diff --git a/.travis.yml b/.travis.yml index 4b5b599e73a..e856f74456d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,4 +22,4 @@ before_script: script: # - mvn -e -B clean install && cd hapi-fhir-ra && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report # - mvn -Dci=true -e -B -P ALLMODULES,NOPARALLEL,ERRORPRONE clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report - - mvn -Dci=true -e -B -P ALLMODULES,MINPARALLEL clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report + - mvn -Dci=true -e -B -P ALLMODULES,MINPARALLEL,ERRORPRONE clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report diff --git a/examples/src/main/java/example/ClientExamples.java b/examples/src/main/java/example/ClientExamples.java index 1c263e23b0d..25a805d8dd8 100644 --- a/examples/src/main/java/example/ClientExamples.java +++ b/examples/src/main/java/example/ClientExamples.java @@ -1,5 +1,6 @@ package example; +import ca.uhn.fhir.rest.api.CacheControlDirective; import org.hl7.fhir.dstu3.model.Bundle; import ca.uhn.fhir.context.FhirContext; @@ -8,6 +9,7 @@ import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.client.apache.GZipContentInterceptor; import ca.uhn.fhir.rest.client.api.*; import ca.uhn.fhir.rest.client.interceptor.*; +import org.hl7.fhir.r4.model.Patient; public class ClientExamples { @@ -52,6 +54,26 @@ public class ClientExamples { // END SNIPPET: processMessage } + @SuppressWarnings("unused") + public void cacheControl() { + FhirContext ctx = FhirContext.forDstu3(); + + // Create the client + IGenericClient client = ctx.newRestfulGenericClient("http://localhost:9999/fhir"); + + Bundle bundle = new Bundle(); + // ..populate the bundle.. + + // START SNIPPET: cacheControl + Bundle response = client + .search() + .forResource(Patient.class) + .returnBundle(Bundle.class) + .cacheControl(new CacheControlDirective().setNoCache(true)) // <-- add a directive + .execute(); + // END SNIPPET: cacheControl + } + @SuppressWarnings("unused") public void createOkHttp() { // START SNIPPET: okhttp diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml index f13b998e86a..8b0168ae690 100644 --- a/hapi-deployable-pom/pom.xml +++ b/hapi-deployable-pom/pom.xml @@ -63,6 +63,65 @@ + + org.basepom.maven + duplicate-finder-maven-plugin + + + default + verify + + check + + true + + + + false + true + true + true + true + false + false + false + false + true + true + 2 + ${project.build.directory}/duplicate-finder-result.xml + + + javax.el + javax.el-api + + + javax.mail + javax.mail-api + + + com.phloc + phloc-commons + + + commons-logging + commons-logging + + + org.jscience + jscience + + + org.springframework + spring-jcl + + + + changelog.txt + javac.bat + + + diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index 30c6c59f62d..5437fbfd16b 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -35,6 +35,25 @@ commons-codec commons-codec + + org.codehaus.woodstox + woodstox-core-asl + + + + + ca.uhn.hapi.fhir + hapi-fhir-client + ${project.version} + + + org.apache.httpcomponents + httpcore + + + org.apache.httpcomponents + httpclient + @@ -92,52 +111,14 @@ - dstu2_shade + it integration-test - verify - **/*Dstu2ShadeIT.java + **/*IT.java - - - org.codehaus.woodstox:woodstox-core-asl - org.codehaus.woodstox:stax2-api - - - - - dstu2 - - integration-test - verify - - - - **/*Dstu2IT.java - - - org.codehaus.woodstox:woodstox-core-asl - org.codehaus.woodstox:stax2-api - - - - - dstu3 - - integration-test - verify - - - - **/*Dstu3IT.java - - - org.codehaus.woodstox:woodstox-core-asl - org.codehaus.woodstox:stax2-api - diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java index edb29a485e7..cd10815159a 100644 --- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java +++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java @@ -9,6 +9,7 @@ import java.util.zip.ZipFile; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.WildcardFileFilter; +import org.junit.Ignore; import org.junit.Test; import ca.uhn.fhir.context.FhirContext; @@ -21,6 +22,7 @@ public class BuiltJarDstu2ShadeIT { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BuiltJarDstu2ShadeIT.class); @Test + @Ignore public void testParserXml() throws Exception { FhirContext ctx = FhirContext.forDstu2(); diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java index 9fa959270f0..aada3596319 100644 --- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java +++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java @@ -7,7 +7,6 @@ import static org.mockito.Mockito.when; import java.io.IOException; import java.util.Date; -import org.apache.http.client.ClientProtocolException; import org.hl7.fhir.dstu3.model.*; import org.junit.*; import org.mockito.ArgumentCaptor; @@ -82,6 +81,7 @@ public class GenericClientDstu3IT { * TODO: narratives don't work without stax */ @Test + @Ignore public void testBinaryCreateWithFhirContentType() throws Exception { IParser p = ourCtx.newXmlParser(); @@ -142,7 +142,7 @@ public class GenericClientDstu3IT { .returnBundle(Bundle.class) .execute(); - assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).url().toString()); + assertEquals("http://example.com/fhir/Patient?_format=json", capt.getAllValues().get(idx).url().toString()); idx++; } @@ -177,12 +177,12 @@ public class GenericClientDstu3IT { Request request = capt.getAllValues().get(0); ourLog.info(request.headers().toString()); - assertEquals("http://example.com/fhir/Binary", request.url().toString()); + assertEquals("http://example.com/fhir/Binary?_format=json", request.url().toString()); validateUserAgent(capt); - assertEquals(Constants.CT_FHIR_XML_NEW + ";charset=utf-8", request.body().contentType().toString().toLowerCase().replace(" ", "")); - assertEquals(Constants.HEADER_ACCEPT_VALUE_XML_NON_LEGACY, request.header("Accept")); - assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, ourCtx.newXmlParser().parseResource(Binary.class, extractBodyAsString(capt)).getContent()); + assertEquals(Constants.CT_FHIR_JSON_NEW + ";charset=utf-8", request.body().contentType().toString().toLowerCase().replace(" ", "")); + assertEquals(Constants.HEADER_ACCEPT_VALUE_JSON_NON_LEGACY, request.header("Accept")); + assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, ourCtx.newJsonParser().parseResource(Binary.class, extractBodyAsString(capt)).getContent()); } @@ -257,11 +257,11 @@ public class GenericClientDstu3IT { assertNotNull(outcome.getResource()); assertEquals("
FINAL VALUE
", ((Patient) outcome.getResource()).getText().getDivAsString()); - assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(0).url().toString()); + assertEquals("http://example.com/fhir/Patient?_format=json", capt.getAllValues().get(0).url().toString()); } - private ArgumentCaptor prepareClientForSearchResponse() throws IOException, ClientProtocolException { + private ArgumentCaptor prepareClientForSearchResponse() throws IOException { final String respString = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}"; myHttpResponse = new Response.Builder() .request(myRequest) diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index c024db6628c..87536543923 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -28,6 +28,7 @@ org.codehaus.woodstox woodstox-core-asl + true @@ -124,6 +125,7 @@ ${argLine} -Dfile.encoding=UTF-8 -Xmx712m + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java index 80fcb05295c..a705ab91fd7 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java @@ -78,6 +78,10 @@ public enum FhirVersionEnum { return myVersionImplementation; } + public boolean isEqualOrNewerThan(FhirVersionEnum theVersion) { + return ordinal() >= theVersion.ordinal(); + } + public boolean isEquivalentTo(FhirVersionEnum theVersion) { if (this.equals(theVersion)) { return true; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java index d3df0dd67e2..af1a5498a84 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java @@ -152,7 +152,8 @@ public class RuntimeSearchParam { public enum RuntimeSearchParamStatusEnum { ACTIVE, DRAFT, - RETIRED + RETIRED, + UNKNOWN } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java index 5bb5dff071f..b22008a078b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java @@ -20,29 +20,29 @@ package ca.uhn.fhir.model.primitive; * #L% */ -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.stream.FactoryConfigurationError; -import javax.xml.stream.XMLEventReader; -import javax.xml.stream.XMLEventWriter; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.events.XMLEvent; - -import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.SimpleSetter; import ca.uhn.fhir.parser.DataFormatException; +import ca.uhn.fhir.util.XmlDetectionUtil; import ca.uhn.fhir.util.XmlUtil; +import java.util.List; + +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +/** + * Note that as of HAPI FHIR 3.1.0, this method no longer uses + * the StAX XMLEvent type as the XML representation, and uses a + * String instead. If you need to work with XML as StAX events, you + * can use the {@link XmlUtil#parse(String)} and {@link XmlUtil#encode(List)} + * methods to do so. + */ @DatatypeDef(name = "xhtml") -public class XhtmlDt extends BasePrimitive> { +public class XhtmlDt extends BasePrimitive { private static final String DECL_XMLNS = " xmlns=\"http://www.w3.org/1999/xhtml\""; - private static final String DIV_OPEN_FIRST = ""; + public static final String DIV_OPEN_FIRST = ""; private static final long serialVersionUID = 1L; /** @@ -54,7 +54,7 @@ public class XhtmlDt extends BasePrimitive> { /** * Constructor which accepts a string code - * + * * @see #setValueAsString(String) for a description of how this value is applied */ @SimpleSetter() @@ -63,29 +63,12 @@ public class XhtmlDt extends BasePrimitive> { } @Override - protected String encode(List theValue) { - try { - StringWriter w = new StringWriter(); - XMLEventWriter ew = XmlUtil.createXmlFragmentWriter(w); - - for (XMLEvent next : getValue()) { - if (next.isCharacters()) { - ew.add(next); - } else { - ew.add(next); - } - } - ew.close(); - return w.toString(); - } catch (XMLStreamException e) { - throw new DataFormatException("Problem with the contained XML events", e); - } catch (FactoryConfigurationError e) { - throw new ConfigurationException(e); - } + protected String encode(String theValue) { + return theValue; } public boolean hasContent() { - return getValue() != null && getValue().size() > 0; + return isNotBlank(getValue()); } @Override @@ -94,40 +77,37 @@ public class XhtmlDt extends BasePrimitive> { } @Override - protected List parse(String theValue) { - String val = theValue.trim(); - if (!val.startsWith("<")) { - val = DIV_OPEN_FIRST + val + ""; - } - boolean hasProcessingInstruction = val.startsWith("")) { - return null; + protected String parse(String theValue) { + if (XmlDetectionUtil.isStaxPresent()) { + // for validation + XmlUtil.parse(theValue); } + return theValue; + } - - try { - ArrayList value = new ArrayList(); - StringReader reader = new StringReader(val); - XMLEventReader er = XmlUtil.createXmlReader(reader); - boolean first = true; - while (er.hasNext()) { - XMLEvent next = er.nextEvent(); - if (first) { - first = false; - continue; - } - if (er.hasNext()) { - // don't add the last event - value.add(next); - } - } - return value; - } catch (XMLStreamException e) { - throw new DataFormatException("String does not appear to be valid XML/XHTML (error is \"" + e.getMessage() + "\"): " + theValue, e); - } catch (FactoryConfigurationError e) { - throw new ConfigurationException(e); - } + /** + * Note that as of HAPI FHIR 3.1.0, this method no longer uses + * the StAX XMLEvent type as the XML representation, and uses a + * String instead. If you need to work with XML as StAX events, you + * can use the {@link XmlUtil#parse(String)} and {@link XmlUtil#encode(List)} + * methods to do so. + */ + @Override + public String getValue() { + return super.getValue(); + } + + /** + * Note that as of HAPI FHIR 3.1.0, this method no longer uses + * the StAX XMLEvent type as the XML representation, and uses a + * String instead. If you need to work with XML as StAX events, you + * can use the {@link XmlUtil#parse(String)} and {@link XmlUtil#encode(List)} + * methods to do so. + */ + @Override + public BasePrimitive setValue(String theValue) throws DataFormatException { + return super.setValue(theValue); } /** @@ -157,7 +137,7 @@ public class XhtmlDt extends BasePrimitive> { if (value.charAt(0) != '<') { value = DIV_OPEN_FIRST + value + ""; } - + boolean hasProcessingInstruction = value.startsWith(" myDontEncodeElements; private boolean myDontEncodeElementsIncludesStars; @@ -556,6 +556,16 @@ public abstract class BaseParser implements IParser { && theIncludedResource == false; } + @Override + public boolean isEncodeElementsAppliesToChildResourcesOnly() { + return myEncodeElementsAppliesToChildResourcesOnly; + } + + @Override + public void setEncodeElementsAppliesToChildResourcesOnly(boolean theEncodeElementsAppliesToChildResourcesOnly) { + myEncodeElementsAppliesToChildResourcesOnly = theEncodeElementsAppliesToChildResourcesOnly; + } + @Override public boolean isOmitResourceId() { return myOmitResourceId; @@ -1039,7 +1049,13 @@ public abstract class BaseParser implements IParser { } private boolean checkIfParentShouldBeEncodedAndBuildPath(StringBuilder thePathBuilder, boolean theStarPass) { - return checkIfPathMatchesForEncoding(thePathBuilder, theStarPass, myEncodeElementsAppliesToResourceTypes, myEncodeElements, true); + Set encodeElements = myEncodeElements; + if (encodeElements != null && encodeElements.isEmpty() == false) { + if (isEncodeElementsAppliesToChildResourcesOnly() && !mySubResource) { + encodeElements = null; + } + } + return checkIfPathMatchesForEncoding(thePathBuilder, theStarPass, myEncodeElementsAppliesToResourceTypes, encodeElements, true); } private boolean checkIfParentShouldNotBeEncodedAndBuildPath(StringBuilder thePathBuilder, boolean theStarPass) { @@ -1058,6 +1074,9 @@ public abstract class BaseParser implements IParser { } else { thePathBuilder.append(myResDef.getName()); } + if (theElements == null) { + return true; + } if (theElements.contains(thePathBuilder.toString())) { return true; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java index d12e681231d..54de21c62b4 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java @@ -206,6 +206,22 @@ public interface IParser { */ void setEncodeElements(Set theEncodeElements); + /** + * If set to true (default is false), the values supplied + * to {@link #setEncodeElements(Set)} will not be applied to the root + * resource (typically a Bundle), but will be applied to any sub-resources + * contained within it (i.e. search result resources in that bundle) + */ + void setEncodeElementsAppliesToChildResourcesOnly(boolean theEncodeElementsAppliesToChildResourcesOnly); + + /** + * If set to true (default is false), the values supplied + * to {@link #setEncodeElements(Set)} will not be applied to the root + * resource (typically a Bundle), but will be applied to any sub-resources + * contained within it (i.e. search result resources in that bundle) + */ + boolean isEncodeElementsAppliesToChildResourcesOnly(); + /** * If provided, tells the parse which resource types to apply {@link #setEncodeElements(Set) encode elements} to. Any * resource types not specified here will be encoded completely, with no elements excluded. diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java index 55aa0bc7a7a..f759cefa6cd 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java @@ -19,19 +19,6 @@ package ca.uhn.fhir.parser; * limitations under the License. * #L% */ -import static org.apache.commons.lang3.StringUtils.*; - -import java.io.*; -import java.math.BigDecimal; -import java.util.*; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.text.WordUtils; -import org.hl7.fhir.instance.model.api.*; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; import ca.uhn.fhir.context.*; import ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum; @@ -46,9 +33,27 @@ import ca.uhn.fhir.parser.json.*; import ca.uhn.fhir.parser.json.JsonLikeValue.ScalarType; import ca.uhn.fhir.parser.json.JsonLikeValue.ValueType; import ca.uhn.fhir.rest.api.EncodingEnum; +import ca.uhn.fhir.util.BinaryUtil; import ca.uhn.fhir.util.ElementUtil; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.text.WordUtils; +import org.hl7.fhir.instance.model.api.*; + +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; + import static ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum.ID_DATATYPE; import static ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum.PRIMITIVE_DATATYPE; +import static org.apache.commons.lang3.StringUtils.*; /** * This class is the FHIR JSON parser/encoder. Users should not interact with this class directly, but should use @@ -88,7 +93,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } private boolean addToHeldExtensions(int valueIdx, List> ext, ArrayList> list, boolean theIsModifier, CompositeChildElement theChildElem, - CompositeChildElement theParent) { + CompositeChildElement theParent) { if (ext.size() > 0) { list.ensureCapacity(valueIdx); while (list.size() <= valueIdx) { @@ -139,12 +144,6 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { return retVal; } - @Override - protected void doEncodeResourceToWriter(IBaseResource theResource, Writer theWriter) throws IOException { - JsonLikeWriter eventWriter = createJsonWriter(theWriter); - doEncodeResourceToJsonLikeWriter(theResource, eventWriter); - } - public void doEncodeResourceToJsonLikeWriter(IBaseResource theResource, JsonLikeWriter theEventWriter) throws IOException { if (myPrettyPrint) { theEventWriter.setPrettyPrint(myPrettyPrint); @@ -156,6 +155,12 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { theEventWriter.flush(); } + @Override + protected void doEncodeResourceToWriter(IBaseResource theResource, Writer theWriter) throws IOException { + JsonLikeWriter eventWriter = createJsonWriter(theWriter); + doEncodeResourceToJsonLikeWriter(theResource, eventWriter); + } + @Override public T doParseResource(Class theResourceType, Reader theReader) { JsonLikeStructure jsonStructure = new GsonStructure(); @@ -191,136 +196,136 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } private void encodeChildElementToStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, IBase theNextValue, - BaseRuntimeElementDefinition theChildDef, String theChildName, boolean theContainedResource, boolean theSubResource, CompositeChildElement theChildElem, - boolean theForceEmpty) throws IOException { + BaseRuntimeElementDefinition theChildDef, String theChildName, boolean theContainedResource, boolean theSubResource, CompositeChildElement theChildElem, + boolean theForceEmpty) throws IOException { switch (theChildDef.getChildType()) { - case ID_DATATYPE: { - IIdType value = (IIdType) theNextValue; - String encodedValue = "id".equals(theChildName) ? value.getIdPart() : value.getValue(); - if (isBlank(encodedValue)) { - break; - } - if (theChildName != null) { - write(theEventWriter, theChildName, encodedValue); - } else { - theEventWriter.write(encodedValue); - } - break; - } - case PRIMITIVE_DATATYPE: { - final IPrimitiveType value = (IPrimitiveType) theNextValue; - if (isBlank(value.getValueAsString())) { - if (theForceEmpty) { - theEventWriter.writeNull(); + case ID_DATATYPE: { + IIdType value = (IIdType) theNextValue; + String encodedValue = "id".equals(theChildName) ? value.getIdPart() : value.getValue(); + if (isBlank(encodedValue)) { + break; + } + if (theChildName != null) { + write(theEventWriter, theChildName, encodedValue); + } else { + theEventWriter.write(encodedValue); } break; } - - if (value instanceof IBaseIntegerDatatype) { - if (theChildName != null) { - write(theEventWriter, theChildName, ((IBaseIntegerDatatype) value).getValue()); - } else { - theEventWriter.write(((IBaseIntegerDatatype) value).getValue()); - } - } else if (value instanceof IBaseDecimalDatatype) { - BigDecimal decimalValue = ((IBaseDecimalDatatype) value).getValue(); - decimalValue = new BigDecimal(decimalValue.toString()) { - private static final long serialVersionUID = 1L; - - @Override - public String toString() { - return value.getValueAsString(); + case PRIMITIVE_DATATYPE: { + final IPrimitiveType value = (IPrimitiveType) theNextValue; + if (isBlank(value.getValueAsString())) { + if (theForceEmpty) { + theEventWriter.writeNull(); } - }; - if (theChildName != null) { - write(theEventWriter, theChildName, decimalValue); - } else { - theEventWriter.write(decimalValue); + break; } - } else if (value instanceof IBaseBooleanDatatype) { - if (theChildName != null) { - write(theEventWriter, theChildName, ((IBaseBooleanDatatype) value).getValue()); + + if (value instanceof IBaseIntegerDatatype) { + if (theChildName != null) { + write(theEventWriter, theChildName, ((IBaseIntegerDatatype) value).getValue()); + } else { + theEventWriter.write(((IBaseIntegerDatatype) value).getValue()); + } + } else if (value instanceof IBaseDecimalDatatype) { + BigDecimal decimalValue = ((IBaseDecimalDatatype) value).getValue(); + decimalValue = new BigDecimal(decimalValue.toString()) { + private static final long serialVersionUID = 1L; + + @Override + public String toString() { + return value.getValueAsString(); + } + }; + if (theChildName != null) { + write(theEventWriter, theChildName, decimalValue); + } else { + theEventWriter.write(decimalValue); + } + } else if (value instanceof IBaseBooleanDatatype) { + if (theChildName != null) { + write(theEventWriter, theChildName, ((IBaseBooleanDatatype) value).getValue()); + } else { + Boolean booleanValue = ((IBaseBooleanDatatype) value).getValue(); + if (booleanValue != null) { + theEventWriter.write(booleanValue.booleanValue()); + } + } } else { - Boolean booleanValue = ((IBaseBooleanDatatype) value).getValue(); - if (booleanValue != null) { - theEventWriter.write(booleanValue.booleanValue()); + String valueStr = value.getValueAsString(); + if (theChildName != null) { + write(theEventWriter, theChildName, valueStr); + } else { + theEventWriter.write(valueStr); } } - } else { - String valueStr = value.getValueAsString(); + break; + } + case RESOURCE_BLOCK: + case COMPOSITE_DATATYPE: { if (theChildName != null) { - write(theEventWriter, theChildName, valueStr); + theEventWriter.beginObject(theChildName); } else { - theEventWriter.write(valueStr); + theEventWriter.beginObject(); } + encodeCompositeElementToStreamWriter(theResDef, theResource, theNextValue, theEventWriter, theContainedResource, theSubResource, theChildElem); + theEventWriter.endObject(); + break; } - break; - } - case RESOURCE_BLOCK: - case COMPOSITE_DATATYPE: { - if (theChildName != null) { - theEventWriter.beginObject(theChildName); - } else { - theEventWriter.beginObject(); - } - encodeCompositeElementToStreamWriter(theResDef, theResource, theNextValue, theEventWriter, theContainedResource, theSubResource, theChildElem); - theEventWriter.endObject(); - break; - } - case CONTAINED_RESOURCE_LIST: - case CONTAINED_RESOURCES: { + case CONTAINED_RESOURCE_LIST: + case CONTAINED_RESOURCES: { /* * Disabled per #103 ContainedDt value = (ContainedDt) theNextValue; for (IResource next : * value.getContainedResources()) { if (getContainedResources().getResourceId(next) != null) { continue; } * encodeResourceToJsonStreamWriter(theResDef, next, theWriter, null, true, * fixContainedResourceId(next.getId().getValue())); } */ - List containedResources = getContainedResources().getContainedResources(); - if (containedResources.size() > 0) { - beginArray(theEventWriter, theChildName); + List containedResources = getContainedResources().getContainedResources(); + if (containedResources.size() > 0) { + beginArray(theEventWriter, theChildName); - for (IBaseResource next : containedResources) { - IIdType resourceId = getContainedResources().getResourceId(next); - encodeResourceToJsonStreamWriter(theResDef, next, theEventWriter, null, true, false, fixContainedResourceId(resourceId.getValue())); - } + for (IBaseResource next : containedResources) { + IIdType resourceId = getContainedResources().getResourceId(next); + encodeResourceToJsonStreamWriter(theResDef, next, theEventWriter, null, true, false, fixContainedResourceId(resourceId.getValue())); + } - theEventWriter.endArray(); - } - break; - } - case PRIMITIVE_XHTML_HL7ORG: - case PRIMITIVE_XHTML: { - if (!isSuppressNarratives()) { - IPrimitiveType dt = (IPrimitiveType) theNextValue; - if (theChildName != null) { - write(theEventWriter, theChildName, dt.getValueAsString()); - } else { - theEventWriter.write(dt.getValueAsString()); - } - } else { - if (theChildName != null) { - // do nothing - } else { - theEventWriter.writeNull(); + theEventWriter.endArray(); } + break; } - break; - } - case RESOURCE: - IBaseResource resource = (IBaseResource) theNextValue; - RuntimeResourceDefinition def = myContext.getResourceDefinition(resource); - encodeResourceToJsonStreamWriter(def, resource, theEventWriter, theChildName, false, true); - break; - case UNDECL_EXT: - default: - throw new IllegalStateException("Should not have this state here: " + theChildDef.getChildType().name()); + case PRIMITIVE_XHTML_HL7ORG: + case PRIMITIVE_XHTML: { + if (!isSuppressNarratives()) { + IPrimitiveType dt = (IPrimitiveType) theNextValue; + if (theChildName != null) { + write(theEventWriter, theChildName, dt.getValueAsString()); + } else { + theEventWriter.write(dt.getValueAsString()); + } + } else { + if (theChildName != null) { + // do nothing + } else { + theEventWriter.writeNull(); + } + } + break; + } + case RESOURCE: + IBaseResource resource = (IBaseResource) theNextValue; + RuntimeResourceDefinition def = myContext.getResourceDefinition(resource); + encodeResourceToJsonStreamWriter(def, resource, theEventWriter, theChildName, false, true); + break; + case UNDECL_EXT: + default: + throw new IllegalStateException("Should not have this state here: " + theChildDef.getChildType().name()); } } private void encodeCompositeElementChildrenToStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, IBase theElement, JsonLikeWriter theEventWriter, - boolean theContainedResource, boolean theSubResource, CompositeChildElement theParent) throws IOException { + boolean theContainedResource, boolean theSubResource, CompositeChildElement theParent) throws IOException { { String elementId = getCompositeElementId(theElement); @@ -335,7 +340,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { BaseRuntimeChildDefinition nextChild = nextChildElem.getDef(); if (nextChildElem.getDef().getElementName().equals("extension") || nextChildElem.getDef().getElementName().equals("modifierExtension") - || nextChild instanceof RuntimeChildDeclaredExtensionDefinition) { + || nextChild instanceof RuntimeChildDeclaredExtensionDefinition) { if (!haveWrittenExtensions) { extractAndWriteExtensionsAsDirectChild(theElement, theEventWriter, myContext.getElementDefinition(theElement.getClass()), theResDef, theResource, nextChildElem, theParent); haveWrittenExtensions = true; @@ -451,15 +456,15 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { if (nextChild.getMax() > 1 || nextChild.getMax() == Child.MAX_UNLIMITED) { beginArray(theEventWriter, childName); inArray = true; - encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource, theSubResource,nextChildElem, force); + encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource, theSubResource, nextChildElem, force); } else if (nextChild instanceof RuntimeChildNarrativeDefinition && theContainedResource) { // suppress narratives from contained resources } else { - encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, childName, theContainedResource, theSubResource,nextChildElem, false); + encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, childName, theContainedResource, theSubResource, nextChildElem, false); } currentChildName = childName; } else { - encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource,theSubResource, nextChildElem, force); + encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource, theSubResource, nextChildElem, force); } valueIdx++; @@ -541,7 +546,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } private void encodeCompositeElementToStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, IBase theNextValue, JsonLikeWriter theEventWriter, boolean theContainedResource, boolean theSubResource, - CompositeChildElement theParent) throws IOException, DataFormatException { + CompositeChildElement theParent) throws IOException, DataFormatException { writeCommentsPreAndPost(theNextValue, theEventWriter); encodeCompositeElementChildrenToStreamWriter(theResDef, theResource, theNextValue, theEventWriter, theContainedResource, theSubResource, theParent); @@ -554,14 +559,14 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { if (theResource.getStructureFhirVersionEnum() != myContext.getVersion().getVersion()) { throw new IllegalArgumentException( - "This parser is for FHIR version " + myContext.getVersion().getVersion() + " - Can not encode a structure for version " + theResource.getStructureFhirVersionEnum()); + "This parser is for FHIR version " + myContext.getVersion().getVersion() + " - Can not encode a structure for version " + theResource.getStructureFhirVersionEnum()); } doEncodeResourceToJsonLikeWriter(theResource, theJsonLikeWriter); } private void encodeResourceToJsonStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, String theObjectNameOrNull, - boolean theContainedResource, boolean theSubResource) throws IOException { + boolean theContainedResource, boolean theSubResource) throws IOException { IIdType resourceId = null; // if (theResource instanceof IResource) { // IResource res = (IResource) theResource; @@ -598,7 +603,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } private void encodeResourceToJsonStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, String theObjectNameOrNull, - boolean theContainedResource, boolean theSubResource, IIdType theResourceId) throws IOException { + boolean theContainedResource, boolean theSubResource, IIdType theResourceId) throws IOException { if (!theContainedResource) { super.containResourcesForEncoding(theResource); } @@ -612,28 +617,28 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } write(theEventWriter, "resourceType", resDef.getName()); - if (theResourceId != null && theResourceId.hasIdPart()) { - write(theEventWriter, "id", theResourceId.getIdPart()); - final List extensions = new ArrayList(0); - final List modifierExtensions = new ArrayList(0); - // Undeclared extensions - extractUndeclaredExtensions(theResourceId, extensions, modifierExtensions, null, null); - boolean haveExtension = false; - if (!extensions.isEmpty()) { - haveExtension = true; - } + if (theResourceId != null && theResourceId.hasIdPart()) { + write(theEventWriter, "id", theResourceId.getIdPart()); + final List extensions = new ArrayList(0); + final List modifierExtensions = new ArrayList(0); + // Undeclared extensions + extractUndeclaredExtensions(theResourceId, extensions, modifierExtensions, null, null); + boolean haveExtension = false; + if (!extensions.isEmpty()) { + haveExtension = true; + } - if (theResourceId.hasFormatComment() || haveExtension) { - beginObject(theEventWriter, "_id"); - if (theResourceId.hasFormatComment()) { - writeCommentsPreAndPost(theResourceId, theEventWriter); - } - if (haveExtension) { - writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions); - } - theEventWriter.endObject(); - } - } + if (theResourceId.hasFormatComment() || haveExtension) { + beginObject(theEventWriter, "_id"); + if (theResourceId.hasFormatComment()) { + writeCommentsPreAndPost(theResourceId, theEventWriter); + } + if (haveExtension) { + writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions); + } + theEventWriter.endObject(); + } + } if (theResource instanceof IResource) { IResource resource = (IResource) theResource; @@ -695,19 +700,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } } - if (theResource instanceof IBaseBinary) { - IBaseBinary bin = (IBaseBinary) theResource; - String contentType = bin.getContentType(); - if (isNotBlank(contentType)) { - write(theEventWriter, "contentType", contentType); - } - String contentAsBase64 = bin.getContentAsBase64(); - if (isNotBlank(contentAsBase64)) { - write(theEventWriter, "content", contentAsBase64); - } - } else { - encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource)); - } + encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource)); theEventWriter.endObject(); } @@ -715,12 +708,12 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { /** * This is useful only for the two cases where extensions are encoded as direct children (e.g. not in some object * called _name): resource extensions, and extension extensions - * + * * @param theChildElem * @param theParent */ private void extractAndWriteExtensionsAsDirectChild(IBase theElement, JsonLikeWriter theEventWriter, BaseRuntimeElementDefinition theElementDef, RuntimeResourceDefinition theResDef, - IBaseResource theResource, CompositeChildElement theChildElem, CompositeChildElement theParent) throws IOException { + IBaseResource theResource, CompositeChildElement theChildElem, CompositeChildElement theParent) throws IOException { List extensions = new ArrayList(0); List modifierExtensions = new ArrayList(0); @@ -737,7 +730,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } private void extractDeclaredExtensions(IBase theResource, BaseRuntimeElementDefinition resDef, List extensions, List modifierExtensions, - CompositeChildElement theChildElem) { + CompositeChildElement theChildElem) { for (RuntimeChildDeclaredExtensionDefinition nextDef : resDef.getExtensionsNonModifier()) { for (IBase nextValue : nextDef.getAccessor().getValues(theResource)) { if (nextValue != null) { @@ -761,7 +754,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } private void extractUndeclaredExtensions(IBase theElement, List extensions, List modifierExtensions, CompositeChildElement theChildElem, - CompositeChildElement theParent) { + CompositeChildElement theParent) { if (theElement instanceof ISupportsUndeclaredExtensions) { ISupportsUndeclaredExtensions element = (ISupportsUndeclaredExtensions) theElement; List ext = element.getUndeclaredExtensions(); @@ -1029,78 +1022,78 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } } - private void parseExtension(ParserState theState, JsonLikeArray theValues, boolean theIsModifier) { - int allUnderscoreNames = 0; - int handledUnderscoreNames = 0; + private void parseExtension(ParserState theState, JsonLikeArray theValues, boolean theIsModifier) { + int allUnderscoreNames = 0; + int handledUnderscoreNames = 0; + + for (int i = 0; i < theValues.size(); i++) { + JsonLikeObject nextExtObj = JsonLikeValue.asObject(theValues.get(i)); + JsonLikeValue jsonElement = nextExtObj.get("url"); + String url; + if (null == jsonElement || !(jsonElement.isScalar())) { + String parentElementName; + if (theIsModifier) { + parentElementName = "modifierExtension"; + } else { + parentElementName = "extension"; + } + getErrorHandler().missingRequiredElement(new ParseLocation(parentElementName), "url"); + url = null; + } else { + url = getExtensionUrl(jsonElement.getAsString()); + } + theState.enteringNewElementExtension(null, url, theIsModifier, getServerBaseUrl()); + for (String next : nextExtObj.keySet()) { + if ("url".equals(next)) { + continue; + } else if ("extension".equals(next)) { + JsonLikeArray jsonVal = JsonLikeValue.asArray(nextExtObj.get(next)); + parseExtension(theState, jsonVal, false); + } else if ("modifierExtension".equals(next)) { + JsonLikeArray jsonVal = JsonLikeValue.asArray(nextExtObj.get(next)); + parseExtension(theState, jsonVal, true); + } else if (next.charAt(0) == '_') { + allUnderscoreNames++; + continue; + } else { + JsonLikeValue jsonVal = nextExtObj.get(next); + String alternateName = '_' + next; + JsonLikeValue alternateVal = nextExtObj.get(alternateName); + if (alternateVal != null) { + handledUnderscoreNames++; + } + parseChildren(theState, next, jsonVal, alternateVal, alternateName, false); + } + } - for (int i = 0; i < theValues.size(); i++) { - JsonLikeObject nextExtObj = JsonLikeValue.asObject(theValues.get(i)); - JsonLikeValue jsonElement = nextExtObj.get("url"); - String url; - if (null == jsonElement || !(jsonElement.isScalar())) { - String parentElementName; - if (theIsModifier) { - parentElementName = "modifierExtension"; - } else { - parentElementName = "extension"; - } - getErrorHandler().missingRequiredElement(new ParseLocation(parentElementName), "url"); - url = null; - } else { - url = getExtensionUrl(jsonElement.getAsString()); - } - theState.enteringNewElementExtension(null, url, theIsModifier, getServerBaseUrl()); - for (String next : nextExtObj.keySet()) { - if ("url".equals(next)) { - continue; - } else if ("extension".equals(next)) { - JsonLikeArray jsonVal = JsonLikeValue.asArray(nextExtObj.get(next)); - parseExtension(theState, jsonVal, false); - } else if ("modifierExtension".equals(next)) { - JsonLikeArray jsonVal = JsonLikeValue.asArray(nextExtObj.get(next)); - parseExtension(theState, jsonVal, true); - } else if (next.charAt(0) == '_') { - allUnderscoreNames++; - continue; - } else { - JsonLikeValue jsonVal = nextExtObj.get(next); - String alternateName = '_' + next; - JsonLikeValue alternateVal = nextExtObj.get(alternateName); - if (alternateVal != null) { - handledUnderscoreNames++; - } - parseChildren(theState, next, jsonVal, alternateVal, alternateName, false); - } - } - /* - * This happens if an element has an extension but no actual value. I.e. + * This happens if an element has an extension but no actual value. I.e. * if a resource has a "_status" element but no corresponding "status" * element. This could be used to handle a null value with an extension * for example. */ - if (allUnderscoreNames > handledUnderscoreNames) { - for (String alternateName : nextExtObj.keySet()) { - if (alternateName.startsWith("_") && alternateName.length() > 1) { - JsonLikeValue nextValue = nextExtObj.get(alternateName); - if (nextValue != null) { - if (nextValue.isObject()) { - String nextName = alternateName.substring(1); - if (nextExtObj.get(nextName) == null) { - theState.enteringNewElement(null, nextName); - parseAlternates(nextValue, theState, alternateName, alternateName); - theState.endingElement(); - } - } else { - getErrorHandler().incorrectJsonType(null, alternateName, ValueType.OBJECT, null, nextValue.getJsonType(), null); - } - } - } - } - } - theState.endingElement(); - } - } + if (allUnderscoreNames > handledUnderscoreNames) { + for (String alternateName : nextExtObj.keySet()) { + if (alternateName.startsWith("_") && alternateName.length() > 1) { + JsonLikeValue nextValue = nextExtObj.get(alternateName); + if (nextValue != null) { + if (nextValue.isObject()) { + String nextName = alternateName.substring(1); + if (nextExtObj.get(nextName) == null) { + theState.enteringNewElement(null, nextName); + parseAlternates(nextValue, theState, alternateName, alternateName); + theState.endingElement(); + } + } else { + getErrorHandler().incorrectJsonType(null, alternateName, ValueType.OBJECT, null, nextValue.getJsonType(), null); + } + } + } + } + } + theState.endingElement(); + } + } private void parseFhirComments(JsonLikeValue theObject, ParserState theState) { if (theObject.isArray()) { @@ -1254,7 +1247,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } private void writeExtensionsAsDirectChild(IBaseResource theResource, JsonLikeWriter theEventWriter, RuntimeResourceDefinition resDef, List extensions, - List modifierExtensions) throws IOException { + List modifierExtensions) throws IOException { if (extensions.isEmpty() == false) { beginArray(theEventWriter, "extension"); for (HeldExtension next : extensions) { @@ -1328,6 +1321,28 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { return url1.compareTo(url2); } + private void managePrimitiveExtension(final IBase theValue, final RuntimeResourceDefinition theResDef, final IBaseResource theResource, final JsonLikeWriter theEventWriter, final BaseRuntimeElementDefinition def, final String childName) throws IOException { + if (def.getChildType().equals(ID_DATATYPE) || def.getChildType().equals(PRIMITIVE_DATATYPE)) { + final List extensions = new ArrayList(0); + final List modifierExtensions = new ArrayList(0); + // Undeclared extensions + extractUndeclaredExtensions(theValue, extensions, modifierExtensions, myParent, null); + // Declared extensions + if (def != null) { + extractDeclaredExtensions(theValue, def, extensions, modifierExtensions, myParent); + } + boolean haveContent = false; + if (!extensions.isEmpty() || !modifierExtensions.isEmpty()) { + haveContent = true; + } + if (haveContent) { + beginObject(theEventWriter, '_' + childName); + writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions); + theEventWriter.endObject(); + } + } + } + public void write(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter) throws IOException { if (myUndeclaredExtension != null) { writeUndeclaredExtension(theResDef, theResource, theEventWriter, myUndeclaredExtension); @@ -1341,7 +1356,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { /* * This makes sure that even if the extension contains a reference to a contained * resource which has a HAPI-assigned ID we'll still encode that ID. - * + * * See #327 */ List preProcessedValue = preProcessValues(myDef, theResource, Collections.singletonList(myValue), myChildElem); @@ -1367,7 +1382,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { } else { String childName = myDef.getChildNameByDatatype(myValue.getClass()); encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, myValue, def, childName, false, false, myParent, false); - managePrimitiveExtension(myValue, theResDef, theResource, theEventWriter, def, childName); + managePrimitiveExtension(myValue, theResDef, theResource, theEventWriter, def, childName); } theEventWriter.endObject(); @@ -1422,34 +1437,12 @@ public class JsonParser extends BaseParser implements IJsonLikeParser { throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + value.getClass().getCanonicalName()); } encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, value, childDef, childName, true, false, myParent, false); - managePrimitiveExtension(value, theResDef, theResource, theEventWriter, childDef, childName); + managePrimitiveExtension(value, theResDef, theResource, theEventWriter, childDef, childName); } // theEventWriter.name(myUndeclaredExtension.get); theEventWriter.endObject(); } - - private void managePrimitiveExtension(final IBase theValue, final RuntimeResourceDefinition theResDef, final IBaseResource theResource, final JsonLikeWriter theEventWriter, final BaseRuntimeElementDefinition def, final String childName) throws IOException { - if (def.getChildType().equals(ID_DATATYPE) || def.getChildType().equals(PRIMITIVE_DATATYPE)) { - final List extensions = new ArrayList(0); - final List modifierExtensions = new ArrayList(0); - // Undeclared extensions - extractUndeclaredExtensions(theValue, extensions, modifierExtensions, myParent, null); - // Declared extensions - if (def != null) { - extractDeclaredExtensions(theValue, def, extensions, modifierExtensions, myParent); - } - boolean haveContent = false; - if (!extensions.isEmpty() || !modifierExtensions.isEmpty()) { - haveContent = true; - } - if (haveContent) { - beginObject(theEventWriter, '_' + childName); - writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions); - theEventWriter.endObject(); - } - } - } - } + } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java index ce00a0dcbdd..e54793602c6 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java @@ -606,7 +606,7 @@ class ParserState { return; } case RESOURCE: { - if (myInstance instanceof IAnyResource || myInstance instanceof IBaseBackboneElement) { + if (myInstance instanceof IAnyResource || myInstance instanceof IBaseBackboneElement || myInstance instanceof IBaseElement) { ParserState.PreResourceStateHl7Org state = new PreResourceStateHl7Org(myInstance, child.getMutator(), null); push(state); } else { @@ -1559,7 +1559,8 @@ class ParserState { if (theEvent.isEndElement()) { if (myDepth == 0) { - myDt.setValue(myEvents); + String eventsAsString = XmlUtil.encode(myEvents); + myDt.setValue(eventsAsString); doPop(); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java index 1a577c5d567..f79d1130428 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java @@ -24,6 +24,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; import java.io.Reader; +import java.io.StringReader; import java.io.Writer; import java.util.*; @@ -605,13 +606,16 @@ public class XmlParser extends BaseParser /* implements IParser */ { } } + private void encodeXhtml(XhtmlDt theDt, XMLStreamWriter theEventWriter) throws XMLStreamException { if (theDt == null || theDt.getValue() == null) { return; } + List events = XmlUtil.parse(theDt.getValue()); boolean firstElement = true; - for (XMLEvent event : theDt.getValue()) { + + for (XMLEvent event : events) { switch (event.getEventType()) { case XMLStreamConstants.ATTRIBUTE: Attribute attr = (Attribute) event; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/CacheControlDirective.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/CacheControlDirective.java new file mode 100644 index 00000000000..bb9ab1b1326 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/CacheControlDirective.java @@ -0,0 +1,128 @@ +package ca.uhn.fhir.rest.api; + +/*- + * #%L + * HAPI FHIR - Core Library + * %% + * Copyright (C) 2014 - 2017 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.StringTokenizer; + +import static org.apache.commons.lang3.StringUtils.trim; + +/** + * Parses and stores the value(s) within HTTP Cache-Control headers + */ +public class CacheControlDirective { + + private static final String MAX_RESULTS_EQUALS = Constants.CACHE_CONTROL_MAX_RESULTS + "="; + private static final Logger ourLog = LoggerFactory.getLogger(CacheControlDirective.class); + private boolean myNoCache; + private boolean myNoStore; + private Integer myMaxResults; + + /** + * Constructor + */ + public CacheControlDirective() { + super(); + } + + /** + * If the {@link #isNoStore() no-store} directive is set, this HAPI FHIR extention + * to the Cache-Control header called max-results=123 + * specified the maximum number of results which will be fetched from the + * database before returning. + */ + public Integer getMaxResults() { + return myMaxResults; + } + + /** + * If the {@link #isNoStore() no-store} directive is set, this HAPI FHIR extention + * to the Cache-Control header called max-results=123 + * specified the maximum number of results which will be fetched from the + * database before returning. + */ + public CacheControlDirective setMaxResults(Integer theMaxResults) { + myMaxResults = theMaxResults; + return this; + } + + /** + * If true<, adds the no-cache directive to the + * request. This directive indicates that the cache should not be used to + * serve this request. + */ + public boolean isNoCache() { + return myNoCache; + } + + /** + * If true<, adds the no-cache directive to the + * request. This directive indicates that the cache should not be used to + * serve this request. + */ + public CacheControlDirective setNoCache(boolean theNoCache) { + myNoCache = theNoCache; + return this; + } + + public boolean isNoStore() { + return myNoStore; + } + + public CacheControlDirective setNoStore(boolean theNoStore) { + myNoStore = theNoStore; + return this; + } + + /** + * Parses a list of Cache-Control header values + * + * @param theValues The Cache-Control header values + */ + public CacheControlDirective parse(List theValues) { + if (theValues != null) { + for (String nextValue : theValues) { + StringTokenizer tok = new StringTokenizer(nextValue, ","); + while (tok.hasMoreTokens()) { + String next = trim(tok.nextToken()); + if (Constants.CACHE_CONTROL_NO_CACHE.equals(next)) { + myNoCache = true; + } else if (Constants.CACHE_CONTROL_NO_STORE.equals(next)) { + myNoStore = true; + } else if (next.startsWith(MAX_RESULTS_EQUALS)) { + String valueString = trim(next.substring(MAX_RESULTS_EQUALS.length())); + try { + myMaxResults = Integer.parseInt(valueString); + } catch (NumberFormatException e) { + ourLog.warn("Invalid {} value: {}", Constants.CACHE_CONTROL_MAX_RESULTS, valueString); + } + + } + } + } + } + + return this; + } +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java index 4d067c33677..7b78de58f85 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java @@ -25,9 +25,22 @@ import java.util.*; public class Constants { + public static final String CACHE_CONTROL_MAX_RESULTS = "max-results"; + public static final String CACHE_CONTROL_NO_CACHE = "no-cache"; + public static final String CACHE_CONTROL_NO_STORE = "no-store"; public static final String CHARSET_NAME_UTF8 = "UTF-8"; public static final Charset CHARSET_UTF8; public static final String CHARSET_UTF8_CTSUFFIX = "; charset=" + CHARSET_NAME_UTF8; + /** + * Contains a standard set of headers which are used by FHIR / HAPI FHIR, and therefore + * would make a useful set for CORS AllowedHeader declarations + */ + public static final Set CORS_ALLOWED_HEADERS; + /** + * Contains a standard set of HTTP Methods which are used by FHIR / HAPI FHIR, and therefore + * would make a useful set for CORS AllowedMethod declarations + */ + public static final Set CORS_ALLWED_METHODS; public static final String CT_FHIR_JSON = "application/json+fhir"; public static final String CT_FHIR_JSON_NEW = "application/fhir+json"; public static final String CT_FHIR_XML = "application/xml+fhir"; @@ -67,6 +80,7 @@ public class Constants { public static final String HEADER_AUTHORIZATION = "Authorization"; public static final String HEADER_AUTHORIZATION_VALPREFIX_BASIC = "Basic "; public static final String HEADER_AUTHORIZATION_VALPREFIX_BEARER = "Bearer "; + public static final String HEADER_CACHE_CONTROL = "Cache-Control"; public static final String HEADER_CONTENT_DISPOSITION = "Content-Disposition"; public static final String HEADER_CONTENT_ENCODING = "Content-Encoding"; public static final String HEADER_CONTENT_LOCATION = "Content-Location"; @@ -172,12 +186,13 @@ public class Constants { public static final String URL_TOKEN_METADATA = "metadata"; public static final String OO_INFOSTATUS_PROCESSING = "processing"; public static final String PARAM_GRAPHQL_QUERY = "query"; + public static final String HEADER_X_CACHE = "X-Cache"; + public static final String HEADER_X_SECURITY_CONTEXT = "X-Security-Context"; static { CHARSET_UTF8 = Charset.forName(CHARSET_NAME_UTF8); - HashMap statusNames = new HashMap(); - + HashMap statusNames = new HashMap<>(); statusNames.put(200, "OK"); statusNames.put(201, "Created"); statusNames.put(202, "Accepted"); @@ -242,11 +257,31 @@ public class Constants { statusNames.put(511, "Network Authentication Required"); HTTP_STATUS_NAMES = Collections.unmodifiableMap(statusNames); - Set formatsHtml = new HashSet(); + Set formatsHtml = new HashSet<>(); formatsHtml.add(CT_HTML); formatsHtml.add(FORMAT_HTML); FORMATS_HTML = Collections.unmodifiableSet(formatsHtml); - + + // ********************************************************* + // Update CorsInterceptor's constructor documentation if you change these: + // ********************************************************* + HashSet corsAllowedHeaders = new HashSet<>(); + corsAllowedHeaders.add("Accept"); + corsAllowedHeaders.add("Access-Control-Request-Headers"); + corsAllowedHeaders.add("Access-Control-Request-Method"); + corsAllowedHeaders.add("Cache-Control"); + corsAllowedHeaders.add("Content-Type"); + corsAllowedHeaders.add("Origin"); + corsAllowedHeaders.add("Prefer"); + corsAllowedHeaders.add("X-Requested-With"); + CORS_ALLOWED_HEADERS = Collections.unmodifiableSet(corsAllowedHeaders); + + // ********************************************************* + // Update CorsInterceptor's constructor documentation if you change these: + // ********************************************************* + HashSet corsAllowedMethods = new HashSet<>(); + corsAllowedMethods.addAll(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH")); + CORS_ALLWED_METHODS = Collections.unmodifiableSet(corsAllowedMethods); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/IVersionSpecificBundleFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/IVersionSpecificBundleFactory.java index b9154445d6e..947044070eb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/IVersionSpecificBundleFactory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/IVersionSpecificBundleFactory.java @@ -35,7 +35,7 @@ public interface IVersionSpecificBundleFactory { void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes); - void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType theLastUpdated); + void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType theLastUpdated); IBaseResource getResourceBundle(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IClientExecutable.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IClientExecutable.java index b345a6d02b2..bb08eb5a677 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IClientExecutable.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IClientExecutable.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.rest.gclient; +import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.SummaryEnum; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -38,6 +39,12 @@ public interface IClientExecutable, Y> { @Deprecated T andLogRequestAndResponse(boolean theLogRequestAndResponse); + /** + * Sets the Cache-Control header value, which advises the server (or any cache in front of it) + * how to behave in terms of cached requests + */ + T cacheControl(CacheControlDirective theCacheControlDirective); + /** * Request that the server return subsetted resources, containing only the elements specified in the given parameters. * For example: subsetElements("name", "identifier") requests that the server only return diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/BinaryUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/BinaryUtil.java new file mode 100644 index 00000000000..b6c4411c8f3 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/BinaryUtil.java @@ -0,0 +1,47 @@ +package ca.uhn.fhir.util; + +import ca.uhn.fhir.context.BaseRuntimeChildDefinition; +import ca.uhn.fhir.context.BaseRuntimeElementDefinition; +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.context.RuntimeResourceDefinition; +import org.hl7.fhir.instance.model.api.IBase; +import org.hl7.fhir.instance.model.api.IBaseBinary; +import org.hl7.fhir.instance.model.api.IBaseReference; + +import java.util.List; + +public class BinaryUtil { + + private BinaryUtil() { + // non instantiable + } + + public static IBaseReference getSecurityContext(FhirContext theCtx, IBaseBinary theBinary) { + RuntimeResourceDefinition def = theCtx.getResourceDefinition("Binary"); + BaseRuntimeChildDefinition child = def.getChildByName("securityContext"); + IBaseReference retVal = null; + if (child != null) { + List values = child.getAccessor().getValues(theBinary); + if (values.size() > 0) { + retVal = (IBaseReference) values.get(0); + } + } + return retVal; + } + + public static IBaseBinary newBinary(FhirContext theCtx) { + return (IBaseBinary) theCtx.getResourceDefinition("Binary").newInstance(); + } + + public static void setSecurityContext(FhirContext theCtx, IBaseBinary theBinary, String theSecurityContext) { + RuntimeResourceDefinition def = theCtx.getResourceDefinition("Binary"); + BaseRuntimeChildDefinition child = def.getChildByName("securityContext"); + + BaseRuntimeElementDefinition referenceDef = theCtx.getElementDefinition("reference"); + IBaseReference reference = (IBaseReference) referenceDef.newInstance(); + child.getMutator().addValue(theBinary, reference); + + reference.setReference(theSecurityContext); + } + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java index 620e36dbbc4..0ec0fe86848 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java @@ -21,12 +21,14 @@ package ca.uhn.fhir.util; */ import java.net.ServerSocket; +import java.util.LinkedHashSet; /** * Provides server ports */ @CoverageIgnore public class PortUtil { + private static LinkedHashSet ourPorts = new LinkedHashSet<>(); /* * Non instantiable @@ -41,9 +43,13 @@ public class PortUtil { public static int findFreePort() { ServerSocket server; try { - server = new ServerSocket(0); - int port = server.getLocalPort(); - server.close(); + int port; + do { + server = new ServerSocket(0); + port = server.getLocalPort(); + server.close(); + } while (!ourPorts.add(port)); + Thread.sleep(500); return port; } catch (Exception e) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java index a9aca692015..3e1347dafcb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java @@ -20,33 +20,34 @@ package ca.uhn.fhir.util; * #L% */ +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.i18n.HapiLocalizer; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.LoggerContext; +import org.slf4j.LoggerFactory; + import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.Locale; import java.util.TimeZone; -import org.slf4j.LoggerFactory; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.i18n.HapiLocalizer; -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import ch.qos.logback.classic.LoggerContext; +import static org.apache.commons.lang3.StringUtils.defaultString; public class TestUtil { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TestUtil.class); /** * THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODE - * + *

* When we run the unit tests in cobertura, JUnit doesn't seem to clean up static fields which leads to * tons of memory being used by the end and the JVM crashes in Travis. Manually clearing all of the * static fields seems to solve this. */ public static void clearAllStaticFieldsForUnitTest() { HapiLocalizer.setOurFailOnMissingMessage(true); - + Class theType; try { throw new Exception(); @@ -104,7 +105,7 @@ public class TestUtil { * environment */ public static void randomizeLocale() { - Locale[] availableLocales = { Locale.CANADA, Locale.GERMANY, Locale.TAIWAN }; + Locale[] availableLocales = {Locale.CANADA, Locale.GERMANY, Locale.TAIWAN}; Locale.setDefault(availableLocales[(int) (Math.random() * availableLocales.length)]); ourLog.info("Tests are running in locale: " + Locale.getDefault().getDisplayName()); if (Math.random() < 0.5) { @@ -116,10 +117,19 @@ public class TestUtil { System.setProperty("file.encoding", "UTF-8"); System.setProperty("line.separator", "\n"); } - String availableTimeZones[] = { "GMT+08:00", "GMT-05:00", "GMT+00:00", "GMT+03:30" }; + String availableTimeZones[] = {"GMT+08:00", "GMT-05:00", "GMT+00:00", "GMT+03:30"}; String timeZone = availableTimeZones[(int) (Math.random() * availableTimeZones.length)]; TimeZone.setDefault(TimeZone.getTimeZone(timeZone)); ourLog.info("Tests are using time zone: {}", TimeZone.getDefault().getID()); } + /** + * THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODE + *

+ * Strip \r chars from a string to account for line ending platform differences + */ + public static String stripReturns(String theString) { + return defaultString(theString).replace("\r", ""); + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlDetectionUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlDetectionUtil.java new file mode 100644 index 00000000000..4619418d7c8 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlDetectionUtil.java @@ -0,0 +1,57 @@ +package ca.uhn.fhir.util; + +/*- + * #%L + * HAPI FHIR - Core Library + * %% + * Copyright (C) 2014 - 2017 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.Reader; +import java.io.StringReader; + +public class XmlDetectionUtil { + + private static final Logger ourLog = LoggerFactory.getLogger(XmlDetectionUtil.class); + private static Boolean ourStaxPresent; + + /** + * This method will return true if a StAX XML parsing library is present + * on the classpath + */ + public static boolean isStaxPresent() { + Boolean retVal = ourStaxPresent; + if (retVal == null) { + try { + Class.forName("javax.xml.stream.events.XMLEvent"); + Class xmlUtilClazz = Class.forName("ca.uhn.fhir.util.XmlUtil"); + xmlUtilClazz.getMethod("createXmlReader", Reader.class).invoke(xmlUtilClazz, new StringReader("")); + ourStaxPresent = Boolean.TRUE; + retVal = Boolean.TRUE; + } catch (Throwable t) { + ourLog.info("StAX not detected on classpath, XML processing will be disabled"); + ourStaxPresent = Boolean.FALSE; + retVal = Boolean.FALSE; + } + } + return retVal; + } + + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java index c42fc0d42e8..301bdfe42ba 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java @@ -20,12 +20,13 @@ package ca.uhn.fhir.util; * #L% */ import java.io.*; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.*; import javax.xml.stream.*; +import javax.xml.stream.events.XMLEvent; +import ca.uhn.fhir.model.primitive.XhtmlDt; +import ca.uhn.fhir.parser.DataFormatException; import org.apache.commons.lang3.StringEscapeUtils; import org.codehaus.stax2.XMLOutputFactory2; import org.codehaus.stax2.io.EscapingWriterFactory; @@ -37,21 +38,22 @@ import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.util.jar.DependencyLogFactory; import ca.uhn.fhir.util.jar.IDependencyLog; +import static org.apache.commons.lang3.StringUtils.isBlank; + /** * Utility methods for working with the StAX API. * * This class contains code adapted from the Apache Axiom project. */ public class XmlUtil { + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlUtil.class); + private static final Map VALID_ENTITY_NAMES; + private static final ExtendedEntityReplacingXmlResolver XML_RESOLVER = new ExtendedEntityReplacingXmlResolver(); private static XMLOutputFactory ourFragmentOutputFactory; private static volatile boolean ourHaveLoggedStaxImplementation; private static volatile XMLInputFactory ourInputFactory; - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlUtil.class); private static Throwable ourNextException; private static volatile XMLOutputFactory ourOutputFactory; - private static Boolean ourStaxPresent; - private static final Map VALID_ENTITY_NAMES; - private static final ExtendedEntityReplacingXmlResolver XML_RESOLVER = new ExtendedEntityReplacingXmlResolver(); static { HashMap validEntityNames = new HashMap(1448); @@ -1517,7 +1519,7 @@ public class XmlUtil { } XMLOutputFactory outputFactory = newOutputFactory(); - + if (!ourHaveLoggedStaxImplementation) { logStaxImplementation(outputFactory.getClass()); } @@ -1545,7 +1547,7 @@ public class XmlUtil { public static XMLEventReader createXmlReader(Reader reader) throws FactoryConfigurationError, XMLStreamException { throwUnitTestExceptionIfConfiguredToDoSo(); - + XMLInputFactory inputFactory = getOrCreateInputFactory(); // Now.. create the reader and return it @@ -1555,7 +1557,7 @@ public class XmlUtil { public static XMLStreamWriter createXmlStreamWriter(Writer theWriter) throws FactoryConfigurationError, XMLStreamException { throwUnitTestExceptionIfConfiguredToDoSo(); - + XMLOutputFactory outputFactory = getOrCreateOutputFactory(); XMLStreamWriter retVal = outputFactory.createXMLStreamWriter(theWriter); return retVal; @@ -1567,6 +1569,30 @@ public class XmlUtil { return retVal; } + /** + * Encode a set of StAX events into a String + */ + public static String encode(List theEvents) { + try { + StringWriter w = new StringWriter(); + XMLEventWriter ew = XmlUtil.createXmlFragmentWriter(w); + + for (XMLEvent next : theEvents) { + if (next.isCharacters()) { + ew.add(next); + } else { + ew.add(next); + } + } + ew.close(); + return w.toString(); + } catch (XMLStreamException e) { + throw new DataFormatException("Problem with the contained XML events", e); + } catch (FactoryConfigurationError e) { + throw new ConfigurationException(e); + } + } + private static XMLOutputFactory getOrCreateFragmentOutputFactory() throws FactoryConfigurationError { XMLOutputFactory retVal = ourFragmentOutputFactory; if (retVal == null) { @@ -1588,7 +1614,7 @@ public class XmlUtil { } catch (ClassNotFoundException e) { // ok } - + XMLInputFactory inputFactory = newInputFactory(); if (!ourHaveLoggedStaxImplementation) { @@ -1596,20 +1622,20 @@ public class XmlUtil { } /* - * These two properties disable external entity processing, which can + * These two properties disable external entity processing, which can * be a security vulnerability. - * + * * See https://github.com/jamesagnew/hapi-fhir/issues/339 * https://www.owasp.org/index.php/XML_External_Entity_%28XXE%29_Processing */ inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false); // This disables DTDs entirely for that factory inputFactory.setProperty("javax.xml.stream.isSupportingExternalEntities", false); // disable external entities - + /* * In the following few lines, you can uncomment the first and comment the second to disable automatic * parsing of extended entities, e.g. § - * + * * Note that these properties are Woodstox specific and they cause a crash in environments where SJSXP is * being used (e.g. glassfish) so we don't set them there. */ @@ -1652,6 +1678,7 @@ public class XmlUtil { return ourOutputFactory; } + private static void logStaxImplementation(Class theClass) { IDependencyLog logger = DependencyLogFactory.createJarLogger(); if (logger != null) { @@ -1683,6 +1710,49 @@ public class XmlUtil { return outputFactory; } + /** + * Parses an XML string into a set of StAX events + */ + public static List parse(String theValue) { + if (isBlank(theValue)) { + return Collections.emptyList(); + } + + String val = theValue.trim(); + if (!val.startsWith("<")) { + val = XhtmlDt.DIV_OPEN_FIRST + val + ""; + } + boolean hasProcessingInstruction = val.startsWith("")) { + return null; + } + + + try { + ArrayList value = new ArrayList<>(); + StringReader reader = new StringReader(val); + XMLEventReader er = XmlUtil.createXmlReader(reader); + boolean first = true; + while (er.hasNext()) { + XMLEvent next = er.nextEvent(); + if (first) { + first = false; + continue; + } + if (er.hasNext()) { + // don't add the last event + value.add(next); + } + } + return value; + + } catch (XMLStreamException e) { + throw new DataFormatException("String does not appear to be valid XML/XHTML (error is \"" + e.getMessage() + "\"): " + theValue, e); + } catch (FactoryConfigurationError e) { + throw new ConfigurationException(e); + } + } + /** * FOR UNIT TESTS ONLY - Throw this exception for the next operation */ @@ -1711,26 +1781,6 @@ public class XmlUtil { return null; } } - - /** - * This method will return true if a StAX XML parsing library is present - * on the classpath - */ - public static boolean isStaxPresent() { - Boolean retVal = ourStaxPresent; - if (retVal == null) { - try { - newInputFactory(); - ourStaxPresent = Boolean.TRUE; - retVal = Boolean.TRUE; - } catch (ConfigurationException e) { - ourLog.info("StAX not detected on classpath, XML processing will be disabled"); - ourStaxPresent = Boolean.FALSE; - retVal = Boolean.FALSE; - } - } - return retVal; - } public static class MyEscaper implements EscapingWriterFactory { diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/DefinitionException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/DefinitionException.java deleted file mode 100644 index 3896b1dd9b1..00000000000 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/DefinitionException.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.hl7.fhir.exceptions; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 - 2017 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% - */ - - -public class DefinitionException extends FHIRException { - - private static final long serialVersionUID = 8175803009974854088L; - - public DefinitionException() { - super(); - } - - public DefinitionException(String message, Throwable cause) { - super(message, cause); - } - - public DefinitionException(String message) { - super(message); - } - - public DefinitionException(Throwable cause) { - super(cause); - } - -} diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRException.java deleted file mode 100644 index 274864c3078..00000000000 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRException.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.hl7.fhir.exceptions; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 - 2017 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% - */ - - -public class FHIRException extends Exception { - - // Note that the 4-argument constructor has been removed as it is not JDK6 compatible - - private static final long serialVersionUID = -1793365096090608037L; - - public FHIRException() { - super(); - } - - public FHIRException(String message, Throwable cause) { - super(message, cause); - } - - public FHIRException(String message) { - super(message); - } - - public FHIRException(Throwable cause) { - super(cause); - } - -} diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRFormatError.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRFormatError.java deleted file mode 100644 index 42c96577801..00000000000 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRFormatError.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.hl7.fhir.exceptions; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 - 2017 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% - */ - - -public class FHIRFormatError extends FHIRException { - - private static final long serialVersionUID = 1L; - - public FHIRFormatError() { - super(); - } - - public FHIRFormatError(String message, Throwable cause) { - super(message, cause); - } - - public FHIRFormatError(String message) { - super(message); - } - - public FHIRFormatError(Throwable cause) { - super(cause); - } - -} diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/NoTerminologyServiceException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/NoTerminologyServiceException.java deleted file mode 100644 index 08be82d5d89..00000000000 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/NoTerminologyServiceException.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.hl7.fhir.exceptions; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 - 2017 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% - */ - - -public class NoTerminologyServiceException extends FHIRException { - - private static final long serialVersionUID = 8196224236579018584L; - - public NoTerminologyServiceException() { - super(); - } - - public NoTerminologyServiceException(String message, Throwable cause) { - super(message, cause); - } - - public NoTerminologyServiceException(String message) { - super(message); - } - - public NoTerminologyServiceException(Throwable cause) { - super(cause); - } - -} diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/PathEngineException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/PathEngineException.java deleted file mode 100644 index b56c9d9212c..00000000000 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/PathEngineException.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.hl7.fhir.exceptions; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 - 2017 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% - */ - - -public class PathEngineException extends FHIRException { - - private static final long serialVersionUID = -8550234068917355391L; - - public PathEngineException() { - super(); - } - - public PathEngineException(String message, Throwable cause) { - super(message, cause); - } - - public PathEngineException(String message) { - super(message); - } - - public PathEngineException(Throwable cause) { - super(cause); - } - -} diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/TerminologyServiceException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/TerminologyServiceException.java deleted file mode 100644 index 2f1ae3dca5a..00000000000 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/TerminologyServiceException.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.hl7.fhir.exceptions; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 - 2017 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% - */ - - -public class TerminologyServiceException extends FHIRException { - - private static final long serialVersionUID = -1547510329455394225L; - - public TerminologyServiceException() { - super(); - } - - public TerminologyServiceException(String message, Throwable cause) { - super(message, cause); - } - - public TerminologyServiceException(String message) { - super(message); - } - - public TerminologyServiceException(Throwable cause) { - super(cause); - } - -} diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/UcumException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/UcumException.java deleted file mode 100644 index c1c2bd8a90e..00000000000 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/UcumException.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.hl7.fhir.exceptions; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 - 2017 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% - */ - - -public class UcumException extends FHIRException { - - private static final long serialVersionUID = -8535757334881835619L; - - public UcumException() { - super(); - } - - public UcumException(String message, Throwable cause) { - super(message, cause); - } - - public UcumException(String message) { - super(message); - } - - public UcumException(Throwable cause) { - super(cause); - } - -} diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/CacheControlDirectiveTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/CacheControlDirectiveTest.java new file mode 100644 index 00000000000..4591b4bc1f1 --- /dev/null +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/CacheControlDirectiveTest.java @@ -0,0 +1,58 @@ +package ca.uhn.fhir.rest.api; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.*; + +public class CacheControlDirectiveTest { + + @Test + public void testParseNoCache() { + List values = Arrays.asList(Constants.CACHE_CONTROL_NO_CACHE); + CacheControlDirective ccd = new CacheControlDirective(); + ccd.parse(values); + assertTrue(ccd.isNoCache()); + assertFalse(ccd.isNoStore()); + } + + @Test + public void testParseNoCacheNoStore() { + List values = Arrays.asList(Constants.CACHE_CONTROL_NO_CACHE + " , " + Constants.CACHE_CONTROL_NO_STORE); + CacheControlDirective ccd = new CacheControlDirective(); + ccd.parse(values); + assertTrue(ccd.isNoCache()); + assertTrue(ccd.isNoStore()); + assertEquals(null, ccd.getMaxResults()); + } + + @Test + public void testParseNoCacheNoStoreMaxResults() { + List values = Arrays.asList(Constants.CACHE_CONTROL_NO_STORE + ", "+ Constants.CACHE_CONTROL_MAX_RESULTS + "=5"); + CacheControlDirective ccd = new CacheControlDirective(); + ccd.parse(values); + assertFalse(ccd.isNoCache()); + assertTrue(ccd.isNoStore()); + assertEquals(5, ccd.getMaxResults().intValue()); + } + + @Test + public void testParseNoCacheNoStoreMaxResultsInvalid() { + List values = Arrays.asList(Constants.CACHE_CONTROL_NO_STORE + ", "+ Constants.CACHE_CONTROL_MAX_RESULTS + "=A"); + CacheControlDirective ccd = new CacheControlDirective(); + ccd.parse(values); + assertFalse(ccd.isNoCache()); + assertTrue(ccd.isNoStore()); + assertEquals(null, ccd.getMaxResults()); + } + + @Test + public void testParseNull() { + CacheControlDirective ccd = new CacheControlDirective(); + ccd.parse(null); + assertFalse(ccd.isNoCache()); + assertFalse(ccd.isNoStore()); + } +} diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java b/hapi-fhir-cli/hapi-fhir-cli-app/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java index 3b8c70dd639..d69ee208acf 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java +++ b/hapi-fhir-cli/hapi-fhir-cli-app/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java @@ -73,6 +73,7 @@ public class IgPackUploader extends BaseCommand { .and(StructureDefinition.URL.matches().value(nextResourceUrl)) .execute(); } + break; default: throw new ParseException("This command does not support FHIR version " + ctx.getVersion().getVersion()); } diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java index 933acbaa1d7..751eabb88d9 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java @@ -1,28 +1,36 @@ package ca.uhn.fhir.jpa.demo; -import java.util.*; - -import javax.servlet.ServletException; - -import org.springframework.web.context.ContextLoaderListener; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.cors.CorsConfiguration; - import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2; import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2; -import ca.uhn.fhir.jpa.provider.dstu3.*; -import ca.uhn.fhir.jpa.provider.r4.*; +import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3; +import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3; +import ca.uhn.fhir.jpa.provider.dstu3.TerminologyUploaderProviderDstu3; +import ca.uhn.fhir.jpa.provider.r4.JpaConformanceProviderR4; +import ca.uhn.fhir.jpa.provider.r4.JpaSystemProviderR4; +import ca.uhn.fhir.jpa.provider.r4.TerminologyUploaderProviderR4; import ca.uhn.fhir.model.dstu2.composite.MetaDt; import ca.uhn.fhir.model.dstu2.resource.Bundle; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.rest.api.EncodingEnum; -import ca.uhn.fhir.rest.server.*; +import ca.uhn.fhir.rest.server.ETagSupportEnum; +import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider; +import ca.uhn.fhir.rest.server.IResourceProvider; +import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; +import org.springframework.web.context.ContextLoaderListener; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.cors.CorsConfiguration; + +import javax.servlet.ServletException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; public class JpaServerDemo extends RestfulServer { @@ -134,19 +142,7 @@ public class JpaServerDemo extends RestfulServer { setPagingProvider(new FifoMemoryPagingProvider(10)); // Register a CORS filter - CorsConfiguration config = new CorsConfiguration(); - CorsInterceptor corsInterceptor = new CorsInterceptor(config); - config.addAllowedHeader("x-fhir-starter"); - config.addAllowedHeader("Origin"); - config.addAllowedHeader("Accept"); - config.addAllowedHeader("X-Requested-With"); - config.addAllowedHeader("Content-Type"); - config.addAllowedHeader("Access-Control-Request-Method"); - config.addAllowedHeader("Access-Control-Request-Headers"); - config.addAllowedOrigin("*"); - config.addExposedHeader("Location"); - config.addExposedHeader("Content-Location"); - config.setAllowedMethods(Arrays.asList("GET","POST","PUT","DELETE","OPTIONS")); + CorsInterceptor corsInterceptor = new CorsInterceptor(); registerInterceptor(corsInterceptor); /* diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml index 525c8e0ceaa..d45e99e0e57 100644 --- a/hapi-fhir-client-okhttp/pom.xml +++ b/hapi-fhir-client-okhttp/pom.xml @@ -59,6 +59,11 @@ + + org.codehaus.woodstox + woodstox-core-asl + test + com.google.guava guava @@ -125,4 +130,4 @@ - \ No newline at end of file + diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/apache/ApacheHttpResponse.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/apache/ApacheHttpResponse.java index 17c097fdcfd..746b335b807 100644 --- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/apache/ApacheHttpResponse.java +++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/apache/ApacheHttpResponse.java @@ -98,24 +98,23 @@ public class ApacheHttpResponse implements IHttpResponse { } if (charset == null) { if (Constants.STATUS_HTTP_204_NO_CONTENT != myResponse.getStatusLine().getStatusCode()) { - ourLog.warn("Response did not specify a charset."); + ourLog.debug("Response did not specify a charset, defaulting to utf-8"); } charset = Charset.forName("UTF-8"); } - Reader reader = new InputStreamReader(readEntity(), charset); - return reader; + return new InputStreamReader(readEntity(), charset); } @Override public Map> getAllHeaders() { - Map> headers = new HashMap>(); + Map> headers = new HashMap<>(); if (myResponse.getAllHeaders() != null) { for (Header next : myResponse.getAllHeaders()) { String name = next.getName().toLowerCase(); List list = headers.get(name); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); headers.put(name, list); } list.add(next.getValue()); @@ -131,7 +130,7 @@ public class ApacheHttpResponse implements IHttpResponse { if (headers == null) { headers = new Header[0]; } - List retVal = new ArrayList(); + List retVal = new ArrayList<>(); for (Header next : headers) { retVal.add(next.getValue()); } diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseClient.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseClient.java index 4aa1e2770df..ceafc691847 100644 --- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseClient.java +++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseClient.java @@ -34,6 +34,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import ca.uhn.fhir.rest.api.CacheControlDirective; +import ca.uhn.fhir.util.XmlDetectionUtil; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -109,7 +111,7 @@ public abstract class BaseClient implements IRestfulClient { setKeepResponses(true); } - if (XmlUtil.isStaxPresent() == false) { + if (XmlDetectionUtil.isStaxPresent() == false) { myEncoding = EncodingEnum.JSON; } @@ -135,7 +137,7 @@ public abstract class BaseClient implements IRestfulClient { public T fetchResourceFromUrl(Class theResourceType, String theUrl) { BaseHttpClientInvocation clientInvocation = new HttpGetClientInvocation(getFhirContext(), theUrl); ResourceResponseHandler binding = new ResourceResponseHandler(theResourceType); - return invokeClient(getFhirContext(), binding, clientInvocation, null, false, false, null, null); + return invokeClient(getFhirContext(), binding, clientInvocation, null, false, false, null, null, null); } void forceConformanceCheck() { @@ -198,11 +200,11 @@ public abstract class BaseClient implements IRestfulClient { } T invokeClient(FhirContext theContext, IClientResponseHandler binding, BaseHttpClientInvocation clientInvocation, boolean theLogRequestAndResponse) { - return invokeClient(theContext, binding, clientInvocation, null, null, theLogRequestAndResponse, null, null); + return invokeClient(theContext, binding, clientInvocation, null, null, theLogRequestAndResponse, null, null, null); } T invokeClient(FhirContext theContext, IClientResponseHandler binding, BaseHttpClientInvocation clientInvocation, EncodingEnum theEncoding, Boolean thePrettyPrint, - boolean theLogRequestAndResponse, SummaryEnum theSummaryMode, Set theSubsetElements) { + boolean theLogRequestAndResponse, SummaryEnum theSummaryMode, Set theSubsetElements, CacheControlDirective theCacheControlDirective) { if (!myDontValidateConformance) { myFactory.validateServerBaseIfConfiguredToDoSo(myUrlBase, myClient, this); @@ -244,6 +246,18 @@ public abstract class BaseClient implements IRestfulClient { httpRequest = clientInvocation.asHttpRequest(myUrlBase, params, encoding, thePrettyPrint); + if (theCacheControlDirective != null) { + StringBuilder b = new StringBuilder(); + addToCacheControlHeader(b, Constants.CACHE_CONTROL_NO_CACHE, theCacheControlDirective.isNoCache()); + addToCacheControlHeader(b, Constants.CACHE_CONTROL_NO_STORE, theCacheControlDirective.isNoStore()); + if (theCacheControlDirective.getMaxResults() != null) { + addToCacheControlHeader(b, Constants.CACHE_CONTROL_MAX_RESULTS+"="+ Integer.toString(theCacheControlDirective.getMaxResults().intValue()), true); + } + if (b.length() > 0) { + httpRequest.addHeader(Constants.HEADER_CACHE_CONTROL, b.toString()); + } + } + if (theLogRequestAndResponse) { ourLog.info("Client invoking: {}", httpRequest); String body = httpRequest.getRequestBodyFromStream(); @@ -366,6 +380,15 @@ public abstract class BaseClient implements IRestfulClient { } } + private void addToCacheControlHeader(StringBuilder theBuilder, String theDirective, boolean theActive) { + if (theActive) { + if (theBuilder.length() > 0) { + theBuilder.append(", "); + } + theBuilder.append(theDirective); + } + } + /** * For now, this is a part of the internal API of HAPI - Use with caution as this method may change! */ diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java index c82d329a18e..60687a5f7b9 100644 --- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java +++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java @@ -120,10 +120,10 @@ public class GenericClient extends BaseClient implements IGenericClient { ResourceResponseHandler binding = new ResourceResponseHandler(theType, (Class) null, id, allowHtmlResponse); if (theNotModifiedHandler == null) { - return invokeClient(myContext, binding, invocation, theEncoding, thePrettyPrint, myLogRequestAndResponse, theSummary, theSubsetElements); + return invokeClient(myContext, binding, invocation, theEncoding, thePrettyPrint, myLogRequestAndResponse, theSummary, theSubsetElements, null); } try { - return invokeClient(myContext, binding, invocation, theEncoding, thePrettyPrint, myLogRequestAndResponse, theSummary, theSubsetElements); + return invokeClient(myContext, binding, invocation, theEncoding, thePrettyPrint, myLogRequestAndResponse, theSummary, theSubsetElements, null); } catch (NotModifiedException e) { return theNotModifiedHandler.call(); } @@ -373,6 +373,7 @@ public class GenericClient extends BaseClient implements IGenericClient { private boolean myQueryLogRequestAndResponse; private HashSet mySubsetElements; protected SummaryEnum mySummaryMode; + protected CacheControlDirective myCacheControlDirective; @Deprecated // override deprecated method @SuppressWarnings("unchecked") @@ -382,6 +383,12 @@ public class GenericClient extends BaseClient implements IGenericClient { return (T) this; } + @Override + public T cacheControl(CacheControlDirective theCacheControlDirective) { + myCacheControlDirective = theCacheControlDirective; + return (T) this; + } + @SuppressWarnings("unchecked") @Override public T elementsSubset(String... theElements) { @@ -434,19 +441,11 @@ public class GenericClient extends BaseClient implements IGenericClient { } protected Z invoke(Map> theParams, IClientResponseHandler theHandler, BaseHttpClientInvocation theInvocation) { - // if (myParamEncoding != null) { - // theParams.put(Constants.PARAM_FORMAT, Collections.singletonList(myParamEncoding.getFormatContentType())); - // } - // - // if (myPrettyPrint != null) { - // theParams.put(Constants.PARAM_PRETTY, Collections.singletonList(myPrettyPrint.toString())); - // } - if (isKeepResponses()) { myLastRequest = theInvocation.asHttpRequest(getServerBase(), theParams, getEncoding(), myPrettyPrint); } - Z resp = invokeClient(myContext, theHandler, theInvocation, myParamEncoding, myPrettyPrint, myQueryLogRequestAndResponse || myLogRequestAndResponse, mySummaryMode, mySubsetElements); + Z resp = invokeClient(myContext, theHandler, theInvocation, myParamEncoding, myPrettyPrint, myQueryLogRequestAndResponse || myLogRequestAndResponse, mySummaryMode, mySubsetElements, myCacheControlDirective); return resp; } diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java index 3c0daa061b7..59f0054154e 100644 --- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java +++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java @@ -330,6 +330,8 @@ public abstract class RestfulClientFactory implements IRestfulClientFactory { serverFhirVersionEnum = FhirVersionEnum.DSTU2_1; } else if (serverFhirVersionString.equals(FhirVersionEnum.DSTU3.getFhirVersionString())) { serverFhirVersionEnum = FhirVersionEnum.DSTU3; + } else if (serverFhirVersionString.equals(FhirVersionEnum.R4.getFhirVersionString())) { + serverFhirVersionEnum = FhirVersionEnum.R4; } else { // we'll be lenient and accept this ourLog.debug("Server conformance statement indicates unknown FHIR version: {}", serverFhirVersionString); diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java index 742c9aac7a7..c44c1878063 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java @@ -87,6 +87,1973 @@ public class VersionConvertor_10_40 { this.advisor = advisor; } + public void copyElement(org.hl7.fhir.instance.model.Element src, org.hl7.fhir.r4.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.instance.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + public void copyElement(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + public void copyBackboneElement(org.hl7.fhir.instance.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.instance.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.instance.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.instance.model.Base64BinaryType tgt = new org.hl7.fhir.instance.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.instance.model.BooleanType src) throws FHIRException { + org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { + org.hl7.fhir.instance.model.BooleanType tgt = new org.hl7.fhir.instance.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.instance.model.CodeType src) throws FHIRException { + org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { + org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.UriType convertCodeToUri(org.hl7.fhir.instance.model.CodeType src) throws FHIRException { + org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.CodeType convertUriToCode(org.hl7.fhir.r4.model.UriType src) throws FHIRException { + org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.instance.model.DateType src) throws FHIRException { + org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { + org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.instance.model.DateTimeType tgt = new org.hl7.fhir.instance.model.DateTimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.instance.model.DecimalType src) throws FHIRException { + org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { + org.hl7.fhir.instance.model.DecimalType tgt = new org.hl7.fhir.instance.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.instance.model.IdType src) throws FHIRException { + org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { + org.hl7.fhir.instance.model.IdType tgt = new org.hl7.fhir.instance.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.instance.model.InstantType src) throws FHIRException { + org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { + org.hl7.fhir.instance.model.InstantType tgt = new org.hl7.fhir.instance.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.instance.model.IntegerType src) throws FHIRException { + org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { + org.hl7.fhir.instance.model.IntegerType tgt = new org.hl7.fhir.instance.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.instance.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.instance.model.MarkdownType tgt = new org.hl7.fhir.instance.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.instance.model.OidType src) throws FHIRException { + org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { + org.hl7.fhir.instance.model.OidType tgt = new org.hl7.fhir.instance.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.instance.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.instance.model.PositiveIntType tgt = new org.hl7.fhir.instance.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.instance.model.StringType src) throws FHIRException { + org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { + org.hl7.fhir.instance.model.StringType tgt = new org.hl7.fhir.instance.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.instance.model.TimeType src) throws FHIRException { + org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { + org.hl7.fhir.instance.model.TimeType tgt = new org.hl7.fhir.instance.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.instance.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.instance.model.UnsignedIntType tgt = new org.hl7.fhir.instance.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.instance.model.UriType src) throws FHIRException { + org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { + org.hl7.fhir.instance.model.UriType tgt = new org.hl7.fhir.instance.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.instance.model.UuidType src) throws FHIRException { + org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { + org.hl7.fhir.instance.model.UuidType tgt = new org.hl7.fhir.instance.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.instance.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.instance.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Extension tgt = new org.hl7.fhir.instance.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.instance.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public org.hl7.fhir.instance.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Narrative tgt = new org.hl7.fhir.instance.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.instance.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.instance.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.instance.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Annotation tgt = new org.hl7.fhir.instance.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.instance.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; + } + + public org.hl7.fhir.instance.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Attachment tgt = new org.hl7.fhir.instance.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; + } + + public org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.instance.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.instance.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.CodeableConcept tgt = new org.hl7.fhir.instance.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.instance.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public org.hl7.fhir.instance.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Coding tgt = new org.hl7.fhir.instance.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + + + public org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.instance.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSystem(src.getSystem()); + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public org.hl7.fhir.instance.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Identifier tgt = new org.hl7.fhir.instance.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.instance.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; + } + } + + public org.hl7.fhir.instance.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.NULL; + } + } + + public org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.instance.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public org.hl7.fhir.instance.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Period tgt = new org.hl7.fhir.instance.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.instance.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Quantity tgt = new org.hl7.fhir.instance.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.instance.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL; + } + } + + public org.hl7.fhir.instance.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.NULL; + } + } + + public org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.instance.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public org.hl7.fhir.instance.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Range tgt = new org.hl7.fhir.instance.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.instance.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public org.hl7.fhir.instance.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Ratio tgt = new org.hl7.fhir.instance.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Reference tgt = new org.hl7.fhir.instance.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.instance.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public org.hl7.fhir.instance.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SampledData tgt = new org.hl7.fhir.instance.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.instance.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + tgt.setContentType(src.getContentType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public org.hl7.fhir.instance.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Signature tgt = new org.hl7.fhir.instance.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + tgt.setContentType(src.getContentType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.instance.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.instance.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Address tgt = new org.hl7.fhir.instance.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.instance.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r4.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.r4.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.r4.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.r4.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.r4.model.Address.AddressUse.NULL; + } + } + + public org.hl7.fhir.instance.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.instance.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.instance.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.instance.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.instance.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.instance.model.Address.AddressUse.NULL; + } + } + + public org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.instance.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.r4.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.r4.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.r4.model.Address.AddressType.NULL; + } + } + + public org.hl7.fhir.instance.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.instance.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.instance.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.instance.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.instance.model.Address.AddressType.NULL; + } + } + + public org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.instance.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ContactPoint tgt = new org.hl7.fhir.instance.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER; + case URL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.instance.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL; + } + } + + public org.hl7.fhir.instance.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.NULL; + } + } + + public org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.instance.model.ElementDefinition src, List slicePaths, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.instance.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasName()) { + if (slicePaths.contains(src.getPath())) + tgt.setSliceName(src.getName()); + tgt.setId(src.getName()); + } + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.instance.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos)); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.instance.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasNameReference()) + tgt.setContentReference("#"+src.getNameReference()); + for (org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent t : src.getType()) + tgt.addType(convertElementDefinitionTypeComponent(t)); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.instance.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition tgt = new org.hl7.fhir.instance.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + else + tgt.setName(src.getId()); + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.r4.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + tgt.setShort(src.getShort()); + tgt.setDefinition(src.getDefinition()); + tgt.setComments(src.getComment()); + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setNameReference(src.getContentReference().substring(1)); + for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) + tgt.addType(convertElementDefinitionTypeComponent(t)); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExampleFirstRep().getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + tgt.setMustSupport(src.getMustSupport()); + tgt.setIsModifier(src.getIsModifier()); + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + org.hl7.fhir.instance.model.ElementDefinition slicingElement = context.get(pos); + for (org.hl7.fhir.instance.model.StringType t : src.getDiscriminator()) { + boolean isExists = false; + if (!t.asStringValue().contains("@")) { + int slices = 0; + boolean existsSlicePresent = false; + boolean notExistsSlicePresent = false; + String existsPath = slicingElement.getPath() + "." + t.asStringValue(); + for (int i = pos + 1; i < context.size(); i++) { + org.hl7.fhir.instance.model.ElementDefinition e = context.get(i); + if (e.getPath().equals(slicingElement.getPath())) + slices++; + else if (!e.getPath().startsWith(slicingElement.getPath() + ".")) + break; + else if (e.getPath().equals(existsPath)) { + if (e.hasMin() && e.getMin() > 0) + existsSlicePresent = true; + else if (e.hasMax() && e.getMax().equals("0")) + notExistsSlicePresent = true; + } + } + isExists = slices==2 && existsSlicePresent && notExistsSlicePresent; + } + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists)); + } + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) + tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.instance.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL; + } + } + + public org.hl7.fhir.instance.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.NULL; + } + } + + public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCodeElement(convertCodeToUri(src.getCodeElement())); + for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) + if (src.hasCode() && "Reference".equals(src.getCode())) + tgt.setTargetProfile(t.getValueAsString()); + else + tgt.setProfile(t.getValue()); + for (org.hl7.fhir.instance.model.Enumeration t : src.getAggregation()) + tgt.addAggregation(convertAggregationMode(t.getValue())); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCodeElement(convertUriToCode(src.getCodeElement())); + if (src.hasCode() && "Reference".equals(src.getCode())) { + if (src.hasTargetProfile()) + tgt.addProfile(src.getTargetProfile()); + } else if (src.hasProfile()) + tgt.addProfile(src.getProfile()); + for (org.hl7.fhir.r4.model.Enumeration t : src.getAggregation()) + tgt.addAggregation(convertAggregationMode(t.getValue())); + return tgt; + } + + public org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.instance.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL; + } + } + + public org.hl7.fhir.instance.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.NULL; + } + } + + public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.instance.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.NULL; + } + } + + public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + for (org.hl7.fhir.instance.model.StringType t : src.getFamily()) + tgt.setFamily(t.getValue()); + for (org.hl7.fhir.instance.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.instance.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.instance.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.HumanName tgt = new org.hl7.fhir.instance.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.instance.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.r4.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.r4.model.HumanName.NameUse.NULL; + } + } + + public org.hl7.fhir.instance.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.instance.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.instance.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.instance.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.instance.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.instance.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.instance.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.instance.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.instance.model.HumanName.NameUse.NULL; + } + } + + public org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.instance.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.instance.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.instance.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Meta tgt = new org.hl7.fhir.instance.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.r4.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.instance.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.instance.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Timing tgt = new org.hl7.fhir.instance.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.instance.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); + tgt.addWhen(convertEventTiming(src.getWhen())); + return tgt; + } + + public org.hl7.fhir.instance.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.instance.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) + tgt.setWhen(convertEventTiming(t.getValue())); + return tgt; + } + + public org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.instance.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL; + } + } + + public org.hl7.fhir.instance.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.NULL; + } + } + + public org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.instance.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.r4.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.r4.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.r4.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.r4.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.r4.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.r4.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.r4.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.r4.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.r4.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.r4.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.r4.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.r4.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.r4.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.r4.model.Timing.EventTiming.NULL; + } + } + + public org.hl7.fhir.instance.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.instance.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.instance.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.instance.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.instance.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.instance.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.instance.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.instance.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.instance.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.instance.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.instance.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.instance.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.instance.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.instance.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.instance.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.instance.model.Timing.EventTiming.NULL; + } + } + + public org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.instance.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Age tgt = new org.hl7.fhir.instance.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.instance.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Count tgt = new org.hl7.fhir.instance.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.instance.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Distance tgt = new org.hl7.fhir.instance.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.instance.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Duration tgt = new org.hl7.fhir.instance.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.instance.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Money tgt = new org.hl7.fhir.instance.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r4.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.instance.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SimpleQuantity tgt = new org.hl7.fhir.instance.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.instance.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.instance.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.instance.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.instance.model.BooleanType) + return convertBoolean((org.hl7.fhir.instance.model.BooleanType) src); + if (src instanceof org.hl7.fhir.instance.model.CodeType) + return convertCode((org.hl7.fhir.instance.model.CodeType) src); + if (src instanceof org.hl7.fhir.instance.model.DateType) + return convertDate((org.hl7.fhir.instance.model.DateType) src); + if (src instanceof org.hl7.fhir.instance.model.DateTimeType) + return convertDateTime((org.hl7.fhir.instance.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.instance.model.DecimalType) + return convertDecimal((org.hl7.fhir.instance.model.DecimalType) src); + if (src instanceof org.hl7.fhir.instance.model.IdType) + return convertId((org.hl7.fhir.instance.model.IdType) src); + if (src instanceof org.hl7.fhir.instance.model.InstantType) + return convertInstant((org.hl7.fhir.instance.model.InstantType) src); + if (src instanceof org.hl7.fhir.instance.model.IntegerType) + return convertInteger((org.hl7.fhir.instance.model.IntegerType) src); + if (src instanceof org.hl7.fhir.instance.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.instance.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.instance.model.OidType) + return convertOid((org.hl7.fhir.instance.model.OidType) src); + if (src instanceof org.hl7.fhir.instance.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.instance.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.instance.model.StringType) + return convertString((org.hl7.fhir.instance.model.StringType) src); + if (src instanceof org.hl7.fhir.instance.model.TimeType) + return convertTime((org.hl7.fhir.instance.model.TimeType) src); + if (src instanceof org.hl7.fhir.instance.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.instance.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.instance.model.UriType) + return convertUri((org.hl7.fhir.instance.model.UriType) src); + if (src instanceof org.hl7.fhir.instance.model.UuidType) + return convertUuid((org.hl7.fhir.instance.model.UuidType) src); + if (src instanceof org.hl7.fhir.instance.model.Extension) + return convertExtension((org.hl7.fhir.instance.model.Extension) src); + if (src instanceof org.hl7.fhir.instance.model.Narrative) + return convertNarrative((org.hl7.fhir.instance.model.Narrative) src); + if (src instanceof org.hl7.fhir.instance.model.Annotation) + return convertAnnotation((org.hl7.fhir.instance.model.Annotation) src); + if (src instanceof org.hl7.fhir.instance.model.Attachment) + return convertAttachment((org.hl7.fhir.instance.model.Attachment) src); + if (src instanceof org.hl7.fhir.instance.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.instance.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.instance.model.Coding) + return convertCoding((org.hl7.fhir.instance.model.Coding) src); + if (src instanceof org.hl7.fhir.instance.model.Identifier) + return convertIdentifier((org.hl7.fhir.instance.model.Identifier) src); + if (src instanceof org.hl7.fhir.instance.model.Period) + return convertPeriod((org.hl7.fhir.instance.model.Period) src); + if (src instanceof org.hl7.fhir.instance.model.Quantity) + return convertQuantity((org.hl7.fhir.instance.model.Quantity) src); + if (src instanceof org.hl7.fhir.instance.model.Range) + return convertRange((org.hl7.fhir.instance.model.Range) src); + if (src instanceof org.hl7.fhir.instance.model.Ratio) + return convertRatio((org.hl7.fhir.instance.model.Ratio) src); + if (src instanceof org.hl7.fhir.instance.model.Reference) + return convertReference((org.hl7.fhir.instance.model.Reference) src); + if (src instanceof org.hl7.fhir.instance.model.SampledData) + return convertSampledData((org.hl7.fhir.instance.model.SampledData) src); + if (src instanceof org.hl7.fhir.instance.model.Signature) + return convertSignature((org.hl7.fhir.instance.model.Signature) src); + if (src instanceof org.hl7.fhir.instance.model.Address) + return convertAddress((org.hl7.fhir.instance.model.Address) src); + if (src instanceof org.hl7.fhir.instance.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.instance.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.instance.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.instance.model.ElementDefinition) src, new ArrayList(), new ArrayList(), 0); + if (src instanceof org.hl7.fhir.instance.model.HumanName) + return convertHumanName((org.hl7.fhir.instance.model.HumanName) src); + if (src instanceof org.hl7.fhir.instance.model.Meta) + return convertMeta((org.hl7.fhir.instance.model.Meta) src); + if (src instanceof org.hl7.fhir.instance.model.Timing) + return convertTiming((org.hl7.fhir.instance.model.Timing) src); + if (src instanceof org.hl7.fhir.instance.model.Age) + return convertAge((org.hl7.fhir.instance.model.Age) src); + if (src instanceof org.hl7.fhir.instance.model.Count) + return convertCount((org.hl7.fhir.instance.model.Count) src); + if (src instanceof org.hl7.fhir.instance.model.Distance) + return convertDistance((org.hl7.fhir.instance.model.Distance) src); + if (src instanceof org.hl7.fhir.instance.model.Duration) + return convertDuration((org.hl7.fhir.instance.model.Duration) src); + if (src instanceof org.hl7.fhir.instance.model.Money) + return convertMoney((org.hl7.fhir.instance.model.Money) src); + if (src instanceof org.hl7.fhir.instance.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.instance.model.SimpleQuantity) src); + throw new Error("Unknown type "+src.fhirType()); + } + + public org.hl7.fhir.instance.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.r4.model.BooleanType) + return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src); + if (src instanceof org.hl7.fhir.r4.model.CodeType) + return convertCode((org.hl7.fhir.r4.model.CodeType) src); + if (src instanceof org.hl7.fhir.r4.model.DateType) + return convertDate((org.hl7.fhir.r4.model.DateType) src); + if (src instanceof org.hl7.fhir.r4.model.DateTimeType) + return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.r4.model.DecimalType) + return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src); + if (src instanceof org.hl7.fhir.r4.model.IdType) + return convertId((org.hl7.fhir.r4.model.IdType) src); + if (src instanceof org.hl7.fhir.r4.model.InstantType) + return convertInstant((org.hl7.fhir.r4.model.InstantType) src); + if (src instanceof org.hl7.fhir.r4.model.IntegerType) + return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); + if (src instanceof org.hl7.fhir.r4.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.r4.model.OidType) + return convertOid((org.hl7.fhir.r4.model.OidType) src); + if (src instanceof org.hl7.fhir.r4.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.r4.model.StringType) + return convertString((org.hl7.fhir.r4.model.StringType) src); + if (src instanceof org.hl7.fhir.r4.model.TimeType) + return convertTime((org.hl7.fhir.r4.model.TimeType) src); + if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.r4.model.UriType) + return convertUri((org.hl7.fhir.r4.model.UriType) src); + if (src instanceof org.hl7.fhir.r4.model.UuidType) + return convertUuid((org.hl7.fhir.r4.model.UuidType) src); + if (src instanceof org.hl7.fhir.r4.model.Extension) + return convertExtension((org.hl7.fhir.r4.model.Extension) src); + if (src instanceof org.hl7.fhir.r4.model.Narrative) + return convertNarrative((org.hl7.fhir.r4.model.Narrative) src); + if (src instanceof org.hl7.fhir.r4.model.Annotation) + return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src); + if (src instanceof org.hl7.fhir.r4.model.Attachment) + return convertAttachment((org.hl7.fhir.r4.model.Attachment) src); + if (src instanceof org.hl7.fhir.r4.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.r4.model.Coding) + return convertCoding((org.hl7.fhir.r4.model.Coding) src); + if (src instanceof org.hl7.fhir.r4.model.Identifier) + return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src); + if (src instanceof org.hl7.fhir.r4.model.Period) + return convertPeriod((org.hl7.fhir.r4.model.Period) src); + if (src instanceof org.hl7.fhir.r4.model.Quantity) + return convertQuantity((org.hl7.fhir.r4.model.Quantity) src); + if (src instanceof org.hl7.fhir.r4.model.Range) + return convertRange((org.hl7.fhir.r4.model.Range) src); + if (src instanceof org.hl7.fhir.r4.model.Ratio) + return convertRatio((org.hl7.fhir.r4.model.Ratio) src); + if (src instanceof org.hl7.fhir.r4.model.Reference) + return convertReference((org.hl7.fhir.r4.model.Reference) src); + if (src instanceof org.hl7.fhir.r4.model.SampledData) + return convertSampledData((org.hl7.fhir.r4.model.SampledData) src); + if (src instanceof org.hl7.fhir.r4.model.Signature) + return convertSignature((org.hl7.fhir.r4.model.Signature) src); + if (src instanceof org.hl7.fhir.r4.model.Address) + return convertAddress((org.hl7.fhir.r4.model.Address) src); + if (src instanceof org.hl7.fhir.r4.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.r4.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.r4.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.r4.model.HumanName) + return convertHumanName((org.hl7.fhir.r4.model.HumanName) src); + if (src instanceof org.hl7.fhir.r4.model.Meta) + return convertMeta((org.hl7.fhir.r4.model.Meta) src); + if (src instanceof org.hl7.fhir.r4.model.Timing) + return convertTiming((org.hl7.fhir.r4.model.Timing) src); + if (src instanceof org.hl7.fhir.r4.model.Age) + return convertAge((org.hl7.fhir.r4.model.Age) src); + if (src instanceof org.hl7.fhir.r4.model.Count) + return convertCount((org.hl7.fhir.r4.model.Count) src); + if (src instanceof org.hl7.fhir.r4.model.Distance) + return convertDistance((org.hl7.fhir.r4.model.Distance) src); + if (src instanceof org.hl7.fhir.r4.model.Duration) + return convertDuration((org.hl7.fhir.r4.model.Duration) src); + if (src instanceof org.hl7.fhir.r4.model.Money) + return convertMoney((org.hl7.fhir.r4.model.Money) src); + if (src instanceof org.hl7.fhir.r4.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.r4.model.SimpleQuantity) src); + throw new Error("Unknown type "+src.fhirType()); + } + + public void copyDomainResource(org.hl7.fhir.instance.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.instance.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.instance.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.instance.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.instance.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.r4.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.r4.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + + public org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.instance.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Parameters tgt = new org.hl7.fhir.instance.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public void copyResource(org.hl7.fhir.instance.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + tgt.setImplicitRules(src.getImplicitRules()); + tgt.setLanguage(src.getLanguage()); + } + public void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.instance.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public org.hl7.fhir.r4.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.instance.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.NULL; + } + } + + public org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.instance.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NULL; + } + } + public org.hl7.fhir.r4.model.Account convertAccount(org.hl7.fhir.instance.model.Account src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -147,251 +2114,6 @@ public class VersionConvertor_10_40 { } } - public org.hl7.fhir.r4.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.instance.model.ProcessRequest.ActionList src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CANCEL: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.CANCEL; - case POLL: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.POLL; - case REPROCESS: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.REPROCESS; - case STATUS: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.STATUS; - default: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.NULL; - } - } - - public org.hl7.fhir.instance.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.r4.model.ProcessRequest.ActionList src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CANCEL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.CANCEL; - case POLL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.POLL; - case REPROCESS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.REPROCESS; - case STATUS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.STATUS; - default: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.NULL; - } - } - - public org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.instance.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.instance.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Address tgt = new org.hl7.fhir.instance.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.r4.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.instance.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.r4.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.r4.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.r4.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.instance.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.instance.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.instance.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.instance.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.instance.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.instance.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r4.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.r4.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.r4.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.r4.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.r4.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.instance.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.instance.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.instance.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.instance.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.instance.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.instance.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.r4.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.instance.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.instance.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Age tgt = new org.hl7.fhir.instance.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.instance.model.Contract.ActorComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getEntity())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.ActorComponent tgt = new org.hl7.fhir.instance.model.Contract.ActorComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getActor())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.instance.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.instance.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.r4.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.instance.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Patient.AnimalComponent tgt = new org.hl7.fhir.r4.model.Patient.AnimalComponent(); - copyElement(src, tgt); - tgt.setSpecies(convertCodeableConcept(src.getSpecies())); - tgt.setBreed(convertCodeableConcept(src.getBreed())); - tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public org.hl7.fhir.instance.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r4.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Patient.AnimalComponent tgt = new org.hl7.fhir.instance.model.Patient.AnimalComponent(); - copyElement(src, tgt); - tgt.setSpecies(convertCodeableConcept(src.getSpecies())); - tgt.setBreed(convertCodeableConcept(src.getBreed())); - tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.instance.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.instance.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Annotation tgt = new org.hl7.fhir.instance.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } public org.hl7.fhir.r4.model.Appointment convertAppointment(org.hl7.fhir.instance.model.Appointment src) throws FHIRException { if (src == null || src.isEmpty()) @@ -441,68 +2163,6 @@ public class VersionConvertor_10_40 { return tgt; } - public org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.instance.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.instance.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AppointmentResponse tgt = new org.hl7.fhir.instance.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - public org.hl7.fhir.r4.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.instance.model.Appointment.AppointmentStatus src) throws FHIRException { if (src == null) return null; @@ -533,131 +2193,137 @@ public class VersionConvertor_10_40 { } } - public org.hl7.fhir.r4.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.instance.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL; - } - } - - public org.hl7.fhir.instance.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.NULL; - } - } - - public org.hl7.fhir.r4.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.instance.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL; - } - } - - public org.hl7.fhir.instance.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NULL; - } - } - - public org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL; - } - } - - public org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NULL; - } - } - - public org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.instance.model.Attachment src) throws FHIRException { + public org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment(); + org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent(); copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(src.getSize()); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); return tgt; } - public org.hl7.fhir.instance.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException { + public org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Attachment tgt = new org.hl7.fhir.instance.model.Attachment(); + org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent(); copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(src.getSize()); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public org.hl7.fhir.r4.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.instance.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL; + } + } + + public org.hl7.fhir.instance.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r4.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.NULL; + } + } + + public org.hl7.fhir.r4.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.instance.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r4.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.instance.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setAppointment(convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + private org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case INPROCESS: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case COMPLETED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case NEEDSACTION: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + private org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AppointmentResponse tgt = new org.hl7.fhir.instance.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setAppointment(convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); return tgt; } @@ -734,6 +2400,30 @@ public class VersionConvertor_10_40 { } } + public org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome.NULL; + } + } + public org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -799,90 +2489,6 @@ public class VersionConvertor_10_40 { return tgt; } - public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(convertReference(src.getReference())); - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.instance.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(convertReference(src.getReference())); - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setValue(new Base64BinaryType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setValue((src.getValueBase64BinaryType().getValue())); - return tgt; - } - - public org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL; - } - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome.NULL; - } - } - public org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { if (src == null) return null; @@ -933,15 +2539,63 @@ public class VersionConvertor_10_40 { return tgt; } - public org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.instance.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue()); + public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent(); copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setReference(convertReference(src.getReference())); + tgt.setType(convertCoding(src.getType())); + tgt.setRole(convertCoding(src.getRole())); + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.instance.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); return tgt; } - public org.hl7.fhir.instance.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.instance.model.Base64BinaryType tgt = new org.hl7.fhir.instance.model.Base64BinaryType(src.getValue()); + public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent(); copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setReference(convertReference(src.getReference())); + tgt.setType(convertCoding(src.getType())); + tgt.setRole(convertCoding(src.getRole())); + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setValue(new Base64BinaryType(src.getValueElement().getValue())); + return tgt; + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setValue(src.getValueBase64BinaryType().getValue()); return tgt; } @@ -993,42 +2647,6 @@ public class VersionConvertor_10_40 { return tgt; } - public org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.instance.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.instance.model.BooleanType src) throws FHIRException { - org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException { - org.hl7.fhir.instance.model.BooleanType tgt = new org.hl7.fhir.instance.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - public org.hl7.fhir.r4.model.Bundle convertBundle(org.hl7.fhir.instance.model.Bundle src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -1062,6 +2680,60 @@ public class VersionConvertor_10_40 { return tgt; } + public org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.instance.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.r4.model.Bundle.BundleType.NULL; + } + } + + public org.hl7.fhir.instance.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.instance.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.instance.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.instance.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.instance.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.instance.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.instance.model.Bundle.BundleType.NULL; + } + } + + public org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.instance.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.instance.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + public org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -1101,6 +2773,48 @@ public class VersionConvertor_10_40 { return tgt; } + public org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.instance.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL; + } + } + + public org.hl7.fhir.instance.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.NULL; + } + } + public org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -1129,6 +2843,30 @@ public class VersionConvertor_10_40 { return tgt; } + public org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.instance.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL; + } + } + + public org.hl7.fhir.instance.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.NULL; + } + } + public org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -1153,80 +2891,6 @@ public class VersionConvertor_10_40 { return tgt; } - public org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.instance.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.instance.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.instance.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.r4.model.Bundle.BundleType.NULL; - } - } - - public org.hl7.fhir.instance.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.instance.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.instance.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.instance.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.instance.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.instance.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.instance.model.Bundle.BundleType.NULL; - } - } - public org.hl7.fhir.r4.model.CarePlan convertCarePlan(org.hl7.fhir.instance.model.CarePlan src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -1293,6 +2957,74 @@ public class VersionConvertor_10_40 { return tgt; } + public org.hl7.fhir.r4.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.instance.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; + case DRAFT: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.CANCELLED; + default: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { +// case PROPOSED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.PROPOSED; + case DRAFT: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.CANCELLED; + default: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.NULL; + } + } + +// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCarePlanRelationship(src.getCode())); +// tgt.setPlan(convertReference(src.getPlan())); +// return tgt; +// } + +// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCarePlanRelationship(src.getCode())); +// tgt.setPlan(convertReference(src.getPlan())); +// return tgt; +// } + +// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case INCLUDES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.INCLUDES; +// case REPLACES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.REPLACES; +// case FULFILLS: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.FULFILLS; +// default: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.NULL; +// } +// } + +// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case INCLUDES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.INCLUDES; +// case REPLACES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.REPLACES; +// case FULFILLS: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.FULFILLS; +// default: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.NULL; +// } +// } + // public org.hl7.fhir.r4.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { // if (src == null || src.isEmpty()) // return null; @@ -1423,32 +3155,6 @@ public class VersionConvertor_10_40 { } } - public org.hl7.fhir.r4.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.instance.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; - case DRAFT: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.CANCELLED; - default: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { -// case PROPOSED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.PROPOSED; - case DRAFT: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.CANCELLED; - default: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.NULL; - } - } - public org.hl7.fhir.r4.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.instance.model.ClinicalImpression src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -1507,30 +3213,6 @@ public class VersionConvertor_10_40 { return tgt; } - public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - tgt.setItem(convertCodeableConcept(src.getItem())); -// tgt.setCause(src.getCause()); - return tgt; - } - - public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - if (src.hasItemCodeableConcept()) - try { - tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - } -// tgt.setCause(src.getCause()); - return tgt; - } - public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { if (src == null) return null; @@ -1553,119 +3235,49 @@ public class VersionConvertor_10_40 { } } - public org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.instance.model.CodeType src) throws FHIRException { - org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } +// public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCodeableConcept(src.getCode())); +// for (org.hl7.fhir.instance.model.Reference t : src.getItem()) +// tgt.addItem(convertReference(t)); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCodeableConcept(src.getCode())); +// for (org.hl7.fhir.r4.model.Reference t : src.getItem()) +// tgt.addItem(convertReference(t)); +// return tgt; +// } - public org.hl7.fhir.instance.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException { - org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException { + public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent(); + org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent(); copyElement(src, tgt); - tgt.setSystem(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setCaseSensitive(src.getCaseSensitive()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(src, cc)); + tgt.setItem(convertCodeableConcept(src.getItem())); +// tgt.setCause(src.getCause()); return tgt; } -public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { + public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent(); + org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent(); copyElement(src, tgt); - tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); - tgt.setCode(src.getCode()); - tgt.setDefinition(src.getDefinition()); - tgt.setDisplay(src.getDisplay()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(cs, cc)); - for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) - tgt.addDesignation(convertCodeSystemDesignation(cc)); - return tgt; - } - -public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setUse(convertCoding(src.getUse())); - tgt.setLanguage(src.getLanguage()); - tgt.setValue(src.getValue()); - - return tgt; - } - - public org.hl7.fhir.r4.model.UriType convertCodeToUri(org.hl7.fhir.instance.model.CodeType src) throws FHIRException { - org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.instance.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.instance.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.CodeableConcept tgt = new org.hl7.fhir.instance.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.instance.model.CodeableConcept t) throws FHIRException { - org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext(); - // todo: set type.. - result.setValue(convertCodeableConcept(t)); - return result; - } - - public org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.instance.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public org.hl7.fhir.instance.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Coding tgt = new org.hl7.fhir.instance.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); + if (src.hasItemCodeableConcept()) + try { + tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + } +// tgt.setCause(src.getCause()); return tgt; } @@ -1719,6 +3331,32 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.instance.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.SUSPENDED; + case REJECTED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ENTEREDINERROR; + case FAILED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ABORTED; + default: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.SUSPENDED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.REJECTED; + case ABORTED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.FAILED; + default: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.NULL; + } + } + public org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -1764,6 +3402,20 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + private org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.instance.model.CodeableConcept priority) { + for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) { + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ROUTINE; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.URGENT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.STAT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) + return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ASAP; + } + return null; + } + public org.hl7.fhir.instance.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r4.model.CommunicationRequest src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -1791,22 +3443,16 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; + private org.hl7.fhir.instance.model.CodeableConcept convertPriorityCode(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority priority) { + org.hl7.fhir.instance.model.CodeableConcept cc = new org.hl7.fhir.instance.model.CodeableConcept(); + switch (priority) { + case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; + case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; + case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; + case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; + default: return null; + } + return cc; } public org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { @@ -1845,30 +3491,22 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } - public org.hl7.fhir.r4.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.instance.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) + public org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.SUSPENDED; - case REJECTED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ENTEREDINERROR; - case FAILED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ABORTED; - default: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NULL; - } + org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; } - public org.hl7.fhir.instance.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) + public org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.SUSPENDED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.REJECTED; - case ABORTED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.FAILED; - default: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.NULL; - } + org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; } public org.hl7.fhir.r4.model.Composition convertComposition(org.hl7.fhir.instance.model.Composition src) throws FHIRException { @@ -1929,27 +3567,27 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.instance.model.Composition.CompositionAttestationMode src) throws FHIRException { + public org.hl7.fhir.r4.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.instance.model.Composition.CompositionStatus src) throws FHIRException { if (src == null) return null; switch (src) { - case PERSONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL; + case PRELIMINARY: return org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL; } } - public org.hl7.fhir.instance.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode src) throws FHIRException { + public org.hl7.fhir.instance.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r4.model.Composition.CompositionStatus src) throws FHIRException { if (src == null) return null; switch (src) { - case PERSONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.NULL; + case PRELIMINARY: return org.hl7.fhir.instance.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.instance.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.instance.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.Composition.CompositionStatus.NULL; } } @@ -1977,6 +3615,30 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.instance.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL; + } + } + + public org.hl7.fhir.instance.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.NULL; + } + } + public org.hl7.fhir.r4.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.instance.model.Composition.CompositionEventComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -2003,48 +3665,59 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.instance.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r4.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.instance.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.instance.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.instance.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.Composition.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent src) throws FHIRException { + public org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.instance.model.Composition.SectionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent(); + org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent(); copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setText(convertNarrative(src.getText())); + try { + tgt.setMode(org.hl7.fhir.r4.model.Composition.SectionMode.fromCode(src.getMode())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.instance.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.instance.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); return tgt; } - public org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent src) throws FHIRException { + public org.hl7.fhir.instance.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent(); + org.hl7.fhir.instance.model.Composition.SectionComponent tgt = new org.hl7.fhir.instance.model.Composition.SectionComponent(); copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setText(convertNarrative(src.getText())); + tgt.setMode(src.getMode().toCode()); + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.r4.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); return tgt; } + private class SourceElementComponentWrapper { + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + private String source; + private String target; + private org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp; + + } + public org.hl7.fhir.r4.model.ConceptMap convertConceptMap(org.hl7.fhir.instance.model.ConceptMap src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -2080,6 +3753,26 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.instance.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext(); + // todo: set type.. + result.setValue(convertCodeableConcept(t)); + return result; + } + + + private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } + + public org.hl7.fhir.instance.model.ConceptMap convertConceptMap(org.hl7.fhir.r4.model.ConceptMap src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -2113,6 +3806,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; + default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + public org.hl7.fhir.r4.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -2135,6 +3850,63 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public List convertSourceElementComponent(org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.addTarget(convertTargetElementComponent(t)); + res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); + } + return res; + } + + public org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + tgt.setCodeSystem(g.getSource()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) + tgt.addTarget(convertTargetElementComponent(t, g)); + return tgt; + } + + public org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComment(src.getComments()); + for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + tgt.setCodeSystem(g.getTarget()); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComments(src.getComment()); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + public org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { if (src == null) return null; @@ -2169,99 +3941,25 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } - public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + public org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent(); + org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent(); copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getCodeSystem()); tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); return tgt; } - public org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + public org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent(); + org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent(); copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setCodeSystem(src.getSystem()); tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); return tgt; } @@ -2326,51 +4024,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - tgt.addCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.instance.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept cc : src.getCode()) - tgt.setCode(convertCodeableConcept(cc)); - for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.instance.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.instance.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r4.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.r4.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - public org.hl7.fhir.r4.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus src) throws FHIRException { if (src == null) return null; @@ -2399,26 +4052,49 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } - public org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) + public org.hl7.fhir.r4.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.instance.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } + org.hl7.fhir.r4.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.instance.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + return tgt; } - public org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) + public org.hl7.fhir.instance.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r4.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NULL; - } + org.hl7.fhir.instance.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.r4.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + tgt.addCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.instance.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept cc : src.getCode()) + tgt.setCode(convertCodeableConcept(cc)); + for (org.hl7.fhir.r4.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; } public org.hl7.fhir.r4.model.CapabilityStatement convertConformance(org.hl7.fhir.instance.model.Conformance src) throws FHIRException { @@ -2496,6 +4172,52 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.NULL; + } + } + + public org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.instance.model.Conformance.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NO: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NO; + case EXTENSIONS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; + case ELEMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.ELEMENTS; + case BOTH: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.BOTH; + default: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NO: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NO; + case EXTENSIONS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.EXTENSIONS; + case ELEMENTS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.ELEMENTS; + case BOTH: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.BOTH; + default: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NULL; + } + } + public org.hl7.fhir.r4.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -2518,48 +4240,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); return tgt; } - public org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + public org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent(); + org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent(); copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); return tgt; } - public org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.instance.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.SENDER; - case RECEIVER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.RECEIVER; - default: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.NULL; - } - } - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -2580,6 +4282,362 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + if (src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH) + tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.instance.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + boolean batch = false; + boolean transaction = false; + for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { + if (t.getCode().equals(SystemRestfulInteraction.BATCH)) + batch = true; + else + tgt.addInteraction(convertSystemInteractionComponent(t)); + if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) + transaction = true; + } + if (batch) + tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH); + else + tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.instance.model.Conformance.TransactionMode.NOTSUPPORTED); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + public org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.SERVER; + default: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.NULL; + } + } + + + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) + tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent(); + copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) + tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + for (org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.instance.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.instance.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(convertReference(src.getProfile())); + for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + public org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(convertReference(src.getDefinition())); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(convertReference(src.getDefinition())); + return tgt; + } + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -2658,422 +4716,87 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + public org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory src) throws FHIRException { if (src == null) return null; switch (src) { - case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; + case CONSEQUENCE: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.NULL; } } - public org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { + public org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { if (src == null) return null; switch (src) { - case DRAFT: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.RETIRED; - default: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.NULL; + case CONSEQUENCE: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NULL; } } - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) + public org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.instance.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH) - tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.instance.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - boolean batch = false; - boolean transaction = false; - for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { - if (t.getCode().equals(SystemRestfulInteraction.BATCH)) - batch = true; - else - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) - transaction = true; + switch (src) { + case SENDER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL; } - if (batch) - tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH); - else - tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.instance.model.Conformance.TransactionMode.NOTSUPPORTED); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.r4.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; } - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) + public org.hl7.fhir.instance.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; + switch (src) { + case SENDER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.RECEIVER; + default: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.NULL; + } } - public org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { + public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent(); + org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent(); copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.instance.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.instance.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); return tgt; } - public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + public org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent(); + org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent(); copyElement(src, tgt); - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); + tgt.setMode(convertDocumentMode(src.getMode())); tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(convertReference(src.getProfile())); return tgt; } - public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind src) throws FHIRException { + public org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.instance.model.Conformance.DocumentMode src) throws FHIRException { if (src == null) return null; switch (src) { - case INSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL; + case PRODUCER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER; + default: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL; } } - public org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + public org.hl7.fhir.instance.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException { if (src == null) return null; switch (src) { - case INSTANCE: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.NULL; - } - } - - public org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.r4.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.instance.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Patient.ContactComponent tgt = new org.hl7.fhir.r4.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r4.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Patient.ContactComponent tgt = new org.hl7.fhir.instance.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.instance.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ContactPoint tgt = new org.hl7.fhir.instance.model.ContactPoint(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - tgt.setRank(src.getRank()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER; - case URL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.instance.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.instance.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.r4.model.TestScript.ContentType convertContentType(org.hl7.fhir.instance.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.r4.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.r4.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.r4.model.TestScript.ContentType.NULL; - } - } - - public org.hl7.fhir.instance.model.TestScript.ContentType convertContentType(org.hl7.fhir.r4.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.instance.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.instance.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.instance.model.TestScript.ContentType.NULL; + case PRODUCER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.CONSUMER; + default: return org.hl7.fhir.instance.model.Conformance.DocumentMode.NULL; } } @@ -3137,32 +4860,235 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.instance.model.Count src) throws FHIRException { + public org.hl7.fhir.r4.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.instance.model.Contract.ActorComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count(); + org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent(); copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); + tgt.setActor(convertReference(src.getEntity())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); return tgt; } - public org.hl7.fhir.instance.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException { + public org.hl7.fhir.instance.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Count tgt = new org.hl7.fhir.instance.model.Count(); + org.hl7.fhir.instance.model.Contract.ActorComponent tgt = new org.hl7.fhir.instance.model.Contract.ActorComponent(); copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); + tgt.setEntity(convertReference(src.getActor())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); return tgt; } + public org.hl7.fhir.r4.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.instance.model.Contract.SignatoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r4.model.Contract.SignatoryComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setParty(convertReference(src.getParty())); + if (src.hasSignature()) + tgt.addSignature(new org.hl7.fhir.r4.model.Signature().setBlob(src.getSignature().getBytes())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r4.model.Contract.SignatoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.instance.model.Contract.SignatoryComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setParty(convertReference(src.getParty())); + for (org.hl7.fhir.r4.model.Signature t : src.getSignature()) + tgt.setSignature(Base64.encodeBase64String(t.getBlob())); + return tgt; + } + + public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.instance.model.Contract.ValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent(); + copyElement(src, tgt); + tgt.setEntity(convertType(src.getEntity())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(convertMoney(src.getNet())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.ValuedItemComponent(); + copyElement(src, tgt); + tgt.setEntity(convertType(src.getEntity())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(convertMoney(src.getNet())); + return tgt; + } + + public org.hl7.fhir.r4.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.instance.model.Contract.TermComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Contract.TermComponent tgt = new org.hl7.fhir.r4.model.Contract.TermComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(convertPeriod(src.getApplies())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSubType(convertCodeableConcept(src.getSubType())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getAction()) + tgt.addAction(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getActionReason()) + tgt.addActionReason(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.Contract.TermActorComponent t : src.getActor()) + tgt.addAgent(convertTermAgentComponent(t)); + for (org.hl7.fhir.instance.model.Contract.TermComponent t : src.getGroup()) + tgt.addGroup(convertTermComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r4.model.Contract.TermComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.TermComponent tgt = new org.hl7.fhir.instance.model.Contract.TermComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(convertPeriod(src.getApplies())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSubType(convertCodeableConcept(src.getSubType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction()) + tgt.addAction(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getActionReason()) + tgt.addActionReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Contract.AgentComponent t : src.getAgent()) + tgt.addActor(convertTermAgentComponent(t)); + for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getGroup()) + tgt.addGroup(convertTermComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.instance.model.Contract.TermActorComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent(); + copyElement(src, tgt); + tgt.setActor(convertReference(src.getEntity())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.TermActorComponent tgt = new org.hl7.fhir.instance.model.Contract.TermActorComponent(); + copyElement(src, tgt); + tgt.setEntity(convertReference(src.getActor())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.instance.model.Contract.TermValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent(); + copyElement(src, tgt); + tgt.setEntity(convertType(src.getEntity())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(convertMoney(src.getNet())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.TermValuedItemComponent(); + copyElement(src, tgt); + tgt.setEntity(convertType(src.getEntity())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(convertMoney(src.getNet())); + return tgt; + } + + public org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.r4.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.instance.model.Contract.LegalLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.LegalLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r4.model.Contract.LegalLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.LegalLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.r4.model.StructureDefinition convertDataElement(org.hl7.fhir.instance.model.DataElement src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -3195,7 +5121,7 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { if (t.hasSlicing()) slicePaths.add(t.getPath()); - tgt.getSnapshot().addElement(convertElementDefinition(t, slicePaths)); + tgt.getSnapshot().addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); } tgt.setKind(StructureDefinitionKind.LOGICAL); tgt.setAbstract(false); @@ -3205,6 +5131,66 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } +// public org.hl7.fhir.instance.model.DataElement convertDataElement(org.hl7.fhir.r4.model.DataElement src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.DataElement tgt = new org.hl7.fhir.instance.model.DataElement(); +// copyDomainResource(src, tgt); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setVersion(src.getVersion()); +// tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); +// if (src.hasExperimental()) +// tgt.setExperimental(src.getExperimental()); +// tgt.setPublisher(src.getPublisher()); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setName(src.getName()); +// for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) +// tgt.addContact(convertDataElementContactComponent(t)); +// for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) +// if (t.hasValueCodeableConcept()) +// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); +// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) +// tgt.addUseContext(convertCodeableConcept(t)); +// tgt.setCopyright(src.getCopyright()); +// tgt.setStringency(convertDataElementStringency(src.getStringency())); +// for (org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent t : src.getMapping()) +// tgt.addMapping(convertDataElementMappingComponent(t)); +// for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) +// tgt.addElement(convertElementDefinition(t)); +// return tgt; +// } + +// public org.hl7.fhir.r4.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.instance.model.DataElement.DataElementStringency src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case COMPARABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.COMPARABLE; +// case FULLYSPECIFIED: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FULLYSPECIFIED; +// case EQUIVALENT: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.EQUIVALENT; +// case CONVERTABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.CONVERTABLE; +// case SCALEABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.SCALEABLE; +// case FLEXIBLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FLEXIBLE; +// default: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.NULL; +// } +// } +// +// public org.hl7.fhir.instance.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r4.model.DataElement.DataElementStringency src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case COMPARABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.COMPARABLE; +// case FULLYSPECIFIED: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FULLYSPECIFIED; +// case EQUIVALENT: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.EQUIVALENT; +// case CONVERTABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.CONVERTABLE; +// case SCALEABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.SCALEABLE; +// case FLEXIBLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FLEXIBLE; +// default: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.NULL; +// } +// } + public org.hl7.fhir.r4.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.instance.model.DataElement.DataElementContactComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -3239,126 +5225,18 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.instance.model.DateType src) throws FHIRException { - org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException { - org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - -// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { +// public org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent src) throws FHIRException { // if (src == null || src.isEmpty()) // return null; -// org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent(); +// org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent(); // copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); +// tgt.setIdentity(src.getIdentity()); +// tgt.setUri(src.getUri()); +// tgt.setName(src.getName()); +// tgt.setComments(src.getComment()); // return tgt; // } -// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); -// return tgt; -// } - -// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - -// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - - public org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.instance.model.DateTimeType tgt = new org.hl7.fhir.instance.model.DateTimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.instance.model.DecimalType src) throws FHIRException { - org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException { - org.hl7.fhir.instance.model.DecimalType tgt = new org.hl7.fhir.instance.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - public org.hl7.fhir.r4.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.instance.model.DetectedIssue src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -3401,6 +5279,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + public org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -3425,50 +5325,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } -// public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.instance.model.Reference t : src.getItem()) -// tgt.addItem(convertReference(t)); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.r4.model.Reference t : src.getItem()) -// tgt.addItem(convertReference(t)); -// return tgt; -// } - - public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - - public org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - public org.hl7.fhir.r4.model.Device convertDevice(org.hl7.fhir.instance.model.Device src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -3524,6 +5380,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.instance.model.Device.DeviceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ACTIVE; + case NOTAVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.AVAILABLE; + case INACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.NOTAVAILABLE; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Device.DeviceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.Device.DeviceStatus.NULL; + } + } + public org.hl7.fhir.r4.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.instance.model.DeviceComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -3564,6 +5442,44 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OTHER: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OTHER; + case CHEMICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; + case ELECTRICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; + case IMPEDANCE: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; + case NUCLEAR: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; + case OPTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OPTICAL; + case THERMAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.THERMAL; + case BIOLOGICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; + case MECHANICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; + case ACOUSTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; + case MANUAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MANUAL; + default: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NULL; + } + } + + public org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OTHER: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OTHER; + case CHEMICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; + case ELECTRICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; + case IMPEDANCE: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; + case NUCLEAR: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; + case OPTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OPTICAL; + case THERMAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.THERMAL; + case BIOLOGICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; + case MECHANICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; + case ACOUSTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; + case MANUAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MANUAL; + default: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NULL; + } + } + public org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -3624,97 +5540,25 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { if (src == null) return null; switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + case ON: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; } } - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { if (src == null) return null; switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NULL; - } - } - - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.NULL; - } - } - - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.NULL; + case ON: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; } } @@ -3750,47 +5594,97 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } - public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { if (src == null) return null; switch (src) { - case ON: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + case MEASUREMENT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.NULL; } } - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { if (src == null) return null; switch (src) { - case ON: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + case MEASUREMENT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.NULL; } } - public org.hl7.fhir.r4.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.instance.model.Device.DeviceStatus src) throws FHIRException { + public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent(); + copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent(); + copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { if (src == null) return null; switch (src) { - case AVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ACTIVE; - case NOTAVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.NULL; + case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.NULL; } } - public org.hl7.fhir.instance.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus src) throws FHIRException { + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { if (src == null) return null; switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.AVAILABLE; - case INACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.NOTAVAILABLE; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Device.DeviceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.Device.DeviceStatus.NULL; + case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTCALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTCALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NULL; } } @@ -3835,6 +5729,49 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } +// public org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException { +// if (src ==/* null || src.isEmpty()*/) +// return null; +// switch (src) { +// case PROPOSED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED; +// case DRAFT: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT; +// case PLANNED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED; +// case RECEIVED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED; +// case ACCEPTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED; +// case INPROGRESS: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS; +// case REVIEW: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW; +// case COMPLETED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED; +// case CANCELLED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED; +// case SUSPENDED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED; +// case REJECTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED; +// case FAILED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED; +// default: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.NULL; +// } +// } +// +// public org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException { +// if (src ==/* null || src.isEmpty()*/) +// return null; +// switch (src) { +// case PROPOSED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED; +// case DRAFT: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT; +// case PLANNED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED; +// case RECEIVED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED; +// case ACCEPTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED; +// case INPROGRESS: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS; +// case REVIEW: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW; +// case COMPLETED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED; +// case CANCELLED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED; +// case SUSPENDED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED; +// case REJECTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED; +// case FAILED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED; +// default: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.NULL; +// } +// } + + public org.hl7.fhir.r4.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.instance.model.DiagnosticReport src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -3901,26 +5838,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - - public org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - public org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { if (src == null) return null; @@ -3951,79 +5868,26 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } - public org.hl7.fhir.r4.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.instance.model.Media.DigitalMediaType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHOTO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.PHOTO; - case VIDEO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.VIDEO; - case AUDIO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.AUDIO; - default: return org.hl7.fhir.r4.model.Media.DigitalMediaType.NULL; - } - } - - public org.hl7.fhir.instance.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.r4.model.Media.DigitalMediaType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHOTO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.PHOTO; - case VIDEO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.VIDEO; - case AUDIO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.AUDIO; - default: return org.hl7.fhir.instance.model.Media.DigitalMediaType.NULL; - } - } - - public org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.instance.model.Distance src) throws FHIRException { + public org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance(); + org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent(); copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); + tgt.setComment(src.getComment()); + tgt.setLink(convertReference(src.getLink())); return tgt; } - public org.hl7.fhir.instance.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException { + public org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Distance tgt = new org.hl7.fhir.instance.model.Distance(); + org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent(); copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); + tgt.setComment(src.getComment()); + tgt.setLink(convertReference(src.getLink())); return tgt; } - private ReferredDocumentStatus convertDocStatus(CodeableConcept cc) { - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) - return ReferredDocumentStatus.PRELIMINARY; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) - return ReferredDocumentStatus.FINAL; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) - return ReferredDocumentStatus.AMENDED; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) - return ReferredDocumentStatus.ENTEREDINERROR; - - return null; - } - - private CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) { - CodeableConcept cc = new CodeableConcept (); - switch (docStatus) { - case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break; - case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break; - case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break; - case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break; - default: return null; - } - return cc; - } - public org.hl7.fhir.r4.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.instance.model.DocumentManifest src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -4066,6 +5930,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + public org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { @@ -4088,26 +5974,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.instance.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.CONSUMER; - default: return org.hl7.fhir.instance.model.Conformance.DocumentMode.NULL; - } - } - public org.hl7.fhir.r4.model.DocumentReference convertDocumentReference(org.hl7.fhir.instance.model.DocumentReference src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -4135,6 +6001,31 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + private ReferredDocumentStatus convertDocStatus(CodeableConcept cc) { + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) + return ReferredDocumentStatus.PRELIMINARY; + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) + return ReferredDocumentStatus.FINAL; + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) + return ReferredDocumentStatus.AMENDED; + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) + return ReferredDocumentStatus.ENTEREDINERROR; + + return null; + } + + private CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) { + CodeableConcept cc = new CodeableConcept (); + switch (docStatus) { + case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break; + case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break; + case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break; + case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break; + default: return null; + } + return cc; + } + public org.hl7.fhir.instance.model.DocumentReference convertDocumentReference(org.hl7.fhir.r4.model.DocumentReference src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -4162,6 +6053,51 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + + public org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + public org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + public org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -4237,376 +6173,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.instance.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Duration tgt = new org.hl7.fhir.instance.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.instance.model.ElementDefinition src, List slicePaths) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.instance.model.Enumeration t : src.getRepresentation()) - tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); - if (src.hasName()) { - if (slicePaths.contains(src.getPath())) - tgt.setSliceName(src.getName()); - tgt.setId(src.getName()); - } - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.instance.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.instance.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasNameReference()) - tgt.setContentReference("#"+src.getNameReference()); - for (org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertElementDefinitionTypeComponent(t)); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.instance.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition tgt = new org.hl7.fhir.instance.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation()) - tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); - if (src.hasSliceName()) - tgt.setName(src.getSliceName()); - else - tgt.setName(src.getId()); - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.r4.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - tgt.setShort(src.getShort()); - tgt.setDefinition(src.getDefinition()); - tgt.setComments(src.getComment()); - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.r4.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setNameReference(src.getContentReference().substring(1)); - for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertElementDefinitionTypeComponent(t)); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExampleFirstRep().getValue())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.r4.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - tgt.setMustSupport(src.getMustSupport()); - tgt.setIsModifier(src.getIsModifier()); - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.StringType t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCodeElement(convertCodeToUri(src.getCodeElement())); - for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) - if (src.hasCode() && "Reference".equals(src.getCode())) - tgt.setTargetProfile(t.getValueAsString()); - else - tgt.setProfile(t.getValue()); - for (org.hl7.fhir.instance.model.Enumeration t : src.getAggregation()) - tgt.addAggregation(convertAggregationMode(t.getValue())); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCodeElement(convertUriToCode(src.getCodeElement())); - if (src.hasCode() && "Reference".equals(src.getCode())) { - if (src.hasTargetProfile()) - tgt.addProfile(src.getTargetProfile()); - } else if (src.hasProfile()) - tgt.addProfile(src.getProfile()); - for (org.hl7.fhir.r4.model.Enumeration t : src.getAggregation()) - tgt.addAggregation(convertAggregationMode(t.getValue())); - return tgt; - } public org.hl7.fhir.r4.model.Encounter convertEncounter(org.hl7.fhir.instance.model.Encounter src) throws FHIRException { if (src == null || src.isEmpty()) @@ -4676,6 +6242,34 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.instance.model.Encounter.EncounterState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ARRIVED; + case INPROGRESS: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED; + default: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.r4.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.instance.model.Encounter.EncounterState.PLANNED; + case ARRIVED: return org.hl7.fhir.instance.model.Encounter.EncounterState.ARRIVED; + case INPROGRESS: return org.hl7.fhir.instance.model.Encounter.EncounterState.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.instance.model.Encounter.EncounterState.ONLEAVE; + case FINISHED: return org.hl7.fhir.instance.model.Encounter.EncounterState.FINISHED; + case CANCELLED: return org.hl7.fhir.instance.model.Encounter.EncounterState.CANCELLED; + default: return org.hl7.fhir.instance.model.Encounter.EncounterState.NULL; + } + } + public org.hl7.fhir.r4.model.Coding convertEncounterClass(org.hl7.fhir.instance.model.Encounter.EncounterClass src) throws FHIRException { if (src == null) return null; @@ -4707,6 +6301,50 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return org.hl7.fhir.instance.model.Encounter.EncounterClass.NULL; } +// public org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent(); +// copyElement(src, tgt); +// tgt.setStatus(convertEncounterState(src.getStatus())); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// return tgt; +// } + +// public org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent(); +// copyElement(src, tgt); +// tgt.setStatus(convertEncounterState(src.getStatus())); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// return tgt; +// } + + public org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + + public org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + public org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -4793,58 +6431,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } - public org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.r4.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.instance.model.Encounter.EncounterState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED; - case ARRIVED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ARRIVED; - case INPROGRESS: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ONLEAVE; - case FINISHED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED; - default: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.r4.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.instance.model.Encounter.EncounterState.PLANNED; - case ARRIVED: return org.hl7.fhir.instance.model.Encounter.EncounterState.ARRIVED; - case INPROGRESS: return org.hl7.fhir.instance.model.Encounter.EncounterState.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.instance.model.Encounter.EncounterState.ONLEAVE; - case FINISHED: return org.hl7.fhir.instance.model.Encounter.EncounterState.FINISHED; - case CANCELLED: return org.hl7.fhir.instance.model.Encounter.EncounterState.CANCELLED; - default: return org.hl7.fhir.instance.model.Encounter.EncounterState.NULL; - } - } - public org.hl7.fhir.r4.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.instance.model.EnrollmentRequest src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -5003,115 +6589,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.instance.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.r4.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.r4.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.r4.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.r4.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.r4.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.r4.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.r4.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.r4.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.r4.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.r4.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.r4.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.r4.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.r4.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.r4.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.instance.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.instance.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.instance.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.instance.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.instance.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.instance.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.instance.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.instance.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.instance.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.instance.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.instance.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.instance.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.instance.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.instance.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.instance.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.instance.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.instance.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.instance.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Extension tgt = new org.hl7.fhir.instance.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.NULL; - } - } - - public org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.NULL; - } - } - - public org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } public org.hl7.fhir.r4.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.instance.model.FamilyMemberHistory src) throws FHIRException { if (src == null || src.isEmpty()) @@ -5159,6 +6636,30 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + public org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -5183,34 +6684,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.instance.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL; - } - } - - public org.hl7.fhir.instance.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NULL; - } - } - public org.hl7.fhir.r4.model.Flag convertFlag(org.hl7.fhir.instance.model.Flag src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -5267,24 +6740,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } - public org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - public org.hl7.fhir.r4.model.Group convertGroup(org.hl7.fhir.instance.model.Group src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -5323,6 +6778,34 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Group.GroupType convertGroupType(org.hl7.fhir.instance.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.r4.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.r4.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.r4.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.r4.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.r4.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.r4.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.r4.model.Group.GroupType.NULL; + } + } + + public org.hl7.fhir.instance.model.Group.GroupType convertGroupType(org.hl7.fhir.r4.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.instance.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.instance.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.instance.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.instance.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.instance.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.instance.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.instance.model.Group.GroupType.NULL; + } + } + public org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -5369,182 +6852,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } -// public org.hl7.fhir.instance.model.DataElement convertDataElement(org.hl7.fhir.r4.model.DataElement src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.DataElement tgt = new org.hl7.fhir.instance.model.DataElement(); -// copyDomainResource(src, tgt); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setVersion(src.getVersion()); -// tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); -// if (src.hasExperimental()) -// tgt.setExperimental(src.getExperimental()); -// tgt.setPublisher(src.getPublisher()); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setName(src.getName()); -// for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) -// tgt.addContact(convertDataElementContactComponent(t)); -// for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) -// if (t.hasValueCodeableConcept()) -// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) -// tgt.addUseContext(convertCodeableConcept(t)); -// tgt.setCopyright(src.getCopyright()); -// tgt.setStringency(convertDataElementStringency(src.getStringency())); -// for (org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent t : src.getMapping()) -// tgt.addMapping(convertDataElementMappingComponent(t)); -// for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) -// tgt.addElement(convertElementDefinition(t)); -// return tgt; -// } - -// public org.hl7.fhir.r4.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.instance.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.NULL; -// } -// } -// -// public org.hl7.fhir.instance.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r4.model.DataElement.DataElementStringency src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case COMPARABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.COMPARABLE; -// case FULLYSPECIFIED: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FULLYSPECIFIED; -// case EQUIVALENT: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.EQUIVALENT; -// case CONVERTABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.CONVERTABLE; -// case SCALEABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.SCALEABLE; -// case FLEXIBLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FLEXIBLE; -// default: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.NULL; -// } -// } - - public org.hl7.fhir.r4.model.Group.GroupType convertGroupType(org.hl7.fhir.instance.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.r4.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.r4.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.r4.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.r4.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.r4.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.r4.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.r4.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.instance.model.Group.GroupType convertGroupType(org.hl7.fhir.r4.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.instance.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.instance.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.instance.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.instance.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.instance.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.instance.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.instance.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - -// public org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent(); -// copyElement(src, tgt); -// tgt.setIdentity(src.getIdentity()); -// tgt.setUri(src.getUri()); -// tgt.setName(src.getName()); -// tgt.setComments(src.getComment()); -// return tgt; -// } - - public org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - - public org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - public org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - public org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.instance.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL; - } - } - - public org.hl7.fhir.instance.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.NULL; - } - } - public org.hl7.fhir.r4.model.HealthcareService convertHealthcareService(org.hl7.fhir.instance.model.HealthcareService src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -5661,6 +6968,36 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.NULL; + } + } + public org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -5681,138 +7018,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - for (org.hl7.fhir.instance.model.StringType t : src.getFamily()) - tgt.setFamily(t.getValue()); - for (org.hl7.fhir.instance.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.instance.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.instance.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.HumanName tgt = new org.hl7.fhir.instance.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.addFamily(src.getFamily()); - for (org.hl7.fhir.r4.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.r4.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.instance.model.IdType src) throws FHIRException { - org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException { - org.hl7.fhir.instance.model.IdType tgt = new org.hl7.fhir.instance.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.instance.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSystem(src.getSystem()); - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.instance.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Identifier tgt = new org.hl7.fhir.instance.model.Identifier(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertIdentifierUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.instance.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL; - } - } - - public org.hl7.fhir.instance.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.NULL; - } - } - - public org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.NULL; - } - } - - public org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.NULL; - } - } - // public org.hl7.fhir.r4.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.instance.model.ImagingObjectSelection src) throws FHIRException { // if (src == null || src.isEmpty()) // return null; @@ -5996,6 +7201,30 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ONLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.ONLINE; + case OFFLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.OFFLINE; + case NEARLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.NEARLINE; + case UNAVAILABLE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; + default: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.NULL; + } + } + + public org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ONLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.ONLINE; + case OFFLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.OFFLINE; + case NEARLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NEARLINE; + case UNAVAILABLE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; + default: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NULL; + } + } + public org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -6132,6 +7361,38 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + private org.hl7.fhir.r4.model.Reference getPerformer(List practitioner) { + for (ImmunizationPractitionerComponent p : practitioner) { + if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "AP")) + return p.getActor(); + } + return null; + } + + private org.hl7.fhir.r4.model.Reference getRequester(List practitioner) { + for (ImmunizationPractitionerComponent p : practitioner) { + if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "OP")) + return p.getActor(); + } + return null; + } + + private boolean hasConcept(org.hl7.fhir.r4.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.r4.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + private boolean hasConcept(org.hl7.fhir.instance.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.instance.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + public org.hl7.fhir.r4.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -6168,48 +7429,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } -// public org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED; -// case FAILED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED; -// default: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.NULL; -// } -// } -// -// public org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED; -// case FAILED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED; -// default: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.NULL; -// } -// } - public org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -6222,6 +7441,40 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent(); + copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + tgt.setSeriesDoses(src.getSeriesDoses()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getTargetDisease()) + tgt.addTargetDisease(convertCodeableConcept(t)); + tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); + tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); + return tgt; + } + + public org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent(); + copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + tgt.setSeriesDoses(src.getSeriesDoses()); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTargetDisease()) + tgt.addTargetDisease(convertCodeableConcept(t)); + tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); + tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); + return tgt; + } + public org.hl7.fhir.r4.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.instance.model.ImmunizationRecommendation src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -6332,40 +7585,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - tgt.setSeriesDoses(src.getSeriesDoses()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getTargetDisease()) - tgt.addTargetDisease(convertCodeableConcept(t)); - tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); - tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); - return tgt; - } - - public org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - tgt.setSeriesDoses(src.getSeriesDoses()); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTargetDisease()) - tgt.addTargetDisease(convertCodeableConcept(t)); - tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); - tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); - return tgt; - } - public org.hl7.fhir.r4.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.instance.model.ImplementationGuide src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -6480,24 +7699,24 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) + public org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) return null; - org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; + switch (src) { + case REFERENCE: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.NULL; + } } - public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) + public org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) return null; - org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; + switch (src) { + case REFERENCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.NULL; + } } public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { @@ -6555,6 +7774,26 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + + public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -6591,348 +7830,38 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability src) throws FHIRException { + public org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind src) throws FHIRException { if (src == null) return null; switch (src) { - case ONLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.ONLINE; - case OFFLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.OFFLINE; - case NEARLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.NEARLINE; - case UNAVAILABLE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; - default: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.NULL; + case PAGE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.NULL; } } - public org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability src) throws FHIRException { + public org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind src) throws FHIRException { if (src == null) return null; switch (src) { - case ONLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.ONLINE; - case OFFLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.OFFLINE; - case NEARLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NEARLINE; - case UNAVAILABLE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; - default: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NULL; + case PAGE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.NULL; } } - public org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.instance.model.InstantType src) throws FHIRException { - org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException { - org.hl7.fhir.instance.model.InstantType tgt = new org.hl7.fhir.instance.model.InstantType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.instance.model.IntegerType src) throws FHIRException { - org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException { - org.hl7.fhir.instance.model.IntegerType tgt = new org.hl7.fhir.instance.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.instance.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL; - } - } - -// public org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - -// public org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - - public org.hl7.fhir.instance.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NULL; - } - } - - public org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent(); - copyElement(src, tgt); - tgt.setSequenceLinkId(src.getSequenceLinkId()); - return tgt; - } - - public org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent(); - copyElement(src, tgt); - tgt.setSequenceLinkId(src.getSequenceLinkId()); - return tgt; - } - - public org.hl7.fhir.r4.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.instance.model.Contract.LegalLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.LegalLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r4.model.Contract.LegalLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.LegalLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.r4.model.Patient.LinkType convertLinkType(org.hl7.fhir.instance.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACE: return org.hl7.fhir.r4.model.Patient.LinkType.REPLACEDBY; - case REFER: return org.hl7.fhir.r4.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.r4.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.r4.model.Patient.LinkType.NULL; - } - } - - public org.hl7.fhir.instance.model.Patient.LinkType convertLinkType(org.hl7.fhir.r4.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACEDBY: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE; - case REPLACES: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE; - case REFER: return org.hl7.fhir.instance.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.instance.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.instance.model.Patient.LinkType.NULL; - } - } - - public org.hl7.fhir.r4.model.ListResource convertList(org.hl7.fhir.instance.model.List_ src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ListResource tgt = new org.hl7.fhir.r4.model.ListResource(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - if (src.hasNote()) - tgt.addNote(new org.hl7.fhir.r4.model.Annotation().setText(src.getNote())); - for (org.hl7.fhir.instance.model.List_.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.List_ convertList(org.hl7.fhir.r4.model.ListResource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.List_ tgt = new org.hl7.fhir.instance.model.List_(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.r4.model.ListResource.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.instance.model.List_.ListEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r4.model.ListResource.ListEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public org.hl7.fhir.instance.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.r4.model.ListResource.ListEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.List_.ListEntryComponent tgt = new org.hl7.fhir.instance.model.List_.ListEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public org.hl7.fhir.r4.model.ListResource.ListMode convertListMode(org.hl7.fhir.instance.model.List_.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.r4.model.ListResource.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.r4.model.ListResource.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.r4.model.ListResource.ListMode.CHANGES; - default: return org.hl7.fhir.r4.model.ListResource.ListMode.NULL; - } - } - - public org.hl7.fhir.instance.model.List_.ListMode convertListMode(org.hl7.fhir.r4.model.ListResource.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.instance.model.List_.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.instance.model.List_.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.instance.model.List_.ListMode.CHANGES; - default: return org.hl7.fhir.instance.model.List_.ListMode.NULL; - } - } - - public org.hl7.fhir.r4.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.instance.model.List_.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.r4.model.ListResource.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.r4.model.ListResource.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.ListResource.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.ListResource.ListStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.List_.ListStatus convertListStatus(org.hl7.fhir.r4.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.instance.model.List_.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.instance.model.List_.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.List_.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.List_.ListStatus.NULL; - } - } public org.hl7.fhir.r4.model.Location convertLocation(org.hl7.fhir.instance.model.Location src) throws FHIRException { if (src == null || src.isEmpty()) @@ -6978,6 +7907,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.instance.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.r4.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.r4.model.Location.LocationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r4.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.instance.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.instance.model.Location.LocationStatus.NULL; + } + } + public org.hl7.fhir.r4.model.Location.LocationMode convertLocationMode(org.hl7.fhir.instance.model.Location.LocationMode src) throws FHIRException { if (src == null) return null; @@ -7020,78 +7971,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.instance.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.r4.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.r4.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r4.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.instance.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.instance.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.instance.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.instance.model.MarkdownType tgt = new org.hl7.fhir.instance.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OTHER: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OTHER; - case CHEMICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; - case ELECTRICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; - case IMPEDANCE: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; - case NUCLEAR: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; - case OPTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OPTICAL; - case THERMAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.THERMAL; - case BIOLOGICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; - case MECHANICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; - case ACOUSTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; - case MANUAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MANUAL; - default: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NULL; - } - } - - public org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OTHER: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OTHER; - case CHEMICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; - case ELECTRICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; - case IMPEDANCE: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; - case NUCLEAR: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; - case OPTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OPTICAL; - case THERMAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.THERMAL; - case BIOLOGICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; - case MECHANICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; - case ACOUSTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; - case MANUAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MANUAL; - default: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NULL; - } - } - public org.hl7.fhir.r4.model.Media convertMedia(org.hl7.fhir.instance.model.Media src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -7134,6 +8013,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.instance.model.Media.DigitalMediaType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHOTO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.PHOTO; + case VIDEO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.VIDEO; + case AUDIO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.AUDIO; + default: return org.hl7.fhir.r4.model.Media.DigitalMediaType.NULL; + } + } + + public org.hl7.fhir.instance.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.r4.model.Media.DigitalMediaType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHOTO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.PHOTO; + case VIDEO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.VIDEO; + case AUDIO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.AUDIO; + default: return org.hl7.fhir.instance.model.Media.DigitalMediaType.NULL; + } + } + public org.hl7.fhir.r4.model.Medication convertMedication(org.hl7.fhir.instance.model.Medication src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -7160,1128 +8061,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.instance.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MedicationDispense tgt = new org.hl7.fhir.r4.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.instance.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.instance.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r4.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationDispense tgt = new org.hl7.fhir.instance.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.r4.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public org.hl7.fhir.r4.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.STOPPED; - default: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.STOPPED; - default: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageComponent(); - copyElement(src, tgt); - tgt.setContainer(convertCodeableConcept(src.getContainer())); - for (org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent t : src.getContent()) - tgt.addContent(convertMedicationPackageContentComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageComponent(); - copyElement(src, tgt); - tgt.setContainer(convertCodeableConcept(src.getContainer())); - for (org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent t : src.getContent()) - tgt.addContent(convertMedicationPackageContentComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent(); - copyElement(src, tgt); - tgt.setItem(convertType(src.getItem())); - tgt.setAmount(convertSimpleQuantity(src.getAmount())); - return tgt; - } - - public org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent(); - copyElement(src, tgt); - if (src.hasItemReference()) - tgt.setItem((org.hl7.fhir.instance.model.Reference) convertType(src.getItem())); - tgt.setAmount(convertSimpleQuantity(src.getAmount())); - return tgt; - } - - public org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.instance.model.MedicationStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.instance.model.Reference t : src.getSupportingInformation()) - tgt.addDerivedFrom(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N"); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotTaken()) - tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r4.model.MedicationStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationStatement tgt = new org.hl7.fhir.instance.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonNotTaken()) - tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED; - default: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.INTENDED; - default: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.r4.model.MessageHeader convertMessageHeader(org.hl7.fhir.instance.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MessageHeader tgt = new org.hl7.fhir.r4.model.MessageHeader(); - copyDomainResource(src, tgt); - tgt.setTimestamp(src.getTimestamp()); - tgt.setEvent(convertCoding(src.getEvent())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.instance.model.Reference t : src.getData()) - tgt.addFocus(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.MessageHeader convertMessageHeader(org.hl7.fhir.r4.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MessageHeader tgt = new org.hl7.fhir.instance.model.MessageHeader(); - copyDomainResource(src, tgt); - tgt.setTimestamp(src.getTimestamp()); - tgt.setEvent(convertCoding(src.getEvent())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.r4.model.Reference t : src.getFocus()) - tgt.addData(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NULL; - } - } - - public org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.instance.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.instance.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.instance.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Meta tgt = new org.hl7.fhir.instance.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.r4.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.r4.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.r4.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.instance.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Money tgt = new org.hl7.fhir.instance.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.instance.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.r4.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.r4.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.instance.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.instance.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.instance.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.instance.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.instance.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.instance.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.instance.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.instance.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.instance.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.instance.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - public org.hl7.fhir.instance.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.NamingSystem tgt = new org.hl7.fhir.instance.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.instance.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.instance.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.instance.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Narrative tgt = new org.hl7.fhir.instance.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.instance.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Observation convertObservation(org.hl7.fhir.instance.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Observation tgt = new org.hl7.fhir.r4.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.instance.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); - tgt.setComment(src.getComments()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent t : src.getRelated()) - tgt.addRelated(convertObservationRelatedComponent(t)); - for (org.hl7.fhir.instance.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Observation convertObservation(org.hl7.fhir.r4.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Observation tgt = new org.hl7.fhir.instance.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - for (org.hl7.fhir.r4.model.CodeableConcept c : src.getCategory()) - tgt.setCategory(convertCodeableConcept(c)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); - tgt.setComments(src.getComment()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent t : src.getRelated()) - tgt.addRelated(convertObservationRelatedComponent(t)); - for (org.hl7.fhir.r4.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.instance.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - tgt.setType(convertCodeableConcept(src.getMeaning())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); -// for (org.hl7.fhir.r4.model.CodeableConcept c : src.getMeaning()) - tgt.setMeaning(convertCodeableConcept(src.getType())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(convertObservationRelationshipType(src.getType())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(convertObservationRelationshipType(src.getType())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.r4.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.instance.model.Observation.ObservationRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HASMEMBER: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.HASMEMBER; - case DERIVEDFROM: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.DERIVEDFROM; - case SEQUELTO: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.SEQUELTO; - case REPLACES: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.REPLACES; - case QUALIFIEDBY: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.QUALIFIEDBY; - case INTERFEREDBY: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.INTERFEREDBY; - default: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.NULL; - } - } - - public org.hl7.fhir.instance.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.r4.model.Observation.ObservationRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HASMEMBER: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.HASMEMBER; - case DERIVEDFROM: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.DERIVEDFROM; - case SEQUELTO: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.SEQUELTO; - case REPLACES: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.REPLACES; - case QUALIFIEDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.QUALIFIEDBY; - case INTERFEREDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.INTERFEREDBY; - default: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.NULL; - } - } - - public org.hl7.fhir.r4.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.instance.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.r4.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.r4.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.r4.model.Observation.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.instance.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.instance.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.instance.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.instance.model.Observation.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.instance.model.OidType src) throws FHIRException { - org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException { - org.hl7.fhir.instance.model.OidType tgt = new org.hl7.fhir.instance.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.instance.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setPurpose(src.getRequirements()); - if (src.hasIdempotent()) - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - tgt.setComment(src.getNotes()); - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - for (org.hl7.fhir.instance.model.CodeType t : src.getType()) - tgt.addResource(t.getValue()); - tgt.setType(tgt.hasResource()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationDefinition tgt = new org.hl7.fhir.instance.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setRequirements(src.getPurpose()); - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - tgt.setNotes(src.getComment()); - if (src.hasBase()) - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - if (src.getType()) - for (org.hl7.fhir.r4.model.CodeType t : src.getResource()) - tgt.addType(t.getValue()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - if (src.hasSearchType()) { - tgt.setType(src.getSearchType().toCode()); - tgt.setType("string"); - } else - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertReference(src.getProfile())); - if (src.hasBinding()) - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.instance.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL; - } - } - // public org.hl7.fhir.r4.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.instance.model.Medication.MedicationProductComponent src) throws FHIRException { // if (src == null || src.isEmpty()) // return null; @@ -8349,158 +8128,191 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen // return tgt; // } - public org.hl7.fhir.instance.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException { + public org.hl7.fhir.r4.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageComponent(); + copyElement(src, tgt); + tgt.setContainer(convertCodeableConcept(src.getContainer())); + for (org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent t : src.getContent()) + tgt.addContent(convertMedicationPackageContentComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageComponent(); + copyElement(src, tgt); + tgt.setContainer(convertCodeableConcept(src.getContainer())); + for (org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent t : src.getContent()) + tgt.addContent(convertMedicationPackageContentComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent(); + copyElement(src, tgt); + tgt.setItem(convertType(src.getItem())); + tgt.setAmount(convertSimpleQuantity(src.getAmount())); + return tgt; + } + + public org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent(); + copyElement(src, tgt); + if (src.hasItemReference()) + tgt.setItem((org.hl7.fhir.instance.model.Reference) convertType(src.getItem())); + tgt.setAmount(convertSimpleQuantity(src.getAmount())); + return tgt; + } + + public org.hl7.fhir.r4.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.instance.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MedicationDispense tgt = new org.hl7.fhir.r4.model.MedicationDispense(); + copyDomainResource(src, tgt); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setSubject(convertReference(src.getPatient())); +// tgt.setDispenser(convertReference(src.getDispenser())); + for (org.hl7.fhir.instance.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.instance.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public org.hl7.fhir.instance.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r4.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MedicationDispense tgt = new org.hl7.fhir.instance.model.MedicationDispense(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setPatient(convertReference(src.getSubject())); +// tgt.setDispenser(convertReference(src.getDispenser())); + for (org.hl7.fhir.r4.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.setNote(t.getText()); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { if (src == null) return null; switch (src) { - case OPERATION: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.NULL; + case INPROGRESS: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.STOPPED; + default: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.NULL; } } - public org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.instance.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationOutcome tgt = new org.hl7.fhir.instance.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.instance.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.r4.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { if (src == null) return null; switch (src) { - case IN: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL; + case INPROGRESS: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.STOPPED; + default: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.NULL; } } - public org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.instance.model.Organization src) throws FHIRException { + public org.hl7.fhir.r4.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.addType(convertCodeableConcept(src.getType())); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.instance.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.instance.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Organization tgt = new org.hl7.fhir.instance.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.r4.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.instance.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent(); + org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); return tgt; } - public org.hl7.fhir.instance.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException { + public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.instance.model.Organization.OrganizationContactComponent(); + org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); return tgt; } - public org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent src) throws FHIRException { + public org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent(); + org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); copyElement(src, tgt); - tgt.setProperty(src.getElement()); - tgt.setSystem(src.getCodeSystem()); - tgt.setCode(src.getCode()); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + copyElement(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); return tgt; } @@ -8592,24 +8404,40 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen // } // } - public org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException { + public org.hl7.fhir.r4.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent(); + org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); copyElement(src, tgt); - tgt.setElement(src.getProperty()); - tgt.setCodeSystem(src.getSystem()); - tgt.setCode(src.getCode()); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); return tgt; } - public org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.instance.model.Parameters src) throws FHIRException { + public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); + org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); return tgt; } @@ -8659,114 +8487,1003 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen // return tgt; // } - public org.hl7.fhir.instance.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException { + public org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.instance.model.MedicationStatement src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Parameters tgt = new org.hl7.fhir.instance.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); + org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setSubject(convertReference(src.getPatient())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setInformationSource(convertReference(src.getInformationSource())); + for (org.hl7.fhir.instance.model.Reference t : src.getSupportingInformation()) + tgt.addDerivedFrom(convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); +// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N"); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotTaken()) + tgt.addReasonNotTaken(convertCodeableConcept(t)); +// tgt.setReasonForUse(convertType(src.getReasonForUse())); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) + tgt.addDosage(convertMedicationStatementDosageComponent(t)); return tgt; } - public org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent src) throws FHIRException { + public org.hl7.fhir.instance.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r4.model.MedicationStatement src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent(); + org.hl7.fhir.instance.model.MedicationStatement tgt = new org.hl7.fhir.instance.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setPatient(convertReference(src.getSubject())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setInformationSource(convertReference(src.getInformationSource())); + for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); +// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonNotTaken()) + tgt.addReasonNotTaken(convertCodeableConcept(t)); +// tgt.setReasonForUse(convertType(src.getReasonForUse())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.setNote(t.getText()); + for (org.hl7.fhir.r4.model.Dosage t : src.getDosage()) + tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); +// tgt.setQuantity(convertType(src.getQuantity())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); +// tgt.setQuantity(convertType(src.getQuantity())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.r4.model.MessageHeader convertMessageHeader(org.hl7.fhir.instance.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MessageHeader tgt = new org.hl7.fhir.r4.model.MessageHeader(); + copyDomainResource(src, tgt); + tgt.setTimestamp(src.getTimestamp()); + tgt.setEvent(convertCoding(src.getEvent())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(convertReference(src.getEnterer())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setResponsible(convertReference(src.getResponsible())); + tgt.setReason(convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.instance.model.Reference t : src.getData()) + tgt.addFocus(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.MessageHeader convertMessageHeader(org.hl7.fhir.r4.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MessageHeader tgt = new org.hl7.fhir.instance.model.MessageHeader(); + copyDomainResource(src, tgt); + tgt.setTimestamp(src.getTimestamp()); + tgt.setEvent(convertCoding(src.getEvent())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(convertReference(src.getEnterer())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setResponsible(convertReference(src.getResponsible())); + tgt.setReason(convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.r4.model.Reference t : src.getFocus()) + tgt.addData(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + public org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + public org.hl7.fhir.r4.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.instance.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.NULL; + } + } + + public org.hl7.fhir.instance.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r4.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.NULL; + } + } + + public org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent(); copyElement(src, tgt); tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); return tgt; } - public org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException { + public org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; - org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent(); + org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent(); copyElement(src, tgt); tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); return tgt; } - public org.hl7.fhir.r4.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.instance.model.Appointment.ParticipantRequired src) throws FHIRException { + public org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.instance.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(convertReference(src.getReplacedBy())); + return tgt; + } + + public org.hl7.fhir.instance.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.NamingSystem tgt = new org.hl7.fhir.instance.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(convertReference(src.getReplacedBy())); + return tgt; + } + + public org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemType src) throws FHIRException { if (src == null) return null; switch (src) { - case REQUIRED: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL; + case CODESYSTEM: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL; } } - public org.hl7.fhir.instance.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r4.model.Appointment.ParticipantRequired src) throws FHIRException { + public org.hl7.fhir.instance.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException { if (src == null) return null; switch (src) { - case REQUIRED: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.NULL; + case CODESYSTEM: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.NULL; } } - private org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus src) { + public org.hl7.fhir.r4.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { if (src == null) return null; switch (src) { - case ACCEPTED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case INPROCESS: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case COMPLETED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case NEEDSACTION: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL; + case OID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL; } } - private org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus src) { + public org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { if (src == null) return null; switch (src) { - case ACCEPTED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NULL; + case OID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.NULL; } } - public org.hl7.fhir.r4.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.instance.model.Appointment.ParticipationStatus src) throws FHIRException { + public org.hl7.fhir.r4.model.Observation convertObservation(org.hl7.fhir.instance.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Observation tgt = new org.hl7.fhir.r4.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.instance.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); + tgt.setComment(src.getComments()); + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(convertReference(src.getSpecimen())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent t : src.getRelated()) + tgt.addRelated(convertObservationRelatedComponent(t)); + for (org.hl7.fhir.instance.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Observation convertObservation(org.hl7.fhir.r4.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Observation tgt = new org.hl7.fhir.instance.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.r4.model.CodeableConcept c : src.getCategory()) + tgt.setCategory(convertCodeableConcept(c)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.r4.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); + tgt.setComments(src.getComment()); + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(convertReference(src.getSpecimen())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent t : src.getRelated()) + tgt.addRelated(convertObservationRelatedComponent(t)); + for (org.hl7.fhir.r4.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.instance.model.Observation.ObservationStatus src) throws FHIRException { if (src == null) return null; switch (src) { - case ACCEPTED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL; + case REGISTERED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.r4.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.r4.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.r4.model.Observation.ObservationStatus.NULL; } } - public org.hl7.fhir.instance.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r4.model.Appointment.ParticipationStatus src) throws FHIRException { + public org.hl7.fhir.instance.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus src) throws FHIRException { if (src == null) return null; switch (src) { - case ACCEPTED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NULL; + case REGISTERED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.instance.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.instance.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.instance.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.instance.model.Observation.ObservationStatus.NULL; } } + public org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + tgt.setType(convertCodeableConcept(src.getMeaning())); + tgt.setAge(convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); +// for (org.hl7.fhir.r4.model.CodeableConcept c : src.getMeaning()) + tgt.setMeaning(convertCodeableConcept(src.getType())); + tgt.setAge(convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent(); + copyElement(src, tgt); + tgt.setType(convertObservationRelationshipType(src.getType())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent(); + copyElement(src, tgt); + tgt.setType(convertObservationRelationshipType(src.getType())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.r4.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.instance.model.Observation.ObservationRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HASMEMBER: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.HASMEMBER; + case DERIVEDFROM: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.DERIVEDFROM; + case SEQUELTO: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.SEQUELTO; + case REPLACES: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.REPLACES; + case QUALIFIEDBY: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.QUALIFIEDBY; + case INTERFEREDBY: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.INTERFEREDBY; + default: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.NULL; + } + } + + public org.hl7.fhir.instance.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.r4.model.Observation.ObservationRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HASMEMBER: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.HASMEMBER; + case DERIVEDFROM: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.DERIVEDFROM; + case SEQUELTO: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.SEQUELTO; + case REPLACES: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.REPLACES; + case QUALIFIEDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.QUALIFIEDBY; + case INTERFEREDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.INTERFEREDBY; + default: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.NULL; + } + } + + public org.hl7.fhir.r4.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.instance.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.instance.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + tgt.setComment(src.getNotes()); + tgt.setBase(convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.instance.model.CodeType t : src.getType()) + tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationDefinition tgt = new org.hl7.fhir.instance.model.OperationDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + tgt.setNotes(src.getComment()); + if (src.hasBase()) + tgt.setBase(convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (org.hl7.fhir.r4.model.CodeType t : src.getResource()) + tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.instance.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL; + } + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.NULL; + } + } + + public org.hl7.fhir.r4.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSearchType()) { + tgt.setType(src.getSearchType().toCode()); + tgt.setType("string"); + } else + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(convertReference(src.getProfile())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.instance.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationOutcome tgt = new org.hl7.fhir.instance.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.instance.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.r4.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + return tgt; + } + + public org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.instance.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL; + } + } + + public org.hl7.fhir.instance.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NULL; + } + } + + + public org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.instance.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.addType(convertCodeableConcept(src.getType())); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.instance.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.instance.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Organization tgt = new org.hl7.fhir.instance.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.r4.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.instance.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + public org.hl7.fhir.instance.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.instance.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + public org.hl7.fhir.r4.model.Patient convertPatient(org.hl7.fhir.instance.model.Patient src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -8835,6 +9552,62 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.instance.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Patient.ContactComponent tgt = new org.hl7.fhir.r4.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r4.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Patient.ContactComponent tgt = new org.hl7.fhir.instance.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.r4.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.instance.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Patient.AnimalComponent tgt = new org.hl7.fhir.r4.model.Patient.AnimalComponent(); + copyElement(src, tgt); + tgt.setSpecies(convertCodeableConcept(src.getSpecies())); + tgt.setBreed(convertCodeableConcept(src.getBreed())); + tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public org.hl7.fhir.instance.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r4.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Patient.AnimalComponent tgt = new org.hl7.fhir.instance.model.Patient.AnimalComponent(); + copyElement(src, tgt); + tgt.setSpecies(convertCodeableConcept(src.getSpecies())); + tgt.setBreed(convertCodeableConcept(src.getBreed())); + tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + public org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -8875,26 +9648,30 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.instance.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) + public org.hl7.fhir.r4.model.Patient.LinkType convertLinkType(org.hl7.fhir.instance.model.Patient.LinkType src) throws FHIRException { + if (src == null) return null; - org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; + switch (src) { + case REPLACE: return org.hl7.fhir.r4.model.Patient.LinkType.REPLACEDBY; + case REFER: return org.hl7.fhir.r4.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.r4.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.r4.model.Patient.LinkType.NULL; + } } - public org.hl7.fhir.instance.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) + public org.hl7.fhir.instance.model.Patient.LinkType convertLinkType(org.hl7.fhir.r4.model.Patient.LinkType src) throws FHIRException { + if (src == null) return null; - org.hl7.fhir.instance.model.Period tgt = new org.hl7.fhir.instance.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; + switch (src) { + case REPLACEDBY: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE; + case REPLACES: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE; + case REFER: return org.hl7.fhir.instance.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.instance.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.instance.model.Patient.LinkType.NULL; + } } + public org.hl7.fhir.r4.model.Person convertPerson(org.hl7.fhir.instance.model.Person src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -8961,16 +9738,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.instance.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; + public org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.NULL; + } } - public org.hl7.fhir.instance.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.instance.model.PositiveIntType tgt = new org.hl7.fhir.instance.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; + public org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.NULL; + } } public org.hl7.fhir.r4.model.Practitioner convertPractitioner(org.hl7.fhir.instance.model.Practitioner src) throws FHIRException { @@ -9027,6 +9816,40 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } +// public org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent(); +// copyElement(src, tgt); +// tgt.setOrganization(convertReference(src.getManagingOrganization())); +// tgt.setCode(convertCodeableConcept(src.getRole())); +// for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialty()) +// tgt.addSpecialty(convertCodeableConcept(t)); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.instance.model.Reference t : src.getLocation()) +// tgt.addLocation(convertReference(t)); +// for (org.hl7.fhir.instance.model.Reference t : src.getHealthcareService()) +// tgt.addHealthcareService(convertReference(t)); +// return tgt; +// } + +// public org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent(); +// copyElement(src, tgt); +// tgt.setManagingOrganization(convertReference(src.getOrganization())); +// tgt.setRole(convertCodeableConcept(src.getCode())); +// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) +// tgt.addSpecialty(convertCodeableConcept(t)); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) +// tgt.addLocation(convertReference(t)); +// for (org.hl7.fhir.r4.model.Reference t : src.getHealthcareService()) +// tgt.addHealthcareService(convertReference(t)); +// return tgt; +// } + public org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9053,32 +9876,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - private org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.instance.model.CodeableConcept priority) { - for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) { - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) - return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ROUTINE; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) - return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.URGENT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) - return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.STAT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) - return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ASAP; - } - return null; - } - - private org.hl7.fhir.instance.model.CodeableConcept convertPriorityCode(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority priority) { - org.hl7.fhir.instance.model.CodeableConcept cc = new org.hl7.fhir.instance.model.CodeableConcept(); - switch (priority) { - case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; - case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; - case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; - case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; - default: return null; - } - return cc; - } - public org.hl7.fhir.r4.model.Procedure convertProcedure(org.hl7.fhir.instance.model.Procedure src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9155,24 +9952,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) + public org.hl7.fhir.r4.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.instance.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) return null; - org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - tgt.setManipulated(convertReference(src.getManipulated())); - return tgt; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.INPROGRESS; + case ABORTED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ABORTED; + case COMPLETED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NULL; + } } - public org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) + public org.hl7.fhir.instance.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.r4.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) return null; - org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - tgt.setManipulated(convertReference(src.getManipulated())); - return tgt; + switch (src) { + case INPROGRESS: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.INPROGRESS; + case ABORTED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ABORTED; + case COMPLETED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.NULL; + } } public org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { @@ -9195,6 +9996,26 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent(); + copyElement(src, tgt); + tgt.setAction(convertCodeableConcept(src.getAction())); + tgt.setManipulated(convertReference(src.getManipulated())); + return tgt; + } + + public org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent(); + copyElement(src, tgt); + tgt.setAction(convertCodeableConcept(src.getAction())); + tgt.setManipulated(convertReference(src.getManipulated())); + return tgt; + } + public org.hl7.fhir.r4.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.instance.model.ProcedureRequest src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9246,30 +10067,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.URGENT; - case STAT: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.STAT; - case ASAP: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ASAP; - default: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.NULL; - } - } - - public org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.URGENT; - case STAT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.STAT; - case ASAP: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ASAP; - default: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.NULL; - } - } - public org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { if (src == null) return null; @@ -9306,48 +10103,73 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } - public org.hl7.fhir.r4.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.instance.model.Procedure.ProcedureStatus src) throws FHIRException { + public org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { if (src == null) return null; switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.INPROGRESS; - case ABORTED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ABORTED; - case COMPLETED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ENTEREDINERROR; - default: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NULL; + case ROUTINE: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + case STAT: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.STAT; + case ASAP: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + default: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.NULL; } } - public org.hl7.fhir.instance.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.r4.model.Procedure.ProcedureStatus src) throws FHIRException { + public org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { if (src == null) return null; switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.INPROGRESS; - case ABORTED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ABORTED; - case COMPLETED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.NULL; + case ROUTINE: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + case STAT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.STAT; + case ASAP: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + default: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.NULL; } } - public org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + + public org.hl7.fhir.r4.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.instance.model.ProcessRequest.ActionList src) throws FHIRException { if (src == null) return null; switch (src) { - case XMLATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL; + case CANCEL: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.CANCEL; + case POLL: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.POLL; + case REPROCESS: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.REPROCESS; + case STATUS: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.STATUS; + default: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.NULL; } } - public org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + public org.hl7.fhir.instance.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.r4.model.ProcessRequest.ActionList src) throws FHIRException { if (src == null) return null; switch (src) { - case XMLATTR: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.NULL; + case CANCEL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.CANCEL; + case POLL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.POLL; + case REPROCESS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.REPROCESS; + case STATUS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.STATUS; + default: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.NULL; } } + public org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent(); + copyElement(src, tgt); + tgt.setSequenceLinkId(src.getSequenceLinkId()); + return tgt; + } + + public org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent(); + copyElement(src, tgt); + tgt.setSequenceLinkId(src.getSequenceLinkId()); + return tgt; + } + public org.hl7.fhir.r4.model.Provenance convertProvenance(org.hl7.fhir.instance.model.Provenance src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9356,6 +10178,7 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen for (org.hl7.fhir.instance.model.Reference t : src.getTarget()) tgt.addTarget(convertReference(t)); tgt.setRecorded(src.getRecorded()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) tgt.setLocation(convertReference(src.getLocation())); for (org.hl7.fhir.instance.model.UriType t : src.getPolicy()) tgt.addPolicy(t.getValue()); @@ -9458,56 +10281,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } - public org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.instance.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Quantity tgt = new org.hl7.fhir.instance.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.instance.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL; - } - } - - public org.hl7.fhir.instance.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.NULL; - } - } - public org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.instance.model.Questionnaire src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9570,6 +10343,48 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen tgt.addTelecom(convertContactPoint(src)); return tgt; } + + private static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; + case PUBLISHED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; + default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; + } + } + + private static org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.instance.model.Questionnaire.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.instance.model.Coding t : src.getConcept()) + tgt.addCode(convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireQuestionType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setOptions(convertReference(src.getOptions())); + for (org.hl7.fhir.instance.model.Coding t : src.getOption()) + tgt.addOption().setValue(convertCoding(t)); + for (org.hl7.fhir.instance.model.Questionnaire.GroupComponent t : src.getGroup()) + tgt.addItem(convertQuestionnaireGroupComponent(t)); + return tgt; + } public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.instance.model.Questionnaire.GroupComponent src) throws FHIRException { if (src == null || src.isEmpty()) @@ -9609,76 +10424,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - if (t.hasAnswer()) - tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); - else - tgt.addGroup(convertQuestionnaireItemToGroup(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BOOLEAN: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.BOOLEAN; - case DECIMAL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DECIMAL; - case INTEGER: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.INTEGER; - case DATE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATE; - case DATETIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATETIME; - case TIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TIME; - case STRING: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.STRING; - case TEXT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TEXT; - case URL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.URL; - case CHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.CHOICE; - case OPENCHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.REFERENCE; - case QUANTITY: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.QUANTITY; - default: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.NULL; - } - } - - public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.instance.model.Questionnaire.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.instance.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireQuestionType(src.getType())); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - tgt.setOptions(convertReference(src.getOptions())); - for (org.hl7.fhir.instance.model.Coding t : src.getOption()) - tgt.addOption().setValue(convertCoding(t)); - for (org.hl7.fhir.instance.model.Questionnaire.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireGroupComponent(t)); - return tgt; - } - public org.hl7.fhir.instance.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9727,6 +10472,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen } } + public org.hl7.fhir.instance.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BOOLEAN: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.BOOLEAN; + case DECIMAL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DECIMAL; + case INTEGER: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.INTEGER; + case DATE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATE; + case DATETIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATETIME; + case TIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TIME; + case STRING: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.STRING; + case TEXT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TEXT; + case URL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.URL; + case CHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.CHOICE; + case OPENCHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.REFERENCE; + case QUANTITY: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.QUANTITY; + default: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.NULL; + } + } + public org.hl7.fhir.r4.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.instance.model.QuestionnaireResponse src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9766,6 +10533,29 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + + public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9781,6 +10571,46 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + if (t.hasAnswer()) + tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); + else + tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9803,148 +10633,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } - public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.instance.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.instance.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Range tgt = new org.hl7.fhir.instance.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.instance.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.instance.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Ratio tgt = new org.hl7.fhir.instance.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Reference tgt = new org.hl7.fhir.instance.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - -// public org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setOrganization(convertReference(src.getManagingOrganization())); -// tgt.setCode(convertCodeableConcept(src.getRole())); -// for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.instance.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.instance.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - -// public org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setManagingOrganization(convertReference(src.getOrganization())); -// tgt.setRole(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.r4.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.r4.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - - private org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority convertReferralPriorityCode(CodeableConcept priority) { - for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) { - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) - return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) - return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.URGENT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) - return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.STAT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) - return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ASAP; - } - return null; - } - public org.hl7.fhir.r4.model.ProcedureRequest convertReferralRequest(org.hl7.fhir.instance.model.ReferralRequest src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -9965,6 +10653,21 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + private org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority convertReferralPriorityCode(CodeableConcept priority) { + for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) { + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) + return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) + return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) + return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.STAT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) + return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + } + return null; + } + + public org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestStatus convertReferralStatus(org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus src) throws FHIRException { if (src == null) return null; @@ -10025,6 +10728,1998 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen return tgt; } + public org.hl7.fhir.r4.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.instance.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.RiskAssessment tgt = new org.hl7.fhir.r4.model.RiskAssessment(); + copyDomainResource(src, tgt); + tgt.setSubject(convertReference(src.getSubject())); +// tgt.setDate(src.getDate()); + tgt.setCondition(convertReference(src.getCondition())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setPerformer(convertReference(src.getPerformer())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.instance.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public org.hl7.fhir.instance.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r4.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.RiskAssessment tgt = new org.hl7.fhir.instance.model.RiskAssessment(); + copyDomainResource(src, tgt); + tgt.setSubject(convertReference(src.getSubject())); +// tgt.setDateElement(src.getOccurrenceDateTimeType()); + tgt.setCondition(convertReference(src.getCondition())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setPerformer(convertReference(src.getPerformer())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.r4.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setProbability(convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } + + public org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setProbability(convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } + + public org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.instance.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) + tgt.addServiceType(convertCodeableConcept(t)); + tgt.addActor(convertReference(src.getActor())); + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.instance.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Schedule tgt = new org.hl7.fhir.instance.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActorFirstRep())); + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.instance.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.instance.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SearchParameter tgt = new org.hl7.fhir.instance.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) + tgt.setBase(t.asStringValue()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + 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.r4.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + public org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.instance.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL; + } + } + + public org.hl7.fhir.instance.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NULL; + } + } + + public org.hl7.fhir.r4.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Slot convertSlot(org.hl7.fhir.instance.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Slot tgt = new org.hl7.fhir.r4.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.addServiceType(convertCodeableConcept(src.getType())); + tgt.setSchedule(convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.instance.model.Slot convertSlot(org.hl7.fhir.r4.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Slot tgt = new org.hl7.fhir.instance.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) + tgt.setType(convertCodeableConcept(t)); + tgt.setSchedule(convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.r4.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.instance.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.r4.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYTENTATIVE; + default: return org.hl7.fhir.r4.model.Slot.SlotStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r4.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.instance.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYTENTATIVE; + default: return org.hl7.fhir.instance.model.Slot.SlotStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.instance.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setTitle(src.getDisplay()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.instance.model.Coding t : src.getCode()) + tgt.addKeyword(convertCoding(t)); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.instance.model.StringType t : src.getContext()) + tgt.addContext(t.getValue()); + if (src.hasConstrainedType()) + tgt.setType(src.getConstrainedType()); + else if (src.getSnapshot().hasElement()) + tgt.setType(src.getSnapshot().getElement().get(0).getPath()); + else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) + tgt.setType(src.getDifferential().getElement().get(0).getPath()); + else + tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); + tgt.setBaseDefinition(src.getBase()); + tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElementFirstRep().getType().clear(); + if (tgt.hasDifferential()) + tgt.getDifferential().getElementFirstRep().getType().clear(); + if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { + tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType()); +// for (ElementDefinition ed : tgt.getSnapshot().getElement()) { +// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); +// } +// for (ElementDefinition ed : tgt.getDifferential().getElement()) { +// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); +// } + tgt.setType(tgt.getId()); + } + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition tgt = new org.hl7.fhir.instance.model.StructureDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setDisplay(src.getTitle()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) + tgt.addCode(convertCoding(t)); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.r4.model.StringType t : src.getContext()) + tgt.addContext(t.getValue()); + tgt.setConstrainedType(src.getType()); + tgt.setBase(src.getBaseDefinition()); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasBase()) { + if (tgt.hasDifferential()) + tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); + } + return tgt; + } + + private String tail(String base) { + return base.substring(base.lastIndexOf("/")+1); + } + + public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DATATYPE: + if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml")) + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + else + return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRIMITIVETYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.EXTENSION; + default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.EXTENSION; + default: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComments(src.getComment()); + return tgt; + } + + public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t))); + } + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Subscription convertSubscription(org.hl7.fhir.instance.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Subscription tgt = new org.hl7.fhir.r4.model.Subscription(); + copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.instance.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Subscription convertSubscription(org.hl7.fhir.r4.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Subscription tgt = new org.hl7.fhir.instance.model.Subscription(); + copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.r4.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.instance.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + tgt.addHeader(src.getHeader()); + return tgt; + } + + public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + if (src.hasHeader()) + tgt.setHeaderElement(convertString(src.getHeader().get(0))); + return tgt; + } + + public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public org.hl7.fhir.r4.model.Substance convertSubstance(org.hl7.fhir.instance.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Substance tgt = new org.hl7.fhir.r4.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Substance convertSubstance(org.hl7.fhir.r4.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Substance tgt = new org.hl7.fhir.instance.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + tgt.setQuantity(convertRatio(src.getQuantity())); + tgt.setSubstance(convertReference(src.getSubstance())); + return tgt; + } + + public org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + tgt.setQuantity(convertRatio(src.getQuantity())); +// tgt.setSubstance(convertReference(src.getSubstance())); + return tgt; + } + + public org.hl7.fhir.r4.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.instance.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SupplyDelivery tgt = new org.hl7.fhir.r4.model.SupplyDelivery(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); + tgt.setSupplier(convertReference(src.getSupplier())); +// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); +// tgt.setTime(src.getTime()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.instance.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SupplyDelivery tgt = new org.hl7.fhir.instance.model.SupplyDelivery(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); + tgt.setSupplier(convertReference(src.getSupplier())); +// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); +// tgt.setTime(src.getTime()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.instance.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.SupplyRequest tgt = new org.hl7.fhir.r4.model.SupplyRequest(); + copyDomainResource(src, tgt); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); +// tgt.setKind(convertCodeableConcept(src.getKind())); +// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem())); +// for (org.hl7.fhir.instance.model.Reference t : src.getSupplier()) +// tgt.addSupplier(convertReference(t)); +// tgt.setReason(convertType(src.getReason())); +// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); + return tgt; + } + + public org.hl7.fhir.instance.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r4.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SupplyRequest tgt = new org.hl7.fhir.instance.model.SupplyRequest(); +// copyDomainResource(src, tgt); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); +// tgt.setKind(convertCodeableConcept(src.getKind())); +// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference())); +// for (org.hl7.fhir.r4.model.Reference t : src.getSupplier()) +// tgt.addSupplier(convertReference(t)); +// tgt.setReason(convertType(src.getReason())); +// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); + return tgt; + } + + public org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case FAILED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + case CANCELLED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.REQUESTED; + case COMPLETED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.instance.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent t : src.getContact()) + tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript tgt = new org.hl7.fhir.instance.model.TestScript(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.r4.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public org.hl7.fhir.r4.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.instance.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + tgt.setCapabilities(convertReference(src.getConformance())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.r4.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + tgt.setConformance(convertReference(src.getCapabilities())); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.ContentType convertContentType(org.hl7.fhir.instance.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XML: return org.hl7.fhir.r4.model.TestScript.ContentType.XML; + case JSON: return org.hl7.fhir.r4.model.TestScript.ContentType.JSON; + default: return org.hl7.fhir.r4.model.TestScript.ContentType.NULL; + } + } + + public org.hl7.fhir.instance.model.TestScript.ContentType convertContentType(org.hl7.fhir.r4.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XML: return org.hl7.fhir.instance.model.TestScript.ContentType.XML; + case JSON: return org.hl7.fhir.instance.model.TestScript.ContentType.JSON; + default: return org.hl7.fhir.instance.model.TestScript.ContentType.NULL; + } + } + + public org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent(); + copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.instance.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL; + } + } + + public org.hl7.fhir.instance.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.NULL; + } + } + + public org.hl7.fhir.r4.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.instance.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL; + } + } + + public org.hl7.fhir.instance.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NULL; + } + } + + public org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NULL; + } + } + + + public org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setCaseSensitive(src.getCaseSensitive()); + + for (ConceptDefinitionComponent cc : src.getConcept()) + tgt.addConcept(convertCodeSystemConcept(src, cc)); + return tgt; + } + +public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); + tgt.setCode(src.getCode()); + tgt.setDefinition(src.getDefinition()); + tgt.setDisplay(src.getDisplay()); + + for (ConceptDefinitionComponent cc : src.getConcept()) + tgt.addConcept(convertCodeSystemConcept(cs, cc)); + for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) + tgt.addDesignation(convertCodeSystemDesignation(cc)); + return tgt; + } + +public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + tgt.setUse(convertCoding(src.getUse())); + tgt.setLanguage(src.getLanguage()); + tgt.setValue(src.getValue()); + + return tgt; + } + + public org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.instance.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setExtensible(src.getExtensible()); + if (src.hasCompose()) { + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + tgt.getCompose().setLockedDate(src.getLockedDate()); + } + if (src.hasCodeSystem() && advisor != null) { + org.hl7.fhir.r4.model.CodeSystem tgtcs = new org.hl7.fhir.r4.model.CodeSystem(); + copyDomainResource(src, tgtcs); + tgtcs.setUrl(src.getCodeSystem().getSystem()); + tgtcs.setIdentifier(convertIdentifier(src.getIdentifier())); + tgtcs.setVersion(src.getCodeSystem().getVersion()); + tgtcs.setName(src.getName()+" Code System"); + tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgtcs.setExperimental(src.getExperimental()); + tgtcs.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact()) + tgtcs.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgtcs.setDate(src.getDate()); + tgtcs.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgtcs.addJurisdiction(convertCodeableConcept(t)); + else + tgtcs.addUseContext(convertCodeableConceptToUsageContext(t)); + tgtcs.setPurpose(src.getRequirements()); + tgtcs.setCopyright(src.getCopyright()); + tgtcs.setContent(CodeSystemContentMode.COMPLETE); + tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); + for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) + processConcept(tgtcs.getConcept(), cs, tgtcs); + advisor.handleCodeSystem(tgtcs, tgt); + tgt.setUserData("r2-cs", tgtcs); + tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); + } + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + private void processConcept(List concepts, org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (cs.getAbstract()) + CodeSystemUtilities.setNotSelectable(tgtcs, ct); + for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + + for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) + processConcept(ct.getConcept(), csc, tgtcs); + } + + private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) + ct.setAbstract(true); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + + for (ConceptDefinitionComponent csc : cs.getConcept()) + processConcept(ct.getConcept(), csc, srcCS); + } + + public org.hl7.fhir.instance.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet tgt = new org.hl7.fhir.instance.model.ValueSet(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.r4.model.Identifier i : src.getIdentifier()) + tgt.setIdentifier(convertIdentifier(i)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setLockedDate(src.getCompose().getLockedDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setExtensible(src.getExtensible()); + org.hl7.fhir.r4.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); + if (srcCS == null) + srcCS = advisor.getCodeSystem(src); + if (srcCS != null) { + tgt.getCodeSystem().setSystem(srcCS.getUrl()); + tgt.getCodeSystem().setVersion(srcCS.getVersion()); + tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); + for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) + processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); + + } + tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + private static boolean isJurisdiction(CodeableConcept t) { + return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) + || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); + } + + + public org.hl7.fhir.r4.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.UriType t : src.getImport()) + tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getInclude()) + tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.r4.model.UriType ti : t.getValueSet()) + tgt.addImport(ti.getValue()); + if (noSystem == null || !t.getSystem().equals(noSystem)) + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.instance.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL; + } + } + + public org.hl7.fhir.instance.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NULL; + } + } + + public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.r4.model.ListResource convertList(org.hl7.fhir.instance.model.List_ src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ListResource tgt = new org.hl7.fhir.r4.model.ListResource(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setSource(convertReference(src.getSource())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + if (src.hasNote()) + tgt.addNote(new org.hl7.fhir.r4.model.Annotation().setText(src.getNote())); + for (org.hl7.fhir.instance.model.List_.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntry(t)); + return tgt; + } + + + public org.hl7.fhir.r4.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.instance.model.List_.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.r4.model.ListResource.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.r4.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.r4.model.ListResource.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.r4.model.ListResource.ListStatus.NULL; + } + } + + public org.hl7.fhir.r4.model.ListResource.ListMode convertListMode(org.hl7.fhir.instance.model.List_.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.r4.model.ListResource.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.r4.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.r4.model.ListResource.ListMode.CHANGES; + default: return org.hl7.fhir.r4.model.ListResource.ListMode.NULL; + } + } + + public org.hl7.fhir.r4.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.instance.model.List_.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.r4.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r4.model.ListResource.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + public org.hl7.fhir.instance.model.List_ convertList(org.hl7.fhir.r4.model.ListResource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.List_ tgt = new org.hl7.fhir.instance.model.List_(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setSource(convertReference(src.getSource())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) + tgt.setNote(t.getText()); + for (org.hl7.fhir.r4.model.ListResource.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntry(t)); + return tgt; + } + + + public org.hl7.fhir.instance.model.List_.ListStatus convertListStatus(org.hl7.fhir.r4.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.instance.model.List_.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.instance.model.List_.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.List_.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.List_.ListStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.List_.ListMode convertListMode(org.hl7.fhir.r4.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.instance.model.List_.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.instance.model.List_.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.instance.model.List_.ListMode.CHANGES; + default: return org.hl7.fhir.instance.model.List_.ListMode.NULL; + } + } + + public org.hl7.fhir.instance.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.r4.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.List_.ListEntryComponent tgt = new org.hl7.fhir.instance.model.List_.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + + public org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.instance.model.Resource src) throws FHIRException { if (src == null || src.isEmpty()) return null; @@ -10319,2653 +13014,4 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen throw new Error("Unknown resource "+src.fhirType()); } - public org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.r4.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.instance.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.instance.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r4.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.CLIENT; - case SERVER: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.SERVER; - default: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.NULL; - } - } - - public org.hl7.fhir.r4.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.instance.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.RiskAssessment tgt = new org.hl7.fhir.r4.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDate(src.getDate()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.instance.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.instance.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r4.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.RiskAssessment tgt = new org.hl7.fhir.instance.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDateElement(src.getOccurrenceDateTimeType()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.r4.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.instance.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.instance.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SampledData tgt = new org.hl7.fhir.instance.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.instance.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) - tgt.addServiceType(convertCodeableConcept(t)); - tgt.addActor(convertReference(src.getActor())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.instance.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Schedule tgt = new org.hl7.fhir.instance.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActorFirstRep())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.instance.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.instance.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NULL; - } - } - - public org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.instance.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCode(src.getCode()); - tgt.addBase(src.getBase()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.instance.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SearchParameter tgt = new org.hl7.fhir.instance.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r4.model.CodeType t : src.getBase()) - tgt.setBase(t.asStringValue()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - 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.r4.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.instance.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - try { - tgt.setMode(org.hl7.fhir.r4.model.Composition.SectionMode.fromCode(src.getMode())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.instance.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.instance.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Composition.SectionComponent tgt = new org.hl7.fhir.instance.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - tgt.setMode(src.getMode().toCode()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.r4.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(src.getResource()); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(src.getResource()); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.r4.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.instance.model.Contract.SignatoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r4.model.Contract.SignatoryComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setParty(convertReference(src.getParty())); - if (src.hasSignature()) - tgt.addSignature(new org.hl7.fhir.r4.model.Signature().setBlob(src.getSignature().getBytes())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r4.model.Contract.SignatoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.instance.model.Contract.SignatoryComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setParty(convertReference(src.getParty())); - for (org.hl7.fhir.r4.model.Signature t : src.getSignature()) - tgt.setSignature(Base64.encodeBase64String(t.getBlob())); - return tgt; - } - - public org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.instance.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - tgt.setContentType(src.getContentType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.instance.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Signature tgt = new org.hl7.fhir.instance.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - tgt.setContentType(src.getContentType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.r4.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.instance.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SimpleQuantity tgt = new org.hl7.fhir.instance.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.instance.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.instance.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.r4.model.Slot convertSlot(org.hl7.fhir.instance.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Slot tgt = new org.hl7.fhir.r4.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasType()) - tgt.addServiceType(convertCodeableConcept(src.getType())); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.instance.model.Slot convertSlot(org.hl7.fhir.r4.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Slot tgt = new org.hl7.fhir.instance.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) - tgt.setType(convertCodeableConcept(t)); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r4.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.instance.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.r4.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.r4.model.Slot.SlotStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r4.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.instance.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.instance.model.Slot.SlotStatus.NULL; - } - } - - public List convertSourceElementComponent(org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent src) throws FHIRException { - List res = new ArrayList(); - if (src == null || src.isEmpty()) - return res; - for (org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent t : src.getTarget()) { - org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.addTarget(convertTargetElementComponent(t)); - res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); - } - return res; - } - - public org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getSource()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t, g)); - return tgt; - } - - public org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.instance.model.StringType src) throws FHIRException { - org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException { - org.hl7.fhir.instance.model.StringType tgt = new org.hl7.fhir.instance.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.instance.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setTitle(src.getDisplay()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.instance.model.Coding t : src.getCode()) - tgt.addKeyword(convertCoding(t)); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.instance.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - if (src.hasConstrainedType()) - tgt.setType(src.getConstrainedType()); - else if (src.getSnapshot().hasElement()) - tgt.setType(src.getSnapshot().getElement().get(0).getPath()); - else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) - tgt.setType(src.getDifferential().getElement().get(0).getPath()); - else - tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); - tgt.setBaseDefinition(src.getBase()); - tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElementFirstRep().getType().clear(); - if (tgt.hasDifferential()) - tgt.getDifferential().getElementFirstRep().getType().clear(); - if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { - tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType()); -// for (ElementDefinition ed : tgt.getSnapshot().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } -// for (ElementDefinition ed : tgt.getDifferential().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } - tgt.setType(tgt.getId()); - } - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition tgt = new org.hl7.fhir.instance.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setDisplay(src.getTitle()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.r4.model.Coding t : src.getKeyword()) - tgt.addCode(convertCoding(t)); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.r4.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - tgt.setConstrainedType(src.getType()); - tgt.setBase(src.getBaseDefinition()); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasBase()) { - if (tgt.hasDifferential()) - tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); - } - return tgt; - } - - public org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths)); - } - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DATATYPE: - if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml")) - return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - else - return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL; - } - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case COMPLEXTYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.NULL; - } - } - - public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComment(src.getComments()); - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComments(src.getComment()); - return tgt; - } - - public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths)); - } - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Subscription convertSubscription(org.hl7.fhir.instance.model.Subscription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Subscription tgt = new org.hl7.fhir.r4.model.Subscription(); - copyDomainResource(src, tgt); - tgt.setCriteria(src.getCriteria()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setReason(src.getReason()); - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - tgt.setError(src.getError()); - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.instance.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Subscription convertSubscription(org.hl7.fhir.r4.model.Subscription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Subscription tgt = new org.hl7.fhir.instance.model.Subscription(); - copyDomainResource(src, tgt); - tgt.setCriteria(src.getCriteria()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setReason(src.getReason()); - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - tgt.setError(src.getError()); - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.r4.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - tgt.setType(convertSubscriptionChannelType(src.getType())); - tgt.setEndpoint(src.getEndpoint()); - tgt.setPayload(src.getPayload()); - tgt.addHeader(src.getHeader()); - return tgt; - } - - public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - tgt.setType(convertSubscriptionChannelType(src.getType())); - tgt.setEndpoint(src.getEndpoint()); - tgt.setPayload(src.getPayload()); - if (src.hasHeader()) - tgt.setHeaderElement(convertString(src.getHeader().get(0))); - return tgt; - } - - public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.NULL; - } - } - - public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.NULL; - } - } - - public org.hl7.fhir.r4.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.instance.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.Substance convertSubstance(org.hl7.fhir.instance.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Substance tgt = new org.hl7.fhir.r4.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Substance convertSubstance(org.hl7.fhir.r4.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Substance tgt = new org.hl7.fhir.instance.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); - tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); -// tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.r4.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.instance.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SupplyDelivery tgt = new org.hl7.fhir.r4.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.instance.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SupplyDelivery tgt = new org.hl7.fhir.instance.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.r4.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.instance.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.SupplyRequest tgt = new org.hl7.fhir.r4.model.SupplyRequest(); - copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem())); -// for (org.hl7.fhir.instance.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.instance.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r4.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SupplyRequest tgt = new org.hl7.fhir.instance.model.SupplyRequest(); -// copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference())); -// for (org.hl7.fhir.r4.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case FAILED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - case CANCELLED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.REQUESTED; - case COMPLETED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.NULL; - } - } - - public org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - tgt.setComment(src.getComments()); - for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getTarget()); - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - tgt.setComments(src.getComment()); - for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.r4.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.instance.model.Contract.TermActorComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getEntity())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.TermActorComponent tgt = new org.hl7.fhir.instance.model.Contract.TermActorComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getActor())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.instance.model.Contract.TermComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Contract.TermComponent tgt = new org.hl7.fhir.r4.model.Contract.TermComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSubType(convertCodeableConcept(src.getSubType())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.Contract.TermActorComponent t : src.getActor()) - tgt.addAgent(convertTermAgentComponent(t)); - for (org.hl7.fhir.instance.model.Contract.TermComponent t : src.getGroup()) - tgt.addGroup(convertTermComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r4.model.Contract.TermComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.TermComponent tgt = new org.hl7.fhir.instance.model.Contract.TermComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSubType(convertCodeableConcept(src.getSubType())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.r4.model.Contract.AgentComponent t : src.getAgent()) - tgt.addActor(convertTermAgentComponent(t)); - for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getGroup()) - tgt.addGroup(convertTermComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.instance.model.Contract.TermValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.TermValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.instance.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript tgt = new org.hl7.fhir.instance.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.r4.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.instance.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setCapabilities(convertReference(src.getConformance())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.r4.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setConformance(convertReference(src.getCapabilities())); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.instance.model.TimeType src) throws FHIRException { - org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException { - org.hl7.fhir.instance.model.TimeType tgt = new org.hl7.fhir.instance.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.instance.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.instance.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Timing tgt = new org.hl7.fhir.instance.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.instance.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); - tgt.addWhen(convertEventTiming(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.instance.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.instance.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); - for (Enumeration t : src.getWhen()) - tgt.setWhen(convertEventTiming(t.getValue())); - return tgt; - } - - public org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.instance.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.instance.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.instance.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.instance.model.BooleanType) - return convertBoolean((org.hl7.fhir.instance.model.BooleanType) src); - if (src instanceof org.hl7.fhir.instance.model.CodeType) - return convertCode((org.hl7.fhir.instance.model.CodeType) src); - if (src instanceof org.hl7.fhir.instance.model.DateType) - return convertDate((org.hl7.fhir.instance.model.DateType) src); - if (src instanceof org.hl7.fhir.instance.model.DateTimeType) - return convertDateTime((org.hl7.fhir.instance.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.instance.model.DecimalType) - return convertDecimal((org.hl7.fhir.instance.model.DecimalType) src); - if (src instanceof org.hl7.fhir.instance.model.IdType) - return convertId((org.hl7.fhir.instance.model.IdType) src); - if (src instanceof org.hl7.fhir.instance.model.InstantType) - return convertInstant((org.hl7.fhir.instance.model.InstantType) src); - if (src instanceof org.hl7.fhir.instance.model.IntegerType) - return convertInteger((org.hl7.fhir.instance.model.IntegerType) src); - if (src instanceof org.hl7.fhir.instance.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.instance.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.instance.model.OidType) - return convertOid((org.hl7.fhir.instance.model.OidType) src); - if (src instanceof org.hl7.fhir.instance.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.instance.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.instance.model.StringType) - return convertString((org.hl7.fhir.instance.model.StringType) src); - if (src instanceof org.hl7.fhir.instance.model.TimeType) - return convertTime((org.hl7.fhir.instance.model.TimeType) src); - if (src instanceof org.hl7.fhir.instance.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.instance.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.instance.model.UriType) - return convertUri((org.hl7.fhir.instance.model.UriType) src); - if (src instanceof org.hl7.fhir.instance.model.UuidType) - return convertUuid((org.hl7.fhir.instance.model.UuidType) src); - if (src instanceof org.hl7.fhir.instance.model.Extension) - return convertExtension((org.hl7.fhir.instance.model.Extension) src); - if (src instanceof org.hl7.fhir.instance.model.Narrative) - return convertNarrative((org.hl7.fhir.instance.model.Narrative) src); - if (src instanceof org.hl7.fhir.instance.model.Annotation) - return convertAnnotation((org.hl7.fhir.instance.model.Annotation) src); - if (src instanceof org.hl7.fhir.instance.model.Attachment) - return convertAttachment((org.hl7.fhir.instance.model.Attachment) src); - if (src instanceof org.hl7.fhir.instance.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.instance.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.instance.model.Coding) - return convertCoding((org.hl7.fhir.instance.model.Coding) src); - if (src instanceof org.hl7.fhir.instance.model.Identifier) - return convertIdentifier((org.hl7.fhir.instance.model.Identifier) src); - if (src instanceof org.hl7.fhir.instance.model.Period) - return convertPeriod((org.hl7.fhir.instance.model.Period) src); - if (src instanceof org.hl7.fhir.instance.model.Quantity) - return convertQuantity((org.hl7.fhir.instance.model.Quantity) src); - if (src instanceof org.hl7.fhir.instance.model.Range) - return convertRange((org.hl7.fhir.instance.model.Range) src); - if (src instanceof org.hl7.fhir.instance.model.Ratio) - return convertRatio((org.hl7.fhir.instance.model.Ratio) src); - if (src instanceof org.hl7.fhir.instance.model.Reference) - return convertReference((org.hl7.fhir.instance.model.Reference) src); - if (src instanceof org.hl7.fhir.instance.model.SampledData) - return convertSampledData((org.hl7.fhir.instance.model.SampledData) src); - if (src instanceof org.hl7.fhir.instance.model.Signature) - return convertSignature((org.hl7.fhir.instance.model.Signature) src); - if (src instanceof org.hl7.fhir.instance.model.Address) - return convertAddress((org.hl7.fhir.instance.model.Address) src); - if (src instanceof org.hl7.fhir.instance.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.instance.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.instance.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.instance.model.ElementDefinition) src, new ArrayList()); - if (src instanceof org.hl7.fhir.instance.model.HumanName) - return convertHumanName((org.hl7.fhir.instance.model.HumanName) src); - if (src instanceof org.hl7.fhir.instance.model.Meta) - return convertMeta((org.hl7.fhir.instance.model.Meta) src); - if (src instanceof org.hl7.fhir.instance.model.Timing) - return convertTiming((org.hl7.fhir.instance.model.Timing) src); - if (src instanceof org.hl7.fhir.instance.model.Age) - return convertAge((org.hl7.fhir.instance.model.Age) src); - if (src instanceof org.hl7.fhir.instance.model.Count) - return convertCount((org.hl7.fhir.instance.model.Count) src); - if (src instanceof org.hl7.fhir.instance.model.Distance) - return convertDistance((org.hl7.fhir.instance.model.Distance) src); - if (src instanceof org.hl7.fhir.instance.model.Duration) - return convertDuration((org.hl7.fhir.instance.model.Duration) src); - if (src instanceof org.hl7.fhir.instance.model.Money) - return convertMoney((org.hl7.fhir.instance.model.Money) src); - if (src instanceof org.hl7.fhir.instance.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.instance.model.SimpleQuantity) src); - throw new Error("Unknown type "+src.fhirType()); - } - - public org.hl7.fhir.instance.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.r4.model.BooleanType) - return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src); - if (src instanceof org.hl7.fhir.r4.model.CodeType) - return convertCode((org.hl7.fhir.r4.model.CodeType) src); - if (src instanceof org.hl7.fhir.r4.model.DateType) - return convertDate((org.hl7.fhir.r4.model.DateType) src); - if (src instanceof org.hl7.fhir.r4.model.DateTimeType) - return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.r4.model.DecimalType) - return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src); - if (src instanceof org.hl7.fhir.r4.model.IdType) - return convertId((org.hl7.fhir.r4.model.IdType) src); - if (src instanceof org.hl7.fhir.r4.model.InstantType) - return convertInstant((org.hl7.fhir.r4.model.InstantType) src); - if (src instanceof org.hl7.fhir.r4.model.IntegerType) - return convertInteger((org.hl7.fhir.r4.model.IntegerType) src); - if (src instanceof org.hl7.fhir.r4.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.r4.model.OidType) - return convertOid((org.hl7.fhir.r4.model.OidType) src); - if (src instanceof org.hl7.fhir.r4.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.r4.model.StringType) - return convertString((org.hl7.fhir.r4.model.StringType) src); - if (src instanceof org.hl7.fhir.r4.model.TimeType) - return convertTime((org.hl7.fhir.r4.model.TimeType) src); - if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.r4.model.UriType) - return convertUri((org.hl7.fhir.r4.model.UriType) src); - if (src instanceof org.hl7.fhir.r4.model.UuidType) - return convertUuid((org.hl7.fhir.r4.model.UuidType) src); - if (src instanceof org.hl7.fhir.r4.model.Extension) - return convertExtension((org.hl7.fhir.r4.model.Extension) src); - if (src instanceof org.hl7.fhir.r4.model.Narrative) - return convertNarrative((org.hl7.fhir.r4.model.Narrative) src); - if (src instanceof org.hl7.fhir.r4.model.Annotation) - return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src); - if (src instanceof org.hl7.fhir.r4.model.Attachment) - return convertAttachment((org.hl7.fhir.r4.model.Attachment) src); - if (src instanceof org.hl7.fhir.r4.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.r4.model.Coding) - return convertCoding((org.hl7.fhir.r4.model.Coding) src); - if (src instanceof org.hl7.fhir.r4.model.Identifier) - return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src); - if (src instanceof org.hl7.fhir.r4.model.Period) - return convertPeriod((org.hl7.fhir.r4.model.Period) src); - if (src instanceof org.hl7.fhir.r4.model.Quantity) - return convertQuantity((org.hl7.fhir.r4.model.Quantity) src); - if (src instanceof org.hl7.fhir.r4.model.Range) - return convertRange((org.hl7.fhir.r4.model.Range) src); - if (src instanceof org.hl7.fhir.r4.model.Ratio) - return convertRatio((org.hl7.fhir.r4.model.Ratio) src); - if (src instanceof org.hl7.fhir.r4.model.Reference) - return convertReference((org.hl7.fhir.r4.model.Reference) src); - if (src instanceof org.hl7.fhir.r4.model.SampledData) - return convertSampledData((org.hl7.fhir.r4.model.SampledData) src); - if (src instanceof org.hl7.fhir.r4.model.Signature) - return convertSignature((org.hl7.fhir.r4.model.Signature) src); - if (src instanceof org.hl7.fhir.r4.model.Address) - return convertAddress((org.hl7.fhir.r4.model.Address) src); - if (src instanceof org.hl7.fhir.r4.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.r4.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.r4.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.r4.model.HumanName) - return convertHumanName((org.hl7.fhir.r4.model.HumanName) src); - if (src instanceof org.hl7.fhir.r4.model.Meta) - return convertMeta((org.hl7.fhir.r4.model.Meta) src); - if (src instanceof org.hl7.fhir.r4.model.Timing) - return convertTiming((org.hl7.fhir.r4.model.Timing) src); - if (src instanceof org.hl7.fhir.r4.model.Age) - return convertAge((org.hl7.fhir.r4.model.Age) src); - if (src instanceof org.hl7.fhir.r4.model.Count) - return convertCount((org.hl7.fhir.r4.model.Count) src); - if (src instanceof org.hl7.fhir.r4.model.Distance) - return convertDistance((org.hl7.fhir.r4.model.Distance) src); - if (src instanceof org.hl7.fhir.r4.model.Duration) - return convertDuration((org.hl7.fhir.r4.model.Duration) src); - if (src instanceof org.hl7.fhir.r4.model.Money) - return convertMoney((org.hl7.fhir.r4.model.Money) src); - if (src instanceof org.hl7.fhir.r4.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.r4.model.SimpleQuantity) src); - throw new Error("Unknown type "+src.fhirType()); - } - - public org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.instance.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.instance.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.instance.model.Conformance.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.BOTH; - default: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.BOTH; - default: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NULL; - } - } - - public org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.instance.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.instance.model.UnsignedIntType tgt = new org.hl7.fhir.instance.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.instance.model.UriType src) throws FHIRException { - org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException { - org.hl7.fhir.instance.model.UriType tgt = new org.hl7.fhir.instance.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.CodeType convertUriToCode(org.hl7.fhir.r4.model.UriType src) throws FHIRException { - org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.instance.model.UuidType src) throws FHIRException { - org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException { - org.hl7.fhir.instance.model.UuidType tgt = new org.hl7.fhir.instance.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.instance.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setExtensible(src.getExtensible()); - if (src.hasCompose()) { - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - tgt.getCompose().setLockedDate(src.getLockedDate()); - } - if (src.hasCodeSystem() && advisor != null) { - org.hl7.fhir.r4.model.CodeSystem tgtcs = new org.hl7.fhir.r4.model.CodeSystem(); - copyDomainResource(src, tgtcs); - tgtcs.setUrl(src.getCodeSystem().getSystem()); - tgtcs.setIdentifier(convertIdentifier(src.getIdentifier())); - tgtcs.setVersion(src.getCodeSystem().getVersion()); - tgtcs.setName(src.getName()+" Code System"); - tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgtcs.setExperimental(src.getExperimental()); - tgtcs.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgtcs.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgtcs.setDate(src.getDate()); - tgtcs.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgtcs.addJurisdiction(convertCodeableConcept(t)); - else - tgtcs.addUseContext(convertCodeableConceptToUsageContext(t)); - tgtcs.setPurpose(src.getRequirements()); - tgtcs.setCopyright(src.getCopyright()); - tgtcs.setContent(CodeSystemContentMode.COMPLETE); - tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); - for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) - processConcept(tgtcs.getConcept(), cs, tgtcs); - advisor.handleCodeSystem(tgtcs, tgt); - tgt.setUserData("r2-cs", tgtcs); - tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); - } - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet tgt = new org.hl7.fhir.instance.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.r4.model.Identifier i : src.getIdentifier()) - tgt.setIdentifier(convertIdentifier(i)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setLockedDate(src.getCompose().getLockedDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setExtensible(src.getExtensible()); - org.hl7.fhir.r4.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); - if (srcCS == null) - srcCS = advisor.getCodeSystem(src); - if (srcCS != null) { - tgt.getCodeSystem().setSystem(srcCS.getUrl()); - tgt.getCodeSystem().setVersion(srcCS.getVersion()); - tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) - processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); - - } - tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.UriType t : src.getImport()) - tgt.addInclude().addValueSet(t.getValue()); - for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) { - for (org.hl7.fhir.r4.model.UriType ti : t.getValueSet()) - tgt.addImport(ti.getValue()); - if (noSystem == null || !t.getSystem().equals(noSystem)) - tgt.addInclude(convertConceptSetComponent(t)); - } - for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.instance.model.Contract.ValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.ValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.instance.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL; - } - } - - public org.hl7.fhir.instance.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NULL; - } - } - - public void copyBackboneElement(org.hl7.fhir.instance.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.instance.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public void copyDomainResource(org.hl7.fhir.instance.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException { - copyResource(src, tgt); - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.instance.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.instance.model.Extension t : src.getExtension()) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.instance.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - - public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.instance.model.DomainResource tgt) throws FHIRException { - copyResource(src, tgt); - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.r4.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.r4.model.Extension t : src.getExtension()) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - - public void copyElement(org.hl7.fhir.instance.model.Element src, org.hl7.fhir.r4.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.instance.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - public void copyElement(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - public void copyResource(org.hl7.fhir.instance.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - tgt.setMeta(convertMeta(src.getMeta())); - tgt.setImplicitRules(src.getImplicitRules()); - tgt.setLanguage(src.getLanguage()); - } - - public void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.instance.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { - for (ConceptMapGroupComponent grp : map.getGroup()) { - if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) - return grp; - } - ConceptMapGroupComponent grp = map.addGroup(); - grp.setSource(srcs); - grp.setTarget(tgts); - return grp; - } - - private org.hl7.fhir.r4.model.Reference getPerformer(List practitioner) { - for (ImmunizationPractitionerComponent p : practitioner) { - if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "AP")) - return p.getActor(); - } - return null; - } - - private org.hl7.fhir.r4.model.Reference getRequester(List practitioner) { - for (ImmunizationPractitionerComponent p : practitioner) { - if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "OP")) - return p.getActor(); - } - return null; - } - - private boolean hasConcept(org.hl7.fhir.r4.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.r4.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - private boolean hasConcept(org.hl7.fhir.instance.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.instance.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - private void processConcept(List concepts, org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { - org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (cs.getAbstract()) - CodeSystemUtilities.setNotSelectable(tgtcs, ct); - for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); - } - - for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, tgtcs); - } - - private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) - ct.setAbstract(true); - for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); - } - - for (ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, srcCS); - } - - private String tail(String base) { - return base.substring(base.lastIndexOf("/")+1); - } - - private static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL; - } - } - - private static org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - private static boolean isJurisdiction(CodeableConcept t) { - return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) - || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem())); - } - - private class SourceElementComponentWrapper { - private String source; - private String target; - private org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp; - public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { - super(); - this.source = source; - this.target = target; - this.comp = comp; - } - - } - } diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java index 1e0955c7aac..6a1e32f1b12 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java @@ -1346,7 +1346,7 @@ public class VersionConvertor_14_40 { org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent(); copyElement(src, tgt); for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), true)); if (src.hasDescription()) tgt.setDescription(src.getDescription()); if (src.hasOrdered()) diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java deleted file mode 100644 index 67c5bd5fd51..00000000000 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.hl7.fhir.utilities; - -/* - * #%L - * HAPI FHIR - Converter - * %% - * Copyright (C) 2014 - 2017 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% - */ - - -public class OIDUtils { - - /* - 2.16.840.1.113883.3.72.5.2 - NIST owns this - 2.16.840.1.113883.4.6 - National Provider Identifier - 2.16.840.1.113883.6.21 - UB92 - 2.16.840.1.113883.6.69 - NDC - */ - - public static String getUriForOid(String r) { - if (r.equals("2.16.840.1.113883.6.96")) - return "http://snomed.info/sct"; - if (r.equals("2.16.840.1.113883.6.1")) - return "http://loinc.org"; - if (r.equals("2.16.840.1.113883.6.8")) - return "http://unitsofmeasure.org"; - if (r.equals("2.16.840.1.113883.6.3")) - return "http://hl7.org/fhir/sid/icd-10"; - if (r.equals("2.16.840.1.113883.6.42")) - return "http://hl7.org/fhir/sid/icd-9"; - if (r.equals("2.16.840.1.113883.6.104")) - return "http://hl7.org/fhir/sid/icd-9"; - if (r.equals("2.16.840.1.113883.6.103")) - return "http://hl7.org/fhir/sid/icd-9"; //todo: confirm this - if (r.equals("2.16.840.1.113883.6.73")) - return "http://hl7.org/fhir/sid/atc"; - if (r.equals("2.16.840.1.113883.3.26.1.1")) - return "http://ncimeta.nci.nih.gov"; - if (r.equals("2.16.840.1.113883.3.26.1.1.1")) - return "http://ncimeta.nci.nih.gov"; - if (r.equals("2.16.840.1.113883.6.88")) - return "http://www.nlm.nih.gov/research/umls/rxnorm"; // todo: confirm this - - if (r.equals("2.16.840.1.113883.5.1008")) - return "http://hl7.org/fhir/v3/NullFlavor"; - if (r.equals("2.16.840.1.113883.5.111")) - return "http://hl7.org/fhir/v3/RoleCode"; - if (r.equals("2.16.840.1.113883.5.4")) - return "http://hl7.org/fhir/v3/ActCode"; - if (r.equals("2.16.840.1.113883.5.8")) - return "http://hl7.org/fhir/v3/ActReason"; - if (r.equals("2.16.840.1.113883.5.83")) - return "http://hl7.org/fhir/v3/ObservationInterpretation"; - if (r.equals("2.16.840.1.113883.6.238")) - return "http://hl7.org/fhir/v3/Race"; - - if (r.equals("2.16.840.1.113883.6.59")) - return "http://hl7.org/fhir/sid/cvx"; - if (r.equals("2.16.840.1.113883.12.292")) - return "http://hl7.org/fhir/sid/cvx"; - - if (r.equals("2.16.840.1.113883.6.12")) - return "http://www.ama-assn.org/go/cpt"; - - if (r.startsWith("2.16.840.1.113883.12.")) - return "http://hl7.org/fhir/sid/v2-"+r.substring(21); - return null; - } - -} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/ucum/UcumService.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/ucum/UcumService.java deleted file mode 100644 index dc39030e5b6..00000000000 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/ucum/UcumService.java +++ /dev/null @@ -1,193 +0,0 @@ -package org.hl7.fhir.utilities.ucum; - -/* - * #%L - * HAPI FHIR - Converter - * %% - * Copyright (C) 2014 - 2017 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% - */ - -/******************************************************************************* - * Crown Copyright (c) 2006+, Copyright (c) 2006 - 2014 Kestral Computing & Health Intersections. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Kestral Computing P/L - initial implementation - * Health Intersections - ongoing maintenance - *******************************************************************************/ - -import java.util.Date; -import java.util.List; -import java.util.Set; - -import org.hl7.fhir.exceptions.UcumException; - - -/** - * General Ucum Service - * - * UCUM functionality that is useful for applications that make use of UCUM codes - * - * This is a tightly bound interface - consumers use the internal model classes - * - * @author Grahame Grieve - * - */ -public interface UcumService { - - public class UcumVersionDetails { - private Date releaseDate; - private String version; - /** - * @param releaseDate - * @param version - */ - public UcumVersionDetails(Date releaseDate, String version) { - super(); - this.releaseDate = releaseDate; - this.version = version; - } - /** - * @return the releaseDate - */ - public Date getReleaseDate() { - return releaseDate; - } - /** - * @return the version - */ - public String getVersion() { - return version; - } - - } - - /** - * return Ucum Identification details for the version in use - */ - public abstract UcumVersionDetails ucumIdentification(); - - - /** - * Check UCUM. Note that this stands as a test of the service - * more than UCUM itself (for version 1.7, there are no known - * semantic errors in UCUM). But you should always run this test at least - * once with the version of UCUM you are using to ensure that - * the service implementation correctly understands the UCUM data - * to which it is bound - * - * @return a list of internal errors in the UCUM spec. - * - */ - public abstract List validateUCUM(); - - - /** - * return a list of the defined types of units in this UCUM version - * - * @return - */ - public abstract Set getProperties(); - - /** - * validate whether a unit code are valid UCUM units - * - * @param units - the unit code to check - * @return nil if valid, or an error message describing the problem - */ - public abstract String validate(String unit); - - /** - * given a unit, return a formal description of what the units stand for using - * full names - * @param units the unit code - * @return formal description - * @throws UcumException - * @throws OHFException - */ - public String analyse(String unit) throws UcumException ; - - /** - * validate whether a units are valid UCUM units and additionally require that the - * units from a particular property - * - * @param units - the unit code to check - * @return nil if valid, or an error message describing the problem - */ - public abstract String validateInProperty(String unit, String property); - - /** - * validate whether a units are valid UCUM units and additionally require that the - * units match a particular base canonical unit - * - * @param units - the unit code to check - * @return nil if valid, or an error message describing the problem - */ - public abstract String validateCanonicalUnits(String unit, String canonical); - - /** - * given a set of units, return their canonical form - * @param unit - * @return the canonical form - * @throws UcumException - * @throws OHFException - */ - public abstract String getCanonicalUnits(String unit) throws UcumException ; - - /** - * given two pairs of units, return true if they sahre the same canonical base - * - * @param units1 - * @param units2 - * @return - * @throws UcumException - * @ - */ - public abstract boolean isComparable(String units1, String units2) throws UcumException ; - - - /** - * given a value and source unit, return the value in the given dest unit - * an exception is thrown if the conversion is not possible - * - * @param value - * @param sourceUnit - * @param destUnit - * @return the value if a conversion is possible - * @throws UcumException - * @throws OHFException - */ - public abstract Decimal convert(Decimal value, String sourceUnit, String destUnit) throws UcumException ; - - - - /** - * given a set of UCUM units, return a likely preferred human dense form - * - * SI units - as is. - * Other units - improved by manual fixes, or the removal of [] - * - * @param code - * @return the preferred human display form - */ - public abstract String getCommonDisplay(String code); - - - -} diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index 4fae00dd908..4069846907f 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -1,8 +1,13 @@ - + 4.0.0 - + ca.uhn.hapi.fhir hapi-deployable-pom @@ -139,7 +144,7 @@ jetty-util test - + net.sf.json-lib json-lib @@ -225,14 +230,14 @@ spring-web - - - javax.interceptor - javax.interceptor-api - provided - + + javax.interceptor + javax.interceptor-api + provided + @@ -253,6 +258,13 @@ + + org.basepom.maven + duplicate-finder-maven-plugin + + true + + org.jacoco jacoco-maven-plugin @@ -285,19 +297,17 @@ - - post-integration-test - install - - report - - - ${project.build.directory}/jacoco.exec - ${project.reporting.outputDirectory}/jacoco-report - - - - + + post-integration-test + install + + report + + + ${project.build.directory}/jacoco.exec + ${project.reporting.outputDirectory}/jacoco-report + + diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml index 3f2ac2eacae..02db004dd62 100644 --- a/hapi-fhir-jaxrsserver-base/pom.xml +++ b/hapi-fhir-jaxrsserver-base/pom.xml @@ -74,6 +74,11 @@ + + org.codehaus.woodstox + woodstox-core-asl + test + com.google.guava guava diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactory.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactory.java index e72726af6e0..23b16a2db4c 100644 --- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactory.java +++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactory.java @@ -34,13 +34,15 @@ import ca.uhn.fhir.rest.client.impl.RestfulClientFactory; /** * A Restful Client Factory, based on Jax Rs - * + * Default Jax-Rs client is NOT thread safe in static context, you should create a new factory every time or + * use a specific Jax-Rs client implementation which managed connection pool. * @author Peter Van Houte | peter.vanhoute@agfa.com | Agfa Healthcare */ public class JaxRsRestfulClientFactory extends RestfulClientFactory { private Client myNativeClient; - + private List> registeredComponents; + /** * Constructor. Note that you must set the {@link FhirContext} manually using {@link #setFhirContext(FhirContext)} if this constructor is used! */ @@ -64,6 +66,12 @@ public class JaxRsRestfulClientFactory extends RestfulClientFactory { myNativeClient = builder.build(); } + if (registeredComponents != null && !registeredComponents.isEmpty()) { + for (Class c : registeredComponents) { + myNativeClient = myNativeClient.register(c); + } + } + return myNativeClient; } @@ -73,29 +81,46 @@ public class JaxRsRestfulClientFactory extends RestfulClientFactory { return new JaxRsHttpClient(client, url, theIfNoneExistParams, theIfNoneExistString, theRequestType, theHeaders); } + /*** + * Not supported with default Jax-Rs client implementation + * @param theHost + * The host (or null to disable proxying, as is the default) + * @param thePort + */ @Override public void setProxy(String theHost, Integer thePort) { throw new UnsupportedOperationException("Proxies are not supported yet in JAX-RS client"); } - - /** - * Only accept clients of type javax.ws.rs.client.Client - * - * @param theHttpClient - */ + + /** + * Only accept clients of type javax.ws.rs.client.Client + * Can be used to set a specific Client implementation + * @param theHttpClient + */ @Override public synchronized void setHttpClient(Object theHttpClient) { this.myNativeClient = (Client) theHttpClient; } + /** + * Register a list of Jax-Rs component (provider, filter...) + * @param components list of Jax-Rs components to register + */ + public void register(List> components) { + registeredComponents = components; + } + + @Override protected JaxRsHttpClient getHttpClient(String theServerBase) { return new JaxRsHttpClient(getNativeClientClient(), new StringBuilder(theServerBase), null, null, null, null); } - - @Override - protected void resetHttpClient() { - this.myNativeClient = null; - } + + @Override + protected void resetHttpClient() { + if (myNativeClient != null) + myNativeClient.close(); // close client to avoid memory leak + myNativeClient = null; + } } diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java new file mode 100644 index 00000000000..944e0be9fe2 --- /dev/null +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java @@ -0,0 +1,53 @@ +package ca.uhn.fhir.jaxrs.client; + +import ca.uhn.fhir.context.FhirContext; +import org.junit.Before; +import org.junit.Test; + +import javax.ws.rs.client.Client; +import java.util.ArrayList; +import java.util.Arrays; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +/** + * Created by Sebastien Riviere on 31/07/2017. + */ +public class JaxRsRestfulClientFactoryTest { + + private final FhirContext context = FhirContext.forDstu2(); + private JaxRsRestfulClientFactory factory; + + @Before + public void setUp() { + factory = new JaxRsRestfulClientFactory(context); + } + + @Test + public void emptyConstructorTest() { + assertNotNull(new JaxRsRestfulClientFactory()); + } + + @Test + public void getDefaultNativeClientTest() { + assertNotNull(factory.getNativeClientClient()); + } + + @Test + public void getNativeClientEmptyRegisteredComponentListTest() { + factory.register(new ArrayList>()); + final Client result = factory.getNativeClientClient(); + assertNotNull(result); + assertTrue(result.getConfiguration().getClasses().isEmpty()); + } + + @Test + public void getNativeClientRegisteredComponentListTest() { + factory.register(Arrays.asList(MyFilter.class, String.class)); + final Client result = factory.getNativeClientClient(); + assertNotNull(result); + assertEquals(1, result.getConfiguration().getClasses().size()); + } +} \ No newline at end of file diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/MyFilter.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/MyFilter.java new file mode 100644 index 00000000000..99bbe79ec96 --- /dev/null +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/MyFilter.java @@ -0,0 +1,18 @@ +package ca.uhn.fhir.jaxrs.client; + +import javax.ws.rs.client.ClientRequestContext; +import javax.ws.rs.client.ClientResponseContext; +import javax.ws.rs.client.ClientResponseFilter; +import javax.ws.rs.ext.Provider; +import java.io.IOException; + +/** + * Created by Sebastien Riviere on 31/07/2017. + */ +@Provider +public class MyFilter implements ClientResponseFilter { + @Override + public void filter(final ClientRequestContext requestContext, final ClientResponseContext responseContext) throws IOException { + + } +} diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 4a434b2c881..1a68b4c4b84 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -1,4 +1,4 @@ - + 4.0.0 @@ -32,6 +32,12 @@ 3.5 --> + + + org.codehaus.woodstox + woodstox-core-asl + + net.sf.saxon Saxon-HE @@ -105,10 +111,12 @@ ${project.version} + ch.qos.logback @@ -163,7 +171,7 @@ thymeleaf-spring4 - + org.jscience jscience @@ -233,10 +241,12 @@ + org.springframework spring-core @@ -358,6 +368,7 @@ javax.mail javax.mail-api + provided com.sun.mail diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java index 03a99a2bb18..37696c29c54 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.graphql.JpaStorageServices; import ca.uhn.fhir.jpa.search.*; import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc; import ca.uhn.fhir.jpa.sp.SearchParamPresenceSvcImpl; +import ca.uhn.fhir.jpa.subscription.email.SubscriptionEmailInterceptor; import ca.uhn.fhir.jpa.subscription.resthook.SubscriptionRestHookInterceptor; import ca.uhn.fhir.jpa.subscription.websocket.SubscriptionWebsocketInterceptor; import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices; @@ -93,15 +94,6 @@ public class BaseConfig implements SchedulingConfigurer { return new StaleSearchDeletingSvcImpl(); } - // @PostConstruct - // public void wireResourceDaos() { - // Map daoBeans = myAppCtx.getBeansOfType(IDao.class); - // List bean = myAppCtx.getBean("myResourceProvidersDstu2", List.class); - // for (IDao next : daoBeans.values()) { - // next.setResourceDaos(bean); - // } - // } - @Bean @Lazy public SubscriptionRestHookInterceptor subscriptionRestHookInterceptor() { @@ -114,15 +106,23 @@ public class BaseConfig implements SchedulingConfigurer { return new SubscriptionWebsocketInterceptor(); } + /** + * Note: If you're going to use this, you need to provide a bean + * of type {@link ca.uhn.fhir.jpa.subscription.email.IEmailSender} + * in your own Spring config + */ + @Bean + @Lazy + public SubscriptionEmailInterceptor subscriptionEmailInterceptor() { + return new SubscriptionEmailInterceptor(); + } + @Bean public TaskScheduler taskScheduler() { ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler(); retVal.setConcurrentExecutor(scheduledExecutorService().getObject()); retVal.setScheduledExecutor(scheduledExecutorService().getObject()); return retVal; -// ThreadPoolTaskScheduler retVal = new ThreadPoolTaskScheduler(); -// retVal.setPoolSize(5); -// return retVal; } /** diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java index 0a89964524a..4f88d75eb5b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java @@ -29,7 +29,6 @@ import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider; import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc; import ca.uhn.fhir.jpa.term.IHapiTerminologySvc; import ca.uhn.fhir.jpa.util.DeleteConflict; -import ca.uhn.fhir.jpa.util.StopWatch; import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; @@ -51,10 +50,7 @@ import ca.uhn.fhir.rest.server.exceptions.*; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; -import ca.uhn.fhir.util.CoverageIgnore; -import ca.uhn.fhir.util.FhirTerser; -import ca.uhn.fhir.util.OperationOutcomeUtil; -import ca.uhn.fhir.util.UrlUtil; +import ca.uhn.fhir.util.*; import com.google.common.base.Charsets; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Sets; @@ -1011,14 +1007,6 @@ public abstract class BaseHapiFhirDao implements IDao { changed = true; } - if (theResource instanceof IResource) { - String title = ResourceMetadataKeyEnum.TITLE.get((IResource) theResource); - if (title != null && title.length() > BaseHasResource.MAX_TITLE_LENGTH) { - title = title.substring(0, BaseHasResource.MAX_TITLE_LENGTH); - } - theEntity.setTitle(title); - } - return changed; } @@ -1052,10 +1040,6 @@ public abstract class BaseHapiFhirDao implements IDao { ResourceMetadataKeyEnum.UPDATED.put(res, theEntity.getUpdated()); IDao.RESOURCE_PID.put(res, theEntity.getId()); - if (theEntity.getTitle() != null) { - ResourceMetadataKeyEnum.TITLE.put(res, theEntity.getTitle()); - } - Collection tags = theEntity.getTags(); if (theEntity.isHasTags()) { TagList tagList = new TagList(); @@ -2056,7 +2040,7 @@ public abstract class BaseHapiFhirDao implements IDao { StringBuilder b = new StringBuilder(); if (theResource instanceof IResource) { IResource resource = (IResource) theResource; - List xmlEvents = resource.getText().getDiv().getValue(); + List xmlEvents = XmlUtil.parse(resource.getText().getDiv().getValue()); if (xmlEvents != null) { for (XMLEvent next : xmlEvents) { if (next.isCharacters()) { @@ -2069,8 +2053,7 @@ public abstract class BaseHapiFhirDao implements IDao { IDomainResource resource = (IDomainResource) theResource; try { String divAsString = resource.getText().getDivAsString(); - XhtmlDt xhtml = new XhtmlDt(divAsString); - List xmlEvents = xhtml.getValue(); + List xmlEvents = XmlUtil.parse(divAsString); if (xmlEvents != null) { for (XMLEvent next : xmlEvents) { if (next.isCharacters()) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java index a234e456941..1e238dce835 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java @@ -30,16 +30,14 @@ import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.dao.data.ISearchResultDao; import ca.uhn.fhir.jpa.entity.*; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; +import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider; import ca.uhn.fhir.jpa.util.DeleteConflict; import ca.uhn.fhir.jpa.util.StopWatch; import ca.uhn.fhir.jpa.util.jsonpatch.JsonPatchUtils; import ca.uhn.fhir.jpa.util.xmlpatch.XmlPatchUtils; import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.rest.api.PatchTypeEnum; -import ca.uhn.fhir.rest.api.QualifiedParamList; -import ca.uhn.fhir.rest.api.RestOperationTypeEnum; -import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum; +import ca.uhn.fhir.rest.api.*; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.param.ParameterUtil; @@ -64,6 +62,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.PostConstruct; import javax.persistence.NoResultException; import javax.persistence.TypedQuery; +import javax.servlet.http.HttpServletResponse; import java.util.*; import static org.apache.commons.lang3.StringUtils.isNotBlank; @@ -897,6 +896,12 @@ public abstract class BaseHapiFhirResourceDao extends B @Transactional(propagation = Propagation.SUPPORTS) @Override public IBundleProvider search(final SearchParameterMap theParams, RequestDetails theRequestDetails) { + return search(theParams, theRequestDetails, null); + } + + @Transactional(propagation = Propagation.SUPPORTS) + @Override + public IBundleProvider search(final SearchParameterMap theParams, RequestDetails theRequestDetails, HttpServletResponse theServletResponse) { if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.DISABLED) { for (List> nextAnds : theParams.values()) { @@ -928,7 +933,24 @@ public abstract class BaseHapiFhirResourceDao extends B } } - return mySearchCoordinatorSvc.registerSearch(this, theParams, getResourceName()); + CacheControlDirective cacheControlDirective = new CacheControlDirective(); + if (theRequestDetails != null) { + cacheControlDirective.parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL)); + } + + IBundleProvider retVal = mySearchCoordinatorSvc.registerSearch(this, theParams, getResourceName(), cacheControlDirective); + + if (retVal instanceof PersistedJpaBundleProvider) { + PersistedJpaBundleProvider provider = (PersistedJpaBundleProvider) retVal; + if (provider.isCacheHit()) { + if (theServletResponse != null && theRequestDetails != null) { + String value = "HIT from " + theRequestDetails.getFhirServerBase(); + theServletResponse.addHeader(Constants.HEADER_X_CACHE, value); + } + } + } + + return retVal; } @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java index 1e972721644..e981581192b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java @@ -107,6 +107,8 @@ public class DaoConfig { private Set myTreatBaseUrlsAsLocal = new HashSet(); private Set myTreatReferencesAsLogical = new HashSet(DEFAULT_LOGICAL_BASE_URLS); private boolean myAutoCreatePlaceholderReferenceTargets; + private Integer myCacheControlNoStoreMaxResultsUpperLimit = 1000; + private Integer myCountSearchResultsUpTo = null; /** * Constructor @@ -131,6 +133,76 @@ public class DaoConfig { myTreatReferencesAsLogical.add(theTreatReferencesAsLogical); } + /** + * Specifies the highest number that a client is permitted to use in a + * Cache-Control: nostore, max-results=NNN + * directive. If the client tries to exceed this limit, the + * request will be denied. Defaults to 1000. + */ + public Integer getCacheControlNoStoreMaxResultsUpperLimit() { + return myCacheControlNoStoreMaxResultsUpperLimit; + } + + /** + * Specifies the highest number that a client is permitted to use in a + * Cache-Control: nostore, max-results=NNN + * directive. If the client tries to exceed this limit, the + * request will be denied. Defaults to 1000. + */ + public void setCacheControlNoStoreMaxResultsUpperLimit(Integer theCacheControlNoStoreMaxResults) { + myCacheControlNoStoreMaxResultsUpperLimit = theCacheControlNoStoreMaxResults; + } + + /** + * When searching, if set to a non-null value (default is null) the + * search coordinator will attempt to find at least this many results + * before returning a response to the client. This parameter mainly affects + * whether a "total count" is included in the response bundle for searches that + * return large amounts of data. + *

+ * For a search that returns 10000 results, if this value is set to + * 10000 the search coordinator will find all 10000 results + * prior to returning, so the initial response bundle will have the + * total set to 10000. If this value is null (or less than 10000) + * the response bundle will likely return slightly faster, but will + * not include the total. Subsequent page requests will likely + * include the total however, if they are performed after the + * search coordinator has found all results. + *

+ *

+ * Set this value to 0 to always load all + * results before returning. + *

+ */ + public Integer getCountSearchResultsUpTo() { + return myCountSearchResultsUpTo; + } + + /** + * When searching, if set to a non-null value (default is null) the + * search coordinator will attempt to find at least this many results + * before returning a response to the client. This parameter mainly affects + * whether a "total count" is included in the response bundle for searches that + * return large amounts of data. + *

+ * For a search that returns 10000 results, if this value is set to + * 10000 the search coordinator will find all 10000 results + * prior to returning, so the initial response bundle will have the + * total set to 10000. If this value is null (or less than 10000) + * the response bundle will likely return slightly faster, but will + * not include the total. Subsequent page requests will likely + * include the total however, if they are performed after the + * search coordinator has found all results. + *

+ *

+ * Set this value to 0 to always load all + * results before returning. + *

+ */ + public void setCountSearchResultsUpTo(Integer theCountSearchResultsUpTo) { + myCountSearchResultsUpTo = theCountSearchResultsUpTo; + } + /** * When a code system is added that contains more than this number of codes, * the code system will be indexed later in an incremental process in order to @@ -434,6 +506,11 @@ public class DaoConfig { * This approach can improve performance, especially under heavy load, but can also mean that * searches may potentially return slightly out-of-date results. *

+ *

+ * Note that if this is set to a non-null value, clients may override this setting by using + * the Cache-Control header. If this is set to null, the Cache-Control + * header will be ignored. + *

*/ public Long getReuseCachedSearchResultsForMillis() { return myReuseCachedSearchResultsForMillis; @@ -449,6 +526,11 @@ public class DaoConfig { * This approach can improve performance, especially under heavy load, but can also mean that * searches may potentially return slightly out-of-date results. *

+ *

+ * Note that if this is set to a non-null value, clients may override this setting by using + * the Cache-Control header. If this is set to null, the Cache-Control + * header will be ignored. + *

*/ public void setReuseCachedSearchResultsForMillis(Long theReuseCachedSearchResultsForMillis) { myReuseCachedSearchResultsForMillis = theReuseCachedSearchResultsForMillis; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java index 04932c11d79..4def0078564 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java @@ -65,7 +65,7 @@ public class FhirResourceDaoPatientDstu2 extends FhirResourceDaoDstu2im paramMap.setLoadSynchronous(true); } - return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName()); + return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName(), new CacheControlDirective().parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL))); } @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java index 79fa7c4d33a..9e80aa6c8b5 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java @@ -33,6 +33,10 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.servlet.http.HttpServletResponse; public interface IFhirResourceDao extends IDao { @@ -179,6 +183,9 @@ public interface IFhirResourceDao extends IDao { IBundleProvider search(SearchParameterMap theParams, RequestDetails theRequestDetails); + @Transactional(propagation = Propagation.SUPPORTS) + IBundleProvider search(SearchParameterMap theParams, RequestDetails theRequestDetails, HttpServletResponse theServletResponse); + Set searchForIds(SearchParameterMap theParams); /** diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java index 0a077f9f04b..23426709440 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java @@ -1259,7 +1259,7 @@ public class SearchBuilder implements ISearchBuilder { * Check if there is a unique key associated with the set * of parameters passed in */ - ourLog.info("Checking for unique index for query: {}", theParams.toNormalizedQueryString(myContext)); + ourLog.debug("Checking for unique index for query: {}", theParams.toNormalizedQueryString(myContext)); if (myCallingDao.getConfig().isUniqueIndexesEnabled()) { if (myParams.getIncludes().isEmpty()) { if (myParams.getRevIncludes().isEmpty()) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParameterMap.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParameterMap.java index 0b4a36ae41d..864f4531981 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParameterMap.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParameterMap.java @@ -274,14 +274,6 @@ public class SearchParameterMap extends LinkedHashMap theRevIncludes) { myRevIncludes = theRevIncludes; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java index fed35e6ad2a..31e320b04aa 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java @@ -24,6 +24,7 @@ import java.util.Collections; import javax.servlet.http.HttpServletRequest; +import ca.uhn.fhir.rest.api.CacheControlDirective; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; @@ -66,7 +67,7 @@ public class FhirResourceDaoPatientDstu3 extends FhirResourceDaoDstu3im paramMap.setLoadSynchronous(true); } - return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName()); + return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName(), new CacheControlDirective().parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL))); } @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java index f987a7bdfc3..20efb940c4d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java @@ -29,6 +29,7 @@ import java.util.Map.Entry; import javax.persistence.TypedQuery; import ca.uhn.fhir.jpa.util.StopWatch; +import ca.uhn.fhir.rest.param.ParameterUtil; import org.apache.commons.lang3.Validate; import org.apache.http.NameValuePair; import org.hibernate.Session; @@ -438,7 +439,11 @@ public class FhirSystemDaoDstu3 extends BaseHapiFhirSystemDao { DaoMethodOutcome outcome; UrlParts parts = UrlUtil.parseUrl(url); if (isNotBlank(parts.getResourceId())) { - res.setId(new IdType(parts.getResourceType(), parts.getResourceId())); + String version = null; + if (isNotBlank(nextReqEntry.getRequest().getIfMatch())) { + version = ParameterUtil.parseETagValue(nextReqEntry.getRequest().getIfMatch()); + } + res.setId(new IdType(parts.getResourceType(), parts.getResourceId(), version)); outcome = resourceDao.update(res, null, false, theRequestDetails); } else { res.setId((String) null); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/SearchParamRegistryDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/SearchParamRegistryDstu3.java index d2c6e5cd38a..598e42ece8d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/SearchParamRegistryDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/SearchParamRegistryDstu3.java @@ -215,6 +215,9 @@ public class SearchParamRegistryDstu3 extends BaseSearchParamRegistry { case RETIRED: status = RuntimeSearchParamStatusEnum.RETIRED; break; + case UNKNOWN: + status = RuntimeSearchParamStatusEnum.UNKNOWN; + break; case NULL: break; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java index f9d66c30f7a..3d10dfcf1a4 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java @@ -24,6 +24,7 @@ import java.util.Collections; import javax.servlet.http.HttpServletRequest; +import ca.uhn.fhir.rest.api.CacheControlDirective; import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; @@ -66,7 +67,7 @@ public class FhirResourceDaoPatientR4 extends FhirResourceDaoR4implemen paramMap.setLoadSynchronous(true); } - return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName()); + return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName(), new CacheControlDirective().parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL))); } @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java index 05918c2e8f2..9e9ab48f2c6 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java @@ -28,6 +28,7 @@ import java.util.Map.Entry; import javax.persistence.TypedQuery; +import ca.uhn.fhir.rest.param.ParameterUtil; import org.apache.commons.lang3.Validate; import org.apache.http.NameValuePair; import org.hl7.fhir.r4.model.*; @@ -435,7 +436,11 @@ public class FhirSystemDaoR4 extends BaseHapiFhirSystemDao { DaoMethodOutcome outcome; UrlParts parts = UrlUtil.parseUrl(url); if (isNotBlank(parts.getResourceId())) { - res.setId(new IdType(parts.getResourceType(), parts.getResourceId())); + String version = null; + if (isNotBlank(nextReqEntry.getRequest().getIfMatch())) { + version = ParameterUtil.parseETagValue(nextReqEntry.getRequest().getIfMatch()); + } + res.setId(new IdType(parts.getResourceType(), parts.getResourceId(), version)); outcome = resourceDao.update(res, null, false, theRequestDetails); } else { res.setId((String) null); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/SearchParamRegistryR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/SearchParamRegistryR4.java index e82e575423a..2702ccfca83 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/SearchParamRegistryR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/SearchParamRegistryR4.java @@ -216,6 +216,9 @@ public class SearchParamRegistryR4 extends BaseSearchParamRegistry { case RETIRED: status = RuntimeSearchParamStatusEnum.RETIRED; break; + case UNKNOWN: + status = RuntimeSearchParamStatusEnum.UNKNOWN; + break; case NULL: break; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java index 055ed717096..fe1160c9cbf 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java @@ -20,52 +20,54 @@ package ca.uhn.fhir.jpa.entity; * #L% */ -import java.util.Collection; -import java.util.Date; - -import javax.persistence.*; - import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; +import org.hibernate.annotations.OptimisticLock; + +import javax.persistence.*; +import java.util.Collection; +import java.util.Date; @MappedSuperclass public abstract class BaseHasResource { - public static final int MAX_TITLE_LENGTH = 100; - @Column(name = "RES_DELETED_AT", nullable = true) @Temporal(TemporalType.TIMESTAMP) private Date myDeleted; @Column(name = "RES_ENCODING", nullable = false, length = 5) @Enumerated(EnumType.STRING) + @OptimisticLock(excluded = true) private ResourceEncodingEnum myEncoding; @Column(name = "RES_VERSION", nullable = true, length = 7) @Enumerated(EnumType.STRING) + @OptimisticLock(excluded = true) private FhirVersionEnum myFhirVersion; @OneToOne(optional = true, fetch = FetchType.EAGER, cascade = {}, orphanRemoval = false) @JoinColumn(name = "FORCED_ID_PID") + @OptimisticLock(excluded = true) private ForcedId myForcedId; @Column(name = "HAS_TAGS", nullable = false) + @OptimisticLock(excluded = true) private boolean myHasTags; @Temporal(TemporalType.TIMESTAMP) @Column(name = "RES_PUBLISHED", nullable = false) + @OptimisticLock(excluded = true) private Date myPublished; @Column(name = "RES_TEXT", length = Integer.MAX_VALUE - 1, nullable = false) @Lob() + @OptimisticLock(excluded = true) private byte[] myResource; - @Column(name = "RES_TITLE", nullable = true, length = MAX_TITLE_LENGTH) - private String myTitle; - @Temporal(TemporalType.TIMESTAMP) @Column(name = "RES_UPDATED", nullable = false) + @OptimisticLock(excluded = true) private Date myUpdated; public abstract BaseTag addTag(TagDefinition theDef); @@ -74,18 +76,36 @@ public abstract class BaseHasResource { return myDeleted; } + public void setDeleted(Date theDate) { + myDeleted = theDate; + } + public ResourceEncodingEnum getEncoding() { return myEncoding; } + public void setEncoding(ResourceEncodingEnum theEncoding) { + myEncoding = theEncoding; + } + public FhirVersionEnum getFhirVersion() { return myFhirVersion; } + public void setFhirVersion(FhirVersionEnum theFhirVersion) { + myFhirVersion = theFhirVersion; + } + public ForcedId getForcedId() { return myForcedId; } + public void setForcedId(ForcedId theForcedId) { + myForcedId = theForcedId; + } + + public abstract Long getId(); + public abstract IdDt getIdDt(); public InstantDt getPublished() { @@ -96,22 +116,30 @@ public abstract class BaseHasResource { } } + public void setPublished(InstantDt thePublished) { + myPublished = thePublished.getValue(); + } + public byte[] getResource() { return myResource; } + public void setResource(byte[] theResource) { + myResource = theResource; + } + public abstract String getResourceType(); public abstract Collection getTags(); - public String getTitle() { - return myTitle; - } - public InstantDt getUpdated() { return new InstantDt(myUpdated); } + public void setUpdated(InstantDt theUpdated) { + myUpdated = theUpdated.getValue(); + } + public Date getUpdatedDate() { return myUpdated; } @@ -122,24 +150,6 @@ public abstract class BaseHasResource { return myHasTags; } - public void setDeleted(Date theDate) { - myDeleted = theDate; - } - - public abstract Long getId(); - - public void setEncoding(ResourceEncodingEnum theEncoding) { - myEncoding = theEncoding; - } - - public void setFhirVersion(FhirVersionEnum theFhirVersion) { - myFhirVersion = theFhirVersion; - } - - public void setForcedId(ForcedId theForcedId) { - myForcedId = theForcedId; - } - public void setHasTags(boolean theHasTags) { myHasTags = theHasTags; } @@ -148,24 +158,8 @@ public abstract class BaseHasResource { myPublished = thePublished; } - public void setPublished(InstantDt thePublished) { - myPublished = thePublished.getValue(); - } - - public void setResource(byte[] theResource) { - myResource = theResource; - } - - public void setTitle(String theTitle) { - myTitle = theTitle; - } - public void setUpdated(Date theUpdated) { myUpdated = theUpdated; } - public void setUpdated(InstantDt theUpdated) { - myUpdated = theUpdated.getValue(); - } - } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java index d961168f0ab..4df1d50cfd1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java @@ -37,6 +37,7 @@ import org.apache.lucene.analysis.snowball.SnowballPorterFilterFactory; import org.apache.lucene.analysis.standard.StandardFilterFactory; import org.apache.lucene.analysis.standard.StandardTokenizerFactory; import org.hibernate.annotations.ColumnDefault; +import org.hibernate.annotations.OptimisticLock; import org.hibernate.search.annotations.*; import org.hibernate.search.annotations.Parameter; @@ -124,12 +125,15 @@ public class ResourceTable extends BaseHasResource implements Serializable { @Field(name = "myContentTextNGram", index = org.hibernate.search.annotations.Index.YES, store = Store.NO, analyze = Analyze.YES, analyzer = @Analyzer(definition = "autocompleteNGramAnalyzer")), @Field(name = "myContentTextPhonetic", index = org.hibernate.search.annotations.Index.YES, store = Store.NO, analyze = Analyze.YES, analyzer = @Analyzer(definition = "autocompletePhoneticAnalyzer")) }) + @OptimisticLock(excluded = true) private String myContentText; @Column(name = "HASH_SHA256", length = 64, nullable = true) + @OptimisticLock(excluded = true) private String myHashSha256; @Column(name = "SP_HAS_LINKS") + @OptimisticLock(excluded = true) private boolean myHasLinks; @Id @@ -139,12 +143,15 @@ public class ResourceTable extends BaseHasResource implements Serializable { private Long myId; @OneToMany(mappedBy = "myTargetResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) + @OptimisticLock(excluded = true) private Collection myIncomingResourceLinks; @Column(name = "SP_INDEX_STATUS", nullable = true) + @OptimisticLock(excluded = true) private Long myIndexStatus; @Column(name = "RES_LANGUAGE", length = MAX_LANGUAGE_LENGTH, nullable = true) + @OptimisticLock(excluded = true) private String myLanguage; /** @@ -157,69 +164,100 @@ public class ResourceTable extends BaseHasResource implements Serializable { @Field(name = "myNarrativeTextNGram", index = org.hibernate.search.annotations.Index.YES, store = Store.NO, analyze = Analyze.YES, analyzer = @Analyzer(definition = "autocompleteNGramAnalyzer")), @Field(name = "myNarrativeTextPhonetic", index = org.hibernate.search.annotations.Index.YES, store = Store.NO, analyze = Analyze.YES, analyzer = @Analyzer(definition = "autocompletePhoneticAnalyzer")) }) + @OptimisticLock(excluded = true) private String myNarrativeText; @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) + @OptimisticLock(excluded = true) private Collection myParamsCoords; @Column(name = "SP_COORDS_PRESENT") + @OptimisticLock(excluded = true) private boolean myParamsCoordsPopulated; @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) + @OptimisticLock(excluded = true) private Collection myParamsDate; @Column(name = "SP_DATE_PRESENT") + @OptimisticLock(excluded = true) private boolean myParamsDatePopulated; + @OptimisticLock(excluded = true) @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) private Collection myParamsNumber; @Column(name = "SP_NUMBER_PRESENT") + @OptimisticLock(excluded = true) private boolean myParamsNumberPopulated; @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) + @OptimisticLock(excluded = true) private Collection myParamsQuantity; @Column(name = "SP_QUANTITY_PRESENT") + @OptimisticLock(excluded = true) private boolean myParamsQuantityPopulated; @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) + @OptimisticLock(excluded = true) private Collection myParamsString; @Column(name = "SP_STRING_PRESENT") + @OptimisticLock(excluded = true) private boolean myParamsStringPopulated; @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) + @OptimisticLock(excluded = true) private Collection myParamsToken; @Column(name = "SP_TOKEN_PRESENT") + @OptimisticLock(excluded = true) private boolean myParamsTokenPopulated; @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) + @OptimisticLock(excluded = true) private Collection myParamsUri; @Column(name = "SP_URI_PRESENT") + @OptimisticLock(excluded = true) private boolean myParamsUriPopulated; @Column(name = "RES_PROFILE", length = MAX_PROFILE_LENGTH, nullable = true) + @OptimisticLock(excluded = true) private String myProfile; - @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) - private Collection myParamsCompositeStringUnique; + // Added in 3.0.0 - Should make this a primitive Boolean at some point + @OptimisticLock(excluded = true) @Column(name = "SP_CMPSTR_UNIQ_PRESENT") private Boolean myParamsCompositeStringUniquePresent = false; + + @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) + @OptimisticLock(excluded = true) + private Collection myParamsCompositeStringUnique; + @OneToMany(mappedBy = "mySourceResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false) @IndexedEmbedded() + @OptimisticLock(excluded = true) private Collection myResourceLinks; + @Column(name = "RES_TYPE", length = RESTYPE_LEN) @Field + @OptimisticLock(excluded = true) private String myResourceType; + @OneToMany(mappedBy = "myResource", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true) + @OptimisticLock(excluded = true) private Collection mySearchParamPresents; + @OneToMany(mappedBy = "myResource", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true) + @OptimisticLock(excluded = true) private Set myTags; + @Transient private transient boolean myUnchangedInCurrentOperation; + + @Version @Column(name = "RES_VER") private long myVersion; @@ -555,7 +593,6 @@ public class ResourceTable extends BaseHasResource implements Serializable { retVal.setResourceType(myResourceType); retVal.setVersion(myVersion); - retVal.setTitle(getTitle()); retVal.setPublished(getPublished()); retVal.setUpdated(getUpdated()); retVal.setEncoding(getEncoding()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java index dfbc745c0b9..ff2086f1cbf 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java @@ -50,6 +50,7 @@ public class Search implements Serializable { private static final int FAILURE_MESSAGE_LENGTH = 500; private static final long serialVersionUID = 1L; + public static final int MAX_SEARCH_QUERY_STRING = 10000; @Temporal(TemporalType.TIMESTAMP) @Column(name="CREATED", nullable=false, updatable=false) @@ -100,8 +101,8 @@ public class Search implements Serializable { private Date mySearchLastReturned; @Lob() - @Basic(fetch=FetchType.LAZY) - @Column(name="SEARCH_QUERY_STRING", nullable=true, updatable=false) + @Basic(fetch=FetchType.LAZY) + @Column(name="SEARCH_QUERY_STRING", nullable=true, updatable=false, length = MAX_SEARCH_QUERY_STRING) private String mySearchQueryString; @Column(name="SEARCH_QUERY_STRING_HASH", nullable=true, updatable=false) @@ -256,7 +257,11 @@ public class Search implements Serializable { } public void setSearchQueryString(String theSearchQueryString) { - mySearchQueryString = theSearchQueryString; + if (theSearchQueryString != null && theSearchQueryString.length() > MAX_SEARCH_QUERY_STRING) { + mySearchQueryString = null; + } else { + mySearchQueryString = theSearchQueryString; + } } public void setSearchQueryStringHash(Integer theSearchQueryStringHash) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java index cba8963940c..fce3910d95b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java @@ -115,6 +115,8 @@ public class JpaStorageServices extends BaseHapiFhirDao implement break; case URI: break; + case HAS: + break; } params.add(nextArgument.getName(), param); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProviderDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProviderDstu2.java index 059f34f1f24..43b9c63f48f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProviderDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProviderDstu2.java @@ -24,6 +24,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank; import java.util.*; import java.util.Map.Entry; +import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -47,7 +48,7 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus mySystemDao; - @Autowired + @Autowired(required = false) private IFulltextSearchSvc mySearchDao; //@formatter:off @@ -178,7 +179,8 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus keywords = mySearchDao.suggestKeywords(theContext, theSearchParam, theText); Parameters retVal = new Parameters(); for (Suggestion next : keywords) { - //@formatter:off retVal.addParameter() .addPart(new Parameter().setName("keyword").setValue(new StringDt(next.getTerm()))) .addPart(new Parameter().setName("score").setValue(new DecimalDt(next.getScore()))); - //@formatter:on } return retVal; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderValueSetDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderValueSetDstu3.java index dc4f88e9a6b..d4bcb91db47 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderValueSetDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderValueSetDstu3.java @@ -20,35 +20,42 @@ package ca.uhn.fhir.jpa.provider.dstu3; * #L% */ -import static org.apache.commons.lang3.StringUtils.isNotBlank; +import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet; +import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult; +import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.Operation; +import ca.uhn.fhir.rest.annotation.OperationParam; +import ca.uhn.fhir.rest.api.server.RequestDetails; +import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import org.hl7.fhir.dstu3.model.*; import javax.servlet.http.HttpServletRequest; -import org.hl7.fhir.dstu3.model.*; - -import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet; -import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult; -import ca.uhn.fhir.rest.annotation.*; -import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import static org.apache.commons.lang3.StringUtils.isNotBlank; public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDstu3 { - //@formatter:off @Operation(name = "$expand", idempotent = true) public ValueSet expand( - HttpServletRequest theServletRequest, - @IdParam(optional=true) IdType theId, - @OperationParam(name="valueSet", min=0, max=1) ValueSet theValueSet, - @OperationParam(name="identifier", min=0, max=1) UriType theIdentifier, - @OperationParam(name = "filter", min=0, max=1) StringType theFilter, - RequestDetails theRequestDetails) { - //@formatter:on - + HttpServletRequest theServletRequest, + @IdParam(optional = true) IdType theId, + @OperationParam(name = "valueSet", min = 0, max = 1) ValueSet theValueSet, + // Note: url is correct and identifier is not, but identifier was only added as + // of 3.1.0 so we'll leave url for now. See: https://groups.google.com/d/msgid/hapi-fhir/CAN2Cfy8kW%2BAOkgC6VjPsU3gRCpExCNZBmJdi-k5R_TWeyWH4tA%40mail.gmail.com?utm_medium=email&utm_source=footer + @OperationParam(name = "url", min = 0, max = 1) UriType theUrl, + @OperationParam(name = "identifier", min = 0, max = 1) UriType theIdentifier, + @OperationParam(name = "filter", min = 0, max = 1) StringType theFilter, + RequestDetails theRequestDetails) { + boolean haveId = theId != null && theId.hasIdPart(); - boolean haveIdentifier = theIdentifier != null && isNotBlank(theIdentifier.getValue()); + UriType url = theIdentifier; + if (theUrl != null && isNotBlank(theUrl.getValue())) { + url = theUrl; + } + + boolean haveIdentifier = url != null && isNotBlank(url.getValue()); boolean haveValueSet = theValueSet != null && theValueSet.isEmpty() == false; - + if (!haveId && !haveIdentifier && !haveValueSet) { throw new InvalidRequestException("$expand operation at the type level (no ID specified) requires an identifier or a valueSet as a part of the request"); } @@ -56,18 +63,18 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst if (moreThanOneTrue(haveId, haveIdentifier, haveValueSet)) { throw new InvalidRequestException("$expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options."); } - + startRequest(theServletRequest); try { IFhirResourceDaoValueSet dao = (IFhirResourceDaoValueSet) getDao(); if (haveId) { return dao.expand(theId, toFilterString(theFilter), theRequestDetails); } else if (haveIdentifier) { - return dao.expandByIdentifier(theIdentifier.getValue(), toFilterString(theFilter)); + return dao.expandByIdentifier(url.getValue(), toFilterString(theFilter)); } else { return dao.expand(theValueSet, toFilterString(theFilter)); } - + } finally { endRequest(theServletRequest); } @@ -79,30 +86,34 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst } - //@formatter:off @SuppressWarnings("unchecked") - @Operation(name = "$validate-code", idempotent = true, returnParameters= { - @OperationParam(name="result", type=BooleanType.class, min=1), - @OperationParam(name="message", type=StringType.class), - @OperationParam(name="display", type=StringType.class) + @Operation(name = "$validate-code", idempotent = true, returnParameters = { + @OperationParam(name = "result", type = BooleanType.class, min = 1), + @OperationParam(name = "message", type = StringType.class), + @OperationParam(name = "display", type = StringType.class) }) public Parameters validateCode( - HttpServletRequest theServletRequest, - @IdParam(optional=true) IdType theId, - @OperationParam(name="identifier", min=0, max=1) UriType theValueSetIdentifier, - @OperationParam(name="code", min=0, max=1) CodeType theCode, - @OperationParam(name="system", min=0, max=1) UriType theSystem, - @OperationParam(name="display", min=0, max=1) StringType theDisplay, - @OperationParam(name="coding", min=0, max=1) Coding theCoding, - @OperationParam(name="codeableConcept", min=0, max=1) CodeableConcept theCodeableConcept, - RequestDetails theRequestDetails - ) { - //@formatter:on - + HttpServletRequest theServletRequest, + @IdParam(optional = true) IdType theId, + @OperationParam(name = "identifier", min = 0, max = 1) UriType theValueSetIdentifier, + @OperationParam(name = "url", min = 0, max = 1) UriType theValueSetUrl, + @OperationParam(name = "code", min = 0, max = 1) CodeType theCode, + @OperationParam(name = "system", min = 0, max = 1) UriType theSystem, + @OperationParam(name = "display", min = 0, max = 1) StringType theDisplay, + @OperationParam(name = "coding", min = 0, max = 1) Coding theCoding, + @OperationParam(name = "codeableConcept", min = 0, max = 1) CodeableConcept theCodeableConcept, + RequestDetails theRequestDetails + ) { + + UriType url = theValueSetIdentifier; + if (theValueSetUrl != null && isNotBlank(theValueSetUrl.getValue())) { + url = theValueSetUrl; + } + startRequest(theServletRequest); try { IFhirResourceDaoValueSet dao = (IFhirResourceDaoValueSet) getDao(); - ValidateCodeResult result = dao.validateCode(theValueSetIdentifier, theId, theCode, theSystem, theDisplay, theCoding, theCodeableConcept, theRequestDetails); + ValidateCodeResult result = dao.validateCode(url, theId, theCode, theSystem, theDisplay, theCoding, theCodeableConcept, theRequestDetails); Parameters retVal = new Parameters(); retVal.addParameter().setName("result").setValue(new BooleanType(result.isResult())); if (isNotBlank(result.getMessage())) { @@ -117,8 +128,7 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst } } - - + private static boolean moreThanOneTrue(boolean... theBooleans) { boolean haveOne = false; for (boolean next : theBooleans) { @@ -133,5 +143,5 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst return false; } - + } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java index e2567514936..c4562a39048 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java @@ -1,5 +1,27 @@ package ca.uhn.fhir.jpa.provider.dstu3; +import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl.Suggestion; +import ca.uhn.fhir.jpa.dao.IFhirSystemDao; +import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; +import ca.uhn.fhir.jpa.provider.BaseJpaSystemProviderDstu2Plus; +import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.rest.annotation.Operation; +import ca.uhn.fhir.rest.annotation.OperationParam; +import ca.uhn.fhir.rest.annotation.Transaction; +import ca.uhn.fhir.rest.annotation.TransactionParam; +import ca.uhn.fhir.rest.api.server.RequestDetails; +import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; +import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + import static org.apache.commons.lang3.StringUtils.isBlank; /* @@ -21,23 +43,6 @@ import static org.apache.commons.lang3.StringUtils.isBlank; * limitations under the License. * #L% */ -import java.util.*; -import java.util.Map.Entry; - -import org.hl7.fhir.dstu3.model.*; -import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl.Suggestion; -import ca.uhn.fhir.jpa.dao.IFhirSystemDao; -import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; -import ca.uhn.fhir.jpa.provider.BaseJpaSystemProviderDstu2Plus; -import ca.uhn.fhir.model.api.annotation.Description; -import ca.uhn.fhir.rest.annotation.*; -import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus { @@ -45,122 +50,122 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus mySystemDao; - @Autowired + @Autowired(required = false) private IFulltextSearchSvc mySearchDao; - + //@formatter:off // This is generated by hand: // ls hapi-fhir-structures-dstu2/target/generated-sources/tinder/ca/uhn/fhir/model/dstu2/resource/ | sort | sed "s/.java//" | sed "s/^/@OperationParam(name=\"/" | sed "s/$/\", type=IntegerType.class, min=0, max=1),/" - @Operation(name="$get-resource-counts", idempotent=true, returnParameters= { - @OperationParam(name="AllergyIntolerance", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Appointment", type=IntegerType.class, min=0, max=1), - @OperationParam(name="AppointmentResponse", type=IntegerType.class, min=0, max=1), - @OperationParam(name="AuditEvent", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Basic", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Binary", type=IntegerType.class, min=0, max=1), - @OperationParam(name="BodySite", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Bundle", type=IntegerType.class, min=0, max=1), - @OperationParam(name="CarePlan", type=IntegerType.class, min=0, max=1), - @OperationParam(name="CarePlan2", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Claim", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ClaimResponse", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ClinicalImpression", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Communication", type=IntegerType.class, min=0, max=1), - @OperationParam(name="CommunicationRequest", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Composition", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ConceptMap", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Condition", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Conformance", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Contract", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Contraindication", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Coverage", type=IntegerType.class, min=0, max=1), - @OperationParam(name="DataElement", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Device", type=IntegerType.class, min=0, max=1), - @OperationParam(name="DeviceComponent", type=IntegerType.class, min=0, max=1), - @OperationParam(name="DeviceMetric", type=IntegerType.class, min=0, max=1), - @OperationParam(name="DeviceUseRequest", type=IntegerType.class, min=0, max=1), - @OperationParam(name="DeviceUseStatement", type=IntegerType.class, min=0, max=1), - @OperationParam(name="DiagnosticOrder", type=IntegerType.class, min=0, max=1), - @OperationParam(name="DiagnosticReport", type=IntegerType.class, min=0, max=1), - @OperationParam(name="DocumentManifest", type=IntegerType.class, min=0, max=1), - @OperationParam(name="DocumentReference", type=IntegerType.class, min=0, max=1), - @OperationParam(name="EligibilityRequest", type=IntegerType.class, min=0, max=1), - @OperationParam(name="EligibilityResponse", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Encounter", type=IntegerType.class, min=0, max=1), - @OperationParam(name="EnrollmentRequest", type=IntegerType.class, min=0, max=1), - @OperationParam(name="EnrollmentResponse", type=IntegerType.class, min=0, max=1), - @OperationParam(name="EpisodeOfCare", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ExplanationOfBenefit", type=IntegerType.class, min=0, max=1), - @OperationParam(name="FamilyMemberHistory", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Flag", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Goal", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Group", type=IntegerType.class, min=0, max=1), - @OperationParam(name="HealthcareService", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ImagingObjectSelection", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ImagingStudy", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Immunization", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ImmunizationRecommendation", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ListResource", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Location", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Media", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Medication", type=IntegerType.class, min=0, max=1), - @OperationParam(name="MedicationAdministration", type=IntegerType.class, min=0, max=1), - @OperationParam(name="MedicationDispense", type=IntegerType.class, min=0, max=1), - @OperationParam(name="MedicationPrescription", type=IntegerType.class, min=0, max=1), - @OperationParam(name="MedicationStatement", type=IntegerType.class, min=0, max=1), - @OperationParam(name="MessageHeader", type=IntegerType.class, min=0, max=1), - @OperationParam(name="NamingSystem", type=IntegerType.class, min=0, max=1), - @OperationParam(name="NutritionOrder", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Observation", type=IntegerType.class, min=0, max=1), - @OperationParam(name="OperationDefinition", type=IntegerType.class, min=0, max=1), - @OperationParam(name="OperationOutcome", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Order", type=IntegerType.class, min=0, max=1), - @OperationParam(name="OrderResponse", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Organization", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Parameters", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Patient", type=IntegerType.class, min=0, max=1), - @OperationParam(name="PaymentNotice", type=IntegerType.class, min=0, max=1), - @OperationParam(name="PaymentReconciliation", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Person", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Practitioner", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Procedure", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ProcedureRequest", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ProcessRequest", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ProcessResponse", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Provenance", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Questionnaire", type=IntegerType.class, min=0, max=1), - @OperationParam(name="QuestionnaireAnswers", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ReferralRequest", type=IntegerType.class, min=0, max=1), - @OperationParam(name="RelatedPerson", type=IntegerType.class, min=0, max=1), - @OperationParam(name="RiskAssessment", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Schedule", type=IntegerType.class, min=0, max=1), - @OperationParam(name="SearchParameter", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Slot", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Specimen", type=IntegerType.class, min=0, max=1), - @OperationParam(name="StructureDefinition", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Subscription", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Substance", type=IntegerType.class, min=0, max=1), - @OperationParam(name="Supply", type=IntegerType.class, min=0, max=1), - @OperationParam(name="ValueSet", type=IntegerType.class, min=0, max=1), - @OperationParam(name="VisionPrescription", type=IntegerType.class, min=0, max=1) + @Operation(name = "$get-resource-counts", idempotent = true, returnParameters = { + @OperationParam(name = "AllergyIntolerance", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Appointment", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "AppointmentResponse", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "AuditEvent", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Basic", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Binary", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "BodySite", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Bundle", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "CarePlan", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "CarePlan2", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Claim", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ClaimResponse", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ClinicalImpression", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Communication", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "CommunicationRequest", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Composition", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ConceptMap", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Condition", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Conformance", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Contract", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Contraindication", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Coverage", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "DataElement", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Device", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "DeviceComponent", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "DeviceMetric", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "DeviceUseRequest", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "DeviceUseStatement", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "DiagnosticOrder", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "DiagnosticReport", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "DocumentManifest", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "DocumentReference", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "EligibilityRequest", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "EligibilityResponse", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Encounter", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "EnrollmentRequest", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "EnrollmentResponse", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "EpisodeOfCare", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ExplanationOfBenefit", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "FamilyMemberHistory", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Flag", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Goal", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Group", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "HealthcareService", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ImagingObjectSelection", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ImagingStudy", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Immunization", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ImmunizationRecommendation", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ListResource", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Location", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Media", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Medication", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "MedicationAdministration", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "MedicationDispense", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "MedicationPrescription", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "MedicationStatement", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "MessageHeader", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "NamingSystem", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "NutritionOrder", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Observation", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "OperationDefinition", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "OperationOutcome", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Order", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "OrderResponse", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Organization", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Parameters", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Patient", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "PaymentNotice", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "PaymentReconciliation", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Person", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Practitioner", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Procedure", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ProcedureRequest", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ProcessRequest", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ProcessResponse", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Provenance", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Questionnaire", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "QuestionnaireAnswers", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ReferralRequest", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "RelatedPerson", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "RiskAssessment", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Schedule", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "SearchParameter", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Slot", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Specimen", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "StructureDefinition", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Subscription", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Substance", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "Supply", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "ValueSet", type = IntegerType.class, min = 0, max = 1), + @OperationParam(name = "VisionPrescription", type = IntegerType.class, min = 0, max = 1) }) - @Description(shortDefinition="Provides the number of resources currently stored on the server, broken down by resource type") + @Description(shortDefinition = "Provides the number of resources currently stored on the server, broken down by resource type") //@formatter:on public Parameters getResourceCounts() { Parameters retVal = new Parameters(); - + Map counts = mySystemDao.getResourceCounts(); counts = new TreeMap(counts); for (Entry nextEntry : counts.entrySet()) { retVal.addParameter().setName((nextEntry.getKey())).setValue(new IntegerType(nextEntry.getValue().intValue())); } - + return retVal; } //@formatter:off - @Operation(name="$meta", idempotent=true, returnParameters= { - @OperationParam(name="return", type=Meta.class) + @Operation(name = "$meta", idempotent = true, returnParameters = { + @OperationParam(name = "return", type = Meta.class) }) //@formatter:on public Parameters meta(RequestDetails theRequestDetails) { @@ -168,14 +173,15 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus keywords = mySearchDao.suggestKeywords(theContext, theSearchParam, theText); - + Parameters retVal = new Parameters(); for (Suggestion next : keywords) { //@formatter:off retVal.addParameter() - .addPart(new ParametersParameterComponent().setName("keyword").setValue(new StringType(next.getTerm()))) - .addPart(new ParametersParameterComponent().setName("score").setValue(new DecimalType(next.getScore()))); + .addPart(new ParametersParameterComponent().setName("keyword").setValue(new StringType(next.getTerm()))) + .addPart(new ParametersParameterComponent().setName("score").setValue(new DecimalType(next.getScore()))); //@formatter:on } return retVal; } - + @Transaction public Bundle transaction(RequestDetails theRequestDetails, @TransactionParam Bundle theResources) { startRequest(((ServletRequestDetails) theRequestDetails).getServletRequest()); @@ -210,4 +216,10 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus { - //@formatter:off @Operation(name = "$expand", idempotent = true) public ValueSet expand( - HttpServletRequest theServletRequest, - @IdParam(optional=true) IdType theId, - @OperationParam(name="valueSet", min=0, max=1) ValueSet theValueSet, - @OperationParam(name="identifier", min=0, max=1) UriType theIdentifier, - @OperationParam(name = "filter", min=0, max=1) StringType theFilter, - RequestDetails theRequestDetails) { - //@formatter:on - + HttpServletRequest theServletRequest, + @IdParam(optional = true) IdType theId, + @OperationParam(name = "valueSet", min = 0, max = 1) ValueSet theValueSet, + @OperationParam(name = "url", min = 0, max = 1) UriType theUrl, + @OperationParam(name = "filter", min = 0, max = 1) StringType theFilter, + RequestDetails theRequestDetails) { + boolean haveId = theId != null && theId.hasIdPart(); - boolean haveIdentifier = theIdentifier != null && isNotBlank(theIdentifier.getValue()); + boolean haveIdentifier = theUrl != null && isNotBlank(theUrl.getValue()); boolean haveValueSet = theValueSet != null && theValueSet.isEmpty() == false; - + if (!haveId && !haveIdentifier && !haveValueSet) { - throw new InvalidRequestException("$expand operation at the type level (no ID specified) requires an identifier or a valueSet as a part of the request"); + throw new InvalidRequestException("$expand operation at the type level (no ID specified) requires a url or a valueSet as a part of the request"); } if (moreThanOneTrue(haveId, haveIdentifier, haveValueSet)) { - throw new InvalidRequestException("$expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options."); + throw new InvalidRequestException("$expand must EITHER be invoked at the instance level, or have a url specified, or have a ValueSet specified. Can not combine these options."); } - + startRequest(theServletRequest); try { IFhirResourceDaoValueSet dao = (IFhirResourceDaoValueSet) getDao(); if (haveId) { return dao.expand(theId, toFilterString(theFilter), theRequestDetails); } else if (haveIdentifier) { - return dao.expandByIdentifier(theIdentifier.getValue(), toFilterString(theFilter)); + return dao.expandByIdentifier(theUrl.getValue(), toFilterString(theFilter)); } else { return dao.expand(theValueSet, toFilterString(theFilter)); } - + } finally { endRequest(theServletRequest); } @@ -79,30 +78,28 @@ public class BaseJpaResourceProviderValueSetR4 extends JpaResourceProviderR4 dao = (IFhirResourceDaoValueSet) getDao(); - ValidateCodeResult result = dao.validateCode(theValueSetIdentifier, theId, theCode, theSystem, theDisplay, theCoding, theCodeableConcept, theRequestDetails); + ValidateCodeResult result = dao.validateCode(theValueSetUrl, theId, theCode, theSystem, theDisplay, theCoding, theCodeableConcept, theRequestDetails); Parameters retVal = new Parameters(); retVal.addParameter().setName("result").setValue(new BooleanType(result.isResult())); if (isNotBlank(result.getMessage())) { @@ -117,8 +114,7 @@ public class BaseJpaResourceProviderValueSetR4 extends JpaResourceProviderR4 mySystemDao; - @Autowired + @Autowired(required = false) private IFulltextSearchSvc mySearchDao; //@formatter:off @@ -175,6 +175,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus getResources(String theUuid, int theFrom, int theTo); - - IBundleProvider registerSearch(IDao theCallingDao, SearchParameterMap theParams, String theResourceType); - void cancelAllActiveSearches(); + List getResources(String theUuid, int theFrom, int theTo); + + IBundleProvider registerSearch(IDao theCallingDao, SearchParameterMap theParams, String theResourceType, CacheControlDirective theCacheControlDirective); + } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java index 7bb742485d4..d0cece19699 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java @@ -19,23 +19,32 @@ package ca.uhn.fhir.jpa.search; * limitations under the License. * #L% */ -import java.util.*; - -import javax.persistence.*; -import javax.persistence.criteria.*; - -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.support.*; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.dao.IDao; import ca.uhn.fhir.jpa.dao.ISearchBuilder; import ca.uhn.fhir.jpa.dao.data.ISearchDao; -import ca.uhn.fhir.jpa.entity.*; +import ca.uhn.fhir.jpa.entity.BaseHasResource; +import ca.uhn.fhir.jpa.entity.ResourceHistoryTable; +import ca.uhn.fhir.jpa.entity.Search; +import ca.uhn.fhir.jpa.entity.SearchTypeEnum; import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.rest.api.server.IBundleProvider; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.TransactionCallback; +import org.springframework.transaction.support.TransactionCallbackWithoutResult; +import org.springframework.transaction.support.TransactionTemplate; + +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import java.util.*; public class PersistedJpaBundleProvider implements IBundleProvider { @@ -47,6 +56,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider { private ISearchDao mySearchDao; private Search mySearchEntity; private String myUuid; + private boolean myCacheHit; public PersistedJpaBundleProvider(String theSearchUuid, IDao theDao) { myUuid = theSearchUuid; @@ -179,17 +189,17 @@ public class PersistedJpaBundleProvider implements IBundleProvider { }); switch (mySearchEntity.getSearchType()) { - case HISTORY: - return template.execute(new TransactionCallback>() { - @Override - public List doInTransaction(TransactionStatus theStatus) { - return doHistoryInTransaction(theFromIndex, theToIndex); - } - }); - case SEARCH: - case EVERYTHING: - default: - return doSearchOrEverything(theFromIndex, theToIndex); + case HISTORY: + return template.execute(new TransactionCallback>() { + @Override + public List doInTransaction(TransactionStatus theStatus) { + return doHistoryInTransaction(theFromIndex, theToIndex); + } + }); + case SEARCH: + case EVERYTHING: + default: + return doSearchOrEverything(theFromIndex, theToIndex); } } @@ -197,6 +207,14 @@ public class PersistedJpaBundleProvider implements IBundleProvider { return myUuid; } + public boolean isCacheHit() { + return myCacheHit; + } + + public void setCacheHit(boolean theCacheHit) { + myCacheHit = theCacheHit; + } + @Override public Integer preferredPageSize() { ensureSearchEntityLoaded(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaSearchFirstPageBundleProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaSearchFirstPageBundleProvider.java index d3d5618f888..f1b63e8716c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaSearchFirstPageBundleProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaSearchFirstPageBundleProvider.java @@ -67,8 +67,11 @@ public class PersistedJpaSearchFirstPageBundleProvider extends PersistedJpaBundl @Override public Integer size() { - mySearchTask.awaitInitialSync(); + Integer size = mySearchTask.awaitInitialSync(); SearchCoordinatorSvcImpl.verifySearchHasntFailedOrThrowInternalErrorException(mySearch); + if (size != null) { + return size; + } return super.size(); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java index e2e9cb30da6..49950d34dd3 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java @@ -17,13 +17,15 @@ package ca.uhn.fhir.jpa.search; * 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% + * #L%family */ import java.util.*; import java.util.concurrent.*; import javax.persistence.EntityManager; +import ca.uhn.fhir.rest.api.CacheControlDirective; +import ca.uhn.fhir.rest.api.Constants; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.exception.ExceptionUtils; @@ -55,7 +57,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { public static final int DEFAULT_SYNC_SIZE = 250; private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchCoordinatorSvcImpl.class); - + private final ConcurrentHashMap myIdToSearchTask = new ConcurrentHashMap(); @Autowired private FhirContext myContext; @Autowired @@ -63,7 +65,6 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { @Autowired private EntityManager myEntityManager; private ExecutorService myExecutor; - private final ConcurrentHashMap myIdToSearchTask = new ConcurrentHashMap(); private Integer myLoadingThrottleForUnitTests = null; private long myMaxMillisToWaitForRemoteResults = DateUtils.MILLIS_PER_MINUTE; private boolean myNeverUseLocalSearchForUnitTests; @@ -78,13 +79,6 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { private int mySyncSize = DEFAULT_SYNC_SIZE; - // @Autowired - // private DataSource myDataSource; - // @PostConstruct - // public void start() { - // JpaTransactionManager txManager = (JpaTransactionManager) myManagedTxManager; - // } - /** * Constructor */ @@ -186,15 +180,33 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { } @Override - public IBundleProvider registerSearch(final IDao theCallingDao, final SearchParameterMap theParams, String theResourceType) { + public IBundleProvider registerSearch(final IDao theCallingDao, final SearchParameterMap theParams, String theResourceType, CacheControlDirective theCacheControlDirective) { StopWatch w = new StopWatch(); final String searchUuid = UUID.randomUUID().toString(); + ourLog.debug("Registering new search {}", searchUuid); + Class resourceTypeClass = myContext.getResourceDefinition(theResourceType).getImplementingClass(); final ISearchBuilder sb = theCallingDao.newSearchBuilder(); sb.setType(resourceTypeClass, theResourceType); - if (theParams.isLoadSynchronous()) { + final Integer loadSynchronousUpTo; + if (theCacheControlDirective != null && theCacheControlDirective.isNoStore()) { + if (theCacheControlDirective.getMaxResults() != null) { + loadSynchronousUpTo = theCacheControlDirective.getMaxResults(); + if (loadSynchronousUpTo > myDaoConfig.getCacheControlNoStoreMaxResultsUpperLimit()) { + throw new InvalidRequestException(Constants.HEADER_CACHE_CONTROL + " header " + Constants.CACHE_CONTROL_MAX_RESULTS + " value must not exceed " + myDaoConfig.getCacheControlNoStoreMaxResultsUpperLimit()); + } + } else { + loadSynchronousUpTo = 100; + } + } else { + loadSynchronousUpTo = null; + } + + if (theParams.isLoadSynchronous() || loadSynchronousUpTo != null) { + + ourLog.debug("Search {} is loading in synchronous mode", searchUuid); // Execute the query and make sure we return distinct results TransactionTemplate txTemplate = new TransactionTemplate(myManagedTxManager); @@ -209,6 +221,9 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { Iterator resultIter = sb.createQuery(theParams, searchUuid); while (resultIter.hasNext()) { pids.add(resultIter.next()); + if (loadSynchronousUpTo != null && pids.size() >= loadSynchronousUpTo) { + break; + } if (theParams.getLoadSynchronousUpTo() != null && pids.size() >= theParams.getLoadSynchronousUpTo()) { break; } @@ -238,9 +253,13 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { * See if there are any cached searches whose results we can return * instead */ + boolean useCache = true; + if (theCacheControlDirective != null && theCacheControlDirective.isNoCache() == true) { + useCache = false; + } final String queryString = theParams.toNormalizedQueryString(myContext); if (theParams.getEverythingMode() == null) { - if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null) { + if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null && useCache) { final Date createdCutoff = new Date(System.currentTimeMillis() - myDaoConfig.getReuseCachedSearchResultsForMillis()); final String resourceType = theResourceType; @@ -266,6 +285,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { mySearchDao.updateSearchLastReturned(searchToUse.getId(), new Date()); retVal = new PersistedJpaBundleProvider(searchToUse.getUuid(), theCallingDao); + retVal.setCacheHit(true); + populateBundleProvider(retVal); } @@ -401,16 +422,16 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { public class SearchTask implements Callable { - private boolean myAbortRequested; private final IDao myCallingDao; private final CountDownLatch myCompletionLatch; - private int myCountSaved = 0; private final CountDownLatch myInitialCollectionLatch = new CountDownLatch(1); private final SearchParameterMap myParams; private final String myResourceType; private final Search mySearch; private final ArrayList mySyncedPids = new ArrayList(); private final ArrayList myUnsyncedPids = new ArrayList(); + private boolean myAbortRequested; + private int myCountSaved = 0; private String mySearchUuid; public SearchTask(Search theSearch, IDao theCallingDao, SearchParameterMap theParams, String theResourceType, String theSearchUuid) { @@ -422,7 +443,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { mySearchUuid = theSearchUuid; } - public void awaitInitialSync() { + public Integer awaitInitialSync() { ourLog.trace("Awaiting initial sync"); do { try { @@ -434,6 +455,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { } } while (mySearch.getStatus() == SearchStatusEnum.LOADING); ourLog.trace("Initial sync completed"); + + return mySearch.getTotalCount(); } @Override @@ -492,6 +515,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { } myIdToSearchTask.remove(mySearch.getUuid()); + myInitialCollectionLatch.countDown(); myCompletionLatch.countDown(); return null; } @@ -537,27 +561,27 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { public List getResourcePids(int theFromIndex, int theToIndex) { ourLog.info("Requesting search PIDs from {}-{}", theFromIndex, theToIndex); - CountDownLatch latch = null; - synchronized (mySyncedPids) { - if (mySyncedPids.size() < theToIndex && mySearch.getStatus() == SearchStatusEnum.LOADING) { - int latchSize = theToIndex - mySyncedPids.size(); - ourLog.trace("Registering latch to await {} results (want {} total)", latchSize, theToIndex); - latch = new CountDownLatch(latchSize); - } - } - - if (latch != null) { - while (latch.getCount() > 0 && mySearch.getStatus() == SearchStatusEnum.LOADING) { - try { - ourLog.trace("Awaiting latch with {}", latch.getCount()); - latch.await(500, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - // ok + boolean keepWaiting; + do { + synchronized (mySyncedPids) { + keepWaiting = false; + if (mySyncedPids.size() < theToIndex && mySearch.getStatus() == SearchStatusEnum.LOADING) { + keepWaiting = true; } } - } + if (keepWaiting) { + ourLog.info("Waiting, as we only have {} results", mySyncedPids.size()); + try { + Thread.sleep(500); + } catch (InterruptedException theE) { + // ignore + } + } + } while (keepWaiting); - ArrayList retVal = new ArrayList(); + ourLog.info("Proceeding, as we have {} results", mySyncedPids.size()); + + ArrayList retVal = new ArrayList<>(); synchronized (mySyncedPids) { verifySearchHasntFailedOrThrowInternalErrorException(mySearch); @@ -570,6 +594,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { } } + ourLog.info("Done syncing results", mySyncedPids.size()); + return retVal; } @@ -618,8 +644,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { myUnsyncedPids.clear(); if (theResultIter.hasNext() == false) { - mySearch.setStatus(SearchStatusEnum.FINISHED); mySearch.setTotalCount(myCountSaved); + mySearch.setStatus(SearchStatusEnum.FINISHED); } } mySearch.setNumFound(myCountSaved); @@ -628,7 +654,16 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { } }); - myInitialCollectionLatch.countDown(); + int numSynced; + synchronized (mySyncedPids) { + numSynced = mySyncedPids.size(); + } + + if (myDaoConfig.getCountSearchResultsUpTo() == null || + myDaoConfig.getCountSearchResultsUpTo() <= 0 || + myDaoConfig.getCountSearchResultsUpTo() <= numSynced) { + myInitialCollectionLatch.countDown(); + } } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java index 9c5a2c56be7..29d12b36916 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java @@ -20,8 +20,12 @@ package ca.uhn.fhir.jpa.search; * #L% */ -import java.util.Date; - +import ca.uhn.fhir.jpa.dao.DaoConfig; +import ca.uhn.fhir.jpa.dao.data.ISearchDao; +import ca.uhn.fhir.jpa.dao.data.ISearchIncludeDao; +import ca.uhn.fhir.jpa.dao.data.ISearchResultDao; +import ca.uhn.fhir.jpa.entity.Search; +import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; @@ -34,11 +38,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.support.TransactionCallback; import org.springframework.transaction.support.TransactionTemplate; -import com.google.common.annotations.VisibleForTesting; - -import ca.uhn.fhir.jpa.dao.DaoConfig; -import ca.uhn.fhir.jpa.dao.data.*; -import ca.uhn.fhir.jpa.entity.Search; +import java.util.Date; /** * Deletes old searches @@ -46,35 +46,32 @@ import ca.uhn.fhir.jpa.entity.Search; public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc { public static final long DEFAULT_CUTOFF_SLACK = 10 * DateUtils.MILLIS_PER_SECOND; private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StaleSearchDeletingSvcImpl.class); - + private static Long ourNowForUnitTests; /* * We give a bit of extra leeway just to avoid race conditions where a query result * is being reused (because a new client request came in with the same params) right before * the result is to be deleted */ private long myCutoffSlack = DEFAULT_CUTOFF_SLACK; - @Autowired private DaoConfig myDaoConfig; - @Autowired private ISearchDao mySearchDao; - @Autowired private ISearchIncludeDao mySearchIncludeDao; - @Autowired private ISearchResultDao mySearchResultDao; - @Autowired private PlatformTransactionManager myTransactionManager; private void deleteSearch(final Long theSearchPid) { Search searchToDelete = mySearchDao.findOne(theSearchPid); - ourLog.info("Deleting search {}/{} - Created[{}] -- Last returned[{}]", searchToDelete.getId(), searchToDelete.getUuid(), searchToDelete.getCreated(), searchToDelete.getSearchLastReturned()); - mySearchIncludeDao.deleteForSearch(searchToDelete.getId()); - mySearchResultDao.deleteForSearch(searchToDelete.getId()); - mySearchDao.delete(searchToDelete); + if (searchToDelete != null) { + ourLog.info("Deleting search {}/{} - Created[{}] -- Last returned[{}]", searchToDelete.getId(), searchToDelete.getUuid(), searchToDelete.getCreated(), searchToDelete.getSearchLastReturned()); + mySearchIncludeDao.deleteForSearch(searchToDelete.getId()); + mySearchResultDao.deleteForSearch(searchToDelete.getId()); + mySearchDao.delete(searchToDelete); + } } @Override @@ -85,7 +82,7 @@ public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc { if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null) { cutoffMillis = Math.max(cutoffMillis, myDaoConfig.getReuseCachedSearchResultsForMillis()); } - final Date cutoff = new Date((System.currentTimeMillis() - cutoffMillis) - myCutoffSlack); + final Date cutoff = new Date((now() - cutoffMillis) - myCutoffSlack); ourLog.debug("Searching for searches which are before {}", cutoff); @@ -129,4 +126,19 @@ public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc { myCutoffSlack = theCutoffSlack; } + private static long now() { + if (ourNowForUnitTests != null) { + return ourNowForUnitTests; + } + return System.currentTimeMillis(); + } + + /** + * This is for unit tests only, do not call otherwise + */ + @VisibleForTesting + public static void setNowForUnitTests(Long theNowForUnitTests) { + ourNowForUnitTests = theNowForUnitTests; + } + } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java index 41b9df3e3ab..667bf38d859 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java @@ -89,7 +89,7 @@ public class SearchParamPresenceSvcImpl implements ISearchParamPresenceSvc { searchParam = new SearchParam(); searchParam.setResourceName(resourceType); searchParam.setParamName(paramName); - searchParam = mySearchParamDao.saveAndFlush(searchParam); + searchParam = mySearchParamDao.save(searchParam); ourLog.info("Added search param {} with pid {}", paramName, searchParam.getId()); // Don't add the newly saved entity to the map in case the save fails } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionInterceptor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionInterceptor.java index 3f259e6cf77..5eb63a96072 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionInterceptor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionInterceptor.java @@ -36,6 +36,7 @@ import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; import ca.uhn.fhir.rest.server.interceptor.ServerOperationInterceptorAdapter; +import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.hl7.fhir.exceptions.FHIRException; @@ -51,8 +52,12 @@ import org.springframework.messaging.MessageHandler; import org.springframework.messaging.SubscribableChannel; import org.springframework.messaging.support.ExecutorSubscribableChannel; import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.TransactionCallbackWithoutResult; import org.springframework.transaction.support.TransactionSynchronizationAdapter; import org.springframework.transaction.support.TransactionSynchronizationManager; +import org.springframework.transaction.support.TransactionTemplate; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; @@ -87,6 +92,9 @@ public abstract class BaseSubscriptionInterceptor exten @Autowired(required = false) @Qualifier("myEventDefinitionDaoR4") private IFhirResourceDao myEventDefinitionDaoR4; + @Autowired + private PlatformTransactionManager myTxManager; + /** * Constructor */ @@ -148,13 +156,11 @@ public abstract class BaseSubscriptionInterceptor exten try { from = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM); subjectTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE); - bodyTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_BODY_TEMPLATE); } catch (FHIRException theE) { throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); } retVal.getEmailDetails().setFrom(from); retVal.getEmailDetails().setSubjectTemplate(subjectTemplate); - retVal.getEmailDetails().setBodyTemplate(bodyTemplate); } } catch (FHIRException theE) { @@ -183,13 +189,11 @@ public abstract class BaseSubscriptionInterceptor exten try { from = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM); subjectTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE); - bodyTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_BODY_TEMPLATE); } catch (FHIRException theE) { throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE); } retVal.getEmailDetails().setFrom(from); retVal.getEmailDetails().setSubjectTemplate(subjectTemplate); - retVal.getEmailDetails().setBodyTemplate(bodyTemplate); } List topicExts = subscription.getExtensionsByUrl("http://hl7.org/fhir/subscription/topics"); @@ -368,6 +372,11 @@ public abstract class BaseSubscriptionInterceptor exten myResourceDaos = theResourceDaos; } + @VisibleForTesting + public void setTxManager(PlatformTransactionManager theTxManager) { + myTxManager = theTxManager; + } + @PostConstruct public void start() { for (IFhirResourceDao next : myResourceDaos) { @@ -446,13 +455,19 @@ public abstract class BaseSubscriptionInterceptor exten } if (mySubscriptionActivatingSubscriber == null) { - mySubscriptionActivatingSubscriber = new SubscriptionActivatingSubscriber(getSubscriptionDao(), getChannelType(), this); + mySubscriptionActivatingSubscriber = new SubscriptionActivatingSubscriber(getSubscriptionDao(), getChannelType(), this, myTxManager); } registerSubscriptionCheckingSubscriber(); registerDeliverySubscriber(); - initSubscriptions(); + TransactionTemplate transactionTemplate = new TransactionTemplate(myTxManager); + transactionTemplate.execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus status) { + initSubscriptions(); + } + }); } protected void submitResourceModified(final ResourceModifiedMessage theMsg) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/CanonicalSubscription.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/CanonicalSubscription.java index e04bae5f58c..28ce7c5f797 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/CanonicalSubscription.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/CanonicalSubscription.java @@ -131,10 +131,12 @@ public class CanonicalSubscription implements Serializable { return myHeaders; } - public void setHeaders(String theHeaders) { + public void setHeaders(List> theHeader) { myHeaders = new ArrayList<>(); - if (isNotBlank(theHeaders)) { - myHeaders.add(theHeaders); + for (IPrimitiveType next : theHeader) { + if (isNotBlank(next.getValueAsString())) { + myHeaders.add(next.getValueAsString()); + } } } @@ -189,12 +191,10 @@ public class CanonicalSubscription implements Serializable { } } - public void setHeaders(List> theHeader) { + public void setHeaders(String theHeaders) { myHeaders = new ArrayList<>(); - for (IPrimitiveType next : theHeader) { - if (isNotBlank(next.getValueAsString())) { - myHeaders.add(next.getValueAsString()); - } + if (isNotBlank(theHeaders)) { + myHeaders.add(theHeaders); } } @@ -212,16 +212,6 @@ public class CanonicalSubscription implements Serializable { private String myFrom; @JsonProperty("subjectTemplate") private String mySubjectTemplate; - @JsonProperty("bodyTemplate") - private String myBodyTemplate; - - public String getBodyTemplate() { - return myBodyTemplate; - } - - public void setBodyTemplate(String theBodyTemplate) { - myBodyTemplate = theBodyTemplate; - } public String getFrom() { return myFrom; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionActivatingSubscriber.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionActivatingSubscriber.java index 8a37edbb3f7..3d8d3f05bd5 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionActivatingSubscriber.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionActivatingSubscriber.java @@ -27,18 +27,21 @@ import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.hl7.fhir.r4.model.Subscription; -import org.hl7.fhir.utilities.ucum.Canonical; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.messaging.Message; import org.springframework.messaging.MessagingException; - -import java.util.concurrent.ConcurrentHashMap; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.support.TransactionCallbackWithoutResult; +import org.springframework.transaction.support.TransactionSynchronizationAdapter; +import org.springframework.transaction.support.TransactionSynchronizationManager; +import org.springframework.transaction.support.TransactionTemplate; @SuppressWarnings("unchecked") public class SubscriptionActivatingSubscriber { private final IFhirResourceDao mySubscriptionDao; private final BaseSubscriptionInterceptor mySubscriptionInterceptor; + private final PlatformTransactionManager myTransactionManager; private Logger ourLog = LoggerFactory.getLogger(SubscriptionActivatingSubscriber.class); private FhirContext myCtx; private Subscription.SubscriptionChannelType myChannelType; @@ -46,29 +49,36 @@ public class SubscriptionActivatingSubscriber { /** * Constructor */ - public SubscriptionActivatingSubscriber(IFhirResourceDao theSubscriptionDao, Subscription.SubscriptionChannelType theChannelType, BaseSubscriptionInterceptor theSubscriptionInterceptor) { + public SubscriptionActivatingSubscriber(IFhirResourceDao theSubscriptionDao, Subscription.SubscriptionChannelType theChannelType, BaseSubscriptionInterceptor theSubscriptionInterceptor, PlatformTransactionManager theTransactionManager) { mySubscriptionDao = theSubscriptionDao; mySubscriptionInterceptor = theSubscriptionInterceptor; myChannelType = theChannelType; myCtx = theSubscriptionDao.getContext(); + myTransactionManager = theTransactionManager; } - public void activateAndRegisterSubscriptionIfRequired(IBaseResource theSubscription) { + public void activateAndRegisterSubscriptionIfRequired(final IBaseResource theSubscription) { boolean subscriptionTypeApplies = BaseSubscriptionSubscriber.subscriptionTypeApplies(myCtx, theSubscription, myChannelType); if (subscriptionTypeApplies == false) { return; } - IPrimitiveType status = myCtx.newTerser().getSingleValueOrNull(theSubscription, BaseSubscriptionInterceptor.SUBSCRIPTION_STATUS, IPrimitiveType.class); + final IPrimitiveType status = myCtx.newTerser().getSingleValueOrNull(theSubscription, BaseSubscriptionInterceptor.SUBSCRIPTION_STATUS, IPrimitiveType.class); String statusString = status.getValueAsString(); - String requestedStatus = Subscription.SubscriptionStatus.REQUESTED.toCode(); - String activeStatus = Subscription.SubscriptionStatus.ACTIVE.toCode(); + final String requestedStatus = Subscription.SubscriptionStatus.REQUESTED.toCode(); + final String activeStatus = Subscription.SubscriptionStatus.ACTIVE.toCode(); if (requestedStatus.equals(statusString)) { - status.setValueAsString(activeStatus); - ourLog.info("Activating and registering subscription {} from status {} to {}", theSubscription.getIdElement().toUnqualified().getValue(), requestedStatus, activeStatus); - mySubscriptionDao.update(theSubscription); - mySubscriptionInterceptor.registerSubscription(theSubscription.getIdElement(), theSubscription); + if (TransactionSynchronizationManager.isSynchronizationActive()) { + TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() { + @Override + public void afterCommit() { + activateSubscription(status, activeStatus, theSubscription, requestedStatus); + } + }); + } else { + activateSubscription(status, activeStatus, theSubscription, requestedStatus); + } } else if (activeStatus.equals(statusString)) { if (!mySubscriptionInterceptor.hasSubscription(theSubscription.getIdElement())) { ourLog.info("Registering active subscription {}", theSubscription.getIdElement().toUnqualified().getValue()); @@ -82,8 +92,15 @@ public class SubscriptionActivatingSubscriber { } } + private void activateSubscription(IPrimitiveType theStatus, String theActiveStatus, IBaseResource theSubscription, String theRequestedStatus) { + theStatus.setValueAsString(theActiveStatus); + ourLog.info("Activating and registering subscription {} from status {} to {}", theSubscription.getIdElement().toUnqualified().getValue(), theRequestedStatus, theActiveStatus); + mySubscriptionDao.update(theSubscription); + mySubscriptionInterceptor.registerSubscription(theSubscription.getIdElement(), theSubscription); + } - public void handleMessage(RestOperationTypeEnum theOperationType, IIdType theId, IBaseResource theSubscription) throws MessagingException { + + public void handleMessage(RestOperationTypeEnum theOperationType, IIdType theId, final IBaseResource theSubscription) throws MessagingException { switch (theOperationType) { case DELETE: @@ -94,7 +111,15 @@ public class SubscriptionActivatingSubscriber { if (!theId.getResourceType().equals("Subscription")) { return; } - activateAndRegisterSubscriptionIfRequired(theSubscription); + TransactionTemplate txTemplate = new TransactionTemplate(myTransactionManager); + txTemplate.execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus status) { + activateAndRegisterSubscriptionIfRequired(theSubscription); + } + }); + break; + default: break; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailDetails.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailDetails.java index 38838cb0888..96fdeac09be 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailDetails.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailDetails.java @@ -20,6 +20,8 @@ package ca.uhn.fhir.jpa.subscription.email; * #L% */ +import org.hl7.fhir.instance.model.api.IIdType; + import java.util.List; public class EmailDetails { @@ -27,6 +29,7 @@ public class EmailDetails { private String myBodyTemplate; private List myTo; private String myFrom; + private IIdType mySubscription; public String getBodyTemplate() { return myBodyTemplate; @@ -52,6 +55,14 @@ public class EmailDetails { mySubjectTemplate = theSubjectTemplate; } + public IIdType getSubscription() { + return mySubscription; + } + + public void setSubscription(IIdType theSubscription) { + mySubscription = theSubscription; + } + public List getTo() { return myTo; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailSender.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSender.java similarity index 56% rename from hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailSender.java rename to hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSender.java index c0f8938ef18..503109ca1ff 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailSender.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSender.java @@ -22,11 +22,11 @@ package ca.uhn.fhir.jpa.subscription.email; import ca.uhn.fhir.jpa.util.StopWatch; import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.mail.SimpleMailMessage; -import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSenderImpl; import org.thymeleaf.context.Context; import org.thymeleaf.spring4.SpringTemplateEngine; @@ -35,6 +35,9 @@ import org.thymeleaf.templatemode.TemplateMode; import org.thymeleaf.templateresolver.StringTemplateResolver; import javax.annotation.PostConstruct; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -42,26 +45,57 @@ import java.util.List; import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.trim; -public class EmailSender implements IEmailSender { +public class JavaMailEmailSender implements IEmailSender { - private static final Logger ourLog = LoggerFactory.getLogger(EmailSender.class); - private String mySmtpServerHost; + private static final Logger ourLog = LoggerFactory.getLogger(JavaMailEmailSender.class); + private String mySmtpServerHostname; private int mySmtpServerPort = 25; private JavaMailSenderImpl mySender; + private String mySmtpServerUsername; + private String mySmtpServerPassword; - @PostConstruct - public void start() { - Validate.notBlank(mySmtpServerHost, "No SMTP host defined"); + public String getSmtpServerHostname() { + return mySmtpServerHostname; + } - mySender = new JavaMailSenderImpl(); - mySender.setHost(mySmtpServerHost); - mySender.setPort(mySmtpServerPort); - mySender.setDefaultEncoding(Constants.CHARSET_UTF8.name()); + /** + * Set the SMTP server host to use for outbound mail + */ + public void setSmtpServerHostname(String theSmtpServerHostname) { + mySmtpServerHostname = theSmtpServerHostname; + } + + public String getSmtpServerPassword() { + return mySmtpServerPassword; + } + + public void setSmtpServerPassword(String theSmtpServerPassword) { + mySmtpServerPassword = theSmtpServerPassword; + } + + public int getSmtpServerPort() { + return mySmtpServerPort; + } + + /** + * Set the SMTP server port to use for outbound mail + */ + public void setSmtpServerPort(int theSmtpServerPort) { + mySmtpServerPort = theSmtpServerPort; + } + + public String getSmtpServerUsername() { + return mySmtpServerUsername; + } + + public void setSmtpServerUsername(String theSmtpServerUsername) { + mySmtpServerUsername = theSmtpServerUsername; } @Override public void send(EmailDetails theDetails) { - ourLog.info("Sending email to recipients: {}", theDetails.getTo()); + String subscriptionId = theDetails.getSubscription().toUnqualifiedVersionless().getValue(); + ourLog.info("Sending email for subscription {} to recipients: {}", subscriptionId, theDetails.getTo()); StopWatch sw = new StopWatch(); StringTemplateResolver templateResolver = new StringTemplateResolver(); @@ -80,39 +114,44 @@ public class EmailSender implements IEmailSender { String body = engine.process(theDetails.getBodyTemplate(), context); String subject = engine.process(theDetails.getSubjectTemplate(), context); - SimpleMailMessage email = new SimpleMailMessage(); - email.setFrom(trim(theDetails.getFrom())); - email.setTo(toTrimmedStringArray(theDetails.getTo())); - email.setSubject(subject); - email.setText(body); - email.setSentDate(new Date()); + MimeMessage email = mySender.createMimeMessage(); + + try { + email.setFrom(trim(theDetails.getFrom())); + email.setRecipients(Message.RecipientType.TO, toTrimmedCommaSeparatedString(theDetails.getTo())); + email.setSubject(subject); + email.setText(body); + email.setSentDate(new Date()); + email.addHeader("X-FHIR-Subscription", subscriptionId); + } catch (MessagingException e) { + throw new InternalErrorException("Failed to create email messaage", e); + } mySender.send(email); ourLog.info("Done sending email (took {}ms)", sw.getMillis()); } - /** - * Set the SMTP server host to use for outbound mail - */ - public void setSmtpServerHost(String theSmtpServerHost) { - mySmtpServerHost = theSmtpServerHost; + @PostConstruct + public void start() { + Validate.notBlank(mySmtpServerHostname, "No SMTP host defined"); + + mySender = new JavaMailSenderImpl(); + mySender.setHost(getSmtpServerHostname()); + mySender.setPort(getSmtpServerPort()); + mySender.setUsername(getSmtpServerUsername()); + mySender.setPassword(getSmtpServerPassword()); + mySender.setDefaultEncoding(Constants.CHARSET_UTF8.name()); } - /** - * Set the SMTP server port to use for outbound mail - */ - public void setSmtpServerPort(int theSmtpServerPort) { - mySmtpServerPort = theSmtpServerPort; - } - - private static String[] toTrimmedStringArray(List theTo) { + private static String toTrimmedCommaSeparatedString(List theTo) { List to = new ArrayList<>(); for (String next : theTo) { if (isNotBlank(next)) { to.add(next); } } - return to.toArray(new String[to.size()]); + + return StringUtils.join(to, ","); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionDeliveringEmailSubscriber.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionDeliveringEmailSubscriber.java index 851e3e9a541..755561a422c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionDeliveringEmailSubscriber.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionDeliveringEmailSubscriber.java @@ -54,32 +54,29 @@ public class SubscriptionDeliveringEmailSubscriber extends BaseSubscriptionDeliv List destinationAddresses = new ArrayList<>(); String[] destinationAddressStrings = StringUtils.split(endpointUrl, ","); for (String next : destinationAddressStrings) { + next = trim(defaultString(next)); + if (next.startsWith("mailto:")) { + next = next.substring("mailto:".length()); + } if (isNotBlank(next)) { - destinationAddresses.add(trim(next)); + destinationAddresses.add(next); } } - String from = defaultString(subscription.getEmailDetails().getFrom(), provideDefaultFrom()); + String from = defaultString(subscription.getEmailDetails().getFrom(), mySubscriptionEmailInterceptor.getDefaultFromAddress()); String subjectTemplate = defaultString(subscription.getEmailDetails().getSubjectTemplate(), provideDefaultSubjectTemplate()); - String bodyTemplate = defaultString(subscription.getEmailDetails().getBodyTemplate(), provideDefaultBodyTemplate()); EmailDetails details = new EmailDetails(); details.setTo(destinationAddresses); details.setFrom(from); - details.setBodyTemplate(bodyTemplate); + details.setBodyTemplate(subscription.getPayloadString()); details.setSubjectTemplate(subjectTemplate); + details.setSubscription(subscription.getIdElement(getContext())); IEmailSender emailSender = mySubscriptionEmailInterceptor.getEmailSender(); emailSender.send(details); } - private String provideDefaultBodyTemplate() { - return "A subscription update has been received"; - } - - private String provideDefaultFrom() { - return "unknown@sender.com"; - } private String provideDefaultSubjectTemplate() { return "HAPI FHIR Subscriptions"; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionEmailInterceptor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionEmailInterceptor.java index 21fc67a5d1a..862131885e3 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionEmailInterceptor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionEmailInterceptor.java @@ -20,28 +20,51 @@ package ca.uhn.fhir.jpa.subscription.email; * #L% */ -import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.subscription.BaseSubscriptionInterceptor; import org.apache.commons.lang3.Validate; -import org.springframework.beans.factory.annotation.Required; +import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.PostConstruct; -import java.util.List; public class SubscriptionEmailInterceptor extends BaseSubscriptionInterceptor { private SubscriptionDeliveringEmailSubscriber mySubscriptionDeliverySubscriber; + + /** + * This is set to autowired=false just so that implementors can supply this + * with a mechanism other than autowiring if they want + */ + @Autowired(required = false) private IEmailSender myEmailSender; + private String myDefaultFromAddress = "noreply@unknown.com"; @Override public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType getChannelType() { return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL; } + /** + * The "from" address to use for any sent emails that to not explicitly specity a from address + */ + public String getDefaultFromAddress() { + return myDefaultFromAddress; + } + + /** + * The "from" address to use for any sent emails that to not explicitly specity a from address + */ + public void setDefaultFromAddress(String theDefaultFromAddress) { + Validate.notBlank(theDefaultFromAddress, "theDefaultFromAddress must not be null or blank"); + myDefaultFromAddress = theDefaultFromAddress; + } + public IEmailSender getEmailSender() { return myEmailSender; } - @Required + /** + * Set the email sender (this method does not need to be explicitly called if you + * are using autowiring to supply the sender) + */ public void setEmailSender(IEmailSender theEmailSender) { myEmailSender = theEmailSender; } @@ -54,12 +77,12 @@ public class SubscriptionEmailInterceptor extends BaseSubscriptionInterceptor { getDeliveryChannel().subscribe(mySubscriptionDeliverySubscriber); } - @PostConstruct - public void start() { - Validate.notNull(myEmailSender, "emailSender has not been configured"); - - super.start(); - } +// @PostConstruct +// public void start() { +// Validate.notNull(myEmailSender, "emailSender has not been configured"); +// +// super.start(); +// } @Override protected void unregisterDeliverySubscriber() { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/JpaConstants.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/JpaConstants.java index 92ca5966565..5eb02eae95a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/JpaConstants.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/JpaConstants.java @@ -24,8 +24,20 @@ public class JpaConstants { public static final String EXT_SP_UNIQUE = "http://hapifhir.io/fhir/StructureDefinition/sp-unique"; + /** + *

+ * This extension should be of type string and should be + * placed on the Subscription.channel element + *

+ */ public static final String EXT_SUBSCRIPTION_EMAIL_FROM = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-from"; + + /** + *

+ * This extension should be of type string and should be + * placed on the Subscription.channel element + *

+ */ public static final String EXT_SUBSCRIPTION_SUBJECT_TEMPLATE = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-subject-template"; - public static final String EXT_SUBSCRIPTION_BODY_TEMPLATE = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-body-template"; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/SubscriptionsRequireManualActivationInterceptorDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/SubscriptionsRequireManualActivationInterceptorDstu2.java index 61d128fd36e..f4ebde30368 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/SubscriptionsRequireManualActivationInterceptorDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/SubscriptionsRequireManualActivationInterceptorDstu2.java @@ -42,7 +42,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; public class SubscriptionsRequireManualActivationInterceptorDstu2 extends ServerOperationInterceptorAdapter { @Autowired - @Qualifier("mySubscriptionDaoR4") + @Qualifier("mySubscriptionDaoDstu2") private IFhirResourceDao myDao; @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/TestUtil.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/TestUtil.java index feabf163417..b9d35c68020 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/TestUtil.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/TestUtil.java @@ -130,4 +130,19 @@ public class TestUtil { } } + public static void sleepAtLeast(int theMillis) { + long start = System.currentTimeMillis(); + while (System.currentTimeMillis() <= start + theMillis) { + try { + long timeSinceStarted = System.currentTimeMillis() - start; + long timeToSleep = Math.max(0, theMillis - timeSinceStarted); + ourLog.info("Sleeping for {}ms", timeToSleep); + Thread.sleep(timeToSleep); + } catch (InterruptedException theE) { + theE.printStackTrace(); + } + } + } + + } diff --git a/hapi-fhir-jpaserver-base/src/main/resources/.keep b/hapi-fhir-jpaserver-base/src/main/resources/.keep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ConnectionWrapper.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ConnectionWrapper.java index fe5fc0c9515..cd9fc5b444d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ConnectionWrapper.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ConnectionWrapper.java @@ -97,7 +97,7 @@ public class ConnectionWrapper implements Connection { @Override public String getClientInfo(String theName) throws SQLException { - return getClientInfo(theName); + return myWrap.getClientInfo(theName); } @Override diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java index 970cbdc37fd..baa0a217359 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java @@ -1,26 +1,29 @@ package ca.uhn.fhir.jpa.config; +import ca.uhn.fhir.jpa.dao.DaoConfig; +import ca.uhn.fhir.jpa.subscription.email.IEmailSender; +import ca.uhn.fhir.jpa.subscription.email.JavaMailEmailSender; +import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; +import ca.uhn.fhir.validation.ResultSeverityEnum; +import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; +import org.apache.commons.dbcp2.BasicDataSource; +import org.hibernate.jpa.HibernatePersistenceProvider; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.context.annotation.Primary; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; import java.util.Properties; import java.util.concurrent.TimeUnit; -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; - -import org.apache.commons.dbcp2.BasicDataSource; -import org.hibernate.jpa.HibernatePersistenceProvider; -import org.springframework.context.annotation.*; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import ca.uhn.fhir.jpa.dao.DaoConfig; -import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; -import ca.uhn.fhir.validation.ResultSeverityEnum; -import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder; - -import static org.junit.Assert.fail; +import static org.junit.Assert.*; @Configuration @EnableTransactionManagement() @@ -30,12 +33,7 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 { private Exception myLastStackTrace; @Bean() - public DaoConfig daoConfig() { - return new DaoConfig(); - } - - @Bean() - public DataSource dataSource() { + public BasicDataSource basicDataSource() { BasicDataSource retVal = new BasicDataSource() { @@ -48,36 +46,36 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 { ourLog.error("Exceeded maximum wait for connection", e); logGetConnectionStackTrace(); // if ("true".equals(System.getProperty("ci"))) { - fail("Exceeded maximum wait for connection: "+ e.toString()); + fail("Exceeded maximum wait for connection: " + e.toString()); // } // System.exit(1); retVal = null; } - + try { throw new Exception(); } catch (Exception e) { myLastStackTrace = e; } - + return retVal; } private void logGetConnectionStackTrace() { - StringBuilder b = new StringBuilder(); - b.append("Last connection request stack trace:"); - for (StackTraceElement next : myLastStackTrace.getStackTrace()) { - b.append("\n "); - b.append(next.getClassName()); - b.append("."); - b.append(next.getMethodName()); - b.append("("); - b.append(next.getFileName()); - b.append(":"); - b.append(next.getLineNumber()); - b.append(")"); - } - ourLog.info(b.toString()); + StringBuilder b = new StringBuilder(); + b.append("Last connection request stack trace:"); + for (StackTraceElement next : myLastStackTrace.getStackTrace()) { + b.append("\n "); + b.append(next.getClassName()); + b.append("."); + b.append(next.getMethodName()); + b.append("("); + b.append(next.getFileName()); + b.append(":"); + b.append(next.getLineNumber()); + b.append(")"); + } + ourLog.info(b.toString()); } }; @@ -92,19 +90,39 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 { * and catch any potential deadlocks caused by database connection * starvation */ - int maxThreads = (int) (Math.random() * 6) + 1; + int maxThreads = (int) (Math.random() * 6.0) + 1; retVal.setMaxTotal(maxThreads); + return retVal; + } + + @Bean() + public DaoConfig daoConfig() { + return new DaoConfig(); + } + + @Bean() + @Primary() + public DataSource dataSource() { + DataSource dataSource = ProxyDataSourceBuilder - .create(retVal) - // .logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL") - .logSlowQueryBySlf4j(100, TimeUnit.MILLISECONDS) - .countQuery() - .build(); + .create(basicDataSource()) +// .logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL") + .logSlowQueryBySlf4j(1000, TimeUnit.MILLISECONDS) + .countQuery() + .build(); return dataSource; } + @Bean + public IEmailSender emailSender() { + JavaMailEmailSender retVal = new JavaMailEmailSender(); + retVal.setSmtpServerHostname("localhost"); + retVal.setSmtpServerPort(3025); + return retVal; + } + @Bean() public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java index 8794a67ebd8..82b78e27799 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java @@ -94,12 +94,12 @@ public class TestR4Config extends BaseJavaConfigR4 { * and catch any potential deadlocks caused by database connection * starvation */ - int maxThreads = (int) (Math.random() * 6) + 1; + int maxThreads = (int) (Math.random() * 6.0) + 1; retVal.setMaxTotal(maxThreads); DataSource dataSource = ProxyDataSourceBuilder .create(retVal) - .logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL") +// .logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL") .logSlowQueryBySlf4j(10, TimeUnit.SECONDS) .countQuery(new ThreadQueryCountHolder()) .build(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java index 2fd5b5fe8b1..468845de9a4 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java @@ -118,8 +118,13 @@ public abstract class BaseJpaTest { protected List toUnqualifiedVersionlessIdValues(IBundleProvider theFound) { List retVal = new ArrayList(); - int size = theFound.size(); + Integer size = theFound.size(); ourLog.info("Found {} results", size); + + if (size == null) { + size = 99999; + } + List resources = theFound.getResources(0, size); for (IBaseResource next : resources) { retVal.add(next.getIdElement().toUnqualifiedVersionless().getValue()); @@ -298,7 +303,7 @@ public abstract class BaseJpaTest { public static void waitForSize(int theTarget, List theList) { StopWatch sw = new StopWatch(); - while (theList.size() != theTarget && sw.getMillis() < 10000) { + while (theList.size() != theTarget && sw.getMillis() <= 15000) { try { Thread.sleep(50); } catch (InterruptedException theE) { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java index a10ddb03513..a1d35f4b229 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java @@ -120,7 +120,7 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest { protected Object myResourceProviders; @Autowired protected ISearchCoordinatorSvc mySearchCoordinatorSvc; - @Autowired + @Autowired(required = false) protected IFulltextSearchSvc mySearchDao; @Autowired protected ISearchParamPresenceSvc mySearchParamPresenceSvc; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java index f0cc7d84364..cadec9a7a90 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java @@ -921,7 +921,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test { List patients = toList(myPatientDao.search(params)); assertEquals(1, patients.size()); assertEquals(id1.getIdPart(), patients.get(0).getId().getIdPart()); - assertEquals("P1TITLE", ResourceMetadataKeyEnum.TITLE.get(patients.get(0))); // Given name shouldn't return for family param params = new SearchParameterMap(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java index c03923110a2..1c3a5d470fc 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java @@ -56,6 +56,30 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical()); } + /** + * See #773 + */ + @Test + public void testDeleteResourceWithOutboundDeletedResources() { + myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + + Organization org = new Organization(); + org.setId("ORG"); + org.setName("ORG"); + myOrganizationDao.update(org); + + Patient pat = new Patient(); + pat.setId("PAT"); + pat.setActive(true); + pat.setManagingOrganization(new ResourceReferenceDt("Organization/ORG")); + myPatientDao.update(pat); + + myOrganizationDao.delete(new IdDt("Organization/ORG")); + + myPatientDao.delete(new IdDt("Patient/PAT")); + } + + private void assertGone(IIdType theId) { try { assertNotGone(theId); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java index 76ffd1441f2..0c1e762798b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java @@ -102,6 +102,7 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test { } catch (PreconditionFailedException e) { return (OperationOutcome) e.getOperationOutcome(); } + break; case XML: encoded = myFhirCtx.newXmlParser().encodeResourceToString(input); try { @@ -110,6 +111,7 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test { } catch (PreconditionFailedException e) { return (OperationOutcome) e.getOperationOutcome(); } + break; } throw new IllegalStateException(); // shouldn't get here diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java index 1685a1c1d7f..8589e535e44 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java @@ -172,7 +172,7 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { protected IResourceTagDao myResourceTagDao; @Autowired protected ISearchCoordinatorSvc mySearchCoordinatorSvc; - @Autowired + @Autowired(required = false) protected IFulltextSearchSvc mySearchDao; @Autowired protected ISearchDao mySearchEntityDao; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirDaoConcurrencyDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirDaoConcurrencyDstu3Test.java new file mode 100644 index 00000000000..d6c27cb0334 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirDaoConcurrencyDstu3Test.java @@ -0,0 +1,153 @@ +package ca.uhn.fhir.jpa.dao.dstu3; + +import ca.uhn.fhir.jpa.dao.DaoConfig; +import ca.uhn.fhir.jpa.util.StopWatch; +import ca.uhn.fhir.rest.api.server.IBundleProvider; +import ca.uhn.fhir.util.TestUtil; +import com.phloc.commons.compare.ReverseComparator; +import org.apache.commons.dbcp2.BasicDataSource; +import org.hl7.fhir.dstu3.model.Bundle; +import org.hl7.fhir.dstu3.model.Bundle.BundleType; +import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.Organization; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.comparator.ComparableComparator; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.concurrent.Future; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.junit.Assert.*; + +public class FhirDaoConcurrencyDstu3Test extends BaseJpaDstu3SystemTest { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirDaoConcurrencyDstu3Test.class); + + @Autowired + public BasicDataSource myBasicDataSource; + private int myMaxTotal; + + @After + public void afterResetConnectionPool() { + myBasicDataSource.setMaxTotal(myMaxTotal); + } + + @Before + public void beforeSetUpConnectionPool() { + myMaxTotal = myBasicDataSource.getMaxTotal(); + myBasicDataSource.setMaxTotal(5); + } + + @Test + public void testMultipleConcurrentWritesToSameResource() throws InterruptedException { + + ThreadPoolExecutor exec = new ThreadPoolExecutor(10, 10, + 0L, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue()); + + final AtomicInteger errors = new AtomicInteger(); + + List futures = new ArrayList<>(); + for (int i = 0; i < 50; i++) { + final Patient p = new Patient(); + p.setId("PID"); + p.setActive(true); + p.setBirthDate(new Date()); + p.addIdentifier().setSystem("foo1"); + p.addIdentifier().setSystem("foo2"); + p.addIdentifier().setSystem("foo3"); + p.addIdentifier().setSystem("foo4"); + p.addName().setFamily("FOO" + i); + p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB1"); + p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB2"); + p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB3"); + p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB4"); + p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB5"); + p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB6"); + + Organization o = new Organization(); + o.setName("ORG" + i); + + final Bundle t = new Bundle(); + t.setType(BundleType.TRANSACTION); + t.addEntry() + .setResource(p) + .getRequest() + .setUrl("Patient/PID") + .setMethod(HTTPVerb.PUT); + t.addEntry() + .setResource(o) + .getRequest() + .setUrl("Organization") + .setMethod(HTTPVerb.POST); + + if (i == 0) { + mySystemDao.transaction(mySrd, t); + } + futures.add(exec.submit(new Runnable() { + @Override + public void run() { + try { + mySystemDao.transaction(mySrd, t); + } catch (Exception e) { + ourLog.error("Failed to update", e); + errors.incrementAndGet(); + } + } + })); + } + + ourLog.info("Shutting down excutor"); + StopWatch sw = new StopWatch(); + for (Future next : futures) { + while (!next.isDone()) { + Thread.sleep(20); + } + } + exec.shutdown(); + ourLog.info("Shut down excutor in {}ms", sw.getMillis()); + ourLog.info("Had {} errors", errors.get()); + + Patient currentPatient = myPatientDao.read(new IdType("Patient/PID")); + Long currentVersion = currentPatient.getIdElement().getVersionIdPartAsLong(); + ourLog.info("Current version: {}", currentVersion); + + IBundleProvider historyBundle = myPatientDao.history(new IdType("Patient/PID"),null,null,mySrd); + List resources = historyBundle.getResources(0, 1000); + List versions = new ArrayList<>(); + for (IBaseResource next : resources) { + versions.add(next.getIdElement().getVersionIdPartAsLong()); + } + + String message = "Current version is " + currentVersion + " - History is: " + versions; + ourLog.info(message); + + Collections.sort(versions, new ReverseComparator<>(new ComparableComparator())); + Long lastVersion = versions.get(0); + ourLog.info("Last version: {}", lastVersion); + + //assertEquals(message, currentVersion.intValue(), versions.size()); + assertEquals(message, currentVersion, lastVersion); + + } + + + @AfterClass + public static void afterClassClearContext() { + TestUtil.clearAllStaticFieldsForUnitTest(); + } + +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchPageExpiryTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchPageExpiryTest.java index c6a6247d36b..ea2fd0c1158 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchPageExpiryTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchPageExpiryTest.java @@ -1,12 +1,16 @@ package ca.uhn.fhir.jpa.dao.dstu3; +import static ca.uhn.fhir.jpa.util.TestUtil.sleepAtLeast; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.junit.Assert.*; +import ca.uhn.fhir.jpa.util.StopWatch; import org.apache.commons.lang3.Validate; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.test.util.AopTestUtils; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionCallbackWithoutResult; @@ -18,15 +22,13 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.StringParam; public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test { - @Before - public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - } + private static final Logger ourLog = LoggerFactory.getLogger(FhirResourceDaoDstu3SearchPageExpiryTest.class); @After() public void after() { StaleSearchDeletingSvcImpl staleSearchDeletingSvc = AopTestUtils.getTargetObject(myStaleSearchDeletingSvc); staleSearchDeletingSvc.setCutoffSlackForUnitTest(StaleSearchDeletingSvcImpl.DEFAULT_CUTOFF_SLACK); + StaleSearchDeletingSvcImpl.setNowForUnitTests(null); } @Before @@ -35,48 +37,9 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test { staleSearchDeletingSvc.setCutoffSlackForUnitTest(0); } - @Test - public void testExpirePagesAfterSingleUse() throws Exception { - IIdType pid1; - IIdType pid2; - { - Patient patient = new Patient(); - patient.addName().setFamily("EXPIRE"); - pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - Thread.sleep(10); - { - Patient patient = new Patient(); - patient.addName().setFamily("EXPIRE"); - pid2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - Thread.sleep(10); - - SearchParameterMap params; - params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("EXPIRE")); - final IBundleProvider bundleProvider = myPatientDao.search(params); - assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2)); - assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2)); - - myDaoConfig.setExpireSearchResultsAfterMillis(500); - myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); - TransactionTemplate txTemplate = new TransactionTemplate(myTxManager); - txTemplate.execute(new TransactionCallbackWithoutResult() { - @Override - protected void doInTransactionWithoutResult(TransactionStatus theArg0) { - assertNotNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid())); - } - }); - - Thread.sleep(750); - myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); - txTemplate.execute(new TransactionCallbackWithoutResult() { - @Override - protected void doInTransactionWithoutResult(TransactionStatus theArg0) { - assertNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid())); - } - }); + @Before + public void beforeDisableResultReuse() { + myDaoConfig.setReuseCachedSearchResultsForMillis(null); } @Test @@ -98,6 +61,7 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test { myDaoConfig.setExpireSearchResultsAfterMillis(1000L); myDaoConfig.setReuseCachedSearchResultsForMillis(500L); + long start = System.currentTimeMillis(); final String searchUuid1; { @@ -109,7 +73,7 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test { Validate.notBlank(searchUuid1); } - Thread.sleep(250); + sleepAtLeast(250); String searchUuid2; { @@ -122,7 +86,7 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test { } assertEquals(searchUuid1, searchUuid2); - Thread.sleep(500); + sleepAtLeast(500); // We're now past 500ms so we shouldn't reuse the search @@ -139,18 +103,31 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test { // Search just got used so it shouldn't be deleted - Thread.sleep(750); + myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); + newTxTemplate().execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus theArg0) { + assertNotNull(mySearchEntityDao.findByUuid(searchUuid3)); + } + }); + + StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 1400); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); newTxTemplate().execute(new TransactionCallbackWithoutResult() { @Override protected void doInTransactionWithoutResult(TransactionStatus theArg0) { - assertNull(mySearchEntityDao.findByUuid(searchUuid1)); assertNotNull(mySearchEntityDao.findByUuid(searchUuid3)); } }); + newTxTemplate().execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus theArg0) { + assertNull(mySearchEntityDao.findByUuid(searchUuid1)); + } + }); - Thread.sleep(300); + StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 2200); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); newTxTemplate().execute(new TransactionCallbackWithoutResult() { @@ -162,4 +139,63 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test { }); } + + @Test + public void testExpirePagesAfterSingleUse() throws Exception { + IIdType pid1; + IIdType pid2; + { + Patient patient = new Patient(); + patient.addName().setFamily("EXPIRE"); + pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); + } + Thread.sleep(10); + { + Patient patient = new Patient(); + patient.addName().setFamily("EXPIRE"); + pid2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); + } + Thread.sleep(10); + + final StopWatch sw = new StopWatch(); + + long start = System.currentTimeMillis(); + + SearchParameterMap params; + params = new SearchParameterMap(); + params.add(Patient.SP_FAMILY, new StringParam("EXPIRE")); + final IBundleProvider bundleProvider = myPatientDao.search(params); + assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2)); + assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2)); + + myDaoConfig.setExpireSearchResultsAfterMillis(500); + StaleSearchDeletingSvcImpl.setNowForUnitTests(start); + + myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); + TransactionTemplate txTemplate = new TransactionTemplate(myTxManager); + txTemplate.execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus theArg0) { + assertNotNull("Failed after " + sw.toString(), mySearchEntityDao.findByUuid(bundleProvider.getUuid())); + } + }); + + StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 499); + myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); + txTemplate.execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus theArg0) { + assertNotNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid())); + } + }); + + StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 600); + myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); + txTemplate.execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus theArg0) { + assertNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid())); + } + }); + } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java index b243e95755d..3971b902474 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java @@ -252,6 +252,7 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test { p.setId("Patient/A"); String id = myPatientDao.update(p).getId().getValue(); assertThat(id, endsWith("Patient/A/_history/1")); + assertEquals("1", myPatientDao.read(new IdType("Patient/A")).getIdElement().getVersionIdPart()); // Second time should not result in an update p = new Patient(); @@ -259,6 +260,7 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test { p.setId("Patient/A"); id = myPatientDao.update(p).getId().getValue(); assertThat(id, endsWith("Patient/A/_history/1")); + assertEquals("1", myPatientDao.read(new IdType("Patient/A")).getIdElement().getVersionIdPart()); // And third time should not result in an update p = new Patient(); @@ -266,6 +268,7 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test { p.setId("Patient/A"); id = myPatientDao.update(p).getId().getValue(); assertThat(id, endsWith("Patient/A/_history/1")); + assertEquals("1", myPatientDao.read(new IdType("Patient/A")).getIdElement().getVersionIdPart()); myPatientDao.read(new IdType("Patient/A")); myPatientDao.read(new IdType("Patient/A/_history/1")); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValidateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValidateTest.java index 47582dada07..3442f7cc87d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValidateTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValidateTest.java @@ -133,6 +133,7 @@ public class FhirResourceDaoDstu3ValidateTest extends BaseJpaDstu3Test { } catch (PreconditionFailedException e) { return (OperationOutcome) e.getOperationOutcome(); } + break; case XML: encoded = myFhirCtx.newXmlParser().encodeResourceToString(input); try { @@ -141,6 +142,7 @@ public class FhirResourceDaoDstu3ValidateTest extends BaseJpaDstu3Test { } catch (PreconditionFailedException e) { return (OperationOutcome) e.getOperationOutcome(); } + break; } throw new IllegalStateException(); // shouldn't get here diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java index 681cbbf9e4c..42cd0ea6625 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java @@ -62,43 +62,6 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { myDaoConfig.setReuseCachedSearchResultsForMillis(null); } - @Test - public void testTransactionWhichFailsPersistsNothing() { - - // Run a transaction which points to that practitioner - // in a field that isn't allowed to refer to a practitioner - Bundle input = new Bundle(); - input.setType(BundleType.TRANSACTION); - - Patient pt = new Patient(); - pt.setId("PT"); - pt.setActive(true); - pt.addName().setFamily("FAMILY"); - input.addEntry() - .setResource(pt) - .getRequest().setMethod(HTTPVerb.PUT).setUrl("Patient/PT"); - - Observation obs = new Observation(); - obs.setId("OBS"); - obs.getCode().addCoding().setSystem("foo").setCode("bar"); - obs.addPerformer().setReference("Practicioner/AAAAA"); - input.addEntry() - .setResource(obs) - .getRequest().setMethod(HTTPVerb.PUT).setUrl("Observation/OBS"); - - try { - mySystemDao.transaction(mySrd, input); - fail(); - } catch (UnprocessableEntityException e) { - assertThat(e.getMessage(), containsString("Resource type 'Practicioner' is not valid for this path")); - } - - assertThat(myResourceTableDao.findAll(), empty()); - assertThat(myResourceIndexedSearchParamStringDao.findAll(), empty()); - - } - - private Bundle createInputTransactionWithPlaceholderIdInMatchUrl(HTTPVerb theVerb) { Patient pat = new Patient(); @@ -209,6 +172,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { return null; } + private Bundle loadBundle(String theFileName) throws IOException { + String req = IOUtils.toString(FhirSystemDaoDstu3Test.class.getResourceAsStream(theFileName), StandardCharsets.UTF_8); + return myFhirCtx.newXmlParser().parseResource(Bundle.class, req); + } + @Test public void testBatchCreateWithBadRead() { Bundle request = new Bundle(); @@ -1222,8 +1190,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { @Test public void testTransactionCreateWithPutUsingUrl2() throws Exception { - String req = IOUtils.toString(FhirSystemDaoDstu3Test.class.getResourceAsStream("/bundle-dstu3.xml"), StandardCharsets.UTF_8); - Bundle request = myFhirCtx.newXmlParser().parseResource(Bundle.class, req); + Bundle request = loadBundle("/bundle-dstu3.xml"); mySystemDao.transaction(mySrd, request); } @@ -1702,13 +1669,13 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { //@formatter:off /* * Transaction Order, per the spec: - * + * * Process any DELETE interactions * Process any POST interactions * Process any PUT interactions * Process any GET interactions - * - * This test creates a transaction bundle that includes + * + * This test creates a transaction bundle that includes * these four operations in the reverse order and verifies * that they are invoked correctly. */ @@ -1912,6 +1879,91 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { assertNull(nextEntry.getResource()); } + @Test + public void testTransactionWithIfMatch() { + Patient p = new Patient(); + p.setId("P1"); + p.setActive(true); + myPatientDao.update(p); + + p.setActive(false); + Bundle b = new Bundle(); + b.setType(BundleType.TRANSACTION); + b.addEntry() + .setFullUrl("Patient/P1") + .setResource(p) + .getRequest() + .setMethod(HTTPVerb.PUT) + .setUrl("Patient/P1") + .setIfMatch("2"); + + try { + mySystemDao.transaction(mySrd, b); + } catch (ResourceVersionConflictException e) { + assertEquals("Trying to update Patient/P1/_history/2 but this is not the current version", e.getMessage()); + } + + b = new Bundle(); + b.setType(BundleType.TRANSACTION); + b.addEntry() + .setFullUrl("Patient/P1") + .setResource(p) + .getRequest() + .setMethod(HTTPVerb.PUT) + .setUrl("Patient/P1") + .setIfMatch("1"); + + Bundle resp = mySystemDao.transaction(mySrd, b); + assertEquals("Patient/P1/_history/2", new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue()); + + + } + + @Test + public void testTransactionWithIfNoneExist() { + Patient p = new Patient(); + p.setId("P1"); + p.setActive(true); + myPatientDao.update(p); + + p = new Patient(); + p.setActive(true); + p.addName().setFamily("AAA"); + + Bundle b = new Bundle(); + b.setType(BundleType.TRANSACTION); + b.addEntry() + .setFullUrl("Patient") + .setResource(p) + .getRequest() + .setMethod(HTTPVerb.POST) + .setUrl("Patient/P1") + .setIfNoneExist("Patient?active=true"); + + Bundle resp = mySystemDao.transaction(mySrd, b); + assertEquals("Patient/P1/_history/1", new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue()); + + p = new Patient(); + p.setActive(true); + p.addName().setFamily("AAA"); + + b = new Bundle(); + b.setType(BundleType.TRANSACTION); + b.addEntry() + .setFullUrl("Patient") + .setResource(p) + .getRequest() + .setMethod(HTTPVerb.POST) + .setUrl("Patient/P1") + .setIfNoneExist("Patient?active=false"); + + resp = mySystemDao.transaction(mySrd, b); + assertThat( new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue(), matchesPattern("Patient/[0-9]+/_history/1")); + + + } + + @Test public void testTransactionSearchWithCount() { String methodName = "testTransactionSearchWithCount"; @@ -2147,6 +2199,42 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { } } + @Test + public void testTransactionWhichFailsPersistsNothing() { + + // Run a transaction which points to that practitioner + // in a field that isn't allowed to refer to a practitioner + Bundle input = new Bundle(); + input.setType(BundleType.TRANSACTION); + + Patient pt = new Patient(); + pt.setId("PT"); + pt.setActive(true); + pt.addName().setFamily("FAMILY"); + input.addEntry() + .setResource(pt) + .getRequest().setMethod(HTTPVerb.PUT).setUrl("Patient/PT"); + + Observation obs = new Observation(); + obs.setId("OBS"); + obs.getCode().addCoding().setSystem("foo").setCode("bar"); + obs.addPerformer().setReference("Practicioner/AAAAA"); + input.addEntry() + .setResource(obs) + .getRequest().setMethod(HTTPVerb.PUT).setUrl("Observation/OBS"); + + try { + mySystemDao.transaction(mySrd, input); + fail(); + } catch (UnprocessableEntityException e) { + assertThat(e.getMessage(), containsString("Resource type 'Practicioner' is not valid for this path")); + } + + assertThat(myResourceTableDao.findAll(), empty()); + assertThat(myResourceIndexedSearchParamStringDao.findAll(), empty()); + + } + /** * Format changed, source isn't valid */ @@ -2492,7 +2580,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { IdType medOrderId1 = new IdType(outcome.getEntry().get(1).getResponse().getLocation()); /* - * Again! + * Again! */ bundle = new Bundle(); @@ -2815,6 +2903,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { } + @AfterClass public static void afterClassClearContext() { TestUtil.clearAllStaticFieldsForUnitTest(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java index aa0be15706b..e2bccd223a3 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java @@ -181,7 +181,7 @@ public abstract class BaseJpaR4Test extends BaseJpaTest { protected IResourceTagDao myResourceTagDao; @Autowired protected ISearchCoordinatorSvc mySearchCoordinatorSvc; - @Autowired + @Autowired(required = false) protected IFulltextSearchSvc mySearchDao; @Autowired protected ISearchDao mySearchEntityDao; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java index 42819bb0345..24d1ce80b8a 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java @@ -44,11 +44,92 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoR4SearchNoFtTest.class); @Before - public void beforeDisableResultReuse() { + public void beforeDidsableCacheReuse() { myDaoConfig.setReuseCachedSearchResultsForMillis(null); + } + + @After + public void afterResetSearchSize() { + myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum()); } + /** + * See #744 + */ + @Test + public void testSearchWithVeryLongUrlShorter() { + myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + + Patient p = new Patient(); + p.addName().setFamily("A1"); + myPatientDao.create(p); + + assertEquals(0, mySearchEntityDao.count()); + + SearchParameterMap map = new SearchParameterMap(); + StringOrListParam or = new StringOrListParam(); + or.addOr(new StringParam("A1")); + or.addOr(new StringParam(StringUtils.leftPad("", 200, 'A'))); + or.addOr(new StringParam(StringUtils.leftPad("", 200, 'B'))); + or.addOr(new StringParam(StringUtils.leftPad("", 200, 'C'))); + map.add(Patient.SP_NAME, or); + IBundleProvider results = myPatientDao.search(map); + assertEquals(1, results.getResources(0, 10).size()); + assertEquals(1, mySearchEntityDao.count()); + + map = new SearchParameterMap(); + or = new StringOrListParam(); + or.addOr(new StringParam("A1")); + or.addOr(new StringParam(StringUtils.leftPad("", 200, 'A'))); + or.addOr(new StringParam(StringUtils.leftPad("", 200, 'B'))); + or.addOr(new StringParam(StringUtils.leftPad("", 200, 'C'))); + map.add(Patient.SP_NAME, or); + results = myPatientDao.search(map); + assertEquals(1, results.getResources(0, 10).size()); + assertEquals(1, mySearchEntityDao.count()); + + } + + /** + * See #744 + */ + @Test + public void testSearchWithVeryLongUrlLonger() { + myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + + Patient p = new Patient(); + p.addName().setFamily("A1"); + myPatientDao.create(p); + + assertEquals(0, mySearchEntityDao.count()); + + SearchParameterMap map = new SearchParameterMap(); + StringOrListParam or = new StringOrListParam(); + or.addOr(new StringParam("A1")); + for (int i = 0; i < 50; i++) { + or.addOr(new StringParam(StringUtils.leftPad("", 200, (char)('A' + i)))); + } + map.add(Patient.SP_NAME, or); + IBundleProvider results = myPatientDao.search(map); + assertEquals(1, results.getResources(0, 10).size()); + assertEquals(1, mySearchEntityDao.count()); + + map = new SearchParameterMap(); + or = new StringOrListParam(); + or.addOr(new StringParam("A1")); + or.addOr(new StringParam("A1")); + for (int i = 0; i < 50; i++) { + or.addOr(new StringParam(StringUtils.leftPad("", 200, (char)('A' + i)))); + } + map.add(Patient.SP_NAME, or); + results = myPatientDao.search(map); + assertEquals(1, results.getResources(0, 10).size()); + // We expect a new one because we don't cache the search URL for very long search URLs + assertEquals(2, mySearchEntityDao.count()); + + } + /** * See #441 */ diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java index df856260457..aa39d50803a 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java @@ -1,33 +1,35 @@ package ca.uhn.fhir.jpa.dao.r4; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.junit.Assert.*; - +import ca.uhn.fhir.jpa.dao.SearchParameterMap; +import ca.uhn.fhir.jpa.search.StaleSearchDeletingSvcImpl; import ca.uhn.fhir.jpa.util.StopWatch; +import ca.uhn.fhir.rest.api.server.IBundleProvider; +import ca.uhn.fhir.rest.param.StringParam; import org.apache.commons.lang3.Validate; -import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.instance.model.api.IIdType; -import org.junit.*; +import org.hl7.fhir.r4.model.Patient; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.test.util.AopTestUtils; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionCallbackWithoutResult; import org.springframework.transaction.support.TransactionTemplate; -import ca.uhn.fhir.jpa.dao.SearchParameterMap; -import ca.uhn.fhir.jpa.search.StaleSearchDeletingSvcImpl; -import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.param.StringParam; +import static ca.uhn.fhir.jpa.util.TestUtil.sleepAtLeast; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.junit.Assert.*; public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { - @Before - public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - } + private static final Logger ourLog = LoggerFactory.getLogger(FhirResourceDaoR4SearchPageExpiryTest.class); @After() public void after() { StaleSearchDeletingSvcImpl staleSearchDeletingSvc = AopTestUtils.getTargetObject(myStaleSearchDeletingSvc); staleSearchDeletingSvc.setCutoffSlackForUnitTest(StaleSearchDeletingSvcImpl.DEFAULT_CUTOFF_SLACK); + StaleSearchDeletingSvcImpl.setNowForUnitTests(null); } @Before @@ -36,50 +38,9 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { staleSearchDeletingSvc.setCutoffSlackForUnitTest(0); } - @Test - public void testExpirePagesAfterSingleUse() throws Exception { - IIdType pid1; - IIdType pid2; - { - Patient patient = new Patient(); - patient.addName().setFamily("EXPIRE"); - pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - Thread.sleep(10); - { - Patient patient = new Patient(); - patient.addName().setFamily("EXPIRE"); - pid2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - Thread.sleep(10); - - final StopWatch sw = new StopWatch(); - - SearchParameterMap params; - params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("EXPIRE")); - final IBundleProvider bundleProvider = myPatientDao.search(params); - assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2)); - assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2)); - - myDaoConfig.setExpireSearchResultsAfterMillis(500); - myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); - TransactionTemplate txTemplate = new TransactionTemplate(myTxManager); - txTemplate.execute(new TransactionCallbackWithoutResult() { - @Override - protected void doInTransactionWithoutResult(TransactionStatus theArg0) { - assertNotNull("Failed after " + sw.toString(), mySearchEntityDao.findByUuid(bundleProvider.getUuid())); - } - }); - - Thread.sleep(750); - myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); - txTemplate.execute(new TransactionCallbackWithoutResult() { - @Override - protected void doInTransactionWithoutResult(TransactionStatus theArg0) { - assertNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid())); - } - }); + @Before + public void beforeDisableResultReuse() { + myDaoConfig.setReuseCachedSearchResultsForMillis(null); } @Test @@ -101,6 +62,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { myDaoConfig.setExpireSearchResultsAfterMillis(1000L); myDaoConfig.setReuseCachedSearchResultsForMillis(500L); + long start = System.currentTimeMillis(); final String searchUuid1; { @@ -112,7 +74,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { Validate.notBlank(searchUuid1); } - Thread.sleep(250); + sleepAtLeast(250); String searchUuid2; { @@ -125,7 +87,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { } assertEquals(searchUuid1, searchUuid2); - Thread.sleep(500); + sleepAtLeast(500); // We're now past 500ms so we shouldn't reuse the search @@ -150,7 +112,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { } }); - Thread.sleep(750); + StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 1400); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); newTxTemplate().execute(new TransactionCallbackWithoutResult() { @@ -166,7 +128,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { } }); - Thread.sleep(300); + StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 2200); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); newTxTemplate().execute(new TransactionCallbackWithoutResult() { @@ -178,4 +140,63 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { }); } + + @Test + public void testExpirePagesAfterSingleUse() throws Exception { + IIdType pid1; + IIdType pid2; + { + Patient patient = new Patient(); + patient.addName().setFamily("EXPIRE"); + pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); + } + Thread.sleep(10); + { + Patient patient = new Patient(); + patient.addName().setFamily("EXPIRE"); + pid2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); + } + Thread.sleep(10); + + final StopWatch sw = new StopWatch(); + + long start = System.currentTimeMillis(); + + SearchParameterMap params; + params = new SearchParameterMap(); + params.add(Patient.SP_FAMILY, new StringParam("EXPIRE")); + final IBundleProvider bundleProvider = myPatientDao.search(params); + assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2)); + assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2)); + + myDaoConfig.setExpireSearchResultsAfterMillis(500); + StaleSearchDeletingSvcImpl.setNowForUnitTests(start); + + myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); + TransactionTemplate txTemplate = new TransactionTemplate(myTxManager); + txTemplate.execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus theArg0) { + assertNotNull("Failed after " + sw.toString(), mySearchEntityDao.findByUuid(bundleProvider.getUuid())); + } + }); + + StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 499); + myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); + txTemplate.execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus theArg0) { + assertNotNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid())); + } + }); + + StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 600); + myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); + txTemplate.execute(new TransactionCallbackWithoutResult() { + @Override + protected void doInTransactionWithoutResult(TransactionStatus theArg0) { + assertNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid())); + } + }); + } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java index 567aa1aa49a..04a686da42c 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java @@ -55,6 +55,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { public final void after() { myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical()); + myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); } private void assertGone(IIdType theId) { @@ -98,6 +99,29 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { } + /** + * See #773 + */ + @Test + public void testDeleteResourceWithOutboundDeletedResources() { + myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + + Organization org = new Organization(); + org.setId("ORG"); + org.setName("ORG"); + myOrganizationDao.update(org); + + Patient pat = new Patient(); + pat.setId("PAT"); + pat.setActive(true); + pat.setManagingOrganization(new Reference("Organization/ORG")); + myPatientDao.update(pat); + + myOrganizationDao.delete(new IdType("Organization/ORG")); + + myPatientDao.delete(new IdType("Patient/PAT")); + } + @Before public void beforeDisableResultReuse() { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java index 8679cd69864..3cf4fcd8aa8 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java @@ -303,7 +303,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test { Patient pt1 = new Patient(); pt1.setGender(Enumerations.AdministrativeGender.MALE); pt1.setBirthDateElement(new DateType("2011-01-01")); - IIdType id1 = myPatientDao.create(pt1).getId().toUnqualifiedVersionless(); + String id1 = myPatientDao.create(pt1).getId().toUnqualifiedVersionless().getValue(); Patient pt2 = new Patient(); pt2.setGender(Enumerations.AdministrativeGender.MALE); @@ -316,7 +316,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test { params.add("birthdate", new DateParam("2011-01-01")); IBundleProvider results = myPatientDao.search(params); String searchId = results.getUuid(); - assertThat(toUnqualifiedVersionlessIdValues(results), containsInAnyOrder(id1.getValue())); + assertThat(toUnqualifiedVersionlessIdValues(results), containsInAnyOrder(id1)); assertEquals(SearchBuilder.HandlerTypeEnum.UNIQUE_INDEX, SearchBuilder.getLastHandlerMechanismForUnitTest()); // Other order @@ -326,7 +326,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test { params.add("gender", new TokenParam("http://hl7.org/fhir/administrative-gender", "male")); results = myPatientDao.search(params); assertEquals(searchId, results.getUuid()); - assertThat(toUnqualifiedVersionlessIdValues(results), containsInAnyOrder(id1.getValue())); + assertThat(toUnqualifiedVersionlessIdValues(results), containsInAnyOrder(id1)); // Null because we just reuse the last search assertEquals(null, SearchBuilder.getLastHandlerMechanismForUnitTest()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java index 601d944d3c3..1bb289d2e03 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java @@ -133,6 +133,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { } catch (PreconditionFailedException e) { return (OperationOutcome) e.getOperationOutcome(); } + break; case XML: encoded = myFhirCtx.newXmlParser().encodeResourceToString(input); try { @@ -141,6 +142,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { } catch (PreconditionFailedException e) { return (OperationOutcome) e.getOperationOutcome(); } + break; } throw new IllegalStateException(); // shouldn't get here diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java index 7d8354f5a08..4997c46e92d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java @@ -587,6 +587,90 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { } + @Test + public void testTransactionWithIfMatch() { + Patient p = new Patient(); + p.setId("P1"); + p.setActive(true); + myPatientDao.update(p); + + p.setActive(false); + Bundle b = new Bundle(); + b.setType(BundleType.TRANSACTION); + b.addEntry() + .setFullUrl("Patient/P1") + .setResource(p) + .getRequest() + .setMethod(HTTPVerb.PUT) + .setUrl("Patient/P1") + .setIfMatch("2"); + + try { + mySystemDao.transaction(mySrd, b); + } catch (ResourceVersionConflictException e) { + assertEquals("Trying to update Patient/P1/_history/2 but this is not the current version", e.getMessage()); + } + + b = new Bundle(); + b.setType(BundleType.TRANSACTION); + b.addEntry() + .setFullUrl("Patient/P1") + .setResource(p) + .getRequest() + .setMethod(HTTPVerb.PUT) + .setUrl("Patient/P1") + .setIfMatch("1"); + + Bundle resp = mySystemDao.transaction(mySrd, b); + assertEquals("Patient/P1/_history/2", new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue()); + + + } + + @Test + public void testTransactionWithIfNoneExist() { + Patient p = new Patient(); + p.setId("P1"); + p.setActive(true); + myPatientDao.update(p); + + p = new Patient(); + p.setActive(true); + p.addName().setFamily("AAA"); + + Bundle b = new Bundle(); + b.setType(BundleType.TRANSACTION); + b.addEntry() + .setFullUrl("Patient") + .setResource(p) + .getRequest() + .setMethod(HTTPVerb.POST) + .setUrl("Patient/P1") + .setIfNoneExist("Patient?active=true"); + + Bundle resp = mySystemDao.transaction(mySrd, b); + assertEquals("Patient/P1/_history/1", new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue()); + + p = new Patient(); + p.setActive(true); + p.addName().setFamily("AAA"); + + b = new Bundle(); + b.setType(BundleType.TRANSACTION); + b.addEntry() + .setFullUrl("Patient") + .setResource(p) + .getRequest() + .setMethod(HTTPVerb.POST) + .setUrl("Patient/P1") + .setIfNoneExist("Patient?active=false"); + + resp = mySystemDao.transaction(mySrd, b); + assertThat( new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue(), matchesPattern("Patient/[0-9]+/_history/1")); + + + } + @Test public void testTransaction1() throws IOException { String inputBundleString = loadClasspath("/david-bundle-error.json"); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java index b1372bd99e4..b50dd291a99 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java @@ -24,6 +24,7 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; +import org.springframework.transaction.PlatformTransactionManager; import org.springframework.web.context.ContextLoader; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -47,6 +48,7 @@ public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test { protected static GenericWebApplicationContext ourWebApplicationContext; protected static SubscriptionRestHookInterceptor ourRestHookSubscriptionInterceptor; protected static DatabaseBackedPagingProvider ourPagingProvider; + protected static PlatformTransactionManager ourTxManager; public BaseResourceProviderDstu2Test() { super(); @@ -98,6 +100,7 @@ public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test { ourWebApplicationContext.refresh(); ourRestHookSubscriptionInterceptor = ourWebApplicationContext.getBean(SubscriptionRestHookInterceptor.class); + ourTxManager = ourWebApplicationContext.getBean(PlatformTransactionManager.class); proxyHandler.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ourWebApplicationContext); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java index 969906c4136..516ea29df48 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java @@ -6,6 +6,7 @@ import ca.uhn.fhir.jpa.dao.dstu3.BaseJpaDstu3Test; import ca.uhn.fhir.jpa.dao.dstu3.SearchParamRegistryDstu3; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc; +import ca.uhn.fhir.jpa.subscription.email.SubscriptionEmailInterceptor; import ca.uhn.fhir.jpa.subscription.resthook.SubscriptionRestHookInterceptor; import ca.uhn.fhir.jpa.validation.JpaValidationSupportChainDstu3; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; @@ -58,6 +59,7 @@ public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test { protected static SearchParamRegistryDstu3 ourSearchParamRegistry; protected static DatabaseBackedPagingProvider ourPagingProvider; protected static SubscriptionRestHookInterceptor ourRestHookSubscriptionInterceptor; + protected static SubscriptionEmailInterceptor ourEmailSubscriptionInterceptor; protected static ISearchDao mySearchEntityDao; protected static ISearchCoordinatorSvc mySearchCoordinatorSvc; @@ -111,13 +113,9 @@ public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test { ourWebApplicationContext = new GenericWebApplicationContext(); ourWebApplicationContext.setParent(myAppCtx); ourWebApplicationContext.refresh(); - // ContextLoaderListener loaderListener = new ContextLoaderListener(webApplicationContext); - // loaderListener.initWebApplicationContext(mock(ServletContext.class)); - // proxyHandler.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ourWebApplicationContext); DispatcherServlet dispatcherServlet = new DispatcherServlet(); - // dispatcherServlet.setApplicationContext(webApplicationContext); dispatcherServlet.setContextClass(AnnotationConfigWebApplicationContext.class); ServletHolder subsServletHolder = new ServletHolder(); subsServletHolder.setServlet(dispatcherServlet); @@ -150,6 +148,7 @@ public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test { mySearchCoordinatorSvc = wac.getBean(ISearchCoordinatorSvc.class); mySearchEntityDao = wac.getBean(ISearchDao.class); ourRestHookSubscriptionInterceptor = wac.getBean(SubscriptionRestHookInterceptor.class); + ourEmailSubscriptionInterceptor = wac.getBean(SubscriptionEmailInterceptor.class); ourSearchParamRegistry = wac.getBean(SearchParamRegistryDstu3.class); myFhirCtx.getRestfulClientFactory().setSocketTimeout(5000000); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java index beec2e3ffe3..57993ba7915 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java @@ -1,13 +1,15 @@ package ca.uhn.fhir.jpa.provider.dstu3; -import static ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest.URL_MY_CODE_SYSTEM; -import static ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest.URL_MY_VALUE_SET; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; - +import ca.uhn.fhir.jpa.dao.IFhirResourceDao; +import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; +import ca.uhn.fhir.jpa.entity.ResourceTable; +import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; +import ca.uhn.fhir.jpa.entity.TermConcept; +import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum; +import ca.uhn.fhir.jpa.term.IHapiTerminologySvc; +import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; +import ca.uhn.fhir.util.TestUtil; import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; @@ -19,17 +21,18 @@ import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent; import org.hl7.fhir.dstu3.model.ValueSet.FilterOperator; import org.hl7.fhir.instance.model.api.IIdType; -import org.junit.*; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; import org.springframework.transaction.annotation.Transactional; -import ca.uhn.fhir.jpa.dao.IFhirResourceDao; -import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; -import ca.uhn.fhir.jpa.entity.*; -import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum; -import ca.uhn.fhir.jpa.term.IHapiTerminologySvc; -import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; -import ca.uhn.fhir.util.TestUtil; +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +import static ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest.URL_MY_CODE_SYSTEM; +import static ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest.URL_MY_VALUE_SET; +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3Test { @@ -48,73 +51,14 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 myExtensionalVsId = myValueSetDao.create(upload, mySrd).getId().toUnqualifiedVersionless(); } - /** - * #516 - */ - @Test - public void testInvalidFilter() throws Exception { - String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8); - HttpPost post = new HttpPost(ourServerBase+"/ValueSet/%24expand"); - post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW))); - - CloseableHttpResponse resp = ourHttpClient.execute(post); - try { - - String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8); - ourLog.info(respString); - - ourLog.info(resp.toString()); - - assertEquals(400, resp.getStatusLine().getStatusCode()); - assertThat(respString, containsString("Unknown FilterOperator code 'n'")); - - }finally { - IOUtils.closeQuietly(resp); - } - } - private CodeSystem createExternalCs() { IFhirResourceDao codeSystemDao = myCodeSystemDao; IResourceTableDao resourceTableDao = myResourceTableDao; IHapiTerminologySvc termSvc = myTermSvc; - + return createExternalCs(codeSystemDao, resourceTableDao, termSvc, mySrd); } - public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, IHapiTerminologySvc theTermSvc, ServletRequestDetails theRequestDetails) { - CodeSystem codeSystem = new CodeSystem(); - codeSystem.setUrl(URL_MY_CODE_SYSTEM); - codeSystem.setContent(CodeSystemContentMode.NOTPRESENT); - IIdType id = theCodeSystemDao.create(codeSystem, theRequestDetails).getId().toUnqualified(); - - ResourceTable table = theResourceTableDao.findOne(id.getIdPartAsLong()); - - TermCodeSystemVersion cs = new TermCodeSystemVersion(); - cs.setResource(table); - cs.setResourceVersionId(table.getVersion()); - - TermConcept parentA = new TermConcept(cs, "ParentA").setDisplay("Parent A"); - cs.getConcepts().add(parentA); - - TermConcept childAA = new TermConcept(cs, "childAA").setDisplay("Child AA"); - parentA.addChild(childAA, RelationshipTypeEnum.ISA); - - TermConcept childAAA = new TermConcept(cs, "childAAA").setDisplay("Child AAA"); - childAA.addChild(childAAA, RelationshipTypeEnum.ISA); - - TermConcept childAAB = new TermConcept(cs, "childAAB").setDisplay("Child AAB"); - childAA.addChild(childAAB, RelationshipTypeEnum.ISA); - - TermConcept childAB = new TermConcept(cs, "childAB").setDisplay("Child AB"); - parentA.addChild(childAB, RelationshipTypeEnum.ISA); - - TermConcept parentB = new TermConcept(cs, "ParentB").setDisplay("Parent B"); - cs.getConcepts().add(parentB); - - theTermSvc.storeNewCodeSystemVersion(table.getId(), URL_MY_CODE_SYSTEM, cs); - return codeSystem; - } - private void createExternalCsAndLocalVs() { CodeSystem codeSystem = createExternalCs(); @@ -131,17 +75,17 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 //@formatter:off CodeSystem codeSystem = new CodeSystem(); codeSystem.setUrl(URL_MY_CODE_SYSTEM); - codeSystem.setContent(CodeSystemContentMode.COMPLETE); + codeSystem.setContent(CodeSystemContentMode.COMPLETE); codeSystem .addConcept().setCode("A").setDisplay("Code A") - .addConcept(new ConceptDefinitionComponent().setCode("AA").setDisplay("Code AA") - .addConcept(new ConceptDefinitionComponent().setCode("AAA").setDisplay("Code AAA")) - ) - .addConcept(new ConceptDefinitionComponent().setCode("AB").setDisplay("Code AB")); + .addConcept(new ConceptDefinitionComponent().setCode("AA").setDisplay("Code AA") + .addConcept(new ConceptDefinitionComponent().setCode("AAA").setDisplay("Code AAA")) + ) + .addConcept(new ConceptDefinitionComponent().setCode("AB").setDisplay("Code AB")); codeSystem .addConcept().setCode("B").setDisplay("Code B") - .addConcept(new ConceptDefinitionComponent().setCode("BA").setDisplay("Code BA")) - .addConcept(new ConceptDefinitionComponent().setCode("BB").setDisplay("Code BB")); + .addConcept(new ConceptDefinitionComponent().setCode("BA").setDisplay("Code BA")) + .addConcept(new ConceptDefinitionComponent().setCode("BB").setDisplay("Code BB")); //@formatter:on myCodeSystemDao.create(codeSystem, mySrd); @@ -185,49 +129,25 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, containsString("")); + assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); - assertThat(resp, containsString("")); + assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); - assertThat(resp, containsString("")); + assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); } - @Test - public void testExpandByIdentifier() { - //@formatter:off - Parameters respParam = ourClient - .operation() - .onType(ValueSet.class) - .named("expand") - .withParameter(Parameters.class, "identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) - .execute(); - ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); - //@formatter:on - - String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); - ourLog.info(resp); - //@formatter:off - assertThat(resp, stringContainsInOrder( - "", - "")); - //@formatter:on - - } - - // - @Test public void testExpandByIdWithFilter() throws IOException { @@ -245,13 +165,56 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 ourLog.info(resp); assertThat(resp, containsString("")); assertThat(resp, not(containsString(""))); - + + } + + /** + * $expand?identifier=foo is legacy.. It's actually not valid in FHIR as of STU3 + * but we supported it for longer than we should have so I don't want to delete + * it right now. + * + * https://groups.google.com/d/msgid/hapi-fhir/CAN2Cfy8kW%2BAOkgC6VjPsU3gRCpExCNZBmJdi-k5R_TWeyWH4tA%40mail.gmail.com?utm_medium=email&utm_source=footer + */ + @Test + public void testExpandByIdentifier() { + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("expand") + .withParameter(Parameters.class, "identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "", + "")); + + } + + @Test + public void testExpandByUrl() { + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("expand") + .withParameter(Parameters.class, "url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "", + "")); + } @Test public void testExpandByValueSet() throws IOException { ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml"); - + //@formatter:off Parameters respParam = ourClient .operation() @@ -266,8 +229,8 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 ourLog.info(resp); //@formatter:off assertThat(resp, stringContainsInOrder( - "", - "")); + "", + "")); //@formatter:on } @@ -276,7 +239,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 public void testExpandInlineVsAgainstBuiltInCs() throws IOException { createLocalVsPointingAtBuiltInCodeSystem(); assertNotNull(myLocalValueSetId); - + //@formatter:off Parameters respParam = ourClient .operation() @@ -286,10 +249,10 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); } @@ -298,7 +261,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 createExternalCsAndLocalVs(); assertNotNull(myLocalVs); myLocalVs.setId(""); - + //@formatter:off Parameters respParam = ourClient .operation() @@ -308,16 +271,15 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, not(containsStringIgnoringCase(""))); - - } + } @Test public void testExpandInvalidParams() throws IOException { @@ -373,7 +335,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 public void testExpandLocalVsAgainstBuiltInCs() throws IOException { createLocalVsPointingAtBuiltInCodeSystem(); assertNotNull(myLocalValueSetId); - + //@formatter:off Parameters respParam = ourClient .operation() @@ -383,22 +345,18 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); } - - - - - + @Test public void testExpandLocalVsAgainstExternalCs() throws IOException { createExternalCsAndLocalVs(); assertNotNull(myLocalValueSetId); - + //@formatter:off Parameters respParam = ourClient .operation() @@ -408,21 +366,21 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, not(containsStringIgnoringCase(""))); - + } @Test public void testExpandLocalVsCanonicalAgainstExternalCs() throws IOException { createExternalCsAndLocalVs(); assertNotNull(myLocalValueSetId); - + //@formatter:off Parameters respParam = ourClient .operation() @@ -432,21 +390,21 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, not(containsStringIgnoringCase(""))); - + } @Test public void testExpandLocalVsWithUnknownCode() throws IOException { createExternalCsAndLocalVsWithUnknownCode(); assertNotNull(myLocalValueSetId); - + //@formatter:off try { ourClient @@ -461,34 +419,31 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 //@formatter:on } + /** + * #516 + */ @Test - public void testValiedateCodeAgainstBuiltInSystem() { - //@formatter:off - Parameters respParam = ourClient - .operation() - .onType(ValueSet.class) - .named("validate-code") - .withParameter(Parameters.class, "code", new StringType("BRN")) - .andParameter("identifier", new StringType("http://hl7.org/fhir/ValueSet/v2-0487")) - .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487")) - .useHttpGet() - .execute(); - //@formatter:on + public void testInvalidFilter() throws Exception { + String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8); + HttpPost post = new HttpPost(ourServerBase + "/ValueSet/%24expand"); + post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW))); - String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); - ourLog.info(resp); - - assertEquals("result", respParam.getParameter().get(0).getName()); - assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).getValue().booleanValue()); - - assertEquals("message", respParam.getParameter().get(1).getName()); - assertThat(((StringType)respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded")); + CloseableHttpResponse resp = ourHttpClient.execute(post); + try { - assertEquals("display", respParam.getParameter().get(2).getName()); - assertEquals("Burn", ((StringType)respParam.getParameter().get(2).getValue()).getValue()); + String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8); + ourLog.info(respString); + + ourLog.info(resp.toString()); + + assertEquals(400, resp.getStatusLine().getStatusCode()); + assertThat(respString, containsString("Unknown FilterOperator code 'n'")); + + } finally { + IOUtils.closeQuietly(resp); + } } - @Test public void testValidateCodeOperationByCodeAndSystemInstance() { //@formatter:off @@ -503,8 +458,8 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); ourLog.info(resp); - - assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).booleanValue()); + + assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue()); } @Test @@ -521,8 +476,64 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); ourLog.info(resp); - - assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).booleanValue()); + + assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue()); + } + + /** + * Technically this is the wrong param name + */ + @Test + public void testValiedateCodeAgainstBuiltInSystem() { + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("validate-code") + .withParameter(Parameters.class, "code", new StringType("BRN")) + .andParameter("identifier", new StringType("http://hl7.org/fhir/ValueSet/v2-0487")) + .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487")) + .useHttpGet() + .execute(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + assertEquals("result", respParam.getParameter().get(0).getName()); + assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).getValue().booleanValue()); + + assertEquals("message", respParam.getParameter().get(1).getName()); + assertThat(((StringType) respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded")); + + assertEquals("display", respParam.getParameter().get(2).getName()); + assertEquals("Burn", ((StringType) respParam.getParameter().get(2).getValue()).getValue()); + } + + /** + * Technically this is the right param name + */ + @Test + public void testValiedateCodeAgainstBuiltInSystemByUrl() { + Parameters respParam = ourClient + .operation() + .onType(ValueSet.class) + .named("validate-code") + .withParameter(Parameters.class, "code", new StringType("BRN")) + .andParameter("url", new StringType("http://hl7.org/fhir/ValueSet/v2-0487")) + .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487")) + .useHttpGet() + .execute(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + assertEquals("result", respParam.getParameter().get(0).getName()); + assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).getValue().booleanValue()); + + assertEquals("message", respParam.getParameter().get(1).getName()); + assertThat(((StringType) respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded")); + + assertEquals("display", respParam.getParameter().get(2).getName()); + assertEquals("Burn", ((StringType) respParam.getParameter().get(2).getValue()).getValue()); } @AfterClass @@ -530,4 +541,38 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 TestUtil.clearAllStaticFieldsForUnitTest(); } + public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, IHapiTerminologySvc theTermSvc, ServletRequestDetails theRequestDetails) { + CodeSystem codeSystem = new CodeSystem(); + codeSystem.setUrl(URL_MY_CODE_SYSTEM); + codeSystem.setContent(CodeSystemContentMode.NOTPRESENT); + IIdType id = theCodeSystemDao.create(codeSystem, theRequestDetails).getId().toUnqualified(); + + ResourceTable table = theResourceTableDao.findOne(id.getIdPartAsLong()); + + TermCodeSystemVersion cs = new TermCodeSystemVersion(); + cs.setResource(table); + cs.setResourceVersionId(table.getVersion()); + + TermConcept parentA = new TermConcept(cs, "ParentA").setDisplay("Parent A"); + cs.getConcepts().add(parentA); + + TermConcept childAA = new TermConcept(cs, "childAA").setDisplay("Child AA"); + parentA.addChild(childAA, RelationshipTypeEnum.ISA); + + TermConcept childAAA = new TermConcept(cs, "childAAA").setDisplay("Child AAA"); + childAA.addChild(childAAA, RelationshipTypeEnum.ISA); + + TermConcept childAAB = new TermConcept(cs, "childAAB").setDisplay("Child AAB"); + childAA.addChild(childAAB, RelationshipTypeEnum.ISA); + + TermConcept childAB = new TermConcept(cs, "childAB").setDisplay("Child AB"); + parentA.addChild(childAB, RelationshipTypeEnum.ISA); + + TermConcept parentB = new TermConcept(cs, "ParentB").setDisplay("Parent B"); + cs.getConcepts().add(parentB); + + theTermSvc.storeNewCodeSystemVersion(table.getId(), URL_MY_CODE_SYSTEM, cs); + return codeSystem; + } + } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderInterceptorDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderInterceptorDstu3Test.java index 29798cf84bf..2a4e87c050d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderInterceptorDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderInterceptorDstu3Test.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.jpa.provider.dstu3; import ca.uhn.fhir.jpa.provider.r4.ResourceProviderInterceptorR4Test; -import ca.uhn.fhir.model.dstu2.resource.Conformance; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.RestOperationTypeEnum; @@ -61,8 +60,8 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs public void before() throws Exception { super.before(); - myServerInterceptor = mock(IServerInterceptor.class); - myDaoInterceptor = mock(IServerInterceptor.class); + myServerInterceptor = mock(IServerInterceptor.class, withSettings().verboseLogging()); + myDaoInterceptor = mock(IServerInterceptor.class, withSettings().verboseLogging()); resetServerInterceptor(); @@ -125,6 +124,8 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs public void testCreateResourceInTransaction() throws IOException, ServletException { String methodName = "testCreateResourceInTransaction"; + ourLog.info("** Starting {}", methodName); + Patient pt = new Patient(); pt.addName().setFamily(methodName); @@ -140,6 +141,11 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs resetServerInterceptor(); + ArgumentCaptor ardCaptor = ArgumentCaptor.forClass(ActionRequestDetails.class); + ArgumentCaptor opTypeCaptor = ArgumentCaptor.forClass(RestOperationTypeEnum.class); + verify(myDaoInterceptor, times(0)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture()); + verify(myServerInterceptor, times(0)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture()); + HttpPost post = new HttpPost(ourServerBase + "/"); post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8"))); CloseableHttpResponse response = ourHttpClient.execute(post); @@ -153,8 +159,8 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs * Server Interceptor */ - ArgumentCaptor ardCaptor = ArgumentCaptor.forClass(ActionRequestDetails.class); - ArgumentCaptor opTypeCaptor = ArgumentCaptor.forClass(RestOperationTypeEnum.class); + ardCaptor = ArgumentCaptor.forClass(ActionRequestDetails.class); + opTypeCaptor = ArgumentCaptor.forClass(RestOperationTypeEnum.class); verify(myServerInterceptor, times(2)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture()); assertEquals(RestOperationTypeEnum.TRANSACTION, opTypeCaptor.getAllValues().get(0)); assertEquals(null, ardCaptor.getAllValues().get(0).getResourceType()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java index 758c6daf735..2ac8b37a4f1 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java @@ -9,6 +9,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; +import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; import org.apache.http.client.methods.*; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; @@ -69,19 +71,68 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource Patient patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - IIdType id = ourClient.create().resource(patient).execute().getId(); + IIdType id = myClient.create().resource(patient).execute().getId(); try { - ourClient.delete().resourceById(id.toUnqualifiedVersionless()).execute(); + myClient.delete().resourceById(id.toUnqualifiedVersionless()).execute(); fail(); } catch (ForbiddenOperationException e) { // good } - patient = ourClient.read().resource(Patient.class).withId(id.toUnqualifiedVersionless()).execute(); + patient = myClient.read().resource(Patient.class).withId(id.toUnqualifiedVersionless()).execute(); assertEquals(id.getValue(), patient.getId()); } - + + /** + * See #751 + */ + @Test + public void testDeleteInCompartmentIsBlocked() { + + Patient patient = new Patient(); + patient.setId("Patient/A"); + patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); + patient.addName().setFamily("Tester").addGiven("Raghad"); + IIdType id = myClient.update().resource(patient).execute().getId(); + + Observation obs = new Observation(); + obs.setId("Observation/B"); + obs.getSubject().setReference("Patient/A"); + myClient.update().resource(obs).execute(); + + obs = new Observation(); + obs.setId("Observation/C"); + obs.setStatus(ObservationStatus.FINAL); + myClient.update().resource(obs).execute(); + + ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow().delete().allResources().inCompartment("Patient", new IdType("Patient/A")).andThen() + .allow().read().allResources().withAnyId().andThen() + .denyAll() + .build(); + } + }); + + myClient.delete().resourceById(new IdType("Observation/B")).execute(); + + try { + myClient.read().resource(Observation.class).withId("Observation/B").execute(); + fail(); + } catch (ResourceGoneException e) { + // good + } + + try { + myClient.delete().resourceById(new IdType("Observation/C")).execute(); + fail(); + } catch (ForbiddenOperationException e) { + // good + } + } /** * See #503 @@ -92,16 +143,16 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource Patient patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - final IIdType id = ourClient.create().resource(patient).execute().getId(); + final IIdType id = myClient.create().resource(patient).execute().getId(); Observation obsInCompartment = new Observation(); obsInCompartment.setStatus(ObservationStatus.FINAL); obsInCompartment.getSubject().setReferenceElement(id.toUnqualifiedVersionless()); - IIdType obsInCompartmentId = ourClient.create().resource(obsInCompartment).execute().getId().toUnqualifiedVersionless(); + IIdType obsInCompartmentId = myClient.create().resource(obsInCompartment).execute().getId().toUnqualifiedVersionless(); Observation obsNotInCompartment = new Observation(); obsNotInCompartment.setStatus(ObservationStatus.FINAL); - IIdType obsNotInCompartmentId = ourClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless(); + IIdType obsNotInCompartmentId = myClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless(); ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { @Override @@ -114,10 +165,10 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource } }); - ourClient.delete().resourceById(obsInCompartmentId.toUnqualifiedVersionless()).execute(); + myClient.delete().resourceById(obsInCompartmentId.toUnqualifiedVersionless()).execute(); try { - ourClient.delete().resourceById(obsNotInCompartmentId.toUnqualifiedVersionless()).execute(); + myClient.delete().resourceById(obsNotInCompartmentId.toUnqualifiedVersionless()).execute(); fail(); } catch (ForbiddenOperationException e) { // good @@ -130,7 +181,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource Patient patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - final MethodOutcome output1 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); + final MethodOutcome output1 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { @Override @@ -148,7 +199,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource patient.setId(output1.getId().toUnqualifiedVersionless()); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - MethodOutcome output2 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); + MethodOutcome output2 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); assertEquals(output1.getId().getIdPart(), output2.getId().getIdPart()); @@ -156,7 +207,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); try { - ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|101").execute(); + myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|101").execute(); fail(); } catch (ForbiddenOperationException e) { assertEquals("HTTP 403 Forbidden: Access denied by default policy (no applicable rules)", e.getMessage()); @@ -167,7 +218,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); try { - ourClient.update().resource(patient).execute(); + myClient.update().resource(patient).execute(); fail(); } catch (ForbiddenOperationException e) { assertEquals("HTTP 403 Forbidden: Access denied by default policy (no applicable rules)", e.getMessage()); @@ -182,11 +233,11 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource public void testBlockUpdatingPatientUserDoesnNotHaveAccessTo() throws IOException { Patient pt1 = new Patient(); pt1.setActive(true); - final IIdType pid1 = ourClient.create().resource(pt1).execute().getId().toUnqualifiedVersionless(); + final IIdType pid1 = myClient.create().resource(pt1).execute().getId().toUnqualifiedVersionless(); Patient pt2 = new Patient(); pt2.setActive(false); - final IIdType pid2 = ourClient.create().resource(pt2).execute().getId().toUnqualifiedVersionless(); + final IIdType pid2 = myClient.create().resource(pt2).execute().getId().toUnqualifiedVersionless(); ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { @Override @@ -200,7 +251,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource Observation obs = new Observation(); obs.setStatus(ObservationStatus.FINAL); obs.setSubject(new Reference(pid1)); - IIdType oid = ourClient.create().resource(obs).execute().getId().toUnqualified(); + IIdType oid = myClient.create().resource(obs).execute().getId().toUnqualified(); unregisterInterceptors(); @@ -224,7 +275,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource obs.setSubject(new Reference(pid2)); try { - ourClient.update().resource(obs).execute(); + myClient.update().resource(obs).execute(); fail(); } catch (ForbiddenOperationException e) { // good diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java index b051b94e155..12e8f7f0967 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java @@ -47,7 +47,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test { protected static JpaValidationSupportChainR4 myValidationSupport; - protected static IGenericClient ourClient; + protected IGenericClient myClient; protected static CloseableHttpClient ourHttpClient; protected static int ourPort; protected static RestfulServer ourRestServer; @@ -150,10 +150,6 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test { ourSearchParamRegistry = wac.getBean(SearchParamRegistryR4.class); myFhirCtx.getRestfulClientFactory().setSocketTimeout(5000000); - ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase); - if (shouldLogClient()) { - ourClient.registerInterceptor(new LoggingInterceptor()); - } PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS); HttpClientBuilder builder = HttpClientBuilder.create(); @@ -165,6 +161,11 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test { } ourRestServer.setPagingProvider(ourPagingProvider); + + myClient = myFhirCtx.newRestfulGenericClient(ourServerBase); + if (shouldLogClient()) { + myClient.registerInterceptor(new LoggingInterceptor()); + } } /** diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java index 2a554e36963..286c6d9ce0b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java @@ -1,11 +1,11 @@ package ca.uhn.fhir.jpa.provider.r4; +import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.UrlUtil; import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.hl7.fhir.instance.model.api.IIdType; -import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Patient; import org.junit.Test; import org.slf4j.Logger; @@ -31,14 +31,14 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { try { String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(resp); - assertEquals(resp, "{\n" + + assertEquals(TestUtil.stripReturns(resp), TestUtil.stripReturns("{\n" + " \"name\":[{\n" + " \"family\":\"FAM\",\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + " },{\n" + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + " }]\n" + - "}"); + "}")); } finally { IOUtils.closeQuietly(response); } @@ -56,7 +56,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { try { String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(resp); - assertEquals(resp, "{\n" + + assertEquals(TestUtil.stripReturns(resp), TestUtil.stripReturns("{\n" + " \"PatientList\":[{\n" + " \"name\":[{\n" + " \"family\":\"FAM\",\n" + @@ -69,7 +69,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + " }]\n" + " }]\n" + - "}"); + "}")); } finally { IOUtils.closeQuietly(response); } @@ -85,13 +85,13 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { p.addName() .addGiven("GivenOnly1") .addGiven("GivenOnly2"); - myPatientId0 = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + myPatientId0 = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); p = new Patient(); p.addName() .addGiven("GivenOnlyB1") .addGiven("GivenOnlyB2"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java index ba0db38b0e9..37b45783b2b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java @@ -57,41 +57,41 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test { Organization org = new Organization(); org.setName("an org"); - orgId = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless().getValue(); + orgId = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless().getValue(); ourLog.info("OrgId: {}", orgId); Patient patient = new Patient(); patient.getManagingOrganization().setReference(orgId); - patId = ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless().getValue(); + patId = myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless().getValue(); Patient patient2 = new Patient(); patient2.getManagingOrganization().setReference(orgId); - myWrongPatId = ourClient.create().resource(patient2).execute().getId().toUnqualifiedVersionless().getValue(); + myWrongPatId = myClient.create().resource(patient2).execute().getId().toUnqualifiedVersionless().getValue(); Encounter enc1 = new Encounter(); enc1.setStatus(EncounterStatus.CANCELLED); enc1.getSubject().setReference(patId); enc1.getServiceProvider().setReference(orgId); - encId1 = ourClient.create().resource(enc1).execute().getId().toUnqualifiedVersionless().getValue(); + encId1 = myClient.create().resource(enc1).execute().getId().toUnqualifiedVersionless().getValue(); Encounter enc2 = new Encounter(); enc2.setStatus(EncounterStatus.ARRIVED); enc2.getSubject().setReference(patId); enc2.getServiceProvider().setReference(orgId); - encId2 = ourClient.create().resource(enc2).execute().getId().toUnqualifiedVersionless().getValue(); + encId2 = myClient.create().resource(enc2).execute().getId().toUnqualifiedVersionless().getValue(); Encounter wrongEnc1 = new Encounter(); wrongEnc1.setStatus(EncounterStatus.ARRIVED); wrongEnc1.getSubject().setReference(myWrongPatId); wrongEnc1.getServiceProvider().setReference(orgId); - myWrongEnc1 = ourClient.create().resource(wrongEnc1).execute().getId().toUnqualifiedVersionless().getValue(); + myWrongEnc1 = myClient.create().resource(wrongEnc1).execute().getId().toUnqualifiedVersionless().getValue(); myObsIds = new ArrayList(); for (int i = 0; i < 20; i++) { Observation obs = new Observation(); obs.getSubject().setReference(patId); obs.setStatus(ObservationStatus.FINAL); - String obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue(); + String obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue(); myObsIds.add(obsId); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java index c0bfdc29769..a46d3cc363f 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java @@ -54,7 +54,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide sp.setTitle("Foo Param"); try { - ourClient.create().resource(sp).execute(); + myClient.create().resource(sp).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: SearchParameter.status is missing or invalid: null", e.getMessage()); @@ -120,7 +120,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(eyeColourSp)); - ourClient + myClient .create() .resource(eyeColourSp) .execute(); @@ -139,7 +139,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide p2.addExtension().setUrl("http://acme.org/eyecolour").setValue(new CodeType("green")); IIdType p2id = myPatientDao.create(p2).getId().toUnqualifiedVersionless(); - Bundle bundle = ourClient + Bundle bundle = myClient .search() .forResource(Patient.class) .where(new TokenClientParam("eyecolour").exactly().code("blue")) @@ -168,7 +168,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide public void testConformanceOverrideAllowed() { myDaoConfig.setDefaultSearchParamsCanBeOverridden(true); - CapabilityStatement conformance = ourClient + CapabilityStatement conformance = myClient .fetchConformance() .ofType(CapabilityStatement.class) .execute(); @@ -220,7 +220,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide } }); - conformance = ourClient + conformance = myClient .fetchConformance() .ofType(CapabilityStatement.class) .execute(); @@ -238,7 +238,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide public void testConformanceOverrideNotAllowed() { myDaoConfig.setDefaultSearchParamsCanBeOverridden(false); - CapabilityStatement conformance = ourClient + CapabilityStatement conformance = myClient .fetchConformance() .ofType(CapabilityStatement.class) .execute(); @@ -274,7 +274,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide mySearchParamRegsitry.forceRefresh(); - conformance = ourClient + conformance = myClient .fetchConformance() .ofType(CapabilityStatement.class) .execute(); @@ -332,7 +332,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide List foundResources; Bundle result; - result = ourClient + result = myClient .search() .forResource(Patient.class) .where(new TokenClientParam("foo").exactly().code("male")) @@ -409,7 +409,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide List foundResources; Bundle result; - result = ourClient + result = myClient .search() .forResource(Observation.class) .where(new ReferenceClientParam("foo").hasChainedProperty(Patient.GENDER.exactly().code("male"))) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java index 742e097aad0..781d7040b46 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java @@ -198,7 +198,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes Organization org = new Organization(); org.setName("orgName"); - IIdType orgId = ourClient.create().resource(org).execute().getId().toUnqualified(); + IIdType orgId = myClient.create().resource(org).execute().getId().toUnqualified(); assertNotNull(orgId.getVersionIdPartAsLong()); resetServerInterceptor(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java index 78423c8552b..a3e9351442f 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java @@ -72,7 +72,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro qr1.setStatus(QuestionnaireResponseStatus.COMPLETED); qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123)); try { - ourClient.create().resource(qr1).execute(); + myClient.create().resource(qr1).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.toString(), containsString("Answer value must be of type string")); @@ -95,7 +95,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro qr1.setStatus(QuestionnaireResponseStatus.COMPLETED); qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123)); try { - ourClient.create().resource(qr1).execute(); + myClient.create().resource(qr1).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.toString(), containsString("Answer value must be of type string")); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java index 075ed457670..6ea92ae282a 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java @@ -34,9 +34,9 @@ public class ResourceProviderR4BundleTest extends BaseResourceProviderR4Test { composition.setTitle("Visit Summary"); bundle.addEntry().setFullUrl("http://foo").setResource(composition); - IIdType id = ourClient.create().resource(bundle).execute().getId(); + IIdType id = myClient.create().resource(bundle).execute().getId(); - Bundle retBundle = ourClient.read().resource(Bundle.class).withId(id).execute(); + Bundle retBundle = myClient.read().resource(Bundle.class).withId(id).execute(); ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(retBundle)); assertEquals("http://foo", bundle.getEntry().get(0).getFullUrl()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java new file mode 100644 index 00000000000..9ffb2e4c623 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java @@ -0,0 +1,188 @@ +package ca.uhn.fhir.jpa.provider.r4; + +import ca.uhn.fhir.jpa.dao.DaoConfig; +import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; +import ca.uhn.fhir.parser.StrictErrorHandler; +import ca.uhn.fhir.rest.api.CacheControlDirective; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor; +import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import ca.uhn.fhir.util.TestUtil; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Patient; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Test; +import org.springframework.test.util.AopTestUtils; + +import java.io.IOException; +import java.util.Date; + +import static org.hamcrest.Matchers.*; +import static org.hamcrest.core.IsNot.not; +import static org.junit.Assert.*; + +public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderR4CacheTest.class); + private SearchCoordinatorSvcImpl mySearchCoordinatorSvcRaw; + private CapturingInterceptor myCapturingInterceptor; + + @Override + @After + public void after() throws Exception { + super.after(); + myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + myDaoConfig.setCacheControlNoStoreMaxResultsUpperLimit(new DaoConfig().getCacheControlNoStoreMaxResultsUpperLimit()); + + myClient.unregisterInterceptor(myCapturingInterceptor); + } + + @Override + public void before() throws Exception { + super.before(); + myFhirCtx.setParserErrorHandler(new StrictErrorHandler()); + mySearchCoordinatorSvcRaw = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); + + myCapturingInterceptor = new CapturingInterceptor(); + myClient.registerInterceptor(myCapturingInterceptor); + } + + @Test + public void testCacheNoStore() throws IOException { + + Patient pt1 = new Patient(); + pt1.addName().setFamily("FAM"); + myClient.create().resource(pt1).execute(); + + Bundle results = myClient + .search() + .forResource("Patient") + .where(Patient.FAMILY.matches().value("FAM")) + .returnBundle(Bundle.class) + .cacheControl(new CacheControlDirective().setNoStore(true)) + .execute(); + assertEquals(1, results.getEntry().size()); + assertEquals(0, mySearchEntityDao.count()); + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty()); + + Patient pt2 = new Patient(); + pt2.addName().setFamily("FAM"); + myClient.create().resource(pt2).execute(); + + results = myClient + .search() + .forResource("Patient") + .where(Patient.FAMILY.matches().value("FAM")) + .returnBundle(Bundle.class) + .cacheControl(new CacheControlDirective().setNoStore(true)) + .execute(); + assertEquals(2, results.getEntry().size()); + assertEquals(0, mySearchEntityDao.count()); + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty()); + + } + + @Test + public void testCacheNoStoreMaxResults() throws IOException { + + for (int i = 0; i < 10; i++) { + Patient pt1 = new Patient(); + pt1.addName().setFamily("FAM" + i); + myClient.create().resource(pt1).execute(); + } + + Bundle results = myClient + .search() + .forResource("Patient") + .where(Patient.FAMILY.matches().value("FAM")) + .returnBundle(Bundle.class) + .cacheControl(new CacheControlDirective().setNoStore(true).setMaxResults(5)) + .execute(); + assertEquals(5, results.getEntry().size()); + assertEquals(0, mySearchEntityDao.count()); + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty()); + + } + + @Test + public void testCacheNoStoreMaxResultsWithIllegalValue() throws IOException { + myDaoConfig.setCacheControlNoStoreMaxResultsUpperLimit(123); + try { + myClient + .search() + .forResource("Patient") + .where(Patient.FAMILY.matches().value("FAM")) + .returnBundle(Bundle.class) + .cacheControl(new CacheControlDirective().setNoStore(true).setMaxResults(5000)) + .execute(); + fail(); + } catch (InvalidRequestException e) { + assertEquals("HTTP 400 Bad Request: Cache-Control header max-results value must not exceed 123", e.getMessage()); + } + } + + @Test + public void testCacheSuppressed() throws IOException { + + Patient pt1 = new Patient(); + pt1.addName().setFamily("FAM"); + myClient.create().resource(pt1).execute(); + + Bundle results = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute(); + assertEquals(1, results.getEntry().size()); + assertEquals(1, mySearchEntityDao.count()); + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty()); + + Patient pt2 = new Patient(); + pt2.addName().setFamily("FAM"); + myClient.create().resource(pt2).execute(); + + results = myClient + .search() + .forResource("Patient") + .where(Patient.FAMILY.matches().value("FAM")) + .returnBundle(Bundle.class) + .cacheControl(new CacheControlDirective().setNoCache(true)) + .execute(); + assertEquals(2, results.getEntry().size()); + assertEquals(2, mySearchEntityDao.count()); + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty()); + + } + + @Test + public void testCacheUsedNormally() throws IOException { + + Patient pt1 = new Patient(); + pt1.addName().setFamily("FAM"); + myClient.create().resource(pt1).execute(); + + Date beforeFirst = new Date(); + + Bundle results1 = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute(); + assertEquals(1, results1.getEntry().size()); + assertEquals(1, mySearchEntityDao.count()); + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty()); + assertThat(results1.getMeta().getLastUpdated(), greaterThan(beforeFirst)); + assertThat(results1.getMeta().getLastUpdated(), lessThan(new Date())); + assertThat(results1.getId(), not(blankOrNullString())); + + Patient pt2 = new Patient(); + pt2.addName().setFamily("FAM"); + myClient.create().resource(pt2).execute(); + + Bundle results2 = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute(); + assertEquals(1, results2.getEntry().size()); + assertEquals(1, mySearchEntityDao.count()); + assertEquals("HIT from " + ourServerBase, myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE).get(0)); + assertEquals(results1.getMeta().getLastUpdated(), results2.getMeta().getLastUpdated()); + assertEquals(results1.getId(), results2.getId()); + } + + @AfterClass + public static void afterClassClearContext() { + TestUtil.clearAllStaticFieldsForUnitTest(); + } + +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java index 9b04ff87ed2..a54963a5f6f 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java @@ -40,7 +40,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOnExternalCode() { ResourceProviderR4ValueSetTest.createExternalCs(myCodeSystemDao, myResourceTableDao, myTermSvc, mySrd); - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -59,7 +59,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test assertEquals(false, ((BooleanType)respParam.getParameter().get(2).getValue()).getValue().booleanValue()); // With HTTP GET - respParam = ourClient + respParam = myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -82,7 +82,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test @Test public void testLookupOperationByCodeAndSystemBuiltInCode() { - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -105,7 +105,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByCodeAndSystemBuiltInNonexistantCode() { //@formatter:off try { - ourClient + myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -122,7 +122,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test @Test public void testLookupOperationByCodeAndSystemUserDefinedCode() { //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -146,7 +146,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByCodeAndSystemUserDefinedNonExistantCode() { //@formatter:off try { - ourClient + myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -163,7 +163,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test @Test public void testLookupOperationByCoding() { //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -186,7 +186,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByInvalidCombination() { //@formatter:off try { - ourClient + myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -205,7 +205,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByInvalidCombination2() { //@formatter:off try { - ourClient + myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -223,7 +223,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test public void testLookupOperationByInvalidCombination3() { //@formatter:off try { - ourClient + myClient .operation() .onType(CodeSystem.class) .named("lookup") @@ -240,7 +240,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test // @Ignore public void testLookupOperationForBuiltInCode() { //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onType(CodeSystem.class) .named("lookup") diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java index 9410fb8d2e6..5a458068ef2 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java @@ -1,22 +1,29 @@ package ca.uhn.fhir.jpa.provider.r4; -import static org.apache.commons.lang3.StringUtils.isNotBlank; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.*; -import java.math.BigDecimal; -import java.net.*; -import java.nio.charset.StandardCharsets; -import java.util.*; - +import ca.uhn.fhir.jpa.dao.DaoConfig; +import ca.uhn.fhir.jpa.entity.Search; +import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; +import ca.uhn.fhir.jpa.util.StopWatch; +import ca.uhn.fhir.model.api.TemporalPrecisionEnum; +import ca.uhn.fhir.model.primitive.InstantDt; +import ca.uhn.fhir.model.primitive.UriDt; +import ca.uhn.fhir.parser.IParser; +import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.MethodOutcome; +import ca.uhn.fhir.rest.api.SummaryEnum; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor; +import ca.uhn.fhir.rest.gclient.StringClientParam; +import ca.uhn.fhir.rest.param.*; +import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; +import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; +import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; +import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; +import ca.uhn.fhir.util.TestUtil; +import ca.uhn.fhir.util.UrlUtil; +import com.google.common.collect.Lists; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; @@ -24,8 +31,14 @@ import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.*; -import org.apache.http.entity.*; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; import org.apache.http.message.BasicNameValuePair; +import org.hamcrest.Matchers; +import org.hl7.fhir.instance.model.api.IBaseOperationOutcome; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.*; import org.hl7.fhir.r4.model.Bundle.*; import org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent; @@ -36,36 +49,31 @@ import org.hl7.fhir.r4.model.Observation.ObservationStatus; import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType; import org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType; import org.hl7.fhir.r4.model.Subscription.SubscriptionStatus; -import org.hl7.fhir.instance.model.api.*; import org.junit.*; import org.springframework.test.util.AopTestUtils; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionCallback; -import com.google.common.collect.Lists; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.math.BigDecimal; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketTimeoutException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.*; -import ca.uhn.fhir.jpa.dao.DaoConfig; -import ca.uhn.fhir.jpa.entity.Search; -import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; -import ca.uhn.fhir.model.api.TemporalPrecisionEnum; -import ca.uhn.fhir.model.primitive.InstantDt; -import ca.uhn.fhir.model.primitive.UriDt; -import ca.uhn.fhir.parser.IParser; -import ca.uhn.fhir.parser.StrictErrorHandler; -import ca.uhn.fhir.rest.api.MethodOutcome; -import ca.uhn.fhir.rest.api.SummaryEnum; -import ca.uhn.fhir.rest.client.api.IGenericClient; -import ca.uhn.fhir.rest.gclient.StringClientParam; -import ca.uhn.fhir.rest.param.*; -import ca.uhn.fhir.rest.server.exceptions.*; -import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; -import ca.uhn.fhir.util.TestUtil; -import ca.uhn.fhir.util.UrlUtil; +import static org.apache.commons.lang3.StringUtils.isNotBlank; +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; public class ResourceProviderR4Test extends BaseResourceProviderR4Test { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderR4Test.class); private SearchCoordinatorSvcImpl mySearchCoordinatorSvcRaw; + private CapturingInterceptor myCapturingInterceptor = new CapturingInterceptor(); @Override @After @@ -75,11 +83,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - + myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo()); + mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null); mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(SearchCoordinatorSvcImpl.DEFAULT_SYNC_SIZE); mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(false); + mySearchCoordinatorSvcRaw.cancelAllActiveSearches(); + myClient.unregisterInterceptor(myCapturingInterceptor); } @Override @@ -88,6 +99,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myFhirCtx.setParserErrorHandler(new StrictErrorHandler()); myDaoConfig.setAllowMultipleDelete(true); + myClient.registerInterceptor(myCapturingInterceptor); } @Before @@ -102,8 +114,8 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { IOUtils.closeQuietly(resp.getEntity().getContent()); assertEquals(200, resp.getStatusLine().getStatusCode()); } - - + + private ArrayList genResourcesOfType(Bundle theRes, Class theClass) { ArrayList retVal = new ArrayList(); for (BundleEntryComponent next : theRes.getEntry()) { @@ -123,12 +135,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void saveAndRetrieveBasicResource() throws IOException { String input = IOUtils.toString(getClass().getResourceAsStream("/basic-stu3.xml"), StandardCharsets.UTF_8); - String respString = ourClient.transaction().withBundle(input).prettyPrint().execute(); + String respString = myClient.transaction().withBundle(input).prettyPrint().execute(); ourLog.info(respString); Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, respString); IdType id = new IdType(bundle.getEntry().get(0).getResponse().getLocation()); - Basic basic = ourClient.read().resource(Basic.class).withId(id).execute(); + Basic basic = myClient.read().resource(Basic.class).withId(id).execute(); List exts = basic.getExtensionsByUrl("http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/DateID"); assertEquals(1, exts.size()); } @@ -168,7 +180,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { // Y @Test public void testBundleCreate() throws Exception { - IGenericClient client = ourClient; + IGenericClient client = myClient; String resBody = IOUtils.toString(ResourceProviderR4Test.class.getResource("/r4/document-father.json"), StandardCharsets.UTF_8); IIdType id = client.create().resource(resBody).execute().getId(); @@ -182,7 +194,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testBundleCreateWithTypeTransaction() throws Exception { - IGenericClient client = ourClient; + IGenericClient client = myClient; String resBody = IOUtils.toString(ResourceProviderR4Test.class.getResource("/r4/document-father.json"), StandardCharsets.UTF_8); resBody = resBody.replace("\"type\": \"document\"", "\"type\": \"transaction\""); @@ -200,10 +212,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { subs.setStatus(SubscriptionStatus.ACTIVE); subs.getChannel().setType(SubscriptionChannelType.WEBSOCKET); subs.setCriteria("Observation?"); - IIdType id = ourClient.create().resource(subs).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(subs).execute().getId().toUnqualifiedVersionless(); //@formatter:off - Bundle resp = ourClient + Bundle resp = myClient .search() .forResource(Subscription.class) .where(Subscription.TYPE.exactly().code(SubscriptionChannelType.WEBSOCKET.toCode())) @@ -215,7 +227,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(resp), contains(id)); //@formatter:off - resp = ourClient + resp = myClient .search() .forResource(Subscription.class) .where(Subscription.TYPE.exactly().systemAndCode(SubscriptionChannelType.WEBSOCKET.getSystem(), SubscriptionChannelType.WEBSOCKET.toCode())) @@ -227,7 +239,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(toUnqualifiedVersionlessIds(resp), contains(id)); //@formatter:off - resp = ourClient + resp = myClient .search() .forResource(Subscription.class) .where(Subscription.TYPE.exactly().systemAndCode(SubscriptionChannelType.WEBSOCKET.getSystem(), SubscriptionChannelType.WEBSOCKET.toCode())) @@ -248,13 +260,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("rpdstu2_testCountParam_01"); resources.add(org); } - ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - Bundle found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(10).returnBundle(Bundle.class).execute(); + Bundle found = myClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(10).returnBundle(Bundle.class).execute(); assertEquals(100, found.getTotal()); assertEquals(10, found.getEntry().size()); - found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(999).returnBundle(Bundle.class).execute(); + found = myClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(999).returnBundle(Bundle.class).execute(); assertEquals(100, found.getTotal()); assertEquals(50, found.getEntry().size()); @@ -265,14 +277,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { */ @Test public void testCreateAndUpdateBinary() throws ClientProtocolException, Exception { - byte[] arr = { 1, 21, 74, 123, -44 }; + byte[] arr = {1, 21, 74, 123, -44}; Binary binary = new Binary(); binary.setContent(arr); binary.setContentType("dansk"); - IIdType resource = ourClient.create().resource(binary).execute().getId(); + IIdType resource = myClient.create().resource(binary).execute().getId(); - Binary fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); + Binary fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); assertEquals("1", fromDB.getIdElement().getVersionIdPart()); arr[0] = 2; @@ -286,7 +298,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { IOUtils.closeQuietly(resp); } - fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); + fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); assertEquals("2", fromDB.getIdElement().getVersionIdPart()); arr[0] = 3; @@ -302,7 +314,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { IOUtils.closeQuietly(resp); } - fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); + fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); assertEquals("3", fromDB.getIdElement().getVersionIdPart()); // Now an update with the wrong ID in the body @@ -319,7 +331,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { IOUtils.closeQuietly(resp); } - fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); + fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute(); assertEquals("3", fromDB.getIdElement().getVersionIdPart()); } @@ -331,7 +343,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testCreateBundle() throws IOException { String input = IOUtils.toString(getClass().getResourceAsStream("/bryn-bundle.json"), StandardCharsets.UTF_8); Validate.notNull(input); - ourClient.create().resource(input).execute().getResource(); + myClient.create().resource(input).execute().getResource(); } @Test @@ -340,13 +352,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - MethodOutcome output1 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); + MethodOutcome output1 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.addName().setFamily("Tester").addGiven("Raghad"); - MethodOutcome output2 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); + MethodOutcome output2 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute(); assertEquals(output1.getId().getIdPart(), output2.getId().getIdPart()); } @@ -362,7 +374,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { // Missing status, which is mandatory Observation obs = new Observation(); obs.addIdentifier().setSystem("urn:foo").setValue("bar"); - IBaseResource outcome = ourClient.create().resource(obs).execute().getOperationOutcome(); + IBaseResource outcome = myClient.create().resource(obs).execute().getOperationOutcome(); String encodedOo = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome); ourLog.info(encodedOo); @@ -370,7 +382,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(encodedOo, containsString("Successfully created resource \\\"Observation/")); interceptor.setAddValidationResultsToResponseOperationOutcome(false); - outcome = ourClient.create().resource(obs).execute().getOperationOutcome(); + outcome = myClient.create().resource(obs).execute().getOperationOutcome(); encodedOo = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome); ourLog.info(encodedOo); assertThat(encodedOo, not(containsString("cvc-complex-type.2.4.b"))); @@ -387,15 +399,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { CodeSystem cs = new CodeSystem(); cs.setUrl("http://urn/system"); cs.addConcept().setCode("code0"); - ourClient.create().resource(cs).execute(); + myClient.create().resource(cs).execute(); ValueSet options = new ValueSet(); options.getCompose().addInclude().setSystem("http://urn/system"); - IIdType optId = ourClient.create().resource(options).execute().getId(); + 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)); - IIdType qId = ourClient.create().resource(q).execute().getId(); + IIdType qId = myClient.create().resource(q).execute().getId(); QuestionnaireResponse qa; @@ -404,7 +416,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { qa = new QuestionnaireResponse(); qa.getQuestionnaire().setReference(qId.toUnqualifiedVersionless().getValue()); qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setSystem("urn:system").setCode("code0")); - ourClient.create().resource(qa).execute(); + myClient.create().resource(qa).execute(); // Bad code @@ -412,7 +424,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { qa.getQuestionnaire().setReference(qId.toUnqualifiedVersionless().getValue()); qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setSystem("urn:system").setCode("code1")); try { - ourClient.create().resource(qa).execute(); + myClient.create().resource(qa).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Question with linkId[link0]")); @@ -488,7 +500,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } // //@formatter:off -// IIdType id3 = ourClient +// IIdType id3 = myClient // .update() // .resource(pt) // .conditionalByUrl("Patient?identifier=http://general-hospital.co.uk/Identifiers|09832345234543876876") @@ -532,14 +544,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals(400, response.getStatusLine().getStatusCode()); OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, responseString); assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)", - oo.getIssue().get(0).getDiagnostics()); + oo.getIssue().get(0).getDiagnostics()); } finally { response.getEntity().getContent().close(); response.close(); } } - + @Test public void testCreateWithForcedId() throws IOException { String methodName = "testCreateWithForcedId"; @@ -548,7 +560,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p.addName().setFamily(methodName); p.setId(methodName); - IIdType optId = ourClient.update().resource(p).execute().getId(); + IIdType optId = myClient.update().resource(p).execute().getId(); assertEquals(methodName, optId.getIdPart()); assertEquals("1", optId.getVersionIdPart()); } @@ -557,12 +569,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testDeepChaining() { Location l1 = new Location(); l1.getNameElement().setValue("testDeepChainingL1"); - IIdType l1id = ourClient.create().resource(l1).execute().getId(); + IIdType l1id = myClient.create().resource(l1).execute().getId(); Location l2 = new Location(); l2.getNameElement().setValue("testDeepChainingL2"); l2.getPartOf().setReferenceElement(l1id.toVersionless().toUnqualified()); - IIdType l2id = ourClient.create().resource(l2).execute().getId(); + IIdType l2id = myClient.create().resource(l2).execute().getId(); Encounter e1 = new Encounter(); e1.addIdentifier().setSystem("urn:foo").setValue("testDeepChainingE1"); @@ -570,10 +582,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { EncounterLocationComponent location = e1.addLocation(); location.getLocation().setReferenceElement(l2id.toUnqualifiedVersionless()); location.setPeriod(new Period().setStart(new Date(), TemporalPrecisionEnum.SECOND).setEnd(new Date(), TemporalPrecisionEnum.SECOND)); - IIdType e1id = ourClient.create().resource(e1).execute().getId(); + IIdType e1id = myClient.create().resource(e1).execute().getId(); //@formatter:off - Bundle res = ourClient.search() + Bundle res = myClient.search() .forResource(Encounter.class) .where(Encounter.IDENTIFIER.exactly().systemAndCode("urn:foo", "testDeepChainingE1")) .include(Encounter.INCLUDE_LOCATION.asRecursive()) @@ -606,7 +618,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { try { //@formatter:off - ourClient + myClient .delete() .resourceConditionalByType(Patient.class) .where(Patient.IDENTIFIER.exactly().code(methodName)) @@ -615,17 +627,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { fail(); } catch (PreconditionFailedException e) { assertEquals("HTTP 412 Precondition Failed: Failed to DELETE resource with match URL \"Patient?identifier=testDeleteConditionalMultiple\" because this search matched 2 resources", - e.getMessage()); + e.getMessage()); } // Not deleted yet.. - ourClient.read().resource("Patient").withId(id1).execute(); - ourClient.read().resource("Patient").withId(id2).execute(); + myClient.read().resource("Patient").withId(id1).execute(); + myClient.read().resource("Patient").withId(id2).execute(); myDaoConfig.setAllowMultipleDelete(true); //@formatter:off - IBaseOperationOutcome response = ourClient + IBaseOperationOutcome response = myClient .delete() .resourceConditionalByType(Patient.class) .where(Patient.IDENTIFIER.exactly().code(methodName)) @@ -635,15 +647,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { String encoded = myFhirCtx.newXmlParser().encodeResourceToString(response); ourLog.info(encoded); assertThat(encoded, containsString( - "")); + "")); } finally { IOUtils.closeQuietly(resp); } @@ -690,14 +702,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testDeleteNormal() { Patient p = new Patient(); p.addName().setFamily("FAM"); - IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); - ourClient.read().resource(Patient.class).withId(id).execute(); + myClient.read().resource(Patient.class).withId(id).execute(); - ourClient.delete().resourceById(id).execute(); + myClient.delete().resourceById(id).execute(); try { - ourClient.read().resource(Patient.class).withId(id).execute(); + myClient.read().resource(Patient.class).withId(id).execute(); fail(); } catch (ResourceGoneException e) { // good @@ -836,9 +848,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testDeleteReturnsOperationOutcome() { Patient p = new Patient(); p.addName().setFamily("FAM"); - IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); - IBaseOperationOutcome resp = ourClient.delete().resourceById(id).execute(); + IBaseOperationOutcome resp = myClient.delete().resourceById(id).execute(); OperationOutcome oo = (OperationOutcome) resp; assertThat(oo.getIssueFirstRep().getDiagnostics(), startsWith("Successfully deleted 1 resource(s) in ")); } @@ -851,7 +863,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myFhirCtx.getResourceDefinition(Practitioner.class); myFhirCtx.getResourceDefinition(DocumentManifest.class); - IGenericClient client = ourClient; + IGenericClient client = myClient; int initialSize = client.search().forResource(DocumentManifest.class).returnBundle(Bundle.class).execute().getEntry().size(); @@ -869,7 +881,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { */ @Test public void testDocumentReferenceResources() throws Exception { - IGenericClient client = ourClient; + IGenericClient client = myClient; int initialSize = client.search().forResource(DocumentReference.class).returnBundle(Bundle.class).execute().getEntry().size(); @@ -886,13 +898,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testEmptySearch() throws Exception { Bundle responseBundle; - responseBundle = ourClient.search().forResource(Patient.class).returnBundle(Bundle.class).execute(); + responseBundle = myClient.search().forResource(Patient.class).returnBundle(Bundle.class).execute(); assertEquals(0, responseBundle.getTotal()); - responseBundle = ourClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("AAA")).returnBundle(Bundle.class).execute(); + responseBundle = myClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("AAA")).returnBundle(Bundle.class).execute(); assertEquals(0, responseBundle.getTotal()); - responseBundle = ourClient.search().forResource(Patient.class).where(new StringClientParam("_content").matches().value("AAA")).returnBundle(Bundle.class).execute(); + responseBundle = myClient.search().forResource(Patient.class).where(new StringClientParam("_content").matches().value("AAA")).returnBundle(Bundle.class).execute(); assertEquals(0, responseBundle.getTotal()); } @@ -904,55 +916,55 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization org1parent = new Organization(); org1parent.setId("org1parent"); org1parent.setName(methodName + "1parent"); - IIdType orgId1parent = ourClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1parent = myClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); Organization org1 = new Organization(); org1.setName(methodName + "1"); org1.getPartOf().setReferenceElement(orgId1parent); - IIdType orgId1 = ourClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1 = myClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); Patient p = new Patient(); p.addName().setFamily(methodName); p.getManagingOrganization().setReferenceElement(orgId1); - IIdType patientId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType patientId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); Organization org2 = new Organization(); org2.setName(methodName + "1"); - IIdType orgId2 = ourClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); + IIdType orgId2 = myClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); Device dev = new Device(); dev.setModel(methodName); dev.getOwner().setReferenceElement(orgId2); - IIdType devId = ourClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); + IIdType devId = myClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); Location locParent = new Location(); locParent.setName(methodName + "Parent"); - IIdType locPId = ourClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless(); + IIdType locPId = myClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless(); Location locChild = new Location(); locChild.setName(methodName); locChild.getPartOf().setReferenceElement(locPId); - IIdType locCId = ourClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless(); + IIdType locCId = myClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless(); Encounter encU = new Encounter(); encU.getSubject().setReferenceElement(patientId); encU.addLocation().getLocation().setReferenceElement(locCId); - IIdType encUId = ourClient.create().resource(encU).execute().getId().toUnqualifiedVersionless(); + IIdType encUId = myClient.create().resource(encU).execute().getId().toUnqualifiedVersionless(); Encounter enc = new Encounter(); enc.getSubject().setReferenceElement(patientId); enc.addLocation().getLocation().setReferenceElement(locCId); - IIdType encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); + IIdType encId = myClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); Observation obs = new Observation(); obs.getSubject().setReferenceElement(patientId); obs.getDevice().setReferenceElement(devId); obs.getContext().setReferenceElement(encId); - IIdType obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); + IIdType obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); ourLog.info("IDs: EncU:" + encUId.getIdPart() + " Enc:" + encId.getIdPart() + " " + patientId.toUnqualifiedVersionless()); - Parameters output = ourClient.operation().onInstance(encId).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = myClient.operation().onInstance(encId).named("everything").withNoParameters(Parameters.class).execute(); Bundle b = (Bundle) output.getParameter().get(0).getResource(); List ids = toUnqualifiedVersionlessIds(b); assertThat(ids, containsInAnyOrder(patientId, encId, orgId1, orgId2, orgId1parent, locPId, locCId, obsId, devId)); @@ -968,52 +980,52 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization org1parent = new Organization(); org1parent.setId("org1parent"); org1parent.setName(methodName + "1parent"); - IIdType orgId1parent = ourClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1parent = myClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); Organization org1 = new Organization(); org1.setName(methodName + "1"); org1.getPartOf().setReferenceElement(orgId1parent); - IIdType orgId1 = ourClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1 = myClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); Patient p = new Patient(); p.addName().setFamily(methodName); p.getManagingOrganization().setReferenceElement(orgId1); - IIdType patientId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType patientId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); Organization org2 = new Organization(); org2.setName(methodName + "1"); - IIdType orgId2 = ourClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); + IIdType orgId2 = myClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); Device dev = new Device(); dev.setModel(methodName); dev.getOwner().setReferenceElement(orgId2); - IIdType devId = ourClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); + IIdType devId = myClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); Location locParent = new Location(); locParent.setName(methodName + "Parent"); - IIdType locPId = ourClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless(); + IIdType locPId = myClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless(); Location locChild = new Location(); locChild.setName(methodName); locChild.getPartOf().setReferenceElement(locPId); - IIdType locCId = ourClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless(); + IIdType locCId = myClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless(); Encounter encU = new Encounter(); encU.addIdentifier().setValue(methodName); - IIdType encUId = ourClient.create().resource(encU).execute().getId().toUnqualifiedVersionless(); + IIdType encUId = myClient.create().resource(encU).execute().getId().toUnqualifiedVersionless(); Encounter enc = new Encounter(); enc.getSubject().setReferenceElement(patientId); enc.addLocation().getLocation().setReferenceElement(locCId); - IIdType encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); + IIdType encId = myClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); Observation obs = new Observation(); obs.getSubject().setReferenceElement(patientId); obs.getDevice().setReferenceElement(devId); obs.getContext().setReferenceElement(encId); - IIdType obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); + IIdType obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); - Parameters output = ourClient.operation().onType(Encounter.class).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = myClient.operation().onType(Encounter.class).named("everything").withNoParameters(Parameters.class).execute(); Bundle b = (Bundle) output.getParameter().get(0).getResource(); List ids = toUnqualifiedVersionlessIds(b); assertThat(ids, containsInAnyOrder(patientId, encUId, encId, orgId1, orgId2, orgId1parent, locPId, locCId, obsId, devId)); @@ -1062,13 +1074,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { List actual; StringAndListParam param; - ourLog.info("Pt1:{} Pt2:{} Obs1:{} Obs2:{} Obs3:{}", new Object[] { ptId1.getIdPart(), ptId2.getIdPart(), obsId1.getIdPart(), obsId2.getIdPart(), obsId3.getIdPart() }); + ourLog.info("Pt1:{} Pt2:{} Obs1:{} Obs2:{} Obs3:{}", new Object[]{ptId1.getIdPart(), ptId2.getIdPart(), obsId1.getIdPart(), obsId2.getIdPart(), obsId3.getIdPart()}); param = new StringAndListParam(); param.addAnd(new StringOrListParam().addOr(new StringParam("obsvalue1"))); //@formatter:off - Parameters response = ourClient + Parameters response = myClient .operation() .onInstance(ptId1) .named("everything") @@ -1090,7 +1102,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { IParser parser = myFhirCtx.newJsonParser(); b = parser.parseResource(Bundle.class, new InputStreamReader(ResourceProviderR4Test.class.getResourceAsStream("/r4/bug147-bundle.json"))); - Bundle resp = ourClient.transaction().withBundle(b).execute(); + Bundle resp = myClient.transaction().withBundle(b).execute(); List ids = new ArrayList(); for (BundleEntryComponent next : resp.getEntry()) { IdType toAdd = new IdType(next.getResponse().getLocation()).toUnqualifiedVersionless(); @@ -1102,7 +1114,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals("Patient", patientId.getResourceType()); { - Parameters output = ourClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = myClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); b = (Bundle) output.getParameter().get(0).getResource(); ids = new ArrayList(); @@ -1123,7 +1135,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { { Parameters input = new Parameters(); input.addParameter().setName(Constants.PARAM_COUNT).setValue(new UnsignedIntType(100)); - Parameters output = ourClient.operation().onInstance(patientId).named("everything").withParameters(input).execute(); + Parameters output = myClient.operation().onInstance(patientId).named("everything").withParameters(input).execute(); b = (Bundle) output.getParameter().get(0).getResource(); ids = new ArrayList(); @@ -1161,7 +1173,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { mo.setMedication(new Reference(medId)); IIdType moId = myMedicationRequestDao.create(mo, mySrd).getId().toUnqualifiedVersionless(); - Parameters output = ourClient.operation().onInstance(patId).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = myClient.operation().onInstance(patId).named("everything").withNoParameters(Parameters.class).execute(); Bundle b = (Bundle) output.getParameter().get(0).getResource(); List ids = toUnqualifiedVersionlessIds(b); ourLog.info(ids.toString()); @@ -1182,14 +1194,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { c.getSubject().setReference("Patient/1"); b.addEntry().setResource(c).getRequest().setMethod(HTTPVerb.POST); - Bundle resp = ourClient.transaction().withBundle(b).execute(); + Bundle resp = myClient.transaction().withBundle(b).execute(); ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(resp)); IdType patientId = new IdType(resp.getEntry().get(0).getResponse().getLocation()); assertEquals("Patient", patientId.getResourceType()); - Parameters output = ourClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = myClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); b = (Bundle) output.getParameter().get(0).getResource(); List ids = new ArrayList(); @@ -1210,37 +1222,37 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization org1parent = new Organization(); org1parent.setId("org1parent"); org1parent.setName(methodName + "1parent"); - IIdType orgId1parent = ourClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1parent = myClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless(); Organization org1 = new Organization(); org1.setName(methodName + "1"); org1.getPartOf().setReferenceElement(orgId1parent); - IIdType orgId1 = ourClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); + IIdType orgId1 = myClient.create().resource(org1).execute().getId().toUnqualifiedVersionless(); Patient p = new Patient(); p.addName().setFamily(methodName); p.getManagingOrganization().setReferenceElement(orgId1); - IIdType patientId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType patientId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); Organization org2 = new Organization(); org2.setName(methodName + "1"); - IIdType orgId2 = ourClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); + IIdType orgId2 = myClient.create().resource(org2).execute().getId().toUnqualifiedVersionless(); Device dev = new Device(); dev.setModel(methodName); dev.getOwner().setReferenceElement(orgId2); - IIdType devId = ourClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); + IIdType devId = myClient.create().resource(dev).execute().getId().toUnqualifiedVersionless(); Observation obs = new Observation(); obs.getSubject().setReferenceElement(patientId); obs.getDevice().setReferenceElement(devId); - IIdType obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); + IIdType obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless(); Encounter enc = new Encounter(); enc.getSubject().setReferenceElement(patientId); - IIdType encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); + IIdType encId = myClient.create().resource(enc).execute().getId().toUnqualifiedVersionless(); - Parameters output = ourClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = myClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute(); Bundle b = (Bundle) output.getParameter().get(0).getResource(); List ids = toUnqualifiedVersionlessIds(b); assertThat(ids, containsInAnyOrder(patientId, devId, obsId, encId, orgId1, orgId2, orgId1parent)); @@ -1254,32 +1266,32 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization o1 = new Organization(); o1.setName(methodName + "1"); - IIdType o1Id = ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); + IIdType o1Id = myClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); Organization o2 = new Organization(); o2.setName(methodName + "2"); - IIdType o2Id = ourClient.create().resource(o2).execute().getId().toUnqualifiedVersionless(); + IIdType o2Id = myClient.create().resource(o2).execute().getId().toUnqualifiedVersionless(); Patient p1 = new Patient(); p1.addName().setFamily(methodName + "1"); p1.getManagingOrganization().setReferenceElement(o1Id); - IIdType p1Id = ourClient.create().resource(p1).execute().getId().toUnqualifiedVersionless(); + IIdType p1Id = myClient.create().resource(p1).execute().getId().toUnqualifiedVersionless(); Patient p2 = new Patient(); p2.addName().setFamily(methodName + "2"); p2.getManagingOrganization().setReferenceElement(o2Id); - IIdType p2Id = ourClient.create().resource(p2).execute().getId().toUnqualifiedVersionless(); + IIdType p2Id = myClient.create().resource(p2).execute().getId().toUnqualifiedVersionless(); Condition c1 = new Condition(); c1.getSubject().setReferenceElement(p1Id); - IIdType c1Id = ourClient.create().resource(c1).execute().getId().toUnqualifiedVersionless(); + IIdType c1Id = myClient.create().resource(c1).execute().getId().toUnqualifiedVersionless(); Condition c2 = new Condition(); c2.getSubject().setReferenceElement(p2Id); - IIdType c2Id = ourClient.create().resource(c2).execute().getId().toUnqualifiedVersionless(); + IIdType c2Id = myClient.create().resource(c2).execute().getId().toUnqualifiedVersionless(); Condition c3 = new Condition(); c3.addIdentifier().setValue(methodName + "3"); - IIdType c3Id = ourClient.create().resource(c3).execute().getId().toUnqualifiedVersionless(); + IIdType c3Id = myClient.create().resource(c3).execute().getId().toUnqualifiedVersionless(); - Parameters output = ourClient.operation().onType(Patient.class).named("everything").withNoParameters(Parameters.class).execute(); + Parameters output = myClient.operation().onType(Patient.class).named("everything").withNoParameters(Parameters.class).execute(); Bundle b = (Bundle) output.getParameter().get(0).getResource(); assertEquals(BundleType.SEARCHSET, b.getType()); @@ -1296,7 +1308,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization org = new Organization(); org.setName(methodName); - IIdType oId = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); + IIdType oId = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); long time1 = System.currentTimeMillis(); Thread.sleep(10); @@ -1304,7 +1316,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p = new Patient(); p.addName().setFamily(methodName); p.getManagingOrganization().setReferenceElement(oId); - IIdType pId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType pId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); long time2 = System.currentTimeMillis(); Thread.sleep(10); @@ -1312,7 +1324,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Condition c = new Condition(); c.getCode().setText(methodName); c.getSubject().setReferenceElement(pId); - IIdType cId = ourClient.create().resource(c).execute().getId().toUnqualifiedVersionless(); + IIdType cId = myClient.create().resource(c).execute().getId().toUnqualifiedVersionless(); Thread.sleep(10); long time3 = System.currentTimeMillis(); @@ -1334,7 +1346,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } get = new HttpGet(ourServerBase + "/Patient/" + pId.getIdPart() + "/$everything?_lastUpdated=%3E" + new InstantType(new Date(time2)).getValueAsString() + "&_lastUpdated=%3C" - + new InstantType(new Date(time3)).getValueAsString()); + + new InstantType(new Date(time3)).getValueAsString()); response = ourHttpClient.execute(get); try { assertEquals(200, response.getStatusLine().getStatusCode()); @@ -1406,14 +1418,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { mySystemDao.transaction(mySrd, inputBundle); - Bundle responseBundle = ourClient - .operation() - .onInstance(new IdType("Patient/A161443")) - .named("everything") - .withParameter(Parameters.class, "_count", new IntegerType(20)) - .useHttpGet() - .returnResourceType(Bundle.class) - .execute(); + Bundle responseBundle = myClient + .operation() + .onInstance(new IdType("Patient/A161443")) + .named("everything") + .withParameter(Parameters.class, "_count", new IntegerType(20)) + .useHttpGet() + .returnResourceType(Bundle.class) + .execute(); ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(responseBundle)); @@ -1434,7 +1446,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } String nextUrl = responseBundle.getLink("next").getUrl(); - responseBundle = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); + responseBundle = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); for (int i = 0; i < responseBundle.getEntry().size(); i++) { for (BundleEntryComponent nextEntry : responseBundle.getEntry()) { idsSet.add(nextEntry.getResource().getIdElement().toUnqualifiedVersionless().getValue()); @@ -1442,7 +1454,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } nextUrl = responseBundle.getLink("next").getUrl(); - responseBundle = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); + responseBundle = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); for (int i = 0; i < responseBundle.getEntry().size(); i++) { for (BundleEntryComponent nextEntry : responseBundle.getEntry()) { idsSet.add(nextEntry.getResource().getIdElement().toUnqualifiedVersionless().getValue()); @@ -1468,17 +1480,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testEverythingWithLargeSet2() throws Exception { Patient p = new Patient(); p.setActive(true); - IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); for (int i = 1; i < 77; i++) { Observation obs = new Observation(); obs.setId("A" + StringUtils.leftPad(Integer.toString(i), 2, '0')); obs.setSubject(new Reference(id)); - ourClient.update().resource(obs).execute(); + myClient.update().resource(obs).execute(); } - Bundle responseBundle = ourClient.operation().onInstance(id).named("everything").withParameter(Parameters.class, "_count", new IntegerType(50)).useHttpGet().returnResourceType(Bundle.class) - .execute(); + Bundle responseBundle = myClient.operation().onInstance(id).named("everything").withParameter(Parameters.class, "_count", new IntegerType(50)).useHttpGet().returnResourceType(Bundle.class) + .execute(); TreeSet ids = new TreeSet(); for (int i = 0; i < responseBundle.getEntry().size(); i++) { @@ -1492,7 +1504,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { BundleLinkComponent nextLink = responseBundle.getLink("next"); while (nextLink != null) { String nextUrl = nextLink.getUrl(); - responseBundle = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); + responseBundle = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); for (int i = 0; i < responseBundle.getEntry().size(); i++) { for (BundleEntryComponent nextEntry : responseBundle.getEntry()) { ids.add(nextEntry.getResource().getIdElement().getIdPart()); @@ -1514,17 +1526,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testEverythingWithOnlyPatient() { Patient p = new Patient(); p.setActive(true); - IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); myFhirCtx.getRestfulClientFactory().setSocketTimeout(300 * 1000); - Bundle response = ourClient - .operation() - .onInstance(id) - .named("everything") - .withNoParameters(Parameters.class) - .returnResourceType(Bundle.class) - .execute(); + Bundle response = myClient + .operation() + .onInstance(id) + .named("everything") + .withNoParameters(Parameters.class) + .returnResourceType(Bundle.class) + .execute(); assertEquals(1, response.getEntry().size()); } @@ -1557,38 +1569,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } } - // private void delete(String theResourceType, String theParamName, String theParamValue) { - // Bundle resources; - // do { - // IQuery forResource = ourClient.search().forResource(theResourceType); - // if (theParamName != null) { - // forResource = forResource.where(new StringClientParam(theParamName).matches().value(theParamValue)); - // } - // resources = forResource.execute(); - // for (IResource next : resources.toListOfResources()) { - // ourLog.info("Deleting resource: {}", next.getId()); - // ourClient.delete().resource(next).execute(); - // } - // } while (resources.size() > 0); - // } - // - // private void deleteToken(String theResourceType, String theParamName, String theParamSystem, String theParamValue) - // { - // Bundle resources = ourClient.search().forResource(theResourceType).where(new - // TokenClientParam(theParamName).exactly().systemAndCode(theParamSystem, theParamValue)).execute(); - // for (IResource next : resources.toListOfResources()) { - // ourLog.info("Deleting resource: {}", next.getId()); - // ourClient.delete().resource(next).execute(); - // } - // } - @Test public void testGetResourceCountsOperation() throws Exception { String methodName = "testMetaOperations"; Patient pt = new Patient(); pt.addName().setFamily(methodName); - ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); + myClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); HttpGet get = new HttpGet(ourServerBase + "/$get-resource-counts"); CloseableHttpResponse response = ourHttpClient.execute(get); @@ -1603,6 +1590,31 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } } + // private void delete(String theResourceType, String theParamName, String theParamValue) { + // Bundle resources; + // do { + // IQuery forResource = myClient.search().forResource(theResourceType); + // if (theParamName != null) { + // forResource = forResource.where(new StringClientParam(theParamName).matches().value(theParamValue)); + // } + // resources = forResource.execute(); + // for (IResource next : resources.toListOfResources()) { + // ourLog.info("Deleting resource: {}", next.getId()); + // myClient.delete().resource(next).execute(); + // } + // } while (resources.size() > 0); + // } + // + // private void deleteToken(String theResourceType, String theParamName, String theParamSystem, String theParamValue) + // { + // Bundle resources = myClient.search().forResource(theResourceType).where(new + // TokenClientParam(theParamName).exactly().systemAndCode(theParamSystem, theParamValue)).execute(); + // for (IResource next : resources.toListOfResources()) { + // ourLog.info("Deleting resource: {}", next.getId()); + // myClient.delete().resource(next).execute(); + // } + // } + @Test public void testHasParameter() throws Exception { IIdType pid0; @@ -1639,7 +1651,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { List ids = searchAndReturnUnqualifiedVersionlessIdValues(uri); assertThat(ids, contains(pid0.getValue())); } - + @Test public void testHasParameterNoResults() throws Exception { @@ -1704,12 +1716,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient patient = new Patient(); patient.addName().setFamily(methodName); - IIdType id = ourClient.create().resource(patient).execute().getId().toVersionless(); - ourClient.delete().resourceById(id).execute(); + IIdType id = myClient.create().resource(patient).execute().getId().toVersionless(); + myClient.delete().resourceById(id).execute(); patient.setId(id); - ourClient.update().resource(patient).execute(); + myClient.update().resource(patient).execute(); - Bundle history = ourClient.history().onInstance(id).andReturnBundle(Bundle.class).prettyPrint().summaryMode(SummaryEnum.DATA).execute(); + Bundle history = myClient.history().onInstance(id).andReturnBundle(Bundle.class).prettyPrint().summaryMode(SummaryEnum.DATA).execute(); assertEquals(3, history.getEntry().size()); assertEquals(id.withVersion("3").getValue(), history.getEntry().get(0).getResource().getId()); assertEquals(1, ((Patient) history.getEntry().get(0).getResource()).getName().size()); @@ -1810,9 +1822,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals(400, response.getStatusLine().getStatusCode()); OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, respString); assertEquals( - "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"AAA\" does not match URL ID of \"" - + id.getIdPart() + "\"", - oo.getIssue().get(0).getDiagnostics()); + "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"AAA\" does not match URL ID of \"" + + id.getIdPart() + "\"", + oo.getIssue().get(0).getDiagnostics()); } finally { response.close(); } @@ -1824,7 +1836,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { */ @Test public void testImagingStudyResources() throws Exception { - IGenericClient client = ourClient; + IGenericClient client = myClient; int initialSize = client.search().forResource(ImagingStudy.class).returnBundle(Bundle.class).execute().getEntry().size(); @@ -1843,9 +1855,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/Organization/123"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); - Bundle b = ourClient.search().forResource("Patient").include(Patient.INCLUDE_ORGANIZATION).returnBundle(Bundle.class).execute(); + Bundle b = myClient.search().forResource("Patient").include(Patient.INCLUDE_ORGANIZATION).returnBundle(Bundle.class).execute(); assertEquals(1, b.getEntry().size()); } @@ -1853,18 +1865,18 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testMetaOperationWithNoMetaParameter() throws Exception { Patient p = new Patient(); p.addName().setFamily("testMetaAddInvalid"); - IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); //@formatter:off String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; //@formatter:on HttpPost post = new HttpPost(ourServerBase + "/Patient/" + id.getIdPart() + "/$meta-add"); @@ -1899,19 +1911,19 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient pt = new Patient(); pt.addName().setFamily(methodName); - IIdType id = ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); - Meta meta = ourClient.meta().get(Meta.class).fromResource(id).execute(); + Meta meta = myClient.meta().get(Meta.class).fromResource(id).execute(); assertEquals(0, meta.getTag().size()); Meta inMeta = new Meta(); inMeta.addTag().setSystem("urn:system1").setCode("urn:code1"); - meta = ourClient.meta().add().onResource(id).meta(inMeta).execute(); + meta = myClient.meta().add().onResource(id).meta(inMeta).execute(); assertEquals(1, meta.getTag().size()); inMeta = new Meta(); inMeta.addTag().setSystem("urn:system1").setCode("urn:code1"); - meta = ourClient.meta().delete().onResource(id).meta(inMeta).execute(); + meta = myClient.meta().delete().onResource(id).meta(inMeta).execute(); assertEquals(0, meta.getTag().size()); } @@ -1937,14 +1949,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { StructureDefinition p = new StructureDefinition(); p.setAbstract(true); p.setUrl("http://example.com/foo"); - IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); - Bundle resp = ourClient - .search() - .forResource(StructureDefinition.class) - .where(StructureDefinition.URL.matches().value("http://example.com/foo")) - .returnBundle(Bundle.class) - .execute(); + Bundle resp = myClient + .search() + .forResource(StructureDefinition.class) + .where(StructureDefinition.URL.matches().value("http://example.com/foo")) + .returnBundle(Bundle.class) + .execute(); assertEquals(1, resp.getTotal()); } @@ -1966,7 +1978,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10); mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true); - Bundle response = ourClient + Bundle response = myClient .operation() .onInstance(new IdType(pid)) .named("everything") @@ -1984,7 +1996,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { // Load page 2 String nextUrl = response.getLink("next").getUrl(); - response = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); + response = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); assertEquals(10, response.getEntry().size()); if (response.getTotalElement().getValueAsString() != null) { @@ -1996,7 +2008,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Thread.sleep(2000); nextUrl = response.getLink("next").getUrl(); - response = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl); + response = myClient.fetchResourceFromUrl(Bundle.class, nextUrl); assertEquals(1, response.getEntry().size()); assertEquals("21", response.getTotalElement().getValueAsString()); @@ -2023,7 +2035,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10); mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true); - Bundle response = ourClient + Bundle response = myClient .operation() .onInstance(new IdType(pid)) .named("everything") @@ -2063,7 +2075,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { response.close(); } - Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); + Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); assertEquals("2", newPt.getIdElement().getVersionIdPart()); assertEquals(false, newPt.getActive()); } @@ -2094,7 +2106,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { response.close(); } - Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); + Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); assertEquals("1", newPt.getIdElement().getVersionIdPart()); assertEquals(true, newPt.getActive()); } @@ -2125,7 +2137,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { response.close(); } - Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); + Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); assertEquals("2", newPt.getIdElement().getVersionIdPart()); assertEquals(false, newPt.getActive()); } @@ -2156,7 +2168,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { response.close(); } - Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); + Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute(); assertEquals("2", newPt.getIdElement().getVersionIdPart()); assertEquals(false, newPt.getActive()); } @@ -2165,25 +2177,25 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testPreserveVersionsOnAuditEvent() { Organization org = new Organization(); org.setName("ORG"); - IIdType orgId = ourClient.create().resource(org).execute().getId(); + IIdType orgId = myClient.create().resource(org).execute().getId(); assertEquals("1", orgId.getVersionIdPart()); Patient patient = new Patient(); patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100"); patient.getManagingOrganization().setReference(orgId.toUnqualified().getValue()); - IIdType patientId = ourClient.create().resource(patient).execute().getId(); + IIdType patientId = myClient.create().resource(patient).execute().getId(); assertEquals("1", patientId.getVersionIdPart()); AuditEvent ae = new org.hl7.fhir.r4.model.AuditEvent(); ae.addEntity().getReference().setReference(patientId.toUnqualified().getValue()); - IIdType aeId = ourClient.create().resource(ae).execute().getId(); + IIdType aeId = myClient.create().resource(ae).execute().getId(); assertEquals("1", aeId.getVersionIdPart()); - patient = ourClient.read().resource(Patient.class).withId(patientId).execute(); + patient = myClient.read().resource(Patient.class).withId(patientId).execute(); assertTrue(patient.getManagingOrganization().getReferenceElement().hasIdPart()); assertFalse(patient.getManagingOrganization().getReferenceElement().hasVersionIdPart()); - ae = ourClient.read().resource(AuditEvent.class).withId(aeId).execute(); + ae = myClient.read().resource(AuditEvent.class).withId(aeId).execute(); assertTrue(ae.getEntityFirstRep().getReference().getReferenceElement().hasIdPart()); assertTrue(ae.getEntityFirstRep().getReference().getReferenceElement().hasVersionIdPart()); @@ -2194,7 +2206,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { */ @Test public void testProcedureRequestResources() throws Exception { - IGenericClient client = ourClient; + IGenericClient client = myClient; int initialSize = client.search().forResource(ProcedureRequest.class).returnBundle(Bundle.class).execute().getEntry().size(); @@ -2218,19 +2230,19 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { pat = new Patient(); pat.addIdentifier().setSystem("urn:system").setValue("testReadAllInstancesOfType_01"); - ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); + myClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); pat = new Patient(); pat.addIdentifier().setSystem("urn:system").setValue("testReadAllInstancesOfType_02"); - ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); + myClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); { - Bundle returned = ourClient.search().forResource(Patient.class).encodedXml().returnBundle(Bundle.class).execute(); + Bundle returned = myClient.search().forResource(Patient.class).encodedXml().returnBundle(Bundle.class).execute(); assertThat(returned.getEntry().size(), greaterThan(1)); assertEquals(BundleType.SEARCHSET, returned.getType()); } { - Bundle returned = ourClient.search().forResource(Patient.class).encodedJson().returnBundle(Bundle.class).execute(); + Bundle returned = myClient.search().forResource(Patient.class).encodedJson().returnBundle(Bundle.class).execute(); assertThat(returned.getEntry().size(), greaterThan(1)); } } @@ -2242,9 +2254,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.getText().getDiv().setValueAsString("
HELLO WORLD
"); p1.addIdentifier().setSystem("urn:system").setValue("testSaveAndRetrieveExistingNarrative01"); - IIdType newId = ourClient.create().resource(p1).encodedJson().execute().getId(); + IIdType newId = myClient.create().resource(p1).encodedJson().execute().getId(); - Patient actual = ourClient.read().resource(Patient.class).withId(newId).encodedJson().execute(); + Patient actual = myClient.read().resource(Patient.class).withId(newId).encodedJson().execute(); assertEquals("
HELLO WORLD
", actual.getText().getDiv().getValueAsString()); } @@ -2255,9 +2267,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.getText().getDiv().setValueAsString("
HELLO WORLD
"); p1.addIdentifier().setSystem("urn:system").setValue("testSaveAndRetrieveExistingNarrative01"); - IIdType newId = ourClient.create().resource(p1).encodedXml().execute().getId(); + IIdType newId = myClient.create().resource(p1).encodedXml().execute().getId(); - Patient actual = ourClient.read().resource(Patient.class).withId(newId).encodedXml().execute(); + Patient actual = myClient.read().resource(Patient.class).withId(newId).encodedXml().execute(); assertEquals("
HELLO WORLD
", actual.getText().getDiv().getValueAsString()); } @@ -2266,13 +2278,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient nextPatient = new Patient(); nextPatient.setId("Patient/B"); nextPatient - .addExtension() - .setUrl("http://foo") - .setValue(new Reference("Practitioner/A")); + .addExtension() + .setUrl("http://foo") + .setValue(new Reference("Practitioner/A")); - ourClient.update().resource(nextPatient).execute(); + myClient.update().resource(nextPatient).execute(); - Patient p = ourClient.read().resource(Patient.class).withId("B").execute(); + Patient p = myClient.read().resource(Patient.class).withId("B").execute(); String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p); ourLog.info(encoded); @@ -2290,19 +2302,19 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.getManagingOrganization().setResource(o1); - IIdType newId = ourClient.create().resource(p1).execute().getId(); + IIdType newId = myClient.create().resource(p1).execute().getId(); - Patient actual = ourClient.read(Patient.class, new UriDt(newId.getValue())); + Patient actual = myClient.read(Patient.class, new UriDt(newId.getValue())); assertEquals(1, actual.getContained().size()); //@formatter:off - Bundle b = ourClient - .search() - .forResource("Patient") - .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system:rpdstu2", "testSaveAndRetrieveWithContained01")) - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); + Bundle b = myClient + .search() + .forResource("Patient") + .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system:rpdstu2", "testSaveAndRetrieveWithContained01")) + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); //@formatter:on assertEquals(1, b.getEntry().size()); @@ -2314,9 +2326,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.getText().setDivAsString("
IdentifiertestSearchByResourceChain01
"); p1.addIdentifier().setSystem("urn:system").setValue("testSearchByResourceChain01"); - IdType newId = (IdType) ourClient.create().resource(p1).execute().getId(); + IdType newId = (IdType) myClient.create().resource(p1).execute().getId(); - Patient actual = ourClient.read(Patient.class, newId.getIdPart()); + Patient actual = myClient.read(Patient.class, newId.getIdPart()); assertThat(actual.getText().getDiv().getValueAsString(), containsString("IdentifiertestSearchByResourceChain01")); } @@ -2382,68 +2394,68 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Bundle found; - found = ourClient - .search() - .forResource(Patient.class) - .where(BaseResource.RES_ID.exactly().systemAndValues(null, id1.getIdPart(), id2.getIdPart())) - .returnBundle(Bundle.class) - .execute(); + found = myClient + .search() + .forResource(Patient.class) + .where(BaseResource.RES_ID.exactly().systemAndValues(null, id1.getIdPart(), id2.getIdPart())) + .returnBundle(Bundle.class) + .execute(); assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1, id2)); - found = ourClient - .search() - .forResource(Patient.class) - .where(BaseResource.RES_ID.exactly().systemAndValues(null, Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO"))) - .returnBundle(Bundle.class) - .execute(); + found = myClient + .search() + .forResource(Patient.class) + .where(BaseResource.RES_ID.exactly().systemAndValues(null, Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO"))) + .returnBundle(Bundle.class) + .execute(); assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1, id2)); - found = ourClient - .search() - .forResource(Patient.class) - .where(BaseResource.RES_ID.exactly().systemAndCode(null, id1.getIdPart())) - .returnBundle(Bundle.class) - .execute(); + found = myClient + .search() + .forResource(Patient.class) + .where(BaseResource.RES_ID.exactly().systemAndCode(null, id1.getIdPart())) + .returnBundle(Bundle.class) + .execute(); assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1)); - found = ourClient - .search() - .forResource(Patient.class) - .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart())) - .and(BaseResource.RES_ID.exactly().code(id1.getIdPart())) - .returnBundle(Bundle.class) - .execute(); + found = myClient + .search() + .forResource(Patient.class) + .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart())) + .and(BaseResource.RES_ID.exactly().code(id1.getIdPart())) + .returnBundle(Bundle.class) + .execute(); assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1)); - found = ourClient - .search() - .forResource(Patient.class) - .where(BaseResource.RES_ID.exactly().codes(Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO"))) - .and(BaseResource.RES_ID.exactly().code(id1.getIdPart())) - .returnBundle(Bundle.class) - .execute(); + found = myClient + .search() + .forResource(Patient.class) + .where(BaseResource.RES_ID.exactly().codes(Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO"))) + .and(BaseResource.RES_ID.exactly().code(id1.getIdPart())) + .returnBundle(Bundle.class) + .execute(); assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1)); - found = ourClient - .search() - .forResource(Patient.class) - .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart(), "FOOO")) - .returnBundle(Bundle.class) - .execute(); + found = myClient + .search() + .forResource(Patient.class) + .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart(), "FOOO")) + .returnBundle(Bundle.class) + .execute(); assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1, id2)); - found = ourClient - .search() - .forResource(Patient.class) - .where(BaseResource.RES_ID.exactly().codes("FOOO")) - .returnBundle(Bundle.class) - .execute(); + found = myClient + .search() + .forResource(Patient.class) + .where(BaseResource.RES_ID.exactly().codes("FOOO")) + .returnBundle(Bundle.class) + .execute(); assertThat(toUnqualifiedVersionlessIds(found), empty()); @@ -2454,22 +2466,22 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testSearchByIdentifier01"); p1.addName().setFamily("testSearchByIdentifierFamily01").addGiven("testSearchByIdentifierGiven01"); - IdType p1Id = (IdType) ourClient.create().resource(p1).execute().getId(); + IdType p1Id = (IdType) myClient.create().resource(p1).execute().getId(); Patient p2 = new Patient(); p2.addIdentifier().setSystem("urn:system").setValue("testSearchByIdentifier02"); p2.addName().setFamily("testSearchByIdentifierFamily01").addGiven("testSearchByIdentifierGiven02"); - ourClient.create().resource(p2).execute().getId(); + myClient.create().resource(p2).execute().getId(); //@formatter:off - Bundle actual = ourClient - .search() - .forResource(Patient.class) - .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testSearchByIdentifier01")) - .encodedJson() - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); + Bundle actual = myClient + .search() + .forResource(Patient.class) + .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testSearchByIdentifier01")) + .encodedJson() + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); //@formatter:on assertEquals(1, actual.getEntry().size()); @@ -2483,17 +2495,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setValue("testSearchByIdentifierWithoutSystem01"); - IdType p1Id = (IdType) ourClient.create().resource(p1).execute().getId(); + IdType p1Id = (IdType) myClient.create().resource(p1).execute().getId(); //@formatter:off - Bundle actual = ourClient - .search() - .forResource(Patient.class) - .where(Patient.IDENTIFIER.exactly().systemAndCode(null, "testSearchByIdentifierWithoutSystem01")) - .encodedJson() - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); + Bundle actual = myClient + .search() + .forResource(Patient.class) + .where(Patient.IDENTIFIER.exactly().systemAndCode(null, "testSearchByIdentifierWithoutSystem01")) + .encodedJson() + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); //@formatter:on assertEquals(1, actual.getEntry().size()); assertEquals(p1Id.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart()); @@ -2505,16 +2517,16 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { String methodName = "testSearchByLastUpdated"; Patient p = new Patient(); - p.addName().setFamily(methodName+"1"); - IIdType pid1 = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); + p.addName().setFamily(methodName + "1"); + IIdType pid1 = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); Thread.sleep(10); long time1 = System.currentTimeMillis(); Thread.sleep(10); Patient p2 = new Patient(); - p2.addName().setFamily(methodName+"2"); - IIdType pid2 = ourClient.create().resource(p2).execute().getId().toUnqualifiedVersionless(); + p2.addName().setFamily(methodName + "2"); + IIdType pid2 = myClient.create().resource(p2).execute().getId().toUnqualifiedVersionless(); HttpGet get = new HttpGet(ourServerBase + "/Patient?_lastUpdated=lt" + new InstantType(new Date(time1)).getValueAsString()); CloseableHttpResponse response = ourHttpClient.execute(get); @@ -2550,28 +2562,28 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testSearchByReferenceIds() { Organization o1 = new Organization(); o1.setName("testSearchByResourceChainName01"); - IIdType o1id = ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); + IIdType o1id = myClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); Organization o2 = new Organization(); o2.setName("testSearchByResourceChainName02"); - IIdType o2id = ourClient.create().resource(o2).execute().getId().toUnqualifiedVersionless(); + IIdType o2id = myClient.create().resource(o2).execute().getId().toUnqualifiedVersionless(); Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testSearchByReferenceIds01"); p1.addName().setFamily("testSearchByReferenceIdsFamily01").addGiven("testSearchByReferenceIdsGiven01"); p1.setManagingOrganization(new Reference(o1id.toUnqualifiedVersionless())); - IIdType p1Id = ourClient.create().resource(p1).execute().getId(); + IIdType p1Id = myClient.create().resource(p1).execute().getId(); Patient p2 = new Patient(); p2.addIdentifier().setSystem("urn:system").setValue("testSearchByReferenceIds02"); p2.addName().setFamily("testSearchByReferenceIdsFamily02").addGiven("testSearchByReferenceIdsGiven02"); p2.setManagingOrganization(new Reference(o2id.toUnqualifiedVersionless())); - IIdType p2Id = ourClient.create().resource(p2).execute().getId(); + IIdType p2Id = myClient.create().resource(p2).execute().getId(); //@formatter:off - Bundle actual = ourClient.search() - .forResource(Patient.class) - .where(Patient.ORGANIZATION.hasAnyOfIds(Arrays.asList(o1id.getIdPart(), o2id.getIdPart()))) - .encodedJson().prettyPrint().returnBundle(Bundle.class).execute(); + Bundle actual = myClient.search() + .forResource(Patient.class) + .where(Patient.ORGANIZATION.hasAnyOfIds(Arrays.asList(o1id.getIdPart(), o2id.getIdPart()))) + .encodedJson().prettyPrint().returnBundle(Bundle.class).execute(); //@formatter:on Set expectedIds = new HashSet(); expectedIds.add(p1Id.getIdPart()); @@ -2588,28 +2600,28 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization o1 = new Organization(); o1.setName("testSearchByResourceChainName01"); - IdType o1id = (IdType) ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); + IdType o1id = (IdType) myClient.create().resource(o1).execute().getId().toUnqualifiedVersionless(); Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testSearchByResourceChain01"); p1.addName().setFamily("testSearchByResourceChainFamily01").addGiven("testSearchByResourceChainGiven01"); p1.setManagingOrganization(new Reference(o1id.toUnqualifiedVersionless())); - IdType p1Id = (IdType) ourClient.create().resource(p1).execute().getId(); + IdType p1Id = (IdType) myClient.create().resource(p1).execute().getId(); //@formatter:off - Bundle actual = ourClient.search() - .forResource(Patient.class) - .where(Patient.ORGANIZATION.hasId(o1id.getIdPart())) - .encodedJson().prettyPrint().returnBundle(Bundle.class).execute(); + Bundle actual = myClient.search() + .forResource(Patient.class) + .where(Patient.ORGANIZATION.hasId(o1id.getIdPart())) + .encodedJson().prettyPrint().returnBundle(Bundle.class).execute(); //@formatter:on assertEquals(1, actual.getEntry().size()); assertEquals(p1Id.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart()); //@formatter:off - actual = ourClient.search() - .forResource(Patient.class) - .where(Patient.ORGANIZATION.hasId(o1id.getValue())) - .encodedJson().prettyPrint().returnBundle(Bundle.class).execute(); + actual = myClient.search() + .forResource(Patient.class) + .where(Patient.ORGANIZATION.hasId(o1id.getValue())) + .encodedJson().prettyPrint().returnBundle(Bundle.class).execute(); //@formatter:on assertEquals(1, actual.getEntry().size()); assertEquals(p1Id.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart()); @@ -2651,14 +2663,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient patient = new Patient(); patient.addIdentifier().setSystem("urn:system").setValue("001"); patient.addName().setFamily(methodName).addGiven("Joe"); - id1a = (IdType) ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); + id1a = (IdType) myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); } IIdType id1b; { Patient patient = new Patient(); patient.addIdentifier().setSystem("urn:system").setValue("002"); patient.addName().setFamily(methodName + "XXXX").addGiven("Joe"); - id1b = (IdType) ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); + id1b = (IdType) myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); } Thread.sleep(1100); @@ -2670,40 +2682,40 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient patient = new Patient(); patient.addIdentifier().setSystem("urn:system").setValue("002"); patient.addName().setFamily(methodName).addGiven("John"); - id2 = (IdType) ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); + id2 = (IdType) myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless(); } { //@formatter:off - Bundle found = ourClient.search() - .forResource(Patient.class) - .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) - .returnBundle(Bundle.class) - .execute(); + Bundle found = myClient.search() + .forResource(Patient.class) + .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) + .returnBundle(Bundle.class) + .execute(); //@formatter:on List patients = toUnqualifiedVersionlessIds(found); assertThat(patients, hasItems(id1a, id1b, id2)); } { //@formatter:off - Bundle found = ourClient.search() - .forResource(Patient.class) - .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) - .lastUpdated(new DateRangeParam(beforeAny, null)) - .returnBundle(Bundle.class) - .execute(); + Bundle found = myClient.search() + .forResource(Patient.class) + .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) + .lastUpdated(new DateRangeParam(beforeAny, null)) + .returnBundle(Bundle.class) + .execute(); //@formatter:on List patients = toUnqualifiedVersionlessIds(found); assertThat(patients, hasItems(id1a, id1b, id2)); } { //@formatter:off - Bundle found = ourClient.search() - .forResource(Patient.class) - .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) - .lastUpdated(new DateRangeParam(beforeR2, null)) - .returnBundle(Bundle.class) - .execute(); + Bundle found = myClient.search() + .forResource(Patient.class) + .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) + .lastUpdated(new DateRangeParam(beforeR2, null)) + .returnBundle(Bundle.class) + .execute(); //@formatter:on List patients = toUnqualifiedVersionlessIds(found); assertThat(patients, hasItems(id2)); @@ -2711,12 +2723,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } { //@formatter:off - Bundle found = ourClient.search() - .forResource(Patient.class) - .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) - .lastUpdated(new DateRangeParam(beforeAny, beforeR2)) - .returnBundle(Bundle.class) - .execute(); + Bundle found = myClient.search() + .forResource(Patient.class) + .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) + .lastUpdated(new DateRangeParam(beforeAny, beforeR2)) + .returnBundle(Bundle.class) + .execute(); //@formatter:on List patients = toUnqualifiedVersionlessIds(found); assertThat(patients.toString(), patients, not(hasItems(id2))); @@ -2724,12 +2736,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } { //@formatter:off - Bundle found = ourClient.search() - .forResource(Patient.class) - .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) - .lastUpdated(new DateRangeParam(null, beforeR2)) - .returnBundle(Bundle.class) - .execute(); + Bundle found = myClient.search() + .forResource(Patient.class) + .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp")) + .lastUpdated(new DateRangeParam(null, beforeR2)) + .returnBundle(Bundle.class) + .execute(); //@formatter:on List patients = toUnqualifiedVersionlessIds(found); assertThat(patients, (hasItems(id1a, id1b))); @@ -2809,7 +2821,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { List linkNext = Lists.newArrayList(); for (int i = 0; i < 100; i++) { - Bundle bundle = ourClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("testSearchPagingKeepsOldSearches")).count(5).returnBundle(Bundle.class).execute(); + Bundle bundle = myClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("testSearchPagingKeepsOldSearches")).count(5).returnBundle(Bundle.class).execute(); assertTrue(isNotBlank(bundle.getLink("next").getUrl())); assertEquals(5, bundle.getEntry().size()); linkNext.add(bundle.getLink("next").getUrl()); @@ -2818,7 +2830,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { int index = 0; for (String nextLink : linkNext) { ourLog.info("Fetching index {}", index++); - Bundle b = ourClient.fetchResourceFromUrl(Bundle.class, nextLink); + Bundle b = myClient.fetchResourceFromUrl(Bundle.class, nextLink); assertEquals(5, b.getEntry().size()); } } @@ -2842,12 +2854,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Thread.sleep(1); //@formatter:off - Bundle found = ourClient - .search() - .forResource(Patient.class) - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); + Bundle found = myClient + .search() + .forResource(Patient.class) + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); //@formatter:on Thread.sleep(1); @@ -2871,23 +2883,23 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("HELLO"); resources.add(org); } - ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); myDaoConfig.setReuseCachedSearchResultsForMillis(1000L); - Bundle result1 = ourClient - .search() - .forResource("Organization") - .returnBundle(Bundle.class) - .execute(); + Bundle result1 = myClient + .search() + .forResource("Organization") + .returnBundle(Bundle.class) + .execute(); final String uuid1 = toSearchUuidFromLinkNext(result1); - Bundle result2 = ourClient - .search() - .forResource("Organization") - .returnBundle(Bundle.class) - .execute(); + Bundle result2 = myClient + .search() + .forResource("Organization") + .returnBundle(Bundle.class) + .execute(); final String uuid2 = toSearchUuidFromLinkNext(result2); @@ -2902,37 +2914,37 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("HELLO"); resources.add(org); } - ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); myDaoConfig.setReuseCachedSearchResultsForMillis(null); - Bundle result1 = ourClient - .search() - .forResource("Organization") - .where(Organization.NAME.matches().value("HELLO")) - .count(5) - .returnBundle(Bundle.class) - .execute(); + Bundle result1 = myClient + .search() + .forResource("Organization") + .where(Organization.NAME.matches().value("HELLO")) + .count(5) + .returnBundle(Bundle.class) + .execute(); final String uuid1 = toSearchUuidFromLinkNext(result1); - Bundle result2 = ourClient - .search() - .forResource("Organization") - .where(Organization.NAME.matches().value("HELLO")) - .count(5) - .returnBundle(Bundle.class) - .execute(); + Bundle result2 = myClient + .search() + .forResource("Organization") + .where(Organization.NAME.matches().value("HELLO")) + .count(5) + .returnBundle(Bundle.class) + .execute(); final String uuid2 = toSearchUuidFromLinkNext(result2); - Bundle result3 = ourClient - .search() - .forResource("Organization") - .where(Organization.NAME.matches().value("HELLO")) - .count(5) - .returnBundle(Bundle.class) - .execute(); + Bundle result3 = myClient + .search() + .forResource("Organization") + .where(Organization.NAME.matches().value("HELLO")) + .count(5) + .returnBundle(Bundle.class) + .execute(); String uuid3 = toSearchUuidFromLinkNext(result3); @@ -2948,17 +2960,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("HELLO"); resources.add(org); } - ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); myDaoConfig.setReuseCachedSearchResultsForMillis(1000L); - Bundle result1 = ourClient - .search() - .forResource("Organization") - .where(Organization.NAME.matches().value("HELLO")) - .count(5) - .returnBundle(Bundle.class) - .execute(); + Bundle result1 = myClient + .search() + .forResource("Organization") + .where(Organization.NAME.matches().value("HELLO")) + .count(5) + .returnBundle(Bundle.class) + .execute(); final String uuid1 = toSearchUuidFromLinkNext(result1); Search search1 = newTxTemplate().execute(new TransactionCallback() { @@ -2969,13 +2981,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { }); Date lastReturned1 = search1.getSearchLastReturned(); - Bundle result2 = ourClient - .search() - .forResource("Organization") - .where(Organization.NAME.matches().value("HELLO")) - .count(5) - .returnBundle(Bundle.class) - .execute(); + Bundle result2 = myClient + .search() + .forResource("Organization") + .where(Organization.NAME.matches().value("HELLO")) + .count(5) + .returnBundle(Bundle.class) + .execute(); final String uuid2 = toSearchUuidFromLinkNext(result2); Search search2 = newTxTemplate().execute(new TransactionCallback() { @@ -2990,13 +3002,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Thread.sleep(1500); - Bundle result3 = ourClient - .search() - .forResource("Organization") - .where(Organization.NAME.matches().value("HELLO")) - .count(5) - .returnBundle(Bundle.class) - .execute(); + Bundle result3 = myClient + .search() + .forResource("Organization") + .where(Organization.NAME.matches().value("HELLO")) + .count(5) + .returnBundle(Bundle.class) + .execute(); String uuid3 = toSearchUuidFromLinkNext(result3); @@ -3012,15 +3024,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName("HELLO"); resources.add(org); } - ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); myDaoConfig.setReuseCachedSearchResultsForMillis(100000L); - Bundle result1 = ourClient - .search() - .forResource("Organization") - .returnBundle(Bundle.class) - .execute(); + Bundle result1 = myClient + .search() + .forResource("Organization") + .returnBundle(Bundle.class) + .execute(); final String uuid1 = toSearchUuidFromLinkNext(result1); Search search1 = newTxTemplate().execute(new TransactionCallback() { @@ -3031,11 +3043,11 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { }); Date lastReturned1 = search1.getSearchLastReturned(); - Bundle result2 = ourClient - .search() - .forResource("Organization") - .returnBundle(Bundle.class) - .execute(); + Bundle result2 = myClient + .search() + .forResource("Organization") + .returnBundle(Bundle.class) + .execute(); final String uuid2 = toSearchUuidFromLinkNext(result2); Search search2 = newTxTemplate().execute(new TransactionCallback() { @@ -3059,34 +3071,28 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient patient = new Patient(); patient.addIdentifier().setSystem("urn:system2").setValue("testSearchTokenParam002"); patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2"); - ourClient.create().resource(patient).execute(); + myClient.create().resource(patient).execute(); - //@formatter:off - Bundle response = ourClient - .search() - .forResource(Patient.class) - .returnBundle(Bundle.class) - .execute(); - //@formatter:on + Bundle response = myClient + .search() + .forResource(Patient.class) + .returnBundle(Bundle.class) + .execute(); patient = (Patient) response.getEntry().get(0).getResource(); - //@formatter:off - ourClient + myClient .meta() .add() .onResource(patient.getIdElement()) .meta(new Meta().addTag("http://system", "tag1", "display")) .execute(); - //@formatter:on - //@formatter:off - response = ourClient - .search() - .forResource(Patient.class) - .returnBundle(Bundle.class) - .execute(); - //@formatter:on + response = myClient + .search() + .forResource(Patient.class) + .returnBundle(Bundle.class) + .execute(); patient = (Patient) response.getEntry().get(0).getResource(); assertEquals(1, patient.getMeta().getTag().size()); @@ -3098,7 +3104,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { patient.addIdentifier().setSystem("urn:system").setValue("testSearchTokenParam001"); patient.addName().setFamily("Tester").addGiven("testSearchTokenParam1"); patient.addCommunication().getLanguage().setText("testSearchTokenParamComText").addCoding().setCode("testSearchTokenParamCode").setSystem("testSearchTokenParamSystem") - .setDisplay("testSearchTokenParamDisplay"); + .setDisplay("testSearchTokenParamDisplay"); myPatientDao.create(patient, mySrd); patient = new Patient(); @@ -3111,25 +3117,116 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2"); myPatientDao.create(patient, mySrd); - //@formatter:off - Bundle response = ourClient - .search() - .forResource(Patient.class) - .where(Patient.IDENTIFIER.hasSystemWithAnyCode("urn:system")) - .returnBundle(Bundle.class) - .execute(); - //@formatter:on + Bundle response = myClient + .search() + .forResource(Patient.class) + .where(Patient.IDENTIFIER.hasSystemWithAnyCode("urn:system")) + .returnBundle(Bundle.class) + .execute(); assertEquals(2, response.getEntry().size()); } + @Test + public void testSearchWithCountNotSet() throws Exception { + mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1); + mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(200); + + for (int i = 0; i < 10; i++) { + Patient pat = new Patient(); + pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i); + myClient.create().resource(pat).execute(); + } + + StopWatch sw = new StopWatch(); + + ourLog.info("** About to search with count of 1"); + + Bundle found = myClient + .search() + .forResource(Patient.class) + .returnBundle(Bundle.class) + .count(1) + .execute(); + + ourLog.info("** Done searching with count of 1"); + + ourLog.info(myCapturingInterceptor.getLastResponse().getAllHeaders().toString()); + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), Matchers.empty()); + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE.toLowerCase()),Matchers.empty()); + + // If this fails under load, try increasing the throttle above + assertEquals(null, found.getTotalElement().getValue()); + assertEquals(1, found.getEntry().size()); + assertThat(sw.getMillis(), lessThan(1000L)); + + } + + @Test + public void testSearchWithCountSearchResultsUpTo20() throws Exception { + mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1); + mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(200); + myDaoConfig.setCountSearchResultsUpTo(20); + + for (int i = 0; i < 10; i++) { + Patient pat = new Patient(); + pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i); + myClient.create().resource(pat).execute(); + } + + StopWatch sw = new StopWatch(); + + Bundle found = myClient + .search() + .forResource(Patient.class) + .returnBundle(Bundle.class) + .count(1) + .execute(); + + assertThat(sw.getMillis(), not(lessThan(1000L))); + + // If this fails under load, try increasing the throttle above + assertEquals(10, found.getTotalElement().getValue().intValue()); + assertEquals(1, found.getEntry().size()); + } + + @Test + public void testSearchWithCountSearchResultsUpTo5() throws Exception { + mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1); + mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(200); + myDaoConfig.setCountSearchResultsUpTo(5); + + for (int i = 0; i < 10; i++) { + Patient pat = new Patient(); + pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i); + myClient.create().resource(pat).execute(); + } + + StopWatch sw = new StopWatch(); + + Bundle found = myClient + .search() + .forResource(Patient.class) + .returnBundle(Bundle.class) + .count(1) + .execute(); + + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), Matchers.empty()); + assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE.toLowerCase()),Matchers.empty()); + + // If this fails under load, try increasing the throttle above + assertEquals(null, found.getTotalElement().getValue()); + assertEquals(1, found.getEntry().size()); + assertThat(sw.getMillis(), lessThan(1000L)); + } + @Test public void testSearchWithEmptyParameter() throws Exception { - Observation obs= new Observation(); + Observation obs = new Observation(); obs.setStatus(ObservationStatus.FINAL); obs.getCode().addCoding().setSystem("foo").setCode("bar"); - ourClient.create().resource(obs).execute(); - + myClient.create().resource(obs).execute(); + testSearchWithEmptyParameter("/Observation?value-quantity="); testSearchWithEmptyParameter("/Observation?code=bar&value-quantity="); testSearchWithEmptyParameter("/Observation?value-date="); @@ -3155,23 +3252,21 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testSearchWithInclude() throws Exception { Organization org = new Organization(); org.addIdentifier().setSystem("urn:system:rpdstu2").setValue("testSearchWithInclude01"); - IdType orgId = (IdType) ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId(); + IdType orgId = (IdType) myClient.create().resource(org).prettyPrint().encodedXml().execute().getId(); Patient pat = new Patient(); pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("testSearchWithInclude02"); pat.getManagingOrganization().setReferenceElement(orgId.toUnqualifiedVersionless()); - ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); + myClient.create().resource(pat).prettyPrint().encodedXml().execute().getId(); - //@formatter:off - Bundle found = ourClient - .search() - .forResource(Patient.class) - .where(Patient.IDENTIFIER.exactly().systemAndIdentifier("urn:system:rpdstu2","testSearchWithInclude02")) - .include(Patient.INCLUDE_ORGANIZATION) - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); - //@formatter:on + Bundle found = myClient + .search() + .forResource(Patient.class) + .where(Patient.IDENTIFIER.exactly().systemAndIdentifier("urn:system:rpdstu2", "testSearchWithInclude02")) + .include(Patient.INCLUDE_ORGANIZATION) + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); assertEquals(2, found.getEntry().size()); assertEquals(Patient.class, found.getEntry().get(0).getResource().getClass()); @@ -3184,13 +3279,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testSearchWithInvalidNumberPrefix() throws Exception { try { //@formatter:off - ourClient - .search() - .forResource(Encounter.class) - .where(Encounter.LENGTH.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100)) - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); + myClient + .search() + .forResource(Encounter.class) + .where(Encounter.LENGTH.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100)) + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); //@formatter:on fail(); } catch (InvalidRequestException e) { @@ -3205,13 +3300,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myObservationDao.create(o, mySrd); try { //@formatter:off - ourClient - .search() - .forResource(Observation.class) - .where(Observation.VALUE_QUANTITY.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100).andNoUnits()) - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); + myClient + .search() + .forResource(Observation.class) + .where(Observation.VALUE_QUANTITY.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100).andNoUnits()) + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); //@formatter:on fail(); } catch (InvalidRequestException e) { @@ -3225,13 +3320,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { o.getCode().setText("testSearchWithInvalidSort"); myObservationDao.create(o, mySrd); //@formatter:off - ourClient - .search() - .forResource(Observation.class) - .sort().ascending(Observation.CODE_VALUE_QUANTITY) // composite sort not supported yet - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); + myClient + .search() + .forResource(Observation.class) + .sort().ascending(Observation.CODE_VALUE_QUANTITY) // composite sort not supported yet + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); //@formatter:on } @@ -3242,13 +3337,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { String methodName = "testSearchWithMissing"; Organization org = new Organization(); - IIdType deletedIdMissingTrue = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); - ourClient.delete().resourceById(deletedIdMissingTrue).execute(); + IIdType deletedIdMissingTrue = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); + myClient.delete().resourceById(deletedIdMissingTrue).execute(); org = new Organization(); org.setName("Help I'm a Bug"); - IIdType deletedIdMissingFalse = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); - ourClient.delete().resourceById(deletedIdMissingFalse).execute(); + IIdType deletedIdMissingFalse = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless(); + myClient.delete().resourceById(deletedIdMissingFalse).execute(); List resources = new ArrayList(); for (int i = 0; i < 20; i++) { @@ -3256,27 +3351,27 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { org.setName(methodName + "_0" + i); resources.add(org); } - ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); + myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); org = new Organization(); org.addIdentifier().setSystem("urn:system:rpdstu2").setValue(methodName + "01"); org.setName(methodName + "name"); - IIdType orgNotMissing = ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless(); + IIdType orgNotMissing = myClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless(); org = new Organization(); org.addIdentifier().setSystem("urn:system:rpdstu2").setValue(methodName + "01"); - IIdType orgMissing = ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless(); + IIdType orgMissing = myClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless(); { //@formatter:off - Bundle found = ourClient - .search() - .forResource(Organization.class) - .where(Organization.NAME.isMissing(false)) - .count(100) - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); + Bundle found = myClient + .search() + .forResource(Organization.class) + .where(Organization.NAME.isMissing(false)) + .count(100) + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); //@formatter:on List list = toUnqualifiedVersionlessIds(found); @@ -3288,15 +3383,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } //@formatter:off - Bundle found = ourClient - .search() - .forResource(Organization.class) - .where(Organization.NAME.isMissing(true)) - .count(100) - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); - //@formatter:on + Bundle found = myClient + .search() + .forResource(Organization.class) + .where(Organization.NAME.isMissing(true)) + .count(100) + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); + //@formatter:on List list = toUnqualifiedVersionlessIds(found); ourLog.info(methodName + " found: " + list.toString() + " - Wanted " + orgMissing + " but not " + orgNotMissing); @@ -3342,7 +3437,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { /** * See #411 - * + *

* Let's see if we can reproduce this issue in JPA */ @Test @@ -3376,7 +3471,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Observation obs = new Observation(); obs.getCode().setText("THIS_IS_THE_TEXT"); obs.getCode().addCoding().setSystem("SYSTEM").setCode("CODE").setDisplay("THIS_IS_THE_DISPLAY"); - ourClient.create().resource(obs).execute(); + myClient.create().resource(obs).execute(); testSearchReturnsResults("/Observation?code%3Atext=THIS_IS_THE_TEXT"); testSearchReturnsResults("/Observation?code%3Atext=THIS_IS_THE_"); @@ -3395,119 +3490,119 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Daniel").setFamily("Adams"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Aaron").setFamily("Alexis"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Carol").setFamily("Allen"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Ruth").setFamily("Black"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Brian").setFamily("Brooks"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Susan").setFamily("Clark"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Amy").setFamily("Clark"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Anthony").setFamily("Coleman"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Steven").setFamily("Coleman"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Lisa").setFamily("Coleman"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Ruth").setFamily("Cook"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Betty").setFamily("Davis"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Joshua").setFamily("Diaz"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Brian").setFamily("Gracia"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Stephan").setFamily("Graham"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); p.addName().addGiven("Sarah").setFamily("Graham"); - ourClient.create().resource(p).execute(); + myClient.create().resource(p).execute(); - Bundle resp = ourClient - .search() - .forResource(Patient.class) - .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", methodName)) - .sort().ascending(Patient.FAMILY) - .sort().ascending(Patient.GIVEN) - .count(100) - .returnBundle(Bundle.class) - .execute(); + Bundle resp = myClient + .search() + .forResource(Patient.class) + .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", methodName)) + .sort().ascending(Patient.FAMILY) + .sort().ascending(Patient.GIVEN) + .count(100) + .returnBundle(Bundle.class) + .execute(); List names = toNameList(resp); ourLog.info(StringUtils.join(names, '\n')); assertThat(names, contains( // this matches in order only - "Daniel Adams", - "Aaron Alexis", - "Carol Allen", - "Ruth Black", - "Brian Brooks", - "Amy Clark", - "Susan Clark", - "Anthony Coleman", - "Lisa Coleman", - "Steven Coleman", - "Ruth Cook", - "Betty Davis", - "Joshua Diaz", - "Brian Gracia", - "Sarah Graham", - "Stephan Graham")); + "Daniel Adams", + "Aaron Alexis", + "Carol Allen", + "Ruth Black", + "Brian Brooks", + "Amy Clark", + "Susan Clark", + "Anthony Coleman", + "Lisa Coleman", + "Steven Coleman", + "Ruth Cook", + "Betty Davis", + "Joshua Diaz", + "Brian Gracia", + "Sarah Graham", + "Stephan Graham")); } @@ -3519,7 +3614,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Organization org = new Organization(); org.setName("測試醫院"); org.addIdentifier().setSystem("urn:system").setValue("testStoreUtf8Characters_01"); - IdType orgId = (IdType) ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId(); + IdType orgId = (IdType) myClient.create().resource(org).prettyPrint().encodedXml().execute().getId(); // Read back directly from the DAO { @@ -3530,7 +3625,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } // Read back through the HTTP API { - Organization returned = ourClient.read(Organization.class, orgId.getIdPart()); + Organization returned = myClient.read(Organization.class, orgId.getIdPart()); String val = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(returned); ourLog.info(val); assertThat(val, containsString("")); @@ -3560,7 +3655,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { p1.setManagingOrganization(new Reference("Organization/99999999999")); try { - ourClient.create().resource(p1).execute().getId(); + myClient.create().resource(p1).execute().getId(); fail(); } catch (InvalidRequestException e) { assertThat(e.getMessage(), containsString("Organization/99999999999")); @@ -3585,7 +3680,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals(400, response.getStatusLine().getStatusCode()); OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, responseString); assertThat(oo.getIssue().get(0).getDiagnostics(), - containsString("Can not update resource, request URL must contain an ID element for update (PUT) operation (it must be of the form [base]/[resource type]/[id])")); + containsString("Can not update resource, request URL must contain an ID element for update (PUT) operation (it must be of the form [base]/[resource type]/[id])")); } finally { response.close(); } @@ -3646,7 +3741,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testUpdateRejectsInvalidTypes"); p1.addName().setFamily("Tester").addGiven("testUpdateRejectsInvalidTypes"); - IdType p1id = (IdType) ourClient.create().resource(p1).execute().getId(); + IdType p1id = (IdType) myClient.create().resource(p1).execute().getId(); // Try to update with the wrong ID in the resource body p1.setId("FOO"); @@ -3663,9 +3758,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals(400, response.getStatusLine().getStatusCode()); OperationOutcome oo = myFhirCtx.newJsonParser().parseResource(OperationOutcome.class, new InputStreamReader(response.getEntity().getContent())); assertEquals( - "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"FOO\" does not match URL ID of \"" - + p1id.getIdPart() + "\"", - oo.getIssue().get(0).getDiagnostics()); + "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"FOO\" does not match URL ID of \"" + + p1id.getIdPart() + "\"", + oo.getIssue().get(0).getDiagnostics()); } finally { response.close(); } @@ -3707,20 +3802,20 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testUpdateRejectsInvalidTypes"); p1.addName().setFamily("Tester").addGiven("testUpdateRejectsInvalidTypes"); - IdType p1id = (IdType) ourClient.create().resource(p1).execute().getId(); + IdType p1id = (IdType) myClient.create().resource(p1).execute().getId(); Organization p2 = new Organization(); p2.setId(p1id.getIdPart()); p2.getNameElement().setValue("testUpdateRejectsInvalidTypes"); try { - ourClient.update().resource(p2).withId("Organization/" + p1id.getIdPart()).execute(); + myClient.update().resource(p2).withId("Organization/" + p1id.getIdPart()).execute(); fail(); } catch (UnprocessableEntityException e) { // good } try { - ourClient.update().resource(p2).withId("Patient/" + p1id.getIdPart()).execute(); + myClient.update().resource(p2).withId("Patient/" + p1id.getIdPart()).execute(); fail(); } catch (UnprocessableEntityException e) { // good @@ -3896,21 +3991,21 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient p1 = new Patient(); p1.addIdentifier().setSystem("urn:system").setValue("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2"); - MethodOutcome outcome = ourClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2").execute(); + MethodOutcome outcome = myClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2").execute(); assertEquals(true, outcome.getCreated().booleanValue()); IdType p1Id = (IdType) outcome.getId(); assertThat(p1Id.getValue(), containsString("Patient/testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2/_history")); //@formatter:off - Bundle actual = ourClient - .search() - .forResource(Patient.class) - .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2")) - .encodedJson() - .prettyPrint() - .returnBundle(Bundle.class) - .execute(); + Bundle actual = myClient + .search() + .forResource(Patient.class) + .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2")) + .encodedJson() + .prettyPrint() + .returnBundle(Bundle.class) + .execute(); //@formatter:on assertEquals(1, actual.getEntry().size()); @@ -3924,7 +4019,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { Patient pt = new Patient(); pt.addName().setFamily(methodName); - IIdType id = ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(pt).execute().getId().toUnqualifiedVersionless(); pt.addName().setFamily("FAM2"); pt.setId(id.toUnqualifiedVersionless()); @@ -3977,13 +4072,27 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals(400, response.getStatusLine().getStatusCode()); OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, responseString); assertEquals( - "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"333\" does not match URL ID of \"A2\"", - oo.getIssue().get(0).getDiagnostics()); + "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"333\" does not match URL ID of \"A2\"", + oo.getIssue().get(0).getDiagnostics()); } finally { response.close(); } } + @Test + public void testUpdateWrongResourceType() throws IOException { + String input = IOUtils.toString(getClass().getResourceAsStream("/dstu3-person.json"), StandardCharsets.UTF_8); + + try { + MethodOutcome resp = myClient.update().resource(input).withId("Patient/PERSON1").execute(); + } catch (InvalidRequestException e) { + assertEquals("", e.getMessage()); + } + + MethodOutcome resp = myClient.update().resource(input).withId("Person/PERSON1").execute(); + assertEquals("Person/PERSON1/_history/1", resp.getId().toUnqualified().getValue()); + } + @Test public void testValidateBadInputViaGet() throws IOException { @@ -4043,7 +4152,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals(412, response.getStatusLine().getStatusCode()); assertThat(resp, not(containsString("Resource has no id"))); assertThat(resp, - stringContainsInOrder(">ERROR<", "[Patient.contact]", "

SHALL at least contain a contact's details or a reference to an organization", ""));
+				stringContainsInOrder(">ERROR<", "[Patient.contact]", "
SHALL at least contain a contact's details or a reference to an organization", ""));
 		} finally {
 			IOUtils.closeQuietly(response.getEntity().getContent());
 			response.close();
@@ -4155,8 +4264,8 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
 			assertThat(resp, not(containsString("Resource has no id")));
 			assertThat(resp, containsString("
No issues detected during validation
")); assertThat(resp, - stringContainsInOrder("", "", "", "", - "")); + stringContainsInOrder("", "", "", "", + "")); } finally { IOUtils.closeQuietly(response.getEntity().getContent()); response.close(); @@ -4182,8 +4291,8 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertThat(resp, not(containsString("Resource has no id"))); assertThat(resp, containsString("
No issues detected during validation
")); assertThat(resp, - stringContainsInOrder("", "", "", "", - "")); + stringContainsInOrder("", "", "", "", + "")); } finally { IOUtils.closeQuietly(response.getEntity().getContent()); response.close(); @@ -4193,10 +4302,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testValueSetExpandOperation() throws IOException { CodeSystem cs = myFhirCtx.newXmlParser().parseResource(CodeSystem.class, new InputStreamReader(ResourceProviderR4Test.class.getResourceAsStream("/extensional-case-3-cs.xml"))); - ourClient.create().resource(cs).execute(); + myClient.create().resource(cs).execute(); ValueSet upload = myFhirCtx.newXmlParser().parseResource(ValueSet.class, new InputStreamReader(ResourceProviderR4Test.class.getResourceAsStream("/extensional-case-3-vs.xml"))); - IIdType vsid = ourClient.create().resource(upload).execute().getId().toUnqualifiedVersionless(); + IIdType vsid = myClient.create().resource(upload).execute().getId().toUnqualifiedVersionless(); HttpGet get = new HttpGet(ourServerBase + "/ValueSet/" + vsid.getIdPart() + "/$expand"); CloseableHttpResponse response = ourHttpClient.execute(get); @@ -4234,8 +4343,8 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertEquals(200, response.getStatusLine().getStatusCode()); //@formatter:off assertThat(resp, stringContainsInOrder( - "", - "")); + "", + "")); //@formatter:on } finally { IOUtils.closeQuietly(response.getEntity().getContent()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java index 2dacfaf2322..216e3c168e0 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java @@ -1,35 +1,38 @@ package ca.uhn.fhir.jpa.provider.r4; -import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_CODE_SYSTEM; -import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_VALUE_SET; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -import org.apache.commons.io.IOUtils; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.hl7.fhir.r4.model.*; -import org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode; -import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent; -import org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent; -import org.hl7.fhir.r4.model.ValueSet.FilterOperator; -import org.hl7.fhir.instance.model.api.IIdType; -import org.junit.*; -import org.springframework.transaction.annotation.Transactional; - import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; -import ca.uhn.fhir.jpa.entity.*; +import ca.uhn.fhir.jpa.entity.ResourceTable; +import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; +import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum; import ca.uhn.fhir.jpa.term.IHapiTerminologySvc; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import ca.uhn.fhir.util.TestUtil; +import org.apache.commons.io.IOUtils; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.hl7.fhir.instance.model.api.IIdType; +import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent; +import org.hl7.fhir.r4.model.ValueSet.FilterOperator; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; +import org.springframework.transaction.annotation.Transactional; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_CODE_SYSTEM; +import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_VALUE_SET; +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { @@ -48,73 +51,14 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { myExtensionalVsId = myValueSetDao.create(upload, mySrd).getId().toUnqualifiedVersionless(); } - /** - * #516 - */ - @Test - public void testInvalidFilter() throws Exception { - String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8); - HttpPost post = new HttpPost(ourServerBase+"/ValueSet/%24expand"); - post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW))); - - CloseableHttpResponse resp = ourHttpClient.execute(post); - try { - - String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8); - ourLog.info(respString); - - ourLog.info(resp.toString()); - - assertEquals(400, resp.getStatusLine().getStatusCode()); - assertThat(respString, containsString("Unknown FilterOperator code 'n'")); - - }finally { - IOUtils.closeQuietly(resp); - } - } - private CodeSystem createExternalCs() { IFhirResourceDao codeSystemDao = myCodeSystemDao; IResourceTableDao resourceTableDao = myResourceTableDao; IHapiTerminologySvc termSvc = myTermSvc; - + return createExternalCs(codeSystemDao, resourceTableDao, termSvc, mySrd); } - public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, IHapiTerminologySvc theTermSvc, ServletRequestDetails theRequestDetails) { - CodeSystem codeSystem = new CodeSystem(); - codeSystem.setUrl(URL_MY_CODE_SYSTEM); - codeSystem.setContent(CodeSystemContentMode.NOTPRESENT); - IIdType id = theCodeSystemDao.create(codeSystem, theRequestDetails).getId().toUnqualified(); - - ResourceTable table = theResourceTableDao.findOne(id.getIdPartAsLong()); - - TermCodeSystemVersion cs = new TermCodeSystemVersion(); - cs.setResource(table); - cs.setResourceVersionId(table.getVersion()); - - TermConcept parentA = new TermConcept(cs, "ParentA").setDisplay("Parent A"); - cs.getConcepts().add(parentA); - - TermConcept childAA = new TermConcept(cs, "childAA").setDisplay("Child AA"); - parentA.addChild(childAA, RelationshipTypeEnum.ISA); - - TermConcept childAAA = new TermConcept(cs, "childAAA").setDisplay("Child AAA"); - childAA.addChild(childAAA, RelationshipTypeEnum.ISA); - - TermConcept childAAB = new TermConcept(cs, "childAAB").setDisplay("Child AAB"); - childAA.addChild(childAAB, RelationshipTypeEnum.ISA); - - TermConcept childAB = new TermConcept(cs, "childAB").setDisplay("Child AB"); - parentA.addChild(childAB, RelationshipTypeEnum.ISA); - - TermConcept parentB = new TermConcept(cs, "ParentB").setDisplay("Parent B"); - cs.getConcepts().add(parentB); - - theTermSvc.storeNewCodeSystemVersion(table.getId(), URL_MY_CODE_SYSTEM, cs); - return codeSystem; - } - private void createExternalCsAndLocalVs() { CodeSystem codeSystem = createExternalCs(); @@ -131,17 +75,17 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { //@formatter:off CodeSystem codeSystem = new CodeSystem(); codeSystem.setUrl(URL_MY_CODE_SYSTEM); - codeSystem.setContent(CodeSystemContentMode.COMPLETE); + codeSystem.setContent(CodeSystemContentMode.COMPLETE); codeSystem .addConcept().setCode("A").setDisplay("Code A") - .addConcept(new ConceptDefinitionComponent().setCode("AA").setDisplay("Code AA") - .addConcept(new ConceptDefinitionComponent().setCode("AAA").setDisplay("Code AAA")) - ) - .addConcept(new ConceptDefinitionComponent().setCode("AB").setDisplay("Code AB")); + .addConcept(new ConceptDefinitionComponent().setCode("AA").setDisplay("Code AA") + .addConcept(new ConceptDefinitionComponent().setCode("AAA").setDisplay("Code AAA")) + ) + .addConcept(new ConceptDefinitionComponent().setCode("AB").setDisplay("Code AB")); codeSystem .addConcept().setCode("B").setDisplay("Code B") - .addConcept(new ConceptDefinitionComponent().setCode("BA").setDisplay("Code BA")) - .addConcept(new ConceptDefinitionComponent().setCode("BB").setDisplay("Code BB")); + .addConcept(new ConceptDefinitionComponent().setCode("BA").setDisplay("Code BA")) + .addConcept(new ConceptDefinitionComponent().setCode("BB").setDisplay("Code BB")); //@formatter:on myCodeSystemDao.create(codeSystem, mySrd); @@ -177,7 +121,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { @Test public void testExpandById() throws IOException { //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onInstance(myExtensionalVsId) .named("expand") @@ -185,54 +129,30 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - assertThat(resp, containsString("")); + assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); - assertThat(resp, containsString("")); + assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); - assertThat(resp, containsString("")); + assertThat(resp, containsString("")); assertThat(resp, containsString("")); assertThat(resp, containsString("")); } - @Test - public void testExpandByIdentifier() { - //@formatter:off - Parameters respParam = ourClient - .operation() - .onType(ValueSet.class) - .named("expand") - .withParameter(Parameters.class, "identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) - .execute(); - ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); - //@formatter:on - - String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); - ourLog.info(resp); - //@formatter:off - assertThat(resp, stringContainsInOrder( - "", - "")); - //@formatter:on - - } - - // - @Test public void testExpandByIdWithFilter() throws IOException { //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onInstance(myExtensionalVsId) .named("expand") @@ -245,14 +165,32 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { ourLog.info(resp); assertThat(resp, containsString("")); assertThat(resp, not(containsString(""))); - + + } + + @Test + public void testExpandByUrl() { + Parameters respParam = myClient + .operation() + .onType(ValueSet.class) + .named("expand") + .withParameter(Parameters.class, "url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) + .execute(); + ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); + ourLog.info(resp); + assertThat(resp, stringContainsInOrder( + "", + "")); + } @Test public void testExpandByValueSet() throws IOException { ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml"); - - Parameters respParam = ourClient + + Parameters respParam = myClient .operation() .onType(ValueSet.class) .named("expand") @@ -263,18 +201,19 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); assertThat(resp, stringContainsInOrder( - "", - "")); + "", + "")); } + @Test public void testExpandInlineVsAgainstBuiltInCs() throws IOException { createLocalVsPointingAtBuiltInCodeSystem(); assertNotNull(myLocalValueSetId); - + //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onType(ValueSet.class) .named("expand") @@ -282,10 +221,10 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); } @@ -294,9 +233,9 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { createExternalCsAndLocalVs(); assertNotNull(myLocalVs); myLocalVs.setId(""); - + //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onType(ValueSet.class) .named("expand") @@ -304,22 +243,21 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, not(containsStringIgnoringCase(""))); - - } + } @Test public void testExpandInvalidParams() throws IOException { //@formatter:off try { - ourClient + myClient .operation() .onType(ValueSet.class) .named("expand") @@ -327,39 +265,39 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { .execute(); fail(); } catch (InvalidRequestException e) { - assertEquals("HTTP 400 Bad Request: $expand operation at the type level (no ID specified) requires an identifier or a valueSet as a part of the request", e.getMessage()); + assertEquals("HTTP 400 Bad Request: $expand operation at the type level (no ID specified) requires a url or a valueSet as a part of the request", e.getMessage()); } //@formatter:on //@formatter:off try { ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/r4/extensional-case-r4.xml"); - ourClient + myClient .operation() .onType(ValueSet.class) .named("expand") .withParameter(Parameters.class, "valueSet", toExpand) - .andParameter("identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) + .andParameter("url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) .execute(); fail(); } catch (InvalidRequestException e) { - assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.", e.getMessage()); + assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have a url specified, or have a ValueSet specified. Can not combine these options.", e.getMessage()); } //@formatter:on //@formatter:off try { ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/r4/extensional-case.xml"); - ourClient + myClient .operation() .onInstance(myExtensionalVsId) .named("expand") .withParameter(Parameters.class, "valueSet", toExpand) - .andParameter("identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) + .andParameter("url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2")) .execute(); fail(); } catch (InvalidRequestException e) { - assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.", e.getMessage()); + assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have a url specified, or have a ValueSet specified. Can not combine these options.", e.getMessage()); } //@formatter:on @@ -369,9 +307,9 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { public void testExpandLocalVsAgainstBuiltInCs() throws IOException { createLocalVsPointingAtBuiltInCodeSystem(); assertNotNull(myLocalValueSetId); - + //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onInstance(myLocalValueSetId) .named("expand") @@ -379,24 +317,20 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); } - - - - - + @Test public void testExpandLocalVsAgainstExternalCs() throws IOException { createExternalCsAndLocalVs(); assertNotNull(myLocalValueSetId); - + //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onInstance(myLocalValueSetId) .named("expand") @@ -404,48 +338,48 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, not(containsStringIgnoringCase(""))); - + } @Test public void testExpandLocalVsCanonicalAgainstExternalCs() throws IOException { createExternalCsAndLocalVs(); assertNotNull(myLocalValueSetId); - + //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onType(ValueSet.class) .named("expand") - .withParameter(Parameters.class, "identifier", new UriType(URL_MY_VALUE_SET)) + .withParameter(Parameters.class, "url", new UriType(URL_MY_VALUE_SET)) .execute(); ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource(); //@formatter:on - + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded); ourLog.info(resp); - + assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, containsStringIgnoringCase("")); assertThat(resp, not(containsStringIgnoringCase(""))); - + } @Test public void testExpandLocalVsWithUnknownCode() throws IOException { createExternalCsAndLocalVsWithUnknownCode(); assertNotNull(myLocalValueSetId); - + //@formatter:off try { - ourClient + myClient .operation() .onInstance(myLocalValueSetId) .named("expand") @@ -457,38 +391,35 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { //@formatter:on } + /** + * #516 + */ @Test - public void testValiedateCodeAgainstBuiltInSystem() { - //@formatter:off - Parameters respParam = ourClient - .operation() - .onType(ValueSet.class) - .named("validate-code") - .withParameter(Parameters.class, "code", new StringType("BRN")) - .andParameter("identifier", new StringType("http://hl7.org/fhir/ValueSet/v2-0487")) - .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487")) - .useHttpGet() - .execute(); - //@formatter:on + public void testInvalidFilter() throws Exception { + String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8); + HttpPost post = new HttpPost(ourServerBase + "/ValueSet/%24expand"); + post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW))); - String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); - ourLog.info(resp); - - assertEquals("result", respParam.getParameter().get(0).getName()); - assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).getValue().booleanValue()); - - assertEquals("message", respParam.getParameter().get(1).getName()); - assertThat(((StringType)respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded")); + CloseableHttpResponse resp = ourHttpClient.execute(post); + try { - assertEquals("display", respParam.getParameter().get(2).getName()); - assertEquals("Burn", ((StringType)respParam.getParameter().get(2).getValue()).getValue()); + String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8); + ourLog.info(respString); + + ourLog.info(resp.toString()); + + assertEquals(400, resp.getStatusLine().getStatusCode()); + assertThat(respString, containsString("Unknown FilterOperator code 'n'")); + + } finally { + IOUtils.closeQuietly(resp); + } } - @Test public void testValidateCodeOperationByCodeAndSystemInstance() { //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onInstance(myExtensionalVsId) .named("validate-code") @@ -499,14 +430,14 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); ourLog.info(resp); - - assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).booleanValue()); + + assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue()); } @Test public void testValidateCodeOperationByCodeAndSystemType() { //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onType(ValueSet.class) .named("validate-code") @@ -517,8 +448,33 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); ourLog.info(resp); - - assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).booleanValue()); + + assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue()); + } + + @Test + public void testValiedateCodeAgainstBuiltInSystem() { + Parameters respParam = myClient + .operation() + .onType(ValueSet.class) + .named("validate-code") + .withParameter(Parameters.class, "code", new StringType("BRN")) + .andParameter("url", new StringType("http://hl7.org/fhir/ValueSet/v2-0487")) + .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487")) + .useHttpGet() + .execute(); + + String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + assertEquals("result", respParam.getParameter().get(0).getName()); + assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).getValue().booleanValue()); + + assertEquals("message", respParam.getParameter().get(1).getName()); + assertThat(((StringType) respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded")); + + assertEquals("display", respParam.getParameter().get(2).getName()); + assertEquals("Burn", ((StringType) respParam.getParameter().get(2).getValue()).getValue()); } @AfterClass @@ -526,4 +482,38 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test { TestUtil.clearAllStaticFieldsForUnitTest(); } + public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, IHapiTerminologySvc theTermSvc, ServletRequestDetails theRequestDetails) { + CodeSystem codeSystem = new CodeSystem(); + codeSystem.setUrl(URL_MY_CODE_SYSTEM); + codeSystem.setContent(CodeSystemContentMode.NOTPRESENT); + IIdType id = theCodeSystemDao.create(codeSystem, theRequestDetails).getId().toUnqualified(); + + ResourceTable table = theResourceTableDao.findOne(id.getIdPartAsLong()); + + TermCodeSystemVersion cs = new TermCodeSystemVersion(); + cs.setResource(table); + cs.setResourceVersionId(table.getVersion()); + + TermConcept parentA = new TermConcept(cs, "ParentA").setDisplay("Parent A"); + cs.getConcepts().add(parentA); + + TermConcept childAA = new TermConcept(cs, "childAA").setDisplay("Child AA"); + parentA.addChild(childAA, RelationshipTypeEnum.ISA); + + TermConcept childAAA = new TermConcept(cs, "childAAA").setDisplay("Child AAA"); + childAA.addChild(childAAA, RelationshipTypeEnum.ISA); + + TermConcept childAAB = new TermConcept(cs, "childAAB").setDisplay("Child AAB"); + childAA.addChild(childAAB, RelationshipTypeEnum.ISA); + + TermConcept childAB = new TermConcept(cs, "childAB").setDisplay("Child AB"); + parentA.addChild(childAB, RelationshipTypeEnum.ISA); + + TermConcept parentB = new TermConcept(cs, "ParentB").setDisplay("Parent B"); + cs.getConcepts().add(parentB); + + theTermSvc.storeNewCodeSystemVersion(table.getId(), URL_MY_CODE_SYSTEM, cs); + return codeSystem; + } + } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java index 8334a1d3bd8..998e8250a57 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java @@ -56,7 +56,7 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test { } //@formatter:off - IClientExecutable, Bundle> search = ourClient + IClientExecutable, Bundle> search = myClient .search() .forResource(Patient.class) .where(Patient.NAME.matches().value("Everything")) @@ -74,12 +74,12 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test { String nextLinkUrl = nextLink.getUrl(); assertThat(nextLinkUrl, not(blankOrNullString())); - Bundle resp2 = ourClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); + Bundle resp2 = myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp2)); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); - ourClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); + myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); Thread.sleep(20); myDaoConfig.setExpireSearchResultsAfterMillis(10); @@ -87,7 +87,7 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test { myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); try { - ourClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); + myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); fail(); } catch (ResourceGoneException e) { assertThat(e.getMessage(), containsString("does not exist and may have expired")); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java index eac3edd6280..8724c3fdffa 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java @@ -57,7 +57,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.getChannel().setEndpoint("http://localhost:8888"); subs.setCriteria("Observation?identifier=123"); try { - ourClient.create().resource(subs).execute(); + myClient.create().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server")); @@ -65,14 +65,14 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.setId("ABC"); try { - ourClient.update().resource(subs).execute(); + myClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server")); } subs.setStatus(SubscriptionStatus.REQUESTED); - ourClient.update().resource(subs).execute(); + myClient.update().resource(subs).execute(); } @Test @@ -84,7 +84,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.setStatus(SubscriptionStatus.ACTIVE); subs.setCriteria("Observation?identifier=123"); try { - ourClient.create().resource(subs).execute(); + myClient.create().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage()); @@ -92,7 +92,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.setId("ABC"); try { - ourClient.update().resource(subs).execute(); + myClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage()); @@ -109,13 +109,13 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.getChannel().setEndpoint("http://localhost:8888"); subs.setStatus(SubscriptionStatus.REQUESTED); subs.setCriteria("Observation?identifier=123"); - IIdType id = ourClient.create().resource(subs).execute().getId().toUnqualifiedVersionless(); + IIdType id = myClient.create().resource(subs).execute().getId().toUnqualifiedVersionless(); subs.setId(id); try { subs.setStatus(SubscriptionStatus.ACTIVE); - ourClient.update().resource(subs).execute(); + myClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: Subscription.status can not be changed from 'requested' to 'active'", e.getMessage()); @@ -123,7 +123,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { try { subs.setStatus((SubscriptionStatus) null); - ourClient.update().resource(subs).execute(); + myClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server")); @@ -141,12 +141,12 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { subs.getChannel().setEndpoint("http://localhost:8888"); subs.setCriteria("Observation?identifier=123"); subs.setStatus(SubscriptionStatus.REQUESTED); - IIdType id = ourClient.create().resource(subs).execute().getId(); + IIdType id = myClient.create().resource(subs).execute().getId(); subs.setId(id); try { subs.setStatus(SubscriptionStatus.ACTIVE); - ourClient.update().resource(subs).execute(); + myClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertEquals("HTTP 422 Unprocessable Entity: Subscription.status can not be changed from 'requested' to 'active'", e.getMessage()); @@ -154,14 +154,14 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { try { subs.setStatus((SubscriptionStatus) null); - ourClient.update().resource(subs).execute(); + myClient.update().resource(subs).execute(); fail(); } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server")); } subs.setStatus(SubscriptionStatus.OFF); - ourClient.update().resource(subs).execute(); + myClient.update().resource(subs).execute(); } @AfterClass diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java index 708d05d6ac6..e15dee56274 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java @@ -43,7 +43,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes byte[] packageBytes = createSctZip(); //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onServer() .named("upload-external-code-system") @@ -63,7 +63,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes byte[] packageBytes = createLoincZip(); //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onServer() .named("upload-external-code-system") @@ -82,7 +82,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes */ //@formatter:off - respParam = ourClient + respParam = myClient .operation() .onServer() .named("upload-external-code-system") @@ -107,7 +107,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes fos.close(); //@formatter:off - Parameters respParam = ourClient + Parameters respParam = myClient .operation() .onServer() .named("upload-external-code-system") @@ -128,7 +128,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes //@formatter:off try { - ourClient + myClient .operation() .onServer() .named("upload-external-code-system") @@ -148,7 +148,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes //@formatter:off try { - ourClient + myClient .operation() .onServer() .named("upload-external-code-system") @@ -165,7 +165,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes public void testUploadMissingPackage() throws Exception { //@formatter:off try { - ourClient + myClient .operation() .onServer() .named("upload-external-code-system") diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java index 2720e48f8f3..9126cec246a 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java @@ -1,41 +1,60 @@ package ca.uhn.fhir.jpa.search; -import static org.junit.Assert.*; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.*; - -import java.util.*; - -import javax.persistence.EntityManager; - -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.junit.*; -import org.junit.runner.RunWith; -import org.mockito.*; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.runners.MockitoJUnitRunner; -import org.mockito.stubbing.Answer; -import org.springframework.data.domain.*; -import org.springframework.transaction.PlatformTransactionManager; - -import com.google.common.collect.Lists; - import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.dao.*; -import ca.uhn.fhir.jpa.dao.data.*; -import ca.uhn.fhir.jpa.entity.*; +import ca.uhn.fhir.jpa.dao.DaoConfig; +import ca.uhn.fhir.jpa.dao.IDao; +import ca.uhn.fhir.jpa.dao.ISearchBuilder; +import ca.uhn.fhir.jpa.dao.SearchParameterMap; +import ca.uhn.fhir.jpa.dao.data.ISearchDao; +import ca.uhn.fhir.jpa.dao.data.ISearchIncludeDao; +import ca.uhn.fhir.jpa.dao.data.ISearchResultDao; +import ca.uhn.fhir.jpa.entity.Search; +import ca.uhn.fhir.jpa.entity.SearchResult; +import ca.uhn.fhir.jpa.entity.SearchStatusEnum; +import ca.uhn.fhir.jpa.entity.SearchTypeEnum; import ca.uhn.fhir.jpa.util.BaseIterator; import ca.uhn.fhir.model.dstu2.resource.Patient; +import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.StringParam; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.util.TestUtil; +import com.google.common.collect.Lists; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.stubbing.Answer; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; +import org.springframework.transaction.PlatformTransactionManager; -@SuppressWarnings({ "unchecked" }) +import javax.persistence.EntityManager; +import java.util.*; + +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.same; +import static org.mockito.Mockito.*; + +@SuppressWarnings({"unchecked"}) @RunWith(MockitoJUnitRunner.class) public class SearchCoordinatorSvcImplTest { private static FhirContext ourCtx = FhirContext.forDstu3(); + @Captor + ArgumentCaptor> mySearchResultIterCaptor; @Mock private IDao myCallingDao; @Mock @@ -49,10 +68,6 @@ public class SearchCoordinatorSvcImplTest { private ISearchIncludeDao mySearchIncludeDao; @Mock private ISearchResultDao mySearchResultDao; - @Captor - ArgumentCaptor> mySearchResultIterCaptor; - - private SearchCoordinatorSvcImpl mySvc; @Mock @@ -63,9 +78,10 @@ public class SearchCoordinatorSvcImplTest { public void after() { verify(myCallingDao, atMost(myExpectedNumberOfSearchBuildersCreated)).newSearchBuilder(); } + @Before public void before() { - + mySvc = new SearchCoordinatorSvcImpl(); mySvc.setEntityManagerForUnitTest(myEntityManager); mySvc.setTransactionManagerForUnitTest(myTxManager); @@ -76,9 +92,9 @@ public class SearchCoordinatorSvcImplTest { myDaoConfig = new DaoConfig(); mySvc.setDaoConfigForUnitTest(myDaoConfig); - + when(myCallingDao.newSearchBuilder()).thenReturn(mySearchBuider); - + doAnswer(new Answer() { @Override public Void answer(InvocationOnMock theInvocation) throws Throwable { @@ -89,7 +105,8 @@ public class SearchCoordinatorSvcImplTest { provider.setEntityManager(myEntityManager); provider.setContext(ourCtx); return null; - }}).when(myCallingDao).injectDependenciesIntoBundleProvider(any(PersistedJpaBundleProvider.class)); + } + }).when(myCallingDao).injectDependenciesIntoBundleProvider(any(PersistedJpaBundleProvider.class)); } private List createPidSequence(int from, int to) { @@ -128,7 +145,7 @@ public class SearchCoordinatorSvcImplTest { doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao)); - IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient"); + IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective()); assertNotNull(result.getUuid()); assertEquals(null, result.size()); @@ -146,17 +163,17 @@ public class SearchCoordinatorSvcImplTest { params.add("name", new StringParam("ANAME")); List pids = createPidSequence(10, 800); - Iterator iter = new SlowIterator(pids.iterator(), 2); + Iterator iter = new SlowIterator(pids.iterator(), 1); when(mySearchBuider.createQuery(Mockito.same(params), any(String.class))).thenReturn(iter); doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao)); - IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient"); + IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective()); assertNotNull(result.getUuid()); assertEquals(null, result.size()); List resources; - + resources = result.getResources(0, 100000); assertEquals(790, resources.size()); assertEquals("10", resources.get(0).getIdElement().getValueAsString()); @@ -164,18 +181,18 @@ public class SearchCoordinatorSvcImplTest { ArgumentCaptor searchCaptor = ArgumentCaptor.forClass(Search.class); verify(mySearchDao, atLeastOnce()).save(searchCaptor.capture()); - + verify(mySearchResultDao, atLeastOnce()).save(mySearchResultIterCaptor.capture()); - List allResults= new ArrayList(); + List allResults = new ArrayList(); for (Iterable next : mySearchResultIterCaptor.getAllValues()) { allResults.addAll(Lists.newArrayList(next)); } - + assertEquals(790, allResults.size()); assertEquals(10, allResults.get(0).getResourcePid().longValue()); assertEquals(799, allResults.get(789).getResourcePid().longValue()); } - + @Test public void testAsyncSearchLargeResultSetSameCoordinator() { SearchParameterMap params = new SearchParameterMap(); @@ -187,12 +204,12 @@ public class SearchCoordinatorSvcImplTest { doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao)); - IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient"); + IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective()); assertNotNull(result.getUuid()); assertEquals(null, result.size()); List resources; - + resources = result.getResources(0, 30); assertEquals(30, resources.size()); assertEquals("10", resources.get(0).getIdElement().getValueAsString()); @@ -202,7 +219,7 @@ public class SearchCoordinatorSvcImplTest { /** * Subsequent requests for the same search (i.e. a request for the next - * page) within the same JVM will not use the original bundle provider + * page) within the same JVM will not use the original bundle provider */ @Test public void testAsyncSearchLargeResultSetSecondRequestSameCoordinator() { @@ -215,7 +232,7 @@ public class SearchCoordinatorSvcImplTest { doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao)); - IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient"); + IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective()); assertNotNull(result.getUuid()); assertEquals(null, result.size()); @@ -223,10 +240,10 @@ public class SearchCoordinatorSvcImplTest { verify(mySearchDao, atLeast(1)).save(searchCaptor.capture()); Search search = searchCaptor.getValue(); assertEquals(SearchTypeEnum.SEARCH, search.getSearchType()); - + List resources; PersistedJpaBundleProvider provider; - + resources = result.getResources(0, 10); assertNull(result.size()); assertEquals(10, resources.size()); @@ -244,7 +261,7 @@ public class SearchCoordinatorSvcImplTest { assertEquals(10, resources.size()); assertEquals("20", resources.get(0).getIdElement().getValueAsString()); assertEquals("29", resources.get(9).getIdElement().getValueAsString()); - + provider = new PersistedJpaBundleProvider(result.getUuid(), myCallingDao); resources = provider.getResources(20, 99999); assertEquals(770, resources.size()); @@ -265,7 +282,7 @@ public class SearchCoordinatorSvcImplTest { doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao)); - IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient"); + IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective()); assertNotNull(result.getUuid()); assertEquals(90, result.size().intValue()); @@ -285,18 +302,18 @@ public class SearchCoordinatorSvcImplTest { @Test public void testLoadSearchResultsFromDifferentCoordinator() { final String uuid = UUID.randomUUID().toString(); - + final Search search = new Search(); search.setUuid(uuid); search.setSearchType(SearchTypeEnum.SEARCH); search.setResourceType("Patient"); - + when(mySearchDao.findByUuid(eq(uuid))).thenReturn(search); doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao)); PersistedJpaBundleProvider provider; List resources; - + new Thread() { @Override public void run() { @@ -305,20 +322,21 @@ public class SearchCoordinatorSvcImplTest { } catch (InterruptedException e) { // ignore } - + when(mySearchResultDao.findWithSearchUuid(any(Search.class), any(Pageable.class))).thenAnswer(new Answer>() { @Override public Page answer(InvocationOnMock theInvocation) throws Throwable { Pageable page = (Pageable) theInvocation.getArguments()[1]; - + ArrayList results = new ArrayList(); int max = (page.getPageNumber() * page.getPageSize()) + page.getPageSize(); for (int i = page.getOffset(); i < max; i++) { results.add(new SearchResult().setResourcePid(i + 10L)); } - + return new PageImpl(results); - }}); + } + }); search.setStatus(SearchStatusEnum.FINISHED); } }.start(); @@ -332,7 +350,7 @@ public class SearchCoordinatorSvcImplTest { assertEquals(10, resources.size()); assertEquals("20", resources.get(0).getIdElement().getValueAsString()); assertEquals("29", resources.get(9).getIdElement().getValueAsString()); - + provider = new PersistedJpaBundleProvider(uuid, myCallingDao); resources = provider.getResources(20, 40); assertEquals(20, resources.size()); @@ -353,7 +371,7 @@ public class SearchCoordinatorSvcImplTest { doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(eq(pids), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao)); - IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient"); + IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective()); assertNull(result.getUuid()); assertEquals(790, result.size().intValue()); @@ -375,7 +393,7 @@ public class SearchCoordinatorSvcImplTest { pids = createPidSequence(10, 110); doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(eq(pids), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao)); - IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient"); + IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective()); assertNull(result.getUuid()); assertEquals(100, result.size().intValue()); @@ -394,7 +412,7 @@ public class SearchCoordinatorSvcImplTest { private int myCount; private Iterator myWrap; - + public FailAfterNIterator(Iterator theWrap, int theCount) { myWrap = theWrap; myCount = theCount; @@ -416,7 +434,7 @@ public class SearchCoordinatorSvcImplTest { } - + public static class SlowIterator extends BaseIterator implements Iterator { private int myDelay; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java index 851f28a3dbf..121debf6f37 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java @@ -61,7 +61,7 @@ public class PagingMultinodeProviderR4Test extends BaseResourceProviderR4Test { mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10); mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true); - found = ourClient + found = myClient .search() .forResource(Patient.class) .sort().ascending(Patient.SP_FAMILY) @@ -70,19 +70,19 @@ public class PagingMultinodeProviderR4Test extends BaseResourceProviderR4Test { .execute(); assertThat(toUnqualifiedVersionlessIdValues(found), contains("Patient/A000", "Patient/A001", "Patient/A002", "Patient/A003", "Patient/A004", "Patient/A005", "Patient/A006", "Patient/A007", "Patient/A008", "Patient/A009")); - found = ourClient + found = myClient .loadPage() .next(found) .execute(); assertThat(toUnqualifiedVersionlessIdValues(found), contains("Patient/A010", "Patient/A011", "Patient/A012", "Patient/A013", "Patient/A014", "Patient/A015", "Patient/A016", "Patient/A017", "Patient/A018", "Patient/A019")); - found = ourClient + found = myClient .loadPage() .next(found) .execute(); assertThat(toUnqualifiedVersionlessIdValues(found), contains("Patient/A020", "Patient/A021", "Patient/A022", "Patient/A023", "Patient/A024", "Patient/A025", "Patient/A026", "Patient/A027", "Patient/A028", "Patient/A029")); - found = ourClient + found = myClient .loadPage() .next(found) .execute(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestDstu3Test.java index 82d2f6a02fe..ca346af6e6a 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestDstu3Test.java @@ -1,51 +1,54 @@ package ca.uhn.fhir.jpa.stresstest; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import java.util.List; -import java.util.UUID; - +import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; +import ca.uhn.fhir.util.TestUtil; +import com.google.common.base.Charsets; +import com.google.common.collect.Lists; import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle.BundleType; import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb; -import org.junit.*; +import org.hl7.fhir.dstu3.model.CodeableConcept; +import org.hl7.fhir.dstu3.model.Coding; +import org.hl7.fhir.dstu3.model.Patient; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; -import com.google.common.base.Charsets; -import com.google.common.collect.Lists; +import java.util.List; +import java.util.UUID; -import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; -import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; -import ca.uhn.fhir.util.TestUtil; +import static org.junit.Assert.*; public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StressTestDstu3Test.class); private RequestValidatingInterceptor myRequestValidatingInterceptor; + @After + public void after() throws Exception { + super.after(); + + ourRestServer.unregisterInterceptor(myRequestValidatingInterceptor); + } + @Before public void before() throws Exception { super.before(); - + myRequestValidatingInterceptor = new RequestValidatingInterceptor(); FhirInstanceValidator module = new FhirInstanceValidator(); module.setValidationSupport(myValidationSupport); myRequestValidatingInterceptor.addValidatorModule(module); } - @After - public void after() throws Exception { - super.after(); - - ourRestServer.unregisterInterceptor(myRequestValidatingInterceptor); - } - @Test public void testMultithreadedSearch() throws Exception { Bundle input = new Bundle(); @@ -56,8 +59,8 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { input.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient"); } ourClient.transaction().withBundle(input).execute(); - - + + List tasks = Lists.newArrayList(); try { for (int threadIndex = 0; threadIndex < 10; threadIndex++) { @@ -74,10 +77,9 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { validateNoErrors(tasks); } - - + /** - * This test prevents a deadlock that was detected with a large number of + * This test prevents a deadlock that was detected with a large number of * threads creating resources and blocking on the searchparamcache refreshing * (since this is a synchronized method) while the instance that was actually * executing was waiting on a DB connection. This was solved by making @@ -87,7 +89,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { @Test public void testMultithreadedSearchWithValidation() throws Exception { ourRestServer.registerInterceptor(myRequestValidatingInterceptor); - + Bundle input = new Bundle(); input.setType(BundleType.TRANSACTION); for (int i = 0; i < 500; i++) { @@ -96,7 +98,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { input.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient"); } ourClient.transaction().withBundle(input).execute(); - + CloseableHttpResponse getMeta = ourHttpClient.execute(new HttpGet(ourServerBase + "/metadata")); try { assertEquals(200, getMeta.getStatusLine().getStatusCode()); @@ -133,7 +135,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { } total += next.getTaskCount(); } - + ourLog.info("Loaded {} searches", total); } @@ -142,14 +144,14 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { TestUtil.clearAllStaticFieldsForUnitTest(); } - public class BaseTask extends Thread { + public class BaseTask extends Thread { protected Throwable myError; protected int myTaskCount = 0; - + public BaseTask() { setDaemon(true); } - + public Throwable getError() { return myError; } @@ -168,7 +170,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { for (int i = 0; i < 10; i++) { try { Bundle respBundle; - + // Load search HttpGet get = new HttpGet(ourServerBase + "/Patient?identifier=http%3A%2F%2Ftest%7CBAR," + UUID.randomUUID().toString()); get.addHeader(Constants.HEADER_CONTENT_TYPE, Constants.CT_FHIR_JSON_NEW); @@ -181,7 +183,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { } finally { IOUtils.closeQuietly(getResp); } - + // Load page 2 get = new HttpGet(respBundle.getLink("next").getUrl()); get.addHeader(Constants.HEADER_CONTENT_TYPE, Constants.CT_FHIR_JSON_NEW); @@ -194,7 +196,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { } finally { IOUtils.closeQuietly(getResp); } - + } catch (Throwable e) { ourLog.error("Failure during search", e); myError = e; @@ -214,9 +216,9 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { p.addIdentifier().setSystem("http://test").setValue("BAR").setType(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("bar"))); p.setGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE); ourClient.create().resource(p).execute(); - + ourSearchParamRegistry.forceRefresh(); - + } catch (Throwable e) { ourLog.error("Failure during search", e); myError = e; @@ -226,4 +228,5 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test { } } + } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/EmailSubscriptionDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/EmailSubscriptionDstu2Test.java index 007872d6992..310b8c515d3 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/EmailSubscriptionDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/EmailSubscriptionDstu2Test.java @@ -2,10 +2,9 @@ package ca.uhn.fhir.jpa.subscription; import ca.uhn.fhir.jpa.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test; -import ca.uhn.fhir.jpa.subscription.email.EmailDetails; -import ca.uhn.fhir.jpa.subscription.email.EmailSender; -import ca.uhn.fhir.jpa.subscription.email.IEmailSender; +import ca.uhn.fhir.jpa.subscription.email.JavaMailEmailSender; import ca.uhn.fhir.jpa.subscription.email.SubscriptionEmailInterceptor; +import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider; import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.resource.Observation; @@ -14,11 +13,9 @@ import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum; import ca.uhn.fhir.model.dstu2.valueset.SubscriptionChannelTypeEnum; import ca.uhn.fhir.model.dstu2.valueset.SubscriptionStatusEnum; import ca.uhn.fhir.rest.api.MethodOutcome; -import com.icegreen.greenmail.imap.ImapConstants; -import com.icegreen.greenmail.store.MailFolder; -import com.icegreen.greenmail.store.Store; import com.icegreen.greenmail.util.GreenMail; import com.icegreen.greenmail.util.GreenMailUtil; +import com.icegreen.greenmail.util.ServerSetup; import com.icegreen.greenmail.util.ServerSetupTest; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.*; @@ -39,6 +36,7 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test { private static final Logger ourLog = LoggerFactory.getLogger(EmailSubscriptionDstu2Test.class); private static GreenMail ourTestSmtp; + private static int ourListenerPort; private SubscriptionEmailInterceptor mySubscriber; private List mySubscriptionIds = new ArrayList<>(); @@ -62,15 +60,16 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test { public void before() throws Exception { super.before(); - EmailSender emailSender = new EmailSender(); - emailSender.setSmtpServerHost("localhost"); - emailSender.setSmtpServerPort(3025); + JavaMailEmailSender emailSender = new JavaMailEmailSender(); + emailSender.setSmtpServerHostname("localhost"); + emailSender.setSmtpServerPort(ourListenerPort); emailSender.start(); mySubscriber = new SubscriptionEmailInterceptor(); mySubscriber.setEmailSender(emailSender); mySubscriber.setResourceDaos(myResourceDaos); mySubscriber.setFhirContext(myFhirCtx); + mySubscriber.setTxManager(ourTxManager); mySubscriber.start(); ourRestServer.registerInterceptor(mySubscriber); @@ -128,7 +127,7 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test { @Test public void testSubscribeAndDeliver() throws Exception { - String payload = "application/json"; + String payload = "A subscription update has been received"; String code = "1000000050"; String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml"; @@ -152,12 +151,12 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test { ourLog.info("Received: " + GreenMailUtil.getWholeMessage(messages[msgIdx])); assertEquals("HAPI FHIR Subscriptions", messages[msgIdx].getSubject()); assertEquals(1, messages[msgIdx].getFrom().length); - assertEquals("unknown@sender.com", ((InternetAddress) messages[msgIdx].getFrom()[0]).getAddress()); + assertEquals("noreply@unknown.com", ((InternetAddress) messages[msgIdx].getFrom()[0]).getAddress()); assertEquals(2, messages[msgIdx].getAllRecipients().length); assertEquals("to1@example.com", ((InternetAddress) messages[msgIdx].getAllRecipients()[0]).getAddress()); assertEquals("to2@example.com", ((InternetAddress) messages[msgIdx].getAllRecipients()[1]).getAddress()); assertEquals(1, messages[msgIdx].getHeader("Content-Type").length); - assertEquals("text/plain; charset=UTF-8", messages[msgIdx].getHeader("Content-Type")[0]); + assertEquals("text/plain; charset=us-ascii", messages[msgIdx].getHeader("Content-Type")[0]); String foundBody = GreenMailUtil.getBody(messages[msgIdx]); assertEquals("A subscription update has been received", foundBody); @@ -171,7 +170,10 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test { @BeforeClass public static void beforeClass() { - ourTestSmtp = new GreenMail(ServerSetupTest.SMTP); + ourListenerPort = RandomServerPortProvider.findFreePort(); + ServerSetup smtp = new ServerSetup(ourListenerPort, null, ServerSetup.PROTOCOL_SMTP); + smtp.setServerStartupTimeout(2000); + ourTestSmtp = new GreenMail(smtp); ourTestSmtp.start(); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java index aa079ac0871..46baafdadfb 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java @@ -72,6 +72,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B public void beforeReset() { ourCreatedObservations.clear(); ourUpdatedObservations.clear(); + + ourRestHookSubscriptionInterceptor.initSubscriptions(); } private void waitForQueueToDrain() throws InterruptedException { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java new file mode 100644 index 00000000000..7e85a05d75e --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java @@ -0,0 +1,223 @@ + +package ca.uhn.fhir.jpa.subscription.email; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.jpa.dao.DaoConfig; +import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; +import ca.uhn.fhir.jpa.subscription.RestHookTestDstu2Test; +import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider; +import ca.uhn.fhir.jpa.util.JpaConstants; +import ca.uhn.fhir.rest.annotation.Create; +import ca.uhn.fhir.rest.annotation.ResourceParam; +import ca.uhn.fhir.rest.annotation.Update; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.MethodOutcome; +import ca.uhn.fhir.rest.server.IResourceProvider; +import ca.uhn.fhir.rest.server.RestfulServer; +import ca.uhn.fhir.util.PortUtil; +import com.google.common.collect.Lists; +import com.icegreen.greenmail.store.FolderException; +import com.icegreen.greenmail.util.GreenMail; +import com.icegreen.greenmail.util.ServerSetup; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.instance.model.api.IIdType; +import org.junit.*; + +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.Callable; + +import static org.junit.Assert.*; + +/** + * Test the rest-hook subscriptions + */ +public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(EmailSubscriptionDstu3Test.class); + private static List ourCreatedObservations = Lists.newArrayList(); + private static int ourListenerPort; + private static List ourContentTypes = new ArrayList<>(); + private static GreenMail ourTestSmtp; + private List mySubscriptionIds = new ArrayList<>(); + + @After + public void afterUnregisterEmailListener() { + ourLog.info("**** Starting @After *****"); + + for (IIdType next : mySubscriptionIds){ + ourClient.delete().resourceById(next).execute(); + } + mySubscriptionIds.clear(); + + myDaoConfig.setAllowMultipleDelete(true); + ourLog.info("Deleting all subscriptions"); + ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); + ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); + ourLog.info("Done deleting all subscriptions"); + myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + + ourRestServer.unregisterInterceptor(ourEmailSubscriptionInterceptor); + + } + + @Before + public void beforeRegisterEmailListener() throws FolderException { + ourTestSmtp.purgeEmailFromAllMailboxes();; + ourRestServer.registerInterceptor(ourEmailSubscriptionInterceptor); + + JavaMailEmailSender emailSender = new JavaMailEmailSender(); + emailSender.setSmtpServerHostname("localhost"); + emailSender.setSmtpServerPort(ourListenerPort); + emailSender.start(); + + ourEmailSubscriptionInterceptor.setEmailSender(emailSender); + ourEmailSubscriptionInterceptor.setDefaultFromAddress("123@hapifhir.io"); + } + + @AfterClass + public static void afterClass() { + ourTestSmtp.stop(); + } + + @BeforeClass + public static void beforeClass() { + ourListenerPort = RandomServerPortProvider.findFreePort(); + ServerSetup smtp = new ServerSetup(ourListenerPort, null, ServerSetup.PROTOCOL_SMTP); + smtp.setServerStartupTimeout(2000); + ourTestSmtp = new GreenMail(smtp); + ourTestSmtp.start(); + } + + + + private Subscription createSubscription(String theCriteria, String thePayload) throws InterruptedException { + Subscription subscription = new Subscription(); + subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)"); + subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED); + subscription.setCriteria(theCriteria); + + Subscription.SubscriptionChannelComponent channel = new Subscription.SubscriptionChannelComponent(); + channel.setType(Subscription.SubscriptionChannelType.EMAIL); + channel.setPayload(thePayload); + channel.setEndpoint("mailto:foo@example.com"); + subscription.setChannel(channel); + + MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); + subscription.setId(methodOutcome.getId().getIdPart()); + mySubscriptionIds.add(methodOutcome.getId()); + + waitForQueueToDrain(); + + return subscription; + } + + private Observation sendObservation(String code, String system) { + Observation observation = new Observation(); + CodeableConcept codeableConcept = new CodeableConcept(); + observation.setCode(codeableConcept); + Coding coding = codeableConcept.addCoding(); + coding.setCode(code); + coding.setSystem(system); + + observation.setStatus(Observation.ObservationStatus.FINAL); + + MethodOutcome methodOutcome = ourClient.create().resource(observation).execute(); + + String observationId = methodOutcome.getId().getIdPart(); + observation.setId(observationId); + + return observation; + } + + @Test + public void testEmailSubscriptionNormal() throws Exception { + String payload = "This is the body"; + + String code = "1000000050"; + String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml"; + createSubscription(criteria1, payload); + waitForQueueToDrain(); + + sendObservation(code, "SNOMED-CT"); + waitForQueueToDrain(); + + waitForSize(1, 20000, new Callable() { + @Override + public Number call() throws Exception { + return ourTestSmtp.getReceivedMessages().length; + } + }); + + List received = Arrays.asList(ourTestSmtp.getReceivedMessages()); + assertEquals(1, received.get(0).getFrom().length); + assertEquals("123@hapifhir.io", ((InternetAddress)received.get(0).getFrom()[0]).getAddress()); + assertEquals(1, received.get(0).getAllRecipients().length); + assertEquals("foo@example.com", ((InternetAddress)received.get(0).getAllRecipients()[0]).getAddress()); + assertEquals("text/plain; charset=us-ascii", received.get(0).getContentType()); + assertEquals("This is the body", received.get(0).getContent().toString().trim()); + assertEquals(mySubscriptionIds.get(0).toUnqualifiedVersionless().getValue(), received.get(0).getHeader("X-FHIR-Subscription")[0]); + } + + + @Test + public void testEmailSubscriptionWithCustom() throws Exception { + String payload = "This is the body"; + + String code = "1000000050"; + String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml"; + Subscription sub1 = createSubscription(criteria1, payload); + + Subscription subscriptionTemp = ourClient.read(Subscription.class, sub1.getId()); + Assert.assertNotNull(subscriptionTemp); + subscriptionTemp.getChannel().addExtension() + .setUrl(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM) + .setValue(new StringType("myfrom@from.com")); + subscriptionTemp.getChannel().addExtension() + .setUrl(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE) + .setValue(new StringType("This is a subject")); + subscriptionTemp.setIdElement(subscriptionTemp.getIdElement().toUnqualifiedVersionless()); + + + ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(subscriptionTemp)); + + + ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); + waitForQueueToDrain(); + + + sendObservation(code, "SNOMED-CT"); + waitForQueueToDrain(); + + waitForSize(1, 20000, new Callable() { + @Override + public Number call() throws Exception { + return ourTestSmtp.getReceivedMessages().length; + } + }); + + List received = Arrays.asList(ourTestSmtp.getReceivedMessages()); + assertEquals(1, received.size()); + assertEquals(1, received.get(0).getFrom().length); + assertEquals("myfrom@from.com", ((InternetAddress)received.get(0).getFrom()[0]).getAddress()); + assertEquals(1, received.get(0).getAllRecipients().length); + assertEquals("foo@example.com", ((InternetAddress)received.get(0).getAllRecipients()[0]).getAddress()); + assertEquals("text/plain; charset=us-ascii", received.get(0).getContentType()); + assertEquals("This is a subject", received.get(0).getSubject().toString().trim()); + assertEquals("This is the body", received.get(0).getContent().toString().trim()); + assertEquals(mySubscriptionIds.get(0).toUnqualifiedVersionless().getValue(), received.get(0).getHeader("X-FHIR-Subscription")[0]); + } + + private void waitForQueueToDrain() throws InterruptedException { + RestHookTestDstu2Test.waitForQueueToDrain(ourEmailSubscriptionInterceptor); + } + +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSenderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSenderTest.java similarity index 66% rename from hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSenderTest.java rename to hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSenderTest.java index b86ad483d6b..828441acb29 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSenderTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSenderTest.java @@ -1,8 +1,10 @@ package ca.uhn.fhir.jpa.subscription.email; +import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider; import com.icegreen.greenmail.util.GreenMail; import com.icegreen.greenmail.util.GreenMailUtil; -import com.icegreen.greenmail.util.ServerSetupTest; +import com.icegreen.greenmail.util.ServerSetup; +import org.hl7.fhir.dstu3.model.IdType; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -15,21 +17,25 @@ import java.util.Arrays; import static org.junit.Assert.*; -public class EmailSenderTest { +public class JavaMailEmailSenderTest { - private static final Logger ourLog = LoggerFactory.getLogger(EmailSenderTest.class); + private static final Logger ourLog = LoggerFactory.getLogger(JavaMailEmailSenderTest.class); private static GreenMail ourTestSmtp; + private static int ourPort; @Test public void testSend() throws Exception { - EmailSender sender = new EmailSender(); - sender.setSmtpServerHost("localhost"); - sender.setSmtpServerPort(3025); + JavaMailEmailSender sender = new JavaMailEmailSender(); + sender.setSmtpServerHostname("localhost"); + sender.setSmtpServerPort(ourPort); + sender.setSmtpServerUsername(null); + sender.setSmtpServerPassword(null); sender.start(); String body = "foo"; EmailDetails details = new EmailDetails(); + details.setSubscription(new IdType("Subscription/123")); details.setFrom("foo@example.com "); details.setTo(Arrays.asList(" to1@example.com", "to2@example.com ")); details.setSubjectTemplate("test subject"); @@ -46,7 +52,7 @@ public class EmailSenderTest { assertEquals("to1@example.com", ((InternetAddress)messages[0].getAllRecipients()[0]).getAddress()); assertEquals("to2@example.com", ((InternetAddress)messages[0].getAllRecipients()[1]).getAddress()); assertEquals(1, messages[0].getHeader("Content-Type").length); - assertEquals("text/plain; charset=UTF-8", messages[0].getHeader("Content-Type")[0]); + assertEquals("text/plain; charset=us-ascii", messages[0].getHeader("Content-Type")[0]); String foundBody = GreenMailUtil.getBody(messages[0]); assertEquals("foo", foundBody); } @@ -58,7 +64,10 @@ public class EmailSenderTest { @BeforeClass public static void beforeClass() { - ourTestSmtp = new GreenMail(ServerSetupTest.SMTP); + ourPort = RandomServerPortProvider.findFreePort(); + ServerSetup smtp = new ServerSetup(ourPort, null, ServerSetup.PROTOCOL_SMTP); + smtp.setServerStartupTimeout(2000); + ourTestSmtp = new GreenMail(smtp); ourTestSmtp.start(); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java index 27b6935593e..9dea424bd06 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java @@ -54,7 +54,7 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc channel.setPayload(thePayload); channel.setEndpoint(theEndpoint); - MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); + MethodOutcome methodOutcome = myClient.create().resource(subscription).execute(); subscription.setId(methodOutcome.getId().getIdPart()); waitForQueueToDrain(); @@ -71,7 +71,7 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome = ourClient.create().resource(observation).execute(); + MethodOutcome methodOutcome = myClient.create().resource(observation).execute(); String observationId = methodOutcome.getId().getIdPart(); observation.setId(observationId); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java index 515e85d82e4..a8a5d3a702d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java @@ -51,14 +51,16 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { @After public void afterUnregisterRestHookListener() { for (IIdType next : mySubscriptionIds) { - ourClient.delete().resourceById(next).execute(); + IIdType nextId = next.toUnqualifiedVersionless(); + ourLog.info("Deleting: {}", nextId); + myClient.delete().resourceById(nextId).execute(); } mySubscriptionIds.clear(); myDaoConfig.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); - ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); - ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); + myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); + myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); @@ -89,7 +91,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { channel.setPayload(thePayload); channel.setEndpoint(theEndpoint); - MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); + MethodOutcome methodOutcome = myClient.create().resource(subscription).execute(); subscription.setId(methodOutcome.getId().getIdPart()); mySubscriptionIds.add(methodOutcome.getId()); @@ -107,7 +109,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome = ourClient.create().resource(observation).execute(); + MethodOutcome methodOutcome = myClient.create().resource(observation).execute(); String observationId = methodOutcome.getId().getIdPart(); observation.setId(observationId); @@ -154,11 +156,11 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(1, ourUpdatedObservations); assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0)); - Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); + Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId()); Assert.assertNotNull(subscriptionTemp); subscriptionTemp.setCriteria(criteria1); - ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); + myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); waitForQueueToDrain(); Observation observation2 = sendObservation(code, "SNOMED-CT"); @@ -168,7 +170,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(0, ourCreatedObservations); waitForSize(3, ourUpdatedObservations); - ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute(); + myClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute(); waitForQueueToDrain(); Observation observationTemp3 = sendObservation(code, "SNOMED-CT"); @@ -178,27 +180,27 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId()); + Observation observation3 = myClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept = new CodeableConcept(); observation3.setCode(codeableConcept); Coding coding = codeableConcept.addCoding(); coding.setCode(code + "111"); coding.setSystem("SNOMED-CT"); - ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); + myClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); // Should see no subscription notification waitForQueueToDrain(); waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId()); + Observation observation3a = myClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept1 = new CodeableConcept(); observation3a.setCode(codeableConcept1); Coding coding1 = codeableConcept1.addCoding(); coding1.setCode(code); coding1.setSystem("SNOMED-CT"); - ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); + myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); // Should see only one subscription notification waitForQueueToDrain(); @@ -229,10 +231,10 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(1, ourUpdatedObservations); assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0)); - Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); + Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId()); Assert.assertNotNull(subscriptionTemp); subscriptionTemp.setCriteria(criteria1); - ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); + myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); waitForQueueToDrain(); Observation observation2 = sendObservation(code, "SNOMED-CT"); @@ -242,7 +244,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(0, ourCreatedObservations); waitForSize(3, ourUpdatedObservations); - ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute(); + myClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute(); Observation observationTemp3 = sendObservation(code, "SNOMED-CT"); @@ -251,27 +253,27 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId()); + Observation observation3 = myClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept = new CodeableConcept(); observation3.setCode(codeableConcept); Coding coding = codeableConcept.addCoding(); coding.setCode(code + "111"); coding.setSystem("SNOMED-CT"); - ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); + myClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); // Should see no subscription notification waitForQueueToDrain(); waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId()); + Observation observation3a = myClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept1 = new CodeableConcept(); observation3a.setCode(codeableConcept1); Coding coding1 = codeableConcept1.addCoding(); coding1.setCode(code); coding1.setSystem("SNOMED-CT"); - ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); + myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); // Should see only one subscription notification waitForQueueToDrain(); @@ -331,7 +333,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { subscription.getChannel().addHeader("X-Foo: FOO"); subscription.getChannel().addHeader("X-Bar: BAR"); subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED); - ourClient.update().resource(subscription).execute(); + myClient.update().resource(subscription).execute(); waitForQueueToDrain(); sendObservation(code, "SNOMED-CT"); @@ -362,7 +364,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test { // Disable subscription.setStatus(Subscription.SubscriptionStatus.OFF); - ourClient.update().resource(subscription).execute(); + myClient.update().resource(subscription).execute(); waitForQueueToDrain(); // Send another object diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java index 48c54cdedee..32e418e82a8 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java @@ -1,8 +1,6 @@ package ca.uhn.fhir.jpa.subscription.r4; -import static org.junit.Assert.*; - import java.util.List; import org.eclipse.jetty.server.Server; @@ -46,7 +44,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base public void afterUnregisterRestHookListener() { myDaoConfig.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); - ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); + myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); ourLog.info("Done deleting all subscriptions"); myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); @@ -76,7 +74,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base channel.setEndpoint(endpoint); subscription.setChannel(channel); - MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); + MethodOutcome methodOutcome = myClient.create().resource(subscription).execute(); subscription.setId(methodOutcome.getId().getIdPart()); waitForQueueToDrain(); @@ -101,7 +99,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome = ourClient.create().resource(observation).execute(); + MethodOutcome methodOutcome = myClient.create().resource(observation).execute(); String observationId = methodOutcome.getId().getIdPart(); observation.setId(observationId); @@ -129,11 +127,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(1, ourUpdatedObservations); - Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); + Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId()); Assert.assertNotNull(subscriptionTemp); subscriptionTemp.setCriteria(criteria1); - ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); + myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); Observation observation2 = sendObservation(code, "SNOMED-CT"); @@ -143,7 +141,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(3, ourUpdatedObservations); - ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute(); + myClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute(); Observation observationTemp3 = sendObservation(code, "SNOMED-CT"); @@ -152,27 +150,27 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId()); + Observation observation3 = myClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept = new CodeableConcept(); observation3.setCode(codeableConcept); Coding coding = codeableConcept.addCoding(); coding.setCode(code + "111"); coding.setSystem("SNOMED-CT"); - ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); + myClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); // Should see no subscription notification Thread.sleep(500); waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId()); + Observation observation3a = myClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept1 = new CodeableConcept(); observation3a.setCode(codeableConcept1); Coding coding1 = codeableConcept1.addCoding(); coding1.setCode(code); coding1.setSystem("SNOMED-CT"); - ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); + myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); // Should see only one subscription notification Thread.sleep(500); @@ -202,11 +200,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(1, ourUpdatedObservations); - Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId()); + Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId()); Assert.assertNotNull(subscriptionTemp); subscriptionTemp.setCriteria(criteria1); - ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); + myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute(); Observation observation2 = sendObservation(code, "SNOMED-CT"); @@ -216,7 +214,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(3, ourUpdatedObservations); - ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute(); + myClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute(); Observation observationTemp3 = sendObservation(code, "SNOMED-CT"); @@ -225,27 +223,27 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId()); + Observation observation3 = myClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept = new CodeableConcept(); observation3.setCode(codeableConcept); Coding coding = codeableConcept.addCoding(); coding.setCode(code + "111"); coding.setSystem("SNOMED-CT"); - ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); + myClient.update().resource(observation3).withId(observation3.getIdElement()).execute(); // Should see no subscription notification waitForQueueToDrain(); waitForSize(0, ourCreatedObservations); waitForSize(4, ourUpdatedObservations); - Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId()); + Observation observation3a = myClient.read(Observation.class, observationTemp3.getId()); CodeableConcept codeableConcept1 = new CodeableConcept(); observation3a.setCode(codeableConcept1); Coding coding1 = codeableConcept1.addCoding(); coding1.setCode(code); coding1.setSystem("SNOMED-CT"); - ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); + myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute(); // Should see only one subscription notification waitForQueueToDrain(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java index 2a0eae5a583..d32b823f680 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java @@ -52,14 +52,14 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes @After public void afterUnregisterRestHookListener() { for (IIdType next : mySubscriptionIds) { - ourClient.delete().resourceById(next).execute(); + myClient.delete().resourceById(next).execute(); } mySubscriptionIds.clear(); myDaoConfig.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); - ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); - ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); + myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); + myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); @@ -83,7 +83,7 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes */ Patient patient = FhirR4Util.getPatient(); - MethodOutcome methodOutcome = ourClient.create().resource(patient).execute(); + MethodOutcome methodOutcome = myClient.create().resource(patient).execute(); myPatientId = methodOutcome.getId().getIdPart(); /* @@ -114,7 +114,7 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes channel.setPayload("application/json"); subscription.setChannel(channel); - methodOutcome = ourClient.create().resource(subscription).execute(); + methodOutcome = myClient.create().resource(subscription).execute(); mySubscriptionId = methodOutcome.getId().getIdPart(); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java index dfe9b283c9f..316c9caeba3 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java @@ -49,7 +49,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test { */ Patient patient = FhirR4Util.getPatient(); - MethodOutcome methodOutcome = ourClient.create().resource(patient).execute(); + MethodOutcome methodOutcome = myClient.create().resource(patient).execute(); myPatientId = methodOutcome.getId().getIdPart(); /* @@ -66,7 +66,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test { channel.setPayload("application/json"); subscription.setChannel(channel); - methodOutcome = ourClient.create().resource(subscription).execute(); + methodOutcome = myClient.create().resource(subscription).execute(); mySubscriptionId = methodOutcome.getId().getIdPart(); /* @@ -105,7 +105,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test { observation.setSubject(reference); observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute(); + MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute(); String observationId = methodOutcome2.getId().getIdPart(); observation.setId(observationId); @@ -129,7 +129,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test { observation.setSubject(reference); observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute(); + MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute(); String observationId = methodOutcome2.getId().getIdPart(); observation.setId(observationId); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java index 4aca0fcc419..90a973e69e6 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java @@ -72,7 +72,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes */ Patient patient = FhirR4Util.getPatient(); - MethodOutcome methodOutcome = ourClient.create().resource(patient).execute(); + MethodOutcome methodOutcome = myClient.create().resource(patient).execute(); myPatientId = methodOutcome.getId().getIdPart(); /* @@ -89,7 +89,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes channel.setPayload("application/json"); subscription.setChannel(channel); - methodOutcome = ourClient.create().resource(subscription).execute(); + methodOutcome = myClient.create().resource(subscription).execute(); mySubscriptionId = methodOutcome.getId().getIdPart(); /* @@ -122,7 +122,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes observation.setSubject(reference); observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute(); + MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute(); String observationId = methodOutcome2.getId().getIdPart(); observation.setId(observationId); @@ -146,7 +146,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes observation.setSubject(reference); observation.setStatus(Observation.ObservationStatus.FINAL); - MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute(); + MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute(); String observationId = methodOutcome2.getId().getIdPart(); observation.setId(observationId); diff --git a/hapi-fhir-jpaserver-base/src/test/resources/dstu3-person.json b/hapi-fhir-jpaserver-base/src/test/resources/dstu3-person.json new file mode 100644 index 00000000000..ad7edea379b --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/resources/dstu3-person.json @@ -0,0 +1,52 @@ + { + "resourceType": "Person", + "id": "PERSON1", + "meta": { + "versionId": "1", + "lastUpdated": "2017-08-17T16:19:40.109+03:00" + }, + "identifier": [ + { + "value": "081181-9984" + } + ], + "name": [ + { + "text": "Anna Testi", + "family": "Testi", + "given": [ + "Anna" + ] + }, + { + "family": "asdfas" + } + ], + "telecom": [ + { + "use": "home" + }, + { + "system": "phone", + "value": "(044) 1234567", + "use": "work" + } + ], + "gender": "female", + "birthDate": "1981-11-08", + "address": [ + { + "line": [ + "Osuuspankkitie 2" + ], + "city": "Helsinki", + "postalCode": "00120", + "country": "Suomi" + }, + { + "city": "Blo-49847020" + } + ], + "active": true + } + diff --git a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml index 39d8f8970a3..4bba1d9adc6 100644 --- a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml +++ b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml @@ -76,7 +76,7 @@ A comma separated list of allowed headers when making a non simple CORS request. cors.allowed.headers - X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers + X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Prefer A comma separated list non-standard response headers that will be exposed to XHR2 object. diff --git a/hapi-fhir-jpaserver-uhnfhirtest/derby_maintenance.txt b/hapi-fhir-jpaserver-uhnfhirtest/derby_maintenance.txt index 21e69afe88a..1e8c7df6044 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/derby_maintenance.txt +++ b/hapi-fhir-jpaserver-uhnfhirtest/derby_maintenance.txt @@ -74,4 +74,24 @@ drop table trm_concept cascade constraints; drop table trm_concept_pc_link cascade constraints; drop table trm_concept_property cascade constraints; +# Delete all resources +update hfj_res_ver set forced_id_pid = null where res_id in (select res_id from hfj_resource); +update hfj_resource set forced_id_pid = null where res_id in (select res_id from hfj_resource); +delete from hfj_history_tag where res_id in (select res_id from hfj_resource); +delete from hfj_res_ver where res_id in (select res_id from hfj_resource); +delete from hfj_forced_id where resource_pid in (select res_id from hfj_resource); +delete from hfj_res_link where src_resource_id in (select res_id from hfj_resource); +delete from hfj_res_link where target_resource_id in (select res_id from hfj_resource); +delete from hfj_spidx_coords where res_id in (select res_id from hfj_resource); +delete from hfj_spidx_date where res_id in (select res_id from hfj_resource); +delete from hfj_spidx_number where res_id in (select res_id from hfj_resource); +delete from hfj_spidx_quantity where res_id in (select res_id from hfj_resource); +delete from hfj_spidx_string where res_id in (select res_id from hfj_resource); +delete from hfj_spidx_token where res_id in (select res_id from hfj_resource); +delete from hfj_spidx_uri where res_id in (select res_id from hfj_resource); +delete from hfj_res_tag where res_id in (select res_id from hfj_resource); +delete from hfj_search_result where resource_pid in (select res_id from hfj_resource); +delete from hfj_res_param_present where res_id in (select res_id from hfj_resource); +delete from hfj_resource where res_id in (select res_id from hfj_resource); + diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java index ab5189cdbe7..a77e7c7b5de 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java @@ -173,18 +173,7 @@ public class TestRestfulServer extends RestfulServer { /* * Enable CORS */ - CorsConfiguration config = new CorsConfiguration(); - CorsInterceptor corsInterceptor = new CorsInterceptor(config); - config.addAllowedHeader("Origin"); - config.addAllowedHeader("Accept"); - config.addAllowedHeader("X-Requested-With"); - config.addAllowedHeader("Content-Type"); - config.addAllowedHeader("Access-Control-Request-Method"); - config.addAllowedHeader("Access-Control-Request-Headers"); - config.addAllowedOrigin("*"); - config.addExposedHeader("Location"); - config.addExposedHeader("Content-Location"); - config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH")); + CorsInterceptor corsInterceptor = new CorsInterceptor(); registerInterceptor(corsInterceptor); /* diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java index 47380b48473..bf568c7d1c9 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java @@ -67,6 +67,7 @@ public class TdlDstu2Config extends BaseJavaConfigDstu2 { retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/testDataLibraryDstu2"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/testDataLibraryDstu2"); retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); return retVal; } diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java index 052d974092d..45be4c9e38b 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java @@ -57,6 +57,7 @@ public class TdlDstu3Config extends BaseJavaConfigDstu3 { retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/testDataLibraryStu3"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/testDataLibraryStu3"); retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); return retVal; } diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java index 609b537f500..d76e45b40f2 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java @@ -34,6 +34,7 @@ public class TestR4Config extends BaseJavaConfigR4 { public static final String FHIR_DB_USERNAME = "${fhir.db.username}"; public static final String FHIR_DB_PASSWORD = "${fhir.db.password}"; public static final String FHIR_LUCENE_LOCATION_R4 = "${fhir.lucene.location.r4}"; + public static final Integer COUNT_SEARCH_RESULTS_UP_TO = 50000; @Value(TestR4Config.FHIR_DB_USERNAME) private String myDbUsername; @@ -56,6 +57,7 @@ public class TestR4Config extends BaseJavaConfigR4 { retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseR4"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseR4"); retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); return retVal; } diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java index 8a3910f4f5e..ca5d8cba655 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java @@ -34,6 +34,9 @@ public class IncomingRequestAddressStrategy implements IServerAddressStrategy { @Override public String determineServerBase(ServletContext theServletContext, HttpServletRequest theRequest) { + if (theRequest == null) { + return null; + } String requestFullPath = StringUtils.defaultString(theRequest.getRequestURI()); String servletPath; diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java index a8e7e94a0ed..0dfb36051e9 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java @@ -29,6 +29,7 @@ import java.util.regex.Pattern; import javax.servlet.http.HttpServletRequest; +import ca.uhn.fhir.util.BinaryUtil; import org.hl7.fhir.instance.model.api.*; import ca.uhn.fhir.context.FhirContext; @@ -85,10 +86,41 @@ public class RestfulServerUtils { } } if (elements != null && elements.size() > 0) { - Set newElements = new HashSet(); + Set newElements = new HashSet<>(); for (String next : elements) { newElements.add("*." + next); } + + /* + * We try to be smart about what the user is asking for + * when they include an _elements parameter. If we're responding + * to something that returns a Bundle (e.g. a search) we assume + * the elements don't apply to the Bundle itself, unless + * the client has explicitly scoped the Bundle + * (i.e. with Bundle.total or something like that) + */ + switch (theRequestDetails.getRestOperationType()) { + case SEARCH_SYSTEM: + case SEARCH_TYPE: + case HISTORY_SYSTEM: + case HISTORY_TYPE: + case HISTORY_INSTANCE: + case GET_PAGE: + boolean haveExplicitBundleElement = false; + for (String next : newElements) { + if (next.startsWith("Bundle.")) { + haveExplicitBundleElement = true; + break; + } + } + if (!haveExplicitBundleElement) { + parser.setEncodeElementsAppliesToChildResourcesOnly(true); + } + break; + default: + break; + } + parser.setEncodeElements(newElements); parser.setEncodeElementsAppliesToResourceTypes(elementsAppliesTo); } @@ -146,6 +178,19 @@ public class RestfulServerUtils { b.append(theBundleType.getCode()); } + String paramName = Constants.PARAM_ELEMENTS; + String[] params = theRequestParameters.get(paramName); + if (params != null) { + for (String nextValue : params) { + if (isNotBlank(nextValue)) { + b.append('&'); + b.append(paramName); + b.append('='); + b.append(UrlUtil.escape(nextValue)); + } + } + } + return b.toString(); } catch (UnsupportedEncodingException e) { throw new Error("UTF-8 not supported", e);// should not happen @@ -580,10 +625,19 @@ public class RestfulServerUtils { } else { contentType = Constants.CT_OCTET_STREAM; } + // Force binary resources to download - This is a security measure to prevent // malicious images or HTML blocks being served up as content. response.addHeader(Constants.HEADER_CONTENT_DISPOSITION, "Attachment;"); + IBaseReference securityContext = BinaryUtil.getSecurityContext(theServer.getFhirContext(), bin); + if (securityContext != null) { + String securityContextRef = securityContext.getReferenceElement().getValue(); + if (isNotBlank(securityContextRef)) { + response.addHeader(Constants.HEADER_X_SECURITY_CONTEXT, securityContextRef); + } + } + return response.sendAttachmentResponse(bin, theStausCode, contentType); } diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptor.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptor.java index 795c066e328..38f7307b3bb 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptor.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptor.java @@ -21,10 +21,13 @@ package ca.uhn.fhir.rest.server.interceptor; */ import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import ca.uhn.fhir.rest.api.Constants; import org.apache.commons.lang3.Validate; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsProcessor; @@ -43,14 +46,16 @@ public class CorsInterceptor extends InterceptorAdapter { * a FHIR server. This includes: *
    *
  • Allowed Origin: *
  • - *
  • Allowed Header: Origin
  • *
  • Allowed Header: Accept
  • - *
  • Allowed Header: X-Requested-With
  • - *
  • Allowed Header: Content-Type
  • - *
  • Allowed Header: Access-Control-Request-Method
  • *
  • Allowed Header: Access-Control-Request-Headers
  • - *
  • Exposed Header: Location
  • + *
  • Allowed Header: Access-Control-Request-Method
  • + *
  • Allowed Header: Cache-Control
  • *
  • Exposed Header: Content-Location
  • + *
  • Allowed Header: Content-Type
  • + *
  • Exposed Header: Location
  • + *
  • Allowed Header: Origin
  • + *
  • Allowed Header: Prefer
  • + *
  • Allowed Header: X-Requested-With
  • *
* Note that this configuration is useful for quickly getting CORS working, but * in a real production system you probably want to consider whether it is @@ -61,29 +66,9 @@ public class CorsInterceptor extends InterceptorAdapter { this(createDefaultCorsConfig()); } - private static CorsConfiguration createDefaultCorsConfig() { - CorsConfiguration retVal = new CorsConfiguration(); - - // ********************************************************* - // Update constructor documentation if you change these: - // ********************************************************* - - retVal.addAllowedHeader("Origin"); - retVal.addAllowedHeader("Accept"); - retVal.addAllowedHeader("X-Requested-With"); - retVal.addAllowedHeader("Content-Type"); - retVal.addAllowedHeader("Access-Control-Request-Method"); - retVal.addAllowedHeader("Access-Control-Request-Headers"); - retVal.addAllowedOrigin("*"); - retVal.addExposedHeader("Location"); - retVal.addExposedHeader("Content-Location"); - - return retVal; - } - /** * Constructor which accepts the given configuration - * + * * @param theConfiguration * The CORS configuration */ @@ -93,13 +78,6 @@ public class CorsInterceptor extends InterceptorAdapter { setConfig(theConfiguration); } - /** - * Sets the CORS configuration - */ - public void setConfig(CorsConfiguration theConfiguration) { - myConfig = theConfiguration; - } - /** * Gets the CORS configuration */ @@ -107,6 +85,13 @@ public class CorsInterceptor extends InterceptorAdapter { return myConfig; } + /** + * Sets the CORS configuration + */ + public void setConfig(CorsConfiguration theConfiguration) { + myConfig = theConfiguration; + } + @Override public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse) { if (CorsUtils.isCorsRequest(theRequest)) { @@ -124,4 +109,19 @@ public class CorsInterceptor extends InterceptorAdapter { return super.incomingRequestPreProcessed(theRequest, theResponse); } + private static CorsConfiguration createDefaultCorsConfig() { + CorsConfiguration retVal = new CorsConfiguration(); + + retVal.setAllowedHeaders(new ArrayList<>(Constants.CORS_ALLOWED_HEADERS)); + retVal.setAllowedMethods(new ArrayList<>(Constants.CORS_ALLWED_METHODS)); + + retVal.addExposedHeader("Content-Location"); + retVal.addExposedHeader("Location"); + + retVal.addAllowedOrigin("*"); + + + return retVal; + } + } diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java index 9fe6ce1ed6f..60820b85046 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java @@ -149,24 +149,6 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi return theRequest.getResponse().streamResponseAsResource(response, prettyPrint, summaryMode, Constants.STATUS_HTTP_200_OK, null, theRequest.isRespondGzip(), isAddContentLocationHeader()); - // DSTU1 Bundle - // // Is this request coming from a browser - // String uaHeader = theRequest.getHeader("user-agent"); - // boolean requestIsBrowser = false; - // if (uaHeader != null && uaHeader.contains("Mozilla")) { - // requestIsBrowser = true; - // } - // - // for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) { - // IServerInterceptor next = theServer.getInterceptors().get(i); - // boolean continueProcessing = next.outgoingResponse(theRequest, responseObject.getDstu1Bundle()); - // if (!continueProcessing) { - // ourLog.debug("Interceptor {} returned false, not continuing processing"); - // return null; - // } - // } - // - // return theRequest.getResponse().streamResponseAsBundle(responseObject.getDstu1Bundle(), summaryMode, theRequest.isRespondGzip(), requestIsBrowser); } public IBaseResource doInvokeServer(IRestfulServer theServer, RequestDetails theRequest) { @@ -349,8 +331,8 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi } } - bundleFactory.addRootPropertiesToBundle(null, serverBase, theLinkSelf, linkPrev, linkNext, theResult.size(), theBundleType, theResult.getPublished()); - bundleFactory.addResourcesToBundle(new ArrayList(resourceList), theBundleType, serverBase, theServer.getBundleInclusionRule(), theIncludes); + bundleFactory.addRootPropertiesToBundle(theResult.getUuid(), serverBase, theLinkSelf, linkPrev, linkNext, theResult.size(), theBundleType, theResult.getPublished()); + bundleFactory.addResourcesToBundle(new ArrayList<>(resourceList), theBundleType, serverBase, theServer.getBundleInclusionRule(), theIncludes); if (theServer.getPagingProvider() != null) { int limit; diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ReadMethodBinding.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ReadMethodBinding.java index 050e2a6d468..710c1b07c9a 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ReadMethodBinding.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ReadMethodBinding.java @@ -161,7 +161,7 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding { ifNoneMatch = ParameterUtil.parseETagValue(ifNoneMatch); if (responseResource.getIdElement() != null && responseResource.getIdElement().hasVersionIdPart()) { if (responseResource.getIdElement().getVersionIdPart().equals(ifNoneMatch)) { - ourLog.debug("Returning HTTP 301 because request specified {}={}", Constants.HEADER_IF_NONE_MATCH, ifNoneMatch); + ourLog.debug("Returning HTTP 304 because request specified {}={}", Constants.HEADER_IF_NONE_MATCH, ifNoneMatch); throw new NotModifiedException("Not Modified"); } } @@ -182,8 +182,8 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding { lastModified = responseResource.getMeta().getLastUpdated(); } - if (lastModified != null && lastModified.getTime() > ifModifiedSinceDate.getTime()) { - ourLog.debug("Returning HTTP 301 because If-Modified-Since does not match"); + if (lastModified != null && lastModified.getTime() <= ifModifiedSinceDate.getTime()) { + ourLog.debug("Returning HTTP 304 because If-Modified-Since does not match"); throw new NotModifiedException("Not Modified"); } } diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ResourceParameter.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ResourceParameter.java index 03567863f67..de5abc7839c 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ResourceParameter.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ResourceParameter.java @@ -19,7 +19,24 @@ package ca.uhn.fhir.rest.server.method; * limitations under the License. * #L% */ -import static org.apache.commons.lang3.StringUtils.isBlank; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.parser.DataFormatException; +import ca.uhn.fhir.parser.IParser; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.EncodingEnum; +import ca.uhn.fhir.rest.api.RestOperationTypeEnum; +import ca.uhn.fhir.rest.api.server.RequestDetails; +import ca.uhn.fhir.rest.server.IResourceProvider; +import ca.uhn.fhir.rest.server.RestfulServerUtils; +import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import ca.uhn.fhir.util.BinaryUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.Validate; +import org.hl7.fhir.instance.model.api.IBaseBinary; +import org.hl7.fhir.instance.model.api.IBaseResource; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -30,27 +47,8 @@ import java.lang.reflect.Modifier; import java.nio.charset.Charset; import java.util.Collection; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.Validate; -import org.hl7.fhir.instance.model.api.IBaseBinary; -import org.hl7.fhir.instance.model.api.IBaseResource; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.FhirVersionEnum; -import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; -import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.parser.DataFormatException; -import ca.uhn.fhir.parser.IParser; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.EncodingEnum; -import ca.uhn.fhir.rest.api.RestOperationTypeEnum; -import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.param.ParameterUtil; -import ca.uhn.fhir.rest.server.IResourceProvider; -import ca.uhn.fhir.rest.server.RestfulServerUtils; -import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; -import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; public class ResourceParameter implements IParameter { @@ -193,11 +191,22 @@ public class ResourceParameter implements IParameter { String ct = theRequest.getHeader(Constants.HEADER_CONTENT_TYPE); if (EncodingEnum.forContentTypeStrict(ct) == null) { FhirContext ctx = theRequest.getServer().getFhirContext(); - IBaseBinary binary = (IBaseBinary) ctx.getResourceDefinition("Binary").newInstance(); + IBaseBinary binary = BinaryUtil.newBinary(ctx); binary.setId(theRequest.getId()); binary.setContentType(ct); binary.setContent(theRequest.loadRequestContents()); retVal = binary; + + /* + * Security context header, which is only in + * DSTU3+ + */ + if (ctx.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) { + String securityContext = theRequest.getHeader(Constants.HEADER_X_SECURITY_CONTEXT); + if (isNotBlank(securityContext)) { + BinaryUtil.setSecurityContext(ctx, binary, securityContext); + } + } } } diff --git a/hapi-fhir-server/src/test/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategyTest.java b/hapi-fhir-server/src/test/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategyTest.java new file mode 100644 index 00000000000..4cc9d3682ec --- /dev/null +++ b/hapi-fhir-server/src/test/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategyTest.java @@ -0,0 +1,16 @@ +package ca.uhn.fhir.rest.server; + +import org.junit.Test; + +import static org.junit.Assert.*; + +public class IncomingRequestAddressStrategyTest { + + @Test + public void testRequestWithNull() { + IncomingRequestAddressStrategy s = new IncomingRequestAddressStrategy(); + String result = s.determineServerBase(null, null); + assertNull(result); + } + +} diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index e826d9f5a95..47968c3f638 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -29,6 +29,11 @@ + + org.codehaus.woodstox + woodstox-core-asl + test + ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu2.1 diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/rest/server/Dstu2_1BundleFactory.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/rest/server/Dstu2_1BundleFactory.java index dfc86d1d2e4..273b0c2cf8b 100644 --- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/rest/server/Dstu2_1BundleFactory.java +++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/rest/server/Dstu2_1BundleFactory.java @@ -226,12 +226,15 @@ public class Dstu2_1BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, - IPrimitiveType theLastUpdated) { + public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, + IPrimitiveType theLastUpdated) { ensureBundle(); myBase = theServerBase; + if (myBundle.getIdElement().isEmpty()) { + myBundle.setId(theId); + } if (myBundle.getIdElement().isEmpty()) { myBundle.setId(UUID.randomUUID().toString()); } diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/BackboneElement.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/BackboneElement.java index 0b116dab9c2..45c47692d64 100644 --- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/BackboneElement.java +++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/BackboneElement.java @@ -159,6 +159,7 @@ public abstract class BackboneElement extends Element implements IBaseBackboneEl public abstract BackboneElement copy(); public void copyValues(BackboneElement dst) { + super.copyValues(dst); if (modifierExtension != null) { dst.modifierExtension = new ArrayList(); for (Extension i : modifierExtension) diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/DomainResource.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/DomainResource.java index f2794e50265..2c243fef9d4 100644 --- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/DomainResource.java +++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/DomainResource.java @@ -340,6 +340,7 @@ public abstract class DomainResource extends Resource implements IBaseHasExtensi public abstract DomainResource copy(); public void copyValues(DomainResource dst) { + super.copyValues(dst); dst.text = text == null ? null : text.copy(); if (contained != null) { dst.contained = new ArrayList(); diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/JsonTrackingParser.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/JsonTrackingParser.java index 5758b77472b..42a4449f3bf 100644 --- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/JsonTrackingParser.java +++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/JsonTrackingParser.java @@ -364,6 +364,7 @@ public class JsonTrackingParser { break; case Eof : throw lexer.error("Unexpected End of File"); + case End: default: break; } @@ -407,6 +408,8 @@ public class JsonTrackingParser { break; case Eof : throw lexer.error("Unexpected End of File"); + case Boolean: + case End: default: break; } diff --git a/hapi-fhir-structures-dstu2.1/src/main/resources/.keep b/hapi-fhir-structures-dstu2.1/src/main/resources/.keep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/BackboneElementDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/BackboneElementDstu2_1Test.java new file mode 100644 index 00000000000..f5c092029a4 --- /dev/null +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/BackboneElementDstu2_1Test.java @@ -0,0 +1,26 @@ +package ca.uhn.fhir.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.hl7.fhir.dstu2016may.model.BackboneElement; +import org.hl7.fhir.dstu2016may.model.Patient.PatientCommunicationComponent; +import org.junit.Test; + +public class BackboneElementDstu2_1Test { + /** + * Ensuring that IDs of subtypes of BackboneElement get copied when + * the {@link org.hl7.fhir.dstu2016may.model.BackboneElement#copy()} method is called + */ + @Test + public void testPatientCommunicationComponentIdCopy() { + PatientCommunicationComponent pcc1 = new PatientCommunicationComponent(); + pcc1.setId("1001"); + + PatientCommunicationComponent copiedPcc = pcc1.copy(); + String copiedPccID = copiedPcc.getIdElement().getIdPart(); + + assertTrue(copiedPcc instanceof BackboneElement); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedPccID); + } +} diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/DomainResourceDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/DomainResourceDstu2_1Test.java new file mode 100644 index 00000000000..f05415e1934 --- /dev/null +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/DomainResourceDstu2_1Test.java @@ -0,0 +1,30 @@ +package ca.uhn.fhir.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.hl7.fhir.dstu2016may.model.DomainResource; +import org.hl7.fhir.dstu2016may.model.Narrative; +import org.hl7.fhir.dstu2016may.model.Patient; +import org.junit.Test; + +public class DomainResourceDstu2_1Test { + /** + * Ensuring that Ensuring that fields defined in {@link org.hl7.fhir.dstu2016may.model.DomainResource} and {@link org.hl7.fhir.dstu2016may.model.Resource} + * get copied when the {@link org.hl7.fhir.dstu2016may.model.DomainResource#copy()} method is called + */ + @Test + public void testPatientCopy() { + Patient p1 = new Patient(); + p1.setId("1001"); + p1.setText(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL)); + + Patient copiedPatient = p1.copy(); + String copiedPatientID = copiedPatient.getIdElement().getIdPart(); + Narrative.NarrativeStatus copiedPatientTextStatus = copiedPatient.getText().getStatus(); + + assertTrue(copiedPatient instanceof DomainResource); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedPatientID); + assertEquals(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL).getStatus(), copiedPatientTextStatus); + } +} diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java index c4702d6d789..131d79141be 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java @@ -1499,7 +1499,7 @@ public class JsonParserDstu2_1Test { String val = ourCtx.newJsonParser().encodeResourceToString(patient); - String expected = "{\"resourceType\":\"Binary\",\"id\":\"11\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}"; + String expected = "{\"resourceType\":\"Binary\",\"id\":\"11\",\"meta\":{\"versionId\":\"22\"},\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}"; ourLog.info("Expected: {}", expected); ourLog.info("Actual : {}", val); assertEquals(expected, val); diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java new file mode 100644 index 00000000000..98bbae280fb --- /dev/null +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java @@ -0,0 +1,152 @@ +package ca.uhn.fhir.rest.client; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.InputStream; +import java.io.StringReader; +import java.nio.charset.Charset; + +import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.dstu2016may.model.Conformance; +import org.hl7.fhir.dstu2016may.model.Patient; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Matchers; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.primitive.UriDt; +import ca.uhn.fhir.rest.client.exceptions.FhirClientInappropriateForServerException; +import ca.uhn.fhir.util.TestUtil; + +public class ClientServerValidationDstu2_1Test { + + private FhirContext myCtx; + private HttpClient myHttpClient; + private HttpResponse myHttpResponse; + private boolean myFirstResponse; + + @Before + public void before() { + myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs()); + myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); + myFirstResponse = true; + + myCtx = FhirContext.forDstu2_1(); + myCtx.getRestfulClientFactory().setHttpClient(myHttpClient); + } + + @Test + public void testServerReturnsAppropriateVersionDstu2_1() throws Exception { + String appropriateFhirVersion = "1.4.0"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2_1.getFhirVersionString())); + Conformance conf = new Conformance(); + conf.setFhirVersion(appropriateFhirVersion); + final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + if (myFirstResponse) { + myFirstResponse=false; + return new ReaderInputStream(new StringReader(confResource), Charset.forName("UTF-8")); + } else { + return new ReaderInputStream(new StringReader(myCtx.newXmlParser().encodeResourceToString(new Patient())), Charset.forName("UTF-8")); + } + }}); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); + IGenericClient client = myCtx.newRestfulGenericClient("http://foo"); + + // don't load the conformance until the first time the client is actually used + assertTrue(myFirstResponse); + client.read(new UriDt("http://foo/Patient/123")); + assertFalse(myFirstResponse); + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + + // Conformance only loaded once, then 3 reads + verify(myHttpClient, times(4)).execute(Matchers.any(HttpUriRequest.class)); + } + + @Test + public void testServerReturnsWrongVersionDstu2_1() throws Exception { + String wrongFhirVersion = "1.0.2"; + assertThat(wrongFhirVersion, is(FhirVersionEnum.DSTU2.getFhirVersionString())); + Conformance conf = new Conformance(); + conf.setFhirVersion(wrongFhirVersion); + String msg = myCtx.newXmlParser().encodeResourceToString(conf); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); + try { + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/1")); + fail(); + } catch (FhirClientInappropriateForServerException e) { + assertThat(e.toString(), containsString("The server at base URL \"http://foo/metadata\" returned a conformance statement indicating that it supports FHIR version \"1.0.2\" which corresponds to DSTU2, but this client is configured to use DSTU2_1 (via the FhirContext)")); + } + } + + @Test + public void testServerReturnsRightVersionDstu2_1() throws Exception { + String appropriateFhirVersion = "1.4.0"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2_1.getFhirVersionString())); + Conformance conf = new Conformance(); + conf.setFhirVersion(appropriateFhirVersion); + String msg = myCtx.newXmlParser().encodeResourceToString(conf); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); + myCtx.newRestfulGenericClient("http://foo").forceConformanceCheck(); + } + + @AfterClass + public static void afterClassClearContext() { + TestUtil.clearAllStaticFieldsForUnitTest(); + } + +} + diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index eb4e7e82391..1028391e59d 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -23,6 +23,11 @@ + + org.codehaus.woodstox + woodstox-core-asl + test + ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu2 @@ -318,8 +323,8 @@ - test testscript user valueset diff --git a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java index 676a1184782..cfa5a19ba74 100644 --- a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java +++ b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java @@ -219,12 +219,15 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, - IPrimitiveType theLastUpdated) { + public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, + IPrimitiveType theLastUpdated) { ensureBundle(); myBase = theServerBase; + if (myBundle.getIdElement().isEmpty()) { + myBundle.setId(theId); + } if (myBundle.getId().isEmpty()) { myBundle.setId(UUID.randomUUID().toString()); } diff --git a/hapi-fhir-structures-dstu2/src/main/resources/.keep b/hapi-fhir-structures-dstu2/src/main/resources/.keep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java index 28491dbdb7b..6400f939e23 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.rest.client; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; @@ -16,6 +17,7 @@ import java.io.InputStream; import java.io.StringReader; import java.nio.charset.Charset; +import ca.uhn.fhir.context.FhirVersionEnum; import org.apache.commons.io.input.ReaderInputStream; import org.apache.http.*; import org.apache.http.client.HttpClient; @@ -67,8 +69,10 @@ public class ClientServerValidationDstu2Test { @Test public void testClientUsesInterceptors() throws Exception { + String appropriateFhirVersion = "1.0.2"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2.getFhirVersionString())); Conformance conf = new Conformance(); - conf.setFhirVersion("1.0.2"); + conf.setFhirVersion(appropriateFhirVersion); final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); @@ -109,8 +113,10 @@ public class ClientServerValidationDstu2Test { @Test public void testForceConformanceCheck() throws Exception { + String appropriateFhirVersion = "1.0.2"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2.getFhirVersionString())); Conformance conf = new Conformance(); - conf.setFhirVersion("1.0.2"); + conf.setFhirVersion(appropriateFhirVersion); final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); @@ -178,46 +184,9 @@ public class ClientServerValidationDstu2Test { } } + // This test can should stay to test the leniency of accepting unknown FHIR versions from the server @Test - public void testServerReturnsAppropriateVersionForDstu2_040() throws Exception { - Conformance conf = new Conformance(); - conf.setFhirVersion("0.5.0"); - final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); - - ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); - - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { - @Override - public InputStream answer(InvocationOnMock theInvocation) throws Throwable { - if (myFirstResponse) { - myFirstResponse = false; - return new ReaderInputStream(new StringReader(confResource), Charset.forName("UTF-8")); - } else { - return new ReaderInputStream(new StringReader(myCtx.newXmlParser().encodeResourceToString(new Patient())), Charset.forName("UTF-8")); - } - } - }); - - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - - myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); - IGenericClient client = myCtx.newRestfulGenericClient("http://foo"); - - // don't load the conformance until the first time the client is actually used - assertTrue(myFirstResponse); - client.read(new UriDt("http://foo/Patient/123")); - assertFalse(myFirstResponse); - myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); - myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); - - // Conformance only loaded once, then 3 reads - verify(myHttpClient, times(4)).execute(Matchers.any(HttpUriRequest.class)); - } - - @Test - public void testServerReturnsAppropriateVersionForDstu2_050() throws Exception { + public void testServerReturnsAppropriateVersionForUnknownVersion() throws Exception { Conformance conf = new Conformance(); conf.setFhirVersion("0.5.0"); final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); @@ -256,8 +225,10 @@ public class ClientServerValidationDstu2Test { @Test public void testServerReturnsAppropriateVersionForDstu2() throws Exception { + String appropriateFhirVersion = "1.0.2"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2.getFhirVersionString())); Conformance conf = new Conformance(); - conf.setFhirVersion("1.0.2"); + conf.setFhirVersion(appropriateFhirVersion); final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); @@ -294,8 +265,10 @@ public class ClientServerValidationDstu2Test { @Test public void testServerReturnsWrongVersionForDstu2() throws Exception { + String wrongFhirVersion = "3.0.1"; + assertThat(wrongFhirVersion, is(FhirVersionEnum.DSTU3.getFhirVersionString())); // asserting that what we assume to be the DSTU3 FHIR version is still correct Conformance conf = new Conformance(); - conf.setFhirVersion("3.0.1"); + conf.setFhirVersion(wrongFhirVersion); String msg = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java index 58282a11db8..86fd1e9b0a1 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java @@ -57,20 +57,38 @@ public class ReadDstu2Test { CloseableHttpResponse status; HttpGet httpGet; + // Fixture was last modified at 2012-01-01T12:12:12Z + // thus it has changed before the later time of 2012-01-01T13:00:00Z + // so we expect a 304 httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2"); httpGet.addHeader(Constants.HEADER_IF_MODIFIED_SINCE, DateUtils.formatDate(new InstantDt("2012-01-01T13:00:00Z").getValue())); status = ourClient.execute(httpGet); try { - assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(304, status.getStatusLine().getStatusCode()); } finally { IOUtils.closeQuietly(status); } + // Fixture was last modified at 2012-01-01T12:12:12Z + // thus it has changed at the same time of 2012-01-01T12:12:12Z + // so we expect a 304 + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2"); + httpGet.addHeader(Constants.HEADER_IF_MODIFIED_SINCE, DateUtils.formatDate(new InstantDt("2012-01-01T12:12:12Z").getValue())); + status = ourClient.execute(httpGet); + try { + assertEquals(304, status.getStatusLine().getStatusCode()); + } finally { + IOUtils.closeQuietly(status); + } + + // Fixture was last modified at 2012-01-01T12:12:12Z + // thus it has changed after the earlier time of 2012-01-01T10:00:00Z + // so we expect a 200 httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2"); httpGet.addHeader(Constants.HEADER_IF_MODIFIED_SINCE, DateUtils.formatDate(new InstantDt("2012-01-01T10:00:00Z").getValue())); status = ourClient.execute(httpGet); try { - assertEquals(304, status.getStatusLine().getStatusCode()); + assertEquals(200, status.getStatusLine().getStatusCode()); } finally { IOUtils.closeQuietly(status); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java index 9d3e17b4f8c..a72517521ef 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java @@ -192,7 +192,7 @@ public class LoggingInterceptorDstu2Test { ArgumentCaptor captor = ArgumentCaptor.forClass(String.class); verify(logger, timeout(1000).times(1)).info(captor.capture()); - assertThat(captor.getValue(), matchesPattern("[1-9][0-9]{2}")); + assertThat(captor.getValue(), matchesPattern("[1-9][0-9]{1,3}")); } @Test diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java index d5d198902c6..3b2818641d3 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java @@ -61,92 +61,230 @@ import ca.uhn.fhir.util.*; public class ResponseHighlightingInterceptorTest { + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResponseHighlightingInterceptorTest.class); private static ResponseHighlighterInterceptor ourInterceptor = new ResponseHighlighterInterceptor(); private static CloseableHttpClient ourClient; private static FhirContext ourCtx = FhirContext.forDstu2(); - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResponseHighlightingInterceptorTest.class); private static int ourPort; private static Server ourServer; private static RestfulServer ourServlet; - @AfterClass - public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); - } - @Before public void before() { ourInterceptor.setShowRequestHeaders(new ResponseHighlighterInterceptor().isShowRequestHeaders()); ourInterceptor.setShowResponseHeaders(new ResponseHighlighterInterceptor().isShowResponseHeaders()); } - /** - * For interactive testing only - */ @Test - public void waitForInput() throws IOException { - System.in.read(); + public void testBinaryReadAcceptBrowser() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo"); + httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); + httpGet.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); + + HttpResponse status = ourClient.execute(httpGet); + byte[] responseContent = IOUtils.toByteArray(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals("foo", status.getFirstHeader("content-type").getValue()); + assertEquals("Attachment;", status.getFirstHeader("Content-Disposition").getValue()); + assertArrayEquals(new byte[] { 1, 2, 3, 4 }, responseContent); } - /** - * See #464 - */ @Test - public void testPrettyPrintDefaultsToTrue() throws Exception { - ourServlet.setDefaultPrettyPrint(false); - - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1"); - httpGet.addHeader("Accept", "text/html"); + public void testBinaryReadAcceptFhirJson() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo"); + httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); + httpGet.addHeader("Accept", Constants.CT_FHIR_JSON); HttpResponse status = ourClient.execute(httpGet); String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); IOUtils.closeQuietly(status.getEntity().getContent()); - ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - assertThat(responseContent, (stringContainsInOrder("", "
", "")));
+		assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
+		assertNull(status.getFirstHeader("Content-Disposition"));
+		assertEquals("{\"resourceType\":\"Binary\",\"id\":\"1\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}", responseContent);
+
 	}
 
-	/**
-	 * See #464
-	 */
 	@Test
-	public void testPrettyPrintDefaultsToTrueWithExplicitTrue() throws Exception {
-		ourServlet.setDefaultPrettyPrint(false);
-		
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_pretty=true");
-		httpGet.addHeader("Accept", "text/html");
+	public void testBinaryReadAcceptMissing() throws Exception {
+		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo");
+
+		HttpResponse status = ourClient.execute(httpGet);
+		byte[] responseContent = IOUtils.toByteArray(status.getEntity().getContent());
+		IOUtils.closeQuietly(status.getEntity().getContent());
+		assertEquals(200, status.getStatusLine().getStatusCode());
+		assertEquals("foo", status.getFirstHeader("content-type").getValue());
+		assertEquals("Attachment;", status.getFirstHeader("Content-Disposition").getValue());
+		assertArrayEquals(new byte[] { 1, 2, 3, 4 }, responseContent);
+
+	}
+
+	@Test
+	public void testDontHighlightWhenOriginHeaderPresent() throws Exception {
+		ResponseHighlighterInterceptor ic = ourInterceptor;
+
+		HttpServletRequest req = mock(HttpServletRequest.class);
+		when(req.getHeaders(Constants.HEADER_ACCEPT)).thenAnswer(new Answer>() {
+			@Override
+			public Enumeration answer(InvocationOnMock theInvocation) throws Throwable {
+				return new ArrayEnumeration("text/html,application/xhtml+xml,application/xml;q=0.9");
+			}
+		});
+		when(req.getHeader(Constants.HEADER_ORIGIN)).thenAnswer(new Answer() {
+			@Override
+			public String answer(InvocationOnMock theInvocation) throws Throwable {
+				return "http://example.com";
+			}
+		});
+
+		HttpServletResponse resp = mock(HttpServletResponse.class);
+		StringWriter sw = new StringWriter();
+		when(resp.getWriter()).thenReturn(new PrintWriter(sw));
+
+		Patient resource = new Patient();
+		resource.addName().addFamily("FAMILY");
+
+		ServletRequestDetails reqDetails = new TestServletRequestDetails();
+		reqDetails.setRequestType(RequestTypeEnum.GET);
+		HashMap params = new HashMap();
+		reqDetails.setParameters(params);
+		reqDetails.setServer(new RestfulServer(ourCtx));
+		reqDetails.setServletRequest(req);
+
+		// true means it decided to not handle the request..
+		assertTrue(ic.outgoingResponse(reqDetails, resource, req, resp));
+
+	}
+
+	@Test
+	public void testForceApplicationJson() throws Exception {
+		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=application/json");
+		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
 
 		HttpResponse status = ourClient.execute(httpGet);
 		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
 		IOUtils.closeQuietly(status.getEntity().getContent());
-		ourLog.info(responseContent);
 		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertThat(responseContent, (stringContainsInOrder("", "
", "")));
+		assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
+		assertThat(responseContent, not(containsString("html")));
 	}
 
-	/**
-	 * See #464
-	 */
 	@Test
-	public void testPrettyPrintDefaultsToTrueWithExplicitFalse() throws Exception {
-		ourServlet.setDefaultPrettyPrint(false);
-		
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_pretty=false");
-		httpGet.addHeader("Accept", "text/html");
+	public void testForceApplicationJsonFhir() throws Exception {
+		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=application/json+fhir");
+		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
 
 		HttpResponse status = ourClient.execute(httpGet);
 		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
 		IOUtils.closeQuietly(status.getEntity().getContent());
-		ourLog.info(responseContent);
 		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertThat(responseContent, not(stringContainsInOrder("", "
", "\n", "
"))); + assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); + assertThat(responseContent, not(containsString("html"))); + } + + @Test + public void testForceApplicationJsonPlusFhir() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=" + UrlUtil.escape("application/json+fhir")); + httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); + + HttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + IOUtils.closeQuietly(status.getEntity().getContent()); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); + assertThat(responseContent, not(containsString("html"))); + } + + @Test + public void testForceApplicationXml() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=application/xml"); + httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); + + HttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(Constants.CT_FHIR_XML + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); + assertThat(responseContent, not(containsString("html"))); + } + + @Test + public void testForceApplicationXmlFhir() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=application/xml+fhir"); + httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); + + HttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(Constants.CT_FHIR_XML + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); + assertThat(responseContent, not(containsString("html"))); + } + + @Test + public void testForceApplicationXmlPlusFhir() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=" + UrlUtil.escape("application/xml+fhir")); + httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); + + HttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(Constants.CT_FHIR_XML + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); + assertThat(responseContent, not(containsString("html"))); + } + + @Test + public void testForceHtmlJson() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json"); + httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); + + HttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + IOUtils.closeQuietly(status.getEntity().getContent()); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); + assertThat(responseContent, containsString("html")); + assertThat(responseContent, containsString(">{<")); + assertThat(responseContent, not(containsString("<"))); + + ourLog.info(responseContent); + } + + @Test + public void testForceHtmlXml() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/xml"); + httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); + + HttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); + assertThat(responseContent, containsString("html")); + assertThat(responseContent, not(containsString(">{<"))); + assertThat(responseContent, containsString("<")); + } + + @Test + public void testForceJson() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=json"); + httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"); + + HttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + IOUtils.closeQuietly(status.getEntity().getContent()); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); + assertThat(responseContent, not(containsString("html"))); } @Test public void testForceResponseTime() throws Exception { HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json"); - + HttpResponse status = ourClient.execute(httpGet); String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); IOUtils.closeQuietly(status.getEntity().getContent()); @@ -154,74 +292,7 @@ public class ResponseHighlightingInterceptorTest { assertEquals(200, status.getStatusLine().getStatusCode()); assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); assertThat(responseContent.replace('\n', ' ').replace('\r', ' '), matchesPattern(".*Response generated in [0-9]+ms.*")); - - } - @Test - public void testShowNeither() throws Exception { - ourInterceptor.setShowRequestHeaders(false); - ourInterceptor.setShowResponseHeaders(false); - - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json"); - - HttpResponse status = ourClient.execute(httpGet); - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - IOUtils.closeQuietly(status.getEntity().getContent()); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); - assertThat(responseContent, not(containsStringIgnoringCase("Accept"))); - assertThat(responseContent, not(containsStringIgnoringCase("Content-Type"))); - } - - @Test - public void testShowResponse() throws Exception { - ourInterceptor.setShowResponseHeaders(true); - - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json"); - - HttpResponse status = ourClient.execute(httpGet); - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - IOUtils.closeQuietly(status.getEntity().getContent()); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); - assertThat(responseContent, not(containsStringIgnoringCase("Accept"))); - assertThat(responseContent, (containsStringIgnoringCase("Content-Type"))); - } - - @Test - public void testShowRequest() throws Exception { - ourInterceptor.setShowRequestHeaders(true); - ourInterceptor.setShowResponseHeaders(false); - - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json"); - - HttpResponse status = ourClient.execute(httpGet); - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - IOUtils.closeQuietly(status.getEntity().getContent()); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); - assertThat(responseContent, (containsStringIgnoringCase("Accept"))); - assertThat(responseContent, not(containsStringIgnoringCase("Content-Type"))); - } - - @Test - public void testShowRequestAndResponse() throws Exception { - ourInterceptor.setShowRequestHeaders(true); - ourInterceptor.setShowResponseHeaders(true); - - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json"); - - HttpResponse status = ourClient.execute(httpGet); - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - IOUtils.closeQuietly(status.getEntity().getContent()); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase()); - assertThat(responseContent, (containsStringIgnoringCase("Accept"))); - assertThat(responseContent, (containsStringIgnoringCase("Content-Type"))); } @Test @@ -238,7 +309,7 @@ public class ResponseHighlightingInterceptorTest { assertThat(responseContent, stringContainsInOrder("OperationOutcome", "Unknown resource type 'Foobar' - Server knows how to handle")); } - + @Test public void testGetInvalidResourceNoAcceptHeader() throws Exception { HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Foobar/123"); @@ -296,7 +367,7 @@ public class ResponseHighlightingInterceptorTest { // This can be null depending on the exception type // reqDetails.setParameters(null); - + ResourceNotFoundException exception = new ResourceNotFoundException("Not found"); exception.setOperationOutcome(new OperationOutcome().addIssue(new Issue().setDiagnostics("Hello"))); @@ -307,113 +378,6 @@ public class ResponseHighlightingInterceptorTest { assertThat(output, containsString("OperationOutcome")); } - - @Test - public void testHighlightNormalResponseForcePrettyPrint() throws Exception { - ResponseHighlighterInterceptor ic = ourInterceptor; - - HttpServletRequest req = mock(HttpServletRequest.class); - when(req.getHeaders(Constants.HEADER_ACCEPT)).thenAnswer(new Answer>() { - @Override - public Enumeration answer(InvocationOnMock theInvocation) throws Throwable { - return new ArrayEnumeration("text/html,application/xhtml+xml,application/xml;q=0.9"); - } - }); - - HttpServletResponse resp = mock(HttpServletResponse.class); - StringWriter sw = new StringWriter(); - when(resp.getWriter()).thenReturn(new PrintWriter(sw)); - - Patient resource = new Patient(); - resource.addName().addFamily("FAMILY"); - - ServletRequestDetails reqDetails = new TestServletRequestDetails(); - reqDetails.setRequestType(RequestTypeEnum.GET); - HashMap params = new HashMap(); - params.put(Constants.PARAM_PRETTY, new String[] { Constants.PARAM_PRETTY_VALUE_TRUE }); - reqDetails.setParameters(params); - reqDetails.setServer(new RestfulServer(ourCtx)); - reqDetails.setServletRequest(req); - - assertFalse(ic.outgoingResponse(reqDetails, resource, req, resp)); - - String output = sw.getBuffer().toString(); - ourLog.info(output); - assertThat(output, containsString("Patient")); - assertThat(output, stringContainsInOrder("", "
", ""));
-	}
-
-	@Test
-	public void testHighlightForceRaw() throws Exception {
-		ResponseHighlighterInterceptor ic = ourInterceptor;
-
-		HttpServletRequest req = mock(HttpServletRequest.class);
-		when(req.getHeaders(Constants.HEADER_ACCEPT)).thenAnswer(new Answer>() {
-			@Override
-			public Enumeration answer(InvocationOnMock theInvocation) throws Throwable {
-				return new ArrayEnumeration("text/html,application/xhtml+xml,application/xml;q=0.9");
-			}
-		});
-
-		HttpServletResponse resp = mock(HttpServletResponse.class);
-		StringWriter sw = new StringWriter();
-		when(resp.getWriter()).thenReturn(new PrintWriter(sw));
-
-		Patient resource = new Patient();
-		resource.addName().addFamily("FAMILY");
-
-		ServletRequestDetails reqDetails = new TestServletRequestDetails();
-		reqDetails.setRequestType(RequestTypeEnum.GET);
-		HashMap params = new HashMap();
-		params.put(Constants.PARAM_PRETTY, new String[] { Constants.PARAM_PRETTY_VALUE_TRUE });
-		params.put(Constants.PARAM_FORMAT, new String[] { Constants.CT_XML });
-		params.put(ResponseHighlighterInterceptor.PARAM_RAW, new String[] { ResponseHighlighterInterceptor.PARAM_RAW_TRUE });
-		reqDetails.setParameters(params);
-		reqDetails.setServer(new RestfulServer(ourCtx));
-		reqDetails.setServletRequest(req);
-
-		// true means it decided to not handle the request..
-		assertTrue(ic.outgoingResponse(reqDetails, resource, req, resp));
-
-	}
-	
-	@Test
-	public void testDontHighlightWhenOriginHeaderPresent() throws Exception {
-		ResponseHighlighterInterceptor ic = ourInterceptor;
-
-		HttpServletRequest req = mock(HttpServletRequest.class);
-		when(req.getHeaders(Constants.HEADER_ACCEPT)).thenAnswer(new Answer>() {
-			@Override
-			public Enumeration answer(InvocationOnMock theInvocation) throws Throwable {
-				return new ArrayEnumeration("text/html,application/xhtml+xml,application/xml;q=0.9");
-			}
-		});
-		when(req.getHeader(Constants.HEADER_ORIGIN)).thenAnswer(new Answer() {
-			@Override
-			public String answer(InvocationOnMock theInvocation) throws Throwable {
-				return "http://example.com";
-			}
-		});
-
-		HttpServletResponse resp = mock(HttpServletResponse.class);
-		StringWriter sw = new StringWriter();
-		when(resp.getWriter()).thenReturn(new PrintWriter(sw));
-
-		Patient resource = new Patient();
-		resource.addName().addFamily("FAMILY");
-
-		ServletRequestDetails reqDetails = new TestServletRequestDetails();
-		reqDetails.setRequestType(RequestTypeEnum.GET);
-		HashMap params = new HashMap();
-		reqDetails.setParameters(params);
-		reqDetails.setServer(new RestfulServer(ourCtx));
-		reqDetails.setServletRequest(req);
-
-		// true means it decided to not handle the request..
-		assertTrue(ic.outgoingResponse(reqDetails, resource, req, resp));
-
-	}
-
 	/**
 	 * See #346
 	 */
@@ -482,6 +446,40 @@ public class ResponseHighlightingInterceptorTest {
 		assertFalse(ic.outgoingResponse(reqDetails, resource, req, resp));
 	}
 
+	@Test
+	public void testHighlightForceRaw() throws Exception {
+		ResponseHighlighterInterceptor ic = ourInterceptor;
+
+		HttpServletRequest req = mock(HttpServletRequest.class);
+		when(req.getHeaders(Constants.HEADER_ACCEPT)).thenAnswer(new Answer>() {
+			@Override
+			public Enumeration answer(InvocationOnMock theInvocation) throws Throwable {
+				return new ArrayEnumeration("text/html,application/xhtml+xml,application/xml;q=0.9");
+			}
+		});
+
+		HttpServletResponse resp = mock(HttpServletResponse.class);
+		StringWriter sw = new StringWriter();
+		when(resp.getWriter()).thenReturn(new PrintWriter(sw));
+
+		Patient resource = new Patient();
+		resource.addName().addFamily("FAMILY");
+
+		ServletRequestDetails reqDetails = new TestServletRequestDetails();
+		reqDetails.setRequestType(RequestTypeEnum.GET);
+		HashMap params = new HashMap();
+		params.put(Constants.PARAM_PRETTY, new String[] { Constants.PARAM_PRETTY_VALUE_TRUE });
+		params.put(Constants.PARAM_FORMAT, new String[] { Constants.CT_XML });
+		params.put(ResponseHighlighterInterceptor.PARAM_RAW, new String[] { ResponseHighlighterInterceptor.PARAM_RAW_TRUE });
+		reqDetails.setParameters(params);
+		reqDetails.setServer(new RestfulServer(ourCtx));
+		reqDetails.setServletRequest(req);
+
+		// true means it decided to not handle the request..
+		assertTrue(ic.outgoingResponse(reqDetails, resource, req, resp));
+
+	}
+
 	@Test
 	public void testHighlightNormalResponse() throws Exception {
 		ResponseHighlighterInterceptor ic = ourInterceptor;
@@ -516,6 +514,41 @@ public class ResponseHighlightingInterceptorTest {
 		assertThat(output, containsString(""));
 	}
 
+	@Test
+	public void testHighlightNormalResponseForcePrettyPrint() throws Exception {
+		ResponseHighlighterInterceptor ic = ourInterceptor;
+
+		HttpServletRequest req = mock(HttpServletRequest.class);
+		when(req.getHeaders(Constants.HEADER_ACCEPT)).thenAnswer(new Answer>() {
+			@Override
+			public Enumeration answer(InvocationOnMock theInvocation) throws Throwable {
+				return new ArrayEnumeration("text/html,application/xhtml+xml,application/xml;q=0.9");
+			}
+		});
+
+		HttpServletResponse resp = mock(HttpServletResponse.class);
+		StringWriter sw = new StringWriter();
+		when(resp.getWriter()).thenReturn(new PrintWriter(sw));
+
+		Patient resource = new Patient();
+		resource.addName().addFamily("FAMILY");
+
+		ServletRequestDetails reqDetails = new TestServletRequestDetails();
+		reqDetails.setRequestType(RequestTypeEnum.GET);
+		HashMap params = new HashMap();
+		params.put(Constants.PARAM_PRETTY, new String[] { Constants.PARAM_PRETTY_VALUE_TRUE });
+		reqDetails.setParameters(params);
+		reqDetails.setServer(new RestfulServer(ourCtx));
+		reqDetails.setServletRequest(req);
+
+		assertFalse(ic.outgoingResponse(reqDetails, resource, req, resp));
+
+		String output = sw.getBuffer().toString();
+		ourLog.info(output);
+		assertThat(output, containsString("Patient"));
+		assertThat(output, stringContainsInOrder("", "
", ""));
+	}
+
 	/**
 	 * Browsers declare XML but not JSON in their accept header, we should still respond using JSON if that's the default
 	 */
@@ -553,9 +586,6 @@ public class ResponseHighlightingInterceptorTest {
 		ourLog.info(output);
 		assertThat(output, containsString("resourceType"));
 	}
-
-	
-	
 	
 	@Test
 	public void testHighlightProducesDefaultJsonWithBrowserRequest2() throws Exception {
@@ -589,6 +619,60 @@ public class ResponseHighlightingInterceptorTest {
 		assertTrue(ic.outgoingResponse(reqDetails, resource, req, resp));
 	}
 
+	/**
+	 * See #464
+	 */
+	@Test
+	public void testPrettyPrintDefaultsToTrue() throws Exception {
+		ourServlet.setDefaultPrettyPrint(false);
+
+		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1");
+		httpGet.addHeader("Accept", "text/html");
+
+		HttpResponse status = ourClient.execute(httpGet);
+		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
+		IOUtils.closeQuietly(status.getEntity().getContent());
+		ourLog.info(responseContent);
+		assertEquals(200, status.getStatusLine().getStatusCode());
+		assertThat(responseContent, (stringContainsInOrder("", "
", "")));
+	}
+
+	/**
+	 * See #464
+	 */
+	@Test
+	public void testPrettyPrintDefaultsToTrueWithExplicitFalse() throws Exception {
+		ourServlet.setDefaultPrettyPrint(false);
+
+		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_pretty=false");
+		httpGet.addHeader("Accept", "text/html");
+
+		HttpResponse status = ourClient.execute(httpGet);
+		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
+		IOUtils.closeQuietly(status.getEntity().getContent());
+		ourLog.info(responseContent);
+		assertEquals(200, status.getStatusLine().getStatusCode());
+		assertThat(responseContent, not(stringContainsInOrder("", "
", "\n", "
"))); + } + + /** + * See #464 + */ + @Test + public void testPrettyPrintDefaultsToTrueWithExplicitTrue() throws Exception { + ourServlet.setDefaultPrettyPrint(false); + + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_pretty=true"); + httpGet.addHeader("Accept", "text/html"); + + HttpResponse status = ourClient.execute(httpGet); + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + IOUtils.closeQuietly(status.getEntity().getContent()); + ourLog.info(responseContent); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertThat(responseContent, (stringContainsInOrder("", "
", "")));
+	}
+
 	@Test
 	public void testSearchWithSummaryParam() throws Exception {
 		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchWithWildcardRetVal&_summary=count");
@@ -603,169 +687,75 @@ public class ResponseHighlightingInterceptorTest {
 	}
 
 	@Test
-	public void testBinaryReadAcceptMissing() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo");
+	public void testShowNeither() throws Exception {
+		ourInterceptor.setShowRequestHeaders(false);
+		ourInterceptor.setShowResponseHeaders(false);
 
-		HttpResponse status = ourClient.execute(httpGet);
-		byte[] responseContent = IOUtils.toByteArray(status.getEntity().getContent());
-		IOUtils.closeQuietly(status.getEntity().getContent());
-		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals("foo", status.getFirstHeader("content-type").getValue());
-		assertEquals("Attachment;", status.getFirstHeader("Content-Disposition").getValue());
-		assertArrayEquals(new byte[] { 1, 2, 3, 4 }, responseContent);
-
-	}
-
-	@Test
-	public void testBinaryReadAcceptBrowser() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo");
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		httpGet.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
-		
-		HttpResponse status = ourClient.execute(httpGet);
-		byte[] responseContent = IOUtils.toByteArray(status.getEntity().getContent());
-		IOUtils.closeQuietly(status.getEntity().getContent());
-		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals("foo", status.getFirstHeader("content-type").getValue());
-		assertEquals("Attachment;", status.getFirstHeader("Content-Disposition").getValue());
-		assertArrayEquals(new byte[] { 1, 2, 3, 4 }, responseContent);
-	}
-	
-	@Test
-	public void testBinaryReadAcceptFhirJson() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Binary/foo");
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		httpGet.addHeader("Accept", Constants.CT_FHIR_JSON);
-		
-		HttpResponse status = ourClient.execute(httpGet);
-		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
-		IOUtils.closeQuietly(status.getEntity().getContent());
-		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertNull(status.getFirstHeader("Content-Disposition"));
-		assertEquals("{\"resourceType\":\"Binary\",\"id\":\"1\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}", responseContent);
-
-	}
-	@Test
-	public void testForceApplicationJson() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=application/json");
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		
-		HttpResponse status = ourClient.execute(httpGet);
-		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
-		IOUtils.closeQuietly(status.getEntity().getContent());
-		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertThat(responseContent, not(containsString("html")));
-	}
-	@Test
-	public void testForceApplicationJsonFhir() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=application/json+fhir");
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		
-		HttpResponse status = ourClient.execute(httpGet);
-		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
-		IOUtils.closeQuietly(status.getEntity().getContent());
-		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertThat(responseContent, not(containsString("html")));
-	}
-
-	@Test
-	public void testForceApplicationJsonPlusFhir() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=" + UrlUtil.escape("application/json+fhir"));
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		
-		HttpResponse status = ourClient.execute(httpGet);
-		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
-		IOUtils.closeQuietly(status.getEntity().getContent());
-		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertThat(responseContent, not(containsString("html")));
-	}
-
-	@Test
-	public void testForceJson() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=json");
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		
-		HttpResponse status = ourClient.execute(httpGet);
-		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
-		IOUtils.closeQuietly(status.getEntity().getContent());
-		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals(Constants.CT_FHIR_JSON + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertThat(responseContent, not(containsString("html")));
-	}
-
-
-	
-	@Test
-	public void testForceHtmlJson() throws Exception {
 		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json");
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		
+
 		HttpResponse status = ourClient.execute(httpGet);
 		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
 		IOUtils.closeQuietly(status.getEntity().getContent());
-		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertThat(responseContent, containsString("html"));
-		assertThat(responseContent, containsString(">{<"));
-		assertThat(responseContent, not(containsString("<")));
-		
 		ourLog.info(responseContent);
-	}
-	
-	@Test
-	public void testForceHtmlXml() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/xml");
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		
-		HttpResponse status = ourClient.execute(httpGet);
-		String responseContent = IOUtils.toString(status.getEntity().getContent());
-		IOUtils.closeQuietly(status.getEntity().getContent());
 		assertEquals(200, status.getStatusLine().getStatusCode());
 		assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertThat(responseContent, containsString("html"));
-		assertThat(responseContent, not(containsString(">{<")));
-		assertThat(responseContent, containsString("<"));
+		assertThat(responseContent, not(containsStringIgnoringCase("Accept")));
+		assertThat(responseContent, not(containsStringIgnoringCase("Content-Type")));
 	}
 	
 	@Test
-	public void testForceApplicationXml() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=application/xml");
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		
+	public void testShowRequest() throws Exception {
+		ourInterceptor.setShowRequestHeaders(true);
+		ourInterceptor.setShowResponseHeaders(false);
+
+		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json");
+
 		HttpResponse status = ourClient.execute(httpGet);
-		String responseContent = IOUtils.toString(status.getEntity().getContent());
+		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
 		IOUtils.closeQuietly(status.getEntity().getContent());
+		ourLog.info(responseContent);
 		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals(Constants.CT_FHIR_XML + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertThat(responseContent, not(containsString("html")));
+		assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
+		assertThat(responseContent, (containsStringIgnoringCase("Accept")));
+		assertThat(responseContent, not(containsStringIgnoringCase("Content-Type")));
 	}
+	
 	@Test
-	public void testForceApplicationXmlFhir() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=application/xml+fhir");
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		
+	public void testShowRequestAndResponse() throws Exception {
+		ourInterceptor.setShowRequestHeaders(true);
+		ourInterceptor.setShowResponseHeaders(true);
+
+		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json");
+
 		HttpResponse status = ourClient.execute(httpGet);
-		String responseContent = IOUtils.toString(status.getEntity().getContent());
+		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
 		IOUtils.closeQuietly(status.getEntity().getContent());
+		ourLog.info(responseContent);
 		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals(Constants.CT_FHIR_XML + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertThat(responseContent, not(containsString("html")));
+		assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
+		assertThat(responseContent, (containsStringIgnoringCase("Accept")));
+		assertThat(responseContent, (containsStringIgnoringCase("Content-Type")));
 	}
+
 	@Test
-	public void testForceApplicationXmlPlusFhir() throws Exception {
-		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=" + UrlUtil.escape("application/xml+fhir"));
-		httpGet.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1");
-		
+	public void testShowResponse() throws Exception {
+		ourInterceptor.setShowResponseHeaders(true);
+
+		HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=html/json");
+
 		HttpResponse status = ourClient.execute(httpGet);
-		String responseContent = IOUtils.toString(status.getEntity().getContent());
+		String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
 		IOUtils.closeQuietly(status.getEntity().getContent());
+		ourLog.info(responseContent);
 		assertEquals(200, status.getStatusLine().getStatusCode());
-		assertEquals(Constants.CT_FHIR_XML + ";charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
-		assertThat(responseContent, not(containsString("html")));
+		assertEquals("text/html;charset=utf-8", status.getFirstHeader("content-type").getValue().replace(" ", "").toLowerCase());
+		assertThat(responseContent, not(containsStringIgnoringCase("Accept")));
+		assertThat(responseContent, (containsStringIgnoringCase("Content-Type")));
+	}
+
+	@AfterClass
+	public static void afterClassClearContext() {
+		TestUtil.clearAllStaticFieldsForUnitTest();
 	}
 
 	@BeforeClass
@@ -812,6 +802,13 @@ public class ResponseHighlightingInterceptorTest {
 
 	}
 	
+	class TestServletRequestDetails extends ServletRequestDetails {
+		@Override
+		public String getServerBaseForRequest() {
+			return "/baseDstu3";
+		}
+	}
+
 	public static class DummyBinaryResourceProvider implements IResourceProvider {
 
 		@Override
@@ -839,7 +836,6 @@ public class ResponseHighlightingInterceptorTest {
 
 	}
 
-
 	public static class DummyPatientResourceProvider implements IResourceProvider {
 
 		private Patient createPatient1() {
@@ -898,7 +894,7 @@ public class ResponseHighlightingInterceptorTest {
 
 		/**
 		 * Retrieve the resource by its identifier
-		 * 
+		 *
 		 * @param theId
 		 *           The resource identity
 		 * @return The resource
@@ -912,7 +908,7 @@ public class ResponseHighlightingInterceptorTest {
 
 		/**
 		 * Retrieve the resource by its identifier
-		 * 
+		 *
 		 * @param theId
 		 *           The resource identity
 		 * @return The resource
@@ -942,11 +938,4 @@ public class ResponseHighlightingInterceptorTest {
 
 	}
 
-	class TestServletRequestDetails extends ServletRequestDetails {
-		@Override
-		public String getServerBaseForRequest() {
-			return "/baseDstu3";
-		}
-	}
-
 }
diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml
index e8a0720097a..f303ccd1785 100644
--- a/hapi-fhir-structures-dstu3/pom.xml
+++ b/hapi-fhir-structures-dstu3/pom.xml
@@ -1,4 +1,4 @@
-
 	4.0.0
 
@@ -14,6 +14,72 @@
 
 	HAPI FHIR Structures - DSTU3
 
+	
+		
+			
+				org.apache.maven.plugins
+				maven-javadoc-plugin
+				
+					public
+				
+			
+		
+	
+
+	
+		
+			
+				org.jacoco
+				jacoco-maven-plugin
+				
+					
+						${basedir}/target/classes
+						${basedir}/../hapi-fhir-base/target/classes
+						${basedir}/../hapi-fhir-client/target/classes
+						${basedir}/../hapi-fhir-server/target/classes
+					
+					
+						${basedir}/src/main/java
+						${basedir}/../hapi-fhir-base/src/main/java
+						${basedir}/../hapi-fhir-client/src/main/java
+						${basedir}/../hapi-fhir-server/src/main/java
+					
+					true
+				
+				
+					
+						default-prepare-agent
+						
+							prepare-agent
+						
+					
+				
+			
+			
+				org.apache.maven.plugins
+				maven-surefire-plugin
+				
+					${argLine} -Dfile.encoding=UTF-8 -Xmx712m
+				
+			
+			
+				org.codehaus.mojo
+				license-maven-plugin
+				
+					
+					true
+				
+			
+			
+				org.apache.maven.plugins
+				maven-compiler-plugin
+				
+					true
+				
+			
+		
+	
+
 	
 		
 			ca.uhn.hapi.fhir
@@ -25,9 +91,9 @@
 			hapi-fhir-utilities
 			${project.version}
 		
-		
+
 		
 		
 			ca.uhn.hapi.fhir
@@ -35,6 +101,11 @@
 			${project.version}
 			test
 		
+      
+         org.codehaus.woodstox
+         woodstox-core-asl
+			test
+      
 		
 			ca.uhn.hapi.fhir
 			hapi-fhir-client
@@ -48,27 +119,21 @@
 			true
 		
 
-		
-			xpp3
-			xpp3
-			true
-		
-
-		
 		
 			javax.servlet
-			servlet-api
-			2.5
+			javax.servlet-api
+			3.0.1
 			true
 		
 
-		
 		
 			commons-codec
@@ -77,13 +142,21 @@
 		
 
 
+		
+			xpp3
+			xpp3
+			true
+		
+		
 
-		
-					true
-				
-			
-			
-				org.apache.maven.plugins
-				maven-compiler-plugin
-				
-					true
-				
-			
-		
-	
-
 
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java
index e386274b8d4..8e75cf1995a 100644
--- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java
@@ -1772,8 +1772,9 @@ public class ProfileUtilities extends TranslatingUtilities {
     case BUNDLED : return "b";
     case CONTAINED : return "c";
     case REFERENCED: return "r";
+    default: return "?";
     }
-    return "?";
+
   }
 
 
@@ -2232,7 +2233,7 @@ public class ProfileUtilities extends TranslatingUtilities {
         if (definition != null && definition.hasShort()) {
           if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br"));
           c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, gt(definition.getShortElement()), null)));
-        } else if (fallback != null && fallback != null && fallback.hasShort()) {
+        } else if (fallback != null && fallback.hasShort()) {
           if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br"));
           c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, gt(fallback.getShortElement()), null)));
         }
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/rest/server/Dstu3BundleFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/rest/server/Dstu3BundleFactory.java
index c05f5ad8e44..88dd8a99364 100644
--- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/rest/server/Dstu3BundleFactory.java
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/rest/server/Dstu3BundleFactory.java
@@ -19,13 +19,6 @@ package org.hl7.fhir.dstu3.hapi.rest.server;
  * limitations under the License.
  * #L%
  */
-import static org.apache.commons.lang3.StringUtils.isNotBlank;
-
-import java.util.*;
-
-import org.hl7.fhir.dstu3.model.*;
-import org.hl7.fhir.dstu3.model.Bundle.*;
-import org.hl7.fhir.instance.model.api.*;
 
 import ca.uhn.fhir.context.FhirContext;
 import ca.uhn.fhir.context.api.BundleInclusionRule;
@@ -35,324 +28,340 @@ import ca.uhn.fhir.model.valueset.BundleTypeEnum;
 import ca.uhn.fhir.rest.api.Constants;
 import ca.uhn.fhir.rest.api.IVersionSpecificBundleFactory;
 import ca.uhn.fhir.util.ResourceReferenceInfo;
+import org.hl7.fhir.dstu3.model.Bundle;
+import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
+import org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent;
+import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb;
+import org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode;
+import org.hl7.fhir.dstu3.model.DomainResource;
+import org.hl7.fhir.dstu3.model.IdType;
+import org.hl7.fhir.dstu3.model.Resource;
+import org.hl7.fhir.instance.model.api.*;
+
+import java.util.*;
+
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
 
 public class Dstu3BundleFactory implements IVersionSpecificBundleFactory {
-	private String myBase;
-	private Bundle myBundle;
-	private FhirContext myContext;
+  private String myBase;
+  private Bundle myBundle;
+  private FhirContext myContext;
 
-	public Dstu3BundleFactory(FhirContext theContext) {
-		myContext = theContext;
-	}
+  public Dstu3BundleFactory(FhirContext theContext) {
+    myContext = theContext;
+  }
 
-	private void addResourcesForSearch(List theResult) {
-		List includedResources = new ArrayList();
-		Set addedResourceIds = new HashSet();
+  private void addResourcesForSearch(List theResult) {
+    List includedResources = new ArrayList();
+    Set addedResourceIds = new HashSet();
 
-		for (IBaseResource next : theResult) {
-			if (next.getIdElement().isEmpty() == false) {
-				addedResourceIds.add(next.getIdElement());
-			}
-		}
+    for (IBaseResource next : theResult) {
+      if (next.getIdElement().isEmpty() == false) {
+        addedResourceIds.add(next.getIdElement());
+      }
+    }
 
-		for (IBaseResource nextBaseRes : theResult) {
-			Resource next = (Resource) nextBaseRes;
-			Set containedIds = new HashSet();
-			if (next instanceof DomainResource) {
-				for (Resource nextContained : ((DomainResource) next).getContained()) {
-					if (nextContained.getIdElement().isEmpty() == false) {
-						containedIds.add(nextContained.getIdElement().getValue());
-					}
-				}
-			}
+    for (IBaseResource nextBaseRes : theResult) {
+      Resource next = (Resource) nextBaseRes;
+      Set containedIds = new HashSet();
+      if (next instanceof DomainResource) {
+        for (Resource nextContained : ((DomainResource) next).getContained()) {
+          if (nextContained.getIdElement().isEmpty() == false) {
+            containedIds.add(nextContained.getIdElement().getValue());
+          }
+        }
+      }
 
-			List references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, IBaseReference.class);
-			do {
-				List addedResourcesThisPass = new ArrayList();
+      List references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, IBaseReference.class);
+      do {
+        List addedResourcesThisPass = new ArrayList();
 
-				for (IBaseReference nextRef : references) {
-					IAnyResource nextRes = (IAnyResource) nextRef.getResource();
-					if (nextRes != null) {
-						if (nextRes.getIdElement().hasIdPart()) {
-							if (containedIds.contains(nextRes.getIdElement().getValue())) {
-								// Don't add contained IDs as top level resources
-								continue;
-							}
+        for (IBaseReference nextRef : references) {
+          IAnyResource nextRes = (IAnyResource) nextRef.getResource();
+          if (nextRes != null) {
+            if (nextRes.getIdElement().hasIdPart()) {
+              if (containedIds.contains(nextRes.getIdElement().getValue())) {
+                // Don't add contained IDs as top level resources
+                continue;
+              }
 
-							IIdType id = nextRes.getIdElement();
-							if (id.hasResourceType() == false) {
-								String resName = myContext.getResourceDefinition(nextRes).getName();
-								id = id.withResourceType(resName);
-							}
+              IIdType id = nextRes.getIdElement();
+              if (id.hasResourceType() == false) {
+                String resName = myContext.getResourceDefinition(nextRes).getName();
+                id = id.withResourceType(resName);
+              }
 
-							if (!addedResourceIds.contains(id)) {
-								addedResourceIds.add(id);
-								addedResourcesThisPass.add(nextRes);
-							}
+              if (!addedResourceIds.contains(id)) {
+                addedResourceIds.add(id);
+                addedResourcesThisPass.add(nextRes);
+              }
 
-						}
-					}
-				}
+            }
+          }
+        }
 
-				// Linked resources may themselves have linked resources
-				references = new ArrayList();
-				for (IAnyResource iResource : addedResourcesThisPass) {
-					List newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, IBaseReference.class);
-					references.addAll(newReferences);
-				}
+        // Linked resources may themselves have linked resources
+        references = new ArrayList();
+        for (IAnyResource iResource : addedResourcesThisPass) {
+          List newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, IBaseReference.class);
+          references.addAll(newReferences);
+        }
 
-				includedResources.addAll(addedResourcesThisPass);
+        includedResources.addAll(addedResourcesThisPass);
 
-			} while (references.isEmpty() == false);
+      } while (references.isEmpty() == false);
 
-			BundleEntryComponent entry = myBundle.addEntry().setResource(next);
-			if (next.getIdElement().hasBaseUrl()) {
-				entry.setFullUrl(next.getId());
-			}
+      BundleEntryComponent entry = myBundle.addEntry().setResource(next);
+      if (next.getIdElement().hasBaseUrl()) {
+        entry.setFullUrl(next.getId());
+      }
 
-			String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(next);
-			if (httpVerb != null) {
-				entry.getRequest().getMethodElement().setValueAsString(httpVerb);
-				entry.getRequest().getUrlElement().setValue(next.getId());
-			}
-		}
+      String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(next);
+      if (httpVerb != null) {
+        entry.getRequest().getMethodElement().setValueAsString(httpVerb);
+        entry.getRequest().getUrlElement().setValue(next.getId());
+      }
+    }
+
+		/*
+       * Actually add the resources to the bundle
+		 */
+    for (IBaseResource next : includedResources) {
+      BundleEntryComponent entry = myBundle.addEntry();
+      entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE);
+      if (next.getIdElement().hasBaseUrl()) {
+        entry.setFullUrl(next.getIdElement().getValue());
+      }
+    }
+  }
+
+  @Override
+  public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes) {
+    ensureBundle();
+
+    List includedResources = new ArrayList();
+    Set addedResourceIds = new HashSet();
+
+    for (IBaseResource next : theResult) {
+      if (next.getIdElement().isEmpty() == false) {
+        addedResourceIds.add(next.getIdElement());
+      }
+    }
+
+    for (IBaseResource next : theResult) {
+
+      Set containedIds = new HashSet();
+
+      if (next instanceof DomainResource) {
+        for (Resource nextContained : ((DomainResource) next).getContained()) {
+          if (isNotBlank(nextContained.getId())) {
+            containedIds.add(nextContained.getId());
+          }
+        }
+      }
+
+      List references = myContext.newTerser().getAllResourceReferences(next);
+      do {
+        List addedResourcesThisPass = new ArrayList();
+
+        for (ResourceReferenceInfo nextRefInfo : references) {
+          if (!theBundleInclusionRule.shouldIncludeReferencedResource(nextRefInfo, theIncludes)) {
+            continue;
+          }
+
+          IAnyResource nextRes = (IAnyResource) nextRefInfo.getResourceReference().getResource();
+          if (nextRes != null) {
+            if (nextRes.getIdElement().hasIdPart()) {
+              if (containedIds.contains(nextRes.getIdElement().getValue())) {
+                // Don't add contained IDs as top level resources
+                continue;
+              }
+
+              IIdType id = nextRes.getIdElement();
+              if (id.hasResourceType() == false) {
+                String resName = myContext.getResourceDefinition(nextRes).getName();
+                id = id.withResourceType(resName);
+              }
+
+              if (!addedResourceIds.contains(id)) {
+                addedResourceIds.add(id);
+                addedResourcesThisPass.add(nextRes);
+              }
+
+            }
+          }
+        }
+
+        includedResources.addAll(addedResourcesThisPass);
+
+        // Linked resources may themselves have linked resources
+        references = new ArrayList();
+        for (IAnyResource iResource : addedResourcesThisPass) {
+          List newReferences = myContext.newTerser().getAllResourceReferences(iResource);
+          references.addAll(newReferences);
+        }
+      } while (references.isEmpty() == false);
+
+      BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next);
+      Resource nextAsResource = (Resource) next;
+      IIdType id = populateBundleEntryFullUrl(next, entry);
+      String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
+      if (httpVerb != null) {
+        entry.getRequest().getMethodElement().setValueAsString(httpVerb);
+        if (id != null) {
+          entry.getRequest().setUrl(id.getValue());
+        }
+      }
+
+      String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
+      if (searchMode != null) {
+        entry.getSearch().getModeElement().setValueAsString(searchMode);
+      }
+    }
 
 		/*
 		 * Actually add the resources to the bundle
 		 */
-		for (IBaseResource next : includedResources) {
-			BundleEntryComponent entry = myBundle.addEntry();
-			entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE);
-			if (next.getIdElement().hasBaseUrl()) {
-				entry.setFullUrl(next.getIdElement().getValue());
-			}
-		}
-	}
+    for (IAnyResource next : includedResources) {
+      BundleEntryComponent entry = myBundle.addEntry();
+      entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE);
+      populateBundleEntryFullUrl(next, entry);
+    }
 
-	@Override
-	public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes) {
-		ensureBundle();
+  }
 
-		List includedResources = new ArrayList();
-		Set addedResourceIds = new HashSet();
+  @Override
+  public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType,
+                                        IPrimitiveType theLastUpdated) {
+    ensureBundle();
 
-		for (IBaseResource next : theResult) {
-			if (next.getIdElement().isEmpty() == false) {
-				addedResourceIds.add(next.getIdElement());
-			}
-		}
+    myBase = theServerBase;
 
-		for (IBaseResource next : theResult) {
+    if (myBundle.getIdElement().isEmpty()) {
+      myBundle.setId(theId);
+    }
+    if (myBundle.getIdElement().isEmpty()) {
+      myBundle.setId(UUID.randomUUID().toString());
+    }
 
-			Set containedIds = new HashSet();
+    if (myBundle.getMeta().getLastUpdated() == null && theLastUpdated != null) {
+      myBundle.getMeta().getLastUpdatedElement().setValueAsString(theLastUpdated.getValueAsString());
+    }
 
-			if (next instanceof DomainResource) {
-				for (Resource nextContained : ((DomainResource) next).getContained()) {
-					if (isNotBlank(nextContained.getId())) {
-						containedIds.add(nextContained.getId());
-					}
-				}
-			}
+    if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkSelf)) {
+      myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theLinkSelf);
+    }
+    if (!hasLink(Constants.LINK_NEXT, myBundle) && isNotBlank(theLinkNext)) {
+      myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(theLinkNext);
+    }
+    if (!hasLink(Constants.LINK_PREVIOUS, myBundle) && isNotBlank(theLinkPrev)) {
+      myBundle.addLink().setRelation(Constants.LINK_PREVIOUS).setUrl(theLinkPrev);
+    }
 
-			List references = myContext.newTerser().getAllResourceReferences(next);
-			do {
-				List addedResourcesThisPass = new ArrayList();
+    if (myBundle.getTypeElement().isEmpty() && theBundleType != null) {
+      myBundle.getTypeElement().setValueAsString(theBundleType.getCode());
+    }
 
-				for (ResourceReferenceInfo nextRefInfo : references) {
-					if (!theBundleInclusionRule.shouldIncludeReferencedResource(nextRefInfo, theIncludes)) {
-						continue;
-					}
+    if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) {
+      myBundle.getTotalElement().setValue(theTotalResults);
+    }
+  }
 
-					IAnyResource nextRes = (IAnyResource) nextRefInfo.getResourceReference().getResource();
-					if (nextRes != null) {
-						if (nextRes.getIdElement().hasIdPart()) {
-							if (containedIds.contains(nextRes.getIdElement().getValue())) {
-								// Don't add contained IDs as top level resources
-								continue;
-							}
+  private void ensureBundle() {
+    if (myBundle == null) {
+      myBundle = new Bundle();
+    }
+  }
 
-							IIdType id = nextRes.getIdElement();
-							if (id.hasResourceType() == false) {
-								String resName = myContext.getResourceDefinition(nextRes).getName();
-								id = id.withResourceType(resName);
-							}
+  @Override
+  public IBaseResource getResourceBundle() {
+    return myBundle;
+  }
 
-							if (!addedResourceIds.contains(id)) {
-								addedResourceIds.add(id);
-								addedResourcesThisPass.add(nextRes);
-							}
+  private boolean hasLink(String theLinkType, Bundle theBundle) {
+    for (BundleLinkComponent next : theBundle.getLink()) {
+      if (theLinkType.equals(next.getRelation())) {
+        return true;
+      }
+    }
+    return false;
+  }
 
-						}
-					}
-				}
+  @Override
+  public void initializeBundleFromResourceList(String theAuthor, List theResources, String theServerBase, String theCompleteUrl, int theTotalResults,
+                                               BundleTypeEnum theBundleType) {
+    myBundle = new Bundle();
 
-				includedResources.addAll(addedResourcesThisPass);
+    myBundle.setId(UUID.randomUUID().toString());
 
-				// Linked resources may themselves have linked resources
-				references = new ArrayList();
-				for (IAnyResource iResource : addedResourcesThisPass) {
-					List newReferences = myContext.newTerser().getAllResourceReferences(iResource);
-					references.addAll(newReferences);
-				}
-			} while (references.isEmpty() == false);
+    myBundle.getMeta().setLastUpdated(new Date());
 
-			BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next);
-			Resource nextAsResource = (Resource) next;
-			IIdType id = populateBundleEntryFullUrl(next, entry);
-			String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource);
-			if (httpVerb != null) {
-				entry.getRequest().getMethodElement().setValueAsString(httpVerb);
-				if (id != null) {
-					entry.getRequest().setUrl(id.getValue());
-				}
-			}
+    myBundle.addLink().setRelation(Constants.LINK_FHIR_BASE).setUrl(theServerBase);
+    myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theCompleteUrl);
+    myBundle.getTypeElement().setValueAsString(theBundleType.getCode());
 
-			String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
-			if (searchMode != null) {
-				entry.getSearch().getModeElement().setValueAsString(searchMode);
-			}
-		}
+    if (theBundleType.equals(BundleTypeEnum.TRANSACTION)) {
+      for (IBaseResource nextBaseRes : theResources) {
+        Resource next = (Resource) nextBaseRes;
+        BundleEntryComponent nextEntry = myBundle.addEntry();
 
-		/*
-		 * Actually add the resources to the bundle
-		 */
-		for (IAnyResource next : includedResources) {
-			BundleEntryComponent entry = myBundle.addEntry();
-			entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE);
-			populateBundleEntryFullUrl(next, entry);
-		}
+        nextEntry.setResource(next);
+        if (next.getIdElement().isEmpty()) {
+          nextEntry.getRequest().setMethod(HTTPVerb.POST);
+        } else {
+          nextEntry.getRequest().setMethod(HTTPVerb.PUT);
+          if (next.getIdElement().isAbsolute()) {
+            nextEntry.getRequest().setUrl(next.getId());
+          } else {
+            String resourceType = myContext.getResourceDefinition(next).getName();
+            nextEntry.getRequest().setUrl(new IdType(theServerBase, resourceType, next.getIdElement().getIdPart(), next.getIdElement().getVersionIdPart()).getValue());
+          }
+        }
+      }
+    } else {
+      addResourcesForSearch(theResources);
+    }
 
-	}
+    myBundle.getTotalElement().setValue(theTotalResults);
+  }
 
-	@Override
-	public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType,
-			IPrimitiveType theLastUpdated) {
-		ensureBundle();
+  @Override
+  public void initializeWithBundleResource(IBaseResource theBundle) {
+    myBundle = (Bundle) theBundle;
+  }
 
-		myBase = theServerBase;
+  private IIdType populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) {
+    IIdType idElement = null;
+    if (next.getIdElement().hasBaseUrl()) {
+      idElement = next.getIdElement();
+      entry.setFullUrl(idElement.toVersionless().getValue());
+    } else {
+      if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) {
+        idElement = next.getIdElement();
+        idElement = idElement.withServerBase(myBase, myContext.getResourceDefinition(next).getName());
+        entry.setFullUrl(idElement.toVersionless().getValue());
+      }
+    }
+    return idElement;
+  }
 
-		if (myBundle.getIdElement().isEmpty()) {
-			myBundle.setId(UUID.randomUUID().toString());
-		}
-
-		if (myBundle.getMeta().getLastUpdated() == null && theLastUpdated != null) {
-			myBundle.getMeta().getLastUpdatedElement().setValueAsString(theLastUpdated.getValueAsString());
-		}
-
-		if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkSelf)) {
-			myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theLinkSelf);
-		}
-		if (!hasLink(Constants.LINK_NEXT, myBundle) && isNotBlank(theLinkNext)) {
-			myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(theLinkNext);
-		}
-		if (!hasLink(Constants.LINK_PREVIOUS, myBundle) && isNotBlank(theLinkPrev)) {
-			myBundle.addLink().setRelation(Constants.LINK_PREVIOUS).setUrl(theLinkPrev);
-		}
-
-		if (myBundle.getTypeElement().isEmpty() && theBundleType != null) {
-			myBundle.getTypeElement().setValueAsString(theBundleType.getCode());
-		}
-
-		if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) {
-			myBundle.getTotalElement().setValue(theTotalResults);
-		}
-	}
-
-	private void ensureBundle() {
-		if (myBundle == null) {
-			myBundle = new Bundle();
-		}
-	}
-
-	@Override
-	public IBaseResource getResourceBundle() {
-		return myBundle;
-	}
-
-	private boolean hasLink(String theLinkType, Bundle theBundle) {
-		for (BundleLinkComponent next : theBundle.getLink()) {
-			if (theLinkType.equals(next.getRelation())) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	@Override
-	public void initializeBundleFromResourceList(String theAuthor, List theResources, String theServerBase, String theCompleteUrl, int theTotalResults,
-			BundleTypeEnum theBundleType) {
-		myBundle = new Bundle();
-
-		myBundle.setId(UUID.randomUUID().toString());
-
-		myBundle.getMeta().setLastUpdated(new Date());
-
-		myBundle.addLink().setRelation(Constants.LINK_FHIR_BASE).setUrl(theServerBase);
-		myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theCompleteUrl);
-		myBundle.getTypeElement().setValueAsString(theBundleType.getCode());
-
-		if (theBundleType.equals(BundleTypeEnum.TRANSACTION)) {
-			for (IBaseResource nextBaseRes : theResources) {
-				Resource next = (Resource) nextBaseRes;
-				BundleEntryComponent nextEntry = myBundle.addEntry();
-
-				nextEntry.setResource(next);
-				if (next.getIdElement().isEmpty()) {
-					nextEntry.getRequest().setMethod(HTTPVerb.POST);
-				} else {
-					nextEntry.getRequest().setMethod(HTTPVerb.PUT);
-					if (next.getIdElement().isAbsolute()) {
-						nextEntry.getRequest().setUrl(next.getId());
-					} else {
-						String resourceType = myContext.getResourceDefinition(next).getName();
-						nextEntry.getRequest().setUrl(new IdType(theServerBase, resourceType, next.getIdElement().getIdPart(), next.getIdElement().getVersionIdPart()).getValue());
-					}
-				}
-			}
-		} else {
-			addResourcesForSearch(theResources);
-		}
-
-		myBundle.getTotalElement().setValue(theTotalResults);
-	}
-
-	@Override
-	public void initializeWithBundleResource(IBaseResource theBundle) {
-		myBundle = (Bundle) theBundle;
-	}
-
-	private IIdType populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) {
-		IIdType idElement = null;
-		if (next.getIdElement().hasBaseUrl()) {
-			idElement = next.getIdElement();
-			entry.setFullUrl(idElement.toVersionless().getValue());
-		} else {
-			if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) {
-				idElement = next.getIdElement();
-				idElement = idElement.withServerBase(myBase, myContext.getResourceDefinition(next).getName());
-				entry.setFullUrl(idElement.toVersionless().getValue());
-			}
-		}
-		return idElement;
-	}
-
-	@Override
-	public List toListOfResources() {
-		ArrayList retVal = new ArrayList();
-		for (BundleEntryComponent next : myBundle.getEntry()) {
-			if (next.getResource() != null) {
-				retVal.add(next.getResource());
-			} else if (next.getResponse().getLocationElement().isEmpty() == false) {
-				IdType id = new IdType(next.getResponse().getLocation());
-				String resourceType = id.getResourceType();
-				if (isNotBlank(resourceType)) {
-					IAnyResource res = (IAnyResource) myContext.getResourceDefinition(resourceType).newInstance();
-					res.setId(id);
-					retVal.add(res);
-				}
-			}
-		}
-		return retVal;
-	}
+  @Override
+  public List toListOfResources() {
+    ArrayList retVal = new ArrayList();
+    for (BundleEntryComponent next : myBundle.getEntry()) {
+      if (next.getResource() != null) {
+        retVal.add(next.getResource());
+      } else if (next.getResponse().getLocationElement().isEmpty() == false) {
+        IdType id = new IdType(next.getResponse().getLocation());
+        String resourceType = id.getResourceType();
+        if (isNotBlank(resourceType)) {
+          IAnyResource res = (IAnyResource) myContext.getResourceDefinition(resourceType).newInstance();
+          res.setId(id);
+          retVal.add(res);
+        }
+      }
+    }
+    return retVal;
+  }
 
 }
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AbstractTypes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AbstractTypes.java
new file mode 100644
index 00000000000..a3b561e00e3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AbstractTypes.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AbstractTypes {
+
+        /**
+         * A place holder that means any kind of data type
+         */
+        TYPE, 
+        /**
+         * A place holder that means any kind of resource
+         */
+        ANY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AbstractTypes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("Type".equals(codeString))
+          return TYPE;
+        if ("Any".equals(codeString))
+          return ANY;
+        throw new FHIRException("Unknown AbstractTypes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case TYPE: return "Type";
+            case ANY: return "Any";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/abstract-types";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case TYPE: return "A place holder that means any kind of data type";
+            case ANY: return "A place holder that means any kind of resource";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case TYPE: return "Type";
+            case ANY: return "Any";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AbstractTypesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AbstractTypesEnumFactory.java
new file mode 100644
index 00000000000..4c9a817fdab
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AbstractTypesEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AbstractTypesEnumFactory implements EnumFactory {
+
+  public AbstractTypes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("Type".equals(codeString))
+      return AbstractTypes.TYPE;
+    if ("Any".equals(codeString))
+      return AbstractTypes.ANY;
+    throw new IllegalArgumentException("Unknown AbstractTypes code '"+codeString+"'");
+  }
+
+  public String toCode(AbstractTypes code) {
+    if (code == AbstractTypes.TYPE)
+      return "Type";
+    if (code == AbstractTypes.ANY)
+      return "Any";
+    return "?";
+  }
+
+    public String toSystem(AbstractTypes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AccountStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AccountStatus.java
new file mode 100644
index 00000000000..0fd1b26968d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AccountStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AccountStatus {
+
+        /**
+         * This account is active and may be used.
+         */
+        ACTIVE, 
+        /**
+         * This account is inactive and should not be used to track financial information.
+         */
+        INACTIVE, 
+        /**
+         * This instance should not have been part of this patient's medical record.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AccountStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case INACTIVE: return "inactive";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/account-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            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.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case INACTIVE: return "Inactive";
+            case ENTEREDINERROR: return "Entered in error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AccountStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AccountStatusEnumFactory.java
new file mode 100644
index 00000000000..e8b81f7b3c0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AccountStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AccountStatusEnumFactory implements EnumFactory {
+
+  public AccountStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return AccountStatus.ACTIVE;
+    if ("inactive".equals(codeString))
+      return AccountStatus.INACTIVE;
+    if ("entered-in-error".equals(codeString))
+      return AccountStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown AccountStatus code '"+codeString+"'");
+  }
+
+  public String toCode(AccountStatus code) {
+    if (code == AccountStatus.ACTIVE)
+      return "active";
+    if (code == AccountStatus.INACTIVE)
+      return "inactive";
+    if (code == AccountStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(AccountStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionCardinalityBehavior.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionCardinalityBehavior.java
new file mode 100644
index 00000000000..567f4f57585
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionCardinalityBehavior.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActionCardinalityBehavior {
+
+        /**
+         * The action may only be selected one time
+         */
+        SINGLE, 
+        /**
+         * The action may be selected multiple times
+         */
+        MULTIPLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActionCardinalityBehavior fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("single".equals(codeString))
+          return SINGLE;
+        if ("multiple".equals(codeString))
+          return MULTIPLE;
+        throw new FHIRException("Unknown ActionCardinalityBehavior code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SINGLE: return "single";
+            case MULTIPLE: return "multiple";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/action-cardinality-behavior";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SINGLE: return "The action may only be selected one time";
+            case MULTIPLE: return "The action may be selected multiple times";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SINGLE: return "Single";
+            case MULTIPLE: return "Multiple";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionCardinalityBehaviorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionCardinalityBehaviorEnumFactory.java
new file mode 100644
index 00000000000..251308725b0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionCardinalityBehaviorEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionCardinalityBehaviorEnumFactory implements EnumFactory {
+
+  public ActionCardinalityBehavior fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("single".equals(codeString))
+      return ActionCardinalityBehavior.SINGLE;
+    if ("multiple".equals(codeString))
+      return ActionCardinalityBehavior.MULTIPLE;
+    throw new IllegalArgumentException("Unknown ActionCardinalityBehavior code '"+codeString+"'");
+  }
+
+  public String toCode(ActionCardinalityBehavior code) {
+    if (code == ActionCardinalityBehavior.SINGLE)
+      return "single";
+    if (code == ActionCardinalityBehavior.MULTIPLE)
+      return "multiple";
+    return "?";
+  }
+
+    public String toSystem(ActionCardinalityBehavior code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionConditionKind.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionConditionKind.java
new file mode 100644
index 00000000000..a4f1ef8523b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionConditionKind.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActionConditionKind {
+
+        /**
+         * The condition describes whether or not a given action is applicable
+         */
+        APPLICABILITY, 
+        /**
+         * The condition is a starting condition for the action
+         */
+        START, 
+        /**
+         * The condition is a stop, or exit condition for the action
+         */
+        STOP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActionConditionKind fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("applicability".equals(codeString))
+          return APPLICABILITY;
+        if ("start".equals(codeString))
+          return START;
+        if ("stop".equals(codeString))
+          return STOP;
+        throw new FHIRException("Unknown ActionConditionKind code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case APPLICABILITY: return "applicability";
+            case START: return "start";
+            case STOP: return "stop";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/action-condition-kind";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case APPLICABILITY: return "The condition describes whether or not a given action is applicable";
+            case START: return "The condition is a starting condition for the action";
+            case STOP: return "The condition is a stop, or exit condition for the action";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case APPLICABILITY: return "Applicability";
+            case START: return "Start";
+            case STOP: return "Stop";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionConditionKindEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionConditionKindEnumFactory.java
new file mode 100644
index 00000000000..e12ba1c2799
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionConditionKindEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionConditionKindEnumFactory implements EnumFactory {
+
+  public ActionConditionKind fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("applicability".equals(codeString))
+      return ActionConditionKind.APPLICABILITY;
+    if ("start".equals(codeString))
+      return ActionConditionKind.START;
+    if ("stop".equals(codeString))
+      return ActionConditionKind.STOP;
+    throw new IllegalArgumentException("Unknown ActionConditionKind code '"+codeString+"'");
+  }
+
+  public String toCode(ActionConditionKind code) {
+    if (code == ActionConditionKind.APPLICABILITY)
+      return "applicability";
+    if (code == ActionConditionKind.START)
+      return "start";
+    if (code == ActionConditionKind.STOP)
+      return "stop";
+    return "?";
+  }
+
+    public String toSystem(ActionConditionKind code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionGroupingBehavior.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionGroupingBehavior.java
new file mode 100644
index 00000000000..b0eaeeea69a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionGroupingBehavior.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActionGroupingBehavior {
+
+        /**
+         * Any group marked with this behavior should be displayed as a visual group to the end user
+         */
+        VISUALGROUP, 
+        /**
+         * A group with this behavior logically groups its sub-elements, and may be shown as a visual group to the end user, but it is not required to do so
+         */
+        LOGICALGROUP, 
+        /**
+         * A group of related alternative actions is a sentence group if the target referenced by the action is the same in all the actions and each action simply constitutes a different variation on how to specify the details for the target. For example, two actions that could be in a SentenceGroup are "aspirin, 500 mg, 2 times per day" and "aspirin, 300 mg, 3 times per day". In both cases, aspirin is the target referenced by the action, and the two actions represent different options for how aspirin might be ordered for the patient. Note that a SentenceGroup would almost always have an associated selection behavior of "AtMostOne", unless it's a required action, in which case, it would be "ExactlyOne"
+         */
+        SENTENCEGROUP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActionGroupingBehavior fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("visual-group".equals(codeString))
+          return VISUALGROUP;
+        if ("logical-group".equals(codeString))
+          return LOGICALGROUP;
+        if ("sentence-group".equals(codeString))
+          return SENTENCEGROUP;
+        throw new FHIRException("Unknown ActionGroupingBehavior code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case VISUALGROUP: return "visual-group";
+            case LOGICALGROUP: return "logical-group";
+            case SENTENCEGROUP: return "sentence-group";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/action-grouping-behavior";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case VISUALGROUP: return "Any group marked with this behavior should be displayed as a visual group to the end user";
+            case LOGICALGROUP: return "A group with this behavior logically groups its sub-elements, and may be shown as a visual group to the end user, but it is not required to do so";
+            case SENTENCEGROUP: return "A group of related alternative actions is a sentence group if the target referenced by the action is the same in all the actions and each action simply constitutes a different variation on how to specify the details for the target. For example, two actions that could be in a SentenceGroup are \"aspirin, 500 mg, 2 times per day\" and \"aspirin, 300 mg, 3 times per day\". In both cases, aspirin is the target referenced by the action, and the two actions represent different options for how aspirin might be ordered for the patient. Note that a SentenceGroup would almost always have an associated selection behavior of \"AtMostOne\", unless it's a required action, in which case, it would be \"ExactlyOne\"";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case VISUALGROUP: return "Visual Group";
+            case LOGICALGROUP: return "Logical Group";
+            case SENTENCEGROUP: return "Sentence Group";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionGroupingBehaviorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionGroupingBehaviorEnumFactory.java
new file mode 100644
index 00000000000..56601109bd5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionGroupingBehaviorEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionGroupingBehaviorEnumFactory implements EnumFactory {
+
+  public ActionGroupingBehavior fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("visual-group".equals(codeString))
+      return ActionGroupingBehavior.VISUALGROUP;
+    if ("logical-group".equals(codeString))
+      return ActionGroupingBehavior.LOGICALGROUP;
+    if ("sentence-group".equals(codeString))
+      return ActionGroupingBehavior.SENTENCEGROUP;
+    throw new IllegalArgumentException("Unknown ActionGroupingBehavior code '"+codeString+"'");
+  }
+
+  public String toCode(ActionGroupingBehavior code) {
+    if (code == ActionGroupingBehavior.VISUALGROUP)
+      return "visual-group";
+    if (code == ActionGroupingBehavior.LOGICALGROUP)
+      return "logical-group";
+    if (code == ActionGroupingBehavior.SENTENCEGROUP)
+      return "sentence-group";
+    return "?";
+  }
+
+    public String toSystem(ActionGroupingBehavior code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionParticipantType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionParticipantType.java
new file mode 100644
index 00000000000..3baadbfa33a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionParticipantType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActionParticipantType {
+
+        /**
+         * The participant is the patient under evaluation
+         */
+        PATIENT, 
+        /**
+         * The participant is a practitioner involved in the patient's care
+         */
+        PRACTITIONER, 
+        /**
+         * The participant is a person related to the patient
+         */
+        RELATEDPERSON, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActionParticipantType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("patient".equals(codeString))
+          return PATIENT;
+        if ("practitioner".equals(codeString))
+          return PRACTITIONER;
+        if ("related-person".equals(codeString))
+          return RELATEDPERSON;
+        throw new FHIRException("Unknown ActionParticipantType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PATIENT: return "patient";
+            case PRACTITIONER: return "practitioner";
+            case RELATEDPERSON: return "related-person";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/action-participant-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PATIENT: return "The participant is the patient under evaluation";
+            case PRACTITIONER: return "The participant is a practitioner involved in the patient's care";
+            case RELATEDPERSON: return "The participant is a person related to the patient";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PATIENT: return "Patient";
+            case PRACTITIONER: return "Practitioner";
+            case RELATEDPERSON: return "Related Person";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionParticipantTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionParticipantTypeEnumFactory.java
new file mode 100644
index 00000000000..3f9efbab8e4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionParticipantTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionParticipantTypeEnumFactory implements EnumFactory {
+
+  public ActionParticipantType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("patient".equals(codeString))
+      return ActionParticipantType.PATIENT;
+    if ("practitioner".equals(codeString))
+      return ActionParticipantType.PRACTITIONER;
+    if ("related-person".equals(codeString))
+      return ActionParticipantType.RELATEDPERSON;
+    throw new IllegalArgumentException("Unknown ActionParticipantType code '"+codeString+"'");
+  }
+
+  public String toCode(ActionParticipantType code) {
+    if (code == ActionParticipantType.PATIENT)
+      return "patient";
+    if (code == ActionParticipantType.PRACTITIONER)
+      return "practitioner";
+    if (code == ActionParticipantType.RELATEDPERSON)
+      return "related-person";
+    return "?";
+  }
+
+    public String toSystem(ActionParticipantType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionPrecheckBehavior.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionPrecheckBehavior.java
new file mode 100644
index 00000000000..e6c05169e25
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionPrecheckBehavior.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActionPrecheckBehavior {
+
+        /**
+         * An action with this behavior is one of the most frequent action that is, or should be, included by an end user, for the particular context in which the action occurs. The system displaying the action to the end user should consider "pre-checking" such an action as a convenience for the user
+         */
+        YES, 
+        /**
+         * An action with this behavior is one of the less frequent actions included by the end user, for the particular context in which the action occurs. The system displaying the actions to the end user would typically not "pre-check" such an action
+         */
+        NO, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActionPrecheckBehavior fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("yes".equals(codeString))
+          return YES;
+        if ("no".equals(codeString))
+          return NO;
+        throw new FHIRException("Unknown ActionPrecheckBehavior code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case YES: return "yes";
+            case NO: return "no";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/action-precheck-behavior";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case YES: return "An action with this behavior is one of the most frequent action that is, or should be, included by an end user, for the particular context in which the action occurs. The system displaying the action to the end user should consider \"pre-checking\" such an action as a convenience for the user";
+            case NO: return "An action with this behavior is one of the less frequent actions included by the end user, for the particular context in which the action occurs. The system displaying the actions to the end user would typically not \"pre-check\" such an action";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case YES: return "Yes";
+            case NO: return "No";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionPrecheckBehaviorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionPrecheckBehaviorEnumFactory.java
new file mode 100644
index 00000000000..b79ed8083d9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionPrecheckBehaviorEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionPrecheckBehaviorEnumFactory implements EnumFactory {
+
+  public ActionPrecheckBehavior fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("yes".equals(codeString))
+      return ActionPrecheckBehavior.YES;
+    if ("no".equals(codeString))
+      return ActionPrecheckBehavior.NO;
+    throw new IllegalArgumentException("Unknown ActionPrecheckBehavior code '"+codeString+"'");
+  }
+
+  public String toCode(ActionPrecheckBehavior code) {
+    if (code == ActionPrecheckBehavior.YES)
+      return "yes";
+    if (code == ActionPrecheckBehavior.NO)
+      return "no";
+    return "?";
+  }
+
+    public String toSystem(ActionPrecheckBehavior code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRelationshipType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRelationshipType.java
new file mode 100644
index 00000000000..be949b3780f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRelationshipType.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActionRelationshipType {
+
+        /**
+         * The action must be performed before the start of the related action
+         */
+        BEFORESTART, 
+        /**
+         * The action must be performed before the related action
+         */
+        BEFORE, 
+        /**
+         * The action must be performed before the end of the related action
+         */
+        BEFOREEND, 
+        /**
+         * The action must be performed concurrent with the start of the related action
+         */
+        CONCURRENTWITHSTART, 
+        /**
+         * The action must be performed concurrent with the related action
+         */
+        CONCURRENT, 
+        /**
+         * The action must be performed concurrent with the end of the related action
+         */
+        CONCURRENTWITHEND, 
+        /**
+         * The action must be performed after the start of the related action
+         */
+        AFTERSTART, 
+        /**
+         * The action must be performed after the related action
+         */
+        AFTER, 
+        /**
+         * The action must be performed after the end of the related action
+         */
+        AFTEREND, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActionRelationshipType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("before-start".equals(codeString))
+          return BEFORESTART;
+        if ("before".equals(codeString))
+          return BEFORE;
+        if ("before-end".equals(codeString))
+          return BEFOREEND;
+        if ("concurrent-with-start".equals(codeString))
+          return CONCURRENTWITHSTART;
+        if ("concurrent".equals(codeString))
+          return CONCURRENT;
+        if ("concurrent-with-end".equals(codeString))
+          return CONCURRENTWITHEND;
+        if ("after-start".equals(codeString))
+          return AFTERSTART;
+        if ("after".equals(codeString))
+          return AFTER;
+        if ("after-end".equals(codeString))
+          return AFTEREND;
+        throw new FHIRException("Unknown ActionRelationshipType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BEFORESTART: return "before-start";
+            case BEFORE: return "before";
+            case BEFOREEND: return "before-end";
+            case CONCURRENTWITHSTART: return "concurrent-with-start";
+            case CONCURRENT: return "concurrent";
+            case CONCURRENTWITHEND: return "concurrent-with-end";
+            case AFTERSTART: return "after-start";
+            case AFTER: return "after";
+            case AFTEREND: return "after-end";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/action-relationship-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BEFORESTART: return "The action must be performed before the start of the related action";
+            case BEFORE: return "The action must be performed before the related action";
+            case BEFOREEND: return "The action must be performed before the end of the related action";
+            case CONCURRENTWITHSTART: return "The action must be performed concurrent with the start of the related action";
+            case CONCURRENT: return "The action must be performed concurrent with the related action";
+            case CONCURRENTWITHEND: return "The action must be performed concurrent with the end of the related action";
+            case AFTERSTART: return "The action must be performed after the start of the related action";
+            case AFTER: return "The action must be performed after the related action";
+            case AFTEREND: return "The action must be performed after the end of the related action";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BEFORESTART: return "Before Start";
+            case BEFORE: return "Before";
+            case BEFOREEND: return "Before End";
+            case CONCURRENTWITHSTART: return "Concurrent With Start";
+            case CONCURRENT: return "Concurrent";
+            case CONCURRENTWITHEND: return "Concurrent With End";
+            case AFTERSTART: return "After Start";
+            case AFTER: return "After";
+            case AFTEREND: return "After End";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRelationshipTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRelationshipTypeEnumFactory.java
new file mode 100644
index 00000000000..d5eed81b843
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRelationshipTypeEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionRelationshipTypeEnumFactory implements EnumFactory {
+
+  public ActionRelationshipType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("before-start".equals(codeString))
+      return ActionRelationshipType.BEFORESTART;
+    if ("before".equals(codeString))
+      return ActionRelationshipType.BEFORE;
+    if ("before-end".equals(codeString))
+      return ActionRelationshipType.BEFOREEND;
+    if ("concurrent-with-start".equals(codeString))
+      return ActionRelationshipType.CONCURRENTWITHSTART;
+    if ("concurrent".equals(codeString))
+      return ActionRelationshipType.CONCURRENT;
+    if ("concurrent-with-end".equals(codeString))
+      return ActionRelationshipType.CONCURRENTWITHEND;
+    if ("after-start".equals(codeString))
+      return ActionRelationshipType.AFTERSTART;
+    if ("after".equals(codeString))
+      return ActionRelationshipType.AFTER;
+    if ("after-end".equals(codeString))
+      return ActionRelationshipType.AFTEREND;
+    throw new IllegalArgumentException("Unknown ActionRelationshipType code '"+codeString+"'");
+  }
+
+  public String toCode(ActionRelationshipType code) {
+    if (code == ActionRelationshipType.BEFORESTART)
+      return "before-start";
+    if (code == ActionRelationshipType.BEFORE)
+      return "before";
+    if (code == ActionRelationshipType.BEFOREEND)
+      return "before-end";
+    if (code == ActionRelationshipType.CONCURRENTWITHSTART)
+      return "concurrent-with-start";
+    if (code == ActionRelationshipType.CONCURRENT)
+      return "concurrent";
+    if (code == ActionRelationshipType.CONCURRENTWITHEND)
+      return "concurrent-with-end";
+    if (code == ActionRelationshipType.AFTERSTART)
+      return "after-start";
+    if (code == ActionRelationshipType.AFTER)
+      return "after";
+    if (code == ActionRelationshipType.AFTEREND)
+      return "after-end";
+    return "?";
+  }
+
+    public String toSystem(ActionRelationshipType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRequiredBehavior.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRequiredBehavior.java
new file mode 100644
index 00000000000..ebe4c456267
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRequiredBehavior.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActionRequiredBehavior {
+
+        /**
+         * An action with this behavior must be included in the actions processed by the end user; the end user may not choose not to include this action
+         */
+        MUST, 
+        /**
+         * An action with this behavior may be included in the set of actions processed by the end user
+         */
+        COULD, 
+        /**
+         * An action with this behavior must be included in the set of actions processed by the end user, unless the end user provides documentation as to why the action was not included
+         */
+        MUSTUNLESSDOCUMENTED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActionRequiredBehavior fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("must".equals(codeString))
+          return MUST;
+        if ("could".equals(codeString))
+          return COULD;
+        if ("must-unless-documented".equals(codeString))
+          return MUSTUNLESSDOCUMENTED;
+        throw new FHIRException("Unknown ActionRequiredBehavior code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MUST: return "must";
+            case COULD: return "could";
+            case MUSTUNLESSDOCUMENTED: return "must-unless-documented";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/action-required-behavior";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MUST: return "An action with this behavior must be included in the actions processed by the end user; the end user may not choose not to include this action";
+            case COULD: return "An action with this behavior may be included in the set of actions processed by the end user";
+            case MUSTUNLESSDOCUMENTED: return "An action with this behavior must be included in the set of actions processed by the end user, unless the end user provides documentation as to why the action was not included";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MUST: return "Must";
+            case COULD: return "Could";
+            case MUSTUNLESSDOCUMENTED: return "Must Unless Documented";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRequiredBehaviorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRequiredBehaviorEnumFactory.java
new file mode 100644
index 00000000000..ada3f99df57
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionRequiredBehaviorEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionRequiredBehaviorEnumFactory implements EnumFactory {
+
+  public ActionRequiredBehavior fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("must".equals(codeString))
+      return ActionRequiredBehavior.MUST;
+    if ("could".equals(codeString))
+      return ActionRequiredBehavior.COULD;
+    if ("must-unless-documented".equals(codeString))
+      return ActionRequiredBehavior.MUSTUNLESSDOCUMENTED;
+    throw new IllegalArgumentException("Unknown ActionRequiredBehavior code '"+codeString+"'");
+  }
+
+  public String toCode(ActionRequiredBehavior code) {
+    if (code == ActionRequiredBehavior.MUST)
+      return "must";
+    if (code == ActionRequiredBehavior.COULD)
+      return "could";
+    if (code == ActionRequiredBehavior.MUSTUNLESSDOCUMENTED)
+      return "must-unless-documented";
+    return "?";
+  }
+
+    public String toSystem(ActionRequiredBehavior code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionSelectionBehavior.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionSelectionBehavior.java
new file mode 100644
index 00000000000..eae4afe6040
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionSelectionBehavior.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActionSelectionBehavior {
+
+        /**
+         * Any number of the actions in the group may be chosen, from zero to all
+         */
+        ANY, 
+        /**
+         * All the actions in the group must be selected as a single unit
+         */
+        ALL, 
+        /**
+         * All the actions in the group are meant to be chosen as a single unit: either all must be selected by the end user, or none may be selected
+         */
+        ALLORNONE, 
+        /**
+         * The end user must choose one and only one of the selectable actions in the group. The user may not choose none of the actions in the group
+         */
+        EXACTLYONE, 
+        /**
+         * The end user may choose zero or at most one of the actions in the group
+         */
+        ATMOSTONE, 
+        /**
+         * The end user must choose a minimum of one, and as many additional as desired
+         */
+        ONEORMORE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActionSelectionBehavior fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("any".equals(codeString))
+          return ANY;
+        if ("all".equals(codeString))
+          return ALL;
+        if ("all-or-none".equals(codeString))
+          return ALLORNONE;
+        if ("exactly-one".equals(codeString))
+          return EXACTLYONE;
+        if ("at-most-one".equals(codeString))
+          return ATMOSTONE;
+        if ("one-or-more".equals(codeString))
+          return ONEORMORE;
+        throw new FHIRException("Unknown ActionSelectionBehavior code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ANY: return "any";
+            case ALL: return "all";
+            case ALLORNONE: return "all-or-none";
+            case EXACTLYONE: return "exactly-one";
+            case ATMOSTONE: return "at-most-one";
+            case ONEORMORE: return "one-or-more";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/action-selection-behavior";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ANY: return "Any number of the actions in the group may be chosen, from zero to all";
+            case ALL: return "All the actions in the group must be selected as a single unit";
+            case ALLORNONE: return "All the actions in the group are meant to be chosen as a single unit: either all must be selected by the end user, or none may be selected";
+            case EXACTLYONE: return "The end user must choose one and only one of the selectable actions in the group. The user may not choose none of the actions in the group";
+            case ATMOSTONE: return "The end user may choose zero or at most one of the actions in the group";
+            case ONEORMORE: return "The end user must choose a minimum of one, and as many additional as desired";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ANY: return "Any";
+            case ALL: return "All";
+            case ALLORNONE: return "All Or None";
+            case EXACTLYONE: return "Exactly One";
+            case ATMOSTONE: return "At Most One";
+            case ONEORMORE: return "One Or More";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionSelectionBehaviorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionSelectionBehaviorEnumFactory.java
new file mode 100644
index 00000000000..0d8d5632e4f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionSelectionBehaviorEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionSelectionBehaviorEnumFactory implements EnumFactory {
+
+  public ActionSelectionBehavior fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("any".equals(codeString))
+      return ActionSelectionBehavior.ANY;
+    if ("all".equals(codeString))
+      return ActionSelectionBehavior.ALL;
+    if ("all-or-none".equals(codeString))
+      return ActionSelectionBehavior.ALLORNONE;
+    if ("exactly-one".equals(codeString))
+      return ActionSelectionBehavior.EXACTLYONE;
+    if ("at-most-one".equals(codeString))
+      return ActionSelectionBehavior.ATMOSTONE;
+    if ("one-or-more".equals(codeString))
+      return ActionSelectionBehavior.ONEORMORE;
+    throw new IllegalArgumentException("Unknown ActionSelectionBehavior code '"+codeString+"'");
+  }
+
+  public String toCode(ActionSelectionBehavior code) {
+    if (code == ActionSelectionBehavior.ANY)
+      return "any";
+    if (code == ActionSelectionBehavior.ALL)
+      return "all";
+    if (code == ActionSelectionBehavior.ALLORNONE)
+      return "all-or-none";
+    if (code == ActionSelectionBehavior.EXACTLYONE)
+      return "exactly-one";
+    if (code == ActionSelectionBehavior.ATMOSTONE)
+      return "at-most-one";
+    if (code == ActionSelectionBehavior.ONEORMORE)
+      return "one-or-more";
+    return "?";
+  }
+
+    public String toSystem(ActionSelectionBehavior code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionType.java
new file mode 100644
index 00000000000..87de2a770d0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActionType {
+
+        /**
+         * The action is to create a new resource
+         */
+        CREATE, 
+        /**
+         * The action is to update an existing resource
+         */
+        UPDATE, 
+        /**
+         * The action is to remove an existing resource
+         */
+        REMOVE, 
+        /**
+         * The action is to fire a specific event
+         */
+        FIREEVENT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActionType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("create".equals(codeString))
+          return CREATE;
+        if ("update".equals(codeString))
+          return UPDATE;
+        if ("remove".equals(codeString))
+          return REMOVE;
+        if ("fire-event".equals(codeString))
+          return FIREEVENT;
+        throw new FHIRException("Unknown ActionType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CREATE: return "create";
+            case UPDATE: return "update";
+            case REMOVE: return "remove";
+            case FIREEVENT: return "fire-event";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/action-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CREATE: return "The action is to create a new resource";
+            case UPDATE: return "The action is to update an existing resource";
+            case REMOVE: return "The action is to remove an existing resource";
+            case FIREEVENT: return "The action is to fire a specific event";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CREATE: return "Create";
+            case UPDATE: return "Update";
+            case REMOVE: return "Remove";
+            case FIREEVENT: return "Fire Event";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionTypeEnumFactory.java
new file mode 100644
index 00000000000..e3c3af4aa1d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionTypeEnumFactory implements EnumFactory {
+
+  public ActionType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("create".equals(codeString))
+      return ActionType.CREATE;
+    if ("update".equals(codeString))
+      return ActionType.UPDATE;
+    if ("remove".equals(codeString))
+      return ActionType.REMOVE;
+    if ("fire-event".equals(codeString))
+      return ActionType.FIREEVENT;
+    throw new IllegalArgumentException("Unknown ActionType code '"+codeString+"'");
+  }
+
+  public String toCode(ActionType code) {
+    if (code == ActionType.CREATE)
+      return "create";
+    if (code == ActionType.UPDATE)
+      return "update";
+    if (code == ActionType.REMOVE)
+      return "remove";
+    if (code == ActionType.FIREEVENT)
+      return "fire-event";
+    return "?";
+  }
+
+    public String toSystem(ActionType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Actionlist.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Actionlist.java
new file mode 100644
index 00000000000..1dd4355e268
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Actionlist.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Actionlist {
+
+        /**
+         * Cancel, reverse or nullify the target resource.
+         */
+        CANCEL, 
+        /**
+         * Check for previously un-read/ not-retrieved resources.
+         */
+        POLL, 
+        /**
+         * Re-process the target resource.
+         */
+        REPROCESS, 
+        /**
+         * Retrieve the processing status of the target resource.
+         */
+        STATUS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Actionlist fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("cancel".equals(codeString))
+          return CANCEL;
+        if ("poll".equals(codeString))
+          return POLL;
+        if ("reprocess".equals(codeString))
+          return REPROCESS;
+        if ("status".equals(codeString))
+          return STATUS;
+        throw new FHIRException("Unknown Actionlist code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CANCEL: return "cancel";
+            case POLL: return "poll";
+            case REPROCESS: return "reprocess";
+            case STATUS: return "status";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/actionlist";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CANCEL: return "Cancel, reverse or nullify the target resource.";
+            case POLL: return "Check for previously un-read/ not-retrieved resources.";
+            case REPROCESS: return "Re-process the target resource.";
+            case STATUS: return "Retrieve the processing status of the target resource.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CANCEL: return "Cancel, Reverse or Nullify";
+            case POLL: return "Poll";
+            case REPROCESS: return "Re-Process";
+            case STATUS: return "Status Check";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionlistEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionlistEnumFactory.java
new file mode 100644
index 00000000000..2e16f8333f6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActionlistEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActionlistEnumFactory implements EnumFactory {
+
+  public Actionlist fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("cancel".equals(codeString))
+      return Actionlist.CANCEL;
+    if ("poll".equals(codeString))
+      return Actionlist.POLL;
+    if ("reprocess".equals(codeString))
+      return Actionlist.REPROCESS;
+    if ("status".equals(codeString))
+      return Actionlist.STATUS;
+    throw new IllegalArgumentException("Unknown Actionlist code '"+codeString+"'");
+  }
+
+  public String toCode(Actionlist code) {
+    if (code == Actionlist.CANCEL)
+      return "cancel";
+    if (code == Actionlist.POLL)
+      return "poll";
+    if (code == Actionlist.REPROCESS)
+      return "reprocess";
+    if (code == Actionlist.STATUS)
+      return "status";
+    return "?";
+  }
+
+    public String toSystem(Actionlist code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActivityDefinitionCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActivityDefinitionCategory.java
new file mode 100644
index 00000000000..f440901334f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActivityDefinitionCategory.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ActivityDefinitionCategory {
+
+        /**
+         * The activity is intended to provide or is related to treatment of the patient
+         */
+        TREATMENT, 
+        /**
+         * The activity is intended to provide or is related to education of the patient
+         */
+        EDUCATION, 
+        /**
+         * The activity is intended to perform or is related to assessment of the patient
+         */
+        ASSESSMENT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ActivityDefinitionCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("treatment".equals(codeString))
+          return TREATMENT;
+        if ("education".equals(codeString))
+          return EDUCATION;
+        if ("assessment".equals(codeString))
+          return ASSESSMENT;
+        throw new FHIRException("Unknown ActivityDefinitionCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case TREATMENT: return "treatment";
+            case EDUCATION: return "education";
+            case ASSESSMENT: return "assessment";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/activity-definition-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case TREATMENT: return "The activity is intended to provide or is related to treatment of the patient";
+            case EDUCATION: return "The activity is intended to provide or is related to education of the patient";
+            case ASSESSMENT: return "The activity is intended to perform or is related to assessment of the patient";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case TREATMENT: return "Treatment";
+            case EDUCATION: return "Education";
+            case ASSESSMENT: return "Assessment";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActivityDefinitionCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActivityDefinitionCategoryEnumFactory.java
new file mode 100644
index 00000000000..e83937bcf36
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ActivityDefinitionCategoryEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ActivityDefinitionCategoryEnumFactory implements EnumFactory {
+
+  public ActivityDefinitionCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("treatment".equals(codeString))
+      return ActivityDefinitionCategory.TREATMENT;
+    if ("education".equals(codeString))
+      return ActivityDefinitionCategory.EDUCATION;
+    if ("assessment".equals(codeString))
+      return ActivityDefinitionCategory.ASSESSMENT;
+    throw new IllegalArgumentException("Unknown ActivityDefinitionCategory code '"+codeString+"'");
+  }
+
+  public String toCode(ActivityDefinitionCategory code) {
+    if (code == ActivityDefinitionCategory.TREATMENT)
+      return "treatment";
+    if (code == ActivityDefinitionCategory.EDUCATION)
+      return "education";
+    if (code == ActivityDefinitionCategory.ASSESSMENT)
+      return "assessment";
+    return "?";
+  }
+
+    public String toSystem(ActivityDefinitionCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Additionalmaterials.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Additionalmaterials.java
new file mode 100644
index 00000000000..d4317aa5271
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Additionalmaterials.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Additionalmaterials {
+
+        /**
+         * XRay
+         */
+        XRAY, 
+        /**
+         * Image
+         */
+        IMAGE, 
+        /**
+         * Email
+         */
+        EMAIL, 
+        /**
+         * Model
+         */
+        MODEL, 
+        /**
+         * Document
+         */
+        DOCUMENT, 
+        /**
+         * Other
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Additionalmaterials fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("xray".equals(codeString))
+          return XRAY;
+        if ("image".equals(codeString))
+          return IMAGE;
+        if ("email".equals(codeString))
+          return EMAIL;
+        if ("model".equals(codeString))
+          return MODEL;
+        if ("document".equals(codeString))
+          return DOCUMENT;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown Additionalmaterials code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case XRAY: return "xray";
+            case IMAGE: return "image";
+            case EMAIL: return "email";
+            case MODEL: return "model";
+            case DOCUMENT: return "document";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/additionalmaterials";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case XRAY: return "XRay";
+            case IMAGE: return "Image";
+            case EMAIL: return "Email";
+            case MODEL: return "Model";
+            case DOCUMENT: return "Document";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case XRAY: return "XRay";
+            case IMAGE: return "Image";
+            case EMAIL: return "Email";
+            case MODEL: return "Model";
+            case DOCUMENT: return "Document";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdditionalmaterialsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdditionalmaterialsEnumFactory.java
new file mode 100644
index 00000000000..263bebfeffe
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdditionalmaterialsEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdditionalmaterialsEnumFactory implements EnumFactory {
+
+  public Additionalmaterials fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("xray".equals(codeString))
+      return Additionalmaterials.XRAY;
+    if ("image".equals(codeString))
+      return Additionalmaterials.IMAGE;
+    if ("email".equals(codeString))
+      return Additionalmaterials.EMAIL;
+    if ("model".equals(codeString))
+      return Additionalmaterials.MODEL;
+    if ("document".equals(codeString))
+      return Additionalmaterials.DOCUMENT;
+    if ("other".equals(codeString))
+      return Additionalmaterials.OTHER;
+    throw new IllegalArgumentException("Unknown Additionalmaterials code '"+codeString+"'");
+  }
+
+  public String toCode(Additionalmaterials code) {
+    if (code == Additionalmaterials.XRAY)
+      return "xray";
+    if (code == Additionalmaterials.IMAGE)
+      return "image";
+    if (code == Additionalmaterials.EMAIL)
+      return "email";
+    if (code == Additionalmaterials.MODEL)
+      return "model";
+    if (code == Additionalmaterials.DOCUMENT)
+      return "document";
+    if (code == Additionalmaterials.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(Additionalmaterials code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressType.java
new file mode 100644
index 00000000000..f51ee12082e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AddressType {
+
+        /**
+         * Mailing addresses - PO Boxes and care-of addresses.
+         */
+        POSTAL, 
+        /**
+         * A physical address that can be visited.
+         */
+        PHYSICAL, 
+        /**
+         * An address that is both physical and postal.
+         */
+        BOTH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AddressType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("postal".equals(codeString))
+          return POSTAL;
+        if ("physical".equals(codeString))
+          return PHYSICAL;
+        if ("both".equals(codeString))
+          return BOTH;
+        throw new FHIRException("Unknown AddressType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case POSTAL: return "postal";
+            case PHYSICAL: return "physical";
+            case BOTH: return "both";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/address-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case POSTAL: return "Mailing addresses - PO Boxes and care-of addresses.";
+            case PHYSICAL: return "A physical address that can be visited.";
+            case BOTH: return "An address that is both physical and postal.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case POSTAL: return "Postal";
+            case PHYSICAL: return "Physical";
+            case BOTH: return "Postal & Physical";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressTypeEnumFactory.java
new file mode 100644
index 00000000000..a5a74c2ce2d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AddressTypeEnumFactory implements EnumFactory {
+
+  public AddressType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("postal".equals(codeString))
+      return AddressType.POSTAL;
+    if ("physical".equals(codeString))
+      return AddressType.PHYSICAL;
+    if ("both".equals(codeString))
+      return AddressType.BOTH;
+    throw new IllegalArgumentException("Unknown AddressType code '"+codeString+"'");
+  }
+
+  public String toCode(AddressType code) {
+    if (code == AddressType.POSTAL)
+      return "postal";
+    if (code == AddressType.PHYSICAL)
+      return "physical";
+    if (code == AddressType.BOTH)
+      return "both";
+    return "?";
+  }
+
+    public String toSystem(AddressType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressUse.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressUse.java
new file mode 100644
index 00000000000..f10f8e59b4c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressUse.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AddressUse {
+
+        /**
+         * A communication address at a home.
+         */
+        HOME, 
+        /**
+         * An office address. First choice for business related contacts during business hours.
+         */
+        WORK, 
+        /**
+         * A temporary address. The period can provide more detailed information.
+         */
+        TEMP, 
+        /**
+         * This address is no longer in use (or was never correct, but retained for records).
+         */
+        OLD, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AddressUse fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("home".equals(codeString))
+          return HOME;
+        if ("work".equals(codeString))
+          return WORK;
+        if ("temp".equals(codeString))
+          return TEMP;
+        if ("old".equals(codeString))
+          return OLD;
+        throw new FHIRException("Unknown AddressUse code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HOME: return "home";
+            case WORK: return "work";
+            case TEMP: return "temp";
+            case OLD: return "old";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/address-use";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HOME: return "A communication address at a home.";
+            case WORK: return "An office address. First choice for business related contacts during business hours.";
+            case TEMP: return "A temporary address. The period can provide more detailed information.";
+            case OLD: return "This address is no longer in use (or was never correct, but retained for records).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HOME: return "Home";
+            case WORK: return "Work";
+            case TEMP: return "Temporary";
+            case OLD: return "Old / Incorrect";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressUseEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressUseEnumFactory.java
new file mode 100644
index 00000000000..612e5ef8963
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AddressUseEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AddressUseEnumFactory implements EnumFactory {
+
+  public AddressUse fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("home".equals(codeString))
+      return AddressUse.HOME;
+    if ("work".equals(codeString))
+      return AddressUse.WORK;
+    if ("temp".equals(codeString))
+      return AddressUse.TEMP;
+    if ("old".equals(codeString))
+      return AddressUse.OLD;
+    throw new IllegalArgumentException("Unknown AddressUse code '"+codeString+"'");
+  }
+
+  public String toCode(AddressUse code) {
+    if (code == AddressUse.HOME)
+      return "home";
+    if (code == AddressUse.WORK)
+      return "work";
+    if (code == AddressUse.TEMP)
+      return "temp";
+    if (code == AddressUse.OLD)
+      return "old";
+    return "?";
+  }
+
+    public String toSystem(AddressUse code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Adjudication.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Adjudication.java
new file mode 100644
index 00000000000..884ae826dba
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Adjudication.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Adjudication {
+
+        /**
+         * Total submitted
+         */
+        TOTAL, 
+        /**
+         * Patient Co-Payment
+         */
+        COPAY, 
+        /**
+         * Amount of the change which is considered for adjudication
+         */
+        ELIGIBLE, 
+        /**
+         * Amount deducted from the eligible amount prior to adjudication
+         */
+        DEDUCTIBLE, 
+        /**
+         * Eligible Percentage
+         */
+        ELIGPERCENT, 
+        /**
+         * Emergency Department
+         */
+        TAX, 
+        /**
+         * Amount payable under the coverage
+         */
+        BENEFIT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Adjudication fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("total".equals(codeString))
+          return TOTAL;
+        if ("copay".equals(codeString))
+          return COPAY;
+        if ("eligible".equals(codeString))
+          return ELIGIBLE;
+        if ("deductible".equals(codeString))
+          return DEDUCTIBLE;
+        if ("eligpercent".equals(codeString))
+          return ELIGPERCENT;
+        if ("tax".equals(codeString))
+          return TAX;
+        if ("benefit".equals(codeString))
+          return BENEFIT;
+        throw new FHIRException("Unknown Adjudication code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case TOTAL: return "total";
+            case COPAY: return "copay";
+            case ELIGIBLE: return "eligible";
+            case DEDUCTIBLE: return "deductible";
+            case ELIGPERCENT: return "eligpercent";
+            case TAX: return "tax";
+            case BENEFIT: return "benefit";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adjudication";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case TOTAL: return "Total submitted";
+            case COPAY: return "Patient Co-Payment";
+            case ELIGIBLE: return "Amount of the change which is considered for adjudication";
+            case DEDUCTIBLE: return "Amount deducted from the eligible amount prior to adjudication";
+            case ELIGPERCENT: return "Eligible Percentage";
+            case TAX: return "Emergency Department";
+            case BENEFIT: return "Amount payable under the coverage";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case TOTAL: return "Total";
+            case COPAY: return "CoPay";
+            case ELIGIBLE: return "Eligible Amount";
+            case DEDUCTIBLE: return "Deductable";
+            case ELIGPERCENT: return "Eligible %";
+            case TAX: return "Emergency Department";
+            case BENEFIT: return "Benefit Amount";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationEnumFactory.java
new file mode 100644
index 00000000000..90cd98c954d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdjudicationEnumFactory implements EnumFactory {
+
+  public Adjudication fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("total".equals(codeString))
+      return Adjudication.TOTAL;
+    if ("copay".equals(codeString))
+      return Adjudication.COPAY;
+    if ("eligible".equals(codeString))
+      return Adjudication.ELIGIBLE;
+    if ("deductible".equals(codeString))
+      return Adjudication.DEDUCTIBLE;
+    if ("eligpercent".equals(codeString))
+      return Adjudication.ELIGPERCENT;
+    if ("tax".equals(codeString))
+      return Adjudication.TAX;
+    if ("benefit".equals(codeString))
+      return Adjudication.BENEFIT;
+    throw new IllegalArgumentException("Unknown Adjudication code '"+codeString+"'");
+  }
+
+  public String toCode(Adjudication code) {
+    if (code == Adjudication.TOTAL)
+      return "total";
+    if (code == Adjudication.COPAY)
+      return "copay";
+    if (code == Adjudication.ELIGIBLE)
+      return "eligible";
+    if (code == Adjudication.DEDUCTIBLE)
+      return "deductible";
+    if (code == Adjudication.ELIGPERCENT)
+      return "eligpercent";
+    if (code == Adjudication.TAX)
+      return "tax";
+    if (code == Adjudication.BENEFIT)
+      return "benefit";
+    return "?";
+  }
+
+    public String toSystem(Adjudication code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationError.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationError.java
new file mode 100644
index 00000000000..44f64ce2239
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationError.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdjudicationError {
+
+        /**
+         * Missing Identifier
+         */
+        A001, 
+        /**
+         * Missing Creation Date
+         */
+        A002, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdjudicationError fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("a001".equals(codeString))
+          return A001;
+        if ("a002".equals(codeString))
+          return A002;
+        throw new FHIRException("Unknown AdjudicationError code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A001: return "a001";
+            case A002: return "a002";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adjudication-error";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A001: return "Missing Identifier";
+            case A002: return "Missing Creation Date";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A001: return "Missing Identifier";
+            case A002: return "Missing Creation Date";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationErrorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationErrorEnumFactory.java
new file mode 100644
index 00000000000..334ac254d38
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationErrorEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdjudicationErrorEnumFactory implements EnumFactory {
+
+  public AdjudicationError fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("a001".equals(codeString))
+      return AdjudicationError.A001;
+    if ("a002".equals(codeString))
+      return AdjudicationError.A002;
+    throw new IllegalArgumentException("Unknown AdjudicationError code '"+codeString+"'");
+  }
+
+  public String toCode(AdjudicationError code) {
+    if (code == AdjudicationError.A001)
+      return "a001";
+    if (code == AdjudicationError.A002)
+      return "a002";
+    return "?";
+  }
+
+    public String toSystem(AdjudicationError code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationReason.java
new file mode 100644
index 00000000000..bc47e7eb6f5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationReason.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdjudicationReason {
+
+        /**
+         * Not covered
+         */
+        AR001, 
+        /**
+         * Plan Limit Reached
+         */
+        AR002, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdjudicationReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ar001".equals(codeString))
+          return AR001;
+        if ("ar002".equals(codeString))
+          return AR002;
+        throw new FHIRException("Unknown AdjudicationReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AR001: return "ar001";
+            case AR002: return "ar002";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adjudication-reason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AR001: return "Not covered";
+            case AR002: return "Plan Limit Reached";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AR001: return "Not covered";
+            case AR002: return "Plan Limit Reached";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationReasonEnumFactory.java
new file mode 100644
index 00000000000..f6c2bf78314
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdjudicationReasonEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdjudicationReasonEnumFactory implements EnumFactory {
+
+  public AdjudicationReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ar001".equals(codeString))
+      return AdjudicationReason.AR001;
+    if ("ar002".equals(codeString))
+      return AdjudicationReason.AR002;
+    throw new IllegalArgumentException("Unknown AdjudicationReason code '"+codeString+"'");
+  }
+
+  public String toCode(AdjudicationReason code) {
+    if (code == AdjudicationReason.AR001)
+      return "ar001";
+    if (code == AdjudicationReason.AR002)
+      return "ar002";
+    return "?";
+  }
+
+    public String toSystem(AdjudicationReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdministrativeGender.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdministrativeGender.java
new file mode 100644
index 00000000000..f5b7067afb6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdministrativeGender.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdministrativeGender {
+
+        /**
+         * Male
+         */
+        MALE, 
+        /**
+         * Female
+         */
+        FEMALE, 
+        /**
+         * Other
+         */
+        OTHER, 
+        /**
+         * Unknown
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdministrativeGender fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("male".equals(codeString))
+          return MALE;
+        if ("female".equals(codeString))
+          return FEMALE;
+        if ("other".equals(codeString))
+          return OTHER;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown AdministrativeGender code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MALE: return "male";
+            case FEMALE: return "female";
+            case OTHER: return "other";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/administrative-gender";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MALE: return "Male";
+            case FEMALE: return "Female";
+            case OTHER: return "Other";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MALE: return "Male";
+            case FEMALE: return "Female";
+            case OTHER: return "Other";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdministrativeGenderEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdministrativeGenderEnumFactory.java
new file mode 100644
index 00000000000..18e28754066
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdministrativeGenderEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdministrativeGenderEnumFactory implements EnumFactory {
+
+  public AdministrativeGender fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("male".equals(codeString))
+      return AdministrativeGender.MALE;
+    if ("female".equals(codeString))
+      return AdministrativeGender.FEMALE;
+    if ("other".equals(codeString))
+      return AdministrativeGender.OTHER;
+    if ("unknown".equals(codeString))
+      return AdministrativeGender.UNKNOWN;
+    throw new IllegalArgumentException("Unknown AdministrativeGender code '"+codeString+"'");
+  }
+
+  public String toCode(AdministrativeGender code) {
+    if (code == AdministrativeGender.MALE)
+      return "male";
+    if (code == AdministrativeGender.FEMALE)
+      return "female";
+    if (code == AdministrativeGender.OTHER)
+      return "other";
+    if (code == AdministrativeGender.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(AdministrativeGender code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCategory.java
new file mode 100644
index 00000000000..666299b5f27
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCategory.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdverseEventCategory {
+
+        /**
+         * null
+         */
+        AE, 
+        /**
+         * null
+         */
+        PAE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdverseEventCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AE".equals(codeString))
+          return AE;
+        if ("PAE".equals(codeString))
+          return PAE;
+        throw new FHIRException("Unknown AdverseEventCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AE: return "AE";
+            case PAE: return "PAE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adverse-event-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AE: return "";
+            case PAE: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AE: return "Adverse Event";
+            case PAE: return "Potential Adverse Event";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCategoryEnumFactory.java
new file mode 100644
index 00000000000..9aef5fefe0d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCategoryEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdverseEventCategoryEnumFactory implements EnumFactory {
+
+  public AdverseEventCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AE".equals(codeString))
+      return AdverseEventCategory.AE;
+    if ("PAE".equals(codeString))
+      return AdverseEventCategory.PAE;
+    throw new IllegalArgumentException("Unknown AdverseEventCategory code '"+codeString+"'");
+  }
+
+  public String toCode(AdverseEventCategory code) {
+    if (code == AdverseEventCategory.AE)
+      return "AE";
+    if (code == AdverseEventCategory.PAE)
+      return "PAE";
+    return "?";
+  }
+
+    public String toSystem(AdverseEventCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausality.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausality.java
new file mode 100644
index 00000000000..8d9b9a0d2ae
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausality.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdverseEventCausality {
+
+        /**
+         * null
+         */
+        CAUSALITY1, 
+        /**
+         * null
+         */
+        CAUSALITY2, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdverseEventCausality fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("causality1".equals(codeString))
+          return CAUSALITY1;
+        if ("causality2".equals(codeString))
+          return CAUSALITY2;
+        throw new FHIRException("Unknown AdverseEventCausality code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CAUSALITY1: return "causality1";
+            case CAUSALITY2: return "causality2";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adverse-event-causality";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CAUSALITY1: return "";
+            case CAUSALITY2: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CAUSALITY1: return "causality1 placeholder";
+            case CAUSALITY2: return "causality2 placeholder";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityAssess.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityAssess.java
new file mode 100644
index 00000000000..0831085caa6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityAssess.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdverseEventCausalityAssess {
+
+        /**
+         * null
+         */
+        ASSESS1, 
+        /**
+         * null
+         */
+        ASSESS2, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdverseEventCausalityAssess fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("assess1".equals(codeString))
+          return ASSESS1;
+        if ("assess2".equals(codeString))
+          return ASSESS2;
+        throw new FHIRException("Unknown AdverseEventCausalityAssess code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ASSESS1: return "assess1";
+            case ASSESS2: return "assess2";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adverse-event-causality-assess";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ASSESS1: return "";
+            case ASSESS2: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ASSESS1: return "assess1 placeholder";
+            case ASSESS2: return "assess2 placeholder";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityAssessEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityAssessEnumFactory.java
new file mode 100644
index 00000000000..26c38dbec8f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityAssessEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdverseEventCausalityAssessEnumFactory implements EnumFactory {
+
+  public AdverseEventCausalityAssess fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("assess1".equals(codeString))
+      return AdverseEventCausalityAssess.ASSESS1;
+    if ("assess2".equals(codeString))
+      return AdverseEventCausalityAssess.ASSESS2;
+    throw new IllegalArgumentException("Unknown AdverseEventCausalityAssess code '"+codeString+"'");
+  }
+
+  public String toCode(AdverseEventCausalityAssess code) {
+    if (code == AdverseEventCausalityAssess.ASSESS1)
+      return "assess1";
+    if (code == AdverseEventCausalityAssess.ASSESS2)
+      return "assess2";
+    return "?";
+  }
+
+    public String toSystem(AdverseEventCausalityAssess code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityEnumFactory.java
new file mode 100644
index 00000000000..c826dda471d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdverseEventCausalityEnumFactory implements EnumFactory {
+
+  public AdverseEventCausality fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("causality1".equals(codeString))
+      return AdverseEventCausality.CAUSALITY1;
+    if ("causality2".equals(codeString))
+      return AdverseEventCausality.CAUSALITY2;
+    throw new IllegalArgumentException("Unknown AdverseEventCausality code '"+codeString+"'");
+  }
+
+  public String toCode(AdverseEventCausality code) {
+    if (code == AdverseEventCausality.CAUSALITY1)
+      return "causality1";
+    if (code == AdverseEventCausality.CAUSALITY2)
+      return "causality2";
+    return "?";
+  }
+
+    public String toSystem(AdverseEventCausality code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityMethod.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityMethod.java
new file mode 100644
index 00000000000..463e673d4b6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityMethod.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdverseEventCausalityMethod {
+
+        /**
+         * null
+         */
+        METHOD1, 
+        /**
+         * null
+         */
+        METHOD2, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdverseEventCausalityMethod fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("method1".equals(codeString))
+          return METHOD1;
+        if ("method2".equals(codeString))
+          return METHOD2;
+        throw new FHIRException("Unknown AdverseEventCausalityMethod code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case METHOD1: return "method1";
+            case METHOD2: return "method2";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adverse-event-causality-method";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case METHOD1: return "";
+            case METHOD2: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case METHOD1: return "placeholder";
+            case METHOD2: return "placeholder";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityMethodEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityMethodEnumFactory.java
new file mode 100644
index 00000000000..8fedc8b77b5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityMethodEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdverseEventCausalityMethodEnumFactory implements EnumFactory {
+
+  public AdverseEventCausalityMethod fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("method1".equals(codeString))
+      return AdverseEventCausalityMethod.METHOD1;
+    if ("method2".equals(codeString))
+      return AdverseEventCausalityMethod.METHOD2;
+    throw new IllegalArgumentException("Unknown AdverseEventCausalityMethod code '"+codeString+"'");
+  }
+
+  public String toCode(AdverseEventCausalityMethod code) {
+    if (code == AdverseEventCausalityMethod.METHOD1)
+      return "method1";
+    if (code == AdverseEventCausalityMethod.METHOD2)
+      return "method2";
+    return "?";
+  }
+
+    public String toSystem(AdverseEventCausalityMethod code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityResult.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityResult.java
new file mode 100644
index 00000000000..88173bd3305
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityResult.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdverseEventCausalityResult {
+
+        /**
+         * null
+         */
+        RESULT1, 
+        /**
+         * null
+         */
+        RESULT2, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdverseEventCausalityResult fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("result1".equals(codeString))
+          return RESULT1;
+        if ("result2".equals(codeString))
+          return RESULT2;
+        throw new FHIRException("Unknown AdverseEventCausalityResult code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case RESULT1: return "result1";
+            case RESULT2: return "result2";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adverse-event-causality-result";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case RESULT1: return "";
+            case RESULT2: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case RESULT1: return "placeholder";
+            case RESULT2: return "placeholder";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityResultEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityResultEnumFactory.java
new file mode 100644
index 00000000000..7850352abf5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventCausalityResultEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdverseEventCausalityResultEnumFactory implements EnumFactory {
+
+  public AdverseEventCausalityResult fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("result1".equals(codeString))
+      return AdverseEventCausalityResult.RESULT1;
+    if ("result2".equals(codeString))
+      return AdverseEventCausalityResult.RESULT2;
+    throw new IllegalArgumentException("Unknown AdverseEventCausalityResult code '"+codeString+"'");
+  }
+
+  public String toCode(AdverseEventCausalityResult code) {
+    if (code == AdverseEventCausalityResult.RESULT1)
+      return "result1";
+    if (code == AdverseEventCausalityResult.RESULT2)
+      return "result2";
+    return "?";
+  }
+
+    public String toSystem(AdverseEventCausalityResult code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventOutcome.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventOutcome.java
new file mode 100644
index 00000000000..b1dccd706b6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventOutcome.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdverseEventOutcome {
+
+        /**
+         * null
+         */
+        RESOLVED, 
+        /**
+         * null
+         */
+        RECOVERING, 
+        /**
+         * null
+         */
+        ONGOING, 
+        /**
+         * null
+         */
+        RESOLVEDWITHSEQUELAE, 
+        /**
+         * null
+         */
+        FATAL, 
+        /**
+         * null
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdverseEventOutcome fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("resolved".equals(codeString))
+          return RESOLVED;
+        if ("recovering".equals(codeString))
+          return RECOVERING;
+        if ("ongoing".equals(codeString))
+          return ONGOING;
+        if ("resolvedWithSequelae".equals(codeString))
+          return RESOLVEDWITHSEQUELAE;
+        if ("fatal".equals(codeString))
+          return FATAL;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown AdverseEventOutcome code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case RESOLVED: return "resolved";
+            case RECOVERING: return "recovering";
+            case ONGOING: return "ongoing";
+            case RESOLVEDWITHSEQUELAE: return "resolvedWithSequelae";
+            case FATAL: return "fatal";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adverse-event-outcome";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case RESOLVED: return "";
+            case RECOVERING: return "";
+            case ONGOING: return "";
+            case RESOLVEDWITHSEQUELAE: return "";
+            case FATAL: return "";
+            case UNKNOWN: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case RESOLVED: return "Resolved";
+            case RECOVERING: return "Recovering";
+            case ONGOING: return "Ongoing";
+            case RESOLVEDWITHSEQUELAE: return "Resolved with Sequelae";
+            case FATAL: return "Fatal";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventOutcomeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventOutcomeEnumFactory.java
new file mode 100644
index 00000000000..7da763ac389
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventOutcomeEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdverseEventOutcomeEnumFactory implements EnumFactory {
+
+  public AdverseEventOutcome fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("resolved".equals(codeString))
+      return AdverseEventOutcome.RESOLVED;
+    if ("recovering".equals(codeString))
+      return AdverseEventOutcome.RECOVERING;
+    if ("ongoing".equals(codeString))
+      return AdverseEventOutcome.ONGOING;
+    if ("resolvedWithSequelae".equals(codeString))
+      return AdverseEventOutcome.RESOLVEDWITHSEQUELAE;
+    if ("fatal".equals(codeString))
+      return AdverseEventOutcome.FATAL;
+    if ("unknown".equals(codeString))
+      return AdverseEventOutcome.UNKNOWN;
+    throw new IllegalArgumentException("Unknown AdverseEventOutcome code '"+codeString+"'");
+  }
+
+  public String toCode(AdverseEventOutcome code) {
+    if (code == AdverseEventOutcome.RESOLVED)
+      return "resolved";
+    if (code == AdverseEventOutcome.RECOVERING)
+      return "recovering";
+    if (code == AdverseEventOutcome.ONGOING)
+      return "ongoing";
+    if (code == AdverseEventOutcome.RESOLVEDWITHSEQUELAE)
+      return "resolvedWithSequelae";
+    if (code == AdverseEventOutcome.FATAL)
+      return "fatal";
+    if (code == AdverseEventOutcome.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(AdverseEventOutcome code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventSeriousness.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventSeriousness.java
new file mode 100644
index 00000000000..10fd3de9a82
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventSeriousness.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AdverseEventSeriousness {
+
+        /**
+         * null
+         */
+        MILD, 
+        /**
+         * null
+         */
+        MODERATE, 
+        /**
+         * null
+         */
+        SEVERE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AdverseEventSeriousness fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("Mild".equals(codeString))
+          return MILD;
+        if ("Moderate".equals(codeString))
+          return MODERATE;
+        if ("Severe".equals(codeString))
+          return SEVERE;
+        throw new FHIRException("Unknown AdverseEventSeriousness code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MILD: return "Mild";
+            case MODERATE: return "Moderate";
+            case SEVERE: return "Severe";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/adverse-event-seriousness";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MILD: return "";
+            case MODERATE: return "";
+            case SEVERE: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MILD: return "Mild";
+            case MODERATE: return "Moderate";
+            case SEVERE: return "Severe";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventSeriousnessEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventSeriousnessEnumFactory.java
new file mode 100644
index 00000000000..c22cafb348f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AdverseEventSeriousnessEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AdverseEventSeriousnessEnumFactory implements EnumFactory {
+
+  public AdverseEventSeriousness fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("Mild".equals(codeString))
+      return AdverseEventSeriousness.MILD;
+    if ("Moderate".equals(codeString))
+      return AdverseEventSeriousness.MODERATE;
+    if ("Severe".equals(codeString))
+      return AdverseEventSeriousness.SEVERE;
+    throw new IllegalArgumentException("Unknown AdverseEventSeriousness code '"+codeString+"'");
+  }
+
+  public String toCode(AdverseEventSeriousness code) {
+    if (code == AdverseEventSeriousness.MILD)
+      return "Mild";
+    if (code == AdverseEventSeriousness.MODERATE)
+      return "Moderate";
+    if (code == AdverseEventSeriousness.SEVERE)
+      return "Severe";
+    return "?";
+  }
+
+    public String toSystem(AdverseEventSeriousness code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergIntolSubstanceExpRisk.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergIntolSubstanceExpRisk.java
new file mode 100644
index 00000000000..4d3a70092b1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergIntolSubstanceExpRisk.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AllergIntolSubstanceExpRisk {
+
+        /**
+         * Known risk of allergy or intolerance reaction upon exposure to the specified substance.
+         */
+        KNOWNREACTIONRISK, 
+        /**
+         * No known risk of allergy or intolerance reaction upon exposure to the specified substance.
+         */
+        NOKNOWNREACTIONRISK, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AllergIntolSubstanceExpRisk fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("known-reaction-risk".equals(codeString))
+          return KNOWNREACTIONRISK;
+        if ("no-known-reaction-risk".equals(codeString))
+          return NOKNOWNREACTIONRISK;
+        throw new FHIRException("Unknown AllergIntolSubstanceExpRisk code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case KNOWNREACTIONRISK: return "known-reaction-risk";
+            case NOKNOWNREACTIONRISK: return "no-known-reaction-risk";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/allerg-intol-substance-exp-risk";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case KNOWNREACTIONRISK: return "Known risk of allergy or intolerance reaction upon exposure to the specified substance.";
+            case NOKNOWNREACTIONRISK: return "No known risk of allergy or intolerance reaction upon exposure to the specified substance.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case KNOWNREACTIONRISK: return "Known Reaction Risk";
+            case NOKNOWNREACTIONRISK: return "No Known Reaction Risk";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergIntolSubstanceExpRiskEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergIntolSubstanceExpRiskEnumFactory.java
new file mode 100644
index 00000000000..4401df0f326
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergIntolSubstanceExpRiskEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AllergIntolSubstanceExpRiskEnumFactory implements EnumFactory {
+
+  public AllergIntolSubstanceExpRisk fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("known-reaction-risk".equals(codeString))
+      return AllergIntolSubstanceExpRisk.KNOWNREACTIONRISK;
+    if ("no-known-reaction-risk".equals(codeString))
+      return AllergIntolSubstanceExpRisk.NOKNOWNREACTIONRISK;
+    throw new IllegalArgumentException("Unknown AllergIntolSubstanceExpRisk code '"+codeString+"'");
+  }
+
+  public String toCode(AllergIntolSubstanceExpRisk code) {
+    if (code == AllergIntolSubstanceExpRisk.KNOWNREACTIONRISK)
+      return "known-reaction-risk";
+    if (code == AllergIntolSubstanceExpRisk.NOKNOWNREACTIONRISK)
+      return "no-known-reaction-risk";
+    return "?";
+  }
+
+    public String toSystem(AllergIntolSubstanceExpRisk code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyClinicalStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyClinicalStatus.java
new file mode 100644
index 00000000000..536eadd9eb5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyClinicalStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AllergyClinicalStatus {
+
+        /**
+         * An active record of a risk of a reaction to the identified substance.
+         */
+        ACTIVE, 
+        /**
+         * An inactivated record of a risk of a reaction to the identified substance.
+         */
+        INACTIVE, 
+        /**
+         * A reaction to the identified substance has been clinically reassessed by testing or re-exposure and considered to be resolved.
+         */
+        RESOLVED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AllergyClinicalStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("resolved".equals(codeString))
+          return RESOLVED;
+        throw new FHIRException("Unknown AllergyClinicalStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case INACTIVE: return "inactive";
+            case RESOLVED: return "resolved";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/allergy-clinical-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "An active record of a risk of a reaction to the identified substance.";
+            case INACTIVE: return "An inactivated record of a risk of a reaction to the identified substance.";
+            case RESOLVED: return "A reaction to the identified substance has been clinically reassessed by testing or re-exposure and considered to be resolved.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case INACTIVE: return "Inactive";
+            case RESOLVED: return "Resolved";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyClinicalStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyClinicalStatusEnumFactory.java
new file mode 100644
index 00000000000..a9f27997109
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyClinicalStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AllergyClinicalStatusEnumFactory implements EnumFactory {
+
+  public AllergyClinicalStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return AllergyClinicalStatus.ACTIVE;
+    if ("inactive".equals(codeString))
+      return AllergyClinicalStatus.INACTIVE;
+    if ("resolved".equals(codeString))
+      return AllergyClinicalStatus.RESOLVED;
+    throw new IllegalArgumentException("Unknown AllergyClinicalStatus code '"+codeString+"'");
+  }
+
+  public String toCode(AllergyClinicalStatus code) {
+    if (code == AllergyClinicalStatus.ACTIVE)
+      return "active";
+    if (code == AllergyClinicalStatus.INACTIVE)
+      return "inactive";
+    if (code == AllergyClinicalStatus.RESOLVED)
+      return "resolved";
+    return "?";
+  }
+
+    public String toSystem(AllergyClinicalStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCategory.java
new file mode 100644
index 00000000000..c8141c57f80
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCategory.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AllergyIntoleranceCategory {
+
+        /**
+         * Any substance consumed to provide nutritional support for the body.
+         */
+        FOOD, 
+        /**
+         * Substances administered to achieve a physiological effect.
+         */
+        MEDICATION, 
+        /**
+         * Any substances that are encountered in the environment, including any substance not already classified as food, medication, or biologic.
+         */
+        ENVIRONMENT, 
+        /**
+         * A preparation that is synthesized from living organisms or their products, especially a human or animal protein, such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment (for example, allergy shots); gene therapies; cellular therapies.  There are other biologic products, such as tissues, that are not typically associated with allergies.
+         */
+        BIOLOGIC, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AllergyIntoleranceCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("food".equals(codeString))
+          return FOOD;
+        if ("medication".equals(codeString))
+          return MEDICATION;
+        if ("environment".equals(codeString))
+          return ENVIRONMENT;
+        if ("biologic".equals(codeString))
+          return BIOLOGIC;
+        throw new FHIRException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FOOD: return "food";
+            case MEDICATION: return "medication";
+            case ENVIRONMENT: return "environment";
+            case BIOLOGIC: return "biologic";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/allergy-intolerance-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FOOD: return "Any substance consumed to provide nutritional support for the body.";
+            case MEDICATION: return "Substances administered to achieve a physiological effect.";
+            case ENVIRONMENT: return "Any substances that are encountered in the environment, including any substance not already classified as food, medication, or biologic.";
+            case BIOLOGIC: return "A preparation that is synthesized from living organisms or their products, especially a human or animal protein, such as a hormone or antitoxin, that is used as a diagnostic, preventive, or therapeutic agent. Examples of biologic medications include: vaccines; allergenic extracts, which are used for both diagnosis and treatment (for example, allergy shots); gene therapies; cellular therapies.  There are other biologic products, such as tissues, that are not typically associated with allergies.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FOOD: return "Food";
+            case MEDICATION: return "Medication";
+            case ENVIRONMENT: return "Environment";
+            case BIOLOGIC: return "Biologic";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCategoryEnumFactory.java
new file mode 100644
index 00000000000..176a35ffe7d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCategoryEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AllergyIntoleranceCategoryEnumFactory implements EnumFactory {
+
+  public AllergyIntoleranceCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("food".equals(codeString))
+      return AllergyIntoleranceCategory.FOOD;
+    if ("medication".equals(codeString))
+      return AllergyIntoleranceCategory.MEDICATION;
+    if ("environment".equals(codeString))
+      return AllergyIntoleranceCategory.ENVIRONMENT;
+    if ("biologic".equals(codeString))
+      return AllergyIntoleranceCategory.BIOLOGIC;
+    throw new IllegalArgumentException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
+  }
+
+  public String toCode(AllergyIntoleranceCategory code) {
+    if (code == AllergyIntoleranceCategory.FOOD)
+      return "food";
+    if (code == AllergyIntoleranceCategory.MEDICATION)
+      return "medication";
+    if (code == AllergyIntoleranceCategory.ENVIRONMENT)
+      return "environment";
+    if (code == AllergyIntoleranceCategory.BIOLOGIC)
+      return "biologic";
+    return "?";
+  }
+
+    public String toSystem(AllergyIntoleranceCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCriticality.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCriticality.java
new file mode 100644
index 00000000000..9cbf7fbe2e3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCriticality.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AllergyIntoleranceCriticality {
+
+        /**
+         * Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.
+         */
+        LOW, 
+        /**
+         * Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.
+         */
+        HIGH, 
+        /**
+         * Unable to assess the worst case result of a future exposure.
+         */
+        UNABLETOASSESS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AllergyIntoleranceCriticality fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("low".equals(codeString))
+          return LOW;
+        if ("high".equals(codeString))
+          return HIGH;
+        if ("unable-to-assess".equals(codeString))
+          return UNABLETOASSESS;
+        throw new FHIRException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LOW: return "low";
+            case HIGH: return "high";
+            case UNABLETOASSESS: return "unable-to-assess";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/allergy-intolerance-criticality";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LOW: return "Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.";
+            case HIGH: return "Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.";
+            case UNABLETOASSESS: return "Unable to assess the worst case result of a future exposure.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LOW: return "Low Risk";
+            case HIGH: return "High Risk";
+            case UNABLETOASSESS: return "Unable to Assess Risk";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCriticalityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCriticalityEnumFactory.java
new file mode 100644
index 00000000000..597bebce23d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceCriticalityEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AllergyIntoleranceCriticalityEnumFactory implements EnumFactory {
+
+  public AllergyIntoleranceCriticality fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("low".equals(codeString))
+      return AllergyIntoleranceCriticality.LOW;
+    if ("high".equals(codeString))
+      return AllergyIntoleranceCriticality.HIGH;
+    if ("unable-to-assess".equals(codeString))
+      return AllergyIntoleranceCriticality.UNABLETOASSESS;
+    throw new IllegalArgumentException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
+  }
+
+  public String toCode(AllergyIntoleranceCriticality code) {
+    if (code == AllergyIntoleranceCriticality.LOW)
+      return "low";
+    if (code == AllergyIntoleranceCriticality.HIGH)
+      return "high";
+    if (code == AllergyIntoleranceCriticality.UNABLETOASSESS)
+      return "unable-to-assess";
+    return "?";
+  }
+
+    public String toSystem(AllergyIntoleranceCriticality code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceStatus.java
new file mode 100644
index 00000000000..7e2247316e5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AllergyIntoleranceStatus {
+
+        /**
+         * An active record of a risk of a reaction to the identified substance.
+         */
+        ACTIVE, 
+        /**
+         * A high level of certainty about the propensity for a reaction to the identified substance, which may include clinical evidence by testing or rechallenge.
+         */
+        ACTIVECONFIRMED, 
+        /**
+         * An inactivated record of a risk of a reaction to the identified substance
+         */
+        INACTIVE, 
+        /**
+         * A reaction to the identified substance has been clinically reassessed by testing or re-exposure and considered to be resolved
+         */
+        RESOLVED, 
+        /**
+         * A propensity for a reaction to the identified substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.
+         */
+        REFUTED, 
+        /**
+         * The statement was entered in error and is not valid.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AllergyIntoleranceStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("active-confirmed".equals(codeString))
+          return ACTIVECONFIRMED;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("resolved".equals(codeString))
+          return RESOLVED;
+        if ("refuted".equals(codeString))
+          return REFUTED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case ACTIVECONFIRMED: return "active-confirmed";
+            case INACTIVE: return "inactive";
+            case RESOLVED: return "resolved";
+            case REFUTED: return "refuted";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/allergy-intolerance-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "An active record of a risk of a reaction to the identified substance.";
+            case ACTIVECONFIRMED: return "A high level of certainty about the propensity for a reaction to the identified substance, which may include clinical evidence by testing or rechallenge.";
+            case INACTIVE: return "An inactivated record of a risk of a reaction to the identified substance";
+            case RESOLVED: return "A reaction to the identified substance has been clinically reassessed by testing or re-exposure and considered to be resolved";
+            case REFUTED: return "A propensity for a reaction to the identified substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.";
+            case ENTEREDINERROR: return "The statement was entered in error and is not valid.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case ACTIVECONFIRMED: return "Active Confirmed";
+            case INACTIVE: return "Inactive";
+            case RESOLVED: return "Resolved";
+            case REFUTED: return "Refuted";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceStatusEnumFactory.java
new file mode 100644
index 00000000000..5ae3f71a548
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AllergyIntoleranceStatusEnumFactory implements EnumFactory {
+
+  public AllergyIntoleranceStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return AllergyIntoleranceStatus.ACTIVE;
+    if ("active-confirmed".equals(codeString))
+      return AllergyIntoleranceStatus.ACTIVECONFIRMED;
+    if ("inactive".equals(codeString))
+      return AllergyIntoleranceStatus.INACTIVE;
+    if ("resolved".equals(codeString))
+      return AllergyIntoleranceStatus.RESOLVED;
+    if ("refuted".equals(codeString))
+      return AllergyIntoleranceStatus.REFUTED;
+    if ("entered-in-error".equals(codeString))
+      return AllergyIntoleranceStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
+  }
+
+  public String toCode(AllergyIntoleranceStatus code) {
+    if (code == AllergyIntoleranceStatus.ACTIVE)
+      return "active";
+    if (code == AllergyIntoleranceStatus.ACTIVECONFIRMED)
+      return "active-confirmed";
+    if (code == AllergyIntoleranceStatus.INACTIVE)
+      return "inactive";
+    if (code == AllergyIntoleranceStatus.RESOLVED)
+      return "resolved";
+    if (code == AllergyIntoleranceStatus.REFUTED)
+      return "refuted";
+    if (code == AllergyIntoleranceStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(AllergyIntoleranceStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceType.java
new file mode 100644
index 00000000000..89fe056a17c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AllergyIntoleranceType {
+
+        /**
+         * A propensity for hypersensitivity reaction(s) to a substance.  These reactions are most typically type I hypersensitivity, plus other "allergy-like" reactions, including pseudoallergy.
+         */
+        ALLERGY, 
+        /**
+         * A propensity for adverse reactions to a substance that is not judged to be allergic or "allergy-like".  These reactions are typically (but not necessarily) non-immune.  They are to some degree idiosyncratic and/or individually specific (i.e. are not a reaction that is expected to occur with most or all patients given similar circumstances).
+         */
+        INTOLERANCE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AllergyIntoleranceType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("allergy".equals(codeString))
+          return ALLERGY;
+        if ("intolerance".equals(codeString))
+          return INTOLERANCE;
+        throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ALLERGY: return "allergy";
+            case INTOLERANCE: return "intolerance";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/allergy-intolerance-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ALLERGY: return "A propensity for hypersensitivity reaction(s) to a substance.  These reactions are most typically type I hypersensitivity, plus other \"allergy-like\" reactions, including pseudoallergy.";
+            case INTOLERANCE: return "A propensity for adverse reactions to a substance that is not judged to be allergic or \"allergy-like\".  These reactions are typically (but not necessarily) non-immune.  They are to some degree idiosyncratic and/or individually specific (i.e. are not a reaction that is expected to occur with most or all patients given similar circumstances).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ALLERGY: return "Allergy";
+            case INTOLERANCE: return "Intolerance";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceTypeEnumFactory.java
new file mode 100644
index 00000000000..604e7dbcaf5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyIntoleranceTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AllergyIntoleranceTypeEnumFactory implements EnumFactory {
+
+  public AllergyIntoleranceType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("allergy".equals(codeString))
+      return AllergyIntoleranceType.ALLERGY;
+    if ("intolerance".equals(codeString))
+      return AllergyIntoleranceType.INTOLERANCE;
+    throw new IllegalArgumentException("Unknown AllergyIntoleranceType code '"+codeString+"'");
+  }
+
+  public String toCode(AllergyIntoleranceType code) {
+    if (code == AllergyIntoleranceType.ALLERGY)
+      return "allergy";
+    if (code == AllergyIntoleranceType.INTOLERANCE)
+      return "intolerance";
+    return "?";
+  }
+
+    public String toSystem(AllergyIntoleranceType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyVerificationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyVerificationStatus.java
new file mode 100644
index 00000000000..d3f71f17b65
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyVerificationStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AllergyVerificationStatus {
+
+        /**
+         * A low level of certainty about the propensity for a reaction to the identified substance.
+         */
+        UNCONFIRMED, 
+        /**
+         * A high level of certainty about the propensity for a reaction to the identified substance, which may include clinical evidence by testing or rechallenge.
+         */
+        CONFIRMED, 
+        /**
+         * A propensity for a reaction to the identified substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.
+         */
+        REFUTED, 
+        /**
+         * The statement was entered in error and is not valid.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AllergyVerificationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("unconfirmed".equals(codeString))
+          return UNCONFIRMED;
+        if ("confirmed".equals(codeString))
+          return CONFIRMED;
+        if ("refuted".equals(codeString))
+          return REFUTED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown AllergyVerificationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UNCONFIRMED: return "unconfirmed";
+            case CONFIRMED: return "confirmed";
+            case REFUTED: return "refuted";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/allergy-verification-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UNCONFIRMED: return "A low level of certainty about the propensity for a reaction to the identified substance.";
+            case CONFIRMED: return "A high level of certainty about the propensity for a reaction to the identified substance, which may include clinical evidence by testing or rechallenge.";
+            case REFUTED: return "A propensity for a reaction to the identified substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.";
+            case ENTEREDINERROR: return "The statement was entered in error and is not valid.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UNCONFIRMED: return "Unconfirmed";
+            case CONFIRMED: return "Confirmed";
+            case REFUTED: return "Refuted";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyVerificationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyVerificationStatusEnumFactory.java
new file mode 100644
index 00000000000..0aaf7777505
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AllergyVerificationStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AllergyVerificationStatusEnumFactory implements EnumFactory {
+
+  public AllergyVerificationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("unconfirmed".equals(codeString))
+      return AllergyVerificationStatus.UNCONFIRMED;
+    if ("confirmed".equals(codeString))
+      return AllergyVerificationStatus.CONFIRMED;
+    if ("refuted".equals(codeString))
+      return AllergyVerificationStatus.REFUTED;
+    if ("entered-in-error".equals(codeString))
+      return AllergyVerificationStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown AllergyVerificationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(AllergyVerificationStatus code) {
+    if (code == AllergyVerificationStatus.UNCONFIRMED)
+      return "unconfirmed";
+    if (code == AllergyVerificationStatus.CONFIRMED)
+      return "confirmed";
+    if (code == AllergyVerificationStatus.REFUTED)
+      return "refuted";
+    if (code == AllergyVerificationStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(AllergyVerificationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalGenderstatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalGenderstatus.java
new file mode 100644
index 00000000000..3e11ee304de
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalGenderstatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AnimalGenderstatus {
+
+        /**
+         * The animal has been sterilized, castrated or otherwise made infertile.
+         */
+        NEUTERED, 
+        /**
+         * The animal's reproductive organs are intact.
+         */
+        INTACT, 
+        /**
+         * Unable to determine whether the animal has been neutered.
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AnimalGenderstatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("neutered".equals(codeString))
+          return NEUTERED;
+        if ("intact".equals(codeString))
+          return INTACT;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown AnimalGenderstatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NEUTERED: return "neutered";
+            case INTACT: return "intact";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/animal-genderstatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NEUTERED: return "The animal has been sterilized, castrated or otherwise made infertile.";
+            case INTACT: return "The animal's reproductive organs are intact.";
+            case UNKNOWN: return "Unable to determine whether the animal has been neutered.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NEUTERED: return "Neutered";
+            case INTACT: return "Intact";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalGenderstatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalGenderstatusEnumFactory.java
new file mode 100644
index 00000000000..298dacaafb1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalGenderstatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AnimalGenderstatusEnumFactory implements EnumFactory {
+
+  public AnimalGenderstatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("neutered".equals(codeString))
+      return AnimalGenderstatus.NEUTERED;
+    if ("intact".equals(codeString))
+      return AnimalGenderstatus.INTACT;
+    if ("unknown".equals(codeString))
+      return AnimalGenderstatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown AnimalGenderstatus code '"+codeString+"'");
+  }
+
+  public String toCode(AnimalGenderstatus code) {
+    if (code == AnimalGenderstatus.NEUTERED)
+      return "neutered";
+    if (code == AnimalGenderstatus.INTACT)
+      return "intact";
+    if (code == AnimalGenderstatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(AnimalGenderstatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalSpecies.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalSpecies.java
new file mode 100644
index 00000000000..139a3929b99
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalSpecies.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AnimalSpecies {
+
+        /**
+         * Canis lupus familiaris
+         */
+        CANISLF, 
+        /**
+         * Ovis aries
+         */
+        OVISA, 
+        /**
+         * Serinus canaria domestica
+         */
+        SERINUSCD, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AnimalSpecies fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("canislf".equals(codeString))
+          return CANISLF;
+        if ("ovisa".equals(codeString))
+          return OVISA;
+        if ("serinuscd".equals(codeString))
+          return SERINUSCD;
+        throw new FHIRException("Unknown AnimalSpecies code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CANISLF: return "canislf";
+            case OVISA: return "ovisa";
+            case SERINUSCD: return "serinuscd";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/animal-species";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CANISLF: return "Canis lupus familiaris";
+            case OVISA: return "Ovis aries";
+            case SERINUSCD: return "Serinus canaria domestica";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CANISLF: return "Dog";
+            case OVISA: return "Sheep";
+            case SERINUSCD: return "Domestic Canary";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalSpeciesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalSpeciesEnumFactory.java
new file mode 100644
index 00000000000..4604504b6d3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnimalSpeciesEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AnimalSpeciesEnumFactory implements EnumFactory {
+
+  public AnimalSpecies fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("canislf".equals(codeString))
+      return AnimalSpecies.CANISLF;
+    if ("ovisa".equals(codeString))
+      return AnimalSpecies.OVISA;
+    if ("serinuscd".equals(codeString))
+      return AnimalSpecies.SERINUSCD;
+    throw new IllegalArgumentException("Unknown AnimalSpecies code '"+codeString+"'");
+  }
+
+  public String toCode(AnimalSpecies code) {
+    if (code == AnimalSpecies.CANISLF)
+      return "canislf";
+    if (code == AnimalSpecies.OVISA)
+      return "ovisa";
+    if (code == AnimalSpecies.SERINUSCD)
+      return "serinuscd";
+    return "?";
+  }
+
+    public String toSystem(AnimalSpecies code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnzscoOccupations.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnzscoOccupations.java
new file mode 100644
index 00000000000..9c07df5a6a3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnzscoOccupations.java
@@ -0,0 +1,12003 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AnzscoOccupations {
+
+        /**
+         * Managers not further defined
+         */
+        _100000, 
+        /**
+         * Chief Executives, General Managers and Legislators not further defined
+         */
+        _111000, 
+        /**
+         * Chief Executive or Managing Director
+         */
+        _111111, 
+        /**
+         * General Managers not further defined
+         */
+        _111200, 
+        /**
+         * Corporate General Manager
+         */
+        _111211, 
+        /**
+         * Defence Force Senior Officer
+         */
+        _111212, 
+        /**
+         * Legislators not further defined
+         */
+        _111300, 
+        /**
+         * Local Government Legislator
+         */
+        _111311, 
+        /**
+         * Member of Parliament
+         */
+        _111312, 
+        /**
+         * Legislators not elsewhere classified
+         */
+        _111399, 
+        /**
+         * Farmers and Farm Managers not further defined
+         */
+        _121000, 
+        /**
+         * Aquaculture Farmer
+         */
+        _121111, 
+        /**
+         * Crop Farmers not further defined
+         */
+        _121200, 
+        /**
+         * Cotton Grower
+         */
+        _121211, 
+        /**
+         * Flower Grower
+         */
+        _121212, 
+        /**
+         * Fruit or Nut Grower
+         */
+        _121213, 
+        /**
+         * Grain, Oilseed or Pasture Grower
+         */
+        _121214, 
+        /**
+         * Grape Grower
+         */
+        _121215, 
+        /**
+         * Mixed Crop Farmer
+         */
+        _121216, 
+        /**
+         * Sugar Cane Grower
+         */
+        _121217, 
+        /**
+         * Turf Grower
+         */
+        _121218, 
+        /**
+         * Vegetable Grower
+         */
+        _121221, 
+        /**
+         * Crop Farmers not elsewhere classified
+         */
+        _121299, 
+        /**
+         * Livestock Farmers not further defined
+         */
+        _121300, 
+        /**
+         * Apiarist
+         */
+        _121311, 
+        /**
+         * Beef Cattle Farmer
+         */
+        _121312, 
+        /**
+         * Dairy Cattle Farmer
+         */
+        _121313, 
+        /**
+         * Deer Farmer
+         */
+        _121314, 
+        /**
+         * Goat Farmer
+         */
+        _121315, 
+        /**
+         * Horse Breeder
+         */
+        _121316, 
+        /**
+         * Mixed Livestock Farmer
+         */
+        _121317, 
+        /**
+         * Pig Farmer
+         */
+        _121318, 
+        /**
+         * Poultry Farmer
+         */
+        _121321, 
+        /**
+         * Sheep Farmer
+         */
+        _121322, 
+        /**
+         * Livestock Farmers not elsewhere classified
+         */
+        _121399, 
+        /**
+         * Mixed Crop and Livestock Farmer
+         */
+        _121411, 
+        /**
+         * Specialist Managers not further defined
+         */
+        _130000, 
+        /**
+         * Advertising and Sales Managers not further defined
+         */
+        _131100, 
+        /**
+         * Advertising and Public Relations Manager
+         */
+        _131111, 
+        /**
+         * Sales and Marketing Manager
+         */
+        _131112, 
+        /**
+         * Business Administration Managers not further defined
+         */
+        _132000, 
+        /**
+         * Corporate Services Manager
+         */
+        _132111, 
+        /**
+         * Finance Manager
+         */
+        _132211, 
+        /**
+         * Human Resource Manager
+         */
+        _132311, 
+        /**
+         * Policy and Planning Manager
+         */
+        _132411, 
+        /**
+         * Research and Development Manager
+         */
+        _132511, 
+        /**
+         * Construction, Distribution and Production Managers not further defined
+         */
+        _133000, 
+        /**
+         * Construction Managers not further defined
+         */
+        _133100, 
+        /**
+         * Construction Project Manager
+         */
+        _133111, 
+        /**
+         * Project Builder
+         */
+        _133112, 
+        /**
+         * Engineering Manager
+         */
+        _133211, 
+        /**
+         * Importers, Exporters and Wholesalers not further defined
+         */
+        _133300, 
+        /**
+         * Importer or Exporter
+         */
+        _133311, 
+        /**
+         * Wholesaler
+         */
+        _133312, 
+        /**
+         * Manufacturer
+         */
+        _133411, 
+        /**
+         * Production Managers not further defined
+         */
+        _133500, 
+        /**
+         * Production Manager (Forestry)
+         */
+        _133511, 
+        /**
+         * Production Manager (Manufacturing)
+         */
+        _133512, 
+        /**
+         * Production Manager (Mining)
+         */
+        _133513, 
+        /**
+         * Supply and Distribution Manager
+         */
+        _133611, 
+        /**
+         * Education, Health and Welfare Services Managers not further defined
+         */
+        _134000, 
+        /**
+         * Child Care Centre Manager
+         */
+        _134111, 
+        /**
+         * Health and Welfare Services Managers not further defined
+         */
+        _134200, 
+        /**
+         * Medical Administrator
+         */
+        _134211, 
+        /**
+         * Nursing Clinical Director
+         */
+        _134212, 
+        /**
+         * Primary Health Organization Manager
+         */
+        _134213, 
+        /**
+         * Welfare Centre Manager
+         */
+        _134214, 
+        /**
+         * Health and Welfare Services Managers not elsewhere classified
+         */
+        _134299, 
+        /**
+         * School Principal
+         */
+        _134311, 
+        /**
+         * Other Education Managers not further defined
+         */
+        _134400, 
+        /**
+         * Faculty Head
+         */
+        _134411, 
+        /**
+         * Regional Education Manager
+         */
+        _134412, 
+        /**
+         * Education Managers not elsewhere classified
+         */
+        _134499, 
+        /**
+         * ICT Managers not further defined
+         */
+        _135100, 
+        /**
+         * Chief Information Officer
+         */
+        _135111, 
+        /**
+         * ICT Project Manager
+         */
+        _135112, 
+        /**
+         * ICT Managers not elsewhere classified
+         */
+        _135199, 
+        /**
+         * Miscellaneous Specialist Managers not further defined
+         */
+        _139000, 
+        /**
+         * Commissioned Officers (Management) not further defined
+         */
+        _139100, 
+        /**
+         * Commissioned Defence Force Officer
+         */
+        _139111, 
+        /**
+         * Commissioned Fire Officer
+         */
+        _139112, 
+        /**
+         * Commissioned Police Officer
+         */
+        _139113, 
+        /**
+         * Senior Non-commissioned Defence Force Member
+         */
+        _139211, 
+        /**
+         * Other Specialist Managers not further defined
+         */
+        _139900, 
+        /**
+         * Arts Administrator or Manager
+         */
+        _139911, 
+        /**
+         * Environmental Manager
+         */
+        _139912, 
+        /**
+         * Laboratory Manager
+         */
+        _139913, 
+        /**
+         * Quality Assurance Manager
+         */
+        _139914, 
+        /**
+         * Sports Administrator
+         */
+        _139915, 
+        /**
+         * Specialist Managers not elsewhere classified
+         */
+        _139999, 
+        /**
+         * Hospitality, Retail and Service Managers not further defined
+         */
+        _140000, 
+        /**
+         * Accommodation and Hospitality Managers not further defined
+         */
+        _141000, 
+        /**
+         * Cafe or Restaurant Manager
+         */
+        _141111, 
+        /**
+         * Caravan Park and Camping Ground Manager
+         */
+        _141211, 
+        /**
+         * Hotel or Motel Manager
+         */
+        _141311, 
+        /**
+         * Licensed Club Manager
+         */
+        _141411, 
+        /**
+         * Other Accommodation and Hospitality Managers not further defined
+         */
+        _141900, 
+        /**
+         * Bed and Breakfast Operator
+         */
+        _141911, 
+        /**
+         * Accommodation and Hospitality Managers not elsewhere classified
+         */
+        _141999, 
+        /**
+         * Retail Managers not further defined
+         */
+        _142100, 
+        /**
+         * Retail Manager (General)
+         */
+        _142111, 
+        /**
+         * Antique Dealer
+         */
+        _142112, 
+        /**
+         * Betting Agency Manager
+         */
+        _142113, 
+        /**
+         * Hair or Beauty Salon Manager
+         */
+        _142114, 
+        /**
+         * Post Office Manager
+         */
+        _142115, 
+        /**
+         * Travel Agency Manager
+         */
+        _142116, 
+        /**
+         * Miscellaneous Hospitality, Retail and Service Managers not further defined
+         */
+        _149000, 
+        /**
+         * Amusement, Fitness and Sports Centre Managers not further defined
+         */
+        _149100, 
+        /**
+         * Amusement Centre Manager
+         */
+        _149111, 
+        /**
+         * Fitness Centre Manager
+         */
+        _149112, 
+        /**
+         * Sports Centre Manager
+         */
+        _149113, 
+        /**
+         * Call or Contact Centre and Customer Service Managers not further defined
+         */
+        _149200, 
+        /**
+         * Call or Contact Centre Manager
+         */
+        _149211, 
+        /**
+         * Customer Service Manager
+         */
+        _149212, 
+        /**
+         * Conference and Event Organizer
+         */
+        _149311, 
+        /**
+         * Transport Services Managers not further defined
+         */
+        _149400, 
+        /**
+         * Fleet Manager
+         */
+        _149411, 
+        /**
+         * Railway Station Manager
+         */
+        _149412, 
+        /**
+         * Transport Company Manager
+         */
+        _149413, 
+        /**
+         * Other Hospitality, Retail and Service Managers not further defined
+         */
+        _149900, 
+        /**
+         * Boarding Kennel or Cattery Operator
+         */
+        _149911, 
+        /**
+         * Cinema or Theatre Manager
+         */
+        _149912, 
+        /**
+         * Facilities Manager
+         */
+        _149913, 
+        /**
+         * Financial Institution Branch Manager
+         */
+        _149914, 
+        /**
+         * Hospitality, Retail and Service Managers not elsewhere classified
+         */
+        _149999, 
+        /**
+         * Professionals not further defined
+         */
+        _200000, 
+        /**
+         * Arts and Media Professionals not further defined
+         */
+        _210000, 
+        /**
+         * Arts Professionals not further defined
+         */
+        _211000, 
+        /**
+         * Actors, Dancers and Other Entertainers not further defined
+         */
+        _211100, 
+        /**
+         * Actor
+         */
+        _211111, 
+        /**
+         * Dancer or Choreographer
+         */
+        _211112, 
+        /**
+         * Entertainer or Variety Artist
+         */
+        _211113, 
+        /**
+         * Actors, Dancers and Other Entertainers not elsewhere classified
+         */
+        _211199, 
+        /**
+         * Music Professionals not further defined
+         */
+        _211200, 
+        /**
+         * Composer
+         */
+        _211211, 
+        /**
+         * Music Director
+         */
+        _211212, 
+        /**
+         * Musician (Instrumental)
+         */
+        _211213, 
+        /**
+         * Singer
+         */
+        _211214, 
+        /**
+         * Music Professionals not elsewhere classified
+         */
+        _211299, 
+        /**
+         * Photographer
+         */
+        _211311, 
+        /**
+         * Visual Arts and Crafts Professionals not further defined
+         */
+        _211400, 
+        /**
+         * Painter (Visual Arts)
+         */
+        _211411, 
+        /**
+         * Potter or Ceramic Artist
+         */
+        _211412, 
+        /**
+         * Sculptor
+         */
+        _211413, 
+        /**
+         * Visual Arts and Crafts Professionals not elsewhere classified
+         */
+        _211499, 
+        /**
+         * Media Professionals not further defined
+         */
+        _212000, 
+        /**
+         * Artistic Directors, and Media Producers and Presenters not further defined
+         */
+        _212100, 
+        /**
+         * Artistic Director
+         */
+        _212111, 
+        /**
+         * Media Producer (excluding Video)
+         */
+        _212112, 
+        /**
+         * Radio Presenter
+         */
+        _212113, 
+        /**
+         * Television Presenter
+         */
+        _212114, 
+        /**
+         * Authors, and Book and Script Editors not further defined
+         */
+        _212200, 
+        /**
+         * Author
+         */
+        _212211, 
+        /**
+         * Book or Script Editor
+         */
+        _212212, 
+        /**
+         * Film, Television, Radio and Stage Directors not further defined
+         */
+        _212300, 
+        /**
+         * Art Director (Film, Television or Stage)
+         */
+        _212311, 
+        /**
+         * Director (Film, Television, Radio or Stage)
+         */
+        _212312, 
+        /**
+         * Director of Photography
+         */
+        _212313, 
+        /**
+         * Film and Video Editor
+         */
+        _212314, 
+        /**
+         * Program Director (Television or Radio)
+         */
+        _212315, 
+        /**
+         * Stage Manager
+         */
+        _212316, 
+        /**
+         * Technical Director
+         */
+        _212317, 
+        /**
+         * Video Producer
+         */
+        _212318, 
+        /**
+         * Film, Television, Radio and Stage Directors not elsewhere classified
+         */
+        _212399, 
+        /**
+         * Journalists and Other Writers not further defined
+         */
+        _212400, 
+        /**
+         * Copywriter
+         */
+        _212411, 
+        /**
+         * Newspaper or Periodical Editor
+         */
+        _212412, 
+        /**
+         * Print Journalist
+         */
+        _212413, 
+        /**
+         * Radio Journalist
+         */
+        _212414, 
+        /**
+         * Technical Writer
+         */
+        _212415, 
+        /**
+         * Television Journalist
+         */
+        _212416, 
+        /**
+         * Journalists and Other Writers not elsewhere classified
+         */
+        _212499, 
+        /**
+         * Business, Human Resource and Marketing Professionals not further defined
+         */
+        _220000, 
+        /**
+         * Accountants, Auditors and Company Secretaries not further defined
+         */
+        _221000, 
+        /**
+         * Accountants not further defined
+         */
+        _221100, 
+        /**
+         * Accountant (General)
+         */
+        _221111, 
+        /**
+         * Management Accountant
+         */
+        _221112, 
+        /**
+         * Taxation Accountant
+         */
+        _221113, 
+        /**
+         * Auditors, Company Secretaries and Corporate Treasurers not further defined
+         */
+        _221200, 
+        /**
+         * Company Secretary
+         */
+        _221211, 
+        /**
+         * Corporate Treasurer
+         */
+        _221212, 
+        /**
+         * External Auditor
+         */
+        _221213, 
+        /**
+         * Internal Auditor
+         */
+        _221214, 
+        /**
+         * Financial Brokers and Dealers, and Investment Advisers not further defined
+         */
+        _222000, 
+        /**
+         * Financial Brokers not further defined
+         */
+        _222100, 
+        /**
+         * Commodities Trader
+         */
+        _222111, 
+        /**
+         * Finance Broker
+         */
+        _222112, 
+        /**
+         * Insurance Broker
+         */
+        _222113, 
+        /**
+         * Financial Brokers not elsewhere classified
+         */
+        _222199, 
+        /**
+         * Financial Dealers not further defined
+         */
+        _222200, 
+        /**
+         * Financial Market Dealer
+         */
+        _222211, 
+        /**
+         * Futures Trader
+         */
+        _222212, 
+        /**
+         * Stockbroking Dealer
+         */
+        _222213, 
+        /**
+         * Financial Dealers not elsewhere classified
+         */
+        _222299, 
+        /**
+         * Financial Investment Advisers and Managers not further defined
+         */
+        _222300, 
+        /**
+         * Financial Investment Adviser
+         */
+        _222311, 
+        /**
+         * Financial Investment Manager
+         */
+        _222312, 
+        /**
+         * Human Resource and Training Professionals not further defined
+         */
+        _223000, 
+        /**
+         * Human Resource Professionals not further defined
+         */
+        _223100, 
+        /**
+         * Human Resource Adviser
+         */
+        _223111, 
+        /**
+         * Recruitment Consultant
+         */
+        _223112, 
+        /**
+         * Workplace Relations Adviser
+         */
+        _223113, 
+        /**
+         * ICT Trainer
+         */
+        _223211, 
+        /**
+         * Training and Development Professional
+         */
+        _223311, 
+        /**
+         * Information and Organization Professionals not further defined
+         */
+        _224000, 
+        /**
+         * Actuaries, Mathematicians and Statisticians not further defined
+         */
+        _224100, 
+        /**
+         * Actuary
+         */
+        _224111, 
+        /**
+         * Mathematician
+         */
+        _224112, 
+        /**
+         * Statistician
+         */
+        _224113, 
+        /**
+         * Archivists, Curators and Records Managers not further defined
+         */
+        _224200, 
+        /**
+         * Archivist
+         */
+        _224211, 
+        /**
+         * Gallery or Museum Curator
+         */
+        _224212, 
+        /**
+         * Health Information Manager
+         */
+        _224213, 
+        /**
+         * Records Manager
+         */
+        _224214, 
+        /**
+         * Economist
+         */
+        _224311, 
+        /**
+         * Intelligence and Policy Analysts not further defined
+         */
+        _224400, 
+        /**
+         * Intelligence Officer
+         */
+        _224411, 
+        /**
+         * Policy Analyst
+         */
+        _224412, 
+        /**
+         * Land Economists and Valuers not further defined
+         */
+        _224500, 
+        /**
+         * Land Economist
+         */
+        _224511, 
+        /**
+         * Valuer
+         */
+        _224512, 
+        /**
+         * Librarian
+         */
+        _224611, 
+        /**
+         * Management and Organization Analysts not further defined
+         */
+        _224700, 
+        /**
+         * Management Consultant
+         */
+        _224711, 
+        /**
+         * Organization and Methods Analyst
+         */
+        _224712, 
+        /**
+         * Other Information and Organization Professionals not further defined
+         */
+        _224900, 
+        /**
+         * Electorate Officer
+         */
+        _224911, 
+        /**
+         * Liaison Officer
+         */
+        _224912, 
+        /**
+         * Migration Agent
+         */
+        _224913, 
+        /**
+         * Patents Examiner
+         */
+        _224914, 
+        /**
+         * Information and Organization Professionals not elsewhere classified
+         */
+        _224999, 
+        /**
+         * Sales, Marketing and Public Relations Professionals not further defined
+         */
+        _225000, 
+        /**
+         * Advertising and Marketing Professionals not further defined
+         */
+        _225100, 
+        /**
+         * Advertising Specialist
+         */
+        _225111, 
+        /**
+         * Market Research Analyst
+         */
+        _225112, 
+        /**
+         * Marketing Specialist
+         */
+        _225113, 
+        /**
+         * ICT Sales Professionals not further defined
+         */
+        _225200, 
+        /**
+         * ICT Account Manager
+         */
+        _225211, 
+        /**
+         * ICT Business Development Manager
+         */
+        _225212, 
+        /**
+         * ICT Sales Representative
+         */
+        _225213, 
+        /**
+         * Public Relations Professional
+         */
+        _225311, 
+        /**
+         * Technical Sales Representatives not further defined
+         */
+        _225400, 
+        /**
+         * Sales Representative (Industrial Products)
+         */
+        _225411, 
+        /**
+         * Sales Representative (Medical and Pharmaceutical Products)
+         */
+        _225412, 
+        /**
+         * Technical Sales Representatives not elsewhere classified
+         */
+        _225499, 
+        /**
+         * Design, Engineering, Science and Transport Professionals not further defined
+         */
+        _230000, 
+        /**
+         * Air and Marine Transport Professionals not further defined
+         */
+        _231000, 
+        /**
+         * Air Transport Professionals not further defined
+         */
+        _231100, 
+        /**
+         * Aeroplane Pilot
+         */
+        _231111, 
+        /**
+         * Air Traffic Controller
+         */
+        _231112, 
+        /**
+         * Flying Instructor
+         */
+        _231113, 
+        /**
+         * Helicopter Pilot
+         */
+        _231114, 
+        /**
+         * Air Transport Professionals not elsewhere classified
+         */
+        _231199, 
+        /**
+         * Marine Transport Professionals not further defined
+         */
+        _231200, 
+        /**
+         * Master Fisher
+         */
+        _231211, 
+        /**
+         * Ship's Engineer
+         */
+        _231212, 
+        /**
+         * Ship's Master
+         */
+        _231213, 
+        /**
+         * Ship's Officer
+         */
+        _231214, 
+        /**
+         * Ship's Surveyor
+         */
+        _231215, 
+        /**
+         * Marine Transport Professionals not elsewhere classified
+         */
+        _231299, 
+        /**
+         * Architects, Designers, Planners and Surveyors not further defined
+         */
+        _232000, 
+        /**
+         * Architects and Landscape Architects not further defined
+         */
+        _232100, 
+        /**
+         * Architect
+         */
+        _232111, 
+        /**
+         * Landscape Architect
+         */
+        _232112, 
+        /**
+         * Cartographers and Surveyors not further defined
+         */
+        _232200, 
+        /**
+         * Cartographer
+         */
+        _232211, 
+        /**
+         * Surveyor
+         */
+        _232212, 
+        /**
+         * Fashion, Industrial and Jewellery Designers not further defined
+         */
+        _232300, 
+        /**
+         * Fashion Designer
+         */
+        _232311, 
+        /**
+         * Industrial Designer
+         */
+        _232312, 
+        /**
+         * Jewellery Designer
+         */
+        _232313, 
+        /**
+         * Graphic and Web Designers, and Illustrators not further defined
+         */
+        _232400, 
+        /**
+         * Graphic Designer
+         */
+        _232411, 
+        /**
+         * Illustrator
+         */
+        _232412, 
+        /**
+         * Multimedia Designer
+         */
+        _232413, 
+        /**
+         * Web Designer
+         */
+        _232414, 
+        /**
+         * Interior Designer
+         */
+        _232511, 
+        /**
+         * Urban and Regional Planner
+         */
+        _232611, 
+        /**
+         * Engineering Professionals not further defined
+         */
+        _233000, 
+        /**
+         * Chemical and Materials Engineers not further defined
+         */
+        _233100, 
+        /**
+         * Chemical Engineer
+         */
+        _233111, 
+        /**
+         * Materials Engineer
+         */
+        _233112, 
+        /**
+         * Civil Engineering Professionals not further defined
+         */
+        _233200, 
+        /**
+         * Civil Engineer
+         */
+        _233211, 
+        /**
+         * Geotechnical Engineer
+         */
+        _233212, 
+        /**
+         * Quantity Surveyor
+         */
+        _233213, 
+        /**
+         * Structural Engineer
+         */
+        _233214, 
+        /**
+         * Transport Engineer
+         */
+        _233215, 
+        /**
+         * Electrical Engineer
+         */
+        _233311, 
+        /**
+         * Electronics Engineer
+         */
+        _233411, 
+        /**
+         * Industrial, Mechanical and Production Engineers not further defined
+         */
+        _233500, 
+        /**
+         * Industrial Engineer
+         */
+        _233511, 
+        /**
+         * Mechanical Engineer
+         */
+        _233512, 
+        /**
+         * Production or Plant Engineer
+         */
+        _233513, 
+        /**
+         * Mining Engineers not further defined
+         */
+        _233600, 
+        /**
+         * Mining Engineer (excluding Petroleum)
+         */
+        _233611, 
+        /**
+         * Petroleum Engineer
+         */
+        _233612, 
+        /**
+         * Other Engineering Professionals not further defined
+         */
+        _233900, 
+        /**
+         * Aeronautical Engineer
+         */
+        _233911, 
+        /**
+         * Agricultural Engineer
+         */
+        _233912, 
+        /**
+         * Biomedical Engineer
+         */
+        _233913, 
+        /**
+         * Engineering Technologist
+         */
+        _233914, 
+        /**
+         * Environmental Engineer
+         */
+        _233915, 
+        /**
+         * Naval Architect
+         */
+        _233916, 
+        /**
+         * Engineering Professionals not elsewhere classified
+         */
+        _233999, 
+        /**
+         * Natural and Physical Science Professionals not further defined
+         */
+        _234000, 
+        /**
+         * Agricultural and Forestry Scientists not further defined
+         */
+        _234100, 
+        /**
+         * Agricultural Consultant
+         */
+        _234111, 
+        /**
+         * Agricultural Scientist
+         */
+        _234112, 
+        /**
+         * Forester
+         */
+        _234113, 
+        /**
+         * Chemists, and Food and Wine Scientists not further defined
+         */
+        _234200, 
+        /**
+         * Chemist
+         */
+        _234211, 
+        /**
+         * Food Technologist
+         */
+        _234212, 
+        /**
+         * Wine Maker
+         */
+        _234213, 
+        /**
+         * Environmental Scientists not further defined
+         */
+        _234300, 
+        /**
+         * Conservation Officer
+         */
+        _234311, 
+        /**
+         * Environmental Consultant
+         */
+        _234312, 
+        /**
+         * Environmental Research Scientist
+         */
+        _234313, 
+        /**
+         * Park Ranger
+         */
+        _234314, 
+        /**
+         * Environmental Scientists not elsewhere classified
+         */
+        _234399, 
+        /**
+         * Geologists and Geophysicists not further defined
+         */
+        _234400, 
+        /**
+         * Geologist
+         */
+        _234411, 
+        /**
+         * Geophysicist
+         */
+        _234412, 
+        /**
+         * Life Scientists not further defined
+         */
+        _234500, 
+        /**
+         * Life Scientist (General)
+         */
+        _234511, 
+        /**
+         * Anatomist or Physiologist
+         */
+        _234512, 
+        /**
+         * Biochemist
+         */
+        _234513, 
+        /**
+         * Biotechnologist
+         */
+        _234514, 
+        /**
+         * Botanist
+         */
+        _234515, 
+        /**
+         * Marine Biologist
+         */
+        _234516, 
+        /**
+         * Microbiologist
+         */
+        _234517, 
+        /**
+         * Zoologist
+         */
+        _234518, 
+        /**
+         * Life Scientists not elsewhere classified
+         */
+        _234599, 
+        /**
+         * Medical Laboratory Scientist
+         */
+        _234611, 
+        /**
+         * Veterinarian
+         */
+        _234711, 
+        /**
+         * Other Natural and Physical Science Professionals not further defined
+         */
+        _234900, 
+        /**
+         * Conservator
+         */
+        _234911, 
+        /**
+         * Metallurgist
+         */
+        _234912, 
+        /**
+         * Meteorologist
+         */
+        _234913, 
+        /**
+         * Physicist
+         */
+        _234914, 
+        /**
+         * Natural and Physical Science Professionals not elsewhere classified
+         */
+        _234999, 
+        /**
+         * Education Professionals not further defined
+         */
+        _240000, 
+        /**
+         * School Teachers not further defined
+         */
+        _241000, 
+        /**
+         * Early Childhood (Pre-primary School) Teacher
+         */
+        _241111, 
+        /**
+         * Primary School Teacher
+         */
+        _241213, 
+        /**
+         * Middle School Teacher
+         */
+        _241311, 
+        /**
+         * Secondary School Teacher
+         */
+        _241411, 
+        /**
+         * Special Education Teachers not further defined
+         */
+        _241500, 
+        /**
+         * Special Needs Teacher
+         */
+        _241511, 
+        /**
+         * Teacher of the Hearing Impaired
+         */
+        _241512, 
+        /**
+         * Teacher of the Sight Impaired
+         */
+        _241513, 
+        /**
+         * Special Education Teachers not elsewhere classified
+         */
+        _241599, 
+        /**
+         * Tertiary Education Teachers not further defined
+         */
+        _242000, 
+        /**
+         * University Lecturers and Tutors not further defined
+         */
+        _242100, 
+        /**
+         * University Lecturer
+         */
+        _242111, 
+        /**
+         * University Tutor
+         */
+        _242112, 
+        /**
+         * Vocational Education Teacher
+         */
+        _242211, 
+        /**
+         * Miscellaneous Education Professionals not further defined
+         */
+        _249000, 
+        /**
+         * Education Advisers and Reviewers not further defined
+         */
+        _249100, 
+        /**
+         * Education Adviser
+         */
+        _249111, 
+        /**
+         * Education Reviewer
+         */
+        _249112, 
+        /**
+         * Private Tutors and Teachers not further defined
+         */
+        _249200, 
+        /**
+         * Art Teacher (Private Tuition)
+         */
+        _249211, 
+        /**
+         * Dance Teacher (Private Tuition)
+         */
+        _249212, 
+        /**
+         * Drama Teacher (Private Tuition)
+         */
+        _249213, 
+        /**
+         * Music Teacher (Private Tuition)
+         */
+        _249214, 
+        /**
+         * Private Tutors and Teachers not elsewhere classified
+         */
+        _249299, 
+        /**
+         * Teacher of English to Speakers of Other Languages
+         */
+        _249311, 
+        /**
+         * Health Professionals not further defined
+         */
+        _250000, 
+        /**
+         * Health Diagnostic and Promotion Professionals not further defined
+         */
+        _251000, 
+        /**
+         * Dietitian
+         */
+        _251111, 
+        /**
+         * Medical Imaging Professionals not further defined
+         */
+        _251200, 
+        /**
+         * Medical Diagnostic Radiographer
+         */
+        _251211, 
+        /**
+         * Medical Radiation Therapist
+         */
+        _251212, 
+        /**
+         * Nuclear Medicine Technologist
+         */
+        _251213, 
+        /**
+         * Sonographer
+         */
+        _251214, 
+        /**
+         * Occupational and Environmental Health Professionals not further defined
+         */
+        _251300, 
+        /**
+         * Environmental Health Officer
+         */
+        _251311, 
+        /**
+         * Occupational Health and Safety Adviser
+         */
+        _251312, 
+        /**
+         * Optometrists and Orthoptists not further defined
+         */
+        _251400, 
+        /**
+         * Optometrist
+         */
+        _251411, 
+        /**
+         * Orthoptist
+         */
+        _251412, 
+        /**
+         * Pharmacists not further defined
+         */
+        _251500, 
+        /**
+         * Hospital Pharmacist
+         */
+        _251511, 
+        /**
+         * Industrial Pharmacist
+         */
+        _251512, 
+        /**
+         * Retail Pharmacist
+         */
+        _251513, 
+        /**
+         * Other Health Diagnostic and Promotion Professionals not further defined
+         */
+        _251900, 
+        /**
+         * Health Promotion Officer
+         */
+        _251911, 
+        /**
+         * Orthotist or Prosthetist
+         */
+        _251912, 
+        /**
+         * Health Diagnostic and Promotion Professionals not elsewhere classified
+         */
+        _251999, 
+        /**
+         * Health Therapy Professionals not further defined
+         */
+        _252000, 
+        /**
+         * Chiropractors and Osteopaths not further defined
+         */
+        _252100, 
+        /**
+         * Chiropractor
+         */
+        _252111, 
+        /**
+         * Osteopath
+         */
+        _252112, 
+        /**
+         * Complementary Health Therapists not further defined
+         */
+        _252200, 
+        /**
+         * Acupuncturist
+         */
+        _252211, 
+        /**
+         * Homoeopath
+         */
+        _252212, 
+        /**
+         * Naturopath
+         */
+        _252213, 
+        /**
+         * Traditional Chinese Medicine Practitioner
+         */
+        _252214, 
+        /**
+         * Complementary Health Therapists not elsewhere classified
+         */
+        _252299, 
+        /**
+         * Dental Practitioners not further defined
+         */
+        _252300, 
+        /**
+         * Dental Specialist
+         */
+        _252311, 
+        /**
+         * Dentist
+         */
+        _252312, 
+        /**
+         * Occupational Therapist
+         */
+        _252411, 
+        /**
+         * Physiotherapist
+         */
+        _252511, 
+        /**
+         * Podiatrist
+         */
+        _252611, 
+        /**
+         * Speech Professionals and Audiologists not further defined
+         */
+        _252700, 
+        /**
+         * Audiologist
+         */
+        _252711, 
+        /**
+         * Speech Pathologist
+         */
+        _252712, 
+        /**
+         * Medical Practitioners not further defined
+         */
+        _253000, 
+        /**
+         * Generalist Medical Practitioners not further defined
+         */
+        _253100, 
+        /**
+         * General Medical Practitioner
+         */
+        _253111, 
+        /**
+         * Resident Medical Officer
+         */
+        _253112, 
+        /**
+         * Anaesthetist
+         */
+        _253211, 
+        /**
+         * Internal Medicine Specialists not further defined
+         */
+        _253300, 
+        /**
+         * Specialist Physician (General Medicine)
+         */
+        _253311, 
+        /**
+         * Cardiologist
+         */
+        _253312, 
+        /**
+         * Clinical Haematologist
+         */
+        _253313, 
+        /**
+         * Clinical Oncologist
+         */
+        _253314, 
+        /**
+         * Endocrinologist
+         */
+        _253315, 
+        /**
+         * Gastroenterologist
+         */
+        _253316, 
+        /**
+         * Intensive Care Specialist
+         */
+        _253317, 
+        /**
+         * Neurologist
+         */
+        _253318, 
+        /**
+         * Paediatrician
+         */
+        _253321, 
+        /**
+         * Renal Medicine Specialist
+         */
+        _253322, 
+        /**
+         * Rheumatologist
+         */
+        _253323, 
+        /**
+         * Thoracic Medicine Specialist
+         */
+        _253324, 
+        /**
+         * Internal Medicine Specialists not elsewhere classified
+         */
+        _253399, 
+        /**
+         * Psychiatrist
+         */
+        _253411, 
+        /**
+         * Surgeons not further defined
+         */
+        _253500, 
+        /**
+         * Surgeon (General)
+         */
+        _253511, 
+        /**
+         * Cardiothoracic Surgeon
+         */
+        _253512, 
+        /**
+         * Neurosurgeon
+         */
+        _253513, 
+        /**
+         * Orthopaedic Surgeon
+         */
+        _253514, 
+        /**
+         * Otorhinolaryngologist
+         */
+        _253515, 
+        /**
+         * Paediatric Surgeon
+         */
+        _253516, 
+        /**
+         * Plastic and Reconstructive Surgeon
+         */
+        _253517, 
+        /**
+         * Urologist
+         */
+        _253518, 
+        /**
+         * Vascular Surgeon
+         */
+        _253521, 
+        /**
+         * Other Medical Practitioners not further defined
+         */
+        _253900, 
+        /**
+         * Dermatologist
+         */
+        _253911, 
+        /**
+         * Emergency Medicine Specialist
+         */
+        _253912, 
+        /**
+         * Obstetrician and Gynaecologist
+         */
+        _253913, 
+        /**
+         * Ophthalmologist
+         */
+        _253914, 
+        /**
+         * Pathologist
+         */
+        _253915, 
+        /**
+         * Radiologist
+         */
+        _253916, 
+        /**
+         * Medical Practitioners not elsewhere classified
+         */
+        _253999, 
+        /**
+         * Midwifery and Nursing Professionals not further defined
+         */
+        _254000, 
+        /**
+         * Midwife
+         */
+        _254111, 
+        /**
+         * Nurse Educators and Researchers not further defined
+         */
+        _254200, 
+        /**
+         * Nurse Educator
+         */
+        _254211, 
+        /**
+         * Nurse Researcher
+         */
+        _254212, 
+        /**
+         * Nurse Manager
+         */
+        _254311, 
+        /**
+         * Registered Nurses not further defined
+         */
+        _254400, 
+        /**
+         * Nurse Practitioner
+         */
+        _254411, 
+        /**
+         * Registered Nurse (Aged Care)
+         */
+        _254412, 
+        /**
+         * Registered Nurse (Child and Family Health)
+         */
+        _254413, 
+        /**
+         * Registered Nurse (Community Health)
+         */
+        _254414, 
+        /**
+         * Registered Nurse (Critical Care and Emergency)
+         */
+        _254415, 
+        /**
+         * Registered Nurse (Developmental Disability)
+         */
+        _254416, 
+        /**
+         * Registered Nurse (Disability and Rehabilitation)
+         */
+        _254417, 
+        /**
+         * Registered Nurse (Medical)
+         */
+        _254418, 
+        /**
+         * Registered Nurse (Medical Practice)
+         */
+        _254421, 
+        /**
+         * Registered Nurse (Mental Health)
+         */
+        _254422, 
+        /**
+         * Registered Nurse (Perioperative)
+         */
+        _254423, 
+        /**
+         * Registered Nurse (Surgical)
+         */
+        _254424, 
+        /**
+         * Registered Nurses not elsewhere classified
+         */
+        _254499, 
+        /**
+         * ICT Professionals not further defined
+         */
+        _260000, 
+        /**
+         * Business and Systems Analysts, and Programmers not further defined
+         */
+        _261000, 
+        /**
+         * ICT Business and Systems Analysts not further defined
+         */
+        _261100, 
+        /**
+         * ICT Business Analyst
+         */
+        _261111, 
+        /**
+         * Systems Analyst
+         */
+        _261112, 
+        /**
+         * Multimedia Specialists and Web Developers not further defined
+         */
+        _261200, 
+        /**
+         * Multimedia Specialist
+         */
+        _261211, 
+        /**
+         * Web Developer
+         */
+        _261212, 
+        /**
+         * Software and Applications Programmers not further defined
+         */
+        _261300, 
+        /**
+         * Analyst Programmer
+         */
+        _261311, 
+        /**
+         * Developer Programmer
+         */
+        _261312, 
+        /**
+         * Software Engineer
+         */
+        _261313, 
+        /**
+         * Software and Applications Programmers not elsewhere classified
+         */
+        _261399, 
+        /**
+         * Database and Systems Administrators, and ICT Security Specialists not further defined
+         */
+        _262100, 
+        /**
+         * Database Administrator
+         */
+        _262111, 
+        /**
+         * ICT Security Specialist
+         */
+        _262112, 
+        /**
+         * Systems Administrator
+         */
+        _262113, 
+        /**
+         * ICT Network and Support Professionals not further defined
+         */
+        _263000, 
+        /**
+         * Computer Network Professionals not further defined
+         */
+        _263100, 
+        /**
+         * Computer Network and Systems Engineer
+         */
+        _263111, 
+        /**
+         * Network Administrator
+         */
+        _263112, 
+        /**
+         * Network Analyst
+         */
+        _263113, 
+        /**
+         * ICT Support and Test Engineers not further defined
+         */
+        _263200, 
+        /**
+         * ICT Quality Assurance Engineer
+         */
+        _263211, 
+        /**
+         * ICT Support Engineer
+         */
+        _263212, 
+        /**
+         * ICT Systems Test Engineer
+         */
+        _263213, 
+        /**
+         * ICT Support and Test Engineers not elsewhere classified
+         */
+        _263299, 
+        /**
+         * Telecommunications Engineering Professionals not further defined
+         */
+        _263300, 
+        /**
+         * Telecommunications Engineer
+         */
+        _263311, 
+        /**
+         * Telecommunications Network Engineer
+         */
+        _263312, 
+        /**
+         * Legal, Social and Welfare Professionals not further defined
+         */
+        _270000, 
+        /**
+         * Legal Professionals not further defined
+         */
+        _271000, 
+        /**
+         * Barrister
+         */
+        _271111, 
+        /**
+         * Judicial and Other Legal Professionals not further defined
+         */
+        _271200, 
+        /**
+         * Judge
+         */
+        _271211, 
+        /**
+         * Magistrate
+         */
+        _271212, 
+        /**
+         * Tribunal Member
+         */
+        _271213, 
+        /**
+         * Judicial and Other Legal Professionals not elsewhere classified
+         */
+        _271299, 
+        /**
+         * Solicitor
+         */
+        _271311, 
+        /**
+         * Social and Welfare Professionals not further defined
+         */
+        _272000, 
+        /**
+         * Counsellors not further defined
+         */
+        _272100, 
+        /**
+         * Careers Counsellor
+         */
+        _272111, 
+        /**
+         * Drug and Alcohol Counsellor
+         */
+        _272112, 
+        /**
+         * Family and Marriage Counsellor
+         */
+        _272113, 
+        /**
+         * Rehabilitation Counsellor
+         */
+        _272114, 
+        /**
+         * Student Counsellor
+         */
+        _272115, 
+        /**
+         * Counsellors not elsewhere classified
+         */
+        _272199, 
+        /**
+         * Minister of Religion
+         */
+        _272211, 
+        /**
+         * Psychologists not further defined
+         */
+        _272300, 
+        /**
+         * Clinical Psychologist
+         */
+        _272311, 
+        /**
+         * Educational Psychologist
+         */
+        _272312, 
+        /**
+         * Organizational Psychologist
+         */
+        _272313, 
+        /**
+         * Psychotherapist
+         */
+        _272314, 
+        /**
+         * Psychologists not elsewhere classified
+         */
+        _272399, 
+        /**
+         * Social Professionals not further defined
+         */
+        _272400, 
+        /**
+         * Historian
+         */
+        _272411, 
+        /**
+         * Interpreter
+         */
+        _272412, 
+        /**
+         * Translator
+         */
+        _272413, 
+        /**
+         * Social Professionals not elsewhere classified
+         */
+        _272499, 
+        /**
+         * Social Worker
+         */
+        _272511, 
+        /**
+         * Welfare, Recreation and Community Arts Workers not further defined
+         */
+        _272600, 
+        /**
+         * Community Arts Worker
+         */
+        _272611, 
+        /**
+         * Recreation Officer
+         */
+        _272612, 
+        /**
+         * Welfare Worker
+         */
+        _272613, 
+        /**
+         * Technicians and Trades Workers not further defined
+         */
+        _300000, 
+        /**
+         * Engineering, ICT and Science Technicians not further defined
+         */
+        _310000, 
+        /**
+         * Agricultural, Medical and Science Technicians not further defined
+         */
+        _311000, 
+        /**
+         * Agricultural Technician
+         */
+        _311111, 
+        /**
+         * Medical Technicians not further defined
+         */
+        _311200, 
+        /**
+         * Anaesthetic Technician
+         */
+        _311211, 
+        /**
+         * Cardiac Technician
+         */
+        _311212, 
+        /**
+         * Medical Laboratory Technician
+         */
+        _311213, 
+        /**
+         * Operating Theatre Technician
+         */
+        _311214, 
+        /**
+         * Pharmacy Technician
+         */
+        _311215, 
+        /**
+         * Medical Technicians not elsewhere classified
+         */
+        _311299, 
+        /**
+         * Primary Products Inspectors not further defined
+         */
+        _311300, 
+        /**
+         * Fisheries Officer
+         */
+        _311311, 
+        /**
+         * Meat Inspector
+         */
+        _311312, 
+        /**
+         * Quarantine Officer
+         */
+        _311313, 
+        /**
+         * Primary Products Inspectors not elsewhere classified
+         */
+        _311399, 
+        /**
+         * Science Technicians not further defined
+         */
+        _311400, 
+        /**
+         * Chemistry Technician
+         */
+        _311411, 
+        /**
+         * Earth Science Technician
+         */
+        _311412, 
+        /**
+         * Life Science Technician
+         */
+        _311413, 
+        /**
+         * School Laboratory Technician
+         */
+        _311414, 
+        /**
+         * Science Technicians not elsewhere classified
+         */
+        _311499, 
+        /**
+         * Building and Engineering Technicians not further defined
+         */
+        _312000, 
+        /**
+         * Architectural, Building and Surveying Technicians not further defined
+         */
+        _312100, 
+        /**
+         * Architectural Draftsperson
+         */
+        _312111, 
+        /**
+         * Building Associate
+         */
+        _312112, 
+        /**
+         * Building Inspector
+         */
+        _312113, 
+        /**
+         * Construction Estimator
+         */
+        _312114, 
+        /**
+         * Plumbing Inspector
+         */
+        _312115, 
+        /**
+         * Surveying or Cartographic Technician
+         */
+        _312116, 
+        /**
+         * Civil Engineering Draftspersons and Technicians not further defined
+         */
+        _312200, 
+        /**
+         * Civil Engineering Draftsperson
+         */
+        _312211, 
+        /**
+         * Civil Engineering Technician
+         */
+        _312212, 
+        /**
+         * Electrical Engineering Draftspersons and Technicians not further defined
+         */
+        _312300, 
+        /**
+         * Electrical Engineering Draftsperson
+         */
+        _312311, 
+        /**
+         * Electrical Engineering Technician
+         */
+        _312312, 
+        /**
+         * Electronic Engineering Draftspersons and Technicians not further defined
+         */
+        _312400, 
+        /**
+         * Electronic Engineering Draftsperson
+         */
+        _312411, 
+        /**
+         * Electronic Engineering Technician
+         */
+        _312412, 
+        /**
+         * Mechanical Engineering Draftspersons and Technicians not further defined
+         */
+        _312500, 
+        /**
+         * Mechanical Engineering Draftsperson
+         */
+        _312511, 
+        /**
+         * Mechanical Engineering Technician
+         */
+        _312512, 
+        /**
+         * Safety Inspector
+         */
+        _312611, 
+        /**
+         * Other Building and Engineering Technicians not further defined
+         */
+        _312900, 
+        /**
+         * Maintenance Planner
+         */
+        _312911, 
+        /**
+         * Metallurgical or Materials Technician
+         */
+        _312912, 
+        /**
+         * Mine Deputy
+         */
+        _312913, 
+        /**
+         * Building and Engineering Technicians not elsewhere classified
+         */
+        _312999, 
+        /**
+         * ICT and Telecommunications Technicians not further defined
+         */
+        _313000, 
+        /**
+         * ICT Support Technicians not further defined
+         */
+        _313100, 
+        /**
+         * Hardware Technician
+         */
+        _313111, 
+        /**
+         * ICT Customer Support Officer
+         */
+        _313112, 
+        /**
+         * Web Administrator
+         */
+        _313113, 
+        /**
+         * ICT Support Technicians not elsewhere classified
+         */
+        _313199, 
+        /**
+         * Telecommunications Technical Specialists not further defined
+         */
+        _313200, 
+        /**
+         * Radiocommunications Technician
+         */
+        _313211, 
+        /**
+         * Telecommunications Field Engineer
+         */
+        _313212, 
+        /**
+         * Telecommunications Network Planner
+         */
+        _313213, 
+        /**
+         * Telecommunications Technical Officer or Technologist
+         */
+        _313214, 
+        /**
+         * Automotive and Engineering Trades Workers not further defined
+         */
+        _320000, 
+        /**
+         * Automotive Electricians and Mechanics not further defined
+         */
+        _321000, 
+        /**
+         * Automotive Electrician
+         */
+        _321111, 
+        /**
+         * Motor Mechanics not further defined
+         */
+        _321200, 
+        /**
+         * Motor Mechanic (General)
+         */
+        _321211, 
+        /**
+         * Diesel Motor Mechanic
+         */
+        _321212, 
+        /**
+         * Motorcycle Mechanic
+         */
+        _321213, 
+        /**
+         * Small Engine Mechanic
+         */
+        _321214, 
+        /**
+         * Fabrication Engineering Trades Workers not further defined
+         */
+        _322000, 
+        /**
+         * Metal Casting, Forging and Finishing Trades Workers not further defined
+         */
+        _322100, 
+        /**
+         * Blacksmith
+         */
+        _322111, 
+        /**
+         * Electroplater
+         */
+        _322112, 
+        /**
+         * Farrier
+         */
+        _322113, 
+        /**
+         * Metal Casting Trades Worker
+         */
+        _322114, 
+        /**
+         * Metal Polisher
+         */
+        _322115, 
+        /**
+         * Sheetmetal Trades Worker
+         */
+        _322211, 
+        /**
+         * Structural Steel and Welding Trades Workers not further defined
+         */
+        _322300, 
+        /**
+         * Metal Fabricator
+         */
+        _322311, 
+        /**
+         * Pressure Welder
+         */
+        _322312, 
+        /**
+         * Welder (First Class)
+         */
+        _322313, 
+        /**
+         * Mechanical Engineering Trades Workers not further defined
+         */
+        _323000, 
+        /**
+         * Aircraft Maintenance Engineers not further defined
+         */
+        _323100, 
+        /**
+         * Aircraft Maintenance Engineer (Avionics)
+         */
+        _323111, 
+        /**
+         * Aircraft Maintenance Engineer (Mechanical)
+         */
+        _323112, 
+        /**
+         * Aircraft Maintenance Engineer (Structures)
+         */
+        _323113, 
+        /**
+         * Metal Fitters and Machinists not further defined
+         */
+        _323200, 
+        /**
+         * Fitter (General)
+         */
+        _323211, 
+        /**
+         * Fitter and Turner
+         */
+        _323212, 
+        /**
+         * Fitter-Welder
+         */
+        _323213, 
+        /**
+         * Metal Machinist (First Class)
+         */
+        _323214, 
+        /**
+         * Textile, Clothing and Footwear Mechanic
+         */
+        _323215, 
+        /**
+         * Metal Fitters and Machinists not elsewhere classified
+         */
+        _323299, 
+        /**
+         * Precision Metal Trades Workers not further defined
+         */
+        _323300, 
+        /**
+         * Engraver
+         */
+        _323311, 
+        /**
+         * Gunsmith
+         */
+        _323312, 
+        /**
+         * Locksmith
+         */
+        _323313, 
+        /**
+         * Precision Instrument Maker and Repairer
+         */
+        _323314, 
+        /**
+         * Saw Maker and Repairer
+         */
+        _323315, 
+        /**
+         * Watch and Clock Maker and Repairer
+         */
+        _323316, 
+        /**
+         * Toolmakers and Engineering Patternmakers not further defined
+         */
+        _323400, 
+        /**
+         * Engineering Patternmaker
+         */
+        _323411, 
+        /**
+         * Toolmaker
+         */
+        _323412, 
+        /**
+         * Panelbeaters, and Vehicle Body Builders, Trimmers and Painters not further defined
+         */
+        _324000, 
+        /**
+         * Panelbeater
+         */
+        _324111, 
+        /**
+         * Vehicle Body Builders and Trimmers not further defined
+         */
+        _324200, 
+        /**
+         * Vehicle Body Builder
+         */
+        _324211, 
+        /**
+         * Vehicle Trimmer
+         */
+        _324212, 
+        /**
+         * Vehicle Painter
+         */
+        _324311, 
+        /**
+         * Construction Trades Workers not further defined
+         */
+        _330000, 
+        /**
+         * Bricklayers, and Carpenters and Joiners not further defined
+         */
+        _331000, 
+        /**
+         * Bricklayers and Stonemasons not further defined
+         */
+        _331100, 
+        /**
+         * Bricklayer
+         */
+        _331111, 
+        /**
+         * Stonemason
+         */
+        _331112, 
+        /**
+         * Carpenter and Joiner
+         */
+        _331211, 
+        /**
+         * Carpenter
+         */
+        _331212, 
+        /**
+         * Joiner
+         */
+        _331213, 
+        /**
+         * Floor Finishers and Painting Trades Workers not further defined
+         */
+        _332000, 
+        /**
+         * Floor Finisher
+         */
+        _332111, 
+        /**
+         * Painting Trades Worker
+         */
+        _332211, 
+        /**
+         * Glaziers, Plasterers and Tilers not further defined
+         */
+        _333000, 
+        /**
+         * Glazier
+         */
+        _333111, 
+        /**
+         * Plasterers not further defined
+         */
+        _333200, 
+        /**
+         * Fibrous Plasterer
+         */
+        _333211, 
+        /**
+         * Solid Plasterer
+         */
+        _333212, 
+        /**
+         * Roof Tiler
+         */
+        _333311, 
+        /**
+         * Wall and Floor Tiler
+         */
+        _333411, 
+        /**
+         * Plumbers not further defined
+         */
+        _334100, 
+        /**
+         * Plumber (General)
+         */
+        _334111, 
+        /**
+         * Airconditioning and Mechanical Services Plumber
+         */
+        _334112, 
+        /**
+         * Drainer
+         */
+        _334113, 
+        /**
+         * Gasfitter
+         */
+        _334114, 
+        /**
+         * Roof Plumber
+         */
+        _334115, 
+        /**
+         * Electrotechnology and Telecommunications Trades Workers not further defined
+         */
+        _340000, 
+        /**
+         * Electricians not further defined
+         */
+        _341100, 
+        /**
+         * Electrician (General)
+         */
+        _341111, 
+        /**
+         * Electrician (Special Class)
+         */
+        _341112, 
+        /**
+         * Lift Mechanic
+         */
+        _341113, 
+        /**
+         * Electronics and Telecommunications Trades Workers not further defined
+         */
+        _342000, 
+        /**
+         * Airconditioning and Refrigeration Mechanic
+         */
+        _342111, 
+        /**
+         * Electrical Distribution Trades Workers not further defined
+         */
+        _342200, 
+        /**
+         * Electrical Linesworker
+         */
+        _342211, 
+        /**
+         * Technical Cable Jointer
+         */
+        _342212, 
+        /**
+         * Electronics Trades Workers not further defined
+         */
+        _342300, 
+        /**
+         * Business Machine Mechanic
+         */
+        _342311, 
+        /**
+         * Communications Operator
+         */
+        _342312, 
+        /**
+         * Electronic Equipment Trades Worker
+         */
+        _342313, 
+        /**
+         * Electronic Instrument Trades Worker (General)
+         */
+        _342314, 
+        /**
+         * Electronic Instrument Trades Worker (Special Class)
+         */
+        _342315, 
+        /**
+         * Telecommunications Trades Workers not further defined
+         */
+        _342400, 
+        /**
+         * Cabler (Data and Telecommunications)
+         */
+        _342411, 
+        /**
+         * Telecommunications Cable Jointer
+         */
+        _342412, 
+        /**
+         * Telecommunications Linesworker
+         */
+        _342413, 
+        /**
+         * Telecommunications Technician
+         */
+        _342414, 
+        /**
+         * Food Trades Workers not further defined
+         */
+        _351000, 
+        /**
+         * Bakers and Pastrycooks not further defined
+         */
+        _351100, 
+        /**
+         * Baker
+         */
+        _351111, 
+        /**
+         * Pastrycook
+         */
+        _351112, 
+        /**
+         * Butcher or Smallgoods Maker
+         */
+        _351211, 
+        /**
+         * Chef
+         */
+        _351311, 
+        /**
+         * Cook
+         */
+        _351411, 
+        /**
+         * Skilled Animal and Horticultural Workers not further defined
+         */
+        _360000, 
+        /**
+         * Animal Attendants and Trainers, and Shearers not further defined
+         */
+        _361000, 
+        /**
+         * Animal Attendants and Trainers not further defined
+         */
+        _361100, 
+        /**
+         * Dog Handler or Trainer
+         */
+        _361111, 
+        /**
+         * Horse Trainer
+         */
+        _361112, 
+        /**
+         * Pet Groomer
+         */
+        _361113, 
+        /**
+         * Zookeeper
+         */
+        _361114, 
+        /**
+         * Animal Attendants and Trainers not elsewhere classified
+         */
+        _361199, 
+        /**
+         * Shearer
+         */
+        _361211, 
+        /**
+         * Veterinary Nurse
+         */
+        _361311, 
+        /**
+         * Horticultural Trades Workers not further defined
+         */
+        _362000, 
+        /**
+         * Florist
+         */
+        _362111, 
+        /**
+         * Gardeners not further defined
+         */
+        _362200, 
+        /**
+         * Gardener (General)
+         */
+        _362211, 
+        /**
+         * Arborist
+         */
+        _362212, 
+        /**
+         * Landscape Gardener
+         */
+        _362213, 
+        /**
+         * Greenkeeper
+         */
+        _362311, 
+        /**
+         * Nurseryperson
+         */
+        _362411, 
+        /**
+         * Other Technicians and Trades Workers not further defined
+         */
+        _390000, 
+        /**
+         * Hairdresser
+         */
+        _391111, 
+        /**
+         * Printing Trades Workers not further defined
+         */
+        _392000, 
+        /**
+         * Binders, Finishers and Screen Printers not further defined
+         */
+        _392100, 
+        /**
+         * Binder and Finisher
+         */
+        _392111, 
+        /**
+         * Screen Printer
+         */
+        _392112, 
+        /**
+         * Graphic Pre-press Trades Worker
+         */
+        _392211, 
+        /**
+         * Printers not further defined
+         */
+        _392300, 
+        /**
+         * Printing Machinist
+         */
+        _392311, 
+        /**
+         * Small Offset Printer
+         */
+        _392312, 
+        /**
+         * Textile, Clothing and Footwear Trades Workers not further defined
+         */
+        _393000, 
+        /**
+         * Canvas and Leather Goods Makers not further defined
+         */
+        _393100, 
+        /**
+         * Canvas Goods Maker
+         */
+        _393111, 
+        /**
+         * Leather Goods Maker
+         */
+        _393112, 
+        /**
+         * Sail Maker
+         */
+        _393113, 
+        /**
+         * Shoemaker
+         */
+        _393114, 
+        /**
+         * Clothing Trades Workers not further defined
+         */
+        _393200, 
+        /**
+         * Apparel Cutter
+         */
+        _393211, 
+        /**
+         * Clothing Patternmaker
+         */
+        _393212, 
+        /**
+         * Dressmaker or Tailor
+         */
+        _393213, 
+        /**
+         * Clothing Trades Workers not elsewhere classified
+         */
+        _393299, 
+        /**
+         * Upholsterer
+         */
+        _393311, 
+        /**
+         * Wood Trades Workers not further defined
+         */
+        _394000, 
+        /**
+         * Cabinetmaker
+         */
+        _394111, 
+        /**
+         * Wood Machinists and Other Wood Trades Workers not further defined
+         */
+        _394200, 
+        /**
+         * Furniture Finisher
+         */
+        _394211, 
+        /**
+         * Picture Framer
+         */
+        _394212, 
+        /**
+         * Wood Machinist
+         */
+        _394213, 
+        /**
+         * Wood Turner
+         */
+        _394214, 
+        /**
+         * Wood Machinists and Other Wood Trades Workers not elsewhere classified
+         */
+        _394299, 
+        /**
+         * Miscellaneous Technicians and Trades Workers not further defined
+         */
+        _399000, 
+        /**
+         * Boat Builders and Shipwrights not further defined
+         */
+        _399100, 
+        /**
+         * Boat Builder and Repairer
+         */
+        _399111, 
+        /**
+         * Shipwright
+         */
+        _399112, 
+        /**
+         * Chemical, Gas, Petroleum and Power Generation Plant Operators not further defined
+         */
+        _399200, 
+        /**
+         * Chemical Plant Operator
+         */
+        _399211, 
+        /**
+         * Gas or Petroleum Operator
+         */
+        _399212, 
+        /**
+         * Power Generation Plant Operator
+         */
+        _399213, 
+        /**
+         * Gallery, Library and Museum Technicians not further defined
+         */
+        _399300, 
+        /**
+         * Gallery or Museum Technician
+         */
+        _399311, 
+        /**
+         * Library Technician
+         */
+        _399312, 
+        /**
+         * Jeweller
+         */
+        _399411, 
+        /**
+         * Performing Arts Technicians not further defined
+         */
+        _399500, 
+        /**
+         * Broadcast Transmitter Operator
+         */
+        _399511, 
+        /**
+         * Camera Operator (Film, Television or Video)
+         */
+        _399512, 
+        /**
+         * Light Technician
+         */
+        _399513, 
+        /**
+         * Make Up Artist
+         */
+        _399514, 
+        /**
+         * Musical Instrument Maker or Repairer
+         */
+        _399515, 
+        /**
+         * Sound Technician
+         */
+        _399516, 
+        /**
+         * Television Equipment Operator
+         */
+        _399517, 
+        /**
+         * Performing Arts Technicians not elsewhere classified
+         */
+        _399599, 
+        /**
+         * Signwriter
+         */
+        _399611, 
+        /**
+         * Other Miscellaneous Technicians and Trades Workers not further defined
+         */
+        _399900, 
+        /**
+         * Diver
+         */
+        _399911, 
+        /**
+         * Interior Decorator
+         */
+        _399912, 
+        /**
+         * Optical Dispenser
+         */
+        _399913, 
+        /**
+         * Optical Mechanic
+         */
+        _399914, 
+        /**
+         * Photographer's Assistant
+         */
+        _399915, 
+        /**
+         * Plastics Technician
+         */
+        _399916, 
+        /**
+         * Wool Classer
+         */
+        _399917, 
+        /**
+         * Technicians and Trades Workers not elsewhere classified
+         */
+        _399999, 
+        /**
+         * Community and Personal Service Workers not further defined
+         */
+        _400000, 
+        /**
+         * Health and Welfare Support Workers not further defined
+         */
+        _411000, 
+        /**
+         * Ambulance Officers and Paramedics not further defined
+         */
+        _411100, 
+        /**
+         * Ambulance Officer
+         */
+        _411111, 
+        /**
+         * Intensive Care Ambulance Paramedic
+         */
+        _411112, 
+        /**
+         * Dental Hygienists, Technicians and Therapists not further defined
+         */
+        _411200, 
+        /**
+         * Dental Hygienist
+         */
+        _411211, 
+        /**
+         * Dental Prosthetist
+         */
+        _411212, 
+        /**
+         * Dental Technician
+         */
+        _411213, 
+        /**
+         * Dental Therapist
+         */
+        _411214, 
+        /**
+         * Diversional Therapist
+         */
+        _411311, 
+        /**
+         * Enrolled and Mothercraft Nurses not further defined
+         */
+        _411400, 
+        /**
+         * Enrolled Nurse
+         */
+        _411411, 
+        /**
+         * Mothercraft Nurse
+         */
+        _411412, 
+        /**
+         * Aboriginal and Torres Strait Islander Health Worker
+         */
+        _411511, 
+        /**
+         * Massage Therapist
+         */
+        _411611, 
+        /**
+         * Welfare Support Workers not further defined
+         */
+        _411700, 
+        /**
+         * Community Worker
+         */
+        _411711, 
+        /**
+         * Disabilities Services Officer
+         */
+        _411712, 
+        /**
+         * Family Support Worker
+         */
+        _411713, 
+        /**
+         * Parole or Probation Officer
+         */
+        _411714, 
+        /**
+         * Residential Care Officer
+         */
+        _411715, 
+        /**
+         * Youth Worker
+         */
+        _411716, 
+        /**
+         * Carers and Aides not further defined
+         */
+        _420000, 
+        /**
+         * Child Carers not further defined
+         */
+        _421100, 
+        /**
+         * Child Care Worker
+         */
+        _421111, 
+        /**
+         * Family Day Care Worker
+         */
+        _421112, 
+        /**
+         * Nanny
+         */
+        _421113, 
+        /**
+         * Out of School Hours Care Worker
+         */
+        _421114, 
+        /**
+         * Education Aides not further defined
+         */
+        _422100, 
+        /**
+         * Aboriginal and Torres Strait Islander Education Worker
+         */
+        _422111, 
+        /**
+         * Integration Aide
+         */
+        _422112, 
+        /**
+         * Preschool Aide
+         */
+        _422115, 
+        /**
+         * Teachers' Aide
+         */
+        _422116, 
+        /**
+         * Personal Carers and Assistants not further defined
+         */
+        _423000, 
+        /**
+         * Aged or Disabled Carer
+         */
+        _423111, 
+        /**
+         * Dental Assistant
+         */
+        _423211, 
+        /**
+         * Nursing Support and Personal Care Workers not further defined
+         */
+        _423300, 
+        /**
+         * Hospital Orderly
+         */
+        _423311, 
+        /**
+         * Nursing Support Worker
+         */
+        _423312, 
+        /**
+         * Personal Care Assistant
+         */
+        _423313, 
+        /**
+         * Therapy Aide
+         */
+        _423314, 
+        /**
+         * Special Care Workers not further defined
+         */
+        _423400, 
+        /**
+         * Child or Youth Residential Care Assistant
+         */
+        _423411, 
+        /**
+         * Hostel Parent
+         */
+        _423412, 
+        /**
+         * Refuge Worker
+         */
+        _423413, 
+        /**
+         * Hospitality Workers not further defined
+         */
+        _431000, 
+        /**
+         * Bar Attendants and Baristas not further defined
+         */
+        _431100, 
+        /**
+         * Bar Attendant
+         */
+        _431111, 
+        /**
+         * Barista
+         */
+        _431112, 
+        /**
+         * Cafe Worker
+         */
+        _431211, 
+        /**
+         * Gaming Worker
+         */
+        _431311, 
+        /**
+         * Hotel Service Manager
+         */
+        _431411, 
+        /**
+         * Waiter
+         */
+        _431511, 
+        /**
+         * Other Hospitality Workers not further defined
+         */
+        _431900, 
+        /**
+         * Bar Useful or Busser
+         */
+        _431911, 
+        /**
+         * Doorperson or Luggage Porter
+         */
+        _431912, 
+        /**
+         * Hospitality Workers not elsewhere classified
+         */
+        _431999, 
+        /**
+         * Protective Service Workers not further defined
+         */
+        _440000, 
+        /**
+         * Defence Force Members, Fire Fighters and Police not further defined
+         */
+        _441000, 
+        /**
+         * Defence Force Member - Other Ranks
+         */
+        _441111, 
+        /**
+         * Fire and Emergency Workers not further defined
+         */
+        _441200, 
+        /**
+         * Emergency Service Worker
+         */
+        _441211, 
+        /**
+         * Fire Fighter
+         */
+        _441212, 
+        /**
+         * Police not further defined
+         */
+        _441300, 
+        /**
+         * Detective
+         */
+        _441311, 
+        /**
+         * Police Officer
+         */
+        _441312, 
+        /**
+         * Prison and Security Officers not further defined
+         */
+        _442000, 
+        /**
+         * Prison Officer
+         */
+        _442111, 
+        /**
+         * Security Officers and Guards not further defined
+         */
+        _442200, 
+        /**
+         * Alarm, Security or Surveillance Monitor
+         */
+        _442211, 
+        /**
+         * Armoured Car Escort
+         */
+        _442212, 
+        /**
+         * Crowd Controller
+         */
+        _442213, 
+        /**
+         * Private Investigator
+         */
+        _442214, 
+        /**
+         * Retail Loss Prevention Officer
+         */
+        _442215, 
+        /**
+         * Security Consultant
+         */
+        _442216, 
+        /**
+         * Security Officer
+         */
+        _442217, 
+        /**
+         * Security Officers and Guards not elsewhere classified
+         */
+        _442299, 
+        /**
+         * Sports and Personal Service Workers not further defined
+         */
+        _450000, 
+        /**
+         * Personal Service and Travel Workers not further defined
+         */
+        _451000, 
+        /**
+         * Beauty Therapist
+         */
+        _451111, 
+        /**
+         * Driving Instructor
+         */
+        _451211, 
+        /**
+         * Funeral Workers not further defined
+         */
+        _451300, 
+        /**
+         * Funeral Director
+         */
+        _451311, 
+        /**
+         * Funeral Workers not elsewhere classified
+         */
+        _451399, 
+        /**
+         * Gallery, Museum and Tour Guides not further defined
+         */
+        _451400, 
+        /**
+         * Gallery or Museum Guide
+         */
+        _451411, 
+        /**
+         * Tour Guide
+         */
+        _451412, 
+        /**
+         * Personal Care Consultants not further defined
+         */
+        _451500, 
+        /**
+         * Natural Remedy Consultant
+         */
+        _451511, 
+        /**
+         * Weight Loss Consultant
+         */
+        _451512, 
+        /**
+         * Tourism and Travel Advisers not further defined
+         */
+        _451600, 
+        /**
+         * Tourist Information Officer
+         */
+        _451611, 
+        /**
+         * Travel Consultant
+         */
+        _451612, 
+        /**
+         * Travel Attendants not further defined
+         */
+        _451700, 
+        /**
+         * Flight Attendant
+         */
+        _451711, 
+        /**
+         * Travel Attendants not elsewhere classified
+         */
+        _451799, 
+        /**
+         * Other Personal Service Workers not further defined
+         */
+        _451800, 
+        /**
+         * Civil Celebrant
+         */
+        _451811, 
+        /**
+         * Hair or Beauty Salon Assistant
+         */
+        _451812, 
+        /**
+         * Sex Worker or Escort
+         */
+        _451813, 
+        /**
+         * Personal Service Workers not elsewhere classified
+         */
+        _451899, 
+        /**
+         * Sports and Fitness Workers not further defined
+         */
+        _452000, 
+        /**
+         * Fitness Instructor
+         */
+        _452111, 
+        /**
+         * Outdoor Adventure Guides not further defined
+         */
+        _452200, 
+        /**
+         * Bungy Jump Master
+         */
+        _452211, 
+        /**
+         * Fishing Guide
+         */
+        _452212, 
+        /**
+         * Hunting Guide
+         */
+        _452213, 
+        /**
+         * Mountain or Glacier Guide
+         */
+        _452214, 
+        /**
+         * Outdoor Adventure Instructor
+         */
+        _452215, 
+        /**
+         * Trekking Guide
+         */
+        _452216, 
+        /**
+         * Whitewater Rafting Guide
+         */
+        _452217, 
+        /**
+         * Outdoor Adventure Guides not elsewhere classified
+         */
+        _452299, 
+        /**
+         * Sports Coaches, Instructors and Officials not further defined
+         */
+        _452300, 
+        /**
+         * Diving Instructor (Open Water)
+         */
+        _452311, 
+        /**
+         * Gymnastics Coach or Instructor
+         */
+        _452312, 
+        /**
+         * Horse Riding Coach or Instructor
+         */
+        _452313, 
+        /**
+         * Snowsport Instructor
+         */
+        _452314, 
+        /**
+         * Swimming Coach or Instructor
+         */
+        _452315, 
+        /**
+         * Tennis Coach
+         */
+        _452316, 
+        /**
+         * Other Sports Coach or Instructor
+         */
+        _452317, 
+        /**
+         * Dog or Horse Racing Official
+         */
+        _452318, 
+        /**
+         * Sports Development Officer
+         */
+        _452321, 
+        /**
+         * Sports Umpire
+         */
+        _452322, 
+        /**
+         * Other Sports Official
+         */
+        _452323, 
+        /**
+         * Sportspersons not further defined
+         */
+        _452400, 
+        /**
+         * Footballer
+         */
+        _452411, 
+        /**
+         * Golfer
+         */
+        _452412, 
+        /**
+         * Jockey
+         */
+        _452413, 
+        /**
+         * Lifeguard
+         */
+        _452414, 
+        /**
+         * Sportspersons not elsewhere classified
+         */
+        _452499, 
+        /**
+         * Clerical and Administrative Workers not further defined
+         */
+        _500000, 
+        /**
+         * Office Managers and Program Administrators not further defined
+         */
+        _510000, 
+        /**
+         * Contract, Program and Project Administrators not further defined
+         */
+        _511100, 
+        /**
+         * Contract Administrator
+         */
+        _511111, 
+        /**
+         * Program or Project Administrator
+         */
+        _511112, 
+        /**
+         * Office and Practice Managers not further defined
+         */
+        _512000, 
+        /**
+         * Office Manager
+         */
+        _512111, 
+        /**
+         * Practice Managers not further defined
+         */
+        _512200, 
+        /**
+         * Health Practice Manager
+         */
+        _512211, 
+        /**
+         * Practice Managers not elsewhere classified
+         */
+        _512299, 
+        /**
+         * Personal Assistants and Secretaries not further defined
+         */
+        _521000, 
+        /**
+         * Personal Assistant
+         */
+        _521111, 
+        /**
+         * Secretaries not further defined
+         */
+        _521200, 
+        /**
+         * Secretary (General)
+         */
+        _521211, 
+        /**
+         * Legal Secretary
+         */
+        _521212, 
+        /**
+         * General Clerical Workers not further defined
+         */
+        _530000, 
+        /**
+         * General Clerk
+         */
+        _531111, 
+        /**
+         * Keyboard Operators not further defined
+         */
+        _532100, 
+        /**
+         * Data Entry Operator
+         */
+        _532111, 
+        /**
+         * Machine Shorthand Reporter
+         */
+        _532112, 
+        /**
+         * Word Processing Operator
+         */
+        _532113, 
+        /**
+         * Inquiry Clerks and Receptionists not further defined
+         */
+        _540000, 
+        /**
+         * Call or Contact Centre Information Clerks not further defined
+         */
+        _541000, 
+        /**
+         * Call or Contact Centre Workers not further defined
+         */
+        _541100, 
+        /**
+         * Call or Contact Centre Team Leader
+         */
+        _541111, 
+        /**
+         * Call or Contact Centre Operator
+         */
+        _541112, 
+        /**
+         * Inquiry Clerk
+         */
+        _541211, 
+        /**
+         * Receptionists not further defined
+         */
+        _542100, 
+        /**
+         * Receptionist (General)
+         */
+        _542111, 
+        /**
+         * Admissions Clerk
+         */
+        _542112, 
+        /**
+         * Hotel or Motel Receptionist
+         */
+        _542113, 
+        /**
+         * Medical Receptionist
+         */
+        _542114, 
+        /**
+         * Numerical Clerks not further defined
+         */
+        _550000, 
+        /**
+         * Accounting Clerks and Bookkeepers not further defined
+         */
+        _551000, 
+        /**
+         * Accounting Clerks not further defined
+         */
+        _551100, 
+        /**
+         * Accounts Clerk
+         */
+        _551111, 
+        /**
+         * Cost Clerk
+         */
+        _551112, 
+        /**
+         * Bookkeeper
+         */
+        _551211, 
+        /**
+         * Payroll Clerk
+         */
+        _551311, 
+        /**
+         * Financial and Insurance Clerks not further defined
+         */
+        _552000, 
+        /**
+         * Bank Worker
+         */
+        _552111, 
+        /**
+         * Credit or Loans Officer
+         */
+        _552211, 
+        /**
+         * Insurance, Money Market and Statistical Clerks not further defined
+         */
+        _552300, 
+        /**
+         * Bookmaker
+         */
+        _552311, 
+        /**
+         * Insurance Consultant
+         */
+        _552312, 
+        /**
+         * Money Market Clerk
+         */
+        _552313, 
+        /**
+         * Statistical Clerk
+         */
+        _552314, 
+        /**
+         * Clerical and Office Support Workers not further defined
+         */
+        _561000, 
+        /**
+         * Betting Clerks not further defined
+         */
+        _561100, 
+        /**
+         * Betting Agency Counter Clerk
+         */
+        _561111, 
+        /**
+         * Bookmaker's Clerk
+         */
+        _561112, 
+        /**
+         * Telephone Betting Clerk
+         */
+        _561113, 
+        /**
+         * Betting Clerks not elsewhere classified
+         */
+        _561199, 
+        /**
+         * Couriers and Postal Deliverers not further defined
+         */
+        _561200, 
+        /**
+         * Courier
+         */
+        _561211, 
+        /**
+         * Postal Delivery Officer
+         */
+        _561212, 
+        /**
+         * Filing or Registry Clerk
+         */
+        _561311, 
+        /**
+         * Mail Sorters not further defined
+         */
+        _561400, 
+        /**
+         * Mail Clerk
+         */
+        _561411, 
+        /**
+         * Postal Sorting Officer
+         */
+        _561412, 
+        /**
+         * Survey Interviewer
+         */
+        _561511, 
+        /**
+         * Switchboard Operator
+         */
+        _561611, 
+        /**
+         * Other Clerical and Office Support Workers not further defined
+         */
+        _561900, 
+        /**
+         * Classified Advertising Clerk
+         */
+        _561911, 
+        /**
+         * Meter Reader
+         */
+        _561912, 
+        /**
+         * Parking Inspector
+         */
+        _561913, 
+        /**
+         * Clerical and Office Support Workers not elsewhere classified
+         */
+        _561999, 
+        /**
+         * Other Clerical and Administrative Workers not further defined
+         */
+        _590000, 
+        /**
+         * Logistics Clerks not further defined
+         */
+        _591000, 
+        /**
+         * Purchasing and Supply Logistics Clerks not further defined
+         */
+        _591100, 
+        /**
+         * Order Clerk
+         */
+        _591111, 
+        /**
+         * Production Clerk
+         */
+        _591112, 
+        /**
+         * Purchasing Officer
+         */
+        _591113, 
+        /**
+         * Sales Clerk
+         */
+        _591114, 
+        /**
+         * Stock Clerk
+         */
+        _591115, 
+        /**
+         * Warehouse Administrator
+         */
+        _591116, 
+        /**
+         * Transport and Despatch Clerks not further defined
+         */
+        _591200, 
+        /**
+         * Despatching and Receiving Clerk
+         */
+        _591211, 
+        /**
+         * Import-Export Clerk
+         */
+        _591212, 
+        /**
+         * Miscellaneous Clerical and Administrative Workers not further defined
+         */
+        _599000, 
+        /**
+         * Conveyancers and Legal Executives not further defined
+         */
+        _599100, 
+        /**
+         * Conveyancer
+         */
+        _599111, 
+        /**
+         * Legal Executive
+         */
+        _599112, 
+        /**
+         * Court and Legal Clerks not further defined
+         */
+        _599200, 
+        /**
+         * Clerk of Court
+         */
+        _599211, 
+        /**
+         * Court Bailiff or Sheriff
+         */
+        _599212, 
+        /**
+         * Court Orderly
+         */
+        _599213, 
+        /**
+         * Law Clerk
+         */
+        _599214, 
+        /**
+         * Trust Officer
+         */
+        _599215, 
+        /**
+         * Debt Collector
+         */
+        _599311, 
+        /**
+         * Human Resource Clerk
+         */
+        _599411, 
+        /**
+         * Inspectors and Regulatory Officers not further defined
+         */
+        _599500, 
+        /**
+         * Customs Officer
+         */
+        _599511, 
+        /**
+         * Immigration Officer
+         */
+        _599512, 
+        /**
+         * Motor Vehicle Licence Examiner
+         */
+        _599513, 
+        /**
+         * Noxious Weeds and Pest Inspector
+         */
+        _599514, 
+        /**
+         * Social Security Assessor
+         */
+        _599515, 
+        /**
+         * Taxation Inspector
+         */
+        _599516, 
+        /**
+         * Train Examiner
+         */
+        _599517, 
+        /**
+         * Transport Operations Inspector
+         */
+        _599518, 
+        /**
+         * Water Inspector
+         */
+        _599521, 
+        /**
+         * Inspectors and Regulatory Officers not elsewhere classified
+         */
+        _599599, 
+        /**
+         * Insurance Investigators, Loss Adjusters and Risk Surveyors not further defined
+         */
+        _599600, 
+        /**
+         * Insurance Investigator
+         */
+        _599611, 
+        /**
+         * Insurance Loss Adjuster
+         */
+        _599612, 
+        /**
+         * Insurance Risk Surveyor
+         */
+        _599613, 
+        /**
+         * Library Assistant
+         */
+        _599711, 
+        /**
+         * Other Miscellaneous Clerical and Administrative Workers not further defined
+         */
+        _599900, 
+        /**
+         * Coding Clerk
+         */
+        _599911, 
+        /**
+         * Production Assistant (Film, Television, Radio or Stage)
+         */
+        _599912, 
+        /**
+         * Proof Reader
+         */
+        _599913, 
+        /**
+         * Radio Despatcher
+         */
+        _599914, 
+        /**
+         * Clerical and Administrative Workers not elsewhere classified
+         */
+        _599999, 
+        /**
+         * Sales Workers not further defined
+         */
+        _600000, 
+        /**
+         * Sales Representatives and Agents not further defined
+         */
+        _610000, 
+        /**
+         * Insurance Agents and Sales Representatives not further defined
+         */
+        _611000, 
+        /**
+         * Auctioneers, and Stock and Station Agents not further defined
+         */
+        _611100, 
+        /**
+         * Auctioneer
+         */
+        _611111, 
+        /**
+         * Stock and Station Agent
+         */
+        _611112, 
+        /**
+         * Insurance Agent
+         */
+        _611211, 
+        /**
+         * Sales Representatives not further defined
+         */
+        _611300, 
+        /**
+         * Sales Representative (Building and Plumbing Supplies)
+         */
+        _611311, 
+        /**
+         * Sales Representative (Business Services)
+         */
+        _611312, 
+        /**
+         * Sales Representative (Motor Vehicle Parts and Accessories)
+         */
+        _611313, 
+        /**
+         * Sales Representative (Personal and Household Goods)
+         */
+        _611314, 
+        /**
+         * Sales Representatives not elsewhere classified
+         */
+        _611399, 
+        /**
+         * Real Estate Sales Agents not further defined
+         */
+        _612100, 
+        /**
+         * Business Broker
+         */
+        _612111, 
+        /**
+         * Property Manager
+         */
+        _612112, 
+        /**
+         * Real Estate Agency Principal
+         */
+        _612113, 
+        /**
+         * Real Estate Agent
+         */
+        _612114, 
+        /**
+         * Real Estate Representative
+         */
+        _612115, 
+        /**
+         * Sales Assistants and Salespersons not further defined
+         */
+        _621000, 
+        /**
+         * Sales Assistant (General)
+         */
+        _621111, 
+        /**
+         * ICT Sales Assistant
+         */
+        _621211, 
+        /**
+         * Motor Vehicle and Vehicle Parts Salespersons not further defined
+         */
+        _621300, 
+        /**
+         * Motor Vehicle or Caravan Salesperson
+         */
+        _621311, 
+        /**
+         * Motor Vehicle Parts Interpreter
+         */
+        _621312, 
+        /**
+         * Pharmacy Sales Assistant
+         */
+        _621411, 
+        /**
+         * Retail Supervisor
+         */
+        _621511, 
+        /**
+         * Service Station Attendant
+         */
+        _621611, 
+        /**
+         * Street Vendors and Related Salespersons not further defined
+         */
+        _621700, 
+        /**
+         * Cash Van Salesperson
+         */
+        _621711, 
+        /**
+         * Door-to-door Salesperson
+         */
+        _621712, 
+        /**
+         * Street Vendor
+         */
+        _621713, 
+        /**
+         * Other Sales Assistants and Salespersons not further defined
+         */
+        _621900, 
+        /**
+         * Materials Recycler
+         */
+        _621911, 
+        /**
+         * Rental Salesperson
+         */
+        _621912, 
+        /**
+         * Sales Assistants and Salespersons not elsewhere classified
+         */
+        _621999, 
+        /**
+         * Sales Support Workers not further defined
+         */
+        _630000, 
+        /**
+         * Checkout Operators and Office Cashiers not further defined
+         */
+        _631100, 
+        /**
+         * Checkout Operator
+         */
+        _631111, 
+        /**
+         * Office Cashier
+         */
+        _631112, 
+        /**
+         * Miscellaneous Sales Support Workers not further defined
+         */
+        _639000, 
+        /**
+         * Models and Sales Demonstrators not further defined
+         */
+        _639100, 
+        /**
+         * Model
+         */
+        _639111, 
+        /**
+         * Sales Demonstrator
+         */
+        _639112, 
+        /**
+         * Retail and Wool Buyers not further defined
+         */
+        _639200, 
+        /**
+         * Retail Buyer
+         */
+        _639211, 
+        /**
+         * Wool Buyer
+         */
+        _639212, 
+        /**
+         * Telemarketer
+         */
+        _639311, 
+        /**
+         * Ticket Salespersons not further defined
+         */
+        _639400, 
+        /**
+         * Ticket Seller
+         */
+        _639411, 
+        /**
+         * Transport Conductor
+         */
+        _639412, 
+        /**
+         * Visual Merchandiser
+         */
+        _639511, 
+        /**
+         * Other Sales Support Worker
+         */
+        _639911, 
+        /**
+         * Machinery Operators and Drivers not further defined
+         */
+        _700000, 
+        /**
+         * Machine and Stationary Plant Operators not further defined
+         */
+        _710000, 
+        /**
+         * Machine Operators not further defined
+         */
+        _711000, 
+        /**
+         * Clay, Concrete, Glass and Stone Processing Machine Operators not further defined
+         */
+        _711100, 
+        /**
+         * Clay Products Machine Operator
+         */
+        _711111, 
+        /**
+         * Concrete Products Machine Operator
+         */
+        _711112, 
+        /**
+         * Glass Production Machine Operator
+         */
+        _711113, 
+        /**
+         * Stone Processing Machine Operator
+         */
+        _711114, 
+        /**
+         * Clay, Concrete, Glass and Stone Processing Machine Operators not elsewhere classified
+         */
+        _711199, 
+        /**
+         * Industrial Spraypainter
+         */
+        _711211, 
+        /**
+         * Paper and Wood Processing Machine Operators not further defined
+         */
+        _711300, 
+        /**
+         * Paper Products Machine Operator
+         */
+        _711311, 
+        /**
+         * Wood Processing Machine Operator
+         */
+        _711312, 
+        /**
+         * Photographic Developer and Printer
+         */
+        _711411, 
+        /**
+         * Plastics and Rubber Production Machine Operators not further defined
+         */
+        _711500, 
+        /**
+         * Plastic Cablemaking Machine Operator
+         */
+        _711511, 
+        /**
+         * Plastic Compounding and Reclamation Machine Operator
+         */
+        _711512, 
+        /**
+         * Plastics Fabricator or Welder
+         */
+        _711513, 
+        /**
+         * Plastics Production Machine Operator (General)
+         */
+        _711514, 
+        /**
+         * Reinforced Plastic and Composite Production Worker
+         */
+        _711515, 
+        /**
+         * Rubber Production Machine Operator
+         */
+        _711516, 
+        /**
+         * Plastics and Rubber Production Machine Operators not elsewhere classified
+         */
+        _711599, 
+        /**
+         * Sewing Machinist
+         */
+        _711611, 
+        /**
+         * Textile and Footwear Production Machine Operators not further defined
+         */
+        _711700, 
+        /**
+         * Footwear Production Machine Operator
+         */
+        _711711, 
+        /**
+         * Hide and Skin Processing Machine Operator
+         */
+        _711712, 
+        /**
+         * Knitting Machine Operator
+         */
+        _711713, 
+        /**
+         * Textile Dyeing and Finishing Machine Operator
+         */
+        _711714, 
+        /**
+         * Weaving Machine Operator
+         */
+        _711715, 
+        /**
+         * Yarn Carding and Spinning Machine Operator
+         */
+        _711716, 
+        /**
+         * Textile and Footwear Production Machine Operators not elsewhere classified
+         */
+        _711799, 
+        /**
+         * Other Machine Operators not further defined
+         */
+        _711900, 
+        /**
+         * Chemical Production Machine Operator
+         */
+        _711911, 
+        /**
+         * Motion Picture Projectionist
+         */
+        _711912, 
+        /**
+         * Sand Blaster
+         */
+        _711913, 
+        /**
+         * Sterilisation Technician
+         */
+        _711914, 
+        /**
+         * Machine Operators not elsewhere classified
+         */
+        _711999, 
+        /**
+         * Stationary Plant Operators not further defined
+         */
+        _712000, 
+        /**
+         * Crane, Hoist or Lift Operator
+         */
+        _712111, 
+        /**
+         * Drillers, Miners and Shot Firers not further defined
+         */
+        _712200, 
+        /**
+         * Driller
+         */
+        _712211, 
+        /**
+         * Miner
+         */
+        _712212, 
+        /**
+         * Shot Firer
+         */
+        _712213, 
+        /**
+         * Engineering Production Systems Worker
+         */
+        _712311, 
+        /**
+         * Other Stationary Plant Operators not further defined
+         */
+        _712900, 
+        /**
+         * Boiler or Engine Operator
+         */
+        _712911, 
+        /**
+         * Bulk Materials Handling Plant Operator
+         */
+        _712912, 
+        /**
+         * Cement Production Plant Operator
+         */
+        _712913, 
+        /**
+         * Concrete Batching Plant Operator
+         */
+        _712914, 
+        /**
+         * Concrete Pump Operator
+         */
+        _712915, 
+        /**
+         * Paper and Pulp Mill Operator
+         */
+        _712916, 
+        /**
+         * Railway Signal Operator
+         */
+        _712917, 
+        /**
+         * Train Controller
+         */
+        _712918, 
+        /**
+         * Waste Water or Water Plant Operator
+         */
+        _712921, 
+        /**
+         * Weighbridge Operator
+         */
+        _712922, 
+        /**
+         * Stationary Plant Operators not elsewhere classified
+         */
+        _712999, 
+        /**
+         * Mobile Plant Operators not further defined
+         */
+        _721000, 
+        /**
+         * Agricultural, Forestry and Horticultural Plant Operators not further defined
+         */
+        _721100, 
+        /**
+         * Agricultural and Horticultural Mobile Plant Operator
+         */
+        _721111, 
+        /**
+         * Logging Plant Operator
+         */
+        _721112, 
+        /**
+         * Earthmoving Plant Operators not further defined
+         */
+        _721200, 
+        /**
+         * Earthmoving Plant Operator (General)
+         */
+        _721211, 
+        /**
+         * Backhoe Operator
+         */
+        _721212, 
+        /**
+         * Bulldozer Operator
+         */
+        _721213, 
+        /**
+         * Excavator Operator
+         */
+        _721214, 
+        /**
+         * Grader Operator
+         */
+        _721215, 
+        /**
+         * Loader Operator
+         */
+        _721216, 
+        /**
+         * Forklift Driver
+         */
+        _721311, 
+        /**
+         * Other Mobile Plant Operators not further defined
+         */
+        _721900, 
+        /**
+         * Aircraft Baggage Handler and Airline Ground Crew
+         */
+        _721911, 
+        /**
+         * Linemarker
+         */
+        _721912, 
+        /**
+         * Paving Plant Operator
+         */
+        _721913, 
+        /**
+         * Railway Track Plant Operator
+         */
+        _721914, 
+        /**
+         * Road Roller Operator
+         */
+        _721915, 
+        /**
+         * Streetsweeper Operator
+         */
+        _721916, 
+        /**
+         * Mobile Plant Operators not elsewhere classified
+         */
+        _721999, 
+        /**
+         * Road and Rail Drivers not further defined
+         */
+        _730000, 
+        /**
+         * Automobile, Bus and Rail Drivers not further defined
+         */
+        _731000, 
+        /**
+         * Automobile Drivers not further defined
+         */
+        _731100, 
+        /**
+         * Chauffeur
+         */
+        _731111, 
+        /**
+         * Taxi Driver
+         */
+        _731112, 
+        /**
+         * Automobile Drivers not elsewhere classified
+         */
+        _731199, 
+        /**
+         * Bus and Coach Drivers not further defined
+         */
+        _731200, 
+        /**
+         * Bus Driver
+         */
+        _731211, 
+        /**
+         * Charter and Tour Bus Driver
+         */
+        _731212, 
+        /**
+         * Passenger Coach Driver
+         */
+        _731213, 
+        /**
+         * Train and Tram Drivers not further defined
+         */
+        _731300, 
+        /**
+         * Train Driver
+         */
+        _731311, 
+        /**
+         * Tram Driver
+         */
+        _731312, 
+        /**
+         * Delivery Driver
+         */
+        _732111, 
+        /**
+         * Truck Drivers not further defined
+         */
+        _733100, 
+        /**
+         * Truck Driver (General)
+         */
+        _733111, 
+        /**
+         * Aircraft Refueller
+         */
+        _733112, 
+        /**
+         * Furniture Removalist
+         */
+        _733113, 
+        /**
+         * Tanker Driver
+         */
+        _733114, 
+        /**
+         * Tow Truck Driver
+         */
+        _733115, 
+        /**
+         * Storeperson
+         */
+        _741111, 
+        /**
+         * Labourers not further defined
+         */
+        _800000, 
+        /**
+         * Cleaners and Laundry Workers not further defined
+         */
+        _811000, 
+        /**
+         * Car Detailer
+         */
+        _811111, 
+        /**
+         * Commercial Cleaner
+         */
+        _811211, 
+        /**
+         * Domestic Cleaner
+         */
+        _811311, 
+        /**
+         * Housekeepers not further defined
+         */
+        _811400, 
+        /**
+         * Commercial Housekeeper
+         */
+        _811411, 
+        /**
+         * Domestic Housekeeper
+         */
+        _811412, 
+        /**
+         * Laundry Workers not further defined
+         */
+        _811500, 
+        /**
+         * Laundry Worker (General)
+         */
+        _811511, 
+        /**
+         * Drycleaner
+         */
+        _811512, 
+        /**
+         * Ironer or Presser
+         */
+        _811513, 
+        /**
+         * Other Cleaners not further defined
+         */
+        _811600, 
+        /**
+         * Carpet Cleaner
+         */
+        _811611, 
+        /**
+         * Window Cleaner
+         */
+        _811612, 
+        /**
+         * Cleaners not elsewhere classified
+         */
+        _811699, 
+        /**
+         * Construction and Mining Labourers not further defined
+         */
+        _821000, 
+        /**
+         * Building and Plumbing Labourers not further defined
+         */
+        _821100, 
+        /**
+         * Builder's Labourer
+         */
+        _821111, 
+        /**
+         * Drainage, Sewerage and Stormwater Labourer
+         */
+        _821112, 
+        /**
+         * Earthmoving Labourer
+         */
+        _821113, 
+        /**
+         * Plumber's Assistant
+         */
+        _821114, 
+        /**
+         * Concreter
+         */
+        _821211, 
+        /**
+         * Fencer
+         */
+        _821311, 
+        /**
+         * Insulation and Home Improvement Installers not further defined
+         */
+        _821400, 
+        /**
+         * Building Insulation Installer
+         */
+        _821411, 
+        /**
+         * Home Improvement Installer
+         */
+        _821412, 
+        /**
+         * Paving and Surfacing Labourer
+         */
+        _821511, 
+        /**
+         * Railway Track Worker
+         */
+        _821611, 
+        /**
+         * Structural Steel Construction Workers not further defined
+         */
+        _821700, 
+        /**
+         * Construction Rigger
+         */
+        _821711, 
+        /**
+         * Scaffolder
+         */
+        _821712, 
+        /**
+         * Steel Fixer
+         */
+        _821713, 
+        /**
+         * Structural Steel Erector
+         */
+        _821714, 
+        /**
+         * Other Construction and Mining Labourers not further defined
+         */
+        _821900, 
+        /**
+         * Crane Chaser
+         */
+        _821911, 
+        /**
+         * Driller's Assistant
+         */
+        _821912, 
+        /**
+         * Lagger
+         */
+        _821913, 
+        /**
+         * Mining Support Worker
+         */
+        _821914, 
+        /**
+         * Surveyor's Assistant
+         */
+        _821915, 
+        /**
+         * Factory Process Workers not further defined
+         */
+        _830000, 
+        /**
+         * Food Process Workers not further defined
+         */
+        _831000, 
+        /**
+         * Food and Drink Factory Workers not further defined
+         */
+        _831100, 
+        /**
+         * Baking Factory Worker
+         */
+        _831111, 
+        /**
+         * Brewery Worker
+         */
+        _831112, 
+        /**
+         * Confectionery Maker
+         */
+        _831113, 
+        /**
+         * Dairy Products Maker
+         */
+        _831114, 
+        /**
+         * Fruit and Vegetable Factory Worker
+         */
+        _831115, 
+        /**
+         * Grain Mill Worker
+         */
+        _831116, 
+        /**
+         * Sugar Mill Worker
+         */
+        _831117, 
+        /**
+         * Winery Cellar Hand
+         */
+        _831118, 
+        /**
+         * Food and Drink Factory Workers not elsewhere classified
+         */
+        _831199, 
+        /**
+         * Meat Boners and Slicers, and Slaughterers not further defined
+         */
+        _831200, 
+        /**
+         * Meat Boner and Slicer
+         */
+        _831211, 
+        /**
+         * Slaughterer
+         */
+        _831212, 
+        /**
+         * Meat, Poultry and Seafood Process Workers not further defined
+         */
+        _831300, 
+        /**
+         * Meat Process Worker
+         */
+        _831311, 
+        /**
+         * Poultry Process Worker
+         */
+        _831312, 
+        /**
+         * Seafood Process Worker
+         */
+        _831313, 
+        /**
+         * Packers and Product Assemblers not further defined
+         */
+        _832000, 
+        /**
+         * Packers not further defined
+         */
+        _832100, 
+        /**
+         * Chocolate Packer
+         */
+        _832111, 
+        /**
+         * Container Filler
+         */
+        _832112, 
+        /**
+         * Fruit and Vegetable Packer
+         */
+        _832113, 
+        /**
+         * Meat Packer
+         */
+        _832114, 
+        /**
+         * Seafood Packer
+         */
+        _832115, 
+        /**
+         * Packers not elsewhere classified
+         */
+        _832199, 
+        /**
+         * Product Assembler
+         */
+        _832211, 
+        /**
+         * Miscellaneous Factory Process Workers not further defined
+         */
+        _839000, 
+        /**
+         * Metal Engineering Process Worker
+         */
+        _839111, 
+        /**
+         * Plastics and Rubber Factory Workers not further defined
+         */
+        _839200, 
+        /**
+         * Plastics Factory Worker
+         */
+        _839211, 
+        /**
+         * Rubber Factory Worker
+         */
+        _839212, 
+        /**
+         * Product Quality Controllers not further defined
+         */
+        _839300, 
+        /**
+         * Product Examiner
+         */
+        _839311, 
+        /**
+         * Product Grader
+         */
+        _839312, 
+        /**
+         * Product Tester
+         */
+        _839313, 
+        /**
+         * Timber and Wood Process Workers not further defined
+         */
+        _839400, 
+        /**
+         * Paper and Pulp Mill Worker
+         */
+        _839411, 
+        /**
+         * Sawmill or Timber Yard Worker
+         */
+        _839412, 
+        /**
+         * Wood and Wood Products Factory Worker
+         */
+        _839413, 
+        /**
+         * Other Factory Process Workers not further defined
+         */
+        _839900, 
+        /**
+         * Cement and Concrete Plant Worker
+         */
+        _839911, 
+        /**
+         * Chemical Plant Worker
+         */
+        _839912, 
+        /**
+         * Clay Processing Factory Worker
+         */
+        _839913, 
+        /**
+         * Fabric and Textile Factory Worker
+         */
+        _839914, 
+        /**
+         * Footwear Factory Worker
+         */
+        _839915, 
+        /**
+         * Glass Processing Worker
+         */
+        _839916, 
+        /**
+         * Hide and Skin Processing Worker
+         */
+        _839917, 
+        /**
+         * Factory Process Workers not elsewhere classified
+         */
+        _839999, 
+        /**
+         * Farm, Forestry and Garden Workers not further defined
+         */
+        _841000, 
+        /**
+         * Aquaculture Worker
+         */
+        _841111, 
+        /**
+         * Crop Farm Workers not further defined
+         */
+        _841200, 
+        /**
+         * Fruit or Nut Farm Worker
+         */
+        _841211, 
+        /**
+         * Fruit or Nut Picker
+         */
+        _841212, 
+        /**
+         * Grain, Oilseed or Pasture Farm Worker
+         */
+        _841213, 
+        /**
+         * Vegetable Farm Worker
+         */
+        _841214, 
+        /**
+         * Vegetable Picker
+         */
+        _841215, 
+        /**
+         * Vineyard Worker
+         */
+        _841216, 
+        /**
+         * Crop Farm Workers not elsewhere classified
+         */
+        _841299, 
+        /**
+         * Forestry and Logging Workers not further defined
+         */
+        _841300, 
+        /**
+         * Forestry Worker
+         */
+        _841311, 
+        /**
+         * Logging Assistant
+         */
+        _841312, 
+        /**
+         * Tree Faller
+         */
+        _841313, 
+        /**
+         * Garden and Nursery Labourers not further defined
+         */
+        _841400, 
+        /**
+         * Garden Labourer
+         */
+        _841411, 
+        /**
+         * Horticultural Nursery Assistant
+         */
+        _841412, 
+        /**
+         * Livestock Farm Workers not further defined
+         */
+        _841500, 
+        /**
+         * Beef Cattle Farm Worker
+         */
+        _841511, 
+        /**
+         * Dairy Cattle Farm Worker
+         */
+        _841512, 
+        /**
+         * Mixed Livestock Farm Worker
+         */
+        _841513, 
+        /**
+         * Poultry Farm Worker
+         */
+        _841514, 
+        /**
+         * Sheep Farm Worker
+         */
+        _841515, 
+        /**
+         * Stablehand
+         */
+        _841516, 
+        /**
+         * Wool Handler
+         */
+        _841517, 
+        /**
+         * Livestock Farm Workers not elsewhere classified
+         */
+        _841599, 
+        /**
+         * Mixed Crop and Livestock Farm Worker
+         */
+        _841611, 
+        /**
+         * Other Farm, Forestry and Garden Workers not further defined
+         */
+        _841900, 
+        /**
+         * Hunter-Trapper
+         */
+        _841911, 
+        /**
+         * Pest or Weed Controller
+         */
+        _841912, 
+        /**
+         * Farm, Forestry and Garden Workers not elsewhere classified
+         */
+        _841999, 
+        /**
+         * Food Preparation Assistants not further defined
+         */
+        _851000, 
+        /**
+         * Fast Food Cook
+         */
+        _851111, 
+        /**
+         * Food Trades Assistants not further defined
+         */
+        _851200, 
+        /**
+         * Pastrycook's Assistant
+         */
+        _851211, 
+        /**
+         * Food Trades Assistants not elsewhere classified
+         */
+        _851299, 
+        /**
+         * Kitchenhand
+         */
+        _851311, 
+        /**
+         * Other Labourers not further defined
+         */
+        _890000, 
+        /**
+         * Freight Handlers and Shelf Fillers not further defined
+         */
+        _891000, 
+        /**
+         * Freight and Furniture Handlers not further defined
+         */
+        _891100, 
+        /**
+         * Freight Handler (Rail or Road)
+         */
+        _891111, 
+        /**
+         * Truck Driver's Offsider
+         */
+        _891112, 
+        /**
+         * Waterside Worker
+         */
+        _891113, 
+        /**
+         * Shelf Filler
+         */
+        _891211, 
+        /**
+         * Miscellaneous Labourers not further defined
+         */
+        _899000, 
+        /**
+         * Caretaker
+         */
+        _899111, 
+        /**
+         * Deck and Fishing Hands not further defined
+         */
+        _899200, 
+        /**
+         * Deck Hand
+         */
+        _899211, 
+        /**
+         * Fishing Hand
+         */
+        _899212, 
+        /**
+         * Handyperson
+         */
+        _899311, 
+        /**
+         * Motor Vehicle Parts and Accessories Fitters not further defined
+         */
+        _899400, 
+        /**
+         * Motor Vehicle Parts and Accessories Fitter (General)
+         */
+        _899411, 
+        /**
+         * Autoglazier
+         */
+        _899412, 
+        /**
+         * Exhaust and Muffler Fitter
+         */
+        _899413, 
+        /**
+         * Radiator Fitter
+         */
+        _899414, 
+        /**
+         * Tyre Fitter
+         */
+        _899415, 
+        /**
+         * Printing Assistants and Table Workers not further defined
+         */
+        _899500, 
+        /**
+         * Printer's Assistant
+         */
+        _899511, 
+        /**
+         * Printing Table Worker
+         */
+        _899512, 
+        /**
+         * Recycling or Rubbish Collector
+         */
+        _899611, 
+        /**
+         * Vending Machine Attendant
+         */
+        _899711, 
+        /**
+         * Other Miscellaneous Labourers not further defined
+         */
+        _899900, 
+        /**
+         * Bicycle Mechanic
+         */
+        _899911, 
+        /**
+         * Car Park Attendant
+         */
+        _899912, 
+        /**
+         * Crossing Supervisor
+         */
+        _899913, 
+        /**
+         * Electrical or Telecommunications Trades Assistant
+         */
+        _899914, 
+        /**
+         * Leaflet or Newspaper Deliverer
+         */
+        _899915, 
+        /**
+         * Mechanic's Assistant
+         */
+        _899916, 
+        /**
+         * Railways Assistant
+         */
+        _899917, 
+        /**
+         * Sign Erector
+         */
+        _899918, 
+        /**
+         * Ticket Collector or Usher
+         */
+        _899921, 
+        /**
+         * Trolley Collector
+         */
+        _899922, 
+        /**
+         * Labourers not elsewhere classified
+         */
+        _899999, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AnzscoOccupations fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("100000".equals(codeString))
+          return _100000;
+        if ("111000".equals(codeString))
+          return _111000;
+        if ("111111".equals(codeString))
+          return _111111;
+        if ("111200".equals(codeString))
+          return _111200;
+        if ("111211".equals(codeString))
+          return _111211;
+        if ("111212".equals(codeString))
+          return _111212;
+        if ("111300".equals(codeString))
+          return _111300;
+        if ("111311".equals(codeString))
+          return _111311;
+        if ("111312".equals(codeString))
+          return _111312;
+        if ("111399".equals(codeString))
+          return _111399;
+        if ("121000".equals(codeString))
+          return _121000;
+        if ("121111".equals(codeString))
+          return _121111;
+        if ("121200".equals(codeString))
+          return _121200;
+        if ("121211".equals(codeString))
+          return _121211;
+        if ("121212".equals(codeString))
+          return _121212;
+        if ("121213".equals(codeString))
+          return _121213;
+        if ("121214".equals(codeString))
+          return _121214;
+        if ("121215".equals(codeString))
+          return _121215;
+        if ("121216".equals(codeString))
+          return _121216;
+        if ("121217".equals(codeString))
+          return _121217;
+        if ("121218".equals(codeString))
+          return _121218;
+        if ("121221".equals(codeString))
+          return _121221;
+        if ("121299".equals(codeString))
+          return _121299;
+        if ("121300".equals(codeString))
+          return _121300;
+        if ("121311".equals(codeString))
+          return _121311;
+        if ("121312".equals(codeString))
+          return _121312;
+        if ("121313".equals(codeString))
+          return _121313;
+        if ("121314".equals(codeString))
+          return _121314;
+        if ("121315".equals(codeString))
+          return _121315;
+        if ("121316".equals(codeString))
+          return _121316;
+        if ("121317".equals(codeString))
+          return _121317;
+        if ("121318".equals(codeString))
+          return _121318;
+        if ("121321".equals(codeString))
+          return _121321;
+        if ("121322".equals(codeString))
+          return _121322;
+        if ("121399".equals(codeString))
+          return _121399;
+        if ("121411".equals(codeString))
+          return _121411;
+        if ("130000".equals(codeString))
+          return _130000;
+        if ("131100".equals(codeString))
+          return _131100;
+        if ("131111".equals(codeString))
+          return _131111;
+        if ("131112".equals(codeString))
+          return _131112;
+        if ("132000".equals(codeString))
+          return _132000;
+        if ("132111".equals(codeString))
+          return _132111;
+        if ("132211".equals(codeString))
+          return _132211;
+        if ("132311".equals(codeString))
+          return _132311;
+        if ("132411".equals(codeString))
+          return _132411;
+        if ("132511".equals(codeString))
+          return _132511;
+        if ("133000".equals(codeString))
+          return _133000;
+        if ("133100".equals(codeString))
+          return _133100;
+        if ("133111".equals(codeString))
+          return _133111;
+        if ("133112".equals(codeString))
+          return _133112;
+        if ("133211".equals(codeString))
+          return _133211;
+        if ("133300".equals(codeString))
+          return _133300;
+        if ("133311".equals(codeString))
+          return _133311;
+        if ("133312".equals(codeString))
+          return _133312;
+        if ("133411".equals(codeString))
+          return _133411;
+        if ("133500".equals(codeString))
+          return _133500;
+        if ("133511".equals(codeString))
+          return _133511;
+        if ("133512".equals(codeString))
+          return _133512;
+        if ("133513".equals(codeString))
+          return _133513;
+        if ("133611".equals(codeString))
+          return _133611;
+        if ("134000".equals(codeString))
+          return _134000;
+        if ("134111".equals(codeString))
+          return _134111;
+        if ("134200".equals(codeString))
+          return _134200;
+        if ("134211".equals(codeString))
+          return _134211;
+        if ("134212".equals(codeString))
+          return _134212;
+        if ("134213".equals(codeString))
+          return _134213;
+        if ("134214".equals(codeString))
+          return _134214;
+        if ("134299".equals(codeString))
+          return _134299;
+        if ("134311".equals(codeString))
+          return _134311;
+        if ("134400".equals(codeString))
+          return _134400;
+        if ("134411".equals(codeString))
+          return _134411;
+        if ("134412".equals(codeString))
+          return _134412;
+        if ("134499".equals(codeString))
+          return _134499;
+        if ("135100".equals(codeString))
+          return _135100;
+        if ("135111".equals(codeString))
+          return _135111;
+        if ("135112".equals(codeString))
+          return _135112;
+        if ("135199".equals(codeString))
+          return _135199;
+        if ("139000".equals(codeString))
+          return _139000;
+        if ("139100".equals(codeString))
+          return _139100;
+        if ("139111".equals(codeString))
+          return _139111;
+        if ("139112".equals(codeString))
+          return _139112;
+        if ("139113".equals(codeString))
+          return _139113;
+        if ("139211".equals(codeString))
+          return _139211;
+        if ("139900".equals(codeString))
+          return _139900;
+        if ("139911".equals(codeString))
+          return _139911;
+        if ("139912".equals(codeString))
+          return _139912;
+        if ("139913".equals(codeString))
+          return _139913;
+        if ("139914".equals(codeString))
+          return _139914;
+        if ("139915".equals(codeString))
+          return _139915;
+        if ("139999".equals(codeString))
+          return _139999;
+        if ("140000".equals(codeString))
+          return _140000;
+        if ("141000".equals(codeString))
+          return _141000;
+        if ("141111".equals(codeString))
+          return _141111;
+        if ("141211".equals(codeString))
+          return _141211;
+        if ("141311".equals(codeString))
+          return _141311;
+        if ("141411".equals(codeString))
+          return _141411;
+        if ("141900".equals(codeString))
+          return _141900;
+        if ("141911".equals(codeString))
+          return _141911;
+        if ("141999".equals(codeString))
+          return _141999;
+        if ("142100".equals(codeString))
+          return _142100;
+        if ("142111".equals(codeString))
+          return _142111;
+        if ("142112".equals(codeString))
+          return _142112;
+        if ("142113".equals(codeString))
+          return _142113;
+        if ("142114".equals(codeString))
+          return _142114;
+        if ("142115".equals(codeString))
+          return _142115;
+        if ("142116".equals(codeString))
+          return _142116;
+        if ("149000".equals(codeString))
+          return _149000;
+        if ("149100".equals(codeString))
+          return _149100;
+        if ("149111".equals(codeString))
+          return _149111;
+        if ("149112".equals(codeString))
+          return _149112;
+        if ("149113".equals(codeString))
+          return _149113;
+        if ("149200".equals(codeString))
+          return _149200;
+        if ("149211".equals(codeString))
+          return _149211;
+        if ("149212".equals(codeString))
+          return _149212;
+        if ("149311".equals(codeString))
+          return _149311;
+        if ("149400".equals(codeString))
+          return _149400;
+        if ("149411".equals(codeString))
+          return _149411;
+        if ("149412".equals(codeString))
+          return _149412;
+        if ("149413".equals(codeString))
+          return _149413;
+        if ("149900".equals(codeString))
+          return _149900;
+        if ("149911".equals(codeString))
+          return _149911;
+        if ("149912".equals(codeString))
+          return _149912;
+        if ("149913".equals(codeString))
+          return _149913;
+        if ("149914".equals(codeString))
+          return _149914;
+        if ("149999".equals(codeString))
+          return _149999;
+        if ("200000".equals(codeString))
+          return _200000;
+        if ("210000".equals(codeString))
+          return _210000;
+        if ("211000".equals(codeString))
+          return _211000;
+        if ("211100".equals(codeString))
+          return _211100;
+        if ("211111".equals(codeString))
+          return _211111;
+        if ("211112".equals(codeString))
+          return _211112;
+        if ("211113".equals(codeString))
+          return _211113;
+        if ("211199".equals(codeString))
+          return _211199;
+        if ("211200".equals(codeString))
+          return _211200;
+        if ("211211".equals(codeString))
+          return _211211;
+        if ("211212".equals(codeString))
+          return _211212;
+        if ("211213".equals(codeString))
+          return _211213;
+        if ("211214".equals(codeString))
+          return _211214;
+        if ("211299".equals(codeString))
+          return _211299;
+        if ("211311".equals(codeString))
+          return _211311;
+        if ("211400".equals(codeString))
+          return _211400;
+        if ("211411".equals(codeString))
+          return _211411;
+        if ("211412".equals(codeString))
+          return _211412;
+        if ("211413".equals(codeString))
+          return _211413;
+        if ("211499".equals(codeString))
+          return _211499;
+        if ("212000".equals(codeString))
+          return _212000;
+        if ("212100".equals(codeString))
+          return _212100;
+        if ("212111".equals(codeString))
+          return _212111;
+        if ("212112".equals(codeString))
+          return _212112;
+        if ("212113".equals(codeString))
+          return _212113;
+        if ("212114".equals(codeString))
+          return _212114;
+        if ("212200".equals(codeString))
+          return _212200;
+        if ("212211".equals(codeString))
+          return _212211;
+        if ("212212".equals(codeString))
+          return _212212;
+        if ("212300".equals(codeString))
+          return _212300;
+        if ("212311".equals(codeString))
+          return _212311;
+        if ("212312".equals(codeString))
+          return _212312;
+        if ("212313".equals(codeString))
+          return _212313;
+        if ("212314".equals(codeString))
+          return _212314;
+        if ("212315".equals(codeString))
+          return _212315;
+        if ("212316".equals(codeString))
+          return _212316;
+        if ("212317".equals(codeString))
+          return _212317;
+        if ("212318".equals(codeString))
+          return _212318;
+        if ("212399".equals(codeString))
+          return _212399;
+        if ("212400".equals(codeString))
+          return _212400;
+        if ("212411".equals(codeString))
+          return _212411;
+        if ("212412".equals(codeString))
+          return _212412;
+        if ("212413".equals(codeString))
+          return _212413;
+        if ("212414".equals(codeString))
+          return _212414;
+        if ("212415".equals(codeString))
+          return _212415;
+        if ("212416".equals(codeString))
+          return _212416;
+        if ("212499".equals(codeString))
+          return _212499;
+        if ("220000".equals(codeString))
+          return _220000;
+        if ("221000".equals(codeString))
+          return _221000;
+        if ("221100".equals(codeString))
+          return _221100;
+        if ("221111".equals(codeString))
+          return _221111;
+        if ("221112".equals(codeString))
+          return _221112;
+        if ("221113".equals(codeString))
+          return _221113;
+        if ("221200".equals(codeString))
+          return _221200;
+        if ("221211".equals(codeString))
+          return _221211;
+        if ("221212".equals(codeString))
+          return _221212;
+        if ("221213".equals(codeString))
+          return _221213;
+        if ("221214".equals(codeString))
+          return _221214;
+        if ("222000".equals(codeString))
+          return _222000;
+        if ("222100".equals(codeString))
+          return _222100;
+        if ("222111".equals(codeString))
+          return _222111;
+        if ("222112".equals(codeString))
+          return _222112;
+        if ("222113".equals(codeString))
+          return _222113;
+        if ("222199".equals(codeString))
+          return _222199;
+        if ("222200".equals(codeString))
+          return _222200;
+        if ("222211".equals(codeString))
+          return _222211;
+        if ("222212".equals(codeString))
+          return _222212;
+        if ("222213".equals(codeString))
+          return _222213;
+        if ("222299".equals(codeString))
+          return _222299;
+        if ("222300".equals(codeString))
+          return _222300;
+        if ("222311".equals(codeString))
+          return _222311;
+        if ("222312".equals(codeString))
+          return _222312;
+        if ("223000".equals(codeString))
+          return _223000;
+        if ("223100".equals(codeString))
+          return _223100;
+        if ("223111".equals(codeString))
+          return _223111;
+        if ("223112".equals(codeString))
+          return _223112;
+        if ("223113".equals(codeString))
+          return _223113;
+        if ("223211".equals(codeString))
+          return _223211;
+        if ("223311".equals(codeString))
+          return _223311;
+        if ("224000".equals(codeString))
+          return _224000;
+        if ("224100".equals(codeString))
+          return _224100;
+        if ("224111".equals(codeString))
+          return _224111;
+        if ("224112".equals(codeString))
+          return _224112;
+        if ("224113".equals(codeString))
+          return _224113;
+        if ("224200".equals(codeString))
+          return _224200;
+        if ("224211".equals(codeString))
+          return _224211;
+        if ("224212".equals(codeString))
+          return _224212;
+        if ("224213".equals(codeString))
+          return _224213;
+        if ("224214".equals(codeString))
+          return _224214;
+        if ("224311".equals(codeString))
+          return _224311;
+        if ("224400".equals(codeString))
+          return _224400;
+        if ("224411".equals(codeString))
+          return _224411;
+        if ("224412".equals(codeString))
+          return _224412;
+        if ("224500".equals(codeString))
+          return _224500;
+        if ("224511".equals(codeString))
+          return _224511;
+        if ("224512".equals(codeString))
+          return _224512;
+        if ("224611".equals(codeString))
+          return _224611;
+        if ("224700".equals(codeString))
+          return _224700;
+        if ("224711".equals(codeString))
+          return _224711;
+        if ("224712".equals(codeString))
+          return _224712;
+        if ("224900".equals(codeString))
+          return _224900;
+        if ("224911".equals(codeString))
+          return _224911;
+        if ("224912".equals(codeString))
+          return _224912;
+        if ("224913".equals(codeString))
+          return _224913;
+        if ("224914".equals(codeString))
+          return _224914;
+        if ("224999".equals(codeString))
+          return _224999;
+        if ("225000".equals(codeString))
+          return _225000;
+        if ("225100".equals(codeString))
+          return _225100;
+        if ("225111".equals(codeString))
+          return _225111;
+        if ("225112".equals(codeString))
+          return _225112;
+        if ("225113".equals(codeString))
+          return _225113;
+        if ("225200".equals(codeString))
+          return _225200;
+        if ("225211".equals(codeString))
+          return _225211;
+        if ("225212".equals(codeString))
+          return _225212;
+        if ("225213".equals(codeString))
+          return _225213;
+        if ("225311".equals(codeString))
+          return _225311;
+        if ("225400".equals(codeString))
+          return _225400;
+        if ("225411".equals(codeString))
+          return _225411;
+        if ("225412".equals(codeString))
+          return _225412;
+        if ("225499".equals(codeString))
+          return _225499;
+        if ("230000".equals(codeString))
+          return _230000;
+        if ("231000".equals(codeString))
+          return _231000;
+        if ("231100".equals(codeString))
+          return _231100;
+        if ("231111".equals(codeString))
+          return _231111;
+        if ("231112".equals(codeString))
+          return _231112;
+        if ("231113".equals(codeString))
+          return _231113;
+        if ("231114".equals(codeString))
+          return _231114;
+        if ("231199".equals(codeString))
+          return _231199;
+        if ("231200".equals(codeString))
+          return _231200;
+        if ("231211".equals(codeString))
+          return _231211;
+        if ("231212".equals(codeString))
+          return _231212;
+        if ("231213".equals(codeString))
+          return _231213;
+        if ("231214".equals(codeString))
+          return _231214;
+        if ("231215".equals(codeString))
+          return _231215;
+        if ("231299".equals(codeString))
+          return _231299;
+        if ("232000".equals(codeString))
+          return _232000;
+        if ("232100".equals(codeString))
+          return _232100;
+        if ("232111".equals(codeString))
+          return _232111;
+        if ("232112".equals(codeString))
+          return _232112;
+        if ("232200".equals(codeString))
+          return _232200;
+        if ("232211".equals(codeString))
+          return _232211;
+        if ("232212".equals(codeString))
+          return _232212;
+        if ("232300".equals(codeString))
+          return _232300;
+        if ("232311".equals(codeString))
+          return _232311;
+        if ("232312".equals(codeString))
+          return _232312;
+        if ("232313".equals(codeString))
+          return _232313;
+        if ("232400".equals(codeString))
+          return _232400;
+        if ("232411".equals(codeString))
+          return _232411;
+        if ("232412".equals(codeString))
+          return _232412;
+        if ("232413".equals(codeString))
+          return _232413;
+        if ("232414".equals(codeString))
+          return _232414;
+        if ("232511".equals(codeString))
+          return _232511;
+        if ("232611".equals(codeString))
+          return _232611;
+        if ("233000".equals(codeString))
+          return _233000;
+        if ("233100".equals(codeString))
+          return _233100;
+        if ("233111".equals(codeString))
+          return _233111;
+        if ("233112".equals(codeString))
+          return _233112;
+        if ("233200".equals(codeString))
+          return _233200;
+        if ("233211".equals(codeString))
+          return _233211;
+        if ("233212".equals(codeString))
+          return _233212;
+        if ("233213".equals(codeString))
+          return _233213;
+        if ("233214".equals(codeString))
+          return _233214;
+        if ("233215".equals(codeString))
+          return _233215;
+        if ("233311".equals(codeString))
+          return _233311;
+        if ("233411".equals(codeString))
+          return _233411;
+        if ("233500".equals(codeString))
+          return _233500;
+        if ("233511".equals(codeString))
+          return _233511;
+        if ("233512".equals(codeString))
+          return _233512;
+        if ("233513".equals(codeString))
+          return _233513;
+        if ("233600".equals(codeString))
+          return _233600;
+        if ("233611".equals(codeString))
+          return _233611;
+        if ("233612".equals(codeString))
+          return _233612;
+        if ("233900".equals(codeString))
+          return _233900;
+        if ("233911".equals(codeString))
+          return _233911;
+        if ("233912".equals(codeString))
+          return _233912;
+        if ("233913".equals(codeString))
+          return _233913;
+        if ("233914".equals(codeString))
+          return _233914;
+        if ("233915".equals(codeString))
+          return _233915;
+        if ("233916".equals(codeString))
+          return _233916;
+        if ("233999".equals(codeString))
+          return _233999;
+        if ("234000".equals(codeString))
+          return _234000;
+        if ("234100".equals(codeString))
+          return _234100;
+        if ("234111".equals(codeString))
+          return _234111;
+        if ("234112".equals(codeString))
+          return _234112;
+        if ("234113".equals(codeString))
+          return _234113;
+        if ("234200".equals(codeString))
+          return _234200;
+        if ("234211".equals(codeString))
+          return _234211;
+        if ("234212".equals(codeString))
+          return _234212;
+        if ("234213".equals(codeString))
+          return _234213;
+        if ("234300".equals(codeString))
+          return _234300;
+        if ("234311".equals(codeString))
+          return _234311;
+        if ("234312".equals(codeString))
+          return _234312;
+        if ("234313".equals(codeString))
+          return _234313;
+        if ("234314".equals(codeString))
+          return _234314;
+        if ("234399".equals(codeString))
+          return _234399;
+        if ("234400".equals(codeString))
+          return _234400;
+        if ("234411".equals(codeString))
+          return _234411;
+        if ("234412".equals(codeString))
+          return _234412;
+        if ("234500".equals(codeString))
+          return _234500;
+        if ("234511".equals(codeString))
+          return _234511;
+        if ("234512".equals(codeString))
+          return _234512;
+        if ("234513".equals(codeString))
+          return _234513;
+        if ("234514".equals(codeString))
+          return _234514;
+        if ("234515".equals(codeString))
+          return _234515;
+        if ("234516".equals(codeString))
+          return _234516;
+        if ("234517".equals(codeString))
+          return _234517;
+        if ("234518".equals(codeString))
+          return _234518;
+        if ("234599".equals(codeString))
+          return _234599;
+        if ("234611".equals(codeString))
+          return _234611;
+        if ("234711".equals(codeString))
+          return _234711;
+        if ("234900".equals(codeString))
+          return _234900;
+        if ("234911".equals(codeString))
+          return _234911;
+        if ("234912".equals(codeString))
+          return _234912;
+        if ("234913".equals(codeString))
+          return _234913;
+        if ("234914".equals(codeString))
+          return _234914;
+        if ("234999".equals(codeString))
+          return _234999;
+        if ("240000".equals(codeString))
+          return _240000;
+        if ("241000".equals(codeString))
+          return _241000;
+        if ("241111".equals(codeString))
+          return _241111;
+        if ("241213".equals(codeString))
+          return _241213;
+        if ("241311".equals(codeString))
+          return _241311;
+        if ("241411".equals(codeString))
+          return _241411;
+        if ("241500".equals(codeString))
+          return _241500;
+        if ("241511".equals(codeString))
+          return _241511;
+        if ("241512".equals(codeString))
+          return _241512;
+        if ("241513".equals(codeString))
+          return _241513;
+        if ("241599".equals(codeString))
+          return _241599;
+        if ("242000".equals(codeString))
+          return _242000;
+        if ("242100".equals(codeString))
+          return _242100;
+        if ("242111".equals(codeString))
+          return _242111;
+        if ("242112".equals(codeString))
+          return _242112;
+        if ("242211".equals(codeString))
+          return _242211;
+        if ("249000".equals(codeString))
+          return _249000;
+        if ("249100".equals(codeString))
+          return _249100;
+        if ("249111".equals(codeString))
+          return _249111;
+        if ("249112".equals(codeString))
+          return _249112;
+        if ("249200".equals(codeString))
+          return _249200;
+        if ("249211".equals(codeString))
+          return _249211;
+        if ("249212".equals(codeString))
+          return _249212;
+        if ("249213".equals(codeString))
+          return _249213;
+        if ("249214".equals(codeString))
+          return _249214;
+        if ("249299".equals(codeString))
+          return _249299;
+        if ("249311".equals(codeString))
+          return _249311;
+        if ("250000".equals(codeString))
+          return _250000;
+        if ("251000".equals(codeString))
+          return _251000;
+        if ("251111".equals(codeString))
+          return _251111;
+        if ("251200".equals(codeString))
+          return _251200;
+        if ("251211".equals(codeString))
+          return _251211;
+        if ("251212".equals(codeString))
+          return _251212;
+        if ("251213".equals(codeString))
+          return _251213;
+        if ("251214".equals(codeString))
+          return _251214;
+        if ("251300".equals(codeString))
+          return _251300;
+        if ("251311".equals(codeString))
+          return _251311;
+        if ("251312".equals(codeString))
+          return _251312;
+        if ("251400".equals(codeString))
+          return _251400;
+        if ("251411".equals(codeString))
+          return _251411;
+        if ("251412".equals(codeString))
+          return _251412;
+        if ("251500".equals(codeString))
+          return _251500;
+        if ("251511".equals(codeString))
+          return _251511;
+        if ("251512".equals(codeString))
+          return _251512;
+        if ("251513".equals(codeString))
+          return _251513;
+        if ("251900".equals(codeString))
+          return _251900;
+        if ("251911".equals(codeString))
+          return _251911;
+        if ("251912".equals(codeString))
+          return _251912;
+        if ("251999".equals(codeString))
+          return _251999;
+        if ("252000".equals(codeString))
+          return _252000;
+        if ("252100".equals(codeString))
+          return _252100;
+        if ("252111".equals(codeString))
+          return _252111;
+        if ("252112".equals(codeString))
+          return _252112;
+        if ("252200".equals(codeString))
+          return _252200;
+        if ("252211".equals(codeString))
+          return _252211;
+        if ("252212".equals(codeString))
+          return _252212;
+        if ("252213".equals(codeString))
+          return _252213;
+        if ("252214".equals(codeString))
+          return _252214;
+        if ("252299".equals(codeString))
+          return _252299;
+        if ("252300".equals(codeString))
+          return _252300;
+        if ("252311".equals(codeString))
+          return _252311;
+        if ("252312".equals(codeString))
+          return _252312;
+        if ("252411".equals(codeString))
+          return _252411;
+        if ("252511".equals(codeString))
+          return _252511;
+        if ("252611".equals(codeString))
+          return _252611;
+        if ("252700".equals(codeString))
+          return _252700;
+        if ("252711".equals(codeString))
+          return _252711;
+        if ("252712".equals(codeString))
+          return _252712;
+        if ("253000".equals(codeString))
+          return _253000;
+        if ("253100".equals(codeString))
+          return _253100;
+        if ("253111".equals(codeString))
+          return _253111;
+        if ("253112".equals(codeString))
+          return _253112;
+        if ("253211".equals(codeString))
+          return _253211;
+        if ("253300".equals(codeString))
+          return _253300;
+        if ("253311".equals(codeString))
+          return _253311;
+        if ("253312".equals(codeString))
+          return _253312;
+        if ("253313".equals(codeString))
+          return _253313;
+        if ("253314".equals(codeString))
+          return _253314;
+        if ("253315".equals(codeString))
+          return _253315;
+        if ("253316".equals(codeString))
+          return _253316;
+        if ("253317".equals(codeString))
+          return _253317;
+        if ("253318".equals(codeString))
+          return _253318;
+        if ("253321".equals(codeString))
+          return _253321;
+        if ("253322".equals(codeString))
+          return _253322;
+        if ("253323".equals(codeString))
+          return _253323;
+        if ("253324".equals(codeString))
+          return _253324;
+        if ("253399".equals(codeString))
+          return _253399;
+        if ("253411".equals(codeString))
+          return _253411;
+        if ("253500".equals(codeString))
+          return _253500;
+        if ("253511".equals(codeString))
+          return _253511;
+        if ("253512".equals(codeString))
+          return _253512;
+        if ("253513".equals(codeString))
+          return _253513;
+        if ("253514".equals(codeString))
+          return _253514;
+        if ("253515".equals(codeString))
+          return _253515;
+        if ("253516".equals(codeString))
+          return _253516;
+        if ("253517".equals(codeString))
+          return _253517;
+        if ("253518".equals(codeString))
+          return _253518;
+        if ("253521".equals(codeString))
+          return _253521;
+        if ("253900".equals(codeString))
+          return _253900;
+        if ("253911".equals(codeString))
+          return _253911;
+        if ("253912".equals(codeString))
+          return _253912;
+        if ("253913".equals(codeString))
+          return _253913;
+        if ("253914".equals(codeString))
+          return _253914;
+        if ("253915".equals(codeString))
+          return _253915;
+        if ("253916".equals(codeString))
+          return _253916;
+        if ("253999".equals(codeString))
+          return _253999;
+        if ("254000".equals(codeString))
+          return _254000;
+        if ("254111".equals(codeString))
+          return _254111;
+        if ("254200".equals(codeString))
+          return _254200;
+        if ("254211".equals(codeString))
+          return _254211;
+        if ("254212".equals(codeString))
+          return _254212;
+        if ("254311".equals(codeString))
+          return _254311;
+        if ("254400".equals(codeString))
+          return _254400;
+        if ("254411".equals(codeString))
+          return _254411;
+        if ("254412".equals(codeString))
+          return _254412;
+        if ("254413".equals(codeString))
+          return _254413;
+        if ("254414".equals(codeString))
+          return _254414;
+        if ("254415".equals(codeString))
+          return _254415;
+        if ("254416".equals(codeString))
+          return _254416;
+        if ("254417".equals(codeString))
+          return _254417;
+        if ("254418".equals(codeString))
+          return _254418;
+        if ("254421".equals(codeString))
+          return _254421;
+        if ("254422".equals(codeString))
+          return _254422;
+        if ("254423".equals(codeString))
+          return _254423;
+        if ("254424".equals(codeString))
+          return _254424;
+        if ("254499".equals(codeString))
+          return _254499;
+        if ("260000".equals(codeString))
+          return _260000;
+        if ("261000".equals(codeString))
+          return _261000;
+        if ("261100".equals(codeString))
+          return _261100;
+        if ("261111".equals(codeString))
+          return _261111;
+        if ("261112".equals(codeString))
+          return _261112;
+        if ("261200".equals(codeString))
+          return _261200;
+        if ("261211".equals(codeString))
+          return _261211;
+        if ("261212".equals(codeString))
+          return _261212;
+        if ("261300".equals(codeString))
+          return _261300;
+        if ("261311".equals(codeString))
+          return _261311;
+        if ("261312".equals(codeString))
+          return _261312;
+        if ("261313".equals(codeString))
+          return _261313;
+        if ("261399".equals(codeString))
+          return _261399;
+        if ("262100".equals(codeString))
+          return _262100;
+        if ("262111".equals(codeString))
+          return _262111;
+        if ("262112".equals(codeString))
+          return _262112;
+        if ("262113".equals(codeString))
+          return _262113;
+        if ("263000".equals(codeString))
+          return _263000;
+        if ("263100".equals(codeString))
+          return _263100;
+        if ("263111".equals(codeString))
+          return _263111;
+        if ("263112".equals(codeString))
+          return _263112;
+        if ("263113".equals(codeString))
+          return _263113;
+        if ("263200".equals(codeString))
+          return _263200;
+        if ("263211".equals(codeString))
+          return _263211;
+        if ("263212".equals(codeString))
+          return _263212;
+        if ("263213".equals(codeString))
+          return _263213;
+        if ("263299".equals(codeString))
+          return _263299;
+        if ("263300".equals(codeString))
+          return _263300;
+        if ("263311".equals(codeString))
+          return _263311;
+        if ("263312".equals(codeString))
+          return _263312;
+        if ("270000".equals(codeString))
+          return _270000;
+        if ("271000".equals(codeString))
+          return _271000;
+        if ("271111".equals(codeString))
+          return _271111;
+        if ("271200".equals(codeString))
+          return _271200;
+        if ("271211".equals(codeString))
+          return _271211;
+        if ("271212".equals(codeString))
+          return _271212;
+        if ("271213".equals(codeString))
+          return _271213;
+        if ("271299".equals(codeString))
+          return _271299;
+        if ("271311".equals(codeString))
+          return _271311;
+        if ("272000".equals(codeString))
+          return _272000;
+        if ("272100".equals(codeString))
+          return _272100;
+        if ("272111".equals(codeString))
+          return _272111;
+        if ("272112".equals(codeString))
+          return _272112;
+        if ("272113".equals(codeString))
+          return _272113;
+        if ("272114".equals(codeString))
+          return _272114;
+        if ("272115".equals(codeString))
+          return _272115;
+        if ("272199".equals(codeString))
+          return _272199;
+        if ("272211".equals(codeString))
+          return _272211;
+        if ("272300".equals(codeString))
+          return _272300;
+        if ("272311".equals(codeString))
+          return _272311;
+        if ("272312".equals(codeString))
+          return _272312;
+        if ("272313".equals(codeString))
+          return _272313;
+        if ("272314".equals(codeString))
+          return _272314;
+        if ("272399".equals(codeString))
+          return _272399;
+        if ("272400".equals(codeString))
+          return _272400;
+        if ("272411".equals(codeString))
+          return _272411;
+        if ("272412".equals(codeString))
+          return _272412;
+        if ("272413".equals(codeString))
+          return _272413;
+        if ("272499".equals(codeString))
+          return _272499;
+        if ("272511".equals(codeString))
+          return _272511;
+        if ("272600".equals(codeString))
+          return _272600;
+        if ("272611".equals(codeString))
+          return _272611;
+        if ("272612".equals(codeString))
+          return _272612;
+        if ("272613".equals(codeString))
+          return _272613;
+        if ("300000".equals(codeString))
+          return _300000;
+        if ("310000".equals(codeString))
+          return _310000;
+        if ("311000".equals(codeString))
+          return _311000;
+        if ("311111".equals(codeString))
+          return _311111;
+        if ("311200".equals(codeString))
+          return _311200;
+        if ("311211".equals(codeString))
+          return _311211;
+        if ("311212".equals(codeString))
+          return _311212;
+        if ("311213".equals(codeString))
+          return _311213;
+        if ("311214".equals(codeString))
+          return _311214;
+        if ("311215".equals(codeString))
+          return _311215;
+        if ("311299".equals(codeString))
+          return _311299;
+        if ("311300".equals(codeString))
+          return _311300;
+        if ("311311".equals(codeString))
+          return _311311;
+        if ("311312".equals(codeString))
+          return _311312;
+        if ("311313".equals(codeString))
+          return _311313;
+        if ("311399".equals(codeString))
+          return _311399;
+        if ("311400".equals(codeString))
+          return _311400;
+        if ("311411".equals(codeString))
+          return _311411;
+        if ("311412".equals(codeString))
+          return _311412;
+        if ("311413".equals(codeString))
+          return _311413;
+        if ("311414".equals(codeString))
+          return _311414;
+        if ("311499".equals(codeString))
+          return _311499;
+        if ("312000".equals(codeString))
+          return _312000;
+        if ("312100".equals(codeString))
+          return _312100;
+        if ("312111".equals(codeString))
+          return _312111;
+        if ("312112".equals(codeString))
+          return _312112;
+        if ("312113".equals(codeString))
+          return _312113;
+        if ("312114".equals(codeString))
+          return _312114;
+        if ("312115".equals(codeString))
+          return _312115;
+        if ("312116".equals(codeString))
+          return _312116;
+        if ("312200".equals(codeString))
+          return _312200;
+        if ("312211".equals(codeString))
+          return _312211;
+        if ("312212".equals(codeString))
+          return _312212;
+        if ("312300".equals(codeString))
+          return _312300;
+        if ("312311".equals(codeString))
+          return _312311;
+        if ("312312".equals(codeString))
+          return _312312;
+        if ("312400".equals(codeString))
+          return _312400;
+        if ("312411".equals(codeString))
+          return _312411;
+        if ("312412".equals(codeString))
+          return _312412;
+        if ("312500".equals(codeString))
+          return _312500;
+        if ("312511".equals(codeString))
+          return _312511;
+        if ("312512".equals(codeString))
+          return _312512;
+        if ("312611".equals(codeString))
+          return _312611;
+        if ("312900".equals(codeString))
+          return _312900;
+        if ("312911".equals(codeString))
+          return _312911;
+        if ("312912".equals(codeString))
+          return _312912;
+        if ("312913".equals(codeString))
+          return _312913;
+        if ("312999".equals(codeString))
+          return _312999;
+        if ("313000".equals(codeString))
+          return _313000;
+        if ("313100".equals(codeString))
+          return _313100;
+        if ("313111".equals(codeString))
+          return _313111;
+        if ("313112".equals(codeString))
+          return _313112;
+        if ("313113".equals(codeString))
+          return _313113;
+        if ("313199".equals(codeString))
+          return _313199;
+        if ("313200".equals(codeString))
+          return _313200;
+        if ("313211".equals(codeString))
+          return _313211;
+        if ("313212".equals(codeString))
+          return _313212;
+        if ("313213".equals(codeString))
+          return _313213;
+        if ("313214".equals(codeString))
+          return _313214;
+        if ("320000".equals(codeString))
+          return _320000;
+        if ("321000".equals(codeString))
+          return _321000;
+        if ("321111".equals(codeString))
+          return _321111;
+        if ("321200".equals(codeString))
+          return _321200;
+        if ("321211".equals(codeString))
+          return _321211;
+        if ("321212".equals(codeString))
+          return _321212;
+        if ("321213".equals(codeString))
+          return _321213;
+        if ("321214".equals(codeString))
+          return _321214;
+        if ("322000".equals(codeString))
+          return _322000;
+        if ("322100".equals(codeString))
+          return _322100;
+        if ("322111".equals(codeString))
+          return _322111;
+        if ("322112".equals(codeString))
+          return _322112;
+        if ("322113".equals(codeString))
+          return _322113;
+        if ("322114".equals(codeString))
+          return _322114;
+        if ("322115".equals(codeString))
+          return _322115;
+        if ("322211".equals(codeString))
+          return _322211;
+        if ("322300".equals(codeString))
+          return _322300;
+        if ("322311".equals(codeString))
+          return _322311;
+        if ("322312".equals(codeString))
+          return _322312;
+        if ("322313".equals(codeString))
+          return _322313;
+        if ("323000".equals(codeString))
+          return _323000;
+        if ("323100".equals(codeString))
+          return _323100;
+        if ("323111".equals(codeString))
+          return _323111;
+        if ("323112".equals(codeString))
+          return _323112;
+        if ("323113".equals(codeString))
+          return _323113;
+        if ("323200".equals(codeString))
+          return _323200;
+        if ("323211".equals(codeString))
+          return _323211;
+        if ("323212".equals(codeString))
+          return _323212;
+        if ("323213".equals(codeString))
+          return _323213;
+        if ("323214".equals(codeString))
+          return _323214;
+        if ("323215".equals(codeString))
+          return _323215;
+        if ("323299".equals(codeString))
+          return _323299;
+        if ("323300".equals(codeString))
+          return _323300;
+        if ("323311".equals(codeString))
+          return _323311;
+        if ("323312".equals(codeString))
+          return _323312;
+        if ("323313".equals(codeString))
+          return _323313;
+        if ("323314".equals(codeString))
+          return _323314;
+        if ("323315".equals(codeString))
+          return _323315;
+        if ("323316".equals(codeString))
+          return _323316;
+        if ("323400".equals(codeString))
+          return _323400;
+        if ("323411".equals(codeString))
+          return _323411;
+        if ("323412".equals(codeString))
+          return _323412;
+        if ("324000".equals(codeString))
+          return _324000;
+        if ("324111".equals(codeString))
+          return _324111;
+        if ("324200".equals(codeString))
+          return _324200;
+        if ("324211".equals(codeString))
+          return _324211;
+        if ("324212".equals(codeString))
+          return _324212;
+        if ("324311".equals(codeString))
+          return _324311;
+        if ("330000".equals(codeString))
+          return _330000;
+        if ("331000".equals(codeString))
+          return _331000;
+        if ("331100".equals(codeString))
+          return _331100;
+        if ("331111".equals(codeString))
+          return _331111;
+        if ("331112".equals(codeString))
+          return _331112;
+        if ("331211".equals(codeString))
+          return _331211;
+        if ("331212".equals(codeString))
+          return _331212;
+        if ("331213".equals(codeString))
+          return _331213;
+        if ("332000".equals(codeString))
+          return _332000;
+        if ("332111".equals(codeString))
+          return _332111;
+        if ("332211".equals(codeString))
+          return _332211;
+        if ("333000".equals(codeString))
+          return _333000;
+        if ("333111".equals(codeString))
+          return _333111;
+        if ("333200".equals(codeString))
+          return _333200;
+        if ("333211".equals(codeString))
+          return _333211;
+        if ("333212".equals(codeString))
+          return _333212;
+        if ("333311".equals(codeString))
+          return _333311;
+        if ("333411".equals(codeString))
+          return _333411;
+        if ("334100".equals(codeString))
+          return _334100;
+        if ("334111".equals(codeString))
+          return _334111;
+        if ("334112".equals(codeString))
+          return _334112;
+        if ("334113".equals(codeString))
+          return _334113;
+        if ("334114".equals(codeString))
+          return _334114;
+        if ("334115".equals(codeString))
+          return _334115;
+        if ("340000".equals(codeString))
+          return _340000;
+        if ("341100".equals(codeString))
+          return _341100;
+        if ("341111".equals(codeString))
+          return _341111;
+        if ("341112".equals(codeString))
+          return _341112;
+        if ("341113".equals(codeString))
+          return _341113;
+        if ("342000".equals(codeString))
+          return _342000;
+        if ("342111".equals(codeString))
+          return _342111;
+        if ("342200".equals(codeString))
+          return _342200;
+        if ("342211".equals(codeString))
+          return _342211;
+        if ("342212".equals(codeString))
+          return _342212;
+        if ("342300".equals(codeString))
+          return _342300;
+        if ("342311".equals(codeString))
+          return _342311;
+        if ("342312".equals(codeString))
+          return _342312;
+        if ("342313".equals(codeString))
+          return _342313;
+        if ("342314".equals(codeString))
+          return _342314;
+        if ("342315".equals(codeString))
+          return _342315;
+        if ("342400".equals(codeString))
+          return _342400;
+        if ("342411".equals(codeString))
+          return _342411;
+        if ("342412".equals(codeString))
+          return _342412;
+        if ("342413".equals(codeString))
+          return _342413;
+        if ("342414".equals(codeString))
+          return _342414;
+        if ("351000".equals(codeString))
+          return _351000;
+        if ("351100".equals(codeString))
+          return _351100;
+        if ("351111".equals(codeString))
+          return _351111;
+        if ("351112".equals(codeString))
+          return _351112;
+        if ("351211".equals(codeString))
+          return _351211;
+        if ("351311".equals(codeString))
+          return _351311;
+        if ("351411".equals(codeString))
+          return _351411;
+        if ("360000".equals(codeString))
+          return _360000;
+        if ("361000".equals(codeString))
+          return _361000;
+        if ("361100".equals(codeString))
+          return _361100;
+        if ("361111".equals(codeString))
+          return _361111;
+        if ("361112".equals(codeString))
+          return _361112;
+        if ("361113".equals(codeString))
+          return _361113;
+        if ("361114".equals(codeString))
+          return _361114;
+        if ("361199".equals(codeString))
+          return _361199;
+        if ("361211".equals(codeString))
+          return _361211;
+        if ("361311".equals(codeString))
+          return _361311;
+        if ("362000".equals(codeString))
+          return _362000;
+        if ("362111".equals(codeString))
+          return _362111;
+        if ("362200".equals(codeString))
+          return _362200;
+        if ("362211".equals(codeString))
+          return _362211;
+        if ("362212".equals(codeString))
+          return _362212;
+        if ("362213".equals(codeString))
+          return _362213;
+        if ("362311".equals(codeString))
+          return _362311;
+        if ("362411".equals(codeString))
+          return _362411;
+        if ("390000".equals(codeString))
+          return _390000;
+        if ("391111".equals(codeString))
+          return _391111;
+        if ("392000".equals(codeString))
+          return _392000;
+        if ("392100".equals(codeString))
+          return _392100;
+        if ("392111".equals(codeString))
+          return _392111;
+        if ("392112".equals(codeString))
+          return _392112;
+        if ("392211".equals(codeString))
+          return _392211;
+        if ("392300".equals(codeString))
+          return _392300;
+        if ("392311".equals(codeString))
+          return _392311;
+        if ("392312".equals(codeString))
+          return _392312;
+        if ("393000".equals(codeString))
+          return _393000;
+        if ("393100".equals(codeString))
+          return _393100;
+        if ("393111".equals(codeString))
+          return _393111;
+        if ("393112".equals(codeString))
+          return _393112;
+        if ("393113".equals(codeString))
+          return _393113;
+        if ("393114".equals(codeString))
+          return _393114;
+        if ("393200".equals(codeString))
+          return _393200;
+        if ("393211".equals(codeString))
+          return _393211;
+        if ("393212".equals(codeString))
+          return _393212;
+        if ("393213".equals(codeString))
+          return _393213;
+        if ("393299".equals(codeString))
+          return _393299;
+        if ("393311".equals(codeString))
+          return _393311;
+        if ("394000".equals(codeString))
+          return _394000;
+        if ("394111".equals(codeString))
+          return _394111;
+        if ("394200".equals(codeString))
+          return _394200;
+        if ("394211".equals(codeString))
+          return _394211;
+        if ("394212".equals(codeString))
+          return _394212;
+        if ("394213".equals(codeString))
+          return _394213;
+        if ("394214".equals(codeString))
+          return _394214;
+        if ("394299".equals(codeString))
+          return _394299;
+        if ("399000".equals(codeString))
+          return _399000;
+        if ("399100".equals(codeString))
+          return _399100;
+        if ("399111".equals(codeString))
+          return _399111;
+        if ("399112".equals(codeString))
+          return _399112;
+        if ("399200".equals(codeString))
+          return _399200;
+        if ("399211".equals(codeString))
+          return _399211;
+        if ("399212".equals(codeString))
+          return _399212;
+        if ("399213".equals(codeString))
+          return _399213;
+        if ("399300".equals(codeString))
+          return _399300;
+        if ("399311".equals(codeString))
+          return _399311;
+        if ("399312".equals(codeString))
+          return _399312;
+        if ("399411".equals(codeString))
+          return _399411;
+        if ("399500".equals(codeString))
+          return _399500;
+        if ("399511".equals(codeString))
+          return _399511;
+        if ("399512".equals(codeString))
+          return _399512;
+        if ("399513".equals(codeString))
+          return _399513;
+        if ("399514".equals(codeString))
+          return _399514;
+        if ("399515".equals(codeString))
+          return _399515;
+        if ("399516".equals(codeString))
+          return _399516;
+        if ("399517".equals(codeString))
+          return _399517;
+        if ("399599".equals(codeString))
+          return _399599;
+        if ("399611".equals(codeString))
+          return _399611;
+        if ("399900".equals(codeString))
+          return _399900;
+        if ("399911".equals(codeString))
+          return _399911;
+        if ("399912".equals(codeString))
+          return _399912;
+        if ("399913".equals(codeString))
+          return _399913;
+        if ("399914".equals(codeString))
+          return _399914;
+        if ("399915".equals(codeString))
+          return _399915;
+        if ("399916".equals(codeString))
+          return _399916;
+        if ("399917".equals(codeString))
+          return _399917;
+        if ("399999".equals(codeString))
+          return _399999;
+        if ("400000".equals(codeString))
+          return _400000;
+        if ("411000".equals(codeString))
+          return _411000;
+        if ("411100".equals(codeString))
+          return _411100;
+        if ("411111".equals(codeString))
+          return _411111;
+        if ("411112".equals(codeString))
+          return _411112;
+        if ("411200".equals(codeString))
+          return _411200;
+        if ("411211".equals(codeString))
+          return _411211;
+        if ("411212".equals(codeString))
+          return _411212;
+        if ("411213".equals(codeString))
+          return _411213;
+        if ("411214".equals(codeString))
+          return _411214;
+        if ("411311".equals(codeString))
+          return _411311;
+        if ("411400".equals(codeString))
+          return _411400;
+        if ("411411".equals(codeString))
+          return _411411;
+        if ("411412".equals(codeString))
+          return _411412;
+        if ("411511".equals(codeString))
+          return _411511;
+        if ("411611".equals(codeString))
+          return _411611;
+        if ("411700".equals(codeString))
+          return _411700;
+        if ("411711".equals(codeString))
+          return _411711;
+        if ("411712".equals(codeString))
+          return _411712;
+        if ("411713".equals(codeString))
+          return _411713;
+        if ("411714".equals(codeString))
+          return _411714;
+        if ("411715".equals(codeString))
+          return _411715;
+        if ("411716".equals(codeString))
+          return _411716;
+        if ("420000".equals(codeString))
+          return _420000;
+        if ("421100".equals(codeString))
+          return _421100;
+        if ("421111".equals(codeString))
+          return _421111;
+        if ("421112".equals(codeString))
+          return _421112;
+        if ("421113".equals(codeString))
+          return _421113;
+        if ("421114".equals(codeString))
+          return _421114;
+        if ("422100".equals(codeString))
+          return _422100;
+        if ("422111".equals(codeString))
+          return _422111;
+        if ("422112".equals(codeString))
+          return _422112;
+        if ("422115".equals(codeString))
+          return _422115;
+        if ("422116".equals(codeString))
+          return _422116;
+        if ("423000".equals(codeString))
+          return _423000;
+        if ("423111".equals(codeString))
+          return _423111;
+        if ("423211".equals(codeString))
+          return _423211;
+        if ("423300".equals(codeString))
+          return _423300;
+        if ("423311".equals(codeString))
+          return _423311;
+        if ("423312".equals(codeString))
+          return _423312;
+        if ("423313".equals(codeString))
+          return _423313;
+        if ("423314".equals(codeString))
+          return _423314;
+        if ("423400".equals(codeString))
+          return _423400;
+        if ("423411".equals(codeString))
+          return _423411;
+        if ("423412".equals(codeString))
+          return _423412;
+        if ("423413".equals(codeString))
+          return _423413;
+        if ("431000".equals(codeString))
+          return _431000;
+        if ("431100".equals(codeString))
+          return _431100;
+        if ("431111".equals(codeString))
+          return _431111;
+        if ("431112".equals(codeString))
+          return _431112;
+        if ("431211".equals(codeString))
+          return _431211;
+        if ("431311".equals(codeString))
+          return _431311;
+        if ("431411".equals(codeString))
+          return _431411;
+        if ("431511".equals(codeString))
+          return _431511;
+        if ("431900".equals(codeString))
+          return _431900;
+        if ("431911".equals(codeString))
+          return _431911;
+        if ("431912".equals(codeString))
+          return _431912;
+        if ("431999".equals(codeString))
+          return _431999;
+        if ("440000".equals(codeString))
+          return _440000;
+        if ("441000".equals(codeString))
+          return _441000;
+        if ("441111".equals(codeString))
+          return _441111;
+        if ("441200".equals(codeString))
+          return _441200;
+        if ("441211".equals(codeString))
+          return _441211;
+        if ("441212".equals(codeString))
+          return _441212;
+        if ("441300".equals(codeString))
+          return _441300;
+        if ("441311".equals(codeString))
+          return _441311;
+        if ("441312".equals(codeString))
+          return _441312;
+        if ("442000".equals(codeString))
+          return _442000;
+        if ("442111".equals(codeString))
+          return _442111;
+        if ("442200".equals(codeString))
+          return _442200;
+        if ("442211".equals(codeString))
+          return _442211;
+        if ("442212".equals(codeString))
+          return _442212;
+        if ("442213".equals(codeString))
+          return _442213;
+        if ("442214".equals(codeString))
+          return _442214;
+        if ("442215".equals(codeString))
+          return _442215;
+        if ("442216".equals(codeString))
+          return _442216;
+        if ("442217".equals(codeString))
+          return _442217;
+        if ("442299".equals(codeString))
+          return _442299;
+        if ("450000".equals(codeString))
+          return _450000;
+        if ("451000".equals(codeString))
+          return _451000;
+        if ("451111".equals(codeString))
+          return _451111;
+        if ("451211".equals(codeString))
+          return _451211;
+        if ("451300".equals(codeString))
+          return _451300;
+        if ("451311".equals(codeString))
+          return _451311;
+        if ("451399".equals(codeString))
+          return _451399;
+        if ("451400".equals(codeString))
+          return _451400;
+        if ("451411".equals(codeString))
+          return _451411;
+        if ("451412".equals(codeString))
+          return _451412;
+        if ("451500".equals(codeString))
+          return _451500;
+        if ("451511".equals(codeString))
+          return _451511;
+        if ("451512".equals(codeString))
+          return _451512;
+        if ("451600".equals(codeString))
+          return _451600;
+        if ("451611".equals(codeString))
+          return _451611;
+        if ("451612".equals(codeString))
+          return _451612;
+        if ("451700".equals(codeString))
+          return _451700;
+        if ("451711".equals(codeString))
+          return _451711;
+        if ("451799".equals(codeString))
+          return _451799;
+        if ("451800".equals(codeString))
+          return _451800;
+        if ("451811".equals(codeString))
+          return _451811;
+        if ("451812".equals(codeString))
+          return _451812;
+        if ("451813".equals(codeString))
+          return _451813;
+        if ("451899".equals(codeString))
+          return _451899;
+        if ("452000".equals(codeString))
+          return _452000;
+        if ("452111".equals(codeString))
+          return _452111;
+        if ("452200".equals(codeString))
+          return _452200;
+        if ("452211".equals(codeString))
+          return _452211;
+        if ("452212".equals(codeString))
+          return _452212;
+        if ("452213".equals(codeString))
+          return _452213;
+        if ("452214".equals(codeString))
+          return _452214;
+        if ("452215".equals(codeString))
+          return _452215;
+        if ("452216".equals(codeString))
+          return _452216;
+        if ("452217".equals(codeString))
+          return _452217;
+        if ("452299".equals(codeString))
+          return _452299;
+        if ("452300".equals(codeString))
+          return _452300;
+        if ("452311".equals(codeString))
+          return _452311;
+        if ("452312".equals(codeString))
+          return _452312;
+        if ("452313".equals(codeString))
+          return _452313;
+        if ("452314".equals(codeString))
+          return _452314;
+        if ("452315".equals(codeString))
+          return _452315;
+        if ("452316".equals(codeString))
+          return _452316;
+        if ("452317".equals(codeString))
+          return _452317;
+        if ("452318".equals(codeString))
+          return _452318;
+        if ("452321".equals(codeString))
+          return _452321;
+        if ("452322".equals(codeString))
+          return _452322;
+        if ("452323".equals(codeString))
+          return _452323;
+        if ("452400".equals(codeString))
+          return _452400;
+        if ("452411".equals(codeString))
+          return _452411;
+        if ("452412".equals(codeString))
+          return _452412;
+        if ("452413".equals(codeString))
+          return _452413;
+        if ("452414".equals(codeString))
+          return _452414;
+        if ("452499".equals(codeString))
+          return _452499;
+        if ("500000".equals(codeString))
+          return _500000;
+        if ("510000".equals(codeString))
+          return _510000;
+        if ("511100".equals(codeString))
+          return _511100;
+        if ("511111".equals(codeString))
+          return _511111;
+        if ("511112".equals(codeString))
+          return _511112;
+        if ("512000".equals(codeString))
+          return _512000;
+        if ("512111".equals(codeString))
+          return _512111;
+        if ("512200".equals(codeString))
+          return _512200;
+        if ("512211".equals(codeString))
+          return _512211;
+        if ("512299".equals(codeString))
+          return _512299;
+        if ("521000".equals(codeString))
+          return _521000;
+        if ("521111".equals(codeString))
+          return _521111;
+        if ("521200".equals(codeString))
+          return _521200;
+        if ("521211".equals(codeString))
+          return _521211;
+        if ("521212".equals(codeString))
+          return _521212;
+        if ("530000".equals(codeString))
+          return _530000;
+        if ("531111".equals(codeString))
+          return _531111;
+        if ("532100".equals(codeString))
+          return _532100;
+        if ("532111".equals(codeString))
+          return _532111;
+        if ("532112".equals(codeString))
+          return _532112;
+        if ("532113".equals(codeString))
+          return _532113;
+        if ("540000".equals(codeString))
+          return _540000;
+        if ("541000".equals(codeString))
+          return _541000;
+        if ("541100".equals(codeString))
+          return _541100;
+        if ("541111".equals(codeString))
+          return _541111;
+        if ("541112".equals(codeString))
+          return _541112;
+        if ("541211".equals(codeString))
+          return _541211;
+        if ("542100".equals(codeString))
+          return _542100;
+        if ("542111".equals(codeString))
+          return _542111;
+        if ("542112".equals(codeString))
+          return _542112;
+        if ("542113".equals(codeString))
+          return _542113;
+        if ("542114".equals(codeString))
+          return _542114;
+        if ("550000".equals(codeString))
+          return _550000;
+        if ("551000".equals(codeString))
+          return _551000;
+        if ("551100".equals(codeString))
+          return _551100;
+        if ("551111".equals(codeString))
+          return _551111;
+        if ("551112".equals(codeString))
+          return _551112;
+        if ("551211".equals(codeString))
+          return _551211;
+        if ("551311".equals(codeString))
+          return _551311;
+        if ("552000".equals(codeString))
+          return _552000;
+        if ("552111".equals(codeString))
+          return _552111;
+        if ("552211".equals(codeString))
+          return _552211;
+        if ("552300".equals(codeString))
+          return _552300;
+        if ("552311".equals(codeString))
+          return _552311;
+        if ("552312".equals(codeString))
+          return _552312;
+        if ("552313".equals(codeString))
+          return _552313;
+        if ("552314".equals(codeString))
+          return _552314;
+        if ("561000".equals(codeString))
+          return _561000;
+        if ("561100".equals(codeString))
+          return _561100;
+        if ("561111".equals(codeString))
+          return _561111;
+        if ("561112".equals(codeString))
+          return _561112;
+        if ("561113".equals(codeString))
+          return _561113;
+        if ("561199".equals(codeString))
+          return _561199;
+        if ("561200".equals(codeString))
+          return _561200;
+        if ("561211".equals(codeString))
+          return _561211;
+        if ("561212".equals(codeString))
+          return _561212;
+        if ("561311".equals(codeString))
+          return _561311;
+        if ("561400".equals(codeString))
+          return _561400;
+        if ("561411".equals(codeString))
+          return _561411;
+        if ("561412".equals(codeString))
+          return _561412;
+        if ("561511".equals(codeString))
+          return _561511;
+        if ("561611".equals(codeString))
+          return _561611;
+        if ("561900".equals(codeString))
+          return _561900;
+        if ("561911".equals(codeString))
+          return _561911;
+        if ("561912".equals(codeString))
+          return _561912;
+        if ("561913".equals(codeString))
+          return _561913;
+        if ("561999".equals(codeString))
+          return _561999;
+        if ("590000".equals(codeString))
+          return _590000;
+        if ("591000".equals(codeString))
+          return _591000;
+        if ("591100".equals(codeString))
+          return _591100;
+        if ("591111".equals(codeString))
+          return _591111;
+        if ("591112".equals(codeString))
+          return _591112;
+        if ("591113".equals(codeString))
+          return _591113;
+        if ("591114".equals(codeString))
+          return _591114;
+        if ("591115".equals(codeString))
+          return _591115;
+        if ("591116".equals(codeString))
+          return _591116;
+        if ("591200".equals(codeString))
+          return _591200;
+        if ("591211".equals(codeString))
+          return _591211;
+        if ("591212".equals(codeString))
+          return _591212;
+        if ("599000".equals(codeString))
+          return _599000;
+        if ("599100".equals(codeString))
+          return _599100;
+        if ("599111".equals(codeString))
+          return _599111;
+        if ("599112".equals(codeString))
+          return _599112;
+        if ("599200".equals(codeString))
+          return _599200;
+        if ("599211".equals(codeString))
+          return _599211;
+        if ("599212".equals(codeString))
+          return _599212;
+        if ("599213".equals(codeString))
+          return _599213;
+        if ("599214".equals(codeString))
+          return _599214;
+        if ("599215".equals(codeString))
+          return _599215;
+        if ("599311".equals(codeString))
+          return _599311;
+        if ("599411".equals(codeString))
+          return _599411;
+        if ("599500".equals(codeString))
+          return _599500;
+        if ("599511".equals(codeString))
+          return _599511;
+        if ("599512".equals(codeString))
+          return _599512;
+        if ("599513".equals(codeString))
+          return _599513;
+        if ("599514".equals(codeString))
+          return _599514;
+        if ("599515".equals(codeString))
+          return _599515;
+        if ("599516".equals(codeString))
+          return _599516;
+        if ("599517".equals(codeString))
+          return _599517;
+        if ("599518".equals(codeString))
+          return _599518;
+        if ("599521".equals(codeString))
+          return _599521;
+        if ("599599".equals(codeString))
+          return _599599;
+        if ("599600".equals(codeString))
+          return _599600;
+        if ("599611".equals(codeString))
+          return _599611;
+        if ("599612".equals(codeString))
+          return _599612;
+        if ("599613".equals(codeString))
+          return _599613;
+        if ("599711".equals(codeString))
+          return _599711;
+        if ("599900".equals(codeString))
+          return _599900;
+        if ("599911".equals(codeString))
+          return _599911;
+        if ("599912".equals(codeString))
+          return _599912;
+        if ("599913".equals(codeString))
+          return _599913;
+        if ("599914".equals(codeString))
+          return _599914;
+        if ("599999".equals(codeString))
+          return _599999;
+        if ("600000".equals(codeString))
+          return _600000;
+        if ("610000".equals(codeString))
+          return _610000;
+        if ("611000".equals(codeString))
+          return _611000;
+        if ("611100".equals(codeString))
+          return _611100;
+        if ("611111".equals(codeString))
+          return _611111;
+        if ("611112".equals(codeString))
+          return _611112;
+        if ("611211".equals(codeString))
+          return _611211;
+        if ("611300".equals(codeString))
+          return _611300;
+        if ("611311".equals(codeString))
+          return _611311;
+        if ("611312".equals(codeString))
+          return _611312;
+        if ("611313".equals(codeString))
+          return _611313;
+        if ("611314".equals(codeString))
+          return _611314;
+        if ("611399".equals(codeString))
+          return _611399;
+        if ("612100".equals(codeString))
+          return _612100;
+        if ("612111".equals(codeString))
+          return _612111;
+        if ("612112".equals(codeString))
+          return _612112;
+        if ("612113".equals(codeString))
+          return _612113;
+        if ("612114".equals(codeString))
+          return _612114;
+        if ("612115".equals(codeString))
+          return _612115;
+        if ("621000".equals(codeString))
+          return _621000;
+        if ("621111".equals(codeString))
+          return _621111;
+        if ("621211".equals(codeString))
+          return _621211;
+        if ("621300".equals(codeString))
+          return _621300;
+        if ("621311".equals(codeString))
+          return _621311;
+        if ("621312".equals(codeString))
+          return _621312;
+        if ("621411".equals(codeString))
+          return _621411;
+        if ("621511".equals(codeString))
+          return _621511;
+        if ("621611".equals(codeString))
+          return _621611;
+        if ("621700".equals(codeString))
+          return _621700;
+        if ("621711".equals(codeString))
+          return _621711;
+        if ("621712".equals(codeString))
+          return _621712;
+        if ("621713".equals(codeString))
+          return _621713;
+        if ("621900".equals(codeString))
+          return _621900;
+        if ("621911".equals(codeString))
+          return _621911;
+        if ("621912".equals(codeString))
+          return _621912;
+        if ("621999".equals(codeString))
+          return _621999;
+        if ("630000".equals(codeString))
+          return _630000;
+        if ("631100".equals(codeString))
+          return _631100;
+        if ("631111".equals(codeString))
+          return _631111;
+        if ("631112".equals(codeString))
+          return _631112;
+        if ("639000".equals(codeString))
+          return _639000;
+        if ("639100".equals(codeString))
+          return _639100;
+        if ("639111".equals(codeString))
+          return _639111;
+        if ("639112".equals(codeString))
+          return _639112;
+        if ("639200".equals(codeString))
+          return _639200;
+        if ("639211".equals(codeString))
+          return _639211;
+        if ("639212".equals(codeString))
+          return _639212;
+        if ("639311".equals(codeString))
+          return _639311;
+        if ("639400".equals(codeString))
+          return _639400;
+        if ("639411".equals(codeString))
+          return _639411;
+        if ("639412".equals(codeString))
+          return _639412;
+        if ("639511".equals(codeString))
+          return _639511;
+        if ("639911".equals(codeString))
+          return _639911;
+        if ("700000".equals(codeString))
+          return _700000;
+        if ("710000".equals(codeString))
+          return _710000;
+        if ("711000".equals(codeString))
+          return _711000;
+        if ("711100".equals(codeString))
+          return _711100;
+        if ("711111".equals(codeString))
+          return _711111;
+        if ("711112".equals(codeString))
+          return _711112;
+        if ("711113".equals(codeString))
+          return _711113;
+        if ("711114".equals(codeString))
+          return _711114;
+        if ("711199".equals(codeString))
+          return _711199;
+        if ("711211".equals(codeString))
+          return _711211;
+        if ("711300".equals(codeString))
+          return _711300;
+        if ("711311".equals(codeString))
+          return _711311;
+        if ("711312".equals(codeString))
+          return _711312;
+        if ("711411".equals(codeString))
+          return _711411;
+        if ("711500".equals(codeString))
+          return _711500;
+        if ("711511".equals(codeString))
+          return _711511;
+        if ("711512".equals(codeString))
+          return _711512;
+        if ("711513".equals(codeString))
+          return _711513;
+        if ("711514".equals(codeString))
+          return _711514;
+        if ("711515".equals(codeString))
+          return _711515;
+        if ("711516".equals(codeString))
+          return _711516;
+        if ("711599".equals(codeString))
+          return _711599;
+        if ("711611".equals(codeString))
+          return _711611;
+        if ("711700".equals(codeString))
+          return _711700;
+        if ("711711".equals(codeString))
+          return _711711;
+        if ("711712".equals(codeString))
+          return _711712;
+        if ("711713".equals(codeString))
+          return _711713;
+        if ("711714".equals(codeString))
+          return _711714;
+        if ("711715".equals(codeString))
+          return _711715;
+        if ("711716".equals(codeString))
+          return _711716;
+        if ("711799".equals(codeString))
+          return _711799;
+        if ("711900".equals(codeString))
+          return _711900;
+        if ("711911".equals(codeString))
+          return _711911;
+        if ("711912".equals(codeString))
+          return _711912;
+        if ("711913".equals(codeString))
+          return _711913;
+        if ("711914".equals(codeString))
+          return _711914;
+        if ("711999".equals(codeString))
+          return _711999;
+        if ("712000".equals(codeString))
+          return _712000;
+        if ("712111".equals(codeString))
+          return _712111;
+        if ("712200".equals(codeString))
+          return _712200;
+        if ("712211".equals(codeString))
+          return _712211;
+        if ("712212".equals(codeString))
+          return _712212;
+        if ("712213".equals(codeString))
+          return _712213;
+        if ("712311".equals(codeString))
+          return _712311;
+        if ("712900".equals(codeString))
+          return _712900;
+        if ("712911".equals(codeString))
+          return _712911;
+        if ("712912".equals(codeString))
+          return _712912;
+        if ("712913".equals(codeString))
+          return _712913;
+        if ("712914".equals(codeString))
+          return _712914;
+        if ("712915".equals(codeString))
+          return _712915;
+        if ("712916".equals(codeString))
+          return _712916;
+        if ("712917".equals(codeString))
+          return _712917;
+        if ("712918".equals(codeString))
+          return _712918;
+        if ("712921".equals(codeString))
+          return _712921;
+        if ("712922".equals(codeString))
+          return _712922;
+        if ("712999".equals(codeString))
+          return _712999;
+        if ("721000".equals(codeString))
+          return _721000;
+        if ("721100".equals(codeString))
+          return _721100;
+        if ("721111".equals(codeString))
+          return _721111;
+        if ("721112".equals(codeString))
+          return _721112;
+        if ("721200".equals(codeString))
+          return _721200;
+        if ("721211".equals(codeString))
+          return _721211;
+        if ("721212".equals(codeString))
+          return _721212;
+        if ("721213".equals(codeString))
+          return _721213;
+        if ("721214".equals(codeString))
+          return _721214;
+        if ("721215".equals(codeString))
+          return _721215;
+        if ("721216".equals(codeString))
+          return _721216;
+        if ("721311".equals(codeString))
+          return _721311;
+        if ("721900".equals(codeString))
+          return _721900;
+        if ("721911".equals(codeString))
+          return _721911;
+        if ("721912".equals(codeString))
+          return _721912;
+        if ("721913".equals(codeString))
+          return _721913;
+        if ("721914".equals(codeString))
+          return _721914;
+        if ("721915".equals(codeString))
+          return _721915;
+        if ("721916".equals(codeString))
+          return _721916;
+        if ("721999".equals(codeString))
+          return _721999;
+        if ("730000".equals(codeString))
+          return _730000;
+        if ("731000".equals(codeString))
+          return _731000;
+        if ("731100".equals(codeString))
+          return _731100;
+        if ("731111".equals(codeString))
+          return _731111;
+        if ("731112".equals(codeString))
+          return _731112;
+        if ("731199".equals(codeString))
+          return _731199;
+        if ("731200".equals(codeString))
+          return _731200;
+        if ("731211".equals(codeString))
+          return _731211;
+        if ("731212".equals(codeString))
+          return _731212;
+        if ("731213".equals(codeString))
+          return _731213;
+        if ("731300".equals(codeString))
+          return _731300;
+        if ("731311".equals(codeString))
+          return _731311;
+        if ("731312".equals(codeString))
+          return _731312;
+        if ("732111".equals(codeString))
+          return _732111;
+        if ("733100".equals(codeString))
+          return _733100;
+        if ("733111".equals(codeString))
+          return _733111;
+        if ("733112".equals(codeString))
+          return _733112;
+        if ("733113".equals(codeString))
+          return _733113;
+        if ("733114".equals(codeString))
+          return _733114;
+        if ("733115".equals(codeString))
+          return _733115;
+        if ("741111".equals(codeString))
+          return _741111;
+        if ("800000".equals(codeString))
+          return _800000;
+        if ("811000".equals(codeString))
+          return _811000;
+        if ("811111".equals(codeString))
+          return _811111;
+        if ("811211".equals(codeString))
+          return _811211;
+        if ("811311".equals(codeString))
+          return _811311;
+        if ("811400".equals(codeString))
+          return _811400;
+        if ("811411".equals(codeString))
+          return _811411;
+        if ("811412".equals(codeString))
+          return _811412;
+        if ("811500".equals(codeString))
+          return _811500;
+        if ("811511".equals(codeString))
+          return _811511;
+        if ("811512".equals(codeString))
+          return _811512;
+        if ("811513".equals(codeString))
+          return _811513;
+        if ("811600".equals(codeString))
+          return _811600;
+        if ("811611".equals(codeString))
+          return _811611;
+        if ("811612".equals(codeString))
+          return _811612;
+        if ("811699".equals(codeString))
+          return _811699;
+        if ("821000".equals(codeString))
+          return _821000;
+        if ("821100".equals(codeString))
+          return _821100;
+        if ("821111".equals(codeString))
+          return _821111;
+        if ("821112".equals(codeString))
+          return _821112;
+        if ("821113".equals(codeString))
+          return _821113;
+        if ("821114".equals(codeString))
+          return _821114;
+        if ("821211".equals(codeString))
+          return _821211;
+        if ("821311".equals(codeString))
+          return _821311;
+        if ("821400".equals(codeString))
+          return _821400;
+        if ("821411".equals(codeString))
+          return _821411;
+        if ("821412".equals(codeString))
+          return _821412;
+        if ("821511".equals(codeString))
+          return _821511;
+        if ("821611".equals(codeString))
+          return _821611;
+        if ("821700".equals(codeString))
+          return _821700;
+        if ("821711".equals(codeString))
+          return _821711;
+        if ("821712".equals(codeString))
+          return _821712;
+        if ("821713".equals(codeString))
+          return _821713;
+        if ("821714".equals(codeString))
+          return _821714;
+        if ("821900".equals(codeString))
+          return _821900;
+        if ("821911".equals(codeString))
+          return _821911;
+        if ("821912".equals(codeString))
+          return _821912;
+        if ("821913".equals(codeString))
+          return _821913;
+        if ("821914".equals(codeString))
+          return _821914;
+        if ("821915".equals(codeString))
+          return _821915;
+        if ("830000".equals(codeString))
+          return _830000;
+        if ("831000".equals(codeString))
+          return _831000;
+        if ("831100".equals(codeString))
+          return _831100;
+        if ("831111".equals(codeString))
+          return _831111;
+        if ("831112".equals(codeString))
+          return _831112;
+        if ("831113".equals(codeString))
+          return _831113;
+        if ("831114".equals(codeString))
+          return _831114;
+        if ("831115".equals(codeString))
+          return _831115;
+        if ("831116".equals(codeString))
+          return _831116;
+        if ("831117".equals(codeString))
+          return _831117;
+        if ("831118".equals(codeString))
+          return _831118;
+        if ("831199".equals(codeString))
+          return _831199;
+        if ("831200".equals(codeString))
+          return _831200;
+        if ("831211".equals(codeString))
+          return _831211;
+        if ("831212".equals(codeString))
+          return _831212;
+        if ("831300".equals(codeString))
+          return _831300;
+        if ("831311".equals(codeString))
+          return _831311;
+        if ("831312".equals(codeString))
+          return _831312;
+        if ("831313".equals(codeString))
+          return _831313;
+        if ("832000".equals(codeString))
+          return _832000;
+        if ("832100".equals(codeString))
+          return _832100;
+        if ("832111".equals(codeString))
+          return _832111;
+        if ("832112".equals(codeString))
+          return _832112;
+        if ("832113".equals(codeString))
+          return _832113;
+        if ("832114".equals(codeString))
+          return _832114;
+        if ("832115".equals(codeString))
+          return _832115;
+        if ("832199".equals(codeString))
+          return _832199;
+        if ("832211".equals(codeString))
+          return _832211;
+        if ("839000".equals(codeString))
+          return _839000;
+        if ("839111".equals(codeString))
+          return _839111;
+        if ("839200".equals(codeString))
+          return _839200;
+        if ("839211".equals(codeString))
+          return _839211;
+        if ("839212".equals(codeString))
+          return _839212;
+        if ("839300".equals(codeString))
+          return _839300;
+        if ("839311".equals(codeString))
+          return _839311;
+        if ("839312".equals(codeString))
+          return _839312;
+        if ("839313".equals(codeString))
+          return _839313;
+        if ("839400".equals(codeString))
+          return _839400;
+        if ("839411".equals(codeString))
+          return _839411;
+        if ("839412".equals(codeString))
+          return _839412;
+        if ("839413".equals(codeString))
+          return _839413;
+        if ("839900".equals(codeString))
+          return _839900;
+        if ("839911".equals(codeString))
+          return _839911;
+        if ("839912".equals(codeString))
+          return _839912;
+        if ("839913".equals(codeString))
+          return _839913;
+        if ("839914".equals(codeString))
+          return _839914;
+        if ("839915".equals(codeString))
+          return _839915;
+        if ("839916".equals(codeString))
+          return _839916;
+        if ("839917".equals(codeString))
+          return _839917;
+        if ("839999".equals(codeString))
+          return _839999;
+        if ("841000".equals(codeString))
+          return _841000;
+        if ("841111".equals(codeString))
+          return _841111;
+        if ("841200".equals(codeString))
+          return _841200;
+        if ("841211".equals(codeString))
+          return _841211;
+        if ("841212".equals(codeString))
+          return _841212;
+        if ("841213".equals(codeString))
+          return _841213;
+        if ("841214".equals(codeString))
+          return _841214;
+        if ("841215".equals(codeString))
+          return _841215;
+        if ("841216".equals(codeString))
+          return _841216;
+        if ("841299".equals(codeString))
+          return _841299;
+        if ("841300".equals(codeString))
+          return _841300;
+        if ("841311".equals(codeString))
+          return _841311;
+        if ("841312".equals(codeString))
+          return _841312;
+        if ("841313".equals(codeString))
+          return _841313;
+        if ("841400".equals(codeString))
+          return _841400;
+        if ("841411".equals(codeString))
+          return _841411;
+        if ("841412".equals(codeString))
+          return _841412;
+        if ("841500".equals(codeString))
+          return _841500;
+        if ("841511".equals(codeString))
+          return _841511;
+        if ("841512".equals(codeString))
+          return _841512;
+        if ("841513".equals(codeString))
+          return _841513;
+        if ("841514".equals(codeString))
+          return _841514;
+        if ("841515".equals(codeString))
+          return _841515;
+        if ("841516".equals(codeString))
+          return _841516;
+        if ("841517".equals(codeString))
+          return _841517;
+        if ("841599".equals(codeString))
+          return _841599;
+        if ("841611".equals(codeString))
+          return _841611;
+        if ("841900".equals(codeString))
+          return _841900;
+        if ("841911".equals(codeString))
+          return _841911;
+        if ("841912".equals(codeString))
+          return _841912;
+        if ("841999".equals(codeString))
+          return _841999;
+        if ("851000".equals(codeString))
+          return _851000;
+        if ("851111".equals(codeString))
+          return _851111;
+        if ("851200".equals(codeString))
+          return _851200;
+        if ("851211".equals(codeString))
+          return _851211;
+        if ("851299".equals(codeString))
+          return _851299;
+        if ("851311".equals(codeString))
+          return _851311;
+        if ("890000".equals(codeString))
+          return _890000;
+        if ("891000".equals(codeString))
+          return _891000;
+        if ("891100".equals(codeString))
+          return _891100;
+        if ("891111".equals(codeString))
+          return _891111;
+        if ("891112".equals(codeString))
+          return _891112;
+        if ("891113".equals(codeString))
+          return _891113;
+        if ("891211".equals(codeString))
+          return _891211;
+        if ("899000".equals(codeString))
+          return _899000;
+        if ("899111".equals(codeString))
+          return _899111;
+        if ("899200".equals(codeString))
+          return _899200;
+        if ("899211".equals(codeString))
+          return _899211;
+        if ("899212".equals(codeString))
+          return _899212;
+        if ("899311".equals(codeString))
+          return _899311;
+        if ("899400".equals(codeString))
+          return _899400;
+        if ("899411".equals(codeString))
+          return _899411;
+        if ("899412".equals(codeString))
+          return _899412;
+        if ("899413".equals(codeString))
+          return _899413;
+        if ("899414".equals(codeString))
+          return _899414;
+        if ("899415".equals(codeString))
+          return _899415;
+        if ("899500".equals(codeString))
+          return _899500;
+        if ("899511".equals(codeString))
+          return _899511;
+        if ("899512".equals(codeString))
+          return _899512;
+        if ("899611".equals(codeString))
+          return _899611;
+        if ("899711".equals(codeString))
+          return _899711;
+        if ("899900".equals(codeString))
+          return _899900;
+        if ("899911".equals(codeString))
+          return _899911;
+        if ("899912".equals(codeString))
+          return _899912;
+        if ("899913".equals(codeString))
+          return _899913;
+        if ("899914".equals(codeString))
+          return _899914;
+        if ("899915".equals(codeString))
+          return _899915;
+        if ("899916".equals(codeString))
+          return _899916;
+        if ("899917".equals(codeString))
+          return _899917;
+        if ("899918".equals(codeString))
+          return _899918;
+        if ("899921".equals(codeString))
+          return _899921;
+        if ("899922".equals(codeString))
+          return _899922;
+        if ("899999".equals(codeString))
+          return _899999;
+        throw new FHIRException("Unknown AnzscoOccupations code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _100000: return "100000";
+            case _111000: return "111000";
+            case _111111: return "111111";
+            case _111200: return "111200";
+            case _111211: return "111211";
+            case _111212: return "111212";
+            case _111300: return "111300";
+            case _111311: return "111311";
+            case _111312: return "111312";
+            case _111399: return "111399";
+            case _121000: return "121000";
+            case _121111: return "121111";
+            case _121200: return "121200";
+            case _121211: return "121211";
+            case _121212: return "121212";
+            case _121213: return "121213";
+            case _121214: return "121214";
+            case _121215: return "121215";
+            case _121216: return "121216";
+            case _121217: return "121217";
+            case _121218: return "121218";
+            case _121221: return "121221";
+            case _121299: return "121299";
+            case _121300: return "121300";
+            case _121311: return "121311";
+            case _121312: return "121312";
+            case _121313: return "121313";
+            case _121314: return "121314";
+            case _121315: return "121315";
+            case _121316: return "121316";
+            case _121317: return "121317";
+            case _121318: return "121318";
+            case _121321: return "121321";
+            case _121322: return "121322";
+            case _121399: return "121399";
+            case _121411: return "121411";
+            case _130000: return "130000";
+            case _131100: return "131100";
+            case _131111: return "131111";
+            case _131112: return "131112";
+            case _132000: return "132000";
+            case _132111: return "132111";
+            case _132211: return "132211";
+            case _132311: return "132311";
+            case _132411: return "132411";
+            case _132511: return "132511";
+            case _133000: return "133000";
+            case _133100: return "133100";
+            case _133111: return "133111";
+            case _133112: return "133112";
+            case _133211: return "133211";
+            case _133300: return "133300";
+            case _133311: return "133311";
+            case _133312: return "133312";
+            case _133411: return "133411";
+            case _133500: return "133500";
+            case _133511: return "133511";
+            case _133512: return "133512";
+            case _133513: return "133513";
+            case _133611: return "133611";
+            case _134000: return "134000";
+            case _134111: return "134111";
+            case _134200: return "134200";
+            case _134211: return "134211";
+            case _134212: return "134212";
+            case _134213: return "134213";
+            case _134214: return "134214";
+            case _134299: return "134299";
+            case _134311: return "134311";
+            case _134400: return "134400";
+            case _134411: return "134411";
+            case _134412: return "134412";
+            case _134499: return "134499";
+            case _135100: return "135100";
+            case _135111: return "135111";
+            case _135112: return "135112";
+            case _135199: return "135199";
+            case _139000: return "139000";
+            case _139100: return "139100";
+            case _139111: return "139111";
+            case _139112: return "139112";
+            case _139113: return "139113";
+            case _139211: return "139211";
+            case _139900: return "139900";
+            case _139911: return "139911";
+            case _139912: return "139912";
+            case _139913: return "139913";
+            case _139914: return "139914";
+            case _139915: return "139915";
+            case _139999: return "139999";
+            case _140000: return "140000";
+            case _141000: return "141000";
+            case _141111: return "141111";
+            case _141211: return "141211";
+            case _141311: return "141311";
+            case _141411: return "141411";
+            case _141900: return "141900";
+            case _141911: return "141911";
+            case _141999: return "141999";
+            case _142100: return "142100";
+            case _142111: return "142111";
+            case _142112: return "142112";
+            case _142113: return "142113";
+            case _142114: return "142114";
+            case _142115: return "142115";
+            case _142116: return "142116";
+            case _149000: return "149000";
+            case _149100: return "149100";
+            case _149111: return "149111";
+            case _149112: return "149112";
+            case _149113: return "149113";
+            case _149200: return "149200";
+            case _149211: return "149211";
+            case _149212: return "149212";
+            case _149311: return "149311";
+            case _149400: return "149400";
+            case _149411: return "149411";
+            case _149412: return "149412";
+            case _149413: return "149413";
+            case _149900: return "149900";
+            case _149911: return "149911";
+            case _149912: return "149912";
+            case _149913: return "149913";
+            case _149914: return "149914";
+            case _149999: return "149999";
+            case _200000: return "200000";
+            case _210000: return "210000";
+            case _211000: return "211000";
+            case _211100: return "211100";
+            case _211111: return "211111";
+            case _211112: return "211112";
+            case _211113: return "211113";
+            case _211199: return "211199";
+            case _211200: return "211200";
+            case _211211: return "211211";
+            case _211212: return "211212";
+            case _211213: return "211213";
+            case _211214: return "211214";
+            case _211299: return "211299";
+            case _211311: return "211311";
+            case _211400: return "211400";
+            case _211411: return "211411";
+            case _211412: return "211412";
+            case _211413: return "211413";
+            case _211499: return "211499";
+            case _212000: return "212000";
+            case _212100: return "212100";
+            case _212111: return "212111";
+            case _212112: return "212112";
+            case _212113: return "212113";
+            case _212114: return "212114";
+            case _212200: return "212200";
+            case _212211: return "212211";
+            case _212212: return "212212";
+            case _212300: return "212300";
+            case _212311: return "212311";
+            case _212312: return "212312";
+            case _212313: return "212313";
+            case _212314: return "212314";
+            case _212315: return "212315";
+            case _212316: return "212316";
+            case _212317: return "212317";
+            case _212318: return "212318";
+            case _212399: return "212399";
+            case _212400: return "212400";
+            case _212411: return "212411";
+            case _212412: return "212412";
+            case _212413: return "212413";
+            case _212414: return "212414";
+            case _212415: return "212415";
+            case _212416: return "212416";
+            case _212499: return "212499";
+            case _220000: return "220000";
+            case _221000: return "221000";
+            case _221100: return "221100";
+            case _221111: return "221111";
+            case _221112: return "221112";
+            case _221113: return "221113";
+            case _221200: return "221200";
+            case _221211: return "221211";
+            case _221212: return "221212";
+            case _221213: return "221213";
+            case _221214: return "221214";
+            case _222000: return "222000";
+            case _222100: return "222100";
+            case _222111: return "222111";
+            case _222112: return "222112";
+            case _222113: return "222113";
+            case _222199: return "222199";
+            case _222200: return "222200";
+            case _222211: return "222211";
+            case _222212: return "222212";
+            case _222213: return "222213";
+            case _222299: return "222299";
+            case _222300: return "222300";
+            case _222311: return "222311";
+            case _222312: return "222312";
+            case _223000: return "223000";
+            case _223100: return "223100";
+            case _223111: return "223111";
+            case _223112: return "223112";
+            case _223113: return "223113";
+            case _223211: return "223211";
+            case _223311: return "223311";
+            case _224000: return "224000";
+            case _224100: return "224100";
+            case _224111: return "224111";
+            case _224112: return "224112";
+            case _224113: return "224113";
+            case _224200: return "224200";
+            case _224211: return "224211";
+            case _224212: return "224212";
+            case _224213: return "224213";
+            case _224214: return "224214";
+            case _224311: return "224311";
+            case _224400: return "224400";
+            case _224411: return "224411";
+            case _224412: return "224412";
+            case _224500: return "224500";
+            case _224511: return "224511";
+            case _224512: return "224512";
+            case _224611: return "224611";
+            case _224700: return "224700";
+            case _224711: return "224711";
+            case _224712: return "224712";
+            case _224900: return "224900";
+            case _224911: return "224911";
+            case _224912: return "224912";
+            case _224913: return "224913";
+            case _224914: return "224914";
+            case _224999: return "224999";
+            case _225000: return "225000";
+            case _225100: return "225100";
+            case _225111: return "225111";
+            case _225112: return "225112";
+            case _225113: return "225113";
+            case _225200: return "225200";
+            case _225211: return "225211";
+            case _225212: return "225212";
+            case _225213: return "225213";
+            case _225311: return "225311";
+            case _225400: return "225400";
+            case _225411: return "225411";
+            case _225412: return "225412";
+            case _225499: return "225499";
+            case _230000: return "230000";
+            case _231000: return "231000";
+            case _231100: return "231100";
+            case _231111: return "231111";
+            case _231112: return "231112";
+            case _231113: return "231113";
+            case _231114: return "231114";
+            case _231199: return "231199";
+            case _231200: return "231200";
+            case _231211: return "231211";
+            case _231212: return "231212";
+            case _231213: return "231213";
+            case _231214: return "231214";
+            case _231215: return "231215";
+            case _231299: return "231299";
+            case _232000: return "232000";
+            case _232100: return "232100";
+            case _232111: return "232111";
+            case _232112: return "232112";
+            case _232200: return "232200";
+            case _232211: return "232211";
+            case _232212: return "232212";
+            case _232300: return "232300";
+            case _232311: return "232311";
+            case _232312: return "232312";
+            case _232313: return "232313";
+            case _232400: return "232400";
+            case _232411: return "232411";
+            case _232412: return "232412";
+            case _232413: return "232413";
+            case _232414: return "232414";
+            case _232511: return "232511";
+            case _232611: return "232611";
+            case _233000: return "233000";
+            case _233100: return "233100";
+            case _233111: return "233111";
+            case _233112: return "233112";
+            case _233200: return "233200";
+            case _233211: return "233211";
+            case _233212: return "233212";
+            case _233213: return "233213";
+            case _233214: return "233214";
+            case _233215: return "233215";
+            case _233311: return "233311";
+            case _233411: return "233411";
+            case _233500: return "233500";
+            case _233511: return "233511";
+            case _233512: return "233512";
+            case _233513: return "233513";
+            case _233600: return "233600";
+            case _233611: return "233611";
+            case _233612: return "233612";
+            case _233900: return "233900";
+            case _233911: return "233911";
+            case _233912: return "233912";
+            case _233913: return "233913";
+            case _233914: return "233914";
+            case _233915: return "233915";
+            case _233916: return "233916";
+            case _233999: return "233999";
+            case _234000: return "234000";
+            case _234100: return "234100";
+            case _234111: return "234111";
+            case _234112: return "234112";
+            case _234113: return "234113";
+            case _234200: return "234200";
+            case _234211: return "234211";
+            case _234212: return "234212";
+            case _234213: return "234213";
+            case _234300: return "234300";
+            case _234311: return "234311";
+            case _234312: return "234312";
+            case _234313: return "234313";
+            case _234314: return "234314";
+            case _234399: return "234399";
+            case _234400: return "234400";
+            case _234411: return "234411";
+            case _234412: return "234412";
+            case _234500: return "234500";
+            case _234511: return "234511";
+            case _234512: return "234512";
+            case _234513: return "234513";
+            case _234514: return "234514";
+            case _234515: return "234515";
+            case _234516: return "234516";
+            case _234517: return "234517";
+            case _234518: return "234518";
+            case _234599: return "234599";
+            case _234611: return "234611";
+            case _234711: return "234711";
+            case _234900: return "234900";
+            case _234911: return "234911";
+            case _234912: return "234912";
+            case _234913: return "234913";
+            case _234914: return "234914";
+            case _234999: return "234999";
+            case _240000: return "240000";
+            case _241000: return "241000";
+            case _241111: return "241111";
+            case _241213: return "241213";
+            case _241311: return "241311";
+            case _241411: return "241411";
+            case _241500: return "241500";
+            case _241511: return "241511";
+            case _241512: return "241512";
+            case _241513: return "241513";
+            case _241599: return "241599";
+            case _242000: return "242000";
+            case _242100: return "242100";
+            case _242111: return "242111";
+            case _242112: return "242112";
+            case _242211: return "242211";
+            case _249000: return "249000";
+            case _249100: return "249100";
+            case _249111: return "249111";
+            case _249112: return "249112";
+            case _249200: return "249200";
+            case _249211: return "249211";
+            case _249212: return "249212";
+            case _249213: return "249213";
+            case _249214: return "249214";
+            case _249299: return "249299";
+            case _249311: return "249311";
+            case _250000: return "250000";
+            case _251000: return "251000";
+            case _251111: return "251111";
+            case _251200: return "251200";
+            case _251211: return "251211";
+            case _251212: return "251212";
+            case _251213: return "251213";
+            case _251214: return "251214";
+            case _251300: return "251300";
+            case _251311: return "251311";
+            case _251312: return "251312";
+            case _251400: return "251400";
+            case _251411: return "251411";
+            case _251412: return "251412";
+            case _251500: return "251500";
+            case _251511: return "251511";
+            case _251512: return "251512";
+            case _251513: return "251513";
+            case _251900: return "251900";
+            case _251911: return "251911";
+            case _251912: return "251912";
+            case _251999: return "251999";
+            case _252000: return "252000";
+            case _252100: return "252100";
+            case _252111: return "252111";
+            case _252112: return "252112";
+            case _252200: return "252200";
+            case _252211: return "252211";
+            case _252212: return "252212";
+            case _252213: return "252213";
+            case _252214: return "252214";
+            case _252299: return "252299";
+            case _252300: return "252300";
+            case _252311: return "252311";
+            case _252312: return "252312";
+            case _252411: return "252411";
+            case _252511: return "252511";
+            case _252611: return "252611";
+            case _252700: return "252700";
+            case _252711: return "252711";
+            case _252712: return "252712";
+            case _253000: return "253000";
+            case _253100: return "253100";
+            case _253111: return "253111";
+            case _253112: return "253112";
+            case _253211: return "253211";
+            case _253300: return "253300";
+            case _253311: return "253311";
+            case _253312: return "253312";
+            case _253313: return "253313";
+            case _253314: return "253314";
+            case _253315: return "253315";
+            case _253316: return "253316";
+            case _253317: return "253317";
+            case _253318: return "253318";
+            case _253321: return "253321";
+            case _253322: return "253322";
+            case _253323: return "253323";
+            case _253324: return "253324";
+            case _253399: return "253399";
+            case _253411: return "253411";
+            case _253500: return "253500";
+            case _253511: return "253511";
+            case _253512: return "253512";
+            case _253513: return "253513";
+            case _253514: return "253514";
+            case _253515: return "253515";
+            case _253516: return "253516";
+            case _253517: return "253517";
+            case _253518: return "253518";
+            case _253521: return "253521";
+            case _253900: return "253900";
+            case _253911: return "253911";
+            case _253912: return "253912";
+            case _253913: return "253913";
+            case _253914: return "253914";
+            case _253915: return "253915";
+            case _253916: return "253916";
+            case _253999: return "253999";
+            case _254000: return "254000";
+            case _254111: return "254111";
+            case _254200: return "254200";
+            case _254211: return "254211";
+            case _254212: return "254212";
+            case _254311: return "254311";
+            case _254400: return "254400";
+            case _254411: return "254411";
+            case _254412: return "254412";
+            case _254413: return "254413";
+            case _254414: return "254414";
+            case _254415: return "254415";
+            case _254416: return "254416";
+            case _254417: return "254417";
+            case _254418: return "254418";
+            case _254421: return "254421";
+            case _254422: return "254422";
+            case _254423: return "254423";
+            case _254424: return "254424";
+            case _254499: return "254499";
+            case _260000: return "260000";
+            case _261000: return "261000";
+            case _261100: return "261100";
+            case _261111: return "261111";
+            case _261112: return "261112";
+            case _261200: return "261200";
+            case _261211: return "261211";
+            case _261212: return "261212";
+            case _261300: return "261300";
+            case _261311: return "261311";
+            case _261312: return "261312";
+            case _261313: return "261313";
+            case _261399: return "261399";
+            case _262100: return "262100";
+            case _262111: return "262111";
+            case _262112: return "262112";
+            case _262113: return "262113";
+            case _263000: return "263000";
+            case _263100: return "263100";
+            case _263111: return "263111";
+            case _263112: return "263112";
+            case _263113: return "263113";
+            case _263200: return "263200";
+            case _263211: return "263211";
+            case _263212: return "263212";
+            case _263213: return "263213";
+            case _263299: return "263299";
+            case _263300: return "263300";
+            case _263311: return "263311";
+            case _263312: return "263312";
+            case _270000: return "270000";
+            case _271000: return "271000";
+            case _271111: return "271111";
+            case _271200: return "271200";
+            case _271211: return "271211";
+            case _271212: return "271212";
+            case _271213: return "271213";
+            case _271299: return "271299";
+            case _271311: return "271311";
+            case _272000: return "272000";
+            case _272100: return "272100";
+            case _272111: return "272111";
+            case _272112: return "272112";
+            case _272113: return "272113";
+            case _272114: return "272114";
+            case _272115: return "272115";
+            case _272199: return "272199";
+            case _272211: return "272211";
+            case _272300: return "272300";
+            case _272311: return "272311";
+            case _272312: return "272312";
+            case _272313: return "272313";
+            case _272314: return "272314";
+            case _272399: return "272399";
+            case _272400: return "272400";
+            case _272411: return "272411";
+            case _272412: return "272412";
+            case _272413: return "272413";
+            case _272499: return "272499";
+            case _272511: return "272511";
+            case _272600: return "272600";
+            case _272611: return "272611";
+            case _272612: return "272612";
+            case _272613: return "272613";
+            case _300000: return "300000";
+            case _310000: return "310000";
+            case _311000: return "311000";
+            case _311111: return "311111";
+            case _311200: return "311200";
+            case _311211: return "311211";
+            case _311212: return "311212";
+            case _311213: return "311213";
+            case _311214: return "311214";
+            case _311215: return "311215";
+            case _311299: return "311299";
+            case _311300: return "311300";
+            case _311311: return "311311";
+            case _311312: return "311312";
+            case _311313: return "311313";
+            case _311399: return "311399";
+            case _311400: return "311400";
+            case _311411: return "311411";
+            case _311412: return "311412";
+            case _311413: return "311413";
+            case _311414: return "311414";
+            case _311499: return "311499";
+            case _312000: return "312000";
+            case _312100: return "312100";
+            case _312111: return "312111";
+            case _312112: return "312112";
+            case _312113: return "312113";
+            case _312114: return "312114";
+            case _312115: return "312115";
+            case _312116: return "312116";
+            case _312200: return "312200";
+            case _312211: return "312211";
+            case _312212: return "312212";
+            case _312300: return "312300";
+            case _312311: return "312311";
+            case _312312: return "312312";
+            case _312400: return "312400";
+            case _312411: return "312411";
+            case _312412: return "312412";
+            case _312500: return "312500";
+            case _312511: return "312511";
+            case _312512: return "312512";
+            case _312611: return "312611";
+            case _312900: return "312900";
+            case _312911: return "312911";
+            case _312912: return "312912";
+            case _312913: return "312913";
+            case _312999: return "312999";
+            case _313000: return "313000";
+            case _313100: return "313100";
+            case _313111: return "313111";
+            case _313112: return "313112";
+            case _313113: return "313113";
+            case _313199: return "313199";
+            case _313200: return "313200";
+            case _313211: return "313211";
+            case _313212: return "313212";
+            case _313213: return "313213";
+            case _313214: return "313214";
+            case _320000: return "320000";
+            case _321000: return "321000";
+            case _321111: return "321111";
+            case _321200: return "321200";
+            case _321211: return "321211";
+            case _321212: return "321212";
+            case _321213: return "321213";
+            case _321214: return "321214";
+            case _322000: return "322000";
+            case _322100: return "322100";
+            case _322111: return "322111";
+            case _322112: return "322112";
+            case _322113: return "322113";
+            case _322114: return "322114";
+            case _322115: return "322115";
+            case _322211: return "322211";
+            case _322300: return "322300";
+            case _322311: return "322311";
+            case _322312: return "322312";
+            case _322313: return "322313";
+            case _323000: return "323000";
+            case _323100: return "323100";
+            case _323111: return "323111";
+            case _323112: return "323112";
+            case _323113: return "323113";
+            case _323200: return "323200";
+            case _323211: return "323211";
+            case _323212: return "323212";
+            case _323213: return "323213";
+            case _323214: return "323214";
+            case _323215: return "323215";
+            case _323299: return "323299";
+            case _323300: return "323300";
+            case _323311: return "323311";
+            case _323312: return "323312";
+            case _323313: return "323313";
+            case _323314: return "323314";
+            case _323315: return "323315";
+            case _323316: return "323316";
+            case _323400: return "323400";
+            case _323411: return "323411";
+            case _323412: return "323412";
+            case _324000: return "324000";
+            case _324111: return "324111";
+            case _324200: return "324200";
+            case _324211: return "324211";
+            case _324212: return "324212";
+            case _324311: return "324311";
+            case _330000: return "330000";
+            case _331000: return "331000";
+            case _331100: return "331100";
+            case _331111: return "331111";
+            case _331112: return "331112";
+            case _331211: return "331211";
+            case _331212: return "331212";
+            case _331213: return "331213";
+            case _332000: return "332000";
+            case _332111: return "332111";
+            case _332211: return "332211";
+            case _333000: return "333000";
+            case _333111: return "333111";
+            case _333200: return "333200";
+            case _333211: return "333211";
+            case _333212: return "333212";
+            case _333311: return "333311";
+            case _333411: return "333411";
+            case _334100: return "334100";
+            case _334111: return "334111";
+            case _334112: return "334112";
+            case _334113: return "334113";
+            case _334114: return "334114";
+            case _334115: return "334115";
+            case _340000: return "340000";
+            case _341100: return "341100";
+            case _341111: return "341111";
+            case _341112: return "341112";
+            case _341113: return "341113";
+            case _342000: return "342000";
+            case _342111: return "342111";
+            case _342200: return "342200";
+            case _342211: return "342211";
+            case _342212: return "342212";
+            case _342300: return "342300";
+            case _342311: return "342311";
+            case _342312: return "342312";
+            case _342313: return "342313";
+            case _342314: return "342314";
+            case _342315: return "342315";
+            case _342400: return "342400";
+            case _342411: return "342411";
+            case _342412: return "342412";
+            case _342413: return "342413";
+            case _342414: return "342414";
+            case _351000: return "351000";
+            case _351100: return "351100";
+            case _351111: return "351111";
+            case _351112: return "351112";
+            case _351211: return "351211";
+            case _351311: return "351311";
+            case _351411: return "351411";
+            case _360000: return "360000";
+            case _361000: return "361000";
+            case _361100: return "361100";
+            case _361111: return "361111";
+            case _361112: return "361112";
+            case _361113: return "361113";
+            case _361114: return "361114";
+            case _361199: return "361199";
+            case _361211: return "361211";
+            case _361311: return "361311";
+            case _362000: return "362000";
+            case _362111: return "362111";
+            case _362200: return "362200";
+            case _362211: return "362211";
+            case _362212: return "362212";
+            case _362213: return "362213";
+            case _362311: return "362311";
+            case _362411: return "362411";
+            case _390000: return "390000";
+            case _391111: return "391111";
+            case _392000: return "392000";
+            case _392100: return "392100";
+            case _392111: return "392111";
+            case _392112: return "392112";
+            case _392211: return "392211";
+            case _392300: return "392300";
+            case _392311: return "392311";
+            case _392312: return "392312";
+            case _393000: return "393000";
+            case _393100: return "393100";
+            case _393111: return "393111";
+            case _393112: return "393112";
+            case _393113: return "393113";
+            case _393114: return "393114";
+            case _393200: return "393200";
+            case _393211: return "393211";
+            case _393212: return "393212";
+            case _393213: return "393213";
+            case _393299: return "393299";
+            case _393311: return "393311";
+            case _394000: return "394000";
+            case _394111: return "394111";
+            case _394200: return "394200";
+            case _394211: return "394211";
+            case _394212: return "394212";
+            case _394213: return "394213";
+            case _394214: return "394214";
+            case _394299: return "394299";
+            case _399000: return "399000";
+            case _399100: return "399100";
+            case _399111: return "399111";
+            case _399112: return "399112";
+            case _399200: return "399200";
+            case _399211: return "399211";
+            case _399212: return "399212";
+            case _399213: return "399213";
+            case _399300: return "399300";
+            case _399311: return "399311";
+            case _399312: return "399312";
+            case _399411: return "399411";
+            case _399500: return "399500";
+            case _399511: return "399511";
+            case _399512: return "399512";
+            case _399513: return "399513";
+            case _399514: return "399514";
+            case _399515: return "399515";
+            case _399516: return "399516";
+            case _399517: return "399517";
+            case _399599: return "399599";
+            case _399611: return "399611";
+            case _399900: return "399900";
+            case _399911: return "399911";
+            case _399912: return "399912";
+            case _399913: return "399913";
+            case _399914: return "399914";
+            case _399915: return "399915";
+            case _399916: return "399916";
+            case _399917: return "399917";
+            case _399999: return "399999";
+            case _400000: return "400000";
+            case _411000: return "411000";
+            case _411100: return "411100";
+            case _411111: return "411111";
+            case _411112: return "411112";
+            case _411200: return "411200";
+            case _411211: return "411211";
+            case _411212: return "411212";
+            case _411213: return "411213";
+            case _411214: return "411214";
+            case _411311: return "411311";
+            case _411400: return "411400";
+            case _411411: return "411411";
+            case _411412: return "411412";
+            case _411511: return "411511";
+            case _411611: return "411611";
+            case _411700: return "411700";
+            case _411711: return "411711";
+            case _411712: return "411712";
+            case _411713: return "411713";
+            case _411714: return "411714";
+            case _411715: return "411715";
+            case _411716: return "411716";
+            case _420000: return "420000";
+            case _421100: return "421100";
+            case _421111: return "421111";
+            case _421112: return "421112";
+            case _421113: return "421113";
+            case _421114: return "421114";
+            case _422100: return "422100";
+            case _422111: return "422111";
+            case _422112: return "422112";
+            case _422115: return "422115";
+            case _422116: return "422116";
+            case _423000: return "423000";
+            case _423111: return "423111";
+            case _423211: return "423211";
+            case _423300: return "423300";
+            case _423311: return "423311";
+            case _423312: return "423312";
+            case _423313: return "423313";
+            case _423314: return "423314";
+            case _423400: return "423400";
+            case _423411: return "423411";
+            case _423412: return "423412";
+            case _423413: return "423413";
+            case _431000: return "431000";
+            case _431100: return "431100";
+            case _431111: return "431111";
+            case _431112: return "431112";
+            case _431211: return "431211";
+            case _431311: return "431311";
+            case _431411: return "431411";
+            case _431511: return "431511";
+            case _431900: return "431900";
+            case _431911: return "431911";
+            case _431912: return "431912";
+            case _431999: return "431999";
+            case _440000: return "440000";
+            case _441000: return "441000";
+            case _441111: return "441111";
+            case _441200: return "441200";
+            case _441211: return "441211";
+            case _441212: return "441212";
+            case _441300: return "441300";
+            case _441311: return "441311";
+            case _441312: return "441312";
+            case _442000: return "442000";
+            case _442111: return "442111";
+            case _442200: return "442200";
+            case _442211: return "442211";
+            case _442212: return "442212";
+            case _442213: return "442213";
+            case _442214: return "442214";
+            case _442215: return "442215";
+            case _442216: return "442216";
+            case _442217: return "442217";
+            case _442299: return "442299";
+            case _450000: return "450000";
+            case _451000: return "451000";
+            case _451111: return "451111";
+            case _451211: return "451211";
+            case _451300: return "451300";
+            case _451311: return "451311";
+            case _451399: return "451399";
+            case _451400: return "451400";
+            case _451411: return "451411";
+            case _451412: return "451412";
+            case _451500: return "451500";
+            case _451511: return "451511";
+            case _451512: return "451512";
+            case _451600: return "451600";
+            case _451611: return "451611";
+            case _451612: return "451612";
+            case _451700: return "451700";
+            case _451711: return "451711";
+            case _451799: return "451799";
+            case _451800: return "451800";
+            case _451811: return "451811";
+            case _451812: return "451812";
+            case _451813: return "451813";
+            case _451899: return "451899";
+            case _452000: return "452000";
+            case _452111: return "452111";
+            case _452200: return "452200";
+            case _452211: return "452211";
+            case _452212: return "452212";
+            case _452213: return "452213";
+            case _452214: return "452214";
+            case _452215: return "452215";
+            case _452216: return "452216";
+            case _452217: return "452217";
+            case _452299: return "452299";
+            case _452300: return "452300";
+            case _452311: return "452311";
+            case _452312: return "452312";
+            case _452313: return "452313";
+            case _452314: return "452314";
+            case _452315: return "452315";
+            case _452316: return "452316";
+            case _452317: return "452317";
+            case _452318: return "452318";
+            case _452321: return "452321";
+            case _452322: return "452322";
+            case _452323: return "452323";
+            case _452400: return "452400";
+            case _452411: return "452411";
+            case _452412: return "452412";
+            case _452413: return "452413";
+            case _452414: return "452414";
+            case _452499: return "452499";
+            case _500000: return "500000";
+            case _510000: return "510000";
+            case _511100: return "511100";
+            case _511111: return "511111";
+            case _511112: return "511112";
+            case _512000: return "512000";
+            case _512111: return "512111";
+            case _512200: return "512200";
+            case _512211: return "512211";
+            case _512299: return "512299";
+            case _521000: return "521000";
+            case _521111: return "521111";
+            case _521200: return "521200";
+            case _521211: return "521211";
+            case _521212: return "521212";
+            case _530000: return "530000";
+            case _531111: return "531111";
+            case _532100: return "532100";
+            case _532111: return "532111";
+            case _532112: return "532112";
+            case _532113: return "532113";
+            case _540000: return "540000";
+            case _541000: return "541000";
+            case _541100: return "541100";
+            case _541111: return "541111";
+            case _541112: return "541112";
+            case _541211: return "541211";
+            case _542100: return "542100";
+            case _542111: return "542111";
+            case _542112: return "542112";
+            case _542113: return "542113";
+            case _542114: return "542114";
+            case _550000: return "550000";
+            case _551000: return "551000";
+            case _551100: return "551100";
+            case _551111: return "551111";
+            case _551112: return "551112";
+            case _551211: return "551211";
+            case _551311: return "551311";
+            case _552000: return "552000";
+            case _552111: return "552111";
+            case _552211: return "552211";
+            case _552300: return "552300";
+            case _552311: return "552311";
+            case _552312: return "552312";
+            case _552313: return "552313";
+            case _552314: return "552314";
+            case _561000: return "561000";
+            case _561100: return "561100";
+            case _561111: return "561111";
+            case _561112: return "561112";
+            case _561113: return "561113";
+            case _561199: return "561199";
+            case _561200: return "561200";
+            case _561211: return "561211";
+            case _561212: return "561212";
+            case _561311: return "561311";
+            case _561400: return "561400";
+            case _561411: return "561411";
+            case _561412: return "561412";
+            case _561511: return "561511";
+            case _561611: return "561611";
+            case _561900: return "561900";
+            case _561911: return "561911";
+            case _561912: return "561912";
+            case _561913: return "561913";
+            case _561999: return "561999";
+            case _590000: return "590000";
+            case _591000: return "591000";
+            case _591100: return "591100";
+            case _591111: return "591111";
+            case _591112: return "591112";
+            case _591113: return "591113";
+            case _591114: return "591114";
+            case _591115: return "591115";
+            case _591116: return "591116";
+            case _591200: return "591200";
+            case _591211: return "591211";
+            case _591212: return "591212";
+            case _599000: return "599000";
+            case _599100: return "599100";
+            case _599111: return "599111";
+            case _599112: return "599112";
+            case _599200: return "599200";
+            case _599211: return "599211";
+            case _599212: return "599212";
+            case _599213: return "599213";
+            case _599214: return "599214";
+            case _599215: return "599215";
+            case _599311: return "599311";
+            case _599411: return "599411";
+            case _599500: return "599500";
+            case _599511: return "599511";
+            case _599512: return "599512";
+            case _599513: return "599513";
+            case _599514: return "599514";
+            case _599515: return "599515";
+            case _599516: return "599516";
+            case _599517: return "599517";
+            case _599518: return "599518";
+            case _599521: return "599521";
+            case _599599: return "599599";
+            case _599600: return "599600";
+            case _599611: return "599611";
+            case _599612: return "599612";
+            case _599613: return "599613";
+            case _599711: return "599711";
+            case _599900: return "599900";
+            case _599911: return "599911";
+            case _599912: return "599912";
+            case _599913: return "599913";
+            case _599914: return "599914";
+            case _599999: return "599999";
+            case _600000: return "600000";
+            case _610000: return "610000";
+            case _611000: return "611000";
+            case _611100: return "611100";
+            case _611111: return "611111";
+            case _611112: return "611112";
+            case _611211: return "611211";
+            case _611300: return "611300";
+            case _611311: return "611311";
+            case _611312: return "611312";
+            case _611313: return "611313";
+            case _611314: return "611314";
+            case _611399: return "611399";
+            case _612100: return "612100";
+            case _612111: return "612111";
+            case _612112: return "612112";
+            case _612113: return "612113";
+            case _612114: return "612114";
+            case _612115: return "612115";
+            case _621000: return "621000";
+            case _621111: return "621111";
+            case _621211: return "621211";
+            case _621300: return "621300";
+            case _621311: return "621311";
+            case _621312: return "621312";
+            case _621411: return "621411";
+            case _621511: return "621511";
+            case _621611: return "621611";
+            case _621700: return "621700";
+            case _621711: return "621711";
+            case _621712: return "621712";
+            case _621713: return "621713";
+            case _621900: return "621900";
+            case _621911: return "621911";
+            case _621912: return "621912";
+            case _621999: return "621999";
+            case _630000: return "630000";
+            case _631100: return "631100";
+            case _631111: return "631111";
+            case _631112: return "631112";
+            case _639000: return "639000";
+            case _639100: return "639100";
+            case _639111: return "639111";
+            case _639112: return "639112";
+            case _639200: return "639200";
+            case _639211: return "639211";
+            case _639212: return "639212";
+            case _639311: return "639311";
+            case _639400: return "639400";
+            case _639411: return "639411";
+            case _639412: return "639412";
+            case _639511: return "639511";
+            case _639911: return "639911";
+            case _700000: return "700000";
+            case _710000: return "710000";
+            case _711000: return "711000";
+            case _711100: return "711100";
+            case _711111: return "711111";
+            case _711112: return "711112";
+            case _711113: return "711113";
+            case _711114: return "711114";
+            case _711199: return "711199";
+            case _711211: return "711211";
+            case _711300: return "711300";
+            case _711311: return "711311";
+            case _711312: return "711312";
+            case _711411: return "711411";
+            case _711500: return "711500";
+            case _711511: return "711511";
+            case _711512: return "711512";
+            case _711513: return "711513";
+            case _711514: return "711514";
+            case _711515: return "711515";
+            case _711516: return "711516";
+            case _711599: return "711599";
+            case _711611: return "711611";
+            case _711700: return "711700";
+            case _711711: return "711711";
+            case _711712: return "711712";
+            case _711713: return "711713";
+            case _711714: return "711714";
+            case _711715: return "711715";
+            case _711716: return "711716";
+            case _711799: return "711799";
+            case _711900: return "711900";
+            case _711911: return "711911";
+            case _711912: return "711912";
+            case _711913: return "711913";
+            case _711914: return "711914";
+            case _711999: return "711999";
+            case _712000: return "712000";
+            case _712111: return "712111";
+            case _712200: return "712200";
+            case _712211: return "712211";
+            case _712212: return "712212";
+            case _712213: return "712213";
+            case _712311: return "712311";
+            case _712900: return "712900";
+            case _712911: return "712911";
+            case _712912: return "712912";
+            case _712913: return "712913";
+            case _712914: return "712914";
+            case _712915: return "712915";
+            case _712916: return "712916";
+            case _712917: return "712917";
+            case _712918: return "712918";
+            case _712921: return "712921";
+            case _712922: return "712922";
+            case _712999: return "712999";
+            case _721000: return "721000";
+            case _721100: return "721100";
+            case _721111: return "721111";
+            case _721112: return "721112";
+            case _721200: return "721200";
+            case _721211: return "721211";
+            case _721212: return "721212";
+            case _721213: return "721213";
+            case _721214: return "721214";
+            case _721215: return "721215";
+            case _721216: return "721216";
+            case _721311: return "721311";
+            case _721900: return "721900";
+            case _721911: return "721911";
+            case _721912: return "721912";
+            case _721913: return "721913";
+            case _721914: return "721914";
+            case _721915: return "721915";
+            case _721916: return "721916";
+            case _721999: return "721999";
+            case _730000: return "730000";
+            case _731000: return "731000";
+            case _731100: return "731100";
+            case _731111: return "731111";
+            case _731112: return "731112";
+            case _731199: return "731199";
+            case _731200: return "731200";
+            case _731211: return "731211";
+            case _731212: return "731212";
+            case _731213: return "731213";
+            case _731300: return "731300";
+            case _731311: return "731311";
+            case _731312: return "731312";
+            case _732111: return "732111";
+            case _733100: return "733100";
+            case _733111: return "733111";
+            case _733112: return "733112";
+            case _733113: return "733113";
+            case _733114: return "733114";
+            case _733115: return "733115";
+            case _741111: return "741111";
+            case _800000: return "800000";
+            case _811000: return "811000";
+            case _811111: return "811111";
+            case _811211: return "811211";
+            case _811311: return "811311";
+            case _811400: return "811400";
+            case _811411: return "811411";
+            case _811412: return "811412";
+            case _811500: return "811500";
+            case _811511: return "811511";
+            case _811512: return "811512";
+            case _811513: return "811513";
+            case _811600: return "811600";
+            case _811611: return "811611";
+            case _811612: return "811612";
+            case _811699: return "811699";
+            case _821000: return "821000";
+            case _821100: return "821100";
+            case _821111: return "821111";
+            case _821112: return "821112";
+            case _821113: return "821113";
+            case _821114: return "821114";
+            case _821211: return "821211";
+            case _821311: return "821311";
+            case _821400: return "821400";
+            case _821411: return "821411";
+            case _821412: return "821412";
+            case _821511: return "821511";
+            case _821611: return "821611";
+            case _821700: return "821700";
+            case _821711: return "821711";
+            case _821712: return "821712";
+            case _821713: return "821713";
+            case _821714: return "821714";
+            case _821900: return "821900";
+            case _821911: return "821911";
+            case _821912: return "821912";
+            case _821913: return "821913";
+            case _821914: return "821914";
+            case _821915: return "821915";
+            case _830000: return "830000";
+            case _831000: return "831000";
+            case _831100: return "831100";
+            case _831111: return "831111";
+            case _831112: return "831112";
+            case _831113: return "831113";
+            case _831114: return "831114";
+            case _831115: return "831115";
+            case _831116: return "831116";
+            case _831117: return "831117";
+            case _831118: return "831118";
+            case _831199: return "831199";
+            case _831200: return "831200";
+            case _831211: return "831211";
+            case _831212: return "831212";
+            case _831300: return "831300";
+            case _831311: return "831311";
+            case _831312: return "831312";
+            case _831313: return "831313";
+            case _832000: return "832000";
+            case _832100: return "832100";
+            case _832111: return "832111";
+            case _832112: return "832112";
+            case _832113: return "832113";
+            case _832114: return "832114";
+            case _832115: return "832115";
+            case _832199: return "832199";
+            case _832211: return "832211";
+            case _839000: return "839000";
+            case _839111: return "839111";
+            case _839200: return "839200";
+            case _839211: return "839211";
+            case _839212: return "839212";
+            case _839300: return "839300";
+            case _839311: return "839311";
+            case _839312: return "839312";
+            case _839313: return "839313";
+            case _839400: return "839400";
+            case _839411: return "839411";
+            case _839412: return "839412";
+            case _839413: return "839413";
+            case _839900: return "839900";
+            case _839911: return "839911";
+            case _839912: return "839912";
+            case _839913: return "839913";
+            case _839914: return "839914";
+            case _839915: return "839915";
+            case _839916: return "839916";
+            case _839917: return "839917";
+            case _839999: return "839999";
+            case _841000: return "841000";
+            case _841111: return "841111";
+            case _841200: return "841200";
+            case _841211: return "841211";
+            case _841212: return "841212";
+            case _841213: return "841213";
+            case _841214: return "841214";
+            case _841215: return "841215";
+            case _841216: return "841216";
+            case _841299: return "841299";
+            case _841300: return "841300";
+            case _841311: return "841311";
+            case _841312: return "841312";
+            case _841313: return "841313";
+            case _841400: return "841400";
+            case _841411: return "841411";
+            case _841412: return "841412";
+            case _841500: return "841500";
+            case _841511: return "841511";
+            case _841512: return "841512";
+            case _841513: return "841513";
+            case _841514: return "841514";
+            case _841515: return "841515";
+            case _841516: return "841516";
+            case _841517: return "841517";
+            case _841599: return "841599";
+            case _841611: return "841611";
+            case _841900: return "841900";
+            case _841911: return "841911";
+            case _841912: return "841912";
+            case _841999: return "841999";
+            case _851000: return "851000";
+            case _851111: return "851111";
+            case _851200: return "851200";
+            case _851211: return "851211";
+            case _851299: return "851299";
+            case _851311: return "851311";
+            case _890000: return "890000";
+            case _891000: return "891000";
+            case _891100: return "891100";
+            case _891111: return "891111";
+            case _891112: return "891112";
+            case _891113: return "891113";
+            case _891211: return "891211";
+            case _899000: return "899000";
+            case _899111: return "899111";
+            case _899200: return "899200";
+            case _899211: return "899211";
+            case _899212: return "899212";
+            case _899311: return "899311";
+            case _899400: return "899400";
+            case _899411: return "899411";
+            case _899412: return "899412";
+            case _899413: return "899413";
+            case _899414: return "899414";
+            case _899415: return "899415";
+            case _899500: return "899500";
+            case _899511: return "899511";
+            case _899512: return "899512";
+            case _899611: return "899611";
+            case _899711: return "899711";
+            case _899900: return "899900";
+            case _899911: return "899911";
+            case _899912: return "899912";
+            case _899913: return "899913";
+            case _899914: return "899914";
+            case _899915: return "899915";
+            case _899916: return "899916";
+            case _899917: return "899917";
+            case _899918: return "899918";
+            case _899921: return "899921";
+            case _899922: return "899922";
+            case _899999: return "899999";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://www.abs.gov.au/ausstats/abs@.nsf/mf/1220.0";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _100000: return "Managers not further defined";
+            case _111000: return "Chief Executives, General Managers and Legislators not further defined";
+            case _111111: return "Chief Executive or Managing Director";
+            case _111200: return "General Managers not further defined";
+            case _111211: return "Corporate General Manager";
+            case _111212: return "Defence Force Senior Officer";
+            case _111300: return "Legislators not further defined";
+            case _111311: return "Local Government Legislator";
+            case _111312: return "Member of Parliament";
+            case _111399: return "Legislators not elsewhere classified";
+            case _121000: return "Farmers and Farm Managers not further defined";
+            case _121111: return "Aquaculture Farmer";
+            case _121200: return "Crop Farmers not further defined";
+            case _121211: return "Cotton Grower";
+            case _121212: return "Flower Grower";
+            case _121213: return "Fruit or Nut Grower";
+            case _121214: return "Grain, Oilseed or Pasture Grower";
+            case _121215: return "Grape Grower";
+            case _121216: return "Mixed Crop Farmer";
+            case _121217: return "Sugar Cane Grower";
+            case _121218: return "Turf Grower";
+            case _121221: return "Vegetable Grower";
+            case _121299: return "Crop Farmers not elsewhere classified";
+            case _121300: return "Livestock Farmers not further defined";
+            case _121311: return "Apiarist";
+            case _121312: return "Beef Cattle Farmer";
+            case _121313: return "Dairy Cattle Farmer";
+            case _121314: return "Deer Farmer";
+            case _121315: return "Goat Farmer";
+            case _121316: return "Horse Breeder";
+            case _121317: return "Mixed Livestock Farmer";
+            case _121318: return "Pig Farmer";
+            case _121321: return "Poultry Farmer";
+            case _121322: return "Sheep Farmer";
+            case _121399: return "Livestock Farmers not elsewhere classified";
+            case _121411: return "Mixed Crop and Livestock Farmer";
+            case _130000: return "Specialist Managers not further defined";
+            case _131100: return "Advertising and Sales Managers not further defined";
+            case _131111: return "Advertising and Public Relations Manager";
+            case _131112: return "Sales and Marketing Manager";
+            case _132000: return "Business Administration Managers not further defined";
+            case _132111: return "Corporate Services Manager";
+            case _132211: return "Finance Manager";
+            case _132311: return "Human Resource Manager";
+            case _132411: return "Policy and Planning Manager";
+            case _132511: return "Research and Development Manager";
+            case _133000: return "Construction, Distribution and Production Managers not further defined";
+            case _133100: return "Construction Managers not further defined";
+            case _133111: return "Construction Project Manager";
+            case _133112: return "Project Builder";
+            case _133211: return "Engineering Manager";
+            case _133300: return "Importers, Exporters and Wholesalers not further defined";
+            case _133311: return "Importer or Exporter";
+            case _133312: return "Wholesaler";
+            case _133411: return "Manufacturer";
+            case _133500: return "Production Managers not further defined";
+            case _133511: return "Production Manager (Forestry)";
+            case _133512: return "Production Manager (Manufacturing)";
+            case _133513: return "Production Manager (Mining)";
+            case _133611: return "Supply and Distribution Manager";
+            case _134000: return "Education, Health and Welfare Services Managers not further defined";
+            case _134111: return "Child Care Centre Manager";
+            case _134200: return "Health and Welfare Services Managers not further defined";
+            case _134211: return "Medical Administrator";
+            case _134212: return "Nursing Clinical Director";
+            case _134213: return "Primary Health Organization Manager";
+            case _134214: return "Welfare Centre Manager";
+            case _134299: return "Health and Welfare Services Managers not elsewhere classified";
+            case _134311: return "School Principal";
+            case _134400: return "Other Education Managers not further defined";
+            case _134411: return "Faculty Head";
+            case _134412: return "Regional Education Manager";
+            case _134499: return "Education Managers not elsewhere classified";
+            case _135100: return "ICT Managers not further defined";
+            case _135111: return "Chief Information Officer";
+            case _135112: return "ICT Project Manager";
+            case _135199: return "ICT Managers not elsewhere classified";
+            case _139000: return "Miscellaneous Specialist Managers not further defined";
+            case _139100: return "Commissioned Officers (Management) not further defined";
+            case _139111: return "Commissioned Defence Force Officer";
+            case _139112: return "Commissioned Fire Officer";
+            case _139113: return "Commissioned Police Officer";
+            case _139211: return "Senior Non-commissioned Defence Force Member";
+            case _139900: return "Other Specialist Managers not further defined";
+            case _139911: return "Arts Administrator or Manager";
+            case _139912: return "Environmental Manager";
+            case _139913: return "Laboratory Manager";
+            case _139914: return "Quality Assurance Manager";
+            case _139915: return "Sports Administrator";
+            case _139999: return "Specialist Managers not elsewhere classified";
+            case _140000: return "Hospitality, Retail and Service Managers not further defined";
+            case _141000: return "Accommodation and Hospitality Managers not further defined";
+            case _141111: return "Cafe or Restaurant Manager";
+            case _141211: return "Caravan Park and Camping Ground Manager";
+            case _141311: return "Hotel or Motel Manager";
+            case _141411: return "Licensed Club Manager";
+            case _141900: return "Other Accommodation and Hospitality Managers not further defined";
+            case _141911: return "Bed and Breakfast Operator";
+            case _141999: return "Accommodation and Hospitality Managers not elsewhere classified";
+            case _142100: return "Retail Managers not further defined";
+            case _142111: return "Retail Manager (General)";
+            case _142112: return "Antique Dealer";
+            case _142113: return "Betting Agency Manager";
+            case _142114: return "Hair or Beauty Salon Manager";
+            case _142115: return "Post Office Manager";
+            case _142116: return "Travel Agency Manager";
+            case _149000: return "Miscellaneous Hospitality, Retail and Service Managers not further defined";
+            case _149100: return "Amusement, Fitness and Sports Centre Managers not further defined";
+            case _149111: return "Amusement Centre Manager";
+            case _149112: return "Fitness Centre Manager";
+            case _149113: return "Sports Centre Manager";
+            case _149200: return "Call or Contact Centre and Customer Service Managers not further defined";
+            case _149211: return "Call or Contact Centre Manager";
+            case _149212: return "Customer Service Manager";
+            case _149311: return "Conference and Event Organizer";
+            case _149400: return "Transport Services Managers not further defined";
+            case _149411: return "Fleet Manager";
+            case _149412: return "Railway Station Manager";
+            case _149413: return "Transport Company Manager";
+            case _149900: return "Other Hospitality, Retail and Service Managers not further defined";
+            case _149911: return "Boarding Kennel or Cattery Operator";
+            case _149912: return "Cinema or Theatre Manager";
+            case _149913: return "Facilities Manager";
+            case _149914: return "Financial Institution Branch Manager";
+            case _149999: return "Hospitality, Retail and Service Managers not elsewhere classified";
+            case _200000: return "Professionals not further defined";
+            case _210000: return "Arts and Media Professionals not further defined";
+            case _211000: return "Arts Professionals not further defined";
+            case _211100: return "Actors, Dancers and Other Entertainers not further defined";
+            case _211111: return "Actor";
+            case _211112: return "Dancer or Choreographer";
+            case _211113: return "Entertainer or Variety Artist";
+            case _211199: return "Actors, Dancers and Other Entertainers not elsewhere classified";
+            case _211200: return "Music Professionals not further defined";
+            case _211211: return "Composer";
+            case _211212: return "Music Director";
+            case _211213: return "Musician (Instrumental)";
+            case _211214: return "Singer";
+            case _211299: return "Music Professionals not elsewhere classified";
+            case _211311: return "Photographer";
+            case _211400: return "Visual Arts and Crafts Professionals not further defined";
+            case _211411: return "Painter (Visual Arts)";
+            case _211412: return "Potter or Ceramic Artist";
+            case _211413: return "Sculptor";
+            case _211499: return "Visual Arts and Crafts Professionals not elsewhere classified";
+            case _212000: return "Media Professionals not further defined";
+            case _212100: return "Artistic Directors, and Media Producers and Presenters not further defined";
+            case _212111: return "Artistic Director";
+            case _212112: return "Media Producer (excluding Video)";
+            case _212113: return "Radio Presenter";
+            case _212114: return "Television Presenter";
+            case _212200: return "Authors, and Book and Script Editors not further defined";
+            case _212211: return "Author";
+            case _212212: return "Book or Script Editor";
+            case _212300: return "Film, Television, Radio and Stage Directors not further defined";
+            case _212311: return "Art Director (Film, Television or Stage)";
+            case _212312: return "Director (Film, Television, Radio or Stage)";
+            case _212313: return "Director of Photography";
+            case _212314: return "Film and Video Editor";
+            case _212315: return "Program Director (Television or Radio)";
+            case _212316: return "Stage Manager";
+            case _212317: return "Technical Director";
+            case _212318: return "Video Producer";
+            case _212399: return "Film, Television, Radio and Stage Directors not elsewhere classified";
+            case _212400: return "Journalists and Other Writers not further defined";
+            case _212411: return "Copywriter";
+            case _212412: return "Newspaper or Periodical Editor";
+            case _212413: return "Print Journalist";
+            case _212414: return "Radio Journalist";
+            case _212415: return "Technical Writer";
+            case _212416: return "Television Journalist";
+            case _212499: return "Journalists and Other Writers not elsewhere classified";
+            case _220000: return "Business, Human Resource and Marketing Professionals not further defined";
+            case _221000: return "Accountants, Auditors and Company Secretaries not further defined";
+            case _221100: return "Accountants not further defined";
+            case _221111: return "Accountant (General)";
+            case _221112: return "Management Accountant";
+            case _221113: return "Taxation Accountant";
+            case _221200: return "Auditors, Company Secretaries and Corporate Treasurers not further defined";
+            case _221211: return "Company Secretary";
+            case _221212: return "Corporate Treasurer";
+            case _221213: return "External Auditor";
+            case _221214: return "Internal Auditor";
+            case _222000: return "Financial Brokers and Dealers, and Investment Advisers not further defined";
+            case _222100: return "Financial Brokers not further defined";
+            case _222111: return "Commodities Trader";
+            case _222112: return "Finance Broker";
+            case _222113: return "Insurance Broker";
+            case _222199: return "Financial Brokers not elsewhere classified";
+            case _222200: return "Financial Dealers not further defined";
+            case _222211: return "Financial Market Dealer";
+            case _222212: return "Futures Trader";
+            case _222213: return "Stockbroking Dealer";
+            case _222299: return "Financial Dealers not elsewhere classified";
+            case _222300: return "Financial Investment Advisers and Managers not further defined";
+            case _222311: return "Financial Investment Adviser";
+            case _222312: return "Financial Investment Manager";
+            case _223000: return "Human Resource and Training Professionals not further defined";
+            case _223100: return "Human Resource Professionals not further defined";
+            case _223111: return "Human Resource Adviser";
+            case _223112: return "Recruitment Consultant";
+            case _223113: return "Workplace Relations Adviser";
+            case _223211: return "ICT Trainer";
+            case _223311: return "Training and Development Professional";
+            case _224000: return "Information and Organization Professionals not further defined";
+            case _224100: return "Actuaries, Mathematicians and Statisticians not further defined";
+            case _224111: return "Actuary";
+            case _224112: return "Mathematician";
+            case _224113: return "Statistician";
+            case _224200: return "Archivists, Curators and Records Managers not further defined";
+            case _224211: return "Archivist";
+            case _224212: return "Gallery or Museum Curator";
+            case _224213: return "Health Information Manager";
+            case _224214: return "Records Manager";
+            case _224311: return "Economist";
+            case _224400: return "Intelligence and Policy Analysts not further defined";
+            case _224411: return "Intelligence Officer";
+            case _224412: return "Policy Analyst";
+            case _224500: return "Land Economists and Valuers not further defined";
+            case _224511: return "Land Economist";
+            case _224512: return "Valuer";
+            case _224611: return "Librarian";
+            case _224700: return "Management and Organization Analysts not further defined";
+            case _224711: return "Management Consultant";
+            case _224712: return "Organization and Methods Analyst";
+            case _224900: return "Other Information and Organization Professionals not further defined";
+            case _224911: return "Electorate Officer";
+            case _224912: return "Liaison Officer";
+            case _224913: return "Migration Agent";
+            case _224914: return "Patents Examiner";
+            case _224999: return "Information and Organization Professionals not elsewhere classified";
+            case _225000: return "Sales, Marketing and Public Relations Professionals not further defined";
+            case _225100: return "Advertising and Marketing Professionals not further defined";
+            case _225111: return "Advertising Specialist";
+            case _225112: return "Market Research Analyst";
+            case _225113: return "Marketing Specialist";
+            case _225200: return "ICT Sales Professionals not further defined";
+            case _225211: return "ICT Account Manager";
+            case _225212: return "ICT Business Development Manager";
+            case _225213: return "ICT Sales Representative";
+            case _225311: return "Public Relations Professional";
+            case _225400: return "Technical Sales Representatives not further defined";
+            case _225411: return "Sales Representative (Industrial Products)";
+            case _225412: return "Sales Representative (Medical and Pharmaceutical Products)";
+            case _225499: return "Technical Sales Representatives not elsewhere classified";
+            case _230000: return "Design, Engineering, Science and Transport Professionals not further defined";
+            case _231000: return "Air and Marine Transport Professionals not further defined";
+            case _231100: return "Air Transport Professionals not further defined";
+            case _231111: return "Aeroplane Pilot";
+            case _231112: return "Air Traffic Controller";
+            case _231113: return "Flying Instructor";
+            case _231114: return "Helicopter Pilot";
+            case _231199: return "Air Transport Professionals not elsewhere classified";
+            case _231200: return "Marine Transport Professionals not further defined";
+            case _231211: return "Master Fisher";
+            case _231212: return "Ship's Engineer";
+            case _231213: return "Ship's Master";
+            case _231214: return "Ship's Officer";
+            case _231215: return "Ship's Surveyor";
+            case _231299: return "Marine Transport Professionals not elsewhere classified";
+            case _232000: return "Architects, Designers, Planners and Surveyors not further defined";
+            case _232100: return "Architects and Landscape Architects not further defined";
+            case _232111: return "Architect";
+            case _232112: return "Landscape Architect";
+            case _232200: return "Cartographers and Surveyors not further defined";
+            case _232211: return "Cartographer";
+            case _232212: return "Surveyor";
+            case _232300: return "Fashion, Industrial and Jewellery Designers not further defined";
+            case _232311: return "Fashion Designer";
+            case _232312: return "Industrial Designer";
+            case _232313: return "Jewellery Designer";
+            case _232400: return "Graphic and Web Designers, and Illustrators not further defined";
+            case _232411: return "Graphic Designer";
+            case _232412: return "Illustrator";
+            case _232413: return "Multimedia Designer";
+            case _232414: return "Web Designer";
+            case _232511: return "Interior Designer";
+            case _232611: return "Urban and Regional Planner";
+            case _233000: return "Engineering Professionals not further defined";
+            case _233100: return "Chemical and Materials Engineers not further defined";
+            case _233111: return "Chemical Engineer";
+            case _233112: return "Materials Engineer";
+            case _233200: return "Civil Engineering Professionals not further defined";
+            case _233211: return "Civil Engineer";
+            case _233212: return "Geotechnical Engineer";
+            case _233213: return "Quantity Surveyor";
+            case _233214: return "Structural Engineer";
+            case _233215: return "Transport Engineer";
+            case _233311: return "Electrical Engineer";
+            case _233411: return "Electronics Engineer";
+            case _233500: return "Industrial, Mechanical and Production Engineers not further defined";
+            case _233511: return "Industrial Engineer";
+            case _233512: return "Mechanical Engineer";
+            case _233513: return "Production or Plant Engineer";
+            case _233600: return "Mining Engineers not further defined";
+            case _233611: return "Mining Engineer (excluding Petroleum)";
+            case _233612: return "Petroleum Engineer";
+            case _233900: return "Other Engineering Professionals not further defined";
+            case _233911: return "Aeronautical Engineer";
+            case _233912: return "Agricultural Engineer";
+            case _233913: return "Biomedical Engineer";
+            case _233914: return "Engineering Technologist";
+            case _233915: return "Environmental Engineer";
+            case _233916: return "Naval Architect";
+            case _233999: return "Engineering Professionals not elsewhere classified";
+            case _234000: return "Natural and Physical Science Professionals not further defined";
+            case _234100: return "Agricultural and Forestry Scientists not further defined";
+            case _234111: return "Agricultural Consultant";
+            case _234112: return "Agricultural Scientist";
+            case _234113: return "Forester";
+            case _234200: return "Chemists, and Food and Wine Scientists not further defined";
+            case _234211: return "Chemist";
+            case _234212: return "Food Technologist";
+            case _234213: return "Wine Maker";
+            case _234300: return "Environmental Scientists not further defined";
+            case _234311: return "Conservation Officer";
+            case _234312: return "Environmental Consultant";
+            case _234313: return "Environmental Research Scientist";
+            case _234314: return "Park Ranger";
+            case _234399: return "Environmental Scientists not elsewhere classified";
+            case _234400: return "Geologists and Geophysicists not further defined";
+            case _234411: return "Geologist";
+            case _234412: return "Geophysicist";
+            case _234500: return "Life Scientists not further defined";
+            case _234511: return "Life Scientist (General)";
+            case _234512: return "Anatomist or Physiologist";
+            case _234513: return "Biochemist";
+            case _234514: return "Biotechnologist";
+            case _234515: return "Botanist";
+            case _234516: return "Marine Biologist";
+            case _234517: return "Microbiologist";
+            case _234518: return "Zoologist";
+            case _234599: return "Life Scientists not elsewhere classified";
+            case _234611: return "Medical Laboratory Scientist";
+            case _234711: return "Veterinarian";
+            case _234900: return "Other Natural and Physical Science Professionals not further defined";
+            case _234911: return "Conservator";
+            case _234912: return "Metallurgist";
+            case _234913: return "Meteorologist";
+            case _234914: return "Physicist";
+            case _234999: return "Natural and Physical Science Professionals not elsewhere classified";
+            case _240000: return "Education Professionals not further defined";
+            case _241000: return "School Teachers not further defined";
+            case _241111: return "Early Childhood (Pre-primary School) Teacher";
+            case _241213: return "Primary School Teacher";
+            case _241311: return "Middle School Teacher";
+            case _241411: return "Secondary School Teacher";
+            case _241500: return "Special Education Teachers not further defined";
+            case _241511: return "Special Needs Teacher";
+            case _241512: return "Teacher of the Hearing Impaired";
+            case _241513: return "Teacher of the Sight Impaired";
+            case _241599: return "Special Education Teachers not elsewhere classified";
+            case _242000: return "Tertiary Education Teachers not further defined";
+            case _242100: return "University Lecturers and Tutors not further defined";
+            case _242111: return "University Lecturer";
+            case _242112: return "University Tutor";
+            case _242211: return "Vocational Education Teacher";
+            case _249000: return "Miscellaneous Education Professionals not further defined";
+            case _249100: return "Education Advisers and Reviewers not further defined";
+            case _249111: return "Education Adviser";
+            case _249112: return "Education Reviewer";
+            case _249200: return "Private Tutors and Teachers not further defined";
+            case _249211: return "Art Teacher (Private Tuition)";
+            case _249212: return "Dance Teacher (Private Tuition)";
+            case _249213: return "Drama Teacher (Private Tuition)";
+            case _249214: return "Music Teacher (Private Tuition)";
+            case _249299: return "Private Tutors and Teachers not elsewhere classified";
+            case _249311: return "Teacher of English to Speakers of Other Languages";
+            case _250000: return "Health Professionals not further defined";
+            case _251000: return "Health Diagnostic and Promotion Professionals not further defined";
+            case _251111: return "Dietitian";
+            case _251200: return "Medical Imaging Professionals not further defined";
+            case _251211: return "Medical Diagnostic Radiographer";
+            case _251212: return "Medical Radiation Therapist";
+            case _251213: return "Nuclear Medicine Technologist";
+            case _251214: return "Sonographer";
+            case _251300: return "Occupational and Environmental Health Professionals not further defined";
+            case _251311: return "Environmental Health Officer";
+            case _251312: return "Occupational Health and Safety Adviser";
+            case _251400: return "Optometrists and Orthoptists not further defined";
+            case _251411: return "Optometrist";
+            case _251412: return "Orthoptist";
+            case _251500: return "Pharmacists not further defined";
+            case _251511: return "Hospital Pharmacist";
+            case _251512: return "Industrial Pharmacist";
+            case _251513: return "Retail Pharmacist";
+            case _251900: return "Other Health Diagnostic and Promotion Professionals not further defined";
+            case _251911: return "Health Promotion Officer";
+            case _251912: return "Orthotist or Prosthetist";
+            case _251999: return "Health Diagnostic and Promotion Professionals not elsewhere classified";
+            case _252000: return "Health Therapy Professionals not further defined";
+            case _252100: return "Chiropractors and Osteopaths not further defined";
+            case _252111: return "Chiropractor";
+            case _252112: return "Osteopath";
+            case _252200: return "Complementary Health Therapists not further defined";
+            case _252211: return "Acupuncturist";
+            case _252212: return "Homoeopath";
+            case _252213: return "Naturopath";
+            case _252214: return "Traditional Chinese Medicine Practitioner";
+            case _252299: return "Complementary Health Therapists not elsewhere classified";
+            case _252300: return "Dental Practitioners not further defined";
+            case _252311: return "Dental Specialist";
+            case _252312: return "Dentist";
+            case _252411: return "Occupational Therapist";
+            case _252511: return "Physiotherapist";
+            case _252611: return "Podiatrist";
+            case _252700: return "Speech Professionals and Audiologists not further defined";
+            case _252711: return "Audiologist";
+            case _252712: return "Speech Pathologist";
+            case _253000: return "Medical Practitioners not further defined";
+            case _253100: return "Generalist Medical Practitioners not further defined";
+            case _253111: return "General Medical Practitioner";
+            case _253112: return "Resident Medical Officer";
+            case _253211: return "Anaesthetist";
+            case _253300: return "Internal Medicine Specialists not further defined";
+            case _253311: return "Specialist Physician (General Medicine)";
+            case _253312: return "Cardiologist";
+            case _253313: return "Clinical Haematologist";
+            case _253314: return "Clinical Oncologist";
+            case _253315: return "Endocrinologist";
+            case _253316: return "Gastroenterologist";
+            case _253317: return "Intensive Care Specialist";
+            case _253318: return "Neurologist";
+            case _253321: return "Paediatrician";
+            case _253322: return "Renal Medicine Specialist";
+            case _253323: return "Rheumatologist";
+            case _253324: return "Thoracic Medicine Specialist";
+            case _253399: return "Internal Medicine Specialists not elsewhere classified";
+            case _253411: return "Psychiatrist";
+            case _253500: return "Surgeons not further defined";
+            case _253511: return "Surgeon (General)";
+            case _253512: return "Cardiothoracic Surgeon";
+            case _253513: return "Neurosurgeon";
+            case _253514: return "Orthopaedic Surgeon";
+            case _253515: return "Otorhinolaryngologist";
+            case _253516: return "Paediatric Surgeon";
+            case _253517: return "Plastic and Reconstructive Surgeon";
+            case _253518: return "Urologist";
+            case _253521: return "Vascular Surgeon";
+            case _253900: return "Other Medical Practitioners not further defined";
+            case _253911: return "Dermatologist";
+            case _253912: return "Emergency Medicine Specialist";
+            case _253913: return "Obstetrician and Gynaecologist";
+            case _253914: return "Ophthalmologist";
+            case _253915: return "Pathologist";
+            case _253916: return "Radiologist";
+            case _253999: return "Medical Practitioners not elsewhere classified";
+            case _254000: return "Midwifery and Nursing Professionals not further defined";
+            case _254111: return "Midwife";
+            case _254200: return "Nurse Educators and Researchers not further defined";
+            case _254211: return "Nurse Educator";
+            case _254212: return "Nurse Researcher";
+            case _254311: return "Nurse Manager";
+            case _254400: return "Registered Nurses not further defined";
+            case _254411: return "Nurse Practitioner";
+            case _254412: return "Registered Nurse (Aged Care)";
+            case _254413: return "Registered Nurse (Child and Family Health)";
+            case _254414: return "Registered Nurse (Community Health)";
+            case _254415: return "Registered Nurse (Critical Care and Emergency)";
+            case _254416: return "Registered Nurse (Developmental Disability)";
+            case _254417: return "Registered Nurse (Disability and Rehabilitation)";
+            case _254418: return "Registered Nurse (Medical)";
+            case _254421: return "Registered Nurse (Medical Practice)";
+            case _254422: return "Registered Nurse (Mental Health)";
+            case _254423: return "Registered Nurse (Perioperative)";
+            case _254424: return "Registered Nurse (Surgical)";
+            case _254499: return "Registered Nurses not elsewhere classified";
+            case _260000: return "ICT Professionals not further defined";
+            case _261000: return "Business and Systems Analysts, and Programmers not further defined";
+            case _261100: return "ICT Business and Systems Analysts not further defined";
+            case _261111: return "ICT Business Analyst";
+            case _261112: return "Systems Analyst";
+            case _261200: return "Multimedia Specialists and Web Developers not further defined";
+            case _261211: return "Multimedia Specialist";
+            case _261212: return "Web Developer";
+            case _261300: return "Software and Applications Programmers not further defined";
+            case _261311: return "Analyst Programmer";
+            case _261312: return "Developer Programmer";
+            case _261313: return "Software Engineer";
+            case _261399: return "Software and Applications Programmers not elsewhere classified";
+            case _262100: return "Database and Systems Administrators, and ICT Security Specialists not further defined";
+            case _262111: return "Database Administrator";
+            case _262112: return "ICT Security Specialist";
+            case _262113: return "Systems Administrator";
+            case _263000: return "ICT Network and Support Professionals not further defined";
+            case _263100: return "Computer Network Professionals not further defined";
+            case _263111: return "Computer Network and Systems Engineer";
+            case _263112: return "Network Administrator";
+            case _263113: return "Network Analyst";
+            case _263200: return "ICT Support and Test Engineers not further defined";
+            case _263211: return "ICT Quality Assurance Engineer";
+            case _263212: return "ICT Support Engineer";
+            case _263213: return "ICT Systems Test Engineer";
+            case _263299: return "ICT Support and Test Engineers not elsewhere classified";
+            case _263300: return "Telecommunications Engineering Professionals not further defined";
+            case _263311: return "Telecommunications Engineer";
+            case _263312: return "Telecommunications Network Engineer";
+            case _270000: return "Legal, Social and Welfare Professionals not further defined";
+            case _271000: return "Legal Professionals not further defined";
+            case _271111: return "Barrister";
+            case _271200: return "Judicial and Other Legal Professionals not further defined";
+            case _271211: return "Judge";
+            case _271212: return "Magistrate";
+            case _271213: return "Tribunal Member";
+            case _271299: return "Judicial and Other Legal Professionals not elsewhere classified";
+            case _271311: return "Solicitor";
+            case _272000: return "Social and Welfare Professionals not further defined";
+            case _272100: return "Counsellors not further defined";
+            case _272111: return "Careers Counsellor";
+            case _272112: return "Drug and Alcohol Counsellor";
+            case _272113: return "Family and Marriage Counsellor";
+            case _272114: return "Rehabilitation Counsellor";
+            case _272115: return "Student Counsellor";
+            case _272199: return "Counsellors not elsewhere classified";
+            case _272211: return "Minister of Religion";
+            case _272300: return "Psychologists not further defined";
+            case _272311: return "Clinical Psychologist";
+            case _272312: return "Educational Psychologist";
+            case _272313: return "Organizational Psychologist";
+            case _272314: return "Psychotherapist";
+            case _272399: return "Psychologists not elsewhere classified";
+            case _272400: return "Social Professionals not further defined";
+            case _272411: return "Historian";
+            case _272412: return "Interpreter";
+            case _272413: return "Translator";
+            case _272499: return "Social Professionals not elsewhere classified";
+            case _272511: return "Social Worker";
+            case _272600: return "Welfare, Recreation and Community Arts Workers not further defined";
+            case _272611: return "Community Arts Worker";
+            case _272612: return "Recreation Officer";
+            case _272613: return "Welfare Worker";
+            case _300000: return "Technicians and Trades Workers not further defined";
+            case _310000: return "Engineering, ICT and Science Technicians not further defined";
+            case _311000: return "Agricultural, Medical and Science Technicians not further defined";
+            case _311111: return "Agricultural Technician";
+            case _311200: return "Medical Technicians not further defined";
+            case _311211: return "Anaesthetic Technician";
+            case _311212: return "Cardiac Technician";
+            case _311213: return "Medical Laboratory Technician";
+            case _311214: return "Operating Theatre Technician";
+            case _311215: return "Pharmacy Technician";
+            case _311299: return "Medical Technicians not elsewhere classified";
+            case _311300: return "Primary Products Inspectors not further defined";
+            case _311311: return "Fisheries Officer";
+            case _311312: return "Meat Inspector";
+            case _311313: return "Quarantine Officer";
+            case _311399: return "Primary Products Inspectors not elsewhere classified";
+            case _311400: return "Science Technicians not further defined";
+            case _311411: return "Chemistry Technician";
+            case _311412: return "Earth Science Technician";
+            case _311413: return "Life Science Technician";
+            case _311414: return "School Laboratory Technician";
+            case _311499: return "Science Technicians not elsewhere classified";
+            case _312000: return "Building and Engineering Technicians not further defined";
+            case _312100: return "Architectural, Building and Surveying Technicians not further defined";
+            case _312111: return "Architectural Draftsperson";
+            case _312112: return "Building Associate";
+            case _312113: return "Building Inspector";
+            case _312114: return "Construction Estimator";
+            case _312115: return "Plumbing Inspector";
+            case _312116: return "Surveying or Cartographic Technician";
+            case _312200: return "Civil Engineering Draftspersons and Technicians not further defined";
+            case _312211: return "Civil Engineering Draftsperson";
+            case _312212: return "Civil Engineering Technician";
+            case _312300: return "Electrical Engineering Draftspersons and Technicians not further defined";
+            case _312311: return "Electrical Engineering Draftsperson";
+            case _312312: return "Electrical Engineering Technician";
+            case _312400: return "Electronic Engineering Draftspersons and Technicians not further defined";
+            case _312411: return "Electronic Engineering Draftsperson";
+            case _312412: return "Electronic Engineering Technician";
+            case _312500: return "Mechanical Engineering Draftspersons and Technicians not further defined";
+            case _312511: return "Mechanical Engineering Draftsperson";
+            case _312512: return "Mechanical Engineering Technician";
+            case _312611: return "Safety Inspector";
+            case _312900: return "Other Building and Engineering Technicians not further defined";
+            case _312911: return "Maintenance Planner";
+            case _312912: return "Metallurgical or Materials Technician";
+            case _312913: return "Mine Deputy";
+            case _312999: return "Building and Engineering Technicians not elsewhere classified";
+            case _313000: return "ICT and Telecommunications Technicians not further defined";
+            case _313100: return "ICT Support Technicians not further defined";
+            case _313111: return "Hardware Technician";
+            case _313112: return "ICT Customer Support Officer";
+            case _313113: return "Web Administrator";
+            case _313199: return "ICT Support Technicians not elsewhere classified";
+            case _313200: return "Telecommunications Technical Specialists not further defined";
+            case _313211: return "Radiocommunications Technician";
+            case _313212: return "Telecommunications Field Engineer";
+            case _313213: return "Telecommunications Network Planner";
+            case _313214: return "Telecommunications Technical Officer or Technologist";
+            case _320000: return "Automotive and Engineering Trades Workers not further defined";
+            case _321000: return "Automotive Electricians and Mechanics not further defined";
+            case _321111: return "Automotive Electrician";
+            case _321200: return "Motor Mechanics not further defined";
+            case _321211: return "Motor Mechanic (General)";
+            case _321212: return "Diesel Motor Mechanic";
+            case _321213: return "Motorcycle Mechanic";
+            case _321214: return "Small Engine Mechanic";
+            case _322000: return "Fabrication Engineering Trades Workers not further defined";
+            case _322100: return "Metal Casting, Forging and Finishing Trades Workers not further defined";
+            case _322111: return "Blacksmith";
+            case _322112: return "Electroplater";
+            case _322113: return "Farrier";
+            case _322114: return "Metal Casting Trades Worker";
+            case _322115: return "Metal Polisher";
+            case _322211: return "Sheetmetal Trades Worker";
+            case _322300: return "Structural Steel and Welding Trades Workers not further defined";
+            case _322311: return "Metal Fabricator";
+            case _322312: return "Pressure Welder";
+            case _322313: return "Welder (First Class)";
+            case _323000: return "Mechanical Engineering Trades Workers not further defined";
+            case _323100: return "Aircraft Maintenance Engineers not further defined";
+            case _323111: return "Aircraft Maintenance Engineer (Avionics)";
+            case _323112: return "Aircraft Maintenance Engineer (Mechanical)";
+            case _323113: return "Aircraft Maintenance Engineer (Structures)";
+            case _323200: return "Metal Fitters and Machinists not further defined";
+            case _323211: return "Fitter (General)";
+            case _323212: return "Fitter and Turner";
+            case _323213: return "Fitter-Welder";
+            case _323214: return "Metal Machinist (First Class)";
+            case _323215: return "Textile, Clothing and Footwear Mechanic";
+            case _323299: return "Metal Fitters and Machinists not elsewhere classified";
+            case _323300: return "Precision Metal Trades Workers not further defined";
+            case _323311: return "Engraver";
+            case _323312: return "Gunsmith";
+            case _323313: return "Locksmith";
+            case _323314: return "Precision Instrument Maker and Repairer";
+            case _323315: return "Saw Maker and Repairer";
+            case _323316: return "Watch and Clock Maker and Repairer";
+            case _323400: return "Toolmakers and Engineering Patternmakers not further defined";
+            case _323411: return "Engineering Patternmaker";
+            case _323412: return "Toolmaker";
+            case _324000: return "Panelbeaters, and Vehicle Body Builders, Trimmers and Painters not further defined";
+            case _324111: return "Panelbeater";
+            case _324200: return "Vehicle Body Builders and Trimmers not further defined";
+            case _324211: return "Vehicle Body Builder";
+            case _324212: return "Vehicle Trimmer";
+            case _324311: return "Vehicle Painter";
+            case _330000: return "Construction Trades Workers not further defined";
+            case _331000: return "Bricklayers, and Carpenters and Joiners not further defined";
+            case _331100: return "Bricklayers and Stonemasons not further defined";
+            case _331111: return "Bricklayer";
+            case _331112: return "Stonemason";
+            case _331211: return "Carpenter and Joiner";
+            case _331212: return "Carpenter";
+            case _331213: return "Joiner";
+            case _332000: return "Floor Finishers and Painting Trades Workers not further defined";
+            case _332111: return "Floor Finisher";
+            case _332211: return "Painting Trades Worker";
+            case _333000: return "Glaziers, Plasterers and Tilers not further defined";
+            case _333111: return "Glazier";
+            case _333200: return "Plasterers not further defined";
+            case _333211: return "Fibrous Plasterer";
+            case _333212: return "Solid Plasterer";
+            case _333311: return "Roof Tiler";
+            case _333411: return "Wall and Floor Tiler";
+            case _334100: return "Plumbers not further defined";
+            case _334111: return "Plumber (General)";
+            case _334112: return "Airconditioning and Mechanical Services Plumber";
+            case _334113: return "Drainer";
+            case _334114: return "Gasfitter";
+            case _334115: return "Roof Plumber";
+            case _340000: return "Electrotechnology and Telecommunications Trades Workers not further defined";
+            case _341100: return "Electricians not further defined";
+            case _341111: return "Electrician (General)";
+            case _341112: return "Electrician (Special Class)";
+            case _341113: return "Lift Mechanic";
+            case _342000: return "Electronics and Telecommunications Trades Workers not further defined";
+            case _342111: return "Airconditioning and Refrigeration Mechanic";
+            case _342200: return "Electrical Distribution Trades Workers not further defined";
+            case _342211: return "Electrical Linesworker";
+            case _342212: return "Technical Cable Jointer";
+            case _342300: return "Electronics Trades Workers not further defined";
+            case _342311: return "Business Machine Mechanic";
+            case _342312: return "Communications Operator";
+            case _342313: return "Electronic Equipment Trades Worker";
+            case _342314: return "Electronic Instrument Trades Worker (General)";
+            case _342315: return "Electronic Instrument Trades Worker (Special Class)";
+            case _342400: return "Telecommunications Trades Workers not further defined";
+            case _342411: return "Cabler (Data and Telecommunications)";
+            case _342412: return "Telecommunications Cable Jointer";
+            case _342413: return "Telecommunications Linesworker";
+            case _342414: return "Telecommunications Technician";
+            case _351000: return "Food Trades Workers not further defined";
+            case _351100: return "Bakers and Pastrycooks not further defined";
+            case _351111: return "Baker";
+            case _351112: return "Pastrycook";
+            case _351211: return "Butcher or Smallgoods Maker";
+            case _351311: return "Chef";
+            case _351411: return "Cook";
+            case _360000: return "Skilled Animal and Horticultural Workers not further defined";
+            case _361000: return "Animal Attendants and Trainers, and Shearers not further defined";
+            case _361100: return "Animal Attendants and Trainers not further defined";
+            case _361111: return "Dog Handler or Trainer";
+            case _361112: return "Horse Trainer";
+            case _361113: return "Pet Groomer";
+            case _361114: return "Zookeeper";
+            case _361199: return "Animal Attendants and Trainers not elsewhere classified";
+            case _361211: return "Shearer";
+            case _361311: return "Veterinary Nurse";
+            case _362000: return "Horticultural Trades Workers not further defined";
+            case _362111: return "Florist";
+            case _362200: return "Gardeners not further defined";
+            case _362211: return "Gardener (General)";
+            case _362212: return "Arborist";
+            case _362213: return "Landscape Gardener";
+            case _362311: return "Greenkeeper";
+            case _362411: return "Nurseryperson";
+            case _390000: return "Other Technicians and Trades Workers not further defined";
+            case _391111: return "Hairdresser";
+            case _392000: return "Printing Trades Workers not further defined";
+            case _392100: return "Binders, Finishers and Screen Printers not further defined";
+            case _392111: return "Binder and Finisher";
+            case _392112: return "Screen Printer";
+            case _392211: return "Graphic Pre-press Trades Worker";
+            case _392300: return "Printers not further defined";
+            case _392311: return "Printing Machinist";
+            case _392312: return "Small Offset Printer";
+            case _393000: return "Textile, Clothing and Footwear Trades Workers not further defined";
+            case _393100: return "Canvas and Leather Goods Makers not further defined";
+            case _393111: return "Canvas Goods Maker";
+            case _393112: return "Leather Goods Maker";
+            case _393113: return "Sail Maker";
+            case _393114: return "Shoemaker";
+            case _393200: return "Clothing Trades Workers not further defined";
+            case _393211: return "Apparel Cutter";
+            case _393212: return "Clothing Patternmaker";
+            case _393213: return "Dressmaker or Tailor";
+            case _393299: return "Clothing Trades Workers not elsewhere classified";
+            case _393311: return "Upholsterer";
+            case _394000: return "Wood Trades Workers not further defined";
+            case _394111: return "Cabinetmaker";
+            case _394200: return "Wood Machinists and Other Wood Trades Workers not further defined";
+            case _394211: return "Furniture Finisher";
+            case _394212: return "Picture Framer";
+            case _394213: return "Wood Machinist";
+            case _394214: return "Wood Turner";
+            case _394299: return "Wood Machinists and Other Wood Trades Workers not elsewhere classified";
+            case _399000: return "Miscellaneous Technicians and Trades Workers not further defined";
+            case _399100: return "Boat Builders and Shipwrights not further defined";
+            case _399111: return "Boat Builder and Repairer";
+            case _399112: return "Shipwright";
+            case _399200: return "Chemical, Gas, Petroleum and Power Generation Plant Operators not further defined";
+            case _399211: return "Chemical Plant Operator";
+            case _399212: return "Gas or Petroleum Operator";
+            case _399213: return "Power Generation Plant Operator";
+            case _399300: return "Gallery, Library and Museum Technicians not further defined";
+            case _399311: return "Gallery or Museum Technician";
+            case _399312: return "Library Technician";
+            case _399411: return "Jeweller";
+            case _399500: return "Performing Arts Technicians not further defined";
+            case _399511: return "Broadcast Transmitter Operator";
+            case _399512: return "Camera Operator (Film, Television or Video)";
+            case _399513: return "Light Technician";
+            case _399514: return "Make Up Artist";
+            case _399515: return "Musical Instrument Maker or Repairer";
+            case _399516: return "Sound Technician";
+            case _399517: return "Television Equipment Operator";
+            case _399599: return "Performing Arts Technicians not elsewhere classified";
+            case _399611: return "Signwriter";
+            case _399900: return "Other Miscellaneous Technicians and Trades Workers not further defined";
+            case _399911: return "Diver";
+            case _399912: return "Interior Decorator";
+            case _399913: return "Optical Dispenser";
+            case _399914: return "Optical Mechanic";
+            case _399915: return "Photographer's Assistant";
+            case _399916: return "Plastics Technician";
+            case _399917: return "Wool Classer";
+            case _399999: return "Technicians and Trades Workers not elsewhere classified";
+            case _400000: return "Community and Personal Service Workers not further defined";
+            case _411000: return "Health and Welfare Support Workers not further defined";
+            case _411100: return "Ambulance Officers and Paramedics not further defined";
+            case _411111: return "Ambulance Officer";
+            case _411112: return "Intensive Care Ambulance Paramedic";
+            case _411200: return "Dental Hygienists, Technicians and Therapists not further defined";
+            case _411211: return "Dental Hygienist";
+            case _411212: return "Dental Prosthetist";
+            case _411213: return "Dental Technician";
+            case _411214: return "Dental Therapist";
+            case _411311: return "Diversional Therapist";
+            case _411400: return "Enrolled and Mothercraft Nurses not further defined";
+            case _411411: return "Enrolled Nurse";
+            case _411412: return "Mothercraft Nurse";
+            case _411511: return "Aboriginal and Torres Strait Islander Health Worker";
+            case _411611: return "Massage Therapist";
+            case _411700: return "Welfare Support Workers not further defined";
+            case _411711: return "Community Worker";
+            case _411712: return "Disabilities Services Officer";
+            case _411713: return "Family Support Worker";
+            case _411714: return "Parole or Probation Officer";
+            case _411715: return "Residential Care Officer";
+            case _411716: return "Youth Worker";
+            case _420000: return "Carers and Aides not further defined";
+            case _421100: return "Child Carers not further defined";
+            case _421111: return "Child Care Worker";
+            case _421112: return "Family Day Care Worker";
+            case _421113: return "Nanny";
+            case _421114: return "Out of School Hours Care Worker";
+            case _422100: return "Education Aides not further defined";
+            case _422111: return "Aboriginal and Torres Strait Islander Education Worker";
+            case _422112: return "Integration Aide";
+            case _422115: return "Preschool Aide";
+            case _422116: return "Teachers' Aide";
+            case _423000: return "Personal Carers and Assistants not further defined";
+            case _423111: return "Aged or Disabled Carer";
+            case _423211: return "Dental Assistant";
+            case _423300: return "Nursing Support and Personal Care Workers not further defined";
+            case _423311: return "Hospital Orderly";
+            case _423312: return "Nursing Support Worker";
+            case _423313: return "Personal Care Assistant";
+            case _423314: return "Therapy Aide";
+            case _423400: return "Special Care Workers not further defined";
+            case _423411: return "Child or Youth Residential Care Assistant";
+            case _423412: return "Hostel Parent";
+            case _423413: return "Refuge Worker";
+            case _431000: return "Hospitality Workers not further defined";
+            case _431100: return "Bar Attendants and Baristas not further defined";
+            case _431111: return "Bar Attendant";
+            case _431112: return "Barista";
+            case _431211: return "Cafe Worker";
+            case _431311: return "Gaming Worker";
+            case _431411: return "Hotel Service Manager";
+            case _431511: return "Waiter";
+            case _431900: return "Other Hospitality Workers not further defined";
+            case _431911: return "Bar Useful or Busser";
+            case _431912: return "Doorperson or Luggage Porter";
+            case _431999: return "Hospitality Workers not elsewhere classified";
+            case _440000: return "Protective Service Workers not further defined";
+            case _441000: return "Defence Force Members, Fire Fighters and Police not further defined";
+            case _441111: return "Defence Force Member - Other Ranks";
+            case _441200: return "Fire and Emergency Workers not further defined";
+            case _441211: return "Emergency Service Worker";
+            case _441212: return "Fire Fighter";
+            case _441300: return "Police not further defined";
+            case _441311: return "Detective";
+            case _441312: return "Police Officer";
+            case _442000: return "Prison and Security Officers not further defined";
+            case _442111: return "Prison Officer";
+            case _442200: return "Security Officers and Guards not further defined";
+            case _442211: return "Alarm, Security or Surveillance Monitor";
+            case _442212: return "Armoured Car Escort";
+            case _442213: return "Crowd Controller";
+            case _442214: return "Private Investigator";
+            case _442215: return "Retail Loss Prevention Officer";
+            case _442216: return "Security Consultant";
+            case _442217: return "Security Officer";
+            case _442299: return "Security Officers and Guards not elsewhere classified";
+            case _450000: return "Sports and Personal Service Workers not further defined";
+            case _451000: return "Personal Service and Travel Workers not further defined";
+            case _451111: return "Beauty Therapist";
+            case _451211: return "Driving Instructor";
+            case _451300: return "Funeral Workers not further defined";
+            case _451311: return "Funeral Director";
+            case _451399: return "Funeral Workers not elsewhere classified";
+            case _451400: return "Gallery, Museum and Tour Guides not further defined";
+            case _451411: return "Gallery or Museum Guide";
+            case _451412: return "Tour Guide";
+            case _451500: return "Personal Care Consultants not further defined";
+            case _451511: return "Natural Remedy Consultant";
+            case _451512: return "Weight Loss Consultant";
+            case _451600: return "Tourism and Travel Advisers not further defined";
+            case _451611: return "Tourist Information Officer";
+            case _451612: return "Travel Consultant";
+            case _451700: return "Travel Attendants not further defined";
+            case _451711: return "Flight Attendant";
+            case _451799: return "Travel Attendants not elsewhere classified";
+            case _451800: return "Other Personal Service Workers not further defined";
+            case _451811: return "Civil Celebrant";
+            case _451812: return "Hair or Beauty Salon Assistant";
+            case _451813: return "Sex Worker or Escort";
+            case _451899: return "Personal Service Workers not elsewhere classified";
+            case _452000: return "Sports and Fitness Workers not further defined";
+            case _452111: return "Fitness Instructor";
+            case _452200: return "Outdoor Adventure Guides not further defined";
+            case _452211: return "Bungy Jump Master";
+            case _452212: return "Fishing Guide";
+            case _452213: return "Hunting Guide";
+            case _452214: return "Mountain or Glacier Guide";
+            case _452215: return "Outdoor Adventure Instructor";
+            case _452216: return "Trekking Guide";
+            case _452217: return "Whitewater Rafting Guide";
+            case _452299: return "Outdoor Adventure Guides not elsewhere classified";
+            case _452300: return "Sports Coaches, Instructors and Officials not further defined";
+            case _452311: return "Diving Instructor (Open Water)";
+            case _452312: return "Gymnastics Coach or Instructor";
+            case _452313: return "Horse Riding Coach or Instructor";
+            case _452314: return "Snowsport Instructor";
+            case _452315: return "Swimming Coach or Instructor";
+            case _452316: return "Tennis Coach";
+            case _452317: return "Other Sports Coach or Instructor";
+            case _452318: return "Dog or Horse Racing Official";
+            case _452321: return "Sports Development Officer";
+            case _452322: return "Sports Umpire";
+            case _452323: return "Other Sports Official";
+            case _452400: return "Sportspersons not further defined";
+            case _452411: return "Footballer";
+            case _452412: return "Golfer";
+            case _452413: return "Jockey";
+            case _452414: return "Lifeguard";
+            case _452499: return "Sportspersons not elsewhere classified";
+            case _500000: return "Clerical and Administrative Workers not further defined";
+            case _510000: return "Office Managers and Program Administrators not further defined";
+            case _511100: return "Contract, Program and Project Administrators not further defined";
+            case _511111: return "Contract Administrator";
+            case _511112: return "Program or Project Administrator";
+            case _512000: return "Office and Practice Managers not further defined";
+            case _512111: return "Office Manager";
+            case _512200: return "Practice Managers not further defined";
+            case _512211: return "Health Practice Manager";
+            case _512299: return "Practice Managers not elsewhere classified";
+            case _521000: return "Personal Assistants and Secretaries not further defined";
+            case _521111: return "Personal Assistant";
+            case _521200: return "Secretaries not further defined";
+            case _521211: return "Secretary (General)";
+            case _521212: return "Legal Secretary";
+            case _530000: return "General Clerical Workers not further defined";
+            case _531111: return "General Clerk";
+            case _532100: return "Keyboard Operators not further defined";
+            case _532111: return "Data Entry Operator";
+            case _532112: return "Machine Shorthand Reporter";
+            case _532113: return "Word Processing Operator";
+            case _540000: return "Inquiry Clerks and Receptionists not further defined";
+            case _541000: return "Call or Contact Centre Information Clerks not further defined";
+            case _541100: return "Call or Contact Centre Workers not further defined";
+            case _541111: return "Call or Contact Centre Team Leader";
+            case _541112: return "Call or Contact Centre Operator";
+            case _541211: return "Inquiry Clerk";
+            case _542100: return "Receptionists not further defined";
+            case _542111: return "Receptionist (General)";
+            case _542112: return "Admissions Clerk";
+            case _542113: return "Hotel or Motel Receptionist";
+            case _542114: return "Medical Receptionist";
+            case _550000: return "Numerical Clerks not further defined";
+            case _551000: return "Accounting Clerks and Bookkeepers not further defined";
+            case _551100: return "Accounting Clerks not further defined";
+            case _551111: return "Accounts Clerk";
+            case _551112: return "Cost Clerk";
+            case _551211: return "Bookkeeper";
+            case _551311: return "Payroll Clerk";
+            case _552000: return "Financial and Insurance Clerks not further defined";
+            case _552111: return "Bank Worker";
+            case _552211: return "Credit or Loans Officer";
+            case _552300: return "Insurance, Money Market and Statistical Clerks not further defined";
+            case _552311: return "Bookmaker";
+            case _552312: return "Insurance Consultant";
+            case _552313: return "Money Market Clerk";
+            case _552314: return "Statistical Clerk";
+            case _561000: return "Clerical and Office Support Workers not further defined";
+            case _561100: return "Betting Clerks not further defined";
+            case _561111: return "Betting Agency Counter Clerk";
+            case _561112: return "Bookmaker's Clerk";
+            case _561113: return "Telephone Betting Clerk";
+            case _561199: return "Betting Clerks not elsewhere classified";
+            case _561200: return "Couriers and Postal Deliverers not further defined";
+            case _561211: return "Courier";
+            case _561212: return "Postal Delivery Officer";
+            case _561311: return "Filing or Registry Clerk";
+            case _561400: return "Mail Sorters not further defined";
+            case _561411: return "Mail Clerk";
+            case _561412: return "Postal Sorting Officer";
+            case _561511: return "Survey Interviewer";
+            case _561611: return "Switchboard Operator";
+            case _561900: return "Other Clerical and Office Support Workers not further defined";
+            case _561911: return "Classified Advertising Clerk";
+            case _561912: return "Meter Reader";
+            case _561913: return "Parking Inspector";
+            case _561999: return "Clerical and Office Support Workers not elsewhere classified";
+            case _590000: return "Other Clerical and Administrative Workers not further defined";
+            case _591000: return "Logistics Clerks not further defined";
+            case _591100: return "Purchasing and Supply Logistics Clerks not further defined";
+            case _591111: return "Order Clerk";
+            case _591112: return "Production Clerk";
+            case _591113: return "Purchasing Officer";
+            case _591114: return "Sales Clerk";
+            case _591115: return "Stock Clerk";
+            case _591116: return "Warehouse Administrator";
+            case _591200: return "Transport and Despatch Clerks not further defined";
+            case _591211: return "Despatching and Receiving Clerk";
+            case _591212: return "Import-Export Clerk";
+            case _599000: return "Miscellaneous Clerical and Administrative Workers not further defined";
+            case _599100: return "Conveyancers and Legal Executives not further defined";
+            case _599111: return "Conveyancer";
+            case _599112: return "Legal Executive";
+            case _599200: return "Court and Legal Clerks not further defined";
+            case _599211: return "Clerk of Court";
+            case _599212: return "Court Bailiff or Sheriff";
+            case _599213: return "Court Orderly";
+            case _599214: return "Law Clerk";
+            case _599215: return "Trust Officer";
+            case _599311: return "Debt Collector";
+            case _599411: return "Human Resource Clerk";
+            case _599500: return "Inspectors and Regulatory Officers not further defined";
+            case _599511: return "Customs Officer";
+            case _599512: return "Immigration Officer";
+            case _599513: return "Motor Vehicle Licence Examiner";
+            case _599514: return "Noxious Weeds and Pest Inspector";
+            case _599515: return "Social Security Assessor";
+            case _599516: return "Taxation Inspector";
+            case _599517: return "Train Examiner";
+            case _599518: return "Transport Operations Inspector";
+            case _599521: return "Water Inspector";
+            case _599599: return "Inspectors and Regulatory Officers not elsewhere classified";
+            case _599600: return "Insurance Investigators, Loss Adjusters and Risk Surveyors not further defined";
+            case _599611: return "Insurance Investigator";
+            case _599612: return "Insurance Loss Adjuster";
+            case _599613: return "Insurance Risk Surveyor";
+            case _599711: return "Library Assistant";
+            case _599900: return "Other Miscellaneous Clerical and Administrative Workers not further defined";
+            case _599911: return "Coding Clerk";
+            case _599912: return "Production Assistant (Film, Television, Radio or Stage)";
+            case _599913: return "Proof Reader";
+            case _599914: return "Radio Despatcher";
+            case _599999: return "Clerical and Administrative Workers not elsewhere classified";
+            case _600000: return "Sales Workers not further defined";
+            case _610000: return "Sales Representatives and Agents not further defined";
+            case _611000: return "Insurance Agents and Sales Representatives not further defined";
+            case _611100: return "Auctioneers, and Stock and Station Agents not further defined";
+            case _611111: return "Auctioneer";
+            case _611112: return "Stock and Station Agent";
+            case _611211: return "Insurance Agent";
+            case _611300: return "Sales Representatives not further defined";
+            case _611311: return "Sales Representative (Building and Plumbing Supplies)";
+            case _611312: return "Sales Representative (Business Services)";
+            case _611313: return "Sales Representative (Motor Vehicle Parts and Accessories)";
+            case _611314: return "Sales Representative (Personal and Household Goods)";
+            case _611399: return "Sales Representatives not elsewhere classified";
+            case _612100: return "Real Estate Sales Agents not further defined";
+            case _612111: return "Business Broker";
+            case _612112: return "Property Manager";
+            case _612113: return "Real Estate Agency Principal";
+            case _612114: return "Real Estate Agent";
+            case _612115: return "Real Estate Representative";
+            case _621000: return "Sales Assistants and Salespersons not further defined";
+            case _621111: return "Sales Assistant (General)";
+            case _621211: return "ICT Sales Assistant";
+            case _621300: return "Motor Vehicle and Vehicle Parts Salespersons not further defined";
+            case _621311: return "Motor Vehicle or Caravan Salesperson";
+            case _621312: return "Motor Vehicle Parts Interpreter";
+            case _621411: return "Pharmacy Sales Assistant";
+            case _621511: return "Retail Supervisor";
+            case _621611: return "Service Station Attendant";
+            case _621700: return "Street Vendors and Related Salespersons not further defined";
+            case _621711: return "Cash Van Salesperson";
+            case _621712: return "Door-to-door Salesperson";
+            case _621713: return "Street Vendor";
+            case _621900: return "Other Sales Assistants and Salespersons not further defined";
+            case _621911: return "Materials Recycler";
+            case _621912: return "Rental Salesperson";
+            case _621999: return "Sales Assistants and Salespersons not elsewhere classified";
+            case _630000: return "Sales Support Workers not further defined";
+            case _631100: return "Checkout Operators and Office Cashiers not further defined";
+            case _631111: return "Checkout Operator";
+            case _631112: return "Office Cashier";
+            case _639000: return "Miscellaneous Sales Support Workers not further defined";
+            case _639100: return "Models and Sales Demonstrators not further defined";
+            case _639111: return "Model";
+            case _639112: return "Sales Demonstrator";
+            case _639200: return "Retail and Wool Buyers not further defined";
+            case _639211: return "Retail Buyer";
+            case _639212: return "Wool Buyer";
+            case _639311: return "Telemarketer";
+            case _639400: return "Ticket Salespersons not further defined";
+            case _639411: return "Ticket Seller";
+            case _639412: return "Transport Conductor";
+            case _639511: return "Visual Merchandiser";
+            case _639911: return "Other Sales Support Worker";
+            case _700000: return "Machinery Operators and Drivers not further defined";
+            case _710000: return "Machine and Stationary Plant Operators not further defined";
+            case _711000: return "Machine Operators not further defined";
+            case _711100: return "Clay, Concrete, Glass and Stone Processing Machine Operators not further defined";
+            case _711111: return "Clay Products Machine Operator";
+            case _711112: return "Concrete Products Machine Operator";
+            case _711113: return "Glass Production Machine Operator";
+            case _711114: return "Stone Processing Machine Operator";
+            case _711199: return "Clay, Concrete, Glass and Stone Processing Machine Operators not elsewhere classified";
+            case _711211: return "Industrial Spraypainter";
+            case _711300: return "Paper and Wood Processing Machine Operators not further defined";
+            case _711311: return "Paper Products Machine Operator";
+            case _711312: return "Wood Processing Machine Operator";
+            case _711411: return "Photographic Developer and Printer";
+            case _711500: return "Plastics and Rubber Production Machine Operators not further defined";
+            case _711511: return "Plastic Cablemaking Machine Operator";
+            case _711512: return "Plastic Compounding and Reclamation Machine Operator";
+            case _711513: return "Plastics Fabricator or Welder";
+            case _711514: return "Plastics Production Machine Operator (General)";
+            case _711515: return "Reinforced Plastic and Composite Production Worker";
+            case _711516: return "Rubber Production Machine Operator";
+            case _711599: return "Plastics and Rubber Production Machine Operators not elsewhere classified";
+            case _711611: return "Sewing Machinist";
+            case _711700: return "Textile and Footwear Production Machine Operators not further defined";
+            case _711711: return "Footwear Production Machine Operator";
+            case _711712: return "Hide and Skin Processing Machine Operator";
+            case _711713: return "Knitting Machine Operator";
+            case _711714: return "Textile Dyeing and Finishing Machine Operator";
+            case _711715: return "Weaving Machine Operator";
+            case _711716: return "Yarn Carding and Spinning Machine Operator";
+            case _711799: return "Textile and Footwear Production Machine Operators not elsewhere classified";
+            case _711900: return "Other Machine Operators not further defined";
+            case _711911: return "Chemical Production Machine Operator";
+            case _711912: return "Motion Picture Projectionist";
+            case _711913: return "Sand Blaster";
+            case _711914: return "Sterilisation Technician";
+            case _711999: return "Machine Operators not elsewhere classified";
+            case _712000: return "Stationary Plant Operators not further defined";
+            case _712111: return "Crane, Hoist or Lift Operator";
+            case _712200: return "Drillers, Miners and Shot Firers not further defined";
+            case _712211: return "Driller";
+            case _712212: return "Miner";
+            case _712213: return "Shot Firer";
+            case _712311: return "Engineering Production Systems Worker";
+            case _712900: return "Other Stationary Plant Operators not further defined";
+            case _712911: return "Boiler or Engine Operator";
+            case _712912: return "Bulk Materials Handling Plant Operator";
+            case _712913: return "Cement Production Plant Operator";
+            case _712914: return "Concrete Batching Plant Operator";
+            case _712915: return "Concrete Pump Operator";
+            case _712916: return "Paper and Pulp Mill Operator";
+            case _712917: return "Railway Signal Operator";
+            case _712918: return "Train Controller";
+            case _712921: return "Waste Water or Water Plant Operator";
+            case _712922: return "Weighbridge Operator";
+            case _712999: return "Stationary Plant Operators not elsewhere classified";
+            case _721000: return "Mobile Plant Operators not further defined";
+            case _721100: return "Agricultural, Forestry and Horticultural Plant Operators not further defined";
+            case _721111: return "Agricultural and Horticultural Mobile Plant Operator";
+            case _721112: return "Logging Plant Operator";
+            case _721200: return "Earthmoving Plant Operators not further defined";
+            case _721211: return "Earthmoving Plant Operator (General)";
+            case _721212: return "Backhoe Operator";
+            case _721213: return "Bulldozer Operator";
+            case _721214: return "Excavator Operator";
+            case _721215: return "Grader Operator";
+            case _721216: return "Loader Operator";
+            case _721311: return "Forklift Driver";
+            case _721900: return "Other Mobile Plant Operators not further defined";
+            case _721911: return "Aircraft Baggage Handler and Airline Ground Crew";
+            case _721912: return "Linemarker";
+            case _721913: return "Paving Plant Operator";
+            case _721914: return "Railway Track Plant Operator";
+            case _721915: return "Road Roller Operator";
+            case _721916: return "Streetsweeper Operator";
+            case _721999: return "Mobile Plant Operators not elsewhere classified";
+            case _730000: return "Road and Rail Drivers not further defined";
+            case _731000: return "Automobile, Bus and Rail Drivers not further defined";
+            case _731100: return "Automobile Drivers not further defined";
+            case _731111: return "Chauffeur";
+            case _731112: return "Taxi Driver";
+            case _731199: return "Automobile Drivers not elsewhere classified";
+            case _731200: return "Bus and Coach Drivers not further defined";
+            case _731211: return "Bus Driver";
+            case _731212: return "Charter and Tour Bus Driver";
+            case _731213: return "Passenger Coach Driver";
+            case _731300: return "Train and Tram Drivers not further defined";
+            case _731311: return "Train Driver";
+            case _731312: return "Tram Driver";
+            case _732111: return "Delivery Driver";
+            case _733100: return "Truck Drivers not further defined";
+            case _733111: return "Truck Driver (General)";
+            case _733112: return "Aircraft Refueller";
+            case _733113: return "Furniture Removalist";
+            case _733114: return "Tanker Driver";
+            case _733115: return "Tow Truck Driver";
+            case _741111: return "Storeperson";
+            case _800000: return "Labourers not further defined";
+            case _811000: return "Cleaners and Laundry Workers not further defined";
+            case _811111: return "Car Detailer";
+            case _811211: return "Commercial Cleaner";
+            case _811311: return "Domestic Cleaner";
+            case _811400: return "Housekeepers not further defined";
+            case _811411: return "Commercial Housekeeper";
+            case _811412: return "Domestic Housekeeper";
+            case _811500: return "Laundry Workers not further defined";
+            case _811511: return "Laundry Worker (General)";
+            case _811512: return "Drycleaner";
+            case _811513: return "Ironer or Presser";
+            case _811600: return "Other Cleaners not further defined";
+            case _811611: return "Carpet Cleaner";
+            case _811612: return "Window Cleaner";
+            case _811699: return "Cleaners not elsewhere classified";
+            case _821000: return "Construction and Mining Labourers not further defined";
+            case _821100: return "Building and Plumbing Labourers not further defined";
+            case _821111: return "Builder's Labourer";
+            case _821112: return "Drainage, Sewerage and Stormwater Labourer";
+            case _821113: return "Earthmoving Labourer";
+            case _821114: return "Plumber's Assistant";
+            case _821211: return "Concreter";
+            case _821311: return "Fencer";
+            case _821400: return "Insulation and Home Improvement Installers not further defined";
+            case _821411: return "Building Insulation Installer";
+            case _821412: return "Home Improvement Installer";
+            case _821511: return "Paving and Surfacing Labourer";
+            case _821611: return "Railway Track Worker";
+            case _821700: return "Structural Steel Construction Workers not further defined";
+            case _821711: return "Construction Rigger";
+            case _821712: return "Scaffolder";
+            case _821713: return "Steel Fixer";
+            case _821714: return "Structural Steel Erector";
+            case _821900: return "Other Construction and Mining Labourers not further defined";
+            case _821911: return "Crane Chaser";
+            case _821912: return "Driller's Assistant";
+            case _821913: return "Lagger";
+            case _821914: return "Mining Support Worker";
+            case _821915: return "Surveyor's Assistant";
+            case _830000: return "Factory Process Workers not further defined";
+            case _831000: return "Food Process Workers not further defined";
+            case _831100: return "Food and Drink Factory Workers not further defined";
+            case _831111: return "Baking Factory Worker";
+            case _831112: return "Brewery Worker";
+            case _831113: return "Confectionery Maker";
+            case _831114: return "Dairy Products Maker";
+            case _831115: return "Fruit and Vegetable Factory Worker";
+            case _831116: return "Grain Mill Worker";
+            case _831117: return "Sugar Mill Worker";
+            case _831118: return "Winery Cellar Hand";
+            case _831199: return "Food and Drink Factory Workers not elsewhere classified";
+            case _831200: return "Meat Boners and Slicers, and Slaughterers not further defined";
+            case _831211: return "Meat Boner and Slicer";
+            case _831212: return "Slaughterer";
+            case _831300: return "Meat, Poultry and Seafood Process Workers not further defined";
+            case _831311: return "Meat Process Worker";
+            case _831312: return "Poultry Process Worker";
+            case _831313: return "Seafood Process Worker";
+            case _832000: return "Packers and Product Assemblers not further defined";
+            case _832100: return "Packers not further defined";
+            case _832111: return "Chocolate Packer";
+            case _832112: return "Container Filler";
+            case _832113: return "Fruit and Vegetable Packer";
+            case _832114: return "Meat Packer";
+            case _832115: return "Seafood Packer";
+            case _832199: return "Packers not elsewhere classified";
+            case _832211: return "Product Assembler";
+            case _839000: return "Miscellaneous Factory Process Workers not further defined";
+            case _839111: return "Metal Engineering Process Worker";
+            case _839200: return "Plastics and Rubber Factory Workers not further defined";
+            case _839211: return "Plastics Factory Worker";
+            case _839212: return "Rubber Factory Worker";
+            case _839300: return "Product Quality Controllers not further defined";
+            case _839311: return "Product Examiner";
+            case _839312: return "Product Grader";
+            case _839313: return "Product Tester";
+            case _839400: return "Timber and Wood Process Workers not further defined";
+            case _839411: return "Paper and Pulp Mill Worker";
+            case _839412: return "Sawmill or Timber Yard Worker";
+            case _839413: return "Wood and Wood Products Factory Worker";
+            case _839900: return "Other Factory Process Workers not further defined";
+            case _839911: return "Cement and Concrete Plant Worker";
+            case _839912: return "Chemical Plant Worker";
+            case _839913: return "Clay Processing Factory Worker";
+            case _839914: return "Fabric and Textile Factory Worker";
+            case _839915: return "Footwear Factory Worker";
+            case _839916: return "Glass Processing Worker";
+            case _839917: return "Hide and Skin Processing Worker";
+            case _839999: return "Factory Process Workers not elsewhere classified";
+            case _841000: return "Farm, Forestry and Garden Workers not further defined";
+            case _841111: return "Aquaculture Worker";
+            case _841200: return "Crop Farm Workers not further defined";
+            case _841211: return "Fruit or Nut Farm Worker";
+            case _841212: return "Fruit or Nut Picker";
+            case _841213: return "Grain, Oilseed or Pasture Farm Worker";
+            case _841214: return "Vegetable Farm Worker";
+            case _841215: return "Vegetable Picker";
+            case _841216: return "Vineyard Worker";
+            case _841299: return "Crop Farm Workers not elsewhere classified";
+            case _841300: return "Forestry and Logging Workers not further defined";
+            case _841311: return "Forestry Worker";
+            case _841312: return "Logging Assistant";
+            case _841313: return "Tree Faller";
+            case _841400: return "Garden and Nursery Labourers not further defined";
+            case _841411: return "Garden Labourer";
+            case _841412: return "Horticultural Nursery Assistant";
+            case _841500: return "Livestock Farm Workers not further defined";
+            case _841511: return "Beef Cattle Farm Worker";
+            case _841512: return "Dairy Cattle Farm Worker";
+            case _841513: return "Mixed Livestock Farm Worker";
+            case _841514: return "Poultry Farm Worker";
+            case _841515: return "Sheep Farm Worker";
+            case _841516: return "Stablehand";
+            case _841517: return "Wool Handler";
+            case _841599: return "Livestock Farm Workers not elsewhere classified";
+            case _841611: return "Mixed Crop and Livestock Farm Worker";
+            case _841900: return "Other Farm, Forestry and Garden Workers not further defined";
+            case _841911: return "Hunter-Trapper";
+            case _841912: return "Pest or Weed Controller";
+            case _841999: return "Farm, Forestry and Garden Workers not elsewhere classified";
+            case _851000: return "Food Preparation Assistants not further defined";
+            case _851111: return "Fast Food Cook";
+            case _851200: return "Food Trades Assistants not further defined";
+            case _851211: return "Pastrycook's Assistant";
+            case _851299: return "Food Trades Assistants not elsewhere classified";
+            case _851311: return "Kitchenhand";
+            case _890000: return "Other Labourers not further defined";
+            case _891000: return "Freight Handlers and Shelf Fillers not further defined";
+            case _891100: return "Freight and Furniture Handlers not further defined";
+            case _891111: return "Freight Handler (Rail or Road)";
+            case _891112: return "Truck Driver's Offsider";
+            case _891113: return "Waterside Worker";
+            case _891211: return "Shelf Filler";
+            case _899000: return "Miscellaneous Labourers not further defined";
+            case _899111: return "Caretaker";
+            case _899200: return "Deck and Fishing Hands not further defined";
+            case _899211: return "Deck Hand";
+            case _899212: return "Fishing Hand";
+            case _899311: return "Handyperson";
+            case _899400: return "Motor Vehicle Parts and Accessories Fitters not further defined";
+            case _899411: return "Motor Vehicle Parts and Accessories Fitter (General)";
+            case _899412: return "Autoglazier";
+            case _899413: return "Exhaust and Muffler Fitter";
+            case _899414: return "Radiator Fitter";
+            case _899415: return "Tyre Fitter";
+            case _899500: return "Printing Assistants and Table Workers not further defined";
+            case _899511: return "Printer's Assistant";
+            case _899512: return "Printing Table Worker";
+            case _899611: return "Recycling or Rubbish Collector";
+            case _899711: return "Vending Machine Attendant";
+            case _899900: return "Other Miscellaneous Labourers not further defined";
+            case _899911: return "Bicycle Mechanic";
+            case _899912: return "Car Park Attendant";
+            case _899913: return "Crossing Supervisor";
+            case _899914: return "Electrical or Telecommunications Trades Assistant";
+            case _899915: return "Leaflet or Newspaper Deliverer";
+            case _899916: return "Mechanic's Assistant";
+            case _899917: return "Railways Assistant";
+            case _899918: return "Sign Erector";
+            case _899921: return "Ticket Collector or Usher";
+            case _899922: return "Trolley Collector";
+            case _899999: return "Labourers not elsewhere classified";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _100000: return "Managers nfd";
+            case _111000: return "Chief Executives, General Managers and Legislators nfd";
+            case _111111: return "Chief Executive or Managing Director";
+            case _111200: return "General Managers nfd";
+            case _111211: return "Corporate General Manager";
+            case _111212: return "Defence Force Senior Officer";
+            case _111300: return "Legislators nfd";
+            case _111311: return "Local Government Legislator";
+            case _111312: return "Member of Parliament";
+            case _111399: return "Legislators nec";
+            case _121000: return "Farmers and Farm Managers nfd";
+            case _121111: return "Aquaculture Farmer";
+            case _121200: return "Crop Farmers nfd";
+            case _121211: return "Cotton Grower";
+            case _121212: return "Flower Grower";
+            case _121213: return "Fruit or Nut Grower";
+            case _121214: return "Grain, Oilseed or Pasture Grower";
+            case _121215: return "Grape Grower";
+            case _121216: return "Mixed Crop Farmer";
+            case _121217: return "Sugar Cane Grower";
+            case _121218: return "Turf Grower";
+            case _121221: return "Vegetable Grower";
+            case _121299: return "Crop Farmers nec";
+            case _121300: return "Livestock Farmers nfd";
+            case _121311: return "Apiarist";
+            case _121312: return "Beef Cattle Farmer";
+            case _121313: return "Dairy Cattle Farmer";
+            case _121314: return "Deer Farmer";
+            case _121315: return "Goat Farmer";
+            case _121316: return "Horse Breeder";
+            case _121317: return "Mixed Livestock Farmer";
+            case _121318: return "Pig Farmer";
+            case _121321: return "Poultry Farmer";
+            case _121322: return "Sheep Farmer";
+            case _121399: return "Livestock Farmers nec";
+            case _121411: return "Mixed Crop and Livestock Farmer";
+            case _130000: return "Specialist Managers nfd";
+            case _131100: return "Advertising and Sales Managers nfd";
+            case _131111: return "Advertising and Public Relations Manager";
+            case _131112: return "Sales and Marketing Manager";
+            case _132000: return "Business Administration Managers nfd";
+            case _132111: return "Corporate Services Manager";
+            case _132211: return "Finance Manager";
+            case _132311: return "Human Resource Manager";
+            case _132411: return "Policy and Planning Manager";
+            case _132511: return "Research and Development Manager";
+            case _133000: return "Construction, Distribution and Production Managers nfd";
+            case _133100: return "Construction Managers nfd";
+            case _133111: return "Construction Project Manager";
+            case _133112: return "Project Builder";
+            case _133211: return "Engineering Manager";
+            case _133300: return "Importers, Exporters and Wholesalers nfd";
+            case _133311: return "Importer or Exporter";
+            case _133312: return "Wholesaler";
+            case _133411: return "Manufacturer";
+            case _133500: return "Production Managers nfd";
+            case _133511: return "Production Manager (Forestry)";
+            case _133512: return "Production Manager (Manufacturing)";
+            case _133513: return "Production Manager (Mining)";
+            case _133611: return "Supply and Distribution Manager";
+            case _134000: return "Education, Health and Welfare Services Managers nfd";
+            case _134111: return "Child Care Centre Manager";
+            case _134200: return "Health and Welfare Services Managers nfd";
+            case _134211: return "Medical Administrator";
+            case _134212: return "Nursing Clinical Director";
+            case _134213: return "Primary Health Organization Manager";
+            case _134214: return "Welfare Centre Manager";
+            case _134299: return "Health and Welfare Services Managers nec";
+            case _134311: return "School Principal";
+            case _134400: return "Other Education Managers nfd";
+            case _134411: return "Faculty Head";
+            case _134412: return "Regional Education Manager";
+            case _134499: return "Education Managers nec";
+            case _135100: return "ICT Managers nfd";
+            case _135111: return "Chief Information Officer";
+            case _135112: return "ICT Project Manager";
+            case _135199: return "ICT Managers nec";
+            case _139000: return "Miscellaneous Specialist Managers nfd";
+            case _139100: return "Commissioned Officers (Management) nfd";
+            case _139111: return "Commissioned Defence Force Officer";
+            case _139112: return "Commissioned Fire Officer";
+            case _139113: return "Commissioned Police Officer";
+            case _139211: return "Senior Non-commissioned Defence Force Member";
+            case _139900: return "Other Specialist Managers nfd";
+            case _139911: return "Arts Administrator or Manager";
+            case _139912: return "Environmental Manager";
+            case _139913: return "Laboratory Manager";
+            case _139914: return "Quality Assurance Manager";
+            case _139915: return "Sports Administrator";
+            case _139999: return "Specialist Managers nec";
+            case _140000: return "Hospitality, Retail and Service Managers nfd";
+            case _141000: return "Accommodation and Hospitality Managers nfd";
+            case _141111: return "Cafe or Restaurant Manager";
+            case _141211: return "Caravan Park and Camping Ground Manager";
+            case _141311: return "Hotel or Motel Manager";
+            case _141411: return "Licensed Club Manager";
+            case _141900: return "Other Accommodation and Hospitality Managers nfd";
+            case _141911: return "Bed and Breakfast Operator";
+            case _141999: return "Accommodation and Hospitality Managers nec";
+            case _142100: return "Retail Managers nfd";
+            case _142111: return "Retail Manager (General)";
+            case _142112: return "Antique Dealer";
+            case _142113: return "Betting Agency Manager";
+            case _142114: return "Hair or Beauty Salon Manager";
+            case _142115: return "Post Office Manager";
+            case _142116: return "Travel Agency Manager";
+            case _149000: return "Miscellaneous Hospitality, Retail and Service Managers nfd";
+            case _149100: return "Amusement, Fitness and Sports Centre Managers nfd";
+            case _149111: return "Amusement Centre Manager";
+            case _149112: return "Fitness Centre Manager";
+            case _149113: return "Sports Centre Manager";
+            case _149200: return "Call or Contact Centre and Customer Service Managers nfd";
+            case _149211: return "Call or Contact Centre Manager";
+            case _149212: return "Customer Service Manager";
+            case _149311: return "Conference and Event Organizer";
+            case _149400: return "Transport Services Managers nfd";
+            case _149411: return "Fleet Manager";
+            case _149412: return "Railway Station Manager";
+            case _149413: return "Transport Company Manager";
+            case _149900: return "Other Hospitality, Retail and Service Managers nfd";
+            case _149911: return "Boarding Kennel or Cattery Operator";
+            case _149912: return "Cinema or Theatre Manager";
+            case _149913: return "Facilities Manager";
+            case _149914: return "Financial Institution Branch Manager";
+            case _149999: return "Hospitality, Retail and Service Managers nec";
+            case _200000: return "Professionals nfd";
+            case _210000: return "Arts and Media Professionals nfd";
+            case _211000: return "Arts Professionals nfd";
+            case _211100: return "Actors, Dancers and Other Entertainers nfd";
+            case _211111: return "Actor";
+            case _211112: return "Dancer or Choreographer";
+            case _211113: return "Entertainer or Variety Artist";
+            case _211199: return "Actors, Dancers and Other Entertainers nec";
+            case _211200: return "Music Professionals nfd";
+            case _211211: return "Composer";
+            case _211212: return "Music Director";
+            case _211213: return "Musician (Instrumental)";
+            case _211214: return "Singer";
+            case _211299: return "Music Professionals nec";
+            case _211311: return "Photographer";
+            case _211400: return "Visual Arts and Crafts Professionals nfd";
+            case _211411: return "Painter (Visual Arts)";
+            case _211412: return "Potter or Ceramic Artist";
+            case _211413: return "Sculptor";
+            case _211499: return "Visual Arts and Crafts Professionals nec";
+            case _212000: return "Media Professionals nfd";
+            case _212100: return "Artistic Directors, and Media Producers and Presenters nfd";
+            case _212111: return "Artistic Director";
+            case _212112: return "Media Producer (excluding Video)";
+            case _212113: return "Radio Presenter";
+            case _212114: return "Television Presenter";
+            case _212200: return "Authors, and Book and Script Editors nfd";
+            case _212211: return "Author";
+            case _212212: return "Book or Script Editor";
+            case _212300: return "Film, Television, Radio and Stage Directors nfd";
+            case _212311: return "Art Director (Film, Television or Stage)";
+            case _212312: return "Director (Film, Television, Radio or Stage)";
+            case _212313: return "Director of Photography";
+            case _212314: return "Film and Video Editor";
+            case _212315: return "Program Director (Television or Radio)";
+            case _212316: return "Stage Manager";
+            case _212317: return "Technical Director";
+            case _212318: return "Video Producer";
+            case _212399: return "Film, Television, Radio and Stage Directors nec";
+            case _212400: return "Journalists and Other Writers nfd";
+            case _212411: return "Copywriter";
+            case _212412: return "Newspaper or Periodical Editor";
+            case _212413: return "Print Journalist";
+            case _212414: return "Radio Journalist";
+            case _212415: return "Technical Writer";
+            case _212416: return "Television Journalist";
+            case _212499: return "Journalists and Other Writers nec";
+            case _220000: return "Business, Human Resource and Marketing Professionals nfd";
+            case _221000: return "Accountants, Auditors and Company Secretaries nfd";
+            case _221100: return "Accountants nfd";
+            case _221111: return "Accountant (General)";
+            case _221112: return "Management Accountant";
+            case _221113: return "Taxation Accountant";
+            case _221200: return "Auditors, Company Secretaries and Corporate Treasurers nfd";
+            case _221211: return "Company Secretary";
+            case _221212: return "Corporate Treasurer";
+            case _221213: return "External Auditor";
+            case _221214: return "Internal Auditor";
+            case _222000: return "Financial Brokers and Dealers, and Investment Advisers nfd";
+            case _222100: return "Financial Brokers nfd";
+            case _222111: return "Commodities Trader";
+            case _222112: return "Finance Broker";
+            case _222113: return "Insurance Broker";
+            case _222199: return "Financial Brokers nec";
+            case _222200: return "Financial Dealers nfd";
+            case _222211: return "Financial Market Dealer";
+            case _222212: return "Futures Trader";
+            case _222213: return "Stockbroking Dealer";
+            case _222299: return "Financial Dealers nec";
+            case _222300: return "Financial Investment Advisers and Managers nfd";
+            case _222311: return "Financial Investment Adviser";
+            case _222312: return "Financial Investment Manager";
+            case _223000: return "Human Resource and Training Professionals nfd";
+            case _223100: return "Human Resource Professionals nfd";
+            case _223111: return "Human Resource Adviser";
+            case _223112: return "Recruitment Consultant";
+            case _223113: return "Workplace Relations Adviser";
+            case _223211: return "ICT Trainer";
+            case _223311: return "Training and Development Professional";
+            case _224000: return "Information and Organization Professionals nfd";
+            case _224100: return "Actuaries, Mathematicians and Statisticians nfd";
+            case _224111: return "Actuary";
+            case _224112: return "Mathematician";
+            case _224113: return "Statistician";
+            case _224200: return "Archivists, Curators and Records Managers nfd";
+            case _224211: return "Archivist";
+            case _224212: return "Gallery or Museum Curator";
+            case _224213: return "Health Information Manager";
+            case _224214: return "Records Manager";
+            case _224311: return "Economist";
+            case _224400: return "Intelligence and Policy Analysts nfd";
+            case _224411: return "Intelligence Officer";
+            case _224412: return "Policy Analyst";
+            case _224500: return "Land Economists and Valuers nfd";
+            case _224511: return "Land Economist";
+            case _224512: return "Valuer";
+            case _224611: return "Librarian";
+            case _224700: return "Management and Organization Analysts nfd";
+            case _224711: return "Management Consultant";
+            case _224712: return "Organization and Methods Analyst";
+            case _224900: return "Other Information and Organization Professionals nfd";
+            case _224911: return "Electorate Officer";
+            case _224912: return "Liaison Officer";
+            case _224913: return "Migration Agent";
+            case _224914: return "Patents Examiner";
+            case _224999: return "Information and Organization Professionals nec";
+            case _225000: return "Sales, Marketing and Public Relations Professionals nfd";
+            case _225100: return "Advertising and Marketing Professionals nfd";
+            case _225111: return "Advertising Specialist";
+            case _225112: return "Market Research Analyst";
+            case _225113: return "Marketing Specialist";
+            case _225200: return "ICT Sales Professionals nfd";
+            case _225211: return "ICT Account Manager";
+            case _225212: return "ICT Business Development Manager";
+            case _225213: return "ICT Sales Representative";
+            case _225311: return "Public Relations Professional";
+            case _225400: return "Technical Sales Representatives nfd";
+            case _225411: return "Sales Representative (Industrial Products)";
+            case _225412: return "Sales Representative (Medical and Pharmaceutical Products)";
+            case _225499: return "Technical Sales Representatives nec";
+            case _230000: return "Design, Engineering, Science and Transport Professionals nfd";
+            case _231000: return "Air and Marine Transport Professionals nfd";
+            case _231100: return "Air Transport Professionals nfd";
+            case _231111: return "Aeroplane Pilot";
+            case _231112: return "Air Traffic Controller";
+            case _231113: return "Flying Instructor";
+            case _231114: return "Helicopter Pilot";
+            case _231199: return "Air Transport Professionals nec";
+            case _231200: return "Marine Transport Professionals nfd";
+            case _231211: return "Master Fisher";
+            case _231212: return "Ship's Engineer";
+            case _231213: return "Ship's Master";
+            case _231214: return "Ship's Officer";
+            case _231215: return "Ship's Surveyor";
+            case _231299: return "Marine Transport Professionals nec";
+            case _232000: return "Architects, Designers, Planners and Surveyors nfd";
+            case _232100: return "Architects and Landscape Architects nfd";
+            case _232111: return "Architect";
+            case _232112: return "Landscape Architect";
+            case _232200: return "Cartographers and Surveyors nfd";
+            case _232211: return "Cartographer";
+            case _232212: return "Surveyor";
+            case _232300: return "Fashion, Industrial and Jewellery Designers nfd";
+            case _232311: return "Fashion Designer";
+            case _232312: return "Industrial Designer";
+            case _232313: return "Jewellery Designer";
+            case _232400: return "Graphic and Web Designers, and Illustrators nfd";
+            case _232411: return "Graphic Designer";
+            case _232412: return "Illustrator";
+            case _232413: return "Multimedia Designer";
+            case _232414: return "Web Designer";
+            case _232511: return "Interior Designer";
+            case _232611: return "Urban and Regional Planner";
+            case _233000: return "Engineering Professionals nfd";
+            case _233100: return "Chemical and Materials Engineers nfd";
+            case _233111: return "Chemical Engineer";
+            case _233112: return "Materials Engineer";
+            case _233200: return "Civil Engineering Professionals nfd";
+            case _233211: return "Civil Engineer";
+            case _233212: return "Geotechnical Engineer";
+            case _233213: return "Quantity Surveyor";
+            case _233214: return "Structural Engineer";
+            case _233215: return "Transport Engineer";
+            case _233311: return "Electrical Engineer";
+            case _233411: return "Electronics Engineer";
+            case _233500: return "Industrial, Mechanical and Production Engineers nfd";
+            case _233511: return "Industrial Engineer";
+            case _233512: return "Mechanical Engineer";
+            case _233513: return "Production or Plant Engineer";
+            case _233600: return "Mining Engineers nfd";
+            case _233611: return "Mining Engineer (excluding Petroleum)";
+            case _233612: return "Petroleum Engineer";
+            case _233900: return "Other Engineering Professionals nfd";
+            case _233911: return "Aeronautical Engineer";
+            case _233912: return "Agricultural Engineer";
+            case _233913: return "Biomedical Engineer";
+            case _233914: return "Engineering Technologist";
+            case _233915: return "Environmental Engineer";
+            case _233916: return "Naval Architect";
+            case _233999: return "Engineering Professionals nec";
+            case _234000: return "Natural and Physical Science Professionals nfd";
+            case _234100: return "Agricultural and Forestry Scientists nfd";
+            case _234111: return "Agricultural Consultant";
+            case _234112: return "Agricultural Scientist";
+            case _234113: return "Forester";
+            case _234200: return "Chemists, and Food and Wine Scientists nfd";
+            case _234211: return "Chemist";
+            case _234212: return "Food Technologist";
+            case _234213: return "Wine Maker";
+            case _234300: return "Environmental Scientists nfd";
+            case _234311: return "Conservation Officer";
+            case _234312: return "Environmental Consultant";
+            case _234313: return "Environmental Research Scientist";
+            case _234314: return "Park Ranger";
+            case _234399: return "Environmental Scientists nec";
+            case _234400: return "Geologists and Geophysicists nfd";
+            case _234411: return "Geologist";
+            case _234412: return "Geophysicist";
+            case _234500: return "Life Scientists nfd";
+            case _234511: return "Life Scientist (General)";
+            case _234512: return "Anatomist or Physiologist";
+            case _234513: return "Biochemist";
+            case _234514: return "Biotechnologist";
+            case _234515: return "Botanist";
+            case _234516: return "Marine Biologist";
+            case _234517: return "Microbiologist";
+            case _234518: return "Zoologist";
+            case _234599: return "Life Scientists nec";
+            case _234611: return "Medical Laboratory Scientist";
+            case _234711: return "Veterinarian";
+            case _234900: return "Other Natural and Physical Science Professionals nfd";
+            case _234911: return "Conservator";
+            case _234912: return "Metallurgist";
+            case _234913: return "Meteorologist";
+            case _234914: return "Physicist";
+            case _234999: return "Natural and Physical Science Professionals nec";
+            case _240000: return "Education Professionals nfd";
+            case _241000: return "School Teachers nfd";
+            case _241111: return "Early Childhood (Pre-primary School) Teacher";
+            case _241213: return "Primary School Teacher";
+            case _241311: return "Middle School Teacher";
+            case _241411: return "Secondary School Teacher";
+            case _241500: return "Special Education Teachers nfd";
+            case _241511: return "Special Needs Teacher";
+            case _241512: return "Teacher of the Hearing Impaired";
+            case _241513: return "Teacher of the Sight Impaired";
+            case _241599: return "Special Education Teachers nec";
+            case _242000: return "Tertiary Education Teachers nfd";
+            case _242100: return "University Lecturers and Tutors nfd";
+            case _242111: return "University Lecturer";
+            case _242112: return "University Tutor";
+            case _242211: return "Vocational Education Teacher";
+            case _249000: return "Miscellaneous Education Professionals nfd";
+            case _249100: return "Education Advisers and Reviewers nfd";
+            case _249111: return "Education Adviser";
+            case _249112: return "Education Reviewer";
+            case _249200: return "Private Tutors and Teachers nfd";
+            case _249211: return "Art Teacher (Private Tuition)";
+            case _249212: return "Dance Teacher (Private Tuition)";
+            case _249213: return "Drama Teacher (Private Tuition)";
+            case _249214: return "Music Teacher (Private Tuition)";
+            case _249299: return "Private Tutors and Teachers nec";
+            case _249311: return "Teacher of English to Speakers of Other Languages";
+            case _250000: return "Health Professionals nfd";
+            case _251000: return "Health Diagnostic and Promotion Professionals nfd";
+            case _251111: return "Dietitian";
+            case _251200: return "Medical Imaging Professionals nfd";
+            case _251211: return "Medical Diagnostic Radiographer";
+            case _251212: return "Medical Radiation Therapist";
+            case _251213: return "Nuclear Medicine Technologist";
+            case _251214: return "Sonographer";
+            case _251300: return "Occupational and Environmental Health Professionals nfd";
+            case _251311: return "Environmental Health Officer";
+            case _251312: return "Occupational Health and Safety Adviser";
+            case _251400: return "Optometrists and Orthoptists nfd";
+            case _251411: return "Optometrist";
+            case _251412: return "Orthoptist";
+            case _251500: return "Pharmacists nfd";
+            case _251511: return "Hospital Pharmacist";
+            case _251512: return "Industrial Pharmacist";
+            case _251513: return "Retail Pharmacist";
+            case _251900: return "Other Health Diagnostic and Promotion Professionals nfd";
+            case _251911: return "Health Promotion Officer";
+            case _251912: return "Orthotist or Prosthetist";
+            case _251999: return "Health Diagnostic and Promotion Professionals nec";
+            case _252000: return "Health Therapy Professionals nfd";
+            case _252100: return "Chiropractors and Osteopaths nfd";
+            case _252111: return "Chiropractor";
+            case _252112: return "Osteopath";
+            case _252200: return "Complementary Health Therapists nfd";
+            case _252211: return "Acupuncturist";
+            case _252212: return "Homoeopath";
+            case _252213: return "Naturopath";
+            case _252214: return "Traditional Chinese Medicine Practitioner";
+            case _252299: return "Complementary Health Therapists nec";
+            case _252300: return "Dental Practitioners nfd";
+            case _252311: return "Dental Specialist";
+            case _252312: return "Dentist";
+            case _252411: return "Occupational Therapist";
+            case _252511: return "Physiotherapist";
+            case _252611: return "Podiatrist";
+            case _252700: return "Speech Professionals and Audiologists nfd";
+            case _252711: return "Audiologist";
+            case _252712: return "Speech Pathologist";
+            case _253000: return "Medical Practitioners nfd";
+            case _253100: return "Generalist Medical Practitioners nfd";
+            case _253111: return "General Medical Practitioner";
+            case _253112: return "Resident Medical Officer";
+            case _253211: return "Anaesthetist";
+            case _253300: return "Internal Medicine Specialists nfd";
+            case _253311: return "Specialist Physician (General Medicine)";
+            case _253312: return "Cardiologist";
+            case _253313: return "Clinical Haematologist";
+            case _253314: return "Clinical Oncologist";
+            case _253315: return "Endocrinologist";
+            case _253316: return "Gastroenterologist";
+            case _253317: return "Intensive Care Specialist";
+            case _253318: return "Neurologist";
+            case _253321: return "Paediatrician";
+            case _253322: return "Renal Medicine Specialist";
+            case _253323: return "Rheumatologist";
+            case _253324: return "Thoracic Medicine Specialist";
+            case _253399: return "Internal Medicine Specialists nec";
+            case _253411: return "Psychiatrist";
+            case _253500: return "Surgeons nfd";
+            case _253511: return "Surgeon (General)";
+            case _253512: return "Cardiothoracic Surgeon";
+            case _253513: return "Neurosurgeon";
+            case _253514: return "Orthopaedic Surgeon";
+            case _253515: return "Otorhinolaryngologist";
+            case _253516: return "Paediatric Surgeon";
+            case _253517: return "Plastic and Reconstructive Surgeon";
+            case _253518: return "Urologist";
+            case _253521: return "Vascular Surgeon";
+            case _253900: return "Other Medical Practitioners nfd";
+            case _253911: return "Dermatologist";
+            case _253912: return "Emergency Medicine Specialist";
+            case _253913: return "Obstetrician and Gynaecologist";
+            case _253914: return "Ophthalmologist";
+            case _253915: return "Pathologist";
+            case _253916: return "Radiologist";
+            case _253999: return "Medical Practitioners nec";
+            case _254000: return "Midwifery and Nursing Professionals nfd";
+            case _254111: return "Midwife";
+            case _254200: return "Nurse Educators and Researchers nfd";
+            case _254211: return "Nurse Educator";
+            case _254212: return "Nurse Researcher";
+            case _254311: return "Nurse Manager";
+            case _254400: return "Registered Nurses nfd";
+            case _254411: return "Nurse Practitioner";
+            case _254412: return "Registered Nurse (Aged Care)";
+            case _254413: return "Registered Nurse (Child and Family Health)";
+            case _254414: return "Registered Nurse (Community Health)";
+            case _254415: return "Registered Nurse (Critical Care and Emergency)";
+            case _254416: return "Registered Nurse (Developmental Disability)";
+            case _254417: return "Registered Nurse (Disability and Rehabilitation)";
+            case _254418: return "Registered Nurse (Medical)";
+            case _254421: return "Registered Nurse (Medical Practice)";
+            case _254422: return "Registered Nurse (Mental Health)";
+            case _254423: return "Registered Nurse (Perioperative)";
+            case _254424: return "Registered Nurse (Surgical)";
+            case _254499: return "Registered Nurses nec";
+            case _260000: return "ICT Professionals nfd";
+            case _261000: return "Business and Systems Analysts, and Programmers nfd";
+            case _261100: return "ICT Business and Systems Analysts nfd";
+            case _261111: return "ICT Business Analyst";
+            case _261112: return "Systems Analyst";
+            case _261200: return "Multimedia Specialists and Web Developers nfd";
+            case _261211: return "Multimedia Specialist";
+            case _261212: return "Web Developer";
+            case _261300: return "Software and Applications Programmers nfd";
+            case _261311: return "Analyst Programmer";
+            case _261312: return "Developer Programmer";
+            case _261313: return "Software Engineer";
+            case _261399: return "Software and Applications Programmers nec";
+            case _262100: return "Database and Systems Administrators, and ICT Security Specialists nfd";
+            case _262111: return "Database Administrator";
+            case _262112: return "ICT Security Specialist";
+            case _262113: return "Systems Administrator";
+            case _263000: return "ICT Network and Support Professionals nfd";
+            case _263100: return "Computer Network Professionals nfd";
+            case _263111: return "Computer Network and Systems Engineer";
+            case _263112: return "Network Administrator";
+            case _263113: return "Network Analyst";
+            case _263200: return "ICT Support and Test Engineers nfd";
+            case _263211: return "ICT Quality Assurance Engineer";
+            case _263212: return "ICT Support Engineer";
+            case _263213: return "ICT Systems Test Engineer";
+            case _263299: return "ICT Support and Test Engineers nec";
+            case _263300: return "Telecommunications Engineering Professionals nfd";
+            case _263311: return "Telecommunications Engineer";
+            case _263312: return "Telecommunications Network Engineer";
+            case _270000: return "Legal, Social and Welfare Professionals nfd";
+            case _271000: return "Legal Professionals nfd";
+            case _271111: return "Barrister";
+            case _271200: return "Judicial and Other Legal Professionals nfd";
+            case _271211: return "Judge";
+            case _271212: return "Magistrate";
+            case _271213: return "Tribunal Member";
+            case _271299: return "Judicial and Other Legal Professionals nec";
+            case _271311: return "Solicitor";
+            case _272000: return "Social and Welfare Professionals nfd";
+            case _272100: return "Counsellors nfd";
+            case _272111: return "Careers Counsellor";
+            case _272112: return "Drug and Alcohol Counsellor";
+            case _272113: return "Family and Marriage Counsellor";
+            case _272114: return "Rehabilitation Counsellor";
+            case _272115: return "Student Counsellor";
+            case _272199: return "Counsellors nec";
+            case _272211: return "Minister of Religion";
+            case _272300: return "Psychologists nfd";
+            case _272311: return "Clinical Psychologist";
+            case _272312: return "Educational Psychologist";
+            case _272313: return "Organizational Psychologist";
+            case _272314: return "Psychotherapist";
+            case _272399: return "Psychologists nec";
+            case _272400: return "Social Professionals nfd";
+            case _272411: return "Historian";
+            case _272412: return "Interpreter";
+            case _272413: return "Translator";
+            case _272499: return "Social Professionals nec";
+            case _272511: return "Social Worker";
+            case _272600: return "Welfare, Recreation and Community Arts Workers nfd";
+            case _272611: return "Community Arts Worker";
+            case _272612: return "Recreation Officer";
+            case _272613: return "Welfare Worker";
+            case _300000: return "Technicians and Trades Workers nfd";
+            case _310000: return "Engineering, ICT and Science Technicians nfd";
+            case _311000: return "Agricultural, Medical and Science Technicians nfd";
+            case _311111: return "Agricultural Technician";
+            case _311200: return "Medical Technicians nfd";
+            case _311211: return "Anaesthetic Technician";
+            case _311212: return "Cardiac Technician";
+            case _311213: return "Medical Laboratory Technician";
+            case _311214: return "Operating Theatre Technician";
+            case _311215: return "Pharmacy Technician";
+            case _311299: return "Medical Technicians nec";
+            case _311300: return "Primary Products Inspectors nfd";
+            case _311311: return "Fisheries Officer";
+            case _311312: return "Meat Inspector";
+            case _311313: return "Quarantine Officer";
+            case _311399: return "Primary Products Inspectors nec";
+            case _311400: return "Science Technicians nfd";
+            case _311411: return "Chemistry Technician";
+            case _311412: return "Earth Science Technician";
+            case _311413: return "Life Science Technician";
+            case _311414: return "School Laboratory Technician";
+            case _311499: return "Science Technicians nec";
+            case _312000: return "Building and Engineering Technicians nfd";
+            case _312100: return "Architectural, Building and Surveying Technicians nfd";
+            case _312111: return "Architectural Draftsperson";
+            case _312112: return "Building Associate";
+            case _312113: return "Building Inspector";
+            case _312114: return "Construction Estimator";
+            case _312115: return "Plumbing Inspector";
+            case _312116: return "Surveying or Cartographic Technician";
+            case _312200: return "Civil Engineering Draftspersons and Technicians nfd";
+            case _312211: return "Civil Engineering Draftsperson";
+            case _312212: return "Civil Engineering Technician";
+            case _312300: return "Electrical Engineering Draftspersons and Technicians nfd";
+            case _312311: return "Electrical Engineering Draftsperson";
+            case _312312: return "Electrical Engineering Technician";
+            case _312400: return "Electronic Engineering Draftspersons and Technicians nfd";
+            case _312411: return "Electronic Engineering Draftsperson";
+            case _312412: return "Electronic Engineering Technician";
+            case _312500: return "Mechanical Engineering Draftspersons and Technicians nfd";
+            case _312511: return "Mechanical Engineering Draftsperson";
+            case _312512: return "Mechanical Engineering Technician";
+            case _312611: return "Safety Inspector";
+            case _312900: return "Other Building and Engineering Technicians nfd";
+            case _312911: return "Maintenance Planner";
+            case _312912: return "Metallurgical or Materials Technician";
+            case _312913: return "Mine Deputy";
+            case _312999: return "Building and Engineering Technicians nec";
+            case _313000: return "ICT and Telecommunications Technicians nfd";
+            case _313100: return "ICT Support Technicians nfd";
+            case _313111: return "Hardware Technician";
+            case _313112: return "ICT Customer Support Officer";
+            case _313113: return "Web Administrator";
+            case _313199: return "ICT Support Technicians nec";
+            case _313200: return "Telecommunications Technical Specialists nfd";
+            case _313211: return "Radiocommunications Technician";
+            case _313212: return "Telecommunications Field Engineer";
+            case _313213: return "Telecommunications Network Planner";
+            case _313214: return "Telecommunications Technical Officer or Technologist";
+            case _320000: return "Automotive and Engineering Trades Workers nfd";
+            case _321000: return "Automotive Electricians and Mechanics nfd";
+            case _321111: return "Automotive Electrician";
+            case _321200: return "Motor Mechanics nfd";
+            case _321211: return "Motor Mechanic (General)";
+            case _321212: return "Diesel Motor Mechanic";
+            case _321213: return "Motorcycle Mechanic";
+            case _321214: return "Small Engine Mechanic";
+            case _322000: return "Fabrication Engineering Trades Workers nfd";
+            case _322100: return "Metal Casting, Forging and Finishing Trades Workers nfd";
+            case _322111: return "Blacksmith";
+            case _322112: return "Electroplater";
+            case _322113: return "Farrier";
+            case _322114: return "Metal Casting Trades Worker";
+            case _322115: return "Metal Polisher";
+            case _322211: return "Sheetmetal Trades Worker";
+            case _322300: return "Structural Steel and Welding Trades Workers nfd";
+            case _322311: return "Metal Fabricator";
+            case _322312: return "Pressure Welder";
+            case _322313: return "Welder (First Class)";
+            case _323000: return "Mechanical Engineering Trades Workers nfd";
+            case _323100: return "Aircraft Maintenance Engineers nfd";
+            case _323111: return "Aircraft Maintenance Engineer (Avionics)";
+            case _323112: return "Aircraft Maintenance Engineer (Mechanical)";
+            case _323113: return "Aircraft Maintenance Engineer (Structures)";
+            case _323200: return "Metal Fitters and Machinists nfd";
+            case _323211: return "Fitter (General)";
+            case _323212: return "Fitter and Turner";
+            case _323213: return "Fitter-Welder";
+            case _323214: return "Metal Machinist (First Class)";
+            case _323215: return "Textile, Clothing and Footwear Mechanic";
+            case _323299: return "Metal Fitters and Machinists nec";
+            case _323300: return "Precision Metal Trades Workers nfd";
+            case _323311: return "Engraver";
+            case _323312: return "Gunsmith";
+            case _323313: return "Locksmith";
+            case _323314: return "Precision Instrument Maker and Repairer";
+            case _323315: return "Saw Maker and Repairer";
+            case _323316: return "Watch and Clock Maker and Repairer";
+            case _323400: return "Toolmakers and Engineering Patternmakers nfd";
+            case _323411: return "Engineering Patternmaker";
+            case _323412: return "Toolmaker";
+            case _324000: return "Panelbeaters, and Vehicle Body Builders, Trimmers and Painters nfd";
+            case _324111: return "Panelbeater";
+            case _324200: return "Vehicle Body Builders and Trimmers nfd";
+            case _324211: return "Vehicle Body Builder";
+            case _324212: return "Vehicle Trimmer";
+            case _324311: return "Vehicle Painter";
+            case _330000: return "Construction Trades Workers nfd";
+            case _331000: return "Bricklayers, and Carpenters and Joiners nfd";
+            case _331100: return "Bricklayers and Stonemasons nfd";
+            case _331111: return "Bricklayer";
+            case _331112: return "Stonemason";
+            case _331211: return "Carpenter and Joiner";
+            case _331212: return "Carpenter";
+            case _331213: return "Joiner";
+            case _332000: return "Floor Finishers and Painting Trades Workers nfd";
+            case _332111: return "Floor Finisher";
+            case _332211: return "Painting Trades Worker";
+            case _333000: return "Glaziers, Plasterers and Tilers nfd";
+            case _333111: return "Glazier";
+            case _333200: return "Plasterers nfd";
+            case _333211: return "Fibrous Plasterer";
+            case _333212: return "Solid Plasterer";
+            case _333311: return "Roof Tiler";
+            case _333411: return "Wall and Floor Tiler";
+            case _334100: return "Plumbers nfd";
+            case _334111: return "Plumber (General)";
+            case _334112: return "Airconditioning and Mechanical Services Plumber";
+            case _334113: return "Drainer";
+            case _334114: return "Gasfitter";
+            case _334115: return "Roof Plumber";
+            case _340000: return "Electrotechnology and Telecommunications Trades Workers nfd";
+            case _341100: return "Electricians nfd";
+            case _341111: return "Electrician (General)";
+            case _341112: return "Electrician (Special Class)";
+            case _341113: return "Lift Mechanic";
+            case _342000: return "Electronics and Telecommunications Trades Workers nfd";
+            case _342111: return "Airconditioning and Refrigeration Mechanic";
+            case _342200: return "Electrical Distribution Trades Workers nfd";
+            case _342211: return "Electrical Linesworker";
+            case _342212: return "Technical Cable Jointer";
+            case _342300: return "Electronics Trades Workers nfd";
+            case _342311: return "Business Machine Mechanic";
+            case _342312: return "Communications Operator";
+            case _342313: return "Electronic Equipment Trades Worker";
+            case _342314: return "Electronic Instrument Trades Worker (General)";
+            case _342315: return "Electronic Instrument Trades Worker (Special Class)";
+            case _342400: return "Telecommunications Trades Workers nfd";
+            case _342411: return "Cabler (Data and Telecommunications)";
+            case _342412: return "Telecommunications Cable Jointer";
+            case _342413: return "Telecommunications Linesworker";
+            case _342414: return "Telecommunications Technician";
+            case _351000: return "Food Trades Workers nfd";
+            case _351100: return "Bakers and Pastrycooks nfd";
+            case _351111: return "Baker";
+            case _351112: return "Pastrycook";
+            case _351211: return "Butcher or Smallgoods Maker";
+            case _351311: return "Chef";
+            case _351411: return "Cook";
+            case _360000: return "Skilled Animal and Horticultural Workers nfd";
+            case _361000: return "Animal Attendants and Trainers, and Shearers nfd";
+            case _361100: return "Animal Attendants and Trainers nfd";
+            case _361111: return "Dog Handler or Trainer";
+            case _361112: return "Horse Trainer";
+            case _361113: return "Pet Groomer";
+            case _361114: return "Zookeeper";
+            case _361199: return "Animal Attendants and Trainers nec";
+            case _361211: return "Shearer";
+            case _361311: return "Veterinary Nurse";
+            case _362000: return "Horticultural Trades Workers nfd";
+            case _362111: return "Florist";
+            case _362200: return "Gardeners nfd";
+            case _362211: return "Gardener (General)";
+            case _362212: return "Arborist";
+            case _362213: return "Landscape Gardener";
+            case _362311: return "Greenkeeper";
+            case _362411: return "Nurseryperson";
+            case _390000: return "Other Technicians and Trades Workers nfd";
+            case _391111: return "Hairdresser";
+            case _392000: return "Printing Trades Workers nfd";
+            case _392100: return "Binders, Finishers and Screen Printers nfd";
+            case _392111: return "Binder and Finisher";
+            case _392112: return "Screen Printer";
+            case _392211: return "Graphic Pre-press Trades Worker";
+            case _392300: return "Printers nfd";
+            case _392311: return "Printing Machinist";
+            case _392312: return "Small Offset Printer";
+            case _393000: return "Textile, Clothing and Footwear Trades Workers nfd";
+            case _393100: return "Canvas and Leather Goods Makers nfd";
+            case _393111: return "Canvas Goods Maker";
+            case _393112: return "Leather Goods Maker";
+            case _393113: return "Sail Maker";
+            case _393114: return "Shoemaker";
+            case _393200: return "Clothing Trades Workers nfd";
+            case _393211: return "Apparel Cutter";
+            case _393212: return "Clothing Patternmaker";
+            case _393213: return "Dressmaker or Tailor";
+            case _393299: return "Clothing Trades Workers nec";
+            case _393311: return "Upholsterer";
+            case _394000: return "Wood Trades Workers nfd";
+            case _394111: return "Cabinetmaker";
+            case _394200: return "Wood Machinists and Other Wood Trades Workers nfd";
+            case _394211: return "Furniture Finisher";
+            case _394212: return "Picture Framer";
+            case _394213: return "Wood Machinist";
+            case _394214: return "Wood Turner";
+            case _394299: return "Wood Machinists and Other Wood Trades Workers nec";
+            case _399000: return "Miscellaneous Technicians and Trades Workers nfd";
+            case _399100: return "Boat Builders and Shipwrights nfd";
+            case _399111: return "Boat Builder and Repairer";
+            case _399112: return "Shipwright";
+            case _399200: return "Chemical, Gas, Petroleum and Power Generation Plant Operators nfd";
+            case _399211: return "Chemical Plant Operator";
+            case _399212: return "Gas or Petroleum Operator";
+            case _399213: return "Power Generation Plant Operator";
+            case _399300: return "Gallery, Library and Museum Technicians nfd";
+            case _399311: return "Gallery or Museum Technician";
+            case _399312: return "Library Technician";
+            case _399411: return "Jeweller";
+            case _399500: return "Performing Arts Technicians nfd";
+            case _399511: return "Broadcast Transmitter Operator";
+            case _399512: return "Camera Operator (Film, Television or Video)";
+            case _399513: return "Light Technician";
+            case _399514: return "Make Up Artist";
+            case _399515: return "Musical Instrument Maker or Repairer";
+            case _399516: return "Sound Technician";
+            case _399517: return "Television Equipment Operator";
+            case _399599: return "Performing Arts Technicians nec";
+            case _399611: return "Signwriter";
+            case _399900: return "Other Miscellaneous Technicians and Trades Workers nfd";
+            case _399911: return "Diver";
+            case _399912: return "Interior Decorator";
+            case _399913: return "Optical Dispenser";
+            case _399914: return "Optical Mechanic";
+            case _399915: return "Photographer's Assistant";
+            case _399916: return "Plastics Technician";
+            case _399917: return "Wool Classer";
+            case _399999: return "Technicians and Trades Workers nec";
+            case _400000: return "Community and Personal Service Workers nfd";
+            case _411000: return "Health and Welfare Support Workers nfd";
+            case _411100: return "Ambulance Officers and Paramedics nfd";
+            case _411111: return "Ambulance Officer";
+            case _411112: return "Intensive Care Ambulance Paramedic";
+            case _411200: return "Dental Hygienists, Technicians and Therapists nfd";
+            case _411211: return "Dental Hygienist";
+            case _411212: return "Dental Prosthetist";
+            case _411213: return "Dental Technician";
+            case _411214: return "Dental Therapist";
+            case _411311: return "Diversional Therapist";
+            case _411400: return "Enrolled and Mothercraft Nurses nfd";
+            case _411411: return "Enrolled Nurse";
+            case _411412: return "Mothercraft Nurse";
+            case _411511: return "Aboriginal and Torres Strait Islander Health Worker";
+            case _411611: return "Massage Therapist";
+            case _411700: return "Welfare Support Workers nfd";
+            case _411711: return "Community Worker";
+            case _411712: return "Disabilities Services Officer";
+            case _411713: return "Family Support Worker";
+            case _411714: return "Parole or Probation Officer";
+            case _411715: return "Residential Care Officer";
+            case _411716: return "Youth Worker";
+            case _420000: return "Carers and Aides nfd";
+            case _421100: return "Child Carers nfd";
+            case _421111: return "Child Care Worker";
+            case _421112: return "Family Day Care Worker";
+            case _421113: return "Nanny";
+            case _421114: return "Out of School Hours Care Worker";
+            case _422100: return "Education Aides nfd";
+            case _422111: return "Aboriginal and Torres Strait Islander Education Worker";
+            case _422112: return "Integration Aide";
+            case _422115: return "Preschool Aide";
+            case _422116: return "Teachers' Aide";
+            case _423000: return "Personal Carers and Assistants nfd";
+            case _423111: return "Aged or Disabled Carer";
+            case _423211: return "Dental Assistant";
+            case _423300: return "Nursing Support and Personal Care Workers nfd";
+            case _423311: return "Hospital Orderly";
+            case _423312: return "Nursing Support Worker";
+            case _423313: return "Personal Care Assistant";
+            case _423314: return "Therapy Aide";
+            case _423400: return "Special Care Workers nfd";
+            case _423411: return "Child or Youth Residential Care Assistant";
+            case _423412: return "Hostel Parent";
+            case _423413: return "Refuge Worker";
+            case _431000: return "Hospitality Workers nfd";
+            case _431100: return "Bar Attendants and Baristas nfd";
+            case _431111: return "Bar Attendant";
+            case _431112: return "Barista";
+            case _431211: return "Cafe Worker";
+            case _431311: return "Gaming Worker";
+            case _431411: return "Hotel Service Manager";
+            case _431511: return "Waiter";
+            case _431900: return "Other Hospitality Workers nfd";
+            case _431911: return "Bar Useful or Busser";
+            case _431912: return "Doorperson or Luggage Porter";
+            case _431999: return "Hospitality Workers nec";
+            case _440000: return "Protective Service Workers nfd";
+            case _441000: return "Defence Force Members, Fire Fighters and Police nfd";
+            case _441111: return "Defence Force Member - Other Ranks";
+            case _441200: return "Fire and Emergency Workers nfd";
+            case _441211: return "Emergency Service Worker";
+            case _441212: return "Fire Fighter";
+            case _441300: return "Police nfd";
+            case _441311: return "Detective";
+            case _441312: return "Police Officer";
+            case _442000: return "Prison and Security Officers nfd";
+            case _442111: return "Prison Officer";
+            case _442200: return "Security Officers and Guards nfd";
+            case _442211: return "Alarm, Security or Surveillance Monitor";
+            case _442212: return "Armoured Car Escort";
+            case _442213: return "Crowd Controller";
+            case _442214: return "Private Investigator";
+            case _442215: return "Retail Loss Prevention Officer";
+            case _442216: return "Security Consultant";
+            case _442217: return "Security Officer";
+            case _442299: return "Security Officers and Guards nec";
+            case _450000: return "Sports and Personal Service Workers nfd";
+            case _451000: return "Personal Service and Travel Workers nfd";
+            case _451111: return "Beauty Therapist";
+            case _451211: return "Driving Instructor";
+            case _451300: return "Funeral Workers nfd";
+            case _451311: return "Funeral Director";
+            case _451399: return "Funeral Workers nec";
+            case _451400: return "Gallery, Museum and Tour Guides nfd";
+            case _451411: return "Gallery or Museum Guide";
+            case _451412: return "Tour Guide";
+            case _451500: return "Personal Care Consultants nfd";
+            case _451511: return "Natural Remedy Consultant";
+            case _451512: return "Weight Loss Consultant";
+            case _451600: return "Tourism and Travel Advisers nfd";
+            case _451611: return "Tourist Information Officer";
+            case _451612: return "Travel Consultant";
+            case _451700: return "Travel Attendants nfd";
+            case _451711: return "Flight Attendant";
+            case _451799: return "Travel Attendants nec";
+            case _451800: return "Other Personal Service Workers nfd";
+            case _451811: return "Civil Celebrant";
+            case _451812: return "Hair or Beauty Salon Assistant";
+            case _451813: return "Sex Worker or Escort";
+            case _451899: return "Personal Service Workers nec";
+            case _452000: return "Sports and Fitness Workers nfd";
+            case _452111: return "Fitness Instructor";
+            case _452200: return "Outdoor Adventure Guides nfd";
+            case _452211: return "Bungy Jump Master";
+            case _452212: return "Fishing Guide";
+            case _452213: return "Hunting Guide";
+            case _452214: return "Mountain or Glacier Guide";
+            case _452215: return "Outdoor Adventure Instructor";
+            case _452216: return "Trekking Guide";
+            case _452217: return "Whitewater Rafting Guide";
+            case _452299: return "Outdoor Adventure Guides nec";
+            case _452300: return "Sports Coaches, Instructors and Officials nfd";
+            case _452311: return "Diving Instructor (Open Water)";
+            case _452312: return "Gymnastics Coach or Instructor";
+            case _452313: return "Horse Riding Coach or Instructor";
+            case _452314: return "Snowsport Instructor";
+            case _452315: return "Swimming Coach or Instructor";
+            case _452316: return "Tennis Coach";
+            case _452317: return "Other Sports Coach or Instructor";
+            case _452318: return "Dog or Horse Racing Official";
+            case _452321: return "Sports Development Officer";
+            case _452322: return "Sports Umpire";
+            case _452323: return "Other Sports Official";
+            case _452400: return "Sportspersons nfd";
+            case _452411: return "Footballer";
+            case _452412: return "Golfer";
+            case _452413: return "Jockey";
+            case _452414: return "Lifeguard";
+            case _452499: return "Sportspersons nec";
+            case _500000: return "Clerical and Administrative Workers nfd";
+            case _510000: return "Office Managers and Program Administrators nfd";
+            case _511100: return "Contract, Program and Project Administrators nfd";
+            case _511111: return "Contract Administrator";
+            case _511112: return "Program or Project Administrator";
+            case _512000: return "Office and Practice Managers nfd";
+            case _512111: return "Office Manager";
+            case _512200: return "Practice Managers nfd";
+            case _512211: return "Health Practice Manager";
+            case _512299: return "Practice Managers nec";
+            case _521000: return "Personal Assistants and Secretaries nfd";
+            case _521111: return "Personal Assistant";
+            case _521200: return "Secretaries nfd";
+            case _521211: return "Secretary (General)";
+            case _521212: return "Legal Secretary";
+            case _530000: return "General Clerical Workers nfd";
+            case _531111: return "General Clerk";
+            case _532100: return "Keyboard Operators nfd";
+            case _532111: return "Data Entry Operator";
+            case _532112: return "Machine Shorthand Reporter";
+            case _532113: return "Word Processing Operator";
+            case _540000: return "Inquiry Clerks and Receptionists nfd";
+            case _541000: return "Call or Contact Centre Information Clerks nfd";
+            case _541100: return "Call or Contact Centre Workers nfd";
+            case _541111: return "Call or Contact Centre Team Leader";
+            case _541112: return "Call or Contact Centre Operator";
+            case _541211: return "Inquiry Clerk";
+            case _542100: return "Receptionists nfd";
+            case _542111: return "Receptionist (General)";
+            case _542112: return "Admissions Clerk";
+            case _542113: return "Hotel or Motel Receptionist";
+            case _542114: return "Medical Receptionist";
+            case _550000: return "Numerical Clerks nfd";
+            case _551000: return "Accounting Clerks and Bookkeepers nfd";
+            case _551100: return "Accounting Clerks nfd";
+            case _551111: return "Accounts Clerk";
+            case _551112: return "Cost Clerk";
+            case _551211: return "Bookkeeper";
+            case _551311: return "Payroll Clerk";
+            case _552000: return "Financial and Insurance Clerks nfd";
+            case _552111: return "Bank Worker";
+            case _552211: return "Credit or Loans Officer";
+            case _552300: return "Insurance, Money Market and Statistical Clerks nfd";
+            case _552311: return "Bookmaker";
+            case _552312: return "Insurance Consultant";
+            case _552313: return "Money Market Clerk";
+            case _552314: return "Statistical Clerk";
+            case _561000: return "Clerical and Office Support Workers nfd";
+            case _561100: return "Betting Clerks nfd";
+            case _561111: return "Betting Agency Counter Clerk";
+            case _561112: return "Bookmaker's Clerk";
+            case _561113: return "Telephone Betting Clerk";
+            case _561199: return "Betting Clerks nec";
+            case _561200: return "Couriers and Postal Deliverers nfd";
+            case _561211: return "Courier";
+            case _561212: return "Postal Delivery Officer";
+            case _561311: return "Filing or Registry Clerk";
+            case _561400: return "Mail Sorters nfd";
+            case _561411: return "Mail Clerk";
+            case _561412: return "Postal Sorting Officer";
+            case _561511: return "Survey Interviewer";
+            case _561611: return "Switchboard Operator";
+            case _561900: return "Other Clerical and Office Support Workers nfd";
+            case _561911: return "Classified Advertising Clerk";
+            case _561912: return "Meter Reader";
+            case _561913: return "Parking Inspector";
+            case _561999: return "Clerical and Office Support Workers nec";
+            case _590000: return "Other Clerical and Administrative Workers nfd";
+            case _591000: return "Logistics Clerks nfd";
+            case _591100: return "Purchasing and Supply Logistics Clerks nfd";
+            case _591111: return "Order Clerk";
+            case _591112: return "Production Clerk";
+            case _591113: return "Purchasing Officer";
+            case _591114: return "Sales Clerk";
+            case _591115: return "Stock Clerk";
+            case _591116: return "Warehouse Administrator";
+            case _591200: return "Transport and Despatch Clerks nfd";
+            case _591211: return "Despatching and Receiving Clerk";
+            case _591212: return "Import-Export Clerk";
+            case _599000: return "Miscellaneous Clerical and Administrative Workers nfd";
+            case _599100: return "Conveyancers and Legal Executives nfd";
+            case _599111: return "Conveyancer";
+            case _599112: return "Legal Executive";
+            case _599200: return "Court and Legal Clerks nfd";
+            case _599211: return "Clerk of Court";
+            case _599212: return "Court Bailiff or Sheriff";
+            case _599213: return "Court Orderly";
+            case _599214: return "Law Clerk";
+            case _599215: return "Trust Officer";
+            case _599311: return "Debt Collector";
+            case _599411: return "Human Resource Clerk";
+            case _599500: return "Inspectors and Regulatory Officers nfd";
+            case _599511: return "Customs Officer";
+            case _599512: return "Immigration Officer";
+            case _599513: return "Motor Vehicle Licence Examiner";
+            case _599514: return "Noxious Weeds and Pest Inspector";
+            case _599515: return "Social Security Assessor";
+            case _599516: return "Taxation Inspector";
+            case _599517: return "Train Examiner";
+            case _599518: return "Transport Operations Inspector";
+            case _599521: return "Water Inspector";
+            case _599599: return "Inspectors and Regulatory Officers nec";
+            case _599600: return "Insurance Investigators, Loss Adjusters and Risk Surveyors nfd";
+            case _599611: return "Insurance Investigator";
+            case _599612: return "Insurance Loss Adjuster";
+            case _599613: return "Insurance Risk Surveyor";
+            case _599711: return "Library Assistant";
+            case _599900: return "Other Miscellaneous Clerical and Administrative Workers nfd";
+            case _599911: return "Coding Clerk";
+            case _599912: return "Production Assistant (Film, Television, Radio or Stage)";
+            case _599913: return "Proof Reader";
+            case _599914: return "Radio Despatcher";
+            case _599999: return "Clerical and Administrative Workers nec";
+            case _600000: return "Sales Workers nfd";
+            case _610000: return "Sales Representatives and Agents nfd";
+            case _611000: return "Insurance Agents and Sales Representatives nfd";
+            case _611100: return "Auctioneers, and Stock and Station Agents nfd";
+            case _611111: return "Auctioneer";
+            case _611112: return "Stock and Station Agent";
+            case _611211: return "Insurance Agent";
+            case _611300: return "Sales Representatives nfd";
+            case _611311: return "Sales Representative (Building and Plumbing Supplies)";
+            case _611312: return "Sales Representative (Business Services)";
+            case _611313: return "Sales Representative (Motor Vehicle Parts and Accessories)";
+            case _611314: return "Sales Representative (Personal and Household Goods)";
+            case _611399: return "Sales Representatives nec";
+            case _612100: return "Real Estate Sales Agents nfd";
+            case _612111: return "Business Broker";
+            case _612112: return "Property Manager";
+            case _612113: return "Real Estate Agency Principal";
+            case _612114: return "Real Estate Agent";
+            case _612115: return "Real Estate Representative";
+            case _621000: return "Sales Assistants and Salespersons nfd";
+            case _621111: return "Sales Assistant (General)";
+            case _621211: return "ICT Sales Assistant";
+            case _621300: return "Motor Vehicle and Vehicle Parts Salespersons nfd";
+            case _621311: return "Motor Vehicle or Caravan Salesperson";
+            case _621312: return "Motor Vehicle Parts Interpreter";
+            case _621411: return "Pharmacy Sales Assistant";
+            case _621511: return "Retail Supervisor";
+            case _621611: return "Service Station Attendant";
+            case _621700: return "Street Vendors and Related Salespersons nfd";
+            case _621711: return "Cash Van Salesperson";
+            case _621712: return "Door-to-door Salesperson";
+            case _621713: return "Street Vendor";
+            case _621900: return "Other Sales Assistants and Salespersons nfd";
+            case _621911: return "Materials Recycler";
+            case _621912: return "Rental Salesperson";
+            case _621999: return "Sales Assistants and Salespersons nec";
+            case _630000: return "Sales Support Workers nfd";
+            case _631100: return "Checkout Operators and Office Cashiers nfd";
+            case _631111: return "Checkout Operator";
+            case _631112: return "Office Cashier";
+            case _639000: return "Miscellaneous Sales Support Workers nfd";
+            case _639100: return "Models and Sales Demonstrators nfd";
+            case _639111: return "Model";
+            case _639112: return "Sales Demonstrator";
+            case _639200: return "Retail and Wool Buyers nfd";
+            case _639211: return "Retail Buyer";
+            case _639212: return "Wool Buyer";
+            case _639311: return "Telemarketer";
+            case _639400: return "Ticket Salespersons nfd";
+            case _639411: return "Ticket Seller";
+            case _639412: return "Transport Conductor";
+            case _639511: return "Visual Merchandiser";
+            case _639911: return "Other Sales Support Worker";
+            case _700000: return "Machinery Operators and Drivers nfd";
+            case _710000: return "Machine and Stationary Plant Operators nfd";
+            case _711000: return "Machine Operators nfd";
+            case _711100: return "Clay, Concrete, Glass and Stone Processing Machine Operators nfd";
+            case _711111: return "Clay Products Machine Operator";
+            case _711112: return "Concrete Products Machine Operator";
+            case _711113: return "Glass Production Machine Operator";
+            case _711114: return "Stone Processing Machine Operator";
+            case _711199: return "Clay, Concrete, Glass and Stone Processing Machine Operators nec";
+            case _711211: return "Industrial Spraypainter";
+            case _711300: return "Paper and Wood Processing Machine Operators nfd";
+            case _711311: return "Paper Products Machine Operator";
+            case _711312: return "Wood Processing Machine Operator";
+            case _711411: return "Photographic Developer and Printer";
+            case _711500: return "Plastics and Rubber Production Machine Operators nfd";
+            case _711511: return "Plastic Cablemaking Machine Operator";
+            case _711512: return "Plastic Compounding and Reclamation Machine Operator";
+            case _711513: return "Plastics Fabricator or Welder";
+            case _711514: return "Plastics Production Machine Operator (General)";
+            case _711515: return "Reinforced Plastic and Composite Production Worker";
+            case _711516: return "Rubber Production Machine Operator";
+            case _711599: return "Plastics and Rubber Production Machine Operators nec";
+            case _711611: return "Sewing Machinist";
+            case _711700: return "Textile and Footwear Production Machine Operators nfd";
+            case _711711: return "Footwear Production Machine Operator";
+            case _711712: return "Hide and Skin Processing Machine Operator";
+            case _711713: return "Knitting Machine Operator";
+            case _711714: return "Textile Dyeing and Finishing Machine Operator";
+            case _711715: return "Weaving Machine Operator";
+            case _711716: return "Yarn Carding and Spinning Machine Operator";
+            case _711799: return "Textile and Footwear Production Machine Operators nec";
+            case _711900: return "Other Machine Operators nfd";
+            case _711911: return "Chemical Production Machine Operator";
+            case _711912: return "Motion Picture Projectionist";
+            case _711913: return "Sand Blaster";
+            case _711914: return "Sterilisation Technician";
+            case _711999: return "Machine Operators nec";
+            case _712000: return "Stationary Plant Operators nfd";
+            case _712111: return "Crane, Hoist or Lift Operator";
+            case _712200: return "Drillers, Miners and Shot Firers nfd";
+            case _712211: return "Driller";
+            case _712212: return "Miner";
+            case _712213: return "Shot Firer";
+            case _712311: return "Engineering Production Systems Worker";
+            case _712900: return "Other Stationary Plant Operators nfd";
+            case _712911: return "Boiler or Engine Operator";
+            case _712912: return "Bulk Materials Handling Plant Operator";
+            case _712913: return "Cement Production Plant Operator";
+            case _712914: return "Concrete Batching Plant Operator";
+            case _712915: return "Concrete Pump Operator";
+            case _712916: return "Paper and Pulp Mill Operator";
+            case _712917: return "Railway Signal Operator";
+            case _712918: return "Train Controller";
+            case _712921: return "Waste Water or Water Plant Operator";
+            case _712922: return "Weighbridge Operator";
+            case _712999: return "Stationary Plant Operators nec";
+            case _721000: return "Mobile Plant Operators nfd";
+            case _721100: return "Agricultural, Forestry and Horticultural Plant Operators nfd";
+            case _721111: return "Agricultural and Horticultural Mobile Plant Operator";
+            case _721112: return "Logging Plant Operator";
+            case _721200: return "Earthmoving Plant Operators nfd";
+            case _721211: return "Earthmoving Plant Operator (General)";
+            case _721212: return "Backhoe Operator";
+            case _721213: return "Bulldozer Operator";
+            case _721214: return "Excavator Operator";
+            case _721215: return "Grader Operator";
+            case _721216: return "Loader Operator";
+            case _721311: return "Forklift Driver";
+            case _721900: return "Other Mobile Plant Operators nfd";
+            case _721911: return "Aircraft Baggage Handler and Airline Ground Crew";
+            case _721912: return "Linemarker";
+            case _721913: return "Paving Plant Operator";
+            case _721914: return "Railway Track Plant Operator";
+            case _721915: return "Road Roller Operator";
+            case _721916: return "Streetsweeper Operator";
+            case _721999: return "Mobile Plant Operators nec";
+            case _730000: return "Road and Rail Drivers nfd";
+            case _731000: return "Automobile, Bus and Rail Drivers nfd";
+            case _731100: return "Automobile Drivers nfd";
+            case _731111: return "Chauffeur";
+            case _731112: return "Taxi Driver";
+            case _731199: return "Automobile Drivers nec";
+            case _731200: return "Bus and Coach Drivers nfd";
+            case _731211: return "Bus Driver";
+            case _731212: return "Charter and Tour Bus Driver";
+            case _731213: return "Passenger Coach Driver";
+            case _731300: return "Train and Tram Drivers nfd";
+            case _731311: return "Train Driver";
+            case _731312: return "Tram Driver";
+            case _732111: return "Delivery Driver";
+            case _733100: return "Truck Drivers nfd";
+            case _733111: return "Truck Driver (General)";
+            case _733112: return "Aircraft Refueller";
+            case _733113: return "Furniture Removalist";
+            case _733114: return "Tanker Driver";
+            case _733115: return "Tow Truck Driver";
+            case _741111: return "Storeperson";
+            case _800000: return "Labourers nfd";
+            case _811000: return "Cleaners and Laundry Workers nfd";
+            case _811111: return "Car Detailer";
+            case _811211: return "Commercial Cleaner";
+            case _811311: return "Domestic Cleaner";
+            case _811400: return "Housekeepers nfd";
+            case _811411: return "Commercial Housekeeper";
+            case _811412: return "Domestic Housekeeper";
+            case _811500: return "Laundry Workers nfd";
+            case _811511: return "Laundry Worker (General)";
+            case _811512: return "Drycleaner";
+            case _811513: return "Ironer or Presser";
+            case _811600: return "Other Cleaners nfd";
+            case _811611: return "Carpet Cleaner";
+            case _811612: return "Window Cleaner";
+            case _811699: return "Cleaners nec";
+            case _821000: return "Construction and Mining Labourers nfd";
+            case _821100: return "Building and Plumbing Labourers nfd";
+            case _821111: return "Builder's Labourer";
+            case _821112: return "Drainage, Sewerage and Stormwater Labourer";
+            case _821113: return "Earthmoving Labourer";
+            case _821114: return "Plumber's Assistant";
+            case _821211: return "Concreter";
+            case _821311: return "Fencer";
+            case _821400: return "Insulation and Home Improvement Installers nfd";
+            case _821411: return "Building Insulation Installer";
+            case _821412: return "Home Improvement Installer";
+            case _821511: return "Paving and Surfacing Labourer";
+            case _821611: return "Railway Track Worker";
+            case _821700: return "Structural Steel Construction Workers nfd";
+            case _821711: return "Construction Rigger";
+            case _821712: return "Scaffolder";
+            case _821713: return "Steel Fixer";
+            case _821714: return "Structural Steel Erector";
+            case _821900: return "Other Construction and Mining Labourers nfd";
+            case _821911: return "Crane Chaser";
+            case _821912: return "Driller's Assistant";
+            case _821913: return "Lagger";
+            case _821914: return "Mining Support Worker";
+            case _821915: return "Surveyor's Assistant";
+            case _830000: return "Factory Process Workers nfd";
+            case _831000: return "Food Process Workers nfd";
+            case _831100: return "Food and Drink Factory Workers nfd";
+            case _831111: return "Baking Factory Worker";
+            case _831112: return "Brewery Worker";
+            case _831113: return "Confectionery Maker";
+            case _831114: return "Dairy Products Maker";
+            case _831115: return "Fruit and Vegetable Factory Worker";
+            case _831116: return "Grain Mill Worker";
+            case _831117: return "Sugar Mill Worker";
+            case _831118: return "Winery Cellar Hand";
+            case _831199: return "Food and Drink Factory Workers nec";
+            case _831200: return "Meat Boners and Slicers, and Slaughterers nfd";
+            case _831211: return "Meat Boner and Slicer";
+            case _831212: return "Slaughterer";
+            case _831300: return "Meat, Poultry and Seafood Process Workers nfd";
+            case _831311: return "Meat Process Worker";
+            case _831312: return "Poultry Process Worker";
+            case _831313: return "Seafood Process Worker";
+            case _832000: return "Packers and Product Assemblers nfd";
+            case _832100: return "Packers nfd";
+            case _832111: return "Chocolate Packer";
+            case _832112: return "Container Filler";
+            case _832113: return "Fruit and Vegetable Packer";
+            case _832114: return "Meat Packer";
+            case _832115: return "Seafood Packer";
+            case _832199: return "Packers nec";
+            case _832211: return "Product Assembler";
+            case _839000: return "Miscellaneous Factory Process Workers nfd";
+            case _839111: return "Metal Engineering Process Worker";
+            case _839200: return "Plastics and Rubber Factory Workers nfd";
+            case _839211: return "Plastics Factory Worker";
+            case _839212: return "Rubber Factory Worker";
+            case _839300: return "Product Quality Controllers nfd";
+            case _839311: return "Product Examiner";
+            case _839312: return "Product Grader";
+            case _839313: return "Product Tester";
+            case _839400: return "Timber and Wood Process Workers nfd";
+            case _839411: return "Paper and Pulp Mill Worker";
+            case _839412: return "Sawmill or Timber Yard Worker";
+            case _839413: return "Wood and Wood Products Factory Worker";
+            case _839900: return "Other Factory Process Workers nfd";
+            case _839911: return "Cement and Concrete Plant Worker";
+            case _839912: return "Chemical Plant Worker";
+            case _839913: return "Clay Processing Factory Worker";
+            case _839914: return "Fabric and Textile Factory Worker";
+            case _839915: return "Footwear Factory Worker";
+            case _839916: return "Glass Processing Worker";
+            case _839917: return "Hide and Skin Processing Worker";
+            case _839999: return "Factory Process Workers nec";
+            case _841000: return "Farm, Forestry and Garden Workers nfd";
+            case _841111: return "Aquaculture Worker";
+            case _841200: return "Crop Farm Workers nfd";
+            case _841211: return "Fruit or Nut Farm Worker";
+            case _841212: return "Fruit or Nut Picker";
+            case _841213: return "Grain, Oilseed or Pasture Farm Worker";
+            case _841214: return "Vegetable Farm Worker";
+            case _841215: return "Vegetable Picker";
+            case _841216: return "Vineyard Worker";
+            case _841299: return "Crop Farm Workers nec";
+            case _841300: return "Forestry and Logging Workers nfd";
+            case _841311: return "Forestry Worker";
+            case _841312: return "Logging Assistant";
+            case _841313: return "Tree Faller";
+            case _841400: return "Garden and Nursery Labourers nfd";
+            case _841411: return "Garden Labourer";
+            case _841412: return "Horticultural Nursery Assistant";
+            case _841500: return "Livestock Farm Workers nfd";
+            case _841511: return "Beef Cattle Farm Worker";
+            case _841512: return "Dairy Cattle Farm Worker";
+            case _841513: return "Mixed Livestock Farm Worker";
+            case _841514: return "Poultry Farm Worker";
+            case _841515: return "Sheep Farm Worker";
+            case _841516: return "Stablehand";
+            case _841517: return "Wool Handler";
+            case _841599: return "Livestock Farm Workers nec";
+            case _841611: return "Mixed Crop and Livestock Farm Worker";
+            case _841900: return "Other Farm, Forestry and Garden Workers nfd";
+            case _841911: return "Hunter-Trapper";
+            case _841912: return "Pest or Weed Controller";
+            case _841999: return "Farm, Forestry and Garden Workers nec";
+            case _851000: return "Food Preparation Assistants nfd";
+            case _851111: return "Fast Food Cook";
+            case _851200: return "Food Trades Assistants nfd";
+            case _851211: return "Pastrycook's Assistant";
+            case _851299: return "Food Trades Assistants nec";
+            case _851311: return "Kitchenhand";
+            case _890000: return "Other Labourers nfd";
+            case _891000: return "Freight Handlers and Shelf Fillers nfd";
+            case _891100: return "Freight and Furniture Handlers nfd";
+            case _891111: return "Freight Handler (Rail or Road)";
+            case _891112: return "Truck Driver's Offsider";
+            case _891113: return "Waterside Worker";
+            case _891211: return "Shelf Filler";
+            case _899000: return "Miscellaneous Labourers nfd";
+            case _899111: return "Caretaker";
+            case _899200: return "Deck and Fishing Hands nfd";
+            case _899211: return "Deck Hand";
+            case _899212: return "Fishing Hand";
+            case _899311: return "Handyperson";
+            case _899400: return "Motor Vehicle Parts and Accessories Fitters nfd";
+            case _899411: return "Motor Vehicle Parts and Accessories Fitter (General)";
+            case _899412: return "Autoglazier";
+            case _899413: return "Exhaust and Muffler Fitter";
+            case _899414: return "Radiator Fitter";
+            case _899415: return "Tyre Fitter";
+            case _899500: return "Printing Assistants and Table Workers nfd";
+            case _899511: return "Printer's Assistant";
+            case _899512: return "Printing Table Worker";
+            case _899611: return "Recycling or Rubbish Collector";
+            case _899711: return "Vending Machine Attendant";
+            case _899900: return "Other Miscellaneous Labourers nfd";
+            case _899911: return "Bicycle Mechanic";
+            case _899912: return "Car Park Attendant";
+            case _899913: return "Crossing Supervisor";
+            case _899914: return "Electrical or Telecommunications Trades Assistant";
+            case _899915: return "Leaflet or Newspaper Deliverer";
+            case _899916: return "Mechanic's Assistant";
+            case _899917: return "Railways Assistant";
+            case _899918: return "Sign Erector";
+            case _899921: return "Ticket Collector or Usher";
+            case _899922: return "Trolley Collector";
+            case _899999: return "Labourers nec";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnzscoOccupationsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnzscoOccupationsEnumFactory.java
new file mode 100644
index 00000000000..679e2974994
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AnzscoOccupationsEnumFactory.java
@@ -0,0 +1,5358 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AnzscoOccupationsEnumFactory implements EnumFactory {
+
+  public AnzscoOccupations fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("100000".equals(codeString))
+      return AnzscoOccupations._100000;
+    if ("111000".equals(codeString))
+      return AnzscoOccupations._111000;
+    if ("111111".equals(codeString))
+      return AnzscoOccupations._111111;
+    if ("111200".equals(codeString))
+      return AnzscoOccupations._111200;
+    if ("111211".equals(codeString))
+      return AnzscoOccupations._111211;
+    if ("111212".equals(codeString))
+      return AnzscoOccupations._111212;
+    if ("111300".equals(codeString))
+      return AnzscoOccupations._111300;
+    if ("111311".equals(codeString))
+      return AnzscoOccupations._111311;
+    if ("111312".equals(codeString))
+      return AnzscoOccupations._111312;
+    if ("111399".equals(codeString))
+      return AnzscoOccupations._111399;
+    if ("121000".equals(codeString))
+      return AnzscoOccupations._121000;
+    if ("121111".equals(codeString))
+      return AnzscoOccupations._121111;
+    if ("121200".equals(codeString))
+      return AnzscoOccupations._121200;
+    if ("121211".equals(codeString))
+      return AnzscoOccupations._121211;
+    if ("121212".equals(codeString))
+      return AnzscoOccupations._121212;
+    if ("121213".equals(codeString))
+      return AnzscoOccupations._121213;
+    if ("121214".equals(codeString))
+      return AnzscoOccupations._121214;
+    if ("121215".equals(codeString))
+      return AnzscoOccupations._121215;
+    if ("121216".equals(codeString))
+      return AnzscoOccupations._121216;
+    if ("121217".equals(codeString))
+      return AnzscoOccupations._121217;
+    if ("121218".equals(codeString))
+      return AnzscoOccupations._121218;
+    if ("121221".equals(codeString))
+      return AnzscoOccupations._121221;
+    if ("121299".equals(codeString))
+      return AnzscoOccupations._121299;
+    if ("121300".equals(codeString))
+      return AnzscoOccupations._121300;
+    if ("121311".equals(codeString))
+      return AnzscoOccupations._121311;
+    if ("121312".equals(codeString))
+      return AnzscoOccupations._121312;
+    if ("121313".equals(codeString))
+      return AnzscoOccupations._121313;
+    if ("121314".equals(codeString))
+      return AnzscoOccupations._121314;
+    if ("121315".equals(codeString))
+      return AnzscoOccupations._121315;
+    if ("121316".equals(codeString))
+      return AnzscoOccupations._121316;
+    if ("121317".equals(codeString))
+      return AnzscoOccupations._121317;
+    if ("121318".equals(codeString))
+      return AnzscoOccupations._121318;
+    if ("121321".equals(codeString))
+      return AnzscoOccupations._121321;
+    if ("121322".equals(codeString))
+      return AnzscoOccupations._121322;
+    if ("121399".equals(codeString))
+      return AnzscoOccupations._121399;
+    if ("121411".equals(codeString))
+      return AnzscoOccupations._121411;
+    if ("130000".equals(codeString))
+      return AnzscoOccupations._130000;
+    if ("131100".equals(codeString))
+      return AnzscoOccupations._131100;
+    if ("131111".equals(codeString))
+      return AnzscoOccupations._131111;
+    if ("131112".equals(codeString))
+      return AnzscoOccupations._131112;
+    if ("132000".equals(codeString))
+      return AnzscoOccupations._132000;
+    if ("132111".equals(codeString))
+      return AnzscoOccupations._132111;
+    if ("132211".equals(codeString))
+      return AnzscoOccupations._132211;
+    if ("132311".equals(codeString))
+      return AnzscoOccupations._132311;
+    if ("132411".equals(codeString))
+      return AnzscoOccupations._132411;
+    if ("132511".equals(codeString))
+      return AnzscoOccupations._132511;
+    if ("133000".equals(codeString))
+      return AnzscoOccupations._133000;
+    if ("133100".equals(codeString))
+      return AnzscoOccupations._133100;
+    if ("133111".equals(codeString))
+      return AnzscoOccupations._133111;
+    if ("133112".equals(codeString))
+      return AnzscoOccupations._133112;
+    if ("133211".equals(codeString))
+      return AnzscoOccupations._133211;
+    if ("133300".equals(codeString))
+      return AnzscoOccupations._133300;
+    if ("133311".equals(codeString))
+      return AnzscoOccupations._133311;
+    if ("133312".equals(codeString))
+      return AnzscoOccupations._133312;
+    if ("133411".equals(codeString))
+      return AnzscoOccupations._133411;
+    if ("133500".equals(codeString))
+      return AnzscoOccupations._133500;
+    if ("133511".equals(codeString))
+      return AnzscoOccupations._133511;
+    if ("133512".equals(codeString))
+      return AnzscoOccupations._133512;
+    if ("133513".equals(codeString))
+      return AnzscoOccupations._133513;
+    if ("133611".equals(codeString))
+      return AnzscoOccupations._133611;
+    if ("134000".equals(codeString))
+      return AnzscoOccupations._134000;
+    if ("134111".equals(codeString))
+      return AnzscoOccupations._134111;
+    if ("134200".equals(codeString))
+      return AnzscoOccupations._134200;
+    if ("134211".equals(codeString))
+      return AnzscoOccupations._134211;
+    if ("134212".equals(codeString))
+      return AnzscoOccupations._134212;
+    if ("134213".equals(codeString))
+      return AnzscoOccupations._134213;
+    if ("134214".equals(codeString))
+      return AnzscoOccupations._134214;
+    if ("134299".equals(codeString))
+      return AnzscoOccupations._134299;
+    if ("134311".equals(codeString))
+      return AnzscoOccupations._134311;
+    if ("134400".equals(codeString))
+      return AnzscoOccupations._134400;
+    if ("134411".equals(codeString))
+      return AnzscoOccupations._134411;
+    if ("134412".equals(codeString))
+      return AnzscoOccupations._134412;
+    if ("134499".equals(codeString))
+      return AnzscoOccupations._134499;
+    if ("135100".equals(codeString))
+      return AnzscoOccupations._135100;
+    if ("135111".equals(codeString))
+      return AnzscoOccupations._135111;
+    if ("135112".equals(codeString))
+      return AnzscoOccupations._135112;
+    if ("135199".equals(codeString))
+      return AnzscoOccupations._135199;
+    if ("139000".equals(codeString))
+      return AnzscoOccupations._139000;
+    if ("139100".equals(codeString))
+      return AnzscoOccupations._139100;
+    if ("139111".equals(codeString))
+      return AnzscoOccupations._139111;
+    if ("139112".equals(codeString))
+      return AnzscoOccupations._139112;
+    if ("139113".equals(codeString))
+      return AnzscoOccupations._139113;
+    if ("139211".equals(codeString))
+      return AnzscoOccupations._139211;
+    if ("139900".equals(codeString))
+      return AnzscoOccupations._139900;
+    if ("139911".equals(codeString))
+      return AnzscoOccupations._139911;
+    if ("139912".equals(codeString))
+      return AnzscoOccupations._139912;
+    if ("139913".equals(codeString))
+      return AnzscoOccupations._139913;
+    if ("139914".equals(codeString))
+      return AnzscoOccupations._139914;
+    if ("139915".equals(codeString))
+      return AnzscoOccupations._139915;
+    if ("139999".equals(codeString))
+      return AnzscoOccupations._139999;
+    if ("140000".equals(codeString))
+      return AnzscoOccupations._140000;
+    if ("141000".equals(codeString))
+      return AnzscoOccupations._141000;
+    if ("141111".equals(codeString))
+      return AnzscoOccupations._141111;
+    if ("141211".equals(codeString))
+      return AnzscoOccupations._141211;
+    if ("141311".equals(codeString))
+      return AnzscoOccupations._141311;
+    if ("141411".equals(codeString))
+      return AnzscoOccupations._141411;
+    if ("141900".equals(codeString))
+      return AnzscoOccupations._141900;
+    if ("141911".equals(codeString))
+      return AnzscoOccupations._141911;
+    if ("141999".equals(codeString))
+      return AnzscoOccupations._141999;
+    if ("142100".equals(codeString))
+      return AnzscoOccupations._142100;
+    if ("142111".equals(codeString))
+      return AnzscoOccupations._142111;
+    if ("142112".equals(codeString))
+      return AnzscoOccupations._142112;
+    if ("142113".equals(codeString))
+      return AnzscoOccupations._142113;
+    if ("142114".equals(codeString))
+      return AnzscoOccupations._142114;
+    if ("142115".equals(codeString))
+      return AnzscoOccupations._142115;
+    if ("142116".equals(codeString))
+      return AnzscoOccupations._142116;
+    if ("149000".equals(codeString))
+      return AnzscoOccupations._149000;
+    if ("149100".equals(codeString))
+      return AnzscoOccupations._149100;
+    if ("149111".equals(codeString))
+      return AnzscoOccupations._149111;
+    if ("149112".equals(codeString))
+      return AnzscoOccupations._149112;
+    if ("149113".equals(codeString))
+      return AnzscoOccupations._149113;
+    if ("149200".equals(codeString))
+      return AnzscoOccupations._149200;
+    if ("149211".equals(codeString))
+      return AnzscoOccupations._149211;
+    if ("149212".equals(codeString))
+      return AnzscoOccupations._149212;
+    if ("149311".equals(codeString))
+      return AnzscoOccupations._149311;
+    if ("149400".equals(codeString))
+      return AnzscoOccupations._149400;
+    if ("149411".equals(codeString))
+      return AnzscoOccupations._149411;
+    if ("149412".equals(codeString))
+      return AnzscoOccupations._149412;
+    if ("149413".equals(codeString))
+      return AnzscoOccupations._149413;
+    if ("149900".equals(codeString))
+      return AnzscoOccupations._149900;
+    if ("149911".equals(codeString))
+      return AnzscoOccupations._149911;
+    if ("149912".equals(codeString))
+      return AnzscoOccupations._149912;
+    if ("149913".equals(codeString))
+      return AnzscoOccupations._149913;
+    if ("149914".equals(codeString))
+      return AnzscoOccupations._149914;
+    if ("149999".equals(codeString))
+      return AnzscoOccupations._149999;
+    if ("200000".equals(codeString))
+      return AnzscoOccupations._200000;
+    if ("210000".equals(codeString))
+      return AnzscoOccupations._210000;
+    if ("211000".equals(codeString))
+      return AnzscoOccupations._211000;
+    if ("211100".equals(codeString))
+      return AnzscoOccupations._211100;
+    if ("211111".equals(codeString))
+      return AnzscoOccupations._211111;
+    if ("211112".equals(codeString))
+      return AnzscoOccupations._211112;
+    if ("211113".equals(codeString))
+      return AnzscoOccupations._211113;
+    if ("211199".equals(codeString))
+      return AnzscoOccupations._211199;
+    if ("211200".equals(codeString))
+      return AnzscoOccupations._211200;
+    if ("211211".equals(codeString))
+      return AnzscoOccupations._211211;
+    if ("211212".equals(codeString))
+      return AnzscoOccupations._211212;
+    if ("211213".equals(codeString))
+      return AnzscoOccupations._211213;
+    if ("211214".equals(codeString))
+      return AnzscoOccupations._211214;
+    if ("211299".equals(codeString))
+      return AnzscoOccupations._211299;
+    if ("211311".equals(codeString))
+      return AnzscoOccupations._211311;
+    if ("211400".equals(codeString))
+      return AnzscoOccupations._211400;
+    if ("211411".equals(codeString))
+      return AnzscoOccupations._211411;
+    if ("211412".equals(codeString))
+      return AnzscoOccupations._211412;
+    if ("211413".equals(codeString))
+      return AnzscoOccupations._211413;
+    if ("211499".equals(codeString))
+      return AnzscoOccupations._211499;
+    if ("212000".equals(codeString))
+      return AnzscoOccupations._212000;
+    if ("212100".equals(codeString))
+      return AnzscoOccupations._212100;
+    if ("212111".equals(codeString))
+      return AnzscoOccupations._212111;
+    if ("212112".equals(codeString))
+      return AnzscoOccupations._212112;
+    if ("212113".equals(codeString))
+      return AnzscoOccupations._212113;
+    if ("212114".equals(codeString))
+      return AnzscoOccupations._212114;
+    if ("212200".equals(codeString))
+      return AnzscoOccupations._212200;
+    if ("212211".equals(codeString))
+      return AnzscoOccupations._212211;
+    if ("212212".equals(codeString))
+      return AnzscoOccupations._212212;
+    if ("212300".equals(codeString))
+      return AnzscoOccupations._212300;
+    if ("212311".equals(codeString))
+      return AnzscoOccupations._212311;
+    if ("212312".equals(codeString))
+      return AnzscoOccupations._212312;
+    if ("212313".equals(codeString))
+      return AnzscoOccupations._212313;
+    if ("212314".equals(codeString))
+      return AnzscoOccupations._212314;
+    if ("212315".equals(codeString))
+      return AnzscoOccupations._212315;
+    if ("212316".equals(codeString))
+      return AnzscoOccupations._212316;
+    if ("212317".equals(codeString))
+      return AnzscoOccupations._212317;
+    if ("212318".equals(codeString))
+      return AnzscoOccupations._212318;
+    if ("212399".equals(codeString))
+      return AnzscoOccupations._212399;
+    if ("212400".equals(codeString))
+      return AnzscoOccupations._212400;
+    if ("212411".equals(codeString))
+      return AnzscoOccupations._212411;
+    if ("212412".equals(codeString))
+      return AnzscoOccupations._212412;
+    if ("212413".equals(codeString))
+      return AnzscoOccupations._212413;
+    if ("212414".equals(codeString))
+      return AnzscoOccupations._212414;
+    if ("212415".equals(codeString))
+      return AnzscoOccupations._212415;
+    if ("212416".equals(codeString))
+      return AnzscoOccupations._212416;
+    if ("212499".equals(codeString))
+      return AnzscoOccupations._212499;
+    if ("220000".equals(codeString))
+      return AnzscoOccupations._220000;
+    if ("221000".equals(codeString))
+      return AnzscoOccupations._221000;
+    if ("221100".equals(codeString))
+      return AnzscoOccupations._221100;
+    if ("221111".equals(codeString))
+      return AnzscoOccupations._221111;
+    if ("221112".equals(codeString))
+      return AnzscoOccupations._221112;
+    if ("221113".equals(codeString))
+      return AnzscoOccupations._221113;
+    if ("221200".equals(codeString))
+      return AnzscoOccupations._221200;
+    if ("221211".equals(codeString))
+      return AnzscoOccupations._221211;
+    if ("221212".equals(codeString))
+      return AnzscoOccupations._221212;
+    if ("221213".equals(codeString))
+      return AnzscoOccupations._221213;
+    if ("221214".equals(codeString))
+      return AnzscoOccupations._221214;
+    if ("222000".equals(codeString))
+      return AnzscoOccupations._222000;
+    if ("222100".equals(codeString))
+      return AnzscoOccupations._222100;
+    if ("222111".equals(codeString))
+      return AnzscoOccupations._222111;
+    if ("222112".equals(codeString))
+      return AnzscoOccupations._222112;
+    if ("222113".equals(codeString))
+      return AnzscoOccupations._222113;
+    if ("222199".equals(codeString))
+      return AnzscoOccupations._222199;
+    if ("222200".equals(codeString))
+      return AnzscoOccupations._222200;
+    if ("222211".equals(codeString))
+      return AnzscoOccupations._222211;
+    if ("222212".equals(codeString))
+      return AnzscoOccupations._222212;
+    if ("222213".equals(codeString))
+      return AnzscoOccupations._222213;
+    if ("222299".equals(codeString))
+      return AnzscoOccupations._222299;
+    if ("222300".equals(codeString))
+      return AnzscoOccupations._222300;
+    if ("222311".equals(codeString))
+      return AnzscoOccupations._222311;
+    if ("222312".equals(codeString))
+      return AnzscoOccupations._222312;
+    if ("223000".equals(codeString))
+      return AnzscoOccupations._223000;
+    if ("223100".equals(codeString))
+      return AnzscoOccupations._223100;
+    if ("223111".equals(codeString))
+      return AnzscoOccupations._223111;
+    if ("223112".equals(codeString))
+      return AnzscoOccupations._223112;
+    if ("223113".equals(codeString))
+      return AnzscoOccupations._223113;
+    if ("223211".equals(codeString))
+      return AnzscoOccupations._223211;
+    if ("223311".equals(codeString))
+      return AnzscoOccupations._223311;
+    if ("224000".equals(codeString))
+      return AnzscoOccupations._224000;
+    if ("224100".equals(codeString))
+      return AnzscoOccupations._224100;
+    if ("224111".equals(codeString))
+      return AnzscoOccupations._224111;
+    if ("224112".equals(codeString))
+      return AnzscoOccupations._224112;
+    if ("224113".equals(codeString))
+      return AnzscoOccupations._224113;
+    if ("224200".equals(codeString))
+      return AnzscoOccupations._224200;
+    if ("224211".equals(codeString))
+      return AnzscoOccupations._224211;
+    if ("224212".equals(codeString))
+      return AnzscoOccupations._224212;
+    if ("224213".equals(codeString))
+      return AnzscoOccupations._224213;
+    if ("224214".equals(codeString))
+      return AnzscoOccupations._224214;
+    if ("224311".equals(codeString))
+      return AnzscoOccupations._224311;
+    if ("224400".equals(codeString))
+      return AnzscoOccupations._224400;
+    if ("224411".equals(codeString))
+      return AnzscoOccupations._224411;
+    if ("224412".equals(codeString))
+      return AnzscoOccupations._224412;
+    if ("224500".equals(codeString))
+      return AnzscoOccupations._224500;
+    if ("224511".equals(codeString))
+      return AnzscoOccupations._224511;
+    if ("224512".equals(codeString))
+      return AnzscoOccupations._224512;
+    if ("224611".equals(codeString))
+      return AnzscoOccupations._224611;
+    if ("224700".equals(codeString))
+      return AnzscoOccupations._224700;
+    if ("224711".equals(codeString))
+      return AnzscoOccupations._224711;
+    if ("224712".equals(codeString))
+      return AnzscoOccupations._224712;
+    if ("224900".equals(codeString))
+      return AnzscoOccupations._224900;
+    if ("224911".equals(codeString))
+      return AnzscoOccupations._224911;
+    if ("224912".equals(codeString))
+      return AnzscoOccupations._224912;
+    if ("224913".equals(codeString))
+      return AnzscoOccupations._224913;
+    if ("224914".equals(codeString))
+      return AnzscoOccupations._224914;
+    if ("224999".equals(codeString))
+      return AnzscoOccupations._224999;
+    if ("225000".equals(codeString))
+      return AnzscoOccupations._225000;
+    if ("225100".equals(codeString))
+      return AnzscoOccupations._225100;
+    if ("225111".equals(codeString))
+      return AnzscoOccupations._225111;
+    if ("225112".equals(codeString))
+      return AnzscoOccupations._225112;
+    if ("225113".equals(codeString))
+      return AnzscoOccupations._225113;
+    if ("225200".equals(codeString))
+      return AnzscoOccupations._225200;
+    if ("225211".equals(codeString))
+      return AnzscoOccupations._225211;
+    if ("225212".equals(codeString))
+      return AnzscoOccupations._225212;
+    if ("225213".equals(codeString))
+      return AnzscoOccupations._225213;
+    if ("225311".equals(codeString))
+      return AnzscoOccupations._225311;
+    if ("225400".equals(codeString))
+      return AnzscoOccupations._225400;
+    if ("225411".equals(codeString))
+      return AnzscoOccupations._225411;
+    if ("225412".equals(codeString))
+      return AnzscoOccupations._225412;
+    if ("225499".equals(codeString))
+      return AnzscoOccupations._225499;
+    if ("230000".equals(codeString))
+      return AnzscoOccupations._230000;
+    if ("231000".equals(codeString))
+      return AnzscoOccupations._231000;
+    if ("231100".equals(codeString))
+      return AnzscoOccupations._231100;
+    if ("231111".equals(codeString))
+      return AnzscoOccupations._231111;
+    if ("231112".equals(codeString))
+      return AnzscoOccupations._231112;
+    if ("231113".equals(codeString))
+      return AnzscoOccupations._231113;
+    if ("231114".equals(codeString))
+      return AnzscoOccupations._231114;
+    if ("231199".equals(codeString))
+      return AnzscoOccupations._231199;
+    if ("231200".equals(codeString))
+      return AnzscoOccupations._231200;
+    if ("231211".equals(codeString))
+      return AnzscoOccupations._231211;
+    if ("231212".equals(codeString))
+      return AnzscoOccupations._231212;
+    if ("231213".equals(codeString))
+      return AnzscoOccupations._231213;
+    if ("231214".equals(codeString))
+      return AnzscoOccupations._231214;
+    if ("231215".equals(codeString))
+      return AnzscoOccupations._231215;
+    if ("231299".equals(codeString))
+      return AnzscoOccupations._231299;
+    if ("232000".equals(codeString))
+      return AnzscoOccupations._232000;
+    if ("232100".equals(codeString))
+      return AnzscoOccupations._232100;
+    if ("232111".equals(codeString))
+      return AnzscoOccupations._232111;
+    if ("232112".equals(codeString))
+      return AnzscoOccupations._232112;
+    if ("232200".equals(codeString))
+      return AnzscoOccupations._232200;
+    if ("232211".equals(codeString))
+      return AnzscoOccupations._232211;
+    if ("232212".equals(codeString))
+      return AnzscoOccupations._232212;
+    if ("232300".equals(codeString))
+      return AnzscoOccupations._232300;
+    if ("232311".equals(codeString))
+      return AnzscoOccupations._232311;
+    if ("232312".equals(codeString))
+      return AnzscoOccupations._232312;
+    if ("232313".equals(codeString))
+      return AnzscoOccupations._232313;
+    if ("232400".equals(codeString))
+      return AnzscoOccupations._232400;
+    if ("232411".equals(codeString))
+      return AnzscoOccupations._232411;
+    if ("232412".equals(codeString))
+      return AnzscoOccupations._232412;
+    if ("232413".equals(codeString))
+      return AnzscoOccupations._232413;
+    if ("232414".equals(codeString))
+      return AnzscoOccupations._232414;
+    if ("232511".equals(codeString))
+      return AnzscoOccupations._232511;
+    if ("232611".equals(codeString))
+      return AnzscoOccupations._232611;
+    if ("233000".equals(codeString))
+      return AnzscoOccupations._233000;
+    if ("233100".equals(codeString))
+      return AnzscoOccupations._233100;
+    if ("233111".equals(codeString))
+      return AnzscoOccupations._233111;
+    if ("233112".equals(codeString))
+      return AnzscoOccupations._233112;
+    if ("233200".equals(codeString))
+      return AnzscoOccupations._233200;
+    if ("233211".equals(codeString))
+      return AnzscoOccupations._233211;
+    if ("233212".equals(codeString))
+      return AnzscoOccupations._233212;
+    if ("233213".equals(codeString))
+      return AnzscoOccupations._233213;
+    if ("233214".equals(codeString))
+      return AnzscoOccupations._233214;
+    if ("233215".equals(codeString))
+      return AnzscoOccupations._233215;
+    if ("233311".equals(codeString))
+      return AnzscoOccupations._233311;
+    if ("233411".equals(codeString))
+      return AnzscoOccupations._233411;
+    if ("233500".equals(codeString))
+      return AnzscoOccupations._233500;
+    if ("233511".equals(codeString))
+      return AnzscoOccupations._233511;
+    if ("233512".equals(codeString))
+      return AnzscoOccupations._233512;
+    if ("233513".equals(codeString))
+      return AnzscoOccupations._233513;
+    if ("233600".equals(codeString))
+      return AnzscoOccupations._233600;
+    if ("233611".equals(codeString))
+      return AnzscoOccupations._233611;
+    if ("233612".equals(codeString))
+      return AnzscoOccupations._233612;
+    if ("233900".equals(codeString))
+      return AnzscoOccupations._233900;
+    if ("233911".equals(codeString))
+      return AnzscoOccupations._233911;
+    if ("233912".equals(codeString))
+      return AnzscoOccupations._233912;
+    if ("233913".equals(codeString))
+      return AnzscoOccupations._233913;
+    if ("233914".equals(codeString))
+      return AnzscoOccupations._233914;
+    if ("233915".equals(codeString))
+      return AnzscoOccupations._233915;
+    if ("233916".equals(codeString))
+      return AnzscoOccupations._233916;
+    if ("233999".equals(codeString))
+      return AnzscoOccupations._233999;
+    if ("234000".equals(codeString))
+      return AnzscoOccupations._234000;
+    if ("234100".equals(codeString))
+      return AnzscoOccupations._234100;
+    if ("234111".equals(codeString))
+      return AnzscoOccupations._234111;
+    if ("234112".equals(codeString))
+      return AnzscoOccupations._234112;
+    if ("234113".equals(codeString))
+      return AnzscoOccupations._234113;
+    if ("234200".equals(codeString))
+      return AnzscoOccupations._234200;
+    if ("234211".equals(codeString))
+      return AnzscoOccupations._234211;
+    if ("234212".equals(codeString))
+      return AnzscoOccupations._234212;
+    if ("234213".equals(codeString))
+      return AnzscoOccupations._234213;
+    if ("234300".equals(codeString))
+      return AnzscoOccupations._234300;
+    if ("234311".equals(codeString))
+      return AnzscoOccupations._234311;
+    if ("234312".equals(codeString))
+      return AnzscoOccupations._234312;
+    if ("234313".equals(codeString))
+      return AnzscoOccupations._234313;
+    if ("234314".equals(codeString))
+      return AnzscoOccupations._234314;
+    if ("234399".equals(codeString))
+      return AnzscoOccupations._234399;
+    if ("234400".equals(codeString))
+      return AnzscoOccupations._234400;
+    if ("234411".equals(codeString))
+      return AnzscoOccupations._234411;
+    if ("234412".equals(codeString))
+      return AnzscoOccupations._234412;
+    if ("234500".equals(codeString))
+      return AnzscoOccupations._234500;
+    if ("234511".equals(codeString))
+      return AnzscoOccupations._234511;
+    if ("234512".equals(codeString))
+      return AnzscoOccupations._234512;
+    if ("234513".equals(codeString))
+      return AnzscoOccupations._234513;
+    if ("234514".equals(codeString))
+      return AnzscoOccupations._234514;
+    if ("234515".equals(codeString))
+      return AnzscoOccupations._234515;
+    if ("234516".equals(codeString))
+      return AnzscoOccupations._234516;
+    if ("234517".equals(codeString))
+      return AnzscoOccupations._234517;
+    if ("234518".equals(codeString))
+      return AnzscoOccupations._234518;
+    if ("234599".equals(codeString))
+      return AnzscoOccupations._234599;
+    if ("234611".equals(codeString))
+      return AnzscoOccupations._234611;
+    if ("234711".equals(codeString))
+      return AnzscoOccupations._234711;
+    if ("234900".equals(codeString))
+      return AnzscoOccupations._234900;
+    if ("234911".equals(codeString))
+      return AnzscoOccupations._234911;
+    if ("234912".equals(codeString))
+      return AnzscoOccupations._234912;
+    if ("234913".equals(codeString))
+      return AnzscoOccupations._234913;
+    if ("234914".equals(codeString))
+      return AnzscoOccupations._234914;
+    if ("234999".equals(codeString))
+      return AnzscoOccupations._234999;
+    if ("240000".equals(codeString))
+      return AnzscoOccupations._240000;
+    if ("241000".equals(codeString))
+      return AnzscoOccupations._241000;
+    if ("241111".equals(codeString))
+      return AnzscoOccupations._241111;
+    if ("241213".equals(codeString))
+      return AnzscoOccupations._241213;
+    if ("241311".equals(codeString))
+      return AnzscoOccupations._241311;
+    if ("241411".equals(codeString))
+      return AnzscoOccupations._241411;
+    if ("241500".equals(codeString))
+      return AnzscoOccupations._241500;
+    if ("241511".equals(codeString))
+      return AnzscoOccupations._241511;
+    if ("241512".equals(codeString))
+      return AnzscoOccupations._241512;
+    if ("241513".equals(codeString))
+      return AnzscoOccupations._241513;
+    if ("241599".equals(codeString))
+      return AnzscoOccupations._241599;
+    if ("242000".equals(codeString))
+      return AnzscoOccupations._242000;
+    if ("242100".equals(codeString))
+      return AnzscoOccupations._242100;
+    if ("242111".equals(codeString))
+      return AnzscoOccupations._242111;
+    if ("242112".equals(codeString))
+      return AnzscoOccupations._242112;
+    if ("242211".equals(codeString))
+      return AnzscoOccupations._242211;
+    if ("249000".equals(codeString))
+      return AnzscoOccupations._249000;
+    if ("249100".equals(codeString))
+      return AnzscoOccupations._249100;
+    if ("249111".equals(codeString))
+      return AnzscoOccupations._249111;
+    if ("249112".equals(codeString))
+      return AnzscoOccupations._249112;
+    if ("249200".equals(codeString))
+      return AnzscoOccupations._249200;
+    if ("249211".equals(codeString))
+      return AnzscoOccupations._249211;
+    if ("249212".equals(codeString))
+      return AnzscoOccupations._249212;
+    if ("249213".equals(codeString))
+      return AnzscoOccupations._249213;
+    if ("249214".equals(codeString))
+      return AnzscoOccupations._249214;
+    if ("249299".equals(codeString))
+      return AnzscoOccupations._249299;
+    if ("249311".equals(codeString))
+      return AnzscoOccupations._249311;
+    if ("250000".equals(codeString))
+      return AnzscoOccupations._250000;
+    if ("251000".equals(codeString))
+      return AnzscoOccupations._251000;
+    if ("251111".equals(codeString))
+      return AnzscoOccupations._251111;
+    if ("251200".equals(codeString))
+      return AnzscoOccupations._251200;
+    if ("251211".equals(codeString))
+      return AnzscoOccupations._251211;
+    if ("251212".equals(codeString))
+      return AnzscoOccupations._251212;
+    if ("251213".equals(codeString))
+      return AnzscoOccupations._251213;
+    if ("251214".equals(codeString))
+      return AnzscoOccupations._251214;
+    if ("251300".equals(codeString))
+      return AnzscoOccupations._251300;
+    if ("251311".equals(codeString))
+      return AnzscoOccupations._251311;
+    if ("251312".equals(codeString))
+      return AnzscoOccupations._251312;
+    if ("251400".equals(codeString))
+      return AnzscoOccupations._251400;
+    if ("251411".equals(codeString))
+      return AnzscoOccupations._251411;
+    if ("251412".equals(codeString))
+      return AnzscoOccupations._251412;
+    if ("251500".equals(codeString))
+      return AnzscoOccupations._251500;
+    if ("251511".equals(codeString))
+      return AnzscoOccupations._251511;
+    if ("251512".equals(codeString))
+      return AnzscoOccupations._251512;
+    if ("251513".equals(codeString))
+      return AnzscoOccupations._251513;
+    if ("251900".equals(codeString))
+      return AnzscoOccupations._251900;
+    if ("251911".equals(codeString))
+      return AnzscoOccupations._251911;
+    if ("251912".equals(codeString))
+      return AnzscoOccupations._251912;
+    if ("251999".equals(codeString))
+      return AnzscoOccupations._251999;
+    if ("252000".equals(codeString))
+      return AnzscoOccupations._252000;
+    if ("252100".equals(codeString))
+      return AnzscoOccupations._252100;
+    if ("252111".equals(codeString))
+      return AnzscoOccupations._252111;
+    if ("252112".equals(codeString))
+      return AnzscoOccupations._252112;
+    if ("252200".equals(codeString))
+      return AnzscoOccupations._252200;
+    if ("252211".equals(codeString))
+      return AnzscoOccupations._252211;
+    if ("252212".equals(codeString))
+      return AnzscoOccupations._252212;
+    if ("252213".equals(codeString))
+      return AnzscoOccupations._252213;
+    if ("252214".equals(codeString))
+      return AnzscoOccupations._252214;
+    if ("252299".equals(codeString))
+      return AnzscoOccupations._252299;
+    if ("252300".equals(codeString))
+      return AnzscoOccupations._252300;
+    if ("252311".equals(codeString))
+      return AnzscoOccupations._252311;
+    if ("252312".equals(codeString))
+      return AnzscoOccupations._252312;
+    if ("252411".equals(codeString))
+      return AnzscoOccupations._252411;
+    if ("252511".equals(codeString))
+      return AnzscoOccupations._252511;
+    if ("252611".equals(codeString))
+      return AnzscoOccupations._252611;
+    if ("252700".equals(codeString))
+      return AnzscoOccupations._252700;
+    if ("252711".equals(codeString))
+      return AnzscoOccupations._252711;
+    if ("252712".equals(codeString))
+      return AnzscoOccupations._252712;
+    if ("253000".equals(codeString))
+      return AnzscoOccupations._253000;
+    if ("253100".equals(codeString))
+      return AnzscoOccupations._253100;
+    if ("253111".equals(codeString))
+      return AnzscoOccupations._253111;
+    if ("253112".equals(codeString))
+      return AnzscoOccupations._253112;
+    if ("253211".equals(codeString))
+      return AnzscoOccupations._253211;
+    if ("253300".equals(codeString))
+      return AnzscoOccupations._253300;
+    if ("253311".equals(codeString))
+      return AnzscoOccupations._253311;
+    if ("253312".equals(codeString))
+      return AnzscoOccupations._253312;
+    if ("253313".equals(codeString))
+      return AnzscoOccupations._253313;
+    if ("253314".equals(codeString))
+      return AnzscoOccupations._253314;
+    if ("253315".equals(codeString))
+      return AnzscoOccupations._253315;
+    if ("253316".equals(codeString))
+      return AnzscoOccupations._253316;
+    if ("253317".equals(codeString))
+      return AnzscoOccupations._253317;
+    if ("253318".equals(codeString))
+      return AnzscoOccupations._253318;
+    if ("253321".equals(codeString))
+      return AnzscoOccupations._253321;
+    if ("253322".equals(codeString))
+      return AnzscoOccupations._253322;
+    if ("253323".equals(codeString))
+      return AnzscoOccupations._253323;
+    if ("253324".equals(codeString))
+      return AnzscoOccupations._253324;
+    if ("253399".equals(codeString))
+      return AnzscoOccupations._253399;
+    if ("253411".equals(codeString))
+      return AnzscoOccupations._253411;
+    if ("253500".equals(codeString))
+      return AnzscoOccupations._253500;
+    if ("253511".equals(codeString))
+      return AnzscoOccupations._253511;
+    if ("253512".equals(codeString))
+      return AnzscoOccupations._253512;
+    if ("253513".equals(codeString))
+      return AnzscoOccupations._253513;
+    if ("253514".equals(codeString))
+      return AnzscoOccupations._253514;
+    if ("253515".equals(codeString))
+      return AnzscoOccupations._253515;
+    if ("253516".equals(codeString))
+      return AnzscoOccupations._253516;
+    if ("253517".equals(codeString))
+      return AnzscoOccupations._253517;
+    if ("253518".equals(codeString))
+      return AnzscoOccupations._253518;
+    if ("253521".equals(codeString))
+      return AnzscoOccupations._253521;
+    if ("253900".equals(codeString))
+      return AnzscoOccupations._253900;
+    if ("253911".equals(codeString))
+      return AnzscoOccupations._253911;
+    if ("253912".equals(codeString))
+      return AnzscoOccupations._253912;
+    if ("253913".equals(codeString))
+      return AnzscoOccupations._253913;
+    if ("253914".equals(codeString))
+      return AnzscoOccupations._253914;
+    if ("253915".equals(codeString))
+      return AnzscoOccupations._253915;
+    if ("253916".equals(codeString))
+      return AnzscoOccupations._253916;
+    if ("253999".equals(codeString))
+      return AnzscoOccupations._253999;
+    if ("254000".equals(codeString))
+      return AnzscoOccupations._254000;
+    if ("254111".equals(codeString))
+      return AnzscoOccupations._254111;
+    if ("254200".equals(codeString))
+      return AnzscoOccupations._254200;
+    if ("254211".equals(codeString))
+      return AnzscoOccupations._254211;
+    if ("254212".equals(codeString))
+      return AnzscoOccupations._254212;
+    if ("254311".equals(codeString))
+      return AnzscoOccupations._254311;
+    if ("254400".equals(codeString))
+      return AnzscoOccupations._254400;
+    if ("254411".equals(codeString))
+      return AnzscoOccupations._254411;
+    if ("254412".equals(codeString))
+      return AnzscoOccupations._254412;
+    if ("254413".equals(codeString))
+      return AnzscoOccupations._254413;
+    if ("254414".equals(codeString))
+      return AnzscoOccupations._254414;
+    if ("254415".equals(codeString))
+      return AnzscoOccupations._254415;
+    if ("254416".equals(codeString))
+      return AnzscoOccupations._254416;
+    if ("254417".equals(codeString))
+      return AnzscoOccupations._254417;
+    if ("254418".equals(codeString))
+      return AnzscoOccupations._254418;
+    if ("254421".equals(codeString))
+      return AnzscoOccupations._254421;
+    if ("254422".equals(codeString))
+      return AnzscoOccupations._254422;
+    if ("254423".equals(codeString))
+      return AnzscoOccupations._254423;
+    if ("254424".equals(codeString))
+      return AnzscoOccupations._254424;
+    if ("254499".equals(codeString))
+      return AnzscoOccupations._254499;
+    if ("260000".equals(codeString))
+      return AnzscoOccupations._260000;
+    if ("261000".equals(codeString))
+      return AnzscoOccupations._261000;
+    if ("261100".equals(codeString))
+      return AnzscoOccupations._261100;
+    if ("261111".equals(codeString))
+      return AnzscoOccupations._261111;
+    if ("261112".equals(codeString))
+      return AnzscoOccupations._261112;
+    if ("261200".equals(codeString))
+      return AnzscoOccupations._261200;
+    if ("261211".equals(codeString))
+      return AnzscoOccupations._261211;
+    if ("261212".equals(codeString))
+      return AnzscoOccupations._261212;
+    if ("261300".equals(codeString))
+      return AnzscoOccupations._261300;
+    if ("261311".equals(codeString))
+      return AnzscoOccupations._261311;
+    if ("261312".equals(codeString))
+      return AnzscoOccupations._261312;
+    if ("261313".equals(codeString))
+      return AnzscoOccupations._261313;
+    if ("261399".equals(codeString))
+      return AnzscoOccupations._261399;
+    if ("262100".equals(codeString))
+      return AnzscoOccupations._262100;
+    if ("262111".equals(codeString))
+      return AnzscoOccupations._262111;
+    if ("262112".equals(codeString))
+      return AnzscoOccupations._262112;
+    if ("262113".equals(codeString))
+      return AnzscoOccupations._262113;
+    if ("263000".equals(codeString))
+      return AnzscoOccupations._263000;
+    if ("263100".equals(codeString))
+      return AnzscoOccupations._263100;
+    if ("263111".equals(codeString))
+      return AnzscoOccupations._263111;
+    if ("263112".equals(codeString))
+      return AnzscoOccupations._263112;
+    if ("263113".equals(codeString))
+      return AnzscoOccupations._263113;
+    if ("263200".equals(codeString))
+      return AnzscoOccupations._263200;
+    if ("263211".equals(codeString))
+      return AnzscoOccupations._263211;
+    if ("263212".equals(codeString))
+      return AnzscoOccupations._263212;
+    if ("263213".equals(codeString))
+      return AnzscoOccupations._263213;
+    if ("263299".equals(codeString))
+      return AnzscoOccupations._263299;
+    if ("263300".equals(codeString))
+      return AnzscoOccupations._263300;
+    if ("263311".equals(codeString))
+      return AnzscoOccupations._263311;
+    if ("263312".equals(codeString))
+      return AnzscoOccupations._263312;
+    if ("270000".equals(codeString))
+      return AnzscoOccupations._270000;
+    if ("271000".equals(codeString))
+      return AnzscoOccupations._271000;
+    if ("271111".equals(codeString))
+      return AnzscoOccupations._271111;
+    if ("271200".equals(codeString))
+      return AnzscoOccupations._271200;
+    if ("271211".equals(codeString))
+      return AnzscoOccupations._271211;
+    if ("271212".equals(codeString))
+      return AnzscoOccupations._271212;
+    if ("271213".equals(codeString))
+      return AnzscoOccupations._271213;
+    if ("271299".equals(codeString))
+      return AnzscoOccupations._271299;
+    if ("271311".equals(codeString))
+      return AnzscoOccupations._271311;
+    if ("272000".equals(codeString))
+      return AnzscoOccupations._272000;
+    if ("272100".equals(codeString))
+      return AnzscoOccupations._272100;
+    if ("272111".equals(codeString))
+      return AnzscoOccupations._272111;
+    if ("272112".equals(codeString))
+      return AnzscoOccupations._272112;
+    if ("272113".equals(codeString))
+      return AnzscoOccupations._272113;
+    if ("272114".equals(codeString))
+      return AnzscoOccupations._272114;
+    if ("272115".equals(codeString))
+      return AnzscoOccupations._272115;
+    if ("272199".equals(codeString))
+      return AnzscoOccupations._272199;
+    if ("272211".equals(codeString))
+      return AnzscoOccupations._272211;
+    if ("272300".equals(codeString))
+      return AnzscoOccupations._272300;
+    if ("272311".equals(codeString))
+      return AnzscoOccupations._272311;
+    if ("272312".equals(codeString))
+      return AnzscoOccupations._272312;
+    if ("272313".equals(codeString))
+      return AnzscoOccupations._272313;
+    if ("272314".equals(codeString))
+      return AnzscoOccupations._272314;
+    if ("272399".equals(codeString))
+      return AnzscoOccupations._272399;
+    if ("272400".equals(codeString))
+      return AnzscoOccupations._272400;
+    if ("272411".equals(codeString))
+      return AnzscoOccupations._272411;
+    if ("272412".equals(codeString))
+      return AnzscoOccupations._272412;
+    if ("272413".equals(codeString))
+      return AnzscoOccupations._272413;
+    if ("272499".equals(codeString))
+      return AnzscoOccupations._272499;
+    if ("272511".equals(codeString))
+      return AnzscoOccupations._272511;
+    if ("272600".equals(codeString))
+      return AnzscoOccupations._272600;
+    if ("272611".equals(codeString))
+      return AnzscoOccupations._272611;
+    if ("272612".equals(codeString))
+      return AnzscoOccupations._272612;
+    if ("272613".equals(codeString))
+      return AnzscoOccupations._272613;
+    if ("300000".equals(codeString))
+      return AnzscoOccupations._300000;
+    if ("310000".equals(codeString))
+      return AnzscoOccupations._310000;
+    if ("311000".equals(codeString))
+      return AnzscoOccupations._311000;
+    if ("311111".equals(codeString))
+      return AnzscoOccupations._311111;
+    if ("311200".equals(codeString))
+      return AnzscoOccupations._311200;
+    if ("311211".equals(codeString))
+      return AnzscoOccupations._311211;
+    if ("311212".equals(codeString))
+      return AnzscoOccupations._311212;
+    if ("311213".equals(codeString))
+      return AnzscoOccupations._311213;
+    if ("311214".equals(codeString))
+      return AnzscoOccupations._311214;
+    if ("311215".equals(codeString))
+      return AnzscoOccupations._311215;
+    if ("311299".equals(codeString))
+      return AnzscoOccupations._311299;
+    if ("311300".equals(codeString))
+      return AnzscoOccupations._311300;
+    if ("311311".equals(codeString))
+      return AnzscoOccupations._311311;
+    if ("311312".equals(codeString))
+      return AnzscoOccupations._311312;
+    if ("311313".equals(codeString))
+      return AnzscoOccupations._311313;
+    if ("311399".equals(codeString))
+      return AnzscoOccupations._311399;
+    if ("311400".equals(codeString))
+      return AnzscoOccupations._311400;
+    if ("311411".equals(codeString))
+      return AnzscoOccupations._311411;
+    if ("311412".equals(codeString))
+      return AnzscoOccupations._311412;
+    if ("311413".equals(codeString))
+      return AnzscoOccupations._311413;
+    if ("311414".equals(codeString))
+      return AnzscoOccupations._311414;
+    if ("311499".equals(codeString))
+      return AnzscoOccupations._311499;
+    if ("312000".equals(codeString))
+      return AnzscoOccupations._312000;
+    if ("312100".equals(codeString))
+      return AnzscoOccupations._312100;
+    if ("312111".equals(codeString))
+      return AnzscoOccupations._312111;
+    if ("312112".equals(codeString))
+      return AnzscoOccupations._312112;
+    if ("312113".equals(codeString))
+      return AnzscoOccupations._312113;
+    if ("312114".equals(codeString))
+      return AnzscoOccupations._312114;
+    if ("312115".equals(codeString))
+      return AnzscoOccupations._312115;
+    if ("312116".equals(codeString))
+      return AnzscoOccupations._312116;
+    if ("312200".equals(codeString))
+      return AnzscoOccupations._312200;
+    if ("312211".equals(codeString))
+      return AnzscoOccupations._312211;
+    if ("312212".equals(codeString))
+      return AnzscoOccupations._312212;
+    if ("312300".equals(codeString))
+      return AnzscoOccupations._312300;
+    if ("312311".equals(codeString))
+      return AnzscoOccupations._312311;
+    if ("312312".equals(codeString))
+      return AnzscoOccupations._312312;
+    if ("312400".equals(codeString))
+      return AnzscoOccupations._312400;
+    if ("312411".equals(codeString))
+      return AnzscoOccupations._312411;
+    if ("312412".equals(codeString))
+      return AnzscoOccupations._312412;
+    if ("312500".equals(codeString))
+      return AnzscoOccupations._312500;
+    if ("312511".equals(codeString))
+      return AnzscoOccupations._312511;
+    if ("312512".equals(codeString))
+      return AnzscoOccupations._312512;
+    if ("312611".equals(codeString))
+      return AnzscoOccupations._312611;
+    if ("312900".equals(codeString))
+      return AnzscoOccupations._312900;
+    if ("312911".equals(codeString))
+      return AnzscoOccupations._312911;
+    if ("312912".equals(codeString))
+      return AnzscoOccupations._312912;
+    if ("312913".equals(codeString))
+      return AnzscoOccupations._312913;
+    if ("312999".equals(codeString))
+      return AnzscoOccupations._312999;
+    if ("313000".equals(codeString))
+      return AnzscoOccupations._313000;
+    if ("313100".equals(codeString))
+      return AnzscoOccupations._313100;
+    if ("313111".equals(codeString))
+      return AnzscoOccupations._313111;
+    if ("313112".equals(codeString))
+      return AnzscoOccupations._313112;
+    if ("313113".equals(codeString))
+      return AnzscoOccupations._313113;
+    if ("313199".equals(codeString))
+      return AnzscoOccupations._313199;
+    if ("313200".equals(codeString))
+      return AnzscoOccupations._313200;
+    if ("313211".equals(codeString))
+      return AnzscoOccupations._313211;
+    if ("313212".equals(codeString))
+      return AnzscoOccupations._313212;
+    if ("313213".equals(codeString))
+      return AnzscoOccupations._313213;
+    if ("313214".equals(codeString))
+      return AnzscoOccupations._313214;
+    if ("320000".equals(codeString))
+      return AnzscoOccupations._320000;
+    if ("321000".equals(codeString))
+      return AnzscoOccupations._321000;
+    if ("321111".equals(codeString))
+      return AnzscoOccupations._321111;
+    if ("321200".equals(codeString))
+      return AnzscoOccupations._321200;
+    if ("321211".equals(codeString))
+      return AnzscoOccupations._321211;
+    if ("321212".equals(codeString))
+      return AnzscoOccupations._321212;
+    if ("321213".equals(codeString))
+      return AnzscoOccupations._321213;
+    if ("321214".equals(codeString))
+      return AnzscoOccupations._321214;
+    if ("322000".equals(codeString))
+      return AnzscoOccupations._322000;
+    if ("322100".equals(codeString))
+      return AnzscoOccupations._322100;
+    if ("322111".equals(codeString))
+      return AnzscoOccupations._322111;
+    if ("322112".equals(codeString))
+      return AnzscoOccupations._322112;
+    if ("322113".equals(codeString))
+      return AnzscoOccupations._322113;
+    if ("322114".equals(codeString))
+      return AnzscoOccupations._322114;
+    if ("322115".equals(codeString))
+      return AnzscoOccupations._322115;
+    if ("322211".equals(codeString))
+      return AnzscoOccupations._322211;
+    if ("322300".equals(codeString))
+      return AnzscoOccupations._322300;
+    if ("322311".equals(codeString))
+      return AnzscoOccupations._322311;
+    if ("322312".equals(codeString))
+      return AnzscoOccupations._322312;
+    if ("322313".equals(codeString))
+      return AnzscoOccupations._322313;
+    if ("323000".equals(codeString))
+      return AnzscoOccupations._323000;
+    if ("323100".equals(codeString))
+      return AnzscoOccupations._323100;
+    if ("323111".equals(codeString))
+      return AnzscoOccupations._323111;
+    if ("323112".equals(codeString))
+      return AnzscoOccupations._323112;
+    if ("323113".equals(codeString))
+      return AnzscoOccupations._323113;
+    if ("323200".equals(codeString))
+      return AnzscoOccupations._323200;
+    if ("323211".equals(codeString))
+      return AnzscoOccupations._323211;
+    if ("323212".equals(codeString))
+      return AnzscoOccupations._323212;
+    if ("323213".equals(codeString))
+      return AnzscoOccupations._323213;
+    if ("323214".equals(codeString))
+      return AnzscoOccupations._323214;
+    if ("323215".equals(codeString))
+      return AnzscoOccupations._323215;
+    if ("323299".equals(codeString))
+      return AnzscoOccupations._323299;
+    if ("323300".equals(codeString))
+      return AnzscoOccupations._323300;
+    if ("323311".equals(codeString))
+      return AnzscoOccupations._323311;
+    if ("323312".equals(codeString))
+      return AnzscoOccupations._323312;
+    if ("323313".equals(codeString))
+      return AnzscoOccupations._323313;
+    if ("323314".equals(codeString))
+      return AnzscoOccupations._323314;
+    if ("323315".equals(codeString))
+      return AnzscoOccupations._323315;
+    if ("323316".equals(codeString))
+      return AnzscoOccupations._323316;
+    if ("323400".equals(codeString))
+      return AnzscoOccupations._323400;
+    if ("323411".equals(codeString))
+      return AnzscoOccupations._323411;
+    if ("323412".equals(codeString))
+      return AnzscoOccupations._323412;
+    if ("324000".equals(codeString))
+      return AnzscoOccupations._324000;
+    if ("324111".equals(codeString))
+      return AnzscoOccupations._324111;
+    if ("324200".equals(codeString))
+      return AnzscoOccupations._324200;
+    if ("324211".equals(codeString))
+      return AnzscoOccupations._324211;
+    if ("324212".equals(codeString))
+      return AnzscoOccupations._324212;
+    if ("324311".equals(codeString))
+      return AnzscoOccupations._324311;
+    if ("330000".equals(codeString))
+      return AnzscoOccupations._330000;
+    if ("331000".equals(codeString))
+      return AnzscoOccupations._331000;
+    if ("331100".equals(codeString))
+      return AnzscoOccupations._331100;
+    if ("331111".equals(codeString))
+      return AnzscoOccupations._331111;
+    if ("331112".equals(codeString))
+      return AnzscoOccupations._331112;
+    if ("331211".equals(codeString))
+      return AnzscoOccupations._331211;
+    if ("331212".equals(codeString))
+      return AnzscoOccupations._331212;
+    if ("331213".equals(codeString))
+      return AnzscoOccupations._331213;
+    if ("332000".equals(codeString))
+      return AnzscoOccupations._332000;
+    if ("332111".equals(codeString))
+      return AnzscoOccupations._332111;
+    if ("332211".equals(codeString))
+      return AnzscoOccupations._332211;
+    if ("333000".equals(codeString))
+      return AnzscoOccupations._333000;
+    if ("333111".equals(codeString))
+      return AnzscoOccupations._333111;
+    if ("333200".equals(codeString))
+      return AnzscoOccupations._333200;
+    if ("333211".equals(codeString))
+      return AnzscoOccupations._333211;
+    if ("333212".equals(codeString))
+      return AnzscoOccupations._333212;
+    if ("333311".equals(codeString))
+      return AnzscoOccupations._333311;
+    if ("333411".equals(codeString))
+      return AnzscoOccupations._333411;
+    if ("334100".equals(codeString))
+      return AnzscoOccupations._334100;
+    if ("334111".equals(codeString))
+      return AnzscoOccupations._334111;
+    if ("334112".equals(codeString))
+      return AnzscoOccupations._334112;
+    if ("334113".equals(codeString))
+      return AnzscoOccupations._334113;
+    if ("334114".equals(codeString))
+      return AnzscoOccupations._334114;
+    if ("334115".equals(codeString))
+      return AnzscoOccupations._334115;
+    if ("340000".equals(codeString))
+      return AnzscoOccupations._340000;
+    if ("341100".equals(codeString))
+      return AnzscoOccupations._341100;
+    if ("341111".equals(codeString))
+      return AnzscoOccupations._341111;
+    if ("341112".equals(codeString))
+      return AnzscoOccupations._341112;
+    if ("341113".equals(codeString))
+      return AnzscoOccupations._341113;
+    if ("342000".equals(codeString))
+      return AnzscoOccupations._342000;
+    if ("342111".equals(codeString))
+      return AnzscoOccupations._342111;
+    if ("342200".equals(codeString))
+      return AnzscoOccupations._342200;
+    if ("342211".equals(codeString))
+      return AnzscoOccupations._342211;
+    if ("342212".equals(codeString))
+      return AnzscoOccupations._342212;
+    if ("342300".equals(codeString))
+      return AnzscoOccupations._342300;
+    if ("342311".equals(codeString))
+      return AnzscoOccupations._342311;
+    if ("342312".equals(codeString))
+      return AnzscoOccupations._342312;
+    if ("342313".equals(codeString))
+      return AnzscoOccupations._342313;
+    if ("342314".equals(codeString))
+      return AnzscoOccupations._342314;
+    if ("342315".equals(codeString))
+      return AnzscoOccupations._342315;
+    if ("342400".equals(codeString))
+      return AnzscoOccupations._342400;
+    if ("342411".equals(codeString))
+      return AnzscoOccupations._342411;
+    if ("342412".equals(codeString))
+      return AnzscoOccupations._342412;
+    if ("342413".equals(codeString))
+      return AnzscoOccupations._342413;
+    if ("342414".equals(codeString))
+      return AnzscoOccupations._342414;
+    if ("351000".equals(codeString))
+      return AnzscoOccupations._351000;
+    if ("351100".equals(codeString))
+      return AnzscoOccupations._351100;
+    if ("351111".equals(codeString))
+      return AnzscoOccupations._351111;
+    if ("351112".equals(codeString))
+      return AnzscoOccupations._351112;
+    if ("351211".equals(codeString))
+      return AnzscoOccupations._351211;
+    if ("351311".equals(codeString))
+      return AnzscoOccupations._351311;
+    if ("351411".equals(codeString))
+      return AnzscoOccupations._351411;
+    if ("360000".equals(codeString))
+      return AnzscoOccupations._360000;
+    if ("361000".equals(codeString))
+      return AnzscoOccupations._361000;
+    if ("361100".equals(codeString))
+      return AnzscoOccupations._361100;
+    if ("361111".equals(codeString))
+      return AnzscoOccupations._361111;
+    if ("361112".equals(codeString))
+      return AnzscoOccupations._361112;
+    if ("361113".equals(codeString))
+      return AnzscoOccupations._361113;
+    if ("361114".equals(codeString))
+      return AnzscoOccupations._361114;
+    if ("361199".equals(codeString))
+      return AnzscoOccupations._361199;
+    if ("361211".equals(codeString))
+      return AnzscoOccupations._361211;
+    if ("361311".equals(codeString))
+      return AnzscoOccupations._361311;
+    if ("362000".equals(codeString))
+      return AnzscoOccupations._362000;
+    if ("362111".equals(codeString))
+      return AnzscoOccupations._362111;
+    if ("362200".equals(codeString))
+      return AnzscoOccupations._362200;
+    if ("362211".equals(codeString))
+      return AnzscoOccupations._362211;
+    if ("362212".equals(codeString))
+      return AnzscoOccupations._362212;
+    if ("362213".equals(codeString))
+      return AnzscoOccupations._362213;
+    if ("362311".equals(codeString))
+      return AnzscoOccupations._362311;
+    if ("362411".equals(codeString))
+      return AnzscoOccupations._362411;
+    if ("390000".equals(codeString))
+      return AnzscoOccupations._390000;
+    if ("391111".equals(codeString))
+      return AnzscoOccupations._391111;
+    if ("392000".equals(codeString))
+      return AnzscoOccupations._392000;
+    if ("392100".equals(codeString))
+      return AnzscoOccupations._392100;
+    if ("392111".equals(codeString))
+      return AnzscoOccupations._392111;
+    if ("392112".equals(codeString))
+      return AnzscoOccupations._392112;
+    if ("392211".equals(codeString))
+      return AnzscoOccupations._392211;
+    if ("392300".equals(codeString))
+      return AnzscoOccupations._392300;
+    if ("392311".equals(codeString))
+      return AnzscoOccupations._392311;
+    if ("392312".equals(codeString))
+      return AnzscoOccupations._392312;
+    if ("393000".equals(codeString))
+      return AnzscoOccupations._393000;
+    if ("393100".equals(codeString))
+      return AnzscoOccupations._393100;
+    if ("393111".equals(codeString))
+      return AnzscoOccupations._393111;
+    if ("393112".equals(codeString))
+      return AnzscoOccupations._393112;
+    if ("393113".equals(codeString))
+      return AnzscoOccupations._393113;
+    if ("393114".equals(codeString))
+      return AnzscoOccupations._393114;
+    if ("393200".equals(codeString))
+      return AnzscoOccupations._393200;
+    if ("393211".equals(codeString))
+      return AnzscoOccupations._393211;
+    if ("393212".equals(codeString))
+      return AnzscoOccupations._393212;
+    if ("393213".equals(codeString))
+      return AnzscoOccupations._393213;
+    if ("393299".equals(codeString))
+      return AnzscoOccupations._393299;
+    if ("393311".equals(codeString))
+      return AnzscoOccupations._393311;
+    if ("394000".equals(codeString))
+      return AnzscoOccupations._394000;
+    if ("394111".equals(codeString))
+      return AnzscoOccupations._394111;
+    if ("394200".equals(codeString))
+      return AnzscoOccupations._394200;
+    if ("394211".equals(codeString))
+      return AnzscoOccupations._394211;
+    if ("394212".equals(codeString))
+      return AnzscoOccupations._394212;
+    if ("394213".equals(codeString))
+      return AnzscoOccupations._394213;
+    if ("394214".equals(codeString))
+      return AnzscoOccupations._394214;
+    if ("394299".equals(codeString))
+      return AnzscoOccupations._394299;
+    if ("399000".equals(codeString))
+      return AnzscoOccupations._399000;
+    if ("399100".equals(codeString))
+      return AnzscoOccupations._399100;
+    if ("399111".equals(codeString))
+      return AnzscoOccupations._399111;
+    if ("399112".equals(codeString))
+      return AnzscoOccupations._399112;
+    if ("399200".equals(codeString))
+      return AnzscoOccupations._399200;
+    if ("399211".equals(codeString))
+      return AnzscoOccupations._399211;
+    if ("399212".equals(codeString))
+      return AnzscoOccupations._399212;
+    if ("399213".equals(codeString))
+      return AnzscoOccupations._399213;
+    if ("399300".equals(codeString))
+      return AnzscoOccupations._399300;
+    if ("399311".equals(codeString))
+      return AnzscoOccupations._399311;
+    if ("399312".equals(codeString))
+      return AnzscoOccupations._399312;
+    if ("399411".equals(codeString))
+      return AnzscoOccupations._399411;
+    if ("399500".equals(codeString))
+      return AnzscoOccupations._399500;
+    if ("399511".equals(codeString))
+      return AnzscoOccupations._399511;
+    if ("399512".equals(codeString))
+      return AnzscoOccupations._399512;
+    if ("399513".equals(codeString))
+      return AnzscoOccupations._399513;
+    if ("399514".equals(codeString))
+      return AnzscoOccupations._399514;
+    if ("399515".equals(codeString))
+      return AnzscoOccupations._399515;
+    if ("399516".equals(codeString))
+      return AnzscoOccupations._399516;
+    if ("399517".equals(codeString))
+      return AnzscoOccupations._399517;
+    if ("399599".equals(codeString))
+      return AnzscoOccupations._399599;
+    if ("399611".equals(codeString))
+      return AnzscoOccupations._399611;
+    if ("399900".equals(codeString))
+      return AnzscoOccupations._399900;
+    if ("399911".equals(codeString))
+      return AnzscoOccupations._399911;
+    if ("399912".equals(codeString))
+      return AnzscoOccupations._399912;
+    if ("399913".equals(codeString))
+      return AnzscoOccupations._399913;
+    if ("399914".equals(codeString))
+      return AnzscoOccupations._399914;
+    if ("399915".equals(codeString))
+      return AnzscoOccupations._399915;
+    if ("399916".equals(codeString))
+      return AnzscoOccupations._399916;
+    if ("399917".equals(codeString))
+      return AnzscoOccupations._399917;
+    if ("399999".equals(codeString))
+      return AnzscoOccupations._399999;
+    if ("400000".equals(codeString))
+      return AnzscoOccupations._400000;
+    if ("411000".equals(codeString))
+      return AnzscoOccupations._411000;
+    if ("411100".equals(codeString))
+      return AnzscoOccupations._411100;
+    if ("411111".equals(codeString))
+      return AnzscoOccupations._411111;
+    if ("411112".equals(codeString))
+      return AnzscoOccupations._411112;
+    if ("411200".equals(codeString))
+      return AnzscoOccupations._411200;
+    if ("411211".equals(codeString))
+      return AnzscoOccupations._411211;
+    if ("411212".equals(codeString))
+      return AnzscoOccupations._411212;
+    if ("411213".equals(codeString))
+      return AnzscoOccupations._411213;
+    if ("411214".equals(codeString))
+      return AnzscoOccupations._411214;
+    if ("411311".equals(codeString))
+      return AnzscoOccupations._411311;
+    if ("411400".equals(codeString))
+      return AnzscoOccupations._411400;
+    if ("411411".equals(codeString))
+      return AnzscoOccupations._411411;
+    if ("411412".equals(codeString))
+      return AnzscoOccupations._411412;
+    if ("411511".equals(codeString))
+      return AnzscoOccupations._411511;
+    if ("411611".equals(codeString))
+      return AnzscoOccupations._411611;
+    if ("411700".equals(codeString))
+      return AnzscoOccupations._411700;
+    if ("411711".equals(codeString))
+      return AnzscoOccupations._411711;
+    if ("411712".equals(codeString))
+      return AnzscoOccupations._411712;
+    if ("411713".equals(codeString))
+      return AnzscoOccupations._411713;
+    if ("411714".equals(codeString))
+      return AnzscoOccupations._411714;
+    if ("411715".equals(codeString))
+      return AnzscoOccupations._411715;
+    if ("411716".equals(codeString))
+      return AnzscoOccupations._411716;
+    if ("420000".equals(codeString))
+      return AnzscoOccupations._420000;
+    if ("421100".equals(codeString))
+      return AnzscoOccupations._421100;
+    if ("421111".equals(codeString))
+      return AnzscoOccupations._421111;
+    if ("421112".equals(codeString))
+      return AnzscoOccupations._421112;
+    if ("421113".equals(codeString))
+      return AnzscoOccupations._421113;
+    if ("421114".equals(codeString))
+      return AnzscoOccupations._421114;
+    if ("422100".equals(codeString))
+      return AnzscoOccupations._422100;
+    if ("422111".equals(codeString))
+      return AnzscoOccupations._422111;
+    if ("422112".equals(codeString))
+      return AnzscoOccupations._422112;
+    if ("422115".equals(codeString))
+      return AnzscoOccupations._422115;
+    if ("422116".equals(codeString))
+      return AnzscoOccupations._422116;
+    if ("423000".equals(codeString))
+      return AnzscoOccupations._423000;
+    if ("423111".equals(codeString))
+      return AnzscoOccupations._423111;
+    if ("423211".equals(codeString))
+      return AnzscoOccupations._423211;
+    if ("423300".equals(codeString))
+      return AnzscoOccupations._423300;
+    if ("423311".equals(codeString))
+      return AnzscoOccupations._423311;
+    if ("423312".equals(codeString))
+      return AnzscoOccupations._423312;
+    if ("423313".equals(codeString))
+      return AnzscoOccupations._423313;
+    if ("423314".equals(codeString))
+      return AnzscoOccupations._423314;
+    if ("423400".equals(codeString))
+      return AnzscoOccupations._423400;
+    if ("423411".equals(codeString))
+      return AnzscoOccupations._423411;
+    if ("423412".equals(codeString))
+      return AnzscoOccupations._423412;
+    if ("423413".equals(codeString))
+      return AnzscoOccupations._423413;
+    if ("431000".equals(codeString))
+      return AnzscoOccupations._431000;
+    if ("431100".equals(codeString))
+      return AnzscoOccupations._431100;
+    if ("431111".equals(codeString))
+      return AnzscoOccupations._431111;
+    if ("431112".equals(codeString))
+      return AnzscoOccupations._431112;
+    if ("431211".equals(codeString))
+      return AnzscoOccupations._431211;
+    if ("431311".equals(codeString))
+      return AnzscoOccupations._431311;
+    if ("431411".equals(codeString))
+      return AnzscoOccupations._431411;
+    if ("431511".equals(codeString))
+      return AnzscoOccupations._431511;
+    if ("431900".equals(codeString))
+      return AnzscoOccupations._431900;
+    if ("431911".equals(codeString))
+      return AnzscoOccupations._431911;
+    if ("431912".equals(codeString))
+      return AnzscoOccupations._431912;
+    if ("431999".equals(codeString))
+      return AnzscoOccupations._431999;
+    if ("440000".equals(codeString))
+      return AnzscoOccupations._440000;
+    if ("441000".equals(codeString))
+      return AnzscoOccupations._441000;
+    if ("441111".equals(codeString))
+      return AnzscoOccupations._441111;
+    if ("441200".equals(codeString))
+      return AnzscoOccupations._441200;
+    if ("441211".equals(codeString))
+      return AnzscoOccupations._441211;
+    if ("441212".equals(codeString))
+      return AnzscoOccupations._441212;
+    if ("441300".equals(codeString))
+      return AnzscoOccupations._441300;
+    if ("441311".equals(codeString))
+      return AnzscoOccupations._441311;
+    if ("441312".equals(codeString))
+      return AnzscoOccupations._441312;
+    if ("442000".equals(codeString))
+      return AnzscoOccupations._442000;
+    if ("442111".equals(codeString))
+      return AnzscoOccupations._442111;
+    if ("442200".equals(codeString))
+      return AnzscoOccupations._442200;
+    if ("442211".equals(codeString))
+      return AnzscoOccupations._442211;
+    if ("442212".equals(codeString))
+      return AnzscoOccupations._442212;
+    if ("442213".equals(codeString))
+      return AnzscoOccupations._442213;
+    if ("442214".equals(codeString))
+      return AnzscoOccupations._442214;
+    if ("442215".equals(codeString))
+      return AnzscoOccupations._442215;
+    if ("442216".equals(codeString))
+      return AnzscoOccupations._442216;
+    if ("442217".equals(codeString))
+      return AnzscoOccupations._442217;
+    if ("442299".equals(codeString))
+      return AnzscoOccupations._442299;
+    if ("450000".equals(codeString))
+      return AnzscoOccupations._450000;
+    if ("451000".equals(codeString))
+      return AnzscoOccupations._451000;
+    if ("451111".equals(codeString))
+      return AnzscoOccupations._451111;
+    if ("451211".equals(codeString))
+      return AnzscoOccupations._451211;
+    if ("451300".equals(codeString))
+      return AnzscoOccupations._451300;
+    if ("451311".equals(codeString))
+      return AnzscoOccupations._451311;
+    if ("451399".equals(codeString))
+      return AnzscoOccupations._451399;
+    if ("451400".equals(codeString))
+      return AnzscoOccupations._451400;
+    if ("451411".equals(codeString))
+      return AnzscoOccupations._451411;
+    if ("451412".equals(codeString))
+      return AnzscoOccupations._451412;
+    if ("451500".equals(codeString))
+      return AnzscoOccupations._451500;
+    if ("451511".equals(codeString))
+      return AnzscoOccupations._451511;
+    if ("451512".equals(codeString))
+      return AnzscoOccupations._451512;
+    if ("451600".equals(codeString))
+      return AnzscoOccupations._451600;
+    if ("451611".equals(codeString))
+      return AnzscoOccupations._451611;
+    if ("451612".equals(codeString))
+      return AnzscoOccupations._451612;
+    if ("451700".equals(codeString))
+      return AnzscoOccupations._451700;
+    if ("451711".equals(codeString))
+      return AnzscoOccupations._451711;
+    if ("451799".equals(codeString))
+      return AnzscoOccupations._451799;
+    if ("451800".equals(codeString))
+      return AnzscoOccupations._451800;
+    if ("451811".equals(codeString))
+      return AnzscoOccupations._451811;
+    if ("451812".equals(codeString))
+      return AnzscoOccupations._451812;
+    if ("451813".equals(codeString))
+      return AnzscoOccupations._451813;
+    if ("451899".equals(codeString))
+      return AnzscoOccupations._451899;
+    if ("452000".equals(codeString))
+      return AnzscoOccupations._452000;
+    if ("452111".equals(codeString))
+      return AnzscoOccupations._452111;
+    if ("452200".equals(codeString))
+      return AnzscoOccupations._452200;
+    if ("452211".equals(codeString))
+      return AnzscoOccupations._452211;
+    if ("452212".equals(codeString))
+      return AnzscoOccupations._452212;
+    if ("452213".equals(codeString))
+      return AnzscoOccupations._452213;
+    if ("452214".equals(codeString))
+      return AnzscoOccupations._452214;
+    if ("452215".equals(codeString))
+      return AnzscoOccupations._452215;
+    if ("452216".equals(codeString))
+      return AnzscoOccupations._452216;
+    if ("452217".equals(codeString))
+      return AnzscoOccupations._452217;
+    if ("452299".equals(codeString))
+      return AnzscoOccupations._452299;
+    if ("452300".equals(codeString))
+      return AnzscoOccupations._452300;
+    if ("452311".equals(codeString))
+      return AnzscoOccupations._452311;
+    if ("452312".equals(codeString))
+      return AnzscoOccupations._452312;
+    if ("452313".equals(codeString))
+      return AnzscoOccupations._452313;
+    if ("452314".equals(codeString))
+      return AnzscoOccupations._452314;
+    if ("452315".equals(codeString))
+      return AnzscoOccupations._452315;
+    if ("452316".equals(codeString))
+      return AnzscoOccupations._452316;
+    if ("452317".equals(codeString))
+      return AnzscoOccupations._452317;
+    if ("452318".equals(codeString))
+      return AnzscoOccupations._452318;
+    if ("452321".equals(codeString))
+      return AnzscoOccupations._452321;
+    if ("452322".equals(codeString))
+      return AnzscoOccupations._452322;
+    if ("452323".equals(codeString))
+      return AnzscoOccupations._452323;
+    if ("452400".equals(codeString))
+      return AnzscoOccupations._452400;
+    if ("452411".equals(codeString))
+      return AnzscoOccupations._452411;
+    if ("452412".equals(codeString))
+      return AnzscoOccupations._452412;
+    if ("452413".equals(codeString))
+      return AnzscoOccupations._452413;
+    if ("452414".equals(codeString))
+      return AnzscoOccupations._452414;
+    if ("452499".equals(codeString))
+      return AnzscoOccupations._452499;
+    if ("500000".equals(codeString))
+      return AnzscoOccupations._500000;
+    if ("510000".equals(codeString))
+      return AnzscoOccupations._510000;
+    if ("511100".equals(codeString))
+      return AnzscoOccupations._511100;
+    if ("511111".equals(codeString))
+      return AnzscoOccupations._511111;
+    if ("511112".equals(codeString))
+      return AnzscoOccupations._511112;
+    if ("512000".equals(codeString))
+      return AnzscoOccupations._512000;
+    if ("512111".equals(codeString))
+      return AnzscoOccupations._512111;
+    if ("512200".equals(codeString))
+      return AnzscoOccupations._512200;
+    if ("512211".equals(codeString))
+      return AnzscoOccupations._512211;
+    if ("512299".equals(codeString))
+      return AnzscoOccupations._512299;
+    if ("521000".equals(codeString))
+      return AnzscoOccupations._521000;
+    if ("521111".equals(codeString))
+      return AnzscoOccupations._521111;
+    if ("521200".equals(codeString))
+      return AnzscoOccupations._521200;
+    if ("521211".equals(codeString))
+      return AnzscoOccupations._521211;
+    if ("521212".equals(codeString))
+      return AnzscoOccupations._521212;
+    if ("530000".equals(codeString))
+      return AnzscoOccupations._530000;
+    if ("531111".equals(codeString))
+      return AnzscoOccupations._531111;
+    if ("532100".equals(codeString))
+      return AnzscoOccupations._532100;
+    if ("532111".equals(codeString))
+      return AnzscoOccupations._532111;
+    if ("532112".equals(codeString))
+      return AnzscoOccupations._532112;
+    if ("532113".equals(codeString))
+      return AnzscoOccupations._532113;
+    if ("540000".equals(codeString))
+      return AnzscoOccupations._540000;
+    if ("541000".equals(codeString))
+      return AnzscoOccupations._541000;
+    if ("541100".equals(codeString))
+      return AnzscoOccupations._541100;
+    if ("541111".equals(codeString))
+      return AnzscoOccupations._541111;
+    if ("541112".equals(codeString))
+      return AnzscoOccupations._541112;
+    if ("541211".equals(codeString))
+      return AnzscoOccupations._541211;
+    if ("542100".equals(codeString))
+      return AnzscoOccupations._542100;
+    if ("542111".equals(codeString))
+      return AnzscoOccupations._542111;
+    if ("542112".equals(codeString))
+      return AnzscoOccupations._542112;
+    if ("542113".equals(codeString))
+      return AnzscoOccupations._542113;
+    if ("542114".equals(codeString))
+      return AnzscoOccupations._542114;
+    if ("550000".equals(codeString))
+      return AnzscoOccupations._550000;
+    if ("551000".equals(codeString))
+      return AnzscoOccupations._551000;
+    if ("551100".equals(codeString))
+      return AnzscoOccupations._551100;
+    if ("551111".equals(codeString))
+      return AnzscoOccupations._551111;
+    if ("551112".equals(codeString))
+      return AnzscoOccupations._551112;
+    if ("551211".equals(codeString))
+      return AnzscoOccupations._551211;
+    if ("551311".equals(codeString))
+      return AnzscoOccupations._551311;
+    if ("552000".equals(codeString))
+      return AnzscoOccupations._552000;
+    if ("552111".equals(codeString))
+      return AnzscoOccupations._552111;
+    if ("552211".equals(codeString))
+      return AnzscoOccupations._552211;
+    if ("552300".equals(codeString))
+      return AnzscoOccupations._552300;
+    if ("552311".equals(codeString))
+      return AnzscoOccupations._552311;
+    if ("552312".equals(codeString))
+      return AnzscoOccupations._552312;
+    if ("552313".equals(codeString))
+      return AnzscoOccupations._552313;
+    if ("552314".equals(codeString))
+      return AnzscoOccupations._552314;
+    if ("561000".equals(codeString))
+      return AnzscoOccupations._561000;
+    if ("561100".equals(codeString))
+      return AnzscoOccupations._561100;
+    if ("561111".equals(codeString))
+      return AnzscoOccupations._561111;
+    if ("561112".equals(codeString))
+      return AnzscoOccupations._561112;
+    if ("561113".equals(codeString))
+      return AnzscoOccupations._561113;
+    if ("561199".equals(codeString))
+      return AnzscoOccupations._561199;
+    if ("561200".equals(codeString))
+      return AnzscoOccupations._561200;
+    if ("561211".equals(codeString))
+      return AnzscoOccupations._561211;
+    if ("561212".equals(codeString))
+      return AnzscoOccupations._561212;
+    if ("561311".equals(codeString))
+      return AnzscoOccupations._561311;
+    if ("561400".equals(codeString))
+      return AnzscoOccupations._561400;
+    if ("561411".equals(codeString))
+      return AnzscoOccupations._561411;
+    if ("561412".equals(codeString))
+      return AnzscoOccupations._561412;
+    if ("561511".equals(codeString))
+      return AnzscoOccupations._561511;
+    if ("561611".equals(codeString))
+      return AnzscoOccupations._561611;
+    if ("561900".equals(codeString))
+      return AnzscoOccupations._561900;
+    if ("561911".equals(codeString))
+      return AnzscoOccupations._561911;
+    if ("561912".equals(codeString))
+      return AnzscoOccupations._561912;
+    if ("561913".equals(codeString))
+      return AnzscoOccupations._561913;
+    if ("561999".equals(codeString))
+      return AnzscoOccupations._561999;
+    if ("590000".equals(codeString))
+      return AnzscoOccupations._590000;
+    if ("591000".equals(codeString))
+      return AnzscoOccupations._591000;
+    if ("591100".equals(codeString))
+      return AnzscoOccupations._591100;
+    if ("591111".equals(codeString))
+      return AnzscoOccupations._591111;
+    if ("591112".equals(codeString))
+      return AnzscoOccupations._591112;
+    if ("591113".equals(codeString))
+      return AnzscoOccupations._591113;
+    if ("591114".equals(codeString))
+      return AnzscoOccupations._591114;
+    if ("591115".equals(codeString))
+      return AnzscoOccupations._591115;
+    if ("591116".equals(codeString))
+      return AnzscoOccupations._591116;
+    if ("591200".equals(codeString))
+      return AnzscoOccupations._591200;
+    if ("591211".equals(codeString))
+      return AnzscoOccupations._591211;
+    if ("591212".equals(codeString))
+      return AnzscoOccupations._591212;
+    if ("599000".equals(codeString))
+      return AnzscoOccupations._599000;
+    if ("599100".equals(codeString))
+      return AnzscoOccupations._599100;
+    if ("599111".equals(codeString))
+      return AnzscoOccupations._599111;
+    if ("599112".equals(codeString))
+      return AnzscoOccupations._599112;
+    if ("599200".equals(codeString))
+      return AnzscoOccupations._599200;
+    if ("599211".equals(codeString))
+      return AnzscoOccupations._599211;
+    if ("599212".equals(codeString))
+      return AnzscoOccupations._599212;
+    if ("599213".equals(codeString))
+      return AnzscoOccupations._599213;
+    if ("599214".equals(codeString))
+      return AnzscoOccupations._599214;
+    if ("599215".equals(codeString))
+      return AnzscoOccupations._599215;
+    if ("599311".equals(codeString))
+      return AnzscoOccupations._599311;
+    if ("599411".equals(codeString))
+      return AnzscoOccupations._599411;
+    if ("599500".equals(codeString))
+      return AnzscoOccupations._599500;
+    if ("599511".equals(codeString))
+      return AnzscoOccupations._599511;
+    if ("599512".equals(codeString))
+      return AnzscoOccupations._599512;
+    if ("599513".equals(codeString))
+      return AnzscoOccupations._599513;
+    if ("599514".equals(codeString))
+      return AnzscoOccupations._599514;
+    if ("599515".equals(codeString))
+      return AnzscoOccupations._599515;
+    if ("599516".equals(codeString))
+      return AnzscoOccupations._599516;
+    if ("599517".equals(codeString))
+      return AnzscoOccupations._599517;
+    if ("599518".equals(codeString))
+      return AnzscoOccupations._599518;
+    if ("599521".equals(codeString))
+      return AnzscoOccupations._599521;
+    if ("599599".equals(codeString))
+      return AnzscoOccupations._599599;
+    if ("599600".equals(codeString))
+      return AnzscoOccupations._599600;
+    if ("599611".equals(codeString))
+      return AnzscoOccupations._599611;
+    if ("599612".equals(codeString))
+      return AnzscoOccupations._599612;
+    if ("599613".equals(codeString))
+      return AnzscoOccupations._599613;
+    if ("599711".equals(codeString))
+      return AnzscoOccupations._599711;
+    if ("599900".equals(codeString))
+      return AnzscoOccupations._599900;
+    if ("599911".equals(codeString))
+      return AnzscoOccupations._599911;
+    if ("599912".equals(codeString))
+      return AnzscoOccupations._599912;
+    if ("599913".equals(codeString))
+      return AnzscoOccupations._599913;
+    if ("599914".equals(codeString))
+      return AnzscoOccupations._599914;
+    if ("599999".equals(codeString))
+      return AnzscoOccupations._599999;
+    if ("600000".equals(codeString))
+      return AnzscoOccupations._600000;
+    if ("610000".equals(codeString))
+      return AnzscoOccupations._610000;
+    if ("611000".equals(codeString))
+      return AnzscoOccupations._611000;
+    if ("611100".equals(codeString))
+      return AnzscoOccupations._611100;
+    if ("611111".equals(codeString))
+      return AnzscoOccupations._611111;
+    if ("611112".equals(codeString))
+      return AnzscoOccupations._611112;
+    if ("611211".equals(codeString))
+      return AnzscoOccupations._611211;
+    if ("611300".equals(codeString))
+      return AnzscoOccupations._611300;
+    if ("611311".equals(codeString))
+      return AnzscoOccupations._611311;
+    if ("611312".equals(codeString))
+      return AnzscoOccupations._611312;
+    if ("611313".equals(codeString))
+      return AnzscoOccupations._611313;
+    if ("611314".equals(codeString))
+      return AnzscoOccupations._611314;
+    if ("611399".equals(codeString))
+      return AnzscoOccupations._611399;
+    if ("612100".equals(codeString))
+      return AnzscoOccupations._612100;
+    if ("612111".equals(codeString))
+      return AnzscoOccupations._612111;
+    if ("612112".equals(codeString))
+      return AnzscoOccupations._612112;
+    if ("612113".equals(codeString))
+      return AnzscoOccupations._612113;
+    if ("612114".equals(codeString))
+      return AnzscoOccupations._612114;
+    if ("612115".equals(codeString))
+      return AnzscoOccupations._612115;
+    if ("621000".equals(codeString))
+      return AnzscoOccupations._621000;
+    if ("621111".equals(codeString))
+      return AnzscoOccupations._621111;
+    if ("621211".equals(codeString))
+      return AnzscoOccupations._621211;
+    if ("621300".equals(codeString))
+      return AnzscoOccupations._621300;
+    if ("621311".equals(codeString))
+      return AnzscoOccupations._621311;
+    if ("621312".equals(codeString))
+      return AnzscoOccupations._621312;
+    if ("621411".equals(codeString))
+      return AnzscoOccupations._621411;
+    if ("621511".equals(codeString))
+      return AnzscoOccupations._621511;
+    if ("621611".equals(codeString))
+      return AnzscoOccupations._621611;
+    if ("621700".equals(codeString))
+      return AnzscoOccupations._621700;
+    if ("621711".equals(codeString))
+      return AnzscoOccupations._621711;
+    if ("621712".equals(codeString))
+      return AnzscoOccupations._621712;
+    if ("621713".equals(codeString))
+      return AnzscoOccupations._621713;
+    if ("621900".equals(codeString))
+      return AnzscoOccupations._621900;
+    if ("621911".equals(codeString))
+      return AnzscoOccupations._621911;
+    if ("621912".equals(codeString))
+      return AnzscoOccupations._621912;
+    if ("621999".equals(codeString))
+      return AnzscoOccupations._621999;
+    if ("630000".equals(codeString))
+      return AnzscoOccupations._630000;
+    if ("631100".equals(codeString))
+      return AnzscoOccupations._631100;
+    if ("631111".equals(codeString))
+      return AnzscoOccupations._631111;
+    if ("631112".equals(codeString))
+      return AnzscoOccupations._631112;
+    if ("639000".equals(codeString))
+      return AnzscoOccupations._639000;
+    if ("639100".equals(codeString))
+      return AnzscoOccupations._639100;
+    if ("639111".equals(codeString))
+      return AnzscoOccupations._639111;
+    if ("639112".equals(codeString))
+      return AnzscoOccupations._639112;
+    if ("639200".equals(codeString))
+      return AnzscoOccupations._639200;
+    if ("639211".equals(codeString))
+      return AnzscoOccupations._639211;
+    if ("639212".equals(codeString))
+      return AnzscoOccupations._639212;
+    if ("639311".equals(codeString))
+      return AnzscoOccupations._639311;
+    if ("639400".equals(codeString))
+      return AnzscoOccupations._639400;
+    if ("639411".equals(codeString))
+      return AnzscoOccupations._639411;
+    if ("639412".equals(codeString))
+      return AnzscoOccupations._639412;
+    if ("639511".equals(codeString))
+      return AnzscoOccupations._639511;
+    if ("639911".equals(codeString))
+      return AnzscoOccupations._639911;
+    if ("700000".equals(codeString))
+      return AnzscoOccupations._700000;
+    if ("710000".equals(codeString))
+      return AnzscoOccupations._710000;
+    if ("711000".equals(codeString))
+      return AnzscoOccupations._711000;
+    if ("711100".equals(codeString))
+      return AnzscoOccupations._711100;
+    if ("711111".equals(codeString))
+      return AnzscoOccupations._711111;
+    if ("711112".equals(codeString))
+      return AnzscoOccupations._711112;
+    if ("711113".equals(codeString))
+      return AnzscoOccupations._711113;
+    if ("711114".equals(codeString))
+      return AnzscoOccupations._711114;
+    if ("711199".equals(codeString))
+      return AnzscoOccupations._711199;
+    if ("711211".equals(codeString))
+      return AnzscoOccupations._711211;
+    if ("711300".equals(codeString))
+      return AnzscoOccupations._711300;
+    if ("711311".equals(codeString))
+      return AnzscoOccupations._711311;
+    if ("711312".equals(codeString))
+      return AnzscoOccupations._711312;
+    if ("711411".equals(codeString))
+      return AnzscoOccupations._711411;
+    if ("711500".equals(codeString))
+      return AnzscoOccupations._711500;
+    if ("711511".equals(codeString))
+      return AnzscoOccupations._711511;
+    if ("711512".equals(codeString))
+      return AnzscoOccupations._711512;
+    if ("711513".equals(codeString))
+      return AnzscoOccupations._711513;
+    if ("711514".equals(codeString))
+      return AnzscoOccupations._711514;
+    if ("711515".equals(codeString))
+      return AnzscoOccupations._711515;
+    if ("711516".equals(codeString))
+      return AnzscoOccupations._711516;
+    if ("711599".equals(codeString))
+      return AnzscoOccupations._711599;
+    if ("711611".equals(codeString))
+      return AnzscoOccupations._711611;
+    if ("711700".equals(codeString))
+      return AnzscoOccupations._711700;
+    if ("711711".equals(codeString))
+      return AnzscoOccupations._711711;
+    if ("711712".equals(codeString))
+      return AnzscoOccupations._711712;
+    if ("711713".equals(codeString))
+      return AnzscoOccupations._711713;
+    if ("711714".equals(codeString))
+      return AnzscoOccupations._711714;
+    if ("711715".equals(codeString))
+      return AnzscoOccupations._711715;
+    if ("711716".equals(codeString))
+      return AnzscoOccupations._711716;
+    if ("711799".equals(codeString))
+      return AnzscoOccupations._711799;
+    if ("711900".equals(codeString))
+      return AnzscoOccupations._711900;
+    if ("711911".equals(codeString))
+      return AnzscoOccupations._711911;
+    if ("711912".equals(codeString))
+      return AnzscoOccupations._711912;
+    if ("711913".equals(codeString))
+      return AnzscoOccupations._711913;
+    if ("711914".equals(codeString))
+      return AnzscoOccupations._711914;
+    if ("711999".equals(codeString))
+      return AnzscoOccupations._711999;
+    if ("712000".equals(codeString))
+      return AnzscoOccupations._712000;
+    if ("712111".equals(codeString))
+      return AnzscoOccupations._712111;
+    if ("712200".equals(codeString))
+      return AnzscoOccupations._712200;
+    if ("712211".equals(codeString))
+      return AnzscoOccupations._712211;
+    if ("712212".equals(codeString))
+      return AnzscoOccupations._712212;
+    if ("712213".equals(codeString))
+      return AnzscoOccupations._712213;
+    if ("712311".equals(codeString))
+      return AnzscoOccupations._712311;
+    if ("712900".equals(codeString))
+      return AnzscoOccupations._712900;
+    if ("712911".equals(codeString))
+      return AnzscoOccupations._712911;
+    if ("712912".equals(codeString))
+      return AnzscoOccupations._712912;
+    if ("712913".equals(codeString))
+      return AnzscoOccupations._712913;
+    if ("712914".equals(codeString))
+      return AnzscoOccupations._712914;
+    if ("712915".equals(codeString))
+      return AnzscoOccupations._712915;
+    if ("712916".equals(codeString))
+      return AnzscoOccupations._712916;
+    if ("712917".equals(codeString))
+      return AnzscoOccupations._712917;
+    if ("712918".equals(codeString))
+      return AnzscoOccupations._712918;
+    if ("712921".equals(codeString))
+      return AnzscoOccupations._712921;
+    if ("712922".equals(codeString))
+      return AnzscoOccupations._712922;
+    if ("712999".equals(codeString))
+      return AnzscoOccupations._712999;
+    if ("721000".equals(codeString))
+      return AnzscoOccupations._721000;
+    if ("721100".equals(codeString))
+      return AnzscoOccupations._721100;
+    if ("721111".equals(codeString))
+      return AnzscoOccupations._721111;
+    if ("721112".equals(codeString))
+      return AnzscoOccupations._721112;
+    if ("721200".equals(codeString))
+      return AnzscoOccupations._721200;
+    if ("721211".equals(codeString))
+      return AnzscoOccupations._721211;
+    if ("721212".equals(codeString))
+      return AnzscoOccupations._721212;
+    if ("721213".equals(codeString))
+      return AnzscoOccupations._721213;
+    if ("721214".equals(codeString))
+      return AnzscoOccupations._721214;
+    if ("721215".equals(codeString))
+      return AnzscoOccupations._721215;
+    if ("721216".equals(codeString))
+      return AnzscoOccupations._721216;
+    if ("721311".equals(codeString))
+      return AnzscoOccupations._721311;
+    if ("721900".equals(codeString))
+      return AnzscoOccupations._721900;
+    if ("721911".equals(codeString))
+      return AnzscoOccupations._721911;
+    if ("721912".equals(codeString))
+      return AnzscoOccupations._721912;
+    if ("721913".equals(codeString))
+      return AnzscoOccupations._721913;
+    if ("721914".equals(codeString))
+      return AnzscoOccupations._721914;
+    if ("721915".equals(codeString))
+      return AnzscoOccupations._721915;
+    if ("721916".equals(codeString))
+      return AnzscoOccupations._721916;
+    if ("721999".equals(codeString))
+      return AnzscoOccupations._721999;
+    if ("730000".equals(codeString))
+      return AnzscoOccupations._730000;
+    if ("731000".equals(codeString))
+      return AnzscoOccupations._731000;
+    if ("731100".equals(codeString))
+      return AnzscoOccupations._731100;
+    if ("731111".equals(codeString))
+      return AnzscoOccupations._731111;
+    if ("731112".equals(codeString))
+      return AnzscoOccupations._731112;
+    if ("731199".equals(codeString))
+      return AnzscoOccupations._731199;
+    if ("731200".equals(codeString))
+      return AnzscoOccupations._731200;
+    if ("731211".equals(codeString))
+      return AnzscoOccupations._731211;
+    if ("731212".equals(codeString))
+      return AnzscoOccupations._731212;
+    if ("731213".equals(codeString))
+      return AnzscoOccupations._731213;
+    if ("731300".equals(codeString))
+      return AnzscoOccupations._731300;
+    if ("731311".equals(codeString))
+      return AnzscoOccupations._731311;
+    if ("731312".equals(codeString))
+      return AnzscoOccupations._731312;
+    if ("732111".equals(codeString))
+      return AnzscoOccupations._732111;
+    if ("733100".equals(codeString))
+      return AnzscoOccupations._733100;
+    if ("733111".equals(codeString))
+      return AnzscoOccupations._733111;
+    if ("733112".equals(codeString))
+      return AnzscoOccupations._733112;
+    if ("733113".equals(codeString))
+      return AnzscoOccupations._733113;
+    if ("733114".equals(codeString))
+      return AnzscoOccupations._733114;
+    if ("733115".equals(codeString))
+      return AnzscoOccupations._733115;
+    if ("741111".equals(codeString))
+      return AnzscoOccupations._741111;
+    if ("800000".equals(codeString))
+      return AnzscoOccupations._800000;
+    if ("811000".equals(codeString))
+      return AnzscoOccupations._811000;
+    if ("811111".equals(codeString))
+      return AnzscoOccupations._811111;
+    if ("811211".equals(codeString))
+      return AnzscoOccupations._811211;
+    if ("811311".equals(codeString))
+      return AnzscoOccupations._811311;
+    if ("811400".equals(codeString))
+      return AnzscoOccupations._811400;
+    if ("811411".equals(codeString))
+      return AnzscoOccupations._811411;
+    if ("811412".equals(codeString))
+      return AnzscoOccupations._811412;
+    if ("811500".equals(codeString))
+      return AnzscoOccupations._811500;
+    if ("811511".equals(codeString))
+      return AnzscoOccupations._811511;
+    if ("811512".equals(codeString))
+      return AnzscoOccupations._811512;
+    if ("811513".equals(codeString))
+      return AnzscoOccupations._811513;
+    if ("811600".equals(codeString))
+      return AnzscoOccupations._811600;
+    if ("811611".equals(codeString))
+      return AnzscoOccupations._811611;
+    if ("811612".equals(codeString))
+      return AnzscoOccupations._811612;
+    if ("811699".equals(codeString))
+      return AnzscoOccupations._811699;
+    if ("821000".equals(codeString))
+      return AnzscoOccupations._821000;
+    if ("821100".equals(codeString))
+      return AnzscoOccupations._821100;
+    if ("821111".equals(codeString))
+      return AnzscoOccupations._821111;
+    if ("821112".equals(codeString))
+      return AnzscoOccupations._821112;
+    if ("821113".equals(codeString))
+      return AnzscoOccupations._821113;
+    if ("821114".equals(codeString))
+      return AnzscoOccupations._821114;
+    if ("821211".equals(codeString))
+      return AnzscoOccupations._821211;
+    if ("821311".equals(codeString))
+      return AnzscoOccupations._821311;
+    if ("821400".equals(codeString))
+      return AnzscoOccupations._821400;
+    if ("821411".equals(codeString))
+      return AnzscoOccupations._821411;
+    if ("821412".equals(codeString))
+      return AnzscoOccupations._821412;
+    if ("821511".equals(codeString))
+      return AnzscoOccupations._821511;
+    if ("821611".equals(codeString))
+      return AnzscoOccupations._821611;
+    if ("821700".equals(codeString))
+      return AnzscoOccupations._821700;
+    if ("821711".equals(codeString))
+      return AnzscoOccupations._821711;
+    if ("821712".equals(codeString))
+      return AnzscoOccupations._821712;
+    if ("821713".equals(codeString))
+      return AnzscoOccupations._821713;
+    if ("821714".equals(codeString))
+      return AnzscoOccupations._821714;
+    if ("821900".equals(codeString))
+      return AnzscoOccupations._821900;
+    if ("821911".equals(codeString))
+      return AnzscoOccupations._821911;
+    if ("821912".equals(codeString))
+      return AnzscoOccupations._821912;
+    if ("821913".equals(codeString))
+      return AnzscoOccupations._821913;
+    if ("821914".equals(codeString))
+      return AnzscoOccupations._821914;
+    if ("821915".equals(codeString))
+      return AnzscoOccupations._821915;
+    if ("830000".equals(codeString))
+      return AnzscoOccupations._830000;
+    if ("831000".equals(codeString))
+      return AnzscoOccupations._831000;
+    if ("831100".equals(codeString))
+      return AnzscoOccupations._831100;
+    if ("831111".equals(codeString))
+      return AnzscoOccupations._831111;
+    if ("831112".equals(codeString))
+      return AnzscoOccupations._831112;
+    if ("831113".equals(codeString))
+      return AnzscoOccupations._831113;
+    if ("831114".equals(codeString))
+      return AnzscoOccupations._831114;
+    if ("831115".equals(codeString))
+      return AnzscoOccupations._831115;
+    if ("831116".equals(codeString))
+      return AnzscoOccupations._831116;
+    if ("831117".equals(codeString))
+      return AnzscoOccupations._831117;
+    if ("831118".equals(codeString))
+      return AnzscoOccupations._831118;
+    if ("831199".equals(codeString))
+      return AnzscoOccupations._831199;
+    if ("831200".equals(codeString))
+      return AnzscoOccupations._831200;
+    if ("831211".equals(codeString))
+      return AnzscoOccupations._831211;
+    if ("831212".equals(codeString))
+      return AnzscoOccupations._831212;
+    if ("831300".equals(codeString))
+      return AnzscoOccupations._831300;
+    if ("831311".equals(codeString))
+      return AnzscoOccupations._831311;
+    if ("831312".equals(codeString))
+      return AnzscoOccupations._831312;
+    if ("831313".equals(codeString))
+      return AnzscoOccupations._831313;
+    if ("832000".equals(codeString))
+      return AnzscoOccupations._832000;
+    if ("832100".equals(codeString))
+      return AnzscoOccupations._832100;
+    if ("832111".equals(codeString))
+      return AnzscoOccupations._832111;
+    if ("832112".equals(codeString))
+      return AnzscoOccupations._832112;
+    if ("832113".equals(codeString))
+      return AnzscoOccupations._832113;
+    if ("832114".equals(codeString))
+      return AnzscoOccupations._832114;
+    if ("832115".equals(codeString))
+      return AnzscoOccupations._832115;
+    if ("832199".equals(codeString))
+      return AnzscoOccupations._832199;
+    if ("832211".equals(codeString))
+      return AnzscoOccupations._832211;
+    if ("839000".equals(codeString))
+      return AnzscoOccupations._839000;
+    if ("839111".equals(codeString))
+      return AnzscoOccupations._839111;
+    if ("839200".equals(codeString))
+      return AnzscoOccupations._839200;
+    if ("839211".equals(codeString))
+      return AnzscoOccupations._839211;
+    if ("839212".equals(codeString))
+      return AnzscoOccupations._839212;
+    if ("839300".equals(codeString))
+      return AnzscoOccupations._839300;
+    if ("839311".equals(codeString))
+      return AnzscoOccupations._839311;
+    if ("839312".equals(codeString))
+      return AnzscoOccupations._839312;
+    if ("839313".equals(codeString))
+      return AnzscoOccupations._839313;
+    if ("839400".equals(codeString))
+      return AnzscoOccupations._839400;
+    if ("839411".equals(codeString))
+      return AnzscoOccupations._839411;
+    if ("839412".equals(codeString))
+      return AnzscoOccupations._839412;
+    if ("839413".equals(codeString))
+      return AnzscoOccupations._839413;
+    if ("839900".equals(codeString))
+      return AnzscoOccupations._839900;
+    if ("839911".equals(codeString))
+      return AnzscoOccupations._839911;
+    if ("839912".equals(codeString))
+      return AnzscoOccupations._839912;
+    if ("839913".equals(codeString))
+      return AnzscoOccupations._839913;
+    if ("839914".equals(codeString))
+      return AnzscoOccupations._839914;
+    if ("839915".equals(codeString))
+      return AnzscoOccupations._839915;
+    if ("839916".equals(codeString))
+      return AnzscoOccupations._839916;
+    if ("839917".equals(codeString))
+      return AnzscoOccupations._839917;
+    if ("839999".equals(codeString))
+      return AnzscoOccupations._839999;
+    if ("841000".equals(codeString))
+      return AnzscoOccupations._841000;
+    if ("841111".equals(codeString))
+      return AnzscoOccupations._841111;
+    if ("841200".equals(codeString))
+      return AnzscoOccupations._841200;
+    if ("841211".equals(codeString))
+      return AnzscoOccupations._841211;
+    if ("841212".equals(codeString))
+      return AnzscoOccupations._841212;
+    if ("841213".equals(codeString))
+      return AnzscoOccupations._841213;
+    if ("841214".equals(codeString))
+      return AnzscoOccupations._841214;
+    if ("841215".equals(codeString))
+      return AnzscoOccupations._841215;
+    if ("841216".equals(codeString))
+      return AnzscoOccupations._841216;
+    if ("841299".equals(codeString))
+      return AnzscoOccupations._841299;
+    if ("841300".equals(codeString))
+      return AnzscoOccupations._841300;
+    if ("841311".equals(codeString))
+      return AnzscoOccupations._841311;
+    if ("841312".equals(codeString))
+      return AnzscoOccupations._841312;
+    if ("841313".equals(codeString))
+      return AnzscoOccupations._841313;
+    if ("841400".equals(codeString))
+      return AnzscoOccupations._841400;
+    if ("841411".equals(codeString))
+      return AnzscoOccupations._841411;
+    if ("841412".equals(codeString))
+      return AnzscoOccupations._841412;
+    if ("841500".equals(codeString))
+      return AnzscoOccupations._841500;
+    if ("841511".equals(codeString))
+      return AnzscoOccupations._841511;
+    if ("841512".equals(codeString))
+      return AnzscoOccupations._841512;
+    if ("841513".equals(codeString))
+      return AnzscoOccupations._841513;
+    if ("841514".equals(codeString))
+      return AnzscoOccupations._841514;
+    if ("841515".equals(codeString))
+      return AnzscoOccupations._841515;
+    if ("841516".equals(codeString))
+      return AnzscoOccupations._841516;
+    if ("841517".equals(codeString))
+      return AnzscoOccupations._841517;
+    if ("841599".equals(codeString))
+      return AnzscoOccupations._841599;
+    if ("841611".equals(codeString))
+      return AnzscoOccupations._841611;
+    if ("841900".equals(codeString))
+      return AnzscoOccupations._841900;
+    if ("841911".equals(codeString))
+      return AnzscoOccupations._841911;
+    if ("841912".equals(codeString))
+      return AnzscoOccupations._841912;
+    if ("841999".equals(codeString))
+      return AnzscoOccupations._841999;
+    if ("851000".equals(codeString))
+      return AnzscoOccupations._851000;
+    if ("851111".equals(codeString))
+      return AnzscoOccupations._851111;
+    if ("851200".equals(codeString))
+      return AnzscoOccupations._851200;
+    if ("851211".equals(codeString))
+      return AnzscoOccupations._851211;
+    if ("851299".equals(codeString))
+      return AnzscoOccupations._851299;
+    if ("851311".equals(codeString))
+      return AnzscoOccupations._851311;
+    if ("890000".equals(codeString))
+      return AnzscoOccupations._890000;
+    if ("891000".equals(codeString))
+      return AnzscoOccupations._891000;
+    if ("891100".equals(codeString))
+      return AnzscoOccupations._891100;
+    if ("891111".equals(codeString))
+      return AnzscoOccupations._891111;
+    if ("891112".equals(codeString))
+      return AnzscoOccupations._891112;
+    if ("891113".equals(codeString))
+      return AnzscoOccupations._891113;
+    if ("891211".equals(codeString))
+      return AnzscoOccupations._891211;
+    if ("899000".equals(codeString))
+      return AnzscoOccupations._899000;
+    if ("899111".equals(codeString))
+      return AnzscoOccupations._899111;
+    if ("899200".equals(codeString))
+      return AnzscoOccupations._899200;
+    if ("899211".equals(codeString))
+      return AnzscoOccupations._899211;
+    if ("899212".equals(codeString))
+      return AnzscoOccupations._899212;
+    if ("899311".equals(codeString))
+      return AnzscoOccupations._899311;
+    if ("899400".equals(codeString))
+      return AnzscoOccupations._899400;
+    if ("899411".equals(codeString))
+      return AnzscoOccupations._899411;
+    if ("899412".equals(codeString))
+      return AnzscoOccupations._899412;
+    if ("899413".equals(codeString))
+      return AnzscoOccupations._899413;
+    if ("899414".equals(codeString))
+      return AnzscoOccupations._899414;
+    if ("899415".equals(codeString))
+      return AnzscoOccupations._899415;
+    if ("899500".equals(codeString))
+      return AnzscoOccupations._899500;
+    if ("899511".equals(codeString))
+      return AnzscoOccupations._899511;
+    if ("899512".equals(codeString))
+      return AnzscoOccupations._899512;
+    if ("899611".equals(codeString))
+      return AnzscoOccupations._899611;
+    if ("899711".equals(codeString))
+      return AnzscoOccupations._899711;
+    if ("899900".equals(codeString))
+      return AnzscoOccupations._899900;
+    if ("899911".equals(codeString))
+      return AnzscoOccupations._899911;
+    if ("899912".equals(codeString))
+      return AnzscoOccupations._899912;
+    if ("899913".equals(codeString))
+      return AnzscoOccupations._899913;
+    if ("899914".equals(codeString))
+      return AnzscoOccupations._899914;
+    if ("899915".equals(codeString))
+      return AnzscoOccupations._899915;
+    if ("899916".equals(codeString))
+      return AnzscoOccupations._899916;
+    if ("899917".equals(codeString))
+      return AnzscoOccupations._899917;
+    if ("899918".equals(codeString))
+      return AnzscoOccupations._899918;
+    if ("899921".equals(codeString))
+      return AnzscoOccupations._899921;
+    if ("899922".equals(codeString))
+      return AnzscoOccupations._899922;
+    if ("899999".equals(codeString))
+      return AnzscoOccupations._899999;
+    throw new IllegalArgumentException("Unknown AnzscoOccupations code '"+codeString+"'");
+  }
+
+  public String toCode(AnzscoOccupations code) {
+    if (code == AnzscoOccupations._100000)
+      return "100000";
+    if (code == AnzscoOccupations._111000)
+      return "111000";
+    if (code == AnzscoOccupations._111111)
+      return "111111";
+    if (code == AnzscoOccupations._111200)
+      return "111200";
+    if (code == AnzscoOccupations._111211)
+      return "111211";
+    if (code == AnzscoOccupations._111212)
+      return "111212";
+    if (code == AnzscoOccupations._111300)
+      return "111300";
+    if (code == AnzscoOccupations._111311)
+      return "111311";
+    if (code == AnzscoOccupations._111312)
+      return "111312";
+    if (code == AnzscoOccupations._111399)
+      return "111399";
+    if (code == AnzscoOccupations._121000)
+      return "121000";
+    if (code == AnzscoOccupations._121111)
+      return "121111";
+    if (code == AnzscoOccupations._121200)
+      return "121200";
+    if (code == AnzscoOccupations._121211)
+      return "121211";
+    if (code == AnzscoOccupations._121212)
+      return "121212";
+    if (code == AnzscoOccupations._121213)
+      return "121213";
+    if (code == AnzscoOccupations._121214)
+      return "121214";
+    if (code == AnzscoOccupations._121215)
+      return "121215";
+    if (code == AnzscoOccupations._121216)
+      return "121216";
+    if (code == AnzscoOccupations._121217)
+      return "121217";
+    if (code == AnzscoOccupations._121218)
+      return "121218";
+    if (code == AnzscoOccupations._121221)
+      return "121221";
+    if (code == AnzscoOccupations._121299)
+      return "121299";
+    if (code == AnzscoOccupations._121300)
+      return "121300";
+    if (code == AnzscoOccupations._121311)
+      return "121311";
+    if (code == AnzscoOccupations._121312)
+      return "121312";
+    if (code == AnzscoOccupations._121313)
+      return "121313";
+    if (code == AnzscoOccupations._121314)
+      return "121314";
+    if (code == AnzscoOccupations._121315)
+      return "121315";
+    if (code == AnzscoOccupations._121316)
+      return "121316";
+    if (code == AnzscoOccupations._121317)
+      return "121317";
+    if (code == AnzscoOccupations._121318)
+      return "121318";
+    if (code == AnzscoOccupations._121321)
+      return "121321";
+    if (code == AnzscoOccupations._121322)
+      return "121322";
+    if (code == AnzscoOccupations._121399)
+      return "121399";
+    if (code == AnzscoOccupations._121411)
+      return "121411";
+    if (code == AnzscoOccupations._130000)
+      return "130000";
+    if (code == AnzscoOccupations._131100)
+      return "131100";
+    if (code == AnzscoOccupations._131111)
+      return "131111";
+    if (code == AnzscoOccupations._131112)
+      return "131112";
+    if (code == AnzscoOccupations._132000)
+      return "132000";
+    if (code == AnzscoOccupations._132111)
+      return "132111";
+    if (code == AnzscoOccupations._132211)
+      return "132211";
+    if (code == AnzscoOccupations._132311)
+      return "132311";
+    if (code == AnzscoOccupations._132411)
+      return "132411";
+    if (code == AnzscoOccupations._132511)
+      return "132511";
+    if (code == AnzscoOccupations._133000)
+      return "133000";
+    if (code == AnzscoOccupations._133100)
+      return "133100";
+    if (code == AnzscoOccupations._133111)
+      return "133111";
+    if (code == AnzscoOccupations._133112)
+      return "133112";
+    if (code == AnzscoOccupations._133211)
+      return "133211";
+    if (code == AnzscoOccupations._133300)
+      return "133300";
+    if (code == AnzscoOccupations._133311)
+      return "133311";
+    if (code == AnzscoOccupations._133312)
+      return "133312";
+    if (code == AnzscoOccupations._133411)
+      return "133411";
+    if (code == AnzscoOccupations._133500)
+      return "133500";
+    if (code == AnzscoOccupations._133511)
+      return "133511";
+    if (code == AnzscoOccupations._133512)
+      return "133512";
+    if (code == AnzscoOccupations._133513)
+      return "133513";
+    if (code == AnzscoOccupations._133611)
+      return "133611";
+    if (code == AnzscoOccupations._134000)
+      return "134000";
+    if (code == AnzscoOccupations._134111)
+      return "134111";
+    if (code == AnzscoOccupations._134200)
+      return "134200";
+    if (code == AnzscoOccupations._134211)
+      return "134211";
+    if (code == AnzscoOccupations._134212)
+      return "134212";
+    if (code == AnzscoOccupations._134213)
+      return "134213";
+    if (code == AnzscoOccupations._134214)
+      return "134214";
+    if (code == AnzscoOccupations._134299)
+      return "134299";
+    if (code == AnzscoOccupations._134311)
+      return "134311";
+    if (code == AnzscoOccupations._134400)
+      return "134400";
+    if (code == AnzscoOccupations._134411)
+      return "134411";
+    if (code == AnzscoOccupations._134412)
+      return "134412";
+    if (code == AnzscoOccupations._134499)
+      return "134499";
+    if (code == AnzscoOccupations._135100)
+      return "135100";
+    if (code == AnzscoOccupations._135111)
+      return "135111";
+    if (code == AnzscoOccupations._135112)
+      return "135112";
+    if (code == AnzscoOccupations._135199)
+      return "135199";
+    if (code == AnzscoOccupations._139000)
+      return "139000";
+    if (code == AnzscoOccupations._139100)
+      return "139100";
+    if (code == AnzscoOccupations._139111)
+      return "139111";
+    if (code == AnzscoOccupations._139112)
+      return "139112";
+    if (code == AnzscoOccupations._139113)
+      return "139113";
+    if (code == AnzscoOccupations._139211)
+      return "139211";
+    if (code == AnzscoOccupations._139900)
+      return "139900";
+    if (code == AnzscoOccupations._139911)
+      return "139911";
+    if (code == AnzscoOccupations._139912)
+      return "139912";
+    if (code == AnzscoOccupations._139913)
+      return "139913";
+    if (code == AnzscoOccupations._139914)
+      return "139914";
+    if (code == AnzscoOccupations._139915)
+      return "139915";
+    if (code == AnzscoOccupations._139999)
+      return "139999";
+    if (code == AnzscoOccupations._140000)
+      return "140000";
+    if (code == AnzscoOccupations._141000)
+      return "141000";
+    if (code == AnzscoOccupations._141111)
+      return "141111";
+    if (code == AnzscoOccupations._141211)
+      return "141211";
+    if (code == AnzscoOccupations._141311)
+      return "141311";
+    if (code == AnzscoOccupations._141411)
+      return "141411";
+    if (code == AnzscoOccupations._141900)
+      return "141900";
+    if (code == AnzscoOccupations._141911)
+      return "141911";
+    if (code == AnzscoOccupations._141999)
+      return "141999";
+    if (code == AnzscoOccupations._142100)
+      return "142100";
+    if (code == AnzscoOccupations._142111)
+      return "142111";
+    if (code == AnzscoOccupations._142112)
+      return "142112";
+    if (code == AnzscoOccupations._142113)
+      return "142113";
+    if (code == AnzscoOccupations._142114)
+      return "142114";
+    if (code == AnzscoOccupations._142115)
+      return "142115";
+    if (code == AnzscoOccupations._142116)
+      return "142116";
+    if (code == AnzscoOccupations._149000)
+      return "149000";
+    if (code == AnzscoOccupations._149100)
+      return "149100";
+    if (code == AnzscoOccupations._149111)
+      return "149111";
+    if (code == AnzscoOccupations._149112)
+      return "149112";
+    if (code == AnzscoOccupations._149113)
+      return "149113";
+    if (code == AnzscoOccupations._149200)
+      return "149200";
+    if (code == AnzscoOccupations._149211)
+      return "149211";
+    if (code == AnzscoOccupations._149212)
+      return "149212";
+    if (code == AnzscoOccupations._149311)
+      return "149311";
+    if (code == AnzscoOccupations._149400)
+      return "149400";
+    if (code == AnzscoOccupations._149411)
+      return "149411";
+    if (code == AnzscoOccupations._149412)
+      return "149412";
+    if (code == AnzscoOccupations._149413)
+      return "149413";
+    if (code == AnzscoOccupations._149900)
+      return "149900";
+    if (code == AnzscoOccupations._149911)
+      return "149911";
+    if (code == AnzscoOccupations._149912)
+      return "149912";
+    if (code == AnzscoOccupations._149913)
+      return "149913";
+    if (code == AnzscoOccupations._149914)
+      return "149914";
+    if (code == AnzscoOccupations._149999)
+      return "149999";
+    if (code == AnzscoOccupations._200000)
+      return "200000";
+    if (code == AnzscoOccupations._210000)
+      return "210000";
+    if (code == AnzscoOccupations._211000)
+      return "211000";
+    if (code == AnzscoOccupations._211100)
+      return "211100";
+    if (code == AnzscoOccupations._211111)
+      return "211111";
+    if (code == AnzscoOccupations._211112)
+      return "211112";
+    if (code == AnzscoOccupations._211113)
+      return "211113";
+    if (code == AnzscoOccupations._211199)
+      return "211199";
+    if (code == AnzscoOccupations._211200)
+      return "211200";
+    if (code == AnzscoOccupations._211211)
+      return "211211";
+    if (code == AnzscoOccupations._211212)
+      return "211212";
+    if (code == AnzscoOccupations._211213)
+      return "211213";
+    if (code == AnzscoOccupations._211214)
+      return "211214";
+    if (code == AnzscoOccupations._211299)
+      return "211299";
+    if (code == AnzscoOccupations._211311)
+      return "211311";
+    if (code == AnzscoOccupations._211400)
+      return "211400";
+    if (code == AnzscoOccupations._211411)
+      return "211411";
+    if (code == AnzscoOccupations._211412)
+      return "211412";
+    if (code == AnzscoOccupations._211413)
+      return "211413";
+    if (code == AnzscoOccupations._211499)
+      return "211499";
+    if (code == AnzscoOccupations._212000)
+      return "212000";
+    if (code == AnzscoOccupations._212100)
+      return "212100";
+    if (code == AnzscoOccupations._212111)
+      return "212111";
+    if (code == AnzscoOccupations._212112)
+      return "212112";
+    if (code == AnzscoOccupations._212113)
+      return "212113";
+    if (code == AnzscoOccupations._212114)
+      return "212114";
+    if (code == AnzscoOccupations._212200)
+      return "212200";
+    if (code == AnzscoOccupations._212211)
+      return "212211";
+    if (code == AnzscoOccupations._212212)
+      return "212212";
+    if (code == AnzscoOccupations._212300)
+      return "212300";
+    if (code == AnzscoOccupations._212311)
+      return "212311";
+    if (code == AnzscoOccupations._212312)
+      return "212312";
+    if (code == AnzscoOccupations._212313)
+      return "212313";
+    if (code == AnzscoOccupations._212314)
+      return "212314";
+    if (code == AnzscoOccupations._212315)
+      return "212315";
+    if (code == AnzscoOccupations._212316)
+      return "212316";
+    if (code == AnzscoOccupations._212317)
+      return "212317";
+    if (code == AnzscoOccupations._212318)
+      return "212318";
+    if (code == AnzscoOccupations._212399)
+      return "212399";
+    if (code == AnzscoOccupations._212400)
+      return "212400";
+    if (code == AnzscoOccupations._212411)
+      return "212411";
+    if (code == AnzscoOccupations._212412)
+      return "212412";
+    if (code == AnzscoOccupations._212413)
+      return "212413";
+    if (code == AnzscoOccupations._212414)
+      return "212414";
+    if (code == AnzscoOccupations._212415)
+      return "212415";
+    if (code == AnzscoOccupations._212416)
+      return "212416";
+    if (code == AnzscoOccupations._212499)
+      return "212499";
+    if (code == AnzscoOccupations._220000)
+      return "220000";
+    if (code == AnzscoOccupations._221000)
+      return "221000";
+    if (code == AnzscoOccupations._221100)
+      return "221100";
+    if (code == AnzscoOccupations._221111)
+      return "221111";
+    if (code == AnzscoOccupations._221112)
+      return "221112";
+    if (code == AnzscoOccupations._221113)
+      return "221113";
+    if (code == AnzscoOccupations._221200)
+      return "221200";
+    if (code == AnzscoOccupations._221211)
+      return "221211";
+    if (code == AnzscoOccupations._221212)
+      return "221212";
+    if (code == AnzscoOccupations._221213)
+      return "221213";
+    if (code == AnzscoOccupations._221214)
+      return "221214";
+    if (code == AnzscoOccupations._222000)
+      return "222000";
+    if (code == AnzscoOccupations._222100)
+      return "222100";
+    if (code == AnzscoOccupations._222111)
+      return "222111";
+    if (code == AnzscoOccupations._222112)
+      return "222112";
+    if (code == AnzscoOccupations._222113)
+      return "222113";
+    if (code == AnzscoOccupations._222199)
+      return "222199";
+    if (code == AnzscoOccupations._222200)
+      return "222200";
+    if (code == AnzscoOccupations._222211)
+      return "222211";
+    if (code == AnzscoOccupations._222212)
+      return "222212";
+    if (code == AnzscoOccupations._222213)
+      return "222213";
+    if (code == AnzscoOccupations._222299)
+      return "222299";
+    if (code == AnzscoOccupations._222300)
+      return "222300";
+    if (code == AnzscoOccupations._222311)
+      return "222311";
+    if (code == AnzscoOccupations._222312)
+      return "222312";
+    if (code == AnzscoOccupations._223000)
+      return "223000";
+    if (code == AnzscoOccupations._223100)
+      return "223100";
+    if (code == AnzscoOccupations._223111)
+      return "223111";
+    if (code == AnzscoOccupations._223112)
+      return "223112";
+    if (code == AnzscoOccupations._223113)
+      return "223113";
+    if (code == AnzscoOccupations._223211)
+      return "223211";
+    if (code == AnzscoOccupations._223311)
+      return "223311";
+    if (code == AnzscoOccupations._224000)
+      return "224000";
+    if (code == AnzscoOccupations._224100)
+      return "224100";
+    if (code == AnzscoOccupations._224111)
+      return "224111";
+    if (code == AnzscoOccupations._224112)
+      return "224112";
+    if (code == AnzscoOccupations._224113)
+      return "224113";
+    if (code == AnzscoOccupations._224200)
+      return "224200";
+    if (code == AnzscoOccupations._224211)
+      return "224211";
+    if (code == AnzscoOccupations._224212)
+      return "224212";
+    if (code == AnzscoOccupations._224213)
+      return "224213";
+    if (code == AnzscoOccupations._224214)
+      return "224214";
+    if (code == AnzscoOccupations._224311)
+      return "224311";
+    if (code == AnzscoOccupations._224400)
+      return "224400";
+    if (code == AnzscoOccupations._224411)
+      return "224411";
+    if (code == AnzscoOccupations._224412)
+      return "224412";
+    if (code == AnzscoOccupations._224500)
+      return "224500";
+    if (code == AnzscoOccupations._224511)
+      return "224511";
+    if (code == AnzscoOccupations._224512)
+      return "224512";
+    if (code == AnzscoOccupations._224611)
+      return "224611";
+    if (code == AnzscoOccupations._224700)
+      return "224700";
+    if (code == AnzscoOccupations._224711)
+      return "224711";
+    if (code == AnzscoOccupations._224712)
+      return "224712";
+    if (code == AnzscoOccupations._224900)
+      return "224900";
+    if (code == AnzscoOccupations._224911)
+      return "224911";
+    if (code == AnzscoOccupations._224912)
+      return "224912";
+    if (code == AnzscoOccupations._224913)
+      return "224913";
+    if (code == AnzscoOccupations._224914)
+      return "224914";
+    if (code == AnzscoOccupations._224999)
+      return "224999";
+    if (code == AnzscoOccupations._225000)
+      return "225000";
+    if (code == AnzscoOccupations._225100)
+      return "225100";
+    if (code == AnzscoOccupations._225111)
+      return "225111";
+    if (code == AnzscoOccupations._225112)
+      return "225112";
+    if (code == AnzscoOccupations._225113)
+      return "225113";
+    if (code == AnzscoOccupations._225200)
+      return "225200";
+    if (code == AnzscoOccupations._225211)
+      return "225211";
+    if (code == AnzscoOccupations._225212)
+      return "225212";
+    if (code == AnzscoOccupations._225213)
+      return "225213";
+    if (code == AnzscoOccupations._225311)
+      return "225311";
+    if (code == AnzscoOccupations._225400)
+      return "225400";
+    if (code == AnzscoOccupations._225411)
+      return "225411";
+    if (code == AnzscoOccupations._225412)
+      return "225412";
+    if (code == AnzscoOccupations._225499)
+      return "225499";
+    if (code == AnzscoOccupations._230000)
+      return "230000";
+    if (code == AnzscoOccupations._231000)
+      return "231000";
+    if (code == AnzscoOccupations._231100)
+      return "231100";
+    if (code == AnzscoOccupations._231111)
+      return "231111";
+    if (code == AnzscoOccupations._231112)
+      return "231112";
+    if (code == AnzscoOccupations._231113)
+      return "231113";
+    if (code == AnzscoOccupations._231114)
+      return "231114";
+    if (code == AnzscoOccupations._231199)
+      return "231199";
+    if (code == AnzscoOccupations._231200)
+      return "231200";
+    if (code == AnzscoOccupations._231211)
+      return "231211";
+    if (code == AnzscoOccupations._231212)
+      return "231212";
+    if (code == AnzscoOccupations._231213)
+      return "231213";
+    if (code == AnzscoOccupations._231214)
+      return "231214";
+    if (code == AnzscoOccupations._231215)
+      return "231215";
+    if (code == AnzscoOccupations._231299)
+      return "231299";
+    if (code == AnzscoOccupations._232000)
+      return "232000";
+    if (code == AnzscoOccupations._232100)
+      return "232100";
+    if (code == AnzscoOccupations._232111)
+      return "232111";
+    if (code == AnzscoOccupations._232112)
+      return "232112";
+    if (code == AnzscoOccupations._232200)
+      return "232200";
+    if (code == AnzscoOccupations._232211)
+      return "232211";
+    if (code == AnzscoOccupations._232212)
+      return "232212";
+    if (code == AnzscoOccupations._232300)
+      return "232300";
+    if (code == AnzscoOccupations._232311)
+      return "232311";
+    if (code == AnzscoOccupations._232312)
+      return "232312";
+    if (code == AnzscoOccupations._232313)
+      return "232313";
+    if (code == AnzscoOccupations._232400)
+      return "232400";
+    if (code == AnzscoOccupations._232411)
+      return "232411";
+    if (code == AnzscoOccupations._232412)
+      return "232412";
+    if (code == AnzscoOccupations._232413)
+      return "232413";
+    if (code == AnzscoOccupations._232414)
+      return "232414";
+    if (code == AnzscoOccupations._232511)
+      return "232511";
+    if (code == AnzscoOccupations._232611)
+      return "232611";
+    if (code == AnzscoOccupations._233000)
+      return "233000";
+    if (code == AnzscoOccupations._233100)
+      return "233100";
+    if (code == AnzscoOccupations._233111)
+      return "233111";
+    if (code == AnzscoOccupations._233112)
+      return "233112";
+    if (code == AnzscoOccupations._233200)
+      return "233200";
+    if (code == AnzscoOccupations._233211)
+      return "233211";
+    if (code == AnzscoOccupations._233212)
+      return "233212";
+    if (code == AnzscoOccupations._233213)
+      return "233213";
+    if (code == AnzscoOccupations._233214)
+      return "233214";
+    if (code == AnzscoOccupations._233215)
+      return "233215";
+    if (code == AnzscoOccupations._233311)
+      return "233311";
+    if (code == AnzscoOccupations._233411)
+      return "233411";
+    if (code == AnzscoOccupations._233500)
+      return "233500";
+    if (code == AnzscoOccupations._233511)
+      return "233511";
+    if (code == AnzscoOccupations._233512)
+      return "233512";
+    if (code == AnzscoOccupations._233513)
+      return "233513";
+    if (code == AnzscoOccupations._233600)
+      return "233600";
+    if (code == AnzscoOccupations._233611)
+      return "233611";
+    if (code == AnzscoOccupations._233612)
+      return "233612";
+    if (code == AnzscoOccupations._233900)
+      return "233900";
+    if (code == AnzscoOccupations._233911)
+      return "233911";
+    if (code == AnzscoOccupations._233912)
+      return "233912";
+    if (code == AnzscoOccupations._233913)
+      return "233913";
+    if (code == AnzscoOccupations._233914)
+      return "233914";
+    if (code == AnzscoOccupations._233915)
+      return "233915";
+    if (code == AnzscoOccupations._233916)
+      return "233916";
+    if (code == AnzscoOccupations._233999)
+      return "233999";
+    if (code == AnzscoOccupations._234000)
+      return "234000";
+    if (code == AnzscoOccupations._234100)
+      return "234100";
+    if (code == AnzscoOccupations._234111)
+      return "234111";
+    if (code == AnzscoOccupations._234112)
+      return "234112";
+    if (code == AnzscoOccupations._234113)
+      return "234113";
+    if (code == AnzscoOccupations._234200)
+      return "234200";
+    if (code == AnzscoOccupations._234211)
+      return "234211";
+    if (code == AnzscoOccupations._234212)
+      return "234212";
+    if (code == AnzscoOccupations._234213)
+      return "234213";
+    if (code == AnzscoOccupations._234300)
+      return "234300";
+    if (code == AnzscoOccupations._234311)
+      return "234311";
+    if (code == AnzscoOccupations._234312)
+      return "234312";
+    if (code == AnzscoOccupations._234313)
+      return "234313";
+    if (code == AnzscoOccupations._234314)
+      return "234314";
+    if (code == AnzscoOccupations._234399)
+      return "234399";
+    if (code == AnzscoOccupations._234400)
+      return "234400";
+    if (code == AnzscoOccupations._234411)
+      return "234411";
+    if (code == AnzscoOccupations._234412)
+      return "234412";
+    if (code == AnzscoOccupations._234500)
+      return "234500";
+    if (code == AnzscoOccupations._234511)
+      return "234511";
+    if (code == AnzscoOccupations._234512)
+      return "234512";
+    if (code == AnzscoOccupations._234513)
+      return "234513";
+    if (code == AnzscoOccupations._234514)
+      return "234514";
+    if (code == AnzscoOccupations._234515)
+      return "234515";
+    if (code == AnzscoOccupations._234516)
+      return "234516";
+    if (code == AnzscoOccupations._234517)
+      return "234517";
+    if (code == AnzscoOccupations._234518)
+      return "234518";
+    if (code == AnzscoOccupations._234599)
+      return "234599";
+    if (code == AnzscoOccupations._234611)
+      return "234611";
+    if (code == AnzscoOccupations._234711)
+      return "234711";
+    if (code == AnzscoOccupations._234900)
+      return "234900";
+    if (code == AnzscoOccupations._234911)
+      return "234911";
+    if (code == AnzscoOccupations._234912)
+      return "234912";
+    if (code == AnzscoOccupations._234913)
+      return "234913";
+    if (code == AnzscoOccupations._234914)
+      return "234914";
+    if (code == AnzscoOccupations._234999)
+      return "234999";
+    if (code == AnzscoOccupations._240000)
+      return "240000";
+    if (code == AnzscoOccupations._241000)
+      return "241000";
+    if (code == AnzscoOccupations._241111)
+      return "241111";
+    if (code == AnzscoOccupations._241213)
+      return "241213";
+    if (code == AnzscoOccupations._241311)
+      return "241311";
+    if (code == AnzscoOccupations._241411)
+      return "241411";
+    if (code == AnzscoOccupations._241500)
+      return "241500";
+    if (code == AnzscoOccupations._241511)
+      return "241511";
+    if (code == AnzscoOccupations._241512)
+      return "241512";
+    if (code == AnzscoOccupations._241513)
+      return "241513";
+    if (code == AnzscoOccupations._241599)
+      return "241599";
+    if (code == AnzscoOccupations._242000)
+      return "242000";
+    if (code == AnzscoOccupations._242100)
+      return "242100";
+    if (code == AnzscoOccupations._242111)
+      return "242111";
+    if (code == AnzscoOccupations._242112)
+      return "242112";
+    if (code == AnzscoOccupations._242211)
+      return "242211";
+    if (code == AnzscoOccupations._249000)
+      return "249000";
+    if (code == AnzscoOccupations._249100)
+      return "249100";
+    if (code == AnzscoOccupations._249111)
+      return "249111";
+    if (code == AnzscoOccupations._249112)
+      return "249112";
+    if (code == AnzscoOccupations._249200)
+      return "249200";
+    if (code == AnzscoOccupations._249211)
+      return "249211";
+    if (code == AnzscoOccupations._249212)
+      return "249212";
+    if (code == AnzscoOccupations._249213)
+      return "249213";
+    if (code == AnzscoOccupations._249214)
+      return "249214";
+    if (code == AnzscoOccupations._249299)
+      return "249299";
+    if (code == AnzscoOccupations._249311)
+      return "249311";
+    if (code == AnzscoOccupations._250000)
+      return "250000";
+    if (code == AnzscoOccupations._251000)
+      return "251000";
+    if (code == AnzscoOccupations._251111)
+      return "251111";
+    if (code == AnzscoOccupations._251200)
+      return "251200";
+    if (code == AnzscoOccupations._251211)
+      return "251211";
+    if (code == AnzscoOccupations._251212)
+      return "251212";
+    if (code == AnzscoOccupations._251213)
+      return "251213";
+    if (code == AnzscoOccupations._251214)
+      return "251214";
+    if (code == AnzscoOccupations._251300)
+      return "251300";
+    if (code == AnzscoOccupations._251311)
+      return "251311";
+    if (code == AnzscoOccupations._251312)
+      return "251312";
+    if (code == AnzscoOccupations._251400)
+      return "251400";
+    if (code == AnzscoOccupations._251411)
+      return "251411";
+    if (code == AnzscoOccupations._251412)
+      return "251412";
+    if (code == AnzscoOccupations._251500)
+      return "251500";
+    if (code == AnzscoOccupations._251511)
+      return "251511";
+    if (code == AnzscoOccupations._251512)
+      return "251512";
+    if (code == AnzscoOccupations._251513)
+      return "251513";
+    if (code == AnzscoOccupations._251900)
+      return "251900";
+    if (code == AnzscoOccupations._251911)
+      return "251911";
+    if (code == AnzscoOccupations._251912)
+      return "251912";
+    if (code == AnzscoOccupations._251999)
+      return "251999";
+    if (code == AnzscoOccupations._252000)
+      return "252000";
+    if (code == AnzscoOccupations._252100)
+      return "252100";
+    if (code == AnzscoOccupations._252111)
+      return "252111";
+    if (code == AnzscoOccupations._252112)
+      return "252112";
+    if (code == AnzscoOccupations._252200)
+      return "252200";
+    if (code == AnzscoOccupations._252211)
+      return "252211";
+    if (code == AnzscoOccupations._252212)
+      return "252212";
+    if (code == AnzscoOccupations._252213)
+      return "252213";
+    if (code == AnzscoOccupations._252214)
+      return "252214";
+    if (code == AnzscoOccupations._252299)
+      return "252299";
+    if (code == AnzscoOccupations._252300)
+      return "252300";
+    if (code == AnzscoOccupations._252311)
+      return "252311";
+    if (code == AnzscoOccupations._252312)
+      return "252312";
+    if (code == AnzscoOccupations._252411)
+      return "252411";
+    if (code == AnzscoOccupations._252511)
+      return "252511";
+    if (code == AnzscoOccupations._252611)
+      return "252611";
+    if (code == AnzscoOccupations._252700)
+      return "252700";
+    if (code == AnzscoOccupations._252711)
+      return "252711";
+    if (code == AnzscoOccupations._252712)
+      return "252712";
+    if (code == AnzscoOccupations._253000)
+      return "253000";
+    if (code == AnzscoOccupations._253100)
+      return "253100";
+    if (code == AnzscoOccupations._253111)
+      return "253111";
+    if (code == AnzscoOccupations._253112)
+      return "253112";
+    if (code == AnzscoOccupations._253211)
+      return "253211";
+    if (code == AnzscoOccupations._253300)
+      return "253300";
+    if (code == AnzscoOccupations._253311)
+      return "253311";
+    if (code == AnzscoOccupations._253312)
+      return "253312";
+    if (code == AnzscoOccupations._253313)
+      return "253313";
+    if (code == AnzscoOccupations._253314)
+      return "253314";
+    if (code == AnzscoOccupations._253315)
+      return "253315";
+    if (code == AnzscoOccupations._253316)
+      return "253316";
+    if (code == AnzscoOccupations._253317)
+      return "253317";
+    if (code == AnzscoOccupations._253318)
+      return "253318";
+    if (code == AnzscoOccupations._253321)
+      return "253321";
+    if (code == AnzscoOccupations._253322)
+      return "253322";
+    if (code == AnzscoOccupations._253323)
+      return "253323";
+    if (code == AnzscoOccupations._253324)
+      return "253324";
+    if (code == AnzscoOccupations._253399)
+      return "253399";
+    if (code == AnzscoOccupations._253411)
+      return "253411";
+    if (code == AnzscoOccupations._253500)
+      return "253500";
+    if (code == AnzscoOccupations._253511)
+      return "253511";
+    if (code == AnzscoOccupations._253512)
+      return "253512";
+    if (code == AnzscoOccupations._253513)
+      return "253513";
+    if (code == AnzscoOccupations._253514)
+      return "253514";
+    if (code == AnzscoOccupations._253515)
+      return "253515";
+    if (code == AnzscoOccupations._253516)
+      return "253516";
+    if (code == AnzscoOccupations._253517)
+      return "253517";
+    if (code == AnzscoOccupations._253518)
+      return "253518";
+    if (code == AnzscoOccupations._253521)
+      return "253521";
+    if (code == AnzscoOccupations._253900)
+      return "253900";
+    if (code == AnzscoOccupations._253911)
+      return "253911";
+    if (code == AnzscoOccupations._253912)
+      return "253912";
+    if (code == AnzscoOccupations._253913)
+      return "253913";
+    if (code == AnzscoOccupations._253914)
+      return "253914";
+    if (code == AnzscoOccupations._253915)
+      return "253915";
+    if (code == AnzscoOccupations._253916)
+      return "253916";
+    if (code == AnzscoOccupations._253999)
+      return "253999";
+    if (code == AnzscoOccupations._254000)
+      return "254000";
+    if (code == AnzscoOccupations._254111)
+      return "254111";
+    if (code == AnzscoOccupations._254200)
+      return "254200";
+    if (code == AnzscoOccupations._254211)
+      return "254211";
+    if (code == AnzscoOccupations._254212)
+      return "254212";
+    if (code == AnzscoOccupations._254311)
+      return "254311";
+    if (code == AnzscoOccupations._254400)
+      return "254400";
+    if (code == AnzscoOccupations._254411)
+      return "254411";
+    if (code == AnzscoOccupations._254412)
+      return "254412";
+    if (code == AnzscoOccupations._254413)
+      return "254413";
+    if (code == AnzscoOccupations._254414)
+      return "254414";
+    if (code == AnzscoOccupations._254415)
+      return "254415";
+    if (code == AnzscoOccupations._254416)
+      return "254416";
+    if (code == AnzscoOccupations._254417)
+      return "254417";
+    if (code == AnzscoOccupations._254418)
+      return "254418";
+    if (code == AnzscoOccupations._254421)
+      return "254421";
+    if (code == AnzscoOccupations._254422)
+      return "254422";
+    if (code == AnzscoOccupations._254423)
+      return "254423";
+    if (code == AnzscoOccupations._254424)
+      return "254424";
+    if (code == AnzscoOccupations._254499)
+      return "254499";
+    if (code == AnzscoOccupations._260000)
+      return "260000";
+    if (code == AnzscoOccupations._261000)
+      return "261000";
+    if (code == AnzscoOccupations._261100)
+      return "261100";
+    if (code == AnzscoOccupations._261111)
+      return "261111";
+    if (code == AnzscoOccupations._261112)
+      return "261112";
+    if (code == AnzscoOccupations._261200)
+      return "261200";
+    if (code == AnzscoOccupations._261211)
+      return "261211";
+    if (code == AnzscoOccupations._261212)
+      return "261212";
+    if (code == AnzscoOccupations._261300)
+      return "261300";
+    if (code == AnzscoOccupations._261311)
+      return "261311";
+    if (code == AnzscoOccupations._261312)
+      return "261312";
+    if (code == AnzscoOccupations._261313)
+      return "261313";
+    if (code == AnzscoOccupations._261399)
+      return "261399";
+    if (code == AnzscoOccupations._262100)
+      return "262100";
+    if (code == AnzscoOccupations._262111)
+      return "262111";
+    if (code == AnzscoOccupations._262112)
+      return "262112";
+    if (code == AnzscoOccupations._262113)
+      return "262113";
+    if (code == AnzscoOccupations._263000)
+      return "263000";
+    if (code == AnzscoOccupations._263100)
+      return "263100";
+    if (code == AnzscoOccupations._263111)
+      return "263111";
+    if (code == AnzscoOccupations._263112)
+      return "263112";
+    if (code == AnzscoOccupations._263113)
+      return "263113";
+    if (code == AnzscoOccupations._263200)
+      return "263200";
+    if (code == AnzscoOccupations._263211)
+      return "263211";
+    if (code == AnzscoOccupations._263212)
+      return "263212";
+    if (code == AnzscoOccupations._263213)
+      return "263213";
+    if (code == AnzscoOccupations._263299)
+      return "263299";
+    if (code == AnzscoOccupations._263300)
+      return "263300";
+    if (code == AnzscoOccupations._263311)
+      return "263311";
+    if (code == AnzscoOccupations._263312)
+      return "263312";
+    if (code == AnzscoOccupations._270000)
+      return "270000";
+    if (code == AnzscoOccupations._271000)
+      return "271000";
+    if (code == AnzscoOccupations._271111)
+      return "271111";
+    if (code == AnzscoOccupations._271200)
+      return "271200";
+    if (code == AnzscoOccupations._271211)
+      return "271211";
+    if (code == AnzscoOccupations._271212)
+      return "271212";
+    if (code == AnzscoOccupations._271213)
+      return "271213";
+    if (code == AnzscoOccupations._271299)
+      return "271299";
+    if (code == AnzscoOccupations._271311)
+      return "271311";
+    if (code == AnzscoOccupations._272000)
+      return "272000";
+    if (code == AnzscoOccupations._272100)
+      return "272100";
+    if (code == AnzscoOccupations._272111)
+      return "272111";
+    if (code == AnzscoOccupations._272112)
+      return "272112";
+    if (code == AnzscoOccupations._272113)
+      return "272113";
+    if (code == AnzscoOccupations._272114)
+      return "272114";
+    if (code == AnzscoOccupations._272115)
+      return "272115";
+    if (code == AnzscoOccupations._272199)
+      return "272199";
+    if (code == AnzscoOccupations._272211)
+      return "272211";
+    if (code == AnzscoOccupations._272300)
+      return "272300";
+    if (code == AnzscoOccupations._272311)
+      return "272311";
+    if (code == AnzscoOccupations._272312)
+      return "272312";
+    if (code == AnzscoOccupations._272313)
+      return "272313";
+    if (code == AnzscoOccupations._272314)
+      return "272314";
+    if (code == AnzscoOccupations._272399)
+      return "272399";
+    if (code == AnzscoOccupations._272400)
+      return "272400";
+    if (code == AnzscoOccupations._272411)
+      return "272411";
+    if (code == AnzscoOccupations._272412)
+      return "272412";
+    if (code == AnzscoOccupations._272413)
+      return "272413";
+    if (code == AnzscoOccupations._272499)
+      return "272499";
+    if (code == AnzscoOccupations._272511)
+      return "272511";
+    if (code == AnzscoOccupations._272600)
+      return "272600";
+    if (code == AnzscoOccupations._272611)
+      return "272611";
+    if (code == AnzscoOccupations._272612)
+      return "272612";
+    if (code == AnzscoOccupations._272613)
+      return "272613";
+    if (code == AnzscoOccupations._300000)
+      return "300000";
+    if (code == AnzscoOccupations._310000)
+      return "310000";
+    if (code == AnzscoOccupations._311000)
+      return "311000";
+    if (code == AnzscoOccupations._311111)
+      return "311111";
+    if (code == AnzscoOccupations._311200)
+      return "311200";
+    if (code == AnzscoOccupations._311211)
+      return "311211";
+    if (code == AnzscoOccupations._311212)
+      return "311212";
+    if (code == AnzscoOccupations._311213)
+      return "311213";
+    if (code == AnzscoOccupations._311214)
+      return "311214";
+    if (code == AnzscoOccupations._311215)
+      return "311215";
+    if (code == AnzscoOccupations._311299)
+      return "311299";
+    if (code == AnzscoOccupations._311300)
+      return "311300";
+    if (code == AnzscoOccupations._311311)
+      return "311311";
+    if (code == AnzscoOccupations._311312)
+      return "311312";
+    if (code == AnzscoOccupations._311313)
+      return "311313";
+    if (code == AnzscoOccupations._311399)
+      return "311399";
+    if (code == AnzscoOccupations._311400)
+      return "311400";
+    if (code == AnzscoOccupations._311411)
+      return "311411";
+    if (code == AnzscoOccupations._311412)
+      return "311412";
+    if (code == AnzscoOccupations._311413)
+      return "311413";
+    if (code == AnzscoOccupations._311414)
+      return "311414";
+    if (code == AnzscoOccupations._311499)
+      return "311499";
+    if (code == AnzscoOccupations._312000)
+      return "312000";
+    if (code == AnzscoOccupations._312100)
+      return "312100";
+    if (code == AnzscoOccupations._312111)
+      return "312111";
+    if (code == AnzscoOccupations._312112)
+      return "312112";
+    if (code == AnzscoOccupations._312113)
+      return "312113";
+    if (code == AnzscoOccupations._312114)
+      return "312114";
+    if (code == AnzscoOccupations._312115)
+      return "312115";
+    if (code == AnzscoOccupations._312116)
+      return "312116";
+    if (code == AnzscoOccupations._312200)
+      return "312200";
+    if (code == AnzscoOccupations._312211)
+      return "312211";
+    if (code == AnzscoOccupations._312212)
+      return "312212";
+    if (code == AnzscoOccupations._312300)
+      return "312300";
+    if (code == AnzscoOccupations._312311)
+      return "312311";
+    if (code == AnzscoOccupations._312312)
+      return "312312";
+    if (code == AnzscoOccupations._312400)
+      return "312400";
+    if (code == AnzscoOccupations._312411)
+      return "312411";
+    if (code == AnzscoOccupations._312412)
+      return "312412";
+    if (code == AnzscoOccupations._312500)
+      return "312500";
+    if (code == AnzscoOccupations._312511)
+      return "312511";
+    if (code == AnzscoOccupations._312512)
+      return "312512";
+    if (code == AnzscoOccupations._312611)
+      return "312611";
+    if (code == AnzscoOccupations._312900)
+      return "312900";
+    if (code == AnzscoOccupations._312911)
+      return "312911";
+    if (code == AnzscoOccupations._312912)
+      return "312912";
+    if (code == AnzscoOccupations._312913)
+      return "312913";
+    if (code == AnzscoOccupations._312999)
+      return "312999";
+    if (code == AnzscoOccupations._313000)
+      return "313000";
+    if (code == AnzscoOccupations._313100)
+      return "313100";
+    if (code == AnzscoOccupations._313111)
+      return "313111";
+    if (code == AnzscoOccupations._313112)
+      return "313112";
+    if (code == AnzscoOccupations._313113)
+      return "313113";
+    if (code == AnzscoOccupations._313199)
+      return "313199";
+    if (code == AnzscoOccupations._313200)
+      return "313200";
+    if (code == AnzscoOccupations._313211)
+      return "313211";
+    if (code == AnzscoOccupations._313212)
+      return "313212";
+    if (code == AnzscoOccupations._313213)
+      return "313213";
+    if (code == AnzscoOccupations._313214)
+      return "313214";
+    if (code == AnzscoOccupations._320000)
+      return "320000";
+    if (code == AnzscoOccupations._321000)
+      return "321000";
+    if (code == AnzscoOccupations._321111)
+      return "321111";
+    if (code == AnzscoOccupations._321200)
+      return "321200";
+    if (code == AnzscoOccupations._321211)
+      return "321211";
+    if (code == AnzscoOccupations._321212)
+      return "321212";
+    if (code == AnzscoOccupations._321213)
+      return "321213";
+    if (code == AnzscoOccupations._321214)
+      return "321214";
+    if (code == AnzscoOccupations._322000)
+      return "322000";
+    if (code == AnzscoOccupations._322100)
+      return "322100";
+    if (code == AnzscoOccupations._322111)
+      return "322111";
+    if (code == AnzscoOccupations._322112)
+      return "322112";
+    if (code == AnzscoOccupations._322113)
+      return "322113";
+    if (code == AnzscoOccupations._322114)
+      return "322114";
+    if (code == AnzscoOccupations._322115)
+      return "322115";
+    if (code == AnzscoOccupations._322211)
+      return "322211";
+    if (code == AnzscoOccupations._322300)
+      return "322300";
+    if (code == AnzscoOccupations._322311)
+      return "322311";
+    if (code == AnzscoOccupations._322312)
+      return "322312";
+    if (code == AnzscoOccupations._322313)
+      return "322313";
+    if (code == AnzscoOccupations._323000)
+      return "323000";
+    if (code == AnzscoOccupations._323100)
+      return "323100";
+    if (code == AnzscoOccupations._323111)
+      return "323111";
+    if (code == AnzscoOccupations._323112)
+      return "323112";
+    if (code == AnzscoOccupations._323113)
+      return "323113";
+    if (code == AnzscoOccupations._323200)
+      return "323200";
+    if (code == AnzscoOccupations._323211)
+      return "323211";
+    if (code == AnzscoOccupations._323212)
+      return "323212";
+    if (code == AnzscoOccupations._323213)
+      return "323213";
+    if (code == AnzscoOccupations._323214)
+      return "323214";
+    if (code == AnzscoOccupations._323215)
+      return "323215";
+    if (code == AnzscoOccupations._323299)
+      return "323299";
+    if (code == AnzscoOccupations._323300)
+      return "323300";
+    if (code == AnzscoOccupations._323311)
+      return "323311";
+    if (code == AnzscoOccupations._323312)
+      return "323312";
+    if (code == AnzscoOccupations._323313)
+      return "323313";
+    if (code == AnzscoOccupations._323314)
+      return "323314";
+    if (code == AnzscoOccupations._323315)
+      return "323315";
+    if (code == AnzscoOccupations._323316)
+      return "323316";
+    if (code == AnzscoOccupations._323400)
+      return "323400";
+    if (code == AnzscoOccupations._323411)
+      return "323411";
+    if (code == AnzscoOccupations._323412)
+      return "323412";
+    if (code == AnzscoOccupations._324000)
+      return "324000";
+    if (code == AnzscoOccupations._324111)
+      return "324111";
+    if (code == AnzscoOccupations._324200)
+      return "324200";
+    if (code == AnzscoOccupations._324211)
+      return "324211";
+    if (code == AnzscoOccupations._324212)
+      return "324212";
+    if (code == AnzscoOccupations._324311)
+      return "324311";
+    if (code == AnzscoOccupations._330000)
+      return "330000";
+    if (code == AnzscoOccupations._331000)
+      return "331000";
+    if (code == AnzscoOccupations._331100)
+      return "331100";
+    if (code == AnzscoOccupations._331111)
+      return "331111";
+    if (code == AnzscoOccupations._331112)
+      return "331112";
+    if (code == AnzscoOccupations._331211)
+      return "331211";
+    if (code == AnzscoOccupations._331212)
+      return "331212";
+    if (code == AnzscoOccupations._331213)
+      return "331213";
+    if (code == AnzscoOccupations._332000)
+      return "332000";
+    if (code == AnzscoOccupations._332111)
+      return "332111";
+    if (code == AnzscoOccupations._332211)
+      return "332211";
+    if (code == AnzscoOccupations._333000)
+      return "333000";
+    if (code == AnzscoOccupations._333111)
+      return "333111";
+    if (code == AnzscoOccupations._333200)
+      return "333200";
+    if (code == AnzscoOccupations._333211)
+      return "333211";
+    if (code == AnzscoOccupations._333212)
+      return "333212";
+    if (code == AnzscoOccupations._333311)
+      return "333311";
+    if (code == AnzscoOccupations._333411)
+      return "333411";
+    if (code == AnzscoOccupations._334100)
+      return "334100";
+    if (code == AnzscoOccupations._334111)
+      return "334111";
+    if (code == AnzscoOccupations._334112)
+      return "334112";
+    if (code == AnzscoOccupations._334113)
+      return "334113";
+    if (code == AnzscoOccupations._334114)
+      return "334114";
+    if (code == AnzscoOccupations._334115)
+      return "334115";
+    if (code == AnzscoOccupations._340000)
+      return "340000";
+    if (code == AnzscoOccupations._341100)
+      return "341100";
+    if (code == AnzscoOccupations._341111)
+      return "341111";
+    if (code == AnzscoOccupations._341112)
+      return "341112";
+    if (code == AnzscoOccupations._341113)
+      return "341113";
+    if (code == AnzscoOccupations._342000)
+      return "342000";
+    if (code == AnzscoOccupations._342111)
+      return "342111";
+    if (code == AnzscoOccupations._342200)
+      return "342200";
+    if (code == AnzscoOccupations._342211)
+      return "342211";
+    if (code == AnzscoOccupations._342212)
+      return "342212";
+    if (code == AnzscoOccupations._342300)
+      return "342300";
+    if (code == AnzscoOccupations._342311)
+      return "342311";
+    if (code == AnzscoOccupations._342312)
+      return "342312";
+    if (code == AnzscoOccupations._342313)
+      return "342313";
+    if (code == AnzscoOccupations._342314)
+      return "342314";
+    if (code == AnzscoOccupations._342315)
+      return "342315";
+    if (code == AnzscoOccupations._342400)
+      return "342400";
+    if (code == AnzscoOccupations._342411)
+      return "342411";
+    if (code == AnzscoOccupations._342412)
+      return "342412";
+    if (code == AnzscoOccupations._342413)
+      return "342413";
+    if (code == AnzscoOccupations._342414)
+      return "342414";
+    if (code == AnzscoOccupations._351000)
+      return "351000";
+    if (code == AnzscoOccupations._351100)
+      return "351100";
+    if (code == AnzscoOccupations._351111)
+      return "351111";
+    if (code == AnzscoOccupations._351112)
+      return "351112";
+    if (code == AnzscoOccupations._351211)
+      return "351211";
+    if (code == AnzscoOccupations._351311)
+      return "351311";
+    if (code == AnzscoOccupations._351411)
+      return "351411";
+    if (code == AnzscoOccupations._360000)
+      return "360000";
+    if (code == AnzscoOccupations._361000)
+      return "361000";
+    if (code == AnzscoOccupations._361100)
+      return "361100";
+    if (code == AnzscoOccupations._361111)
+      return "361111";
+    if (code == AnzscoOccupations._361112)
+      return "361112";
+    if (code == AnzscoOccupations._361113)
+      return "361113";
+    if (code == AnzscoOccupations._361114)
+      return "361114";
+    if (code == AnzscoOccupations._361199)
+      return "361199";
+    if (code == AnzscoOccupations._361211)
+      return "361211";
+    if (code == AnzscoOccupations._361311)
+      return "361311";
+    if (code == AnzscoOccupations._362000)
+      return "362000";
+    if (code == AnzscoOccupations._362111)
+      return "362111";
+    if (code == AnzscoOccupations._362200)
+      return "362200";
+    if (code == AnzscoOccupations._362211)
+      return "362211";
+    if (code == AnzscoOccupations._362212)
+      return "362212";
+    if (code == AnzscoOccupations._362213)
+      return "362213";
+    if (code == AnzscoOccupations._362311)
+      return "362311";
+    if (code == AnzscoOccupations._362411)
+      return "362411";
+    if (code == AnzscoOccupations._390000)
+      return "390000";
+    if (code == AnzscoOccupations._391111)
+      return "391111";
+    if (code == AnzscoOccupations._392000)
+      return "392000";
+    if (code == AnzscoOccupations._392100)
+      return "392100";
+    if (code == AnzscoOccupations._392111)
+      return "392111";
+    if (code == AnzscoOccupations._392112)
+      return "392112";
+    if (code == AnzscoOccupations._392211)
+      return "392211";
+    if (code == AnzscoOccupations._392300)
+      return "392300";
+    if (code == AnzscoOccupations._392311)
+      return "392311";
+    if (code == AnzscoOccupations._392312)
+      return "392312";
+    if (code == AnzscoOccupations._393000)
+      return "393000";
+    if (code == AnzscoOccupations._393100)
+      return "393100";
+    if (code == AnzscoOccupations._393111)
+      return "393111";
+    if (code == AnzscoOccupations._393112)
+      return "393112";
+    if (code == AnzscoOccupations._393113)
+      return "393113";
+    if (code == AnzscoOccupations._393114)
+      return "393114";
+    if (code == AnzscoOccupations._393200)
+      return "393200";
+    if (code == AnzscoOccupations._393211)
+      return "393211";
+    if (code == AnzscoOccupations._393212)
+      return "393212";
+    if (code == AnzscoOccupations._393213)
+      return "393213";
+    if (code == AnzscoOccupations._393299)
+      return "393299";
+    if (code == AnzscoOccupations._393311)
+      return "393311";
+    if (code == AnzscoOccupations._394000)
+      return "394000";
+    if (code == AnzscoOccupations._394111)
+      return "394111";
+    if (code == AnzscoOccupations._394200)
+      return "394200";
+    if (code == AnzscoOccupations._394211)
+      return "394211";
+    if (code == AnzscoOccupations._394212)
+      return "394212";
+    if (code == AnzscoOccupations._394213)
+      return "394213";
+    if (code == AnzscoOccupations._394214)
+      return "394214";
+    if (code == AnzscoOccupations._394299)
+      return "394299";
+    if (code == AnzscoOccupations._399000)
+      return "399000";
+    if (code == AnzscoOccupations._399100)
+      return "399100";
+    if (code == AnzscoOccupations._399111)
+      return "399111";
+    if (code == AnzscoOccupations._399112)
+      return "399112";
+    if (code == AnzscoOccupations._399200)
+      return "399200";
+    if (code == AnzscoOccupations._399211)
+      return "399211";
+    if (code == AnzscoOccupations._399212)
+      return "399212";
+    if (code == AnzscoOccupations._399213)
+      return "399213";
+    if (code == AnzscoOccupations._399300)
+      return "399300";
+    if (code == AnzscoOccupations._399311)
+      return "399311";
+    if (code == AnzscoOccupations._399312)
+      return "399312";
+    if (code == AnzscoOccupations._399411)
+      return "399411";
+    if (code == AnzscoOccupations._399500)
+      return "399500";
+    if (code == AnzscoOccupations._399511)
+      return "399511";
+    if (code == AnzscoOccupations._399512)
+      return "399512";
+    if (code == AnzscoOccupations._399513)
+      return "399513";
+    if (code == AnzscoOccupations._399514)
+      return "399514";
+    if (code == AnzscoOccupations._399515)
+      return "399515";
+    if (code == AnzscoOccupations._399516)
+      return "399516";
+    if (code == AnzscoOccupations._399517)
+      return "399517";
+    if (code == AnzscoOccupations._399599)
+      return "399599";
+    if (code == AnzscoOccupations._399611)
+      return "399611";
+    if (code == AnzscoOccupations._399900)
+      return "399900";
+    if (code == AnzscoOccupations._399911)
+      return "399911";
+    if (code == AnzscoOccupations._399912)
+      return "399912";
+    if (code == AnzscoOccupations._399913)
+      return "399913";
+    if (code == AnzscoOccupations._399914)
+      return "399914";
+    if (code == AnzscoOccupations._399915)
+      return "399915";
+    if (code == AnzscoOccupations._399916)
+      return "399916";
+    if (code == AnzscoOccupations._399917)
+      return "399917";
+    if (code == AnzscoOccupations._399999)
+      return "399999";
+    if (code == AnzscoOccupations._400000)
+      return "400000";
+    if (code == AnzscoOccupations._411000)
+      return "411000";
+    if (code == AnzscoOccupations._411100)
+      return "411100";
+    if (code == AnzscoOccupations._411111)
+      return "411111";
+    if (code == AnzscoOccupations._411112)
+      return "411112";
+    if (code == AnzscoOccupations._411200)
+      return "411200";
+    if (code == AnzscoOccupations._411211)
+      return "411211";
+    if (code == AnzscoOccupations._411212)
+      return "411212";
+    if (code == AnzscoOccupations._411213)
+      return "411213";
+    if (code == AnzscoOccupations._411214)
+      return "411214";
+    if (code == AnzscoOccupations._411311)
+      return "411311";
+    if (code == AnzscoOccupations._411400)
+      return "411400";
+    if (code == AnzscoOccupations._411411)
+      return "411411";
+    if (code == AnzscoOccupations._411412)
+      return "411412";
+    if (code == AnzscoOccupations._411511)
+      return "411511";
+    if (code == AnzscoOccupations._411611)
+      return "411611";
+    if (code == AnzscoOccupations._411700)
+      return "411700";
+    if (code == AnzscoOccupations._411711)
+      return "411711";
+    if (code == AnzscoOccupations._411712)
+      return "411712";
+    if (code == AnzscoOccupations._411713)
+      return "411713";
+    if (code == AnzscoOccupations._411714)
+      return "411714";
+    if (code == AnzscoOccupations._411715)
+      return "411715";
+    if (code == AnzscoOccupations._411716)
+      return "411716";
+    if (code == AnzscoOccupations._420000)
+      return "420000";
+    if (code == AnzscoOccupations._421100)
+      return "421100";
+    if (code == AnzscoOccupations._421111)
+      return "421111";
+    if (code == AnzscoOccupations._421112)
+      return "421112";
+    if (code == AnzscoOccupations._421113)
+      return "421113";
+    if (code == AnzscoOccupations._421114)
+      return "421114";
+    if (code == AnzscoOccupations._422100)
+      return "422100";
+    if (code == AnzscoOccupations._422111)
+      return "422111";
+    if (code == AnzscoOccupations._422112)
+      return "422112";
+    if (code == AnzscoOccupations._422115)
+      return "422115";
+    if (code == AnzscoOccupations._422116)
+      return "422116";
+    if (code == AnzscoOccupations._423000)
+      return "423000";
+    if (code == AnzscoOccupations._423111)
+      return "423111";
+    if (code == AnzscoOccupations._423211)
+      return "423211";
+    if (code == AnzscoOccupations._423300)
+      return "423300";
+    if (code == AnzscoOccupations._423311)
+      return "423311";
+    if (code == AnzscoOccupations._423312)
+      return "423312";
+    if (code == AnzscoOccupations._423313)
+      return "423313";
+    if (code == AnzscoOccupations._423314)
+      return "423314";
+    if (code == AnzscoOccupations._423400)
+      return "423400";
+    if (code == AnzscoOccupations._423411)
+      return "423411";
+    if (code == AnzscoOccupations._423412)
+      return "423412";
+    if (code == AnzscoOccupations._423413)
+      return "423413";
+    if (code == AnzscoOccupations._431000)
+      return "431000";
+    if (code == AnzscoOccupations._431100)
+      return "431100";
+    if (code == AnzscoOccupations._431111)
+      return "431111";
+    if (code == AnzscoOccupations._431112)
+      return "431112";
+    if (code == AnzscoOccupations._431211)
+      return "431211";
+    if (code == AnzscoOccupations._431311)
+      return "431311";
+    if (code == AnzscoOccupations._431411)
+      return "431411";
+    if (code == AnzscoOccupations._431511)
+      return "431511";
+    if (code == AnzscoOccupations._431900)
+      return "431900";
+    if (code == AnzscoOccupations._431911)
+      return "431911";
+    if (code == AnzscoOccupations._431912)
+      return "431912";
+    if (code == AnzscoOccupations._431999)
+      return "431999";
+    if (code == AnzscoOccupations._440000)
+      return "440000";
+    if (code == AnzscoOccupations._441000)
+      return "441000";
+    if (code == AnzscoOccupations._441111)
+      return "441111";
+    if (code == AnzscoOccupations._441200)
+      return "441200";
+    if (code == AnzscoOccupations._441211)
+      return "441211";
+    if (code == AnzscoOccupations._441212)
+      return "441212";
+    if (code == AnzscoOccupations._441300)
+      return "441300";
+    if (code == AnzscoOccupations._441311)
+      return "441311";
+    if (code == AnzscoOccupations._441312)
+      return "441312";
+    if (code == AnzscoOccupations._442000)
+      return "442000";
+    if (code == AnzscoOccupations._442111)
+      return "442111";
+    if (code == AnzscoOccupations._442200)
+      return "442200";
+    if (code == AnzscoOccupations._442211)
+      return "442211";
+    if (code == AnzscoOccupations._442212)
+      return "442212";
+    if (code == AnzscoOccupations._442213)
+      return "442213";
+    if (code == AnzscoOccupations._442214)
+      return "442214";
+    if (code == AnzscoOccupations._442215)
+      return "442215";
+    if (code == AnzscoOccupations._442216)
+      return "442216";
+    if (code == AnzscoOccupations._442217)
+      return "442217";
+    if (code == AnzscoOccupations._442299)
+      return "442299";
+    if (code == AnzscoOccupations._450000)
+      return "450000";
+    if (code == AnzscoOccupations._451000)
+      return "451000";
+    if (code == AnzscoOccupations._451111)
+      return "451111";
+    if (code == AnzscoOccupations._451211)
+      return "451211";
+    if (code == AnzscoOccupations._451300)
+      return "451300";
+    if (code == AnzscoOccupations._451311)
+      return "451311";
+    if (code == AnzscoOccupations._451399)
+      return "451399";
+    if (code == AnzscoOccupations._451400)
+      return "451400";
+    if (code == AnzscoOccupations._451411)
+      return "451411";
+    if (code == AnzscoOccupations._451412)
+      return "451412";
+    if (code == AnzscoOccupations._451500)
+      return "451500";
+    if (code == AnzscoOccupations._451511)
+      return "451511";
+    if (code == AnzscoOccupations._451512)
+      return "451512";
+    if (code == AnzscoOccupations._451600)
+      return "451600";
+    if (code == AnzscoOccupations._451611)
+      return "451611";
+    if (code == AnzscoOccupations._451612)
+      return "451612";
+    if (code == AnzscoOccupations._451700)
+      return "451700";
+    if (code == AnzscoOccupations._451711)
+      return "451711";
+    if (code == AnzscoOccupations._451799)
+      return "451799";
+    if (code == AnzscoOccupations._451800)
+      return "451800";
+    if (code == AnzscoOccupations._451811)
+      return "451811";
+    if (code == AnzscoOccupations._451812)
+      return "451812";
+    if (code == AnzscoOccupations._451813)
+      return "451813";
+    if (code == AnzscoOccupations._451899)
+      return "451899";
+    if (code == AnzscoOccupations._452000)
+      return "452000";
+    if (code == AnzscoOccupations._452111)
+      return "452111";
+    if (code == AnzscoOccupations._452200)
+      return "452200";
+    if (code == AnzscoOccupations._452211)
+      return "452211";
+    if (code == AnzscoOccupations._452212)
+      return "452212";
+    if (code == AnzscoOccupations._452213)
+      return "452213";
+    if (code == AnzscoOccupations._452214)
+      return "452214";
+    if (code == AnzscoOccupations._452215)
+      return "452215";
+    if (code == AnzscoOccupations._452216)
+      return "452216";
+    if (code == AnzscoOccupations._452217)
+      return "452217";
+    if (code == AnzscoOccupations._452299)
+      return "452299";
+    if (code == AnzscoOccupations._452300)
+      return "452300";
+    if (code == AnzscoOccupations._452311)
+      return "452311";
+    if (code == AnzscoOccupations._452312)
+      return "452312";
+    if (code == AnzscoOccupations._452313)
+      return "452313";
+    if (code == AnzscoOccupations._452314)
+      return "452314";
+    if (code == AnzscoOccupations._452315)
+      return "452315";
+    if (code == AnzscoOccupations._452316)
+      return "452316";
+    if (code == AnzscoOccupations._452317)
+      return "452317";
+    if (code == AnzscoOccupations._452318)
+      return "452318";
+    if (code == AnzscoOccupations._452321)
+      return "452321";
+    if (code == AnzscoOccupations._452322)
+      return "452322";
+    if (code == AnzscoOccupations._452323)
+      return "452323";
+    if (code == AnzscoOccupations._452400)
+      return "452400";
+    if (code == AnzscoOccupations._452411)
+      return "452411";
+    if (code == AnzscoOccupations._452412)
+      return "452412";
+    if (code == AnzscoOccupations._452413)
+      return "452413";
+    if (code == AnzscoOccupations._452414)
+      return "452414";
+    if (code == AnzscoOccupations._452499)
+      return "452499";
+    if (code == AnzscoOccupations._500000)
+      return "500000";
+    if (code == AnzscoOccupations._510000)
+      return "510000";
+    if (code == AnzscoOccupations._511100)
+      return "511100";
+    if (code == AnzscoOccupations._511111)
+      return "511111";
+    if (code == AnzscoOccupations._511112)
+      return "511112";
+    if (code == AnzscoOccupations._512000)
+      return "512000";
+    if (code == AnzscoOccupations._512111)
+      return "512111";
+    if (code == AnzscoOccupations._512200)
+      return "512200";
+    if (code == AnzscoOccupations._512211)
+      return "512211";
+    if (code == AnzscoOccupations._512299)
+      return "512299";
+    if (code == AnzscoOccupations._521000)
+      return "521000";
+    if (code == AnzscoOccupations._521111)
+      return "521111";
+    if (code == AnzscoOccupations._521200)
+      return "521200";
+    if (code == AnzscoOccupations._521211)
+      return "521211";
+    if (code == AnzscoOccupations._521212)
+      return "521212";
+    if (code == AnzscoOccupations._530000)
+      return "530000";
+    if (code == AnzscoOccupations._531111)
+      return "531111";
+    if (code == AnzscoOccupations._532100)
+      return "532100";
+    if (code == AnzscoOccupations._532111)
+      return "532111";
+    if (code == AnzscoOccupations._532112)
+      return "532112";
+    if (code == AnzscoOccupations._532113)
+      return "532113";
+    if (code == AnzscoOccupations._540000)
+      return "540000";
+    if (code == AnzscoOccupations._541000)
+      return "541000";
+    if (code == AnzscoOccupations._541100)
+      return "541100";
+    if (code == AnzscoOccupations._541111)
+      return "541111";
+    if (code == AnzscoOccupations._541112)
+      return "541112";
+    if (code == AnzscoOccupations._541211)
+      return "541211";
+    if (code == AnzscoOccupations._542100)
+      return "542100";
+    if (code == AnzscoOccupations._542111)
+      return "542111";
+    if (code == AnzscoOccupations._542112)
+      return "542112";
+    if (code == AnzscoOccupations._542113)
+      return "542113";
+    if (code == AnzscoOccupations._542114)
+      return "542114";
+    if (code == AnzscoOccupations._550000)
+      return "550000";
+    if (code == AnzscoOccupations._551000)
+      return "551000";
+    if (code == AnzscoOccupations._551100)
+      return "551100";
+    if (code == AnzscoOccupations._551111)
+      return "551111";
+    if (code == AnzscoOccupations._551112)
+      return "551112";
+    if (code == AnzscoOccupations._551211)
+      return "551211";
+    if (code == AnzscoOccupations._551311)
+      return "551311";
+    if (code == AnzscoOccupations._552000)
+      return "552000";
+    if (code == AnzscoOccupations._552111)
+      return "552111";
+    if (code == AnzscoOccupations._552211)
+      return "552211";
+    if (code == AnzscoOccupations._552300)
+      return "552300";
+    if (code == AnzscoOccupations._552311)
+      return "552311";
+    if (code == AnzscoOccupations._552312)
+      return "552312";
+    if (code == AnzscoOccupations._552313)
+      return "552313";
+    if (code == AnzscoOccupations._552314)
+      return "552314";
+    if (code == AnzscoOccupations._561000)
+      return "561000";
+    if (code == AnzscoOccupations._561100)
+      return "561100";
+    if (code == AnzscoOccupations._561111)
+      return "561111";
+    if (code == AnzscoOccupations._561112)
+      return "561112";
+    if (code == AnzscoOccupations._561113)
+      return "561113";
+    if (code == AnzscoOccupations._561199)
+      return "561199";
+    if (code == AnzscoOccupations._561200)
+      return "561200";
+    if (code == AnzscoOccupations._561211)
+      return "561211";
+    if (code == AnzscoOccupations._561212)
+      return "561212";
+    if (code == AnzscoOccupations._561311)
+      return "561311";
+    if (code == AnzscoOccupations._561400)
+      return "561400";
+    if (code == AnzscoOccupations._561411)
+      return "561411";
+    if (code == AnzscoOccupations._561412)
+      return "561412";
+    if (code == AnzscoOccupations._561511)
+      return "561511";
+    if (code == AnzscoOccupations._561611)
+      return "561611";
+    if (code == AnzscoOccupations._561900)
+      return "561900";
+    if (code == AnzscoOccupations._561911)
+      return "561911";
+    if (code == AnzscoOccupations._561912)
+      return "561912";
+    if (code == AnzscoOccupations._561913)
+      return "561913";
+    if (code == AnzscoOccupations._561999)
+      return "561999";
+    if (code == AnzscoOccupations._590000)
+      return "590000";
+    if (code == AnzscoOccupations._591000)
+      return "591000";
+    if (code == AnzscoOccupations._591100)
+      return "591100";
+    if (code == AnzscoOccupations._591111)
+      return "591111";
+    if (code == AnzscoOccupations._591112)
+      return "591112";
+    if (code == AnzscoOccupations._591113)
+      return "591113";
+    if (code == AnzscoOccupations._591114)
+      return "591114";
+    if (code == AnzscoOccupations._591115)
+      return "591115";
+    if (code == AnzscoOccupations._591116)
+      return "591116";
+    if (code == AnzscoOccupations._591200)
+      return "591200";
+    if (code == AnzscoOccupations._591211)
+      return "591211";
+    if (code == AnzscoOccupations._591212)
+      return "591212";
+    if (code == AnzscoOccupations._599000)
+      return "599000";
+    if (code == AnzscoOccupations._599100)
+      return "599100";
+    if (code == AnzscoOccupations._599111)
+      return "599111";
+    if (code == AnzscoOccupations._599112)
+      return "599112";
+    if (code == AnzscoOccupations._599200)
+      return "599200";
+    if (code == AnzscoOccupations._599211)
+      return "599211";
+    if (code == AnzscoOccupations._599212)
+      return "599212";
+    if (code == AnzscoOccupations._599213)
+      return "599213";
+    if (code == AnzscoOccupations._599214)
+      return "599214";
+    if (code == AnzscoOccupations._599215)
+      return "599215";
+    if (code == AnzscoOccupations._599311)
+      return "599311";
+    if (code == AnzscoOccupations._599411)
+      return "599411";
+    if (code == AnzscoOccupations._599500)
+      return "599500";
+    if (code == AnzscoOccupations._599511)
+      return "599511";
+    if (code == AnzscoOccupations._599512)
+      return "599512";
+    if (code == AnzscoOccupations._599513)
+      return "599513";
+    if (code == AnzscoOccupations._599514)
+      return "599514";
+    if (code == AnzscoOccupations._599515)
+      return "599515";
+    if (code == AnzscoOccupations._599516)
+      return "599516";
+    if (code == AnzscoOccupations._599517)
+      return "599517";
+    if (code == AnzscoOccupations._599518)
+      return "599518";
+    if (code == AnzscoOccupations._599521)
+      return "599521";
+    if (code == AnzscoOccupations._599599)
+      return "599599";
+    if (code == AnzscoOccupations._599600)
+      return "599600";
+    if (code == AnzscoOccupations._599611)
+      return "599611";
+    if (code == AnzscoOccupations._599612)
+      return "599612";
+    if (code == AnzscoOccupations._599613)
+      return "599613";
+    if (code == AnzscoOccupations._599711)
+      return "599711";
+    if (code == AnzscoOccupations._599900)
+      return "599900";
+    if (code == AnzscoOccupations._599911)
+      return "599911";
+    if (code == AnzscoOccupations._599912)
+      return "599912";
+    if (code == AnzscoOccupations._599913)
+      return "599913";
+    if (code == AnzscoOccupations._599914)
+      return "599914";
+    if (code == AnzscoOccupations._599999)
+      return "599999";
+    if (code == AnzscoOccupations._600000)
+      return "600000";
+    if (code == AnzscoOccupations._610000)
+      return "610000";
+    if (code == AnzscoOccupations._611000)
+      return "611000";
+    if (code == AnzscoOccupations._611100)
+      return "611100";
+    if (code == AnzscoOccupations._611111)
+      return "611111";
+    if (code == AnzscoOccupations._611112)
+      return "611112";
+    if (code == AnzscoOccupations._611211)
+      return "611211";
+    if (code == AnzscoOccupations._611300)
+      return "611300";
+    if (code == AnzscoOccupations._611311)
+      return "611311";
+    if (code == AnzscoOccupations._611312)
+      return "611312";
+    if (code == AnzscoOccupations._611313)
+      return "611313";
+    if (code == AnzscoOccupations._611314)
+      return "611314";
+    if (code == AnzscoOccupations._611399)
+      return "611399";
+    if (code == AnzscoOccupations._612100)
+      return "612100";
+    if (code == AnzscoOccupations._612111)
+      return "612111";
+    if (code == AnzscoOccupations._612112)
+      return "612112";
+    if (code == AnzscoOccupations._612113)
+      return "612113";
+    if (code == AnzscoOccupations._612114)
+      return "612114";
+    if (code == AnzscoOccupations._612115)
+      return "612115";
+    if (code == AnzscoOccupations._621000)
+      return "621000";
+    if (code == AnzscoOccupations._621111)
+      return "621111";
+    if (code == AnzscoOccupations._621211)
+      return "621211";
+    if (code == AnzscoOccupations._621300)
+      return "621300";
+    if (code == AnzscoOccupations._621311)
+      return "621311";
+    if (code == AnzscoOccupations._621312)
+      return "621312";
+    if (code == AnzscoOccupations._621411)
+      return "621411";
+    if (code == AnzscoOccupations._621511)
+      return "621511";
+    if (code == AnzscoOccupations._621611)
+      return "621611";
+    if (code == AnzscoOccupations._621700)
+      return "621700";
+    if (code == AnzscoOccupations._621711)
+      return "621711";
+    if (code == AnzscoOccupations._621712)
+      return "621712";
+    if (code == AnzscoOccupations._621713)
+      return "621713";
+    if (code == AnzscoOccupations._621900)
+      return "621900";
+    if (code == AnzscoOccupations._621911)
+      return "621911";
+    if (code == AnzscoOccupations._621912)
+      return "621912";
+    if (code == AnzscoOccupations._621999)
+      return "621999";
+    if (code == AnzscoOccupations._630000)
+      return "630000";
+    if (code == AnzscoOccupations._631100)
+      return "631100";
+    if (code == AnzscoOccupations._631111)
+      return "631111";
+    if (code == AnzscoOccupations._631112)
+      return "631112";
+    if (code == AnzscoOccupations._639000)
+      return "639000";
+    if (code == AnzscoOccupations._639100)
+      return "639100";
+    if (code == AnzscoOccupations._639111)
+      return "639111";
+    if (code == AnzscoOccupations._639112)
+      return "639112";
+    if (code == AnzscoOccupations._639200)
+      return "639200";
+    if (code == AnzscoOccupations._639211)
+      return "639211";
+    if (code == AnzscoOccupations._639212)
+      return "639212";
+    if (code == AnzscoOccupations._639311)
+      return "639311";
+    if (code == AnzscoOccupations._639400)
+      return "639400";
+    if (code == AnzscoOccupations._639411)
+      return "639411";
+    if (code == AnzscoOccupations._639412)
+      return "639412";
+    if (code == AnzscoOccupations._639511)
+      return "639511";
+    if (code == AnzscoOccupations._639911)
+      return "639911";
+    if (code == AnzscoOccupations._700000)
+      return "700000";
+    if (code == AnzscoOccupations._710000)
+      return "710000";
+    if (code == AnzscoOccupations._711000)
+      return "711000";
+    if (code == AnzscoOccupations._711100)
+      return "711100";
+    if (code == AnzscoOccupations._711111)
+      return "711111";
+    if (code == AnzscoOccupations._711112)
+      return "711112";
+    if (code == AnzscoOccupations._711113)
+      return "711113";
+    if (code == AnzscoOccupations._711114)
+      return "711114";
+    if (code == AnzscoOccupations._711199)
+      return "711199";
+    if (code == AnzscoOccupations._711211)
+      return "711211";
+    if (code == AnzscoOccupations._711300)
+      return "711300";
+    if (code == AnzscoOccupations._711311)
+      return "711311";
+    if (code == AnzscoOccupations._711312)
+      return "711312";
+    if (code == AnzscoOccupations._711411)
+      return "711411";
+    if (code == AnzscoOccupations._711500)
+      return "711500";
+    if (code == AnzscoOccupations._711511)
+      return "711511";
+    if (code == AnzscoOccupations._711512)
+      return "711512";
+    if (code == AnzscoOccupations._711513)
+      return "711513";
+    if (code == AnzscoOccupations._711514)
+      return "711514";
+    if (code == AnzscoOccupations._711515)
+      return "711515";
+    if (code == AnzscoOccupations._711516)
+      return "711516";
+    if (code == AnzscoOccupations._711599)
+      return "711599";
+    if (code == AnzscoOccupations._711611)
+      return "711611";
+    if (code == AnzscoOccupations._711700)
+      return "711700";
+    if (code == AnzscoOccupations._711711)
+      return "711711";
+    if (code == AnzscoOccupations._711712)
+      return "711712";
+    if (code == AnzscoOccupations._711713)
+      return "711713";
+    if (code == AnzscoOccupations._711714)
+      return "711714";
+    if (code == AnzscoOccupations._711715)
+      return "711715";
+    if (code == AnzscoOccupations._711716)
+      return "711716";
+    if (code == AnzscoOccupations._711799)
+      return "711799";
+    if (code == AnzscoOccupations._711900)
+      return "711900";
+    if (code == AnzscoOccupations._711911)
+      return "711911";
+    if (code == AnzscoOccupations._711912)
+      return "711912";
+    if (code == AnzscoOccupations._711913)
+      return "711913";
+    if (code == AnzscoOccupations._711914)
+      return "711914";
+    if (code == AnzscoOccupations._711999)
+      return "711999";
+    if (code == AnzscoOccupations._712000)
+      return "712000";
+    if (code == AnzscoOccupations._712111)
+      return "712111";
+    if (code == AnzscoOccupations._712200)
+      return "712200";
+    if (code == AnzscoOccupations._712211)
+      return "712211";
+    if (code == AnzscoOccupations._712212)
+      return "712212";
+    if (code == AnzscoOccupations._712213)
+      return "712213";
+    if (code == AnzscoOccupations._712311)
+      return "712311";
+    if (code == AnzscoOccupations._712900)
+      return "712900";
+    if (code == AnzscoOccupations._712911)
+      return "712911";
+    if (code == AnzscoOccupations._712912)
+      return "712912";
+    if (code == AnzscoOccupations._712913)
+      return "712913";
+    if (code == AnzscoOccupations._712914)
+      return "712914";
+    if (code == AnzscoOccupations._712915)
+      return "712915";
+    if (code == AnzscoOccupations._712916)
+      return "712916";
+    if (code == AnzscoOccupations._712917)
+      return "712917";
+    if (code == AnzscoOccupations._712918)
+      return "712918";
+    if (code == AnzscoOccupations._712921)
+      return "712921";
+    if (code == AnzscoOccupations._712922)
+      return "712922";
+    if (code == AnzscoOccupations._712999)
+      return "712999";
+    if (code == AnzscoOccupations._721000)
+      return "721000";
+    if (code == AnzscoOccupations._721100)
+      return "721100";
+    if (code == AnzscoOccupations._721111)
+      return "721111";
+    if (code == AnzscoOccupations._721112)
+      return "721112";
+    if (code == AnzscoOccupations._721200)
+      return "721200";
+    if (code == AnzscoOccupations._721211)
+      return "721211";
+    if (code == AnzscoOccupations._721212)
+      return "721212";
+    if (code == AnzscoOccupations._721213)
+      return "721213";
+    if (code == AnzscoOccupations._721214)
+      return "721214";
+    if (code == AnzscoOccupations._721215)
+      return "721215";
+    if (code == AnzscoOccupations._721216)
+      return "721216";
+    if (code == AnzscoOccupations._721311)
+      return "721311";
+    if (code == AnzscoOccupations._721900)
+      return "721900";
+    if (code == AnzscoOccupations._721911)
+      return "721911";
+    if (code == AnzscoOccupations._721912)
+      return "721912";
+    if (code == AnzscoOccupations._721913)
+      return "721913";
+    if (code == AnzscoOccupations._721914)
+      return "721914";
+    if (code == AnzscoOccupations._721915)
+      return "721915";
+    if (code == AnzscoOccupations._721916)
+      return "721916";
+    if (code == AnzscoOccupations._721999)
+      return "721999";
+    if (code == AnzscoOccupations._730000)
+      return "730000";
+    if (code == AnzscoOccupations._731000)
+      return "731000";
+    if (code == AnzscoOccupations._731100)
+      return "731100";
+    if (code == AnzscoOccupations._731111)
+      return "731111";
+    if (code == AnzscoOccupations._731112)
+      return "731112";
+    if (code == AnzscoOccupations._731199)
+      return "731199";
+    if (code == AnzscoOccupations._731200)
+      return "731200";
+    if (code == AnzscoOccupations._731211)
+      return "731211";
+    if (code == AnzscoOccupations._731212)
+      return "731212";
+    if (code == AnzscoOccupations._731213)
+      return "731213";
+    if (code == AnzscoOccupations._731300)
+      return "731300";
+    if (code == AnzscoOccupations._731311)
+      return "731311";
+    if (code == AnzscoOccupations._731312)
+      return "731312";
+    if (code == AnzscoOccupations._732111)
+      return "732111";
+    if (code == AnzscoOccupations._733100)
+      return "733100";
+    if (code == AnzscoOccupations._733111)
+      return "733111";
+    if (code == AnzscoOccupations._733112)
+      return "733112";
+    if (code == AnzscoOccupations._733113)
+      return "733113";
+    if (code == AnzscoOccupations._733114)
+      return "733114";
+    if (code == AnzscoOccupations._733115)
+      return "733115";
+    if (code == AnzscoOccupations._741111)
+      return "741111";
+    if (code == AnzscoOccupations._800000)
+      return "800000";
+    if (code == AnzscoOccupations._811000)
+      return "811000";
+    if (code == AnzscoOccupations._811111)
+      return "811111";
+    if (code == AnzscoOccupations._811211)
+      return "811211";
+    if (code == AnzscoOccupations._811311)
+      return "811311";
+    if (code == AnzscoOccupations._811400)
+      return "811400";
+    if (code == AnzscoOccupations._811411)
+      return "811411";
+    if (code == AnzscoOccupations._811412)
+      return "811412";
+    if (code == AnzscoOccupations._811500)
+      return "811500";
+    if (code == AnzscoOccupations._811511)
+      return "811511";
+    if (code == AnzscoOccupations._811512)
+      return "811512";
+    if (code == AnzscoOccupations._811513)
+      return "811513";
+    if (code == AnzscoOccupations._811600)
+      return "811600";
+    if (code == AnzscoOccupations._811611)
+      return "811611";
+    if (code == AnzscoOccupations._811612)
+      return "811612";
+    if (code == AnzscoOccupations._811699)
+      return "811699";
+    if (code == AnzscoOccupations._821000)
+      return "821000";
+    if (code == AnzscoOccupations._821100)
+      return "821100";
+    if (code == AnzscoOccupations._821111)
+      return "821111";
+    if (code == AnzscoOccupations._821112)
+      return "821112";
+    if (code == AnzscoOccupations._821113)
+      return "821113";
+    if (code == AnzscoOccupations._821114)
+      return "821114";
+    if (code == AnzscoOccupations._821211)
+      return "821211";
+    if (code == AnzscoOccupations._821311)
+      return "821311";
+    if (code == AnzscoOccupations._821400)
+      return "821400";
+    if (code == AnzscoOccupations._821411)
+      return "821411";
+    if (code == AnzscoOccupations._821412)
+      return "821412";
+    if (code == AnzscoOccupations._821511)
+      return "821511";
+    if (code == AnzscoOccupations._821611)
+      return "821611";
+    if (code == AnzscoOccupations._821700)
+      return "821700";
+    if (code == AnzscoOccupations._821711)
+      return "821711";
+    if (code == AnzscoOccupations._821712)
+      return "821712";
+    if (code == AnzscoOccupations._821713)
+      return "821713";
+    if (code == AnzscoOccupations._821714)
+      return "821714";
+    if (code == AnzscoOccupations._821900)
+      return "821900";
+    if (code == AnzscoOccupations._821911)
+      return "821911";
+    if (code == AnzscoOccupations._821912)
+      return "821912";
+    if (code == AnzscoOccupations._821913)
+      return "821913";
+    if (code == AnzscoOccupations._821914)
+      return "821914";
+    if (code == AnzscoOccupations._821915)
+      return "821915";
+    if (code == AnzscoOccupations._830000)
+      return "830000";
+    if (code == AnzscoOccupations._831000)
+      return "831000";
+    if (code == AnzscoOccupations._831100)
+      return "831100";
+    if (code == AnzscoOccupations._831111)
+      return "831111";
+    if (code == AnzscoOccupations._831112)
+      return "831112";
+    if (code == AnzscoOccupations._831113)
+      return "831113";
+    if (code == AnzscoOccupations._831114)
+      return "831114";
+    if (code == AnzscoOccupations._831115)
+      return "831115";
+    if (code == AnzscoOccupations._831116)
+      return "831116";
+    if (code == AnzscoOccupations._831117)
+      return "831117";
+    if (code == AnzscoOccupations._831118)
+      return "831118";
+    if (code == AnzscoOccupations._831199)
+      return "831199";
+    if (code == AnzscoOccupations._831200)
+      return "831200";
+    if (code == AnzscoOccupations._831211)
+      return "831211";
+    if (code == AnzscoOccupations._831212)
+      return "831212";
+    if (code == AnzscoOccupations._831300)
+      return "831300";
+    if (code == AnzscoOccupations._831311)
+      return "831311";
+    if (code == AnzscoOccupations._831312)
+      return "831312";
+    if (code == AnzscoOccupations._831313)
+      return "831313";
+    if (code == AnzscoOccupations._832000)
+      return "832000";
+    if (code == AnzscoOccupations._832100)
+      return "832100";
+    if (code == AnzscoOccupations._832111)
+      return "832111";
+    if (code == AnzscoOccupations._832112)
+      return "832112";
+    if (code == AnzscoOccupations._832113)
+      return "832113";
+    if (code == AnzscoOccupations._832114)
+      return "832114";
+    if (code == AnzscoOccupations._832115)
+      return "832115";
+    if (code == AnzscoOccupations._832199)
+      return "832199";
+    if (code == AnzscoOccupations._832211)
+      return "832211";
+    if (code == AnzscoOccupations._839000)
+      return "839000";
+    if (code == AnzscoOccupations._839111)
+      return "839111";
+    if (code == AnzscoOccupations._839200)
+      return "839200";
+    if (code == AnzscoOccupations._839211)
+      return "839211";
+    if (code == AnzscoOccupations._839212)
+      return "839212";
+    if (code == AnzscoOccupations._839300)
+      return "839300";
+    if (code == AnzscoOccupations._839311)
+      return "839311";
+    if (code == AnzscoOccupations._839312)
+      return "839312";
+    if (code == AnzscoOccupations._839313)
+      return "839313";
+    if (code == AnzscoOccupations._839400)
+      return "839400";
+    if (code == AnzscoOccupations._839411)
+      return "839411";
+    if (code == AnzscoOccupations._839412)
+      return "839412";
+    if (code == AnzscoOccupations._839413)
+      return "839413";
+    if (code == AnzscoOccupations._839900)
+      return "839900";
+    if (code == AnzscoOccupations._839911)
+      return "839911";
+    if (code == AnzscoOccupations._839912)
+      return "839912";
+    if (code == AnzscoOccupations._839913)
+      return "839913";
+    if (code == AnzscoOccupations._839914)
+      return "839914";
+    if (code == AnzscoOccupations._839915)
+      return "839915";
+    if (code == AnzscoOccupations._839916)
+      return "839916";
+    if (code == AnzscoOccupations._839917)
+      return "839917";
+    if (code == AnzscoOccupations._839999)
+      return "839999";
+    if (code == AnzscoOccupations._841000)
+      return "841000";
+    if (code == AnzscoOccupations._841111)
+      return "841111";
+    if (code == AnzscoOccupations._841200)
+      return "841200";
+    if (code == AnzscoOccupations._841211)
+      return "841211";
+    if (code == AnzscoOccupations._841212)
+      return "841212";
+    if (code == AnzscoOccupations._841213)
+      return "841213";
+    if (code == AnzscoOccupations._841214)
+      return "841214";
+    if (code == AnzscoOccupations._841215)
+      return "841215";
+    if (code == AnzscoOccupations._841216)
+      return "841216";
+    if (code == AnzscoOccupations._841299)
+      return "841299";
+    if (code == AnzscoOccupations._841300)
+      return "841300";
+    if (code == AnzscoOccupations._841311)
+      return "841311";
+    if (code == AnzscoOccupations._841312)
+      return "841312";
+    if (code == AnzscoOccupations._841313)
+      return "841313";
+    if (code == AnzscoOccupations._841400)
+      return "841400";
+    if (code == AnzscoOccupations._841411)
+      return "841411";
+    if (code == AnzscoOccupations._841412)
+      return "841412";
+    if (code == AnzscoOccupations._841500)
+      return "841500";
+    if (code == AnzscoOccupations._841511)
+      return "841511";
+    if (code == AnzscoOccupations._841512)
+      return "841512";
+    if (code == AnzscoOccupations._841513)
+      return "841513";
+    if (code == AnzscoOccupations._841514)
+      return "841514";
+    if (code == AnzscoOccupations._841515)
+      return "841515";
+    if (code == AnzscoOccupations._841516)
+      return "841516";
+    if (code == AnzscoOccupations._841517)
+      return "841517";
+    if (code == AnzscoOccupations._841599)
+      return "841599";
+    if (code == AnzscoOccupations._841611)
+      return "841611";
+    if (code == AnzscoOccupations._841900)
+      return "841900";
+    if (code == AnzscoOccupations._841911)
+      return "841911";
+    if (code == AnzscoOccupations._841912)
+      return "841912";
+    if (code == AnzscoOccupations._841999)
+      return "841999";
+    if (code == AnzscoOccupations._851000)
+      return "851000";
+    if (code == AnzscoOccupations._851111)
+      return "851111";
+    if (code == AnzscoOccupations._851200)
+      return "851200";
+    if (code == AnzscoOccupations._851211)
+      return "851211";
+    if (code == AnzscoOccupations._851299)
+      return "851299";
+    if (code == AnzscoOccupations._851311)
+      return "851311";
+    if (code == AnzscoOccupations._890000)
+      return "890000";
+    if (code == AnzscoOccupations._891000)
+      return "891000";
+    if (code == AnzscoOccupations._891100)
+      return "891100";
+    if (code == AnzscoOccupations._891111)
+      return "891111";
+    if (code == AnzscoOccupations._891112)
+      return "891112";
+    if (code == AnzscoOccupations._891113)
+      return "891113";
+    if (code == AnzscoOccupations._891211)
+      return "891211";
+    if (code == AnzscoOccupations._899000)
+      return "899000";
+    if (code == AnzscoOccupations._899111)
+      return "899111";
+    if (code == AnzscoOccupations._899200)
+      return "899200";
+    if (code == AnzscoOccupations._899211)
+      return "899211";
+    if (code == AnzscoOccupations._899212)
+      return "899212";
+    if (code == AnzscoOccupations._899311)
+      return "899311";
+    if (code == AnzscoOccupations._899400)
+      return "899400";
+    if (code == AnzscoOccupations._899411)
+      return "899411";
+    if (code == AnzscoOccupations._899412)
+      return "899412";
+    if (code == AnzscoOccupations._899413)
+      return "899413";
+    if (code == AnzscoOccupations._899414)
+      return "899414";
+    if (code == AnzscoOccupations._899415)
+      return "899415";
+    if (code == AnzscoOccupations._899500)
+      return "899500";
+    if (code == AnzscoOccupations._899511)
+      return "899511";
+    if (code == AnzscoOccupations._899512)
+      return "899512";
+    if (code == AnzscoOccupations._899611)
+      return "899611";
+    if (code == AnzscoOccupations._899711)
+      return "899711";
+    if (code == AnzscoOccupations._899900)
+      return "899900";
+    if (code == AnzscoOccupations._899911)
+      return "899911";
+    if (code == AnzscoOccupations._899912)
+      return "899912";
+    if (code == AnzscoOccupations._899913)
+      return "899913";
+    if (code == AnzscoOccupations._899914)
+      return "899914";
+    if (code == AnzscoOccupations._899915)
+      return "899915";
+    if (code == AnzscoOccupations._899916)
+      return "899916";
+    if (code == AnzscoOccupations._899917)
+      return "899917";
+    if (code == AnzscoOccupations._899918)
+      return "899918";
+    if (code == AnzscoOccupations._899921)
+      return "899921";
+    if (code == AnzscoOccupations._899922)
+      return "899922";
+    if (code == AnzscoOccupations._899999)
+      return "899999";
+    return "?";
+  }
+
+    public String toSystem(AnzscoOccupations code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Appointmentstatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Appointmentstatus.java
new file mode 100644
index 00000000000..e002c6c7275
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Appointmentstatus.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Appointmentstatus {
+
+        /**
+         * None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time may not be set yet.
+         */
+        PROPOSED, 
+        /**
+         * Some or all of the participant(s) have not finalized their acceptance of the appointment request.
+         */
+        PENDING, 
+        /**
+         * All participant(s) have been considered and the appointment is confirmed to go ahead at the date/times specified.
+         */
+        BOOKED, 
+        /**
+         * Some of the patients have arrived.
+         */
+        ARRIVED, 
+        /**
+         * This appointment has completed and may have resulted in an encounter.
+         */
+        FULFILLED, 
+        /**
+         * The appointment has been cancelled.
+         */
+        CANCELLED, 
+        /**
+         * Some or all of the participant(s) have not/did not appear for the appointment (usually the patient).
+         */
+        NOSHOW, 
+        /**
+         * This instance should not have been part of this patient's medical record.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Appointmentstatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposed".equals(codeString))
+          return PROPOSED;
+        if ("pending".equals(codeString))
+          return PENDING;
+        if ("booked".equals(codeString))
+          return BOOKED;
+        if ("arrived".equals(codeString))
+          return ARRIVED;
+        if ("fulfilled".equals(codeString))
+          return FULFILLED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("noshow".equals(codeString))
+          return NOSHOW;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown Appointmentstatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSED: return "proposed";
+            case PENDING: return "pending";
+            case BOOKED: return "booked";
+            case ARRIVED: return "arrived";
+            case FULFILLED: return "fulfilled";
+            case CANCELLED: return "cancelled";
+            case NOSHOW: return "noshow";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/appointmentstatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSED: return "None of the participant(s) have finalized their acceptance of the appointment request, and the start/end time may 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 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.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSED: return "Proposed";
+            case PENDING: return "Pending";
+            case BOOKED: return "Booked";
+            case ARRIVED: return "Arrived";
+            case FULFILLED: return "Fulfilled";
+            case CANCELLED: return "Cancelled";
+            case NOSHOW: return "No Show";
+            case ENTEREDINERROR: return "Entered in error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AppointmentstatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AppointmentstatusEnumFactory.java
new file mode 100644
index 00000000000..e0225aadf4a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AppointmentstatusEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AppointmentstatusEnumFactory implements EnumFactory {
+
+  public Appointmentstatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposed".equals(codeString))
+      return Appointmentstatus.PROPOSED;
+    if ("pending".equals(codeString))
+      return Appointmentstatus.PENDING;
+    if ("booked".equals(codeString))
+      return Appointmentstatus.BOOKED;
+    if ("arrived".equals(codeString))
+      return Appointmentstatus.ARRIVED;
+    if ("fulfilled".equals(codeString))
+      return Appointmentstatus.FULFILLED;
+    if ("cancelled".equals(codeString))
+      return Appointmentstatus.CANCELLED;
+    if ("noshow".equals(codeString))
+      return Appointmentstatus.NOSHOW;
+    if ("entered-in-error".equals(codeString))
+      return Appointmentstatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown Appointmentstatus code '"+codeString+"'");
+  }
+
+  public String toCode(Appointmentstatus code) {
+    if (code == Appointmentstatus.PROPOSED)
+      return "proposed";
+    if (code == Appointmentstatus.PENDING)
+      return "pending";
+    if (code == Appointmentstatus.BOOKED)
+      return "booked";
+    if (code == Appointmentstatus.ARRIVED)
+      return "arrived";
+    if (code == Appointmentstatus.FULFILLED)
+      return "fulfilled";
+    if (code == Appointmentstatus.CANCELLED)
+      return "cancelled";
+    if (code == Appointmentstatus.NOSHOW)
+      return "noshow";
+    if (code == Appointmentstatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(Appointmentstatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertDirectionCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertDirectionCodes.java
new file mode 100644
index 00000000000..e02f92e1f9d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertDirectionCodes.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AssertDirectionCodes {
+
+        /**
+         * The assertion is evaluated on the response. This is the default value.
+         */
+        RESPONSE, 
+        /**
+         * The assertion is evaluated on the request.
+         */
+        REQUEST, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AssertDirectionCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("response".equals(codeString))
+          return RESPONSE;
+        if ("request".equals(codeString))
+          return REQUEST;
+        throw new FHIRException("Unknown AssertDirectionCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case RESPONSE: return "response";
+            case REQUEST: return "request";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/assert-direction-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case RESPONSE: return "The assertion is evaluated on the response. This is the default value.";
+            case REQUEST: return "The assertion is evaluated on the request.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case RESPONSE: return "response";
+            case REQUEST: return "request";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertDirectionCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertDirectionCodesEnumFactory.java
new file mode 100644
index 00000000000..ddd057b3e41
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertDirectionCodesEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AssertDirectionCodesEnumFactory implements EnumFactory {
+
+  public AssertDirectionCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("response".equals(codeString))
+      return AssertDirectionCodes.RESPONSE;
+    if ("request".equals(codeString))
+      return AssertDirectionCodes.REQUEST;
+    throw new IllegalArgumentException("Unknown AssertDirectionCodes code '"+codeString+"'");
+  }
+
+  public String toCode(AssertDirectionCodes code) {
+    if (code == AssertDirectionCodes.RESPONSE)
+      return "response";
+    if (code == AssertDirectionCodes.REQUEST)
+      return "request";
+    return "?";
+  }
+
+    public String toSystem(AssertDirectionCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertOperatorCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertOperatorCodes.java
new file mode 100644
index 00000000000..040ee40960c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertOperatorCodes.java
@@ -0,0 +1,168 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AssertOperatorCodes {
+
+        /**
+         * Default value. Equals comparison.
+         */
+        EQUALS, 
+        /**
+         * Not equals comparison.
+         */
+        NOTEQUALS, 
+        /**
+         * Compare value within a known set of values.
+         */
+        IN, 
+        /**
+         * Compare value not within a known set of values.
+         */
+        NOTIN, 
+        /**
+         * Compare value to be greater than a known value.
+         */
+        GREATERTHAN, 
+        /**
+         * Compare value to be less than a known value.
+         */
+        LESSTHAN, 
+        /**
+         * Compare value is empty.
+         */
+        EMPTY, 
+        /**
+         * Compare value is not empty.
+         */
+        NOTEMPTY, 
+        /**
+         * Compare value string contains a known value.
+         */
+        CONTAINS, 
+        /**
+         * Compare value string does not contain a known value.
+         */
+        NOTCONTAINS, 
+        /**
+         * Evaluate the fluentpath expression as a boolean condition.
+         */
+        EVAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AssertOperatorCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("equals".equals(codeString))
+          return EQUALS;
+        if ("notEquals".equals(codeString))
+          return NOTEQUALS;
+        if ("in".equals(codeString))
+          return IN;
+        if ("notIn".equals(codeString))
+          return NOTIN;
+        if ("greaterThan".equals(codeString))
+          return GREATERTHAN;
+        if ("lessThan".equals(codeString))
+          return LESSTHAN;
+        if ("empty".equals(codeString))
+          return EMPTY;
+        if ("notEmpty".equals(codeString))
+          return NOTEMPTY;
+        if ("contains".equals(codeString))
+          return CONTAINS;
+        if ("notContains".equals(codeString))
+          return NOTCONTAINS;
+        if ("eval".equals(codeString))
+          return EVAL;
+        throw new FHIRException("Unknown AssertOperatorCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case EQUALS: return "equals";
+            case NOTEQUALS: return "notEquals";
+            case IN: return "in";
+            case NOTIN: return "notIn";
+            case GREATERTHAN: return "greaterThan";
+            case LESSTHAN: return "lessThan";
+            case EMPTY: return "empty";
+            case NOTEMPTY: return "notEmpty";
+            case CONTAINS: return "contains";
+            case NOTCONTAINS: return "notContains";
+            case EVAL: return "eval";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/assert-operator-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case EQUALS: return "Default value. Equals comparison.";
+            case NOTEQUALS: return "Not equals comparison.";
+            case IN: return "Compare value within a known set of values.";
+            case NOTIN: return "Compare value not within a known set of values.";
+            case GREATERTHAN: return "Compare value to be greater than a known value.";
+            case LESSTHAN: return "Compare value to be less than a known value.";
+            case EMPTY: return "Compare value is empty.";
+            case NOTEMPTY: return "Compare value is not empty.";
+            case CONTAINS: return "Compare value string contains a known value.";
+            case NOTCONTAINS: return "Compare value string does not contain a known value.";
+            case EVAL: return "Evaluate the fluentpath expression as a boolean condition.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case EQUALS: return "equals";
+            case NOTEQUALS: return "notEquals";
+            case IN: return "in";
+            case NOTIN: return "notIn";
+            case GREATERTHAN: return "greaterThan";
+            case LESSTHAN: return "lessThan";
+            case EMPTY: return "empty";
+            case NOTEMPTY: return "notEmpty";
+            case CONTAINS: return "contains";
+            case NOTCONTAINS: return "notContains";
+            case EVAL: return "evaluate";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertOperatorCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertOperatorCodesEnumFactory.java
new file mode 100644
index 00000000000..5ec42fe2274
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertOperatorCodesEnumFactory.java
@@ -0,0 +1,98 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AssertOperatorCodesEnumFactory implements EnumFactory {
+
+  public AssertOperatorCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("equals".equals(codeString))
+      return AssertOperatorCodes.EQUALS;
+    if ("notEquals".equals(codeString))
+      return AssertOperatorCodes.NOTEQUALS;
+    if ("in".equals(codeString))
+      return AssertOperatorCodes.IN;
+    if ("notIn".equals(codeString))
+      return AssertOperatorCodes.NOTIN;
+    if ("greaterThan".equals(codeString))
+      return AssertOperatorCodes.GREATERTHAN;
+    if ("lessThan".equals(codeString))
+      return AssertOperatorCodes.LESSTHAN;
+    if ("empty".equals(codeString))
+      return AssertOperatorCodes.EMPTY;
+    if ("notEmpty".equals(codeString))
+      return AssertOperatorCodes.NOTEMPTY;
+    if ("contains".equals(codeString))
+      return AssertOperatorCodes.CONTAINS;
+    if ("notContains".equals(codeString))
+      return AssertOperatorCodes.NOTCONTAINS;
+    if ("eval".equals(codeString))
+      return AssertOperatorCodes.EVAL;
+    throw new IllegalArgumentException("Unknown AssertOperatorCodes code '"+codeString+"'");
+  }
+
+  public String toCode(AssertOperatorCodes code) {
+    if (code == AssertOperatorCodes.EQUALS)
+      return "equals";
+    if (code == AssertOperatorCodes.NOTEQUALS)
+      return "notEquals";
+    if (code == AssertOperatorCodes.IN)
+      return "in";
+    if (code == AssertOperatorCodes.NOTIN)
+      return "notIn";
+    if (code == AssertOperatorCodes.GREATERTHAN)
+      return "greaterThan";
+    if (code == AssertOperatorCodes.LESSTHAN)
+      return "lessThan";
+    if (code == AssertOperatorCodes.EMPTY)
+      return "empty";
+    if (code == AssertOperatorCodes.NOTEMPTY)
+      return "notEmpty";
+    if (code == AssertOperatorCodes.CONTAINS)
+      return "contains";
+    if (code == AssertOperatorCodes.NOTCONTAINS)
+      return "notContains";
+    if (code == AssertOperatorCodes.EVAL)
+      return "eval";
+    return "?";
+  }
+
+    public String toSystem(AssertOperatorCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertResponseCodeTypes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertResponseCodeTypes.java
new file mode 100644
index 00000000000..8711d3d92e9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertResponseCodeTypes.java
@@ -0,0 +1,177 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AssertResponseCodeTypes {
+
+        /**
+         * Response code is 200.
+         */
+        OKAY, 
+        /**
+         * Response code is 201.
+         */
+        CREATED, 
+        /**
+         * Response code is 204.
+         */
+        NOCONTENT, 
+        /**
+         * Response code is 304.
+         */
+        NOTMODIFIED, 
+        /**
+         * Response code is 400.
+         */
+        BAD, 
+        /**
+         * Response code is 403.
+         */
+        FORBIDDEN, 
+        /**
+         * Response code is 404.
+         */
+        NOTFOUND, 
+        /**
+         * Response code is 405.
+         */
+        METHODNOTALLOWED, 
+        /**
+         * Response code is 409.
+         */
+        CONFLICT, 
+        /**
+         * Response code is 410.
+         */
+        GONE, 
+        /**
+         * Response code is 412.
+         */
+        PRECONDITIONFAILED, 
+        /**
+         * Response code is 422.
+         */
+        UNPROCESSABLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AssertResponseCodeTypes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("okay".equals(codeString))
+          return OKAY;
+        if ("created".equals(codeString))
+          return CREATED;
+        if ("noContent".equals(codeString))
+          return NOCONTENT;
+        if ("notModified".equals(codeString))
+          return NOTMODIFIED;
+        if ("bad".equals(codeString))
+          return BAD;
+        if ("forbidden".equals(codeString))
+          return FORBIDDEN;
+        if ("notFound".equals(codeString))
+          return NOTFOUND;
+        if ("methodNotAllowed".equals(codeString))
+          return METHODNOTALLOWED;
+        if ("conflict".equals(codeString))
+          return CONFLICT;
+        if ("gone".equals(codeString))
+          return GONE;
+        if ("preconditionFailed".equals(codeString))
+          return PRECONDITIONFAILED;
+        if ("unprocessable".equals(codeString))
+          return UNPROCESSABLE;
+        throw new FHIRException("Unknown AssertResponseCodeTypes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OKAY: return "okay";
+            case CREATED: return "created";
+            case NOCONTENT: return "noContent";
+            case NOTMODIFIED: return "notModified";
+            case BAD: return "bad";
+            case FORBIDDEN: return "forbidden";
+            case NOTFOUND: return "notFound";
+            case METHODNOTALLOWED: return "methodNotAllowed";
+            case CONFLICT: return "conflict";
+            case GONE: return "gone";
+            case PRECONDITIONFAILED: return "preconditionFailed";
+            case UNPROCESSABLE: return "unprocessable";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/assert-response-code-types";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OKAY: return "Response code is 200.";
+            case CREATED: return "Response code is 201.";
+            case NOCONTENT: return "Response code is 204.";
+            case NOTMODIFIED: return "Response code is 304.";
+            case BAD: return "Response code is 400.";
+            case FORBIDDEN: return "Response code is 403.";
+            case NOTFOUND: return "Response code is 404.";
+            case METHODNOTALLOWED: return "Response code is 405.";
+            case CONFLICT: return "Response code is 409.";
+            case GONE: return "Response code is 410.";
+            case PRECONDITIONFAILED: return "Response code is 412.";
+            case UNPROCESSABLE: return "Response code is 422.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OKAY: return "okay";
+            case CREATED: return "created";
+            case NOCONTENT: return "noContent";
+            case NOTMODIFIED: return "notModified";
+            case BAD: return "bad";
+            case FORBIDDEN: return "forbidden";
+            case NOTFOUND: return "notFound";
+            case METHODNOTALLOWED: return "methodNotAllowed";
+            case CONFLICT: return "conflict";
+            case GONE: return "gone";
+            case PRECONDITIONFAILED: return "preconditionFailed";
+            case UNPROCESSABLE: return "unprocessable";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertResponseCodeTypesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertResponseCodeTypesEnumFactory.java
new file mode 100644
index 00000000000..ec261da7708
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AssertResponseCodeTypesEnumFactory.java
@@ -0,0 +1,102 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AssertResponseCodeTypesEnumFactory implements EnumFactory {
+
+  public AssertResponseCodeTypes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("okay".equals(codeString))
+      return AssertResponseCodeTypes.OKAY;
+    if ("created".equals(codeString))
+      return AssertResponseCodeTypes.CREATED;
+    if ("noContent".equals(codeString))
+      return AssertResponseCodeTypes.NOCONTENT;
+    if ("notModified".equals(codeString))
+      return AssertResponseCodeTypes.NOTMODIFIED;
+    if ("bad".equals(codeString))
+      return AssertResponseCodeTypes.BAD;
+    if ("forbidden".equals(codeString))
+      return AssertResponseCodeTypes.FORBIDDEN;
+    if ("notFound".equals(codeString))
+      return AssertResponseCodeTypes.NOTFOUND;
+    if ("methodNotAllowed".equals(codeString))
+      return AssertResponseCodeTypes.METHODNOTALLOWED;
+    if ("conflict".equals(codeString))
+      return AssertResponseCodeTypes.CONFLICT;
+    if ("gone".equals(codeString))
+      return AssertResponseCodeTypes.GONE;
+    if ("preconditionFailed".equals(codeString))
+      return AssertResponseCodeTypes.PRECONDITIONFAILED;
+    if ("unprocessable".equals(codeString))
+      return AssertResponseCodeTypes.UNPROCESSABLE;
+    throw new IllegalArgumentException("Unknown AssertResponseCodeTypes code '"+codeString+"'");
+  }
+
+  public String toCode(AssertResponseCodeTypes code) {
+    if (code == AssertResponseCodeTypes.OKAY)
+      return "okay";
+    if (code == AssertResponseCodeTypes.CREATED)
+      return "created";
+    if (code == AssertResponseCodeTypes.NOCONTENT)
+      return "noContent";
+    if (code == AssertResponseCodeTypes.NOTMODIFIED)
+      return "notModified";
+    if (code == AssertResponseCodeTypes.BAD)
+      return "bad";
+    if (code == AssertResponseCodeTypes.FORBIDDEN)
+      return "forbidden";
+    if (code == AssertResponseCodeTypes.NOTFOUND)
+      return "notFound";
+    if (code == AssertResponseCodeTypes.METHODNOTALLOWED)
+      return "methodNotAllowed";
+    if (code == AssertResponseCodeTypes.CONFLICT)
+      return "conflict";
+    if (code == AssertResponseCodeTypes.GONE)
+      return "gone";
+    if (code == AssertResponseCodeTypes.PRECONDITIONFAILED)
+      return "preconditionFailed";
+    if (code == AssertResponseCodeTypes.UNPROCESSABLE)
+      return "unprocessable";
+    return "?";
+  }
+
+    public String toSystem(AssertResponseCodeTypes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEntityType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEntityType.java
new file mode 100644
index 00000000000..8e4d7dd9d06
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEntityType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AuditEntityType {
+
+        /**
+         * Person
+         */
+        _1, 
+        /**
+         * System Object
+         */
+        _2, 
+        /**
+         * Organization
+         */
+        _3, 
+        /**
+         * Other
+         */
+        _4, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AuditEntityType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        throw new FHIRException("Unknown AuditEntityType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/audit-entity-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "Person";
+            case _2: return "System Object";
+            case _3: return "Organization";
+            case _4: return "Other";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Person";
+            case _2: return "System Object";
+            case _3: return "Organization";
+            case _4: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEntityTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEntityTypeEnumFactory.java
new file mode 100644
index 00000000000..f0e8e244019
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEntityTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AuditEntityTypeEnumFactory implements EnumFactory {
+
+  public AuditEntityType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return AuditEntityType._1;
+    if ("2".equals(codeString))
+      return AuditEntityType._2;
+    if ("3".equals(codeString))
+      return AuditEntityType._3;
+    if ("4".equals(codeString))
+      return AuditEntityType._4;
+    throw new IllegalArgumentException("Unknown AuditEntityType code '"+codeString+"'");
+  }
+
+  public String toCode(AuditEntityType code) {
+    if (code == AuditEntityType._1)
+      return "1";
+    if (code == AuditEntityType._2)
+      return "2";
+    if (code == AuditEntityType._3)
+      return "3";
+    if (code == AuditEntityType._4)
+      return "4";
+    return "?";
+  }
+
+    public String toSystem(AuditEntityType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventAction.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventAction.java
new file mode 100644
index 00000000000..712faa20caa
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventAction.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AuditEventAction {
+
+        /**
+         * Create a new database object, such as placing an order.
+         */
+        C, 
+        /**
+         * Display or print data, such as a doctor census.
+         */
+        R, 
+        /**
+         * Update data, such as revise patient information.
+         */
+        U, 
+        /**
+         * Delete items, such as a doctor master file record.
+         */
+        D, 
+        /**
+         * Perform a system or application function such as log-on, program execution or use of an object's method, or perform a query/search operation.
+         */
+        E, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AuditEventAction fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("C".equals(codeString))
+          return C;
+        if ("R".equals(codeString))
+          return R;
+        if ("U".equals(codeString))
+          return U;
+        if ("D".equals(codeString))
+          return D;
+        if ("E".equals(codeString))
+          return E;
+        throw new FHIRException("Unknown AuditEventAction code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case C: return "C";
+            case R: return "R";
+            case U: return "U";
+            case D: return "D";
+            case E: return "E";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/audit-event-action";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case C: return "Create a new database object, such as placing an order.";
+            case R: return "Display or print data, such as a doctor census.";
+            case U: return "Update data, such as revise patient information.";
+            case D: return "Delete items, such as a doctor master file record.";
+            case E: return "Perform a system or application function such as log-on, program execution or use of an object's method, or perform a query/search operation.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case C: return "Create";
+            case R: return "Read/View/Print";
+            case U: return "Update";
+            case D: return "Delete";
+            case E: return "Execute";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventActionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventActionEnumFactory.java
new file mode 100644
index 00000000000..38da2628590
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventActionEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AuditEventActionEnumFactory implements EnumFactory {
+
+  public AuditEventAction fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("C".equals(codeString))
+      return AuditEventAction.C;
+    if ("R".equals(codeString))
+      return AuditEventAction.R;
+    if ("U".equals(codeString))
+      return AuditEventAction.U;
+    if ("D".equals(codeString))
+      return AuditEventAction.D;
+    if ("E".equals(codeString))
+      return AuditEventAction.E;
+    throw new IllegalArgumentException("Unknown AuditEventAction code '"+codeString+"'");
+  }
+
+  public String toCode(AuditEventAction code) {
+    if (code == AuditEventAction.C)
+      return "C";
+    if (code == AuditEventAction.R)
+      return "R";
+    if (code == AuditEventAction.U)
+      return "U";
+    if (code == AuditEventAction.D)
+      return "D";
+    if (code == AuditEventAction.E)
+      return "E";
+    return "?";
+  }
+
+    public String toSystem(AuditEventAction code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventOutcome.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventOutcome.java
new file mode 100644
index 00000000000..785ae535add
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventOutcome.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AuditEventOutcome {
+
+        /**
+         * The operation completed successfully (whether with warnings or not).
+         */
+        _0, 
+        /**
+         * The action was not successful due to some kind of catered for error (often equivalent to an HTTP 400 response).
+         */
+        _4, 
+        /**
+         * The action was not successful due to some kind of unexpected error (often equivalent to an HTTP 500 response).
+         */
+        _8, 
+        /**
+         * An error of such magnitude occurred that the system is no longer available for use (i.e. the system died).
+         */
+        _12, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AuditEventOutcome fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("0".equals(codeString))
+          return _0;
+        if ("4".equals(codeString))
+          return _4;
+        if ("8".equals(codeString))
+          return _8;
+        if ("12".equals(codeString))
+          return _12;
+        throw new FHIRException("Unknown AuditEventOutcome code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _0: return "0";
+            case _4: return "4";
+            case _8: return "8";
+            case _12: return "12";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/audit-event-outcome";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _0: return "The operation completed successfully (whether with warnings or not).";
+            case _4: return "The action was not successful due to some kind of catered for error (often equivalent to an HTTP 400 response).";
+            case _8: return "The action was not successful due to some kind of unexpected error (often equivalent to an HTTP 500 response).";
+            case _12: return "An error of such magnitude occurred that the system is no longer available for use (i.e. the system died).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _0: return "Success";
+            case _4: return "Minor failure";
+            case _8: return "Serious failure";
+            case _12: return "Major failure";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventOutcomeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventOutcomeEnumFactory.java
new file mode 100644
index 00000000000..b2e18f8a2a4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventOutcomeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AuditEventOutcomeEnumFactory implements EnumFactory {
+
+  public AuditEventOutcome fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("0".equals(codeString))
+      return AuditEventOutcome._0;
+    if ("4".equals(codeString))
+      return AuditEventOutcome._4;
+    if ("8".equals(codeString))
+      return AuditEventOutcome._8;
+    if ("12".equals(codeString))
+      return AuditEventOutcome._12;
+    throw new IllegalArgumentException("Unknown AuditEventOutcome code '"+codeString+"'");
+  }
+
+  public String toCode(AuditEventOutcome code) {
+    if (code == AuditEventOutcome._0)
+      return "0";
+    if (code == AuditEventOutcome._4)
+      return "4";
+    if (code == AuditEventOutcome._8)
+      return "8";
+    if (code == AuditEventOutcome._12)
+      return "12";
+    return "?";
+  }
+
+    public String toSystem(AuditEventOutcome code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventType.java
new file mode 100644
index 00000000000..5cc107e8240
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventType.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AuditEventType {
+
+        /**
+         * Audit Event: Execution of a RESTful operation as defined by FHIR.
+         */
+        REST, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AuditEventType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("rest".equals(codeString))
+          return REST;
+        throw new FHIRException("Unknown AuditEventType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REST: return "rest";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/audit-event-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REST: return "Audit Event: Execution of a RESTful operation as defined by FHIR.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REST: return "RESTful Operation";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventTypeEnumFactory.java
new file mode 100644
index 00000000000..9936bac0c56
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditEventTypeEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AuditEventTypeEnumFactory implements EnumFactory {
+
+  public AuditEventType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("rest".equals(codeString))
+      return AuditEventType.REST;
+    throw new IllegalArgumentException("Unknown AuditEventType code '"+codeString+"'");
+  }
+
+  public String toCode(AuditEventType code) {
+    if (code == AuditEventType.REST)
+      return "rest";
+    return "?";
+  }
+
+    public String toSystem(AuditEventType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditSourceType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditSourceType.java
new file mode 100644
index 00000000000..6b305ef5ede
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditSourceType.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum AuditSourceType {
+
+        /**
+         * End-user display device, diagnostic device.
+         */
+        _1, 
+        /**
+         * Data acquisition device or instrument.
+         */
+        _2, 
+        /**
+         * Web Server process or thread.
+         */
+        _3, 
+        /**
+         * Application Server process or thread.
+         */
+        _4, 
+        /**
+         * Database Server process or thread.
+         */
+        _5, 
+        /**
+         * Security server, e.g. a domain controller.
+         */
+        _6, 
+        /**
+         * ISO level 1-3 network component.
+         */
+        _7, 
+        /**
+         * ISO level 4-6 operating software.
+         */
+        _8, 
+        /**
+         * other kind of device (defined by DICOM, but some other code/system can be used).
+         */
+        _9, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static AuditSourceType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("6".equals(codeString))
+          return _6;
+        if ("7".equals(codeString))
+          return _7;
+        if ("8".equals(codeString))
+          return _8;
+        if ("9".equals(codeString))
+          return _9;
+        throw new FHIRException("Unknown AuditSourceType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _8: return "8";
+            case _9: return "9";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/security-source-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "End-user display device, diagnostic device.";
+            case _2: return "Data acquisition device or instrument.";
+            case _3: return "Web Server process or thread.";
+            case _4: return "Application Server process or thread.";
+            case _5: return "Database Server process or thread.";
+            case _6: return "Security server, e.g. a domain controller.";
+            case _7: return "ISO level 1-3 network component.";
+            case _8: return "ISO level 4-6 operating software.";
+            case _9: return "other kind of device (defined by DICOM, but some other code/system can be used).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "User Device";
+            case _2: return "Data Interface";
+            case _3: return "Web Server";
+            case _4: return "Application Server";
+            case _5: return "Database Server";
+            case _6: return "Security Server";
+            case _7: return "Network Device";
+            case _8: return "Network Router";
+            case _9: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditSourceTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditSourceTypeEnumFactory.java
new file mode 100644
index 00000000000..e2e04c6da90
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/AuditSourceTypeEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class AuditSourceTypeEnumFactory implements EnumFactory {
+
+  public AuditSourceType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return AuditSourceType._1;
+    if ("2".equals(codeString))
+      return AuditSourceType._2;
+    if ("3".equals(codeString))
+      return AuditSourceType._3;
+    if ("4".equals(codeString))
+      return AuditSourceType._4;
+    if ("5".equals(codeString))
+      return AuditSourceType._5;
+    if ("6".equals(codeString))
+      return AuditSourceType._6;
+    if ("7".equals(codeString))
+      return AuditSourceType._7;
+    if ("8".equals(codeString))
+      return AuditSourceType._8;
+    if ("9".equals(codeString))
+      return AuditSourceType._9;
+    throw new IllegalArgumentException("Unknown AuditSourceType code '"+codeString+"'");
+  }
+
+  public String toCode(AuditSourceType code) {
+    if (code == AuditSourceType._1)
+      return "1";
+    if (code == AuditSourceType._2)
+      return "2";
+    if (code == AuditSourceType._3)
+      return "3";
+    if (code == AuditSourceType._4)
+      return "4";
+    if (code == AuditSourceType._5)
+      return "5";
+    if (code == AuditSourceType._6)
+      return "6";
+    if (code == AuditSourceType._7)
+      return "7";
+    if (code == AuditSourceType._8)
+      return "8";
+    if (code == AuditSourceType._9)
+      return "9";
+    return "?";
+  }
+
+    public String toSystem(AuditSourceType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BasicResourceType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BasicResourceType.java
new file mode 100644
index 00000000000..90f68438144
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BasicResourceType.java
@@ -0,0 +1,213 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum BasicResourceType {
+
+        /**
+         * An assertion of permission for an activity or set of activities to occur, possibly subject to particular limitations; e.g. surgical consent, information disclosure consent, etc.
+         */
+        CONSENT, 
+        /**
+         * A request that care of a particular type be provided to a patient.  Could involve the transfer of care, a consult, etc.
+         */
+        REFERRAL, 
+        /**
+         * An undesired reaction caused by exposure to some agent (e.g. a medication, immunization, food, or environmental agent).
+         */
+        ADVEVENT, 
+        /**
+         * A request that a time be scheduled for a type of service for a specified patient, potentially subject to other constraints
+         */
+        APTMTREQ, 
+        /**
+         * The transition of a patient or set of material from one location to another
+         */
+        TRANSFER, 
+        /**
+         * The specification of a set of food and/or other nutritional material to be delivered to a patient.
+         */
+        DIET, 
+        /**
+         * An occurrence of a non-care-related event in the healthcare domain, such as approvals, reviews, etc.
+         */
+        ADMINACT, 
+        /**
+         * Record of a situation where a subject was exposed to a substance.  Usually of interest to public health.
+         */
+        EXPOSURE, 
+        /**
+         * A formalized inquiry into the circumstances surrounding a particular unplanned event or potential event for the purposes of identifying possible causes and contributing factors for the event
+         */
+        INVESTIGATION, 
+        /**
+         * A financial instrument used to track costs, charges or other amounts.
+         */
+        ACCOUNT, 
+        /**
+         * A request for payment for goods and/or services.  Includes the idea of a healthcare insurance claim.
+         */
+        INVOICE, 
+        /**
+         * The determination of what will be paid against a particular invoice based on coverage, plan rules, etc.
+         */
+        ADJUDICAT, 
+        /**
+         * A request for a pre-determination of the cost that would be paid under an insurance plan for a hypothetical claim for goods or services
+         */
+        PREDETREQ, 
+        /**
+         * An adjudication of what would be paid under an insurance plan for a hypothetical claim for goods or services
+         */
+        PREDETERMINE, 
+        /**
+         * An investigation to determine information about a particular therapy or product
+         */
+        STUDY, 
+        /**
+         * A set of (possibly conditional) steps to be taken to achieve some aim.  Includes study protocols, treatment protocols, emergency protocols, etc.
+         */
+        PROTOCOL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static BasicResourceType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("consent".equals(codeString))
+          return CONSENT;
+        if ("referral".equals(codeString))
+          return REFERRAL;
+        if ("advevent".equals(codeString))
+          return ADVEVENT;
+        if ("aptmtreq".equals(codeString))
+          return APTMTREQ;
+        if ("transfer".equals(codeString))
+          return TRANSFER;
+        if ("diet".equals(codeString))
+          return DIET;
+        if ("adminact".equals(codeString))
+          return ADMINACT;
+        if ("exposure".equals(codeString))
+          return EXPOSURE;
+        if ("investigation".equals(codeString))
+          return INVESTIGATION;
+        if ("account".equals(codeString))
+          return ACCOUNT;
+        if ("invoice".equals(codeString))
+          return INVOICE;
+        if ("adjudicat".equals(codeString))
+          return ADJUDICAT;
+        if ("predetreq".equals(codeString))
+          return PREDETREQ;
+        if ("predetermine".equals(codeString))
+          return PREDETERMINE;
+        if ("study".equals(codeString))
+          return STUDY;
+        if ("protocol".equals(codeString))
+          return PROTOCOL;
+        throw new FHIRException("Unknown BasicResourceType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CONSENT: return "consent";
+            case REFERRAL: return "referral";
+            case ADVEVENT: return "advevent";
+            case APTMTREQ: return "aptmtreq";
+            case TRANSFER: return "transfer";
+            case DIET: return "diet";
+            case ADMINACT: return "adminact";
+            case EXPOSURE: return "exposure";
+            case INVESTIGATION: return "investigation";
+            case ACCOUNT: return "account";
+            case INVOICE: return "invoice";
+            case ADJUDICAT: return "adjudicat";
+            case PREDETREQ: return "predetreq";
+            case PREDETERMINE: return "predetermine";
+            case STUDY: return "study";
+            case PROTOCOL: return "protocol";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/basic-resource-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CONSENT: return "An assertion of permission for an activity or set of activities to occur, possibly subject to particular limitations; e.g. surgical consent, information disclosure consent, etc.";
+            case REFERRAL: return "A request that care of a particular type be provided to a patient.  Could involve the transfer of care, a consult, etc.";
+            case ADVEVENT: return "An undesired reaction caused by exposure to some agent (e.g. a medication, immunization, food, or environmental agent).";
+            case APTMTREQ: return "A request that a time be scheduled for a type of service for a specified patient, potentially subject to other constraints";
+            case TRANSFER: return "The transition of a patient or set of material from one location to another";
+            case DIET: return "The specification of a set of food and/or other nutritional material to be delivered to a patient.";
+            case ADMINACT: return "An occurrence of a non-care-related event in the healthcare domain, such as approvals, reviews, etc.";
+            case EXPOSURE: return "Record of a situation where a subject was exposed to a substance.  Usually of interest to public health.";
+            case INVESTIGATION: return "A formalized inquiry into the circumstances surrounding a particular unplanned event or potential event for the purposes of identifying possible causes and contributing factors for the event";
+            case ACCOUNT: return "A financial instrument used to track costs, charges or other amounts.";
+            case INVOICE: return "A request for payment for goods and/or services.  Includes the idea of a healthcare insurance claim.";
+            case ADJUDICAT: return "The determination of what will be paid against a particular invoice based on coverage, plan rules, etc.";
+            case PREDETREQ: return "A request for a pre-determination of the cost that would be paid under an insurance plan for a hypothetical claim for goods or services";
+            case PREDETERMINE: return "An adjudication of what would be paid under an insurance plan for a hypothetical claim for goods or services";
+            case STUDY: return "An investigation to determine information about a particular therapy or product";
+            case PROTOCOL: return "A set of (possibly conditional) steps to be taken to achieve some aim.  Includes study protocols, treatment protocols, emergency protocols, etc.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CONSENT: return "Consent";
+            case REFERRAL: return "Referral";
+            case ADVEVENT: return "Adverse Event";
+            case APTMTREQ: return "Appointment Request";
+            case TRANSFER: return "Transfer";
+            case DIET: return "Diet";
+            case ADMINACT: return "Administrative Activity";
+            case EXPOSURE: return "Exposure";
+            case INVESTIGATION: return "Investigation";
+            case ACCOUNT: return "Account";
+            case INVOICE: return "Invoice";
+            case ADJUDICAT: return "Invoice Adjudication";
+            case PREDETREQ: return "Pre-determination Request";
+            case PREDETERMINE: return "Predetermination";
+            case STUDY: return "Study";
+            case PROTOCOL: return "Protocol";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BasicResourceTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BasicResourceTypeEnumFactory.java
new file mode 100644
index 00000000000..19db9856d6f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BasicResourceTypeEnumFactory.java
@@ -0,0 +1,118 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class BasicResourceTypeEnumFactory implements EnumFactory {
+
+  public BasicResourceType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("consent".equals(codeString))
+      return BasicResourceType.CONSENT;
+    if ("referral".equals(codeString))
+      return BasicResourceType.REFERRAL;
+    if ("advevent".equals(codeString))
+      return BasicResourceType.ADVEVENT;
+    if ("aptmtreq".equals(codeString))
+      return BasicResourceType.APTMTREQ;
+    if ("transfer".equals(codeString))
+      return BasicResourceType.TRANSFER;
+    if ("diet".equals(codeString))
+      return BasicResourceType.DIET;
+    if ("adminact".equals(codeString))
+      return BasicResourceType.ADMINACT;
+    if ("exposure".equals(codeString))
+      return BasicResourceType.EXPOSURE;
+    if ("investigation".equals(codeString))
+      return BasicResourceType.INVESTIGATION;
+    if ("account".equals(codeString))
+      return BasicResourceType.ACCOUNT;
+    if ("invoice".equals(codeString))
+      return BasicResourceType.INVOICE;
+    if ("adjudicat".equals(codeString))
+      return BasicResourceType.ADJUDICAT;
+    if ("predetreq".equals(codeString))
+      return BasicResourceType.PREDETREQ;
+    if ("predetermine".equals(codeString))
+      return BasicResourceType.PREDETERMINE;
+    if ("study".equals(codeString))
+      return BasicResourceType.STUDY;
+    if ("protocol".equals(codeString))
+      return BasicResourceType.PROTOCOL;
+    throw new IllegalArgumentException("Unknown BasicResourceType code '"+codeString+"'");
+  }
+
+  public String toCode(BasicResourceType code) {
+    if (code == BasicResourceType.CONSENT)
+      return "consent";
+    if (code == BasicResourceType.REFERRAL)
+      return "referral";
+    if (code == BasicResourceType.ADVEVENT)
+      return "advevent";
+    if (code == BasicResourceType.APTMTREQ)
+      return "aptmtreq";
+    if (code == BasicResourceType.TRANSFER)
+      return "transfer";
+    if (code == BasicResourceType.DIET)
+      return "diet";
+    if (code == BasicResourceType.ADMINACT)
+      return "adminact";
+    if (code == BasicResourceType.EXPOSURE)
+      return "exposure";
+    if (code == BasicResourceType.INVESTIGATION)
+      return "investigation";
+    if (code == BasicResourceType.ACCOUNT)
+      return "account";
+    if (code == BasicResourceType.INVOICE)
+      return "invoice";
+    if (code == BasicResourceType.ADJUDICAT)
+      return "adjudicat";
+    if (code == BasicResourceType.PREDETREQ)
+      return "predetreq";
+    if (code == BasicResourceType.PREDETERMINE)
+      return "predetermine";
+    if (code == BasicResourceType.STUDY)
+      return "study";
+    if (code == BasicResourceType.PROTOCOL)
+      return "protocol";
+    return "?";
+  }
+
+    public String toSystem(BasicResourceType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitCategory.java
new file mode 100644
index 00000000000..0b69b9a0394
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitCategory.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum BenefitCategory {
+
+        /**
+         * Dental and Oral Health Coverage
+         */
+        ORAL, 
+        /**
+         * Vision Health Coverage
+         */
+        VISION, 
+        /**
+         * Medical Health Coverage
+         */
+        MEDICAL, 
+        /**
+         * Pharmacy Coverage
+         */
+        PHARMACY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static BenefitCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("oral".equals(codeString))
+          return ORAL;
+        if ("vision".equals(codeString))
+          return VISION;
+        if ("medical".equals(codeString))
+          return MEDICAL;
+        if ("pharmacy".equals(codeString))
+          return PHARMACY;
+        throw new FHIRException("Unknown BenefitCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ORAL: return "oral";
+            case VISION: return "vision";
+            case MEDICAL: return "medical";
+            case PHARMACY: return "pharmacy";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/benefit-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ORAL: return "Dental and Oral Health Coverage";
+            case VISION: return "Vision Health Coverage";
+            case MEDICAL: return "Medical Health Coverage";
+            case PHARMACY: return "Pharmacy Coverage";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ORAL: return "Dental and Oral Health Coverage";
+            case VISION: return "Vision Health Coverage";
+            case MEDICAL: return "Medical Health Coverage";
+            case PHARMACY: return "Pharmacy Coverage";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitCategoryEnumFactory.java
new file mode 100644
index 00000000000..915f2e0848c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitCategoryEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class BenefitCategoryEnumFactory implements EnumFactory {
+
+  public BenefitCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("oral".equals(codeString))
+      return BenefitCategory.ORAL;
+    if ("vision".equals(codeString))
+      return BenefitCategory.VISION;
+    if ("medical".equals(codeString))
+      return BenefitCategory.MEDICAL;
+    if ("pharmacy".equals(codeString))
+      return BenefitCategory.PHARMACY;
+    throw new IllegalArgumentException("Unknown BenefitCategory code '"+codeString+"'");
+  }
+
+  public String toCode(BenefitCategory code) {
+    if (code == BenefitCategory.ORAL)
+      return "oral";
+    if (code == BenefitCategory.VISION)
+      return "vision";
+    if (code == BenefitCategory.MEDICAL)
+      return "medical";
+    if (code == BenefitCategory.PHARMACY)
+      return "pharmacy";
+    return "?";
+  }
+
+    public String toSystem(BenefitCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitNetwork.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitNetwork.java
new file mode 100644
index 00000000000..4e33763fe65
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitNetwork.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum BenefitNetwork {
+
+        /**
+         * Services rendered by a Network provider
+         */
+        IN, 
+        /**
+         * Services rendered by a provider who is not in the Network
+         */
+        OUT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static BenefitNetwork fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("in".equals(codeString))
+          return IN;
+        if ("out".equals(codeString))
+          return OUT;
+        throw new FHIRException("Unknown BenefitNetwork code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case IN: return "in";
+            case OUT: return "out";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/benefit-network";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case IN: return "Services rendered by a Network provider";
+            case OUT: return "Services rendered by a provider who is not in the Network";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case IN: return "In Network";
+            case OUT: return "Out of Network";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitNetworkEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitNetworkEnumFactory.java
new file mode 100644
index 00000000000..564696be9b3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitNetworkEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class BenefitNetworkEnumFactory implements EnumFactory {
+
+  public BenefitNetwork fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("in".equals(codeString))
+      return BenefitNetwork.IN;
+    if ("out".equals(codeString))
+      return BenefitNetwork.OUT;
+    throw new IllegalArgumentException("Unknown BenefitNetwork code '"+codeString+"'");
+  }
+
+  public String toCode(BenefitNetwork code) {
+    if (code == BenefitNetwork.IN)
+      return "in";
+    if (code == BenefitNetwork.OUT)
+      return "out";
+    return "?";
+  }
+
+    public String toSystem(BenefitNetwork code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitSubcategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitSubcategory.java
new file mode 100644
index 00000000000..50beaa02193
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitSubcategory.java
@@ -0,0 +1,321 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum BenefitSubcategory {
+
+        /**
+         * Medical Care.
+         */
+        _1, 
+        /**
+         * Surgical.
+         */
+        _2, 
+        /**
+         * Consultation.
+         */
+        _3, 
+        /**
+         * Diagnostic XRay.
+         */
+        _4, 
+        /**
+         * Diagnostic Lab.
+         */
+        _5, 
+        /**
+         * Renal Supplies excluding Dialysis.
+         */
+        _14, 
+        /**
+         * Diagnostic Dental.
+         */
+        _23, 
+        /**
+         * Periodontics.
+         */
+        _24, 
+        /**
+         * Restorative.
+         */
+        _25, 
+        /**
+         * Endodontics.
+         */
+        _26, 
+        /**
+         * Maxillofacilial Prosthetics.
+         */
+        _27, 
+        /**
+         * Adjunctive Dental Services.
+         */
+        _28, 
+        /**
+         * Health Benefit Plan Coverage.
+         */
+        _30, 
+        /**
+         * Dental Care.
+         */
+        _35, 
+        /**
+         * Dental Crowns.
+         */
+        _36, 
+        /**
+         * Dental Accident.
+         */
+        _37, 
+        /**
+         * Hospital Room and Board.
+         */
+        _49, 
+        /**
+         * Major Medical.
+         */
+        _55, 
+        /**
+         * Medically Related Transportation.
+         */
+        _56, 
+        /**
+         * In-vitro Fertilization.
+         */
+        _61, 
+        /**
+         * MRI Scan.
+         */
+        _62, 
+        /**
+         * Donor Procedures such as organ harvest.
+         */
+        _63, 
+        /**
+         * Maternity.
+         */
+        _69, 
+        /**
+         * Renal dialysis.
+         */
+        _76, 
+        /**
+         * Medical Coverage.
+         */
+        F1, 
+        /**
+         * Dental Coverage.
+         */
+        F3, 
+        /**
+         * Hearing Coverage.
+         */
+        F4, 
+        /**
+         * Vision Coverage.
+         */
+        F6, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static BenefitSubcategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("14".equals(codeString))
+          return _14;
+        if ("23".equals(codeString))
+          return _23;
+        if ("24".equals(codeString))
+          return _24;
+        if ("25".equals(codeString))
+          return _25;
+        if ("26".equals(codeString))
+          return _26;
+        if ("27".equals(codeString))
+          return _27;
+        if ("28".equals(codeString))
+          return _28;
+        if ("30".equals(codeString))
+          return _30;
+        if ("35".equals(codeString))
+          return _35;
+        if ("36".equals(codeString))
+          return _36;
+        if ("37".equals(codeString))
+          return _37;
+        if ("49".equals(codeString))
+          return _49;
+        if ("55".equals(codeString))
+          return _55;
+        if ("56".equals(codeString))
+          return _56;
+        if ("61".equals(codeString))
+          return _61;
+        if ("62".equals(codeString))
+          return _62;
+        if ("63".equals(codeString))
+          return _63;
+        if ("69".equals(codeString))
+          return _69;
+        if ("76".equals(codeString))
+          return _76;
+        if ("F1".equals(codeString))
+          return F1;
+        if ("F3".equals(codeString))
+          return F3;
+        if ("F4".equals(codeString))
+          return F4;
+        if ("F6".equals(codeString))
+          return F6;
+        throw new FHIRException("Unknown BenefitSubcategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _14: return "14";
+            case _23: return "23";
+            case _24: return "24";
+            case _25: return "25";
+            case _26: return "26";
+            case _27: return "27";
+            case _28: return "28";
+            case _30: return "30";
+            case _35: return "35";
+            case _36: return "36";
+            case _37: return "37";
+            case _49: return "49";
+            case _55: return "55";
+            case _56: return "56";
+            case _61: return "61";
+            case _62: return "62";
+            case _63: return "63";
+            case _69: return "69";
+            case _76: return "76";
+            case F1: return "F1";
+            case F3: return "F3";
+            case F4: return "F4";
+            case F6: return "F6";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/benefit-subcategory";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "Medical Care.";
+            case _2: return "Surgical.";
+            case _3: return "Consultation.";
+            case _4: return "Diagnostic XRay.";
+            case _5: return "Diagnostic Lab.";
+            case _14: return "Renal Supplies excluding Dialysis.";
+            case _23: return "Diagnostic Dental.";
+            case _24: return "Periodontics.";
+            case _25: return "Restorative.";
+            case _26: return "Endodontics.";
+            case _27: return "Maxillofacilial Prosthetics.";
+            case _28: return "Adjunctive Dental Services.";
+            case _30: return "Health Benefit Plan Coverage.";
+            case _35: return "Dental Care.";
+            case _36: return "Dental Crowns.";
+            case _37: return "Dental Accident.";
+            case _49: return "Hospital Room and Board.";
+            case _55: return "Major Medical.";
+            case _56: return "Medically Related Transportation.";
+            case _61: return "In-vitro Fertilization.";
+            case _62: return "MRI Scan.";
+            case _63: return "Donor Procedures such as organ harvest.";
+            case _69: return "Maternity.";
+            case _76: return "Renal dialysis.";
+            case F1: return "Medical Coverage.";
+            case F3: return "Dental Coverage.";
+            case F4: return "Hearing Coverage.";
+            case F6: return "Vision Coverage.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Medical Care";
+            case _2: return "Surgical";
+            case _3: return "Consultation";
+            case _4: return "Diagnostic XRay";
+            case _5: return "Diagnostic Lab";
+            case _14: return "Renal Supplies";
+            case _23: return "Diagnostic Dental";
+            case _24: return "Periodontics";
+            case _25: return "Restorative";
+            case _26: return "Endodontics";
+            case _27: return "Maxillofacilial Prosthetics";
+            case _28: return "Adjunctive Dental Services";
+            case _30: return "Health Benefit Plan Coverage";
+            case _35: return "Dental Care";
+            case _36: return "Dental Crowns";
+            case _37: return "Dental Accident";
+            case _49: return "Hospital Room and Board";
+            case _55: return "Major Medical";
+            case _56: return "Medically Related Transportation";
+            case _61: return "In-vitro Fertilization";
+            case _62: return "MRI Scan";
+            case _63: return "Donor Procedures";
+            case _69: return "Maternity";
+            case _76: return "Renal Dialysis";
+            case F1: return "Medical Coverage";
+            case F3: return "Dental Coverage";
+            case F4: return "Hearing Coverage";
+            case F6: return "Vision Coverage";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitSubcategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitSubcategoryEnumFactory.java
new file mode 100644
index 00000000000..ee7e7693f7e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitSubcategoryEnumFactory.java
@@ -0,0 +1,166 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class BenefitSubcategoryEnumFactory implements EnumFactory {
+
+  public BenefitSubcategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return BenefitSubcategory._1;
+    if ("2".equals(codeString))
+      return BenefitSubcategory._2;
+    if ("3".equals(codeString))
+      return BenefitSubcategory._3;
+    if ("4".equals(codeString))
+      return BenefitSubcategory._4;
+    if ("5".equals(codeString))
+      return BenefitSubcategory._5;
+    if ("14".equals(codeString))
+      return BenefitSubcategory._14;
+    if ("23".equals(codeString))
+      return BenefitSubcategory._23;
+    if ("24".equals(codeString))
+      return BenefitSubcategory._24;
+    if ("25".equals(codeString))
+      return BenefitSubcategory._25;
+    if ("26".equals(codeString))
+      return BenefitSubcategory._26;
+    if ("27".equals(codeString))
+      return BenefitSubcategory._27;
+    if ("28".equals(codeString))
+      return BenefitSubcategory._28;
+    if ("30".equals(codeString))
+      return BenefitSubcategory._30;
+    if ("35".equals(codeString))
+      return BenefitSubcategory._35;
+    if ("36".equals(codeString))
+      return BenefitSubcategory._36;
+    if ("37".equals(codeString))
+      return BenefitSubcategory._37;
+    if ("49".equals(codeString))
+      return BenefitSubcategory._49;
+    if ("55".equals(codeString))
+      return BenefitSubcategory._55;
+    if ("56".equals(codeString))
+      return BenefitSubcategory._56;
+    if ("61".equals(codeString))
+      return BenefitSubcategory._61;
+    if ("62".equals(codeString))
+      return BenefitSubcategory._62;
+    if ("63".equals(codeString))
+      return BenefitSubcategory._63;
+    if ("69".equals(codeString))
+      return BenefitSubcategory._69;
+    if ("76".equals(codeString))
+      return BenefitSubcategory._76;
+    if ("F1".equals(codeString))
+      return BenefitSubcategory.F1;
+    if ("F3".equals(codeString))
+      return BenefitSubcategory.F3;
+    if ("F4".equals(codeString))
+      return BenefitSubcategory.F4;
+    if ("F6".equals(codeString))
+      return BenefitSubcategory.F6;
+    throw new IllegalArgumentException("Unknown BenefitSubcategory code '"+codeString+"'");
+  }
+
+  public String toCode(BenefitSubcategory code) {
+    if (code == BenefitSubcategory._1)
+      return "1";
+    if (code == BenefitSubcategory._2)
+      return "2";
+    if (code == BenefitSubcategory._3)
+      return "3";
+    if (code == BenefitSubcategory._4)
+      return "4";
+    if (code == BenefitSubcategory._5)
+      return "5";
+    if (code == BenefitSubcategory._14)
+      return "14";
+    if (code == BenefitSubcategory._23)
+      return "23";
+    if (code == BenefitSubcategory._24)
+      return "24";
+    if (code == BenefitSubcategory._25)
+      return "25";
+    if (code == BenefitSubcategory._26)
+      return "26";
+    if (code == BenefitSubcategory._27)
+      return "27";
+    if (code == BenefitSubcategory._28)
+      return "28";
+    if (code == BenefitSubcategory._30)
+      return "30";
+    if (code == BenefitSubcategory._35)
+      return "35";
+    if (code == BenefitSubcategory._36)
+      return "36";
+    if (code == BenefitSubcategory._37)
+      return "37";
+    if (code == BenefitSubcategory._49)
+      return "49";
+    if (code == BenefitSubcategory._55)
+      return "55";
+    if (code == BenefitSubcategory._56)
+      return "56";
+    if (code == BenefitSubcategory._61)
+      return "61";
+    if (code == BenefitSubcategory._62)
+      return "62";
+    if (code == BenefitSubcategory._63)
+      return "63";
+    if (code == BenefitSubcategory._69)
+      return "69";
+    if (code == BenefitSubcategory._76)
+      return "76";
+    if (code == BenefitSubcategory.F1)
+      return "F1";
+    if (code == BenefitSubcategory.F3)
+      return "F3";
+    if (code == BenefitSubcategory.F4)
+      return "F4";
+    if (code == BenefitSubcategory.F6)
+      return "F6";
+    return "?";
+  }
+
+    public String toSystem(BenefitSubcategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitTerm.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitTerm.java
new file mode 100644
index 00000000000..140ed534a70
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitTerm.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum BenefitTerm {
+
+        /**
+         * Annual, renewing on the anniversary
+         */
+        ANNUAL, 
+        /**
+         * Per day
+         */
+        DAY, 
+        /**
+         * For the total term, lifetime, of the policy or coverage
+         */
+        LIFETIME, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static BenefitTerm fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("annual".equals(codeString))
+          return ANNUAL;
+        if ("day".equals(codeString))
+          return DAY;
+        if ("lifetime".equals(codeString))
+          return LIFETIME;
+        throw new FHIRException("Unknown BenefitTerm code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ANNUAL: return "annual";
+            case DAY: return "day";
+            case LIFETIME: return "lifetime";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/benefit-term";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ANNUAL: return "Annual, renewing on the anniversary";
+            case DAY: return "Per day";
+            case LIFETIME: return "For the total term, lifetime, of the policy or coverage";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ANNUAL: return "Annual";
+            case DAY: return "Day";
+            case LIFETIME: return "Lifetime";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitTermEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitTermEnumFactory.java
new file mode 100644
index 00000000000..6a17d483278
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitTermEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class BenefitTermEnumFactory implements EnumFactory {
+
+  public BenefitTerm fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("annual".equals(codeString))
+      return BenefitTerm.ANNUAL;
+    if ("day".equals(codeString))
+      return BenefitTerm.DAY;
+    if ("lifetime".equals(codeString))
+      return BenefitTerm.LIFETIME;
+    throw new IllegalArgumentException("Unknown BenefitTerm code '"+codeString+"'");
+  }
+
+  public String toCode(BenefitTerm code) {
+    if (code == BenefitTerm.ANNUAL)
+      return "annual";
+    if (code == BenefitTerm.DAY)
+      return "day";
+    if (code == BenefitTerm.LIFETIME)
+      return "lifetime";
+    return "?";
+  }
+
+    public String toSystem(BenefitTerm code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitType.java
new file mode 100644
index 00000000000..533a11a9ff5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitType.java
@@ -0,0 +1,177 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum BenefitType {
+
+        /**
+         * Maximum benefit allowable.
+         */
+        BENEFIT, 
+        /**
+         * Cost to be incurred before benefits are applied
+         */
+        DEDUCTABLE, 
+        /**
+         * Service visit
+         */
+        VISIT, 
+        /**
+         * Type of room
+         */
+        ROOM, 
+        /**
+         * Copayment per service
+         */
+        COPAY, 
+        /**
+         * Copayment percentage per service
+         */
+        COPAYPERCENT, 
+        /**
+         * Copayment maximum per service
+         */
+        COPAYMAXIMUM, 
+        /**
+         * Vision Exam
+         */
+        VISIONEXAM, 
+        /**
+         * Frames and lenses
+         */
+        VISIONGLASSES, 
+        /**
+         * Contact Lenses
+         */
+        VISIONCONTACTS, 
+        /**
+         * Medical Primary Health Coverage
+         */
+        MEDICALPRIMARYCARE, 
+        /**
+         * Pharmacy Dispense Coverage
+         */
+        PHARMACYDISPENSE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static BenefitType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("benefit".equals(codeString))
+          return BENEFIT;
+        if ("deductable".equals(codeString))
+          return DEDUCTABLE;
+        if ("visit".equals(codeString))
+          return VISIT;
+        if ("room".equals(codeString))
+          return ROOM;
+        if ("copay".equals(codeString))
+          return COPAY;
+        if ("copay-percent".equals(codeString))
+          return COPAYPERCENT;
+        if ("copay-maximum".equals(codeString))
+          return COPAYMAXIMUM;
+        if ("vision-exam".equals(codeString))
+          return VISIONEXAM;
+        if ("vision-glasses".equals(codeString))
+          return VISIONGLASSES;
+        if ("vision-contacts".equals(codeString))
+          return VISIONCONTACTS;
+        if ("medical-primarycare".equals(codeString))
+          return MEDICALPRIMARYCARE;
+        if ("pharmacy-dispense".equals(codeString))
+          return PHARMACYDISPENSE;
+        throw new FHIRException("Unknown BenefitType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BENEFIT: return "benefit";
+            case DEDUCTABLE: return "deductable";
+            case VISIT: return "visit";
+            case ROOM: return "room";
+            case COPAY: return "copay";
+            case COPAYPERCENT: return "copay-percent";
+            case COPAYMAXIMUM: return "copay-maximum";
+            case VISIONEXAM: return "vision-exam";
+            case VISIONGLASSES: return "vision-glasses";
+            case VISIONCONTACTS: return "vision-contacts";
+            case MEDICALPRIMARYCARE: return "medical-primarycare";
+            case PHARMACYDISPENSE: return "pharmacy-dispense";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/benefit-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BENEFIT: return "Maximum benefit allowable.";
+            case DEDUCTABLE: return "Cost to be incurred before benefits are applied";
+            case VISIT: return "Service visit";
+            case ROOM: return "Type of room";
+            case COPAY: return "Copayment per service";
+            case COPAYPERCENT: return "Copayment percentage per service";
+            case COPAYMAXIMUM: return "Copayment maximum per service";
+            case VISIONEXAM: return "Vision Exam";
+            case VISIONGLASSES: return "Frames and lenses";
+            case VISIONCONTACTS: return "Contact Lenses";
+            case MEDICALPRIMARYCARE: return "Medical Primary Health Coverage";
+            case PHARMACYDISPENSE: return "Pharmacy Dispense Coverage";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BENEFIT: return "Benefit";
+            case DEDUCTABLE: return "Deductable";
+            case VISIT: return "Visit";
+            case ROOM: return "Room";
+            case COPAY: return "Copayment per service";
+            case COPAYPERCENT: return "Copayment Percent per service";
+            case COPAYMAXIMUM: return "Copayment maximum per service";
+            case VISIONEXAM: return "Vision Exam";
+            case VISIONGLASSES: return "Vision Glasses";
+            case VISIONCONTACTS: return "Vision Contacts Coverage";
+            case MEDICALPRIMARYCARE: return "Medical Primary Health Coverage";
+            case PHARMACYDISPENSE: return "Pharmacy Dispense Coverage";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitTypeEnumFactory.java
new file mode 100644
index 00000000000..f150c8f34d5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitTypeEnumFactory.java
@@ -0,0 +1,102 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class BenefitTypeEnumFactory implements EnumFactory {
+
+  public BenefitType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("benefit".equals(codeString))
+      return BenefitType.BENEFIT;
+    if ("deductable".equals(codeString))
+      return BenefitType.DEDUCTABLE;
+    if ("visit".equals(codeString))
+      return BenefitType.VISIT;
+    if ("room".equals(codeString))
+      return BenefitType.ROOM;
+    if ("copay".equals(codeString))
+      return BenefitType.COPAY;
+    if ("copay-percent".equals(codeString))
+      return BenefitType.COPAYPERCENT;
+    if ("copay-maximum".equals(codeString))
+      return BenefitType.COPAYMAXIMUM;
+    if ("vision-exam".equals(codeString))
+      return BenefitType.VISIONEXAM;
+    if ("vision-glasses".equals(codeString))
+      return BenefitType.VISIONGLASSES;
+    if ("vision-contacts".equals(codeString))
+      return BenefitType.VISIONCONTACTS;
+    if ("medical-primarycare".equals(codeString))
+      return BenefitType.MEDICALPRIMARYCARE;
+    if ("pharmacy-dispense".equals(codeString))
+      return BenefitType.PHARMACYDISPENSE;
+    throw new IllegalArgumentException("Unknown BenefitType code '"+codeString+"'");
+  }
+
+  public String toCode(BenefitType code) {
+    if (code == BenefitType.BENEFIT)
+      return "benefit";
+    if (code == BenefitType.DEDUCTABLE)
+      return "deductable";
+    if (code == BenefitType.VISIT)
+      return "visit";
+    if (code == BenefitType.ROOM)
+      return "room";
+    if (code == BenefitType.COPAY)
+      return "copay";
+    if (code == BenefitType.COPAYPERCENT)
+      return "copay-percent";
+    if (code == BenefitType.COPAYMAXIMUM)
+      return "copay-maximum";
+    if (code == BenefitType.VISIONEXAM)
+      return "vision-exam";
+    if (code == BenefitType.VISIONGLASSES)
+      return "vision-glasses";
+    if (code == BenefitType.VISIONCONTACTS)
+      return "vision-contacts";
+    if (code == BenefitType.MEDICALPRIMARYCARE)
+      return "medical-primarycare";
+    if (code == BenefitType.PHARMACYDISPENSE)
+      return "pharmacy-dispense";
+    return "?";
+  }
+
+    public String toSystem(BenefitType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitUnit.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitUnit.java
new file mode 100644
index 00000000000..136fbd0fad0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitUnit.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum BenefitUnit {
+
+        /**
+         * A single individual
+         */
+        INDIVIDUAL, 
+        /**
+         * A family, typically includes self, spous(s) and children to a defined age
+         */
+        FAMILY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static BenefitUnit fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("individual".equals(codeString))
+          return INDIVIDUAL;
+        if ("family".equals(codeString))
+          return FAMILY;
+        throw new FHIRException("Unknown BenefitUnit code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INDIVIDUAL: return "individual";
+            case FAMILY: return "family";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/benefit-unit";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INDIVIDUAL: return "A single individual";
+            case FAMILY: return "A family, typically includes self, spous(s) and children to a defined age";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INDIVIDUAL: return "Individual";
+            case FAMILY: return "Family";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitUnitEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitUnitEnumFactory.java
new file mode 100644
index 00000000000..4945d8c3582
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BenefitUnitEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class BenefitUnitEnumFactory implements EnumFactory {
+
+  public BenefitUnit fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("individual".equals(codeString))
+      return BenefitUnit.INDIVIDUAL;
+    if ("family".equals(codeString))
+      return BenefitUnit.FAMILY;
+    throw new IllegalArgumentException("Unknown BenefitUnit code '"+codeString+"'");
+  }
+
+  public String toCode(BenefitUnit code) {
+    if (code == BenefitUnit.INDIVIDUAL)
+      return "individual";
+    if (code == BenefitUnit.FAMILY)
+      return "family";
+    return "?";
+  }
+
+    public String toSystem(BenefitUnit code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BindingStrength.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BindingStrength.java
new file mode 100644
index 00000000000..f394a4583e1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BindingStrength.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum BindingStrength {
+
+        /**
+         * To be conformant, the concept in this element SHALL be from the specified value set
+         */
+        REQUIRED, 
+        /**
+         * To be conformant, the concept in this element SHALL be from the specified value set if any of the codes within the value set can apply to the concept being communicated.  If the value set does not cover the concept (based on human review), alternate codings (or, data type allowing, text) may be included instead.
+         */
+        EXTENSIBLE, 
+        /**
+         * Instances are encouraged to draw from the specified codes for interoperability purposes but are not required to do so to be considered conformant.
+         */
+        PREFERRED, 
+        /**
+         * Instances are not expected or even encouraged to draw from the specified value set.  The value set merely provides examples of the types of concepts intended to be included.
+         */
+        EXAMPLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static BindingStrength fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("required".equals(codeString))
+          return REQUIRED;
+        if ("extensible".equals(codeString))
+          return EXTENSIBLE;
+        if ("preferred".equals(codeString))
+          return PREFERRED;
+        if ("example".equals(codeString))
+          return EXAMPLE;
+        throw new FHIRException("Unknown BindingStrength code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REQUIRED: return "required";
+            case EXTENSIBLE: return "extensible";
+            case PREFERRED: return "preferred";
+            case EXAMPLE: return "example";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/binding-strength";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REQUIRED: return "To be conformant, the concept in this element SHALL be from the specified value set";
+            case EXTENSIBLE: return "To be conformant, the concept in this element SHALL be from the specified value set if any of the codes within the value set can apply to the concept being communicated.  If the value set does not cover the concept (based on human review), alternate codings (or, data type allowing, text) may be included instead.";
+            case PREFERRED: return "Instances are encouraged to draw from the specified codes for interoperability purposes but are not required to do so to be considered conformant.";
+            case EXAMPLE: return "Instances are not expected or even encouraged to draw from the specified value set.  The value set merely provides examples of the types of concepts intended to be included.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REQUIRED: return "Required";
+            case EXTENSIBLE: return "Extensible";
+            case PREFERRED: return "Preferred";
+            case EXAMPLE: return "Example";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BindingStrengthEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BindingStrengthEnumFactory.java
new file mode 100644
index 00000000000..3221ecf63a8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BindingStrengthEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class BindingStrengthEnumFactory implements EnumFactory {
+
+  public BindingStrength fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("required".equals(codeString))
+      return BindingStrength.REQUIRED;
+    if ("extensible".equals(codeString))
+      return BindingStrength.EXTENSIBLE;
+    if ("preferred".equals(codeString))
+      return BindingStrength.PREFERRED;
+    if ("example".equals(codeString))
+      return BindingStrength.EXAMPLE;
+    throw new IllegalArgumentException("Unknown BindingStrength code '"+codeString+"'");
+  }
+
+  public String toCode(BindingStrength code) {
+    if (code == BindingStrength.REQUIRED)
+      return "required";
+    if (code == BindingStrength.EXTENSIBLE)
+      return "extensible";
+    if (code == BindingStrength.PREFERRED)
+      return "preferred";
+    if (code == BindingStrength.EXAMPLE)
+      return "example";
+    return "?";
+  }
+
+    public String toSystem(BindingStrength code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BundleType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BundleType.java
new file mode 100644
index 00000000000..3e8e424b09a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BundleType.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum BundleType {
+
+        /**
+         * The bundle is a document. The first resource is a Composition.
+         */
+        DOCUMENT, 
+        /**
+         * The bundle is a message. The first resource is a MessageHeader.
+         */
+        MESSAGE, 
+        /**
+         * The bundle is a transaction - intended to be processed by a server as an atomic commit.
+         */
+        TRANSACTION, 
+        /**
+         * The bundle is a transaction response. Because the response is a transaction response, the transaction has succeeded, and all responses are error free.
+         */
+        TRANSACTIONRESPONSE, 
+        /**
+         * The bundle is a transaction - intended to be processed by a server as a group of actions.
+         */
+        BATCH, 
+        /**
+         * The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success.
+         */
+        BATCHRESPONSE, 
+        /**
+         * The bundle is a list of resources from a history interaction on a server.
+         */
+        HISTORY, 
+        /**
+         * The bundle is a list of resources returned as a result of a search/query interaction, operation, or message.
+         */
+        SEARCHSET, 
+        /**
+         * The bundle is a set of resources collected into a single package for ease of distribution.
+         */
+        COLLECTION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static BundleType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("document".equals(codeString))
+          return DOCUMENT;
+        if ("message".equals(codeString))
+          return MESSAGE;
+        if ("transaction".equals(codeString))
+          return TRANSACTION;
+        if ("transaction-response".equals(codeString))
+          return TRANSACTIONRESPONSE;
+        if ("batch".equals(codeString))
+          return BATCH;
+        if ("batch-response".equals(codeString))
+          return BATCHRESPONSE;
+        if ("history".equals(codeString))
+          return HISTORY;
+        if ("searchset".equals(codeString))
+          return SEARCHSET;
+        if ("collection".equals(codeString))
+          return COLLECTION;
+        throw new FHIRException("Unknown BundleType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DOCUMENT: return "document";
+            case MESSAGE: return "message";
+            case TRANSACTION: return "transaction";
+            case TRANSACTIONRESPONSE: return "transaction-response";
+            case BATCH: return "batch";
+            case BATCHRESPONSE: return "batch-response";
+            case HISTORY: return "history";
+            case SEARCHSET: return "searchset";
+            case COLLECTION: return "collection";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/bundle-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DOCUMENT: return "The bundle is a document. The first resource is a Composition.";
+            case MESSAGE: return "The bundle is a message. The first resource is a MessageHeader.";
+            case TRANSACTION: return "The bundle is a transaction - intended to be processed by a server as an atomic commit.";
+            case TRANSACTIONRESPONSE: return "The bundle is a transaction response. Because the response is a transaction response, the transaction has succeeded, and all responses are error free.";
+            case BATCH: return "The bundle is a transaction - intended to be processed by a server as a group of actions.";
+            case BATCHRESPONSE: return "The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success.";
+            case HISTORY: return "The bundle is a list of resources from a history interaction on a server.";
+            case SEARCHSET: return "The bundle is a list of resources returned as a result of a search/query interaction, operation, or message.";
+            case COLLECTION: return "The bundle is a set of resources collected into a single package for ease of distribution.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DOCUMENT: return "Document";
+            case MESSAGE: return "Message";
+            case TRANSACTION: return "Transaction";
+            case TRANSACTIONRESPONSE: return "Transaction Response";
+            case BATCH: return "Batch";
+            case BATCHRESPONSE: return "Batch Response";
+            case HISTORY: return "History List";
+            case SEARCHSET: return "Search Results";
+            case COLLECTION: return "Collection";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BundleTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BundleTypeEnumFactory.java
new file mode 100644
index 00000000000..975eeeac90b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/BundleTypeEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class BundleTypeEnumFactory implements EnumFactory {
+
+  public BundleType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("document".equals(codeString))
+      return BundleType.DOCUMENT;
+    if ("message".equals(codeString))
+      return BundleType.MESSAGE;
+    if ("transaction".equals(codeString))
+      return BundleType.TRANSACTION;
+    if ("transaction-response".equals(codeString))
+      return BundleType.TRANSACTIONRESPONSE;
+    if ("batch".equals(codeString))
+      return BundleType.BATCH;
+    if ("batch-response".equals(codeString))
+      return BundleType.BATCHRESPONSE;
+    if ("history".equals(codeString))
+      return BundleType.HISTORY;
+    if ("searchset".equals(codeString))
+      return BundleType.SEARCHSET;
+    if ("collection".equals(codeString))
+      return BundleType.COLLECTION;
+    throw new IllegalArgumentException("Unknown BundleType code '"+codeString+"'");
+  }
+
+  public String toCode(BundleType code) {
+    if (code == BundleType.DOCUMENT)
+      return "document";
+    if (code == BundleType.MESSAGE)
+      return "message";
+    if (code == BundleType.TRANSACTION)
+      return "transaction";
+    if (code == BundleType.TRANSACTIONRESPONSE)
+      return "transaction-response";
+    if (code == BundleType.BATCH)
+      return "batch";
+    if (code == BundleType.BATCHRESPONSE)
+      return "batch-response";
+    if (code == BundleType.HISTORY)
+      return "history";
+    if (code == BundleType.SEARCHSET)
+      return "searchset";
+    if (code == BundleType.COLLECTION)
+      return "collection";
+    return "?";
+  }
+
+    public String toSystem(BundleType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CapabilityStatementKind.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CapabilityStatementKind.java
new file mode 100644
index 00000000000..dfc66fcaa9d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CapabilityStatementKind.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CapabilityStatementKind {
+
+        /**
+         * The CapabilityStatement instance represents the present capabilities of a specific system instance.  This is the kind returned by OPTIONS for a FHIR server end-point.
+         */
+        INSTANCE, 
+        /**
+         * The CapabilityStatement instance represents the capabilities of a system or piece of software, independent of a particular installation.
+         */
+        CAPABILITY, 
+        /**
+         * The CapabilityStatement instance represents a set of requirements for other systems to meet; e.g. as part of an implementation guide or 'request for proposal'.
+         */
+        REQUIREMENTS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CapabilityStatementKind fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("instance".equals(codeString))
+          return INSTANCE;
+        if ("capability".equals(codeString))
+          return CAPABILITY;
+        if ("requirements".equals(codeString))
+          return REQUIREMENTS;
+        throw new FHIRException("Unknown CapabilityStatementKind code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INSTANCE: return "instance";
+            case CAPABILITY: return "capability";
+            case REQUIREMENTS: return "requirements";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/capability-statement-kind";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INSTANCE: return "The CapabilityStatement instance represents the present capabilities of a specific system instance.  This is the kind returned by OPTIONS for a FHIR server end-point.";
+            case CAPABILITY: return "The CapabilityStatement instance represents the capabilities of a system or piece of software, independent of a particular installation.";
+            case REQUIREMENTS: return "The CapabilityStatement instance represents a set of requirements for other systems to meet; e.g. as part of an implementation guide or 'request for proposal'.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INSTANCE: return "Instance";
+            case CAPABILITY: return "Capability";
+            case REQUIREMENTS: return "Requirements";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CapabilityStatementKindEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CapabilityStatementKindEnumFactory.java
new file mode 100644
index 00000000000..97a8c52f4ec
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CapabilityStatementKindEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CapabilityStatementKindEnumFactory implements EnumFactory {
+
+  public CapabilityStatementKind fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("instance".equals(codeString))
+      return CapabilityStatementKind.INSTANCE;
+    if ("capability".equals(codeString))
+      return CapabilityStatementKind.CAPABILITY;
+    if ("requirements".equals(codeString))
+      return CapabilityStatementKind.REQUIREMENTS;
+    throw new IllegalArgumentException("Unknown CapabilityStatementKind code '"+codeString+"'");
+  }
+
+  public String toCode(CapabilityStatementKind code) {
+    if (code == CapabilityStatementKind.INSTANCE)
+      return "instance";
+    if (code == CapabilityStatementKind.CAPABILITY)
+      return "capability";
+    if (code == CapabilityStatementKind.REQUIREMENTS)
+      return "requirements";
+    return "?";
+  }
+
+    public String toSystem(CapabilityStatementKind code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityCategory.java
new file mode 100644
index 00000000000..826e872e035
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityCategory.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CarePlanActivityCategory {
+
+        /**
+         * Plan for the patient to consume food of a specified nature
+         */
+        DIET, 
+        /**
+         * Plan for the patient to consume/receive a drug, vaccine or other product
+         */
+        DRUG, 
+        /**
+         * Plan to meet or communicate with the patient (in-patient, out-patient, phone call, etc.)
+         */
+        ENCOUNTER, 
+        /**
+         * Plan to capture information about a patient (vitals, labs, diagnostic images, etc.)
+         */
+        OBSERVATION, 
+        /**
+         * Plan to modify the patient in some way (surgery, physiotherapy, education, counseling, etc.)
+         */
+        PROCEDURE, 
+        /**
+         * Plan to provide something to the patient (medication, medical supply, etc.)
+         */
+        SUPPLY, 
+        /**
+         * Some other form of action
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CarePlanActivityCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("diet".equals(codeString))
+          return DIET;
+        if ("drug".equals(codeString))
+          return DRUG;
+        if ("encounter".equals(codeString))
+          return ENCOUNTER;
+        if ("observation".equals(codeString))
+          return OBSERVATION;
+        if ("procedure".equals(codeString))
+          return PROCEDURE;
+        if ("supply".equals(codeString))
+          return SUPPLY;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown CarePlanActivityCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DIET: return "diet";
+            case DRUG: return "drug";
+            case ENCOUNTER: return "encounter";
+            case OBSERVATION: return "observation";
+            case PROCEDURE: return "procedure";
+            case SUPPLY: return "supply";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/care-plan-activity-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DIET: return "Plan for the patient to consume food of a specified nature";
+            case DRUG: return "Plan for the patient to consume/receive a drug, vaccine or other product";
+            case ENCOUNTER: return "Plan to meet or communicate with the patient (in-patient, out-patient, phone call, etc.)";
+            case OBSERVATION: return "Plan to capture information about a patient (vitals, labs, diagnostic images, etc.)";
+            case PROCEDURE: return "Plan to modify the patient in some way (surgery, physiotherapy, education, counseling, etc.)";
+            case SUPPLY: return "Plan to provide something to the patient (medication, medical supply, etc.)";
+            case OTHER: return "Some other form of action";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DIET: return "Diet";
+            case DRUG: return "Drug";
+            case ENCOUNTER: return "Encounter";
+            case OBSERVATION: return "Observation";
+            case PROCEDURE: return "Procedure";
+            case SUPPLY: return "Supply";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityCategoryEnumFactory.java
new file mode 100644
index 00000000000..9963068d2eb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityCategoryEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CarePlanActivityCategoryEnumFactory implements EnumFactory {
+
+  public CarePlanActivityCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("diet".equals(codeString))
+      return CarePlanActivityCategory.DIET;
+    if ("drug".equals(codeString))
+      return CarePlanActivityCategory.DRUG;
+    if ("encounter".equals(codeString))
+      return CarePlanActivityCategory.ENCOUNTER;
+    if ("observation".equals(codeString))
+      return CarePlanActivityCategory.OBSERVATION;
+    if ("procedure".equals(codeString))
+      return CarePlanActivityCategory.PROCEDURE;
+    if ("supply".equals(codeString))
+      return CarePlanActivityCategory.SUPPLY;
+    if ("other".equals(codeString))
+      return CarePlanActivityCategory.OTHER;
+    throw new IllegalArgumentException("Unknown CarePlanActivityCategory code '"+codeString+"'");
+  }
+
+  public String toCode(CarePlanActivityCategory code) {
+    if (code == CarePlanActivityCategory.DIET)
+      return "diet";
+    if (code == CarePlanActivityCategory.DRUG)
+      return "drug";
+    if (code == CarePlanActivityCategory.ENCOUNTER)
+      return "encounter";
+    if (code == CarePlanActivityCategory.OBSERVATION)
+      return "observation";
+    if (code == CarePlanActivityCategory.PROCEDURE)
+      return "procedure";
+    if (code == CarePlanActivityCategory.SUPPLY)
+      return "supply";
+    if (code == CarePlanActivityCategory.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(CarePlanActivityCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityStatus.java
new file mode 100644
index 00000000000..5f1702abe50
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CarePlanActivityStatus {
+
+        /**
+         * Activity is planned but no action has yet been taken.
+         */
+        NOTSTARTED, 
+        /**
+         * Appointment or other booking has occurred but activity has not yet begun.
+         */
+        SCHEDULED, 
+        /**
+         * Activity has been started but is not yet complete.
+         */
+        INPROGRESS, 
+        /**
+         * Activity was started but has temporarily ceased with an expectation of resumption at a future time.
+         */
+        ONHOLD, 
+        /**
+         * The activities have been completed (more or less) as planned.
+         */
+        COMPLETED, 
+        /**
+         * The activities have been ended prior to completion (perhaps even before they were started).
+         */
+        CANCELLED, 
+        /**
+         * The authoring system doesn't know the current state of the activity.
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CarePlanActivityStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("not-started".equals(codeString))
+          return NOTSTARTED;
+        if ("scheduled".equals(codeString))
+          return SCHEDULED;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("on-hold".equals(codeString))
+          return ONHOLD;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown CarePlanActivityStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NOTSTARTED: return "not-started";
+            case SCHEDULED: return "scheduled";
+            case INPROGRESS: return "in-progress";
+            case ONHOLD: return "on-hold";
+            case COMPLETED: return "completed";
+            case CANCELLED: return "cancelled";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/care-plan-activity-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NOTSTARTED: return "Activity is planned but no action has yet been taken.";
+            case SCHEDULED: return "Appointment or other booking has occurred but activity has not yet begun.";
+            case INPROGRESS: return "Activity has been started but is not yet complete.";
+            case ONHOLD: return "Activity was started but has temporarily ceased with an expectation of resumption at a future time.";
+            case COMPLETED: return "The activities have been completed (more or less) as planned.";
+            case CANCELLED: return "The activities have been ended prior to completion (perhaps even before they were started).";
+            case UNKNOWN: return "The authoring system doesn't know the current state of the activity.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NOTSTARTED: return "Not Started";
+            case SCHEDULED: return "Scheduled";
+            case INPROGRESS: return "In Progress";
+            case ONHOLD: return "On Hold";
+            case COMPLETED: return "Completed";
+            case CANCELLED: return "Cancelled";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityStatusEnumFactory.java
new file mode 100644
index 00000000000..430cc1a541c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanActivityStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CarePlanActivityStatusEnumFactory implements EnumFactory {
+
+  public CarePlanActivityStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("not-started".equals(codeString))
+      return CarePlanActivityStatus.NOTSTARTED;
+    if ("scheduled".equals(codeString))
+      return CarePlanActivityStatus.SCHEDULED;
+    if ("in-progress".equals(codeString))
+      return CarePlanActivityStatus.INPROGRESS;
+    if ("on-hold".equals(codeString))
+      return CarePlanActivityStatus.ONHOLD;
+    if ("completed".equals(codeString))
+      return CarePlanActivityStatus.COMPLETED;
+    if ("cancelled".equals(codeString))
+      return CarePlanActivityStatus.CANCELLED;
+    if ("unknown".equals(codeString))
+      return CarePlanActivityStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown CarePlanActivityStatus code '"+codeString+"'");
+  }
+
+  public String toCode(CarePlanActivityStatus code) {
+    if (code == CarePlanActivityStatus.NOTSTARTED)
+      return "not-started";
+    if (code == CarePlanActivityStatus.SCHEDULED)
+      return "scheduled";
+    if (code == CarePlanActivityStatus.INPROGRESS)
+      return "in-progress";
+    if (code == CarePlanActivityStatus.ONHOLD)
+      return "on-hold";
+    if (code == CarePlanActivityStatus.COMPLETED)
+      return "completed";
+    if (code == CarePlanActivityStatus.CANCELLED)
+      return "cancelled";
+    if (code == CarePlanActivityStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(CarePlanActivityStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanIntent.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanIntent.java
new file mode 100644
index 00000000000..47c0f9291b4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanIntent.java
@@ -0,0 +1,107 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CarePlanIntent {
+
+        /**
+         * The care plan is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act
+         */
+        PROPOSAL, 
+        /**
+         * The care plan represents an intention to ensure something occurs without providing an authorization for others to act
+         */
+        PLAN, 
+        /**
+         * The care plan represents a request/demand and authorization for action
+         */
+        ORDER, 
+        /**
+         * The care plan represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.
+
+Refer to [[[RequestGroup]]] for additional information on how this status is used
+         */
+        OPTION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CarePlanIntent fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposal".equals(codeString))
+          return PROPOSAL;
+        if ("plan".equals(codeString))
+          return PLAN;
+        if ("order".equals(codeString))
+          return ORDER;
+        if ("option".equals(codeString))
+          return OPTION;
+        throw new FHIRException("Unknown CarePlanIntent code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSAL: return "proposal";
+            case PLAN: return "plan";
+            case ORDER: return "order";
+            case OPTION: return "option";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/care-plan-intent";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSAL: return "The care plan is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act";
+            case PLAN: return "The care plan represents an intention to ensure something occurs without providing an authorization for others to act";
+            case ORDER: return "The care plan represents a request/demand and authorization for action";
+            case OPTION: return "The care plan represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.\n\nRefer to [[[RequestGroup]]] for additional information on how this status is used";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSAL: return "Proposal";
+            case PLAN: return "Plan";
+            case ORDER: return "Order";
+            case OPTION: return "Option";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanIntentEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanIntentEnumFactory.java
new file mode 100644
index 00000000000..7f7c97af2e2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanIntentEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CarePlanIntentEnumFactory implements EnumFactory {
+
+  public CarePlanIntent fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposal".equals(codeString))
+      return CarePlanIntent.PROPOSAL;
+    if ("plan".equals(codeString))
+      return CarePlanIntent.PLAN;
+    if ("order".equals(codeString))
+      return CarePlanIntent.ORDER;
+    if ("option".equals(codeString))
+      return CarePlanIntent.OPTION;
+    throw new IllegalArgumentException("Unknown CarePlanIntent code '"+codeString+"'");
+  }
+
+  public String toCode(CarePlanIntent code) {
+    if (code == CarePlanIntent.PROPOSAL)
+      return "proposal";
+    if (code == CarePlanIntent.PLAN)
+      return "plan";
+    if (code == CarePlanIntent.ORDER)
+      return "order";
+    if (code == CarePlanIntent.OPTION)
+      return "option";
+    return "?";
+  }
+
+    public String toSystem(CarePlanIntent code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanRelationship.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanRelationship.java
new file mode 100644
index 00000000000..11e5ce06a16
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanRelationship.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CarePlanRelationship {
+
+        /**
+         * The referenced plan is considered to be part of this plan.
+         */
+        INCLUDES, 
+        /**
+         * This plan takes the places of the referenced plan.
+         */
+        REPLACES, 
+        /**
+         * This plan provides details about how to perform activities defined at a higher level by the referenced plan.
+         */
+        FULFILLS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CarePlanRelationship fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("includes".equals(codeString))
+          return INCLUDES;
+        if ("replaces".equals(codeString))
+          return REPLACES;
+        if ("fulfills".equals(codeString))
+          return FULFILLS;
+        throw new FHIRException("Unknown CarePlanRelationship code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INCLUDES: return "includes";
+            case REPLACES: return "replaces";
+            case FULFILLS: return "fulfills";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/care-plan-relationship";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INCLUDES: return "The referenced plan is considered to be part of this plan.";
+            case REPLACES: return "This plan takes the places of the referenced plan.";
+            case FULFILLS: return "This plan provides details about how to perform activities defined at a higher level by the referenced plan.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INCLUDES: return "Includes";
+            case REPLACES: return "Replaces";
+            case FULFILLS: return "Fulfills";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanRelationshipEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanRelationshipEnumFactory.java
new file mode 100644
index 00000000000..83db261b1b6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanRelationshipEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CarePlanRelationshipEnumFactory implements EnumFactory {
+
+  public CarePlanRelationship fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("includes".equals(codeString))
+      return CarePlanRelationship.INCLUDES;
+    if ("replaces".equals(codeString))
+      return CarePlanRelationship.REPLACES;
+    if ("fulfills".equals(codeString))
+      return CarePlanRelationship.FULFILLS;
+    throw new IllegalArgumentException("Unknown CarePlanRelationship code '"+codeString+"'");
+  }
+
+  public String toCode(CarePlanRelationship code) {
+    if (code == CarePlanRelationship.INCLUDES)
+      return "includes";
+    if (code == CarePlanRelationship.REPLACES)
+      return "replaces";
+    if (code == CarePlanRelationship.FULFILLS)
+      return "fulfills";
+    return "?";
+  }
+
+    public String toSystem(CarePlanRelationship code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanStatus.java
new file mode 100644
index 00000000000..7c58bb84db6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CarePlanStatus {
+
+        /**
+         * The plan is in development or awaiting use but is not yet intended to be acted upon.
+         */
+        DRAFT, 
+        /**
+         * The plan is intended to be followed and used as part of patient care.
+         */
+        ACTIVE, 
+        /**
+         * The plan has been temporarily stopped but is expected to resume in the future.
+         */
+        SUSPENDED, 
+        /**
+         * The plan is no longer in use and is not expected to be followed or used in patient care.
+         */
+        COMPLETED, 
+        /**
+         * The plan was entered in error and voided.
+         */
+        ENTEREDINERROR, 
+        /**
+         * The plan has been terminated prior to reaching completion (though it may have been replaced by a new plan).
+         */
+        CANCELLED, 
+        /**
+         * The authoring system doesn't know the current state of the care plan.
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CarePlanStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown CarePlanStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case ACTIVE: return "active";
+            case SUSPENDED: return "suspended";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case CANCELLED: return "cancelled";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/care-plan-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "The plan is in development or awaiting use but is not yet intended to be acted upon.";
+            case ACTIVE: return "The plan is intended to be followed and used as part of patient care.";
+            case SUSPENDED: return "The plan has been temporarily stopped but is expected to resume in the future.";
+            case COMPLETED: return "The plan is no longer in use and is not expected to be followed or used in patient care.";
+            case ENTEREDINERROR: return "The plan was entered in error and voided.";
+            case CANCELLED: return "The plan has been terminated prior to reaching completion (though it may have been replaced by a new plan).";
+            case UNKNOWN: return "The authoring system doesn't know the current state of the care plan.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DRAFT: return "Pending";
+            case ACTIVE: return "Active";
+            case SUSPENDED: return "Suspended";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered In Error";
+            case CANCELLED: return "Cancelled";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanStatusEnumFactory.java
new file mode 100644
index 00000000000..3408643aeed
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CarePlanStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CarePlanStatusEnumFactory implements EnumFactory {
+
+  public CarePlanStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return CarePlanStatus.DRAFT;
+    if ("active".equals(codeString))
+      return CarePlanStatus.ACTIVE;
+    if ("suspended".equals(codeString))
+      return CarePlanStatus.SUSPENDED;
+    if ("completed".equals(codeString))
+      return CarePlanStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return CarePlanStatus.ENTEREDINERROR;
+    if ("cancelled".equals(codeString))
+      return CarePlanStatus.CANCELLED;
+    if ("unknown".equals(codeString))
+      return CarePlanStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown CarePlanStatus code '"+codeString+"'");
+  }
+
+  public String toCode(CarePlanStatus code) {
+    if (code == CarePlanStatus.DRAFT)
+      return "draft";
+    if (code == CarePlanStatus.ACTIVE)
+      return "active";
+    if (code == CarePlanStatus.SUSPENDED)
+      return "suspended";
+    if (code == CarePlanStatus.COMPLETED)
+      return "completed";
+    if (code == CarePlanStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == CarePlanStatus.CANCELLED)
+      return "cancelled";
+    if (code == CarePlanStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(CarePlanStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamCategory.java
new file mode 100644
index 00000000000..b459d73c84e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamCategory.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CareTeamCategory {
+
+        /**
+         * This type of team focuses on one specific type of incident, which is non-patient specific. The incident is determined by the context of use.  For example, code team (code red, code blue, medical emergency treatment) or the PICC line team.
+         */
+        EVENT, 
+        /**
+         * This type of team focuses on one specific encounter. The encounter is determined by the context of use.  For example, during an inpatient encounter, the nutrition support care team
+         */
+        ENCOUNTER, 
+        /**
+         * This type of team focuses on one specific episode of care with a defined time period or self-limiting process (e.g. 10 visits). The episode of care is determined by the context of use.  For example, a maternity care team over 9 months.
+         */
+        EPISODE, 
+        /**
+         * This type of team focuses on overall care coordination managing one or more conditions across the continuum of care ensuring there are smooth transitions of care. The members of the team are determined or selected by an individual or organization. When determined by an organization, the team may be assigned or based on the person's enrollment in a particular program. For example, disease management team or patient centered medical home team.
+         */
+        LONGITUDINAL, 
+        /**
+         * This type of team focuses on one specific condition. The condition is determined by the context of use.  For example, a disease management team focused on one condition (e.g. diabetes).
+         */
+        CONDITION, 
+        /**
+         * This type of team is responsible for establishing, conducting, coordinating and monitoring the outcomes of clinical trials. The team focuses on research, clinical care and education.
+         */
+        CLINICALRESEARCH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CareTeamCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("event".equals(codeString))
+          return EVENT;
+        if ("encounter".equals(codeString))
+          return ENCOUNTER;
+        if ("episode".equals(codeString))
+          return EPISODE;
+        if ("longitudinal".equals(codeString))
+          return LONGITUDINAL;
+        if ("condition".equals(codeString))
+          return CONDITION;
+        if ("clinical-research".equals(codeString))
+          return CLINICALRESEARCH;
+        throw new FHIRException("Unknown CareTeamCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case EVENT: return "event";
+            case ENCOUNTER: return "encounter";
+            case EPISODE: return "episode";
+            case LONGITUDINAL: return "longitudinal";
+            case CONDITION: return "condition";
+            case CLINICALRESEARCH: return "clinical-research";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/care-team-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case EVENT: return "This type of team focuses on one specific type of incident, which is non-patient specific. The incident is determined by the context of use.  For example, code team (code red, code blue, medical emergency treatment) or the PICC line team.";
+            case ENCOUNTER: return "This type of team focuses on one specific encounter. The encounter is determined by the context of use.  For example, during an inpatient encounter, the nutrition support care team";
+            case EPISODE: return "This type of team focuses on one specific episode of care with a defined time period or self-limiting process (e.g. 10 visits). The episode of care is determined by the context of use.  For example, a maternity care team over 9 months.";
+            case LONGITUDINAL: return "This type of team focuses on overall care coordination managing one or more conditions across the continuum of care ensuring there are smooth transitions of care. The members of the team are determined or selected by an individual or organization. When determined by an organization, the team may be assigned or based on the person's enrollment in a particular program. For example, disease management team or patient centered medical home team.";
+            case CONDITION: return "This type of team focuses on one specific condition. The condition is determined by the context of use.  For example, a disease management team focused on one condition (e.g. diabetes).";
+            case CLINICALRESEARCH: return "This type of team is responsible for establishing, conducting, coordinating and monitoring the outcomes of clinical trials. The team focuses on research, clinical care and education.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case EVENT: return "Event";
+            case ENCOUNTER: return "Encounter";
+            case EPISODE: return "Episode";
+            case LONGITUDINAL: return "Longitudinal Care Coordination";
+            case CONDITION: return "Condition";
+            case CLINICALRESEARCH: return "Clinical Research";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamCategoryEnumFactory.java
new file mode 100644
index 00000000000..0260bf2b26f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamCategoryEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CareTeamCategoryEnumFactory implements EnumFactory {
+
+  public CareTeamCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("event".equals(codeString))
+      return CareTeamCategory.EVENT;
+    if ("encounter".equals(codeString))
+      return CareTeamCategory.ENCOUNTER;
+    if ("episode".equals(codeString))
+      return CareTeamCategory.EPISODE;
+    if ("longitudinal".equals(codeString))
+      return CareTeamCategory.LONGITUDINAL;
+    if ("condition".equals(codeString))
+      return CareTeamCategory.CONDITION;
+    if ("clinical-research".equals(codeString))
+      return CareTeamCategory.CLINICALRESEARCH;
+    throw new IllegalArgumentException("Unknown CareTeamCategory code '"+codeString+"'");
+  }
+
+  public String toCode(CareTeamCategory code) {
+    if (code == CareTeamCategory.EVENT)
+      return "event";
+    if (code == CareTeamCategory.ENCOUNTER)
+      return "encounter";
+    if (code == CareTeamCategory.EPISODE)
+      return "episode";
+    if (code == CareTeamCategory.LONGITUDINAL)
+      return "longitudinal";
+    if (code == CareTeamCategory.CONDITION)
+      return "condition";
+    if (code == CareTeamCategory.CLINICALRESEARCH)
+      return "clinical-research";
+    return "?";
+  }
+
+    public String toSystem(CareTeamCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamStatus.java
new file mode 100644
index 00000000000..8d5cc5de963
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamStatus.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CareTeamStatus {
+
+        /**
+         * The care team has been drafted and proposed, but not yet participating in the coordination and delivery of care.
+         */
+        PROPOSED, 
+        /**
+         * The care team is currently participating in the coordination and delivery of care.
+         */
+        ACTIVE, 
+        /**
+         * The care team is temporarily on hold or suspended and not participating in the coordination and delivery of care.
+         */
+        SUSPENDED, 
+        /**
+         * The care team was, but is no longer, participating in the coordination and delivery of care.
+         */
+        INACTIVE, 
+        /**
+         * The care team should have never existed.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CareTeamStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposed".equals(codeString))
+          return PROPOSED;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown CareTeamStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSED: return "proposed";
+            case ACTIVE: return "active";
+            case SUSPENDED: return "suspended";
+            case INACTIVE: return "inactive";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/care-team-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSED: return "The care team has been drafted and proposed, but not yet participating in the coordination and delivery of care.";
+            case ACTIVE: return "The care team is currently participating in the coordination and delivery of care.";
+            case SUSPENDED: return "The care team is temporarily on hold or suspended and not participating in the coordination and delivery of care.";
+            case INACTIVE: return "The care team was, but is no longer, participating in the coordination and delivery of care.";
+            case ENTEREDINERROR: return "The care team should have never existed.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSED: return "Proposed";
+            case ACTIVE: return "Active";
+            case SUSPENDED: return "Suspended";
+            case INACTIVE: return "Inactive";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamStatusEnumFactory.java
new file mode 100644
index 00000000000..28933b5eb48
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CareTeamStatusEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CareTeamStatusEnumFactory implements EnumFactory {
+
+  public CareTeamStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposed".equals(codeString))
+      return CareTeamStatus.PROPOSED;
+    if ("active".equals(codeString))
+      return CareTeamStatus.ACTIVE;
+    if ("suspended".equals(codeString))
+      return CareTeamStatus.SUSPENDED;
+    if ("inactive".equals(codeString))
+      return CareTeamStatus.INACTIVE;
+    if ("entered-in-error".equals(codeString))
+      return CareTeamStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown CareTeamStatus code '"+codeString+"'");
+  }
+
+  public String toCode(CareTeamStatus code) {
+    if (code == CareTeamStatus.PROPOSED)
+      return "proposed";
+    if (code == CareTeamStatus.ACTIVE)
+      return "active";
+    if (code == CareTeamStatus.SUSPENDED)
+      return "suspended";
+    if (code == CareTeamStatus.INACTIVE)
+      return "inactive";
+    if (code == CareTeamStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(CareTeamStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentStatus.java
new file mode 100644
index 00000000000..304e5bbefff
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CatalogContentStatus {
+
+        /**
+         * The catalog is approved
+         */
+        APPROVED, 
+        /**
+         * The catalog content is pending some action e.g. confirmation or approval
+         */
+        PENDING, 
+        /**
+         * The catalog is discontinued
+         */
+        DISCONTINUED, 
+        /**
+         * The catalog content is considered official
+         */
+        OFFICIAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CatalogContentStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("approved".equals(codeString))
+          return APPROVED;
+        if ("pending".equals(codeString))
+          return PENDING;
+        if ("discontinued".equals(codeString))
+          return DISCONTINUED;
+        if ("official".equals(codeString))
+          return OFFICIAL;
+        throw new FHIRException("Unknown CatalogContentStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case APPROVED: return "approved";
+            case PENDING: return "pending";
+            case DISCONTINUED: return "discontinued";
+            case OFFICIAL: return "official";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/catalog-content-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case APPROVED: return "The catalog is approved";
+            case PENDING: return "The catalog content is pending some action e.g. confirmation or approval";
+            case DISCONTINUED: return "The catalog is discontinued";
+            case OFFICIAL: return "The catalog content is considered official";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case APPROVED: return "Approved";
+            case PENDING: return "Pending";
+            case DISCONTINUED: return "Discontinued";
+            case OFFICIAL: return "Official";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentStatusEnumFactory.java
new file mode 100644
index 00000000000..ad2f76fd1e7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CatalogContentStatusEnumFactory implements EnumFactory {
+
+  public CatalogContentStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("approved".equals(codeString))
+      return CatalogContentStatus.APPROVED;
+    if ("pending".equals(codeString))
+      return CatalogContentStatus.PENDING;
+    if ("discontinued".equals(codeString))
+      return CatalogContentStatus.DISCONTINUED;
+    if ("official".equals(codeString))
+      return CatalogContentStatus.OFFICIAL;
+    throw new IllegalArgumentException("Unknown CatalogContentStatus code '"+codeString+"'");
+  }
+
+  public String toCode(CatalogContentStatus code) {
+    if (code == CatalogContentStatus.APPROVED)
+      return "approved";
+    if (code == CatalogContentStatus.PENDING)
+      return "pending";
+    if (code == CatalogContentStatus.DISCONTINUED)
+      return "discontinued";
+    if (code == CatalogContentStatus.OFFICIAL)
+      return "official";
+    return "?";
+  }
+
+    public String toSystem(CatalogContentStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentType.java
new file mode 100644
index 00000000000..cb0b00b0bdb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CatalogContentType {
+
+        /**
+         * This is a product submission
+         */
+        SINGLESUBMISSION, 
+        /**
+         * This is a resubmission of a previously submitted item
+         */
+        RESUBMISSION, 
+        /**
+         * This is a full catalog transfer
+         */
+        FULLCATALOG, 
+        /**
+         * This is a differential update
+         */
+        CATALOGUPDATE, 
+        /**
+         * This is a response to a request for catalog information
+         */
+        CATALOGRESPONSE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CatalogContentType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("single-submission".equals(codeString))
+          return SINGLESUBMISSION;
+        if ("resubmission".equals(codeString))
+          return RESUBMISSION;
+        if ("full-catalog".equals(codeString))
+          return FULLCATALOG;
+        if ("catalog-update".equals(codeString))
+          return CATALOGUPDATE;
+        if ("catalog-response".equals(codeString))
+          return CATALOGRESPONSE;
+        throw new FHIRException("Unknown CatalogContentType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SINGLESUBMISSION: return "single-submission";
+            case RESUBMISSION: return "resubmission";
+            case FULLCATALOG: return "full-catalog";
+            case CATALOGUPDATE: return "catalog-update";
+            case CATALOGRESPONSE: return "catalog-response";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/catalog-content-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SINGLESUBMISSION: return "This is a product submission";
+            case RESUBMISSION: return "This is a resubmission of a previously submitted item";
+            case FULLCATALOG: return "This is a full catalog transfer";
+            case CATALOGUPDATE: return "This is a differential update";
+            case CATALOGRESPONSE: return "This is a response to a request for catalog information";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SINGLESUBMISSION: return "Submission";
+            case RESUBMISSION: return "Resubmission";
+            case FULLCATALOG: return "Full Catalog";
+            case CATALOGUPDATE: return "Update";
+            case CATALOGRESPONSE: return "Response";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentTypeEnumFactory.java
new file mode 100644
index 00000000000..491a7d679b6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogContentTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CatalogContentTypeEnumFactory implements EnumFactory {
+
+  public CatalogContentType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("single-submission".equals(codeString))
+      return CatalogContentType.SINGLESUBMISSION;
+    if ("resubmission".equals(codeString))
+      return CatalogContentType.RESUBMISSION;
+    if ("full-catalog".equals(codeString))
+      return CatalogContentType.FULLCATALOG;
+    if ("catalog-update".equals(codeString))
+      return CatalogContentType.CATALOGUPDATE;
+    if ("catalog-response".equals(codeString))
+      return CatalogContentType.CATALOGRESPONSE;
+    throw new IllegalArgumentException("Unknown CatalogContentType code '"+codeString+"'");
+  }
+
+  public String toCode(CatalogContentType code) {
+    if (code == CatalogContentType.SINGLESUBMISSION)
+      return "single-submission";
+    if (code == CatalogContentType.RESUBMISSION)
+      return "resubmission";
+    if (code == CatalogContentType.FULLCATALOG)
+      return "full-catalog";
+    if (code == CatalogContentType.CATALOGUPDATE)
+      return "catalog-update";
+    if (code == CatalogContentType.CATALOGRESPONSE)
+      return "catalog-response";
+    return "?";
+  }
+
+    public String toSystem(CatalogContentType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryStatus.java
new file mode 100644
index 00000000000..0558ff178ae
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CatalogEntryStatus {
+
+        /**
+         * The entry is approved for use
+         */
+        APPROVED, 
+        /**
+         * The entry is pending some action e.g. confirmation or approval
+         */
+        PENDING, 
+        /**
+         * The catalog entry is discontinued
+         */
+        DISCONTINUED, 
+        /**
+         * The catalog entry is considered official
+         */
+        OFFICIAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CatalogEntryStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("approved".equals(codeString))
+          return APPROVED;
+        if ("pending".equals(codeString))
+          return PENDING;
+        if ("discontinued".equals(codeString))
+          return DISCONTINUED;
+        if ("official".equals(codeString))
+          return OFFICIAL;
+        throw new FHIRException("Unknown CatalogEntryStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case APPROVED: return "approved";
+            case PENDING: return "pending";
+            case DISCONTINUED: return "discontinued";
+            case OFFICIAL: return "official";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/catalog-entry-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case APPROVED: return "The entry is approved for use";
+            case PENDING: return "The entry is pending some action e.g. confirmation or approval";
+            case DISCONTINUED: return "The catalog entry is discontinued";
+            case OFFICIAL: return "The catalog entry is considered official";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case APPROVED: return "Approved";
+            case PENDING: return "Pending";
+            case DISCONTINUED: return "Discontinued";
+            case OFFICIAL: return "Official";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryStatusEnumFactory.java
new file mode 100644
index 00000000000..f46dc57f208
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CatalogEntryStatusEnumFactory implements EnumFactory {
+
+  public CatalogEntryStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("approved".equals(codeString))
+      return CatalogEntryStatus.APPROVED;
+    if ("pending".equals(codeString))
+      return CatalogEntryStatus.PENDING;
+    if ("discontinued".equals(codeString))
+      return CatalogEntryStatus.DISCONTINUED;
+    if ("official".equals(codeString))
+      return CatalogEntryStatus.OFFICIAL;
+    throw new IllegalArgumentException("Unknown CatalogEntryStatus code '"+codeString+"'");
+  }
+
+  public String toCode(CatalogEntryStatus code) {
+    if (code == CatalogEntryStatus.APPROVED)
+      return "approved";
+    if (code == CatalogEntryStatus.PENDING)
+      return "pending";
+    if (code == CatalogEntryStatus.DISCONTINUED)
+      return "discontinued";
+    if (code == CatalogEntryStatus.OFFICIAL)
+      return "official";
+    return "?";
+  }
+
+    public String toSystem(CatalogEntryStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryType.java
new file mode 100644
index 00000000000..9285956b552
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CatalogEntryType {
+
+        /**
+         * This is a medication
+         */
+        MEDICATION, 
+        /**
+         * This is a device
+         */
+        DEVICE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CatalogEntryType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("medication".equals(codeString))
+          return MEDICATION;
+        if ("device".equals(codeString))
+          return DEVICE;
+        throw new FHIRException("Unknown CatalogEntryType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MEDICATION: return "medication";
+            case DEVICE: return "device";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/catalog-entry-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MEDICATION: return "This is a medication";
+            case DEVICE: return "This is a device";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MEDICATION: return "Medication";
+            case DEVICE: return "Device";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryTypeEnumFactory.java
new file mode 100644
index 00000000000..8a31ec3a6b8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogEntryTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CatalogEntryTypeEnumFactory implements EnumFactory {
+
+  public CatalogEntryType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("medication".equals(codeString))
+      return CatalogEntryType.MEDICATION;
+    if ("device".equals(codeString))
+      return CatalogEntryType.DEVICE;
+    throw new IllegalArgumentException("Unknown CatalogEntryType code '"+codeString+"'");
+  }
+
+  public String toCode(CatalogEntryType code) {
+    if (code == CatalogEntryType.MEDICATION)
+      return "medication";
+    if (code == CatalogEntryType.DEVICE)
+      return "device";
+    return "?";
+  }
+
+    public String toSystem(CatalogEntryType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogItemRelationType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogItemRelationType.java
new file mode 100644
index 00000000000..2f5b1dd545e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogItemRelationType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CatalogItemRelationType {
+
+        /**
+         * The entry is a package that contains the related entry
+         */
+        PKGCONTAINS, 
+        /**
+         * The entry is contained in the related entry
+         */
+        PKGISCONTAINEDIN, 
+        /**
+         * The entry contains the related entry as a substance
+         */
+        CONTAINSSBST, 
+        /**
+         * The entry combines with the related entry
+         */
+        COMBINESWITH, 
+        /**
+         * The entry requires the related entry for use
+         */
+        REQUIRES, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CatalogItemRelationType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("pkg-contains".equals(codeString))
+          return PKGCONTAINS;
+        if ("pkg-is-contained-in".equals(codeString))
+          return PKGISCONTAINEDIN;
+        if ("contains-sbst".equals(codeString))
+          return CONTAINSSBST;
+        if ("combines-with".equals(codeString))
+          return COMBINESWITH;
+        if ("requires".equals(codeString))
+          return REQUIRES;
+        throw new FHIRException("Unknown CatalogItemRelationType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PKGCONTAINS: return "pkg-contains";
+            case PKGISCONTAINEDIN: return "pkg-is-contained-in";
+            case CONTAINSSBST: return "contains-sbst";
+            case COMBINESWITH: return "combines-with";
+            case REQUIRES: return "requires";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/catalog-item-relation-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PKGCONTAINS: return "The entry is a package that contains the related entry";
+            case PKGISCONTAINEDIN: return "The entry is contained in the related entry";
+            case CONTAINSSBST: return "The entry contains the related entry as a substance";
+            case COMBINESWITH: return "The entry combines with the related entry";
+            case REQUIRES: return "The entry requires the related entry for use";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PKGCONTAINS: return "Package Contains";
+            case PKGISCONTAINEDIN: return "Is contained in Package";
+            case CONTAINSSBST: return "Contains Substance";
+            case COMBINESWITH: return "Combines with";
+            case REQUIRES: return "Requires";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogItemRelationTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogItemRelationTypeEnumFactory.java
new file mode 100644
index 00000000000..a732b71264c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogItemRelationTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CatalogItemRelationTypeEnumFactory implements EnumFactory {
+
+  public CatalogItemRelationType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("pkg-contains".equals(codeString))
+      return CatalogItemRelationType.PKGCONTAINS;
+    if ("pkg-is-contained-in".equals(codeString))
+      return CatalogItemRelationType.PKGISCONTAINEDIN;
+    if ("contains-sbst".equals(codeString))
+      return CatalogItemRelationType.CONTAINSSBST;
+    if ("combines-with".equals(codeString))
+      return CatalogItemRelationType.COMBINESWITH;
+    if ("requires".equals(codeString))
+      return CatalogItemRelationType.REQUIRES;
+    throw new IllegalArgumentException("Unknown CatalogItemRelationType code '"+codeString+"'");
+  }
+
+  public String toCode(CatalogItemRelationType code) {
+    if (code == CatalogItemRelationType.PKGCONTAINS)
+      return "pkg-contains";
+    if (code == CatalogItemRelationType.PKGISCONTAINEDIN)
+      return "pkg-is-contained-in";
+    if (code == CatalogItemRelationType.CONTAINSSBST)
+      return "contains-sbst";
+    if (code == CatalogItemRelationType.COMBINESWITH)
+      return "combines-with";
+    if (code == CatalogItemRelationType.REQUIRES)
+      return "requires";
+    return "?";
+  }
+
+    public String toSystem(CatalogItemRelationType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogUpdateMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogUpdateMode.java
new file mode 100644
index 00000000000..1ad203c3fe4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogUpdateMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CatalogUpdateMode {
+
+        /**
+         * This is a product submission
+         */
+        UPDATE, 
+        /**
+         * The catalog content is expected to be replacing the existing entries
+         */
+        REPLACE, 
+        /**
+         * The catalog content is expected to update the entries, and if not existing, insert the entry
+         */
+        UPSERT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CatalogUpdateMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("update".equals(codeString))
+          return UPDATE;
+        if ("replace".equals(codeString))
+          return REPLACE;
+        if ("upsert".equals(codeString))
+          return UPSERT;
+        throw new FHIRException("Unknown CatalogUpdateMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UPDATE: return "update";
+            case REPLACE: return "replace";
+            case UPSERT: return "upsert";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/catalog-update-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UPDATE: return "This is a product submission";
+            case REPLACE: return "The catalog content is expected to be replacing the existing entries";
+            case UPSERT: return "The catalog content is expected to update the entries, and if not existing, insert the entry";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UPDATE: return "Update";
+            case REPLACE: return "Replace";
+            case UPSERT: return "Upsert";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogUpdateModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogUpdateModeEnumFactory.java
new file mode 100644
index 00000000000..b6eb90e04d8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CatalogUpdateModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CatalogUpdateModeEnumFactory implements EnumFactory {
+
+  public CatalogUpdateMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("update".equals(codeString))
+      return CatalogUpdateMode.UPDATE;
+    if ("replace".equals(codeString))
+      return CatalogUpdateMode.REPLACE;
+    if ("upsert".equals(codeString))
+      return CatalogUpdateMode.UPSERT;
+    throw new IllegalArgumentException("Unknown CatalogUpdateMode code '"+codeString+"'");
+  }
+
+  public String toCode(CatalogUpdateMode code) {
+    if (code == CatalogUpdateMode.UPDATE)
+      return "update";
+    if (code == CatalogUpdateMode.REPLACE)
+      return "replace";
+    if (code == CatalogUpdateMode.UPSERT)
+      return "upsert";
+    return "?";
+  }
+
+    public String toSystem(CatalogUpdateMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemBillingcodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemBillingcodes.java
new file mode 100644
index 00000000000..87546b57c25
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemBillingcodes.java
@@ -0,0 +1,99 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ChargeitemBillingcodes {
+
+        /**
+         * From German EBM billing system:
+Unvorhergesehene Inanspruchnahme des Vertragsarztes durch einen Patienten;zwischen 19:00 und 22:00 Uhr;an Samstagen, Sonntagen und gesetzlichen Feiertagen, am 24.12. und 31.12. zwischen 07:00 und 19:00 Uhr
+         */
+        _1100, 
+        /**
+         * From German EBM billing system:
+Notfallpauschale im organisierten Not(-fall)dienst und für nicht an der vertragsärztlichen Versorgung teilnehmende Ärzte, Institute und Krankenhäuser bei Inanspruchnahme;zwischen 07:00 und 19:00 Uhr
+         */
+        _1210, 
+        /**
+         * From German EBM billing system:
+Grundpauschale für Ärzte, Institute und Krankenhäuser, die zur Erbringung von Leistungen innerhalb mindestens eines der Fachgebiete Anästhesiologie, Frauenheilkunde und Geburtshilfe, Haut- und Geschlechtskrankheiten, Mund-, Kiefer- und Gesichtschirurgie und Humangenetik ermächtigt sind
+         */
+        _1320, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ChargeitemBillingcodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1100".equals(codeString))
+          return _1100;
+        if ("1210".equals(codeString))
+          return _1210;
+        if ("1320".equals(codeString))
+          return _1320;
+        throw new FHIRException("Unknown ChargeitemBillingcodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1100: return "1100";
+            case _1210: return "1210";
+            case _1320: return "1320";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/chargeitem-billingcodes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1100: return "From German EBM billing system:\nUnvorhergesehene Inanspruchnahme des Vertragsarztes durch einen Patienten;zwischen 19:00 und 22:00 Uhr;an Samstagen, Sonntagen und gesetzlichen Feiertagen, am 24.12. und 31.12. zwischen 07:00 und 19:00 Uhr";
+            case _1210: return "From German EBM billing system:\nNotfallpauschale im organisierten Not(-fall)dienst und für nicht an der vertragsärztlichen Versorgung teilnehmende Ärzte, Institute und Krankenhäuser bei Inanspruchnahme;zwischen 07:00 und 19:00 Uhr";
+            case _1320: return "From German EBM billing system:\nGrundpauschale für Ärzte, Institute und Krankenhäuser, die zur Erbringung von Leistungen innerhalb mindestens eines der Fachgebiete Anästhesiologie, Frauenheilkunde und Geburtshilfe, Haut- und Geschlechtskrankheiten, Mund-, Kiefer- und Gesichtschirurgie und Humangenetik ermächtigt sind";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1100: return "Unvorhergesehene Inanspruchnahme";
+            case _1210: return "Notfallpauschale";
+            case _1320: return "Grundpauschale";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemBillingcodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemBillingcodesEnumFactory.java
new file mode 100644
index 00000000000..9d5c60ad921
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemBillingcodesEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ChargeitemBillingcodesEnumFactory implements EnumFactory {
+
+  public ChargeitemBillingcodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1100".equals(codeString))
+      return ChargeitemBillingcodes._1100;
+    if ("1210".equals(codeString))
+      return ChargeitemBillingcodes._1210;
+    if ("1320".equals(codeString))
+      return ChargeitemBillingcodes._1320;
+    throw new IllegalArgumentException("Unknown ChargeitemBillingcodes code '"+codeString+"'");
+  }
+
+  public String toCode(ChargeitemBillingcodes code) {
+    if (code == ChargeitemBillingcodes._1100)
+      return "1100";
+    if (code == ChargeitemBillingcodes._1210)
+      return "1210";
+    if (code == ChargeitemBillingcodes._1320)
+      return "1320";
+    return "?";
+  }
+
+    public String toSystem(ChargeitemBillingcodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemStatus.java
new file mode 100644
index 00000000000..213311a3ef4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ChargeitemStatus {
+
+        /**
+         * The charge item has been entered, but the charged service is not  yet complete, so it shall not be billed yet but might be used in the context of pre-authorization
+         */
+        PLANNED, 
+        /**
+         * The charge item is ready for billing
+         */
+        BILLABLE, 
+        /**
+         * The charge item has been determined to be not billable (e.g. due to rules associated with the billing code)
+         */
+        NOTBILLABLE, 
+        /**
+         * The processing of the charge was aborted
+         */
+        ABORTED, 
+        /**
+         * The charge item has been billed (e.g. a billing engine has generated financial transactions by applying the associated ruled for the charge item to the context of the Encounter, and placed them into Claims/Invoices
+         */
+        BILLED, 
+        /**
+         * The charge item has been entered in error and should not be processed for billing
+         */
+        ENTEREDINERROR, 
+        /**
+         * The authoring system does not know which of the status values currently applies for this charge item  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
+         */
+        NULL;
+        public static ChargeitemStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("planned".equals(codeString))
+          return PLANNED;
+        if ("billable".equals(codeString))
+          return BILLABLE;
+        if ("not-billable".equals(codeString))
+          return NOTBILLABLE;
+        if ("aborted".equals(codeString))
+          return ABORTED;
+        if ("billed".equals(codeString))
+          return BILLED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown ChargeitemStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PLANNED: return "planned";
+            case BILLABLE: return "billable";
+            case NOTBILLABLE: return "not-billable";
+            case ABORTED: return "aborted";
+            case BILLED: return "billed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/chargeitem-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PLANNED: return "The charge item has been entered, but the charged service is not  yet complete, so it shall not be billed yet but might be used in the context of pre-authorization";
+            case BILLABLE: return "The charge item is ready for billing";
+            case NOTBILLABLE: return "The charge item has been determined to be not billable (e.g. due to rules associated with the billing code)";
+            case ABORTED: return "The processing of the charge was aborted";
+            case BILLED: return "The charge item has been billed (e.g. a billing engine has generated financial transactions by applying the associated ruled for the charge item to the context of the Encounter, and placed them into Claims/Invoices";
+            case ENTEREDINERROR: return "The charge item has been entered in error and should not be processed for billing";
+            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this charge item  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 PLANNED: return "Planned";
+            case BILLABLE: return "Billable";
+            case NOTBILLABLE: return "Not billable";
+            case ABORTED: return "Aborted";
+            case BILLED: return "Billed";
+            case ENTEREDINERROR: return "Entered in Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemStatusEnumFactory.java
new file mode 100644
index 00000000000..f1f561e14ef
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChargeitemStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ChargeitemStatusEnumFactory implements EnumFactory {
+
+  public ChargeitemStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("planned".equals(codeString))
+      return ChargeitemStatus.PLANNED;
+    if ("billable".equals(codeString))
+      return ChargeitemStatus.BILLABLE;
+    if ("not-billable".equals(codeString))
+      return ChargeitemStatus.NOTBILLABLE;
+    if ("aborted".equals(codeString))
+      return ChargeitemStatus.ABORTED;
+    if ("billed".equals(codeString))
+      return ChargeitemStatus.BILLED;
+    if ("entered-in-error".equals(codeString))
+      return ChargeitemStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return ChargeitemStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown ChargeitemStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ChargeitemStatus code) {
+    if (code == ChargeitemStatus.PLANNED)
+      return "planned";
+    if (code == ChargeitemStatus.BILLABLE)
+      return "billable";
+    if (code == ChargeitemStatus.NOTBILLABLE)
+      return "not-billable";
+    if (code == ChargeitemStatus.ABORTED)
+      return "aborted";
+    if (code == ChargeitemStatus.BILLED)
+      return "billed";
+    if (code == ChargeitemStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == ChargeitemStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(ChargeitemStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChoiceListOrientation.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChoiceListOrientation.java
new file mode 100644
index 00000000000..afeb60849d8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChoiceListOrientation.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ChoiceListOrientation {
+
+        /**
+         * List choices along the horizontal axis
+         */
+        HORIZONTAL, 
+        /**
+         * List choices down the vertical axis
+         */
+        VERTICAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ChoiceListOrientation fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("horizontal".equals(codeString))
+          return HORIZONTAL;
+        if ("vertical".equals(codeString))
+          return VERTICAL;
+        throw new FHIRException("Unknown ChoiceListOrientation code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HORIZONTAL: return "horizontal";
+            case VERTICAL: return "vertical";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/choice-list-orientation";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HORIZONTAL: return "List choices along the horizontal axis";
+            case VERTICAL: return "List choices down the vertical axis";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HORIZONTAL: return "Horizontal";
+            case VERTICAL: return "Vertical";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChoiceListOrientationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChoiceListOrientationEnumFactory.java
new file mode 100644
index 00000000000..35a82ffb24a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChoiceListOrientationEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ChoiceListOrientationEnumFactory implements EnumFactory {
+
+  public ChoiceListOrientation fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("horizontal".equals(codeString))
+      return ChoiceListOrientation.HORIZONTAL;
+    if ("vertical".equals(codeString))
+      return ChoiceListOrientation.VERTICAL;
+    throw new IllegalArgumentException("Unknown ChoiceListOrientation code '"+codeString+"'");
+  }
+
+  public String toCode(ChoiceListOrientation code) {
+    if (code == ChoiceListOrientation.HORIZONTAL)
+      return "horizontal";
+    if (code == ChoiceListOrientation.VERTICAL)
+      return "vertical";
+    return "?";
+  }
+
+    public String toSystem(ChoiceListOrientation code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChromosomeHuman.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChromosomeHuman.java
new file mode 100644
index 00000000000..3fc7bc3e6e7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChromosomeHuman.java
@@ -0,0 +1,285 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ChromosomeHuman {
+
+        /**
+         * chromosome 1
+         */
+        _1, 
+        /**
+         * chromosome 2
+         */
+        _2, 
+        /**
+         * chromosome 3
+         */
+        _3, 
+        /**
+         * chromosome 4
+         */
+        _4, 
+        /**
+         * chromosome 5
+         */
+        _5, 
+        /**
+         * chromosome 6
+         */
+        _6, 
+        /**
+         * chromosome 7
+         */
+        _7, 
+        /**
+         * chromosome 8
+         */
+        _8, 
+        /**
+         * chromosome 9
+         */
+        _9, 
+        /**
+         * chromosome 10
+         */
+        _10, 
+        /**
+         * chromosome 11
+         */
+        _11, 
+        /**
+         * chromosome 12
+         */
+        _12, 
+        /**
+         * chromosome 13
+         */
+        _13, 
+        /**
+         * chromosome 14
+         */
+        _14, 
+        /**
+         * chromosome 15
+         */
+        _15, 
+        /**
+         * chromosome 16
+         */
+        _16, 
+        /**
+         * chromosome 17
+         */
+        _17, 
+        /**
+         * chromosome 18
+         */
+        _18, 
+        /**
+         * chromosome 19
+         */
+        _19, 
+        /**
+         * chromosome 20
+         */
+        _20, 
+        /**
+         * chromosome 21
+         */
+        _21, 
+        /**
+         * chromosome 22
+         */
+        _22, 
+        /**
+         * chromosome X
+         */
+        X, 
+        /**
+         * chromosome Y
+         */
+        Y, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ChromosomeHuman fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("6".equals(codeString))
+          return _6;
+        if ("7".equals(codeString))
+          return _7;
+        if ("8".equals(codeString))
+          return _8;
+        if ("9".equals(codeString))
+          return _9;
+        if ("10".equals(codeString))
+          return _10;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        if ("16".equals(codeString))
+          return _16;
+        if ("17".equals(codeString))
+          return _17;
+        if ("18".equals(codeString))
+          return _18;
+        if ("19".equals(codeString))
+          return _19;
+        if ("20".equals(codeString))
+          return _20;
+        if ("21".equals(codeString))
+          return _21;
+        if ("22".equals(codeString))
+          return _22;
+        if ("X".equals(codeString))
+          return X;
+        if ("Y".equals(codeString))
+          return Y;
+        throw new FHIRException("Unknown ChromosomeHuman code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _8: return "8";
+            case _9: return "9";
+            case _10: return "10";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            case _16: return "16";
+            case _17: return "17";
+            case _18: return "18";
+            case _19: return "19";
+            case _20: return "20";
+            case _21: return "21";
+            case _22: return "22";
+            case X: return "X";
+            case Y: return "Y";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/chromosome-human";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "chromosome 1";
+            case _2: return "chromosome 2";
+            case _3: return "chromosome 3";
+            case _4: return "chromosome 4";
+            case _5: return "chromosome 5";
+            case _6: return "chromosome 6";
+            case _7: return "chromosome 7";
+            case _8: return "chromosome 8";
+            case _9: return "chromosome 9";
+            case _10: return "chromosome 10";
+            case _11: return "chromosome 11";
+            case _12: return "chromosome 12";
+            case _13: return "chromosome 13";
+            case _14: return "chromosome 14";
+            case _15: return "chromosome 15";
+            case _16: return "chromosome 16";
+            case _17: return "chromosome 17";
+            case _18: return "chromosome 18";
+            case _19: return "chromosome 19";
+            case _20: return "chromosome 20";
+            case _21: return "chromosome 21";
+            case _22: return "chromosome 22";
+            case X: return "chromosome X";
+            case Y: return "chromosome Y";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "chromosome 1";
+            case _2: return "chromosome 2";
+            case _3: return "chromosome 3";
+            case _4: return "chromosome 4";
+            case _5: return "chromosome 5";
+            case _6: return "chromosome 6";
+            case _7: return "chromosome 7";
+            case _8: return "chromosome 8";
+            case _9: return "chromosome 9";
+            case _10: return "chromosome 10";
+            case _11: return "chromosome 11";
+            case _12: return "chromosome 12";
+            case _13: return "chromosome 13";
+            case _14: return "chromosome 14";
+            case _15: return "chromosome 15";
+            case _16: return "chromosome 16";
+            case _17: return "chromosome 17";
+            case _18: return "chromosome 18";
+            case _19: return "chromosome 19";
+            case _20: return "chromosome 20";
+            case _21: return "chromosome 21";
+            case _22: return "chromosome 22";
+            case X: return "chromosome X";
+            case Y: return "chromosome Y";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChromosomeHumanEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChromosomeHumanEnumFactory.java
new file mode 100644
index 00000000000..3dc84f370d8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ChromosomeHumanEnumFactory.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ChromosomeHumanEnumFactory implements EnumFactory {
+
+  public ChromosomeHuman fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return ChromosomeHuman._1;
+    if ("2".equals(codeString))
+      return ChromosomeHuman._2;
+    if ("3".equals(codeString))
+      return ChromosomeHuman._3;
+    if ("4".equals(codeString))
+      return ChromosomeHuman._4;
+    if ("5".equals(codeString))
+      return ChromosomeHuman._5;
+    if ("6".equals(codeString))
+      return ChromosomeHuman._6;
+    if ("7".equals(codeString))
+      return ChromosomeHuman._7;
+    if ("8".equals(codeString))
+      return ChromosomeHuman._8;
+    if ("9".equals(codeString))
+      return ChromosomeHuman._9;
+    if ("10".equals(codeString))
+      return ChromosomeHuman._10;
+    if ("11".equals(codeString))
+      return ChromosomeHuman._11;
+    if ("12".equals(codeString))
+      return ChromosomeHuman._12;
+    if ("13".equals(codeString))
+      return ChromosomeHuman._13;
+    if ("14".equals(codeString))
+      return ChromosomeHuman._14;
+    if ("15".equals(codeString))
+      return ChromosomeHuman._15;
+    if ("16".equals(codeString))
+      return ChromosomeHuman._16;
+    if ("17".equals(codeString))
+      return ChromosomeHuman._17;
+    if ("18".equals(codeString))
+      return ChromosomeHuman._18;
+    if ("19".equals(codeString))
+      return ChromosomeHuman._19;
+    if ("20".equals(codeString))
+      return ChromosomeHuman._20;
+    if ("21".equals(codeString))
+      return ChromosomeHuman._21;
+    if ("22".equals(codeString))
+      return ChromosomeHuman._22;
+    if ("X".equals(codeString))
+      return ChromosomeHuman.X;
+    if ("Y".equals(codeString))
+      return ChromosomeHuman.Y;
+    throw new IllegalArgumentException("Unknown ChromosomeHuman code '"+codeString+"'");
+  }
+
+  public String toCode(ChromosomeHuman code) {
+    if (code == ChromosomeHuman._1)
+      return "1";
+    if (code == ChromosomeHuman._2)
+      return "2";
+    if (code == ChromosomeHuman._3)
+      return "3";
+    if (code == ChromosomeHuman._4)
+      return "4";
+    if (code == ChromosomeHuman._5)
+      return "5";
+    if (code == ChromosomeHuman._6)
+      return "6";
+    if (code == ChromosomeHuman._7)
+      return "7";
+    if (code == ChromosomeHuman._8)
+      return "8";
+    if (code == ChromosomeHuman._9)
+      return "9";
+    if (code == ChromosomeHuman._10)
+      return "10";
+    if (code == ChromosomeHuman._11)
+      return "11";
+    if (code == ChromosomeHuman._12)
+      return "12";
+    if (code == ChromosomeHuman._13)
+      return "13";
+    if (code == ChromosomeHuman._14)
+      return "14";
+    if (code == ChromosomeHuman._15)
+      return "15";
+    if (code == ChromosomeHuman._16)
+      return "16";
+    if (code == ChromosomeHuman._17)
+      return "17";
+    if (code == ChromosomeHuman._18)
+      return "18";
+    if (code == ChromosomeHuman._19)
+      return "19";
+    if (code == ChromosomeHuman._20)
+      return "20";
+    if (code == ChromosomeHuman._21)
+      return "21";
+    if (code == ChromosomeHuman._22)
+      return "22";
+    if (code == ChromosomeHuman.X)
+      return "X";
+    if (code == ChromosomeHuman.Y)
+      return "Y";
+    return "?";
+  }
+
+    public String toSystem(ChromosomeHuman code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimCareteamrole.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimCareteamrole.java
new file mode 100644
index 00000000000..c1f0e373d2a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimCareteamrole.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClaimCareteamrole {
+
+        /**
+         * The primary care provider.
+         */
+        PRIMARY, 
+        /**
+         * Assisting care provider.
+         */
+        ASSIST, 
+        /**
+         * Supervising care provider.
+         */
+        SUPERVISOR, 
+        /**
+         * Other role on the care team.
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClaimCareteamrole fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("primary".equals(codeString))
+          return PRIMARY;
+        if ("assist".equals(codeString))
+          return ASSIST;
+        if ("supervisor".equals(codeString))
+          return SUPERVISOR;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown ClaimCareteamrole code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PRIMARY: return "primary";
+            case ASSIST: return "assist";
+            case SUPERVISOR: return "supervisor";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/claimcareteamrole";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PRIMARY: return "The primary care provider.";
+            case ASSIST: return "Assisting care provider.";
+            case SUPERVISOR: return "Supervising care provider.";
+            case OTHER: return "Other role on the care team.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PRIMARY: return "Primary provider";
+            case ASSIST: return "Assisting Provider";
+            case SUPERVISOR: return "Supervising Provider";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimCareteamroleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimCareteamroleEnumFactory.java
new file mode 100644
index 00000000000..e8f24dd1de0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimCareteamroleEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClaimCareteamroleEnumFactory implements EnumFactory {
+
+  public ClaimCareteamrole fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("primary".equals(codeString))
+      return ClaimCareteamrole.PRIMARY;
+    if ("assist".equals(codeString))
+      return ClaimCareteamrole.ASSIST;
+    if ("supervisor".equals(codeString))
+      return ClaimCareteamrole.SUPERVISOR;
+    if ("other".equals(codeString))
+      return ClaimCareteamrole.OTHER;
+    throw new IllegalArgumentException("Unknown ClaimCareteamrole code '"+codeString+"'");
+  }
+
+  public String toCode(ClaimCareteamrole code) {
+    if (code == ClaimCareteamrole.PRIMARY)
+      return "primary";
+    if (code == ClaimCareteamrole.ASSIST)
+      return "assist";
+    if (code == ClaimCareteamrole.SUPERVISOR)
+      return "supervisor";
+    if (code == ClaimCareteamrole.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(ClaimCareteamrole code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimException.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimException.java
new file mode 100644
index 00000000000..ad4cf0724dd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimException.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClaimException {
+
+        /**
+         * Fulltime Student
+         */
+        STUDENT, 
+        /**
+         * Disabled
+         */
+        DISABLED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClaimException fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("student".equals(codeString))
+          return STUDENT;
+        if ("disabled".equals(codeString))
+          return DISABLED;
+        throw new FHIRException("Unknown ClaimException code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case STUDENT: return "student";
+            case DISABLED: return "disabled";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/claim-exception";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case STUDENT: return "Fulltime Student";
+            case DISABLED: return "Disabled";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case STUDENT: return "Student (Fulltime)";
+            case DISABLED: return "Disabled";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimExceptionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimExceptionEnumFactory.java
new file mode 100644
index 00000000000..fd37964503c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimExceptionEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClaimExceptionEnumFactory implements EnumFactory {
+
+  public ClaimException fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("student".equals(codeString))
+      return ClaimException.STUDENT;
+    if ("disabled".equals(codeString))
+      return ClaimException.DISABLED;
+    throw new IllegalArgumentException("Unknown ClaimException code '"+codeString+"'");
+  }
+
+  public String toCode(ClaimException code) {
+    if (code == ClaimException.STUDENT)
+      return "student";
+    if (code == ClaimException.DISABLED)
+      return "disabled";
+    return "?";
+  }
+
+    public String toSystem(ClaimException code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimInformationcategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimInformationcategory.java
new file mode 100644
index 00000000000..525547f998a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimInformationcategory.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClaimInformationcategory {
+
+        /**
+         * Codes conveying additional situation and condition information.
+         */
+        INFO, 
+        /**
+         * Discharge status and discharge to locations.
+         */
+        DISCHARGE, 
+        /**
+         * Period, start or end dates of aspects of the Condition.
+         */
+        ONSET, 
+        /**
+         * Nature and date of the related event eg. Last exam, service, Xray etc.
+         */
+        RELATED, 
+        /**
+         * Insurance policy exceptions.
+         */
+        EXCEPTION, 
+        /**
+         * Materials being forwarded, eg. Models, molds, images, documents.
+         */
+        MATERIAL, 
+        /**
+         * Materials attached such as images, documents and resources.
+         */
+        ATTACHMENT, 
+        /**
+         * Teeth which are missing for any reason, for example: prior extraction, never developed.
+         */
+        MISSINGTOOTH, 
+        /**
+         * The type of prosthesis and date of supply if a previously supplied prosthesis.
+         */
+        PROSTHESIS, 
+        /**
+         * Other information identified by the type.system.
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClaimInformationcategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("info".equals(codeString))
+          return INFO;
+        if ("discharge".equals(codeString))
+          return DISCHARGE;
+        if ("onset".equals(codeString))
+          return ONSET;
+        if ("related".equals(codeString))
+          return RELATED;
+        if ("exception".equals(codeString))
+          return EXCEPTION;
+        if ("material".equals(codeString))
+          return MATERIAL;
+        if ("attachment".equals(codeString))
+          return ATTACHMENT;
+        if ("missingtooth".equals(codeString))
+          return MISSINGTOOTH;
+        if ("prosthesis".equals(codeString))
+          return PROSTHESIS;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown ClaimInformationcategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INFO: return "info";
+            case DISCHARGE: return "discharge";
+            case ONSET: return "onset";
+            case RELATED: return "related";
+            case EXCEPTION: return "exception";
+            case MATERIAL: return "material";
+            case ATTACHMENT: return "attachment";
+            case MISSINGTOOTH: return "missingtooth";
+            case PROSTHESIS: return "prosthesis";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/claiminformationcategory";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INFO: return "Codes conveying additional situation and condition information.";
+            case DISCHARGE: return "Discharge status and discharge to locations.";
+            case ONSET: return "Period, start or end dates of aspects of the Condition.";
+            case RELATED: return "Nature and date of the related event eg. Last exam, service, Xray etc.";
+            case EXCEPTION: return "Insurance policy exceptions.";
+            case MATERIAL: return "Materials being forwarded, eg. Models, molds, images, documents.";
+            case ATTACHMENT: return "Materials attached such as images, documents and resources.";
+            case MISSINGTOOTH: return "Teeth which are missing for any reason, for example: prior extraction, never developed.";
+            case PROSTHESIS: return "The type of prosthesis and date of supply if a previously supplied prosthesis.";
+            case OTHER: return "Other information identified by the type.system.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INFO: return "Information";
+            case DISCHARGE: return "Discharge";
+            case ONSET: return "Onset";
+            case RELATED: return "Related Services";
+            case EXCEPTION: return "Exception";
+            case MATERIAL: return "Materials Forwarded";
+            case ATTACHMENT: return "Attachment";
+            case MISSINGTOOTH: return "Missing Tooth";
+            case PROSTHESIS: return "Prosthesis";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimInformationcategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimInformationcategoryEnumFactory.java
new file mode 100644
index 00000000000..422022e0edc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimInformationcategoryEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClaimInformationcategoryEnumFactory implements EnumFactory {
+
+  public ClaimInformationcategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("info".equals(codeString))
+      return ClaimInformationcategory.INFO;
+    if ("discharge".equals(codeString))
+      return ClaimInformationcategory.DISCHARGE;
+    if ("onset".equals(codeString))
+      return ClaimInformationcategory.ONSET;
+    if ("related".equals(codeString))
+      return ClaimInformationcategory.RELATED;
+    if ("exception".equals(codeString))
+      return ClaimInformationcategory.EXCEPTION;
+    if ("material".equals(codeString))
+      return ClaimInformationcategory.MATERIAL;
+    if ("attachment".equals(codeString))
+      return ClaimInformationcategory.ATTACHMENT;
+    if ("missingtooth".equals(codeString))
+      return ClaimInformationcategory.MISSINGTOOTH;
+    if ("prosthesis".equals(codeString))
+      return ClaimInformationcategory.PROSTHESIS;
+    if ("other".equals(codeString))
+      return ClaimInformationcategory.OTHER;
+    throw new IllegalArgumentException("Unknown ClaimInformationcategory code '"+codeString+"'");
+  }
+
+  public String toCode(ClaimInformationcategory code) {
+    if (code == ClaimInformationcategory.INFO)
+      return "info";
+    if (code == ClaimInformationcategory.DISCHARGE)
+      return "discharge";
+    if (code == ClaimInformationcategory.ONSET)
+      return "onset";
+    if (code == ClaimInformationcategory.RELATED)
+      return "related";
+    if (code == ClaimInformationcategory.EXCEPTION)
+      return "exception";
+    if (code == ClaimInformationcategory.MATERIAL)
+      return "material";
+    if (code == ClaimInformationcategory.ATTACHMENT)
+      return "attachment";
+    if (code == ClaimInformationcategory.MISSINGTOOTH)
+      return "missingtooth";
+    if (code == ClaimInformationcategory.PROSTHESIS)
+      return "prosthesis";
+    if (code == ClaimInformationcategory.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(ClaimInformationcategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimModifiers.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimModifiers.java
new file mode 100644
index 00000000000..86e5ad47fd3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimModifiers.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClaimModifiers {
+
+        /**
+         * Repair of prior service or installation.
+         */
+        A, 
+        /**
+         * Temporary service or installation.
+         */
+        B, 
+        /**
+         * Treatment associated with TMJ.
+         */
+        C, 
+        /**
+         * Implant or associated with an implant.
+         */
+        E, 
+        /**
+         * A Rush service or service performed outside of normal office hours.
+         */
+        ROOH, 
+        /**
+         * None.
+         */
+        X, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClaimModifiers fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("a".equals(codeString))
+          return A;
+        if ("b".equals(codeString))
+          return B;
+        if ("c".equals(codeString))
+          return C;
+        if ("e".equals(codeString))
+          return E;
+        if ("rooh".equals(codeString))
+          return ROOH;
+        if ("x".equals(codeString))
+          return X;
+        throw new FHIRException("Unknown ClaimModifiers code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A: return "a";
+            case B: return "b";
+            case C: return "c";
+            case E: return "e";
+            case ROOH: return "rooh";
+            case X: return "x";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/modifiers";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A: return "Repair of prior service or installation.";
+            case B: return "Temporary service or installation.";
+            case C: return "Treatment associated with TMJ.";
+            case E: return "Implant or associated with an implant.";
+            case ROOH: return "A Rush service or service performed outside of normal office hours.";
+            case X: return "None.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A: return "Repair of prior service or installation";
+            case B: return "Temporary service or installation";
+            case C: return "TMJ treatment";
+            case E: return "Implant or associated with an implant";
+            case ROOH: return "Rush or Outside of office hours";
+            case X: return "None";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimModifiersEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimModifiersEnumFactory.java
new file mode 100644
index 00000000000..ea961c1e394
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimModifiersEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClaimModifiersEnumFactory implements EnumFactory {
+
+  public ClaimModifiers fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("a".equals(codeString))
+      return ClaimModifiers.A;
+    if ("b".equals(codeString))
+      return ClaimModifiers.B;
+    if ("c".equals(codeString))
+      return ClaimModifiers.C;
+    if ("e".equals(codeString))
+      return ClaimModifiers.E;
+    if ("rooh".equals(codeString))
+      return ClaimModifiers.ROOH;
+    if ("x".equals(codeString))
+      return ClaimModifiers.X;
+    throw new IllegalArgumentException("Unknown ClaimModifiers code '"+codeString+"'");
+  }
+
+  public String toCode(ClaimModifiers code) {
+    if (code == ClaimModifiers.A)
+      return "a";
+    if (code == ClaimModifiers.B)
+      return "b";
+    if (code == ClaimModifiers.C)
+      return "c";
+    if (code == ClaimModifiers.E)
+      return "e";
+    if (code == ClaimModifiers.ROOH)
+      return "rooh";
+    if (code == ClaimModifiers.X)
+      return "x";
+    return "?";
+  }
+
+    public String toSystem(ClaimModifiers code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimStatus.java
new file mode 100644
index 00000000000..e8d038b3cd8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClaimStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClaimStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ClaimStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/claim-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimStatusEnumFactory.java
new file mode 100644
index 00000000000..df914b97f1e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClaimStatusEnumFactory implements EnumFactory {
+
+  public ClaimStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return ClaimStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return ClaimStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return ClaimStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return ClaimStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ClaimStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ClaimStatus code) {
+    if (code == ClaimStatus.ACTIVE)
+      return "active";
+    if (code == ClaimStatus.CANCELLED)
+      return "cancelled";
+    if (code == ClaimStatus.DRAFT)
+      return "draft";
+    if (code == ClaimStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ClaimStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimSubtype.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimSubtype.java
new file mode 100644
index 00000000000..c106243df8b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimSubtype.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClaimSubtype {
+
+        /**
+         * A claim for Orthodontic Services.
+         */
+        ORTHO, 
+        /**
+         * A claim for emergency services.
+         */
+        EMERGENCY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClaimSubtype fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ortho".equals(codeString))
+          return ORTHO;
+        if ("emergency".equals(codeString))
+          return EMERGENCY;
+        throw new FHIRException("Unknown ClaimSubtype code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ORTHO: return "ortho";
+            case EMERGENCY: return "emergency";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-claimsubtype";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ORTHO: return "A claim for Orthodontic Services.";
+            case EMERGENCY: return "A claim for emergency services.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ORTHO: return "Orthodontic Claim";
+            case EMERGENCY: return "Emergency Claim";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimSubtypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimSubtypeEnumFactory.java
new file mode 100644
index 00000000000..385f3ed86d0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimSubtypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClaimSubtypeEnumFactory implements EnumFactory {
+
+  public ClaimSubtype fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ortho".equals(codeString))
+      return ClaimSubtype.ORTHO;
+    if ("emergency".equals(codeString))
+      return ClaimSubtype.EMERGENCY;
+    throw new IllegalArgumentException("Unknown ClaimSubtype code '"+codeString+"'");
+  }
+
+  public String toCode(ClaimSubtype code) {
+    if (code == ClaimSubtype.ORTHO)
+      return "ortho";
+    if (code == ClaimSubtype.EMERGENCY)
+      return "emergency";
+    return "?";
+  }
+
+    public String toSystem(ClaimSubtype code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimType.java
new file mode 100644
index 00000000000..a0f173e2b76
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClaimType {
+
+        /**
+         * Hospital, clinic and typically inpatient claims.
+         */
+        INSTITUTIONAL, 
+        /**
+         * Dental, Denture and Hygiene claims.
+         */
+        ORAL, 
+        /**
+         * Pharmacy claims for goods and services.
+         */
+        PHARMACY, 
+        /**
+         * Typically outpatient claims from Physician, Psychological, Chiropractor, Physiotherapy, Speach Pathology, rehabilitative, consulting.
+         */
+        PROFESSIONAL, 
+        /**
+         * Vision claims for professional services and products such as glasses and contact lenses.
+         */
+        VISION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClaimType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("institutional".equals(codeString))
+          return INSTITUTIONAL;
+        if ("oral".equals(codeString))
+          return ORAL;
+        if ("pharmacy".equals(codeString))
+          return PHARMACY;
+        if ("professional".equals(codeString))
+          return PROFESSIONAL;
+        if ("vision".equals(codeString))
+          return VISION;
+        throw new FHIRException("Unknown ClaimType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INSTITUTIONAL: return "institutional";
+            case ORAL: return "oral";
+            case PHARMACY: return "pharmacy";
+            case PROFESSIONAL: return "professional";
+            case VISION: return "vision";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-claimtype";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INSTITUTIONAL: return "Hospital, clinic and typically inpatient claims.";
+            case ORAL: return "Dental, Denture and Hygiene claims.";
+            case PHARMACY: return "Pharmacy claims for goods and services.";
+            case PROFESSIONAL: return "Typically outpatient claims from Physician, Psychological, Chiropractor, Physiotherapy, Speach Pathology, rehabilitative, consulting.";
+            case VISION: return "Vision claims for professional services and products such as glasses and contact lenses.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INSTITUTIONAL: return "Institutional";
+            case ORAL: return "Oral";
+            case PHARMACY: return "Pharmacy";
+            case PROFESSIONAL: return "Professional";
+            case VISION: return "Vision";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimTypeEnumFactory.java
new file mode 100644
index 00000000000..a8395bf044a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClaimTypeEnumFactory implements EnumFactory {
+
+  public ClaimType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("institutional".equals(codeString))
+      return ClaimType.INSTITUTIONAL;
+    if ("oral".equals(codeString))
+      return ClaimType.ORAL;
+    if ("pharmacy".equals(codeString))
+      return ClaimType.PHARMACY;
+    if ("professional".equals(codeString))
+      return ClaimType.PROFESSIONAL;
+    if ("vision".equals(codeString))
+      return ClaimType.VISION;
+    throw new IllegalArgumentException("Unknown ClaimType code '"+codeString+"'");
+  }
+
+  public String toCode(ClaimType code) {
+    if (code == ClaimType.INSTITUTIONAL)
+      return "institutional";
+    if (code == ClaimType.ORAL)
+      return "oral";
+    if (code == ClaimType.PHARMACY)
+      return "pharmacy";
+    if (code == ClaimType.PROFESSIONAL)
+      return "professional";
+    if (code == ClaimType.VISION)
+      return "vision";
+    return "?";
+  }
+
+    public String toSystem(ClaimType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimUse.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimUse.java
new file mode 100644
index 00000000000..6e4e1cc0736
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimUse.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClaimUse {
+
+        /**
+         * The treatment is complete and this represents a Claim for the services.
+         */
+        COMPLETE, 
+        /**
+         * The treatment is proposed and this represents a Pre-authorization for the services.
+         */
+        PROPOSED, 
+        /**
+         * The treatment is proposed and this represents a Pre-determination for the services.
+         */
+        EXPLORATORY, 
+        /**
+         * A locally defined or otherwise resolved status.
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClaimUse fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("complete".equals(codeString))
+          return COMPLETE;
+        if ("proposed".equals(codeString))
+          return PROPOSED;
+        if ("exploratory".equals(codeString))
+          return EXPLORATORY;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown ClaimUse code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COMPLETE: return "complete";
+            case PROPOSED: return "proposed";
+            case EXPLORATORY: return "exploratory";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/claim-use";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COMPLETE: return "The treatment is complete and this represents a Claim for the services.";
+            case PROPOSED: return "The treatment is proposed and this represents a Pre-authorization for the services.";
+            case EXPLORATORY: return "The treatment is proposed and this represents a Pre-determination for the services.";
+            case OTHER: return "A locally defined or otherwise resolved status.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COMPLETE: return "Complete";
+            case PROPOSED: return "Proposed";
+            case EXPLORATORY: return "Exploratory";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimUseEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimUseEnumFactory.java
new file mode 100644
index 00000000000..674a075faa9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimUseEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClaimUseEnumFactory implements EnumFactory {
+
+  public ClaimUse fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("complete".equals(codeString))
+      return ClaimUse.COMPLETE;
+    if ("proposed".equals(codeString))
+      return ClaimUse.PROPOSED;
+    if ("exploratory".equals(codeString))
+      return ClaimUse.EXPLORATORY;
+    if ("other".equals(codeString))
+      return ClaimUse.OTHER;
+    throw new IllegalArgumentException("Unknown ClaimUse code '"+codeString+"'");
+  }
+
+  public String toCode(ClaimUse code) {
+    if (code == ClaimUse.COMPLETE)
+      return "complete";
+    if (code == ClaimUse.PROPOSED)
+      return "proposed";
+    if (code == ClaimUse.EXPLORATORY)
+      return "exploratory";
+    if (code == ClaimUse.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(ClaimUse code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimresponseStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimresponseStatus.java
new file mode 100644
index 00000000000..764eec89c08
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimresponseStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClaimresponseStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClaimresponseStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ClaimresponseStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/claimresponse-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimresponseStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimresponseStatusEnumFactory.java
new file mode 100644
index 00000000000..b5ae7109ea7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClaimresponseStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClaimresponseStatusEnumFactory implements EnumFactory {
+
+  public ClaimresponseStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return ClaimresponseStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return ClaimresponseStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return ClaimresponseStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return ClaimresponseStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ClaimresponseStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ClaimresponseStatus code) {
+    if (code == ClaimresponseStatus.ACTIVE)
+      return "active";
+    if (code == ClaimresponseStatus.CANCELLED)
+      return "cancelled";
+    if (code == ClaimresponseStatus.DRAFT)
+      return "draft";
+    if (code == ClaimresponseStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ClaimresponseStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClassificationOrContext.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClassificationOrContext.java
new file mode 100644
index 00000000000..d50abdfe85f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClassificationOrContext.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClassificationOrContext {
+
+        /**
+         * Indicates the useContext is a classification - e.g. Administrative, financial, etc.
+         */
+        CLASSIFICATION, 
+        /**
+         * Indicates the useContext is a context - a domain of use - e.g. Particular country, organization or system
+         */
+        CONTEXT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClassificationOrContext fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("classification".equals(codeString))
+          return CLASSIFICATION;
+        if ("context".equals(codeString))
+          return CONTEXT;
+        throw new FHIRException("Unknown ClassificationOrContext code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CLASSIFICATION: return "classification";
+            case CONTEXT: return "context";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/classification-or-context";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CLASSIFICATION: return "Indicates the useContext is a classification - e.g. Administrative, financial, etc.";
+            case CONTEXT: return "Indicates the useContext is a context - a domain of use - e.g. Particular country, organization or system";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CLASSIFICATION: return "Classification";
+            case CONTEXT: return "Context";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClassificationOrContextEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClassificationOrContextEnumFactory.java
new file mode 100644
index 00000000000..ce3f52f3492
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClassificationOrContextEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClassificationOrContextEnumFactory implements EnumFactory {
+
+  public ClassificationOrContext fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("classification".equals(codeString))
+      return ClassificationOrContext.CLASSIFICATION;
+    if ("context".equals(codeString))
+      return ClassificationOrContext.CONTEXT;
+    throw new IllegalArgumentException("Unknown ClassificationOrContext code '"+codeString+"'");
+  }
+
+  public String toCode(ClassificationOrContext code) {
+    if (code == ClassificationOrContext.CLASSIFICATION)
+      return "classification";
+    if (code == ClassificationOrContext.CONTEXT)
+      return "context";
+    return "?";
+  }
+
+    public String toSystem(ClassificationOrContext code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClinicalImpressionStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClinicalImpressionStatus.java
new file mode 100644
index 00000000000..6e25d1bb332
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClinicalImpressionStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ClinicalImpressionStatus {
+
+        /**
+         * The assessment is still on-going and results are not yet final.
+         */
+        DRAFT, 
+        /**
+         * The assessment is done and the results are final.
+         */
+        COMPLETED, 
+        /**
+         * This assessment was never actually done and the record is erroneous (e.g. Wrong patient).
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ClinicalImpressionStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ClinicalImpressionStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/clinical-impression-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "The assessment is still on-going and results are not yet final.";
+            case COMPLETED: return "The assessment is done and the results are final.";
+            case ENTEREDINERROR: return "This assessment was never actually done and the record is erroneous (e.g. Wrong patient).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DRAFT: return "In progress";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClinicalImpressionStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClinicalImpressionStatusEnumFactory.java
new file mode 100644
index 00000000000..2bbf5cd9652
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ClinicalImpressionStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ClinicalImpressionStatusEnumFactory implements EnumFactory {
+
+  public ClinicalImpressionStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return ClinicalImpressionStatus.DRAFT;
+    if ("completed".equals(codeString))
+      return ClinicalImpressionStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return ClinicalImpressionStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ClinicalImpressionStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ClinicalImpressionStatus code) {
+    if (code == ClinicalImpressionStatus.DRAFT)
+      return "draft";
+    if (code == ClinicalImpressionStatus.COMPLETED)
+      return "completed";
+    if (code == ClinicalImpressionStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ClinicalImpressionStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemContentMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemContentMode.java
new file mode 100644
index 00000000000..1c0ec08e025
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemContentMode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CodesystemContentMode {
+
+        /**
+         * None of the concepts defined by the code system are included in the code system resource
+         */
+        NOTPRESENT, 
+        /**
+         * A few representative concepts are included in the code system resource
+         */
+        EXAMPLE, 
+        /**
+         * A subset of the code system concepts are included in the code system resource
+         */
+        FRAGMENT, 
+        /**
+         * All the concepts defined by the code system are included in the code system resource
+         */
+        COMPLETE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CodesystemContentMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("not-present".equals(codeString))
+          return NOTPRESENT;
+        if ("example".equals(codeString))
+          return EXAMPLE;
+        if ("fragment".equals(codeString))
+          return FRAGMENT;
+        if ("complete".equals(codeString))
+          return COMPLETE;
+        throw new FHIRException("Unknown CodesystemContentMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NOTPRESENT: return "not-present";
+            case EXAMPLE: return "example";
+            case FRAGMENT: return "fragment";
+            case COMPLETE: return "complete";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/codesystem-content-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NOTPRESENT: return "None of the concepts defined by the code system are included in the code system resource";
+            case EXAMPLE: return "A few representative concepts are included in the code system resource";
+            case FRAGMENT: return "A subset of the code system concepts are included in the code system resource";
+            case COMPLETE: return "All the concepts defined by the code system are included in the code system resource";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NOTPRESENT: return "Not Present";
+            case EXAMPLE: return "Example";
+            case FRAGMENT: return "Fragment";
+            case COMPLETE: return "Complete";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemContentModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemContentModeEnumFactory.java
new file mode 100644
index 00000000000..c89d696d369
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemContentModeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CodesystemContentModeEnumFactory implements EnumFactory {
+
+  public CodesystemContentMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("not-present".equals(codeString))
+      return CodesystemContentMode.NOTPRESENT;
+    if ("example".equals(codeString))
+      return CodesystemContentMode.EXAMPLE;
+    if ("fragment".equals(codeString))
+      return CodesystemContentMode.FRAGMENT;
+    if ("complete".equals(codeString))
+      return CodesystemContentMode.COMPLETE;
+    throw new IllegalArgumentException("Unknown CodesystemContentMode code '"+codeString+"'");
+  }
+
+  public String toCode(CodesystemContentMode code) {
+    if (code == CodesystemContentMode.NOTPRESENT)
+      return "not-present";
+    if (code == CodesystemContentMode.EXAMPLE)
+      return "example";
+    if (code == CodesystemContentMode.FRAGMENT)
+      return "fragment";
+    if (code == CodesystemContentMode.COMPLETE)
+      return "complete";
+    return "?";
+  }
+
+    public String toSystem(CodesystemContentMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemHierarchyMeaning.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemHierarchyMeaning.java
new file mode 100644
index 00000000000..2c3c9a084b9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemHierarchyMeaning.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CodesystemHierarchyMeaning {
+
+        /**
+         * No particular relationship between the concepts can be assumed, except what can be determined by inspection of the definitions of the elements (possible reasons to use this: importing from a source where this is not defined, or where various parts of the hierarchy have different meanings)
+         */
+        GROUPEDBY, 
+        /**
+         * A hierarchy where the child concepts have an IS-A relationship with the parents - that is, all the properties of the parent are also true for its child concepts
+         */
+        ISA, 
+        /**
+         * Child elements list the individual parts of a composite whole (e.g. body site)
+         */
+        PARTOF, 
+        /**
+         * Child concepts in the hierarchy may have only one parent, and there is a presumption that the code system is a "closed world" meaning all things must be in the hierarchy. This results in concepts such as "not otherwise classified."
+         */
+        CLASSIFIEDWITH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CodesystemHierarchyMeaning fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("grouped-by".equals(codeString))
+          return GROUPEDBY;
+        if ("is-a".equals(codeString))
+          return ISA;
+        if ("part-of".equals(codeString))
+          return PARTOF;
+        if ("classified-with".equals(codeString))
+          return CLASSIFIEDWITH;
+        throw new FHIRException("Unknown CodesystemHierarchyMeaning code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GROUPEDBY: return "grouped-by";
+            case ISA: return "is-a";
+            case PARTOF: return "part-of";
+            case CLASSIFIEDWITH: return "classified-with";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/codesystem-hierarchy-meaning";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GROUPEDBY: return "No particular relationship between the concepts can be assumed, except what can be determined by inspection of the definitions of the elements (possible reasons to use this: importing from a source where this is not defined, or where various parts of the hierarchy have different meanings)";
+            case ISA: return "A hierarchy where the child concepts have an IS-A relationship with the parents - that is, all the properties of the parent are also true for its child concepts";
+            case PARTOF: return "Child elements list the individual parts of a composite whole (e.g. body site)";
+            case CLASSIFIEDWITH: return "Child concepts in the hierarchy may have only one parent, and there is a presumption that the code system is a \"closed world\" meaning all things must be in the hierarchy. This results in concepts such as \"not otherwise classified.\"";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GROUPEDBY: return "Grouped By";
+            case ISA: return "Is-A";
+            case PARTOF: return "Part Of";
+            case CLASSIFIEDWITH: return "Classified With";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemHierarchyMeaningEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemHierarchyMeaningEnumFactory.java
new file mode 100644
index 00000000000..f73c9758781
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CodesystemHierarchyMeaningEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CodesystemHierarchyMeaningEnumFactory implements EnumFactory {
+
+  public CodesystemHierarchyMeaning fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("grouped-by".equals(codeString))
+      return CodesystemHierarchyMeaning.GROUPEDBY;
+    if ("is-a".equals(codeString))
+      return CodesystemHierarchyMeaning.ISA;
+    if ("part-of".equals(codeString))
+      return CodesystemHierarchyMeaning.PARTOF;
+    if ("classified-with".equals(codeString))
+      return CodesystemHierarchyMeaning.CLASSIFIEDWITH;
+    throw new IllegalArgumentException("Unknown CodesystemHierarchyMeaning code '"+codeString+"'");
+  }
+
+  public String toCode(CodesystemHierarchyMeaning code) {
+    if (code == CodesystemHierarchyMeaning.GROUPEDBY)
+      return "grouped-by";
+    if (code == CodesystemHierarchyMeaning.ISA)
+      return "is-a";
+    if (code == CodesystemHierarchyMeaning.PARTOF)
+      return "part-of";
+    if (code == CodesystemHierarchyMeaning.CLASSIFIEDWITH)
+      return "classified-with";
+    return "?";
+  }
+
+    public String toSystem(CodesystemHierarchyMeaning code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommonTags.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommonTags.java
new file mode 100644
index 00000000000..0ab77615324
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommonTags.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CommonTags {
+
+        /**
+         * This request is intended to be acted upon, not merely stored
+         */
+        ACTIONABLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CommonTags fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("actionable".equals(codeString))
+          return ACTIONABLE;
+        throw new FHIRException("Unknown CommonTags code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIONABLE: return "actionable";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/common-tags";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIONABLE: return "This request is intended to be acted upon, not merely stored";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIONABLE: return "Actionable";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommonTagsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommonTagsEnumFactory.java
new file mode 100644
index 00000000000..fc8a63c69a9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommonTagsEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CommonTagsEnumFactory implements EnumFactory {
+
+  public CommonTags fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("actionable".equals(codeString))
+      return CommonTags.ACTIONABLE;
+    throw new IllegalArgumentException("Unknown CommonTags code '"+codeString+"'");
+  }
+
+  public String toCode(CommonTags code) {
+    if (code == CommonTags.ACTIONABLE)
+      return "actionable";
+    return "?";
+  }
+
+    public String toSystem(CommonTags code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationCategory.java
new file mode 100644
index 00000000000..d6b3a940fa9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationCategory.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CommunicationCategory {
+
+        /**
+         * The communication conveys an alert.
+         */
+        ALERT, 
+        /**
+         * The communication conveys a notification.
+         */
+        NOTIFICATION, 
+        /**
+         * The communication conveys a reminder.
+         */
+        REMINDER, 
+        /**
+         * The communication conveys instruction.
+         */
+        INSTRUCTION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CommunicationCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("alert".equals(codeString))
+          return ALERT;
+        if ("notification".equals(codeString))
+          return NOTIFICATION;
+        if ("reminder".equals(codeString))
+          return REMINDER;
+        if ("instruction".equals(codeString))
+          return INSTRUCTION;
+        throw new FHIRException("Unknown CommunicationCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ALERT: return "alert";
+            case NOTIFICATION: return "notification";
+            case REMINDER: return "reminder";
+            case INSTRUCTION: return "instruction";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/communication-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ALERT: return "The communication conveys an alert.";
+            case NOTIFICATION: return "The communication conveys a notification.";
+            case REMINDER: return "The communication conveys a reminder.";
+            case INSTRUCTION: return "The communication conveys instruction.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ALERT: return "Alert";
+            case NOTIFICATION: return "Notification";
+            case REMINDER: return "Reminder";
+            case INSTRUCTION: return "Instruction";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationCategoryEnumFactory.java
new file mode 100644
index 00000000000..298c57b0fe0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationCategoryEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CommunicationCategoryEnumFactory implements EnumFactory {
+
+  public CommunicationCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("alert".equals(codeString))
+      return CommunicationCategory.ALERT;
+    if ("notification".equals(codeString))
+      return CommunicationCategory.NOTIFICATION;
+    if ("reminder".equals(codeString))
+      return CommunicationCategory.REMINDER;
+    if ("instruction".equals(codeString))
+      return CommunicationCategory.INSTRUCTION;
+    throw new IllegalArgumentException("Unknown CommunicationCategory code '"+codeString+"'");
+  }
+
+  public String toCode(CommunicationCategory code) {
+    if (code == CommunicationCategory.ALERT)
+      return "alert";
+    if (code == CommunicationCategory.NOTIFICATION)
+      return "notification";
+    if (code == CommunicationCategory.REMINDER)
+      return "reminder";
+    if (code == CommunicationCategory.INSTRUCTION)
+      return "instruction";
+    return "?";
+  }
+
+    public String toSystem(CommunicationCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationNotDoneReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationNotDoneReason.java
new file mode 100644
index 00000000000..bf263f86844
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationNotDoneReason.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CommunicationNotDoneReason {
+
+        /**
+         * The communication was not done due to an unknown reason.
+         */
+        UNKNOWN, 
+        /**
+         * The communication was not done due to a system error.
+         */
+        SYSTEMERROR, 
+        /**
+         * The communication was not done due to an invalid phone number.
+         */
+        INVALIDPHONENUMBER, 
+        /**
+         * The communication was not done due to the recipient being unavailable.
+         */
+        RECIPIENTUNAVAILABLE, 
+        /**
+         * The communication was not done due to a family objection.
+         */
+        FAMILYOBJECTION, 
+        /**
+         * The communication was not done due to a patient objection.
+         */
+        PATIENTOBJECTION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CommunicationNotDoneReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        if ("system-error".equals(codeString))
+          return SYSTEMERROR;
+        if ("invalid-phone-number".equals(codeString))
+          return INVALIDPHONENUMBER;
+        if ("recipient-unavailable".equals(codeString))
+          return RECIPIENTUNAVAILABLE;
+        if ("family-objection".equals(codeString))
+          return FAMILYOBJECTION;
+        if ("patient-objection".equals(codeString))
+          return PATIENTOBJECTION;
+        throw new FHIRException("Unknown CommunicationNotDoneReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UNKNOWN: return "unknown";
+            case SYSTEMERROR: return "system-error";
+            case INVALIDPHONENUMBER: return "invalid-phone-number";
+            case RECIPIENTUNAVAILABLE: return "recipient-unavailable";
+            case FAMILYOBJECTION: return "family-objection";
+            case PATIENTOBJECTION: return "patient-objection";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/communication-not-done-reason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UNKNOWN: return "The communication was not done due to an unknown reason.";
+            case SYSTEMERROR: return "The communication was not done due to a system error.";
+            case INVALIDPHONENUMBER: return "The communication was not done due to an invalid phone number.";
+            case RECIPIENTUNAVAILABLE: return "The communication was not done due to the recipient being unavailable.";
+            case FAMILYOBJECTION: return "The communication was not done due to a family objection.";
+            case PATIENTOBJECTION: return "The communication was not done due to a patient objection.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UNKNOWN: return "Unknown";
+            case SYSTEMERROR: return "System Error";
+            case INVALIDPHONENUMBER: return "Invalid Phone Number";
+            case RECIPIENTUNAVAILABLE: return "Recipient Unavailable";
+            case FAMILYOBJECTION: return "Family Objection";
+            case PATIENTOBJECTION: return "Patient Objection";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationNotDoneReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationNotDoneReasonEnumFactory.java
new file mode 100644
index 00000000000..16130433952
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationNotDoneReasonEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CommunicationNotDoneReasonEnumFactory implements EnumFactory {
+
+  public CommunicationNotDoneReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("unknown".equals(codeString))
+      return CommunicationNotDoneReason.UNKNOWN;
+    if ("system-error".equals(codeString))
+      return CommunicationNotDoneReason.SYSTEMERROR;
+    if ("invalid-phone-number".equals(codeString))
+      return CommunicationNotDoneReason.INVALIDPHONENUMBER;
+    if ("recipient-unavailable".equals(codeString))
+      return CommunicationNotDoneReason.RECIPIENTUNAVAILABLE;
+    if ("family-objection".equals(codeString))
+      return CommunicationNotDoneReason.FAMILYOBJECTION;
+    if ("patient-objection".equals(codeString))
+      return CommunicationNotDoneReason.PATIENTOBJECTION;
+    throw new IllegalArgumentException("Unknown CommunicationNotDoneReason code '"+codeString+"'");
+  }
+
+  public String toCode(CommunicationNotDoneReason code) {
+    if (code == CommunicationNotDoneReason.UNKNOWN)
+      return "unknown";
+    if (code == CommunicationNotDoneReason.SYSTEMERROR)
+      return "system-error";
+    if (code == CommunicationNotDoneReason.INVALIDPHONENUMBER)
+      return "invalid-phone-number";
+    if (code == CommunicationNotDoneReason.RECIPIENTUNAVAILABLE)
+      return "recipient-unavailable";
+    if (code == CommunicationNotDoneReason.FAMILYOBJECTION)
+      return "family-objection";
+    if (code == CommunicationNotDoneReason.PATIENTOBJECTION)
+      return "patient-objection";
+    return "?";
+  }
+
+    public String toSystem(CommunicationNotDoneReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationRequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationRequestStatus.java
new file mode 100644
index 00000000000..a52d1c83540
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationRequestStatus.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CommunicationRequestStatus {
+
+        /**
+         * The request has been proposed.
+         */
+        PROPOSED, 
+        /**
+         * The request has been planned.
+         */
+        PLANNED, 
+        /**
+         * The request has been placed.
+         */
+        REQUESTED, 
+        /**
+         * The receiving system has received the request but not yet decided whether it will be performed.
+         */
+        RECEIVED, 
+        /**
+         * The receiving system has accepted the order, but work has not yet commenced.
+         */
+        ACCEPTED, 
+        /**
+         * The work to fulfill the order is happening.
+         */
+        INPROGRESS, 
+        /**
+         * The work has been complete, the report(s) released, and no further work is planned.
+         */
+        COMPLETED, 
+        /**
+         * The request has been held by originating system/user request.
+         */
+        SUSPENDED, 
+        /**
+         * The receiving system has declined to fulfill the request
+         */
+        REJECTED, 
+        /**
+         * The communication was attempted, but due to some procedural error, it could not be completed.
+         */
+        FAILED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CommunicationRequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposed".equals(codeString))
+          return PROPOSED;
+        if ("planned".equals(codeString))
+          return PLANNED;
+        if ("requested".equals(codeString))
+          return REQUESTED;
+        if ("received".equals(codeString))
+          return RECEIVED;
+        if ("accepted".equals(codeString))
+          return ACCEPTED;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("rejected".equals(codeString))
+          return REJECTED;
+        if ("failed".equals(codeString))
+          return FAILED;
+        throw new FHIRException("Unknown CommunicationRequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSED: return "proposed";
+            case PLANNED: return "planned";
+            case REQUESTED: return "requested";
+            case RECEIVED: return "received";
+            case ACCEPTED: return "accepted";
+            case INPROGRESS: return "in-progress";
+            case COMPLETED: return "completed";
+            case SUSPENDED: return "suspended";
+            case REJECTED: return "rejected";
+            case FAILED: return "failed";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/communication-request-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSED: return "The request has been proposed.";
+            case PLANNED: return "The request has been planned.";
+            case REQUESTED: return "The request has been placed.";
+            case RECEIVED: return "The receiving system has received the request but not yet decided whether it will be performed.";
+            case ACCEPTED: return "The receiving system has accepted the order, but work has not yet commenced.";
+            case INPROGRESS: return "The work to fulfill the order is happening.";
+            case COMPLETED: return "The work has been complete, the report(s) released, and no further work is planned.";
+            case SUSPENDED: return "The request has been held by originating system/user request.";
+            case REJECTED: return "The receiving system has declined to fulfill the request";
+            case FAILED: return "The communication was attempted, but due to some procedural error, it could not be completed.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSED: return "Proposed";
+            case PLANNED: return "Planned";
+            case REQUESTED: return "Requested";
+            case RECEIVED: return "Received";
+            case ACCEPTED: return "Accepted";
+            case INPROGRESS: return "In Progress";
+            case COMPLETED: return "Completed";
+            case SUSPENDED: return "Suspended";
+            case REJECTED: return "Rejected";
+            case FAILED: return "Failed";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationRequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationRequestStatusEnumFactory.java
new file mode 100644
index 00000000000..44111068a58
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationRequestStatusEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CommunicationRequestStatusEnumFactory implements EnumFactory {
+
+  public CommunicationRequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposed".equals(codeString))
+      return CommunicationRequestStatus.PROPOSED;
+    if ("planned".equals(codeString))
+      return CommunicationRequestStatus.PLANNED;
+    if ("requested".equals(codeString))
+      return CommunicationRequestStatus.REQUESTED;
+    if ("received".equals(codeString))
+      return CommunicationRequestStatus.RECEIVED;
+    if ("accepted".equals(codeString))
+      return CommunicationRequestStatus.ACCEPTED;
+    if ("in-progress".equals(codeString))
+      return CommunicationRequestStatus.INPROGRESS;
+    if ("completed".equals(codeString))
+      return CommunicationRequestStatus.COMPLETED;
+    if ("suspended".equals(codeString))
+      return CommunicationRequestStatus.SUSPENDED;
+    if ("rejected".equals(codeString))
+      return CommunicationRequestStatus.REJECTED;
+    if ("failed".equals(codeString))
+      return CommunicationRequestStatus.FAILED;
+    throw new IllegalArgumentException("Unknown CommunicationRequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(CommunicationRequestStatus code) {
+    if (code == CommunicationRequestStatus.PROPOSED)
+      return "proposed";
+    if (code == CommunicationRequestStatus.PLANNED)
+      return "planned";
+    if (code == CommunicationRequestStatus.REQUESTED)
+      return "requested";
+    if (code == CommunicationRequestStatus.RECEIVED)
+      return "received";
+    if (code == CommunicationRequestStatus.ACCEPTED)
+      return "accepted";
+    if (code == CommunicationRequestStatus.INPROGRESS)
+      return "in-progress";
+    if (code == CommunicationRequestStatus.COMPLETED)
+      return "completed";
+    if (code == CommunicationRequestStatus.SUSPENDED)
+      return "suspended";
+    if (code == CommunicationRequestStatus.REJECTED)
+      return "rejected";
+    if (code == CommunicationRequestStatus.FAILED)
+      return "failed";
+    return "?";
+  }
+
+    public String toSystem(CommunicationRequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationStatus.java
new file mode 100644
index 00000000000..70f1353eff2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationStatus.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CommunicationStatus {
+
+        /**
+         * The communication transmission is ongoing.
+         */
+        INPROGRESS, 
+        /**
+         * The message transmission is complete, i.e., delivered to the recipient's destination.
+         */
+        COMPLETED, 
+        /**
+         * The communication transmission has been held by originating system/user request.
+         */
+        SUSPENDED, 
+        /**
+         * The receiving system has declined to accept the message.
+         */
+        REJECTED, 
+        /**
+         * There was a failure in transmitting the message out.
+         */
+        FAILED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CommunicationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("rejected".equals(codeString))
+          return REJECTED;
+        if ("failed".equals(codeString))
+          return FAILED;
+        throw new FHIRException("Unknown CommunicationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INPROGRESS: return "in-progress";
+            case COMPLETED: return "completed";
+            case SUSPENDED: return "suspended";
+            case REJECTED: return "rejected";
+            case FAILED: return "failed";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/communication-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INPROGRESS: return "The communication transmission is ongoing.";
+            case COMPLETED: return "The message transmission is complete, i.e., delivered to the recipient's destination.";
+            case SUSPENDED: return "The communication transmission has been held by originating system/user request.";
+            case REJECTED: return "The receiving system has declined to accept the message.";
+            case FAILED: return "There was a failure in transmitting the message out.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INPROGRESS: return "In Progress";
+            case COMPLETED: return "Completed";
+            case SUSPENDED: return "Suspended";
+            case REJECTED: return "Rejected";
+            case FAILED: return "Failed";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationStatusEnumFactory.java
new file mode 100644
index 00000000000..77d715b4fb7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CommunicationStatusEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CommunicationStatusEnumFactory implements EnumFactory {
+
+  public CommunicationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("in-progress".equals(codeString))
+      return CommunicationStatus.INPROGRESS;
+    if ("completed".equals(codeString))
+      return CommunicationStatus.COMPLETED;
+    if ("suspended".equals(codeString))
+      return CommunicationStatus.SUSPENDED;
+    if ("rejected".equals(codeString))
+      return CommunicationStatus.REJECTED;
+    if ("failed".equals(codeString))
+      return CommunicationStatus.FAILED;
+    throw new IllegalArgumentException("Unknown CommunicationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(CommunicationStatus code) {
+    if (code == CommunicationStatus.INPROGRESS)
+      return "in-progress";
+    if (code == CommunicationStatus.COMPLETED)
+      return "completed";
+    if (code == CommunicationStatus.SUSPENDED)
+      return "suspended";
+    if (code == CommunicationStatus.REJECTED)
+      return "rejected";
+    if (code == CommunicationStatus.FAILED)
+      return "failed";
+    return "?";
+  }
+
+    public String toSystem(CommunicationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompartmentType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompartmentType.java
new file mode 100644
index 00000000000..a563e69b9f7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompartmentType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CompartmentType {
+
+        /**
+         * The compartment definition is for the patient compartment
+         */
+        PATIENT, 
+        /**
+         * The compartment definition is for the encounter compartment
+         */
+        ENCOUNTER, 
+        /**
+         * The compartment definition is for the related-person compartment
+         */
+        RELATEDPERSON, 
+        /**
+         * The compartment definition is for the practitioner compartment
+         */
+        PRACTITIONER, 
+        /**
+         * The compartment definition is for the device compartment
+         */
+        DEVICE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CompartmentType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("Patient".equals(codeString))
+          return PATIENT;
+        if ("Encounter".equals(codeString))
+          return ENCOUNTER;
+        if ("RelatedPerson".equals(codeString))
+          return RELATEDPERSON;
+        if ("Practitioner".equals(codeString))
+          return PRACTITIONER;
+        if ("Device".equals(codeString))
+          return DEVICE;
+        throw new FHIRException("Unknown CompartmentType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PATIENT: return "Patient";
+            case ENCOUNTER: return "Encounter";
+            case RELATEDPERSON: return "RelatedPerson";
+            case PRACTITIONER: return "Practitioner";
+            case DEVICE: return "Device";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/compartment-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PATIENT: return "The compartment definition is for the patient compartment";
+            case ENCOUNTER: return "The compartment definition is for the encounter compartment";
+            case RELATEDPERSON: return "The compartment definition is for the related-person compartment";
+            case PRACTITIONER: return "The compartment definition is for the practitioner compartment";
+            case DEVICE: return "The compartment definition is for the device compartment";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PATIENT: return "Patient";
+            case ENCOUNTER: return "Encounter";
+            case RELATEDPERSON: return "RelatedPerson";
+            case PRACTITIONER: return "Practitioner";
+            case DEVICE: return "Device";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompartmentTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompartmentTypeEnumFactory.java
new file mode 100644
index 00000000000..d643650a5dd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompartmentTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CompartmentTypeEnumFactory implements EnumFactory {
+
+  public CompartmentType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("Patient".equals(codeString))
+      return CompartmentType.PATIENT;
+    if ("Encounter".equals(codeString))
+      return CompartmentType.ENCOUNTER;
+    if ("RelatedPerson".equals(codeString))
+      return CompartmentType.RELATEDPERSON;
+    if ("Practitioner".equals(codeString))
+      return CompartmentType.PRACTITIONER;
+    if ("Device".equals(codeString))
+      return CompartmentType.DEVICE;
+    throw new IllegalArgumentException("Unknown CompartmentType code '"+codeString+"'");
+  }
+
+  public String toCode(CompartmentType code) {
+    if (code == CompartmentType.PATIENT)
+      return "Patient";
+    if (code == CompartmentType.ENCOUNTER)
+      return "Encounter";
+    if (code == CompartmentType.RELATEDPERSON)
+      return "RelatedPerson";
+    if (code == CompartmentType.PRACTITIONER)
+      return "Practitioner";
+    if (code == CompartmentType.DEVICE)
+      return "Device";
+    return "?";
+  }
+
+    public String toSystem(CompartmentType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositeMeasureScoring.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositeMeasureScoring.java
new file mode 100644
index 00000000000..50edeed75c6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositeMeasureScoring.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CompositeMeasureScoring {
+
+        /**
+         * Opportunity scoring combines the scores from component measures by combining the numerators and denominators for each component
+         */
+        OPPORTUNITY, 
+        /**
+         * All-or-nothing scoring includes an individual in the numerator of the composite measure if they are in the numerators of all of the component measures in which they are in the denominator
+         */
+        ALLORNOTHING, 
+        /**
+         * Linear scoring gives an individual a score based on the number of numerators in which they appear
+         */
+        LINEAR, 
+        /**
+         * Weighted scoring gives an individual a score based on a weighted factor for each component numerator in which they appear
+         */
+        WEIGHTED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CompositeMeasureScoring fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("opportunity".equals(codeString))
+          return OPPORTUNITY;
+        if ("all-or-nothing".equals(codeString))
+          return ALLORNOTHING;
+        if ("linear".equals(codeString))
+          return LINEAR;
+        if ("weighted".equals(codeString))
+          return WEIGHTED;
+        throw new FHIRException("Unknown CompositeMeasureScoring code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OPPORTUNITY: return "opportunity";
+            case ALLORNOTHING: return "all-or-nothing";
+            case LINEAR: return "linear";
+            case WEIGHTED: return "weighted";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/composite-measure-scoring";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OPPORTUNITY: return "Opportunity scoring combines the scores from component measures by combining the numerators and denominators for each component";
+            case ALLORNOTHING: return "All-or-nothing scoring includes an individual in the numerator of the composite measure if they are in the numerators of all of the component measures in which they are in the denominator";
+            case LINEAR: return "Linear scoring gives an individual a score based on the number of numerators in which they appear";
+            case WEIGHTED: return "Weighted scoring gives an individual a score based on a weighted factor for each component numerator in which they appear";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OPPORTUNITY: return "Opportunity";
+            case ALLORNOTHING: return "All-or-nothing";
+            case LINEAR: return "Linear";
+            case WEIGHTED: return "Weighted";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositeMeasureScoringEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositeMeasureScoringEnumFactory.java
new file mode 100644
index 00000000000..d4e96307d67
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositeMeasureScoringEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CompositeMeasureScoringEnumFactory implements EnumFactory {
+
+  public CompositeMeasureScoring fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("opportunity".equals(codeString))
+      return CompositeMeasureScoring.OPPORTUNITY;
+    if ("all-or-nothing".equals(codeString))
+      return CompositeMeasureScoring.ALLORNOTHING;
+    if ("linear".equals(codeString))
+      return CompositeMeasureScoring.LINEAR;
+    if ("weighted".equals(codeString))
+      return CompositeMeasureScoring.WEIGHTED;
+    throw new IllegalArgumentException("Unknown CompositeMeasureScoring code '"+codeString+"'");
+  }
+
+  public String toCode(CompositeMeasureScoring code) {
+    if (code == CompositeMeasureScoring.OPPORTUNITY)
+      return "opportunity";
+    if (code == CompositeMeasureScoring.ALLORNOTHING)
+      return "all-or-nothing";
+    if (code == CompositeMeasureScoring.LINEAR)
+      return "linear";
+    if (code == CompositeMeasureScoring.WEIGHTED)
+      return "weighted";
+    return "?";
+  }
+
+    public String toSystem(CompositeMeasureScoring code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionAttestationMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionAttestationMode.java
new file mode 100644
index 00000000000..296b6feb6f8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionAttestationMode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CompositionAttestationMode {
+
+        /**
+         * The person authenticated the content in their personal capacity.
+         */
+        PERSONAL, 
+        /**
+         * The person authenticated the content in their professional capacity.
+         */
+        PROFESSIONAL, 
+        /**
+         * The person authenticated the content and accepted legal responsibility for its content.
+         */
+        LEGAL, 
+        /**
+         * The organization authenticated the content as consistent with their policies and procedures.
+         */
+        OFFICIAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CompositionAttestationMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("personal".equals(codeString))
+          return PERSONAL;
+        if ("professional".equals(codeString))
+          return PROFESSIONAL;
+        if ("legal".equals(codeString))
+          return LEGAL;
+        if ("official".equals(codeString))
+          return OFFICIAL;
+        throw new FHIRException("Unknown CompositionAttestationMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PERSONAL: return "personal";
+            case PROFESSIONAL: return "professional";
+            case LEGAL: return "legal";
+            case OFFICIAL: return "official";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/composition-attestation-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PERSONAL: return "The person authenticated the content in their personal capacity.";
+            case PROFESSIONAL: return "The person authenticated the content in their professional capacity.";
+            case LEGAL: return "The person authenticated the content and accepted legal responsibility for its content.";
+            case OFFICIAL: return "The organization authenticated the content as consistent with their policies and procedures.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PERSONAL: return "Personal";
+            case PROFESSIONAL: return "Professional";
+            case LEGAL: return "Legal";
+            case OFFICIAL: return "Official";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionAttestationModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionAttestationModeEnumFactory.java
new file mode 100644
index 00000000000..da40ff7db07
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionAttestationModeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CompositionAttestationModeEnumFactory implements EnumFactory {
+
+  public CompositionAttestationMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("personal".equals(codeString))
+      return CompositionAttestationMode.PERSONAL;
+    if ("professional".equals(codeString))
+      return CompositionAttestationMode.PROFESSIONAL;
+    if ("legal".equals(codeString))
+      return CompositionAttestationMode.LEGAL;
+    if ("official".equals(codeString))
+      return CompositionAttestationMode.OFFICIAL;
+    throw new IllegalArgumentException("Unknown CompositionAttestationMode code '"+codeString+"'");
+  }
+
+  public String toCode(CompositionAttestationMode code) {
+    if (code == CompositionAttestationMode.PERSONAL)
+      return "personal";
+    if (code == CompositionAttestationMode.PROFESSIONAL)
+      return "professional";
+    if (code == CompositionAttestationMode.LEGAL)
+      return "legal";
+    if (code == CompositionAttestationMode.OFFICIAL)
+      return "official";
+    return "?";
+  }
+
+    public String toSystem(CompositionAttestationMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionStatus.java
new file mode 100644
index 00000000000..be776c3c5c8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CompositionStatus {
+
+        /**
+         * This is a preliminary composition or document (also known as initial or interim). The content may be incomplete or unverified.
+         */
+        PRELIMINARY, 
+        /**
+         * This version of the composition is complete and verified by an appropriate person and no further work is planned. Any subsequent updates would be on a new version of the composition.
+         */
+        FINAL, 
+        /**
+         * The composition content or the referenced resources have been modified (edited or added to) subsequent to being released as "final" and the composition is complete and verified by an authorized person.
+         */
+        AMENDED, 
+        /**
+         * The composition or document was originally created/issued in error, and this is an amendment that marks that the entire series should not be considered as valid.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CompositionStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("preliminary".equals(codeString))
+          return PRELIMINARY;
+        if ("final".equals(codeString))
+          return FINAL;
+        if ("amended".equals(codeString))
+          return AMENDED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown CompositionStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PRELIMINARY: return "preliminary";
+            case FINAL: return "final";
+            case AMENDED: return "amended";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/composition-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PRELIMINARY: return "This is a preliminary composition or document (also known as initial or interim). The content may be incomplete or unverified.";
+            case FINAL: return "This version of the composition is complete and verified by an appropriate person and no further work is planned. Any subsequent updates would be on a new version of the composition.";
+            case AMENDED: return "The composition content or the referenced resources have been modified (edited or added to) subsequent to being released as \"final\" and the composition is complete and verified by an authorized person.";
+            case ENTEREDINERROR: return "The composition or document was originally created/issued in error, and this is an amendment that marks that the entire series should not be considered as valid.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PRELIMINARY: return "Preliminary";
+            case FINAL: return "Final";
+            case AMENDED: return "Amended";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionStatusEnumFactory.java
new file mode 100644
index 00000000000..00ff549e155
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CompositionStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CompositionStatusEnumFactory implements EnumFactory {
+
+  public CompositionStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("preliminary".equals(codeString))
+      return CompositionStatus.PRELIMINARY;
+    if ("final".equals(codeString))
+      return CompositionStatus.FINAL;
+    if ("amended".equals(codeString))
+      return CompositionStatus.AMENDED;
+    if ("entered-in-error".equals(codeString))
+      return CompositionStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown CompositionStatus code '"+codeString+"'");
+  }
+
+  public String toCode(CompositionStatus code) {
+    if (code == CompositionStatus.PRELIMINARY)
+      return "preliminary";
+    if (code == CompositionStatus.FINAL)
+      return "final";
+    if (code == CompositionStatus.AMENDED)
+      return "amended";
+    if (code == CompositionStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(CompositionStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptMapEquivalence.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptMapEquivalence.java
new file mode 100644
index 00000000000..eda9e46e14e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptMapEquivalence.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConceptMapEquivalence {
+
+        /**
+         * The concepts are related to each other, and have at least some overlap in meaning, but the exact relationship is not known
+         */
+        RELATEDTO, 
+        /**
+         * The definitions of the concepts mean the same thing (including when structural implications of meaning are considered) (i.e. extensionally identical).
+         */
+        EQUIVALENT, 
+        /**
+         * The definitions of the concepts are exactly the same (i.e. only grammatical differences) and structural implications of meaning are identical or irrelevant (i.e. intentionally identical).
+         */
+        EQUAL, 
+        /**
+         * The target mapping is wider in meaning than the source concept.
+         */
+        WIDER, 
+        /**
+         * The target mapping subsumes the meaning of the source concept (e.g. the source is-a target).
+         */
+        SUBSUMES, 
+        /**
+         * The target mapping is narrower in meaning than the source concept. The sense in which the mapping is narrower SHALL be described in the comments in this case, and applications should be careful when attempting to use these mappings operationally.
+         */
+        NARROWER, 
+        /**
+         * The target mapping specializes the meaning of the source concept (e.g. the target is-a source).
+         */
+        SPECIALIZES, 
+        /**
+         * The target mapping overlaps with the source concept, but both source and target cover additional meaning, or the definitions are imprecise and it is uncertain whether they have the same boundaries to their meaning. The sense in which the mapping is narrower SHALL be described in the comments in this case, and applications should be careful when attempting to use these mappings operationally.
+         */
+        INEXACT, 
+        /**
+         * There is no match for this concept in the destination concept system.
+         */
+        UNMATCHED, 
+        /**
+         * This is an explicit assertion that there is no mapping between the source and target concept.
+         */
+        DISJOINT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConceptMapEquivalence fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("relatedto".equals(codeString))
+          return RELATEDTO;
+        if ("equivalent".equals(codeString))
+          return EQUIVALENT;
+        if ("equal".equals(codeString))
+          return EQUAL;
+        if ("wider".equals(codeString))
+          return WIDER;
+        if ("subsumes".equals(codeString))
+          return SUBSUMES;
+        if ("narrower".equals(codeString))
+          return NARROWER;
+        if ("specializes".equals(codeString))
+          return SPECIALIZES;
+        if ("inexact".equals(codeString))
+          return INEXACT;
+        if ("unmatched".equals(codeString))
+          return UNMATCHED;
+        if ("disjoint".equals(codeString))
+          return DISJOINT;
+        throw new FHIRException("Unknown ConceptMapEquivalence code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case RELATEDTO: return "relatedto";
+            case EQUIVALENT: return "equivalent";
+            case EQUAL: return "equal";
+            case WIDER: return "wider";
+            case SUBSUMES: return "subsumes";
+            case NARROWER: return "narrower";
+            case SPECIALIZES: return "specializes";
+            case INEXACT: return "inexact";
+            case UNMATCHED: return "unmatched";
+            case DISJOINT: return "disjoint";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/concept-map-equivalence";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case RELATEDTO: return "The concepts are related to each other, and have at least some overlap in meaning, but the exact relationship is not known";
+            case EQUIVALENT: return "The definitions of the concepts mean the same thing (including when structural implications of meaning are considered) (i.e. extensionally identical).";
+            case EQUAL: return "The definitions of the concepts are exactly the same (i.e. only grammatical differences) and structural implications of meaning are identical or irrelevant (i.e. intentionally identical).";
+            case WIDER: return "The target mapping is wider in meaning than the source concept.";
+            case SUBSUMES: return "The target mapping subsumes the meaning of the source concept (e.g. the source is-a target).";
+            case NARROWER: return "The target mapping is narrower in meaning than the source concept. The sense in which the mapping is narrower SHALL be described in the comments in this case, and applications should be careful when attempting to use these mappings operationally.";
+            case SPECIALIZES: return "The target mapping specializes the meaning of the source concept (e.g. the target is-a source).";
+            case INEXACT: return "The target mapping overlaps with the source concept, but both source and target cover additional meaning, or the definitions are imprecise and it is uncertain whether they have the same boundaries to their meaning. The sense in which the mapping is narrower SHALL be described in the comments in this case, and applications should be careful when attempting to use these mappings operationally.";
+            case UNMATCHED: return "There is no match for this concept in the destination concept system.";
+            case DISJOINT: return "This is an explicit assertion that there is no mapping between the source and target concept.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case RELATEDTO: return "Related To";
+            case EQUIVALENT: return "Equivalent";
+            case EQUAL: return "Equal";
+            case WIDER: return "Wider";
+            case SUBSUMES: return "Subsumes";
+            case NARROWER: return "Narrower";
+            case SPECIALIZES: return "Specializes";
+            case INEXACT: return "Inexact";
+            case UNMATCHED: return "Unmatched";
+            case DISJOINT: return "Disjoint";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptMapEquivalenceEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptMapEquivalenceEnumFactory.java
new file mode 100644
index 00000000000..aa7e290a8a3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptMapEquivalenceEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConceptMapEquivalenceEnumFactory implements EnumFactory {
+
+  public ConceptMapEquivalence fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("relatedto".equals(codeString))
+      return ConceptMapEquivalence.RELATEDTO;
+    if ("equivalent".equals(codeString))
+      return ConceptMapEquivalence.EQUIVALENT;
+    if ("equal".equals(codeString))
+      return ConceptMapEquivalence.EQUAL;
+    if ("wider".equals(codeString))
+      return ConceptMapEquivalence.WIDER;
+    if ("subsumes".equals(codeString))
+      return ConceptMapEquivalence.SUBSUMES;
+    if ("narrower".equals(codeString))
+      return ConceptMapEquivalence.NARROWER;
+    if ("specializes".equals(codeString))
+      return ConceptMapEquivalence.SPECIALIZES;
+    if ("inexact".equals(codeString))
+      return ConceptMapEquivalence.INEXACT;
+    if ("unmatched".equals(codeString))
+      return ConceptMapEquivalence.UNMATCHED;
+    if ("disjoint".equals(codeString))
+      return ConceptMapEquivalence.DISJOINT;
+    throw new IllegalArgumentException("Unknown ConceptMapEquivalence code '"+codeString+"'");
+  }
+
+  public String toCode(ConceptMapEquivalence code) {
+    if (code == ConceptMapEquivalence.RELATEDTO)
+      return "relatedto";
+    if (code == ConceptMapEquivalence.EQUIVALENT)
+      return "equivalent";
+    if (code == ConceptMapEquivalence.EQUAL)
+      return "equal";
+    if (code == ConceptMapEquivalence.WIDER)
+      return "wider";
+    if (code == ConceptMapEquivalence.SUBSUMES)
+      return "subsumes";
+    if (code == ConceptMapEquivalence.NARROWER)
+      return "narrower";
+    if (code == ConceptMapEquivalence.SPECIALIZES)
+      return "specializes";
+    if (code == ConceptMapEquivalence.INEXACT)
+      return "inexact";
+    if (code == ConceptMapEquivalence.UNMATCHED)
+      return "unmatched";
+    if (code == ConceptMapEquivalence.DISJOINT)
+      return "disjoint";
+    return "?";
+  }
+
+    public String toSystem(ConceptMapEquivalence code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptProperties.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptProperties.java
new file mode 100644
index 00000000000..fbad5df6266
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptProperties.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConceptProperties {
+
+        /**
+         * True if the concept is not considered active - e.g. not a valid concept any more. Property type is boolean, default value is false
+         */
+        INACTIVE, 
+        /**
+         * The date at which a concept was deprecated. Concepts that are deprecated but not inactive can still be used, but their use is discouraged, and they should be expected to be made inactive in a future release. Property type is dateTime
+         */
+        DEPRECATED, 
+        /**
+         * The concept is not intended to be chosen by the user - only intended to be used as a selector for other concepts. Note, though, that the interpretation of this is highly contextual; all concepts are selectable in some context. Property type is boolean, default value is false
+         */
+        NOTSELECTABLE, 
+        /**
+         * The concept identified in this property is a parent of the concept on which it is a property. The property type will be 'code'. The meaning of 'parent' is defined by the hierarchyMeaning attribute
+         */
+        PARENT, 
+        /**
+         * The concept identified in this property is a child of the concept on which it is a property. The property type will be 'code'. The meaning of 'child' is defined by the hierarchyMeaning attribute
+         */
+        CHILD, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConceptProperties fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("deprecated".equals(codeString))
+          return DEPRECATED;
+        if ("notSelectable".equals(codeString))
+          return NOTSELECTABLE;
+        if ("parent".equals(codeString))
+          return PARENT;
+        if ("child".equals(codeString))
+          return CHILD;
+        throw new FHIRException("Unknown ConceptProperties code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INACTIVE: return "inactive";
+            case DEPRECATED: return "deprecated";
+            case NOTSELECTABLE: return "notSelectable";
+            case PARENT: return "parent";
+            case CHILD: return "child";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/concept-properties";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INACTIVE: return "True if the concept is not considered active - e.g. not a valid concept any more. Property type is boolean, default value is false";
+            case DEPRECATED: return "The date at which a concept was deprecated. Concepts that are deprecated but not inactive can still be used, but their use is discouraged, and they should be expected to be made inactive in a future release. Property type is dateTime";
+            case NOTSELECTABLE: return "The concept is not intended to be chosen by the user - only intended to be used as a selector for other concepts. Note, though, that the interpretation of this is highly contextual; all concepts are selectable in some context. Property type is boolean, default value is false";
+            case PARENT: return "The concept identified in this property is a parent of the concept on which it is a property. The property type will be 'code'. The meaning of 'parent' is defined by the hierarchyMeaning attribute";
+            case CHILD: return "The concept identified in this property is a child of the concept on which it is a property. The property type will be 'code'. The meaning of 'child' is defined by the hierarchyMeaning attribute";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INACTIVE: return "Inactive";
+            case DEPRECATED: return "Deprecated";
+            case NOTSELECTABLE: return "Not Selectable";
+            case PARENT: return "Parent";
+            case CHILD: return "Child";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptPropertiesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptPropertiesEnumFactory.java
new file mode 100644
index 00000000000..c3c4b065545
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptPropertiesEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConceptPropertiesEnumFactory implements EnumFactory {
+
+  public ConceptProperties fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("inactive".equals(codeString))
+      return ConceptProperties.INACTIVE;
+    if ("deprecated".equals(codeString))
+      return ConceptProperties.DEPRECATED;
+    if ("notSelectable".equals(codeString))
+      return ConceptProperties.NOTSELECTABLE;
+    if ("parent".equals(codeString))
+      return ConceptProperties.PARENT;
+    if ("child".equals(codeString))
+      return ConceptProperties.CHILD;
+    throw new IllegalArgumentException("Unknown ConceptProperties code '"+codeString+"'");
+  }
+
+  public String toCode(ConceptProperties code) {
+    if (code == ConceptProperties.INACTIVE)
+      return "inactive";
+    if (code == ConceptProperties.DEPRECATED)
+      return "deprecated";
+    if (code == ConceptProperties.NOTSELECTABLE)
+      return "notSelectable";
+    if (code == ConceptProperties.PARENT)
+      return "parent";
+    if (code == ConceptProperties.CHILD)
+      return "child";
+    return "?";
+  }
+
+    public String toSystem(ConceptProperties code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptPropertyType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptPropertyType.java
new file mode 100644
index 00000000000..fae72487490
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptPropertyType.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConceptPropertyType {
+
+        /**
+         * The property value is a code that identifies a concept defined in the code system
+         */
+        CODE, 
+        /**
+         * The property  value is a code defined in an external code system. This may be used for translations, but is not the intent
+         */
+        CODING, 
+        /**
+         * The property value is a string
+         */
+        STRING, 
+        /**
+         * The property value is a string (often used to assign ranking values to concepts for supporting score assessments)
+         */
+        INTEGER, 
+        /**
+         * The property value is a boolean true | false
+         */
+        BOOLEAN, 
+        /**
+         * The property is a date or a date + time
+         */
+        DATETIME, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConceptPropertyType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("code".equals(codeString))
+          return CODE;
+        if ("Coding".equals(codeString))
+          return CODING;
+        if ("string".equals(codeString))
+          return STRING;
+        if ("integer".equals(codeString))
+          return INTEGER;
+        if ("boolean".equals(codeString))
+          return BOOLEAN;
+        if ("dateTime".equals(codeString))
+          return DATETIME;
+        throw new FHIRException("Unknown ConceptPropertyType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CODE: return "code";
+            case CODING: return "Coding";
+            case STRING: return "string";
+            case INTEGER: return "integer";
+            case BOOLEAN: return "boolean";
+            case DATETIME: return "dateTime";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/concept-property-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CODE: return "The property value is a code that identifies a concept defined in the code system";
+            case CODING: return "The property  value is a code defined in an external code system. This may be used for translations, but is not the intent";
+            case STRING: return "The property value is a string";
+            case INTEGER: return "The property value is a string (often used to assign ranking values to concepts for supporting score assessments)";
+            case BOOLEAN: return "The property value is a boolean true | false";
+            case DATETIME: return "The property is a date or a date + time";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CODE: return "code (internal reference)";
+            case CODING: return "Coding (external reference)";
+            case STRING: return "string";
+            case INTEGER: return "integer";
+            case BOOLEAN: return "boolean";
+            case DATETIME: return "dateTime";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptPropertyTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptPropertyTypeEnumFactory.java
new file mode 100644
index 00000000000..c61bf126af9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptPropertyTypeEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConceptPropertyTypeEnumFactory implements EnumFactory {
+
+  public ConceptPropertyType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("code".equals(codeString))
+      return ConceptPropertyType.CODE;
+    if ("Coding".equals(codeString))
+      return ConceptPropertyType.CODING;
+    if ("string".equals(codeString))
+      return ConceptPropertyType.STRING;
+    if ("integer".equals(codeString))
+      return ConceptPropertyType.INTEGER;
+    if ("boolean".equals(codeString))
+      return ConceptPropertyType.BOOLEAN;
+    if ("dateTime".equals(codeString))
+      return ConceptPropertyType.DATETIME;
+    throw new IllegalArgumentException("Unknown ConceptPropertyType code '"+codeString+"'");
+  }
+
+  public String toCode(ConceptPropertyType code) {
+    if (code == ConceptPropertyType.CODE)
+      return "code";
+    if (code == ConceptPropertyType.CODING)
+      return "Coding";
+    if (code == ConceptPropertyType.STRING)
+      return "string";
+    if (code == ConceptPropertyType.INTEGER)
+      return "integer";
+    if (code == ConceptPropertyType.BOOLEAN)
+      return "boolean";
+    if (code == ConceptPropertyType.DATETIME)
+      return "dateTime";
+    return "?";
+  }
+
+    public String toSystem(ConceptPropertyType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptmapUnmappedMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptmapUnmappedMode.java
new file mode 100644
index 00000000000..04952b63380
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptmapUnmappedMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConceptmapUnmappedMode {
+
+        /**
+         * Use the code as provided in the $translate request
+         */
+        PROVIDED, 
+        /**
+         * Use the code explicitly provided in the group.unmapped
+         */
+        FIXED, 
+        /**
+         * Use the map identified by the canonical URL in URL
+         */
+        OTHERMAP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConceptmapUnmappedMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("provided".equals(codeString))
+          return PROVIDED;
+        if ("fixed".equals(codeString))
+          return FIXED;
+        if ("other-map".equals(codeString))
+          return OTHERMAP;
+        throw new FHIRException("Unknown ConceptmapUnmappedMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROVIDED: return "provided";
+            case FIXED: return "fixed";
+            case OTHERMAP: return "other-map";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/conceptmap-unmapped-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROVIDED: return "Use the code as provided in the $translate request";
+            case FIXED: return "Use the code explicitly provided in the group.unmapped";
+            case OTHERMAP: return "Use the map identified by the canonical URL in URL";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROVIDED: return "Provided Code";
+            case FIXED: return "Fixed Code";
+            case OTHERMAP: return "Other Map";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptmapUnmappedModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptmapUnmappedModeEnumFactory.java
new file mode 100644
index 00000000000..38008090578
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConceptmapUnmappedModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConceptmapUnmappedModeEnumFactory implements EnumFactory {
+
+  public ConceptmapUnmappedMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("provided".equals(codeString))
+      return ConceptmapUnmappedMode.PROVIDED;
+    if ("fixed".equals(codeString))
+      return ConceptmapUnmappedMode.FIXED;
+    if ("other-map".equals(codeString))
+      return ConceptmapUnmappedMode.OTHERMAP;
+    throw new IllegalArgumentException("Unknown ConceptmapUnmappedMode code '"+codeString+"'");
+  }
+
+  public String toCode(ConceptmapUnmappedMode code) {
+    if (code == ConceptmapUnmappedMode.PROVIDED)
+      return "provided";
+    if (code == ConceptmapUnmappedMode.FIXED)
+      return "fixed";
+    if (code == ConceptmapUnmappedMode.OTHERMAP)
+      return "other-map";
+    return "?";
+  }
+
+    public String toSystem(ConceptmapUnmappedMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionCategory.java
new file mode 100644
index 00000000000..e48af546bdb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionCategory.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConditionCategory {
+
+        /**
+         * An item on a problem list which can be managed over time and can be expressed by a practitioner (e.g. physician, nurse), patient, or related person.
+         */
+        PROBLEMLISTITEM, 
+        /**
+         * A point in time diagnosis (e.g. from a physician or nurse) in context of an encounter.
+         */
+        ENCOUNTERDIAGNOSIS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConditionCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("problem-list-item".equals(codeString))
+          return PROBLEMLISTITEM;
+        if ("encounter-diagnosis".equals(codeString))
+          return ENCOUNTERDIAGNOSIS;
+        throw new FHIRException("Unknown ConditionCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROBLEMLISTITEM: return "problem-list-item";
+            case ENCOUNTERDIAGNOSIS: return "encounter-diagnosis";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/condition-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROBLEMLISTITEM: return "An item on a problem list which can be managed over time and can be expressed by a practitioner (e.g. physician, nurse), patient, or related person.";
+            case ENCOUNTERDIAGNOSIS: return "A point in time diagnosis (e.g. from a physician or nurse) in context of an encounter.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROBLEMLISTITEM: return "Problem List Item";
+            case ENCOUNTERDIAGNOSIS: return "Encounter Diagnosis";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionCategoryEnumFactory.java
new file mode 100644
index 00000000000..c084200bde3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionCategoryEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConditionCategoryEnumFactory implements EnumFactory {
+
+  public ConditionCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("problem-list-item".equals(codeString))
+      return ConditionCategory.PROBLEMLISTITEM;
+    if ("encounter-diagnosis".equals(codeString))
+      return ConditionCategory.ENCOUNTERDIAGNOSIS;
+    throw new IllegalArgumentException("Unknown ConditionCategory code '"+codeString+"'");
+  }
+
+  public String toCode(ConditionCategory code) {
+    if (code == ConditionCategory.PROBLEMLISTITEM)
+      return "problem-list-item";
+    if (code == ConditionCategory.ENCOUNTERDIAGNOSIS)
+      return "encounter-diagnosis";
+    return "?";
+  }
+
+    public String toSystem(ConditionCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionClinical.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionClinical.java
new file mode 100644
index 00000000000..09cea0e99f8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionClinical.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConditionClinical {
+
+        /**
+         * The subject is currently experiencing the symptoms of the condition or there is evidence of the condition.
+         */
+        ACTIVE, 
+        /**
+         * The subject is having a relapse or re-experiencing the condition after a period of remission or presumed resolution.
+         */
+        RECURRENCE, 
+        /**
+         * The subject is no longer experiencing the symptoms of the condition or there is no longer evidence of the condition.
+         */
+        INACTIVE, 
+        /**
+         * The subject is no longer experiencing the symptoms of the condition, but there is a risk of the symptoms returning.
+         */
+        REMISSION, 
+        /**
+         * The subject is no longer experiencing the symptoms of the condition and there is a negligible perceived risk of the symptoms returning.
+         */
+        RESOLVED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConditionClinical fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("recurrence".equals(codeString))
+          return RECURRENCE;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("remission".equals(codeString))
+          return REMISSION;
+        if ("resolved".equals(codeString))
+          return RESOLVED;
+        throw new FHIRException("Unknown ConditionClinical code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case RECURRENCE: return "recurrence";
+            case INACTIVE: return "inactive";
+            case REMISSION: return "remission";
+            case RESOLVED: return "resolved";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/condition-clinical";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The subject is currently experiencing the symptoms of the condition or there is evidence of the condition.";
+            case RECURRENCE: return "The subject is having a relapse or re-experiencing the condition after a period of remission or presumed resolution.";
+            case INACTIVE: return "The subject is no longer experiencing the symptoms of the condition or there is no longer evidence of the condition.";
+            case REMISSION: return "The subject is no longer experiencing the symptoms of the condition, but there is a risk of the symptoms returning.";
+            case RESOLVED: return "The subject is no longer experiencing the symptoms of the condition and there is a negligible perceived risk of the symptoms returning.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case RECURRENCE: return "Recurrence";
+            case INACTIVE: return "Inactive";
+            case REMISSION: return "Remission";
+            case RESOLVED: return "Resolved";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionClinicalEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionClinicalEnumFactory.java
new file mode 100644
index 00000000000..4e580abc3ca
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionClinicalEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConditionClinicalEnumFactory implements EnumFactory {
+
+  public ConditionClinical fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return ConditionClinical.ACTIVE;
+    if ("recurrence".equals(codeString))
+      return ConditionClinical.RECURRENCE;
+    if ("inactive".equals(codeString))
+      return ConditionClinical.INACTIVE;
+    if ("remission".equals(codeString))
+      return ConditionClinical.REMISSION;
+    if ("resolved".equals(codeString))
+      return ConditionClinical.RESOLVED;
+    throw new IllegalArgumentException("Unknown ConditionClinical code '"+codeString+"'");
+  }
+
+  public String toCode(ConditionClinical code) {
+    if (code == ConditionClinical.ACTIVE)
+      return "active";
+    if (code == ConditionClinical.RECURRENCE)
+      return "recurrence";
+    if (code == ConditionClinical.INACTIVE)
+      return "inactive";
+    if (code == ConditionClinical.REMISSION)
+      return "remission";
+    if (code == ConditionClinical.RESOLVED)
+      return "resolved";
+    return "?";
+  }
+
+    public String toSystem(ConditionClinical code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionState.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionState.java
new file mode 100644
index 00000000000..1ba5a7f9af7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionState.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConditionState {
+
+        /**
+         * The condition is active.
+         */
+        ACTIVE, 
+        /**
+         * The condition is inactive, but not resolved.
+         */
+        INACTIVE, 
+        /**
+         * The condition is resolved.
+         */
+        RESOLVED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConditionState fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("resolved".equals(codeString))
+          return RESOLVED;
+        throw new FHIRException("Unknown ConditionState code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case INACTIVE: return "inactive";
+            case RESOLVED: return "resolved";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/condition-state";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The condition is active.";
+            case INACTIVE: return "The condition is inactive, but not resolved.";
+            case RESOLVED: return "The condition is resolved.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case INACTIVE: return "Inactive";
+            case RESOLVED: return "Resolved";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionStateEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionStateEnumFactory.java
new file mode 100644
index 00000000000..ea79a34a3b2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionStateEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConditionStateEnumFactory implements EnumFactory {
+
+  public ConditionState fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return ConditionState.ACTIVE;
+    if ("inactive".equals(codeString))
+      return ConditionState.INACTIVE;
+    if ("resolved".equals(codeString))
+      return ConditionState.RESOLVED;
+    throw new IllegalArgumentException("Unknown ConditionState code '"+codeString+"'");
+  }
+
+  public String toCode(ConditionState code) {
+    if (code == ConditionState.ACTIVE)
+      return "active";
+    if (code == ConditionState.INACTIVE)
+      return "inactive";
+    if (code == ConditionState.RESOLVED)
+      return "resolved";
+    return "?";
+  }
+
+    public String toSystem(ConditionState code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionVerStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionVerStatus.java
new file mode 100644
index 00000000000..a4df1dfa697
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionVerStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConditionVerStatus {
+
+        /**
+         * This is a tentative diagnosis - still a candidate that is under consideration.
+         */
+        PROVISIONAL, 
+        /**
+         * One of a set of potential (and typically mutually exclusive) diagnoses asserted to further guide the diagnostic process and preliminary treatment.
+         */
+        DIFFERENTIAL, 
+        /**
+         * There is sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition.
+         */
+        CONFIRMED, 
+        /**
+         * This condition has been ruled out by diagnostic and clinical evidence.
+         */
+        REFUTED, 
+        /**
+         * The statement was entered in error and is not valid.
+         */
+        ENTEREDINERROR, 
+        /**
+         * The condition status is unknown.  Note that "unknown" is a value of last resort and every attempt should be made to provide a meaningful value other than "unknown".
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConditionVerStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("provisional".equals(codeString))
+          return PROVISIONAL;
+        if ("differential".equals(codeString))
+          return DIFFERENTIAL;
+        if ("confirmed".equals(codeString))
+          return CONFIRMED;
+        if ("refuted".equals(codeString))
+          return REFUTED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown ConditionVerStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROVISIONAL: return "provisional";
+            case DIFFERENTIAL: return "differential";
+            case CONFIRMED: return "confirmed";
+            case REFUTED: return "refuted";
+            case ENTEREDINERROR: return "entered-in-error";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/condition-ver-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROVISIONAL: return "This is a tentative diagnosis - still a candidate that is under consideration.";
+            case DIFFERENTIAL: return "One of a set of potential (and typically mutually exclusive) diagnoses asserted to further guide the diagnostic process and preliminary treatment.";
+            case CONFIRMED: return "There is sufficient diagnostic and/or clinical evidence to treat this as a confirmed condition.";
+            case REFUTED: return "This condition has been ruled out by diagnostic and clinical evidence.";
+            case ENTEREDINERROR: return "The statement was entered in error and is not valid.";
+            case UNKNOWN: return "The condition status is unknown.  Note that \"unknown\" is a value of last resort and every attempt should be made to provide a meaningful value other than \"unknown\".";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROVISIONAL: return "Provisional";
+            case DIFFERENTIAL: return "Differential";
+            case CONFIRMED: return "Confirmed";
+            case REFUTED: return "Refuted";
+            case ENTEREDINERROR: return "Entered In Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionVerStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionVerStatusEnumFactory.java
new file mode 100644
index 00000000000..a1aff65c2e5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionVerStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConditionVerStatusEnumFactory implements EnumFactory {
+
+  public ConditionVerStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("provisional".equals(codeString))
+      return ConditionVerStatus.PROVISIONAL;
+    if ("differential".equals(codeString))
+      return ConditionVerStatus.DIFFERENTIAL;
+    if ("confirmed".equals(codeString))
+      return ConditionVerStatus.CONFIRMED;
+    if ("refuted".equals(codeString))
+      return ConditionVerStatus.REFUTED;
+    if ("entered-in-error".equals(codeString))
+      return ConditionVerStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return ConditionVerStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown ConditionVerStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ConditionVerStatus code) {
+    if (code == ConditionVerStatus.PROVISIONAL)
+      return "provisional";
+    if (code == ConditionVerStatus.DIFFERENTIAL)
+      return "differential";
+    if (code == ConditionVerStatus.CONFIRMED)
+      return "confirmed";
+    if (code == ConditionVerStatus.REFUTED)
+      return "refuted";
+    if (code == ConditionVerStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == ConditionVerStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(ConditionVerStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalDeleteStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalDeleteStatus.java
new file mode 100644
index 00000000000..acb6b95420a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalDeleteStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConditionalDeleteStatus {
+
+        /**
+         * No support for conditional deletes.
+         */
+        NOTSUPPORTED, 
+        /**
+         * Conditional deletes are supported, but only single resources at a time.
+         */
+        SINGLE, 
+        /**
+         * Conditional deletes are supported, and multiple resources can be deleted in a single interaction.
+         */
+        MULTIPLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConditionalDeleteStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("not-supported".equals(codeString))
+          return NOTSUPPORTED;
+        if ("single".equals(codeString))
+          return SINGLE;
+        if ("multiple".equals(codeString))
+          return MULTIPLE;
+        throw new FHIRException("Unknown ConditionalDeleteStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NOTSUPPORTED: return "not-supported";
+            case SINGLE: return "single";
+            case MULTIPLE: return "multiple";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/conditional-delete-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NOTSUPPORTED: return "No support for conditional deletes.";
+            case SINGLE: return "Conditional deletes are supported, but only single resources at a time.";
+            case MULTIPLE: return "Conditional deletes are supported, and multiple resources can be deleted in a single interaction.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NOTSUPPORTED: return "Not Supported";
+            case SINGLE: return "Single Deletes Supported";
+            case MULTIPLE: return "Multiple Deletes Supported";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalDeleteStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalDeleteStatusEnumFactory.java
new file mode 100644
index 00000000000..7adc938022a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalDeleteStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConditionalDeleteStatusEnumFactory implements EnumFactory {
+
+  public ConditionalDeleteStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("not-supported".equals(codeString))
+      return ConditionalDeleteStatus.NOTSUPPORTED;
+    if ("single".equals(codeString))
+      return ConditionalDeleteStatus.SINGLE;
+    if ("multiple".equals(codeString))
+      return ConditionalDeleteStatus.MULTIPLE;
+    throw new IllegalArgumentException("Unknown ConditionalDeleteStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ConditionalDeleteStatus code) {
+    if (code == ConditionalDeleteStatus.NOTSUPPORTED)
+      return "not-supported";
+    if (code == ConditionalDeleteStatus.SINGLE)
+      return "single";
+    if (code == ConditionalDeleteStatus.MULTIPLE)
+      return "multiple";
+    return "?";
+  }
+
+    public String toSystem(ConditionalDeleteStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalReadStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalReadStatus.java
new file mode 100644
index 00000000000..000723eac60
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalReadStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConditionalReadStatus {
+
+        /**
+         * No support for conditional deletes.
+         */
+        NOTSUPPORTED, 
+        /**
+         * Conditional reads are supported, but only with the If-Modified-Since HTTP Header.
+         */
+        MODIFIEDSINCE, 
+        /**
+         * Conditional reads are supported, but only with the If-None-Match HTTP Header.
+         */
+        NOTMATCH, 
+        /**
+         * Conditional reads are supported, with both If-Modified-Since and If-None-Match HTTP Headers.
+         */
+        FULLSUPPORT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConditionalReadStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("not-supported".equals(codeString))
+          return NOTSUPPORTED;
+        if ("modified-since".equals(codeString))
+          return MODIFIEDSINCE;
+        if ("not-match".equals(codeString))
+          return NOTMATCH;
+        if ("full-support".equals(codeString))
+          return FULLSUPPORT;
+        throw new FHIRException("Unknown ConditionalReadStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NOTSUPPORTED: return "not-supported";
+            case MODIFIEDSINCE: return "modified-since";
+            case NOTMATCH: return "not-match";
+            case FULLSUPPORT: return "full-support";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/conditional-read-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NOTSUPPORTED: return "No support for conditional deletes.";
+            case MODIFIEDSINCE: return "Conditional reads are supported, but only with the If-Modified-Since HTTP Header.";
+            case NOTMATCH: return "Conditional reads are supported, but only with the If-None-Match HTTP Header.";
+            case FULLSUPPORT: return "Conditional reads are supported, with both If-Modified-Since and If-None-Match HTTP Headers.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NOTSUPPORTED: return "Not Supported";
+            case MODIFIEDSINCE: return "If-Modified-Since";
+            case NOTMATCH: return "If-None-Match";
+            case FULLSUPPORT: return "Full Support";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalReadStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalReadStatusEnumFactory.java
new file mode 100644
index 00000000000..ae7a5db3528
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConditionalReadStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConditionalReadStatusEnumFactory implements EnumFactory {
+
+  public ConditionalReadStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("not-supported".equals(codeString))
+      return ConditionalReadStatus.NOTSUPPORTED;
+    if ("modified-since".equals(codeString))
+      return ConditionalReadStatus.MODIFIEDSINCE;
+    if ("not-match".equals(codeString))
+      return ConditionalReadStatus.NOTMATCH;
+    if ("full-support".equals(codeString))
+      return ConditionalReadStatus.FULLSUPPORT;
+    throw new IllegalArgumentException("Unknown ConditionalReadStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ConditionalReadStatus code) {
+    if (code == ConditionalReadStatus.NOTSUPPORTED)
+      return "not-supported";
+    if (code == ConditionalReadStatus.MODIFIEDSINCE)
+      return "modified-since";
+    if (code == ConditionalReadStatus.NOTMATCH)
+      return "not-match";
+    if (code == ConditionalReadStatus.FULLSUPPORT)
+      return "full-support";
+    return "?";
+  }
+
+    public String toSystem(ConditionalReadStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConformanceExpectation.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConformanceExpectation.java
new file mode 100644
index 00000000000..193d363f89f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConformanceExpectation.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConformanceExpectation {
+
+        /**
+         * Support for the specified capability is required to be considered conformant.
+         */
+        SHALL, 
+        /**
+         * Support for the specified capability is strongly encouraged, and failure to support it should only occur after careful consideration.
+         */
+        SHOULD, 
+        /**
+         * Support for the specified capability is not necessary to be considered conformant, and the requirement should be considered strictly optional.
+         */
+        MAY, 
+        /**
+         * Support for the specified capability is strongly discouraged and should occur only after careful consideration.
+         */
+        SHOULDNOT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConformanceExpectation fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("SHALL".equals(codeString))
+          return SHALL;
+        if ("SHOULD".equals(codeString))
+          return SHOULD;
+        if ("MAY".equals(codeString))
+          return MAY;
+        if ("SHOULD-NOT".equals(codeString))
+          return SHOULDNOT;
+        throw new FHIRException("Unknown ConformanceExpectation code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SHALL: return "SHALL";
+            case SHOULD: return "SHOULD";
+            case MAY: return "MAY";
+            case SHOULDNOT: return "SHOULD-NOT";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/conformance-expectation";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SHALL: return "Support for the specified capability is required to be considered conformant.";
+            case SHOULD: return "Support for the specified capability is strongly encouraged, and failure to support it should only occur after careful consideration.";
+            case MAY: return "Support for the specified capability is not necessary to be considered conformant, and the requirement should be considered strictly optional.";
+            case SHOULDNOT: return "Support for the specified capability is strongly discouraged and should occur only after careful consideration.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SHALL: return "SHALL";
+            case SHOULD: return "SHOULD";
+            case MAY: return "MAY";
+            case SHOULDNOT: return "SHOULD-NOT";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConformanceExpectationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConformanceExpectationEnumFactory.java
new file mode 100644
index 00000000000..042f79fa09d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConformanceExpectationEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConformanceExpectationEnumFactory implements EnumFactory {
+
+  public ConformanceExpectation fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("SHALL".equals(codeString))
+      return ConformanceExpectation.SHALL;
+    if ("SHOULD".equals(codeString))
+      return ConformanceExpectation.SHOULD;
+    if ("MAY".equals(codeString))
+      return ConformanceExpectation.MAY;
+    if ("SHOULD-NOT".equals(codeString))
+      return ConformanceExpectation.SHOULDNOT;
+    throw new IllegalArgumentException("Unknown ConformanceExpectation code '"+codeString+"'");
+  }
+
+  public String toCode(ConformanceExpectation code) {
+    if (code == ConformanceExpectation.SHALL)
+      return "SHALL";
+    if (code == ConformanceExpectation.SHOULD)
+      return "SHOULD";
+    if (code == ConformanceExpectation.MAY)
+      return "MAY";
+    if (code == ConformanceExpectation.SHOULDNOT)
+      return "SHOULD-NOT";
+    return "?";
+  }
+
+    public String toSystem(ConformanceExpectation code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentAction.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentAction.java
new file mode 100644
index 00000000000..35188cc7b70
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentAction.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConsentAction {
+
+        /**
+         * Gather/acquire information by an entity to achieve a stated purpose
+         */
+        COLLECT, 
+        /**
+         * Provide an entity access to information to achieve a stated purpose
+         */
+        ACCESS, 
+        /**
+         * Use of stored information by an entity fo the stated purpose
+         */
+        USE, 
+        /**
+         * Release / transfer of information to an entity 
+         */
+        DISCLOSE, 
+        /**
+         * Allowing an entity to correct a patient's information
+         */
+        CORRECT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConsentAction fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("collect".equals(codeString))
+          return COLLECT;
+        if ("access".equals(codeString))
+          return ACCESS;
+        if ("use".equals(codeString))
+          return USE;
+        if ("disclose".equals(codeString))
+          return DISCLOSE;
+        if ("correct".equals(codeString))
+          return CORRECT;
+        throw new FHIRException("Unknown ConsentAction code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COLLECT: return "collect";
+            case ACCESS: return "access";
+            case USE: return "use";
+            case DISCLOSE: return "disclose";
+            case CORRECT: return "correct";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/consentaction";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COLLECT: return "Gather/acquire information by an entity to achieve a stated purpose";
+            case ACCESS: return "Provide an entity access to information to achieve a stated purpose";
+            case USE: return "Use of stored information by an entity fo the stated purpose";
+            case DISCLOSE: return "Release / transfer of information to an entity ";
+            case CORRECT: return "Allowing an entity to correct a patient's information";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COLLECT: return "Collect";
+            case ACCESS: return "Access";
+            case USE: return "Use";
+            case DISCLOSE: return "Disclose";
+            case CORRECT: return "Access and Correct";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentActionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentActionEnumFactory.java
new file mode 100644
index 00000000000..ea56a004031
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentActionEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConsentActionEnumFactory implements EnumFactory {
+
+  public ConsentAction fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("collect".equals(codeString))
+      return ConsentAction.COLLECT;
+    if ("access".equals(codeString))
+      return ConsentAction.ACCESS;
+    if ("use".equals(codeString))
+      return ConsentAction.USE;
+    if ("disclose".equals(codeString))
+      return ConsentAction.DISCLOSE;
+    if ("correct".equals(codeString))
+      return ConsentAction.CORRECT;
+    throw new IllegalArgumentException("Unknown ConsentAction code '"+codeString+"'");
+  }
+
+  public String toCode(ConsentAction code) {
+    if (code == ConsentAction.COLLECT)
+      return "collect";
+    if (code == ConsentAction.ACCESS)
+      return "access";
+    if (code == ConsentAction.USE)
+      return "use";
+    if (code == ConsentAction.DISCLOSE)
+      return "disclose";
+    if (code == ConsentAction.CORRECT)
+      return "correct";
+    return "?";
+  }
+
+    public String toSystem(ConsentAction code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentCategory.java
new file mode 100644
index 00000000000..9f8de0d4258
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentCategory.java
@@ -0,0 +1,312 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConsentCategory {
+
+        /**
+         * Required elements in a written consent to a disclosure of information governed under 42 CFR Part 2. http://www.ecfr.gov/cgi-bin/text-idx?SID=69c4339acd2df9fab9dcbed15181917b&mc=true&node=pt42.1.2&rgn=div5
+         */
+        _42CFR2, 
+        /**
+         * Any instructions, written or given verbally by a patient to a health care provider in anticipation of potential need for medical treatment. [2005 Honor My Wishes]
+         */
+        ACD, 
+        /**
+         * 45 CFR part 46 §46.116 General requirements for informed consent; and §46.117 Documentation of informed consent. https://www.gpo.gov/fdsys/pkg/FR-2017-01-19/pdf/2017-01058.pdf
+         */
+        CRIC, 
+        /**
+         * A legal document, signed by both the patient and their provider, stating a desire not to have CPR initiated in case of a cardiac event. Note: This form was replaced in 2003 with the Physician Orders for Life-Sustaining Treatment [POLST].
+         */
+        DNR, 
+        /**
+         * Opt-in to disclosure of health information for emergency only consent directive. Comment: This general consent directive specifically limits disclosure of health information for purpose of emergency treatment. Additional parameters may further limit the disclosure to specific users, roles, duration, types of information, and impose uses obligations. [ActConsentDirective (2.16.840.1.113883.1.11.20425)]
+         */
+        EMRGONLY, 
+        /**
+         * The consent to the performance of a medical or surgical procedure by a physician licensed to practice medicine and surgery, a licensed advanced practice nurse, or a licensed physician assistant executed by a married person who is a minor, by a parent who is a minor, by a pregnant woman who is a minor, or by any person 18 years of age or older, is not voidable because of such minority, and, for such purpose, a married person who is a minor, a parent who is a minor, a pregnant woman who is a minor, or any person 18 years of age or older, is deemed to have the same legal capacity to act and has the same powers and obligations as has a person of legal age. Consent by Minors to Medical Procedures Act. (410 ILCS 210/0.01) (from Ch. 111, par. 4500) Sec. 0.01. Short title. This Act may be cited as the Consent by Minors to Medical Procedures Act. (Source: P.A. 86-1324.) http://www.ilga.gov/legislation/ilcs/ilcs3.asp?ActID=1539&ChapterID=35
+         */
+        ILLINOISMINORPROCEDURE, 
+        /**
+         * Patient’s document telling patient’s health care provider what the patient wants or does not want if the patient is diagnosed as being terminally ill and in a persistent vegetative state or in a permanently unconscious condition.[2005 Honor My Wishes]
+         */
+        HCD, 
+        /**
+         * HIPAA 45 CFR Section 164.508 Uses and disclosures for which an authorization is required. (a) Standard: Authorizations for uses and disclosures. (1) Authorization required: General rule. Except as otherwise permitted or required by this subchapter, a covered entity may not use or disclose protected health information without an authorization that is valid under this section. When a covered entity obtains or receives a valid authorization for its use or disclosure of protected health information, such use or disclosure must be consistent with such authorization. Usage Note: Authorizations governed under this regulation meet the definition of an opt in class of consent directive.
+         */
+        HIPAAAUTH, 
+        /**
+         * § 164.520 — Notice of privacy practices for protected health information. (1) Right to notice. Except as provided by paragraph (a)(2) or (3) of this section, an individual has a right to adequate notice of the uses and disclosures of protected health information that may be made by the covered entity, and of the individual's rights and the covered entity's legal duties with respect to protected health information. Usage Note: Restrictions governed under this regulation meet the definition of an implied with an opportunity to dissent class of consent directive.
+         */
+        HIPAANPP, 
+        /**
+         * HIPAA 45 CFR § 164.510 - Uses and disclosures requiring an opportunity for the individual to agree or to object. A covered entity may use or disclose protected health information, provided that the individual is informed in advance of the use or disclosure and has the opportunity to agree to or prohibit or restrict the use or disclosure, in accordance with the applicable requirements of this section. The covered entity may orally inform the individual of and obtain the individual's oral agreement or objection to a use or disclosure permitted by this section. Usage Note: Restrictions governed under this regulation meet the definition of an opt out with exception class of consent directive.
+         */
+        HIPAARESTRICTIONS, 
+        /**
+         * HIPAA 45 CFR § 164.508 - Uses and disclosures for which an authorization is required. (a) Standard: Authorizations for uses and disclosures. (3) Compound authorizations. An authorization for use or disclosure of protected health information may not be combined with any other document to create a compound authorization, except as follows: (i) An authorization for the use or disclosure of protected health information for a research study may be combined with any other type of written permission for the same or another research study. This exception includes combining an authorization for the use or disclosure of protected health information for a research study with another authorization for the same research study, with an authorization for the creation or maintenance of a research database or repository, or with a consent to participate in research. Where a covered health care provider has conditioned the provision of research-related treatment on the provision of one of the authorizations, as permitted under paragraph (b)(4)(i) of this section, any compound authorization created under this paragraph must clearly differentiate between the conditioned and unconditioned components and provide the individual with an opportunity to opt in to the research activities described in the unconditioned authorization. Usage Notes: See HHS http://www.hhs.gov/hipaa/for-professionals/special-topics/research/index.html and OCR http://www.hhs.gov/hipaa/for-professionals/special-topics/research/index.html
+         */
+        HIPAARESEARCH, 
+        /**
+         * HIPAA 45 CFR § 164.522(a)—Right To Request a Restriction of Uses and Disclosures. (vi) A covered entity must agree to the request of an individual to restrict disclosure of protected health information about the individual to a health plan if: (A) The disclosure is for the purpose of carrying out payment or health care operations and is not otherwise required by law; and (B) The protected health information pertains solely to a health care item or service for which the individual, or person other than the health plan on behalf of the individual, has paid the covered entity in full. Usage Note: Restrictions governed under this regulation meet the definition of an opt out with exception class of consent directive. Opt out is limited to disclosures to a payer for payment and operations purpose of use. See HL7 HIPAA Self-Pay code in ActPrivacyLaw (2.16.840.1.113883.1.11.20426).
+         */
+        HIPAASELFPAY, 
+        /**
+         * On January 1, 2015, the Michigan Department of Health and Human Services (MDHHS) released a standard consent form for the sharing of health information specific to behavioral health and substance use treatment in accordance with Public Act 129 of 2014. In Michigan, while providers are not required to use this new standard form (MDHHS-5515), they are required to accept it. Note: Form is available at http://www.michigan.gov/documents/mdhhs/Consent_to_Share_Behavioral_Health_Information_for_Care_Coordination_Purposes_548835_7.docx For more information see http://www.michigan.gov/documents/mdhhs/Behavioral_Health_Consent_Form_Background_Information_548864_7.pdf
+         */
+        MDHHS5515, 
+        /**
+         * The New York State Surgical and Invasive Procedure Protocol (NYSSIPP) applies to all operative and invasive procedures including endoscopy, general surgery or interventional radiology. Other procedures that involve puncture or incision of the skin, or insertion of an instrument or foreign material into the body are within the scope of the protocol. This protocol also applies to those anesthesia procedures either prior to a surgical procedure or independent of a surgical procedure such as spinal facet blocks. Example: Certain 'minor' procedures such as venipuncture, peripheral IV placement, insertion of nasogastric tube and foley catheter insertion are not within the scope of the protocol. From http://www.health.ny.gov/professionals/protocols_and_guidelines/surgical_and_invasive_procedure/nyssipp_faq.htm Note: HHC 100B-1 Form is available at http://www.downstate.edu/emergency_medicine/documents/Consent_CT_with_contrast.pdf
+         */
+        NYSSIPP, 
+        /**
+         * Acknowledgement of custodian notice of privacy practices. Usage Notes: This type of consent directive acknowledges a custodian's notice of privacy practices including its permitted collection, access, use and disclosure of health information to users and for purposes of use specified. [ActConsentDirective (2.16.840.1.113883.1.11.20425)]
+         */
+        NPP, 
+        /**
+         * The Physician Order for Life-Sustaining Treatment form records a person’s health care wishes for end of life emergency treatment and translates them into an order by the physician. It must be reviewed and signed by both the patient and the physician, Advanced Registered Nurse Practitioner or Physician Assistant. [2005 Honor My Wishes] Comment: Opt-in Consent Directive with restrictions.
+         */
+        POLST, 
+        /**
+         * Consent to have healthcare information in an electronic health record accessed for research purposes. [VALUE SET: ActConsentType (2.16.840.1.113883.1.11.19897)]
+         */
+        RESEARCH, 
+        /**
+         * Consent to have de-identified healthcare information in an electronic health record that is accessed for research purposes, but without consent to re-identify the information under any circumstance. [VALUE SET: ActConsentType (2.16.840.1.113883.1.11.19897)
+         */
+        RSDID, 
+        /**
+         * Consent to have de-identified healthcare information in an electronic health record that is accessed for research purposes re-identified under specific circumstances outlined in the consent. [VALUE SET: ActConsentType (2.16.840.1.113883.1.11.19897)]
+         */
+        RSREID, 
+        /**
+         * SSA Form SSA-827 (Authorization to Disclose Information to the Social Security Administration (SSA))and its affiliated State disability determination services use Form SSA-827, Authorization to Disclose Information to the Social Security Administration (SSA) to obtain medical and other information needed to determine whether or not a claimant is disabled. Comment: Opt-in Consent Directive. Note: Form is available at https://www.socialsecurity.gov/forms/ssa-827-inst-sp.pdf 
+         */
+        SSA827, 
+        /**
+         * VA Form 10-0484 Revocation for Release of Individually-Identifiable Health Information enables a veteran to revoke authorization for the VA to release specified copies of individually-identifiable health information with the non-VA health care provider organizations participating in the eHealth Exchange and partnering with VA. Comment: Opt-in Consent Directive with status = rescinded (aka 'revoked'). Note: Form is available at http://www.va.gov/vaforms/medical/pdf/vha-10-0484-fill.pdf
+         */
+        VA100484, 
+        /**
+         * VA Form 10-0485 Request for and Authorization to Release Protected Health Information to eHealth Exchange enables a veteran to request and authorize a VA health care facility to release protected health information (PHI) for treatment purposes only to the communities that are participating in the eHealth Exchange, VLER Directive, and other Health Information Exchanges with who VA has an agreement. This information may consist of the diagnosis of Sickle Cell Anemia, the treatment of or referral for Drug Abuse, treatment of or referral for Alcohol Abuse or the treatment of or testing for infection with Human Immunodeficiency Virus. This authorization covers the diagnoses that I may have upon signing of the authorization and the diagnoses that I may acquire in the future including those protected by 38 U.S.C. 7332. Comment: Opt-in Consent Directive. Note: Form is available at http://www.va.gov/vaforms/medical/pdf/10-0485-fill.pdf
+         */
+        VA100485, 
+        /**
+         * VA Form 10-5345 Request for and Authorization to Release Medical Records or Health Information enables a veteran to request and authorize the VA to release specified copies of protected health information (PHI), such as hospital summary or outpatient treatment notes, which may include information about conditions governed under Title 38 Section 7332 (drug abuse, alcoholism or alcohol abuse, testing for or infection with HIV, and sickle cell anemia). Comment: Opt-in Consent Directive. Note: Form is available at http://www.va.gov/vaforms/medical/pdf/vha-10-5345-fill.pdf
+         */
+        VA105345, 
+        /**
+         * VA Form 10-5345a Individuals' Request for a Copy of Their Own Health Information enables a veteran to request and authorize the VA to release specified copies of protected health information (PHI), such as hospital summary or outpatient treatment notes. Note: Form is available at http://www.va.gov/vaforms/medical/pdf/vha-10-5345a-fill.pdf
+         */
+        VA105345A, 
+        /**
+         * VA Form 10-5345a-MHV Individual’s Request for a Copy of their own health information from MyHealtheVet enables a veteran to receive a copy of all available personal health information to be delivered through the veteran’s My HealtheVet account. Note: Form is available at http://www.va.gov/vaforms/medical/pdf/vha-10-5345a-MHV-fill.pdf
+         */
+        VA105345AMHV, 
+        /**
+         * VA Form 10-10116 Revocation of Authorization for Use and Release of Individually Identifiable Health Information for Veterans Health Administration Research. Comment: Opt-in with Restriction Consent Directive with status = 'completed'. Note: Form is available at http://www.northerncalifornia.va.gov/northerncalifornia/services/rnd/docs/vha-10-10116.pdf 
+         */
+        VA1010116, 
+        /**
+         * VA Form 21-4142 (Authorization and Consent to Release Information to the Department of Veterans Affairs (VA) enables a veteran to authorize the US Veterans Administration [VA] to request veteran’s health information from non-VA providers. Aka VA Compensation Application Note: Form is available at http://www.vba.va.gov/pubs/forms/VBA-21-4142-ARE.pdf . For additional information regarding VA Form 21-4142, refer to the following website: www.benefits.va.gov/compensation/consent_privateproviders
+         */
+        VA214142, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConsentCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("42-CFR-2".equals(codeString))
+          return _42CFR2;
+        if ("ACD".equals(codeString))
+          return ACD;
+        if ("CRIC".equals(codeString))
+          return CRIC;
+        if ("DNR".equals(codeString))
+          return DNR;
+        if ("EMRGONLY".equals(codeString))
+          return EMRGONLY;
+        if ("Illinois-Minor-Procedure".equals(codeString))
+          return ILLINOISMINORPROCEDURE;
+        if ("HCD".equals(codeString))
+          return HCD;
+        if ("HIPAA-Auth".equals(codeString))
+          return HIPAAAUTH;
+        if ("HIPAA-NPP".equals(codeString))
+          return HIPAANPP;
+        if ("HIPAA-Restrictions".equals(codeString))
+          return HIPAARESTRICTIONS;
+        if ("HIPAA-Research".equals(codeString))
+          return HIPAARESEARCH;
+        if ("HIPAA-Self-Pay".equals(codeString))
+          return HIPAASELFPAY;
+        if ("MDHHS-5515".equals(codeString))
+          return MDHHS5515;
+        if ("NYSSIPP".equals(codeString))
+          return NYSSIPP;
+        if ("NPP".equals(codeString))
+          return NPP;
+        if ("POLST".equals(codeString))
+          return POLST;
+        if ("RESEARCH".equals(codeString))
+          return RESEARCH;
+        if ("RSDID".equals(codeString))
+          return RSDID;
+        if ("RSREID".equals(codeString))
+          return RSREID;
+        if ("SSA-827".equals(codeString))
+          return SSA827;
+        if ("VA-10-0484".equals(codeString))
+          return VA100484;
+        if ("VA-10-0485".equals(codeString))
+          return VA100485;
+        if ("VA-10-5345".equals(codeString))
+          return VA105345;
+        if ("VA-10-5345a".equals(codeString))
+          return VA105345A;
+        if ("VA-10-5345a-MHV".equals(codeString))
+          return VA105345AMHV;
+        if ("VA-10-10116".equals(codeString))
+          return VA1010116;
+        if ("VA-21-4142".equals(codeString))
+          return VA214142;
+        throw new FHIRException("Unknown ConsentCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _42CFR2: return "42-CFR-2";
+            case ACD: return "ACD";
+            case CRIC: return "CRIC";
+            case DNR: return "DNR";
+            case EMRGONLY: return "EMRGONLY";
+            case ILLINOISMINORPROCEDURE: return "Illinois-Minor-Procedure";
+            case HCD: return "HCD";
+            case HIPAAAUTH: return "HIPAA-Auth";
+            case HIPAANPP: return "HIPAA-NPP";
+            case HIPAARESTRICTIONS: return "HIPAA-Restrictions";
+            case HIPAARESEARCH: return "HIPAA-Research";
+            case HIPAASELFPAY: return "HIPAA-Self-Pay";
+            case MDHHS5515: return "MDHHS-5515";
+            case NYSSIPP: return "NYSSIPP";
+            case NPP: return "NPP";
+            case POLST: return "POLST";
+            case RESEARCH: return "RESEARCH";
+            case RSDID: return "RSDID";
+            case RSREID: return "RSREID";
+            case SSA827: return "SSA-827";
+            case VA100484: return "VA-10-0484";
+            case VA100485: return "VA-10-0485";
+            case VA105345: return "VA-10-5345";
+            case VA105345A: return "VA-10-5345a";
+            case VA105345AMHV: return "VA-10-5345a-MHV";
+            case VA1010116: return "VA-10-10116";
+            case VA214142: return "VA-21-4142";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/consentcategorycodes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _42CFR2: return "Required elements in a written consent to a disclosure of information governed under 42 CFR Part 2. http://www.ecfr.gov/cgi-bin/text-idx?SID=69c4339acd2df9fab9dcbed15181917b&mc=true&node=pt42.1.2&rgn=div5";
+            case ACD: return "Any instructions, written or given verbally by a patient to a health care provider in anticipation of potential need for medical treatment. [2005 Honor My Wishes]";
+            case CRIC: return "45 CFR part 46 §46.116 General requirements for informed consent; and §46.117 Documentation of informed consent. https://www.gpo.gov/fdsys/pkg/FR-2017-01-19/pdf/2017-01058.pdf";
+            case DNR: return "A legal document, signed by both the patient and their provider, stating a desire not to have CPR initiated in case of a cardiac event. Note: This form was replaced in 2003 with the Physician Orders for Life-Sustaining Treatment [POLST].";
+            case EMRGONLY: return "Opt-in to disclosure of health information for emergency only consent directive. Comment: This general consent directive specifically limits disclosure of health information for purpose of emergency treatment. Additional parameters may further limit the disclosure to specific users, roles, duration, types of information, and impose uses obligations. [ActConsentDirective (2.16.840.1.113883.1.11.20425)]";
+            case ILLINOISMINORPROCEDURE: return "The consent to the performance of a medical or surgical procedure by a physician licensed to practice medicine and surgery, a licensed advanced practice nurse, or a licensed physician assistant executed by a married person who is a minor, by a parent who is a minor, by a pregnant woman who is a minor, or by any person 18 years of age or older, is not voidable because of such minority, and, for such purpose, a married person who is a minor, a parent who is a minor, a pregnant woman who is a minor, or any person 18 years of age or older, is deemed to have the same legal capacity to act and has the same powers and obligations as has a person of legal age. Consent by Minors to Medical Procedures Act. (410 ILCS 210/0.01) (from Ch. 111, par. 4500) Sec. 0.01. Short title. This Act may be cited as the Consent by Minors to Medical Procedures Act. (Source: P.A. 86-1324.) http://www.ilga.gov/legislation/ilcs/ilcs3.asp?ActID=1539&ChapterID=35";
+            case HCD: return "Patient’s document telling patient’s health care provider what the patient wants or does not want if the patient is diagnosed as being terminally ill and in a persistent vegetative state or in a permanently unconscious condition.[2005 Honor My Wishes]";
+            case HIPAAAUTH: return "HIPAA 45 CFR Section 164.508 Uses and disclosures for which an authorization is required. (a) Standard: Authorizations for uses and disclosures. (1) Authorization required: General rule. Except as otherwise permitted or required by this subchapter, a covered entity may not use or disclose protected health information without an authorization that is valid under this section. When a covered entity obtains or receives a valid authorization for its use or disclosure of protected health information, such use or disclosure must be consistent with such authorization. Usage Note: Authorizations governed under this regulation meet the definition of an opt in class of consent directive.";
+            case HIPAANPP: return "§ 164.520 — Notice of privacy practices for protected health information. (1) Right to notice. Except as provided by paragraph (a)(2) or (3) of this section, an individual has a right to adequate notice of the uses and disclosures of protected health information that may be made by the covered entity, and of the individual's rights and the covered entity's legal duties with respect to protected health information. Usage Note: Restrictions governed under this regulation meet the definition of an implied with an opportunity to dissent class of consent directive.";
+            case HIPAARESTRICTIONS: return "HIPAA 45 CFR § 164.510 - Uses and disclosures requiring an opportunity for the individual to agree or to object. A covered entity may use or disclose protected health information, provided that the individual is informed in advance of the use or disclosure and has the opportunity to agree to or prohibit or restrict the use or disclosure, in accordance with the applicable requirements of this section. The covered entity may orally inform the individual of and obtain the individual's oral agreement or objection to a use or disclosure permitted by this section. Usage Note: Restrictions governed under this regulation meet the definition of an opt out with exception class of consent directive.";
+            case HIPAARESEARCH: return "HIPAA 45 CFR § 164.508 - Uses and disclosures for which an authorization is required. (a) Standard: Authorizations for uses and disclosures. (3) Compound authorizations. An authorization for use or disclosure of protected health information may not be combined with any other document to create a compound authorization, except as follows: (i) An authorization for the use or disclosure of protected health information for a research study may be combined with any other type of written permission for the same or another research study. This exception includes combining an authorization for the use or disclosure of protected health information for a research study with another authorization for the same research study, with an authorization for the creation or maintenance of a research database or repository, or with a consent to participate in research. Where a covered health care provider has conditioned the provision of research-related treatment on the provision of one of the authorizations, as permitted under paragraph (b)(4)(i) of this section, any compound authorization created under this paragraph must clearly differentiate between the conditioned and unconditioned components and provide the individual with an opportunity to opt in to the research activities described in the unconditioned authorization. Usage Notes: See HHS http://www.hhs.gov/hipaa/for-professionals/special-topics/research/index.html and OCR http://www.hhs.gov/hipaa/for-professionals/special-topics/research/index.html";
+            case HIPAASELFPAY: return "HIPAA 45 CFR § 164.522(a)—Right To Request a Restriction of Uses and Disclosures. (vi) A covered entity must agree to the request of an individual to restrict disclosure of protected health information about the individual to a health plan if: (A) The disclosure is for the purpose of carrying out payment or health care operations and is not otherwise required by law; and (B) The protected health information pertains solely to a health care item or service for which the individual, or person other than the health plan on behalf of the individual, has paid the covered entity in full. Usage Note: Restrictions governed under this regulation meet the definition of an opt out with exception class of consent directive. Opt out is limited to disclosures to a payer for payment and operations purpose of use. See HL7 HIPAA Self-Pay code in ActPrivacyLaw (2.16.840.1.113883.1.11.20426).";
+            case MDHHS5515: return "On January 1, 2015, the Michigan Department of Health and Human Services (MDHHS) released a standard consent form for the sharing of health information specific to behavioral health and substance use treatment in accordance with Public Act 129 of 2014. In Michigan, while providers are not required to use this new standard form (MDHHS-5515), they are required to accept it. Note: Form is available at http://www.michigan.gov/documents/mdhhs/Consent_to_Share_Behavioral_Health_Information_for_Care_Coordination_Purposes_548835_7.docx For more information see http://www.michigan.gov/documents/mdhhs/Behavioral_Health_Consent_Form_Background_Information_548864_7.pdf";
+            case NYSSIPP: return "The New York State Surgical and Invasive Procedure Protocol (NYSSIPP) applies to all operative and invasive procedures including endoscopy, general surgery or interventional radiology. Other procedures that involve puncture or incision of the skin, or insertion of an instrument or foreign material into the body are within the scope of the protocol. This protocol also applies to those anesthesia procedures either prior to a surgical procedure or independent of a surgical procedure such as spinal facet blocks. Example: Certain 'minor' procedures such as venipuncture, peripheral IV placement, insertion of nasogastric tube and foley catheter insertion are not within the scope of the protocol. From http://www.health.ny.gov/professionals/protocols_and_guidelines/surgical_and_invasive_procedure/nyssipp_faq.htm Note: HHC 100B-1 Form is available at http://www.downstate.edu/emergency_medicine/documents/Consent_CT_with_contrast.pdf";
+            case NPP: return "Acknowledgement of custodian notice of privacy practices. Usage Notes: This type of consent directive acknowledges a custodian's notice of privacy practices including its permitted collection, access, use and disclosure of health information to users and for purposes of use specified. [ActConsentDirective (2.16.840.1.113883.1.11.20425)]";
+            case POLST: return "The Physician Order for Life-Sustaining Treatment form records a person’s health care wishes for end of life emergency treatment and translates them into an order by the physician. It must be reviewed and signed by both the patient and the physician, Advanced Registered Nurse Practitioner or Physician Assistant. [2005 Honor My Wishes] Comment: Opt-in Consent Directive with restrictions.";
+            case RESEARCH: return "Consent to have healthcare information in an electronic health record accessed for research purposes. [VALUE SET: ActConsentType (2.16.840.1.113883.1.11.19897)]";
+            case RSDID: return "Consent to have de-identified healthcare information in an electronic health record that is accessed for research purposes, but without consent to re-identify the information under any circumstance. [VALUE SET: ActConsentType (2.16.840.1.113883.1.11.19897)";
+            case RSREID: return "Consent to have de-identified healthcare information in an electronic health record that is accessed for research purposes re-identified under specific circumstances outlined in the consent. [VALUE SET: ActConsentType (2.16.840.1.113883.1.11.19897)]";
+            case SSA827: return "SSA Form SSA-827 (Authorization to Disclose Information to the Social Security Administration (SSA))and its affiliated State disability determination services use Form SSA-827, Authorization to Disclose Information to the Social Security Administration (SSA) to obtain medical and other information needed to determine whether or not a claimant is disabled. Comment: Opt-in Consent Directive. Note: Form is available at https://www.socialsecurity.gov/forms/ssa-827-inst-sp.pdf ";
+            case VA100484: return "VA Form 10-0484 Revocation for Release of Individually-Identifiable Health Information enables a veteran to revoke authorization for the VA to release specified copies of individually-identifiable health information with the non-VA health care provider organizations participating in the eHealth Exchange and partnering with VA. Comment: Opt-in Consent Directive with status = rescinded (aka 'revoked'). Note: Form is available at http://www.va.gov/vaforms/medical/pdf/vha-10-0484-fill.pdf";
+            case VA100485: return "VA Form 10-0485 Request for and Authorization to Release Protected Health Information to eHealth Exchange enables a veteran to request and authorize a VA health care facility to release protected health information (PHI) for treatment purposes only to the communities that are participating in the eHealth Exchange, VLER Directive, and other Health Information Exchanges with who VA has an agreement. This information may consist of the diagnosis of Sickle Cell Anemia, the treatment of or referral for Drug Abuse, treatment of or referral for Alcohol Abuse or the treatment of or testing for infection with Human Immunodeficiency Virus. This authorization covers the diagnoses that I may have upon signing of the authorization and the diagnoses that I may acquire in the future including those protected by 38 U.S.C. 7332. Comment: Opt-in Consent Directive. Note: Form is available at http://www.va.gov/vaforms/medical/pdf/10-0485-fill.pdf";
+            case VA105345: return "VA Form 10-5345 Request for and Authorization to Release Medical Records or Health Information enables a veteran to request and authorize the VA to release specified copies of protected health information (PHI), such as hospital summary or outpatient treatment notes, which may include information about conditions governed under Title 38 Section 7332 (drug abuse, alcoholism or alcohol abuse, testing for or infection with HIV, and sickle cell anemia). Comment: Opt-in Consent Directive. Note: Form is available at http://www.va.gov/vaforms/medical/pdf/vha-10-5345-fill.pdf";
+            case VA105345A: return "VA Form 10-5345a Individuals' Request for a Copy of Their Own Health Information enables a veteran to request and authorize the VA to release specified copies of protected health information (PHI), such as hospital summary or outpatient treatment notes. Note: Form is available at http://www.va.gov/vaforms/medical/pdf/vha-10-5345a-fill.pdf";
+            case VA105345AMHV: return "VA Form 10-5345a-MHV Individual’s Request for a Copy of their own health information from MyHealtheVet enables a veteran to receive a copy of all available personal health information to be delivered through the veteran’s My HealtheVet account. Note: Form is available at http://www.va.gov/vaforms/medical/pdf/vha-10-5345a-MHV-fill.pdf";
+            case VA1010116: return "VA Form 10-10116 Revocation of Authorization for Use and Release of Individually Identifiable Health Information for Veterans Health Administration Research. Comment: Opt-in with Restriction Consent Directive with status = 'completed'. Note: Form is available at http://www.northerncalifornia.va.gov/northerncalifornia/services/rnd/docs/vha-10-10116.pdf ";
+            case VA214142: return "VA Form 21-4142 (Authorization and Consent to Release Information to the Department of Veterans Affairs (VA) enables a veteran to authorize the US Veterans Administration [VA] to request veteran’s health information from non-VA providers. Aka VA Compensation Application Note: Form is available at http://www.vba.va.gov/pubs/forms/VBA-21-4142-ARE.pdf . For additional information regarding VA Form 21-4142, refer to the following website: www.benefits.va.gov/compensation/consent_privateproviders";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _42CFR2: return "42 CFR Part 2 Form of written consent";
+            case ACD: return "Advance Directive";
+            case CRIC: return "Common Rule Informed Consent";
+            case DNR: return "Do Not Resuscitate";
+            case EMRGONLY: return "Emergency Only";
+            case ILLINOISMINORPROCEDURE: return "Illinois Consent by Minors to Medical Procedures";
+            case HCD: return "Health Care Directive";
+            case HIPAAAUTH: return "HIPAA Authorization";
+            case HIPAANPP: return "HIPAA Notice of Privacy Practices";
+            case HIPAARESTRICTIONS: return "HIPAA Restrictions";
+            case HIPAARESEARCH: return "HIPAA Research Authorization";
+            case HIPAASELFPAY: return "HIPAA Self-Pay Restriction";
+            case MDHHS5515: return "Michigan MDHHS-5515 Consent to Share Behavioral Health Information for Care Coordination Purposes";
+            case NYSSIPP: return "New York State Surgical and Invasive Procedure Protocol";
+            case NPP: return "Notice of Privacy Practices";
+            case POLST: return "POLST";
+            case RESEARCH: return "Research Information Access";
+            case RSDID: return "De-identified Information Access";
+            case RSREID: return "Re-identifiable Information Access";
+            case SSA827: return "Form SSA-827";
+            case VA100484: return "VA Form 10-0484";
+            case VA100485: return "VA Form 10-0485";
+            case VA105345: return "VA Form 10-5345";
+            case VA105345A: return "VA Form 10-5345a";
+            case VA105345AMHV: return "VA Form 10-5345a-MHV";
+            case VA1010116: return "VA Form 10-10-10116";
+            case VA214142: return "VA Form 21-4142";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentCategoryEnumFactory.java
new file mode 100644
index 00000000000..686e42e90b6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentCategoryEnumFactory.java
@@ -0,0 +1,162 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConsentCategoryEnumFactory implements EnumFactory {
+
+  public ConsentCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("42-CFR-2".equals(codeString))
+      return ConsentCategory._42CFR2;
+    if ("ACD".equals(codeString))
+      return ConsentCategory.ACD;
+    if ("CRIC".equals(codeString))
+      return ConsentCategory.CRIC;
+    if ("DNR".equals(codeString))
+      return ConsentCategory.DNR;
+    if ("EMRGONLY".equals(codeString))
+      return ConsentCategory.EMRGONLY;
+    if ("Illinois-Minor-Procedure".equals(codeString))
+      return ConsentCategory.ILLINOISMINORPROCEDURE;
+    if ("HCD".equals(codeString))
+      return ConsentCategory.HCD;
+    if ("HIPAA-Auth".equals(codeString))
+      return ConsentCategory.HIPAAAUTH;
+    if ("HIPAA-NPP".equals(codeString))
+      return ConsentCategory.HIPAANPP;
+    if ("HIPAA-Restrictions".equals(codeString))
+      return ConsentCategory.HIPAARESTRICTIONS;
+    if ("HIPAA-Research".equals(codeString))
+      return ConsentCategory.HIPAARESEARCH;
+    if ("HIPAA-Self-Pay".equals(codeString))
+      return ConsentCategory.HIPAASELFPAY;
+    if ("MDHHS-5515".equals(codeString))
+      return ConsentCategory.MDHHS5515;
+    if ("NYSSIPP".equals(codeString))
+      return ConsentCategory.NYSSIPP;
+    if ("NPP".equals(codeString))
+      return ConsentCategory.NPP;
+    if ("POLST".equals(codeString))
+      return ConsentCategory.POLST;
+    if ("RESEARCH".equals(codeString))
+      return ConsentCategory.RESEARCH;
+    if ("RSDID".equals(codeString))
+      return ConsentCategory.RSDID;
+    if ("RSREID".equals(codeString))
+      return ConsentCategory.RSREID;
+    if ("SSA-827".equals(codeString))
+      return ConsentCategory.SSA827;
+    if ("VA-10-0484".equals(codeString))
+      return ConsentCategory.VA100484;
+    if ("VA-10-0485".equals(codeString))
+      return ConsentCategory.VA100485;
+    if ("VA-10-5345".equals(codeString))
+      return ConsentCategory.VA105345;
+    if ("VA-10-5345a".equals(codeString))
+      return ConsentCategory.VA105345A;
+    if ("VA-10-5345a-MHV".equals(codeString))
+      return ConsentCategory.VA105345AMHV;
+    if ("VA-10-10116".equals(codeString))
+      return ConsentCategory.VA1010116;
+    if ("VA-21-4142".equals(codeString))
+      return ConsentCategory.VA214142;
+    throw new IllegalArgumentException("Unknown ConsentCategory code '"+codeString+"'");
+  }
+
+  public String toCode(ConsentCategory code) {
+    if (code == ConsentCategory._42CFR2)
+      return "42-CFR-2";
+    if (code == ConsentCategory.ACD)
+      return "ACD";
+    if (code == ConsentCategory.CRIC)
+      return "CRIC";
+    if (code == ConsentCategory.DNR)
+      return "DNR";
+    if (code == ConsentCategory.EMRGONLY)
+      return "EMRGONLY";
+    if (code == ConsentCategory.ILLINOISMINORPROCEDURE)
+      return "Illinois-Minor-Procedure";
+    if (code == ConsentCategory.HCD)
+      return "HCD";
+    if (code == ConsentCategory.HIPAAAUTH)
+      return "HIPAA-Auth";
+    if (code == ConsentCategory.HIPAANPP)
+      return "HIPAA-NPP";
+    if (code == ConsentCategory.HIPAARESTRICTIONS)
+      return "HIPAA-Restrictions";
+    if (code == ConsentCategory.HIPAARESEARCH)
+      return "HIPAA-Research";
+    if (code == ConsentCategory.HIPAASELFPAY)
+      return "HIPAA-Self-Pay";
+    if (code == ConsentCategory.MDHHS5515)
+      return "MDHHS-5515";
+    if (code == ConsentCategory.NYSSIPP)
+      return "NYSSIPP";
+    if (code == ConsentCategory.NPP)
+      return "NPP";
+    if (code == ConsentCategory.POLST)
+      return "POLST";
+    if (code == ConsentCategory.RESEARCH)
+      return "RESEARCH";
+    if (code == ConsentCategory.RSDID)
+      return "RSDID";
+    if (code == ConsentCategory.RSREID)
+      return "RSREID";
+    if (code == ConsentCategory.SSA827)
+      return "SSA-827";
+    if (code == ConsentCategory.VA100484)
+      return "VA-10-0484";
+    if (code == ConsentCategory.VA100485)
+      return "VA-10-0485";
+    if (code == ConsentCategory.VA105345)
+      return "VA-10-5345";
+    if (code == ConsentCategory.VA105345A)
+      return "VA-10-5345a";
+    if (code == ConsentCategory.VA105345AMHV)
+      return "VA-10-5345a-MHV";
+    if (code == ConsentCategory.VA1010116)
+      return "VA-10-10116";
+    if (code == ConsentCategory.VA214142)
+      return "VA-21-4142";
+    return "?";
+  }
+
+    public String toSystem(ConsentCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentDataMeaning.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentDataMeaning.java
new file mode 100644
index 00000000000..ea9f9fffa0d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentDataMeaning.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConsentDataMeaning {
+
+        /**
+         * The consent applies directly to the instance of the resource
+         */
+        INSTANCE, 
+        /**
+         * The consent applies directly to the instance of the resource and instances it refers to
+         */
+        RELATED, 
+        /**
+         * The consent applies directly to the instance of the resource and instances that refer to it
+         */
+        DEPENDENTS, 
+        /**
+         * The consent applies to instances of resources that are authored by
+         */
+        AUTHOREDBY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConsentDataMeaning fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("instance".equals(codeString))
+          return INSTANCE;
+        if ("related".equals(codeString))
+          return RELATED;
+        if ("dependents".equals(codeString))
+          return DEPENDENTS;
+        if ("authoredby".equals(codeString))
+          return AUTHOREDBY;
+        throw new FHIRException("Unknown ConsentDataMeaning code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INSTANCE: return "instance";
+            case RELATED: return "related";
+            case DEPENDENTS: return "dependents";
+            case AUTHOREDBY: return "authoredby";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/consent-data-meaning";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INSTANCE: return "The consent applies directly to the instance of the resource";
+            case RELATED: return "The consent applies directly to the instance of the resource and instances it refers to";
+            case DEPENDENTS: return "The consent applies directly to the instance of the resource and instances that refer to it";
+            case AUTHOREDBY: return "The consent applies to instances of resources that are authored by";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INSTANCE: return "Instance";
+            case RELATED: return "Related";
+            case DEPENDENTS: return "Dependents";
+            case AUTHOREDBY: return "AuthoredBy";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentDataMeaningEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentDataMeaningEnumFactory.java
new file mode 100644
index 00000000000..86ebb778682
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentDataMeaningEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConsentDataMeaningEnumFactory implements EnumFactory {
+
+  public ConsentDataMeaning fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("instance".equals(codeString))
+      return ConsentDataMeaning.INSTANCE;
+    if ("related".equals(codeString))
+      return ConsentDataMeaning.RELATED;
+    if ("dependents".equals(codeString))
+      return ConsentDataMeaning.DEPENDENTS;
+    if ("authoredby".equals(codeString))
+      return ConsentDataMeaning.AUTHOREDBY;
+    throw new IllegalArgumentException("Unknown ConsentDataMeaning code '"+codeString+"'");
+  }
+
+  public String toCode(ConsentDataMeaning code) {
+    if (code == ConsentDataMeaning.INSTANCE)
+      return "instance";
+    if (code == ConsentDataMeaning.RELATED)
+      return "related";
+    if (code == ConsentDataMeaning.DEPENDENTS)
+      return "dependents";
+    if (code == ConsentDataMeaning.AUTHOREDBY)
+      return "authoredby";
+    return "?";
+  }
+
+    public String toSystem(ConsentDataMeaning code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentExceptType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentExceptType.java
new file mode 100644
index 00000000000..f9d9ebeab1a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentExceptType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConsentExceptType {
+
+        /**
+         * Consent is denied for actions meeting these rules
+         */
+        DENY, 
+        /**
+         * Consent is provided for actions meeting these rules
+         */
+        PERMIT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConsentExceptType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("deny".equals(codeString))
+          return DENY;
+        if ("permit".equals(codeString))
+          return PERMIT;
+        throw new FHIRException("Unknown ConsentExceptType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DENY: return "deny";
+            case PERMIT: return "permit";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/consent-except-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DENY: return "Consent is denied for actions meeting these rules";
+            case PERMIT: return "Consent is provided for actions meeting these rules";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DENY: return "Opt Out";
+            case PERMIT: return "Opt In";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentExceptTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentExceptTypeEnumFactory.java
new file mode 100644
index 00000000000..61f304e5a38
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentExceptTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConsentExceptTypeEnumFactory implements EnumFactory {
+
+  public ConsentExceptType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("deny".equals(codeString))
+      return ConsentExceptType.DENY;
+    if ("permit".equals(codeString))
+      return ConsentExceptType.PERMIT;
+    throw new IllegalArgumentException("Unknown ConsentExceptType code '"+codeString+"'");
+  }
+
+  public String toCode(ConsentExceptType code) {
+    if (code == ConsentExceptType.DENY)
+      return "deny";
+    if (code == ConsentExceptType.PERMIT)
+      return "permit";
+    return "?";
+  }
+
+    public String toSystem(ConsentExceptType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStateCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStateCodes.java
new file mode 100644
index 00000000000..0f6ecb44eff
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStateCodes.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConsentStateCodes {
+
+        /**
+         * The consent is in development or awaiting use but is not yet intended to be acted upon.
+         */
+        DRAFT, 
+        /**
+         * The consent has been proposed but not yet agreed to by all parties. The negotiation stage.
+         */
+        PROPOSED, 
+        /**
+         * The consent is to be followed and enforced.
+         */
+        ACTIVE, 
+        /**
+         * The consent has been rejected by one or more of the parties.
+         */
+        REJECTED, 
+        /**
+         * The consent is terminated or replaced.
+         */
+        INACTIVE, 
+        /**
+         * The consent was created wrongly (e.g. wrong patient) and should be ignored
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConsentStateCodes 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 ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ConsentStateCodes code '"+codeString+"'");
+        }
+        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 ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/consent-state-codes";
+        }
+        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";
+            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 ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStateCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStateCodesEnumFactory.java
new file mode 100644
index 00000000000..dfb6aba5cfb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStateCodesEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConsentStateCodesEnumFactory implements EnumFactory {
+
+  public ConsentStateCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return ConsentStateCodes.DRAFT;
+    if ("proposed".equals(codeString))
+      return ConsentStateCodes.PROPOSED;
+    if ("active".equals(codeString))
+      return ConsentStateCodes.ACTIVE;
+    if ("rejected".equals(codeString))
+      return ConsentStateCodes.REJECTED;
+    if ("inactive".equals(codeString))
+      return ConsentStateCodes.INACTIVE;
+    if ("entered-in-error".equals(codeString))
+      return ConsentStateCodes.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ConsentStateCodes code '"+codeString+"'");
+  }
+
+  public String toCode(ConsentStateCodes code) {
+    if (code == ConsentStateCodes.DRAFT)
+      return "draft";
+    if (code == ConsentStateCodes.PROPOSED)
+      return "proposed";
+    if (code == ConsentStateCodes.ACTIVE)
+      return "active";
+    if (code == ConsentStateCodes.REJECTED)
+      return "rejected";
+    if (code == ConsentStateCodes.INACTIVE)
+      return "inactive";
+    if (code == ConsentStateCodes.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ConsentStateCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStatus.java
new file mode 100644
index 00000000000..0508eb1b48b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConsentStatus {
+
+        /**
+         * The consent is in development or awaiting use but is not yet intended to be acted upon.
+         */
+        DRAFT, 
+        /**
+         * The consent has been proposed but not yet agreed to by all parties. The negotiation stage.
+         */
+        PROPOSED, 
+        /**
+         * The consent is to be followed and enforced.
+         */
+        ACTIVE, 
+        /**
+         * The consent has been rejected by one or more of the parties.
+         */
+        REJECTED, 
+        /**
+         * The consent is terminated or replaced.
+         */
+        INACTIVE, 
+        /**
+         * The consent was created wrongly (e.g. wrong patient) and should be ignored
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConsentStatus 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 ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ConsentStatus code '"+codeString+"'");
+        }
+        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 ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/consent-status";
+        }
+        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";
+            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 ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStatusEnumFactory.java
new file mode 100644
index 00000000000..af51996041b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConsentStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConsentStatusEnumFactory implements EnumFactory {
+
+  public ConsentStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return ConsentStatus.DRAFT;
+    if ("proposed".equals(codeString))
+      return ConsentStatus.PROPOSED;
+    if ("active".equals(codeString))
+      return ConsentStatus.ACTIVE;
+    if ("rejected".equals(codeString))
+      return ConsentStatus.REJECTED;
+    if ("inactive".equals(codeString))
+      return ConsentStatus.INACTIVE;
+    if ("entered-in-error".equals(codeString))
+      return ConsentStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ConsentStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ConsentStatus code) {
+    if (code == ConsentStatus.DRAFT)
+      return "draft";
+    if (code == ConsentStatus.PROPOSED)
+      return "proposed";
+    if (code == ConsentStatus.ACTIVE)
+      return "active";
+    if (code == ConsentStatus.REJECTED)
+      return "rejected";
+    if (code == ConsentStatus.INACTIVE)
+      return "inactive";
+    if (code == ConsentStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ConsentStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConstraintSeverity.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConstraintSeverity.java
new file mode 100644
index 00000000000..b98136572b8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConstraintSeverity.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ConstraintSeverity {
+
+        /**
+         * If the constraint is violated, the resource is not conformant.
+         */
+        ERROR, 
+        /**
+         * If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.
+         */
+        WARNING, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ConstraintSeverity fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("error".equals(codeString))
+          return ERROR;
+        if ("warning".equals(codeString))
+          return WARNING;
+        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ERROR: return "error";
+            case WARNING: return "warning";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/constraint-severity";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ERROR: return "If the constraint is violated, the resource is not conformant.";
+            case WARNING: return "If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ERROR: return "Error";
+            case WARNING: return "Warning";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConstraintSeverityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConstraintSeverityEnumFactory.java
new file mode 100644
index 00000000000..5ad927a69a8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ConstraintSeverityEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ConstraintSeverityEnumFactory implements EnumFactory {
+
+  public ConstraintSeverity fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("error".equals(codeString))
+      return ConstraintSeverity.ERROR;
+    if ("warning".equals(codeString))
+      return ConstraintSeverity.WARNING;
+    throw new IllegalArgumentException("Unknown ConstraintSeverity code '"+codeString+"'");
+  }
+
+  public String toCode(ConstraintSeverity code) {
+    if (code == ConstraintSeverity.ERROR)
+      return "error";
+    if (code == ConstraintSeverity.WARNING)
+      return "warning";
+    return "?";
+  }
+
+    public String toSystem(ConstraintSeverity code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointSystem.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointSystem.java
new file mode 100644
index 00000000000..b08ec14b521
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointSystem.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContactPointSystem {
+
+        /**
+         * The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.
+         */
+        PHONE, 
+        /**
+         * The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.
+         */
+        FAX, 
+        /**
+         * The value is an email address.
+         */
+        EMAIL, 
+        /**
+         * The value is a pager number. These may be local pager numbers that are only usable on a particular pager system.
+         */
+        PAGER, 
+        /**
+         * A contact that is not a phone, fax, pager or email address and is expressed as a URL.  This is intended for various personal contacts including blogs, Skype, Twitter, Facebook, etc. Do not use for email addresses.
+         */
+        URL, 
+        /**
+         * A contact that can be used for sending an sms message (e.g. mobide phones, some landlines)
+         */
+        SMS, 
+        /**
+         * A contact that is not a phone, fax, page or email address and is not expressible as a URL.  E.g. Internal mail address.  This SHOULD NOT be used for contacts that are expressible as a URL (e.g. Skype, Twitter, Facebook, etc.)  Extensions may be used to distinguish "other" contact types.
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContactPointSystem fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("phone".equals(codeString))
+          return PHONE;
+        if ("fax".equals(codeString))
+          return FAX;
+        if ("email".equals(codeString))
+          return EMAIL;
+        if ("pager".equals(codeString))
+          return PAGER;
+        if ("url".equals(codeString))
+          return URL;
+        if ("sms".equals(codeString))
+          return SMS;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PHONE: return "phone";
+            case FAX: return "fax";
+            case EMAIL: return "email";
+            case PAGER: return "pager";
+            case URL: return "url";
+            case SMS: return "sms";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contact-point-system";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PHONE: return "The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.";
+            case FAX: return "The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.";
+            case EMAIL: return "The value is an email address.";
+            case PAGER: return "The value is a pager number. These may be local pager numbers that are only usable on a particular pager system.";
+            case URL: return "A contact that is not a phone, fax, pager or email address and is expressed as a URL.  This is intended for various personal contacts including blogs, Skype, Twitter, Facebook, etc. Do not use for email addresses.";
+            case SMS: return "A contact that can be used for sending an sms message (e.g. mobide phones, some landlines)";
+            case OTHER: return "A contact that is not a phone, fax, page or email address and is not expressible as a URL.  E.g. Internal mail address.  This SHOULD NOT be used for contacts that are expressible as a URL (e.g. Skype, Twitter, Facebook, etc.)  Extensions may be used to distinguish \"other\" contact types.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PHONE: return "Phone";
+            case FAX: return "Fax";
+            case EMAIL: return "Email";
+            case PAGER: return "Pager";
+            case URL: return "URL";
+            case SMS: return "SMS";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointSystemEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointSystemEnumFactory.java
new file mode 100644
index 00000000000..143d92b5d5e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointSystemEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContactPointSystemEnumFactory implements EnumFactory {
+
+  public ContactPointSystem fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("phone".equals(codeString))
+      return ContactPointSystem.PHONE;
+    if ("fax".equals(codeString))
+      return ContactPointSystem.FAX;
+    if ("email".equals(codeString))
+      return ContactPointSystem.EMAIL;
+    if ("pager".equals(codeString))
+      return ContactPointSystem.PAGER;
+    if ("url".equals(codeString))
+      return ContactPointSystem.URL;
+    if ("sms".equals(codeString))
+      return ContactPointSystem.SMS;
+    if ("other".equals(codeString))
+      return ContactPointSystem.OTHER;
+    throw new IllegalArgumentException("Unknown ContactPointSystem code '"+codeString+"'");
+  }
+
+  public String toCode(ContactPointSystem code) {
+    if (code == ContactPointSystem.PHONE)
+      return "phone";
+    if (code == ContactPointSystem.FAX)
+      return "fax";
+    if (code == ContactPointSystem.EMAIL)
+      return "email";
+    if (code == ContactPointSystem.PAGER)
+      return "pager";
+    if (code == ContactPointSystem.URL)
+      return "url";
+    if (code == ContactPointSystem.SMS)
+      return "sms";
+    if (code == ContactPointSystem.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(ContactPointSystem code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointUse.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointUse.java
new file mode 100644
index 00000000000..6c2cf800af7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointUse.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContactPointUse {
+
+        /**
+         * A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available.
+         */
+        HOME, 
+        /**
+         * An office contact point. First choice for business related contacts during business hours.
+         */
+        WORK, 
+        /**
+         * A temporary contact point. The period can provide more detailed information.
+         */
+        TEMP, 
+        /**
+         * This contact point is no longer in use (or was never correct, but retained for records).
+         */
+        OLD, 
+        /**
+         * A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business.
+         */
+        MOBILE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContactPointUse fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("home".equals(codeString))
+          return HOME;
+        if ("work".equals(codeString))
+          return WORK;
+        if ("temp".equals(codeString))
+          return TEMP;
+        if ("old".equals(codeString))
+          return OLD;
+        if ("mobile".equals(codeString))
+          return MOBILE;
+        throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HOME: return "home";
+            case WORK: return "work";
+            case TEMP: return "temp";
+            case OLD: return "old";
+            case MOBILE: return "mobile";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contact-point-use";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HOME: return "A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available.";
+            case WORK: return "An office contact point. First choice for business related contacts during business hours.";
+            case TEMP: return "A temporary contact point. The period can provide more detailed information.";
+            case OLD: return "This contact point is no longer in use (or was never correct, but retained for records).";
+            case MOBILE: return "A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HOME: return "Home";
+            case WORK: return "Work";
+            case TEMP: return "Temp";
+            case OLD: return "Old";
+            case MOBILE: return "Mobile";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointUseEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointUseEnumFactory.java
new file mode 100644
index 00000000000..583b894f27e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactPointUseEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContactPointUseEnumFactory implements EnumFactory {
+
+  public ContactPointUse fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("home".equals(codeString))
+      return ContactPointUse.HOME;
+    if ("work".equals(codeString))
+      return ContactPointUse.WORK;
+    if ("temp".equals(codeString))
+      return ContactPointUse.TEMP;
+    if ("old".equals(codeString))
+      return ContactPointUse.OLD;
+    if ("mobile".equals(codeString))
+      return ContactPointUse.MOBILE;
+    throw new IllegalArgumentException("Unknown ContactPointUse code '"+codeString+"'");
+  }
+
+  public String toCode(ContactPointUse code) {
+    if (code == ContactPointUse.HOME)
+      return "home";
+    if (code == ContactPointUse.WORK)
+      return "work";
+    if (code == ContactPointUse.TEMP)
+      return "temp";
+    if (code == ContactPointUse.OLD)
+      return "old";
+    if (code == ContactPointUse.MOBILE)
+      return "mobile";
+    return "?";
+  }
+
+    public String toSystem(ContactPointUse code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactentityType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactentityType.java
new file mode 100644
index 00000000000..a338e3ec53a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactentityType.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContactentityType {
+
+        /**
+         * Contact details for information regarding to billing/general finance enquiries.
+         */
+        BILL, 
+        /**
+         * Contact details for administrative enquiries.
+         */
+        ADMIN, 
+        /**
+         * Contact details for issues related to Human Resources, such as staff matters, OH&S etc.
+         */
+        HR, 
+        /**
+         * Contact details for dealing with issues related to insurance claims/adjudication/payment.
+         */
+        PAYOR, 
+        /**
+         * Generic information contact for patients.
+         */
+        PATINF, 
+        /**
+         * Dedicated contact point for matters relating to press enquiries.
+         */
+        PRESS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContactentityType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("BILL".equals(codeString))
+          return BILL;
+        if ("ADMIN".equals(codeString))
+          return ADMIN;
+        if ("HR".equals(codeString))
+          return HR;
+        if ("PAYOR".equals(codeString))
+          return PAYOR;
+        if ("PATINF".equals(codeString))
+          return PATINF;
+        if ("PRESS".equals(codeString))
+          return PRESS;
+        throw new FHIRException("Unknown ContactentityType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BILL: return "BILL";
+            case ADMIN: return "ADMIN";
+            case HR: return "HR";
+            case PAYOR: return "PAYOR";
+            case PATINF: return "PATINF";
+            case PRESS: return "PRESS";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contactentity-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BILL: return "Contact details for information regarding to billing/general finance enquiries.";
+            case ADMIN: return "Contact details for administrative enquiries.";
+            case HR: return "Contact details for issues related to Human Resources, such as staff matters, OH&S etc.";
+            case PAYOR: return "Contact details for dealing with issues related to insurance claims/adjudication/payment.";
+            case PATINF: return "Generic information contact for patients.";
+            case PRESS: return "Dedicated contact point for matters relating to press enquiries.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BILL: return "Billing";
+            case ADMIN: return "Administrative";
+            case HR: return "Human Resource";
+            case PAYOR: return "Payor";
+            case PATINF: return "Patient";
+            case PRESS: return "Press";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactentityTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactentityTypeEnumFactory.java
new file mode 100644
index 00000000000..3f9624559aa
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContactentityTypeEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContactentityTypeEnumFactory implements EnumFactory {
+
+  public ContactentityType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("BILL".equals(codeString))
+      return ContactentityType.BILL;
+    if ("ADMIN".equals(codeString))
+      return ContactentityType.ADMIN;
+    if ("HR".equals(codeString))
+      return ContactentityType.HR;
+    if ("PAYOR".equals(codeString))
+      return ContactentityType.PAYOR;
+    if ("PATINF".equals(codeString))
+      return ContactentityType.PATINF;
+    if ("PRESS".equals(codeString))
+      return ContactentityType.PRESS;
+    throw new IllegalArgumentException("Unknown ContactentityType code '"+codeString+"'");
+  }
+
+  public String toCode(ContactentityType code) {
+    if (code == ContactentityType.BILL)
+      return "BILL";
+    if (code == ContactentityType.ADMIN)
+      return "ADMIN";
+    if (code == ContactentityType.HR)
+      return "HR";
+    if (code == ContactentityType.PAYOR)
+      return "PAYOR";
+    if (code == ContactentityType.PATINF)
+      return "PATINF";
+    if (code == ContactentityType.PRESS)
+      return "PRESS";
+    return "?";
+  }
+
+    public String toSystem(ContactentityType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContentType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContentType.java
new file mode 100644
index 00000000000..7de72bbc50b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContentType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContentType {
+
+        /**
+         * XML content-type corresponding to the application/fhir+xml mime-type.
+         */
+        XML, 
+        /**
+         * JSON content-type corresponding to the application/fhir+json mime-type.
+         */
+        JSON, 
+        /**
+         * RDF content-type corresponding to the text/turtle mime-type.
+         */
+        TTL, 
+        /**
+         * Prevent the use of the corresponding http header.
+         */
+        NONE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContentType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("xml".equals(codeString))
+          return XML;
+        if ("json".equals(codeString))
+          return JSON;
+        if ("ttl".equals(codeString))
+          return TTL;
+        if ("none".equals(codeString))
+          return NONE;
+        throw new FHIRException("Unknown ContentType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case XML: return "xml";
+            case JSON: return "json";
+            case TTL: return "ttl";
+            case NONE: return "none";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/content-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case XML: return "XML content-type corresponding to the application/fhir+xml mime-type.";
+            case JSON: return "JSON content-type corresponding to the application/fhir+json mime-type.";
+            case TTL: return "RDF content-type corresponding to the text/turtle mime-type.";
+            case NONE: return "Prevent the use of the corresponding http header.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case XML: return "xml";
+            case JSON: return "json";
+            case TTL: return "ttl";
+            case NONE: return "none";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContentTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContentTypeEnumFactory.java
new file mode 100644
index 00000000000..89d00885c11
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContentTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContentTypeEnumFactory implements EnumFactory {
+
+  public ContentType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("xml".equals(codeString))
+      return ContentType.XML;
+    if ("json".equals(codeString))
+      return ContentType.JSON;
+    if ("ttl".equals(codeString))
+      return ContentType.TTL;
+    if ("none".equals(codeString))
+      return ContentType.NONE;
+    throw new IllegalArgumentException("Unknown ContentType code '"+codeString+"'");
+  }
+
+  public String toCode(ContentType code) {
+    if (code == ContentType.XML)
+      return "xml";
+    if (code == ContentType.JSON)
+      return "json";
+    if (code == ContentType.TTL)
+      return "ttl";
+    if (code == ContentType.NONE)
+      return "none";
+    return "?";
+  }
+
+    public String toSystem(ContentType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractAction.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractAction.java
new file mode 100644
index 00000000000..851526fa488
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractAction.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContractAction {
+
+        /**
+         * Definition for Action A
+         */
+        ACTIONA, 
+        /**
+         * Definition for Action B
+         */
+        ACTIONB, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContractAction fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("action-a".equals(codeString))
+          return ACTIONA;
+        if ("action-b".equals(codeString))
+          return ACTIONB;
+        throw new FHIRException("Unknown ContractAction code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIONA: return "action-a";
+            case ACTIONB: return "action-b";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://www.hl7.org/fhir/contractaction";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIONA: return "Definition for Action A";
+            case ACTIONB: return "Definition for Action B";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIONA: return "Action A";
+            case ACTIONB: return "Action B";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractActionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractActionEnumFactory.java
new file mode 100644
index 00000000000..03b7ef7f5ec
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractActionEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContractActionEnumFactory implements EnumFactory {
+
+  public ContractAction fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("action-a".equals(codeString))
+      return ContractAction.ACTIONA;
+    if ("action-b".equals(codeString))
+      return ContractAction.ACTIONB;
+    throw new IllegalArgumentException("Unknown ContractAction code '"+codeString+"'");
+  }
+
+  public String toCode(ContractAction code) {
+    if (code == ContractAction.ACTIONA)
+      return "action-a";
+    if (code == ContractAction.ACTIONB)
+      return "action-b";
+    return "?";
+  }
+
+    public String toSystem(ContractAction code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractActorrole.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractActorrole.java
new file mode 100644
index 00000000000..f13c85d96a2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractActorrole.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContractActorrole {
+
+        /**
+         * Someone who provides health care related services to people or animals including both clinical and support services.
+         */
+        PRACTITIONER, 
+        /**
+         * A receiver, human or animal, of health care related goods and services.
+         */
+        PATIENT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContractActorrole fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("practitioner".equals(codeString))
+          return PRACTITIONER;
+        if ("patient".equals(codeString))
+          return PATIENT;
+        throw new FHIRException("Unknown ContractActorrole code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PRACTITIONER: return "practitioner";
+            case PATIENT: return "patient";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://www.hl7.org/fhir/contractactorrole";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PRACTITIONER: return "Someone who provides health care related services to people or animals including both clinical and support services.";
+            case PATIENT: return "A receiver, human or animal, of health care related goods and services.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PRACTITIONER: return "Practitioner";
+            case PATIENT: return "Patient";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractActorroleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractActorroleEnumFactory.java
new file mode 100644
index 00000000000..48e692770c7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractActorroleEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContractActorroleEnumFactory implements EnumFactory {
+
+  public ContractActorrole fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("practitioner".equals(codeString))
+      return ContractActorrole.PRACTITIONER;
+    if ("patient".equals(codeString))
+      return ContractActorrole.PATIENT;
+    throw new IllegalArgumentException("Unknown ContractActorrole code '"+codeString+"'");
+  }
+
+  public String toCode(ContractActorrole code) {
+    if (code == ContractActorrole.PRACTITIONER)
+      return "practitioner";
+    if (code == ContractActorrole.PATIENT)
+      return "patient";
+    return "?";
+  }
+
+    public String toSystem(ContractActorrole code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractContentDerivative.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractContentDerivative.java
new file mode 100644
index 00000000000..56a7700363d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractContentDerivative.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContractContentDerivative {
+
+        /**
+         * Content derivative that conveys sufficient information needed to register the source basal content from which it is derived.  This derivative content may be used to register the basal content as it changes status in its lifecycle.  For example, content registration may occur when the basal content is created, updated, inactive, or deleted.
+         */
+        REGISTRATION, 
+        /**
+         * A content derivative that conveys sufficient information to locate and retrieve the content.
+         */
+        RETRIEVAL, 
+        /**
+         * Content derivative that has less than full fidelity to the basal information source from which it was 'transcribed'. It provides recipients with the full content representation they may require for compliance purposes, and typically include a reference to or an attached unstructured representation for recipients needing an exact copy of the legal agreement.
+         */
+        STATEMENT, 
+        /**
+         * A Content Derivative that conveys sufficient information to determine the authorized entities with which the content may be shared.
+         */
+        SHAREABLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContractContentDerivative fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("registration".equals(codeString))
+          return REGISTRATION;
+        if ("retrieval".equals(codeString))
+          return RETRIEVAL;
+        if ("statement".equals(codeString))
+          return STATEMENT;
+        if ("shareable".equals(codeString))
+          return SHAREABLE;
+        throw new FHIRException("Unknown ContractContentDerivative code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REGISTRATION: return "registration";
+            case RETRIEVAL: return "retrieval";
+            case STATEMENT: return "statement";
+            case SHAREABLE: return "shareable";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contract-content-derivative";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REGISTRATION: return "Content derivative that conveys sufficient information needed to register the source basal content from which it is derived.  This derivative content may be used to register the basal content as it changes status in its lifecycle.  For example, content registration may occur when the basal content is created, updated, inactive, or deleted.";
+            case RETRIEVAL: return "A content derivative that conveys sufficient information to locate and retrieve the content.";
+            case STATEMENT: return "Content derivative that has less than full fidelity to the basal information source from which it was 'transcribed'. It provides recipients with the full content representation they may require for compliance purposes, and typically include a reference to or an attached unstructured representation for recipients needing an exact copy of the legal agreement.";
+            case SHAREABLE: return "A Content Derivative that conveys sufficient information to determine the authorized entities with which the content may be shared.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REGISTRATION: return "Content Registration";
+            case RETRIEVAL: return "Content Retrieval";
+            case STATEMENT: return "Content Statement";
+            case SHAREABLE: return "Shareable Content";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractContentDerivativeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractContentDerivativeEnumFactory.java
new file mode 100644
index 00000000000..ceec7650aa7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractContentDerivativeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContractContentDerivativeEnumFactory implements EnumFactory {
+
+  public ContractContentDerivative fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("registration".equals(codeString))
+      return ContractContentDerivative.REGISTRATION;
+    if ("retrieval".equals(codeString))
+      return ContractContentDerivative.RETRIEVAL;
+    if ("statement".equals(codeString))
+      return ContractContentDerivative.STATEMENT;
+    if ("shareable".equals(codeString))
+      return ContractContentDerivative.SHAREABLE;
+    throw new IllegalArgumentException("Unknown ContractContentDerivative code '"+codeString+"'");
+  }
+
+  public String toCode(ContractContentDerivative code) {
+    if (code == ContractContentDerivative.REGISTRATION)
+      return "registration";
+    if (code == ContractContentDerivative.RETRIEVAL)
+      return "retrieval";
+    if (code == ContractContentDerivative.STATEMENT)
+      return "statement";
+    if (code == ContractContentDerivative.SHAREABLE)
+      return "shareable";
+    return "?";
+  }
+
+    public String toSystem(ContractContentDerivative code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSignerType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSignerType.java
new file mode 100644
index 00000000000..e719ad934ec
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSignerType.java
@@ -0,0 +1,501 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContractSignerType {
+
+        /**
+         * A person who has corrected, edited, or amended pre-existing information.
+         */
+        AMENDER, 
+        /**
+         * A person in the role of verifier who attests to the accuracy of an act, but who does not have privileges to legally authenticate information content. An example would be a resident physician who sees a patient and dictates a note, then later signs it. The resident's signature constitutes an authentication.
+         */
+        AUTHN, 
+        /**
+         * An entity that authored specific content. There can be multiple authors of content, which may take such forms as a contract, a healthcare record entry or document, a policy, or a consent directive.
+         */
+        AUT, 
+        /**
+         * An entity that has a business or professional relationship with another entity in accordance with an agreement.
+         */
+        AFFL, 
+        /**
+         * An entity that acts or is authorized to act on behalf of another entity in accordance with an agreement.
+         */
+        AGNT, 
+        /**
+         * An agent role in which the agent is an Entity acting in the employ of an organization. The focus is on functional role on behalf of the organization, unlike the Employee role where the focus is on the 'Human Resources' relationship between the employee and the organization.
+         */
+        ASSIGNED, 
+        /**
+         * The member of a jurisdiction afforded certain rights and encumbered with certain obligation in accordance with jurisdictional policy.
+         */
+        CIT, 
+        /**
+         * A party that makes a claim for coverage under a policy.
+         */
+        CLAIMANT, 
+        /**
+         * The entity that co-authored content. There can be multiple co-authors of content,which may take such forms as a  such as a contract, a healthcare record entry or document, a policy, or a consent directive.
+         */
+        COAUTH, 
+        /**
+         * A patient or patient representative who is the grantee in a healthcare related agreement such as a consent for healthcare services, advanced directive, or a privacy consent directive in accordance with jurisdictional, organizational, or patient policy.
+         */
+        CONSENTER, 
+        /**
+         * A person who has witnessed and attests to observing a patient being counseled about a healthcare related agreement such as a consent for healthcare services, advanced directive, or a privacy consent directive.
+         */
+        CONSWIT, 
+        /**
+         * A person or an organization that provides or receives information regarding another entity. Examples; patient NOK and emergency contacts; guarantor contact; employer contact.
+         */
+        CONT, 
+        /**
+         * A person who participates in the generation of and attest to veracity of content, but is not an author or co-author. For example a surgeon who is required by institutional, regulatory, or legal rules to sign an operative report, but who was not involved in the authorship of that report.
+         */
+        COPART, 
+        /**
+         * An entity, which is the insured, that receives benefits such as healthcare services, reimbursement for out-of-pocket expenses, or compensation for losses through coverage under the terms of an insurance policy. The underwriter of that policy is the scoping entity. The covered party receives coverage because of some contractual or other relationship with the holder of that policy. Note that a particular policy may cover several individuals one of whom may be, but need not be, the policy holder. Thus the notion of covered party is a role that is distinct from that of the policy holder.
+         */
+        COVPTY, 
+        /**
+         * A party to whom some right or authority is delegated by a delegator.
+         */
+        DELEGATEE, 
+        /**
+         * A party that delegates a right or authority to another party.
+         */
+        DELEGATOR, 
+        /**
+         * A person covered under an insurance policy or program based on an association with a subscriber, which is recognized by the policy holder. The dependent has an association with the subscriber such as a financial dependency or personal relationship such as that of a spouse, or a natural or adopted child. The policy holder may be required by law to recognize certain associations or may have discretion about the associations. For example, a policy holder may dictate the criteria for the dependent status of adult children who are students, such as requiring full time enrollment, or may recognize domestic partners as dependents. Under certain circumstances, the dependent may be under the indirect authority of a responsible party acting as a surrogate for the subscriber, for example, if the subscriber is differently-abled or deceased, a guardian ad Lidem or estate executor may be appointed to assume the subscriber's legal standing in the relationship with the dependent.
+         */
+        DEPEND, 
+        /**
+         * A person who has been granted the authority to represent or act on another's behalf generally in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts. Unlike ordinary powers of attorney, durable powers can survive for long periods of time, and again, unlike standard powers of attorney, durable powers can continue after incompetency.
+         */
+        DPOWATT, 
+        /**
+         * An entity to be contacted in the event of an emergency
+         */
+        EMGCON, 
+        /**
+         * A person who attests to observing an occurrence.  For example, the witness has observed a procedure and is attesting to this fact.
+         */
+        EVTWIT, 
+        /**
+         * A person who has been granted the authority to act as an estate executor for a deceased person who was the responsible party.
+         */
+        EXCEST, 
+        /**
+         * A person who grants to another person the authority to represent or act on that person's behalf.  Examples include (1) exercising specific rights belonging to the grantee; (2) performing specific duties on behalf of a grantee; and (3) making specific decisions concerning a grantee.
+         */
+        GRANTEE, 
+        /**
+         * A person who has been granted the authority to represent or act on another's behalf. Examples include (1) exercising specific rights belonging to the grantee; (2) performing specific duties on behalf of a grantee; and (3) making specific decisions concerning a grantee.
+         */
+        GRANTOR, 
+        /**
+         * A person or organization contractually recognized by the issuer as an entity that has assumed fiscal responsibility (e.g., by making or giving a promise, assurance, or pledge) for another entity's financial obligations by guaranteeing to pay for amounts owed to a particular account.  In a healthcare context, the account may be a patient's billing account for services rendered by a provider or a health plan premium account.
+         */
+        GUAR, 
+        /**
+         * A person or organization legally empowered with responsibility for the care of a ward.
+         */
+        GUARD, 
+        /**
+         * A person appointed by the court to look out for the best interests of a minor child during the course of legal proceedings.
+         */
+        GUADLTM, 
+        /**
+         * An entity that is the source of reported information (e.g., a next of kin who answers questions about the patient's history). For history questions, the patient is logically an informant, yet the informant of history questions is implicitly the subject.
+         */
+        INF, 
+        /**
+         * A person who converts spoken or written language into the language of key participants in an event such as when a provider is obtaining a patient's consent to treatment or permission to disclose information.
+         */
+        INTPRT, 
+        /**
+         * An entity that is the subject of an investigation. This role is scoped by the party responsible for the investigation.
+         */
+        INSBJ, 
+        /**
+         * A person who has been granted the authority to represent or act on another's behalf for healthcare related matters in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts. Examples include (1) exercising specific healthcare legal rights belonging to the grantee such as signing a consent directive; (2) performing specific healthcare related legal duties on behalf of a grantee such as claims payment; and (3) making specific healthcare legal decisions concerning a grantee such as consenting to healthcare services.
+         */
+        HPOWATT, 
+        /**
+         * An entity that is authorized to provide health care services by an authorizing organization or jurisdiction.
+         */
+        HPROV, 
+        /**
+         * A person in the role of verifier who attests to the accuracy of information content, and who has privileges to certify the legal authenticity of that content with a signature that constitutes a legal authentication.  For example, a licensed physician who signs a consult authored by a resident physician who authenticated it.
+         */
+        LEGAUTHN, 
+        /**
+         * A party to an insurance policy under which the insurer agrees to indemnify for losses, provides benefits for, or renders services. A named insured may be either a person, non-person living subject, or an organization, or a group of persons, non-person living subject that is the named insured under a comprehensive automobile, disability, or property and casualty policy.  The named insured and may or may not be the policy holder.
+         */
+        NMDINS, 
+        /**
+         * A person, who is a type of contact, designated to receive notifications on behalf of another person who is a relative.
+         */
+        NOK, 
+        /**
+         * The party credentialed to legally attest to the contract binding by verifying the identity and capacity of the grantor and grantee, and witnessing their signing of the contract or agreement such as a real estate transaction, pre-nuptial agreement, or a will.
+         */
+        NOTARY, 
+        /**
+         * A person, animal, or other living subject that is the actual or potential recipient of health care services.
+         */
+        PAT, 
+        /**
+         * A person who has been granted the authority to represent or act on another's behalf generally in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts. Examples include (1) exercising specific legal rights belonging to the grantee such as signing a contract; (2) performing specific legal duties on behalf of a grantee such as making loan payments; and (3) making specific legal decisions concerning a grantee such as financial investment decisions.
+         */
+        POWATT, 
+        /**
+         * An entity that is the primary or sole author of information content.  In the healthcare context, there can be only one primary author of health information content in a record entry or document.
+         */
+        PRIMAUTH, 
+        /**
+         * An entity that may, should receive, or has received information or an object to which it was primarily addressed.
+         */
+        PRIRECIP, 
+        /**
+         * An entity that may, should receive, or has received information or an object, which may not have been primarily addressed to it. For example, the staff of a provider, a clearinghouse, or other intermediary.
+         */
+        RECIP, 
+        /**
+         * An entity that has legal responsibility for another party.
+         */
+        RESPRSN, 
+        /**
+         * A person, device, or algorithm that has used approved criteria for filtered data for inclusion into the patient record.  Examples: (1) a medical records clerk who scans a document for inclusion in the medical record, enters header information, or catalogues and classifies the data, or a combination thereof; (2) a gateway that receives data from another computer system and interprets that data or changes its format, or both, before entering it into the patient record.
+         */
+        REVIEWER, 
+        /**
+         * An entity entering the data into the originating system. This includes the transcriptionist for dictated text transcribed into electronic form.
+         */
+        TRANS, 
+        /**
+         * An automated data source that generates a signature along with content. Examples: (1) the signature for an image that is generated by a device for inclusion in the patient record; (2) the signature for an ECG derived by an ECG system for inclusion in the patient record; (3) the data from a biomedical monitoring device or system that is for inclusion in the patient record.
+         */
+        SOURCE, 
+        /**
+         * A person who has been granted the authority to represent or act on another's behalf for a limited set of specific matters in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts. Examples include (1) exercising specific legal rights belonging to the grantee such as drafting a will; (2) performing specific legal duties on behalf of a grantee such as making a reversible mortgage to pay for end of life expenses; and (3) making specific legal decisions concerning a grantee such as managing a trust.
+         */
+        SPOWATT, 
+        /**
+         * A person who validates a health information document for inclusion in the patient record. For example, a medical student or resident is credentialed to perform history or physical examinations and to write progress notes. The attending physician signs the history and physical examination to validate the entry for inclusion in the patient's medical record.
+         */
+        VALID, 
+        /**
+         * A person who asserts the correctness and appropriateness of an act or the recording of the act, and is accountable for the assertion that the act or the recording of the act complies with jurisdictional or organizational policy. For example, a physician is required to countersign a verbal order that has previously been recorded in the medical record by a registered nurse who has carried out the verbal order.
+         */
+        VERF, 
+        /**
+         * A person witnessing the signature of another party. A witness is not knowledgeable about the content being signed, much less approves of anything stated in the content. For example, an advanced directive witness or a witness that a party to a contract signed that certain demographic or financial information is truthful.
+         */
+        WIT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContractSignerType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AMENDER".equals(codeString))
+          return AMENDER;
+        if ("AUTHN".equals(codeString))
+          return AUTHN;
+        if ("AUT".equals(codeString))
+          return AUT;
+        if ("AFFL".equals(codeString))
+          return AFFL;
+        if ("AGNT".equals(codeString))
+          return AGNT;
+        if ("ASSIGNED".equals(codeString))
+          return ASSIGNED;
+        if ("CIT".equals(codeString))
+          return CIT;
+        if ("CLAIMANT".equals(codeString))
+          return CLAIMANT;
+        if ("COAUTH".equals(codeString))
+          return COAUTH;
+        if ("CONSENTER".equals(codeString))
+          return CONSENTER;
+        if ("CONSWIT".equals(codeString))
+          return CONSWIT;
+        if ("CONT".equals(codeString))
+          return CONT;
+        if ("COPART".equals(codeString))
+          return COPART;
+        if ("COVPTY".equals(codeString))
+          return COVPTY;
+        if ("DELEGATEE".equals(codeString))
+          return DELEGATEE;
+        if ("delegator".equals(codeString))
+          return DELEGATOR;
+        if ("DEPEND".equals(codeString))
+          return DEPEND;
+        if ("DPOWATT".equals(codeString))
+          return DPOWATT;
+        if ("EMGCON".equals(codeString))
+          return EMGCON;
+        if ("EVTWIT".equals(codeString))
+          return EVTWIT;
+        if ("EXCEST".equals(codeString))
+          return EXCEST;
+        if ("GRANTEE".equals(codeString))
+          return GRANTEE;
+        if ("GRANTOR".equals(codeString))
+          return GRANTOR;
+        if ("GUAR".equals(codeString))
+          return GUAR;
+        if ("GUARD".equals(codeString))
+          return GUARD;
+        if ("GUADLTM".equals(codeString))
+          return GUADLTM;
+        if ("INF".equals(codeString))
+          return INF;
+        if ("INTPRT".equals(codeString))
+          return INTPRT;
+        if ("INSBJ".equals(codeString))
+          return INSBJ;
+        if ("HPOWATT".equals(codeString))
+          return HPOWATT;
+        if ("HPROV".equals(codeString))
+          return HPROV;
+        if ("LEGAUTHN".equals(codeString))
+          return LEGAUTHN;
+        if ("NMDINS".equals(codeString))
+          return NMDINS;
+        if ("NOK".equals(codeString))
+          return NOK;
+        if ("NOTARY".equals(codeString))
+          return NOTARY;
+        if ("PAT".equals(codeString))
+          return PAT;
+        if ("POWATT".equals(codeString))
+          return POWATT;
+        if ("PRIMAUTH".equals(codeString))
+          return PRIMAUTH;
+        if ("PRIRECIP".equals(codeString))
+          return PRIRECIP;
+        if ("RECIP".equals(codeString))
+          return RECIP;
+        if ("RESPRSN".equals(codeString))
+          return RESPRSN;
+        if ("REVIEWER".equals(codeString))
+          return REVIEWER;
+        if ("TRANS".equals(codeString))
+          return TRANS;
+        if ("SOURCE".equals(codeString))
+          return SOURCE;
+        if ("SPOWATT".equals(codeString))
+          return SPOWATT;
+        if ("VALID".equals(codeString))
+          return VALID;
+        if ("VERF".equals(codeString))
+          return VERF;
+        if ("WIT".equals(codeString))
+          return WIT;
+        throw new FHIRException("Unknown ContractSignerType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AMENDER: return "AMENDER";
+            case AUTHN: return "AUTHN";
+            case AUT: return "AUT";
+            case AFFL: return "AFFL";
+            case AGNT: return "AGNT";
+            case ASSIGNED: return "ASSIGNED";
+            case CIT: return "CIT";
+            case CLAIMANT: return "CLAIMANT";
+            case COAUTH: return "COAUTH";
+            case CONSENTER: return "CONSENTER";
+            case CONSWIT: return "CONSWIT";
+            case CONT: return "CONT";
+            case COPART: return "COPART";
+            case COVPTY: return "COVPTY";
+            case DELEGATEE: return "DELEGATEE";
+            case DELEGATOR: return "delegator";
+            case DEPEND: return "DEPEND";
+            case DPOWATT: return "DPOWATT";
+            case EMGCON: return "EMGCON";
+            case EVTWIT: return "EVTWIT";
+            case EXCEST: return "EXCEST";
+            case GRANTEE: return "GRANTEE";
+            case GRANTOR: return "GRANTOR";
+            case GUAR: return "GUAR";
+            case GUARD: return "GUARD";
+            case GUADLTM: return "GUADLTM";
+            case INF: return "INF";
+            case INTPRT: return "INTPRT";
+            case INSBJ: return "INSBJ";
+            case HPOWATT: return "HPOWATT";
+            case HPROV: return "HPROV";
+            case LEGAUTHN: return "LEGAUTHN";
+            case NMDINS: return "NMDINS";
+            case NOK: return "NOK";
+            case NOTARY: return "NOTARY";
+            case PAT: return "PAT";
+            case POWATT: return "POWATT";
+            case PRIMAUTH: return "PRIMAUTH";
+            case PRIRECIP: return "PRIRECIP";
+            case RECIP: return "RECIP";
+            case RESPRSN: return "RESPRSN";
+            case REVIEWER: return "REVIEWER";
+            case TRANS: return "TRANS";
+            case SOURCE: return "SOURCE";
+            case SPOWATT: return "SPOWATT";
+            case VALID: return "VALID";
+            case VERF: return "VERF";
+            case WIT: return "WIT";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://www.hl7.org/fhir/contractsignertypecodes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AMENDER: return "A person who has corrected, edited, or amended pre-existing information.";
+            case AUTHN: return "A person in the role of verifier who attests to the accuracy of an act, but who does not have privileges to legally authenticate information content. An example would be a resident physician who sees a patient and dictates a note, then later signs it. The resident's signature constitutes an authentication.";
+            case AUT: return "An entity that authored specific content. There can be multiple authors of content, which may take such forms as a contract, a healthcare record entry or document, a policy, or a consent directive.";
+            case AFFL: return "An entity that has a business or professional relationship with another entity in accordance with an agreement.";
+            case AGNT: return "An entity that acts or is authorized to act on behalf of another entity in accordance with an agreement.";
+            case ASSIGNED: return "An agent role in which the agent is an Entity acting in the employ of an organization. The focus is on functional role on behalf of the organization, unlike the Employee role where the focus is on the 'Human Resources' relationship between the employee and the organization.";
+            case CIT: return "The member of a jurisdiction afforded certain rights and encumbered with certain obligation in accordance with jurisdictional policy.";
+            case CLAIMANT: return "A party that makes a claim for coverage under a policy.";
+            case COAUTH: return "The entity that co-authored content. There can be multiple co-authors of content,which may take such forms as a  such as a contract, a healthcare record entry or document, a policy, or a consent directive.";
+            case CONSENTER: return "A patient or patient representative who is the grantee in a healthcare related agreement such as a consent for healthcare services, advanced directive, or a privacy consent directive in accordance with jurisdictional, organizational, or patient policy.";
+            case CONSWIT: return "A person who has witnessed and attests to observing a patient being counseled about a healthcare related agreement such as a consent for healthcare services, advanced directive, or a privacy consent directive.";
+            case CONT: return "A person or an organization that provides or receives information regarding another entity. Examples; patient NOK and emergency contacts; guarantor contact; employer contact.";
+            case COPART: return "A person who participates in the generation of and attest to veracity of content, but is not an author or co-author. For example a surgeon who is required by institutional, regulatory, or legal rules to sign an operative report, but who was not involved in the authorship of that report.";
+            case COVPTY: return "An entity, which is the insured, that receives benefits such as healthcare services, reimbursement for out-of-pocket expenses, or compensation for losses through coverage under the terms of an insurance policy. The underwriter of that policy is the scoping entity. The covered party receives coverage because of some contractual or other relationship with the holder of that policy. Note that a particular policy may cover several individuals one of whom may be, but need not be, the policy holder. Thus the notion of covered party is a role that is distinct from that of the policy holder.";
+            case DELEGATEE: return "A party to whom some right or authority is delegated by a delegator.";
+            case DELEGATOR: return "A party that delegates a right or authority to another party.";
+            case DEPEND: return "A person covered under an insurance policy or program based on an association with a subscriber, which is recognized by the policy holder. The dependent has an association with the subscriber such as a financial dependency or personal relationship such as that of a spouse, or a natural or adopted child. The policy holder may be required by law to recognize certain associations or may have discretion about the associations. For example, a policy holder may dictate the criteria for the dependent status of adult children who are students, such as requiring full time enrollment, or may recognize domestic partners as dependents. Under certain circumstances, the dependent may be under the indirect authority of a responsible party acting as a surrogate for the subscriber, for example, if the subscriber is differently-abled or deceased, a guardian ad Lidem or estate executor may be appointed to assume the subscriber's legal standing in the relationship with the dependent.";
+            case DPOWATT: return "A person who has been granted the authority to represent or act on another's behalf generally in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts. Unlike ordinary powers of attorney, durable powers can survive for long periods of time, and again, unlike standard powers of attorney, durable powers can continue after incompetency.";
+            case EMGCON: return "An entity to be contacted in the event of an emergency";
+            case EVTWIT: return "A person who attests to observing an occurrence.  For example, the witness has observed a procedure and is attesting to this fact.";
+            case EXCEST: return "A person who has been granted the authority to act as an estate executor for a deceased person who was the responsible party.";
+            case GRANTEE: return "A person who grants to another person the authority to represent or act on that person's behalf.  Examples include (1) exercising specific rights belonging to the grantee; (2) performing specific duties on behalf of a grantee; and (3) making specific decisions concerning a grantee.";
+            case GRANTOR: return "A person who has been granted the authority to represent or act on another's behalf. Examples include (1) exercising specific rights belonging to the grantee; (2) performing specific duties on behalf of a grantee; and (3) making specific decisions concerning a grantee.";
+            case GUAR: return "A person or organization contractually recognized by the issuer as an entity that has assumed fiscal responsibility (e.g., by making or giving a promise, assurance, or pledge) for another entity's financial obligations by guaranteeing to pay for amounts owed to a particular account.  In a healthcare context, the account may be a patient's billing account for services rendered by a provider or a health plan premium account.";
+            case GUARD: return "A person or organization legally empowered with responsibility for the care of a ward.";
+            case GUADLTM: return "A person appointed by the court to look out for the best interests of a minor child during the course of legal proceedings.";
+            case INF: return "An entity that is the source of reported information (e.g., a next of kin who answers questions about the patient's history). For history questions, the patient is logically an informant, yet the informant of history questions is implicitly the subject.";
+            case INTPRT: return "A person who converts spoken or written language into the language of key participants in an event such as when a provider is obtaining a patient's consent to treatment or permission to disclose information.";
+            case INSBJ: return "An entity that is the subject of an investigation. This role is scoped by the party responsible for the investigation.";
+            case HPOWATT: return "A person who has been granted the authority to represent or act on another's behalf for healthcare related matters in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts. Examples include (1) exercising specific healthcare legal rights belonging to the grantee such as signing a consent directive; (2) performing specific healthcare related legal duties on behalf of a grantee such as claims payment; and (3) making specific healthcare legal decisions concerning a grantee such as consenting to healthcare services.";
+            case HPROV: return "An entity that is authorized to provide health care services by an authorizing organization or jurisdiction.";
+            case LEGAUTHN: return "A person in the role of verifier who attests to the accuracy of information content, and who has privileges to certify the legal authenticity of that content with a signature that constitutes a legal authentication.  For example, a licensed physician who signs a consult authored by a resident physician who authenticated it.";
+            case NMDINS: return "A party to an insurance policy under which the insurer agrees to indemnify for losses, provides benefits for, or renders services. A named insured may be either a person, non-person living subject, or an organization, or a group of persons, non-person living subject that is the named insured under a comprehensive automobile, disability, or property and casualty policy.  The named insured and may or may not be the policy holder.";
+            case NOK: return "A person, who is a type of contact, designated to receive notifications on behalf of another person who is a relative.";
+            case NOTARY: return "The party credentialed to legally attest to the contract binding by verifying the identity and capacity of the grantor and grantee, and witnessing their signing of the contract or agreement such as a real estate transaction, pre-nuptial agreement, or a will.";
+            case PAT: return "A person, animal, or other living subject that is the actual or potential recipient of health care services.";
+            case POWATT: return "A person who has been granted the authority to represent or act on another's behalf generally in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts. Examples include (1) exercising specific legal rights belonging to the grantee such as signing a contract; (2) performing specific legal duties on behalf of a grantee such as making loan payments; and (3) making specific legal decisions concerning a grantee such as financial investment decisions.";
+            case PRIMAUTH: return "An entity that is the primary or sole author of information content.  In the healthcare context, there can be only one primary author of health information content in a record entry or document.";
+            case PRIRECIP: return "An entity that may, should receive, or has received information or an object to which it was primarily addressed.";
+            case RECIP: return "An entity that may, should receive, or has received information or an object, which may not have been primarily addressed to it. For example, the staff of a provider, a clearinghouse, or other intermediary.";
+            case RESPRSN: return "An entity that has legal responsibility for another party.";
+            case REVIEWER: return "A person, device, or algorithm that has used approved criteria for filtered data for inclusion into the patient record.  Examples: (1) a medical records clerk who scans a document for inclusion in the medical record, enters header information, or catalogues and classifies the data, or a combination thereof; (2) a gateway that receives data from another computer system and interprets that data or changes its format, or both, before entering it into the patient record.";
+            case TRANS: return "An entity entering the data into the originating system. This includes the transcriptionist for dictated text transcribed into electronic form.";
+            case SOURCE: return "An automated data source that generates a signature along with content. Examples: (1) the signature for an image that is generated by a device for inclusion in the patient record; (2) the signature for an ECG derived by an ECG system for inclusion in the patient record; (3) the data from a biomedical monitoring device or system that is for inclusion in the patient record.";
+            case SPOWATT: return "A person who has been granted the authority to represent or act on another's behalf for a limited set of specific matters in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts. Examples include (1) exercising specific legal rights belonging to the grantee such as drafting a will; (2) performing specific legal duties on behalf of a grantee such as making a reversible mortgage to pay for end of life expenses; and (3) making specific legal decisions concerning a grantee such as managing a trust.";
+            case VALID: return "A person who validates a health information document for inclusion in the patient record. For example, a medical student or resident is credentialed to perform history or physical examinations and to write progress notes. The attending physician signs the history and physical examination to validate the entry for inclusion in the patient's medical record.";
+            case VERF: return "A person who asserts the correctness and appropriateness of an act or the recording of the act, and is accountable for the assertion that the act or the recording of the act complies with jurisdictional or organizational policy. For example, a physician is required to countersign a verbal order that has previously been recorded in the medical record by a registered nurse who has carried out the verbal order.";
+            case WIT: return "A person witnessing the signature of another party. A witness is not knowledgeable about the content being signed, much less approves of anything stated in the content. For example, an advanced directive witness or a witness that a party to a contract signed that certain demographic or financial information is truthful.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AMENDER: return "Amender";
+            case AUTHN: return "Authenticator";
+            case AUT: return "Author";
+            case AFFL: return "Affiliate";
+            case AGNT: return "Agent";
+            case ASSIGNED: return "Assigned Entity";
+            case CIT: return "Citizen";
+            case CLAIMANT: return "Claimant";
+            case COAUTH: return "Co-Author";
+            case CONSENTER: return "Consenter";
+            case CONSWIT: return "Consent Witness";
+            case CONT: return "Contact";
+            case COPART: return "Co-Participant";
+            case COVPTY: return "Covered Party";
+            case DELEGATEE: return "Delegatee";
+            case DELEGATOR: return "Delegator";
+            case DEPEND: return "Dependent";
+            case DPOWATT: return "Durable Power of Attorney";
+            case EMGCON: return "Emergency Contact";
+            case EVTWIT: return "Event Witness";
+            case EXCEST: return "Executor of Estate";
+            case GRANTEE: return "Grantee";
+            case GRANTOR: return "Grantor";
+            case GUAR: return "Guarantor";
+            case GUARD: return "Guardian";
+            case GUADLTM: return "Guardian ad lidem";
+            case INF: return "Informant";
+            case INTPRT: return "Interpreter";
+            case INSBJ: return "Investigation Subject";
+            case HPOWATT: return "Healthcare Power of Attorney";
+            case HPROV: return "Healthcare Provider";
+            case LEGAUTHN: return "Legal Authenticator";
+            case NMDINS: return "Named Insured";
+            case NOK: return "Next of Kin";
+            case NOTARY: return "Notary";
+            case PAT: return "Patient";
+            case POWATT: return "Power of Attorney";
+            case PRIMAUTH: return "Primary Author";
+            case PRIRECIP: return "Primary Responsible Party ";
+            case RECIP: return "Recipient";
+            case RESPRSN: return "Responsible Party";
+            case REVIEWER: return "Reviewer";
+            case TRANS: return "Transcriber";
+            case SOURCE: return "Source";
+            case SPOWATT: return "Apecial Power of Attorney";
+            case VALID: return "Validator";
+            case VERF: return "Verifier";
+            case WIT: return "Witness";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSignerTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSignerTypeEnumFactory.java
new file mode 100644
index 00000000000..eaf72b7f830
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSignerTypeEnumFactory.java
@@ -0,0 +1,246 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContractSignerTypeEnumFactory implements EnumFactory {
+
+  public ContractSignerType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AMENDER".equals(codeString))
+      return ContractSignerType.AMENDER;
+    if ("AUTHN".equals(codeString))
+      return ContractSignerType.AUTHN;
+    if ("AUT".equals(codeString))
+      return ContractSignerType.AUT;
+    if ("AFFL".equals(codeString))
+      return ContractSignerType.AFFL;
+    if ("AGNT".equals(codeString))
+      return ContractSignerType.AGNT;
+    if ("ASSIGNED".equals(codeString))
+      return ContractSignerType.ASSIGNED;
+    if ("CIT".equals(codeString))
+      return ContractSignerType.CIT;
+    if ("CLAIMANT".equals(codeString))
+      return ContractSignerType.CLAIMANT;
+    if ("COAUTH".equals(codeString))
+      return ContractSignerType.COAUTH;
+    if ("CONSENTER".equals(codeString))
+      return ContractSignerType.CONSENTER;
+    if ("CONSWIT".equals(codeString))
+      return ContractSignerType.CONSWIT;
+    if ("CONT".equals(codeString))
+      return ContractSignerType.CONT;
+    if ("COPART".equals(codeString))
+      return ContractSignerType.COPART;
+    if ("COVPTY".equals(codeString))
+      return ContractSignerType.COVPTY;
+    if ("DELEGATEE".equals(codeString))
+      return ContractSignerType.DELEGATEE;
+    if ("delegator".equals(codeString))
+      return ContractSignerType.DELEGATOR;
+    if ("DEPEND".equals(codeString))
+      return ContractSignerType.DEPEND;
+    if ("DPOWATT".equals(codeString))
+      return ContractSignerType.DPOWATT;
+    if ("EMGCON".equals(codeString))
+      return ContractSignerType.EMGCON;
+    if ("EVTWIT".equals(codeString))
+      return ContractSignerType.EVTWIT;
+    if ("EXCEST".equals(codeString))
+      return ContractSignerType.EXCEST;
+    if ("GRANTEE".equals(codeString))
+      return ContractSignerType.GRANTEE;
+    if ("GRANTOR".equals(codeString))
+      return ContractSignerType.GRANTOR;
+    if ("GUAR".equals(codeString))
+      return ContractSignerType.GUAR;
+    if ("GUARD".equals(codeString))
+      return ContractSignerType.GUARD;
+    if ("GUADLTM".equals(codeString))
+      return ContractSignerType.GUADLTM;
+    if ("INF".equals(codeString))
+      return ContractSignerType.INF;
+    if ("INTPRT".equals(codeString))
+      return ContractSignerType.INTPRT;
+    if ("INSBJ".equals(codeString))
+      return ContractSignerType.INSBJ;
+    if ("HPOWATT".equals(codeString))
+      return ContractSignerType.HPOWATT;
+    if ("HPROV".equals(codeString))
+      return ContractSignerType.HPROV;
+    if ("LEGAUTHN".equals(codeString))
+      return ContractSignerType.LEGAUTHN;
+    if ("NMDINS".equals(codeString))
+      return ContractSignerType.NMDINS;
+    if ("NOK".equals(codeString))
+      return ContractSignerType.NOK;
+    if ("NOTARY".equals(codeString))
+      return ContractSignerType.NOTARY;
+    if ("PAT".equals(codeString))
+      return ContractSignerType.PAT;
+    if ("POWATT".equals(codeString))
+      return ContractSignerType.POWATT;
+    if ("PRIMAUTH".equals(codeString))
+      return ContractSignerType.PRIMAUTH;
+    if ("PRIRECIP".equals(codeString))
+      return ContractSignerType.PRIRECIP;
+    if ("RECIP".equals(codeString))
+      return ContractSignerType.RECIP;
+    if ("RESPRSN".equals(codeString))
+      return ContractSignerType.RESPRSN;
+    if ("REVIEWER".equals(codeString))
+      return ContractSignerType.REVIEWER;
+    if ("TRANS".equals(codeString))
+      return ContractSignerType.TRANS;
+    if ("SOURCE".equals(codeString))
+      return ContractSignerType.SOURCE;
+    if ("SPOWATT".equals(codeString))
+      return ContractSignerType.SPOWATT;
+    if ("VALID".equals(codeString))
+      return ContractSignerType.VALID;
+    if ("VERF".equals(codeString))
+      return ContractSignerType.VERF;
+    if ("WIT".equals(codeString))
+      return ContractSignerType.WIT;
+    throw new IllegalArgumentException("Unknown ContractSignerType code '"+codeString+"'");
+  }
+
+  public String toCode(ContractSignerType code) {
+    if (code == ContractSignerType.AMENDER)
+      return "AMENDER";
+    if (code == ContractSignerType.AUTHN)
+      return "AUTHN";
+    if (code == ContractSignerType.AUT)
+      return "AUT";
+    if (code == ContractSignerType.AFFL)
+      return "AFFL";
+    if (code == ContractSignerType.AGNT)
+      return "AGNT";
+    if (code == ContractSignerType.ASSIGNED)
+      return "ASSIGNED";
+    if (code == ContractSignerType.CIT)
+      return "CIT";
+    if (code == ContractSignerType.CLAIMANT)
+      return "CLAIMANT";
+    if (code == ContractSignerType.COAUTH)
+      return "COAUTH";
+    if (code == ContractSignerType.CONSENTER)
+      return "CONSENTER";
+    if (code == ContractSignerType.CONSWIT)
+      return "CONSWIT";
+    if (code == ContractSignerType.CONT)
+      return "CONT";
+    if (code == ContractSignerType.COPART)
+      return "COPART";
+    if (code == ContractSignerType.COVPTY)
+      return "COVPTY";
+    if (code == ContractSignerType.DELEGATEE)
+      return "DELEGATEE";
+    if (code == ContractSignerType.DELEGATOR)
+      return "delegator";
+    if (code == ContractSignerType.DEPEND)
+      return "DEPEND";
+    if (code == ContractSignerType.DPOWATT)
+      return "DPOWATT";
+    if (code == ContractSignerType.EMGCON)
+      return "EMGCON";
+    if (code == ContractSignerType.EVTWIT)
+      return "EVTWIT";
+    if (code == ContractSignerType.EXCEST)
+      return "EXCEST";
+    if (code == ContractSignerType.GRANTEE)
+      return "GRANTEE";
+    if (code == ContractSignerType.GRANTOR)
+      return "GRANTOR";
+    if (code == ContractSignerType.GUAR)
+      return "GUAR";
+    if (code == ContractSignerType.GUARD)
+      return "GUARD";
+    if (code == ContractSignerType.GUADLTM)
+      return "GUADLTM";
+    if (code == ContractSignerType.INF)
+      return "INF";
+    if (code == ContractSignerType.INTPRT)
+      return "INTPRT";
+    if (code == ContractSignerType.INSBJ)
+      return "INSBJ";
+    if (code == ContractSignerType.HPOWATT)
+      return "HPOWATT";
+    if (code == ContractSignerType.HPROV)
+      return "HPROV";
+    if (code == ContractSignerType.LEGAUTHN)
+      return "LEGAUTHN";
+    if (code == ContractSignerType.NMDINS)
+      return "NMDINS";
+    if (code == ContractSignerType.NOK)
+      return "NOK";
+    if (code == ContractSignerType.NOTARY)
+      return "NOTARY";
+    if (code == ContractSignerType.PAT)
+      return "PAT";
+    if (code == ContractSignerType.POWATT)
+      return "POWATT";
+    if (code == ContractSignerType.PRIMAUTH)
+      return "PRIMAUTH";
+    if (code == ContractSignerType.PRIRECIP)
+      return "PRIRECIP";
+    if (code == ContractSignerType.RECIP)
+      return "RECIP";
+    if (code == ContractSignerType.RESPRSN)
+      return "RESPRSN";
+    if (code == ContractSignerType.REVIEWER)
+      return "REVIEWER";
+    if (code == ContractSignerType.TRANS)
+      return "TRANS";
+    if (code == ContractSignerType.SOURCE)
+      return "SOURCE";
+    if (code == ContractSignerType.SPOWATT)
+      return "SPOWATT";
+    if (code == ContractSignerType.VALID)
+      return "VALID";
+    if (code == ContractSignerType.VERF)
+      return "VERF";
+    if (code == ContractSignerType.WIT)
+      return "WIT";
+    return "?";
+  }
+
+    public String toSystem(ContractSignerType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractStatus.java
new file mode 100644
index 00000000000..a49d96300a9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractStatus.java
@@ -0,0 +1,204 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContractStatus {
+
+        /**
+         * Contract is augmented with additional information to correct errors in a predecessor or to updated values in a predecessor. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: revised; replaced.
+         */
+        AMENDED, 
+        /**
+         * Contract is augmented with additional information that was missing from a predecessor Contract. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: updated, replaced.
+         */
+        APPENDED, 
+        /**
+         * Contract is terminated due to failure of the Grantor and/or the Grantee to fulfil one or more contract provisions. Usage: Abnormal contract termination. Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed; aborted.
+         */
+        CANCELLED, 
+        /**
+         * Contract is pended to rectify failure of the Grantor or the Grantee to fulfil contract provision(s). E.g., Grantee complaint about Grantor's failure to comply with contract provisions. Usage: Contract pended. Precedence Order = 7.Comparable FHIR and v.3 status codes: on hold; pended; suspended.
+         */
+        DISPUTED, 
+        /**
+         * Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.
+         */
+        ENTEREDINERROR, 
+        /**
+         * Contract execution pending; may be executed when either the Grantor or the Grantee accepts the contract provisions by signing. I.e., where either the Grantor or the Grantee has signed, but not both. E.g., when an insurance applicant signs the insurers application, which references the policy. Usage: Optional first step of contract execution activity.  May be skipped and contracting activity moves directly to executed state. Precedence Order = 3. Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended; active.
+         */
+        EXECUTABLE, 
+        /**
+         * Contract is activated for period stipulated when both the Grantor and Grantee have signed it. Usage: Required state for normal completion of contracting activity.  Precedence Order = 6. Comparable FHIR and v.3 status codes: accepted; completed.
+         */
+        EXECUTED, 
+        /**
+         * Contract execution is suspended while either or both the Grantor and Grantee propose and consider new or revised contract provisions. I.e., where the party which has not signed proposes changes to the terms.  E .g., a life insurer declines to agree to the signed application because the life insurer has evidence that the applicant, who asserted to being younger or a non-smoker to get a lower premium rate - but offers instead to agree to a higher premium based on the applicants actual age or smoking status. Usage: Optional contract activity between executable and executed state. Precedence Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.
+         */
+        NEGOTIABLE, 
+        /**
+         * Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract hard copy or electronic 'template','form' or 'application'. E.g., health insurance application; consent directive form. Usage: Beginning of contract negotiation, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes: requested; new.
+         */
+        OFFERED, 
+        /**
+         * Contract template is available as the basis for an application or offer by the Grantor or Grantee. E.g., health insurance policy; consent directive policy.  Usage: Required initial contract activity, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 1. Comparable FHIR and v.3 status codes: proposed; intended.
+         */
+        POLICY, 
+        /**
+         *  Execution of the Contract is not completed because either or both the Grantor and Grantee decline to accept some or all of the contract provisions. Usage: Optional contract activity between executable and abnormal termination. Precedence Order = 5. Comparable FHIR and v.3 status codes:  stopped; cancelled.
+         */
+        REJECTED, 
+        /**
+         * Beginning of a successor Contract at the termination of predecessor Contract lifecycle. Usage: Follows termination of a preceding Contract that has reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3 status codes: superseded.
+         */
+        RENEWED, 
+        /**
+         * A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.
+         */
+        REVOKED, 
+        /**
+         * Contract is reactivated after being pended because of faulty execution. *E.g., competency of the signer(s), or where the policy is substantially different from and did not accompany the application/form so that the applicant could not compare them. Aka - ''reactivated''. Usage: Optional stage where a pended contract is reactivated. Precedence Order = 8. Comparable FHIR and v.3 status codes: reactivated.
+         */
+        RESOLVED, 
+        /**
+         * Contract reaches its expiry date. It may or may not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.
+         */
+        TERMINATED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContractStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("amended".equals(codeString))
+          return AMENDED;
+        if ("appended".equals(codeString))
+          return APPENDED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("disputed".equals(codeString))
+          return DISPUTED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("executable".equals(codeString))
+          return EXECUTABLE;
+        if ("executed".equals(codeString))
+          return EXECUTED;
+        if ("negotiable".equals(codeString))
+          return NEGOTIABLE;
+        if ("offered".equals(codeString))
+          return OFFERED;
+        if ("policy".equals(codeString))
+          return POLICY;
+        if ("rejected".equals(codeString))
+          return REJECTED;
+        if ("renewed".equals(codeString))
+          return RENEWED;
+        if ("revoked".equals(codeString))
+          return REVOKED;
+        if ("resolved".equals(codeString))
+          return RESOLVED;
+        if ("terminated".equals(codeString))
+          return TERMINATED;
+        throw new FHIRException("Unknown ContractStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AMENDED: return "amended";
+            case APPENDED: return "appended";
+            case CANCELLED: return "cancelled";
+            case DISPUTED: return "disputed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case EXECUTABLE: return "executable";
+            case EXECUTED: return "executed";
+            case NEGOTIABLE: return "negotiable";
+            case OFFERED: return "offered";
+            case POLICY: return "policy";
+            case REJECTED: return "rejected";
+            case RENEWED: return "renewed";
+            case REVOKED: return "revoked";
+            case RESOLVED: return "resolved";
+            case TERMINATED: return "terminated";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contract-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AMENDED: return "Contract is augmented with additional information to correct errors in a predecessor or to updated values in a predecessor. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: revised; replaced.";
+            case APPENDED: return "Contract is augmented with additional information that was missing from a predecessor Contract. Usage: Contract altered within effective time. Precedence Order = 9. Comparable FHIR and v.3 status codes: updated, replaced.";
+            case CANCELLED: return "Contract is terminated due to failure of the Grantor and/or the Grantee to fulfil one or more contract provisions. Usage: Abnormal contract termination. Precedence Order = 10. Comparable FHIR and v.3 status codes: stopped; failed; aborted.";
+            case DISPUTED: return "Contract is pended to rectify failure of the Grantor or the Grantee to fulfil contract provision(s). E.g., Grantee complaint about Grantor's failure to comply with contract provisions. Usage: Contract pended. Precedence Order = 7.Comparable FHIR and v.3 status codes: on hold; pended; suspended.";
+            case ENTEREDINERROR: return "Contract was created in error. No Precedence Order.  Status may be applied to a Contract with any status.";
+            case EXECUTABLE: return "Contract execution pending; may be executed when either the Grantor or the Grantee accepts the contract provisions by signing. I.e., where either the Grantor or the Grantee has signed, but not both. E.g., when an insurance applicant signs the insurers application, which references the policy. Usage: Optional first step of contract execution activity.  May be skipped and contracting activity moves directly to executed state. Precedence Order = 3. Comparable FHIR and v.3 status codes: draft; preliminary; planned; intended; active.";
+            case EXECUTED: return "Contract is activated for period stipulated when both the Grantor and Grantee have signed it. Usage: Required state for normal completion of contracting activity.  Precedence Order = 6. Comparable FHIR and v.3 status codes: accepted; completed.";
+            case NEGOTIABLE: return "Contract execution is suspended while either or both the Grantor and Grantee propose and consider new or revised contract provisions. I.e., where the party which has not signed proposes changes to the terms.  E .g., a life insurer declines to agree to the signed application because the life insurer has evidence that the applicant, who asserted to being younger or a non-smoker to get a lower premium rate - but offers instead to agree to a higher premium based on the applicants actual age or smoking status. Usage: Optional contract activity between executable and executed state. Precedence Order = 4. Comparable FHIR and v.3 status codes: in progress; review; held.";
+            case OFFERED: return "Contract is a proposal by either the Grantor or the Grantee. Aka - A Contract hard copy or electronic 'template','form' or 'application'. E.g., health insurance application; consent directive form. Usage: Beginning of contract negotiation, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 2. Comparable FHIR and v.3 status codes: requested; new.";
+            case POLICY: return "Contract template is available as the basis for an application or offer by the Grantor or Grantee. E.g., health insurance policy; consent directive policy.  Usage: Required initial contract activity, which may have been completed as a precondition because used for 0..* contracts. Precedence Order = 1. Comparable FHIR and v.3 status codes: proposed; intended.";
+            case REJECTED: return " Execution of the Contract is not completed because either or both the Grantor and Grantee decline to accept some or all of the contract provisions. Usage: Optional contract activity between executable and abnormal termination. Precedence Order = 5. Comparable FHIR and v.3 status codes:  stopped; cancelled.";
+            case RENEWED: return "Beginning of a successor Contract at the termination of predecessor Contract lifecycle. Usage: Follows termination of a preceding Contract that has reached its expiry date. Precedence Order = 13. Comparable FHIR and v.3 status codes: superseded.";
+            case REVOKED: return "A Contract that is rescinded.  May be required prior to replacing with an updated Contract. Comparable FHIR and v.3 status codes: nullified.";
+            case RESOLVED: return "Contract is reactivated after being pended because of faulty execution. *E.g., competency of the signer(s), or where the policy is substantially different from and did not accompany the application/form so that the applicant could not compare them. Aka - ''reactivated''. Usage: Optional stage where a pended contract is reactivated. Precedence Order = 8. Comparable FHIR and v.3 status codes: reactivated.";
+            case TERMINATED: return "Contract reaches its expiry date. It may or may not be renewed or renegotiated. Usage: Normal end of contract period. Precedence Order = 12. Comparable FHIR and v.3 status codes: Obsoleted.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AMENDED: return "Amended";
+            case APPENDED: return "Appended";
+            case CANCELLED: return "Cancelled";
+            case DISPUTED: return "Disputed";
+            case ENTEREDINERROR: return "Entered in Error";
+            case EXECUTABLE: return "Executable";
+            case EXECUTED: return "Executed";
+            case NEGOTIABLE: return "Negotiable";
+            case OFFERED: return "Offered";
+            case POLICY: return "Policy";
+            case REJECTED: return "Rejected";
+            case RENEWED: return "Renewed";
+            case REVOKED: return "Revoked";
+            case RESOLVED: return "Resolved";
+            case TERMINATED: return "Terminated";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractStatusEnumFactory.java
new file mode 100644
index 00000000000..736ff10a93a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractStatusEnumFactory.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContractStatusEnumFactory implements EnumFactory {
+
+  public ContractStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("amended".equals(codeString))
+      return ContractStatus.AMENDED;
+    if ("appended".equals(codeString))
+      return ContractStatus.APPENDED;
+    if ("cancelled".equals(codeString))
+      return ContractStatus.CANCELLED;
+    if ("disputed".equals(codeString))
+      return ContractStatus.DISPUTED;
+    if ("entered-in-error".equals(codeString))
+      return ContractStatus.ENTEREDINERROR;
+    if ("executable".equals(codeString))
+      return ContractStatus.EXECUTABLE;
+    if ("executed".equals(codeString))
+      return ContractStatus.EXECUTED;
+    if ("negotiable".equals(codeString))
+      return ContractStatus.NEGOTIABLE;
+    if ("offered".equals(codeString))
+      return ContractStatus.OFFERED;
+    if ("policy".equals(codeString))
+      return ContractStatus.POLICY;
+    if ("rejected".equals(codeString))
+      return ContractStatus.REJECTED;
+    if ("renewed".equals(codeString))
+      return ContractStatus.RENEWED;
+    if ("revoked".equals(codeString))
+      return ContractStatus.REVOKED;
+    if ("resolved".equals(codeString))
+      return ContractStatus.RESOLVED;
+    if ("terminated".equals(codeString))
+      return ContractStatus.TERMINATED;
+    throw new IllegalArgumentException("Unknown ContractStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ContractStatus code) {
+    if (code == ContractStatus.AMENDED)
+      return "amended";
+    if (code == ContractStatus.APPENDED)
+      return "appended";
+    if (code == ContractStatus.CANCELLED)
+      return "cancelled";
+    if (code == ContractStatus.DISPUTED)
+      return "disputed";
+    if (code == ContractStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == ContractStatus.EXECUTABLE)
+      return "executable";
+    if (code == ContractStatus.EXECUTED)
+      return "executed";
+    if (code == ContractStatus.NEGOTIABLE)
+      return "negotiable";
+    if (code == ContractStatus.OFFERED)
+      return "offered";
+    if (code == ContractStatus.POLICY)
+      return "policy";
+    if (code == ContractStatus.REJECTED)
+      return "rejected";
+    if (code == ContractStatus.RENEWED)
+      return "renewed";
+    if (code == ContractStatus.REVOKED)
+      return "revoked";
+    if (code == ContractStatus.RESOLVED)
+      return "resolved";
+    if (code == ContractStatus.TERMINATED)
+      return "terminated";
+    return "?";
+  }
+
+    public String toSystem(ContractStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSubtype.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSubtype.java
new file mode 100644
index 00000000000..c98bfd63c3c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSubtype.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContractSubtype {
+
+        /**
+         * Canadian health information displosure policy.
+         */
+        DISCLOSURECA, 
+        /**
+         * United States health information displosure policy.
+         */
+        DISCLOSUREUS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContractSubtype fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("disclosure-ca".equals(codeString))
+          return DISCLOSURECA;
+        if ("disclosure-us".equals(codeString))
+          return DISCLOSUREUS;
+        throw new FHIRException("Unknown ContractSubtype code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DISCLOSURECA: return "disclosure-ca";
+            case DISCLOSUREUS: return "disclosure-us";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contractsubtypecodes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DISCLOSURECA: return "Canadian health information displosure policy.";
+            case DISCLOSUREUS: return "United States health information displosure policy.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DISCLOSURECA: return "Disclosure-CA";
+            case DISCLOSUREUS: return "Disclosure-US";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSubtypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSubtypeEnumFactory.java
new file mode 100644
index 00000000000..67b22387745
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractSubtypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContractSubtypeEnumFactory implements EnumFactory {
+
+  public ContractSubtype fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("disclosure-ca".equals(codeString))
+      return ContractSubtype.DISCLOSURECA;
+    if ("disclosure-us".equals(codeString))
+      return ContractSubtype.DISCLOSUREUS;
+    throw new IllegalArgumentException("Unknown ContractSubtype code '"+codeString+"'");
+  }
+
+  public String toCode(ContractSubtype code) {
+    if (code == ContractSubtype.DISCLOSURECA)
+      return "disclosure-ca";
+    if (code == ContractSubtype.DISCLOSUREUS)
+      return "disclosure-us";
+    return "?";
+  }
+
+    public String toSystem(ContractSubtype code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermSubtype.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermSubtype.java
new file mode 100644
index 00000000000..da94d0aa891
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermSubtype.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContractTermSubtype {
+
+        /**
+         * Terms that go to the very root of a contract.
+         */
+        CONDITION, 
+        /**
+         * Less imperative than a condition, so the contract will survive a breach
+         */
+        WARRANTY, 
+        /**
+         * Breach of which may or may not go to the root of the contract depending upon the nature of the breach
+         */
+        INNOMINATE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContractTermSubtype fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("condition".equals(codeString))
+          return CONDITION;
+        if ("warranty".equals(codeString))
+          return WARRANTY;
+        if ("innominate".equals(codeString))
+          return INNOMINATE;
+        throw new FHIRException("Unknown ContractTermSubtype code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CONDITION: return "condition";
+            case WARRANTY: return "warranty";
+            case INNOMINATE: return "innominate";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contracttermsubtypecodes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CONDITION: return "Terms that go to the very root of a contract.";
+            case WARRANTY: return "Less imperative than a condition, so the contract will survive a breach";
+            case INNOMINATE: return "Breach of which may or may not go to the root of the contract depending upon the nature of the breach";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CONDITION: return "Condition";
+            case WARRANTY: return "Warranty";
+            case INNOMINATE: return "Innominate";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermSubtypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermSubtypeEnumFactory.java
new file mode 100644
index 00000000000..8c01e9b0f61
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermSubtypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContractTermSubtypeEnumFactory implements EnumFactory {
+
+  public ContractTermSubtype fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("condition".equals(codeString))
+      return ContractTermSubtype.CONDITION;
+    if ("warranty".equals(codeString))
+      return ContractTermSubtype.WARRANTY;
+    if ("innominate".equals(codeString))
+      return ContractTermSubtype.INNOMINATE;
+    throw new IllegalArgumentException("Unknown ContractTermSubtype code '"+codeString+"'");
+  }
+
+  public String toCode(ContractTermSubtype code) {
+    if (code == ContractTermSubtype.CONDITION)
+      return "condition";
+    if (code == ContractTermSubtype.WARRANTY)
+      return "warranty";
+    if (code == ContractTermSubtype.INNOMINATE)
+      return "innominate";
+    return "?";
+  }
+
+    public String toSystem(ContractTermSubtype code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermType.java
new file mode 100644
index 00000000000..9cc505f34c1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContractTermType {
+
+        /**
+         * Based on specialized statutes that deal with particular subjects.
+         */
+        STATUTORY, 
+        /**
+         * Execution of the term in the contract is conditional on the execution of other actions.
+         */
+        SUBJECTTO, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContractTermType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("statutory".equals(codeString))
+          return STATUTORY;
+        if ("subject-to".equals(codeString))
+          return SUBJECTTO;
+        throw new FHIRException("Unknown ContractTermType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case STATUTORY: return "statutory";
+            case SUBJECTTO: return "subject-to";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contracttermtypecodes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case STATUTORY: return "Based on specialized statutes that deal with particular subjects.";
+            case SUBJECTTO: return "Execution of the term in the contract is conditional on the execution of other actions.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case STATUTORY: return "Statutory";
+            case SUBJECTTO: return "Subject To";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermTypeEnumFactory.java
new file mode 100644
index 00000000000..ac313046dca
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTermTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContractTermTypeEnumFactory implements EnumFactory {
+
+  public ContractTermType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("statutory".equals(codeString))
+      return ContractTermType.STATUTORY;
+    if ("subject-to".equals(codeString))
+      return ContractTermType.SUBJECTTO;
+    throw new IllegalArgumentException("Unknown ContractTermType code '"+codeString+"'");
+  }
+
+  public String toCode(ContractTermType code) {
+    if (code == ContractTermType.STATUTORY)
+      return "statutory";
+    if (code == ContractTermType.SUBJECTTO)
+      return "subject-to";
+    return "?";
+  }
+
+    public String toSystem(ContractTermType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractType.java
new file mode 100644
index 00000000000..2f85db18763
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContractType {
+
+        /**
+         * Privacy policy.
+         */
+        PRIVACY, 
+        /**
+         * Information disclosure policy.
+         */
+        DISCLOSURE, 
+        /**
+         * Health Insurance policy.
+         */
+        HEALTHINSURANCE, 
+        /**
+         * Contract to supply goods or services.
+         */
+        SUPPLY, 
+        /**
+         * Consent Directive.
+         */
+        CONSENT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContractType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("privacy".equals(codeString))
+          return PRIVACY;
+        if ("disclosure".equals(codeString))
+          return DISCLOSURE;
+        if ("healthinsurance".equals(codeString))
+          return HEALTHINSURANCE;
+        if ("supply".equals(codeString))
+          return SUPPLY;
+        if ("consent".equals(codeString))
+          return CONSENT;
+        throw new FHIRException("Unknown ContractType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PRIVACY: return "privacy";
+            case DISCLOSURE: return "disclosure";
+            case HEALTHINSURANCE: return "healthinsurance";
+            case SUPPLY: return "supply";
+            case CONSENT: return "consent";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contracttypecodes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PRIVACY: return "Privacy policy.";
+            case DISCLOSURE: return "Information disclosure policy.";
+            case HEALTHINSURANCE: return "Health Insurance policy.";
+            case SUPPLY: return "Contract to supply goods or services.";
+            case CONSENT: return "Consent Directive.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PRIVACY: return "Privacy";
+            case DISCLOSURE: return "Disclosure";
+            case HEALTHINSURANCE: return "Health Insurance";
+            case SUPPLY: return "Supply Contract";
+            case CONSENT: return "Consent";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTypeEnumFactory.java
new file mode 100644
index 00000000000..c98ab5370fe
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContractTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContractTypeEnumFactory implements EnumFactory {
+
+  public ContractType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("privacy".equals(codeString))
+      return ContractType.PRIVACY;
+    if ("disclosure".equals(codeString))
+      return ContractType.DISCLOSURE;
+    if ("healthinsurance".equals(codeString))
+      return ContractType.HEALTHINSURANCE;
+    if ("supply".equals(codeString))
+      return ContractType.SUPPLY;
+    if ("consent".equals(codeString))
+      return ContractType.CONSENT;
+    throw new IllegalArgumentException("Unknown ContractType code '"+codeString+"'");
+  }
+
+  public String toCode(ContractType code) {
+    if (code == ContractType.PRIVACY)
+      return "privacy";
+    if (code == ContractType.DISCLOSURE)
+      return "disclosure";
+    if (code == ContractType.HEALTHINSURANCE)
+      return "healthinsurance";
+    if (code == ContractType.SUPPLY)
+      return "supply";
+    if (code == ContractType.CONSENT)
+      return "consent";
+    return "?";
+  }
+
+    public String toSystem(ContractType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContributorType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContributorType.java
new file mode 100644
index 00000000000..f3440a8d43f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContributorType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ContributorType {
+
+        /**
+         * An author of the content of the module
+         */
+        AUTHOR, 
+        /**
+         * An editor of the content of the module
+         */
+        EDITOR, 
+        /**
+         * A reviewer of the content of the module
+         */
+        REVIEWER, 
+        /**
+         * An endorser of the content of the module
+         */
+        ENDORSER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ContributorType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("author".equals(codeString))
+          return AUTHOR;
+        if ("editor".equals(codeString))
+          return EDITOR;
+        if ("reviewer".equals(codeString))
+          return REVIEWER;
+        if ("endorser".equals(codeString))
+          return ENDORSER;
+        throw new FHIRException("Unknown ContributorType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AUTHOR: return "author";
+            case EDITOR: return "editor";
+            case REVIEWER: return "reviewer";
+            case ENDORSER: return "endorser";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/contributor-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AUTHOR: return "An author of the content of the module";
+            case EDITOR: return "An editor of the content of the module";
+            case REVIEWER: return "A reviewer of the content of the module";
+            case ENDORSER: return "An endorser of the content of the module";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AUTHOR: return "Author";
+            case EDITOR: return "Editor";
+            case REVIEWER: return "Reviewer";
+            case ENDORSER: return "Endorser";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContributorTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContributorTypeEnumFactory.java
new file mode 100644
index 00000000000..88aae404c94
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ContributorTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ContributorTypeEnumFactory implements EnumFactory {
+
+  public ContributorType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("author".equals(codeString))
+      return ContributorType.AUTHOR;
+    if ("editor".equals(codeString))
+      return ContributorType.EDITOR;
+    if ("reviewer".equals(codeString))
+      return ContributorType.REVIEWER;
+    if ("endorser".equals(codeString))
+      return ContributorType.ENDORSER;
+    throw new IllegalArgumentException("Unknown ContributorType code '"+codeString+"'");
+  }
+
+  public String toCode(ContributorType code) {
+    if (code == ContributorType.AUTHOR)
+      return "author";
+    if (code == ContributorType.EDITOR)
+      return "editor";
+    if (code == ContributorType.REVIEWER)
+      return "reviewer";
+    if (code == ContributorType.ENDORSER)
+      return "endorser";
+    return "?";
+  }
+
+    public String toSystem(ContributorType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CopyNumberEvent.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CopyNumberEvent.java
new file mode 100644
index 00000000000..84b3b7ad75d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CopyNumberEvent.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CopyNumberEvent {
+
+        /**
+         * amplificaiton
+         */
+        AMP, 
+        /**
+         * deletion
+         */
+        DEL, 
+        /**
+         * loss of function
+         */
+        LOF, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CopyNumberEvent fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("amp".equals(codeString))
+          return AMP;
+        if ("del".equals(codeString))
+          return DEL;
+        if ("lof".equals(codeString))
+          return LOF;
+        throw new FHIRException("Unknown CopyNumberEvent code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AMP: return "amp";
+            case DEL: return "del";
+            case LOF: return "lof";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/copy-number-event";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AMP: return "amplificaiton";
+            case DEL: return "deletion";
+            case LOF: return "loss of function";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AMP: return "amplificaiton";
+            case DEL: return "deletion";
+            case LOF: return "loss of function";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CopyNumberEventEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CopyNumberEventEnumFactory.java
new file mode 100644
index 00000000000..8bc39dbd073
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CopyNumberEventEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CopyNumberEventEnumFactory implements EnumFactory {
+
+  public CopyNumberEvent fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("amp".equals(codeString))
+      return CopyNumberEvent.AMP;
+    if ("del".equals(codeString))
+      return CopyNumberEvent.DEL;
+    if ("lof".equals(codeString))
+      return CopyNumberEvent.LOF;
+    throw new IllegalArgumentException("Unknown CopyNumberEvent code '"+codeString+"'");
+  }
+
+  public String toCode(CopyNumberEvent code) {
+    if (code == CopyNumberEvent.AMP)
+      return "amp";
+    if (code == CopyNumberEvent.DEL)
+      return "del";
+    if (code == CopyNumberEvent.LOF)
+      return "lof";
+    return "?";
+  }
+
+    public String toSystem(CopyNumberEvent code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageException.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageException.java
new file mode 100644
index 00000000000..1eb18e3cbc4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageException.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CoverageException {
+
+        /**
+         * Fulltime Student
+         */
+        STUDENT, 
+        /**
+         * Disabled
+         */
+        DISABLED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CoverageException fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("student".equals(codeString))
+          return STUDENT;
+        if ("disabled".equals(codeString))
+          return DISABLED;
+        throw new FHIRException("Unknown CoverageException code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case STUDENT: return "student";
+            case DISABLED: return "disabled";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/coverage-exception";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case STUDENT: return "Fulltime Student";
+            case DISABLED: return "Disabled";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case STUDENT: return "Student (Fulltime)";
+            case DISABLED: return "Disabled";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageExceptionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageExceptionEnumFactory.java
new file mode 100644
index 00000000000..00c17770937
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageExceptionEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CoverageExceptionEnumFactory implements EnumFactory {
+
+  public CoverageException fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("student".equals(codeString))
+      return CoverageException.STUDENT;
+    if ("disabled".equals(codeString))
+      return CoverageException.DISABLED;
+    throw new IllegalArgumentException("Unknown CoverageException code '"+codeString+"'");
+  }
+
+  public String toCode(CoverageException code) {
+    if (code == CoverageException.STUDENT)
+      return "student";
+    if (code == CoverageException.DISABLED)
+      return "disabled";
+    return "?";
+  }
+
+    public String toSystem(CoverageException code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageLevel.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageLevel.java
new file mode 100644
index 00000000000..fab0a6d426e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageLevel.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CoverageLevel {
+
+        /**
+         * An employee group
+         */
+        GROUP, 
+        /**
+         * A sub-group of an employee group
+         */
+        SUBGROUP, 
+        /**
+         * A specific suite of benefits.
+         */
+        PLAN, 
+        /**
+         * A subset of a specific suite of benefits.
+         */
+        SUBPLAN, 
+        /**
+         * A class of benefits.
+         */
+        CLASS, 
+        /**
+         * A subset of a class of benefits.
+         */
+        SUBCLASS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CoverageLevel fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("group".equals(codeString))
+          return GROUP;
+        if ("subgroup".equals(codeString))
+          return SUBGROUP;
+        if ("plan".equals(codeString))
+          return PLAN;
+        if ("subplan".equals(codeString))
+          return SUBPLAN;
+        if ("class".equals(codeString))
+          return CLASS;
+        if ("subclass".equals(codeString))
+          return SUBCLASS;
+        throw new FHIRException("Unknown CoverageLevel code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GROUP: return "group";
+            case SUBGROUP: return "subgroup";
+            case PLAN: return "plan";
+            case SUBPLAN: return "subplan";
+            case CLASS: return "class";
+            case SUBCLASS: return "subclass";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/coverage-level";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GROUP: return "An employee group";
+            case SUBGROUP: return "A sub-group of an employee group";
+            case PLAN: return "A specific suite of benefits.";
+            case SUBPLAN: return "A subset of a specific suite of benefits.";
+            case CLASS: return "A class of benefits.";
+            case SUBCLASS: return "A subset of a class of benefits.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GROUP: return "Group";
+            case SUBGROUP: return "SubGroup";
+            case PLAN: return "Plan";
+            case SUBPLAN: return "SubPlan";
+            case CLASS: return "Class";
+            case SUBCLASS: return "SubClass";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageLevelEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageLevelEnumFactory.java
new file mode 100644
index 00000000000..5677b670678
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageLevelEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CoverageLevelEnumFactory implements EnumFactory {
+
+  public CoverageLevel fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("group".equals(codeString))
+      return CoverageLevel.GROUP;
+    if ("subgroup".equals(codeString))
+      return CoverageLevel.SUBGROUP;
+    if ("plan".equals(codeString))
+      return CoverageLevel.PLAN;
+    if ("subplan".equals(codeString))
+      return CoverageLevel.SUBPLAN;
+    if ("class".equals(codeString))
+      return CoverageLevel.CLASS;
+    if ("subclass".equals(codeString))
+      return CoverageLevel.SUBCLASS;
+    throw new IllegalArgumentException("Unknown CoverageLevel code '"+codeString+"'");
+  }
+
+  public String toCode(CoverageLevel code) {
+    if (code == CoverageLevel.GROUP)
+      return "group";
+    if (code == CoverageLevel.SUBGROUP)
+      return "subgroup";
+    if (code == CoverageLevel.PLAN)
+      return "plan";
+    if (code == CoverageLevel.SUBPLAN)
+      return "subplan";
+    if (code == CoverageLevel.CLASS)
+      return "class";
+    if (code == CoverageLevel.SUBCLASS)
+      return "subclass";
+    return "?";
+  }
+
+    public String toSystem(CoverageLevel code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageSelfpay.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageSelfpay.java
new file mode 100644
index 00000000000..e77794b23fe
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageSelfpay.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CoverageSelfpay {
+
+        /**
+         * An individual or oraganization is paying directly for goods and services.
+         */
+        PAY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CoverageSelfpay fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("pay".equals(codeString))
+          return PAY;
+        throw new FHIRException("Unknown CoverageSelfpay code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PAY: return "pay";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/coverage-selfpay";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PAY: return "An individual or oraganization is paying directly for goods and services.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PAY: return "Pay";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageSelfpayEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageSelfpayEnumFactory.java
new file mode 100644
index 00000000000..3ba2134972d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageSelfpayEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CoverageSelfpayEnumFactory implements EnumFactory {
+
+  public CoverageSelfpay fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("pay".equals(codeString))
+      return CoverageSelfpay.PAY;
+    throw new IllegalArgumentException("Unknown CoverageSelfpay code '"+codeString+"'");
+  }
+
+  public String toCode(CoverageSelfpay code) {
+    if (code == CoverageSelfpay.PAY)
+      return "pay";
+    return "?";
+  }
+
+    public String toSystem(CoverageSelfpay code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageStatus.java
new file mode 100644
index 00000000000..2a0fa40ff7f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CoverageStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CoverageStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown CoverageStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/coverage-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageStatusEnumFactory.java
new file mode 100644
index 00000000000..315c81dfc54
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CoverageStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CoverageStatusEnumFactory implements EnumFactory {
+
+  public CoverageStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return CoverageStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return CoverageStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return CoverageStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return CoverageStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown CoverageStatus code '"+codeString+"'");
+  }
+
+  public String toCode(CoverageStatus code) {
+    if (code == CoverageStatus.ACTIVE)
+      return "active";
+    if (code == CoverageStatus.CANCELLED)
+      return "cancelled";
+    if (code == CoverageStatus.DRAFT)
+      return "draft";
+    if (code == CoverageStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(CoverageStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifEvidenceQuality.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifEvidenceQuality.java
new file mode 100644
index 00000000000..e92b1411f74
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifEvidenceQuality.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CqifEvidenceQuality {
+
+        /**
+         * High quality evidence
+         */
+        HIGH, 
+        /**
+         * Moderate quality evidence
+         */
+        MODERATE, 
+        /**
+         * Low quality evidence
+         */
+        LOW, 
+        /**
+         * Very low quality evidence
+         */
+        VERYLOW, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CqifEvidenceQuality fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("high".equals(codeString))
+          return HIGH;
+        if ("moderate".equals(codeString))
+          return MODERATE;
+        if ("low".equals(codeString))
+          return LOW;
+        if ("very-low".equals(codeString))
+          return VERYLOW;
+        throw new FHIRException("Unknown CqifEvidenceQuality code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HIGH: return "high";
+            case MODERATE: return "moderate";
+            case LOW: return "low";
+            case VERYLOW: return "very-low";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/evidence-quality";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HIGH: return "High quality evidence";
+            case MODERATE: return "Moderate quality evidence";
+            case LOW: return "Low quality evidence";
+            case VERYLOW: return "Very low quality evidence";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HIGH: return "High quality";
+            case MODERATE: return "Moderate quality";
+            case LOW: return "Low quality";
+            case VERYLOW: return "Very low quality";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifEvidenceQualityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifEvidenceQualityEnumFactory.java
new file mode 100644
index 00000000000..a0dfe34fc83
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifEvidenceQualityEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CqifEvidenceQualityEnumFactory implements EnumFactory {
+
+  public CqifEvidenceQuality fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("high".equals(codeString))
+      return CqifEvidenceQuality.HIGH;
+    if ("moderate".equals(codeString))
+      return CqifEvidenceQuality.MODERATE;
+    if ("low".equals(codeString))
+      return CqifEvidenceQuality.LOW;
+    if ("very-low".equals(codeString))
+      return CqifEvidenceQuality.VERYLOW;
+    throw new IllegalArgumentException("Unknown CqifEvidenceQuality code '"+codeString+"'");
+  }
+
+  public String toCode(CqifEvidenceQuality code) {
+    if (code == CqifEvidenceQuality.HIGH)
+      return "high";
+    if (code == CqifEvidenceQuality.MODERATE)
+      return "moderate";
+    if (code == CqifEvidenceQuality.LOW)
+      return "low";
+    if (code == CqifEvidenceQuality.VERYLOW)
+      return "very-low";
+    return "?";
+  }
+
+    public String toSystem(CqifEvidenceQuality code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifRecommendationStrength.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifRecommendationStrength.java
new file mode 100644
index 00000000000..0536f4d5ad2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifRecommendationStrength.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CqifRecommendationStrength {
+
+        /**
+         * Strong recommendation
+         */
+        STRONG, 
+        /**
+         * Weak recommendation
+         */
+        WEAK, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CqifRecommendationStrength fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("strong".equals(codeString))
+          return STRONG;
+        if ("weak".equals(codeString))
+          return WEAK;
+        throw new FHIRException("Unknown CqifRecommendationStrength code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case STRONG: return "strong";
+            case WEAK: return "weak";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/recommendation-strength";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case STRONG: return "Strong recommendation";
+            case WEAK: return "Weak recommendation";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case STRONG: return "Strong";
+            case WEAK: return "Weak";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifRecommendationStrengthEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifRecommendationStrengthEnumFactory.java
new file mode 100644
index 00000000000..13a243c0c4e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifRecommendationStrengthEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CqifRecommendationStrengthEnumFactory implements EnumFactory {
+
+  public CqifRecommendationStrength fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("strong".equals(codeString))
+      return CqifRecommendationStrength.STRONG;
+    if ("weak".equals(codeString))
+      return CqifRecommendationStrength.WEAK;
+    throw new IllegalArgumentException("Unknown CqifRecommendationStrength code '"+codeString+"'");
+  }
+
+  public String toCode(CqifRecommendationStrength code) {
+    if (code == CqifRecommendationStrength.STRONG)
+      return "strong";
+    if (code == CqifRecommendationStrength.WEAK)
+      return "weak";
+    return "?";
+  }
+
+    public String toSystem(CqifRecommendationStrength code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifTriggerType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifTriggerType.java
new file mode 100644
index 00000000000..b8f7a4a424d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifTriggerType.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum CqifTriggerType {
+
+        /**
+         * The trigger occurs in response to a specific named event
+         */
+        NAMEDEVENT, 
+        /**
+         * The trigger occurs at a specific time or periodically as described by a timing or schedule
+         */
+        PERIODIC, 
+        /**
+         * The trigger occurs whenever data of a particular type is added
+         */
+        DATAADDED, 
+        /**
+         * The trigger occurs whenever data of a particular type is modified
+         */
+        DATAMODIFIED, 
+        /**
+         * The trigger occurs whenever data of a particular type is removed
+         */
+        DATAREMOVED, 
+        /**
+         * The trigger occurs whenever data of a particular type is accessed
+         */
+        DATAACCESSED, 
+        /**
+         * The trigger occurs whenever access to data of a particular type is completed
+         */
+        DATAACCESSENDED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static CqifTriggerType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("named-event".equals(codeString))
+          return NAMEDEVENT;
+        if ("periodic".equals(codeString))
+          return PERIODIC;
+        if ("data-added".equals(codeString))
+          return DATAADDED;
+        if ("data-modified".equals(codeString))
+          return DATAMODIFIED;
+        if ("data-removed".equals(codeString))
+          return DATAREMOVED;
+        if ("data-accessed".equals(codeString))
+          return DATAACCESSED;
+        if ("data-access-ended".equals(codeString))
+          return DATAACCESSENDED;
+        throw new FHIRException("Unknown CqifTriggerType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NAMEDEVENT: return "named-event";
+            case PERIODIC: return "periodic";
+            case DATAADDED: return "data-added";
+            case DATAMODIFIED: return "data-modified";
+            case DATAREMOVED: return "data-removed";
+            case DATAACCESSED: return "data-accessed";
+            case DATAACCESSENDED: return "data-access-ended";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/trigger-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NAMEDEVENT: return "The trigger occurs in response to a specific named event";
+            case PERIODIC: return "The trigger occurs at a specific time or periodically as described by a timing or schedule";
+            case DATAADDED: return "The trigger occurs whenever data of a particular type is added";
+            case DATAMODIFIED: return "The trigger occurs whenever data of a particular type is modified";
+            case DATAREMOVED: return "The trigger occurs whenever data of a particular type is removed";
+            case DATAACCESSED: return "The trigger occurs whenever data of a particular type is accessed";
+            case DATAACCESSENDED: return "The trigger occurs whenever access to data of a particular type is completed";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NAMEDEVENT: return "Named Event";
+            case PERIODIC: return "Periodic";
+            case DATAADDED: return "Data Added";
+            case DATAMODIFIED: return "Data Modified";
+            case DATAREMOVED: return "Data Removed";
+            case DATAACCESSED: return "Data Accessed";
+            case DATAACCESSENDED: return "Data Access Ended";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifTriggerTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifTriggerTypeEnumFactory.java
new file mode 100644
index 00000000000..b44fdc8646b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/CqifTriggerTypeEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class CqifTriggerTypeEnumFactory implements EnumFactory {
+
+  public CqifTriggerType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("named-event".equals(codeString))
+      return CqifTriggerType.NAMEDEVENT;
+    if ("periodic".equals(codeString))
+      return CqifTriggerType.PERIODIC;
+    if ("data-added".equals(codeString))
+      return CqifTriggerType.DATAADDED;
+    if ("data-modified".equals(codeString))
+      return CqifTriggerType.DATAMODIFIED;
+    if ("data-removed".equals(codeString))
+      return CqifTriggerType.DATAREMOVED;
+    if ("data-accessed".equals(codeString))
+      return CqifTriggerType.DATAACCESSED;
+    if ("data-access-ended".equals(codeString))
+      return CqifTriggerType.DATAACCESSENDED;
+    throw new IllegalArgumentException("Unknown CqifTriggerType code '"+codeString+"'");
+  }
+
+  public String toCode(CqifTriggerType code) {
+    if (code == CqifTriggerType.NAMEDEVENT)
+      return "named-event";
+    if (code == CqifTriggerType.PERIODIC)
+      return "periodic";
+    if (code == CqifTriggerType.DATAADDED)
+      return "data-added";
+    if (code == CqifTriggerType.DATAMODIFIED)
+      return "data-modified";
+    if (code == CqifTriggerType.DATAREMOVED)
+      return "data-removed";
+    if (code == CqifTriggerType.DATAACCESSED)
+      return "data-accessed";
+    if (code == CqifTriggerType.DATAACCESSENDED)
+      return "data-access-ended";
+    return "?";
+  }
+
+    public String toSystem(CqifTriggerType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DWebType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DWebType.java
new file mode 100644
index 00000000000..4fb1d32e02b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DWebType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DWebType {
+
+        /**
+         * Web Access to DICOM Persistent Objects - RESTful Services
+         */
+        WADORS, 
+        /**
+         * Web Access to DICOM Persistent Objects - URI
+         */
+        WADOURI, 
+        /**
+         * IHE - Invoke Image Display Profile
+         */
+        IID, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DWebType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("WADO-RS".equals(codeString))
+          return WADORS;
+        if ("WADO-URI".equals(codeString))
+          return WADOURI;
+        if ("IID".equals(codeString))
+          return IID;
+        throw new FHIRException("Unknown DWebType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case WADORS: return "WADO-RS";
+            case WADOURI: return "WADO-URI";
+            case IID: return "IID";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/dWebType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case WADORS: return "Web Access to DICOM Persistent Objects - RESTful Services";
+            case WADOURI: return "Web Access to DICOM Persistent Objects - URI";
+            case IID: return "IHE - Invoke Image Display Profile";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case WADORS: return "WADO-RS";
+            case WADOURI: return "WADO-URI";
+            case IID: return "IID";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DWebTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DWebTypeEnumFactory.java
new file mode 100644
index 00000000000..1b5c16b09b7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DWebTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DWebTypeEnumFactory implements EnumFactory {
+
+  public DWebType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("WADO-RS".equals(codeString))
+      return DWebType.WADORS;
+    if ("WADO-URI".equals(codeString))
+      return DWebType.WADOURI;
+    if ("IID".equals(codeString))
+      return DWebType.IID;
+    throw new IllegalArgumentException("Unknown DWebType code '"+codeString+"'");
+  }
+
+  public String toCode(DWebType code) {
+    if (code == DWebType.WADORS)
+      return "WADO-RS";
+    if (code == DWebType.WADOURI)
+      return "WADO-URI";
+    if (code == DWebType.IID)
+      return "IID";
+    return "?";
+  }
+
+    public String toSystem(DWebType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataAbsentReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataAbsentReason.java
new file mode 100644
index 00000000000..65d83f7eb12
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataAbsentReason.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DataAbsentReason {
+
+        /**
+         * The value is not known.
+         */
+        UNKNOWN, 
+        /**
+         * The source human does not know the value.
+         */
+        ASKED, 
+        /**
+         * There is reason to expect (from the workflow) that the value may become known.
+         */
+        TEMP, 
+        /**
+         * The workflow didn't lead to this value being known.
+         */
+        NOTASKED, 
+        /**
+         * The information is not available due to security, privacy or related reasons.
+         */
+        MASKED, 
+        /**
+         * The source system wasn't capable of supporting this element.
+         */
+        UNSUPPORTED, 
+        /**
+         * The content of the data is represented in the resource narrative.
+         */
+        ASTEXT, 
+        /**
+         * Some system or workflow process error means that the information is not available.
+         */
+        ERROR, 
+        /**
+         * NaN, standing for not a number, is a numeric data type value representing an undefined or unrepresentable value.
+         */
+        NAN, 
+        /**
+         * The value is not available because the observation procedure (test, etc.) was not performed.
+         */
+        NOTPERFORMED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DataAbsentReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        if ("asked".equals(codeString))
+          return ASKED;
+        if ("temp".equals(codeString))
+          return TEMP;
+        if ("not-asked".equals(codeString))
+          return NOTASKED;
+        if ("masked".equals(codeString))
+          return MASKED;
+        if ("unsupported".equals(codeString))
+          return UNSUPPORTED;
+        if ("astext".equals(codeString))
+          return ASTEXT;
+        if ("error".equals(codeString))
+          return ERROR;
+        if ("NaN".equals(codeString))
+          return NAN;
+        if ("not-performed".equals(codeString))
+          return NOTPERFORMED;
+        throw new FHIRException("Unknown DataAbsentReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UNKNOWN: return "unknown";
+            case ASKED: return "asked";
+            case TEMP: return "temp";
+            case NOTASKED: return "not-asked";
+            case MASKED: return "masked";
+            case UNSUPPORTED: return "unsupported";
+            case ASTEXT: return "astext";
+            case ERROR: return "error";
+            case NAN: return "NaN";
+            case NOTPERFORMED: return "not-performed";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/data-absent-reason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UNKNOWN: return "The value is not known.";
+            case ASKED: return "The source human does not know the value.";
+            case TEMP: return "There is reason to expect (from the workflow) that the value may become known.";
+            case NOTASKED: return "The workflow didn't lead to this value being known.";
+            case MASKED: return "The information is not available due to security, privacy or related reasons.";
+            case UNSUPPORTED: return "The source system wasn't capable of supporting this element.";
+            case ASTEXT: return "The content of the data is represented in the resource narrative.";
+            case ERROR: return "Some system or workflow process error means that the information is not available.";
+            case NAN: return "NaN, standing for not a number, is a numeric data type value representing an undefined or unrepresentable value.";
+            case NOTPERFORMED: return "The value is not available because the observation procedure (test, etc.) was not performed.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UNKNOWN: return "Unknown";
+            case ASKED: return "Asked";
+            case TEMP: return "Temp";
+            case NOTASKED: return "Not Asked";
+            case MASKED: return "Masked";
+            case UNSUPPORTED: return "Unsupported";
+            case ASTEXT: return "As Text";
+            case ERROR: return "Error";
+            case NAN: return "Not a Number";
+            case NOTPERFORMED: return "Not Performed";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataAbsentReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataAbsentReasonEnumFactory.java
new file mode 100644
index 00000000000..0bf4c338466
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataAbsentReasonEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DataAbsentReasonEnumFactory implements EnumFactory {
+
+  public DataAbsentReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("unknown".equals(codeString))
+      return DataAbsentReason.UNKNOWN;
+    if ("asked".equals(codeString))
+      return DataAbsentReason.ASKED;
+    if ("temp".equals(codeString))
+      return DataAbsentReason.TEMP;
+    if ("not-asked".equals(codeString))
+      return DataAbsentReason.NOTASKED;
+    if ("masked".equals(codeString))
+      return DataAbsentReason.MASKED;
+    if ("unsupported".equals(codeString))
+      return DataAbsentReason.UNSUPPORTED;
+    if ("astext".equals(codeString))
+      return DataAbsentReason.ASTEXT;
+    if ("error".equals(codeString))
+      return DataAbsentReason.ERROR;
+    if ("NaN".equals(codeString))
+      return DataAbsentReason.NAN;
+    if ("not-performed".equals(codeString))
+      return DataAbsentReason.NOTPERFORMED;
+    throw new IllegalArgumentException("Unknown DataAbsentReason code '"+codeString+"'");
+  }
+
+  public String toCode(DataAbsentReason code) {
+    if (code == DataAbsentReason.UNKNOWN)
+      return "unknown";
+    if (code == DataAbsentReason.ASKED)
+      return "asked";
+    if (code == DataAbsentReason.TEMP)
+      return "temp";
+    if (code == DataAbsentReason.NOTASKED)
+      return "not-asked";
+    if (code == DataAbsentReason.MASKED)
+      return "masked";
+    if (code == DataAbsentReason.UNSUPPORTED)
+      return "unsupported";
+    if (code == DataAbsentReason.ASTEXT)
+      return "astext";
+    if (code == DataAbsentReason.ERROR)
+      return "error";
+    if (code == DataAbsentReason.NAN)
+      return "NaN";
+    if (code == DataAbsentReason.NOTPERFORMED)
+      return "not-performed";
+    return "?";
+  }
+
+    public String toSystem(DataAbsentReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataTypes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataTypes.java
new file mode 100644
index 00000000000..73ef30649ec
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataTypes.java
@@ -0,0 +1,555 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DataTypes {
+
+        /**
+         * An address expressed using postal conventions (as opposed to GPS or other location definition formats).  This data type may be used to convey addresses for use in delivering mail as well as for visiting locations which might not be valid for mail delivery.  There are a variety of postal address formats defined around the world.
+         */
+        ADDRESS, 
+        /**
+         * A duration of time during which an organism (or a process) has existed.
+         */
+        AGE, 
+        /**
+         * A  text note which also  contains information about who made the statement and when.
+         */
+        ANNOTATION, 
+        /**
+         * For referring to data content defined in other formats.
+         */
+        ATTACHMENT, 
+        /**
+         * Base definition for all elements that are defined inside a resource - but not those in a data type.
+         */
+        BACKBONEELEMENT, 
+        /**
+         * A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text.
+         */
+        CODEABLECONCEPT, 
+        /**
+         * A reference to a code defined by a terminology system.
+         */
+        CODING, 
+        /**
+         * Specifies contact information for a person or organization.
+         */
+        CONTACTDETAIL, 
+        /**
+         * Details for all kinds of technology mediated contact points for a person or organization, including telephone, email, etc.
+         */
+        CONTACTPOINT, 
+        /**
+         * A contributor to the content of a knowledge asset, including authors, editors, reviewers, and endorsers.
+         */
+        CONTRIBUTOR, 
+        /**
+         * A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
+         */
+        COUNT, 
+        /**
+         * Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of the data.
+         */
+        DATAREQUIREMENT, 
+        /**
+         * A length - a value with a unit that is a physical distance.
+         */
+        DISTANCE, 
+        /**
+         * Indicates how the medication is/was taken or should be taken by the patient.
+         */
+        DOSAGE, 
+        /**
+         * A length of time.
+         */
+        DURATION, 
+        /**
+         * Base definition for all elements in a resource.
+         */
+        ELEMENT, 
+        /**
+         * Captures constraints on each element within the resource, profile, or extension.
+         */
+        ELEMENTDEFINITION, 
+        /**
+         * Optional Extension Element - found in all resources.
+         */
+        EXTENSION, 
+        /**
+         * A human's name with the ability to identify parts and usage.
+         */
+        HUMANNAME, 
+        /**
+         * A technical identifier - identifies some entity uniquely and unambiguously.
+         */
+        IDENTIFIER, 
+        /**
+         * The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.
+         */
+        META, 
+        /**
+         * An amount of economic utility in some recognized currency.
+         */
+        MONEY, 
+        /**
+         * A human-readable formatted text, including images.
+         */
+        NARRATIVE, 
+        /**
+         * The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.
+         */
+        PARAMETERDEFINITION, 
+        /**
+         * A time period defined by a start and end date and optionally time.
+         */
+        PERIOD, 
+        /**
+         * A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
+         */
+        QUANTITY, 
+        /**
+         * A set of ordered Quantities defined by a low and high limit.
+         */
+        RANGE, 
+        /**
+         * A relationship of two Quantity values - expressed as a numerator and a denominator.
+         */
+        RATIO, 
+        /**
+         * A reference from one resource to another.
+         */
+        REFERENCE, 
+        /**
+         * Related artifacts such as additional documentation, justification, or bibliographic references.
+         */
+        RELATEDARTIFACT, 
+        /**
+         * A series of measurements taken by a device, with upper and lower limits. There may be more than one dimension in the data.
+         */
+        SAMPLEDDATA, 
+        /**
+         * A digital signature along with supporting context. The signature may be electronic/cryptographic in nature, or a graphical image representing a hand-written signature, or a signature process. Different signature approaches have different utilities.
+         */
+        SIGNATURE, 
+        /**
+         * null
+         */
+        SIMPLEQUANTITY, 
+        /**
+         * Specifies an event that may occur multiple times. Timing schedules are used to record when things are planned, expected or requested to occur. The most common usage is in dosage instructions for medications. They are also used when planning care of various kinds, and may be used for reporting the schedule to which past regular activities were carried out.
+         */
+        TIMING, 
+        /**
+         * A description of a triggering event.
+         */
+        TRIGGERDEFINITION, 
+        /**
+         * Specifies clinical/business/etc metadata that can be used to retrieve, index and/or categorize an artifact. This metadata can either be specific to the applicable population (e.g., age category, DRG) or the specific context of care (e.g., venue, care setting, provider of care).
+         */
+        USAGECONTEXT, 
+        /**
+         * A stream of bytes
+         */
+        BASE64BINARY, 
+        /**
+         * Value of "true" or "false"
+         */
+        BOOLEAN, 
+        /**
+         * A string which has at least one character and no leading or trailing whitespace and where there is no whitespace other than single spaces in the contents
+         */
+        CODE, 
+        /**
+         * A date or partial date (e.g. just year or year + month). There is no time zone. The format is a union of the schema types gYear, gYearMonth and date.  Dates SHALL be valid dates.
+         */
+        DATE, 
+        /**
+         * A date, date-time or partial date (e.g. just year or year + month).  If hours and minutes are specified, a time zone SHALL be populated. The format is a union of the schema types gYear, gYearMonth, date and dateTime. Seconds must be provided due to schema type constraints but may be zero-filled and may be ignored.                 Dates SHALL be valid dates.
+         */
+        DATETIME, 
+        /**
+         * A rational number with implicit precision
+         */
+        DECIMAL, 
+        /**
+         * Any combination of letters, numerals, "-" and ".", with a length limit of 64 characters.  (This might be an integer, an unprefixed OID, UUID or any other identifier pattern that meets these constraints.)  Ids are case-insensitive.
+         */
+        ID, 
+        /**
+         * An instant in time - known at least to the second
+         */
+        INSTANT, 
+        /**
+         * A whole number
+         */
+        INTEGER, 
+        /**
+         * A string that may contain markdown syntax for optional processing by a mark down presentation engine
+         */
+        MARKDOWN, 
+        /**
+         * An OID represented as a URI
+         */
+        OID, 
+        /**
+         * An integer with a value that is positive (e.g. >0)
+         */
+        POSITIVEINT, 
+        /**
+         * A sequence of Unicode characters
+         */
+        STRING, 
+        /**
+         * A time during the day, with no date specified
+         */
+        TIME, 
+        /**
+         * An integer with a value that is not negative (e.g. >= 0)
+         */
+        UNSIGNEDINT, 
+        /**
+         * String of characters used to identify a name or a resource
+         */
+        URI, 
+        /**
+         * A UUID, represented as a URI
+         */
+        UUID, 
+        /**
+         * XHTML format, as defined by W3C, but restricted usage (mainly, no active content)
+         */
+        XHTML, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DataTypes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("Address".equals(codeString))
+          return ADDRESS;
+        if ("Age".equals(codeString))
+          return AGE;
+        if ("Annotation".equals(codeString))
+          return ANNOTATION;
+        if ("Attachment".equals(codeString))
+          return ATTACHMENT;
+        if ("BackboneElement".equals(codeString))
+          return BACKBONEELEMENT;
+        if ("CodeableConcept".equals(codeString))
+          return CODEABLECONCEPT;
+        if ("Coding".equals(codeString))
+          return CODING;
+        if ("ContactDetail".equals(codeString))
+          return CONTACTDETAIL;
+        if ("ContactPoint".equals(codeString))
+          return CONTACTPOINT;
+        if ("Contributor".equals(codeString))
+          return CONTRIBUTOR;
+        if ("Count".equals(codeString))
+          return COUNT;
+        if ("DataRequirement".equals(codeString))
+          return DATAREQUIREMENT;
+        if ("Distance".equals(codeString))
+          return DISTANCE;
+        if ("Dosage".equals(codeString))
+          return DOSAGE;
+        if ("Duration".equals(codeString))
+          return DURATION;
+        if ("Element".equals(codeString))
+          return ELEMENT;
+        if ("ElementDefinition".equals(codeString))
+          return ELEMENTDEFINITION;
+        if ("Extension".equals(codeString))
+          return EXTENSION;
+        if ("HumanName".equals(codeString))
+          return HUMANNAME;
+        if ("Identifier".equals(codeString))
+          return IDENTIFIER;
+        if ("Meta".equals(codeString))
+          return META;
+        if ("Money".equals(codeString))
+          return MONEY;
+        if ("Narrative".equals(codeString))
+          return NARRATIVE;
+        if ("ParameterDefinition".equals(codeString))
+          return PARAMETERDEFINITION;
+        if ("Period".equals(codeString))
+          return PERIOD;
+        if ("Quantity".equals(codeString))
+          return QUANTITY;
+        if ("Range".equals(codeString))
+          return RANGE;
+        if ("Ratio".equals(codeString))
+          return RATIO;
+        if ("Reference".equals(codeString))
+          return REFERENCE;
+        if ("RelatedArtifact".equals(codeString))
+          return RELATEDARTIFACT;
+        if ("SampledData".equals(codeString))
+          return SAMPLEDDATA;
+        if ("Signature".equals(codeString))
+          return SIGNATURE;
+        if ("SimpleQuantity".equals(codeString))
+          return SIMPLEQUANTITY;
+        if ("Timing".equals(codeString))
+          return TIMING;
+        if ("TriggerDefinition".equals(codeString))
+          return TRIGGERDEFINITION;
+        if ("UsageContext".equals(codeString))
+          return USAGECONTEXT;
+        if ("base64Binary".equals(codeString))
+          return BASE64BINARY;
+        if ("boolean".equals(codeString))
+          return BOOLEAN;
+        if ("code".equals(codeString))
+          return CODE;
+        if ("date".equals(codeString))
+          return DATE;
+        if ("dateTime".equals(codeString))
+          return DATETIME;
+        if ("decimal".equals(codeString))
+          return DECIMAL;
+        if ("id".equals(codeString))
+          return ID;
+        if ("instant".equals(codeString))
+          return INSTANT;
+        if ("integer".equals(codeString))
+          return INTEGER;
+        if ("markdown".equals(codeString))
+          return MARKDOWN;
+        if ("oid".equals(codeString))
+          return OID;
+        if ("positiveInt".equals(codeString))
+          return POSITIVEINT;
+        if ("string".equals(codeString))
+          return STRING;
+        if ("time".equals(codeString))
+          return TIME;
+        if ("unsignedInt".equals(codeString))
+          return UNSIGNEDINT;
+        if ("uri".equals(codeString))
+          return URI;
+        if ("uuid".equals(codeString))
+          return UUID;
+        if ("xhtml".equals(codeString))
+          return XHTML;
+        throw new FHIRException("Unknown DataTypes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ADDRESS: return "Address";
+            case AGE: return "Age";
+            case ANNOTATION: return "Annotation";
+            case ATTACHMENT: return "Attachment";
+            case BACKBONEELEMENT: return "BackboneElement";
+            case CODEABLECONCEPT: return "CodeableConcept";
+            case CODING: return "Coding";
+            case CONTACTDETAIL: return "ContactDetail";
+            case CONTACTPOINT: return "ContactPoint";
+            case CONTRIBUTOR: return "Contributor";
+            case COUNT: return "Count";
+            case DATAREQUIREMENT: return "DataRequirement";
+            case DISTANCE: return "Distance";
+            case DOSAGE: return "Dosage";
+            case DURATION: return "Duration";
+            case ELEMENT: return "Element";
+            case ELEMENTDEFINITION: return "ElementDefinition";
+            case EXTENSION: return "Extension";
+            case HUMANNAME: return "HumanName";
+            case IDENTIFIER: return "Identifier";
+            case META: return "Meta";
+            case MONEY: return "Money";
+            case NARRATIVE: return "Narrative";
+            case PARAMETERDEFINITION: return "ParameterDefinition";
+            case PERIOD: return "Period";
+            case QUANTITY: return "Quantity";
+            case RANGE: return "Range";
+            case RATIO: return "Ratio";
+            case REFERENCE: return "Reference";
+            case RELATEDARTIFACT: return "RelatedArtifact";
+            case SAMPLEDDATA: return "SampledData";
+            case SIGNATURE: return "Signature";
+            case SIMPLEQUANTITY: return "SimpleQuantity";
+            case TIMING: return "Timing";
+            case TRIGGERDEFINITION: return "TriggerDefinition";
+            case USAGECONTEXT: return "UsageContext";
+            case BASE64BINARY: return "base64Binary";
+            case BOOLEAN: return "boolean";
+            case CODE: return "code";
+            case DATE: return "date";
+            case DATETIME: return "dateTime";
+            case DECIMAL: return "decimal";
+            case ID: return "id";
+            case INSTANT: return "instant";
+            case INTEGER: return "integer";
+            case MARKDOWN: return "markdown";
+            case OID: return "oid";
+            case POSITIVEINT: return "positiveInt";
+            case STRING: return "string";
+            case TIME: return "time";
+            case UNSIGNEDINT: return "unsignedInt";
+            case URI: return "uri";
+            case UUID: return "uuid";
+            case XHTML: return "xhtml";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/data-types";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ADDRESS: return "An address expressed using postal conventions (as opposed to GPS or other location definition formats).  This data type may be used to convey addresses for use in delivering mail as well as for visiting locations which might not be valid for mail delivery.  There are a variety of postal address formats defined around the world.";
+            case AGE: return "A duration of time during which an organism (or a process) has existed.";
+            case ANNOTATION: return "A  text note which also  contains information about who made the statement and when.";
+            case ATTACHMENT: return "For referring to data content defined in other formats.";
+            case BACKBONEELEMENT: return "Base definition for all elements that are defined inside a resource - but not those in a data type.";
+            case CODEABLECONCEPT: return "A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text.";
+            case CODING: return "A reference to a code defined by a terminology system.";
+            case CONTACTDETAIL: return "Specifies contact information for a person or organization.";
+            case CONTACTPOINT: return "Details for all kinds of technology mediated contact points for a person or organization, including telephone, email, etc.";
+            case CONTRIBUTOR: return "A contributor to the content of a knowledge asset, including authors, editors, reviewers, and endorsers.";
+            case COUNT: return "A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.";
+            case DATAREQUIREMENT: return "Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of the data.";
+            case DISTANCE: return "A length - a value with a unit that is a physical distance.";
+            case DOSAGE: return "Indicates how the medication is/was taken or should be taken by the patient.";
+            case DURATION: return "A length of time.";
+            case ELEMENT: return "Base definition for all elements in a resource.";
+            case ELEMENTDEFINITION: return "Captures constraints on each element within the resource, profile, or extension.";
+            case EXTENSION: return "Optional Extension Element - found in all resources.";
+            case HUMANNAME: return "A human's name with the ability to identify parts and usage.";
+            case IDENTIFIER: return "A technical identifier - identifies some entity uniquely and unambiguously.";
+            case META: return "The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.";
+            case MONEY: return "An amount of economic utility in some recognized currency.";
+            case NARRATIVE: return "A human-readable formatted text, including images.";
+            case PARAMETERDEFINITION: return "The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.";
+            case PERIOD: return "A time period defined by a start and end date and optionally time.";
+            case QUANTITY: return "A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.";
+            case RANGE: return "A set of ordered Quantities defined by a low and high limit.";
+            case RATIO: return "A relationship of two Quantity values - expressed as a numerator and a denominator.";
+            case REFERENCE: return "A reference from one resource to another.";
+            case RELATEDARTIFACT: return "Related artifacts such as additional documentation, justification, or bibliographic references.";
+            case SAMPLEDDATA: return "A series of measurements taken by a device, with upper and lower limits. There may be more than one dimension in the data.";
+            case SIGNATURE: return "A digital signature along with supporting context. The signature may be electronic/cryptographic in nature, or a graphical image representing a hand-written signature, or a signature process. Different signature approaches have different utilities.";
+            case SIMPLEQUANTITY: return "";
+            case TIMING: return "Specifies an event that may occur multiple times. Timing schedules are used to record when things are planned, expected or requested to occur. The most common usage is in dosage instructions for medications. They are also used when planning care of various kinds, and may be used for reporting the schedule to which past regular activities were carried out.";
+            case TRIGGERDEFINITION: return "A description of a triggering event.";
+            case USAGECONTEXT: return "Specifies clinical/business/etc metadata that can be used to retrieve, index and/or categorize an artifact. This metadata can either be specific to the applicable population (e.g., age category, DRG) or the specific context of care (e.g., venue, care setting, provider of care).";
+            case BASE64BINARY: return "A stream of bytes";
+            case BOOLEAN: return "Value of \"true\" or \"false\"";
+            case CODE: return "A string which has at least one character and no leading or trailing whitespace and where there is no whitespace other than single spaces in the contents";
+            case DATE: return "A date or partial date (e.g. just year or year + month). There is no time zone. The format is a union of the schema types gYear, gYearMonth and date.  Dates SHALL be valid dates.";
+            case DATETIME: return "A date, date-time or partial date (e.g. just year or year + month).  If hours and minutes are specified, a time zone SHALL be populated. The format is a union of the schema types gYear, gYearMonth, date and dateTime. Seconds must be provided due to schema type constraints but may be zero-filled and may be ignored.                 Dates SHALL be valid dates.";
+            case DECIMAL: return "A rational number with implicit precision";
+            case ID: return "Any combination of letters, numerals, \"-\" and \".\", with a length limit of 64 characters.  (This might be an integer, an unprefixed OID, UUID or any other identifier pattern that meets these constraints.)  Ids are case-insensitive.";
+            case INSTANT: return "An instant in time - known at least to the second";
+            case INTEGER: return "A whole number";
+            case MARKDOWN: return "A string that may contain markdown syntax for optional processing by a mark down presentation engine";
+            case OID: return "An OID represented as a URI";
+            case POSITIVEINT: return "An integer with a value that is positive (e.g. >0)";
+            case STRING: return "A sequence of Unicode characters";
+            case TIME: return "A time during the day, with no date specified";
+            case UNSIGNEDINT: return "An integer with a value that is not negative (e.g. >= 0)";
+            case URI: return "String of characters used to identify a name or a resource";
+            case UUID: return "A UUID, represented as a URI";
+            case XHTML: return "XHTML format, as defined by W3C, but restricted usage (mainly, no active content)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ADDRESS: return "Address";
+            case AGE: return "Age";
+            case ANNOTATION: return "Annotation";
+            case ATTACHMENT: return "Attachment";
+            case BACKBONEELEMENT: return "BackboneElement";
+            case CODEABLECONCEPT: return "CodeableConcept";
+            case CODING: return "Coding";
+            case CONTACTDETAIL: return "ContactDetail";
+            case CONTACTPOINT: return "ContactPoint";
+            case CONTRIBUTOR: return "Contributor";
+            case COUNT: return "Count";
+            case DATAREQUIREMENT: return "DataRequirement";
+            case DISTANCE: return "Distance";
+            case DOSAGE: return "Dosage";
+            case DURATION: return "Duration";
+            case ELEMENT: return "Element";
+            case ELEMENTDEFINITION: return "ElementDefinition";
+            case EXTENSION: return "Extension";
+            case HUMANNAME: return "HumanName";
+            case IDENTIFIER: return "Identifier";
+            case META: return "Meta";
+            case MONEY: return "Money";
+            case NARRATIVE: return "Narrative";
+            case PARAMETERDEFINITION: return "ParameterDefinition";
+            case PERIOD: return "Period";
+            case QUANTITY: return "Quantity";
+            case RANGE: return "Range";
+            case RATIO: return "Ratio";
+            case REFERENCE: return "Reference";
+            case RELATEDARTIFACT: return "RelatedArtifact";
+            case SAMPLEDDATA: return "SampledData";
+            case SIGNATURE: return "Signature";
+            case SIMPLEQUANTITY: return "SimpleQuantity";
+            case TIMING: return "Timing";
+            case TRIGGERDEFINITION: return "TriggerDefinition";
+            case USAGECONTEXT: return "UsageContext";
+            case BASE64BINARY: return "base64Binary";
+            case BOOLEAN: return "boolean";
+            case CODE: return "code";
+            case DATE: return "date";
+            case DATETIME: return "dateTime";
+            case DECIMAL: return "decimal";
+            case ID: return "id";
+            case INSTANT: return "instant";
+            case INTEGER: return "integer";
+            case MARKDOWN: return "markdown";
+            case OID: return "oid";
+            case POSITIVEINT: return "positiveInt";
+            case STRING: return "string";
+            case TIME: return "time";
+            case UNSIGNEDINT: return "unsignedInt";
+            case URI: return "uri";
+            case UUID: return "uuid";
+            case XHTML: return "XHTML";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataTypesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataTypesEnumFactory.java
new file mode 100644
index 00000000000..e090780ae9d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataTypesEnumFactory.java
@@ -0,0 +1,270 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DataTypesEnumFactory implements EnumFactory {
+
+  public DataTypes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("Address".equals(codeString))
+      return DataTypes.ADDRESS;
+    if ("Age".equals(codeString))
+      return DataTypes.AGE;
+    if ("Annotation".equals(codeString))
+      return DataTypes.ANNOTATION;
+    if ("Attachment".equals(codeString))
+      return DataTypes.ATTACHMENT;
+    if ("BackboneElement".equals(codeString))
+      return DataTypes.BACKBONEELEMENT;
+    if ("CodeableConcept".equals(codeString))
+      return DataTypes.CODEABLECONCEPT;
+    if ("Coding".equals(codeString))
+      return DataTypes.CODING;
+    if ("ContactDetail".equals(codeString))
+      return DataTypes.CONTACTDETAIL;
+    if ("ContactPoint".equals(codeString))
+      return DataTypes.CONTACTPOINT;
+    if ("Contributor".equals(codeString))
+      return DataTypes.CONTRIBUTOR;
+    if ("Count".equals(codeString))
+      return DataTypes.COUNT;
+    if ("DataRequirement".equals(codeString))
+      return DataTypes.DATAREQUIREMENT;
+    if ("Distance".equals(codeString))
+      return DataTypes.DISTANCE;
+    if ("Dosage".equals(codeString))
+      return DataTypes.DOSAGE;
+    if ("Duration".equals(codeString))
+      return DataTypes.DURATION;
+    if ("Element".equals(codeString))
+      return DataTypes.ELEMENT;
+    if ("ElementDefinition".equals(codeString))
+      return DataTypes.ELEMENTDEFINITION;
+    if ("Extension".equals(codeString))
+      return DataTypes.EXTENSION;
+    if ("HumanName".equals(codeString))
+      return DataTypes.HUMANNAME;
+    if ("Identifier".equals(codeString))
+      return DataTypes.IDENTIFIER;
+    if ("Meta".equals(codeString))
+      return DataTypes.META;
+    if ("Money".equals(codeString))
+      return DataTypes.MONEY;
+    if ("Narrative".equals(codeString))
+      return DataTypes.NARRATIVE;
+    if ("ParameterDefinition".equals(codeString))
+      return DataTypes.PARAMETERDEFINITION;
+    if ("Period".equals(codeString))
+      return DataTypes.PERIOD;
+    if ("Quantity".equals(codeString))
+      return DataTypes.QUANTITY;
+    if ("Range".equals(codeString))
+      return DataTypes.RANGE;
+    if ("Ratio".equals(codeString))
+      return DataTypes.RATIO;
+    if ("Reference".equals(codeString))
+      return DataTypes.REFERENCE;
+    if ("RelatedArtifact".equals(codeString))
+      return DataTypes.RELATEDARTIFACT;
+    if ("SampledData".equals(codeString))
+      return DataTypes.SAMPLEDDATA;
+    if ("Signature".equals(codeString))
+      return DataTypes.SIGNATURE;
+    if ("SimpleQuantity".equals(codeString))
+      return DataTypes.SIMPLEQUANTITY;
+    if ("Timing".equals(codeString))
+      return DataTypes.TIMING;
+    if ("TriggerDefinition".equals(codeString))
+      return DataTypes.TRIGGERDEFINITION;
+    if ("UsageContext".equals(codeString))
+      return DataTypes.USAGECONTEXT;
+    if ("base64Binary".equals(codeString))
+      return DataTypes.BASE64BINARY;
+    if ("boolean".equals(codeString))
+      return DataTypes.BOOLEAN;
+    if ("code".equals(codeString))
+      return DataTypes.CODE;
+    if ("date".equals(codeString))
+      return DataTypes.DATE;
+    if ("dateTime".equals(codeString))
+      return DataTypes.DATETIME;
+    if ("decimal".equals(codeString))
+      return DataTypes.DECIMAL;
+    if ("id".equals(codeString))
+      return DataTypes.ID;
+    if ("instant".equals(codeString))
+      return DataTypes.INSTANT;
+    if ("integer".equals(codeString))
+      return DataTypes.INTEGER;
+    if ("markdown".equals(codeString))
+      return DataTypes.MARKDOWN;
+    if ("oid".equals(codeString))
+      return DataTypes.OID;
+    if ("positiveInt".equals(codeString))
+      return DataTypes.POSITIVEINT;
+    if ("string".equals(codeString))
+      return DataTypes.STRING;
+    if ("time".equals(codeString))
+      return DataTypes.TIME;
+    if ("unsignedInt".equals(codeString))
+      return DataTypes.UNSIGNEDINT;
+    if ("uri".equals(codeString))
+      return DataTypes.URI;
+    if ("uuid".equals(codeString))
+      return DataTypes.UUID;
+    if ("xhtml".equals(codeString))
+      return DataTypes.XHTML;
+    throw new IllegalArgumentException("Unknown DataTypes code '"+codeString+"'");
+  }
+
+  public String toCode(DataTypes code) {
+    if (code == DataTypes.ADDRESS)
+      return "Address";
+    if (code == DataTypes.AGE)
+      return "Age";
+    if (code == DataTypes.ANNOTATION)
+      return "Annotation";
+    if (code == DataTypes.ATTACHMENT)
+      return "Attachment";
+    if (code == DataTypes.BACKBONEELEMENT)
+      return "BackboneElement";
+    if (code == DataTypes.CODEABLECONCEPT)
+      return "CodeableConcept";
+    if (code == DataTypes.CODING)
+      return "Coding";
+    if (code == DataTypes.CONTACTDETAIL)
+      return "ContactDetail";
+    if (code == DataTypes.CONTACTPOINT)
+      return "ContactPoint";
+    if (code == DataTypes.CONTRIBUTOR)
+      return "Contributor";
+    if (code == DataTypes.COUNT)
+      return "Count";
+    if (code == DataTypes.DATAREQUIREMENT)
+      return "DataRequirement";
+    if (code == DataTypes.DISTANCE)
+      return "Distance";
+    if (code == DataTypes.DOSAGE)
+      return "Dosage";
+    if (code == DataTypes.DURATION)
+      return "Duration";
+    if (code == DataTypes.ELEMENT)
+      return "Element";
+    if (code == DataTypes.ELEMENTDEFINITION)
+      return "ElementDefinition";
+    if (code == DataTypes.EXTENSION)
+      return "Extension";
+    if (code == DataTypes.HUMANNAME)
+      return "HumanName";
+    if (code == DataTypes.IDENTIFIER)
+      return "Identifier";
+    if (code == DataTypes.META)
+      return "Meta";
+    if (code == DataTypes.MONEY)
+      return "Money";
+    if (code == DataTypes.NARRATIVE)
+      return "Narrative";
+    if (code == DataTypes.PARAMETERDEFINITION)
+      return "ParameterDefinition";
+    if (code == DataTypes.PERIOD)
+      return "Period";
+    if (code == DataTypes.QUANTITY)
+      return "Quantity";
+    if (code == DataTypes.RANGE)
+      return "Range";
+    if (code == DataTypes.RATIO)
+      return "Ratio";
+    if (code == DataTypes.REFERENCE)
+      return "Reference";
+    if (code == DataTypes.RELATEDARTIFACT)
+      return "RelatedArtifact";
+    if (code == DataTypes.SAMPLEDDATA)
+      return "SampledData";
+    if (code == DataTypes.SIGNATURE)
+      return "Signature";
+    if (code == DataTypes.SIMPLEQUANTITY)
+      return "SimpleQuantity";
+    if (code == DataTypes.TIMING)
+      return "Timing";
+    if (code == DataTypes.TRIGGERDEFINITION)
+      return "TriggerDefinition";
+    if (code == DataTypes.USAGECONTEXT)
+      return "UsageContext";
+    if (code == DataTypes.BASE64BINARY)
+      return "base64Binary";
+    if (code == DataTypes.BOOLEAN)
+      return "boolean";
+    if (code == DataTypes.CODE)
+      return "code";
+    if (code == DataTypes.DATE)
+      return "date";
+    if (code == DataTypes.DATETIME)
+      return "dateTime";
+    if (code == DataTypes.DECIMAL)
+      return "decimal";
+    if (code == DataTypes.ID)
+      return "id";
+    if (code == DataTypes.INSTANT)
+      return "instant";
+    if (code == DataTypes.INTEGER)
+      return "integer";
+    if (code == DataTypes.MARKDOWN)
+      return "markdown";
+    if (code == DataTypes.OID)
+      return "oid";
+    if (code == DataTypes.POSITIVEINT)
+      return "positiveInt";
+    if (code == DataTypes.STRING)
+      return "string";
+    if (code == DataTypes.TIME)
+      return "time";
+    if (code == DataTypes.UNSIGNEDINT)
+      return "unsignedInt";
+    if (code == DataTypes.URI)
+      return "uri";
+    if (code == DataTypes.UUID)
+      return "uuid";
+    if (code == DataTypes.XHTML)
+      return "xhtml";
+    return "?";
+  }
+
+    public String toSystem(DataTypes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataelementStringency.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataelementStringency.java
new file mode 100644
index 00000000000..9f6eadc34bc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataelementStringency.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DataelementStringency {
+
+        /**
+         * The data element is sufficiently well-constrained that multiple pieces of data captured according to the constraints of the data element will be comparable (though in some cases, a degree of automated conversion/normalization may be required).
+         */
+        COMPARABLE, 
+        /**
+         * The data element is fully specified down to a single value set, single unit of measure, single data type, etc.  Multiple pieces of data associated with this data element are fully comparable.
+         */
+        FULLYSPECIFIED, 
+        /**
+         * The data element allows multiple units of measure having equivalent meaning; e.g. "cc" (cubic centimeter) and "mL" (milliliter).
+         */
+        EQUIVALENT, 
+        /**
+         * The data element allows multiple units of measure that are convertable between each other (e.g. inches and centimeters) and/or allows data to be captured in multiple value sets for which a known mapping exists allowing conversion of meaning.
+         */
+        CONVERTABLE, 
+        /**
+         * A convertable data element where unit conversions are different only by a power of 10; e.g. g, mg, kg.
+         */
+        SCALEABLE, 
+        /**
+         * The data element is unconstrained in units, choice of data types and/or choice of vocabulary such that automated comparison of data captured using the data element is not possible.
+         */
+        FLEXIBLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DataelementStringency fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("comparable".equals(codeString))
+          return COMPARABLE;
+        if ("fully-specified".equals(codeString))
+          return FULLYSPECIFIED;
+        if ("equivalent".equals(codeString))
+          return EQUIVALENT;
+        if ("convertable".equals(codeString))
+          return CONVERTABLE;
+        if ("scaleable".equals(codeString))
+          return SCALEABLE;
+        if ("flexible".equals(codeString))
+          return FLEXIBLE;
+        throw new FHIRException("Unknown DataelementStringency code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COMPARABLE: return "comparable";
+            case FULLYSPECIFIED: return "fully-specified";
+            case EQUIVALENT: return "equivalent";
+            case CONVERTABLE: return "convertable";
+            case SCALEABLE: return "scaleable";
+            case FLEXIBLE: return "flexible";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/dataelement-stringency";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COMPARABLE: return "The data element is sufficiently well-constrained that multiple pieces of data captured according to the constraints of the data element will be comparable (though in some cases, a degree of automated conversion/normalization may be required).";
+            case FULLYSPECIFIED: return "The data element is fully specified down to a single value set, single unit of measure, single data type, etc.  Multiple pieces of data associated with this data element are fully comparable.";
+            case EQUIVALENT: return "The data element allows multiple units of measure having equivalent meaning; e.g. \"cc\" (cubic centimeter) and \"mL\" (milliliter).";
+            case CONVERTABLE: return "The data element allows multiple units of measure that are convertable between each other (e.g. inches and centimeters) and/or allows data to be captured in multiple value sets for which a known mapping exists allowing conversion of meaning.";
+            case SCALEABLE: return "A convertable data element where unit conversions are different only by a power of 10; e.g. g, mg, kg.";
+            case FLEXIBLE: return "The data element is unconstrained in units, choice of data types and/or choice of vocabulary such that automated comparison of data captured using the data element is not possible.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COMPARABLE: return "Comparable";
+            case FULLYSPECIFIED: return "Fully Specified";
+            case EQUIVALENT: return "Equivalent";
+            case CONVERTABLE: return "Convertable";
+            case SCALEABLE: return "Scaleable";
+            case FLEXIBLE: return "Flexible";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataelementStringencyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataelementStringencyEnumFactory.java
new file mode 100644
index 00000000000..23a85f75823
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DataelementStringencyEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DataelementStringencyEnumFactory implements EnumFactory {
+
+  public DataelementStringency fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("comparable".equals(codeString))
+      return DataelementStringency.COMPARABLE;
+    if ("fully-specified".equals(codeString))
+      return DataelementStringency.FULLYSPECIFIED;
+    if ("equivalent".equals(codeString))
+      return DataelementStringency.EQUIVALENT;
+    if ("convertable".equals(codeString))
+      return DataelementStringency.CONVERTABLE;
+    if ("scaleable".equals(codeString))
+      return DataelementStringency.SCALEABLE;
+    if ("flexible".equals(codeString))
+      return DataelementStringency.FLEXIBLE;
+    throw new IllegalArgumentException("Unknown DataelementStringency code '"+codeString+"'");
+  }
+
+  public String toCode(DataelementStringency code) {
+    if (code == DataelementStringency.COMPARABLE)
+      return "comparable";
+    if (code == DataelementStringency.FULLYSPECIFIED)
+      return "fully-specified";
+    if (code == DataelementStringency.EQUIVALENT)
+      return "equivalent";
+    if (code == DataelementStringency.CONVERTABLE)
+      return "convertable";
+    if (code == DataelementStringency.SCALEABLE)
+      return "scaleable";
+    if (code == DataelementStringency.FLEXIBLE)
+      return "flexible";
+    return "?";
+  }
+
+    public String toSystem(DataelementStringency code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DaysOfWeek.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DaysOfWeek.java
new file mode 100644
index 00000000000..4879ca63a6d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DaysOfWeek.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DaysOfWeek {
+
+        /**
+         * Monday
+         */
+        MON, 
+        /**
+         * Tuesday
+         */
+        TUE, 
+        /**
+         * Wednesday
+         */
+        WED, 
+        /**
+         * Thursday
+         */
+        THU, 
+        /**
+         * Friday
+         */
+        FRI, 
+        /**
+         * Saturday
+         */
+        SAT, 
+        /**
+         * Sunday
+         */
+        SUN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DaysOfWeek fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("mon".equals(codeString))
+          return MON;
+        if ("tue".equals(codeString))
+          return TUE;
+        if ("wed".equals(codeString))
+          return WED;
+        if ("thu".equals(codeString))
+          return THU;
+        if ("fri".equals(codeString))
+          return FRI;
+        if ("sat".equals(codeString))
+          return SAT;
+        if ("sun".equals(codeString))
+          return SUN;
+        throw new FHIRException("Unknown DaysOfWeek code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MON: return "mon";
+            case TUE: return "tue";
+            case WED: return "wed";
+            case THU: return "thu";
+            case FRI: return "fri";
+            case SAT: return "sat";
+            case SUN: return "sun";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/days-of-week";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MON: return "Monday";
+            case TUE: return "Tuesday";
+            case WED: return "Wednesday";
+            case THU: return "Thursday";
+            case FRI: return "Friday";
+            case SAT: return "Saturday";
+            case SUN: return "Sunday";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MON: return "Monday";
+            case TUE: return "Tuesday";
+            case WED: return "Wednesday";
+            case THU: return "Thursday";
+            case FRI: return "Friday";
+            case SAT: return "Saturday";
+            case SUN: return "Sunday";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DaysOfWeekEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DaysOfWeekEnumFactory.java
new file mode 100644
index 00000000000..7d7c827aa5d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DaysOfWeekEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DaysOfWeekEnumFactory implements EnumFactory {
+
+  public DaysOfWeek fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("mon".equals(codeString))
+      return DaysOfWeek.MON;
+    if ("tue".equals(codeString))
+      return DaysOfWeek.TUE;
+    if ("wed".equals(codeString))
+      return DaysOfWeek.WED;
+    if ("thu".equals(codeString))
+      return DaysOfWeek.THU;
+    if ("fri".equals(codeString))
+      return DaysOfWeek.FRI;
+    if ("sat".equals(codeString))
+      return DaysOfWeek.SAT;
+    if ("sun".equals(codeString))
+      return DaysOfWeek.SUN;
+    throw new IllegalArgumentException("Unknown DaysOfWeek code '"+codeString+"'");
+  }
+
+  public String toCode(DaysOfWeek code) {
+    if (code == DaysOfWeek.MON)
+      return "mon";
+    if (code == DaysOfWeek.TUE)
+      return "tue";
+    if (code == DaysOfWeek.WED)
+      return "wed";
+    if (code == DaysOfWeek.THU)
+      return "thu";
+    if (code == DaysOfWeek.FRI)
+      return "fri";
+    if (code == DaysOfWeek.SAT)
+      return "sat";
+    if (code == DaysOfWeek.SUN)
+      return "sun";
+    return "?";
+  }
+
+    public String toSystem(DaysOfWeek code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionStatus.java
new file mode 100644
index 00000000000..a2c2ba3fcd5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DefinitionStatus {
+
+        /**
+         * The definition is in the design stage and is not yet considered to be "ready for use"
+         */
+        DRAFT, 
+        /**
+         * The definition is considered ready for use
+         */
+        ACTIVE, 
+        /**
+         * The definition should no longer be used
+         */
+        WITHDRAWN, 
+        /**
+         * 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
+         */
+        NULL;
+        public static DefinitionStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("withdrawn".equals(codeString))
+          return WITHDRAWN;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown DefinitionStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case ACTIVE: return "active";
+            case WITHDRAWN: return "withdrawn";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/definition-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "The definition is in the design stage and is not yet considered to be \"ready for use\"";
+            case ACTIVE: return "The definition is considered ready for use";
+            case WITHDRAWN: return "The definition should no longer be used";
+            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 "Draft";
+            case ACTIVE: return "Active";
+            case WITHDRAWN: return "Withdrawn";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionStatusEnumFactory.java
new file mode 100644
index 00000000000..83b9a951439
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DefinitionStatusEnumFactory implements EnumFactory {
+
+  public DefinitionStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return DefinitionStatus.DRAFT;
+    if ("active".equals(codeString))
+      return DefinitionStatus.ACTIVE;
+    if ("withdrawn".equals(codeString))
+      return DefinitionStatus.WITHDRAWN;
+    if ("unknown".equals(codeString))
+      return DefinitionStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown DefinitionStatus code '"+codeString+"'");
+  }
+
+  public String toCode(DefinitionStatus code) {
+    if (code == DefinitionStatus.DRAFT)
+      return "draft";
+    if (code == DefinitionStatus.ACTIVE)
+      return "active";
+    if (code == DefinitionStatus.WITHDRAWN)
+      return "withdrawn";
+    if (code == DefinitionStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(DefinitionStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionTopic.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionTopic.java
new file mode 100644
index 00000000000..ebc068b4319
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionTopic.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DefinitionTopic {
+
+        /**
+         * The definition is related to treatment of the patient
+         */
+        TREATMENT, 
+        /**
+         * The definition is related to education of the patient
+         */
+        EDUCATION, 
+        /**
+         * The definition is related to assessment of the patient
+         */
+        ASSESSMENT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DefinitionTopic fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("treatment".equals(codeString))
+          return TREATMENT;
+        if ("education".equals(codeString))
+          return EDUCATION;
+        if ("assessment".equals(codeString))
+          return ASSESSMENT;
+        throw new FHIRException("Unknown DefinitionTopic code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case TREATMENT: return "treatment";
+            case EDUCATION: return "education";
+            case ASSESSMENT: return "assessment";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/definition-topic";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case TREATMENT: return "The definition is related to treatment of the patient";
+            case EDUCATION: return "The definition is related to education of the patient";
+            case ASSESSMENT: return "The definition is related to assessment of the patient";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case TREATMENT: return "Treatment";
+            case EDUCATION: return "Education";
+            case ASSESSMENT: return "Assessment";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionTopicEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionTopicEnumFactory.java
new file mode 100644
index 00000000000..80686082003
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DefinitionTopicEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DefinitionTopicEnumFactory implements EnumFactory {
+
+  public DefinitionTopic fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("treatment".equals(codeString))
+      return DefinitionTopic.TREATMENT;
+    if ("education".equals(codeString))
+      return DefinitionTopic.EDUCATION;
+    if ("assessment".equals(codeString))
+      return DefinitionTopic.ASSESSMENT;
+    throw new IllegalArgumentException("Unknown DefinitionTopic code '"+codeString+"'");
+  }
+
+  public String toCode(DefinitionTopic code) {
+    if (code == DefinitionTopic.TREATMENT)
+      return "treatment";
+    if (code == DefinitionTopic.EDUCATION)
+      return "education";
+    if (code == DefinitionTopic.ASSESSMENT)
+      return "assessment";
+    return "?";
+  }
+
+    public String toSystem(DefinitionTopic code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DetectedissueSeverity.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DetectedissueSeverity.java
new file mode 100644
index 00000000000..1f5e8c38ee2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DetectedissueSeverity.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DetectedissueSeverity {
+
+        /**
+         * Indicates the issue may be life-threatening or has the potential to cause permanent injury.
+         */
+        HIGH, 
+        /**
+         * Indicates the issue may result in noticeable adverse consequences but is unlikely to be life-threatening or cause permanent injury.
+         */
+        MODERATE, 
+        /**
+         * Indicates the issue may result in some adverse consequences but is unlikely to substantially affect the situation of the subject.
+         */
+        LOW, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DetectedissueSeverity fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("high".equals(codeString))
+          return HIGH;
+        if ("moderate".equals(codeString))
+          return MODERATE;
+        if ("low".equals(codeString))
+          return LOW;
+        throw new FHIRException("Unknown DetectedissueSeverity code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HIGH: return "high";
+            case MODERATE: return "moderate";
+            case LOW: return "low";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/detectedissue-severity";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HIGH: return "Indicates the issue may be life-threatening or has the potential to cause permanent injury.";
+            case MODERATE: return "Indicates the issue may result in noticeable adverse consequences but is unlikely to be life-threatening or cause permanent injury.";
+            case LOW: return "Indicates the issue may result in some adverse consequences but is unlikely to substantially affect the situation of the subject.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HIGH: return "High";
+            case MODERATE: return "Moderate";
+            case LOW: return "Low";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DetectedissueSeverityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DetectedissueSeverityEnumFactory.java
new file mode 100644
index 00000000000..8255152ba23
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DetectedissueSeverityEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DetectedissueSeverityEnumFactory implements EnumFactory {
+
+  public DetectedissueSeverity fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("high".equals(codeString))
+      return DetectedissueSeverity.HIGH;
+    if ("moderate".equals(codeString))
+      return DetectedissueSeverity.MODERATE;
+    if ("low".equals(codeString))
+      return DetectedissueSeverity.LOW;
+    throw new IllegalArgumentException("Unknown DetectedissueSeverity code '"+codeString+"'");
+  }
+
+  public String toCode(DetectedissueSeverity code) {
+    if (code == DetectedissueSeverity.HIGH)
+      return "high";
+    if (code == DetectedissueSeverity.MODERATE)
+      return "moderate";
+    if (code == DetectedissueSeverity.LOW)
+      return "low";
+    return "?";
+  }
+
+    public String toSystem(DetectedissueSeverity code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceAction.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceAction.java
new file mode 100644
index 00000000000..a443801f1f1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceAction.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DeviceAction {
+
+        /**
+         * The device was implanted in the patient during the procedure.
+         */
+        IMPLANTED, 
+        /**
+         * The device was explanted from the patient during the procedure.
+         */
+        EXPLANTED, 
+        /**
+         * The device remains in that patient, but its location, settings, or functionality was changed.
+         */
+        MANIPULATED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DeviceAction fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("implanted".equals(codeString))
+          return IMPLANTED;
+        if ("explanted".equals(codeString))
+          return EXPLANTED;
+        if ("manipulated".equals(codeString))
+          return MANIPULATED;
+        throw new FHIRException("Unknown DeviceAction code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case IMPLANTED: return "implanted";
+            case EXPLANTED: return "explanted";
+            case MANIPULATED: return "manipulated";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/device-action";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case IMPLANTED: return "The device was implanted in the patient during the procedure.";
+            case EXPLANTED: return "The device was explanted from the patient during the procedure.";
+            case MANIPULATED: return "The device remains in that patient, but its location, settings, or functionality was changed.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case IMPLANTED: return "Implanted";
+            case EXPLANTED: return "Explanted";
+            case MANIPULATED: return "Manipulated";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceActionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceActionEnumFactory.java
new file mode 100644
index 00000000000..fa516b78213
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceActionEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DeviceActionEnumFactory implements EnumFactory {
+
+  public DeviceAction fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("implanted".equals(codeString))
+      return DeviceAction.IMPLANTED;
+    if ("explanted".equals(codeString))
+      return DeviceAction.EXPLANTED;
+    if ("manipulated".equals(codeString))
+      return DeviceAction.MANIPULATED;
+    throw new IllegalArgumentException("Unknown DeviceAction code '"+codeString+"'");
+  }
+
+  public String toCode(DeviceAction code) {
+    if (code == DeviceAction.IMPLANTED)
+      return "implanted";
+    if (code == DeviceAction.EXPLANTED)
+      return "explanted";
+    if (code == DeviceAction.MANIPULATED)
+      return "manipulated";
+    return "?";
+  }
+
+    public String toSystem(DeviceAction code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceSafety.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceSafety.java
new file mode 100644
index 00000000000..50116026bf2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceSafety.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DeviceSafety {
+
+        /**
+         * Indicates that the device or packaging contains natural rubber that contacts humans
+         */
+        CONTAINSLATEX, 
+        /**
+         * Indicates that natural rubber latex was not used as materials in the manufacture of the medical product and container and the device labeling contains this information.
+         */
+        LATEXFREE, 
+        /**
+         * Indicates that whether the device or packaging contains natural rubber that contacts humans is not indicated on the label Not all medical products that are NOT made with natural rubber latex will be marked
+         */
+        LATEXUNKNOWN, 
+        /**
+         * The device, when used in the MRI environment, has been demonstrated to present no additional risk to the patient or other individual, but may affect the quality of the diagnostic information. The MRI conditions in which the device was tested should be specified in conjunction with the term MR safe since a device which is safe under one set of conditions may not be found to be so under more extreme MRI conditions.
+         */
+        MRSAFE, 
+        /**
+         * An item that is known to pose hazards in all MRI environments. MR Unsafe items include magnetic items such as a pair of ferromagnetic scissors.
+         */
+        MRUNSAFE, 
+        /**
+         * An item that has been demonstrated to pose no known hazards in a specified MRI environment with specified conditions of use. Field conditions that define the MRI environment include, for instance, static magnetic field or specific absorption rate (SAR).
+         */
+        MRCONDITIONAL, 
+        /**
+         * Labeling does not contain MRI Safety information
+         */
+        MRUNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DeviceSafety fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("contains-latex".equals(codeString))
+          return CONTAINSLATEX;
+        if ("latex-free".equals(codeString))
+          return LATEXFREE;
+        if ("latex-unknown".equals(codeString))
+          return LATEXUNKNOWN;
+        if ("mr-safe".equals(codeString))
+          return MRSAFE;
+        if ("mr-unsafe".equals(codeString))
+          return MRUNSAFE;
+        if ("mr-conditional".equals(codeString))
+          return MRCONDITIONAL;
+        if ("mr-unknown".equals(codeString))
+          return MRUNKNOWN;
+        throw new FHIRException("Unknown DeviceSafety code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CONTAINSLATEX: return "contains-latex";
+            case LATEXFREE: return "latex-free";
+            case LATEXUNKNOWN: return "latex-unknown";
+            case MRSAFE: return "mr-safe";
+            case MRUNSAFE: return "mr-unsafe";
+            case MRCONDITIONAL: return "mr-conditional";
+            case MRUNKNOWN: return "mr-unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/device-safety";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CONTAINSLATEX: return "Indicates that the device or packaging contains natural rubber that contacts humans";
+            case LATEXFREE: return "Indicates that natural rubber latex was not used as materials in the manufacture of the medical product and container and the device labeling contains this information.";
+            case LATEXUNKNOWN: return "Indicates that whether the device or packaging contains natural rubber that contacts humans is not indicated on the label Not all medical products that are NOT made with natural rubber latex will be marked";
+            case MRSAFE: return "The device, when used in the MRI environment, has been demonstrated to present no additional risk to the patient or other individual, but may affect the quality of the diagnostic information. The MRI conditions in which the device was tested should be specified in conjunction with the term MR safe since a device which is safe under one set of conditions may not be found to be so under more extreme MRI conditions.";
+            case MRUNSAFE: return "An item that is known to pose hazards in all MRI environments. MR Unsafe items include magnetic items such as a pair of ferromagnetic scissors.";
+            case MRCONDITIONAL: return "An item that has been demonstrated to pose no known hazards in a specified MRI environment with specified conditions of use. Field conditions that define the MRI environment include, for instance, static magnetic field or specific absorption rate (SAR).";
+            case MRUNKNOWN: return "Labeling does not contain MRI Safety information";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CONTAINSLATEX: return "Contains Latex";
+            case LATEXFREE: return "Latex Free";
+            case LATEXUNKNOWN: return "Latex Unknown";
+            case MRSAFE: return "MR Safe";
+            case MRUNSAFE: return "MR Unsafe";
+            case MRCONDITIONAL: return "MR Conditional";
+            case MRUNKNOWN: return "MR Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceSafetyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceSafetyEnumFactory.java
new file mode 100644
index 00000000000..c4e3278a6ea
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceSafetyEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DeviceSafetyEnumFactory implements EnumFactory {
+
+  public DeviceSafety fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("contains-latex".equals(codeString))
+      return DeviceSafety.CONTAINSLATEX;
+    if ("latex-free".equals(codeString))
+      return DeviceSafety.LATEXFREE;
+    if ("latex-unknown".equals(codeString))
+      return DeviceSafety.LATEXUNKNOWN;
+    if ("mr-safe".equals(codeString))
+      return DeviceSafety.MRSAFE;
+    if ("mr-unsafe".equals(codeString))
+      return DeviceSafety.MRUNSAFE;
+    if ("mr-conditional".equals(codeString))
+      return DeviceSafety.MRCONDITIONAL;
+    if ("mr-unknown".equals(codeString))
+      return DeviceSafety.MRUNKNOWN;
+    throw new IllegalArgumentException("Unknown DeviceSafety code '"+codeString+"'");
+  }
+
+  public String toCode(DeviceSafety code) {
+    if (code == DeviceSafety.CONTAINSLATEX)
+      return "contains-latex";
+    if (code == DeviceSafety.LATEXFREE)
+      return "latex-free";
+    if (code == DeviceSafety.LATEXUNKNOWN)
+      return "latex-unknown";
+    if (code == DeviceSafety.MRSAFE)
+      return "mr-safe";
+    if (code == DeviceSafety.MRUNSAFE)
+      return "mr-unsafe";
+    if (code == DeviceSafety.MRCONDITIONAL)
+      return "mr-conditional";
+    if (code == DeviceSafety.MRUNKNOWN)
+      return "mr-unknown";
+    return "?";
+  }
+
+    public String toSystem(DeviceSafety code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatementStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatementStatus.java
new file mode 100644
index 00000000000..cdba1c04323
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatementStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DeviceStatementStatus {
+
+        /**
+         * The device is still being used.
+         */
+        ACTIVE, 
+        /**
+         * The device is no longer being used.
+         */
+        COMPLETED, 
+        /**
+         * The statement was recorded incorrectly.
+         */
+        ENTEREDINERROR, 
+        /**
+         * The device may be used at some time in the future.
+         */
+        INTENDED, 
+        /**
+         * Actions implied by the statement have been permanently halted, before all of them occurred.
+         */
+        STOPPED, 
+        /**
+         * Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called "suspended".
+         */
+        ONHOLD, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DeviceStatementStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("intended".equals(codeString))
+          return INTENDED;
+        if ("stopped".equals(codeString))
+          return STOPPED;
+        if ("on-hold".equals(codeString))
+          return ONHOLD;
+        throw new FHIRException("Unknown DeviceStatementStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case INTENDED: return "intended";
+            case STOPPED: return "stopped";
+            case ONHOLD: return "on-hold";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/device-statement-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The device is still being used.";
+            case COMPLETED: return "The device is no longer being used.";
+            case ENTEREDINERROR: return "The statement was recorded incorrectly.";
+            case INTENDED: return "The device may be used at some time in the future.";
+            case STOPPED: return "Actions implied by the statement have been permanently halted, before all of them occurred.";
+            case ONHOLD: return "Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called \"suspended\".";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            case INTENDED: return "Intended";
+            case STOPPED: return "Stopped";
+            case ONHOLD: return "On Hold";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatementStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatementStatusEnumFactory.java
new file mode 100644
index 00000000000..831ee212e22
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatementStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DeviceStatementStatusEnumFactory implements EnumFactory {
+
+  public DeviceStatementStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return DeviceStatementStatus.ACTIVE;
+    if ("completed".equals(codeString))
+      return DeviceStatementStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return DeviceStatementStatus.ENTEREDINERROR;
+    if ("intended".equals(codeString))
+      return DeviceStatementStatus.INTENDED;
+    if ("stopped".equals(codeString))
+      return DeviceStatementStatus.STOPPED;
+    if ("on-hold".equals(codeString))
+      return DeviceStatementStatus.ONHOLD;
+    throw new IllegalArgumentException("Unknown DeviceStatementStatus code '"+codeString+"'");
+  }
+
+  public String toCode(DeviceStatementStatus code) {
+    if (code == DeviceStatementStatus.ACTIVE)
+      return "active";
+    if (code == DeviceStatementStatus.COMPLETED)
+      return "completed";
+    if (code == DeviceStatementStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == DeviceStatementStatus.INTENDED)
+      return "intended";
+    if (code == DeviceStatementStatus.STOPPED)
+      return "stopped";
+    if (code == DeviceStatementStatus.ONHOLD)
+      return "on-hold";
+    return "?";
+  }
+
+    public String toSystem(DeviceStatementStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatus.java
new file mode 100644
index 00000000000..d5ccb36916d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DeviceStatus {
+
+        /**
+         * The Device is available for use.  Note: This means for *implanted devices*  the device is implanted in the patient.
+         */
+        ACTIVE, 
+        /**
+         * The Device is no longer available for use (e.g. lost, expired, damaged).  Note: This means for *implanted devices*  the device has been removed from the patient.
+         */
+        INACTIVE, 
+        /**
+         * The Device was entered in error and voided.
+         */
+        ENTEREDINERROR, 
+        /**
+         * The status of the device has not been determined.
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DeviceStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown DeviceStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case INACTIVE: return "inactive";
+            case ENTEREDINERROR: return "entered-in-error";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/device-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The Device is available for use.  Note: This means for *implanted devices*  the device is implanted in the patient.";
+            case INACTIVE: return "The Device is no longer available for use (e.g. lost, expired, damaged).  Note: This means for *implanted devices*  the device has been removed from the patient.";
+            case ENTEREDINERROR: return "The Device was entered in error and voided.";
+            case UNKNOWN: return "The status of the device has not been determined.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case INACTIVE: return "Inactive";
+            case ENTEREDINERROR: return "Entered in Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatusEnumFactory.java
new file mode 100644
index 00000000000..64e4d361f1c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DeviceStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DeviceStatusEnumFactory implements EnumFactory {
+
+  public DeviceStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return DeviceStatus.ACTIVE;
+    if ("inactive".equals(codeString))
+      return DeviceStatus.INACTIVE;
+    if ("entered-in-error".equals(codeString))
+      return DeviceStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return DeviceStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown DeviceStatus code '"+codeString+"'");
+  }
+
+  public String toCode(DeviceStatus code) {
+    if (code == DeviceStatus.ACTIVE)
+      return "active";
+    if (code == DeviceStatus.INACTIVE)
+      return "inactive";
+    if (code == DeviceStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == DeviceStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(DeviceStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosisRole.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosisRole.java
new file mode 100644
index 00000000000..c8dc9532ff9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosisRole.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DiagnosisRole {
+
+        /**
+         * null
+         */
+        AD, 
+        /**
+         * null
+         */
+        DD, 
+        /**
+         * null
+         */
+        CC, 
+        /**
+         * null
+         */
+        CM, 
+        /**
+         * null
+         */
+        PREOP, 
+        /**
+         * null
+         */
+        POSTOP, 
+        /**
+         * null
+         */
+        BILLING, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DiagnosisRole fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AD".equals(codeString))
+          return AD;
+        if ("DD".equals(codeString))
+          return DD;
+        if ("CC".equals(codeString))
+          return CC;
+        if ("CM".equals(codeString))
+          return CM;
+        if ("pre-op".equals(codeString))
+          return PREOP;
+        if ("post-op".equals(codeString))
+          return POSTOP;
+        if ("billing".equals(codeString))
+          return BILLING;
+        throw new FHIRException("Unknown DiagnosisRole code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AD: return "AD";
+            case DD: return "DD";
+            case CC: return "CC";
+            case CM: return "CM";
+            case PREOP: return "pre-op";
+            case POSTOP: return "post-op";
+            case BILLING: return "billing";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/diagnosis-role";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AD: return "";
+            case DD: return "";
+            case CC: return "";
+            case CM: return "";
+            case PREOP: return "";
+            case POSTOP: return "";
+            case BILLING: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AD: return "Admission diagnosis";
+            case DD: return "Discharge diagnosis";
+            case CC: return "Chief complaint";
+            case CM: return "Comorbidity diagnosis";
+            case PREOP: return "pre-op diagnosis";
+            case POSTOP: return "post-op diagnosis";
+            case BILLING: return "Billing";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosisRoleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosisRoleEnumFactory.java
new file mode 100644
index 00000000000..971a1f3b3ed
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosisRoleEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DiagnosisRoleEnumFactory implements EnumFactory {
+
+  public DiagnosisRole fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AD".equals(codeString))
+      return DiagnosisRole.AD;
+    if ("DD".equals(codeString))
+      return DiagnosisRole.DD;
+    if ("CC".equals(codeString))
+      return DiagnosisRole.CC;
+    if ("CM".equals(codeString))
+      return DiagnosisRole.CM;
+    if ("pre-op".equals(codeString))
+      return DiagnosisRole.PREOP;
+    if ("post-op".equals(codeString))
+      return DiagnosisRole.POSTOP;
+    if ("billing".equals(codeString))
+      return DiagnosisRole.BILLING;
+    throw new IllegalArgumentException("Unknown DiagnosisRole code '"+codeString+"'");
+  }
+
+  public String toCode(DiagnosisRole code) {
+    if (code == DiagnosisRole.AD)
+      return "AD";
+    if (code == DiagnosisRole.DD)
+      return "DD";
+    if (code == DiagnosisRole.CC)
+      return "CC";
+    if (code == DiagnosisRole.CM)
+      return "CM";
+    if (code == DiagnosisRole.PREOP)
+      return "pre-op";
+    if (code == DiagnosisRole.POSTOP)
+      return "post-op";
+    if (code == DiagnosisRole.BILLING)
+      return "billing";
+    return "?";
+  }
+
+    public String toSystem(DiagnosisRole code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosticReportStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosticReportStatus.java
new file mode 100644
index 00000000000..30b260012d9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosticReportStatus.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DiagnosticReportStatus {
+
+        /**
+         * The existence of the report is registered, but there is nothing yet available.
+         */
+        REGISTERED, 
+        /**
+         * This is a partial (e.g. initial, interim or preliminary) report: data in the report may be incomplete or unverified.
+         */
+        PARTIAL, 
+        /**
+         * Verified early results are available, but not all  results are final.
+         */
+        PRELIMINARY, 
+        /**
+         * The report is complete and verified by an authorized person.
+         */
+        FINAL, 
+        /**
+         * Subsequent to being final, the report has been modified.  This includes any change in the results, diagnosis, narrative text, or other content of a report that has been issued.
+         */
+        AMENDED, 
+        /**
+         * Subsequent to being final, the report has been modified  to correct an error in the report or referenced results.
+         */
+        CORRECTED, 
+        /**
+         * Subsequent to being final, the report has been modified by adding new content. The existing content is unchanged.
+         */
+        APPENDED, 
+        /**
+         * The report is unavailable because the measurement was not started or not completed (also sometimes called "aborted").
+         */
+        CANCELLED, 
+        /**
+         * The report has been withdrawn following a previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".)
+         */
+        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
+         */
+        NULL;
+        public static DiagnosticReportStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("registered".equals(codeString))
+          return REGISTERED;
+        if ("partial".equals(codeString))
+          return PARTIAL;
+        if ("preliminary".equals(codeString))
+          return PRELIMINARY;
+        if ("final".equals(codeString))
+          return FINAL;
+        if ("amended".equals(codeString))
+          return AMENDED;
+        if ("corrected".equals(codeString))
+          return CORRECTED;
+        if ("appended".equals(codeString))
+          return APPENDED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown DiagnosticReportStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REGISTERED: return "registered";
+            case PARTIAL: return "partial";
+            case PRELIMINARY: return "preliminary";
+            case FINAL: return "final";
+            case AMENDED: return "amended";
+            case CORRECTED: return "corrected";
+            case APPENDED: return "appended";
+            case CANCELLED: return "cancelled";
+            case ENTEREDINERROR: return "entered-in-error";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/diagnostic-report-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REGISTERED: return "The existence of the report is registered, but there is nothing yet available.";
+            case PARTIAL: return "This is a partial (e.g. initial, interim or preliminary) report: data in the report may be incomplete or unverified.";
+            case PRELIMINARY: return "Verified early results are available, but not all  results are final.";
+            case FINAL: return "The report is complete and verified by an authorized person.";
+            case AMENDED: return "Subsequent to being final, the report has been modified.  This includes any change in the results, diagnosis, narrative text, or other content of a report that has been issued.";
+            case CORRECTED: return "Subsequent to being final, the report has been modified  to correct an error in the report or referenced results.";
+            case APPENDED: return "Subsequent to being final, the report has been modified by adding new content. The existing content is unchanged.";
+            case CANCELLED: return "The report is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
+            case ENTEREDINERROR: return "The report has been withdrawn following a previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".)";
+            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 REGISTERED: return "Registered";
+            case PARTIAL: return "Partial";
+            case PRELIMINARY: return "Preliminary";
+            case FINAL: return "Final";
+            case AMENDED: return "Amended";
+            case CORRECTED: return "Corrected";
+            case APPENDED: return "Appended";
+            case CANCELLED: return "Cancelled";
+            case ENTEREDINERROR: return "Entered in Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosticReportStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosticReportStatusEnumFactory.java
new file mode 100644
index 00000000000..3704d4c6d72
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiagnosticReportStatusEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DiagnosticReportStatusEnumFactory implements EnumFactory {
+
+  public DiagnosticReportStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("registered".equals(codeString))
+      return DiagnosticReportStatus.REGISTERED;
+    if ("partial".equals(codeString))
+      return DiagnosticReportStatus.PARTIAL;
+    if ("preliminary".equals(codeString))
+      return DiagnosticReportStatus.PRELIMINARY;
+    if ("final".equals(codeString))
+      return DiagnosticReportStatus.FINAL;
+    if ("amended".equals(codeString))
+      return DiagnosticReportStatus.AMENDED;
+    if ("corrected".equals(codeString))
+      return DiagnosticReportStatus.CORRECTED;
+    if ("appended".equals(codeString))
+      return DiagnosticReportStatus.APPENDED;
+    if ("cancelled".equals(codeString))
+      return DiagnosticReportStatus.CANCELLED;
+    if ("entered-in-error".equals(codeString))
+      return DiagnosticReportStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return DiagnosticReportStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown DiagnosticReportStatus code '"+codeString+"'");
+  }
+
+  public String toCode(DiagnosticReportStatus code) {
+    if (code == DiagnosticReportStatus.REGISTERED)
+      return "registered";
+    if (code == DiagnosticReportStatus.PARTIAL)
+      return "partial";
+    if (code == DiagnosticReportStatus.PRELIMINARY)
+      return "preliminary";
+    if (code == DiagnosticReportStatus.FINAL)
+      return "final";
+    if (code == DiagnosticReportStatus.AMENDED)
+      return "amended";
+    if (code == DiagnosticReportStatus.CORRECTED)
+      return "corrected";
+    if (code == DiagnosticReportStatus.APPENDED)
+      return "appended";
+    if (code == DiagnosticReportStatus.CANCELLED)
+      return "cancelled";
+    if (code == DiagnosticReportStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == DiagnosticReportStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(DiagnosticReportStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DicomAuditLifecycle.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DicomAuditLifecycle.java
new file mode 100644
index 00000000000..a202285f0f4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DicomAuditLifecycle.java
@@ -0,0 +1,204 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DicomAuditLifecycle {
+
+        /**
+         * null
+         */
+        _1, 
+        /**
+         * null
+         */
+        _2, 
+        /**
+         * null
+         */
+        _3, 
+        /**
+         * null
+         */
+        _4, 
+        /**
+         * null
+         */
+        _5, 
+        /**
+         * null
+         */
+        _6, 
+        /**
+         * null
+         */
+        _7, 
+        /**
+         * null
+         */
+        _8, 
+        /**
+         * null
+         */
+        _9, 
+        /**
+         * null
+         */
+        _10, 
+        /**
+         * null
+         */
+        _11, 
+        /**
+         * null
+         */
+        _12, 
+        /**
+         * null
+         */
+        _13, 
+        /**
+         * null
+         */
+        _14, 
+        /**
+         * null
+         */
+        _15, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DicomAuditLifecycle fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("6".equals(codeString))
+          return _6;
+        if ("7".equals(codeString))
+          return _7;
+        if ("8".equals(codeString))
+          return _8;
+        if ("9".equals(codeString))
+          return _9;
+        if ("10".equals(codeString))
+          return _10;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        throw new FHIRException("Unknown DicomAuditLifecycle code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _8: return "8";
+            case _9: return "9";
+            case _10: return "10";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/dicom-audit-lifecycle";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "";
+            case _2: return "";
+            case _3: return "";
+            case _4: return "";
+            case _5: return "";
+            case _6: return "";
+            case _7: return "";
+            case _8: return "";
+            case _9: return "";
+            case _10: return "";
+            case _11: return "";
+            case _12: return "";
+            case _13: return "";
+            case _14: return "";
+            case _15: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Origination / Creation";
+            case _2: return "Import / Copy";
+            case _3: return "Amendment";
+            case _4: return "Verification";
+            case _5: return "Translation";
+            case _6: return "Access / Use";
+            case _7: return "De-identification";
+            case _8: return "Aggregation / summarization / derivation";
+            case _9: return "Report";
+            case _10: return "Export";
+            case _11: return "Disclosure";
+            case _12: return "Receipt of disclosure";
+            case _13: return "Archiving";
+            case _14: return "Logical deletion";
+            case _15: return "Permanent erasure / Physical destruction";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DicomAuditLifecycleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DicomAuditLifecycleEnumFactory.java
new file mode 100644
index 00000000000..d780de0286b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DicomAuditLifecycleEnumFactory.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DicomAuditLifecycleEnumFactory implements EnumFactory {
+
+  public DicomAuditLifecycle fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return DicomAuditLifecycle._1;
+    if ("2".equals(codeString))
+      return DicomAuditLifecycle._2;
+    if ("3".equals(codeString))
+      return DicomAuditLifecycle._3;
+    if ("4".equals(codeString))
+      return DicomAuditLifecycle._4;
+    if ("5".equals(codeString))
+      return DicomAuditLifecycle._5;
+    if ("6".equals(codeString))
+      return DicomAuditLifecycle._6;
+    if ("7".equals(codeString))
+      return DicomAuditLifecycle._7;
+    if ("8".equals(codeString))
+      return DicomAuditLifecycle._8;
+    if ("9".equals(codeString))
+      return DicomAuditLifecycle._9;
+    if ("10".equals(codeString))
+      return DicomAuditLifecycle._10;
+    if ("11".equals(codeString))
+      return DicomAuditLifecycle._11;
+    if ("12".equals(codeString))
+      return DicomAuditLifecycle._12;
+    if ("13".equals(codeString))
+      return DicomAuditLifecycle._13;
+    if ("14".equals(codeString))
+      return DicomAuditLifecycle._14;
+    if ("15".equals(codeString))
+      return DicomAuditLifecycle._15;
+    throw new IllegalArgumentException("Unknown DicomAuditLifecycle code '"+codeString+"'");
+  }
+
+  public String toCode(DicomAuditLifecycle code) {
+    if (code == DicomAuditLifecycle._1)
+      return "1";
+    if (code == DicomAuditLifecycle._2)
+      return "2";
+    if (code == DicomAuditLifecycle._3)
+      return "3";
+    if (code == DicomAuditLifecycle._4)
+      return "4";
+    if (code == DicomAuditLifecycle._5)
+      return "5";
+    if (code == DicomAuditLifecycle._6)
+      return "6";
+    if (code == DicomAuditLifecycle._7)
+      return "7";
+    if (code == DicomAuditLifecycle._8)
+      return "8";
+    if (code == DicomAuditLifecycle._9)
+      return "9";
+    if (code == DicomAuditLifecycle._10)
+      return "10";
+    if (code == DicomAuditLifecycle._11)
+      return "11";
+    if (code == DicomAuditLifecycle._12)
+      return "12";
+    if (code == DicomAuditLifecycle._13)
+      return "13";
+    if (code == DicomAuditLifecycle._14)
+      return "14";
+    if (code == DicomAuditLifecycle._15)
+      return "15";
+    return "?";
+  }
+
+    public String toSystem(DicomAuditLifecycle code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaSubtype.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaSubtype.java
new file mode 100644
index 00000000000..391dc54cc6a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaSubtype.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DigitalMediaSubtype {
+
+        /**
+         * A diagram. Often used in diagnostic reports
+         */
+        DIAGRAM, 
+        /**
+         * A digital record of a fax document
+         */
+        FAX, 
+        /**
+         * A digital scan of a document. This is reserved for when there is not enough metadata to create a document reference
+         */
+        SCAN, 
+        /**
+         * A retinal image used for identification purposes
+         */
+        RETINA, 
+        /**
+         * A finger print scan used for identification purposes
+         */
+        FINGERPRINT, 
+        /**
+         * An iris scan used for identification purposes
+         */
+        IRIS, 
+        /**
+         * A palm scan used for identification purposes
+         */
+        PALM, 
+        /**
+         * A face scan used for identification purposes
+         */
+        FACE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DigitalMediaSubtype fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("diagram".equals(codeString))
+          return DIAGRAM;
+        if ("fax".equals(codeString))
+          return FAX;
+        if ("scan".equals(codeString))
+          return SCAN;
+        if ("retina".equals(codeString))
+          return RETINA;
+        if ("fingerprint".equals(codeString))
+          return FINGERPRINT;
+        if ("iris".equals(codeString))
+          return IRIS;
+        if ("palm".equals(codeString))
+          return PALM;
+        if ("face".equals(codeString))
+          return FACE;
+        throw new FHIRException("Unknown DigitalMediaSubtype code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DIAGRAM: return "diagram";
+            case FAX: return "fax";
+            case SCAN: return "scan";
+            case RETINA: return "retina";
+            case FINGERPRINT: return "fingerprint";
+            case IRIS: return "iris";
+            case PALM: return "palm";
+            case FACE: return "face";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/media-subtype";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DIAGRAM: return "A diagram. Often used in diagnostic reports";
+            case FAX: return "A digital record of a fax document";
+            case SCAN: return "A digital scan of a document. This is reserved for when there is not enough metadata to create a document reference";
+            case RETINA: return "A retinal image used for identification purposes";
+            case FINGERPRINT: return "A finger print scan used for identification purposes";
+            case IRIS: return "An iris scan used for identification purposes";
+            case PALM: return "A palm scan used for identification purposes";
+            case FACE: return "A face scan used for identification purposes";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DIAGRAM: return "Diagram";
+            case FAX: return "Fax";
+            case SCAN: return "Scanned Document";
+            case RETINA: return "Retina scan";
+            case FINGERPRINT: return "Fingerprint";
+            case IRIS: return "Iris";
+            case PALM: return "Palm";
+            case FACE: return "Face";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaSubtypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaSubtypeEnumFactory.java
new file mode 100644
index 00000000000..88ea3938449
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaSubtypeEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DigitalMediaSubtypeEnumFactory implements EnumFactory {
+
+  public DigitalMediaSubtype fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("diagram".equals(codeString))
+      return DigitalMediaSubtype.DIAGRAM;
+    if ("fax".equals(codeString))
+      return DigitalMediaSubtype.FAX;
+    if ("scan".equals(codeString))
+      return DigitalMediaSubtype.SCAN;
+    if ("retina".equals(codeString))
+      return DigitalMediaSubtype.RETINA;
+    if ("fingerprint".equals(codeString))
+      return DigitalMediaSubtype.FINGERPRINT;
+    if ("iris".equals(codeString))
+      return DigitalMediaSubtype.IRIS;
+    if ("palm".equals(codeString))
+      return DigitalMediaSubtype.PALM;
+    if ("face".equals(codeString))
+      return DigitalMediaSubtype.FACE;
+    throw new IllegalArgumentException("Unknown DigitalMediaSubtype code '"+codeString+"'");
+  }
+
+  public String toCode(DigitalMediaSubtype code) {
+    if (code == DigitalMediaSubtype.DIAGRAM)
+      return "diagram";
+    if (code == DigitalMediaSubtype.FAX)
+      return "fax";
+    if (code == DigitalMediaSubtype.SCAN)
+      return "scan";
+    if (code == DigitalMediaSubtype.RETINA)
+      return "retina";
+    if (code == DigitalMediaSubtype.FINGERPRINT)
+      return "fingerprint";
+    if (code == DigitalMediaSubtype.IRIS)
+      return "iris";
+    if (code == DigitalMediaSubtype.PALM)
+      return "palm";
+    if (code == DigitalMediaSubtype.FACE)
+      return "face";
+    return "?";
+  }
+
+    public String toSystem(DigitalMediaSubtype code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaType.java
new file mode 100644
index 00000000000..c91b58408fd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DigitalMediaType {
+
+        /**
+         * The media consists of one or more unmoving images, including photographs, computer-generated graphs and charts, and scanned documents
+         */
+        PHOTO, 
+        /**
+         * The media consists of a series of frames that capture a moving image
+         */
+        VIDEO, 
+        /**
+         * The media consists of a sound recording
+         */
+        AUDIO, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DigitalMediaType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("photo".equals(codeString))
+          return PHOTO;
+        if ("video".equals(codeString))
+          return VIDEO;
+        if ("audio".equals(codeString))
+          return AUDIO;
+        throw new FHIRException("Unknown DigitalMediaType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PHOTO: return "photo";
+            case VIDEO: return "video";
+            case AUDIO: return "audio";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/digital-media-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PHOTO: return "The media consists of one or more unmoving images, including photographs, computer-generated graphs and charts, and scanned documents";
+            case VIDEO: return "The media consists of a series of frames that capture a moving image";
+            case AUDIO: return "The media consists of a sound recording";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PHOTO: return "Photo";
+            case VIDEO: return "Video";
+            case AUDIO: return "Audio";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaTypeEnumFactory.java
new file mode 100644
index 00000000000..0a174e94650
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DigitalMediaTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DigitalMediaTypeEnumFactory implements EnumFactory {
+
+  public DigitalMediaType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("photo".equals(codeString))
+      return DigitalMediaType.PHOTO;
+    if ("video".equals(codeString))
+      return DigitalMediaType.VIDEO;
+    if ("audio".equals(codeString))
+      return DigitalMediaType.AUDIO;
+    throw new IllegalArgumentException("Unknown DigitalMediaType code '"+codeString+"'");
+  }
+
+  public String toCode(DigitalMediaType code) {
+    if (code == DigitalMediaType.PHOTO)
+      return "photo";
+    if (code == DigitalMediaType.VIDEO)
+      return "video";
+    if (code == DigitalMediaType.AUDIO)
+      return "audio";
+    return "?";
+  }
+
+    public String toSystem(DigitalMediaType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiscriminatorType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiscriminatorType.java
new file mode 100644
index 00000000000..c67e27e7682
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiscriminatorType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DiscriminatorType {
+
+        /**
+         * The slices have different values in the nominated element
+         */
+        VALUE, 
+        /**
+         * The slices are differentiated by the presence or absence of the nominated element
+         */
+        EXISTS, 
+        /**
+         * The slices have different values in the nominated element, as determined by testing them against the applicable ElementDefinition.pattern[x]
+         */
+        PATTERN, 
+        /**
+         * The slices are differentiated by type of the nominated element to a specifed profile
+         */
+        TYPE, 
+        /**
+         * The slices are differentiated by conformance of the nominated element to a specifed profile
+         */
+        PROFILE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DiscriminatorType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("value".equals(codeString))
+          return VALUE;
+        if ("exists".equals(codeString))
+          return EXISTS;
+        if ("pattern".equals(codeString))
+          return PATTERN;
+        if ("type".equals(codeString))
+          return TYPE;
+        if ("profile".equals(codeString))
+          return PROFILE;
+        throw new FHIRException("Unknown DiscriminatorType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case VALUE: return "value";
+            case EXISTS: return "exists";
+            case PATTERN: return "pattern";
+            case TYPE: return "type";
+            case PROFILE: return "profile";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/discriminator-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case VALUE: return "The slices have different values in the nominated element";
+            case EXISTS: return "The slices are differentiated by the presence or absence of the nominated element";
+            case PATTERN: return "The slices have different values in the nominated element, as determined by testing them against the applicable ElementDefinition.pattern[x]";
+            case TYPE: return "The slices are differentiated by type of the nominated element to a specifed profile";
+            case PROFILE: return "The slices are differentiated by conformance of the nominated element to a specifed profile";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case VALUE: return "Value";
+            case EXISTS: return "Exists";
+            case PATTERN: return "Pattern";
+            case TYPE: return "Type";
+            case PROFILE: return "Profile";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiscriminatorTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiscriminatorTypeEnumFactory.java
new file mode 100644
index 00000000000..11d789becd1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DiscriminatorTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DiscriminatorTypeEnumFactory implements EnumFactory {
+
+  public DiscriminatorType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("value".equals(codeString))
+      return DiscriminatorType.VALUE;
+    if ("exists".equals(codeString))
+      return DiscriminatorType.EXISTS;
+    if ("pattern".equals(codeString))
+      return DiscriminatorType.PATTERN;
+    if ("type".equals(codeString))
+      return DiscriminatorType.TYPE;
+    if ("profile".equals(codeString))
+      return DiscriminatorType.PROFILE;
+    throw new IllegalArgumentException("Unknown DiscriminatorType code '"+codeString+"'");
+  }
+
+  public String toCode(DiscriminatorType code) {
+    if (code == DiscriminatorType.VALUE)
+      return "value";
+    if (code == DiscriminatorType.EXISTS)
+      return "exists";
+    if (code == DiscriminatorType.PATTERN)
+      return "pattern";
+    if (code == DiscriminatorType.TYPE)
+      return "type";
+    if (code == DiscriminatorType.PROFILE)
+      return "profile";
+    return "?";
+  }
+
+    public String toSystem(DiscriminatorType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentMode.java
new file mode 100644
index 00000000000..243e3d8f1f5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentMode.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DocumentMode {
+
+        /**
+         * The application produces documents of the specified type.
+         */
+        PRODUCER, 
+        /**
+         * The application consumes documents of the specified type.
+         */
+        CONSUMER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DocumentMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("producer".equals(codeString))
+          return PRODUCER;
+        if ("consumer".equals(codeString))
+          return CONSUMER;
+        throw new FHIRException("Unknown DocumentMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PRODUCER: return "producer";
+            case CONSUMER: return "consumer";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/document-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PRODUCER: return "The application produces documents of the specified type.";
+            case CONSUMER: return "The application consumes documents of the specified type.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PRODUCER: return "Producer";
+            case CONSUMER: return "Consumer";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentModeEnumFactory.java
new file mode 100644
index 00000000000..dd6c13e3f7f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentModeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DocumentModeEnumFactory implements EnumFactory {
+
+  public DocumentMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("producer".equals(codeString))
+      return DocumentMode.PRODUCER;
+    if ("consumer".equals(codeString))
+      return DocumentMode.CONSUMER;
+    throw new IllegalArgumentException("Unknown DocumentMode code '"+codeString+"'");
+  }
+
+  public String toCode(DocumentMode code) {
+    if (code == DocumentMode.PRODUCER)
+      return "producer";
+    if (code == DocumentMode.CONSUMER)
+      return "consumer";
+    return "?";
+  }
+
+    public String toSystem(DocumentMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentReferenceStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentReferenceStatus.java
new file mode 100644
index 00000000000..128bac6144a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentReferenceStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DocumentReferenceStatus {
+
+        /**
+         * This is the current reference for this document.
+         */
+        CURRENT, 
+        /**
+         * This reference has been superseded by another reference.
+         */
+        SUPERSEDED, 
+        /**
+         * This reference was created in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DocumentReferenceStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("current".equals(codeString))
+          return CURRENT;
+        if ("superseded".equals(codeString))
+          return SUPERSEDED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown DocumentReferenceStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CURRENT: return "current";
+            case SUPERSEDED: return "superseded";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/document-reference-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CURRENT: return "This is the current reference for this document.";
+            case SUPERSEDED: return "This reference has been superseded by another reference.";
+            case ENTEREDINERROR: return "This reference was created in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CURRENT: return "Current";
+            case SUPERSEDED: return "Superseded";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentReferenceStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentReferenceStatusEnumFactory.java
new file mode 100644
index 00000000000..94b94c6ccd6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentReferenceStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DocumentReferenceStatusEnumFactory implements EnumFactory {
+
+  public DocumentReferenceStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("current".equals(codeString))
+      return DocumentReferenceStatus.CURRENT;
+    if ("superseded".equals(codeString))
+      return DocumentReferenceStatus.SUPERSEDED;
+    if ("entered-in-error".equals(codeString))
+      return DocumentReferenceStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown DocumentReferenceStatus code '"+codeString+"'");
+  }
+
+  public String toCode(DocumentReferenceStatus code) {
+    if (code == DocumentReferenceStatus.CURRENT)
+      return "current";
+    if (code == DocumentReferenceStatus.SUPERSEDED)
+      return "superseded";
+    if (code == DocumentReferenceStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(DocumentReferenceStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentRelationshipType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentRelationshipType.java
new file mode 100644
index 00000000000..d51449c5f50
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentRelationshipType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum DocumentRelationshipType {
+
+        /**
+         * This document logically replaces or supersedes the target document.
+         */
+        REPLACES, 
+        /**
+         * This document was generated by transforming the target document (e.g. format or language conversion).
+         */
+        TRANSFORMS, 
+        /**
+         * This document is a signature of the target document.
+         */
+        SIGNS, 
+        /**
+         * This document adds additional information to the target document.
+         */
+        APPENDS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static DocumentRelationshipType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("replaces".equals(codeString))
+          return REPLACES;
+        if ("transforms".equals(codeString))
+          return TRANSFORMS;
+        if ("signs".equals(codeString))
+          return SIGNS;
+        if ("appends".equals(codeString))
+          return APPENDS;
+        throw new FHIRException("Unknown DocumentRelationshipType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REPLACES: return "replaces";
+            case TRANSFORMS: return "transforms";
+            case SIGNS: return "signs";
+            case APPENDS: return "appends";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/document-relationship-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REPLACES: return "This document logically replaces or supersedes the target document.";
+            case TRANSFORMS: return "This document was generated by transforming the target document (e.g. format or language conversion).";
+            case SIGNS: return "This document is a signature of the target document.";
+            case APPENDS: return "This document adds additional information to the target document.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REPLACES: return "Replaces";
+            case TRANSFORMS: return "Transforms";
+            case SIGNS: return "Signs";
+            case APPENDS: return "Appends";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentRelationshipTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentRelationshipTypeEnumFactory.java
new file mode 100644
index 00000000000..f1c8477fc72
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/DocumentRelationshipTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class DocumentRelationshipTypeEnumFactory implements EnumFactory {
+
+  public DocumentRelationshipType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("replaces".equals(codeString))
+      return DocumentRelationshipType.REPLACES;
+    if ("transforms".equals(codeString))
+      return DocumentRelationshipType.TRANSFORMS;
+    if ("signs".equals(codeString))
+      return DocumentRelationshipType.SIGNS;
+    if ("appends".equals(codeString))
+      return DocumentRelationshipType.APPENDS;
+    throw new IllegalArgumentException("Unknown DocumentRelationshipType code '"+codeString+"'");
+  }
+
+  public String toCode(DocumentRelationshipType code) {
+    if (code == DocumentRelationshipType.REPLACES)
+      return "replaces";
+    if (code == DocumentRelationshipType.TRANSFORMS)
+      return "transforms";
+    if (code == DocumentRelationshipType.SIGNS)
+      return "signs";
+    if (code == DocumentRelationshipType.APPENDS)
+      return "appends";
+    return "?";
+  }
+
+    public String toSystem(DocumentRelationshipType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityrequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityrequestStatus.java
new file mode 100644
index 00000000000..2f94543e141
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityrequestStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EligibilityrequestStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EligibilityrequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown EligibilityrequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/eligibilityrequest-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityrequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityrequestStatusEnumFactory.java
new file mode 100644
index 00000000000..75bca5d4a9a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityrequestStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EligibilityrequestStatusEnumFactory implements EnumFactory {
+
+  public EligibilityrequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return EligibilityrequestStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return EligibilityrequestStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return EligibilityrequestStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return EligibilityrequestStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown EligibilityrequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(EligibilityrequestStatus code) {
+    if (code == EligibilityrequestStatus.ACTIVE)
+      return "active";
+    if (code == EligibilityrequestStatus.CANCELLED)
+      return "cancelled";
+    if (code == EligibilityrequestStatus.DRAFT)
+      return "draft";
+    if (code == EligibilityrequestStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(EligibilityrequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityresponseStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityresponseStatus.java
new file mode 100644
index 00000000000..85ad004dcee
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityresponseStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EligibilityresponseStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EligibilityresponseStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown EligibilityresponseStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/eligibilityresponse-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityresponseStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityresponseStatusEnumFactory.java
new file mode 100644
index 00000000000..24f65db11eb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EligibilityresponseStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EligibilityresponseStatusEnumFactory implements EnumFactory {
+
+  public EligibilityresponseStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return EligibilityresponseStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return EligibilityresponseStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return EligibilityresponseStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return EligibilityresponseStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown EligibilityresponseStatus code '"+codeString+"'");
+  }
+
+  public String toCode(EligibilityresponseStatus code) {
+    if (code == EligibilityresponseStatus.ACTIVE)
+      return "active";
+    if (code == EligibilityresponseStatus.CANCELLED)
+      return "cancelled";
+    if (code == EligibilityresponseStatus.DRAFT)
+      return "draft";
+    if (code == EligibilityresponseStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(EligibilityresponseStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterAdmitSource.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterAdmitSource.java
new file mode 100644
index 00000000000..731d3a941f1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterAdmitSource.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EncounterAdmitSource {
+
+        /**
+         * The Patient has been transferred from another hospital for this encounter.
+         */
+        HOSPTRANS, 
+        /**
+         * The patient has been transferred from the emergency department within the hospital. This is typically used in the transition to an inpatient encounter
+         */
+        EMD, 
+        /**
+         * The patient has been transferred from an outpatient department within the hospital.
+         */
+        OUTP, 
+        /**
+         * The patient is a newborn and the encounter will track the baby related activities (as opposed to the Mothers encounter - that may be associated using the newborn encounters partof property)
+         */
+        BORN, 
+        /**
+         * The patient has been admitted due to a referred from a General Practitioner.
+         */
+        GP, 
+        /**
+         * The patient has been admitted due to a referred from a Specialist (as opposed to a General Practitioner).
+         */
+        MP, 
+        /**
+         * The patient has been transferred from a nursing home.
+         */
+        NURSING, 
+        /**
+         * The patient has been transferred from a psychiatric facility.
+         */
+        PSYCH, 
+        /**
+         * The patient has been transferred from a rehabilitiation facility or clinic.
+         */
+        REHAB, 
+        /**
+         * The patient has been admitted from a source otherwise not specified here.
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EncounterAdmitSource fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("hosp-trans".equals(codeString))
+          return HOSPTRANS;
+        if ("emd".equals(codeString))
+          return EMD;
+        if ("outp".equals(codeString))
+          return OUTP;
+        if ("born".equals(codeString))
+          return BORN;
+        if ("gp".equals(codeString))
+          return GP;
+        if ("mp".equals(codeString))
+          return MP;
+        if ("nursing".equals(codeString))
+          return NURSING;
+        if ("psych".equals(codeString))
+          return PSYCH;
+        if ("rehab".equals(codeString))
+          return REHAB;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown EncounterAdmitSource code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HOSPTRANS: return "hosp-trans";
+            case EMD: return "emd";
+            case OUTP: return "outp";
+            case BORN: return "born";
+            case GP: return "gp";
+            case MP: return "mp";
+            case NURSING: return "nursing";
+            case PSYCH: return "psych";
+            case REHAB: return "rehab";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/admit-source";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HOSPTRANS: return "The Patient has been transferred from another hospital for this encounter.";
+            case EMD: return "The patient has been transferred from the emergency department within the hospital. This is typically used in the transition to an inpatient encounter";
+            case OUTP: return "The patient has been transferred from an outpatient department within the hospital.";
+            case BORN: return "The patient is a newborn and the encounter will track the baby related activities (as opposed to the Mothers encounter - that may be associated using the newborn encounters partof property)";
+            case GP: return "The patient has been admitted due to a referred from a General Practitioner.";
+            case MP: return "The patient has been admitted due to a referred from a Specialist (as opposed to a General Practitioner).";
+            case NURSING: return "The patient has been transferred from a nursing home.";
+            case PSYCH: return "The patient has been transferred from a psychiatric facility.";
+            case REHAB: return "The patient has been transferred from a rehabilitiation facility or clinic.";
+            case OTHER: return "The patient has been admitted from a source otherwise not specified here.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HOSPTRANS: return "Transferred from other hospital";
+            case EMD: return "From accident/emergency department";
+            case OUTP: return "From outpatient department";
+            case BORN: return "Born in hospital";
+            case GP: return "General Practitioner referral";
+            case MP: return "Medical Practitioner/physician referral";
+            case NURSING: return "From nursing home";
+            case PSYCH: return "From psychiatric hospital";
+            case REHAB: return "From rehabilitation facility";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterAdmitSourceEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterAdmitSourceEnumFactory.java
new file mode 100644
index 00000000000..7408ef0f0d2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterAdmitSourceEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EncounterAdmitSourceEnumFactory implements EnumFactory {
+
+  public EncounterAdmitSource fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("hosp-trans".equals(codeString))
+      return EncounterAdmitSource.HOSPTRANS;
+    if ("emd".equals(codeString))
+      return EncounterAdmitSource.EMD;
+    if ("outp".equals(codeString))
+      return EncounterAdmitSource.OUTP;
+    if ("born".equals(codeString))
+      return EncounterAdmitSource.BORN;
+    if ("gp".equals(codeString))
+      return EncounterAdmitSource.GP;
+    if ("mp".equals(codeString))
+      return EncounterAdmitSource.MP;
+    if ("nursing".equals(codeString))
+      return EncounterAdmitSource.NURSING;
+    if ("psych".equals(codeString))
+      return EncounterAdmitSource.PSYCH;
+    if ("rehab".equals(codeString))
+      return EncounterAdmitSource.REHAB;
+    if ("other".equals(codeString))
+      return EncounterAdmitSource.OTHER;
+    throw new IllegalArgumentException("Unknown EncounterAdmitSource code '"+codeString+"'");
+  }
+
+  public String toCode(EncounterAdmitSource code) {
+    if (code == EncounterAdmitSource.HOSPTRANS)
+      return "hosp-trans";
+    if (code == EncounterAdmitSource.EMD)
+      return "emd";
+    if (code == EncounterAdmitSource.OUTP)
+      return "outp";
+    if (code == EncounterAdmitSource.BORN)
+      return "born";
+    if (code == EncounterAdmitSource.GP)
+      return "gp";
+    if (code == EncounterAdmitSource.MP)
+      return "mp";
+    if (code == EncounterAdmitSource.NURSING)
+      return "nursing";
+    if (code == EncounterAdmitSource.PSYCH)
+      return "psych";
+    if (code == EncounterAdmitSource.REHAB)
+      return "rehab";
+    if (code == EncounterAdmitSource.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(EncounterAdmitSource code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDiet.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDiet.java
new file mode 100644
index 00000000000..23d9529f0ce
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDiet.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EncounterDiet {
+
+        /**
+         * Food without meat, poultry or seafood.
+         */
+        VEGETARIAN, 
+        /**
+         * Excludes dairy products.
+         */
+        DAIRYFREE, 
+        /**
+         * Excludes ingredients containing nuts.
+         */
+        NUTFREE, 
+        /**
+         * Excludes ingredients containing gluten.
+         */
+        GLUTENFREE, 
+        /**
+         * Food without meat, poultry, seafood, eggs, dairy products and other animal-derived substances.
+         */
+        VEGAN, 
+        /**
+         * Foods that conform to Islamic law.
+         */
+        HALAL, 
+        /**
+         * Foods that conform to Jewish dietary law.
+         */
+        KOSHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EncounterDiet fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("vegetarian".equals(codeString))
+          return VEGETARIAN;
+        if ("dairy-free".equals(codeString))
+          return DAIRYFREE;
+        if ("nut-free".equals(codeString))
+          return NUTFREE;
+        if ("gluten-free".equals(codeString))
+          return GLUTENFREE;
+        if ("vegan".equals(codeString))
+          return VEGAN;
+        if ("halal".equals(codeString))
+          return HALAL;
+        if ("kosher".equals(codeString))
+          return KOSHER;
+        throw new FHIRException("Unknown EncounterDiet code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case VEGETARIAN: return "vegetarian";
+            case DAIRYFREE: return "dairy-free";
+            case NUTFREE: return "nut-free";
+            case GLUTENFREE: return "gluten-free";
+            case VEGAN: return "vegan";
+            case HALAL: return "halal";
+            case KOSHER: return "kosher";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/diet";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case VEGETARIAN: return "Food without meat, poultry or seafood.";
+            case DAIRYFREE: return "Excludes dairy products.";
+            case NUTFREE: return "Excludes ingredients containing nuts.";
+            case GLUTENFREE: return "Excludes ingredients containing gluten.";
+            case VEGAN: return "Food without meat, poultry, seafood, eggs, dairy products and other animal-derived substances.";
+            case HALAL: return "Foods that conform to Islamic law.";
+            case KOSHER: return "Foods that conform to Jewish dietary law.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case VEGETARIAN: return "Vegetarian";
+            case DAIRYFREE: return "Dairy Free";
+            case NUTFREE: return "Nut Free";
+            case GLUTENFREE: return "Gluten Free";
+            case VEGAN: return "Vegan";
+            case HALAL: return "Halal";
+            case KOSHER: return "Kosher";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDietEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDietEnumFactory.java
new file mode 100644
index 00000000000..118587c6b4f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDietEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EncounterDietEnumFactory implements EnumFactory {
+
+  public EncounterDiet fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("vegetarian".equals(codeString))
+      return EncounterDiet.VEGETARIAN;
+    if ("dairy-free".equals(codeString))
+      return EncounterDiet.DAIRYFREE;
+    if ("nut-free".equals(codeString))
+      return EncounterDiet.NUTFREE;
+    if ("gluten-free".equals(codeString))
+      return EncounterDiet.GLUTENFREE;
+    if ("vegan".equals(codeString))
+      return EncounterDiet.VEGAN;
+    if ("halal".equals(codeString))
+      return EncounterDiet.HALAL;
+    if ("kosher".equals(codeString))
+      return EncounterDiet.KOSHER;
+    throw new IllegalArgumentException("Unknown EncounterDiet code '"+codeString+"'");
+  }
+
+  public String toCode(EncounterDiet code) {
+    if (code == EncounterDiet.VEGETARIAN)
+      return "vegetarian";
+    if (code == EncounterDiet.DAIRYFREE)
+      return "dairy-free";
+    if (code == EncounterDiet.NUTFREE)
+      return "nut-free";
+    if (code == EncounterDiet.GLUTENFREE)
+      return "gluten-free";
+    if (code == EncounterDiet.VEGAN)
+      return "vegan";
+    if (code == EncounterDiet.HALAL)
+      return "halal";
+    if (code == EncounterDiet.KOSHER)
+      return "kosher";
+    return "?";
+  }
+
+    public String toSystem(EncounterDiet code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDischargeDisposition.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDischargeDisposition.java
new file mode 100644
index 00000000000..c0b80a26ca6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDischargeDisposition.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EncounterDischargeDisposition {
+
+        /**
+         * The patient was dicharged and has indicated that they are going to return home afterwards.
+         */
+        HOME, 
+        /**
+         * The patient was transferred to another healthcare facility.
+         */
+        OTHERHCF, 
+        /**
+         * The patient has been discharged into palliative care.
+         */
+        HOSP, 
+        /**
+         * The patient has been discharged into long-term care where is likely to be monitored through an ongoing episode-of-care.
+         */
+        LONG, 
+        /**
+         * The patient self discharged against medical advice.
+         */
+        AADVICE, 
+        /**
+         * The patient has deceased during this encounter.
+         */
+        EXP, 
+        /**
+         * The patient has been transferred to a psychiatric facility.
+         */
+        PSY, 
+        /**
+         * The patient was discharged and is to receive post acute care rehabilitation services.
+         */
+        REHAB, 
+        /**
+         * The patient has been discharged to a skilled nursing facility for the patient to receive additional care.
+         */
+        SNF, 
+        /**
+         * The discharge disposition has not otherwise defined.
+         */
+        OTH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EncounterDischargeDisposition fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("home".equals(codeString))
+          return HOME;
+        if ("other-hcf".equals(codeString))
+          return OTHERHCF;
+        if ("hosp".equals(codeString))
+          return HOSP;
+        if ("long".equals(codeString))
+          return LONG;
+        if ("aadvice".equals(codeString))
+          return AADVICE;
+        if ("exp".equals(codeString))
+          return EXP;
+        if ("psy".equals(codeString))
+          return PSY;
+        if ("rehab".equals(codeString))
+          return REHAB;
+        if ("snf".equals(codeString))
+          return SNF;
+        if ("oth".equals(codeString))
+          return OTH;
+        throw new FHIRException("Unknown EncounterDischargeDisposition code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HOME: return "home";
+            case OTHERHCF: return "other-hcf";
+            case HOSP: return "hosp";
+            case LONG: return "long";
+            case AADVICE: return "aadvice";
+            case EXP: return "exp";
+            case PSY: return "psy";
+            case REHAB: return "rehab";
+            case SNF: return "snf";
+            case OTH: return "oth";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/discharge-disposition";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HOME: return "The patient was dicharged and has indicated that they are going to return home afterwards.";
+            case OTHERHCF: return "The patient was transferred to another healthcare facility.";
+            case HOSP: return "The patient has been discharged into palliative care.";
+            case LONG: return "The patient has been discharged into long-term care where is likely to be monitored through an ongoing episode-of-care.";
+            case AADVICE: return "The patient self discharged against medical advice.";
+            case EXP: return "The patient has deceased during this encounter.";
+            case PSY: return "The patient has been transferred to a psychiatric facility.";
+            case REHAB: return "The patient was discharged and is to receive post acute care rehabilitation services.";
+            case SNF: return "The patient has been discharged to a skilled nursing facility for the patient to receive additional care.";
+            case OTH: return "The discharge disposition has not otherwise defined.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HOME: return "Home";
+            case OTHERHCF: return "Other healthcare facility";
+            case HOSP: return "Hospice";
+            case LONG: return "Long-term care";
+            case AADVICE: return "Left against advice";
+            case EXP: return "Expired";
+            case PSY: return "Psychiatric hospital";
+            case REHAB: return "Rehabilitation";
+            case SNF: return "Skilled nursing facility";
+            case OTH: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDischargeDispositionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDischargeDispositionEnumFactory.java
new file mode 100644
index 00000000000..0a8bc76fc93
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterDischargeDispositionEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EncounterDischargeDispositionEnumFactory implements EnumFactory {
+
+  public EncounterDischargeDisposition fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("home".equals(codeString))
+      return EncounterDischargeDisposition.HOME;
+    if ("other-hcf".equals(codeString))
+      return EncounterDischargeDisposition.OTHERHCF;
+    if ("hosp".equals(codeString))
+      return EncounterDischargeDisposition.HOSP;
+    if ("long".equals(codeString))
+      return EncounterDischargeDisposition.LONG;
+    if ("aadvice".equals(codeString))
+      return EncounterDischargeDisposition.AADVICE;
+    if ("exp".equals(codeString))
+      return EncounterDischargeDisposition.EXP;
+    if ("psy".equals(codeString))
+      return EncounterDischargeDisposition.PSY;
+    if ("rehab".equals(codeString))
+      return EncounterDischargeDisposition.REHAB;
+    if ("snf".equals(codeString))
+      return EncounterDischargeDisposition.SNF;
+    if ("oth".equals(codeString))
+      return EncounterDischargeDisposition.OTH;
+    throw new IllegalArgumentException("Unknown EncounterDischargeDisposition code '"+codeString+"'");
+  }
+
+  public String toCode(EncounterDischargeDisposition code) {
+    if (code == EncounterDischargeDisposition.HOME)
+      return "home";
+    if (code == EncounterDischargeDisposition.OTHERHCF)
+      return "other-hcf";
+    if (code == EncounterDischargeDisposition.HOSP)
+      return "hosp";
+    if (code == EncounterDischargeDisposition.LONG)
+      return "long";
+    if (code == EncounterDischargeDisposition.AADVICE)
+      return "aadvice";
+    if (code == EncounterDischargeDisposition.EXP)
+      return "exp";
+    if (code == EncounterDischargeDisposition.PSY)
+      return "psy";
+    if (code == EncounterDischargeDisposition.REHAB)
+      return "rehab";
+    if (code == EncounterDischargeDisposition.SNF)
+      return "snf";
+    if (code == EncounterDischargeDisposition.OTH)
+      return "oth";
+    return "?";
+  }
+
+    public String toSystem(EncounterDischargeDisposition code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterLocationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterLocationStatus.java
new file mode 100644
index 00000000000..83969478d0c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterLocationStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EncounterLocationStatus {
+
+        /**
+         * The patient is planned to be moved to this location at some point in the future.
+         */
+        PLANNED, 
+        /**
+         * The patient is currently at this location, or was between the period specified.

A system may update these records when the patient leaves the location to either reserved, or completed
+         */
+        ACTIVE, 
+        /**
+         * This location is held empty for this patient.
+         */
+        RESERVED, 
+        /**
+         * The patient was at this location during the period specified.

Not to be used when the patient is currently at the location
+         */
+        COMPLETED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EncounterLocationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("planned".equals(codeString))
+          return PLANNED;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("reserved".equals(codeString))
+          return RESERVED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        throw new FHIRException("Unknown EncounterLocationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PLANNED: return "planned";
+            case ACTIVE: return "active";
+            case RESERVED: return "reserved";
+            case COMPLETED: return "completed";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/encounter-location-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PLANNED: return "The patient is planned to be moved to this location at some point in the future.";
+            case ACTIVE: return "The patient is currently at this location, or was between the period specified.\r\rA system may update these records when the patient leaves the location to either reserved, or completed";
+            case RESERVED: return "This location is held empty for this patient.";
+            case COMPLETED: return "The patient was at this location during the period specified.\r\rNot to be used when the patient is currently at the location";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PLANNED: return "Planned";
+            case ACTIVE: return "Active";
+            case RESERVED: return "Reserved";
+            case COMPLETED: return "Completed";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterLocationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterLocationStatusEnumFactory.java
new file mode 100644
index 00000000000..e9bd151ce3a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterLocationStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EncounterLocationStatusEnumFactory implements EnumFactory {
+
+  public EncounterLocationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("planned".equals(codeString))
+      return EncounterLocationStatus.PLANNED;
+    if ("active".equals(codeString))
+      return EncounterLocationStatus.ACTIVE;
+    if ("reserved".equals(codeString))
+      return EncounterLocationStatus.RESERVED;
+    if ("completed".equals(codeString))
+      return EncounterLocationStatus.COMPLETED;
+    throw new IllegalArgumentException("Unknown EncounterLocationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(EncounterLocationStatus code) {
+    if (code == EncounterLocationStatus.PLANNED)
+      return "planned";
+    if (code == EncounterLocationStatus.ACTIVE)
+      return "active";
+    if (code == EncounterLocationStatus.RESERVED)
+      return "reserved";
+    if (code == EncounterLocationStatus.COMPLETED)
+      return "completed";
+    return "?";
+  }
+
+    public String toSystem(EncounterLocationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterParticipantType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterParticipantType.java
new file mode 100644
index 00000000000..656aada1f85
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterParticipantType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EncounterParticipantType {
+
+        /**
+         * A translator who is facilitating communication with the patient during the encounter.
+         */
+        TRANSLATOR, 
+        /**
+         * A person to be contacted in case of an emergency during the encounter.
+         */
+        EMERGENCY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EncounterParticipantType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("translator".equals(codeString))
+          return TRANSLATOR;
+        if ("emergency".equals(codeString))
+          return EMERGENCY;
+        throw new FHIRException("Unknown EncounterParticipantType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case TRANSLATOR: return "translator";
+            case EMERGENCY: return "emergency";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/participant-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case TRANSLATOR: return "A translator who is facilitating communication with the patient during the encounter.";
+            case EMERGENCY: return "A person to be contacted in case of an emergency during the encounter.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case TRANSLATOR: return "Translator";
+            case EMERGENCY: return "Emergency";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterParticipantTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterParticipantTypeEnumFactory.java
new file mode 100644
index 00000000000..5c8926ccb92
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterParticipantTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EncounterParticipantTypeEnumFactory implements EnumFactory {
+
+  public EncounterParticipantType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("translator".equals(codeString))
+      return EncounterParticipantType.TRANSLATOR;
+    if ("emergency".equals(codeString))
+      return EncounterParticipantType.EMERGENCY;
+    throw new IllegalArgumentException("Unknown EncounterParticipantType code '"+codeString+"'");
+  }
+
+  public String toCode(EncounterParticipantType code) {
+    if (code == EncounterParticipantType.TRANSLATOR)
+      return "translator";
+    if (code == EncounterParticipantType.EMERGENCY)
+      return "emergency";
+    return "?";
+  }
+
+    public String toSystem(EncounterParticipantType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterSpecialArrangements.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterSpecialArrangements.java
new file mode 100644
index 00000000000..692b4efd819
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterSpecialArrangements.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EncounterSpecialArrangements {
+
+        /**
+         * The patient requires a wheelchair to be made available for the encounter.
+         */
+        WHEEL, 
+        /**
+         * An additional bed made available for a person accompanying the patient, for example a parent accompanying a child.
+         */
+        ADDBED, 
+        /**
+         * The patient is not fluent in the local language and requires an interpreter to be available. Refer to the Patient.Language property for the type of interpreter required.
+         */
+        INT, 
+        /**
+         * A person who accompanies a patient to provide assistive services necessary for the patient's care during the encounter.
+         */
+        ATT, 
+        /**
+         * The patient has a guide-dog and the location used for the encounter should be able to support the presence of the service animal.
+         */
+        DOG, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EncounterSpecialArrangements fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("wheel".equals(codeString))
+          return WHEEL;
+        if ("add-bed".equals(codeString))
+          return ADDBED;
+        if ("int".equals(codeString))
+          return INT;
+        if ("att".equals(codeString))
+          return ATT;
+        if ("dog".equals(codeString))
+          return DOG;
+        throw new FHIRException("Unknown EncounterSpecialArrangements code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case WHEEL: return "wheel";
+            case ADDBED: return "add-bed";
+            case INT: return "int";
+            case ATT: return "att";
+            case DOG: return "dog";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/encounter-special-arrangements";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case WHEEL: return "The patient requires a wheelchair to be made available for the encounter.";
+            case ADDBED: return "An additional bed made available for a person accompanying the patient, for example a parent accompanying a child.";
+            case INT: return "The patient is not fluent in the local language and requires an interpreter to be available. Refer to the Patient.Language property for the type of interpreter required.";
+            case ATT: return "A person who accompanies a patient to provide assistive services necessary for the patient's care during the encounter.";
+            case DOG: return "The patient has a guide-dog and the location used for the encounter should be able to support the presence of the service animal.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case WHEEL: return "Wheelchair";
+            case ADDBED: return "Additional bedding";
+            case INT: return "Interpreter";
+            case ATT: return "Attendant";
+            case DOG: return "Guide dog";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterSpecialArrangementsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterSpecialArrangementsEnumFactory.java
new file mode 100644
index 00000000000..e16f4dcb7e3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterSpecialArrangementsEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EncounterSpecialArrangementsEnumFactory implements EnumFactory {
+
+  public EncounterSpecialArrangements fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("wheel".equals(codeString))
+      return EncounterSpecialArrangements.WHEEL;
+    if ("add-bed".equals(codeString))
+      return EncounterSpecialArrangements.ADDBED;
+    if ("int".equals(codeString))
+      return EncounterSpecialArrangements.INT;
+    if ("att".equals(codeString))
+      return EncounterSpecialArrangements.ATT;
+    if ("dog".equals(codeString))
+      return EncounterSpecialArrangements.DOG;
+    throw new IllegalArgumentException("Unknown EncounterSpecialArrangements code '"+codeString+"'");
+  }
+
+  public String toCode(EncounterSpecialArrangements code) {
+    if (code == EncounterSpecialArrangements.WHEEL)
+      return "wheel";
+    if (code == EncounterSpecialArrangements.ADDBED)
+      return "add-bed";
+    if (code == EncounterSpecialArrangements.INT)
+      return "int";
+    if (code == EncounterSpecialArrangements.ATT)
+      return "att";
+    if (code == EncounterSpecialArrangements.DOG)
+      return "dog";
+    return "?";
+  }
+
+    public String toSystem(EncounterSpecialArrangements code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterStatus.java
new file mode 100644
index 00000000000..6149cc67dce
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterStatus.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EncounterStatus {
+
+        /**
+         * The Encounter has not yet started.
+         */
+        PLANNED, 
+        /**
+         * The Patient is present for the encounter, however is not currently meeting with a practitioner.
+         */
+        ARRIVED, 
+        /**
+         * The patient has been assessed for the priority of their treatment based on the severity of their condition.
+         */
+        TRIAGED, 
+        /**
+         * The Encounter has begun and the patient is present / the practitioner and the patient are meeting.
+         */
+        INPROGRESS, 
+        /**
+         * The Encounter has begun, but the patient is temporarily on leave.
+         */
+        ONLEAVE, 
+        /**
+         * The Encounter has ended.
+         */
+        FINISHED, 
+        /**
+         * The Encounter has ended before it has begun.
+         */
+        CANCELLED, 
+        /**
+         * This instance should not have been part of this patient's medical record.
+         */
+        ENTEREDINERROR, 
+        /**
+         * The encounter status is unknown. Note that "unknown" is a value of last resort and every attempt should be made to provide a meaningful value other than "unknown".
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EncounterStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("planned".equals(codeString))
+          return PLANNED;
+        if ("arrived".equals(codeString))
+          return ARRIVED;
+        if ("triaged".equals(codeString))
+          return TRIAGED;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("onleave".equals(codeString))
+          return ONLEAVE;
+        if ("finished".equals(codeString))
+          return FINISHED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown EncounterStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PLANNED: return "planned";
+            case ARRIVED: return "arrived";
+            case TRIAGED: return "triaged";
+            case INPROGRESS: return "in-progress";
+            case ONLEAVE: return "onleave";
+            case FINISHED: return "finished";
+            case CANCELLED: return "cancelled";
+            case ENTEREDINERROR: return "entered-in-error";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/encounter-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PLANNED: return "The Encounter has not yet started.";
+            case ARRIVED: return "The Patient is present for the encounter, however is not currently meeting with a practitioner.";
+            case TRIAGED: return "The patient has been assessed for the priority of their treatment based on the severity of their condition.";
+            case INPROGRESS: return "The Encounter has begun and the patient is present / the practitioner and the patient are meeting.";
+            case ONLEAVE: return "The Encounter has begun, but the patient is temporarily on leave.";
+            case FINISHED: return "The Encounter has ended.";
+            case CANCELLED: return "The Encounter has ended before it has begun.";
+            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
+            case UNKNOWN: return "The encounter status is unknown. Note that \"unknown\" is a value of last resort and every attempt should be made to provide a meaningful value other than \"unknown\".";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PLANNED: return "Planned";
+            case ARRIVED: return "Arrived";
+            case TRIAGED: return "Triaged";
+            case INPROGRESS: return "In Progress";
+            case ONLEAVE: return "On Leave";
+            case FINISHED: return "Finished";
+            case CANCELLED: return "Cancelled";
+            case ENTEREDINERROR: return "Entered in Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterStatusEnumFactory.java
new file mode 100644
index 00000000000..c8f40da2d08
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterStatusEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EncounterStatusEnumFactory implements EnumFactory {
+
+  public EncounterStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("planned".equals(codeString))
+      return EncounterStatus.PLANNED;
+    if ("arrived".equals(codeString))
+      return EncounterStatus.ARRIVED;
+    if ("triaged".equals(codeString))
+      return EncounterStatus.TRIAGED;
+    if ("in-progress".equals(codeString))
+      return EncounterStatus.INPROGRESS;
+    if ("onleave".equals(codeString))
+      return EncounterStatus.ONLEAVE;
+    if ("finished".equals(codeString))
+      return EncounterStatus.FINISHED;
+    if ("cancelled".equals(codeString))
+      return EncounterStatus.CANCELLED;
+    if ("entered-in-error".equals(codeString))
+      return EncounterStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return EncounterStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown EncounterStatus code '"+codeString+"'");
+  }
+
+  public String toCode(EncounterStatus code) {
+    if (code == EncounterStatus.PLANNED)
+      return "planned";
+    if (code == EncounterStatus.ARRIVED)
+      return "arrived";
+    if (code == EncounterStatus.TRIAGED)
+      return "triaged";
+    if (code == EncounterStatus.INPROGRESS)
+      return "in-progress";
+    if (code == EncounterStatus.ONLEAVE)
+      return "onleave";
+    if (code == EncounterStatus.FINISHED)
+      return "finished";
+    if (code == EncounterStatus.CANCELLED)
+      return "cancelled";
+    if (code == EncounterStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == EncounterStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(EncounterStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterType.java
new file mode 100644
index 00000000000..18264187257
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EncounterType {
+
+        /**
+         * null
+         */
+        ADMS, 
+        /**
+         * null
+         */
+        BD_BMCLIN, 
+        /**
+         * null
+         */
+        CCS60, 
+        /**
+         * null
+         */
+        OKI, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EncounterType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ADMS".equals(codeString))
+          return ADMS;
+        if ("BD/BM-clin".equals(codeString))
+          return BD_BMCLIN;
+        if ("CCS60".equals(codeString))
+          return CCS60;
+        if ("OKI".equals(codeString))
+          return OKI;
+        throw new FHIRException("Unknown EncounterType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ADMS: return "ADMS";
+            case BD_BMCLIN: return "BD/BM-clin";
+            case CCS60: return "CCS60";
+            case OKI: return "OKI";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/encounter-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ADMS: return "";
+            case BD_BMCLIN: return "";
+            case CCS60: return "";
+            case OKI: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ADMS: return "Annual diabetes mellitus screening";
+            case BD_BMCLIN: return "Bone drilling/bone marrow punction in clinic";
+            case CCS60: return "Infant colon screening - 60 minutes";
+            case OKI: return "Outpatient Kenacort injection";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterTypeEnumFactory.java
new file mode 100644
index 00000000000..59f2e04b219
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EncounterTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EncounterTypeEnumFactory implements EnumFactory {
+
+  public EncounterType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ADMS".equals(codeString))
+      return EncounterType.ADMS;
+    if ("BD/BM-clin".equals(codeString))
+      return EncounterType.BD_BMCLIN;
+    if ("CCS60".equals(codeString))
+      return EncounterType.CCS60;
+    if ("OKI".equals(codeString))
+      return EncounterType.OKI;
+    throw new IllegalArgumentException("Unknown EncounterType code '"+codeString+"'");
+  }
+
+  public String toCode(EncounterType code) {
+    if (code == EncounterType.ADMS)
+      return "ADMS";
+    if (code == EncounterType.BD_BMCLIN)
+      return "BD/BM-clin";
+    if (code == EncounterType.CCS60)
+      return "CCS60";
+    if (code == EncounterType.OKI)
+      return "OKI";
+    return "?";
+  }
+
+    public String toSystem(EncounterType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointConnectionType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointConnectionType.java
new file mode 100644
index 00000000000..b47a3cf639d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointConnectionType.java
@@ -0,0 +1,195 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EndpointConnectionType {
+
+        /**
+         * IHE Cross Community Patient Discovery Profile (XCPD) - http://wiki.ihe.net/index.php/Cross-Community_Patient_Discovery
+         */
+        IHEXCPD, 
+        /**
+         * IHE Cross Community Access Profile (XCA) - http://wiki.ihe.net/index.php/Cross-Community_Access
+         */
+        IHEXCA, 
+        /**
+         * IHE Cross-Enterprise Document Reliable Exchange (XDR) - http://wiki.ihe.net/index.php/Cross-enterprise_Document_Reliable_Interchange
+         */
+        IHEXDR, 
+        /**
+         * IHE Cross-Enterprise Document Sharing (XDS) - http://wiki.ihe.net/index.php/Cross-Enterprise_Document_Sharing
+         */
+        IHEXDS, 
+        /**
+         * IHE Invoke Image Display (IID) - http://wiki.ihe.net/index.php/Invoke_Image_Display
+         */
+        IHEIID, 
+        /**
+         * DICOMweb RESTful Image Retrieve - http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_6.5.html
+         */
+        DICOMWADORS, 
+        /**
+         * DICOMweb RESTful Image query - http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_6.7.html
+         */
+        DICOMQIDORS, 
+        /**
+         * DICOMweb RESTful image sending and storage - http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_6.6.html
+         */
+        DICOMSTOWRS, 
+        /**
+         * DICOMweb Image Retrieve - http://dicom.nema.org/dicom/2013/output/chtml/part18/sect_6.3.html
+         */
+        DICOMWADOURI, 
+        /**
+         * Interact with the server interface using FHIR's RESTful interface. For details on its version/capabilities you should connect the the value in Endpoint.address and retrieve the FHIR CapabilityStatement.
+         */
+        HL7FHIRREST, 
+        /**
+         * Use the servers FHIR Messaging interface. Details can be found on the messaging.html page in the FHIR Specification. The FHIR server's base address is specified in the Endpoint.address property.
+         */
+        HL7FHIRMSG, 
+        /**
+         * HL7v2 messages over an LLP TCP connection
+         */
+        HL7V2MLLP, 
+        /**
+         * Email delivery using a digital certificate to encrypt the content using the public key, receiver must have the private key to decrypt the content
+         */
+        SECUREEMAIL, 
+        /**
+         * Direct Project information - http://wiki.directproject.org/
+         */
+        DIRECTPROJECT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EndpointConnectionType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ihe-xcpd".equals(codeString))
+          return IHEXCPD;
+        if ("ihe-xca".equals(codeString))
+          return IHEXCA;
+        if ("ihe-xdr".equals(codeString))
+          return IHEXDR;
+        if ("ihe-xds".equals(codeString))
+          return IHEXDS;
+        if ("ihe-iid".equals(codeString))
+          return IHEIID;
+        if ("dicom-wado-rs".equals(codeString))
+          return DICOMWADORS;
+        if ("dicom-qido-rs".equals(codeString))
+          return DICOMQIDORS;
+        if ("dicom-stow-rs".equals(codeString))
+          return DICOMSTOWRS;
+        if ("dicom-wado-uri".equals(codeString))
+          return DICOMWADOURI;
+        if ("hl7-fhir-rest".equals(codeString))
+          return HL7FHIRREST;
+        if ("hl7-fhir-msg".equals(codeString))
+          return HL7FHIRMSG;
+        if ("hl7v2-mllp".equals(codeString))
+          return HL7V2MLLP;
+        if ("secure-email".equals(codeString))
+          return SECUREEMAIL;
+        if ("direct-project".equals(codeString))
+          return DIRECTPROJECT;
+        throw new FHIRException("Unknown EndpointConnectionType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case IHEXCPD: return "ihe-xcpd";
+            case IHEXCA: return "ihe-xca";
+            case IHEXDR: return "ihe-xdr";
+            case IHEXDS: return "ihe-xds";
+            case IHEIID: return "ihe-iid";
+            case DICOMWADORS: return "dicom-wado-rs";
+            case DICOMQIDORS: return "dicom-qido-rs";
+            case DICOMSTOWRS: return "dicom-stow-rs";
+            case DICOMWADOURI: return "dicom-wado-uri";
+            case HL7FHIRREST: return "hl7-fhir-rest";
+            case HL7FHIRMSG: return "hl7-fhir-msg";
+            case HL7V2MLLP: return "hl7v2-mllp";
+            case SECUREEMAIL: return "secure-email";
+            case DIRECTPROJECT: return "direct-project";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/endpoint-connection-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case IHEXCPD: return "IHE Cross Community Patient Discovery Profile (XCPD) - http://wiki.ihe.net/index.php/Cross-Community_Patient_Discovery";
+            case IHEXCA: return "IHE Cross Community Access Profile (XCA) - http://wiki.ihe.net/index.php/Cross-Community_Access";
+            case IHEXDR: return "IHE Cross-Enterprise Document Reliable Exchange (XDR) - http://wiki.ihe.net/index.php/Cross-enterprise_Document_Reliable_Interchange";
+            case IHEXDS: return "IHE Cross-Enterprise Document Sharing (XDS) - http://wiki.ihe.net/index.php/Cross-Enterprise_Document_Sharing";
+            case IHEIID: return "IHE Invoke Image Display (IID) - http://wiki.ihe.net/index.php/Invoke_Image_Display";
+            case DICOMWADORS: return "DICOMweb RESTful Image Retrieve - http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_6.5.html";
+            case DICOMQIDORS: return "DICOMweb RESTful Image query - http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_6.7.html";
+            case DICOMSTOWRS: return "DICOMweb RESTful image sending and storage - http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_6.6.html";
+            case DICOMWADOURI: return "DICOMweb Image Retrieve - http://dicom.nema.org/dicom/2013/output/chtml/part18/sect_6.3.html";
+            case HL7FHIRREST: return "Interact with the server interface using FHIR's RESTful interface. For details on its version/capabilities you should connect the the value in Endpoint.address and retrieve the FHIR CapabilityStatement.";
+            case HL7FHIRMSG: return "Use the servers FHIR Messaging interface. Details can be found on the messaging.html page in the FHIR Specification. The FHIR server's base address is specified in the Endpoint.address property.";
+            case HL7V2MLLP: return "HL7v2 messages over an LLP TCP connection";
+            case SECUREEMAIL: return "Email delivery using a digital certificate to encrypt the content using the public key, receiver must have the private key to decrypt the content";
+            case DIRECTPROJECT: return "Direct Project information - http://wiki.directproject.org/";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case IHEXCPD: return "IHE XCPD";
+            case IHEXCA: return "IHE XCA";
+            case IHEXDR: return "IHE XDR";
+            case IHEXDS: return "IHE XDS";
+            case IHEIID: return "IHE IID";
+            case DICOMWADORS: return "DICOM WADO-RS";
+            case DICOMQIDORS: return "DICOM QIDO-RS";
+            case DICOMSTOWRS: return "DICOM STOW-RS";
+            case DICOMWADOURI: return "DICOM WADO-URI";
+            case HL7FHIRREST: return "HL7 FHIR";
+            case HL7FHIRMSG: return "HL7 FHIR Messaging";
+            case HL7V2MLLP: return "HL7 v2 MLLP";
+            case SECUREEMAIL: return "Secure email";
+            case DIRECTPROJECT: return "Direct Project";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointConnectionTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointConnectionTypeEnumFactory.java
new file mode 100644
index 00000000000..f2a3ab0b54c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointConnectionTypeEnumFactory.java
@@ -0,0 +1,110 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EndpointConnectionTypeEnumFactory implements EnumFactory {
+
+  public EndpointConnectionType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ihe-xcpd".equals(codeString))
+      return EndpointConnectionType.IHEXCPD;
+    if ("ihe-xca".equals(codeString))
+      return EndpointConnectionType.IHEXCA;
+    if ("ihe-xdr".equals(codeString))
+      return EndpointConnectionType.IHEXDR;
+    if ("ihe-xds".equals(codeString))
+      return EndpointConnectionType.IHEXDS;
+    if ("ihe-iid".equals(codeString))
+      return EndpointConnectionType.IHEIID;
+    if ("dicom-wado-rs".equals(codeString))
+      return EndpointConnectionType.DICOMWADORS;
+    if ("dicom-qido-rs".equals(codeString))
+      return EndpointConnectionType.DICOMQIDORS;
+    if ("dicom-stow-rs".equals(codeString))
+      return EndpointConnectionType.DICOMSTOWRS;
+    if ("dicom-wado-uri".equals(codeString))
+      return EndpointConnectionType.DICOMWADOURI;
+    if ("hl7-fhir-rest".equals(codeString))
+      return EndpointConnectionType.HL7FHIRREST;
+    if ("hl7-fhir-msg".equals(codeString))
+      return EndpointConnectionType.HL7FHIRMSG;
+    if ("hl7v2-mllp".equals(codeString))
+      return EndpointConnectionType.HL7V2MLLP;
+    if ("secure-email".equals(codeString))
+      return EndpointConnectionType.SECUREEMAIL;
+    if ("direct-project".equals(codeString))
+      return EndpointConnectionType.DIRECTPROJECT;
+    throw new IllegalArgumentException("Unknown EndpointConnectionType code '"+codeString+"'");
+  }
+
+  public String toCode(EndpointConnectionType code) {
+    if (code == EndpointConnectionType.IHEXCPD)
+      return "ihe-xcpd";
+    if (code == EndpointConnectionType.IHEXCA)
+      return "ihe-xca";
+    if (code == EndpointConnectionType.IHEXDR)
+      return "ihe-xdr";
+    if (code == EndpointConnectionType.IHEXDS)
+      return "ihe-xds";
+    if (code == EndpointConnectionType.IHEIID)
+      return "ihe-iid";
+    if (code == EndpointConnectionType.DICOMWADORS)
+      return "dicom-wado-rs";
+    if (code == EndpointConnectionType.DICOMQIDORS)
+      return "dicom-qido-rs";
+    if (code == EndpointConnectionType.DICOMSTOWRS)
+      return "dicom-stow-rs";
+    if (code == EndpointConnectionType.DICOMWADOURI)
+      return "dicom-wado-uri";
+    if (code == EndpointConnectionType.HL7FHIRREST)
+      return "hl7-fhir-rest";
+    if (code == EndpointConnectionType.HL7FHIRMSG)
+      return "hl7-fhir-msg";
+    if (code == EndpointConnectionType.HL7V2MLLP)
+      return "hl7v2-mllp";
+    if (code == EndpointConnectionType.SECUREEMAIL)
+      return "secure-email";
+    if (code == EndpointConnectionType.DIRECTPROJECT)
+      return "direct-project";
+    return "?";
+  }
+
+    public String toSystem(EndpointConnectionType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointPayloadType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointPayloadType.java
new file mode 100644
index 00000000000..f690a132464
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointPayloadType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EndpointPayloadType {
+
+        /**
+         * Any payload type can be used with this endpoint, it is either a payload agnostic infrastructure (such as a storage repository), or some other type of endpoint where payload considerations are internally handled, and not available
+         */
+        ANY, 
+        /**
+         * This endpoint does not require any content to be sent, simply connecting to the endpoint is enough notification. This can be used as a 'ping' to wakeup a service to retrieve content, which could be to ensure security considerations are correctly handled
+         */
+        NONE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EndpointPayloadType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("any".equals(codeString))
+          return ANY;
+        if ("none".equals(codeString))
+          return NONE;
+        throw new FHIRException("Unknown EndpointPayloadType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ANY: return "any";
+            case NONE: return "none";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/endpoint-payload-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ANY: return "Any payload type can be used with this endpoint, it is either a payload agnostic infrastructure (such as a storage repository), or some other type of endpoint where payload considerations are internally handled, and not available";
+            case NONE: return "This endpoint does not require any content to be sent, simply connecting to the endpoint is enough notification. This can be used as a 'ping' to wakeup a service to retrieve content, which could be to ensure security considerations are correctly handled";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ANY: return "Any";
+            case NONE: return "None";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointPayloadTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointPayloadTypeEnumFactory.java
new file mode 100644
index 00000000000..ae243dd3046
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointPayloadTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EndpointPayloadTypeEnumFactory implements EnumFactory {
+
+  public EndpointPayloadType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("any".equals(codeString))
+      return EndpointPayloadType.ANY;
+    if ("none".equals(codeString))
+      return EndpointPayloadType.NONE;
+    throw new IllegalArgumentException("Unknown EndpointPayloadType code '"+codeString+"'");
+  }
+
+  public String toCode(EndpointPayloadType code) {
+    if (code == EndpointPayloadType.ANY)
+      return "any";
+    if (code == EndpointPayloadType.NONE)
+      return "none";
+    return "?";
+  }
+
+    public String toSystem(EndpointPayloadType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointStatus.java
new file mode 100644
index 00000000000..16db54fa822
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EndpointStatus {
+
+        /**
+         * This endpoint is expected to be active and can be used
+         */
+        ACTIVE, 
+        /**
+         * This endpoint is temporarily unavailable
+         */
+        SUSPENDED, 
+        /**
+         * This endpoint has exceeded connectivity thresholds and is considered in an error state and should no longer be attempted to connect to until corrective action is taken
+         */
+        ERROR, 
+        /**
+         * This endpoint is no longer to be used
+         */
+        OFF, 
+        /**
+         * This instance should not have been part of this patient's medical record.
+         */
+        ENTEREDINERROR, 
+        /**
+         * This endpoint is not intended for production usage.
+         */
+        TEST, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EndpointStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("error".equals(codeString))
+          return ERROR;
+        if ("off".equals(codeString))
+          return OFF;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("test".equals(codeString))
+          return TEST;
+        throw new FHIRException("Unknown EndpointStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case SUSPENDED: return "suspended";
+            case ERROR: return "error";
+            case OFF: return "off";
+            case ENTEREDINERROR: return "entered-in-error";
+            case TEST: return "test";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/endpoint-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "This endpoint is expected to be active and can be used";
+            case SUSPENDED: return "This endpoint is temporarily unavailable";
+            case ERROR: return "This endpoint has exceeded connectivity thresholds and is considered in an error state and should no longer be attempted to connect to until corrective action is taken";
+            case OFF: return "This endpoint is no longer to be used";
+            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
+            case TEST: return "This endpoint is not intended for production usage.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case SUSPENDED: return "Suspended";
+            case ERROR: return "Error";
+            case OFF: return "Off";
+            case ENTEREDINERROR: return "Entered in error";
+            case TEST: return "Test";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointStatusEnumFactory.java
new file mode 100644
index 00000000000..02283fe63e8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EndpointStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EndpointStatusEnumFactory implements EnumFactory {
+
+  public EndpointStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return EndpointStatus.ACTIVE;
+    if ("suspended".equals(codeString))
+      return EndpointStatus.SUSPENDED;
+    if ("error".equals(codeString))
+      return EndpointStatus.ERROR;
+    if ("off".equals(codeString))
+      return EndpointStatus.OFF;
+    if ("entered-in-error".equals(codeString))
+      return EndpointStatus.ENTEREDINERROR;
+    if ("test".equals(codeString))
+      return EndpointStatus.TEST;
+    throw new IllegalArgumentException("Unknown EndpointStatus code '"+codeString+"'");
+  }
+
+  public String toCode(EndpointStatus code) {
+    if (code == EndpointStatus.ACTIVE)
+      return "active";
+    if (code == EndpointStatus.SUSPENDED)
+      return "suspended";
+    if (code == EndpointStatus.ERROR)
+      return "error";
+    if (code == EndpointStatus.OFF)
+      return "off";
+    if (code == EndpointStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == EndpointStatus.TEST)
+      return "test";
+    return "?";
+  }
+
+    public String toSystem(EndpointStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentrequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentrequestStatus.java
new file mode 100644
index 00000000000..6112b066456
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentrequestStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EnrollmentrequestStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EnrollmentrequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown EnrollmentrequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/enrollmentrequest-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentrequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentrequestStatusEnumFactory.java
new file mode 100644
index 00000000000..27e1dda40d1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentrequestStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EnrollmentrequestStatusEnumFactory implements EnumFactory {
+
+  public EnrollmentrequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return EnrollmentrequestStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return EnrollmentrequestStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return EnrollmentrequestStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return EnrollmentrequestStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown EnrollmentrequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(EnrollmentrequestStatus code) {
+    if (code == EnrollmentrequestStatus.ACTIVE)
+      return "active";
+    if (code == EnrollmentrequestStatus.CANCELLED)
+      return "cancelled";
+    if (code == EnrollmentrequestStatus.DRAFT)
+      return "draft";
+    if (code == EnrollmentrequestStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(EnrollmentrequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentresponseStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentresponseStatus.java
new file mode 100644
index 00000000000..074d992ff0d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentresponseStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EnrollmentresponseStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EnrollmentresponseStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown EnrollmentresponseStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/enrollmentresponse-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentresponseStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentresponseStatusEnumFactory.java
new file mode 100644
index 00000000000..4e328d73f63
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EnrollmentresponseStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EnrollmentresponseStatusEnumFactory implements EnumFactory {
+
+  public EnrollmentresponseStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return EnrollmentresponseStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return EnrollmentresponseStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return EnrollmentresponseStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return EnrollmentresponseStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown EnrollmentresponseStatus code '"+codeString+"'");
+  }
+
+  public String toCode(EnrollmentresponseStatus code) {
+    if (code == EnrollmentresponseStatus.ACTIVE)
+      return "active";
+    if (code == EnrollmentresponseStatus.CANCELLED)
+      return "cancelled";
+    if (code == EnrollmentresponseStatus.DRAFT)
+      return "draft";
+    if (code == EnrollmentresponseStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(EnrollmentresponseStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EntformulaAdditive.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EntformulaAdditive.java
new file mode 100644
index 00000000000..253965862a1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EntformulaAdditive.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EntformulaAdditive {
+
+        /**
+         * Modular lipid enteral formula component
+         */
+        LIPID, 
+        /**
+         * Modular protein enteral formula component
+         */
+        PROTEIN, 
+        /**
+         * Modular carbohydrate enteral formula component
+         */
+        CARBOHYDRATE, 
+        /**
+         * Modular fiber enteral formula component
+         */
+        FIBER, 
+        /**
+         * Added water
+         */
+        WATER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EntformulaAdditive fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("lipid".equals(codeString))
+          return LIPID;
+        if ("protein".equals(codeString))
+          return PROTEIN;
+        if ("carbohydrate".equals(codeString))
+          return CARBOHYDRATE;
+        if ("fiber".equals(codeString))
+          return FIBER;
+        if ("water".equals(codeString))
+          return WATER;
+        throw new FHIRException("Unknown EntformulaAdditive code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LIPID: return "lipid";
+            case PROTEIN: return "protein";
+            case CARBOHYDRATE: return "carbohydrate";
+            case FIBER: return "fiber";
+            case WATER: return "water";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/entformula-additive";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LIPID: return "Modular lipid enteral formula component";
+            case PROTEIN: return "Modular protein enteral formula component";
+            case CARBOHYDRATE: return "Modular carbohydrate enteral formula component";
+            case FIBER: return "Modular fiber enteral formula component";
+            case WATER: return "Added water";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LIPID: return "Lipid";
+            case PROTEIN: return "Protein";
+            case CARBOHYDRATE: return "Carbohydrate";
+            case FIBER: return "Fiber";
+            case WATER: return "Water";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EntformulaAdditiveEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EntformulaAdditiveEnumFactory.java
new file mode 100644
index 00000000000..b3f33162925
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EntformulaAdditiveEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EntformulaAdditiveEnumFactory implements EnumFactory {
+
+  public EntformulaAdditive fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("lipid".equals(codeString))
+      return EntformulaAdditive.LIPID;
+    if ("protein".equals(codeString))
+      return EntformulaAdditive.PROTEIN;
+    if ("carbohydrate".equals(codeString))
+      return EntformulaAdditive.CARBOHYDRATE;
+    if ("fiber".equals(codeString))
+      return EntformulaAdditive.FIBER;
+    if ("water".equals(codeString))
+      return EntformulaAdditive.WATER;
+    throw new IllegalArgumentException("Unknown EntformulaAdditive code '"+codeString+"'");
+  }
+
+  public String toCode(EntformulaAdditive code) {
+    if (code == EntformulaAdditive.LIPID)
+      return "lipid";
+    if (code == EntformulaAdditive.PROTEIN)
+      return "protein";
+    if (code == EntformulaAdditive.CARBOHYDRATE)
+      return "carbohydrate";
+    if (code == EntformulaAdditive.FIBER)
+      return "fiber";
+    if (code == EntformulaAdditive.WATER)
+      return "water";
+    return "?";
+  }
+
+    public String toSystem(EntformulaAdditive code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeOfCareStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeOfCareStatus.java
new file mode 100644
index 00000000000..21fae9a8328
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeOfCareStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EpisodeOfCareStatus {
+
+        /**
+         * This episode of care is planned to start at the date specified in the period.start. During this status, an organization may perform assessments to determine if the patient is eligible to receive services, or be organizing to make resources available to provide care services.
+         */
+        PLANNED, 
+        /**
+         * This episode has been placed on a waitlist, pending the episode being made active (or cancelled).
+         */
+        WAITLIST, 
+        /**
+         * This episode of care is current.
+         */
+        ACTIVE, 
+        /**
+         * This episode of care is on hold, the organization has limited responsibility for the patient (such as while on respite).
+         */
+        ONHOLD, 
+        /**
+         * This episode of care is finished and the organization is not expecting to be providing further care to the patient. Can also be known as "closed", "completed" or other similar terms.
+         */
+        FINISHED, 
+        /**
+         * The episode of care was cancelled, or withdrawn from service, often selected during the planned stage as the patient may have gone elsewhere, or the circumstances have changed and the organization is unable to provide the care. It indicates that services terminated outside the planned/expected workflow.
+         */
+        CANCELLED, 
+        /**
+         * This instance should not have been part of this patient's medical record.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EpisodeOfCareStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("planned".equals(codeString))
+          return PLANNED;
+        if ("waitlist".equals(codeString))
+          return WAITLIST;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("onhold".equals(codeString))
+          return ONHOLD;
+        if ("finished".equals(codeString))
+          return FINISHED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown EpisodeOfCareStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PLANNED: return "planned";
+            case WAITLIST: return "waitlist";
+            case ACTIVE: return "active";
+            case ONHOLD: return "onhold";
+            case FINISHED: return "finished";
+            case CANCELLED: return "cancelled";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/episode-of-care-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PLANNED: return "This episode of care is planned to start at the date specified in the period.start. During this status, an organization may perform assessments to determine if the patient is eligible to receive services, or be organizing to make resources available to provide care services.";
+            case WAITLIST: return "This episode has been placed on a waitlist, pending the episode being made active (or cancelled).";
+            case ACTIVE: return "This episode of care is current.";
+            case ONHOLD: return "This episode of care is on hold, the organization has limited responsibility for the patient (such as while on respite).";
+            case FINISHED: return "This episode of care is finished and the organization is not expecting to be providing further care to the patient. Can also be known as \"closed\", \"completed\" or other similar terms.";
+            case CANCELLED: return "The episode of care was cancelled, or withdrawn from service, often selected during the planned stage as the patient may have gone elsewhere, or the circumstances have changed and the organization is unable to provide the care. It indicates that services terminated outside the planned/expected workflow.";
+            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PLANNED: return "Planned";
+            case WAITLIST: return "Waitlist";
+            case ACTIVE: return "Active";
+            case ONHOLD: return "On Hold";
+            case FINISHED: return "Finished";
+            case CANCELLED: return "Cancelled";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeOfCareStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeOfCareStatusEnumFactory.java
new file mode 100644
index 00000000000..32ae4d83d0f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeOfCareStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EpisodeOfCareStatusEnumFactory implements EnumFactory {
+
+  public EpisodeOfCareStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("planned".equals(codeString))
+      return EpisodeOfCareStatus.PLANNED;
+    if ("waitlist".equals(codeString))
+      return EpisodeOfCareStatus.WAITLIST;
+    if ("active".equals(codeString))
+      return EpisodeOfCareStatus.ACTIVE;
+    if ("onhold".equals(codeString))
+      return EpisodeOfCareStatus.ONHOLD;
+    if ("finished".equals(codeString))
+      return EpisodeOfCareStatus.FINISHED;
+    if ("cancelled".equals(codeString))
+      return EpisodeOfCareStatus.CANCELLED;
+    if ("entered-in-error".equals(codeString))
+      return EpisodeOfCareStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown EpisodeOfCareStatus code '"+codeString+"'");
+  }
+
+  public String toCode(EpisodeOfCareStatus code) {
+    if (code == EpisodeOfCareStatus.PLANNED)
+      return "planned";
+    if (code == EpisodeOfCareStatus.WAITLIST)
+      return "waitlist";
+    if (code == EpisodeOfCareStatus.ACTIVE)
+      return "active";
+    if (code == EpisodeOfCareStatus.ONHOLD)
+      return "onhold";
+    if (code == EpisodeOfCareStatus.FINISHED)
+      return "finished";
+    if (code == EpisodeOfCareStatus.CANCELLED)
+      return "cancelled";
+    if (code == EpisodeOfCareStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(EpisodeOfCareStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeofcareType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeofcareType.java
new file mode 100644
index 00000000000..3cd2383a4b0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeofcareType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EpisodeofcareType {
+
+        /**
+         * null
+         */
+        HACC, 
+        /**
+         * null
+         */
+        PAC, 
+        /**
+         * null
+         */
+        DIAB, 
+        /**
+         * null
+         */
+        DA, 
+        /**
+         * null
+         */
+        CACP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EpisodeofcareType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("hacc".equals(codeString))
+          return HACC;
+        if ("pac".equals(codeString))
+          return PAC;
+        if ("diab".equals(codeString))
+          return DIAB;
+        if ("da".equals(codeString))
+          return DA;
+        if ("cacp".equals(codeString))
+          return CACP;
+        throw new FHIRException("Unknown EpisodeofcareType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HACC: return "hacc";
+            case PAC: return "pac";
+            case DIAB: return "diab";
+            case DA: return "da";
+            case CACP: return "cacp";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/episodeofcare-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HACC: return "";
+            case PAC: return "";
+            case DIAB: return "";
+            case DA: return "";
+            case CACP: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HACC: return "Home and Community Care";
+            case PAC: return "Post Acute Care";
+            case DIAB: return "Post co-ordinated diabetes program";
+            case DA: return "Drug and alcohol rehabilitation";
+            case CACP: return "Community-based aged care";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeofcareTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeofcareTypeEnumFactory.java
new file mode 100644
index 00000000000..f6be866ecd5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EpisodeofcareTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EpisodeofcareTypeEnumFactory implements EnumFactory {
+
+  public EpisodeofcareType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("hacc".equals(codeString))
+      return EpisodeofcareType.HACC;
+    if ("pac".equals(codeString))
+      return EpisodeofcareType.PAC;
+    if ("diab".equals(codeString))
+      return EpisodeofcareType.DIAB;
+    if ("da".equals(codeString))
+      return EpisodeofcareType.DA;
+    if ("cacp".equals(codeString))
+      return EpisodeofcareType.CACP;
+    throw new IllegalArgumentException("Unknown EpisodeofcareType code '"+codeString+"'");
+  }
+
+  public String toCode(EpisodeofcareType code) {
+    if (code == EpisodeofcareType.HACC)
+      return "hacc";
+    if (code == EpisodeofcareType.PAC)
+      return "pac";
+    if (code == EpisodeofcareType.DIAB)
+      return "diab";
+    if (code == EpisodeofcareType.DA)
+      return "da";
+    if (code == EpisodeofcareType.CACP)
+      return "cacp";
+    return "?";
+  }
+
+    public String toSystem(EpisodeofcareType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventCapabilityMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventCapabilityMode.java
new file mode 100644
index 00000000000..f6125f8b84b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventCapabilityMode.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EventCapabilityMode {
+
+        /**
+         * The application sends requests and receives responses.
+         */
+        SENDER, 
+        /**
+         * The application receives requests and sends responses.
+         */
+        RECEIVER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EventCapabilityMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("sender".equals(codeString))
+          return SENDER;
+        if ("receiver".equals(codeString))
+          return RECEIVER;
+        throw new FHIRException("Unknown EventCapabilityMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SENDER: return "sender";
+            case RECEIVER: return "receiver";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/event-capability-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SENDER: return "The application sends requests and receives responses.";
+            case RECEIVER: return "The application receives requests and sends responses.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SENDER: return "Sender";
+            case RECEIVER: return "Receiver";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventCapabilityModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventCapabilityModeEnumFactory.java
new file mode 100644
index 00000000000..1aab0fb2002
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventCapabilityModeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EventCapabilityModeEnumFactory implements EnumFactory {
+
+  public EventCapabilityMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("sender".equals(codeString))
+      return EventCapabilityMode.SENDER;
+    if ("receiver".equals(codeString))
+      return EventCapabilityMode.RECEIVER;
+    throw new IllegalArgumentException("Unknown EventCapabilityMode code '"+codeString+"'");
+  }
+
+  public String toCode(EventCapabilityMode code) {
+    if (code == EventCapabilityMode.SENDER)
+      return "sender";
+    if (code == EventCapabilityMode.RECEIVER)
+      return "receiver";
+    return "?";
+  }
+
+    public String toSystem(EventCapabilityMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventStatus.java
new file mode 100644
index 00000000000..86429d64d1a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EventStatus {
+
+        /**
+         * 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.
+         */
+        PREPARATION, 
+        /**
+         * The event is currently occurring
+         */
+        INPROGRESS, 
+        /**
+         * The event has been temporarily stopped but is expected to resume in the future
+         */
+        SUSPENDED, 
+        /**
+         * The event was  prior to the full completion of the intended actions
+         */
+        ABORTED, 
+        /**
+         * 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
+         */
+        NULL;
+        public static EventStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("preparation".equals(codeString))
+          return PREPARATION;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        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;
+        throw new FHIRException("Unknown EventStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PREPARATION: return "preparation";
+            case INPROGRESS: return "in-progress";
+            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() {
+          return "http://hl7.org/fhir/event-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            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 SUSPENDED: return "The event has been temporarily stopped but is expected to resume in the future";
+            case ABORTED: return "The event was  prior to the full completion of the intended actions";
+            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 PREPARATION: return "Preparation";
+            case INPROGRESS: return "In Progress";
+            case SUSPENDED: return "Suspended";
+            case ABORTED: return "Aborted";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventStatusEnumFactory.java
new file mode 100644
index 00000000000..83b4c56eff4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EventStatusEnumFactory implements EnumFactory {
+
+  public EventStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("preparation".equals(codeString))
+      return EventStatus.PREPARATION;
+    if ("in-progress".equals(codeString))
+      return EventStatus.INPROGRESS;
+    if ("suspended".equals(codeString))
+      return EventStatus.SUSPENDED;
+    if ("aborted".equals(codeString))
+      return EventStatus.ABORTED;
+    if ("completed".equals(codeString))
+      return EventStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return EventStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return EventStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown EventStatus code '"+codeString+"'");
+  }
+
+  public String toCode(EventStatus code) {
+    if (code == EventStatus.PREPARATION)
+      return "preparation";
+    if (code == EventStatus.INPROGRESS)
+      return "in-progress";
+    if (code == EventStatus.SUSPENDED)
+      return "suspended";
+    if (code == EventStatus.ABORTED)
+      return "aborted";
+    if (code == EventStatus.COMPLETED)
+      return "completed";
+    if (code == EventStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == EventStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(EventStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventTiming.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventTiming.java
new file mode 100644
index 00000000000..eeff384406f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventTiming.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum EventTiming {
+
+        /**
+         * event occurs during the morning
+         */
+        MORN, 
+        /**
+         * event occurs during the afternoon
+         */
+        AFT, 
+        /**
+         * event occurs during the evening
+         */
+        EVE, 
+        /**
+         * event occurs during the night
+         */
+        NIGHT, 
+        /**
+         * event occurs [offset] after subject goes to sleep
+         */
+        PHS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static EventTiming fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("MORN".equals(codeString))
+          return MORN;
+        if ("AFT".equals(codeString))
+          return AFT;
+        if ("EVE".equals(codeString))
+          return EVE;
+        if ("NIGHT".equals(codeString))
+          return NIGHT;
+        if ("PHS".equals(codeString))
+          return PHS;
+        throw new FHIRException("Unknown EventTiming code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MORN: return "MORN";
+            case AFT: return "AFT";
+            case EVE: return "EVE";
+            case NIGHT: return "NIGHT";
+            case PHS: return "PHS";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/event-timing";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MORN: return "event occurs during the morning";
+            case AFT: return "event occurs during the afternoon";
+            case EVE: return "event occurs during the evening";
+            case NIGHT: return "event occurs during the night";
+            case PHS: return "event occurs [offset] after subject goes to sleep";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MORN: return "Morning";
+            case AFT: return "Afternoon";
+            case EVE: return "Evening";
+            case NIGHT: return "Night";
+            case PHS: return "After Sleep";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventTimingEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventTimingEnumFactory.java
new file mode 100644
index 00000000000..4b8cf6e81d6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/EventTimingEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class EventTimingEnumFactory implements EnumFactory {
+
+  public EventTiming fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("MORN".equals(codeString))
+      return EventTiming.MORN;
+    if ("AFT".equals(codeString))
+      return EventTiming.AFT;
+    if ("EVE".equals(codeString))
+      return EventTiming.EVE;
+    if ("NIGHT".equals(codeString))
+      return EventTiming.NIGHT;
+    if ("PHS".equals(codeString))
+      return EventTiming.PHS;
+    throw new IllegalArgumentException("Unknown EventTiming code '"+codeString+"'");
+  }
+
+  public String toCode(EventTiming code) {
+    if (code == EventTiming.MORN)
+      return "MORN";
+    if (code == EventTiming.AFT)
+      return "AFT";
+    if (code == EventTiming.EVE)
+      return "EVE";
+    if (code == EventTiming.NIGHT)
+      return "NIGHT";
+    if (code == EventTiming.PHS)
+      return "PHS";
+    return "?";
+  }
+
+    public String toSystem(EventTiming code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosisrelatedgroup.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosisrelatedgroup.java
new file mode 100644
index 00000000000..7bd1160b53c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosisrelatedgroup.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExDiagnosisrelatedgroup {
+
+        /**
+         * Normal Vaginal Delivery.
+         */
+        _100, 
+        /**
+         * Appendectomy without rupture or other complications.
+         */
+        _101, 
+        /**
+         * Emergency department treatment of a tooth abcess.
+         */
+        _300, 
+        /**
+         * Head trauma - concussion.
+         */
+        _400, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExDiagnosisrelatedgroup fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("100".equals(codeString))
+          return _100;
+        if ("101".equals(codeString))
+          return _101;
+        if ("300".equals(codeString))
+          return _300;
+        if ("400".equals(codeString))
+          return _400;
+        throw new FHIRException("Unknown ExDiagnosisrelatedgroup code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _100: return "100";
+            case _101: return "101";
+            case _300: return "300";
+            case _400: return "400";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-diagnosisrelatedgroup";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _100: return "Normal Vaginal Delivery.";
+            case _101: return "Appendectomy without rupture or other complications.";
+            case _300: return "Emergency department treatment of a tooth abcess.";
+            case _400: return "Head trauma - concussion.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _100: return "Normal Vaginal Delivery";
+            case _101: return "Appendectomy - uncomplicated";
+            case _300: return "Tooth abcess";
+            case _400: return "Head trauma - concussion";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosisrelatedgroupEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosisrelatedgroupEnumFactory.java
new file mode 100644
index 00000000000..c6263245936
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosisrelatedgroupEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExDiagnosisrelatedgroupEnumFactory implements EnumFactory {
+
+  public ExDiagnosisrelatedgroup fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("100".equals(codeString))
+      return ExDiagnosisrelatedgroup._100;
+    if ("101".equals(codeString))
+      return ExDiagnosisrelatedgroup._101;
+    if ("300".equals(codeString))
+      return ExDiagnosisrelatedgroup._300;
+    if ("400".equals(codeString))
+      return ExDiagnosisrelatedgroup._400;
+    throw new IllegalArgumentException("Unknown ExDiagnosisrelatedgroup code '"+codeString+"'");
+  }
+
+  public String toCode(ExDiagnosisrelatedgroup code) {
+    if (code == ExDiagnosisrelatedgroup._100)
+      return "100";
+    if (code == ExDiagnosisrelatedgroup._101)
+      return "101";
+    if (code == ExDiagnosisrelatedgroup._300)
+      return "300";
+    if (code == ExDiagnosisrelatedgroup._400)
+      return "400";
+    return "?";
+  }
+
+    public String toSystem(ExDiagnosisrelatedgroup code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosistype.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosistype.java
new file mode 100644
index 00000000000..1827a5c2da3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosistype.java
@@ -0,0 +1,177 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExDiagnosistype {
+
+        /**
+         * The diagnosis given as the reason why the patient was admitted to the hospital.
+         */
+        ADMITTING, 
+        /**
+         * A diagnosis made on the basis of medical signs and patient-reported symptoms, rather than diagnostic tests.
+         */
+        CLINICAL, 
+        /**
+         * One of a set of the possible diagnoses that could be connected to the signs, symptoms, and lab findings.
+         */
+        DIFFERENTIAL, 
+        /**
+         * The diagnosis given when the patient is discharged from the hospital.
+         */
+        DISCHARGE, 
+        /**
+         * A diagnosis based significantly on laboratory reports or test results, rather than the physical examination of the patient.
+         */
+        LABORATORY, 
+        /**
+         * A diagnosis which identifies people's responses to situations in their lives, such as a readiness to change or a willingness to accept assistance.
+         */
+        NURSING, 
+        /**
+         * A diagnosis determined prior to birth.
+         */
+        PRENATAL, 
+        /**
+         * The single medical diagnosis that is most relevant to the patient's chief complaint or need for treatment.
+         */
+        PRINCIPAL, 
+        /**
+         * A diagnosis based primarily on the results from medical imaging studies.
+         */
+        RADIOLOGY, 
+        /**
+         * A diagnosis determined using telemedicine techniques.
+         */
+        REMOTE, 
+        /**
+         * The labeling of an illness in a specific historical event using modern knowledge, methods and disease classifications.
+         */
+        RETROSPECTIVE, 
+        /**
+         * A diagnosis determined by the patient.
+         */
+        SELF, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExDiagnosistype fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("admitting".equals(codeString))
+          return ADMITTING;
+        if ("clinical".equals(codeString))
+          return CLINICAL;
+        if ("differential".equals(codeString))
+          return DIFFERENTIAL;
+        if ("discharge".equals(codeString))
+          return DISCHARGE;
+        if ("laboratory".equals(codeString))
+          return LABORATORY;
+        if ("nursing".equals(codeString))
+          return NURSING;
+        if ("prenatal".equals(codeString))
+          return PRENATAL;
+        if ("principal".equals(codeString))
+          return PRINCIPAL;
+        if ("radiology".equals(codeString))
+          return RADIOLOGY;
+        if ("remote".equals(codeString))
+          return REMOTE;
+        if ("retrospective".equals(codeString))
+          return RETROSPECTIVE;
+        if ("self".equals(codeString))
+          return SELF;
+        throw new FHIRException("Unknown ExDiagnosistype code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ADMITTING: return "admitting";
+            case CLINICAL: return "clinical";
+            case DIFFERENTIAL: return "differential";
+            case DISCHARGE: return "discharge";
+            case LABORATORY: return "laboratory";
+            case NURSING: return "nursing";
+            case PRENATAL: return "prenatal";
+            case PRINCIPAL: return "principal";
+            case RADIOLOGY: return "radiology";
+            case REMOTE: return "remote";
+            case RETROSPECTIVE: return "retrospective";
+            case SELF: return "self";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-diagnosistype";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ADMITTING: return "The diagnosis given as the reason why the patient was admitted to the hospital.";
+            case CLINICAL: return "A diagnosis made on the basis of medical signs and patient-reported symptoms, rather than diagnostic tests.";
+            case DIFFERENTIAL: return "One of a set of the possible diagnoses that could be connected to the signs, symptoms, and lab findings.";
+            case DISCHARGE: return "The diagnosis given when the patient is discharged from the hospital.";
+            case LABORATORY: return "A diagnosis based significantly on laboratory reports or test results, rather than the physical examination of the patient.";
+            case NURSING: return "A diagnosis which identifies people's responses to situations in their lives, such as a readiness to change or a willingness to accept assistance.";
+            case PRENATAL: return "A diagnosis determined prior to birth.";
+            case PRINCIPAL: return "The single medical diagnosis that is most relevant to the patient's chief complaint or need for treatment.";
+            case RADIOLOGY: return "A diagnosis based primarily on the results from medical imaging studies.";
+            case REMOTE: return "A diagnosis determined using telemedicine techniques.";
+            case RETROSPECTIVE: return "The labeling of an illness in a specific historical event using modern knowledge, methods and disease classifications.";
+            case SELF: return "A diagnosis determined by the patient.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ADMITTING: return "Admitting Diagnosis";
+            case CLINICAL: return "Clinical Diagnosis";
+            case DIFFERENTIAL: return "Differential Diagnosis";
+            case DISCHARGE: return "Discharge Diagnosis";
+            case LABORATORY: return "Laboratory Diagnosis";
+            case NURSING: return "Nursing Diagnosis";
+            case PRENATAL: return "Prenatal Diagnosis";
+            case PRINCIPAL: return "Principal Diagnosis";
+            case RADIOLOGY: return "Radiology Diagnosis";
+            case REMOTE: return "Remote Diagnosis";
+            case RETROSPECTIVE: return "Retrospective Diagnosis";
+            case SELF: return "Self Diagnosis";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosistypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosistypeEnumFactory.java
new file mode 100644
index 00000000000..4fa40f14830
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExDiagnosistypeEnumFactory.java
@@ -0,0 +1,102 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExDiagnosistypeEnumFactory implements EnumFactory {
+
+  public ExDiagnosistype fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("admitting".equals(codeString))
+      return ExDiagnosistype.ADMITTING;
+    if ("clinical".equals(codeString))
+      return ExDiagnosistype.CLINICAL;
+    if ("differential".equals(codeString))
+      return ExDiagnosistype.DIFFERENTIAL;
+    if ("discharge".equals(codeString))
+      return ExDiagnosistype.DISCHARGE;
+    if ("laboratory".equals(codeString))
+      return ExDiagnosistype.LABORATORY;
+    if ("nursing".equals(codeString))
+      return ExDiagnosistype.NURSING;
+    if ("prenatal".equals(codeString))
+      return ExDiagnosistype.PRENATAL;
+    if ("principal".equals(codeString))
+      return ExDiagnosistype.PRINCIPAL;
+    if ("radiology".equals(codeString))
+      return ExDiagnosistype.RADIOLOGY;
+    if ("remote".equals(codeString))
+      return ExDiagnosistype.REMOTE;
+    if ("retrospective".equals(codeString))
+      return ExDiagnosistype.RETROSPECTIVE;
+    if ("self".equals(codeString))
+      return ExDiagnosistype.SELF;
+    throw new IllegalArgumentException("Unknown ExDiagnosistype code '"+codeString+"'");
+  }
+
+  public String toCode(ExDiagnosistype code) {
+    if (code == ExDiagnosistype.ADMITTING)
+      return "admitting";
+    if (code == ExDiagnosistype.CLINICAL)
+      return "clinical";
+    if (code == ExDiagnosistype.DIFFERENTIAL)
+      return "differential";
+    if (code == ExDiagnosistype.DISCHARGE)
+      return "discharge";
+    if (code == ExDiagnosistype.LABORATORY)
+      return "laboratory";
+    if (code == ExDiagnosistype.NURSING)
+      return "nursing";
+    if (code == ExDiagnosistype.PRENATAL)
+      return "prenatal";
+    if (code == ExDiagnosistype.PRINCIPAL)
+      return "principal";
+    if (code == ExDiagnosistype.RADIOLOGY)
+      return "radiology";
+    if (code == ExDiagnosistype.REMOTE)
+      return "remote";
+    if (code == ExDiagnosistype.RETROSPECTIVE)
+      return "retrospective";
+    if (code == ExDiagnosistype.SELF)
+      return "self";
+    return "?";
+  }
+
+    public String toSystem(ExDiagnosistype code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExOnsettype.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExOnsettype.java
new file mode 100644
index 00000000000..9b0af14c81b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExOnsettype.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExOnsettype {
+
+        /**
+         * Date of last examination.
+         */
+        LXM, 
+        /**
+         * Date when symptoms were first noticed..
+         */
+        SYM, 
+        /**
+         * Start date of last menstruation.
+         */
+        LMN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExOnsettype fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("lxm".equals(codeString))
+          return LXM;
+        if ("sym".equals(codeString))
+          return SYM;
+        if ("lmn".equals(codeString))
+          return LMN;
+        throw new FHIRException("Unknown ExOnsettype code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LXM: return "lxm";
+            case SYM: return "sym";
+            case LMN: return "lmn";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-onsettype";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LXM: return "Date of last examination.";
+            case SYM: return "Date when symptoms were first noticed..";
+            case LMN: return "Start date of last menstruation.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LXM: return "Last Exam";
+            case SYM: return "Start of Symptoms";
+            case LMN: return "Last Menstruation";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExOnsettypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExOnsettypeEnumFactory.java
new file mode 100644
index 00000000000..0a3aece4bfc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExOnsettypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExOnsettypeEnumFactory implements EnumFactory {
+
+  public ExOnsettype fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("lxm".equals(codeString))
+      return ExOnsettype.LXM;
+    if ("sym".equals(codeString))
+      return ExOnsettype.SYM;
+    if ("lmn".equals(codeString))
+      return ExOnsettype.LMN;
+    throw new IllegalArgumentException("Unknown ExOnsettype code '"+codeString+"'");
+  }
+
+  public String toCode(ExOnsettype code) {
+    if (code == ExOnsettype.LXM)
+      return "lxm";
+    if (code == ExOnsettype.SYM)
+      return "sym";
+    if (code == ExOnsettype.LMN)
+      return "lmn";
+    return "?";
+  }
+
+    public String toSystem(ExOnsettype code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPayeeResourceType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPayeeResourceType.java
new file mode 100644
index 00000000000..b9db7364380
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPayeeResourceType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExPayeeResourceType {
+
+        /**
+         * Organization resource
+         */
+        ORGANIZATION, 
+        /**
+         * Patient resource
+         */
+        PATIENT, 
+        /**
+         * Practitioner resource
+         */
+        PRACTITIONER, 
+        /**
+         * RelatedPerson resource
+         */
+        RELATEDPERSON, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExPayeeResourceType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("organization".equals(codeString))
+          return ORGANIZATION;
+        if ("patient".equals(codeString))
+          return PATIENT;
+        if ("practitioner".equals(codeString))
+          return PRACTITIONER;
+        if ("relatedperson".equals(codeString))
+          return RELATEDPERSON;
+        throw new FHIRException("Unknown ExPayeeResourceType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ORGANIZATION: return "organization";
+            case PATIENT: return "patient";
+            case PRACTITIONER: return "practitioner";
+            case RELATEDPERSON: return "relatedperson";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-payee-resource-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ORGANIZATION: return "Organization resource";
+            case PATIENT: return "Patient resource";
+            case PRACTITIONER: return "Practitioner resource";
+            case RELATEDPERSON: return "RelatedPerson resource";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ORGANIZATION: return "Organization";
+            case PATIENT: return "Patient";
+            case PRACTITIONER: return "Practitioner";
+            case RELATEDPERSON: return "RelatedPerson";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPayeeResourceTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPayeeResourceTypeEnumFactory.java
new file mode 100644
index 00000000000..3c0bc521103
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPayeeResourceTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExPayeeResourceTypeEnumFactory implements EnumFactory {
+
+  public ExPayeeResourceType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("organization".equals(codeString))
+      return ExPayeeResourceType.ORGANIZATION;
+    if ("patient".equals(codeString))
+      return ExPayeeResourceType.PATIENT;
+    if ("practitioner".equals(codeString))
+      return ExPayeeResourceType.PRACTITIONER;
+    if ("relatedperson".equals(codeString))
+      return ExPayeeResourceType.RELATEDPERSON;
+    throw new IllegalArgumentException("Unknown ExPayeeResourceType code '"+codeString+"'");
+  }
+
+  public String toCode(ExPayeeResourceType code) {
+    if (code == ExPayeeResourceType.ORGANIZATION)
+      return "organization";
+    if (code == ExPayeeResourceType.PATIENT)
+      return "patient";
+    if (code == ExPayeeResourceType.PRACTITIONER)
+      return "practitioner";
+    if (code == ExPayeeResourceType.RELATEDPERSON)
+      return "relatedperson";
+    return "?";
+  }
+
+    public String toSystem(ExPayeeResourceType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPaymenttype.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPaymenttype.java
new file mode 100644
index 00000000000..f5889ebaa94
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPaymenttype.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExPaymenttype {
+
+        /**
+         * Complete (final) payment of the benefit under the Claim less any adjustments.
+         */
+        COMPLETE, 
+        /**
+         * Partial payment of the benefit under the Claim less any adjustments.
+         */
+        PARTIAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExPaymenttype fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("complete".equals(codeString))
+          return COMPLETE;
+        if ("partial".equals(codeString))
+          return PARTIAL;
+        throw new FHIRException("Unknown ExPaymenttype code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COMPLETE: return "complete";
+            case PARTIAL: return "partial";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-paymenttype";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COMPLETE: return "Complete (final) payment of the benefit under the Claim less any adjustments.";
+            case PARTIAL: return "Partial payment of the benefit under the Claim less any adjustments.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COMPLETE: return "Complete";
+            case PARTIAL: return "Partial";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPaymenttypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPaymenttypeEnumFactory.java
new file mode 100644
index 00000000000..63f7dd41582
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExPaymenttypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExPaymenttypeEnumFactory implements EnumFactory {
+
+  public ExPaymenttype fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("complete".equals(codeString))
+      return ExPaymenttype.COMPLETE;
+    if ("partial".equals(codeString))
+      return ExPaymenttype.PARTIAL;
+    throw new IllegalArgumentException("Unknown ExPaymenttype code '"+codeString+"'");
+  }
+
+  public String toCode(ExPaymenttype code) {
+    if (code == ExPaymenttype.COMPLETE)
+      return "complete";
+    if (code == ExPaymenttype.PARTIAL)
+      return "partial";
+    return "?";
+  }
+
+    public String toSystem(ExPaymenttype code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExProgramCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExProgramCode.java
new file mode 100644
index 00000000000..50bb9c8b48d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExProgramCode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExProgramCode {
+
+        /**
+         * Child Asthma Program
+         */
+        AS, 
+        /**
+         * Heamodialisis Program.
+         */
+        HD, 
+        /**
+         * Autism Screening Program.
+         */
+        AUSCR, 
+        /**
+         * No program code applies.
+         */
+        NONE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExProgramCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("as".equals(codeString))
+          return AS;
+        if ("hd".equals(codeString))
+          return HD;
+        if ("auscr".equals(codeString))
+          return AUSCR;
+        if ("none".equals(codeString))
+          return NONE;
+        throw new FHIRException("Unknown ExProgramCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AS: return "as";
+            case HD: return "hd";
+            case AUSCR: return "auscr";
+            case NONE: return "none";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-programcode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AS: return "Child Asthma Program";
+            case HD: return "Heamodialisis Program.";
+            case AUSCR: return "Autism Screening Program.";
+            case NONE: return "No program code applies.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AS: return "Child Asthma";
+            case HD: return "Heamodialisis";
+            case AUSCR: return "Autism Screening";
+            case NONE: return "None";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExProgramCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExProgramCodeEnumFactory.java
new file mode 100644
index 00000000000..795a71f90e5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExProgramCodeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExProgramCodeEnumFactory implements EnumFactory {
+
+  public ExProgramCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("as".equals(codeString))
+      return ExProgramCode.AS;
+    if ("hd".equals(codeString))
+      return ExProgramCode.HD;
+    if ("auscr".equals(codeString))
+      return ExProgramCode.AUSCR;
+    if ("none".equals(codeString))
+      return ExProgramCode.NONE;
+    throw new IllegalArgumentException("Unknown ExProgramCode code '"+codeString+"'");
+  }
+
+  public String toCode(ExProgramCode code) {
+    if (code == ExProgramCode.AS)
+      return "as";
+    if (code == ExProgramCode.HD)
+      return "hd";
+    if (code == ExProgramCode.AUSCR)
+      return "auscr";
+    if (code == ExProgramCode.NONE)
+      return "none";
+    return "?";
+  }
+
+    public String toSystem(ExProgramCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExRevenueCenter.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExRevenueCenter.java
new file mode 100644
index 00000000000..cb6d141874e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExRevenueCenter.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExRevenueCenter {
+
+        /**
+         * Anaesthesia.
+         */
+        _0370, 
+        /**
+         * Physical Therapy.
+         */
+        _0420, 
+        /**
+         * Physical Therapy - visit charge.
+         */
+        _0421, 
+        /**
+         * Speech-Language Pathology.
+         */
+        _0440, 
+        /**
+         * Speech-Language Pathology- visit charge
+         */
+        _0441, 
+        /**
+         * Emergency Room
+         */
+        _0450, 
+        /**
+         * Emergency Room - EM/EMTALA
+         */
+        _0451, 
+        /**
+         * Emergency Room - beyond EMTALA
+         */
+        _0452, 
+        /**
+         * Vision Clinic
+         */
+        _0010, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExRevenueCenter fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("0370".equals(codeString))
+          return _0370;
+        if ("0420".equals(codeString))
+          return _0420;
+        if ("0421".equals(codeString))
+          return _0421;
+        if ("0440".equals(codeString))
+          return _0440;
+        if ("0441".equals(codeString))
+          return _0441;
+        if ("0450".equals(codeString))
+          return _0450;
+        if ("0451".equals(codeString))
+          return _0451;
+        if ("0452".equals(codeString))
+          return _0452;
+        if ("0010".equals(codeString))
+          return _0010;
+        throw new FHIRException("Unknown ExRevenueCenter code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _0370: return "0370";
+            case _0420: return "0420";
+            case _0421: return "0421";
+            case _0440: return "0440";
+            case _0441: return "0441";
+            case _0450: return "0450";
+            case _0451: return "0451";
+            case _0452: return "0452";
+            case _0010: return "0010";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-revenue-center";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _0370: return "Anaesthesia.";
+            case _0420: return "Physical Therapy.";
+            case _0421: return "Physical Therapy - visit charge.";
+            case _0440: return "Speech-Language Pathology.";
+            case _0441: return "Speech-Language Pathology- visit charge";
+            case _0450: return "Emergency Room";
+            case _0451: return "Emergency Room - EM/EMTALA";
+            case _0452: return "Emergency Room - beyond EMTALA";
+            case _0010: return "Vision Clinic";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _0370: return "Anaesthesia";
+            case _0420: return "Physical Therapy";
+            case _0421: return "Physical Therapy - ";
+            case _0440: return "Speech-Language Pathology";
+            case _0441: return "Speech-Language Pathology - Visit";
+            case _0450: return "Emergency Room";
+            case _0451: return "Emergency Room - EM/EMTALA";
+            case _0452: return "Emergency Room - beyond EMTALA";
+            case _0010: return "Vision Clinic";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExRevenueCenterEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExRevenueCenterEnumFactory.java
new file mode 100644
index 00000000000..2f686583f8e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExRevenueCenterEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExRevenueCenterEnumFactory implements EnumFactory {
+
+  public ExRevenueCenter fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("0370".equals(codeString))
+      return ExRevenueCenter._0370;
+    if ("0420".equals(codeString))
+      return ExRevenueCenter._0420;
+    if ("0421".equals(codeString))
+      return ExRevenueCenter._0421;
+    if ("0440".equals(codeString))
+      return ExRevenueCenter._0440;
+    if ("0441".equals(codeString))
+      return ExRevenueCenter._0441;
+    if ("0450".equals(codeString))
+      return ExRevenueCenter._0450;
+    if ("0451".equals(codeString))
+      return ExRevenueCenter._0451;
+    if ("0452".equals(codeString))
+      return ExRevenueCenter._0452;
+    if ("0010".equals(codeString))
+      return ExRevenueCenter._0010;
+    throw new IllegalArgumentException("Unknown ExRevenueCenter code '"+codeString+"'");
+  }
+
+  public String toCode(ExRevenueCenter code) {
+    if (code == ExRevenueCenter._0370)
+      return "0370";
+    if (code == ExRevenueCenter._0420)
+      return "0420";
+    if (code == ExRevenueCenter._0421)
+      return "0421";
+    if (code == ExRevenueCenter._0440)
+      return "0440";
+    if (code == ExRevenueCenter._0441)
+      return "0441";
+    if (code == ExRevenueCenter._0450)
+      return "0450";
+    if (code == ExRevenueCenter._0451)
+      return "0451";
+    if (code == ExRevenueCenter._0452)
+      return "0452";
+    if (code == ExRevenueCenter._0010)
+      return "0010";
+    return "?";
+  }
+
+    public String toSystem(ExRevenueCenter code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExplanationofbenefitStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExplanationofbenefitStatus.java
new file mode 100644
index 00000000000..7dc8a8661c1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExplanationofbenefitStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExplanationofbenefitStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExplanationofbenefitStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ExplanationofbenefitStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/explanationofbenefit-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExplanationofbenefitStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExplanationofbenefitStatusEnumFactory.java
new file mode 100644
index 00000000000..7772fe4a2e3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExplanationofbenefitStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExplanationofbenefitStatusEnumFactory implements EnumFactory {
+
+  public ExplanationofbenefitStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return ExplanationofbenefitStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return ExplanationofbenefitStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return ExplanationofbenefitStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return ExplanationofbenefitStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ExplanationofbenefitStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ExplanationofbenefitStatus code) {
+    if (code == ExplanationofbenefitStatus.ACTIVE)
+      return "active";
+    if (code == ExplanationofbenefitStatus.CANCELLED)
+      return "cancelled";
+    if (code == ExplanationofbenefitStatus.DRAFT)
+      return "draft";
+    if (code == ExplanationofbenefitStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ExplanationofbenefitStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtensionContext.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtensionContext.java
new file mode 100644
index 00000000000..07ff75915ec
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtensionContext.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExtensionContext {
+
+        /**
+         * The context is all elements matching a particular resource element path.
+         */
+        RESOURCE, 
+        /**
+         * The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name).
+         */
+        DATATYPE, 
+        /**
+         * The context is a particular extension from a particular profile, a uri that identifies the extension definition.
+         */
+        EXTENSION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExtensionContext fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("resource".equals(codeString))
+          return RESOURCE;
+        if ("datatype".equals(codeString))
+          return DATATYPE;
+        if ("extension".equals(codeString))
+          return EXTENSION;
+        throw new FHIRException("Unknown ExtensionContext code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case RESOURCE: return "resource";
+            case DATATYPE: return "datatype";
+            case EXTENSION: return "extension";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/extension-context";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case RESOURCE: return "The context is all elements matching a particular resource element path.";
+            case DATATYPE: return "The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name).";
+            case EXTENSION: return "The context is a particular extension from a particular profile, a uri that identifies the extension definition.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case RESOURCE: return "Resource";
+            case DATATYPE: return "Datatype";
+            case EXTENSION: return "Extension";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtensionContextEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtensionContextEnumFactory.java
new file mode 100644
index 00000000000..f1e24af4b1d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtensionContextEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExtensionContextEnumFactory implements EnumFactory {
+
+  public ExtensionContext fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("resource".equals(codeString))
+      return ExtensionContext.RESOURCE;
+    if ("datatype".equals(codeString))
+      return ExtensionContext.DATATYPE;
+    if ("extension".equals(codeString))
+      return ExtensionContext.EXTENSION;
+    throw new IllegalArgumentException("Unknown ExtensionContext code '"+codeString+"'");
+  }
+
+  public String toCode(ExtensionContext code) {
+    if (code == ExtensionContext.RESOURCE)
+      return "resource";
+    if (code == ExtensionContext.DATATYPE)
+      return "datatype";
+    if (code == ExtensionContext.EXTENSION)
+      return "extension";
+    return "?";
+  }
+
+    public String toSystem(ExtensionContext code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraActivityType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraActivityType.java
new file mode 100644
index 00000000000..25034ca3d6e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraActivityType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExtraActivityType {
+
+        /**
+         * Activity resulting in a structured collection of preexisting content that does not necessarily result in an integral object with semantic context making it more than the sum of component parts, from which components could be disaggregated without loss of semantic context, e.g., the assembly of multiple stand-alone documents.
+         */
+        AGGREGATE, 
+        /**
+         * Activity resulting in the structured compilation of new and preexisting content for the purposes of forming an integral object with  semantic context making it more than the sum of component parts, which would be lost if decomposed. For example, the composition of a document that includes in whole or part other documents along with new content that result in a new document that has unique semantic meaning.
+         */
+        COMPOSE, 
+        /**
+         * The means used to associate a set of security attributes with a specific information object as part of the data structure for that object. [ISO-10181-3 Access Control]
+         */
+        LABEL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExtraActivityType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("aggregate".equals(codeString))
+          return AGGREGATE;
+        if ("compose".equals(codeString))
+          return COMPOSE;
+        if ("label".equals(codeString))
+          return LABEL;
+        throw new FHIRException("Unknown ExtraActivityType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AGGREGATE: return "aggregate";
+            case COMPOSE: return "compose";
+            case LABEL: return "label";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/extra-activity-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AGGREGATE: return "Activity resulting in a structured collection of preexisting content that does not necessarily result in an integral object with semantic context making it more than the sum of component parts, from which components could be disaggregated without loss of semantic context, e.g., the assembly of multiple stand-alone documents.";
+            case COMPOSE: return "Activity resulting in the structured compilation of new and preexisting content for the purposes of forming an integral object with  semantic context making it more than the sum of component parts, which would be lost if decomposed. For example, the composition of a document that includes in whole or part other documents along with new content that result in a new document that has unique semantic meaning.";
+            case LABEL: return "The means used to associate a set of security attributes with a specific information object as part of the data structure for that object. [ISO-10181-3 Access Control]";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AGGREGATE: return "aggregate";
+            case COMPOSE: return "compose";
+            case LABEL: return "label";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraActivityTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraActivityTypeEnumFactory.java
new file mode 100644
index 00000000000..e12dd868a76
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraActivityTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExtraActivityTypeEnumFactory implements EnumFactory {
+
+  public ExtraActivityType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("aggregate".equals(codeString))
+      return ExtraActivityType.AGGREGATE;
+    if ("compose".equals(codeString))
+      return ExtraActivityType.COMPOSE;
+    if ("label".equals(codeString))
+      return ExtraActivityType.LABEL;
+    throw new IllegalArgumentException("Unknown ExtraActivityType code '"+codeString+"'");
+  }
+
+  public String toCode(ExtraActivityType code) {
+    if (code == ExtraActivityType.AGGREGATE)
+      return "aggregate";
+    if (code == ExtraActivityType.COMPOSE)
+      return "compose";
+    if (code == ExtraActivityType.LABEL)
+      return "label";
+    return "?";
+  }
+
+    public String toSystem(ExtraActivityType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraSecurityRoleType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraSecurityRoleType.java
new file mode 100644
index 00000000000..885bde50f05
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraSecurityRoleType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ExtraSecurityRoleType {
+
+        /**
+         * An entity providing authorization services to enable the electronic sharing of health-related information based on resource owner's preapproved permissions. For example, an UMA Authorization Server[UMA]
+         */
+        AUTHSERVER, 
+        /**
+         * An entity that collects information over which the data subject may have certain rights under policy or law to control that information's management and distribution by data collectors, including the right to access, retrieve, distribute, or delete that information. 
+         */
+        DATACOLLECTOR, 
+        /**
+         * An entity that processes collected information over which the data subject may have certain rights under policy or law to control that information's management and distribution by data processors, including the right to access, retrieve, distribute, or delete that information.
+         */
+        DATAPROCESSOR, 
+        /**
+         * A person whose personal information is collected or processed, and who may have certain rights under policy or law to control that information's management and distribution by data collectors or processors, including the right to access, retrieve, distribute, or delete that information.
+         */
+        DATASUBJECT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ExtraSecurityRoleType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("authserver".equals(codeString))
+          return AUTHSERVER;
+        if ("datacollector".equals(codeString))
+          return DATACOLLECTOR;
+        if ("dataprocessor".equals(codeString))
+          return DATAPROCESSOR;
+        if ("datasubject".equals(codeString))
+          return DATASUBJECT;
+        throw new FHIRException("Unknown ExtraSecurityRoleType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AUTHSERVER: return "authserver";
+            case DATACOLLECTOR: return "datacollector";
+            case DATAPROCESSOR: return "dataprocessor";
+            case DATASUBJECT: return "datasubject";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/extra-security-role-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AUTHSERVER: return "An entity providing authorization services to enable the electronic sharing of health-related information based on resource owner's preapproved permissions. For example, an UMA Authorization Server[UMA]";
+            case DATACOLLECTOR: return "An entity that collects information over which the data subject may have certain rights under policy or law to control that information's management and distribution by data collectors, including the right to access, retrieve, distribute, or delete that information. ";
+            case DATAPROCESSOR: return "An entity that processes collected information over which the data subject may have certain rights under policy or law to control that information's management and distribution by data processors, including the right to access, retrieve, distribute, or delete that information.";
+            case DATASUBJECT: return "A person whose personal information is collected or processed, and who may have certain rights under policy or law to control that information's management and distribution by data collectors or processors, including the right to access, retrieve, distribute, or delete that information.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AUTHSERVER: return "authorization server";
+            case DATACOLLECTOR: return "data collector";
+            case DATAPROCESSOR: return "data processor";
+            case DATASUBJECT: return "data subject";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraSecurityRoleTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraSecurityRoleTypeEnumFactory.java
new file mode 100644
index 00000000000..0826ec7e1e9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ExtraSecurityRoleTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ExtraSecurityRoleTypeEnumFactory implements EnumFactory {
+
+  public ExtraSecurityRoleType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("authserver".equals(codeString))
+      return ExtraSecurityRoleType.AUTHSERVER;
+    if ("datacollector".equals(codeString))
+      return ExtraSecurityRoleType.DATACOLLECTOR;
+    if ("dataprocessor".equals(codeString))
+      return ExtraSecurityRoleType.DATAPROCESSOR;
+    if ("datasubject".equals(codeString))
+      return ExtraSecurityRoleType.DATASUBJECT;
+    throw new IllegalArgumentException("Unknown ExtraSecurityRoleType code '"+codeString+"'");
+  }
+
+  public String toCode(ExtraSecurityRoleType code) {
+    if (code == ExtraSecurityRoleType.AUTHSERVER)
+      return "authserver";
+    if (code == ExtraSecurityRoleType.DATACOLLECTOR)
+      return "datacollector";
+    if (code == ExtraSecurityRoleType.DATAPROCESSOR)
+      return "dataprocessor";
+    if (code == ExtraSecurityRoleType.DATASUBJECT)
+      return "datasubject";
+    return "?";
+  }
+
+    public String toSystem(ExtraSecurityRoleType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FilterOperator.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FilterOperator.java
new file mode 100644
index 00000000000..1ca0eacbffc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FilterOperator.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum FilterOperator {
+
+        /**
+         * The specified property of the code equals the provided value.
+         */
+        EQUAL, 
+        /**
+         * Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, including the provided concept itself (i.e. include child codes)
+         */
+        ISA, 
+        /**
+         * Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, excluding the provided concept itself (i.e. include child codes)
+         */
+        DESCENDENTOF, 
+        /**
+         * The specified property of the code does not have an is-a relationship with the provided value.
+         */
+        ISNOTA, 
+        /**
+         * The specified property of the code  matches the regex specified in the provided value.
+         */
+        REGEX, 
+        /**
+         * The specified property of the code is in the set of codes or concepts specified in the provided value (comma separated list).
+         */
+        IN, 
+        /**
+         * The specified property of the code is not in the set of codes or concepts specified in the provided value (comma separated list).
+         */
+        NOTIN, 
+        /**
+         * Includes all concept ids that have a transitive is-a relationship from the concept Id provided as the value, including the provided concept itself (e.g. include parent codes)
+         */
+        GENERALIZES, 
+        /**
+         * The specified property of the code has at least one value (if the specified value is true; if the specified value is false, then matches when the specified property of the code has no values)
+         */
+        EXISTS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static FilterOperator fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("=".equals(codeString))
+          return EQUAL;
+        if ("is-a".equals(codeString))
+          return ISA;
+        if ("descendent-of".equals(codeString))
+          return DESCENDENTOF;
+        if ("is-not-a".equals(codeString))
+          return ISNOTA;
+        if ("regex".equals(codeString))
+          return REGEX;
+        if ("in".equals(codeString))
+          return IN;
+        if ("not-in".equals(codeString))
+          return NOTIN;
+        if ("generalizes".equals(codeString))
+          return GENERALIZES;
+        if ("exists".equals(codeString))
+          return EXISTS;
+        throw new FHIRException("Unknown FilterOperator code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case EQUAL: return "=";
+            case ISA: return "is-a";
+            case DESCENDENTOF: return "descendent-of";
+            case ISNOTA: return "is-not-a";
+            case REGEX: return "regex";
+            case IN: return "in";
+            case NOTIN: return "not-in";
+            case GENERALIZES: return "generalizes";
+            case EXISTS: return "exists";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/filter-operator";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case EQUAL: return "The specified property of the code equals the provided value.";
+            case ISA: return "Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, including the provided concept itself (i.e. include child codes)";
+            case DESCENDENTOF: return "Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, excluding the provided concept itself (i.e. include child codes)";
+            case ISNOTA: return "The specified property of the code does not have an is-a relationship with the provided value.";
+            case REGEX: return "The specified property of the code  matches the regex specified in the provided value.";
+            case IN: return "The specified property of the code is in the set of codes or concepts specified in the provided value (comma separated list).";
+            case NOTIN: return "The specified property of the code is not in the set of codes or concepts specified in the provided value (comma separated list).";
+            case GENERALIZES: return "Includes all concept ids that have a transitive is-a relationship from the concept Id provided as the value, including the provided concept itself (e.g. include parent codes)";
+            case EXISTS: return "The specified property of the code has at least one value (if the specified value is true; if the specified value is false, then matches when the specified property of the code has no values)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case EQUAL: return "Equals";
+            case ISA: return "Is A (by subsumption)";
+            case DESCENDENTOF: return "Descendent Of (by subsumption)";
+            case ISNOTA: return "Not (Is A) (by subsumption)";
+            case REGEX: return "Regular Expression";
+            case IN: return "In Set";
+            case NOTIN: return "Not in Set";
+            case GENERALIZES: return "Generalizes (by Subsumption)";
+            case EXISTS: return "Exists";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FilterOperatorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FilterOperatorEnumFactory.java
new file mode 100644
index 00000000000..a23af6fb032
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FilterOperatorEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class FilterOperatorEnumFactory implements EnumFactory {
+
+  public FilterOperator fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("=".equals(codeString))
+      return FilterOperator.EQUAL;
+    if ("is-a".equals(codeString))
+      return FilterOperator.ISA;
+    if ("descendent-of".equals(codeString))
+      return FilterOperator.DESCENDENTOF;
+    if ("is-not-a".equals(codeString))
+      return FilterOperator.ISNOTA;
+    if ("regex".equals(codeString))
+      return FilterOperator.REGEX;
+    if ("in".equals(codeString))
+      return FilterOperator.IN;
+    if ("not-in".equals(codeString))
+      return FilterOperator.NOTIN;
+    if ("generalizes".equals(codeString))
+      return FilterOperator.GENERALIZES;
+    if ("exists".equals(codeString))
+      return FilterOperator.EXISTS;
+    throw new IllegalArgumentException("Unknown FilterOperator code '"+codeString+"'");
+  }
+
+  public String toCode(FilterOperator code) {
+    if (code == FilterOperator.EQUAL)
+      return "=";
+    if (code == FilterOperator.ISA)
+      return "is-a";
+    if (code == FilterOperator.DESCENDENTOF)
+      return "descendent-of";
+    if (code == FilterOperator.ISNOTA)
+      return "is-not-a";
+    if (code == FilterOperator.REGEX)
+      return "regex";
+    if (code == FilterOperator.IN)
+      return "in";
+    if (code == FilterOperator.NOTIN)
+      return "not-in";
+    if (code == FilterOperator.GENERALIZES)
+      return "generalizes";
+    if (code == FilterOperator.EXISTS)
+      return "exists";
+    return "?";
+  }
+
+    public String toSystem(FilterOperator code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagCategory.java
new file mode 100644
index 00000000000..8334995f6a8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagCategory.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum FlagCategory {
+
+        /**
+         * Flags related to the subject's dietary needs.
+         */
+        DIET, 
+        /**
+         * Flags related to the patient's medications.
+         */
+        DRUG, 
+        /**
+         * Flags related to performing laboratory tests and related processes (e.g. phlebotomy).
+         */
+        LAB, 
+        /**
+         * Flags related to administrative and financial processes.
+         */
+        ADMIN, 
+        /**
+         * Flags related to coming into contact with the patient.
+         */
+        CONTACT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static FlagCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("diet".equals(codeString))
+          return DIET;
+        if ("drug".equals(codeString))
+          return DRUG;
+        if ("lab".equals(codeString))
+          return LAB;
+        if ("admin".equals(codeString))
+          return ADMIN;
+        if ("contact".equals(codeString))
+          return CONTACT;
+        throw new FHIRException("Unknown FlagCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DIET: return "diet";
+            case DRUG: return "drug";
+            case LAB: return "lab";
+            case ADMIN: return "admin";
+            case CONTACT: return "contact";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/flag-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DIET: return "Flags related to the subject's dietary needs.";
+            case DRUG: return "Flags related to the patient's medications.";
+            case LAB: return "Flags related to performing laboratory tests and related processes (e.g. phlebotomy).";
+            case ADMIN: return "Flags related to administrative and financial processes.";
+            case CONTACT: return "Flags related to coming into contact with the patient.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DIET: return "Diet";
+            case DRUG: return "Drug";
+            case LAB: return "Lab";
+            case ADMIN: return "Administrative";
+            case CONTACT: return "Subject contact";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagCategoryEnumFactory.java
new file mode 100644
index 00000000000..6b83d48a679
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagCategoryEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class FlagCategoryEnumFactory implements EnumFactory {
+
+  public FlagCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("diet".equals(codeString))
+      return FlagCategory.DIET;
+    if ("drug".equals(codeString))
+      return FlagCategory.DRUG;
+    if ("lab".equals(codeString))
+      return FlagCategory.LAB;
+    if ("admin".equals(codeString))
+      return FlagCategory.ADMIN;
+    if ("contact".equals(codeString))
+      return FlagCategory.CONTACT;
+    throw new IllegalArgumentException("Unknown FlagCategory code '"+codeString+"'");
+  }
+
+  public String toCode(FlagCategory code) {
+    if (code == FlagCategory.DIET)
+      return "diet";
+    if (code == FlagCategory.DRUG)
+      return "drug";
+    if (code == FlagCategory.LAB)
+      return "lab";
+    if (code == FlagCategory.ADMIN)
+      return "admin";
+    if (code == FlagCategory.CONTACT)
+      return "contact";
+    return "?";
+  }
+
+    public String toSystem(FlagCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagPriority.java
new file mode 100644
index 00000000000..f41caa6df9e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagPriority.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum FlagPriority {
+
+        /**
+         * No alarm.
+         */
+        PN, 
+        /**
+         * Low priority.
+         */
+        PL, 
+        /**
+         * Medium priority.
+         */
+        PM, 
+        /**
+         * High priority.
+         */
+        PH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static FlagPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("PN".equals(codeString))
+          return PN;
+        if ("PL".equals(codeString))
+          return PL;
+        if ("PM".equals(codeString))
+          return PM;
+        if ("PH".equals(codeString))
+          return PH;
+        throw new FHIRException("Unknown FlagPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PN: return "PN";
+            case PL: return "PL";
+            case PM: return "PM";
+            case PH: return "PH";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/flag-priority-code";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PN: return "No alarm.";
+            case PL: return "Low priority.";
+            case PM: return "Medium priority.";
+            case PH: return "High priority.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PN: return "No alarm";
+            case PL: return "Low priority";
+            case PM: return "Medium priority";
+            case PH: return "High priority";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagPriorityEnumFactory.java
new file mode 100644
index 00000000000..18bf4fd68cf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagPriorityEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class FlagPriorityEnumFactory implements EnumFactory {
+
+  public FlagPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("PN".equals(codeString))
+      return FlagPriority.PN;
+    if ("PL".equals(codeString))
+      return FlagPriority.PL;
+    if ("PM".equals(codeString))
+      return FlagPriority.PM;
+    if ("PH".equals(codeString))
+      return FlagPriority.PH;
+    throw new IllegalArgumentException("Unknown FlagPriority code '"+codeString+"'");
+  }
+
+  public String toCode(FlagPriority code) {
+    if (code == FlagPriority.PN)
+      return "PN";
+    if (code == FlagPriority.PL)
+      return "PL";
+    if (code == FlagPriority.PM)
+      return "PM";
+    if (code == FlagPriority.PH)
+      return "PH";
+    return "?";
+  }
+
+    public String toSystem(FlagPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagStatus.java
new file mode 100644
index 00000000000..16928f60eab
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum FlagStatus {
+
+        /**
+         * A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.
+         */
+        ACTIVE, 
+        /**
+         * The flag does not need to be displayed any more.
+         */
+        INACTIVE, 
+        /**
+         * The flag was added in error, and should no longer be displayed.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static FlagStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case INACTIVE: return "inactive";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/flag-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.";
+            case INACTIVE: return "The flag does not need to be displayed any more.";
+            case ENTEREDINERROR: return "The flag was added in error, and should no longer be displayed.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case INACTIVE: return "Inactive";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagStatusEnumFactory.java
new file mode 100644
index 00000000000..f14d312a253
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FlagStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class FlagStatusEnumFactory implements EnumFactory {
+
+  public FlagStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return FlagStatus.ACTIVE;
+    if ("inactive".equals(codeString))
+      return FlagStatus.INACTIVE;
+    if ("entered-in-error".equals(codeString))
+      return FlagStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown FlagStatus code '"+codeString+"'");
+  }
+
+  public String toCode(FlagStatus code) {
+    if (code == FlagStatus.ACTIVE)
+      return "active";
+    if (code == FlagStatus.INACTIVE)
+      return "inactive";
+    if (code == FlagStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(FlagStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmConditions.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmConditions.java
new file mode 100644
index 00000000000..9d2f88fa613
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmConditions.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum FmConditions {
+
+        /**
+         * Headache
+         */
+        _123987, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static FmConditions fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("123987".equals(codeString))
+          return _123987;
+        throw new FHIRException("Unknown FmConditions code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _123987: return "123987";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/fm-conditions";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _123987: return "Headache";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _123987: return "Headache";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmConditionsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmConditionsEnumFactory.java
new file mode 100644
index 00000000000..642338ffb22
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmConditionsEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class FmConditionsEnumFactory implements EnumFactory {
+
+  public FmConditions fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("123987".equals(codeString))
+      return FmConditions._123987;
+    throw new IllegalArgumentException("Unknown FmConditions code '"+codeString+"'");
+  }
+
+  public String toCode(FmConditions code) {
+    if (code == FmConditions._123987)
+      return "123987";
+    return "?";
+  }
+
+    public String toSystem(FmConditions code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmItemtype.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmItemtype.java
new file mode 100644
index 00000000000..30f351ba458
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmItemtype.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum FmItemtype {
+
+        /**
+         * A group of products and/or Services, amount ar the summary or detail level products and services.
+         */
+        GROUP, 
+        /**
+         * A billed product line item.
+         */
+        PRODUCT, 
+        /**
+         * A billed service line item.
+         */
+        SERVICE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static FmItemtype fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("group".equals(codeString))
+          return GROUP;
+        if ("product".equals(codeString))
+          return PRODUCT;
+        if ("service".equals(codeString))
+          return SERVICE;
+        throw new FHIRException("Unknown FmItemtype code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GROUP: return "group";
+            case PRODUCT: return "product";
+            case SERVICE: return "service";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-claimitemtype";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GROUP: return "A group of products and/or Services, amount ar the summary or detail level products and services.";
+            case PRODUCT: return "A billed product line item.";
+            case SERVICE: return "A billed service line item.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GROUP: return "Group";
+            case PRODUCT: return "Product";
+            case SERVICE: return "Service";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmItemtypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmItemtypeEnumFactory.java
new file mode 100644
index 00000000000..8ded79646f3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmItemtypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class FmItemtypeEnumFactory implements EnumFactory {
+
+  public FmItemtype fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("group".equals(codeString))
+      return FmItemtype.GROUP;
+    if ("product".equals(codeString))
+      return FmItemtype.PRODUCT;
+    if ("service".equals(codeString))
+      return FmItemtype.SERVICE;
+    throw new IllegalArgumentException("Unknown FmItemtype code '"+codeString+"'");
+  }
+
+  public String toCode(FmItemtype code) {
+    if (code == FmItemtype.GROUP)
+      return "group";
+    if (code == FmItemtype.PRODUCT)
+      return "product";
+    if (code == FmItemtype.SERVICE)
+      return "service";
+    return "?";
+  }
+
+    public String toSystem(FmItemtype code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmStatus.java
new file mode 100644
index 00000000000..0a9039020a0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum FmStatus {
+
+        /**
+         * The instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static FmStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown FmStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/fm-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The instance is currently in-force.";
+            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmStatusEnumFactory.java
new file mode 100644
index 00000000000..153e80b4235
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FmStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class FmStatusEnumFactory implements EnumFactory {
+
+  public FmStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return FmStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return FmStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return FmStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return FmStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown FmStatus code '"+codeString+"'");
+  }
+
+  public String toCode(FmStatus code) {
+    if (code == FmStatus.ACTIVE)
+      return "active";
+    if (code == FmStatus.CANCELLED)
+      return "cancelled";
+    if (code == FmStatus.DRAFT)
+      return "draft";
+    if (code == FmStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(FmStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Forms.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Forms.java
new file mode 100644
index 00000000000..5853350762a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Forms.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Forms {
+
+        /**
+         * Example: The #1 form to be used when printing this information.
+         */
+        _1, 
+        /**
+         * Example: The #2 form to be used when printing this information.
+         */
+        _2, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Forms fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        throw new FHIRException("Unknown Forms code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/forms-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "Example: The #1 form to be used when printing this information.";
+            case _2: return "Example: The #2 form to be used when printing this information.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Form #1";
+            case _2: return "Form #1";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FormsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FormsEnumFactory.java
new file mode 100644
index 00000000000..5d885bbd7ad
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FormsEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class FormsEnumFactory implements EnumFactory {
+
+  public Forms fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return Forms._1;
+    if ("2".equals(codeString))
+      return Forms._2;
+    throw new IllegalArgumentException("Unknown Forms code '"+codeString+"'");
+  }
+
+  public String toCode(Forms code) {
+    if (code == Forms._1)
+      return "1";
+    if (code == Forms._2)
+      return "2";
+    return "?";
+  }
+
+    public String toSystem(Forms code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Fundsreserve.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Fundsreserve.java
new file mode 100644
index 00000000000..d3c8ea28c73
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Fundsreserve.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Fundsreserve {
+
+        /**
+         * The payor is requested to reserve funds for the provision of the named services by any provider for settlement of future claims related to this request.
+         */
+        PATIENT, 
+        /**
+         * The payor is requested to reserve funds solely for the named provider for settlement of future claims related to this request.
+         */
+        PROVIDER, 
+        /**
+         * The payor is not being requested to reserve any funds for the settlement of future claims.
+         */
+        NONE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Fundsreserve fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("patient".equals(codeString))
+          return PATIENT;
+        if ("provider".equals(codeString))
+          return PROVIDER;
+        if ("none".equals(codeString))
+          return NONE;
+        throw new FHIRException("Unknown Fundsreserve code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PATIENT: return "patient";
+            case PROVIDER: return "provider";
+            case NONE: return "none";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/fundsreserve";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PATIENT: return "The payor is requested to reserve funds for the provision of the named services by any provider for settlement of future claims related to this request.";
+            case PROVIDER: return "The payor is requested to reserve funds solely for the named provider for settlement of future claims related to this request.";
+            case NONE: return "The payor is not being requested to reserve any funds for the settlement of future claims.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PATIENT: return "Patient";
+            case PROVIDER: return "Provider";
+            case NONE: return "None";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FundsreserveEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FundsreserveEnumFactory.java
new file mode 100644
index 00000000000..b917a1b2ab1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/FundsreserveEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class FundsreserveEnumFactory implements EnumFactory {
+
+  public Fundsreserve fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("patient".equals(codeString))
+      return Fundsreserve.PATIENT;
+    if ("provider".equals(codeString))
+      return Fundsreserve.PROVIDER;
+    if ("none".equals(codeString))
+      return Fundsreserve.NONE;
+    throw new IllegalArgumentException("Unknown Fundsreserve code '"+codeString+"'");
+  }
+
+  public String toCode(Fundsreserve code) {
+    if (code == Fundsreserve.PATIENT)
+      return "patient";
+    if (code == Fundsreserve.PROVIDER)
+      return "provider";
+    if (code == Fundsreserve.NONE)
+      return "none";
+    return "?";
+  }
+
+    public String toSystem(Fundsreserve code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalAcceptanceStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalAcceptanceStatus.java
new file mode 100644
index 00000000000..aada8c3b44c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalAcceptanceStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GoalAcceptanceStatus {
+
+        /**
+         * Stakeholder supports pursuit of the goal
+         */
+        AGREE, 
+        /**
+         * Stakeholder is not in support of the pursuit of the goal
+         */
+        DISAGREE, 
+        /**
+         * Stakeholder has not yet made a decision on whether they support the goal
+         */
+        PENDING, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GoalAcceptanceStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("agree".equals(codeString))
+          return AGREE;
+        if ("disagree".equals(codeString))
+          return DISAGREE;
+        if ("pending".equals(codeString))
+          return PENDING;
+        throw new FHIRException("Unknown GoalAcceptanceStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AGREE: return "agree";
+            case DISAGREE: return "disagree";
+            case PENDING: return "pending";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/goal-acceptance-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AGREE: return "Stakeholder supports pursuit of the goal";
+            case DISAGREE: return "Stakeholder is not in support of the pursuit of the goal";
+            case PENDING: return "Stakeholder has not yet made a decision on whether they support the goal";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AGREE: return "Agree";
+            case DISAGREE: return "Disagree";
+            case PENDING: return "Pending";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalAcceptanceStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalAcceptanceStatusEnumFactory.java
new file mode 100644
index 00000000000..af8b3fd1299
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalAcceptanceStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GoalAcceptanceStatusEnumFactory implements EnumFactory {
+
+  public GoalAcceptanceStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("agree".equals(codeString))
+      return GoalAcceptanceStatus.AGREE;
+    if ("disagree".equals(codeString))
+      return GoalAcceptanceStatus.DISAGREE;
+    if ("pending".equals(codeString))
+      return GoalAcceptanceStatus.PENDING;
+    throw new IllegalArgumentException("Unknown GoalAcceptanceStatus code '"+codeString+"'");
+  }
+
+  public String toCode(GoalAcceptanceStatus code) {
+    if (code == GoalAcceptanceStatus.AGREE)
+      return "agree";
+    if (code == GoalAcceptanceStatus.DISAGREE)
+      return "disagree";
+    if (code == GoalAcceptanceStatus.PENDING)
+      return "pending";
+    return "?";
+  }
+
+    public String toSystem(GoalAcceptanceStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalCategory.java
new file mode 100644
index 00000000000..b83c1afe9df
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalCategory.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GoalCategory {
+
+        /**
+         * Goals related to the consumption of food and/or beverages.
+         */
+        DIETARY, 
+        /**
+         * Goals related to the personal protection of the subject.
+         */
+        SAFETY, 
+        /**
+         * Goals related to the manner in which the subject acts.
+         */
+        BEHAVIORAL, 
+        /**
+         * Goals related to the practice of nursing or established by nurses.
+         */
+        NURSING, 
+        /**
+         * Goals related to the mobility and motor capability of the subject.
+         */
+        PHYSIOTHERAPY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GoalCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("dietary".equals(codeString))
+          return DIETARY;
+        if ("safety".equals(codeString))
+          return SAFETY;
+        if ("behavioral".equals(codeString))
+          return BEHAVIORAL;
+        if ("nursing".equals(codeString))
+          return NURSING;
+        if ("physiotherapy".equals(codeString))
+          return PHYSIOTHERAPY;
+        throw new FHIRException("Unknown GoalCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DIETARY: return "dietary";
+            case SAFETY: return "safety";
+            case BEHAVIORAL: return "behavioral";
+            case NURSING: return "nursing";
+            case PHYSIOTHERAPY: return "physiotherapy";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/goal-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DIETARY: return "Goals related to the consumption of food and/or beverages.";
+            case SAFETY: return "Goals related to the personal protection of the subject.";
+            case BEHAVIORAL: return "Goals related to the manner in which the subject acts.";
+            case NURSING: return "Goals related to the practice of nursing or established by nurses.";
+            case PHYSIOTHERAPY: return "Goals related to the mobility and motor capability of the subject.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DIETARY: return "Dietary";
+            case SAFETY: return "Safety";
+            case BEHAVIORAL: return "Behavioral";
+            case NURSING: return "Nursing";
+            case PHYSIOTHERAPY: return "Physiotherapy";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalCategoryEnumFactory.java
new file mode 100644
index 00000000000..7256d505c0c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalCategoryEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GoalCategoryEnumFactory implements EnumFactory {
+
+  public GoalCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("dietary".equals(codeString))
+      return GoalCategory.DIETARY;
+    if ("safety".equals(codeString))
+      return GoalCategory.SAFETY;
+    if ("behavioral".equals(codeString))
+      return GoalCategory.BEHAVIORAL;
+    if ("nursing".equals(codeString))
+      return GoalCategory.NURSING;
+    if ("physiotherapy".equals(codeString))
+      return GoalCategory.PHYSIOTHERAPY;
+    throw new IllegalArgumentException("Unknown GoalCategory code '"+codeString+"'");
+  }
+
+  public String toCode(GoalCategory code) {
+    if (code == GoalCategory.DIETARY)
+      return "dietary";
+    if (code == GoalCategory.SAFETY)
+      return "safety";
+    if (code == GoalCategory.BEHAVIORAL)
+      return "behavioral";
+    if (code == GoalCategory.NURSING)
+      return "nursing";
+    if (code == GoalCategory.PHYSIOTHERAPY)
+      return "physiotherapy";
+    return "?";
+  }
+
+    public String toSystem(GoalCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalPriority.java
new file mode 100644
index 00000000000..0423a5cdf9f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalPriority.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GoalPriority {
+
+        /**
+         * Indicates that the goal is of considerable importance and should be a primary focus of care delivery.
+         */
+        HIGHPRIORITY, 
+        /**
+         * Indicates that the goal has a reasonable degree of importance and that concrete action should be taken towards the goal.  Attainment is not as critical as high-priority goals.
+         */
+        MEDIUMPRIORITY, 
+        /**
+         * The goal is desirable but is not sufficiently important to devote significant resources to.  Achievement of the goal may be sought when incidental to achieving other goals.
+         */
+        LOWPRIORITY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GoalPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("high-priority".equals(codeString))
+          return HIGHPRIORITY;
+        if ("medium-priority".equals(codeString))
+          return MEDIUMPRIORITY;
+        if ("low-priority".equals(codeString))
+          return LOWPRIORITY;
+        throw new FHIRException("Unknown GoalPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HIGHPRIORITY: return "high-priority";
+            case MEDIUMPRIORITY: return "medium-priority";
+            case LOWPRIORITY: return "low-priority";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/goal-priority";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HIGHPRIORITY: return "Indicates that the goal is of considerable importance and should be a primary focus of care delivery.";
+            case MEDIUMPRIORITY: return "Indicates that the goal has a reasonable degree of importance and that concrete action should be taken towards the goal.  Attainment is not as critical as high-priority goals.";
+            case LOWPRIORITY: return "The goal is desirable but is not sufficiently important to devote significant resources to.  Achievement of the goal may be sought when incidental to achieving other goals.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HIGHPRIORITY: return "High Priority";
+            case MEDIUMPRIORITY: return "Medium Priority";
+            case LOWPRIORITY: return "Low Priority";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalPriorityEnumFactory.java
new file mode 100644
index 00000000000..5ed23f80e43
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalPriorityEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GoalPriorityEnumFactory implements EnumFactory {
+
+  public GoalPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("high-priority".equals(codeString))
+      return GoalPriority.HIGHPRIORITY;
+    if ("medium-priority".equals(codeString))
+      return GoalPriority.MEDIUMPRIORITY;
+    if ("low-priority".equals(codeString))
+      return GoalPriority.LOWPRIORITY;
+    throw new IllegalArgumentException("Unknown GoalPriority code '"+codeString+"'");
+  }
+
+  public String toCode(GoalPriority code) {
+    if (code == GoalPriority.HIGHPRIORITY)
+      return "high-priority";
+    if (code == GoalPriority.MEDIUMPRIORITY)
+      return "medium-priority";
+    if (code == GoalPriority.LOWPRIORITY)
+      return "low-priority";
+    return "?";
+  }
+
+    public String toSystem(GoalPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalRelationshipType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalRelationshipType.java
new file mode 100644
index 00000000000..c5aa61eeee7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalRelationshipType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GoalRelationshipType {
+
+        /**
+         * Indicates that the target goal is one which must be met before striving for the current goal
+         */
+        PREDECESSOR, 
+        /**
+         * Indicates that the target goal is a desired objective once the current goal is met
+         */
+        SUCCESSOR, 
+        /**
+         * Indicates that this goal has been replaced by the target goal
+         */
+        REPLACEMENT, 
+        /**
+         * Indicates that the target goal is considered to be a "piece" of attaining this goal.
+         */
+        MILESTONE, 
+        /**
+         * Indicates that the relationship is not covered by one of the pre-defined codes.  (An extension may convey more information about the meaning of the relationship.)
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GoalRelationshipType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("predecessor".equals(codeString))
+          return PREDECESSOR;
+        if ("successor".equals(codeString))
+          return SUCCESSOR;
+        if ("replacement".equals(codeString))
+          return REPLACEMENT;
+        if ("milestone".equals(codeString))
+          return MILESTONE;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown GoalRelationshipType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PREDECESSOR: return "predecessor";
+            case SUCCESSOR: return "successor";
+            case REPLACEMENT: return "replacement";
+            case MILESTONE: return "milestone";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/goal-relationship-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PREDECESSOR: return "Indicates that the target goal is one which must be met before striving for the current goal";
+            case SUCCESSOR: return "Indicates that the target goal is a desired objective once the current goal is met";
+            case REPLACEMENT: return "Indicates that this goal has been replaced by the target goal";
+            case MILESTONE: return "Indicates that the target goal is considered to be a \"piece\" of attaining this goal.";
+            case OTHER: return "Indicates that the relationship is not covered by one of the pre-defined codes.  (An extension may convey more information about the meaning of the relationship.)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PREDECESSOR: return "Predecessor";
+            case SUCCESSOR: return "Successor";
+            case REPLACEMENT: return "Replacement";
+            case MILESTONE: return "Milestone";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalRelationshipTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalRelationshipTypeEnumFactory.java
new file mode 100644
index 00000000000..d8801040181
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalRelationshipTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GoalRelationshipTypeEnumFactory implements EnumFactory {
+
+  public GoalRelationshipType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("predecessor".equals(codeString))
+      return GoalRelationshipType.PREDECESSOR;
+    if ("successor".equals(codeString))
+      return GoalRelationshipType.SUCCESSOR;
+    if ("replacement".equals(codeString))
+      return GoalRelationshipType.REPLACEMENT;
+    if ("milestone".equals(codeString))
+      return GoalRelationshipType.MILESTONE;
+    if ("other".equals(codeString))
+      return GoalRelationshipType.OTHER;
+    throw new IllegalArgumentException("Unknown GoalRelationshipType code '"+codeString+"'");
+  }
+
+  public String toCode(GoalRelationshipType code) {
+    if (code == GoalRelationshipType.PREDECESSOR)
+      return "predecessor";
+    if (code == GoalRelationshipType.SUCCESSOR)
+      return "successor";
+    if (code == GoalRelationshipType.REPLACEMENT)
+      return "replacement";
+    if (code == GoalRelationshipType.MILESTONE)
+      return "milestone";
+    if (code == GoalRelationshipType.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(GoalRelationshipType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatus.java
new file mode 100644
index 00000000000..d14312e3e5e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatus.java
@@ -0,0 +1,186 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GoalStatus {
+
+        /**
+         * A goal is proposed for this patient
+         */
+        PROPOSED, 
+        /**
+         * A proposed goal was accepted or acknowledged
+         */
+        ACCEPTED, 
+        /**
+         * A goal is planned for this patient
+         */
+        PLANNED, 
+        /**
+         * The goal is being sought but has not yet been reached.  (Also applies if goal was reached in the past but there has been regression and goal is being sought again)
+         */
+        INPROGRESS, 
+        /**
+         * The goal is on schedule for the planned timelines
+         */
+        ONTARGET, 
+        /**
+         * The goal is ahead of the planned timelines
+         */
+        AHEADOFTARGET, 
+        /**
+         * The goal is behind the planned timelines
+         */
+        BEHINDTARGET, 
+        /**
+         * The goal has been met, but ongoing activity is needed to sustain the goal objective
+         */
+        SUSTAINING, 
+        /**
+         * The goal has been met and no further action is needed
+         */
+        ACHIEVED, 
+        /**
+         * The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.
+         */
+        ONHOLD, 
+        /**
+         * The previously accepted goal is no longer being sought
+         */
+        CANCELLED, 
+        /**
+         * The goal was entered in error and voided.
+         */
+        ENTEREDINERROR, 
+        /**
+         * A proposed goal was rejected
+         */
+        REJECTED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GoalStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposed".equals(codeString))
+          return PROPOSED;
+        if ("accepted".equals(codeString))
+          return ACCEPTED;
+        if ("planned".equals(codeString))
+          return PLANNED;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("on-target".equals(codeString))
+          return ONTARGET;
+        if ("ahead-of-target".equals(codeString))
+          return AHEADOFTARGET;
+        if ("behind-target".equals(codeString))
+          return BEHINDTARGET;
+        if ("sustaining".equals(codeString))
+          return SUSTAINING;
+        if ("achieved".equals(codeString))
+          return ACHIEVED;
+        if ("on-hold".equals(codeString))
+          return ONHOLD;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("rejected".equals(codeString))
+          return REJECTED;
+        throw new FHIRException("Unknown GoalStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSED: return "proposed";
+            case ACCEPTED: return "accepted";
+            case PLANNED: return "planned";
+            case INPROGRESS: return "in-progress";
+            case ONTARGET: return "on-target";
+            case AHEADOFTARGET: return "ahead-of-target";
+            case BEHINDTARGET: return "behind-target";
+            case SUSTAINING: return "sustaining";
+            case ACHIEVED: return "achieved";
+            case ONHOLD: return "on-hold";
+            case CANCELLED: return "cancelled";
+            case ENTEREDINERROR: return "entered-in-error";
+            case REJECTED: return "rejected";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/goal-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSED: return "A goal is proposed for this patient";
+            case ACCEPTED: return "A proposed goal was accepted or acknowledged";
+            case PLANNED: return "A goal is planned for this patient";
+            case INPROGRESS: return "The goal is being sought but has not yet been reached.  (Also applies if goal was reached in the past but there has been regression and goal is being sought again)";
+            case ONTARGET: return "The goal is on schedule for the planned timelines";
+            case AHEADOFTARGET: return "The goal is ahead of the planned timelines";
+            case BEHINDTARGET: return "The goal is behind the planned timelines";
+            case SUSTAINING: return "The goal has been met, but ongoing activity is needed to sustain the goal objective";
+            case ACHIEVED: return "The goal has been met and no further action is needed";
+            case ONHOLD: return "The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.";
+            case CANCELLED: return "The previously accepted goal is no longer being sought";
+            case ENTEREDINERROR: return "The goal was entered in error and voided.";
+            case REJECTED: return "A proposed goal was rejected";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSED: return "Proposed";
+            case ACCEPTED: return "Accepted";
+            case PLANNED: return "Planned";
+            case INPROGRESS: return "In Progress";
+            case ONTARGET: return "On Target";
+            case AHEADOFTARGET: return "Ahead of Target";
+            case BEHINDTARGET: return "Behind Target";
+            case SUSTAINING: return "Sustaining";
+            case ACHIEVED: return "Achieved";
+            case ONHOLD: return "On Hold";
+            case CANCELLED: return "Cancelled";
+            case ENTEREDINERROR: return "Entered In Error";
+            case REJECTED: return "Rejected";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatusEnumFactory.java
new file mode 100644
index 00000000000..80c4dfa8a6d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatusEnumFactory.java
@@ -0,0 +1,106 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GoalStatusEnumFactory implements EnumFactory {
+
+  public GoalStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposed".equals(codeString))
+      return GoalStatus.PROPOSED;
+    if ("accepted".equals(codeString))
+      return GoalStatus.ACCEPTED;
+    if ("planned".equals(codeString))
+      return GoalStatus.PLANNED;
+    if ("in-progress".equals(codeString))
+      return GoalStatus.INPROGRESS;
+    if ("on-target".equals(codeString))
+      return GoalStatus.ONTARGET;
+    if ("ahead-of-target".equals(codeString))
+      return GoalStatus.AHEADOFTARGET;
+    if ("behind-target".equals(codeString))
+      return GoalStatus.BEHINDTARGET;
+    if ("sustaining".equals(codeString))
+      return GoalStatus.SUSTAINING;
+    if ("achieved".equals(codeString))
+      return GoalStatus.ACHIEVED;
+    if ("on-hold".equals(codeString))
+      return GoalStatus.ONHOLD;
+    if ("cancelled".equals(codeString))
+      return GoalStatus.CANCELLED;
+    if ("entered-in-error".equals(codeString))
+      return GoalStatus.ENTEREDINERROR;
+    if ("rejected".equals(codeString))
+      return GoalStatus.REJECTED;
+    throw new IllegalArgumentException("Unknown GoalStatus code '"+codeString+"'");
+  }
+
+  public String toCode(GoalStatus code) {
+    if (code == GoalStatus.PROPOSED)
+      return "proposed";
+    if (code == GoalStatus.ACCEPTED)
+      return "accepted";
+    if (code == GoalStatus.PLANNED)
+      return "planned";
+    if (code == GoalStatus.INPROGRESS)
+      return "in-progress";
+    if (code == GoalStatus.ONTARGET)
+      return "on-target";
+    if (code == GoalStatus.AHEADOFTARGET)
+      return "ahead-of-target";
+    if (code == GoalStatus.BEHINDTARGET)
+      return "behind-target";
+    if (code == GoalStatus.SUSTAINING)
+      return "sustaining";
+    if (code == GoalStatus.ACHIEVED)
+      return "achieved";
+    if (code == GoalStatus.ONHOLD)
+      return "on-hold";
+    if (code == GoalStatus.CANCELLED)
+      return "cancelled";
+    if (code == GoalStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == GoalStatus.REJECTED)
+      return "rejected";
+    return "?";
+  }
+
+    public String toSystem(GoalStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatusReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatusReason.java
new file mode 100644
index 00000000000..5f8932f963e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatusReason.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GoalStatusReason {
+
+        /**
+         * Goal suspended or ended because of a surgical procedure.
+         */
+        SURGERY, 
+        /**
+         * Goal suspended or ended because of a significant life event (marital change, bereavement, etc.).
+         */
+        LIFEEVENT, 
+        /**
+         * Goal has been superseded by a new goal.
+         */
+        REPLACED, 
+        /**
+         * Patient wishes the goal to be set aside, at least temporarily.
+         */
+        PATIENTREQUEST, 
+        /**
+         * Goal can not be reached temporarily.
+         */
+        TEMPNOTATTAINABLE, 
+        /**
+         * Goal can not be reached permanently.
+         */
+        PERMANENTNOTATTAINABLE, 
+        /**
+         * Goal can not be reached due to financial barrier or reason.
+         */
+        FINANCIALBARRIER, 
+        /**
+         * Goal can not be reached due to a lack of transportation.
+         */
+        LACKOFTRANSPORTATION, 
+        /**
+         * Goal can not be reached due to a lack of social support.
+         */
+        LACKOFSOCIALSUPPORT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GoalStatusReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("surgery".equals(codeString))
+          return SURGERY;
+        if ("life-event".equals(codeString))
+          return LIFEEVENT;
+        if ("replaced".equals(codeString))
+          return REPLACED;
+        if ("patient-request".equals(codeString))
+          return PATIENTREQUEST;
+        if ("temp-not-attainable".equals(codeString))
+          return TEMPNOTATTAINABLE;
+        if ("permanent-not-attainable".equals(codeString))
+          return PERMANENTNOTATTAINABLE;
+        if ("financial-barrier".equals(codeString))
+          return FINANCIALBARRIER;
+        if ("lack-of-transportation".equals(codeString))
+          return LACKOFTRANSPORTATION;
+        if ("lack-of-social-support".equals(codeString))
+          return LACKOFSOCIALSUPPORT;
+        throw new FHIRException("Unknown GoalStatusReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SURGERY: return "surgery";
+            case LIFEEVENT: return "life-event";
+            case REPLACED: return "replaced";
+            case PATIENTREQUEST: return "patient-request";
+            case TEMPNOTATTAINABLE: return "temp-not-attainable";
+            case PERMANENTNOTATTAINABLE: return "permanent-not-attainable";
+            case FINANCIALBARRIER: return "financial-barrier";
+            case LACKOFTRANSPORTATION: return "lack-of-transportation";
+            case LACKOFSOCIALSUPPORT: return "lack-of-social-support";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/goal-status-reason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SURGERY: return "Goal suspended or ended because of a surgical procedure.";
+            case LIFEEVENT: return "Goal suspended or ended because of a significant life event (marital change, bereavement, etc.).";
+            case REPLACED: return "Goal has been superseded by a new goal.";
+            case PATIENTREQUEST: return "Patient wishes the goal to be set aside, at least temporarily.";
+            case TEMPNOTATTAINABLE: return "Goal can not be reached temporarily.";
+            case PERMANENTNOTATTAINABLE: return "Goal can not be reached permanently.";
+            case FINANCIALBARRIER: return "Goal can not be reached due to financial barrier or reason.";
+            case LACKOFTRANSPORTATION: return "Goal can not be reached due to a lack of transportation.";
+            case LACKOFSOCIALSUPPORT: return "Goal can not be reached due to a lack of social support.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SURGERY: return "Surgery";
+            case LIFEEVENT: return "Life Event";
+            case REPLACED: return "Replaced";
+            case PATIENTREQUEST: return "Patient Request";
+            case TEMPNOTATTAINABLE: return "Goal Not Attainable Temporarily";
+            case PERMANENTNOTATTAINABLE: return "Goal Not Attainable Permanently";
+            case FINANCIALBARRIER: return "Financial Reason";
+            case LACKOFTRANSPORTATION: return "Lack Of Transportation";
+            case LACKOFSOCIALSUPPORT: return "Lack Of Social Support";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatusReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatusReasonEnumFactory.java
new file mode 100644
index 00000000000..728e786ec15
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GoalStatusReasonEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GoalStatusReasonEnumFactory implements EnumFactory {
+
+  public GoalStatusReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("surgery".equals(codeString))
+      return GoalStatusReason.SURGERY;
+    if ("life-event".equals(codeString))
+      return GoalStatusReason.LIFEEVENT;
+    if ("replaced".equals(codeString))
+      return GoalStatusReason.REPLACED;
+    if ("patient-request".equals(codeString))
+      return GoalStatusReason.PATIENTREQUEST;
+    if ("temp-not-attainable".equals(codeString))
+      return GoalStatusReason.TEMPNOTATTAINABLE;
+    if ("permanent-not-attainable".equals(codeString))
+      return GoalStatusReason.PERMANENTNOTATTAINABLE;
+    if ("financial-barrier".equals(codeString))
+      return GoalStatusReason.FINANCIALBARRIER;
+    if ("lack-of-transportation".equals(codeString))
+      return GoalStatusReason.LACKOFTRANSPORTATION;
+    if ("lack-of-social-support".equals(codeString))
+      return GoalStatusReason.LACKOFSOCIALSUPPORT;
+    throw new IllegalArgumentException("Unknown GoalStatusReason code '"+codeString+"'");
+  }
+
+  public String toCode(GoalStatusReason code) {
+    if (code == GoalStatusReason.SURGERY)
+      return "surgery";
+    if (code == GoalStatusReason.LIFEEVENT)
+      return "life-event";
+    if (code == GoalStatusReason.REPLACED)
+      return "replaced";
+    if (code == GoalStatusReason.PATIENTREQUEST)
+      return "patient-request";
+    if (code == GoalStatusReason.TEMPNOTATTAINABLE)
+      return "temp-not-attainable";
+    if (code == GoalStatusReason.PERMANENTNOTATTAINABLE)
+      return "permanent-not-attainable";
+    if (code == GoalStatusReason.FINANCIALBARRIER)
+      return "financial-barrier";
+    if (code == GoalStatusReason.LACKOFTRANSPORTATION)
+      return "lack-of-transportation";
+    if (code == GoalStatusReason.LACKOFSOCIALSUPPORT)
+      return "lack-of-social-support";
+    return "?";
+  }
+
+    public String toSystem(GoalStatusReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GraphCompartmentRule.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GraphCompartmentRule.java
new file mode 100644
index 00000000000..a3016bb5af8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GraphCompartmentRule.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GraphCompartmentRule {
+
+        /**
+         * The compartment must be identical (the same literal reference)
+         */
+        IDENTICAL, 
+        /**
+         * The compartment must be the same - the record must be about the same patient, but the reference may be different
+         */
+        MATCHING, 
+        /**
+         * The compartment must be different
+         */
+        DIFFERENT, 
+        /**
+         * The compartment rule is defined in the accompanying FHIRPath expression
+         */
+        CUSTOM, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GraphCompartmentRule fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("identical".equals(codeString))
+          return IDENTICAL;
+        if ("matching".equals(codeString))
+          return MATCHING;
+        if ("different".equals(codeString))
+          return DIFFERENT;
+        if ("custom".equals(codeString))
+          return CUSTOM;
+        throw new FHIRException("Unknown GraphCompartmentRule code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case IDENTICAL: return "identical";
+            case MATCHING: return "matching";
+            case DIFFERENT: return "different";
+            case CUSTOM: return "custom";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/graph-compartment-rule";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case IDENTICAL: return "The compartment must be identical (the same literal reference)";
+            case MATCHING: return "The compartment must be the same - the record must be about the same patient, but the reference may be different";
+            case DIFFERENT: return "The compartment must be different";
+            case CUSTOM: return "The compartment rule is defined in the accompanying FHIRPath expression";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case IDENTICAL: return "Identical";
+            case MATCHING: return "Matching";
+            case DIFFERENT: return "Different";
+            case CUSTOM: return "Custom";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GraphCompartmentRuleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GraphCompartmentRuleEnumFactory.java
new file mode 100644
index 00000000000..9c5f47c9c21
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GraphCompartmentRuleEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GraphCompartmentRuleEnumFactory implements EnumFactory {
+
+  public GraphCompartmentRule fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("identical".equals(codeString))
+      return GraphCompartmentRule.IDENTICAL;
+    if ("matching".equals(codeString))
+      return GraphCompartmentRule.MATCHING;
+    if ("different".equals(codeString))
+      return GraphCompartmentRule.DIFFERENT;
+    if ("custom".equals(codeString))
+      return GraphCompartmentRule.CUSTOM;
+    throw new IllegalArgumentException("Unknown GraphCompartmentRule code '"+codeString+"'");
+  }
+
+  public String toCode(GraphCompartmentRule code) {
+    if (code == GraphCompartmentRule.IDENTICAL)
+      return "identical";
+    if (code == GraphCompartmentRule.MATCHING)
+      return "matching";
+    if (code == GraphCompartmentRule.DIFFERENT)
+      return "different";
+    if (code == GraphCompartmentRule.CUSTOM)
+      return "custom";
+    return "?";
+  }
+
+    public String toSystem(GraphCompartmentRule code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GroupType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GroupType.java
new file mode 100644
index 00000000000..571962f6ada
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GroupType.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GroupType {
+
+        /**
+         * Group contains "person" Patient resources
+         */
+        PERSON, 
+        /**
+         * Group contains "animal" Patient resources
+         */
+        ANIMAL, 
+        /**
+         * Group contains healthcare practitioner resources
+         */
+        PRACTITIONER, 
+        /**
+         * Group contains Device resources
+         */
+        DEVICE, 
+        /**
+         * Group contains Medication resources
+         */
+        MEDICATION, 
+        /**
+         * Group contains Substance resources
+         */
+        SUBSTANCE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GroupType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("person".equals(codeString))
+          return PERSON;
+        if ("animal".equals(codeString))
+          return ANIMAL;
+        if ("practitioner".equals(codeString))
+          return PRACTITIONER;
+        if ("device".equals(codeString))
+          return DEVICE;
+        if ("medication".equals(codeString))
+          return MEDICATION;
+        if ("substance".equals(codeString))
+          return SUBSTANCE;
+        throw new FHIRException("Unknown GroupType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PERSON: return "person";
+            case ANIMAL: return "animal";
+            case PRACTITIONER: return "practitioner";
+            case DEVICE: return "device";
+            case MEDICATION: return "medication";
+            case SUBSTANCE: return "substance";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/group-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PERSON: return "Group contains \"person\" Patient resources";
+            case ANIMAL: return "Group contains \"animal\" Patient resources";
+            case PRACTITIONER: return "Group contains healthcare practitioner resources";
+            case DEVICE: return "Group contains Device resources";
+            case MEDICATION: return "Group contains Medication resources";
+            case SUBSTANCE: return "Group contains Substance resources";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PERSON: return "Person";
+            case ANIMAL: return "Animal";
+            case PRACTITIONER: return "Practitioner";
+            case DEVICE: return "Device";
+            case MEDICATION: return "Medication";
+            case SUBSTANCE: return "Substance";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GroupTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GroupTypeEnumFactory.java
new file mode 100644
index 00000000000..bb4398642f9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GroupTypeEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GroupTypeEnumFactory implements EnumFactory {
+
+  public GroupType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("person".equals(codeString))
+      return GroupType.PERSON;
+    if ("animal".equals(codeString))
+      return GroupType.ANIMAL;
+    if ("practitioner".equals(codeString))
+      return GroupType.PRACTITIONER;
+    if ("device".equals(codeString))
+      return GroupType.DEVICE;
+    if ("medication".equals(codeString))
+      return GroupType.MEDICATION;
+    if ("substance".equals(codeString))
+      return GroupType.SUBSTANCE;
+    throw new IllegalArgumentException("Unknown GroupType code '"+codeString+"'");
+  }
+
+  public String toCode(GroupType code) {
+    if (code == GroupType.PERSON)
+      return "person";
+    if (code == GroupType.ANIMAL)
+      return "animal";
+    if (code == GroupType.PRACTITIONER)
+      return "practitioner";
+    if (code == GroupType.DEVICE)
+      return "device";
+    if (code == GroupType.MEDICATION)
+      return "medication";
+    if (code == GroupType.SUBSTANCE)
+      return "substance";
+    return "?";
+  }
+
+    public String toSystem(GroupType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidanceResponseStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidanceResponseStatus.java
new file mode 100644
index 00000000000..fcfd4d98756
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidanceResponseStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GuidanceResponseStatus {
+
+        /**
+         * The request was processed successfully
+         */
+        SUCCESS, 
+        /**
+         * The request was processed successfully, but more data may result in a more complete evaluation
+         */
+        DATAREQUESTED, 
+        /**
+         * The request was processed, but more data is required to complete the evaluation
+         */
+        DATAREQUIRED, 
+        /**
+         * The request is currently being processed
+         */
+        INPROGRESS, 
+        /**
+         * The request was not processed successfully
+         */
+        FAILURE, 
+        /**
+         * The response was entered in error
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GuidanceResponseStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("success".equals(codeString))
+          return SUCCESS;
+        if ("data-requested".equals(codeString))
+          return DATAREQUESTED;
+        if ("data-required".equals(codeString))
+          return DATAREQUIRED;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("failure".equals(codeString))
+          return FAILURE;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown GuidanceResponseStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SUCCESS: return "success";
+            case DATAREQUESTED: return "data-requested";
+            case DATAREQUIRED: return "data-required";
+            case INPROGRESS: return "in-progress";
+            case FAILURE: return "failure";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/guidance-response-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SUCCESS: return "The request was processed successfully";
+            case DATAREQUESTED: return "The request was processed successfully, but more data may result in a more complete evaluation";
+            case DATAREQUIRED: return "The request was processed, but more data is required to complete the evaluation";
+            case INPROGRESS: return "The request is currently being processed";
+            case FAILURE: return "The request was not processed successfully";
+            case ENTEREDINERROR: return "The response was entered in error";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SUCCESS: return "Success";
+            case DATAREQUESTED: return "Data Requested";
+            case DATAREQUIRED: return "Data Required";
+            case INPROGRESS: return "In Progress";
+            case FAILURE: return "Failure";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidanceResponseStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidanceResponseStatusEnumFactory.java
new file mode 100644
index 00000000000..204f06b674a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidanceResponseStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GuidanceResponseStatusEnumFactory implements EnumFactory {
+
+  public GuidanceResponseStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("success".equals(codeString))
+      return GuidanceResponseStatus.SUCCESS;
+    if ("data-requested".equals(codeString))
+      return GuidanceResponseStatus.DATAREQUESTED;
+    if ("data-required".equals(codeString))
+      return GuidanceResponseStatus.DATAREQUIRED;
+    if ("in-progress".equals(codeString))
+      return GuidanceResponseStatus.INPROGRESS;
+    if ("failure".equals(codeString))
+      return GuidanceResponseStatus.FAILURE;
+    if ("entered-in-error".equals(codeString))
+      return GuidanceResponseStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown GuidanceResponseStatus code '"+codeString+"'");
+  }
+
+  public String toCode(GuidanceResponseStatus code) {
+    if (code == GuidanceResponseStatus.SUCCESS)
+      return "success";
+    if (code == GuidanceResponseStatus.DATAREQUESTED)
+      return "data-requested";
+    if (code == GuidanceResponseStatus.DATAREQUIRED)
+      return "data-required";
+    if (code == GuidanceResponseStatus.INPROGRESS)
+      return "in-progress";
+    if (code == GuidanceResponseStatus.FAILURE)
+      return "failure";
+    if (code == GuidanceResponseStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(GuidanceResponseStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuideDependencyType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuideDependencyType.java
new file mode 100644
index 00000000000..cb3183f9b4b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuideDependencyType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GuideDependencyType {
+
+        /**
+         * The guide is referred to by URL.
+         */
+        REFERENCE, 
+        /**
+         * The guide is embedded in this guide when published.
+         */
+        INCLUSION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GuideDependencyType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("reference".equals(codeString))
+          return REFERENCE;
+        if ("inclusion".equals(codeString))
+          return INCLUSION;
+        throw new FHIRException("Unknown GuideDependencyType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REFERENCE: return "reference";
+            case INCLUSION: return "inclusion";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/guide-dependency-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REFERENCE: return "The guide is referred to by URL.";
+            case INCLUSION: return "The guide is embedded in this guide when published.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REFERENCE: return "Reference";
+            case INCLUSION: return "Inclusion";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuideDependencyTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuideDependencyTypeEnumFactory.java
new file mode 100644
index 00000000000..f28a8557f0b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuideDependencyTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GuideDependencyTypeEnumFactory implements EnumFactory {
+
+  public GuideDependencyType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("reference".equals(codeString))
+      return GuideDependencyType.REFERENCE;
+    if ("inclusion".equals(codeString))
+      return GuideDependencyType.INCLUSION;
+    throw new IllegalArgumentException("Unknown GuideDependencyType code '"+codeString+"'");
+  }
+
+  public String toCode(GuideDependencyType code) {
+    if (code == GuideDependencyType.REFERENCE)
+      return "reference";
+    if (code == GuideDependencyType.INCLUSION)
+      return "inclusion";
+    return "?";
+  }
+
+    public String toSystem(GuideDependencyType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidePageKind.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidePageKind.java
new file mode 100644
index 00000000000..a1935c478fa
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidePageKind.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum GuidePageKind {
+
+        /**
+         * This is a page of content that is included in the implementation guide. It has no particular function.
+         */
+        PAGE, 
+        /**
+         * This is a page that represents a human readable rendering of an example.
+         */
+        EXAMPLE, 
+        /**
+         * This is a page that represents a list of resources of one or more types.
+         */
+        LIST, 
+        /**
+         * This is a page showing where an included guide is injected.
+         */
+        INCLUDE, 
+        /**
+         * This is a page that lists the resources of a given type, and also creates pages for all the listed types as other pages in the section.
+         */
+        DIRECTORY, 
+        /**
+         * This is a page that creates the listed resources as a dictionary.
+         */
+        DICTIONARY, 
+        /**
+         * This is a generated page that contains the table of contents.
+         */
+        TOC, 
+        /**
+         * This is a page that represents a presented resource. This is typically used for generated conformance resource presentations.
+         */
+        RESOURCE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static GuidePageKind fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("page".equals(codeString))
+          return PAGE;
+        if ("example".equals(codeString))
+          return EXAMPLE;
+        if ("list".equals(codeString))
+          return LIST;
+        if ("include".equals(codeString))
+          return INCLUDE;
+        if ("directory".equals(codeString))
+          return DIRECTORY;
+        if ("dictionary".equals(codeString))
+          return DICTIONARY;
+        if ("toc".equals(codeString))
+          return TOC;
+        if ("resource".equals(codeString))
+          return RESOURCE;
+        throw new FHIRException("Unknown GuidePageKind code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PAGE: return "page";
+            case EXAMPLE: return "example";
+            case LIST: return "list";
+            case INCLUDE: return "include";
+            case DIRECTORY: return "directory";
+            case DICTIONARY: return "dictionary";
+            case TOC: return "toc";
+            case RESOURCE: return "resource";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/guide-page-kind";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PAGE: return "This is a page of content that is included in the implementation guide. It has no particular function.";
+            case EXAMPLE: return "This is a page that represents a human readable rendering of an example.";
+            case LIST: return "This is a page that represents a list of resources of one or more types.";
+            case INCLUDE: return "This is a page showing where an included guide is injected.";
+            case DIRECTORY: return "This is a page that lists the resources of a given type, and also creates pages for all the listed types as other pages in the section.";
+            case DICTIONARY: return "This is a page that creates the listed resources as a dictionary.";
+            case TOC: return "This is a generated page that contains the table of contents.";
+            case RESOURCE: return "This is a page that represents a presented resource. This is typically used for generated conformance resource presentations.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PAGE: return "Page";
+            case EXAMPLE: return "Example";
+            case LIST: return "List";
+            case INCLUDE: return "Include";
+            case DIRECTORY: return "Directory";
+            case DICTIONARY: return "Dictionary";
+            case TOC: return "Table Of Contents";
+            case RESOURCE: return "Resource";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidePageKindEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidePageKindEnumFactory.java
new file mode 100644
index 00000000000..fd69d91bc40
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/GuidePageKindEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class GuidePageKindEnumFactory implements EnumFactory {
+
+  public GuidePageKind fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("page".equals(codeString))
+      return GuidePageKind.PAGE;
+    if ("example".equals(codeString))
+      return GuidePageKind.EXAMPLE;
+    if ("list".equals(codeString))
+      return GuidePageKind.LIST;
+    if ("include".equals(codeString))
+      return GuidePageKind.INCLUDE;
+    if ("directory".equals(codeString))
+      return GuidePageKind.DIRECTORY;
+    if ("dictionary".equals(codeString))
+      return GuidePageKind.DICTIONARY;
+    if ("toc".equals(codeString))
+      return GuidePageKind.TOC;
+    if ("resource".equals(codeString))
+      return GuidePageKind.RESOURCE;
+    throw new IllegalArgumentException("Unknown GuidePageKind code '"+codeString+"'");
+  }
+
+  public String toCode(GuidePageKind code) {
+    if (code == GuidePageKind.PAGE)
+      return "page";
+    if (code == GuidePageKind.EXAMPLE)
+      return "example";
+    if (code == GuidePageKind.LIST)
+      return "list";
+    if (code == GuidePageKind.INCLUDE)
+      return "include";
+    if (code == GuidePageKind.DIRECTORY)
+      return "directory";
+    if (code == GuidePageKind.DICTIONARY)
+      return "dictionary";
+    if (code == GuidePageKind.TOC)
+      return "toc";
+    if (code == GuidePageKind.RESOURCE)
+      return "resource";
+    return "?";
+  }
+
+    public String toSystem(GuidePageKind code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryNotDoneReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryNotDoneReason.java
new file mode 100644
index 00000000000..f46dff796ad
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryNotDoneReason.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum HistoryNotDoneReason {
+
+        /**
+         * Patient does not know the subject, e.g. the biological parent of an adopted patient.
+         */
+        SUBJECTUNKNOWN, 
+        /**
+         * The patient withheld or refused to share the information.
+         */
+        WITHHELD, 
+        /**
+         * Information cannot be obtained; e.g. unconscious patient
+         */
+        UNABLETOOBTAIN, 
+        /**
+         * Patient does not have the information now, but can provide the information at a later date.
+         */
+        DEFERRED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static HistoryNotDoneReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("subject-unknown".equals(codeString))
+          return SUBJECTUNKNOWN;
+        if ("withheld".equals(codeString))
+          return WITHHELD;
+        if ("unable-to-obtain".equals(codeString))
+          return UNABLETOOBTAIN;
+        if ("deferred".equals(codeString))
+          return DEFERRED;
+        throw new FHIRException("Unknown HistoryNotDoneReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SUBJECTUNKNOWN: return "subject-unknown";
+            case WITHHELD: return "withheld";
+            case UNABLETOOBTAIN: return "unable-to-obtain";
+            case DEFERRED: return "deferred";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/history-not-done-reason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SUBJECTUNKNOWN: return "Patient does not know the subject, e.g. the biological parent of an adopted patient.";
+            case WITHHELD: return "The patient withheld or refused to share the information.";
+            case UNABLETOOBTAIN: return "Information cannot be obtained; e.g. unconscious patient";
+            case DEFERRED: return "Patient does not have the information now, but can provide the information at a later date.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SUBJECTUNKNOWN: return "Subject Unknown";
+            case WITHHELD: return "Information Withheld";
+            case UNABLETOOBTAIN: return "Unable To Obtain";
+            case DEFERRED: return "Deferred";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryNotDoneReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryNotDoneReasonEnumFactory.java
new file mode 100644
index 00000000000..e67914454ee
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryNotDoneReasonEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class HistoryNotDoneReasonEnumFactory implements EnumFactory {
+
+  public HistoryNotDoneReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("subject-unknown".equals(codeString))
+      return HistoryNotDoneReason.SUBJECTUNKNOWN;
+    if ("withheld".equals(codeString))
+      return HistoryNotDoneReason.WITHHELD;
+    if ("unable-to-obtain".equals(codeString))
+      return HistoryNotDoneReason.UNABLETOOBTAIN;
+    if ("deferred".equals(codeString))
+      return HistoryNotDoneReason.DEFERRED;
+    throw new IllegalArgumentException("Unknown HistoryNotDoneReason code '"+codeString+"'");
+  }
+
+  public String toCode(HistoryNotDoneReason code) {
+    if (code == HistoryNotDoneReason.SUBJECTUNKNOWN)
+      return "subject-unknown";
+    if (code == HistoryNotDoneReason.WITHHELD)
+      return "withheld";
+    if (code == HistoryNotDoneReason.UNABLETOOBTAIN)
+      return "unable-to-obtain";
+    if (code == HistoryNotDoneReason.DEFERRED)
+      return "deferred";
+    return "?";
+  }
+
+    public String toSystem(HistoryNotDoneReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryStatus.java
new file mode 100644
index 00000000000..959a029e859
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum HistoryStatus {
+
+        /**
+         * Some health information is known and captured, but not complete - see notes for details.
+         */
+        PARTIAL, 
+        /**
+         * All available related health information is captured as of the date (and possibly time) when the family member history was taken.
+         */
+        COMPLETED, 
+        /**
+         * This instance should not have been part of this patient's medical record.
+         */
+        ENTEREDINERROR, 
+        /**
+         * Health information for this individual is unavailable/unknown.
+         */
+        HEALTHUNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static HistoryStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("partial".equals(codeString))
+          return PARTIAL;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("health-unknown".equals(codeString))
+          return HEALTHUNKNOWN;
+        throw new FHIRException("Unknown HistoryStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PARTIAL: return "partial";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case HEALTHUNKNOWN: return "health-unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/history-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PARTIAL: return "Some health information is known and captured, but not complete - see notes for details.";
+            case COMPLETED: return "All available related health information is captured as of the date (and possibly time) when the family member history was taken.";
+            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
+            case HEALTHUNKNOWN: return "Health information for this individual is unavailable/unknown.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PARTIAL: return "Partial";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in error";
+            case HEALTHUNKNOWN: return "Health unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryStatusEnumFactory.java
new file mode 100644
index 00000000000..88cb75d811a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HistoryStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class HistoryStatusEnumFactory implements EnumFactory {
+
+  public HistoryStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("partial".equals(codeString))
+      return HistoryStatus.PARTIAL;
+    if ("completed".equals(codeString))
+      return HistoryStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return HistoryStatus.ENTEREDINERROR;
+    if ("health-unknown".equals(codeString))
+      return HistoryStatus.HEALTHUNKNOWN;
+    throw new IllegalArgumentException("Unknown HistoryStatus code '"+codeString+"'");
+  }
+
+  public String toCode(HistoryStatus code) {
+    if (code == HistoryStatus.PARTIAL)
+      return "partial";
+    if (code == HistoryStatus.COMPLETED)
+      return "completed";
+    if (code == HistoryStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == HistoryStatus.HEALTHUNKNOWN)
+      return "health-unknown";
+    return "?";
+  }
+
+    public String toSystem(HistoryStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Hl7WorkGroup.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Hl7WorkGroup.java
new file mode 100644
index 00000000000..43e70c9b516
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Hl7WorkGroup.java
@@ -0,0 +1,276 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Hl7WorkGroup {
+
+        /**
+         * Community Based Collaborative Care (http://www.hl7.org/Special/committees/cbcc/index.cfm)
+         */
+        CBCC, 
+        /**
+         * Clinical Decision Support (http://www.hl7.org/Special/committees/dss/index.cfm)
+         */
+        CDS, 
+        /**
+         * Clinical Quality Information (http://www.hl7.org/Special/committees/cqi/index.cfm)
+         */
+        CQI, 
+        /**
+         * Clinical Genomics (http://www.hl7.org/Special/committees/clingenomics/index.cfm)
+         */
+        CG, 
+        /**
+         * Health Care Devices (http://www.hl7.org/Special/committees/healthcaredevices/index.cfm)
+         */
+        DEV, 
+        /**
+         * Electronic Health Records (http://www.hl7.org/special/committees/ehr/index.cfm)
+         */
+        EHR, 
+        /**
+         * FHIR Infrastructure (http://www.hl7.org/Special/committees/fiwg/index.cfm)
+         */
+        FHIR, 
+        /**
+         * Financial Management (http://www.hl7.org/Special/committees/fm/index.cfm)
+         */
+        FM, 
+        /**
+         * Health Standards Integration (http://www.hl7.org/Special/committees/hsi/index.cfm)
+         */
+        HSI, 
+        /**
+         * Imaging Integration (http://www.hl7.org/Special/committees/imagemgt/index.cfm)
+         */
+        II, 
+        /**
+         * Infrastructure And Messaging (http://www.hl7.org/special/committees/inm/index.cfm)
+         */
+        INM, 
+        /**
+         * Implementable Technology Specifications (http://www.hl7.org/special/committees/xml/index.cfm)
+         */
+        ITS, 
+        /**
+         * Orders and Observations (http://www.hl7.org/Special/committees/orders/index.cfm)
+         */
+        OO, 
+        /**
+         * Patient Administration (http://www.hl7.org/Special/committees/pafm/index.cfm)
+         */
+        PA, 
+        /**
+         * Patient Care (http://www.hl7.org/Special/committees/patientcare/index.cfm)
+         */
+        PC, 
+        /**
+         * Public Health and Emergency Response (http://www.hl7.org/Special/committees/pher/index.cfm)
+         */
+        PHER, 
+        /**
+         * Pharmacy (http://www.hl7.org/Special/committees/medication/index.cfm)
+         */
+        PHX, 
+        /**
+         * Regulated Clinical Research Information Management (http://www.hl7.org/Special/committees/rcrim/index.cfm)
+         */
+        RCRIM, 
+        /**
+         * Structured Documents (http://www.hl7.org/Special/committees/structure/index.cfm)
+         */
+        SD, 
+        /**
+         * Security (http://www.hl7.org/Special/committees/secure/index.cfm)
+         */
+        SEC, 
+        /**
+         * US Realm Taskforce (http://wiki.hl7.org/index.php?title=US_Realm_Task_Force)
+         */
+        US, 
+        /**
+         * Vocabulary (http://www.hl7.org/Special/committees/Vocab/index.cfm)
+         */
+        VOCAB, 
+        /**
+         * Application Implementation and Design (http://www.hl7.org/Special/committees/java/index.cfm)
+         */
+        AID, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Hl7WorkGroup fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("cbcc".equals(codeString))
+          return CBCC;
+        if ("cds".equals(codeString))
+          return CDS;
+        if ("cqi".equals(codeString))
+          return CQI;
+        if ("cg".equals(codeString))
+          return CG;
+        if ("dev".equals(codeString))
+          return DEV;
+        if ("ehr".equals(codeString))
+          return EHR;
+        if ("fhir".equals(codeString))
+          return FHIR;
+        if ("fm".equals(codeString))
+          return FM;
+        if ("hsi".equals(codeString))
+          return HSI;
+        if ("ii".equals(codeString))
+          return II;
+        if ("inm".equals(codeString))
+          return INM;
+        if ("its".equals(codeString))
+          return ITS;
+        if ("oo".equals(codeString))
+          return OO;
+        if ("pa".equals(codeString))
+          return PA;
+        if ("pc".equals(codeString))
+          return PC;
+        if ("pher".equals(codeString))
+          return PHER;
+        if ("phx".equals(codeString))
+          return PHX;
+        if ("rcrim".equals(codeString))
+          return RCRIM;
+        if ("sd".equals(codeString))
+          return SD;
+        if ("sec".equals(codeString))
+          return SEC;
+        if ("us".equals(codeString))
+          return US;
+        if ("vocab".equals(codeString))
+          return VOCAB;
+        if ("aid".equals(codeString))
+          return AID;
+        throw new FHIRException("Unknown Hl7WorkGroup code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CBCC: return "cbcc";
+            case CDS: return "cds";
+            case CQI: return "cqi";
+            case CG: return "cg";
+            case DEV: return "dev";
+            case EHR: return "ehr";
+            case FHIR: return "fhir";
+            case FM: return "fm";
+            case HSI: return "hsi";
+            case II: return "ii";
+            case INM: return "inm";
+            case ITS: return "its";
+            case OO: return "oo";
+            case PA: return "pa";
+            case PC: return "pc";
+            case PHER: return "pher";
+            case PHX: return "phx";
+            case RCRIM: return "rcrim";
+            case SD: return "sd";
+            case SEC: return "sec";
+            case US: return "us";
+            case VOCAB: return "vocab";
+            case AID: return "aid";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/hl7-work-group";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CBCC: return "Community Based Collaborative Care (http://www.hl7.org/Special/committees/cbcc/index.cfm)";
+            case CDS: return "Clinical Decision Support (http://www.hl7.org/Special/committees/dss/index.cfm)";
+            case CQI: return "Clinical Quality Information (http://www.hl7.org/Special/committees/cqi/index.cfm)";
+            case CG: return "Clinical Genomics (http://www.hl7.org/Special/committees/clingenomics/index.cfm)";
+            case DEV: return "Health Care Devices (http://www.hl7.org/Special/committees/healthcaredevices/index.cfm)";
+            case EHR: return "Electronic Health Records (http://www.hl7.org/special/committees/ehr/index.cfm)";
+            case FHIR: return "FHIR Infrastructure (http://www.hl7.org/Special/committees/fiwg/index.cfm)";
+            case FM: return "Financial Management (http://www.hl7.org/Special/committees/fm/index.cfm)";
+            case HSI: return "Health Standards Integration (http://www.hl7.org/Special/committees/hsi/index.cfm)";
+            case II: return "Imaging Integration (http://www.hl7.org/Special/committees/imagemgt/index.cfm)";
+            case INM: return "Infrastructure And Messaging (http://www.hl7.org/special/committees/inm/index.cfm)";
+            case ITS: return "Implementable Technology Specifications (http://www.hl7.org/special/committees/xml/index.cfm)";
+            case OO: return "Orders and Observations (http://www.hl7.org/Special/committees/orders/index.cfm)";
+            case PA: return "Patient Administration (http://www.hl7.org/Special/committees/pafm/index.cfm)";
+            case PC: return "Patient Care (http://www.hl7.org/Special/committees/patientcare/index.cfm)";
+            case PHER: return "Public Health and Emergency Response (http://www.hl7.org/Special/committees/pher/index.cfm)";
+            case PHX: return "Pharmacy (http://www.hl7.org/Special/committees/medication/index.cfm)";
+            case RCRIM: return "Regulated Clinical Research Information Management (http://www.hl7.org/Special/committees/rcrim/index.cfm)";
+            case SD: return "Structured Documents (http://www.hl7.org/Special/committees/structure/index.cfm)";
+            case SEC: return "Security (http://www.hl7.org/Special/committees/secure/index.cfm)";
+            case US: return "US Realm Taskforce (http://wiki.hl7.org/index.php?title=US_Realm_Task_Force)";
+            case VOCAB: return "Vocabulary (http://www.hl7.org/Special/committees/Vocab/index.cfm)";
+            case AID: return "Application Implementation and Design (http://www.hl7.org/Special/committees/java/index.cfm)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CBCC: return "Community Based Collaborative Care";
+            case CDS: return "Clinical Decision Support";
+            case CQI: return "Clinical Quality Information";
+            case CG: return "Clinical Genomics";
+            case DEV: return "Health Care Devices";
+            case EHR: return "Electronic Health Records";
+            case FHIR: return "FHIR Infrastructure";
+            case FM: return "Financial Management";
+            case HSI: return "Health Standards Integration";
+            case II: return "Imaging Integration";
+            case INM: return "Infrastructure And Messaging";
+            case ITS: return "Implementable Technology Specifications";
+            case OO: return "Orders and Observations";
+            case PA: return "Patient Administration";
+            case PC: return "Patient Care";
+            case PHER: return "Public Health and Emergency Response";
+            case PHX: return "Pharmacy";
+            case RCRIM: return "Regulated Clinical Research Information Management";
+            case SD: return "Structured Documents";
+            case SEC: return "Security";
+            case US: return "US Realm Taskforce";
+            case VOCAB: return "Vocabulary";
+            case AID: return "Application Implementation and Design";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Hl7WorkGroupEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Hl7WorkGroupEnumFactory.java
new file mode 100644
index 00000000000..7c3888f4c87
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Hl7WorkGroupEnumFactory.java
@@ -0,0 +1,146 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class Hl7WorkGroupEnumFactory implements EnumFactory {
+
+  public Hl7WorkGroup fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("cbcc".equals(codeString))
+      return Hl7WorkGroup.CBCC;
+    if ("cds".equals(codeString))
+      return Hl7WorkGroup.CDS;
+    if ("cqi".equals(codeString))
+      return Hl7WorkGroup.CQI;
+    if ("cg".equals(codeString))
+      return Hl7WorkGroup.CG;
+    if ("dev".equals(codeString))
+      return Hl7WorkGroup.DEV;
+    if ("ehr".equals(codeString))
+      return Hl7WorkGroup.EHR;
+    if ("fhir".equals(codeString))
+      return Hl7WorkGroup.FHIR;
+    if ("fm".equals(codeString))
+      return Hl7WorkGroup.FM;
+    if ("hsi".equals(codeString))
+      return Hl7WorkGroup.HSI;
+    if ("ii".equals(codeString))
+      return Hl7WorkGroup.II;
+    if ("inm".equals(codeString))
+      return Hl7WorkGroup.INM;
+    if ("its".equals(codeString))
+      return Hl7WorkGroup.ITS;
+    if ("oo".equals(codeString))
+      return Hl7WorkGroup.OO;
+    if ("pa".equals(codeString))
+      return Hl7WorkGroup.PA;
+    if ("pc".equals(codeString))
+      return Hl7WorkGroup.PC;
+    if ("pher".equals(codeString))
+      return Hl7WorkGroup.PHER;
+    if ("phx".equals(codeString))
+      return Hl7WorkGroup.PHX;
+    if ("rcrim".equals(codeString))
+      return Hl7WorkGroup.RCRIM;
+    if ("sd".equals(codeString))
+      return Hl7WorkGroup.SD;
+    if ("sec".equals(codeString))
+      return Hl7WorkGroup.SEC;
+    if ("us".equals(codeString))
+      return Hl7WorkGroup.US;
+    if ("vocab".equals(codeString))
+      return Hl7WorkGroup.VOCAB;
+    if ("aid".equals(codeString))
+      return Hl7WorkGroup.AID;
+    throw new IllegalArgumentException("Unknown Hl7WorkGroup code '"+codeString+"'");
+  }
+
+  public String toCode(Hl7WorkGroup code) {
+    if (code == Hl7WorkGroup.CBCC)
+      return "cbcc";
+    if (code == Hl7WorkGroup.CDS)
+      return "cds";
+    if (code == Hl7WorkGroup.CQI)
+      return "cqi";
+    if (code == Hl7WorkGroup.CG)
+      return "cg";
+    if (code == Hl7WorkGroup.DEV)
+      return "dev";
+    if (code == Hl7WorkGroup.EHR)
+      return "ehr";
+    if (code == Hl7WorkGroup.FHIR)
+      return "fhir";
+    if (code == Hl7WorkGroup.FM)
+      return "fm";
+    if (code == Hl7WorkGroup.HSI)
+      return "hsi";
+    if (code == Hl7WorkGroup.II)
+      return "ii";
+    if (code == Hl7WorkGroup.INM)
+      return "inm";
+    if (code == Hl7WorkGroup.ITS)
+      return "its";
+    if (code == Hl7WorkGroup.OO)
+      return "oo";
+    if (code == Hl7WorkGroup.PA)
+      return "pa";
+    if (code == Hl7WorkGroup.PC)
+      return "pc";
+    if (code == Hl7WorkGroup.PHER)
+      return "pher";
+    if (code == Hl7WorkGroup.PHX)
+      return "phx";
+    if (code == Hl7WorkGroup.RCRIM)
+      return "rcrim";
+    if (code == Hl7WorkGroup.SD)
+      return "sd";
+    if (code == Hl7WorkGroup.SEC)
+      return "sec";
+    if (code == Hl7WorkGroup.US)
+      return "us";
+    if (code == Hl7WorkGroup.VOCAB)
+      return "vocab";
+    if (code == Hl7WorkGroup.AID)
+      return "aid";
+    return "?";
+  }
+
+    public String toSystem(Hl7WorkGroup code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpOperations.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpOperations.java
new file mode 100644
index 00000000000..48fa3427dad
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpOperations.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum HttpOperations {
+
+        /**
+         * HTTP DELETE operation
+         */
+        DELETE, 
+        /**
+         * HTTP GET operation
+         */
+        GET, 
+        /**
+         * HTTP OPTIONS operation
+         */
+        OPTIONS, 
+        /**
+         * HTTP PATCH operation
+         */
+        PATCH, 
+        /**
+         * HTTP POST operation
+         */
+        POST, 
+        /**
+         * HTTP PUT operation
+         */
+        PUT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static HttpOperations fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("delete".equals(codeString))
+          return DELETE;
+        if ("get".equals(codeString))
+          return GET;
+        if ("options".equals(codeString))
+          return OPTIONS;
+        if ("patch".equals(codeString))
+          return PATCH;
+        if ("post".equals(codeString))
+          return POST;
+        if ("put".equals(codeString))
+          return PUT;
+        throw new FHIRException("Unknown HttpOperations code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DELETE: return "delete";
+            case GET: return "get";
+            case OPTIONS: return "options";
+            case PATCH: return "patch";
+            case POST: return "post";
+            case PUT: return "put";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/http-operations";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DELETE: return "HTTP DELETE operation";
+            case GET: return "HTTP GET operation";
+            case OPTIONS: return "HTTP OPTIONS operation";
+            case PATCH: return "HTTP PATCH operation";
+            case POST: return "HTTP POST operation";
+            case PUT: return "HTTP PUT operation";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DELETE: return "DELETE";
+            case GET: return "GET";
+            case OPTIONS: return "OPTIONS";
+            case PATCH: return "PATCH";
+            case POST: return "POST";
+            case PUT: return "PUT";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpOperationsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpOperationsEnumFactory.java
new file mode 100644
index 00000000000..c7b451a50f3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpOperationsEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class HttpOperationsEnumFactory implements EnumFactory {
+
+  public HttpOperations fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("delete".equals(codeString))
+      return HttpOperations.DELETE;
+    if ("get".equals(codeString))
+      return HttpOperations.GET;
+    if ("options".equals(codeString))
+      return HttpOperations.OPTIONS;
+    if ("patch".equals(codeString))
+      return HttpOperations.PATCH;
+    if ("post".equals(codeString))
+      return HttpOperations.POST;
+    if ("put".equals(codeString))
+      return HttpOperations.PUT;
+    throw new IllegalArgumentException("Unknown HttpOperations code '"+codeString+"'");
+  }
+
+  public String toCode(HttpOperations code) {
+    if (code == HttpOperations.DELETE)
+      return "delete";
+    if (code == HttpOperations.GET)
+      return "get";
+    if (code == HttpOperations.OPTIONS)
+      return "options";
+    if (code == HttpOperations.PATCH)
+      return "patch";
+    if (code == HttpOperations.POST)
+      return "post";
+    if (code == HttpOperations.PUT)
+      return "put";
+    return "?";
+  }
+
+    public String toSystem(HttpOperations code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpVerb.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpVerb.java
new file mode 100644
index 00000000000..f6b68ee0276
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpVerb.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum HttpVerb {
+
+        /**
+         * HTTP GET
+         */
+        GET, 
+        /**
+         * HTTP POST
+         */
+        POST, 
+        /**
+         * HTTP PUT
+         */
+        PUT, 
+        /**
+         * HTTP DELETE
+         */
+        DELETE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static HttpVerb fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("GET".equals(codeString))
+          return GET;
+        if ("POST".equals(codeString))
+          return POST;
+        if ("PUT".equals(codeString))
+          return PUT;
+        if ("DELETE".equals(codeString))
+          return DELETE;
+        throw new FHIRException("Unknown HttpVerb code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GET: return "GET";
+            case POST: return "POST";
+            case PUT: return "PUT";
+            case DELETE: return "DELETE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/http-verb";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GET: return "HTTP GET";
+            case POST: return "HTTP POST";
+            case PUT: return "HTTP PUT";
+            case DELETE: return "HTTP DELETE";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GET: return "GET";
+            case POST: return "POST";
+            case PUT: return "PUT";
+            case DELETE: return "DELETE";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpVerbEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpVerbEnumFactory.java
new file mode 100644
index 00000000000..4ec60a82d05
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/HttpVerbEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class HttpVerbEnumFactory implements EnumFactory {
+
+  public HttpVerb fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("GET".equals(codeString))
+      return HttpVerb.GET;
+    if ("POST".equals(codeString))
+      return HttpVerb.POST;
+    if ("PUT".equals(codeString))
+      return HttpVerb.PUT;
+    if ("DELETE".equals(codeString))
+      return HttpVerb.DELETE;
+    throw new IllegalArgumentException("Unknown HttpVerb code '"+codeString+"'");
+  }
+
+  public String toCode(HttpVerb code) {
+    if (code == HttpVerb.GET)
+      return "GET";
+    if (code == HttpVerb.POST)
+      return "POST";
+    if (code == HttpVerb.PUT)
+      return "PUT";
+    if (code == HttpVerb.DELETE)
+      return "DELETE";
+    return "?";
+  }
+
+    public String toSystem(HttpVerb code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Icd10Procedures.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Icd10Procedures.java
new file mode 100644
index 00000000000..d124f8e54a0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Icd10Procedures.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Icd10Procedures {
+
+        /**
+         * Procedure 1
+         */
+        _123001, 
+        /**
+         * Procedure 2
+         */
+        _123002, 
+        /**
+         * Procedure 3
+         */
+        _123003, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Icd10Procedures fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("123001".equals(codeString))
+          return _123001;
+        if ("123002".equals(codeString))
+          return _123002;
+        if ("123003".equals(codeString))
+          return _123003;
+        throw new FHIRException("Unknown Icd10Procedures code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _123001: return "123001";
+            case _123002: return "123002";
+            case _123003: return "123003";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/sid/ex-icd-10-procedures";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _123001: return "Procedure 1";
+            case _123002: return "Procedure 2";
+            case _123003: return "Procedure 3";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _123001: return "PROC-1";
+            case _123002: return "PROC-2";
+            case _123003: return "PROC-3";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Icd10ProceduresEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Icd10ProceduresEnumFactory.java
new file mode 100644
index 00000000000..8e19338d718
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Icd10ProceduresEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class Icd10ProceduresEnumFactory implements EnumFactory {
+
+  public Icd10Procedures fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("123001".equals(codeString))
+      return Icd10Procedures._123001;
+    if ("123002".equals(codeString))
+      return Icd10Procedures._123002;
+    if ("123003".equals(codeString))
+      return Icd10Procedures._123003;
+    throw new IllegalArgumentException("Unknown Icd10Procedures code '"+codeString+"'");
+  }
+
+  public String toCode(Icd10Procedures code) {
+    if (code == Icd10Procedures._123001)
+      return "123001";
+    if (code == Icd10Procedures._123002)
+      return "123002";
+    if (code == Icd10Procedures._123003)
+      return "123003";
+    return "?";
+  }
+
+    public String toSystem(Icd10Procedures code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierType.java
new file mode 100644
index 00000000000..046487be365
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum IdentifierType {
+
+        /**
+         * A identifier assigned to a device using the Universal Device Identifier framework as defined by FDA (http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/).
+         */
+        UDI, 
+        /**
+         * An identifier affixed to an item by the manufacturer when it is first made, where each item has a different identifier.
+         */
+        SNO, 
+        /**
+         * An identifier issued by a governmental organization to an individual for the purpose of the receipt of social services and benefits.
+         */
+        SB, 
+        /**
+         * The identifier associated with the person or service that requests or places an order.
+         */
+        PLAC, 
+        /**
+         * The Identifier associated with the person, or service, who produces the observations or fulfills the order requested by the requestor.
+         */
+        FILL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static IdentifierType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("UDI".equals(codeString))
+          return UDI;
+        if ("SNO".equals(codeString))
+          return SNO;
+        if ("SB".equals(codeString))
+          return SB;
+        if ("PLAC".equals(codeString))
+          return PLAC;
+        if ("FILL".equals(codeString))
+          return FILL;
+        throw new FHIRException("Unknown IdentifierType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UDI: return "UDI";
+            case SNO: return "SNO";
+            case SB: return "SB";
+            case PLAC: return "PLAC";
+            case FILL: return "FILL";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/identifier-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UDI: return "A identifier assigned to a device using the Universal Device Identifier framework as defined by FDA (http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/).";
+            case SNO: return "An identifier affixed to an item by the manufacturer when it is first made, where each item has a different identifier.";
+            case SB: return "An identifier issued by a governmental organization to an individual for the purpose of the receipt of social services and benefits.";
+            case PLAC: return "The identifier associated with the person or service that requests or places an order.";
+            case FILL: return "The Identifier associated with the person, or service, who produces the observations or fulfills the order requested by the requestor.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UDI: return "Universal Device Identifier";
+            case SNO: return "Serial Number";
+            case SB: return "Social Beneficiary Identifier";
+            case PLAC: return "Placer Identifier";
+            case FILL: return "Filler Identifier";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierTypeEnumFactory.java
new file mode 100644
index 00000000000..5e01f170d6f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class IdentifierTypeEnumFactory implements EnumFactory {
+
+  public IdentifierType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("UDI".equals(codeString))
+      return IdentifierType.UDI;
+    if ("SNO".equals(codeString))
+      return IdentifierType.SNO;
+    if ("SB".equals(codeString))
+      return IdentifierType.SB;
+    if ("PLAC".equals(codeString))
+      return IdentifierType.PLAC;
+    if ("FILL".equals(codeString))
+      return IdentifierType.FILL;
+    throw new IllegalArgumentException("Unknown IdentifierType code '"+codeString+"'");
+  }
+
+  public String toCode(IdentifierType code) {
+    if (code == IdentifierType.UDI)
+      return "UDI";
+    if (code == IdentifierType.SNO)
+      return "SNO";
+    if (code == IdentifierType.SB)
+      return "SB";
+    if (code == IdentifierType.PLAC)
+      return "PLAC";
+    if (code == IdentifierType.FILL)
+      return "FILL";
+    return "?";
+  }
+
+    public String toSystem(IdentifierType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierUse.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierUse.java
new file mode 100644
index 00000000000..0bbe222ff04
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierUse.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum IdentifierUse {
+
+        /**
+         * The identifier recommended for display and use in real-world interactions.
+         */
+        USUAL, 
+        /**
+         * The identifier considered to be most trusted for the identification of this item.
+         */
+        OFFICIAL, 
+        /**
+         * A temporary identifier.
+         */
+        TEMP, 
+        /**
+         * An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context.
+         */
+        SECONDARY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static IdentifierUse fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("usual".equals(codeString))
+          return USUAL;
+        if ("official".equals(codeString))
+          return OFFICIAL;
+        if ("temp".equals(codeString))
+          return TEMP;
+        if ("secondary".equals(codeString))
+          return SECONDARY;
+        throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case USUAL: return "usual";
+            case OFFICIAL: return "official";
+            case TEMP: return "temp";
+            case SECONDARY: return "secondary";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/identifier-use";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case USUAL: return "The identifier recommended for display and use in real-world interactions.";
+            case OFFICIAL: return "The identifier considered to be most trusted for the identification of this item.";
+            case TEMP: return "A temporary identifier.";
+            case SECONDARY: return "An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case USUAL: return "Usual";
+            case OFFICIAL: return "Official";
+            case TEMP: return "Temp";
+            case SECONDARY: return "Secondary";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierUseEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierUseEnumFactory.java
new file mode 100644
index 00000000000..3c1ba4b2645
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentifierUseEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class IdentifierUseEnumFactory implements EnumFactory {
+
+  public IdentifierUse fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("usual".equals(codeString))
+      return IdentifierUse.USUAL;
+    if ("official".equals(codeString))
+      return IdentifierUse.OFFICIAL;
+    if ("temp".equals(codeString))
+      return IdentifierUse.TEMP;
+    if ("secondary".equals(codeString))
+      return IdentifierUse.SECONDARY;
+    throw new IllegalArgumentException("Unknown IdentifierUse code '"+codeString+"'");
+  }
+
+  public String toCode(IdentifierUse code) {
+    if (code == IdentifierUse.USUAL)
+      return "usual";
+    if (code == IdentifierUse.OFFICIAL)
+      return "official";
+    if (code == IdentifierUse.TEMP)
+      return "temp";
+    if (code == IdentifierUse.SECONDARY)
+      return "secondary";
+    return "?";
+  }
+
+    public String toSystem(IdentifierUse code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentityAssuranceLevel.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentityAssuranceLevel.java
new file mode 100644
index 00000000000..a243edcca30
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentityAssuranceLevel.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum IdentityAssuranceLevel {
+
+        /**
+         * Little or no confidence in the asserted identity's accuracy.
+         */
+        LEVEL1, 
+        /**
+         * Some confidence in the asserted identity's accuracy.
+         */
+        LEVEL2, 
+        /**
+         * High confidence in the asserted identity's accuracy.
+         */
+        LEVEL3, 
+        /**
+         * Very high confidence in the asserted identity's accuracy.
+         */
+        LEVEL4, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static IdentityAssuranceLevel fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("level1".equals(codeString))
+          return LEVEL1;
+        if ("level2".equals(codeString))
+          return LEVEL2;
+        if ("level3".equals(codeString))
+          return LEVEL3;
+        if ("level4".equals(codeString))
+          return LEVEL4;
+        throw new FHIRException("Unknown IdentityAssuranceLevel code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LEVEL1: return "level1";
+            case LEVEL2: return "level2";
+            case LEVEL3: return "level3";
+            case LEVEL4: return "level4";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/identity-assuranceLevel";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LEVEL1: return "Little or no confidence in the asserted identity's accuracy.";
+            case LEVEL2: return "Some confidence in the asserted identity's accuracy.";
+            case LEVEL3: return "High confidence in the asserted identity's accuracy.";
+            case LEVEL4: return "Very high confidence in the asserted identity's accuracy.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LEVEL1: return "Level 1";
+            case LEVEL2: return "Level 2";
+            case LEVEL3: return "Level 3";
+            case LEVEL4: return "Level 4";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentityAssuranceLevelEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentityAssuranceLevelEnumFactory.java
new file mode 100644
index 00000000000..9c3b71409e8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IdentityAssuranceLevelEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class IdentityAssuranceLevelEnumFactory implements EnumFactory {
+
+  public IdentityAssuranceLevel fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("level1".equals(codeString))
+      return IdentityAssuranceLevel.LEVEL1;
+    if ("level2".equals(codeString))
+      return IdentityAssuranceLevel.LEVEL2;
+    if ("level3".equals(codeString))
+      return IdentityAssuranceLevel.LEVEL3;
+    if ("level4".equals(codeString))
+      return IdentityAssuranceLevel.LEVEL4;
+    throw new IllegalArgumentException("Unknown IdentityAssuranceLevel code '"+codeString+"'");
+  }
+
+  public String toCode(IdentityAssuranceLevel code) {
+    if (code == IdentityAssuranceLevel.LEVEL1)
+      return "level1";
+    if (code == IdentityAssuranceLevel.LEVEL2)
+      return "level2";
+    if (code == IdentityAssuranceLevel.LEVEL3)
+      return "level3";
+    if (code == IdentityAssuranceLevel.LEVEL4)
+      return "level4";
+    return "?";
+  }
+
+    public String toSystem(IdentityAssuranceLevel code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationOrigin.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationOrigin.java
new file mode 100644
index 00000000000..3a39020d3d8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationOrigin.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ImmunizationOrigin {
+
+        /**
+         * The data for the immunization event originated with another provider.
+         */
+        PROVIDER, 
+        /**
+         * The data for the immunization event originated with a written record for the patient.
+         */
+        RECORD, 
+        /**
+         * The data for the immunization event originated from the recollection of the patient or parent/guardian of the patient.
+         */
+        RECALL, 
+        /**
+         * The data for the immunization event originated with a school record for the patient.
+         */
+        SCHOOL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ImmunizationOrigin fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("provider".equals(codeString))
+          return PROVIDER;
+        if ("record".equals(codeString))
+          return RECORD;
+        if ("recall".equals(codeString))
+          return RECALL;
+        if ("school".equals(codeString))
+          return SCHOOL;
+        throw new FHIRException("Unknown ImmunizationOrigin code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROVIDER: return "provider";
+            case RECORD: return "record";
+            case RECALL: return "recall";
+            case SCHOOL: return "school";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/immunization-origin";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROVIDER: return "The data for the immunization event originated with another provider.";
+            case RECORD: return "The data for the immunization event originated with a written record for the patient.";
+            case RECALL: return "The data for the immunization event originated from the recollection of the patient or parent/guardian of the patient.";
+            case SCHOOL: return "The data for the immunization event originated with a school record for the patient.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROVIDER: return "Other Provider";
+            case RECORD: return "Written Record";
+            case RECALL: return "Parent/Guardian/Patient Recall";
+            case SCHOOL: return "School Record";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationOriginEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationOriginEnumFactory.java
new file mode 100644
index 00000000000..f11bb2eaec1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationOriginEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ImmunizationOriginEnumFactory implements EnumFactory {
+
+  public ImmunizationOrigin fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("provider".equals(codeString))
+      return ImmunizationOrigin.PROVIDER;
+    if ("record".equals(codeString))
+      return ImmunizationOrigin.RECORD;
+    if ("recall".equals(codeString))
+      return ImmunizationOrigin.RECALL;
+    if ("school".equals(codeString))
+      return ImmunizationOrigin.SCHOOL;
+    throw new IllegalArgumentException("Unknown ImmunizationOrigin code '"+codeString+"'");
+  }
+
+  public String toCode(ImmunizationOrigin code) {
+    if (code == ImmunizationOrigin.PROVIDER)
+      return "provider";
+    if (code == ImmunizationOrigin.RECORD)
+      return "record";
+    if (code == ImmunizationOrigin.RECALL)
+      return "recall";
+    if (code == ImmunizationOrigin.SCHOOL)
+      return "school";
+    return "?";
+  }
+
+    public String toSystem(ImmunizationOrigin code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationDateCriterion.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationDateCriterion.java
new file mode 100644
index 00000000000..4308d9d4a1b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationDateCriterion.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ImmunizationRecommendationDateCriterion {
+
+        /**
+         * Date the next dose is considered due.
+         */
+        DUE, 
+        /**
+         * At the recommended date.
+         */
+        RECOMMENDED, 
+        /**
+         * As early as possible.
+         */
+        EARLIEST, 
+        /**
+         * Date the next dose is considered overdue.
+         */
+        OVERDUE, 
+        /**
+         * The latest date the next dose is to be given.
+         */
+        LATEST, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ImmunizationRecommendationDateCriterion fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("due".equals(codeString))
+          return DUE;
+        if ("recommended".equals(codeString))
+          return RECOMMENDED;
+        if ("earliest".equals(codeString))
+          return EARLIEST;
+        if ("overdue".equals(codeString))
+          return OVERDUE;
+        if ("latest".equals(codeString))
+          return LATEST;
+        throw new FHIRException("Unknown ImmunizationRecommendationDateCriterion code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DUE: return "due";
+            case RECOMMENDED: return "recommended";
+            case EARLIEST: return "earliest";
+            case OVERDUE: return "overdue";
+            case LATEST: return "latest";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/immunization-recommendation-date-criterion";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DUE: return "Date the next dose is considered due.";
+            case RECOMMENDED: return "At the recommended date.";
+            case EARLIEST: return "As early as possible.";
+            case OVERDUE: return "Date the next dose is considered overdue.";
+            case LATEST: return "The latest date the next dose is to be given.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DUE: return "Due";
+            case RECOMMENDED: return "Recommended";
+            case EARLIEST: return "Earliest Date";
+            case OVERDUE: return "Past Due Date";
+            case LATEST: return "Latest";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationDateCriterionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationDateCriterionEnumFactory.java
new file mode 100644
index 00000000000..40963dff123
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationDateCriterionEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ImmunizationRecommendationDateCriterionEnumFactory implements EnumFactory {
+
+  public ImmunizationRecommendationDateCriterion fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("due".equals(codeString))
+      return ImmunizationRecommendationDateCriterion.DUE;
+    if ("recommended".equals(codeString))
+      return ImmunizationRecommendationDateCriterion.RECOMMENDED;
+    if ("earliest".equals(codeString))
+      return ImmunizationRecommendationDateCriterion.EARLIEST;
+    if ("overdue".equals(codeString))
+      return ImmunizationRecommendationDateCriterion.OVERDUE;
+    if ("latest".equals(codeString))
+      return ImmunizationRecommendationDateCriterion.LATEST;
+    throw new IllegalArgumentException("Unknown ImmunizationRecommendationDateCriterion code '"+codeString+"'");
+  }
+
+  public String toCode(ImmunizationRecommendationDateCriterion code) {
+    if (code == ImmunizationRecommendationDateCriterion.DUE)
+      return "due";
+    if (code == ImmunizationRecommendationDateCriterion.RECOMMENDED)
+      return "recommended";
+    if (code == ImmunizationRecommendationDateCriterion.EARLIEST)
+      return "earliest";
+    if (code == ImmunizationRecommendationDateCriterion.OVERDUE)
+      return "overdue";
+    if (code == ImmunizationRecommendationDateCriterion.LATEST)
+      return "latest";
+    return "?";
+  }
+
+    public String toSystem(ImmunizationRecommendationDateCriterion code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationStatus.java
new file mode 100644
index 00000000000..3215206c89a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationStatus.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ImmunizationRecommendationStatus {
+
+        /**
+         * The patient is due for their next vaccination.
+         */
+        DUE, 
+        /**
+         * The patient is considered overdue for their next vaccination.
+         */
+        OVERDUE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ImmunizationRecommendationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("due".equals(codeString))
+          return DUE;
+        if ("overdue".equals(codeString))
+          return OVERDUE;
+        throw new FHIRException("Unknown ImmunizationRecommendationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DUE: return "due";
+            case OVERDUE: return "overdue";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/immunization-recommendation-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DUE: return "The patient is due for their next vaccination.";
+            case OVERDUE: return "The patient is considered overdue for their next vaccination.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DUE: return "Due";
+            case OVERDUE: return "Overdue";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationStatusEnumFactory.java
new file mode 100644
index 00000000000..5d00e5341d7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImmunizationRecommendationStatusEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ImmunizationRecommendationStatusEnumFactory implements EnumFactory {
+
+  public ImmunizationRecommendationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("due".equals(codeString))
+      return ImmunizationRecommendationStatus.DUE;
+    if ("overdue".equals(codeString))
+      return ImmunizationRecommendationStatus.OVERDUE;
+    throw new IllegalArgumentException("Unknown ImmunizationRecommendationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ImmunizationRecommendationStatus code) {
+    if (code == ImmunizationRecommendationStatus.DUE)
+      return "due";
+    if (code == ImmunizationRecommendationStatus.OVERDUE)
+      return "overdue";
+    return "?";
+  }
+
+    public String toSystem(ImmunizationRecommendationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImplantStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImplantStatus.java
new file mode 100644
index 00000000000..c95fc24af72
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImplantStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ImplantStatus {
+
+        /**
+         * The implanted device is working normally
+         */
+        FUNCTIONAL, 
+        /**
+         * The implanted device is not working
+         */
+        NONFUNCTIONAL, 
+        /**
+         * The implanted device has been turned off
+         */
+        DISABLED, 
+        /**
+         * the functional status of the implant has not been determined
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ImplantStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("functional".equals(codeString))
+          return FUNCTIONAL;
+        if ("non-functional".equals(codeString))
+          return NONFUNCTIONAL;
+        if ("disabled".equals(codeString))
+          return DISABLED;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown ImplantStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FUNCTIONAL: return "functional";
+            case NONFUNCTIONAL: return "non-functional";
+            case DISABLED: return "disabled";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/implant-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FUNCTIONAL: return "The implanted device is working normally";
+            case NONFUNCTIONAL: return "The implanted device is not working";
+            case DISABLED: return "The implanted device has been turned off";
+            case UNKNOWN: return "the functional status of the implant has not been determined";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FUNCTIONAL: return "Functional";
+            case NONFUNCTIONAL: return "Non-Functional";
+            case DISABLED: return "Disabled";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImplantStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImplantStatusEnumFactory.java
new file mode 100644
index 00000000000..391b08af570
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ImplantStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ImplantStatusEnumFactory implements EnumFactory {
+
+  public ImplantStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("functional".equals(codeString))
+      return ImplantStatus.FUNCTIONAL;
+    if ("non-functional".equals(codeString))
+      return ImplantStatus.NONFUNCTIONAL;
+    if ("disabled".equals(codeString))
+      return ImplantStatus.DISABLED;
+    if ("unknown".equals(codeString))
+      return ImplantStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown ImplantStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ImplantStatus code) {
+    if (code == ImplantStatus.FUNCTIONAL)
+      return "functional";
+    if (code == ImplantStatus.NONFUNCTIONAL)
+      return "non-functional";
+    if (code == ImplantStatus.DISABLED)
+      return "disabled";
+    if (code == ImplantStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(ImplantStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Intervention.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Intervention.java
new file mode 100644
index 00000000000..84e9b1a048a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Intervention.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Intervention {
+
+        /**
+         * Unknown
+         */
+        UNKNOWN, 
+        /**
+         * Other
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Intervention fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown Intervention code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UNKNOWN: return "unknown";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/intervention";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UNKNOWN: return "Unknown";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UNKNOWN: return "Unknown";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/InterventionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/InterventionEnumFactory.java
new file mode 100644
index 00000000000..d73c246e351
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/InterventionEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class InterventionEnumFactory implements EnumFactory {
+
+  public Intervention fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("unknown".equals(codeString))
+      return Intervention.UNKNOWN;
+    if ("other".equals(codeString))
+      return Intervention.OTHER;
+    throw new IllegalArgumentException("Unknown Intervention code '"+codeString+"'");
+  }
+
+  public String toCode(Intervention code) {
+    if (code == Intervention.UNKNOWN)
+      return "unknown";
+    if (code == Intervention.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(Intervention code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Iso21089Lifecycle.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Iso21089Lifecycle.java
new file mode 100644
index 00000000000..fede9f3603c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Iso21089Lifecycle.java
@@ -0,0 +1,294 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Iso21089Lifecycle {
+
+        /**
+         * occurs when an agent makes any change to record entry content currently residing in storage considered permanent (persistent)
+         */
+        _2, 
+        /**
+         * occurs when an agent causes the system to create and move archive artifacts containing record entry content, typically to long-term offline storage
+         */
+        _14, 
+        /**
+         * occurs when an agent causes the system to capture the agent’s digital signature (or equivalent indication) during formal validation of record entry content
+         */
+        _4, 
+        /**
+         * occurs when an agent causes the system to decode record entry content from a cipher
+         */
+        _27, 
+        /**
+         * occurs when an agent causes the system to scrub record entry content to reduce the association between a set of identifying data and the data subject in a way that may or may not be reversible
+         */
+        _10, 
+        /**
+         * occurs when an agent causes the system to tag record entry(ies) as obsolete, erroneous or untrustworthy, to warn against its future use
+         */
+        _17, 
+        /**
+         * occurs when an agent causes the system to permanently erase record entry content from the system
+         */
+        _16, 
+        /**
+         * occurs when an agent causes the system to release, transfer, provision access to, or otherwise divulge record entry content
+         */
+        _7, 
+        /**
+         * occurs when an agent causes the system to encode record entry content in a cipher
+         */
+        _26, 
+        /**
+         * occurs when an agent causes the system to selectively pull out a subset of record entry content, based on explicit criteria
+         */
+        _13, 
+        /**
+         * occurs when an agent causes the system to connect related record entries
+         */
+        _21, 
+        /**
+         * occurs when an agent causes the system to combine or join content from two or more record entries, resulting in a single logical record entry
+         */
+        _19, 
+        /**
+         * occurs when an agent causes the system to:  a) initiate capture of potential record content, and b) incorporate that content into the storage considered a permanent part of the health record
+         */
+        _1, 
+        /**
+         * occurs when an agent causes the system to remove record entry content to reduce the association between a set of identifying data and the data subject in a way that may be reversible
+         */
+        _11, 
+        /**
+         * occurs when an agent causes the system to recreate or restore full status to record entries previously deleted or deprecated
+         */
+        _18, 
+        /**
+         * occurs when an agent causes the system to:  a) initiate capture of data content from elseware, and b) incorporate that content into the storage considered a permanent part of the health record
+         */
+        _9, 
+        /**
+         * occurs when an agent causes the system to produce and deliver record entry content in a particular form and manner
+         */
+        _6, 
+        /**
+         * occurs when an agent causes the system to restore information to data that allows identification of information source and/or information subject
+         */
+        _12, 
+        /**
+         * occurs when an agent causes the system to remove a tag or other cues for special access management had required to fulfill organizational policy under the legal doctrine of “duty to preserve”
+         */
+        _24, 
+        /**
+         * occurs when an agent causes the system to recreate record entries and their content from a previous created archive artifact
+         */
+        _15, 
+        /**
+         * occurs when an agent causes the system to change the form, language or code system used to represent record entry content
+         */
+        _3, 
+        /**
+         * occurs when an agent causes the system to send record entry content from one (EHR/PHR/other) system to another
+         */
+        _8, 
+        /**
+         * occurs when an agent causes the system to disconnect two or more record entries previously connected, rendering them separate (disconnected) again
+         */
+        _22, 
+        /**
+         * occurs when an agent causes the system to reverse a previous record entry merge operation, rendering them separate again
+         */
+        _20, 
+        /**
+         * occurs when an agent causes the system to confirm compliance of data or data objects with regulations, requirements, specifications, or other imposed conditions based on organizational policy
+         */
+        _25, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Iso21089Lifecycle fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("2".equals(codeString))
+          return _2;
+        if ("14".equals(codeString))
+          return _14;
+        if ("4".equals(codeString))
+          return _4;
+        if ("27".equals(codeString))
+          return _27;
+        if ("10".equals(codeString))
+          return _10;
+        if ("17".equals(codeString))
+          return _17;
+        if ("16".equals(codeString))
+          return _16;
+        if ("7".equals(codeString))
+          return _7;
+        if ("26".equals(codeString))
+          return _26;
+        if ("13".equals(codeString))
+          return _13;
+        if ("21".equals(codeString))
+          return _21;
+        if ("19".equals(codeString))
+          return _19;
+        if ("1".equals(codeString))
+          return _1;
+        if ("11".equals(codeString))
+          return _11;
+        if ("18".equals(codeString))
+          return _18;
+        if ("9".equals(codeString))
+          return _9;
+        if ("6".equals(codeString))
+          return _6;
+        if ("12".equals(codeString))
+          return _12;
+        if ("24".equals(codeString))
+          return _24;
+        if ("15".equals(codeString))
+          return _15;
+        if ("3".equals(codeString))
+          return _3;
+        if ("8".equals(codeString))
+          return _8;
+        if ("22".equals(codeString))
+          return _22;
+        if ("20".equals(codeString))
+          return _20;
+        if ("25".equals(codeString))
+          return _25;
+        throw new FHIRException("Unknown Iso21089Lifecycle code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _2: return "2";
+            case _14: return "14";
+            case _4: return "4";
+            case _27: return "27";
+            case _10: return "10";
+            case _17: return "17";
+            case _16: return "16";
+            case _7: return "7";
+            case _26: return "26";
+            case _13: return "13";
+            case _21: return "21";
+            case _19: return "19";
+            case _1: return "1";
+            case _11: return "11";
+            case _18: return "18";
+            case _9: return "9";
+            case _6: return "6";
+            case _12: return "12";
+            case _24: return "24";
+            case _15: return "15";
+            case _3: return "3";
+            case _8: return "8";
+            case _22: return "22";
+            case _20: return "20";
+            case _25: return "25";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/iso-21089-lifecycle";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _2: return "occurs when an agent makes any change to record entry content currently residing in storage considered permanent (persistent)";
+            case _14: return "occurs when an agent causes the system to create and move archive artifacts containing record entry content, typically to long-term offline storage";
+            case _4: return "occurs when an agent causes the system to capture the agent’s digital signature (or equivalent indication) during formal validation of record entry content";
+            case _27: return "occurs when an agent causes the system to decode record entry content from a cipher";
+            case _10: return "occurs when an agent causes the system to scrub record entry content to reduce the association between a set of identifying data and the data subject in a way that may or may not be reversible";
+            case _17: return "occurs when an agent causes the system to tag record entry(ies) as obsolete, erroneous or untrustworthy, to warn against its future use";
+            case _16: return "occurs when an agent causes the system to permanently erase record entry content from the system";
+            case _7: return "occurs when an agent causes the system to release, transfer, provision access to, or otherwise divulge record entry content";
+            case _26: return "occurs when an agent causes the system to encode record entry content in a cipher";
+            case _13: return "occurs when an agent causes the system to selectively pull out a subset of record entry content, based on explicit criteria";
+            case _21: return "occurs when an agent causes the system to connect related record entries";
+            case _19: return "occurs when an agent causes the system to combine or join content from two or more record entries, resulting in a single logical record entry";
+            case _1: return "occurs when an agent causes the system to:  a) initiate capture of potential record content, and b) incorporate that content into the storage considered a permanent part of the health record";
+            case _11: return "occurs when an agent causes the system to remove record entry content to reduce the association between a set of identifying data and the data subject in a way that may be reversible";
+            case _18: return "occurs when an agent causes the system to recreate or restore full status to record entries previously deleted or deprecated";
+            case _9: return "occurs when an agent causes the system to:  a) initiate capture of data content from elseware, and b) incorporate that content into the storage considered a permanent part of the health record";
+            case _6: return "occurs when an agent causes the system to produce and deliver record entry content in a particular form and manner";
+            case _12: return "occurs when an agent causes the system to restore information to data that allows identification of information source and/or information subject";
+            case _24: return "occurs when an agent causes the system to remove a tag or other cues for special access management had required to fulfill organizational policy under the legal doctrine of “duty to preserve”";
+            case _15: return "occurs when an agent causes the system to recreate record entries and their content from a previous created archive artifact";
+            case _3: return "occurs when an agent causes the system to change the form, language or code system used to represent record entry content";
+            case _8: return "occurs when an agent causes the system to send record entry content from one (EHR/PHR/other) system to another";
+            case _22: return "occurs when an agent causes the system to disconnect two or more record entries previously connected, rendering them separate (disconnected) again";
+            case _20: return "occurs when an agent causes the system to reverse a previous record entry merge operation, rendering them separate again";
+            case _25: return "occurs when an agent causes the system to confirm compliance of data or data objects with regulations, requirements, specifications, or other imposed conditions based on organizational policy";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _2: return "Amend (Update) - Lifeycle Event";
+            case _14: return "Archive - Lifeycle Event";
+            case _4: return "Attest - Lifecycle Event";
+            case _27: return "Decrypt - Lifecycle Event";
+            case _10: return "De-Identify (Anononymize) - Lifecycle Event";
+            case _17: return "Deprecate - Lifecycle Event";
+            case _16: return "Destroy/Delete - Lifecycle Event";
+            case _7: return "Disclose - Lifecycle Event";
+            case _26: return "Encrypt - Lifecycle Event";
+            case _13: return "Extract - Lifecycle Event";
+            case _21: return "Link - Lifecycle Event";
+            case _19: return "Merge - Lifecycle Event";
+            case _1: return "Originate/Retain - Record Lifecyle Event";
+            case _11: return "Pseudonymize - Lifecycle Event";
+            case _18: return "Re-activate - Lifecycle Event";
+            case _9: return "Receive/Retain - Lifecycle Event";
+            case _6: return "Report (Output) - Lifecycle Event";
+            case _12: return "Re-identify - Lifecycle Event";
+            case _24: return "Remove Legal Hold - Lifecycle Event";
+            case _15: return "Restore - Lifecycle Event";
+            case _3: return "Transform/Translate - Lifecycle Event";
+            case _8: return "Transmit - Lifecycle Event";
+            case _22: return "Unlink - Lifecycle Event";
+            case _20: return "Unmerge - Lifecycle Event";
+            case _25: return "Verify - Lifecycle Event";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Iso21089LifecycleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Iso21089LifecycleEnumFactory.java
new file mode 100644
index 00000000000..0c7452a87a8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Iso21089LifecycleEnumFactory.java
@@ -0,0 +1,154 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class Iso21089LifecycleEnumFactory implements EnumFactory {
+
+  public Iso21089Lifecycle fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("2".equals(codeString))
+      return Iso21089Lifecycle._2;
+    if ("14".equals(codeString))
+      return Iso21089Lifecycle._14;
+    if ("4".equals(codeString))
+      return Iso21089Lifecycle._4;
+    if ("27".equals(codeString))
+      return Iso21089Lifecycle._27;
+    if ("10".equals(codeString))
+      return Iso21089Lifecycle._10;
+    if ("17".equals(codeString))
+      return Iso21089Lifecycle._17;
+    if ("16".equals(codeString))
+      return Iso21089Lifecycle._16;
+    if ("7".equals(codeString))
+      return Iso21089Lifecycle._7;
+    if ("26".equals(codeString))
+      return Iso21089Lifecycle._26;
+    if ("13".equals(codeString))
+      return Iso21089Lifecycle._13;
+    if ("21".equals(codeString))
+      return Iso21089Lifecycle._21;
+    if ("19".equals(codeString))
+      return Iso21089Lifecycle._19;
+    if ("1".equals(codeString))
+      return Iso21089Lifecycle._1;
+    if ("11".equals(codeString))
+      return Iso21089Lifecycle._11;
+    if ("18".equals(codeString))
+      return Iso21089Lifecycle._18;
+    if ("9".equals(codeString))
+      return Iso21089Lifecycle._9;
+    if ("6".equals(codeString))
+      return Iso21089Lifecycle._6;
+    if ("12".equals(codeString))
+      return Iso21089Lifecycle._12;
+    if ("24".equals(codeString))
+      return Iso21089Lifecycle._24;
+    if ("15".equals(codeString))
+      return Iso21089Lifecycle._15;
+    if ("3".equals(codeString))
+      return Iso21089Lifecycle._3;
+    if ("8".equals(codeString))
+      return Iso21089Lifecycle._8;
+    if ("22".equals(codeString))
+      return Iso21089Lifecycle._22;
+    if ("20".equals(codeString))
+      return Iso21089Lifecycle._20;
+    if ("25".equals(codeString))
+      return Iso21089Lifecycle._25;
+    throw new IllegalArgumentException("Unknown Iso21089Lifecycle code '"+codeString+"'");
+  }
+
+  public String toCode(Iso21089Lifecycle code) {
+    if (code == Iso21089Lifecycle._2)
+      return "2";
+    if (code == Iso21089Lifecycle._14)
+      return "14";
+    if (code == Iso21089Lifecycle._4)
+      return "4";
+    if (code == Iso21089Lifecycle._27)
+      return "27";
+    if (code == Iso21089Lifecycle._10)
+      return "10";
+    if (code == Iso21089Lifecycle._17)
+      return "17";
+    if (code == Iso21089Lifecycle._16)
+      return "16";
+    if (code == Iso21089Lifecycle._7)
+      return "7";
+    if (code == Iso21089Lifecycle._26)
+      return "26";
+    if (code == Iso21089Lifecycle._13)
+      return "13";
+    if (code == Iso21089Lifecycle._21)
+      return "21";
+    if (code == Iso21089Lifecycle._19)
+      return "19";
+    if (code == Iso21089Lifecycle._1)
+      return "1";
+    if (code == Iso21089Lifecycle._11)
+      return "11";
+    if (code == Iso21089Lifecycle._18)
+      return "18";
+    if (code == Iso21089Lifecycle._9)
+      return "9";
+    if (code == Iso21089Lifecycle._6)
+      return "6";
+    if (code == Iso21089Lifecycle._12)
+      return "12";
+    if (code == Iso21089Lifecycle._24)
+      return "24";
+    if (code == Iso21089Lifecycle._15)
+      return "15";
+    if (code == Iso21089Lifecycle._3)
+      return "3";
+    if (code == Iso21089Lifecycle._8)
+      return "8";
+    if (code == Iso21089Lifecycle._22)
+      return "22";
+    if (code == Iso21089Lifecycle._20)
+      return "20";
+    if (code == Iso21089Lifecycle._25)
+      return "25";
+    return "?";
+  }
+
+    public String toSystem(Iso21089Lifecycle code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueSeverity.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueSeverity.java
new file mode 100644
index 00000000000..4b36a805697
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueSeverity.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum IssueSeverity {
+
+        /**
+         * The issue caused the action to fail, and no further checking could be performed.
+         */
+        FATAL, 
+        /**
+         * The issue is sufficiently important to cause the action to fail.
+         */
+        ERROR, 
+        /**
+         * The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired.
+         */
+        WARNING, 
+        /**
+         * The issue has no relation to the degree of success of the action.
+         */
+        INFORMATION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static IssueSeverity fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("fatal".equals(codeString))
+          return FATAL;
+        if ("error".equals(codeString))
+          return ERROR;
+        if ("warning".equals(codeString))
+          return WARNING;
+        if ("information".equals(codeString))
+          return INFORMATION;
+        throw new FHIRException("Unknown IssueSeverity code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FATAL: return "fatal";
+            case ERROR: return "error";
+            case WARNING: return "warning";
+            case INFORMATION: return "information";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/issue-severity";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FATAL: return "The issue caused the action to fail, and no further checking could be performed.";
+            case ERROR: return "The issue is sufficiently important to cause the action to fail.";
+            case WARNING: return "The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired.";
+            case INFORMATION: return "The issue has no relation to the degree of success of the action.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FATAL: return "Fatal";
+            case ERROR: return "Error";
+            case WARNING: return "Warning";
+            case INFORMATION: return "Information";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueSeverityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueSeverityEnumFactory.java
new file mode 100644
index 00000000000..d4260cc2daa
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueSeverityEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class IssueSeverityEnumFactory implements EnumFactory {
+
+  public IssueSeverity fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("fatal".equals(codeString))
+      return IssueSeverity.FATAL;
+    if ("error".equals(codeString))
+      return IssueSeverity.ERROR;
+    if ("warning".equals(codeString))
+      return IssueSeverity.WARNING;
+    if ("information".equals(codeString))
+      return IssueSeverity.INFORMATION;
+    throw new IllegalArgumentException("Unknown IssueSeverity code '"+codeString+"'");
+  }
+
+  public String toCode(IssueSeverity code) {
+    if (code == IssueSeverity.FATAL)
+      return "fatal";
+    if (code == IssueSeverity.ERROR)
+      return "error";
+    if (code == IssueSeverity.WARNING)
+      return "warning";
+    if (code == IssueSeverity.INFORMATION)
+      return "information";
+    return "?";
+  }
+
+    public String toSystem(IssueSeverity code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueType.java
new file mode 100644
index 00000000000..480721d8de7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueType.java
@@ -0,0 +1,330 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum IssueType {
+
+        /**
+         * Content invalid against the specification or a profile.
+         */
+        INVALID, 
+        /**
+         * A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax.
+         */
+        STRUCTURE, 
+        /**
+         * A required element is missing.
+         */
+        REQUIRED, 
+        /**
+         * An element value is invalid.
+         */
+        VALUE, 
+        /**
+         * A content validation rule failed - e.g. a schematron rule.
+         */
+        INVARIANT, 
+        /**
+         * An authentication/authorization/permissions issue of some kind.
+         */
+        SECURITY, 
+        /**
+         * The client needs to initiate an authentication process.
+         */
+        LOGIN, 
+        /**
+         * The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable).
+         */
+        UNKNOWN, 
+        /**
+         * User session expired; a login may be required.
+         */
+        EXPIRED, 
+        /**
+         * The user does not have the rights to perform this action.
+         */
+        FORBIDDEN, 
+        /**
+         * Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints.  This information may be accessible through alternate processes.
+         */
+        SUPPRESSED, 
+        /**
+         * Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged.
+         */
+        PROCESSING, 
+        /**
+         * The resource or profile is not supported.
+         */
+        NOTSUPPORTED, 
+        /**
+         * An attempt was made to create a duplicate record.
+         */
+        DUPLICATE, 
+        /**
+         * The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture.
+         */
+        NOTFOUND, 
+        /**
+         * Provided content is too long (typically, this is a denial of service protection type of error).
+         */
+        TOOLONG, 
+        /**
+         * The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code.
+         */
+        CODEINVALID, 
+        /**
+         * An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized.
+         */
+        EXTENSION, 
+        /**
+         * The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT.
+         */
+        TOOCOSTLY, 
+        /**
+         * The content/operation failed to pass some business rule, and so could not proceed.
+         */
+        BUSINESSRULE, 
+        /**
+         * Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.)
+         */
+        CONFLICT, 
+        /**
+         * Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete.
+         */
+        INCOMPLETE, 
+        /**
+         * Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved.
+         */
+        TRANSIENT, 
+        /**
+         * A resource/record locking failure (usually in an underlying database).
+         */
+        LOCKERROR, 
+        /**
+         * The persistent store is unavailable; e.g. the database is down for maintenance or similar action.
+         */
+        NOSTORE, 
+        /**
+         * An unexpected internal error has occurred.
+         */
+        EXCEPTION, 
+        /**
+         * An internal timeout has occurred.
+         */
+        TIMEOUT, 
+        /**
+         * The system is not prepared to handle this request due to load management.
+         */
+        THROTTLED, 
+        /**
+         * A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.).
+         */
+        INFORMATIONAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static IssueType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("invalid".equals(codeString))
+          return INVALID;
+        if ("structure".equals(codeString))
+          return STRUCTURE;
+        if ("required".equals(codeString))
+          return REQUIRED;
+        if ("value".equals(codeString))
+          return VALUE;
+        if ("invariant".equals(codeString))
+          return INVARIANT;
+        if ("security".equals(codeString))
+          return SECURITY;
+        if ("login".equals(codeString))
+          return LOGIN;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        if ("expired".equals(codeString))
+          return EXPIRED;
+        if ("forbidden".equals(codeString))
+          return FORBIDDEN;
+        if ("suppressed".equals(codeString))
+          return SUPPRESSED;
+        if ("processing".equals(codeString))
+          return PROCESSING;
+        if ("not-supported".equals(codeString))
+          return NOTSUPPORTED;
+        if ("duplicate".equals(codeString))
+          return DUPLICATE;
+        if ("not-found".equals(codeString))
+          return NOTFOUND;
+        if ("too-long".equals(codeString))
+          return TOOLONG;
+        if ("code-invalid".equals(codeString))
+          return CODEINVALID;
+        if ("extension".equals(codeString))
+          return EXTENSION;
+        if ("too-costly".equals(codeString))
+          return TOOCOSTLY;
+        if ("business-rule".equals(codeString))
+          return BUSINESSRULE;
+        if ("conflict".equals(codeString))
+          return CONFLICT;
+        if ("incomplete".equals(codeString))
+          return INCOMPLETE;
+        if ("transient".equals(codeString))
+          return TRANSIENT;
+        if ("lock-error".equals(codeString))
+          return LOCKERROR;
+        if ("no-store".equals(codeString))
+          return NOSTORE;
+        if ("exception".equals(codeString))
+          return EXCEPTION;
+        if ("timeout".equals(codeString))
+          return TIMEOUT;
+        if ("throttled".equals(codeString))
+          return THROTTLED;
+        if ("informational".equals(codeString))
+          return INFORMATIONAL;
+        throw new FHIRException("Unknown IssueType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INVALID: return "invalid";
+            case STRUCTURE: return "structure";
+            case REQUIRED: return "required";
+            case VALUE: return "value";
+            case INVARIANT: return "invariant";
+            case SECURITY: return "security";
+            case LOGIN: return "login";
+            case UNKNOWN: return "unknown";
+            case EXPIRED: return "expired";
+            case FORBIDDEN: return "forbidden";
+            case SUPPRESSED: return "suppressed";
+            case PROCESSING: return "processing";
+            case NOTSUPPORTED: return "not-supported";
+            case DUPLICATE: return "duplicate";
+            case NOTFOUND: return "not-found";
+            case TOOLONG: return "too-long";
+            case CODEINVALID: return "code-invalid";
+            case EXTENSION: return "extension";
+            case TOOCOSTLY: return "too-costly";
+            case BUSINESSRULE: return "business-rule";
+            case CONFLICT: return "conflict";
+            case INCOMPLETE: return "incomplete";
+            case TRANSIENT: return "transient";
+            case LOCKERROR: return "lock-error";
+            case NOSTORE: return "no-store";
+            case EXCEPTION: return "exception";
+            case TIMEOUT: return "timeout";
+            case THROTTLED: return "throttled";
+            case INFORMATIONAL: return "informational";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/issue-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INVALID: return "Content invalid against the specification or a profile.";
+            case STRUCTURE: return "A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax.";
+            case REQUIRED: return "A required element is missing.";
+            case VALUE: return "An element value is invalid.";
+            case INVARIANT: return "A content validation rule failed - e.g. a schematron rule.";
+            case SECURITY: return "An authentication/authorization/permissions issue of some kind.";
+            case LOGIN: return "The client needs to initiate an authentication process.";
+            case UNKNOWN: return "The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable).";
+            case EXPIRED: return "User session expired; a login may be required.";
+            case FORBIDDEN: return "The user does not have the rights to perform this action.";
+            case SUPPRESSED: return "Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints.  This information may be accessible through alternate processes.";
+            case PROCESSING: return "Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged.";
+            case NOTSUPPORTED: return "The resource or profile is not supported.";
+            case DUPLICATE: return "An attempt was made to create a duplicate record.";
+            case NOTFOUND: return "The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture.";
+            case TOOLONG: return "Provided content is too long (typically, this is a denial of service protection type of error).";
+            case CODEINVALID: return "The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code.";
+            case EXTENSION: return "An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized.";
+            case TOOCOSTLY: return "The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT.";
+            case BUSINESSRULE: return "The content/operation failed to pass some business rule, and so could not proceed.";
+            case CONFLICT: return "Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.)";
+            case INCOMPLETE: return "Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete.";
+            case TRANSIENT: return "Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved.";
+            case LOCKERROR: return "A resource/record locking failure (usually in an underlying database).";
+            case NOSTORE: return "The persistent store is unavailable; e.g. the database is down for maintenance or similar action.";
+            case EXCEPTION: return "An unexpected internal error has occurred.";
+            case TIMEOUT: return "An internal timeout has occurred.";
+            case THROTTLED: return "The system is not prepared to handle this request due to load management.";
+            case INFORMATIONAL: return "A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INVALID: return "Invalid Content";
+            case STRUCTURE: return "Structural Issue";
+            case REQUIRED: return "Required element missing";
+            case VALUE: return "Element value invalid";
+            case INVARIANT: return "Validation rule failed";
+            case SECURITY: return "Security Problem";
+            case LOGIN: return "Login Required";
+            case UNKNOWN: return "Unknown User";
+            case EXPIRED: return "Session Expired";
+            case FORBIDDEN: return "Forbidden";
+            case SUPPRESSED: return "Information  Suppressed";
+            case PROCESSING: return "Processing Failure";
+            case NOTSUPPORTED: return "Content not supported";
+            case DUPLICATE: return "Duplicate";
+            case NOTFOUND: return "Not Found";
+            case TOOLONG: return "Content Too Long";
+            case CODEINVALID: return "Invalid Code";
+            case EXTENSION: return "Unacceptable Extension";
+            case TOOCOSTLY: return "Operation Too Costly";
+            case BUSINESSRULE: return "Business Rule Violation";
+            case CONFLICT: return "Edit Version Conflict";
+            case INCOMPLETE: return "Incomplete Results";
+            case TRANSIENT: return "Transient Issue";
+            case LOCKERROR: return "Lock Error";
+            case NOSTORE: return "No Store Available";
+            case EXCEPTION: return "Exception";
+            case TIMEOUT: return "Timeout";
+            case THROTTLED: return "Throttled";
+            case INFORMATIONAL: return "Informational Note";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueTypeEnumFactory.java
new file mode 100644
index 00000000000..f308fa966e1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/IssueTypeEnumFactory.java
@@ -0,0 +1,170 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class IssueTypeEnumFactory implements EnumFactory {
+
+  public IssueType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("invalid".equals(codeString))
+      return IssueType.INVALID;
+    if ("structure".equals(codeString))
+      return IssueType.STRUCTURE;
+    if ("required".equals(codeString))
+      return IssueType.REQUIRED;
+    if ("value".equals(codeString))
+      return IssueType.VALUE;
+    if ("invariant".equals(codeString))
+      return IssueType.INVARIANT;
+    if ("security".equals(codeString))
+      return IssueType.SECURITY;
+    if ("login".equals(codeString))
+      return IssueType.LOGIN;
+    if ("unknown".equals(codeString))
+      return IssueType.UNKNOWN;
+    if ("expired".equals(codeString))
+      return IssueType.EXPIRED;
+    if ("forbidden".equals(codeString))
+      return IssueType.FORBIDDEN;
+    if ("suppressed".equals(codeString))
+      return IssueType.SUPPRESSED;
+    if ("processing".equals(codeString))
+      return IssueType.PROCESSING;
+    if ("not-supported".equals(codeString))
+      return IssueType.NOTSUPPORTED;
+    if ("duplicate".equals(codeString))
+      return IssueType.DUPLICATE;
+    if ("not-found".equals(codeString))
+      return IssueType.NOTFOUND;
+    if ("too-long".equals(codeString))
+      return IssueType.TOOLONG;
+    if ("code-invalid".equals(codeString))
+      return IssueType.CODEINVALID;
+    if ("extension".equals(codeString))
+      return IssueType.EXTENSION;
+    if ("too-costly".equals(codeString))
+      return IssueType.TOOCOSTLY;
+    if ("business-rule".equals(codeString))
+      return IssueType.BUSINESSRULE;
+    if ("conflict".equals(codeString))
+      return IssueType.CONFLICT;
+    if ("incomplete".equals(codeString))
+      return IssueType.INCOMPLETE;
+    if ("transient".equals(codeString))
+      return IssueType.TRANSIENT;
+    if ("lock-error".equals(codeString))
+      return IssueType.LOCKERROR;
+    if ("no-store".equals(codeString))
+      return IssueType.NOSTORE;
+    if ("exception".equals(codeString))
+      return IssueType.EXCEPTION;
+    if ("timeout".equals(codeString))
+      return IssueType.TIMEOUT;
+    if ("throttled".equals(codeString))
+      return IssueType.THROTTLED;
+    if ("informational".equals(codeString))
+      return IssueType.INFORMATIONAL;
+    throw new IllegalArgumentException("Unknown IssueType code '"+codeString+"'");
+  }
+
+  public String toCode(IssueType code) {
+    if (code == IssueType.INVALID)
+      return "invalid";
+    if (code == IssueType.STRUCTURE)
+      return "structure";
+    if (code == IssueType.REQUIRED)
+      return "required";
+    if (code == IssueType.VALUE)
+      return "value";
+    if (code == IssueType.INVARIANT)
+      return "invariant";
+    if (code == IssueType.SECURITY)
+      return "security";
+    if (code == IssueType.LOGIN)
+      return "login";
+    if (code == IssueType.UNKNOWN)
+      return "unknown";
+    if (code == IssueType.EXPIRED)
+      return "expired";
+    if (code == IssueType.FORBIDDEN)
+      return "forbidden";
+    if (code == IssueType.SUPPRESSED)
+      return "suppressed";
+    if (code == IssueType.PROCESSING)
+      return "processing";
+    if (code == IssueType.NOTSUPPORTED)
+      return "not-supported";
+    if (code == IssueType.DUPLICATE)
+      return "duplicate";
+    if (code == IssueType.NOTFOUND)
+      return "not-found";
+    if (code == IssueType.TOOLONG)
+      return "too-long";
+    if (code == IssueType.CODEINVALID)
+      return "code-invalid";
+    if (code == IssueType.EXTENSION)
+      return "extension";
+    if (code == IssueType.TOOCOSTLY)
+      return "too-costly";
+    if (code == IssueType.BUSINESSRULE)
+      return "business-rule";
+    if (code == IssueType.CONFLICT)
+      return "conflict";
+    if (code == IssueType.INCOMPLETE)
+      return "incomplete";
+    if (code == IssueType.TRANSIENT)
+      return "transient";
+    if (code == IssueType.LOCKERROR)
+      return "lock-error";
+    if (code == IssueType.NOSTORE)
+      return "no-store";
+    if (code == IssueType.EXCEPTION)
+      return "exception";
+    if (code == IssueType.TIMEOUT)
+      return "timeout";
+    if (code == IssueType.THROTTLED)
+      return "throttled";
+    if (code == IssueType.INFORMATIONAL)
+      return "informational";
+    return "?";
+  }
+
+    public String toSystem(IssueType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ItemType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ItemType.java
new file mode 100644
index 00000000000..555cd06f334
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ItemType.java
@@ -0,0 +1,224 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ItemType {
+
+        /**
+         * An item with no direct answer but should have at least one child item.
+         */
+        GROUP, 
+        /**
+         * Text for display that will not capture an answer or have child items.
+         */
+        DISPLAY, 
+        /**
+         * An item that defines a specific answer to be captured, and may have child items.
+(the answer provided in the QuestionnaireResponse should be of the defined datatype)
+         */
+        QUESTION, 
+        /**
+         * Question with a yes/no answer (valueBoolean)
+         */
+        BOOLEAN, 
+        /**
+         * Question with is a real number answer (valueDecimal)
+         */
+        DECIMAL, 
+        /**
+         * Question with an integer answer (valueInteger)
+         */
+        INTEGER, 
+        /**
+         * Question with a date answer (valueDate)
+         */
+        DATE, 
+        /**
+         * Question with a date and time answer (valueDateTime)
+         */
+        DATETIME, 
+        /**
+         * Question with a time (hour:minute:second) answer independent of date. (valueTime)
+         */
+        TIME, 
+        /**
+         * Question with a short (few words to short sentence) free-text entry answer (valueString)
+         */
+        STRING, 
+        /**
+         * Question with a long (potentially multi-paragraph) free-text entry answer (valueString)
+         */
+        TEXT, 
+        /**
+         * Question with a URL (website, FTP site, etc.) answer (valueUri)
+         */
+        URL, 
+        /**
+         * Question with a Coding drawn from a list of options (specified in either the option property, or via the valueset referenced in the options property) as an answer (valueCoding)
+         */
+        CHOICE, 
+        /**
+         * Answer is a Coding drawn from a list of options (as with the choice type) or a free-text entry in a string (valueCoding or valueString)
+         */
+        OPENCHOICE, 
+        /**
+         * Question with binary content such as a image, PDF, etc. as an answer (valueAttachment)
+         */
+        ATTACHMENT, 
+        /**
+         * Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference)
+         */
+        REFERENCE, 
+        /**
+         * Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity)
+There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit whould be captured (or the a unit that has a ucum conversion from the provided unit)
+         */
+        QUANTITY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ItemType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("group".equals(codeString))
+          return GROUP;
+        if ("display".equals(codeString))
+          return DISPLAY;
+        if ("question".equals(codeString))
+          return QUESTION;
+        if ("boolean".equals(codeString))
+          return BOOLEAN;
+        if ("decimal".equals(codeString))
+          return DECIMAL;
+        if ("integer".equals(codeString))
+          return INTEGER;
+        if ("date".equals(codeString))
+          return DATE;
+        if ("dateTime".equals(codeString))
+          return DATETIME;
+        if ("time".equals(codeString))
+          return TIME;
+        if ("string".equals(codeString))
+          return STRING;
+        if ("text".equals(codeString))
+          return TEXT;
+        if ("url".equals(codeString))
+          return URL;
+        if ("choice".equals(codeString))
+          return CHOICE;
+        if ("open-choice".equals(codeString))
+          return OPENCHOICE;
+        if ("attachment".equals(codeString))
+          return ATTACHMENT;
+        if ("reference".equals(codeString))
+          return REFERENCE;
+        if ("quantity".equals(codeString))
+          return QUANTITY;
+        throw new FHIRException("Unknown ItemType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GROUP: return "group";
+            case DISPLAY: return "display";
+            case QUESTION: return "question";
+            case BOOLEAN: return "boolean";
+            case DECIMAL: return "decimal";
+            case INTEGER: return "integer";
+            case DATE: return "date";
+            case DATETIME: return "dateTime";
+            case TIME: return "time";
+            case STRING: return "string";
+            case TEXT: return "text";
+            case URL: return "url";
+            case CHOICE: return "choice";
+            case OPENCHOICE: return "open-choice";
+            case ATTACHMENT: return "attachment";
+            case REFERENCE: return "reference";
+            case QUANTITY: return "quantity";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/item-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GROUP: return "An item with no direct answer but should have at least one child item.";
+            case DISPLAY: return "Text for display that will not capture an answer or have child items.";
+            case QUESTION: return "An item that defines a specific answer to be captured, and may have child items.\n(the answer provided in the QuestionnaireResponse should be of the defined datatype)";
+            case BOOLEAN: return "Question with a yes/no answer (valueBoolean)";
+            case DECIMAL: return "Question with is a real number answer (valueDecimal)";
+            case INTEGER: return "Question with an integer answer (valueInteger)";
+            case DATE: return "Question with a date answer (valueDate)";
+            case DATETIME: return "Question with a date and time answer (valueDateTime)";
+            case TIME: return "Question with a time (hour:minute:second) answer independent of date. (valueTime)";
+            case STRING: return "Question with a short (few words to short sentence) free-text entry answer (valueString)";
+            case TEXT: return "Question with a long (potentially multi-paragraph) free-text entry answer (valueString)";
+            case URL: return "Question with a URL (website, FTP site, etc.) answer (valueUri)";
+            case CHOICE: return "Question with a Coding drawn from a list of options (specified in either the option property, or via the valueset referenced in the options property) as an answer (valueCoding)";
+            case OPENCHOICE: return "Answer is a Coding drawn from a list of options (as with the choice type) or a free-text entry in a string (valueCoding or valueString)";
+            case ATTACHMENT: return "Question with binary content such as a image, PDF, etc. as an answer (valueAttachment)";
+            case REFERENCE: return "Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference)";
+            case QUANTITY: return "Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity)\nThere is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit whould be captured (or the a unit that has a ucum conversion from the provided unit)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GROUP: return "Group";
+            case DISPLAY: return "Display";
+            case QUESTION: return "Question";
+            case BOOLEAN: return "Boolean";
+            case DECIMAL: return "Decimal";
+            case INTEGER: return "Integer";
+            case DATE: return "Date";
+            case DATETIME: return "Date Time";
+            case TIME: return "Time";
+            case STRING: return "String";
+            case TEXT: return "Text";
+            case URL: return "Url";
+            case CHOICE: return "Choice";
+            case OPENCHOICE: return "Open Choice";
+            case ATTACHMENT: return "Attachment";
+            case REFERENCE: return "Reference";
+            case QUANTITY: return "Quantity";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ItemTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ItemTypeEnumFactory.java
new file mode 100644
index 00000000000..92535829ba7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ItemTypeEnumFactory.java
@@ -0,0 +1,122 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ItemTypeEnumFactory implements EnumFactory {
+
+  public ItemType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("group".equals(codeString))
+      return ItemType.GROUP;
+    if ("display".equals(codeString))
+      return ItemType.DISPLAY;
+    if ("question".equals(codeString))
+      return ItemType.QUESTION;
+    if ("boolean".equals(codeString))
+      return ItemType.BOOLEAN;
+    if ("decimal".equals(codeString))
+      return ItemType.DECIMAL;
+    if ("integer".equals(codeString))
+      return ItemType.INTEGER;
+    if ("date".equals(codeString))
+      return ItemType.DATE;
+    if ("dateTime".equals(codeString))
+      return ItemType.DATETIME;
+    if ("time".equals(codeString))
+      return ItemType.TIME;
+    if ("string".equals(codeString))
+      return ItemType.STRING;
+    if ("text".equals(codeString))
+      return ItemType.TEXT;
+    if ("url".equals(codeString))
+      return ItemType.URL;
+    if ("choice".equals(codeString))
+      return ItemType.CHOICE;
+    if ("open-choice".equals(codeString))
+      return ItemType.OPENCHOICE;
+    if ("attachment".equals(codeString))
+      return ItemType.ATTACHMENT;
+    if ("reference".equals(codeString))
+      return ItemType.REFERENCE;
+    if ("quantity".equals(codeString))
+      return ItemType.QUANTITY;
+    throw new IllegalArgumentException("Unknown ItemType code '"+codeString+"'");
+  }
+
+  public String toCode(ItemType code) {
+    if (code == ItemType.GROUP)
+      return "group";
+    if (code == ItemType.DISPLAY)
+      return "display";
+    if (code == ItemType.QUESTION)
+      return "question";
+    if (code == ItemType.BOOLEAN)
+      return "boolean";
+    if (code == ItemType.DECIMAL)
+      return "decimal";
+    if (code == ItemType.INTEGER)
+      return "integer";
+    if (code == ItemType.DATE)
+      return "date";
+    if (code == ItemType.DATETIME)
+      return "dateTime";
+    if (code == ItemType.TIME)
+      return "time";
+    if (code == ItemType.STRING)
+      return "string";
+    if (code == ItemType.TEXT)
+      return "text";
+    if (code == ItemType.URL)
+      return "url";
+    if (code == ItemType.CHOICE)
+      return "choice";
+    if (code == ItemType.OPENCHOICE)
+      return "open-choice";
+    if (code == ItemType.ATTACHMENT)
+      return "attachment";
+    if (code == ItemType.REFERENCE)
+      return "reference";
+    if (code == ItemType.QUANTITY)
+      return "quantity";
+    return "?";
+  }
+
+    public String toSystem(ItemType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480020Answerlist.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480020Answerlist.java
new file mode 100644
index 00000000000..7ba8268c01f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480020Answerlist.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum LOINC480020Answerlist {
+
+        /**
+         * Germline
+         */
+        LA66832, 
+        /**
+         * Somatic
+         */
+        LA66840, 
+        /**
+         * Prenatal
+         */
+        LA104291, 
+        /**
+         * Likely Germline
+         */
+        LA181943, 
+        /**
+         * Likely Somatic
+         */
+        LA181950, 
+        /**
+         * Likely Prenatal
+         */
+        LA181968, 
+        /**
+         * Unknown Genomic Origin
+         */
+        LA181976, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static LOINC480020Answerlist fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("LA6683-2".equals(codeString))
+          return LA66832;
+        if ("LA6684-0".equals(codeString))
+          return LA66840;
+        if ("LA10429-1".equals(codeString))
+          return LA104291;
+        if ("LA18194-3".equals(codeString))
+          return LA181943;
+        if ("LA18195-0".equals(codeString))
+          return LA181950;
+        if ("LA18196-8".equals(codeString))
+          return LA181968;
+        if ("LA18197-6".equals(codeString))
+          return LA181976;
+        throw new FHIRException("Unknown LOINC480020Answerlist code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LA66832: return "LA6683-2";
+            case LA66840: return "LA6684-0";
+            case LA104291: return "LA10429-1";
+            case LA181943: return "LA18194-3";
+            case LA181950: return "LA18195-0";
+            case LA181968: return "LA18196-8";
+            case LA181976: return "LA18197-6";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/LOINC-48002-0-answerlist";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LA66832: return "Germline";
+            case LA66840: return "Somatic";
+            case LA104291: return "Prenatal";
+            case LA181943: return "Likely Germline";
+            case LA181950: return "Likely Somatic";
+            case LA181968: return "Likely Prenatal";
+            case LA181976: return "Unknown Genomic Origin";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LA66832: return "Germline";
+            case LA66840: return "Somatic";
+            case LA104291: return "Prenatal";
+            case LA181943: return "Likely Germline";
+            case LA181950: return "Likely Somatic";
+            case LA181968: return "Likely Prenatal";
+            case LA181976: return "Unknown Genomic Origin";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480020AnswerlistEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480020AnswerlistEnumFactory.java
new file mode 100644
index 00000000000..267a1009ec3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480020AnswerlistEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class LOINC480020AnswerlistEnumFactory implements EnumFactory {
+
+  public LOINC480020Answerlist fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("LA6683-2".equals(codeString))
+      return LOINC480020Answerlist.LA66832;
+    if ("LA6684-0".equals(codeString))
+      return LOINC480020Answerlist.LA66840;
+    if ("LA10429-1".equals(codeString))
+      return LOINC480020Answerlist.LA104291;
+    if ("LA18194-3".equals(codeString))
+      return LOINC480020Answerlist.LA181943;
+    if ("LA18195-0".equals(codeString))
+      return LOINC480020Answerlist.LA181950;
+    if ("LA18196-8".equals(codeString))
+      return LOINC480020Answerlist.LA181968;
+    if ("LA18197-6".equals(codeString))
+      return LOINC480020Answerlist.LA181976;
+    throw new IllegalArgumentException("Unknown LOINC480020Answerlist code '"+codeString+"'");
+  }
+
+  public String toCode(LOINC480020Answerlist code) {
+    if (code == LOINC480020Answerlist.LA66832)
+      return "LA6683-2";
+    if (code == LOINC480020Answerlist.LA66840)
+      return "LA6684-0";
+    if (code == LOINC480020Answerlist.LA104291)
+      return "LA10429-1";
+    if (code == LOINC480020Answerlist.LA181943)
+      return "LA18194-3";
+    if (code == LOINC480020Answerlist.LA181950)
+      return "LA18195-0";
+    if (code == LOINC480020Answerlist.LA181968)
+      return "LA18196-8";
+    if (code == LOINC480020Answerlist.LA181976)
+      return "LA18197-6";
+    return "?";
+  }
+
+    public String toSystem(LOINC480020Answerlist code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480194Answerlist.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480194Answerlist.java
new file mode 100644
index 00000000000..09866fe1781
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480194Answerlist.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum LOINC480194Answerlist {
+
+        /**
+         * Wild type
+         */
+        LA96581, 
+        /**
+         * Deletion
+         */
+        LA66923, 
+        /**
+         * Duplication
+         */
+        LA66865, 
+        /**
+         * Insertion
+         */
+        LA66873, 
+        /**
+         * Insertion/Deletion
+         */
+        LA66881, 
+        /**
+         * Inversion
+         */
+        LA66899, 
+        /**
+         * Substitution
+         */
+        LA66907, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static LOINC480194Answerlist fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("LA9658-1".equals(codeString))
+          return LA96581;
+        if ("LA6692-3".equals(codeString))
+          return LA66923;
+        if ("LA6686-5".equals(codeString))
+          return LA66865;
+        if ("LA6687-3".equals(codeString))
+          return LA66873;
+        if ("LA6688-1".equals(codeString))
+          return LA66881;
+        if ("LA6689-9".equals(codeString))
+          return LA66899;
+        if ("LA6690-7".equals(codeString))
+          return LA66907;
+        throw new FHIRException("Unknown LOINC480194Answerlist code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LA96581: return "LA9658-1";
+            case LA66923: return "LA6692-3";
+            case LA66865: return "LA6686-5";
+            case LA66873: return "LA6687-3";
+            case LA66881: return "LA6688-1";
+            case LA66899: return "LA6689-9";
+            case LA66907: return "LA6690-7";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/LOINC-48019-4-answerlist";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LA96581: return "Wild type";
+            case LA66923: return "Deletion";
+            case LA66865: return "Duplication";
+            case LA66873: return "Insertion";
+            case LA66881: return "Insertion/Deletion";
+            case LA66899: return "Inversion";
+            case LA66907: return "Substitution";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LA96581: return "Wild type";
+            case LA66923: return "Deletion";
+            case LA66865: return "Duplication";
+            case LA66873: return "Insertion";
+            case LA66881: return "Insertion/Deletion";
+            case LA66899: return "Inversion";
+            case LA66907: return "Substitution";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480194AnswerlistEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480194AnswerlistEnumFactory.java
new file mode 100644
index 00000000000..f244ee7bcad
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC480194AnswerlistEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class LOINC480194AnswerlistEnumFactory implements EnumFactory {
+
+  public LOINC480194Answerlist fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("LA9658-1".equals(codeString))
+      return LOINC480194Answerlist.LA96581;
+    if ("LA6692-3".equals(codeString))
+      return LOINC480194Answerlist.LA66923;
+    if ("LA6686-5".equals(codeString))
+      return LOINC480194Answerlist.LA66865;
+    if ("LA6687-3".equals(codeString))
+      return LOINC480194Answerlist.LA66873;
+    if ("LA6688-1".equals(codeString))
+      return LOINC480194Answerlist.LA66881;
+    if ("LA6689-9".equals(codeString))
+      return LOINC480194Answerlist.LA66899;
+    if ("LA6690-7".equals(codeString))
+      return LOINC480194Answerlist.LA66907;
+    throw new IllegalArgumentException("Unknown LOINC480194Answerlist code '"+codeString+"'");
+  }
+
+  public String toCode(LOINC480194Answerlist code) {
+    if (code == LOINC480194Answerlist.LA96581)
+      return "LA9658-1";
+    if (code == LOINC480194Answerlist.LA66923)
+      return "LA6692-3";
+    if (code == LOINC480194Answerlist.LA66865)
+      return "LA6686-5";
+    if (code == LOINC480194Answerlist.LA66873)
+      return "LA6687-3";
+    if (code == LOINC480194Answerlist.LA66881)
+      return "LA6688-1";
+    if (code == LOINC480194Answerlist.LA66899)
+      return "LA6689-9";
+    if (code == LOINC480194Answerlist.LA66907)
+      return "LA6690-7";
+    return "?";
+  }
+
+    public String toSystem(LOINC480194Answerlist code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC530345Answerlist.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC530345Answerlist.java
new file mode 100644
index 00000000000..b76b8957511
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC530345Answerlist.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum LOINC530345Answerlist {
+
+        /**
+         * Heteroplasmic
+         */
+        LA67038, 
+        /**
+         * Homoplasmic
+         */
+        LA67046, 
+        /**
+         * Homozygous
+         */
+        LA67053, 
+        /**
+         * Heterozygous
+         */
+        LA67061, 
+        /**
+         * Hemizygous
+         */
+        LA67079, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static LOINC530345Answerlist fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("LA6703-8".equals(codeString))
+          return LA67038;
+        if ("LA6704-6".equals(codeString))
+          return LA67046;
+        if ("LA6705-3".equals(codeString))
+          return LA67053;
+        if ("LA6706-1".equals(codeString))
+          return LA67061;
+        if ("LA6707-9".equals(codeString))
+          return LA67079;
+        throw new FHIRException("Unknown LOINC530345Answerlist code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LA67038: return "LA6703-8";
+            case LA67046: return "LA6704-6";
+            case LA67053: return "LA6705-3";
+            case LA67061: return "LA6706-1";
+            case LA67079: return "LA6707-9";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/LOINC-53034-5-answerlist";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LA67038: return "Heteroplasmic";
+            case LA67046: return "Homoplasmic";
+            case LA67053: return "Homozygous";
+            case LA67061: return "Heterozygous";
+            case LA67079: return "Hemizygous";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LA67038: return "Heteroplasmic";
+            case LA67046: return "Homoplasmic";
+            case LA67053: return "Homozygous";
+            case LA67061: return "Heterozygous";
+            case LA67079: return "Hemizygous";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC530345AnswerlistEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC530345AnswerlistEnumFactory.java
new file mode 100644
index 00000000000..5e76e27f665
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LOINC530345AnswerlistEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class LOINC530345AnswerlistEnumFactory implements EnumFactory {
+
+  public LOINC530345Answerlist fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("LA6703-8".equals(codeString))
+      return LOINC530345Answerlist.LA67038;
+    if ("LA6704-6".equals(codeString))
+      return LOINC530345Answerlist.LA67046;
+    if ("LA6705-3".equals(codeString))
+      return LOINC530345Answerlist.LA67053;
+    if ("LA6706-1".equals(codeString))
+      return LOINC530345Answerlist.LA67061;
+    if ("LA6707-9".equals(codeString))
+      return LOINC530345Answerlist.LA67079;
+    throw new IllegalArgumentException("Unknown LOINC530345Answerlist code '"+codeString+"'");
+  }
+
+  public String toCode(LOINC530345Answerlist code) {
+    if (code == LOINC530345Answerlist.LA67038)
+      return "LA6703-8";
+    if (code == LOINC530345Answerlist.LA67046)
+      return "LA6704-6";
+    if (code == LOINC530345Answerlist.LA67053)
+      return "LA6705-3";
+    if (code == LOINC530345Answerlist.LA67061)
+      return "LA6706-1";
+    if (code == LOINC530345Answerlist.LA67079)
+      return "LA6707-9";
+    return "?";
+  }
+
+    public String toSystem(LOINC530345Answerlist code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LibraryType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LibraryType.java
new file mode 100644
index 00000000000..730743d26ed
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LibraryType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum LibraryType {
+
+        /**
+         * The resource is a shareable library of formalized knowledge
+         */
+        LOGICLIBRARY, 
+        /**
+         * The resource is a definition of an information model
+         */
+        MODELDEFINITION, 
+        /**
+         * The resource is a collection of knowledge assets
+         */
+        ASSETCOLLECTION, 
+        /**
+         * The resource defines the dependencies, parameters, and data requirements for a particular module or evaluation context
+         */
+        MODULEDEFINITION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static LibraryType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("logic-library".equals(codeString))
+          return LOGICLIBRARY;
+        if ("model-definition".equals(codeString))
+          return MODELDEFINITION;
+        if ("asset-collection".equals(codeString))
+          return ASSETCOLLECTION;
+        if ("module-definition".equals(codeString))
+          return MODULEDEFINITION;
+        throw new FHIRException("Unknown LibraryType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LOGICLIBRARY: return "logic-library";
+            case MODELDEFINITION: return "model-definition";
+            case ASSETCOLLECTION: return "asset-collection";
+            case MODULEDEFINITION: return "module-definition";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/library-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LOGICLIBRARY: return "The resource is a shareable library of formalized knowledge";
+            case MODELDEFINITION: return "The resource is a definition of an information model";
+            case ASSETCOLLECTION: return "The resource is a collection of knowledge assets";
+            case MODULEDEFINITION: return "The resource defines the dependencies, parameters, and data requirements for a particular module or evaluation context";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LOGICLIBRARY: return "Logic Library";
+            case MODELDEFINITION: return "Model Definition";
+            case ASSETCOLLECTION: return "Asset Collection";
+            case MODULEDEFINITION: return "Module Definition";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LibraryTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LibraryTypeEnumFactory.java
new file mode 100644
index 00000000000..ff845b9e6a6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LibraryTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class LibraryTypeEnumFactory implements EnumFactory {
+
+  public LibraryType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("logic-library".equals(codeString))
+      return LibraryType.LOGICLIBRARY;
+    if ("model-definition".equals(codeString))
+      return LibraryType.MODELDEFINITION;
+    if ("asset-collection".equals(codeString))
+      return LibraryType.ASSETCOLLECTION;
+    if ("module-definition".equals(codeString))
+      return LibraryType.MODULEDEFINITION;
+    throw new IllegalArgumentException("Unknown LibraryType code '"+codeString+"'");
+  }
+
+  public String toCode(LibraryType code) {
+    if (code == LibraryType.LOGICLIBRARY)
+      return "logic-library";
+    if (code == LibraryType.MODELDEFINITION)
+      return "model-definition";
+    if (code == LibraryType.ASSETCOLLECTION)
+      return "asset-collection";
+    if (code == LibraryType.MODULEDEFINITION)
+      return "module-definition";
+    return "?";
+  }
+
+    public String toSystem(LibraryType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkType.java
new file mode 100644
index 00000000000..b9c64cea7cf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum LinkType {
+
+        /**
+         * The patient resource containing this link must no longer be used. The link points forward to another patient resource that must be used in lieu of the patient resource that contains this link.
+         */
+        REPLACEDBY, 
+        /**
+         * The patient resource containing this link is the current active patient record. The link points back to an inactive patient resource that has been merged into this resource, and should be consulted to retrieve additional referenced information.
+         */
+        REPLACES, 
+        /**
+         * The patient resource containing this link is in use and valid but not considered the main source of information about a patient. The link points forward to another patient resource that should be consulted to retrieve additional patient information.
+         */
+        REFER, 
+        /**
+         * The patient resource containing this link is in use and valid, but points to another patient resource that is known to contain data about the same person. Data in this resource might overlap or contradict information found in the other patient resource. This link does not indicate any relative importance of the resources concerned, and both should be regarded as equally valid.
+         */
+        SEEALSO, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static LinkType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("replaced-by".equals(codeString))
+          return REPLACEDBY;
+        if ("replaces".equals(codeString))
+          return REPLACES;
+        if ("refer".equals(codeString))
+          return REFER;
+        if ("seealso".equals(codeString))
+          return SEEALSO;
+        throw new FHIRException("Unknown LinkType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REPLACEDBY: return "replaced-by";
+            case REPLACES: return "replaces";
+            case REFER: return "refer";
+            case SEEALSO: return "seealso";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/link-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REPLACEDBY: return "The patient resource containing this link must no longer be used. The link points forward to another patient resource that must be used in lieu of the patient resource that contains this link.";
+            case REPLACES: return "The patient resource containing this link is the current active patient record. The link points back to an inactive patient resource that has been merged into this resource, and should be consulted to retrieve additional referenced information.";
+            case REFER: return "The patient resource containing this link is in use and valid but not considered the main source of information about a patient. The link points forward to another patient resource that should be consulted to retrieve additional patient information.";
+            case SEEALSO: return "The patient resource containing this link is in use and valid, but points to another patient resource that is known to contain data about the same person. Data in this resource might overlap or contradict information found in the other patient resource. This link does not indicate any relative importance of the resources concerned, and both should be regarded as equally valid.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REPLACEDBY: return "Replaced-by";
+            case REPLACES: return "Replaces";
+            case REFER: return "Refer";
+            case SEEALSO: return "See also";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkTypeEnumFactory.java
new file mode 100644
index 00000000000..a967d79a0f0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class LinkTypeEnumFactory implements EnumFactory {
+
+  public LinkType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("replaced-by".equals(codeString))
+      return LinkType.REPLACEDBY;
+    if ("replaces".equals(codeString))
+      return LinkType.REPLACES;
+    if ("refer".equals(codeString))
+      return LinkType.REFER;
+    if ("seealso".equals(codeString))
+      return LinkType.SEEALSO;
+    throw new IllegalArgumentException("Unknown LinkType code '"+codeString+"'");
+  }
+
+  public String toCode(LinkType code) {
+    if (code == LinkType.REPLACEDBY)
+      return "replaced-by";
+    if (code == LinkType.REPLACES)
+      return "replaces";
+    if (code == LinkType.REFER)
+      return "refer";
+    if (code == LinkType.SEEALSO)
+      return "seealso";
+    return "?";
+  }
+
+    public String toSystem(LinkType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkageType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkageType.java
new file mode 100644
index 00000000000..4d43bdafafd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkageType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum LinkageType {
+
+        /**
+         * The record represents the "source of truth" (from the perspective of this Linkage resource) for the underlying event/condition/etc.
+         */
+        SOURCE, 
+        /**
+         * The record represents the alternative view of the underlying event/condition/etc.  The record may still be actively maintained, even though it is not considered to be the source of truth.
+         */
+        ALTERNATE, 
+        /**
+         * The record represents an obsolete record of the underlyng event/condition/etc.  It is not expected to be actively maintained.
+         */
+        HISTORICAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static LinkageType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("source".equals(codeString))
+          return SOURCE;
+        if ("alternate".equals(codeString))
+          return ALTERNATE;
+        if ("historical".equals(codeString))
+          return HISTORICAL;
+        throw new FHIRException("Unknown LinkageType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SOURCE: return "source";
+            case ALTERNATE: return "alternate";
+            case HISTORICAL: return "historical";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/linkage-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SOURCE: return "The record represents the \"source of truth\" (from the perspective of this Linkage resource) for the underlying event/condition/etc.";
+            case ALTERNATE: return "The record represents the alternative view of the underlying event/condition/etc.  The record may still be actively maintained, even though it is not considered to be the source of truth.";
+            case HISTORICAL: return "The record represents an obsolete record of the underlyng event/condition/etc.  It is not expected to be actively maintained.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SOURCE: return "Source of truth";
+            case ALTERNATE: return "Alternate record";
+            case HISTORICAL: return "Historical/obsolete record";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkageTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkageTypeEnumFactory.java
new file mode 100644
index 00000000000..9cc6946bce9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LinkageTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class LinkageTypeEnumFactory implements EnumFactory {
+
+  public LinkageType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("source".equals(codeString))
+      return LinkageType.SOURCE;
+    if ("alternate".equals(codeString))
+      return LinkageType.ALTERNATE;
+    if ("historical".equals(codeString))
+      return LinkageType.HISTORICAL;
+    throw new IllegalArgumentException("Unknown LinkageType code '"+codeString+"'");
+  }
+
+  public String toCode(LinkageType code) {
+    if (code == LinkageType.SOURCE)
+      return "source";
+    if (code == LinkageType.ALTERNATE)
+      return "alternate";
+    if (code == LinkageType.HISTORICAL)
+      return "historical";
+    return "?";
+  }
+
+    public String toSystem(LinkageType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListEmptyReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListEmptyReason.java
new file mode 100644
index 00000000000..8e0bac6716c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListEmptyReason.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ListEmptyReason {
+
+        /**
+         * Clinical judgment that there are no known items for this list after reasonable investigation. Note that this a positive statement by a clinical user, and not a default position asserted by a computer system in the lack of other information. Example uses:  * For allergies: the patient or patient's agent/guardian has asserted that he/she is not aware of any allergies (NKA - nil known allergies)  * For medications: the patient or patient's agent/guardian has asserted that the patient is known to be taking no medications  * For diagnoses, problems and procedures: the patient or patient's agent/guardian has asserted that there is no known event to record.
+         */
+        NILKNOWN, 
+        /**
+         * The investigation to find out whether there are items for this list has not occurred.
+         */
+        NOTASKED, 
+        /**
+         * The content of the list was not provided due to privacy or confidentiality concerns. Note that it should not be assumed that this means that the particular information in question was withheld due to its contents - it can also be a policy decision.
+         */
+        WITHHELD, 
+        /**
+         * Information to populate this list cannot be obtained; e.g. unconscious patient.
+         */
+        UNAVAILABLE, 
+        /**
+         * The work to populate this list has not yet begun.
+         */
+        NOTSTARTED, 
+        /**
+         * This list has now closed or has ceased to be relevant or useful.
+         */
+        CLOSED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ListEmptyReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("nilknown".equals(codeString))
+          return NILKNOWN;
+        if ("notasked".equals(codeString))
+          return NOTASKED;
+        if ("withheld".equals(codeString))
+          return WITHHELD;
+        if ("unavailable".equals(codeString))
+          return UNAVAILABLE;
+        if ("notstarted".equals(codeString))
+          return NOTSTARTED;
+        if ("closed".equals(codeString))
+          return CLOSED;
+        throw new FHIRException("Unknown ListEmptyReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NILKNOWN: return "nilknown";
+            case NOTASKED: return "notasked";
+            case WITHHELD: return "withheld";
+            case UNAVAILABLE: return "unavailable";
+            case NOTSTARTED: return "notstarted";
+            case CLOSED: return "closed";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/list-empty-reason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NILKNOWN: return "Clinical judgment that there are no known items for this list after reasonable investigation. Note that this a positive statement by a clinical user, and not a default position asserted by a computer system in the lack of other information. Example uses:  * For allergies: the patient or patient's agent/guardian has asserted that he/she is not aware of any allergies (NKA - nil known allergies)  * For medications: the patient or patient's agent/guardian has asserted that the patient is known to be taking no medications  * For diagnoses, problems and procedures: the patient or patient's agent/guardian has asserted that there is no known event to record.";
+            case NOTASKED: return "The investigation to find out whether there are items for this list has not occurred.";
+            case WITHHELD: return "The content of the list was not provided due to privacy or confidentiality concerns. Note that it should not be assumed that this means that the particular information in question was withheld due to its contents - it can also be a policy decision.";
+            case UNAVAILABLE: return "Information to populate this list cannot be obtained; e.g. unconscious patient.";
+            case NOTSTARTED: return "The work to populate this list has not yet begun.";
+            case CLOSED: return "This list has now closed or has ceased to be relevant or useful.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NILKNOWN: return "Nil Known";
+            case NOTASKED: return "Not Asked";
+            case WITHHELD: return "Information Withheld";
+            case UNAVAILABLE: return "Unavailable";
+            case NOTSTARTED: return "Not Started";
+            case CLOSED: return "Closed";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListEmptyReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListEmptyReasonEnumFactory.java
new file mode 100644
index 00000000000..dc226bf4b69
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListEmptyReasonEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ListEmptyReasonEnumFactory implements EnumFactory {
+
+  public ListEmptyReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("nilknown".equals(codeString))
+      return ListEmptyReason.NILKNOWN;
+    if ("notasked".equals(codeString))
+      return ListEmptyReason.NOTASKED;
+    if ("withheld".equals(codeString))
+      return ListEmptyReason.WITHHELD;
+    if ("unavailable".equals(codeString))
+      return ListEmptyReason.UNAVAILABLE;
+    if ("notstarted".equals(codeString))
+      return ListEmptyReason.NOTSTARTED;
+    if ("closed".equals(codeString))
+      return ListEmptyReason.CLOSED;
+    throw new IllegalArgumentException("Unknown ListEmptyReason code '"+codeString+"'");
+  }
+
+  public String toCode(ListEmptyReason code) {
+    if (code == ListEmptyReason.NILKNOWN)
+      return "nilknown";
+    if (code == ListEmptyReason.NOTASKED)
+      return "notasked";
+    if (code == ListEmptyReason.WITHHELD)
+      return "withheld";
+    if (code == ListEmptyReason.UNAVAILABLE)
+      return "unavailable";
+    if (code == ListEmptyReason.NOTSTARTED)
+      return "notstarted";
+    if (code == ListEmptyReason.CLOSED)
+      return "closed";
+    return "?";
+  }
+
+    public String toSystem(ListEmptyReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListExampleCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListExampleCodes.java
new file mode 100644
index 00000000000..11f5882a445
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListExampleCodes.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ListExampleCodes {
+
+        /**
+         * A list of alerts for the patient.
+         */
+        ALERTS, 
+        /**
+         * A list of part adverse reactions.
+         */
+        ADVERSERXNS, 
+        /**
+         * A list of Allergies for the patient.
+         */
+        ALLERGIES, 
+        /**
+         * A list of medication statements for the patient.
+         */
+        MEDICATIONS, 
+        /**
+         * A list of problems that the patient is known of have (or have had in the past).
+         */
+        PROBLEMS, 
+        /**
+         * A list of items that constitute a set of work to be performed (typically this code would be specialized for more specific uses, such as a ward round list).
+         */
+        WORKLIST, 
+        /**
+         * A list of items waiting for an event (perhaps a surgical patient waiting list).
+         */
+        WAITING, 
+        /**
+         * A set of protocols to be followed.
+         */
+        PROTOCOLS, 
+        /**
+         * A set of care plans that apply in a particular context of care.
+         */
+        PLANS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ListExampleCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("alerts".equals(codeString))
+          return ALERTS;
+        if ("adverserxns".equals(codeString))
+          return ADVERSERXNS;
+        if ("allergies".equals(codeString))
+          return ALLERGIES;
+        if ("medications".equals(codeString))
+          return MEDICATIONS;
+        if ("problems".equals(codeString))
+          return PROBLEMS;
+        if ("worklist".equals(codeString))
+          return WORKLIST;
+        if ("waiting".equals(codeString))
+          return WAITING;
+        if ("protocols".equals(codeString))
+          return PROTOCOLS;
+        if ("plans".equals(codeString))
+          return PLANS;
+        throw new FHIRException("Unknown ListExampleCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ALERTS: return "alerts";
+            case ADVERSERXNS: return "adverserxns";
+            case ALLERGIES: return "allergies";
+            case MEDICATIONS: return "medications";
+            case PROBLEMS: return "problems";
+            case WORKLIST: return "worklist";
+            case WAITING: return "waiting";
+            case PROTOCOLS: return "protocols";
+            case PLANS: return "plans";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/list-example-use-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ALERTS: return "A list of alerts for the patient.";
+            case ADVERSERXNS: return "A list of part adverse reactions.";
+            case ALLERGIES: return "A list of Allergies for the patient.";
+            case MEDICATIONS: return "A list of medication statements for the patient.";
+            case PROBLEMS: return "A list of problems that the patient is known of have (or have had in the past).";
+            case WORKLIST: return "A list of items that constitute a set of work to be performed (typically this code would be specialized for more specific uses, such as a ward round list).";
+            case WAITING: return "A list of items waiting for an event (perhaps a surgical patient waiting list).";
+            case PROTOCOLS: return "A set of protocols to be followed.";
+            case PLANS: return "A set of care plans that apply in a particular context of care.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ALERTS: return "Alerts";
+            case ADVERSERXNS: return "Adverse Reactions";
+            case ALLERGIES: return "Allergies";
+            case MEDICATIONS: return "Medication List";
+            case PROBLEMS: return "Problem List";
+            case WORKLIST: return "Worklist";
+            case WAITING: return "Waiting List";
+            case PROTOCOLS: return "Protocols";
+            case PLANS: return "Care Plans";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListExampleCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListExampleCodesEnumFactory.java
new file mode 100644
index 00000000000..7d1f3029914
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListExampleCodesEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ListExampleCodesEnumFactory implements EnumFactory {
+
+  public ListExampleCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("alerts".equals(codeString))
+      return ListExampleCodes.ALERTS;
+    if ("adverserxns".equals(codeString))
+      return ListExampleCodes.ADVERSERXNS;
+    if ("allergies".equals(codeString))
+      return ListExampleCodes.ALLERGIES;
+    if ("medications".equals(codeString))
+      return ListExampleCodes.MEDICATIONS;
+    if ("problems".equals(codeString))
+      return ListExampleCodes.PROBLEMS;
+    if ("worklist".equals(codeString))
+      return ListExampleCodes.WORKLIST;
+    if ("waiting".equals(codeString))
+      return ListExampleCodes.WAITING;
+    if ("protocols".equals(codeString))
+      return ListExampleCodes.PROTOCOLS;
+    if ("plans".equals(codeString))
+      return ListExampleCodes.PLANS;
+    throw new IllegalArgumentException("Unknown ListExampleCodes code '"+codeString+"'");
+  }
+
+  public String toCode(ListExampleCodes code) {
+    if (code == ListExampleCodes.ALERTS)
+      return "alerts";
+    if (code == ListExampleCodes.ADVERSERXNS)
+      return "adverserxns";
+    if (code == ListExampleCodes.ALLERGIES)
+      return "allergies";
+    if (code == ListExampleCodes.MEDICATIONS)
+      return "medications";
+    if (code == ListExampleCodes.PROBLEMS)
+      return "problems";
+    if (code == ListExampleCodes.WORKLIST)
+      return "worklist";
+    if (code == ListExampleCodes.WAITING)
+      return "waiting";
+    if (code == ListExampleCodes.PROTOCOLS)
+      return "protocols";
+    if (code == ListExampleCodes.PLANS)
+      return "plans";
+    return "?";
+  }
+
+    public String toSystem(ListExampleCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListItemFlag.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListItemFlag.java
new file mode 100644
index 00000000000..76f724c9eda
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListItemFlag.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ListItemFlag {
+
+        /**
+         * No change has been made to the status of this medicine item.
+         */
+        _01, 
+        /**
+         * The medicine item has changed. The change may be described in an extension (not defined yet)
+         */
+        _02, 
+        /**
+         * The prescription for this medicine item was cancelled by an authorized health care provider. The patient may be advised to complete the course of the prescribed medicine. This advice is a clinical decision made based on assessment of the patient's clinical condition.
+         */
+        _03, 
+        /**
+         * A new medicine item has been prescribed
+         */
+        _04, 
+        /**
+         * Administration of this medication item that the patient is currently taking is stopped or recommended to be stopped (i.e. instructed to be ceased by a health care provider). This cessation is anticipated to be permanent. The Change Description should describe the reason for cessation. Example uses: the medication in question is considered ineffective or has caused serious adverse effects. This value applies both to the cessation of a medication that is prescribed by another healthcare provider or patient self-administration of OTC medicines.
+         */
+        _05, 
+        /**
+         * Administration of this medication item that the patient is currently taking is on hold, or instructed or recommended by a health care provider to be temporarily stopped, or subject to clinical review (i.e. the stop may be temporary or permanent depending on the outcome of clinical review), or temporarily suspended as a pre-requisite to certain surgical or diagnostic procedures.
+         */
+        _06, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ListItemFlag fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("01".equals(codeString))
+          return _01;
+        if ("02".equals(codeString))
+          return _02;
+        if ("03".equals(codeString))
+          return _03;
+        if ("04".equals(codeString))
+          return _04;
+        if ("05".equals(codeString))
+          return _05;
+        if ("06".equals(codeString))
+          return _06;
+        throw new FHIRException("Unknown ListItemFlag code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _01: return "01";
+            case _02: return "02";
+            case _03: return "03";
+            case _04: return "04";
+            case _05: return "05";
+            case _06: return "06";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "urn:oid:1.2.36.1.2001.1001.101.104.16592";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _01: return "No change has been made to the status of this medicine item.";
+            case _02: return "The medicine item has changed. The change may be described in an extension (not defined yet)";
+            case _03: return "The prescription for this medicine item was cancelled by an authorized health care provider. The patient may be advised to complete the course of the prescribed medicine. This advice is a clinical decision made based on assessment of the patient's clinical condition.";
+            case _04: return "A new medicine item has been prescribed";
+            case _05: return "Administration of this medication item that the patient is currently taking is stopped or recommended to be stopped (i.e. instructed to be ceased by a health care provider). This cessation is anticipated to be permanent. The Change Description should describe the reason for cessation. Example uses: the medication in question is considered ineffective or has caused serious adverse effects. This value applies both to the cessation of a medication that is prescribed by another healthcare provider or patient self-administration of OTC medicines.";
+            case _06: return "Administration of this medication item that the patient is currently taking is on hold, or instructed or recommended by a health care provider to be temporarily stopped, or subject to clinical review (i.e. the stop may be temporary or permanent depending on the outcome of clinical review), or temporarily suspended as a pre-requisite to certain surgical or diagnostic procedures.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _01: return "Unchanged";
+            case _02: return "Changed";
+            case _03: return "Cancelled";
+            case _04: return "Prescribed";
+            case _05: return "Ceased";
+            case _06: return "Suspended";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListItemFlagEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListItemFlagEnumFactory.java
new file mode 100644
index 00000000000..8c10d67c8dc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListItemFlagEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ListItemFlagEnumFactory implements EnumFactory {
+
+  public ListItemFlag fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("01".equals(codeString))
+      return ListItemFlag._01;
+    if ("02".equals(codeString))
+      return ListItemFlag._02;
+    if ("03".equals(codeString))
+      return ListItemFlag._03;
+    if ("04".equals(codeString))
+      return ListItemFlag._04;
+    if ("05".equals(codeString))
+      return ListItemFlag._05;
+    if ("06".equals(codeString))
+      return ListItemFlag._06;
+    throw new IllegalArgumentException("Unknown ListItemFlag code '"+codeString+"'");
+  }
+
+  public String toCode(ListItemFlag code) {
+    if (code == ListItemFlag._01)
+      return "01";
+    if (code == ListItemFlag._02)
+      return "02";
+    if (code == ListItemFlag._03)
+      return "03";
+    if (code == ListItemFlag._04)
+      return "04";
+    if (code == ListItemFlag._05)
+      return "05";
+    if (code == ListItemFlag._06)
+      return "06";
+    return "?";
+  }
+
+    public String toSystem(ListItemFlag code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListMode.java
new file mode 100644
index 00000000000..b972581b681
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ListMode {
+
+        /**
+         * This list is the master list, maintained in an ongoing fashion with regular updates as the real world list it is tracking changes
+         */
+        WORKING, 
+        /**
+         * This list was prepared as a snapshot. It should not be assumed to be current
+         */
+        SNAPSHOT, 
+        /**
+         * A list that indicates where changes have been made or recommended
+         */
+        CHANGES, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ListMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("working".equals(codeString))
+          return WORKING;
+        if ("snapshot".equals(codeString))
+          return SNAPSHOT;
+        if ("changes".equals(codeString))
+          return CHANGES;
+        throw new FHIRException("Unknown ListMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case WORKING: return "working";
+            case SNAPSHOT: return "snapshot";
+            case CHANGES: return "changes";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/list-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case WORKING: return "This list is the master list, maintained in an ongoing fashion with regular updates as the real world list it is tracking changes";
+            case SNAPSHOT: return "This list was prepared as a snapshot. It should not be assumed to be current";
+            case CHANGES: return "A list that indicates where changes have been made or recommended";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case WORKING: return "Working List";
+            case SNAPSHOT: return "Snapshot List";
+            case CHANGES: return "Change List";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListModeEnumFactory.java
new file mode 100644
index 00000000000..fa4988c3cfd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ListModeEnumFactory implements EnumFactory {
+
+  public ListMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("working".equals(codeString))
+      return ListMode.WORKING;
+    if ("snapshot".equals(codeString))
+      return ListMode.SNAPSHOT;
+    if ("changes".equals(codeString))
+      return ListMode.CHANGES;
+    throw new IllegalArgumentException("Unknown ListMode code '"+codeString+"'");
+  }
+
+  public String toCode(ListMode code) {
+    if (code == ListMode.WORKING)
+      return "working";
+    if (code == ListMode.SNAPSHOT)
+      return "snapshot";
+    if (code == ListMode.CHANGES)
+      return "changes";
+    return "?";
+  }
+
+    public String toSystem(ListMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListOrder.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListOrder.java
new file mode 100644
index 00000000000..483beb3779f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListOrder.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ListOrder {
+
+        /**
+         * The list was sorted by a user. The criteria the user used are not specified.
+         */
+        USER, 
+        /**
+         * The list was sorted by the system. The criteria the user used are not specified; define additional codes to specify a particular order (or use other defined codes).
+         */
+        SYSTEM, 
+        /**
+         * The list is sorted by the data of the event. This can be used when the list has items which are dates with past or future events.
+         */
+        EVENTDATE, 
+        /**
+         * The list is sorted by the date the item was added to the list. Note that the date added to the list is not explicit in the list itself.
+         */
+        ENTRYDATE, 
+        /**
+         * The list is sorted by priority. The exact method in which priority has been determined is not specified.
+         */
+        PRIORITY, 
+        /**
+         * The list is sorted alphabetically by an unspecified property of the items in the list.
+         */
+        ALPHABETIC, 
+        /**
+         * The list is sorted categorically by an unspecified property of the items in the list.
+         */
+        CATEGORY, 
+        /**
+         * The list is sorted by patient, with items for each patient grouped together.
+         */
+        PATIENT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ListOrder fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("user".equals(codeString))
+          return USER;
+        if ("system".equals(codeString))
+          return SYSTEM;
+        if ("event-date".equals(codeString))
+          return EVENTDATE;
+        if ("entry-date".equals(codeString))
+          return ENTRYDATE;
+        if ("priority".equals(codeString))
+          return PRIORITY;
+        if ("alphabetic".equals(codeString))
+          return ALPHABETIC;
+        if ("category".equals(codeString))
+          return CATEGORY;
+        if ("patient".equals(codeString))
+          return PATIENT;
+        throw new FHIRException("Unknown ListOrder code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case USER: return "user";
+            case SYSTEM: return "system";
+            case EVENTDATE: return "event-date";
+            case ENTRYDATE: return "entry-date";
+            case PRIORITY: return "priority";
+            case ALPHABETIC: return "alphabetic";
+            case CATEGORY: return "category";
+            case PATIENT: return "patient";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/list-order";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case USER: return "The list was sorted by a user. The criteria the user used are not specified.";
+            case SYSTEM: return "The list was sorted by the system. The criteria the user used are not specified; define additional codes to specify a particular order (or use other defined codes).";
+            case EVENTDATE: return "The list is sorted by the data of the event. This can be used when the list has items which are dates with past or future events.";
+            case ENTRYDATE: return "The list is sorted by the date the item was added to the list. Note that the date added to the list is not explicit in the list itself.";
+            case PRIORITY: return "The list is sorted by priority. The exact method in which priority has been determined is not specified.";
+            case ALPHABETIC: return "The list is sorted alphabetically by an unspecified property of the items in the list.";
+            case CATEGORY: return "The list is sorted categorically by an unspecified property of the items in the list.";
+            case PATIENT: return "The list is sorted by patient, with items for each patient grouped together.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case USER: return "Sorted by User";
+            case SYSTEM: return "Sorted by System";
+            case EVENTDATE: return "Sorted by Event Date";
+            case ENTRYDATE: return "Sorted by Item Date";
+            case PRIORITY: return "Sorted by Priority";
+            case ALPHABETIC: return "Sorted Alphabetically";
+            case CATEGORY: return "Sorted by Category";
+            case PATIENT: return "Sorted by Patient";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListOrderEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListOrderEnumFactory.java
new file mode 100644
index 00000000000..b93a354c294
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListOrderEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ListOrderEnumFactory implements EnumFactory {
+
+  public ListOrder fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("user".equals(codeString))
+      return ListOrder.USER;
+    if ("system".equals(codeString))
+      return ListOrder.SYSTEM;
+    if ("event-date".equals(codeString))
+      return ListOrder.EVENTDATE;
+    if ("entry-date".equals(codeString))
+      return ListOrder.ENTRYDATE;
+    if ("priority".equals(codeString))
+      return ListOrder.PRIORITY;
+    if ("alphabetic".equals(codeString))
+      return ListOrder.ALPHABETIC;
+    if ("category".equals(codeString))
+      return ListOrder.CATEGORY;
+    if ("patient".equals(codeString))
+      return ListOrder.PATIENT;
+    throw new IllegalArgumentException("Unknown ListOrder code '"+codeString+"'");
+  }
+
+  public String toCode(ListOrder code) {
+    if (code == ListOrder.USER)
+      return "user";
+    if (code == ListOrder.SYSTEM)
+      return "system";
+    if (code == ListOrder.EVENTDATE)
+      return "event-date";
+    if (code == ListOrder.ENTRYDATE)
+      return "entry-date";
+    if (code == ListOrder.PRIORITY)
+      return "priority";
+    if (code == ListOrder.ALPHABETIC)
+      return "alphabetic";
+    if (code == ListOrder.CATEGORY)
+      return "category";
+    if (code == ListOrder.PATIENT)
+      return "patient";
+    return "?";
+  }
+
+    public String toSystem(ListOrder code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListStatus.java
new file mode 100644
index 00000000000..711b0eaec39
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ListStatus {
+
+        /**
+         * The list is considered to be an active part of the patient's record.
+         */
+        CURRENT, 
+        /**
+         * The list is "old" and should no longer be considered accurate or relevant.
+         */
+        RETIRED, 
+        /**
+         * The list was never accurate.  It is retained for medico-legal purposes only.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ListStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("current".equals(codeString))
+          return CURRENT;
+        if ("retired".equals(codeString))
+          return RETIRED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ListStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CURRENT: return "current";
+            case RETIRED: return "retired";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/list-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CURRENT: return "The list is considered to be an active part of the patient's record.";
+            case RETIRED: return "The list is \"old\" and should no longer be considered accurate or relevant.";
+            case ENTEREDINERROR: return "The list was never accurate.  It is retained for medico-legal purposes only.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CURRENT: return "Current";
+            case RETIRED: return "Retired";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListStatusEnumFactory.java
new file mode 100644
index 00000000000..afd76a9be07
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ListStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ListStatusEnumFactory implements EnumFactory {
+
+  public ListStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("current".equals(codeString))
+      return ListStatus.CURRENT;
+    if ("retired".equals(codeString))
+      return ListStatus.RETIRED;
+    if ("entered-in-error".equals(codeString))
+      return ListStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ListStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ListStatus code) {
+    if (code == ListStatus.CURRENT)
+      return "current";
+    if (code == ListStatus.RETIRED)
+      return "retired";
+    if (code == ListStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ListStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationMode.java
new file mode 100644
index 00000000000..907a89eb947
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationMode.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum LocationMode {
+
+        /**
+         * The Location resource represents a specific instance of a location (e.g. Operating Theatre 1A).
+         */
+        INSTANCE, 
+        /**
+         * The Location represents a class of locations (e.g. Any Operating Theatre) although this class of locations could be constrained within a specific boundary (such as organization, or parent location, address etc.).
+         */
+        KIND, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static LocationMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("instance".equals(codeString))
+          return INSTANCE;
+        if ("kind".equals(codeString))
+          return KIND;
+        throw new FHIRException("Unknown LocationMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INSTANCE: return "instance";
+            case KIND: return "kind";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/location-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INSTANCE: return "The Location resource represents a specific instance of a location (e.g. Operating Theatre 1A).";
+            case KIND: return "The Location represents a class of locations (e.g. Any Operating Theatre) although this class of locations could be constrained within a specific boundary (such as organization, or parent location, address etc.).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INSTANCE: return "Instance";
+            case KIND: return "Kind";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationModeEnumFactory.java
new file mode 100644
index 00000000000..06fbcdc9dbb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationModeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class LocationModeEnumFactory implements EnumFactory {
+
+  public LocationMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("instance".equals(codeString))
+      return LocationMode.INSTANCE;
+    if ("kind".equals(codeString))
+      return LocationMode.KIND;
+    throw new IllegalArgumentException("Unknown LocationMode code '"+codeString+"'");
+  }
+
+  public String toCode(LocationMode code) {
+    if (code == LocationMode.INSTANCE)
+      return "instance";
+    if (code == LocationMode.KIND)
+      return "kind";
+    return "?";
+  }
+
+    public String toSystem(LocationMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationPhysicalType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationPhysicalType.java
new file mode 100644
index 00000000000..682487f0ca9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationPhysicalType.java
@@ -0,0 +1,195 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum LocationPhysicalType {
+
+        /**
+         * A collection of buildings or other locations such as a site or a campus.
+         */
+        SI, 
+        /**
+         * Any Building or structure. This may contain rooms, corridors, wings, etc. It may not have walls, or a roof, but is considered a defined/allocated space.
+         */
+        BU, 
+        /**
+         * A Wing within a Building, this often contains levels, rooms and corridors.
+         */
+        WI, 
+        /**
+         * A Ward is a section of a medical facility that may contain rooms and other types of location.
+         */
+        WA, 
+        /**
+         * A Level in a multi-level Building/Structure.
+         */
+        LVL, 
+        /**
+         * Any corridor within a Building, that may connect rooms.
+         */
+        CO, 
+        /**
+         * A space that is allocated as a room, it may have walls/roof etc., but does not require these.
+         */
+        RO, 
+        /**
+         * A space that is allocated for sleeping/laying on. This is not the physical bed/trolley that may be moved about, but the space it may occupy.
+         */
+        BD, 
+        /**
+         * A means of transportation.
+         */
+        VE, 
+        /**
+         * A residential dwelling. Usually used to reference a location that a person/patient may reside.
+         */
+        HO, 
+        /**
+         * A container that can store goods, equipment, medications or other items.
+         */
+        CA, 
+        /**
+         * A defined path to travel between 2 points that has a known name.
+         */
+        RD, 
+        /**
+         * A defined physical boundary of something, such as a flood risk zone, region, postcode
+         */
+        AREA, 
+        /**
+         * A wide scope that covers a conceptual domain, such as a Nation (Country wide community or Federal Government - e.g. Ministry of Health),  Province or State (community or Government), Business (throughout the enterprise), Nation with a business scope of an agency (e.g. CDC, FDA etc.) or a Business segment (UK Pharmacy), not just an physical boundry
+         */
+        JDN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static LocationPhysicalType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("si".equals(codeString))
+          return SI;
+        if ("bu".equals(codeString))
+          return BU;
+        if ("wi".equals(codeString))
+          return WI;
+        if ("wa".equals(codeString))
+          return WA;
+        if ("lvl".equals(codeString))
+          return LVL;
+        if ("co".equals(codeString))
+          return CO;
+        if ("ro".equals(codeString))
+          return RO;
+        if ("bd".equals(codeString))
+          return BD;
+        if ("ve".equals(codeString))
+          return VE;
+        if ("ho".equals(codeString))
+          return HO;
+        if ("ca".equals(codeString))
+          return CA;
+        if ("rd".equals(codeString))
+          return RD;
+        if ("area".equals(codeString))
+          return AREA;
+        if ("jdn".equals(codeString))
+          return JDN;
+        throw new FHIRException("Unknown LocationPhysicalType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SI: return "si";
+            case BU: return "bu";
+            case WI: return "wi";
+            case WA: return "wa";
+            case LVL: return "lvl";
+            case CO: return "co";
+            case RO: return "ro";
+            case BD: return "bd";
+            case VE: return "ve";
+            case HO: return "ho";
+            case CA: return "ca";
+            case RD: return "rd";
+            case AREA: return "area";
+            case JDN: return "jdn";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/location-physical-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SI: return "A collection of buildings or other locations such as a site or a campus.";
+            case BU: return "Any Building or structure. This may contain rooms, corridors, wings, etc. It may not have walls, or a roof, but is considered a defined/allocated space.";
+            case WI: return "A Wing within a Building, this often contains levels, rooms and corridors.";
+            case WA: return "A Ward is a section of a medical facility that may contain rooms and other types of location.";
+            case LVL: return "A Level in a multi-level Building/Structure.";
+            case CO: return "Any corridor within a Building, that may connect rooms.";
+            case RO: return "A space that is allocated as a room, it may have walls/roof etc., but does not require these.";
+            case BD: return "A space that is allocated for sleeping/laying on. This is not the physical bed/trolley that may be moved about, but the space it may occupy.";
+            case VE: return "A means of transportation.";
+            case HO: return "A residential dwelling. Usually used to reference a location that a person/patient may reside.";
+            case CA: return "A container that can store goods, equipment, medications or other items.";
+            case RD: return "A defined path to travel between 2 points that has a known name.";
+            case AREA: return "A defined physical boundary of something, such as a flood risk zone, region, postcode";
+            case JDN: return "A wide scope that covers a conceptual domain, such as a Nation (Country wide community or Federal Government - e.g. Ministry of Health),  Province or State (community or Government), Business (throughout the enterprise), Nation with a business scope of an agency (e.g. CDC, FDA etc.) or a Business segment (UK Pharmacy), not just an physical boundry";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SI: return "Site";
+            case BU: return "Building";
+            case WI: return "Wing";
+            case WA: return "Ward";
+            case LVL: return "Level";
+            case CO: return "Corridor";
+            case RO: return "Room";
+            case BD: return "Bed";
+            case VE: return "Vehicle";
+            case HO: return "House";
+            case CA: return "Cabinet";
+            case RD: return "Road";
+            case AREA: return "Area";
+            case JDN: return "Jurisdiction";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationPhysicalTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationPhysicalTypeEnumFactory.java
new file mode 100644
index 00000000000..aeba0441aea
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationPhysicalTypeEnumFactory.java
@@ -0,0 +1,110 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class LocationPhysicalTypeEnumFactory implements EnumFactory {
+
+  public LocationPhysicalType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("si".equals(codeString))
+      return LocationPhysicalType.SI;
+    if ("bu".equals(codeString))
+      return LocationPhysicalType.BU;
+    if ("wi".equals(codeString))
+      return LocationPhysicalType.WI;
+    if ("wa".equals(codeString))
+      return LocationPhysicalType.WA;
+    if ("lvl".equals(codeString))
+      return LocationPhysicalType.LVL;
+    if ("co".equals(codeString))
+      return LocationPhysicalType.CO;
+    if ("ro".equals(codeString))
+      return LocationPhysicalType.RO;
+    if ("bd".equals(codeString))
+      return LocationPhysicalType.BD;
+    if ("ve".equals(codeString))
+      return LocationPhysicalType.VE;
+    if ("ho".equals(codeString))
+      return LocationPhysicalType.HO;
+    if ("ca".equals(codeString))
+      return LocationPhysicalType.CA;
+    if ("rd".equals(codeString))
+      return LocationPhysicalType.RD;
+    if ("area".equals(codeString))
+      return LocationPhysicalType.AREA;
+    if ("jdn".equals(codeString))
+      return LocationPhysicalType.JDN;
+    throw new IllegalArgumentException("Unknown LocationPhysicalType code '"+codeString+"'");
+  }
+
+  public String toCode(LocationPhysicalType code) {
+    if (code == LocationPhysicalType.SI)
+      return "si";
+    if (code == LocationPhysicalType.BU)
+      return "bu";
+    if (code == LocationPhysicalType.WI)
+      return "wi";
+    if (code == LocationPhysicalType.WA)
+      return "wa";
+    if (code == LocationPhysicalType.LVL)
+      return "lvl";
+    if (code == LocationPhysicalType.CO)
+      return "co";
+    if (code == LocationPhysicalType.RO)
+      return "ro";
+    if (code == LocationPhysicalType.BD)
+      return "bd";
+    if (code == LocationPhysicalType.VE)
+      return "ve";
+    if (code == LocationPhysicalType.HO)
+      return "ho";
+    if (code == LocationPhysicalType.CA)
+      return "ca";
+    if (code == LocationPhysicalType.RD)
+      return "rd";
+    if (code == LocationPhysicalType.AREA)
+      return "area";
+    if (code == LocationPhysicalType.JDN)
+      return "jdn";
+    return "?";
+  }
+
+    public String toSystem(LocationPhysicalType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationStatus.java
new file mode 100644
index 00000000000..722e6c39482
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum LocationStatus {
+
+        /**
+         * The location is operational.
+         */
+        ACTIVE, 
+        /**
+         * The location is temporarily closed.
+         */
+        SUSPENDED, 
+        /**
+         * The location is no longer used.
+         */
+        INACTIVE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static LocationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        throw new FHIRException("Unknown LocationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case SUSPENDED: return "suspended";
+            case INACTIVE: return "inactive";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/location-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The location is operational.";
+            case SUSPENDED: return "The location is temporarily closed.";
+            case INACTIVE: return "The location is no longer used.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case SUSPENDED: return "Suspended";
+            case INACTIVE: return "Inactive";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationStatusEnumFactory.java
new file mode 100644
index 00000000000..538f785a73c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/LocationStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class LocationStatusEnumFactory implements EnumFactory {
+
+  public LocationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return LocationStatus.ACTIVE;
+    if ("suspended".equals(codeString))
+      return LocationStatus.SUSPENDED;
+    if ("inactive".equals(codeString))
+      return LocationStatus.INACTIVE;
+    throw new IllegalArgumentException("Unknown LocationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(LocationStatus code) {
+    if (code == LocationStatus.ACTIVE)
+      return "active";
+    if (code == LocationStatus.SUSPENDED)
+      return "suspended";
+    if (code == LocationStatus.INACTIVE)
+      return "inactive";
+    return "?";
+  }
+
+    public String toSystem(LocationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapContextType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapContextType.java
new file mode 100644
index 00000000000..6607f11d156
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapContextType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MapContextType {
+
+        /**
+         * The context specifies a type
+         */
+        TYPE, 
+        /**
+         * The context specifies a variable
+         */
+        VARIABLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MapContextType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("type".equals(codeString))
+          return TYPE;
+        if ("variable".equals(codeString))
+          return VARIABLE;
+        throw new FHIRException("Unknown MapContextType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case TYPE: return "type";
+            case VARIABLE: return "variable";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/map-context-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case TYPE: return "The context specifies a type";
+            case VARIABLE: return "The context specifies a variable";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case TYPE: return "Type";
+            case VARIABLE: return "Variable";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapContextTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapContextTypeEnumFactory.java
new file mode 100644
index 00000000000..72d934f9cc5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapContextTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MapContextTypeEnumFactory implements EnumFactory {
+
+  public MapContextType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("type".equals(codeString))
+      return MapContextType.TYPE;
+    if ("variable".equals(codeString))
+      return MapContextType.VARIABLE;
+    throw new IllegalArgumentException("Unknown MapContextType code '"+codeString+"'");
+  }
+
+  public String toCode(MapContextType code) {
+    if (code == MapContextType.TYPE)
+      return "type";
+    if (code == MapContextType.VARIABLE)
+      return "variable";
+    return "?";
+  }
+
+    public String toSystem(MapContextType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapGroupTypeMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapGroupTypeMode.java
new file mode 100644
index 00000000000..ce403803f9e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapGroupTypeMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MapGroupTypeMode {
+
+        /**
+         * This group is not a default group for the types
+         */
+        NONE, 
+        /**
+         * This group is a default mapping group for the specified types and for the primary source type
+         */
+        TYPES, 
+        /**
+         * This group is a default mapping group for the specified types
+         */
+        TYPEANDTYPES, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MapGroupTypeMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("none".equals(codeString))
+          return NONE;
+        if ("types".equals(codeString))
+          return TYPES;
+        if ("type-and-types".equals(codeString))
+          return TYPEANDTYPES;
+        throw new FHIRException("Unknown MapGroupTypeMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NONE: return "none";
+            case TYPES: return "types";
+            case TYPEANDTYPES: return "type-and-types";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/map-group-type-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NONE: return "This group is not a default group for the types";
+            case TYPES: return "This group is a default mapping group for the specified types and for the primary source type";
+            case TYPEANDTYPES: return "This group is a default mapping group for the specified types";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NONE: return "Not a Default";
+            case TYPES: return "Default for Type Combination";
+            case TYPEANDTYPES: return "Default for type + combination";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapGroupTypeModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapGroupTypeModeEnumFactory.java
new file mode 100644
index 00000000000..11a459906c6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapGroupTypeModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MapGroupTypeModeEnumFactory implements EnumFactory {
+
+  public MapGroupTypeMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("none".equals(codeString))
+      return MapGroupTypeMode.NONE;
+    if ("types".equals(codeString))
+      return MapGroupTypeMode.TYPES;
+    if ("type-and-types".equals(codeString))
+      return MapGroupTypeMode.TYPEANDTYPES;
+    throw new IllegalArgumentException("Unknown MapGroupTypeMode code '"+codeString+"'");
+  }
+
+  public String toCode(MapGroupTypeMode code) {
+    if (code == MapGroupTypeMode.NONE)
+      return "none";
+    if (code == MapGroupTypeMode.TYPES)
+      return "types";
+    if (code == MapGroupTypeMode.TYPEANDTYPES)
+      return "type-and-types";
+    return "?";
+  }
+
+    public String toSystem(MapGroupTypeMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapInputMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapInputMode.java
new file mode 100644
index 00000000000..1232573f93e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapInputMode.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MapInputMode {
+
+        /**
+         * Names an input instance used a source for mapping
+         */
+        SOURCE, 
+        /**
+         * Names an instance that is being populated
+         */
+        TARGET, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MapInputMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("source".equals(codeString))
+          return SOURCE;
+        if ("target".equals(codeString))
+          return TARGET;
+        throw new FHIRException("Unknown MapInputMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SOURCE: return "source";
+            case TARGET: return "target";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/map-input-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SOURCE: return "Names an input instance used a source for mapping";
+            case TARGET: return "Names an instance that is being populated";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SOURCE: return "Source Instance";
+            case TARGET: return "Target Instance";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapInputModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapInputModeEnumFactory.java
new file mode 100644
index 00000000000..dc28903c803
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapInputModeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MapInputModeEnumFactory implements EnumFactory {
+
+  public MapInputMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("source".equals(codeString))
+      return MapInputMode.SOURCE;
+    if ("target".equals(codeString))
+      return MapInputMode.TARGET;
+    throw new IllegalArgumentException("Unknown MapInputMode code '"+codeString+"'");
+  }
+
+  public String toCode(MapInputMode code) {
+    if (code == MapInputMode.SOURCE)
+      return "source";
+    if (code == MapInputMode.TARGET)
+      return "target";
+    return "?";
+  }
+
+    public String toSystem(MapInputMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapListMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapListMode.java
new file mode 100644
index 00000000000..91e2c46aab6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapListMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Dec 12, 2016 07:06-0500 for FHIR v1.8.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MapListMode {
+
+        /**
+         * when the target list is being assembled, the items for this rule go first. If more that one rule defines a first item (for a given instance of mapping) then this is an error
+         */
+        FIRST, 
+        /**
+         * the target instance is shared with the target instances generated by another rule (up to the first common n items, then create new ones)
+         */
+        SHARE, 
+        /**
+         * when the target list is being assembled, the items for this rule go last. If more that one rule defines a last item (for a given instance of mapping) then this is an error
+         */
+        LAST, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MapListMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("first".equals(codeString))
+          return FIRST;
+        if ("share".equals(codeString))
+          return SHARE;
+        if ("last".equals(codeString))
+          return LAST;
+        throw new FHIRException("Unknown MapListMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FIRST: return "first";
+            case SHARE: return "share";
+            case LAST: return "last";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/map-list-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FIRST: return "when the target list is being assembled, the items for this rule go first. If more that one rule defines a first item (for a given instance of mapping) then this is an error";
+            case SHARE: return "the target instance is shared with the target instances generated by another rule (up to the first common n items, then create new ones)";
+            case LAST: return "when the target list is being assembled, the items for this rule go last. If more that one rule defines a last item (for a given instance of mapping) then this is an error";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FIRST: return "First";
+            case SHARE: return "Share";
+            case LAST: return "Last";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapListModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapListModeEnumFactory.java
new file mode 100644
index 00000000000..cb2389cc3f5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapListModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Dec 12, 2016 07:06-0500 for FHIR v1.8.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MapListModeEnumFactory implements EnumFactory {
+
+  public MapListMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("first".equals(codeString))
+      return MapListMode.FIRST;
+    if ("share".equals(codeString))
+      return MapListMode.SHARE;
+    if ("last".equals(codeString))
+      return MapListMode.LAST;
+    throw new IllegalArgumentException("Unknown MapListMode code '"+codeString+"'");
+  }
+
+  public String toCode(MapListMode code) {
+    if (code == MapListMode.FIRST)
+      return "first";
+    if (code == MapListMode.SHARE)
+      return "share";
+    if (code == MapListMode.LAST)
+      return "last";
+    return "?";
+  }
+
+    public String toSystem(MapListMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapModelMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapModelMode.java
new file mode 100644
index 00000000000..4ca9f3df1cb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapModelMode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MapModelMode {
+
+        /**
+         * This structure describes an instance passed to the mapping engine that is used a source of data
+         */
+        SOURCE, 
+        /**
+         * This structure describes an instance that the mapping engine may ask for that is used a source of data
+         */
+        QUERIED, 
+        /**
+         * This structure describes an instance passed to the mapping engine that is used a target of data
+         */
+        TARGET, 
+        /**
+         * This structure describes an instance that the mapping engine may ask to create that is used a target of data
+         */
+        PRODUCED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MapModelMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("source".equals(codeString))
+          return SOURCE;
+        if ("queried".equals(codeString))
+          return QUERIED;
+        if ("target".equals(codeString))
+          return TARGET;
+        if ("produced".equals(codeString))
+          return PRODUCED;
+        throw new FHIRException("Unknown MapModelMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SOURCE: return "source";
+            case QUERIED: return "queried";
+            case TARGET: return "target";
+            case PRODUCED: return "produced";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/map-model-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SOURCE: return "This structure describes an instance passed to the mapping engine that is used a source of data";
+            case QUERIED: return "This structure describes an instance that the mapping engine may ask for that is used a source of data";
+            case TARGET: return "This structure describes an instance passed to the mapping engine that is used a target of data";
+            case PRODUCED: return "This structure describes an instance that the mapping engine may ask to create that is used a target of data";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SOURCE: return "Source Structure Definition";
+            case QUERIED: return "Queried Structure Definition";
+            case TARGET: return "Target Structure Definition";
+            case PRODUCED: return "Produced Structure Definition";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapModelModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapModelModeEnumFactory.java
new file mode 100644
index 00000000000..0427f9e40ea
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapModelModeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MapModelModeEnumFactory implements EnumFactory {
+
+  public MapModelMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("source".equals(codeString))
+      return MapModelMode.SOURCE;
+    if ("queried".equals(codeString))
+      return MapModelMode.QUERIED;
+    if ("target".equals(codeString))
+      return MapModelMode.TARGET;
+    if ("produced".equals(codeString))
+      return MapModelMode.PRODUCED;
+    throw new IllegalArgumentException("Unknown MapModelMode code '"+codeString+"'");
+  }
+
+  public String toCode(MapModelMode code) {
+    if (code == MapModelMode.SOURCE)
+      return "source";
+    if (code == MapModelMode.QUERIED)
+      return "queried";
+    if (code == MapModelMode.TARGET)
+      return "target";
+    if (code == MapModelMode.PRODUCED)
+      return "produced";
+    return "?";
+  }
+
+    public String toSystem(MapModelMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapSourceListMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapSourceListMode.java
new file mode 100644
index 00000000000..b1024accc80
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapSourceListMode.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MapSourceListMode {
+
+        /**
+         * Only process this rule for the first in the list
+         */
+        FIRST, 
+        /**
+         * Process this rule for all but the first
+         */
+        NOTFIRST, 
+        /**
+         * Only process this rule for the last in the list
+         */
+        LAST, 
+        /**
+         * Process this rule for all but the last
+         */
+        NOTLAST, 
+        /**
+         * Only process this rule is there is only item
+         */
+        ONLYONE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MapSourceListMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("first".equals(codeString))
+          return FIRST;
+        if ("not_first".equals(codeString))
+          return NOTFIRST;
+        if ("last".equals(codeString))
+          return LAST;
+        if ("not_last".equals(codeString))
+          return NOTLAST;
+        if ("only_one".equals(codeString))
+          return ONLYONE;
+        throw new FHIRException("Unknown MapSourceListMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FIRST: return "first";
+            case NOTFIRST: return "not_first";
+            case LAST: return "last";
+            case NOTLAST: return "not_last";
+            case ONLYONE: return "only_one";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/map-source-list-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FIRST: return "Only process this rule for the first in the list";
+            case NOTFIRST: return "Process this rule for all but the first";
+            case LAST: return "Only process this rule for the last in the list";
+            case NOTLAST: return "Process this rule for all but the last";
+            case ONLYONE: return "Only process this rule is there is only item";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FIRST: return "First";
+            case NOTFIRST: return "All but the first";
+            case LAST: return "Last";
+            case NOTLAST: return "All but the last";
+            case ONLYONE: return "Enforce only one";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapSourceListModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapSourceListModeEnumFactory.java
new file mode 100644
index 00000000000..7803d10fec6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapSourceListModeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MapSourceListModeEnumFactory implements EnumFactory {
+
+  public MapSourceListMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("first".equals(codeString))
+      return MapSourceListMode.FIRST;
+    if ("not_first".equals(codeString))
+      return MapSourceListMode.NOTFIRST;
+    if ("last".equals(codeString))
+      return MapSourceListMode.LAST;
+    if ("not_last".equals(codeString))
+      return MapSourceListMode.NOTLAST;
+    if ("only_one".equals(codeString))
+      return MapSourceListMode.ONLYONE;
+    throw new IllegalArgumentException("Unknown MapSourceListMode code '"+codeString+"'");
+  }
+
+  public String toCode(MapSourceListMode code) {
+    if (code == MapSourceListMode.FIRST)
+      return "first";
+    if (code == MapSourceListMode.NOTFIRST)
+      return "not_first";
+    if (code == MapSourceListMode.LAST)
+      return "last";
+    if (code == MapSourceListMode.NOTLAST)
+      return "not_last";
+    if (code == MapSourceListMode.ONLYONE)
+      return "only_one";
+    return "?";
+  }
+
+    public String toSystem(MapSourceListMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTargetListMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTargetListMode.java
new file mode 100644
index 00000000000..f4ef0bb57a7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTargetListMode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MapTargetListMode {
+
+        /**
+         * when the target list is being assembled, the items for this rule go first. If more that one rule defines a first item (for a given instance of mapping) then this is an error
+         */
+        FIRST, 
+        /**
+         * the target instance is shared with the target instances generated by another rule (up to the first common n items, then create new ones)
+         */
+        SHARE, 
+        /**
+         * when the target list is being assembled, the items for this rule go last. If more that one rule defines a last item (for a given instance of mapping) then this is an error
+         */
+        LAST, 
+        /**
+         * re-use the first item in the list, and keep adding content to it
+         */
+        COLLATE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MapTargetListMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("first".equals(codeString))
+          return FIRST;
+        if ("share".equals(codeString))
+          return SHARE;
+        if ("last".equals(codeString))
+          return LAST;
+        if ("collate".equals(codeString))
+          return COLLATE;
+        throw new FHIRException("Unknown MapTargetListMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FIRST: return "first";
+            case SHARE: return "share";
+            case LAST: return "last";
+            case COLLATE: return "collate";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/map-target-list-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FIRST: return "when the target list is being assembled, the items for this rule go first. If more that one rule defines a first item (for a given instance of mapping) then this is an error";
+            case SHARE: return "the target instance is shared with the target instances generated by another rule (up to the first common n items, then create new ones)";
+            case LAST: return "when the target list is being assembled, the items for this rule go last. If more that one rule defines a last item (for a given instance of mapping) then this is an error";
+            case COLLATE: return "re-use the first item in the list, and keep adding content to it";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FIRST: return "First";
+            case SHARE: return "Share";
+            case LAST: return "Last";
+            case COLLATE: return "Collate";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTargetListModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTargetListModeEnumFactory.java
new file mode 100644
index 00000000000..7cd8dac6c56
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTargetListModeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MapTargetListModeEnumFactory implements EnumFactory {
+
+  public MapTargetListMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("first".equals(codeString))
+      return MapTargetListMode.FIRST;
+    if ("share".equals(codeString))
+      return MapTargetListMode.SHARE;
+    if ("last".equals(codeString))
+      return MapTargetListMode.LAST;
+    if ("collate".equals(codeString))
+      return MapTargetListMode.COLLATE;
+    throw new IllegalArgumentException("Unknown MapTargetListMode code '"+codeString+"'");
+  }
+
+  public String toCode(MapTargetListMode code) {
+    if (code == MapTargetListMode.FIRST)
+      return "first";
+    if (code == MapTargetListMode.SHARE)
+      return "share";
+    if (code == MapTargetListMode.LAST)
+      return "last";
+    if (code == MapTargetListMode.COLLATE)
+      return "collate";
+    return "?";
+  }
+
+    public String toSystem(MapTargetListMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTransform.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTransform.java
new file mode 100644
index 00000000000..2281b0e0251
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTransform.java
@@ -0,0 +1,222 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MapTransform {
+
+        /**
+         * create(type : string) - type is passed through to the application on the standard API, and must be known by it
+         */
+        CREATE, 
+        /**
+         * copy(source)
+         */
+        COPY, 
+        /**
+         * truncate(source, length) - source must be stringy type
+         */
+        TRUNCATE, 
+        /**
+         * escape(source, fmt1, fmt2) - change source from one kind of escaping to another (plain, java, xml, json). note that this is for when the string itself is escaped
+         */
+        ESCAPE, 
+        /**
+         * cast(source, type?) - case source from one type to another. target type can be left as implicit if there is one and only one target type known
+         */
+        CAST, 
+        /**
+         * append(source...) - source is element or string
+         */
+        APPEND, 
+        /**
+         * translate(source, uri_of_map) - use the translate operation
+         */
+        TRANSLATE, 
+        /**
+         * reference(source : object) - return a string that references the provided tree properly
+         */
+        REFERENCE, 
+        /**
+         * Perform a date operation. *Parameters to be documented*
+         */
+        DATEOP, 
+        /**
+         * Generate a random UUID (in lowercase). No Parameters
+         */
+        UUID, 
+        /**
+         * Return the appropriate string to put in a reference that refers to the resource provided as a parameter
+         */
+        POINTER, 
+        /**
+         * Execute the supplied fluentpath expression and use the value returned by that
+         */
+        EVALUATE, 
+        /**
+         * Create a CodeableConcept. Parameters = (text) or (system. Code[, display])
+         */
+        CC, 
+        /**
+         * Create a Coding. Parameters = (system. Code[, display])
+         */
+        C, 
+        /**
+         * Create a quantity. Parameters = (text) or (value, unit, [system, code]) where text is the natural representation e.g. [comparator]value[space]unit
+         */
+        QTY, 
+        /**
+         * Create an identifier. Parameters = (system, value[, type]) where type is a code from the identifier type value set
+         */
+        ID, 
+        /**
+         * Create a contact details. Parameters = (value) or (system, value). If no system is provided, the system should be inferred from the content of the value
+         */
+        CP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MapTransform fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("create".equals(codeString))
+          return CREATE;
+        if ("copy".equals(codeString))
+          return COPY;
+        if ("truncate".equals(codeString))
+          return TRUNCATE;
+        if ("escape".equals(codeString))
+          return ESCAPE;
+        if ("cast".equals(codeString))
+          return CAST;
+        if ("append".equals(codeString))
+          return APPEND;
+        if ("translate".equals(codeString))
+          return TRANSLATE;
+        if ("reference".equals(codeString))
+          return REFERENCE;
+        if ("dateOp".equals(codeString))
+          return DATEOP;
+        if ("uuid".equals(codeString))
+          return UUID;
+        if ("pointer".equals(codeString))
+          return POINTER;
+        if ("evaluate".equals(codeString))
+          return EVALUATE;
+        if ("cc".equals(codeString))
+          return CC;
+        if ("c".equals(codeString))
+          return C;
+        if ("qty".equals(codeString))
+          return QTY;
+        if ("id".equals(codeString))
+          return ID;
+        if ("cp".equals(codeString))
+          return CP;
+        throw new FHIRException("Unknown MapTransform code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CREATE: return "create";
+            case COPY: return "copy";
+            case TRUNCATE: return "truncate";
+            case ESCAPE: return "escape";
+            case CAST: return "cast";
+            case APPEND: return "append";
+            case TRANSLATE: return "translate";
+            case REFERENCE: return "reference";
+            case DATEOP: return "dateOp";
+            case UUID: return "uuid";
+            case POINTER: return "pointer";
+            case EVALUATE: return "evaluate";
+            case CC: return "cc";
+            case C: return "c";
+            case QTY: return "qty";
+            case ID: return "id";
+            case CP: return "cp";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/map-transform";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CREATE: return "create(type : string) - type is passed through to the application on the standard API, and must be known by it";
+            case COPY: return "copy(source)";
+            case TRUNCATE: return "truncate(source, length) - source must be stringy type";
+            case ESCAPE: return "escape(source, fmt1, fmt2) - change source from one kind of escaping to another (plain, java, xml, json). note that this is for when the string itself is escaped";
+            case CAST: return "cast(source, type?) - case source from one type to another. target type can be left as implicit if there is one and only one target type known";
+            case APPEND: return "append(source...) - source is element or string";
+            case TRANSLATE: return "translate(source, uri_of_map) - use the translate operation";
+            case REFERENCE: return "reference(source : object) - return a string that references the provided tree properly";
+            case DATEOP: return "Perform a date operation. *Parameters to be documented*";
+            case UUID: return "Generate a random UUID (in lowercase). No Parameters";
+            case POINTER: return "Return the appropriate string to put in a reference that refers to the resource provided as a parameter";
+            case EVALUATE: return "Execute the supplied fluentpath expression and use the value returned by that";
+            case CC: return "Create a CodeableConcept. Parameters = (text) or (system. Code[, display])";
+            case C: return "Create a Coding. Parameters = (system. Code[, display])";
+            case QTY: return "Create a quantity. Parameters = (text) or (value, unit, [system, code]) where text is the natural representation e.g. [comparator]value[space]unit";
+            case ID: return "Create an identifier. Parameters = (system, value[, type]) where type is a code from the identifier type value set";
+            case CP: return "Create a contact details. Parameters = (value) or (system, value). If no system is provided, the system should be inferred from the content of the value";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CREATE: return "create";
+            case COPY: return "copy";
+            case TRUNCATE: return "truncate";
+            case ESCAPE: return "escape";
+            case CAST: return "cast";
+            case APPEND: return "append";
+            case TRANSLATE: return "translate";
+            case REFERENCE: return "reference";
+            case DATEOP: return "dateOp";
+            case UUID: return "uuid";
+            case POINTER: return "pointer";
+            case EVALUATE: return "evaluate";
+            case CC: return "cc";
+            case C: return "c";
+            case QTY: return "qty";
+            case ID: return "id";
+            case CP: return "cp";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTransformEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTransformEnumFactory.java
new file mode 100644
index 00000000000..64fc92fd21b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MapTransformEnumFactory.java
@@ -0,0 +1,122 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MapTransformEnumFactory implements EnumFactory {
+
+  public MapTransform fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("create".equals(codeString))
+      return MapTransform.CREATE;
+    if ("copy".equals(codeString))
+      return MapTransform.COPY;
+    if ("truncate".equals(codeString))
+      return MapTransform.TRUNCATE;
+    if ("escape".equals(codeString))
+      return MapTransform.ESCAPE;
+    if ("cast".equals(codeString))
+      return MapTransform.CAST;
+    if ("append".equals(codeString))
+      return MapTransform.APPEND;
+    if ("translate".equals(codeString))
+      return MapTransform.TRANSLATE;
+    if ("reference".equals(codeString))
+      return MapTransform.REFERENCE;
+    if ("dateOp".equals(codeString))
+      return MapTransform.DATEOP;
+    if ("uuid".equals(codeString))
+      return MapTransform.UUID;
+    if ("pointer".equals(codeString))
+      return MapTransform.POINTER;
+    if ("evaluate".equals(codeString))
+      return MapTransform.EVALUATE;
+    if ("cc".equals(codeString))
+      return MapTransform.CC;
+    if ("c".equals(codeString))
+      return MapTransform.C;
+    if ("qty".equals(codeString))
+      return MapTransform.QTY;
+    if ("id".equals(codeString))
+      return MapTransform.ID;
+    if ("cp".equals(codeString))
+      return MapTransform.CP;
+    throw new IllegalArgumentException("Unknown MapTransform code '"+codeString+"'");
+  }
+
+  public String toCode(MapTransform code) {
+    if (code == MapTransform.CREATE)
+      return "create";
+    if (code == MapTransform.COPY)
+      return "copy";
+    if (code == MapTransform.TRUNCATE)
+      return "truncate";
+    if (code == MapTransform.ESCAPE)
+      return "escape";
+    if (code == MapTransform.CAST)
+      return "cast";
+    if (code == MapTransform.APPEND)
+      return "append";
+    if (code == MapTransform.TRANSLATE)
+      return "translate";
+    if (code == MapTransform.REFERENCE)
+      return "reference";
+    if (code == MapTransform.DATEOP)
+      return "dateOp";
+    if (code == MapTransform.UUID)
+      return "uuid";
+    if (code == MapTransform.POINTER)
+      return "pointer";
+    if (code == MapTransform.EVALUATE)
+      return "evaluate";
+    if (code == MapTransform.CC)
+      return "cc";
+    if (code == MapTransform.C)
+      return "c";
+    if (code == MapTransform.QTY)
+      return "qty";
+    if (code == MapTransform.ID)
+      return "id";
+    if (code == MapTransform.CP)
+      return "cp";
+    return "?";
+  }
+
+    public String toSystem(MapTransform code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MaritalStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MaritalStatus.java
new file mode 100644
index 00000000000..66dcb9001a5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MaritalStatus.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MaritalStatus {
+
+        /**
+         * The person is not presently married. The marital history is not known or stated.
+         */
+        U, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MaritalStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("U".equals(codeString))
+          return U;
+        throw new FHIRException("Unknown MaritalStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case U: return "U";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/marital-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case U: return "The person is not presently married. The marital history is not known or stated.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case U: return "Unmarried";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MaritalStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MaritalStatusEnumFactory.java
new file mode 100644
index 00000000000..77ff33222e8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MaritalStatusEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MaritalStatusEnumFactory implements EnumFactory {
+
+  public MaritalStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("U".equals(codeString))
+      return MaritalStatus.U;
+    throw new IllegalArgumentException("Unknown MaritalStatus code '"+codeString+"'");
+  }
+
+  public String toCode(MaritalStatus code) {
+    if (code == MaritalStatus.U)
+      return "U";
+    return "?";
+  }
+
+    public String toSystem(MaritalStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MatchGrade.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MatchGrade.java
new file mode 100644
index 00000000000..f2e0447177a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MatchGrade.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MatchGrade {
+
+        /**
+         * This record meets the matching criteria to be automatically considered as a full match.
+         */
+        CERTAIN, 
+        /**
+         * This record is a close match, but not a certain match. Additional review (e.g. by a human) may be required before using this as a match.
+         */
+        PROBABLE, 
+        /**
+         * This record may be a matching one. Additional review (e.g. by a human) SHOULD be performed before using this as a match.
+         */
+        POSSIBLE, 
+        /**
+         * This record is known not to be a match. Note that usually non-matching records are not returned, but in some cases records previously or likely considered as a match may specifically be negated by the matching engine
+         */
+        CERTAINLYNOT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MatchGrade fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("certain".equals(codeString))
+          return CERTAIN;
+        if ("probable".equals(codeString))
+          return PROBABLE;
+        if ("possible".equals(codeString))
+          return POSSIBLE;
+        if ("certainly-not".equals(codeString))
+          return CERTAINLYNOT;
+        throw new FHIRException("Unknown MatchGrade code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CERTAIN: return "certain";
+            case PROBABLE: return "probable";
+            case POSSIBLE: return "possible";
+            case CERTAINLYNOT: return "certainly-not";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/match-grade";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CERTAIN: return "This record meets the matching criteria to be automatically considered as a full match.";
+            case PROBABLE: return "This record is a close match, but not a certain match. Additional review (e.g. by a human) may be required before using this as a match.";
+            case POSSIBLE: return "This record may be a matching one. Additional review (e.g. by a human) SHOULD be performed before using this as a match.";
+            case CERTAINLYNOT: return "This record is known not to be a match. Note that usually non-matching records are not returned, but in some cases records previously or likely considered as a match may specifically be negated by the matching engine";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CERTAIN: return "Certain Match";
+            case PROBABLE: return "Probable Match";
+            case POSSIBLE: return "Possible Match";
+            case CERTAINLYNOT: return "Certainly Not a Match";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MatchGradeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MatchGradeEnumFactory.java
new file mode 100644
index 00000000000..0cc206d8db4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MatchGradeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MatchGradeEnumFactory implements EnumFactory {
+
+  public MatchGrade fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("certain".equals(codeString))
+      return MatchGrade.CERTAIN;
+    if ("probable".equals(codeString))
+      return MatchGrade.PROBABLE;
+    if ("possible".equals(codeString))
+      return MatchGrade.POSSIBLE;
+    if ("certainly-not".equals(codeString))
+      return MatchGrade.CERTAINLYNOT;
+    throw new IllegalArgumentException("Unknown MatchGrade code '"+codeString+"'");
+  }
+
+  public String toCode(MatchGrade code) {
+    if (code == MatchGrade.CERTAIN)
+      return "certain";
+    if (code == MatchGrade.PROBABLE)
+      return "probable";
+    if (code == MatchGrade.POSSIBLE)
+      return "possible";
+    if (code == MatchGrade.CERTAINLYNOT)
+      return "certainly-not";
+    return "?";
+  }
+
+    public String toSystem(MatchGrade code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureDataUsage.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureDataUsage.java
new file mode 100644
index 00000000000..3c4925cdd6e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureDataUsage.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MeasureDataUsage {
+
+        /**
+         * The data is intended to be provided as additional information alongside the measure results
+         */
+        SUPPLEMENTALDATA, 
+        /**
+         * The data is intended to be used to calculate and apply a risk adjustment model for the measure
+         */
+        RISKADJUSTMENTFACTOR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MeasureDataUsage fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("supplemental-data".equals(codeString))
+          return SUPPLEMENTALDATA;
+        if ("risk-adjustment-factor".equals(codeString))
+          return RISKADJUSTMENTFACTOR;
+        throw new FHIRException("Unknown MeasureDataUsage code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SUPPLEMENTALDATA: return "supplemental-data";
+            case RISKADJUSTMENTFACTOR: return "risk-adjustment-factor";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/measure-data-usage";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SUPPLEMENTALDATA: return "The data is intended to be provided as additional information alongside the measure results";
+            case RISKADJUSTMENTFACTOR: return "The data is intended to be used to calculate and apply a risk adjustment model for the measure";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SUPPLEMENTALDATA: return "Supplemental Data";
+            case RISKADJUSTMENTFACTOR: return "Risk Adjustment Factor";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureDataUsageEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureDataUsageEnumFactory.java
new file mode 100644
index 00000000000..6a8b6dfc820
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureDataUsageEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MeasureDataUsageEnumFactory implements EnumFactory {
+
+  public MeasureDataUsage fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("supplemental-data".equals(codeString))
+      return MeasureDataUsage.SUPPLEMENTALDATA;
+    if ("risk-adjustment-factor".equals(codeString))
+      return MeasureDataUsage.RISKADJUSTMENTFACTOR;
+    throw new IllegalArgumentException("Unknown MeasureDataUsage code '"+codeString+"'");
+  }
+
+  public String toCode(MeasureDataUsage code) {
+    if (code == MeasureDataUsage.SUPPLEMENTALDATA)
+      return "supplemental-data";
+    if (code == MeasureDataUsage.RISKADJUSTMENTFACTOR)
+      return "risk-adjustment-factor";
+    return "?";
+  }
+
+    public String toSystem(MeasureDataUsage code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurePopulation.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurePopulation.java
new file mode 100644
index 00000000000..97d46cb5e2b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurePopulation.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MeasurePopulation {
+
+        /**
+         * The initial population refers to all patients or events to be evaluated by a quality measure involving patients who share a common set of specified characterstics. All patients or events counted (for example, as numerator, as denominator) are drawn from the initial population
+         */
+        INITIALPOPULATION, 
+        /**
+         * The upper portion of a fraction used to calculate a rate, proportion, or ratio. Also called the measure focus, it is the target process, condition, event, or outcome. Numerator criteria are the processes or outcomes expected for each patient, or event defined in the denominator. A numerator statement describes the clinical action that satisfies the conditions of the measure
+         */
+        NUMERATOR, 
+        /**
+         * Numerator exclusion criteria define patients or events to be removed from the numerator. Numerator exclusions are used in proportion and ratio measures to help narrow the numerator (for inverted measures)
+         */
+        NUMERATOREXCLUSION, 
+        /**
+         * The lower portion of a fraction used to calculate a rate, proportion, or ratio. The denominator can be the same as the initial population, or a subset of the initial population to further constrain the population for the purpose of the measure
+         */
+        DENOMINATOR, 
+        /**
+         * Denominator exclusion criteria define patients or events that should be removed from the denominator before determining if numerator criteria are met. Denominator exclusions are used in proportion and ratio measures to help narrow the denominator. For example, patients with bilateral lower extremity amputations would be listed as a denominator exclusion for a measure requiring foot exams
+         */
+        DENOMINATOREXCLUSION, 
+        /**
+         * Denominator exceptions are conditions that should remove a patient or event from the denominator of a measure only if the numerator criteria are not met. Denominator exception allows for adjustment of the calculated score for those providers with higher risk populations. Denominator exception criteria are only used in proportion measures
+         */
+        DENOMINATOREXCEPTION, 
+        /**
+         * Measure population criteria define the patients or events for which the individual observation for the measure should be taken. Measure populations are used for continuous variable measures rather than numerator and denominator criteria
+         */
+        MEASUREPOPULATION, 
+        /**
+         * Measure population criteria define the patients or events that should be removed from the measure population before determining the outcome of one or more continuous variables defined for the measure observation. Measure population exclusion criteria are used within continuous variable measures to help narrow the measure population
+         */
+        MEASUREPOPULATIONEXCLUSION, 
+        /**
+         * Defines the individual observation to be performed for each patient or event in the measure population. Measure observations for each case in the population are aggregated to determine the overall measure score for the population
+         */
+        MEASUREOBSERVATION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MeasurePopulation fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("initial-population".equals(codeString))
+          return INITIALPOPULATION;
+        if ("numerator".equals(codeString))
+          return NUMERATOR;
+        if ("numerator-exclusion".equals(codeString))
+          return NUMERATOREXCLUSION;
+        if ("denominator".equals(codeString))
+          return DENOMINATOR;
+        if ("denominator-exclusion".equals(codeString))
+          return DENOMINATOREXCLUSION;
+        if ("denominator-exception".equals(codeString))
+          return DENOMINATOREXCEPTION;
+        if ("measure-population".equals(codeString))
+          return MEASUREPOPULATION;
+        if ("measure-population-exclusion".equals(codeString))
+          return MEASUREPOPULATIONEXCLUSION;
+        if ("measure-observation".equals(codeString))
+          return MEASUREOBSERVATION;
+        throw new FHIRException("Unknown MeasurePopulation code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INITIALPOPULATION: return "initial-population";
+            case NUMERATOR: return "numerator";
+            case NUMERATOREXCLUSION: return "numerator-exclusion";
+            case DENOMINATOR: return "denominator";
+            case DENOMINATOREXCLUSION: return "denominator-exclusion";
+            case DENOMINATOREXCEPTION: return "denominator-exception";
+            case MEASUREPOPULATION: return "measure-population";
+            case MEASUREPOPULATIONEXCLUSION: return "measure-population-exclusion";
+            case MEASUREOBSERVATION: return "measure-observation";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/measure-population";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INITIALPOPULATION: return "The initial population refers to all patients or events to be evaluated by a quality measure involving patients who share a common set of specified characterstics. All patients or events counted (for example, as numerator, as denominator) are drawn from the initial population";
+            case NUMERATOR: return "The upper portion of a fraction used to calculate a rate, proportion, or ratio. Also called the measure focus, it is the target process, condition, event, or outcome. Numerator criteria are the processes or outcomes expected for each patient, or event defined in the denominator. A numerator statement describes the clinical action that satisfies the conditions of the measure";
+            case NUMERATOREXCLUSION: return "Numerator exclusion criteria define patients or events to be removed from the numerator. Numerator exclusions are used in proportion and ratio measures to help narrow the numerator (for inverted measures)";
+            case DENOMINATOR: return "The lower portion of a fraction used to calculate a rate, proportion, or ratio. The denominator can be the same as the initial population, or a subset of the initial population to further constrain the population for the purpose of the measure";
+            case DENOMINATOREXCLUSION: return "Denominator exclusion criteria define patients or events that should be removed from the denominator before determining if numerator criteria are met. Denominator exclusions are used in proportion and ratio measures to help narrow the denominator. For example, patients with bilateral lower extremity amputations would be listed as a denominator exclusion for a measure requiring foot exams";
+            case DENOMINATOREXCEPTION: return "Denominator exceptions are conditions that should remove a patient or event from the denominator of a measure only if the numerator criteria are not met. Denominator exception allows for adjustment of the calculated score for those providers with higher risk populations. Denominator exception criteria are only used in proportion measures";
+            case MEASUREPOPULATION: return "Measure population criteria define the patients or events for which the individual observation for the measure should be taken. Measure populations are used for continuous variable measures rather than numerator and denominator criteria";
+            case MEASUREPOPULATIONEXCLUSION: return "Measure population criteria define the patients or events that should be removed from the measure population before determining the outcome of one or more continuous variables defined for the measure observation. Measure population exclusion criteria are used within continuous variable measures to help narrow the measure population";
+            case MEASUREOBSERVATION: return "Defines the individual observation to be performed for each patient or event in the measure population. Measure observations for each case in the population are aggregated to determine the overall measure score for the population";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INITIALPOPULATION: return "Initial Population";
+            case NUMERATOR: return "Numerator";
+            case NUMERATOREXCLUSION: return "Numerator Exclusion";
+            case DENOMINATOR: return "Denominator";
+            case DENOMINATOREXCLUSION: return "Denominator Exclusion";
+            case DENOMINATOREXCEPTION: return "Denominator Exception";
+            case MEASUREPOPULATION: return "Measure Population";
+            case MEASUREPOPULATIONEXCLUSION: return "Measure Population Exclusion";
+            case MEASUREOBSERVATION: return "Measure Observation";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurePopulationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurePopulationEnumFactory.java
new file mode 100644
index 00000000000..dafe3459a99
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurePopulationEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MeasurePopulationEnumFactory implements EnumFactory {
+
+  public MeasurePopulation fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("initial-population".equals(codeString))
+      return MeasurePopulation.INITIALPOPULATION;
+    if ("numerator".equals(codeString))
+      return MeasurePopulation.NUMERATOR;
+    if ("numerator-exclusion".equals(codeString))
+      return MeasurePopulation.NUMERATOREXCLUSION;
+    if ("denominator".equals(codeString))
+      return MeasurePopulation.DENOMINATOR;
+    if ("denominator-exclusion".equals(codeString))
+      return MeasurePopulation.DENOMINATOREXCLUSION;
+    if ("denominator-exception".equals(codeString))
+      return MeasurePopulation.DENOMINATOREXCEPTION;
+    if ("measure-population".equals(codeString))
+      return MeasurePopulation.MEASUREPOPULATION;
+    if ("measure-population-exclusion".equals(codeString))
+      return MeasurePopulation.MEASUREPOPULATIONEXCLUSION;
+    if ("measure-observation".equals(codeString))
+      return MeasurePopulation.MEASUREOBSERVATION;
+    throw new IllegalArgumentException("Unknown MeasurePopulation code '"+codeString+"'");
+  }
+
+  public String toCode(MeasurePopulation code) {
+    if (code == MeasurePopulation.INITIALPOPULATION)
+      return "initial-population";
+    if (code == MeasurePopulation.NUMERATOR)
+      return "numerator";
+    if (code == MeasurePopulation.NUMERATOREXCLUSION)
+      return "numerator-exclusion";
+    if (code == MeasurePopulation.DENOMINATOR)
+      return "denominator";
+    if (code == MeasurePopulation.DENOMINATOREXCLUSION)
+      return "denominator-exclusion";
+    if (code == MeasurePopulation.DENOMINATOREXCEPTION)
+      return "denominator-exception";
+    if (code == MeasurePopulation.MEASUREPOPULATION)
+      return "measure-population";
+    if (code == MeasurePopulation.MEASUREPOPULATIONEXCLUSION)
+      return "measure-population-exclusion";
+    if (code == MeasurePopulation.MEASUREOBSERVATION)
+      return "measure-observation";
+    return "?";
+  }
+
+    public String toSystem(MeasurePopulation code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportStatus.java
new file mode 100644
index 00000000000..bec3bdcc2b0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MeasureReportStatus {
+
+        /**
+         * The report is complete and ready for use
+         */
+        COMPLETE, 
+        /**
+         * The report is currently being generated
+         */
+        PENDING, 
+        /**
+         * An error occurred attempting to generate the report
+         */
+        ERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MeasureReportStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("complete".equals(codeString))
+          return COMPLETE;
+        if ("pending".equals(codeString))
+          return PENDING;
+        if ("error".equals(codeString))
+          return ERROR;
+        throw new FHIRException("Unknown MeasureReportStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COMPLETE: return "complete";
+            case PENDING: return "pending";
+            case ERROR: return "error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/measure-report-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COMPLETE: return "The report is complete and ready for use";
+            case PENDING: return "The report is currently being generated";
+            case ERROR: return "An error occurred attempting to generate the report";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COMPLETE: return "Complete";
+            case PENDING: return "Pending";
+            case ERROR: return "Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportStatusEnumFactory.java
new file mode 100644
index 00000000000..beac8627747
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MeasureReportStatusEnumFactory implements EnumFactory {
+
+  public MeasureReportStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("complete".equals(codeString))
+      return MeasureReportStatus.COMPLETE;
+    if ("pending".equals(codeString))
+      return MeasureReportStatus.PENDING;
+    if ("error".equals(codeString))
+      return MeasureReportStatus.ERROR;
+    throw new IllegalArgumentException("Unknown MeasureReportStatus code '"+codeString+"'");
+  }
+
+  public String toCode(MeasureReportStatus code) {
+    if (code == MeasureReportStatus.COMPLETE)
+      return "complete";
+    if (code == MeasureReportStatus.PENDING)
+      return "pending";
+    if (code == MeasureReportStatus.ERROR)
+      return "error";
+    return "?";
+  }
+
+    public String toSystem(MeasureReportStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportType.java
new file mode 100644
index 00000000000..1f6651a1d54
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MeasureReportType {
+
+        /**
+         * An individual report that provides information on the performance for a given measure with respect to a single patient
+         */
+        INDIVIDUAL, 
+        /**
+         * A patient list report that includes a listing of patients that satisfied each population criteria in the measure
+         */
+        PATIENTLIST, 
+        /**
+         * A summary report that returns the number of patients in each population criteria for the measure
+         */
+        SUMMARY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MeasureReportType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("individual".equals(codeString))
+          return INDIVIDUAL;
+        if ("patient-list".equals(codeString))
+          return PATIENTLIST;
+        if ("summary".equals(codeString))
+          return SUMMARY;
+        throw new FHIRException("Unknown MeasureReportType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INDIVIDUAL: return "individual";
+            case PATIENTLIST: return "patient-list";
+            case SUMMARY: return "summary";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/measure-report-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INDIVIDUAL: return "An individual report that provides information on the performance for a given measure with respect to a single patient";
+            case PATIENTLIST: return "A patient list report that includes a listing of patients that satisfied each population criteria in the measure";
+            case SUMMARY: return "A summary report that returns the number of patients in each population criteria for the measure";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INDIVIDUAL: return "Individual";
+            case PATIENTLIST: return "Patient List";
+            case SUMMARY: return "Summary";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportTypeEnumFactory.java
new file mode 100644
index 00000000000..c2bd1904cd6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureReportTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MeasureReportTypeEnumFactory implements EnumFactory {
+
+  public MeasureReportType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("individual".equals(codeString))
+      return MeasureReportType.INDIVIDUAL;
+    if ("patient-list".equals(codeString))
+      return MeasureReportType.PATIENTLIST;
+    if ("summary".equals(codeString))
+      return MeasureReportType.SUMMARY;
+    throw new IllegalArgumentException("Unknown MeasureReportType code '"+codeString+"'");
+  }
+
+  public String toCode(MeasureReportType code) {
+    if (code == MeasureReportType.INDIVIDUAL)
+      return "individual";
+    if (code == MeasureReportType.PATIENTLIST)
+      return "patient-list";
+    if (code == MeasureReportType.SUMMARY)
+      return "summary";
+    return "?";
+  }
+
+    public String toSystem(MeasureReportType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureScoring.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureScoring.java
new file mode 100644
index 00000000000..d031afbb342
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureScoring.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MeasureScoring {
+
+        /**
+         * The measure score is defined using a proportion
+         */
+        PROPORTION, 
+        /**
+         * The measure score is defined using a ratio
+         */
+        RATIO, 
+        /**
+         * The score is defined by a calculation of some quantity
+         */
+        CONTINUOUSVARIABLE, 
+        /**
+         * The measure is a cohort definition
+         */
+        COHORT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MeasureScoring fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proportion".equals(codeString))
+          return PROPORTION;
+        if ("ratio".equals(codeString))
+          return RATIO;
+        if ("continuous-variable".equals(codeString))
+          return CONTINUOUSVARIABLE;
+        if ("cohort".equals(codeString))
+          return COHORT;
+        throw new FHIRException("Unknown MeasureScoring code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPORTION: return "proportion";
+            case RATIO: return "ratio";
+            case CONTINUOUSVARIABLE: return "continuous-variable";
+            case COHORT: return "cohort";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/measure-scoring";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPORTION: return "The measure score is defined using a proportion";
+            case RATIO: return "The measure score is defined using a ratio";
+            case CONTINUOUSVARIABLE: return "The score is defined by a calculation of some quantity";
+            case COHORT: return "The measure is a cohort definition";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPORTION: return "Proportion";
+            case RATIO: return "Ratio";
+            case CONTINUOUSVARIABLE: return "Continuous Variable";
+            case COHORT: return "Cohort";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureScoringEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureScoringEnumFactory.java
new file mode 100644
index 00000000000..4320204e5dd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureScoringEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MeasureScoringEnumFactory implements EnumFactory {
+
+  public MeasureScoring fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proportion".equals(codeString))
+      return MeasureScoring.PROPORTION;
+    if ("ratio".equals(codeString))
+      return MeasureScoring.RATIO;
+    if ("continuous-variable".equals(codeString))
+      return MeasureScoring.CONTINUOUSVARIABLE;
+    if ("cohort".equals(codeString))
+      return MeasureScoring.COHORT;
+    throw new IllegalArgumentException("Unknown MeasureScoring code '"+codeString+"'");
+  }
+
+  public String toCode(MeasureScoring code) {
+    if (code == MeasureScoring.PROPORTION)
+      return "proportion";
+    if (code == MeasureScoring.RATIO)
+      return "ratio";
+    if (code == MeasureScoring.CONTINUOUSVARIABLE)
+      return "continuous-variable";
+    if (code == MeasureScoring.COHORT)
+      return "cohort";
+    return "?";
+  }
+
+    public String toSystem(MeasureScoring code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureType.java
new file mode 100644
index 00000000000..a0d4adc801d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MeasureType {
+
+        /**
+         * A measure which focuses on a process which leads to a certain outcome, meaning that a scientific basis exists for believing that the process, when executed well, will increase the probability of achieving a desired outcome
+         */
+        PROCESS, 
+        /**
+         * A measure that indicates the result of the performance (or non-performance) of a function or process
+         */
+        OUTCOME, 
+        /**
+         * A measure that focuses on a health care provider's capacity, systems, and processes to provide high-quality care
+         */
+        STRUCTURE, 
+        /**
+         * A measure that focuses on patient-reported information such as patient engagement or patient experience measures
+         */
+        PATIENTREPORTEDOUTCOME, 
+        /**
+         * A measure that combines multiple component measures in to a single quality measure
+         */
+        COMPOSITE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MeasureType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("process".equals(codeString))
+          return PROCESS;
+        if ("outcome".equals(codeString))
+          return OUTCOME;
+        if ("structure".equals(codeString))
+          return STRUCTURE;
+        if ("patient-reported-outcome".equals(codeString))
+          return PATIENTREPORTEDOUTCOME;
+        if ("composite".equals(codeString))
+          return COMPOSITE;
+        throw new FHIRException("Unknown MeasureType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROCESS: return "process";
+            case OUTCOME: return "outcome";
+            case STRUCTURE: return "structure";
+            case PATIENTREPORTEDOUTCOME: return "patient-reported-outcome";
+            case COMPOSITE: return "composite";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/measure-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROCESS: return "A measure which focuses on a process which leads to a certain outcome, meaning that a scientific basis exists for believing that the process, when executed well, will increase the probability of achieving a desired outcome";
+            case OUTCOME: return "A measure that indicates the result of the performance (or non-performance) of a function or process";
+            case STRUCTURE: return "A measure that focuses on a health care provider's capacity, systems, and processes to provide high-quality care";
+            case PATIENTREPORTEDOUTCOME: return "A measure that focuses on patient-reported information such as patient engagement or patient experience measures";
+            case COMPOSITE: return "A measure that combines multiple component measures in to a single quality measure";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROCESS: return "Process";
+            case OUTCOME: return "Outcome";
+            case STRUCTURE: return "Structure";
+            case PATIENTREPORTEDOUTCOME: return "Patient Reported Outcome";
+            case COMPOSITE: return "Composite";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureTypeEnumFactory.java
new file mode 100644
index 00000000000..c964ed24e14
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasureTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MeasureTypeEnumFactory implements EnumFactory {
+
+  public MeasureType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("process".equals(codeString))
+      return MeasureType.PROCESS;
+    if ("outcome".equals(codeString))
+      return MeasureType.OUTCOME;
+    if ("structure".equals(codeString))
+      return MeasureType.STRUCTURE;
+    if ("patient-reported-outcome".equals(codeString))
+      return MeasureType.PATIENTREPORTEDOUTCOME;
+    if ("composite".equals(codeString))
+      return MeasureType.COMPOSITE;
+    throw new IllegalArgumentException("Unknown MeasureType code '"+codeString+"'");
+  }
+
+  public String toCode(MeasureType code) {
+    if (code == MeasureType.PROCESS)
+      return "process";
+    if (code == MeasureType.OUTCOME)
+      return "outcome";
+    if (code == MeasureType.STRUCTURE)
+      return "structure";
+    if (code == MeasureType.PATIENTREPORTEDOUTCOME)
+      return "patient-reported-outcome";
+    if (code == MeasureType.COMPOSITE)
+      return "composite";
+    return "?";
+  }
+
+    public String toSystem(MeasureType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurementPrinciple.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurementPrinciple.java
new file mode 100644
index 00000000000..a8a2643338a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurementPrinciple.java
@@ -0,0 +1,168 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MeasurementPrinciple {
+
+        /**
+         * Measurement principle isn't in the list.
+         */
+        OTHER, 
+        /**
+         * Measurement is done using the chemical principle.
+         */
+        CHEMICAL, 
+        /**
+         * Measurement is done using the electrical principle.
+         */
+        ELECTRICAL, 
+        /**
+         * Measurement is done using the impedance principle.
+         */
+        IMPEDANCE, 
+        /**
+         * Measurement is done using the nuclear principle.
+         */
+        NUCLEAR, 
+        /**
+         * Measurement is done using the optical principle.
+         */
+        OPTICAL, 
+        /**
+         * Measurement is done using the thermal principle.
+         */
+        THERMAL, 
+        /**
+         * Measurement is done using the biological principle.
+         */
+        BIOLOGICAL, 
+        /**
+         * Measurement is done using the mechanical principle.
+         */
+        MECHANICAL, 
+        /**
+         * Measurement is done using the acoustical principle.
+         */
+        ACOUSTICAL, 
+        /**
+         * Measurement is done using the manual principle.
+         */
+        MANUAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MeasurementPrinciple fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("other".equals(codeString))
+          return OTHER;
+        if ("chemical".equals(codeString))
+          return CHEMICAL;
+        if ("electrical".equals(codeString))
+          return ELECTRICAL;
+        if ("impedance".equals(codeString))
+          return IMPEDANCE;
+        if ("nuclear".equals(codeString))
+          return NUCLEAR;
+        if ("optical".equals(codeString))
+          return OPTICAL;
+        if ("thermal".equals(codeString))
+          return THERMAL;
+        if ("biological".equals(codeString))
+          return BIOLOGICAL;
+        if ("mechanical".equals(codeString))
+          return MECHANICAL;
+        if ("acoustical".equals(codeString))
+          return ACOUSTICAL;
+        if ("manual".equals(codeString))
+          return MANUAL;
+        throw new FHIRException("Unknown MeasurementPrinciple code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OTHER: return "other";
+            case CHEMICAL: return "chemical";
+            case ELECTRICAL: return "electrical";
+            case IMPEDANCE: return "impedance";
+            case NUCLEAR: return "nuclear";
+            case OPTICAL: return "optical";
+            case THERMAL: return "thermal";
+            case BIOLOGICAL: return "biological";
+            case MECHANICAL: return "mechanical";
+            case ACOUSTICAL: return "acoustical";
+            case MANUAL: return "manual";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/measurement-principle";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OTHER: return "Measurement principle isn't in the list.";
+            case CHEMICAL: return "Measurement is done using the chemical principle.";
+            case ELECTRICAL: return "Measurement is done using the electrical principle.";
+            case IMPEDANCE: return "Measurement is done using the impedance principle.";
+            case NUCLEAR: return "Measurement is done using the nuclear principle.";
+            case OPTICAL: return "Measurement is done using the optical principle.";
+            case THERMAL: return "Measurement is done using the thermal principle.";
+            case BIOLOGICAL: return "Measurement is done using the biological principle.";
+            case MECHANICAL: return "Measurement is done using the mechanical principle.";
+            case ACOUSTICAL: return "Measurement is done using the acoustical principle.";
+            case MANUAL: return "Measurement is done using the manual principle.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OTHER: return "MSP Other";
+            case CHEMICAL: return "MSP Chemical";
+            case ELECTRICAL: return "MSP Electrical";
+            case IMPEDANCE: return "MSP Impedance";
+            case NUCLEAR: return "MSP Nuclear";
+            case OPTICAL: return "MSP Optical";
+            case THERMAL: return "MSP Thermal";
+            case BIOLOGICAL: return "MSP Biological";
+            case MECHANICAL: return "MSP Mechanical";
+            case ACOUSTICAL: return "MSP Acoustical";
+            case MANUAL: return "MSP Manual";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurementPrincipleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurementPrincipleEnumFactory.java
new file mode 100644
index 00000000000..899be9070da
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MeasurementPrincipleEnumFactory.java
@@ -0,0 +1,98 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MeasurementPrincipleEnumFactory implements EnumFactory {
+
+  public MeasurementPrinciple fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("other".equals(codeString))
+      return MeasurementPrinciple.OTHER;
+    if ("chemical".equals(codeString))
+      return MeasurementPrinciple.CHEMICAL;
+    if ("electrical".equals(codeString))
+      return MeasurementPrinciple.ELECTRICAL;
+    if ("impedance".equals(codeString))
+      return MeasurementPrinciple.IMPEDANCE;
+    if ("nuclear".equals(codeString))
+      return MeasurementPrinciple.NUCLEAR;
+    if ("optical".equals(codeString))
+      return MeasurementPrinciple.OPTICAL;
+    if ("thermal".equals(codeString))
+      return MeasurementPrinciple.THERMAL;
+    if ("biological".equals(codeString))
+      return MeasurementPrinciple.BIOLOGICAL;
+    if ("mechanical".equals(codeString))
+      return MeasurementPrinciple.MECHANICAL;
+    if ("acoustical".equals(codeString))
+      return MeasurementPrinciple.ACOUSTICAL;
+    if ("manual".equals(codeString))
+      return MeasurementPrinciple.MANUAL;
+    throw new IllegalArgumentException("Unknown MeasurementPrinciple code '"+codeString+"'");
+  }
+
+  public String toCode(MeasurementPrinciple code) {
+    if (code == MeasurementPrinciple.OTHER)
+      return "other";
+    if (code == MeasurementPrinciple.CHEMICAL)
+      return "chemical";
+    if (code == MeasurementPrinciple.ELECTRICAL)
+      return "electrical";
+    if (code == MeasurementPrinciple.IMPEDANCE)
+      return "impedance";
+    if (code == MeasurementPrinciple.NUCLEAR)
+      return "nuclear";
+    if (code == MeasurementPrinciple.OPTICAL)
+      return "optical";
+    if (code == MeasurementPrinciple.THERMAL)
+      return "thermal";
+    if (code == MeasurementPrinciple.BIOLOGICAL)
+      return "biological";
+    if (code == MeasurementPrinciple.MECHANICAL)
+      return "mechanical";
+    if (code == MeasurementPrinciple.ACOUSTICAL)
+      return "acoustical";
+    if (code == MeasurementPrinciple.MANUAL)
+      return "manual";
+    return "?";
+  }
+
+    public String toSystem(MeasurementPrinciple code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminCategory.java
new file mode 100644
index 00000000000..477e733b4be
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminCategory.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationAdminCategory {
+
+        /**
+         * Includes administrations in an inpatient or acute care setting
+         */
+        INPATIENT, 
+        /**
+         * Includes administrations in an outpatient setting (for example, Emergency Department, Outpatient Clinic, Outpatient Surgery, Doctor's office)
+         */
+        OUTPATIENT, 
+        /**
+         * Includes administrations by the patient in their home (this would include long term care or nursing homes, hospices, etc)
+         */
+        COMMUNITY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationAdminCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("inpatient".equals(codeString))
+          return INPATIENT;
+        if ("outpatient".equals(codeString))
+          return OUTPATIENT;
+        if ("community".equals(codeString))
+          return COMMUNITY;
+        throw new FHIRException("Unknown MedicationAdminCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INPATIENT: return "inpatient";
+            case OUTPATIENT: return "outpatient";
+            case COMMUNITY: return "community";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-admin-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INPATIENT: return "Includes administrations in an inpatient or acute care setting";
+            case OUTPATIENT: return "Includes administrations in an outpatient setting (for example, Emergency Department, Outpatient Clinic, Outpatient Surgery, Doctor's office)";
+            case COMMUNITY: return "Includes administrations by the patient in their home (this would include long term care or nursing homes, hospices, etc)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INPATIENT: return "Inpatient";
+            case OUTPATIENT: return "Outpatient";
+            case COMMUNITY: return "Community";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminCategoryEnumFactory.java
new file mode 100644
index 00000000000..91cb21fc6f3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminCategoryEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationAdminCategoryEnumFactory implements EnumFactory {
+
+  public MedicationAdminCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("inpatient".equals(codeString))
+      return MedicationAdminCategory.INPATIENT;
+    if ("outpatient".equals(codeString))
+      return MedicationAdminCategory.OUTPATIENT;
+    if ("community".equals(codeString))
+      return MedicationAdminCategory.COMMUNITY;
+    throw new IllegalArgumentException("Unknown MedicationAdminCategory code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationAdminCategory code) {
+    if (code == MedicationAdminCategory.INPATIENT)
+      return "inpatient";
+    if (code == MedicationAdminCategory.OUTPATIENT)
+      return "outpatient";
+    if (code == MedicationAdminCategory.COMMUNITY)
+      return "community";
+    return "?";
+  }
+
+    public String toSystem(MedicationAdminCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminStatus.java
new file mode 100644
index 00000000000..a7469641b81
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationAdminStatus {
+
+        /**
+         * The administration has started but has not yet completed.
+         */
+        INPROGRESS, 
+        /**
+         * Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called "suspended".
+         */
+        ONHOLD, 
+        /**
+         * All actions that are implied by the administration have occurred.
+         */
+        COMPLETED, 
+        /**
+         * The administration was entered in error and therefore nullified.
+         */
+        ENTEREDINERROR, 
+        /**
+         * Actions implied by the administration have been permanently halted, before all of them occurred.
+         */
+        STOPPED, 
+        /**
+         * 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
+         */
+        NULL;
+        public static MedicationAdminStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("on-hold".equals(codeString))
+          return ONHOLD;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("stopped".equals(codeString))
+          return STOPPED;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown MedicationAdminStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INPROGRESS: return "in-progress";
+            case ONHOLD: return "on-hold";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case STOPPED: return "stopped";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-admin-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INPROGRESS: return "The administration has started but has not yet completed.";
+            case ONHOLD: return "Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called \"suspended\".";
+            case COMPLETED: return "All actions that are implied by the administration have occurred.";
+            case ENTEREDINERROR: return "The administration was entered in error and therefore nullified.";
+            case STOPPED: return "Actions implied by the administration have been permanently halted, before all of them occurred.";
+            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 INPROGRESS: return "In Progress";
+            case ONHOLD: return "On Hold";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            case STOPPED: return "Stopped";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminStatusEnumFactory.java
new file mode 100644
index 00000000000..ac89467e122
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationAdminStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationAdminStatusEnumFactory implements EnumFactory {
+
+  public MedicationAdminStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("in-progress".equals(codeString))
+      return MedicationAdminStatus.INPROGRESS;
+    if ("on-hold".equals(codeString))
+      return MedicationAdminStatus.ONHOLD;
+    if ("completed".equals(codeString))
+      return MedicationAdminStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return MedicationAdminStatus.ENTEREDINERROR;
+    if ("stopped".equals(codeString))
+      return MedicationAdminStatus.STOPPED;
+    if ("unknown".equals(codeString))
+      return MedicationAdminStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown MedicationAdminStatus code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationAdminStatus code) {
+    if (code == MedicationAdminStatus.INPROGRESS)
+      return "in-progress";
+    if (code == MedicationAdminStatus.ONHOLD)
+      return "on-hold";
+    if (code == MedicationAdminStatus.COMPLETED)
+      return "completed";
+    if (code == MedicationAdminStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == MedicationAdminStatus.STOPPED)
+      return "stopped";
+    if (code == MedicationAdminStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(MedicationAdminStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseCategory.java
new file mode 100644
index 00000000000..d7da95c4c76
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseCategory.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationDispenseCategory {
+
+        /**
+         * Includes dispenses for medications to be administered or consumed in an inpatient or acute care setting
+         */
+        INPATIENT, 
+        /**
+         * Includes dispenses for medications to be administered or consumed in an outpatient setting (for example, Emergency Department, Outpatient Clinic, Outpatient Surgery, Doctor's office)
+         */
+        OUTPATIENT, 
+        /**
+         * Includes dispenses for medications to be administered or consumed by the patient in their home (this would include long term care or nursing homes, hospices, etc)
+         */
+        COMMUNITY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationDispenseCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("inpatient".equals(codeString))
+          return INPATIENT;
+        if ("outpatient".equals(codeString))
+          return OUTPATIENT;
+        if ("community".equals(codeString))
+          return COMMUNITY;
+        throw new FHIRException("Unknown MedicationDispenseCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INPATIENT: return "inpatient";
+            case OUTPATIENT: return "outpatient";
+            case COMMUNITY: return "community";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-dispense-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INPATIENT: return "Includes dispenses for medications to be administered or consumed in an inpatient or acute care setting";
+            case OUTPATIENT: return "Includes dispenses for medications to be administered or consumed in an outpatient setting (for example, Emergency Department, Outpatient Clinic, Outpatient Surgery, Doctor's office)";
+            case COMMUNITY: return "Includes dispenses for medications to be administered or consumed by the patient in their home (this would include long term care or nursing homes, hospices, etc)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INPATIENT: return "Inpatient";
+            case OUTPATIENT: return "Outpatient";
+            case COMMUNITY: return "Community";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseCategoryEnumFactory.java
new file mode 100644
index 00000000000..c2556a1328d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseCategoryEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationDispenseCategoryEnumFactory implements EnumFactory {
+
+  public MedicationDispenseCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("inpatient".equals(codeString))
+      return MedicationDispenseCategory.INPATIENT;
+    if ("outpatient".equals(codeString))
+      return MedicationDispenseCategory.OUTPATIENT;
+    if ("community".equals(codeString))
+      return MedicationDispenseCategory.COMMUNITY;
+    throw new IllegalArgumentException("Unknown MedicationDispenseCategory code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationDispenseCategory code) {
+    if (code == MedicationDispenseCategory.INPATIENT)
+      return "inpatient";
+    if (code == MedicationDispenseCategory.OUTPATIENT)
+      return "outpatient";
+    if (code == MedicationDispenseCategory.COMMUNITY)
+      return "community";
+    return "?";
+  }
+
+    public String toSystem(MedicationDispenseCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseStatus.java
new file mode 100644
index 00000000000..3f81d37a8a9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationDispenseStatus {
+
+        /**
+         * The core event has not started yet, but some staging activities have begun (e.g. initial compounding or packaging of medication). Preparation stages may be tracked for billing purposes.
+         */
+        PREPARATION, 
+        /**
+         * The dispense has started but has not yet completed.
+         */
+        INPROGRESS, 
+        /**
+         * Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called "suspended"
+         */
+        ONHOLD, 
+        /**
+         * All actions that are implied by the dispense have occurred.
+         */
+        COMPLETED, 
+        /**
+         * The dispense was entered in error and therefore nullified.
+         */
+        ENTEREDINERROR, 
+        /**
+         * Actions implied by the dispense have been permanently halted, before all of them occurred.
+         */
+        STOPPED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationDispenseStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("preparation".equals(codeString))
+          return PREPARATION;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("on-hold".equals(codeString))
+          return ONHOLD;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("stopped".equals(codeString))
+          return STOPPED;
+        throw new FHIRException("Unknown MedicationDispenseStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PREPARATION: return "preparation";
+            case INPROGRESS: return "in-progress";
+            case ONHOLD: return "on-hold";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case STOPPED: return "stopped";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-dispense-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PREPARATION: return "The core event has not started yet, but some staging activities have begun (e.g. initial compounding or packaging of medication). Preparation stages may be tracked for billing purposes.";
+            case INPROGRESS: return "The dispense has started but has not yet completed.";
+            case ONHOLD: return "Actions implied by the administration have been temporarily halted, but are expected to continue later. May also be called \"suspended\"";
+            case COMPLETED: return "All actions that are implied by the dispense have occurred.";
+            case ENTEREDINERROR: return "The dispense was entered in error and therefore nullified.";
+            case STOPPED: return "Actions implied by the dispense have been permanently halted, before all of them occurred.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PREPARATION: return "Preparation";
+            case INPROGRESS: return "In Progress";
+            case ONHOLD: return "On Hold";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in-Error";
+            case STOPPED: return "Stopped";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseStatusEnumFactory.java
new file mode 100644
index 00000000000..48792161c55
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationDispenseStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationDispenseStatusEnumFactory implements EnumFactory {
+
+  public MedicationDispenseStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("preparation".equals(codeString))
+      return MedicationDispenseStatus.PREPARATION;
+    if ("in-progress".equals(codeString))
+      return MedicationDispenseStatus.INPROGRESS;
+    if ("on-hold".equals(codeString))
+      return MedicationDispenseStatus.ONHOLD;
+    if ("completed".equals(codeString))
+      return MedicationDispenseStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return MedicationDispenseStatus.ENTEREDINERROR;
+    if ("stopped".equals(codeString))
+      return MedicationDispenseStatus.STOPPED;
+    throw new IllegalArgumentException("Unknown MedicationDispenseStatus code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationDispenseStatus code) {
+    if (code == MedicationDispenseStatus.PREPARATION)
+      return "preparation";
+    if (code == MedicationDispenseStatus.INPROGRESS)
+      return "in-progress";
+    if (code == MedicationDispenseStatus.ONHOLD)
+      return "on-hold";
+    if (code == MedicationDispenseStatus.COMPLETED)
+      return "completed";
+    if (code == MedicationDispenseStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == MedicationDispenseStatus.STOPPED)
+      return "stopped";
+    return "?";
+  }
+
+    public String toSystem(MedicationDispenseStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationPackageForm.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationPackageForm.java
new file mode 100644
index 00000000000..40e35483d34
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationPackageForm.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationPackageForm {
+
+        /**
+         * A sealed glass capsule containing a liquid
+         */
+        AMPOULE, 
+        /**
+         * A container, typically made of glass or plastic and with a narrow neck, used for storing liquids.
+         */
+        BOTTLE, 
+        /**
+         * A container with a flat base and sides, typically square or rectangular and having a lid.
+         */
+        BOX, 
+        /**
+         * A device of various configuration and composition used with a syringe for the application of anesthetic or other materials to a patient.
+         */
+        CARTRIDGE, 
+        /**
+         * A package intended to store pharmaceuticals.
+         */
+        CONTAINER, 
+        /**
+         * A long, hollow cylinder of metal, plastic, glass, etc., for holding medications, typically creams or ointments
+         */
+        TUBE, 
+        /**
+         * A dose of medicine prepared in an individual package for convenience, safety or monitoring.
+         */
+        UNITDOSE, 
+        /**
+         * A small container, typically cylindrical and made of glass, used especially for holding liquid medications.
+         */
+        VIAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationPackageForm fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ampoule".equals(codeString))
+          return AMPOULE;
+        if ("bottle".equals(codeString))
+          return BOTTLE;
+        if ("box".equals(codeString))
+          return BOX;
+        if ("cartridge".equals(codeString))
+          return CARTRIDGE;
+        if ("container".equals(codeString))
+          return CONTAINER;
+        if ("tube".equals(codeString))
+          return TUBE;
+        if ("unitdose".equals(codeString))
+          return UNITDOSE;
+        if ("vial".equals(codeString))
+          return VIAL;
+        throw new FHIRException("Unknown MedicationPackageForm code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AMPOULE: return "ampoule";
+            case BOTTLE: return "bottle";
+            case BOX: return "box";
+            case CARTRIDGE: return "cartridge";
+            case CONTAINER: return "container";
+            case TUBE: return "tube";
+            case UNITDOSE: return "unitdose";
+            case VIAL: return "vial";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-package-form";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AMPOULE: return "A sealed glass capsule containing a liquid";
+            case BOTTLE: return "A container, typically made of glass or plastic and with a narrow neck, used for storing liquids.";
+            case BOX: return "A container with a flat base and sides, typically square or rectangular and having a lid.";
+            case CARTRIDGE: return "A device of various configuration and composition used with a syringe for the application of anesthetic or other materials to a patient.";
+            case CONTAINER: return "A package intended to store pharmaceuticals.";
+            case TUBE: return "A long, hollow cylinder of metal, plastic, glass, etc., for holding medications, typically creams or ointments";
+            case UNITDOSE: return "A dose of medicine prepared in an individual package for convenience, safety or monitoring.";
+            case VIAL: return "A small container, typically cylindrical and made of glass, used especially for holding liquid medications.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AMPOULE: return "Ampoule";
+            case BOTTLE: return "Bottle";
+            case BOX: return "Box";
+            case CARTRIDGE: return "Cartridge";
+            case CONTAINER: return "Container";
+            case TUBE: return "Tube";
+            case UNITDOSE: return "Unit Dose Blister";
+            case VIAL: return "Vial";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationPackageFormEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationPackageFormEnumFactory.java
new file mode 100644
index 00000000000..71e78879242
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationPackageFormEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationPackageFormEnumFactory implements EnumFactory {
+
+  public MedicationPackageForm fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ampoule".equals(codeString))
+      return MedicationPackageForm.AMPOULE;
+    if ("bottle".equals(codeString))
+      return MedicationPackageForm.BOTTLE;
+    if ("box".equals(codeString))
+      return MedicationPackageForm.BOX;
+    if ("cartridge".equals(codeString))
+      return MedicationPackageForm.CARTRIDGE;
+    if ("container".equals(codeString))
+      return MedicationPackageForm.CONTAINER;
+    if ("tube".equals(codeString))
+      return MedicationPackageForm.TUBE;
+    if ("unitdose".equals(codeString))
+      return MedicationPackageForm.UNITDOSE;
+    if ("vial".equals(codeString))
+      return MedicationPackageForm.VIAL;
+    throw new IllegalArgumentException("Unknown MedicationPackageForm code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationPackageForm code) {
+    if (code == MedicationPackageForm.AMPOULE)
+      return "ampoule";
+    if (code == MedicationPackageForm.BOTTLE)
+      return "bottle";
+    if (code == MedicationPackageForm.BOX)
+      return "box";
+    if (code == MedicationPackageForm.CARTRIDGE)
+      return "cartridge";
+    if (code == MedicationPackageForm.CONTAINER)
+      return "container";
+    if (code == MedicationPackageForm.TUBE)
+      return "tube";
+    if (code == MedicationPackageForm.UNITDOSE)
+      return "unitdose";
+    if (code == MedicationPackageForm.VIAL)
+      return "vial";
+    return "?";
+  }
+
+    public String toSystem(MedicationPackageForm code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestCategory.java
new file mode 100644
index 00000000000..97509d31240
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestCategory.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationRequestCategory {
+
+        /**
+         * Includes orders for medications to be administered or consumed in an inpatient or acute care setting
+         */
+        INPATIENT, 
+        /**
+         * Includes orders for medications to be administered or consumed in an outpatient setting (for example, Emergency Department, Outpatient Clinic, Outpatient Surgery, Doctor's office)
+         */
+        OUTPATIENT, 
+        /**
+         * Includes orders for medications to be administered or consumed by the patient in their home (this would include long term care or nursing homes, hospices, etc)
+         */
+        COMMUNITY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationRequestCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("inpatient".equals(codeString))
+          return INPATIENT;
+        if ("outpatient".equals(codeString))
+          return OUTPATIENT;
+        if ("community".equals(codeString))
+          return COMMUNITY;
+        throw new FHIRException("Unknown MedicationRequestCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INPATIENT: return "inpatient";
+            case OUTPATIENT: return "outpatient";
+            case COMMUNITY: return "community";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-request-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INPATIENT: return "Includes orders for medications to be administered or consumed in an inpatient or acute care setting";
+            case OUTPATIENT: return "Includes orders for medications to be administered or consumed in an outpatient setting (for example, Emergency Department, Outpatient Clinic, Outpatient Surgery, Doctor's office)";
+            case COMMUNITY: return "Includes orders for medications to be administered or consumed by the patient in their home (this would include long term care or nursing homes, hospices, etc)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INPATIENT: return "Inpatient";
+            case OUTPATIENT: return "Outpatient";
+            case COMMUNITY: return "Community";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestCategoryEnumFactory.java
new file mode 100644
index 00000000000..3d824f9f400
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestCategoryEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationRequestCategoryEnumFactory implements EnumFactory {
+
+  public MedicationRequestCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("inpatient".equals(codeString))
+      return MedicationRequestCategory.INPATIENT;
+    if ("outpatient".equals(codeString))
+      return MedicationRequestCategory.OUTPATIENT;
+    if ("community".equals(codeString))
+      return MedicationRequestCategory.COMMUNITY;
+    throw new IllegalArgumentException("Unknown MedicationRequestCategory code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationRequestCategory code) {
+    if (code == MedicationRequestCategory.INPATIENT)
+      return "inpatient";
+    if (code == MedicationRequestCategory.OUTPATIENT)
+      return "outpatient";
+    if (code == MedicationRequestCategory.COMMUNITY)
+      return "community";
+    return "?";
+  }
+
+    public String toSystem(MedicationRequestCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestIntent.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestIntent.java
new file mode 100644
index 00000000000..14862028c1c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestIntent.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationRequestIntent {
+
+        /**
+         * The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act
+         */
+        PROPOSAL, 
+        /**
+         * The request represents an intension to ensure something occurs without providing an authorization for others to act
+         */
+        PLAN, 
+        /**
+         * The request represents a request/demand and authorization for action
+         */
+        ORDER, 
+        /**
+         * The request represents an instance for the particular order, for example a medication administration record.
+         */
+        INSTANCEORDER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationRequestIntent fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposal".equals(codeString))
+          return PROPOSAL;
+        if ("plan".equals(codeString))
+          return PLAN;
+        if ("order".equals(codeString))
+          return ORDER;
+        if ("instance-order".equals(codeString))
+          return INSTANCEORDER;
+        throw new FHIRException("Unknown MedicationRequestIntent code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSAL: return "proposal";
+            case PLAN: return "plan";
+            case ORDER: return "order";
+            case INSTANCEORDER: return "instance-order";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-request-intent";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSAL: return "The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act";
+            case PLAN: return "The request represents an intension to ensure something occurs without providing an authorization for others to act";
+            case ORDER: return "The request represents a request/demand and authorization for action";
+            case INSTANCEORDER: return "The request represents an instance for the particular order, for example a medication administration record.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSAL: return "Proposal";
+            case PLAN: return "Plan";
+            case ORDER: return "Order";
+            case INSTANCEORDER: return "Instance Order";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestIntentEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestIntentEnumFactory.java
new file mode 100644
index 00000000000..b09c5d092ee
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestIntentEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationRequestIntentEnumFactory implements EnumFactory {
+
+  public MedicationRequestIntent fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposal".equals(codeString))
+      return MedicationRequestIntent.PROPOSAL;
+    if ("plan".equals(codeString))
+      return MedicationRequestIntent.PLAN;
+    if ("order".equals(codeString))
+      return MedicationRequestIntent.ORDER;
+    if ("instance-order".equals(codeString))
+      return MedicationRequestIntent.INSTANCEORDER;
+    throw new IllegalArgumentException("Unknown MedicationRequestIntent code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationRequestIntent code) {
+    if (code == MedicationRequestIntent.PROPOSAL)
+      return "proposal";
+    if (code == MedicationRequestIntent.PLAN)
+      return "plan";
+    if (code == MedicationRequestIntent.ORDER)
+      return "order";
+    if (code == MedicationRequestIntent.INSTANCEORDER)
+      return "instance-order";
+    return "?";
+  }
+
+    public String toSystem(MedicationRequestIntent code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestPriority.java
new file mode 100644
index 00000000000..00c79038cd4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestPriority.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationRequestPriority {
+
+        /**
+         * The order has a normal priority .
+         */
+        ROUTINE, 
+        /**
+         * The order should be urgently.
+         */
+        URGENT, 
+        /**
+         * The order is time-critical.
+         */
+        STAT, 
+        /**
+         * The order should be acted on as soon as possible.
+         */
+        ASAP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationRequestPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("routine".equals(codeString))
+          return ROUTINE;
+        if ("urgent".equals(codeString))
+          return URGENT;
+        if ("stat".equals(codeString))
+          return STAT;
+        if ("asap".equals(codeString))
+          return ASAP;
+        throw new FHIRException("Unknown MedicationRequestPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ROUTINE: return "routine";
+            case URGENT: return "urgent";
+            case STAT: return "stat";
+            case ASAP: return "asap";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-request-priority";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ROUTINE: return "The order has a normal priority .";
+            case URGENT: return "The order should be urgently.";
+            case STAT: return "The order is time-critical.";
+            case ASAP: return "The order should be acted on as soon as possible.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ROUTINE: return "Routine";
+            case URGENT: return "Urgent";
+            case STAT: return "Stat";
+            case ASAP: return "ASAP";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestPriorityEnumFactory.java
new file mode 100644
index 00000000000..3ae1dd0e002
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestPriorityEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationRequestPriorityEnumFactory implements EnumFactory {
+
+  public MedicationRequestPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("routine".equals(codeString))
+      return MedicationRequestPriority.ROUTINE;
+    if ("urgent".equals(codeString))
+      return MedicationRequestPriority.URGENT;
+    if ("stat".equals(codeString))
+      return MedicationRequestPriority.STAT;
+    if ("asap".equals(codeString))
+      return MedicationRequestPriority.ASAP;
+    throw new IllegalArgumentException("Unknown MedicationRequestPriority code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationRequestPriority code) {
+    if (code == MedicationRequestPriority.ROUTINE)
+      return "routine";
+    if (code == MedicationRequestPriority.URGENT)
+      return "urgent";
+    if (code == MedicationRequestPriority.STAT)
+      return "stat";
+    if (code == MedicationRequestPriority.ASAP)
+      return "asap";
+    return "?";
+  }
+
+    public String toSystem(MedicationRequestPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestStatus.java
new file mode 100644
index 00000000000..e70aa3a829b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestStatus.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationRequestStatus {
+
+        /**
+         * The prescription is 'actionable', but not all actions that are implied by it have occurred yet.
+         */
+        ACTIVE, 
+        /**
+         * Actions implied by the prescription are to be temporarily halted, but are expected to continue later.  May also be called "suspended".
+         */
+        ONHOLD, 
+        /**
+         * The prescription has been withdrawn.
+         */
+        CANCELLED, 
+        /**
+         * All actions that are implied by the prescription have occurred.
+         */
+        COMPLETED, 
+        /**
+         * The prescription was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * Actions implied by the prescription are to be permanently halted, before all of them occurred.
+         */
+        STOPPED, 
+        /**
+         * The prescription is not yet 'actionable', i.e. it is a work in progress, requires sign-off or verification, and needs to be run through decision support process.
+         */
+        DRAFT, 
+        /**
+         * The authoring system does not know which of the status values currently applies for this request
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationRequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("on-hold".equals(codeString))
+          return ONHOLD;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("stopped".equals(codeString))
+          return STOPPED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown MedicationRequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case ONHOLD: return "on-hold";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case STOPPED: return "stopped";
+            case DRAFT: return "draft";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-request-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The prescription is 'actionable', but not all actions that are implied by it have occurred yet.";
+            case ONHOLD: return "Actions implied by the prescription are to be temporarily halted, but are expected to continue later.  May also be called \"suspended\".";
+            case CANCELLED: return "The prescription has been withdrawn.";
+            case COMPLETED: return "All actions that are implied by the prescription have occurred.";
+            case ENTEREDINERROR: return "The prescription was entered in error.";
+            case STOPPED: return "Actions implied by the prescription are to be permanently halted, before all of them occurred.";
+            case DRAFT: return "The prescription is not yet 'actionable', i.e. it is a work in progress, requires sign-off or verification, and needs to be run through decision support process.";
+            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this request";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case ONHOLD: return "On Hold";
+            case CANCELLED: return "Cancelled";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered In Error";
+            case STOPPED: return "Stopped";
+            case DRAFT: return "Draft";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestStatusEnumFactory.java
new file mode 100644
index 00000000000..d7745252380
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationRequestStatusEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationRequestStatusEnumFactory implements EnumFactory {
+
+  public MedicationRequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return MedicationRequestStatus.ACTIVE;
+    if ("on-hold".equals(codeString))
+      return MedicationRequestStatus.ONHOLD;
+    if ("cancelled".equals(codeString))
+      return MedicationRequestStatus.CANCELLED;
+    if ("completed".equals(codeString))
+      return MedicationRequestStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return MedicationRequestStatus.ENTEREDINERROR;
+    if ("stopped".equals(codeString))
+      return MedicationRequestStatus.STOPPED;
+    if ("draft".equals(codeString))
+      return MedicationRequestStatus.DRAFT;
+    if ("unknown".equals(codeString))
+      return MedicationRequestStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown MedicationRequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationRequestStatus code) {
+    if (code == MedicationRequestStatus.ACTIVE)
+      return "active";
+    if (code == MedicationRequestStatus.ONHOLD)
+      return "on-hold";
+    if (code == MedicationRequestStatus.CANCELLED)
+      return "cancelled";
+    if (code == MedicationRequestStatus.COMPLETED)
+      return "completed";
+    if (code == MedicationRequestStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == MedicationRequestStatus.STOPPED)
+      return "stopped";
+    if (code == MedicationRequestStatus.DRAFT)
+      return "draft";
+    if (code == MedicationRequestStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(MedicationRequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementCategory.java
new file mode 100644
index 00000000000..431166f0a2d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementCategory.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationStatementCategory {
+
+        /**
+         * Includes orders for medications to be administered or consumed in an inpatient or acute care setting
+         */
+        INPATIENT, 
+        /**
+         * Includes orders for medications to be administered or consumed in an outpatient setting (for example, Emergency Department, Outpatient Clinic, Outpatient Surgery, Doctor's office)
+         */
+        OUTPATIENT, 
+        /**
+         * Includes orders for medications to be administered or consumed by the patient in their home (this would include long term care or nursing homes, hospices, etc)
+         */
+        COMMUNITY, 
+        /**
+         * Includes statements about medication use, including over the counter medication, provided by the patient, agent or another provider
+         */
+        PATIENTSPECIFIED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationStatementCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("inpatient".equals(codeString))
+          return INPATIENT;
+        if ("outpatient".equals(codeString))
+          return OUTPATIENT;
+        if ("community".equals(codeString))
+          return COMMUNITY;
+        if ("patientspecified".equals(codeString))
+          return PATIENTSPECIFIED;
+        throw new FHIRException("Unknown MedicationStatementCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INPATIENT: return "inpatient";
+            case OUTPATIENT: return "outpatient";
+            case COMMUNITY: return "community";
+            case PATIENTSPECIFIED: return "patientspecified";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-statement-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INPATIENT: return "Includes orders for medications to be administered or consumed in an inpatient or acute care setting";
+            case OUTPATIENT: return "Includes orders for medications to be administered or consumed in an outpatient setting (for example, Emergency Department, Outpatient Clinic, Outpatient Surgery, Doctor's office)";
+            case COMMUNITY: return "Includes orders for medications to be administered or consumed by the patient in their home (this would include long term care or nursing homes, hospices, etc)";
+            case PATIENTSPECIFIED: return "Includes statements about medication use, including over the counter medication, provided by the patient, agent or another provider";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INPATIENT: return "Inpatient";
+            case OUTPATIENT: return "Outpatient";
+            case COMMUNITY: return "Community";
+            case PATIENTSPECIFIED: return "Patient Specified";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementCategoryEnumFactory.java
new file mode 100644
index 00000000000..1eb1b62e3ff
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementCategoryEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationStatementCategoryEnumFactory implements EnumFactory {
+
+  public MedicationStatementCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("inpatient".equals(codeString))
+      return MedicationStatementCategory.INPATIENT;
+    if ("outpatient".equals(codeString))
+      return MedicationStatementCategory.OUTPATIENT;
+    if ("community".equals(codeString))
+      return MedicationStatementCategory.COMMUNITY;
+    if ("patientspecified".equals(codeString))
+      return MedicationStatementCategory.PATIENTSPECIFIED;
+    throw new IllegalArgumentException("Unknown MedicationStatementCategory code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationStatementCategory code) {
+    if (code == MedicationStatementCategory.INPATIENT)
+      return "inpatient";
+    if (code == MedicationStatementCategory.OUTPATIENT)
+      return "outpatient";
+    if (code == MedicationStatementCategory.COMMUNITY)
+      return "community";
+    if (code == MedicationStatementCategory.PATIENTSPECIFIED)
+      return "patientspecified";
+    return "?";
+  }
+
+    public String toSystem(MedicationStatementCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementNottaken.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementNottaken.java
new file mode 100644
index 00000000000..db88e2c44e1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementNottaken.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationStatementNottaken {
+
+        /**
+         * Positive assertion that patient has taken medication
+         */
+        Y, 
+        /**
+         * Negative assertion that patient has not taken medication
+         */
+        N, 
+        /**
+         * Unknown assertion if patient has taken medication
+         */
+        UNK, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationStatementNottaken fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("y".equals(codeString))
+          return Y;
+        if ("n".equals(codeString))
+          return N;
+        if ("unk".equals(codeString))
+          return UNK;
+        throw new FHIRException("Unknown MedicationStatementNottaken code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case Y: return "y";
+            case N: return "n";
+            case UNK: return "unk";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-statement-nottaken";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case Y: return "Positive assertion that patient has taken medication";
+            case N: return "Negative assertion that patient has not taken medication";
+            case UNK: return "Unknown assertion if patient has taken medication";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case Y: return "Yes";
+            case N: return "No";
+            case UNK: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementNottakenEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementNottakenEnumFactory.java
new file mode 100644
index 00000000000..9224c33fd9b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementNottakenEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationStatementNottakenEnumFactory implements EnumFactory {
+
+  public MedicationStatementNottaken fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("y".equals(codeString))
+      return MedicationStatementNottaken.Y;
+    if ("n".equals(codeString))
+      return MedicationStatementNottaken.N;
+    if ("unk".equals(codeString))
+      return MedicationStatementNottaken.UNK;
+    throw new IllegalArgumentException("Unknown MedicationStatementNottaken code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationStatementNottaken code) {
+    if (code == MedicationStatementNottaken.Y)
+      return "y";
+    if (code == MedicationStatementNottaken.N)
+      return "n";
+    if (code == MedicationStatementNottaken.UNK)
+      return "unk";
+    return "?";
+  }
+
+    public String toSystem(MedicationStatementNottaken code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementStatus.java
new file mode 100644
index 00000000000..e5b517d470d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationStatementStatus {
+
+        /**
+         * The medication is still being taken.
+         */
+        ACTIVE, 
+        /**
+         * The medication is no longer being taken.
+         */
+        COMPLETED, 
+        /**
+         * The statement was recorded incorrectly.
+         */
+        ENTEREDINERROR, 
+        /**
+         * The medication may be taken at some time in the future.
+         */
+        INTENDED, 
+        /**
+         * Actions implied by the statement have been permanently halted, before all of them occurred.
+         */
+        STOPPED, 
+        /**
+         * Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called "suspended".
+         */
+        ONHOLD, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationStatementStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("intended".equals(codeString))
+          return INTENDED;
+        if ("stopped".equals(codeString))
+          return STOPPED;
+        if ("on-hold".equals(codeString))
+          return ONHOLD;
+        throw new FHIRException("Unknown MedicationStatementStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case INTENDED: return "intended";
+            case STOPPED: return "stopped";
+            case ONHOLD: return "on-hold";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-statement-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The medication is still being taken.";
+            case COMPLETED: return "The medication is no longer being taken.";
+            case ENTEREDINERROR: return "The statement was recorded incorrectly.";
+            case INTENDED: return "The medication may be taken at some time in the future.";
+            case STOPPED: return "Actions implied by the statement have been permanently halted, before all of them occurred.";
+            case ONHOLD: return "Actions implied by the statement have been temporarily halted, but are expected to continue later. May also be called \"suspended\".";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            case INTENDED: return "Intended";
+            case STOPPED: return "Stopped";
+            case ONHOLD: return "On Hold";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementStatusEnumFactory.java
new file mode 100644
index 00000000000..d2b41a989c1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationStatementStatusEnumFactory implements EnumFactory {
+
+  public MedicationStatementStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return MedicationStatementStatus.ACTIVE;
+    if ("completed".equals(codeString))
+      return MedicationStatementStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return MedicationStatementStatus.ENTEREDINERROR;
+    if ("intended".equals(codeString))
+      return MedicationStatementStatus.INTENDED;
+    if ("stopped".equals(codeString))
+      return MedicationStatementStatus.STOPPED;
+    if ("on-hold".equals(codeString))
+      return MedicationStatementStatus.ONHOLD;
+    throw new IllegalArgumentException("Unknown MedicationStatementStatus code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationStatementStatus code) {
+    if (code == MedicationStatementStatus.ACTIVE)
+      return "active";
+    if (code == MedicationStatementStatus.COMPLETED)
+      return "completed";
+    if (code == MedicationStatementStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == MedicationStatementStatus.INTENDED)
+      return "intended";
+    if (code == MedicationStatementStatus.STOPPED)
+      return "stopped";
+    if (code == MedicationStatementStatus.ONHOLD)
+      return "on-hold";
+    return "?";
+  }
+
+    public String toSystem(MedicationStatementStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementTaken.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementTaken.java
new file mode 100644
index 00000000000..4ab086a3368
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementTaken.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationStatementTaken {
+
+        /**
+         * Positive assertion that patient has taken medication
+         */
+        Y, 
+        /**
+         * Negative assertion that patient has not taken medication
+         */
+        N, 
+        /**
+         * Unknown assertion if patient has taken medication
+         */
+        UNK, 
+        /**
+         * Patient reporting does not apply
+         */
+        NA, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationStatementTaken fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("y".equals(codeString))
+          return Y;
+        if ("n".equals(codeString))
+          return N;
+        if ("unk".equals(codeString))
+          return UNK;
+        if ("na".equals(codeString))
+          return NA;
+        throw new FHIRException("Unknown MedicationStatementTaken code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case Y: return "y";
+            case N: return "n";
+            case UNK: return "unk";
+            case NA: return "na";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-statement-taken";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case Y: return "Positive assertion that patient has taken medication";
+            case N: return "Negative assertion that patient has not taken medication";
+            case UNK: return "Unknown assertion if patient has taken medication";
+            case NA: return "Patient reporting does not apply";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case Y: return "Yes";
+            case N: return "No";
+            case UNK: return "Unknown";
+            case NA: return "Not Applicable";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementTakenEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementTakenEnumFactory.java
new file mode 100644
index 00000000000..1256e40e756
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatementTakenEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationStatementTakenEnumFactory implements EnumFactory {
+
+  public MedicationStatementTaken fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("y".equals(codeString))
+      return MedicationStatementTaken.Y;
+    if ("n".equals(codeString))
+      return MedicationStatementTaken.N;
+    if ("unk".equals(codeString))
+      return MedicationStatementTaken.UNK;
+    if ("na".equals(codeString))
+      return MedicationStatementTaken.NA;
+    throw new IllegalArgumentException("Unknown MedicationStatementTaken code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationStatementTaken code) {
+    if (code == MedicationStatementTaken.Y)
+      return "y";
+    if (code == MedicationStatementTaken.N)
+      return "n";
+    if (code == MedicationStatementTaken.UNK)
+      return "unk";
+    if (code == MedicationStatementTaken.NA)
+      return "na";
+    return "?";
+  }
+
+    public String toSystem(MedicationStatementTaken code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatus.java
new file mode 100644
index 00000000000..38e84d962a7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MedicationStatus {
+
+        /**
+         * The medication is available for use
+         */
+        ACTIVE, 
+        /**
+         * The medication is not available for use
+         */
+        INACTIVE, 
+        /**
+         * The medication was entered in error
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MedicationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown MedicationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case INACTIVE: return "inactive";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/medication-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The medication is available for use";
+            case INACTIVE: return "The medication is not available for use";
+            case ENTEREDINERROR: return "The medication was entered in error";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case INACTIVE: return "Inactive";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatusEnumFactory.java
new file mode 100644
index 00000000000..42ea0360ac7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MedicationStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MedicationStatusEnumFactory implements EnumFactory {
+
+  public MedicationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return MedicationStatus.ACTIVE;
+    if ("inactive".equals(codeString))
+      return MedicationStatus.INACTIVE;
+    if ("entered-in-error".equals(codeString))
+      return MedicationStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown MedicationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(MedicationStatus code) {
+    if (code == MedicationStatus.ACTIVE)
+      return "active";
+    if (code == MedicationStatus.INACTIVE)
+      return "inactive";
+    if (code == MedicationStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(MedicationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageEvents.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageEvents.java
new file mode 100644
index 00000000000..c1e01c2d8fe
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageEvents.java
@@ -0,0 +1,177 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MessageEvents {
+
+        /**
+         * The definition of a code system is used to create a simple collection of codes suitable for use for data entry or validation. An expanded code system will be returned, or an error message.
+         */
+        CODESYSTEMEXPAND, 
+        /**
+         * Change the status of a Medication Administration to show that it is complete.
+         */
+        MEDICATIONADMINISTRATIONCOMPLETE, 
+        /**
+         * Someone wishes to record that the record of administration of a medication is in error and should be ignored.
+         */
+        MEDICATIONADMINISTRATIONNULLIFICATION, 
+        /**
+         * Indicates that a medication has been recorded against the patient's record.
+         */
+        MEDICATIONADMINISTRATIONRECORDING, 
+        /**
+         * Update a Medication Administration record.
+         */
+        MEDICATIONADMINISTRATIONUPDATE, 
+        /**
+         * Notification of a change to an administrative resource (either create or update). Note that there is no delete, though some administrative resources have status or period elements for this use.
+         */
+        ADMINNOTIFY, 
+        /**
+         * Notification to convey information.
+         */
+        COMMUNICATIONREQUEST, 
+        /**
+         * Provide a diagnostic report, or update a previously provided diagnostic report.
+         */
+        DIAGNOSTICREPORTPROVIDE, 
+        /**
+         * Provide a simple observation or update a previously provided simple observation.
+         */
+        OBSERVATIONPROVIDE, 
+        /**
+         * Notification that two patient records actually identify the same patient.
+         */
+        PATIENTLINK, 
+        /**
+         * Notification that previous advice that two patient records concern the same patient is now considered incorrect.
+         */
+        PATIENTUNLINK, 
+        /**
+         * The definition of a value set is used to create a simple collection of codes suitable for use for data entry or validation. An expanded value set will be returned, or an error message.
+         */
+        VALUESETEXPAND, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MessageEvents fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("CodeSystem-expand".equals(codeString))
+          return CODESYSTEMEXPAND;
+        if ("MedicationAdministration-Complete".equals(codeString))
+          return MEDICATIONADMINISTRATIONCOMPLETE;
+        if ("MedicationAdministration-Nullification".equals(codeString))
+          return MEDICATIONADMINISTRATIONNULLIFICATION;
+        if ("MedicationAdministration-Recording".equals(codeString))
+          return MEDICATIONADMINISTRATIONRECORDING;
+        if ("MedicationAdministration-Update".equals(codeString))
+          return MEDICATIONADMINISTRATIONUPDATE;
+        if ("admin-notify".equals(codeString))
+          return ADMINNOTIFY;
+        if ("communication-request".equals(codeString))
+          return COMMUNICATIONREQUEST;
+        if ("diagnosticreport-provide".equals(codeString))
+          return DIAGNOSTICREPORTPROVIDE;
+        if ("observation-provide".equals(codeString))
+          return OBSERVATIONPROVIDE;
+        if ("patient-link".equals(codeString))
+          return PATIENTLINK;
+        if ("patient-unlink".equals(codeString))
+          return PATIENTUNLINK;
+        if ("valueset-expand".equals(codeString))
+          return VALUESETEXPAND;
+        throw new FHIRException("Unknown MessageEvents code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CODESYSTEMEXPAND: return "CodeSystem-expand";
+            case MEDICATIONADMINISTRATIONCOMPLETE: return "MedicationAdministration-Complete";
+            case MEDICATIONADMINISTRATIONNULLIFICATION: return "MedicationAdministration-Nullification";
+            case MEDICATIONADMINISTRATIONRECORDING: return "MedicationAdministration-Recording";
+            case MEDICATIONADMINISTRATIONUPDATE: return "MedicationAdministration-Update";
+            case ADMINNOTIFY: return "admin-notify";
+            case COMMUNICATIONREQUEST: return "communication-request";
+            case DIAGNOSTICREPORTPROVIDE: return "diagnosticreport-provide";
+            case OBSERVATIONPROVIDE: return "observation-provide";
+            case PATIENTLINK: return "patient-link";
+            case PATIENTUNLINK: return "patient-unlink";
+            case VALUESETEXPAND: return "valueset-expand";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/message-events";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CODESYSTEMEXPAND: return "The definition of a code system is used to create a simple collection of codes suitable for use for data entry or validation. An expanded code system will be returned, or an error message.";
+            case MEDICATIONADMINISTRATIONCOMPLETE: return "Change the status of a Medication Administration to show that it is complete.";
+            case MEDICATIONADMINISTRATIONNULLIFICATION: return "Someone wishes to record that the record of administration of a medication is in error and should be ignored.";
+            case MEDICATIONADMINISTRATIONRECORDING: return "Indicates that a medication has been recorded against the patient's record.";
+            case MEDICATIONADMINISTRATIONUPDATE: return "Update a Medication Administration record.";
+            case ADMINNOTIFY: return "Notification of a change to an administrative resource (either create or update). Note that there is no delete, though some administrative resources have status or period elements for this use.";
+            case COMMUNICATIONREQUEST: return "Notification to convey information.";
+            case DIAGNOSTICREPORTPROVIDE: return "Provide a diagnostic report, or update a previously provided diagnostic report.";
+            case OBSERVATIONPROVIDE: return "Provide a simple observation or update a previously provided simple observation.";
+            case PATIENTLINK: return "Notification that two patient records actually identify the same patient.";
+            case PATIENTUNLINK: return "Notification that previous advice that two patient records concern the same patient is now considered incorrect.";
+            case VALUESETEXPAND: return "The definition of a value set is used to create a simple collection of codes suitable for use for data entry or validation. An expanded value set will be returned, or an error message.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CODESYSTEMEXPAND: return "CodeSystem-expand";
+            case MEDICATIONADMINISTRATIONCOMPLETE: return "MedicationAdministration-Complete";
+            case MEDICATIONADMINISTRATIONNULLIFICATION: return "MedicationAdministration-Nullification";
+            case MEDICATIONADMINISTRATIONRECORDING: return "MedicationAdministration-Recording";
+            case MEDICATIONADMINISTRATIONUPDATE: return "MedicationAdministration-Update";
+            case ADMINNOTIFY: return "admin-notify";
+            case COMMUNICATIONREQUEST: return "communication-request";
+            case DIAGNOSTICREPORTPROVIDE: return "diagnosticreport-provide";
+            case OBSERVATIONPROVIDE: return "observation-provide";
+            case PATIENTLINK: return "patient-link";
+            case PATIENTUNLINK: return "patient-unlink";
+            case VALUESETEXPAND: return "valueset-expand";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageEventsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageEventsEnumFactory.java
new file mode 100644
index 00000000000..a131a56178a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageEventsEnumFactory.java
@@ -0,0 +1,102 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MessageEventsEnumFactory implements EnumFactory {
+
+  public MessageEvents fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("CodeSystem-expand".equals(codeString))
+      return MessageEvents.CODESYSTEMEXPAND;
+    if ("MedicationAdministration-Complete".equals(codeString))
+      return MessageEvents.MEDICATIONADMINISTRATIONCOMPLETE;
+    if ("MedicationAdministration-Nullification".equals(codeString))
+      return MessageEvents.MEDICATIONADMINISTRATIONNULLIFICATION;
+    if ("MedicationAdministration-Recording".equals(codeString))
+      return MessageEvents.MEDICATIONADMINISTRATIONRECORDING;
+    if ("MedicationAdministration-Update".equals(codeString))
+      return MessageEvents.MEDICATIONADMINISTRATIONUPDATE;
+    if ("admin-notify".equals(codeString))
+      return MessageEvents.ADMINNOTIFY;
+    if ("communication-request".equals(codeString))
+      return MessageEvents.COMMUNICATIONREQUEST;
+    if ("diagnosticreport-provide".equals(codeString))
+      return MessageEvents.DIAGNOSTICREPORTPROVIDE;
+    if ("observation-provide".equals(codeString))
+      return MessageEvents.OBSERVATIONPROVIDE;
+    if ("patient-link".equals(codeString))
+      return MessageEvents.PATIENTLINK;
+    if ("patient-unlink".equals(codeString))
+      return MessageEvents.PATIENTUNLINK;
+    if ("valueset-expand".equals(codeString))
+      return MessageEvents.VALUESETEXPAND;
+    throw new IllegalArgumentException("Unknown MessageEvents code '"+codeString+"'");
+  }
+
+  public String toCode(MessageEvents code) {
+    if (code == MessageEvents.CODESYSTEMEXPAND)
+      return "CodeSystem-expand";
+    if (code == MessageEvents.MEDICATIONADMINISTRATIONCOMPLETE)
+      return "MedicationAdministration-Complete";
+    if (code == MessageEvents.MEDICATIONADMINISTRATIONNULLIFICATION)
+      return "MedicationAdministration-Nullification";
+    if (code == MessageEvents.MEDICATIONADMINISTRATIONRECORDING)
+      return "MedicationAdministration-Recording";
+    if (code == MessageEvents.MEDICATIONADMINISTRATIONUPDATE)
+      return "MedicationAdministration-Update";
+    if (code == MessageEvents.ADMINNOTIFY)
+      return "admin-notify";
+    if (code == MessageEvents.COMMUNICATIONREQUEST)
+      return "communication-request";
+    if (code == MessageEvents.DIAGNOSTICREPORTPROVIDE)
+      return "diagnosticreport-provide";
+    if (code == MessageEvents.OBSERVATIONPROVIDE)
+      return "observation-provide";
+    if (code == MessageEvents.PATIENTLINK)
+      return "patient-link";
+    if (code == MessageEvents.PATIENTUNLINK)
+      return "patient-unlink";
+    if (code == MessageEvents.VALUESETEXPAND)
+      return "valueset-expand";
+    return "?";
+  }
+
+    public String toSystem(MessageEvents code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageReasonEncounter.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageReasonEncounter.java
new file mode 100644
index 00000000000..dc48dc04e54
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageReasonEncounter.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MessageReasonEncounter {
+
+        /**
+         * The patient has been admitted.
+         */
+        ADMIT, 
+        /**
+         * The patient has been discharged.
+         */
+        DISCHARGE, 
+        /**
+         * The patient has temporarily left the institution.
+         */
+        ABSENT, 
+        /**
+         * The patient has returned from a temporary absence.
+         */
+        RETURN, 
+        /**
+         * The patient has been moved to a new location.
+         */
+        MOVED, 
+        /**
+         * Encounter details have been updated (e.g. to correct a coding error).
+         */
+        EDIT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MessageReasonEncounter fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("admit".equals(codeString))
+          return ADMIT;
+        if ("discharge".equals(codeString))
+          return DISCHARGE;
+        if ("absent".equals(codeString))
+          return ABSENT;
+        if ("return".equals(codeString))
+          return RETURN;
+        if ("moved".equals(codeString))
+          return MOVED;
+        if ("edit".equals(codeString))
+          return EDIT;
+        throw new FHIRException("Unknown MessageReasonEncounter code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ADMIT: return "admit";
+            case DISCHARGE: return "discharge";
+            case ABSENT: return "absent";
+            case RETURN: return "return";
+            case MOVED: return "moved";
+            case EDIT: return "edit";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/message-reasons-encounter";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ADMIT: return "The patient has been admitted.";
+            case DISCHARGE: return "The patient has been discharged.";
+            case ABSENT: return "The patient has temporarily left the institution.";
+            case RETURN: return "The patient has returned from a temporary absence.";
+            case MOVED: return "The patient has been moved to a new location.";
+            case EDIT: return "Encounter details have been updated (e.g. to correct a coding error).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ADMIT: return "Admit";
+            case DISCHARGE: return "Discharge";
+            case ABSENT: return "Absent";
+            case RETURN: return "Returned";
+            case MOVED: return "Moved";
+            case EDIT: return "Edit";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageReasonEncounterEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageReasonEncounterEnumFactory.java
new file mode 100644
index 00000000000..9e1bbd5ea4a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageReasonEncounterEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MessageReasonEncounterEnumFactory implements EnumFactory {
+
+  public MessageReasonEncounter fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("admit".equals(codeString))
+      return MessageReasonEncounter.ADMIT;
+    if ("discharge".equals(codeString))
+      return MessageReasonEncounter.DISCHARGE;
+    if ("absent".equals(codeString))
+      return MessageReasonEncounter.ABSENT;
+    if ("return".equals(codeString))
+      return MessageReasonEncounter.RETURN;
+    if ("moved".equals(codeString))
+      return MessageReasonEncounter.MOVED;
+    if ("edit".equals(codeString))
+      return MessageReasonEncounter.EDIT;
+    throw new IllegalArgumentException("Unknown MessageReasonEncounter code '"+codeString+"'");
+  }
+
+  public String toCode(MessageReasonEncounter code) {
+    if (code == MessageReasonEncounter.ADMIT)
+      return "admit";
+    if (code == MessageReasonEncounter.DISCHARGE)
+      return "discharge";
+    if (code == MessageReasonEncounter.ABSENT)
+      return "absent";
+    if (code == MessageReasonEncounter.RETURN)
+      return "return";
+    if (code == MessageReasonEncounter.MOVED)
+      return "moved";
+    if (code == MessageReasonEncounter.EDIT)
+      return "edit";
+    return "?";
+  }
+
+    public String toSystem(MessageReasonEncounter code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageSignificanceCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageSignificanceCategory.java
new file mode 100644
index 00000000000..6224adf9671
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageSignificanceCategory.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MessageSignificanceCategory {
+
+        /**
+         * The message represents/requests a change that should not be processed more than once; e.g., making a booking for an appointment.
+         */
+        CONSEQUENCE, 
+        /**
+         * The message represents a response to query for current information. Retrospective processing is wrong and/or wasteful.
+         */
+        CURRENCY, 
+        /**
+         * The content is not necessarily intended to be current, and it can be reprocessed, though there may be version issues created by processing old notifications.
+         */
+        NOTIFICATION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MessageSignificanceCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("Consequence".equals(codeString))
+          return CONSEQUENCE;
+        if ("Currency".equals(codeString))
+          return CURRENCY;
+        if ("Notification".equals(codeString))
+          return NOTIFICATION;
+        throw new FHIRException("Unknown MessageSignificanceCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CONSEQUENCE: return "Consequence";
+            case CURRENCY: return "Currency";
+            case NOTIFICATION: return "Notification";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/message-significance-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CONSEQUENCE: return "The message represents/requests a change that should not be processed more than once; e.g., making a booking for an appointment.";
+            case CURRENCY: return "The message represents a response to query for current information. Retrospective processing is wrong and/or wasteful.";
+            case NOTIFICATION: return "The content is not necessarily intended to be current, and it can be reprocessed, though there may be version issues created by processing old notifications.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CONSEQUENCE: return "Consequence";
+            case CURRENCY: return "Currency";
+            case NOTIFICATION: return "Notification";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageSignificanceCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageSignificanceCategoryEnumFactory.java
new file mode 100644
index 00000000000..9026bfd0cee
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageSignificanceCategoryEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MessageSignificanceCategoryEnumFactory implements EnumFactory {
+
+  public MessageSignificanceCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("Consequence".equals(codeString))
+      return MessageSignificanceCategory.CONSEQUENCE;
+    if ("Currency".equals(codeString))
+      return MessageSignificanceCategory.CURRENCY;
+    if ("Notification".equals(codeString))
+      return MessageSignificanceCategory.NOTIFICATION;
+    throw new IllegalArgumentException("Unknown MessageSignificanceCategory code '"+codeString+"'");
+  }
+
+  public String toCode(MessageSignificanceCategory code) {
+    if (code == MessageSignificanceCategory.CONSEQUENCE)
+      return "Consequence";
+    if (code == MessageSignificanceCategory.CURRENCY)
+      return "Currency";
+    if (code == MessageSignificanceCategory.NOTIFICATION)
+      return "Notification";
+    return "?";
+  }
+
+    public String toSystem(MessageSignificanceCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageTransport.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageTransport.java
new file mode 100644
index 00000000000..d4ad6cb7324
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageTransport.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MessageTransport {
+
+        /**
+         * The application sends or receives messages using HTTP POST (may be over http: or https:).
+         */
+        HTTP, 
+        /**
+         * The application sends or receives messages using File Transfer Protocol.
+         */
+        FTP, 
+        /**
+         * The application sends or receives messages using HL7's Minimal Lower Level Protocol.
+         */
+        MLLP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MessageTransport fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("http".equals(codeString))
+          return HTTP;
+        if ("ftp".equals(codeString))
+          return FTP;
+        if ("mllp".equals(codeString))
+          return MLLP;
+        throw new FHIRException("Unknown MessageTransport code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HTTP: return "http";
+            case FTP: return "ftp";
+            case MLLP: return "mllp";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/message-transport";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HTTP: return "The application sends or receives messages using HTTP POST (may be over http: or https:).";
+            case FTP: return "The application sends or receives messages using File Transfer Protocol.";
+            case MLLP: return "The application sends or receives messages using HL7's Minimal Lower Level Protocol.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HTTP: return "HTTP";
+            case FTP: return "FTP";
+            case MLLP: return "MLLP";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageTransportEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageTransportEnumFactory.java
new file mode 100644
index 00000000000..6863c1da06d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageTransportEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MessageTransportEnumFactory implements EnumFactory {
+
+  public MessageTransport fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("http".equals(codeString))
+      return MessageTransport.HTTP;
+    if ("ftp".equals(codeString))
+      return MessageTransport.FTP;
+    if ("mllp".equals(codeString))
+      return MessageTransport.MLLP;
+    throw new IllegalArgumentException("Unknown MessageTransport code '"+codeString+"'");
+  }
+
+  public String toCode(MessageTransport code) {
+    if (code == MessageTransport.HTTP)
+      return "http";
+    if (code == MessageTransport.FTP)
+      return "ftp";
+    if (code == MessageTransport.MLLP)
+      return "mllp";
+    return "?";
+  }
+
+    public String toSystem(MessageTransport code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageheaderResponseRequest.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageheaderResponseRequest.java
new file mode 100644
index 00000000000..f41edeaf990
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageheaderResponseRequest.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MessageheaderResponseRequest {
+
+        /**
+         * initiator expects a response for this message
+         */
+        ALWAYS, 
+        /**
+         * initiator expects a response only if in error
+         */
+        ONERROR, 
+        /**
+         * initiator does not expect a response
+         */
+        NEVER, 
+        /**
+         * initiator expects a response only if successful
+         */
+        ONSUCCESS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MessageheaderResponseRequest fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("always".equals(codeString))
+          return ALWAYS;
+        if ("on-error".equals(codeString))
+          return ONERROR;
+        if ("never".equals(codeString))
+          return NEVER;
+        if ("on-success".equals(codeString))
+          return ONSUCCESS;
+        throw new FHIRException("Unknown MessageheaderResponseRequest code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ALWAYS: return "always";
+            case ONERROR: return "on-error";
+            case NEVER: return "never";
+            case ONSUCCESS: return "on-success";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/messageheader-response-request";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ALWAYS: return "initiator expects a response for this message";
+            case ONERROR: return "initiator expects a response only if in error";
+            case NEVER: return "initiator does not expect a response";
+            case ONSUCCESS: return "initiator expects a response only if successful";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ALWAYS: return "Always";
+            case ONERROR: return "Error/reject conditions only";
+            case NEVER: return "Never";
+            case ONSUCCESS: return "Successful completion only";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageheaderResponseRequestEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageheaderResponseRequestEnumFactory.java
new file mode 100644
index 00000000000..e9aaa4714a6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MessageheaderResponseRequestEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MessageheaderResponseRequestEnumFactory implements EnumFactory {
+
+  public MessageheaderResponseRequest fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("always".equals(codeString))
+      return MessageheaderResponseRequest.ALWAYS;
+    if ("on-error".equals(codeString))
+      return MessageheaderResponseRequest.ONERROR;
+    if ("never".equals(codeString))
+      return MessageheaderResponseRequest.NEVER;
+    if ("on-success".equals(codeString))
+      return MessageheaderResponseRequest.ONSUCCESS;
+    throw new IllegalArgumentException("Unknown MessageheaderResponseRequest code '"+codeString+"'");
+  }
+
+  public String toCode(MessageheaderResponseRequest code) {
+    if (code == MessageheaderResponseRequest.ALWAYS)
+      return "always";
+    if (code == MessageheaderResponseRequest.ONERROR)
+      return "on-error";
+    if (code == MessageheaderResponseRequest.NEVER)
+      return "never";
+    if (code == MessageheaderResponseRequest.ONSUCCESS)
+      return "on-success";
+    return "?";
+  }
+
+    public String toSystem(MessageheaderResponseRequest code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationState.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationState.java
new file mode 100644
index 00000000000..84c34e3a0e2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationState.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MetricCalibrationState {
+
+        /**
+         * The metric has not been calibrated.
+         */
+        NOTCALIBRATED, 
+        /**
+         * The metric needs to be calibrated.
+         */
+        CALIBRATIONREQUIRED, 
+        /**
+         * The metric has been calibrated.
+         */
+        CALIBRATED, 
+        /**
+         * The state of calibration of this metric is unspecified.
+         */
+        UNSPECIFIED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MetricCalibrationState fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("not-calibrated".equals(codeString))
+          return NOTCALIBRATED;
+        if ("calibration-required".equals(codeString))
+          return CALIBRATIONREQUIRED;
+        if ("calibrated".equals(codeString))
+          return CALIBRATED;
+        if ("unspecified".equals(codeString))
+          return UNSPECIFIED;
+        throw new FHIRException("Unknown MetricCalibrationState code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NOTCALIBRATED: return "not-calibrated";
+            case CALIBRATIONREQUIRED: return "calibration-required";
+            case CALIBRATED: return "calibrated";
+            case UNSPECIFIED: return "unspecified";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/metric-calibration-state";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NOTCALIBRATED: return "The metric has not been calibrated.";
+            case CALIBRATIONREQUIRED: return "The metric needs to be calibrated.";
+            case CALIBRATED: return "The metric has been calibrated.";
+            case UNSPECIFIED: return "The state of calibration of this metric is unspecified.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NOTCALIBRATED: return "Not Calibrated";
+            case CALIBRATIONREQUIRED: return "Calibration Required";
+            case CALIBRATED: return "Calibrated";
+            case UNSPECIFIED: return "Unspecified";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationStateEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationStateEnumFactory.java
new file mode 100644
index 00000000000..944cbcdafbc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationStateEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MetricCalibrationStateEnumFactory implements EnumFactory {
+
+  public MetricCalibrationState fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("not-calibrated".equals(codeString))
+      return MetricCalibrationState.NOTCALIBRATED;
+    if ("calibration-required".equals(codeString))
+      return MetricCalibrationState.CALIBRATIONREQUIRED;
+    if ("calibrated".equals(codeString))
+      return MetricCalibrationState.CALIBRATED;
+    if ("unspecified".equals(codeString))
+      return MetricCalibrationState.UNSPECIFIED;
+    throw new IllegalArgumentException("Unknown MetricCalibrationState code '"+codeString+"'");
+  }
+
+  public String toCode(MetricCalibrationState code) {
+    if (code == MetricCalibrationState.NOTCALIBRATED)
+      return "not-calibrated";
+    if (code == MetricCalibrationState.CALIBRATIONREQUIRED)
+      return "calibration-required";
+    if (code == MetricCalibrationState.CALIBRATED)
+      return "calibrated";
+    if (code == MetricCalibrationState.UNSPECIFIED)
+      return "unspecified";
+    return "?";
+  }
+
+    public String toSystem(MetricCalibrationState code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationType.java
new file mode 100644
index 00000000000..63b4e5095b3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MetricCalibrationType {
+
+        /**
+         * Metric calibration method has not been identified.
+         */
+        UNSPECIFIED, 
+        /**
+         * Offset metric calibration method
+         */
+        OFFSET, 
+        /**
+         * Gain metric calibration method
+         */
+        GAIN, 
+        /**
+         * Two-point metric calibration method
+         */
+        TWOPOINT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MetricCalibrationType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("unspecified".equals(codeString))
+          return UNSPECIFIED;
+        if ("offset".equals(codeString))
+          return OFFSET;
+        if ("gain".equals(codeString))
+          return GAIN;
+        if ("two-point".equals(codeString))
+          return TWOPOINT;
+        throw new FHIRException("Unknown MetricCalibrationType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UNSPECIFIED: return "unspecified";
+            case OFFSET: return "offset";
+            case GAIN: return "gain";
+            case TWOPOINT: return "two-point";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/metric-calibration-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UNSPECIFIED: return "Metric calibration method has not been identified.";
+            case OFFSET: return "Offset metric calibration method";
+            case GAIN: return "Gain metric calibration method";
+            case TWOPOINT: return "Two-point metric calibration method";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UNSPECIFIED: return "Unspecified";
+            case OFFSET: return "Offset";
+            case GAIN: return "Gain";
+            case TWOPOINT: return "Two Point";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationTypeEnumFactory.java
new file mode 100644
index 00000000000..95384d54ccb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCalibrationTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MetricCalibrationTypeEnumFactory implements EnumFactory {
+
+  public MetricCalibrationType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("unspecified".equals(codeString))
+      return MetricCalibrationType.UNSPECIFIED;
+    if ("offset".equals(codeString))
+      return MetricCalibrationType.OFFSET;
+    if ("gain".equals(codeString))
+      return MetricCalibrationType.GAIN;
+    if ("two-point".equals(codeString))
+      return MetricCalibrationType.TWOPOINT;
+    throw new IllegalArgumentException("Unknown MetricCalibrationType code '"+codeString+"'");
+  }
+
+  public String toCode(MetricCalibrationType code) {
+    if (code == MetricCalibrationType.UNSPECIFIED)
+      return "unspecified";
+    if (code == MetricCalibrationType.OFFSET)
+      return "offset";
+    if (code == MetricCalibrationType.GAIN)
+      return "gain";
+    if (code == MetricCalibrationType.TWOPOINT)
+      return "two-point";
+    return "?";
+  }
+
+    public String toSystem(MetricCalibrationType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCategory.java
new file mode 100644
index 00000000000..5289e392aba
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCategory.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MetricCategory {
+
+        /**
+         * DeviceObservations generated for this DeviceMetric are measured.
+         */
+        MEASUREMENT, 
+        /**
+         * DeviceObservations generated for this DeviceMetric is a setting that will influence the behavior of the Device.
+         */
+        SETTING, 
+        /**
+         * DeviceObservations generated for this DeviceMetric are calculated.
+         */
+        CALCULATION, 
+        /**
+         * The category of this DeviceMetric is unspecified.
+         */
+        UNSPECIFIED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MetricCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("measurement".equals(codeString))
+          return MEASUREMENT;
+        if ("setting".equals(codeString))
+          return SETTING;
+        if ("calculation".equals(codeString))
+          return CALCULATION;
+        if ("unspecified".equals(codeString))
+          return UNSPECIFIED;
+        throw new FHIRException("Unknown MetricCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MEASUREMENT: return "measurement";
+            case SETTING: return "setting";
+            case CALCULATION: return "calculation";
+            case UNSPECIFIED: return "unspecified";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/metric-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MEASUREMENT: return "DeviceObservations generated for this DeviceMetric are measured.";
+            case SETTING: return "DeviceObservations generated for this DeviceMetric is a setting that will influence the behavior of the Device.";
+            case CALCULATION: return "DeviceObservations generated for this DeviceMetric are calculated.";
+            case UNSPECIFIED: return "The category of this DeviceMetric is unspecified.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MEASUREMENT: return "Measurement";
+            case SETTING: return "Setting";
+            case CALCULATION: return "Calculation";
+            case UNSPECIFIED: return "Unspecified";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCategoryEnumFactory.java
new file mode 100644
index 00000000000..99463e7f1bd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricCategoryEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MetricCategoryEnumFactory implements EnumFactory {
+
+  public MetricCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("measurement".equals(codeString))
+      return MetricCategory.MEASUREMENT;
+    if ("setting".equals(codeString))
+      return MetricCategory.SETTING;
+    if ("calculation".equals(codeString))
+      return MetricCategory.CALCULATION;
+    if ("unspecified".equals(codeString))
+      return MetricCategory.UNSPECIFIED;
+    throw new IllegalArgumentException("Unknown MetricCategory code '"+codeString+"'");
+  }
+
+  public String toCode(MetricCategory code) {
+    if (code == MetricCategory.MEASUREMENT)
+      return "measurement";
+    if (code == MetricCategory.SETTING)
+      return "setting";
+    if (code == MetricCategory.CALCULATION)
+      return "calculation";
+    if (code == MetricCategory.UNSPECIFIED)
+      return "unspecified";
+    return "?";
+  }
+
+    public String toSystem(MetricCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricColor.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricColor.java
new file mode 100644
index 00000000000..19ce5180452
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricColor.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MetricColor {
+
+        /**
+         * Color for representation - black.
+         */
+        BLACK, 
+        /**
+         * Color for representation - red.
+         */
+        RED, 
+        /**
+         * Color for representation - green.
+         */
+        GREEN, 
+        /**
+         * Color for representation - yellow.
+         */
+        YELLOW, 
+        /**
+         * Color for representation - blue.
+         */
+        BLUE, 
+        /**
+         * Color for representation - magenta.
+         */
+        MAGENTA, 
+        /**
+         * Color for representation - cyan.
+         */
+        CYAN, 
+        /**
+         * Color for representation - white.
+         */
+        WHITE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MetricColor fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("black".equals(codeString))
+          return BLACK;
+        if ("red".equals(codeString))
+          return RED;
+        if ("green".equals(codeString))
+          return GREEN;
+        if ("yellow".equals(codeString))
+          return YELLOW;
+        if ("blue".equals(codeString))
+          return BLUE;
+        if ("magenta".equals(codeString))
+          return MAGENTA;
+        if ("cyan".equals(codeString))
+          return CYAN;
+        if ("white".equals(codeString))
+          return WHITE;
+        throw new FHIRException("Unknown MetricColor code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BLACK: return "black";
+            case RED: return "red";
+            case GREEN: return "green";
+            case YELLOW: return "yellow";
+            case BLUE: return "blue";
+            case MAGENTA: return "magenta";
+            case CYAN: return "cyan";
+            case WHITE: return "white";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/metric-color";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BLACK: return "Color for representation - black.";
+            case RED: return "Color for representation - red.";
+            case GREEN: return "Color for representation - green.";
+            case YELLOW: return "Color for representation - yellow.";
+            case BLUE: return "Color for representation - blue.";
+            case MAGENTA: return "Color for representation - magenta.";
+            case CYAN: return "Color for representation - cyan.";
+            case WHITE: return "Color for representation - white.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BLACK: return "Color Black";
+            case RED: return "Color Red";
+            case GREEN: return "Color Green";
+            case YELLOW: return "Color Yellow";
+            case BLUE: return "Color Blue";
+            case MAGENTA: return "Color Magenta";
+            case CYAN: return "Color Cyan";
+            case WHITE: return "Color White";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricColorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricColorEnumFactory.java
new file mode 100644
index 00000000000..7ae5b3ba24a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricColorEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MetricColorEnumFactory implements EnumFactory {
+
+  public MetricColor fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("black".equals(codeString))
+      return MetricColor.BLACK;
+    if ("red".equals(codeString))
+      return MetricColor.RED;
+    if ("green".equals(codeString))
+      return MetricColor.GREEN;
+    if ("yellow".equals(codeString))
+      return MetricColor.YELLOW;
+    if ("blue".equals(codeString))
+      return MetricColor.BLUE;
+    if ("magenta".equals(codeString))
+      return MetricColor.MAGENTA;
+    if ("cyan".equals(codeString))
+      return MetricColor.CYAN;
+    if ("white".equals(codeString))
+      return MetricColor.WHITE;
+    throw new IllegalArgumentException("Unknown MetricColor code '"+codeString+"'");
+  }
+
+  public String toCode(MetricColor code) {
+    if (code == MetricColor.BLACK)
+      return "black";
+    if (code == MetricColor.RED)
+      return "red";
+    if (code == MetricColor.GREEN)
+      return "green";
+    if (code == MetricColor.YELLOW)
+      return "yellow";
+    if (code == MetricColor.BLUE)
+      return "blue";
+    if (code == MetricColor.MAGENTA)
+      return "magenta";
+    if (code == MetricColor.CYAN)
+      return "cyan";
+    if (code == MetricColor.WHITE)
+      return "white";
+    return "?";
+  }
+
+    public String toSystem(MetricColor code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricOperationalStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricOperationalStatus.java
new file mode 100644
index 00000000000..1fc956b01c6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricOperationalStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MetricOperationalStatus {
+
+        /**
+         * The DeviceMetric is operating and will generate DeviceObservations.
+         */
+        ON, 
+        /**
+         * The DeviceMetric is not operating.
+         */
+        OFF, 
+        /**
+         * The DeviceMetric is operating, but will not generate any DeviceObservations.
+         */
+        STANDBY, 
+        /**
+         * The DeviceMetric was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MetricOperationalStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("on".equals(codeString))
+          return ON;
+        if ("off".equals(codeString))
+          return OFF;
+        if ("standby".equals(codeString))
+          return STANDBY;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown MetricOperationalStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ON: return "on";
+            case OFF: return "off";
+            case STANDBY: return "standby";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/metric-operational-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ON: return "The DeviceMetric is operating and will generate DeviceObservations.";
+            case OFF: return "The DeviceMetric is not operating.";
+            case STANDBY: return "The DeviceMetric is operating, but will not generate any DeviceObservations.";
+            case ENTEREDINERROR: return "The DeviceMetric was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ON: return "On";
+            case OFF: return "Off";
+            case STANDBY: return "Standby";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricOperationalStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricOperationalStatusEnumFactory.java
new file mode 100644
index 00000000000..e8c139240da
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MetricOperationalStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MetricOperationalStatusEnumFactory implements EnumFactory {
+
+  public MetricOperationalStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("on".equals(codeString))
+      return MetricOperationalStatus.ON;
+    if ("off".equals(codeString))
+      return MetricOperationalStatus.OFF;
+    if ("standby".equals(codeString))
+      return MetricOperationalStatus.STANDBY;
+    if ("entered-in-error".equals(codeString))
+      return MetricOperationalStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown MetricOperationalStatus code '"+codeString+"'");
+  }
+
+  public String toCode(MetricOperationalStatus code) {
+    if (code == MetricOperationalStatus.ON)
+      return "on";
+    if (code == MetricOperationalStatus.OFF)
+      return "off";
+    if (code == MetricOperationalStatus.STANDBY)
+      return "standby";
+    if (code == MetricOperationalStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(MetricOperationalStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MissingToothReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MissingToothReason.java
new file mode 100644
index 00000000000..61bf512d5ed
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MissingToothReason.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum MissingToothReason {
+
+        /**
+         * Extraction
+         */
+        E, 
+        /**
+         * Congenital
+         */
+        C, 
+        /**
+         * Unknown
+         */
+        U, 
+        /**
+         * Other
+         */
+        O, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static MissingToothReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("e".equals(codeString))
+          return E;
+        if ("c".equals(codeString))
+          return C;
+        if ("u".equals(codeString))
+          return U;
+        if ("o".equals(codeString))
+          return O;
+        throw new FHIRException("Unknown MissingToothReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case E: return "e";
+            case C: return "c";
+            case U: return "u";
+            case O: return "o";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/missingtoothreason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case E: return "Extraction";
+            case C: return "Congenital";
+            case U: return "Unknown";
+            case O: return "Other";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case E: return "E";
+            case C: return "C";
+            case U: return "U";
+            case O: return "O";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MissingToothReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MissingToothReasonEnumFactory.java
new file mode 100644
index 00000000000..f0a43e4eb3a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/MissingToothReasonEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class MissingToothReasonEnumFactory implements EnumFactory {
+
+  public MissingToothReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("e".equals(codeString))
+      return MissingToothReason.E;
+    if ("c".equals(codeString))
+      return MissingToothReason.C;
+    if ("u".equals(codeString))
+      return MissingToothReason.U;
+    if ("o".equals(codeString))
+      return MissingToothReason.O;
+    throw new IllegalArgumentException("Unknown MissingToothReason code '"+codeString+"'");
+  }
+
+  public String toCode(MissingToothReason code) {
+    if (code == MissingToothReason.E)
+      return "e";
+    if (code == MissingToothReason.C)
+      return "c";
+    if (code == MissingToothReason.U)
+      return "u";
+    if (code == MissingToothReason.O)
+      return "o";
+    return "?";
+  }
+
+    public String toSystem(MissingToothReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameAssemblyOrder.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameAssemblyOrder.java
new file mode 100644
index 00000000000..b9b9dbdaa03
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameAssemblyOrder.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum NameAssemblyOrder {
+
+        /**
+         * null
+         */
+        NL1, 
+        /**
+         * null
+         */
+        NL2, 
+        /**
+         * null
+         */
+        NL3, 
+        /**
+         * null
+         */
+        NL4, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static NameAssemblyOrder fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("NL1".equals(codeString))
+          return NL1;
+        if ("NL2".equals(codeString))
+          return NL2;
+        if ("NL3".equals(codeString))
+          return NL3;
+        if ("NL4".equals(codeString))
+          return NL4;
+        throw new FHIRException("Unknown NameAssemblyOrder code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NL1: return "NL1";
+            case NL2: return "NL2";
+            case NL3: return "NL3";
+            case NL4: return "NL4";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/name-assembly-order";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NL1: return "";
+            case NL2: return "";
+            case NL3: return "";
+            case NL4: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NL1: return "Own Name";
+            case NL2: return "Partner Name";
+            case NL3: return "Partner Name followed by Maiden Name";
+            case NL4: return "Own Name followed by Partner Name";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameAssemblyOrderEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameAssemblyOrderEnumFactory.java
new file mode 100644
index 00000000000..3337cc42641
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameAssemblyOrderEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class NameAssemblyOrderEnumFactory implements EnumFactory {
+
+  public NameAssemblyOrder fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("NL1".equals(codeString))
+      return NameAssemblyOrder.NL1;
+    if ("NL2".equals(codeString))
+      return NameAssemblyOrder.NL2;
+    if ("NL3".equals(codeString))
+      return NameAssemblyOrder.NL3;
+    if ("NL4".equals(codeString))
+      return NameAssemblyOrder.NL4;
+    throw new IllegalArgumentException("Unknown NameAssemblyOrder code '"+codeString+"'");
+  }
+
+  public String toCode(NameAssemblyOrder code) {
+    if (code == NameAssemblyOrder.NL1)
+      return "NL1";
+    if (code == NameAssemblyOrder.NL2)
+      return "NL2";
+    if (code == NameAssemblyOrder.NL3)
+      return "NL3";
+    if (code == NameAssemblyOrder.NL4)
+      return "NL4";
+    return "?";
+  }
+
+    public String toSystem(NameAssemblyOrder code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameUse.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameUse.java
new file mode 100644
index 00000000000..8c8755672a7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameUse.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum NameUse {
+
+        /**
+         * Known as/conventional/the one you normally use
+         */
+        USUAL, 
+        /**
+         * The formal name as registered in an official (government) registry, but which name might not be commonly used. May be called "legal name".
+         */
+        OFFICIAL, 
+        /**
+         * A temporary name. Name.period can provide more detailed information. This may also be used for temporary names assigned at birth or in emergency situations.
+         */
+        TEMP, 
+        /**
+         * A name that is used to address the person in an informal manner, but is not part of their formal or usual name
+         */
+        NICKNAME, 
+        /**
+         * Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)
+         */
+        ANONYMOUS, 
+        /**
+         * This name is no longer in use (or was never correct, but retained for records)
+         */
+        OLD, 
+        /**
+         * A name used prior to changing name because of marriage. This name use is for use by applications that collect and store names that were used prior to a marriage. Marriage naming customs vary greatly around the world, and are constantly changing. This term is not gender specific. The use of this term does not imply any particular history for a person's name
+         */
+        MAIDEN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static NameUse fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("usual".equals(codeString))
+          return USUAL;
+        if ("official".equals(codeString))
+          return OFFICIAL;
+        if ("temp".equals(codeString))
+          return TEMP;
+        if ("nickname".equals(codeString))
+          return NICKNAME;
+        if ("anonymous".equals(codeString))
+          return ANONYMOUS;
+        if ("old".equals(codeString))
+          return OLD;
+        if ("maiden".equals(codeString))
+          return MAIDEN;
+        throw new FHIRException("Unknown NameUse code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case USUAL: return "usual";
+            case OFFICIAL: return "official";
+            case TEMP: return "temp";
+            case NICKNAME: return "nickname";
+            case ANONYMOUS: return "anonymous";
+            case OLD: return "old";
+            case MAIDEN: return "maiden";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/name-use";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case USUAL: return "Known as/conventional/the one you normally use";
+            case OFFICIAL: return "The formal name as registered in an official (government) registry, but which name might not be commonly used. May be called \"legal name\".";
+            case TEMP: return "A temporary name. Name.period can provide more detailed information. This may also be used for temporary names assigned at birth or in emergency situations.";
+            case NICKNAME: return "A name that is used to address the person in an informal manner, but is not part of their formal or usual name";
+            case ANONYMOUS: return "Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)";
+            case OLD: return "This name is no longer in use (or was never correct, but retained for records)";
+            case MAIDEN: return "A name used prior to changing name because of marriage. This name use is for use by applications that collect and store names that were used prior to a marriage. Marriage naming customs vary greatly around the world, and are constantly changing. This term is not gender specific. The use of this term does not imply any particular history for a person's name";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case USUAL: return "Usual";
+            case OFFICIAL: return "Official";
+            case TEMP: return "Temp";
+            case NICKNAME: return "Nickname";
+            case ANONYMOUS: return "Anonymous";
+            case OLD: return "Old";
+            case MAIDEN: return "Name changed for Marriage";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameUseEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameUseEnumFactory.java
new file mode 100644
index 00000000000..52b5251890c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NameUseEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class NameUseEnumFactory implements EnumFactory {
+
+  public NameUse fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("usual".equals(codeString))
+      return NameUse.USUAL;
+    if ("official".equals(codeString))
+      return NameUse.OFFICIAL;
+    if ("temp".equals(codeString))
+      return NameUse.TEMP;
+    if ("nickname".equals(codeString))
+      return NameUse.NICKNAME;
+    if ("anonymous".equals(codeString))
+      return NameUse.ANONYMOUS;
+    if ("old".equals(codeString))
+      return NameUse.OLD;
+    if ("maiden".equals(codeString))
+      return NameUse.MAIDEN;
+    throw new IllegalArgumentException("Unknown NameUse code '"+codeString+"'");
+  }
+
+  public String toCode(NameUse code) {
+    if (code == NameUse.USUAL)
+      return "usual";
+    if (code == NameUse.OFFICIAL)
+      return "official";
+    if (code == NameUse.TEMP)
+      return "temp";
+    if (code == NameUse.NICKNAME)
+      return "nickname";
+    if (code == NameUse.ANONYMOUS)
+      return "anonymous";
+    if (code == NameUse.OLD)
+      return "old";
+    if (code == NameUse.MAIDEN)
+      return "maiden";
+    return "?";
+  }
+
+    public String toSystem(NameUse code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemIdentifierType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemIdentifierType.java
new file mode 100644
index 00000000000..02926952537
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemIdentifierType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum NamingsystemIdentifierType {
+
+        /**
+         * An ISO object identifier; e.g. 1.2.3.4.5.
+         */
+        OID, 
+        /**
+         * A universally unique identifier of the form a5afddf4-e880-459b-876e-e4591b0acc11.
+         */
+        UUID, 
+        /**
+         * A uniform resource identifier (ideally a URL - uniform resource locator); e.g. http://unitsofmeasure.org.
+         */
+        URI, 
+        /**
+         * Some other type of unique identifier; e.g. HL7-assigned reserved string such as LN for LOINC.
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static NamingsystemIdentifierType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("oid".equals(codeString))
+          return OID;
+        if ("uuid".equals(codeString))
+          return UUID;
+        if ("uri".equals(codeString))
+          return URI;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown NamingsystemIdentifierType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OID: return "oid";
+            case UUID: return "uuid";
+            case URI: return "uri";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/namingsystem-identifier-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OID: return "An ISO object identifier; e.g. 1.2.3.4.5.";
+            case UUID: return "A universally unique identifier of the form a5afddf4-e880-459b-876e-e4591b0acc11.";
+            case URI: return "A uniform resource identifier (ideally a URL - uniform resource locator); e.g. http://unitsofmeasure.org.";
+            case OTHER: return "Some other type of unique identifier; e.g. HL7-assigned reserved string such as LN for LOINC.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OID: return "OID";
+            case UUID: return "UUID";
+            case URI: return "URI";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemIdentifierTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemIdentifierTypeEnumFactory.java
new file mode 100644
index 00000000000..c02d8e9c023
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemIdentifierTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class NamingsystemIdentifierTypeEnumFactory implements EnumFactory {
+
+  public NamingsystemIdentifierType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("oid".equals(codeString))
+      return NamingsystemIdentifierType.OID;
+    if ("uuid".equals(codeString))
+      return NamingsystemIdentifierType.UUID;
+    if ("uri".equals(codeString))
+      return NamingsystemIdentifierType.URI;
+    if ("other".equals(codeString))
+      return NamingsystemIdentifierType.OTHER;
+    throw new IllegalArgumentException("Unknown NamingsystemIdentifierType code '"+codeString+"'");
+  }
+
+  public String toCode(NamingsystemIdentifierType code) {
+    if (code == NamingsystemIdentifierType.OID)
+      return "oid";
+    if (code == NamingsystemIdentifierType.UUID)
+      return "uuid";
+    if (code == NamingsystemIdentifierType.URI)
+      return "uri";
+    if (code == NamingsystemIdentifierType.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(NamingsystemIdentifierType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemType.java
new file mode 100644
index 00000000000..01c38ec6242
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum NamingsystemType {
+
+        /**
+         * The naming system is used to define concepts and symbols to represent those concepts; e.g. UCUM, LOINC, NDC code, local lab codes, etc.
+         */
+        CODESYSTEM, 
+        /**
+         * The naming system is used to manage identifiers (e.g. license numbers, order numbers, etc.).
+         */
+        IDENTIFIER, 
+        /**
+         * The naming system is used as the root for other identifiers and naming systems.
+         */
+        ROOT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static NamingsystemType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("codesystem".equals(codeString))
+          return CODESYSTEM;
+        if ("identifier".equals(codeString))
+          return IDENTIFIER;
+        if ("root".equals(codeString))
+          return ROOT;
+        throw new FHIRException("Unknown NamingsystemType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CODESYSTEM: return "codesystem";
+            case IDENTIFIER: return "identifier";
+            case ROOT: return "root";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/namingsystem-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CODESYSTEM: return "The naming system is used to define concepts and symbols to represent those concepts; e.g. UCUM, LOINC, NDC code, local lab codes, etc.";
+            case IDENTIFIER: return "The naming system is used to manage identifiers (e.g. license numbers, order numbers, etc.).";
+            case ROOT: return "The naming system is used as the root for other identifiers and naming systems.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CODESYSTEM: return "Code System";
+            case IDENTIFIER: return "Identifier";
+            case ROOT: return "Root";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemTypeEnumFactory.java
new file mode 100644
index 00000000000..569cc08f313
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NamingsystemTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class NamingsystemTypeEnumFactory implements EnumFactory {
+
+  public NamingsystemType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("codesystem".equals(codeString))
+      return NamingsystemType.CODESYSTEM;
+    if ("identifier".equals(codeString))
+      return NamingsystemType.IDENTIFIER;
+    if ("root".equals(codeString))
+      return NamingsystemType.ROOT;
+    throw new IllegalArgumentException("Unknown NamingsystemType code '"+codeString+"'");
+  }
+
+  public String toCode(NamingsystemType code) {
+    if (code == NamingsystemType.CODESYSTEM)
+      return "codesystem";
+    if (code == NamingsystemType.IDENTIFIER)
+      return "identifier";
+    if (code == NamingsystemType.ROOT)
+      return "root";
+    return "?";
+  }
+
+    public String toSystem(NamingsystemType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NarrativeStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NarrativeStatus.java
new file mode 100644
index 00000000000..79d68e3fc80
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NarrativeStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum NarrativeStatus {
+
+        /**
+         * The contents of the narrative are entirely generated from the structured data in the content.
+         */
+        GENERATED, 
+        /**
+         * The contents of the narrative are entirely generated from the structured data in the content and some of the content is generated from extensions
+         */
+        EXTENSIONS, 
+        /**
+         * The contents of the narrative may contain additional information not found in the structured data. Note that there is no computable way to determine what the extra information is, other than by human inspection
+         */
+        ADDITIONAL, 
+        /**
+         * The contents of the narrative are some equivalent of "No human-readable text provided in this case"
+         */
+        EMPTY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static NarrativeStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("generated".equals(codeString))
+          return GENERATED;
+        if ("extensions".equals(codeString))
+          return EXTENSIONS;
+        if ("additional".equals(codeString))
+          return ADDITIONAL;
+        if ("empty".equals(codeString))
+          return EMPTY;
+        throw new FHIRException("Unknown NarrativeStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GENERATED: return "generated";
+            case EXTENSIONS: return "extensions";
+            case ADDITIONAL: return "additional";
+            case EMPTY: return "empty";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/narrative-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GENERATED: return "The contents of the narrative are entirely generated from the structured data in the content.";
+            case EXTENSIONS: return "The contents of the narrative are entirely generated from the structured data in the content and some of the content is generated from extensions";
+            case ADDITIONAL: return "The contents of the narrative may contain additional information not found in the structured data. Note that there is no computable way to determine what the extra information is, other than by human inspection";
+            case EMPTY: return "The contents of the narrative are some equivalent of \"No human-readable text provided in this case\"";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GENERATED: return "Generated";
+            case EXTENSIONS: return "Extensions";
+            case ADDITIONAL: return "Additional";
+            case EMPTY: return "Empty";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NarrativeStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NarrativeStatusEnumFactory.java
new file mode 100644
index 00000000000..93c511dc5c9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NarrativeStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class NarrativeStatusEnumFactory implements EnumFactory {
+
+  public NarrativeStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("generated".equals(codeString))
+      return NarrativeStatus.GENERATED;
+    if ("extensions".equals(codeString))
+      return NarrativeStatus.EXTENSIONS;
+    if ("additional".equals(codeString))
+      return NarrativeStatus.ADDITIONAL;
+    if ("empty".equals(codeString))
+      return NarrativeStatus.EMPTY;
+    throw new IllegalArgumentException("Unknown NarrativeStatus code '"+codeString+"'");
+  }
+
+  public String toCode(NarrativeStatus code) {
+    if (code == NarrativeStatus.GENERATED)
+      return "generated";
+    if (code == NarrativeStatus.EXTENSIONS)
+      return "extensions";
+    if (code == NarrativeStatus.ADDITIONAL)
+      return "additional";
+    if (code == NarrativeStatus.EMPTY)
+      return "empty";
+    return "?";
+  }
+
+    public String toSystem(NarrativeStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NetworkType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NetworkType.java
new file mode 100644
index 00000000000..39be826146f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NetworkType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum NetworkType {
+
+        /**
+         * The machine name, including DNS name.
+         */
+        _1, 
+        /**
+         * The assigned Internet Protocol (IP) address.
+         */
+        _2, 
+        /**
+         * The assigned telephone number.
+         */
+        _3, 
+        /**
+         * The assigned email address.
+         */
+        _4, 
+        /**
+         * URI (User directory, HTTP-PUT, ftp, etc.).
+         */
+        _5, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static NetworkType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        throw new FHIRException("Unknown NetworkType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/network-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "The machine name, including DNS name.";
+            case _2: return "The assigned Internet Protocol (IP) address.";
+            case _3: return "The assigned telephone number.";
+            case _4: return "The assigned email address.";
+            case _5: return "URI (User directory, HTTP-PUT, ftp, etc.).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Machine Name";
+            case _2: return "IP Address";
+            case _3: return "Telephone Number";
+            case _4: return "Email address";
+            case _5: return "URI";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NetworkTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NetworkTypeEnumFactory.java
new file mode 100644
index 00000000000..41640878942
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NetworkTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class NetworkTypeEnumFactory implements EnumFactory {
+
+  public NetworkType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return NetworkType._1;
+    if ("2".equals(codeString))
+      return NetworkType._2;
+    if ("3".equals(codeString))
+      return NetworkType._3;
+    if ("4".equals(codeString))
+      return NetworkType._4;
+    if ("5".equals(codeString))
+      return NetworkType._5;
+    throw new IllegalArgumentException("Unknown NetworkType code '"+codeString+"'");
+  }
+
+  public String toCode(NetworkType code) {
+    if (code == NetworkType._1)
+      return "1";
+    if (code == NetworkType._2)
+      return "2";
+    if (code == NetworkType._3)
+      return "3";
+    if (code == NetworkType._4)
+      return "4";
+    if (code == NetworkType._5)
+      return "5";
+    return "?";
+  }
+
+    public String toSystem(NetworkType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NoteType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NoteType.java
new file mode 100644
index 00000000000..80b7136288f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NoteType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum NoteType {
+
+        /**
+         * Display the note.
+         */
+        DISPLAY, 
+        /**
+         * Print the note on the form.
+         */
+        PRINT, 
+        /**
+         * Print the note for the operator.
+         */
+        PRINTOPER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static NoteType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("display".equals(codeString))
+          return DISPLAY;
+        if ("print".equals(codeString))
+          return PRINT;
+        if ("printoper".equals(codeString))
+          return PRINTOPER;
+        throw new FHIRException("Unknown NoteType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DISPLAY: return "display";
+            case PRINT: return "print";
+            case PRINTOPER: return "printoper";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/note-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DISPLAY: return "Display the note.";
+            case PRINT: return "Print the note on the form.";
+            case PRINTOPER: return "Print the note for the operator.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DISPLAY: return "Display";
+            case PRINT: return "Print (Form)";
+            case PRINTOPER: return "Print (Operator)";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NoteTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NoteTypeEnumFactory.java
new file mode 100644
index 00000000000..ff4a8f7eabc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NoteTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class NoteTypeEnumFactory implements EnumFactory {
+
+  public NoteType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("display".equals(codeString))
+      return NoteType.DISPLAY;
+    if ("print".equals(codeString))
+      return NoteType.PRINT;
+    if ("printoper".equals(codeString))
+      return NoteType.PRINTOPER;
+    throw new IllegalArgumentException("Unknown NoteType code '"+codeString+"'");
+  }
+
+  public String toCode(NoteType code) {
+    if (code == NoteType.DISPLAY)
+      return "display";
+    if (code == NoteType.PRINT)
+      return "print";
+    if (code == NoteType.PRINTOPER)
+      return "printoper";
+    return "?";
+  }
+
+    public String toSystem(NoteType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NutritionRequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NutritionRequestStatus.java
new file mode 100644
index 00000000000..070caa9f69b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NutritionRequestStatus.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum NutritionRequestStatus {
+
+        /**
+         * The request has been proposed.
+         */
+        PROPOSED, 
+        /**
+         * The request is in preliminary form prior to being sent.
+         */
+        DRAFT, 
+        /**
+         * The request has been planned.
+         */
+        PLANNED, 
+        /**
+         * The request has been placed.
+         */
+        REQUESTED, 
+        /**
+         * The request is 'actionable', but not all actions that are implied by it have occurred yet.
+         */
+        ACTIVE, 
+        /**
+         * Actions implied by the request have been temporarily halted, but are expected to continue later. May also be called "suspended".
+         */
+        ONHOLD, 
+        /**
+         * All actions that are implied by the order have occurred and no continuation is planned (this will rarely be made explicit).
+         */
+        COMPLETED, 
+        /**
+         * The request has been withdrawn and is no longer actionable.
+         */
+        CANCELLED, 
+        /**
+         * The request was entered in error and voided.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static NutritionRequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposed".equals(codeString))
+          return PROPOSED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("planned".equals(codeString))
+          return PLANNED;
+        if ("requested".equals(codeString))
+          return REQUESTED;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("on-hold".equals(codeString))
+          return ONHOLD;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown NutritionRequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSED: return "proposed";
+            case DRAFT: return "draft";
+            case PLANNED: return "planned";
+            case REQUESTED: return "requested";
+            case ACTIVE: return "active";
+            case ONHOLD: return "on-hold";
+            case COMPLETED: return "completed";
+            case CANCELLED: return "cancelled";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/nutrition-request-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSED: return "The request has been proposed.";
+            case DRAFT: return "The request is in preliminary form prior to being sent.";
+            case PLANNED: return "The request has been planned.";
+            case REQUESTED: return "The request has been placed.";
+            case ACTIVE: return "The request is 'actionable', but not all actions that are implied by it have occurred yet.";
+            case ONHOLD: return "Actions implied by the request have been temporarily halted, but are expected to continue later. May also be called \"suspended\".";
+            case COMPLETED: return "All actions that are implied by the order have occurred and no continuation is planned (this will rarely be made explicit).";
+            case CANCELLED: return "The request has been withdrawn and is no longer actionable.";
+            case ENTEREDINERROR: return "The request was entered in error and voided.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSED: return "Proposed";
+            case DRAFT: return "Draft";
+            case PLANNED: return "Planned";
+            case REQUESTED: return "Requested";
+            case ACTIVE: return "Active";
+            case ONHOLD: return "On-Hold";
+            case COMPLETED: return "Completed";
+            case CANCELLED: return "Cancelled";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NutritionRequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NutritionRequestStatusEnumFactory.java
new file mode 100644
index 00000000000..4adc296eb50
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/NutritionRequestStatusEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class NutritionRequestStatusEnumFactory implements EnumFactory {
+
+  public NutritionRequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposed".equals(codeString))
+      return NutritionRequestStatus.PROPOSED;
+    if ("draft".equals(codeString))
+      return NutritionRequestStatus.DRAFT;
+    if ("planned".equals(codeString))
+      return NutritionRequestStatus.PLANNED;
+    if ("requested".equals(codeString))
+      return NutritionRequestStatus.REQUESTED;
+    if ("active".equals(codeString))
+      return NutritionRequestStatus.ACTIVE;
+    if ("on-hold".equals(codeString))
+      return NutritionRequestStatus.ONHOLD;
+    if ("completed".equals(codeString))
+      return NutritionRequestStatus.COMPLETED;
+    if ("cancelled".equals(codeString))
+      return NutritionRequestStatus.CANCELLED;
+    if ("entered-in-error".equals(codeString))
+      return NutritionRequestStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown NutritionRequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(NutritionRequestStatus code) {
+    if (code == NutritionRequestStatus.PROPOSED)
+      return "proposed";
+    if (code == NutritionRequestStatus.DRAFT)
+      return "draft";
+    if (code == NutritionRequestStatus.PLANNED)
+      return "planned";
+    if (code == NutritionRequestStatus.REQUESTED)
+      return "requested";
+    if (code == NutritionRequestStatus.ACTIVE)
+      return "active";
+    if (code == NutritionRequestStatus.ONHOLD)
+      return "on-hold";
+    if (code == NutritionRequestStatus.COMPLETED)
+      return "completed";
+    if (code == NutritionRequestStatus.CANCELLED)
+      return "cancelled";
+    if (code == NutritionRequestStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(NutritionRequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectLifecycle.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectLifecycle.java
new file mode 100644
index 00000000000..81c0ed43030
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectLifecycle.java
@@ -0,0 +1,204 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ObjectLifecycle {
+
+        /**
+         * Origination, Creation
+         */
+        _1, 
+        /**
+         * Import / Copy
+         */
+        _2, 
+        /**
+         * Amendment
+         */
+        _3, 
+        /**
+         * Verification
+         */
+        _4, 
+        /**
+         * Translation
+         */
+        _5, 
+        /**
+         * Access / Use
+         */
+        _6, 
+        /**
+         * De-identification
+         */
+        _7, 
+        /**
+         * Aggregation, summarization, derivation
+         */
+        _8, 
+        /**
+         * Report
+         */
+        _9, 
+        /**
+         * Export
+         */
+        _10, 
+        /**
+         * Disclosure
+         */
+        _11, 
+        /**
+         * Receipt of disclosure
+         */
+        _12, 
+        /**
+         * Archiving
+         */
+        _13, 
+        /**
+         * Logical deletion
+         */
+        _14, 
+        /**
+         * Permanent erasure / Physical destruction
+         */
+        _15, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ObjectLifecycle fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("6".equals(codeString))
+          return _6;
+        if ("7".equals(codeString))
+          return _7;
+        if ("8".equals(codeString))
+          return _8;
+        if ("9".equals(codeString))
+          return _9;
+        if ("10".equals(codeString))
+          return _10;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        throw new FHIRException("Unknown ObjectLifecycle code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _8: return "8";
+            case _9: return "9";
+            case _10: return "10";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/object-lifecycle";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "Origination, Creation";
+            case _2: return "Import / Copy";
+            case _3: return "Amendment";
+            case _4: return "Verification";
+            case _5: return "Translation";
+            case _6: return "Access / Use";
+            case _7: return "De-identification";
+            case _8: return "Aggregation, summarization, derivation";
+            case _9: return "Report";
+            case _10: return "Export";
+            case _11: return "Disclosure";
+            case _12: return "Receipt of disclosure";
+            case _13: return "Archiving";
+            case _14: return "Logical deletion";
+            case _15: return "Permanent erasure / Physical destruction";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Origination, Creation";
+            case _2: return "Import / Copy";
+            case _3: return "Amendment";
+            case _4: return "Verification";
+            case _5: return "Translation";
+            case _6: return "Access / Use";
+            case _7: return "De-identification";
+            case _8: return "Aggregation, summarization, derivation";
+            case _9: return "Report";
+            case _10: return "Export";
+            case _11: return "Disclosure";
+            case _12: return "Receipt of disclosure";
+            case _13: return "Archiving";
+            case _14: return "Logical deletion";
+            case _15: return "Permanent erasure / Physical destruction";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectLifecycleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectLifecycleEnumFactory.java
new file mode 100644
index 00000000000..54510ab3951
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectLifecycleEnumFactory.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ObjectLifecycleEnumFactory implements EnumFactory {
+
+  public ObjectLifecycle fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return ObjectLifecycle._1;
+    if ("2".equals(codeString))
+      return ObjectLifecycle._2;
+    if ("3".equals(codeString))
+      return ObjectLifecycle._3;
+    if ("4".equals(codeString))
+      return ObjectLifecycle._4;
+    if ("5".equals(codeString))
+      return ObjectLifecycle._5;
+    if ("6".equals(codeString))
+      return ObjectLifecycle._6;
+    if ("7".equals(codeString))
+      return ObjectLifecycle._7;
+    if ("8".equals(codeString))
+      return ObjectLifecycle._8;
+    if ("9".equals(codeString))
+      return ObjectLifecycle._9;
+    if ("10".equals(codeString))
+      return ObjectLifecycle._10;
+    if ("11".equals(codeString))
+      return ObjectLifecycle._11;
+    if ("12".equals(codeString))
+      return ObjectLifecycle._12;
+    if ("13".equals(codeString))
+      return ObjectLifecycle._13;
+    if ("14".equals(codeString))
+      return ObjectLifecycle._14;
+    if ("15".equals(codeString))
+      return ObjectLifecycle._15;
+    throw new IllegalArgumentException("Unknown ObjectLifecycle code '"+codeString+"'");
+  }
+
+  public String toCode(ObjectLifecycle code) {
+    if (code == ObjectLifecycle._1)
+      return "1";
+    if (code == ObjectLifecycle._2)
+      return "2";
+    if (code == ObjectLifecycle._3)
+      return "3";
+    if (code == ObjectLifecycle._4)
+      return "4";
+    if (code == ObjectLifecycle._5)
+      return "5";
+    if (code == ObjectLifecycle._6)
+      return "6";
+    if (code == ObjectLifecycle._7)
+      return "7";
+    if (code == ObjectLifecycle._8)
+      return "8";
+    if (code == ObjectLifecycle._9)
+      return "9";
+    if (code == ObjectLifecycle._10)
+      return "10";
+    if (code == ObjectLifecycle._11)
+      return "11";
+    if (code == ObjectLifecycle._12)
+      return "12";
+    if (code == ObjectLifecycle._13)
+      return "13";
+    if (code == ObjectLifecycle._14)
+      return "14";
+    if (code == ObjectLifecycle._15)
+      return "15";
+    return "?";
+  }
+
+    public String toSystem(ObjectLifecycle code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectRole.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectRole.java
new file mode 100644
index 00000000000..1e3beaee178
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectRole.java
@@ -0,0 +1,285 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ObjectRole {
+
+        /**
+         * This object is the patient that is the subject of care related to this event.  It is identifiable by patient ID or equivalent.  The patient may be either human or animal.
+         */
+        _1, 
+        /**
+         * This is a location identified as related to the event.  This is usually the location where the event took place.  Note that for shipping, the usual events are arrival at a location or departure from a location.
+         */
+        _2, 
+        /**
+         * This object is any kind of persistent document created as a result of the event.  This could be a paper report, film, electronic report, DICOM Study, etc.  Issues related to medical records life cycle management are conveyed elsewhere.
+         */
+        _3, 
+        /**
+         * A logical object related to a health record event.  This is any healthcare  specific resource (object) not restricted to FHIR defined Resources.
+         */
+        _4, 
+        /**
+         * This is any configurable file used to control creation of documents.  Examples include the objects maintained by the HL7 Master File transactions, Value Sets, etc.
+         */
+        _5, 
+        /**
+         * A human participant not otherwise identified by some other category.
+         */
+        _6, 
+        /**
+         * (deprecated)
+         */
+        _7, 
+        /**
+         * Typically a licensed person who is providing or performing care related to the event, generally a physician.   The key distinction between doctor and practitioner is with regards to their role, not the licensing.  The doctor is the human who actually performed the work.  The practitioner is the human or organization that is responsible for the work.
+         */
+        _8, 
+        /**
+         * A person or system that is being notified as part of the event.  This is relevant in situations where automated systems provide notifications to other parties when an event took place.
+         */
+        _9, 
+        /**
+         * Insurance company, or any other organization who accepts responsibility for paying for the healthcare event.
+         */
+        _10, 
+        /**
+         * A person or active system object involved in the event with a security role.
+         */
+        _11, 
+        /**
+         * A person or system object involved in the event with the authority to modify security roles of other objects.
+         */
+        _12, 
+        /**
+         * A passive object, such as a role table, that is relevant to the event.
+         */
+        _13, 
+        /**
+         * (deprecated)  Relevant to certain RBAC security methodologies.
+         */
+        _14, 
+        /**
+         * Any person or organization responsible for providing care.  This encompasses all forms of care, licensed or otherwise, and all sorts of teams and care groups. Note the distinction between practitioner and the doctor that actually provided the care to the patient.
+         */
+        _15, 
+        /**
+         * The source or destination for data transfer, when it does not match some other role.
+         */
+        _16, 
+        /**
+         * A source or destination for data transfer that acts as an archive, database, or similar role.
+         */
+        _17, 
+        /**
+         * An object that holds schedule information.  This could be an appointment book, availability information, etc.
+         */
+        _18, 
+        /**
+         * An organization or person that is the recipient of services.  This could be an organization that is buying services for a patient, or a person that is buying services for an animal.
+         */
+        _19, 
+        /**
+         * An order, task, work item, procedure step, or other description of work to be performed; e.g. a particular instance of an MPPS.
+         */
+        _20, 
+        /**
+         * A list of jobs or a system that provides lists of jobs; e.g. an MWL SCP.
+         */
+        _21, 
+        /**
+         * (Deprecated)
+         */
+        _22, 
+        /**
+         * An object that specifies or controls the routing or delivery of items.  For example, a distribution list is the routing criteria for mail.  The items delivered may be documents, jobs, or other objects.
+         */
+        _23, 
+        /**
+         * The contents of a query.  This is used to capture the contents of any kind of query.  For security surveillance purposes knowing the queries being made is very important.
+         */
+        _24, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ObjectRole fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("6".equals(codeString))
+          return _6;
+        if ("7".equals(codeString))
+          return _7;
+        if ("8".equals(codeString))
+          return _8;
+        if ("9".equals(codeString))
+          return _9;
+        if ("10".equals(codeString))
+          return _10;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        if ("16".equals(codeString))
+          return _16;
+        if ("17".equals(codeString))
+          return _17;
+        if ("18".equals(codeString))
+          return _18;
+        if ("19".equals(codeString))
+          return _19;
+        if ("20".equals(codeString))
+          return _20;
+        if ("21".equals(codeString))
+          return _21;
+        if ("22".equals(codeString))
+          return _22;
+        if ("23".equals(codeString))
+          return _23;
+        if ("24".equals(codeString))
+          return _24;
+        throw new FHIRException("Unknown ObjectRole code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _8: return "8";
+            case _9: return "9";
+            case _10: return "10";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            case _16: return "16";
+            case _17: return "17";
+            case _18: return "18";
+            case _19: return "19";
+            case _20: return "20";
+            case _21: return "21";
+            case _22: return "22";
+            case _23: return "23";
+            case _24: return "24";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/object-role";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "This object is the patient that is the subject of care related to this event.  It is identifiable by patient ID or equivalent.  The patient may be either human or animal.";
+            case _2: return "This is a location identified as related to the event.  This is usually the location where the event took place.  Note that for shipping, the usual events are arrival at a location or departure from a location.";
+            case _3: return "This object is any kind of persistent document created as a result of the event.  This could be a paper report, film, electronic report, DICOM Study, etc.  Issues related to medical records life cycle management are conveyed elsewhere.";
+            case _4: return "A logical object related to a health record event.  This is any healthcare  specific resource (object) not restricted to FHIR defined Resources.";
+            case _5: return "This is any configurable file used to control creation of documents.  Examples include the objects maintained by the HL7 Master File transactions, Value Sets, etc.";
+            case _6: return "A human participant not otherwise identified by some other category.";
+            case _7: return "(deprecated)";
+            case _8: return "Typically a licensed person who is providing or performing care related to the event, generally a physician.   The key distinction between doctor and practitioner is with regards to their role, not the licensing.  The doctor is the human who actually performed the work.  The practitioner is the human or organization that is responsible for the work.";
+            case _9: return "A person or system that is being notified as part of the event.  This is relevant in situations where automated systems provide notifications to other parties when an event took place.";
+            case _10: return "Insurance company, or any other organization who accepts responsibility for paying for the healthcare event.";
+            case _11: return "A person or active system object involved in the event with a security role.";
+            case _12: return "A person or system object involved in the event with the authority to modify security roles of other objects.";
+            case _13: return "A passive object, such as a role table, that is relevant to the event.";
+            case _14: return "(deprecated)  Relevant to certain RBAC security methodologies.";
+            case _15: return "Any person or organization responsible for providing care.  This encompasses all forms of care, licensed or otherwise, and all sorts of teams and care groups. Note the distinction between practitioner and the doctor that actually provided the care to the patient.";
+            case _16: return "The source or destination for data transfer, when it does not match some other role.";
+            case _17: return "A source or destination for data transfer that acts as an archive, database, or similar role.";
+            case _18: return "An object that holds schedule information.  This could be an appointment book, availability information, etc.";
+            case _19: return "An organization or person that is the recipient of services.  This could be an organization that is buying services for a patient, or a person that is buying services for an animal.";
+            case _20: return "An order, task, work item, procedure step, or other description of work to be performed; e.g. a particular instance of an MPPS.";
+            case _21: return "A list of jobs or a system that provides lists of jobs; e.g. an MWL SCP.";
+            case _22: return "(Deprecated)";
+            case _23: return "An object that specifies or controls the routing or delivery of items.  For example, a distribution list is the routing criteria for mail.  The items delivered may be documents, jobs, or other objects.";
+            case _24: return "The contents of a query.  This is used to capture the contents of any kind of query.  For security surveillance purposes knowing the queries being made is very important.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Patient";
+            case _2: return "Location";
+            case _3: return "Report";
+            case _4: return "Domain Resource";
+            case _5: return "Master file";
+            case _6: return "User";
+            case _7: return "List";
+            case _8: return "Doctor";
+            case _9: return "Subscriber";
+            case _10: return "Guarantor";
+            case _11: return "Security User Entity";
+            case _12: return "Security User Group";
+            case _13: return "Security Resource";
+            case _14: return "Security Granularity Definition";
+            case _15: return "Practitioner";
+            case _16: return "Data Destination";
+            case _17: return "Data Repository";
+            case _18: return "Schedule";
+            case _19: return "Customer";
+            case _20: return "Job";
+            case _21: return "Job Stream";
+            case _22: return "Table";
+            case _23: return "Routing Criteria";
+            case _24: return "Query";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectRoleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectRoleEnumFactory.java
new file mode 100644
index 00000000000..e17e944e00c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectRoleEnumFactory.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ObjectRoleEnumFactory implements EnumFactory {
+
+  public ObjectRole fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return ObjectRole._1;
+    if ("2".equals(codeString))
+      return ObjectRole._2;
+    if ("3".equals(codeString))
+      return ObjectRole._3;
+    if ("4".equals(codeString))
+      return ObjectRole._4;
+    if ("5".equals(codeString))
+      return ObjectRole._5;
+    if ("6".equals(codeString))
+      return ObjectRole._6;
+    if ("7".equals(codeString))
+      return ObjectRole._7;
+    if ("8".equals(codeString))
+      return ObjectRole._8;
+    if ("9".equals(codeString))
+      return ObjectRole._9;
+    if ("10".equals(codeString))
+      return ObjectRole._10;
+    if ("11".equals(codeString))
+      return ObjectRole._11;
+    if ("12".equals(codeString))
+      return ObjectRole._12;
+    if ("13".equals(codeString))
+      return ObjectRole._13;
+    if ("14".equals(codeString))
+      return ObjectRole._14;
+    if ("15".equals(codeString))
+      return ObjectRole._15;
+    if ("16".equals(codeString))
+      return ObjectRole._16;
+    if ("17".equals(codeString))
+      return ObjectRole._17;
+    if ("18".equals(codeString))
+      return ObjectRole._18;
+    if ("19".equals(codeString))
+      return ObjectRole._19;
+    if ("20".equals(codeString))
+      return ObjectRole._20;
+    if ("21".equals(codeString))
+      return ObjectRole._21;
+    if ("22".equals(codeString))
+      return ObjectRole._22;
+    if ("23".equals(codeString))
+      return ObjectRole._23;
+    if ("24".equals(codeString))
+      return ObjectRole._24;
+    throw new IllegalArgumentException("Unknown ObjectRole code '"+codeString+"'");
+  }
+
+  public String toCode(ObjectRole code) {
+    if (code == ObjectRole._1)
+      return "1";
+    if (code == ObjectRole._2)
+      return "2";
+    if (code == ObjectRole._3)
+      return "3";
+    if (code == ObjectRole._4)
+      return "4";
+    if (code == ObjectRole._5)
+      return "5";
+    if (code == ObjectRole._6)
+      return "6";
+    if (code == ObjectRole._7)
+      return "7";
+    if (code == ObjectRole._8)
+      return "8";
+    if (code == ObjectRole._9)
+      return "9";
+    if (code == ObjectRole._10)
+      return "10";
+    if (code == ObjectRole._11)
+      return "11";
+    if (code == ObjectRole._12)
+      return "12";
+    if (code == ObjectRole._13)
+      return "13";
+    if (code == ObjectRole._14)
+      return "14";
+    if (code == ObjectRole._15)
+      return "15";
+    if (code == ObjectRole._16)
+      return "16";
+    if (code == ObjectRole._17)
+      return "17";
+    if (code == ObjectRole._18)
+      return "18";
+    if (code == ObjectRole._19)
+      return "19";
+    if (code == ObjectRole._20)
+      return "20";
+    if (code == ObjectRole._21)
+      return "21";
+    if (code == ObjectRole._22)
+      return "22";
+    if (code == ObjectRole._23)
+      return "23";
+    if (code == ObjectRole._24)
+      return "24";
+    return "?";
+  }
+
+    public String toSystem(ObjectRole code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectType.java
new file mode 100644
index 00000000000..ba27551a081
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectType.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ObjectType {
+
+        /**
+         * Person
+         */
+        _1, 
+        /**
+         * System Object
+         */
+        _2, 
+        /**
+         * Organization
+         */
+        _3, 
+        /**
+         * Other
+         */
+        _4, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ObjectType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        throw new FHIRException("Unknown ObjectType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/object-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "Person";
+            case _2: return "System Object";
+            case _3: return "Organization";
+            case _4: return "Other";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Person";
+            case _2: return "System Object";
+            case _3: return "Organization";
+            case _4: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectTypeEnumFactory.java
new file mode 100644
index 00000000000..c11e1fda540
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObjectTypeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ObjectTypeEnumFactory implements EnumFactory {
+
+  public ObjectType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return ObjectType._1;
+    if ("2".equals(codeString))
+      return ObjectType._2;
+    if ("3".equals(codeString))
+      return ObjectType._3;
+    if ("4".equals(codeString))
+      return ObjectType._4;
+    throw new IllegalArgumentException("Unknown ObjectType code '"+codeString+"'");
+  }
+
+  public String toCode(ObjectType code) {
+    if (code == ObjectType._1)
+      return "1";
+    if (code == ObjectType._2)
+      return "2";
+    if (code == ObjectType._3)
+      return "3";
+    if (code == ObjectType._4)
+      return "4";
+    return "?";
+  }
+
+    public String toSystem(ObjectType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationCategory.java
new file mode 100644
index 00000000000..c16f19f4cbc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationCategory.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ObservationCategory {
+
+        /**
+         * The Social History Observations define the patient's occupational, personal (e.g. lifestyle), social, and environmental history and health risk factors, as well as administrative data such as marital status, race, ethnicity and religious affiliation.
+         */
+        SOCIALHISTORY, 
+        /**
+         *  Clinical observations measure the body's basic functions such as such as blood pressure, heart rate, respiratory rate, height, weight, body mass index, head circumference, pulse oximetry, temperature, and body surface area.
+         */
+        VITALSIGNS, 
+        /**
+         * Observations generated by imaging. The scope includes observations, plain x-ray, ultrasound, CT, MRI, angiography, echocardiography, nuclear medicine.
+         */
+        IMAGING, 
+        /**
+         * The results of observations generated by laboratories.  Laboratory results are typically generated by laboratories providing analytic services in areas such as chemistry, hematology, serology, histology, cytology, anatomic pathology, microbiology, and/or virology. These observations are based on analysis of specimens obtained from the patient and submitted to the laboratory.
+         */
+        LABORATORY, 
+        /**
+         * Observations generated by other procedures.  This category includes observations resulting from interventional and non-interventional procedures excluding lab and imaging (e.g. cardiology catheterization, endoscopy, electrodiagnostics, etc.).  Procedure results are typically generated by a clinician to provide more granular information about component observations made during a procedure, such as where a gastroenterologist reports the size of a polyp observed during a colonoscopy.
+         */
+        PROCEDURE, 
+        /**
+         * Assessment tool/survey instrument observations (e.g. Apgar Scores, Montreal Cognitive Assessment (MoCA))
+         */
+        SURVEY, 
+        /**
+         * Observations generated by physical exam findings including direct observations made by a clinician and use of simple instruments and the result of simple maneuvers performed directly on the patient's body.
+         */
+        EXAM, 
+        /**
+         * Observations generated by non-interventional treatment protocols (e.g. occupational, physical, radiation, nutritional and medication therapy)
+         */
+        THERAPY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ObservationCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("social-history".equals(codeString))
+          return SOCIALHISTORY;
+        if ("vital-signs".equals(codeString))
+          return VITALSIGNS;
+        if ("imaging".equals(codeString))
+          return IMAGING;
+        if ("laboratory".equals(codeString))
+          return LABORATORY;
+        if ("procedure".equals(codeString))
+          return PROCEDURE;
+        if ("survey".equals(codeString))
+          return SURVEY;
+        if ("exam".equals(codeString))
+          return EXAM;
+        if ("therapy".equals(codeString))
+          return THERAPY;
+        throw new FHIRException("Unknown ObservationCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SOCIALHISTORY: return "social-history";
+            case VITALSIGNS: return "vital-signs";
+            case IMAGING: return "imaging";
+            case LABORATORY: return "laboratory";
+            case PROCEDURE: return "procedure";
+            case SURVEY: return "survey";
+            case EXAM: return "exam";
+            case THERAPY: return "therapy";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/observation-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SOCIALHISTORY: return "The Social History Observations define the patient's occupational, personal (e.g. lifestyle), social, and environmental history and health risk factors, as well as administrative data such as marital status, race, ethnicity and religious affiliation.";
+            case VITALSIGNS: return " Clinical observations measure the body's basic functions such as such as blood pressure, heart rate, respiratory rate, height, weight, body mass index, head circumference, pulse oximetry, temperature, and body surface area.";
+            case IMAGING: return "Observations generated by imaging. The scope includes observations, plain x-ray, ultrasound, CT, MRI, angiography, echocardiography, nuclear medicine.";
+            case LABORATORY: return "The results of observations generated by laboratories.  Laboratory results are typically generated by laboratories providing analytic services in areas such as chemistry, hematology, serology, histology, cytology, anatomic pathology, microbiology, and/or virology. These observations are based on analysis of specimens obtained from the patient and submitted to the laboratory.";
+            case PROCEDURE: return "Observations generated by other procedures.  This category includes observations resulting from interventional and non-interventional procedures excluding lab and imaging (e.g. cardiology catheterization, endoscopy, electrodiagnostics, etc.).  Procedure results are typically generated by a clinician to provide more granular information about component observations made during a procedure, such as where a gastroenterologist reports the size of a polyp observed during a colonoscopy.";
+            case SURVEY: return "Assessment tool/survey instrument observations (e.g. Apgar Scores, Montreal Cognitive Assessment (MoCA))";
+            case EXAM: return "Observations generated by physical exam findings including direct observations made by a clinician and use of simple instruments and the result of simple maneuvers performed directly on the patient's body.";
+            case THERAPY: return "Observations generated by non-interventional treatment protocols (e.g. occupational, physical, radiation, nutritional and medication therapy)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SOCIALHISTORY: return "Social History";
+            case VITALSIGNS: return "Vital Signs";
+            case IMAGING: return "Imaging";
+            case LABORATORY: return "Laboratory";
+            case PROCEDURE: return "Procedure";
+            case SURVEY: return "Survey";
+            case EXAM: return "Exam";
+            case THERAPY: return "Therapy";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationCategoryEnumFactory.java
new file mode 100644
index 00000000000..3d3746f5ee1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationCategoryEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ObservationCategoryEnumFactory implements EnumFactory {
+
+  public ObservationCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("social-history".equals(codeString))
+      return ObservationCategory.SOCIALHISTORY;
+    if ("vital-signs".equals(codeString))
+      return ObservationCategory.VITALSIGNS;
+    if ("imaging".equals(codeString))
+      return ObservationCategory.IMAGING;
+    if ("laboratory".equals(codeString))
+      return ObservationCategory.LABORATORY;
+    if ("procedure".equals(codeString))
+      return ObservationCategory.PROCEDURE;
+    if ("survey".equals(codeString))
+      return ObservationCategory.SURVEY;
+    if ("exam".equals(codeString))
+      return ObservationCategory.EXAM;
+    if ("therapy".equals(codeString))
+      return ObservationCategory.THERAPY;
+    throw new IllegalArgumentException("Unknown ObservationCategory code '"+codeString+"'");
+  }
+
+  public String toCode(ObservationCategory code) {
+    if (code == ObservationCategory.SOCIALHISTORY)
+      return "social-history";
+    if (code == ObservationCategory.VITALSIGNS)
+      return "vital-signs";
+    if (code == ObservationCategory.IMAGING)
+      return "imaging";
+    if (code == ObservationCategory.LABORATORY)
+      return "laboratory";
+    if (code == ObservationCategory.PROCEDURE)
+      return "procedure";
+    if (code == ObservationCategory.SURVEY)
+      return "survey";
+    if (code == ObservationCategory.EXAM)
+      return "exam";
+    if (code == ObservationCategory.THERAPY)
+      return "therapy";
+    return "?";
+  }
+
+    public String toSystem(ObservationCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationParamcode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationParamcode.java
new file mode 100644
index 00000000000..989be1cd469
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationParamcode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ObservationParamcode {
+
+        /**
+         * The [mean](https://en.wikipedia.org/wiki/Arithmetic_mean)of N measurements over the stated period
+         */
+        AVERAGE, 
+        /**
+         * The [maximum](https://en.wikipedia.org/wiki/Maximal_element) value of N measurements over the stated period
+         */
+        MAX, 
+        /**
+         * The [minimum](https://en.wikipedia.org/wiki/Minimal_element) value of N measurements over the stated period
+         */
+        MIN, 
+        /**
+         * The [number] of measurements over the stated period
+         */
+        COUNT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ObservationParamcode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("average".equals(codeString))
+          return AVERAGE;
+        if ("max".equals(codeString))
+          return MAX;
+        if ("min".equals(codeString))
+          return MIN;
+        if ("count".equals(codeString))
+          return COUNT;
+        throw new FHIRException("Unknown ObservationParamcode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AVERAGE: return "average";
+            case MAX: return "max";
+            case MIN: return "min";
+            case COUNT: return "count";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/observation-paramcode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AVERAGE: return "The [mean](https://en.wikipedia.org/wiki/Arithmetic_mean)of N measurements over the stated period";
+            case MAX: return "The [maximum](https://en.wikipedia.org/wiki/Maximal_element) value of N measurements over the stated period";
+            case MIN: return "The [minimum](https://en.wikipedia.org/wiki/Minimal_element) value of N measurements over the stated period";
+            case COUNT: return "The [number] of measurements over the stated period";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AVERAGE: return "Average";
+            case MAX: return "Maximum";
+            case MIN: return "Minimum";
+            case COUNT: return "Count";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationParamcodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationParamcodeEnumFactory.java
new file mode 100644
index 00000000000..5f779812b4d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationParamcodeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ObservationParamcodeEnumFactory implements EnumFactory {
+
+  public ObservationParamcode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("average".equals(codeString))
+      return ObservationParamcode.AVERAGE;
+    if ("max".equals(codeString))
+      return ObservationParamcode.MAX;
+    if ("min".equals(codeString))
+      return ObservationParamcode.MIN;
+    if ("count".equals(codeString))
+      return ObservationParamcode.COUNT;
+    throw new IllegalArgumentException("Unknown ObservationParamcode code '"+codeString+"'");
+  }
+
+  public String toCode(ObservationParamcode code) {
+    if (code == ObservationParamcode.AVERAGE)
+      return "average";
+    if (code == ObservationParamcode.MAX)
+      return "max";
+    if (code == ObservationParamcode.MIN)
+      return "min";
+    if (code == ObservationParamcode.COUNT)
+      return "count";
+    return "?";
+  }
+
+    public String toSystem(ObservationParamcode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationRelationshiptypes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationRelationshiptypes.java
new file mode 100644
index 00000000000..38ac0276582
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationRelationshiptypes.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ObservationRelationshiptypes {
+
+        /**
+         * This observation is a group observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.
+         */
+        HASMEMBER, 
+        /**
+         * The target resource (Observation or QuestionnaireResponse) is part of the information from which this observation value is derived. (e.g. calculated anion gap, Apgar score)  NOTE:  "derived-from" is the only logical choice when referencing QuestionnaireResponse.
+         */
+        DERIVEDFROM, 
+        /**
+         * This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test).
+         */
+        SEQUELTO, 
+        /**
+         * This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete.
+         */
+        REPLACES, 
+        /**
+         * The value of the target observation qualifies (refines) the semantics of the source observation (e.g. a lipemia measure target from a plasma measure).
+         */
+        QUALIFIEDBY, 
+        /**
+         * The value of the target observation interferes (degrades quality, or prevents valid observation) with the semantics of the source observation (e.g. a hemolysis measure target from a plasma potassium measure, which has no value).
+         */
+        INTERFEREDBY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ObservationRelationshiptypes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("has-member".equals(codeString))
+          return HASMEMBER;
+        if ("derived-from".equals(codeString))
+          return DERIVEDFROM;
+        if ("sequel-to".equals(codeString))
+          return SEQUELTO;
+        if ("replaces".equals(codeString))
+          return REPLACES;
+        if ("qualified-by".equals(codeString))
+          return QUALIFIEDBY;
+        if ("interfered-by".equals(codeString))
+          return INTERFEREDBY;
+        throw new FHIRException("Unknown ObservationRelationshiptypes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HASMEMBER: return "has-member";
+            case DERIVEDFROM: return "derived-from";
+            case SEQUELTO: return "sequel-to";
+            case REPLACES: return "replaces";
+            case QUALIFIEDBY: return "qualified-by";
+            case INTERFEREDBY: return "interfered-by";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/observation-relationshiptypes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HASMEMBER: return "This observation is a group observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.";
+            case DERIVEDFROM: return "The target resource (Observation or QuestionnaireResponse) is part of the information from which this observation value is derived. (e.g. calculated anion gap, Apgar score)  NOTE:  \"derived-from\" is the only logical choice when referencing QuestionnaireResponse.";
+            case SEQUELTO: return "This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test).";
+            case REPLACES: return "This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete.";
+            case QUALIFIEDBY: return "The value of the target observation qualifies (refines) the semantics of the source observation (e.g. a lipemia measure target from a plasma measure).";
+            case INTERFEREDBY: return "The value of the target observation interferes (degrades quality, or prevents valid observation) with the semantics of the source observation (e.g. a hemolysis measure target from a plasma potassium measure, which has no value).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HASMEMBER: return "Has Member";
+            case DERIVEDFROM: return "Derived From";
+            case SEQUELTO: return "Sequel To";
+            case REPLACES: return "Replaces";
+            case QUALIFIEDBY: return "Qualified By";
+            case INTERFEREDBY: return "Interfered By";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationRelationshiptypesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationRelationshiptypesEnumFactory.java
new file mode 100644
index 00000000000..9e94265a05c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationRelationshiptypesEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ObservationRelationshiptypesEnumFactory implements EnumFactory {
+
+  public ObservationRelationshiptypes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("has-member".equals(codeString))
+      return ObservationRelationshiptypes.HASMEMBER;
+    if ("derived-from".equals(codeString))
+      return ObservationRelationshiptypes.DERIVEDFROM;
+    if ("sequel-to".equals(codeString))
+      return ObservationRelationshiptypes.SEQUELTO;
+    if ("replaces".equals(codeString))
+      return ObservationRelationshiptypes.REPLACES;
+    if ("qualified-by".equals(codeString))
+      return ObservationRelationshiptypes.QUALIFIEDBY;
+    if ("interfered-by".equals(codeString))
+      return ObservationRelationshiptypes.INTERFEREDBY;
+    throw new IllegalArgumentException("Unknown ObservationRelationshiptypes code '"+codeString+"'");
+  }
+
+  public String toCode(ObservationRelationshiptypes code) {
+    if (code == ObservationRelationshiptypes.HASMEMBER)
+      return "has-member";
+    if (code == ObservationRelationshiptypes.DERIVEDFROM)
+      return "derived-from";
+    if (code == ObservationRelationshiptypes.SEQUELTO)
+      return "sequel-to";
+    if (code == ObservationRelationshiptypes.REPLACES)
+      return "replaces";
+    if (code == ObservationRelationshiptypes.QUALIFIEDBY)
+      return "qualified-by";
+    if (code == ObservationRelationshiptypes.INTERFEREDBY)
+      return "interfered-by";
+    return "?";
+  }
+
+    public String toSystem(ObservationRelationshiptypes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatistics.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatistics.java
new file mode 100644
index 00000000000..6b6f2316575
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatistics.java
@@ -0,0 +1,258 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ObservationStatistics {
+
+        /**
+         * The [mean](https://en.wikipedia.org/wiki/Arithmetic_mean) of N measurements over the stated period
+         */
+        AVERAGE, 
+        /**
+         * The [maximum](https://en.wikipedia.org/wiki/Maximal_element) value of N measurements over the stated period
+         */
+        MAXIMUM, 
+        /**
+         * The [minimum](https://en.wikipedia.org/wiki/Minimal_element) value of N measurements over the stated period
+         */
+        MINIMUM, 
+        /**
+         * The [number] of valid measurements over the stated period that contributed to the other statistical outputs
+         */
+        COUNT, 
+        /**
+         * The total [number] of valid measurements over the stated period, including observations that were ignored because they did not contain valid result values
+         */
+        TOTALCOUNT, 
+        /**
+         * The [median](https://en.wikipedia.org/wiki/Median) of N measurements over the stated period
+         */
+        MEDIAN, 
+        /**
+         * The [standard deviation](https://en.wikipedia.org/wiki/Standard_deviation) of N measurements over the stated period
+         */
+        STDDEV, 
+        /**
+         * The [sum](https://en.wikipedia.org/wiki/Summation) of N measurements over the stated period
+         */
+        SUM, 
+        /**
+         * The [variance](https://en.wikipedia.org/wiki/Variance) of N measurements over the stated period
+         */
+        VARIANCE, 
+        /**
+         * The 20th [Percentile](https://en.wikipedia.org/wiki/Percentile) of N measurements over the stated period
+         */
+        _20PERCENT, 
+        /**
+         * The 80th [Percentile](https://en.wikipedia.org/wiki/Percentile) of N measurements over the stated period
+         */
+        _80PERCENT, 
+        /**
+         * The lower [Quartile](https://en.wikipedia.org/wiki/Quartile) Boundary of N measurements over the stated period
+         */
+        _4LOWER, 
+        /**
+         * The upper [Quartile](https://en.wikipedia.org/wiki/Quartile) Boundary of N measurements over the stated period
+         */
+        _4UPPER, 
+        /**
+         * The difference between the upper and lower [Quartiles](https://en.wikipedia.org/wiki/Quartile) is called the Interquartile range. (IQR = Q3-Q1) Quartile deviation or Semi-interquartile range is one-half the difference between the first and the third quartiles.
+         */
+        _4DEV, 
+        /**
+         * The lowest of four values that divide the N measurements into a frequency distribution of five classes with each containing one fifth of the total population
+         */
+        _51, 
+        /**
+         * The second of four values that divide the N measurements into a frequency distribution of five classes with each containing one fifth of the total population
+         */
+        _52, 
+        /**
+         * The third of four values that divide the N measurements into a frequency distribution of five classes with each containing one fifth of the total population
+         */
+        _53, 
+        /**
+         * The fourth of four values that divide the N measurements into a frequency distribution of five classes with each containing one fifth of the total population
+         */
+        _54, 
+        /**
+         * Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. The skewness value can be positive or negative, or even undefined.  Source: [Wikipedia](https://en.wikipedia.org/wiki/Skewness)
+         */
+        SKEW, 
+        /**
+         * Kurtosis  is a measure of the "tailedness" of the probability distribution of a real-valued random variable.   Source: [Wikipedia](https://en.wikipedia.org/wiki/Kurtosis)
+         */
+        KURTOSIS, 
+        /**
+         * Linear regression is an approach for modeling two-dimensional sample points with one independent variable and one dependent variable (conventionally, the x and y coordinates in a Cartesian coordinate system) and finds a linear function (a non-vertical straight line) that, as accurately as possible, predicts the dependent variable values as a function of the independent variables. Source: [Wikipedia](https://en.wikipedia.org/wiki/Simple_linear_regression)  This Statistic code will return both a gradient and an intercept value.
+         */
+        REGRESSION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ObservationStatistics fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("average".equals(codeString))
+          return AVERAGE;
+        if ("maximum".equals(codeString))
+          return MAXIMUM;
+        if ("minimum".equals(codeString))
+          return MINIMUM;
+        if ("count".equals(codeString))
+          return COUNT;
+        if ("totalcount".equals(codeString))
+          return TOTALCOUNT;
+        if ("median".equals(codeString))
+          return MEDIAN;
+        if ("std-dev".equals(codeString))
+          return STDDEV;
+        if ("sum".equals(codeString))
+          return SUM;
+        if ("variance".equals(codeString))
+          return VARIANCE;
+        if ("20-percent".equals(codeString))
+          return _20PERCENT;
+        if ("80-percent".equals(codeString))
+          return _80PERCENT;
+        if ("4-lower".equals(codeString))
+          return _4LOWER;
+        if ("4-upper".equals(codeString))
+          return _4UPPER;
+        if ("4-dev".equals(codeString))
+          return _4DEV;
+        if ("5-1".equals(codeString))
+          return _51;
+        if ("5-2".equals(codeString))
+          return _52;
+        if ("5-3".equals(codeString))
+          return _53;
+        if ("5-4".equals(codeString))
+          return _54;
+        if ("skew".equals(codeString))
+          return SKEW;
+        if ("kurtosis".equals(codeString))
+          return KURTOSIS;
+        if ("regression".equals(codeString))
+          return REGRESSION;
+        throw new FHIRException("Unknown ObservationStatistics code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AVERAGE: return "average";
+            case MAXIMUM: return "maximum";
+            case MINIMUM: return "minimum";
+            case COUNT: return "count";
+            case TOTALCOUNT: return "totalcount";
+            case MEDIAN: return "median";
+            case STDDEV: return "std-dev";
+            case SUM: return "sum";
+            case VARIANCE: return "variance";
+            case _20PERCENT: return "20-percent";
+            case _80PERCENT: return "80-percent";
+            case _4LOWER: return "4-lower";
+            case _4UPPER: return "4-upper";
+            case _4DEV: return "4-dev";
+            case _51: return "5-1";
+            case _52: return "5-2";
+            case _53: return "5-3";
+            case _54: return "5-4";
+            case SKEW: return "skew";
+            case KURTOSIS: return "kurtosis";
+            case REGRESSION: return "regression";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/observation-statistics";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AVERAGE: return "The [mean](https://en.wikipedia.org/wiki/Arithmetic_mean) of N measurements over the stated period";
+            case MAXIMUM: return "The [maximum](https://en.wikipedia.org/wiki/Maximal_element) value of N measurements over the stated period";
+            case MINIMUM: return "The [minimum](https://en.wikipedia.org/wiki/Minimal_element) value of N measurements over the stated period";
+            case COUNT: return "The [number] of valid measurements over the stated period that contributed to the other statistical outputs";
+            case TOTALCOUNT: return "The total [number] of valid measurements over the stated period, including observations that were ignored because they did not contain valid result values";
+            case MEDIAN: return "The [median](https://en.wikipedia.org/wiki/Median) of N measurements over the stated period";
+            case STDDEV: return "The [standard deviation](https://en.wikipedia.org/wiki/Standard_deviation) of N measurements over the stated period";
+            case SUM: return "The [sum](https://en.wikipedia.org/wiki/Summation) of N measurements over the stated period";
+            case VARIANCE: return "The [variance](https://en.wikipedia.org/wiki/Variance) of N measurements over the stated period";
+            case _20PERCENT: return "The 20th [Percentile](https://en.wikipedia.org/wiki/Percentile) of N measurements over the stated period";
+            case _80PERCENT: return "The 80th [Percentile](https://en.wikipedia.org/wiki/Percentile) of N measurements over the stated period";
+            case _4LOWER: return "The lower [Quartile](https://en.wikipedia.org/wiki/Quartile) Boundary of N measurements over the stated period";
+            case _4UPPER: return "The upper [Quartile](https://en.wikipedia.org/wiki/Quartile) Boundary of N measurements over the stated period";
+            case _4DEV: return "The difference between the upper and lower [Quartiles](https://en.wikipedia.org/wiki/Quartile) is called the Interquartile range. (IQR = Q3-Q1) Quartile deviation or Semi-interquartile range is one-half the difference between the first and the third quartiles.";
+            case _51: return "The lowest of four values that divide the N measurements into a frequency distribution of five classes with each containing one fifth of the total population";
+            case _52: return "The second of four values that divide the N measurements into a frequency distribution of five classes with each containing one fifth of the total population";
+            case _53: return "The third of four values that divide the N measurements into a frequency distribution of five classes with each containing one fifth of the total population";
+            case _54: return "The fourth of four values that divide the N measurements into a frequency distribution of five classes with each containing one fifth of the total population";
+            case SKEW: return "Skewness is a measure of the asymmetry of the probability distribution of a real-valued random variable about its mean. The skewness value can be positive or negative, or even undefined.  Source: [Wikipedia](https://en.wikipedia.org/wiki/Skewness)";
+            case KURTOSIS: return "Kurtosis  is a measure of the \"tailedness\" of the probability distribution of a real-valued random variable.   Source: [Wikipedia](https://en.wikipedia.org/wiki/Kurtosis)";
+            case REGRESSION: return "Linear regression is an approach for modeling two-dimensional sample points with one independent variable and one dependent variable (conventionally, the x and y coordinates in a Cartesian coordinate system) and finds a linear function (a non-vertical straight line) that, as accurately as possible, predicts the dependent variable values as a function of the independent variables. Source: [Wikipedia](https://en.wikipedia.org/wiki/Simple_linear_regression)  This Statistic code will return both a gradient and an intercept value.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AVERAGE: return "Average";
+            case MAXIMUM: return "Maximum";
+            case MINIMUM: return "Minimum";
+            case COUNT: return "Count";
+            case TOTALCOUNT: return "Total Count";
+            case MEDIAN: return "Median";
+            case STDDEV: return "Standard Deviation";
+            case SUM: return "Sum";
+            case VARIANCE: return "Variance";
+            case _20PERCENT: return "20th Percentile";
+            case _80PERCENT: return "80th Percentile";
+            case _4LOWER: return "Lower Quartile";
+            case _4UPPER: return "Upper Quartile";
+            case _4DEV: return "Quartile Deviation";
+            case _51: return "1st Quintile";
+            case _52: return "2nd Quintile";
+            case _53: return "3rd Quintile";
+            case _54: return "4th Quintile";
+            case SKEW: return "Skew";
+            case KURTOSIS: return "Kurtosis";
+            case REGRESSION: return "Regression";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatisticsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatisticsEnumFactory.java
new file mode 100644
index 00000000000..b9e2307c253
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatisticsEnumFactory.java
@@ -0,0 +1,138 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ObservationStatisticsEnumFactory implements EnumFactory {
+
+  public ObservationStatistics fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("average".equals(codeString))
+      return ObservationStatistics.AVERAGE;
+    if ("maximum".equals(codeString))
+      return ObservationStatistics.MAXIMUM;
+    if ("minimum".equals(codeString))
+      return ObservationStatistics.MINIMUM;
+    if ("count".equals(codeString))
+      return ObservationStatistics.COUNT;
+    if ("totalcount".equals(codeString))
+      return ObservationStatistics.TOTALCOUNT;
+    if ("median".equals(codeString))
+      return ObservationStatistics.MEDIAN;
+    if ("std-dev".equals(codeString))
+      return ObservationStatistics.STDDEV;
+    if ("sum".equals(codeString))
+      return ObservationStatistics.SUM;
+    if ("variance".equals(codeString))
+      return ObservationStatistics.VARIANCE;
+    if ("20-percent".equals(codeString))
+      return ObservationStatistics._20PERCENT;
+    if ("80-percent".equals(codeString))
+      return ObservationStatistics._80PERCENT;
+    if ("4-lower".equals(codeString))
+      return ObservationStatistics._4LOWER;
+    if ("4-upper".equals(codeString))
+      return ObservationStatistics._4UPPER;
+    if ("4-dev".equals(codeString))
+      return ObservationStatistics._4DEV;
+    if ("5-1".equals(codeString))
+      return ObservationStatistics._51;
+    if ("5-2".equals(codeString))
+      return ObservationStatistics._52;
+    if ("5-3".equals(codeString))
+      return ObservationStatistics._53;
+    if ("5-4".equals(codeString))
+      return ObservationStatistics._54;
+    if ("skew".equals(codeString))
+      return ObservationStatistics.SKEW;
+    if ("kurtosis".equals(codeString))
+      return ObservationStatistics.KURTOSIS;
+    if ("regression".equals(codeString))
+      return ObservationStatistics.REGRESSION;
+    throw new IllegalArgumentException("Unknown ObservationStatistics code '"+codeString+"'");
+  }
+
+  public String toCode(ObservationStatistics code) {
+    if (code == ObservationStatistics.AVERAGE)
+      return "average";
+    if (code == ObservationStatistics.MAXIMUM)
+      return "maximum";
+    if (code == ObservationStatistics.MINIMUM)
+      return "minimum";
+    if (code == ObservationStatistics.COUNT)
+      return "count";
+    if (code == ObservationStatistics.TOTALCOUNT)
+      return "totalcount";
+    if (code == ObservationStatistics.MEDIAN)
+      return "median";
+    if (code == ObservationStatistics.STDDEV)
+      return "std-dev";
+    if (code == ObservationStatistics.SUM)
+      return "sum";
+    if (code == ObservationStatistics.VARIANCE)
+      return "variance";
+    if (code == ObservationStatistics._20PERCENT)
+      return "20-percent";
+    if (code == ObservationStatistics._80PERCENT)
+      return "80-percent";
+    if (code == ObservationStatistics._4LOWER)
+      return "4-lower";
+    if (code == ObservationStatistics._4UPPER)
+      return "4-upper";
+    if (code == ObservationStatistics._4DEV)
+      return "4-dev";
+    if (code == ObservationStatistics._51)
+      return "5-1";
+    if (code == ObservationStatistics._52)
+      return "5-2";
+    if (code == ObservationStatistics._53)
+      return "5-3";
+    if (code == ObservationStatistics._54)
+      return "5-4";
+    if (code == ObservationStatistics.SKEW)
+      return "skew";
+    if (code == ObservationStatistics.KURTOSIS)
+      return "kurtosis";
+    if (code == ObservationStatistics.REGRESSION)
+      return "regression";
+    return "?";
+  }
+
+    public String toSystem(ObservationStatistics code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatus.java
new file mode 100644
index 00000000000..5b3f633d28f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatus.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ObservationStatus {
+
+        /**
+         * The existence of the observation is registered, but there is no result yet available.
+         */
+        REGISTERED, 
+        /**
+         * This is an initial or interim observation: data may be incomplete or unverified.
+         */
+        PRELIMINARY, 
+        /**
+         * The observation is complete.
+         */
+        FINAL, 
+        /**
+         * Subsequent to being Final, the observation has been modified subsequent.  This includes updates/new information and corrections.
+         */
+        AMENDED, 
+        /**
+         * Subsequent to being Final, the observation has been modified to correct an error in the test result.
+         */
+        CORRECTED, 
+        /**
+         * The observation is unavailable because the measurement was not started or not completed (also sometimes called "aborted").
+         */
+        CANCELLED, 
+        /**
+         * The observation has been withdrawn following previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".)
+         */
+        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, but the authoring system does not know which.
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ObservationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("registered".equals(codeString))
+          return REGISTERED;
+        if ("preliminary".equals(codeString))
+          return PRELIMINARY;
+        if ("final".equals(codeString))
+          return FINAL;
+        if ("amended".equals(codeString))
+          return AMENDED;
+        if ("corrected".equals(codeString))
+          return CORRECTED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown ObservationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REGISTERED: return "registered";
+            case PRELIMINARY: return "preliminary";
+            case FINAL: return "final";
+            case AMENDED: return "amended";
+            case CORRECTED: return "corrected";
+            case CANCELLED: return "cancelled";
+            case ENTEREDINERROR: return "entered-in-error";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/observation-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REGISTERED: return "The existence of the observation is registered, but there is no result yet available.";
+            case PRELIMINARY: return "This is an initial or interim observation: data may be incomplete or unverified.";
+            case FINAL: return "The observation is complete.";
+            case AMENDED: return "Subsequent to being Final, the observation has been modified subsequent.  This includes updates/new information and corrections.";
+            case CORRECTED: return "Subsequent to being Final, the observation has been modified to correct an error in the test result.";
+            case CANCELLED: return "The observation is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
+            case ENTEREDINERROR: return "The observation has been withdrawn following previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".)";
+            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, but the authoring system does not know which.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REGISTERED: return "Registered";
+            case PRELIMINARY: return "Preliminary";
+            case FINAL: return "Final";
+            case AMENDED: return "Amended";
+            case CORRECTED: return "Corrected";
+            case CANCELLED: return "Cancelled";
+            case ENTEREDINERROR: return "Entered in Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatusEnumFactory.java
new file mode 100644
index 00000000000..aaf883054b2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ObservationStatusEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ObservationStatusEnumFactory implements EnumFactory {
+
+  public ObservationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("registered".equals(codeString))
+      return ObservationStatus.REGISTERED;
+    if ("preliminary".equals(codeString))
+      return ObservationStatus.PRELIMINARY;
+    if ("final".equals(codeString))
+      return ObservationStatus.FINAL;
+    if ("amended".equals(codeString))
+      return ObservationStatus.AMENDED;
+    if ("corrected".equals(codeString))
+      return ObservationStatus.CORRECTED;
+    if ("cancelled".equals(codeString))
+      return ObservationStatus.CANCELLED;
+    if ("entered-in-error".equals(codeString))
+      return ObservationStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return ObservationStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown ObservationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ObservationStatus code) {
+    if (code == ObservationStatus.REGISTERED)
+      return "registered";
+    if (code == ObservationStatus.PRELIMINARY)
+      return "preliminary";
+    if (code == ObservationStatus.FINAL)
+      return "final";
+    if (code == ObservationStatus.AMENDED)
+      return "amended";
+    if (code == ObservationStatus.CORRECTED)
+      return "corrected";
+    if (code == ObservationStatus.CANCELLED)
+      return "cancelled";
+    if (code == ObservationStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == ObservationStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(ObservationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceCodes.java
new file mode 100644
index 00000000000..945aa6ed55f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceCodes.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum OccurrenceCodes {
+
+        /**
+         * Occurrance 1001 description.
+         */
+        _1001, 
+        /**
+         * Occurrance 1002 description.
+         */
+        _1002, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static OccurrenceCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1001".equals(codeString))
+          return _1001;
+        if ("1002".equals(codeString))
+          return _1002;
+        throw new FHIRException("Unknown OccurrenceCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1001: return "1001";
+            case _1002: return "1002";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-claimoccurrance";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1001: return "Occurrance 1001 description.";
+            case _1002: return "Occurrance 1002 description.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1001: return "Occurrance 1001";
+            case _1002: return "Occurrance 1002";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceCodesEnumFactory.java
new file mode 100644
index 00000000000..652dc6695e1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceCodesEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class OccurrenceCodesEnumFactory implements EnumFactory {
+
+  public OccurrenceCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1001".equals(codeString))
+      return OccurrenceCodes._1001;
+    if ("1002".equals(codeString))
+      return OccurrenceCodes._1002;
+    throw new IllegalArgumentException("Unknown OccurrenceCodes code '"+codeString+"'");
+  }
+
+  public String toCode(OccurrenceCodes code) {
+    if (code == OccurrenceCodes._1001)
+      return "1001";
+    if (code == OccurrenceCodes._1002)
+      return "1002";
+    return "?";
+  }
+
+    public String toSystem(OccurrenceCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceSpanCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceSpanCodes.java
new file mode 100644
index 00000000000..54eabe5341c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceSpanCodes.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum OccurrenceSpanCodes {
+
+        /**
+         * Occurrance Span 1001 description.
+         */
+        _1001, 
+        /**
+         * Occurrance Span 1002 description.
+         */
+        _1002, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static OccurrenceSpanCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1001".equals(codeString))
+          return _1001;
+        if ("1002".equals(codeString))
+          return _1002;
+        throw new FHIRException("Unknown OccurrenceSpanCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1001: return "1001";
+            case _1002: return "1002";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-claimoccurrancespan";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1001: return "Occurrance Span 1001 description.";
+            case _1002: return "Occurrance Span 1002 description.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1001: return "Occurrance Span 1001";
+            case _1002: return "Occurrance Span 1002";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceSpanCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceSpanCodesEnumFactory.java
new file mode 100644
index 00000000000..a53940862f0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OccurrenceSpanCodesEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class OccurrenceSpanCodesEnumFactory implements EnumFactory {
+
+  public OccurrenceSpanCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1001".equals(codeString))
+      return OccurrenceSpanCodes._1001;
+    if ("1002".equals(codeString))
+      return OccurrenceSpanCodes._1002;
+    throw new IllegalArgumentException("Unknown OccurrenceSpanCodes code '"+codeString+"'");
+  }
+
+  public String toCode(OccurrenceSpanCodes code) {
+    if (code == OccurrenceSpanCodes._1001)
+      return "1001";
+    if (code == OccurrenceSpanCodes._1002)
+      return "1002";
+    return "?";
+  }
+
+    public String toSystem(OccurrenceSpanCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationKind.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationKind.java
new file mode 100644
index 00000000000..ceb24ee746e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationKind.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum OperationKind {
+
+        /**
+         * This operation is invoked as an operation.
+         */
+        OPERATION, 
+        /**
+         * This operation is a named query, invoked using the search mechanism.
+         */
+        QUERY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static OperationKind fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("operation".equals(codeString))
+          return OPERATION;
+        if ("query".equals(codeString))
+          return QUERY;
+        throw new FHIRException("Unknown OperationKind code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OPERATION: return "operation";
+            case QUERY: return "query";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/operation-kind";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OPERATION: return "This operation is invoked as an operation.";
+            case QUERY: return "This operation is a named query, invoked using the search mechanism.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OPERATION: return "Operation";
+            case QUERY: return "Query";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationKindEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationKindEnumFactory.java
new file mode 100644
index 00000000000..f2687c47bac
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationKindEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class OperationKindEnumFactory implements EnumFactory {
+
+  public OperationKind fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("operation".equals(codeString))
+      return OperationKind.OPERATION;
+    if ("query".equals(codeString))
+      return OperationKind.QUERY;
+    throw new IllegalArgumentException("Unknown OperationKind code '"+codeString+"'");
+  }
+
+  public String toCode(OperationKind code) {
+    if (code == OperationKind.OPERATION)
+      return "operation";
+    if (code == OperationKind.QUERY)
+      return "query";
+    return "?";
+  }
+
+    public String toSystem(OperationKind code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationOutcome.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationOutcome.java
new file mode 100644
index 00000000000..6510d8f3d22
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationOutcome.java
@@ -0,0 +1,519 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum OperationOutcome {
+
+        /**
+         * null
+         */
+        MSGAUTHREQUIRED, 
+        /**
+         * null
+         */
+        MSGBADFORMAT, 
+        /**
+         * null
+         */
+        MSGBADSYNTAX, 
+        /**
+         * null
+         */
+        MSGCANTPARSECONTENT, 
+        /**
+         * null
+         */
+        MSGCANTPARSEROOT, 
+        /**
+         * null
+         */
+        MSGCREATED, 
+        /**
+         * null
+         */
+        MSGDATEFORMAT, 
+        /**
+         * null
+         */
+        MSGDELETED, 
+        /**
+         * null
+         */
+        MSGDELETEDDONE, 
+        /**
+         * null
+         */
+        MSGDELETEDID, 
+        /**
+         * null
+         */
+        MSGDUPLICATEID, 
+        /**
+         * null
+         */
+        MSGERRORPARSING, 
+        /**
+         * null
+         */
+        MSGIDINVALID, 
+        /**
+         * null
+         */
+        MSGIDTOOLONG, 
+        /**
+         * null
+         */
+        MSGINVALIDID, 
+        /**
+         * null
+         */
+        MSGJSONOBJECT, 
+        /**
+         * null
+         */
+        MSGLOCALFAIL, 
+        /**
+         * null
+         */
+        MSGNOMATCH, 
+        /**
+         * null
+         */
+        MSGNOEXIST, 
+        /**
+         * null
+         */
+        MSGNOMODULE, 
+        /**
+         * null
+         */
+        MSGNOSUMMARY, 
+        /**
+         * null
+         */
+        MSGOPNOTALLOWED, 
+        /**
+         * null
+         */
+        MSGPARAMCHAINED, 
+        /**
+         * null
+         */
+        MSGPARAMNOREPEAT, 
+        /**
+         * null
+         */
+        MSGPARAMUNKNOWN, 
+        /**
+         * null
+         */
+        MSGPARAMINVALID, 
+        /**
+         * null
+         */
+        MSGPARAMMODIFIERINVALID, 
+        /**
+         * null
+         */
+        MSGRESOURCEEXAMPLEPROTECTED, 
+        /**
+         * null
+         */
+        MSGRESOURCEIDFAIL, 
+        /**
+         * null
+         */
+        MSGRESOURCENOTALLOWED, 
+        /**
+         * null
+         */
+        MSGRESOURCEREQUIRED, 
+        /**
+         * null
+         */
+        MSGRESOURCEIDMISMATCH, 
+        /**
+         * null
+         */
+        MSGRESOURCEIDMISSING, 
+        /**
+         * null
+         */
+        MSGRESOURCETYPEMISMATCH, 
+        /**
+         * null
+         */
+        MSGSORTUNKNOWN, 
+        /**
+         * null
+         */
+        MSGTRANSACTIONDUPLICATEID, 
+        /**
+         * null
+         */
+        MSGTRANSACTIONMISSINGID, 
+        /**
+         * null
+         */
+        MSGUNHANDLEDNODETYPE, 
+        /**
+         * null
+         */
+        MSGUNKNOWNCONTENT, 
+        /**
+         * null
+         */
+        MSGUNKNOWNOPERATION, 
+        /**
+         * null
+         */
+        MSGUNKNOWNTYPE, 
+        /**
+         * null
+         */
+        MSGUPDATED, 
+        /**
+         * null
+         */
+        MSGVERSIONAWARE, 
+        /**
+         * null
+         */
+        MSGVERSIONAWARECONFLICT, 
+        /**
+         * null
+         */
+        MSGVERSIONAWAREURL, 
+        /**
+         * null
+         */
+        MSGWRONGNS, 
+        /**
+         * null
+         */
+        SEARCHMULTIPLE, 
+        /**
+         * null
+         */
+        UPDATEMULTIPLEMATCHES, 
+        /**
+         * null
+         */
+        DELETEMULTIPLEMATCHES, 
+        /**
+         * null
+         */
+        SEARCHNONE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static OperationOutcome fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("MSG_AUTH_REQUIRED".equals(codeString))
+          return MSGAUTHREQUIRED;
+        if ("MSG_BAD_FORMAT".equals(codeString))
+          return MSGBADFORMAT;
+        if ("MSG_BAD_SYNTAX".equals(codeString))
+          return MSGBADSYNTAX;
+        if ("MSG_CANT_PARSE_CONTENT".equals(codeString))
+          return MSGCANTPARSECONTENT;
+        if ("MSG_CANT_PARSE_ROOT".equals(codeString))
+          return MSGCANTPARSEROOT;
+        if ("MSG_CREATED".equals(codeString))
+          return MSGCREATED;
+        if ("MSG_DATE_FORMAT".equals(codeString))
+          return MSGDATEFORMAT;
+        if ("MSG_DELETED".equals(codeString))
+          return MSGDELETED;
+        if ("MSG_DELETED_DONE".equals(codeString))
+          return MSGDELETEDDONE;
+        if ("MSG_DELETED_ID".equals(codeString))
+          return MSGDELETEDID;
+        if ("MSG_DUPLICATE_ID".equals(codeString))
+          return MSGDUPLICATEID;
+        if ("MSG_ERROR_PARSING".equals(codeString))
+          return MSGERRORPARSING;
+        if ("MSG_ID_INVALID".equals(codeString))
+          return MSGIDINVALID;
+        if ("MSG_ID_TOO_LONG".equals(codeString))
+          return MSGIDTOOLONG;
+        if ("MSG_INVALID_ID".equals(codeString))
+          return MSGINVALIDID;
+        if ("MSG_JSON_OBJECT".equals(codeString))
+          return MSGJSONOBJECT;
+        if ("MSG_LOCAL_FAIL".equals(codeString))
+          return MSGLOCALFAIL;
+        if ("MSG_NO_MATCH".equals(codeString))
+          return MSGNOMATCH;
+        if ("MSG_NO_EXIST".equals(codeString))
+          return MSGNOEXIST;
+        if ("MSG_NO_MODULE".equals(codeString))
+          return MSGNOMODULE;
+        if ("MSG_NO_SUMMARY".equals(codeString))
+          return MSGNOSUMMARY;
+        if ("MSG_OP_NOT_ALLOWED".equals(codeString))
+          return MSGOPNOTALLOWED;
+        if ("MSG_PARAM_CHAINED".equals(codeString))
+          return MSGPARAMCHAINED;
+        if ("MSG_PARAM_NO_REPEAT".equals(codeString))
+          return MSGPARAMNOREPEAT;
+        if ("MSG_PARAM_UNKNOWN".equals(codeString))
+          return MSGPARAMUNKNOWN;
+        if ("MSG_PARAM_INVALID".equals(codeString))
+          return MSGPARAMINVALID;
+        if ("MSG_PARAM_MODIFIER_INVALID".equals(codeString))
+          return MSGPARAMMODIFIERINVALID;
+        if ("MSG_RESOURCE_EXAMPLE_PROTECTED".equals(codeString))
+          return MSGRESOURCEEXAMPLEPROTECTED;
+        if ("MSG_RESOURCE_ID_FAIL".equals(codeString))
+          return MSGRESOURCEIDFAIL;
+        if ("MSG_RESOURCE_NOT_ALLOWED".equals(codeString))
+          return MSGRESOURCENOTALLOWED;
+        if ("MSG_RESOURCE_REQUIRED".equals(codeString))
+          return MSGRESOURCEREQUIRED;
+        if ("MSG_RESOURCE_ID_MISMATCH".equals(codeString))
+          return MSGRESOURCEIDMISMATCH;
+        if ("MSG_RESOURCE_ID_MISSING".equals(codeString))
+          return MSGRESOURCEIDMISSING;
+        if ("MSG_RESOURCE_TYPE_MISMATCH".equals(codeString))
+          return MSGRESOURCETYPEMISMATCH;
+        if ("MSG_SORT_UNKNOWN".equals(codeString))
+          return MSGSORTUNKNOWN;
+        if ("MSG_TRANSACTION_DUPLICATE_ID".equals(codeString))
+          return MSGTRANSACTIONDUPLICATEID;
+        if ("MSG_TRANSACTION_MISSING_ID".equals(codeString))
+          return MSGTRANSACTIONMISSINGID;
+        if ("MSG_UNHANDLED_NODE_TYPE".equals(codeString))
+          return MSGUNHANDLEDNODETYPE;
+        if ("MSG_UNKNOWN_CONTENT".equals(codeString))
+          return MSGUNKNOWNCONTENT;
+        if ("MSG_UNKNOWN_OPERATION".equals(codeString))
+          return MSGUNKNOWNOPERATION;
+        if ("MSG_UNKNOWN_TYPE".equals(codeString))
+          return MSGUNKNOWNTYPE;
+        if ("MSG_UPDATED".equals(codeString))
+          return MSGUPDATED;
+        if ("MSG_VERSION_AWARE".equals(codeString))
+          return MSGVERSIONAWARE;
+        if ("MSG_VERSION_AWARE_CONFLICT".equals(codeString))
+          return MSGVERSIONAWARECONFLICT;
+        if ("MSG_VERSION_AWARE_URL".equals(codeString))
+          return MSGVERSIONAWAREURL;
+        if ("MSG_WRONG_NS".equals(codeString))
+          return MSGWRONGNS;
+        if ("SEARCH_MULTIPLE".equals(codeString))
+          return SEARCHMULTIPLE;
+        if ("UPDATE_MULTIPLE_MATCHES".equals(codeString))
+          return UPDATEMULTIPLEMATCHES;
+        if ("DELETE_MULTIPLE_MATCHES".equals(codeString))
+          return DELETEMULTIPLEMATCHES;
+        if ("SEARCH_NONE".equals(codeString))
+          return SEARCHNONE;
+        throw new FHIRException("Unknown OperationOutcome code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MSGAUTHREQUIRED: return "MSG_AUTH_REQUIRED";
+            case MSGBADFORMAT: return "MSG_BAD_FORMAT";
+            case MSGBADSYNTAX: return "MSG_BAD_SYNTAX";
+            case MSGCANTPARSECONTENT: return "MSG_CANT_PARSE_CONTENT";
+            case MSGCANTPARSEROOT: return "MSG_CANT_PARSE_ROOT";
+            case MSGCREATED: return "MSG_CREATED";
+            case MSGDATEFORMAT: return "MSG_DATE_FORMAT";
+            case MSGDELETED: return "MSG_DELETED";
+            case MSGDELETEDDONE: return "MSG_DELETED_DONE";
+            case MSGDELETEDID: return "MSG_DELETED_ID";
+            case MSGDUPLICATEID: return "MSG_DUPLICATE_ID";
+            case MSGERRORPARSING: return "MSG_ERROR_PARSING";
+            case MSGIDINVALID: return "MSG_ID_INVALID";
+            case MSGIDTOOLONG: return "MSG_ID_TOO_LONG";
+            case MSGINVALIDID: return "MSG_INVALID_ID";
+            case MSGJSONOBJECT: return "MSG_JSON_OBJECT";
+            case MSGLOCALFAIL: return "MSG_LOCAL_FAIL";
+            case MSGNOMATCH: return "MSG_NO_MATCH";
+            case MSGNOEXIST: return "MSG_NO_EXIST";
+            case MSGNOMODULE: return "MSG_NO_MODULE";
+            case MSGNOSUMMARY: return "MSG_NO_SUMMARY";
+            case MSGOPNOTALLOWED: return "MSG_OP_NOT_ALLOWED";
+            case MSGPARAMCHAINED: return "MSG_PARAM_CHAINED";
+            case MSGPARAMNOREPEAT: return "MSG_PARAM_NO_REPEAT";
+            case MSGPARAMUNKNOWN: return "MSG_PARAM_UNKNOWN";
+            case MSGPARAMINVALID: return "MSG_PARAM_INVALID";
+            case MSGPARAMMODIFIERINVALID: return "MSG_PARAM_MODIFIER_INVALID";
+            case MSGRESOURCEEXAMPLEPROTECTED: return "MSG_RESOURCE_EXAMPLE_PROTECTED";
+            case MSGRESOURCEIDFAIL: return "MSG_RESOURCE_ID_FAIL";
+            case MSGRESOURCENOTALLOWED: return "MSG_RESOURCE_NOT_ALLOWED";
+            case MSGRESOURCEREQUIRED: return "MSG_RESOURCE_REQUIRED";
+            case MSGRESOURCEIDMISMATCH: return "MSG_RESOURCE_ID_MISMATCH";
+            case MSGRESOURCEIDMISSING: return "MSG_RESOURCE_ID_MISSING";
+            case MSGRESOURCETYPEMISMATCH: return "MSG_RESOURCE_TYPE_MISMATCH";
+            case MSGSORTUNKNOWN: return "MSG_SORT_UNKNOWN";
+            case MSGTRANSACTIONDUPLICATEID: return "MSG_TRANSACTION_DUPLICATE_ID";
+            case MSGTRANSACTIONMISSINGID: return "MSG_TRANSACTION_MISSING_ID";
+            case MSGUNHANDLEDNODETYPE: return "MSG_UNHANDLED_NODE_TYPE";
+            case MSGUNKNOWNCONTENT: return "MSG_UNKNOWN_CONTENT";
+            case MSGUNKNOWNOPERATION: return "MSG_UNKNOWN_OPERATION";
+            case MSGUNKNOWNTYPE: return "MSG_UNKNOWN_TYPE";
+            case MSGUPDATED: return "MSG_UPDATED";
+            case MSGVERSIONAWARE: return "MSG_VERSION_AWARE";
+            case MSGVERSIONAWARECONFLICT: return "MSG_VERSION_AWARE_CONFLICT";
+            case MSGVERSIONAWAREURL: return "MSG_VERSION_AWARE_URL";
+            case MSGWRONGNS: return "MSG_WRONG_NS";
+            case SEARCHMULTIPLE: return "SEARCH_MULTIPLE";
+            case UPDATEMULTIPLEMATCHES: return "UPDATE_MULTIPLE_MATCHES";
+            case DELETEMULTIPLEMATCHES: return "DELETE_MULTIPLE_MATCHES";
+            case SEARCHNONE: return "SEARCH_NONE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/operation-outcome";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MSGAUTHREQUIRED: return "";
+            case MSGBADFORMAT: return "";
+            case MSGBADSYNTAX: return "";
+            case MSGCANTPARSECONTENT: return "";
+            case MSGCANTPARSEROOT: return "";
+            case MSGCREATED: return "";
+            case MSGDATEFORMAT: return "";
+            case MSGDELETED: return "";
+            case MSGDELETEDDONE: return "";
+            case MSGDELETEDID: return "";
+            case MSGDUPLICATEID: return "";
+            case MSGERRORPARSING: return "";
+            case MSGIDINVALID: return "";
+            case MSGIDTOOLONG: return "";
+            case MSGINVALIDID: return "";
+            case MSGJSONOBJECT: return "";
+            case MSGLOCALFAIL: return "";
+            case MSGNOMATCH: return "";
+            case MSGNOEXIST: return "";
+            case MSGNOMODULE: return "";
+            case MSGNOSUMMARY: return "";
+            case MSGOPNOTALLOWED: return "";
+            case MSGPARAMCHAINED: return "";
+            case MSGPARAMNOREPEAT: return "";
+            case MSGPARAMUNKNOWN: return "";
+            case MSGPARAMINVALID: return "";
+            case MSGPARAMMODIFIERINVALID: return "";
+            case MSGRESOURCEEXAMPLEPROTECTED: return "";
+            case MSGRESOURCEIDFAIL: return "";
+            case MSGRESOURCENOTALLOWED: return "";
+            case MSGRESOURCEREQUIRED: return "";
+            case MSGRESOURCEIDMISMATCH: return "";
+            case MSGRESOURCEIDMISSING: return "";
+            case MSGRESOURCETYPEMISMATCH: return "";
+            case MSGSORTUNKNOWN: return "";
+            case MSGTRANSACTIONDUPLICATEID: return "";
+            case MSGTRANSACTIONMISSINGID: return "";
+            case MSGUNHANDLEDNODETYPE: return "";
+            case MSGUNKNOWNCONTENT: return "";
+            case MSGUNKNOWNOPERATION: return "";
+            case MSGUNKNOWNTYPE: return "";
+            case MSGUPDATED: return "";
+            case MSGVERSIONAWARE: return "";
+            case MSGVERSIONAWARECONFLICT: return "";
+            case MSGVERSIONAWAREURL: return "";
+            case MSGWRONGNS: return "";
+            case SEARCHMULTIPLE: return "";
+            case UPDATEMULTIPLEMATCHES: return "";
+            case DELETEMULTIPLEMATCHES: return "";
+            case SEARCHNONE: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MSGAUTHREQUIRED: return "You must authenticate before you can use this service";
+            case MSGBADFORMAT: return "Bad Syntax: \"%s\" must be a %s'";
+            case MSGBADSYNTAX: return "Bad Syntax in %s";
+            case MSGCANTPARSECONTENT: return "Unable to parse feed (entry content type = \"%s\")";
+            case MSGCANTPARSEROOT: return "Unable to parse feed (root element name = \"%s\")";
+            case MSGCREATED: return "New resource created";
+            case MSGDATEFORMAT: return "The Date value %s is not in the correct format (Xml Date Format required)";
+            case MSGDELETED: return "This resource has been deleted";
+            case MSGDELETEDDONE: return "Resource deleted";
+            case MSGDELETEDID: return "The resource \"%s\" has been deleted";
+            case MSGDUPLICATEID: return "Duplicate Id %s for resource type %s";
+            case MSGERRORPARSING: return "Error parsing resource Xml (%s)";
+            case MSGIDINVALID: return "Id \"%s\" has an invalid character \"%s\"";
+            case MSGIDTOOLONG: return "Id \"%s\" too long (length limit 36)";
+            case MSGINVALIDID: return "Id not accepted";
+            case MSGJSONOBJECT: return "Json Source for a resource should start with an object";
+            case MSGLOCALFAIL: return "Unable to resolve local reference to resource %s";
+            case MSGNOMATCH: return "No Resource found matching the query \"%s\"";
+            case MSGNOEXIST: return "Resource Id \"%s\" does not exist";
+            case MSGNOMODULE: return "No module could be found to handle the request \"%s\"";
+            case MSGNOSUMMARY: return "No Summary for this resource";
+            case MSGOPNOTALLOWED: return "Operation %s not allowed for resource %s (due to local configuration)";
+            case MSGPARAMCHAINED: return "Unknown chained parameter name \"%s\"";
+            case MSGPARAMNOREPEAT: return "Parameter \"%s\" is not allowed to repeat";
+            case MSGPARAMUNKNOWN: return "Parameter \"%s\" not understood";
+            case MSGPARAMINVALID: return "Parameter \"%s\" content is invalid";
+            case MSGPARAMMODIFIERINVALID: return "Parameter \"%s\" modifier is invalid";
+            case MSGRESOURCEEXAMPLEPROTECTED: return "Resources with identity \"example\" cannot be deleted (for testing/training purposes)";
+            case MSGRESOURCEIDFAIL: return "unable to allocate resource id";
+            case MSGRESOURCENOTALLOWED: return "Not allowed to submit a resource for this operation";
+            case MSGRESOURCEREQUIRED: return "A resource is required";
+            case MSGRESOURCEIDMISMATCH: return "Resource Id Mismatch";
+            case MSGRESOURCEIDMISSING: return "Resource Id Missing";
+            case MSGRESOURCETYPEMISMATCH: return "Resource Type Mismatch";
+            case MSGSORTUNKNOWN: return "Unknown sort parameter name \"%s\"";
+            case MSGTRANSACTIONDUPLICATEID: return "Duplicate Identifier in transaction: %s";
+            case MSGTRANSACTIONMISSINGID: return "Missing Identifier in transaction - an entry.id must be provided";
+            case MSGUNHANDLEDNODETYPE: return "Unhandled xml node type \"%s\"";
+            case MSGUNKNOWNCONTENT: return "Unknown Content (%s) at %s";
+            case MSGUNKNOWNOPERATION: return "unknown FHIR http operation";
+            case MSGUNKNOWNTYPE: return "Resource Type \"%s\" not recognised";
+            case MSGUPDATED: return "existing resource updated";
+            case MSGVERSIONAWARE: return "Version aware updates are required for this resource";
+            case MSGVERSIONAWARECONFLICT: return "Update Conflict (server current version = \"%s\", client version referenced = \"%s\")";
+            case MSGVERSIONAWAREURL: return "Version specific URL not recognised";
+            case MSGWRONGNS: return "This does not appear to be a FHIR element or resource (wrong namespace \"%s\")";
+            case SEARCHMULTIPLE: return "Error: Multiple matches exist for %s search parameters \"%s\"";
+            case UPDATEMULTIPLEMATCHES: return "Error: Multiple matches exist for the conditional update";
+            case DELETEMULTIPLEMATCHES: return "Error: Multiple matches exist for the conditional delete";
+            case SEARCHNONE: return "Error: no processable search found for %s search parameters \"%s\"";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationOutcomeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationOutcomeEnumFactory.java
new file mode 100644
index 00000000000..275a7709b6b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationOutcomeEnumFactory.java
@@ -0,0 +1,254 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class OperationOutcomeEnumFactory implements EnumFactory {
+
+  public OperationOutcome fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("MSG_AUTH_REQUIRED".equals(codeString))
+      return OperationOutcome.MSGAUTHREQUIRED;
+    if ("MSG_BAD_FORMAT".equals(codeString))
+      return OperationOutcome.MSGBADFORMAT;
+    if ("MSG_BAD_SYNTAX".equals(codeString))
+      return OperationOutcome.MSGBADSYNTAX;
+    if ("MSG_CANT_PARSE_CONTENT".equals(codeString))
+      return OperationOutcome.MSGCANTPARSECONTENT;
+    if ("MSG_CANT_PARSE_ROOT".equals(codeString))
+      return OperationOutcome.MSGCANTPARSEROOT;
+    if ("MSG_CREATED".equals(codeString))
+      return OperationOutcome.MSGCREATED;
+    if ("MSG_DATE_FORMAT".equals(codeString))
+      return OperationOutcome.MSGDATEFORMAT;
+    if ("MSG_DELETED".equals(codeString))
+      return OperationOutcome.MSGDELETED;
+    if ("MSG_DELETED_DONE".equals(codeString))
+      return OperationOutcome.MSGDELETEDDONE;
+    if ("MSG_DELETED_ID".equals(codeString))
+      return OperationOutcome.MSGDELETEDID;
+    if ("MSG_DUPLICATE_ID".equals(codeString))
+      return OperationOutcome.MSGDUPLICATEID;
+    if ("MSG_ERROR_PARSING".equals(codeString))
+      return OperationOutcome.MSGERRORPARSING;
+    if ("MSG_ID_INVALID".equals(codeString))
+      return OperationOutcome.MSGIDINVALID;
+    if ("MSG_ID_TOO_LONG".equals(codeString))
+      return OperationOutcome.MSGIDTOOLONG;
+    if ("MSG_INVALID_ID".equals(codeString))
+      return OperationOutcome.MSGINVALIDID;
+    if ("MSG_JSON_OBJECT".equals(codeString))
+      return OperationOutcome.MSGJSONOBJECT;
+    if ("MSG_LOCAL_FAIL".equals(codeString))
+      return OperationOutcome.MSGLOCALFAIL;
+    if ("MSG_NO_MATCH".equals(codeString))
+      return OperationOutcome.MSGNOMATCH;
+    if ("MSG_NO_EXIST".equals(codeString))
+      return OperationOutcome.MSGNOEXIST;
+    if ("MSG_NO_MODULE".equals(codeString))
+      return OperationOutcome.MSGNOMODULE;
+    if ("MSG_NO_SUMMARY".equals(codeString))
+      return OperationOutcome.MSGNOSUMMARY;
+    if ("MSG_OP_NOT_ALLOWED".equals(codeString))
+      return OperationOutcome.MSGOPNOTALLOWED;
+    if ("MSG_PARAM_CHAINED".equals(codeString))
+      return OperationOutcome.MSGPARAMCHAINED;
+    if ("MSG_PARAM_NO_REPEAT".equals(codeString))
+      return OperationOutcome.MSGPARAMNOREPEAT;
+    if ("MSG_PARAM_UNKNOWN".equals(codeString))
+      return OperationOutcome.MSGPARAMUNKNOWN;
+    if ("MSG_PARAM_INVALID".equals(codeString))
+      return OperationOutcome.MSGPARAMINVALID;
+    if ("MSG_PARAM_MODIFIER_INVALID".equals(codeString))
+      return OperationOutcome.MSGPARAMMODIFIERINVALID;
+    if ("MSG_RESOURCE_EXAMPLE_PROTECTED".equals(codeString))
+      return OperationOutcome.MSGRESOURCEEXAMPLEPROTECTED;
+    if ("MSG_RESOURCE_ID_FAIL".equals(codeString))
+      return OperationOutcome.MSGRESOURCEIDFAIL;
+    if ("MSG_RESOURCE_NOT_ALLOWED".equals(codeString))
+      return OperationOutcome.MSGRESOURCENOTALLOWED;
+    if ("MSG_RESOURCE_REQUIRED".equals(codeString))
+      return OperationOutcome.MSGRESOURCEREQUIRED;
+    if ("MSG_RESOURCE_ID_MISMATCH".equals(codeString))
+      return OperationOutcome.MSGRESOURCEIDMISMATCH;
+    if ("MSG_RESOURCE_ID_MISSING".equals(codeString))
+      return OperationOutcome.MSGRESOURCEIDMISSING;
+    if ("MSG_RESOURCE_TYPE_MISMATCH".equals(codeString))
+      return OperationOutcome.MSGRESOURCETYPEMISMATCH;
+    if ("MSG_SORT_UNKNOWN".equals(codeString))
+      return OperationOutcome.MSGSORTUNKNOWN;
+    if ("MSG_TRANSACTION_DUPLICATE_ID".equals(codeString))
+      return OperationOutcome.MSGTRANSACTIONDUPLICATEID;
+    if ("MSG_TRANSACTION_MISSING_ID".equals(codeString))
+      return OperationOutcome.MSGTRANSACTIONMISSINGID;
+    if ("MSG_UNHANDLED_NODE_TYPE".equals(codeString))
+      return OperationOutcome.MSGUNHANDLEDNODETYPE;
+    if ("MSG_UNKNOWN_CONTENT".equals(codeString))
+      return OperationOutcome.MSGUNKNOWNCONTENT;
+    if ("MSG_UNKNOWN_OPERATION".equals(codeString))
+      return OperationOutcome.MSGUNKNOWNOPERATION;
+    if ("MSG_UNKNOWN_TYPE".equals(codeString))
+      return OperationOutcome.MSGUNKNOWNTYPE;
+    if ("MSG_UPDATED".equals(codeString))
+      return OperationOutcome.MSGUPDATED;
+    if ("MSG_VERSION_AWARE".equals(codeString))
+      return OperationOutcome.MSGVERSIONAWARE;
+    if ("MSG_VERSION_AWARE_CONFLICT".equals(codeString))
+      return OperationOutcome.MSGVERSIONAWARECONFLICT;
+    if ("MSG_VERSION_AWARE_URL".equals(codeString))
+      return OperationOutcome.MSGVERSIONAWAREURL;
+    if ("MSG_WRONG_NS".equals(codeString))
+      return OperationOutcome.MSGWRONGNS;
+    if ("SEARCH_MULTIPLE".equals(codeString))
+      return OperationOutcome.SEARCHMULTIPLE;
+    if ("UPDATE_MULTIPLE_MATCHES".equals(codeString))
+      return OperationOutcome.UPDATEMULTIPLEMATCHES;
+    if ("DELETE_MULTIPLE_MATCHES".equals(codeString))
+      return OperationOutcome.DELETEMULTIPLEMATCHES;
+    if ("SEARCH_NONE".equals(codeString))
+      return OperationOutcome.SEARCHNONE;
+    throw new IllegalArgumentException("Unknown OperationOutcome code '"+codeString+"'");
+  }
+
+  public String toCode(OperationOutcome code) {
+    if (code == OperationOutcome.MSGAUTHREQUIRED)
+      return "MSG_AUTH_REQUIRED";
+    if (code == OperationOutcome.MSGBADFORMAT)
+      return "MSG_BAD_FORMAT";
+    if (code == OperationOutcome.MSGBADSYNTAX)
+      return "MSG_BAD_SYNTAX";
+    if (code == OperationOutcome.MSGCANTPARSECONTENT)
+      return "MSG_CANT_PARSE_CONTENT";
+    if (code == OperationOutcome.MSGCANTPARSEROOT)
+      return "MSG_CANT_PARSE_ROOT";
+    if (code == OperationOutcome.MSGCREATED)
+      return "MSG_CREATED";
+    if (code == OperationOutcome.MSGDATEFORMAT)
+      return "MSG_DATE_FORMAT";
+    if (code == OperationOutcome.MSGDELETED)
+      return "MSG_DELETED";
+    if (code == OperationOutcome.MSGDELETEDDONE)
+      return "MSG_DELETED_DONE";
+    if (code == OperationOutcome.MSGDELETEDID)
+      return "MSG_DELETED_ID";
+    if (code == OperationOutcome.MSGDUPLICATEID)
+      return "MSG_DUPLICATE_ID";
+    if (code == OperationOutcome.MSGERRORPARSING)
+      return "MSG_ERROR_PARSING";
+    if (code == OperationOutcome.MSGIDINVALID)
+      return "MSG_ID_INVALID";
+    if (code == OperationOutcome.MSGIDTOOLONG)
+      return "MSG_ID_TOO_LONG";
+    if (code == OperationOutcome.MSGINVALIDID)
+      return "MSG_INVALID_ID";
+    if (code == OperationOutcome.MSGJSONOBJECT)
+      return "MSG_JSON_OBJECT";
+    if (code == OperationOutcome.MSGLOCALFAIL)
+      return "MSG_LOCAL_FAIL";
+    if (code == OperationOutcome.MSGNOMATCH)
+      return "MSG_NO_MATCH";
+    if (code == OperationOutcome.MSGNOEXIST)
+      return "MSG_NO_EXIST";
+    if (code == OperationOutcome.MSGNOMODULE)
+      return "MSG_NO_MODULE";
+    if (code == OperationOutcome.MSGNOSUMMARY)
+      return "MSG_NO_SUMMARY";
+    if (code == OperationOutcome.MSGOPNOTALLOWED)
+      return "MSG_OP_NOT_ALLOWED";
+    if (code == OperationOutcome.MSGPARAMCHAINED)
+      return "MSG_PARAM_CHAINED";
+    if (code == OperationOutcome.MSGPARAMNOREPEAT)
+      return "MSG_PARAM_NO_REPEAT";
+    if (code == OperationOutcome.MSGPARAMUNKNOWN)
+      return "MSG_PARAM_UNKNOWN";
+    if (code == OperationOutcome.MSGPARAMINVALID)
+      return "MSG_PARAM_INVALID";
+    if (code == OperationOutcome.MSGPARAMMODIFIERINVALID)
+      return "MSG_PARAM_MODIFIER_INVALID";
+    if (code == OperationOutcome.MSGRESOURCEEXAMPLEPROTECTED)
+      return "MSG_RESOURCE_EXAMPLE_PROTECTED";
+    if (code == OperationOutcome.MSGRESOURCEIDFAIL)
+      return "MSG_RESOURCE_ID_FAIL";
+    if (code == OperationOutcome.MSGRESOURCENOTALLOWED)
+      return "MSG_RESOURCE_NOT_ALLOWED";
+    if (code == OperationOutcome.MSGRESOURCEREQUIRED)
+      return "MSG_RESOURCE_REQUIRED";
+    if (code == OperationOutcome.MSGRESOURCEIDMISMATCH)
+      return "MSG_RESOURCE_ID_MISMATCH";
+    if (code == OperationOutcome.MSGRESOURCEIDMISSING)
+      return "MSG_RESOURCE_ID_MISSING";
+    if (code == OperationOutcome.MSGRESOURCETYPEMISMATCH)
+      return "MSG_RESOURCE_TYPE_MISMATCH";
+    if (code == OperationOutcome.MSGSORTUNKNOWN)
+      return "MSG_SORT_UNKNOWN";
+    if (code == OperationOutcome.MSGTRANSACTIONDUPLICATEID)
+      return "MSG_TRANSACTION_DUPLICATE_ID";
+    if (code == OperationOutcome.MSGTRANSACTIONMISSINGID)
+      return "MSG_TRANSACTION_MISSING_ID";
+    if (code == OperationOutcome.MSGUNHANDLEDNODETYPE)
+      return "MSG_UNHANDLED_NODE_TYPE";
+    if (code == OperationOutcome.MSGUNKNOWNCONTENT)
+      return "MSG_UNKNOWN_CONTENT";
+    if (code == OperationOutcome.MSGUNKNOWNOPERATION)
+      return "MSG_UNKNOWN_OPERATION";
+    if (code == OperationOutcome.MSGUNKNOWNTYPE)
+      return "MSG_UNKNOWN_TYPE";
+    if (code == OperationOutcome.MSGUPDATED)
+      return "MSG_UPDATED";
+    if (code == OperationOutcome.MSGVERSIONAWARE)
+      return "MSG_VERSION_AWARE";
+    if (code == OperationOutcome.MSGVERSIONAWARECONFLICT)
+      return "MSG_VERSION_AWARE_CONFLICT";
+    if (code == OperationOutcome.MSGVERSIONAWAREURL)
+      return "MSG_VERSION_AWARE_URL";
+    if (code == OperationOutcome.MSGWRONGNS)
+      return "MSG_WRONG_NS";
+    if (code == OperationOutcome.SEARCHMULTIPLE)
+      return "SEARCH_MULTIPLE";
+    if (code == OperationOutcome.UPDATEMULTIPLEMATCHES)
+      return "UPDATE_MULTIPLE_MATCHES";
+    if (code == OperationOutcome.DELETEMULTIPLEMATCHES)
+      return "DELETE_MULTIPLE_MATCHES";
+    if (code == OperationOutcome.SEARCHNONE)
+      return "SEARCH_NONE";
+    return "?";
+  }
+
+    public String toSystem(OperationOutcome code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationParameterUse.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationParameterUse.java
new file mode 100644
index 00000000000..3b7f47e10a0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationParameterUse.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum OperationParameterUse {
+
+        /**
+         * This is an input parameter.
+         */
+        IN, 
+        /**
+         * This is an output parameter.
+         */
+        OUT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static OperationParameterUse fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("in".equals(codeString))
+          return IN;
+        if ("out".equals(codeString))
+          return OUT;
+        throw new FHIRException("Unknown OperationParameterUse code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case IN: return "in";
+            case OUT: return "out";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/operation-parameter-use";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case IN: return "This is an input parameter.";
+            case OUT: return "This is an output parameter.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case IN: return "In";
+            case OUT: return "Out";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationParameterUseEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationParameterUseEnumFactory.java
new file mode 100644
index 00000000000..b487e117e11
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationParameterUseEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class OperationParameterUseEnumFactory implements EnumFactory {
+
+  public OperationParameterUse fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("in".equals(codeString))
+      return OperationParameterUse.IN;
+    if ("out".equals(codeString))
+      return OperationParameterUse.OUT;
+    throw new IllegalArgumentException("Unknown OperationParameterUse code '"+codeString+"'");
+  }
+
+  public String toCode(OperationParameterUse code) {
+    if (code == OperationParameterUse.IN)
+      return "in";
+    if (code == OperationParameterUse.OUT)
+      return "out";
+    return "?";
+  }
+
+    public String toSystem(OperationParameterUse code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationalStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationalStatus.java
new file mode 100644
index 00000000000..4d1cd0cf39d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationalStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum OperationalStatus {
+
+        /**
+         * The device is off.
+         */
+        OFF, 
+        /**
+         * The device is fully operational.
+         */
+        ON, 
+        /**
+         * The device is not ready.
+         */
+        NOTREADY, 
+        /**
+         * The device is ready but not actively operating.
+         */
+        STANDBY, 
+        /**
+         * The device transducer is diconnected.
+         */
+        TRANSDUCDISCON, 
+        /**
+         * The device hardware is disconnected.
+         */
+        HWDISCON, 
+        /**
+         * The device was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static OperationalStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("off".equals(codeString))
+          return OFF;
+        if ("on".equals(codeString))
+          return ON;
+        if ("not-ready".equals(codeString))
+          return NOTREADY;
+        if ("standby".equals(codeString))
+          return STANDBY;
+        if ("transduc-discon".equals(codeString))
+          return TRANSDUCDISCON;
+        if ("hw-discon".equals(codeString))
+          return HWDISCON;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown OperationalStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OFF: return "off";
+            case ON: return "on";
+            case NOTREADY: return "not-ready";
+            case STANDBY: return "standby";
+            case TRANSDUCDISCON: return "transduc-discon";
+            case HWDISCON: return "hw-discon";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/operational-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OFF: return "The device is off.";
+            case ON: return "The device is fully operational.";
+            case NOTREADY: return "The device is not ready.";
+            case STANDBY: return "The device is ready but not actively operating.";
+            case TRANSDUCDISCON: return "The device transducer is diconnected.";
+            case HWDISCON: return "The device hardware is disconnected.";
+            case ENTEREDINERROR: return "The device was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OFF: return "Off";
+            case ON: return "On";
+            case NOTREADY: return "Not Ready";
+            case STANDBY: return "Standby";
+            case TRANSDUCDISCON: return "Transducer Diconnected";
+            case HWDISCON: return "Hardware Disconnectd";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationalStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationalStatusEnumFactory.java
new file mode 100644
index 00000000000..32a787beee9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OperationalStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class OperationalStatusEnumFactory implements EnumFactory {
+
+  public OperationalStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("off".equals(codeString))
+      return OperationalStatus.OFF;
+    if ("on".equals(codeString))
+      return OperationalStatus.ON;
+    if ("not-ready".equals(codeString))
+      return OperationalStatus.NOTREADY;
+    if ("standby".equals(codeString))
+      return OperationalStatus.STANDBY;
+    if ("transduc-discon".equals(codeString))
+      return OperationalStatus.TRANSDUCDISCON;
+    if ("hw-discon".equals(codeString))
+      return OperationalStatus.HWDISCON;
+    if ("entered-in-error".equals(codeString))
+      return OperationalStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown OperationalStatus code '"+codeString+"'");
+  }
+
+  public String toCode(OperationalStatus code) {
+    if (code == OperationalStatus.OFF)
+      return "off";
+    if (code == OperationalStatus.ON)
+      return "on";
+    if (code == OperationalStatus.NOTREADY)
+      return "not-ready";
+    if (code == OperationalStatus.STANDBY)
+      return "standby";
+    if (code == OperationalStatus.TRANSDUCDISCON)
+      return "transduc-discon";
+    if (code == OperationalStatus.HWDISCON)
+      return "hw-discon";
+    if (code == OperationalStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(OperationalStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OralProsthodonticMaterial.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OralProsthodonticMaterial.java
new file mode 100644
index 00000000000..cba1767a972
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OralProsthodonticMaterial.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum OralProsthodonticMaterial {
+
+        /**
+         * Fixed Bridge
+         */
+        _1, 
+        /**
+         * Maryland Bridge
+         */
+        _2, 
+        /**
+         * Denture Acrylic
+         */
+        _3, 
+        /**
+         * Denture Chrome Cobalt
+         */
+        _4, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static OralProsthodonticMaterial fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        throw new FHIRException("Unknown OralProsthodonticMaterial code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-oralprostho";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "Fixed Bridge";
+            case _2: return "Maryland Bridge";
+            case _3: return "Denture Acrylic";
+            case _4: return "Denture Chrome Cobalt";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Fixed Bridge";
+            case _2: return "Maryland Bridge";
+            case _3: return "Denture Acrylic";
+            case _4: return "Denture Chrome Cobalt";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OralProsthodonticMaterialEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OralProsthodonticMaterialEnumFactory.java
new file mode 100644
index 00000000000..635c8327123
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OralProsthodonticMaterialEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class OralProsthodonticMaterialEnumFactory implements EnumFactory {
+
+  public OralProsthodonticMaterial fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return OralProsthodonticMaterial._1;
+    if ("2".equals(codeString))
+      return OralProsthodonticMaterial._2;
+    if ("3".equals(codeString))
+      return OralProsthodonticMaterial._3;
+    if ("4".equals(codeString))
+      return OralProsthodonticMaterial._4;
+    throw new IllegalArgumentException("Unknown OralProsthodonticMaterial code '"+codeString+"'");
+  }
+
+  public String toCode(OralProsthodonticMaterial code) {
+    if (code == OralProsthodonticMaterial._1)
+      return "1";
+    if (code == OralProsthodonticMaterial._2)
+      return "2";
+    if (code == OralProsthodonticMaterial._3)
+      return "3";
+    if (code == OralProsthodonticMaterial._4)
+      return "4";
+    return "?";
+  }
+
+    public String toSystem(OralProsthodonticMaterial code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OrganizationType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OrganizationType.java
new file mode 100644
index 00000000000..88369435744
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OrganizationType.java
@@ -0,0 +1,168 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum OrganizationType {
+
+        /**
+         * An organization that provides healthcare services.
+         */
+        PROV, 
+        /**
+         * A department or ward within a hospital (Generally is not applicable to top level organizations)
+         */
+        DEPT, 
+        /**
+         * An organizational team is usually a grouping of practitioners that perform a specific function within an organization (which could be a top level organization, or a department).
+         */
+        TEAM, 
+        /**
+         * A political body, often used when including organization records for government bodies such as a Federal Government, State or Local Government.
+         */
+        GOVT, 
+        /**
+         * A company that provides insurance to its subscribers that may include healthcare related policies.
+         */
+        INS, 
+        /**
+         * An educational institution that provides education or research facilities.
+         */
+        EDU, 
+        /**
+         * An organization that is identified as a part of a religious institution.
+         */
+        RELI, 
+        /**
+         * An organization that is identified as a Pharmaceutical/Clinical Research Sponsor.
+         */
+        CRS, 
+        /**
+         * An un-incorporated community group.
+         */
+        CG, 
+        /**
+         * An organization that is a registered business or corporation but not identified by other types.
+         */
+        BUS, 
+        /**
+         * Other type of organization not already specified.
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static OrganizationType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("prov".equals(codeString))
+          return PROV;
+        if ("dept".equals(codeString))
+          return DEPT;
+        if ("team".equals(codeString))
+          return TEAM;
+        if ("govt".equals(codeString))
+          return GOVT;
+        if ("ins".equals(codeString))
+          return INS;
+        if ("edu".equals(codeString))
+          return EDU;
+        if ("reli".equals(codeString))
+          return RELI;
+        if ("crs".equals(codeString))
+          return CRS;
+        if ("cg".equals(codeString))
+          return CG;
+        if ("bus".equals(codeString))
+          return BUS;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown OrganizationType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROV: return "prov";
+            case DEPT: return "dept";
+            case TEAM: return "team";
+            case GOVT: return "govt";
+            case INS: return "ins";
+            case EDU: return "edu";
+            case RELI: return "reli";
+            case CRS: return "crs";
+            case CG: return "cg";
+            case BUS: return "bus";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/organization-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROV: return "An organization that provides healthcare services.";
+            case DEPT: return "A department or ward within a hospital (Generally is not applicable to top level organizations)";
+            case TEAM: return "An organizational team is usually a grouping of practitioners that perform a specific function within an organization (which could be a top level organization, or a department).";
+            case GOVT: return "A political body, often used when including organization records for government bodies such as a Federal Government, State or Local Government.";
+            case INS: return "A company that provides insurance to its subscribers that may include healthcare related policies.";
+            case EDU: return "An educational institution that provides education or research facilities.";
+            case RELI: return "An organization that is identified as a part of a religious institution.";
+            case CRS: return "An organization that is identified as a Pharmaceutical/Clinical Research Sponsor.";
+            case CG: return "An un-incorporated community group.";
+            case BUS: return "An organization that is a registered business or corporation but not identified by other types.";
+            case OTHER: return "Other type of organization not already specified.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROV: return "Healthcare Provider";
+            case DEPT: return "Hospital Department";
+            case TEAM: return "Organizational team";
+            case GOVT: return "Government";
+            case INS: return "Insurance Company";
+            case EDU: return "Educational Institute";
+            case RELI: return "Religious Institution";
+            case CRS: return "Clinical Research Sponsor";
+            case CG: return "Community Group";
+            case BUS: return "Non-Healthcare Business or Corporation";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OrganizationTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OrganizationTypeEnumFactory.java
new file mode 100644
index 00000000000..eda74b4c33c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/OrganizationTypeEnumFactory.java
@@ -0,0 +1,98 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class OrganizationTypeEnumFactory implements EnumFactory {
+
+  public OrganizationType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("prov".equals(codeString))
+      return OrganizationType.PROV;
+    if ("dept".equals(codeString))
+      return OrganizationType.DEPT;
+    if ("team".equals(codeString))
+      return OrganizationType.TEAM;
+    if ("govt".equals(codeString))
+      return OrganizationType.GOVT;
+    if ("ins".equals(codeString))
+      return OrganizationType.INS;
+    if ("edu".equals(codeString))
+      return OrganizationType.EDU;
+    if ("reli".equals(codeString))
+      return OrganizationType.RELI;
+    if ("crs".equals(codeString))
+      return OrganizationType.CRS;
+    if ("cg".equals(codeString))
+      return OrganizationType.CG;
+    if ("bus".equals(codeString))
+      return OrganizationType.BUS;
+    if ("other".equals(codeString))
+      return OrganizationType.OTHER;
+    throw new IllegalArgumentException("Unknown OrganizationType code '"+codeString+"'");
+  }
+
+  public String toCode(OrganizationType code) {
+    if (code == OrganizationType.PROV)
+      return "prov";
+    if (code == OrganizationType.DEPT)
+      return "dept";
+    if (code == OrganizationType.TEAM)
+      return "team";
+    if (code == OrganizationType.GOVT)
+      return "govt";
+    if (code == OrganizationType.INS)
+      return "ins";
+    if (code == OrganizationType.EDU)
+      return "edu";
+    if (code == OrganizationType.RELI)
+      return "reli";
+    if (code == OrganizationType.CRS)
+      return "crs";
+    if (code == OrganizationType.CG)
+      return "cg";
+    if (code == OrganizationType.BUS)
+      return "bus";
+    if (code == OrganizationType.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(OrganizationType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParameterGroup.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParameterGroup.java
new file mode 100644
index 00000000000..d6497b218f7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParameterGroup.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ParameterGroup {
+
+        /**
+         * Haemodynamic Parameter Group - MDC_PGRP_HEMO
+         */
+        HAEMODYNAMIC, 
+        /**
+         * ECG Parameter Group - MDC_PGRP_ECG
+         */
+        ECG, 
+        /**
+         * Respiratory Parameter Group - MDC_PGRP_RESP
+         */
+        RESPIRATORY, 
+        /**
+         * Ventilation Parameter Group - MDC_PGRP_VENT
+         */
+        VENTILATION, 
+        /**
+         * Neurological Parameter Group - MDC_PGRP_NEURO
+         */
+        NEUROLOGICAL, 
+        /**
+         * Drug Delivery Parameter Group - MDC_PGRP_DRUG
+         */
+        DRUGDELIVERY, 
+        /**
+         * Fluid Chemistry Parameter Group - MDC_PGRP_FLUID
+         */
+        FLUIDCHEMISTRY, 
+        /**
+         * Blood Chemistry Parameter Group - MDC_PGRP_BLOOD_CHEM
+         */
+        BLOODCHEMISTRY, 
+        /**
+         * Miscellaneous Parameter Group - MDC_PGRP_MISC
+         */
+        MISCELLANEOUS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ParameterGroup fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("haemodynamic".equals(codeString))
+          return HAEMODYNAMIC;
+        if ("ecg".equals(codeString))
+          return ECG;
+        if ("respiratory".equals(codeString))
+          return RESPIRATORY;
+        if ("ventilation".equals(codeString))
+          return VENTILATION;
+        if ("neurological".equals(codeString))
+          return NEUROLOGICAL;
+        if ("drug-delivery".equals(codeString))
+          return DRUGDELIVERY;
+        if ("fluid-chemistry".equals(codeString))
+          return FLUIDCHEMISTRY;
+        if ("blood-chemistry".equals(codeString))
+          return BLOODCHEMISTRY;
+        if ("miscellaneous".equals(codeString))
+          return MISCELLANEOUS;
+        throw new FHIRException("Unknown ParameterGroup code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HAEMODYNAMIC: return "haemodynamic";
+            case ECG: return "ecg";
+            case RESPIRATORY: return "respiratory";
+            case VENTILATION: return "ventilation";
+            case NEUROLOGICAL: return "neurological";
+            case DRUGDELIVERY: return "drug-delivery";
+            case FLUIDCHEMISTRY: return "fluid-chemistry";
+            case BLOODCHEMISTRY: return "blood-chemistry";
+            case MISCELLANEOUS: return "miscellaneous";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/parameter-group";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HAEMODYNAMIC: return "Haemodynamic Parameter Group - MDC_PGRP_HEMO";
+            case ECG: return "ECG Parameter Group - MDC_PGRP_ECG";
+            case RESPIRATORY: return "Respiratory Parameter Group - MDC_PGRP_RESP";
+            case VENTILATION: return "Ventilation Parameter Group - MDC_PGRP_VENT";
+            case NEUROLOGICAL: return "Neurological Parameter Group - MDC_PGRP_NEURO";
+            case DRUGDELIVERY: return "Drug Delivery Parameter Group - MDC_PGRP_DRUG";
+            case FLUIDCHEMISTRY: return "Fluid Chemistry Parameter Group - MDC_PGRP_FLUID";
+            case BLOODCHEMISTRY: return "Blood Chemistry Parameter Group - MDC_PGRP_BLOOD_CHEM";
+            case MISCELLANEOUS: return "Miscellaneous Parameter Group - MDC_PGRP_MISC";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HAEMODYNAMIC: return "Haemodynamic Parameter Group";
+            case ECG: return "ECG Parameter Group";
+            case RESPIRATORY: return "Respiratory Parameter Group";
+            case VENTILATION: return "Ventilation Parameter Group";
+            case NEUROLOGICAL: return "Neurological Parameter Group";
+            case DRUGDELIVERY: return "Drug Delivery Parameter Group";
+            case FLUIDCHEMISTRY: return "Fluid Chemistry Parameter Group";
+            case BLOODCHEMISTRY: return "Blood Chemistry Parameter Group";
+            case MISCELLANEOUS: return "Miscellaneous Parameter Group";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParameterGroupEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParameterGroupEnumFactory.java
new file mode 100644
index 00000000000..ef800c64236
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParameterGroupEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ParameterGroupEnumFactory implements EnumFactory {
+
+  public ParameterGroup fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("haemodynamic".equals(codeString))
+      return ParameterGroup.HAEMODYNAMIC;
+    if ("ecg".equals(codeString))
+      return ParameterGroup.ECG;
+    if ("respiratory".equals(codeString))
+      return ParameterGroup.RESPIRATORY;
+    if ("ventilation".equals(codeString))
+      return ParameterGroup.VENTILATION;
+    if ("neurological".equals(codeString))
+      return ParameterGroup.NEUROLOGICAL;
+    if ("drug-delivery".equals(codeString))
+      return ParameterGroup.DRUGDELIVERY;
+    if ("fluid-chemistry".equals(codeString))
+      return ParameterGroup.FLUIDCHEMISTRY;
+    if ("blood-chemistry".equals(codeString))
+      return ParameterGroup.BLOODCHEMISTRY;
+    if ("miscellaneous".equals(codeString))
+      return ParameterGroup.MISCELLANEOUS;
+    throw new IllegalArgumentException("Unknown ParameterGroup code '"+codeString+"'");
+  }
+
+  public String toCode(ParameterGroup code) {
+    if (code == ParameterGroup.HAEMODYNAMIC)
+      return "haemodynamic";
+    if (code == ParameterGroup.ECG)
+      return "ecg";
+    if (code == ParameterGroup.RESPIRATORY)
+      return "respiratory";
+    if (code == ParameterGroup.VENTILATION)
+      return "ventilation";
+    if (code == ParameterGroup.NEUROLOGICAL)
+      return "neurological";
+    if (code == ParameterGroup.DRUGDELIVERY)
+      return "drug-delivery";
+    if (code == ParameterGroup.FLUIDCHEMISTRY)
+      return "fluid-chemistry";
+    if (code == ParameterGroup.BLOODCHEMISTRY)
+      return "blood-chemistry";
+    if (code == ParameterGroup.MISCELLANEOUS)
+      return "miscellaneous";
+    return "?";
+  }
+
+    public String toSystem(ParameterGroup code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Participantrequired.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Participantrequired.java
new file mode 100644
index 00000000000..eddcb26c00a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Participantrequired.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Participantrequired {
+
+        /**
+         * The participant is required to attend the appointment.
+         */
+        REQUIRED, 
+        /**
+         * The participant may optionally attend the appointment.
+         */
+        OPTIONAL, 
+        /**
+         * The participant is excluded from the appointment, and may not be informed of the appointment taking place. (Appointment is about them, not for them - such as 2 doctors discussing results about a patient's test).
+         */
+        INFORMATIONONLY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Participantrequired fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("required".equals(codeString))
+          return REQUIRED;
+        if ("optional".equals(codeString))
+          return OPTIONAL;
+        if ("information-only".equals(codeString))
+          return INFORMATIONONLY;
+        throw new FHIRException("Unknown Participantrequired code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REQUIRED: return "required";
+            case OPTIONAL: return "optional";
+            case INFORMATIONONLY: return "information-only";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/participantrequired";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REQUIRED: return "The participant is required to attend the appointment.";
+            case OPTIONAL: return "The participant may optionally attend the appointment.";
+            case INFORMATIONONLY: return "The participant is excluded from the appointment, and may not be informed of the appointment taking place. (Appointment is about them, not for them - such as 2 doctors discussing results about a patient's test).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REQUIRED: return "Required";
+            case OPTIONAL: return "Optional";
+            case INFORMATIONONLY: return "Information Only";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParticipantrequiredEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParticipantrequiredEnumFactory.java
new file mode 100644
index 00000000000..3fa39322de3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParticipantrequiredEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ParticipantrequiredEnumFactory implements EnumFactory {
+
+  public Participantrequired fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("required".equals(codeString))
+      return Participantrequired.REQUIRED;
+    if ("optional".equals(codeString))
+      return Participantrequired.OPTIONAL;
+    if ("information-only".equals(codeString))
+      return Participantrequired.INFORMATIONONLY;
+    throw new IllegalArgumentException("Unknown Participantrequired code '"+codeString+"'");
+  }
+
+  public String toCode(Participantrequired code) {
+    if (code == Participantrequired.REQUIRED)
+      return "required";
+    if (code == Participantrequired.OPTIONAL)
+      return "optional";
+    if (code == Participantrequired.INFORMATIONONLY)
+      return "information-only";
+    return "?";
+  }
+
+    public String toSystem(Participantrequired code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Participationstatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Participationstatus.java
new file mode 100644
index 00000000000..6201104a901
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Participationstatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Participationstatus {
+
+        /**
+         * The participant has accepted the appointment.
+         */
+        ACCEPTED, 
+        /**
+         * The participant has declined the appointment and will not participate in the appointment.
+         */
+        DECLINED, 
+        /**
+         * The participant has  tentatively accepted the appointment. This could be automatically created by a system and requires further processing before it can be accepted. There is no commitment that attendance will occur.
+         */
+        TENTATIVE, 
+        /**
+         * The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses.
+         */
+        NEEDSACTION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Participationstatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("accepted".equals(codeString))
+          return ACCEPTED;
+        if ("declined".equals(codeString))
+          return DECLINED;
+        if ("tentative".equals(codeString))
+          return TENTATIVE;
+        if ("needs-action".equals(codeString))
+          return NEEDSACTION;
+        throw new FHIRException("Unknown Participationstatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACCEPTED: return "accepted";
+            case DECLINED: return "declined";
+            case TENTATIVE: return "tentative";
+            case NEEDSACTION: return "needs-action";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/participationstatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACCEPTED: return "The participant has accepted the appointment.";
+            case DECLINED: return "The participant has declined the appointment and will not participate in the appointment.";
+            case TENTATIVE: return "The participant has  tentatively accepted the appointment. This could be automatically created by a system and requires further processing before it can be accepted. There is no commitment that attendance will occur.";
+            case NEEDSACTION: return "The participant needs to indicate if they accept the appointment by changing this status to one of the other statuses.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACCEPTED: return "Accepted";
+            case DECLINED: return "Declined";
+            case TENTATIVE: return "Tentative";
+            case NEEDSACTION: return "Needs Action";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParticipationstatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParticipationstatusEnumFactory.java
new file mode 100644
index 00000000000..6d25f0c8c55
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ParticipationstatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ParticipationstatusEnumFactory implements EnumFactory {
+
+  public Participationstatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("accepted".equals(codeString))
+      return Participationstatus.ACCEPTED;
+    if ("declined".equals(codeString))
+      return Participationstatus.DECLINED;
+    if ("tentative".equals(codeString))
+      return Participationstatus.TENTATIVE;
+    if ("needs-action".equals(codeString))
+      return Participationstatus.NEEDSACTION;
+    throw new IllegalArgumentException("Unknown Participationstatus code '"+codeString+"'");
+  }
+
+  public String toCode(Participationstatus code) {
+    if (code == Participationstatus.ACCEPTED)
+      return "accepted";
+    if (code == Participationstatus.DECLINED)
+      return "declined";
+    if (code == Participationstatus.TENTATIVE)
+      return "tentative";
+    if (code == Participationstatus.NEEDSACTION)
+      return "needs-action";
+    return "?";
+  }
+
+    public String toSystem(Participationstatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PatientMpiMatch.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PatientMpiMatch.java
new file mode 100644
index 00000000000..d92c6b0e737
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PatientMpiMatch.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PatientMpiMatch {
+
+        /**
+         * This record meets the MPI criteria to be automatically considered as a full match.
+         */
+        CERTAIN, 
+        /**
+         * This record is a close match, but not a certain match. Additional review (e.g. by a human) may be required before using this as a match.
+         */
+        PROBABLE, 
+        /**
+         * This record may be a matching one. Additional review (e.g. by a human) SHOULD be performed before using this as a match.
+         */
+        POSSIBLE, 
+        /**
+         * This record is known not to be a match. Note that usually non-matching records are not returned, but in some cases records previously or likely considered as a match may specifically be negated by the MPI.
+         */
+        CERTAINLYNOT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PatientMpiMatch fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("certain".equals(codeString))
+          return CERTAIN;
+        if ("probable".equals(codeString))
+          return PROBABLE;
+        if ("possible".equals(codeString))
+          return POSSIBLE;
+        if ("certainly-not".equals(codeString))
+          return CERTAINLYNOT;
+        throw new FHIRException("Unknown PatientMpiMatch code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CERTAIN: return "certain";
+            case PROBABLE: return "probable";
+            case POSSIBLE: return "possible";
+            case CERTAINLYNOT: return "certainly-not";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/patient-mpi-match";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CERTAIN: return "This record meets the MPI criteria to be automatically considered as a full match.";
+            case PROBABLE: return "This record is a close match, but not a certain match. Additional review (e.g. by a human) may be required before using this as a match.";
+            case POSSIBLE: return "This record may be a matching one. Additional review (e.g. by a human) SHOULD be performed before using this as a match.";
+            case CERTAINLYNOT: return "This record is known not to be a match. Note that usually non-matching records are not returned, but in some cases records previously or likely considered as a match may specifically be negated by the MPI.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CERTAIN: return "Certain Match";
+            case PROBABLE: return "Probable Match";
+            case POSSIBLE: return "Possible Match";
+            case CERTAINLYNOT: return "Certainly Not a Match";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PatientMpiMatchEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PatientMpiMatchEnumFactory.java
new file mode 100644
index 00000000000..77e41d205b0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PatientMpiMatchEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PatientMpiMatchEnumFactory implements EnumFactory {
+
+  public PatientMpiMatch fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("certain".equals(codeString))
+      return PatientMpiMatch.CERTAIN;
+    if ("probable".equals(codeString))
+      return PatientMpiMatch.PROBABLE;
+    if ("possible".equals(codeString))
+      return PatientMpiMatch.POSSIBLE;
+    if ("certainly-not".equals(codeString))
+      return PatientMpiMatch.CERTAINLYNOT;
+    throw new IllegalArgumentException("Unknown PatientMpiMatch code '"+codeString+"'");
+  }
+
+  public String toCode(PatientMpiMatch code) {
+    if (code == PatientMpiMatch.CERTAIN)
+      return "certain";
+    if (code == PatientMpiMatch.PROBABLE)
+      return "probable";
+    if (code == PatientMpiMatch.POSSIBLE)
+      return "possible";
+    if (code == PatientMpiMatch.CERTAINLYNOT)
+      return "certainly-not";
+    return "?";
+  }
+
+    public String toSystem(PatientMpiMatch code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Payeetype.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Payeetype.java
new file mode 100644
index 00000000000..02ace275c42
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Payeetype.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Payeetype {
+
+        /**
+         * The subscriber (policy holder) will be reimbursed.
+         */
+        SUBSCRIBER, 
+        /**
+         * Any benefit payable will be paid to the provider (Assignment of Benefit).
+         */
+        PROVIDER, 
+        /**
+         * Any benefit payable will be paid to a third party such as a guarrantor.
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Payeetype fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("subscriber".equals(codeString))
+          return SUBSCRIBER;
+        if ("provider".equals(codeString))
+          return PROVIDER;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown Payeetype code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SUBSCRIBER: return "subscriber";
+            case PROVIDER: return "provider";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/payeetype";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SUBSCRIBER: return "The subscriber (policy holder) will be reimbursed.";
+            case PROVIDER: return "Any benefit payable will be paid to the provider (Assignment of Benefit).";
+            case OTHER: return "Any benefit payable will be paid to a third party such as a guarrantor.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SUBSCRIBER: return "Subscriber";
+            case PROVIDER: return "Provider";
+            case OTHER: return "Provider";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PayeetypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PayeetypeEnumFactory.java
new file mode 100644
index 00000000000..a47081d9663
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PayeetypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PayeetypeEnumFactory implements EnumFactory {
+
+  public Payeetype fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("subscriber".equals(codeString))
+      return Payeetype.SUBSCRIBER;
+    if ("provider".equals(codeString))
+      return Payeetype.PROVIDER;
+    if ("other".equals(codeString))
+      return Payeetype.OTHER;
+    throw new IllegalArgumentException("Unknown Payeetype code '"+codeString+"'");
+  }
+
+  public String toCode(Payeetype code) {
+    if (code == Payeetype.SUBSCRIBER)
+      return "subscriber";
+    if (code == Payeetype.PROVIDER)
+      return "provider";
+    if (code == Payeetype.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(Payeetype code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentAdjustmentReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentAdjustmentReason.java
new file mode 100644
index 00000000000..cffbe8bd2a4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentAdjustmentReason.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PaymentAdjustmentReason {
+
+        /**
+         * Prior Payment Reversal
+         */
+        A001, 
+        /**
+         * Prior Overpayment
+         */
+        A002, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PaymentAdjustmentReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("a001".equals(codeString))
+          return A001;
+        if ("a002".equals(codeString))
+          return A002;
+        throw new FHIRException("Unknown PaymentAdjustmentReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A001: return "a001";
+            case A002: return "a002";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/payment-adjustment-reason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A001: return "Prior Payment Reversal";
+            case A002: return "Prior Overpayment";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A001: return "Prior Payment Reversal";
+            case A002: return "Prior Overpayment";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentAdjustmentReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentAdjustmentReasonEnumFactory.java
new file mode 100644
index 00000000000..b3324ae182e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentAdjustmentReasonEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PaymentAdjustmentReasonEnumFactory implements EnumFactory {
+
+  public PaymentAdjustmentReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("a001".equals(codeString))
+      return PaymentAdjustmentReason.A001;
+    if ("a002".equals(codeString))
+      return PaymentAdjustmentReason.A002;
+    throw new IllegalArgumentException("Unknown PaymentAdjustmentReason code '"+codeString+"'");
+  }
+
+  public String toCode(PaymentAdjustmentReason code) {
+    if (code == PaymentAdjustmentReason.A001)
+      return "a001";
+    if (code == PaymentAdjustmentReason.A002)
+      return "a002";
+    return "?";
+  }
+
+    public String toSystem(PaymentAdjustmentReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentStatus.java
new file mode 100644
index 00000000000..4447bf8692f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentStatus.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PaymentStatus {
+
+        /**
+         * The payment has been sent physically or electronically.
+         */
+        PAID, 
+        /**
+         * The payment has been received by the payee.
+         */
+        CLEARED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PaymentStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("paid".equals(codeString))
+          return PAID;
+        if ("cleared".equals(codeString))
+          return CLEARED;
+        throw new FHIRException("Unknown PaymentStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PAID: return "paid";
+            case CLEARED: return "cleared";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/paymentstatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PAID: return "The payment has been sent physically or electronically.";
+            case CLEARED: return "The payment has been received by the payee.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PAID: return "Paid";
+            case CLEARED: return "Cleared";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentStatusEnumFactory.java
new file mode 100644
index 00000000000..63179586811
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentStatusEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PaymentStatusEnumFactory implements EnumFactory {
+
+  public PaymentStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("paid".equals(codeString))
+      return PaymentStatus.PAID;
+    if ("cleared".equals(codeString))
+      return PaymentStatus.CLEARED;
+    throw new IllegalArgumentException("Unknown PaymentStatus code '"+codeString+"'");
+  }
+
+  public String toCode(PaymentStatus code) {
+    if (code == PaymentStatus.PAID)
+      return "paid";
+    if (code == PaymentStatus.CLEARED)
+      return "cleared";
+    return "?";
+  }
+
+    public String toSystem(PaymentStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentType.java
new file mode 100644
index 00000000000..f4f725daf9e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PaymentType {
+
+        /**
+         * The amount is partial or complete settlement of the amounts due.
+         */
+        PAYMENT, 
+        /**
+         * The amount is an adjustment regarding claims already paid.
+         */
+        ADJUSTMENT, 
+        /**
+         * The amount is an advance against future claims.
+         */
+        ADVANCE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PaymentType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("payment".equals(codeString))
+          return PAYMENT;
+        if ("adjustment".equals(codeString))
+          return ADJUSTMENT;
+        if ("advance".equals(codeString))
+          return ADVANCE;
+        throw new FHIRException("Unknown PaymentType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PAYMENT: return "payment";
+            case ADJUSTMENT: return "adjustment";
+            case ADVANCE: return "advance";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/payment-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PAYMENT: return "The amount is partial or complete settlement of the amounts due.";
+            case ADJUSTMENT: return "The amount is an adjustment regarding claims already paid.";
+            case ADVANCE: return "The amount is an advance against future claims.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PAYMENT: return "Payment";
+            case ADJUSTMENT: return "Adjustment";
+            case ADVANCE: return "Advance";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentTypeEnumFactory.java
new file mode 100644
index 00000000000..eb65cce190e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PaymentTypeEnumFactory implements EnumFactory {
+
+  public PaymentType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("payment".equals(codeString))
+      return PaymentType.PAYMENT;
+    if ("adjustment".equals(codeString))
+      return PaymentType.ADJUSTMENT;
+    if ("advance".equals(codeString))
+      return PaymentType.ADVANCE;
+    throw new IllegalArgumentException("Unknown PaymentType code '"+codeString+"'");
+  }
+
+  public String toCode(PaymentType code) {
+    if (code == PaymentType.PAYMENT)
+      return "payment";
+    if (code == PaymentType.ADJUSTMENT)
+      return "adjustment";
+    if (code == PaymentType.ADVANCE)
+      return "advance";
+    return "?";
+  }
+
+    public String toSystem(PaymentType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentnoticeStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentnoticeStatus.java
new file mode 100644
index 00000000000..0a3dca653ac
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentnoticeStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PaymentnoticeStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PaymentnoticeStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown PaymentnoticeStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/paymentnotice-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentnoticeStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentnoticeStatusEnumFactory.java
new file mode 100644
index 00000000000..ff2933fa52d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentnoticeStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PaymentnoticeStatusEnumFactory implements EnumFactory {
+
+  public PaymentnoticeStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return PaymentnoticeStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return PaymentnoticeStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return PaymentnoticeStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return PaymentnoticeStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown PaymentnoticeStatus code '"+codeString+"'");
+  }
+
+  public String toCode(PaymentnoticeStatus code) {
+    if (code == PaymentnoticeStatus.ACTIVE)
+      return "active";
+    if (code == PaymentnoticeStatus.CANCELLED)
+      return "cancelled";
+    if (code == PaymentnoticeStatus.DRAFT)
+      return "draft";
+    if (code == PaymentnoticeStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(PaymentnoticeStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentreconciliationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentreconciliationStatus.java
new file mode 100644
index 00000000000..0827183871f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentreconciliationStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PaymentreconciliationStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PaymentreconciliationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown PaymentreconciliationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/paymentreconciliation-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentreconciliationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentreconciliationStatusEnumFactory.java
new file mode 100644
index 00000000000..b0663921cf1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PaymentreconciliationStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PaymentreconciliationStatusEnumFactory implements EnumFactory {
+
+  public PaymentreconciliationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return PaymentreconciliationStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return PaymentreconciliationStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return PaymentreconciliationStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return PaymentreconciliationStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown PaymentreconciliationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(PaymentreconciliationStatus code) {
+    if (code == PaymentreconciliationStatus.ACTIVE)
+      return "active";
+    if (code == PaymentreconciliationStatus.CANCELLED)
+      return "cancelled";
+    if (code == PaymentreconciliationStatus.DRAFT)
+      return "draft";
+    if (code == PaymentreconciliationStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(PaymentreconciliationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PlanDefinitionType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PlanDefinitionType.java
new file mode 100644
index 00000000000..27564970cd3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PlanDefinitionType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PlanDefinitionType {
+
+        /**
+         * A pre-defined and approved group of orders related to a particular clinical condition (e.g. hypertension treatment and monitoring) or stage of care (e.g. hospital admission to Coronary Care Unit). An order set is used as a checklist for the clinician when managing a patient with a specific condition. It is a structured collection of orders relevant to that condition and presented to the clinician in a computerized provider order entry (CPOE) system
+         */
+        ORDERSET, 
+        /**
+         * A set of activities that can be performed that have relationships in terms of order, pre-conditions, etc.
+         */
+        PROTOCOL, 
+        /**
+         * A decision support rule of the form [on Event] if Condition then Action. It is intended to be a shareable, computable definition of actions that should be taken whenever some condition is met in response to a particular event or events
+         */
+        ECARULE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PlanDefinitionType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("order-set".equals(codeString))
+          return ORDERSET;
+        if ("protocol".equals(codeString))
+          return PROTOCOL;
+        if ("eca-rule".equals(codeString))
+          return ECARULE;
+        throw new FHIRException("Unknown PlanDefinitionType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ORDERSET: return "order-set";
+            case PROTOCOL: return "protocol";
+            case ECARULE: return "eca-rule";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/plan-definition-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ORDERSET: return "A pre-defined and approved group of orders related to a particular clinical condition (e.g. hypertension treatment and monitoring) or stage of care (e.g. hospital admission to Coronary Care Unit). An order set is used as a checklist for the clinician when managing a patient with a specific condition. It is a structured collection of orders relevant to that condition and presented to the clinician in a computerized provider order entry (CPOE) system";
+            case PROTOCOL: return "A set of activities that can be performed that have relationships in terms of order, pre-conditions, etc.";
+            case ECARULE: return "A decision support rule of the form [on Event] if Condition then Action. It is intended to be a shareable, computable definition of actions that should be taken whenever some condition is met in response to a particular event or events";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ORDERSET: return "Order Set";
+            case PROTOCOL: return "Protocol";
+            case ECARULE: return "ECA Rule";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PlanDefinitionTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PlanDefinitionTypeEnumFactory.java
new file mode 100644
index 00000000000..31f87725b5b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PlanDefinitionTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PlanDefinitionTypeEnumFactory implements EnumFactory {
+
+  public PlanDefinitionType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("order-set".equals(codeString))
+      return PlanDefinitionType.ORDERSET;
+    if ("protocol".equals(codeString))
+      return PlanDefinitionType.PROTOCOL;
+    if ("eca-rule".equals(codeString))
+      return PlanDefinitionType.ECARULE;
+    throw new IllegalArgumentException("Unknown PlanDefinitionType code '"+codeString+"'");
+  }
+
+  public String toCode(PlanDefinitionType code) {
+    if (code == PlanDefinitionType.ORDERSET)
+      return "order-set";
+    if (code == PlanDefinitionType.PROTOCOL)
+      return "protocol";
+    if (code == PlanDefinitionType.ECARULE)
+      return "eca-rule";
+    return "?";
+  }
+
+    public String toSystem(PlanDefinitionType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PolicyholderRelationship.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PolicyholderRelationship.java
new file mode 100644
index 00000000000..e2136eb2150
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PolicyholderRelationship.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PolicyholderRelationship {
+
+        /**
+         * The Beneficiary is a child of the Policyholder
+         */
+        CHILD, 
+        /**
+         * The Beneficiary is a parent of the Policyholder
+         */
+        PARENT, 
+        /**
+         * The Beneficiary is a spouse or equivalent of the Policyholder
+         */
+        SPOUSE, 
+        /**
+         * The Beneficiary is a common law spouse or equivalent of the Policyholder
+         */
+        COMMON, 
+        /**
+         * The Beneficiary has some other relationship the Policyholder
+         */
+        OTHER, 
+        /**
+         * The Beneficiary is the Policyholder
+         */
+        SELF, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PolicyholderRelationship fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("child".equals(codeString))
+          return CHILD;
+        if ("parent".equals(codeString))
+          return PARENT;
+        if ("spouse".equals(codeString))
+          return SPOUSE;
+        if ("common".equals(codeString))
+          return COMMON;
+        if ("other".equals(codeString))
+          return OTHER;
+        if ("self".equals(codeString))
+          return SELF;
+        throw new FHIRException("Unknown PolicyholderRelationship code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CHILD: return "child";
+            case PARENT: return "parent";
+            case SPOUSE: return "spouse";
+            case COMMON: return "common";
+            case OTHER: return "other";
+            case SELF: return "self";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/policyholder-relationship";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CHILD: return "The Beneficiary is a child of the Policyholder";
+            case PARENT: return "The Beneficiary is a parent of the Policyholder";
+            case SPOUSE: return "The Beneficiary is a spouse or equivalent of the Policyholder";
+            case COMMON: return "The Beneficiary is a common law spouse or equivalent of the Policyholder";
+            case OTHER: return "The Beneficiary has some other relationship the Policyholder";
+            case SELF: return "The Beneficiary is the Policyholder";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CHILD: return "Child";
+            case PARENT: return "Parent";
+            case SPOUSE: return "Spouse";
+            case COMMON: return "Common Law Spouse";
+            case OTHER: return "Other";
+            case SELF: return "Self";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PolicyholderRelationshipEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PolicyholderRelationshipEnumFactory.java
new file mode 100644
index 00000000000..4214c82f08b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PolicyholderRelationshipEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PolicyholderRelationshipEnumFactory implements EnumFactory {
+
+  public PolicyholderRelationship fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("child".equals(codeString))
+      return PolicyholderRelationship.CHILD;
+    if ("parent".equals(codeString))
+      return PolicyholderRelationship.PARENT;
+    if ("spouse".equals(codeString))
+      return PolicyholderRelationship.SPOUSE;
+    if ("common".equals(codeString))
+      return PolicyholderRelationship.COMMON;
+    if ("other".equals(codeString))
+      return PolicyholderRelationship.OTHER;
+    if ("self".equals(codeString))
+      return PolicyholderRelationship.SELF;
+    throw new IllegalArgumentException("Unknown PolicyholderRelationship code '"+codeString+"'");
+  }
+
+  public String toCode(PolicyholderRelationship code) {
+    if (code == PolicyholderRelationship.CHILD)
+      return "child";
+    if (code == PolicyholderRelationship.PARENT)
+      return "parent";
+    if (code == PolicyholderRelationship.SPOUSE)
+      return "spouse";
+    if (code == PolicyholderRelationship.COMMON)
+      return "common";
+    if (code == PolicyholderRelationship.OTHER)
+      return "other";
+    if (code == PolicyholderRelationship.SELF)
+      return "self";
+    return "?";
+  }
+
+    public String toSystem(PolicyholderRelationship code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerRole.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerRole.java
new file mode 100644
index 00000000000..ba3c6c30acd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerRole.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PractitionerRole {
+
+        /**
+         * A qualified/registered medical practitioner
+         */
+        DOCTOR, 
+        /**
+         * A practitoner with nursing experience that may be qualified/registered
+         */
+        NURSE, 
+        /**
+         * A qualified/registered/licensed pharmacist
+         */
+        PHARMACIST, 
+        /**
+         * A practitioner that may perform research
+         */
+        RESEARCHER, 
+        /**
+         * Someone who is able to provide educational services
+         */
+        TEACHER, 
+        /**
+         * Someone who is qualified in Information and Communication Technologies
+         */
+        ICT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PractitionerRole fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("doctor".equals(codeString))
+          return DOCTOR;
+        if ("nurse".equals(codeString))
+          return NURSE;
+        if ("pharmacist".equals(codeString))
+          return PHARMACIST;
+        if ("researcher".equals(codeString))
+          return RESEARCHER;
+        if ("teacher".equals(codeString))
+          return TEACHER;
+        if ("ict".equals(codeString))
+          return ICT;
+        throw new FHIRException("Unknown PractitionerRole code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DOCTOR: return "doctor";
+            case NURSE: return "nurse";
+            case PHARMACIST: return "pharmacist";
+            case RESEARCHER: return "researcher";
+            case TEACHER: return "teacher";
+            case ICT: return "ict";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/practitioner-role";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DOCTOR: return "A qualified/registered medical practitioner";
+            case NURSE: return "A practitoner with nursing experience that may be qualified/registered";
+            case PHARMACIST: return "A qualified/registered/licensed pharmacist";
+            case RESEARCHER: return "A practitioner that may perform research";
+            case TEACHER: return "Someone who is able to provide educational services";
+            case ICT: return "Someone who is qualified in Information and Communication Technologies";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DOCTOR: return "Doctor";
+            case NURSE: return "Nurse";
+            case PHARMACIST: return "Pharmacist";
+            case RESEARCHER: return "Researcher";
+            case TEACHER: return "Teacher/educator";
+            case ICT: return "ICT professional";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerRoleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerRoleEnumFactory.java
new file mode 100644
index 00000000000..d253577b8cd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerRoleEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PractitionerRoleEnumFactory implements EnumFactory {
+
+  public PractitionerRole fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("doctor".equals(codeString))
+      return PractitionerRole.DOCTOR;
+    if ("nurse".equals(codeString))
+      return PractitionerRole.NURSE;
+    if ("pharmacist".equals(codeString))
+      return PractitionerRole.PHARMACIST;
+    if ("researcher".equals(codeString))
+      return PractitionerRole.RESEARCHER;
+    if ("teacher".equals(codeString))
+      return PractitionerRole.TEACHER;
+    if ("ict".equals(codeString))
+      return PractitionerRole.ICT;
+    throw new IllegalArgumentException("Unknown PractitionerRole code '"+codeString+"'");
+  }
+
+  public String toCode(PractitionerRole code) {
+    if (code == PractitionerRole.DOCTOR)
+      return "doctor";
+    if (code == PractitionerRole.NURSE)
+      return "nurse";
+    if (code == PractitionerRole.PHARMACIST)
+      return "pharmacist";
+    if (code == PractitionerRole.RESEARCHER)
+      return "researcher";
+    if (code == PractitionerRole.TEACHER)
+      return "teacher";
+    if (code == PractitionerRole.ICT)
+      return "ict";
+    return "?";
+  }
+
+    public String toSystem(PractitionerRole code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerSpecialty.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerSpecialty.java
new file mode 100644
index 00000000000..91f69be819e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerSpecialty.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PractitionerSpecialty {
+
+        /**
+         * null
+         */
+        CARDIO, 
+        /**
+         * null
+         */
+        DENT, 
+        /**
+         * null
+         */
+        DIETARY, 
+        /**
+         * null
+         */
+        MIDW, 
+        /**
+         * null
+         */
+        SYSARCH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PractitionerSpecialty fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("cardio".equals(codeString))
+          return CARDIO;
+        if ("dent".equals(codeString))
+          return DENT;
+        if ("dietary".equals(codeString))
+          return DIETARY;
+        if ("midw".equals(codeString))
+          return MIDW;
+        if ("sysarch".equals(codeString))
+          return SYSARCH;
+        throw new FHIRException("Unknown PractitionerSpecialty code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CARDIO: return "cardio";
+            case DENT: return "dent";
+            case DIETARY: return "dietary";
+            case MIDW: return "midw";
+            case SYSARCH: return "sysarch";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/practitioner-specialty";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CARDIO: return "";
+            case DENT: return "";
+            case DIETARY: return "";
+            case MIDW: return "";
+            case SYSARCH: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CARDIO: return "Cardiologist";
+            case DENT: return "Dentist";
+            case DIETARY: return "Dietary consultant";
+            case MIDW: return "Midwife";
+            case SYSARCH: return "Systems architect";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerSpecialtyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerSpecialtyEnumFactory.java
new file mode 100644
index 00000000000..20ed7a0f812
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PractitionerSpecialtyEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PractitionerSpecialtyEnumFactory implements EnumFactory {
+
+  public PractitionerSpecialty fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("cardio".equals(codeString))
+      return PractitionerSpecialty.CARDIO;
+    if ("dent".equals(codeString))
+      return PractitionerSpecialty.DENT;
+    if ("dietary".equals(codeString))
+      return PractitionerSpecialty.DIETARY;
+    if ("midw".equals(codeString))
+      return PractitionerSpecialty.MIDW;
+    if ("sysarch".equals(codeString))
+      return PractitionerSpecialty.SYSARCH;
+    throw new IllegalArgumentException("Unknown PractitionerSpecialty code '"+codeString+"'");
+  }
+
+  public String toCode(PractitionerSpecialty code) {
+    if (code == PractitionerSpecialty.CARDIO)
+      return "cardio";
+    if (code == PractitionerSpecialty.DENT)
+      return "dent";
+    if (code == PractitionerSpecialty.DIETARY)
+      return "dietary";
+    if (code == PractitionerSpecialty.MIDW)
+      return "midw";
+    if (code == PractitionerSpecialty.SYSARCH)
+      return "sysarch";
+    return "?";
+  }
+
+    public String toSystem(PractitionerSpecialty code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureProgressStatusCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureProgressStatusCodes.java
new file mode 100644
index 00000000000..051a3b54940
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureProgressStatusCodes.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProcedureProgressStatusCodes {
+
+        /**
+         * A patient is in the Operating Room.
+         */
+        INOPERATINGROOM, 
+        /**
+         * The patient is prepared for a procedure.
+         */
+        PREPARED, 
+        /**
+         * The patient is under anesthesia.
+         */
+        ANESTHESIAINDUCED, 
+        /**
+         * The patient has open incision(s).
+         */
+        OPENINCISION, 
+        /**
+         * The patient has incision(s) closed.
+         */
+        CLOSEDINCISION, 
+        /**
+         * The patient is in the recovery room.
+         */
+        INRECOVERYROOM, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProcedureProgressStatusCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("in-operating-room".equals(codeString))
+          return INOPERATINGROOM;
+        if ("prepared".equals(codeString))
+          return PREPARED;
+        if ("anesthesia-induced".equals(codeString))
+          return ANESTHESIAINDUCED;
+        if ("open-incision".equals(codeString))
+          return OPENINCISION;
+        if ("closed-incision".equals(codeString))
+          return CLOSEDINCISION;
+        if ("in-recovery-room".equals(codeString))
+          return INRECOVERYROOM;
+        throw new FHIRException("Unknown ProcedureProgressStatusCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INOPERATINGROOM: return "in-operating-room";
+            case PREPARED: return "prepared";
+            case ANESTHESIAINDUCED: return "anesthesia-induced";
+            case OPENINCISION: return "open-incision";
+            case CLOSEDINCISION: return "closed-incision";
+            case INRECOVERYROOM: return "in-recovery-room";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/procedure-progress-status-code";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INOPERATINGROOM: return "A patient is in the Operating Room.";
+            case PREPARED: return "The patient is prepared for a procedure.";
+            case ANESTHESIAINDUCED: return "The patient is under anesthesia.";
+            case OPENINCISION: return "The patient has open incision(s).";
+            case CLOSEDINCISION: return "The patient has incision(s) closed.";
+            case INRECOVERYROOM: return "The patient is in the recovery room.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INOPERATINGROOM: return "In Operating Room";
+            case PREPARED: return "Prepared";
+            case ANESTHESIAINDUCED: return "Anesthesia Induced";
+            case OPENINCISION: return "Open Incision";
+            case CLOSEDINCISION: return "Closed Incision";
+            case INRECOVERYROOM: return "In Recovery Room";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureProgressStatusCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureProgressStatusCodesEnumFactory.java
new file mode 100644
index 00000000000..45c22f87ba9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureProgressStatusCodesEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProcedureProgressStatusCodesEnumFactory implements EnumFactory {
+
+  public ProcedureProgressStatusCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("in-operating-room".equals(codeString))
+      return ProcedureProgressStatusCodes.INOPERATINGROOM;
+    if ("prepared".equals(codeString))
+      return ProcedureProgressStatusCodes.PREPARED;
+    if ("anesthesia-induced".equals(codeString))
+      return ProcedureProgressStatusCodes.ANESTHESIAINDUCED;
+    if ("open-incision".equals(codeString))
+      return ProcedureProgressStatusCodes.OPENINCISION;
+    if ("closed-incision".equals(codeString))
+      return ProcedureProgressStatusCodes.CLOSEDINCISION;
+    if ("in-recovery-room".equals(codeString))
+      return ProcedureProgressStatusCodes.INRECOVERYROOM;
+    throw new IllegalArgumentException("Unknown ProcedureProgressStatusCodes code '"+codeString+"'");
+  }
+
+  public String toCode(ProcedureProgressStatusCodes code) {
+    if (code == ProcedureProgressStatusCodes.INOPERATINGROOM)
+      return "in-operating-room";
+    if (code == ProcedureProgressStatusCodes.PREPARED)
+      return "prepared";
+    if (code == ProcedureProgressStatusCodes.ANESTHESIAINDUCED)
+      return "anesthesia-induced";
+    if (code == ProcedureProgressStatusCodes.OPENINCISION)
+      return "open-incision";
+    if (code == ProcedureProgressStatusCodes.CLOSEDINCISION)
+      return "closed-incision";
+    if (code == ProcedureProgressStatusCodes.INRECOVERYROOM)
+      return "in-recovery-room";
+    return "?";
+  }
+
+    public String toSystem(ProcedureProgressStatusCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRelationshipType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRelationshipType.java
new file mode 100644
index 00000000000..50f0327e6a2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRelationshipType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProcedureRelationshipType {
+
+        /**
+         * This procedure had to be performed because of the related one.
+         */
+        CAUSEDBY, 
+        /**
+         * This procedure caused the related one to be performed.
+         */
+        BECAUSEOF, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProcedureRelationshipType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("caused-by".equals(codeString))
+          return CAUSEDBY;
+        if ("because-of".equals(codeString))
+          return BECAUSEOF;
+        throw new FHIRException("Unknown ProcedureRelationshipType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CAUSEDBY: return "caused-by";
+            case BECAUSEOF: return "because-of";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/procedure-relationship-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CAUSEDBY: return "This procedure had to be performed because of the related one.";
+            case BECAUSEOF: return "This procedure caused the related one to be performed.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CAUSEDBY: return "Caused By";
+            case BECAUSEOF: return "Because Of";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRelationshipTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRelationshipTypeEnumFactory.java
new file mode 100644
index 00000000000..da18b936e62
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRelationshipTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProcedureRelationshipTypeEnumFactory implements EnumFactory {
+
+  public ProcedureRelationshipType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("caused-by".equals(codeString))
+      return ProcedureRelationshipType.CAUSEDBY;
+    if ("because-of".equals(codeString))
+      return ProcedureRelationshipType.BECAUSEOF;
+    throw new IllegalArgumentException("Unknown ProcedureRelationshipType code '"+codeString+"'");
+  }
+
+  public String toCode(ProcedureRelationshipType code) {
+    if (code == ProcedureRelationshipType.CAUSEDBY)
+      return "caused-by";
+    if (code == ProcedureRelationshipType.BECAUSEOF)
+      return "because-of";
+    return "?";
+  }
+
+    public String toSystem(ProcedureRelationshipType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestPriority.java
new file mode 100644
index 00000000000..eec83d4baed
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestPriority.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProcedureRequestPriority {
+
+        /**
+         * The request has a normal priority.
+         */
+        ROUTINE, 
+        /**
+         * The request should be done urgently.
+         */
+        URGENT, 
+        /**
+         * The request is time-critical.
+         */
+        STAT, 
+        /**
+         * The request should be acted on as soon as possible.
+         */
+        ASAP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProcedureRequestPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("routine".equals(codeString))
+          return ROUTINE;
+        if ("urgent".equals(codeString))
+          return URGENT;
+        if ("stat".equals(codeString))
+          return STAT;
+        if ("asap".equals(codeString))
+          return ASAP;
+        throw new FHIRException("Unknown ProcedureRequestPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ROUTINE: return "routine";
+            case URGENT: return "urgent";
+            case STAT: return "stat";
+            case ASAP: return "asap";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/procedure-request-priority";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ROUTINE: return "The request has a normal priority.";
+            case URGENT: return "The request should be done urgently.";
+            case STAT: return "The request is time-critical.";
+            case ASAP: return "The request should be acted on as soon as possible.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ROUTINE: return "Routine";
+            case URGENT: return "Urgent";
+            case STAT: return "Stat";
+            case ASAP: return "ASAP";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestPriorityEnumFactory.java
new file mode 100644
index 00000000000..00d8de50abb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestPriorityEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProcedureRequestPriorityEnumFactory implements EnumFactory {
+
+  public ProcedureRequestPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("routine".equals(codeString))
+      return ProcedureRequestPriority.ROUTINE;
+    if ("urgent".equals(codeString))
+      return ProcedureRequestPriority.URGENT;
+    if ("stat".equals(codeString))
+      return ProcedureRequestPriority.STAT;
+    if ("asap".equals(codeString))
+      return ProcedureRequestPriority.ASAP;
+    throw new IllegalArgumentException("Unknown ProcedureRequestPriority code '"+codeString+"'");
+  }
+
+  public String toCode(ProcedureRequestPriority code) {
+    if (code == ProcedureRequestPriority.ROUTINE)
+      return "routine";
+    if (code == ProcedureRequestPriority.URGENT)
+      return "urgent";
+    if (code == ProcedureRequestPriority.STAT)
+      return "stat";
+    if (code == ProcedureRequestPriority.ASAP)
+      return "asap";
+    return "?";
+  }
+
+    public String toSystem(ProcedureRequestPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestStatus.java
new file mode 100644
index 00000000000..1892762f27e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestStatus.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProcedureRequestStatus {
+
+        /**
+         * The request has been proposed.
+         */
+        PROPOSED, 
+        /**
+         * The request is in preliminary form, prior to being requested.
+         */
+        DRAFT, 
+        /**
+         * The request has been placed.
+         */
+        REQUESTED, 
+        /**
+         * The receiving system has received the request but not yet decided whether it will be performed.
+         */
+        RECEIVED, 
+        /**
+         * The receiving system has accepted the request, but work has not yet commenced.
+         */
+        ACCEPTED, 
+        /**
+         * The work to fulfill the request is happening.
+         */
+        INPROGRESS, 
+        /**
+         * The work has been completed, the report(s) released, and no further work is planned.
+         */
+        COMPLETED, 
+        /**
+         * The request has been held by originating system/user request.
+         */
+        SUSPENDED, 
+        /**
+         * The receiving system has declined to fulfill the request.
+         */
+        REJECTED, 
+        /**
+         * The request was attempted, but due to some procedural error, it could not be completed.
+         */
+        ABORTED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProcedureRequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposed".equals(codeString))
+          return PROPOSED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("requested".equals(codeString))
+          return REQUESTED;
+        if ("received".equals(codeString))
+          return RECEIVED;
+        if ("accepted".equals(codeString))
+          return ACCEPTED;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("rejected".equals(codeString))
+          return REJECTED;
+        if ("aborted".equals(codeString))
+          return ABORTED;
+        throw new FHIRException("Unknown ProcedureRequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSED: return "proposed";
+            case DRAFT: return "draft";
+            case REQUESTED: return "requested";
+            case RECEIVED: return "received";
+            case ACCEPTED: return "accepted";
+            case INPROGRESS: return "in-progress";
+            case COMPLETED: return "completed";
+            case SUSPENDED: return "suspended";
+            case REJECTED: return "rejected";
+            case ABORTED: return "aborted";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/procedure-request-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSED: return "The request has been proposed.";
+            case DRAFT: return "The request is in preliminary form, prior to being requested.";
+            case REQUESTED: return "The request has been placed.";
+            case RECEIVED: return "The receiving system has received the request but not yet decided whether it will be performed.";
+            case ACCEPTED: return "The receiving system has accepted the request, but work has not yet commenced.";
+            case INPROGRESS: return "The work to fulfill the request is happening.";
+            case COMPLETED: return "The work has been completed, the report(s) released, and no further work is planned.";
+            case SUSPENDED: return "The request has been held by originating system/user request.";
+            case REJECTED: return "The receiving system has declined to fulfill the request.";
+            case ABORTED: return "The request was attempted, but due to some procedural error, it could not be completed.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSED: return "Proposed";
+            case DRAFT: return "Draft";
+            case REQUESTED: return "Requested";
+            case RECEIVED: return "Received";
+            case ACCEPTED: return "Accepted";
+            case INPROGRESS: return "In Progress";
+            case COMPLETED: return "Completed";
+            case SUSPENDED: return "Suspended";
+            case REJECTED: return "Rejected";
+            case ABORTED: return "Aborted";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestStatusEnumFactory.java
new file mode 100644
index 00000000000..1e5afc21953
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureRequestStatusEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProcedureRequestStatusEnumFactory implements EnumFactory {
+
+  public ProcedureRequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposed".equals(codeString))
+      return ProcedureRequestStatus.PROPOSED;
+    if ("draft".equals(codeString))
+      return ProcedureRequestStatus.DRAFT;
+    if ("requested".equals(codeString))
+      return ProcedureRequestStatus.REQUESTED;
+    if ("received".equals(codeString))
+      return ProcedureRequestStatus.RECEIVED;
+    if ("accepted".equals(codeString))
+      return ProcedureRequestStatus.ACCEPTED;
+    if ("in-progress".equals(codeString))
+      return ProcedureRequestStatus.INPROGRESS;
+    if ("completed".equals(codeString))
+      return ProcedureRequestStatus.COMPLETED;
+    if ("suspended".equals(codeString))
+      return ProcedureRequestStatus.SUSPENDED;
+    if ("rejected".equals(codeString))
+      return ProcedureRequestStatus.REJECTED;
+    if ("aborted".equals(codeString))
+      return ProcedureRequestStatus.ABORTED;
+    throw new IllegalArgumentException("Unknown ProcedureRequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ProcedureRequestStatus code) {
+    if (code == ProcedureRequestStatus.PROPOSED)
+      return "proposed";
+    if (code == ProcedureRequestStatus.DRAFT)
+      return "draft";
+    if (code == ProcedureRequestStatus.REQUESTED)
+      return "requested";
+    if (code == ProcedureRequestStatus.RECEIVED)
+      return "received";
+    if (code == ProcedureRequestStatus.ACCEPTED)
+      return "accepted";
+    if (code == ProcedureRequestStatus.INPROGRESS)
+      return "in-progress";
+    if (code == ProcedureRequestStatus.COMPLETED)
+      return "completed";
+    if (code == ProcedureRequestStatus.SUSPENDED)
+      return "suspended";
+    if (code == ProcedureRequestStatus.REJECTED)
+      return "rejected";
+    if (code == ProcedureRequestStatus.ABORTED)
+      return "aborted";
+    return "?";
+  }
+
+    public String toSystem(ProcedureRequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureStatus.java
new file mode 100644
index 00000000000..d952ee6a258
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProcedureStatus {
+
+        /**
+         * The core procedure has not started yet, but some staging activities have begun (e.g. surgical suite preparation).  Preparation stages may be tracked for billing purposes.
+         */
+        PREPARATION, 
+        /**
+         * The procedure is currently occurring.
+         */
+        INPROGRESS, 
+        /**
+         * The procedure has been temporarily stopped but is expected to resume in the future
+         */
+        SUSPENDED, 
+        /**
+         * The procedure was terminated without completing successfully.
+         */
+        ABORTED, 
+        /**
+         * All actions involved in the procedure have taken place.
+         */
+        COMPLETED, 
+        /**
+         * This electronic record should never have existed.
+         */
+        ENTEREDINERROR, 
+        /**
+         * The authoring system does not know which of the status values currently applies for this procedure.  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
+         */
+        NULL;
+        public static ProcedureStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("preparation".equals(codeString))
+          return PREPARATION;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        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;
+        throw new FHIRException("Unknown ProcedureStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PREPARATION: return "preparation";
+            case INPROGRESS: return "in-progress";
+            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() {
+          return "http://hl7.org/fhir/procedure-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PREPARATION: return "The core procedure 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 procedure is currently occurring.";
+            case SUSPENDED: return "The procedure has been temporarily stopped but is expected to resume in the future";
+            case ABORTED: return "The procedure was terminated without completing successfully.";
+            case COMPLETED: return "All actions involved in the procedure have taken place.";
+            case ENTEREDINERROR: return "This electronic record should never have existed.";
+            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this procedure.  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 PREPARATION: return "Preparation";
+            case INPROGRESS: return "In Progress";
+            case SUSPENDED: return "Suspended";
+            case ABORTED: return "Aboted";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureStatusEnumFactory.java
new file mode 100644
index 00000000000..041035b7526
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcedureStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProcedureStatusEnumFactory implements EnumFactory {
+
+  public ProcedureStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("preparation".equals(codeString))
+      return ProcedureStatus.PREPARATION;
+    if ("in-progress".equals(codeString))
+      return ProcedureStatus.INPROGRESS;
+    if ("suspended".equals(codeString))
+      return ProcedureStatus.SUSPENDED;
+    if ("aborted".equals(codeString))
+      return ProcedureStatus.ABORTED;
+    if ("completed".equals(codeString))
+      return ProcedureStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return ProcedureStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return ProcedureStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown ProcedureStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ProcedureStatus code) {
+    if (code == ProcedureStatus.PREPARATION)
+      return "preparation";
+    if (code == ProcedureStatus.INPROGRESS)
+      return "in-progress";
+    if (code == ProcedureStatus.SUSPENDED)
+      return "suspended";
+    if (code == ProcedureStatus.ABORTED)
+      return "aborted";
+    if (code == ProcedureStatus.COMPLETED)
+      return "completed";
+    if (code == ProcedureStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == ProcedureStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(ProcedureStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessOutcome.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessOutcome.java
new file mode 100644
index 00000000000..01c58b70322
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessOutcome.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProcessOutcome {
+
+        /**
+         * The requested processing has completed.
+         */
+        COMPLETE, 
+        /**
+         * The requested processing has been suspended.
+         */
+        PENDED, 
+        /**
+         * The requested processing has terminated with some errors being found.
+         */
+        ERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProcessOutcome fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("complete".equals(codeString))
+          return COMPLETE;
+        if ("pended".equals(codeString))
+          return PENDED;
+        if ("error".equals(codeString))
+          return ERROR;
+        throw new FHIRException("Unknown ProcessOutcome code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COMPLETE: return "complete";
+            case PENDED: return "pended";
+            case ERROR: return "error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/processoutcomecodes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COMPLETE: return "The requested processing has completed.";
+            case PENDED: return "The requested processing has been suspended.";
+            case ERROR: return "The requested processing has terminated with some errors being found.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COMPLETE: return "Complete";
+            case PENDED: return "Pended";
+            case ERROR: return "Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessOutcomeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessOutcomeEnumFactory.java
new file mode 100644
index 00000000000..4f668e0fd75
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessOutcomeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProcessOutcomeEnumFactory implements EnumFactory {
+
+  public ProcessOutcome fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("complete".equals(codeString))
+      return ProcessOutcome.COMPLETE;
+    if ("pended".equals(codeString))
+      return ProcessOutcome.PENDED;
+    if ("error".equals(codeString))
+      return ProcessOutcome.ERROR;
+    throw new IllegalArgumentException("Unknown ProcessOutcome code '"+codeString+"'");
+  }
+
+  public String toCode(ProcessOutcome code) {
+    if (code == ProcessOutcome.COMPLETE)
+      return "complete";
+    if (code == ProcessOutcome.PENDED)
+      return "pended";
+    if (code == ProcessOutcome.ERROR)
+      return "error";
+    return "?";
+  }
+
+    public String toSystem(ProcessOutcome code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessPriority.java
new file mode 100644
index 00000000000..31286a7ea72
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessPriority.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProcessPriority {
+
+        /**
+         * Immediately in real time.
+         */
+        STAT, 
+        /**
+         * With best effort.
+         */
+        NORMAL, 
+        /**
+         * Later, when possible.
+         */
+        DEFERRED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProcessPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("stat".equals(codeString))
+          return STAT;
+        if ("normal".equals(codeString))
+          return NORMAL;
+        if ("deferred".equals(codeString))
+          return DEFERRED;
+        throw new FHIRException("Unknown ProcessPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case STAT: return "stat";
+            case NORMAL: return "normal";
+            case DEFERRED: return "deferred";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/processpriority";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case STAT: return "Immediately in real time.";
+            case NORMAL: return "With best effort.";
+            case DEFERRED: return "Later, when possible.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case STAT: return "Immediate";
+            case NORMAL: return "Normal";
+            case DEFERRED: return "Deferred";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessPriorityEnumFactory.java
new file mode 100644
index 00000000000..2fc412990fb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessPriorityEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProcessPriorityEnumFactory implements EnumFactory {
+
+  public ProcessPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("stat".equals(codeString))
+      return ProcessPriority.STAT;
+    if ("normal".equals(codeString))
+      return ProcessPriority.NORMAL;
+    if ("deferred".equals(codeString))
+      return ProcessPriority.DEFERRED;
+    throw new IllegalArgumentException("Unknown ProcessPriority code '"+codeString+"'");
+  }
+
+  public String toCode(ProcessPriority code) {
+    if (code == ProcessPriority.STAT)
+      return "stat";
+    if (code == ProcessPriority.NORMAL)
+      return "normal";
+    if (code == ProcessPriority.DEFERRED)
+      return "deferred";
+    return "?";
+  }
+
+    public String toSystem(ProcessPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessrequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessrequestStatus.java
new file mode 100644
index 00000000000..3f7878ddf5d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessrequestStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProcessrequestStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProcessrequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ProcessrequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/processrequest-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessrequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessrequestStatusEnumFactory.java
new file mode 100644
index 00000000000..41b852e1ddc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessrequestStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProcessrequestStatusEnumFactory implements EnumFactory {
+
+  public ProcessrequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return ProcessrequestStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return ProcessrequestStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return ProcessrequestStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return ProcessrequestStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ProcessrequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ProcessrequestStatus code) {
+    if (code == ProcessrequestStatus.ACTIVE)
+      return "active";
+    if (code == ProcessrequestStatus.CANCELLED)
+      return "cancelled";
+    if (code == ProcessrequestStatus.DRAFT)
+      return "draft";
+    if (code == ProcessrequestStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ProcessrequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessresponseStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessresponseStatus.java
new file mode 100644
index 00000000000..b0465ff6856
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessresponseStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProcessresponseStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProcessresponseStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ProcessresponseStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/processresponse-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessresponseStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessresponseStatusEnumFactory.java
new file mode 100644
index 00000000000..4ca9ac69d4d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProcessresponseStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProcessresponseStatusEnumFactory implements EnumFactory {
+
+  public ProcessresponseStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return ProcessresponseStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return ProcessresponseStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return ProcessresponseStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return ProcessresponseStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ProcessresponseStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ProcessresponseStatus code) {
+    if (code == ProcessresponseStatus.ACTIVE)
+      return "active";
+    if (code == ProcessresponseStatus.CANCELLED)
+      return "cancelled";
+    if (code == ProcessresponseStatus.DRAFT)
+      return "draft";
+    if (code == ProcessresponseStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ProcessresponseStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PropertyRepresentation.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PropertyRepresentation.java
new file mode 100644
index 00000000000..41e85c6176a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PropertyRepresentation.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PropertyRepresentation {
+
+        /**
+         * In XML, this property is represented as an attribute not an element.
+         */
+        XMLATTR, 
+        /**
+         * This element is represented using the XML text attribute (primitives only)
+         */
+        XMLTEXT, 
+        /**
+         * The type of this element is indicated using xsi:type
+         */
+        TYPEATTR, 
+        /**
+         * Use CDA narrative instead of XHTML
+         */
+        CDATEXT, 
+        /**
+         * The property is represented using XHTML
+         */
+        XHTML, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static PropertyRepresentation fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("xmlAttr".equals(codeString))
+          return XMLATTR;
+        if ("xmlText".equals(codeString))
+          return XMLTEXT;
+        if ("typeAttr".equals(codeString))
+          return TYPEATTR;
+        if ("cdaText".equals(codeString))
+          return CDATEXT;
+        if ("xhtml".equals(codeString))
+          return XHTML;
+        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case XMLATTR: return "xmlAttr";
+            case XMLTEXT: return "xmlText";
+            case TYPEATTR: return "typeAttr";
+            case CDATEXT: return "cdaText";
+            case XHTML: return "xhtml";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/property-representation";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case XMLATTR: return "In XML, this property is represented as an attribute not an element.";
+            case XMLTEXT: return "This element is represented using the XML text attribute (primitives only)";
+            case TYPEATTR: return "The type of this element is indicated using xsi:type";
+            case CDATEXT: return "Use CDA narrative instead of XHTML";
+            case XHTML: return "The property is represented using XHTML";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case XMLATTR: return "XML Attribute";
+            case XMLTEXT: return "XML Text";
+            case TYPEATTR: return "Type Attribute";
+            case CDATEXT: return "CDA Text Format";
+            case XHTML: return "XHTML";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PropertyRepresentationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PropertyRepresentationEnumFactory.java
new file mode 100644
index 00000000000..99f3f6b74ae
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PropertyRepresentationEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PropertyRepresentationEnumFactory implements EnumFactory {
+
+  public PropertyRepresentation fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("xmlAttr".equals(codeString))
+      return PropertyRepresentation.XMLATTR;
+    if ("xmlText".equals(codeString))
+      return PropertyRepresentation.XMLTEXT;
+    if ("typeAttr".equals(codeString))
+      return PropertyRepresentation.TYPEATTR;
+    if ("cdaText".equals(codeString))
+      return PropertyRepresentation.CDATEXT;
+    if ("xhtml".equals(codeString))
+      return PropertyRepresentation.XHTML;
+    throw new IllegalArgumentException("Unknown PropertyRepresentation code '"+codeString+"'");
+  }
+
+  public String toCode(PropertyRepresentation code) {
+    if (code == PropertyRepresentation.XMLATTR)
+      return "xmlAttr";
+    if (code == PropertyRepresentation.XMLTEXT)
+      return "xmlText";
+    if (code == PropertyRepresentation.TYPEATTR)
+      return "typeAttr";
+    if (code == PropertyRepresentation.CDATEXT)
+      return "cdaText";
+    if (code == PropertyRepresentation.XHTML)
+      return "xhtml";
+    return "?";
+  }
+
+    public String toSystem(PropertyRepresentation code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentRole.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentRole.java
new file mode 100644
index 00000000000..10d7c0a2199
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentRole.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProvenanceAgentRole {
+
+        /**
+         * A person entering the data into the originating system
+         */
+        ENTERER, 
+        /**
+         * A person, animal, organization or device that who actually and principally carries out the activity
+         */
+        PERFORMER, 
+        /**
+         * A party that originates the resource and therefore has responsibility for the information given in the resource and ownership of this resource
+         */
+        AUTHOR, 
+        /**
+         * A person who verifies the correctness and appropriateness of activity
+         */
+        VERIFIER, 
+        /**
+         * The person authenticated the content and accepted legal responsibility for its content
+         */
+        LEGAL, 
+        /**
+         * A verifier who attests to the accuracy of the resource
+         */
+        ATTESTER, 
+        /**
+         * A person who reported information that contributed to the resource
+         */
+        INFORMANT, 
+        /**
+         * The entity that is accountable for maintaining a true an accurate copy of the original record
+         */
+        CUSTODIAN, 
+        /**
+         * A device that operates independently of an author on custodian's algorithms for data extraction of existing information for purpose of generating a new artifact.
+         */
+        ASSEMBLER, 
+        /**
+         * A device used by an author to record new information, which may also be used by the author to select existing information for aggregation with newly recorded information for the purpose of generating a new artifact.
+         */
+        COMPOSER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProvenanceAgentRole fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("enterer".equals(codeString))
+          return ENTERER;
+        if ("performer".equals(codeString))
+          return PERFORMER;
+        if ("author".equals(codeString))
+          return AUTHOR;
+        if ("verifier".equals(codeString))
+          return VERIFIER;
+        if ("legal".equals(codeString))
+          return LEGAL;
+        if ("attester".equals(codeString))
+          return ATTESTER;
+        if ("informant".equals(codeString))
+          return INFORMANT;
+        if ("custodian".equals(codeString))
+          return CUSTODIAN;
+        if ("assembler".equals(codeString))
+          return ASSEMBLER;
+        if ("composer".equals(codeString))
+          return COMPOSER;
+        throw new FHIRException("Unknown ProvenanceAgentRole code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ENTERER: return "enterer";
+            case PERFORMER: return "performer";
+            case AUTHOR: return "author";
+            case VERIFIER: return "verifier";
+            case LEGAL: return "legal";
+            case ATTESTER: return "attester";
+            case INFORMANT: return "informant";
+            case CUSTODIAN: return "custodian";
+            case ASSEMBLER: return "assembler";
+            case COMPOSER: return "composer";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/provenance-participant-role";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ENTERER: return "A person entering the data into the originating system";
+            case PERFORMER: return "A person, animal, organization or device that who actually and principally carries out the activity";
+            case AUTHOR: return "A party that originates the resource and therefore has responsibility for the information given in the resource and ownership of this resource";
+            case VERIFIER: return "A person who verifies the correctness and appropriateness of activity";
+            case LEGAL: return "The person authenticated the content and accepted legal responsibility for its content";
+            case ATTESTER: return "A verifier who attests to the accuracy of the resource";
+            case INFORMANT: return "A person who reported information that contributed to the resource";
+            case CUSTODIAN: return "The entity that is accountable for maintaining a true an accurate copy of the original record";
+            case ASSEMBLER: return "A device that operates independently of an author on custodian's algorithms for data extraction of existing information for purpose of generating a new artifact.";
+            case COMPOSER: return "A device used by an author to record new information, which may also be used by the author to select existing information for aggregation with newly recorded information for the purpose of generating a new artifact.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ENTERER: return "Enterer";
+            case PERFORMER: return "Performer";
+            case AUTHOR: return "Author";
+            case VERIFIER: return "Verifier";
+            case LEGAL: return "Legal Authenticator";
+            case ATTESTER: return "Attester";
+            case INFORMANT: return "Informant";
+            case CUSTODIAN: return "Custodian";
+            case ASSEMBLER: return "Assembler";
+            case COMPOSER: return "Composer";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentRoleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentRoleEnumFactory.java
new file mode 100644
index 00000000000..b55367c4f7e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentRoleEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProvenanceAgentRoleEnumFactory implements EnumFactory {
+
+  public ProvenanceAgentRole fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("enterer".equals(codeString))
+      return ProvenanceAgentRole.ENTERER;
+    if ("performer".equals(codeString))
+      return ProvenanceAgentRole.PERFORMER;
+    if ("author".equals(codeString))
+      return ProvenanceAgentRole.AUTHOR;
+    if ("verifier".equals(codeString))
+      return ProvenanceAgentRole.VERIFIER;
+    if ("legal".equals(codeString))
+      return ProvenanceAgentRole.LEGAL;
+    if ("attester".equals(codeString))
+      return ProvenanceAgentRole.ATTESTER;
+    if ("informant".equals(codeString))
+      return ProvenanceAgentRole.INFORMANT;
+    if ("custodian".equals(codeString))
+      return ProvenanceAgentRole.CUSTODIAN;
+    if ("assembler".equals(codeString))
+      return ProvenanceAgentRole.ASSEMBLER;
+    if ("composer".equals(codeString))
+      return ProvenanceAgentRole.COMPOSER;
+    throw new IllegalArgumentException("Unknown ProvenanceAgentRole code '"+codeString+"'");
+  }
+
+  public String toCode(ProvenanceAgentRole code) {
+    if (code == ProvenanceAgentRole.ENTERER)
+      return "enterer";
+    if (code == ProvenanceAgentRole.PERFORMER)
+      return "performer";
+    if (code == ProvenanceAgentRole.AUTHOR)
+      return "author";
+    if (code == ProvenanceAgentRole.VERIFIER)
+      return "verifier";
+    if (code == ProvenanceAgentRole.LEGAL)
+      return "legal";
+    if (code == ProvenanceAgentRole.ATTESTER)
+      return "attester";
+    if (code == ProvenanceAgentRole.INFORMANT)
+      return "informant";
+    if (code == ProvenanceAgentRole.CUSTODIAN)
+      return "custodian";
+    if (code == ProvenanceAgentRole.ASSEMBLER)
+      return "assembler";
+    if (code == ProvenanceAgentRole.COMPOSER)
+      return "composer";
+    return "?";
+  }
+
+    public String toSystem(ProvenanceAgentRole code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentType.java
new file mode 100644
index 00000000000..87aa444b4d5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentType.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProvenanceAgentType {
+
+        /**
+         * The participant is a person acting on their on behalf or on behalf of the patient rather than as an practitioner for an organization.  I.e. "not a healthcare provider".
+         */
+        PERSON, 
+        /**
+         * The participant is a practitioner, a person (provider) who is directly or indirectly involved in the provisioning of healthcare.
+         */
+        PRACTITIONER, 
+        /**
+         * The participant is an organization.
+         */
+        ORGANIZATION, 
+        /**
+         * The participant is a software application including services, algorithms, etc.
+         */
+        SOFTWARE, 
+        /**
+         * The participant is the patient, a person or animal receiving care or other health-related services.
+         */
+        PATIENT, 
+        /**
+         * The participant is a device, an instance of a manufactured thing that is used in the provision of healthcare without being substantially changed through that activity. The device may be a machine, an insert, a computer, an application, etc. This includes durable (reusable) medical equipment as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.
+         */
+        DEVICE, 
+        /**
+         * The participant is a related person, a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.
+         */
+        RELATEDPERSON, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProvenanceAgentType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("person".equals(codeString))
+          return PERSON;
+        if ("practitioner".equals(codeString))
+          return PRACTITIONER;
+        if ("organization".equals(codeString))
+          return ORGANIZATION;
+        if ("software".equals(codeString))
+          return SOFTWARE;
+        if ("patient".equals(codeString))
+          return PATIENT;
+        if ("device".equals(codeString))
+          return DEVICE;
+        if ("related-person".equals(codeString))
+          return RELATEDPERSON;
+        throw new FHIRException("Unknown ProvenanceAgentType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PERSON: return "person";
+            case PRACTITIONER: return "practitioner";
+            case ORGANIZATION: return "organization";
+            case SOFTWARE: return "software";
+            case PATIENT: return "patient";
+            case DEVICE: return "device";
+            case RELATEDPERSON: return "related-person";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/provenance-participant-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PERSON: return "The participant is a person acting on their on behalf or on behalf of the patient rather than as an practitioner for an organization.  I.e. \"not a healthcare provider\".";
+            case PRACTITIONER: return "The participant is a practitioner, a person (provider) who is directly or indirectly involved in the provisioning of healthcare.";
+            case ORGANIZATION: return "The participant is an organization.";
+            case SOFTWARE: return "The participant is a software application including services, algorithms, etc.";
+            case PATIENT: return "The participant is the patient, a person or animal receiving care or other health-related services.";
+            case DEVICE: return "The participant is a device, an instance of a manufactured thing that is used in the provision of healthcare without being substantially changed through that activity. The device may be a machine, an insert, a computer, an application, etc. This includes durable (reusable) medical equipment as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.";
+            case RELATEDPERSON: return "The participant is a related person, a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PERSON: return "Person";
+            case PRACTITIONER: return "Practitioner";
+            case ORGANIZATION: return "Organization";
+            case SOFTWARE: return "Software";
+            case PATIENT: return "Patient";
+            case DEVICE: return "Device";
+            case RELATEDPERSON: return "Related Person";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentTypeEnumFactory.java
new file mode 100644
index 00000000000..3eabc86651b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceAgentTypeEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProvenanceAgentTypeEnumFactory implements EnumFactory {
+
+  public ProvenanceAgentType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("person".equals(codeString))
+      return ProvenanceAgentType.PERSON;
+    if ("practitioner".equals(codeString))
+      return ProvenanceAgentType.PRACTITIONER;
+    if ("organization".equals(codeString))
+      return ProvenanceAgentType.ORGANIZATION;
+    if ("software".equals(codeString))
+      return ProvenanceAgentType.SOFTWARE;
+    if ("patient".equals(codeString))
+      return ProvenanceAgentType.PATIENT;
+    if ("device".equals(codeString))
+      return ProvenanceAgentType.DEVICE;
+    if ("related-person".equals(codeString))
+      return ProvenanceAgentType.RELATEDPERSON;
+    throw new IllegalArgumentException("Unknown ProvenanceAgentType code '"+codeString+"'");
+  }
+
+  public String toCode(ProvenanceAgentType code) {
+    if (code == ProvenanceAgentType.PERSON)
+      return "person";
+    if (code == ProvenanceAgentType.PRACTITIONER)
+      return "practitioner";
+    if (code == ProvenanceAgentType.ORGANIZATION)
+      return "organization";
+    if (code == ProvenanceAgentType.SOFTWARE)
+      return "software";
+    if (code == ProvenanceAgentType.PATIENT)
+      return "patient";
+    if (code == ProvenanceAgentType.DEVICE)
+      return "device";
+    if (code == ProvenanceAgentType.RELATEDPERSON)
+      return "related-person";
+    return "?";
+  }
+
+    public String toSystem(ProvenanceAgentType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceEntityRole.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceEntityRole.java
new file mode 100644
index 00000000000..b11bc91316d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceEntityRole.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProvenanceEntityRole {
+
+        /**
+         * A transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a preexisting entity.
+         */
+        DERIVATION, 
+        /**
+         * A derivation for which the resulting entity is a revised version of some original.
+         */
+        REVISION, 
+        /**
+         * The repeat of (some or all of) an entity, such as text or image, by someone who may or may not be its original author.
+         */
+        QUOTATION, 
+        /**
+         * A primary source for a topic refers to something produced by some agent with direct experience and knowledge about the topic, at the time of the topic's study, without benefit from hindsight.
+         */
+        SOURCE, 
+        /**
+         * A derivation for which the entity is removed from accessibility usually through the use of the Delete operation.
+         */
+        REMOVAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProvenanceEntityRole fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("derivation".equals(codeString))
+          return DERIVATION;
+        if ("revision".equals(codeString))
+          return REVISION;
+        if ("quotation".equals(codeString))
+          return QUOTATION;
+        if ("source".equals(codeString))
+          return SOURCE;
+        if ("removal".equals(codeString))
+          return REMOVAL;
+        throw new FHIRException("Unknown ProvenanceEntityRole code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DERIVATION: return "derivation";
+            case REVISION: return "revision";
+            case QUOTATION: return "quotation";
+            case SOURCE: return "source";
+            case REMOVAL: return "removal";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/provenance-entity-role";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DERIVATION: return "A transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a preexisting entity.";
+            case REVISION: return "A derivation for which the resulting entity is a revised version of some original.";
+            case QUOTATION: return "The repeat of (some or all of) an entity, such as text or image, by someone who may or may not be its original author.";
+            case SOURCE: return "A primary source for a topic refers to something produced by some agent with direct experience and knowledge about the topic, at the time of the topic's study, without benefit from hindsight.";
+            case REMOVAL: return "A derivation for which the entity is removed from accessibility usually through the use of the Delete operation.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DERIVATION: return "Derivation";
+            case REVISION: return "Revision";
+            case QUOTATION: return "Quotation";
+            case SOURCE: return "Source";
+            case REMOVAL: return "Removal";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceEntityRoleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceEntityRoleEnumFactory.java
new file mode 100644
index 00000000000..1fe5620d105
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProvenanceEntityRoleEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProvenanceEntityRoleEnumFactory implements EnumFactory {
+
+  public ProvenanceEntityRole fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("derivation".equals(codeString))
+      return ProvenanceEntityRole.DERIVATION;
+    if ("revision".equals(codeString))
+      return ProvenanceEntityRole.REVISION;
+    if ("quotation".equals(codeString))
+      return ProvenanceEntityRole.QUOTATION;
+    if ("source".equals(codeString))
+      return ProvenanceEntityRole.SOURCE;
+    if ("removal".equals(codeString))
+      return ProvenanceEntityRole.REMOVAL;
+    throw new IllegalArgumentException("Unknown ProvenanceEntityRole code '"+codeString+"'");
+  }
+
+  public String toCode(ProvenanceEntityRole code) {
+    if (code == ProvenanceEntityRole.DERIVATION)
+      return "derivation";
+    if (code == ProvenanceEntityRole.REVISION)
+      return "revision";
+    if (code == ProvenanceEntityRole.QUOTATION)
+      return "quotation";
+    if (code == ProvenanceEntityRole.SOURCE)
+      return "source";
+    if (code == ProvenanceEntityRole.REMOVAL)
+      return "removal";
+    return "?";
+  }
+
+    public String toSystem(ProvenanceEntityRole code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProviderQualification.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProviderQualification.java
new file mode 100644
index 00000000000..dfbcdd2e73c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProviderQualification.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ProviderQualification {
+
+        /**
+         * Dentist General Practitioner (DDS, DDM).
+         */
+        _311405, 
+        /**
+         * Ophthalmologist.
+         */
+        _604215, 
+        /**
+         * Optometrist.
+         */
+        _604210, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ProviderQualification fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("311405".equals(codeString))
+          return _311405;
+        if ("604215".equals(codeString))
+          return _604215;
+        if ("604210".equals(codeString))
+          return _604210;
+        throw new FHIRException("Unknown ProviderQualification code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _311405: return "311405";
+            case _604215: return "604215";
+            case _604210: return "604210";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-providerqualification";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _311405: return "Dentist General Practitioner (DDS, DDM).";
+            case _604215: return "Ophthalmologist.";
+            case _604210: return "Optometrist.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _311405: return "Dentist";
+            case _604215: return "Ophthalmologist";
+            case _604210: return "Optometrist";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProviderQualificationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProviderQualificationEnumFactory.java
new file mode 100644
index 00000000000..e2bca396663
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ProviderQualificationEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ProviderQualificationEnumFactory implements EnumFactory {
+
+  public ProviderQualification fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("311405".equals(codeString))
+      return ProviderQualification._311405;
+    if ("604215".equals(codeString))
+      return ProviderQualification._604215;
+    if ("604210".equals(codeString))
+      return ProviderQualification._604210;
+    throw new IllegalArgumentException("Unknown ProviderQualification code '"+codeString+"'");
+  }
+
+  public String toCode(ProviderQualification code) {
+    if (code == ProviderQualification._311405)
+      return "311405";
+    if (code == ProviderQualification._604215)
+      return "604215";
+    if (code == ProviderQualification._604210)
+      return "604210";
+    return "?";
+  }
+
+    public String toSystem(ProviderQualification code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PublicationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PublicationStatus.java
new file mode 100644
index 00000000000..3b8ed51d886
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PublicationStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum PublicationStatus {
+
+        /**
+         * This resource is still under development and is not yet considered to be ready for normal use.
+         */
+        DRAFT, 
+        /**
+         * This resource is ready for normal use.
+         */
+        ACTIVE, 
+        /**
+         * This resource has been withdrawn or superseded and should no longer be used.
+         */
+        RETIRED, 
+        /**
+         * The authoring system does not know which of the status values currently applies for this resource.  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
+         */
+        NULL;
+        public static PublicationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("retired".equals(codeString))
+          return RETIRED;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown PublicationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case ACTIVE: return "active";
+            case RETIRED: return "retired";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/publication-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "This resource is still under development and is not yet considered to be ready for normal use.";
+            case ACTIVE: return "This resource is ready for normal use.";
+            case RETIRED: return "This resource has been withdrawn or superseded and should no longer be used.";
+            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this resource.  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 "Draft";
+            case ACTIVE: return "Active";
+            case RETIRED: return "Retired";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PublicationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PublicationStatusEnumFactory.java
new file mode 100644
index 00000000000..2165ce58a13
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/PublicationStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class PublicationStatusEnumFactory implements EnumFactory {
+
+  public PublicationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return PublicationStatus.DRAFT;
+    if ("active".equals(codeString))
+      return PublicationStatus.ACTIVE;
+    if ("retired".equals(codeString))
+      return PublicationStatus.RETIRED;
+    if ("unknown".equals(codeString))
+      return PublicationStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown PublicationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(PublicationStatus code) {
+    if (code == PublicationStatus.DRAFT)
+      return "draft";
+    if (code == PublicationStatus.ACTIVE)
+      return "active";
+    if (code == PublicationStatus.RETIRED)
+      return "retired";
+    if (code == PublicationStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(PublicationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QualityType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QualityType.java
new file mode 100644
index 00000000000..902e77bf5e9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QualityType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum QualityType {
+
+        /**
+         * INDEL Comparison
+         */
+        INDEL, 
+        /**
+         * SNP Comparison
+         */
+        SNP, 
+        /**
+         * UNKNOWN Comparison
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static QualityType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("indel".equals(codeString))
+          return INDEL;
+        if ("snp".equals(codeString))
+          return SNP;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown QualityType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INDEL: return "indel";
+            case SNP: return "snp";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/quality-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INDEL: return "INDEL Comparison";
+            case SNP: return "SNP Comparison";
+            case UNKNOWN: return "UNKNOWN Comparison";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INDEL: return "INDEL Comparison";
+            case SNP: return "SNP Comparison";
+            case UNKNOWN: return "UNKNOWN Comparison";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QualityTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QualityTypeEnumFactory.java
new file mode 100644
index 00000000000..2f6c2878e27
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QualityTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class QualityTypeEnumFactory implements EnumFactory {
+
+  public QualityType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("indel".equals(codeString))
+      return QualityType.INDEL;
+    if ("snp".equals(codeString))
+      return QualityType.SNP;
+    if ("unknown".equals(codeString))
+      return QualityType.UNKNOWN;
+    throw new IllegalArgumentException("Unknown QualityType code '"+codeString+"'");
+  }
+
+  public String toCode(QualityType code) {
+    if (code == QualityType.INDEL)
+      return "indel";
+    if (code == QualityType.SNP)
+      return "snp";
+    if (code == QualityType.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(QualityType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuantityComparator.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuantityComparator.java
new file mode 100644
index 00000000000..9b4a6bdee7e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuantityComparator.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum QuantityComparator {
+
+        /**
+         * The actual value is less than the given value.
+         */
+        LESS_THAN, 
+        /**
+         * The actual value is less than or equal to the given value.
+         */
+        LESS_OR_EQUAL, 
+        /**
+         * The actual value is greater than or equal to the given value.
+         */
+        GREATER_OR_EQUAL, 
+        /**
+         * The actual value is greater than the given value.
+         */
+        GREATER_THAN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static QuantityComparator fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("<".equals(codeString))
+          return LESS_THAN;
+        if ("<=".equals(codeString))
+          return LESS_OR_EQUAL;
+        if (">=".equals(codeString))
+          return GREATER_OR_EQUAL;
+        if (">".equals(codeString))
+          return GREATER_THAN;
+        throw new FHIRException("Unknown QuantityComparator code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LESS_THAN: return "<";
+            case LESS_OR_EQUAL: return "<=";
+            case GREATER_OR_EQUAL: return ">=";
+            case GREATER_THAN: return ">";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/quantity-comparator";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LESS_THAN: return "The actual value is less than the given value.";
+            case LESS_OR_EQUAL: return "The actual value is less than or equal to the given value.";
+            case GREATER_OR_EQUAL: return "The actual value is greater than or equal to the given value.";
+            case GREATER_THAN: return "The actual value is greater than the given value.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LESS_THAN: return "Less than";
+            case LESS_OR_EQUAL: return "Less or Equal to";
+            case GREATER_OR_EQUAL: return "Greater or Equal to";
+            case GREATER_THAN: return "Greater than";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuantityComparatorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuantityComparatorEnumFactory.java
new file mode 100644
index 00000000000..1cca71a7ee0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuantityComparatorEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class QuantityComparatorEnumFactory implements EnumFactory {
+
+  public QuantityComparator fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("<".equals(codeString))
+      return QuantityComparator.LESS_THAN;
+    if ("<=".equals(codeString))
+      return QuantityComparator.LESS_OR_EQUAL;
+    if (">=".equals(codeString))
+      return QuantityComparator.GREATER_OR_EQUAL;
+    if (">".equals(codeString))
+      return QuantityComparator.GREATER_THAN;
+    throw new IllegalArgumentException("Unknown QuantityComparator code '"+codeString+"'");
+  }
+
+  public String toCode(QuantityComparator code) {
+    if (code == QuantityComparator.LESS_THAN)
+      return "<";
+    if (code == QuantityComparator.LESS_OR_EQUAL)
+      return "<=";
+    if (code == QuantityComparator.GREATER_OR_EQUAL)
+      return ">=";
+    if (code == QuantityComparator.GREATER_THAN)
+      return ">";
+    return "?";
+  }
+
+    public String toSystem(QuantityComparator code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionMaxOccurs.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionMaxOccurs.java
new file mode 100644
index 00000000000..119a3e7ab56
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionMaxOccurs.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum QuestionMaxOccurs {
+
+        /**
+         * Element can repeat an unlimited number of times
+         */
+        ASTERISK, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static QuestionMaxOccurs fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("*".equals(codeString))
+          return ASTERISK;
+        throw new FHIRException("Unknown QuestionMaxOccurs code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ASTERISK: return "*";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/question-max-occurs";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ASTERISK: return "Element can repeat an unlimited number of times";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ASTERISK: return "Repeating";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionMaxOccursEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionMaxOccursEnumFactory.java
new file mode 100644
index 00000000000..9505ff32b52
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionMaxOccursEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class QuestionMaxOccursEnumFactory implements EnumFactory {
+
+  public QuestionMaxOccurs fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("*".equals(codeString))
+      return QuestionMaxOccurs.ASTERISK;
+    throw new IllegalArgumentException("Unknown QuestionMaxOccurs code '"+codeString+"'");
+  }
+
+  public String toCode(QuestionMaxOccurs code) {
+    if (code == QuestionMaxOccurs.ASTERISK)
+      return "*";
+    return "?";
+  }
+
+    public String toSystem(QuestionMaxOccurs code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireAnswersStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireAnswersStatus.java
new file mode 100644
index 00000000000..c47d0b1d035
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireAnswersStatus.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum QuestionnaireAnswersStatus {
+
+        /**
+         * This QuestionnaireResponse has been partially filled out with answers, but changes or additions are still expected to be made to it.
+         */
+        INPROGRESS, 
+        /**
+         * This QuestionnaireResponse has been filled out with answers, and the current content is regarded as definitive.
+         */
+        COMPLETED, 
+        /**
+         * This QuestionnaireResponse has been filled out with answers, then marked as complete, yet changes or additions have been made to it afterwards.
+         */
+        AMENDED, 
+        /**
+         * This QuestionnaireResponse was entered in error and voided.
+         */
+        ENTEREDINERROR, 
+        /**
+         * This QuestionnaireResponse has been partially filled out with answers, but has been abandoned. It is unknown whether changes or additions are expected to be made to it.
+         */
+        STOPPED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static QuestionnaireAnswersStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("amended".equals(codeString))
+          return AMENDED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("stopped".equals(codeString))
+          return STOPPED;
+        throw new FHIRException("Unknown QuestionnaireAnswersStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INPROGRESS: return "in-progress";
+            case COMPLETED: return "completed";
+            case AMENDED: return "amended";
+            case ENTEREDINERROR: return "entered-in-error";
+            case STOPPED: return "stopped";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/questionnaire-answers-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INPROGRESS: return "This QuestionnaireResponse has been partially filled out with answers, but changes or additions are still expected to be made to it.";
+            case COMPLETED: return "This QuestionnaireResponse has been filled out with answers, and the current content is regarded as definitive.";
+            case AMENDED: return "This QuestionnaireResponse has been filled out with answers, then marked as complete, yet changes or additions have been made to it afterwards.";
+            case ENTEREDINERROR: return "This QuestionnaireResponse was entered in error and voided.";
+            case STOPPED: return "This QuestionnaireResponse has been partially filled out with answers, but has been abandoned. It is unknown whether changes or additions are expected to be made to it.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INPROGRESS: return "In Progress";
+            case COMPLETED: return "Completed";
+            case AMENDED: return "Amended";
+            case ENTEREDINERROR: return "Entered in Error";
+            case STOPPED: return "Stopped";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireAnswersStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireAnswersStatusEnumFactory.java
new file mode 100644
index 00000000000..016c0dfca10
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireAnswersStatusEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class QuestionnaireAnswersStatusEnumFactory implements EnumFactory {
+
+  public QuestionnaireAnswersStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("in-progress".equals(codeString))
+      return QuestionnaireAnswersStatus.INPROGRESS;
+    if ("completed".equals(codeString))
+      return QuestionnaireAnswersStatus.COMPLETED;
+    if ("amended".equals(codeString))
+      return QuestionnaireAnswersStatus.AMENDED;
+    if ("entered-in-error".equals(codeString))
+      return QuestionnaireAnswersStatus.ENTEREDINERROR;
+    if ("stopped".equals(codeString))
+      return QuestionnaireAnswersStatus.STOPPED;
+    throw new IllegalArgumentException("Unknown QuestionnaireAnswersStatus code '"+codeString+"'");
+  }
+
+  public String toCode(QuestionnaireAnswersStatus code) {
+    if (code == QuestionnaireAnswersStatus.INPROGRESS)
+      return "in-progress";
+    if (code == QuestionnaireAnswersStatus.COMPLETED)
+      return "completed";
+    if (code == QuestionnaireAnswersStatus.AMENDED)
+      return "amended";
+    if (code == QuestionnaireAnswersStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == QuestionnaireAnswersStatus.STOPPED)
+      return "stopped";
+    return "?";
+  }
+
+    public String toSystem(QuestionnaireAnswersStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireDisplayCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireDisplayCategory.java
new file mode 100644
index 00000000000..557e78f348c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireDisplayCategory.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum QuestionnaireDisplayCategory {
+
+        /**
+         * The text provides guidances on how to populate or use a portion of the questionnaire (or the questionnaire as a whole).
+         */
+        INSTRUCTIONS, 
+        /**
+         * The text provides guidance on how the information should be or will be handled from a security/confidentiality/access control perspective when completed
+         */
+        SECURITY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static QuestionnaireDisplayCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("instructions".equals(codeString))
+          return INSTRUCTIONS;
+        if ("security".equals(codeString))
+          return SECURITY;
+        throw new FHIRException("Unknown QuestionnaireDisplayCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INSTRUCTIONS: return "instructions";
+            case SECURITY: return "security";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/questionnaire-display-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INSTRUCTIONS: return "The text provides guidances on how to populate or use a portion of the questionnaire (or the questionnaire as a whole).";
+            case SECURITY: return "The text provides guidance on how the information should be or will be handled from a security/confidentiality/access control perspective when completed";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INSTRUCTIONS: return "Instructions";
+            case SECURITY: return "Security";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireDisplayCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireDisplayCategoryEnumFactory.java
new file mode 100644
index 00000000000..b347f64c004
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireDisplayCategoryEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class QuestionnaireDisplayCategoryEnumFactory implements EnumFactory {
+
+  public QuestionnaireDisplayCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("instructions".equals(codeString))
+      return QuestionnaireDisplayCategory.INSTRUCTIONS;
+    if ("security".equals(codeString))
+      return QuestionnaireDisplayCategory.SECURITY;
+    throw new IllegalArgumentException("Unknown QuestionnaireDisplayCategory code '"+codeString+"'");
+  }
+
+  public String toCode(QuestionnaireDisplayCategory code) {
+    if (code == QuestionnaireDisplayCategory.INSTRUCTIONS)
+      return "instructions";
+    if (code == QuestionnaireDisplayCategory.SECURITY)
+      return "security";
+    return "?";
+  }
+
+    public String toSystem(QuestionnaireDisplayCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireItemControl.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireItemControl.java
new file mode 100644
index 00000000000..e7edf29fbf2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireItemControl.java
@@ -0,0 +1,267 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum QuestionnaireItemControl {
+
+        /**
+         * UI controls relevant to organizing groups of questions
+         */
+        GROUP, 
+        /**
+         * Questions within the group should be listed sequentially
+         */
+        LIST, 
+        /**
+         * Questions within the group are rows in the table with possible answers as columns
+         */
+        TABLE, 
+        /**
+         * The group is to be continuously visible at the top of the questionnaire
+         */
+        HEADER, 
+        /**
+         * The group is to be continuously visible at the bottom of the questionnaire
+         */
+        FOOTER, 
+        /**
+         * UI controls relevant to rendering questionnaire text items
+         */
+        TEXT, 
+        /**
+         * Text is displayed as a paragraph in a sequential position between sibling items (default behavior)
+         */
+        INLINE, 
+        /**
+         * Text is displayed immediately below or within the answer-entry area of the containing question item (typically as a guide for what to enter)
+         */
+        PROMPT, 
+        /**
+         * Text is displayed adjacent (horizontally or vertically) to the answer space for the parent question, typically to indicate a unit of measure
+         */
+        UNIT, 
+        /**
+         * Text is displayed to the left of the set of answer choices or a scaling control for the parent question item to indicate the meaning of the 'lower' bound.  E.g. 'Strongly disagree'
+         */
+        LOWER, 
+        /**
+         * Text is displayed to the right of the set of answer choices or a scaling control for the parent question item to indicate the meaning of the 'upper' bound.  E.g. 'Strongly agree'
+         */
+        UPPER, 
+        /**
+         * Text is temporarily visible over top of an item if the mouse is positioned over top of the text for the containing item
+         */
+        FLYOVER, 
+        /**
+         * Text is displayed in a dialog box or similar control if invoked by pushing a button or some other UI-appropriate action to request 'help' for a question, group or the questionnaire as a whole (depending what the text is nested within)
+         */
+        HELP, 
+        /**
+         * UI controls relevant to capturing question data
+         */
+        QUESTION, 
+        /**
+         * A control which provides a list of potential matches based on text entered into a control.  Used for large choice sets where text-matching is an appropriate discovery mechanism.
+         */
+        AUTOCOMPLETE, 
+        /**
+         * A control where an item (or multiple items) can be selected from a list that is only displayed when the user is editing the field.
+         */
+        DROPDOWN, 
+        /**
+         * A control where choices are listed with a box beside them.  The box can be toggled to select or de-select a given choice.  Multiple selections may be possible.
+         */
+        CHECKBOX, 
+        /**
+         * A control where editing an item spawns a separate dialog box or screen permitting a user to navigate, filter or otherwise discover an appropriate match.  Useful for large choice sets where text matching is not an appropriate discovery mechanism.  Such screens must generally be tuned for the specific choice list structure.
+         */
+        LOOKUP, 
+        /**
+         * A control where choices are listed with a button beside them.  The button can be toggled to select or de-select a given choice.  Selecting one item deselects all others.
+         */
+        RADIOBUTTON, 
+        /**
+         * A control where an axis is displayed between the high and low values and the control can be visually manipulated to select a value anywhere on the axis.
+         */
+        SLIDER, 
+        /**
+         * A control where a list of numeric or other ordered values can be scrolled through via arrows.
+         */
+        SPINNER, 
+        /**
+         * A control where a user can type in their answer freely.
+         */
+        TEXTBOX, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static QuestionnaireItemControl fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("group".equals(codeString))
+          return GROUP;
+        if ("list".equals(codeString))
+          return LIST;
+        if ("table".equals(codeString))
+          return TABLE;
+        if ("header".equals(codeString))
+          return HEADER;
+        if ("footer".equals(codeString))
+          return FOOTER;
+        if ("text".equals(codeString))
+          return TEXT;
+        if ("inline".equals(codeString))
+          return INLINE;
+        if ("prompt".equals(codeString))
+          return PROMPT;
+        if ("unit".equals(codeString))
+          return UNIT;
+        if ("lower".equals(codeString))
+          return LOWER;
+        if ("upper".equals(codeString))
+          return UPPER;
+        if ("flyover".equals(codeString))
+          return FLYOVER;
+        if ("help".equals(codeString))
+          return HELP;
+        if ("question".equals(codeString))
+          return QUESTION;
+        if ("autocomplete".equals(codeString))
+          return AUTOCOMPLETE;
+        if ("drop-down".equals(codeString))
+          return DROPDOWN;
+        if ("check-box".equals(codeString))
+          return CHECKBOX;
+        if ("lookup".equals(codeString))
+          return LOOKUP;
+        if ("radio-button".equals(codeString))
+          return RADIOBUTTON;
+        if ("slider".equals(codeString))
+          return SLIDER;
+        if ("spinner".equals(codeString))
+          return SPINNER;
+        if ("text-box".equals(codeString))
+          return TEXTBOX;
+        throw new FHIRException("Unknown QuestionnaireItemControl code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GROUP: return "group";
+            case LIST: return "list";
+            case TABLE: return "table";
+            case HEADER: return "header";
+            case FOOTER: return "footer";
+            case TEXT: return "text";
+            case INLINE: return "inline";
+            case PROMPT: return "prompt";
+            case UNIT: return "unit";
+            case LOWER: return "lower";
+            case UPPER: return "upper";
+            case FLYOVER: return "flyover";
+            case HELP: return "help";
+            case QUESTION: return "question";
+            case AUTOCOMPLETE: return "autocomplete";
+            case DROPDOWN: return "drop-down";
+            case CHECKBOX: return "check-box";
+            case LOOKUP: return "lookup";
+            case RADIOBUTTON: return "radio-button";
+            case SLIDER: return "slider";
+            case SPINNER: return "spinner";
+            case TEXTBOX: return "text-box";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/questionnaire-item-control";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GROUP: return "UI controls relevant to organizing groups of questions";
+            case LIST: return "Questions within the group should be listed sequentially";
+            case TABLE: return "Questions within the group are rows in the table with possible answers as columns";
+            case HEADER: return "The group is to be continuously visible at the top of the questionnaire";
+            case FOOTER: return "The group is to be continuously visible at the bottom of the questionnaire";
+            case TEXT: return "UI controls relevant to rendering questionnaire text items";
+            case INLINE: return "Text is displayed as a paragraph in a sequential position between sibling items (default behavior)";
+            case PROMPT: return "Text is displayed immediately below or within the answer-entry area of the containing question item (typically as a guide for what to enter)";
+            case UNIT: return "Text is displayed adjacent (horizontally or vertically) to the answer space for the parent question, typically to indicate a unit of measure";
+            case LOWER: return "Text is displayed to the left of the set of answer choices or a scaling control for the parent question item to indicate the meaning of the 'lower' bound.  E.g. 'Strongly disagree'";
+            case UPPER: return "Text is displayed to the right of the set of answer choices or a scaling control for the parent question item to indicate the meaning of the 'upper' bound.  E.g. 'Strongly agree'";
+            case FLYOVER: return "Text is temporarily visible over top of an item if the mouse is positioned over top of the text for the containing item";
+            case HELP: return "Text is displayed in a dialog box or similar control if invoked by pushing a button or some other UI-appropriate action to request 'help' for a question, group or the questionnaire as a whole (depending what the text is nested within)";
+            case QUESTION: return "UI controls relevant to capturing question data";
+            case AUTOCOMPLETE: return "A control which provides a list of potential matches based on text entered into a control.  Used for large choice sets where text-matching is an appropriate discovery mechanism.";
+            case DROPDOWN: return "A control where an item (or multiple items) can be selected from a list that is only displayed when the user is editing the field.";
+            case CHECKBOX: return "A control where choices are listed with a box beside them.  The box can be toggled to select or de-select a given choice.  Multiple selections may be possible.";
+            case LOOKUP: return "A control where editing an item spawns a separate dialog box or screen permitting a user to navigate, filter or otherwise discover an appropriate match.  Useful for large choice sets where text matching is not an appropriate discovery mechanism.  Such screens must generally be tuned for the specific choice list structure.";
+            case RADIOBUTTON: return "A control where choices are listed with a button beside them.  The button can be toggled to select or de-select a given choice.  Selecting one item deselects all others.";
+            case SLIDER: return "A control where an axis is displayed between the high and low values and the control can be visually manipulated to select a value anywhere on the axis.";
+            case SPINNER: return "A control where a list of numeric or other ordered values can be scrolled through via arrows.";
+            case TEXTBOX: return "A control where a user can type in their answer freely.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GROUP: return "group";
+            case LIST: return "List";
+            case TABLE: return "Table";
+            case HEADER: return "Header";
+            case FOOTER: return "Footer";
+            case TEXT: return "text";
+            case INLINE: return "In-line";
+            case PROMPT: return "Prompt";
+            case UNIT: return "Unit";
+            case LOWER: return "Lower-bound";
+            case UPPER: return "Upper-bound";
+            case FLYOVER: return "Fly-over";
+            case HELP: return "Help-Button";
+            case QUESTION: return "question";
+            case AUTOCOMPLETE: return "Auto-complete";
+            case DROPDOWN: return "Drop down";
+            case CHECKBOX: return "Check-box";
+            case LOOKUP: return "Lookup";
+            case RADIOBUTTON: return "Radio Button";
+            case SLIDER: return "Slider";
+            case SPINNER: return "Spinner";
+            case TEXTBOX: return "Text Box";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireItemControlEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireItemControlEnumFactory.java
new file mode 100644
index 00000000000..ef7b8c1f83e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireItemControlEnumFactory.java
@@ -0,0 +1,142 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class QuestionnaireItemControlEnumFactory implements EnumFactory {
+
+  public QuestionnaireItemControl fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("group".equals(codeString))
+      return QuestionnaireItemControl.GROUP;
+    if ("list".equals(codeString))
+      return QuestionnaireItemControl.LIST;
+    if ("table".equals(codeString))
+      return QuestionnaireItemControl.TABLE;
+    if ("header".equals(codeString))
+      return QuestionnaireItemControl.HEADER;
+    if ("footer".equals(codeString))
+      return QuestionnaireItemControl.FOOTER;
+    if ("text".equals(codeString))
+      return QuestionnaireItemControl.TEXT;
+    if ("inline".equals(codeString))
+      return QuestionnaireItemControl.INLINE;
+    if ("prompt".equals(codeString))
+      return QuestionnaireItemControl.PROMPT;
+    if ("unit".equals(codeString))
+      return QuestionnaireItemControl.UNIT;
+    if ("lower".equals(codeString))
+      return QuestionnaireItemControl.LOWER;
+    if ("upper".equals(codeString))
+      return QuestionnaireItemControl.UPPER;
+    if ("flyover".equals(codeString))
+      return QuestionnaireItemControl.FLYOVER;
+    if ("help".equals(codeString))
+      return QuestionnaireItemControl.HELP;
+    if ("question".equals(codeString))
+      return QuestionnaireItemControl.QUESTION;
+    if ("autocomplete".equals(codeString))
+      return QuestionnaireItemControl.AUTOCOMPLETE;
+    if ("drop-down".equals(codeString))
+      return QuestionnaireItemControl.DROPDOWN;
+    if ("check-box".equals(codeString))
+      return QuestionnaireItemControl.CHECKBOX;
+    if ("lookup".equals(codeString))
+      return QuestionnaireItemControl.LOOKUP;
+    if ("radio-button".equals(codeString))
+      return QuestionnaireItemControl.RADIOBUTTON;
+    if ("slider".equals(codeString))
+      return QuestionnaireItemControl.SLIDER;
+    if ("spinner".equals(codeString))
+      return QuestionnaireItemControl.SPINNER;
+    if ("text-box".equals(codeString))
+      return QuestionnaireItemControl.TEXTBOX;
+    throw new IllegalArgumentException("Unknown QuestionnaireItemControl code '"+codeString+"'");
+  }
+
+  public String toCode(QuestionnaireItemControl code) {
+    if (code == QuestionnaireItemControl.GROUP)
+      return "group";
+    if (code == QuestionnaireItemControl.LIST)
+      return "list";
+    if (code == QuestionnaireItemControl.TABLE)
+      return "table";
+    if (code == QuestionnaireItemControl.HEADER)
+      return "header";
+    if (code == QuestionnaireItemControl.FOOTER)
+      return "footer";
+    if (code == QuestionnaireItemControl.TEXT)
+      return "text";
+    if (code == QuestionnaireItemControl.INLINE)
+      return "inline";
+    if (code == QuestionnaireItemControl.PROMPT)
+      return "prompt";
+    if (code == QuestionnaireItemControl.UNIT)
+      return "unit";
+    if (code == QuestionnaireItemControl.LOWER)
+      return "lower";
+    if (code == QuestionnaireItemControl.UPPER)
+      return "upper";
+    if (code == QuestionnaireItemControl.FLYOVER)
+      return "flyover";
+    if (code == QuestionnaireItemControl.HELP)
+      return "help";
+    if (code == QuestionnaireItemControl.QUESTION)
+      return "question";
+    if (code == QuestionnaireItemControl.AUTOCOMPLETE)
+      return "autocomplete";
+    if (code == QuestionnaireItemControl.DROPDOWN)
+      return "drop-down";
+    if (code == QuestionnaireItemControl.CHECKBOX)
+      return "check-box";
+    if (code == QuestionnaireItemControl.LOOKUP)
+      return "lookup";
+    if (code == QuestionnaireItemControl.RADIOBUTTON)
+      return "radio-button";
+    if (code == QuestionnaireItemControl.SLIDER)
+      return "slider";
+    if (code == QuestionnaireItemControl.SPINNER)
+      return "spinner";
+    if (code == QuestionnaireItemControl.TEXTBOX)
+      return "text-box";
+    return "?";
+  }
+
+    public String toSystem(QuestionnaireItemControl code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireStatus.java
new file mode 100644
index 00000000000..0f4e4badcd3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum QuestionnaireStatus {
+
+        /**
+         * This Questionnaire is not ready for official use.
+         */
+        DRAFT, 
+        /**
+         * This Questionnaire is ready for use.
+         */
+        PUBLISHED, 
+        /**
+         * This Questionnaire should no longer be used to gather data.
+         */
+        RETIRED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static QuestionnaireStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("published".equals(codeString))
+          return PUBLISHED;
+        if ("retired".equals(codeString))
+          return RETIRED;
+        throw new FHIRException("Unknown QuestionnaireStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case PUBLISHED: return "published";
+            case RETIRED: return "retired";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/questionnaire-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "This Questionnaire is not ready for official use.";
+            case PUBLISHED: return "This Questionnaire is ready for use.";
+            case RETIRED: return "This Questionnaire should no longer be used to gather data.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DRAFT: return "Draft";
+            case PUBLISHED: return "Published";
+            case RETIRED: return "Retired";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireStatusEnumFactory.java
new file mode 100644
index 00000000000..0d471abf31c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sun, Mar 12, 2017 20:35-0400 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class QuestionnaireStatusEnumFactory implements EnumFactory {
+
+  public QuestionnaireStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return QuestionnaireStatus.DRAFT;
+    if ("published".equals(codeString))
+      return QuestionnaireStatus.PUBLISHED;
+    if ("retired".equals(codeString))
+      return QuestionnaireStatus.RETIRED;
+    throw new IllegalArgumentException("Unknown QuestionnaireStatus code '"+codeString+"'");
+  }
+
+  public String toCode(QuestionnaireStatus code) {
+    if (code == QuestionnaireStatus.DRAFT)
+      return "draft";
+    if (code == QuestionnaireStatus.PUBLISHED)
+      return "published";
+    if (code == QuestionnaireStatus.RETIRED)
+      return "retired";
+    return "?";
+  }
+
+    public String toSystem(QuestionnaireStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireUsageMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireUsageMode.java
new file mode 100644
index 00000000000..d443c39d2a5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireUsageMode.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum QuestionnaireUsageMode {
+
+        /**
+         * Render the item regardless of usage mode
+         */
+        CAPTUREDISPLAY, 
+        /**
+         * Render the item only when capturing data
+         */
+        CAPTURE, 
+        /**
+         * Render the item only when displaying a completed form
+         */
+        DISPLAY, 
+        /**
+         * Render the item only when displaying a completed form and the item has been answered (or has child items that have been answered)
+         */
+        DISPLAYNONEMPTY, 
+        /**
+         * Render the item when capturing data or when displaying a completed form and the item has been answered (or has child items that have been answered)
+         */
+        CAPTUREDISPLAYNONEMPTY, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static QuestionnaireUsageMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("capture-display".equals(codeString))
+          return CAPTUREDISPLAY;
+        if ("capture".equals(codeString))
+          return CAPTURE;
+        if ("display".equals(codeString))
+          return DISPLAY;
+        if ("display-non-empty".equals(codeString))
+          return DISPLAYNONEMPTY;
+        if ("capture-display-non-empty".equals(codeString))
+          return CAPTUREDISPLAYNONEMPTY;
+        throw new FHIRException("Unknown QuestionnaireUsageMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CAPTUREDISPLAY: return "capture-display";
+            case CAPTURE: return "capture";
+            case DISPLAY: return "display";
+            case DISPLAYNONEMPTY: return "display-non-empty";
+            case CAPTUREDISPLAYNONEMPTY: return "capture-display-non-empty";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/questionnaire-usage-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CAPTUREDISPLAY: return "Render the item regardless of usage mode";
+            case CAPTURE: return "Render the item only when capturing data";
+            case DISPLAY: return "Render the item only when displaying a completed form";
+            case DISPLAYNONEMPTY: return "Render the item only when displaying a completed form and the item has been answered (or has child items that have been answered)";
+            case CAPTUREDISPLAYNONEMPTY: return "Render the item when capturing data or when displaying a completed form and the item has been answered (or has child items that have been answered)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CAPTUREDISPLAY: return "Capture & Display";
+            case CAPTURE: return "Capture Only";
+            case DISPLAY: return "Display Only";
+            case DISPLAYNONEMPTY: return "Display when Answered";
+            case CAPTUREDISPLAYNONEMPTY: return "Capture or, if answered, Display";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireUsageModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireUsageModeEnumFactory.java
new file mode 100644
index 00000000000..e27c71daa84
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/QuestionnaireUsageModeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class QuestionnaireUsageModeEnumFactory implements EnumFactory {
+
+  public QuestionnaireUsageMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("capture-display".equals(codeString))
+      return QuestionnaireUsageMode.CAPTUREDISPLAY;
+    if ("capture".equals(codeString))
+      return QuestionnaireUsageMode.CAPTURE;
+    if ("display".equals(codeString))
+      return QuestionnaireUsageMode.DISPLAY;
+    if ("display-non-empty".equals(codeString))
+      return QuestionnaireUsageMode.DISPLAYNONEMPTY;
+    if ("capture-display-non-empty".equals(codeString))
+      return QuestionnaireUsageMode.CAPTUREDISPLAYNONEMPTY;
+    throw new IllegalArgumentException("Unknown QuestionnaireUsageMode code '"+codeString+"'");
+  }
+
+  public String toCode(QuestionnaireUsageMode code) {
+    if (code == QuestionnaireUsageMode.CAPTUREDISPLAY)
+      return "capture-display";
+    if (code == QuestionnaireUsageMode.CAPTURE)
+      return "capture";
+    if (code == QuestionnaireUsageMode.DISPLAY)
+      return "display";
+    if (code == QuestionnaireUsageMode.DISPLAYNONEMPTY)
+      return "display-non-empty";
+    if (code == QuestionnaireUsageMode.CAPTUREDISPLAYNONEMPTY)
+      return "capture-display-non-empty";
+    return "?";
+  }
+
+    public String toSystem(QuestionnaireUsageMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventCertainty.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventCertainty.java
new file mode 100644
index 00000000000..080de2607ed
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventCertainty.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReactionEventCertainty {
+
+        /**
+         * There is a low level of clinical certainty that the reaction was caused by the identified substance.
+         */
+        UNLIKELY, 
+        /**
+         * There is a high level of clinical certainty that the reaction was caused by the identified substance.
+         */
+        LIKELY, 
+        /**
+         * There is a very high level of clinical certainty that the reaction was due to the identified substance, which may include clinical evidence by testing or rechallenge.
+         */
+        CONFIRMED, 
+        /**
+         * The clinical certainty that the reaction was caused by the identified substance is unknown.  It is an explicit assertion that certainty is not known.
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReactionEventCertainty fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("unlikely".equals(codeString))
+          return UNLIKELY;
+        if ("likely".equals(codeString))
+          return LIKELY;
+        if ("confirmed".equals(codeString))
+          return CONFIRMED;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown ReactionEventCertainty code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UNLIKELY: return "unlikely";
+            case LIKELY: return "likely";
+            case CONFIRMED: return "confirmed";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/reaction-event-certainty";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UNLIKELY: return "There is a low level of clinical certainty that the reaction was caused by the identified substance.";
+            case LIKELY: return "There is a high level of clinical certainty that the reaction was caused by the identified substance.";
+            case CONFIRMED: return "There is a very high level of clinical certainty that the reaction was due to the identified substance, which may include clinical evidence by testing or rechallenge.";
+            case UNKNOWN: return "The clinical certainty that the reaction was caused by the identified substance is unknown.  It is an explicit assertion that certainty is not known.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UNLIKELY: return "Unlikely";
+            case LIKELY: return "Likely";
+            case CONFIRMED: return "Confirmed";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventCertaintyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventCertaintyEnumFactory.java
new file mode 100644
index 00000000000..cbfb3300782
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventCertaintyEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReactionEventCertaintyEnumFactory implements EnumFactory {
+
+  public ReactionEventCertainty fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("unlikely".equals(codeString))
+      return ReactionEventCertainty.UNLIKELY;
+    if ("likely".equals(codeString))
+      return ReactionEventCertainty.LIKELY;
+    if ("confirmed".equals(codeString))
+      return ReactionEventCertainty.CONFIRMED;
+    if ("unknown".equals(codeString))
+      return ReactionEventCertainty.UNKNOWN;
+    throw new IllegalArgumentException("Unknown ReactionEventCertainty code '"+codeString+"'");
+  }
+
+  public String toCode(ReactionEventCertainty code) {
+    if (code == ReactionEventCertainty.UNLIKELY)
+      return "unlikely";
+    if (code == ReactionEventCertainty.LIKELY)
+      return "likely";
+    if (code == ReactionEventCertainty.CONFIRMED)
+      return "confirmed";
+    if (code == ReactionEventCertainty.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(ReactionEventCertainty code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventSeverity.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventSeverity.java
new file mode 100644
index 00000000000..1c44141849b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventSeverity.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReactionEventSeverity {
+
+        /**
+         * Causes mild physiological effects.
+         */
+        MILD, 
+        /**
+         * Causes moderate physiological effects.
+         */
+        MODERATE, 
+        /**
+         * Causes severe physiological effects.
+         */
+        SEVERE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReactionEventSeverity fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("mild".equals(codeString))
+          return MILD;
+        if ("moderate".equals(codeString))
+          return MODERATE;
+        if ("severe".equals(codeString))
+          return SEVERE;
+        throw new FHIRException("Unknown ReactionEventSeverity code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MILD: return "mild";
+            case MODERATE: return "moderate";
+            case SEVERE: return "severe";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/reaction-event-severity";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MILD: return "Causes mild physiological effects.";
+            case MODERATE: return "Causes moderate physiological effects.";
+            case SEVERE: return "Causes severe physiological effects.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MILD: return "Mild";
+            case MODERATE: return "Moderate";
+            case SEVERE: return "Severe";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventSeverityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventSeverityEnumFactory.java
new file mode 100644
index 00000000000..442bbf71788
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReactionEventSeverityEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReactionEventSeverityEnumFactory implements EnumFactory {
+
+  public ReactionEventSeverity fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("mild".equals(codeString))
+      return ReactionEventSeverity.MILD;
+    if ("moderate".equals(codeString))
+      return ReactionEventSeverity.MODERATE;
+    if ("severe".equals(codeString))
+      return ReactionEventSeverity.SEVERE;
+    throw new IllegalArgumentException("Unknown ReactionEventSeverity code '"+codeString+"'");
+  }
+
+  public String toCode(ReactionEventSeverity code) {
+    if (code == ReactionEventSeverity.MILD)
+      return "mild";
+    if (code == ReactionEventSeverity.MODERATE)
+      return "moderate";
+    if (code == ReactionEventSeverity.SEVERE)
+      return "severe";
+    return "?";
+  }
+
+    public String toSystem(ReactionEventSeverity code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationGivenCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationGivenCodes.java
new file mode 100644
index 00000000000..1ae4351b5b4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationGivenCodes.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReasonMedicationGivenCodes {
+
+        /**
+         * No reason known.
+         */
+        A, 
+        /**
+         * The administration was following an ordered protocol.
+         */
+        B, 
+        /**
+         * The administration was needed to treat an emergency.
+         */
+        C, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReasonMedicationGivenCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("a".equals(codeString))
+          return A;
+        if ("b".equals(codeString))
+          return B;
+        if ("c".equals(codeString))
+          return C;
+        throw new FHIRException("Unknown ReasonMedicationGivenCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A: return "a";
+            case B: return "b";
+            case C: return "c";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/reason-medication-given";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A: return "No reason known.";
+            case B: return "The administration was following an ordered protocol.";
+            case C: return "The administration was needed to treat an emergency.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A: return "None";
+            case B: return "Given as Ordered";
+            case C: return "Emergency";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationGivenCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationGivenCodesEnumFactory.java
new file mode 100644
index 00000000000..1eea6fae324
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationGivenCodesEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReasonMedicationGivenCodesEnumFactory implements EnumFactory {
+
+  public ReasonMedicationGivenCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("a".equals(codeString))
+      return ReasonMedicationGivenCodes.A;
+    if ("b".equals(codeString))
+      return ReasonMedicationGivenCodes.B;
+    if ("c".equals(codeString))
+      return ReasonMedicationGivenCodes.C;
+    throw new IllegalArgumentException("Unknown ReasonMedicationGivenCodes code '"+codeString+"'");
+  }
+
+  public String toCode(ReasonMedicationGivenCodes code) {
+    if (code == ReasonMedicationGivenCodes.A)
+      return "a";
+    if (code == ReasonMedicationGivenCodes.B)
+      return "b";
+    if (code == ReasonMedicationGivenCodes.C)
+      return "c";
+    return "?";
+  }
+
+    public String toSystem(ReasonMedicationGivenCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationNotGivenCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationNotGivenCodes.java
new file mode 100644
index 00000000000..13ebeceb9b4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationNotGivenCodes.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReasonMedicationNotGivenCodes {
+
+        /**
+         * No reason known.
+         */
+        A, 
+        /**
+         * The patient was not available when the dose was scheduled.
+         */
+        B, 
+        /**
+         * The patient was asleep when the dose was scheduled.
+         */
+        C, 
+        /**
+         * The patient was given the medication and immediately vomited it back.
+         */
+        D, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReasonMedicationNotGivenCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("a".equals(codeString))
+          return A;
+        if ("b".equals(codeString))
+          return B;
+        if ("c".equals(codeString))
+          return C;
+        if ("d".equals(codeString))
+          return D;
+        throw new FHIRException("Unknown ReasonMedicationNotGivenCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A: return "a";
+            case B: return "b";
+            case C: return "c";
+            case D: return "d";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/reason-medication-not-given";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A: return "No reason known.";
+            case B: return "The patient was not available when the dose was scheduled.";
+            case C: return "The patient was asleep when the dose was scheduled.";
+            case D: return "The patient was given the medication and immediately vomited it back.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A: return "None";
+            case B: return "Away";
+            case C: return "Asleep";
+            case D: return "Vomit";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationNotGivenCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationNotGivenCodesEnumFactory.java
new file mode 100644
index 00000000000..e865cdb66d9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReasonMedicationNotGivenCodesEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReasonMedicationNotGivenCodesEnumFactory implements EnumFactory {
+
+  public ReasonMedicationNotGivenCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("a".equals(codeString))
+      return ReasonMedicationNotGivenCodes.A;
+    if ("b".equals(codeString))
+      return ReasonMedicationNotGivenCodes.B;
+    if ("c".equals(codeString))
+      return ReasonMedicationNotGivenCodes.C;
+    if ("d".equals(codeString))
+      return ReasonMedicationNotGivenCodes.D;
+    throw new IllegalArgumentException("Unknown ReasonMedicationNotGivenCodes code '"+codeString+"'");
+  }
+
+  public String toCode(ReasonMedicationNotGivenCodes code) {
+    if (code == ReasonMedicationNotGivenCodes.A)
+      return "a";
+    if (code == ReasonMedicationNotGivenCodes.B)
+      return "b";
+    if (code == ReasonMedicationNotGivenCodes.C)
+      return "c";
+    if (code == ReasonMedicationNotGivenCodes.D)
+      return "d";
+    return "?";
+  }
+
+    public String toSystem(ReasonMedicationNotGivenCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceHandlingPolicy.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceHandlingPolicy.java
new file mode 100644
index 00000000000..7475c6db571
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceHandlingPolicy.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReferenceHandlingPolicy {
+
+        /**
+         * The server supports and populates Literal references where they are known (this code does not guarantee that all references are literal; see 'enforced')
+         */
+        LITERAL, 
+        /**
+         * The server allows logical references
+         */
+        LOGICAL, 
+        /**
+         * The server will attempt to resolve logical references to literal references (if resolution fails, the server may still accept resources; see logical)
+         */
+        RESOLVES, 
+        /**
+         * The server enforces that references have integrity - e.g. it ensures that references can always be resolved. This is typically the case for clinical record systems, but often not the case for middleware/proxy systems
+         */
+        ENFORCED, 
+        /**
+         * The server does not support references that point to other servers
+         */
+        LOCAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReferenceHandlingPolicy fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("literal".equals(codeString))
+          return LITERAL;
+        if ("logical".equals(codeString))
+          return LOGICAL;
+        if ("resolves".equals(codeString))
+          return RESOLVES;
+        if ("enforced".equals(codeString))
+          return ENFORCED;
+        if ("local".equals(codeString))
+          return LOCAL;
+        throw new FHIRException("Unknown ReferenceHandlingPolicy code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LITERAL: return "literal";
+            case LOGICAL: return "logical";
+            case RESOLVES: return "resolves";
+            case ENFORCED: return "enforced";
+            case LOCAL: return "local";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/reference-handling-policy";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LITERAL: return "The server supports and populates Literal references where they are known (this code does not guarantee that all references are literal; see 'enforced')";
+            case LOGICAL: return "The server allows logical references";
+            case RESOLVES: return "The server will attempt to resolve logical references to literal references (if resolution fails, the server may still accept resources; see logical)";
+            case ENFORCED: return "The server enforces that references have integrity - e.g. it ensures that references can always be resolved. This is typically the case for clinical record systems, but often not the case for middleware/proxy systems";
+            case LOCAL: return "The server does not support references that point to other servers";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LITERAL: return "Literal References";
+            case LOGICAL: return "Logical References";
+            case RESOLVES: return "Resolves References";
+            case ENFORCED: return "Reference Integrity Enforced";
+            case LOCAL: return "Local References Only";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceHandlingPolicyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceHandlingPolicyEnumFactory.java
new file mode 100644
index 00000000000..efd60b6a967
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceHandlingPolicyEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReferenceHandlingPolicyEnumFactory implements EnumFactory {
+
+  public ReferenceHandlingPolicy fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("literal".equals(codeString))
+      return ReferenceHandlingPolicy.LITERAL;
+    if ("logical".equals(codeString))
+      return ReferenceHandlingPolicy.LOGICAL;
+    if ("resolves".equals(codeString))
+      return ReferenceHandlingPolicy.RESOLVES;
+    if ("enforced".equals(codeString))
+      return ReferenceHandlingPolicy.ENFORCED;
+    if ("local".equals(codeString))
+      return ReferenceHandlingPolicy.LOCAL;
+    throw new IllegalArgumentException("Unknown ReferenceHandlingPolicy code '"+codeString+"'");
+  }
+
+  public String toCode(ReferenceHandlingPolicy code) {
+    if (code == ReferenceHandlingPolicy.LITERAL)
+      return "literal";
+    if (code == ReferenceHandlingPolicy.LOGICAL)
+      return "logical";
+    if (code == ReferenceHandlingPolicy.RESOLVES)
+      return "resolves";
+    if (code == ReferenceHandlingPolicy.ENFORCED)
+      return "enforced";
+    if (code == ReferenceHandlingPolicy.LOCAL)
+      return "local";
+    return "?";
+  }
+
+    public String toSystem(ReferenceHandlingPolicy code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceVersionRules.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceVersionRules.java
new file mode 100644
index 00000000000..5b74a914cdf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceVersionRules.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReferenceVersionRules {
+
+        /**
+         * The reference may be either version independent or version specific
+         */
+        EITHER, 
+        /**
+         * The reference must be version independent
+         */
+        INDEPENDENT, 
+        /**
+         * The reference must be version specific
+         */
+        SPECIFIC, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReferenceVersionRules fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("either".equals(codeString))
+          return EITHER;
+        if ("independent".equals(codeString))
+          return INDEPENDENT;
+        if ("specific".equals(codeString))
+          return SPECIFIC;
+        throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case EITHER: return "either";
+            case INDEPENDENT: return "independent";
+            case SPECIFIC: return "specific";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/reference-version-rules";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case EITHER: return "The reference may be either version independent or version specific";
+            case INDEPENDENT: return "The reference must be version independent";
+            case SPECIFIC: return "The reference must be version specific";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case EITHER: return "Either Specific or independent";
+            case INDEPENDENT: return "Version independent";
+            case SPECIFIC: return "Version Specific";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceVersionRulesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceVersionRulesEnumFactory.java
new file mode 100644
index 00000000000..3f51b143f02
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferenceVersionRulesEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReferenceVersionRulesEnumFactory implements EnumFactory {
+
+  public ReferenceVersionRules fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("either".equals(codeString))
+      return ReferenceVersionRules.EITHER;
+    if ("independent".equals(codeString))
+      return ReferenceVersionRules.INDEPENDENT;
+    if ("specific".equals(codeString))
+      return ReferenceVersionRules.SPECIFIC;
+    throw new IllegalArgumentException("Unknown ReferenceVersionRules code '"+codeString+"'");
+  }
+
+  public String toCode(ReferenceVersionRules code) {
+    if (code == ReferenceVersionRules.EITHER)
+      return "either";
+    if (code == ReferenceVersionRules.INDEPENDENT)
+      return "independent";
+    if (code == ReferenceVersionRules.SPECIFIC)
+      return "specific";
+    return "?";
+  }
+
+    public String toSystem(ReferenceVersionRules code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferencerangeMeaning.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferencerangeMeaning.java
new file mode 100644
index 00000000000..a4d763df8bf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferencerangeMeaning.java
@@ -0,0 +1,186 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReferencerangeMeaning {
+
+        /**
+         * General types of reference range.
+         */
+        TYPE, 
+        /**
+         * Based on 95th percentile for the relevant control population.
+         */
+        NORMAL, 
+        /**
+         * The range that is recommended by a relevant professional body.
+         */
+        RECOMMENDED, 
+        /**
+         * The range at which treatment would/should be considered.
+         */
+        TREATMENT, 
+        /**
+         * The optimal range for best therapeutic outcomes.
+         */
+        THERAPEUTIC, 
+        /**
+         * The optimal range for best therapeutic outcomes for a specimen taken immediately before administration.
+         */
+        PRE, 
+        /**
+         * The optimal range for best therapeutic outcomes for a specimen taken immediately after administration.
+         */
+        POST, 
+        /**
+         * Endocrine related states that change the expected value.
+         */
+        ENDOCRINE, 
+        /**
+         * An expected range in an individual prior to puberty.
+         */
+        PREPUBERTY, 
+        /**
+         * An expected range in an individual during the follicular stage of the cycle.
+         */
+        FOLLICULAR, 
+        /**
+         * An expected range in an individual during the follicular stage of the cycle.
+         */
+        MIDCYCLE, 
+        /**
+         * An expected range in an individual during the luteal stage of the cycle.
+         */
+        LUTEAL, 
+        /**
+         * An expected range in an individual post-menopause.
+         */
+        POSTMEOPAUSAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReferencerangeMeaning fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("type".equals(codeString))
+          return TYPE;
+        if ("normal".equals(codeString))
+          return NORMAL;
+        if ("recommended".equals(codeString))
+          return RECOMMENDED;
+        if ("treatment".equals(codeString))
+          return TREATMENT;
+        if ("therapeutic".equals(codeString))
+          return THERAPEUTIC;
+        if ("pre".equals(codeString))
+          return PRE;
+        if ("post".equals(codeString))
+          return POST;
+        if ("endocrine".equals(codeString))
+          return ENDOCRINE;
+        if ("pre-puberty".equals(codeString))
+          return PREPUBERTY;
+        if ("follicular".equals(codeString))
+          return FOLLICULAR;
+        if ("midcycle".equals(codeString))
+          return MIDCYCLE;
+        if ("luteal".equals(codeString))
+          return LUTEAL;
+        if ("postmeopausal".equals(codeString))
+          return POSTMEOPAUSAL;
+        throw new FHIRException("Unknown ReferencerangeMeaning code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case TYPE: return "type";
+            case NORMAL: return "normal";
+            case RECOMMENDED: return "recommended";
+            case TREATMENT: return "treatment";
+            case THERAPEUTIC: return "therapeutic";
+            case PRE: return "pre";
+            case POST: return "post";
+            case ENDOCRINE: return "endocrine";
+            case PREPUBERTY: return "pre-puberty";
+            case FOLLICULAR: return "follicular";
+            case MIDCYCLE: return "midcycle";
+            case LUTEAL: return "luteal";
+            case POSTMEOPAUSAL: return "postmeopausal";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/referencerange-meaning";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case TYPE: return "General types of reference range.";
+            case NORMAL: return "Based on 95th percentile for the relevant control population.";
+            case RECOMMENDED: return "The range that is recommended by a relevant professional body.";
+            case TREATMENT: return "The range at which treatment would/should be considered.";
+            case THERAPEUTIC: return "The optimal range for best therapeutic outcomes.";
+            case PRE: return "The optimal range for best therapeutic outcomes for a specimen taken immediately before administration.";
+            case POST: return "The optimal range for best therapeutic outcomes for a specimen taken immediately after administration.";
+            case ENDOCRINE: return "Endocrine related states that change the expected value.";
+            case PREPUBERTY: return "An expected range in an individual prior to puberty.";
+            case FOLLICULAR: return "An expected range in an individual during the follicular stage of the cycle.";
+            case MIDCYCLE: return "An expected range in an individual during the follicular stage of the cycle.";
+            case LUTEAL: return "An expected range in an individual during the luteal stage of the cycle.";
+            case POSTMEOPAUSAL: return "An expected range in an individual post-menopause.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case TYPE: return "Type";
+            case NORMAL: return "Normal Range";
+            case RECOMMENDED: return "Recommended Range";
+            case TREATMENT: return "Treatment Range";
+            case THERAPEUTIC: return "Therapeutic Desired Level";
+            case PRE: return "Pre Therapeutic Desired Level";
+            case POST: return "Post Therapeutic Desired Level";
+            case ENDOCRINE: return "Endocrine";
+            case PREPUBERTY: return "Pre-Puberty";
+            case FOLLICULAR: return "Follicular Stage";
+            case MIDCYCLE: return "MidCycle";
+            case LUTEAL: return "Luteal";
+            case POSTMEOPAUSAL: return "Post-Menopause";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferencerangeMeaningEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferencerangeMeaningEnumFactory.java
new file mode 100644
index 00000000000..176a421d849
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferencerangeMeaningEnumFactory.java
@@ -0,0 +1,106 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReferencerangeMeaningEnumFactory implements EnumFactory {
+
+  public ReferencerangeMeaning fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("type".equals(codeString))
+      return ReferencerangeMeaning.TYPE;
+    if ("normal".equals(codeString))
+      return ReferencerangeMeaning.NORMAL;
+    if ("recommended".equals(codeString))
+      return ReferencerangeMeaning.RECOMMENDED;
+    if ("treatment".equals(codeString))
+      return ReferencerangeMeaning.TREATMENT;
+    if ("therapeutic".equals(codeString))
+      return ReferencerangeMeaning.THERAPEUTIC;
+    if ("pre".equals(codeString))
+      return ReferencerangeMeaning.PRE;
+    if ("post".equals(codeString))
+      return ReferencerangeMeaning.POST;
+    if ("endocrine".equals(codeString))
+      return ReferencerangeMeaning.ENDOCRINE;
+    if ("pre-puberty".equals(codeString))
+      return ReferencerangeMeaning.PREPUBERTY;
+    if ("follicular".equals(codeString))
+      return ReferencerangeMeaning.FOLLICULAR;
+    if ("midcycle".equals(codeString))
+      return ReferencerangeMeaning.MIDCYCLE;
+    if ("luteal".equals(codeString))
+      return ReferencerangeMeaning.LUTEAL;
+    if ("postmeopausal".equals(codeString))
+      return ReferencerangeMeaning.POSTMEOPAUSAL;
+    throw new IllegalArgumentException("Unknown ReferencerangeMeaning code '"+codeString+"'");
+  }
+
+  public String toCode(ReferencerangeMeaning code) {
+    if (code == ReferencerangeMeaning.TYPE)
+      return "type";
+    if (code == ReferencerangeMeaning.NORMAL)
+      return "normal";
+    if (code == ReferencerangeMeaning.RECOMMENDED)
+      return "recommended";
+    if (code == ReferencerangeMeaning.TREATMENT)
+      return "treatment";
+    if (code == ReferencerangeMeaning.THERAPEUTIC)
+      return "therapeutic";
+    if (code == ReferencerangeMeaning.PRE)
+      return "pre";
+    if (code == ReferencerangeMeaning.POST)
+      return "post";
+    if (code == ReferencerangeMeaning.ENDOCRINE)
+      return "endocrine";
+    if (code == ReferencerangeMeaning.PREPUBERTY)
+      return "pre-puberty";
+    if (code == ReferencerangeMeaning.FOLLICULAR)
+      return "follicular";
+    if (code == ReferencerangeMeaning.MIDCYCLE)
+      return "midcycle";
+    if (code == ReferencerangeMeaning.LUTEAL)
+      return "luteal";
+    if (code == ReferencerangeMeaning.POSTMEOPAUSAL)
+      return "postmeopausal";
+    return "?";
+  }
+
+    public String toSystem(ReferencerangeMeaning code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralRequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralRequestStatus.java
new file mode 100644
index 00000000000..f4b16f19ed2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralRequestStatus.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReferralRequestStatus {
+
+        /**
+         * A draft referral that has yet to be send.
+         */
+        DRAFT, 
+        /**
+         * The referral is complete and is ready for fulfillment.
+         */
+        ACTIVE, 
+        /**
+         * The referral has been cancelled without being completed. For example it is no longer needed.
+         */
+        CANCELLED, 
+        /**
+         * The referral has been completely actioned.
+         */
+        COMPLETED, 
+        /**
+         * This referral record should never have existed, though it's possible some degree of real-world activity or decisions may have been taken due to its existence
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReferralRequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ReferralRequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/referral-request-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "A draft referral that has yet to be send.";
+            case ACTIVE: return "The referral is complete and is ready for fulfillment.";
+            case CANCELLED: return "The referral has been cancelled without being completed. For example it is no longer needed.";
+            case COMPLETED: return "The referral has been completely actioned.";
+            case ENTEREDINERROR: return "This referral record should never have existed, though it's possible some degree of real-world activity or decisions may have been taken due to its existence";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DRAFT: return "Draft";
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralRequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralRequestStatusEnumFactory.java
new file mode 100644
index 00000000000..2304f2d4895
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralRequestStatusEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Thu, Feb 9, 2017 08:03-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReferralRequestStatusEnumFactory implements EnumFactory {
+
+  public ReferralRequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return ReferralRequestStatus.DRAFT;
+    if ("active".equals(codeString))
+      return ReferralRequestStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return ReferralRequestStatus.CANCELLED;
+    if ("completed".equals(codeString))
+      return ReferralRequestStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return ReferralRequestStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ReferralRequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ReferralRequestStatus code) {
+    if (code == ReferralRequestStatus.DRAFT)
+      return "draft";
+    if (code == ReferralRequestStatus.ACTIVE)
+      return "active";
+    if (code == ReferralRequestStatus.CANCELLED)
+      return "cancelled";
+    if (code == ReferralRequestStatus.COMPLETED)
+      return "completed";
+    if (code == ReferralRequestStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ReferralRequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Referralcategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Referralcategory.java
new file mode 100644
index 00000000000..6eef3e7bc1a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Referralcategory.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Referralcategory {
+
+        /**
+         * The referral request represents a suggestion or recommendation that a referral be made.
+         */
+        PROPOSAL, 
+        /**
+         * The referral request represents an intention by the author to make a referral, but no actual referral has yet been made/authorized.
+         */
+        PLAN, 
+        /**
+         * This is an actual referral request which, when active, will have the authorizations needed to allow it to be actioned.
+         */
+        REQUEST, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Referralcategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposal".equals(codeString))
+          return PROPOSAL;
+        if ("plan".equals(codeString))
+          return PLAN;
+        if ("request".equals(codeString))
+          return REQUEST;
+        throw new FHIRException("Unknown Referralcategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSAL: return "proposal";
+            case PLAN: return "plan";
+            case REQUEST: return "request";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/referralcategory";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSAL: return "The referral request represents a suggestion or recommendation that a referral be made.";
+            case PLAN: return "The referral request represents an intention by the author to make a referral, but no actual referral has yet been made/authorized.";
+            case REQUEST: return "This is an actual referral request which, when active, will have the authorizations needed to allow it to be actioned.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSAL: return "Proposal";
+            case PLAN: return "Plan";
+            case REQUEST: return "Request";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralcategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralcategoryEnumFactory.java
new file mode 100644
index 00000000000..981610be2f8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralcategoryEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReferralcategoryEnumFactory implements EnumFactory {
+
+  public Referralcategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposal".equals(codeString))
+      return Referralcategory.PROPOSAL;
+    if ("plan".equals(codeString))
+      return Referralcategory.PLAN;
+    if ("request".equals(codeString))
+      return Referralcategory.REQUEST;
+    throw new IllegalArgumentException("Unknown Referralcategory code '"+codeString+"'");
+  }
+
+  public String toCode(Referralcategory code) {
+    if (code == Referralcategory.PROPOSAL)
+      return "proposal";
+    if (code == Referralcategory.PLAN)
+      return "plan";
+    if (code == Referralcategory.REQUEST)
+      return "request";
+    return "?";
+  }
+
+    public String toSystem(Referralcategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Referralstatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Referralstatus.java
new file mode 100644
index 00000000000..20f7a9c4ff3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Referralstatus.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Referralstatus {
+
+        /**
+         * A draft referral that has yet to be send.
+         */
+        DRAFT, 
+        /**
+         * The referral is complete and is ready for fulfillment.
+         */
+        ACTIVE, 
+        /**
+         * The referral has been cancelled without being completed. For example it is no longer needed.
+         */
+        CANCELLED, 
+        /**
+         * The referral has been completely actioned.
+         */
+        COMPLETED, 
+        /**
+         * This referral record should never have existed, though it's possible some degree of real-world activity or decisions may have been taken due to its existence
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Referralstatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown Referralstatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/referralstatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "A draft referral that has yet to be send.";
+            case ACTIVE: return "The referral is complete and is ready for fulfillment.";
+            case CANCELLED: return "The referral has been cancelled without being completed. For example it is no longer needed.";
+            case COMPLETED: return "The referral has been completely actioned.";
+            case ENTEREDINERROR: return "This referral record should never have existed, though it's possible some degree of real-world activity or decisions may have been taken due to its existence";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DRAFT: return "Draft";
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralstatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralstatusEnumFactory.java
new file mode 100644
index 00000000000..78c1cd4fc0e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReferralstatusEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReferralstatusEnumFactory implements EnumFactory {
+
+  public Referralstatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return Referralstatus.DRAFT;
+    if ("active".equals(codeString))
+      return Referralstatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return Referralstatus.CANCELLED;
+    if ("completed".equals(codeString))
+      return Referralstatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return Referralstatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown Referralstatus code '"+codeString+"'");
+  }
+
+  public String toCode(Referralstatus code) {
+    if (code == Referralstatus.DRAFT)
+      return "draft";
+    if (code == Referralstatus.ACTIVE)
+      return "active";
+    if (code == Referralstatus.CANCELLED)
+      return "cancelled";
+    if (code == Referralstatus.COMPLETED)
+      return "completed";
+    if (code == Referralstatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(Referralstatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedArtifactType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedArtifactType.java
new file mode 100644
index 00000000000..ff9b886a7b0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedArtifactType.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RelatedArtifactType {
+
+        /**
+         * Additional documentation for the knowledge resource. This would include additional instructions on usage as well as additional information on clinical context or appropriateness
+         */
+        DOCUMENTATION, 
+        /**
+         * A summary of the justification for the knowledge resource including supporting evidence, relevant guidelines, or other clinically important information. This information is intended to provide a way to make the justification for the knowledge resource available to the consumer of interventions or results produced by the knowledge resource
+         */
+        JUSTIFICATION, 
+        /**
+         * Bibliographic citation for papers, references, or other relevant material for the knowledge resource. This is intended to allow for citation of related material, but that was not necessarily specifically prepared in connection with this knowledge resource
+         */
+        CITATION, 
+        /**
+         * The previous version of the knowledge resource
+         */
+        PREDECESSOR, 
+        /**
+         * The next version of the knowledge resource
+         */
+        SUCCESSOR, 
+        /**
+         * The knowledge resource is derived from the related artifact. This is intended to capture the relationship in which a particular knowledge resource is based on the content of another artifact, but is modified to capture either a different set of overall requirements, or a more specific set of requirements such as those involved in a particular institution or clinical setting
+         */
+        DERIVEDFROM, 
+        /**
+         * The knowledge resource depends on the given related artifact
+         */
+        DEPENDSON, 
+        /**
+         * The knowledge resource is composed of the given related artifact
+         */
+        COMPOSEDOF, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RelatedArtifactType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("documentation".equals(codeString))
+          return DOCUMENTATION;
+        if ("justification".equals(codeString))
+          return JUSTIFICATION;
+        if ("citation".equals(codeString))
+          return CITATION;
+        if ("predecessor".equals(codeString))
+          return PREDECESSOR;
+        if ("successor".equals(codeString))
+          return SUCCESSOR;
+        if ("derived-from".equals(codeString))
+          return DERIVEDFROM;
+        if ("depends-on".equals(codeString))
+          return DEPENDSON;
+        if ("composed-of".equals(codeString))
+          return COMPOSEDOF;
+        throw new FHIRException("Unknown RelatedArtifactType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DOCUMENTATION: return "documentation";
+            case JUSTIFICATION: return "justification";
+            case CITATION: return "citation";
+            case PREDECESSOR: return "predecessor";
+            case SUCCESSOR: return "successor";
+            case DERIVEDFROM: return "derived-from";
+            case DEPENDSON: return "depends-on";
+            case COMPOSEDOF: return "composed-of";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/related-artifact-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DOCUMENTATION: return "Additional documentation for the knowledge resource. This would include additional instructions on usage as well as additional information on clinical context or appropriateness";
+            case JUSTIFICATION: return "A summary of the justification for the knowledge resource including supporting evidence, relevant guidelines, or other clinically important information. This information is intended to provide a way to make the justification for the knowledge resource available to the consumer of interventions or results produced by the knowledge resource";
+            case CITATION: return "Bibliographic citation for papers, references, or other relevant material for the knowledge resource. This is intended to allow for citation of related material, but that was not necessarily specifically prepared in connection with this knowledge resource";
+            case PREDECESSOR: return "The previous version of the knowledge resource";
+            case SUCCESSOR: return "The next version of the knowledge resource";
+            case DERIVEDFROM: return "The knowledge resource is derived from the related artifact. This is intended to capture the relationship in which a particular knowledge resource is based on the content of another artifact, but is modified to capture either a different set of overall requirements, or a more specific set of requirements such as those involved in a particular institution or clinical setting";
+            case DEPENDSON: return "The knowledge resource depends on the given related artifact";
+            case COMPOSEDOF: return "The knowledge resource is composed of the given related artifact";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DOCUMENTATION: return "Documentation";
+            case JUSTIFICATION: return "Justification";
+            case CITATION: return "Citation";
+            case PREDECESSOR: return "Predecessor";
+            case SUCCESSOR: return "Successor";
+            case DERIVEDFROM: return "Derived From";
+            case DEPENDSON: return "Depends On";
+            case COMPOSEDOF: return "Composed Of";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedArtifactTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedArtifactTypeEnumFactory.java
new file mode 100644
index 00000000000..572e13e910f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedArtifactTypeEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RelatedArtifactTypeEnumFactory implements EnumFactory {
+
+  public RelatedArtifactType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("documentation".equals(codeString))
+      return RelatedArtifactType.DOCUMENTATION;
+    if ("justification".equals(codeString))
+      return RelatedArtifactType.JUSTIFICATION;
+    if ("citation".equals(codeString))
+      return RelatedArtifactType.CITATION;
+    if ("predecessor".equals(codeString))
+      return RelatedArtifactType.PREDECESSOR;
+    if ("successor".equals(codeString))
+      return RelatedArtifactType.SUCCESSOR;
+    if ("derived-from".equals(codeString))
+      return RelatedArtifactType.DERIVEDFROM;
+    if ("depends-on".equals(codeString))
+      return RelatedArtifactType.DEPENDSON;
+    if ("composed-of".equals(codeString))
+      return RelatedArtifactType.COMPOSEDOF;
+    throw new IllegalArgumentException("Unknown RelatedArtifactType code '"+codeString+"'");
+  }
+
+  public String toCode(RelatedArtifactType code) {
+    if (code == RelatedArtifactType.DOCUMENTATION)
+      return "documentation";
+    if (code == RelatedArtifactType.JUSTIFICATION)
+      return "justification";
+    if (code == RelatedArtifactType.CITATION)
+      return "citation";
+    if (code == RelatedArtifactType.PREDECESSOR)
+      return "predecessor";
+    if (code == RelatedArtifactType.SUCCESSOR)
+      return "successor";
+    if (code == RelatedArtifactType.DERIVEDFROM)
+      return "derived-from";
+    if (code == RelatedArtifactType.DEPENDSON)
+      return "depends-on";
+    if (code == RelatedArtifactType.COMPOSEDOF)
+      return "composed-of";
+    return "?";
+  }
+
+    public String toSystem(RelatedArtifactType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedClaimRelationship.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedClaimRelationship.java
new file mode 100644
index 00000000000..024fc65f73a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedClaimRelationship.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RelatedClaimRelationship {
+
+        /**
+         * A prior claim instance for the same intended suite of services.
+         */
+        PRIOR, 
+        /**
+         * A claim for a different suite of services which is related the suite claimed here.
+         */
+        ASSOCIATED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RelatedClaimRelationship fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("prior".equals(codeString))
+          return PRIOR;
+        if ("associated".equals(codeString))
+          return ASSOCIATED;
+        throw new FHIRException("Unknown RelatedClaimRelationship code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PRIOR: return "prior";
+            case ASSOCIATED: return "associated";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-relatedclaimrelationship";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PRIOR: return "A prior claim instance for the same intended suite of services.";
+            case ASSOCIATED: return "A claim for a different suite of services which is related the suite claimed here.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PRIOR: return "Prior Claim";
+            case ASSOCIATED: return "Associated Claim";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedClaimRelationshipEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedClaimRelationshipEnumFactory.java
new file mode 100644
index 00000000000..e470faecb48
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelatedClaimRelationshipEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RelatedClaimRelationshipEnumFactory implements EnumFactory {
+
+  public RelatedClaimRelationship fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("prior".equals(codeString))
+      return RelatedClaimRelationship.PRIOR;
+    if ("associated".equals(codeString))
+      return RelatedClaimRelationship.ASSOCIATED;
+    throw new IllegalArgumentException("Unknown RelatedClaimRelationship code '"+codeString+"'");
+  }
+
+  public String toCode(RelatedClaimRelationship code) {
+    if (code == RelatedClaimRelationship.PRIOR)
+      return "prior";
+    if (code == RelatedClaimRelationship.ASSOCIATED)
+      return "associated";
+    return "?";
+  }
+
+    public String toSystem(RelatedClaimRelationship code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Relationship.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Relationship.java
new file mode 100644
index 00000000000..4ac0cde7fd5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Relationship.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Relationship {
+
+        /**
+         * The patient is the subscriber (policy holder)
+         */
+        _1, 
+        /**
+         * The patient is the spouse or equivalent of the subscriber (policy holder)
+         */
+        _2, 
+        /**
+         * The patient is the child of the subscriber (policy holder)
+         */
+        _3, 
+        /**
+         * The patient is the common law spouse of the subscriber (policy holder)
+         */
+        _4, 
+        /**
+         * The patient has some other relationship, such as parent, to the subscriber (policy holder)
+         */
+        _5, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Relationship fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        throw new FHIRException("Unknown Relationship code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/relationship";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "The patient is the subscriber (policy holder)";
+            case _2: return "The patient is the spouse or equivalent of the subscriber (policy holder)";
+            case _3: return "The patient is the child of the subscriber (policy holder)";
+            case _4: return "The patient is the common law spouse of the subscriber (policy holder)";
+            case _5: return "The patient has some other relationship, such as parent, to the subscriber (policy holder)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Self";
+            case _2: return "Spouse";
+            case _3: return "Child";
+            case _4: return "Common Law Spouse";
+            case _5: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelationshipEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelationshipEnumFactory.java
new file mode 100644
index 00000000000..8d3623f6d72
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RelationshipEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RelationshipEnumFactory implements EnumFactory {
+
+  public Relationship fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return Relationship._1;
+    if ("2".equals(codeString))
+      return Relationship._2;
+    if ("3".equals(codeString))
+      return Relationship._3;
+    if ("4".equals(codeString))
+      return Relationship._4;
+    if ("5".equals(codeString))
+      return Relationship._5;
+    throw new IllegalArgumentException("Unknown Relationship code '"+codeString+"'");
+  }
+
+  public String toCode(Relationship code) {
+    if (code == Relationship._1)
+      return "1";
+    if (code == Relationship._2)
+      return "2";
+    if (code == Relationship._3)
+      return "3";
+    if (code == Relationship._4)
+      return "4";
+    if (code == Relationship._5)
+      return "5";
+    return "?";
+  }
+
+    public String toSystem(Relationship code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RemittanceOutcome.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RemittanceOutcome.java
new file mode 100644
index 00000000000..a97a359c303
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RemittanceOutcome.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RemittanceOutcome {
+
+        /**
+         * The processing has completed without errors
+         */
+        COMPLETE, 
+        /**
+         * One or more errors have been detected in the Claim
+         */
+        ERROR, 
+        /**
+         * No errors have been detected in the Claim and some of the adjudication has been performed.
+         */
+        PARTIAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("complete".equals(codeString))
+          return COMPLETE;
+        if ("error".equals(codeString))
+          return ERROR;
+        if ("partial".equals(codeString))
+          return PARTIAL;
+        throw new FHIRException("Unknown RemittanceOutcome code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COMPLETE: return "complete";
+            case ERROR: return "error";
+            case PARTIAL: return "partial";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/remittance-outcome";
+        }
+        public String getDefinition() {
+          switch (this) {
+            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.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COMPLETE: return "Processing Complete";
+            case ERROR: return "Error";
+            case PARTIAL: return "Partial Processing";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RemittanceOutcomeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RemittanceOutcomeEnumFactory.java
new file mode 100644
index 00000000000..bd9fa856e5f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RemittanceOutcomeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RemittanceOutcomeEnumFactory implements EnumFactory {
+
+  public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("complete".equals(codeString))
+      return RemittanceOutcome.COMPLETE;
+    if ("error".equals(codeString))
+      return RemittanceOutcome.ERROR;
+    if ("partial".equals(codeString))
+      return RemittanceOutcome.PARTIAL;
+    throw new IllegalArgumentException("Unknown RemittanceOutcome code '"+codeString+"'");
+  }
+
+  public String toCode(RemittanceOutcome code) {
+    if (code == RemittanceOutcome.COMPLETE)
+      return "complete";
+    if (code == RemittanceOutcome.ERROR)
+      return "error";
+    if (code == RemittanceOutcome.PARTIAL)
+      return "partial";
+    return "?";
+  }
+
+    public String toSystem(RemittanceOutcome code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportActionResultCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportActionResultCodes.java
new file mode 100644
index 00000000000..357304ef62f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportActionResultCodes.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReportActionResultCodes {
+
+        /**
+         * The action was successful.
+         */
+        PASS, 
+        /**
+         * The action was skipped.
+         */
+        SKIP, 
+        /**
+         * The action failed.
+         */
+        FAIL, 
+        /**
+         * The action passed but with warnings.
+         */
+        WARNING, 
+        /**
+         * The action encountered a fatal error and the engine was unable to process.
+         */
+        ERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReportActionResultCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("pass".equals(codeString))
+          return PASS;
+        if ("skip".equals(codeString))
+          return SKIP;
+        if ("fail".equals(codeString))
+          return FAIL;
+        if ("warning".equals(codeString))
+          return WARNING;
+        if ("error".equals(codeString))
+          return ERROR;
+        throw new FHIRException("Unknown ReportActionResultCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PASS: return "pass";
+            case SKIP: return "skip";
+            case FAIL: return "fail";
+            case WARNING: return "warning";
+            case ERROR: return "error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/report-action-result-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PASS: return "The action was successful.";
+            case SKIP: return "The action was skipped.";
+            case FAIL: return "The action failed.";
+            case WARNING: return "The action passed but with warnings.";
+            case ERROR: return "The action encountered a fatal error and the engine was unable to process.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PASS: return "Pass";
+            case SKIP: return "Skip";
+            case FAIL: return "Fail";
+            case WARNING: return "Warning";
+            case ERROR: return "Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportActionResultCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportActionResultCodesEnumFactory.java
new file mode 100644
index 00000000000..21fbca078b6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportActionResultCodesEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReportActionResultCodesEnumFactory implements EnumFactory {
+
+  public ReportActionResultCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("pass".equals(codeString))
+      return ReportActionResultCodes.PASS;
+    if ("skip".equals(codeString))
+      return ReportActionResultCodes.SKIP;
+    if ("fail".equals(codeString))
+      return ReportActionResultCodes.FAIL;
+    if ("warning".equals(codeString))
+      return ReportActionResultCodes.WARNING;
+    if ("error".equals(codeString))
+      return ReportActionResultCodes.ERROR;
+    throw new IllegalArgumentException("Unknown ReportActionResultCodes code '"+codeString+"'");
+  }
+
+  public String toCode(ReportActionResultCodes code) {
+    if (code == ReportActionResultCodes.PASS)
+      return "pass";
+    if (code == ReportActionResultCodes.SKIP)
+      return "skip";
+    if (code == ReportActionResultCodes.FAIL)
+      return "fail";
+    if (code == ReportActionResultCodes.WARNING)
+      return "warning";
+    if (code == ReportActionResultCodes.ERROR)
+      return "error";
+    return "?";
+  }
+
+    public String toSystem(ReportActionResultCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportParticipantType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportParticipantType.java
new file mode 100644
index 00000000000..ff12c1bc8bb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportParticipantType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReportParticipantType {
+
+        /**
+         * The test execution engine.
+         */
+        TESTENGINE, 
+        /**
+         * A FHIR Client
+         */
+        CLIENT, 
+        /**
+         * A FHIR Server
+         */
+        SERVER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReportParticipantType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("test-engine".equals(codeString))
+          return TESTENGINE;
+        if ("client".equals(codeString))
+          return CLIENT;
+        if ("server".equals(codeString))
+          return SERVER;
+        throw new FHIRException("Unknown ReportParticipantType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case TESTENGINE: return "test-engine";
+            case CLIENT: return "client";
+            case SERVER: return "server";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/report-participant-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case TESTENGINE: return "The test execution engine.";
+            case CLIENT: return "A FHIR Client";
+            case SERVER: return "A FHIR Server";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case TESTENGINE: return "Test Engine";
+            case CLIENT: return "Client";
+            case SERVER: return "Server";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportParticipantTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportParticipantTypeEnumFactory.java
new file mode 100644
index 00000000000..4204350e461
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportParticipantTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReportParticipantTypeEnumFactory implements EnumFactory {
+
+  public ReportParticipantType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("test-engine".equals(codeString))
+      return ReportParticipantType.TESTENGINE;
+    if ("client".equals(codeString))
+      return ReportParticipantType.CLIENT;
+    if ("server".equals(codeString))
+      return ReportParticipantType.SERVER;
+    throw new IllegalArgumentException("Unknown ReportParticipantType code '"+codeString+"'");
+  }
+
+  public String toCode(ReportParticipantType code) {
+    if (code == ReportParticipantType.TESTENGINE)
+      return "test-engine";
+    if (code == ReportParticipantType.CLIENT)
+      return "client";
+    if (code == ReportParticipantType.SERVER)
+      return "server";
+    return "?";
+  }
+
+    public String toSystem(ReportParticipantType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportResultCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportResultCodes.java
new file mode 100644
index 00000000000..98e5b8cd9b6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportResultCodes.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReportResultCodes {
+
+        /**
+         * All test operations successfully passed all asserts
+         */
+        PASS, 
+        /**
+         * One or more test operations failed one or more asserts
+         */
+        FAIL, 
+        /**
+         * One or more test operations is pending execution completion
+         */
+        PENDING, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReportResultCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("pass".equals(codeString))
+          return PASS;
+        if ("fail".equals(codeString))
+          return FAIL;
+        if ("pending".equals(codeString))
+          return PENDING;
+        throw new FHIRException("Unknown ReportResultCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PASS: return "pass";
+            case FAIL: return "fail";
+            case PENDING: return "pending";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/report-result-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PASS: return "All test operations successfully passed all asserts";
+            case FAIL: return "One or more test operations failed one or more asserts";
+            case PENDING: return "One or more test operations is pending execution completion";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PASS: return "Pass";
+            case FAIL: return "Fail";
+            case PENDING: return "Pending";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportResultCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportResultCodesEnumFactory.java
new file mode 100644
index 00000000000..d57a5d67b1a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportResultCodesEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReportResultCodesEnumFactory implements EnumFactory {
+
+  public ReportResultCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("pass".equals(codeString))
+      return ReportResultCodes.PASS;
+    if ("fail".equals(codeString))
+      return ReportResultCodes.FAIL;
+    if ("pending".equals(codeString))
+      return ReportResultCodes.PENDING;
+    throw new IllegalArgumentException("Unknown ReportResultCodes code '"+codeString+"'");
+  }
+
+  public String toCode(ReportResultCodes code) {
+    if (code == ReportResultCodes.PASS)
+      return "pass";
+    if (code == ReportResultCodes.FAIL)
+      return "fail";
+    if (code == ReportResultCodes.PENDING)
+      return "pending";
+    return "?";
+  }
+
+    public String toSystem(ReportResultCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportStatusCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportStatusCodes.java
new file mode 100644
index 00000000000..ad9467f1a48
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportStatusCodes.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ReportStatusCodes {
+
+        /**
+         * All test operations have completed
+         */
+        COMPLETED, 
+        /**
+         * A test operations is currently executing
+         */
+        INPROGRESS, 
+        /**
+         * A test operation is waiting for an external client request
+         */
+        WAITING, 
+        /**
+         * The test script execution was manually stopped
+         */
+        STOPPED, 
+        /**
+         * This test report was entered or created in error
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ReportStatusCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("waiting".equals(codeString))
+          return WAITING;
+        if ("stopped".equals(codeString))
+          return STOPPED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ReportStatusCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COMPLETED: return "completed";
+            case INPROGRESS: return "in-progress";
+            case WAITING: return "waiting";
+            case STOPPED: return "stopped";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/report-status-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COMPLETED: return "All test operations have completed";
+            case INPROGRESS: return "A test operations is currently executing";
+            case WAITING: return "A test operation is waiting for an external client request";
+            case STOPPED: return "The test script execution was manually stopped";
+            case ENTEREDINERROR: return "This test report was entered or created in error";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COMPLETED: return "Completed";
+            case INPROGRESS: return "In Progress";
+            case WAITING: return "Waiting";
+            case STOPPED: return "Stopped";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportStatusCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportStatusCodesEnumFactory.java
new file mode 100644
index 00000000000..ca12d2a6dd9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ReportStatusCodesEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ReportStatusCodesEnumFactory implements EnumFactory {
+
+  public ReportStatusCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("completed".equals(codeString))
+      return ReportStatusCodes.COMPLETED;
+    if ("in-progress".equals(codeString))
+      return ReportStatusCodes.INPROGRESS;
+    if ("waiting".equals(codeString))
+      return ReportStatusCodes.WAITING;
+    if ("stopped".equals(codeString))
+      return ReportStatusCodes.STOPPED;
+    if ("entered-in-error".equals(codeString))
+      return ReportStatusCodes.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ReportStatusCodes code '"+codeString+"'");
+  }
+
+  public String toCode(ReportStatusCodes code) {
+    if (code == ReportStatusCodes.COMPLETED)
+      return "completed";
+    if (code == ReportStatusCodes.INPROGRESS)
+      return "in-progress";
+    if (code == ReportStatusCodes.WAITING)
+      return "waiting";
+    if (code == ReportStatusCodes.STOPPED)
+      return "stopped";
+    if (code == ReportStatusCodes.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ReportStatusCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RepositoryType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RepositoryType.java
new file mode 100644
index 00000000000..b12606b3be9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RepositoryType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RepositoryType {
+
+        /**
+         * When URL is clicked, the resource can be seen directly (by webpage or by download link format)
+         */
+        DIRECTLINK, 
+        /**
+         * When the API method (e.g. [base_url]/[parameter]) related with the URL of the website is executed, the resource can be seen directly (usually in JSON or XML format)
+         */
+        OPENAPI, 
+        /**
+         * When logged into the website, the resource can be seen.
+         */
+        LOGIN, 
+        /**
+         * When logged in and  follow the API in the website related with URL, the resource can be seen.
+         */
+        OAUTH, 
+        /**
+         * Some other complicated or particular way to get resource from URL.
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RepositoryType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("directlink".equals(codeString))
+          return DIRECTLINK;
+        if ("openapi".equals(codeString))
+          return OPENAPI;
+        if ("login".equals(codeString))
+          return LOGIN;
+        if ("oauth".equals(codeString))
+          return OAUTH;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown RepositoryType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DIRECTLINK: return "directlink";
+            case OPENAPI: return "openapi";
+            case LOGIN: return "login";
+            case OAUTH: return "oauth";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/repository-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DIRECTLINK: return "When URL is clicked, the resource can be seen directly (by webpage or by download link format)";
+            case OPENAPI: return "When the API method (e.g. [base_url]/[parameter]) related with the URL of the website is executed, the resource can be seen directly (usually in JSON or XML format)";
+            case LOGIN: return "When logged into the website, the resource can be seen.";
+            case OAUTH: return "When logged in and  follow the API in the website related with URL, the resource can be seen.";
+            case OTHER: return "Some other complicated or particular way to get resource from URL.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DIRECTLINK: return "Click and see";
+            case OPENAPI: return "The URL is the RESTful or other kind of API that can access to the result.";
+            case LOGIN: return "Result cannot be access unless an account is logged in";
+            case OAUTH: return "Result need to be fetched with API and need LOGIN( or cookies are required when visiting the link of resource)";
+            case OTHER: return "Some other complicated or particular way to get resource from URL.";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RepositoryTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RepositoryTypeEnumFactory.java
new file mode 100644
index 00000000000..be1b2538026
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RepositoryTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RepositoryTypeEnumFactory implements EnumFactory {
+
+  public RepositoryType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("directlink".equals(codeString))
+      return RepositoryType.DIRECTLINK;
+    if ("openapi".equals(codeString))
+      return RepositoryType.OPENAPI;
+    if ("login".equals(codeString))
+      return RepositoryType.LOGIN;
+    if ("oauth".equals(codeString))
+      return RepositoryType.OAUTH;
+    if ("other".equals(codeString))
+      return RepositoryType.OTHER;
+    throw new IllegalArgumentException("Unknown RepositoryType code '"+codeString+"'");
+  }
+
+  public String toCode(RepositoryType code) {
+    if (code == RepositoryType.DIRECTLINK)
+      return "directlink";
+    if (code == RepositoryType.OPENAPI)
+      return "openapi";
+    if (code == RepositoryType.LOGIN)
+      return "login";
+    if (code == RepositoryType.OAUTH)
+      return "oauth";
+    if (code == RepositoryType.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(RepositoryType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestIntent.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestIntent.java
new file mode 100644
index 00000000000..4dc14087c3f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestIntent.java
@@ -0,0 +1,143 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RequestIntent {
+
+        /**
+         * The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act
+         */
+        PROPOSAL, 
+        /**
+         * The request represents an intension to ensure something occurs without providing an authorization for others to act
+         */
+        PLAN, 
+        /**
+         * The request represents a request/demand and authorization for action
+         */
+        ORDER, 
+        /**
+         * The request represents an original authorization for action
+         */
+        ORIGINALORDER, 
+        /**
+         * The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization
+         */
+        REFLEXORDER, 
+        /**
+         * The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order
+         */
+        FILLERORDER, 
+        /**
+         * An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.
+         */
+        INSTANCEORDER, 
+        /**
+         * The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.
+
+Refer to [[[RequestGroup]]] for additional information on how this status is used
+         */
+        OPTION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RequestIntent fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposal".equals(codeString))
+          return PROPOSAL;
+        if ("plan".equals(codeString))
+          return PLAN;
+        if ("order".equals(codeString))
+          return ORDER;
+        if ("original-order".equals(codeString))
+          return ORIGINALORDER;
+        if ("reflex-order".equals(codeString))
+          return REFLEXORDER;
+        if ("filler-order".equals(codeString))
+          return FILLERORDER;
+        if ("instance-order".equals(codeString))
+          return INSTANCEORDER;
+        if ("option".equals(codeString))
+          return OPTION;
+        throw new FHIRException("Unknown RequestIntent code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSAL: return "proposal";
+            case PLAN: return "plan";
+            case ORDER: return "order";
+            case ORIGINALORDER: return "original-order";
+            case REFLEXORDER: return "reflex-order";
+            case FILLERORDER: return "filler-order";
+            case INSTANCEORDER: return "instance-order";
+            case OPTION: return "option";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/request-intent";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSAL: return "The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act";
+            case PLAN: return "The request represents an intension to ensure something occurs without providing an authorization for others to act";
+            case ORDER: return "The request represents a request/demand and authorization for action";
+            case ORIGINALORDER: return "The request represents an original authorization for action";
+            case REFLEXORDER: return "The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization";
+            case FILLERORDER: return "The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order";
+            case INSTANCEORDER: return "An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.";
+            case OPTION: return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.\n\nRefer to [[[RequestGroup]]] for additional information on how this status is used";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSAL: return "Proposal";
+            case PLAN: return "Plan";
+            case ORDER: return "Order";
+            case ORIGINALORDER: return "Original Order";
+            case REFLEXORDER: return "Reflex Order";
+            case FILLERORDER: return "Filler Order";
+            case INSTANCEORDER: return "Instance Order";
+            case OPTION: return "Option";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestIntentEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestIntentEnumFactory.java
new file mode 100644
index 00000000000..39e5d4ddcdb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestIntentEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RequestIntentEnumFactory implements EnumFactory {
+
+  public RequestIntent fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposal".equals(codeString))
+      return RequestIntent.PROPOSAL;
+    if ("plan".equals(codeString))
+      return RequestIntent.PLAN;
+    if ("order".equals(codeString))
+      return RequestIntent.ORDER;
+    if ("original-order".equals(codeString))
+      return RequestIntent.ORIGINALORDER;
+    if ("reflex-order".equals(codeString))
+      return RequestIntent.REFLEXORDER;
+    if ("filler-order".equals(codeString))
+      return RequestIntent.FILLERORDER;
+    if ("instance-order".equals(codeString))
+      return RequestIntent.INSTANCEORDER;
+    if ("option".equals(codeString))
+      return RequestIntent.OPTION;
+    throw new IllegalArgumentException("Unknown RequestIntent code '"+codeString+"'");
+  }
+
+  public String toCode(RequestIntent code) {
+    if (code == RequestIntent.PROPOSAL)
+      return "proposal";
+    if (code == RequestIntent.PLAN)
+      return "plan";
+    if (code == RequestIntent.ORDER)
+      return "order";
+    if (code == RequestIntent.ORIGINALORDER)
+      return "original-order";
+    if (code == RequestIntent.REFLEXORDER)
+      return "reflex-order";
+    if (code == RequestIntent.FILLERORDER)
+      return "filler-order";
+    if (code == RequestIntent.INSTANCEORDER)
+      return "instance-order";
+    if (code == RequestIntent.OPTION)
+      return "option";
+    return "?";
+  }
+
+    public String toSystem(RequestIntent code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestPriority.java
new file mode 100644
index 00000000000..660cefcb9ff
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestPriority.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RequestPriority {
+
+        /**
+         * The request has normal priority
+         */
+        ROUTINE, 
+        /**
+         * The request should be actioned promptly - higher priority than routine
+         */
+        URGENT, 
+        /**
+         * The request should be actioned as soon as possible - higher priority than urgent
+         */
+        ASAP, 
+        /**
+         * The request should be actioned immediately - highest possible priority.  E.g. an emergency
+         */
+        STAT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RequestPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("routine".equals(codeString))
+          return ROUTINE;
+        if ("urgent".equals(codeString))
+          return URGENT;
+        if ("asap".equals(codeString))
+          return ASAP;
+        if ("stat".equals(codeString))
+          return STAT;
+        throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ROUTINE: return "routine";
+            case URGENT: return "urgent";
+            case ASAP: return "asap";
+            case STAT: return "stat";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/request-priority";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ROUTINE: return "The request has normal priority";
+            case URGENT: return "The request should be actioned promptly - higher priority than routine";
+            case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent";
+            case STAT: return "The request should be actioned immediately - highest possible priority.  E.g. an emergency";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ROUTINE: return "Routine";
+            case URGENT: return "Urgent";
+            case ASAP: return "ASAP";
+            case STAT: return "STAT";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestPriorityEnumFactory.java
new file mode 100644
index 00000000000..12a44bf1670
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestPriorityEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RequestPriorityEnumFactory implements EnumFactory {
+
+  public RequestPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("routine".equals(codeString))
+      return RequestPriority.ROUTINE;
+    if ("urgent".equals(codeString))
+      return RequestPriority.URGENT;
+    if ("asap".equals(codeString))
+      return RequestPriority.ASAP;
+    if ("stat".equals(codeString))
+      return RequestPriority.STAT;
+    throw new IllegalArgumentException("Unknown RequestPriority code '"+codeString+"'");
+  }
+
+  public String toCode(RequestPriority code) {
+    if (code == RequestPriority.ROUTINE)
+      return "routine";
+    if (code == RequestPriority.URGENT)
+      return "urgent";
+    if (code == RequestPriority.ASAP)
+      return "asap";
+    if (code == RequestPriority.STAT)
+      return "stat";
+    return "?";
+  }
+
+    public String toSystem(RequestPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStage.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStage.java
new file mode 100644
index 00000000000..60e96ec311c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStage.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RequestStage {
+
+        /**
+         * The request is a proposal
+         */
+        PROPOSAL, 
+        /**
+         * The request is a plan
+         */
+        PLAN, 
+        /**
+         * The request is an order.
+         */
+        ORIGINALORDER, 
+        /**
+         * Represents an order created by a fulfiller as a representation of the specific action(s) they intend to take to fulfill the original order.  Typically these orders are more fully encoded than the original placer order.
+         */
+        ENCODED, 
+        /**
+         * Represents a separate order created by a fulfiller as result of fulfilment of an order.
+         */
+        REFLEXORDER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RequestStage fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposal".equals(codeString))
+          return PROPOSAL;
+        if ("plan".equals(codeString))
+          return PLAN;
+        if ("original-order".equals(codeString))
+          return ORIGINALORDER;
+        if ("encoded".equals(codeString))
+          return ENCODED;
+        if ("reflex-order".equals(codeString))
+          return REFLEXORDER;
+        throw new FHIRException("Unknown RequestStage code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSAL: return "proposal";
+            case PLAN: return "plan";
+            case ORIGINALORDER: return "original-order";
+            case ENCODED: return "encoded";
+            case REFLEXORDER: return "reflex-order";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/request-stage";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSAL: return "The request is a proposal";
+            case PLAN: return "The request is a plan";
+            case ORIGINALORDER: return "The request is an order.";
+            case ENCODED: return "Represents an order created by a fulfiller as a representation of the specific action(s) they intend to take to fulfill the original order.  Typically these orders are more fully encoded than the original placer order.";
+            case REFLEXORDER: return "Represents a separate order created by a fulfiller as result of fulfilment of an order.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSAL: return "Proposal";
+            case PLAN: return "Plan";
+            case ORIGINALORDER: return "Original Order";
+            case ENCODED: return "Encoded";
+            case REFLEXORDER: return "Reflex Order";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStageEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStageEnumFactory.java
new file mode 100644
index 00000000000..7aaac549989
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStageEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Mon, Jan 16, 2017 12:12-0500 for FHIR v1.9.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RequestStageEnumFactory implements EnumFactory {
+
+  public RequestStage fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposal".equals(codeString))
+      return RequestStage.PROPOSAL;
+    if ("plan".equals(codeString))
+      return RequestStage.PLAN;
+    if ("original-order".equals(codeString))
+      return RequestStage.ORIGINALORDER;
+    if ("encoded".equals(codeString))
+      return RequestStage.ENCODED;
+    if ("reflex-order".equals(codeString))
+      return RequestStage.REFLEXORDER;
+    throw new IllegalArgumentException("Unknown RequestStage code '"+codeString+"'");
+  }
+
+  public String toCode(RequestStage code) {
+    if (code == RequestStage.PROPOSAL)
+      return "proposal";
+    if (code == RequestStage.PLAN)
+      return "plan";
+    if (code == RequestStage.ORIGINALORDER)
+      return "original-order";
+    if (code == RequestStage.ENCODED)
+      return "encoded";
+    if (code == RequestStage.REFLEXORDER)
+      return "reflex-order";
+    return "?";
+  }
+
+    public String toSystem(RequestStage code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStatus.java
new file mode 100644
index 00000000000..01111ef1207
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RequestStatus {
+
+        /**
+         * The request has been created but is not yet complete or ready for action
+         */
+        DRAFT, 
+        /**
+         * The request is ready to be acted upon
+         */
+        ACTIVE, 
+        /**
+         * The authorization/request to act has been temporarily withdrawn but is expected to resume in the future
+         */
+        SUSPENDED, 
+        /**
+         * The authorization/request to act has been terminated prior to the full completion of the intended actions.  No further activity should occur.
+         */
+        CANCELLED, 
+        /**
+         * Activity against the request has been sufficiently completed to the satisfaction of the requester
+         */
+        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,  but the system creating the request doesn't know.
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown RequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case ACTIVE: return "active";
+            case SUSPENDED: return "suspended";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/request-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "The request has been created but is not yet complete or ready for action";
+            case ACTIVE: return "The request is ready to be acted upon";
+            case SUSPENDED: return "The authorization/request to act has been temporarily withdrawn but is expected to resume in the future";
+            case CANCELLED: return "The authorization/request to act has been terminated prior to the full completion of the intended actions.  No further activity should occur.";
+            case COMPLETED: return "Activity against the request has been sufficiently completed to the satisfaction of the requester";
+            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,  but the system creating the request doesn't know.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DRAFT: return "Draft";
+            case ACTIVE: return "Active";
+            case SUSPENDED: return "Suspended";
+            case CANCELLED: return "Cancelled";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStatusEnumFactory.java
new file mode 100644
index 00000000000..3bda29b95dd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RequestStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RequestStatusEnumFactory implements EnumFactory {
+
+  public RequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return RequestStatus.DRAFT;
+    if ("active".equals(codeString))
+      return RequestStatus.ACTIVE;
+    if ("suspended".equals(codeString))
+      return RequestStatus.SUSPENDED;
+    if ("cancelled".equals(codeString))
+      return RequestStatus.CANCELLED;
+    if ("completed".equals(codeString))
+      return RequestStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return RequestStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return RequestStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown RequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(RequestStatus code) {
+    if (code == RequestStatus.DRAFT)
+      return "draft";
+    if (code == RequestStatus.ACTIVE)
+      return "active";
+    if (code == RequestStatus.SUSPENDED)
+      return "suspended";
+    if (code == RequestStatus.CANCELLED)
+      return "cancelled";
+    if (code == RequestStatus.COMPLETED)
+      return "completed";
+    if (code == RequestStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == RequestStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(RequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchStudyStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchStudyStatus.java
new file mode 100644
index 00000000000..16b59e2e7ae
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchStudyStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ResearchStudyStatus {
+
+        /**
+         * The study is undergoing design but the process of selecting study subjects and capturing data has not yet begun.
+         */
+        DRAFT, 
+        /**
+         * The study is currently being executed
+         */
+        INPROGRESS, 
+        /**
+         * Execution of the study has been temporarily paused
+         */
+        SUSPENDED, 
+        /**
+         * The study was terminated prior to the final determination of results
+         */
+        STOPPED, 
+        /**
+         * The information sought by the study has been gathered and compiled and no further work is being performed
+         */
+        COMPLETED, 
+        /**
+         * This study never actually existed.  The record is retained for tracking purposes in the event decisions may have been made based on this erroneous information.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ResearchStudyStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("stopped".equals(codeString))
+          return STOPPED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown ResearchStudyStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case INPROGRESS: return "in-progress";
+            case SUSPENDED: return "suspended";
+            case STOPPED: return "stopped";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/research-study-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "The study is undergoing design but the process of selecting study subjects and capturing data has not yet begun.";
+            case INPROGRESS: return "The study is currently being executed";
+            case SUSPENDED: return "Execution of the study has been temporarily paused";
+            case STOPPED: return "The study was terminated prior to the final determination of results";
+            case COMPLETED: return "The information sought by the study has been gathered and compiled and no further work is being performed";
+            case ENTEREDINERROR: return "This study never actually existed.  The record is retained for tracking purposes in the event decisions may have been made based on this erroneous information.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DRAFT: return "Draft";
+            case INPROGRESS: return "In-progress";
+            case SUSPENDED: return "Suspended";
+            case STOPPED: return "Stopped";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchStudyStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchStudyStatusEnumFactory.java
new file mode 100644
index 00000000000..19f9b2a34f2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchStudyStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ResearchStudyStatusEnumFactory implements EnumFactory {
+
+  public ResearchStudyStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return ResearchStudyStatus.DRAFT;
+    if ("in-progress".equals(codeString))
+      return ResearchStudyStatus.INPROGRESS;
+    if ("suspended".equals(codeString))
+      return ResearchStudyStatus.SUSPENDED;
+    if ("stopped".equals(codeString))
+      return ResearchStudyStatus.STOPPED;
+    if ("completed".equals(codeString))
+      return ResearchStudyStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return ResearchStudyStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown ResearchStudyStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ResearchStudyStatus code) {
+    if (code == ResearchStudyStatus.DRAFT)
+      return "draft";
+    if (code == ResearchStudyStatus.INPROGRESS)
+      return "in-progress";
+    if (code == ResearchStudyStatus.SUSPENDED)
+      return "suspended";
+    if (code == ResearchStudyStatus.STOPPED)
+      return "stopped";
+    if (code == ResearchStudyStatus.COMPLETED)
+      return "completed";
+    if (code == ResearchStudyStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(ResearchStudyStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchSubjectStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchSubjectStatus.java
new file mode 100644
index 00000000000..0fbd9b0148c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchSubjectStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ResearchSubjectStatus {
+
+        /**
+         * The subject has been identified as a potential participant in the study but has not yet agreed to participate
+         */
+        CANDIDATE, 
+        /**
+         * The subject has agreed to participate in the study but has not yet begun performing any action within the study
+         */
+        ENROLLED, 
+        /**
+         * The subject is currently being monitored and/or subject to treatment as part of the study
+         */
+        ACTIVE, 
+        /**
+         * The subject has temporarily discontinued monitoring/treatment as part of the study
+         */
+        SUSPENDED, 
+        /**
+         * The subject has permanently ended participation in the study prior to completion of the intended monitoring/treatment
+         */
+        WITHDRAWN, 
+        /**
+         * All intended monitoring/treatment of the subject has been completed and their engagement with the study is now ended
+         */
+        COMPLETED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ResearchSubjectStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("candidate".equals(codeString))
+          return CANDIDATE;
+        if ("enrolled".equals(codeString))
+          return ENROLLED;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("withdrawn".equals(codeString))
+          return WITHDRAWN;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        throw new FHIRException("Unknown ResearchSubjectStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CANDIDATE: return "candidate";
+            case ENROLLED: return "enrolled";
+            case ACTIVE: return "active";
+            case SUSPENDED: return "suspended";
+            case WITHDRAWN: return "withdrawn";
+            case COMPLETED: return "completed";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/research-subject-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CANDIDATE: return "The subject has been identified as a potential participant in the study but has not yet agreed to participate";
+            case ENROLLED: return "The subject has agreed to participate in the study but has not yet begun performing any action within the study";
+            case ACTIVE: return "The subject is currently being monitored and/or subject to treatment as part of the study";
+            case SUSPENDED: return "The subject has temporarily discontinued monitoring/treatment as part of the study";
+            case WITHDRAWN: return "The subject has permanently ended participation in the study prior to completion of the intended monitoring/treatment";
+            case COMPLETED: return "All intended monitoring/treatment of the subject has been completed and their engagement with the study is now ended";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CANDIDATE: return "Candidate";
+            case ENROLLED: return "Enrolled";
+            case ACTIVE: return "Active";
+            case SUSPENDED: return "Suspended";
+            case WITHDRAWN: return "Withdrawn";
+            case COMPLETED: return "Completed";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchSubjectStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchSubjectStatusEnumFactory.java
new file mode 100644
index 00000000000..2630713b9be
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResearchSubjectStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ResearchSubjectStatusEnumFactory implements EnumFactory {
+
+  public ResearchSubjectStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("candidate".equals(codeString))
+      return ResearchSubjectStatus.CANDIDATE;
+    if ("enrolled".equals(codeString))
+      return ResearchSubjectStatus.ENROLLED;
+    if ("active".equals(codeString))
+      return ResearchSubjectStatus.ACTIVE;
+    if ("suspended".equals(codeString))
+      return ResearchSubjectStatus.SUSPENDED;
+    if ("withdrawn".equals(codeString))
+      return ResearchSubjectStatus.WITHDRAWN;
+    if ("completed".equals(codeString))
+      return ResearchSubjectStatus.COMPLETED;
+    throw new IllegalArgumentException("Unknown ResearchSubjectStatus code '"+codeString+"'");
+  }
+
+  public String toCode(ResearchSubjectStatus code) {
+    if (code == ResearchSubjectStatus.CANDIDATE)
+      return "candidate";
+    if (code == ResearchSubjectStatus.ENROLLED)
+      return "enrolled";
+    if (code == ResearchSubjectStatus.ACTIVE)
+      return "active";
+    if (code == ResearchSubjectStatus.SUSPENDED)
+      return "suspended";
+    if (code == ResearchSubjectStatus.WITHDRAWN)
+      return "withdrawn";
+    if (code == ResearchSubjectStatus.COMPLETED)
+      return "completed";
+    return "?";
+  }
+
+    public String toSystem(ResearchSubjectStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceAggregationMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceAggregationMode.java
new file mode 100644
index 00000000000..c85cf1f6b63
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceAggregationMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ResourceAggregationMode {
+
+        /**
+         * The reference is a local reference to a contained resource.
+         */
+        CONTAINED, 
+        /**
+         * The reference to a resource that has to be resolved externally to the resource that includes the reference.
+         */
+        REFERENCED, 
+        /**
+         * The resource the reference points to will be found in the same bundle as the resource that includes the reference.
+         */
+        BUNDLED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ResourceAggregationMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("contained".equals(codeString))
+          return CONTAINED;
+        if ("referenced".equals(codeString))
+          return REFERENCED;
+        if ("bundled".equals(codeString))
+          return BUNDLED;
+        throw new FHIRException("Unknown ResourceAggregationMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CONTAINED: return "contained";
+            case REFERENCED: return "referenced";
+            case BUNDLED: return "bundled";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/resource-aggregation-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CONTAINED: return "The reference is a local reference to a contained resource.";
+            case REFERENCED: return "The reference to a resource that has to be resolved externally to the resource that includes the reference.";
+            case BUNDLED: return "The resource the reference points to will be found in the same bundle as the resource that includes the reference.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CONTAINED: return "Contained";
+            case REFERENCED: return "Referenced";
+            case BUNDLED: return "Bundled";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceAggregationModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceAggregationModeEnumFactory.java
new file mode 100644
index 00000000000..ac7e7e13a85
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceAggregationModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ResourceAggregationModeEnumFactory implements EnumFactory {
+
+  public ResourceAggregationMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("contained".equals(codeString))
+      return ResourceAggregationMode.CONTAINED;
+    if ("referenced".equals(codeString))
+      return ResourceAggregationMode.REFERENCED;
+    if ("bundled".equals(codeString))
+      return ResourceAggregationMode.BUNDLED;
+    throw new IllegalArgumentException("Unknown ResourceAggregationMode code '"+codeString+"'");
+  }
+
+  public String toCode(ResourceAggregationMode code) {
+    if (code == ResourceAggregationMode.CONTAINED)
+      return "contained";
+    if (code == ResourceAggregationMode.REFERENCED)
+      return "referenced";
+    if (code == ResourceAggregationMode.BUNDLED)
+      return "bundled";
+    return "?";
+  }
+
+    public String toSystem(ResourceAggregationMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceSlicingRules.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceSlicingRules.java
new file mode 100644
index 00000000000..38669d957e4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceSlicingRules.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ResourceSlicingRules {
+
+        /**
+         * No additional content is allowed other than that described by the slices in this profile.
+         */
+        CLOSED, 
+        /**
+         * Additional content is allowed anywhere in the list.
+         */
+        OPEN, 
+        /**
+         * Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be ordered, which makes it hard to share uses. This should only be done where absolutely required.
+         */
+        OPENATEND, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ResourceSlicingRules fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("closed".equals(codeString))
+          return CLOSED;
+        if ("open".equals(codeString))
+          return OPEN;
+        if ("openAtEnd".equals(codeString))
+          return OPENATEND;
+        throw new FHIRException("Unknown ResourceSlicingRules code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CLOSED: return "closed";
+            case OPEN: return "open";
+            case OPENATEND: return "openAtEnd";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/resource-slicing-rules";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CLOSED: return "No additional content is allowed other than that described by the slices in this profile.";
+            case OPEN: return "Additional content is allowed anywhere in the list.";
+            case OPENATEND: return "Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be ordered, which makes it hard to share uses. This should only be done where absolutely required.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CLOSED: return "Closed";
+            case OPEN: return "Open";
+            case OPENATEND: return "Open at End";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceSlicingRulesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceSlicingRulesEnumFactory.java
new file mode 100644
index 00000000000..65c4305d389
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceSlicingRulesEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ResourceSlicingRulesEnumFactory implements EnumFactory {
+
+  public ResourceSlicingRules fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("closed".equals(codeString))
+      return ResourceSlicingRules.CLOSED;
+    if ("open".equals(codeString))
+      return ResourceSlicingRules.OPEN;
+    if ("openAtEnd".equals(codeString))
+      return ResourceSlicingRules.OPENATEND;
+    throw new IllegalArgumentException("Unknown ResourceSlicingRules code '"+codeString+"'");
+  }
+
+  public String toCode(ResourceSlicingRules code) {
+    if (code == ResourceSlicingRules.CLOSED)
+      return "closed";
+    if (code == ResourceSlicingRules.OPEN)
+      return "open";
+    if (code == ResourceSlicingRules.OPENATEND)
+      return "openAtEnd";
+    return "?";
+  }
+
+    public String toSystem(ResourceSlicingRules code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypeLink.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypeLink.java
new file mode 100644
index 00000000000..b139073d557
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypeLink.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ResourceTypeLink {
+
+        /**
+         * Organization resource
+         */
+        ORGANIZATION, 
+        /**
+         * Patient resource
+         */
+        PATIENT, 
+        /**
+         * Practitioner resource
+         */
+        PRACTITIONER, 
+        /**
+         * RelatedPerson resource
+         */
+        RELATEDPERSON, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ResourceTypeLink fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("organization".equals(codeString))
+          return ORGANIZATION;
+        if ("patient".equals(codeString))
+          return PATIENT;
+        if ("practitioner".equals(codeString))
+          return PRACTITIONER;
+        if ("relatedperson".equals(codeString))
+          return RELATEDPERSON;
+        throw new FHIRException("Unknown ResourceTypeLink code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ORGANIZATION: return "organization";
+            case PATIENT: return "patient";
+            case PRACTITIONER: return "practitioner";
+            case RELATEDPERSON: return "relatedperson";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/resource-type-link";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ORGANIZATION: return "Organization resource";
+            case PATIENT: return "Patient resource";
+            case PRACTITIONER: return "Practitioner resource";
+            case RELATEDPERSON: return "RelatedPerson resource";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ORGANIZATION: return "Organization";
+            case PATIENT: return "Patient";
+            case PRACTITIONER: return "Practitioner";
+            case RELATEDPERSON: return "RelatedPerson";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypeLinkEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypeLinkEnumFactory.java
new file mode 100644
index 00000000000..21f9ee94fb5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypeLinkEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ResourceTypeLinkEnumFactory implements EnumFactory {
+
+  public ResourceTypeLink fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("organization".equals(codeString))
+      return ResourceTypeLink.ORGANIZATION;
+    if ("patient".equals(codeString))
+      return ResourceTypeLink.PATIENT;
+    if ("practitioner".equals(codeString))
+      return ResourceTypeLink.PRACTITIONER;
+    if ("relatedperson".equals(codeString))
+      return ResourceTypeLink.RELATEDPERSON;
+    throw new IllegalArgumentException("Unknown ResourceTypeLink code '"+codeString+"'");
+  }
+
+  public String toCode(ResourceTypeLink code) {
+    if (code == ResourceTypeLink.ORGANIZATION)
+      return "organization";
+    if (code == ResourceTypeLink.PATIENT)
+      return "patient";
+    if (code == ResourceTypeLink.PRACTITIONER)
+      return "practitioner";
+    if (code == ResourceTypeLink.RELATEDPERSON)
+      return "relatedperson";
+    return "?";
+  }
+
+    public String toSystem(ResourceTypeLink code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypes.java
new file mode 100644
index 00000000000..127bd566648
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypes.java
@@ -0,0 +1,1140 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ResourceTypes {
+
+        /**
+         * A financial tool for tracking value accrued for a particular purpose.  In the healthcare field, used to track charges for a patient, cost centers, etc.
+         */
+        ACCOUNT, 
+        /**
+         * This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.
+         */
+        ACTIVITYDEFINITION, 
+        /**
+         * Actual or  potential/avoided event causing unintended physical injury resulting from or contributed to by medical care, a research study or other healthcare setting factors that requires additional monitoring, treatment, or hospitalization, or that results in death.
+         */
+        ADVERSEEVENT, 
+        /**
+         * Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.
+         */
+        ALLERGYINTOLERANCE, 
+        /**
+         * A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s).
+         */
+        APPOINTMENT, 
+        /**
+         * A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection.
+         */
+        APPOINTMENTRESPONSE, 
+        /**
+         * A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.
+         */
+        AUDITEVENT, 
+        /**
+         * 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.
+         */
+        BASIC, 
+        /**
+         * A binary resource can contain any content, whether text, image, pdf, zip archive, etc.
+         */
+        BINARY, 
+        /**
+         * Record details about the anatomical location of a specimen or body part.  This resource may be used when a coded concept does not provide the necessary detail needed for the use case.
+         */
+        BODYSITE, 
+        /**
+         * A container for a collection of resources.
+         */
+        BUNDLE, 
+        /**
+         * A Capability Statement documents a set of capabilities (behaviors) of a FHIR Server that may be used as a statement of actual server functionality or a statement of required or desired server implementation.
+         */
+        CAPABILITYSTATEMENT, 
+        /**
+         * Describes the intention of how one or more practitioners intend to deliver care for a particular patient, group or community for a period of time, possibly limited to care for a specific condition or set of conditions.
+         */
+        CAREPLAN, 
+        /**
+         * The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care for a patient.
+         */
+        CARETEAM, 
+        /**
+         * The resource ChargeItem describes the provision of healthcare provider products for a certain patient, therefore referring not only to the product, but containing in addition details of the provision, like date, time, amounts and participating organizations and persons. Main Usage of the ChargeItem is to enable the billing process and internal cost allocation.
+         */
+        CHARGEITEM, 
+        /**
+         * 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.
+         */
+        CLAIM, 
+        /**
+         * This resource provides the adjudication details from the processing of a Claim resource.
+         */
+        CLAIMRESPONSE, 
+        /**
+         * 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.
+         */
+        CLINICALIMPRESSION, 
+        /**
+         * A code system resource specifies a set of codes drawn from one or more code systems.
+         */
+        CODESYSTEM, 
+        /**
+         * 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.
+         */
+        COMMUNICATION, 
+        /**
+         * 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.
+         */
+        COMMUNICATIONREQUEST, 
+        /**
+         * A compartment definition that defines how resources are accessed on a server.
+         */
+        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.
+         */
+        COMPOSITION, 
+        /**
+         * 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.
+         */
+        CONCEPTMAP, 
+        /**
+         * A clinical condition, problem, diagnosis, or other event, situation, issue, or clinical concept that has risen to a level of concern.
+         */
+        CONDITION, 
+        /**
+         * A record of a healthcare consumer’s policy 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.
+         */
+        CONSENT, 
+        /**
+         * A formal agreement between parties regarding the conduct of business, exchange of information or other matters.
+         */
+        CONTRACT, 
+        /**
+         * Financial instrument which may be used to reimburse or pay for health care products and services.
+         */
+        COVERAGE, 
+        /**
+         * The formal description of a single piece of information that can be gathered and reported.
+         */
+        DATAELEMENT, 
+        /**
+         * Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, Ineffective treatment frequency, Procedure-condition conflict, etc.
+         */
+        DETECTEDISSUE, 
+        /**
+         * This resource identifies an instance or a type of a manufactured item that is used in the provision of healthcare without being substantially changed through that activity. The device may be a medical or non-medical device.  Medical devices include durable (reusable) medical equipment, implantable devices, as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.  Non-medical devices may include items such as a machine, cellphone, computer, application, etc.
+         */
+        DEVICE, 
+        /**
+         * The characteristics, operational status and capabilities of a medical-related component of a medical device.
+         */
+        DEVICECOMPONENT, 
+        /**
+         * Describes a measurement, calculation or setting capability of a medical device.
+         */
+        DEVICEMETRIC, 
+        /**
+         * Represents a request for a patient to employ a medical device. The device may be an implantable device, or an external assistive device, such as a walker.
+         */
+        DEVICEREQUEST, 
+        /**
+         * A record of a device being used by a patient where the record is the result of a report from the patient or another clinician.
+         */
+        DEVICEUSESTATEMENT, 
+        /**
+         * The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports.
+         */
+        DIAGNOSTICREPORT, 
+        /**
+         * A collection of documents compiled for a purpose together with metadata that applies to the collection.
+         */
+        DOCUMENTMANIFEST, 
+        /**
+         * A reference to a document.
+         */
+        DOCUMENTREFERENCE, 
+        /**
+         * A resource that includes narrative, extensions, and contained resources.
+         */
+        DOMAINRESOURCE, 
+        /**
+         * The EligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the form of an EligibilityResponse, with information regarding whether the stated coverage is valid and in-force and optionally to provide the insurance details of the policy.
+         */
+        ELIGIBILITYREQUEST, 
+        /**
+         * This resource provides eligibility and plan details from the processing of an Eligibility resource.
+         */
+        ELIGIBILITYRESPONSE, 
+        /**
+         * An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.
+         */
+        ENCOUNTER, 
+        /**
+         * The technical details of an endpoint that can be used for electronic services, such as for web services providing XDS.b or a REST endpoint for another FHIR server. This may include any security context information.
+         */
+        ENDPOINT, 
+        /**
+         * This resource provides the insurance enrollment details to the insurer regarding a specified coverage.
+         */
+        ENROLLMENTREQUEST, 
+        /**
+         * This resource provides enrollment and plan details from the processing of an Enrollment resource.
+         */
+        ENROLLMENTRESPONSE, 
+        /**
+         * An association between a patient and an organization / healthcare provider(s) during which time encounters may occur. The managing organization assumes a level of responsibility for the patient during this time.
+         */
+        EPISODEOFCARE, 
+        /**
+         * Resource to define constraints on the Expansion of a FHIR ValueSet.
+         */
+        EXPANSIONPROFILE, 
+        /**
+         * This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.
+         */
+        EXPLANATIONOFBENEFIT, 
+        /**
+         * Significant health events and conditions for a person related to the patient relevant in the context of care for the patient.
+         */
+        FAMILYMEMBERHISTORY, 
+        /**
+         * Prospective warnings of potential issues when providing care to the patient.
+         */
+        FLAG, 
+        /**
+         * Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.
+         */
+        GOAL, 
+        /**
+         * A formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph by following references. The Graph Definition resource defines a set and makes rules about the set.
+         */
+        GRAPHDEFINITION, 
+        /**
+         * Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized; i.e. a collection of entities that isn't an Organization.
+         */
+        GROUP, 
+        /**
+         * A guidance response is the formal response to a guidance request, including any output parameters returned by the evaluation, as well as the description of any proposed actions to be taken.
+         */
+        GUIDANCERESPONSE, 
+        /**
+         * The details of a healthcare service available at a location.
+         */
+        HEALTHCARESERVICE, 
+        /**
+         * A text description of the DICOM SOP instances selected in the ImagingManifest; or the reason for, or significance of, the selection.
+         */
+        IMAGINGMANIFEST, 
+        /**
+         * Representation of the content produced in a DICOM imaging study. A study comprises a set of series, each of which includes a set of Service-Object Pair Instances (SOP Instances - images or other data) acquired or produced in a common context.  A series is of only one modality (e.g. X-ray, CT, MR, ultrasound), but a study may have multiple series of different modalities.
+         */
+        IMAGINGSTUDY, 
+        /**
+         * Describes the event of a patient being administered a vaccination or a record of a vaccination as reported by a patient, a clinician or another party and may include vaccine reaction information and what vaccination protocol was followed.
+         */
+        IMMUNIZATION, 
+        /**
+         * A patient's point-in-time immunization and recommendation (i.e. forecasting a patient's immunization eligibility according to a published schedule) with optional supporting justification.
+         */
+        IMMUNIZATIONRECOMMENDATION, 
+        /**
+         * A set of rules of how FHIR is used to solve a particular problem. This resource is used to gather all the parts of an implementation guide into a logical whole and to publish a computable definition of all the parts.
+         */
+        IMPLEMENTATIONGUIDE, 
+        /**
+         * The Library resource is a general-purpose container for knowledge asset definitions. It can be used to describe and expose existing knowledge assets such as logic libraries and information model descriptions, as well as to describe a collection of knowledge assets.
+         */
+        LIBRARY, 
+        /**
+         * Identifies two or more records (resource instances) that are referring to the same real-world "occurrence".
+         */
+        LINKAGE, 
+        /**
+         * A set of information summarized from a list of other resources.
+         */
+        LIST, 
+        /**
+         * Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.
+         */
+        LOCATION, 
+        /**
+         * The Measure resource provides the definition of a quality measure.
+         */
+        MEASURE, 
+        /**
+         * The MeasureReport resource contains the results of evaluating a measure.
+         */
+        MEASUREREPORT, 
+        /**
+         * A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference.
+         */
+        MEDIA, 
+        /**
+         * This resource is primarily used for the identification and definition of a medication. It covers the ingredients and the packaging for a medication.
+         */
+        MEDICATION, 
+        /**
+         * Describes the event of a patient consuming or otherwise being administered a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.  Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.
+         */
+        MEDICATIONADMINISTRATION, 
+        /**
+         * Indicates that a medication product is to be or has been dispensed for a named person/patient.  This includes a description of the medication product (supply) provided and the instructions for administering the medication.  The medication dispense is the result of a pharmacy system responding to a medication order.
+         */
+        MEDICATIONDISPENSE, 
+        /**
+         * An order or request for both supply of the medication and the instructions for administration of the medication to a patient. The resource is called "MedicationRequest" rather than "MedicationPrescription" or "MedicationOrder" to generalize the use across inpatient and outpatient settings, including care plans, etc., and to harmonize with workflow patterns.
+         */
+        MEDICATIONREQUEST, 
+        /**
+         * A record of a medication that is being consumed by a patient.   A MedicationStatement may indicate that the patient may be taking the medication now, or has taken the medication in the past or will be taking the medication in the future.  The source of this information can be the patient, significant other (such as a family member or spouse), or a clinician.  A common scenario where this information is captured is during the history taking process during a patient visit or stay.   The medication information may come from sources such as the patient's memory, from a prescription bottle,  or from a list of medications the patient, clinician or other party maintains 

The primary difference between a medication statement and a medication administration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication.  A medication statement is often, if not always, less specific.  There is no required date/time when the medication was administered, in fact we only know that a source has reported the patient is taking this medication, where details such as time, quantity, or rate or even medication product may be incomplete or missing or less precise.  As stated earlier, the medication statement information may come from the patient's memory, from a prescription bottle or from a list of medications the patient, clinician or other party maintains.  Medication administration is more formal and is not missing detailed information.
+         */
+        MEDICATIONSTATEMENT, 
+        /**
+         * Defines the characteristics of a message that can be shared between systems, including the type of event that initiates the message, the content to be transmitted and what response(s), if any, are permitted.
+         */
+        MESSAGEDEFINITION, 
+        /**
+         * The header for a message exchange that is either requesting or responding to an action.  The reference(s) that are the subject of the action as well as other information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.
+         */
+        MESSAGEHEADER, 
+        /**
+         * A curated namespace that issues unique symbols within that namespace for the identification of concepts, people, devices, etc.  Represents a "System" used within the Identifier and Coding data types.
+         */
+        NAMINGSYSTEM, 
+        /**
+         * A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.
+         */
+        NUTRITIONORDER, 
+        /**
+         * Measurements and simple assertions made about a patient, device or other subject.
+         */
+        OBSERVATION, 
+        /**
+         * A formal computable definition of an operation (on the RESTful interface) or a named query (using the search interaction).
+         */
+        OPERATIONDEFINITION, 
+        /**
+         * A collection of error, warning or information messages that result from a system action.
+         */
+        OPERATIONOUTCOME, 
+        /**
+         * 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.
+         */
+        ORGANIZATION, 
+        /**
+         * This special resource type is used to represent an operation request and response (operations.html). It has no other use, and there is no RESTful endpoint associated with it.
+         */
+        PARAMETERS, 
+        /**
+         * Demographics and other administrative information about an individual or animal receiving care or other health-related services.
+         */
+        PATIENT, 
+        /**
+         * This resource provides the status of the payment for goods and services rendered, and the request and response resource references.
+         */
+        PAYMENTNOTICE, 
+        /**
+         * This resource provides payment details and claim references supporting a bulk payment.
+         */
+        PAYMENTRECONCILIATION, 
+        /**
+         * Demographics and administrative information about a person independent of a specific health-related context.
+         */
+        PERSON, 
+        /**
+         * This resource allows for the definition of various types of plans as a sharable, consumable, and executable artifact. The resource is general enough to support the description of a broad range of clinical artifacts such as clinical decision support rules, order sets and protocols.
+         */
+        PLANDEFINITION, 
+        /**
+         * A person who is directly or indirectly involved in the provisioning of healthcare.
+         */
+        PRACTITIONER, 
+        /**
+         * A specific set of Roles/Locations/specialties/services that a practitioner may perform at an organization for a period of time.
+         */
+        PRACTITIONERROLE, 
+        /**
+         * An action that is or was performed on a patient. This can be a physical intervention like an operation, or less invasive like counseling or hypnotherapy.
+         */
+        PROCEDURE, 
+        /**
+         * A record of a request for diagnostic investigations, treatments, or operations to be performed.
+         */
+        PROCEDUREREQUEST, 
+        /**
+         * This resource provides the target, request and response, and action details for an action to be performed by the target on or about existing resources.
+         */
+        PROCESSREQUEST, 
+        /**
+         * This resource provides processing status, errors and notes from the processing of a resource.
+         */
+        PROCESSRESPONSE, 
+        /**
+         * Provenance of a resource is a record that describes entities and processes involved in producing and delivering or otherwise influencing that resource. Provenance provides a critical foundation for assessing authenticity, enabling trust, and allowing reproducibility. Provenance assertions are a form of contextual metadata and can themselves become important records with their own provenance. Provenance statement indicates clinical significance in terms of confidence in authenticity, reliability, and trustworthiness, integrity, and stage in lifecycle (e.g. Document Completion - has the artifact been legally authenticated), all of which may impact security, privacy, and trust policies.
+         */
+        PROVENANCE, 
+        /**
+         * A structured set of questions intended to guide the collection of answers from end-users. Questionnaires provide detailed control over order, presentation, phraseology and grouping to allow coherent, consistent data collection.
+         */
+        QUESTIONNAIRE, 
+        /**
+         * A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to.
+         */
+        QUESTIONNAIRERESPONSE, 
+        /**
+         * Used to record and send details about a request for referral service or transfer of a patient to the care of another provider or provider organization.
+         */
+        REFERRALREQUEST, 
+        /**
+         * Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.
+         */
+        RELATEDPERSON, 
+        /**
+         * A group of related requests that can be used to capture intended activities that have inter-dependencies such as "give this medication after that one".
+         */
+        REQUESTGROUP, 
+        /**
+         * A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.
+         */
+        RESEARCHSTUDY, 
+        /**
+         * A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.
+         */
+        RESEARCHSUBJECT, 
+        /**
+         * This is the base resource type for everything.
+         */
+        RESOURCE, 
+        /**
+         * An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome.
+         */
+        RISKASSESSMENT, 
+        /**
+         * A container for slots of time that may be available for booking appointments.
+         */
+        SCHEDULE, 
+        /**
+         * A search parameter that defines a named search item that can be used to search/filter on a resource.
+         */
+        SEARCHPARAMETER, 
+        /**
+         * Raw data describing a biological sequence.
+         */
+        SEQUENCE, 
+        /**
+         * The ServiceDefinition describes a unit of decision support functionality that is made available as a service, such as immunization modules or drug-drug interaction checking.
+         */
+        SERVICEDEFINITION, 
+        /**
+         * A slot of time on a schedule that may be available for booking appointments.
+         */
+        SLOT, 
+        /**
+         * A sample to be used for analysis.
+         */
+        SPECIMEN, 
+        /**
+         * A definition of a FHIR structure. This resource is used to describe the underlying resources, data types defined in FHIR, and also for describing extensions and constraints on resources and data types.
+         */
+        STRUCTUREDEFINITION, 
+        /**
+         * A Map of relationships between 2 structures that can be used to transform data.
+         */
+        STRUCTUREMAP, 
+        /**
+         * The subscription resource is used to define a push based subscription from a server to another system. Once a subscription is registered with the server, the server checks every resource that is created or updated, and if the resource matches the given criteria, it sends a message on the defined "channel" so that another system is able to take an appropriate action.
+         */
+        SUBSCRIPTION, 
+        /**
+         * A homogeneous material with a definite composition.
+         */
+        SUBSTANCE, 
+        /**
+         * Record of delivery of what is supplied.
+         */
+        SUPPLYDELIVERY, 
+        /**
+         * A record of a request for a medication, substance or device used in the healthcare setting.
+         */
+        SUPPLYREQUEST, 
+        /**
+         * A task to be performed.
+         */
+        TASK, 
+        /**
+         * A summary of information based on the results of executing a TestScript.
+         */
+        TESTREPORT, 
+        /**
+         * A structured set of tests against a FHIR server implementation to determine compliance against the FHIR specification.
+         */
+        TESTSCRIPT, 
+        /**
+         * A value set specifies a set of codes drawn from one or more code systems.
+         */
+        VALUESET, 
+        /**
+         * An authorization for the supply of glasses and/or contact lenses to a patient.
+         */
+        VISIONPRESCRIPTION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ResourceTypes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("Account".equals(codeString))
+          return ACCOUNT;
+        if ("ActivityDefinition".equals(codeString))
+          return ACTIVITYDEFINITION;
+        if ("AdverseEvent".equals(codeString))
+          return ADVERSEEVENT;
+        if ("AllergyIntolerance".equals(codeString))
+          return ALLERGYINTOLERANCE;
+        if ("Appointment".equals(codeString))
+          return APPOINTMENT;
+        if ("AppointmentResponse".equals(codeString))
+          return APPOINTMENTRESPONSE;
+        if ("AuditEvent".equals(codeString))
+          return AUDITEVENT;
+        if ("Basic".equals(codeString))
+          return BASIC;
+        if ("Binary".equals(codeString))
+          return BINARY;
+        if ("BodySite".equals(codeString))
+          return BODYSITE;
+        if ("Bundle".equals(codeString))
+          return BUNDLE;
+        if ("CapabilityStatement".equals(codeString))
+          return CAPABILITYSTATEMENT;
+        if ("CarePlan".equals(codeString))
+          return CAREPLAN;
+        if ("CareTeam".equals(codeString))
+          return CARETEAM;
+        if ("ChargeItem".equals(codeString))
+          return CHARGEITEM;
+        if ("Claim".equals(codeString))
+          return CLAIM;
+        if ("ClaimResponse".equals(codeString))
+          return CLAIMRESPONSE;
+        if ("ClinicalImpression".equals(codeString))
+          return CLINICALIMPRESSION;
+        if ("CodeSystem".equals(codeString))
+          return CODESYSTEM;
+        if ("Communication".equals(codeString))
+          return COMMUNICATION;
+        if ("CommunicationRequest".equals(codeString))
+          return COMMUNICATIONREQUEST;
+        if ("CompartmentDefinition".equals(codeString))
+          return COMPARTMENTDEFINITION;
+        if ("Composition".equals(codeString))
+          return COMPOSITION;
+        if ("ConceptMap".equals(codeString))
+          return CONCEPTMAP;
+        if ("Condition".equals(codeString))
+          return CONDITION;
+        if ("Consent".equals(codeString))
+          return CONSENT;
+        if ("Contract".equals(codeString))
+          return CONTRACT;
+        if ("Coverage".equals(codeString))
+          return COVERAGE;
+        if ("DataElement".equals(codeString))
+          return DATAELEMENT;
+        if ("DetectedIssue".equals(codeString))
+          return DETECTEDISSUE;
+        if ("Device".equals(codeString))
+          return DEVICE;
+        if ("DeviceComponent".equals(codeString))
+          return DEVICECOMPONENT;
+        if ("DeviceMetric".equals(codeString))
+          return DEVICEMETRIC;
+        if ("DeviceRequest".equals(codeString))
+          return DEVICEREQUEST;
+        if ("DeviceUseStatement".equals(codeString))
+          return DEVICEUSESTATEMENT;
+        if ("DiagnosticReport".equals(codeString))
+          return DIAGNOSTICREPORT;
+        if ("DocumentManifest".equals(codeString))
+          return DOCUMENTMANIFEST;
+        if ("DocumentReference".equals(codeString))
+          return DOCUMENTREFERENCE;
+        if ("DomainResource".equals(codeString))
+          return DOMAINRESOURCE;
+        if ("EligibilityRequest".equals(codeString))
+          return ELIGIBILITYREQUEST;
+        if ("EligibilityResponse".equals(codeString))
+          return ELIGIBILITYRESPONSE;
+        if ("Encounter".equals(codeString))
+          return ENCOUNTER;
+        if ("Endpoint".equals(codeString))
+          return ENDPOINT;
+        if ("EnrollmentRequest".equals(codeString))
+          return ENROLLMENTREQUEST;
+        if ("EnrollmentResponse".equals(codeString))
+          return ENROLLMENTRESPONSE;
+        if ("EpisodeOfCare".equals(codeString))
+          return EPISODEOFCARE;
+        if ("ExpansionProfile".equals(codeString))
+          return EXPANSIONPROFILE;
+        if ("ExplanationOfBenefit".equals(codeString))
+          return EXPLANATIONOFBENEFIT;
+        if ("FamilyMemberHistory".equals(codeString))
+          return FAMILYMEMBERHISTORY;
+        if ("Flag".equals(codeString))
+          return FLAG;
+        if ("Goal".equals(codeString))
+          return GOAL;
+        if ("GraphDefinition".equals(codeString))
+          return GRAPHDEFINITION;
+        if ("Group".equals(codeString))
+          return GROUP;
+        if ("GuidanceResponse".equals(codeString))
+          return GUIDANCERESPONSE;
+        if ("HealthcareService".equals(codeString))
+          return HEALTHCARESERVICE;
+        if ("ImagingManifest".equals(codeString))
+          return IMAGINGMANIFEST;
+        if ("ImagingStudy".equals(codeString))
+          return IMAGINGSTUDY;
+        if ("Immunization".equals(codeString))
+          return IMMUNIZATION;
+        if ("ImmunizationRecommendation".equals(codeString))
+          return IMMUNIZATIONRECOMMENDATION;
+        if ("ImplementationGuide".equals(codeString))
+          return IMPLEMENTATIONGUIDE;
+        if ("Library".equals(codeString))
+          return LIBRARY;
+        if ("Linkage".equals(codeString))
+          return LINKAGE;
+        if ("List".equals(codeString))
+          return LIST;
+        if ("Location".equals(codeString))
+          return LOCATION;
+        if ("Measure".equals(codeString))
+          return MEASURE;
+        if ("MeasureReport".equals(codeString))
+          return MEASUREREPORT;
+        if ("Media".equals(codeString))
+          return MEDIA;
+        if ("Medication".equals(codeString))
+          return MEDICATION;
+        if ("MedicationAdministration".equals(codeString))
+          return MEDICATIONADMINISTRATION;
+        if ("MedicationDispense".equals(codeString))
+          return MEDICATIONDISPENSE;
+        if ("MedicationRequest".equals(codeString))
+          return MEDICATIONREQUEST;
+        if ("MedicationStatement".equals(codeString))
+          return MEDICATIONSTATEMENT;
+        if ("MessageDefinition".equals(codeString))
+          return MESSAGEDEFINITION;
+        if ("MessageHeader".equals(codeString))
+          return MESSAGEHEADER;
+        if ("NamingSystem".equals(codeString))
+          return NAMINGSYSTEM;
+        if ("NutritionOrder".equals(codeString))
+          return NUTRITIONORDER;
+        if ("Observation".equals(codeString))
+          return OBSERVATION;
+        if ("OperationDefinition".equals(codeString))
+          return OPERATIONDEFINITION;
+        if ("OperationOutcome".equals(codeString))
+          return OPERATIONOUTCOME;
+        if ("Organization".equals(codeString))
+          return ORGANIZATION;
+        if ("Parameters".equals(codeString))
+          return PARAMETERS;
+        if ("Patient".equals(codeString))
+          return PATIENT;
+        if ("PaymentNotice".equals(codeString))
+          return PAYMENTNOTICE;
+        if ("PaymentReconciliation".equals(codeString))
+          return PAYMENTRECONCILIATION;
+        if ("Person".equals(codeString))
+          return PERSON;
+        if ("PlanDefinition".equals(codeString))
+          return PLANDEFINITION;
+        if ("Practitioner".equals(codeString))
+          return PRACTITIONER;
+        if ("PractitionerRole".equals(codeString))
+          return PRACTITIONERROLE;
+        if ("Procedure".equals(codeString))
+          return PROCEDURE;
+        if ("ProcedureRequest".equals(codeString))
+          return PROCEDUREREQUEST;
+        if ("ProcessRequest".equals(codeString))
+          return PROCESSREQUEST;
+        if ("ProcessResponse".equals(codeString))
+          return PROCESSRESPONSE;
+        if ("Provenance".equals(codeString))
+          return PROVENANCE;
+        if ("Questionnaire".equals(codeString))
+          return QUESTIONNAIRE;
+        if ("QuestionnaireResponse".equals(codeString))
+          return QUESTIONNAIRERESPONSE;
+        if ("ReferralRequest".equals(codeString))
+          return REFERRALREQUEST;
+        if ("RelatedPerson".equals(codeString))
+          return RELATEDPERSON;
+        if ("RequestGroup".equals(codeString))
+          return REQUESTGROUP;
+        if ("ResearchStudy".equals(codeString))
+          return RESEARCHSTUDY;
+        if ("ResearchSubject".equals(codeString))
+          return RESEARCHSUBJECT;
+        if ("Resource".equals(codeString))
+          return RESOURCE;
+        if ("RiskAssessment".equals(codeString))
+          return RISKASSESSMENT;
+        if ("Schedule".equals(codeString))
+          return SCHEDULE;
+        if ("SearchParameter".equals(codeString))
+          return SEARCHPARAMETER;
+        if ("Sequence".equals(codeString))
+          return SEQUENCE;
+        if ("ServiceDefinition".equals(codeString))
+          return SERVICEDEFINITION;
+        if ("Slot".equals(codeString))
+          return SLOT;
+        if ("Specimen".equals(codeString))
+          return SPECIMEN;
+        if ("StructureDefinition".equals(codeString))
+          return STRUCTUREDEFINITION;
+        if ("StructureMap".equals(codeString))
+          return STRUCTUREMAP;
+        if ("Subscription".equals(codeString))
+          return SUBSCRIPTION;
+        if ("Substance".equals(codeString))
+          return SUBSTANCE;
+        if ("SupplyDelivery".equals(codeString))
+          return SUPPLYDELIVERY;
+        if ("SupplyRequest".equals(codeString))
+          return SUPPLYREQUEST;
+        if ("Task".equals(codeString))
+          return TASK;
+        if ("TestReport".equals(codeString))
+          return TESTREPORT;
+        if ("TestScript".equals(codeString))
+          return TESTSCRIPT;
+        if ("ValueSet".equals(codeString))
+          return VALUESET;
+        if ("VisionPrescription".equals(codeString))
+          return VISIONPRESCRIPTION;
+        throw new FHIRException("Unknown ResourceTypes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACCOUNT: return "Account";
+            case ACTIVITYDEFINITION: return "ActivityDefinition";
+            case ADVERSEEVENT: return "AdverseEvent";
+            case ALLERGYINTOLERANCE: return "AllergyIntolerance";
+            case APPOINTMENT: return "Appointment";
+            case APPOINTMENTRESPONSE: return "AppointmentResponse";
+            case AUDITEVENT: return "AuditEvent";
+            case BASIC: return "Basic";
+            case BINARY: return "Binary";
+            case BODYSITE: return "BodySite";
+            case BUNDLE: return "Bundle";
+            case CAPABILITYSTATEMENT: return "CapabilityStatement";
+            case CAREPLAN: return "CarePlan";
+            case CARETEAM: return "CareTeam";
+            case CHARGEITEM: return "ChargeItem";
+            case CLAIM: return "Claim";
+            case CLAIMRESPONSE: return "ClaimResponse";
+            case CLINICALIMPRESSION: return "ClinicalImpression";
+            case CODESYSTEM: return "CodeSystem";
+            case COMMUNICATION: return "Communication";
+            case COMMUNICATIONREQUEST: return "CommunicationRequest";
+            case COMPARTMENTDEFINITION: return "CompartmentDefinition";
+            case COMPOSITION: return "Composition";
+            case CONCEPTMAP: return "ConceptMap";
+            case CONDITION: return "Condition";
+            case CONSENT: return "Consent";
+            case CONTRACT: return "Contract";
+            case COVERAGE: return "Coverage";
+            case DATAELEMENT: return "DataElement";
+            case DETECTEDISSUE: return "DetectedIssue";
+            case DEVICE: return "Device";
+            case DEVICECOMPONENT: return "DeviceComponent";
+            case DEVICEMETRIC: return "DeviceMetric";
+            case DEVICEREQUEST: return "DeviceRequest";
+            case DEVICEUSESTATEMENT: return "DeviceUseStatement";
+            case DIAGNOSTICREPORT: return "DiagnosticReport";
+            case DOCUMENTMANIFEST: return "DocumentManifest";
+            case DOCUMENTREFERENCE: return "DocumentReference";
+            case DOMAINRESOURCE: return "DomainResource";
+            case ELIGIBILITYREQUEST: return "EligibilityRequest";
+            case ELIGIBILITYRESPONSE: return "EligibilityResponse";
+            case ENCOUNTER: return "Encounter";
+            case ENDPOINT: return "Endpoint";
+            case ENROLLMENTREQUEST: return "EnrollmentRequest";
+            case ENROLLMENTRESPONSE: return "EnrollmentResponse";
+            case EPISODEOFCARE: return "EpisodeOfCare";
+            case EXPANSIONPROFILE: return "ExpansionProfile";
+            case EXPLANATIONOFBENEFIT: return "ExplanationOfBenefit";
+            case FAMILYMEMBERHISTORY: return "FamilyMemberHistory";
+            case FLAG: return "Flag";
+            case GOAL: return "Goal";
+            case GRAPHDEFINITION: return "GraphDefinition";
+            case GROUP: return "Group";
+            case GUIDANCERESPONSE: return "GuidanceResponse";
+            case HEALTHCARESERVICE: return "HealthcareService";
+            case IMAGINGMANIFEST: return "ImagingManifest";
+            case IMAGINGSTUDY: return "ImagingStudy";
+            case IMMUNIZATION: return "Immunization";
+            case IMMUNIZATIONRECOMMENDATION: return "ImmunizationRecommendation";
+            case IMPLEMENTATIONGUIDE: return "ImplementationGuide";
+            case LIBRARY: return "Library";
+            case LINKAGE: return "Linkage";
+            case LIST: return "List";
+            case LOCATION: return "Location";
+            case MEASURE: return "Measure";
+            case MEASUREREPORT: return "MeasureReport";
+            case MEDIA: return "Media";
+            case MEDICATION: return "Medication";
+            case MEDICATIONADMINISTRATION: return "MedicationAdministration";
+            case MEDICATIONDISPENSE: return "MedicationDispense";
+            case MEDICATIONREQUEST: return "MedicationRequest";
+            case MEDICATIONSTATEMENT: return "MedicationStatement";
+            case MESSAGEDEFINITION: return "MessageDefinition";
+            case MESSAGEHEADER: return "MessageHeader";
+            case NAMINGSYSTEM: return "NamingSystem";
+            case NUTRITIONORDER: return "NutritionOrder";
+            case OBSERVATION: return "Observation";
+            case OPERATIONDEFINITION: return "OperationDefinition";
+            case OPERATIONOUTCOME: return "OperationOutcome";
+            case ORGANIZATION: return "Organization";
+            case PARAMETERS: return "Parameters";
+            case PATIENT: return "Patient";
+            case PAYMENTNOTICE: return "PaymentNotice";
+            case PAYMENTRECONCILIATION: return "PaymentReconciliation";
+            case PERSON: return "Person";
+            case PLANDEFINITION: return "PlanDefinition";
+            case PRACTITIONER: return "Practitioner";
+            case PRACTITIONERROLE: return "PractitionerRole";
+            case PROCEDURE: return "Procedure";
+            case PROCEDUREREQUEST: return "ProcedureRequest";
+            case PROCESSREQUEST: return "ProcessRequest";
+            case PROCESSRESPONSE: return "ProcessResponse";
+            case PROVENANCE: return "Provenance";
+            case QUESTIONNAIRE: return "Questionnaire";
+            case QUESTIONNAIRERESPONSE: return "QuestionnaireResponse";
+            case REFERRALREQUEST: return "ReferralRequest";
+            case RELATEDPERSON: return "RelatedPerson";
+            case REQUESTGROUP: return "RequestGroup";
+            case RESEARCHSTUDY: return "ResearchStudy";
+            case RESEARCHSUBJECT: return "ResearchSubject";
+            case RESOURCE: return "Resource";
+            case RISKASSESSMENT: return "RiskAssessment";
+            case SCHEDULE: return "Schedule";
+            case SEARCHPARAMETER: return "SearchParameter";
+            case SEQUENCE: return "Sequence";
+            case SERVICEDEFINITION: return "ServiceDefinition";
+            case SLOT: return "Slot";
+            case SPECIMEN: return "Specimen";
+            case STRUCTUREDEFINITION: return "StructureDefinition";
+            case STRUCTUREMAP: return "StructureMap";
+            case SUBSCRIPTION: return "Subscription";
+            case SUBSTANCE: return "Substance";
+            case SUPPLYDELIVERY: return "SupplyDelivery";
+            case SUPPLYREQUEST: return "SupplyRequest";
+            case TASK: return "Task";
+            case TESTREPORT: return "TestReport";
+            case TESTSCRIPT: return "TestScript";
+            case VALUESET: return "ValueSet";
+            case VISIONPRESCRIPTION: return "VisionPrescription";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/resource-types";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACCOUNT: return "A financial tool for tracking value accrued for a particular purpose.  In the healthcare field, used to track charges for a patient, cost centers, etc.";
+            case ACTIVITYDEFINITION: return "This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.";
+            case ADVERSEEVENT: return "Actual or  potential/avoided event causing unintended physical injury resulting from or contributed to by medical care, a research study or other healthcare setting factors that requires additional monitoring, treatment, or hospitalization, or that results in death.";
+            case ALLERGYINTOLERANCE: return "Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.";
+            case APPOINTMENT: return "A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s).";
+            case APPOINTMENTRESPONSE: return "A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection.";
+            case AUDITEVENT: return "A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.";
+            case BASIC: return "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.";
+            case BINARY: return "A binary resource can contain any content, whether text, image, pdf, zip archive, etc.";
+            case BODYSITE: return "Record details about the anatomical location of a specimen or body part.  This resource may be used when a coded concept does not provide the necessary detail needed for the use case.";
+            case BUNDLE: return "A container for a collection of resources.";
+            case CAPABILITYSTATEMENT: return "A Capability Statement documents a set of capabilities (behaviors) of a FHIR Server that may be used as a statement of actual server functionality or a statement of required or desired server implementation.";
+            case CAREPLAN: return "Describes the intention of how one or more practitioners intend to deliver care for a particular patient, group or community for a period of time, possibly limited to care for a specific condition or set of conditions.";
+            case CARETEAM: return "The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care for a patient.";
+            case CHARGEITEM: return "The resource ChargeItem describes the provision of healthcare provider products for a certain patient, therefore referring not only to the product, but containing in addition details of the provision, like date, time, amounts and participating organizations and persons. Main Usage of the ChargeItem is to enable the billing process and internal cost allocation.";
+            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 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 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 consumer’s policy 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.";
+            case CONTRACT: return "A formal agreement between parties regarding the conduct of business, exchange of information or other matters.";
+            case COVERAGE: return "Financial instrument which may be used to reimburse or pay for health care products and services.";
+            case DATAELEMENT: return "The formal description of a single piece of information that can be gathered and reported.";
+            case DETECTEDISSUE: return "Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, Ineffective treatment frequency, Procedure-condition conflict, etc.";
+            case DEVICE: return "This resource identifies an instance or a type of a manufactured item that is used in the provision of healthcare without being substantially changed through that activity. The device may be a medical or non-medical device.  Medical devices include durable (reusable) medical equipment, implantable devices, as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.  Non-medical devices may include items such as a machine, cellphone, computer, application, etc.";
+            case DEVICECOMPONENT: return "The characteristics, operational status and capabilities of a medical-related component of a medical device.";
+            case DEVICEMETRIC: return "Describes a measurement, calculation or setting capability of a medical device.";
+            case DEVICEREQUEST: return "Represents a request for a patient to employ a medical device. The device may be an implantable device, or an external assistive device, such as a walker.";
+            case DEVICEUSESTATEMENT: return "A record of a device being used by a patient where the record is the result of a report from the patient or another clinician.";
+            case DIAGNOSTICREPORT: return "The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports.";
+            case DOCUMENTMANIFEST: return "A collection of documents compiled for a purpose together with metadata that applies to the collection.";
+            case DOCUMENTREFERENCE: return "A reference to a document.";
+            case DOMAINRESOURCE: return "A resource that includes narrative, extensions, and contained resources.";
+            case ELIGIBILITYREQUEST: return "The EligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the form of an EligibilityResponse, with information regarding whether the stated coverage is valid and in-force and optionally to provide the insurance details of the policy.";
+            case ELIGIBILITYRESPONSE: return "This resource provides eligibility and plan details from the processing of an Eligibility resource.";
+            case ENCOUNTER: return "An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.";
+            case ENDPOINT: return "The technical details of an endpoint that can be used for electronic services, such as for web services providing XDS.b or a REST endpoint for another FHIR server. This may include any security context information.";
+            case ENROLLMENTREQUEST: return "This resource provides the insurance enrollment details to the insurer regarding a specified coverage.";
+            case ENROLLMENTRESPONSE: return "This resource provides enrollment and plan details from the processing of an Enrollment resource.";
+            case EPISODEOFCARE: return "An association between a patient and an organization / healthcare provider(s) during which time encounters may occur. The managing organization assumes a level of responsibility for the patient during this time.";
+            case EXPANSIONPROFILE: return "Resource to define constraints on the Expansion of a FHIR ValueSet.";
+            case EXPLANATIONOFBENEFIT: return "This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.";
+            case FAMILYMEMBERHISTORY: return "Significant health events and conditions for a person related to the patient relevant in the context of care for the patient.";
+            case FLAG: return "Prospective warnings of potential issues when providing care to the patient.";
+            case GOAL: return "Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.";
+            case GRAPHDEFINITION: return "A formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph by following references. The Graph Definition resource defines a set and makes rules about the set.";
+            case GROUP: return "Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized; i.e. a collection of entities that isn't an Organization.";
+            case GUIDANCERESPONSE: return "A guidance response is the formal response to a guidance request, including any output parameters returned by the evaluation, as well as the description of any proposed actions to be taken.";
+            case HEALTHCARESERVICE: return "The details of a healthcare service available at a location.";
+            case IMAGINGMANIFEST: return "A text description of the DICOM SOP instances selected in the ImagingManifest; or the reason for, or significance of, the selection.";
+            case IMAGINGSTUDY: return "Representation of the content produced in a DICOM imaging study. A study comprises a set of series, each of which includes a set of Service-Object Pair Instances (SOP Instances - images or other data) acquired or produced in a common context.  A series is of only one modality (e.g. X-ray, CT, MR, ultrasound), but a study may have multiple series of different modalities.";
+            case IMMUNIZATION: return "Describes the event of a patient being administered a vaccination or a record of a vaccination as reported by a patient, a clinician or another party and may include vaccine reaction information and what vaccination protocol was followed.";
+            case IMMUNIZATIONRECOMMENDATION: return "A patient's point-in-time immunization and recommendation (i.e. forecasting a patient's immunization eligibility according to a published schedule) with optional supporting justification.";
+            case IMPLEMENTATIONGUIDE: return "A set of rules of how FHIR is used to solve a particular problem. This resource is used to gather all the parts of an implementation guide into a logical whole and to publish a computable definition of all the parts.";
+            case LIBRARY: return "The Library resource is a general-purpose container for knowledge asset definitions. It can be used to describe and expose existing knowledge assets such as logic libraries and information model descriptions, as well as to describe a collection of knowledge assets.";
+            case LINKAGE: return "Identifies two or more records (resource instances) that are referring to the same real-world \"occurrence\".";
+            case LIST: return "A set of information summarized from a list of other resources.";
+            case LOCATION: return "Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.";
+            case MEASURE: return "The Measure resource provides the definition of a quality measure.";
+            case MEASUREREPORT: return "The MeasureReport resource contains the results of evaluating a measure.";
+            case MEDIA: return "A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference.";
+            case MEDICATION: return "This resource is primarily used for the identification and definition of a medication. It covers the ingredients and the packaging for a medication.";
+            case MEDICATIONADMINISTRATION: return "Describes the event of a patient consuming or otherwise being administered a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.  Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.";
+            case MEDICATIONDISPENSE: return "Indicates that a medication product is to be or has been dispensed for a named person/patient.  This includes a description of the medication product (supply) provided and the instructions for administering the medication.  The medication dispense is the result of a pharmacy system responding to a medication order.";
+            case MEDICATIONREQUEST: return "An order or request for both supply of the medication and the instructions for administration of the medication to a patient. The resource is called \"MedicationRequest\" rather than \"MedicationPrescription\" or \"MedicationOrder\" to generalize the use across inpatient and outpatient settings, including care plans, etc., and to harmonize with workflow patterns.";
+            case MEDICATIONSTATEMENT: return "A record of a medication that is being consumed by a patient.   A MedicationStatement may indicate that the patient may be taking the medication now, or has taken the medication in the past or will be taking the medication in the future.  The source of this information can be the patient, significant other (such as a family member or spouse), or a clinician.  A common scenario where this information is captured is during the history taking process during a patient visit or stay.   The medication information may come from sources such as the patient's memory, from a prescription bottle,  or from a list of medications the patient, clinician or other party maintains \r\rThe primary difference between a medication statement and a medication administration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication.  A medication statement is often, if not always, less specific.  There is no required date/time when the medication was administered, in fact we only know that a source has reported the patient is taking this medication, where details such as time, quantity, or rate or even medication product may be incomplete or missing or less precise.  As stated earlier, the medication statement information may come from the patient's memory, from a prescription bottle or from a list of medications the patient, clinician or other party maintains.  Medication administration is more formal and is not missing detailed information.";
+            case MESSAGEDEFINITION: return "Defines the characteristics of a message that can be shared between systems, including the type of event that initiates the message, the content to be transmitted and what response(s), if any, are permitted.";
+            case MESSAGEHEADER: return "The header for a message exchange that is either requesting or responding to an action.  The reference(s) that are the subject of the action as well as other information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.";
+            case NAMINGSYSTEM: return "A curated namespace that issues unique symbols within that namespace for the identification of concepts, people, devices, etc.  Represents a \"System\" used within the Identifier and Coding data types.";
+            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 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.";
+            case PARAMETERS: return "This special resource type is used to represent an operation request and response (operations.html). It has no other use, and there is no RESTful endpoint associated with it.";
+            case PATIENT: return "Demographics and other administrative information about an individual or animal receiving care or other health-related services.";
+            case PAYMENTNOTICE: return "This resource provides the status of the payment for goods and services rendered, and the request and response resource references.";
+            case PAYMENTRECONCILIATION: return "This resource provides payment details and claim references supporting a bulk payment.";
+            case PERSON: return "Demographics and administrative information about a person independent of a specific health-related context.";
+            case PLANDEFINITION: return "This resource allows for the definition of various types of plans as a sharable, consumable, and executable artifact. The resource is general enough to support the description of a broad range of clinical artifacts such as clinical decision support rules, order sets and protocols.";
+            case PRACTITIONER: return "A person who is directly or indirectly involved in the provisioning of healthcare.";
+            case PRACTITIONERROLE: return "A specific set of Roles/Locations/specialties/services that a practitioner may perform at an organization for a period of time.";
+            case PROCEDURE: return "An action that is or was performed on a patient. This can be a physical intervention like an operation, or less invasive like counseling or hypnotherapy.";
+            case PROCEDUREREQUEST: return "A record of a request for diagnostic investigations, treatments, or operations to be performed.";
+            case PROCESSREQUEST: return "This resource provides the target, request and response, and action details for an action to be performed by the target on or about existing resources.";
+            case PROCESSRESPONSE: return "This resource provides processing status, errors and notes from the processing of a resource.";
+            case PROVENANCE: return "Provenance of a resource is a record that describes entities and processes involved in producing and delivering or otherwise influencing that resource. Provenance provides a critical foundation for assessing authenticity, enabling trust, and allowing reproducibility. Provenance assertions are a form of contextual metadata and can themselves become important records with their own provenance. Provenance statement indicates clinical significance in terms of confidence in authenticity, reliability, and trustworthiness, integrity, and stage in lifecycle (e.g. Document Completion - has the artifact been legally authenticated), all of which may impact security, privacy, and trust policies.";
+            case QUESTIONNAIRE: return "A structured set of questions intended to guide the collection of answers from end-users. Questionnaires provide detailed control over order, presentation, phraseology and grouping to allow coherent, consistent data collection.";
+            case QUESTIONNAIRERESPONSE: return "A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to.";
+            case REFERRALREQUEST: return "Used to record and send details about a request for referral service or transfer of a patient to the care of another provider or provider organization.";
+            case RELATEDPERSON: return "Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.";
+            case REQUESTGROUP: return "A group of related requests that can be used to capture intended activities that have inter-dependencies such as \"give this medication after that one\".";
+            case RESEARCHSTUDY: return "A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.";
+            case RESEARCHSUBJECT: return "A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.";
+            case RESOURCE: return "This is the base resource type for everything.";
+            case RISKASSESSMENT: return "An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome.";
+            case SCHEDULE: return "A container for slots of time that may be available for booking appointments.";
+            case SEARCHPARAMETER: return "A search parameter that defines a named search item that can be used to search/filter on a resource.";
+            case SEQUENCE: return "Raw data describing a biological sequence.";
+            case SERVICEDEFINITION: return "The ServiceDefinition describes a unit of decision support functionality that is made available as a service, such as immunization modules or drug-drug interaction checking.";
+            case SLOT: return "A slot of time on a schedule that may be available for booking appointments.";
+            case SPECIMEN: return "A sample to be used for analysis.";
+            case STRUCTUREDEFINITION: return "A definition of a FHIR structure. This resource is used to describe the underlying resources, data types defined in FHIR, and also for describing extensions and constraints on resources and data types.";
+            case STRUCTUREMAP: return "A Map of relationships between 2 structures that can be used to transform data.";
+            case SUBSCRIPTION: return "The subscription resource is used to define a push based subscription from a server to another system. Once a subscription is registered with the server, the server checks every resource that is created or updated, and if the resource matches the given criteria, it sends a message on the defined \"channel\" so that another system is able to take an appropriate action.";
+            case SUBSTANCE: return "A homogeneous material with a definite composition.";
+            case SUPPLYDELIVERY: return "Record of delivery of what is supplied.";
+            case SUPPLYREQUEST: return "A record of a request for a medication, substance or device used in the healthcare setting.";
+            case TASK: return "A task to be performed.";
+            case TESTREPORT: return "A summary of information based on the results of executing a TestScript.";
+            case TESTSCRIPT: return "A structured set of tests against a FHIR server implementation to determine compliance against the FHIR specification.";
+            case VALUESET: return "A value set specifies a set of codes drawn from one or more code systems.";
+            case VISIONPRESCRIPTION: return "An authorization for the supply of glasses and/or contact lenses to a patient.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACCOUNT: return "Account";
+            case ACTIVITYDEFINITION: return "ActivityDefinition";
+            case ADVERSEEVENT: return "AdverseEvent";
+            case ALLERGYINTOLERANCE: return "AllergyIntolerance";
+            case APPOINTMENT: return "Appointment";
+            case APPOINTMENTRESPONSE: return "AppointmentResponse";
+            case AUDITEVENT: return "AuditEvent";
+            case BASIC: return "Basic";
+            case BINARY: return "Binary";
+            case BODYSITE: return "BodySite";
+            case BUNDLE: return "Bundle";
+            case CAPABILITYSTATEMENT: return "CapabilityStatement";
+            case CAREPLAN: return "CarePlan";
+            case CARETEAM: return "CareTeam";
+            case CHARGEITEM: return "ChargeItem";
+            case CLAIM: return "Claim";
+            case CLAIMRESPONSE: return "ClaimResponse";
+            case CLINICALIMPRESSION: return "ClinicalImpression";
+            case CODESYSTEM: return "CodeSystem";
+            case COMMUNICATION: return "Communication";
+            case COMMUNICATIONREQUEST: return "CommunicationRequest";
+            case COMPARTMENTDEFINITION: return "CompartmentDefinition";
+            case COMPOSITION: return "Composition";
+            case CONCEPTMAP: return "ConceptMap";
+            case CONDITION: return "Condition";
+            case CONSENT: return "Consent";
+            case CONTRACT: return "Contract";
+            case COVERAGE: return "Coverage";
+            case DATAELEMENT: return "DataElement";
+            case DETECTEDISSUE: return "DetectedIssue";
+            case DEVICE: return "Device";
+            case DEVICECOMPONENT: return "DeviceComponent";
+            case DEVICEMETRIC: return "DeviceMetric";
+            case DEVICEREQUEST: return "DeviceRequest";
+            case DEVICEUSESTATEMENT: return "DeviceUseStatement";
+            case DIAGNOSTICREPORT: return "DiagnosticReport";
+            case DOCUMENTMANIFEST: return "DocumentManifest";
+            case DOCUMENTREFERENCE: return "DocumentReference";
+            case DOMAINRESOURCE: return "DomainResource";
+            case ELIGIBILITYREQUEST: return "EligibilityRequest";
+            case ELIGIBILITYRESPONSE: return "EligibilityResponse";
+            case ENCOUNTER: return "Encounter";
+            case ENDPOINT: return "Endpoint";
+            case ENROLLMENTREQUEST: return "EnrollmentRequest";
+            case ENROLLMENTRESPONSE: return "EnrollmentResponse";
+            case EPISODEOFCARE: return "EpisodeOfCare";
+            case EXPANSIONPROFILE: return "ExpansionProfile";
+            case EXPLANATIONOFBENEFIT: return "ExplanationOfBenefit";
+            case FAMILYMEMBERHISTORY: return "FamilyMemberHistory";
+            case FLAG: return "Flag";
+            case GOAL: return "Goal";
+            case GRAPHDEFINITION: return "GraphDefinition";
+            case GROUP: return "Group";
+            case GUIDANCERESPONSE: return "GuidanceResponse";
+            case HEALTHCARESERVICE: return "HealthcareService";
+            case IMAGINGMANIFEST: return "ImagingManifest";
+            case IMAGINGSTUDY: return "ImagingStudy";
+            case IMMUNIZATION: return "Immunization";
+            case IMMUNIZATIONRECOMMENDATION: return "ImmunizationRecommendation";
+            case IMPLEMENTATIONGUIDE: return "ImplementationGuide";
+            case LIBRARY: return "Library";
+            case LINKAGE: return "Linkage";
+            case LIST: return "List";
+            case LOCATION: return "Location";
+            case MEASURE: return "Measure";
+            case MEASUREREPORT: return "MeasureReport";
+            case MEDIA: return "Media";
+            case MEDICATION: return "Medication";
+            case MEDICATIONADMINISTRATION: return "MedicationAdministration";
+            case MEDICATIONDISPENSE: return "MedicationDispense";
+            case MEDICATIONREQUEST: return "MedicationRequest";
+            case MEDICATIONSTATEMENT: return "MedicationStatement";
+            case MESSAGEDEFINITION: return "MessageDefinition";
+            case MESSAGEHEADER: return "MessageHeader";
+            case NAMINGSYSTEM: return "NamingSystem";
+            case NUTRITIONORDER: return "NutritionOrder";
+            case OBSERVATION: return "Observation";
+            case OPERATIONDEFINITION: return "OperationDefinition";
+            case OPERATIONOUTCOME: return "OperationOutcome";
+            case ORGANIZATION: return "Organization";
+            case PARAMETERS: return "Parameters";
+            case PATIENT: return "Patient";
+            case PAYMENTNOTICE: return "PaymentNotice";
+            case PAYMENTRECONCILIATION: return "PaymentReconciliation";
+            case PERSON: return "Person";
+            case PLANDEFINITION: return "PlanDefinition";
+            case PRACTITIONER: return "Practitioner";
+            case PRACTITIONERROLE: return "PractitionerRole";
+            case PROCEDURE: return "Procedure";
+            case PROCEDUREREQUEST: return "ProcedureRequest";
+            case PROCESSREQUEST: return "ProcessRequest";
+            case PROCESSRESPONSE: return "ProcessResponse";
+            case PROVENANCE: return "Provenance";
+            case QUESTIONNAIRE: return "Questionnaire";
+            case QUESTIONNAIRERESPONSE: return "QuestionnaireResponse";
+            case REFERRALREQUEST: return "ReferralRequest";
+            case RELATEDPERSON: return "RelatedPerson";
+            case REQUESTGROUP: return "RequestGroup";
+            case RESEARCHSTUDY: return "ResearchStudy";
+            case RESEARCHSUBJECT: return "ResearchSubject";
+            case RESOURCE: return "Resource";
+            case RISKASSESSMENT: return "RiskAssessment";
+            case SCHEDULE: return "Schedule";
+            case SEARCHPARAMETER: return "SearchParameter";
+            case SEQUENCE: return "Sequence";
+            case SERVICEDEFINITION: return "ServiceDefinition";
+            case SLOT: return "Slot";
+            case SPECIMEN: return "Specimen";
+            case STRUCTUREDEFINITION: return "StructureDefinition";
+            case STRUCTUREMAP: return "StructureMap";
+            case SUBSCRIPTION: return "Subscription";
+            case SUBSTANCE: return "Substance";
+            case SUPPLYDELIVERY: return "SupplyDelivery";
+            case SUPPLYREQUEST: return "SupplyRequest";
+            case TASK: return "Task";
+            case TESTREPORT: return "TestReport";
+            case TESTSCRIPT: return "TestScript";
+            case VALUESET: return "ValueSet";
+            case VISIONPRESCRIPTION: return "VisionPrescription";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypesEnumFactory.java
new file mode 100644
index 00000000000..5cef4b0c867
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceTypesEnumFactory.java
@@ -0,0 +1,530 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ResourceTypesEnumFactory implements EnumFactory {
+
+  public ResourceTypes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("Account".equals(codeString))
+      return ResourceTypes.ACCOUNT;
+    if ("ActivityDefinition".equals(codeString))
+      return ResourceTypes.ACTIVITYDEFINITION;
+    if ("AdverseEvent".equals(codeString))
+      return ResourceTypes.ADVERSEEVENT;
+    if ("AllergyIntolerance".equals(codeString))
+      return ResourceTypes.ALLERGYINTOLERANCE;
+    if ("Appointment".equals(codeString))
+      return ResourceTypes.APPOINTMENT;
+    if ("AppointmentResponse".equals(codeString))
+      return ResourceTypes.APPOINTMENTRESPONSE;
+    if ("AuditEvent".equals(codeString))
+      return ResourceTypes.AUDITEVENT;
+    if ("Basic".equals(codeString))
+      return ResourceTypes.BASIC;
+    if ("Binary".equals(codeString))
+      return ResourceTypes.BINARY;
+    if ("BodySite".equals(codeString))
+      return ResourceTypes.BODYSITE;
+    if ("Bundle".equals(codeString))
+      return ResourceTypes.BUNDLE;
+    if ("CapabilityStatement".equals(codeString))
+      return ResourceTypes.CAPABILITYSTATEMENT;
+    if ("CarePlan".equals(codeString))
+      return ResourceTypes.CAREPLAN;
+    if ("CareTeam".equals(codeString))
+      return ResourceTypes.CARETEAM;
+    if ("ChargeItem".equals(codeString))
+      return ResourceTypes.CHARGEITEM;
+    if ("Claim".equals(codeString))
+      return ResourceTypes.CLAIM;
+    if ("ClaimResponse".equals(codeString))
+      return ResourceTypes.CLAIMRESPONSE;
+    if ("ClinicalImpression".equals(codeString))
+      return ResourceTypes.CLINICALIMPRESSION;
+    if ("CodeSystem".equals(codeString))
+      return ResourceTypes.CODESYSTEM;
+    if ("Communication".equals(codeString))
+      return ResourceTypes.COMMUNICATION;
+    if ("CommunicationRequest".equals(codeString))
+      return ResourceTypes.COMMUNICATIONREQUEST;
+    if ("CompartmentDefinition".equals(codeString))
+      return ResourceTypes.COMPARTMENTDEFINITION;
+    if ("Composition".equals(codeString))
+      return ResourceTypes.COMPOSITION;
+    if ("ConceptMap".equals(codeString))
+      return ResourceTypes.CONCEPTMAP;
+    if ("Condition".equals(codeString))
+      return ResourceTypes.CONDITION;
+    if ("Consent".equals(codeString))
+      return ResourceTypes.CONSENT;
+    if ("Contract".equals(codeString))
+      return ResourceTypes.CONTRACT;
+    if ("Coverage".equals(codeString))
+      return ResourceTypes.COVERAGE;
+    if ("DataElement".equals(codeString))
+      return ResourceTypes.DATAELEMENT;
+    if ("DetectedIssue".equals(codeString))
+      return ResourceTypes.DETECTEDISSUE;
+    if ("Device".equals(codeString))
+      return ResourceTypes.DEVICE;
+    if ("DeviceComponent".equals(codeString))
+      return ResourceTypes.DEVICECOMPONENT;
+    if ("DeviceMetric".equals(codeString))
+      return ResourceTypes.DEVICEMETRIC;
+    if ("DeviceRequest".equals(codeString))
+      return ResourceTypes.DEVICEREQUEST;
+    if ("DeviceUseStatement".equals(codeString))
+      return ResourceTypes.DEVICEUSESTATEMENT;
+    if ("DiagnosticReport".equals(codeString))
+      return ResourceTypes.DIAGNOSTICREPORT;
+    if ("DocumentManifest".equals(codeString))
+      return ResourceTypes.DOCUMENTMANIFEST;
+    if ("DocumentReference".equals(codeString))
+      return ResourceTypes.DOCUMENTREFERENCE;
+    if ("DomainResource".equals(codeString))
+      return ResourceTypes.DOMAINRESOURCE;
+    if ("EligibilityRequest".equals(codeString))
+      return ResourceTypes.ELIGIBILITYREQUEST;
+    if ("EligibilityResponse".equals(codeString))
+      return ResourceTypes.ELIGIBILITYRESPONSE;
+    if ("Encounter".equals(codeString))
+      return ResourceTypes.ENCOUNTER;
+    if ("Endpoint".equals(codeString))
+      return ResourceTypes.ENDPOINT;
+    if ("EnrollmentRequest".equals(codeString))
+      return ResourceTypes.ENROLLMENTREQUEST;
+    if ("EnrollmentResponse".equals(codeString))
+      return ResourceTypes.ENROLLMENTRESPONSE;
+    if ("EpisodeOfCare".equals(codeString))
+      return ResourceTypes.EPISODEOFCARE;
+    if ("ExpansionProfile".equals(codeString))
+      return ResourceTypes.EXPANSIONPROFILE;
+    if ("ExplanationOfBenefit".equals(codeString))
+      return ResourceTypes.EXPLANATIONOFBENEFIT;
+    if ("FamilyMemberHistory".equals(codeString))
+      return ResourceTypes.FAMILYMEMBERHISTORY;
+    if ("Flag".equals(codeString))
+      return ResourceTypes.FLAG;
+    if ("Goal".equals(codeString))
+      return ResourceTypes.GOAL;
+    if ("GraphDefinition".equals(codeString))
+      return ResourceTypes.GRAPHDEFINITION;
+    if ("Group".equals(codeString))
+      return ResourceTypes.GROUP;
+    if ("GuidanceResponse".equals(codeString))
+      return ResourceTypes.GUIDANCERESPONSE;
+    if ("HealthcareService".equals(codeString))
+      return ResourceTypes.HEALTHCARESERVICE;
+    if ("ImagingManifest".equals(codeString))
+      return ResourceTypes.IMAGINGMANIFEST;
+    if ("ImagingStudy".equals(codeString))
+      return ResourceTypes.IMAGINGSTUDY;
+    if ("Immunization".equals(codeString))
+      return ResourceTypes.IMMUNIZATION;
+    if ("ImmunizationRecommendation".equals(codeString))
+      return ResourceTypes.IMMUNIZATIONRECOMMENDATION;
+    if ("ImplementationGuide".equals(codeString))
+      return ResourceTypes.IMPLEMENTATIONGUIDE;
+    if ("Library".equals(codeString))
+      return ResourceTypes.LIBRARY;
+    if ("Linkage".equals(codeString))
+      return ResourceTypes.LINKAGE;
+    if ("List".equals(codeString))
+      return ResourceTypes.LIST;
+    if ("Location".equals(codeString))
+      return ResourceTypes.LOCATION;
+    if ("Measure".equals(codeString))
+      return ResourceTypes.MEASURE;
+    if ("MeasureReport".equals(codeString))
+      return ResourceTypes.MEASUREREPORT;
+    if ("Media".equals(codeString))
+      return ResourceTypes.MEDIA;
+    if ("Medication".equals(codeString))
+      return ResourceTypes.MEDICATION;
+    if ("MedicationAdministration".equals(codeString))
+      return ResourceTypes.MEDICATIONADMINISTRATION;
+    if ("MedicationDispense".equals(codeString))
+      return ResourceTypes.MEDICATIONDISPENSE;
+    if ("MedicationRequest".equals(codeString))
+      return ResourceTypes.MEDICATIONREQUEST;
+    if ("MedicationStatement".equals(codeString))
+      return ResourceTypes.MEDICATIONSTATEMENT;
+    if ("MessageDefinition".equals(codeString))
+      return ResourceTypes.MESSAGEDEFINITION;
+    if ("MessageHeader".equals(codeString))
+      return ResourceTypes.MESSAGEHEADER;
+    if ("NamingSystem".equals(codeString))
+      return ResourceTypes.NAMINGSYSTEM;
+    if ("NutritionOrder".equals(codeString))
+      return ResourceTypes.NUTRITIONORDER;
+    if ("Observation".equals(codeString))
+      return ResourceTypes.OBSERVATION;
+    if ("OperationDefinition".equals(codeString))
+      return ResourceTypes.OPERATIONDEFINITION;
+    if ("OperationOutcome".equals(codeString))
+      return ResourceTypes.OPERATIONOUTCOME;
+    if ("Organization".equals(codeString))
+      return ResourceTypes.ORGANIZATION;
+    if ("Parameters".equals(codeString))
+      return ResourceTypes.PARAMETERS;
+    if ("Patient".equals(codeString))
+      return ResourceTypes.PATIENT;
+    if ("PaymentNotice".equals(codeString))
+      return ResourceTypes.PAYMENTNOTICE;
+    if ("PaymentReconciliation".equals(codeString))
+      return ResourceTypes.PAYMENTRECONCILIATION;
+    if ("Person".equals(codeString))
+      return ResourceTypes.PERSON;
+    if ("PlanDefinition".equals(codeString))
+      return ResourceTypes.PLANDEFINITION;
+    if ("Practitioner".equals(codeString))
+      return ResourceTypes.PRACTITIONER;
+    if ("PractitionerRole".equals(codeString))
+      return ResourceTypes.PRACTITIONERROLE;
+    if ("Procedure".equals(codeString))
+      return ResourceTypes.PROCEDURE;
+    if ("ProcedureRequest".equals(codeString))
+      return ResourceTypes.PROCEDUREREQUEST;
+    if ("ProcessRequest".equals(codeString))
+      return ResourceTypes.PROCESSREQUEST;
+    if ("ProcessResponse".equals(codeString))
+      return ResourceTypes.PROCESSRESPONSE;
+    if ("Provenance".equals(codeString))
+      return ResourceTypes.PROVENANCE;
+    if ("Questionnaire".equals(codeString))
+      return ResourceTypes.QUESTIONNAIRE;
+    if ("QuestionnaireResponse".equals(codeString))
+      return ResourceTypes.QUESTIONNAIRERESPONSE;
+    if ("ReferralRequest".equals(codeString))
+      return ResourceTypes.REFERRALREQUEST;
+    if ("RelatedPerson".equals(codeString))
+      return ResourceTypes.RELATEDPERSON;
+    if ("RequestGroup".equals(codeString))
+      return ResourceTypes.REQUESTGROUP;
+    if ("ResearchStudy".equals(codeString))
+      return ResourceTypes.RESEARCHSTUDY;
+    if ("ResearchSubject".equals(codeString))
+      return ResourceTypes.RESEARCHSUBJECT;
+    if ("Resource".equals(codeString))
+      return ResourceTypes.RESOURCE;
+    if ("RiskAssessment".equals(codeString))
+      return ResourceTypes.RISKASSESSMENT;
+    if ("Schedule".equals(codeString))
+      return ResourceTypes.SCHEDULE;
+    if ("SearchParameter".equals(codeString))
+      return ResourceTypes.SEARCHPARAMETER;
+    if ("Sequence".equals(codeString))
+      return ResourceTypes.SEQUENCE;
+    if ("ServiceDefinition".equals(codeString))
+      return ResourceTypes.SERVICEDEFINITION;
+    if ("Slot".equals(codeString))
+      return ResourceTypes.SLOT;
+    if ("Specimen".equals(codeString))
+      return ResourceTypes.SPECIMEN;
+    if ("StructureDefinition".equals(codeString))
+      return ResourceTypes.STRUCTUREDEFINITION;
+    if ("StructureMap".equals(codeString))
+      return ResourceTypes.STRUCTUREMAP;
+    if ("Subscription".equals(codeString))
+      return ResourceTypes.SUBSCRIPTION;
+    if ("Substance".equals(codeString))
+      return ResourceTypes.SUBSTANCE;
+    if ("SupplyDelivery".equals(codeString))
+      return ResourceTypes.SUPPLYDELIVERY;
+    if ("SupplyRequest".equals(codeString))
+      return ResourceTypes.SUPPLYREQUEST;
+    if ("Task".equals(codeString))
+      return ResourceTypes.TASK;
+    if ("TestReport".equals(codeString))
+      return ResourceTypes.TESTREPORT;
+    if ("TestScript".equals(codeString))
+      return ResourceTypes.TESTSCRIPT;
+    if ("ValueSet".equals(codeString))
+      return ResourceTypes.VALUESET;
+    if ("VisionPrescription".equals(codeString))
+      return ResourceTypes.VISIONPRESCRIPTION;
+    throw new IllegalArgumentException("Unknown ResourceTypes code '"+codeString+"'");
+  }
+
+  public String toCode(ResourceTypes code) {
+    if (code == ResourceTypes.ACCOUNT)
+      return "Account";
+    if (code == ResourceTypes.ACTIVITYDEFINITION)
+      return "ActivityDefinition";
+    if (code == ResourceTypes.ADVERSEEVENT)
+      return "AdverseEvent";
+    if (code == ResourceTypes.ALLERGYINTOLERANCE)
+      return "AllergyIntolerance";
+    if (code == ResourceTypes.APPOINTMENT)
+      return "Appointment";
+    if (code == ResourceTypes.APPOINTMENTRESPONSE)
+      return "AppointmentResponse";
+    if (code == ResourceTypes.AUDITEVENT)
+      return "AuditEvent";
+    if (code == ResourceTypes.BASIC)
+      return "Basic";
+    if (code == ResourceTypes.BINARY)
+      return "Binary";
+    if (code == ResourceTypes.BODYSITE)
+      return "BodySite";
+    if (code == ResourceTypes.BUNDLE)
+      return "Bundle";
+    if (code == ResourceTypes.CAPABILITYSTATEMENT)
+      return "CapabilityStatement";
+    if (code == ResourceTypes.CAREPLAN)
+      return "CarePlan";
+    if (code == ResourceTypes.CARETEAM)
+      return "CareTeam";
+    if (code == ResourceTypes.CHARGEITEM)
+      return "ChargeItem";
+    if (code == ResourceTypes.CLAIM)
+      return "Claim";
+    if (code == ResourceTypes.CLAIMRESPONSE)
+      return "ClaimResponse";
+    if (code == ResourceTypes.CLINICALIMPRESSION)
+      return "ClinicalImpression";
+    if (code == ResourceTypes.CODESYSTEM)
+      return "CodeSystem";
+    if (code == ResourceTypes.COMMUNICATION)
+      return "Communication";
+    if (code == ResourceTypes.COMMUNICATIONREQUEST)
+      return "CommunicationRequest";
+    if (code == ResourceTypes.COMPARTMENTDEFINITION)
+      return "CompartmentDefinition";
+    if (code == ResourceTypes.COMPOSITION)
+      return "Composition";
+    if (code == ResourceTypes.CONCEPTMAP)
+      return "ConceptMap";
+    if (code == ResourceTypes.CONDITION)
+      return "Condition";
+    if (code == ResourceTypes.CONSENT)
+      return "Consent";
+    if (code == ResourceTypes.CONTRACT)
+      return "Contract";
+    if (code == ResourceTypes.COVERAGE)
+      return "Coverage";
+    if (code == ResourceTypes.DATAELEMENT)
+      return "DataElement";
+    if (code == ResourceTypes.DETECTEDISSUE)
+      return "DetectedIssue";
+    if (code == ResourceTypes.DEVICE)
+      return "Device";
+    if (code == ResourceTypes.DEVICECOMPONENT)
+      return "DeviceComponent";
+    if (code == ResourceTypes.DEVICEMETRIC)
+      return "DeviceMetric";
+    if (code == ResourceTypes.DEVICEREQUEST)
+      return "DeviceRequest";
+    if (code == ResourceTypes.DEVICEUSESTATEMENT)
+      return "DeviceUseStatement";
+    if (code == ResourceTypes.DIAGNOSTICREPORT)
+      return "DiagnosticReport";
+    if (code == ResourceTypes.DOCUMENTMANIFEST)
+      return "DocumentManifest";
+    if (code == ResourceTypes.DOCUMENTREFERENCE)
+      return "DocumentReference";
+    if (code == ResourceTypes.DOMAINRESOURCE)
+      return "DomainResource";
+    if (code == ResourceTypes.ELIGIBILITYREQUEST)
+      return "EligibilityRequest";
+    if (code == ResourceTypes.ELIGIBILITYRESPONSE)
+      return "EligibilityResponse";
+    if (code == ResourceTypes.ENCOUNTER)
+      return "Encounter";
+    if (code == ResourceTypes.ENDPOINT)
+      return "Endpoint";
+    if (code == ResourceTypes.ENROLLMENTREQUEST)
+      return "EnrollmentRequest";
+    if (code == ResourceTypes.ENROLLMENTRESPONSE)
+      return "EnrollmentResponse";
+    if (code == ResourceTypes.EPISODEOFCARE)
+      return "EpisodeOfCare";
+    if (code == ResourceTypes.EXPANSIONPROFILE)
+      return "ExpansionProfile";
+    if (code == ResourceTypes.EXPLANATIONOFBENEFIT)
+      return "ExplanationOfBenefit";
+    if (code == ResourceTypes.FAMILYMEMBERHISTORY)
+      return "FamilyMemberHistory";
+    if (code == ResourceTypes.FLAG)
+      return "Flag";
+    if (code == ResourceTypes.GOAL)
+      return "Goal";
+    if (code == ResourceTypes.GRAPHDEFINITION)
+      return "GraphDefinition";
+    if (code == ResourceTypes.GROUP)
+      return "Group";
+    if (code == ResourceTypes.GUIDANCERESPONSE)
+      return "GuidanceResponse";
+    if (code == ResourceTypes.HEALTHCARESERVICE)
+      return "HealthcareService";
+    if (code == ResourceTypes.IMAGINGMANIFEST)
+      return "ImagingManifest";
+    if (code == ResourceTypes.IMAGINGSTUDY)
+      return "ImagingStudy";
+    if (code == ResourceTypes.IMMUNIZATION)
+      return "Immunization";
+    if (code == ResourceTypes.IMMUNIZATIONRECOMMENDATION)
+      return "ImmunizationRecommendation";
+    if (code == ResourceTypes.IMPLEMENTATIONGUIDE)
+      return "ImplementationGuide";
+    if (code == ResourceTypes.LIBRARY)
+      return "Library";
+    if (code == ResourceTypes.LINKAGE)
+      return "Linkage";
+    if (code == ResourceTypes.LIST)
+      return "List";
+    if (code == ResourceTypes.LOCATION)
+      return "Location";
+    if (code == ResourceTypes.MEASURE)
+      return "Measure";
+    if (code == ResourceTypes.MEASUREREPORT)
+      return "MeasureReport";
+    if (code == ResourceTypes.MEDIA)
+      return "Media";
+    if (code == ResourceTypes.MEDICATION)
+      return "Medication";
+    if (code == ResourceTypes.MEDICATIONADMINISTRATION)
+      return "MedicationAdministration";
+    if (code == ResourceTypes.MEDICATIONDISPENSE)
+      return "MedicationDispense";
+    if (code == ResourceTypes.MEDICATIONREQUEST)
+      return "MedicationRequest";
+    if (code == ResourceTypes.MEDICATIONSTATEMENT)
+      return "MedicationStatement";
+    if (code == ResourceTypes.MESSAGEDEFINITION)
+      return "MessageDefinition";
+    if (code == ResourceTypes.MESSAGEHEADER)
+      return "MessageHeader";
+    if (code == ResourceTypes.NAMINGSYSTEM)
+      return "NamingSystem";
+    if (code == ResourceTypes.NUTRITIONORDER)
+      return "NutritionOrder";
+    if (code == ResourceTypes.OBSERVATION)
+      return "Observation";
+    if (code == ResourceTypes.OPERATIONDEFINITION)
+      return "OperationDefinition";
+    if (code == ResourceTypes.OPERATIONOUTCOME)
+      return "OperationOutcome";
+    if (code == ResourceTypes.ORGANIZATION)
+      return "Organization";
+    if (code == ResourceTypes.PARAMETERS)
+      return "Parameters";
+    if (code == ResourceTypes.PATIENT)
+      return "Patient";
+    if (code == ResourceTypes.PAYMENTNOTICE)
+      return "PaymentNotice";
+    if (code == ResourceTypes.PAYMENTRECONCILIATION)
+      return "PaymentReconciliation";
+    if (code == ResourceTypes.PERSON)
+      return "Person";
+    if (code == ResourceTypes.PLANDEFINITION)
+      return "PlanDefinition";
+    if (code == ResourceTypes.PRACTITIONER)
+      return "Practitioner";
+    if (code == ResourceTypes.PRACTITIONERROLE)
+      return "PractitionerRole";
+    if (code == ResourceTypes.PROCEDURE)
+      return "Procedure";
+    if (code == ResourceTypes.PROCEDUREREQUEST)
+      return "ProcedureRequest";
+    if (code == ResourceTypes.PROCESSREQUEST)
+      return "ProcessRequest";
+    if (code == ResourceTypes.PROCESSRESPONSE)
+      return "ProcessResponse";
+    if (code == ResourceTypes.PROVENANCE)
+      return "Provenance";
+    if (code == ResourceTypes.QUESTIONNAIRE)
+      return "Questionnaire";
+    if (code == ResourceTypes.QUESTIONNAIRERESPONSE)
+      return "QuestionnaireResponse";
+    if (code == ResourceTypes.REFERRALREQUEST)
+      return "ReferralRequest";
+    if (code == ResourceTypes.RELATEDPERSON)
+      return "RelatedPerson";
+    if (code == ResourceTypes.REQUESTGROUP)
+      return "RequestGroup";
+    if (code == ResourceTypes.RESEARCHSTUDY)
+      return "ResearchStudy";
+    if (code == ResourceTypes.RESEARCHSUBJECT)
+      return "ResearchSubject";
+    if (code == ResourceTypes.RESOURCE)
+      return "Resource";
+    if (code == ResourceTypes.RISKASSESSMENT)
+      return "RiskAssessment";
+    if (code == ResourceTypes.SCHEDULE)
+      return "Schedule";
+    if (code == ResourceTypes.SEARCHPARAMETER)
+      return "SearchParameter";
+    if (code == ResourceTypes.SEQUENCE)
+      return "Sequence";
+    if (code == ResourceTypes.SERVICEDEFINITION)
+      return "ServiceDefinition";
+    if (code == ResourceTypes.SLOT)
+      return "Slot";
+    if (code == ResourceTypes.SPECIMEN)
+      return "Specimen";
+    if (code == ResourceTypes.STRUCTUREDEFINITION)
+      return "StructureDefinition";
+    if (code == ResourceTypes.STRUCTUREMAP)
+      return "StructureMap";
+    if (code == ResourceTypes.SUBSCRIPTION)
+      return "Subscription";
+    if (code == ResourceTypes.SUBSTANCE)
+      return "Substance";
+    if (code == ResourceTypes.SUPPLYDELIVERY)
+      return "SupplyDelivery";
+    if (code == ResourceTypes.SUPPLYREQUEST)
+      return "SupplyRequest";
+    if (code == ResourceTypes.TASK)
+      return "Task";
+    if (code == ResourceTypes.TESTREPORT)
+      return "TestReport";
+    if (code == ResourceTypes.TESTSCRIPT)
+      return "TestScript";
+    if (code == ResourceTypes.VALUESET)
+      return "ValueSet";
+    if (code == ResourceTypes.VISIONPRESCRIPTION)
+      return "VisionPrescription";
+    return "?";
+  }
+
+    public String toSystem(ResourceTypes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceValidationMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceValidationMode.java
new file mode 100644
index 00000000000..f59e7e11cac
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceValidationMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ResourceValidationMode {
+
+        /**
+         * The server checks the content, and then checks that the content would be acceptable as a create (e.g. that the content would not violate any uniqueness constraints).
+         */
+        CREATE, 
+        /**
+         * The server checks the content, and then checks that it would accept it as an update against the nominated specific resource (e.g. that there are no changes to immutable fields the server does not allow to change, and checking version integrity if appropriate).
+         */
+        UPDATE, 
+        /**
+         * The server ignores the content, and checks that the nominated resource is allowed to be deleted (e.g. checking referential integrity rules).
+         */
+        DELETE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ResourceValidationMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("create".equals(codeString))
+          return CREATE;
+        if ("update".equals(codeString))
+          return UPDATE;
+        if ("delete".equals(codeString))
+          return DELETE;
+        throw new FHIRException("Unknown ResourceValidationMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CREATE: return "create";
+            case UPDATE: return "update";
+            case DELETE: return "delete";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/resource-validation-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CREATE: return "The server checks the content, and then checks that the content would be acceptable as a create (e.g. that the content would not violate any uniqueness constraints).";
+            case UPDATE: return "The server checks the content, and then checks that it would accept it as an update against the nominated specific resource (e.g. that there are no changes to immutable fields the server does not allow to change, and checking version integrity if appropriate).";
+            case DELETE: return "The server ignores the content, and checks that the nominated resource is allowed to be deleted (e.g. checking referential integrity rules).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CREATE: return "Validate for Create";
+            case UPDATE: return "Validate for Update";
+            case DELETE: return "Validate for Delete";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceValidationModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceValidationModeEnumFactory.java
new file mode 100644
index 00000000000..be1b76c9506
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResourceValidationModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ResourceValidationModeEnumFactory implements EnumFactory {
+
+  public ResourceValidationMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("create".equals(codeString))
+      return ResourceValidationMode.CREATE;
+    if ("update".equals(codeString))
+      return ResourceValidationMode.UPDATE;
+    if ("delete".equals(codeString))
+      return ResourceValidationMode.DELETE;
+    throw new IllegalArgumentException("Unknown ResourceValidationMode code '"+codeString+"'");
+  }
+
+  public String toCode(ResourceValidationMode code) {
+    if (code == ResourceValidationMode.CREATE)
+      return "create";
+    if (code == ResourceValidationMode.UPDATE)
+      return "update";
+    if (code == ResourceValidationMode.DELETE)
+      return "delete";
+    return "?";
+  }
+
+    public String toSystem(ResourceValidationMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResponseCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResponseCode.java
new file mode 100644
index 00000000000..ffda2157234
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResponseCode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ResponseCode {
+
+        /**
+         * The message was accepted and processed without error.
+         */
+        OK, 
+        /**
+         * Some internal unexpected error occurred - wait and try again. Note - this is usually used for things like database unavailable, which may be expected to resolve, though human intervention may be required.
+         */
+        TRANSIENTERROR, 
+        /**
+         * The message was rejected because of a problem with the content. There is no point in re-sending without change. The response narrative SHALL describe the issue.
+         */
+        FATALERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ResponseCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ok".equals(codeString))
+          return OK;
+        if ("transient-error".equals(codeString))
+          return TRANSIENTERROR;
+        if ("fatal-error".equals(codeString))
+          return FATALERROR;
+        throw new FHIRException("Unknown ResponseCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OK: return "ok";
+            case TRANSIENTERROR: return "transient-error";
+            case FATALERROR: return "fatal-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/response-code";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OK: return "The message was accepted and processed without error.";
+            case TRANSIENTERROR: return "Some internal unexpected error occurred - wait and try again. Note - this is usually used for things like database unavailable, which may be expected to resolve, though human intervention may be required.";
+            case FATALERROR: return "The message was rejected because of a problem with the content. There is no point in re-sending without change. The response narrative SHALL describe the issue.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OK: return "OK";
+            case TRANSIENTERROR: return "Transient Error";
+            case FATALERROR: return "Fatal Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResponseCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResponseCodeEnumFactory.java
new file mode 100644
index 00000000000..455588cc53b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ResponseCodeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ResponseCodeEnumFactory implements EnumFactory {
+
+  public ResponseCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ok".equals(codeString))
+      return ResponseCode.OK;
+    if ("transient-error".equals(codeString))
+      return ResponseCode.TRANSIENTERROR;
+    if ("fatal-error".equals(codeString))
+      return ResponseCode.FATALERROR;
+    throw new IllegalArgumentException("Unknown ResponseCode code '"+codeString+"'");
+  }
+
+  public String toCode(ResponseCode code) {
+    if (code == ResponseCode.OK)
+      return "ok";
+    if (code == ResponseCode.TRANSIENTERROR)
+      return "transient-error";
+    if (code == ResponseCode.FATALERROR)
+      return "fatal-error";
+    return "?";
+  }
+
+    public String toSystem(ResponseCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulCapabilityMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulCapabilityMode.java
new file mode 100644
index 00000000000..03462172124
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulCapabilityMode.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RestfulCapabilityMode {
+
+        /**
+         * The application acts as a client for this resource.
+         */
+        CLIENT, 
+        /**
+         * The application acts as a server for this resource.
+         */
+        SERVER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RestfulCapabilityMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("client".equals(codeString))
+          return CLIENT;
+        if ("server".equals(codeString))
+          return SERVER;
+        throw new FHIRException("Unknown RestfulCapabilityMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CLIENT: return "client";
+            case SERVER: return "server";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/restful-capability-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CLIENT: return "The application acts as a client for this resource.";
+            case SERVER: return "The application acts as a server for this resource.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CLIENT: return "Client";
+            case SERVER: return "Server";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulCapabilityModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulCapabilityModeEnumFactory.java
new file mode 100644
index 00000000000..0886e41836f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulCapabilityModeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RestfulCapabilityModeEnumFactory implements EnumFactory {
+
+  public RestfulCapabilityMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("client".equals(codeString))
+      return RestfulCapabilityMode.CLIENT;
+    if ("server".equals(codeString))
+      return RestfulCapabilityMode.SERVER;
+    throw new IllegalArgumentException("Unknown RestfulCapabilityMode code '"+codeString+"'");
+  }
+
+  public String toCode(RestfulCapabilityMode code) {
+    if (code == RestfulCapabilityMode.CLIENT)
+      return "client";
+    if (code == RestfulCapabilityMode.SERVER)
+      return "server";
+    return "?";
+  }
+
+    public String toSystem(RestfulCapabilityMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulInteraction.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulInteraction.java
new file mode 100644
index 00000000000..cd5e2a32c76
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulInteraction.java
@@ -0,0 +1,222 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RestfulInteraction {
+
+        /**
+         * Read the current state of the resource.
+         */
+        READ, 
+        /**
+         * Read the state of a specific version of the resource.
+         */
+        VREAD, 
+        /**
+         * Update an existing resource by its id (or create it if it is new).
+         */
+        UPDATE, 
+        /**
+         * Update an existing resource by posting a set of changes to it.
+         */
+        PATCH, 
+        /**
+         * Delete a resource.
+         */
+        DELETE, 
+        /**
+         * Retrieve the change history for a particular resource, type of resource, or the entire system.
+         */
+        HISTORY, 
+        /**
+         * Retrieve the change history for a particular resource.
+         */
+        HISTORYINSTANCE, 
+        /**
+         * Retrieve the change history for all resources of a particular type.
+         */
+        HISTORYTYPE, 
+        /**
+         * Retrieve the change history for all resources on a system.
+         */
+        HISTORYSYSTEM, 
+        /**
+         * Create a new resource with a server assigned id.
+         */
+        CREATE, 
+        /**
+         * Search a resource type or all resources based on some filter criteria.
+         */
+        SEARCH, 
+        /**
+         * Search all resources of the specified type based on some filter criteria.
+         */
+        SEARCHTYPE, 
+        /**
+         * Search all resources based on some filter criteria.
+         */
+        SEARCHSYSTEM, 
+        /**
+         * Get a Capability Statement for the system.
+         */
+        CAPABILITIES, 
+        /**
+         * Update, create or delete a set of resources as a single transaction.
+         */
+        TRANSACTION, 
+        /**
+         * perform a set of a separate interactions in a single http operation
+         */
+        BATCH, 
+        /**
+         * Perform an operation as defined by an OperationDefinition.
+         */
+        OPERATION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RestfulInteraction fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("read".equals(codeString))
+          return READ;
+        if ("vread".equals(codeString))
+          return VREAD;
+        if ("update".equals(codeString))
+          return UPDATE;
+        if ("patch".equals(codeString))
+          return PATCH;
+        if ("delete".equals(codeString))
+          return DELETE;
+        if ("history".equals(codeString))
+          return HISTORY;
+        if ("history-instance".equals(codeString))
+          return HISTORYINSTANCE;
+        if ("history-type".equals(codeString))
+          return HISTORYTYPE;
+        if ("history-system".equals(codeString))
+          return HISTORYSYSTEM;
+        if ("create".equals(codeString))
+          return CREATE;
+        if ("search".equals(codeString))
+          return SEARCH;
+        if ("search-type".equals(codeString))
+          return SEARCHTYPE;
+        if ("search-system".equals(codeString))
+          return SEARCHSYSTEM;
+        if ("capabilities".equals(codeString))
+          return CAPABILITIES;
+        if ("transaction".equals(codeString))
+          return TRANSACTION;
+        if ("batch".equals(codeString))
+          return BATCH;
+        if ("operation".equals(codeString))
+          return OPERATION;
+        throw new FHIRException("Unknown RestfulInteraction code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case READ: return "read";
+            case VREAD: return "vread";
+            case UPDATE: return "update";
+            case PATCH: return "patch";
+            case DELETE: return "delete";
+            case HISTORY: return "history";
+            case HISTORYINSTANCE: return "history-instance";
+            case HISTORYTYPE: return "history-type";
+            case HISTORYSYSTEM: return "history-system";
+            case CREATE: return "create";
+            case SEARCH: return "search";
+            case SEARCHTYPE: return "search-type";
+            case SEARCHSYSTEM: return "search-system";
+            case CAPABILITIES: return "capabilities";
+            case TRANSACTION: return "transaction";
+            case BATCH: return "batch";
+            case OPERATION: return "operation";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/restful-interaction";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case READ: return "Read the current state of the resource.";
+            case VREAD: return "Read the state of a specific version of the resource.";
+            case UPDATE: return "Update an existing resource by its id (or create it if it is new).";
+            case PATCH: return "Update an existing resource by posting a set of changes to it.";
+            case DELETE: return "Delete a resource.";
+            case HISTORY: return "Retrieve the change history for a particular resource, type of resource, or the entire system.";
+            case HISTORYINSTANCE: return "Retrieve the change history for a particular resource.";
+            case HISTORYTYPE: return "Retrieve the change history for all resources of a particular type.";
+            case HISTORYSYSTEM: return "Retrieve the change history for all resources on a system.";
+            case CREATE: return "Create a new resource with a server assigned id.";
+            case SEARCH: return "Search a resource type or all resources based on some filter criteria.";
+            case SEARCHTYPE: return "Search all resources of the specified type based on some filter criteria.";
+            case SEARCHSYSTEM: return "Search all resources based on some filter criteria.";
+            case CAPABILITIES: return "Get a Capability Statement for the system.";
+            case TRANSACTION: return "Update, create or delete a set of resources as a single transaction.";
+            case BATCH: return "perform a set of a separate interactions in a single http operation";
+            case OPERATION: return "Perform an operation as defined by an OperationDefinition.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case READ: return "read";
+            case VREAD: return "vread";
+            case UPDATE: return "update";
+            case PATCH: return "patch";
+            case DELETE: return "delete";
+            case HISTORY: return "history";
+            case HISTORYINSTANCE: return "history-instance";
+            case HISTORYTYPE: return "history-type";
+            case HISTORYSYSTEM: return "history-system";
+            case CREATE: return "create";
+            case SEARCH: return "search";
+            case SEARCHTYPE: return "search-type";
+            case SEARCHSYSTEM: return "search-system";
+            case CAPABILITIES: return "capabilities";
+            case TRANSACTION: return "transaction";
+            case BATCH: return "batch";
+            case OPERATION: return "operation";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulInteractionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulInteractionEnumFactory.java
new file mode 100644
index 00000000000..f3963a83ae5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulInteractionEnumFactory.java
@@ -0,0 +1,122 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RestfulInteractionEnumFactory implements EnumFactory {
+
+  public RestfulInteraction fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("read".equals(codeString))
+      return RestfulInteraction.READ;
+    if ("vread".equals(codeString))
+      return RestfulInteraction.VREAD;
+    if ("update".equals(codeString))
+      return RestfulInteraction.UPDATE;
+    if ("patch".equals(codeString))
+      return RestfulInteraction.PATCH;
+    if ("delete".equals(codeString))
+      return RestfulInteraction.DELETE;
+    if ("history".equals(codeString))
+      return RestfulInteraction.HISTORY;
+    if ("history-instance".equals(codeString))
+      return RestfulInteraction.HISTORYINSTANCE;
+    if ("history-type".equals(codeString))
+      return RestfulInteraction.HISTORYTYPE;
+    if ("history-system".equals(codeString))
+      return RestfulInteraction.HISTORYSYSTEM;
+    if ("create".equals(codeString))
+      return RestfulInteraction.CREATE;
+    if ("search".equals(codeString))
+      return RestfulInteraction.SEARCH;
+    if ("search-type".equals(codeString))
+      return RestfulInteraction.SEARCHTYPE;
+    if ("search-system".equals(codeString))
+      return RestfulInteraction.SEARCHSYSTEM;
+    if ("capabilities".equals(codeString))
+      return RestfulInteraction.CAPABILITIES;
+    if ("transaction".equals(codeString))
+      return RestfulInteraction.TRANSACTION;
+    if ("batch".equals(codeString))
+      return RestfulInteraction.BATCH;
+    if ("operation".equals(codeString))
+      return RestfulInteraction.OPERATION;
+    throw new IllegalArgumentException("Unknown RestfulInteraction code '"+codeString+"'");
+  }
+
+  public String toCode(RestfulInteraction code) {
+    if (code == RestfulInteraction.READ)
+      return "read";
+    if (code == RestfulInteraction.VREAD)
+      return "vread";
+    if (code == RestfulInteraction.UPDATE)
+      return "update";
+    if (code == RestfulInteraction.PATCH)
+      return "patch";
+    if (code == RestfulInteraction.DELETE)
+      return "delete";
+    if (code == RestfulInteraction.HISTORY)
+      return "history";
+    if (code == RestfulInteraction.HISTORYINSTANCE)
+      return "history-instance";
+    if (code == RestfulInteraction.HISTORYTYPE)
+      return "history-type";
+    if (code == RestfulInteraction.HISTORYSYSTEM)
+      return "history-system";
+    if (code == RestfulInteraction.CREATE)
+      return "create";
+    if (code == RestfulInteraction.SEARCH)
+      return "search";
+    if (code == RestfulInteraction.SEARCHTYPE)
+      return "search-type";
+    if (code == RestfulInteraction.SEARCHSYSTEM)
+      return "search-system";
+    if (code == RestfulInteraction.CAPABILITIES)
+      return "capabilities";
+    if (code == RestfulInteraction.TRANSACTION)
+      return "transaction";
+    if (code == RestfulInteraction.BATCH)
+      return "batch";
+    if (code == RestfulInteraction.OPERATION)
+      return "operation";
+    return "?";
+  }
+
+    public String toSystem(RestfulInteraction code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulSecurityService.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulSecurityService.java
new file mode 100644
index 00000000000..b53c5cd0941
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulSecurityService.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RestfulSecurityService {
+
+        /**
+         * Oauth (unspecified version see oauth.net).
+         */
+        OAUTH, 
+        /**
+         * OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org/).
+         */
+        SMARTONFHIR, 
+        /**
+         * Microsoft NTLM Authentication.
+         */
+        NTLM, 
+        /**
+         * Basic authentication defined in HTTP specification.
+         */
+        BASIC, 
+        /**
+         * see http://www.ietf.org/rfc/rfc4120.txt.
+         */
+        KERBEROS, 
+        /**
+         * SSL where client must have a certificate registered with the server.
+         */
+        CERTIFICATES, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RestfulSecurityService fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("OAuth".equals(codeString))
+          return OAUTH;
+        if ("SMART-on-FHIR".equals(codeString))
+          return SMARTONFHIR;
+        if ("NTLM".equals(codeString))
+          return NTLM;
+        if ("Basic".equals(codeString))
+          return BASIC;
+        if ("Kerberos".equals(codeString))
+          return KERBEROS;
+        if ("Certificates".equals(codeString))
+          return CERTIFICATES;
+        throw new FHIRException("Unknown RestfulSecurityService code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OAUTH: return "OAuth";
+            case SMARTONFHIR: return "SMART-on-FHIR";
+            case NTLM: return "NTLM";
+            case BASIC: return "Basic";
+            case KERBEROS: return "Kerberos";
+            case CERTIFICATES: return "Certificates";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/restful-security-service";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OAUTH: return "Oauth (unspecified version see oauth.net).";
+            case SMARTONFHIR: return "OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org/).";
+            case NTLM: return "Microsoft NTLM Authentication.";
+            case BASIC: return "Basic authentication defined in HTTP specification.";
+            case KERBEROS: return "see http://www.ietf.org/rfc/rfc4120.txt.";
+            case CERTIFICATES: return "SSL where client must have a certificate registered with the server.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OAUTH: return "OAuth";
+            case SMARTONFHIR: return "SMART-on-FHIR";
+            case NTLM: return "NTLM";
+            case BASIC: return "Basic";
+            case KERBEROS: return "Kerberos";
+            case CERTIFICATES: return "Certificates";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulSecurityServiceEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulSecurityServiceEnumFactory.java
new file mode 100644
index 00000000000..a0a1c340aaf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RestfulSecurityServiceEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RestfulSecurityServiceEnumFactory implements EnumFactory {
+
+  public RestfulSecurityService fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("OAuth".equals(codeString))
+      return RestfulSecurityService.OAUTH;
+    if ("SMART-on-FHIR".equals(codeString))
+      return RestfulSecurityService.SMARTONFHIR;
+    if ("NTLM".equals(codeString))
+      return RestfulSecurityService.NTLM;
+    if ("Basic".equals(codeString))
+      return RestfulSecurityService.BASIC;
+    if ("Kerberos".equals(codeString))
+      return RestfulSecurityService.KERBEROS;
+    if ("Certificates".equals(codeString))
+      return RestfulSecurityService.CERTIFICATES;
+    throw new IllegalArgumentException("Unknown RestfulSecurityService code '"+codeString+"'");
+  }
+
+  public String toCode(RestfulSecurityService code) {
+    if (code == RestfulSecurityService.OAUTH)
+      return "OAuth";
+    if (code == RestfulSecurityService.SMARTONFHIR)
+      return "SMART-on-FHIR";
+    if (code == RestfulSecurityService.NTLM)
+      return "NTLM";
+    if (code == RestfulSecurityService.BASIC)
+      return "Basic";
+    if (code == RestfulSecurityService.KERBEROS)
+      return "Kerberos";
+    if (code == RestfulSecurityService.CERTIFICATES)
+      return "Certificates";
+    return "?";
+  }
+
+    public String toSystem(RestfulSecurityService code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RiskProbability.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RiskProbability.java
new file mode 100644
index 00000000000..bf02b520a12
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RiskProbability.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum RiskProbability {
+
+        /**
+         * The specified outcome is exceptionally unlikely.
+         */
+        NEGLIGIBLE, 
+        /**
+         * The specified outcome is possible but unlikely.
+         */
+        LOW, 
+        /**
+         * The specified outcome has a reasonable likelihood of occurrence.
+         */
+        MODERATE, 
+        /**
+         * The specified outcome is more likely to occur than not.
+         */
+        HIGH, 
+        /**
+         * The specified outcome is effectively guaranteed.
+         */
+        CERTAIN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static RiskProbability fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("negligible".equals(codeString))
+          return NEGLIGIBLE;
+        if ("low".equals(codeString))
+          return LOW;
+        if ("moderate".equals(codeString))
+          return MODERATE;
+        if ("high".equals(codeString))
+          return HIGH;
+        if ("certain".equals(codeString))
+          return CERTAIN;
+        throw new FHIRException("Unknown RiskProbability code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NEGLIGIBLE: return "negligible";
+            case LOW: return "low";
+            case MODERATE: return "moderate";
+            case HIGH: return "high";
+            case CERTAIN: return "certain";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/risk-probability";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NEGLIGIBLE: return "The specified outcome is exceptionally unlikely.";
+            case LOW: return "The specified outcome is possible but unlikely.";
+            case MODERATE: return "The specified outcome has a reasonable likelihood of occurrence.";
+            case HIGH: return "The specified outcome is more likely to occur than not.";
+            case CERTAIN: return "The specified outcome is effectively guaranteed.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NEGLIGIBLE: return "Negligible likelihood";
+            case LOW: return "Low likelihood";
+            case MODERATE: return "Moderate likelihood";
+            case HIGH: return "High likelihood";
+            case CERTAIN: return "Certain";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RiskProbabilityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RiskProbabilityEnumFactory.java
new file mode 100644
index 00000000000..15c897789d6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RiskProbabilityEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RiskProbabilityEnumFactory implements EnumFactory {
+
+  public RiskProbability fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("negligible".equals(codeString))
+      return RiskProbability.NEGLIGIBLE;
+    if ("low".equals(codeString))
+      return RiskProbability.LOW;
+    if ("moderate".equals(codeString))
+      return RiskProbability.MODERATE;
+    if ("high".equals(codeString))
+      return RiskProbability.HIGH;
+    if ("certain".equals(codeString))
+      return RiskProbability.CERTAIN;
+    throw new IllegalArgumentException("Unknown RiskProbability code '"+codeString+"'");
+  }
+
+  public String toCode(RiskProbability code) {
+    if (code == RiskProbability.NEGLIGIBLE)
+      return "negligible";
+    if (code == RiskProbability.LOW)
+      return "low";
+    if (code == RiskProbability.MODERATE)
+      return "moderate";
+    if (code == RiskProbability.HIGH)
+      return "high";
+    if (code == RiskProbability.CERTAIN)
+      return "certain";
+    return "?";
+  }
+
+    public String toSystem(RiskProbability code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Ruleset.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Ruleset.java
new file mode 100644
index 00000000000..299850bb2cb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Ruleset.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Ruleset {
+
+        /**
+         * null
+         */
+        X124010, 
+        /**
+         * null
+         */
+        X125010, 
+        /**
+         * null
+         */
+        X127010, 
+        /**
+         * null
+         */
+        CDANETV2, 
+        /**
+         * null
+         */
+        CDANETV4, 
+        /**
+         * null
+         */
+        CPHA3, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Ruleset fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("x12-4010".equals(codeString))
+          return X124010;
+        if ("x12-5010".equals(codeString))
+          return X125010;
+        if ("x12-7010".equals(codeString))
+          return X127010;
+        if ("cdanet-v2".equals(codeString))
+          return CDANETV2;
+        if ("cdanet-v4".equals(codeString))
+          return CDANETV4;
+        if ("cpha-3".equals(codeString))
+          return CPHA3;
+        throw new FHIRException("Unknown Ruleset code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case X124010: return "x12-4010";
+            case X125010: return "x12-5010";
+            case X127010: return "x12-7010";
+            case CDANETV2: return "cdanet-v2";
+            case CDANETV4: return "cdanet-v4";
+            case CPHA3: return "cpha-3";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ruleset";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case X124010: return "";
+            case X125010: return "";
+            case X127010: return "";
+            case CDANETV2: return "";
+            case CDANETV4: return "";
+            case CPHA3: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case X124010: return "x12-4010";
+            case X125010: return "x12-5010";
+            case X127010: return "x12-7010";
+            case CDANETV2: return "cdanet-v2";
+            case CDANETV4: return "cdanet-v4";
+            case CPHA3: return "cpha-3";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RulesetEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RulesetEnumFactory.java
new file mode 100644
index 00000000000..a9db41c8952
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/RulesetEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class RulesetEnumFactory implements EnumFactory {
+
+  public Ruleset fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("x12-4010".equals(codeString))
+      return Ruleset.X124010;
+    if ("x12-5010".equals(codeString))
+      return Ruleset.X125010;
+    if ("x12-7010".equals(codeString))
+      return Ruleset.X127010;
+    if ("cdanet-v2".equals(codeString))
+      return Ruleset.CDANETV2;
+    if ("cdanet-v4".equals(codeString))
+      return Ruleset.CDANETV4;
+    if ("cpha-3".equals(codeString))
+      return Ruleset.CPHA3;
+    throw new IllegalArgumentException("Unknown Ruleset code '"+codeString+"'");
+  }
+
+  public String toCode(Ruleset code) {
+    if (code == Ruleset.X124010)
+      return "x12-4010";
+    if (code == Ruleset.X125010)
+      return "x12-5010";
+    if (code == Ruleset.X127010)
+      return "x12-7010";
+    if (code == Ruleset.CDANETV2)
+      return "cdanet-v2";
+    if (code == Ruleset.CDANETV4)
+      return "cdanet-v4";
+    if (code == Ruleset.CPHA3)
+      return "cpha-3";
+    return "?";
+  }
+
+    public String toSystem(Ruleset code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchComparator.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchComparator.java
new file mode 100644
index 00000000000..75f3b0e5fa6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchComparator.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SearchComparator {
+
+        /**
+         * the value for the parameter in the resource is equal to the provided value
+         */
+        EQ, 
+        /**
+         * the value for the parameter in the resource is not equal to the provided value
+         */
+        NE, 
+        /**
+         * the value for the parameter in the resource is greater than the provided value
+         */
+        GT, 
+        /**
+         * the value for the parameter in the resource is less than the provided value
+         */
+        LT, 
+        /**
+         * the value for the parameter in the resource is greater or equal to the provided value
+         */
+        GE, 
+        /**
+         * the value for the parameter in the resource is less or equal to the provided value
+         */
+        LE, 
+        /**
+         * the value for the parameter in the resource starts after the provided value
+         */
+        SA, 
+        /**
+         * the value for the parameter in the resource ends before the provided value
+         */
+        EB, 
+        /**
+         * the value for the parameter in the resource is approximately the same to the provided value.
+         */
+        AP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SearchComparator fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("eq".equals(codeString))
+          return EQ;
+        if ("ne".equals(codeString))
+          return NE;
+        if ("gt".equals(codeString))
+          return GT;
+        if ("lt".equals(codeString))
+          return LT;
+        if ("ge".equals(codeString))
+          return GE;
+        if ("le".equals(codeString))
+          return LE;
+        if ("sa".equals(codeString))
+          return SA;
+        if ("eb".equals(codeString))
+          return EB;
+        if ("ap".equals(codeString))
+          return AP;
+        throw new FHIRException("Unknown SearchComparator code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case EQ: return "eq";
+            case NE: return "ne";
+            case GT: return "gt";
+            case LT: return "lt";
+            case GE: return "ge";
+            case LE: return "le";
+            case SA: return "sa";
+            case EB: return "eb";
+            case AP: return "ap";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/search-comparator";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case EQ: return "the value for the parameter in the resource is equal to the provided value";
+            case NE: return "the value for the parameter in the resource is not equal to the provided value";
+            case GT: return "the value for the parameter in the resource is greater than the provided value";
+            case LT: return "the value for the parameter in the resource is less than the provided value";
+            case GE: return "the value for the parameter in the resource is greater or equal to the provided value";
+            case LE: return "the value for the parameter in the resource is less or equal to the provided value";
+            case SA: return "the value for the parameter in the resource starts after the provided value";
+            case EB: return "the value for the parameter in the resource ends before the provided value";
+            case AP: return "the value for the parameter in the resource is approximately the same to the provided value.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case EQ: return "Equals";
+            case NE: return "Not Equals";
+            case GT: return "Greater Than";
+            case LT: return "Less Then";
+            case GE: return "Greater or Equals";
+            case LE: return "Less of Equal";
+            case SA: return "Starts After";
+            case EB: return "Ends Before";
+            case AP: return "Approximately";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchComparatorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchComparatorEnumFactory.java
new file mode 100644
index 00000000000..bb442908309
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchComparatorEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SearchComparatorEnumFactory implements EnumFactory {
+
+  public SearchComparator fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("eq".equals(codeString))
+      return SearchComparator.EQ;
+    if ("ne".equals(codeString))
+      return SearchComparator.NE;
+    if ("gt".equals(codeString))
+      return SearchComparator.GT;
+    if ("lt".equals(codeString))
+      return SearchComparator.LT;
+    if ("ge".equals(codeString))
+      return SearchComparator.GE;
+    if ("le".equals(codeString))
+      return SearchComparator.LE;
+    if ("sa".equals(codeString))
+      return SearchComparator.SA;
+    if ("eb".equals(codeString))
+      return SearchComparator.EB;
+    if ("ap".equals(codeString))
+      return SearchComparator.AP;
+    throw new IllegalArgumentException("Unknown SearchComparator code '"+codeString+"'");
+  }
+
+  public String toCode(SearchComparator code) {
+    if (code == SearchComparator.EQ)
+      return "eq";
+    if (code == SearchComparator.NE)
+      return "ne";
+    if (code == SearchComparator.GT)
+      return "gt";
+    if (code == SearchComparator.LT)
+      return "lt";
+    if (code == SearchComparator.GE)
+      return "ge";
+    if (code == SearchComparator.LE)
+      return "le";
+    if (code == SearchComparator.SA)
+      return "sa";
+    if (code == SearchComparator.EB)
+      return "eb";
+    if (code == SearchComparator.AP)
+      return "ap";
+    return "?";
+  }
+
+    public String toSystem(SearchComparator code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchEntryMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchEntryMode.java
new file mode 100644
index 00000000000..4ab8150c5ec
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchEntryMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SearchEntryMode {
+
+        /**
+         * This resource matched the search specification.
+         */
+        MATCH, 
+        /**
+         * This resource is returned because it is referred to from another resource in the search set.
+         */
+        INCLUDE, 
+        /**
+         * An OperationOutcome that provides additional information about the processing of a search.
+         */
+        OUTCOME, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SearchEntryMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("match".equals(codeString))
+          return MATCH;
+        if ("include".equals(codeString))
+          return INCLUDE;
+        if ("outcome".equals(codeString))
+          return OUTCOME;
+        throw new FHIRException("Unknown SearchEntryMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MATCH: return "match";
+            case INCLUDE: return "include";
+            case OUTCOME: return "outcome";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/search-entry-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MATCH: return "This resource matched the search specification.";
+            case INCLUDE: return "This resource is returned because it is referred to from another resource in the search set.";
+            case OUTCOME: return "An OperationOutcome that provides additional information about the processing of a search.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MATCH: return "Match";
+            case INCLUDE: return "Include";
+            case OUTCOME: return "Outcome";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchEntryModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchEntryModeEnumFactory.java
new file mode 100644
index 00000000000..bbd8473fd19
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchEntryModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SearchEntryModeEnumFactory implements EnumFactory {
+
+  public SearchEntryMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("match".equals(codeString))
+      return SearchEntryMode.MATCH;
+    if ("include".equals(codeString))
+      return SearchEntryMode.INCLUDE;
+    if ("outcome".equals(codeString))
+      return SearchEntryMode.OUTCOME;
+    throw new IllegalArgumentException("Unknown SearchEntryMode code '"+codeString+"'");
+  }
+
+  public String toCode(SearchEntryMode code) {
+    if (code == SearchEntryMode.MATCH)
+      return "match";
+    if (code == SearchEntryMode.INCLUDE)
+      return "include";
+    if (code == SearchEntryMode.OUTCOME)
+      return "outcome";
+    return "?";
+  }
+
+    public String toSystem(SearchEntryMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchModifierCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchModifierCode.java
new file mode 100644
index 00000000000..93af26044f2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchModifierCode.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SearchModifierCode {
+
+        /**
+         * The search parameter returns resources that have a value or not.
+         */
+        MISSING, 
+        /**
+         * The search parameter returns resources that have a value that exactly matches the supplied parameter (the whole string, including casing and accents).
+         */
+        EXACT, 
+        /**
+         * The search parameter returns resources that include the supplied parameter value anywhere within the field being searched.
+         */
+        CONTAINS, 
+        /**
+         * The search parameter returns resources that do not contain a match.
+         */
+        NOT, 
+        /**
+         * The search parameter is processed as a string that searches text associated with the code/value - either CodeableConcept.text, Coding.display, or Identifier.type.text.
+         */
+        TEXT, 
+        /**
+         * The search parameter is a URI (relative or absolute) that identifies a value set, and the search parameter tests whether the coding is in the specified value set.
+         */
+        IN, 
+        /**
+         * The search parameter is a URI (relative or absolute) that identifies a value set, and the search parameter tests whether the coding is not in the specified value set.
+         */
+        NOTIN, 
+        /**
+         * The search parameter tests whether the value in a resource is subsumed by the specified value (is-a, or hierarchical relationships).
+         */
+        BELOW, 
+        /**
+         * The search parameter tests whether the value in a resource subsumes the specified value (is-a, or hierarchical relationships).
+         */
+        ABOVE, 
+        /**
+         * The search parameter only applies to the Resource Type specified as a modifier (e.g. the modifier is not actually :type, but :Patient etc.).
+         */
+        TYPE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SearchModifierCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("missing".equals(codeString))
+          return MISSING;
+        if ("exact".equals(codeString))
+          return EXACT;
+        if ("contains".equals(codeString))
+          return CONTAINS;
+        if ("not".equals(codeString))
+          return NOT;
+        if ("text".equals(codeString))
+          return TEXT;
+        if ("in".equals(codeString))
+          return IN;
+        if ("not-in".equals(codeString))
+          return NOTIN;
+        if ("below".equals(codeString))
+          return BELOW;
+        if ("above".equals(codeString))
+          return ABOVE;
+        if ("type".equals(codeString))
+          return TYPE;
+        throw new FHIRException("Unknown SearchModifierCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MISSING: return "missing";
+            case EXACT: return "exact";
+            case CONTAINS: return "contains";
+            case NOT: return "not";
+            case TEXT: return "text";
+            case IN: return "in";
+            case NOTIN: return "not-in";
+            case BELOW: return "below";
+            case ABOVE: return "above";
+            case TYPE: return "type";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/search-modifier-code";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MISSING: return "The search parameter returns resources that have a value or not.";
+            case EXACT: return "The search parameter returns resources that have a value that exactly matches the supplied parameter (the whole string, including casing and accents).";
+            case CONTAINS: return "The search parameter returns resources that include the supplied parameter value anywhere within the field being searched.";
+            case NOT: return "The search parameter returns resources that do not contain a match.";
+            case TEXT: return "The search parameter is processed as a string that searches text associated with the code/value - either CodeableConcept.text, Coding.display, or Identifier.type.text.";
+            case IN: return "The search parameter is a URI (relative or absolute) that identifies a value set, and the search parameter tests whether the coding is in the specified value set.";
+            case NOTIN: return "The search parameter is a URI (relative or absolute) that identifies a value set, and the search parameter tests whether the coding is not in the specified value set.";
+            case BELOW: return "The search parameter tests whether the value in a resource is subsumed by the specified value (is-a, or hierarchical relationships).";
+            case ABOVE: return "The search parameter tests whether the value in a resource subsumes the specified value (is-a, or hierarchical relationships).";
+            case TYPE: return "The search parameter only applies to the Resource Type specified as a modifier (e.g. the modifier is not actually :type, but :Patient etc.).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MISSING: return "Missing";
+            case EXACT: return "Exact";
+            case CONTAINS: return "Contains";
+            case NOT: return "Not";
+            case TEXT: return "Text";
+            case IN: return "In";
+            case NOTIN: return "Not In";
+            case BELOW: return "Below";
+            case ABOVE: return "Above";
+            case TYPE: return "Type";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchModifierCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchModifierCodeEnumFactory.java
new file mode 100644
index 00000000000..e1ee5838379
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchModifierCodeEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SearchModifierCodeEnumFactory implements EnumFactory {
+
+  public SearchModifierCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("missing".equals(codeString))
+      return SearchModifierCode.MISSING;
+    if ("exact".equals(codeString))
+      return SearchModifierCode.EXACT;
+    if ("contains".equals(codeString))
+      return SearchModifierCode.CONTAINS;
+    if ("not".equals(codeString))
+      return SearchModifierCode.NOT;
+    if ("text".equals(codeString))
+      return SearchModifierCode.TEXT;
+    if ("in".equals(codeString))
+      return SearchModifierCode.IN;
+    if ("not-in".equals(codeString))
+      return SearchModifierCode.NOTIN;
+    if ("below".equals(codeString))
+      return SearchModifierCode.BELOW;
+    if ("above".equals(codeString))
+      return SearchModifierCode.ABOVE;
+    if ("type".equals(codeString))
+      return SearchModifierCode.TYPE;
+    throw new IllegalArgumentException("Unknown SearchModifierCode code '"+codeString+"'");
+  }
+
+  public String toCode(SearchModifierCode code) {
+    if (code == SearchModifierCode.MISSING)
+      return "missing";
+    if (code == SearchModifierCode.EXACT)
+      return "exact";
+    if (code == SearchModifierCode.CONTAINS)
+      return "contains";
+    if (code == SearchModifierCode.NOT)
+      return "not";
+    if (code == SearchModifierCode.TEXT)
+      return "text";
+    if (code == SearchModifierCode.IN)
+      return "in";
+    if (code == SearchModifierCode.NOTIN)
+      return "not-in";
+    if (code == SearchModifierCode.BELOW)
+      return "below";
+    if (code == SearchModifierCode.ABOVE)
+      return "above";
+    if (code == SearchModifierCode.TYPE)
+      return "type";
+    return "?";
+  }
+
+    public String toSystem(SearchModifierCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchParamType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchParamType.java
new file mode 100644
index 00000000000..4038e91d61c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchParamType.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SearchParamType {
+
+        /**
+         * Search parameter SHALL be a number (a whole number, or a decimal).
+         */
+        NUMBER, 
+        /**
+         * Search parameter is on a date/time. The date format is the standard XML format, though other formats may be supported.
+         */
+        DATE, 
+        /**
+         * Search parameter is a simple string, like a name part. Search is case-insensitive and accent-insensitive. May match just the start of a string. String parameters may contain spaces.
+         */
+        STRING, 
+        /**
+         * Search parameter on a coded element or identifier. May be used to search through the text, displayname, code and code/codesystem (for codes) and label, system and key (for identifier). Its value is either a string or a pair of namespace and value, separated by a "|", depending on the modifier used.
+         */
+        TOKEN, 
+        /**
+         * A reference to another resource.
+         */
+        REFERENCE, 
+        /**
+         * A composite search parameter that combines a search on two values together.
+         */
+        COMPOSITE, 
+        /**
+         * A search parameter that searches on a quantity.
+         */
+        QUANTITY, 
+        /**
+         * A search parameter that searches on a URI (RFC 3986).
+         */
+        URI, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SearchParamType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("number".equals(codeString))
+          return NUMBER;
+        if ("date".equals(codeString))
+          return DATE;
+        if ("string".equals(codeString))
+          return STRING;
+        if ("token".equals(codeString))
+          return TOKEN;
+        if ("reference".equals(codeString))
+          return REFERENCE;
+        if ("composite".equals(codeString))
+          return COMPOSITE;
+        if ("quantity".equals(codeString))
+          return QUANTITY;
+        if ("uri".equals(codeString))
+          return URI;
+        throw new FHIRException("Unknown SearchParamType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NUMBER: return "number";
+            case DATE: return "date";
+            case STRING: return "string";
+            case TOKEN: return "token";
+            case REFERENCE: return "reference";
+            case COMPOSITE: return "composite";
+            case QUANTITY: return "quantity";
+            case URI: return "uri";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/search-param-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NUMBER: return "Search parameter SHALL be a number (a whole number, or a decimal).";
+            case DATE: return "Search parameter is on a date/time. The date format is the standard XML format, though other formats may be supported.";
+            case STRING: return "Search parameter is a simple string, like a name part. Search is case-insensitive and accent-insensitive. May match just the start of a string. String parameters may contain spaces.";
+            case TOKEN: return "Search parameter on a coded element or identifier. May be used to search through the text, displayname, code and code/codesystem (for codes) and label, system and key (for identifier). Its value is either a string or a pair of namespace and value, separated by a \"|\", depending on the modifier used.";
+            case REFERENCE: return "A reference to another resource.";
+            case COMPOSITE: return "A composite search parameter that combines a search on two values together.";
+            case QUANTITY: return "A search parameter that searches on a quantity.";
+            case URI: return "A search parameter that searches on a URI (RFC 3986).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NUMBER: return "Number";
+            case DATE: return "Date/DateTime";
+            case STRING: return "String";
+            case TOKEN: return "Token";
+            case REFERENCE: return "Reference";
+            case COMPOSITE: return "Composite";
+            case QUANTITY: return "Quantity";
+            case URI: return "URI";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchParamTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchParamTypeEnumFactory.java
new file mode 100644
index 00000000000..3853868d1f5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchParamTypeEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SearchParamTypeEnumFactory implements EnumFactory {
+
+  public SearchParamType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("number".equals(codeString))
+      return SearchParamType.NUMBER;
+    if ("date".equals(codeString))
+      return SearchParamType.DATE;
+    if ("string".equals(codeString))
+      return SearchParamType.STRING;
+    if ("token".equals(codeString))
+      return SearchParamType.TOKEN;
+    if ("reference".equals(codeString))
+      return SearchParamType.REFERENCE;
+    if ("composite".equals(codeString))
+      return SearchParamType.COMPOSITE;
+    if ("quantity".equals(codeString))
+      return SearchParamType.QUANTITY;
+    if ("uri".equals(codeString))
+      return SearchParamType.URI;
+    throw new IllegalArgumentException("Unknown SearchParamType code '"+codeString+"'");
+  }
+
+  public String toCode(SearchParamType code) {
+    if (code == SearchParamType.NUMBER)
+      return "number";
+    if (code == SearchParamType.DATE)
+      return "date";
+    if (code == SearchParamType.STRING)
+      return "string";
+    if (code == SearchParamType.TOKEN)
+      return "token";
+    if (code == SearchParamType.REFERENCE)
+      return "reference";
+    if (code == SearchParamType.COMPOSITE)
+      return "composite";
+    if (code == SearchParamType.QUANTITY)
+      return "quantity";
+    if (code == SearchParamType.URI)
+      return "uri";
+    return "?";
+  }
+
+    public String toSystem(SearchParamType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchXpathUsage.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchXpathUsage.java
new file mode 100644
index 00000000000..9d025d03133
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchXpathUsage.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SearchXpathUsage {
+
+        /**
+         * The search parameter is derived directly from the selected nodes based on the type definitions.
+         */
+        NORMAL, 
+        /**
+         * The search parameter is derived by a phonetic transform from the selected nodes.
+         */
+        PHONETIC, 
+        /**
+         * The search parameter is based on a spatial transform of the selected nodes.
+         */
+        NEARBY, 
+        /**
+         * The search parameter is based on a spatial transform of the selected nodes, using physical distance from the middle.
+         */
+        DISTANCE, 
+        /**
+         * The interpretation of the xpath statement is unknown (and can't be automated).
+         */
+        OTHER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SearchXpathUsage fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("normal".equals(codeString))
+          return NORMAL;
+        if ("phonetic".equals(codeString))
+          return PHONETIC;
+        if ("nearby".equals(codeString))
+          return NEARBY;
+        if ("distance".equals(codeString))
+          return DISTANCE;
+        if ("other".equals(codeString))
+          return OTHER;
+        throw new FHIRException("Unknown SearchXpathUsage code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case PHONETIC: return "phonetic";
+            case NEARBY: return "nearby";
+            case DISTANCE: return "distance";
+            case OTHER: return "other";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/search-xpath-usage";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NORMAL: return "The search parameter is derived directly from the selected nodes based on the type definitions.";
+            case PHONETIC: return "The search parameter is derived by a phonetic transform from the selected nodes.";
+            case NEARBY: return "The search parameter is based on a spatial transform of the selected nodes.";
+            case DISTANCE: return "The search parameter is based on a spatial transform of the selected nodes, using physical distance from the middle.";
+            case OTHER: return "The interpretation of the xpath statement is unknown (and can't be automated).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NORMAL: return "Normal";
+            case PHONETIC: return "Phonetic";
+            case NEARBY: return "Nearby";
+            case DISTANCE: return "Distance";
+            case OTHER: return "Other";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchXpathUsageEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchXpathUsageEnumFactory.java
new file mode 100644
index 00000000000..23b2e3a187e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SearchXpathUsageEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SearchXpathUsageEnumFactory implements EnumFactory {
+
+  public SearchXpathUsage fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("normal".equals(codeString))
+      return SearchXpathUsage.NORMAL;
+    if ("phonetic".equals(codeString))
+      return SearchXpathUsage.PHONETIC;
+    if ("nearby".equals(codeString))
+      return SearchXpathUsage.NEARBY;
+    if ("distance".equals(codeString))
+      return SearchXpathUsage.DISTANCE;
+    if ("other".equals(codeString))
+      return SearchXpathUsage.OTHER;
+    throw new IllegalArgumentException("Unknown SearchXpathUsage code '"+codeString+"'");
+  }
+
+  public String toCode(SearchXpathUsage code) {
+    if (code == SearchXpathUsage.NORMAL)
+      return "normal";
+    if (code == SearchXpathUsage.PHONETIC)
+      return "phonetic";
+    if (code == SearchXpathUsage.NEARBY)
+      return "nearby";
+    if (code == SearchXpathUsage.DISTANCE)
+      return "distance";
+    if (code == SearchXpathUsage.OTHER)
+      return "other";
+    return "?";
+  }
+
+    public String toSystem(SearchXpathUsage code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SequenceType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SequenceType.java
new file mode 100644
index 00000000000..2b758391c83
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SequenceType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SequenceType {
+
+        /**
+         * Amino acid sequence
+         */
+        AA, 
+        /**
+         * DNA Sequence
+         */
+        DNA, 
+        /**
+         * RNA Sequence
+         */
+        RNA, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SequenceType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("aa".equals(codeString))
+          return AA;
+        if ("dna".equals(codeString))
+          return DNA;
+        if ("rna".equals(codeString))
+          return RNA;
+        throw new FHIRException("Unknown SequenceType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AA: return "aa";
+            case DNA: return "dna";
+            case RNA: return "rna";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/sequence-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AA: return "Amino acid sequence";
+            case DNA: return "DNA Sequence";
+            case RNA: return "RNA Sequence";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AA: return "AA Sequence";
+            case DNA: return "DNA Sequence";
+            case RNA: return "RNA Sequence";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SequenceTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SequenceTypeEnumFactory.java
new file mode 100644
index 00000000000..e4cbbadf02d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SequenceTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SequenceTypeEnumFactory implements EnumFactory {
+
+  public SequenceType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("aa".equals(codeString))
+      return SequenceType.AA;
+    if ("dna".equals(codeString))
+      return SequenceType.DNA;
+    if ("rna".equals(codeString))
+      return SequenceType.RNA;
+    throw new IllegalArgumentException("Unknown SequenceType code '"+codeString+"'");
+  }
+
+  public String toCode(SequenceType code) {
+    if (code == SequenceType.AA)
+      return "aa";
+    if (code == SequenceType.DNA)
+      return "dna";
+    if (code == SequenceType.RNA)
+      return "rna";
+    return "?";
+  }
+
+    public String toSystem(SequenceType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceCategory.java
new file mode 100644
index 00000000000..eb256f92421
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceCategory.java
@@ -0,0 +1,411 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ServiceCategory {
+
+        /**
+         * Adoption
+         */
+        _1, 
+        /**
+         * Aged Care
+         */
+        _2, 
+        /**
+         * Allied Health
+         */
+        _34, 
+        /**
+         * Alternative & Complementary Therapies
+         */
+        _3, 
+        /**
+         * Child Care and/or Kindergarten
+         */
+        _4, 
+        /**
+         * Child Development
+         */
+        _5, 
+        /**
+         * Child Protection & Family Services
+         */
+        _6, 
+        /**
+         * Community Health Care
+         */
+        _7, 
+        /**
+         * Counselling
+         */
+        _8, 
+        /**
+         * Crisis Line (GPAH use only)
+         */
+        _36, 
+        /**
+         * Death Services
+         */
+        _9, 
+        /**
+         * Dental
+         */
+        _10, 
+        /**
+         * Disability Support
+         */
+        _11, 
+        /**
+         * Drug/Alcohol
+         */
+        _12, 
+        /**
+         * Education & Learning
+         */
+        _13, 
+        /**
+         * Emergency Department
+         */
+        _14, 
+        /**
+         * Employment
+         */
+        _15, 
+        /**
+         * Financial & Material aid
+         */
+        _16, 
+        /**
+         * General Practice/GP (doctor)
+         */
+        _17, 
+        /**
+         * Hospital
+         */
+        _35, 
+        /**
+         * Housing/Homelessness
+         */
+        _18, 
+        /**
+         * Interpreting
+         */
+        _19, 
+        /**
+         * Justice
+         */
+        _20, 
+        /**
+         * Legal
+         */
+        _21, 
+        /**
+         * Mental Health
+         */
+        _22, 
+        /**
+         * NDIA
+         */
+        _38, 
+        /**
+         * Physical Activity & Recreation
+         */
+        _23, 
+        /**
+         * Regulation
+         */
+        _24, 
+        /**
+         * Respite/Carer Support
+         */
+        _25, 
+        /**
+         * Specialist Clinical Pathology - requires referral
+         */
+        _26, 
+        /**
+         * Specialist Medical - requires referral
+         */
+        _27, 
+        /**
+         * Specialist Obstetrics & Gynaecology - requires referral
+         */
+        _28, 
+        /**
+         * Specialist Paediatric - requires referral
+         */
+        _29, 
+        /**
+         * Specialist Radiology/Imaging - requires referral
+         */
+        _30, 
+        /**
+         * Specialist Surgical - requires referral
+         */
+        _31, 
+        /**
+         * Support group/s
+         */
+        _32, 
+        /**
+         * Test Message (HSD admin use only)
+         */
+        _37, 
+        /**
+         * Transport
+         */
+        _33, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ServiceCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("34".equals(codeString))
+          return _34;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("6".equals(codeString))
+          return _6;
+        if ("7".equals(codeString))
+          return _7;
+        if ("8".equals(codeString))
+          return _8;
+        if ("36".equals(codeString))
+          return _36;
+        if ("9".equals(codeString))
+          return _9;
+        if ("10".equals(codeString))
+          return _10;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        if ("16".equals(codeString))
+          return _16;
+        if ("17".equals(codeString))
+          return _17;
+        if ("35".equals(codeString))
+          return _35;
+        if ("18".equals(codeString))
+          return _18;
+        if ("19".equals(codeString))
+          return _19;
+        if ("20".equals(codeString))
+          return _20;
+        if ("21".equals(codeString))
+          return _21;
+        if ("22".equals(codeString))
+          return _22;
+        if ("38".equals(codeString))
+          return _38;
+        if ("23".equals(codeString))
+          return _23;
+        if ("24".equals(codeString))
+          return _24;
+        if ("25".equals(codeString))
+          return _25;
+        if ("26".equals(codeString))
+          return _26;
+        if ("27".equals(codeString))
+          return _27;
+        if ("28".equals(codeString))
+          return _28;
+        if ("29".equals(codeString))
+          return _29;
+        if ("30".equals(codeString))
+          return _30;
+        if ("31".equals(codeString))
+          return _31;
+        if ("32".equals(codeString))
+          return _32;
+        if ("37".equals(codeString))
+          return _37;
+        if ("33".equals(codeString))
+          return _33;
+        throw new FHIRException("Unknown ServiceCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _34: return "34";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _8: return "8";
+            case _36: return "36";
+            case _9: return "9";
+            case _10: return "10";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            case _16: return "16";
+            case _17: return "17";
+            case _35: return "35";
+            case _18: return "18";
+            case _19: return "19";
+            case _20: return "20";
+            case _21: return "21";
+            case _22: return "22";
+            case _38: return "38";
+            case _23: return "23";
+            case _24: return "24";
+            case _25: return "25";
+            case _26: return "26";
+            case _27: return "27";
+            case _28: return "28";
+            case _29: return "29";
+            case _30: return "30";
+            case _31: return "31";
+            case _32: return "32";
+            case _37: return "37";
+            case _33: return "33";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/service-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "Adoption";
+            case _2: return "Aged Care";
+            case _34: return "Allied Health";
+            case _3: return "Alternative & Complementary Therapies";
+            case _4: return "Child Care and/or Kindergarten";
+            case _5: return "Child Development";
+            case _6: return "Child Protection & Family Services";
+            case _7: return "Community Health Care";
+            case _8: return "Counselling";
+            case _36: return "Crisis Line (GPAH use only)";
+            case _9: return "Death Services";
+            case _10: return "Dental";
+            case _11: return "Disability Support";
+            case _12: return "Drug/Alcohol";
+            case _13: return "Education & Learning";
+            case _14: return "Emergency Department";
+            case _15: return "Employment";
+            case _16: return "Financial & Material aid";
+            case _17: return "General Practice/GP (doctor)";
+            case _35: return "Hospital";
+            case _18: return "Housing/Homelessness";
+            case _19: return "Interpreting";
+            case _20: return "Justice";
+            case _21: return "Legal";
+            case _22: return "Mental Health";
+            case _38: return "NDIA";
+            case _23: return "Physical Activity & Recreation";
+            case _24: return "Regulation";
+            case _25: return "Respite/Carer Support";
+            case _26: return "Specialist Clinical Pathology - requires referral";
+            case _27: return "Specialist Medical - requires referral";
+            case _28: return "Specialist Obstetrics & Gynaecology - requires referral";
+            case _29: return "Specialist Paediatric - requires referral";
+            case _30: return "Specialist Radiology/Imaging - requires referral";
+            case _31: return "Specialist Surgical - requires referral";
+            case _32: return "Support group/s";
+            case _37: return "Test Message (HSD admin use only)";
+            case _33: return "Transport";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Adoption";
+            case _2: return "Aged Care";
+            case _34: return "Allied Health";
+            case _3: return "Alternative/Complementary Therapies";
+            case _4: return "Child Care /Kindergarten";
+            case _5: return "Child Development";
+            case _6: return "Child Protection & Family Services";
+            case _7: return "Community Health Care";
+            case _8: return "Counselling";
+            case _36: return "Crisis Line (GPAH use only)";
+            case _9: return "Death Services";
+            case _10: return "Dental";
+            case _11: return "Disability Support";
+            case _12: return "Drug/Alcohol";
+            case _13: return "Education & Learning";
+            case _14: return "Emergency Department";
+            case _15: return "Employment";
+            case _16: return "Financial & Material Aid";
+            case _17: return "General Practice";
+            case _35: return "Hospital";
+            case _18: return "Housing/Homelessness";
+            case _19: return "Interpreting";
+            case _20: return "Justice";
+            case _21: return "Legal";
+            case _22: return "Mental Health";
+            case _38: return "NDIA";
+            case _23: return "Physical Activity & Recreation";
+            case _24: return "Regulation";
+            case _25: return "Respite/Carer Support";
+            case _26: return "Specialist Clinical Pathology";
+            case _27: return "Specialist Medical";
+            case _28: return "Specialist Obstetrics & Gynaecology";
+            case _29: return "Specialist Paediatric";
+            case _30: return "Specialist Radiology/Imaging";
+            case _31: return "Specialist Surgical";
+            case _32: return "Support Group/s";
+            case _37: return "Test Message (HSD admin)";
+            case _33: return "Transport";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceCategoryEnumFactory.java
new file mode 100644
index 00000000000..68f8f185683
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceCategoryEnumFactory.java
@@ -0,0 +1,206 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ServiceCategoryEnumFactory implements EnumFactory {
+
+  public ServiceCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return ServiceCategory._1;
+    if ("2".equals(codeString))
+      return ServiceCategory._2;
+    if ("34".equals(codeString))
+      return ServiceCategory._34;
+    if ("3".equals(codeString))
+      return ServiceCategory._3;
+    if ("4".equals(codeString))
+      return ServiceCategory._4;
+    if ("5".equals(codeString))
+      return ServiceCategory._5;
+    if ("6".equals(codeString))
+      return ServiceCategory._6;
+    if ("7".equals(codeString))
+      return ServiceCategory._7;
+    if ("8".equals(codeString))
+      return ServiceCategory._8;
+    if ("36".equals(codeString))
+      return ServiceCategory._36;
+    if ("9".equals(codeString))
+      return ServiceCategory._9;
+    if ("10".equals(codeString))
+      return ServiceCategory._10;
+    if ("11".equals(codeString))
+      return ServiceCategory._11;
+    if ("12".equals(codeString))
+      return ServiceCategory._12;
+    if ("13".equals(codeString))
+      return ServiceCategory._13;
+    if ("14".equals(codeString))
+      return ServiceCategory._14;
+    if ("15".equals(codeString))
+      return ServiceCategory._15;
+    if ("16".equals(codeString))
+      return ServiceCategory._16;
+    if ("17".equals(codeString))
+      return ServiceCategory._17;
+    if ("35".equals(codeString))
+      return ServiceCategory._35;
+    if ("18".equals(codeString))
+      return ServiceCategory._18;
+    if ("19".equals(codeString))
+      return ServiceCategory._19;
+    if ("20".equals(codeString))
+      return ServiceCategory._20;
+    if ("21".equals(codeString))
+      return ServiceCategory._21;
+    if ("22".equals(codeString))
+      return ServiceCategory._22;
+    if ("38".equals(codeString))
+      return ServiceCategory._38;
+    if ("23".equals(codeString))
+      return ServiceCategory._23;
+    if ("24".equals(codeString))
+      return ServiceCategory._24;
+    if ("25".equals(codeString))
+      return ServiceCategory._25;
+    if ("26".equals(codeString))
+      return ServiceCategory._26;
+    if ("27".equals(codeString))
+      return ServiceCategory._27;
+    if ("28".equals(codeString))
+      return ServiceCategory._28;
+    if ("29".equals(codeString))
+      return ServiceCategory._29;
+    if ("30".equals(codeString))
+      return ServiceCategory._30;
+    if ("31".equals(codeString))
+      return ServiceCategory._31;
+    if ("32".equals(codeString))
+      return ServiceCategory._32;
+    if ("37".equals(codeString))
+      return ServiceCategory._37;
+    if ("33".equals(codeString))
+      return ServiceCategory._33;
+    throw new IllegalArgumentException("Unknown ServiceCategory code '"+codeString+"'");
+  }
+
+  public String toCode(ServiceCategory code) {
+    if (code == ServiceCategory._1)
+      return "1";
+    if (code == ServiceCategory._2)
+      return "2";
+    if (code == ServiceCategory._34)
+      return "34";
+    if (code == ServiceCategory._3)
+      return "3";
+    if (code == ServiceCategory._4)
+      return "4";
+    if (code == ServiceCategory._5)
+      return "5";
+    if (code == ServiceCategory._6)
+      return "6";
+    if (code == ServiceCategory._7)
+      return "7";
+    if (code == ServiceCategory._8)
+      return "8";
+    if (code == ServiceCategory._36)
+      return "36";
+    if (code == ServiceCategory._9)
+      return "9";
+    if (code == ServiceCategory._10)
+      return "10";
+    if (code == ServiceCategory._11)
+      return "11";
+    if (code == ServiceCategory._12)
+      return "12";
+    if (code == ServiceCategory._13)
+      return "13";
+    if (code == ServiceCategory._14)
+      return "14";
+    if (code == ServiceCategory._15)
+      return "15";
+    if (code == ServiceCategory._16)
+      return "16";
+    if (code == ServiceCategory._17)
+      return "17";
+    if (code == ServiceCategory._35)
+      return "35";
+    if (code == ServiceCategory._18)
+      return "18";
+    if (code == ServiceCategory._19)
+      return "19";
+    if (code == ServiceCategory._20)
+      return "20";
+    if (code == ServiceCategory._21)
+      return "21";
+    if (code == ServiceCategory._22)
+      return "22";
+    if (code == ServiceCategory._38)
+      return "38";
+    if (code == ServiceCategory._23)
+      return "23";
+    if (code == ServiceCategory._24)
+      return "24";
+    if (code == ServiceCategory._25)
+      return "25";
+    if (code == ServiceCategory._26)
+      return "26";
+    if (code == ServiceCategory._27)
+      return "27";
+    if (code == ServiceCategory._28)
+      return "28";
+    if (code == ServiceCategory._29)
+      return "29";
+    if (code == ServiceCategory._30)
+      return "30";
+    if (code == ServiceCategory._31)
+      return "31";
+    if (code == ServiceCategory._32)
+      return "32";
+    if (code == ServiceCategory._37)
+      return "37";
+    if (code == ServiceCategory._33)
+      return "33";
+    return "?";
+  }
+
+    public String toSystem(ServiceCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceModifiers.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceModifiers.java
new file mode 100644
index 00000000000..14d7349a2b5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceModifiers.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ServiceModifiers {
+
+        /**
+         * Services provided on the side of the raod or such other non-conventional setting.
+         */
+        SR, 
+        /**
+         * Services provided outside or normal business hours.
+         */
+        AH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ServiceModifiers fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("sr".equals(codeString))
+          return SR;
+        if ("ah".equals(codeString))
+          return AH;
+        throw new FHIRException("Unknown ServiceModifiers code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SR: return "sr";
+            case AH: return "ah";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-servicemodifier";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SR: return "Services provided on the side of the raod or such other non-conventional setting.";
+            case AH: return "Services provided outside or normal business hours.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SR: return "Side of the Road";
+            case AH: return "After hours";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceModifiersEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceModifiersEnumFactory.java
new file mode 100644
index 00000000000..ff02bb76ff5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceModifiersEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ServiceModifiersEnumFactory implements EnumFactory {
+
+  public ServiceModifiers fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("sr".equals(codeString))
+      return ServiceModifiers.SR;
+    if ("ah".equals(codeString))
+      return ServiceModifiers.AH;
+    throw new IllegalArgumentException("Unknown ServiceModifiers code '"+codeString+"'");
+  }
+
+  public String toCode(ServiceModifiers code) {
+    if (code == ServiceModifiers.SR)
+      return "sr";
+    if (code == ServiceModifiers.AH)
+      return "ah";
+    return "?";
+  }
+
+    public String toSystem(ServiceModifiers code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePharmacy.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePharmacy.java
new file mode 100644
index 00000000000..534cf5887b9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePharmacy.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ServicePharmacy {
+
+        /**
+         * Smoking cessation
+         */
+        SMOKECESS, 
+        /**
+         * Flu Shot
+         */
+        FLUSHOT, 
+        /**
+         * The wholesale price of the medication.
+         */
+        DRUGCOST, 
+        /**
+         * The additional cost assessed on the drug.
+         */
+        MARKUP, 
+        /**
+         * The professional fee charged for dispensing the product or service.
+         */
+        DISPENSEFEE, 
+        /**
+         * The professional fee charged for compounding the medication.
+         */
+        COMPOUNDFEE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ServicePharmacy fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("smokecess".equals(codeString))
+          return SMOKECESS;
+        if ("flushot".equals(codeString))
+          return FLUSHOT;
+        if ("drugcost".equals(codeString))
+          return DRUGCOST;
+        if ("markup".equals(codeString))
+          return MARKUP;
+        if ("dispensefee".equals(codeString))
+          return DISPENSEFEE;
+        if ("compoundfee".equals(codeString))
+          return COMPOUNDFEE;
+        throw new FHIRException("Unknown ServicePharmacy code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SMOKECESS: return "smokecess";
+            case FLUSHOT: return "flushot";
+            case DRUGCOST: return "drugcost";
+            case MARKUP: return "markup";
+            case DISPENSEFEE: return "dispensefee";
+            case COMPOUNDFEE: return "compoundfee";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-pharmaservice";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SMOKECESS: return "Smoking cessation";
+            case FLUSHOT: return "Flu Shot";
+            case DRUGCOST: return "The wholesale price of the medication.";
+            case MARKUP: return "The additional cost assessed on the drug.";
+            case DISPENSEFEE: return "The professional fee charged for dispensing the product or service.";
+            case COMPOUNDFEE: return "The professional fee charged for compounding the medication.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SMOKECESS: return "Smoking cessation";
+            case FLUSHOT: return "Flu Shot";
+            case DRUGCOST: return "Drug Cost";
+            case MARKUP: return "Markup";
+            case DISPENSEFEE: return "Dispense Fee";
+            case COMPOUNDFEE: return "Compounding Fee";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePharmacyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePharmacyEnumFactory.java
new file mode 100644
index 00000000000..9a59da6a5c5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePharmacyEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ServicePharmacyEnumFactory implements EnumFactory {
+
+  public ServicePharmacy fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("smokecess".equals(codeString))
+      return ServicePharmacy.SMOKECESS;
+    if ("flushot".equals(codeString))
+      return ServicePharmacy.FLUSHOT;
+    if ("drugcost".equals(codeString))
+      return ServicePharmacy.DRUGCOST;
+    if ("markup".equals(codeString))
+      return ServicePharmacy.MARKUP;
+    if ("dispensefee".equals(codeString))
+      return ServicePharmacy.DISPENSEFEE;
+    if ("compoundfee".equals(codeString))
+      return ServicePharmacy.COMPOUNDFEE;
+    throw new IllegalArgumentException("Unknown ServicePharmacy code '"+codeString+"'");
+  }
+
+  public String toCode(ServicePharmacy code) {
+    if (code == ServicePharmacy.SMOKECESS)
+      return "smokecess";
+    if (code == ServicePharmacy.FLUSHOT)
+      return "flushot";
+    if (code == ServicePharmacy.DRUGCOST)
+      return "drugcost";
+    if (code == ServicePharmacy.MARKUP)
+      return "markup";
+    if (code == ServicePharmacy.DISPENSEFEE)
+      return "dispensefee";
+    if (code == ServicePharmacy.COMPOUNDFEE)
+      return "compoundfee";
+    return "?";
+  }
+
+    public String toSystem(ServicePharmacy code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePlace.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePlace.java
new file mode 100644
index 00000000000..0f6319b04e8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePlace.java
@@ -0,0 +1,222 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ServicePlace {
+
+        /**
+         * A facility or location where drugs and other medically related items and services are sold, dispensed, or otherwise provided directly to patients.
+         */
+        _01, 
+        /**
+         * A facility whose primary purpose is education.
+         */
+        _03, 
+        /**
+         * A facility or location whose primary purpose is to provide temporary housing to homeless individuals (e.g., emergency shelters, individual or family shelters).
+         */
+        _04, 
+        /**
+         * A facility or location, owned and operated by the Indian Health Service, which provides diagnostic, therapeutic (surgical and nonsurgical), and rehabilitation services to American Indians and Alaska Natives who do not require hospitalization.
+         */
+        _05, 
+        /**
+         * A facility or location, owned and operated by the Indian Health Service, which provides diagnostic, therapeutic (surgical and nonsurgical), and rehabilitation services rendered by, or under the supervision of, physicians to American Indians and Alaska Natives admitted as inpatients or outpatients.
+         */
+        _06, 
+        /**
+         * A facility or location owned and operated by a federally recognized American Indian or Alaska Native tribe or tribal organization under a 638 agreement, which provides diagnostic, therapeutic (surgical and nonsurgical), and rehabilitation services to tribal members who do not require hospitalization.
+         */
+        _07, 
+        /**
+         * A facility or location owned and operated by a federally recognized American Indian or Alaska Native tribe or tribal organization under a 638 agreement, which provides diagnostic, therapeutic (surgical and nonsurgical), and rehabilitation services to tribal members admitted as inpatients or outpatients.
+         */
+        _08, 
+        /**
+         * A prison, jail, reformatory, work farm, detention center, or any other similar facility maintained by either Federal, State or local authorities for the purpose of confinement or rehabilitation of adult or juvenile criminal offenders.
+         */
+        _09, 
+        /**
+         * Location, other than a hospital, skilled nursing facility (SNF), military treatment facility, community health center, State or local public health clinic, or intermediate care facility (ICF), where the health professional routinely provides health examinations, diagnosis, and treatment of illness or injury on an ambulatory basis.
+         */
+        _11, 
+        /**
+         * Location, other than a hospital or other facility, where the patient receives care in a private residence.
+         */
+        _12, 
+        /**
+         * Congregate residential facility with self-contained living units providing assessment of each resident's needs and on-site support 24 hours a day, 7 days a week, with the capacity to deliver or arrange for services including some health care and other services.
+         */
+        _13, 
+        /**
+         * A residence, with shared living areas, where clients receive supervision and other services such as social and/or behavioral services, custodial service, and minimal services (e.g., medication administration).
+         */
+        _14, 
+        /**
+         * A facility/unit that moves from place-to-place equipped to provide preventive, screening, diagnostic, and/or treatment services.
+         */
+        _15, 
+        /**
+         * portion of an off-campus hospital provider based department which provides diagnostic, therapeutic (both surgical and nonsurgical), and rehabilitation services to sick or injured persons who do not require hospitalization or institutionalization.
+         */
+        _19, 
+        /**
+         * Location, distinct from a hospital emergency room, an office, or a clinic, whose purpose is to diagnose and treat illness or injury for unscheduled, ambulatory patients seeking immediate medical attention.
+         */
+        _20, 
+        /**
+         * A facility, other than psychiatric, which primarily provides diagnostic, therapeutic (both surgical and nonsurgical), and rehabilitation services by, or under, the supervision of physicians to patients admitted for a variety of medical conditions.
+         */
+        _21, 
+        /**
+         * A land vehicle specifically designed, equipped and staffed for lifesaving and transporting the sick or injured.
+         */
+        _41, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ServicePlace fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("01".equals(codeString))
+          return _01;
+        if ("03".equals(codeString))
+          return _03;
+        if ("04".equals(codeString))
+          return _04;
+        if ("05".equals(codeString))
+          return _05;
+        if ("06".equals(codeString))
+          return _06;
+        if ("07".equals(codeString))
+          return _07;
+        if ("08".equals(codeString))
+          return _08;
+        if ("09".equals(codeString))
+          return _09;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        if ("19".equals(codeString))
+          return _19;
+        if ("20".equals(codeString))
+          return _20;
+        if ("21".equals(codeString))
+          return _21;
+        if ("41".equals(codeString))
+          return _41;
+        throw new FHIRException("Unknown ServicePlace code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _01: return "01";
+            case _03: return "03";
+            case _04: return "04";
+            case _05: return "05";
+            case _06: return "06";
+            case _07: return "07";
+            case _08: return "08";
+            case _09: return "09";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            case _19: return "19";
+            case _20: return "20";
+            case _21: return "21";
+            case _41: return "41";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-serviceplace";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _01: return "A facility or location where drugs and other medically related items and services are sold, dispensed, or otherwise provided directly to patients.";
+            case _03: return "A facility whose primary purpose is education.";
+            case _04: return "A facility or location whose primary purpose is to provide temporary housing to homeless individuals (e.g., emergency shelters, individual or family shelters).";
+            case _05: return "A facility or location, owned and operated by the Indian Health Service, which provides diagnostic, therapeutic (surgical and nonsurgical), and rehabilitation services to American Indians and Alaska Natives who do not require hospitalization.";
+            case _06: return "A facility or location, owned and operated by the Indian Health Service, which provides diagnostic, therapeutic (surgical and nonsurgical), and rehabilitation services rendered by, or under the supervision of, physicians to American Indians and Alaska Natives admitted as inpatients or outpatients.";
+            case _07: return "A facility or location owned and operated by a federally recognized American Indian or Alaska Native tribe or tribal organization under a 638 agreement, which provides diagnostic, therapeutic (surgical and nonsurgical), and rehabilitation services to tribal members who do not require hospitalization.";
+            case _08: return "A facility or location owned and operated by a federally recognized American Indian or Alaska Native tribe or tribal organization under a 638 agreement, which provides diagnostic, therapeutic (surgical and nonsurgical), and rehabilitation services to tribal members admitted as inpatients or outpatients.";
+            case _09: return "A prison, jail, reformatory, work farm, detention center, or any other similar facility maintained by either Federal, State or local authorities for the purpose of confinement or rehabilitation of adult or juvenile criminal offenders.";
+            case _11: return "Location, other than a hospital, skilled nursing facility (SNF), military treatment facility, community health center, State or local public health clinic, or intermediate care facility (ICF), where the health professional routinely provides health examinations, diagnosis, and treatment of illness or injury on an ambulatory basis.";
+            case _12: return "Location, other than a hospital or other facility, where the patient receives care in a private residence.";
+            case _13: return "Congregate residential facility with self-contained living units providing assessment of each resident's needs and on-site support 24 hours a day, 7 days a week, with the capacity to deliver or arrange for services including some health care and other services.";
+            case _14: return "A residence, with shared living areas, where clients receive supervision and other services such as social and/or behavioral services, custodial service, and minimal services (e.g., medication administration).";
+            case _15: return "A facility/unit that moves from place-to-place equipped to provide preventive, screening, diagnostic, and/or treatment services.";
+            case _19: return "portion of an off-campus hospital provider based department which provides diagnostic, therapeutic (both surgical and nonsurgical), and rehabilitation services to sick or injured persons who do not require hospitalization or institutionalization.";
+            case _20: return "Location, distinct from a hospital emergency room, an office, or a clinic, whose purpose is to diagnose and treat illness or injury for unscheduled, ambulatory patients seeking immediate medical attention.";
+            case _21: return "A facility, other than psychiatric, which primarily provides diagnostic, therapeutic (both surgical and nonsurgical), and rehabilitation services by, or under, the supervision of physicians to patients admitted for a variety of medical conditions.";
+            case _41: return "A land vehicle specifically designed, equipped and staffed for lifesaving and transporting the sick or injured.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _01: return "Pharmacy";
+            case _03: return "School";
+            case _04: return "Homeless Shelter";
+            case _05: return "Indian Health Service Free-standing Facility";
+            case _06: return "Indian Health Service Provider-based Facility";
+            case _07: return "Tribal 638 Free-Standing Facility";
+            case _08: return "Tribal 638 Provider-Based Facility";
+            case _09: return "Prison/Correctional Facility";
+            case _11: return "Office";
+            case _12: return "Home";
+            case _13: return "Assisted Living Fa";
+            case _14: return "Group Home";
+            case _15: return "Mobile Unit";
+            case _19: return "Off Campus-Outpatient Hospital";
+            case _20: return "Urgent Care Facility";
+            case _21: return "Inpatient Hospital";
+            case _41: return "Ambulance—Land";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePlaceEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePlaceEnumFactory.java
new file mode 100644
index 00000000000..6e752c04fe3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServicePlaceEnumFactory.java
@@ -0,0 +1,122 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ServicePlaceEnumFactory implements EnumFactory {
+
+  public ServicePlace fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("01".equals(codeString))
+      return ServicePlace._01;
+    if ("03".equals(codeString))
+      return ServicePlace._03;
+    if ("04".equals(codeString))
+      return ServicePlace._04;
+    if ("05".equals(codeString))
+      return ServicePlace._05;
+    if ("06".equals(codeString))
+      return ServicePlace._06;
+    if ("07".equals(codeString))
+      return ServicePlace._07;
+    if ("08".equals(codeString))
+      return ServicePlace._08;
+    if ("09".equals(codeString))
+      return ServicePlace._09;
+    if ("11".equals(codeString))
+      return ServicePlace._11;
+    if ("12".equals(codeString))
+      return ServicePlace._12;
+    if ("13".equals(codeString))
+      return ServicePlace._13;
+    if ("14".equals(codeString))
+      return ServicePlace._14;
+    if ("15".equals(codeString))
+      return ServicePlace._15;
+    if ("19".equals(codeString))
+      return ServicePlace._19;
+    if ("20".equals(codeString))
+      return ServicePlace._20;
+    if ("21".equals(codeString))
+      return ServicePlace._21;
+    if ("41".equals(codeString))
+      return ServicePlace._41;
+    throw new IllegalArgumentException("Unknown ServicePlace code '"+codeString+"'");
+  }
+
+  public String toCode(ServicePlace code) {
+    if (code == ServicePlace._01)
+      return "01";
+    if (code == ServicePlace._03)
+      return "03";
+    if (code == ServicePlace._04)
+      return "04";
+    if (code == ServicePlace._05)
+      return "05";
+    if (code == ServicePlace._06)
+      return "06";
+    if (code == ServicePlace._07)
+      return "07";
+    if (code == ServicePlace._08)
+      return "08";
+    if (code == ServicePlace._09)
+      return "09";
+    if (code == ServicePlace._11)
+      return "11";
+    if (code == ServicePlace._12)
+      return "12";
+    if (code == ServicePlace._13)
+      return "13";
+    if (code == ServicePlace._14)
+      return "14";
+    if (code == ServicePlace._15)
+      return "15";
+    if (code == ServicePlace._19)
+      return "19";
+    if (code == ServicePlace._20)
+      return "20";
+    if (code == ServicePlace._21)
+      return "21";
+    if (code == ServicePlace._41)
+      return "41";
+    return "?";
+  }
+
+    public String toSystem(ServicePlace code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProduct.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProduct.java
new file mode 100644
index 00000000000..ee888e9f607
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProduct.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ServiceProduct {
+
+        /**
+         * Exam
+         */
+        EXAM, 
+        /**
+         * Flu shot
+         */
+        FLUSHOT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ServiceProduct fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("exam".equals(codeString))
+          return EXAM;
+        if ("flushot".equals(codeString))
+          return FLUSHOT;
+        throw new FHIRException("Unknown ServiceProduct code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case EXAM: return "exam";
+            case FLUSHOT: return "flushot";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-serviceproduct";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case EXAM: return "Exam";
+            case FLUSHOT: return "Flu shot";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case EXAM: return "Exam";
+            case FLUSHOT: return "Flu shot";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProductEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProductEnumFactory.java
new file mode 100644
index 00000000000..33a65ba7a68
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProductEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ServiceProductEnumFactory implements EnumFactory {
+
+  public ServiceProduct fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("exam".equals(codeString))
+      return ServiceProduct.EXAM;
+    if ("flushot".equals(codeString))
+      return ServiceProduct.FLUSHOT;
+    throw new IllegalArgumentException("Unknown ServiceProduct code '"+codeString+"'");
+  }
+
+  public String toCode(ServiceProduct code) {
+    if (code == ServiceProduct.EXAM)
+      return "exam";
+    if (code == ServiceProduct.FLUSHOT)
+      return "flushot";
+    return "?";
+  }
+
+    public String toSystem(ServiceProduct code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProvisionConditions.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProvisionConditions.java
new file mode 100644
index 00000000000..6b882945048
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProvisionConditions.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ServiceProvisionConditions {
+
+        /**
+         * This service is available for no patient cost.
+         */
+        FREE, 
+        /**
+         * There are discounts available on this service for qualifying patients.
+         */
+        DISC, 
+        /**
+         * Fees apply for this service.
+         */
+        COST, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ServiceProvisionConditions fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("free".equals(codeString))
+          return FREE;
+        if ("disc".equals(codeString))
+          return DISC;
+        if ("cost".equals(codeString))
+          return COST;
+        throw new FHIRException("Unknown ServiceProvisionConditions code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FREE: return "free";
+            case DISC: return "disc";
+            case COST: return "cost";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/service-provision-conditions";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FREE: return "This service is available for no patient cost.";
+            case DISC: return "There are discounts available on this service for qualifying patients.";
+            case COST: return "Fees apply for this service.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FREE: return "Free";
+            case DISC: return "Discounts Available";
+            case COST: return "Fees apply";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProvisionConditionsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProvisionConditionsEnumFactory.java
new file mode 100644
index 00000000000..e382428e832
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceProvisionConditionsEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ServiceProvisionConditionsEnumFactory implements EnumFactory {
+
+  public ServiceProvisionConditions fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("free".equals(codeString))
+      return ServiceProvisionConditions.FREE;
+    if ("disc".equals(codeString))
+      return ServiceProvisionConditions.DISC;
+    if ("cost".equals(codeString))
+      return ServiceProvisionConditions.COST;
+    throw new IllegalArgumentException("Unknown ServiceProvisionConditions code '"+codeString+"'");
+  }
+
+  public String toCode(ServiceProvisionConditions code) {
+    if (code == ServiceProvisionConditions.FREE)
+      return "free";
+    if (code == ServiceProvisionConditions.DISC)
+      return "disc";
+    if (code == ServiceProvisionConditions.COST)
+      return "cost";
+    return "?";
+  }
+
+    public String toSystem(ServiceProvisionConditions code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceReferralMethod.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceReferralMethod.java
new file mode 100644
index 00000000000..fb566dff82c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceReferralMethod.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ServiceReferralMethod {
+
+        /**
+         * Referrals may be accepted by fax.
+         */
+        FAX, 
+        /**
+         * Referrals may be accepted over the phone from a practitioner.
+         */
+        PHONE, 
+        /**
+         * Referrals may be accepted via a secure messaging system. To determine the types of secure messaging systems supported, refer to the identifiers collection. Callers will need to understand the specific identifier system used to know that they are able to transmit messages.
+         */
+        ELEC, 
+        /**
+         * Referrals may be accepted via a secure email. To send please encrypt with the services public key.
+         */
+        SEMAIL, 
+        /**
+         * Referrals may be accepted via regular postage (or hand delivered).
+         */
+        MAIL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ServiceReferralMethod fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("fax".equals(codeString))
+          return FAX;
+        if ("phone".equals(codeString))
+          return PHONE;
+        if ("elec".equals(codeString))
+          return ELEC;
+        if ("semail".equals(codeString))
+          return SEMAIL;
+        if ("mail".equals(codeString))
+          return MAIL;
+        throw new FHIRException("Unknown ServiceReferralMethod code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FAX: return "fax";
+            case PHONE: return "phone";
+            case ELEC: return "elec";
+            case SEMAIL: return "semail";
+            case MAIL: return "mail";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/service-referral-method";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FAX: return "Referrals may be accepted by fax.";
+            case PHONE: return "Referrals may be accepted over the phone from a practitioner.";
+            case ELEC: return "Referrals may be accepted via a secure messaging system. To determine the types of secure messaging systems supported, refer to the identifiers collection. Callers will need to understand the specific identifier system used to know that they are able to transmit messages.";
+            case SEMAIL: return "Referrals may be accepted via a secure email. To send please encrypt with the services public key.";
+            case MAIL: return "Referrals may be accepted via regular postage (or hand delivered).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FAX: return "Fax";
+            case PHONE: return "Phone";
+            case ELEC: return "Secure Messaging";
+            case SEMAIL: return "Secure Email";
+            case MAIL: return "Mail";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceReferralMethodEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceReferralMethodEnumFactory.java
new file mode 100644
index 00000000000..2b712e3c73c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceReferralMethodEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ServiceReferralMethodEnumFactory implements EnumFactory {
+
+  public ServiceReferralMethod fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("fax".equals(codeString))
+      return ServiceReferralMethod.FAX;
+    if ("phone".equals(codeString))
+      return ServiceReferralMethod.PHONE;
+    if ("elec".equals(codeString))
+      return ServiceReferralMethod.ELEC;
+    if ("semail".equals(codeString))
+      return ServiceReferralMethod.SEMAIL;
+    if ("mail".equals(codeString))
+      return ServiceReferralMethod.MAIL;
+    throw new IllegalArgumentException("Unknown ServiceReferralMethod code '"+codeString+"'");
+  }
+
+  public String toCode(ServiceReferralMethod code) {
+    if (code == ServiceReferralMethod.FAX)
+      return "fax";
+    if (code == ServiceReferralMethod.PHONE)
+      return "phone";
+    if (code == ServiceReferralMethod.ELEC)
+      return "elec";
+    if (code == ServiceReferralMethod.SEMAIL)
+      return "semail";
+    if (code == ServiceReferralMethod.MAIL)
+      return "mail";
+    return "?";
+  }
+
+    public String toSystem(ServiceReferralMethod code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceType.java
new file mode 100644
index 00000000000..0a7562f8f2a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceType.java
@@ -0,0 +1,5433 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ServiceType {
+
+        /**
+         * Adoption & permanent care information/support
+         */
+        _1, 
+        /**
+         * Aged care assessment
+         */
+        _2, 
+        /**
+         * Aged Care information/referral
+         */
+        _3, 
+        /**
+         * Aged Residential Care
+         */
+        _4, 
+        /**
+         * Case management for older persons
+         */
+        _5, 
+        /**
+         * Delivered meals (meals on wheels)
+         */
+        _6, 
+        /**
+         * Friendly visiting
+         */
+        _7, 
+        /**
+         * Home care/housekeeping assistance
+         */
+        _8, 
+        /**
+         * Home maintenance and repair
+         */
+        _9, 
+        /**
+         * Personal alarms/alerts
+         */
+        _10, 
+        /**
+         * Personal care for older persons
+         */
+        _11, 
+        /**
+         * Planned activity groups
+         */
+        _12, 
+        /**
+         * Acupuncture
+         */
+        _13, 
+        /**
+         * Alexander technique therapy
+         */
+        _14, 
+        /**
+         * Aromatherapy
+         */
+        _15, 
+        /**
+         * Biorhythm services
+         */
+        _16, 
+        /**
+         * Bowen therapy
+         */
+        _17, 
+        /**
+         * Chinese herbal medicine
+         */
+        _18, 
+        /**
+         * Feldenkrais
+         */
+        _19, 
+        /**
+         * Homoeopathy
+         */
+        _20, 
+        /**
+         * Hydrotherapy
+         */
+        _21, 
+        /**
+         * Hypnotherapy
+         */
+        _22, 
+        /**
+         * Kinesiology
+         */
+        _23, 
+        /**
+         * Magnetic therapy
+         */
+        _24, 
+        /**
+         * Massage therapy
+         */
+        _25, 
+        /**
+         * Meditation
+         */
+        _26, 
+        /**
+         * Myotherapy
+         */
+        _27, 
+        /**
+         * Naturopathy
+         */
+        _28, 
+        /**
+         * Reflexology
+         */
+        _29, 
+        /**
+         * Reiki
+         */
+        _30, 
+        /**
+         * Relaxation therapy
+         */
+        _31, 
+        /**
+         * Shiatsu
+         */
+        _32, 
+        /**
+         * Western herbal medicine
+         */
+        _33, 
+        /**
+         * Family day care
+         */
+        _34, 
+        /**
+         * Holiday programs
+         */
+        _35, 
+        /**
+         * Kindergarten inclusion support for children with a disability
+         */
+        _36, 
+        /**
+         * Kindergarten/preschool
+         */
+        _37, 
+        /**
+         * Long day child care
+         */
+        _38, 
+        /**
+         * Occasional child care
+         */
+        _39, 
+        /**
+         * Outside school hours care
+         */
+        _40, 
+        /**
+         * Children's play programs
+         */
+        _41, 
+        /**
+         * Parenting & family management support/education
+         */
+        _42, 
+        /**
+         * Playgroup
+         */
+        _43, 
+        /**
+         * School nursing
+         */
+        _44, 
+        /**
+         * Toy library
+         */
+        _45, 
+        /**
+         * Child protection/child abuse report
+         */
+        _46, 
+        /**
+         * Foster care
+         */
+        _47, 
+        /**
+         * Residential/ out of home care
+         */
+        _48, 
+        /**
+         * Support for young people leaving care
+         */
+        _49, 
+        /**
+         * Audiology
+         */
+        _50, 
+        /**
+         * Blood donation
+         */
+        _51, 
+        /**
+         * Chiropractic
+         */
+        _52, 
+        /**
+         * Dietetics
+         */
+        _53, 
+        /**
+         * Family planning
+         */
+        _54, 
+        /**
+         * Health advocacy/Liaison service
+         */
+        _55, 
+        /**
+         * Health information/referral
+         */
+        _56, 
+        /**
+         * Immunization
+         */
+        _57, 
+        /**
+         * Maternal & child health
+         */
+        _58, 
+        /**
+         * Nursing
+         */
+        _59, 
+        /**
+         * Nutrition
+         */
+        _60, 
+        /**
+         * Occupational therapy
+         */
+        _61, 
+        /**
+         * Optometry
+         */
+        _62, 
+        /**
+         * Osteopathy
+         */
+        _63, 
+        /**
+         * Pharmacy
+         */
+        _64, 
+        /**
+         * Physiotherapy
+         */
+        _65, 
+        /**
+         * Podiatry
+         */
+        _66, 
+        /**
+         * Sexual health
+         */
+        _67, 
+        /**
+         * Speech pathology/therapy
+         */
+        _68, 
+        /**
+         * Bereavement counselling
+         */
+        _69, 
+        /**
+         * Crisis counselling
+         */
+        _70, 
+        /**
+         * Family counselling and/or family therapy
+         */
+        _71, 
+        /**
+         * Family violence counselling
+         */
+        _72, 
+        /**
+         * Financial counselling
+         */
+        _73, 
+        /**
+         * Generalist counselling
+         */
+        _74, 
+        /**
+         * Genetic counselling
+         */
+        _75, 
+        /**
+         * Health counselling
+         */
+        _76, 
+        /**
+         * Mediation
+         */
+        _77, 
+        /**
+         * Problem gambling counselling
+         */
+        _78, 
+        /**
+         * Relationship counselling
+         */
+        _79, 
+        /**
+         * Sexual assault counselling
+         */
+        _80, 
+        /**
+         * Trauma counselling
+         */
+        _81, 
+        /**
+         * Victims of crime counselling
+         */
+        _82, 
+        /**
+         * Cemetery operation
+         */
+        _83, 
+        /**
+         * Cremation
+         */
+        _84, 
+        /**
+         * Death service information
+         */
+        _85, 
+        /**
+         * Funeral services
+         */
+        _86, 
+        /**
+         * Endodontic
+         */
+        _87, 
+        /**
+         * General dental
+         */
+        _88, 
+        /**
+         * Oral medicine
+         */
+        _89, 
+        /**
+         * Oral surgery
+         */
+        _90, 
+        /**
+         * Orthodontic
+         */
+        _91, 
+        /**
+         * Paediatric Dentistry
+         */
+        _92, 
+        /**
+         * Periodontic
+         */
+        _93, 
+        /**
+         * Prosthodontic
+         */
+        _94, 
+        /**
+         * Acquired brain injury information/referral
+         */
+        _95, 
+        /**
+         * Disability advocacy
+         */
+        _96, 
+        /**
+         * Disability aids & equipment
+         */
+        _97, 
+        /**
+         * Disability case management
+         */
+        _98, 
+        /**
+         * Disability day programs & activities
+         */
+        _99, 
+        /**
+         * Disability information/referral
+         */
+        _100, 
+        /**
+         * Disability support packages
+         */
+        _101, 
+        /**
+         * Disability supported accommodation
+         */
+        _102, 
+        /**
+         * Early childhood intervention
+         */
+        _103, 
+        /**
+         * Hearing aids & equipment
+         */
+        _104, 
+        /**
+         * Drug and/or alcohol counselling
+         */
+        _105, 
+        /**
+         * Drug and/or alcohol information/referral
+         */
+        _106, 
+        /**
+         * Needle & Syringe exchange
+         */
+        _107, 
+        /**
+         * Non-residential alcohol and/or drug dependence treatment
+         */
+        _108, 
+        /**
+         * Pharmacotherapy (eg. methadone) program
+         */
+        _109, 
+        /**
+         * Quit program
+         */
+        _110, 
+        /**
+         * Residential alcohol and/or drug dependence treatment
+         */
+        _111, 
+        /**
+         * Adult/community education
+         */
+        _112, 
+        /**
+         * Higher education
+         */
+        _113, 
+        /**
+         * Primary education
+         */
+        _114, 
+        /**
+         * Secondary education
+         */
+        _115, 
+        /**
+         * Training & vocational education
+         */
+        _116, 
+        /**
+         * Emergency medical
+         */
+        _117, 
+        /**
+         * Employment placement and/or support
+         */
+        _118, 
+        /**
+         * Vocational Rehabilitation
+         */
+        _119, 
+        /**
+         * Workplace safety and/or accident prevention
+         */
+        _120, 
+        /**
+         * Financial assistance
+         */
+        _121, 
+        /**
+         * Financial information/advice
+         */
+        _122, 
+        /**
+         * Material aid
+         */
+        _123, 
+        /**
+         * General Practice/GP (doctor)
+         */
+        _124, 
+        /**
+         * Accommodation placement and/or support
+         */
+        _125, 
+        /**
+         * Crisis/emergency accommodation
+         */
+        _126, 
+        /**
+         * Homelessness support
+         */
+        _127, 
+        /**
+         * Housing information/referral
+         */
+        _128, 
+        /**
+         * Public rental housing
+         */
+        _129, 
+        /**
+         * Interpreting/Multilingual/Language service
+         */
+        _130, 
+        /**
+         * Juvenile Justice
+         */
+        _131, 
+        /**
+         * Legal advocacy
+         */
+        _132, 
+        /**
+         * Legal information/advice/referral
+         */
+        _133, 
+        /**
+         * Mental health advocacy
+         */
+        _134, 
+        /**
+         * Mental health assessment/triage/crisis response
+         */
+        _135, 
+        /**
+         * Mental health case management/continuing care
+         */
+        _136, 
+        /**
+         * Mental health information/referral
+         */
+        _137, 
+        /**
+         * Mental health inpatient services (hospital psychiatric unit) - requires referral
+         */
+        _138, 
+        /**
+         * Mental health non-residential rehabilitation
+         */
+        _139, 
+        /**
+         * Mental health residential rehabilitation/community care unit
+         */
+        _140, 
+        /**
+         * Psychiatry (requires referral)
+         */
+        _141, 
+        /**
+         * Psychology
+         */
+        _142, 
+        /**
+         * Martial arts
+         */
+        _143, 
+        /**
+         * Personal fitness training
+         */
+        _144, 
+        /**
+         * Physical activity group
+         */
+        _145, 
+        /**
+         * Physical activity programs
+         */
+        _146, 
+        /**
+         * Physical fitness testing
+         */
+        _147, 
+        /**
+         * Pilates
+         */
+        _148, 
+        /**
+         * Self defence
+         */
+        _149, 
+        /**
+         * Sporting club
+         */
+        _150, 
+        /**
+         * Yoga
+         */
+        _151, 
+        /**
+         * Food safety
+         */
+        _152, 
+        /**
+         * Health regulatory, inspection and/or certification
+         */
+        _153, 
+        /**
+         * Workplace health and/or safety inspection and/or certification
+         */
+        _154, 
+        /**
+         * Carer support
+         */
+        _155, 
+        /**
+         * Respite care
+         */
+        _156, 
+        /**
+         * Anatomical Pathology (including Cytopathology & Forensic Pathology)
+         */
+        _157, 
+        /**
+         * Pathology - Clinical Chemistry
+         */
+        _158, 
+        /**
+         * Pathology - General
+         */
+        _159, 
+        /**
+         * Pathology - Genetics
+         */
+        _160, 
+        /**
+         * Pathology - Haematology
+         */
+        _161, 
+        /**
+         * Pathology - Immunology
+         */
+        _162, 
+        /**
+         * Pathology - Microbiology
+         */
+        _163, 
+        /**
+         * Anaesthesiology - Pain Medicine
+         */
+        _164, 
+        /**
+         * Cardiology
+         */
+        _165, 
+        /**
+         * Clinical Genetics
+         */
+        _166, 
+        /**
+         * Clinical Pharmacology
+         */
+        _167, 
+        /**
+         * Dermatology
+         */
+        _168, 
+        /**
+         * Endocrinology
+         */
+        _169, 
+        /**
+         * Gastroenterology & Hepatology
+         */
+        _170, 
+        /**
+         * Geriatric medicine
+         */
+        _171, 
+        /**
+         * Immunology & Allergy
+         */
+        _172, 
+        /**
+         * Infectious diseases
+         */
+        _173, 
+        /**
+         * Intensive care medicine
+         */
+        _174, 
+        /**
+         * Medical Oncology
+         */
+        _175, 
+        /**
+         * Nephrology
+         */
+        _176, 
+        /**
+         * Neurology
+         */
+        _177, 
+        /**
+         * Occupational Medicine
+         */
+        _178, 
+        /**
+         * Palliative Medicine
+         */
+        _179, 
+        /**
+         * Public Health Medicine
+         */
+        _180, 
+        /**
+         * Rehabilitation Medicine
+         */
+        _181, 
+        /**
+         * Rheumatology
+         */
+        _182, 
+        /**
+         * Sleep Medicine
+         */
+        _183, 
+        /**
+         * Thoracic medicine
+         */
+        _184, 
+        /**
+         * Gynaecological Oncology
+         */
+        _185, 
+        /**
+         * Obstetrics & Gynaecology
+         */
+        _186, 
+        /**
+         * Reproductive Endocrinology & Infertility
+         */
+        _187, 
+        /**
+         * Urogynaecology
+         */
+        _188, 
+        /**
+         * Neonatology & Perinatology
+         */
+        _189, 
+        /**
+         * Paediatric Cardiology
+         */
+        _190, 
+        /**
+         * Paediatric Clinical Genetics
+         */
+        _191, 
+        /**
+         * Paediatric Clinical Pharmacology
+         */
+        _192, 
+        /**
+         * Paediatric Endocrinology
+         */
+        _193, 
+        /**
+         * Paediatric Gastroenterology & Hepatology
+         */
+        _194, 
+        /**
+         * Paediatric Haematology
+         */
+        _195, 
+        /**
+         * Paediatric Immunology & Allergy
+         */
+        _196, 
+        /**
+         * Paediatric Infectious diseases
+         */
+        _197, 
+        /**
+         * Paediatric intensive care medicine
+         */
+        _198, 
+        /**
+         * Paediatric Medical Oncology
+         */
+        _199, 
+        /**
+         * Paediatric Medicine
+         */
+        _200, 
+        /**
+         * Paediatric Nephrology
+         */
+        _201, 
+        /**
+         * Paediatric Neurology
+         */
+        _202, 
+        /**
+         * Paediatric Nuclear Medicine
+         */
+        _203, 
+        /**
+         * Paediatric Rehabilitation Medicine
+         */
+        _204, 
+        /**
+         * Paediatric Rheumatology
+         */
+        _205, 
+        /**
+         * Paediatric Sleep Medicine
+         */
+        _206, 
+        /**
+         * Paediatric Surgery
+         */
+        _207, 
+        /**
+         * Paediatric Thoracic Medicine
+         */
+        _208, 
+        /**
+         * Diagnostic Radiology/Xray/CT/Fluoroscopy
+         */
+        _209, 
+        /**
+         * Diagnostic Ultrasound
+         */
+        _210, 
+        /**
+         * Magnetic Resonance Imaging (MRI)
+         */
+        _211, 
+        /**
+         * Nuclear Medicine
+         */
+        _212, 
+        /**
+         * Obstetric & Gynaecological Ultrasound
+         */
+        _213, 
+        /**
+         * Radiation oncology
+         */
+        _214, 
+        /**
+         * Cardiothoracic surgery
+         */
+        _215, 
+        /**
+         * Neurosurgery
+         */
+        _216, 
+        /**
+         * Ophthalmology
+         */
+        _217, 
+        /**
+         * Orthopaedic surgery
+         */
+        _218, 
+        /**
+         * Otolaryngology - Head & Neck Surgery
+         */
+        _219, 
+        /**
+         * Plastic & Reconstructive Surgery
+         */
+        _220, 
+        /**
+         * Surgery - General
+         */
+        _221, 
+        /**
+         * Urology
+         */
+        _222, 
+        /**
+         * Vascular surgery
+         */
+        _223, 
+        /**
+         * Support groups
+         */
+        _224, 
+        /**
+         * Air ambulance
+         */
+        _225, 
+        /**
+         * Ambulance
+         */
+        _226, 
+        /**
+         * Blood transport
+         */
+        _227, 
+        /**
+         * Community bus
+         */
+        _228, 
+        /**
+         * Flying doctor service
+         */
+        _229, 
+        /**
+         * Patient transport
+         */
+        _230, 
+        /**
+         * A&E
+         */
+        _231, 
+        /**
+         * A&EP
+         */
+        _232, 
+        /**
+         * Abuse
+         */
+        _233, 
+        /**
+         * ACAS
+         */
+        _234, 
+        /**
+         * Access
+         */
+        _235, 
+        /**
+         * Accident
+         */
+        _236, 
+        /**
+         * Acute Inpatient Service's
+         */
+        _237, 
+        /**
+         * Adult Day Programs
+         */
+        _238, 
+        /**
+         * Adult Mental Health Services
+         */
+        _239, 
+        /**
+         * Advice
+         */
+        _240, 
+        /**
+         * Advocacy
+         */
+        _241, 
+        /**
+         * Aged Persons Mental Health Residential Units
+         */
+        _242, 
+        /**
+         * Aged Persons Mental Health Services
+         */
+        _243, 
+        /**
+         * Aged Persons Mental Health Teams
+         */
+        _244, 
+        /**
+         * Aids
+         */
+        _245, 
+        /**
+         * Al-Anon
+         */
+        _246, 
+        /**
+         * Alcohol
+         */
+        _247, 
+        /**
+         * Al-Teen
+         */
+        _248, 
+        /**
+         * Antenatal
+         */
+        _249, 
+        /**
+         * Anxiety
+         */
+        _250, 
+        /**
+         * Arthritis
+         */
+        _251, 
+        /**
+         * Assessment
+         */
+        _252, 
+        /**
+         * Assistance
+         */
+        _253, 
+        /**
+         * Asthma
+         */
+        _254, 
+        /**
+         * ATSS
+         */
+        _255, 
+        /**
+         * Attendant Care
+         */
+        _256, 
+        /**
+         * Babies
+         */
+        _257, 
+        /**
+         * Bathroom Modification
+         */
+        _258, 
+        /**
+         * Behaviour
+         */
+        _259, 
+        /**
+         * Behaviour Intervention
+         */
+        _260, 
+        /**
+         * Bereavement
+         */
+        _261, 
+        /**
+         * Bipolar
+         */
+        _262, 
+        /**
+         * Birth
+         */
+        _263, 
+        /**
+         * Birth Control
+         */
+        _264, 
+        /**
+         * Birthing Options
+         */
+        _265, 
+        /**
+         * BIST
+         */
+        _266, 
+        /**
+         * Blood
+         */
+        _267, 
+        /**
+         * Bone
+         */
+        _268, 
+        /**
+         * Bowel
+         */
+        _269, 
+        /**
+         * Brain
+         */
+        _270, 
+        /**
+         * Breast Feeding
+         */
+        _271, 
+        /**
+         * Breast Screen
+         */
+        _272, 
+        /**
+         * Brokerage
+         */
+        _273, 
+        /**
+         * Cancer
+         */
+        _274, 
+        /**
+         * Cancer Support
+         */
+        _275, 
+        /**
+         * Cardiovascular Disease
+         */
+        _276, 
+        /**
+         * Care Packages
+         */
+        _277, 
+        /**
+         * Carer
+         */
+        _278, 
+        /**
+         * Case Management
+         */
+        _279, 
+        /**
+         * Casualty
+         */
+        _280, 
+        /**
+         * Centrelink
+         */
+        _281, 
+        /**
+         * Chemists
+         */
+        _282, 
+        /**
+         * Child And Adolescent Mental Health Services
+         */
+        _283, 
+        /**
+         * Child Care
+         */
+        _284, 
+        /**
+         * Child Services
+         */
+        _285, 
+        /**
+         * Children
+         */
+        _286, 
+        /**
+         * Children's Services
+         */
+        _287, 
+        /**
+         * Cholesterol
+         */
+        _288, 
+        /**
+         * Clothing
+         */
+        _289, 
+        /**
+         * Community Based Accommodation
+         */
+        _290, 
+        /**
+         * Community Care Unit
+         */
+        _291, 
+        /**
+         * Community Child And Adolescent Mental Health Services
+         */
+        _292, 
+        /**
+         * Community Health
+         */
+        _293, 
+        /**
+         * Community Residential Unit
+         */
+        _294, 
+        /**
+         * Community Transport
+         */
+        _295, 
+        /**
+         * Companion Visiting
+         */
+        _296, 
+        /**
+         * Companionship
+         */
+        _297, 
+        /**
+         * Consumer Advice
+         */
+        _298, 
+        /**
+         * Consumer Issues
+         */
+        _299, 
+        /**
+         * Continuing Care Services
+         */
+        _300, 
+        /**
+         * Contraception Information
+         */
+        _301, 
+        /**
+         * Coordinating Bodies
+         */
+        _302, 
+        /**
+         * Correctional Services
+         */
+        _303, 
+        /**
+         * Council Environmental Health
+         */
+        _304, 
+        /**
+         * Counselling
+         */
+        _305, 
+        /**
+         * Criminal
+         */
+        _306, 
+        /**
+         * Crises
+         */
+        _307, 
+        /**
+         * Crisis Assessment And Treatment Services (Cats)
+         */
+        _308, 
+        /**
+         * Crisis Assistance
+         */
+        _309, 
+        /**
+         * Crisis Refuge
+         */
+        _310, 
+        /**
+         * Day Program
+         */
+        _311, 
+        /**
+         * Deaf
+         */
+        _312, 
+        /**
+         * Dental Hygiene
+         */
+        _313, 
+        /**
+         * Dentistry
+         */
+        _314, 
+        /**
+         * Dentures
+         */
+        _315, 
+        /**
+         * Depression
+         */
+        _316, 
+        /**
+         * Detoxification
+         */
+        _317, 
+        /**
+         * Diabetes
+         */
+        _318, 
+        /**
+         * Diaphragm Fitting
+         */
+        _319, 
+        /**
+         * Dieticians
+         */
+        _320, 
+        /**
+         * Disabled Parking
+         */
+        _321, 
+        /**
+         * District Nursing
+         */
+        _322, 
+        /**
+         * Divorce
+         */
+        _323, 
+        /**
+         * Doctors
+         */
+        _324, 
+        /**
+         * Drink-Drive
+         */
+        _325, 
+        /**
+         * Dual Diagnosis Services
+         */
+        _326, 
+        /**
+         * Early Choice
+         */
+        _327, 
+        /**
+         * Eating Disorder
+         */
+        _328, 
+        /**
+         * Emergency Relief
+         */
+        _330, 
+        /**
+         * Employment And Training
+         */
+        _331, 
+        /**
+         * Environment
+         */
+        _332, 
+        /**
+         * Equipment
+         */
+        _333, 
+        /**
+         * Exercise
+         */
+        _334, 
+        /**
+         * Facility
+         */
+        _335, 
+        /**
+         * Family Choice
+         */
+        _336, 
+        /**
+         * Family Law
+         */
+        _337, 
+        /**
+         * Family Options
+         */
+        _338, 
+        /**
+         * Family Services
+         */
+        _339, 
+        /**
+         * FFYA
+         */
+        _340, 
+        /**
+         * Financial Aid
+         */
+        _341, 
+        /**
+         * Fitness
+         */
+        _342, 
+        /**
+         * Flexible Care Packages
+         */
+        _343, 
+        /**
+         * Food
+         */
+        _344, 
+        /**
+         * Food Vouchers
+         */
+        _345, 
+        /**
+         * Forensic Mental Health Services
+         */
+        _346, 
+        /**
+         * Futures
+         */
+        _347, 
+        /**
+         * Futures For Young Adults
+         */
+        _348, 
+        /**
+         * General Practitioners
+         */
+        _349, 
+        /**
+         * Grants
+         */
+        _350, 
+        /**
+         * Grief
+         */
+        _351, 
+        /**
+         * Grief Counselling
+         */
+        _352, 
+        /**
+         * HACC
+         */
+        _353, 
+        /**
+         * Heart Disease
+         */
+        _354, 
+        /**
+         * Help
+         */
+        _355, 
+        /**
+         * High Blood Pressure
+         */
+        _356, 
+        /**
+         * Home Help
+         */
+        _357, 
+        /**
+         * Home Nursing
+         */
+        _358, 
+        /**
+         * Homefirst
+         */
+        _359, 
+        /**
+         * Hospice Care
+         */
+        _360, 
+        /**
+         * Hospital Services
+         */
+        _361, 
+        /**
+         * Hospital To Home
+         */
+        _362, 
+        /**
+         * Hostel
+         */
+        _364, 
+        /**
+         * Hostel Accommodation
+         */
+        _365, 
+        /**
+         * Household Items
+         */
+        _366, 
+        /**
+         * Hypertension
+         */
+        _367, 
+        /**
+         * Illness
+         */
+        _368, 
+        /**
+         * Independent Living
+         */
+        _369, 
+        /**
+         * Information
+         */
+        _370, 
+        /**
+         * Injury
+         */
+        _371, 
+        /**
+         * Intake
+         */
+        _372, 
+        /**
+         * Intensive Mobile Youth Outreach Services (Imyos)
+         */
+        _373, 
+        /**
+         * Intervention
+         */
+        _374, 
+        /**
+         * Job Searching
+         */
+        _375, 
+        /**
+         * Justice
+         */
+        _376, 
+        /**
+         * Leisure
+         */
+        _377, 
+        /**
+         * Loans
+         */
+        _378, 
+        /**
+         * Low Income Earners
+         */
+        _379, 
+        /**
+         * Lung
+         */
+        _380, 
+        /**
+         * Making A Difference
+         */
+        _381, 
+        /**
+         * Medical Services
+         */
+        _382, 
+        /**
+         * Medical Specialists
+         */
+        _383, 
+        /**
+         * Medication Administration
+         */
+        _384, 
+        /**
+         * Menstrual Information
+         */
+        _385, 
+        /**
+         * Methadone
+         */
+        _386, 
+        /**
+         * Mobile Support And Treatment Services (MSTS)
+         */
+        _387, 
+        /**
+         * Motor Neurone
+         */
+        _388, 
+        /**
+         * Multiple Sclerosis
+         */
+        _389, 
+        /**
+         * Neighbourhood House
+         */
+        _390, 
+        /**
+         * Nursing Home
+         */
+        _391, 
+        /**
+         * Nursing Mothers
+         */
+        _392, 
+        /**
+         * Obesity
+         */
+        _393, 
+        /**
+         * Occupational Health & Safety
+         */
+        _394, 
+        /**
+         * Optometrist
+         */
+        _395, 
+        /**
+         * Oral Hygiene
+         */
+        _396, 
+        /**
+         * Outpatients
+         */
+        _397, 
+        /**
+         * Outreach Service
+         */
+        _398, 
+        /**
+         * PADP
+         */
+        _399, 
+        /**
+         * Pain
+         */
+        _400, 
+        /**
+         * Pap Smear
+         */
+        _401, 
+        /**
+         * Parenting
+         */
+        _402, 
+        /**
+         * Peak Organisations
+         */
+        _403, 
+        /**
+         * Personal Care
+         */
+        _404, 
+        /**
+         * Pharmacies
+         */
+        _405, 
+        /**
+         * Phobias
+         */
+        _406, 
+        /**
+         * Physical
+         */
+        _407, 
+        /**
+         * Physical Activity
+         */
+        _408, 
+        /**
+         * Postnatal
+         */
+        _409, 
+        /**
+         * Pregnancy
+         */
+        _410, 
+        /**
+         * Pregnancy Tests
+         */
+        _411, 
+        /**
+         * Preschool
+         */
+        _412, 
+        /**
+         * Prescriptions
+         */
+        _413, 
+        /**
+         * Primary Mental Health And Early Intervention Teams
+         */
+        _414, 
+        /**
+         * Property Maintenance
+         */
+        _415, 
+        /**
+         * Prostate
+         */
+        _416, 
+        /**
+         * Psychiatric
+         */
+        _417, 
+        /**
+         * Psychiatric Disability Support Services - Home-Based Outreach
+         */
+        _418, 
+        /**
+         * Psychiatric Disability Support Services - Planned Respite
+         */
+        _419, 
+        /**
+         * Psychiatric Disability Support Services - Residential Rehabilitation
+         */
+        _420, 
+        /**
+         * Psychiatric Disability Support Services Home-Based Outreach
+         */
+        _421, 
+        /**
+         * Psychiatric Disability Support Services Mutual Support And Self Help
+         */
+        _422, 
+        /**
+         * Psychiatric Support
+         */
+        _423, 
+        /**
+         * Recreation
+         */
+        _424, 
+        /**
+         * Referral
+         */
+        _425, 
+        /**
+         * Refuge
+         */
+        _426, 
+        /**
+         * Rent Assistance
+         */
+        _427, 
+        /**
+         * Residential Facilities
+         */
+        _428, 
+        /**
+         * Residential Respite
+         */
+        _429, 
+        /**
+         * Respiratory
+         */
+        _430, 
+        /**
+         * Response
+         */
+        _431, 
+        /**
+         * Rooming Houses
+         */
+        _432, 
+        /**
+         * Safe Sex
+         */
+        _433, 
+        /**
+         * Secure Extended Care Inpatient Services
+         */
+        _434, 
+        /**
+         * Self Help
+         */
+        _435, 
+        /**
+         * Separation
+         */
+        _436, 
+        /**
+         * Services
+         */
+        _437, 
+        /**
+         * Sex Education
+         */
+        _438, 
+        /**
+         * Sexual Abuse
+         */
+        _439, 
+        /**
+         * Sexual Issues
+         */
+        _440, 
+        /**
+         * Sexually Transmitted Diseases
+         */
+        _441, 
+        /**
+         * SIDS
+         */
+        _442, 
+        /**
+         * Social Support
+         */
+        _443, 
+        /**
+         * Socialisation
+         */
+        _444, 
+        /**
+         * Special Needs
+         */
+        _445, 
+        /**
+         * Speech Therapist
+         */
+        _446, 
+        /**
+         * Splinting
+         */
+        _447, 
+        /**
+         * Sport
+         */
+        _448, 
+        /**
+         * Statewide And Specialist Services
+         */
+        _449, 
+        /**
+         * STD
+         */
+        _450, 
+        /**
+         * STI
+         */
+        _451, 
+        /**
+         * Stillbirth
+         */
+        _452, 
+        /**
+         * Stomal Care
+         */
+        _453, 
+        /**
+         * Stroke
+         */
+        _454, 
+        /**
+         * Substance Abuse
+         */
+        _455, 
+        /**
+         * Support
+         */
+        _456, 
+        /**
+         * Syringes
+         */
+        _457, 
+        /**
+         * Teeth
+         */
+        _458, 
+        /**
+         * Tenancy Advice
+         */
+        _459, 
+        /**
+         * Terminal Illness
+         */
+        _460, 
+        /**
+         * Therapy
+         */
+        _461, 
+        /**
+         * Transcription
+         */
+        _462, 
+        /**
+         * Translating Services
+         */
+        _463, 
+        /**
+         * Translator
+         */
+        _464, 
+        /**
+         * Transport
+         */
+        _465, 
+        /**
+         * Vertebrae
+         */
+        _466, 
+        /**
+         * Violence
+         */
+        _467, 
+        /**
+         * Vocational Guidance
+         */
+        _468, 
+        /**
+         * Weight
+         */
+        _469, 
+        /**
+         * Welfare Assistance
+         */
+        _470, 
+        /**
+         * Welfare Counselling
+         */
+        _471, 
+        /**
+         * Wheelchairs
+         */
+        _472, 
+        /**
+         * Wound Management
+         */
+        _473, 
+        /**
+         * Young People At Risk
+         */
+        _474, 
+        /**
+         * Further Description - Community Health Care
+         */
+        _475, 
+        /**
+         * Library
+         */
+        _476, 
+        /**
+         * Community Hours
+         */
+        _477, 
+        /**
+         * Further Description - Specialist Medical
+         */
+        _478, 
+        /**
+         * Hepatology
+         */
+        _479, 
+        /**
+         * Gastroenterology
+         */
+        _480, 
+        /**
+         * Gynaecology
+         */
+        _481, 
+        /**
+         * Obstetrics
+         */
+        _482, 
+        /**
+         * Further Description - Specialist Surgical
+         */
+        _483, 
+        /**
+         * Placement Protection
+         */
+        _484, 
+        /**
+         * Family Violence
+         */
+        _485, 
+        /**
+         * Integrated Family Services
+         */
+        _486, 
+        /**
+         * Diabetes Educator
+         */
+        _488, 
+        /**
+         * Kinship Care
+         */
+        _489, 
+        /**
+         * General Mental Health Services
+         */
+        _490, 
+        /**
+         * Exercise Physiology
+         */
+        _491, 
+        /**
+         * Medical Research
+         */
+        _492, 
+        /**
+         * Youth
+         */
+        _493, 
+        /**
+         * Youth Services
+         */
+        _494, 
+        /**
+         * Youth Health
+         */
+        _495, 
+        /**
+         * Child and Family Services
+         */
+        _496, 
+        /**
+         * Home Visits
+         */
+        _497, 
+        /**
+         * Mobile Services
+         */
+        _498, 
+        /**
+         * Before and/or After School Care
+         */
+        _500, 
+        /**
+         * Cancer Services
+         */
+        _501, 
+        /**
+         * Integrated Cancer Services
+         */
+        _502, 
+        /**
+         * Multidisciplinary Services
+         */
+        _503, 
+        /**
+         * Multidisciplinary Cancer Services
+         */
+        _504, 
+        /**
+         * Meetings
+         */
+        _505, 
+        /**
+         * Blood pressure monitoring
+         */
+        _506, 
+        /**
+         * Dose administration aid
+         */
+        _507, 
+        /**
+         * Medical Equipment Hire
+         */
+        _508, 
+        /**
+         * Parenting & family support/education
+         */
+        _509, 
+        /**
+         * Deputising Service
+         */
+        _510, 
+        /**
+         * Cancer Support Groups
+         */
+        _513, 
+        /**
+         * Community Cancer Services
+         */
+        _514, 
+        /**
+         * Disability Care Transport
+         */
+        _530, 
+        /**
+         * Aged Care Transport
+         */
+        _531, 
+        /**
+         * Diabetes Education service
+         */
+        _532, 
+        /**
+         * Cardiac Rehabilitation Service 
+         */
+        _533, 
+        /**
+         * Young Adult Diabetes services (YADS)
+         */
+        _534, 
+        /**
+         * Pulmonary Rehabilitation Service
+         */
+        _535, 
+        /**
+         * Art therapy
+         */
+        _536, 
+        /**
+         * Medication Reviews
+         */
+        _537, 
+        /**
+         * Telephone Counselling
+         */
+        _538, 
+        /**
+         * Telephone Help Line
+         */
+        _539, 
+        /**
+         * Online Service
+         */
+        _540, 
+        /**
+         * Crisis - Mental Health
+         */
+        _541, 
+        /**
+         * Youth Crisis
+         */
+        _542, 
+        /**
+         * Sexual Assault
+         */
+        _543, 
+        /**
+         * GPAH Other
+         */
+        _544, 
+        /**
+         * Paediatric Dermatology
+         */
+        _545, 
+        /**
+         * Veterans Services
+         */
+        _546, 
+        /**
+         * Veterans
+         */
+        _547, 
+        /**
+         * Food Relief/food/meals
+         */
+        _548, 
+        /**
+         * Dementia Care
+         */
+        _550, 
+        /**
+         * Alzheimer
+         */
+        _551, 
+        /**
+         * Drug and/or alcohol support groups
+         */
+        _552, 
+        /**
+         * One on One Support/Mentoring/Coaching
+         */
+        _553, 
+        /**
+         * Chronic Disease Management
+         */
+        _554, 
+        /**
+         * Liaison Services
+         */
+        _555, 
+        /**
+         * Walk in Centre / non emergency
+         */
+        _556, 
+        /**
+         * Inpatients
+         */
+        _557, 
+        /**
+         * Spiritual Counselling
+         */
+        _558, 
+        /**
+         * Women's Health
+         */
+        _559, 
+        /**
+         * Men's Health
+         */
+        _560, 
+        /**
+         * Health education/Health awareness program
+         */
+        _561, 
+        /**
+         * Test Message
+         */
+        _562, 
+        /**
+         * Remedial Massage
+         */
+        _563, 
+        /**
+         * Adolescent Mental Health Services
+         */
+        _564, 
+        /**
+         * Youth drop in/assistance/support
+         */
+        _565, 
+        /**
+         * Aboriginal Health Worker
+         */
+        _566, 
+        /**
+         * Women's Health Clinic
+         */
+        _567, 
+        /**
+         * Men's Health Clinic 
+         */
+        _568, 
+        /**
+         * Migrant Health Clinic
+         */
+        _569, 
+        /**
+         * Refugee Health Clinic
+         */
+        _570, 
+        /**
+         * Aboriginal Health Clinic
+         */
+        _571, 
+        /**
+         * Nurse Practitioner lead Clinic/s
+         */
+        _572, 
+        /**
+         * Nurse lead Clinic/s
+         */
+        _573, 
+        /**
+         * Culturally tailored support groups
+         */
+        _574, 
+        /**
+         * Culturally tailored health promotion
+         */
+        _575, 
+        /**
+         * Rehabilitation
+         */
+        _576, 
+        /**
+         * Education information/referral
+         */
+        _577, 
+        /**
+         * Social Work
+         */
+        _580, 
+        /**
+         * Haematology
+         */
+        _581, 
+        /**
+         * Maternity Shared Care
+         */
+        _582, 
+        /**
+         * Rehabilitation Service
+         */
+        _583, 
+        /**
+         * Cranio-Sacral Therapy
+         */
+        _584, 
+        /**
+         * Prosthetics & Orthotics
+         */
+        _585, 
+        /**
+         * Home Medicine Review
+         */
+        _589, 
+        /**
+         * GPAH - Medical
+         */
+        _590, 
+        /**
+         * Music Therapy
+         */
+        _591, 
+        /**
+         * Falls Prevention
+         */
+        _593, 
+        /**
+         * Accommodation/Tenancy
+         */
+        _599, 
+        /**
+         * Assess-Skill, Ability, Needs
+         */
+        _600, 
+        /**
+         * Assist Access/Maintain Employ
+         */
+        _601, 
+        /**
+         * Assist Prod-Pers Care/Safety
+         */
+        _602, 
+        /**
+         * Assist-Integrate School/Ed
+         */
+        _603, 
+        /**
+         * Assist-Life Stage, Transition
+         */
+        _604, 
+        /**
+         * Assist-Personal Activities
+         */
+        _605, 
+        /**
+         * Assist-Travel/Transport
+         */
+        _606, 
+        /**
+         * Assistive Equip-General Tasks
+         */
+        _607, 
+        /**
+         * Assistive Equip-Recreation
+         */
+        _608, 
+        /**
+         * Assistive Prod-Household Task
+         */
+        _609, 
+        /**
+         * Behaviour Support
+         */
+        _610, 
+        /**
+         * Comms & Info Equipment
+         */
+        _611, 
+        /**
+         * Community Nursing Care
+         */
+        _612, 
+        /**
+         * Daily Tasks/Shared Living
+         */
+        _613, 
+        /**
+         * Development-Life Skills
+         */
+        _614, 
+        /**
+         * Early Childhood Supports
+         */
+        _615, 
+        /**
+         * Equipment Special Assess Setup
+         */
+        _616, 
+        /**
+         * Hearing Equipment
+         */
+        _617, 
+        /**
+         * Home Modification
+         */
+        _618, 
+        /**
+         * Household Tasks
+         */
+        _619, 
+        /**
+         * Interpret/Translate
+         */
+        _620, 
+        /**
+         * Other Innovative Supports
+         */
+        _621, 
+        /**
+         * Participate Community
+         */
+        _622, 
+        /**
+         * Personal Mobility Equipment
+         */
+        _623, 
+        /**
+         * Physical Wellbeing
+         */
+        _624, 
+        /**
+         * Plan Management
+         */
+        _625, 
+        /**
+         * Therapeutic Supports
+         */
+        _626, 
+        /**
+         * Training-Travel Independence
+         */
+        _627, 
+        /**
+         * Vehicle modifications
+         */
+        _628, 
+        /**
+         * Vision Equipment
+         */
+        _629, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ServiceType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("6".equals(codeString))
+          return _6;
+        if ("7".equals(codeString))
+          return _7;
+        if ("8".equals(codeString))
+          return _8;
+        if ("9".equals(codeString))
+          return _9;
+        if ("10".equals(codeString))
+          return _10;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        if ("16".equals(codeString))
+          return _16;
+        if ("17".equals(codeString))
+          return _17;
+        if ("18".equals(codeString))
+          return _18;
+        if ("19".equals(codeString))
+          return _19;
+        if ("20".equals(codeString))
+          return _20;
+        if ("21".equals(codeString))
+          return _21;
+        if ("22".equals(codeString))
+          return _22;
+        if ("23".equals(codeString))
+          return _23;
+        if ("24".equals(codeString))
+          return _24;
+        if ("25".equals(codeString))
+          return _25;
+        if ("26".equals(codeString))
+          return _26;
+        if ("27".equals(codeString))
+          return _27;
+        if ("28".equals(codeString))
+          return _28;
+        if ("29".equals(codeString))
+          return _29;
+        if ("30".equals(codeString))
+          return _30;
+        if ("31".equals(codeString))
+          return _31;
+        if ("32".equals(codeString))
+          return _32;
+        if ("33".equals(codeString))
+          return _33;
+        if ("34".equals(codeString))
+          return _34;
+        if ("35".equals(codeString))
+          return _35;
+        if ("36".equals(codeString))
+          return _36;
+        if ("37".equals(codeString))
+          return _37;
+        if ("38".equals(codeString))
+          return _38;
+        if ("39".equals(codeString))
+          return _39;
+        if ("40".equals(codeString))
+          return _40;
+        if ("41".equals(codeString))
+          return _41;
+        if ("42".equals(codeString))
+          return _42;
+        if ("43".equals(codeString))
+          return _43;
+        if ("44".equals(codeString))
+          return _44;
+        if ("45".equals(codeString))
+          return _45;
+        if ("46".equals(codeString))
+          return _46;
+        if ("47".equals(codeString))
+          return _47;
+        if ("48".equals(codeString))
+          return _48;
+        if ("49".equals(codeString))
+          return _49;
+        if ("50".equals(codeString))
+          return _50;
+        if ("51".equals(codeString))
+          return _51;
+        if ("52".equals(codeString))
+          return _52;
+        if ("53".equals(codeString))
+          return _53;
+        if ("54".equals(codeString))
+          return _54;
+        if ("55".equals(codeString))
+          return _55;
+        if ("56".equals(codeString))
+          return _56;
+        if ("57".equals(codeString))
+          return _57;
+        if ("58".equals(codeString))
+          return _58;
+        if ("59".equals(codeString))
+          return _59;
+        if ("60".equals(codeString))
+          return _60;
+        if ("61".equals(codeString))
+          return _61;
+        if ("62".equals(codeString))
+          return _62;
+        if ("63".equals(codeString))
+          return _63;
+        if ("64".equals(codeString))
+          return _64;
+        if ("65".equals(codeString))
+          return _65;
+        if ("66".equals(codeString))
+          return _66;
+        if ("67".equals(codeString))
+          return _67;
+        if ("68".equals(codeString))
+          return _68;
+        if ("69".equals(codeString))
+          return _69;
+        if ("70".equals(codeString))
+          return _70;
+        if ("71".equals(codeString))
+          return _71;
+        if ("72".equals(codeString))
+          return _72;
+        if ("73".equals(codeString))
+          return _73;
+        if ("74".equals(codeString))
+          return _74;
+        if ("75".equals(codeString))
+          return _75;
+        if ("76".equals(codeString))
+          return _76;
+        if ("77".equals(codeString))
+          return _77;
+        if ("78".equals(codeString))
+          return _78;
+        if ("79".equals(codeString))
+          return _79;
+        if ("80".equals(codeString))
+          return _80;
+        if ("81".equals(codeString))
+          return _81;
+        if ("82".equals(codeString))
+          return _82;
+        if ("83".equals(codeString))
+          return _83;
+        if ("84".equals(codeString))
+          return _84;
+        if ("85".equals(codeString))
+          return _85;
+        if ("86".equals(codeString))
+          return _86;
+        if ("87".equals(codeString))
+          return _87;
+        if ("88".equals(codeString))
+          return _88;
+        if ("89".equals(codeString))
+          return _89;
+        if ("90".equals(codeString))
+          return _90;
+        if ("91".equals(codeString))
+          return _91;
+        if ("92".equals(codeString))
+          return _92;
+        if ("93".equals(codeString))
+          return _93;
+        if ("94".equals(codeString))
+          return _94;
+        if ("95".equals(codeString))
+          return _95;
+        if ("96".equals(codeString))
+          return _96;
+        if ("97".equals(codeString))
+          return _97;
+        if ("98".equals(codeString))
+          return _98;
+        if ("99".equals(codeString))
+          return _99;
+        if ("100".equals(codeString))
+          return _100;
+        if ("101".equals(codeString))
+          return _101;
+        if ("102".equals(codeString))
+          return _102;
+        if ("103".equals(codeString))
+          return _103;
+        if ("104".equals(codeString))
+          return _104;
+        if ("105".equals(codeString))
+          return _105;
+        if ("106".equals(codeString))
+          return _106;
+        if ("107".equals(codeString))
+          return _107;
+        if ("108".equals(codeString))
+          return _108;
+        if ("109".equals(codeString))
+          return _109;
+        if ("110".equals(codeString))
+          return _110;
+        if ("111".equals(codeString))
+          return _111;
+        if ("112".equals(codeString))
+          return _112;
+        if ("113".equals(codeString))
+          return _113;
+        if ("114".equals(codeString))
+          return _114;
+        if ("115".equals(codeString))
+          return _115;
+        if ("116".equals(codeString))
+          return _116;
+        if ("117".equals(codeString))
+          return _117;
+        if ("118".equals(codeString))
+          return _118;
+        if ("119".equals(codeString))
+          return _119;
+        if ("120".equals(codeString))
+          return _120;
+        if ("121".equals(codeString))
+          return _121;
+        if ("122".equals(codeString))
+          return _122;
+        if ("123".equals(codeString))
+          return _123;
+        if ("124".equals(codeString))
+          return _124;
+        if ("125".equals(codeString))
+          return _125;
+        if ("126".equals(codeString))
+          return _126;
+        if ("127".equals(codeString))
+          return _127;
+        if ("128".equals(codeString))
+          return _128;
+        if ("129".equals(codeString))
+          return _129;
+        if ("130".equals(codeString))
+          return _130;
+        if ("131".equals(codeString))
+          return _131;
+        if ("132".equals(codeString))
+          return _132;
+        if ("133".equals(codeString))
+          return _133;
+        if ("134".equals(codeString))
+          return _134;
+        if ("135".equals(codeString))
+          return _135;
+        if ("136".equals(codeString))
+          return _136;
+        if ("137".equals(codeString))
+          return _137;
+        if ("138".equals(codeString))
+          return _138;
+        if ("139".equals(codeString))
+          return _139;
+        if ("140".equals(codeString))
+          return _140;
+        if ("141".equals(codeString))
+          return _141;
+        if ("142".equals(codeString))
+          return _142;
+        if ("143".equals(codeString))
+          return _143;
+        if ("144".equals(codeString))
+          return _144;
+        if ("145".equals(codeString))
+          return _145;
+        if ("146".equals(codeString))
+          return _146;
+        if ("147".equals(codeString))
+          return _147;
+        if ("148".equals(codeString))
+          return _148;
+        if ("149".equals(codeString))
+          return _149;
+        if ("150".equals(codeString))
+          return _150;
+        if ("151".equals(codeString))
+          return _151;
+        if ("152".equals(codeString))
+          return _152;
+        if ("153".equals(codeString))
+          return _153;
+        if ("154".equals(codeString))
+          return _154;
+        if ("155".equals(codeString))
+          return _155;
+        if ("156".equals(codeString))
+          return _156;
+        if ("157".equals(codeString))
+          return _157;
+        if ("158".equals(codeString))
+          return _158;
+        if ("159".equals(codeString))
+          return _159;
+        if ("160".equals(codeString))
+          return _160;
+        if ("161".equals(codeString))
+          return _161;
+        if ("162".equals(codeString))
+          return _162;
+        if ("163".equals(codeString))
+          return _163;
+        if ("164".equals(codeString))
+          return _164;
+        if ("165".equals(codeString))
+          return _165;
+        if ("166".equals(codeString))
+          return _166;
+        if ("167".equals(codeString))
+          return _167;
+        if ("168".equals(codeString))
+          return _168;
+        if ("169".equals(codeString))
+          return _169;
+        if ("170".equals(codeString))
+          return _170;
+        if ("171".equals(codeString))
+          return _171;
+        if ("172".equals(codeString))
+          return _172;
+        if ("173".equals(codeString))
+          return _173;
+        if ("174".equals(codeString))
+          return _174;
+        if ("175".equals(codeString))
+          return _175;
+        if ("176".equals(codeString))
+          return _176;
+        if ("177".equals(codeString))
+          return _177;
+        if ("178".equals(codeString))
+          return _178;
+        if ("179".equals(codeString))
+          return _179;
+        if ("180".equals(codeString))
+          return _180;
+        if ("181".equals(codeString))
+          return _181;
+        if ("182".equals(codeString))
+          return _182;
+        if ("183".equals(codeString))
+          return _183;
+        if ("184".equals(codeString))
+          return _184;
+        if ("185".equals(codeString))
+          return _185;
+        if ("186".equals(codeString))
+          return _186;
+        if ("187".equals(codeString))
+          return _187;
+        if ("188".equals(codeString))
+          return _188;
+        if ("189".equals(codeString))
+          return _189;
+        if ("190".equals(codeString))
+          return _190;
+        if ("191".equals(codeString))
+          return _191;
+        if ("192".equals(codeString))
+          return _192;
+        if ("193".equals(codeString))
+          return _193;
+        if ("194".equals(codeString))
+          return _194;
+        if ("195".equals(codeString))
+          return _195;
+        if ("196".equals(codeString))
+          return _196;
+        if ("197".equals(codeString))
+          return _197;
+        if ("198".equals(codeString))
+          return _198;
+        if ("199".equals(codeString))
+          return _199;
+        if ("200".equals(codeString))
+          return _200;
+        if ("201".equals(codeString))
+          return _201;
+        if ("202".equals(codeString))
+          return _202;
+        if ("203".equals(codeString))
+          return _203;
+        if ("204".equals(codeString))
+          return _204;
+        if ("205".equals(codeString))
+          return _205;
+        if ("206".equals(codeString))
+          return _206;
+        if ("207".equals(codeString))
+          return _207;
+        if ("208".equals(codeString))
+          return _208;
+        if ("209".equals(codeString))
+          return _209;
+        if ("210".equals(codeString))
+          return _210;
+        if ("211".equals(codeString))
+          return _211;
+        if ("212".equals(codeString))
+          return _212;
+        if ("213".equals(codeString))
+          return _213;
+        if ("214".equals(codeString))
+          return _214;
+        if ("215".equals(codeString))
+          return _215;
+        if ("216".equals(codeString))
+          return _216;
+        if ("217".equals(codeString))
+          return _217;
+        if ("218".equals(codeString))
+          return _218;
+        if ("219".equals(codeString))
+          return _219;
+        if ("220".equals(codeString))
+          return _220;
+        if ("221".equals(codeString))
+          return _221;
+        if ("222".equals(codeString))
+          return _222;
+        if ("223".equals(codeString))
+          return _223;
+        if ("224".equals(codeString))
+          return _224;
+        if ("225".equals(codeString))
+          return _225;
+        if ("226".equals(codeString))
+          return _226;
+        if ("227".equals(codeString))
+          return _227;
+        if ("228".equals(codeString))
+          return _228;
+        if ("229".equals(codeString))
+          return _229;
+        if ("230".equals(codeString))
+          return _230;
+        if ("231".equals(codeString))
+          return _231;
+        if ("232".equals(codeString))
+          return _232;
+        if ("233".equals(codeString))
+          return _233;
+        if ("234".equals(codeString))
+          return _234;
+        if ("235".equals(codeString))
+          return _235;
+        if ("236".equals(codeString))
+          return _236;
+        if ("237".equals(codeString))
+          return _237;
+        if ("238".equals(codeString))
+          return _238;
+        if ("239".equals(codeString))
+          return _239;
+        if ("240".equals(codeString))
+          return _240;
+        if ("241".equals(codeString))
+          return _241;
+        if ("242".equals(codeString))
+          return _242;
+        if ("243".equals(codeString))
+          return _243;
+        if ("244".equals(codeString))
+          return _244;
+        if ("245".equals(codeString))
+          return _245;
+        if ("246".equals(codeString))
+          return _246;
+        if ("247".equals(codeString))
+          return _247;
+        if ("248".equals(codeString))
+          return _248;
+        if ("249".equals(codeString))
+          return _249;
+        if ("250".equals(codeString))
+          return _250;
+        if ("251".equals(codeString))
+          return _251;
+        if ("252".equals(codeString))
+          return _252;
+        if ("253".equals(codeString))
+          return _253;
+        if ("254".equals(codeString))
+          return _254;
+        if ("255".equals(codeString))
+          return _255;
+        if ("256".equals(codeString))
+          return _256;
+        if ("257".equals(codeString))
+          return _257;
+        if ("258".equals(codeString))
+          return _258;
+        if ("259".equals(codeString))
+          return _259;
+        if ("260".equals(codeString))
+          return _260;
+        if ("261".equals(codeString))
+          return _261;
+        if ("262".equals(codeString))
+          return _262;
+        if ("263".equals(codeString))
+          return _263;
+        if ("264".equals(codeString))
+          return _264;
+        if ("265".equals(codeString))
+          return _265;
+        if ("266".equals(codeString))
+          return _266;
+        if ("267".equals(codeString))
+          return _267;
+        if ("268".equals(codeString))
+          return _268;
+        if ("269".equals(codeString))
+          return _269;
+        if ("270".equals(codeString))
+          return _270;
+        if ("271".equals(codeString))
+          return _271;
+        if ("272".equals(codeString))
+          return _272;
+        if ("273".equals(codeString))
+          return _273;
+        if ("274".equals(codeString))
+          return _274;
+        if ("275".equals(codeString))
+          return _275;
+        if ("276".equals(codeString))
+          return _276;
+        if ("277".equals(codeString))
+          return _277;
+        if ("278".equals(codeString))
+          return _278;
+        if ("279".equals(codeString))
+          return _279;
+        if ("280".equals(codeString))
+          return _280;
+        if ("281".equals(codeString))
+          return _281;
+        if ("282".equals(codeString))
+          return _282;
+        if ("283".equals(codeString))
+          return _283;
+        if ("284".equals(codeString))
+          return _284;
+        if ("285".equals(codeString))
+          return _285;
+        if ("286".equals(codeString))
+          return _286;
+        if ("287".equals(codeString))
+          return _287;
+        if ("288".equals(codeString))
+          return _288;
+        if ("289".equals(codeString))
+          return _289;
+        if ("290".equals(codeString))
+          return _290;
+        if ("291".equals(codeString))
+          return _291;
+        if ("292".equals(codeString))
+          return _292;
+        if ("293".equals(codeString))
+          return _293;
+        if ("294".equals(codeString))
+          return _294;
+        if ("295".equals(codeString))
+          return _295;
+        if ("296".equals(codeString))
+          return _296;
+        if ("297".equals(codeString))
+          return _297;
+        if ("298".equals(codeString))
+          return _298;
+        if ("299".equals(codeString))
+          return _299;
+        if ("300".equals(codeString))
+          return _300;
+        if ("301".equals(codeString))
+          return _301;
+        if ("302".equals(codeString))
+          return _302;
+        if ("303".equals(codeString))
+          return _303;
+        if ("304".equals(codeString))
+          return _304;
+        if ("305".equals(codeString))
+          return _305;
+        if ("306".equals(codeString))
+          return _306;
+        if ("307".equals(codeString))
+          return _307;
+        if ("308".equals(codeString))
+          return _308;
+        if ("309".equals(codeString))
+          return _309;
+        if ("310".equals(codeString))
+          return _310;
+        if ("311".equals(codeString))
+          return _311;
+        if ("312".equals(codeString))
+          return _312;
+        if ("313".equals(codeString))
+          return _313;
+        if ("314".equals(codeString))
+          return _314;
+        if ("315".equals(codeString))
+          return _315;
+        if ("316".equals(codeString))
+          return _316;
+        if ("317".equals(codeString))
+          return _317;
+        if ("318".equals(codeString))
+          return _318;
+        if ("319".equals(codeString))
+          return _319;
+        if ("320".equals(codeString))
+          return _320;
+        if ("321".equals(codeString))
+          return _321;
+        if ("322".equals(codeString))
+          return _322;
+        if ("323".equals(codeString))
+          return _323;
+        if ("324".equals(codeString))
+          return _324;
+        if ("325".equals(codeString))
+          return _325;
+        if ("326".equals(codeString))
+          return _326;
+        if ("327".equals(codeString))
+          return _327;
+        if ("328".equals(codeString))
+          return _328;
+        if ("330".equals(codeString))
+          return _330;
+        if ("331".equals(codeString))
+          return _331;
+        if ("332".equals(codeString))
+          return _332;
+        if ("333".equals(codeString))
+          return _333;
+        if ("334".equals(codeString))
+          return _334;
+        if ("335".equals(codeString))
+          return _335;
+        if ("336".equals(codeString))
+          return _336;
+        if ("337".equals(codeString))
+          return _337;
+        if ("338".equals(codeString))
+          return _338;
+        if ("339".equals(codeString))
+          return _339;
+        if ("340".equals(codeString))
+          return _340;
+        if ("341".equals(codeString))
+          return _341;
+        if ("342".equals(codeString))
+          return _342;
+        if ("343".equals(codeString))
+          return _343;
+        if ("344".equals(codeString))
+          return _344;
+        if ("345".equals(codeString))
+          return _345;
+        if ("346".equals(codeString))
+          return _346;
+        if ("347".equals(codeString))
+          return _347;
+        if ("348".equals(codeString))
+          return _348;
+        if ("349".equals(codeString))
+          return _349;
+        if ("350".equals(codeString))
+          return _350;
+        if ("351".equals(codeString))
+          return _351;
+        if ("352".equals(codeString))
+          return _352;
+        if ("353".equals(codeString))
+          return _353;
+        if ("354".equals(codeString))
+          return _354;
+        if ("355".equals(codeString))
+          return _355;
+        if ("356".equals(codeString))
+          return _356;
+        if ("357".equals(codeString))
+          return _357;
+        if ("358".equals(codeString))
+          return _358;
+        if ("359".equals(codeString))
+          return _359;
+        if ("360".equals(codeString))
+          return _360;
+        if ("361".equals(codeString))
+          return _361;
+        if ("362".equals(codeString))
+          return _362;
+        if ("364".equals(codeString))
+          return _364;
+        if ("365".equals(codeString))
+          return _365;
+        if ("366".equals(codeString))
+          return _366;
+        if ("367".equals(codeString))
+          return _367;
+        if ("368".equals(codeString))
+          return _368;
+        if ("369".equals(codeString))
+          return _369;
+        if ("370".equals(codeString))
+          return _370;
+        if ("371".equals(codeString))
+          return _371;
+        if ("372".equals(codeString))
+          return _372;
+        if ("373".equals(codeString))
+          return _373;
+        if ("374".equals(codeString))
+          return _374;
+        if ("375".equals(codeString))
+          return _375;
+        if ("376".equals(codeString))
+          return _376;
+        if ("377".equals(codeString))
+          return _377;
+        if ("378".equals(codeString))
+          return _378;
+        if ("379".equals(codeString))
+          return _379;
+        if ("380".equals(codeString))
+          return _380;
+        if ("381".equals(codeString))
+          return _381;
+        if ("382".equals(codeString))
+          return _382;
+        if ("383".equals(codeString))
+          return _383;
+        if ("384".equals(codeString))
+          return _384;
+        if ("385".equals(codeString))
+          return _385;
+        if ("386".equals(codeString))
+          return _386;
+        if ("387".equals(codeString))
+          return _387;
+        if ("388".equals(codeString))
+          return _388;
+        if ("389".equals(codeString))
+          return _389;
+        if ("390".equals(codeString))
+          return _390;
+        if ("391".equals(codeString))
+          return _391;
+        if ("392".equals(codeString))
+          return _392;
+        if ("393".equals(codeString))
+          return _393;
+        if ("394".equals(codeString))
+          return _394;
+        if ("395".equals(codeString))
+          return _395;
+        if ("396".equals(codeString))
+          return _396;
+        if ("397".equals(codeString))
+          return _397;
+        if ("398".equals(codeString))
+          return _398;
+        if ("399".equals(codeString))
+          return _399;
+        if ("400".equals(codeString))
+          return _400;
+        if ("401".equals(codeString))
+          return _401;
+        if ("402".equals(codeString))
+          return _402;
+        if ("403".equals(codeString))
+          return _403;
+        if ("404".equals(codeString))
+          return _404;
+        if ("405".equals(codeString))
+          return _405;
+        if ("406".equals(codeString))
+          return _406;
+        if ("407".equals(codeString))
+          return _407;
+        if ("408".equals(codeString))
+          return _408;
+        if ("409".equals(codeString))
+          return _409;
+        if ("410".equals(codeString))
+          return _410;
+        if ("411".equals(codeString))
+          return _411;
+        if ("412".equals(codeString))
+          return _412;
+        if ("413".equals(codeString))
+          return _413;
+        if ("414".equals(codeString))
+          return _414;
+        if ("415".equals(codeString))
+          return _415;
+        if ("416".equals(codeString))
+          return _416;
+        if ("417".equals(codeString))
+          return _417;
+        if ("418".equals(codeString))
+          return _418;
+        if ("419".equals(codeString))
+          return _419;
+        if ("420".equals(codeString))
+          return _420;
+        if ("421".equals(codeString))
+          return _421;
+        if ("422".equals(codeString))
+          return _422;
+        if ("423".equals(codeString))
+          return _423;
+        if ("424".equals(codeString))
+          return _424;
+        if ("425".equals(codeString))
+          return _425;
+        if ("426".equals(codeString))
+          return _426;
+        if ("427".equals(codeString))
+          return _427;
+        if ("428".equals(codeString))
+          return _428;
+        if ("429".equals(codeString))
+          return _429;
+        if ("430".equals(codeString))
+          return _430;
+        if ("431".equals(codeString))
+          return _431;
+        if ("432".equals(codeString))
+          return _432;
+        if ("433".equals(codeString))
+          return _433;
+        if ("434".equals(codeString))
+          return _434;
+        if ("435".equals(codeString))
+          return _435;
+        if ("436".equals(codeString))
+          return _436;
+        if ("437".equals(codeString))
+          return _437;
+        if ("438".equals(codeString))
+          return _438;
+        if ("439".equals(codeString))
+          return _439;
+        if ("440".equals(codeString))
+          return _440;
+        if ("441".equals(codeString))
+          return _441;
+        if ("442".equals(codeString))
+          return _442;
+        if ("443".equals(codeString))
+          return _443;
+        if ("444".equals(codeString))
+          return _444;
+        if ("445".equals(codeString))
+          return _445;
+        if ("446".equals(codeString))
+          return _446;
+        if ("447".equals(codeString))
+          return _447;
+        if ("448".equals(codeString))
+          return _448;
+        if ("449".equals(codeString))
+          return _449;
+        if ("450".equals(codeString))
+          return _450;
+        if ("451".equals(codeString))
+          return _451;
+        if ("452".equals(codeString))
+          return _452;
+        if ("453".equals(codeString))
+          return _453;
+        if ("454".equals(codeString))
+          return _454;
+        if ("455".equals(codeString))
+          return _455;
+        if ("456".equals(codeString))
+          return _456;
+        if ("457".equals(codeString))
+          return _457;
+        if ("458".equals(codeString))
+          return _458;
+        if ("459".equals(codeString))
+          return _459;
+        if ("460".equals(codeString))
+          return _460;
+        if ("461".equals(codeString))
+          return _461;
+        if ("462".equals(codeString))
+          return _462;
+        if ("463".equals(codeString))
+          return _463;
+        if ("464".equals(codeString))
+          return _464;
+        if ("465".equals(codeString))
+          return _465;
+        if ("466".equals(codeString))
+          return _466;
+        if ("467".equals(codeString))
+          return _467;
+        if ("468".equals(codeString))
+          return _468;
+        if ("469".equals(codeString))
+          return _469;
+        if ("470".equals(codeString))
+          return _470;
+        if ("471".equals(codeString))
+          return _471;
+        if ("472".equals(codeString))
+          return _472;
+        if ("473".equals(codeString))
+          return _473;
+        if ("474".equals(codeString))
+          return _474;
+        if ("475".equals(codeString))
+          return _475;
+        if ("476".equals(codeString))
+          return _476;
+        if ("477".equals(codeString))
+          return _477;
+        if ("478".equals(codeString))
+          return _478;
+        if ("479".equals(codeString))
+          return _479;
+        if ("480".equals(codeString))
+          return _480;
+        if ("481".equals(codeString))
+          return _481;
+        if ("482".equals(codeString))
+          return _482;
+        if ("483".equals(codeString))
+          return _483;
+        if ("484".equals(codeString))
+          return _484;
+        if ("485".equals(codeString))
+          return _485;
+        if ("486".equals(codeString))
+          return _486;
+        if ("488".equals(codeString))
+          return _488;
+        if ("489".equals(codeString))
+          return _489;
+        if ("490".equals(codeString))
+          return _490;
+        if ("491".equals(codeString))
+          return _491;
+        if ("492".equals(codeString))
+          return _492;
+        if ("493".equals(codeString))
+          return _493;
+        if ("494".equals(codeString))
+          return _494;
+        if ("495".equals(codeString))
+          return _495;
+        if ("496".equals(codeString))
+          return _496;
+        if ("497".equals(codeString))
+          return _497;
+        if ("498".equals(codeString))
+          return _498;
+        if ("500".equals(codeString))
+          return _500;
+        if ("501".equals(codeString))
+          return _501;
+        if ("502".equals(codeString))
+          return _502;
+        if ("503".equals(codeString))
+          return _503;
+        if ("504".equals(codeString))
+          return _504;
+        if ("505".equals(codeString))
+          return _505;
+        if ("506".equals(codeString))
+          return _506;
+        if ("507".equals(codeString))
+          return _507;
+        if ("508".equals(codeString))
+          return _508;
+        if ("509".equals(codeString))
+          return _509;
+        if ("510".equals(codeString))
+          return _510;
+        if ("513".equals(codeString))
+          return _513;
+        if ("514".equals(codeString))
+          return _514;
+        if ("530".equals(codeString))
+          return _530;
+        if ("531".equals(codeString))
+          return _531;
+        if ("532".equals(codeString))
+          return _532;
+        if ("533".equals(codeString))
+          return _533;
+        if ("534".equals(codeString))
+          return _534;
+        if ("535".equals(codeString))
+          return _535;
+        if ("536".equals(codeString))
+          return _536;
+        if ("537".equals(codeString))
+          return _537;
+        if ("538".equals(codeString))
+          return _538;
+        if ("539".equals(codeString))
+          return _539;
+        if ("540".equals(codeString))
+          return _540;
+        if ("541".equals(codeString))
+          return _541;
+        if ("542".equals(codeString))
+          return _542;
+        if ("543".equals(codeString))
+          return _543;
+        if ("544".equals(codeString))
+          return _544;
+        if ("545".equals(codeString))
+          return _545;
+        if ("546".equals(codeString))
+          return _546;
+        if ("547".equals(codeString))
+          return _547;
+        if ("548".equals(codeString))
+          return _548;
+        if ("550".equals(codeString))
+          return _550;
+        if ("551".equals(codeString))
+          return _551;
+        if ("552".equals(codeString))
+          return _552;
+        if ("553".equals(codeString))
+          return _553;
+        if ("554".equals(codeString))
+          return _554;
+        if ("555".equals(codeString))
+          return _555;
+        if ("556".equals(codeString))
+          return _556;
+        if ("557".equals(codeString))
+          return _557;
+        if ("558".equals(codeString))
+          return _558;
+        if ("559".equals(codeString))
+          return _559;
+        if ("560".equals(codeString))
+          return _560;
+        if ("561".equals(codeString))
+          return _561;
+        if ("562".equals(codeString))
+          return _562;
+        if ("563".equals(codeString))
+          return _563;
+        if ("564".equals(codeString))
+          return _564;
+        if ("565".equals(codeString))
+          return _565;
+        if ("566".equals(codeString))
+          return _566;
+        if ("567".equals(codeString))
+          return _567;
+        if ("568".equals(codeString))
+          return _568;
+        if ("569".equals(codeString))
+          return _569;
+        if ("570".equals(codeString))
+          return _570;
+        if ("571".equals(codeString))
+          return _571;
+        if ("572".equals(codeString))
+          return _572;
+        if ("573".equals(codeString))
+          return _573;
+        if ("574".equals(codeString))
+          return _574;
+        if ("575".equals(codeString))
+          return _575;
+        if ("576".equals(codeString))
+          return _576;
+        if ("577".equals(codeString))
+          return _577;
+        if ("580".equals(codeString))
+          return _580;
+        if ("581".equals(codeString))
+          return _581;
+        if ("582".equals(codeString))
+          return _582;
+        if ("583".equals(codeString))
+          return _583;
+        if ("584".equals(codeString))
+          return _584;
+        if ("585".equals(codeString))
+          return _585;
+        if ("589".equals(codeString))
+          return _589;
+        if ("590".equals(codeString))
+          return _590;
+        if ("591".equals(codeString))
+          return _591;
+        if ("593".equals(codeString))
+          return _593;
+        if ("599".equals(codeString))
+          return _599;
+        if ("600".equals(codeString))
+          return _600;
+        if ("601".equals(codeString))
+          return _601;
+        if ("602".equals(codeString))
+          return _602;
+        if ("603".equals(codeString))
+          return _603;
+        if ("604".equals(codeString))
+          return _604;
+        if ("605".equals(codeString))
+          return _605;
+        if ("606".equals(codeString))
+          return _606;
+        if ("607".equals(codeString))
+          return _607;
+        if ("608".equals(codeString))
+          return _608;
+        if ("609".equals(codeString))
+          return _609;
+        if ("610".equals(codeString))
+          return _610;
+        if ("611".equals(codeString))
+          return _611;
+        if ("612".equals(codeString))
+          return _612;
+        if ("613".equals(codeString))
+          return _613;
+        if ("614".equals(codeString))
+          return _614;
+        if ("615".equals(codeString))
+          return _615;
+        if ("616".equals(codeString))
+          return _616;
+        if ("617".equals(codeString))
+          return _617;
+        if ("618".equals(codeString))
+          return _618;
+        if ("619".equals(codeString))
+          return _619;
+        if ("620".equals(codeString))
+          return _620;
+        if ("621".equals(codeString))
+          return _621;
+        if ("622".equals(codeString))
+          return _622;
+        if ("623".equals(codeString))
+          return _623;
+        if ("624".equals(codeString))
+          return _624;
+        if ("625".equals(codeString))
+          return _625;
+        if ("626".equals(codeString))
+          return _626;
+        if ("627".equals(codeString))
+          return _627;
+        if ("628".equals(codeString))
+          return _628;
+        if ("629".equals(codeString))
+          return _629;
+        throw new FHIRException("Unknown ServiceType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _8: return "8";
+            case _9: return "9";
+            case _10: return "10";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            case _16: return "16";
+            case _17: return "17";
+            case _18: return "18";
+            case _19: return "19";
+            case _20: return "20";
+            case _21: return "21";
+            case _22: return "22";
+            case _23: return "23";
+            case _24: return "24";
+            case _25: return "25";
+            case _26: return "26";
+            case _27: return "27";
+            case _28: return "28";
+            case _29: return "29";
+            case _30: return "30";
+            case _31: return "31";
+            case _32: return "32";
+            case _33: return "33";
+            case _34: return "34";
+            case _35: return "35";
+            case _36: return "36";
+            case _37: return "37";
+            case _38: return "38";
+            case _39: return "39";
+            case _40: return "40";
+            case _41: return "41";
+            case _42: return "42";
+            case _43: return "43";
+            case _44: return "44";
+            case _45: return "45";
+            case _46: return "46";
+            case _47: return "47";
+            case _48: return "48";
+            case _49: return "49";
+            case _50: return "50";
+            case _51: return "51";
+            case _52: return "52";
+            case _53: return "53";
+            case _54: return "54";
+            case _55: return "55";
+            case _56: return "56";
+            case _57: return "57";
+            case _58: return "58";
+            case _59: return "59";
+            case _60: return "60";
+            case _61: return "61";
+            case _62: return "62";
+            case _63: return "63";
+            case _64: return "64";
+            case _65: return "65";
+            case _66: return "66";
+            case _67: return "67";
+            case _68: return "68";
+            case _69: return "69";
+            case _70: return "70";
+            case _71: return "71";
+            case _72: return "72";
+            case _73: return "73";
+            case _74: return "74";
+            case _75: return "75";
+            case _76: return "76";
+            case _77: return "77";
+            case _78: return "78";
+            case _79: return "79";
+            case _80: return "80";
+            case _81: return "81";
+            case _82: return "82";
+            case _83: return "83";
+            case _84: return "84";
+            case _85: return "85";
+            case _86: return "86";
+            case _87: return "87";
+            case _88: return "88";
+            case _89: return "89";
+            case _90: return "90";
+            case _91: return "91";
+            case _92: return "92";
+            case _93: return "93";
+            case _94: return "94";
+            case _95: return "95";
+            case _96: return "96";
+            case _97: return "97";
+            case _98: return "98";
+            case _99: return "99";
+            case _100: return "100";
+            case _101: return "101";
+            case _102: return "102";
+            case _103: return "103";
+            case _104: return "104";
+            case _105: return "105";
+            case _106: return "106";
+            case _107: return "107";
+            case _108: return "108";
+            case _109: return "109";
+            case _110: return "110";
+            case _111: return "111";
+            case _112: return "112";
+            case _113: return "113";
+            case _114: return "114";
+            case _115: return "115";
+            case _116: return "116";
+            case _117: return "117";
+            case _118: return "118";
+            case _119: return "119";
+            case _120: return "120";
+            case _121: return "121";
+            case _122: return "122";
+            case _123: return "123";
+            case _124: return "124";
+            case _125: return "125";
+            case _126: return "126";
+            case _127: return "127";
+            case _128: return "128";
+            case _129: return "129";
+            case _130: return "130";
+            case _131: return "131";
+            case _132: return "132";
+            case _133: return "133";
+            case _134: return "134";
+            case _135: return "135";
+            case _136: return "136";
+            case _137: return "137";
+            case _138: return "138";
+            case _139: return "139";
+            case _140: return "140";
+            case _141: return "141";
+            case _142: return "142";
+            case _143: return "143";
+            case _144: return "144";
+            case _145: return "145";
+            case _146: return "146";
+            case _147: return "147";
+            case _148: return "148";
+            case _149: return "149";
+            case _150: return "150";
+            case _151: return "151";
+            case _152: return "152";
+            case _153: return "153";
+            case _154: return "154";
+            case _155: return "155";
+            case _156: return "156";
+            case _157: return "157";
+            case _158: return "158";
+            case _159: return "159";
+            case _160: return "160";
+            case _161: return "161";
+            case _162: return "162";
+            case _163: return "163";
+            case _164: return "164";
+            case _165: return "165";
+            case _166: return "166";
+            case _167: return "167";
+            case _168: return "168";
+            case _169: return "169";
+            case _170: return "170";
+            case _171: return "171";
+            case _172: return "172";
+            case _173: return "173";
+            case _174: return "174";
+            case _175: return "175";
+            case _176: return "176";
+            case _177: return "177";
+            case _178: return "178";
+            case _179: return "179";
+            case _180: return "180";
+            case _181: return "181";
+            case _182: return "182";
+            case _183: return "183";
+            case _184: return "184";
+            case _185: return "185";
+            case _186: return "186";
+            case _187: return "187";
+            case _188: return "188";
+            case _189: return "189";
+            case _190: return "190";
+            case _191: return "191";
+            case _192: return "192";
+            case _193: return "193";
+            case _194: return "194";
+            case _195: return "195";
+            case _196: return "196";
+            case _197: return "197";
+            case _198: return "198";
+            case _199: return "199";
+            case _200: return "200";
+            case _201: return "201";
+            case _202: return "202";
+            case _203: return "203";
+            case _204: return "204";
+            case _205: return "205";
+            case _206: return "206";
+            case _207: return "207";
+            case _208: return "208";
+            case _209: return "209";
+            case _210: return "210";
+            case _211: return "211";
+            case _212: return "212";
+            case _213: return "213";
+            case _214: return "214";
+            case _215: return "215";
+            case _216: return "216";
+            case _217: return "217";
+            case _218: return "218";
+            case _219: return "219";
+            case _220: return "220";
+            case _221: return "221";
+            case _222: return "222";
+            case _223: return "223";
+            case _224: return "224";
+            case _225: return "225";
+            case _226: return "226";
+            case _227: return "227";
+            case _228: return "228";
+            case _229: return "229";
+            case _230: return "230";
+            case _231: return "231";
+            case _232: return "232";
+            case _233: return "233";
+            case _234: return "234";
+            case _235: return "235";
+            case _236: return "236";
+            case _237: return "237";
+            case _238: return "238";
+            case _239: return "239";
+            case _240: return "240";
+            case _241: return "241";
+            case _242: return "242";
+            case _243: return "243";
+            case _244: return "244";
+            case _245: return "245";
+            case _246: return "246";
+            case _247: return "247";
+            case _248: return "248";
+            case _249: return "249";
+            case _250: return "250";
+            case _251: return "251";
+            case _252: return "252";
+            case _253: return "253";
+            case _254: return "254";
+            case _255: return "255";
+            case _256: return "256";
+            case _257: return "257";
+            case _258: return "258";
+            case _259: return "259";
+            case _260: return "260";
+            case _261: return "261";
+            case _262: return "262";
+            case _263: return "263";
+            case _264: return "264";
+            case _265: return "265";
+            case _266: return "266";
+            case _267: return "267";
+            case _268: return "268";
+            case _269: return "269";
+            case _270: return "270";
+            case _271: return "271";
+            case _272: return "272";
+            case _273: return "273";
+            case _274: return "274";
+            case _275: return "275";
+            case _276: return "276";
+            case _277: return "277";
+            case _278: return "278";
+            case _279: return "279";
+            case _280: return "280";
+            case _281: return "281";
+            case _282: return "282";
+            case _283: return "283";
+            case _284: return "284";
+            case _285: return "285";
+            case _286: return "286";
+            case _287: return "287";
+            case _288: return "288";
+            case _289: return "289";
+            case _290: return "290";
+            case _291: return "291";
+            case _292: return "292";
+            case _293: return "293";
+            case _294: return "294";
+            case _295: return "295";
+            case _296: return "296";
+            case _297: return "297";
+            case _298: return "298";
+            case _299: return "299";
+            case _300: return "300";
+            case _301: return "301";
+            case _302: return "302";
+            case _303: return "303";
+            case _304: return "304";
+            case _305: return "305";
+            case _306: return "306";
+            case _307: return "307";
+            case _308: return "308";
+            case _309: return "309";
+            case _310: return "310";
+            case _311: return "311";
+            case _312: return "312";
+            case _313: return "313";
+            case _314: return "314";
+            case _315: return "315";
+            case _316: return "316";
+            case _317: return "317";
+            case _318: return "318";
+            case _319: return "319";
+            case _320: return "320";
+            case _321: return "321";
+            case _322: return "322";
+            case _323: return "323";
+            case _324: return "324";
+            case _325: return "325";
+            case _326: return "326";
+            case _327: return "327";
+            case _328: return "328";
+            case _330: return "330";
+            case _331: return "331";
+            case _332: return "332";
+            case _333: return "333";
+            case _334: return "334";
+            case _335: return "335";
+            case _336: return "336";
+            case _337: return "337";
+            case _338: return "338";
+            case _339: return "339";
+            case _340: return "340";
+            case _341: return "341";
+            case _342: return "342";
+            case _343: return "343";
+            case _344: return "344";
+            case _345: return "345";
+            case _346: return "346";
+            case _347: return "347";
+            case _348: return "348";
+            case _349: return "349";
+            case _350: return "350";
+            case _351: return "351";
+            case _352: return "352";
+            case _353: return "353";
+            case _354: return "354";
+            case _355: return "355";
+            case _356: return "356";
+            case _357: return "357";
+            case _358: return "358";
+            case _359: return "359";
+            case _360: return "360";
+            case _361: return "361";
+            case _362: return "362";
+            case _364: return "364";
+            case _365: return "365";
+            case _366: return "366";
+            case _367: return "367";
+            case _368: return "368";
+            case _369: return "369";
+            case _370: return "370";
+            case _371: return "371";
+            case _372: return "372";
+            case _373: return "373";
+            case _374: return "374";
+            case _375: return "375";
+            case _376: return "376";
+            case _377: return "377";
+            case _378: return "378";
+            case _379: return "379";
+            case _380: return "380";
+            case _381: return "381";
+            case _382: return "382";
+            case _383: return "383";
+            case _384: return "384";
+            case _385: return "385";
+            case _386: return "386";
+            case _387: return "387";
+            case _388: return "388";
+            case _389: return "389";
+            case _390: return "390";
+            case _391: return "391";
+            case _392: return "392";
+            case _393: return "393";
+            case _394: return "394";
+            case _395: return "395";
+            case _396: return "396";
+            case _397: return "397";
+            case _398: return "398";
+            case _399: return "399";
+            case _400: return "400";
+            case _401: return "401";
+            case _402: return "402";
+            case _403: return "403";
+            case _404: return "404";
+            case _405: return "405";
+            case _406: return "406";
+            case _407: return "407";
+            case _408: return "408";
+            case _409: return "409";
+            case _410: return "410";
+            case _411: return "411";
+            case _412: return "412";
+            case _413: return "413";
+            case _414: return "414";
+            case _415: return "415";
+            case _416: return "416";
+            case _417: return "417";
+            case _418: return "418";
+            case _419: return "419";
+            case _420: return "420";
+            case _421: return "421";
+            case _422: return "422";
+            case _423: return "423";
+            case _424: return "424";
+            case _425: return "425";
+            case _426: return "426";
+            case _427: return "427";
+            case _428: return "428";
+            case _429: return "429";
+            case _430: return "430";
+            case _431: return "431";
+            case _432: return "432";
+            case _433: return "433";
+            case _434: return "434";
+            case _435: return "435";
+            case _436: return "436";
+            case _437: return "437";
+            case _438: return "438";
+            case _439: return "439";
+            case _440: return "440";
+            case _441: return "441";
+            case _442: return "442";
+            case _443: return "443";
+            case _444: return "444";
+            case _445: return "445";
+            case _446: return "446";
+            case _447: return "447";
+            case _448: return "448";
+            case _449: return "449";
+            case _450: return "450";
+            case _451: return "451";
+            case _452: return "452";
+            case _453: return "453";
+            case _454: return "454";
+            case _455: return "455";
+            case _456: return "456";
+            case _457: return "457";
+            case _458: return "458";
+            case _459: return "459";
+            case _460: return "460";
+            case _461: return "461";
+            case _462: return "462";
+            case _463: return "463";
+            case _464: return "464";
+            case _465: return "465";
+            case _466: return "466";
+            case _467: return "467";
+            case _468: return "468";
+            case _469: return "469";
+            case _470: return "470";
+            case _471: return "471";
+            case _472: return "472";
+            case _473: return "473";
+            case _474: return "474";
+            case _475: return "475";
+            case _476: return "476";
+            case _477: return "477";
+            case _478: return "478";
+            case _479: return "479";
+            case _480: return "480";
+            case _481: return "481";
+            case _482: return "482";
+            case _483: return "483";
+            case _484: return "484";
+            case _485: return "485";
+            case _486: return "486";
+            case _488: return "488";
+            case _489: return "489";
+            case _490: return "490";
+            case _491: return "491";
+            case _492: return "492";
+            case _493: return "493";
+            case _494: return "494";
+            case _495: return "495";
+            case _496: return "496";
+            case _497: return "497";
+            case _498: return "498";
+            case _500: return "500";
+            case _501: return "501";
+            case _502: return "502";
+            case _503: return "503";
+            case _504: return "504";
+            case _505: return "505";
+            case _506: return "506";
+            case _507: return "507";
+            case _508: return "508";
+            case _509: return "509";
+            case _510: return "510";
+            case _513: return "513";
+            case _514: return "514";
+            case _530: return "530";
+            case _531: return "531";
+            case _532: return "532";
+            case _533: return "533";
+            case _534: return "534";
+            case _535: return "535";
+            case _536: return "536";
+            case _537: return "537";
+            case _538: return "538";
+            case _539: return "539";
+            case _540: return "540";
+            case _541: return "541";
+            case _542: return "542";
+            case _543: return "543";
+            case _544: return "544";
+            case _545: return "545";
+            case _546: return "546";
+            case _547: return "547";
+            case _548: return "548";
+            case _550: return "550";
+            case _551: return "551";
+            case _552: return "552";
+            case _553: return "553";
+            case _554: return "554";
+            case _555: return "555";
+            case _556: return "556";
+            case _557: return "557";
+            case _558: return "558";
+            case _559: return "559";
+            case _560: return "560";
+            case _561: return "561";
+            case _562: return "562";
+            case _563: return "563";
+            case _564: return "564";
+            case _565: return "565";
+            case _566: return "566";
+            case _567: return "567";
+            case _568: return "568";
+            case _569: return "569";
+            case _570: return "570";
+            case _571: return "571";
+            case _572: return "572";
+            case _573: return "573";
+            case _574: return "574";
+            case _575: return "575";
+            case _576: return "576";
+            case _577: return "577";
+            case _580: return "580";
+            case _581: return "581";
+            case _582: return "582";
+            case _583: return "583";
+            case _584: return "584";
+            case _585: return "585";
+            case _589: return "589";
+            case _590: return "590";
+            case _591: return "591";
+            case _593: return "593";
+            case _599: return "599";
+            case _600: return "600";
+            case _601: return "601";
+            case _602: return "602";
+            case _603: return "603";
+            case _604: return "604";
+            case _605: return "605";
+            case _606: return "606";
+            case _607: return "607";
+            case _608: return "608";
+            case _609: return "609";
+            case _610: return "610";
+            case _611: return "611";
+            case _612: return "612";
+            case _613: return "613";
+            case _614: return "614";
+            case _615: return "615";
+            case _616: return "616";
+            case _617: return "617";
+            case _618: return "618";
+            case _619: return "619";
+            case _620: return "620";
+            case _621: return "621";
+            case _622: return "622";
+            case _623: return "623";
+            case _624: return "624";
+            case _625: return "625";
+            case _626: return "626";
+            case _627: return "627";
+            case _628: return "628";
+            case _629: return "629";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/service-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "Adoption & permanent care information/support";
+            case _2: return "Aged care assessment";
+            case _3: return "Aged Care information/referral";
+            case _4: return "Aged Residential Care";
+            case _5: return "Case management for older persons";
+            case _6: return "Delivered meals (meals on wheels)";
+            case _7: return "Friendly visiting";
+            case _8: return "Home care/housekeeping assistance";
+            case _9: return "Home maintenance and repair";
+            case _10: return "Personal alarms/alerts";
+            case _11: return "Personal care for older persons";
+            case _12: return "Planned activity groups";
+            case _13: return "Acupuncture";
+            case _14: return "Alexander technique therapy";
+            case _15: return "Aromatherapy";
+            case _16: return "Biorhythm services";
+            case _17: return "Bowen therapy";
+            case _18: return "Chinese herbal medicine";
+            case _19: return "Feldenkrais";
+            case _20: return "Homoeopathy";
+            case _21: return "Hydrotherapy";
+            case _22: return "Hypnotherapy";
+            case _23: return "Kinesiology";
+            case _24: return "Magnetic therapy";
+            case _25: return "Massage therapy";
+            case _26: return "Meditation";
+            case _27: return "Myotherapy";
+            case _28: return "Naturopathy";
+            case _29: return "Reflexology";
+            case _30: return "Reiki";
+            case _31: return "Relaxation therapy";
+            case _32: return "Shiatsu";
+            case _33: return "Western herbal medicine";
+            case _34: return "Family day care";
+            case _35: return "Holiday programs";
+            case _36: return "Kindergarten inclusion support for children with a disability";
+            case _37: return "Kindergarten/preschool";
+            case _38: return "Long day child care";
+            case _39: return "Occasional child care";
+            case _40: return "Outside school hours care";
+            case _41: return "Children's play programs";
+            case _42: return "Parenting & family management support/education";
+            case _43: return "Playgroup";
+            case _44: return "School nursing";
+            case _45: return "Toy library";
+            case _46: return "Child protection/child abuse report";
+            case _47: return "Foster care";
+            case _48: return "Residential/ out of home care";
+            case _49: return "Support for young people leaving care";
+            case _50: return "Audiology";
+            case _51: return "Blood donation";
+            case _52: return "Chiropractic";
+            case _53: return "Dietetics";
+            case _54: return "Family planning";
+            case _55: return "Health advocacy/Liaison service";
+            case _56: return "Health information/referral";
+            case _57: return "Immunization";
+            case _58: return "Maternal & child health";
+            case _59: return "Nursing";
+            case _60: return "Nutrition";
+            case _61: return "Occupational therapy";
+            case _62: return "Optometry";
+            case _63: return "Osteopathy";
+            case _64: return "Pharmacy";
+            case _65: return "Physiotherapy";
+            case _66: return "Podiatry";
+            case _67: return "Sexual health";
+            case _68: return "Speech pathology/therapy";
+            case _69: return "Bereavement counselling";
+            case _70: return "Crisis counselling";
+            case _71: return "Family counselling and/or family therapy";
+            case _72: return "Family violence counselling";
+            case _73: return "Financial counselling";
+            case _74: return "Generalist counselling";
+            case _75: return "Genetic counselling";
+            case _76: return "Health counselling";
+            case _77: return "Mediation";
+            case _78: return "Problem gambling counselling";
+            case _79: return "Relationship counselling";
+            case _80: return "Sexual assault counselling";
+            case _81: return "Trauma counselling";
+            case _82: return "Victims of crime counselling";
+            case _83: return "Cemetery operation";
+            case _84: return "Cremation";
+            case _85: return "Death service information";
+            case _86: return "Funeral services";
+            case _87: return "Endodontic";
+            case _88: return "General dental";
+            case _89: return "Oral medicine";
+            case _90: return "Oral surgery";
+            case _91: return "Orthodontic";
+            case _92: return "Paediatric Dentistry";
+            case _93: return "Periodontic";
+            case _94: return "Prosthodontic";
+            case _95: return "Acquired brain injury information/referral";
+            case _96: return "Disability advocacy";
+            case _97: return "Disability aids & equipment";
+            case _98: return "Disability case management";
+            case _99: return "Disability day programs & activities";
+            case _100: return "Disability information/referral";
+            case _101: return "Disability support packages";
+            case _102: return "Disability supported accommodation";
+            case _103: return "Early childhood intervention";
+            case _104: return "Hearing aids & equipment";
+            case _105: return "Drug and/or alcohol counselling";
+            case _106: return "Drug and/or alcohol information/referral";
+            case _107: return "Needle & Syringe exchange";
+            case _108: return "Non-residential alcohol and/or drug dependence treatment";
+            case _109: return "Pharmacotherapy (eg. methadone) program";
+            case _110: return "Quit program";
+            case _111: return "Residential alcohol and/or drug dependence treatment";
+            case _112: return "Adult/community education";
+            case _113: return "Higher education";
+            case _114: return "Primary education";
+            case _115: return "Secondary education";
+            case _116: return "Training & vocational education";
+            case _117: return "Emergency medical";
+            case _118: return "Employment placement and/or support";
+            case _119: return "Vocational Rehabilitation";
+            case _120: return "Workplace safety and/or accident prevention";
+            case _121: return "Financial assistance";
+            case _122: return "Financial information/advice";
+            case _123: return "Material aid";
+            case _124: return "General Practice/GP (doctor)";
+            case _125: return "Accommodation placement and/or support";
+            case _126: return "Crisis/emergency accommodation";
+            case _127: return "Homelessness support";
+            case _128: return "Housing information/referral";
+            case _129: return "Public rental housing";
+            case _130: return "Interpreting/Multilingual/Language service";
+            case _131: return "Juvenile Justice";
+            case _132: return "Legal advocacy";
+            case _133: return "Legal information/advice/referral";
+            case _134: return "Mental health advocacy";
+            case _135: return "Mental health assessment/triage/crisis response";
+            case _136: return "Mental health case management/continuing care";
+            case _137: return "Mental health information/referral";
+            case _138: return "Mental health inpatient services (hospital psychiatric unit) - requires referral";
+            case _139: return "Mental health non-residential rehabilitation";
+            case _140: return "Mental health residential rehabilitation/community care unit";
+            case _141: return "Psychiatry (requires referral)";
+            case _142: return "Psychology";
+            case _143: return "Martial arts";
+            case _144: return "Personal fitness training";
+            case _145: return "Physical activity group";
+            case _146: return "Physical activity programs";
+            case _147: return "Physical fitness testing";
+            case _148: return "Pilates";
+            case _149: return "Self defence";
+            case _150: return "Sporting club";
+            case _151: return "Yoga";
+            case _152: return "Food safety";
+            case _153: return "Health regulatory, inspection and/or certification";
+            case _154: return "Workplace health and/or safety inspection and/or certification";
+            case _155: return "Carer support";
+            case _156: return "Respite care";
+            case _157: return "Anatomical Pathology (including Cytopathology & Forensic Pathology)";
+            case _158: return "Pathology - Clinical Chemistry";
+            case _159: return "Pathology - General";
+            case _160: return "Pathology - Genetics";
+            case _161: return "Pathology - Haematology";
+            case _162: return "Pathology - Immunology";
+            case _163: return "Pathology - Microbiology";
+            case _164: return "Anaesthesiology - Pain Medicine";
+            case _165: return "Cardiology";
+            case _166: return "Clinical Genetics";
+            case _167: return "Clinical Pharmacology";
+            case _168: return "Dermatology";
+            case _169: return "Endocrinology";
+            case _170: return "Gastroenterology & Hepatology";
+            case _171: return "Geriatric medicine";
+            case _172: return "Immunology & Allergy";
+            case _173: return "Infectious diseases";
+            case _174: return "Intensive care medicine";
+            case _175: return "Medical Oncology";
+            case _176: return "Nephrology";
+            case _177: return "Neurology";
+            case _178: return "Occupational Medicine";
+            case _179: return "Palliative Medicine";
+            case _180: return "Public Health Medicine";
+            case _181: return "Rehabilitation Medicine";
+            case _182: return "Rheumatology";
+            case _183: return "Sleep Medicine";
+            case _184: return "Thoracic medicine";
+            case _185: return "Gynaecological Oncology";
+            case _186: return "Obstetrics & Gynaecology";
+            case _187: return "Reproductive Endocrinology & Infertility";
+            case _188: return "Urogynaecology";
+            case _189: return "Neonatology & Perinatology";
+            case _190: return "Paediatric Cardiology";
+            case _191: return "Paediatric Clinical Genetics";
+            case _192: return "Paediatric Clinical Pharmacology";
+            case _193: return "Paediatric Endocrinology";
+            case _194: return "Paediatric Gastroenterology & Hepatology";
+            case _195: return "Paediatric Haematology";
+            case _196: return "Paediatric Immunology & Allergy";
+            case _197: return "Paediatric Infectious diseases";
+            case _198: return "Paediatric intensive care medicine";
+            case _199: return "Paediatric Medical Oncology";
+            case _200: return "Paediatric Medicine";
+            case _201: return "Paediatric Nephrology";
+            case _202: return "Paediatric Neurology";
+            case _203: return "Paediatric Nuclear Medicine";
+            case _204: return "Paediatric Rehabilitation Medicine";
+            case _205: return "Paediatric Rheumatology";
+            case _206: return "Paediatric Sleep Medicine";
+            case _207: return "Paediatric Surgery";
+            case _208: return "Paediatric Thoracic Medicine";
+            case _209: return "Diagnostic Radiology/Xray/CT/Fluoroscopy";
+            case _210: return "Diagnostic Ultrasound";
+            case _211: return "Magnetic Resonance Imaging (MRI)";
+            case _212: return "Nuclear Medicine";
+            case _213: return "Obstetric & Gynaecological Ultrasound";
+            case _214: return "Radiation oncology";
+            case _215: return "Cardiothoracic surgery";
+            case _216: return "Neurosurgery";
+            case _217: return "Ophthalmology";
+            case _218: return "Orthopaedic surgery";
+            case _219: return "Otolaryngology - Head & Neck Surgery";
+            case _220: return "Plastic & Reconstructive Surgery";
+            case _221: return "Surgery - General";
+            case _222: return "Urology";
+            case _223: return "Vascular surgery";
+            case _224: return "Support groups";
+            case _225: return "Air ambulance";
+            case _226: return "Ambulance";
+            case _227: return "Blood transport";
+            case _228: return "Community bus";
+            case _229: return "Flying doctor service";
+            case _230: return "Patient transport";
+            case _231: return "A&E";
+            case _232: return "A&EP";
+            case _233: return "Abuse";
+            case _234: return "ACAS";
+            case _235: return "Access";
+            case _236: return "Accident";
+            case _237: return "Acute Inpatient Service's";
+            case _238: return "Adult Day Programs";
+            case _239: return "Adult Mental Health Services";
+            case _240: return "Advice";
+            case _241: return "Advocacy";
+            case _242: return "Aged Persons Mental Health Residential Units";
+            case _243: return "Aged Persons Mental Health Services";
+            case _244: return "Aged Persons Mental Health Teams";
+            case _245: return "Aids";
+            case _246: return "Al-Anon";
+            case _247: return "Alcohol";
+            case _248: return "Al-Teen";
+            case _249: return "Antenatal";
+            case _250: return "Anxiety";
+            case _251: return "Arthritis";
+            case _252: return "Assessment";
+            case _253: return "Assistance";
+            case _254: return "Asthma";
+            case _255: return "ATSS";
+            case _256: return "Attendant Care";
+            case _257: return "Babies";
+            case _258: return "Bathroom Modification";
+            case _259: return "Behaviour";
+            case _260: return "Behaviour Intervention";
+            case _261: return "Bereavement";
+            case _262: return "Bipolar";
+            case _263: return "Birth";
+            case _264: return "Birth Control";
+            case _265: return "Birthing Options";
+            case _266: return "BIST";
+            case _267: return "Blood";
+            case _268: return "Bone";
+            case _269: return "Bowel";
+            case _270: return "Brain";
+            case _271: return "Breast Feeding";
+            case _272: return "Breast Screen";
+            case _273: return "Brokerage";
+            case _274: return "Cancer";
+            case _275: return "Cancer Support";
+            case _276: return "Cardiovascular Disease";
+            case _277: return "Care Packages";
+            case _278: return "Carer";
+            case _279: return "Case Management";
+            case _280: return "Casualty";
+            case _281: return "Centrelink";
+            case _282: return "Chemists";
+            case _283: return "Child And Adolescent Mental Health Services";
+            case _284: return "Child Care";
+            case _285: return "Child Services";
+            case _286: return "Children";
+            case _287: return "Children's Services";
+            case _288: return "Cholesterol";
+            case _289: return "Clothing";
+            case _290: return "Community Based Accommodation";
+            case _291: return "Community Care Unit";
+            case _292: return "Community Child And Adolescent Mental Health Services";
+            case _293: return "Community Health";
+            case _294: return "Community Residential Unit";
+            case _295: return "Community Transport";
+            case _296: return "Companion Visiting";
+            case _297: return "Companionship";
+            case _298: return "Consumer Advice";
+            case _299: return "Consumer Issues";
+            case _300: return "Continuing Care Services";
+            case _301: return "Contraception Information";
+            case _302: return "Coordinating Bodies";
+            case _303: return "Correctional Services";
+            case _304: return "Council Environmental Health";
+            case _305: return "Counselling";
+            case _306: return "Criminal";
+            case _307: return "Crises";
+            case _308: return "Crisis Assessment And Treatment Services (Cats)";
+            case _309: return "Crisis Assistance";
+            case _310: return "Crisis Refuge";
+            case _311: return "Day Program";
+            case _312: return "Deaf";
+            case _313: return "Dental Hygiene";
+            case _314: return "Dentistry";
+            case _315: return "Dentures";
+            case _316: return "Depression";
+            case _317: return "Detoxification";
+            case _318: return "Diabetes";
+            case _319: return "Diaphragm Fitting";
+            case _320: return "Dieticians";
+            case _321: return "Disabled Parking";
+            case _322: return "District Nursing";
+            case _323: return "Divorce";
+            case _324: return "Doctors";
+            case _325: return "Drink-Drive";
+            case _326: return "Dual Diagnosis Services";
+            case _327: return "Early Choice";
+            case _328: return "Eating Disorder";
+            case _330: return "Emergency Relief";
+            case _331: return "Employment And Training";
+            case _332: return "Environment";
+            case _333: return "Equipment";
+            case _334: return "Exercise";
+            case _335: return "Facility";
+            case _336: return "Family Choice";
+            case _337: return "Family Law";
+            case _338: return "Family Options";
+            case _339: return "Family Services";
+            case _340: return "FFYA";
+            case _341: return "Financial Aid";
+            case _342: return "Fitness";
+            case _343: return "Flexible Care Packages";
+            case _344: return "Food";
+            case _345: return "Food Vouchers";
+            case _346: return "Forensic Mental Health Services";
+            case _347: return "Futures";
+            case _348: return "Futures For Young Adults";
+            case _349: return "General Practitioners";
+            case _350: return "Grants";
+            case _351: return "Grief";
+            case _352: return "Grief Counselling";
+            case _353: return "HACC";
+            case _354: return "Heart Disease";
+            case _355: return "Help";
+            case _356: return "High Blood Pressure";
+            case _357: return "Home Help";
+            case _358: return "Home Nursing";
+            case _359: return "Homefirst";
+            case _360: return "Hospice Care";
+            case _361: return "Hospital Services";
+            case _362: return "Hospital To Home";
+            case _364: return "Hostel";
+            case _365: return "Hostel Accommodation";
+            case _366: return "Household Items";
+            case _367: return "Hypertension";
+            case _368: return "Illness";
+            case _369: return "Independent Living";
+            case _370: return "Information";
+            case _371: return "Injury";
+            case _372: return "Intake";
+            case _373: return "Intensive Mobile Youth Outreach Services (Imyos)";
+            case _374: return "Intervention";
+            case _375: return "Job Searching";
+            case _376: return "Justice";
+            case _377: return "Leisure";
+            case _378: return "Loans";
+            case _379: return "Low Income Earners";
+            case _380: return "Lung";
+            case _381: return "Making A Difference";
+            case _382: return "Medical Services";
+            case _383: return "Medical Specialists";
+            case _384: return "Medication Administration";
+            case _385: return "Menstrual Information";
+            case _386: return "Methadone";
+            case _387: return "Mobile Support And Treatment Services (MSTS)";
+            case _388: return "Motor Neurone";
+            case _389: return "Multiple Sclerosis";
+            case _390: return "Neighbourhood House";
+            case _391: return "Nursing Home";
+            case _392: return "Nursing Mothers";
+            case _393: return "Obesity";
+            case _394: return "Occupational Health & Safety";
+            case _395: return "Optometrist";
+            case _396: return "Oral Hygiene";
+            case _397: return "Outpatients";
+            case _398: return "Outreach Service";
+            case _399: return "PADP";
+            case _400: return "Pain";
+            case _401: return "Pap Smear";
+            case _402: return "Parenting";
+            case _403: return "Peak Organisations";
+            case _404: return "Personal Care";
+            case _405: return "Pharmacies";
+            case _406: return "Phobias";
+            case _407: return "Physical";
+            case _408: return "Physical Activity";
+            case _409: return "Postnatal";
+            case _410: return "Pregnancy";
+            case _411: return "Pregnancy Tests";
+            case _412: return "Preschool";
+            case _413: return "Prescriptions";
+            case _414: return "Primary Mental Health And Early Intervention Teams";
+            case _415: return "Property Maintenance";
+            case _416: return "Prostate";
+            case _417: return "Psychiatric";
+            case _418: return "Psychiatric Disability Support Services - Home-Based Outreach";
+            case _419: return "Psychiatric Disability Support Services - Planned Respite";
+            case _420: return "Psychiatric Disability Support Services - Residential Rehabilitation";
+            case _421: return "Psychiatric Disability Support Services Home-Based Outreach";
+            case _422: return "Psychiatric Disability Support Services Mutual Support And Self Help";
+            case _423: return "Psychiatric Support";
+            case _424: return "Recreation";
+            case _425: return "Referral";
+            case _426: return "Refuge";
+            case _427: return "Rent Assistance";
+            case _428: return "Residential Facilities";
+            case _429: return "Residential Respite";
+            case _430: return "Respiratory";
+            case _431: return "Response";
+            case _432: return "Rooming Houses";
+            case _433: return "Safe Sex";
+            case _434: return "Secure Extended Care Inpatient Services";
+            case _435: return "Self Help";
+            case _436: return "Separation";
+            case _437: return "Services";
+            case _438: return "Sex Education";
+            case _439: return "Sexual Abuse";
+            case _440: return "Sexual Issues";
+            case _441: return "Sexually Transmitted Diseases";
+            case _442: return "SIDS";
+            case _443: return "Social Support";
+            case _444: return "Socialisation";
+            case _445: return "Special Needs";
+            case _446: return "Speech Therapist";
+            case _447: return "Splinting";
+            case _448: return "Sport";
+            case _449: return "Statewide And Specialist Services";
+            case _450: return "STD";
+            case _451: return "STI";
+            case _452: return "Stillbirth";
+            case _453: return "Stomal Care";
+            case _454: return "Stroke";
+            case _455: return "Substance Abuse";
+            case _456: return "Support";
+            case _457: return "Syringes";
+            case _458: return "Teeth";
+            case _459: return "Tenancy Advice";
+            case _460: return "Terminal Illness";
+            case _461: return "Therapy";
+            case _462: return "Transcription";
+            case _463: return "Translating Services";
+            case _464: return "Translator";
+            case _465: return "Transport";
+            case _466: return "Vertebrae";
+            case _467: return "Violence";
+            case _468: return "Vocational Guidance";
+            case _469: return "Weight";
+            case _470: return "Welfare Assistance";
+            case _471: return "Welfare Counselling";
+            case _472: return "Wheelchairs";
+            case _473: return "Wound Management";
+            case _474: return "Young People At Risk";
+            case _475: return "Further Description - Community Health Care";
+            case _476: return "Library";
+            case _477: return "Community Hours";
+            case _478: return "Further Description - Specialist Medical";
+            case _479: return "Hepatology";
+            case _480: return "Gastroenterology";
+            case _481: return "Gynaecology";
+            case _482: return "Obstetrics";
+            case _483: return "Further Description - Specialist Surgical";
+            case _484: return "Placement Protection";
+            case _485: return "Family Violence";
+            case _486: return "Integrated Family Services";
+            case _488: return "Diabetes Educator";
+            case _489: return "Kinship Care";
+            case _490: return "General Mental Health Services";
+            case _491: return "Exercise Physiology";
+            case _492: return "Medical Research";
+            case _493: return "Youth";
+            case _494: return "Youth Services";
+            case _495: return "Youth Health";
+            case _496: return "Child and Family Services";
+            case _497: return "Home Visits";
+            case _498: return "Mobile Services";
+            case _500: return "Before and/or After School Care";
+            case _501: return "Cancer Services";
+            case _502: return "Integrated Cancer Services";
+            case _503: return "Multidisciplinary Services";
+            case _504: return "Multidisciplinary Cancer Services";
+            case _505: return "Meetings";
+            case _506: return "Blood pressure monitoring";
+            case _507: return "Dose administration aid";
+            case _508: return "Medical Equipment Hire";
+            case _509: return "Parenting & family support/education";
+            case _510: return "Deputising Service";
+            case _513: return "Cancer Support Groups";
+            case _514: return "Community Cancer Services";
+            case _530: return "Disability Care Transport";
+            case _531: return "Aged Care Transport";
+            case _532: return "Diabetes Education service";
+            case _533: return "Cardiac Rehabilitation Service ";
+            case _534: return "Young Adult Diabetes services (YADS)";
+            case _535: return "Pulmonary Rehabilitation Service";
+            case _536: return "Art therapy";
+            case _537: return "Medication Reviews";
+            case _538: return "Telephone Counselling";
+            case _539: return "Telephone Help Line";
+            case _540: return "Online Service";
+            case _541: return "Crisis - Mental Health";
+            case _542: return "Youth Crisis";
+            case _543: return "Sexual Assault";
+            case _544: return "GPAH Other";
+            case _545: return "Paediatric Dermatology";
+            case _546: return "Veterans Services";
+            case _547: return "Veterans";
+            case _548: return "Food Relief/food/meals";
+            case _550: return "Dementia Care";
+            case _551: return "Alzheimer";
+            case _552: return "Drug and/or alcohol support groups";
+            case _553: return "One on One Support/Mentoring/Coaching";
+            case _554: return "Chronic Disease Management";
+            case _555: return "Liaison Services";
+            case _556: return "Walk in Centre / non emergency";
+            case _557: return "Inpatients";
+            case _558: return "Spiritual Counselling";
+            case _559: return "Women's Health";
+            case _560: return "Men's Health";
+            case _561: return "Health education/Health awareness program";
+            case _562: return "Test Message";
+            case _563: return "Remedial Massage";
+            case _564: return "Adolescent Mental Health Services";
+            case _565: return "Youth drop in/assistance/support";
+            case _566: return "Aboriginal Health Worker";
+            case _567: return "Women's Health Clinic";
+            case _568: return "Men's Health Clinic ";
+            case _569: return "Migrant Health Clinic";
+            case _570: return "Refugee Health Clinic";
+            case _571: return "Aboriginal Health Clinic";
+            case _572: return "Nurse Practitioner lead Clinic/s";
+            case _573: return "Nurse lead Clinic/s";
+            case _574: return "Culturally tailored support groups";
+            case _575: return "Culturally tailored health promotion";
+            case _576: return "Rehabilitation";
+            case _577: return "Education information/referral";
+            case _580: return "Social Work";
+            case _581: return "Haematology";
+            case _582: return "Maternity Shared Care";
+            case _583: return "Rehabilitation Service";
+            case _584: return "Cranio-Sacral Therapy";
+            case _585: return "Prosthetics & Orthotics";
+            case _589: return "Home Medicine Review";
+            case _590: return "GPAH - Medical";
+            case _591: return "Music Therapy";
+            case _593: return "Falls Prevention";
+            case _599: return "Accommodation/Tenancy";
+            case _600: return "Assess-Skill, Ability, Needs";
+            case _601: return "Assist Access/Maintain Employ";
+            case _602: return "Assist Prod-Pers Care/Safety";
+            case _603: return "Assist-Integrate School/Ed";
+            case _604: return "Assist-Life Stage, Transition";
+            case _605: return "Assist-Personal Activities";
+            case _606: return "Assist-Travel/Transport";
+            case _607: return "Assistive Equip-General Tasks";
+            case _608: return "Assistive Equip-Recreation";
+            case _609: return "Assistive Prod-Household Task";
+            case _610: return "Behaviour Support";
+            case _611: return "Comms & Info Equipment";
+            case _612: return "Community Nursing Care";
+            case _613: return "Daily Tasks/Shared Living";
+            case _614: return "Development-Life Skills";
+            case _615: return "Early Childhood Supports";
+            case _616: return "Equipment Special Assess Setup";
+            case _617: return "Hearing Equipment";
+            case _618: return "Home Modification";
+            case _619: return "Household Tasks";
+            case _620: return "Interpret/Translate";
+            case _621: return "Other Innovative Supports";
+            case _622: return "Participate Community";
+            case _623: return "Personal Mobility Equipment";
+            case _624: return "Physical Wellbeing";
+            case _625: return "Plan Management";
+            case _626: return "Therapeutic Supports";
+            case _627: return "Training-Travel Independence";
+            case _628: return "Vehicle modifications";
+            case _629: return "Vision Equipment";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Adoption/Permanent Care Info/Support";
+            case _2: return "Aged Care Assessment";
+            case _3: return "Aged Care Information/Referral";
+            case _4: return "Aged Residential Care";
+            case _5: return "Case Management for Older Persons";
+            case _6: return "Delivered Meals (Meals On Wheels)";
+            case _7: return "Friendly Visiting";
+            case _8: return "Home Care/Housekeeping Assistance";
+            case _9: return "Home Maintenance and Repair";
+            case _10: return "Personal Alarms/Alerts";
+            case _11: return "Personal Care for Older Persons";
+            case _12: return "Planned Activity Groups";
+            case _13: return "Acupuncture";
+            case _14: return "Alexander Technique Therapy";
+            case _15: return "Aromatherapy";
+            case _16: return "Biorhythm Services";
+            case _17: return "Bowen Therapy";
+            case _18: return "Chinese Herbal Medicine";
+            case _19: return "Feldenkrais";
+            case _20: return "Homoeopathy";
+            case _21: return "Hydrotherapy";
+            case _22: return "Hypnotherapy";
+            case _23: return "Kinesiology";
+            case _24: return "Magnetic Therapy";
+            case _25: return "Massage Therapy";
+            case _26: return "Meditation";
+            case _27: return "Myotherapy";
+            case _28: return "Naturopathy";
+            case _29: return "Reflexology";
+            case _30: return "Reiki";
+            case _31: return "Relaxation Therapy";
+            case _32: return "Shiatsu";
+            case _33: return "Western Herbal Medicine";
+            case _34: return "Family Day care";
+            case _35: return "Holiday Programs";
+            case _36: return "Kindergarten Inclusion Support ";
+            case _37: return "Kindergarten/Preschool";
+            case _38: return "Long Day Child Care";
+            case _39: return "Occasional Child Care";
+            case _40: return "Outside School Hours Care";
+            case _41: return "Children's Play Programs";
+            case _42: return "Parenting/Family Support/Education";
+            case _43: return "Playgroup";
+            case _44: return "School Nursing";
+            case _45: return "Toy Library";
+            case _46: return "Child Protection/Child Abuse Report";
+            case _47: return "Foster Care";
+            case _48: return "Residential/Out-of-Home Care";
+            case _49: return "Support - Young People Leaving Care";
+            case _50: return "Audiology";
+            case _51: return "Blood Donation";
+            case _52: return "Chiropractic";
+            case _53: return "Dietetics";
+            case _54: return "Family Planning";
+            case _55: return "Health Advocacy/Liaison Service";
+            case _56: return "Health Information/Referral";
+            case _57: return "Immunization";
+            case _58: return "Maternal & Child Health";
+            case _59: return "Nursing";
+            case _60: return "Nutrition";
+            case _61: return "Occupational Therapy";
+            case _62: return "Optometry";
+            case _63: return "Osteopathy";
+            case _64: return "Pharmacy";
+            case _65: return "Physiotherapy";
+            case _66: return "Podiatry";
+            case _67: return "Sexual Health";
+            case _68: return "Speech Pathology/Therapy";
+            case _69: return "Bereavement Counselling";
+            case _70: return "Crisis Counselling";
+            case _71: return "Family Counselling/Therapy";
+            case _72: return "Family Violence Counselling";
+            case _73: return "Financial Counselling";
+            case _74: return "Generalist Counselling";
+            case _75: return "Genetic Counselling";
+            case _76: return "Health Counselling";
+            case _77: return "Mediation";
+            case _78: return "Problem Gambling Counselling";
+            case _79: return "Relationship Counselling";
+            case _80: return "Sexual Assault Counselling";
+            case _81: return "Trauma Counselling";
+            case _82: return "Victims of Crime Counselling";
+            case _83: return "Cemetery Operation";
+            case _84: return "Cremation";
+            case _85: return "Death Service Information";
+            case _86: return "Funeral Services";
+            case _87: return "Endodontic";
+            case _88: return "General Dental";
+            case _89: return "Oral Medicine";
+            case _90: return "Oral Surgery";
+            case _91: return "Orthodontic";
+            case _92: return "Paediatric Dentistry";
+            case _93: return "Periodontic";
+            case _94: return "Prosthodontic";
+            case _95: return "Acquired Brain Injury Info/Referral";
+            case _96: return "Disability Advocacy";
+            case _97: return "Disability Aids & Equipment";
+            case _98: return "Disability Case Management";
+            case _99: return "Disability Day Programs/Activities";
+            case _100: return "Disability Information/Referral";
+            case _101: return "Disability Support Packages";
+            case _102: return "Disability Supported Accommodation";
+            case _103: return "Early Childhood Intervention";
+            case _104: return "Hearing Aids & Equipment";
+            case _105: return "Drug and/or Alcohol Counselling";
+            case _106: return "Drug/Alcohol Information/Referral";
+            case _107: return "Needle & Syringe Exchange";
+            case _108: return "Non-resid. Alcohol/Drug Treatment ";
+            case _109: return "Pharmacotherapy";
+            case _110: return "Quit Program";
+            case _111: return "Residential Alcohol/Drug Treatment ";
+            case _112: return "Adult/Community Education";
+            case _113: return "Higher Education";
+            case _114: return "Primary Education";
+            case _115: return "Secondary Education";
+            case _116: return "Training & Vocational Education";
+            case _117: return "Emergency Medical";
+            case _118: return "Employment Placement and/or Support";
+            case _119: return "Vocational Rehabilitation";
+            case _120: return "Work Safety/Accident Prevention";
+            case _121: return "Financial Assistance";
+            case _122: return "Financial Information/Advice";
+            case _123: return "Material Aid";
+            case _124: return "General Practice";
+            case _125: return "Accommodation Placement/Support";
+            case _126: return "Crisis/Emergency Accommodation";
+            case _127: return "Homelessness Support";
+            case _128: return "Housing Information/Referral";
+            case _129: return "Public Rental Housing";
+            case _130: return "Interpreting/Multilingual Service";
+            case _131: return "Juvenile Justice";
+            case _132: return "Legal Advocacy";
+            case _133: return "Legal Information/Advice/Referral";
+            case _134: return "Mental Health Advocacy";
+            case _135: return "Mental Health Assess/Triage/Crisis Response";
+            case _136: return "Mental Health Case Management";
+            case _137: return "Mental Health Information/Referral";
+            case _138: return "Mental Health Inpatient Services";
+            case _139: return "Mental Health Non-residential Rehab";
+            case _140: return "Mental Health Residential Rehab/CCU";
+            case _141: return "Psychiatry (Requires Referral)";
+            case _142: return "Psychology";
+            case _143: return "Martial Arts";
+            case _144: return "Personal Fitness Training";
+            case _145: return "Physical Activity Group";
+            case _146: return "Physical Activity Programs";
+            case _147: return "Physical Fitness Testing";
+            case _148: return "Pilates";
+            case _149: return "Self-Defence";
+            case _150: return "Sporting Club";
+            case _151: return "Yoga";
+            case _152: return "Food Safety";
+            case _153: return "Health Regulatory /Inspection /Cert.";
+            case _154: return "Work Health/Safety Inspection/Cert.";
+            case _155: return "Carer Support";
+            case _156: return "Respite Care";
+            case _157: return "Anatomical Pathology ";
+            case _158: return "Pathology - Clinical Chemistry";
+            case _159: return "Pathology - General";
+            case _160: return "Pathology - Genetics";
+            case _161: return "Pathology - Haematology";
+            case _162: return "Pathology - Immunology";
+            case _163: return "Pathology - Microbiology";
+            case _164: return "Anaesthesiology - Pain Medicine";
+            case _165: return "Cardiology";
+            case _166: return "Clinical Genetics";
+            case _167: return "Clinical Pharmacology";
+            case _168: return "Dermatology";
+            case _169: return "Endocrinology";
+            case _170: return "Gastroenterology & Hepatology";
+            case _171: return "Geriatric Medicine";
+            case _172: return "Immunology & Allergy";
+            case _173: return "Infectious Diseases";
+            case _174: return "Intensive Care Medicine";
+            case _175: return "Medical Oncology";
+            case _176: return "Nephrology";
+            case _177: return "Neurology";
+            case _178: return "Occupational Medicine";
+            case _179: return "Palliative Medicine";
+            case _180: return "Public Health Medicine";
+            case _181: return "Rehabilitation Medicine";
+            case _182: return "Rheumatology";
+            case _183: return "Sleep Medicine";
+            case _184: return "Thoracic Medicine";
+            case _185: return "Gynaecological Oncology";
+            case _186: return "Obstetrics & Gynaecology";
+            case _187: return "Reproductive Endocrinology/Infertility";
+            case _188: return "Urogynaecology";
+            case _189: return "Neonatology & Perinatology";
+            case _190: return "Paediatric Cardiology";
+            case _191: return "Paediatric Clinical Genetics";
+            case _192: return "Paediatric Clinical Pharmacology";
+            case _193: return "Paediatric Endocrinology";
+            case _194: return "Paed. Gastroenterology/Hepatology";
+            case _195: return "Paediatric Haematology";
+            case _196: return "Paediatric Immunology & Allergy";
+            case _197: return "Paediatric Infectious Diseases";
+            case _198: return "Paediatric Intensive Care Medicine";
+            case _199: return "Paediatric Medical Oncology";
+            case _200: return "Paediatric Medicine";
+            case _201: return "Paediatric Nephrology";
+            case _202: return "Paediatric Neurology";
+            case _203: return "Paediatric Nuclear Medicine";
+            case _204: return "Paediatric Rehabilitation Medicine";
+            case _205: return "Paediatric Rheumatology";
+            case _206: return "Paediatric Sleep Medicine";
+            case _207: return "Paediatric Surgery";
+            case _208: return "Paediatric Thoracic Medicine";
+            case _209: return "Diag. Radiology /Xray /CT /Fluoroscopy";
+            case _210: return "Diagnostic Ultrasound";
+            case _211: return "Magnetic Resonance Imaging (MRI)";
+            case _212: return "Nuclear Medicine";
+            case _213: return "Obstetric/Gynaecological Ultrasound";
+            case _214: return "Radiation Oncology";
+            case _215: return "Cardiothoracic Surgery";
+            case _216: return "Neurosurgery";
+            case _217: return "Ophthalmology";
+            case _218: return "Orthopaedic Surgery";
+            case _219: return "Otolaryngology/Head & Neck Surgery";
+            case _220: return "Plastic & Reconstructive Surgery";
+            case _221: return "Surgery - General";
+            case _222: return "Urology";
+            case _223: return "Vascular Surgery";
+            case _224: return "Support Groups";
+            case _225: return "Air ambulance";
+            case _226: return "Ambulance";
+            case _227: return "Blood Transport";
+            case _228: return "Community Bus";
+            case _229: return "Flying Doctor Service";
+            case _230: return "Patient Transport";
+            case _231: return "A&E";
+            case _232: return "A&EP";
+            case _233: return "Abuse";
+            case _234: return "ACAS";
+            case _235: return "Access";
+            case _236: return "Accident";
+            case _237: return "Acute Inpatient Serv";
+            case _238: return "Adult Day Programs";
+            case _239: return "Adult Mental Health Services";
+            case _240: return "Advice";
+            case _241: return "Advocacy";
+            case _242: return "Aged Persons Mental ";
+            case _243: return "Aged Persons Mental ";
+            case _244: return "Aged Persons Mental ";
+            case _245: return "Aids";
+            case _246: return "Al-Anon";
+            case _247: return "Alcohol";
+            case _248: return "Al-Teen";
+            case _249: return "Antenatal";
+            case _250: return "Anxiety";
+            case _251: return "Arthritis";
+            case _252: return "Assessment";
+            case _253: return "Assistance";
+            case _254: return "Asthma";
+            case _255: return "ATSS";
+            case _256: return "Attendant Care";
+            case _257: return "Babies";
+            case _258: return "Bathroom Modificatio";
+            case _259: return "Behaviour";
+            case _260: return "Behaviour Interventi";
+            case _261: return "Bereavement";
+            case _262: return "Bipolar";
+            case _263: return "Birth";
+            case _264: return "Birth Control";
+            case _265: return "Birthing Options";
+            case _266: return "BIST";
+            case _267: return "Blood";
+            case _268: return "Bone";
+            case _269: return "Bowel";
+            case _270: return "Brain";
+            case _271: return "Breast Feeding";
+            case _272: return "Breast Screen";
+            case _273: return "Brokerage";
+            case _274: return "Cancer";
+            case _275: return "Cancer Support";
+            case _276: return "Cardiovascular Disea";
+            case _277: return "Care Packages";
+            case _278: return "Carer";
+            case _279: return "Case Management";
+            case _280: return "Casualty";
+            case _281: return "Centrelink";
+            case _282: return "Chemists";
+            case _283: return "Child And Adolescent";
+            case _284: return "Child Care";
+            case _285: return "Child Services";
+            case _286: return "Children";
+            case _287: return "Children's Services";
+            case _288: return "Cholesterol";
+            case _289: return "Clothing";
+            case _290: return "Community Based Acco";
+            case _291: return "Community Care Unit";
+            case _292: return "Community Child And ";
+            case _293: return "Community Health";
+            case _294: return "Community Residentia";
+            case _295: return "Community Transport";
+            case _296: return "Companion Visiting";
+            case _297: return "Companionship";
+            case _298: return "Consumer Advice";
+            case _299: return "Consumer Issues";
+            case _300: return "Continuing Care Serv";
+            case _301: return "Contraception Inform";
+            case _302: return "Coordinating Bodies";
+            case _303: return "Correctional Service";
+            case _304: return "Council Environmenta";
+            case _305: return "Counselling";
+            case _306: return "Criminal";
+            case _307: return "Crises";
+            case _308: return "Crisis Assessment An";
+            case _309: return "Crisis Assistance";
+            case _310: return "Crisis Refuge";
+            case _311: return "Day Program";
+            case _312: return "Deaf";
+            case _313: return "Dental Hygiene";
+            case _314: return "Dentistry";
+            case _315: return "Dentures";
+            case _316: return "Depression";
+            case _317: return "Detoxification";
+            case _318: return "Diabetes";
+            case _319: return "Diaphragm Fitting";
+            case _320: return "Dieticians";
+            case _321: return "Disabled Parking";
+            case _322: return "District Nursing";
+            case _323: return "Divorce";
+            case _324: return "Doctors";
+            case _325: return "Drink-Drive";
+            case _326: return "Dual Diagnosis Servi";
+            case _327: return "Early Choice";
+            case _328: return "Eating Disorder";
+            case _330: return "Emergency Relief";
+            case _331: return "Employment And Train";
+            case _332: return "Environment";
+            case _333: return "Equipment";
+            case _334: return "Exercise";
+            case _335: return "Facility";
+            case _336: return "Family Choice";
+            case _337: return "Family Law";
+            case _338: return "Family Options";
+            case _339: return "Family Services";
+            case _340: return "FFYA";
+            case _341: return "Financial Aid";
+            case _342: return "Fitness";
+            case _343: return "Flexible Care Packag";
+            case _344: return "Food";
+            case _345: return "Food Vouchers";
+            case _346: return "Forensic Mental Heal";
+            case _347: return "Futures";
+            case _348: return "Futures For Young Ad";
+            case _349: return "General Practitioner";
+            case _350: return "Grants";
+            case _351: return "Grief";
+            case _352: return "Grief Counselling";
+            case _353: return "HACC";
+            case _354: return "Heart Disease";
+            case _355: return "Help";
+            case _356: return "High Blood Pressure";
+            case _357: return "Home Help";
+            case _358: return "Home Nursing";
+            case _359: return "Homefirst";
+            case _360: return "Hospice Care";
+            case _361: return "Hospital Services";
+            case _362: return "Hospital To Home";
+            case _364: return "Hostel";
+            case _365: return "Hostel Accommodation";
+            case _366: return "Household Items";
+            case _367: return "Hypertension";
+            case _368: return "Illness";
+            case _369: return "Independent Living";
+            case _370: return "Information";
+            case _371: return "Injury";
+            case _372: return "Intake";
+            case _373: return "Intensive Mobile You";
+            case _374: return "Intervention";
+            case _375: return "Job Searching";
+            case _376: return "Justice";
+            case _377: return "Leisure";
+            case _378: return "Loans";
+            case _379: return "Low Income Earners";
+            case _380: return "Lung";
+            case _381: return "Making A Difference";
+            case _382: return "Medical Services";
+            case _383: return "Medical Specialists";
+            case _384: return "Medication Administr";
+            case _385: return "Menstrual Informatio";
+            case _386: return "Methadone";
+            case _387: return "Mobile Support And T";
+            case _388: return "Motor Neurone";
+            case _389: return "Multiple Sclerosis";
+            case _390: return "Neighbourhood House";
+            case _391: return "Nursing Home";
+            case _392: return "Nursing Mothers";
+            case _393: return "Obesity";
+            case _394: return "Occupational Health ";
+            case _395: return "Optometrist";
+            case _396: return "Oral Hygiene";
+            case _397: return "Outpatients";
+            case _398: return "Outreach Service";
+            case _399: return "PADP";
+            case _400: return "Pain";
+            case _401: return "Pap Smear";
+            case _402: return "Parenting";
+            case _403: return "Peak Organisations";
+            case _404: return "Personal Care";
+            case _405: return "Pharmacies";
+            case _406: return "Phobias";
+            case _407: return "Physical";
+            case _408: return "Physical Activity";
+            case _409: return "Postnatal";
+            case _410: return "Pregnancy";
+            case _411: return "Pregnancy Tests";
+            case _412: return "Preschool";
+            case _413: return "Prescriptions";
+            case _414: return "Primary Mental Healt";
+            case _415: return "Property Maintenance";
+            case _416: return "Prostate";
+            case _417: return "Psychiatric";
+            case _418: return "Psychiatric Disabili";
+            case _419: return "Psychiatric Disabili";
+            case _420: return "Psychiatric Disabili";
+            case _421: return "Psychiatric Disabili";
+            case _422: return "Psychiatric Disabili";
+            case _423: return "Psychiatric Support";
+            case _424: return "Recreation";
+            case _425: return "Referral";
+            case _426: return "Refuge";
+            case _427: return "Rent Assistance";
+            case _428: return "Residential Faciliti";
+            case _429: return "Residential Respite";
+            case _430: return "Respiratory";
+            case _431: return "Response";
+            case _432: return "Rooming Houses";
+            case _433: return "Safe Sex";
+            case _434: return "Secure Extended Care";
+            case _435: return "Self Help";
+            case _436: return "Separation";
+            case _437: return "Services";
+            case _438: return "Sex Education";
+            case _439: return "Sexual Abuse";
+            case _440: return "Sexual Issues";
+            case _441: return "Sexually Transmitted";
+            case _442: return "SIDS";
+            case _443: return "Social Support";
+            case _444: return "Socialisation";
+            case _445: return "Special Needs";
+            case _446: return "Speech Therapist";
+            case _447: return "Splinting";
+            case _448: return "Sport";
+            case _449: return "Statewide And Specia";
+            case _450: return "STD";
+            case _451: return "STI";
+            case _452: return "Stillbirth";
+            case _453: return "Stomal Care";
+            case _454: return "Stroke";
+            case _455: return "Substance Abuse";
+            case _456: return "Support";
+            case _457: return "Syringes";
+            case _458: return "Teeth";
+            case _459: return "Tenancy Advice";
+            case _460: return "Terminal Illness";
+            case _461: return "Therapy";
+            case _462: return "Transcription";
+            case _463: return "Translating Services";
+            case _464: return "Translator";
+            case _465: return "Transport";
+            case _466: return "Vertebrae";
+            case _467: return "Violence";
+            case _468: return "Vocational Guidance";
+            case _469: return "Weight";
+            case _470: return "Welfare Assistance";
+            case _471: return "Welfare Counselling";
+            case _472: return "Wheelchairs";
+            case _473: return "Wound Management";
+            case _474: return "Young People At Risk";
+            case _475: return "Further Desc. - Community Health Care";
+            case _476: return "Library";
+            case _477: return "Community Hours";
+            case _478: return "Further Desc. - Specialist Medical";
+            case _479: return "Hepatology";
+            case _480: return "Gastroenterology ";
+            case _481: return "Gynaecology";
+            case _482: return "Obstetrics";
+            case _483: return "Further Desc. - Specialist Surgical";
+            case _484: return "Placement Protection";
+            case _485: return "Family Violence";
+            case _486: return "Integrated Family Services";
+            case _488: return "Diabetes Educator";
+            case _489: return "Kinship Care";
+            case _490: return "General Mental Health Services";
+            case _491: return "Exercise Physiology";
+            case _492: return "Medical Research";
+            case _493: return "Youth";
+            case _494: return "Youth Services";
+            case _495: return "Youth Health";
+            case _496: return "Child and Family Ser";
+            case _497: return "Home Visits";
+            case _498: return "Mobile Services";
+            case _500: return "Before and/or After ";
+            case _501: return "Cancer Services";
+            case _502: return "Integrated Cancer Se";
+            case _503: return "Multidisciplinary Se";
+            case _504: return "Multidisciplinary Ca";
+            case _505: return "Meetings";
+            case _506: return "Blood pressure monit";
+            case _507: return "Dose administration ";
+            case _508: return "Medical Equipment Hi";
+            case _509: return "Parenting/Family Support/Education";
+            case _510: return "Deputising Service";
+            case _513: return "Cancer Support Groups";
+            case _514: return "Community Cancer Services";
+            case _530: return "Disability Care Transport";
+            case _531: return "Aged Care Transport";
+            case _532: return "Diabetes Education s";
+            case _533: return "Cardiac Rehabilitati";
+            case _534: return "Young Adult Diabetes";
+            case _535: return "Pulmonary Rehabilita";
+            case _536: return "Art therapy ";
+            case _537: return "Medication Reviews";
+            case _538: return "Telephone Counselling";
+            case _539: return "Telephone Help Line";
+            case _540: return "Online Service";
+            case _541: return "Crisis - Mental Health";
+            case _542: return "Youth Crisis";
+            case _543: return "Sexual Assault";
+            case _544: return "GPAH Other";
+            case _545: return "Paediatric Dermatology";
+            case _546: return "Veterans Services";
+            case _547: return "Veterans";
+            case _548: return "Food Relief/Food/Meals";
+            case _550: return "Dementia Care";
+            case _551: return "Alzheimer";
+            case _552: return "Drug and/or Alcohol Support Groups";
+            case _553: return "1-on-1 Support /Mentoring /Coaching";
+            case _554: return "Chronic Disease Management";
+            case _555: return "Liaison Services";
+            case _556: return "Walk-in Centre /Non-Emergency";
+            case _557: return "Inpatients";
+            case _558: return "Spiritual Counselling";
+            case _559: return "Women's Health";
+            case _560: return "Men's Health";
+            case _561: return "Health Education/Awareness Program";
+            case _562: return "Test Message";
+            case _563: return "Remedial Massage";
+            case _564: return "Adolescent Mental Health Services";
+            case _565: return "Youth Drop In/Assistance/Support";
+            case _566: return "Aboriginal Health Worker";
+            case _567: return "Women's Health Clinic";
+            case _568: return "Men's Health Clinic";
+            case _569: return "Migrant Health Clinic";
+            case _570: return "Refugee Health Clinic";
+            case _571: return "Aboriginal Health Clinic";
+            case _572: return "Nurse Practitioner Lead Clinic/s";
+            case _573: return "Nurse Lead Clinic/s";
+            case _574: return "Culturally Tailored Support Groups";
+            case _575: return "Culturally Tailored Health Promotion";
+            case _576: return "Rehabilitation";
+            case _577: return "Education Information/Referral";
+            case _580: return "Social Work";
+            case _581: return "Haematology";
+            case _582: return "Maternity Shared Car";
+            case _583: return "Rehabilitation Servi";
+            case _584: return "Cranio-sacral Therapy";
+            case _585: return "Prosthetics & Orthotics";
+            case _589: return "Home Medicine Review";
+            case _590: return "GPAH - Medical";
+            case _591: return "Music Therapy";
+            case _593: return "Falls Prevention";
+            case _599: return "Accommodation/Tenancy";
+            case _600: return "Assess-Skill, Ability, Needs";
+            case _601: return "Assist Access/Maintain Employ";
+            case _602: return "Assist Prod-Pers Care/Safety";
+            case _603: return "Assist-Integrate School/Ed";
+            case _604: return "Assist-Life Stage, Transition";
+            case _605: return "Assist-Personal Activities";
+            case _606: return "Assist-Travel/Transport";
+            case _607: return "Assistive Equip-General Tasks";
+            case _608: return "Assistive Equip-Recreation";
+            case _609: return "Assistive Prod-Household Task";
+            case _610: return "Behaviour Support";
+            case _611: return "Comms & Info Equipment";
+            case _612: return "Community Nursing Care";
+            case _613: return "Daily Tasks/Shared Living";
+            case _614: return "Development-Life Skills";
+            case _615: return "Early Childhood Supports";
+            case _616: return "Equipment Special Assess Setup";
+            case _617: return "Hearing Equipment";
+            case _618: return "Home Modification";
+            case _619: return "Household Tasks";
+            case _620: return "Interpret/Translate";
+            case _621: return "Other Innovative Supports";
+            case _622: return "Participate Community";
+            case _623: return "Personal Mobility Equipment";
+            case _624: return "Physical Wellbeing";
+            case _625: return "Plan Management";
+            case _626: return "Therapeutic Supports";
+            case _627: return "Training-Travel Independence";
+            case _628: return "Vehicle modifications";
+            case _629: return "Vision Equipment";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceTypeEnumFactory.java
new file mode 100644
index 00000000000..08d2d4b70cc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceTypeEnumFactory.java
@@ -0,0 +1,2438 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ServiceTypeEnumFactory implements EnumFactory {
+
+  public ServiceType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return ServiceType._1;
+    if ("2".equals(codeString))
+      return ServiceType._2;
+    if ("3".equals(codeString))
+      return ServiceType._3;
+    if ("4".equals(codeString))
+      return ServiceType._4;
+    if ("5".equals(codeString))
+      return ServiceType._5;
+    if ("6".equals(codeString))
+      return ServiceType._6;
+    if ("7".equals(codeString))
+      return ServiceType._7;
+    if ("8".equals(codeString))
+      return ServiceType._8;
+    if ("9".equals(codeString))
+      return ServiceType._9;
+    if ("10".equals(codeString))
+      return ServiceType._10;
+    if ("11".equals(codeString))
+      return ServiceType._11;
+    if ("12".equals(codeString))
+      return ServiceType._12;
+    if ("13".equals(codeString))
+      return ServiceType._13;
+    if ("14".equals(codeString))
+      return ServiceType._14;
+    if ("15".equals(codeString))
+      return ServiceType._15;
+    if ("16".equals(codeString))
+      return ServiceType._16;
+    if ("17".equals(codeString))
+      return ServiceType._17;
+    if ("18".equals(codeString))
+      return ServiceType._18;
+    if ("19".equals(codeString))
+      return ServiceType._19;
+    if ("20".equals(codeString))
+      return ServiceType._20;
+    if ("21".equals(codeString))
+      return ServiceType._21;
+    if ("22".equals(codeString))
+      return ServiceType._22;
+    if ("23".equals(codeString))
+      return ServiceType._23;
+    if ("24".equals(codeString))
+      return ServiceType._24;
+    if ("25".equals(codeString))
+      return ServiceType._25;
+    if ("26".equals(codeString))
+      return ServiceType._26;
+    if ("27".equals(codeString))
+      return ServiceType._27;
+    if ("28".equals(codeString))
+      return ServiceType._28;
+    if ("29".equals(codeString))
+      return ServiceType._29;
+    if ("30".equals(codeString))
+      return ServiceType._30;
+    if ("31".equals(codeString))
+      return ServiceType._31;
+    if ("32".equals(codeString))
+      return ServiceType._32;
+    if ("33".equals(codeString))
+      return ServiceType._33;
+    if ("34".equals(codeString))
+      return ServiceType._34;
+    if ("35".equals(codeString))
+      return ServiceType._35;
+    if ("36".equals(codeString))
+      return ServiceType._36;
+    if ("37".equals(codeString))
+      return ServiceType._37;
+    if ("38".equals(codeString))
+      return ServiceType._38;
+    if ("39".equals(codeString))
+      return ServiceType._39;
+    if ("40".equals(codeString))
+      return ServiceType._40;
+    if ("41".equals(codeString))
+      return ServiceType._41;
+    if ("42".equals(codeString))
+      return ServiceType._42;
+    if ("43".equals(codeString))
+      return ServiceType._43;
+    if ("44".equals(codeString))
+      return ServiceType._44;
+    if ("45".equals(codeString))
+      return ServiceType._45;
+    if ("46".equals(codeString))
+      return ServiceType._46;
+    if ("47".equals(codeString))
+      return ServiceType._47;
+    if ("48".equals(codeString))
+      return ServiceType._48;
+    if ("49".equals(codeString))
+      return ServiceType._49;
+    if ("50".equals(codeString))
+      return ServiceType._50;
+    if ("51".equals(codeString))
+      return ServiceType._51;
+    if ("52".equals(codeString))
+      return ServiceType._52;
+    if ("53".equals(codeString))
+      return ServiceType._53;
+    if ("54".equals(codeString))
+      return ServiceType._54;
+    if ("55".equals(codeString))
+      return ServiceType._55;
+    if ("56".equals(codeString))
+      return ServiceType._56;
+    if ("57".equals(codeString))
+      return ServiceType._57;
+    if ("58".equals(codeString))
+      return ServiceType._58;
+    if ("59".equals(codeString))
+      return ServiceType._59;
+    if ("60".equals(codeString))
+      return ServiceType._60;
+    if ("61".equals(codeString))
+      return ServiceType._61;
+    if ("62".equals(codeString))
+      return ServiceType._62;
+    if ("63".equals(codeString))
+      return ServiceType._63;
+    if ("64".equals(codeString))
+      return ServiceType._64;
+    if ("65".equals(codeString))
+      return ServiceType._65;
+    if ("66".equals(codeString))
+      return ServiceType._66;
+    if ("67".equals(codeString))
+      return ServiceType._67;
+    if ("68".equals(codeString))
+      return ServiceType._68;
+    if ("69".equals(codeString))
+      return ServiceType._69;
+    if ("70".equals(codeString))
+      return ServiceType._70;
+    if ("71".equals(codeString))
+      return ServiceType._71;
+    if ("72".equals(codeString))
+      return ServiceType._72;
+    if ("73".equals(codeString))
+      return ServiceType._73;
+    if ("74".equals(codeString))
+      return ServiceType._74;
+    if ("75".equals(codeString))
+      return ServiceType._75;
+    if ("76".equals(codeString))
+      return ServiceType._76;
+    if ("77".equals(codeString))
+      return ServiceType._77;
+    if ("78".equals(codeString))
+      return ServiceType._78;
+    if ("79".equals(codeString))
+      return ServiceType._79;
+    if ("80".equals(codeString))
+      return ServiceType._80;
+    if ("81".equals(codeString))
+      return ServiceType._81;
+    if ("82".equals(codeString))
+      return ServiceType._82;
+    if ("83".equals(codeString))
+      return ServiceType._83;
+    if ("84".equals(codeString))
+      return ServiceType._84;
+    if ("85".equals(codeString))
+      return ServiceType._85;
+    if ("86".equals(codeString))
+      return ServiceType._86;
+    if ("87".equals(codeString))
+      return ServiceType._87;
+    if ("88".equals(codeString))
+      return ServiceType._88;
+    if ("89".equals(codeString))
+      return ServiceType._89;
+    if ("90".equals(codeString))
+      return ServiceType._90;
+    if ("91".equals(codeString))
+      return ServiceType._91;
+    if ("92".equals(codeString))
+      return ServiceType._92;
+    if ("93".equals(codeString))
+      return ServiceType._93;
+    if ("94".equals(codeString))
+      return ServiceType._94;
+    if ("95".equals(codeString))
+      return ServiceType._95;
+    if ("96".equals(codeString))
+      return ServiceType._96;
+    if ("97".equals(codeString))
+      return ServiceType._97;
+    if ("98".equals(codeString))
+      return ServiceType._98;
+    if ("99".equals(codeString))
+      return ServiceType._99;
+    if ("100".equals(codeString))
+      return ServiceType._100;
+    if ("101".equals(codeString))
+      return ServiceType._101;
+    if ("102".equals(codeString))
+      return ServiceType._102;
+    if ("103".equals(codeString))
+      return ServiceType._103;
+    if ("104".equals(codeString))
+      return ServiceType._104;
+    if ("105".equals(codeString))
+      return ServiceType._105;
+    if ("106".equals(codeString))
+      return ServiceType._106;
+    if ("107".equals(codeString))
+      return ServiceType._107;
+    if ("108".equals(codeString))
+      return ServiceType._108;
+    if ("109".equals(codeString))
+      return ServiceType._109;
+    if ("110".equals(codeString))
+      return ServiceType._110;
+    if ("111".equals(codeString))
+      return ServiceType._111;
+    if ("112".equals(codeString))
+      return ServiceType._112;
+    if ("113".equals(codeString))
+      return ServiceType._113;
+    if ("114".equals(codeString))
+      return ServiceType._114;
+    if ("115".equals(codeString))
+      return ServiceType._115;
+    if ("116".equals(codeString))
+      return ServiceType._116;
+    if ("117".equals(codeString))
+      return ServiceType._117;
+    if ("118".equals(codeString))
+      return ServiceType._118;
+    if ("119".equals(codeString))
+      return ServiceType._119;
+    if ("120".equals(codeString))
+      return ServiceType._120;
+    if ("121".equals(codeString))
+      return ServiceType._121;
+    if ("122".equals(codeString))
+      return ServiceType._122;
+    if ("123".equals(codeString))
+      return ServiceType._123;
+    if ("124".equals(codeString))
+      return ServiceType._124;
+    if ("125".equals(codeString))
+      return ServiceType._125;
+    if ("126".equals(codeString))
+      return ServiceType._126;
+    if ("127".equals(codeString))
+      return ServiceType._127;
+    if ("128".equals(codeString))
+      return ServiceType._128;
+    if ("129".equals(codeString))
+      return ServiceType._129;
+    if ("130".equals(codeString))
+      return ServiceType._130;
+    if ("131".equals(codeString))
+      return ServiceType._131;
+    if ("132".equals(codeString))
+      return ServiceType._132;
+    if ("133".equals(codeString))
+      return ServiceType._133;
+    if ("134".equals(codeString))
+      return ServiceType._134;
+    if ("135".equals(codeString))
+      return ServiceType._135;
+    if ("136".equals(codeString))
+      return ServiceType._136;
+    if ("137".equals(codeString))
+      return ServiceType._137;
+    if ("138".equals(codeString))
+      return ServiceType._138;
+    if ("139".equals(codeString))
+      return ServiceType._139;
+    if ("140".equals(codeString))
+      return ServiceType._140;
+    if ("141".equals(codeString))
+      return ServiceType._141;
+    if ("142".equals(codeString))
+      return ServiceType._142;
+    if ("143".equals(codeString))
+      return ServiceType._143;
+    if ("144".equals(codeString))
+      return ServiceType._144;
+    if ("145".equals(codeString))
+      return ServiceType._145;
+    if ("146".equals(codeString))
+      return ServiceType._146;
+    if ("147".equals(codeString))
+      return ServiceType._147;
+    if ("148".equals(codeString))
+      return ServiceType._148;
+    if ("149".equals(codeString))
+      return ServiceType._149;
+    if ("150".equals(codeString))
+      return ServiceType._150;
+    if ("151".equals(codeString))
+      return ServiceType._151;
+    if ("152".equals(codeString))
+      return ServiceType._152;
+    if ("153".equals(codeString))
+      return ServiceType._153;
+    if ("154".equals(codeString))
+      return ServiceType._154;
+    if ("155".equals(codeString))
+      return ServiceType._155;
+    if ("156".equals(codeString))
+      return ServiceType._156;
+    if ("157".equals(codeString))
+      return ServiceType._157;
+    if ("158".equals(codeString))
+      return ServiceType._158;
+    if ("159".equals(codeString))
+      return ServiceType._159;
+    if ("160".equals(codeString))
+      return ServiceType._160;
+    if ("161".equals(codeString))
+      return ServiceType._161;
+    if ("162".equals(codeString))
+      return ServiceType._162;
+    if ("163".equals(codeString))
+      return ServiceType._163;
+    if ("164".equals(codeString))
+      return ServiceType._164;
+    if ("165".equals(codeString))
+      return ServiceType._165;
+    if ("166".equals(codeString))
+      return ServiceType._166;
+    if ("167".equals(codeString))
+      return ServiceType._167;
+    if ("168".equals(codeString))
+      return ServiceType._168;
+    if ("169".equals(codeString))
+      return ServiceType._169;
+    if ("170".equals(codeString))
+      return ServiceType._170;
+    if ("171".equals(codeString))
+      return ServiceType._171;
+    if ("172".equals(codeString))
+      return ServiceType._172;
+    if ("173".equals(codeString))
+      return ServiceType._173;
+    if ("174".equals(codeString))
+      return ServiceType._174;
+    if ("175".equals(codeString))
+      return ServiceType._175;
+    if ("176".equals(codeString))
+      return ServiceType._176;
+    if ("177".equals(codeString))
+      return ServiceType._177;
+    if ("178".equals(codeString))
+      return ServiceType._178;
+    if ("179".equals(codeString))
+      return ServiceType._179;
+    if ("180".equals(codeString))
+      return ServiceType._180;
+    if ("181".equals(codeString))
+      return ServiceType._181;
+    if ("182".equals(codeString))
+      return ServiceType._182;
+    if ("183".equals(codeString))
+      return ServiceType._183;
+    if ("184".equals(codeString))
+      return ServiceType._184;
+    if ("185".equals(codeString))
+      return ServiceType._185;
+    if ("186".equals(codeString))
+      return ServiceType._186;
+    if ("187".equals(codeString))
+      return ServiceType._187;
+    if ("188".equals(codeString))
+      return ServiceType._188;
+    if ("189".equals(codeString))
+      return ServiceType._189;
+    if ("190".equals(codeString))
+      return ServiceType._190;
+    if ("191".equals(codeString))
+      return ServiceType._191;
+    if ("192".equals(codeString))
+      return ServiceType._192;
+    if ("193".equals(codeString))
+      return ServiceType._193;
+    if ("194".equals(codeString))
+      return ServiceType._194;
+    if ("195".equals(codeString))
+      return ServiceType._195;
+    if ("196".equals(codeString))
+      return ServiceType._196;
+    if ("197".equals(codeString))
+      return ServiceType._197;
+    if ("198".equals(codeString))
+      return ServiceType._198;
+    if ("199".equals(codeString))
+      return ServiceType._199;
+    if ("200".equals(codeString))
+      return ServiceType._200;
+    if ("201".equals(codeString))
+      return ServiceType._201;
+    if ("202".equals(codeString))
+      return ServiceType._202;
+    if ("203".equals(codeString))
+      return ServiceType._203;
+    if ("204".equals(codeString))
+      return ServiceType._204;
+    if ("205".equals(codeString))
+      return ServiceType._205;
+    if ("206".equals(codeString))
+      return ServiceType._206;
+    if ("207".equals(codeString))
+      return ServiceType._207;
+    if ("208".equals(codeString))
+      return ServiceType._208;
+    if ("209".equals(codeString))
+      return ServiceType._209;
+    if ("210".equals(codeString))
+      return ServiceType._210;
+    if ("211".equals(codeString))
+      return ServiceType._211;
+    if ("212".equals(codeString))
+      return ServiceType._212;
+    if ("213".equals(codeString))
+      return ServiceType._213;
+    if ("214".equals(codeString))
+      return ServiceType._214;
+    if ("215".equals(codeString))
+      return ServiceType._215;
+    if ("216".equals(codeString))
+      return ServiceType._216;
+    if ("217".equals(codeString))
+      return ServiceType._217;
+    if ("218".equals(codeString))
+      return ServiceType._218;
+    if ("219".equals(codeString))
+      return ServiceType._219;
+    if ("220".equals(codeString))
+      return ServiceType._220;
+    if ("221".equals(codeString))
+      return ServiceType._221;
+    if ("222".equals(codeString))
+      return ServiceType._222;
+    if ("223".equals(codeString))
+      return ServiceType._223;
+    if ("224".equals(codeString))
+      return ServiceType._224;
+    if ("225".equals(codeString))
+      return ServiceType._225;
+    if ("226".equals(codeString))
+      return ServiceType._226;
+    if ("227".equals(codeString))
+      return ServiceType._227;
+    if ("228".equals(codeString))
+      return ServiceType._228;
+    if ("229".equals(codeString))
+      return ServiceType._229;
+    if ("230".equals(codeString))
+      return ServiceType._230;
+    if ("231".equals(codeString))
+      return ServiceType._231;
+    if ("232".equals(codeString))
+      return ServiceType._232;
+    if ("233".equals(codeString))
+      return ServiceType._233;
+    if ("234".equals(codeString))
+      return ServiceType._234;
+    if ("235".equals(codeString))
+      return ServiceType._235;
+    if ("236".equals(codeString))
+      return ServiceType._236;
+    if ("237".equals(codeString))
+      return ServiceType._237;
+    if ("238".equals(codeString))
+      return ServiceType._238;
+    if ("239".equals(codeString))
+      return ServiceType._239;
+    if ("240".equals(codeString))
+      return ServiceType._240;
+    if ("241".equals(codeString))
+      return ServiceType._241;
+    if ("242".equals(codeString))
+      return ServiceType._242;
+    if ("243".equals(codeString))
+      return ServiceType._243;
+    if ("244".equals(codeString))
+      return ServiceType._244;
+    if ("245".equals(codeString))
+      return ServiceType._245;
+    if ("246".equals(codeString))
+      return ServiceType._246;
+    if ("247".equals(codeString))
+      return ServiceType._247;
+    if ("248".equals(codeString))
+      return ServiceType._248;
+    if ("249".equals(codeString))
+      return ServiceType._249;
+    if ("250".equals(codeString))
+      return ServiceType._250;
+    if ("251".equals(codeString))
+      return ServiceType._251;
+    if ("252".equals(codeString))
+      return ServiceType._252;
+    if ("253".equals(codeString))
+      return ServiceType._253;
+    if ("254".equals(codeString))
+      return ServiceType._254;
+    if ("255".equals(codeString))
+      return ServiceType._255;
+    if ("256".equals(codeString))
+      return ServiceType._256;
+    if ("257".equals(codeString))
+      return ServiceType._257;
+    if ("258".equals(codeString))
+      return ServiceType._258;
+    if ("259".equals(codeString))
+      return ServiceType._259;
+    if ("260".equals(codeString))
+      return ServiceType._260;
+    if ("261".equals(codeString))
+      return ServiceType._261;
+    if ("262".equals(codeString))
+      return ServiceType._262;
+    if ("263".equals(codeString))
+      return ServiceType._263;
+    if ("264".equals(codeString))
+      return ServiceType._264;
+    if ("265".equals(codeString))
+      return ServiceType._265;
+    if ("266".equals(codeString))
+      return ServiceType._266;
+    if ("267".equals(codeString))
+      return ServiceType._267;
+    if ("268".equals(codeString))
+      return ServiceType._268;
+    if ("269".equals(codeString))
+      return ServiceType._269;
+    if ("270".equals(codeString))
+      return ServiceType._270;
+    if ("271".equals(codeString))
+      return ServiceType._271;
+    if ("272".equals(codeString))
+      return ServiceType._272;
+    if ("273".equals(codeString))
+      return ServiceType._273;
+    if ("274".equals(codeString))
+      return ServiceType._274;
+    if ("275".equals(codeString))
+      return ServiceType._275;
+    if ("276".equals(codeString))
+      return ServiceType._276;
+    if ("277".equals(codeString))
+      return ServiceType._277;
+    if ("278".equals(codeString))
+      return ServiceType._278;
+    if ("279".equals(codeString))
+      return ServiceType._279;
+    if ("280".equals(codeString))
+      return ServiceType._280;
+    if ("281".equals(codeString))
+      return ServiceType._281;
+    if ("282".equals(codeString))
+      return ServiceType._282;
+    if ("283".equals(codeString))
+      return ServiceType._283;
+    if ("284".equals(codeString))
+      return ServiceType._284;
+    if ("285".equals(codeString))
+      return ServiceType._285;
+    if ("286".equals(codeString))
+      return ServiceType._286;
+    if ("287".equals(codeString))
+      return ServiceType._287;
+    if ("288".equals(codeString))
+      return ServiceType._288;
+    if ("289".equals(codeString))
+      return ServiceType._289;
+    if ("290".equals(codeString))
+      return ServiceType._290;
+    if ("291".equals(codeString))
+      return ServiceType._291;
+    if ("292".equals(codeString))
+      return ServiceType._292;
+    if ("293".equals(codeString))
+      return ServiceType._293;
+    if ("294".equals(codeString))
+      return ServiceType._294;
+    if ("295".equals(codeString))
+      return ServiceType._295;
+    if ("296".equals(codeString))
+      return ServiceType._296;
+    if ("297".equals(codeString))
+      return ServiceType._297;
+    if ("298".equals(codeString))
+      return ServiceType._298;
+    if ("299".equals(codeString))
+      return ServiceType._299;
+    if ("300".equals(codeString))
+      return ServiceType._300;
+    if ("301".equals(codeString))
+      return ServiceType._301;
+    if ("302".equals(codeString))
+      return ServiceType._302;
+    if ("303".equals(codeString))
+      return ServiceType._303;
+    if ("304".equals(codeString))
+      return ServiceType._304;
+    if ("305".equals(codeString))
+      return ServiceType._305;
+    if ("306".equals(codeString))
+      return ServiceType._306;
+    if ("307".equals(codeString))
+      return ServiceType._307;
+    if ("308".equals(codeString))
+      return ServiceType._308;
+    if ("309".equals(codeString))
+      return ServiceType._309;
+    if ("310".equals(codeString))
+      return ServiceType._310;
+    if ("311".equals(codeString))
+      return ServiceType._311;
+    if ("312".equals(codeString))
+      return ServiceType._312;
+    if ("313".equals(codeString))
+      return ServiceType._313;
+    if ("314".equals(codeString))
+      return ServiceType._314;
+    if ("315".equals(codeString))
+      return ServiceType._315;
+    if ("316".equals(codeString))
+      return ServiceType._316;
+    if ("317".equals(codeString))
+      return ServiceType._317;
+    if ("318".equals(codeString))
+      return ServiceType._318;
+    if ("319".equals(codeString))
+      return ServiceType._319;
+    if ("320".equals(codeString))
+      return ServiceType._320;
+    if ("321".equals(codeString))
+      return ServiceType._321;
+    if ("322".equals(codeString))
+      return ServiceType._322;
+    if ("323".equals(codeString))
+      return ServiceType._323;
+    if ("324".equals(codeString))
+      return ServiceType._324;
+    if ("325".equals(codeString))
+      return ServiceType._325;
+    if ("326".equals(codeString))
+      return ServiceType._326;
+    if ("327".equals(codeString))
+      return ServiceType._327;
+    if ("328".equals(codeString))
+      return ServiceType._328;
+    if ("330".equals(codeString))
+      return ServiceType._330;
+    if ("331".equals(codeString))
+      return ServiceType._331;
+    if ("332".equals(codeString))
+      return ServiceType._332;
+    if ("333".equals(codeString))
+      return ServiceType._333;
+    if ("334".equals(codeString))
+      return ServiceType._334;
+    if ("335".equals(codeString))
+      return ServiceType._335;
+    if ("336".equals(codeString))
+      return ServiceType._336;
+    if ("337".equals(codeString))
+      return ServiceType._337;
+    if ("338".equals(codeString))
+      return ServiceType._338;
+    if ("339".equals(codeString))
+      return ServiceType._339;
+    if ("340".equals(codeString))
+      return ServiceType._340;
+    if ("341".equals(codeString))
+      return ServiceType._341;
+    if ("342".equals(codeString))
+      return ServiceType._342;
+    if ("343".equals(codeString))
+      return ServiceType._343;
+    if ("344".equals(codeString))
+      return ServiceType._344;
+    if ("345".equals(codeString))
+      return ServiceType._345;
+    if ("346".equals(codeString))
+      return ServiceType._346;
+    if ("347".equals(codeString))
+      return ServiceType._347;
+    if ("348".equals(codeString))
+      return ServiceType._348;
+    if ("349".equals(codeString))
+      return ServiceType._349;
+    if ("350".equals(codeString))
+      return ServiceType._350;
+    if ("351".equals(codeString))
+      return ServiceType._351;
+    if ("352".equals(codeString))
+      return ServiceType._352;
+    if ("353".equals(codeString))
+      return ServiceType._353;
+    if ("354".equals(codeString))
+      return ServiceType._354;
+    if ("355".equals(codeString))
+      return ServiceType._355;
+    if ("356".equals(codeString))
+      return ServiceType._356;
+    if ("357".equals(codeString))
+      return ServiceType._357;
+    if ("358".equals(codeString))
+      return ServiceType._358;
+    if ("359".equals(codeString))
+      return ServiceType._359;
+    if ("360".equals(codeString))
+      return ServiceType._360;
+    if ("361".equals(codeString))
+      return ServiceType._361;
+    if ("362".equals(codeString))
+      return ServiceType._362;
+    if ("364".equals(codeString))
+      return ServiceType._364;
+    if ("365".equals(codeString))
+      return ServiceType._365;
+    if ("366".equals(codeString))
+      return ServiceType._366;
+    if ("367".equals(codeString))
+      return ServiceType._367;
+    if ("368".equals(codeString))
+      return ServiceType._368;
+    if ("369".equals(codeString))
+      return ServiceType._369;
+    if ("370".equals(codeString))
+      return ServiceType._370;
+    if ("371".equals(codeString))
+      return ServiceType._371;
+    if ("372".equals(codeString))
+      return ServiceType._372;
+    if ("373".equals(codeString))
+      return ServiceType._373;
+    if ("374".equals(codeString))
+      return ServiceType._374;
+    if ("375".equals(codeString))
+      return ServiceType._375;
+    if ("376".equals(codeString))
+      return ServiceType._376;
+    if ("377".equals(codeString))
+      return ServiceType._377;
+    if ("378".equals(codeString))
+      return ServiceType._378;
+    if ("379".equals(codeString))
+      return ServiceType._379;
+    if ("380".equals(codeString))
+      return ServiceType._380;
+    if ("381".equals(codeString))
+      return ServiceType._381;
+    if ("382".equals(codeString))
+      return ServiceType._382;
+    if ("383".equals(codeString))
+      return ServiceType._383;
+    if ("384".equals(codeString))
+      return ServiceType._384;
+    if ("385".equals(codeString))
+      return ServiceType._385;
+    if ("386".equals(codeString))
+      return ServiceType._386;
+    if ("387".equals(codeString))
+      return ServiceType._387;
+    if ("388".equals(codeString))
+      return ServiceType._388;
+    if ("389".equals(codeString))
+      return ServiceType._389;
+    if ("390".equals(codeString))
+      return ServiceType._390;
+    if ("391".equals(codeString))
+      return ServiceType._391;
+    if ("392".equals(codeString))
+      return ServiceType._392;
+    if ("393".equals(codeString))
+      return ServiceType._393;
+    if ("394".equals(codeString))
+      return ServiceType._394;
+    if ("395".equals(codeString))
+      return ServiceType._395;
+    if ("396".equals(codeString))
+      return ServiceType._396;
+    if ("397".equals(codeString))
+      return ServiceType._397;
+    if ("398".equals(codeString))
+      return ServiceType._398;
+    if ("399".equals(codeString))
+      return ServiceType._399;
+    if ("400".equals(codeString))
+      return ServiceType._400;
+    if ("401".equals(codeString))
+      return ServiceType._401;
+    if ("402".equals(codeString))
+      return ServiceType._402;
+    if ("403".equals(codeString))
+      return ServiceType._403;
+    if ("404".equals(codeString))
+      return ServiceType._404;
+    if ("405".equals(codeString))
+      return ServiceType._405;
+    if ("406".equals(codeString))
+      return ServiceType._406;
+    if ("407".equals(codeString))
+      return ServiceType._407;
+    if ("408".equals(codeString))
+      return ServiceType._408;
+    if ("409".equals(codeString))
+      return ServiceType._409;
+    if ("410".equals(codeString))
+      return ServiceType._410;
+    if ("411".equals(codeString))
+      return ServiceType._411;
+    if ("412".equals(codeString))
+      return ServiceType._412;
+    if ("413".equals(codeString))
+      return ServiceType._413;
+    if ("414".equals(codeString))
+      return ServiceType._414;
+    if ("415".equals(codeString))
+      return ServiceType._415;
+    if ("416".equals(codeString))
+      return ServiceType._416;
+    if ("417".equals(codeString))
+      return ServiceType._417;
+    if ("418".equals(codeString))
+      return ServiceType._418;
+    if ("419".equals(codeString))
+      return ServiceType._419;
+    if ("420".equals(codeString))
+      return ServiceType._420;
+    if ("421".equals(codeString))
+      return ServiceType._421;
+    if ("422".equals(codeString))
+      return ServiceType._422;
+    if ("423".equals(codeString))
+      return ServiceType._423;
+    if ("424".equals(codeString))
+      return ServiceType._424;
+    if ("425".equals(codeString))
+      return ServiceType._425;
+    if ("426".equals(codeString))
+      return ServiceType._426;
+    if ("427".equals(codeString))
+      return ServiceType._427;
+    if ("428".equals(codeString))
+      return ServiceType._428;
+    if ("429".equals(codeString))
+      return ServiceType._429;
+    if ("430".equals(codeString))
+      return ServiceType._430;
+    if ("431".equals(codeString))
+      return ServiceType._431;
+    if ("432".equals(codeString))
+      return ServiceType._432;
+    if ("433".equals(codeString))
+      return ServiceType._433;
+    if ("434".equals(codeString))
+      return ServiceType._434;
+    if ("435".equals(codeString))
+      return ServiceType._435;
+    if ("436".equals(codeString))
+      return ServiceType._436;
+    if ("437".equals(codeString))
+      return ServiceType._437;
+    if ("438".equals(codeString))
+      return ServiceType._438;
+    if ("439".equals(codeString))
+      return ServiceType._439;
+    if ("440".equals(codeString))
+      return ServiceType._440;
+    if ("441".equals(codeString))
+      return ServiceType._441;
+    if ("442".equals(codeString))
+      return ServiceType._442;
+    if ("443".equals(codeString))
+      return ServiceType._443;
+    if ("444".equals(codeString))
+      return ServiceType._444;
+    if ("445".equals(codeString))
+      return ServiceType._445;
+    if ("446".equals(codeString))
+      return ServiceType._446;
+    if ("447".equals(codeString))
+      return ServiceType._447;
+    if ("448".equals(codeString))
+      return ServiceType._448;
+    if ("449".equals(codeString))
+      return ServiceType._449;
+    if ("450".equals(codeString))
+      return ServiceType._450;
+    if ("451".equals(codeString))
+      return ServiceType._451;
+    if ("452".equals(codeString))
+      return ServiceType._452;
+    if ("453".equals(codeString))
+      return ServiceType._453;
+    if ("454".equals(codeString))
+      return ServiceType._454;
+    if ("455".equals(codeString))
+      return ServiceType._455;
+    if ("456".equals(codeString))
+      return ServiceType._456;
+    if ("457".equals(codeString))
+      return ServiceType._457;
+    if ("458".equals(codeString))
+      return ServiceType._458;
+    if ("459".equals(codeString))
+      return ServiceType._459;
+    if ("460".equals(codeString))
+      return ServiceType._460;
+    if ("461".equals(codeString))
+      return ServiceType._461;
+    if ("462".equals(codeString))
+      return ServiceType._462;
+    if ("463".equals(codeString))
+      return ServiceType._463;
+    if ("464".equals(codeString))
+      return ServiceType._464;
+    if ("465".equals(codeString))
+      return ServiceType._465;
+    if ("466".equals(codeString))
+      return ServiceType._466;
+    if ("467".equals(codeString))
+      return ServiceType._467;
+    if ("468".equals(codeString))
+      return ServiceType._468;
+    if ("469".equals(codeString))
+      return ServiceType._469;
+    if ("470".equals(codeString))
+      return ServiceType._470;
+    if ("471".equals(codeString))
+      return ServiceType._471;
+    if ("472".equals(codeString))
+      return ServiceType._472;
+    if ("473".equals(codeString))
+      return ServiceType._473;
+    if ("474".equals(codeString))
+      return ServiceType._474;
+    if ("475".equals(codeString))
+      return ServiceType._475;
+    if ("476".equals(codeString))
+      return ServiceType._476;
+    if ("477".equals(codeString))
+      return ServiceType._477;
+    if ("478".equals(codeString))
+      return ServiceType._478;
+    if ("479".equals(codeString))
+      return ServiceType._479;
+    if ("480".equals(codeString))
+      return ServiceType._480;
+    if ("481".equals(codeString))
+      return ServiceType._481;
+    if ("482".equals(codeString))
+      return ServiceType._482;
+    if ("483".equals(codeString))
+      return ServiceType._483;
+    if ("484".equals(codeString))
+      return ServiceType._484;
+    if ("485".equals(codeString))
+      return ServiceType._485;
+    if ("486".equals(codeString))
+      return ServiceType._486;
+    if ("488".equals(codeString))
+      return ServiceType._488;
+    if ("489".equals(codeString))
+      return ServiceType._489;
+    if ("490".equals(codeString))
+      return ServiceType._490;
+    if ("491".equals(codeString))
+      return ServiceType._491;
+    if ("492".equals(codeString))
+      return ServiceType._492;
+    if ("493".equals(codeString))
+      return ServiceType._493;
+    if ("494".equals(codeString))
+      return ServiceType._494;
+    if ("495".equals(codeString))
+      return ServiceType._495;
+    if ("496".equals(codeString))
+      return ServiceType._496;
+    if ("497".equals(codeString))
+      return ServiceType._497;
+    if ("498".equals(codeString))
+      return ServiceType._498;
+    if ("500".equals(codeString))
+      return ServiceType._500;
+    if ("501".equals(codeString))
+      return ServiceType._501;
+    if ("502".equals(codeString))
+      return ServiceType._502;
+    if ("503".equals(codeString))
+      return ServiceType._503;
+    if ("504".equals(codeString))
+      return ServiceType._504;
+    if ("505".equals(codeString))
+      return ServiceType._505;
+    if ("506".equals(codeString))
+      return ServiceType._506;
+    if ("507".equals(codeString))
+      return ServiceType._507;
+    if ("508".equals(codeString))
+      return ServiceType._508;
+    if ("509".equals(codeString))
+      return ServiceType._509;
+    if ("510".equals(codeString))
+      return ServiceType._510;
+    if ("513".equals(codeString))
+      return ServiceType._513;
+    if ("514".equals(codeString))
+      return ServiceType._514;
+    if ("530".equals(codeString))
+      return ServiceType._530;
+    if ("531".equals(codeString))
+      return ServiceType._531;
+    if ("532".equals(codeString))
+      return ServiceType._532;
+    if ("533".equals(codeString))
+      return ServiceType._533;
+    if ("534".equals(codeString))
+      return ServiceType._534;
+    if ("535".equals(codeString))
+      return ServiceType._535;
+    if ("536".equals(codeString))
+      return ServiceType._536;
+    if ("537".equals(codeString))
+      return ServiceType._537;
+    if ("538".equals(codeString))
+      return ServiceType._538;
+    if ("539".equals(codeString))
+      return ServiceType._539;
+    if ("540".equals(codeString))
+      return ServiceType._540;
+    if ("541".equals(codeString))
+      return ServiceType._541;
+    if ("542".equals(codeString))
+      return ServiceType._542;
+    if ("543".equals(codeString))
+      return ServiceType._543;
+    if ("544".equals(codeString))
+      return ServiceType._544;
+    if ("545".equals(codeString))
+      return ServiceType._545;
+    if ("546".equals(codeString))
+      return ServiceType._546;
+    if ("547".equals(codeString))
+      return ServiceType._547;
+    if ("548".equals(codeString))
+      return ServiceType._548;
+    if ("550".equals(codeString))
+      return ServiceType._550;
+    if ("551".equals(codeString))
+      return ServiceType._551;
+    if ("552".equals(codeString))
+      return ServiceType._552;
+    if ("553".equals(codeString))
+      return ServiceType._553;
+    if ("554".equals(codeString))
+      return ServiceType._554;
+    if ("555".equals(codeString))
+      return ServiceType._555;
+    if ("556".equals(codeString))
+      return ServiceType._556;
+    if ("557".equals(codeString))
+      return ServiceType._557;
+    if ("558".equals(codeString))
+      return ServiceType._558;
+    if ("559".equals(codeString))
+      return ServiceType._559;
+    if ("560".equals(codeString))
+      return ServiceType._560;
+    if ("561".equals(codeString))
+      return ServiceType._561;
+    if ("562".equals(codeString))
+      return ServiceType._562;
+    if ("563".equals(codeString))
+      return ServiceType._563;
+    if ("564".equals(codeString))
+      return ServiceType._564;
+    if ("565".equals(codeString))
+      return ServiceType._565;
+    if ("566".equals(codeString))
+      return ServiceType._566;
+    if ("567".equals(codeString))
+      return ServiceType._567;
+    if ("568".equals(codeString))
+      return ServiceType._568;
+    if ("569".equals(codeString))
+      return ServiceType._569;
+    if ("570".equals(codeString))
+      return ServiceType._570;
+    if ("571".equals(codeString))
+      return ServiceType._571;
+    if ("572".equals(codeString))
+      return ServiceType._572;
+    if ("573".equals(codeString))
+      return ServiceType._573;
+    if ("574".equals(codeString))
+      return ServiceType._574;
+    if ("575".equals(codeString))
+      return ServiceType._575;
+    if ("576".equals(codeString))
+      return ServiceType._576;
+    if ("577".equals(codeString))
+      return ServiceType._577;
+    if ("580".equals(codeString))
+      return ServiceType._580;
+    if ("581".equals(codeString))
+      return ServiceType._581;
+    if ("582".equals(codeString))
+      return ServiceType._582;
+    if ("583".equals(codeString))
+      return ServiceType._583;
+    if ("584".equals(codeString))
+      return ServiceType._584;
+    if ("585".equals(codeString))
+      return ServiceType._585;
+    if ("589".equals(codeString))
+      return ServiceType._589;
+    if ("590".equals(codeString))
+      return ServiceType._590;
+    if ("591".equals(codeString))
+      return ServiceType._591;
+    if ("593".equals(codeString))
+      return ServiceType._593;
+    if ("599".equals(codeString))
+      return ServiceType._599;
+    if ("600".equals(codeString))
+      return ServiceType._600;
+    if ("601".equals(codeString))
+      return ServiceType._601;
+    if ("602".equals(codeString))
+      return ServiceType._602;
+    if ("603".equals(codeString))
+      return ServiceType._603;
+    if ("604".equals(codeString))
+      return ServiceType._604;
+    if ("605".equals(codeString))
+      return ServiceType._605;
+    if ("606".equals(codeString))
+      return ServiceType._606;
+    if ("607".equals(codeString))
+      return ServiceType._607;
+    if ("608".equals(codeString))
+      return ServiceType._608;
+    if ("609".equals(codeString))
+      return ServiceType._609;
+    if ("610".equals(codeString))
+      return ServiceType._610;
+    if ("611".equals(codeString))
+      return ServiceType._611;
+    if ("612".equals(codeString))
+      return ServiceType._612;
+    if ("613".equals(codeString))
+      return ServiceType._613;
+    if ("614".equals(codeString))
+      return ServiceType._614;
+    if ("615".equals(codeString))
+      return ServiceType._615;
+    if ("616".equals(codeString))
+      return ServiceType._616;
+    if ("617".equals(codeString))
+      return ServiceType._617;
+    if ("618".equals(codeString))
+      return ServiceType._618;
+    if ("619".equals(codeString))
+      return ServiceType._619;
+    if ("620".equals(codeString))
+      return ServiceType._620;
+    if ("621".equals(codeString))
+      return ServiceType._621;
+    if ("622".equals(codeString))
+      return ServiceType._622;
+    if ("623".equals(codeString))
+      return ServiceType._623;
+    if ("624".equals(codeString))
+      return ServiceType._624;
+    if ("625".equals(codeString))
+      return ServiceType._625;
+    if ("626".equals(codeString))
+      return ServiceType._626;
+    if ("627".equals(codeString))
+      return ServiceType._627;
+    if ("628".equals(codeString))
+      return ServiceType._628;
+    if ("629".equals(codeString))
+      return ServiceType._629;
+    throw new IllegalArgumentException("Unknown ServiceType code '"+codeString+"'");
+  }
+
+  public String toCode(ServiceType code) {
+    if (code == ServiceType._1)
+      return "1";
+    if (code == ServiceType._2)
+      return "2";
+    if (code == ServiceType._3)
+      return "3";
+    if (code == ServiceType._4)
+      return "4";
+    if (code == ServiceType._5)
+      return "5";
+    if (code == ServiceType._6)
+      return "6";
+    if (code == ServiceType._7)
+      return "7";
+    if (code == ServiceType._8)
+      return "8";
+    if (code == ServiceType._9)
+      return "9";
+    if (code == ServiceType._10)
+      return "10";
+    if (code == ServiceType._11)
+      return "11";
+    if (code == ServiceType._12)
+      return "12";
+    if (code == ServiceType._13)
+      return "13";
+    if (code == ServiceType._14)
+      return "14";
+    if (code == ServiceType._15)
+      return "15";
+    if (code == ServiceType._16)
+      return "16";
+    if (code == ServiceType._17)
+      return "17";
+    if (code == ServiceType._18)
+      return "18";
+    if (code == ServiceType._19)
+      return "19";
+    if (code == ServiceType._20)
+      return "20";
+    if (code == ServiceType._21)
+      return "21";
+    if (code == ServiceType._22)
+      return "22";
+    if (code == ServiceType._23)
+      return "23";
+    if (code == ServiceType._24)
+      return "24";
+    if (code == ServiceType._25)
+      return "25";
+    if (code == ServiceType._26)
+      return "26";
+    if (code == ServiceType._27)
+      return "27";
+    if (code == ServiceType._28)
+      return "28";
+    if (code == ServiceType._29)
+      return "29";
+    if (code == ServiceType._30)
+      return "30";
+    if (code == ServiceType._31)
+      return "31";
+    if (code == ServiceType._32)
+      return "32";
+    if (code == ServiceType._33)
+      return "33";
+    if (code == ServiceType._34)
+      return "34";
+    if (code == ServiceType._35)
+      return "35";
+    if (code == ServiceType._36)
+      return "36";
+    if (code == ServiceType._37)
+      return "37";
+    if (code == ServiceType._38)
+      return "38";
+    if (code == ServiceType._39)
+      return "39";
+    if (code == ServiceType._40)
+      return "40";
+    if (code == ServiceType._41)
+      return "41";
+    if (code == ServiceType._42)
+      return "42";
+    if (code == ServiceType._43)
+      return "43";
+    if (code == ServiceType._44)
+      return "44";
+    if (code == ServiceType._45)
+      return "45";
+    if (code == ServiceType._46)
+      return "46";
+    if (code == ServiceType._47)
+      return "47";
+    if (code == ServiceType._48)
+      return "48";
+    if (code == ServiceType._49)
+      return "49";
+    if (code == ServiceType._50)
+      return "50";
+    if (code == ServiceType._51)
+      return "51";
+    if (code == ServiceType._52)
+      return "52";
+    if (code == ServiceType._53)
+      return "53";
+    if (code == ServiceType._54)
+      return "54";
+    if (code == ServiceType._55)
+      return "55";
+    if (code == ServiceType._56)
+      return "56";
+    if (code == ServiceType._57)
+      return "57";
+    if (code == ServiceType._58)
+      return "58";
+    if (code == ServiceType._59)
+      return "59";
+    if (code == ServiceType._60)
+      return "60";
+    if (code == ServiceType._61)
+      return "61";
+    if (code == ServiceType._62)
+      return "62";
+    if (code == ServiceType._63)
+      return "63";
+    if (code == ServiceType._64)
+      return "64";
+    if (code == ServiceType._65)
+      return "65";
+    if (code == ServiceType._66)
+      return "66";
+    if (code == ServiceType._67)
+      return "67";
+    if (code == ServiceType._68)
+      return "68";
+    if (code == ServiceType._69)
+      return "69";
+    if (code == ServiceType._70)
+      return "70";
+    if (code == ServiceType._71)
+      return "71";
+    if (code == ServiceType._72)
+      return "72";
+    if (code == ServiceType._73)
+      return "73";
+    if (code == ServiceType._74)
+      return "74";
+    if (code == ServiceType._75)
+      return "75";
+    if (code == ServiceType._76)
+      return "76";
+    if (code == ServiceType._77)
+      return "77";
+    if (code == ServiceType._78)
+      return "78";
+    if (code == ServiceType._79)
+      return "79";
+    if (code == ServiceType._80)
+      return "80";
+    if (code == ServiceType._81)
+      return "81";
+    if (code == ServiceType._82)
+      return "82";
+    if (code == ServiceType._83)
+      return "83";
+    if (code == ServiceType._84)
+      return "84";
+    if (code == ServiceType._85)
+      return "85";
+    if (code == ServiceType._86)
+      return "86";
+    if (code == ServiceType._87)
+      return "87";
+    if (code == ServiceType._88)
+      return "88";
+    if (code == ServiceType._89)
+      return "89";
+    if (code == ServiceType._90)
+      return "90";
+    if (code == ServiceType._91)
+      return "91";
+    if (code == ServiceType._92)
+      return "92";
+    if (code == ServiceType._93)
+      return "93";
+    if (code == ServiceType._94)
+      return "94";
+    if (code == ServiceType._95)
+      return "95";
+    if (code == ServiceType._96)
+      return "96";
+    if (code == ServiceType._97)
+      return "97";
+    if (code == ServiceType._98)
+      return "98";
+    if (code == ServiceType._99)
+      return "99";
+    if (code == ServiceType._100)
+      return "100";
+    if (code == ServiceType._101)
+      return "101";
+    if (code == ServiceType._102)
+      return "102";
+    if (code == ServiceType._103)
+      return "103";
+    if (code == ServiceType._104)
+      return "104";
+    if (code == ServiceType._105)
+      return "105";
+    if (code == ServiceType._106)
+      return "106";
+    if (code == ServiceType._107)
+      return "107";
+    if (code == ServiceType._108)
+      return "108";
+    if (code == ServiceType._109)
+      return "109";
+    if (code == ServiceType._110)
+      return "110";
+    if (code == ServiceType._111)
+      return "111";
+    if (code == ServiceType._112)
+      return "112";
+    if (code == ServiceType._113)
+      return "113";
+    if (code == ServiceType._114)
+      return "114";
+    if (code == ServiceType._115)
+      return "115";
+    if (code == ServiceType._116)
+      return "116";
+    if (code == ServiceType._117)
+      return "117";
+    if (code == ServiceType._118)
+      return "118";
+    if (code == ServiceType._119)
+      return "119";
+    if (code == ServiceType._120)
+      return "120";
+    if (code == ServiceType._121)
+      return "121";
+    if (code == ServiceType._122)
+      return "122";
+    if (code == ServiceType._123)
+      return "123";
+    if (code == ServiceType._124)
+      return "124";
+    if (code == ServiceType._125)
+      return "125";
+    if (code == ServiceType._126)
+      return "126";
+    if (code == ServiceType._127)
+      return "127";
+    if (code == ServiceType._128)
+      return "128";
+    if (code == ServiceType._129)
+      return "129";
+    if (code == ServiceType._130)
+      return "130";
+    if (code == ServiceType._131)
+      return "131";
+    if (code == ServiceType._132)
+      return "132";
+    if (code == ServiceType._133)
+      return "133";
+    if (code == ServiceType._134)
+      return "134";
+    if (code == ServiceType._135)
+      return "135";
+    if (code == ServiceType._136)
+      return "136";
+    if (code == ServiceType._137)
+      return "137";
+    if (code == ServiceType._138)
+      return "138";
+    if (code == ServiceType._139)
+      return "139";
+    if (code == ServiceType._140)
+      return "140";
+    if (code == ServiceType._141)
+      return "141";
+    if (code == ServiceType._142)
+      return "142";
+    if (code == ServiceType._143)
+      return "143";
+    if (code == ServiceType._144)
+      return "144";
+    if (code == ServiceType._145)
+      return "145";
+    if (code == ServiceType._146)
+      return "146";
+    if (code == ServiceType._147)
+      return "147";
+    if (code == ServiceType._148)
+      return "148";
+    if (code == ServiceType._149)
+      return "149";
+    if (code == ServiceType._150)
+      return "150";
+    if (code == ServiceType._151)
+      return "151";
+    if (code == ServiceType._152)
+      return "152";
+    if (code == ServiceType._153)
+      return "153";
+    if (code == ServiceType._154)
+      return "154";
+    if (code == ServiceType._155)
+      return "155";
+    if (code == ServiceType._156)
+      return "156";
+    if (code == ServiceType._157)
+      return "157";
+    if (code == ServiceType._158)
+      return "158";
+    if (code == ServiceType._159)
+      return "159";
+    if (code == ServiceType._160)
+      return "160";
+    if (code == ServiceType._161)
+      return "161";
+    if (code == ServiceType._162)
+      return "162";
+    if (code == ServiceType._163)
+      return "163";
+    if (code == ServiceType._164)
+      return "164";
+    if (code == ServiceType._165)
+      return "165";
+    if (code == ServiceType._166)
+      return "166";
+    if (code == ServiceType._167)
+      return "167";
+    if (code == ServiceType._168)
+      return "168";
+    if (code == ServiceType._169)
+      return "169";
+    if (code == ServiceType._170)
+      return "170";
+    if (code == ServiceType._171)
+      return "171";
+    if (code == ServiceType._172)
+      return "172";
+    if (code == ServiceType._173)
+      return "173";
+    if (code == ServiceType._174)
+      return "174";
+    if (code == ServiceType._175)
+      return "175";
+    if (code == ServiceType._176)
+      return "176";
+    if (code == ServiceType._177)
+      return "177";
+    if (code == ServiceType._178)
+      return "178";
+    if (code == ServiceType._179)
+      return "179";
+    if (code == ServiceType._180)
+      return "180";
+    if (code == ServiceType._181)
+      return "181";
+    if (code == ServiceType._182)
+      return "182";
+    if (code == ServiceType._183)
+      return "183";
+    if (code == ServiceType._184)
+      return "184";
+    if (code == ServiceType._185)
+      return "185";
+    if (code == ServiceType._186)
+      return "186";
+    if (code == ServiceType._187)
+      return "187";
+    if (code == ServiceType._188)
+      return "188";
+    if (code == ServiceType._189)
+      return "189";
+    if (code == ServiceType._190)
+      return "190";
+    if (code == ServiceType._191)
+      return "191";
+    if (code == ServiceType._192)
+      return "192";
+    if (code == ServiceType._193)
+      return "193";
+    if (code == ServiceType._194)
+      return "194";
+    if (code == ServiceType._195)
+      return "195";
+    if (code == ServiceType._196)
+      return "196";
+    if (code == ServiceType._197)
+      return "197";
+    if (code == ServiceType._198)
+      return "198";
+    if (code == ServiceType._199)
+      return "199";
+    if (code == ServiceType._200)
+      return "200";
+    if (code == ServiceType._201)
+      return "201";
+    if (code == ServiceType._202)
+      return "202";
+    if (code == ServiceType._203)
+      return "203";
+    if (code == ServiceType._204)
+      return "204";
+    if (code == ServiceType._205)
+      return "205";
+    if (code == ServiceType._206)
+      return "206";
+    if (code == ServiceType._207)
+      return "207";
+    if (code == ServiceType._208)
+      return "208";
+    if (code == ServiceType._209)
+      return "209";
+    if (code == ServiceType._210)
+      return "210";
+    if (code == ServiceType._211)
+      return "211";
+    if (code == ServiceType._212)
+      return "212";
+    if (code == ServiceType._213)
+      return "213";
+    if (code == ServiceType._214)
+      return "214";
+    if (code == ServiceType._215)
+      return "215";
+    if (code == ServiceType._216)
+      return "216";
+    if (code == ServiceType._217)
+      return "217";
+    if (code == ServiceType._218)
+      return "218";
+    if (code == ServiceType._219)
+      return "219";
+    if (code == ServiceType._220)
+      return "220";
+    if (code == ServiceType._221)
+      return "221";
+    if (code == ServiceType._222)
+      return "222";
+    if (code == ServiceType._223)
+      return "223";
+    if (code == ServiceType._224)
+      return "224";
+    if (code == ServiceType._225)
+      return "225";
+    if (code == ServiceType._226)
+      return "226";
+    if (code == ServiceType._227)
+      return "227";
+    if (code == ServiceType._228)
+      return "228";
+    if (code == ServiceType._229)
+      return "229";
+    if (code == ServiceType._230)
+      return "230";
+    if (code == ServiceType._231)
+      return "231";
+    if (code == ServiceType._232)
+      return "232";
+    if (code == ServiceType._233)
+      return "233";
+    if (code == ServiceType._234)
+      return "234";
+    if (code == ServiceType._235)
+      return "235";
+    if (code == ServiceType._236)
+      return "236";
+    if (code == ServiceType._237)
+      return "237";
+    if (code == ServiceType._238)
+      return "238";
+    if (code == ServiceType._239)
+      return "239";
+    if (code == ServiceType._240)
+      return "240";
+    if (code == ServiceType._241)
+      return "241";
+    if (code == ServiceType._242)
+      return "242";
+    if (code == ServiceType._243)
+      return "243";
+    if (code == ServiceType._244)
+      return "244";
+    if (code == ServiceType._245)
+      return "245";
+    if (code == ServiceType._246)
+      return "246";
+    if (code == ServiceType._247)
+      return "247";
+    if (code == ServiceType._248)
+      return "248";
+    if (code == ServiceType._249)
+      return "249";
+    if (code == ServiceType._250)
+      return "250";
+    if (code == ServiceType._251)
+      return "251";
+    if (code == ServiceType._252)
+      return "252";
+    if (code == ServiceType._253)
+      return "253";
+    if (code == ServiceType._254)
+      return "254";
+    if (code == ServiceType._255)
+      return "255";
+    if (code == ServiceType._256)
+      return "256";
+    if (code == ServiceType._257)
+      return "257";
+    if (code == ServiceType._258)
+      return "258";
+    if (code == ServiceType._259)
+      return "259";
+    if (code == ServiceType._260)
+      return "260";
+    if (code == ServiceType._261)
+      return "261";
+    if (code == ServiceType._262)
+      return "262";
+    if (code == ServiceType._263)
+      return "263";
+    if (code == ServiceType._264)
+      return "264";
+    if (code == ServiceType._265)
+      return "265";
+    if (code == ServiceType._266)
+      return "266";
+    if (code == ServiceType._267)
+      return "267";
+    if (code == ServiceType._268)
+      return "268";
+    if (code == ServiceType._269)
+      return "269";
+    if (code == ServiceType._270)
+      return "270";
+    if (code == ServiceType._271)
+      return "271";
+    if (code == ServiceType._272)
+      return "272";
+    if (code == ServiceType._273)
+      return "273";
+    if (code == ServiceType._274)
+      return "274";
+    if (code == ServiceType._275)
+      return "275";
+    if (code == ServiceType._276)
+      return "276";
+    if (code == ServiceType._277)
+      return "277";
+    if (code == ServiceType._278)
+      return "278";
+    if (code == ServiceType._279)
+      return "279";
+    if (code == ServiceType._280)
+      return "280";
+    if (code == ServiceType._281)
+      return "281";
+    if (code == ServiceType._282)
+      return "282";
+    if (code == ServiceType._283)
+      return "283";
+    if (code == ServiceType._284)
+      return "284";
+    if (code == ServiceType._285)
+      return "285";
+    if (code == ServiceType._286)
+      return "286";
+    if (code == ServiceType._287)
+      return "287";
+    if (code == ServiceType._288)
+      return "288";
+    if (code == ServiceType._289)
+      return "289";
+    if (code == ServiceType._290)
+      return "290";
+    if (code == ServiceType._291)
+      return "291";
+    if (code == ServiceType._292)
+      return "292";
+    if (code == ServiceType._293)
+      return "293";
+    if (code == ServiceType._294)
+      return "294";
+    if (code == ServiceType._295)
+      return "295";
+    if (code == ServiceType._296)
+      return "296";
+    if (code == ServiceType._297)
+      return "297";
+    if (code == ServiceType._298)
+      return "298";
+    if (code == ServiceType._299)
+      return "299";
+    if (code == ServiceType._300)
+      return "300";
+    if (code == ServiceType._301)
+      return "301";
+    if (code == ServiceType._302)
+      return "302";
+    if (code == ServiceType._303)
+      return "303";
+    if (code == ServiceType._304)
+      return "304";
+    if (code == ServiceType._305)
+      return "305";
+    if (code == ServiceType._306)
+      return "306";
+    if (code == ServiceType._307)
+      return "307";
+    if (code == ServiceType._308)
+      return "308";
+    if (code == ServiceType._309)
+      return "309";
+    if (code == ServiceType._310)
+      return "310";
+    if (code == ServiceType._311)
+      return "311";
+    if (code == ServiceType._312)
+      return "312";
+    if (code == ServiceType._313)
+      return "313";
+    if (code == ServiceType._314)
+      return "314";
+    if (code == ServiceType._315)
+      return "315";
+    if (code == ServiceType._316)
+      return "316";
+    if (code == ServiceType._317)
+      return "317";
+    if (code == ServiceType._318)
+      return "318";
+    if (code == ServiceType._319)
+      return "319";
+    if (code == ServiceType._320)
+      return "320";
+    if (code == ServiceType._321)
+      return "321";
+    if (code == ServiceType._322)
+      return "322";
+    if (code == ServiceType._323)
+      return "323";
+    if (code == ServiceType._324)
+      return "324";
+    if (code == ServiceType._325)
+      return "325";
+    if (code == ServiceType._326)
+      return "326";
+    if (code == ServiceType._327)
+      return "327";
+    if (code == ServiceType._328)
+      return "328";
+    if (code == ServiceType._330)
+      return "330";
+    if (code == ServiceType._331)
+      return "331";
+    if (code == ServiceType._332)
+      return "332";
+    if (code == ServiceType._333)
+      return "333";
+    if (code == ServiceType._334)
+      return "334";
+    if (code == ServiceType._335)
+      return "335";
+    if (code == ServiceType._336)
+      return "336";
+    if (code == ServiceType._337)
+      return "337";
+    if (code == ServiceType._338)
+      return "338";
+    if (code == ServiceType._339)
+      return "339";
+    if (code == ServiceType._340)
+      return "340";
+    if (code == ServiceType._341)
+      return "341";
+    if (code == ServiceType._342)
+      return "342";
+    if (code == ServiceType._343)
+      return "343";
+    if (code == ServiceType._344)
+      return "344";
+    if (code == ServiceType._345)
+      return "345";
+    if (code == ServiceType._346)
+      return "346";
+    if (code == ServiceType._347)
+      return "347";
+    if (code == ServiceType._348)
+      return "348";
+    if (code == ServiceType._349)
+      return "349";
+    if (code == ServiceType._350)
+      return "350";
+    if (code == ServiceType._351)
+      return "351";
+    if (code == ServiceType._352)
+      return "352";
+    if (code == ServiceType._353)
+      return "353";
+    if (code == ServiceType._354)
+      return "354";
+    if (code == ServiceType._355)
+      return "355";
+    if (code == ServiceType._356)
+      return "356";
+    if (code == ServiceType._357)
+      return "357";
+    if (code == ServiceType._358)
+      return "358";
+    if (code == ServiceType._359)
+      return "359";
+    if (code == ServiceType._360)
+      return "360";
+    if (code == ServiceType._361)
+      return "361";
+    if (code == ServiceType._362)
+      return "362";
+    if (code == ServiceType._364)
+      return "364";
+    if (code == ServiceType._365)
+      return "365";
+    if (code == ServiceType._366)
+      return "366";
+    if (code == ServiceType._367)
+      return "367";
+    if (code == ServiceType._368)
+      return "368";
+    if (code == ServiceType._369)
+      return "369";
+    if (code == ServiceType._370)
+      return "370";
+    if (code == ServiceType._371)
+      return "371";
+    if (code == ServiceType._372)
+      return "372";
+    if (code == ServiceType._373)
+      return "373";
+    if (code == ServiceType._374)
+      return "374";
+    if (code == ServiceType._375)
+      return "375";
+    if (code == ServiceType._376)
+      return "376";
+    if (code == ServiceType._377)
+      return "377";
+    if (code == ServiceType._378)
+      return "378";
+    if (code == ServiceType._379)
+      return "379";
+    if (code == ServiceType._380)
+      return "380";
+    if (code == ServiceType._381)
+      return "381";
+    if (code == ServiceType._382)
+      return "382";
+    if (code == ServiceType._383)
+      return "383";
+    if (code == ServiceType._384)
+      return "384";
+    if (code == ServiceType._385)
+      return "385";
+    if (code == ServiceType._386)
+      return "386";
+    if (code == ServiceType._387)
+      return "387";
+    if (code == ServiceType._388)
+      return "388";
+    if (code == ServiceType._389)
+      return "389";
+    if (code == ServiceType._390)
+      return "390";
+    if (code == ServiceType._391)
+      return "391";
+    if (code == ServiceType._392)
+      return "392";
+    if (code == ServiceType._393)
+      return "393";
+    if (code == ServiceType._394)
+      return "394";
+    if (code == ServiceType._395)
+      return "395";
+    if (code == ServiceType._396)
+      return "396";
+    if (code == ServiceType._397)
+      return "397";
+    if (code == ServiceType._398)
+      return "398";
+    if (code == ServiceType._399)
+      return "399";
+    if (code == ServiceType._400)
+      return "400";
+    if (code == ServiceType._401)
+      return "401";
+    if (code == ServiceType._402)
+      return "402";
+    if (code == ServiceType._403)
+      return "403";
+    if (code == ServiceType._404)
+      return "404";
+    if (code == ServiceType._405)
+      return "405";
+    if (code == ServiceType._406)
+      return "406";
+    if (code == ServiceType._407)
+      return "407";
+    if (code == ServiceType._408)
+      return "408";
+    if (code == ServiceType._409)
+      return "409";
+    if (code == ServiceType._410)
+      return "410";
+    if (code == ServiceType._411)
+      return "411";
+    if (code == ServiceType._412)
+      return "412";
+    if (code == ServiceType._413)
+      return "413";
+    if (code == ServiceType._414)
+      return "414";
+    if (code == ServiceType._415)
+      return "415";
+    if (code == ServiceType._416)
+      return "416";
+    if (code == ServiceType._417)
+      return "417";
+    if (code == ServiceType._418)
+      return "418";
+    if (code == ServiceType._419)
+      return "419";
+    if (code == ServiceType._420)
+      return "420";
+    if (code == ServiceType._421)
+      return "421";
+    if (code == ServiceType._422)
+      return "422";
+    if (code == ServiceType._423)
+      return "423";
+    if (code == ServiceType._424)
+      return "424";
+    if (code == ServiceType._425)
+      return "425";
+    if (code == ServiceType._426)
+      return "426";
+    if (code == ServiceType._427)
+      return "427";
+    if (code == ServiceType._428)
+      return "428";
+    if (code == ServiceType._429)
+      return "429";
+    if (code == ServiceType._430)
+      return "430";
+    if (code == ServiceType._431)
+      return "431";
+    if (code == ServiceType._432)
+      return "432";
+    if (code == ServiceType._433)
+      return "433";
+    if (code == ServiceType._434)
+      return "434";
+    if (code == ServiceType._435)
+      return "435";
+    if (code == ServiceType._436)
+      return "436";
+    if (code == ServiceType._437)
+      return "437";
+    if (code == ServiceType._438)
+      return "438";
+    if (code == ServiceType._439)
+      return "439";
+    if (code == ServiceType._440)
+      return "440";
+    if (code == ServiceType._441)
+      return "441";
+    if (code == ServiceType._442)
+      return "442";
+    if (code == ServiceType._443)
+      return "443";
+    if (code == ServiceType._444)
+      return "444";
+    if (code == ServiceType._445)
+      return "445";
+    if (code == ServiceType._446)
+      return "446";
+    if (code == ServiceType._447)
+      return "447";
+    if (code == ServiceType._448)
+      return "448";
+    if (code == ServiceType._449)
+      return "449";
+    if (code == ServiceType._450)
+      return "450";
+    if (code == ServiceType._451)
+      return "451";
+    if (code == ServiceType._452)
+      return "452";
+    if (code == ServiceType._453)
+      return "453";
+    if (code == ServiceType._454)
+      return "454";
+    if (code == ServiceType._455)
+      return "455";
+    if (code == ServiceType._456)
+      return "456";
+    if (code == ServiceType._457)
+      return "457";
+    if (code == ServiceType._458)
+      return "458";
+    if (code == ServiceType._459)
+      return "459";
+    if (code == ServiceType._460)
+      return "460";
+    if (code == ServiceType._461)
+      return "461";
+    if (code == ServiceType._462)
+      return "462";
+    if (code == ServiceType._463)
+      return "463";
+    if (code == ServiceType._464)
+      return "464";
+    if (code == ServiceType._465)
+      return "465";
+    if (code == ServiceType._466)
+      return "466";
+    if (code == ServiceType._467)
+      return "467";
+    if (code == ServiceType._468)
+      return "468";
+    if (code == ServiceType._469)
+      return "469";
+    if (code == ServiceType._470)
+      return "470";
+    if (code == ServiceType._471)
+      return "471";
+    if (code == ServiceType._472)
+      return "472";
+    if (code == ServiceType._473)
+      return "473";
+    if (code == ServiceType._474)
+      return "474";
+    if (code == ServiceType._475)
+      return "475";
+    if (code == ServiceType._476)
+      return "476";
+    if (code == ServiceType._477)
+      return "477";
+    if (code == ServiceType._478)
+      return "478";
+    if (code == ServiceType._479)
+      return "479";
+    if (code == ServiceType._480)
+      return "480";
+    if (code == ServiceType._481)
+      return "481";
+    if (code == ServiceType._482)
+      return "482";
+    if (code == ServiceType._483)
+      return "483";
+    if (code == ServiceType._484)
+      return "484";
+    if (code == ServiceType._485)
+      return "485";
+    if (code == ServiceType._486)
+      return "486";
+    if (code == ServiceType._488)
+      return "488";
+    if (code == ServiceType._489)
+      return "489";
+    if (code == ServiceType._490)
+      return "490";
+    if (code == ServiceType._491)
+      return "491";
+    if (code == ServiceType._492)
+      return "492";
+    if (code == ServiceType._493)
+      return "493";
+    if (code == ServiceType._494)
+      return "494";
+    if (code == ServiceType._495)
+      return "495";
+    if (code == ServiceType._496)
+      return "496";
+    if (code == ServiceType._497)
+      return "497";
+    if (code == ServiceType._498)
+      return "498";
+    if (code == ServiceType._500)
+      return "500";
+    if (code == ServiceType._501)
+      return "501";
+    if (code == ServiceType._502)
+      return "502";
+    if (code == ServiceType._503)
+      return "503";
+    if (code == ServiceType._504)
+      return "504";
+    if (code == ServiceType._505)
+      return "505";
+    if (code == ServiceType._506)
+      return "506";
+    if (code == ServiceType._507)
+      return "507";
+    if (code == ServiceType._508)
+      return "508";
+    if (code == ServiceType._509)
+      return "509";
+    if (code == ServiceType._510)
+      return "510";
+    if (code == ServiceType._513)
+      return "513";
+    if (code == ServiceType._514)
+      return "514";
+    if (code == ServiceType._530)
+      return "530";
+    if (code == ServiceType._531)
+      return "531";
+    if (code == ServiceType._532)
+      return "532";
+    if (code == ServiceType._533)
+      return "533";
+    if (code == ServiceType._534)
+      return "534";
+    if (code == ServiceType._535)
+      return "535";
+    if (code == ServiceType._536)
+      return "536";
+    if (code == ServiceType._537)
+      return "537";
+    if (code == ServiceType._538)
+      return "538";
+    if (code == ServiceType._539)
+      return "539";
+    if (code == ServiceType._540)
+      return "540";
+    if (code == ServiceType._541)
+      return "541";
+    if (code == ServiceType._542)
+      return "542";
+    if (code == ServiceType._543)
+      return "543";
+    if (code == ServiceType._544)
+      return "544";
+    if (code == ServiceType._545)
+      return "545";
+    if (code == ServiceType._546)
+      return "546";
+    if (code == ServiceType._547)
+      return "547";
+    if (code == ServiceType._548)
+      return "548";
+    if (code == ServiceType._550)
+      return "550";
+    if (code == ServiceType._551)
+      return "551";
+    if (code == ServiceType._552)
+      return "552";
+    if (code == ServiceType._553)
+      return "553";
+    if (code == ServiceType._554)
+      return "554";
+    if (code == ServiceType._555)
+      return "555";
+    if (code == ServiceType._556)
+      return "556";
+    if (code == ServiceType._557)
+      return "557";
+    if (code == ServiceType._558)
+      return "558";
+    if (code == ServiceType._559)
+      return "559";
+    if (code == ServiceType._560)
+      return "560";
+    if (code == ServiceType._561)
+      return "561";
+    if (code == ServiceType._562)
+      return "562";
+    if (code == ServiceType._563)
+      return "563";
+    if (code == ServiceType._564)
+      return "564";
+    if (code == ServiceType._565)
+      return "565";
+    if (code == ServiceType._566)
+      return "566";
+    if (code == ServiceType._567)
+      return "567";
+    if (code == ServiceType._568)
+      return "568";
+    if (code == ServiceType._569)
+      return "569";
+    if (code == ServiceType._570)
+      return "570";
+    if (code == ServiceType._571)
+      return "571";
+    if (code == ServiceType._572)
+      return "572";
+    if (code == ServiceType._573)
+      return "573";
+    if (code == ServiceType._574)
+      return "574";
+    if (code == ServiceType._575)
+      return "575";
+    if (code == ServiceType._576)
+      return "576";
+    if (code == ServiceType._577)
+      return "577";
+    if (code == ServiceType._580)
+      return "580";
+    if (code == ServiceType._581)
+      return "581";
+    if (code == ServiceType._582)
+      return "582";
+    if (code == ServiceType._583)
+      return "583";
+    if (code == ServiceType._584)
+      return "584";
+    if (code == ServiceType._585)
+      return "585";
+    if (code == ServiceType._589)
+      return "589";
+    if (code == ServiceType._590)
+      return "590";
+    if (code == ServiceType._591)
+      return "591";
+    if (code == ServiceType._593)
+      return "593";
+    if (code == ServiceType._599)
+      return "599";
+    if (code == ServiceType._600)
+      return "600";
+    if (code == ServiceType._601)
+      return "601";
+    if (code == ServiceType._602)
+      return "602";
+    if (code == ServiceType._603)
+      return "603";
+    if (code == ServiceType._604)
+      return "604";
+    if (code == ServiceType._605)
+      return "605";
+    if (code == ServiceType._606)
+      return "606";
+    if (code == ServiceType._607)
+      return "607";
+    if (code == ServiceType._608)
+      return "608";
+    if (code == ServiceType._609)
+      return "609";
+    if (code == ServiceType._610)
+      return "610";
+    if (code == ServiceType._611)
+      return "611";
+    if (code == ServiceType._612)
+      return "612";
+    if (code == ServiceType._613)
+      return "613";
+    if (code == ServiceType._614)
+      return "614";
+    if (code == ServiceType._615)
+      return "615";
+    if (code == ServiceType._616)
+      return "616";
+    if (code == ServiceType._617)
+      return "617";
+    if (code == ServiceType._618)
+      return "618";
+    if (code == ServiceType._619)
+      return "619";
+    if (code == ServiceType._620)
+      return "620";
+    if (code == ServiceType._621)
+      return "621";
+    if (code == ServiceType._622)
+      return "622";
+    if (code == ServiceType._623)
+      return "623";
+    if (code == ServiceType._624)
+      return "624";
+    if (code == ServiceType._625)
+      return "625";
+    if (code == ServiceType._626)
+      return "626";
+    if (code == ServiceType._627)
+      return "627";
+    if (code == ServiceType._628)
+      return "628";
+    if (code == ServiceType._629)
+      return "629";
+    return "?";
+  }
+
+    public String toSystem(ServiceType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceUscls.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceUscls.java
new file mode 100644
index 00000000000..d46ff230919
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceUscls.java
@@ -0,0 +1,249 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ServiceUscls {
+
+        /**
+         * Exam, comp, primary
+         */
+        _1101, 
+        /**
+         * Exam, comp, mixed
+         */
+        _1102, 
+        /**
+         * Exam, comp, permanent
+         */
+        _1103, 
+        /**
+         * Exam, recall
+         */
+        _1201, 
+        /**
+         * Exam, emergency
+         */
+        _1205, 
+        /**
+         * Radiograph, series (12)
+         */
+        _2101, 
+        /**
+         * Radiograph, series (16)
+         */
+        _2102, 
+        /**
+         * Radiograph, bytewing
+         */
+        _2141, 
+        /**
+         * Radiograph, panoramic
+         */
+        _2601, 
+        /**
+         * Polishing, 1 unit
+         */
+        _11101, 
+        /**
+         * Polishing, 2 unit
+         */
+        _11102, 
+        /**
+         * Polishing, 3 unit
+         */
+        _11103, 
+        /**
+         * Polishing, 4 unit
+         */
+        _11104, 
+        /**
+         * Amalgam, 1 surface
+         */
+        _21211, 
+        /**
+         * Amalgam, 2 surface
+         */
+        _21212, 
+        /**
+         * Crown, PFM
+         */
+        _27211, 
+        /**
+         * Maryland Bridge
+         */
+        _67211, 
+        /**
+         * Lab, commercial
+         */
+        _99111, 
+        /**
+         * Lab, in office
+         */
+        _99333, 
+        /**
+         * Expense
+         */
+        _99555, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ServiceUscls fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1101".equals(codeString))
+          return _1101;
+        if ("1102".equals(codeString))
+          return _1102;
+        if ("1103".equals(codeString))
+          return _1103;
+        if ("1201".equals(codeString))
+          return _1201;
+        if ("1205".equals(codeString))
+          return _1205;
+        if ("2101".equals(codeString))
+          return _2101;
+        if ("2102".equals(codeString))
+          return _2102;
+        if ("2141".equals(codeString))
+          return _2141;
+        if ("2601".equals(codeString))
+          return _2601;
+        if ("11101".equals(codeString))
+          return _11101;
+        if ("11102".equals(codeString))
+          return _11102;
+        if ("11103".equals(codeString))
+          return _11103;
+        if ("11104".equals(codeString))
+          return _11104;
+        if ("21211".equals(codeString))
+          return _21211;
+        if ("21212".equals(codeString))
+          return _21212;
+        if ("27211".equals(codeString))
+          return _27211;
+        if ("67211".equals(codeString))
+          return _67211;
+        if ("99111".equals(codeString))
+          return _99111;
+        if ("99333".equals(codeString))
+          return _99333;
+        if ("99555".equals(codeString))
+          return _99555;
+        throw new FHIRException("Unknown ServiceUscls code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1101: return "1101";
+            case _1102: return "1102";
+            case _1103: return "1103";
+            case _1201: return "1201";
+            case _1205: return "1205";
+            case _2101: return "2101";
+            case _2102: return "2102";
+            case _2141: return "2141";
+            case _2601: return "2601";
+            case _11101: return "11101";
+            case _11102: return "11102";
+            case _11103: return "11103";
+            case _11104: return "11104";
+            case _21211: return "21211";
+            case _21212: return "21212";
+            case _27211: return "27211";
+            case _67211: return "67211";
+            case _99111: return "99111";
+            case _99333: return "99333";
+            case _99555: return "99555";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-USCLS";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1101: return "Exam, comp, primary";
+            case _1102: return "Exam, comp, mixed";
+            case _1103: return "Exam, comp, permanent";
+            case _1201: return "Exam, recall";
+            case _1205: return "Exam, emergency";
+            case _2101: return "Radiograph, series (12)";
+            case _2102: return "Radiograph, series (16)";
+            case _2141: return "Radiograph, bytewing";
+            case _2601: return "Radiograph, panoramic";
+            case _11101: return "Polishing, 1 unit";
+            case _11102: return "Polishing, 2 unit";
+            case _11103: return "Polishing, 3 unit";
+            case _11104: return "Polishing, 4 unit";
+            case _21211: return "Amalgam, 1 surface";
+            case _21212: return "Amalgam, 2 surface";
+            case _27211: return "Crown, PFM";
+            case _67211: return "Maryland Bridge";
+            case _99111: return "Lab, commercial";
+            case _99333: return "Lab, in office";
+            case _99555: return "Expense";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1101: return "Exam, comp, primary";
+            case _1102: return "Exam, comp, mixed";
+            case _1103: return "Exam, comp, permanent";
+            case _1201: return "Exam, recall";
+            case _1205: return "Exam, emergency";
+            case _2101: return "Radiograph, series (12)";
+            case _2102: return "Radiograph, series (16)";
+            case _2141: return "Radiograph, bytewing";
+            case _2601: return "Radiograph, panoramic";
+            case _11101: return "Polishing, 1 unit";
+            case _11102: return "Polishing, 2 unit";
+            case _11103: return "Polishing, 3 unit";
+            case _11104: return "Polishing, 4 unit";
+            case _21211: return "Amalgam, 1 surface";
+            case _21212: return "Amalgam, 2 surface";
+            case _27211: return "Crown, PFM";
+            case _67211: return "Maryland Bridge";
+            case _99111: return "Lab, commercial";
+            case _99333: return "Lab, in office";
+            case _99555: return "Expense";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceUsclsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceUsclsEnumFactory.java
new file mode 100644
index 00000000000..a45013627cc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ServiceUsclsEnumFactory.java
@@ -0,0 +1,134 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ServiceUsclsEnumFactory implements EnumFactory {
+
+  public ServiceUscls fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1101".equals(codeString))
+      return ServiceUscls._1101;
+    if ("1102".equals(codeString))
+      return ServiceUscls._1102;
+    if ("1103".equals(codeString))
+      return ServiceUscls._1103;
+    if ("1201".equals(codeString))
+      return ServiceUscls._1201;
+    if ("1205".equals(codeString))
+      return ServiceUscls._1205;
+    if ("2101".equals(codeString))
+      return ServiceUscls._2101;
+    if ("2102".equals(codeString))
+      return ServiceUscls._2102;
+    if ("2141".equals(codeString))
+      return ServiceUscls._2141;
+    if ("2601".equals(codeString))
+      return ServiceUscls._2601;
+    if ("11101".equals(codeString))
+      return ServiceUscls._11101;
+    if ("11102".equals(codeString))
+      return ServiceUscls._11102;
+    if ("11103".equals(codeString))
+      return ServiceUscls._11103;
+    if ("11104".equals(codeString))
+      return ServiceUscls._11104;
+    if ("21211".equals(codeString))
+      return ServiceUscls._21211;
+    if ("21212".equals(codeString))
+      return ServiceUscls._21212;
+    if ("27211".equals(codeString))
+      return ServiceUscls._27211;
+    if ("67211".equals(codeString))
+      return ServiceUscls._67211;
+    if ("99111".equals(codeString))
+      return ServiceUscls._99111;
+    if ("99333".equals(codeString))
+      return ServiceUscls._99333;
+    if ("99555".equals(codeString))
+      return ServiceUscls._99555;
+    throw new IllegalArgumentException("Unknown ServiceUscls code '"+codeString+"'");
+  }
+
+  public String toCode(ServiceUscls code) {
+    if (code == ServiceUscls._1101)
+      return "1101";
+    if (code == ServiceUscls._1102)
+      return "1102";
+    if (code == ServiceUscls._1103)
+      return "1103";
+    if (code == ServiceUscls._1201)
+      return "1201";
+    if (code == ServiceUscls._1205)
+      return "1205";
+    if (code == ServiceUscls._2101)
+      return "2101";
+    if (code == ServiceUscls._2102)
+      return "2102";
+    if (code == ServiceUscls._2141)
+      return "2141";
+    if (code == ServiceUscls._2601)
+      return "2601";
+    if (code == ServiceUscls._11101)
+      return "11101";
+    if (code == ServiceUscls._11102)
+      return "11102";
+    if (code == ServiceUscls._11103)
+      return "11103";
+    if (code == ServiceUscls._11104)
+      return "11104";
+    if (code == ServiceUscls._21211)
+      return "21211";
+    if (code == ServiceUscls._21212)
+      return "21212";
+    if (code == ServiceUscls._27211)
+      return "27211";
+    if (code == ServiceUscls._67211)
+      return "67211";
+    if (code == ServiceUscls._99111)
+      return "99111";
+    if (code == ServiceUscls._99333)
+      return "99333";
+    if (code == ServiceUscls._99555)
+      return "99555";
+    return "?";
+  }
+
+    public String toSystem(ServiceUscls code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SignatureType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SignatureType.java
new file mode 100644
index 00000000000..6087d403d63
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SignatureType.java
@@ -0,0 +1,231 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SignatureType {
+
+        /**
+         * the signature of the primary or sole author of a health information document. There can be only one primary author of a health information document.
+         */
+        OID_1_2_840_10065_1_12_1_1, 
+        /**
+         * the signature of a health information document coauthor. There can be multiple coauthors of a health information document.
+         */
+        OID_1_2_840_10065_1_12_1_2, 
+        /**
+         * the signature of an individual who is a participant in the health information document but is not an author or coauthor. (Example a surgeon who is required by institutional, regulatory, or legal rules to sign an operative report, but who was not involved in the authorship of that report.)
+         */
+        OID_1_2_840_10065_1_12_1_3, 
+        /**
+         * the signature of an individual who has transcribed a dictated document or recorded written text into a digital machine readable format.
+         */
+        OID_1_2_840_10065_1_12_1_4, 
+        /**
+         * a signature verifying the information contained in a document. (Example a physician is required to countersign a verbal order that has previously been recorded in the medical record by a registered nurse who has carried out the verbal order.)
+         */
+        OID_1_2_840_10065_1_12_1_5, 
+        /**
+         * a signature validating a health information document for inclusion in the patient record. (Example a medical student or resident is credentialed to perform history or physical examinations and to write progress notes. The attending physician signs the history and physical examination to validate the entry for inclusion in the patient's medical record.)
+         */
+        OID_1_2_840_10065_1_12_1_6, 
+        /**
+         * the signature of an individual consenting to what is described in a health information document.
+         */
+        OID_1_2_840_10065_1_12_1_7, 
+        /**
+         * the signature of a witness to any other signature.
+         */
+        OID_1_2_840_10065_1_12_1_8, 
+        /**
+         * the signature of a witness to an event. (Example the witness has observed a procedure and is attesting to this fact.)
+         */
+        OID_1_2_840_10065_1_12_1_9, 
+        /**
+         * the signature of an individual who has witnessed another individual who is known to them signing a document. (Example the identity witness is a notary public.)
+         */
+        OID_1_2_840_10065_1_12_1_10, 
+        /**
+         * the signature of an individual who has witnessed the health care provider counselling a patient.
+         */
+        OID_1_2_840_10065_1_12_1_11, 
+        /**
+         * the signature of an individual who has translated health care information during an event or the obtaining of consent to a treatment.
+         */
+        OID_1_2_840_10065_1_12_1_12, 
+        /**
+         * the signature of a person, device, or algorithm that has reviewed or filtered data for inclusion into the patient record. ( Examples: (1) a medical records clerk who scans a document for inclusion in the medical record, enters header information, or catalogues and classifies the data, or a combination thereof; (2) a gateway that receives data from another computer system and interprets that data or changes its format, or both, before entering it into the patient record.)
+         */
+        OID_1_2_840_10065_1_12_1_13, 
+        /**
+         * the signature of an automated data source. (Examples: (1) the signature for an image that is generated by a device for inclusion in the patient record; (2) the signature for an ECG derived by an ECG system for inclusion in the patient record; (3) the data from a biomedical monitoring device or system that is for inclusion in the patient record.)
+         */
+        OID_1_2_840_10065_1_12_1_14, 
+        /**
+         * the signature on a new amended document of an individual who has corrected, edited, or amended an original health information document. An addendum signature can either be a signature type or a signature sub-type (see 8.1). Any document with an addendum signature shall have a companion document that is the original document with its original, unaltered content, and original signatures. The original document shall be referenced via an attribute in the new document, which contains, for example, the digest of the old document. Whether the original, unaltered, document is always displayed with the addended document is a local matter, but the original, unaltered, document must remain as part of the patient record and be retrievable on demand.
+         */
+        OID_1_2_840_10065_1_12_1_15, 
+        /**
+         * the signature on an original document of an individual who has generated a new amended document. This (original) document shall reference the new document via an additional signature purpose. This is the inverse of an addendum signature and provides a pointer from the original to the amended document.
+         */
+        OID_1_2_840_10065_1_12_1_16, 
+        /**
+         * the signature of an individual who is certifying that the document is invalidated by an error(s), or is placed in the wrong chart. An administrative (error/edit) signature must include an addendum to the document and therefore shall have an addendum signature sub-type (see 8.1). This signature is reserved for the highest health information system administrative classification, since it is a statement that the entire document is invalidated by the error and that the document should no longer be used for patient care, although for legal reasons the document must remain part of the permanent patient record.
+         */
+        OID_1_2_840_10065_1_12_1_17, 
+        /**
+         * the signature by an entity or device trusted to provide accurate timestamps. This timestamp might be provided, for example, in the signature time attribute.
+         */
+        OID_1_2_840_10065_1_12_1_18, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SignatureType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1.2.840.10065.1.12.1.1".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_1;
+        if ("1.2.840.10065.1.12.1.2".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_2;
+        if ("1.2.840.10065.1.12.1.3".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_3;
+        if ("1.2.840.10065.1.12.1.4".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_4;
+        if ("1.2.840.10065.1.12.1.5".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_5;
+        if ("1.2.840.10065.1.12.1.6".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_6;
+        if ("1.2.840.10065.1.12.1.7".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_7;
+        if ("1.2.840.10065.1.12.1.8".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_8;
+        if ("1.2.840.10065.1.12.1.9".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_9;
+        if ("1.2.840.10065.1.12.1.10".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_10;
+        if ("1.2.840.10065.1.12.1.11".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_11;
+        if ("1.2.840.10065.1.12.1.12".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_12;
+        if ("1.2.840.10065.1.12.1.13".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_13;
+        if ("1.2.840.10065.1.12.1.14".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_14;
+        if ("1.2.840.10065.1.12.1.15".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_15;
+        if ("1.2.840.10065.1.12.1.16".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_16;
+        if ("1.2.840.10065.1.12.1.17".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_17;
+        if ("1.2.840.10065.1.12.1.18".equals(codeString))
+          return OID_1_2_840_10065_1_12_1_18;
+        throw new FHIRException("Unknown SignatureType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OID_1_2_840_10065_1_12_1_1: return "1.2.840.10065.1.12.1.1";
+            case OID_1_2_840_10065_1_12_1_2: return "1.2.840.10065.1.12.1.2";
+            case OID_1_2_840_10065_1_12_1_3: return "1.2.840.10065.1.12.1.3";
+            case OID_1_2_840_10065_1_12_1_4: return "1.2.840.10065.1.12.1.4";
+            case OID_1_2_840_10065_1_12_1_5: return "1.2.840.10065.1.12.1.5";
+            case OID_1_2_840_10065_1_12_1_6: return "1.2.840.10065.1.12.1.6";
+            case OID_1_2_840_10065_1_12_1_7: return "1.2.840.10065.1.12.1.7";
+            case OID_1_2_840_10065_1_12_1_8: return "1.2.840.10065.1.12.1.8";
+            case OID_1_2_840_10065_1_12_1_9: return "1.2.840.10065.1.12.1.9";
+            case OID_1_2_840_10065_1_12_1_10: return "1.2.840.10065.1.12.1.10";
+            case OID_1_2_840_10065_1_12_1_11: return "1.2.840.10065.1.12.1.11";
+            case OID_1_2_840_10065_1_12_1_12: return "1.2.840.10065.1.12.1.12";
+            case OID_1_2_840_10065_1_12_1_13: return "1.2.840.10065.1.12.1.13";
+            case OID_1_2_840_10065_1_12_1_14: return "1.2.840.10065.1.12.1.14";
+            case OID_1_2_840_10065_1_12_1_15: return "1.2.840.10065.1.12.1.15";
+            case OID_1_2_840_10065_1_12_1_16: return "1.2.840.10065.1.12.1.16";
+            case OID_1_2_840_10065_1_12_1_17: return "1.2.840.10065.1.12.1.17";
+            case OID_1_2_840_10065_1_12_1_18: return "1.2.840.10065.1.12.1.18";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "urn:iso-astm:E1762-95:2013";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OID_1_2_840_10065_1_12_1_1: return "the signature of the primary or sole author of a health information document. There can be only one primary author of a health information document.";
+            case OID_1_2_840_10065_1_12_1_2: return "the signature of a health information document coauthor. There can be multiple coauthors of a health information document.";
+            case OID_1_2_840_10065_1_12_1_3: return "the signature of an individual who is a participant in the health information document but is not an author or coauthor. (Example a surgeon who is required by institutional, regulatory, or legal rules to sign an operative report, but who was not involved in the authorship of that report.)";
+            case OID_1_2_840_10065_1_12_1_4: return "the signature of an individual who has transcribed a dictated document or recorded written text into a digital machine readable format.";
+            case OID_1_2_840_10065_1_12_1_5: return "a signature verifying the information contained in a document. (Example a physician is required to countersign a verbal order that has previously been recorded in the medical record by a registered nurse who has carried out the verbal order.)";
+            case OID_1_2_840_10065_1_12_1_6: return "a signature validating a health information document for inclusion in the patient record. (Example a medical student or resident is credentialed to perform history or physical examinations and to write progress notes. The attending physician signs the history and physical examination to validate the entry for inclusion in the patient's medical record.)";
+            case OID_1_2_840_10065_1_12_1_7: return "the signature of an individual consenting to what is described in a health information document.";
+            case OID_1_2_840_10065_1_12_1_8: return "the signature of a witness to any other signature.";
+            case OID_1_2_840_10065_1_12_1_9: return "the signature of a witness to an event. (Example the witness has observed a procedure and is attesting to this fact.)";
+            case OID_1_2_840_10065_1_12_1_10: return "the signature of an individual who has witnessed another individual who is known to them signing a document. (Example the identity witness is a notary public.)";
+            case OID_1_2_840_10065_1_12_1_11: return "the signature of an individual who has witnessed the health care provider counselling a patient.";
+            case OID_1_2_840_10065_1_12_1_12: return "the signature of an individual who has translated health care information during an event or the obtaining of consent to a treatment.";
+            case OID_1_2_840_10065_1_12_1_13: return "the signature of a person, device, or algorithm that has reviewed or filtered data for inclusion into the patient record. ( Examples: (1) a medical records clerk who scans a document for inclusion in the medical record, enters header information, or catalogues and classifies the data, or a combination thereof; (2) a gateway that receives data from another computer system and interprets that data or changes its format, or both, before entering it into the patient record.)";
+            case OID_1_2_840_10065_1_12_1_14: return "the signature of an automated data source. (Examples: (1) the signature for an image that is generated by a device for inclusion in the patient record; (2) the signature for an ECG derived by an ECG system for inclusion in the patient record; (3) the data from a biomedical monitoring device or system that is for inclusion in the patient record.)";
+            case OID_1_2_840_10065_1_12_1_15: return "the signature on a new amended document of an individual who has corrected, edited, or amended an original health information document. An addendum signature can either be a signature type or a signature sub-type (see 8.1). Any document with an addendum signature shall have a companion document that is the original document with its original, unaltered content, and original signatures. The original document shall be referenced via an attribute in the new document, which contains, for example, the digest of the old document. Whether the original, unaltered, document is always displayed with the addended document is a local matter, but the original, unaltered, document must remain as part of the patient record and be retrievable on demand.";
+            case OID_1_2_840_10065_1_12_1_16: return "the signature on an original document of an individual who has generated a new amended document. This (original) document shall reference the new document via an additional signature purpose. This is the inverse of an addendum signature and provides a pointer from the original to the amended document.";
+            case OID_1_2_840_10065_1_12_1_17: return "the signature of an individual who is certifying that the document is invalidated by an error(s), or is placed in the wrong chart. An administrative (error/edit) signature must include an addendum to the document and therefore shall have an addendum signature sub-type (see 8.1). This signature is reserved for the highest health information system administrative classification, since it is a statement that the entire document is invalidated by the error and that the document should no longer be used for patient care, although for legal reasons the document must remain part of the permanent patient record.";
+            case OID_1_2_840_10065_1_12_1_18: return "the signature by an entity or device trusted to provide accurate timestamps. This timestamp might be provided, for example, in the signature time attribute.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OID_1_2_840_10065_1_12_1_1: return "Author's Signature";
+            case OID_1_2_840_10065_1_12_1_2: return "Coauthor's Signature";
+            case OID_1_2_840_10065_1_12_1_3: return "Co-participant's Signature";
+            case OID_1_2_840_10065_1_12_1_4: return "Transcriptionist/Recorder Signature";
+            case OID_1_2_840_10065_1_12_1_5: return "Verification Signature";
+            case OID_1_2_840_10065_1_12_1_6: return "Validation Signature";
+            case OID_1_2_840_10065_1_12_1_7: return "Consent Signature";
+            case OID_1_2_840_10065_1_12_1_8: return "Signature Witness Signature";
+            case OID_1_2_840_10065_1_12_1_9: return "Event Witness Signature";
+            case OID_1_2_840_10065_1_12_1_10: return "Identity Witness Signature";
+            case OID_1_2_840_10065_1_12_1_11: return "Consent Witness Signature";
+            case OID_1_2_840_10065_1_12_1_12: return "Interpreter Signature";
+            case OID_1_2_840_10065_1_12_1_13: return "Review Signature";
+            case OID_1_2_840_10065_1_12_1_14: return "Source Signature";
+            case OID_1_2_840_10065_1_12_1_15: return "Addendum Signature";
+            case OID_1_2_840_10065_1_12_1_16: return "Modification Signature";
+            case OID_1_2_840_10065_1_12_1_17: return "Administrative (Error/Edit) Signature";
+            case OID_1_2_840_10065_1_12_1_18: return "Timestamp Signature";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SignatureTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SignatureTypeEnumFactory.java
new file mode 100644
index 00000000000..e6a8721d11c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SignatureTypeEnumFactory.java
@@ -0,0 +1,126 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SignatureTypeEnumFactory implements EnumFactory {
+
+  public SignatureType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1.2.840.10065.1.12.1.1".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_1;
+    if ("1.2.840.10065.1.12.1.2".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_2;
+    if ("1.2.840.10065.1.12.1.3".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_3;
+    if ("1.2.840.10065.1.12.1.4".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_4;
+    if ("1.2.840.10065.1.12.1.5".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_5;
+    if ("1.2.840.10065.1.12.1.6".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_6;
+    if ("1.2.840.10065.1.12.1.7".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_7;
+    if ("1.2.840.10065.1.12.1.8".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_8;
+    if ("1.2.840.10065.1.12.1.9".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_9;
+    if ("1.2.840.10065.1.12.1.10".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_10;
+    if ("1.2.840.10065.1.12.1.11".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_11;
+    if ("1.2.840.10065.1.12.1.12".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_12;
+    if ("1.2.840.10065.1.12.1.13".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_13;
+    if ("1.2.840.10065.1.12.1.14".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_14;
+    if ("1.2.840.10065.1.12.1.15".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_15;
+    if ("1.2.840.10065.1.12.1.16".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_16;
+    if ("1.2.840.10065.1.12.1.17".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_17;
+    if ("1.2.840.10065.1.12.1.18".equals(codeString))
+      return SignatureType.OID_1_2_840_10065_1_12_1_18;
+    throw new IllegalArgumentException("Unknown SignatureType code '"+codeString+"'");
+  }
+
+  public String toCode(SignatureType code) {
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_1)
+      return "1.2.840.10065.1.12.1.1";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_2)
+      return "1.2.840.10065.1.12.1.2";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_3)
+      return "1.2.840.10065.1.12.1.3";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_4)
+      return "1.2.840.10065.1.12.1.4";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_5)
+      return "1.2.840.10065.1.12.1.5";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_6)
+      return "1.2.840.10065.1.12.1.6";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_7)
+      return "1.2.840.10065.1.12.1.7";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_8)
+      return "1.2.840.10065.1.12.1.8";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_9)
+      return "1.2.840.10065.1.12.1.9";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_10)
+      return "1.2.840.10065.1.12.1.10";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_11)
+      return "1.2.840.10065.1.12.1.11";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_12)
+      return "1.2.840.10065.1.12.1.12";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_13)
+      return "1.2.840.10065.1.12.1.13";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_14)
+      return "1.2.840.10065.1.12.1.14";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_15)
+      return "1.2.840.10065.1.12.1.15";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_16)
+      return "1.2.840.10065.1.12.1.16";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_17)
+      return "1.2.840.10065.1.12.1.17";
+    if (code == SignatureType.OID_1_2_840_10065_1_12_1_18)
+      return "1.2.840.10065.1.12.1.18";
+    return "?";
+  }
+
+    public String toSystem(SignatureType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Slotstatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Slotstatus.java
new file mode 100644
index 00000000000..c93fa9f8713
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Slotstatus.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Slotstatus {
+
+        /**
+         * Indicates that the time interval is busy because one  or more events have been scheduled for that interval.
+         */
+        BUSY, 
+        /**
+         * Indicates that the time interval is free for scheduling.
+         */
+        FREE, 
+        /**
+         * Indicates that the time interval is busy and that the interval can not be scheduled.
+         */
+        BUSYUNAVAILABLE, 
+        /**
+         * Indicates that the time interval is busy because one or more events have been tentatively scheduled for that interval.
+         */
+        BUSYTENTATIVE, 
+        /**
+         * This instance should not have been part of this patient's medical record.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Slotstatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("busy".equals(codeString))
+          return BUSY;
+        if ("free".equals(codeString))
+          return FREE;
+        if ("busy-unavailable".equals(codeString))
+          return BUSYUNAVAILABLE;
+        if ("busy-tentative".equals(codeString))
+          return BUSYTENTATIVE;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown Slotstatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BUSY: return "busy";
+            case FREE: return "free";
+            case BUSYUNAVAILABLE: return "busy-unavailable";
+            case BUSYTENTATIVE: return "busy-tentative";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/slotstatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BUSY: return "Indicates that the time interval is busy because one  or more events have been scheduled for that interval.";
+            case FREE: return "Indicates that the time interval is free for scheduling.";
+            case BUSYUNAVAILABLE: return "Indicates that the time interval is busy and that the interval can not be scheduled.";
+            case BUSYTENTATIVE: return "Indicates that the time interval is busy because one or more events have been tentatively scheduled for that interval.";
+            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BUSY: return "Busy";
+            case FREE: return "Free";
+            case BUSYUNAVAILABLE: return "Busy (Unavailable)";
+            case BUSYTENTATIVE: return "Busy (Tentative)";
+            case ENTEREDINERROR: return "Entered in error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SlotstatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SlotstatusEnumFactory.java
new file mode 100644
index 00000000000..cfd9ba94083
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SlotstatusEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SlotstatusEnumFactory implements EnumFactory {
+
+  public Slotstatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("busy".equals(codeString))
+      return Slotstatus.BUSY;
+    if ("free".equals(codeString))
+      return Slotstatus.FREE;
+    if ("busy-unavailable".equals(codeString))
+      return Slotstatus.BUSYUNAVAILABLE;
+    if ("busy-tentative".equals(codeString))
+      return Slotstatus.BUSYTENTATIVE;
+    if ("entered-in-error".equals(codeString))
+      return Slotstatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown Slotstatus code '"+codeString+"'");
+  }
+
+  public String toCode(Slotstatus code) {
+    if (code == Slotstatus.BUSY)
+      return "busy";
+    if (code == Slotstatus.FREE)
+      return "free";
+    if (code == Slotstatus.BUSYUNAVAILABLE)
+      return "busy-unavailable";
+    if (code == Slotstatus.BUSYTENTATIVE)
+      return "busy-tentative";
+    if (code == Slotstatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(Slotstatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecialValues.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecialValues.java
new file mode 100644
index 00000000000..37aff14c8ac
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecialValues.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SpecialValues {
+
+        /**
+         * Boolean true.
+         */
+        TRUE, 
+        /**
+         * Boolean false.
+         */
+        FALSE, 
+        /**
+         * The content is greater than zero, but too small to be quantified.
+         */
+        TRACE, 
+        /**
+         * The specific quantity is not known, but is known to be non-zero and is not specified because it makes up the bulk of the material.
+         */
+        SUFFICIENT, 
+        /**
+         * The value is no longer available.
+         */
+        WITHDRAWN, 
+        /**
+         * The are no known applicable values in this context.
+         */
+        NILKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SpecialValues fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("true".equals(codeString))
+          return TRUE;
+        if ("false".equals(codeString))
+          return FALSE;
+        if ("trace".equals(codeString))
+          return TRACE;
+        if ("sufficient".equals(codeString))
+          return SUFFICIENT;
+        if ("withdrawn".equals(codeString))
+          return WITHDRAWN;
+        if ("nil-known".equals(codeString))
+          return NILKNOWN;
+        throw new FHIRException("Unknown SpecialValues code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case TRUE: return "true";
+            case FALSE: return "false";
+            case TRACE: return "trace";
+            case SUFFICIENT: return "sufficient";
+            case WITHDRAWN: return "withdrawn";
+            case NILKNOWN: return "nil-known";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/special-values";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case TRUE: return "Boolean true.";
+            case FALSE: return "Boolean false.";
+            case TRACE: return "The content is greater than zero, but too small to be quantified.";
+            case SUFFICIENT: return "The specific quantity is not known, but is known to be non-zero and is not specified because it makes up the bulk of the material.";
+            case WITHDRAWN: return "The value is no longer available.";
+            case NILKNOWN: return "The are no known applicable values in this context.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case TRUE: return "true";
+            case FALSE: return "false";
+            case TRACE: return "Trace Amount Detected";
+            case SUFFICIENT: return "Sufficient Quantity";
+            case WITHDRAWN: return "Value Withdrawn";
+            case NILKNOWN: return "Nil Known";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecialValuesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecialValuesEnumFactory.java
new file mode 100644
index 00000000000..3a9c5e26ec0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecialValuesEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SpecialValuesEnumFactory implements EnumFactory {
+
+  public SpecialValues fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("true".equals(codeString))
+      return SpecialValues.TRUE;
+    if ("false".equals(codeString))
+      return SpecialValues.FALSE;
+    if ("trace".equals(codeString))
+      return SpecialValues.TRACE;
+    if ("sufficient".equals(codeString))
+      return SpecialValues.SUFFICIENT;
+    if ("withdrawn".equals(codeString))
+      return SpecialValues.WITHDRAWN;
+    if ("nil-known".equals(codeString))
+      return SpecialValues.NILKNOWN;
+    throw new IllegalArgumentException("Unknown SpecialValues code '"+codeString+"'");
+  }
+
+  public String toCode(SpecialValues code) {
+    if (code == SpecialValues.TRUE)
+      return "true";
+    if (code == SpecialValues.FALSE)
+      return "false";
+    if (code == SpecialValues.TRACE)
+      return "trace";
+    if (code == SpecialValues.SUFFICIENT)
+      return "sufficient";
+    if (code == SpecialValues.WITHDRAWN)
+      return "withdrawn";
+    if (code == SpecialValues.NILKNOWN)
+      return "nil-known";
+    return "?";
+  }
+
+    public String toSystem(SpecialValues code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecificationType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecificationType.java
new file mode 100644
index 00000000000..2ee1f9723f5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecificationType.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SpecificationType {
+
+        /**
+         * Unspecified Production Specification - MDC_ID_PROD_SPEC_UNSPECIFIED
+         */
+        UNSPECIFIED, 
+        /**
+         * Serial Number - MDC_ID_PROD_SPEC_SERIAL
+         */
+        SERIALNUMBER, 
+        /**
+         * Part Number - MDC_ID_PROD_SPEC_PART
+         */
+        PARTNUMBER, 
+        /**
+         * Hardware Revision - MDC_ID_PROD_SPEC_HW
+         */
+        HARDWAREREVISION, 
+        /**
+         * Software Revision - MDC_ID_PROD_SPEC_SW
+         */
+        SOFTWAREREVISION, 
+        /**
+         * Firmware Revision - MDC_ID_PROD_SPEC_FW
+         */
+        FIRMWAREREVISION, 
+        /**
+         * Protocol Revision - MDC_ID_PROD_SPEC_PROTOCOL
+         */
+        PROTOCOLREVISION, 
+        /**
+         * GMDN - MDC_ID_PROD_SPEC_GMDN
+         */
+        GMDN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SpecificationType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("unspecified".equals(codeString))
+          return UNSPECIFIED;
+        if ("serial-number".equals(codeString))
+          return SERIALNUMBER;
+        if ("part-number".equals(codeString))
+          return PARTNUMBER;
+        if ("hardware-revision".equals(codeString))
+          return HARDWAREREVISION;
+        if ("software-revision".equals(codeString))
+          return SOFTWAREREVISION;
+        if ("firmware-revision".equals(codeString))
+          return FIRMWAREREVISION;
+        if ("protocol-revision".equals(codeString))
+          return PROTOCOLREVISION;
+        if ("gmdn".equals(codeString))
+          return GMDN;
+        throw new FHIRException("Unknown SpecificationType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UNSPECIFIED: return "unspecified";
+            case SERIALNUMBER: return "serial-number";
+            case PARTNUMBER: return "part-number";
+            case HARDWAREREVISION: return "hardware-revision";
+            case SOFTWAREREVISION: return "software-revision";
+            case FIRMWAREREVISION: return "firmware-revision";
+            case PROTOCOLREVISION: return "protocol-revision";
+            case GMDN: return "gmdn";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/specification-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UNSPECIFIED: return "Unspecified Production Specification - MDC_ID_PROD_SPEC_UNSPECIFIED";
+            case SERIALNUMBER: return "Serial Number - MDC_ID_PROD_SPEC_SERIAL";
+            case PARTNUMBER: return "Part Number - MDC_ID_PROD_SPEC_PART";
+            case HARDWAREREVISION: return "Hardware Revision - MDC_ID_PROD_SPEC_HW";
+            case SOFTWAREREVISION: return "Software Revision - MDC_ID_PROD_SPEC_SW";
+            case FIRMWAREREVISION: return "Firmware Revision - MDC_ID_PROD_SPEC_FW";
+            case PROTOCOLREVISION: return "Protocol Revision - MDC_ID_PROD_SPEC_PROTOCOL";
+            case GMDN: return "GMDN - MDC_ID_PROD_SPEC_GMDN";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UNSPECIFIED: return "Unspecified Production Specification";
+            case SERIALNUMBER: return "Serial Number";
+            case PARTNUMBER: return "Part Number";
+            case HARDWAREREVISION: return "Hardware Revision";
+            case SOFTWAREREVISION: return "Software Revision";
+            case FIRMWAREREVISION: return "Firmware Revision";
+            case PROTOCOLREVISION: return "Protocol Revision";
+            case GMDN: return "GMDN";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecificationTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecificationTypeEnumFactory.java
new file mode 100644
index 00000000000..d815cbe6edc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecificationTypeEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SpecificationTypeEnumFactory implements EnumFactory {
+
+  public SpecificationType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("unspecified".equals(codeString))
+      return SpecificationType.UNSPECIFIED;
+    if ("serial-number".equals(codeString))
+      return SpecificationType.SERIALNUMBER;
+    if ("part-number".equals(codeString))
+      return SpecificationType.PARTNUMBER;
+    if ("hardware-revision".equals(codeString))
+      return SpecificationType.HARDWAREREVISION;
+    if ("software-revision".equals(codeString))
+      return SpecificationType.SOFTWAREREVISION;
+    if ("firmware-revision".equals(codeString))
+      return SpecificationType.FIRMWAREREVISION;
+    if ("protocol-revision".equals(codeString))
+      return SpecificationType.PROTOCOLREVISION;
+    if ("gmdn".equals(codeString))
+      return SpecificationType.GMDN;
+    throw new IllegalArgumentException("Unknown SpecificationType code '"+codeString+"'");
+  }
+
+  public String toCode(SpecificationType code) {
+    if (code == SpecificationType.UNSPECIFIED)
+      return "unspecified";
+    if (code == SpecificationType.SERIALNUMBER)
+      return "serial-number";
+    if (code == SpecificationType.PARTNUMBER)
+      return "part-number";
+    if (code == SpecificationType.HARDWAREREVISION)
+      return "hardware-revision";
+    if (code == SpecificationType.SOFTWAREREVISION)
+      return "software-revision";
+    if (code == SpecificationType.FIRMWAREREVISION)
+      return "firmware-revision";
+    if (code == SpecificationType.PROTOCOLREVISION)
+      return "protocol-revision";
+    if (code == SpecificationType.GMDN)
+      return "gmdn";
+    return "?";
+  }
+
+    public String toSystem(SpecificationType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecimenStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecimenStatus.java
new file mode 100644
index 00000000000..6b85a299d07
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecimenStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SpecimenStatus {
+
+        /**
+         * The physical specimen is present and in good condition.
+         */
+        AVAILABLE, 
+        /**
+         * There is no physical specimen because it is either lost, destroyed or consumed.
+         */
+        UNAVAILABLE, 
+        /**
+         * The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old.
+         */
+        UNSATISFACTORY, 
+        /**
+         * The specimen was entered in error and therefore nullified.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SpecimenStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("available".equals(codeString))
+          return AVAILABLE;
+        if ("unavailable".equals(codeString))
+          return UNAVAILABLE;
+        if ("unsatisfactory".equals(codeString))
+          return UNSATISFACTORY;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown SpecimenStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AVAILABLE: return "available";
+            case UNAVAILABLE: return "unavailable";
+            case UNSATISFACTORY: return "unsatisfactory";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/specimen-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AVAILABLE: return "The physical specimen is present and in good condition.";
+            case UNAVAILABLE: return "There is no physical specimen because it is either lost, destroyed or consumed.";
+            case UNSATISFACTORY: return "The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old.";
+            case ENTEREDINERROR: return "The specimen was entered in error and therefore nullified.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AVAILABLE: return "Available";
+            case UNAVAILABLE: return "Unavailable";
+            case UNSATISFACTORY: return "Unsatisfactory";
+            case ENTEREDINERROR: return "Entered-in-error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecimenStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecimenStatusEnumFactory.java
new file mode 100644
index 00000000000..6fe29c162c7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SpecimenStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SpecimenStatusEnumFactory implements EnumFactory {
+
+  public SpecimenStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("available".equals(codeString))
+      return SpecimenStatus.AVAILABLE;
+    if ("unavailable".equals(codeString))
+      return SpecimenStatus.UNAVAILABLE;
+    if ("unsatisfactory".equals(codeString))
+      return SpecimenStatus.UNSATISFACTORY;
+    if ("entered-in-error".equals(codeString))
+      return SpecimenStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown SpecimenStatus code '"+codeString+"'");
+  }
+
+  public String toCode(SpecimenStatus code) {
+    if (code == SpecimenStatus.AVAILABLE)
+      return "available";
+    if (code == SpecimenStatus.UNAVAILABLE)
+      return "unavailable";
+    if (code == SpecimenStatus.UNSATISFACTORY)
+      return "unsatisfactory";
+    if (code == SpecimenStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(SpecimenStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/StructureDefinitionKind.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/StructureDefinitionKind.java
new file mode 100644
index 00000000000..eb895d9913a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/StructureDefinitionKind.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum StructureDefinitionKind {
+
+        /**
+         * A primitive type that has a value and an extension. These can be used throughout Resource and extension definitions. Only the base specification can define primitive types.
+         */
+        PRIMITIVETYPE, 
+        /**
+         * A  complex structure that defines a set of data elements. These can be used throughout Resource and extension definitions, and in logical models.
+         */
+        COMPLEXTYPE, 
+        /**
+         * A resource defined by the FHIR specification.
+         */
+        RESOURCE, 
+        /**
+         * A conceptual package of data that will be mapped to resources for implementation.
+         */
+        LOGICAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static StructureDefinitionKind fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("primitive-type".equals(codeString))
+          return PRIMITIVETYPE;
+        if ("complex-type".equals(codeString))
+          return COMPLEXTYPE;
+        if ("resource".equals(codeString))
+          return RESOURCE;
+        if ("logical".equals(codeString))
+          return LOGICAL;
+        throw new FHIRException("Unknown StructureDefinitionKind code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PRIMITIVETYPE: return "primitive-type";
+            case COMPLEXTYPE: return "complex-type";
+            case RESOURCE: return "resource";
+            case LOGICAL: return "logical";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/structure-definition-kind";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PRIMITIVETYPE: return "A primitive type that has a value and an extension. These can be used throughout Resource and extension definitions. Only the base specification can define primitive types.";
+            case COMPLEXTYPE: return "A  complex structure that defines a set of data elements. These can be used throughout Resource and extension definitions, and in logical models.";
+            case RESOURCE: return "A resource defined by the FHIR specification.";
+            case LOGICAL: return "A conceptual package of data that will be mapped to resources for implementation.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PRIMITIVETYPE: return "Primitive Data Type";
+            case COMPLEXTYPE: return "Complex Data Type";
+            case RESOURCE: return "Resource";
+            case LOGICAL: return "Logical Model";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/StructureDefinitionKindEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/StructureDefinitionKindEnumFactory.java
new file mode 100644
index 00000000000..e0bfda3f364
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/StructureDefinitionKindEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class StructureDefinitionKindEnumFactory implements EnumFactory {
+
+  public StructureDefinitionKind fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("primitive-type".equals(codeString))
+      return StructureDefinitionKind.PRIMITIVETYPE;
+    if ("complex-type".equals(codeString))
+      return StructureDefinitionKind.COMPLEXTYPE;
+    if ("resource".equals(codeString))
+      return StructureDefinitionKind.RESOURCE;
+    if ("logical".equals(codeString))
+      return StructureDefinitionKind.LOGICAL;
+    throw new IllegalArgumentException("Unknown StructureDefinitionKind code '"+codeString+"'");
+  }
+
+  public String toCode(StructureDefinitionKind code) {
+    if (code == StructureDefinitionKind.PRIMITIVETYPE)
+      return "primitive-type";
+    if (code == StructureDefinitionKind.COMPLEXTYPE)
+      return "complex-type";
+    if (code == StructureDefinitionKind.RESOURCE)
+      return "resource";
+    if (code == StructureDefinitionKind.LOGICAL)
+      return "logical";
+    return "?";
+  }
+
+    public String toSystem(StructureDefinitionKind code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionChannelType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionChannelType.java
new file mode 100644
index 00000000000..210079a556d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionChannelType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SubscriptionChannelType {
+
+        /**
+         * The channel is executed by making a post to the URI. If a payload is included, the URL is interpreted as the service base, and an update (PUT) is made.
+         */
+        RESTHOOK, 
+        /**
+         * The channel is executed by sending a packet across a web socket connection maintained by the client. The URL identifies the websocket, and the client binds to this URL.
+         */
+        WEBSOCKET, 
+        /**
+         * The channel is executed by sending an email to the email addressed in the URI (which must be a mailto:).
+         */
+        EMAIL, 
+        /**
+         * The channel is executed by sending an SMS message to the phone number identified in the URL (tel:).
+         */
+        SMS, 
+        /**
+         * The channel is executed by sending a message (e.g. a Bundle with a MessageHeader resource etc.) to the application identified in the URI.
+         */
+        MESSAGE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SubscriptionChannelType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("rest-hook".equals(codeString))
+          return RESTHOOK;
+        if ("websocket".equals(codeString))
+          return WEBSOCKET;
+        if ("email".equals(codeString))
+          return EMAIL;
+        if ("sms".equals(codeString))
+          return SMS;
+        if ("message".equals(codeString))
+          return MESSAGE;
+        throw new FHIRException("Unknown SubscriptionChannelType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case RESTHOOK: return "rest-hook";
+            case WEBSOCKET: return "websocket";
+            case EMAIL: return "email";
+            case SMS: return "sms";
+            case MESSAGE: return "message";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/subscription-channel-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case RESTHOOK: return "The channel is executed by making a post to the URI. If a payload is included, the URL is interpreted as the service base, and an update (PUT) is made.";
+            case WEBSOCKET: return "The channel is executed by sending a packet across a web socket connection maintained by the client. The URL identifies the websocket, and the client binds to this URL.";
+            case EMAIL: return "The channel is executed by sending an email to the email addressed in the URI (which must be a mailto:).";
+            case SMS: return "The channel is executed by sending an SMS message to the phone number identified in the URL (tel:).";
+            case MESSAGE: return "The channel is executed by sending a message (e.g. a Bundle with a MessageHeader resource etc.) to the application identified in the URI.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case RESTHOOK: return "Rest Hook";
+            case WEBSOCKET: return "Websocket";
+            case EMAIL: return "Email";
+            case SMS: return "SMS";
+            case MESSAGE: return "Message";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionChannelTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionChannelTypeEnumFactory.java
new file mode 100644
index 00000000000..bcd64fa7f13
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionChannelTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SubscriptionChannelTypeEnumFactory implements EnumFactory {
+
+  public SubscriptionChannelType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("rest-hook".equals(codeString))
+      return SubscriptionChannelType.RESTHOOK;
+    if ("websocket".equals(codeString))
+      return SubscriptionChannelType.WEBSOCKET;
+    if ("email".equals(codeString))
+      return SubscriptionChannelType.EMAIL;
+    if ("sms".equals(codeString))
+      return SubscriptionChannelType.SMS;
+    if ("message".equals(codeString))
+      return SubscriptionChannelType.MESSAGE;
+    throw new IllegalArgumentException("Unknown SubscriptionChannelType code '"+codeString+"'");
+  }
+
+  public String toCode(SubscriptionChannelType code) {
+    if (code == SubscriptionChannelType.RESTHOOK)
+      return "rest-hook";
+    if (code == SubscriptionChannelType.WEBSOCKET)
+      return "websocket";
+    if (code == SubscriptionChannelType.EMAIL)
+      return "email";
+    if (code == SubscriptionChannelType.SMS)
+      return "sms";
+    if (code == SubscriptionChannelType.MESSAGE)
+      return "message";
+    return "?";
+  }
+
+    public String toSystem(SubscriptionChannelType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionStatus.java
new file mode 100644
index 00000000000..3ffebcb753d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SubscriptionStatus {
+
+        /**
+         * The client has requested the subscription, and the server has not yet set it up.
+         */
+        REQUESTED, 
+        /**
+         * The subscription is active.
+         */
+        ACTIVE, 
+        /**
+         * The server has an error executing the notification.
+         */
+        ERROR, 
+        /**
+         * Too many errors have occurred or the subscription has expired.
+         */
+        OFF, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SubscriptionStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("requested".equals(codeString))
+          return REQUESTED;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("error".equals(codeString))
+          return ERROR;
+        if ("off".equals(codeString))
+          return OFF;
+        throw new FHIRException("Unknown SubscriptionStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REQUESTED: return "requested";
+            case ACTIVE: return "active";
+            case ERROR: return "error";
+            case OFF: return "off";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/subscription-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REQUESTED: return "The client has requested the subscription, and the server has not yet set it up.";
+            case ACTIVE: return "The subscription is active.";
+            case ERROR: return "The server has an error executing the notification.";
+            case OFF: return "Too many errors have occurred or the subscription has expired.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REQUESTED: return "Requested";
+            case ACTIVE: return "Active";
+            case ERROR: return "Error";
+            case OFF: return "Off";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionStatusEnumFactory.java
new file mode 100644
index 00000000000..b427df6800b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SubscriptionStatusEnumFactory implements EnumFactory {
+
+  public SubscriptionStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("requested".equals(codeString))
+      return SubscriptionStatus.REQUESTED;
+    if ("active".equals(codeString))
+      return SubscriptionStatus.ACTIVE;
+    if ("error".equals(codeString))
+      return SubscriptionStatus.ERROR;
+    if ("off".equals(codeString))
+      return SubscriptionStatus.OFF;
+    throw new IllegalArgumentException("Unknown SubscriptionStatus code '"+codeString+"'");
+  }
+
+  public String toCode(SubscriptionStatus code) {
+    if (code == SubscriptionStatus.REQUESTED)
+      return "requested";
+    if (code == SubscriptionStatus.ACTIVE)
+      return "active";
+    if (code == SubscriptionStatus.ERROR)
+      return "error";
+    if (code == SubscriptionStatus.OFF)
+      return "off";
+    return "?";
+  }
+
+    public String toSystem(SubscriptionStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionTag.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionTag.java
new file mode 100644
index 00000000000..1f377d52e7e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionTag.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SubscriptionTag {
+
+        /**
+         * The message has been queued for processing on a destination systems.
+         */
+        QUEUED, 
+        /**
+         * The message has been delivered to its intended recipient.
+         */
+        DELIVERED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SubscriptionTag fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("queued".equals(codeString))
+          return QUEUED;
+        if ("delivered".equals(codeString))
+          return DELIVERED;
+        throw new FHIRException("Unknown SubscriptionTag code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case QUEUED: return "queued";
+            case DELIVERED: return "delivered";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/subscription-tag";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case QUEUED: return "The message has been queued for processing on a destination systems.";
+            case DELIVERED: return "The message has been delivered to its intended recipient.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case QUEUED: return "Queued";
+            case DELIVERED: return "Delivered";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionTagEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionTagEnumFactory.java
new file mode 100644
index 00000000000..462dcccbf08
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubscriptionTagEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SubscriptionTagEnumFactory implements EnumFactory {
+
+  public SubscriptionTag fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("queued".equals(codeString))
+      return SubscriptionTag.QUEUED;
+    if ("delivered".equals(codeString))
+      return SubscriptionTag.DELIVERED;
+    throw new IllegalArgumentException("Unknown SubscriptionTag code '"+codeString+"'");
+  }
+
+  public String toCode(SubscriptionTag code) {
+    if (code == SubscriptionTag.QUEUED)
+      return "queued";
+    if (code == SubscriptionTag.DELIVERED)
+      return "delivered";
+    return "?";
+  }
+
+    public String toSystem(SubscriptionTag code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceCategory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceCategory.java
new file mode 100644
index 00000000000..b3c3dae5fe2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceCategory.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SubstanceCategory {
+
+        /**
+         * A substance that causes an allergic reaction.
+         */
+        ALLERGEN, 
+        /**
+         * A substance that is produced by or extracted from a biological source.
+         */
+        BIOLOGICAL, 
+        /**
+         * A substance that comes directly from a human or an animal (e.g. blood, urine, feces, tears, etc.).
+         */
+        BODY, 
+        /**
+         * Any organic or inorganic substance of a particular molecular identity, including -- (i) any combination of such substances occurring in whole or in part as a result of a chemical reaction or occurring in nature and (ii) any element or uncombined radical (http://www.epa.gov/opptintr/import-export/pubs/importguide.pdf).
+         */
+        CHEMICAL, 
+        /**
+         * A food, dietary ingredient, or dietary supplement for human or animal.
+         */
+        FOOD, 
+        /**
+         * A substance intended for use in the diagnosis, cure, mitigation, treatment, or prevention of disease in man or other animals (Federal Food Drug and Cosmetic Act).
+         */
+        DRUG, 
+        /**
+         * A finished product which is not normally ingested, absorbed or injected (e.g. steel, iron, wood, plastic and paper).
+         */
+        MATERIAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SubstanceCategory fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("allergen".equals(codeString))
+          return ALLERGEN;
+        if ("biological".equals(codeString))
+          return BIOLOGICAL;
+        if ("body".equals(codeString))
+          return BODY;
+        if ("chemical".equals(codeString))
+          return CHEMICAL;
+        if ("food".equals(codeString))
+          return FOOD;
+        if ("drug".equals(codeString))
+          return DRUG;
+        if ("material".equals(codeString))
+          return MATERIAL;
+        throw new FHIRException("Unknown SubstanceCategory code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ALLERGEN: return "allergen";
+            case BIOLOGICAL: return "biological";
+            case BODY: return "body";
+            case CHEMICAL: return "chemical";
+            case FOOD: return "food";
+            case DRUG: return "drug";
+            case MATERIAL: return "material";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/substance-category";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ALLERGEN: return "A substance that causes an allergic reaction.";
+            case BIOLOGICAL: return "A substance that is produced by or extracted from a biological source.";
+            case BODY: return "A substance that comes directly from a human or an animal (e.g. blood, urine, feces, tears, etc.).";
+            case CHEMICAL: return "Any organic or inorganic substance of a particular molecular identity, including -- (i) any combination of such substances occurring in whole or in part as a result of a chemical reaction or occurring in nature and (ii) any element or uncombined radical (http://www.epa.gov/opptintr/import-export/pubs/importguide.pdf).";
+            case FOOD: return "A food, dietary ingredient, or dietary supplement for human or animal.";
+            case DRUG: return "A substance intended for use in the diagnosis, cure, mitigation, treatment, or prevention of disease in man or other animals (Federal Food Drug and Cosmetic Act).";
+            case MATERIAL: return "A finished product which is not normally ingested, absorbed or injected (e.g. steel, iron, wood, plastic and paper).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ALLERGEN: return "Allergen";
+            case BIOLOGICAL: return "Biological Substance";
+            case BODY: return "Body Substance";
+            case CHEMICAL: return "Chemical";
+            case FOOD: return "Dietary Substance";
+            case DRUG: return "Drug or Medicament";
+            case MATERIAL: return "Material";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceCategoryEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceCategoryEnumFactory.java
new file mode 100644
index 00000000000..42114739bd2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceCategoryEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SubstanceCategoryEnumFactory implements EnumFactory {
+
+  public SubstanceCategory fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("allergen".equals(codeString))
+      return SubstanceCategory.ALLERGEN;
+    if ("biological".equals(codeString))
+      return SubstanceCategory.BIOLOGICAL;
+    if ("body".equals(codeString))
+      return SubstanceCategory.BODY;
+    if ("chemical".equals(codeString))
+      return SubstanceCategory.CHEMICAL;
+    if ("food".equals(codeString))
+      return SubstanceCategory.FOOD;
+    if ("drug".equals(codeString))
+      return SubstanceCategory.DRUG;
+    if ("material".equals(codeString))
+      return SubstanceCategory.MATERIAL;
+    throw new IllegalArgumentException("Unknown SubstanceCategory code '"+codeString+"'");
+  }
+
+  public String toCode(SubstanceCategory code) {
+    if (code == SubstanceCategory.ALLERGEN)
+      return "allergen";
+    if (code == SubstanceCategory.BIOLOGICAL)
+      return "biological";
+    if (code == SubstanceCategory.BODY)
+      return "body";
+    if (code == SubstanceCategory.CHEMICAL)
+      return "chemical";
+    if (code == SubstanceCategory.FOOD)
+      return "food";
+    if (code == SubstanceCategory.DRUG)
+      return "drug";
+    if (code == SubstanceCategory.MATERIAL)
+      return "material";
+    return "?";
+  }
+
+    public String toSystem(SubstanceCategory code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceStatus.java
new file mode 100644
index 00000000000..62edf572ac6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceStatus.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SubstanceStatus {
+
+        /**
+         * The substance is considered for use or reference
+         */
+        ACTIVE, 
+        /**
+         * The substance is considered for reference, but not for use
+         */
+        INACTIVE, 
+        /**
+         * The substance was entered in error
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SubstanceStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown SubstanceStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case INACTIVE: return "inactive";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/substance-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The substance is considered for use or reference";
+            case INACTIVE: return "The substance is considered for reference, but not for use";
+            case ENTEREDINERROR: return "The substance was entered in error";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case INACTIVE: return "Inactive";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceStatusEnumFactory.java
new file mode 100644
index 00000000000..25fef908df3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SubstanceStatusEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SubstanceStatusEnumFactory implements EnumFactory {
+
+  public SubstanceStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return SubstanceStatus.ACTIVE;
+    if ("inactive".equals(codeString))
+      return SubstanceStatus.INACTIVE;
+    if ("entered-in-error".equals(codeString))
+      return SubstanceStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown SubstanceStatus code '"+codeString+"'");
+  }
+
+  public String toCode(SubstanceStatus code) {
+    if (code == SubstanceStatus.ACTIVE)
+      return "active";
+    if (code == SubstanceStatus.INACTIVE)
+      return "inactive";
+    if (code == SubstanceStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(SubstanceStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryStatus.java
new file mode 100644
index 00000000000..436b30669ec
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SupplydeliveryStatus {
+
+        /**
+         * Supply has been requested, but not delivered.
+         */
+        INPROGRESS, 
+        /**
+         * Supply has been delivered ("completed").
+         */
+        COMPLETED, 
+        /**
+         * Delivery was not completed.
+         */
+        ABANDONED, 
+        /**
+         * 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, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SupplydeliveryStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("abandoned".equals(codeString))
+          return ABANDONED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown SupplydeliveryStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INPROGRESS: return "in-progress";
+            case COMPLETED: return "completed";
+            case ABANDONED: return "abandoned";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/supplydelivery-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INPROGRESS: return "Supply has been requested, but not delivered.";
+            case COMPLETED: return "Supply has been delivered (\"completed\").";
+            case ABANDONED: return "Delivery was not completed.";
+            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\".)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INPROGRESS: return "In Progress";
+            case COMPLETED: return "Delivered";
+            case ABANDONED: return "Abandoned";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryStatusEnumFactory.java
new file mode 100644
index 00000000000..3a2db357189
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SupplydeliveryStatusEnumFactory implements EnumFactory {
+
+  public SupplydeliveryStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("in-progress".equals(codeString))
+      return SupplydeliveryStatus.INPROGRESS;
+    if ("completed".equals(codeString))
+      return SupplydeliveryStatus.COMPLETED;
+    if ("abandoned".equals(codeString))
+      return SupplydeliveryStatus.ABANDONED;
+    if ("entered-in-error".equals(codeString))
+      return SupplydeliveryStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown SupplydeliveryStatus code '"+codeString+"'");
+  }
+
+  public String toCode(SupplydeliveryStatus code) {
+    if (code == SupplydeliveryStatus.INPROGRESS)
+      return "in-progress";
+    if (code == SupplydeliveryStatus.COMPLETED)
+      return "completed";
+    if (code == SupplydeliveryStatus.ABANDONED)
+      return "abandoned";
+    if (code == SupplydeliveryStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(SupplydeliveryStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryType.java
new file mode 100644
index 00000000000..1e3b75461fd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryType.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SupplydeliveryType {
+
+        /**
+         * Supply is a kind of medication.
+         */
+        MEDICATION, 
+        /**
+         * What is supplied (or requested) is a device.
+         */
+        DEVICE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SupplydeliveryType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("medication".equals(codeString))
+          return MEDICATION;
+        if ("device".equals(codeString))
+          return DEVICE;
+        throw new FHIRException("Unknown SupplydeliveryType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case MEDICATION: return "medication";
+            case DEVICE: return "device";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/supply-item-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case MEDICATION: return "Supply is a kind of medication.";
+            case DEVICE: return "What is supplied (or requested) is a device.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case MEDICATION: return "Medication";
+            case DEVICE: return "Device";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryTypeEnumFactory.java
new file mode 100644
index 00000000000..01cf06d0821
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplydeliveryTypeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SupplydeliveryTypeEnumFactory implements EnumFactory {
+
+  public SupplydeliveryType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("medication".equals(codeString))
+      return SupplydeliveryType.MEDICATION;
+    if ("device".equals(codeString))
+      return SupplydeliveryType.DEVICE;
+    throw new IllegalArgumentException("Unknown SupplydeliveryType code '"+codeString+"'");
+  }
+
+  public String toCode(SupplydeliveryType code) {
+    if (code == SupplydeliveryType.MEDICATION)
+      return "medication";
+    if (code == SupplydeliveryType.DEVICE)
+      return "device";
+    return "?";
+  }
+
+    public String toSystem(SupplydeliveryType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestKind.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestKind.java
new file mode 100644
index 00000000000..6cd71204d8f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestKind.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SupplyrequestKind {
+
+        /**
+         * Supply is stored and requested from central supply.
+         */
+        CENTRAL, 
+        /**
+         * Supply is not onsite and must be requested from an outside vendor using a non-stock requisition.
+         */
+        NONSTOCK, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SupplyrequestKind fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("central".equals(codeString))
+          return CENTRAL;
+        if ("nonstock".equals(codeString))
+          return NONSTOCK;
+        throw new FHIRException("Unknown SupplyrequestKind code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CENTRAL: return "central";
+            case NONSTOCK: return "nonstock";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/supply-kind";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CENTRAL: return "Supply is stored and requested from central supply.";
+            case NONSTOCK: return "Supply is not onsite and must be requested from an outside vendor using a non-stock requisition.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CENTRAL: return "Central Supply";
+            case NONSTOCK: return "Non-Stock";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestKindEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestKindEnumFactory.java
new file mode 100644
index 00000000000..360f920cef6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestKindEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SupplyrequestKindEnumFactory implements EnumFactory {
+
+  public SupplyrequestKind fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("central".equals(codeString))
+      return SupplyrequestKind.CENTRAL;
+    if ("nonstock".equals(codeString))
+      return SupplyrequestKind.NONSTOCK;
+    throw new IllegalArgumentException("Unknown SupplyrequestKind code '"+codeString+"'");
+  }
+
+  public String toCode(SupplyrequestKind code) {
+    if (code == SupplyrequestKind.CENTRAL)
+      return "central";
+    if (code == SupplyrequestKind.NONSTOCK)
+      return "nonstock";
+    return "?";
+  }
+
+    public String toSystem(SupplyrequestKind code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestReason.java
new file mode 100644
index 00000000000..d1fa9dedfd8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestReason.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SupplyrequestReason {
+
+        /**
+         * The supply has been requested for use in direct patient care.
+         */
+        PATIENTCARE, 
+        /**
+         * The supply has been requested for for creating or replenishing ward stock.
+         */
+        WARDSTOCK, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SupplyrequestReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("patient-care".equals(codeString))
+          return PATIENTCARE;
+        if ("ward-stock".equals(codeString))
+          return WARDSTOCK;
+        throw new FHIRException("Unknown SupplyrequestReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PATIENTCARE: return "patient-care";
+            case WARDSTOCK: return "ward-stock";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/supplyrequest-reason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PATIENTCARE: return "The supply has been requested for use in direct patient care.";
+            case WARDSTOCK: return "The supply has been requested for for creating or replenishing ward stock.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PATIENTCARE: return "Patient Care";
+            case WARDSTOCK: return "Ward Stock";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestReasonEnumFactory.java
new file mode 100644
index 00000000000..e6dacfb9df3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestReasonEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SupplyrequestReasonEnumFactory implements EnumFactory {
+
+  public SupplyrequestReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("patient-care".equals(codeString))
+      return SupplyrequestReason.PATIENTCARE;
+    if ("ward-stock".equals(codeString))
+      return SupplyrequestReason.WARDSTOCK;
+    throw new IllegalArgumentException("Unknown SupplyrequestReason code '"+codeString+"'");
+  }
+
+  public String toCode(SupplyrequestReason code) {
+    if (code == SupplyrequestReason.PATIENTCARE)
+      return "patient-care";
+    if (code == SupplyrequestReason.WARDSTOCK)
+      return "ward-stock";
+    return "?";
+  }
+
+    public String toSystem(SupplyrequestReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestStatus.java
new file mode 100644
index 00000000000..38600e15c7e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SupplyrequestStatus {
+
+        /**
+         * The request has been created but is not yet complete or ready for action
+         */
+        DRAFT, 
+        /**
+         * The request is ready to be acted upon
+         */
+        ACTIVE, 
+        /**
+         * The authorization/request to act has been temporarily withdrawn but is expected to resume in the future
+         */
+        SUSPENDED, 
+        /**
+         * The authorization/request to act has been terminated prior to the full completion of the intended actions.  No further activity should occur.
+         */
+        CANCELLED, 
+        /**
+         * Activity against the request has been sufficiently completed to the satisfaction of the requester
+         */
+        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
+         */
+        NULL;
+        public static SupplyrequestStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown SupplyrequestStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case ACTIVE: return "active";
+            case SUSPENDED: return "suspended";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/supplyrequest-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "The request has been created but is not yet complete or ready for action";
+            case ACTIVE: return "The request is ready to be acted upon";
+            case SUSPENDED: return "The authorization/request to act has been temporarily withdrawn but is expected to resume in the future";
+            case CANCELLED: return "The authorization/request to act has been terminated prior to the full completion of the intended actions.  No further activity should occur.";
+            case COMPLETED: return "Activity against the request has been sufficiently completed to the satisfaction of the requester";
+            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 "Draft";
+            case ACTIVE: return "Active";
+            case SUSPENDED: return "Suspended";
+            case CANCELLED: return "Cancelled";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestStatusEnumFactory.java
new file mode 100644
index 00000000000..97125359898
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SupplyrequestStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SupplyrequestStatusEnumFactory implements EnumFactory {
+
+  public SupplyrequestStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return SupplyrequestStatus.DRAFT;
+    if ("active".equals(codeString))
+      return SupplyrequestStatus.ACTIVE;
+    if ("suspended".equals(codeString))
+      return SupplyrequestStatus.SUSPENDED;
+    if ("cancelled".equals(codeString))
+      return SupplyrequestStatus.CANCELLED;
+    if ("completed".equals(codeString))
+      return SupplyrequestStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return SupplyrequestStatus.ENTEREDINERROR;
+    if ("unknown".equals(codeString))
+      return SupplyrequestStatus.UNKNOWN;
+    throw new IllegalArgumentException("Unknown SupplyrequestStatus code '"+codeString+"'");
+  }
+
+  public String toCode(SupplyrequestStatus code) {
+    if (code == SupplyrequestStatus.DRAFT)
+      return "draft";
+    if (code == SupplyrequestStatus.ACTIVE)
+      return "active";
+    if (code == SupplyrequestStatus.SUSPENDED)
+      return "suspended";
+    if (code == SupplyrequestStatus.CANCELLED)
+      return "cancelled";
+    if (code == SupplyrequestStatus.COMPLETED)
+      return "completed";
+    if (code == SupplyrequestStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    if (code == SupplyrequestStatus.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(SupplyrequestStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Surface.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Surface.java
new file mode 100644
index 00000000000..cc6a95c8e55
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Surface.java
@@ -0,0 +1,168 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Surface {
+
+        /**
+         * The surface of a tooth that is closest to the midline (middle) of the face.
+         */
+        M, 
+        /**
+         * The chewing surface of posterior teeth.
+         */
+        O, 
+        /**
+         * The biting edge of anterior teeth.
+         */
+        I, 
+        /**
+         * The surface of a tooth that faces away from the midline of the face.
+         */
+        D, 
+        /**
+         * The surface of a posterior tooth facing the cheeks.
+         */
+        B, 
+        /**
+         * The surface of a tooth facing the lips.
+         */
+        V, 
+        /**
+         * The surface of a tooth facing the tongue.
+         */
+        L, 
+        /**
+         * The Mesioclusal surfaces of a tooth.
+         */
+        MO, 
+        /**
+         * The Distoclusal surfaces of a tooth.
+         */
+        DO, 
+        /**
+         * The Distoincisal surfaces of a tooth.
+         */
+        DI, 
+        /**
+         * The Mesioclusodistal surfaces of a tooth.
+         */
+        MOD, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Surface fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("M".equals(codeString))
+          return M;
+        if ("O".equals(codeString))
+          return O;
+        if ("I".equals(codeString))
+          return I;
+        if ("D".equals(codeString))
+          return D;
+        if ("B".equals(codeString))
+          return B;
+        if ("V".equals(codeString))
+          return V;
+        if ("L".equals(codeString))
+          return L;
+        if ("MO".equals(codeString))
+          return MO;
+        if ("DO".equals(codeString))
+          return DO;
+        if ("DI".equals(codeString))
+          return DI;
+        if ("MOD".equals(codeString))
+          return MOD;
+        throw new FHIRException("Unknown Surface code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case M: return "M";
+            case O: return "O";
+            case I: return "I";
+            case D: return "D";
+            case B: return "B";
+            case V: return "V";
+            case L: return "L";
+            case MO: return "MO";
+            case DO: return "DO";
+            case DI: return "DI";
+            case MOD: return "MOD";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/FDI-surface";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case M: return "The surface of a tooth that is closest to the midline (middle) of the face.";
+            case O: return "The chewing surface of posterior teeth.";
+            case I: return "The biting edge of anterior teeth.";
+            case D: return "The surface of a tooth that faces away from the midline of the face.";
+            case B: return "The surface of a posterior tooth facing the cheeks.";
+            case V: return "The surface of a tooth facing the lips.";
+            case L: return "The surface of a tooth facing the tongue.";
+            case MO: return "The Mesioclusal surfaces of a tooth.";
+            case DO: return "The Distoclusal surfaces of a tooth.";
+            case DI: return "The Distoincisal surfaces of a tooth.";
+            case MOD: return "The Mesioclusodistal surfaces of a tooth.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case M: return "Mesial";
+            case O: return "Occlusal";
+            case I: return "Incisal";
+            case D: return "Distal";
+            case B: return "Buccal";
+            case V: return "Ventral";
+            case L: return "Lingual";
+            case MO: return "Mesioclusal";
+            case DO: return "Distoclusal";
+            case DI: return "Distoincisal";
+            case MOD: return "Mesioclusodistal";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SurfaceEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SurfaceEnumFactory.java
new file mode 100644
index 00000000000..cd95749f639
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SurfaceEnumFactory.java
@@ -0,0 +1,98 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SurfaceEnumFactory implements EnumFactory {
+
+  public Surface fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("M".equals(codeString))
+      return Surface.M;
+    if ("O".equals(codeString))
+      return Surface.O;
+    if ("I".equals(codeString))
+      return Surface.I;
+    if ("D".equals(codeString))
+      return Surface.D;
+    if ("B".equals(codeString))
+      return Surface.B;
+    if ("V".equals(codeString))
+      return Surface.V;
+    if ("L".equals(codeString))
+      return Surface.L;
+    if ("MO".equals(codeString))
+      return Surface.MO;
+    if ("DO".equals(codeString))
+      return Surface.DO;
+    if ("DI".equals(codeString))
+      return Surface.DI;
+    if ("MOD".equals(codeString))
+      return Surface.MOD;
+    throw new IllegalArgumentException("Unknown Surface code '"+codeString+"'");
+  }
+
+  public String toCode(Surface code) {
+    if (code == Surface.M)
+      return "M";
+    if (code == Surface.O)
+      return "O";
+    if (code == Surface.I)
+      return "I";
+    if (code == Surface.D)
+      return "D";
+    if (code == Surface.B)
+      return "B";
+    if (code == Surface.V)
+      return "V";
+    if (code == Surface.L)
+      return "L";
+    if (code == Surface.MO)
+      return "MO";
+    if (code == Surface.DO)
+      return "DO";
+    if (code == Surface.DI)
+      return "DI";
+    if (code == Surface.MOD)
+      return "MOD";
+    return "?";
+  }
+
+    public String toSystem(Surface code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SystemVersionProcessingMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SystemVersionProcessingMode.java
new file mode 100644
index 00000000000..28367e2f686
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SystemVersionProcessingMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum SystemVersionProcessingMode {
+
+        /**
+         * Use this version of the code system if a value set doesn't specify a version
+         */
+        DEFAULT, 
+        /**
+         * Use this version of the code system. If a value set specifies a different version, the expansion operation should fail
+         */
+        CHECK, 
+        /**
+         * Use this version of the code system irrespective of which version is specified by a value set. Note that this has obvious safety issues, in that it may result in a value set expansion giving a different list of codes that is both wrong and unsafe, and implementers should only use this capability reluctantly. It primarily exists to deal with situations where specifications have fallen into decay as time passes. If a  version is override, the version used SHALL explicitly be represented in the expansion parameters
+         */
+        OVERRIDE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static SystemVersionProcessingMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("default".equals(codeString))
+          return DEFAULT;
+        if ("check".equals(codeString))
+          return CHECK;
+        if ("override".equals(codeString))
+          return OVERRIDE;
+        throw new FHIRException("Unknown SystemVersionProcessingMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DEFAULT: return "default";
+            case CHECK: return "check";
+            case OVERRIDE: return "override";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/system-version-processing-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DEFAULT: return "Use this version of the code system if a value set doesn't specify a version";
+            case CHECK: return "Use this version of the code system. If a value set specifies a different version, the expansion operation should fail";
+            case OVERRIDE: return "Use this version of the code system irrespective of which version is specified by a value set. Note that this has obvious safety issues, in that it may result in a value set expansion giving a different list of codes that is both wrong and unsafe, and implementers should only use this capability reluctantly. It primarily exists to deal with situations where specifications have fallen into decay as time passes. If a  version is override, the version used SHALL explicitly be represented in the expansion parameters";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DEFAULT: return "Default Version";
+            case CHECK: return "Check ValueSet Version";
+            case OVERRIDE: return "Override ValueSet Version";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SystemVersionProcessingModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SystemVersionProcessingModeEnumFactory.java
new file mode 100644
index 00000000000..b2e7a5426e2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/SystemVersionProcessingModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class SystemVersionProcessingModeEnumFactory implements EnumFactory {
+
+  public SystemVersionProcessingMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("default".equals(codeString))
+      return SystemVersionProcessingMode.DEFAULT;
+    if ("check".equals(codeString))
+      return SystemVersionProcessingMode.CHECK;
+    if ("override".equals(codeString))
+      return SystemVersionProcessingMode.OVERRIDE;
+    throw new IllegalArgumentException("Unknown SystemVersionProcessingMode code '"+codeString+"'");
+  }
+
+  public String toCode(SystemVersionProcessingMode code) {
+    if (code == SystemVersionProcessingMode.DEFAULT)
+      return "default";
+    if (code == SystemVersionProcessingMode.CHECK)
+      return "check";
+    if (code == SystemVersionProcessingMode.OVERRIDE)
+      return "override";
+    return "?";
+  }
+
+    public String toSystem(SystemVersionProcessingMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPerformerType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPerformerType.java
new file mode 100644
index 00000000000..de7cf1bde78
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPerformerType.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TaskPerformerType {
+
+        /**
+         * A workflow participant that requests services.
+         */
+        REQUESTER, 
+        /**
+         * A workflow participant that dispatches services (assigns another task to a participant).
+         */
+        DISPATCHER, 
+        /**
+         * A workflow participant that schedules (dispatches and sets the time or date for performance of) services.
+         */
+        SCHEDULER, 
+        /**
+         * A workflow participant that performs services.
+         */
+        PERFORMER, 
+        /**
+         * A workflow participant that monitors task activity.
+         */
+        MONITOR, 
+        /**
+         * A workflow participant that manages task activity.
+         */
+        MANAGER, 
+        /**
+         * A workflow participant that acquires resources (specimens, images, etc) necessary to perform the task.
+         */
+        ACQUIRER, 
+        /**
+         * A workflow participant that reviews task inputs or outputs.
+         */
+        REVIEWER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TaskPerformerType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("requester".equals(codeString))
+          return REQUESTER;
+        if ("dispatcher".equals(codeString))
+          return DISPATCHER;
+        if ("scheduler".equals(codeString))
+          return SCHEDULER;
+        if ("performer".equals(codeString))
+          return PERFORMER;
+        if ("monitor".equals(codeString))
+          return MONITOR;
+        if ("manager".equals(codeString))
+          return MANAGER;
+        if ("acquirer".equals(codeString))
+          return ACQUIRER;
+        if ("reviewer".equals(codeString))
+          return REVIEWER;
+        throw new FHIRException("Unknown TaskPerformerType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REQUESTER: return "requester";
+            case DISPATCHER: return "dispatcher";
+            case SCHEDULER: return "scheduler";
+            case PERFORMER: return "performer";
+            case MONITOR: return "monitor";
+            case MANAGER: return "manager";
+            case ACQUIRER: return "acquirer";
+            case REVIEWER: return "reviewer";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/task-performer-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REQUESTER: return "A workflow participant that requests services.";
+            case DISPATCHER: return "A workflow participant that dispatches services (assigns another task to a participant).";
+            case SCHEDULER: return "A workflow participant that schedules (dispatches and sets the time or date for performance of) services.";
+            case PERFORMER: return "A workflow participant that performs services.";
+            case MONITOR: return "A workflow participant that monitors task activity.";
+            case MANAGER: return "A workflow participant that manages task activity.";
+            case ACQUIRER: return "A workflow participant that acquires resources (specimens, images, etc) necessary to perform the task.";
+            case REVIEWER: return "A workflow participant that reviews task inputs or outputs.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REQUESTER: return "Requester";
+            case DISPATCHER: return "Dispatcher";
+            case SCHEDULER: return "Scheduler";
+            case PERFORMER: return "Performer";
+            case MONITOR: return "Monitor";
+            case MANAGER: return "Manager";
+            case ACQUIRER: return "Acquirer";
+            case REVIEWER: return "Reviewer";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPerformerTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPerformerTypeEnumFactory.java
new file mode 100644
index 00000000000..ecdce1088b8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPerformerTypeEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TaskPerformerTypeEnumFactory implements EnumFactory {
+
+  public TaskPerformerType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("requester".equals(codeString))
+      return TaskPerformerType.REQUESTER;
+    if ("dispatcher".equals(codeString))
+      return TaskPerformerType.DISPATCHER;
+    if ("scheduler".equals(codeString))
+      return TaskPerformerType.SCHEDULER;
+    if ("performer".equals(codeString))
+      return TaskPerformerType.PERFORMER;
+    if ("monitor".equals(codeString))
+      return TaskPerformerType.MONITOR;
+    if ("manager".equals(codeString))
+      return TaskPerformerType.MANAGER;
+    if ("acquirer".equals(codeString))
+      return TaskPerformerType.ACQUIRER;
+    if ("reviewer".equals(codeString))
+      return TaskPerformerType.REVIEWER;
+    throw new IllegalArgumentException("Unknown TaskPerformerType code '"+codeString+"'");
+  }
+
+  public String toCode(TaskPerformerType code) {
+    if (code == TaskPerformerType.REQUESTER)
+      return "requester";
+    if (code == TaskPerformerType.DISPATCHER)
+      return "dispatcher";
+    if (code == TaskPerformerType.SCHEDULER)
+      return "scheduler";
+    if (code == TaskPerformerType.PERFORMER)
+      return "performer";
+    if (code == TaskPerformerType.MONITOR)
+      return "monitor";
+    if (code == TaskPerformerType.MANAGER)
+      return "manager";
+    if (code == TaskPerformerType.ACQUIRER)
+      return "acquirer";
+    if (code == TaskPerformerType.REVIEWER)
+      return "reviewer";
+    return "?";
+  }
+
+    public String toSystem(TaskPerformerType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPriority.java
new file mode 100644
index 00000000000..f605703e532
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPriority.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TaskPriority {
+
+        /**
+         * This task has low priority.
+         */
+        LOW, 
+        /**
+         * This task has normal priority.
+         */
+        NORMAL, 
+        /**
+         * This task has high priority.
+         */
+        HIGH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TaskPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("low".equals(codeString))
+          return LOW;
+        if ("normal".equals(codeString))
+          return NORMAL;
+        if ("high".equals(codeString))
+          return HIGH;
+        throw new FHIRException("Unknown TaskPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LOW: return "low";
+            case NORMAL: return "normal";
+            case HIGH: return "high";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/task-priority";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LOW: return "This task has low priority.";
+            case NORMAL: return "This task has normal priority.";
+            case HIGH: return "This task has high priority.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LOW: return "Low";
+            case NORMAL: return "Normal";
+            case HIGH: return "High";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPriorityEnumFactory.java
new file mode 100644
index 00000000000..ff95150ab80
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskPriorityEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TaskPriorityEnumFactory implements EnumFactory {
+
+  public TaskPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("low".equals(codeString))
+      return TaskPriority.LOW;
+    if ("normal".equals(codeString))
+      return TaskPriority.NORMAL;
+    if ("high".equals(codeString))
+      return TaskPriority.HIGH;
+    throw new IllegalArgumentException("Unknown TaskPriority code '"+codeString+"'");
+  }
+
+  public String toCode(TaskPriority code) {
+    if (code == TaskPriority.LOW)
+      return "low";
+    if (code == TaskPriority.NORMAL)
+      return "normal";
+    if (code == TaskPriority.HIGH)
+      return "high";
+    return "?";
+  }
+
+    public String toSystem(TaskPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStage.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStage.java
new file mode 100644
index 00000000000..2f8f6b872da
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStage.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TaskStage {
+
+        /**
+         * The request is a recommendation or suggestion where there has not yet been any commitment to action
+         */
+        PROPOSAL, 
+        /**
+         * The request has a specific intention to be performed and may be scheduled but is not yet authorized to be performed
+         */
+        PLANNED, 
+        /**
+         * Indicates that the task is authorized and ready to be actioned
+         */
+        ACTIONABLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TaskStage fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("proposal".equals(codeString))
+          return PROPOSAL;
+        if ("planned".equals(codeString))
+          return PLANNED;
+        if ("actionable".equals(codeString))
+          return ACTIONABLE;
+        throw new FHIRException("Unknown TaskStage code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PROPOSAL: return "proposal";
+            case PLANNED: return "planned";
+            case ACTIONABLE: return "actionable";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/task-stage";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PROPOSAL: return "The request is a recommendation or suggestion where there has not yet been any commitment to action";
+            case PLANNED: return "The request has a specific intention to be performed and may be scheduled but is not yet authorized to be performed";
+            case ACTIONABLE: return "Indicates that the task is authorized and ready to be actioned";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PROPOSAL: return "proposal";
+            case PLANNED: return "planned";
+            case ACTIONABLE: return "actionable";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStageEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStageEnumFactory.java
new file mode 100644
index 00000000000..64cf118d94f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStageEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TaskStageEnumFactory implements EnumFactory {
+
+  public TaskStage fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("proposal".equals(codeString))
+      return TaskStage.PROPOSAL;
+    if ("planned".equals(codeString))
+      return TaskStage.PLANNED;
+    if ("actionable".equals(codeString))
+      return TaskStage.ACTIONABLE;
+    throw new IllegalArgumentException("Unknown TaskStage code '"+codeString+"'");
+  }
+
+  public String toCode(TaskStage code) {
+    if (code == TaskStage.PROPOSAL)
+      return "proposal";
+    if (code == TaskStage.PLANNED)
+      return "planned";
+    if (code == TaskStage.ACTIONABLE)
+      return "actionable";
+    return "?";
+  }
+
+    public String toSystem(TaskStage code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStatus.java
new file mode 100644
index 00000000000..0f5da55d543
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStatus.java
@@ -0,0 +1,177 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TaskStatus {
+
+        /**
+         * The task is not yet ready to be acted upon.
+         */
+        DRAFT, 
+        /**
+         * The task is ready to be acted upon and action is sought.
+         */
+        REQUESTED, 
+        /**
+         * A potential performer has claimed ownership of the task and is evaluating whether to perform it.
+         */
+        RECEIVED, 
+        /**
+         * The potential performer has agreed to execute the task but has not yet started work.
+         */
+        ACCEPTED, 
+        /**
+         * The potential performer who claimed ownership of the task has decided not to execute it prior to performing any action.
+         */
+        REJECTED, 
+        /**
+         * Task is ready to be performed, but no action has yet been taken.  Used in place of requested/received/accepted/rejected when request assignment and acceptance is a given.
+         */
+        READY, 
+        /**
+         * The task was not completed.
+         */
+        CANCELLED, 
+        /**
+         * Task has been started but is not yet complete.
+         */
+        INPROGRESS, 
+        /**
+         * Task has been started but work has been paused.
+         */
+        ONHOLD, 
+        /**
+         * The task was attempted but could not be completed due to some error.
+         */
+        FAILED, 
+        /**
+         * The task has been completed.
+         */
+        COMPLETED, 
+        /**
+         * The task should never have existed and is retained only because of the possibility it may have used.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TaskStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("requested".equals(codeString))
+          return REQUESTED;
+        if ("received".equals(codeString))
+          return RECEIVED;
+        if ("accepted".equals(codeString))
+          return ACCEPTED;
+        if ("rejected".equals(codeString))
+          return REJECTED;
+        if ("ready".equals(codeString))
+          return READY;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("in-progress".equals(codeString))
+          return INPROGRESS;
+        if ("on-hold".equals(codeString))
+          return ONHOLD;
+        if ("failed".equals(codeString))
+          return FAILED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown TaskStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DRAFT: return "draft";
+            case REQUESTED: return "requested";
+            case RECEIVED: return "received";
+            case ACCEPTED: return "accepted";
+            case REJECTED: return "rejected";
+            case READY: return "ready";
+            case CANCELLED: return "cancelled";
+            case INPROGRESS: return "in-progress";
+            case ONHOLD: return "on-hold";
+            case FAILED: return "failed";
+            case COMPLETED: return "completed";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/task-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DRAFT: return "The task is not yet ready to be acted upon.";
+            case REQUESTED: return "The task is ready to be acted upon and action is sought.";
+            case RECEIVED: return "A potential performer has claimed ownership of the task and is evaluating whether to perform it.";
+            case ACCEPTED: return "The potential performer has agreed to execute the task but has not yet started work.";
+            case REJECTED: return "The potential performer who claimed ownership of the task has decided not to execute it prior to performing any action.";
+            case READY: return "Task is ready to be performed, but no action has yet been taken.  Used in place of requested/received/accepted/rejected when request assignment and acceptance is a given.";
+            case CANCELLED: return "The task was not completed.";
+            case INPROGRESS: return "Task has been started but is not yet complete.";
+            case ONHOLD: return "Task has been started but work has been paused.";
+            case FAILED: return "The task was attempted but could not be completed due to some error.";
+            case COMPLETED: return "The task has been completed.";
+            case ENTEREDINERROR: return "The task should never have existed and is retained only because of the possibility it may have used.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DRAFT: return "Draft";
+            case REQUESTED: return "Requested";
+            case RECEIVED: return "Received";
+            case ACCEPTED: return "Accepted";
+            case REJECTED: return "Rejected";
+            case READY: return "Ready";
+            case CANCELLED: return "Cancelled";
+            case INPROGRESS: return "In Progress";
+            case ONHOLD: return "On Hold";
+            case FAILED: return "Failed";
+            case COMPLETED: return "Completed";
+            case ENTEREDINERROR: return "Entered in Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStatusEnumFactory.java
new file mode 100644
index 00000000000..86c931d36c8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TaskStatusEnumFactory.java
@@ -0,0 +1,102 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TaskStatusEnumFactory implements EnumFactory {
+
+  public TaskStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("draft".equals(codeString))
+      return TaskStatus.DRAFT;
+    if ("requested".equals(codeString))
+      return TaskStatus.REQUESTED;
+    if ("received".equals(codeString))
+      return TaskStatus.RECEIVED;
+    if ("accepted".equals(codeString))
+      return TaskStatus.ACCEPTED;
+    if ("rejected".equals(codeString))
+      return TaskStatus.REJECTED;
+    if ("ready".equals(codeString))
+      return TaskStatus.READY;
+    if ("cancelled".equals(codeString))
+      return TaskStatus.CANCELLED;
+    if ("in-progress".equals(codeString))
+      return TaskStatus.INPROGRESS;
+    if ("on-hold".equals(codeString))
+      return TaskStatus.ONHOLD;
+    if ("failed".equals(codeString))
+      return TaskStatus.FAILED;
+    if ("completed".equals(codeString))
+      return TaskStatus.COMPLETED;
+    if ("entered-in-error".equals(codeString))
+      return TaskStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown TaskStatus code '"+codeString+"'");
+  }
+
+  public String toCode(TaskStatus code) {
+    if (code == TaskStatus.DRAFT)
+      return "draft";
+    if (code == TaskStatus.REQUESTED)
+      return "requested";
+    if (code == TaskStatus.RECEIVED)
+      return "received";
+    if (code == TaskStatus.ACCEPTED)
+      return "accepted";
+    if (code == TaskStatus.REJECTED)
+      return "rejected";
+    if (code == TaskStatus.READY)
+      return "ready";
+    if (code == TaskStatus.CANCELLED)
+      return "cancelled";
+    if (code == TaskStatus.INPROGRESS)
+      return "in-progress";
+    if (code == TaskStatus.ONHOLD)
+      return "on-hold";
+    if (code == TaskStatus.FAILED)
+      return "failed";
+    if (code == TaskStatus.COMPLETED)
+      return "completed";
+    if (code == TaskStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(TaskStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Teeth.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Teeth.java
new file mode 100644
index 00000000000..e9b056e6b80
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Teeth.java
@@ -0,0 +1,357 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Teeth {
+
+        /**
+         * Upper Right Tooth 1 from the central axis, permanent dentition.
+         */
+        _11, 
+        /**
+         * Upper Right Tooth 2 from the central axis, permanent dentition.
+         */
+        _12, 
+        /**
+         * Upper Right Tooth 3 from the central axis, permanent dentition.
+         */
+        _13, 
+        /**
+         * Upper Right Tooth 4 from the central axis, permanent dentition.
+         */
+        _14, 
+        /**
+         * Upper Right Tooth 5 from the central axis, permanent dentition.
+         */
+        _15, 
+        /**
+         * Upper Right Tooth 6 from the central axis, permanent dentition.
+         */
+        _16, 
+        /**
+         * Upper Right Tooth 7 from the central axis, permanent dentition.
+         */
+        _17, 
+        /**
+         * Upper Right Tooth 8 from the central axis, permanent dentition.
+         */
+        _18, 
+        /**
+         * Upper Left Tooth 1 from the central axis, permanent dentition.
+         */
+        _21, 
+        /**
+         * Upper Left Tooth 2 from the central axis, permanent dentition.
+         */
+        _22, 
+        /**
+         * Upper Left Tooth 3 from the central axis, permanent dentition.
+         */
+        _23, 
+        /**
+         * Upper Left Tooth 4 from the central axis, permanent dentition.
+         */
+        _24, 
+        /**
+         * Upper Left Tooth 5 from the central axis, permanent dentition.
+         */
+        _25, 
+        /**
+         * Upper Left Tooth 6 from the central axis, permanent dentition.
+         */
+        _26, 
+        /**
+         * Upper Left Tooth 7 from the central axis, permanent dentition.
+         */
+        _27, 
+        /**
+         * Upper Left Tooth 8 from the central axis, permanent dentition.
+         */
+        _28, 
+        /**
+         * Lower Left Tooth 1 from the central axis, permanent dentition.
+         */
+        _31, 
+        /**
+         * Lower Left Tooth 2 from the central axis, permanent dentition.
+         */
+        _32, 
+        /**
+         * Lower Left Tooth 3 from the central axis, permanent dentition.
+         */
+        _33, 
+        /**
+         * Lower Left Tooth 4 from the central axis, permanent dentition.
+         */
+        _34, 
+        /**
+         * Lower Left Tooth 5 from the central axis, permanent dentition.
+         */
+        _35, 
+        /**
+         * Lower Left Tooth 6 from the central axis, permanent dentition.
+         */
+        _36, 
+        /**
+         * Lower Left Tooth 7 from the central axis, permanent dentition.
+         */
+        _37, 
+        /**
+         * Lower Left Tooth 8 from the central axis, permanent dentition.
+         */
+        _38, 
+        /**
+         * Lower Right Tooth 1 from the central axis, permanent dentition.
+         */
+        _41, 
+        /**
+         * Lower Right Tooth 2 from the central axis, permanent dentition.
+         */
+        _42, 
+        /**
+         * Lower Right Tooth 3 from the central axis, permanent dentition.
+         */
+        _43, 
+        /**
+         * Lower Right Tooth 4 from the central axis, permanent dentition.
+         */
+        _44, 
+        /**
+         * Lower Right Tooth 5 from the central axis, permanent dentition.
+         */
+        _45, 
+        /**
+         * Lower Right Tooth 6 from the central axis, permanent dentition.
+         */
+        _46, 
+        /**
+         * Lower Right Tooth 7 from the central axis, permanent dentition.
+         */
+        _47, 
+        /**
+         * Lower Right Tooth 8 from the central axis, permanent dentition.
+         */
+        _48, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Teeth fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        if ("16".equals(codeString))
+          return _16;
+        if ("17".equals(codeString))
+          return _17;
+        if ("18".equals(codeString))
+          return _18;
+        if ("21".equals(codeString))
+          return _21;
+        if ("22".equals(codeString))
+          return _22;
+        if ("23".equals(codeString))
+          return _23;
+        if ("24".equals(codeString))
+          return _24;
+        if ("25".equals(codeString))
+          return _25;
+        if ("26".equals(codeString))
+          return _26;
+        if ("27".equals(codeString))
+          return _27;
+        if ("28".equals(codeString))
+          return _28;
+        if ("31".equals(codeString))
+          return _31;
+        if ("32".equals(codeString))
+          return _32;
+        if ("33".equals(codeString))
+          return _33;
+        if ("34".equals(codeString))
+          return _34;
+        if ("35".equals(codeString))
+          return _35;
+        if ("36".equals(codeString))
+          return _36;
+        if ("37".equals(codeString))
+          return _37;
+        if ("38".equals(codeString))
+          return _38;
+        if ("41".equals(codeString))
+          return _41;
+        if ("42".equals(codeString))
+          return _42;
+        if ("43".equals(codeString))
+          return _43;
+        if ("44".equals(codeString))
+          return _44;
+        if ("45".equals(codeString))
+          return _45;
+        if ("46".equals(codeString))
+          return _46;
+        if ("47".equals(codeString))
+          return _47;
+        if ("48".equals(codeString))
+          return _48;
+        throw new FHIRException("Unknown Teeth code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            case _16: return "16";
+            case _17: return "17";
+            case _18: return "18";
+            case _21: return "21";
+            case _22: return "22";
+            case _23: return "23";
+            case _24: return "24";
+            case _25: return "25";
+            case _26: return "26";
+            case _27: return "27";
+            case _28: return "28";
+            case _31: return "31";
+            case _32: return "32";
+            case _33: return "33";
+            case _34: return "34";
+            case _35: return "35";
+            case _36: return "36";
+            case _37: return "37";
+            case _38: return "38";
+            case _41: return "41";
+            case _42: return "42";
+            case _43: return "43";
+            case _44: return "44";
+            case _45: return "45";
+            case _46: return "46";
+            case _47: return "47";
+            case _48: return "48";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-fdi";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _11: return "Upper Right Tooth 1 from the central axis, permanent dentition.";
+            case _12: return "Upper Right Tooth 2 from the central axis, permanent dentition.";
+            case _13: return "Upper Right Tooth 3 from the central axis, permanent dentition.";
+            case _14: return "Upper Right Tooth 4 from the central axis, permanent dentition.";
+            case _15: return "Upper Right Tooth 5 from the central axis, permanent dentition.";
+            case _16: return "Upper Right Tooth 6 from the central axis, permanent dentition.";
+            case _17: return "Upper Right Tooth 7 from the central axis, permanent dentition.";
+            case _18: return "Upper Right Tooth 8 from the central axis, permanent dentition.";
+            case _21: return "Upper Left Tooth 1 from the central axis, permanent dentition.";
+            case _22: return "Upper Left Tooth 2 from the central axis, permanent dentition.";
+            case _23: return "Upper Left Tooth 3 from the central axis, permanent dentition.";
+            case _24: return "Upper Left Tooth 4 from the central axis, permanent dentition.";
+            case _25: return "Upper Left Tooth 5 from the central axis, permanent dentition.";
+            case _26: return "Upper Left Tooth 6 from the central axis, permanent dentition.";
+            case _27: return "Upper Left Tooth 7 from the central axis, permanent dentition.";
+            case _28: return "Upper Left Tooth 8 from the central axis, permanent dentition.";
+            case _31: return "Lower Left Tooth 1 from the central axis, permanent dentition.";
+            case _32: return "Lower Left Tooth 2 from the central axis, permanent dentition.";
+            case _33: return "Lower Left Tooth 3 from the central axis, permanent dentition.";
+            case _34: return "Lower Left Tooth 4 from the central axis, permanent dentition.";
+            case _35: return "Lower Left Tooth 5 from the central axis, permanent dentition.";
+            case _36: return "Lower Left Tooth 6 from the central axis, permanent dentition.";
+            case _37: return "Lower Left Tooth 7 from the central axis, permanent dentition.";
+            case _38: return "Lower Left Tooth 8 from the central axis, permanent dentition.";
+            case _41: return "Lower Right Tooth 1 from the central axis, permanent dentition.";
+            case _42: return "Lower Right Tooth 2 from the central axis, permanent dentition.";
+            case _43: return "Lower Right Tooth 3 from the central axis, permanent dentition.";
+            case _44: return "Lower Right Tooth 4 from the central axis, permanent dentition.";
+            case _45: return "Lower Right Tooth 5 from the central axis, permanent dentition.";
+            case _46: return "Lower Right Tooth 6 from the central axis, permanent dentition.";
+            case _47: return "Lower Right Tooth 7 from the central axis, permanent dentition.";
+            case _48: return "Lower Right Tooth 8 from the central axis, permanent dentition.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            case _16: return "16";
+            case _17: return "17";
+            case _18: return "18";
+            case _21: return "21";
+            case _22: return "22";
+            case _23: return "23";
+            case _24: return "24";
+            case _25: return "25";
+            case _26: return "26";
+            case _27: return "27";
+            case _28: return "28";
+            case _31: return "31";
+            case _32: return "32";
+            case _33: return "33";
+            case _34: return "34";
+            case _35: return "35";
+            case _36: return "36";
+            case _37: return "37";
+            case _38: return "38";
+            case _41: return "41";
+            case _42: return "42";
+            case _43: return "43";
+            case _44: return "44";
+            case _45: return "45";
+            case _46: return "46";
+            case _47: return "47";
+            case _48: return "48";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TeethEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TeethEnumFactory.java
new file mode 100644
index 00000000000..11399034040
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TeethEnumFactory.java
@@ -0,0 +1,182 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TeethEnumFactory implements EnumFactory {
+
+  public Teeth fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("11".equals(codeString))
+      return Teeth._11;
+    if ("12".equals(codeString))
+      return Teeth._12;
+    if ("13".equals(codeString))
+      return Teeth._13;
+    if ("14".equals(codeString))
+      return Teeth._14;
+    if ("15".equals(codeString))
+      return Teeth._15;
+    if ("16".equals(codeString))
+      return Teeth._16;
+    if ("17".equals(codeString))
+      return Teeth._17;
+    if ("18".equals(codeString))
+      return Teeth._18;
+    if ("21".equals(codeString))
+      return Teeth._21;
+    if ("22".equals(codeString))
+      return Teeth._22;
+    if ("23".equals(codeString))
+      return Teeth._23;
+    if ("24".equals(codeString))
+      return Teeth._24;
+    if ("25".equals(codeString))
+      return Teeth._25;
+    if ("26".equals(codeString))
+      return Teeth._26;
+    if ("27".equals(codeString))
+      return Teeth._27;
+    if ("28".equals(codeString))
+      return Teeth._28;
+    if ("31".equals(codeString))
+      return Teeth._31;
+    if ("32".equals(codeString))
+      return Teeth._32;
+    if ("33".equals(codeString))
+      return Teeth._33;
+    if ("34".equals(codeString))
+      return Teeth._34;
+    if ("35".equals(codeString))
+      return Teeth._35;
+    if ("36".equals(codeString))
+      return Teeth._36;
+    if ("37".equals(codeString))
+      return Teeth._37;
+    if ("38".equals(codeString))
+      return Teeth._38;
+    if ("41".equals(codeString))
+      return Teeth._41;
+    if ("42".equals(codeString))
+      return Teeth._42;
+    if ("43".equals(codeString))
+      return Teeth._43;
+    if ("44".equals(codeString))
+      return Teeth._44;
+    if ("45".equals(codeString))
+      return Teeth._45;
+    if ("46".equals(codeString))
+      return Teeth._46;
+    if ("47".equals(codeString))
+      return Teeth._47;
+    if ("48".equals(codeString))
+      return Teeth._48;
+    throw new IllegalArgumentException("Unknown Teeth code '"+codeString+"'");
+  }
+
+  public String toCode(Teeth code) {
+    if (code == Teeth._11)
+      return "11";
+    if (code == Teeth._12)
+      return "12";
+    if (code == Teeth._13)
+      return "13";
+    if (code == Teeth._14)
+      return "14";
+    if (code == Teeth._15)
+      return "15";
+    if (code == Teeth._16)
+      return "16";
+    if (code == Teeth._17)
+      return "17";
+    if (code == Teeth._18)
+      return "18";
+    if (code == Teeth._21)
+      return "21";
+    if (code == Teeth._22)
+      return "22";
+    if (code == Teeth._23)
+      return "23";
+    if (code == Teeth._24)
+      return "24";
+    if (code == Teeth._25)
+      return "25";
+    if (code == Teeth._26)
+      return "26";
+    if (code == Teeth._27)
+      return "27";
+    if (code == Teeth._28)
+      return "28";
+    if (code == Teeth._31)
+      return "31";
+    if (code == Teeth._32)
+      return "32";
+    if (code == Teeth._33)
+      return "33";
+    if (code == Teeth._34)
+      return "34";
+    if (code == Teeth._35)
+      return "35";
+    if (code == Teeth._36)
+      return "36";
+    if (code == Teeth._37)
+      return "37";
+    if (code == Teeth._38)
+      return "38";
+    if (code == Teeth._41)
+      return "41";
+    if (code == Teeth._42)
+      return "42";
+    if (code == Teeth._43)
+      return "43";
+    if (code == Teeth._44)
+      return "44";
+    if (code == Teeth._45)
+      return "45";
+    if (code == Teeth._46)
+      return "46";
+    if (code == Teeth._47)
+      return "47";
+    if (code == Teeth._48)
+      return "48";
+    return "?";
+  }
+
+    public String toSystem(Teeth code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptOperationCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptOperationCodes.java
new file mode 100644
index 00000000000..d3ee1bfc364
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptOperationCodes.java
@@ -0,0 +1,546 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TestscriptOperationCodes {
+
+        /**
+         * Read the current state of the resource.
+         */
+        READ, 
+        /**
+         * Read the state of a specific version of the resource.
+         */
+        VREAD, 
+        /**
+         * Update an existing resource by its id.
+         */
+        UPDATE, 
+        /**
+         * Update an existing resource by its id (or create it if it is new).
+         */
+        UPDATECREATE, 
+        /**
+         * Delete a resource.
+         */
+        DELETE, 
+        /**
+         * Conditionally delete a single resource based on search parameters.
+         */
+        DELETECONDSINGLE, 
+        /**
+         * Conditionally delete one or more resources based on search parameters.
+         */
+        DELETECONDMULTIPLE, 
+        /**
+         * Retrieve the change history for a particular resource or resource type.
+         */
+        HISTORY, 
+        /**
+         * Create a new resource with a server assigned id.
+         */
+        CREATE, 
+        /**
+         * Search based on some filter criteria.
+         */
+        SEARCH, 
+        /**
+         * Update, create or delete a set of resources as independent actions.
+         */
+        BATCH, 
+        /**
+         * Update, create or delete a set of resources as a single transaction.
+         */
+        TRANSACTION, 
+        /**
+         * Get a capability statement for the system.
+         */
+        CAPABILITIES, 
+        /**
+         * Realize a definition in a specific context
+         */
+        APPLY, 
+        /**
+         * Cancel Task
+         */
+        CANCEL, 
+        /**
+         * Closure Table Maintenance
+         */
+        CLOSURE, 
+        /**
+         * Code Composition based on supplied properties
+         */
+        COMPOSE, 
+        /**
+         * Test if a server implements a client's required operations
+         */
+        CONFORMS, 
+        /**
+         * Aggregates and return the parameters and data requirements as a single module definition library
+         */
+        DATAREQUIREMENTS, 
+        /**
+         * Generate a Document
+         */
+        DOCUMENT, 
+        /**
+         * Evaluate DecisionSupportRule / DecisionSupportServiceModule
+         */
+        EVALUATE, 
+        /**
+         * Evaluate Measure
+         */
+        EVALUATEMEASURE, 
+        /**
+         * Fetch Encounter/Patient Record
+         */
+        EVERYTHING, 
+        /**
+         * Value Set Expansion
+         */
+        EXPAND, 
+        /**
+         * Fail Task
+         */
+        FAIL, 
+        /**
+         * Find a functional list
+         */
+        FIND, 
+        /**
+         * Finish Task
+         */
+        FINISH, 
+        /**
+         * Test if a server implements a client's required operations
+         */
+        IMPLEMENTS, 
+        /**
+         * Concept Look Up
+         */
+        LOOKUP, 
+        /**
+         * Find patient matches using MPI based logic
+         */
+        MATCH, 
+        /**
+         * Access a list of profiles, tags, and security labels
+         */
+        META, 
+        /**
+         * Add profiles, tags, and security labels to a resource
+         */
+        METAADD, 
+        /**
+         * Delete profiles, tags, and security labels for a resource
+         */
+        METADELETE, 
+        /**
+         * Populate Questionnaire
+         */
+        POPULATE, 
+        /**
+         * Generate HTML for Questionnaire
+         */
+        POPULATEHTML, 
+        /**
+         * Generate a link to a Questionnaire completion webpage
+         */
+        POPULATELINK, 
+        /**
+         * Process Message
+         */
+        PROCESSMESSAGE, 
+        /**
+         * Build Questionnaire
+         */
+        QUESTIONNAIRE, 
+        /**
+         * Release Task
+         */
+        RELEASE, 
+        /**
+         * Reserve Task
+         */
+        RESERVE, 
+        /**
+         * Resume Task
+         */
+        RESUME, 
+        /**
+         * Set Task Input
+         */
+        SETINPUT, 
+        /**
+         * Set Task Output
+         */
+        SETOUTPUT, 
+        /**
+         * Start Task
+         */
+        START, 
+        /**
+         * Observation Statistics
+         */
+        STATS, 
+        /**
+         * Stop Task
+         */
+        STOP, 
+        /**
+         * Fetch a subset of the CapabilityStatement resource
+         */
+        SUBSET, 
+        /**
+         * Determine if code A is subsumed by code B
+         */
+        SUBSUMES, 
+        /**
+         * Suspend Task
+         */
+        SUSPEND, 
+        /**
+         * Model Instance Transformation
+         */
+        TRANSFORM, 
+        /**
+         * Concept Translation
+         */
+        TRANSLATE, 
+        /**
+         * Validate a resource
+         */
+        VALIDATE, 
+        /**
+         * Value Set based Validation
+         */
+        VALIDATECODE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TestscriptOperationCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("read".equals(codeString))
+          return READ;
+        if ("vread".equals(codeString))
+          return VREAD;
+        if ("update".equals(codeString))
+          return UPDATE;
+        if ("updateCreate".equals(codeString))
+          return UPDATECREATE;
+        if ("delete".equals(codeString))
+          return DELETE;
+        if ("deleteCondSingle".equals(codeString))
+          return DELETECONDSINGLE;
+        if ("deleteCondMultiple".equals(codeString))
+          return DELETECONDMULTIPLE;
+        if ("history".equals(codeString))
+          return HISTORY;
+        if ("create".equals(codeString))
+          return CREATE;
+        if ("search".equals(codeString))
+          return SEARCH;
+        if ("batch".equals(codeString))
+          return BATCH;
+        if ("transaction".equals(codeString))
+          return TRANSACTION;
+        if ("capabilities".equals(codeString))
+          return CAPABILITIES;
+        if ("apply".equals(codeString))
+          return APPLY;
+        if ("cancel".equals(codeString))
+          return CANCEL;
+        if ("closure".equals(codeString))
+          return CLOSURE;
+        if ("compose".equals(codeString))
+          return COMPOSE;
+        if ("conforms".equals(codeString))
+          return CONFORMS;
+        if ("data-requirements".equals(codeString))
+          return DATAREQUIREMENTS;
+        if ("document".equals(codeString))
+          return DOCUMENT;
+        if ("evaluate".equals(codeString))
+          return EVALUATE;
+        if ("evaluate-measure".equals(codeString))
+          return EVALUATEMEASURE;
+        if ("everything".equals(codeString))
+          return EVERYTHING;
+        if ("expand".equals(codeString))
+          return EXPAND;
+        if ("fail".equals(codeString))
+          return FAIL;
+        if ("find".equals(codeString))
+          return FIND;
+        if ("finish".equals(codeString))
+          return FINISH;
+        if ("implements".equals(codeString))
+          return IMPLEMENTS;
+        if ("lookup".equals(codeString))
+          return LOOKUP;
+        if ("match".equals(codeString))
+          return MATCH;
+        if ("meta".equals(codeString))
+          return META;
+        if ("meta-add".equals(codeString))
+          return METAADD;
+        if ("meta-delete".equals(codeString))
+          return METADELETE;
+        if ("populate".equals(codeString))
+          return POPULATE;
+        if ("populatehtml".equals(codeString))
+          return POPULATEHTML;
+        if ("populatelink".equals(codeString))
+          return POPULATELINK;
+        if ("process-message".equals(codeString))
+          return PROCESSMESSAGE;
+        if ("questionnaire".equals(codeString))
+          return QUESTIONNAIRE;
+        if ("release".equals(codeString))
+          return RELEASE;
+        if ("reserve".equals(codeString))
+          return RESERVE;
+        if ("resume".equals(codeString))
+          return RESUME;
+        if ("set-input".equals(codeString))
+          return SETINPUT;
+        if ("set-output".equals(codeString))
+          return SETOUTPUT;
+        if ("start".equals(codeString))
+          return START;
+        if ("stats".equals(codeString))
+          return STATS;
+        if ("stop".equals(codeString))
+          return STOP;
+        if ("subset".equals(codeString))
+          return SUBSET;
+        if ("subsumes".equals(codeString))
+          return SUBSUMES;
+        if ("suspend".equals(codeString))
+          return SUSPEND;
+        if ("transform".equals(codeString))
+          return TRANSFORM;
+        if ("translate".equals(codeString))
+          return TRANSLATE;
+        if ("validate".equals(codeString))
+          return VALIDATE;
+        if ("validate-code".equals(codeString))
+          return VALIDATECODE;
+        throw new FHIRException("Unknown TestscriptOperationCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case READ: return "read";
+            case VREAD: return "vread";
+            case UPDATE: return "update";
+            case UPDATECREATE: return "updateCreate";
+            case DELETE: return "delete";
+            case DELETECONDSINGLE: return "deleteCondSingle";
+            case DELETECONDMULTIPLE: return "deleteCondMultiple";
+            case HISTORY: return "history";
+            case CREATE: return "create";
+            case SEARCH: return "search";
+            case BATCH: return "batch";
+            case TRANSACTION: return "transaction";
+            case CAPABILITIES: return "capabilities";
+            case APPLY: return "apply";
+            case CANCEL: return "cancel";
+            case CLOSURE: return "closure";
+            case COMPOSE: return "compose";
+            case CONFORMS: return "conforms";
+            case DATAREQUIREMENTS: return "data-requirements";
+            case DOCUMENT: return "document";
+            case EVALUATE: return "evaluate";
+            case EVALUATEMEASURE: return "evaluate-measure";
+            case EVERYTHING: return "everything";
+            case EXPAND: return "expand";
+            case FAIL: return "fail";
+            case FIND: return "find";
+            case FINISH: return "finish";
+            case IMPLEMENTS: return "implements";
+            case LOOKUP: return "lookup";
+            case MATCH: return "match";
+            case META: return "meta";
+            case METAADD: return "meta-add";
+            case METADELETE: return "meta-delete";
+            case POPULATE: return "populate";
+            case POPULATEHTML: return "populatehtml";
+            case POPULATELINK: return "populatelink";
+            case PROCESSMESSAGE: return "process-message";
+            case QUESTIONNAIRE: return "questionnaire";
+            case RELEASE: return "release";
+            case RESERVE: return "reserve";
+            case RESUME: return "resume";
+            case SETINPUT: return "set-input";
+            case SETOUTPUT: return "set-output";
+            case START: return "start";
+            case STATS: return "stats";
+            case STOP: return "stop";
+            case SUBSET: return "subset";
+            case SUBSUMES: return "subsumes";
+            case SUSPEND: return "suspend";
+            case TRANSFORM: return "transform";
+            case TRANSLATE: return "translate";
+            case VALIDATE: return "validate";
+            case VALIDATECODE: return "validate-code";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/testscript-operation-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case READ: return "Read the current state of the resource.";
+            case VREAD: return "Read the state of a specific version of the resource.";
+            case UPDATE: return "Update an existing resource by its id.";
+            case UPDATECREATE: return "Update an existing resource by its id (or create it if it is new).";
+            case DELETE: return "Delete a resource.";
+            case DELETECONDSINGLE: return "Conditionally delete a single resource based on search parameters.";
+            case DELETECONDMULTIPLE: return "Conditionally delete one or more resources based on search parameters.";
+            case HISTORY: return "Retrieve the change history for a particular resource or resource type.";
+            case CREATE: return "Create a new resource with a server assigned id.";
+            case SEARCH: return "Search based on some filter criteria.";
+            case BATCH: return "Update, create or delete a set of resources as independent actions.";
+            case TRANSACTION: return "Update, create or delete a set of resources as a single transaction.";
+            case CAPABILITIES: return "Get a capability statement for the system.";
+            case APPLY: return "Realize a definition in a specific context";
+            case CANCEL: return "Cancel Task";
+            case CLOSURE: return "Closure Table Maintenance";
+            case COMPOSE: return "Code Composition based on supplied properties";
+            case CONFORMS: return "Test if a server implements a client's required operations";
+            case DATAREQUIREMENTS: return "Aggregates and return the parameters and data requirements as a single module definition library";
+            case DOCUMENT: return "Generate a Document";
+            case EVALUATE: return "Evaluate DecisionSupportRule / DecisionSupportServiceModule";
+            case EVALUATEMEASURE: return "Evaluate Measure";
+            case EVERYTHING: return "Fetch Encounter/Patient Record";
+            case EXPAND: return "Value Set Expansion";
+            case FAIL: return "Fail Task";
+            case FIND: return "Find a functional list";
+            case FINISH: return "Finish Task";
+            case IMPLEMENTS: return "Test if a server implements a client's required operations";
+            case LOOKUP: return "Concept Look Up";
+            case MATCH: return "Find patient matches using MPI based logic";
+            case META: return "Access a list of profiles, tags, and security labels";
+            case METAADD: return "Add profiles, tags, and security labels to a resource";
+            case METADELETE: return "Delete profiles, tags, and security labels for a resource";
+            case POPULATE: return "Populate Questionnaire";
+            case POPULATEHTML: return "Generate HTML for Questionnaire";
+            case POPULATELINK: return "Generate a link to a Questionnaire completion webpage";
+            case PROCESSMESSAGE: return "Process Message";
+            case QUESTIONNAIRE: return "Build Questionnaire";
+            case RELEASE: return "Release Task";
+            case RESERVE: return "Reserve Task";
+            case RESUME: return "Resume Task";
+            case SETINPUT: return "Set Task Input";
+            case SETOUTPUT: return "Set Task Output";
+            case START: return "Start Task";
+            case STATS: return "Observation Statistics";
+            case STOP: return "Stop Task";
+            case SUBSET: return "Fetch a subset of the CapabilityStatement resource";
+            case SUBSUMES: return "Determine if code A is subsumed by code B";
+            case SUSPEND: return "Suspend Task";
+            case TRANSFORM: return "Model Instance Transformation";
+            case TRANSLATE: return "Concept Translation";
+            case VALIDATE: return "Validate a resource";
+            case VALIDATECODE: return "Value Set based Validation";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case READ: return "Read";
+            case VREAD: return "Version Read";
+            case UPDATE: return "Update";
+            case UPDATECREATE: return "Create using Update";
+            case DELETE: return "Delete";
+            case DELETECONDSINGLE: return "Conditional Delete Single";
+            case DELETECONDMULTIPLE: return "Conditional Delete Multiple";
+            case HISTORY: return "History";
+            case CREATE: return "Create";
+            case SEARCH: return "Search";
+            case BATCH: return "Batch";
+            case TRANSACTION: return "Transaction";
+            case CAPABILITIES: return "Capabilities";
+            case APPLY: return "$apply";
+            case CANCEL: return "$cancel";
+            case CLOSURE: return "$closure";
+            case COMPOSE: return "$compose";
+            case CONFORMS: return "$conforms";
+            case DATAREQUIREMENTS: return "$data-requirements";
+            case DOCUMENT: return "$document";
+            case EVALUATE: return "$evaluate";
+            case EVALUATEMEASURE: return "$evaluate-measure";
+            case EVERYTHING: return "$everything";
+            case EXPAND: return "$expand";
+            case FAIL: return "$fail";
+            case FIND: return "$find";
+            case FINISH: return "$finish";
+            case IMPLEMENTS: return "$implements";
+            case LOOKUP: return "$lookup";
+            case MATCH: return "$match";
+            case META: return "$meta";
+            case METAADD: return "$meta-add";
+            case METADELETE: return "$meta-delete";
+            case POPULATE: return "$populate";
+            case POPULATEHTML: return "$populatehtml";
+            case POPULATELINK: return "$populatelink";
+            case PROCESSMESSAGE: return "$process-message";
+            case QUESTIONNAIRE: return "$questionnaire";
+            case RELEASE: return "$release";
+            case RESERVE: return "$reserve";
+            case RESUME: return "$resume";
+            case SETINPUT: return "$set-input";
+            case SETOUTPUT: return "$set-output";
+            case START: return "$start";
+            case STATS: return "$stats";
+            case STOP: return "$stop";
+            case SUBSET: return "$subset";
+            case SUBSUMES: return "$subsumes";
+            case SUSPEND: return "$suspend";
+            case TRANSFORM: return "$transform";
+            case TRANSLATE: return "$translate";
+            case VALIDATE: return "$validate";
+            case VALIDATECODE: return "$validate-code";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptOperationCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptOperationCodesEnumFactory.java
new file mode 100644
index 00000000000..103b65409cf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptOperationCodesEnumFactory.java
@@ -0,0 +1,266 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TestscriptOperationCodesEnumFactory implements EnumFactory {
+
+  public TestscriptOperationCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("read".equals(codeString))
+      return TestscriptOperationCodes.READ;
+    if ("vread".equals(codeString))
+      return TestscriptOperationCodes.VREAD;
+    if ("update".equals(codeString))
+      return TestscriptOperationCodes.UPDATE;
+    if ("updateCreate".equals(codeString))
+      return TestscriptOperationCodes.UPDATECREATE;
+    if ("delete".equals(codeString))
+      return TestscriptOperationCodes.DELETE;
+    if ("deleteCondSingle".equals(codeString))
+      return TestscriptOperationCodes.DELETECONDSINGLE;
+    if ("deleteCondMultiple".equals(codeString))
+      return TestscriptOperationCodes.DELETECONDMULTIPLE;
+    if ("history".equals(codeString))
+      return TestscriptOperationCodes.HISTORY;
+    if ("create".equals(codeString))
+      return TestscriptOperationCodes.CREATE;
+    if ("search".equals(codeString))
+      return TestscriptOperationCodes.SEARCH;
+    if ("batch".equals(codeString))
+      return TestscriptOperationCodes.BATCH;
+    if ("transaction".equals(codeString))
+      return TestscriptOperationCodes.TRANSACTION;
+    if ("capabilities".equals(codeString))
+      return TestscriptOperationCodes.CAPABILITIES;
+    if ("apply".equals(codeString))
+      return TestscriptOperationCodes.APPLY;
+    if ("cancel".equals(codeString))
+      return TestscriptOperationCodes.CANCEL;
+    if ("closure".equals(codeString))
+      return TestscriptOperationCodes.CLOSURE;
+    if ("compose".equals(codeString))
+      return TestscriptOperationCodes.COMPOSE;
+    if ("conforms".equals(codeString))
+      return TestscriptOperationCodes.CONFORMS;
+    if ("data-requirements".equals(codeString))
+      return TestscriptOperationCodes.DATAREQUIREMENTS;
+    if ("document".equals(codeString))
+      return TestscriptOperationCodes.DOCUMENT;
+    if ("evaluate".equals(codeString))
+      return TestscriptOperationCodes.EVALUATE;
+    if ("evaluate-measure".equals(codeString))
+      return TestscriptOperationCodes.EVALUATEMEASURE;
+    if ("everything".equals(codeString))
+      return TestscriptOperationCodes.EVERYTHING;
+    if ("expand".equals(codeString))
+      return TestscriptOperationCodes.EXPAND;
+    if ("fail".equals(codeString))
+      return TestscriptOperationCodes.FAIL;
+    if ("find".equals(codeString))
+      return TestscriptOperationCodes.FIND;
+    if ("finish".equals(codeString))
+      return TestscriptOperationCodes.FINISH;
+    if ("implements".equals(codeString))
+      return TestscriptOperationCodes.IMPLEMENTS;
+    if ("lookup".equals(codeString))
+      return TestscriptOperationCodes.LOOKUP;
+    if ("match".equals(codeString))
+      return TestscriptOperationCodes.MATCH;
+    if ("meta".equals(codeString))
+      return TestscriptOperationCodes.META;
+    if ("meta-add".equals(codeString))
+      return TestscriptOperationCodes.METAADD;
+    if ("meta-delete".equals(codeString))
+      return TestscriptOperationCodes.METADELETE;
+    if ("populate".equals(codeString))
+      return TestscriptOperationCodes.POPULATE;
+    if ("populatehtml".equals(codeString))
+      return TestscriptOperationCodes.POPULATEHTML;
+    if ("populatelink".equals(codeString))
+      return TestscriptOperationCodes.POPULATELINK;
+    if ("process-message".equals(codeString))
+      return TestscriptOperationCodes.PROCESSMESSAGE;
+    if ("questionnaire".equals(codeString))
+      return TestscriptOperationCodes.QUESTIONNAIRE;
+    if ("release".equals(codeString))
+      return TestscriptOperationCodes.RELEASE;
+    if ("reserve".equals(codeString))
+      return TestscriptOperationCodes.RESERVE;
+    if ("resume".equals(codeString))
+      return TestscriptOperationCodes.RESUME;
+    if ("set-input".equals(codeString))
+      return TestscriptOperationCodes.SETINPUT;
+    if ("set-output".equals(codeString))
+      return TestscriptOperationCodes.SETOUTPUT;
+    if ("start".equals(codeString))
+      return TestscriptOperationCodes.START;
+    if ("stats".equals(codeString))
+      return TestscriptOperationCodes.STATS;
+    if ("stop".equals(codeString))
+      return TestscriptOperationCodes.STOP;
+    if ("subset".equals(codeString))
+      return TestscriptOperationCodes.SUBSET;
+    if ("subsumes".equals(codeString))
+      return TestscriptOperationCodes.SUBSUMES;
+    if ("suspend".equals(codeString))
+      return TestscriptOperationCodes.SUSPEND;
+    if ("transform".equals(codeString))
+      return TestscriptOperationCodes.TRANSFORM;
+    if ("translate".equals(codeString))
+      return TestscriptOperationCodes.TRANSLATE;
+    if ("validate".equals(codeString))
+      return TestscriptOperationCodes.VALIDATE;
+    if ("validate-code".equals(codeString))
+      return TestscriptOperationCodes.VALIDATECODE;
+    throw new IllegalArgumentException("Unknown TestscriptOperationCodes code '"+codeString+"'");
+  }
+
+  public String toCode(TestscriptOperationCodes code) {
+    if (code == TestscriptOperationCodes.READ)
+      return "read";
+    if (code == TestscriptOperationCodes.VREAD)
+      return "vread";
+    if (code == TestscriptOperationCodes.UPDATE)
+      return "update";
+    if (code == TestscriptOperationCodes.UPDATECREATE)
+      return "updateCreate";
+    if (code == TestscriptOperationCodes.DELETE)
+      return "delete";
+    if (code == TestscriptOperationCodes.DELETECONDSINGLE)
+      return "deleteCondSingle";
+    if (code == TestscriptOperationCodes.DELETECONDMULTIPLE)
+      return "deleteCondMultiple";
+    if (code == TestscriptOperationCodes.HISTORY)
+      return "history";
+    if (code == TestscriptOperationCodes.CREATE)
+      return "create";
+    if (code == TestscriptOperationCodes.SEARCH)
+      return "search";
+    if (code == TestscriptOperationCodes.BATCH)
+      return "batch";
+    if (code == TestscriptOperationCodes.TRANSACTION)
+      return "transaction";
+    if (code == TestscriptOperationCodes.CAPABILITIES)
+      return "capabilities";
+    if (code == TestscriptOperationCodes.APPLY)
+      return "apply";
+    if (code == TestscriptOperationCodes.CANCEL)
+      return "cancel";
+    if (code == TestscriptOperationCodes.CLOSURE)
+      return "closure";
+    if (code == TestscriptOperationCodes.COMPOSE)
+      return "compose";
+    if (code == TestscriptOperationCodes.CONFORMS)
+      return "conforms";
+    if (code == TestscriptOperationCodes.DATAREQUIREMENTS)
+      return "data-requirements";
+    if (code == TestscriptOperationCodes.DOCUMENT)
+      return "document";
+    if (code == TestscriptOperationCodes.EVALUATE)
+      return "evaluate";
+    if (code == TestscriptOperationCodes.EVALUATEMEASURE)
+      return "evaluate-measure";
+    if (code == TestscriptOperationCodes.EVERYTHING)
+      return "everything";
+    if (code == TestscriptOperationCodes.EXPAND)
+      return "expand";
+    if (code == TestscriptOperationCodes.FAIL)
+      return "fail";
+    if (code == TestscriptOperationCodes.FIND)
+      return "find";
+    if (code == TestscriptOperationCodes.FINISH)
+      return "finish";
+    if (code == TestscriptOperationCodes.IMPLEMENTS)
+      return "implements";
+    if (code == TestscriptOperationCodes.LOOKUP)
+      return "lookup";
+    if (code == TestscriptOperationCodes.MATCH)
+      return "match";
+    if (code == TestscriptOperationCodes.META)
+      return "meta";
+    if (code == TestscriptOperationCodes.METAADD)
+      return "meta-add";
+    if (code == TestscriptOperationCodes.METADELETE)
+      return "meta-delete";
+    if (code == TestscriptOperationCodes.POPULATE)
+      return "populate";
+    if (code == TestscriptOperationCodes.POPULATEHTML)
+      return "populatehtml";
+    if (code == TestscriptOperationCodes.POPULATELINK)
+      return "populatelink";
+    if (code == TestscriptOperationCodes.PROCESSMESSAGE)
+      return "process-message";
+    if (code == TestscriptOperationCodes.QUESTIONNAIRE)
+      return "questionnaire";
+    if (code == TestscriptOperationCodes.RELEASE)
+      return "release";
+    if (code == TestscriptOperationCodes.RESERVE)
+      return "reserve";
+    if (code == TestscriptOperationCodes.RESUME)
+      return "resume";
+    if (code == TestscriptOperationCodes.SETINPUT)
+      return "set-input";
+    if (code == TestscriptOperationCodes.SETOUTPUT)
+      return "set-output";
+    if (code == TestscriptOperationCodes.START)
+      return "start";
+    if (code == TestscriptOperationCodes.STATS)
+      return "stats";
+    if (code == TestscriptOperationCodes.STOP)
+      return "stop";
+    if (code == TestscriptOperationCodes.SUBSET)
+      return "subset";
+    if (code == TestscriptOperationCodes.SUBSUMES)
+      return "subsumes";
+    if (code == TestscriptOperationCodes.SUSPEND)
+      return "suspend";
+    if (code == TestscriptOperationCodes.TRANSFORM)
+      return "transform";
+    if (code == TestscriptOperationCodes.TRANSLATE)
+      return "translate";
+    if (code == TestscriptOperationCodes.VALIDATE)
+      return "validate";
+    if (code == TestscriptOperationCodes.VALIDATECODE)
+      return "validate-code";
+    return "?";
+  }
+
+    public String toSystem(TestscriptOperationCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileDestinationTypes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileDestinationTypes.java
new file mode 100644
index 00000000000..15ebd5c6b7e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileDestinationTypes.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TestscriptProfileDestinationTypes {
+
+        /**
+         * General FHIR server used to respond to operations sent from a FHIR client.
+         */
+        FHIRSERVER, 
+        /**
+         * A FHIR server acting as a Structured Data Capture Form Manager.
+         */
+        FHIRSDCFORMMANAGER, 
+        /**
+         * A FHIR server acting as a Structured Data Capture Form Processor.
+         */
+        FHIRSDCFORMPROCESSOR, 
+        /**
+         * A FHIR server acting as a Structured Data Capture Form Receiver.
+         */
+        FHIRSDCFORMRECEIVER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TestscriptProfileDestinationTypes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("FHIR-Server".equals(codeString))
+          return FHIRSERVER;
+        if ("FHIR-SDC-FormManager".equals(codeString))
+          return FHIRSDCFORMMANAGER;
+        if ("FHIR-SDC-FormProcessor".equals(codeString))
+          return FHIRSDCFORMPROCESSOR;
+        if ("FHIR-SDC-FormReceiver".equals(codeString))
+          return FHIRSDCFORMRECEIVER;
+        throw new FHIRException("Unknown TestscriptProfileDestinationTypes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FHIRSERVER: return "FHIR-Server";
+            case FHIRSDCFORMMANAGER: return "FHIR-SDC-FormManager";
+            case FHIRSDCFORMPROCESSOR: return "FHIR-SDC-FormProcessor";
+            case FHIRSDCFORMRECEIVER: return "FHIR-SDC-FormReceiver";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/testscript-profile-destination-types";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FHIRSERVER: return "General FHIR server used to respond to operations sent from a FHIR client.";
+            case FHIRSDCFORMMANAGER: return "A FHIR server acting as a Structured Data Capture Form Manager.";
+            case FHIRSDCFORMPROCESSOR: return "A FHIR server acting as a Structured Data Capture Form Processor.";
+            case FHIRSDCFORMRECEIVER: return "A FHIR server acting as a Structured Data Capture Form Receiver.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FHIRSERVER: return "FHIR Server";
+            case FHIRSDCFORMMANAGER: return "FHIR SDC FormManager";
+            case FHIRSDCFORMPROCESSOR: return "FHIR SDC FormProcessor";
+            case FHIRSDCFORMRECEIVER: return "FHIR SDC FormReceiver";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileDestinationTypesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileDestinationTypesEnumFactory.java
new file mode 100644
index 00000000000..f0326037645
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileDestinationTypesEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TestscriptProfileDestinationTypesEnumFactory implements EnumFactory {
+
+  public TestscriptProfileDestinationTypes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("FHIR-Server".equals(codeString))
+      return TestscriptProfileDestinationTypes.FHIRSERVER;
+    if ("FHIR-SDC-FormManager".equals(codeString))
+      return TestscriptProfileDestinationTypes.FHIRSDCFORMMANAGER;
+    if ("FHIR-SDC-FormProcessor".equals(codeString))
+      return TestscriptProfileDestinationTypes.FHIRSDCFORMPROCESSOR;
+    if ("FHIR-SDC-FormReceiver".equals(codeString))
+      return TestscriptProfileDestinationTypes.FHIRSDCFORMRECEIVER;
+    throw new IllegalArgumentException("Unknown TestscriptProfileDestinationTypes code '"+codeString+"'");
+  }
+
+  public String toCode(TestscriptProfileDestinationTypes code) {
+    if (code == TestscriptProfileDestinationTypes.FHIRSERVER)
+      return "FHIR-Server";
+    if (code == TestscriptProfileDestinationTypes.FHIRSDCFORMMANAGER)
+      return "FHIR-SDC-FormManager";
+    if (code == TestscriptProfileDestinationTypes.FHIRSDCFORMPROCESSOR)
+      return "FHIR-SDC-FormProcessor";
+    if (code == TestscriptProfileDestinationTypes.FHIRSDCFORMRECEIVER)
+      return "FHIR-SDC-FormReceiver";
+    return "?";
+  }
+
+    public String toSystem(TestscriptProfileDestinationTypes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileOriginTypes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileOriginTypes.java
new file mode 100644
index 00000000000..1cf358ce945
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileOriginTypes.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TestscriptProfileOriginTypes {
+
+        /**
+         * General FHIR client used to initiate operations against a FHIR server.
+         */
+        FHIRCLIENT, 
+        /**
+         * A FHIR client acting as a Structured Data Capture Form Filler.
+         */
+        FHIRSDCFORMFILLER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TestscriptProfileOriginTypes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("FHIR-Client".equals(codeString))
+          return FHIRCLIENT;
+        if ("FHIR-SDC-FormFiller".equals(codeString))
+          return FHIRSDCFORMFILLER;
+        throw new FHIRException("Unknown TestscriptProfileOriginTypes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FHIRCLIENT: return "FHIR-Client";
+            case FHIRSDCFORMFILLER: return "FHIR-SDC-FormFiller";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/testscript-profile-origin-types";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FHIRCLIENT: return "General FHIR client used to initiate operations against a FHIR server.";
+            case FHIRSDCFORMFILLER: return "A FHIR client acting as a Structured Data Capture Form Filler.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FHIRCLIENT: return "FHIR Client";
+            case FHIRSDCFORMFILLER: return "FHIR SDC FormFiller";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileOriginTypesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileOriginTypesEnumFactory.java
new file mode 100644
index 00000000000..7a92f377cbf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TestscriptProfileOriginTypesEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TestscriptProfileOriginTypesEnumFactory implements EnumFactory {
+
+  public TestscriptProfileOriginTypes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("FHIR-Client".equals(codeString))
+      return TestscriptProfileOriginTypes.FHIRCLIENT;
+    if ("FHIR-SDC-FormFiller".equals(codeString))
+      return TestscriptProfileOriginTypes.FHIRSDCFORMFILLER;
+    throw new IllegalArgumentException("Unknown TestscriptProfileOriginTypes code '"+codeString+"'");
+  }
+
+  public String toCode(TestscriptProfileOriginTypes code) {
+    if (code == TestscriptProfileOriginTypes.FHIRCLIENT)
+      return "FHIR-Client";
+    if (code == TestscriptProfileOriginTypes.FHIRSDCFORMFILLER)
+      return "FHIR-SDC-FormFiller";
+    return "?";
+  }
+
+    public String toSystem(TestscriptProfileOriginTypes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Tooth.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Tooth.java
new file mode 100644
index 00000000000..4df3a27b7b5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Tooth.java
@@ -0,0 +1,438 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Tooth {
+
+        /**
+         * Oral cavity.
+         */
+        _0, 
+        /**
+         * Permanent teeth Maxillary right.
+         */
+        _1, 
+        /**
+         * Permanent teeth Maxillary left.
+         */
+        _2, 
+        /**
+         * Permanent teeth Mandibular right.
+         */
+        _3, 
+        /**
+         * Permanent teeth Mandibular left.
+         */
+        _4, 
+        /**
+         * Deciduous teeth Maxillary right.
+         */
+        _5, 
+        /**
+         * Deciduous teeth Maxillary left.
+         */
+        _6, 
+        /**
+         * Deciduous teeth Mandibular right.
+         */
+        _7, 
+        /**
+         * Deciduous teeth Mandibular left.
+         */
+        _8, 
+        /**
+         * Upper Right Tooth 1 from the central axis, permanent dentition.
+         */
+        _11, 
+        /**
+         * Upper Right Tooth 2 from the central axis, permanent dentition.
+         */
+        _12, 
+        /**
+         * Upper Right Tooth 3 from the central axis, permanent dentition.
+         */
+        _13, 
+        /**
+         * Upper Right Tooth 4 from the central axis, permanent dentition.
+         */
+        _14, 
+        /**
+         * Upper Right Tooth 5 from the central axis, permanent dentition.
+         */
+        _15, 
+        /**
+         * Upper Right Tooth 6 from the central axis, permanent dentition.
+         */
+        _16, 
+        /**
+         * Upper Right Tooth 7 from the central axis, permanent dentition.
+         */
+        _17, 
+        /**
+         * Upper Right Tooth 8 from the central axis, permanent dentition.
+         */
+        _18, 
+        /**
+         * Upper Left Tooth 1 from the central axis, permanent dentition.
+         */
+        _21, 
+        /**
+         * Upper Left Tooth 2 from the central axis, permanent dentition.
+         */
+        _22, 
+        /**
+         * Upper Left Tooth 3 from the central axis, permanent dentition.
+         */
+        _23, 
+        /**
+         * Upper Left Tooth 4 from the central axis, permanent dentition.
+         */
+        _24, 
+        /**
+         * Upper Left Tooth 5 from the central axis, permanent dentition.
+         */
+        _25, 
+        /**
+         * Upper Left Tooth 6 from the central axis, permanent dentition.
+         */
+        _26, 
+        /**
+         * Upper Left Tooth 7 from the central axis, permanent dentition.
+         */
+        _27, 
+        /**
+         * Upper Left Tooth 8 from the central axis, permanent dentition.
+         */
+        _28, 
+        /**
+         * Lower Left Tooth 1 from the central axis, permanent dentition.
+         */
+        _31, 
+        /**
+         * Lower Left Tooth 2 from the central axis, permanent dentition.
+         */
+        _32, 
+        /**
+         * Lower Left Tooth 3 from the central axis, permanent dentition.
+         */
+        _33, 
+        /**
+         * Lower Left Tooth 4 from the central axis, permanent dentition.
+         */
+        _34, 
+        /**
+         * Lower Left Tooth 5 from the central axis, permanent dentition.
+         */
+        _35, 
+        /**
+         * Lower Left Tooth 6 from the central axis, permanent dentition.
+         */
+        _36, 
+        /**
+         * Lower Left Tooth 7 from the central axis, permanent dentition.
+         */
+        _37, 
+        /**
+         * Lower Left Tooth 8 from the central axis, permanent dentition.
+         */
+        _38, 
+        /**
+         * Lower Right Tooth 1 from the central axis, permanent dentition.
+         */
+        _41, 
+        /**
+         * Lower Right Tooth 2 from the central axis, permanent dentition.
+         */
+        _42, 
+        /**
+         * Lower Right Tooth 3 from the central axis, permanent dentition.
+         */
+        _43, 
+        /**
+         * Lower Right Tooth 4 from the central axis, permanent dentition.
+         */
+        _44, 
+        /**
+         * Lower Right Tooth 5 from the central axis, permanent dentition.
+         */
+        _45, 
+        /**
+         * Lower Right Tooth 6 from the central axis, permanent dentition.
+         */
+        _46, 
+        /**
+         * Lower Right Tooth 7 from the central axis, permanent dentition.
+         */
+        _47, 
+        /**
+         * Lower Right Tooth 8 from the central axis, permanent dentition.
+         */
+        _48, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Tooth fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("0".equals(codeString))
+          return _0;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("6".equals(codeString))
+          return _6;
+        if ("7".equals(codeString))
+          return _7;
+        if ("8".equals(codeString))
+          return _8;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        if ("16".equals(codeString))
+          return _16;
+        if ("17".equals(codeString))
+          return _17;
+        if ("18".equals(codeString))
+          return _18;
+        if ("21".equals(codeString))
+          return _21;
+        if ("22".equals(codeString))
+          return _22;
+        if ("23".equals(codeString))
+          return _23;
+        if ("24".equals(codeString))
+          return _24;
+        if ("25".equals(codeString))
+          return _25;
+        if ("26".equals(codeString))
+          return _26;
+        if ("27".equals(codeString))
+          return _27;
+        if ("28".equals(codeString))
+          return _28;
+        if ("31".equals(codeString))
+          return _31;
+        if ("32".equals(codeString))
+          return _32;
+        if ("33".equals(codeString))
+          return _33;
+        if ("34".equals(codeString))
+          return _34;
+        if ("35".equals(codeString))
+          return _35;
+        if ("36".equals(codeString))
+          return _36;
+        if ("37".equals(codeString))
+          return _37;
+        if ("38".equals(codeString))
+          return _38;
+        if ("41".equals(codeString))
+          return _41;
+        if ("42".equals(codeString))
+          return _42;
+        if ("43".equals(codeString))
+          return _43;
+        if ("44".equals(codeString))
+          return _44;
+        if ("45".equals(codeString))
+          return _45;
+        if ("46".equals(codeString))
+          return _46;
+        if ("47".equals(codeString))
+          return _47;
+        if ("48".equals(codeString))
+          return _48;
+        throw new FHIRException("Unknown Tooth code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _0: return "0";
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _8: return "8";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            case _16: return "16";
+            case _17: return "17";
+            case _18: return "18";
+            case _21: return "21";
+            case _22: return "22";
+            case _23: return "23";
+            case _24: return "24";
+            case _25: return "25";
+            case _26: return "26";
+            case _27: return "27";
+            case _28: return "28";
+            case _31: return "31";
+            case _32: return "32";
+            case _33: return "33";
+            case _34: return "34";
+            case _35: return "35";
+            case _36: return "36";
+            case _37: return "37";
+            case _38: return "38";
+            case _41: return "41";
+            case _42: return "42";
+            case _43: return "43";
+            case _44: return "44";
+            case _45: return "45";
+            case _46: return "46";
+            case _47: return "47";
+            case _48: return "48";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-tooth";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _0: return "Oral cavity.";
+            case _1: return "Permanent teeth Maxillary right.";
+            case _2: return "Permanent teeth Maxillary left.";
+            case _3: return "Permanent teeth Mandibular right.";
+            case _4: return "Permanent teeth Mandibular left.";
+            case _5: return "Deciduous teeth Maxillary right.";
+            case _6: return "Deciduous teeth Maxillary left.";
+            case _7: return "Deciduous teeth Mandibular right.";
+            case _8: return "Deciduous teeth Mandibular left.";
+            case _11: return "Upper Right Tooth 1 from the central axis, permanent dentition.";
+            case _12: return "Upper Right Tooth 2 from the central axis, permanent dentition.";
+            case _13: return "Upper Right Tooth 3 from the central axis, permanent dentition.";
+            case _14: return "Upper Right Tooth 4 from the central axis, permanent dentition.";
+            case _15: return "Upper Right Tooth 5 from the central axis, permanent dentition.";
+            case _16: return "Upper Right Tooth 6 from the central axis, permanent dentition.";
+            case _17: return "Upper Right Tooth 7 from the central axis, permanent dentition.";
+            case _18: return "Upper Right Tooth 8 from the central axis, permanent dentition.";
+            case _21: return "Upper Left Tooth 1 from the central axis, permanent dentition.";
+            case _22: return "Upper Left Tooth 2 from the central axis, permanent dentition.";
+            case _23: return "Upper Left Tooth 3 from the central axis, permanent dentition.";
+            case _24: return "Upper Left Tooth 4 from the central axis, permanent dentition.";
+            case _25: return "Upper Left Tooth 5 from the central axis, permanent dentition.";
+            case _26: return "Upper Left Tooth 6 from the central axis, permanent dentition.";
+            case _27: return "Upper Left Tooth 7 from the central axis, permanent dentition.";
+            case _28: return "Upper Left Tooth 8 from the central axis, permanent dentition.";
+            case _31: return "Lower Left Tooth 1 from the central axis, permanent dentition.";
+            case _32: return "Lower Left Tooth 2 from the central axis, permanent dentition.";
+            case _33: return "Lower Left Tooth 3 from the central axis, permanent dentition.";
+            case _34: return "Lower Left Tooth 4 from the central axis, permanent dentition.";
+            case _35: return "Lower Left Tooth 5 from the central axis, permanent dentition.";
+            case _36: return "Lower Left Tooth 6 from the central axis, permanent dentition.";
+            case _37: return "Lower Left Tooth 7 from the central axis, permanent dentition.";
+            case _38: return "Lower Left Tooth 8 from the central axis, permanent dentition.";
+            case _41: return "Lower Right Tooth 1 from the central axis, permanent dentition.";
+            case _42: return "Lower Right Tooth 2 from the central axis, permanent dentition.";
+            case _43: return "Lower Right Tooth 3 from the central axis, permanent dentition.";
+            case _44: return "Lower Right Tooth 4 from the central axis, permanent dentition.";
+            case _45: return "Lower Right Tooth 5 from the central axis, permanent dentition.";
+            case _46: return "Lower Right Tooth 6 from the central axis, permanent dentition.";
+            case _47: return "Lower Right Tooth 7 from the central axis, permanent dentition.";
+            case _48: return "Lower Right Tooth 8 from the central axis, permanent dentition.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _0: return "Oral cavity";
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _8: return "8";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _14: return "14";
+            case _15: return "15";
+            case _16: return "16";
+            case _17: return "17";
+            case _18: return "18";
+            case _21: return "21";
+            case _22: return "22";
+            case _23: return "23";
+            case _24: return "24";
+            case _25: return "25";
+            case _26: return "26";
+            case _27: return "27";
+            case _28: return "28";
+            case _31: return "31";
+            case _32: return "32";
+            case _33: return "33";
+            case _34: return "34";
+            case _35: return "35";
+            case _36: return "36";
+            case _37: return "37";
+            case _38: return "38";
+            case _41: return "41";
+            case _42: return "42";
+            case _43: return "43";
+            case _44: return "44";
+            case _45: return "45";
+            case _46: return "46";
+            case _47: return "47";
+            case _48: return "48";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ToothEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ToothEnumFactory.java
new file mode 100644
index 00000000000..87545e4e305
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ToothEnumFactory.java
@@ -0,0 +1,218 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ToothEnumFactory implements EnumFactory {
+
+  public Tooth fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("0".equals(codeString))
+      return Tooth._0;
+    if ("1".equals(codeString))
+      return Tooth._1;
+    if ("2".equals(codeString))
+      return Tooth._2;
+    if ("3".equals(codeString))
+      return Tooth._3;
+    if ("4".equals(codeString))
+      return Tooth._4;
+    if ("5".equals(codeString))
+      return Tooth._5;
+    if ("6".equals(codeString))
+      return Tooth._6;
+    if ("7".equals(codeString))
+      return Tooth._7;
+    if ("8".equals(codeString))
+      return Tooth._8;
+    if ("11".equals(codeString))
+      return Tooth._11;
+    if ("12".equals(codeString))
+      return Tooth._12;
+    if ("13".equals(codeString))
+      return Tooth._13;
+    if ("14".equals(codeString))
+      return Tooth._14;
+    if ("15".equals(codeString))
+      return Tooth._15;
+    if ("16".equals(codeString))
+      return Tooth._16;
+    if ("17".equals(codeString))
+      return Tooth._17;
+    if ("18".equals(codeString))
+      return Tooth._18;
+    if ("21".equals(codeString))
+      return Tooth._21;
+    if ("22".equals(codeString))
+      return Tooth._22;
+    if ("23".equals(codeString))
+      return Tooth._23;
+    if ("24".equals(codeString))
+      return Tooth._24;
+    if ("25".equals(codeString))
+      return Tooth._25;
+    if ("26".equals(codeString))
+      return Tooth._26;
+    if ("27".equals(codeString))
+      return Tooth._27;
+    if ("28".equals(codeString))
+      return Tooth._28;
+    if ("31".equals(codeString))
+      return Tooth._31;
+    if ("32".equals(codeString))
+      return Tooth._32;
+    if ("33".equals(codeString))
+      return Tooth._33;
+    if ("34".equals(codeString))
+      return Tooth._34;
+    if ("35".equals(codeString))
+      return Tooth._35;
+    if ("36".equals(codeString))
+      return Tooth._36;
+    if ("37".equals(codeString))
+      return Tooth._37;
+    if ("38".equals(codeString))
+      return Tooth._38;
+    if ("41".equals(codeString))
+      return Tooth._41;
+    if ("42".equals(codeString))
+      return Tooth._42;
+    if ("43".equals(codeString))
+      return Tooth._43;
+    if ("44".equals(codeString))
+      return Tooth._44;
+    if ("45".equals(codeString))
+      return Tooth._45;
+    if ("46".equals(codeString))
+      return Tooth._46;
+    if ("47".equals(codeString))
+      return Tooth._47;
+    if ("48".equals(codeString))
+      return Tooth._48;
+    throw new IllegalArgumentException("Unknown Tooth code '"+codeString+"'");
+  }
+
+  public String toCode(Tooth code) {
+    if (code == Tooth._0)
+      return "0";
+    if (code == Tooth._1)
+      return "1";
+    if (code == Tooth._2)
+      return "2";
+    if (code == Tooth._3)
+      return "3";
+    if (code == Tooth._4)
+      return "4";
+    if (code == Tooth._5)
+      return "5";
+    if (code == Tooth._6)
+      return "6";
+    if (code == Tooth._7)
+      return "7";
+    if (code == Tooth._8)
+      return "8";
+    if (code == Tooth._11)
+      return "11";
+    if (code == Tooth._12)
+      return "12";
+    if (code == Tooth._13)
+      return "13";
+    if (code == Tooth._14)
+      return "14";
+    if (code == Tooth._15)
+      return "15";
+    if (code == Tooth._16)
+      return "16";
+    if (code == Tooth._17)
+      return "17";
+    if (code == Tooth._18)
+      return "18";
+    if (code == Tooth._21)
+      return "21";
+    if (code == Tooth._22)
+      return "22";
+    if (code == Tooth._23)
+      return "23";
+    if (code == Tooth._24)
+      return "24";
+    if (code == Tooth._25)
+      return "25";
+    if (code == Tooth._26)
+      return "26";
+    if (code == Tooth._27)
+      return "27";
+    if (code == Tooth._28)
+      return "28";
+    if (code == Tooth._31)
+      return "31";
+    if (code == Tooth._32)
+      return "32";
+    if (code == Tooth._33)
+      return "33";
+    if (code == Tooth._34)
+      return "34";
+    if (code == Tooth._35)
+      return "35";
+    if (code == Tooth._36)
+      return "36";
+    if (code == Tooth._37)
+      return "37";
+    if (code == Tooth._38)
+      return "38";
+    if (code == Tooth._41)
+      return "41";
+    if (code == Tooth._42)
+      return "42";
+    if (code == Tooth._43)
+      return "43";
+    if (code == Tooth._44)
+      return "44";
+    if (code == Tooth._45)
+      return "45";
+    if (code == Tooth._46)
+      return "46";
+    if (code == Tooth._47)
+      return "47";
+    if (code == Tooth._48)
+      return "48";
+    return "?";
+  }
+
+    public String toSystem(Tooth code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TransactionMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TransactionMode.java
new file mode 100644
index 00000000000..72cc50db3b6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TransactionMode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TransactionMode {
+
+        /**
+         * Neither batch or transaction is supported.
+         */
+        NOTSUPPORTED, 
+        /**
+         * Batches are  supported.
+         */
+        BATCH, 
+        /**
+         * Transactions are supported.
+         */
+        TRANSACTION, 
+        /**
+         * Both batches and transactions are supported.
+         */
+        BOTH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TransactionMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("not-supported".equals(codeString))
+          return NOTSUPPORTED;
+        if ("batch".equals(codeString))
+          return BATCH;
+        if ("transaction".equals(codeString))
+          return TRANSACTION;
+        if ("both".equals(codeString))
+          return BOTH;
+        throw new FHIRException("Unknown TransactionMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NOTSUPPORTED: return "not-supported";
+            case BATCH: return "batch";
+            case TRANSACTION: return "transaction";
+            case BOTH: return "both";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/transaction-mode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NOTSUPPORTED: return "Neither batch or transaction is supported.";
+            case BATCH: return "Batches are  supported.";
+            case TRANSACTION: return "Transactions are supported.";
+            case BOTH: return "Both batches and transactions are supported.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NOTSUPPORTED: return "None";
+            case BATCH: return "Batches supported";
+            case TRANSACTION: return "Transactions Supported";
+            case BOTH: return "Batches & Transactions";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TransactionModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TransactionModeEnumFactory.java
new file mode 100644
index 00000000000..1e24a6c18b4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TransactionModeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TransactionModeEnumFactory implements EnumFactory {
+
+  public TransactionMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("not-supported".equals(codeString))
+      return TransactionMode.NOTSUPPORTED;
+    if ("batch".equals(codeString))
+      return TransactionMode.BATCH;
+    if ("transaction".equals(codeString))
+      return TransactionMode.TRANSACTION;
+    if ("both".equals(codeString))
+      return TransactionMode.BOTH;
+    throw new IllegalArgumentException("Unknown TransactionMode code '"+codeString+"'");
+  }
+
+  public String toCode(TransactionMode code) {
+    if (code == TransactionMode.NOTSUPPORTED)
+      return "not-supported";
+    if (code == TransactionMode.BATCH)
+      return "batch";
+    if (code == TransactionMode.TRANSACTION)
+      return "transaction";
+    if (code == TransactionMode.BOTH)
+      return "both";
+    return "?";
+  }
+
+    public String toSystem(TransactionMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TriggerType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TriggerType.java
new file mode 100644
index 00000000000..4c10951435d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TriggerType.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TriggerType {
+
+        /**
+         * The trigger occurs in response to a specific named event
+         */
+        NAMEDEVENT, 
+        /**
+         * The trigger occurs at a specific time or periodically as described by a timing or schedule
+         */
+        PERIODIC, 
+        /**
+         * The trigger occurs whenever data of a particular type is added
+         */
+        DATAADDED, 
+        /**
+         * The trigger occurs whenever data of a particular type is modified
+         */
+        DATAMODIFIED, 
+        /**
+         * The trigger occurs whenever data of a particular type is removed
+         */
+        DATAREMOVED, 
+        /**
+         * The trigger occurs whenever data of a particular type is accessed
+         */
+        DATAACCESSED, 
+        /**
+         * The trigger occurs whenever access to data of a particular type is completed
+         */
+        DATAACCESSENDED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TriggerType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("named-event".equals(codeString))
+          return NAMEDEVENT;
+        if ("periodic".equals(codeString))
+          return PERIODIC;
+        if ("data-added".equals(codeString))
+          return DATAADDED;
+        if ("data-modified".equals(codeString))
+          return DATAMODIFIED;
+        if ("data-removed".equals(codeString))
+          return DATAREMOVED;
+        if ("data-accessed".equals(codeString))
+          return DATAACCESSED;
+        if ("data-access-ended".equals(codeString))
+          return DATAACCESSENDED;
+        throw new FHIRException("Unknown TriggerType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NAMEDEVENT: return "named-event";
+            case PERIODIC: return "periodic";
+            case DATAADDED: return "data-added";
+            case DATAMODIFIED: return "data-modified";
+            case DATAREMOVED: return "data-removed";
+            case DATAACCESSED: return "data-accessed";
+            case DATAACCESSENDED: return "data-access-ended";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/trigger-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NAMEDEVENT: return "The trigger occurs in response to a specific named event";
+            case PERIODIC: return "The trigger occurs at a specific time or periodically as described by a timing or schedule";
+            case DATAADDED: return "The trigger occurs whenever data of a particular type is added";
+            case DATAMODIFIED: return "The trigger occurs whenever data of a particular type is modified";
+            case DATAREMOVED: return "The trigger occurs whenever data of a particular type is removed";
+            case DATAACCESSED: return "The trigger occurs whenever data of a particular type is accessed";
+            case DATAACCESSENDED: return "The trigger occurs whenever access to data of a particular type is completed";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NAMEDEVENT: return "Named Event";
+            case PERIODIC: return "Periodic";
+            case DATAADDED: return "Data Added";
+            case DATAMODIFIED: return "Data Modified";
+            case DATAREMOVED: return "Data Removed";
+            case DATAACCESSED: return "Data Accessed";
+            case DATAACCESSENDED: return "Data Access Ended";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TriggerTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TriggerTypeEnumFactory.java
new file mode 100644
index 00000000000..f5d238afe6d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TriggerTypeEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TriggerTypeEnumFactory implements EnumFactory {
+
+  public TriggerType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("named-event".equals(codeString))
+      return TriggerType.NAMEDEVENT;
+    if ("periodic".equals(codeString))
+      return TriggerType.PERIODIC;
+    if ("data-added".equals(codeString))
+      return TriggerType.DATAADDED;
+    if ("data-modified".equals(codeString))
+      return TriggerType.DATAMODIFIED;
+    if ("data-removed".equals(codeString))
+      return TriggerType.DATAREMOVED;
+    if ("data-accessed".equals(codeString))
+      return TriggerType.DATAACCESSED;
+    if ("data-access-ended".equals(codeString))
+      return TriggerType.DATAACCESSENDED;
+    throw new IllegalArgumentException("Unknown TriggerType code '"+codeString+"'");
+  }
+
+  public String toCode(TriggerType code) {
+    if (code == TriggerType.NAMEDEVENT)
+      return "named-event";
+    if (code == TriggerType.PERIODIC)
+      return "periodic";
+    if (code == TriggerType.DATAADDED)
+      return "data-added";
+    if (code == TriggerType.DATAMODIFIED)
+      return "data-modified";
+    if (code == TriggerType.DATAREMOVED)
+      return "data-removed";
+    if (code == TriggerType.DATAACCESSED)
+      return "data-accessed";
+    if (code == TriggerType.DATAACCESSENDED)
+      return "data-access-ended";
+    return "?";
+  }
+
+    public String toSystem(TriggerType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TypeDerivationRule.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TypeDerivationRule.java
new file mode 100644
index 00000000000..93d67b9068b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TypeDerivationRule.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum TypeDerivationRule {
+
+        /**
+         * This definition defines a new type that adds additional elements to the base type
+         */
+        SPECIALIZATION, 
+        /**
+         * This definition adds additional rules to an existing concrete type
+         */
+        CONSTRAINT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static TypeDerivationRule fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("specialization".equals(codeString))
+          return SPECIALIZATION;
+        if ("constraint".equals(codeString))
+          return CONSTRAINT;
+        throw new FHIRException("Unknown TypeDerivationRule code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SPECIALIZATION: return "specialization";
+            case CONSTRAINT: return "constraint";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/type-derivation-rule";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SPECIALIZATION: return "This definition defines a new type that adds additional elements to the base type";
+            case CONSTRAINT: return "This definition adds additional rules to an existing concrete type";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SPECIALIZATION: return "Specialization";
+            case CONSTRAINT: return "Constraint";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TypeDerivationRuleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TypeDerivationRuleEnumFactory.java
new file mode 100644
index 00000000000..98a51abef1b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/TypeDerivationRuleEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class TypeDerivationRuleEnumFactory implements EnumFactory {
+
+  public TypeDerivationRule fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("specialization".equals(codeString))
+      return TypeDerivationRule.SPECIALIZATION;
+    if ("constraint".equals(codeString))
+      return TypeDerivationRule.CONSTRAINT;
+    throw new IllegalArgumentException("Unknown TypeDerivationRule code '"+codeString+"'");
+  }
+
+  public String toCode(TypeDerivationRule code) {
+    if (code == TypeDerivationRule.SPECIALIZATION)
+      return "specialization";
+    if (code == TypeDerivationRule.CONSTRAINT)
+      return "constraint";
+    return "?";
+  }
+
+    public String toSystem(TypeDerivationRule code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Udi.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Udi.java
new file mode 100644
index 00000000000..514b8a2c431
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Udi.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum Udi {
+
+        /**
+         * GUDID (FDA) US Repository
+         */
+        GUDID, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static Udi fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("gudid".equals(codeString))
+          return GUDID;
+        throw new FHIRException("Unknown Udi code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GUDID: return "gudid";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-udi";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GUDID: return "GUDID (FDA) US Repository";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GUDID: return "GUDID (FDA)";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UdiEntryType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UdiEntryType.java
new file mode 100644
index 00000000000..5e14d1d243b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UdiEntryType.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum UdiEntryType {
+
+        /**
+         * A Barcode scanner captured the data from the device label
+         */
+        BARCODE, 
+        /**
+         * An RFID chip reader captured the data from the device label
+         */
+        RFID, 
+        /**
+         * The data was read from the label by a person and manually entered. (e.g.  via a keyboard)
+         */
+        MANUAL, 
+        /**
+         * The data originated from a patient's implant card and read by an operator.
+         */
+        CARD, 
+        /**
+         * The data originated from a patient source and not directly scanned or read from a label or card.
+         */
+        SELFREPORTED, 
+        /**
+         * The method of data capture has not been determined
+         */
+        UNKNOWN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static UdiEntryType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("barcode".equals(codeString))
+          return BARCODE;
+        if ("rfid".equals(codeString))
+          return RFID;
+        if ("manual".equals(codeString))
+          return MANUAL;
+        if ("card".equals(codeString))
+          return CARD;
+        if ("self-reported".equals(codeString))
+          return SELFREPORTED;
+        if ("unknown".equals(codeString))
+          return UNKNOWN;
+        throw new FHIRException("Unknown UdiEntryType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BARCODE: return "barcode";
+            case RFID: return "rfid";
+            case MANUAL: return "manual";
+            case CARD: return "card";
+            case SELFREPORTED: return "self-reported";
+            case UNKNOWN: return "unknown";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/udi-entry-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BARCODE: return "A Barcode scanner captured the data from the device label";
+            case RFID: return "An RFID chip reader captured the data from the device label";
+            case MANUAL: return "The data was read from the label by a person and manually entered. (e.g.  via a keyboard)";
+            case CARD: return "The data originated from a patient's implant card and read by an operator.";
+            case SELFREPORTED: return "The data originated from a patient source and not directly scanned or read from a label or card.";
+            case UNKNOWN: return "The method of data capture has not been determined";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BARCODE: return "BarCode";
+            case RFID: return "RFID";
+            case MANUAL: return "Manual";
+            case CARD: return "Card";
+            case SELFREPORTED: return "Self Reported";
+            case UNKNOWN: return "Unknown";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UdiEntryTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UdiEntryTypeEnumFactory.java
new file mode 100644
index 00000000000..6ae48dd9268
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UdiEntryTypeEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class UdiEntryTypeEnumFactory implements EnumFactory {
+
+  public UdiEntryType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("barcode".equals(codeString))
+      return UdiEntryType.BARCODE;
+    if ("rfid".equals(codeString))
+      return UdiEntryType.RFID;
+    if ("manual".equals(codeString))
+      return UdiEntryType.MANUAL;
+    if ("card".equals(codeString))
+      return UdiEntryType.CARD;
+    if ("self-reported".equals(codeString))
+      return UdiEntryType.SELFREPORTED;
+    if ("unknown".equals(codeString))
+      return UdiEntryType.UNKNOWN;
+    throw new IllegalArgumentException("Unknown UdiEntryType code '"+codeString+"'");
+  }
+
+  public String toCode(UdiEntryType code) {
+    if (code == UdiEntryType.BARCODE)
+      return "barcode";
+    if (code == UdiEntryType.RFID)
+      return "rfid";
+    if (code == UdiEntryType.MANUAL)
+      return "manual";
+    if (code == UdiEntryType.CARD)
+      return "card";
+    if (code == UdiEntryType.SELFREPORTED)
+      return "self-reported";
+    if (code == UdiEntryType.UNKNOWN)
+      return "unknown";
+    return "?";
+  }
+
+    public String toSystem(UdiEntryType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UdiEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UdiEnumFactory.java
new file mode 100644
index 00000000000..ecbf4a49c7e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UdiEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class UdiEnumFactory implements EnumFactory {
+
+  public Udi fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("gudid".equals(codeString))
+      return Udi.GUDID;
+    throw new IllegalArgumentException("Unknown Udi code '"+codeString+"'");
+  }
+
+  public String toCode(Udi code) {
+    if (code == Udi.GUDID)
+      return "gudid";
+    return "?";
+  }
+
+    public String toSystem(Udi code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UnknownContentCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UnknownContentCode.java
new file mode 100644
index 00000000000..918b9f88087
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UnknownContentCode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum UnknownContentCode {
+
+        /**
+         * The application does not accept either unknown elements or extensions.
+         */
+        NO, 
+        /**
+         * The application accepts unknown extensions, but not unknown elements.
+         */
+        EXTENSIONS, 
+        /**
+         * The application accepts unknown elements, but not unknown extensions.
+         */
+        ELEMENTS, 
+        /**
+         * The application accepts unknown elements and extensions.
+         */
+        BOTH, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static UnknownContentCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("no".equals(codeString))
+          return NO;
+        if ("extensions".equals(codeString))
+          return EXTENSIONS;
+        if ("elements".equals(codeString))
+          return ELEMENTS;
+        if ("both".equals(codeString))
+          return BOTH;
+        throw new FHIRException("Unknown UnknownContentCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NO: return "no";
+            case EXTENSIONS: return "extensions";
+            case ELEMENTS: return "elements";
+            case BOTH: return "both";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/unknown-content-code";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NO: return "The application does not accept either unknown elements or extensions.";
+            case EXTENSIONS: return "The application accepts unknown extensions, but not unknown elements.";
+            case ELEMENTS: return "The application accepts unknown elements, but not unknown extensions.";
+            case BOTH: return "The application accepts unknown elements and extensions.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NO: return "Neither Elements or Extensions";
+            case EXTENSIONS: return "Unknown Extensions";
+            case ELEMENTS: return "Unknown Elements";
+            case BOTH: return "Unknown Elements and Extensions";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UnknownContentCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UnknownContentCodeEnumFactory.java
new file mode 100644
index 00000000000..343d9ab4b4b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UnknownContentCodeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class UnknownContentCodeEnumFactory implements EnumFactory {
+
+  public UnknownContentCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("no".equals(codeString))
+      return UnknownContentCode.NO;
+    if ("extensions".equals(codeString))
+      return UnknownContentCode.EXTENSIONS;
+    if ("elements".equals(codeString))
+      return UnknownContentCode.ELEMENTS;
+    if ("both".equals(codeString))
+      return UnknownContentCode.BOTH;
+    throw new IllegalArgumentException("Unknown UnknownContentCode code '"+codeString+"'");
+  }
+
+  public String toCode(UnknownContentCode code) {
+    if (code == UnknownContentCode.NO)
+      return "no";
+    if (code == UnknownContentCode.EXTENSIONS)
+      return "extensions";
+    if (code == UnknownContentCode.ELEMENTS)
+      return "elements";
+    if (code == UnknownContentCode.BOTH)
+      return "both";
+    return "?";
+  }
+
+    public String toSystem(UnknownContentCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UsageContextType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UsageContextType.java
new file mode 100644
index 00000000000..aae1946c29a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UsageContextType.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum UsageContextType {
+
+        /**
+         * The gender of the patient. For this context type, the value should be a code taken from the http://hl7.org/fhir/ValueSet/administrative-gender value set
+         */
+        GENDER, 
+        /**
+         * The age of the patient. For this context type, the value should be a range the specifies the applicable ages or a code from the MeSH value set http://hl7.org/fhir/ValueSet/v3-AgeGroupObservationValue
+         */
+        AGE, 
+        /**
+         * The clinical concept(s) addressed by the artifact. For example, disease, diagnostic test interpretation, medication ordering as in http://hl7.org/fhir/ValueSet/condition-code.
+         */
+        FOCUS, 
+        /**
+         * The clinical specialty of the context in which the patient is being treated - For example, PCP, Patient, Cardiologist, Behavioral Professional, Oral Health Professional, Prescriber, etc... taken from the NUCC Health Care provider taxonomy value set http://hl7.org/fhir/ValueSet/provider-taxonomy.
+         */
+        USER, 
+        /**
+         * The settings in which the artifact is intended for use. For example, admission, pre-op, etc. For example, the ActEncounterCode value set http://hl7.org/fhir/ValueSet/v3-ActEncounterCode
+         */
+        WORKFLOW, 
+        /**
+         * The context for the clinical task(s) represented by this artifact. Can be any task context represented by the HL7 ActTaskCode value set http://hl7.org/fhir/ValueSet/v3-ActTaskCode. General categories include: order entry, patient documentation and patient information review.
+         */
+        TASK, 
+        /**
+         * The venue in which an artifact could be used. For example, Outpatient, Inpatient, Home, Nursing home. The code value may originate from either the HL7 ActEncounterCode http://hl7.org/fhir/ValueSet/v3-ActEncounterCode or NUCC non-individual provider codes http://hl7.org/fhir/ValueSet/provider-taxonomy
+         */
+        VENUE, 
+        /**
+         * The species to which an artifact applies. For example, SNOMED - 387961004 | Kingdom Animalia (organism).
+         */
+        SPECIES, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static UsageContextType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("gender".equals(codeString))
+          return GENDER;
+        if ("age".equals(codeString))
+          return AGE;
+        if ("focus".equals(codeString))
+          return FOCUS;
+        if ("user".equals(codeString))
+          return USER;
+        if ("workflow".equals(codeString))
+          return WORKFLOW;
+        if ("task".equals(codeString))
+          return TASK;
+        if ("venue".equals(codeString))
+          return VENUE;
+        if ("species".equals(codeString))
+          return SPECIES;
+        throw new FHIRException("Unknown UsageContextType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GENDER: return "gender";
+            case AGE: return "age";
+            case FOCUS: return "focus";
+            case USER: return "user";
+            case WORKFLOW: return "workflow";
+            case TASK: return "task";
+            case VENUE: return "venue";
+            case SPECIES: return "species";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/usage-context-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GENDER: return "The gender of the patient. For this context type, the value should be a code taken from the http://hl7.org/fhir/ValueSet/administrative-gender value set";
+            case AGE: return "The age of the patient. For this context type, the value should be a range the specifies the applicable ages or a code from the MeSH value set http://hl7.org/fhir/ValueSet/v3-AgeGroupObservationValue";
+            case FOCUS: return "The clinical concept(s) addressed by the artifact. For example, disease, diagnostic test interpretation, medication ordering as in http://hl7.org/fhir/ValueSet/condition-code.";
+            case USER: return "The clinical specialty of the context in which the patient is being treated - For example, PCP, Patient, Cardiologist, Behavioral Professional, Oral Health Professional, Prescriber, etc... taken from the NUCC Health Care provider taxonomy value set http://hl7.org/fhir/ValueSet/provider-taxonomy.";
+            case WORKFLOW: return "The settings in which the artifact is intended for use. For example, admission, pre-op, etc. For example, the ActEncounterCode value set http://hl7.org/fhir/ValueSet/v3-ActEncounterCode";
+            case TASK: return "The context for the clinical task(s) represented by this artifact. Can be any task context represented by the HL7 ActTaskCode value set http://hl7.org/fhir/ValueSet/v3-ActTaskCode. General categories include: order entry, patient documentation and patient information review.";
+            case VENUE: return "The venue in which an artifact could be used. For example, Outpatient, Inpatient, Home, Nursing home. The code value may originate from either the HL7 ActEncounterCode http://hl7.org/fhir/ValueSet/v3-ActEncounterCode or NUCC non-individual provider codes http://hl7.org/fhir/ValueSet/provider-taxonomy";
+            case SPECIES: return "The species to which an artifact applies. For example, SNOMED - 387961004 | Kingdom Animalia (organism).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GENDER: return "Gender";
+            case AGE: return "Age Range";
+            case FOCUS: return "Clinical Focus";
+            case USER: return "User Type";
+            case WORKFLOW: return "Workflow Setting";
+            case TASK: return "Workflow Task";
+            case VENUE: return "Clinical Venue";
+            case SPECIES: return "Species";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UsageContextTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UsageContextTypeEnumFactory.java
new file mode 100644
index 00000000000..64c1c869060
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/UsageContextTypeEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class UsageContextTypeEnumFactory implements EnumFactory {
+
+  public UsageContextType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("gender".equals(codeString))
+      return UsageContextType.GENDER;
+    if ("age".equals(codeString))
+      return UsageContextType.AGE;
+    if ("focus".equals(codeString))
+      return UsageContextType.FOCUS;
+    if ("user".equals(codeString))
+      return UsageContextType.USER;
+    if ("workflow".equals(codeString))
+      return UsageContextType.WORKFLOW;
+    if ("task".equals(codeString))
+      return UsageContextType.TASK;
+    if ("venue".equals(codeString))
+      return UsageContextType.VENUE;
+    if ("species".equals(codeString))
+      return UsageContextType.SPECIES;
+    throw new IllegalArgumentException("Unknown UsageContextType code '"+codeString+"'");
+  }
+
+  public String toCode(UsageContextType code) {
+    if (code == UsageContextType.GENDER)
+      return "gender";
+    if (code == UsageContextType.AGE)
+      return "age";
+    if (code == UsageContextType.FOCUS)
+      return "focus";
+    if (code == UsageContextType.USER)
+      return "user";
+    if (code == UsageContextType.WORKFLOW)
+      return "workflow";
+    if (code == UsageContextType.TASK)
+      return "task";
+    if (code == UsageContextType.VENUE)
+      return "venue";
+    if (code == UsageContextType.SPECIES)
+      return "species";
+    return "?";
+  }
+
+    public String toSystem(UsageContextType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementCondition.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementCondition.java
new file mode 100644
index 00000000000..48de878278f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementCondition.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3AcknowledgementCondition {
+
+        /**
+         * Always send an acknowledgement.
+         */
+        AL, 
+        /**
+         * Send an acknowledgement for error/reject conditions only.
+         */
+        ER, 
+        /**
+         * Never send an acknowledgement.
+         */
+        NE, 
+        /**
+         * Send an acknowledgement for successful completions only.
+         */
+        SU, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3AcknowledgementCondition fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AL".equals(codeString))
+          return AL;
+        if ("ER".equals(codeString))
+          return ER;
+        if ("NE".equals(codeString))
+          return NE;
+        if ("SU".equals(codeString))
+          return SU;
+        throw new FHIRException("Unknown V3AcknowledgementCondition code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AL: return "AL";
+            case ER: return "ER";
+            case NE: return "NE";
+            case SU: return "SU";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/AcknowledgementCondition";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AL: return "Always send an acknowledgement.";
+            case ER: return "Send an acknowledgement for error/reject conditions only.";
+            case NE: return "Never send an acknowledgement.";
+            case SU: return "Send an acknowledgement for successful completions only.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AL: return "Always";
+            case ER: return "Error/reject only";
+            case NE: return "Never";
+            case SU: return "Successful only";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementConditionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementConditionEnumFactory.java
new file mode 100644
index 00000000000..aad084325d8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementConditionEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3AcknowledgementConditionEnumFactory implements EnumFactory {
+
+  public V3AcknowledgementCondition fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AL".equals(codeString))
+      return V3AcknowledgementCondition.AL;
+    if ("ER".equals(codeString))
+      return V3AcknowledgementCondition.ER;
+    if ("NE".equals(codeString))
+      return V3AcknowledgementCondition.NE;
+    if ("SU".equals(codeString))
+      return V3AcknowledgementCondition.SU;
+    throw new IllegalArgumentException("Unknown V3AcknowledgementCondition code '"+codeString+"'");
+  }
+
+  public String toCode(V3AcknowledgementCondition code) {
+    if (code == V3AcknowledgementCondition.AL)
+      return "AL";
+    if (code == V3AcknowledgementCondition.ER)
+      return "ER";
+    if (code == V3AcknowledgementCondition.NE)
+      return "NE";
+    if (code == V3AcknowledgementCondition.SU)
+      return "SU";
+    return "?";
+  }
+
+    public String toSystem(V3AcknowledgementCondition code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailCode.java
new file mode 100644
index 00000000000..ca14bb3fb87
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailCode.java
@@ -0,0 +1,321 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3AcknowledgementDetailCode {
+
+        /**
+         * Refelects rejections because elements of the communication are not supported in the current context.
+         */
+        _ACKNOWLEDGEMENTDETAILNOTSUPPORTEDCODE, 
+        /**
+         * The interaction (or: this version of the interaction) is not supported.
+         */
+        NS200, 
+        /**
+         * The Processing ID is not supported.
+         */
+        NS202, 
+        /**
+         * The Version ID is not supported.
+         */
+        NS203, 
+        /**
+         * The processing mode is not supported.
+         */
+        NS250, 
+        /**
+         * The Device.id of the sender is unknown.
+         */
+        NS260, 
+        /**
+         * The receiver requires information in the attentionLine classes for routing purposes.
+         */
+        NS261, 
+        /**
+         * An internal software component (database, application, queue mechanism, etc.) has failed, leading to inability to process the message.
+         */
+        INTERR, 
+        /**
+         * Rejection: The message can't be stored by the receiver due to an unspecified internal application issue. The message was neither processed nor stored by the receiving application.
+         */
+        NOSTORE, 
+        /**
+         * Error: The destination of this message is known to the receiving application. Messages have been successfully routed to that destination in the past. The link to the destination application or an intermediate application is unavailable.
+         */
+        RTEDEST, 
+        /**
+         * The destination of this message is unknown to the receiving application. The receiving application in the message does not match the application which received the message. The message was neither routed, processed nor stored by the receiving application.
+         */
+        RTUDEST, 
+        /**
+         * Warning: The destination of this message is known to the receiving application. Messages have been successfully routed to that destination in the past. The link to the destination application or an intermediate application is (temporarily) unavailable. The receiving application will forward the message as soon as the destination can be reached again.
+         */
+        RTWDEST, 
+        /**
+         * Reflects errors in the syntax or structure of the communication.
+         */
+        SYN, 
+        /**
+         * The attribute contained data of the wrong data type, e.g. a numeric attribute contained "FOO".
+         */
+        SYN102, 
+        /**
+         * Description: Required association or attribute missing in message; or the sequence of the classes is different than required by the standard or one of the conformance profiles identified in the message.
+         */
+        SYN105, 
+        /**
+         * Required association missing in message; or the sequence of the classes is different than required by the standard or one of the conformance profiles identified in the message.
+         */
+        SYN100, 
+        /**
+         * A required attribute is missing in a class.
+         */
+        SYN101, 
+        /**
+         * Description: The number of repetitions of a group of association or attributes is less than the required minimum for the standard or of one of the conformance profiles or templates identified in the message.
+         */
+        SYN114, 
+        /**
+         * Description: A coded attribute or datatype property violates one of the terminology constraints specified in the standard or one of the conformance profiles or templates declared by the instance.
+         */
+        SYN106, 
+        /**
+         * An attribute value was compared against the corresponding code system, and no match was found.
+         */
+        SYN103, 
+        /**
+         * An attribute value referenced a code system that is not valid for an attribute constrained to CNE.
+         */
+        SYN104, 
+        /**
+         * Description: A coded attribute is referencing a code that has been deprecated by the owning code system.
+         */
+        SYN107, 
+        /**
+         * Description: The number of repetitions of a (group of) association(s) or attribute(s) exceeds the limits of the standard or of one of the conformance profiles or templates identified in the message.
+         */
+        SYN108, 
+        /**
+         * The number of repetitions of a (group of) association(s) exceeds the limits of the standard or of one of the conformance profiles identified in the message.
+         */
+        SYN110, 
+        /**
+         * The number of repetitions of an attribute exceeds the limits of the standard or of one of the conformance profiles identified in the message.
+         */
+        SYN112, 
+        /**
+         * Description: An attribute or association identified as mandatory in a specification or declared conformance profile or template has been specified with a null flavor.
+         */
+        SYN109, 
+        /**
+         * Description: The value of an attribute or property differs from the fixed value asserted in the standard or one of the conformance profiles or templates declared in the message.
+         */
+        SYN111, 
+        /**
+         * Description: A formal constraint asserted in the standard or one of the conformance profiles or templates declared in the message has been violated.
+         */
+        SYN113, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3AcknowledgementDetailCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_AcknowledgementDetailNotSupportedCode".equals(codeString))
+          return _ACKNOWLEDGEMENTDETAILNOTSUPPORTEDCODE;
+        if ("NS200".equals(codeString))
+          return NS200;
+        if ("NS202".equals(codeString))
+          return NS202;
+        if ("NS203".equals(codeString))
+          return NS203;
+        if ("NS250".equals(codeString))
+          return NS250;
+        if ("NS260".equals(codeString))
+          return NS260;
+        if ("NS261".equals(codeString))
+          return NS261;
+        if ("INTERR".equals(codeString))
+          return INTERR;
+        if ("NOSTORE".equals(codeString))
+          return NOSTORE;
+        if ("RTEDEST".equals(codeString))
+          return RTEDEST;
+        if ("RTUDEST".equals(codeString))
+          return RTUDEST;
+        if ("RTWDEST".equals(codeString))
+          return RTWDEST;
+        if ("SYN".equals(codeString))
+          return SYN;
+        if ("SYN102".equals(codeString))
+          return SYN102;
+        if ("SYN105".equals(codeString))
+          return SYN105;
+        if ("SYN100".equals(codeString))
+          return SYN100;
+        if ("SYN101".equals(codeString))
+          return SYN101;
+        if ("SYN114".equals(codeString))
+          return SYN114;
+        if ("SYN106".equals(codeString))
+          return SYN106;
+        if ("SYN103".equals(codeString))
+          return SYN103;
+        if ("SYN104".equals(codeString))
+          return SYN104;
+        if ("SYN107".equals(codeString))
+          return SYN107;
+        if ("SYN108".equals(codeString))
+          return SYN108;
+        if ("SYN110".equals(codeString))
+          return SYN110;
+        if ("SYN112".equals(codeString))
+          return SYN112;
+        if ("SYN109".equals(codeString))
+          return SYN109;
+        if ("SYN111".equals(codeString))
+          return SYN111;
+        if ("SYN113".equals(codeString))
+          return SYN113;
+        throw new FHIRException("Unknown V3AcknowledgementDetailCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ACKNOWLEDGEMENTDETAILNOTSUPPORTEDCODE: return "_AcknowledgementDetailNotSupportedCode";
+            case NS200: return "NS200";
+            case NS202: return "NS202";
+            case NS203: return "NS203";
+            case NS250: return "NS250";
+            case NS260: return "NS260";
+            case NS261: return "NS261";
+            case INTERR: return "INTERR";
+            case NOSTORE: return "NOSTORE";
+            case RTEDEST: return "RTEDEST";
+            case RTUDEST: return "RTUDEST";
+            case RTWDEST: return "RTWDEST";
+            case SYN: return "SYN";
+            case SYN102: return "SYN102";
+            case SYN105: return "SYN105";
+            case SYN100: return "SYN100";
+            case SYN101: return "SYN101";
+            case SYN114: return "SYN114";
+            case SYN106: return "SYN106";
+            case SYN103: return "SYN103";
+            case SYN104: return "SYN104";
+            case SYN107: return "SYN107";
+            case SYN108: return "SYN108";
+            case SYN110: return "SYN110";
+            case SYN112: return "SYN112";
+            case SYN109: return "SYN109";
+            case SYN111: return "SYN111";
+            case SYN113: return "SYN113";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/AcknowledgementDetailCode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ACKNOWLEDGEMENTDETAILNOTSUPPORTEDCODE: return "Refelects rejections because elements of the communication are not supported in the current context.";
+            case NS200: return "The interaction (or: this version of the interaction) is not supported.";
+            case NS202: return "The Processing ID is not supported.";
+            case NS203: return "The Version ID is not supported.";
+            case NS250: return "The processing mode is not supported.";
+            case NS260: return "The Device.id of the sender is unknown.";
+            case NS261: return "The receiver requires information in the attentionLine classes for routing purposes.";
+            case INTERR: return "An internal software component (database, application, queue mechanism, etc.) has failed, leading to inability to process the message.";
+            case NOSTORE: return "Rejection: The message can't be stored by the receiver due to an unspecified internal application issue. The message was neither processed nor stored by the receiving application.";
+            case RTEDEST: return "Error: The destination of this message is known to the receiving application. Messages have been successfully routed to that destination in the past. The link to the destination application or an intermediate application is unavailable.";
+            case RTUDEST: return "The destination of this message is unknown to the receiving application. The receiving application in the message does not match the application which received the message. The message was neither routed, processed nor stored by the receiving application.";
+            case RTWDEST: return "Warning: The destination of this message is known to the receiving application. Messages have been successfully routed to that destination in the past. The link to the destination application or an intermediate application is (temporarily) unavailable. The receiving application will forward the message as soon as the destination can be reached again.";
+            case SYN: return "Reflects errors in the syntax or structure of the communication.";
+            case SYN102: return "The attribute contained data of the wrong data type, e.g. a numeric attribute contained \"FOO\".";
+            case SYN105: return "Description: Required association or attribute missing in message; or the sequence of the classes is different than required by the standard or one of the conformance profiles identified in the message.";
+            case SYN100: return "Required association missing in message; or the sequence of the classes is different than required by the standard or one of the conformance profiles identified in the message.";
+            case SYN101: return "A required attribute is missing in a class.";
+            case SYN114: return "Description: The number of repetitions of a group of association or attributes is less than the required minimum for the standard or of one of the conformance profiles or templates identified in the message.";
+            case SYN106: return "Description: A coded attribute or datatype property violates one of the terminology constraints specified in the standard or one of the conformance profiles or templates declared by the instance.";
+            case SYN103: return "An attribute value was compared against the corresponding code system, and no match was found.";
+            case SYN104: return "An attribute value referenced a code system that is not valid for an attribute constrained to CNE.";
+            case SYN107: return "Description: A coded attribute is referencing a code that has been deprecated by the owning code system.";
+            case SYN108: return "Description: The number of repetitions of a (group of) association(s) or attribute(s) exceeds the limits of the standard or of one of the conformance profiles or templates identified in the message.";
+            case SYN110: return "The number of repetitions of a (group of) association(s) exceeds the limits of the standard or of one of the conformance profiles identified in the message.";
+            case SYN112: return "The number of repetitions of an attribute exceeds the limits of the standard or of one of the conformance profiles identified in the message.";
+            case SYN109: return "Description: An attribute or association identified as mandatory in a specification or declared conformance profile or template has been specified with a null flavor.";
+            case SYN111: return "Description: The value of an attribute or property differs from the fixed value asserted in the standard or one of the conformance profiles or templates declared in the message.";
+            case SYN113: return "Description: A formal constraint asserted in the standard or one of the conformance profiles or templates declared in the message has been violated.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ACKNOWLEDGEMENTDETAILNOTSUPPORTEDCODE: return "AcknowledgementDetailNotSupportedCode";
+            case NS200: return "Unsupported interaction";
+            case NS202: return "Unsupported processing id";
+            case NS203: return "Unsupported version id";
+            case NS250: return "Unsupported processing Mode";
+            case NS260: return "Unknown sender";
+            case NS261: return "Unrecognized attentionline";
+            case INTERR: return "Internal system error";
+            case NOSTORE: return "No storage space for message.";
+            case RTEDEST: return "Message routing error, destination unreachable.";
+            case RTUDEST: return "Error: Message routing error, unknown destination.";
+            case RTWDEST: return "Message routing warning, destination unreachable.";
+            case SYN: return "Syntax error";
+            case SYN102: return "Data type error";
+            case SYN105: return "Required element missing";
+            case SYN100: return "Required association missing";
+            case SYN101: return "Required attribute missing";
+            case SYN114: return "Insufficient repetitions";
+            case SYN106: return "Terminology error";
+            case SYN103: return "Value not found in code system";
+            case SYN104: return "Invalid code system in CNE";
+            case SYN107: return "Deprecated code";
+            case SYN108: return "Number of repetitions exceeds limit";
+            case SYN110: return "Number of association repetitions exceeds limit";
+            case SYN112: return "Number of attribute repetitions exceeds limit";
+            case SYN109: return "Mandatory element with null value";
+            case SYN111: return "Value does not match fixed value";
+            case SYN113: return "Formal constraint violation";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailCodeEnumFactory.java
new file mode 100644
index 00000000000..5d2561d5dd6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailCodeEnumFactory.java
@@ -0,0 +1,166 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3AcknowledgementDetailCodeEnumFactory implements EnumFactory {
+
+  public V3AcknowledgementDetailCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_AcknowledgementDetailNotSupportedCode".equals(codeString))
+      return V3AcknowledgementDetailCode._ACKNOWLEDGEMENTDETAILNOTSUPPORTEDCODE;
+    if ("NS200".equals(codeString))
+      return V3AcknowledgementDetailCode.NS200;
+    if ("NS202".equals(codeString))
+      return V3AcknowledgementDetailCode.NS202;
+    if ("NS203".equals(codeString))
+      return V3AcknowledgementDetailCode.NS203;
+    if ("NS250".equals(codeString))
+      return V3AcknowledgementDetailCode.NS250;
+    if ("NS260".equals(codeString))
+      return V3AcknowledgementDetailCode.NS260;
+    if ("NS261".equals(codeString))
+      return V3AcknowledgementDetailCode.NS261;
+    if ("INTERR".equals(codeString))
+      return V3AcknowledgementDetailCode.INTERR;
+    if ("NOSTORE".equals(codeString))
+      return V3AcknowledgementDetailCode.NOSTORE;
+    if ("RTEDEST".equals(codeString))
+      return V3AcknowledgementDetailCode.RTEDEST;
+    if ("RTUDEST".equals(codeString))
+      return V3AcknowledgementDetailCode.RTUDEST;
+    if ("RTWDEST".equals(codeString))
+      return V3AcknowledgementDetailCode.RTWDEST;
+    if ("SYN".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN;
+    if ("SYN102".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN102;
+    if ("SYN105".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN105;
+    if ("SYN100".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN100;
+    if ("SYN101".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN101;
+    if ("SYN114".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN114;
+    if ("SYN106".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN106;
+    if ("SYN103".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN103;
+    if ("SYN104".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN104;
+    if ("SYN107".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN107;
+    if ("SYN108".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN108;
+    if ("SYN110".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN110;
+    if ("SYN112".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN112;
+    if ("SYN109".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN109;
+    if ("SYN111".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN111;
+    if ("SYN113".equals(codeString))
+      return V3AcknowledgementDetailCode.SYN113;
+    throw new IllegalArgumentException("Unknown V3AcknowledgementDetailCode code '"+codeString+"'");
+  }
+
+  public String toCode(V3AcknowledgementDetailCode code) {
+    if (code == V3AcknowledgementDetailCode._ACKNOWLEDGEMENTDETAILNOTSUPPORTEDCODE)
+      return "_AcknowledgementDetailNotSupportedCode";
+    if (code == V3AcknowledgementDetailCode.NS200)
+      return "NS200";
+    if (code == V3AcknowledgementDetailCode.NS202)
+      return "NS202";
+    if (code == V3AcknowledgementDetailCode.NS203)
+      return "NS203";
+    if (code == V3AcknowledgementDetailCode.NS250)
+      return "NS250";
+    if (code == V3AcknowledgementDetailCode.NS260)
+      return "NS260";
+    if (code == V3AcknowledgementDetailCode.NS261)
+      return "NS261";
+    if (code == V3AcknowledgementDetailCode.INTERR)
+      return "INTERR";
+    if (code == V3AcknowledgementDetailCode.NOSTORE)
+      return "NOSTORE";
+    if (code == V3AcknowledgementDetailCode.RTEDEST)
+      return "RTEDEST";
+    if (code == V3AcknowledgementDetailCode.RTUDEST)
+      return "RTUDEST";
+    if (code == V3AcknowledgementDetailCode.RTWDEST)
+      return "RTWDEST";
+    if (code == V3AcknowledgementDetailCode.SYN)
+      return "SYN";
+    if (code == V3AcknowledgementDetailCode.SYN102)
+      return "SYN102";
+    if (code == V3AcknowledgementDetailCode.SYN105)
+      return "SYN105";
+    if (code == V3AcknowledgementDetailCode.SYN100)
+      return "SYN100";
+    if (code == V3AcknowledgementDetailCode.SYN101)
+      return "SYN101";
+    if (code == V3AcknowledgementDetailCode.SYN114)
+      return "SYN114";
+    if (code == V3AcknowledgementDetailCode.SYN106)
+      return "SYN106";
+    if (code == V3AcknowledgementDetailCode.SYN103)
+      return "SYN103";
+    if (code == V3AcknowledgementDetailCode.SYN104)
+      return "SYN104";
+    if (code == V3AcknowledgementDetailCode.SYN107)
+      return "SYN107";
+    if (code == V3AcknowledgementDetailCode.SYN108)
+      return "SYN108";
+    if (code == V3AcknowledgementDetailCode.SYN110)
+      return "SYN110";
+    if (code == V3AcknowledgementDetailCode.SYN112)
+      return "SYN112";
+    if (code == V3AcknowledgementDetailCode.SYN109)
+      return "SYN109";
+    if (code == V3AcknowledgementDetailCode.SYN111)
+      return "SYN111";
+    if (code == V3AcknowledgementDetailCode.SYN113)
+      return "SYN113";
+    return "?";
+  }
+
+    public String toSystem(V3AcknowledgementDetailCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailType.java
new file mode 100644
index 00000000000..2c28c60b6c8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailType.java
@@ -0,0 +1,135 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3AcknowledgementDetailType {
+
+        /**
+         * Definition:An issue which has prevented, or will prevent (unless a management is provided for the issue by the sender), the successful processing of an interaction.  Response interactions which include an issue which is an Error are a 'rejection', indicating that the request was not successfully processed. 
+
+                        
+                           Example:Unable to find specified patient.
+         */
+        E, 
+        /**
+         * Definition: The message relates to an issue which has no bearing on the successful processing of the request.  Information issues cannot be overridden by specifying a management.
+
+                        
+                           Example: A Patient's coverage will expire in 5 days.
+         */
+        I, 
+        /**
+         * Definition: The message relates to an issue which cannot prevent the successful processing of a request, but which could result in the processing not having the ideal or intended effect.  Managing a warning issue is not required for successful processing, but will suppress the warning from being raised. 
+
+                        
+                           Example:
+                        
+
+                        Unexpected additional repetitions of phone number have been ignored.
+         */
+        W, 
+        /**
+         * null
+         */
+        ERR, 
+        /**
+         * null
+         */
+        INFO, 
+        /**
+         * null
+         */
+        WARN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3AcknowledgementDetailType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("E".equals(codeString))
+          return E;
+        if ("I".equals(codeString))
+          return I;
+        if ("W".equals(codeString))
+          return W;
+        if ("ERR".equals(codeString))
+          return ERR;
+        if ("INFO".equals(codeString))
+          return INFO;
+        if ("WARN".equals(codeString))
+          return WARN;
+        throw new FHIRException("Unknown V3AcknowledgementDetailType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case E: return "E";
+            case I: return "I";
+            case W: return "W";
+            case ERR: return "ERR";
+            case INFO: return "INFO";
+            case WARN: return "WARN";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/AcknowledgementDetailType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case E: return "Definition:An issue which has prevented, or will prevent (unless a management is provided for the issue by the sender), the successful processing of an interaction.  Response interactions which include an issue which is an Error are a 'rejection', indicating that the request was not successfully processed. \r\n\n                        \n                           Example:Unable to find specified patient.";
+            case I: return "Definition: The message relates to an issue which has no bearing on the successful processing of the request.  Information issues cannot be overridden by specifying a management.\r\n\n                        \n                           Example: A Patient's coverage will expire in 5 days.";
+            case W: return "Definition: The message relates to an issue which cannot prevent the successful processing of a request, but which could result in the processing not having the ideal or intended effect.  Managing a warning issue is not required for successful processing, but will suppress the warning from being raised. \r\n\n                        \n                           Example:\n                        \r\n\n                        Unexpected additional repetitions of phone number have been ignored.";
+            case ERR: return "";
+            case INFO: return "";
+            case WARN: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case E: return "Error";
+            case I: return "Information";
+            case W: return "Warning";
+            case ERR: return "ERR";
+            case INFO: return "INFO";
+            case WARN: return "WARN";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailTypeEnumFactory.java
new file mode 100644
index 00000000000..402883a83df
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementDetailTypeEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3AcknowledgementDetailTypeEnumFactory implements EnumFactory {
+
+  public V3AcknowledgementDetailType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("E".equals(codeString))
+      return V3AcknowledgementDetailType.E;
+    if ("I".equals(codeString))
+      return V3AcknowledgementDetailType.I;
+    if ("W".equals(codeString))
+      return V3AcknowledgementDetailType.W;
+    if ("ERR".equals(codeString))
+      return V3AcknowledgementDetailType.ERR;
+    if ("INFO".equals(codeString))
+      return V3AcknowledgementDetailType.INFO;
+    if ("WARN".equals(codeString))
+      return V3AcknowledgementDetailType.WARN;
+    throw new IllegalArgumentException("Unknown V3AcknowledgementDetailType code '"+codeString+"'");
+  }
+
+  public String toCode(V3AcknowledgementDetailType code) {
+    if (code == V3AcknowledgementDetailType.E)
+      return "E";
+    if (code == V3AcknowledgementDetailType.I)
+      return "I";
+    if (code == V3AcknowledgementDetailType.W)
+      return "W";
+    if (code == V3AcknowledgementDetailType.ERR)
+      return "ERR";
+    if (code == V3AcknowledgementDetailType.INFO)
+      return "INFO";
+    if (code == V3AcknowledgementDetailType.WARN)
+      return "WARN";
+    return "?";
+  }
+
+    public String toSystem(V3AcknowledgementDetailType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementType.java
new file mode 100644
index 00000000000..371a5607bf8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementType.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3AcknowledgementType {
+
+        /**
+         * Receiving application successfully processed message.
+         */
+        AA, 
+        /**
+         * Receiving application found error in processing message.  Sending error response with additional error detail information.
+         */
+        AE, 
+        /**
+         * Receiving application failed to process message for reason unrelated to content or format.  Original message sender must decide on whether to automatically send message again.
+         */
+        AR, 
+        /**
+         * Receiving message handling service accepts responsibility for passing message onto receiving application.
+         */
+        CA, 
+        /**
+         * Receiving message handling service cannot accept message for any other reason (e.g. message sequence number, etc.).
+         */
+        CE, 
+        /**
+         * Receiving message handling service rejects message if interaction identifier, version or processing mode is incompatible with known receiving application role information.
+         */
+        CR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3AcknowledgementType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AA".equals(codeString))
+          return AA;
+        if ("AE".equals(codeString))
+          return AE;
+        if ("AR".equals(codeString))
+          return AR;
+        if ("CA".equals(codeString))
+          return CA;
+        if ("CE".equals(codeString))
+          return CE;
+        if ("CR".equals(codeString))
+          return CR;
+        throw new FHIRException("Unknown V3AcknowledgementType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AA: return "AA";
+            case AE: return "AE";
+            case AR: return "AR";
+            case CA: return "CA";
+            case CE: return "CE";
+            case CR: return "CR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/AcknowledgementType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AA: return "Receiving application successfully processed message.";
+            case AE: return "Receiving application found error in processing message.  Sending error response with additional error detail information.";
+            case AR: return "Receiving application failed to process message for reason unrelated to content or format.  Original message sender must decide on whether to automatically send message again.";
+            case CA: return "Receiving message handling service accepts responsibility for passing message onto receiving application.";
+            case CE: return "Receiving message handling service cannot accept message for any other reason (e.g. message sequence number, etc.).";
+            case CR: return "Receiving message handling service rejects message if interaction identifier, version or processing mode is incompatible with known receiving application role information.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AA: return "Application Acknowledgement Accept";
+            case AE: return "Application Acknowledgement Error";
+            case AR: return "Application Acknowledgement Reject";
+            case CA: return "Accept Acknowledgement Commit Accept";
+            case CE: return "Accept Acknowledgement Commit Error";
+            case CR: return "Accept Acknowledgement Commit Reject";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementTypeEnumFactory.java
new file mode 100644
index 00000000000..865a51fe7ca
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AcknowledgementTypeEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3AcknowledgementTypeEnumFactory implements EnumFactory {
+
+  public V3AcknowledgementType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AA".equals(codeString))
+      return V3AcknowledgementType.AA;
+    if ("AE".equals(codeString))
+      return V3AcknowledgementType.AE;
+    if ("AR".equals(codeString))
+      return V3AcknowledgementType.AR;
+    if ("CA".equals(codeString))
+      return V3AcknowledgementType.CA;
+    if ("CE".equals(codeString))
+      return V3AcknowledgementType.CE;
+    if ("CR".equals(codeString))
+      return V3AcknowledgementType.CR;
+    throw new IllegalArgumentException("Unknown V3AcknowledgementType code '"+codeString+"'");
+  }
+
+  public String toCode(V3AcknowledgementType code) {
+    if (code == V3AcknowledgementType.AA)
+      return "AA";
+    if (code == V3AcknowledgementType.AE)
+      return "AE";
+    if (code == V3AcknowledgementType.AR)
+      return "AR";
+    if (code == V3AcknowledgementType.CA)
+      return "CA";
+    if (code == V3AcknowledgementType.CE)
+      return "CE";
+    if (code == V3AcknowledgementType.CR)
+      return "CR";
+    return "?";
+  }
+
+    public String toSystem(V3AcknowledgementType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActClass.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActClass.java
new file mode 100644
index 00000000000..29463722ce2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActClass.java
@@ -0,0 +1,1760 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActClass {
+
+        /**
+         * A record of something that is being done, has been done, can be done, or is intended or requested to be done.
+
+                        
+                           Examples:The kinds of acts that are common in health care are (1) a clinical observation, (2) an assessment of health condition (such as problems and diagnoses), (3) healthcare goals, (4) treatment services (such as medication, surgery, physical and psychological therapy), (5) assisting, monitoring or attending, (6) training and education services to patients and their next of kin, (7) and notary services (such as advanced directives or living will), (8)  editing and maintaining documents, and many others.
+
+                        
+                           Discussion and Rationale: Acts are the pivot of the RIM; all domain information and processes are represented primarily in Acts. Any profession or business, including healthcare, is primarily constituted of intentional and occasionally non-intentional actions, performed and recorded by responsible actors. An Act-instance is a record of such an action.
+
+                        Acts connect to Entities in their Roles through Participations and connect to other Acts through ActRelationships. Participations are the authors, performers and other responsible parties as well as subjects and beneficiaries (which includes tools and material used in the performance of the act, which are also subjects). The moodCode distinguishes between Acts that are meant as factual records, vs. records of intended or ordered services, and the other modalities in which act can appear.
+
+                        One of the Participations that all acts have (at least implicitly) is a primary author, who is responsible of the Act and who "owns" the act. Responsibility for the act means responsibility for what is being stated in the Act and as what it is stated. Ownership of the act is assumed in the sense of who may operationally modify the same act. Ownership and responsibility of the Act is not the same as ownership or responsibility of what the Act-object refers to in the real world. The same real world activity can be described by two people, each being the author of their Act, describing the same real world activity. Yet one can be a witness while the other can be a principal performer. The performer has responsibilities for the physical actions; the witness only has responsibility for making a true statement to the best of his or her ability. The two Act-instances may even disagree, but because each is properly attributed to its author, such disagreements can exist side by side and left to arbitration by a recipient of these Act-instances.
+
+                        In this sense, an Act-instance represents a "statement" according to Rector and Nowlan (1991) [Foundations for an electronic medical record. Methods Inf Med. 30.]  Rector and Nowlan have emphasized the importance of understanding the medical record not as a collection of facts, but "a faithful record of what clinicians have heard, seen, thought, and done." Rector and Nowlan go on saying that "the other requirements for a medical record, e.g., that it be attributable and permanent, follow naturally from this view." Indeed the Act class is this attributable statement, and the rules of updating acts (discussed in the state-transition model, see Act.statusCode) versus generating new Act-instances are designed according to this principle of permanent attributable statements.
+
+                        Rector and Nolan focus on the electronic medical record as a collection of statements, while attributed statements, these are still mostly factual statements. However, the Act class goes beyond this limitation to attributed factual statements, representing what is known as "speech-acts" in linguistics and philosophy.  The notion of speech-act includes that there is pragmatic meaning in language utterances, aside from just factual statements; and that these utterances interact with the real world to change the state of affairs, even directly cause physical activities to happen. For example, an order is a speech act that (provided it is issued adequately) will cause the ordered action to be physically performed. The speech act theory has culminated in the seminal work by Austin (1962) [How to do things with words. Oxford University Press].
+
+                        An activity in the real world may progress from defined, through planned and ordered to executed, which is represented as the mood of the Act. Even though one might think of a single activity as progressing from planned to executed, this progression is reflected by multiple Act-instances, each having one and only one mood that will not change along the Act-instance life cycle.  This is because the attribution and content of speech acts along this progression of an activity may be different, and it is often critical that a permanent and faithful record be maintained of this progression. The specification of orders or promises or plans must not be overwritten by the specification of what was actually done, so as to allow comparing actions with their earlier specifications. Act-instances that describe this progression of the same real world activity are linked through the ActRelationships (of the relationship category "sequel").
+
+                        Act as statements or speech-acts are the only representation of real world facts or processes in the HL7 RIM. The truth about the real world is constructed through a combination (and arbitration) of such attributed statements only, and there is no class in the RIM whose objects represent "objective state of affairs" or "real processes" independent from attributed statements. As such, there is no distinction between an activity and its documentation. Every Act includes both to varying degrees. For example, a factual statement made about recent (but past) activities, authored (and signed) by the performer of such activities, is commonly known as a procedure report or original documentation (e.g., surgical procedure report, clinic note etc.). Conversely, a status update on an activity that is presently in progress, authored by the performer (or a close observer) is considered to capture that activity (and is later superceded by a full procedure report). However, both status update and procedure report are acts of the same kind, only distinguished by mood and state (see statusCode) and completeness of the information.
+         */
+        ACT, 
+        /**
+         * Used to group a set of acts sharing a common context. Organizer structures can nest within other context structures - such as where a document is contained within a folder, or a folder is contained within an EHR extract.
+         */
+        _ACTCLASSRECORDORGANIZER, 
+        /**
+         * A context representing a grouped commitment of information to the EHR. It is considered the unit of modification of the record, the unit of transmission in record extracts, and the unit of attestation by authorizing clinicians.
+
+                        A composition represents part of a patient record originating from a single interaction between an authenticator and the record.
+
+                        Unless otherwise stated all statements within a composition have the same authenticator, apply to the same patient and were recorded in a single session of use of a single application.
+
+                        A composition contains organizers and entries.
+         */
+        COMPOSITION, 
+        /**
+         * The notion of a document comes particularly from the paper world, where it corresponds to the contents recorded on discrete pieces of paper. In the electronic world, a document is a kind of composition that bears resemblance to their paper world counter-parts. Documents typically are meant to be human-readable.
+
+                        HL7's notion of document differs from that described in the W3C XML Recommendation, in which a document refers specifically to the contents that fall between the root element's start-tag and end-tag. Not all XML documents are HL7 documents.
+         */
+        DOC, 
+        /**
+         * A clinical document is a documentation of clinical observations and services, with the following characteristics:
+
+                        
+                           
+                              Persistence - A clinical document continues to exist in an unaltered state, for a time period defined by local and regulatory requirements; 
+
+                           
+                           
+                              Stewardship - A clinical document is maintained by a person or organization entrusted with its care; 
+
+                           
+                           
+                              Potential for authentication - A clinical document is an assemblage of information that is intended to be legally authenticated; 
+
+                           
+                           
+                              Wholeness - Authentication of a clinical document applies to the whole and does not apply to portions of the document without the full context of the document;
+
+                           
+                           
+                              Human readability - A clinical document is human readable.
+         */
+        DOCCLIN, 
+        /**
+         * A clinical document that conforms to Level One of the HL7 Clinical Document Architecture (CDA)
+         */
+        CDALVLONE, 
+        /**
+         * Description: Container of clinical statements. Navigational. No semantic content. Knowledge of the section code is not required to interpret contained observations. Represents a heading in a heading structure, or "container tree".
+
+                        The record entries relating to a single clinical session are usually grouped under headings that represent phases of the encounter, or assist with layout and navigation. Clinical headings usually reflect the clinical workflow during a care session, and might also reflect the main author's reasoning processes. Much research has demonstrated that headings are used differently by different professional groups and specialties, and that headings are not used consistently enough to support safe automatic processing of the E H R.
+         */
+        CONTAINER, 
+        /**
+         * A group of entries within a composition or topic that have a common characteristic - for example, Examination, Diagnosis, Management OR Subjective, Objective, Analysis, Plan.
+
+                        The distinction from Topic relates to value sets. For Category there is a bounded list of things like "Examination", "Diagnosis" or SOAP categories. For Topic the list is wide open to any clinical condition or reason for a part of an encounter.
+
+                        A CATEGORY MAY CONTAIN ENTRIES.
+         */
+        CATEGORY, 
+        /**
+         * A context that distinguishes the body of a document from the document header. This is seen, for instance, in HTML documents, which have discrete  and  elements.
+         */
+        DOCBODY, 
+        /**
+         * A context that subdivides the body of a document. Document sections are typically used for human navigation, to give a reader a clue as to the expected content. Document sections are used to organize and provide consistency to the contents of a document body. Document sections can contain document sections and can contain entries.
+         */
+        DOCSECT, 
+        /**
+         * A group of entries within a composition that are related to a common clinical theme - such as a specific disorder or problem, prevention, screening and provision of contraceptive services.
+
+                        A topic may contain categories and entries.
+         */
+        TOPIC, 
+        /**
+         * This context represents the part of a patient record conveyed in a single communication. It is drawn from a providing system for the purposes of communication to a requesting process (which might be another repository, a client application or a middleware service such as an electronic guideline engine), and supporting the faithful inclusion of the communicated data in the receiving system.
+
+                        An extract may be the entirety of the patient record as held by the sender or it may be a part of that record (e.g. changes since a specified date).
+
+                        An extract contains folders or compositions.
+
+                        An extract cannot contain another extract.
+         */
+        EXTRACT, 
+        /**
+         * A context that comprises all compositions. The EHR is an extract that includes the entire chart.
+
+                        
+                           NOTE: In an exchange scenario, an EHR is a specialization of an extract.
+         */
+        EHR, 
+        /**
+         * A context representing the high-level organization of an extract e.g. to group parts of the record by episode, care team, clinical specialty, clinical condition, or source application. Internationally, this kind of organizing structure is used variably: in some centers and systems the folder is treated as an informal compartmentalization of the overall health record; in others it might represent a significant legal portion of the EHR relating to the originating enterprise or team.
+
+                        A folder contains compositions.
+
+                        Folders may be nested within folders.
+         */
+        FOLDER, 
+        /**
+         * Definition: An ACT that organizes a set of component acts into a semantic grouping that share a particular context such as timeframe, patient, etc.
+
+                        
+                           UsageNotes: The focus in a GROUPER act is the grouping of the contained acts.  For example "a request to group" (RQO), "a type of grouping that is allowed to occur" (DEF), etc.
+
+                        Unlike WorkingList, which represents a dynamic, shared, continuously updated collection to provide a "view" of a set of objects, GROUPER collections tend to be static and simply indicate a shared set of semantics.  Note that sharing of semantics can be achieved using ACT as well.  However, with GROUPER, the sole semantic is of grouping.
+         */
+        GROUPER, 
+        /**
+         * Description:An ACT that organizes a set of component acts into a semantic grouping that have a shared subject. The subject may be either a subject participation (SBJ), subject act relationship (SUBJ), or child participation/act relationship types.
+
+                        
+                           Discussion: The focus in a CLUSTER act is the grouping of the contained acts.  For example "a request to cluster" (RQO), "a type of cluster that is allowed to occur" (DEF), etc.
+
+                        
+                           Examples: 
+                        
+
+                        
+                           
+                              Radiologic investigations that might include administration of a dye, followed by radiographic observations;
+
+                           
+                           
+                              "Isolate cluster" which includes all testing and specimen processing performed on a specific isolate;
+
+                           
+                           
+                              a set of actions to perform at a particular stage in a clinical trial.
+         */
+        CLUSTER, 
+        /**
+         * An accommodation is a service provided for a Person or other LivingSubject in which a place is provided for the subject to reside for a period of time.  Commonly used to track the provision of ward, private and semi-private accommodations for a patient.
+         */
+        ACCM, 
+        /**
+         * A financial account established to track the net result of financial acts.
+         */
+        ACCT, 
+        /**
+         * A unit of work, a grouper of work items as defined by the system performing that work. Typically some laboratory order fulfillers communicate references to accessions in their communications regarding laboratory orders. Often one or more specimens are related to an accession such that in some environments the accession number is taken as an identifier for a specimen (group).
+         */
+        ACSN, 
+        /**
+         * A transformation process where a requested invoice is transformed into an agreed invoice.  Represents the adjudication processing of an invoice (claim).  Adjudication results can be adjudicated as submitted, with adjustments or refused.
+
+                        Adjudication results comprise 2 components: the adjudication processing results and a restated (or adjudicated) invoice or claim
+         */
+        ADJUD, 
+        /**
+         * An act representing a system action such as the change of state of another act or the initiation of a query.  All control acts represent trigger events in the HL7 context.  ControlActs may occur in different moods.
+         */
+        CACT, 
+        /**
+         * Sender asks addressee to do something depending on the focal Act of the payload.  An example is "fulfill this order".  Addressee has responsibilities to either reject the message or to act on it in an appropriate way (specified by the specific receiver responsibilities for the interaction).
+         */
+        ACTN, 
+        /**
+         * Sender sends payload to addressee as information.  Addressee does not have responsibilities beyond serving addressee's own interest (i.e., read and memorize if you see fit).  This is equivalent to an FYI on a memo.
+         */
+        INFO, 
+        /**
+         * Description: Sender transmits a status change pertaining to the focal act of the payload. This status of the focal act is the final state of the state transition. This can be either a request or an event, according to the mood of the control act.
+         */
+        STC, 
+        /**
+         * An agreement of obligation between two or more parties that is subject to contractual law and enforcement.
+         */
+        CNTRCT, 
+        /**
+         * A contract whose value is measured in monetary terms.
+         */
+        FCNTRCT, 
+        /**
+         * When used in the EVN mood, this concept means with respect to a covered party:
+
+                        
+                           
+                              A health care insurance policy or plan that is contractually binding between two or more parties; or 
+
+                           
+                           
+                              A health care program, usually administered by government entities, that provides coverage to persons determined eligible under the terms of the program.
+
+                           
+                        
+                        
+                           
+                              When used in the definition (DEF) mood, COV means potential coverage for a patient who may or may not be a covered party.
+
+                           
+                           
+                              The concept's meaning is fully specified by the choice of ActCoverageTypeCode (abstract) ActProgramCode or ActInsurancePolicyCode.
+         */
+        COV, 
+        /**
+         * Definition: A worry that tends to persist over time and has as its subject a state or process. The subject of the worry has the potential to require intervention or management.
+
+                        
+                           Examples: an observation result, procedure, substance administration, equipment repair status, device recall status, a health risk, a financial risk, public health risk, pregnancy, health maintenance, allergy, and acute or chronic illness.
+         */
+        CONC, 
+        /**
+         * A public health case is a Concern about an observation or event that has a specific significance for public health. The creation of a PublicHealthCase initiates the tracking of the object of concern.  The decision to track is related to but somewhat independent of the underlying event or observation.
+
+                        
+                           UsageNotes: Typically a Public Health Case involves an instance or instances of a reportable infectious disease or other condition. The public health case can include a health-related event concerning a single individual or it may refer to multiple health-related events that are occurrences of the same disease or condition of interest to public health.
+
+                        A public health case definition (Act.moodCode = "definition") includes the description of the clinical, laboratory, and epidemiologic indicators associated with a disease or condition of interest to public health. There are case definitions for conditions that are reportable, as well as for those that are not. A public health case definition is a construct used by public health for the purpose of counting cases, and should not be used as clinical indications for treatment. Examples include AIDS, toxic-shock syndrome, and salmonellosis and their associated indicators that are used to define a case.
+         */
+        HCASE, 
+        /**
+         * An Outbreak is a concern resulting from a series of public health cases.
+
+                        
+                           UsageNotes: The date on which an outbreak starts is the earliest date of onset among the cases assigned to the outbreak and its ending date is the last date of onset among the cases assigned to the outbreak. The effectiveTime attribute is used to convey the relevant dates for the case. An outbreak definition (Act.moodCode = "definition" includes the criteria for the number, types and occurrence pattern of cases necessary to declare an outbreak and to judge the severity of an outbreak.
+         */
+        OUTBR, 
+        /**
+         * The Consent class represents informed consents and all similar medico-legal transactions between the patient (or his legal guardian) and the provider. Examples are informed consent for surgical procedures, informed consent for clinical trials, advanced beneficiary notice, against medical advice decline from service, release of information agreement, etc.
+
+                        The details of consents vary. Often an institution has a number of different consent forms for various purposes, including reminding the physician about the topics to mention. Such forms also include patient education material. In electronic medical record communication, consents thus are information-generating acts on their own and need to be managed similar to medical activities. Thus, Consent is modeled as a special class of Act.
+
+                        The "signatures" to the consent document are represented electronically through Participation instances to the consent object. Typically an informed consent has Participation.typeCode of "performer", the healthcare provider informing the patient, and "consenter", the patient or legal guardian. Some consent may associate a witness or a notary public (e.g., living wills, advanced directives). In consents where a healthcare provider is not required (e.g. living will), the performer may be the patient himself or a notary public.
+
+                        Some consent has a minimum required delay between the consent and the service, so as to allow the patient to rethink his decisions. This minimum delay can be expressed in the act definition by the ActRelationship.pauseQuantity attribute that delays the service until the pause time has elapsed after the consent has been completed.
+         */
+        CONS, 
+        /**
+         * An Act where a container is registered either via an automated sensor, such as a barcode reader,  or by manual receipt
+         */
+        CONTREG, 
+        /**
+         * An identified point during a clinical trial at which one or more actions are scheduled to be performed (definition mood), or are actually performed (event mood).  The actions may or may not involve an encounter between the subject and a healthcare professional.
+         */
+        CTTEVENT, 
+        /**
+         * An action taken with respect to a subject Entity by a regulatory or authoritative body with supervisory capacity over that entity. The action is taken in response to behavior by the subject Entity that body finds to be 							undesirable.
+
+                        Suspension, license restrictions, monetary fine, letter of reprimand, mandated training, mandated supervision, etc.Examples:
+         */
+        DISPACT, 
+        /**
+         * An interaction between entities that provides opportunity for transmission of a physical, chemical, or biological agent from an exposure source entity to an exposure target entity.
+
+                        
+                           Examples:  The following examples are provided to indicate what interactions are considered exposures rather than other types of Acts:
+
+                        
+                           
+                              A patient accidentally receives three times the recommended dose of their medication due to a dosing error. 
+
+                              
+                                 
+                                    This is a substance administration.  Public health and/or safety authorities may also be interested in documenting this with an associated exposure.
+
+                                 
+                              
+                           
+                           
+                              A patient accidentally is dispensed an incorrect medicine (e.g., clomiphene instead of clomipramine).  They have taken several doses before the mistake is detected.  They are therefore "exposed" to a medicine that there was no therapeutic indication for them to receive. 
+
+                              
+                                 
+                                    There are several substance administrations in this example.  Public health and/or safety authorities may also be interested in documenting this with associated exposures.
+
+                                 
+                              
+                           
+                           
+                              In a busy medical ward, a patient is receiving chemotherapy for a lymphoma.  Unfortunately, the IV infusion bag containing the medicine splits, spraying cytotoxic medication over the patient being treated and the patient in the adjacent bed. 
+
+                              
+                                 
+                                    There are three substance administrations in this example.  The first is the intended one (IV infusion) with its associated (implicit) exposure.  There is an incident with an associated substance administration to the same patient involving the medication sprayed over the patient as well as an associated exposure.  Additionally, the incident includes a substance administration involving the spraying of medication on the adjacent patient, also with an associated exposure.
+
+                                 
+                              
+                           
+                           
+                              A patient who is a refugee from a war-torn African nation arrives in a busy inner city A&E department suffering from a cough with bloody sputum.  Not understanding the registration and triage process, they sit in the waiting room for several hours before it is noticed that they have not booked in.  As soon as they are being processed, it is suspected that they are suffering from TB.  Vulnerable (immunosuppressed) patients who were sharing the waiting room with this patient may have been exposed to the tubercule bacillus, and must be traced for investigation. 
+
+                              
+                                 
+                                    This is an exposure (or possibly multiple exposures) in the waiting room involving the refugee and everyone else in the waiting room during the period.  There might also be a number of known or presumed substance administrations (coughing) via several possible routes.  The substance administrations are only hypotheses until confirmed by further testing.
+
+                                 
+                              
+                           
+                           
+                              A patient who has received an elective total hip replacement procedure suffers a prolonged stay in hospital, due to contracting an MRSA infection in the surgical wound site after the surgery. 
+
+                              
+                                 
+                                    This is an exposure to MRSA.  Although there was some sort of substance administration, it's possible the exact mechanism for introduction of the MRSA into the wound will not be identified.
+
+                                 
+                              
+                           
+                           
+                              Routine maintenance of the X-ray machines at a local hospital reveals a serious breach of the shielding on one of the machines.  Patients who have undergone investigations using that machine in the last month are likely to have been exposed to significantly higher doses of X-rays than was intended, and must be tracked for possible adverse effects. 
+
+                              
+                                 
+                                    There has been an exposure of each patient who used the machine in the past 30 days. Some patients may have had substance administrations.
+
+                                 
+                              
+                           
+                           
+                              A new member of staff is employed in the laundry processing room of a small cottage hospital, and a misreading of the instructions for adding detergents results in fifty times the usual concentration of cleaning materials being added to a batch of hospital bedding.  As a result, several patients have been exposed to very high levels of detergents still present in the "clean" bedding, and have experienced dermatological reactions to this. 
+
+                              
+                                 
+                                    There has been an incident with multiple exposures to several patients.  Although there are substance administrations involving the application of the detergent to the skin of the patients, it is expected that the substance administrations would not be directly documented.
+
+                                 
+                              
+                           
+                           
+                              Seven patients who are residents in a health care facility for the elderly mentally ill have developed respiratory problems. After several months of various tests having been performed and various medications prescribed to these patients, the problem is traced to their being "sensitive" to a new fungicide used in the wall plaster of the ward where these patients reside.
+
+                              
+                                 
+                                    The patients have been continuously exposed to the fungicide.  Although there have been continuous substance administrations (via breathing) this would not normally be documented as a substance administration.
+
+                                 
+                              
+                           
+                           
+                              A patient with osteoarthritis of the knees is treated symptomatically using analgesia, paracetamol (acetaminophen) 1g up to four times a day for pain relief.  His GP does not realize that the patient has, 20 years previously (while at college) had severe alcohol addiction problems, and now, although this is completely under control, his liver has suffered significantly, leaving him more sensitive to hepatic toxicity from paracetamol use.  Later that year, the patient returns with a noticeable level of jaundice.  Paracetamol is immediately withdrawn and alternative solutions for the knee pain are sought.  The jaundice gradually subsides with conservative management, but referral to the gastroenterologist is required for advice and monitoring. 
+
+                              
+                                 
+                                    There is a substance administration with an associated exposure.  The exposure component is based on the relative toxic level of the substance to a patient with a compromised liver function.
+
+                                 
+                              
+                           
+                           
+                              A patient goes to their GP complaining of abdominal pain, having been discharged from the local hospital ten days' previously after an emergency appendectomy.  The GP can find nothing particularly amiss, and presumes it is post operative surgical pain that will resolve.  The patient returns a fortnight later, when the GP prescribes further analgesia, but does decide to request an outpatient surgical follow-up appointment.  At this post-surgical outpatient review, the registrar decides to order an ultrasound, which, when performed three weeks later, shows a small faint inexplicable mass.  A laparoscopy is then performed, as a day case procedure, and a piece of a surgical swab is removed from the patient's abdominal cavity.  Thankfully, a full recovery then takes place. 
+
+                              
+                                 
+                                    This is a procedural sequelae.  There may be an Incident recorded for this also.
+
+                                 
+                              
+                           
+                           
+                              A patient is slightly late for a regular pacemaker battery check in the Cardiology department of the local hospital.  They are hurrying down the second floor corridor.  A sudden summer squall has recently passed over the area, and rain has come in through an open corridor window leaving a small puddle on the corridor floor.  In their haste, the patient slips in the puddle and falls so badly that they have to be taken to the A&E department, where it is discovered on investigation they have slightly torn the cruciate ligament in their left knee. 
+
+                              
+                                 
+                                    This is not an exposure.  There has been an incident.  
+
+                                 
+                              
+                           
+                        
+                        
+                           Usage Notes: This class deals only with opportunity and not the outcome of the exposure; i.e. not all exposed parties will necessarily experience actual harm or benefit.
+
+                        Exposure differs from Substance Administration by the absence of the participation of a performer in the act. 
+
+                        The following participations SHOULD be used with the following participations to distinguish the specific entities:
+
+                        
+                           
+                              The exposed entity participates via the "exposure target" (EXPTRGT) participation.
+
+                           
+                           
+                              An entity that has carried the agent transmitted in the exposure participates via the "exposure source" (EXSRC) participation.  For example: 
+
+                              
+                                 
+                                    a person or animal who carried an infectious disease and interacts (EXSRC) with another person or animal (EXPTRGT) transmitting the disease agent;
+
+                                 
+                                 
+                                    a place or other environment (EXSRC) and a person or animal (EXPTRGT) who is exposed in the presence of this environment.
+
+                                 
+                              
+                           
+                           
+                              When it is unknown whether a participating entity is the source of the agent (EXSRC) or the target of the transmission (EXPTRGT), the "exposure participant" (EXPART) is used.
+
+                           
+                           
+                              The physical (including energy), chemical or biological substance which is participating in the exposure uses the "exposure agent" (EXPAGNT) participation.  There are at least three scenarios:
+
+                              
+                                 
+                                    the player of the Role that participates as EXPAGNT is the chemical or biological substance mixed or carried by the scoper-entity of the Role (e.g., ingredient role); or 
+
+                                 
+                                 
+                                    the player of the Role that participates as EXPAGNT is a mixture known to contain the chemical, radiological or biological substance of interest; or 
+
+                                 
+                                 
+                                    the player of the Role that participates as a EXPAGNT is known to carry the agent (i.e., the player is a fomite, vector, etc.).
+
+                                 
+                              
+                           
+                        
+                        The Exposure.statusCode attribute should be interpreted as the state of the Exposure business object (e.g., active, aborted, completed) and not the clinical status of the exposure (e.g., probable, confirmed).  The clinical status of the exposure should be associated with the exposure via a subject observation.
+
+                        
+                           Design Comment: The usage notes require a clear criterion for determining whether an act is an exposure or substance administration-deleterious potential, uncertainty of actual transmission, or otherwise. SBADM states that the criterion is the presence of a performer-but there are examples above that call this criterion into question (e.g., the first one, concerning a dosing error).
+         */
+        EXPOS, 
+        /**
+         * Description: 
+                        
+
+                        An acquisition exposure act describes the proximity (location and time) through which the participating entity was potentially exposed to a physical (including energy), chemical or biological agent from another entity.  The acquisition exposure act is used in conjunction with transmission exposure acts as part of an analysis technique for contact tracing.  Although an exposure can be decomposed into transmission and acquisition exposures, there is no requirement that all exposures be treated in this fashion.
+
+                        
+                           Constraints:  The Acquisition Exposure inherits the participation constraints that apply to Exposure with the following exception.  The EXPSRC (exposure source) participation must never be associated with the Transmission Exposure either directly or via context conduction.
+         */
+        AEXPOS, 
+        /**
+         * Description: 
+                        
+
+                        A transmission exposure act describes the proximity (time and location) over which the participating source entity was capable of transmitting a physical (including energy), chemical or biological substance agent to another entity.  The transmission exposure act is used in conjunction with acquisition exposure acts as part of an analysis technique for contact tracing.  Although an exposure can be decomposed into transmission and acquisition exposures, there is no requirement that all exposures be treated in this fashion.
+
+                        
+                           Constraints:  The Transmission Exposure inherits the participation constraints that apply to Exposure with the following exception.  The EXPTRGT (exposure target) participation must never be associated with the Transmission Exposure either directly or via context conduction.
+         */
+        TEXPOS, 
+        /**
+         * An event that occurred outside of the control of one or more of the parties involved.  Includes the concept of an accident.
+         */
+        INC, 
+        /**
+         * The act  of transmitting information and understanding about a topic to a subject where the participation association must be SBJ.
+
+                        
+                           Discussion: This act may be used to request that a patient or provider be informed about an Act, or to indicate that a person was informed about a particular act.
+         */
+        INFRM, 
+        /**
+         * Represents concepts related to invoice processing in health care
+         */
+        INVE, 
+        /**
+         * Working list collects a dynamic list of individual instances of Act via ActRelationship which reflects the need of an individual worker, team of workers, or an organization to manage lists of acts for many different clinical and administrative reasons. Examples of working lists include problem lists, goal lists, allergy lists, and to-do lists.
+         */
+        LIST, 
+        /**
+         * An officially or unofficially instituted program to track acts of a particular type or categorization.
+         */
+        MPROT, 
+        /**
+         * Description:An act that is intended to result in new information about a subject. The main difference between Observations and other Acts is that Observations have a value attribute. The code attribute of Observation and the value attribute of Observation must be considered in combination to determine the semantics of the observation.
+
+                        
+                           Discussion:
+                        
+
+                        Structurally, many observations are name-value-pairs, where the Observation.code (inherited from Act) is the name and the Observation.value is the value of the property. Such a construct is also known as a  variable (a named feature that can assume a value) hence, the Observation class is always used to hold generic name-value-pairs or variables, even though the variable valuation may not be the result of an elaborate observation method. It may be a simple answer to a question or it may be an assertion or setting of a parameter.
+
+                        As with all Act statements, Observation statements describe what was done, and in the case of Observations, this includes a description of what was actually observed (results or answers); and those results or answers are part of the observation and not split off into other objects. 
+
+                        The method of action is asserted by the Observation classCode or its subclasses at the least granular level, by the Observation.code attribute value at the medium level of granularity, and by the attribute value of observation.methodCode when a finer level of granularity is required. The method in whole or in part may also appear in the attribute value of Observation.value when using coded data types to express the value of the attribute. Relevant aspects of methodology may also be restated in value when the results themselves imply or state a methodology.
+
+                        An observation may consist of component observations each having their own Observation.code and Observation.value. In this case, the composite observation may not have an Observation.value for itself. For instance, a white blood cell count consists of the sub-observations for the counts of the various granulocytes, lymphocytes and other normal or abnormal blood cells (e.g., blasts). The overall white blood cell count Observation itself may therefore not have a value by itself (even though it could have one, e.g., the sum total of white blood cells). Thus, as long as an Act is essentially an Act of recognizing and noting information about a subject, it is an Observation, regardless of whether it has a simple value by itself or whether it has sub-observations.
+
+                        Even though observations are professional acts (see Act) and as such are intentional actions, this does not require that every possible outcome of an observation be pondered in advance of it being actually made. For instance, differential white blood cell counts (WBC) rarely show blasts, but if they do, this is part of the WBC observation even though blasts might not be predefined in the structure of a normal WBC. 
+
+                        Clinical documents commonly have Subjective and Objective findings, both of which are kinds of Observations. In addition, clinical documents commonly contain Assessments, which are also kinds of Observations. Thus, the establishment of a diagnosis is an Observation. 
+
+                        
+                           Examples:
+                        
+
+                        
+                           
+                              Recording the results of a Family History Assessment
+
+                           
+                           
+                              Laboratory test and associated result
+
+                           
+                           
+                              Physical exam test and associated result
+
+                           
+                           
+                              Device temperature
+
+                           
+                           
+                              Soil lead level
+         */
+        OBS, 
+        /**
+         * Regions of Interest (ROI) within a subject Act. Primarily used for making secondary observations on a subset of a subject observation. The relationship between a ROI and its referenced Act is specified through an ActRelationship of type "subject" (SUBJ), which must always be present.
+         */
+        _ACTCLASSROI, 
+        /**
+         * A Region of Interest (ROI) specified for a multidimensional observation, such as an Observation Series (OBSSER). The ROI is specified using a set of observation criteria, each delineating the boundary of the region in one of the dimensions in the multidimensional observation. The relationship between a ROI and its referenced Act is specified through an ActRelationship of type subject (SUBJ), which must always be present. Each of the boundary criteria observations is connected with the ROI using ActRelationships of type "has component" (COMP). In each boundary criterion, the Act.code names the dimension and the Observation.value specifies the range of values inside the region. Typically the bounded dimension is continuous, and so the Observation.value will be an interval (IVL) data type. The Observation.value need not be specified if the respective dimension is only named but not constrained. For example, an ROI for the QT interval of a certain beat in ECG Lead II would contain 2 boundary criteria, one naming the interval in time (constrained), and the other naming the interval in ECG Lead II (only named, but not constrained).
+         */
+        ROIBND, 
+        /**
+         * A Region of Interest (ROI) specified for an image using an overlay shape. Typically used to make reference to specific regions in images, e.g., to specify the location of a radiologic finding in an image or to specify the site of a physical finding by "circling" a region in a schematic picture of a human body. The units of the coordinate values are in pixels.  The origin is in the upper left hand corner, with positive X values going to the right and positive Y values going down. The relationship between a ROI and its referenced Act is specified through an ActRelationship of type "subject" (SUBJ), which must always be present.
+         */
+        ROIOVL, 
+        /**
+         * The spatial relationship of a subject whether human, other animal, or plant, to a frame of reference such as gravity or a collection device.
+         */
+        _SUBJECTPHYSICALPOSITION, 
+        /**
+         * Contains codes for defining the observed, physical position of a subject, such as during an observation, assessment, collection of a specimen, etc.  ECG waveforms and vital signs, such as blood pressure, are two examples where a general, observed position typically needs to be noted.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        _SUBJECTBODYPOSITION, 
+        /**
+         * Lying on the left side.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        LLD, 
+        /**
+         * Lying with the front or ventral surface downward; lying face down.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        PRN, 
+        /**
+         * Lying on the right side.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        RLD, 
+        /**
+         * A semi-sitting position in bed with the head of the bed elevated approximately 45 degrees.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        SFWL, 
+        /**
+         * Resting the body on the buttocks, typically with upper torso erect or semi erect.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        SIT, 
+        /**
+         * To be stationary, upright, vertical, on one's legs.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        STN, 
+        /**
+         * Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        SUP, 
+        /**
+         * Lying on the back, on an inclined plane, typically about 30-45 degrees with head raised and feet lowered.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        RTRD, 
+        /**
+         * Lying on the back, on an inclined plane, typically about 30-45 degrees, with  head lowered and feet raised.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.
+         */
+        TRD, 
+        /**
+         * An observation identifying a potential adverse outcome as a result of an Act or combination of Acts.
+
+                        
+                           Examples: Detection of a drug-drug interaction; Identification of a late-submission for an invoice; Requesting discharge for a patient who does not meet hospital-defined discharge criteria.
+
+                        
+                           Discussion: This class is commonly used for identifying 'business rule' or 'process' problems that may result in a refusal to carry out a particular request. In some circumstances it may be possible to 'bypass' a problem by modifying the request to acknowledge the issue and/or by providing some form of mitigation.
+
+                        
+                           Constraints: the Act or Acts that may cause the the adverse outcome are the target of a subject ActRelationship. The subbtypes of this concept indicate the type of problem being detected (e.g. drug-drug interaction) while the Observation.value is used to repesent a specific problem code (e.g. specific drug-drug interaction id).
+         */
+        ALRT, 
+        /**
+         * Definition: An observation that is composed of a set of observations. These observations typically have a logical or practical grouping for generally accepted clinical or functional purposes, such as observations that are run together because of automation. A battery can define required and optional component observations and, in some cases, will define complex rules that determine whether or not a particular observation is made. BATTERY is a constraint on the Observation class in that it is understood to always be composed of component observations.
+
+                        
+                           UsageNotes: The focus in a BATTERY is that it is composed of individual observations. In request (RQO) mood, a battery is a request to perform the component observations. In event (EVN) mood a battery is a reporting of associated set of observation events. In definition mood a battery is the definition of the associated set of observations.
+
+                        
+                           Examples: Vital signs, Full blood count, Chemistry panel.
+         */
+        BATTERY, 
+        /**
+         * The set of actions that define an experiment to assess the effectiveness and/or safety of a biopharmaceutical product (food, drug, device, etc.).  In definition mood, this set of actions is often embodied in a clinical trial protocol; in event mood, this designates the aggregate act of applying the actions to one or more subjects.
+         */
+        CLNTRL, 
+        /**
+         * An instance of Observation of a Condition at a point in time that includes any Observations or Procedures associated with that Condition as well as links to previous instances of Condition Node for the same Condition
+
+                        
+                           
+                              Deprecation Comment: 
+                           This concept has been deprecated because an alternative structure for tracking the evolution of a problem has been presented and adopted by the Care Provision Work Group.
+         */
+        CNOD, 
+        /**
+         * An observable finding or state that persists over time and tends to require intervention or management, and, therefore, distinguished from an Observation made at a point in time; may exist before an Observation of the Condition is made or after interventions to manage the Condition are undertaken. Examples: equipment repair status, device recall status, a health risk, a financial risk, public health risk, pregnancy, health maintenance, chronic illness
+         */
+        COND, 
+        /**
+         * A public health case is an Observation representing a condition or event that has a specific significance for public health. Typically it involves an instance or instances of a reportable infectious disease or other condition. The public health case can include a health-related event concerning a single individual or it may refer to multiple health-related events that are occurrences of the same disease or condition of interest to public health. An outbreak involving multiple individuals may be considered as a type of public health case. A public health case definition (Act.moodCode = "definition") includes the description of the clinical, laboratory, and epidemiologic indicators associated with a disease or condition of interest to public health. There are case definitions for conditions that are reportable, as well as for those that are not. There are also case definitions for outbreaks. A public health case definition is a construct used by public health for the purpose of counting cases, and should not be used as clinical indications for treatment. Examples include AIDS, toxic-shock syndrome, and salmonellosis and their associated indicators that are used to define a case.
+         */
+        CASE, 
+        /**
+         * An outbreak represents a series of public health cases. The date on which an outbreak starts is the earliest date of onset among the cases assigned to the outbreak, and its ending date is the last date of onset among the cases assigned to the outbreak.
+         */
+        OUTB, 
+        /**
+         * Class for holding attributes unique to diagnostic images.
+         */
+        DGIMG, 
+        /**
+         * Description:An observation of genomic phenomena.
+         */
+        GEN, 
+        /**
+         * Description:A determinant peptide in a polypeptide as described by polypeptide.
+         */
+        DETPOL, 
+        /**
+         * Description:An expression level of genes/proteins or other expressed genomic entities.
+         */
+        EXP, 
+        /**
+         * Description:The position of a gene (or other significant sequence) on the genome.
+         */
+        LOC, 
+        /**
+         * Description:A genomic phenomenon that is expressed externally in the organism.
+         */
+        PHN, 
+        /**
+         * Description:A polypeptide resulting from the translation of a gene.
+         */
+        POL, 
+        /**
+         * Description:A sequence of biomolecule like the DNA, RNA, protein and the like.
+         */
+        SEQ, 
+        /**
+         * Description:A variation in a sequence as described by BioSequence.
+         */
+        SEQVAR, 
+        /**
+         * An formalized inquiry into the circumstances surrounding a particular unplanned event or potential event for the purposes of identifying possible causes and contributing factors for the event. This investigation could be conducted at a local institutional level or at the level of a local or national government.
+         */
+        INVSTG, 
+        /**
+         * Container for Correlated Observation Sequences sharing a common frame of reference.  All Observations of the same cd must be comparable and relative to the common frame of reference.  For example, a 3-channel ECG device records a 12-lead ECG in 4 steps (3 leads at a time).  Each of the separate 3-channel recordings would be in their own "OBSCOR".  And, all 4 OBSCOR would be contained in one OBSSER because all the times are relative to the same origin (beginning of the recording) and all the ECG signals were from a fixed set of electrodes.
+         */
+        OBSSER, 
+        /**
+         * Container for Observation Sequences (Observations whose values are contained in LIST<>'s) having values correlated with each other.  Each contained Observation Sequence LIST<> must be the same length.  Values in the LIST<>'s are correlated based on index.  E.g. the values in position 2 in all the LIST<>'s are correlated.  This is analogous to a table where each column is an Observation Sequence with a LIST<> of values, and each row in the table is a correlation between the columns.  For example, a 12-lead ECG would contain 13 sequences: one sequence for time, and a sequence for each of the 12 leads.
+         */
+        OBSCOR, 
+        /**
+         * An observation denoting the physical location of a person or thing based on a reference coordinate system.
+         */
+        POS, 
+        /**
+         * Description:An observation representing the degree to which the assignment of the spatial coordinates, based on a matching algorithm by a geocoding engine against a reference spatial database, matches true or accepted values.
+         */
+        POSACC, 
+        /**
+         * Description:An observation representing one of a set of numerical values used to determine the position of a place.  The name of the coordinate value is determined by the reference coordinate system.
+         */
+        POSCOORD, 
+        /**
+         * An observation on a specimen in a laboratory environment that may affect processing, analysis or result interpretation
+         */
+        SPCOBS, 
+        /**
+         * An act which describes the process whereby a 'verifying party' validates either the existence of the Role attested to by some Credential or the actual Vetting act and its details.
+         */
+        VERIF, 
+        /**
+         * An Act that of taking on whole or partial responsibility for, or attention to, safety and well-being of a subject of care. 
+
+                        
+                           Discussion: A care provision event may exist without any other care actions taking place. For example, when a patient is assigned to the care of a particular health professional.
+
+                        In request (RQO) mood care provision communicates a referral, which is a request:
+
+                        
+                           
+                              from one party (linked as a participant of type author (AUT)),
+
+                           
+                           
+                              to another party (linked as a participant of type performer (PRF),
+
+                           
+                           
+                              to take responsibility for a scope specified by the code attribute, 
+
+                           
+                           
+                              for an entity (linked as a participant of type subject (SBJ)).
+
+                           
+                        
+                        The scope of the care for which responsibility is taken is identified by code attribute.
+
+                        In event (EVN) mood care provision indicates the effective time interval of a specified scope of responsibility by a performer (PRF) or set of performers (PRF) for a subject (SBJ).
+
+                        
+                           Examples:
+                        
+
+                        
+                           
+                              Referral from GP to a specialist.
+
+                           
+                           
+                              Assignment of a patient or group of patients to the case list of a health professional.
+
+                           
+                           
+                              Assignment of inpatients to the care of particular nurses for a working shift.
+         */
+        PCPR, 
+        /**
+         * An interaction between a patient and healthcare participant(s) for the purpose of providing patient service(s) or assessing the health status of a patient.  For example, outpatient visit to multiple departments, home health support (including physical therapy), inpatient hospital stay, emergency room visit, field visit (e.g., traffic accident), office visit, occupational therapy, telephone call.
+         */
+        ENC, 
+        /**
+         * Description:A mandate, regulation, obligation, requirement, rule, or expectation unilaterally imposed by one party on:
+
+                        
+                           
+                              The activity of another party
+
+                           
+                           
+                              The behavior of another party
+
+                           
+                           
+                              The manner in which an act is executed
+         */
+        POLICY, 
+        /**
+         * Description:A mandate, regulation, obligation, requirement, rule, or expectation unilaterally imposed by a jurisdiction on:
+
+                        
+                           
+                              The activity of another party
+
+                           
+                           
+                              The behavior of another party
+
+                           
+                           
+                              The manner in which an act is executed
+
+                           
+                        
+                        
+                           Examples:A jurisdictional mandate regarding the prescribing and dispensing of a particular medication.  A jurisdictional privacy or security regulation dictating the manner in which personal health information is disclosed.  A jurisdictional requirement that certain services or health conditions are reported to a monitoring program, e.g., immunizations, methadone treatment, or cancer registries.
+         */
+        JURISPOL, 
+        /**
+         * Description:A mandate, obligation, requirement, rule, or expectation unilaterally imposed by an organization on:
+
+                        
+                           
+                              The activity of another party
+
+                           
+                           
+                              The behavior of another party
+
+                           
+                           
+                              The manner in which an act is executed
+
+                           
+                        
+                        
+                           Examples:A clinical or research protocols imposed by a payer, a malpractice insurer, or an institution to which a provider must adhere.  A mandate imposed by a denominational institution for a provider to provide or withhold certain information from the patient about treatment options.
+         */
+        ORGPOL, 
+        /**
+         * Description:An ethical or clinical obligation, requirement, rule, or expectation imposed or strongly encouraged by organizations that oversee particular clinical domains or provider certification which define the boundaries within which a provider may practice and which may have legal basis or ramifications on:
+
+                        
+                           
+                              The activity of another party
+
+                           
+                           
+                              The behavior of another party
+
+                           
+                           
+                              The manner in which an act is executed
+
+                           
+                        
+                        
+                           Examples:An ethical obligation for a provider to fully inform a patient about all treatment options.  An ethical obligation for a provider not to disclose personal health information that meets certain criteria, e.g., where disclosure might result in harm to the patient or another person.  The set of health care services which a provider is credentialed or privileged to provide.
+         */
+        SCOPOL, 
+        /**
+         * Description:A requirement, rule, or expectation typically documented as guidelines, protocols, or formularies imposed or strongly encouraged by an organization that oversees or has authority over the practices within a domain, and which may have legal basis or ramifications on:
+
+                        
+                           
+                              The activity of another party
+
+                           
+                           
+                              The behavior of another party
+
+                           
+                           
+                              The manner in which an act is executed
+
+                           
+                        
+                        
+                           Examples:A payer may require a prescribing provider to adhere to formulary guidelines.  An institution may adopt clinical guidelines and protocols and implement these within its electronic health record and decision support systems.
+         */
+        STDPOL, 
+        /**
+         * An Act whose immediate and primary outcome (post-condition) is the alteration of the physical condition of the subject.
+
+                        
+                           Examples: : Procedures may involve the disruption of some body surface (e.g. an incision in a surgical procedure), but they also include conservative procedures such as reduction of a luxated join, chiropractic treatment, massage, balneotherapy, acupuncture, shiatsu, etc. Outside of clinical medicine, procedures may be such things as alteration of environments (e.g. straightening rivers, draining swamps, building dams) or the repair or change of machinery etc.
+         */
+        PROC, 
+        /**
+         * The act of introducing or otherwise applying a substance to the subject.
+
+                        
+                           Discussion: The effect of the substance is typically established on a biochemical basis, however, that is not a requirement. For example, radiotherapy can largely be described in the same way, especially if it is a systemic therapy such as radio-iodine.  This class also includes the application of chemical treatments to an area.
+
+                        
+                           Examples: Chemotherapy protocol; Drug prescription; Vaccination record
+         */
+        SBADM, 
+        /**
+         * Description: The act of removing a substance from the subject.
+         */
+        SBEXT, 
+        /**
+         * A procedure for obtaining a specimen from a source entity.
+         */
+        SPECCOLLECT, 
+        /**
+         * Represents the act of maintaining information about the registration of its associated registered subject. The subject can be either an Act or a Role, and includes subjects such as lab exam definitions, drug protocol definitions, prescriptions, persons, patients, practitioners, and equipment.
+
+                        The registration may have a unique identifier - separate from the unique identification of the subject - as well as a core set of related participations and act relationships that characterize the registration event and aid in the disposition of the subject information by a receiving system.
+         */
+        REG, 
+        /**
+         * The act of examining and evaluating the subject, usually another act. For example, "This prescription needs to be reviewed in 2 months."
+         */
+        REV, 
+        /**
+         * A procedure or treatment performed on a specimen to prepare it for analysis
+         */
+        SPCTRT, 
+        /**
+         * Supply orders and deliveries are simple Acts that focus on the delivered product. The product is associated with the Supply Act via Participation.typeCode="product". With general Supply Acts, the precise identification of the Material (manufacturer, serial numbers, etc.) is important.  Most of the detailed information about the Supply should be represented using the Material class.  If delivery needs to be scheduled, tracked, and billed separately, one can associate a Transportation Act with the Supply Act.  Pharmacy dispense services are represented as Supply Acts, associated with a SubstanceAdministration  Act. The SubstanceAdministration class represents the administration of medication, while dispensing is supply.
+         */
+        SPLY, 
+        /**
+         * Diet services are supply services, with some aspects resembling Medication services: the detail of the diet is given as a description of the Material associated via Participation.typeCode="product". Medically relevant diet types may be communicated in the Diet.code attribute using domain ActDietCode, however, the detail of the food supplied and the various combinations of dishes should be communicated as Material instances.
+
+                        
+                           Deprecation Note
+                        
+
+                        
+                           Class: Use either the Supply class (if dealing with what should be given to the patient) or SubstanceAdministration class (if dealing with what the patient should consume)
+
+                        
+                           energyQuantity: This quantity can be conveyed by using a Content relationship with a quantity attribute expressing the calories
+
+                        
+                           carbohydrateQuantity:This quantity can be conveyed using a Content relationship to an Entity with a code of  carbohydrate and a quantity attribute on the content relationship.
+         */
+        DIET, 
+        /**
+         * The act of putting something away for safe keeping. The "something" may be physical object such as a specimen, or information, such as observations regarding a specimen.
+         */
+        STORE, 
+        /**
+         * Definition: Indicates that the subject Act has undergone or should undergo substitution of a type indicated by Act.code.
+
+                        Rationale: Used to specify "allowed" substitution when creating orders, "actual" susbstitution when sending events, as well as the reason for the substitution and who was responsible for it.
+         */
+        SUBST, 
+        /**
+         * Definition: The act of transferring information without the intent of imparting understanding about a topic to the subject that is the recipient or holder of the transferred information where the participation association must be RCV or HLD.
+         */
+        TRFR, 
+        /**
+         * Transportation is the moving of a payload (people or material) from a location of origin to a destination location.  Thus, any transport service has the three target instances of type payload, origin, and destination, besides the targets that are generally used for any service (i.e., performer, device, etc.)
+         */
+        TRNS, 
+        /**
+         * A sub-class of Act representing any transaction between two accounts whose value is measured in monetary terms.
+
+                        In the "intent" mood, communicates a request for a transaction to be initiated, or communicates a transfer of value between two accounts.
+
+                        In the "event" mood, communicates the posting of a transaction to an account.
+         */
+        XACT, 
+        /**
+         * ActClassContainer
+         */
+        _ACTCLASSCONTAINER, 
+        /**
+         * This context represents the information acquired and recorded for an observation, a clinical statement such as a portion of the patient's history or an inference or assertion, or an action that might be intended or has actually been performed. This class may represent both the actual data describing the observation, inference, or action, and optionally the details supporting the clinical reasoning process such as a reference to an electronic guideline, decision support system, or other knowledge reference.
+         */
+        ENTRY, 
+        /**
+         * Organizer of entries. Navigational. No semantic content. Knowledge of the section code is not required to interpret contained observations. Represents a heading in a heading structure, or "organizer tree".
+
+                        The record entries relating to a single clinical session are usually grouped under headings that represent phases of the encounter, or assist with layout and navigation. Clinical headings usually reflect the clinical workflow during a care session, and might also reflect the main author's reasoning processes. Much research has demonstrated that headings are used differently by different professional groups and specialties, and that headings are not used consistently enough to support safe automatic processing of the E H R.
+         */
+        ORGANIZER, 
+        /**
+         * null
+         */
+        DOCCNTNT, 
+        /**
+         * null
+         */
+        DOCLIST, 
+        /**
+         * null
+         */
+        DOCLSTITM, 
+        /**
+         * null
+         */
+        DOCPARA, 
+        /**
+         * null
+         */
+        DOCTBL, 
+        /**
+         * null
+         */
+        LINKHTML, 
+        /**
+         * null
+         */
+        LOCALATTR, 
+        /**
+         * null
+         */
+        LOCALMRKP, 
+        /**
+         * null
+         */
+        ORDERED, 
+        /**
+         * null
+         */
+        REFR, 
+        /**
+         * null
+         */
+        TBLCOL, 
+        /**
+         * null
+         */
+        TBLCOLGP, 
+        /**
+         * null
+         */
+        TBLDATA, 
+        /**
+         * null
+         */
+        TBLHDR, 
+        /**
+         * null
+         */
+        TBLROW, 
+        /**
+         * null
+         */
+        TBODY, 
+        /**
+         * null
+         */
+        TFOOT, 
+        /**
+         * null
+         */
+        THEAD, 
+        /**
+         * null
+         */
+        UNORDERED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActClass fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ACT".equals(codeString))
+          return ACT;
+        if ("_ActClassRecordOrganizer".equals(codeString))
+          return _ACTCLASSRECORDORGANIZER;
+        if ("COMPOSITION".equals(codeString))
+          return COMPOSITION;
+        if ("DOC".equals(codeString))
+          return DOC;
+        if ("DOCCLIN".equals(codeString))
+          return DOCCLIN;
+        if ("CDALVLONE".equals(codeString))
+          return CDALVLONE;
+        if ("CONTAINER".equals(codeString))
+          return CONTAINER;
+        if ("CATEGORY".equals(codeString))
+          return CATEGORY;
+        if ("DOCBODY".equals(codeString))
+          return DOCBODY;
+        if ("DOCSECT".equals(codeString))
+          return DOCSECT;
+        if ("TOPIC".equals(codeString))
+          return TOPIC;
+        if ("EXTRACT".equals(codeString))
+          return EXTRACT;
+        if ("EHR".equals(codeString))
+          return EHR;
+        if ("FOLDER".equals(codeString))
+          return FOLDER;
+        if ("GROUPER".equals(codeString))
+          return GROUPER;
+        if ("CLUSTER".equals(codeString))
+          return CLUSTER;
+        if ("ACCM".equals(codeString))
+          return ACCM;
+        if ("ACCT".equals(codeString))
+          return ACCT;
+        if ("ACSN".equals(codeString))
+          return ACSN;
+        if ("ADJUD".equals(codeString))
+          return ADJUD;
+        if ("CACT".equals(codeString))
+          return CACT;
+        if ("ACTN".equals(codeString))
+          return ACTN;
+        if ("INFO".equals(codeString))
+          return INFO;
+        if ("STC".equals(codeString))
+          return STC;
+        if ("CNTRCT".equals(codeString))
+          return CNTRCT;
+        if ("FCNTRCT".equals(codeString))
+          return FCNTRCT;
+        if ("COV".equals(codeString))
+          return COV;
+        if ("CONC".equals(codeString))
+          return CONC;
+        if ("HCASE".equals(codeString))
+          return HCASE;
+        if ("OUTBR".equals(codeString))
+          return OUTBR;
+        if ("CONS".equals(codeString))
+          return CONS;
+        if ("CONTREG".equals(codeString))
+          return CONTREG;
+        if ("CTTEVENT".equals(codeString))
+          return CTTEVENT;
+        if ("DISPACT".equals(codeString))
+          return DISPACT;
+        if ("EXPOS".equals(codeString))
+          return EXPOS;
+        if ("AEXPOS".equals(codeString))
+          return AEXPOS;
+        if ("TEXPOS".equals(codeString))
+          return TEXPOS;
+        if ("INC".equals(codeString))
+          return INC;
+        if ("INFRM".equals(codeString))
+          return INFRM;
+        if ("INVE".equals(codeString))
+          return INVE;
+        if ("LIST".equals(codeString))
+          return LIST;
+        if ("MPROT".equals(codeString))
+          return MPROT;
+        if ("OBS".equals(codeString))
+          return OBS;
+        if ("_ActClassROI".equals(codeString))
+          return _ACTCLASSROI;
+        if ("ROIBND".equals(codeString))
+          return ROIBND;
+        if ("ROIOVL".equals(codeString))
+          return ROIOVL;
+        if ("_SubjectPhysicalPosition".equals(codeString))
+          return _SUBJECTPHYSICALPOSITION;
+        if ("_SubjectBodyPosition".equals(codeString))
+          return _SUBJECTBODYPOSITION;
+        if ("LLD".equals(codeString))
+          return LLD;
+        if ("PRN".equals(codeString))
+          return PRN;
+        if ("RLD".equals(codeString))
+          return RLD;
+        if ("SFWL".equals(codeString))
+          return SFWL;
+        if ("SIT".equals(codeString))
+          return SIT;
+        if ("STN".equals(codeString))
+          return STN;
+        if ("SUP".equals(codeString))
+          return SUP;
+        if ("RTRD".equals(codeString))
+          return RTRD;
+        if ("TRD".equals(codeString))
+          return TRD;
+        if ("ALRT".equals(codeString))
+          return ALRT;
+        if ("BATTERY".equals(codeString))
+          return BATTERY;
+        if ("CLNTRL".equals(codeString))
+          return CLNTRL;
+        if ("CNOD".equals(codeString))
+          return CNOD;
+        if ("COND".equals(codeString))
+          return COND;
+        if ("CASE".equals(codeString))
+          return CASE;
+        if ("OUTB".equals(codeString))
+          return OUTB;
+        if ("DGIMG".equals(codeString))
+          return DGIMG;
+        if ("GEN".equals(codeString))
+          return GEN;
+        if ("DETPOL".equals(codeString))
+          return DETPOL;
+        if ("EXP".equals(codeString))
+          return EXP;
+        if ("LOC".equals(codeString))
+          return LOC;
+        if ("PHN".equals(codeString))
+          return PHN;
+        if ("POL".equals(codeString))
+          return POL;
+        if ("SEQ".equals(codeString))
+          return SEQ;
+        if ("SEQVAR".equals(codeString))
+          return SEQVAR;
+        if ("INVSTG".equals(codeString))
+          return INVSTG;
+        if ("OBSSER".equals(codeString))
+          return OBSSER;
+        if ("OBSCOR".equals(codeString))
+          return OBSCOR;
+        if ("POS".equals(codeString))
+          return POS;
+        if ("POSACC".equals(codeString))
+          return POSACC;
+        if ("POSCOORD".equals(codeString))
+          return POSCOORD;
+        if ("SPCOBS".equals(codeString))
+          return SPCOBS;
+        if ("VERIF".equals(codeString))
+          return VERIF;
+        if ("PCPR".equals(codeString))
+          return PCPR;
+        if ("ENC".equals(codeString))
+          return ENC;
+        if ("POLICY".equals(codeString))
+          return POLICY;
+        if ("JURISPOL".equals(codeString))
+          return JURISPOL;
+        if ("ORGPOL".equals(codeString))
+          return ORGPOL;
+        if ("SCOPOL".equals(codeString))
+          return SCOPOL;
+        if ("STDPOL".equals(codeString))
+          return STDPOL;
+        if ("PROC".equals(codeString))
+          return PROC;
+        if ("SBADM".equals(codeString))
+          return SBADM;
+        if ("SBEXT".equals(codeString))
+          return SBEXT;
+        if ("SPECCOLLECT".equals(codeString))
+          return SPECCOLLECT;
+        if ("REG".equals(codeString))
+          return REG;
+        if ("REV".equals(codeString))
+          return REV;
+        if ("SPCTRT".equals(codeString))
+          return SPCTRT;
+        if ("SPLY".equals(codeString))
+          return SPLY;
+        if ("DIET".equals(codeString))
+          return DIET;
+        if ("STORE".equals(codeString))
+          return STORE;
+        if ("SUBST".equals(codeString))
+          return SUBST;
+        if ("TRFR".equals(codeString))
+          return TRFR;
+        if ("TRNS".equals(codeString))
+          return TRNS;
+        if ("XACT".equals(codeString))
+          return XACT;
+        if ("_ActClassContainer".equals(codeString))
+          return _ACTCLASSCONTAINER;
+        if ("ENTRY".equals(codeString))
+          return ENTRY;
+        if ("ORGANIZER".equals(codeString))
+          return ORGANIZER;
+        if ("DOCCNTNT".equals(codeString))
+          return DOCCNTNT;
+        if ("DOCLIST".equals(codeString))
+          return DOCLIST;
+        if ("DOCLSTITM".equals(codeString))
+          return DOCLSTITM;
+        if ("DOCPARA".equals(codeString))
+          return DOCPARA;
+        if ("DOCTBL".equals(codeString))
+          return DOCTBL;
+        if ("LINKHTML".equals(codeString))
+          return LINKHTML;
+        if ("LOCALATTR".equals(codeString))
+          return LOCALATTR;
+        if ("LOCALMRKP".equals(codeString))
+          return LOCALMRKP;
+        if ("ordered".equals(codeString))
+          return ORDERED;
+        if ("REFR".equals(codeString))
+          return REFR;
+        if ("TBLCOL".equals(codeString))
+          return TBLCOL;
+        if ("TBLCOLGP".equals(codeString))
+          return TBLCOLGP;
+        if ("TBLDATA".equals(codeString))
+          return TBLDATA;
+        if ("TBLHDR".equals(codeString))
+          return TBLHDR;
+        if ("TBLROW".equals(codeString))
+          return TBLROW;
+        if ("tbody".equals(codeString))
+          return TBODY;
+        if ("tfoot".equals(codeString))
+          return TFOOT;
+        if ("thead".equals(codeString))
+          return THEAD;
+        if ("unordered".equals(codeString))
+          return UNORDERED;
+        throw new FHIRException("Unknown V3ActClass code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACT: return "ACT";
+            case _ACTCLASSRECORDORGANIZER: return "_ActClassRecordOrganizer";
+            case COMPOSITION: return "COMPOSITION";
+            case DOC: return "DOC";
+            case DOCCLIN: return "DOCCLIN";
+            case CDALVLONE: return "CDALVLONE";
+            case CONTAINER: return "CONTAINER";
+            case CATEGORY: return "CATEGORY";
+            case DOCBODY: return "DOCBODY";
+            case DOCSECT: return "DOCSECT";
+            case TOPIC: return "TOPIC";
+            case EXTRACT: return "EXTRACT";
+            case EHR: return "EHR";
+            case FOLDER: return "FOLDER";
+            case GROUPER: return "GROUPER";
+            case CLUSTER: return "CLUSTER";
+            case ACCM: return "ACCM";
+            case ACCT: return "ACCT";
+            case ACSN: return "ACSN";
+            case ADJUD: return "ADJUD";
+            case CACT: return "CACT";
+            case ACTN: return "ACTN";
+            case INFO: return "INFO";
+            case STC: return "STC";
+            case CNTRCT: return "CNTRCT";
+            case FCNTRCT: return "FCNTRCT";
+            case COV: return "COV";
+            case CONC: return "CONC";
+            case HCASE: return "HCASE";
+            case OUTBR: return "OUTBR";
+            case CONS: return "CONS";
+            case CONTREG: return "CONTREG";
+            case CTTEVENT: return "CTTEVENT";
+            case DISPACT: return "DISPACT";
+            case EXPOS: return "EXPOS";
+            case AEXPOS: return "AEXPOS";
+            case TEXPOS: return "TEXPOS";
+            case INC: return "INC";
+            case INFRM: return "INFRM";
+            case INVE: return "INVE";
+            case LIST: return "LIST";
+            case MPROT: return "MPROT";
+            case OBS: return "OBS";
+            case _ACTCLASSROI: return "_ActClassROI";
+            case ROIBND: return "ROIBND";
+            case ROIOVL: return "ROIOVL";
+            case _SUBJECTPHYSICALPOSITION: return "_SubjectPhysicalPosition";
+            case _SUBJECTBODYPOSITION: return "_SubjectBodyPosition";
+            case LLD: return "LLD";
+            case PRN: return "PRN";
+            case RLD: return "RLD";
+            case SFWL: return "SFWL";
+            case SIT: return "SIT";
+            case STN: return "STN";
+            case SUP: return "SUP";
+            case RTRD: return "RTRD";
+            case TRD: return "TRD";
+            case ALRT: return "ALRT";
+            case BATTERY: return "BATTERY";
+            case CLNTRL: return "CLNTRL";
+            case CNOD: return "CNOD";
+            case COND: return "COND";
+            case CASE: return "CASE";
+            case OUTB: return "OUTB";
+            case DGIMG: return "DGIMG";
+            case GEN: return "GEN";
+            case DETPOL: return "DETPOL";
+            case EXP: return "EXP";
+            case LOC: return "LOC";
+            case PHN: return "PHN";
+            case POL: return "POL";
+            case SEQ: return "SEQ";
+            case SEQVAR: return "SEQVAR";
+            case INVSTG: return "INVSTG";
+            case OBSSER: return "OBSSER";
+            case OBSCOR: return "OBSCOR";
+            case POS: return "POS";
+            case POSACC: return "POSACC";
+            case POSCOORD: return "POSCOORD";
+            case SPCOBS: return "SPCOBS";
+            case VERIF: return "VERIF";
+            case PCPR: return "PCPR";
+            case ENC: return "ENC";
+            case POLICY: return "POLICY";
+            case JURISPOL: return "JURISPOL";
+            case ORGPOL: return "ORGPOL";
+            case SCOPOL: return "SCOPOL";
+            case STDPOL: return "STDPOL";
+            case PROC: return "PROC";
+            case SBADM: return "SBADM";
+            case SBEXT: return "SBEXT";
+            case SPECCOLLECT: return "SPECCOLLECT";
+            case REG: return "REG";
+            case REV: return "REV";
+            case SPCTRT: return "SPCTRT";
+            case SPLY: return "SPLY";
+            case DIET: return "DIET";
+            case STORE: return "STORE";
+            case SUBST: return "SUBST";
+            case TRFR: return "TRFR";
+            case TRNS: return "TRNS";
+            case XACT: return "XACT";
+            case _ACTCLASSCONTAINER: return "_ActClassContainer";
+            case ENTRY: return "ENTRY";
+            case ORGANIZER: return "ORGANIZER";
+            case DOCCNTNT: return "DOCCNTNT";
+            case DOCLIST: return "DOCLIST";
+            case DOCLSTITM: return "DOCLSTITM";
+            case DOCPARA: return "DOCPARA";
+            case DOCTBL: return "DOCTBL";
+            case LINKHTML: return "LINKHTML";
+            case LOCALATTR: return "LOCALATTR";
+            case LOCALMRKP: return "LOCALMRKP";
+            case ORDERED: return "ordered";
+            case REFR: return "REFR";
+            case TBLCOL: return "TBLCOL";
+            case TBLCOLGP: return "TBLCOLGP";
+            case TBLDATA: return "TBLDATA";
+            case TBLHDR: return "TBLHDR";
+            case TBLROW: return "TBLROW";
+            case TBODY: return "tbody";
+            case TFOOT: return "tfoot";
+            case THEAD: return "thead";
+            case UNORDERED: return "unordered";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActClass";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACT: return "A record of something that is being done, has been done, can be done, or is intended or requested to be done.\r\n\n                        \n                           Examples:The kinds of acts that are common in health care are (1) a clinical observation, (2) an assessment of health condition (such as problems and diagnoses), (3) healthcare goals, (4) treatment services (such as medication, surgery, physical and psychological therapy), (5) assisting, monitoring or attending, (6) training and education services to patients and their next of kin, (7) and notary services (such as advanced directives or living will), (8)  editing and maintaining documents, and many others.\r\n\n                        \n                           Discussion and Rationale: Acts are the pivot of the RIM; all domain information and processes are represented primarily in Acts. Any profession or business, including healthcare, is primarily constituted of intentional and occasionally non-intentional actions, performed and recorded by responsible actors. An Act-instance is a record of such an action.\r\n\n                        Acts connect to Entities in their Roles through Participations and connect to other Acts through ActRelationships. Participations are the authors, performers and other responsible parties as well as subjects and beneficiaries (which includes tools and material used in the performance of the act, which are also subjects). The moodCode distinguishes between Acts that are meant as factual records, vs. records of intended or ordered services, and the other modalities in which act can appear.\r\n\n                        One of the Participations that all acts have (at least implicitly) is a primary author, who is responsible of the Act and who \"owns\" the act. Responsibility for the act means responsibility for what is being stated in the Act and as what it is stated. Ownership of the act is assumed in the sense of who may operationally modify the same act. Ownership and responsibility of the Act is not the same as ownership or responsibility of what the Act-object refers to in the real world. The same real world activity can be described by two people, each being the author of their Act, describing the same real world activity. Yet one can be a witness while the other can be a principal performer. The performer has responsibilities for the physical actions; the witness only has responsibility for making a true statement to the best of his or her ability. The two Act-instances may even disagree, but because each is properly attributed to its author, such disagreements can exist side by side and left to arbitration by a recipient of these Act-instances.\r\n\n                        In this sense, an Act-instance represents a \"statement\" according to Rector and Nowlan (1991) [Foundations for an electronic medical record. Methods Inf Med. 30.]  Rector and Nowlan have emphasized the importance of understanding the medical record not as a collection of facts, but \"a faithful record of what clinicians have heard, seen, thought, and done.\" Rector and Nowlan go on saying that \"the other requirements for a medical record, e.g., that it be attributable and permanent, follow naturally from this view.\" Indeed the Act class is this attributable statement, and the rules of updating acts (discussed in the state-transition model, see Act.statusCode) versus generating new Act-instances are designed according to this principle of permanent attributable statements.\r\n\n                        Rector and Nolan focus on the electronic medical record as a collection of statements, while attributed statements, these are still mostly factual statements. However, the Act class goes beyond this limitation to attributed factual statements, representing what is known as \"speech-acts\" in linguistics and philosophy.  The notion of speech-act includes that there is pragmatic meaning in language utterances, aside from just factual statements; and that these utterances interact with the real world to change the state of affairs, even directly cause physical activities to happen. For example, an order is a speech act that (provided it is issued adequately) will cause the ordered action to be physically performed. The speech act theory has culminated in the seminal work by Austin (1962) [How to do things with words. Oxford University Press].\r\n\n                        An activity in the real world may progress from defined, through planned and ordered to executed, which is represented as the mood of the Act. Even though one might think of a single activity as progressing from planned to executed, this progression is reflected by multiple Act-instances, each having one and only one mood that will not change along the Act-instance life cycle.  This is because the attribution and content of speech acts along this progression of an activity may be different, and it is often critical that a permanent and faithful record be maintained of this progression. The specification of orders or promises or plans must not be overwritten by the specification of what was actually done, so as to allow comparing actions with their earlier specifications. Act-instances that describe this progression of the same real world activity are linked through the ActRelationships (of the relationship category \"sequel\").\r\n\n                        Act as statements or speech-acts are the only representation of real world facts or processes in the HL7 RIM. The truth about the real world is constructed through a combination (and arbitration) of such attributed statements only, and there is no class in the RIM whose objects represent \"objective state of affairs\" or \"real processes\" independent from attributed statements. As such, there is no distinction between an activity and its documentation. Every Act includes both to varying degrees. For example, a factual statement made about recent (but past) activities, authored (and signed) by the performer of such activities, is commonly known as a procedure report or original documentation (e.g., surgical procedure report, clinic note etc.). Conversely, a status update on an activity that is presently in progress, authored by the performer (or a close observer) is considered to capture that activity (and is later superceded by a full procedure report). However, both status update and procedure report are acts of the same kind, only distinguished by mood and state (see statusCode) and completeness of the information.";
+            case _ACTCLASSRECORDORGANIZER: return "Used to group a set of acts sharing a common context. Organizer structures can nest within other context structures - such as where a document is contained within a folder, or a folder is contained within an EHR extract.";
+            case COMPOSITION: return "A context representing a grouped commitment of information to the EHR. It is considered the unit of modification of the record, the unit of transmission in record extracts, and the unit of attestation by authorizing clinicians.\r\n\n                        A composition represents part of a patient record originating from a single interaction between an authenticator and the record.\r\n\n                        Unless otherwise stated all statements within a composition have the same authenticator, apply to the same patient and were recorded in a single session of use of a single application.\r\n\n                        A composition contains organizers and entries.";
+            case DOC: return "The notion of a document comes particularly from the paper world, where it corresponds to the contents recorded on discrete pieces of paper. In the electronic world, a document is a kind of composition that bears resemblance to their paper world counter-parts. Documents typically are meant to be human-readable.\r\n\n                        HL7's notion of document differs from that described in the W3C XML Recommendation, in which a document refers specifically to the contents that fall between the root element's start-tag and end-tag. Not all XML documents are HL7 documents.";
+            case DOCCLIN: return "A clinical document is a documentation of clinical observations and services, with the following characteristics:\r\n\n                        \n                           \n                              Persistence - A clinical document continues to exist in an unaltered state, for a time period defined by local and regulatory requirements; \r\n\n                           \n                           \n                              Stewardship - A clinical document is maintained by a person or organization entrusted with its care; \r\n\n                           \n                           \n                              Potential for authentication - A clinical document is an assemblage of information that is intended to be legally authenticated; \r\n\n                           \n                           \n                              Wholeness - Authentication of a clinical document applies to the whole and does not apply to portions of the document without the full context of the document;\r\n\n                           \n                           \n                              Human readability - A clinical document is human readable.";
+            case CDALVLONE: return "A clinical document that conforms to Level One of the HL7 Clinical Document Architecture (CDA)";
+            case CONTAINER: return "Description: Container of clinical statements. Navigational. No semantic content. Knowledge of the section code is not required to interpret contained observations. Represents a heading in a heading structure, or \"container tree\".\r\n\n                        The record entries relating to a single clinical session are usually grouped under headings that represent phases of the encounter, or assist with layout and navigation. Clinical headings usually reflect the clinical workflow during a care session, and might also reflect the main author's reasoning processes. Much research has demonstrated that headings are used differently by different professional groups and specialties, and that headings are not used consistently enough to support safe automatic processing of the E H R.";
+            case CATEGORY: return "A group of entries within a composition or topic that have a common characteristic - for example, Examination, Diagnosis, Management OR Subjective, Objective, Analysis, Plan.\r\n\n                        The distinction from Topic relates to value sets. For Category there is a bounded list of things like \"Examination\", \"Diagnosis\" or SOAP categories. For Topic the list is wide open to any clinical condition or reason for a part of an encounter.\r\n\n                        A CATEGORY MAY CONTAIN ENTRIES.";
+            case DOCBODY: return "A context that distinguishes the body of a document from the document header. This is seen, for instance, in HTML documents, which have discrete  and  elements.";
+            case DOCSECT: return "A context that subdivides the body of a document. Document sections are typically used for human navigation, to give a reader a clue as to the expected content. Document sections are used to organize and provide consistency to the contents of a document body. Document sections can contain document sections and can contain entries.";
+            case TOPIC: return "A group of entries within a composition that are related to a common clinical theme - such as a specific disorder or problem, prevention, screening and provision of contraceptive services.\r\n\n                        A topic may contain categories and entries.";
+            case EXTRACT: return "This context represents the part of a patient record conveyed in a single communication. It is drawn from a providing system for the purposes of communication to a requesting process (which might be another repository, a client application or a middleware service such as an electronic guideline engine), and supporting the faithful inclusion of the communicated data in the receiving system.\r\n\n                        An extract may be the entirety of the patient record as held by the sender or it may be a part of that record (e.g. changes since a specified date).\r\n\n                        An extract contains folders or compositions.\r\n\n                        An extract cannot contain another extract.";
+            case EHR: return "A context that comprises all compositions. The EHR is an extract that includes the entire chart.\r\n\n                        \n                           NOTE: In an exchange scenario, an EHR is a specialization of an extract.";
+            case FOLDER: return "A context representing the high-level organization of an extract e.g. to group parts of the record by episode, care team, clinical specialty, clinical condition, or source application. Internationally, this kind of organizing structure is used variably: in some centers and systems the folder is treated as an informal compartmentalization of the overall health record; in others it might represent a significant legal portion of the EHR relating to the originating enterprise or team.\r\n\n                        A folder contains compositions.\r\n\n                        Folders may be nested within folders.";
+            case GROUPER: return "Definition: An ACT that organizes a set of component acts into a semantic grouping that share a particular context such as timeframe, patient, etc.\r\n\n                        \n                           UsageNotes: The focus in a GROUPER act is the grouping of the contained acts.  For example \"a request to group\" (RQO), \"a type of grouping that is allowed to occur\" (DEF), etc.\r\n\n                        Unlike WorkingList, which represents a dynamic, shared, continuously updated collection to provide a \"view\" of a set of objects, GROUPER collections tend to be static and simply indicate a shared set of semantics.  Note that sharing of semantics can be achieved using ACT as well.  However, with GROUPER, the sole semantic is of grouping.";
+            case CLUSTER: return "Description:An ACT that organizes a set of component acts into a semantic grouping that have a shared subject. The subject may be either a subject participation (SBJ), subject act relationship (SUBJ), or child participation/act relationship types.\r\n\n                        \n                           Discussion: The focus in a CLUSTER act is the grouping of the contained acts.  For example \"a request to cluster\" (RQO), \"a type of cluster that is allowed to occur\" (DEF), etc.\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           \n                              Radiologic investigations that might include administration of a dye, followed by radiographic observations;\r\n\n                           \n                           \n                              \"Isolate cluster\" which includes all testing and specimen processing performed on a specific isolate;\r\n\n                           \n                           \n                              a set of actions to perform at a particular stage in a clinical trial.";
+            case ACCM: return "An accommodation is a service provided for a Person or other LivingSubject in which a place is provided for the subject to reside for a period of time.  Commonly used to track the provision of ward, private and semi-private accommodations for a patient.";
+            case ACCT: return "A financial account established to track the net result of financial acts.";
+            case ACSN: return "A unit of work, a grouper of work items as defined by the system performing that work. Typically some laboratory order fulfillers communicate references to accessions in their communications regarding laboratory orders. Often one or more specimens are related to an accession such that in some environments the accession number is taken as an identifier for a specimen (group).";
+            case ADJUD: return "A transformation process where a requested invoice is transformed into an agreed invoice.  Represents the adjudication processing of an invoice (claim).  Adjudication results can be adjudicated as submitted, with adjustments or refused.\r\n\n                        Adjudication results comprise 2 components: the adjudication processing results and a restated (or adjudicated) invoice or claim";
+            case CACT: return "An act representing a system action such as the change of state of another act or the initiation of a query.  All control acts represent trigger events in the HL7 context.  ControlActs may occur in different moods.";
+            case ACTN: return "Sender asks addressee to do something depending on the focal Act of the payload.  An example is \"fulfill this order\".  Addressee has responsibilities to either reject the message or to act on it in an appropriate way (specified by the specific receiver responsibilities for the interaction).";
+            case INFO: return "Sender sends payload to addressee as information.  Addressee does not have responsibilities beyond serving addressee's own interest (i.e., read and memorize if you see fit).  This is equivalent to an FYI on a memo.";
+            case STC: return "Description: Sender transmits a status change pertaining to the focal act of the payload. This status of the focal act is the final state of the state transition. This can be either a request or an event, according to the mood of the control act.";
+            case CNTRCT: return "An agreement of obligation between two or more parties that is subject to contractual law and enforcement.";
+            case FCNTRCT: return "A contract whose value is measured in monetary terms.";
+            case COV: return "When used in the EVN mood, this concept means with respect to a covered party:\r\n\n                        \n                           \n                              A health care insurance policy or plan that is contractually binding between two or more parties; or \r\n\n                           \n                           \n                              A health care program, usually administered by government entities, that provides coverage to persons determined eligible under the terms of the program.\r\n\n                           \n                        \n                        \n                           \n                              When used in the definition (DEF) mood, COV means potential coverage for a patient who may or may not be a covered party.\r\n\n                           \n                           \n                              The concept's meaning is fully specified by the choice of ActCoverageTypeCode (abstract) ActProgramCode or ActInsurancePolicyCode.";
+            case CONC: return "Definition: A worry that tends to persist over time and has as its subject a state or process. The subject of the worry has the potential to require intervention or management.\r\n\n                        \n                           Examples: an observation result, procedure, substance administration, equipment repair status, device recall status, a health risk, a financial risk, public health risk, pregnancy, health maintenance, allergy, and acute or chronic illness.";
+            case HCASE: return "A public health case is a Concern about an observation or event that has a specific significance for public health. The creation of a PublicHealthCase initiates the tracking of the object of concern.  The decision to track is related to but somewhat independent of the underlying event or observation.\r\n\n                        \n                           UsageNotes: Typically a Public Health Case involves an instance or instances of a reportable infectious disease or other condition. The public health case can include a health-related event concerning a single individual or it may refer to multiple health-related events that are occurrences of the same disease or condition of interest to public health.\r\n\n                        A public health case definition (Act.moodCode = \"definition\") includes the description of the clinical, laboratory, and epidemiologic indicators associated with a disease or condition of interest to public health. There are case definitions for conditions that are reportable, as well as for those that are not. A public health case definition is a construct used by public health for the purpose of counting cases, and should not be used as clinical indications for treatment. Examples include AIDS, toxic-shock syndrome, and salmonellosis and their associated indicators that are used to define a case.";
+            case OUTBR: return "An Outbreak is a concern resulting from a series of public health cases.\r\n\n                        \n                           UsageNotes: The date on which an outbreak starts is the earliest date of onset among the cases assigned to the outbreak and its ending date is the last date of onset among the cases assigned to the outbreak. The effectiveTime attribute is used to convey the relevant dates for the case. An outbreak definition (Act.moodCode = \"definition\" includes the criteria for the number, types and occurrence pattern of cases necessary to declare an outbreak and to judge the severity of an outbreak.";
+            case CONS: return "The Consent class represents informed consents and all similar medico-legal transactions between the patient (or his legal guardian) and the provider. Examples are informed consent for surgical procedures, informed consent for clinical trials, advanced beneficiary notice, against medical advice decline from service, release of information agreement, etc.\r\n\n                        The details of consents vary. Often an institution has a number of different consent forms for various purposes, including reminding the physician about the topics to mention. Such forms also include patient education material. In electronic medical record communication, consents thus are information-generating acts on their own and need to be managed similar to medical activities. Thus, Consent is modeled as a special class of Act.\r\n\n                        The \"signatures\" to the consent document are represented electronically through Participation instances to the consent object. Typically an informed consent has Participation.typeCode of \"performer\", the healthcare provider informing the patient, and \"consenter\", the patient or legal guardian. Some consent may associate a witness or a notary public (e.g., living wills, advanced directives). In consents where a healthcare provider is not required (e.g. living will), the performer may be the patient himself or a notary public.\r\n\n                        Some consent has a minimum required delay between the consent and the service, so as to allow the patient to rethink his decisions. This minimum delay can be expressed in the act definition by the ActRelationship.pauseQuantity attribute that delays the service until the pause time has elapsed after the consent has been completed.";
+            case CONTREG: return "An Act where a container is registered either via an automated sensor, such as a barcode reader,  or by manual receipt";
+            case CTTEVENT: return "An identified point during a clinical trial at which one or more actions are scheduled to be performed (definition mood), or are actually performed (event mood).  The actions may or may not involve an encounter between the subject and a healthcare professional.";
+            case DISPACT: return "An action taken with respect to a subject Entity by a regulatory or authoritative body with supervisory capacity over that entity. The action is taken in response to behavior by the subject Entity that body finds to be 							undesirable.\r\n\n                        Suspension, license restrictions, monetary fine, letter of reprimand, mandated training, mandated supervision, etc.Examples:";
+            case EXPOS: return "An interaction between entities that provides opportunity for transmission of a physical, chemical, or biological agent from an exposure source entity to an exposure target entity.\r\n\n                        \n                           Examples:  The following examples are provided to indicate what interactions are considered exposures rather than other types of Acts:\r\n\n                        \n                           \n                              A patient accidentally receives three times the recommended dose of their medication due to a dosing error. \r\n\n                              \n                                 \n                                    This is a substance administration.  Public health and/or safety authorities may also be interested in documenting this with an associated exposure.\r\n\n                                 \n                              \n                           \n                           \n                              A patient accidentally is dispensed an incorrect medicine (e.g., clomiphene instead of clomipramine).  They have taken several doses before the mistake is detected.  They are therefore \"exposed\" to a medicine that there was no therapeutic indication for them to receive. \r\n\n                              \n                                 \n                                    There are several substance administrations in this example.  Public health and/or safety authorities may also be interested in documenting this with associated exposures.\r\n\n                                 \n                              \n                           \n                           \n                              In a busy medical ward, a patient is receiving chemotherapy for a lymphoma.  Unfortunately, the IV infusion bag containing the medicine splits, spraying cytotoxic medication over the patient being treated and the patient in the adjacent bed. \r\n\n                              \n                                 \n                                    There are three substance administrations in this example.  The first is the intended one (IV infusion) with its associated (implicit) exposure.  There is an incident with an associated substance administration to the same patient involving the medication sprayed over the patient as well as an associated exposure.  Additionally, the incident includes a substance administration involving the spraying of medication on the adjacent patient, also with an associated exposure.\r\n\n                                 \n                              \n                           \n                           \n                              A patient who is a refugee from a war-torn African nation arrives in a busy inner city A&E department suffering from a cough with bloody sputum.  Not understanding the registration and triage process, they sit in the waiting room for several hours before it is noticed that they have not booked in.  As soon as they are being processed, it is suspected that they are suffering from TB.  Vulnerable (immunosuppressed) patients who were sharing the waiting room with this patient may have been exposed to the tubercule bacillus, and must be traced for investigation. \r\n\n                              \n                                 \n                                    This is an exposure (or possibly multiple exposures) in the waiting room involving the refugee and everyone else in the waiting room during the period.  There might also be a number of known or presumed substance administrations (coughing) via several possible routes.  The substance administrations are only hypotheses until confirmed by further testing.\r\n\n                                 \n                              \n                           \n                           \n                              A patient who has received an elective total hip replacement procedure suffers a prolonged stay in hospital, due to contracting an MRSA infection in the surgical wound site after the surgery. \r\n\n                              \n                                 \n                                    This is an exposure to MRSA.  Although there was some sort of substance administration, it's possible the exact mechanism for introduction of the MRSA into the wound will not be identified.\r\n\n                                 \n                              \n                           \n                           \n                              Routine maintenance of the X-ray machines at a local hospital reveals a serious breach of the shielding on one of the machines.  Patients who have undergone investigations using that machine in the last month are likely to have been exposed to significantly higher doses of X-rays than was intended, and must be tracked for possible adverse effects. \r\n\n                              \n                                 \n                                    There has been an exposure of each patient who used the machine in the past 30 days. Some patients may have had substance administrations.\r\n\n                                 \n                              \n                           \n                           \n                              A new member of staff is employed in the laundry processing room of a small cottage hospital, and a misreading of the instructions for adding detergents results in fifty times the usual concentration of cleaning materials being added to a batch of hospital bedding.  As a result, several patients have been exposed to very high levels of detergents still present in the \"clean\" bedding, and have experienced dermatological reactions to this. \r\n\n                              \n                                 \n                                    There has been an incident with multiple exposures to several patients.  Although there are substance administrations involving the application of the detergent to the skin of the patients, it is expected that the substance administrations would not be directly documented.\r\n\n                                 \n                              \n                           \n                           \n                              Seven patients who are residents in a health care facility for the elderly mentally ill have developed respiratory problems. After several months of various tests having been performed and various medications prescribed to these patients, the problem is traced to their being \"sensitive\" to a new fungicide used in the wall plaster of the ward where these patients reside.\r\n\n                              \n                                 \n                                    The patients have been continuously exposed to the fungicide.  Although there have been continuous substance administrations (via breathing) this would not normally be documented as a substance administration.\r\n\n                                 \n                              \n                           \n                           \n                              A patient with osteoarthritis of the knees is treated symptomatically using analgesia, paracetamol (acetaminophen) 1g up to four times a day for pain relief.  His GP does not realize that the patient has, 20 years previously (while at college) had severe alcohol addiction problems, and now, although this is completely under control, his liver has suffered significantly, leaving him more sensitive to hepatic toxicity from paracetamol use.  Later that year, the patient returns with a noticeable level of jaundice.  Paracetamol is immediately withdrawn and alternative solutions for the knee pain are sought.  The jaundice gradually subsides with conservative management, but referral to the gastroenterologist is required for advice and monitoring. \r\n\n                              \n                                 \n                                    There is a substance administration with an associated exposure.  The exposure component is based on the relative toxic level of the substance to a patient with a compromised liver function.\r\n\n                                 \n                              \n                           \n                           \n                              A patient goes to their GP complaining of abdominal pain, having been discharged from the local hospital ten days' previously after an emergency appendectomy.  The GP can find nothing particularly amiss, and presumes it is post operative surgical pain that will resolve.  The patient returns a fortnight later, when the GP prescribes further analgesia, but does decide to request an outpatient surgical follow-up appointment.  At this post-surgical outpatient review, the registrar decides to order an ultrasound, which, when performed three weeks later, shows a small faint inexplicable mass.  A laparoscopy is then performed, as a day case procedure, and a piece of a surgical swab is removed from the patient's abdominal cavity.  Thankfully, a full recovery then takes place. \r\n\n                              \n                                 \n                                    This is a procedural sequelae.  There may be an Incident recorded for this also.\r\n\n                                 \n                              \n                           \n                           \n                              A patient is slightly late for a regular pacemaker battery check in the Cardiology department of the local hospital.  They are hurrying down the second floor corridor.  A sudden summer squall has recently passed over the area, and rain has come in through an open corridor window leaving a small puddle on the corridor floor.  In their haste, the patient slips in the puddle and falls so badly that they have to be taken to the A&E department, where it is discovered on investigation they have slightly torn the cruciate ligament in their left knee. \r\n\n                              \n                                 \n                                    This is not an exposure.  There has been an incident.  \r\n\n                                 \n                              \n                           \n                        \n                        \n                           Usage Notes: This class deals only with opportunity and not the outcome of the exposure; i.e. not all exposed parties will necessarily experience actual harm or benefit.\r\n\n                        Exposure differs from Substance Administration by the absence of the participation of a performer in the act. \r\n\n                        The following participations SHOULD be used with the following participations to distinguish the specific entities:\r\n\n                        \n                           \n                              The exposed entity participates via the \"exposure target\" (EXPTRGT) participation.\r\n\n                           \n                           \n                              An entity that has carried the agent transmitted in the exposure participates via the \"exposure source\" (EXSRC) participation.  For example: \r\n\n                              \n                                 \n                                    a person or animal who carried an infectious disease and interacts (EXSRC) with another person or animal (EXPTRGT) transmitting the disease agent;\r\n\n                                 \n                                 \n                                    a place or other environment (EXSRC) and a person or animal (EXPTRGT) who is exposed in the presence of this environment.\r\n\n                                 \n                              \n                           \n                           \n                              When it is unknown whether a participating entity is the source of the agent (EXSRC) or the target of the transmission (EXPTRGT), the \"exposure participant\" (EXPART) is used.\r\n\n                           \n                           \n                              The physical (including energy), chemical or biological substance which is participating in the exposure uses the \"exposure agent\" (EXPAGNT) participation.  There are at least three scenarios:\r\n\n                              \n                                 \n                                    the player of the Role that participates as EXPAGNT is the chemical or biological substance mixed or carried by the scoper-entity of the Role (e.g., ingredient role); or \r\n\n                                 \n                                 \n                                    the player of the Role that participates as EXPAGNT is a mixture known to contain the chemical, radiological or biological substance of interest; or \r\n\n                                 \n                                 \n                                    the player of the Role that participates as a EXPAGNT is known to carry the agent (i.e., the player is a fomite, vector, etc.).\r\n\n                                 \n                              \n                           \n                        \n                        The Exposure.statusCode attribute should be interpreted as the state of the Exposure business object (e.g., active, aborted, completed) and not the clinical status of the exposure (e.g., probable, confirmed).  The clinical status of the exposure should be associated with the exposure via a subject observation.\r\n\n                        \n                           Design Comment: The usage notes require a clear criterion for determining whether an act is an exposure or substance administration-deleterious potential, uncertainty of actual transmission, or otherwise. SBADM states that the criterion is the presence of a performer-but there are examples above that call this criterion into question (e.g., the first one, concerning a dosing error).";
+            case AEXPOS: return "Description: \n                        \r\n\n                        An acquisition exposure act describes the proximity (location and time) through which the participating entity was potentially exposed to a physical (including energy), chemical or biological agent from another entity.  The acquisition exposure act is used in conjunction with transmission exposure acts as part of an analysis technique for contact tracing.  Although an exposure can be decomposed into transmission and acquisition exposures, there is no requirement that all exposures be treated in this fashion.\r\n\n                        \n                           Constraints:  The Acquisition Exposure inherits the participation constraints that apply to Exposure with the following exception.  The EXPSRC (exposure source) participation must never be associated with the Transmission Exposure either directly or via context conduction.";
+            case TEXPOS: return "Description: \n                        \r\n\n                        A transmission exposure act describes the proximity (time and location) over which the participating source entity was capable of transmitting a physical (including energy), chemical or biological substance agent to another entity.  The transmission exposure act is used in conjunction with acquisition exposure acts as part of an analysis technique for contact tracing.  Although an exposure can be decomposed into transmission and acquisition exposures, there is no requirement that all exposures be treated in this fashion.\r\n\n                        \n                           Constraints:  The Transmission Exposure inherits the participation constraints that apply to Exposure with the following exception.  The EXPTRGT (exposure target) participation must never be associated with the Transmission Exposure either directly or via context conduction.";
+            case INC: return "An event that occurred outside of the control of one or more of the parties involved.  Includes the concept of an accident.";
+            case INFRM: return "The act  of transmitting information and understanding about a topic to a subject where the participation association must be SBJ.\r\n\n                        \n                           Discussion: This act may be used to request that a patient or provider be informed about an Act, or to indicate that a person was informed about a particular act.";
+            case INVE: return "Represents concepts related to invoice processing in health care";
+            case LIST: return "Working list collects a dynamic list of individual instances of Act via ActRelationship which reflects the need of an individual worker, team of workers, or an organization to manage lists of acts for many different clinical and administrative reasons. Examples of working lists include problem lists, goal lists, allergy lists, and to-do lists.";
+            case MPROT: return "An officially or unofficially instituted program to track acts of a particular type or categorization.";
+            case OBS: return "Description:An act that is intended to result in new information about a subject. The main difference between Observations and other Acts is that Observations have a value attribute. The code attribute of Observation and the value attribute of Observation must be considered in combination to determine the semantics of the observation.\r\n\n                        \n                           Discussion:\n                        \r\n\n                        Structurally, many observations are name-value-pairs, where the Observation.code (inherited from Act) is the name and the Observation.value is the value of the property. Such a construct is also known as a  variable (a named feature that can assume a value) hence, the Observation class is always used to hold generic name-value-pairs or variables, even though the variable valuation may not be the result of an elaborate observation method. It may be a simple answer to a question or it may be an assertion or setting of a parameter.\r\n\n                        As with all Act statements, Observation statements describe what was done, and in the case of Observations, this includes a description of what was actually observed (results or answers); and those results or answers are part of the observation and not split off into other objects. \r\n\n                        The method of action is asserted by the Observation classCode or its subclasses at the least granular level, by the Observation.code attribute value at the medium level of granularity, and by the attribute value of observation.methodCode when a finer level of granularity is required. The method in whole or in part may also appear in the attribute value of Observation.value when using coded data types to express the value of the attribute. Relevant aspects of methodology may also be restated in value when the results themselves imply or state a methodology.\r\n\n                        An observation may consist of component observations each having their own Observation.code and Observation.value. In this case, the composite observation may not have an Observation.value for itself. For instance, a white blood cell count consists of the sub-observations for the counts of the various granulocytes, lymphocytes and other normal or abnormal blood cells (e.g., blasts). The overall white blood cell count Observation itself may therefore not have a value by itself (even though it could have one, e.g., the sum total of white blood cells). Thus, as long as an Act is essentially an Act of recognizing and noting information about a subject, it is an Observation, regardless of whether it has a simple value by itself or whether it has sub-observations.\r\n\n                        Even though observations are professional acts (see Act) and as such are intentional actions, this does not require that every possible outcome of an observation be pondered in advance of it being actually made. For instance, differential white blood cell counts (WBC) rarely show blasts, but if they do, this is part of the WBC observation even though blasts might not be predefined in the structure of a normal WBC. \r\n\n                        Clinical documents commonly have Subjective and Objective findings, both of which are kinds of Observations. In addition, clinical documents commonly contain Assessments, which are also kinds of Observations. Thus, the establishment of a diagnosis is an Observation. \r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           \n                              Recording the results of a Family History Assessment\r\n\n                           \n                           \n                              Laboratory test and associated result\r\n\n                           \n                           \n                              Physical exam test and associated result\r\n\n                           \n                           \n                              Device temperature\r\n\n                           \n                           \n                              Soil lead level";
+            case _ACTCLASSROI: return "Regions of Interest (ROI) within a subject Act. Primarily used for making secondary observations on a subset of a subject observation. The relationship between a ROI and its referenced Act is specified through an ActRelationship of type \"subject\" (SUBJ), which must always be present.";
+            case ROIBND: return "A Region of Interest (ROI) specified for a multidimensional observation, such as an Observation Series (OBSSER). The ROI is specified using a set of observation criteria, each delineating the boundary of the region in one of the dimensions in the multidimensional observation. The relationship between a ROI and its referenced Act is specified through an ActRelationship of type subject (SUBJ), which must always be present. Each of the boundary criteria observations is connected with the ROI using ActRelationships of type \"has component\" (COMP). In each boundary criterion, the Act.code names the dimension and the Observation.value specifies the range of values inside the region. Typically the bounded dimension is continuous, and so the Observation.value will be an interval (IVL) data type. The Observation.value need not be specified if the respective dimension is only named but not constrained. For example, an ROI for the QT interval of a certain beat in ECG Lead II would contain 2 boundary criteria, one naming the interval in time (constrained), and the other naming the interval in ECG Lead II (only named, but not constrained).";
+            case ROIOVL: return "A Region of Interest (ROI) specified for an image using an overlay shape. Typically used to make reference to specific regions in images, e.g., to specify the location of a radiologic finding in an image or to specify the site of a physical finding by \"circling\" a region in a schematic picture of a human body. The units of the coordinate values are in pixels.  The origin is in the upper left hand corner, with positive X values going to the right and positive Y values going down. The relationship between a ROI and its referenced Act is specified through an ActRelationship of type \"subject\" (SUBJ), which must always be present.";
+            case _SUBJECTPHYSICALPOSITION: return "The spatial relationship of a subject whether human, other animal, or plant, to a frame of reference such as gravity or a collection device.";
+            case _SUBJECTBODYPOSITION: return "Contains codes for defining the observed, physical position of a subject, such as during an observation, assessment, collection of a specimen, etc.  ECG waveforms and vital signs, such as blood pressure, are two examples where a general, observed position typically needs to be noted.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case LLD: return "Lying on the left side.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case PRN: return "Lying with the front or ventral surface downward; lying face down.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case RLD: return "Lying on the right side.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case SFWL: return "A semi-sitting position in bed with the head of the bed elevated approximately 45 degrees.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case SIT: return "Resting the body on the buttocks, typically with upper torso erect or semi erect.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case STN: return "To be stationary, upright, vertical, on one's legs.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case SUP: return "Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case RTRD: return "Lying on the back, on an inclined plane, typically about 30-45 degrees with head raised and feet lowered.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case TRD: return "Lying on the back, on an inclined plane, typically about 30-45 degrees, with  head lowered and feet raised.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because it does not describe a type of Act (as it should in the ActClass code system), but rather encodes the result or value of an observation.  The same code has been added to the ObservationValue code system.";
+            case ALRT: return "An observation identifying a potential adverse outcome as a result of an Act or combination of Acts.\r\n\n                        \n                           Examples: Detection of a drug-drug interaction; Identification of a late-submission for an invoice; Requesting discharge for a patient who does not meet hospital-defined discharge criteria.\r\n\n                        \n                           Discussion: This class is commonly used for identifying 'business rule' or 'process' problems that may result in a refusal to carry out a particular request. In some circumstances it may be possible to 'bypass' a problem by modifying the request to acknowledge the issue and/or by providing some form of mitigation.\r\n\n                        \n                           Constraints: the Act or Acts that may cause the the adverse outcome are the target of a subject ActRelationship. The subbtypes of this concept indicate the type of problem being detected (e.g. drug-drug interaction) while the Observation.value is used to repesent a specific problem code (e.g. specific drug-drug interaction id).";
+            case BATTERY: return "Definition: An observation that is composed of a set of observations. These observations typically have a logical or practical grouping for generally accepted clinical or functional purposes, such as observations that are run together because of automation. A battery can define required and optional component observations and, in some cases, will define complex rules that determine whether or not a particular observation is made. BATTERY is a constraint on the Observation class in that it is understood to always be composed of component observations.\r\n\n                        \n                           UsageNotes: The focus in a BATTERY is that it is composed of individual observations. In request (RQO) mood, a battery is a request to perform the component observations. In event (EVN) mood a battery is a reporting of associated set of observation events. In definition mood a battery is the definition of the associated set of observations.\r\n\n                        \n                           Examples: Vital signs, Full blood count, Chemistry panel.";
+            case CLNTRL: return "The set of actions that define an experiment to assess the effectiveness and/or safety of a biopharmaceutical product (food, drug, device, etc.).  In definition mood, this set of actions is often embodied in a clinical trial protocol; in event mood, this designates the aggregate act of applying the actions to one or more subjects.";
+            case CNOD: return "An instance of Observation of a Condition at a point in time that includes any Observations or Procedures associated with that Condition as well as links to previous instances of Condition Node for the same Condition\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This concept has been deprecated because an alternative structure for tracking the evolution of a problem has been presented and adopted by the Care Provision Work Group.";
+            case COND: return "An observable finding or state that persists over time and tends to require intervention or management, and, therefore, distinguished from an Observation made at a point in time; may exist before an Observation of the Condition is made or after interventions to manage the Condition are undertaken. Examples: equipment repair status, device recall status, a health risk, a financial risk, public health risk, pregnancy, health maintenance, chronic illness";
+            case CASE: return "A public health case is an Observation representing a condition or event that has a specific significance for public health. Typically it involves an instance or instances of a reportable infectious disease or other condition. The public health case can include a health-related event concerning a single individual or it may refer to multiple health-related events that are occurrences of the same disease or condition of interest to public health. An outbreak involving multiple individuals may be considered as a type of public health case. A public health case definition (Act.moodCode = \"definition\") includes the description of the clinical, laboratory, and epidemiologic indicators associated with a disease or condition of interest to public health. There are case definitions for conditions that are reportable, as well as for those that are not. There are also case definitions for outbreaks. A public health case definition is a construct used by public health for the purpose of counting cases, and should not be used as clinical indications for treatment. Examples include AIDS, toxic-shock syndrome, and salmonellosis and their associated indicators that are used to define a case.";
+            case OUTB: return "An outbreak represents a series of public health cases. The date on which an outbreak starts is the earliest date of onset among the cases assigned to the outbreak, and its ending date is the last date of onset among the cases assigned to the outbreak.";
+            case DGIMG: return "Class for holding attributes unique to diagnostic images.";
+            case GEN: return "Description:An observation of genomic phenomena.";
+            case DETPOL: return "Description:A determinant peptide in a polypeptide as described by polypeptide.";
+            case EXP: return "Description:An expression level of genes/proteins or other expressed genomic entities.";
+            case LOC: return "Description:The position of a gene (or other significant sequence) on the genome.";
+            case PHN: return "Description:A genomic phenomenon that is expressed externally in the organism.";
+            case POL: return "Description:A polypeptide resulting from the translation of a gene.";
+            case SEQ: return "Description:A sequence of biomolecule like the DNA, RNA, protein and the like.";
+            case SEQVAR: return "Description:A variation in a sequence as described by BioSequence.";
+            case INVSTG: return "An formalized inquiry into the circumstances surrounding a particular unplanned event or potential event for the purposes of identifying possible causes and contributing factors for the event. This investigation could be conducted at a local institutional level or at the level of a local or national government.";
+            case OBSSER: return "Container for Correlated Observation Sequences sharing a common frame of reference.  All Observations of the same cd must be comparable and relative to the common frame of reference.  For example, a 3-channel ECG device records a 12-lead ECG in 4 steps (3 leads at a time).  Each of the separate 3-channel recordings would be in their own \"OBSCOR\".  And, all 4 OBSCOR would be contained in one OBSSER because all the times are relative to the same origin (beginning of the recording) and all the ECG signals were from a fixed set of electrodes.";
+            case OBSCOR: return "Container for Observation Sequences (Observations whose values are contained in LIST<>'s) having values correlated with each other.  Each contained Observation Sequence LIST<> must be the same length.  Values in the LIST<>'s are correlated based on index.  E.g. the values in position 2 in all the LIST<>'s are correlated.  This is analogous to a table where each column is an Observation Sequence with a LIST<> of values, and each row in the table is a correlation between the columns.  For example, a 12-lead ECG would contain 13 sequences: one sequence for time, and a sequence for each of the 12 leads.";
+            case POS: return "An observation denoting the physical location of a person or thing based on a reference coordinate system.";
+            case POSACC: return "Description:An observation representing the degree to which the assignment of the spatial coordinates, based on a matching algorithm by a geocoding engine against a reference spatial database, matches true or accepted values.";
+            case POSCOORD: return "Description:An observation representing one of a set of numerical values used to determine the position of a place.  The name of the coordinate value is determined by the reference coordinate system.";
+            case SPCOBS: return "An observation on a specimen in a laboratory environment that may affect processing, analysis or result interpretation";
+            case VERIF: return "An act which describes the process whereby a 'verifying party' validates either the existence of the Role attested to by some Credential or the actual Vetting act and its details.";
+            case PCPR: return "An Act that of taking on whole or partial responsibility for, or attention to, safety and well-being of a subject of care. \r\n\n                        \n                           Discussion: A care provision event may exist without any other care actions taking place. For example, when a patient is assigned to the care of a particular health professional.\r\n\n                        In request (RQO) mood care provision communicates a referral, which is a request:\r\n\n                        \n                           \n                              from one party (linked as a participant of type author (AUT)),\r\n\n                           \n                           \n                              to another party (linked as a participant of type performer (PRF),\r\n\n                           \n                           \n                              to take responsibility for a scope specified by the code attribute, \r\n\n                           \n                           \n                              for an entity (linked as a participant of type subject (SBJ)).\r\n\n                           \n                        \n                        The scope of the care for which responsibility is taken is identified by code attribute.\r\n\n                        In event (EVN) mood care provision indicates the effective time interval of a specified scope of responsibility by a performer (PRF) or set of performers (PRF) for a subject (SBJ).\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           \n                              Referral from GP to a specialist.\r\n\n                           \n                           \n                              Assignment of a patient or group of patients to the case list of a health professional.\r\n\n                           \n                           \n                              Assignment of inpatients to the care of particular nurses for a working shift.";
+            case ENC: return "An interaction between a patient and healthcare participant(s) for the purpose of providing patient service(s) or assessing the health status of a patient.  For example, outpatient visit to multiple departments, home health support (including physical therapy), inpatient hospital stay, emergency room visit, field visit (e.g., traffic accident), office visit, occupational therapy, telephone call.";
+            case POLICY: return "Description:A mandate, regulation, obligation, requirement, rule, or expectation unilaterally imposed by one party on:\r\n\n                        \n                           \n                              The activity of another party\r\n\n                           \n                           \n                              The behavior of another party\r\n\n                           \n                           \n                              The manner in which an act is executed";
+            case JURISPOL: return "Description:A mandate, regulation, obligation, requirement, rule, or expectation unilaterally imposed by a jurisdiction on:\r\n\n                        \n                           \n                              The activity of another party\r\n\n                           \n                           \n                              The behavior of another party\r\n\n                           \n                           \n                              The manner in which an act is executed\r\n\n                           \n                        \n                        \n                           Examples:A jurisdictional mandate regarding the prescribing and dispensing of a particular medication.  A jurisdictional privacy or security regulation dictating the manner in which personal health information is disclosed.  A jurisdictional requirement that certain services or health conditions are reported to a monitoring program, e.g., immunizations, methadone treatment, or cancer registries.";
+            case ORGPOL: return "Description:A mandate, obligation, requirement, rule, or expectation unilaterally imposed by an organization on:\r\n\n                        \n                           \n                              The activity of another party\r\n\n                           \n                           \n                              The behavior of another party\r\n\n                           \n                           \n                              The manner in which an act is executed\r\n\n                           \n                        \n                        \n                           Examples:A clinical or research protocols imposed by a payer, a malpractice insurer, or an institution to which a provider must adhere.  A mandate imposed by a denominational institution for a provider to provide or withhold certain information from the patient about treatment options.";
+            case SCOPOL: return "Description:An ethical or clinical obligation, requirement, rule, or expectation imposed or strongly encouraged by organizations that oversee particular clinical domains or provider certification which define the boundaries within which a provider may practice and which may have legal basis or ramifications on:\r\n\n                        \n                           \n                              The activity of another party\r\n\n                           \n                           \n                              The behavior of another party\r\n\n                           \n                           \n                              The manner in which an act is executed\r\n\n                           \n                        \n                        \n                           Examples:An ethical obligation for a provider to fully inform a patient about all treatment options.  An ethical obligation for a provider not to disclose personal health information that meets certain criteria, e.g., where disclosure might result in harm to the patient or another person.  The set of health care services which a provider is credentialed or privileged to provide.";
+            case STDPOL: return "Description:A requirement, rule, or expectation typically documented as guidelines, protocols, or formularies imposed or strongly encouraged by an organization that oversees or has authority over the practices within a domain, and which may have legal basis or ramifications on:\r\n\n                        \n                           \n                              The activity of another party\r\n\n                           \n                           \n                              The behavior of another party\r\n\n                           \n                           \n                              The manner in which an act is executed\r\n\n                           \n                        \n                        \n                           Examples:A payer may require a prescribing provider to adhere to formulary guidelines.  An institution may adopt clinical guidelines and protocols and implement these within its electronic health record and decision support systems.";
+            case PROC: return "An Act whose immediate and primary outcome (post-condition) is the alteration of the physical condition of the subject.\r\n\n                        \n                           Examples: : Procedures may involve the disruption of some body surface (e.g. an incision in a surgical procedure), but they also include conservative procedures such as reduction of a luxated join, chiropractic treatment, massage, balneotherapy, acupuncture, shiatsu, etc. Outside of clinical medicine, procedures may be such things as alteration of environments (e.g. straightening rivers, draining swamps, building dams) or the repair or change of machinery etc.";
+            case SBADM: return "The act of introducing or otherwise applying a substance to the subject.\r\n\n                        \n                           Discussion: The effect of the substance is typically established on a biochemical basis, however, that is not a requirement. For example, radiotherapy can largely be described in the same way, especially if it is a systemic therapy such as radio-iodine.  This class also includes the application of chemical treatments to an area.\r\n\n                        \n                           Examples: Chemotherapy protocol; Drug prescription; Vaccination record";
+            case SBEXT: return "Description: The act of removing a substance from the subject.";
+            case SPECCOLLECT: return "A procedure for obtaining a specimen from a source entity.";
+            case REG: return "Represents the act of maintaining information about the registration of its associated registered subject. The subject can be either an Act or a Role, and includes subjects such as lab exam definitions, drug protocol definitions, prescriptions, persons, patients, practitioners, and equipment.\r\n\n                        The registration may have a unique identifier - separate from the unique identification of the subject - as well as a core set of related participations and act relationships that characterize the registration event and aid in the disposition of the subject information by a receiving system.";
+            case REV: return "The act of examining and evaluating the subject, usually another act. For example, \"This prescription needs to be reviewed in 2 months.\"";
+            case SPCTRT: return "A procedure or treatment performed on a specimen to prepare it for analysis";
+            case SPLY: return "Supply orders and deliveries are simple Acts that focus on the delivered product. The product is associated with the Supply Act via Participation.typeCode=\"product\". With general Supply Acts, the precise identification of the Material (manufacturer, serial numbers, etc.) is important.  Most of the detailed information about the Supply should be represented using the Material class.  If delivery needs to be scheduled, tracked, and billed separately, one can associate a Transportation Act with the Supply Act.  Pharmacy dispense services are represented as Supply Acts, associated with a SubstanceAdministration  Act. The SubstanceAdministration class represents the administration of medication, while dispensing is supply.";
+            case DIET: return "Diet services are supply services, with some aspects resembling Medication services: the detail of the diet is given as a description of the Material associated via Participation.typeCode=\"product\". Medically relevant diet types may be communicated in the Diet.code attribute using domain ActDietCode, however, the detail of the food supplied and the various combinations of dishes should be communicated as Material instances.\r\n\n                        \n                           Deprecation Note\n                        \r\n\n                        \n                           Class: Use either the Supply class (if dealing with what should be given to the patient) or SubstanceAdministration class (if dealing with what the patient should consume)\r\n\n                        \n                           energyQuantity: This quantity can be conveyed by using a Content relationship with a quantity attribute expressing the calories\r\n\n                        \n                           carbohydrateQuantity:This quantity can be conveyed using a Content relationship to an Entity with a code of  carbohydrate and a quantity attribute on the content relationship.";
+            case STORE: return "The act of putting something away for safe keeping. The \"something\" may be physical object such as a specimen, or information, such as observations regarding a specimen.";
+            case SUBST: return "Definition: Indicates that the subject Act has undergone or should undergo substitution of a type indicated by Act.code.\r\n\n                        Rationale: Used to specify \"allowed\" substitution when creating orders, \"actual\" susbstitution when sending events, as well as the reason for the substitution and who was responsible for it.";
+            case TRFR: return "Definition: The act of transferring information without the intent of imparting understanding about a topic to the subject that is the recipient or holder of the transferred information where the participation association must be RCV or HLD.";
+            case TRNS: return "Transportation is the moving of a payload (people or material) from a location of origin to a destination location.  Thus, any transport service has the three target instances of type payload, origin, and destination, besides the targets that are generally used for any service (i.e., performer, device, etc.)";
+            case XACT: return "A sub-class of Act representing any transaction between two accounts whose value is measured in monetary terms.\r\n\n                        In the \"intent\" mood, communicates a request for a transaction to be initiated, or communicates a transfer of value between two accounts.\r\n\n                        In the \"event\" mood, communicates the posting of a transaction to an account.";
+            case _ACTCLASSCONTAINER: return "ActClassContainer";
+            case ENTRY: return "This context represents the information acquired and recorded for an observation, a clinical statement such as a portion of the patient's history or an inference or assertion, or an action that might be intended or has actually been performed. This class may represent both the actual data describing the observation, inference, or action, and optionally the details supporting the clinical reasoning process such as a reference to an electronic guideline, decision support system, or other knowledge reference.";
+            case ORGANIZER: return "Organizer of entries. Navigational. No semantic content. Knowledge of the section code is not required to interpret contained observations. Represents a heading in a heading structure, or \"organizer tree\".\r\n\n                        The record entries relating to a single clinical session are usually grouped under headings that represent phases of the encounter, or assist with layout and navigation. Clinical headings usually reflect the clinical workflow during a care session, and might also reflect the main author's reasoning processes. Much research has demonstrated that headings are used differently by different professional groups and specialties, and that headings are not used consistently enough to support safe automatic processing of the E H R.";
+            case DOCCNTNT: return "";
+            case DOCLIST: return "";
+            case DOCLSTITM: return "";
+            case DOCPARA: return "";
+            case DOCTBL: return "";
+            case LINKHTML: return "";
+            case LOCALATTR: return "";
+            case LOCALMRKP: return "";
+            case ORDERED: return "";
+            case REFR: return "";
+            case TBLCOL: return "";
+            case TBLCOLGP: return "";
+            case TBLDATA: return "";
+            case TBLHDR: return "";
+            case TBLROW: return "";
+            case TBODY: return "";
+            case TFOOT: return "";
+            case THEAD: return "";
+            case UNORDERED: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACT: return "act";
+            case _ACTCLASSRECORDORGANIZER: return "record organizer";
+            case COMPOSITION: return "composition";
+            case DOC: return "document";
+            case DOCCLIN: return "clinical document";
+            case CDALVLONE: return "CDA Level One clinical document";
+            case CONTAINER: return "record container";
+            case CATEGORY: return "category";
+            case DOCBODY: return "document body";
+            case DOCSECT: return "document section";
+            case TOPIC: return "topic";
+            case EXTRACT: return "extract";
+            case EHR: return "electronic health record";
+            case FOLDER: return "folder";
+            case GROUPER: return "grouper";
+            case CLUSTER: return "Cluster";
+            case ACCM: return "accommodation";
+            case ACCT: return "account";
+            case ACSN: return "accession";
+            case ADJUD: return "financial adjudication";
+            case CACT: return "control act";
+            case ACTN: return "action";
+            case INFO: return "information";
+            case STC: return "state transition control";
+            case CNTRCT: return "contract";
+            case FCNTRCT: return "financial contract";
+            case COV: return "coverage";
+            case CONC: return "concern";
+            case HCASE: return "public health case";
+            case OUTBR: return "outbreak";
+            case CONS: return "consent";
+            case CONTREG: return "container registration";
+            case CTTEVENT: return "clinical trial timepoint event";
+            case DISPACT: return "disciplinary action";
+            case EXPOS: return "exposure";
+            case AEXPOS: return "acquisition exposure";
+            case TEXPOS: return "transmission exposure";
+            case INC: return "incident";
+            case INFRM: return "inform";
+            case INVE: return "invoice element";
+            case LIST: return "working list";
+            case MPROT: return "monitoring program";
+            case OBS: return "observation";
+            case _ACTCLASSROI: return "ActClassROI";
+            case ROIBND: return "bounded ROI";
+            case ROIOVL: return "overlay ROI";
+            case _SUBJECTPHYSICALPOSITION: return "subject physical position";
+            case _SUBJECTBODYPOSITION: return "subject body position";
+            case LLD: return "left lateral decubitus";
+            case PRN: return "prone";
+            case RLD: return "right lateral decubitus";
+            case SFWL: return "Semi-Fowler's";
+            case SIT: return "sitting";
+            case STN: return "standing";
+            case SUP: return "supine";
+            case RTRD: return "reverse trendelenburg";
+            case TRD: return "trendelenburg";
+            case ALRT: return "detected issue";
+            case BATTERY: return "battery";
+            case CLNTRL: return "clinical trial";
+            case CNOD: return "Condition Node";
+            case COND: return "Condition";
+            case CASE: return "public health case";
+            case OUTB: return "outbreak";
+            case DGIMG: return "diagnostic image";
+            case GEN: return "genomic observation";
+            case DETPOL: return "determinant peptide";
+            case EXP: return "expression level";
+            case LOC: return "locus";
+            case PHN: return "phenotype";
+            case POL: return "polypeptide";
+            case SEQ: return "bio sequence";
+            case SEQVAR: return "bio sequence variation";
+            case INVSTG: return "investigation";
+            case OBSSER: return "observation series";
+            case OBSCOR: return "correlated observation sequences";
+            case POS: return "position";
+            case POSACC: return "position accuracy";
+            case POSCOORD: return "position coordinate";
+            case SPCOBS: return "specimen observation";
+            case VERIF: return "Verification";
+            case PCPR: return "care provision";
+            case ENC: return "encounter";
+            case POLICY: return "policy";
+            case JURISPOL: return "jurisdictional policy";
+            case ORGPOL: return "organizational policy";
+            case SCOPOL: return "scope of practice policy";
+            case STDPOL: return "standard of practice policy";
+            case PROC: return "procedure";
+            case SBADM: return "substance administration";
+            case SBEXT: return "Substance Extraction";
+            case SPECCOLLECT: return "Specimen Collection";
+            case REG: return "registration";
+            case REV: return "review";
+            case SPCTRT: return "specimen treatment";
+            case SPLY: return "supply";
+            case DIET: return "diet";
+            case STORE: return "storage";
+            case SUBST: return "Substitution";
+            case TRFR: return "transfer";
+            case TRNS: return "transportation";
+            case XACT: return "financial transaction";
+            case _ACTCLASSCONTAINER: return "ActClassContainer";
+            case ENTRY: return "entry";
+            case ORGANIZER: return "organizer";
+            case DOCCNTNT: return "DOCCNTNT";
+            case DOCLIST: return "DOCLIST";
+            case DOCLSTITM: return "DOCLSTITM";
+            case DOCPARA: return "DOCPARA";
+            case DOCTBL: return "DOCTBL";
+            case LINKHTML: return "LINKHTML";
+            case LOCALATTR: return "LOCALATTR";
+            case LOCALMRKP: return "LOCALMRKP";
+            case ORDERED: return "ordered";
+            case REFR: return "REFR";
+            case TBLCOL: return "TBLCOL";
+            case TBLCOLGP: return "TBLCOLGP";
+            case TBLDATA: return "TBLDATA";
+            case TBLHDR: return "TBLHDR";
+            case TBLROW: return "TBLROW";
+            case TBODY: return "tbody";
+            case TFOOT: return "tfoot";
+            case THEAD: return "thead";
+            case UNORDERED: return "unordered";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActClassEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActClassEnumFactory.java
new file mode 100644
index 00000000000..90bdb622fe8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActClassEnumFactory.java
@@ -0,0 +1,550 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActClassEnumFactory implements EnumFactory {
+
+  public V3ActClass fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ACT".equals(codeString))
+      return V3ActClass.ACT;
+    if ("_ActClassRecordOrganizer".equals(codeString))
+      return V3ActClass._ACTCLASSRECORDORGANIZER;
+    if ("COMPOSITION".equals(codeString))
+      return V3ActClass.COMPOSITION;
+    if ("DOC".equals(codeString))
+      return V3ActClass.DOC;
+    if ("DOCCLIN".equals(codeString))
+      return V3ActClass.DOCCLIN;
+    if ("CDALVLONE".equals(codeString))
+      return V3ActClass.CDALVLONE;
+    if ("CONTAINER".equals(codeString))
+      return V3ActClass.CONTAINER;
+    if ("CATEGORY".equals(codeString))
+      return V3ActClass.CATEGORY;
+    if ("DOCBODY".equals(codeString))
+      return V3ActClass.DOCBODY;
+    if ("DOCSECT".equals(codeString))
+      return V3ActClass.DOCSECT;
+    if ("TOPIC".equals(codeString))
+      return V3ActClass.TOPIC;
+    if ("EXTRACT".equals(codeString))
+      return V3ActClass.EXTRACT;
+    if ("EHR".equals(codeString))
+      return V3ActClass.EHR;
+    if ("FOLDER".equals(codeString))
+      return V3ActClass.FOLDER;
+    if ("GROUPER".equals(codeString))
+      return V3ActClass.GROUPER;
+    if ("CLUSTER".equals(codeString))
+      return V3ActClass.CLUSTER;
+    if ("ACCM".equals(codeString))
+      return V3ActClass.ACCM;
+    if ("ACCT".equals(codeString))
+      return V3ActClass.ACCT;
+    if ("ACSN".equals(codeString))
+      return V3ActClass.ACSN;
+    if ("ADJUD".equals(codeString))
+      return V3ActClass.ADJUD;
+    if ("CACT".equals(codeString))
+      return V3ActClass.CACT;
+    if ("ACTN".equals(codeString))
+      return V3ActClass.ACTN;
+    if ("INFO".equals(codeString))
+      return V3ActClass.INFO;
+    if ("STC".equals(codeString))
+      return V3ActClass.STC;
+    if ("CNTRCT".equals(codeString))
+      return V3ActClass.CNTRCT;
+    if ("FCNTRCT".equals(codeString))
+      return V3ActClass.FCNTRCT;
+    if ("COV".equals(codeString))
+      return V3ActClass.COV;
+    if ("CONC".equals(codeString))
+      return V3ActClass.CONC;
+    if ("HCASE".equals(codeString))
+      return V3ActClass.HCASE;
+    if ("OUTBR".equals(codeString))
+      return V3ActClass.OUTBR;
+    if ("CONS".equals(codeString))
+      return V3ActClass.CONS;
+    if ("CONTREG".equals(codeString))
+      return V3ActClass.CONTREG;
+    if ("CTTEVENT".equals(codeString))
+      return V3ActClass.CTTEVENT;
+    if ("DISPACT".equals(codeString))
+      return V3ActClass.DISPACT;
+    if ("EXPOS".equals(codeString))
+      return V3ActClass.EXPOS;
+    if ("AEXPOS".equals(codeString))
+      return V3ActClass.AEXPOS;
+    if ("TEXPOS".equals(codeString))
+      return V3ActClass.TEXPOS;
+    if ("INC".equals(codeString))
+      return V3ActClass.INC;
+    if ("INFRM".equals(codeString))
+      return V3ActClass.INFRM;
+    if ("INVE".equals(codeString))
+      return V3ActClass.INVE;
+    if ("LIST".equals(codeString))
+      return V3ActClass.LIST;
+    if ("MPROT".equals(codeString))
+      return V3ActClass.MPROT;
+    if ("OBS".equals(codeString))
+      return V3ActClass.OBS;
+    if ("_ActClassROI".equals(codeString))
+      return V3ActClass._ACTCLASSROI;
+    if ("ROIBND".equals(codeString))
+      return V3ActClass.ROIBND;
+    if ("ROIOVL".equals(codeString))
+      return V3ActClass.ROIOVL;
+    if ("_SubjectPhysicalPosition".equals(codeString))
+      return V3ActClass._SUBJECTPHYSICALPOSITION;
+    if ("_SubjectBodyPosition".equals(codeString))
+      return V3ActClass._SUBJECTBODYPOSITION;
+    if ("LLD".equals(codeString))
+      return V3ActClass.LLD;
+    if ("PRN".equals(codeString))
+      return V3ActClass.PRN;
+    if ("RLD".equals(codeString))
+      return V3ActClass.RLD;
+    if ("SFWL".equals(codeString))
+      return V3ActClass.SFWL;
+    if ("SIT".equals(codeString))
+      return V3ActClass.SIT;
+    if ("STN".equals(codeString))
+      return V3ActClass.STN;
+    if ("SUP".equals(codeString))
+      return V3ActClass.SUP;
+    if ("RTRD".equals(codeString))
+      return V3ActClass.RTRD;
+    if ("TRD".equals(codeString))
+      return V3ActClass.TRD;
+    if ("ALRT".equals(codeString))
+      return V3ActClass.ALRT;
+    if ("BATTERY".equals(codeString))
+      return V3ActClass.BATTERY;
+    if ("CLNTRL".equals(codeString))
+      return V3ActClass.CLNTRL;
+    if ("CNOD".equals(codeString))
+      return V3ActClass.CNOD;
+    if ("COND".equals(codeString))
+      return V3ActClass.COND;
+    if ("CASE".equals(codeString))
+      return V3ActClass.CASE;
+    if ("OUTB".equals(codeString))
+      return V3ActClass.OUTB;
+    if ("DGIMG".equals(codeString))
+      return V3ActClass.DGIMG;
+    if ("GEN".equals(codeString))
+      return V3ActClass.GEN;
+    if ("DETPOL".equals(codeString))
+      return V3ActClass.DETPOL;
+    if ("EXP".equals(codeString))
+      return V3ActClass.EXP;
+    if ("LOC".equals(codeString))
+      return V3ActClass.LOC;
+    if ("PHN".equals(codeString))
+      return V3ActClass.PHN;
+    if ("POL".equals(codeString))
+      return V3ActClass.POL;
+    if ("SEQ".equals(codeString))
+      return V3ActClass.SEQ;
+    if ("SEQVAR".equals(codeString))
+      return V3ActClass.SEQVAR;
+    if ("INVSTG".equals(codeString))
+      return V3ActClass.INVSTG;
+    if ("OBSSER".equals(codeString))
+      return V3ActClass.OBSSER;
+    if ("OBSCOR".equals(codeString))
+      return V3ActClass.OBSCOR;
+    if ("POS".equals(codeString))
+      return V3ActClass.POS;
+    if ("POSACC".equals(codeString))
+      return V3ActClass.POSACC;
+    if ("POSCOORD".equals(codeString))
+      return V3ActClass.POSCOORD;
+    if ("SPCOBS".equals(codeString))
+      return V3ActClass.SPCOBS;
+    if ("VERIF".equals(codeString))
+      return V3ActClass.VERIF;
+    if ("PCPR".equals(codeString))
+      return V3ActClass.PCPR;
+    if ("ENC".equals(codeString))
+      return V3ActClass.ENC;
+    if ("POLICY".equals(codeString))
+      return V3ActClass.POLICY;
+    if ("JURISPOL".equals(codeString))
+      return V3ActClass.JURISPOL;
+    if ("ORGPOL".equals(codeString))
+      return V3ActClass.ORGPOL;
+    if ("SCOPOL".equals(codeString))
+      return V3ActClass.SCOPOL;
+    if ("STDPOL".equals(codeString))
+      return V3ActClass.STDPOL;
+    if ("PROC".equals(codeString))
+      return V3ActClass.PROC;
+    if ("SBADM".equals(codeString))
+      return V3ActClass.SBADM;
+    if ("SBEXT".equals(codeString))
+      return V3ActClass.SBEXT;
+    if ("SPECCOLLECT".equals(codeString))
+      return V3ActClass.SPECCOLLECT;
+    if ("REG".equals(codeString))
+      return V3ActClass.REG;
+    if ("REV".equals(codeString))
+      return V3ActClass.REV;
+    if ("SPCTRT".equals(codeString))
+      return V3ActClass.SPCTRT;
+    if ("SPLY".equals(codeString))
+      return V3ActClass.SPLY;
+    if ("DIET".equals(codeString))
+      return V3ActClass.DIET;
+    if ("STORE".equals(codeString))
+      return V3ActClass.STORE;
+    if ("SUBST".equals(codeString))
+      return V3ActClass.SUBST;
+    if ("TRFR".equals(codeString))
+      return V3ActClass.TRFR;
+    if ("TRNS".equals(codeString))
+      return V3ActClass.TRNS;
+    if ("XACT".equals(codeString))
+      return V3ActClass.XACT;
+    if ("_ActClassContainer".equals(codeString))
+      return V3ActClass._ACTCLASSCONTAINER;
+    if ("ENTRY".equals(codeString))
+      return V3ActClass.ENTRY;
+    if ("ORGANIZER".equals(codeString))
+      return V3ActClass.ORGANIZER;
+    if ("DOCCNTNT".equals(codeString))
+      return V3ActClass.DOCCNTNT;
+    if ("DOCLIST".equals(codeString))
+      return V3ActClass.DOCLIST;
+    if ("DOCLSTITM".equals(codeString))
+      return V3ActClass.DOCLSTITM;
+    if ("DOCPARA".equals(codeString))
+      return V3ActClass.DOCPARA;
+    if ("DOCTBL".equals(codeString))
+      return V3ActClass.DOCTBL;
+    if ("LINKHTML".equals(codeString))
+      return V3ActClass.LINKHTML;
+    if ("LOCALATTR".equals(codeString))
+      return V3ActClass.LOCALATTR;
+    if ("LOCALMRKP".equals(codeString))
+      return V3ActClass.LOCALMRKP;
+    if ("ordered".equals(codeString))
+      return V3ActClass.ORDERED;
+    if ("REFR".equals(codeString))
+      return V3ActClass.REFR;
+    if ("TBLCOL".equals(codeString))
+      return V3ActClass.TBLCOL;
+    if ("TBLCOLGP".equals(codeString))
+      return V3ActClass.TBLCOLGP;
+    if ("TBLDATA".equals(codeString))
+      return V3ActClass.TBLDATA;
+    if ("TBLHDR".equals(codeString))
+      return V3ActClass.TBLHDR;
+    if ("TBLROW".equals(codeString))
+      return V3ActClass.TBLROW;
+    if ("tbody".equals(codeString))
+      return V3ActClass.TBODY;
+    if ("tfoot".equals(codeString))
+      return V3ActClass.TFOOT;
+    if ("thead".equals(codeString))
+      return V3ActClass.THEAD;
+    if ("unordered".equals(codeString))
+      return V3ActClass.UNORDERED;
+    throw new IllegalArgumentException("Unknown V3ActClass code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActClass code) {
+    if (code == V3ActClass.ACT)
+      return "ACT";
+    if (code == V3ActClass._ACTCLASSRECORDORGANIZER)
+      return "_ActClassRecordOrganizer";
+    if (code == V3ActClass.COMPOSITION)
+      return "COMPOSITION";
+    if (code == V3ActClass.DOC)
+      return "DOC";
+    if (code == V3ActClass.DOCCLIN)
+      return "DOCCLIN";
+    if (code == V3ActClass.CDALVLONE)
+      return "CDALVLONE";
+    if (code == V3ActClass.CONTAINER)
+      return "CONTAINER";
+    if (code == V3ActClass.CATEGORY)
+      return "CATEGORY";
+    if (code == V3ActClass.DOCBODY)
+      return "DOCBODY";
+    if (code == V3ActClass.DOCSECT)
+      return "DOCSECT";
+    if (code == V3ActClass.TOPIC)
+      return "TOPIC";
+    if (code == V3ActClass.EXTRACT)
+      return "EXTRACT";
+    if (code == V3ActClass.EHR)
+      return "EHR";
+    if (code == V3ActClass.FOLDER)
+      return "FOLDER";
+    if (code == V3ActClass.GROUPER)
+      return "GROUPER";
+    if (code == V3ActClass.CLUSTER)
+      return "CLUSTER";
+    if (code == V3ActClass.ACCM)
+      return "ACCM";
+    if (code == V3ActClass.ACCT)
+      return "ACCT";
+    if (code == V3ActClass.ACSN)
+      return "ACSN";
+    if (code == V3ActClass.ADJUD)
+      return "ADJUD";
+    if (code == V3ActClass.CACT)
+      return "CACT";
+    if (code == V3ActClass.ACTN)
+      return "ACTN";
+    if (code == V3ActClass.INFO)
+      return "INFO";
+    if (code == V3ActClass.STC)
+      return "STC";
+    if (code == V3ActClass.CNTRCT)
+      return "CNTRCT";
+    if (code == V3ActClass.FCNTRCT)
+      return "FCNTRCT";
+    if (code == V3ActClass.COV)
+      return "COV";
+    if (code == V3ActClass.CONC)
+      return "CONC";
+    if (code == V3ActClass.HCASE)
+      return "HCASE";
+    if (code == V3ActClass.OUTBR)
+      return "OUTBR";
+    if (code == V3ActClass.CONS)
+      return "CONS";
+    if (code == V3ActClass.CONTREG)
+      return "CONTREG";
+    if (code == V3ActClass.CTTEVENT)
+      return "CTTEVENT";
+    if (code == V3ActClass.DISPACT)
+      return "DISPACT";
+    if (code == V3ActClass.EXPOS)
+      return "EXPOS";
+    if (code == V3ActClass.AEXPOS)
+      return "AEXPOS";
+    if (code == V3ActClass.TEXPOS)
+      return "TEXPOS";
+    if (code == V3ActClass.INC)
+      return "INC";
+    if (code == V3ActClass.INFRM)
+      return "INFRM";
+    if (code == V3ActClass.INVE)
+      return "INVE";
+    if (code == V3ActClass.LIST)
+      return "LIST";
+    if (code == V3ActClass.MPROT)
+      return "MPROT";
+    if (code == V3ActClass.OBS)
+      return "OBS";
+    if (code == V3ActClass._ACTCLASSROI)
+      return "_ActClassROI";
+    if (code == V3ActClass.ROIBND)
+      return "ROIBND";
+    if (code == V3ActClass.ROIOVL)
+      return "ROIOVL";
+    if (code == V3ActClass._SUBJECTPHYSICALPOSITION)
+      return "_SubjectPhysicalPosition";
+    if (code == V3ActClass._SUBJECTBODYPOSITION)
+      return "_SubjectBodyPosition";
+    if (code == V3ActClass.LLD)
+      return "LLD";
+    if (code == V3ActClass.PRN)
+      return "PRN";
+    if (code == V3ActClass.RLD)
+      return "RLD";
+    if (code == V3ActClass.SFWL)
+      return "SFWL";
+    if (code == V3ActClass.SIT)
+      return "SIT";
+    if (code == V3ActClass.STN)
+      return "STN";
+    if (code == V3ActClass.SUP)
+      return "SUP";
+    if (code == V3ActClass.RTRD)
+      return "RTRD";
+    if (code == V3ActClass.TRD)
+      return "TRD";
+    if (code == V3ActClass.ALRT)
+      return "ALRT";
+    if (code == V3ActClass.BATTERY)
+      return "BATTERY";
+    if (code == V3ActClass.CLNTRL)
+      return "CLNTRL";
+    if (code == V3ActClass.CNOD)
+      return "CNOD";
+    if (code == V3ActClass.COND)
+      return "COND";
+    if (code == V3ActClass.CASE)
+      return "CASE";
+    if (code == V3ActClass.OUTB)
+      return "OUTB";
+    if (code == V3ActClass.DGIMG)
+      return "DGIMG";
+    if (code == V3ActClass.GEN)
+      return "GEN";
+    if (code == V3ActClass.DETPOL)
+      return "DETPOL";
+    if (code == V3ActClass.EXP)
+      return "EXP";
+    if (code == V3ActClass.LOC)
+      return "LOC";
+    if (code == V3ActClass.PHN)
+      return "PHN";
+    if (code == V3ActClass.POL)
+      return "POL";
+    if (code == V3ActClass.SEQ)
+      return "SEQ";
+    if (code == V3ActClass.SEQVAR)
+      return "SEQVAR";
+    if (code == V3ActClass.INVSTG)
+      return "INVSTG";
+    if (code == V3ActClass.OBSSER)
+      return "OBSSER";
+    if (code == V3ActClass.OBSCOR)
+      return "OBSCOR";
+    if (code == V3ActClass.POS)
+      return "POS";
+    if (code == V3ActClass.POSACC)
+      return "POSACC";
+    if (code == V3ActClass.POSCOORD)
+      return "POSCOORD";
+    if (code == V3ActClass.SPCOBS)
+      return "SPCOBS";
+    if (code == V3ActClass.VERIF)
+      return "VERIF";
+    if (code == V3ActClass.PCPR)
+      return "PCPR";
+    if (code == V3ActClass.ENC)
+      return "ENC";
+    if (code == V3ActClass.POLICY)
+      return "POLICY";
+    if (code == V3ActClass.JURISPOL)
+      return "JURISPOL";
+    if (code == V3ActClass.ORGPOL)
+      return "ORGPOL";
+    if (code == V3ActClass.SCOPOL)
+      return "SCOPOL";
+    if (code == V3ActClass.STDPOL)
+      return "STDPOL";
+    if (code == V3ActClass.PROC)
+      return "PROC";
+    if (code == V3ActClass.SBADM)
+      return "SBADM";
+    if (code == V3ActClass.SBEXT)
+      return "SBEXT";
+    if (code == V3ActClass.SPECCOLLECT)
+      return "SPECCOLLECT";
+    if (code == V3ActClass.REG)
+      return "REG";
+    if (code == V3ActClass.REV)
+      return "REV";
+    if (code == V3ActClass.SPCTRT)
+      return "SPCTRT";
+    if (code == V3ActClass.SPLY)
+      return "SPLY";
+    if (code == V3ActClass.DIET)
+      return "DIET";
+    if (code == V3ActClass.STORE)
+      return "STORE";
+    if (code == V3ActClass.SUBST)
+      return "SUBST";
+    if (code == V3ActClass.TRFR)
+      return "TRFR";
+    if (code == V3ActClass.TRNS)
+      return "TRNS";
+    if (code == V3ActClass.XACT)
+      return "XACT";
+    if (code == V3ActClass._ACTCLASSCONTAINER)
+      return "_ActClassContainer";
+    if (code == V3ActClass.ENTRY)
+      return "ENTRY";
+    if (code == V3ActClass.ORGANIZER)
+      return "ORGANIZER";
+    if (code == V3ActClass.DOCCNTNT)
+      return "DOCCNTNT";
+    if (code == V3ActClass.DOCLIST)
+      return "DOCLIST";
+    if (code == V3ActClass.DOCLSTITM)
+      return "DOCLSTITM";
+    if (code == V3ActClass.DOCPARA)
+      return "DOCPARA";
+    if (code == V3ActClass.DOCTBL)
+      return "DOCTBL";
+    if (code == V3ActClass.LINKHTML)
+      return "LINKHTML";
+    if (code == V3ActClass.LOCALATTR)
+      return "LOCALATTR";
+    if (code == V3ActClass.LOCALMRKP)
+      return "LOCALMRKP";
+    if (code == V3ActClass.ORDERED)
+      return "ordered";
+    if (code == V3ActClass.REFR)
+      return "REFR";
+    if (code == V3ActClass.TBLCOL)
+      return "TBLCOL";
+    if (code == V3ActClass.TBLCOLGP)
+      return "TBLCOLGP";
+    if (code == V3ActClass.TBLDATA)
+      return "TBLDATA";
+    if (code == V3ActClass.TBLHDR)
+      return "TBLHDR";
+    if (code == V3ActClass.TBLROW)
+      return "TBLROW";
+    if (code == V3ActClass.TBODY)
+      return "tbody";
+    if (code == V3ActClass.TFOOT)
+      return "tfoot";
+    if (code == V3ActClass.THEAD)
+      return "thead";
+    if (code == V3ActClass.UNORDERED)
+      return "unordered";
+    return "?";
+  }
+
+    public String toSystem(V3ActClass code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActCode.java
new file mode 100644
index 00000000000..94613510c8e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActCode.java
@@ -0,0 +1,10682 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActCode {
+
+        /**
+         * An account represents a grouping of financial transactions that are tracked and reported together with a single balance. 	 	Examples of account codes (types) are Patient billing accounts (collection of charges), Cost centers; Cash.
+         */
+        _ACTACCOUNTCODE, 
+        /**
+         * An account for collecting charges, reversals, adjustments and payments, including deductibles, copayments, coinsurance (financial transactions) credited or debited to the account receivable account for a patient's encounter.
+         */
+        ACCTRECEIVABLE, 
+        /**
+         * Cash
+         */
+        CASH, 
+        /**
+         * Description: Types of advance payment to be made on a plastic card usually issued by a financial institution used of purchasing services and/or products.
+         */
+        CC, 
+        /**
+         * American Express
+         */
+        AE, 
+        /**
+         * Diner's Club
+         */
+        DN, 
+        /**
+         * Discover Card
+         */
+        DV, 
+        /**
+         * Master Card
+         */
+        MC, 
+        /**
+         * Visa
+         */
+        V, 
+        /**
+         * An account representing charges and credits (financial transactions) for a patient's encounter.
+         */
+        PBILLACCT, 
+        /**
+         * Includes coded responses that will occur as a result of the adjudication of an electronic invoice at a summary level and provides guidance on interpretation of the referenced adjudication results.
+         */
+        _ACTADJUDICATIONCODE, 
+        /**
+         * Catagorization of grouping criteria for the associated transactions and/or summary (totals, subtotals).
+         */
+        _ACTADJUDICATIONGROUPCODE, 
+        /**
+         * Transaction counts and value totals by Contract Identifier.
+         */
+        CONT, 
+        /**
+         * Transaction counts and value totals for each calendar day within the date range specified.
+         */
+        DAY, 
+        /**
+         * Transaction counts and value totals by service location (e.g clinic).
+         */
+        LOC, 
+        /**
+         * Transaction counts and value totals for each calendar month within the date range specified.
+         */
+        MONTH, 
+        /**
+         * Transaction counts and value totals for the date range specified.
+         */
+        PERIOD, 
+        /**
+         * Transaction counts and value totals by Provider Identifier.
+         */
+        PROV, 
+        /**
+         * Transaction counts and value totals for each calendar week within the date range specified.
+         */
+        WEEK, 
+        /**
+         * Transaction counts and value totals for each calendar year within the date range specified.
+         */
+        YEAR, 
+        /**
+         * The invoice element has been accepted for payment but one or more adjustment(s) have been made to one or more invoice element line items (component charges).  
+
+                        Also includes the concept 'Adjudicate as zero' and items not covered under a particular Policy.  
+
+                        Invoice element can be reversed (nullified).  
+
+                        Recommend that the invoice element is saved for DUR (Drug Utilization Reporting).
+         */
+        AA, 
+        /**
+         * The invoice element has been accepted for payment but one or more adjustment(s) have been made to one or more invoice element line items (component charges) without changing the amount.  
+
+                        Invoice element can be reversed (nullified).  
+
+                        Recommend that the invoice element is saved for DUR (Drug Utilization Reporting).
+         */
+        ANF, 
+        /**
+         * The invoice element has passed through the adjudication process but payment is refused due to one or more reasons.
+
+                        Includes items such as patient not covered, or invoice element is not constructed according to payer rules (e.g. 'invoice submitted too late').
+
+                        If one invoice element line item in the invoice element structure is rejected, the remaining line items may not be adjudicated and the complete group is treated as rejected.
+
+                        A refused invoice element can be forwarded to the next payer (for Coordination of Benefits) or modified and resubmitted to refusing payer.
+
+                        Invoice element cannot be reversed (nullified) as there is nothing to reverse.  
+
+                        Recommend that the invoice element is not saved for DUR (Drug Utilization Reporting).
+         */
+        AR, 
+        /**
+         * The invoice element was/will be paid exactly as submitted, without financial adjustment(s).
+
+                        If the dollar amount stays the same, but the billing codes have been amended or financial adjustments have been applied through the adjudication process, the invoice element is treated as "Adjudicated with Adjustment".
+
+                        If information items are included in the adjudication results that do not affect the monetary amounts paid, then this is still Adjudicated as Submitted (e.g. 'reached Plan Maximum on this Claim').  
+
+                        Invoice element can be reversed (nullified).  
+
+                        Recommend that the invoice element is saved for DUR (Drug Utilization Reporting).
+         */
+        AS, 
+        /**
+         * Actions to be carried out by the recipient of the Adjudication Result information.
+         */
+        _ACTADJUDICATIONRESULTACTIONCODE, 
+        /**
+         * The adjudication result associated is to be displayed to the receiver of the adjudication result.
+         */
+        DISPLAY, 
+        /**
+         * The adjudication result associated is to be printed on the specified form, which is then provided to the covered party.
+         */
+        FORM, 
+        /**
+         * Definition:An identifying modifier code for healthcare interventions or procedures.
+         */
+        _ACTBILLABLEMODIFIERCODE, 
+        /**
+         * Description:CPT modifier codes are found in Appendix A of CPT 2000 Standard Edition.
+         */
+        CPTM, 
+        /**
+         * Description:HCPCS Level II (HCFA-assigned) and Carrier-assigned (Level III) modifiers are reported in Appendix A of CPT 2000 Standard Edition and in the Medicare Bulletin.
+         */
+        HCPCSA, 
+        /**
+         * The type of provision(s)  made for reimbursing for the deliver of healthcare services and/or goods provided by a Provider, over a specified period.
+         */
+        _ACTBILLINGARRANGEMENTCODE, 
+        /**
+         * A billing arrangement where a Provider charges a lump sum to provide a prescribed group (volume) of services to a single patient which occur over a period of time.  Services included in the block may vary.  
+
+                        This billing arrangement is also known as Program of Care for some specific Payors and Program Fees for other Payors.
+         */
+        BLK, 
+        /**
+         * A billing arrangement where the payment made to a Provider is determined by analyzing one or more demographic attributes about the persons/patients who are enrolled with the Provider (in their practice).
+         */
+        CAP, 
+        /**
+         * A billing arrangement where a Provider charges a lump sum to provide a particular volume of one or more interventions/procedures or groups of interventions/procedures.
+         */
+        CONTF, 
+        /**
+         * A billing arrangement where a Provider charges for non-clinical items.  This includes interest in arrears, mileage, etc.  Clinical content is not 	included in Invoices submitted with this type of billing arrangement.
+         */
+        FINBILL, 
+        /**
+         * A billing arrangement where funding is based on a list of individuals registered as patients of the Provider.
+         */
+        ROST, 
+        /**
+         * A billing arrangement where a Provider charges a sum to provide a group (volume) of interventions/procedures to one or more patients within a defined period of time, typically on the same date.  Interventions/procedures included in the session may vary.
+         */
+        SESS, 
+        /**
+         * A billing arrangement where a Provider charges a separate fee for each intervention/procedure/event or product.
+
+                        Fee for Service is used when an individual intervention/procedure/event is used for billing purposes.  In other words, fees are associated with the  intervention/procedure/event.  For example, a specific CCI (Canadian Classification of Interventions) code has an associated fee and is used for billing purposes.
+         */
+        FFS, 
+        /**
+         * A first fill where the quantity supplied is less than one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a partial fill might be for only 30 tablets.) and also where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets)
+         */
+        FFPS, 
+        /**
+         * A first fill where the quantity supplied is equal to one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a complete fill would be for the full 90 tablets) and also where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).
+         */
+        FFCS, 
+        /**
+         * A fill where a small portion is provided to allow for determination of the therapy effectiveness and patient tolerance and also where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).
+         */
+        TFS, 
+        /**
+         * Type of bounded ROI.
+         */
+        _ACTBOUNDEDROICODE, 
+        /**
+         * A fully specified bounded Region of Interest (ROI) delineates a ROI in which only those dimensions participate that are specified by boundary criteria, whereas all other dimensions are excluded.  For example a ROI to mark an episode of "ST elevation" in a subset of the EKG leads V2, V3, and V4 would include 4 boundaries, one each for time, V2, V3, and V4.
+         */
+        ROIFS, 
+        /**
+         * A partially specified bounded Region of Interest (ROI) specifies a ROI in which at least all values in the dimensions specified by the boundary criteria participate. For example, if an episode of ventricular fibrillations (VFib) is observed, it usually doesn't make sense to exclude any EKG leads from the observation and the partially specified ROI would contain only one boundary for time indicating the time interval where VFib was observed.
+         */
+        ROIPS, 
+        /**
+         * Description:The type and scope of responsibility taken-on by the performer of the Act for a specific subject of care.
+         */
+        _ACTCAREPROVISIONCODE, 
+        /**
+         * Description:The type and scope of legal and/or professional responsibility taken-on by the performer of the Act for a specific subject of care as described by a credentialing agency, i.e. government or non-government agency. Failure in executing this Act may result in loss of credential to the person or organization who participates as performer of the Act. Excludes employment agreements.
+
+                        
+                           Example:Hospital license; physician license; clinic accreditation.
+         */
+        _ACTCREDENTIALEDCARECODE, 
+        /**
+         * Description:The type and scope of legal and/or professional responsibility taken-on by the performer of the Act for a specific subject of care as described by an agency for credentialing individuals.
+         */
+        _ACTCREDENTIALEDCAREPROVISIONPERSONCODE, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CACC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CAIC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CAMC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CANC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CAPC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CBGC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CCCC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CCGC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CCPC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CCSC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CDEC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CDRC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CEMC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CFPC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CIMC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CMGC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board
+         */
+        CNEC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CNMC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CNQC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CNSC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        COGC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        COMC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        COPC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        COSC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        COTC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CPEC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CPGC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CPHC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CPRC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CPSC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CPYC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CROC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CRPC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CSUC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CTSC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CURC, 
+        /**
+         * Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.
+         */
+        CVSC, 
+        /**
+         * Description:Scope of responsibility taken-on for physician care of a patient as defined by a governmental licensing agency.
+         */
+        LGPC, 
+        /**
+         * Description:The type and scope of legal and/or professional responsibility taken-on by the performer of the Act for a specific subject of care as described by an agency for credentialing programs within organizations.
+         */
+        _ACTCREDENTIALEDCAREPROVISIONPROGRAMCODE, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.
+         */
+        AALC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.
+         */
+        AAMC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.
+         */
+        ABHC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.
+         */
+        ACAC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.
+         */
+        ACHC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.
+         */
+        AHOC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.
+         */
+        ALTC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.
+         */
+        AOSC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CACS, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CAMI, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CAST, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CBAR, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CCAD, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CCAR, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CDEP, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CDGD, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CDIA, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CEPI, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CFEL, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CHFC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CHRO, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CHYP, 
+        /**
+         * Description:.
+         */
+        CMIH, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CMSC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        COJR, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CONC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        COPD, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CORT, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CPAD, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CPND, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CPST, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CSDM, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CSIC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CSLD, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CSPT, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CTBU, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CVDC, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CWMA, 
+        /**
+         * Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.
+         */
+        CWOH, 
+        /**
+         * Domain provides codes that qualify the ActEncounterClass (ENC)
+         */
+        _ACTENCOUNTERCODE, 
+        /**
+         * A comprehensive term for health care provided in a healthcare facility (e.g. a practitioneraTMs office, clinic setting, or hospital) on a nonresident basis. The term ambulatory usually implies that the patient has come to the location and is not assigned to a bed. Sometimes referred to as an outpatient encounter.
+         */
+        AMB, 
+        /**
+         * A patient encounter that takes place at a dedicated healthcare service delivery location where the patient receives immediate evaluation and treatment, provided until the patient can be discharged or responsibility for the patient's care is transferred elsewhere (for example, the patient could be admitted as an inpatient or transferred to another facility.)
+         */
+        EMER, 
+        /**
+         * A patient encounter that takes place both outside a dedicated service delivery location and outside a patient's residence. Example locations might include an accident site and at a supermarket.
+         */
+        FLD, 
+        /**
+         * Healthcare encounter that takes place in the residence of the patient or a designee
+         */
+        HH, 
+        /**
+         * A patient encounter where a patient is admitted by a hospital or equivalent facility, assigned to a location where patients generally stay at least overnight and provided with room, board, and continuous nursing service.
+         */
+        IMP, 
+        /**
+         * An acute inpatient encounter.
+         */
+        ACUTE, 
+        /**
+         * Any category of inpatient encounter except 'acute'
+         */
+        NONAC, 
+        /**
+         * A patient encounter where patient is scheduled or planned to receive service delivery in the future, and the patient is given a pre-admission account number. When the patient comes back for subsequent service, the pre-admission encounter is selected and is encapsulated into the service registration, and a new account number is generated.
+
+                        
+                           Usage Note: This is intended to be used in advance of encounter types such as ambulatory, inpatient encounter, virtual, etc.
+         */
+        PRENC, 
+        /**
+         * An encounter where the patient is admitted to a health care facility for a predetermined length of time, usually less than 24 hours.
+         */
+        SS, 
+        /**
+         * A patient encounter where the patient and the practitioner(s) are not in the same physical location. Examples include telephone conference, email exchange, robotic surgery, and televideo conference.
+         */
+        VR, 
+        /**
+         * General category of medical service provided to the patient during their encounter.
+         */
+        _ACTMEDICALSERVICECODE, 
+        /**
+         * Provision of Alternate Level of Care to a patient in an acute bed.  Patient is waiting for placement in a long-term care facility and is unable to return home.
+         */
+        ALC, 
+        /**
+         * Provision of diagnosis and treatment of diseases and disorders affecting the heart
+         */
+        CARD, 
+        /**
+         * Provision of recurring care for chronic illness.
+         */
+        CHR, 
+        /**
+         * Provision of treatment for oral health and/or dental surgery.
+         */
+        DNTL, 
+        /**
+         * Provision of treatment for drug abuse.
+         */
+        DRGRHB, 
+        /**
+         * General care performed by a general practitioner or family doctor as a responsible provider for a patient.
+         */
+        GENRL, 
+        /**
+         * Provision of diagnostic and/or therapeutic treatment.
+         */
+        MED, 
+        /**
+         * Provision of care of women during pregnancy, childbirth and immediate postpartum period.  Also known as Maternity.
+         */
+        OBS, 
+        /**
+         * Provision of treatment and/or diagnosis related to tumors and/or cancer.
+         */
+        ONC, 
+        /**
+         * Provision of care for patients who are living or dying from an advanced illness.
+         */
+        PALL, 
+        /**
+         * Provision of diagnosis and treatment of diseases and disorders affecting children.
+         */
+        PED, 
+        /**
+         * Pharmaceutical care performed by a pharmacist.
+         */
+        PHAR, 
+        /**
+         * Provision of treatment for physical injury.
+         */
+        PHYRHB, 
+        /**
+         * Provision of treatment of psychiatric disorder relating to mental illness.
+         */
+        PSYCH, 
+        /**
+         * Provision of surgical treatment.
+         */
+        SURG, 
+        /**
+         * Description: Coded types of attachments included to support a healthcare claim.
+         */
+        _ACTCLAIMATTACHMENTCATEGORYCODE, 
+        /**
+         * Description: Automobile Information Attachment
+         */
+        AUTOATTCH, 
+        /**
+         * Description: Document Attachment
+         */
+        DOCUMENT, 
+        /**
+         * Description: Health Record Attachment
+         */
+        HEALTHREC, 
+        /**
+         * Description: Image Attachment
+         */
+        IMG, 
+        /**
+         * Description: Lab Results Attachment
+         */
+        LABRESULTS, 
+        /**
+         * Description: Digital Model Attachment
+         */
+        MODEL, 
+        /**
+         * Description: Work Injury related additional Information Attachment
+         */
+        WIATTCH, 
+        /**
+         * Description: Digital X-Ray Attachment
+         */
+        XRAY, 
+        /**
+         * Definition: The type of consent directive, e.g., to consent or dissent to collect, access, or use in specific ways within an EHRS or for health information exchange; or to disclose  health information  for purposes such as research.
+         */
+        _ACTCONSENTTYPE, 
+        /**
+         * Definition: Consent to have healthcare information collected in an electronic health record.  This entails that the information may be used in analysis, modified, updated.
+         */
+        ICOL, 
+        /**
+         * Definition: Consent to have collected healthcare information disclosed.
+         */
+        IDSCL, 
+        /**
+         * Definition: Consent to access healthcare information.
+         */
+        INFA, 
+        /**
+         * Definition: Consent to access or "read" only, which entails that the information is not to be copied, screen printed, saved, emailed, stored, re-disclosed or altered in any way.  This level ensures that data which is masked or to which access is restricted will not be.
+
+                        
+                           Example: Opened and then emailed or screen printed for use outside of the consent directive purpose.
+         */
+        INFAO, 
+        /**
+         * Definition: Consent to access and save only, which entails that access to the saved copy will remain locked.
+         */
+        INFASO, 
+        /**
+         * Definition: Information re-disclosed without the patient's consent.
+         */
+        IRDSCL, 
+        /**
+         * Definition: Consent to have healthcare information in an electronic health record accessed for research purposes.
+         */
+        RESEARCH, 
+        /**
+         * Definition: Consent to have de-identified healthcare information in an electronic health record that is accessed for research purposes, but without consent to re-identify the information under any circumstance.
+         */
+        RSDID, 
+        /**
+         * Definition: Consent to have de-identified healthcare information in an electronic health record that is accessed for research purposes re-identified under specific circumstances outlined in the consent.
+
+                        
+                           Example:: Where there is a need to inform the subject of potential health issues.
+         */
+        RSREID, 
+        /**
+         * Constrains the ActCode to the domain of Container Registration
+         */
+        _ACTCONTAINERREGISTRATIONCODE, 
+        /**
+         * Used by one system to inform another that it has received a container.
+         */
+        ID, 
+        /**
+         * Used by one system to inform another that the container is in position for specimen transfer (e.g., container removal from track, pipetting, etc.).
+         */
+        IP, 
+        /**
+         * Used by one system to inform another that the container has been released from that system.
+         */
+        L, 
+        /**
+         * Used by one system to inform another that the container did not arrive at its next expected location.
+         */
+        M, 
+        /**
+         * Used by one system to inform another that the specific container is being processed by the equipment. It is useful as a response to a query about Container Status, when the specific step of the process is not relevant.
+         */
+        O, 
+        /**
+         * Status is used by one system to inform another that the processing has been completed, but the container has not been released from that system.
+         */
+        R, 
+        /**
+         * Used by one system to inform another that the container is no longer available within the scope of the system (e.g., tube broken or discarded).
+         */
+        X, 
+        /**
+         * An observation form that determines parameters or attributes of an Act. Examples are the settings of a ventilator machine as parameters of a ventilator treatment act; the controls on dillution factors of a chemical analyzer as a parameter of a laboratory observation act; the settings of a physiologic measurement assembly (e.g., time skew) or the position of the body while measuring blood pressure.
+
+                        Control variables are forms of observations because just as with clinical observations, the Observation.code determines the parameter and the Observation.value assigns the value. While control variables sometimes can be observed (by noting the control settings or an actually measured feedback loop) they are not primary observations, in the sense that a control variable without a primary act is of no use (e.g., it makes no sense to record a blood pressure position without recording a blood pressure, whereas it does make sense to record a systolic blood pressure without a diastolic blood pressure).
+         */
+        _ACTCONTROLVARIABLE, 
+        /**
+         * Specifies whether or not automatic repeat testing is to be initiated on specimens.
+         */
+        AUTO, 
+        /**
+         * A baseline value for the measured test that is inherently contained in the diluent.  In the calculation of the actual result for the measured test, this baseline value is normally considered.
+         */
+        ENDC, 
+        /**
+         * Specifies whether or not further testing may be automatically or manually initiated on specimens.
+         */
+        REFLEX, 
+        /**
+         * Response to an insurance coverage eligibility query or authorization request.
+         */
+        _ACTCOVERAGECONFIRMATIONCODE, 
+        /**
+         * Indication of authorization for healthcare service(s) and/or product(s).  If authorization is approved, funds are set aside.
+         */
+        _ACTCOVERAGEAUTHORIZATIONCONFIRMATIONCODE, 
+        /**
+         * Authorization approved and funds have been set aside to pay for specified healthcare service(s) and/or product(s) within defined criteria for the authorization.
+         */
+        AUTH, 
+        /**
+         * Authorization for specified healthcare service(s) and/or product(s) denied.
+         */
+        NAUTH, 
+        /**
+         * Indication of eligibility coverage for healthcare service(s) and/or product(s).
+         */
+        _ACTCOVERAGEELIGIBILITYCONFIRMATIONCODE, 
+        /**
+         * Insurance coverage is in effect for healthcare service(s) and/or product(s).
+         */
+        ELG, 
+        /**
+         * Insurance coverage is not in effect for healthcare service(s) and/or product(s). May optionally include reasons for the ineligibility.
+         */
+        NELG, 
+        /**
+         * Criteria that are applicable to the authorized coverage.
+         */
+        _ACTCOVERAGELIMITCODE, 
+        /**
+         * Maximum amount paid or maximum number of services/products covered; or maximum amount or number covered during a specified time period under the policy or program.
+         */
+        _ACTCOVERAGEQUANTITYLIMITCODE, 
+        /**
+         * Codes representing the time period during which coverage is available; or financial participation requirements are in effect.
+         */
+        COVPRD, 
+        /**
+         * Definition: Maximum amount paid by payer or covered party; or maximum number of services or products covered under the policy or program during a covered party's lifetime.
+         */
+        LFEMX, 
+        /**
+         * Maximum net amount that will be covered for the product or service specified.
+         */
+        NETAMT, 
+        /**
+         * Definition: Maximum amount paid by payer or covered party; or maximum number of services/products covered under the policy or program by time period specified by the effective time on the act.
+         */
+        PRDMX, 
+        /**
+         * Maximum unit price that will be covered for the authorized product or service.
+         */
+        UNITPRICE, 
+        /**
+         * Maximum number of items that will be covered of the product or service specified.
+         */
+        UNITQTY, 
+        /**
+         * Definition: Codes representing the maximum coverate or financial participation requirements.
+         */
+        COVMX, 
+        /**
+         * Codes representing the types of covered parties that may receive covered benefits under a policy or program.
+         */
+        _ACTCOVEREDPARTYLIMITCODE, 
+        /**
+         * Definition: Set of codes indicating the type of insurance policy or program that pays for the cost of benefits provided to covered parties.
+         */
+        _ACTCOVERAGETYPECODE, 
+        /**
+         * Set of codes indicating the type of insurance policy or other source of funds to cover healthcare costs.
+         */
+        _ACTINSURANCEPOLICYCODE, 
+        /**
+         * Private insurance policy that provides coverage in addition to other policies (e.g. in addition to a Public Healthcare insurance policy).
+         */
+        EHCPOL, 
+        /**
+         * Insurance policy that provides for an allotment of funds replenished on a periodic (e.g. annual) basis. The use of the funds under this policy is at the 	discretion of the covered party.
+         */
+        HSAPOL, 
+        /**
+         * Insurance policy for injuries sustained in an automobile accident.  Will also typically covered non-named parties to the policy, such as pedestrians 	and passengers.
+         */
+        AUTOPOL, 
+        /**
+         * Definition: An automobile insurance policy under which the insurance company will cover the cost of damages to an automobile owned by the named insured that are caused by accident or intentionally by another party.
+         */
+        COL, 
+        /**
+         * Definition: An automobile insurance policy under which the insurance company will indemnify a loss for which another motorist is liable if that motorist is unable to pay because he or she is uninsured.  Coverage under the policy applies to bodily injury damages only.  Injuries to the covered party caused by a hit-and-run driver are also covered.
+         */
+        UNINSMOT, 
+        /**
+         * Insurance policy funded by a public health system such as a provincial or national health plan.  Examples include BC MSP (British Columbia 	Medical Services Plan) OHIP (Ontario Health Insurance Plan), NHS (National Health Service).
+         */
+        PUBLICPOL, 
+        /**
+         * Definition: A public or government health program that administers and funds coverage for dental care to assist program eligible who meet financial and health status criteria.
+         */
+        DENTPRG, 
+        /**
+         * Definition: A public or government health program that administers and funds coverage for health and social services to assist program eligible who meet financial and health status criteria related to a particular disease.
+
+                        
+                           Example: Reproductive health, sexually transmitted disease, and end renal disease programs.
+         */
+        DISEASEPRG, 
+        /**
+         * Definition: A program that provides low-income, uninsured, and underserved women access to timely, high-quality screening and diagnostic services, to detect breast and cervical cancer at the earliest stages.
+
+                        
+                           Example: To improve women's access to screening for breast and cervical cancers, Congress passed the Breast and Cervical Cancer Mortality Prevention Act of 1990, which guided CDC in creating the National Breast and Cervical Cancer Early Detection Program (NBCCEDP), which  provides access to critical breast and cervical cancer screening services for underserved women in the United States.  An estimated 7 to 10% of U.S. women of screening age are eligible to receive NBCCEDP services. Federal guidelines establish an eligibility baseline to direct services to uninsured and underinsured women at or below 250% of federal poverty level; ages 18 to 64 for cervical screening; ages 40 to 64 for breast screening.
+         */
+        CANPRG, 
+        /**
+         * Definition: A public or government program that administers publicly funded coverage of kidney dialysis and kidney transplant services.
+
+                        Example: In the U.S., the Medicare End-stage Renal Disease program (ESRD), the National Kidney Foundation (NKF) American Kidney Fund (AKF) The Organ Transplant Fund.
+         */
+        ENDRENAL, 
+        /**
+         * Definition: Government administered and funded HIV-AIDS program for beneficiaries meeting financial and health status criteria.  Administration, funding levels, eligibility criteria, covered benefits, provider types, and financial participation are typically set by a regulatory process.  Payer responsibilities for administering the program may be delegated to contractors.
+
+                        
+                           Example: In the U.S., the Ryan White program, which is administered by the Health Resources and Services Administration.
+         */
+        HIVAIDS, 
+        /**
+         * mandatory health program
+         */
+        MANDPOL, 
+        /**
+         * Definition: Government administered and funded mental health program for beneficiaries meeting financial and mental health status criteria.  Administration, funding levels, eligibility criteria, covered benefits, provider types, and financial participation are typically set by a regulatory process.  Payer responsibilities for administering the program may be delegated to contractors.
+
+                        
+                           Example: In the U.S., states receive funding for substance use programs from the Substance Abuse Mental Health Administration (SAMHSA).
+         */
+        MENTPRG, 
+        /**
+         * Definition: Government administered and funded program to support provision of care to underserved populations through safety net clinics.
+
+                        
+                           Example: In the U.S., safety net providers such as federally qualified health centers (FQHC) receive funding under PHSA Section 330 grants administered by the Health Resources and Services Administration.
+         */
+        SAFNET, 
+        /**
+         * Definition: Government administered and funded substance use program for beneficiaries meeting financial, substance use behavior, and health status criteria.  Beneficiaries may be required to enroll as a result of legal proceedings.  Administration, funding levels, eligibility criteria, covered benefits, provider types, and financial participation are typically set by a regulatory process.  Payer responsibilities for administering the program may be delegated to contractors.
+
+                        
+                           Example: In the U.S., states receive funding for substance use programs from the Substance Abuse Mental Health Administration (SAMHSA).
+         */
+        SUBPRG, 
+        /**
+         * Definition: A government health program that provides coverage for health services to persons meeting eligibility criteria such as income, location of residence, access to other coverages, health condition, and age, the cost of which is to some extent subsidized by public funds.
+         */
+        SUBSIDIZ, 
+        /**
+         * Definition: A government health program that provides coverage through managed care contracts for health services to persons meeting eligibility criteria such as income, location of residence, access to other coverages, health condition, and age, the cost of which is to some extent subsidized by public funds. 
+
+                        
+                           Discussion: The structure and business processes for underwriting and administering a subsidized managed care program is further specified by the Underwriter and Payer Role.class and Role.code.
+         */
+        SUBSIDMC, 
+        /**
+         * Definition: A government health program that provides coverage for health services to persons meeting eligibility criteria for a supplemental health policy or program such as income, location of residence, access to other coverages, health condition, and age, the cost of which is to some extent subsidized by public funds.
+
+                        
+                           Example:  Supplemental health coverage program may cover the cost of a health program or policy financial participations, such as the copays and the premiums, and may provide coverage for services in addition to those covered under the supplemented health program or policy.  In the U.S., Medicaid programs may pay the premium for a covered party who is also covered under the  Medicare program or a private health policy.
+
+                        
+                           Discussion: The structure and business processes for underwriting and administering a subsidized supplemental retiree health program is further specified by the Underwriter and Payer Role.class and Role.code.
+         */
+        SUBSUPP, 
+        /**
+         * Insurance policy for injuries sustained in the work place or in the course of employment.
+         */
+        WCBPOL, 
+        /**
+         * Definition: Set of codes indicating the type of insurance policy.  Insurance, in law and economics, is a form of risk management primarily used to hedge against the risk of potential financial loss. Insurance is defined as the equitable transfer of the risk of a potential loss, from one entity to another, in exchange for a premium and duty of care. A policy holder is an individual or an organization enters into a contract with an underwriter which stipulates that, in exchange for payment of a sum of money (a premium), one or more covered parties (insureds) is guaranteed compensation for losses resulting from certain perils under specified conditions.  The underwriter analyzes the risk of loss, makes a decision as to whether the risk is insurable, and prices the premium accordingly.  A policy provides benefits that indemnify or cover the cost of a loss incurred by a covered party, and may include coverage for services required to remediate a loss.  An insurance policy contains pertinent facts about the policy holder, the insurance coverage, the covered parties, and the insurer.  A policy may include exemptions and provisions specifying the extent to which the indemnification clause cannot be enforced for intentional tortious conduct of a covered party, e.g., whether the covered parties are jointly or severably insured.
+
+                        
+                           Discussion: In contrast to programs, an insurance policy has one or more policy holders, who own the policy.  The policy holder may be the covered party, a relative of the covered party, a partnership, or a corporation, e.g., an employer.  A subscriber of a self-insured health insurance policy is a policy holder.  A subscriber of an employer sponsored health insurance policy is holds a certificate of coverage, but is not a policy holder; the policy holder is the employer.  See CoveredRoleType.
+         */
+        _ACTINSURANCETYPECODE, 
+        /**
+         * Definition: Set of codes indicating the type of health insurance policy that covers health services provided to covered parties.  A health insurance policy is a written contract for insurance between the insurance company and the policyholder, and contains pertinent facts about the policy owner (the policy holder), the health insurance coverage, the insured subscribers and dependents, and the insurer.  Health insurance is typically administered in accordance with a plan, which specifies (1) the type of health services and health conditions that will be covered under what circumstances (e.g., exclusion of a pre-existing condition, service must be deemed medically necessary; service must not be experimental; service must provided in accordance with a protocol; drug must be on a formulary; service must be prior authorized; or be a referral from a primary care provider); (2) the type and affiliation of providers (e.g., only allopathic physicians, only in network, only providers employed by an HMO); (3) financial participations required of covered parties (e.g., co-pays, coinsurance, deductibles, out-of-pocket); and (4) the manner in which services will be paid (e.g., under indemnity or fee-for-service health plans, the covered party typically pays out-of-pocket and then file a claim for reimbursement, while health plans that have contractual relationships with providers, i.e., network providers, typically do not allow the providers to bill the covered party for the cost of the service until after filing a claim with the payer and receiving reimbursement).
+         */
+        _ACTHEALTHINSURANCETYPECODE, 
+        /**
+         * Definition: A health insurance policy that that covers benefits for dental services.
+         */
+        DENTAL, 
+        /**
+         * Definition: A health insurance policy that covers benefits for healthcare services provided for named conditions under the policy, e.g., cancer, diabetes, or HIV-AIDS.
+         */
+        DISEASE, 
+        /**
+         * Definition: A health insurance policy that covers benefits for prescription drugs, pharmaceuticals, and supplies.
+         */
+        DRUGPOL, 
+        /**
+         * Definition: A health insurance policy that covers healthcare benefits by protecting covered parties from medical expenses arising from health conditions, sickness, or accidental injury as well as preventive care. Health insurance policies explicitly exclude coverage for losses insured under a disability policy, workers' compensation program, liability insurance (including automobile insurance); or for medical expenses, coverage for on-site medical clinics or for limited dental or vision benefits when these are provided under a separate policy.
+
+                        
+                           Discussion: Health insurance policies are offered by health insurance plans that typically reimburse providers for covered services on a fee-for-service basis, that is, a fee that is the allowable amount that a provider may charge.  This is in contrast to managed care plans, which typically prepay providers a per-member/per-month amount or capitation as reimbursement for all covered services rendered.  Health insurance plans include indemnity and healthcare services plans.
+         */
+        HIP, 
+        /**
+         * Definition: An insurance policy that covers benefits for long-term care services people need when they no longer can care for themselves. This may be due to an accident, disability, prolonged illness or the simple process of aging. Long-term care services assist with activities of daily living including:
+
+                        
+                           
+                              Help at home with day-to-day activities, such as cooking, cleaning, bathing and dressing
+
+                           
+                           
+                              Care in the community, such as in an adult day care facility
+
+                           
+                           
+                              Supervised care provided in an assisted living facility
+
+                           
+                           
+                              Skilled care provided in a nursing home
+         */
+        LTC, 
+        /**
+         * Definition: Government mandated program providing coverage, disability income, and vocational rehabilitation for injuries sustained in the work place or in the course of employment.  Employers may either self-fund the program, purchase commercial coverage, or pay a premium to a government entity that administers the program.  Employees may be required to pay premiums toward the cost of coverage as well.
+
+                        Managed care policies specifically exclude coverage for losses insured under a disability policy, workers' compensation program, liability insurance (including automobile insurance); or for medical expenses, coverage for on-site medical clinics or for limited dental or vision benefits when these are provided under a separate policy.
+
+                        
+                           Discussion: Managed care policies are offered by managed care plans that contract with selected providers or health care organizations to provide comprehensive health care at a discount to covered parties and coordinate the financing and delivery of health care. Managed care uses medical protocols and procedures agreed on by the medical profession to be cost effective, also known as medical practice guidelines. Providers are typically reimbursed for covered services by a capitated amount on a per member per month basis that may reflect difference in the health status and level of services anticipated to be needed by the member.
+         */
+        MCPOL, 
+        /**
+         * Definition: A policy for a health plan that has features of both an HMO and a FFS plan.  Like an HMO, a POS plan encourages the use its HMO network to maintain discounted fees with participating providers, but recognizes that sometimes covered parties want to choose their own provider.  The POS plan allows a covered party to use providers who are not part of the HMO network (non-participating providers).  However, there is a greater cost associated with choosing these non-network providers. A covered party will usually pay deductibles and coinsurances that are substantially higher than the payments when he or she uses a plan provider. Use of non-participating providers often requires the covered party to pay the provider directly and then to file a claim for reimbursement, like in an FFS plan.
+         */
+        POS, 
+        /**
+         * Definition: A policy for a health plan that provides coverage for health care only through contracted or employed physicians and hospitals located in particular geographic or service areas.  HMOs emphasize prevention and early detection of illness. Eligibility to enroll in an HMO is determined by where a covered party lives or works.
+         */
+        HMO, 
+        /**
+         * Definition: A network-based, managed care plan that allows a covered party to choose any health care provider. However, if care is received from a "preferred" (participating in-network) provider, there are generally higher benefit coverage and lower deductibles.
+         */
+        PPO, 
+        /**
+         * Definition: A health insurance policy that covers benefits for mental health services and prescriptions.
+         */
+        MENTPOL, 
+        /**
+         * Definition: A health insurance policy that covers benefits for substance use services.
+         */
+        SUBPOL, 
+        /**
+         * Definition: Set of codes for a policy that provides coverage for health care expenses arising from vision services.
+
+                        A health insurance policy that covers benefits for vision care services, prescriptions, and products.
+         */
+        VISPOL, 
+        /**
+         * Definition: An insurance policy that provides a regular payment to compensate for income lost due to the covered party's inability to work because of illness or injury.
+         */
+        DIS, 
+        /**
+         * Definition: An insurance policy under a benefit plan run by an employer or employee organization for the purpose of providing benefits other than pension-related to employees and their families. Typically provides health-related benefits, benefits for disability, disease or unemployment, or day care and scholarship benefits, among others.  An employer sponsored health policy includes coverage of health care expenses arising from sickness or accidental injury, coverage for on-site medical clinics or for dental or vision benefits, which are typically provided under a separate policy.  Coverage excludes health care expenses covered by accident or disability, workers' compensation, liability or automobile insurance.
+         */
+        EWB, 
+        /**
+         * Definition:  An insurance policy that covers qualified benefits under a Flexible Benefit plan such as group medical insurance, long and short term disability income insurance, group term life insurance for employees only up to $50,000 face amount, specified disease coverage such as a cancer policy, dental and/or vision insurance, hospital indemnity insurance, accidental death and dismemberment insurance, a medical expense reimbursement plan and a dependent care reimbursement plan.
+
+                        
+                            Discussion: See UnderwriterRoleTypeCode flexible benefit plan which is defined as a benefit plan that allows employees to choose from several life, health, disability, dental, and other insurance plans according to their individual needs. Also known as cafeteria plans.  Authorized under Section 125 of the Revenue Act of 1978.
+         */
+        FLEXP, 
+        /**
+         * Definition: A policy under which the insurer agrees to pay a sum of money upon the occurrence of the covered partys death. In return, the policyholder agrees to pay a stipulated amount called a premium at regular intervals.  Life insurance indemnifies the beneficiary for the loss of the insurable interest that a beneficiary has in the life of a covered party.  For persons related by blood, a substantial interest established through love and affection, and for all other persons, a lawful and substantial economic interest in having the life of the insured continue. An insurable interest is required when purchasing life insurance on another person. Specific exclusions are often written into the contract to limit the liability of the insurer; for example claims resulting from suicide or relating to war, riot and civil commotion.
+
+                        
+                           Discussion:A life insurance policy may be used by the covered party as a source of health care coverage in the case of  a viatical settlement, which is the sale of a life insurance policy by the policy owner, before the policy matures. Such a sale, at a price discounted from the face amount of the policy but usually in excess of the premiums paid or current cash surrender value, provides the seller an immediate cash settlement. Generally, viatical settlements involve insured individuals with a life expectancy of less than two years. In countries without state-subsidized healthcare and high healthcare costs (e.g. United States), this is a practical way to pay extremely high health insurance premiums that severely ill people face. Some people are also familiar with life settlements, which are similar transactions but involve insureds with longer life expectancies (two to fifteen years).
+         */
+        LIFE, 
+        /**
+         * Definition: A policy that, after an initial premium or premiums, pays out a sum at pre-determined intervals.
+
+                        For example, a policy holder may pay $10,000, and in return receive $150 each month until he dies; or $1,000 for each of 14 years or death benefits if he dies before the full term of the annuity has elapsed.
+         */
+        ANNU, 
+        /**
+         * Definition: Life insurance under which the benefit is payable only if the insured dies during a specified period. If an insured dies during that period, the beneficiary receives the death payments. If the insured survives, the policy ends and the beneficiary receives nothing.
+         */
+        TLIFE, 
+        /**
+         * Definition: Life insurance under which the benefit is payable upon the insuredaTMs death or diagnosis of a terminal illness.  If an insured dies during that period, the beneficiary receives the death payments. If the insured survives, the policy ends and the beneficiary receives nothing
+         */
+        ULIFE, 
+        /**
+         * Definition: A type of insurance that covers damage to or loss of the policyholderaTMs property by providing payments for damages to property damage or the injury or death of living subjects.  The terms "casualty" and "liability" insurance are often used interchangeably. Both cover the policyholder's legal liability for damages caused to other persons and/or their property.
+         */
+        PNC, 
+        /**
+         * Definition: An agreement between two or more insurance companies by which the risk of loss is proportioned. Thus the risk of loss is spread and a disproportionately large loss under a single policy does not fall on one insurance company. Acceptance by an insurer, called a reinsurer, of all or part of the risk of loss of another insurance company.
+
+                        
+                           Discussion: Reinsurance is a means by which an insurance company can protect itself against the risk of losses with other insurance companies. Individuals and corporations obtain insurance policies to provide protection for various risks (hurricanes, earthquakes, lawsuits, collisions, sickness and death, etc.). Reinsurers, in turn, provide insurance to insurance companies.
+
+                        For example, an HMO may purchase a reinsurance policy to protect itself from losing too much money from one insured's particularly expensive health care costs. An insurance company issuing an automobile liability policy, with a limit of $100,000 per accident may reinsure its liability in excess of $10,000. A fire insurance company which issues a large policy generally reinsures a portion of the risk with one or several other companies. Also called risk control insurance or stop-loss insurance.
+         */
+        REI, 
+        /**
+         * Definition: 
+                        
+
+                        
+                           
+                              A risk or part of a risk for which there is no normal insurance market available.
+
+                           
+                           
+                              Insurance written by unauthorized insurance companies. Surplus lines insurance is insurance placed with unauthorized insurance companies through licensed surplus lines agents or brokers.
+         */
+        SURPL, 
+        /**
+         * Definition: A form of insurance protection that provides additional liability coverage after the limits of your underlying policy are reached. An umbrella liability policy also protects you (the insured) in many situations not covered by the usual liability policies.
+         */
+        UMBRL, 
+        /**
+         * Definition: A set of codes used to indicate coverage under a program.  A program is an organized structure for administering and funding coverage of a benefit package for covered parties meeting eligibility criteria, typically related to employment, health, financial, and demographic status. Programs are typically established or permitted by legislation with provisions for ongoing government oversight.  Regulations may mandate the structure of the program, the manner in which it is funded and administered, covered benefits, provider types, eligibility criteria and financial participation. A government agency may be charged with implementing the program in accordance to the regulation.  Risk of loss under a program in most cases would not meet what an underwriter would consider an insurable risk, i.e., the risk is not random in nature, not financially measurable, and likely requires subsidization with government funds.
+
+                        
+                           Discussion: Programs do not have policy holders or subscribers.  Program eligibles are enrolled based on health status, statutory eligibility, financial status, or age.  Program eligibles who are covered parties under the program may be referred to as members, beneficiaries, eligibles, or recipients.  Programs risk are underwritten by not for profit organizations such as governmental entities, and the beneficiaries typically do not pay for any or some portion of the cost of coverage.  See CoveredPartyRoleType.
+         */
+        _ACTPROGRAMTYPECODE, 
+        /**
+         * Definition: A program that covers the cost of services provided directly to a beneficiary who typically has no other source of coverage without charge.
+         */
+        CHAR, 
+        /**
+         * Definition: A program that covers the cost of services provided to crime victims for injuries or losses related to the occurrence of a crime.
+         */
+        CRIME, 
+        /**
+         * Definition: An employee assistance program is run by an employer or employee organization for the purpose of providing benefits and covering all or part of the cost for employees to receive counseling, referrals, and advice in dealing with stressful issues in their lives. These may include substance abuse, bereavement, marital problems, weight issues, or general wellness issues.  The services are usually provided by a third-party, rather than the company itself, and the company receives only summary statistical data from the service provider. Employee's names and services received are kept confidential.
+         */
+        EAP, 
+        /**
+         * Definition: A set of codes used to indicate a government program that is an organized structure for administering and funding coverage of a benefit package for covered parties meeting eligibility criteria, typically related to employment, health and financial status. Government programs are established or permitted by legislation with provisions for ongoing government oversight.  Regulation mandates the structure of the program, the manner in which it is funded and administered, covered benefits, provider types, eligibility criteria and financial participation. A government agency is charged with implementing the program in accordance to the regulation
+
+                        
+                           Example: Federal employee health benefit program in the U.S.
+         */
+        GOVEMP, 
+        /**
+         * Definition: A government program that provides health coverage to individuals who are considered medically uninsurable or high risk, and who have been denied health insurance due to a serious health condition. In certain cases, it also applies to those who have been quoted very high premiums a" again, due to a serious health condition.  The pool charges premiums for coverage.  Because the pool covers high-risk people, it incurs a higher level of claims than premiums can cover. The insurance industry pays into the pool to make up the difference and help it remain viable.
+         */
+        HIRISK, 
+        /**
+         * Definition: Services provided directly and through contracted and operated indigenous peoples health programs.
+
+                        
+                           Example: Indian Health Service in the U.S.
+         */
+        IND, 
+        /**
+         * Definition: A government program that provides coverage for health services to military personnel, retirees, and dependents.  A covered party who is a subscriber can choose from among Fee-for-Service (FFS) plans, and their Preferred Provider Organizations (PPO), or Plans offering a Point of Service (POS) Product, or Health Maintenance Organizations.
+
+                        
+                           Example: In the U.S., TRICARE, CHAMPUS.
+         */
+        MILITARY, 
+        /**
+         * Definition: A government mandated program with specific eligibility requirements based on premium contributions made during employment, length of employment, age, and employment status, e.g., being retired, disabled, or a dependent of a covered party under this program.   Benefits typically include ambulatory, inpatient, and long-term care, such as hospice care, home health care and respite care.
+         */
+        RETIRE, 
+        /**
+         * Definition: A social service program funded by a public or governmental entity.
+
+                        
+                           Example: Programs providing habilitation, food, lodging, medicine, transportation, equipment, devices, products, education, training, counseling, alteration of living or work space, and other resources to persons meeting eligibility criteria.
+         */
+        SOCIAL, 
+        /**
+         * Definition: Services provided directly and through contracted and operated veteran health programs.
+         */
+        VET, 
+        /**
+         * Codes dealing with the management of Detected Issue observations
+         */
+        _ACTDETECTEDISSUEMANAGEMENTCODE, 
+        /**
+         * Codes dealing with the management of Detected Issue observations for the administrative and patient administrative acts domains.
+         */
+        _ACTADMINISTRATIVEDETECTEDISSUEMANAGEMENTCODE, 
+        /**
+         * Authorization Issue Management Code
+         */
+        _AUTHORIZATIONISSUEMANAGEMENTCODE, 
+        /**
+         * Used to temporarily override normal authorization rules to gain access to data in a case of emergency. Use of this override code will typically be monitored, and a procedure to verify its proper use may be triggered when used.
+         */
+        EMAUTH, 
+        /**
+         * Description: Indicates that the permissions have been externally verified and the request should be processed.
+         */
+        _21, 
+        /**
+         * Confirmed drug therapy appropriate
+         */
+        _1, 
+        /**
+         * Consulted other supplier/pharmacy, therapy confirmed
+         */
+        _19, 
+        /**
+         * Assessed patient, therapy is appropriate
+         */
+        _2, 
+        /**
+         * Description: The patient has the appropriate indication or diagnosis for the action to be taken.
+         */
+        _22, 
+        /**
+         * Description: It has been confirmed that the appropriate pre-requisite therapy has been tried.
+         */
+        _23, 
+        /**
+         * Patient gave adequate explanation
+         */
+        _3, 
+        /**
+         * Consulted other supply source, therapy still appropriate
+         */
+        _4, 
+        /**
+         * Consulted prescriber, therapy confirmed
+         */
+        _5, 
+        /**
+         * Consulted prescriber and recommended change, prescriber declined
+         */
+        _6, 
+        /**
+         * Concurrent therapy triggering alert is no longer on-going or planned
+         */
+        _7, 
+        /**
+         * Confirmed supply action appropriate
+         */
+        _14, 
+        /**
+         * Patient's existing supply was lost/wasted
+         */
+        _15, 
+        /**
+         * Supply date is due to patient vacation
+         */
+        _16, 
+        /**
+         * Supply date is intended to carry patient over weekend
+         */
+        _17, 
+        /**
+         * Supply is intended for use during a leave of absence from an institution.
+         */
+        _18, 
+        /**
+         * Description: Supply is different than expected as an additional quantity has been supplied in a separate dispense.
+         */
+        _20, 
+        /**
+         * Order is performed as issued, but other action taken to mitigate potential adverse effects
+         */
+        _8, 
+        /**
+         * Provided education or training to the patient on appropriate therapy use
+         */
+        _10, 
+        /**
+         * Instituted an additional therapy to mitigate potential negative effects
+         */
+        _11, 
+        /**
+         * Suspended existing therapy that triggered interaction for the duration of this therapy
+         */
+        _12, 
+        /**
+         * Aborted existing therapy that triggered interaction.
+         */
+        _13, 
+        /**
+         * Arranged to monitor patient for adverse effects
+         */
+        _9, 
+        /**
+         * Concepts that identify the type or nature of exposure interaction.  Examples include "household", "care giver", "intimate partner", "common space", "common substance", etc. to further describe the nature of interaction.
+         */
+        _ACTEXPOSURECODE, 
+        /**
+         * Description: Exposure participants' interaction occurred in a child care setting
+         */
+        CHLDCARE, 
+        /**
+         * Description: An interaction where the exposure participants traveled in/on the same vehicle (not necessarily concurrently, e.g. both are passengers of the same plane, but on different flights of that plane).
+         */
+        CONVEYNC, 
+        /**
+         * Description: Exposure participants' interaction occurred during the course of health care delivery or in a health care delivery setting, but did not involve the direct provision of care (e.g. a janitor cleaning a patient's hospital room).
+         */
+        HLTHCARE, 
+        /**
+         * Description: Exposure interaction occurred in context of one providing care for the other, i.e. a babysitter providing care for a child, a home-care aide providing assistance to a paraplegic.
+         */
+        HOMECARE, 
+        /**
+         * Description: Exposure participants' interaction occurred when both were patients being treated in the same (acute) health care delivery facility.
+         */
+        HOSPPTNT, 
+        /**
+         * Description: Exposure participants' interaction occurred when one visited the other who was a patient being treated in a health care delivery facility.
+         */
+        HOSPVSTR, 
+        /**
+         * Description: Exposure interaction occurred in context of domestic interaction, i.e. both participants reside in the same household.
+         */
+        HOUSEHLD, 
+        /**
+         * Description: Exposure participants' interaction occurred in the course of one or both participants being incarcerated at a correctional facility
+         */
+        INMATE, 
+        /**
+         * Description: Exposure interaction was intimate, i.e. participants are intimate companions (e.g. spouses, domestic partners).
+         */
+        INTIMATE, 
+        /**
+         * Description: Exposure participants' interaction occurred in the course of one or both participants being resident at a long term care facility (second participant may be a visitor, worker, resident or a physical place or object within the facility).
+         */
+        LTRMCARE, 
+        /**
+         * Description: An interaction where the exposure participants were both present in the same location/place/space.
+         */
+        PLACE, 
+        /**
+         * Description: Exposure participants' interaction occurred during the course of  health care delivery by a provider (e.g. a physician treating a patient in her office).
+         */
+        PTNTCARE, 
+        /**
+         * Description: Exposure participants' interaction occurred in an academic setting (e.g., participants are fellow students, or student and teacher).
+         */
+        SCHOOL2, 
+        /**
+         * Description: An interaction where the exposure participants are social associates or members of the same extended family
+         */
+        SOCIAL2, 
+        /**
+         * Description: An interaction where the exposure participants shared or co-used a common substance (e.g. drugs, needles, or common food item).
+         */
+        SUBSTNCE, 
+        /**
+         * Description: An interaction where the exposure participants traveled together in/on the same vehicle/trip (e.g. concurrent co-passengers).
+         */
+        TRAVINT, 
+        /**
+         * Description: Exposure interaction occurred in a work setting, i.e. participants are co-workers.
+         */
+        WORK2, 
+        /**
+         * ActFinancialTransactionCode
+         */
+        _ACTFINANCIALTRANSACTIONCODE, 
+        /**
+         * A type of transaction that represents a charge for a service or product.  Expressed in monetary terms.
+         */
+        CHRG, 
+        /**
+         * A type of transaction that represents a reversal of a previous charge for a service or product. Expressed in monetary terms.  It has the opposite effect of a standard charge.
+         */
+        REV, 
+        /**
+         * Set of codes indicating the type of incident or accident.
+         */
+        _ACTINCIDENTCODE, 
+        /**
+         * Incident or accident as the result of a motor vehicle accident
+         */
+        MVA, 
+        /**
+         * Incident or accident is the result of a school place accident.
+         */
+        SCHOOL, 
+        /**
+         * Incident or accident is the result of a sporting accident.
+         */
+        SPT, 
+        /**
+         * Incident or accident is the result of a work place accident
+         */
+        WPA, 
+        /**
+         * Description: The type of health information to which the subject of the information or the subject's delegate consents or dissents.
+         */
+        _ACTINFORMATIONACCESSCODE, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access adverse drug reaction information for a patient.
+         */
+        ACADR, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access all information for a patient.
+         */
+        ACALL, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access allergy information for a patient.
+         */
+        ACALLG, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access informational consent information for a patient.
+         */
+        ACCONS, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access demographics information for a patient.
+         */
+        ACDEMO, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access diagnostic imaging information for a patient.
+         */
+        ACDI, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access immunization information for a patient.
+         */
+        ACIMMUN, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access lab test result information for a patient.
+         */
+        ACLAB, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access medical condition information for a patient.
+         */
+        ACMED, 
+        /**
+         * Definition: Provide consent to view or access medical condition information for a patient.
+         */
+        ACMEDC, 
+        /**
+         * Description:Provide consent to collect, use, disclose, or access mental health information for a patient.
+         */
+        ACMEN, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access common observation information for a patient.
+         */
+        ACOBS, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access coverage policy or program for a patient.
+         */
+        ACPOLPRG, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access provider information for a patient.
+         */
+        ACPROV, 
+        /**
+         * Description: Provide consent to collect, use, disclose, or access professional service information for a patient.
+         */
+        ACPSERV, 
+        /**
+         * Description:Provide consent to collect, use, disclose, or access substance abuse information for a patient.
+         */
+        ACSUBSTAB, 
+        /**
+         * Concepts conveying the context in which authorization given under jurisdictional law, by organizational policy, or by a patient consent directive permits the collection, access, use or disclosure of specified patient health information.
+         */
+        _ACTINFORMATIONACCESSCONTEXTCODE, 
+        /**
+         * Authorization to collect, access, use, or disclose specified patient health information in accordance with jurisdictional law, organizational policy, or a patient's consent directive, which may be implied, deemed, opt-in, opt-out, or explicit.
+         */
+        INFAUT, 
+        /**
+         * Authorization to collect, access, use, or disclose specified patient health information as explicitly consented to by the subject of the information or the subject's representative.
+         */
+        INFCON, 
+        /**
+         * Authorization to collect, access, use, or disclose specified patient health information in accordance with judicial system protocol, such as in the case of a subpoena or court order.
+         */
+        INFCRT, 
+        /**
+         * Authorization to collect, access, use, or disclose specified patient health information where deemed necessary to avert potential danger to other persons in accordance with jurisdictional law, organizational policy, or standards of practice.  For example, disclosure about a person threatening violence.
+         */
+        INFDNG, 
+        /**
+         * Authorization to collect, access, use, or disclose specified patient health information in accordance with emergency information transfer protocol dictated by jurisdictional law, organization policy, or standards of practice. For example, sharing of health information during disaster response.
+         */
+        INFEMER, 
+        /**
+         * Authorization to collect, access, use, or disclose specified patient health information necessary to avert potential public welfare risk in accordance with jurisdictional law, organizational policy, or standards of practice.  For example, reporting that a person is a victim of abuse or demonstrating suicidal tendencies.
+         */
+        INFPWR, 
+        /**
+         * Authorization to collect, access, use, or disclose specified patient health information for public health, welfare, and safety purposes in accordance with jurisdictional law, organizational policy, or standards of practice.  For example, public health reporting of notifiable conditions.
+         */
+        INFREG, 
+        /**
+         * Definition:Indicates the set of information types which may be manipulated or referenced, such as for recommending access restrictions.
+         */
+        _ACTINFORMATIONCATEGORYCODE, 
+        /**
+         * Description: All patient information.
+         */
+        ALLCAT, 
+        /**
+         * Definition:All information pertaining to a patient's allergy and intolerance records.
+         */
+        ALLGCAT, 
+        /**
+         * Description: All information pertaining to a patient's adverse drug reactions.
+         */
+        ARCAT, 
+        /**
+         * Definition:All information pertaining to a patient's common observation records (height, weight, blood pressure, temperature, etc.).
+         */
+        COBSCAT, 
+        /**
+         * Definition:All information pertaining to a patient's demographics (such as name, date of birth, gender, address, etc).
+         */
+        DEMOCAT, 
+        /**
+         * Definition:All information pertaining to a patient's diagnostic image records (orders & results).
+         */
+        DICAT, 
+        /**
+         * Definition:All information pertaining to a patient's vaccination records.
+         */
+        IMMUCAT, 
+        /**
+         * Description: All information pertaining to a patient's lab test records (orders & results)
+         */
+        LABCAT, 
+        /**
+         * Definition:All information pertaining to a patient's medical condition records.
+         */
+        MEDCCAT, 
+        /**
+         * Description: All information pertaining to a patient's mental health records.
+         */
+        MENCAT, 
+        /**
+         * Definition:All information pertaining to a patient's professional service records (such as smoking cessation, counseling, medication review, mental health).
+         */
+        PSVCCAT, 
+        /**
+         * Definition:All information pertaining to a patient's medication records (orders, dispenses and other active medications).
+         */
+        RXCAT, 
+        /**
+         * Type of invoice element that is used to assist in describing an Invoice that is either submitted for adjudication or for which is returned on adjudication results.
+         */
+        _ACTINVOICEELEMENTCODE, 
+        /**
+         * Codes representing a grouping of invoice elements (totals, sub-totals), reported through a Payment Advice or a Statement of Financial Activity (SOFA).  The code can represent summaries by day, location, payee and other cost elements such as bonus, retroactive adjustment and transaction fees.
+         */
+        _ACTINVOICEADJUDICATIONPAYMENTCODE, 
+        /**
+         * Codes representing adjustments to a Payment Advice such as retroactive, clawback, garnishee, etc.
+         */
+        _ACTINVOICEADJUDICATIONPAYMENTGROUPCODE, 
+        /**
+         * Payment initiated by the payor as the result of adjudicating a submitted invoice that arrived to the payor from an electronic source that did not provide a conformant set of HL7 messages (e.g. web claim submission).
+         */
+        ALEC, 
+        /**
+         * Bonus payments based on performance, volume, etc. as agreed to by the payor.
+         */
+        BONUS, 
+        /**
+         * An amount still owing to the payor but the payment is 0$ and this cannot be settled until a future payment is made.
+         */
+        CFWD, 
+        /**
+         * Fees deducted on behalf of a payee for tuition and continuing education.
+         */
+        EDU, 
+        /**
+         * Fees deducted on behalf of a payee for charges based on a shorter payment frequency (i.e. next day versus biweekly payments.
+         */
+        EPYMT, 
+        /**
+         * Fees deducted on behalf of a payee for charges based on a per-transaction or time-period (e.g. monthly) fee.
+         */
+        GARN, 
+        /**
+         * Payment is based on a payment intent for a previously submitted Invoice, based on formal adjudication results..
+         */
+        INVOICE, 
+        /**
+         * Payment initiated by the payor as the result of adjudicating a paper (original, may have been faxed) invoice.
+         */
+        PINV, 
+        /**
+         * An amount that was owed to the payor as indicated, by a carry forward adjusment, in a previous payment advice
+         */
+        PPRD, 
+        /**
+         * Professional association fee that is collected by the payor from the practitioner/provider on behalf of the association
+         */
+        PROA, 
+        /**
+         * Retroactive adjustment such as fee rate adjustment due to contract negotiations.
+         */
+        RECOV, 
+        /**
+         * Bonus payments based on performance, volume, etc. as agreed to by the payor.
+         */
+        RETRO, 
+        /**
+         * Fees deducted on behalf of a payee for charges based on a per-transaction or time-period (e.g. monthly) fee.
+         */
+        TRAN, 
+        /**
+         * Codes representing a grouping of invoice elements (totals, sub-totals), reported through a Payment Advice or a Statement of Financial Activity (SOFA).  The code can represent summaries by day, location, payee, etc.
+         */
+        _ACTINVOICEADJUDICATIONPAYMENTSUMMARYCODE, 
+        /**
+         * Transaction counts and value totals by invoice type (e.g. RXDINV - Pharmacy Dispense)
+         */
+        INVTYPE, 
+        /**
+         * Transaction counts and value totals by each instance of an invoice payee.
+         */
+        PAYEE, 
+        /**
+         * Transaction counts and value totals by each instance of an invoice payor.
+         */
+        PAYOR, 
+        /**
+         * Transaction counts and value totals by each instance of a messaging application on a single processor. It is a registered identifier known to the receivers.
+         */
+        SENDAPP, 
+        /**
+         * Codes representing a service or product that is being invoiced (billed).  The code can represent such concepts as "office visit", "drug X", "wheelchair" and other billable items such as taxes, service charges and discounts.
+         */
+        _ACTINVOICEDETAILCODE, 
+        /**
+         * An identifying data string for healthcare products.
+         */
+        _ACTINVOICEDETAILCLINICALPRODUCTCODE, 
+        /**
+         * Description:United Nations Standard Products and Services Classification, managed by Uniform Code Council (UCC): www.unspsc.org
+         */
+        UNSPSC, 
+        /**
+         * An identifying data string for A substance used as a medication or in the preparation of medication.
+         */
+        _ACTINVOICEDETAILDRUGPRODUCTCODE, 
+        /**
+         * Description:Global Trade Item Number is an identifier for trade items developed by GS1 (comprising the former EAN International and Uniform Code Council).
+         */
+        GTIN, 
+        /**
+         * Description:Universal Product Code is one of a wide variety of bar code languages widely used in the United States and Canada for items in stores.
+         */
+        UPC, 
+        /**
+         * The detail item codes to identify charges or changes to the total billing of a claim due to insurance rules and payments.
+         */
+        _ACTINVOICEDETAILGENERICCODE, 
+        /**
+         * The billable item codes to identify adjudicator specified components to the total billing of a claim.
+         */
+        _ACTINVOICEDETAILGENERICADJUDICATORCODE, 
+        /**
+         * That portion of the eligible charges which a covered party must pay for each service and/or product. It is a percentage of the eligible amount for the service/product that is typically charged after the covered party has met the policy deductible.  This amount represents the covered party's coinsurance that is applied to a particular adjudication result. It is expressed as a negative dollar amount in adjudication results.
+         */
+        COIN, 
+        /**
+         * That portion of the eligible charges which a covered party must pay for each service and/or product. It is a defined amount per service/product of the eligible amount for the service/product. This amount represents the covered party's copayment that is applied to a particular adjudication result. It is expressed as a negative dollar amount in adjudication results.
+         */
+        COPAYMENT, 
+        /**
+         * That portion of the eligible charges which a covered party must pay in a particular period (e.g. annual) before the benefits are payable by the adjudicator. This amount represents the covered party's deductible that is applied to a particular adjudication result. It is expressed as a negative dollar amount in adjudication results.
+         */
+        DEDUCTIBLE, 
+        /**
+         * The guarantor, who may be the patient, pays the entire charge for a service. Reasons for such action may include: there is no insurance coverage for the service (e.g. cosmetic surgery); the patient wishes to self-pay for the service; or the insurer denies payment for the service due to contractual provisions such as the need for prior authorization.
+         */
+        PAY, 
+        /**
+         * That total amount of the eligible charges which a covered party must periodically pay for services and/or products prior to the Medicaid program providing any coverage. This amount represents the covered party's spend down that is applied to a particular adjudication result. It is expressed as a negative dollar amount in adjudication results
+         */
+        SPEND, 
+        /**
+         * The covered party pays a percentage of the cost of covered services.
+         */
+        COINS, 
+        /**
+         * The billable item codes to identify modifications to a billable item charge. As for example after hours increase in the office visit fee.
+         */
+        _ACTINVOICEDETAILGENERICMODIFIERCODE, 
+        /**
+         * Premium paid on service fees in compensation for practicing outside of normal working hours.
+         */
+        AFTHRS, 
+        /**
+         * Premium paid on service fees in compensation for practicing in a remote location.
+         */
+        ISOL, 
+        /**
+         * Premium paid on service fees in compensation for practicing at a location other than normal working location.
+         */
+        OOO, 
+        /**
+         * The billable item codes to identify provider supplied charges or changes to the total billing of a claim.
+         */
+        _ACTINVOICEDETAILGENERICPROVIDERCODE, 
+        /**
+         * A charge to compensate the provider when a patient cancels an appointment with insufficient time for the provider to make another appointment with another patient.
+         */
+        CANCAPT, 
+        /**
+         * A reduction in the amount charged as a percentage of the amount. For example a 5% discount for volume purchase.
+         */
+        DSC, 
+        /**
+         * A premium on a service fee is requested because, due to extenuating circumstances, the service took an extraordinary amount of time or supplies.
+         */
+        ESA, 
+        /**
+         * Under agreement between the parties (payor and provider), a guaranteed level of income is established for the provider over a specific, pre-determined period of time. The normal course of business for the provider is submission of fee-for-service claims. Should the fee-for-service income during the specified period of time be less than the agreed to amount, a top-up amount is paid to the provider equal to the difference between the fee-for-service total and the guaranteed income amount for that period of time. The details of the agreement may specify (or not) a requirement for repayment to the payor in the event that the fee-for-service income exceeds the guaranteed amount.
+         */
+        FFSTOP, 
+        /**
+         * Anticipated or actual final fee associated with treating a patient.
+         */
+        FNLFEE, 
+        /**
+         * Anticipated or actual initial fee associated with treating a patient.
+         */
+        FRSTFEE, 
+        /**
+         * An increase in the amount charged as a percentage of the amount. For example, 12% markup on product cost.
+         */
+        MARKUP, 
+        /**
+         * A charge to compensate the provider when a patient does not show for an appointment.
+         */
+        MISSAPT, 
+        /**
+         * Anticipated or actual periodic fee associated with treating a patient. For example, expected billing cycle such as monthly, quarterly. The actual period (e.g. monthly, quarterly) is specified in the unit quantity of the Invoice Element.
+         */
+        PERFEE, 
+        /**
+         * The amount for a performance bonus that is being requested from a payor for the performance of certain services (childhood immunizations, influenza immunizations, mammograms, pap smears) on a sliding scale. That is, for 90% of childhood immunizations to a maximum of $2200/yr. An invoice is created at the end of the service period (one year) and a code is submitted indicating the percentage achieved and the dollar amount claimed.
+         */
+        PERMBNS, 
+        /**
+         * A charge is requested because the patient failed to pick up the item and it took an amount of time to return it to stock for future use.
+         */
+        RESTOCK, 
+        /**
+         * A charge to cover the cost of travel time and/or cost in conjuction with providing a service or product. It may be charged per kilometer or per hour based on the effective agreement.
+         */
+        TRAVEL, 
+        /**
+         * Premium paid on service fees in compensation for providing an expedited response to an urgent situation.
+         */
+        URGENT, 
+        /**
+         * The billable item codes to identify modifications to a billable item charge by a tax factor applied to the amount. As for example 7% provincial sales tax.
+         */
+        _ACTINVOICEDETAILTAXCODE, 
+        /**
+         * Federal tax on transactions such as the Goods and Services Tax (GST)
+         */
+        FST, 
+        /**
+         * Joint Federal/Provincial Sales Tax
+         */
+        HST, 
+        /**
+         * Tax levied by the provincial or state jurisdiction such as Provincial Sales Tax
+         */
+        PST, 
+        /**
+         * An identifying data string for medical facility accommodations.
+         */
+        _ACTINVOICEDETAILPREFERREDACCOMMODATIONCODE, 
+        /**
+         * Accommodation type.  In Intent mood, represents the accommodation type requested.  In Event mood, represents accommodation assigned/used.  In Definition mood, represents the available accommodation type.
+         */
+        _ACTENCOUNTERACCOMMODATIONCODE, 
+        /**
+         * Description:Accommodation type. In Intent mood, represents the accommodation type requested. In Event mood, represents accommodation assigned/used. In Definition mood, represents the available accommodation type.
+         */
+        _HL7ACCOMMODATIONCODE, 
+        /**
+         * Accommodations used in the care of diseases that are transmitted through casual contact or respiratory transmission.
+         */
+        I, 
+        /**
+         * Accommodations in which there is only 1 bed.
+         */
+        P, 
+        /**
+         * Uniquely designed and elegantly decorated accommodations with many amenities available for an additional charge.
+         */
+        S, 
+        /**
+         * Accommodations in which there are 2 beds.
+         */
+        SP, 
+        /**
+         * Accommodations in which there are 3 or more beds.
+         */
+        W, 
+        /**
+         * An identifying data string for healthcare procedures.
+         */
+        _ACTINVOICEDETAILCLINICALSERVICECODE, 
+        /**
+         * Type of invoice element that is used to assist in describing an Invoice that is either submitted for adjudication or for which is returned on adjudication results.
+
+                        Invoice elements of this type signify a grouping of one or more children (detail) invoice elements.  They do not have intrinsic costing associated with them, but merely reflect the sum of all costing for it's immediate children invoice elements.
+         */
+        _ACTINVOICEGROUPCODE, 
+        /**
+         * Type of invoice element that is used to assist in describing an Invoice that is either submitted for adjudication or for which is returned on adjudication results.
+
+                        Invoice elements of this type signify a grouping of one or more children (detail) invoice elements.  They do not have intrinsic costing associated with them, but merely reflect the sum of all costing for it's immediate children invoice elements.
+
+                        The domain is only specified for an intermediate invoice element group (non-root or non-top level) for an Invoice.
+         */
+        _ACTINVOICEINTERGROUPCODE, 
+        /**
+         * A grouping of invoice element groups and details including the ones specifying the compound ingredients being invoiced. It may also contain generic detail items such as markup.
+         */
+        CPNDDRGING, 
+        /**
+         * A grouping of invoice element details including the one specifying an ingredient drug being invoiced. It may also contain generic detail items such as tax or markup.
+         */
+        CPNDINDING, 
+        /**
+         * A grouping of invoice element groups and details including the ones specifying the compound supplies being invoiced. It may also contain generic detail items such as markup.
+         */
+        CPNDSUPING, 
+        /**
+         * A grouping of invoice element details including the one specifying the drug being invoiced. It may also contain generic detail items such as markup.
+         */
+        DRUGING, 
+        /**
+         * A grouping of invoice element details including the ones specifying the frame fee and the frame dispensing cost that are being invoiced.
+         */
+        FRAMEING, 
+        /**
+         * A grouping of invoice element details including the ones specifying the lens fee and the lens dispensing cost that are being invoiced.
+         */
+        LENSING, 
+        /**
+         * A grouping of invoice element details including the one specifying the product (good or supply) being invoiced. It may also contain generic detail items such as tax or discount.
+         */
+        PRDING, 
+        /**
+         * Type of invoice element that is used to assist in describing an Invoice that is either submitted for adjudication or for which is returned on adjudication results.
+
+                        Invoice elements of this type signify a grouping of one or more children (detail) invoice elements.  They do not have intrinsic costing associated with them, but merely reflect the sum of all costing for it's immediate children invoice elements.
+
+                        Codes from this domain reflect the type of Invoice such as Pharmacy Dispense, Clinical Service and Clinical Product.  The domain is only specified for the root (top level) invoice element group for an Invoice.
+         */
+        _ACTINVOICEROOTGROUPCODE, 
+        /**
+         * Clinical product invoice where the Invoice Grouping contains one or more billable item and is supported by clinical product(s).
+
+                        For example, a crutch or a wheelchair.
+         */
+        CPINV, 
+        /**
+         * Clinical Services Invoice which can be used to describe a single service, multiple services or repeated services.
+
+                        [1] Single Clinical services invoice where the Invoice Grouping contains one billable item and is supported by one clinical service.
+
+                        For example, a single service for an office visit or simple clinical procedure (e.g. knee mobilization).
+
+                        [2] Multiple Clinical services invoice where the Invoice Grouping contains more than one billable item, supported by one or more clinical services.  The services can be distinct and over multiple dates, but for the same patient. This type of invoice includes a series of treatments which must be adjudicated together.
+
+                        For example, an adjustment and ultrasound for a chiropractic session where fees are associated for each of the services and adjudicated (invoiced) together.
+
+                        [3] Repeated Clinical services invoice where the Invoice Grouping contains one or more billable item, supported by the same clinical service repeated over a period of time.
+
+                        For example, the same Chiropractic adjustment (service or treatment) delivered on 3 separate occasions over a period of time at the discretion of the provider (e.g. month).
+         */
+        CSINV, 
+        /**
+         * A clinical Invoice Grouping consisting of one or more services and one or more product.  Billing for these service(s) and product(s) are supported by multiple clinical billable events (acts).
+
+                        All items in the Invoice Grouping must be adjudicated together to be acceptable to the Adjudicator.
+
+                        For example , a brace (product) invoiced together with the fitting (service).
+         */
+        CSPINV, 
+        /**
+         * Invoice Grouping without clinical justification.  These will not require identification of participants and associations from a clinical context such as patient and provider.
+
+                        Examples are interest charges and mileage.
+         */
+        FININV, 
+        /**
+         * A clinical Invoice Grouping consisting of one or more oral health services. Billing for these service(s) are supported by multiple clinical billable events (acts).
+
+                        All items in the Invoice Grouping must be adjudicated together to be acceptable to the Adjudicator.
+         */
+        OHSINV, 
+        /**
+         * HealthCare facility preferred accommodation invoice.
+         */
+        PAINV, 
+        /**
+         * Pharmacy dispense invoice for a compound.
+         */
+        RXCINV, 
+        /**
+         * Pharmacy dispense invoice not involving a compound
+         */
+        RXDINV, 
+        /**
+         * Clinical services invoice where the Invoice Group contains one billable item for multiple clinical services in one or more sessions.
+         */
+        SBFINV, 
+        /**
+         * Vision dispense invoice for up to 2 lens (left and right), frame and optional discount.  Eye exams are invoiced as a clinical service invoice.
+         */
+        VRXINV, 
+        /**
+         * Identifies the different types of summary information that can be reported by queries dealing with Statement of Financial Activity (SOFA).  The summary information is generally used to help resolve balance discrepancies between providers and payors.
+         */
+        _ACTINVOICEELEMENTSUMMARYCODE, 
+        /**
+         * Total counts and total net amounts adjudicated for all  Invoice Groupings that were adjudicated within a time period based on the adjudication date of the Invoice Grouping.
+         */
+        _INVOICEELEMENTADJUDICATED, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted electronically.
+         */
+        ADNFPPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted electronically.
+         */
+        ADNFPPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted manually.
+         */
+        ADNFPPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted manually.
+         */
+        ADNFPPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date), subsequently nullified in the specified period and submitted electronically.
+         */
+        ADNFSPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date), subsequently nullified in the specified period and submitted electronically.
+         */
+        ADNFSPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted manually.
+         */
+        ADNFSPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted manually.
+         */
+        ADNFSPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted electronically.
+         */
+        ADNPPPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted electronically.
+         */
+        ADNPPPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted manually.
+         */
+        ADNPPPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted manually.
+         */
+        ADNPPPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted electronically.
+         */
+        ADNPSPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted electronically.
+         */
+        ADNPSPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted manually.
+         */
+        ADNPSPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted manually.
+         */
+        ADNPSPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted electronically.
+         */
+        ADPPPPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted electronically.
+         */
+        ADPPPPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted manually.
+         */
+        ADPPPPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted manually.
+         */
+        ADPPPPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted electronically.
+         */
+        ADPPSPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted electronically.
+         */
+        ADPPSPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted manually.
+         */
+        ADPPSPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted manually.
+         */
+        ADPPSPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as refused prior to the specified time period (based on adjudication date) and submitted electronically.
+         */
+        ADRFPPELAT, 
+        /**
+         * Identifies the  total number of all  Invoice Groupings that were adjudicated as refused prior to the specified time period (based on adjudication date) and submitted electronically.
+         */
+        ADRFPPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as refused prior to the specified time period (based on adjudication date) and submitted manually.
+         */
+        ADRFPPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as refused prior to the specified time period (based on adjudication date) and submitted manually.
+         */
+        ADRFPPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as refused during the specified time period (based on adjudication date) and submitted electronically.
+         */
+        ADRFSPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as refused during the specified time period (based on adjudication date) and submitted electronically.
+         */
+        ADRFSPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were adjudicated as refused during the specified time period (based on adjudication date) and submitted manually.
+         */
+        ADRFSPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were adjudicated as refused during the specified time period (based on adjudication date) and submitted manually.
+         */
+        ADRFSPMNCT, 
+        /**
+         * Total counts and total net amounts paid for all  Invoice Groupings that were paid within a time period based on the payment date.
+         */
+        _INVOICEELEMENTPAID, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date), subsequently nullified in the specified period and submitted electronically.
+         */
+        PDNFPPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date), subsequently nullified in the specified period and submitted electronically.
+         */
+        PDNFPPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date), subsequently nullified in the specified period and submitted manually.
+         */
+        PDNFPPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date), subsequently nullified in the specified period and submitted manually.
+         */
+        PDNFPPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date), subsequently nullified in the specified period and submitted electronically.
+         */
+        PDNFSPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date), subsequently cancelled in the specified period and submitted electronically.
+         */
+        PDNFSPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date), subsequently nullified in the specified period and submitted manually.
+         */
+        PDNFSPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date), subsequently nullified in the specified period and submitted manually.
+         */
+        PDNFSPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted electronically.
+         */
+        PDNPPPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted electronically.
+         */
+        PDNPPPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted manually.
+         */
+        PDNPPPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted manually.
+         */
+        PDNPPPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted electronically.
+         */
+        PDNPSPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted electronically.
+         */
+        PDNPSPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted manually.
+         */
+        PDNPSPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted manually.
+         */
+        PDNPSPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted electronically.
+         */
+        PDPPPPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted electronically.
+         */
+        PDPPPPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted manually.
+         */
+        PDPPPPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted manually.
+         */
+        PDPPPPMNCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted electronically.
+         */
+        PDPPSPELAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted electronically.
+         */
+        PDPPSPELCT, 
+        /**
+         * Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted manually.
+         */
+        PDPPSPMNAT, 
+        /**
+         * Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted manually.
+         */
+        PDPPSPMNCT, 
+        /**
+         * Total counts and total net amounts billed for all Invoice Groupings that were submitted within a time period.  Adjudicated invoice elements are included.
+         */
+        _INVOICEELEMENTSUBMITTED, 
+        /**
+         * Identifies the total net amount billed for all submitted Invoice Groupings within a time period and submitted electronically.  Adjudicated invoice elements are included.
+         */
+        SBBLELAT, 
+        /**
+         * Identifies the total number of submitted Invoice Groupings within a time period and submitted electronically.  Adjudicated invoice elements are included.
+         */
+        SBBLELCT, 
+        /**
+         * Identifies the total net amount billed for all submitted  Invoice Groupings that were nullified within a time period and submitted electronically.  Adjudicated invoice elements are included.
+         */
+        SBNFELAT, 
+        /**
+         * Identifies the total number of submitted  Invoice Groupings that were nullified within a time period and submitted electronically.  Adjudicated invoice elements are included.
+         */
+        SBNFELCT, 
+        /**
+         * Identifies the total net amount billed for all submitted  Invoice Groupings that are pended or held by the payor, within a time period and submitted electronically.  Adjudicated invoice elements are not included.
+         */
+        SBPDELAT, 
+        /**
+         * Identifies the total number of submitted  Invoice Groupings that are pended or held by the payor, within a time period and submitted electronically.  Adjudicated invoice elements are not included.
+         */
+        SBPDELCT, 
+        /**
+         * Includes coded responses that will occur as a result of the adjudication of an electronic invoice at a summary level and provides guidance on interpretation of the referenced adjudication results.
+         */
+        _ACTINVOICEOVERRIDECODE, 
+        /**
+         * Insurance coverage problems have been encountered. Additional explanation information to be supplied.
+         */
+        COVGE, 
+        /**
+         * Electronic form with supporting or additional information to follow.
+         */
+        EFORM, 
+        /**
+         * Fax with supporting or additional information to follow.
+         */
+        FAX, 
+        /**
+         * The medical service was provided to a patient in good faith that they had medical coverage, although no evidence of coverage was available before service was rendered.
+         */
+        GFTH, 
+        /**
+         * Knowingly over the payor's published time limit for this invoice possibly due to a previous payor's delays in processing. Additional reason information will be supplied.
+         */
+        LATE, 
+        /**
+         * Manual review of the invoice is requested.  Additional information to be supplied.  This may be used in the case of an appeal.
+         */
+        MANUAL, 
+        /**
+         * The medical service and/or product was provided to a patient that has coverage in another jurisdiction.
+         */
+        OOJ, 
+        /**
+         * The service provided is required for orthodontic purposes. If the covered party has orthodontic coverage, then the service may be paid.
+         */
+        ORTHO, 
+        /**
+         * Paper documentation (or other physical format) with supporting or additional information to follow.
+         */
+        PAPER, 
+        /**
+         * Public Insurance has been exhausted.  Invoice has not been sent to Public Insuror and therefore no Explanation Of Benefits (EOB) is provided with this Invoice submission.
+         */
+        PIE, 
+        /**
+         * Allows provider to explain lateness of invoice to a subsequent payor.
+         */
+        PYRDELAY, 
+        /**
+         * Rules of practice do not require a physician's referral for the provider to perform a billable service.
+         */
+        REFNR, 
+        /**
+         * The same service was delivered within a time period that would usually indicate a duplicate billing.  However, the repeated service is a medical 	necessity and therefore not a duplicate.
+         */
+        REPSERV, 
+        /**
+         * The service provided is not related to another billed service. For example, 2 unrelated services provided on the same day to the same patient which may normally result in a refused payment for one of the items.
+         */
+        UNRELAT, 
+        /**
+         * The provider has received a verbal permission from an authoritative source to perform the service or supply the item being invoiced.
+         */
+        VERBAUTH, 
+        /**
+         * Provides codes associated with ActClass value of LIST (working list)
+         */
+        _ACTLISTCODE, 
+        /**
+         * ActObservationList
+         */
+        _ACTOBSERVATIONLIST, 
+        /**
+         * List of acts representing a care plan.  The acts can be in a varierty of moods including event (EVN) to record acts that have been carried out as part of the care plan.
+         */
+        CARELIST, 
+        /**
+         * List of condition observations.
+         */
+        CONDLIST, 
+        /**
+         * List of intolerance observations.
+         */
+        INTOLIST, 
+        /**
+         * List of problem observations.
+         */
+        PROBLIST, 
+        /**
+         * List of risk factor observations.
+         */
+        RISKLIST, 
+        /**
+         * List of observations in goal mood.
+         */
+        GOALLIST, 
+        /**
+         * Codes used to identify different types of 'duration-based' working lists.  Examples include "Continuous/Chronic", "Short-Term" and "As-Needed".
+         */
+        _ACTTHERAPYDURATIONWORKINGLISTCODE, 
+        /**
+         * Definition:A collection of concepts that identifies different types of 'duration-based' mediation working lists.
+
+                        
+                           Examples:"Continuous/Chronic" "Short-Term" and "As Needed"
+         */
+        _ACTMEDICATIONTHERAPYDURATIONWORKINGLISTCODE, 
+        /**
+         * Definition:A list of medications which the patient is only expected to consume for the duration of the current order or limited set of orders and which is not expected to be renewed.
+         */
+        ACU, 
+        /**
+         * Definition:A list of medications which are expected to be continued beyond the present order and which the patient should be assumed to be taking unless explicitly stopped.
+         */
+        CHRON, 
+        /**
+         * Definition:A list of medications which the patient is intended to be administered only once.
+         */
+        ONET, 
+        /**
+         * Definition:A list of medications which the patient will consume intermittently based on the behavior of the condition for which the medication is indicated.
+         */
+        PRN, 
+        /**
+         * List of medications.
+         */
+        MEDLIST, 
+        /**
+         * List of current medications.
+         */
+        CURMEDLIST, 
+        /**
+         * List of discharge medications.
+         */
+        DISCMEDLIST, 
+        /**
+         * Historical list of medications.
+         */
+        HISTMEDLIST, 
+        /**
+         * Identifies types of monitoring programs
+         */
+        _ACTMONITORINGPROTOCOLCODE, 
+        /**
+         * A monitoring program that focuses on narcotics and/or commonly abused substances that are subject to legal restriction.
+         */
+        CTLSUB, 
+        /**
+         * Definition:A monitoring program that focuses on a drug which is under investigation and has not received regulatory approval for the condition being investigated
+         */
+        INV, 
+        /**
+         * Description:A drug that can be prescribed (and reimbursed) only if it meets certain criteria.
+         */
+        LU, 
+        /**
+         * Medicines designated in this way may be supplied for patient use without a prescription.  The exact form of categorisation will vary in different realms.
+         */
+        OTC, 
+        /**
+         * Some form of prescription is required before the related medicine can be supplied for a patient.  The exact form of regulation will vary in different realms.
+         */
+        RX, 
+        /**
+         * Definition:A drug that requires prior approval (to be reimbursed) before being dispensed
+         */
+        SA, 
+        /**
+         * Description:A drug that requires special access permission to be prescribed and dispensed.
+         */
+        SAC, 
+        /**
+         * Description:Concepts representing indications (reasons for clinical action) other than diagnosis and symptoms.
+         */
+        _ACTNONOBSERVATIONINDICATIONCODE, 
+        /**
+         * Description:Contrast agent required for imaging study.
+         */
+        IND01, 
+        /**
+         * Description:Provision of prescription or direction to consume a product for purposes of bowel clearance in preparation for a colonoscopy.
+         */
+        IND02, 
+        /**
+         * Description:Provision of medication as a preventative measure during a treatment or other period of increased risk.
+         */
+        IND03, 
+        /**
+         * Description:Provision of medication during pre-operative phase; e.g., antibiotics before dental surgery or bowel prep before colon surgery.
+         */
+        IND04, 
+        /**
+         * Description:Provision of medication for pregnancy --e.g., vitamins, antibiotic treatments for vaginal tract colonization, etc.
+         */
+        IND05, 
+        /**
+         * Identifies the type of verification investigation being undertaken with respect to the subject of the verification activity.
+
+                        
+                           Examples:
+                        
+
+                        
+                           
+                              Verification of eligibility for coverage under a policy or program - aka enrolled/covered by a policy or program
+
+                           
+                           
+                              Verification of record - e.g., person has record in an immunization registry
+
+                           
+                           
+                              Verification of enumeration - e.g. NPI
+
+                           
+                           
+                              Verification of Board Certification - provider specific
+
+                           
+                           
+                              Verification of Certification - e.g. JAHCO, NCQA, URAC
+
+                           
+                           
+                              Verification of Conformance - e.g. entity use with HIPAA, conformant to the CCHIT EHR system criteria
+
+                           
+                           
+                              Verification of Provider Credentials
+
+                           
+                           
+                              Verification of no adverse findings - e.g. on National Provider Data Bank, Health Integrity Protection Data Base (HIPDB)
+         */
+        _ACTOBSERVATIONVERIFICATIONTYPE, 
+        /**
+         * Definition:Indicates that the paper version of the record has, should be or is being verified against the electronic version.
+         */
+        VFPAPER, 
+        /**
+         * Code identifying the method or the movement of payment instructions.
+
+                        Codes are drawn from X12 data element 591 (PaymentMethodCode)
+         */
+        _ACTPAYMENTCODE, 
+        /**
+         * Automated Clearing House (ACH).
+         */
+        ACH, 
+        /**
+         * A written order to a bank to pay the amount specified from funds on deposit.
+         */
+        CHK, 
+        /**
+         * Electronic Funds Transfer (EFT) deposit into the payee's bank account
+         */
+        DDP, 
+        /**
+         * Non-Payment Data.
+         */
+        NON, 
+        /**
+         * Identifies types of dispensing events
+         */
+        _ACTPHARMACYSUPPLYTYPE, 
+        /**
+         * A fill providing sufficient supply for one day
+         */
+        DF, 
+        /**
+         * A supply action where there is no 'valid' order for the supplied medication.  E.g. Emergency vacation supply, weekend supply (when prescriber is unavailable to provide a renewal prescription)
+         */
+        EM, 
+        /**
+         * An emergency supply where the expectation is that a formal order authorizing the supply will be provided at a later date.
+         */
+        SO, 
+        /**
+         * The initial fill against an order.  (This includes initial fills against refill orders.)
+         */
+        FF, 
+        /**
+         * A first fill where the quantity supplied is equal to one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a complete fill would be for the full 90 tablets).
+         */
+        FFC, 
+        /**
+         * A first fill where the quantity supplied is less than one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a partial fill might be for only 30 tablets.)
+         */
+        FFP, 
+        /**
+         * A first fill where the strength supplied is less than the ordered strength. (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).
+         */
+        FFSS, 
+        /**
+         * A fill where a small portion is provided to allow for determination of the therapy effectiveness and patient tolerance.
+         */
+        TF, 
+        /**
+         * A supply action to restock a smaller more local dispensary.
+         */
+        FS, 
+        /**
+         * A supply of a manufacturer sample
+         */
+        MS, 
+        /**
+         * A fill against an order that has already been filled (or partially filled) at least once.
+         */
+        RF, 
+        /**
+         * A supply action that provides sufficient material for a single dose.
+         */
+        UD, 
+        /**
+         * A refill where the quantity supplied is equal to one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a complete fill would be for the full 90 tablets.)
+         */
+        RFC, 
+        /**
+         * A refill where the quantity supplied is equal to one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a complete fill would be for the full 90 tablets.) and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).
+         */
+        RFCS, 
+        /**
+         * The first fill against an order that has already been filled at least once at another facility.
+         */
+        RFF, 
+        /**
+         * The first fill against an order that has already been filled at least once at another facility and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).
+         */
+        RFFS, 
+        /**
+         * A refill where the quantity supplied is less than one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a partial fill might be for only 30 tablets.)
+         */
+        RFP, 
+        /**
+         * A refill where the quantity supplied is less than one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a partial fill might be for only 30 tablets.) and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).
+         */
+        RFPS, 
+        /**
+         * A fill against an order that has already been filled (or partially filled) at least once and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).
+         */
+        RFS, 
+        /**
+         * A fill where the remainder of a 'complete' fill is provided after a trial fill has been provided.
+         */
+        TB, 
+        /**
+         * A fill where the remainder of a 'complete' fill is provided after a trial fill has been provided and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).
+         */
+        TBS, 
+        /**
+         * A supply action that provides sufficient material for a single dose via multiple products.  E.g. 2 50mg tablets for a 100mg unit dose.
+         */
+        UDE, 
+        /**
+         * Description:Types of policies that further specify the ActClassPolicy value set.
+         */
+        _ACTPOLICYTYPE, 
+        /**
+         * A policy deeming certain information to be private to an individual or organization.
+
+                        
+                           Definition: A mandate, obligation, requirement, rule, or expectation relating to privacy.
+
+                        
+                           Discussion: ActPrivacyPolicyType codes support the designation of the 1..* policies that are applicable to an Act such as a Consent Directive, a Role such as a VIP Patient, or an Entity such as a patient who is a minor.  1..* ActPrivacyPolicyType values may be associated with an Act or Role to indicate the policies that govern the assignment of an Act or Role confidentialityCode.  Use of multiple ActPrivacyPolicyType values enables fine grain specification of applicable policies, but must be carefully assigned to ensure cogency and avoid creation of conflicting policy mandates.
+
+                        
+                           Usage Note: Statutory title may be named in the ActClassPolicy Act Act.title to specify which privacy policy is being referenced.
+         */
+        _ACTPRIVACYPOLICY, 
+        /**
+         * Specifies the type of agreement between one or more grantor and grantee in which rights and obligations related to one or more shared items of interest are allocated.
+
+                        
+                           Usage Note: Such agreements may be considered "consent directives" or "contracts" depending on the context, and are considered closely related or synonymous from a legal perspective.
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Healthcare Privacy Consent Directive permitting or restricting in whole or part the collection, access, use, and disclosure of health information, and any associated handling caveats.
+                           Healthcare Medical Consent Directive to receive medical procedures after being informed of risks and benefits, thereby reducing the grantee's liability.
+                           Research Informed Consent for participation in clinical trials and disclosure of health information after being informed of risks and benefits, thereby reducing the grantee's liability.
+                           Substitute decision maker delegation in which the grantee assumes responsibility to act on behalf of the grantor.
+                           Contracts in which the agreement requires assent/dissent by the grantor of terms offered by a grantee, a consumer opts out of an "award" system for use of a retailer's marketing or credit card vendor's point collection cards in exchange for allowing purchase tracking and profiling.
+                           A mobile device or App privacy policy and terms of service to which a user must agree in whole or in part in order to utilize the service.
+                           Agreements between a client and an authorization server or between an authorization server and a resource operator and/or resource owner permitting or restricting e.g., collection, access, use, and disclosure of information, and any associated handling caveats.
+         */
+        _ACTCONSENTDIRECTIVE, 
+        /**
+         * This general consent directive specifically limits disclosure of health information for purpose of emergency treatment. Additional parameters may further limit the disclosure to specific users, roles, duration, types of information, and impose uses obligations.
+
+                        
+                           Definition: Opt-in to disclosure of health information for emergency only consent directive.
+         */
+        EMRGONLY, 
+        /**
+         * A grantor's terms of agreement to which a grantee may assent or dissent, and which may include an opportunity for a grantee to request restrictions or extensions.
+
+                        
+                           Comment: A grantor typically is able to stipulate preferred terms of agreement when the grantor has control over the topic of the agreement, which a grantee must accept in full or may be offered an opportunity to extend or restrict certain terms.
+
+                        
+                           Usage Note: If the grantor's term of agreement must be accepted in full, then this is considered "basic consent".  If a grantee is offered an opportunity to extend or restrict certain terms, then the agreement is considered "granular consent".
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Healthcare: A PHR account holder [grantor] may require any PHR user [grantee]  to accept the terms of agreement in full, or may permit a PHR user to extend or restrict terms selected by the account holder or requested by the PHR user.
+                           Non-healthcare: The owner of a resource server [grantor] may require any authorization server [grantee] to meet authorization requirements stipulated in the grantor's terms of agreement.
+         */
+        GRANTORCHOICE, 
+        /**
+         * A grantor's presumed assent to the grantee's terms of agreement is based on the grantor's behavior, which may result from not expressly assenting to the consent directive offered, or from having no right to assent or dissent offered by the grantee.
+
+                        
+                           Comment: Implied or "implicit" consent occurs when the behavior of the grantor is understood by a reasonable person to signal agreement to the grantee's terms.
+
+                        
+                           Usage Note: Implied consent with no opportunity to assent or dissent to certain terms is considered "basic consent".
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Healthcare: A patient schedules an appointment with a provider, and either does not take the opportunity to expressly assent or dissent to the provider's consent directive, does not have an opportunity to do so, as in the case where emergency care is required, or simply behaves as though the patient [grantor] agrees to the rights granted to the provider [grantee] in an implicit consent directive.
+                           An injured and unconscious patient is deemed to have assented to emergency treatment by those permitted to do so under jurisdictional laws, e.g., Good Samaritan laws.
+                           Non-healthcare: Upon receiving a driver's license, the driver is deemed to have assented without explicitly consenting to undergoing field sobriety tests.
+                           A corporation that does business in a foreign nation is deemed to have deemed to have assented without explicitly consenting to abide by that nation's laws.
+         */
+        IMPLIED, 
+        /**
+         * A grantor's presumed assent to the grantee's terms of agreement, which is based on the grantor's behavior, and includes a right to dissent to certain terms. 
+
+                        
+                           Comment: A grantor assenting to the grantee's terms of agreement may or may not exercise a right to dissent to grantor selected terms or to grantee's selected terms to which a grantor may dissent.
+
+                        
+                           Usage Note: Implied or "implicit" consent with an "opportunity to dissent" occurs when the grantor's behavior is understood by a reasonable person to signal assent to the grantee's terms of agreement whether the grantor requests or the grantee approves further restrictions, is considered "granular consent".
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Healthcare Examples: A healthcare provider deems a patient's assent to disclosure of health information to family members and friends, but offers an opportunity or permits the patient to dissent to such disclosures.
+                           A health information exchanges deems a patient to have assented to disclosure of health information for treatment purposes, but offers the patient an opportunity to dissents to disclosure to particular provider organizations.
+                           Non-healthcare Examples: A bank deems a banking customer's assent to specified collection, access, use, or disclosure of financial information as a requirement of holding a bank account, but provides the user an opportunity to limit third-party collection, access, use or disclosure of that information for marketing purposes.
+         */
+        IMPLIEDD, 
+        /**
+         * No notification or opportunity is provided for a grantor to assent or dissent to a grantee's terms of agreement.
+
+                        
+                           Comment: A "No Consent" policy scheme provides no opportunity for accommodation of an individual's preferences, and may not comply with Fair Information Practice Principles [FIPP] by enabling the data subject to object, access collected information, correct errors, or have accounting of disclosures.
+
+                        
+                           Usage Note: The grantee's terms of agreement, may be available to the grantor by reviewing the grantee's privacy policies, but there is no notice by which a grantor is apprised of the policy directly or able to acknowledge.
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Healthcare: Without notification or an opportunity to assent or dissent, a patient's health information is automatically included in and available (often according to certain rules) through a health information exchange.  Note that this differs from implied consent, where the patient is assumed to have consented.
+                           Without notification or an opportunity to assent or dissent, a patient's health information is collected, accessed, used, or disclosed for research, public health, security, fraud prevention, court order, or law enforcement.
+                           Non-healthcare: Without notification or an opportunity to assent or dissent, a consumer's healthcare or non-healthcare internet searches are aggregated for secondary uses such as behavioral tracking and profiling.
+                           Without notification or an opportunity to assent or dissent, a consumer's location and activities in a shopping mall are tracked by RFID tags on purchased items.
+         */
+        NOCONSENT, 
+        /**
+         * Acknowledgement of custodian notice of privacy practices.
+
+                        
+                           Usage Notes: This type of consent directive acknowledges a custodian's notice of privacy practices including its permitted collection, access, use and disclosure of health information to users and for purposes of use specified.
+         */
+        NOPP, 
+        /**
+         * A grantor's assent to the terms of an agreement offered by a grantee without an opportunity for to dissent to any terms.
+
+                        
+                           Comment: Acceptance of a grantee's terms pertaining, for example, to permissible activities, purposes of use, handling caveats, expiry date, and revocation policies.
+
+                        
+                           Usage Note: Opt-in with no opportunity for a grantor to restrict certain permissions sought by the grantee is considered "basic consent".
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Healthcare: A patient [grantor] signs a provider's [grantee's] consent directive form, which lists permissible collection, access, use, or disclosure activities, purposes of use, handling caveats, and revocation policies.
+                           Non-healthcare: An employee [grantor] signs an employer's [grantee's] non-disclosure and non-compete agreement.
+         */
+        OPTIN, 
+        /**
+         * A grantor's assent to the grantee's terms of an agreement with an opportunity for to dissent to certain grantor or grantee selected terms.
+
+                        
+                           Comment: A grantor dissenting to the grantee's terms of agreement may or may not exercise a right to assent to grantor's pre-approved restrictions or to grantee's selected terms to which a grantor may dissent.
+
+                        
+                           Usage Note: Opt-in with restrictions is considered "granular consent" because the grantor has an opportunity to narrow the permissions sought by the grantee.
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Healthcare:  A patient assent to grantee's consent directive terms for collection, access, use, or disclosure of health information, and dissents to disclosure to certain recipients as allowed by the provider's pre-approved restriction list.
+                           Non-Healthcare: A cell phone user assents to the cell phone's privacy practices and terms of use, but dissents from location tracking by turning off the cell phone's tracking capability.
+         */
+        OPTINR, 
+        /**
+         * A grantor's dissent to the terms of agreement offered by a grantee without an opportunity for to assent to any terms.
+
+                        
+                           Comment: Rejection of a grantee's terms of agreement pertaining, for example, to permissible activities, purposes of use, handling caveats, expiry date, and revocation policies.
+
+                        
+                           Usage Note: Opt-out with no opportunity for a grantor to permit certain permissions sought by the grantee is considered "basic consent".
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Healthcare: A patient [grantor] declines to sign a provider's [grantee's] consent directive form, which lists permissible collection, access, use, or disclosure activities, purposes of use, handling caveats, revocation policies, and consequences of not assenting.
+                           Non-healthcare: An employee [grantor] refuses to sign an employer's [grantee's] agreement not to join unions or participate in a strike where state law protects employee's collective bargaining rights.
+                           A citizen [grantor] refuses to enroll in mandatory government [grantee] health insurance based on religious beliefs, which is an exemption.
+         */
+        OPTOUT, 
+        /**
+         * A grantor's dissent to the grantee's terms of agreement except for certain grantor or grantee selected terms.
+
+                        
+                           Comment: A rejection of a grantee's terms of agreement while assenting to certain permissions sought by the grantee or requesting approval of additional grantor terms.
+
+                        
+                           Usage Note: Opt-out with exceptions is considered a "granular consent" because the grantor has an opportunity to accept certain permissions sought by the grantee or request additional grantor terms, while rejecting other grantee terms.
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Healthcare: A patient [grantor] dissents to a health information exchange consent directive with the exception of disclosure based on a limited "time to live" shared secret [e.g., a token or password], which the patient can give to a provider when seeking care.
+                           Non-healthcare: A social media user [grantor] dissents from public access to their account, but assents to access to a circle of friends.
+         */
+        OPTOUTE, 
+        /**
+         * A jurisdictional mandate, regulation, obligation, requirement, rule, or expectation deeming certain information to be private to an individual or organization, which is imposed on:
+
+                        
+                           The activity of a governed party
+                           The behavior of a governed party
+                           The manner in which an act is executed by a governed party
+         */
+        _ACTPRIVACYLAW, 
+        /**
+         * Definition: A jurisdictional mandate in the U.S. relating to privacy.
+
+                        
+                           Usage Note: ActPrivacyLaw codes may be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.  May be used to further specify rationale for assignment of other ActPrivacyPolicy codes in the US realm, e.g., ETH and 42CFRPart2 can be differentiated from ETH and Title38Part1.
+         */
+        _ACTUSPRIVACYLAW, 
+        /**
+         * 42 CFR Part 2 stipulates the right of an individual who has applied for or been given diagnosis or treatment for alcohol or drug abuse at a federally assisted program.
+
+                        
+                           Definition: Non-disclosure of health information relating to health care paid for by a federally assisted substance abuse program without patient consent.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.
+         */
+        _42CFRPART2, 
+        /**
+         * U.S. Federal regulations governing the protection of human subjects in research (codified at Subpart A of 45 CFR part 46) that has been adopted by 15 U.S. Federal departments and agencies in an effort to promote uniformity, understanding, and compliance with human subject protections. Existing regulations governing the protection of human subjects in Food and Drug Administration (FDA)-regulated research (21 CFR parts 50, 56, 312, and 812) are separate from the Common Rule but include similar requirements.
+
+                        
+                           Definition: U.S. federal laws governing research-related privacy policies.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.
+         */
+        COMMONRULE, 
+        /**
+         * The U.S. Public Law 104-191 Health Insurance Portability and Accountability Act (HIPAA) Privacy Rule (45 CFR Part 164 Subpart E) permits access, use and disclosure of certain personal health information (PHI as defined under the law) for purposes of Treatment, Payment, and Operations, and requires that the provider ask that patients acknowledge the Provider's Notice of Privacy Practices as permitted conduct under the law.
+
+                        
+                           Definition: Notification of HIPAA Privacy Practices.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.
+         */
+        HIPAANOPP, 
+        /**
+         * The U.S. Public Law 104-191 Health Insurance Portability and Accountability Act (HIPAA) Privacy Rule (45 CFR Part 164 Section 164.508) requires authorization for certain uses and disclosure of psychotherapy notes.
+
+                        
+                           Definition: Authorization that must be obtained for disclosure of psychotherapy notes.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.
+         */
+        HIPAAPSYNOTES, 
+        /**
+         * Section 13405(a) of the Health Information Technology for Economic and Clinical Health Act (HITECH) stipulates the right of an individual to have disclosures regarding certain health care items or services for which the individual pays out of pocket in full restricted from a health plan.
+
+                        
+                           Definition: Non-disclosure of health information to a health plan relating to health care items or services for which an individual pays out of pocket in full.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.
+         */
+        HIPAASELFPAY, 
+        /**
+         * Title 38 Part 1-protected information may only be disclosed to a third party with the special written consent of the patient except where expressly authorized by 38 USC 7332. VA may disclose this information for specific purposes to: VA employees on a need to know basis - more restrictive than Privacy Act need to know; contractors who need the information in order to perform or fulfil the duties of the contract; and researchers who provide assurances that the information will not be identified in any report. This information may also be disclosed without consent where patient lacks decision-making capacity; in a medical emergency for the purpose of treating a condition which poses an immediate threat to the health of any individual and which requires immediate medical intervention; for eye, tissue, or organ donation purposes; and disclosure of HIV information for public health purposes.
+
+                        
+                           Definition: Title 38 Part 1 - Section 1.462 Confidentiality restrictions.
+
+                        (a) General. The patient records to which Sections 1.460 through 1.499 of this part apply may be disclosed or used only as permitted by these regulations and may not otherwise be disclosed or used in any civil, criminal, administrative, or legislative proceedings conducted by any Federal, State, or local authority. Any disclosure made under these regulations must be limited to that information which is necessary to carry out the purpose of the disclosure. SUBCHAPTER III--PROTECTION OF PATIENT RIGHTS Sec. 7332. Confidentiality of certain medical records (a)(1) Records of the identity, diagnosis, prognosis, or treatment of any patient or subject which are maintained in connection with the performance of any program or activity (including education, training, treatment, rehabilitation, or research) relating to drug abuse, alcoholism or alcohol abuse, infection with the human immunodeficiency virus, or sickle cell anemia which is carried out by or for the Department under this title shall, except as provided in subsections (e) and (f), be confidential, and (section 5701 of this title to the contrary notwithstanding) such records may be disclosed only for the purposes and under the circumstances expressly authorized under subsection (b).
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.
+         */
+        TITLE38SECTION7332, 
+        /**
+         * A mandate, obligation, requirement, rule, or expectation characterizing the value or importance of a resource and may include its vulnerability. (Based on ISO7498-2:1989. Note: The vulnerability of personally identifiable sensitive information may be based on concerns that the unauthorized disclosure may result in social stigmatization or discrimination.) Description:  Types of Sensitivity policy that apply to Acts or Roles.  A sensitivity policy is adopted by an enterprise or group of enterprises (a 'policy domain') through a formal data use agreement that stipulates the value, importance, and vulnerability of information. A sensitivity code representing a sensitivity policy may be associated with criteria such as categories of information or sets of information identifiers (e.g., a value set of clinical codes or branch in a code system hierarchy).   These criteria may in turn be used for the Policy Decision Point in a Security Engine.  A sensitivity code may be used to set the confidentiality code used on information about Acts and Roles to trigger the security mechanisms required to control how security principals (i.e., a person, a machine, a software application) may act on the information (e.g., collection, access, use, or disclosure). Sensitivity codes are never assigned to the transport or business envelope containing patient specific information being exchanged outside of a policy domain as this would disclose the information intended to be protected by the policy.  When sensitive information is exchanged with others outside of a policy domain, the confidentiality code on the transport or business envelope conveys the receiver's responsibilities and indicates the how the information is to be safeguarded without unauthorized disclosure of the sensitive information.  This ensures that sensitive information is treated by receivers as the sender intends, accomplishing interoperability without point to point negotiations.
+
+                        
+                           Usage Note: Sensitivity codes are not useful for interoperability outside of a policy domain because sensitivity policies are typically localized and vary drastically across policy domains even for the same information category because of differing organizational business rules, security policies, and jurisdictional requirements.  For example, an employee's sensitivity code would make little sense for use outside of a policy domain.   'Taboo' would rarely be useful outside of a policy domain unless there are jurisdictional requirements requiring that a provider disclose sensitive information to a patient directly.  Sensitivity codes may be more appropriate in a legacy system's Master Files in order to notify those who access a patient's orders and observations about the sensitivity policies that apply.  Newer systems may have a security engine that uses a sensitivity policy's criteria directly.  The specializable InformationSensitivityPolicy Act.code may be useful in some scenarios if used in combination with a sensitivity identifier and/or Act.title.
+         */
+        _INFORMATIONSENSITIVITYPOLICY, 
+        /**
+         * Types of sensitivity policies that apply to Acts.  Act.confidentialityCode is defined in the RIM as "constraints around appropriate disclosure of information about this Act, regardless of mood."
+
+                        
+                           Usage Note: ActSensitivity codes are used to bind information to an Act.confidentialityCode according to local sensitivity policy so that those confidentiality codes can then govern its handling across enterprises.  Internally to a policy domain, however, local policies guide the access control system on how end users in that policy domain are  able to use information tagged with these sensitivity values.
+         */
+        _ACTINFORMATIONSENSITIVITYPOLICY, 
+        /**
+         * Policy for handling alcohol or drug-abuse information, which will be afforded heightened confidentiality.  Information handling protocols based on organizational policies related to alcohol or drug-abuse information that is deemed sensitive.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        ETH, 
+        /**
+         * Policy for handling genetic disease information, which will be afforded heightened confidentiality. Information handling protocols based on organizational policies related to genetic disease information that is deemed sensitive.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        GDIS, 
+        /**
+         * Policy for handling HIV or AIDS information, which will be afforded heightened confidentiality. Information handling protocols based on organizational policies related to HIV or AIDS information that is deemed sensitive.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        HIV, 
+        /**
+         * Policy for handling psychiatry information, which will be afforded heightened confidentiality. Information handling protocols based on organizational policies related to psychiatry information that is deemed sensitive.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        PSY, 
+        /**
+         * Policy for handling sickle cell disease information, which is afforded heightened confidentiality.  Information handling protocols are based on organizational policies related to sickle cell disease information, which is deemed sensitive.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then the Act valued with this ActCode should be associated with an Act valued with any applicable laws from the ActPrivacyLaw code system.
+         */
+        SCA, 
+        /**
+         * Information about provision of social services.
+
+                        
+                           Usage Note: This is a temporary addition to FHIR to be proposed in harmonization.
+         */
+        SOC, 
+        /**
+         * Policy for handling sexual assault, abuse, or domestic violence information, which will be afforded heightened confidentiality. Information handling protocols based on organizational policies related to sexual assault, abuse, or domestic violence information that is deemed sensitive.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        SDV, 
+        /**
+         * Policy for handling sexuality and reproductive health information, which will be afforded heightened confidentiality.  Information handling protocols based on organizational policies related to sexuality and reproductive health information that is deemed sensitive.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        SEX, 
+        /**
+         * Policy for handling sexually transmitted disease information, which will be afforded heightened confidentiality.
+ Information handling protocols based on organizational policies related to sexually transmitted disease information that is deemed sensitive.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        STD, 
+        /**
+         * Policy for handling information not to be initially disclosed or discussed with patient except by a physician assigned to patient in this case. Information handling protocols based on organizational policies related to sensitive patient information that must be initially discussed with the patient by an attending physician before being disclosed to the patient.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+
+                        
+                           Open Issue: This definition conflates a rule and a characteristic, and there may be a similar issue with ts sibling codes.
+         */
+        TBOO, 
+        /**
+         * Types of sensitivity policies that apply to Acts.  Act.confidentialityCode is defined in the RIM as "constraints around appropriate disclosure of information about this Act, regardless of mood."
+
+                        
+                           Usage Note: ActSensitivity codes are used to bind information to an Act.confidentialityCode according to local sensitivity policy so that those confidentiality codes can then govern its handling across enterprises.  Internally to a policy domain, however, local policies guide the access control system on how end users in that policy domain are able to use information tagged with these sensitivity values.
+         */
+        SICKLE, 
+        /**
+         * Types of sensitivity policies that may apply to a sensitive attribute on an Entity.
+
+                        
+                           Usage Note: EntitySensitivity codes are used to convey a policy that is applicable to sensitive information conveyed by an entity attribute.  May be used to bind a Role.confidentialityCode associated with an Entity per organizational policy.  Role.confidentialityCode is defined in the RIM as "an indication of the appropriate disclosure of information about this Role with respect to the playing Entity."
+         */
+        _ENTITYSENSITIVITYPOLICYTYPE, 
+        /**
+         * Policy for handling all demographic information about an information subject, which will be afforded heightened confidentiality. Policies may govern sensitivity of information related to all demographic about an information subject, the disclosure of which could impact the privacy, well-being, or safety of that subject.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        DEMO, 
+        /**
+         * Policy for handling information related to an information subject's date of birth, which will be afforded heightened confidentiality.Policies may govern sensitivity of information related to an information subject's date of birth, the disclosure of which could impact the privacy, well-being, or safety of that subject.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        DOB, 
+        /**
+         * Policy for handling information related to an information subject's gender and sexual orientation, which will be afforded heightened confidentiality.  Policies may govern sensitivity of information related to an information subject's gender and sexual orientation, the disclosure of which could impact the privacy, well-being, or safety of that subject.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        GENDER, 
+        /**
+         * Policy for handling information related to an information subject's living arrangement, which will be afforded heightened confidentiality.  Policies may govern sensitivity of information related to an information subject's living arrangement, the disclosure of which could impact the privacy, well-being, or safety of that subject.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        LIVARG, 
+        /**
+         * Policy for handling information related to an information subject's marital status, which will be afforded heightened confidentiality. Policies may govern sensitivity of information related to an information subject's marital status, the disclosure of which could impact the privacy, well-being, or safety of that subject.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        MARST, 
+        /**
+         * Policy for handling information related to an information subject's race, which will be afforded heightened confidentiality.  Policies may govern sensitivity of information related to an information subject's race, the disclosure of which could impact the privacy, well-being, or safety of that subject.
+
+                        
+                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        RACE, 
+        /**
+         * Policy for handling information related to an information subject's religious affiliation, which will be afforded heightened confidentiality.  Policies may govern sensitivity of information related to an information subject's religion, the disclosure of which could impact the privacy, well-being, or safety of that subject.
+
+                        
+                           Usage Notes: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        REL, 
+        /**
+         * Types of sensitivity policies that apply to Roles.
+
+                        
+                           Usage Notes: RoleSensitivity codes are used to bind information to a Role.confidentialityCode per organizational policy.  Role.confidentialityCode is defined in the RIM as "an indication of the appropriate disclosure of information about this Role with respect to the playing Entity."
+         */
+        _ROLEINFORMATIONSENSITIVITYPOLICY, 
+        /**
+         * Policy for handling trade secrets such as financial information or intellectual property, which will be afforded heightened confidentiality.  Description:  Since the service class can represent knowledge structures that may be considered a trade or business secret, there is sometimes (though rarely) the need to flag those items as of business level confidentiality.
+
+                        
+                           Usage Notes: No patient related information may ever be of this confidentiality level.   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        B, 
+        /**
+         * Policy for handling information related to an employer which is deemed classified to protect an employee who is the information subject, and which will be afforded heightened confidentiality.  Description:  Policies may govern sensitivity of information related to an employer, such as law enforcement or national security, the identity of which could impact the privacy, well-being, or safety of an information subject who is an employee.
+
+                        
+                           Usage Notes: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        EMPL, 
+        /**
+         * Policy for handling information related to the location of the information subject, which will be afforded heightened confidentiality.  Description:  Policies may govern sensitivity of information related to the location of the information subject, the disclosure of which could impact the privacy, well-being, or safety of that subject.
+
+                        
+                           Usage Notes: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        LOCIS, 
+        /**
+         * Policy for handling information related to a provider of sensitive services, which will be afforded heightened confidentiality.  Description:  Policies may govern sensitivity of information related to providers who deliver sensitive healthcare services in order to protect the privacy, well-being, and safety of the provider and of patients receiving sensitive services.
+
+                        
+                           Usage Notes: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        SSP, 
+        /**
+         * Policy for handling information related to an adolescent, which will be afforded heightened confidentiality per applicable organizational or jurisdictional policy.  An enterprise may have a policy that requires that adolescent patient information be provided heightened confidentiality.  Information deemed sensitive typically includes health information and patient role information including patient status, demographics, next of kin, and location.
+
+                        
+                           Usage Note: For use within an enterprise in which an adolescent is the information subject.  If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        ADOL, 
+        /**
+         * Policy for handling information related to a celebrity (people of public interest (VIP), which will be afforded heightened confidentiality.  Celebrities are people of public interest (VIP) about whose information an enterprise may have a policy that requires heightened confidentiality.  Information deemed sensitive may include health information and patient role information including patient status, demographics, next of kin, and location.
+
+                        
+                           Usage Note:  For use within an enterprise in which the information subject is deemed a celebrity or very important person.  If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        CEL, 
+        /**
+         * Policy for handling information related to a diagnosis, health condition or health problem, which will be afforded heightened confidentiality.  Diagnostic, health condition or health problem related information may be deemed sensitive by organizational policy, and require heightened confidentiality.
+
+                        
+                           Usage Note: For use within an enterprise that provides heightened confidentiality to  diagnostic, health condition or health problem related information deemed sensitive.   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        DIA, 
+        /**
+         * Policy for handling information related to a drug, which will be afforded heightened confidentiality. Drug information may be deemed sensitive by organizational policy, and require heightened confidentiality.
+
+                        
+                           Usage Note: For use within an enterprise that provides heightened confidentiality to drug information deemed sensitive.   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        DRGIS, 
+        /**
+         * Policy for handling information related to an employee, which will be afforded heightened confidentiality. When a patient is an employee, an enterprise may have a policy that requires heightened confidentiality.  Information deemed sensitive typically includes health information and patient role information including patient status, demographics, next of kin, and location.
+
+                        
+                           Usage Note: Policy for handling information related to an employee, which will be afforded heightened confidentiality.  Description:  When a patient is an employee, an enterprise may have a policy that requires heightened confidentiality.  Information deemed sensitive typically includes health information and patient role information including patient status, demographics, next of kin, and location.
+         */
+        EMP, 
+        /**
+         * Policy for handling information reported by the patient about another person, e.g., a family member, which will be afforded heightened confidentiality. Sensitive information reported by the patient about another person, e.g., family members may be deemed sensitive by default.  The flag may be set or cleared on patient's request.  
+
+                        
+                           Usage Note: For sensitive information relayed by or about a patient, which is deemed sensitive within the enterprise (i.e., by default regardless of whether the patient requested that the information be deemed sensitive.)   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        PDS, 
+        /**
+         * For sensitive information relayed by or about a patient, which is deemed sensitive within the enterprise (i.e., by default regardless of whether the patient requested that the information be deemed sensitive.)   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+
+                        
+                           Usage Note: For use within an enterprise that provides heightened confidentiality to certain types of information designated by a patient as sensitive.   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.
+         */
+        PRS, 
+        /**
+         * This is the healthcare analog to the US Intelligence Community's concept of a Special Access Program.  Compartment codes may be used in as a field value in an initiator's clearance to indicate permission to access and use an IT Resource with a security label having the same compartment value in security category label field.
+
+                        Map: Aligns with ISO 2382-8 definition of Compartment - "A division of data into isolated blocks with separate security controls for the purpose of reducing risk."
+         */
+        COMPT, 
+        /**
+         * A security category label field value, which indicates that access and use of an IT resource is restricted to members of human resources department or workflow.
+         */
+        HRCOMPT, 
+        /**
+         * A security category label field value, which indicates that access and use of an IT resource is restricted to members of a research project.
+         */
+        RESCOMPT, 
+        /**
+         * A security category label field value, which indicates that access and use of an IT resource is restricted to members of records management department or workflow.
+         */
+        RMGTCOMPT, 
+        /**
+         * A mandate, obligation, requirement, rule, or expectation conveyed as security metadata between senders and receivers required to establish the reliability, authenticity, and trustworthiness of their transactions.
+
+                        Trust security metadata are observation made about aspects of trust applicable to an IT resource (data, information object, service, or system capability).
+
+                        Trust applicable to IT resources is established and maintained in and among security domains, and may be comprised of observations about the domain's trust authority, trust framework, trust policy, trust interaction rules, means for assessing and monitoring adherence to trust policies, mechanisms that enforce trust, and quality and reliability measures of assurance in those mechanisms. [Based on ISO IEC 10181-1 and NIST SP 800-63-2]
+
+                        For example, identity proofing , level of assurance, and Trust Framework.
+         */
+        ACTTRUSTPOLICYTYPE, 
+        /**
+         * Type of security metadata about the formal declaration by an authority or neutral third party that validates the technical, security, trust, and business practice conformance of Trust Agents to facilitate security, interoperability, and trust among participants within a security domain or trust framework.
+         */
+        TRSTACCRD, 
+        /**
+         * Type of security metadata about privacy and security requirements with which a security domain must comply. [ISO IEC 10181-1]
+         */
+        TRSTAGRE, 
+        /**
+         * Type of security metadata about the digital quality or reliability of a trust assertion, activity, capability, information exchange, mechanism, process, or protocol.
+         */
+        TRSTASSUR, 
+        /**
+         * Type of security metadata about a set of security-relevant data issued by a security authority or trusted third party, together with security information which is used to provide the integrity and data origin authentication services for an IT resource (data, information object, service, or system capability). [Based on ISO IEC 10181-1]
+         */
+        TRSTCERT, 
+        /**
+         * Type of security metadata about a complete set of contracts, regulations, or commitments that enable participating actors to rely on certain assertions by other actors to fulfill their information security requirements. [Kantara Initiative]
+         */
+        TRSTFWK, 
+        /**
+         * Type of security metadata about a security architecture system component that supports enforcement of security policies.
+         */
+        TRSTMEC, 
+        /**
+         * Description:A mandate, obligation, requirement, rule, or expectation unilaterally imposed on benefit coverage under a policy or program by a sponsor, underwriter or payor on:
+
+                        
+                           
+                              The activity of another party
+
+                           
+                           
+                              The behavior of another party
+
+                           
+                           
+                              The manner in which an act is executed
+
+                           
+                        
+                        
+                           Examples:A clinical protocol imposed by a payer to which a provider must adhere in order to be paid for providing the service.  A formulary from which a provider must select prescribed drugs in order for the patient to incur a lower copay.
+         */
+        COVPOL, 
+        /**
+         * Types of security policies that further specify the ActClassPolicy value set.
+
+                        
+                           Examples:
+                        
+
+                        
+                           obligation to encrypt
+                           refrain from redisclosure without consent
+         */
+        SECURITYPOLICY, 
+        /**
+         * Conveys the mandated workflow action that an information custodian, receiver, or user must perform.  
+
+                        
+                           Usage Notes: Per ISO 22600-2, ObligationPolicy instances 'are event-triggered and define actions to be performed by manager agent'. Per HL7 Composite Security and Privacy Domain Analysis Model:  This value set refers to the action required to receive the permission specified in the privacy rule. Per OASIS XACML, an obligation is an operation specified in a policy or policy that is performed in conjunction with the enforcement of an access control decision.
+         */
+        OBLIGATIONPOLICY, 
+        /**
+         * Custodian system must remove any information that could result in identifying the information subject.
+         */
+        ANONY, 
+        /**
+         * Custodian system must make available to an information subject upon request an accounting of certain disclosures of the individual’s protected health information over a period of time.  Policy may dictate that the accounting include information about the information disclosed,  the date of disclosure, the identification of the receiver, the purpose of the disclosure, the time in which the disclosing entity must provide a response and the time period for which accountings of disclosure can be requested.
+         */
+        AOD, 
+        /**
+         * Custodian system must monitor systems to ensure that all users are authorized to operate on information objects.
+         */
+        AUDIT, 
+        /**
+         * Custodian system must monitor and maintain retrievable log for each user and operation on information.
+         */
+        AUDTR, 
+        /**
+         * Custodian security system must retrieve, evaluate, and comply with the information handling directions of the Confidentiality Code associated with an information target.
+         */
+        CPLYCC, 
+        /**
+         * Custodian security system must retrieve, evaluate, and comply with applicable information subject consent directives.
+         */
+        CPLYCD, 
+        /**
+         * Custodian security system must retrieve, evaluate, and comply with applicable jurisdictional privacy policies associated with the target information.
+         */
+        CPLYJPP, 
+        /**
+         * Custodian security system must retrieve, evaluate, and comply with applicable organizational privacy policies associated with the target information.
+         */
+        CPLYOPP, 
+        /**
+         * Custodian security system must retrieve, evaluate, and comply with the organizational security policies associated with the target information.
+         */
+        CPLYOSP, 
+        /**
+         * Custodian security system must retrieve, evaluate, and comply with applicable policies associated with the target information.
+         */
+        CPLYPOL, 
+        /**
+         * Custodian security system must declassify information assigned security labels by instantiating a new version of the classified information so as to break the binding of the classifying security label when assigning a new security label that marks the information as unclassified in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the previous assignment and binding.
+         */
+        DECLASSIFYLABEL, 
+        /**
+         * Custodian system must strip information of data that would allow the identification of the source of the information or the information subject.
+         */
+        DEID, 
+        /**
+         * Custodian system must remove target information from access after use.
+         */
+        DELAU, 
+        /**
+         * Custodian security system must downgrade information assigned security labels by instantiating a new version of the classified information so as to break the binding of the classifying security label when assigning a new security label that marks the information as classified at a less protected level in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the previous assignment and binding.
+         */
+        DOWNGRDLABEL, 
+        /**
+         * Custodian security system must assign and bind security labels derived from compilations of information by aggregation or disaggregation in order to classify information compiled in the information systems under its control for collection, access, use and disclosure in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the previous assignment and binding.
+         */
+        DRIVLABEL, 
+        /**
+         * Custodian system must render information unreadable by algorithmically transforming plaintext into ciphertext.  
+
+                        
+
+                        
+                           Usage Notes: A mathematical transposition of a file or data stream so that it cannot be deciphered at the receiving end without the proper key. Encryption is a security feature that assures that only the parties who are supposed to be participating in a videoconference or data transfer are able to do so. It can include a password, public and private keys, or a complex combination of all.  (Per Infoway.)
+         */
+        ENCRYPT, 
+        /**
+         * Custodian system must render information unreadable and unusable by algorithmically transforming plaintext into ciphertext when "at rest" or in storage.
+         */
+        ENCRYPTR, 
+        /**
+         * Custodian system must render information unreadable and unusable by algorithmically transforming plaintext into ciphertext while "in transit" or being transported by any means.
+         */
+        ENCRYPTT, 
+        /**
+         * Custodian system must render information unreadable and unusable by algorithmically transforming plaintext into ciphertext while in use such that operations permitted on the target information are limited by the license granted to the end user.
+         */
+        ENCRYPTU, 
+        /**
+         * Custodian system must require human review and approval for permission requested.
+         */
+        HUAPRV, 
+        /**
+         * Custodian security system must assign and bind security labels in order to classify information created in the information systems under its control for collection, access, use and disclosure in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the assignment and binding.
+
+                        
+                           Usage Note: In security systems, security policy label assignments do not change, they may supersede prior assignments, and such reassignments are always tracked for auditing and other purposes.
+         */
+        LABEL, 
+        /**
+         * Custodian system must render information unreadable and unusable by algorithmically transforming plaintext into ciphertext.  User may be provided a key to decrypt per license or "shared secret".
+         */
+        MASK, 
+        /**
+         * Custodian must limit access and disclosure to the minimum information required to support an authorized user's purpose of use.  
+
+                        
+                           Usage Note: Limiting the information available for access and disclosure to that an authorized user or receiver "needs to know" in order to perform permitted workflow or purpose of use.
+         */
+        MINEC, 
+        /**
+         * Custodian security system must persist the binding of security labels to classify information received or imported by information systems under its control for collection, access, use and disclosure in accordance with applicable jurisdictional privacy policies associated with the target information.  The system must retain an immutable record of the assignment and binding.
+         */
+        PERSISTLABEL, 
+        /**
+         * Custodian must create and/or maintain human readable security label tags as required by policy.
+
+                        Map:  Aligns with ISO 22600-3 Section A.3.4.3 description of privacy mark:  "If present, the privacy-mark is not used for access control. The content of the privacy-mark may be defined by the security policy in force (identified by the security-policy-identifier) which may define a list of values to be used. Alternately, the value may be determined by the originator of the security-label."
+         */
+        PRIVMARK, 
+        /**
+         * Custodian system must strip information of data that would allow the identification of the source of the information or the information subject.  Custodian may retain a key to relink data necessary to reidentify the information subject.
+         */
+        PSEUD, 
+        /**
+         * Custodian system must remove information, which is not authorized to be access, used, or disclosed from records made available to otherwise authorized users.
+         */
+        REDACT, 
+        /**
+         * Custodian security system must declassify information assigned security labels by instantiating a new version of the classified information so as to break the binding of the classifying security label when assigning a new security label that marks the information as classified at a more protected level  in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the previous assignment and binding.
+         */
+        UPGRDLABEL, 
+        /**
+         * Conveys prohibited actions which an information custodian, receiver, or user is not permitted to perform unless otherwise authorized or permitted under specified circumstances.
+
+                        
+
+                        
+                           Usage Notes: ISO 22600-2 species that a Refrain Policy "defines actions the subjects must refrain from performing".  Per HL7 Composite Security and Privacy Domain Analysis Model:  May be used to indicate that a specific action is prohibited based on specific access control attributes e.g., purpose of use, information type, user role, etc.
+         */
+        REFRAINPOLICY, 
+        /**
+         * Prohibition on disclosure without information subject's authorization.
+         */
+        NOAUTH, 
+        /**
+         * Prohibition on collection or storage of the information.
+         */
+        NOCOLLECT, 
+        /**
+         * Prohibition on disclosure without organizational approved patient restriction.
+         */
+        NODSCLCD, 
+        /**
+         * Prohibition on disclosure without a consent directive from the information subject.
+         */
+        NODSCLCDS, 
+        /**
+         * Prohibition on Integration into other records.
+         */
+        NOINTEGRATE, 
+        /**
+         * Prohibition on disclosure except to entities on specific access list.
+         */
+        NOLIST, 
+        /**
+         * Prohibition on disclosure without an interagency service agreement or memorandum of understanding (MOU).
+         */
+        NOMOU, 
+        /**
+         * Prohibition on disclosure without organizational authorization.
+         */
+        NOORGPOL, 
+        /**
+         * Prohibition on disclosing information to patient, family or caregivers without attending provider's authorization.
+
+                        
+                           Usage Note: The information may be labeled with the ActInformationSensitivity TBOO code, triggering application of this RefrainPolicy code as a handling caveat controlling access.
+
+                        Maps to FHIR NOPAT: Typically, this is used on an Alert resource, when the alert records information on patient abuse or non-compliance.
+
+                        FHIR print name is "keep information from patient". Maps to the French realm - code: INVISIBLE_PATIENT.
+
+                        
+                           displayName: Document non visible par le patient
+                           codingScheme: 1.2.250.1.213.1.1.4.13
+                        
+                        French use case:  A label for documents that the author  chose to hide from the patient until the content can be disclose to the patient in a face to face meeting between a healthcare professional and the patient (in French law some results like cancer diagnosis or AIDS diagnosis must be announced to the patient by a healthcare professional and should not be find out by the patient alone).
+         */
+        NOPAT, 
+        /**
+         * Prohibition on collection of the information beyond time necessary to accomplish authorized purpose of use is prohibited.
+         */
+        NOPERSISTP, 
+        /**
+         * Prohibition on redisclosure without patient consent directive.
+         */
+        NORDSCLCD, 
+        /**
+         * Prohibition on redisclosure without a consent directive from the information subject.
+         */
+        NORDSCLCDS, 
+        /**
+         * Prohibition on disclosure without authorization under jurisdictional law.
+         */
+        NORDSCLW, 
+        /**
+         * Prohibition on associating de-identified or pseudonymized information with other information in a manner that could or does result in disclosing information intended to be masked.
+         */
+        NORELINK, 
+        /**
+         * Prohibition on use of the information beyond the purpose of use initially authorized.
+         */
+        NOREUSE, 
+        /**
+         * Prohibition on disclosure except to principals with access permission to specific VIP information.
+         */
+        NOVIP, 
+        /**
+         * Prohibition on disclosure except as permitted by the information originator.
+         */
+        ORCON, 
+        /**
+         * The method that a product is obtained for use by the subject of the supply act (e.g. patient).  Product examples are consumable or durable goods.
+         */
+        _ACTPRODUCTACQUISITIONCODE, 
+        /**
+         * Temporary supply of a product without transfer of ownership for the product.
+         */
+        LOAN, 
+        /**
+         * Temporary supply of a product with financial compensation, without transfer of ownership for the product.
+         */
+        RENT, 
+        /**
+         * Transfer of ownership for a product.
+         */
+        TRANSFER, 
+        /**
+         * Transfer of ownership for a product for financial compensation.
+         */
+        SALE, 
+        /**
+         * Transportation of a specimen.
+         */
+        _ACTSPECIMENTRANSPORTCODE, 
+        /**
+         * Description:Specimen has been received by the participating organization/department.
+         */
+        SREC, 
+        /**
+         * Description:Specimen has been placed into storage at a participating location.
+         */
+        SSTOR, 
+        /**
+         * Description:Specimen has been put in transit to a participating receiver.
+         */
+        STRAN, 
+        /**
+         * Set of codes related to specimen treatments
+         */
+        _ACTSPECIMENTREATMENTCODE, 
+        /**
+         * The lowering of specimen pH through the addition of an acid
+         */
+        ACID, 
+        /**
+         * The act rendering alkaline by impregnating with an alkali; a conferring of alkaline qualities.
+         */
+        ALK, 
+        /**
+         * The removal of fibrin from whole blood or plasma through physical or chemical means
+         */
+        DEFB, 
+        /**
+         * The passage of a liquid through a filter, accomplished by gravity, pressure or vacuum (suction).
+         */
+        FILT, 
+        /**
+         * LDL Precipitation
+         */
+        LDLP, 
+        /**
+         * The act or process by which an acid and a base are combined in such proportions that the resulting compound is neutral.
+         */
+        NEUT, 
+        /**
+         * The addition of calcium back to a specimen after it was removed by chelating agents
+         */
+        RECA, 
+        /**
+         * The filtration of a colloidal substance through a semipermeable medium that allows only the passage of small molecules.
+         */
+        UFIL, 
+        /**
+         * Description: Describes the type of substance administration being performed.  This should not be used to carry codes for identification of products.  Use an associated role or entity to carry such information.
+         */
+        _ACTSUBSTANCEADMINISTRATIONCODE, 
+        /**
+         * The introduction of a drug into a subject with the intention of altering its biologic state with the intent of improving its health status.
+         */
+        DRUG, 
+        /**
+         * Description: The introduction of material into a subject with the intent of providing nutrition or other dietary supplements (e.g. minerals or vitamins).
+         */
+        FD, 
+        /**
+         * The introduction of an immunogen with the intent of stimulating an immune response, aimed at preventing subsequent infections by more viable agents.
+         */
+        IMMUNIZ, 
+        /**
+         * An additional immunization administration within a series intended to bolster or enhance immunity.
+         */
+        BOOSTER, 
+        /**
+         * The first immunization administration in a series intended to produce immunity
+         */
+        INITIMMUNIZ, 
+        /**
+         * Description: A task or action that a user may perform in a clinical information system (e.g., medication order entry, laboratory test results review, problem list entry).
+         */
+        _ACTTASKCODE, 
+        /**
+         * A clinician creates a request for a service to be performed for a given patient.
+         */
+        OE, 
+        /**
+         * A clinician creates a request for a laboratory test to be done for a given patient.
+         */
+        LABOE, 
+        /**
+         * A clinician creates a request for the administration of one or more medications to a given patient.
+         */
+        MEDOE, 
+        /**
+         * A person enters documentation about a given patient.
+         */
+        PATDOC, 
+        /**
+         * Description: A person reviews a list of known allergies of a given patient.
+         */
+        ALLERLREV, 
+        /**
+         * A clinician enters a clinical note about a given patient
+         */
+        CLINNOTEE, 
+        /**
+         * A clinician enters a diagnosis for a given patient.
+         */
+        DIAGLISTE, 
+        /**
+         * A person provides a discharge instruction to a patient.
+         */
+        DISCHINSTE, 
+        /**
+         * A clinician enters a discharge summary for a given patient.
+         */
+        DISCHSUME, 
+        /**
+         * A person provides a patient-specific education handout to a patient.
+         */
+        PATEDUE, 
+        /**
+         * A pathologist enters a report for a given patient.
+         */
+        PATREPE, 
+        /**
+         * A clinician enters a problem for a given patient.
+         */
+        PROBLISTE, 
+        /**
+         * A radiologist enters a report for a given patient.
+         */
+        RADREPE, 
+        /**
+         * Description: A person reviews a list of immunizations due or received for a given patient.
+         */
+        IMMLREV, 
+        /**
+         * Description: A person reviews a list of health care reminders for a given patient.
+         */
+        REMLREV, 
+        /**
+         * Description: A person reviews a list of wellness or preventive care reminders for a given patient.
+         */
+        WELLREMLREV, 
+        /**
+         * A person (e.g., clinician, the patient herself) reviews patient information in the electronic medical record.
+         */
+        PATINFO, 
+        /**
+         * Description: A person enters a known allergy for a given patient.
+         */
+        ALLERLE, 
+        /**
+         * A person reviews a recommendation/assessment provided automatically by a clinical decision support application for a given patient.
+         */
+        CDSREV, 
+        /**
+         * A person reviews a clinical note of a given patient.
+         */
+        CLINNOTEREV, 
+        /**
+         * A person reviews a discharge summary of a given patient.
+         */
+        DISCHSUMREV, 
+        /**
+         * A person reviews a list of diagnoses of a given patient.
+         */
+        DIAGLISTREV, 
+        /**
+         * Description: A person enters an immunization due or received for a given patient.
+         */
+        IMMLE, 
+        /**
+         * A person reviews a list of laboratory results of a given patient.
+         */
+        LABRREV, 
+        /**
+         * A person reviews a list of microbiology results of a given patient.
+         */
+        MICRORREV, 
+        /**
+         * A person reviews organisms of microbiology results of a given patient.
+         */
+        MICROORGRREV, 
+        /**
+         * A person reviews the sensitivity test of microbiology results of a given patient.
+         */
+        MICROSENSRREV, 
+        /**
+         * A person reviews a list of medication orders submitted to a given patient
+         */
+        MLREV, 
+        /**
+         * A clinician reviews a work list of medications to be administered to a given patient.
+         */
+        MARWLREV, 
+        /**
+         * A person reviews a list of orders submitted to a given patient.
+         */
+        OREV, 
+        /**
+         * A person reviews a pathology report of a given patient.
+         */
+        PATREPREV, 
+        /**
+         * A person reviews a list of problems of a given patient.
+         */
+        PROBLISTREV, 
+        /**
+         * A person reviews a radiology report of a given patient.
+         */
+        RADREPREV, 
+        /**
+         * Description: A person enters a health care reminder for a given patient.
+         */
+        REMLE, 
+        /**
+         * Description: A person enters a wellness or preventive care reminder for a given patient.
+         */
+        WELLREMLE, 
+        /**
+         * A person reviews a Risk Assessment Instrument report of a given patient.
+         */
+        RISKASSESS, 
+        /**
+         * A person reviews a Falls Risk Assessment Instrument report of a given patient.
+         */
+        FALLRISK, 
+        /**
+         * Characterizes how a transportation act was or will be carried out.
+
+                        
+                           Examples: Via private transport, via public transit, via courier.
+         */
+        _ACTTRANSPORTATIONMODECODE, 
+        /**
+         * Definition: Characterizes how a patient was or will be transported to the site of a patient encounter.
+
+                        
+                           Examples: Via ambulance, via public transit, on foot.
+         */
+        _ACTPATIENTTRANSPORTATIONMODECODE, 
+        /**
+         * pedestrian transport
+         */
+        AFOOT, 
+        /**
+         * ambulance transport
+         */
+        AMBT, 
+        /**
+         * fixed-wing ambulance transport
+         */
+        AMBAIR, 
+        /**
+         * ground ambulance transport
+         */
+        AMBGRND, 
+        /**
+         * helicopter ambulance transport
+         */
+        AMBHELO, 
+        /**
+         * law enforcement transport
+         */
+        LAWENF, 
+        /**
+         * private transport
+         */
+        PRVTRN, 
+        /**
+         * public transport
+         */
+        PUBTRN, 
+        /**
+         * Identifies the kinds of observations that can be performed
+         */
+        _OBSERVATIONTYPE, 
+        /**
+         * Identifies the type of observation that is made about a specimen that may affect its processing, analysis or further result interpretation
+         */
+        _ACTSPECOBSCODE, 
+        /**
+         * Describes the artificial blood identifier that is associated with the specimen.
+         */
+        ARTBLD, 
+        /**
+         * An observation that reports the dilution of a sample.
+         */
+        DILUTION, 
+        /**
+         * The dilution of a sample performed by automated equipment.  The value is specified by the equipment
+         */
+        AUTOHIGH, 
+        /**
+         * The dilution of a sample performed by automated equipment.  The value is specified by the equipment
+         */
+        AUTOLOW, 
+        /**
+         * The dilution of the specimen made prior to being loaded onto analytical equipment
+         */
+        PRE, 
+        /**
+         * The value of the dilution of a sample after it had been analyzed at a prior dilution value
+         */
+        RERUN, 
+        /**
+         * Domain provides codes that qualify the ActLabObsEnvfctsCode domain. (Environmental Factors)
+         */
+        EVNFCTS, 
+        /**
+         * An observation that relates to factors that may potentially cause interference with the observation
+         */
+        INTFR, 
+        /**
+         * The Fibrin Index of the specimen. In the case of only differentiating between Absent and Present, recommend using 0 and 1
+         */
+        FIBRIN, 
+        /**
+         * An observation of the hemolysis index of the specimen in g/L
+         */
+        HEMOLYSIS, 
+        /**
+         * An observation that describes the icterus index of the specimen.  It is recommended to use mMol/L of bilirubin
+         */
+        ICTERUS, 
+        /**
+         * An observation used to describe the Lipemia Index of the specimen. It is recommended to use the optical turbidity at 600 nm (in absorbance units).
+         */
+        LIPEMIA, 
+        /**
+         * An observation that reports the volume of a sample.
+         */
+        VOLUME, 
+        /**
+         * The available quantity of specimen.   This is the current quantity minus any planned consumption (e.g., tests that are planned)
+         */
+        AVAILABLE, 
+        /**
+         * The quantity of specimen that is used each time the equipment uses this substance
+         */
+        CONSUMPTION, 
+        /**
+         * The current quantity of the specimen, i.e., initial quantity minus what has been actually used.
+         */
+        CURRENT, 
+        /**
+         * The initial quantity of the specimen in inventory
+         */
+        INITIAL, 
+        /**
+         * AnnotationType
+         */
+        _ANNOTATIONTYPE, 
+        /**
+         * Description:Provides a categorization for annotations recorded directly against the patient .
+         */
+        _ACTPATIENTANNOTATIONTYPE, 
+        /**
+         * Description:A note that is specific to a patient's diagnostic images, either historical, current or planned.
+         */
+        ANNDI, 
+        /**
+         * Description:A general or uncategorized note.
+         */
+        ANNGEN, 
+        /**
+         * A note that is specific to a patient's immunizations, either historical, current or planned.
+         */
+        ANNIMM, 
+        /**
+         * Description:A note that is specific to a patient's laboratory results, either historical, current or planned.
+         */
+        ANNLAB, 
+        /**
+         * Description:A note that is specific to a patient's medications, either historical, current or planned.
+         */
+        ANNMED, 
+        /**
+         * Description: None provided
+         */
+        _GENETICOBSERVATIONTYPE, 
+        /**
+         * Description: A DNA segment that contributes to phenotype/function. In the absence of demonstrated function a gene may be characterized by sequence, transcription or homology
+         */
+        GENE, 
+        /**
+         * Description: Observation codes which describe characteristics of the immunization material.
+         */
+        _IMMUNIZATIONOBSERVATIONTYPE, 
+        /**
+         * Description: Indicates the valid antigen count.
+         */
+        OBSANTC, 
+        /**
+         * Description: Indicates whether an antigen is valid or invalid.
+         */
+        OBSANTV, 
+        /**
+         * A code that is used to indicate the type of case safety report received from sender. The current code example reference is from the International Conference on Harmonisation (ICH) Expert Workgroup guideline on Clinical Safety Data Management: Data Elements for Transmission of Individual Case Safety Reports. The unknown/unavailable option allows the transmission of information from a secondary sender where the initial sender did not specify the type of report.
+
+                        Example concepts include: Spontaneous, Report from study, Other.
+         */
+        _INDIVIDUALCASESAFETYREPORTTYPE, 
+        /**
+         * Indicates that the ICSR is describing problems that a patient experienced after receiving a vaccine product.
+         */
+        PATADVEVNT, 
+        /**
+         * Indicates that the ICSR is describing a problem with the actual vaccine product such as physical defects (cloudy, particulate matter) or inability to confer immunity.
+         */
+        VACPROBLEM, 
+        /**
+         * Definition:The set of LOINC codes for the act of determining the period of time that has elapsed since an entity was born or created.
+         */
+        _LOINCOBSERVATIONACTCONTEXTAGETYPE, 
+        /**
+         * Definition:Estimated age.
+         */
+        _216119, 
+        /**
+         * Definition:Reported age.
+         */
+        _216127, 
+        /**
+         * Definition:Calculated age.
+         */
+        _295535, 
+        /**
+         * Definition:General specification of age with no implied method of determination.
+         */
+        _305250, 
+        /**
+         * Definition:Age at onset of associated adverse event; no implied method of determination.
+         */
+        _309724, 
+        /**
+         * MedicationObservationType
+         */
+        _MEDICATIONOBSERVATIONTYPE, 
+        /**
+         * Description:This observation represents an 'average' or 'expected' half-life typical of the product.
+         */
+        REPHALFLIFE, 
+        /**
+         * Definition: A characteristic of an oral solid dosage form of a medicinal product, indicating whether it has one or more coatings such as sugar coating, film coating, or enteric coating.  Only coatings to the external surface or the dosage form should be considered (for example, coatings to individual pellets or granules inside a capsule or tablet are excluded from consideration).
+
+                        
+                           Constraints: The Observation.value must be a Boolean (BL) with true for the presence or false for the absence of one or more coatings on a solid dosage form.
+         */
+        SPLCOATING, 
+        /**
+         * Definition:  A characteristic of an oral solid dosage form of a medicinal product, specifying the color or colors that most predominantly define the appearance of the dose form. SPLCOLOR is not an FDA specification for the actual color of solid dosage forms or the names of colors that can appear in labeling.
+
+                        
+                           Constraints: The Observation.value must be a single coded value or a list of multiple coded values, specifying one or more distinct colors that approximate of the color(s) of distinct areas of the solid dosage form, such as the different sides of a tablet or one-part capsule, or the different halves of a two-part capsule.  Bands on banded capsules, regardless of the color, are not considered when assigning an SPLCOLOR. Imprints on the dosage form, regardless of their color are not considered when assigning an SPLCOLOR. If more than one color exists on a particular side or half, then the most predominant color on that side or half is recorded.  If the gelatin capsule shell is colorless and transparent, use the predominant color of the contents that appears through the colorless and transparent capsule shell. Colors can include: Black;Gray;White;Red;Pink;Purple;Green;Yellow;Orange;Brown;Blue;Turquoise.
+         */
+        SPLCOLOR, 
+        /**
+         * Description: A characteristic representing a single file reference that contains two or more views of the same dosage form of the product; in most cases this should represent front and back views of the dosage form, but occasionally additional views might be needed in order to capture all of the important physical characteristics of the dosage form.  Any imprint and/or symbol should be clearly identifiable, and the viewer should not normally need to rotate the image in order to read it.  Images that are submitted with SPL should be included in the same directory as the SPL file.
+         */
+        SPLIMAGE, 
+        /**
+         * Definition:  A characteristic of an oral solid dosage form of a medicinal product, specifying the alphanumeric text that appears on the solid dosage form, including text that is embossed, debossed, engraved or printed with ink. The presence of other non-textual distinguishing marks or symbols is recorded by SPLSYMBOL.
+
+                        
+                           Examples: Included in SPLIMPRINT are alphanumeric text that appears on the bands of banded capsules and logos and other symbols that can be interpreted as letters or numbers.
+
+                        
+                           Constraints: The Observation.value must be of type Character String (ST). Excluded from SPLIMPRINT are internal and external cut-outs in the form of alphanumeric text and the letter 'R' with a circle around it (when referring to a registered trademark) and the letters 'TM' (when referring to a 'trade mark').  To record text, begin on either side or part of the dosage form. Start at the top left and progress as one would normally read a book.  Enter a semicolon to show separation between words or line divisions.
+         */
+        SPLIMPRINT, 
+        /**
+         * Definition: A characteristic of an oral solid dosage form of a medicinal product, specifying the number of equal pieces that the solid dosage form can be divided into using score line(s). 
+
+                        
+                           Example: One score line creating two equal pieces is given a value of 2, two parallel score lines creating three equal pieces is given a value of 3.
+
+                        
+                           Constraints: Whether three parallel score lines create four equal pieces or two intersecting score lines create two equal pieces using one score line and four equal pieces using both score lines, both have the scoring value of 4. Solid dosage forms that are not scored are given a value of 1. Solid dosage forms that can only be divided into unequal pieces are given a null-value with nullFlavor other (OTH).
+         */
+        SPLSCORING, 
+        /**
+         * Description: A characteristic of an oral solid dosage form of a medicinal product, specifying the two dimensional representation of the solid dose form, in terms of the outside perimeter of a solid dosage form when the dosage form, resting on a flat surface, is viewed from directly above, including slight rounding of corners. SPLSHAPE does not include embossing, scoring, debossing, or internal cut-outs.  SPLSHAPE is independent of the orientation of the imprint and logo. Shapes can include: Triangle (3 sided); Square; Round; Semicircle; Pentagon (5 sided); Diamond; Double circle; Bullet; Hexagon (6 sided); Rectangle; Gear; Capsule; Heptagon (7 sided); Trapezoid; Oval; Clover; Octagon (8 sided); Tear; Freeform.
+         */
+        SPLSHAPE, 
+        /**
+         * Definition: A characteristic of an oral solid dosage form of a medicinal product, specifying the longest single dimension of the solid dosage form as a physical quantity in the dimension of length (e.g., 3 mm). The length is should be specified in millimeters and should be rounded to the nearest whole millimeter.
+
+                        
+                           Example: SPLSIZE for a rectangular shaped tablet is the length and SPLSIZE for a round shaped tablet is the diameter.
+         */
+        SPLSIZE, 
+        /**
+         * Definition: A characteristic of an oral solid dosage form of a medicinal product, to describe whether or not the medicinal product has a mark or symbol appearing on it for easy and definite recognition.  Score lines, letters, numbers, and internal and external cut-outs are not considered marks or symbols. See SPLSCORING and SPLIMPRINT for these characteristics.
+
+                        
+                           Constraints: The Observation.value must be a Boolean (BL) with true indicating the presence and false for the absence of marks or symbols.
+
+                        
+                           Example:
+         */
+        SPLSYMBOL, 
+        /**
+         * Distinguishes the kinds of coded observations that could be the trigger for clinical issue detection. These are observations that are not measurable, but instead can be defined with codes. Coded observation types include: Allergy, Intolerance, Medical Condition, Pregnancy status, etc.
+         */
+        _OBSERVATIONISSUETRIGGERCODEDOBSERVATIONTYPE, 
+        /**
+         * Code for the mechanism by which disease was acquired by the living subject involved in the public health case. Includes sexually transmitted, airborne, bloodborne, vectorborne, foodborne, zoonotic, nosocomial, mechanical, dermal, congenital, environmental exposure, indeterminate.
+         */
+        _CASETRANSMISSIONMODE, 
+        /**
+         * Communication of an agent from a living subject or environmental source to a living subject through indirect contact via oral or nasal inhalation.
+         */
+        AIRTRNS, 
+        /**
+         * Communication of an agent from one animal to another proximate animal.
+         */
+        ANANTRNS, 
+        /**
+         * Communication of an agent from an animal to a proximate person.
+         */
+        ANHUMTRNS, 
+        /**
+         * Communication of an agent from one living subject to another living subject through direct contact with any body fluid.
+         */
+        BDYFLDTRNS, 
+        /**
+         * Communication of an agent to a living subject through direct contact with blood or blood products whether the contact with blood is part of  a therapeutic procedure or not.
+         */
+        BLDTRNS, 
+        /**
+         * Communication of an agent from a living subject or environmental source to a living subject via agent migration through intact skin.
+         */
+        DERMTRNS, 
+        /**
+         * Communication of an agent from an environmental surface or source to a living subject by direct contact.
+         */
+        ENVTRNS, 
+        /**
+         * Communication of an agent from a living subject or environmental source to a living subject through oral contact with material contaminated by person or animal fecal material.
+         */
+        FECTRNS, 
+        /**
+         * Communication of an agent from an non-living material to a living subject through direct contact.
+         */
+        FOMTRNS, 
+        /**
+         * Communication of an agent from a food source to a living subject via oral consumption.
+         */
+        FOODTRNS, 
+        /**
+         * Communication of an agent from a person to a proximate person.
+         */
+        HUMHUMTRNS, 
+        /**
+         * Communication of an agent to a living subject via an undetermined route.
+         */
+        INDTRNS, 
+        /**
+         * Communication of an agent from one living subject to another living subject through direct contact with mammalian milk or colostrum.
+         */
+        LACTTRNS, 
+        /**
+         * Communication of an agent from any entity to a living subject while the living subject is in the patient role in a healthcare facility.
+         */
+        NOSTRNS, 
+        /**
+         * Communication of an agent from a living subject or environmental source to a living subject where the acquisition of the agent is not via the alimentary canal.
+         */
+        PARTRNS, 
+        /**
+         * Communication of an agent from a living subject to the progeny of that living subject via agent migration across the maternal-fetal placental membranes while in utero.
+         */
+        PLACTRNS, 
+        /**
+         * Communication of an agent from one living subject to another living subject through direct contact with genital or oral tissues as part of a sexual act.
+         */
+        SEXTRNS, 
+        /**
+         * Communication of an agent from one living subject to another living subject through direct contact with blood or blood products where the contact with blood is part of  a therapeutic procedure.
+         */
+        TRNSFTRNS, 
+        /**
+         * Communication of an agent from a living subject acting as a required intermediary in the agent transmission process to a recipient living subject via direct contact.
+         */
+        VECTRNS, 
+        /**
+         * Communication of an agent from a contaminated water source to a living subject whether the water is ingested as a food or not. The route of entry of the water may be through any bodily orifice.
+         */
+        WATTRNS, 
+        /**
+         * Codes used to define various metadata aspects of a health quality measure.
+         */
+        _OBSERVATIONQUALITYMEASUREATTRIBUTE, 
+        /**
+         * Indicates that the observation is carrying out an aggregation calculation, contained in the value element.
+         */
+        AGGREGATE, 
+        /**
+         * Indicates what method is used in a quality measure to combine the component measure results included in an composite measure.
+         */
+        CMPMSRMTH, 
+        /**
+         * An attribute of a quality measure describing the weight this component measure score is to carry in determining the overall composite measure final score. The value is real value greater than 0 and less than 1.0. Each component measure score will be multiplied by its CMPMSRSCRWGHT and then summed with the other component measures to determine the final overall composite measure score. The sum across all CMPMSRSCRWGHT values within a single composite measure SHALL be 1.0. The value assigned is scoped to the composite measure referencing this component measure only.
+         */
+        CMPMSRSCRWGHT, 
+        /**
+         * Identifies the organization(s) who own the intellectual property represented by the eMeasure.
+         */
+        COPY, 
+        /**
+         * Summary of relevant clinical guidelines or other clinical recommendations supporting this eMeasure.
+         */
+        CRS, 
+        /**
+         * Description of individual terms, provided as needed.
+         */
+        DEF, 
+        /**
+         * Disclaimer information for the eMeasure.
+         */
+        DISC, 
+        /**
+         * The timestamp when the eMeasure was last packaged in the Measure Authoring Tool.
+         */
+        FINALDT, 
+        /**
+         * Used to allow measure developers to provide additional guidance for implementers to understand greater specificity than could be provided in the logic for data criteria.
+         */
+        GUIDE, 
+        /**
+         * Information on whether an increase or decrease in score is the preferred result 
+(e.g., a higher score indicates better quality OR a lower score indicates better quality OR quality is within a range).
+         */
+        IDUR, 
+        /**
+         * Describes the items counted by the measure (e.g., patients, encounters, procedures, etc.)
+         */
+        ITMCNT, 
+        /**
+         * A significant word that aids in discoverability.
+         */
+        KEY, 
+        /**
+         * The end date of the measurement period.
+         */
+        MEDT, 
+        /**
+         * The start date of the measurement period.
+         */
+        MSD, 
+        /**
+         * The method of adjusting for clinical severity and conditions present at the start of care that can influence patient outcomes for making valid comparisons of outcome measures across providers. Indicates whether an eMeasure is subject to the statistical process for reducing, removing, or clarifying the influences of confounding factors to allow more useful comparisons.
+         */
+        MSRADJ, 
+        /**
+         * Describes how to combine information calculated based on logic in each of several populations into one summarized result. It can also be used to describe how to risk adjust the data based on supplemental data elements described in the eMeasure. (e.g., pneumonia hospital measures antibiotic selection in the ICU versus non-ICU and then the roll-up of the two). 
+
+                        
+                           Open Issue: The description does NOT align well with the definition used in the HQMF specfication; correct the MSGAGG definition, and the possible distinction of MSRAGG as a child of AGGREGATE.
+         */
+        MSRAGG, 
+        /**
+         * Information on whether an increase or decrease in score is the preferred result. This should reflect information on which way is better, an increase or decrease in score.
+         */
+        MSRIMPROV, 
+        /**
+         * The list of jurisdiction(s) for which the measure applies.
+         */
+        MSRJUR, 
+        /**
+         * Type of person or organization that is expected to report the issue.
+         */
+        MSRRPTR, 
+        /**
+         * The maximum time that may elapse following completion of the measure until the measure report must be sent to the receiver.
+         */
+        MSRRPTTIME, 
+        /**
+         * Indicates how the calculation is performed for the eMeasure 
+(e.g., proportion, continuous variable, ratio)
+         */
+        MSRSCORE, 
+        /**
+         * Location(s) in which care being measured is rendered
+
+                        Usage Note: MSRSET is used rather than RoleCode because the setting applies to what is being measured, as opposed to participating directly in the health quality measure documantion itself).
+         */
+        MSRSET, 
+        /**
+         * health quality measure topic type
+         */
+        MSRTOPIC, 
+        /**
+         * The time period for which the eMeasure applies.
+         */
+        MSRTP, 
+        /**
+         * Indicates whether the eMeasure is used to examine a process or an outcome over time 
+(e.g., Structure, Process, Outcome).
+         */
+        MSRTYPE, 
+        /**
+         * Succinct statement of the need for the measure. Usually includes statements pertaining to Importance criterion: impact, gap in care and evidence.
+         */
+        RAT, 
+        /**
+         * Identifies bibliographic citations or references to clinical practice guidelines, sources of evidence, or other relevant materials supporting the intent and rationale of the eMeasure.
+         */
+        REF, 
+        /**
+         * Comparison of results across strata can be used to show where disparities exist or where there is a need to expose differences in results. For example, Centers for Medicare & Medicaid Services (CMS) in the U.S. defines four required Supplemental Data Elements (payer, ethnicity, race, and gender), which are variables used to aggregate data into various subgroups. Additional supplemental data elements required for risk adjustment or other purposes of data aggregation can be included in the Supplemental Data Element section.
+         */
+        SDE, 
+        /**
+         * Describes the strata for which the measure is to be evaluated. There are three examples of reasons for stratification based on existing work. These include: (1) evaluate the measure based on different age groupings within the population described in the measure (e.g., evaluate the whole [age 14-25] and each sub-stratum [14-19] and [20-25]); (2) evaluate the eMeasure based on either a specific condition, a specific discharge location, or both; (3) evaluate the eMeasure based on different locations within a facility (e.g., evaluate the overall rate for all intensive care units and also some strata include additional findings [specific birth weights for neonatal intensive care units]).
+         */
+        STRAT, 
+        /**
+         * Can be a URL or hyperlinks that link to the transmission formats that are specified for a particular reporting program.
+         */
+        TRANF, 
+        /**
+         * Usage notes.
+         */
+        USE, 
+        /**
+         * ObservationSequenceType
+         */
+        _OBSERVATIONSEQUENCETYPE, 
+        /**
+         * A sequence of values in the "absolute" time domain.  This is the same time domain that all HL7 timestamps use.  It is time as measured by the Gregorian calendar
+         */
+        TIMEABSOLUTE, 
+        /**
+         * A sequence of values in a "relative" time domain.  The time is measured relative to the earliest effective time in the Observation Series containing this sequence.
+         */
+        TIMERELATIVE, 
+        /**
+         * ObservationSeriesType
+         */
+        _OBSERVATIONSERIESTYPE, 
+        /**
+         * ECGObservationSeriesType
+         */
+        _ECGOBSERVATIONSERIESTYPE, 
+        /**
+         * This Observation Series type contains waveforms of a "representative beat" (a.k.a. "median beat" or "average beat").  The waveform samples are measured in relative time, relative to the beginning of the beat as defined by the Observation Series effective time.  The waveforms are not directly acquired from the subject, but rather algorithmically derived from the "rhythm" waveforms.
+         */
+        REPRESENTATIVEBEAT, 
+        /**
+         * This Observation type contains ECG "rhythm" waveforms.  The waveform samples are measured in absolute time (a.k.a. "subject time" or "effective time").  These waveforms are usually "raw" with some minimal amount of noise reduction and baseline filtering applied.
+         */
+        RHYTHM, 
+        /**
+         * Description: Reporting codes that are related to an immunization event.
+         */
+        _PATIENTIMMUNIZATIONRELATEDOBSERVATIONTYPE, 
+        /**
+         * Description: The class room associated with the patient during the immunization event.
+         */
+        CLSSRM, 
+        /**
+         * Description: The school grade or level the patient was in when immunized.
+         */
+        GRADE, 
+        /**
+         * Description: The school the patient attended when immunized.
+         */
+        SCHL, 
+        /**
+         * Description: The school division or district associated with the patient during the immunization event.
+         */
+        SCHLDIV, 
+        /**
+         * Description: The patient's teacher when immunized.
+         */
+        TEACHER, 
+        /**
+         * Observation types for specifying criteria used to assert that a subject is included in a particular population.
+         */
+        _POPULATIONINCLUSIONOBSERVATIONTYPE, 
+        /**
+         * Criteria which specify subjects who should be removed from the eMeasure population and denominator before determining if numerator criteria are met. Denominator exclusions are used in proportion and ratio measures to help narrow the denominator.
+         */
+        DENEX, 
+        /**
+         * Criteria which specify the removal of a subject, procedure or unit of measurement from the denominator, only if the numerator criteria are not met. Denominator exceptions allow for adjustment of the calculated score for those providers with higher risk populations. Denominator exceptions are used only in proportion eMeasures. They are not appropriate for ratio or continuous variable eMeasures. Denominator exceptions allow for the exercise of clinical judgment and should be specifically defined where capturing the information in a structured manner fits the clinical workflow. Generic denominator exception reasons used in proportion eMeasures fall into three general categories:
+
+                        
+                           Medical reasons
+                           Patient (or subject) reasons
+                           System reasons
+         */
+        DENEXCEP, 
+        /**
+         * Criteria for specifying the entities to be evaluated by a specific quality measure, based on a shared common set of characteristics (within a specific measurement set to which a given measure belongs).  The denominator can be the same as the initial population, or it may be a subset of the initial population to further constrain it for the purpose of the eMeasure. Different measures within an eMeasure set may have different denominators. Continuous Variable eMeasures do not have a denominator, but instead define a measure population.
+         */
+        DENOM, 
+        /**
+         * Criteria for specifying the entities to be evaluated by a specific quality measure, based on a shared common set of characteristics (within a specific measurement set to which a given measure belongs).
+         */
+        IPOP, 
+        /**
+         * Criteria for specifying the patients to be evaluated by a specific quality measure, based on a shared common set of characteristics (within a specific measurement set to which a given measure belongs). Details often include information based upon specific age groups, diagnoses, diagnostic and procedure codes, and enrollment periods.
+         */
+        IPPOP, 
+        /**
+         * Criteria for specifying
+the measure population as a narrative description (e.g., all patients seen in the Emergency Department during the measurement period).  This is used only in continuous variable eMeasures.
+         */
+        MSRPOPL, 
+        /**
+         * Criteria for specifying subjects who should be removed from the eMeasure's Initial Population and Measure Population. Measure Population Exclusions are used in Continuous Variable measures to help narrow the Measure Population before determining the value(s) of the continuous variable(s).
+         */
+        MSRPOPLEX, 
+        /**
+         * Criteria for specifying the processes or outcomes expected for each patient, procedure, or other unit of measurement defined in the denominator for proportion measures, or related to (but not directly derived from) the denominator for ratio measures (e.g., a numerator listing the number of central line blood stream infections and a denominator indicating the days per thousand of central line usage in a specific time period).
+         */
+        NUMER, 
+        /**
+         * Criteria for specifying instances that should not be included in the numerator data. (e.g., if the number of central line blood stream infections per 1000 catheter days were to exclude infections with a specific bacterium, that bacterium would be listed as a numerator exclusion).  Numerator Exclusions are used only in ratio eMeasures.
+         */
+        NUMEX, 
+        /**
+         * Types of observations that can be made about Preferences.
+         */
+        _PREFERENCEOBSERVATIONTYPE, 
+        /**
+         * An observation about how important a preference is to the target of the preference.
+         */
+        PREFSTRENGTH, 
+        /**
+         * Indicates that the observation is of an unexpected negative occurrence in the subject suspected to result from the subject's exposure to one or more agents.  Observation values would be the symptom resulting from the reaction.
+         */
+        ADVERSEREACTION, 
+        /**
+         * Description:Refines classCode OBS to indicate an observation in which observation.value contains a finding or other nominalized statement, where the encoded information in Observation.value is not altered by Observation.code.  For instance, observation.code="ASSERTION" and observation.value="fracture of femur present" is an assertion of a clinical finding of femur fracture.
+         */
+        ASSERTION, 
+        /**
+         * Definition:An observation that provides a characterization of the level of harm to an investigation subject as a result of a reaction or event.
+         */
+        CASESER, 
+        /**
+         * An observation that states whether the disease was likely acquired outside the jurisdiction of observation, and if so, the nature of the inter-jurisdictional relationship.
+
+                        
+                           OpenIssue: This code could be moved to LOINC if it can be done before there are significant implemenations using it.
+         */
+        CDIO, 
+        /**
+         * A clinical judgment as to the worst case result of a future exposure (including substance administration). When the worst case result is assessed to have a life-threatening or organ system threatening potential, it is considered to be of high criticality.
+         */
+        CRIT, 
+        /**
+         * An observation that states the mechanism by which disease was acquired by the living subject involved in the public health case.
+
+                        
+                           OpenIssue: This code could be moved to LOINC if it can be done before there are significant implemenations using it.
+         */
+        CTMO, 
+        /**
+         * Includes all codes defining types of indications such as diagnosis, symptom and other indications such as contrast agents for lab tests.
+         */
+        DX, 
+        /**
+         * Admitting diagnosis are the diagnoses documented  for administrative purposes as the basis for a hospital admission.
+         */
+        ADMDX, 
+        /**
+         * Discharge diagnosis are the diagnoses documented for administrative purposes as the time of hospital discharge.
+         */
+        DISDX, 
+        /**
+         * Intermediate diagnoses are those diagnoses documented for administrative purposes during the course of a hospital stay.
+         */
+        INTDX, 
+        /**
+         * The type of injury that the injury coding specifies.
+         */
+        NOI, 
+        /**
+         * Description: Accuracy determined as per the GIS tier code system.
+         */
+        GISTIER, 
+        /**
+         * Indicates that the observation is of a person’s living situation in a household including the household composition and circumstances.
+         */
+        HHOBS, 
+        /**
+         * There is a clinical issue for the therapy that makes continuation of the therapy inappropriate.
+
+                        
+                           Open Issue: The definition of this code does not correctly represent the concept space of its specializations (children)
+         */
+        ISSUE, 
+        /**
+         * Identifies types of detectyed issues for Act class "ALRT" for the administrative and patient administrative acts domains.
+         */
+        _ACTADMINISTRATIVEDETECTEDISSUECODE, 
+        /**
+         * ActAdministrativeAuthorizationDetectedIssueCode
+         */
+        _ACTADMINISTRATIVEAUTHORIZATIONDETECTEDISSUECODE, 
+        /**
+         * The requesting party has insufficient authorization to invoke the interaction.
+         */
+        NAT, 
+        /**
+         * Description: One or more records in the query response have been suppressed due to consent or privacy restrictions.
+         */
+        SUPPRESSED, 
+        /**
+         * Description:The specified element did not pass business-rule validation.
+         */
+        VALIDAT, 
+        /**
+         * The ID of the patient, order, etc., was not found. Used for transactions other than additions, e.g. transfer of a non-existent patient.
+         */
+        KEY204, 
+        /**
+         * The ID of the patient, order, etc., already exists. Used in response to addition transactions (Admit, New Order, etc.).
+         */
+        KEY205, 
+        /**
+         * There may be an issue with the patient complying with the intentions of the proposed therapy
+         */
+        COMPLY, 
+        /**
+         * The proposed therapy appears to duplicate an existing therapy
+         */
+        DUPTHPY, 
+        /**
+         * Description:The proposed therapy appears to have the same intended therapeutic benefit as an existing therapy, though the specific mechanisms of action vary.
+         */
+        DUPTHPCLS, 
+        /**
+         * Description:The proposed therapy appears to have the same intended therapeutic benefit as an existing therapy and uses the same mechanisms of action as the existing therapy.
+         */
+        DUPTHPGEN, 
+        /**
+         * Description:The proposed therapy is frequently misused or abused and therefore should be used with caution and/or monitoring.
+         */
+        ABUSE, 
+        /**
+         * Description:The request is suspected to have a fraudulent basis.
+         */
+        FRAUD, 
+        /**
+         * A similar or identical therapy was recently ordered by a different practitioner.
+         */
+        PLYDOC, 
+        /**
+         * This patient was recently supplied a similar or identical therapy from a different pharmacy or supplier.
+         */
+        PLYPHRM, 
+        /**
+         * Proposed dosage instructions for therapy differ from standard practice.
+         */
+        DOSE, 
+        /**
+         * Description:Proposed dosage is inappropriate due to patient's medical condition.
+         */
+        DOSECOND, 
+        /**
+         * Proposed length of therapy differs from standard practice.
+         */
+        DOSEDUR, 
+        /**
+         * Proposed length of therapy is longer than standard practice
+         */
+        DOSEDURH, 
+        /**
+         * Proposed length of therapy is longer than standard practice for the identified indication or diagnosis
+         */
+        DOSEDURHIND, 
+        /**
+         * Proposed length of therapy is shorter than that necessary for therapeutic effect
+         */
+        DOSEDURL, 
+        /**
+         * Proposed length of therapy is shorter than standard practice for the identified indication or diagnosis
+         */
+        DOSEDURLIND, 
+        /**
+         * Proposed dosage exceeds standard practice
+         */
+        DOSEH, 
+        /**
+         * Proposed dosage exceeds standard practice for the patient's age
+         */
+        DOSEHINDA, 
+        /**
+         * High Dose for Indication Alert
+         */
+        DOSEHIND, 
+        /**
+         * Proposed dosage exceeds standard practice for the patient's height or body surface area
+         */
+        DOSEHINDSA, 
+        /**
+         * Proposed dosage exceeds standard practice for the patient's weight
+         */
+        DOSEHINDW, 
+        /**
+         * Proposed dosage interval/timing differs from standard practice
+         */
+        DOSEIVL, 
+        /**
+         * Proposed dosage interval/timing differs from standard practice for the identified indication or diagnosis
+         */
+        DOSEIVLIND, 
+        /**
+         * Proposed dosage is below suggested therapeutic levels
+         */
+        DOSEL, 
+        /**
+         * Proposed dosage is below suggested therapeutic levels for the patient's age
+         */
+        DOSELINDA, 
+        /**
+         * Low Dose for Indication Alert
+         */
+        DOSELIND, 
+        /**
+         * Proposed dosage is below suggested therapeutic levels for the patient's height or body surface area
+         */
+        DOSELINDSA, 
+        /**
+         * Proposed dosage is below suggested therapeutic levels for the patient's weight
+         */
+        DOSELINDW, 
+        /**
+         * Description:The maximum quantity of this drug allowed to be administered within a particular time-range (month, year, lifetime) has been reached or exceeded.
+         */
+        MDOSE, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated due to conditions or characteristics of the patient
+         */
+        OBSA, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated due to patient age
+         */
+        AGE, 
+        /**
+         * Proposed therapy is outside of the standard practice for an adult patient.
+         */
+        ADALRT, 
+        /**
+         * Proposed therapy is outside of standard practice for a geriatric patient.
+         */
+        GEALRT, 
+        /**
+         * Proposed therapy is outside of the standard practice for a pediatric patient.
+         */
+        PEALRT, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated due to an existing/recent patient condition or diagnosis
+         */
+        COND, 
+        /**
+         * null
+         */
+        HGHT, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated when breast-feeding
+         */
+        LACT, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated during pregnancy
+         */
+        PREG, 
+        /**
+         * null
+         */
+        WGHT, 
+        /**
+         * Description:Proposed therapy may be inappropriate or contraindicated because of a common but non-patient specific reaction to the product.
+
+                        
+                           Example:There is no record of a specific sensitivity for the patient, but the presence of the sensitivity is common and therefore caution is warranted.
+         */
+        CREACT, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated due to patient genetic indicators.
+         */
+        GEN, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated due to patient gender.
+         */
+        GEND, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated due to recent lab test results
+         */
+        LAB, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated based on the potential for a patient reaction to the proposed product
+         */
+        REACT, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated because of a recorded patient allergy to the proposed product.  (Allergies are immune based reactions.)
+         */
+        ALGY, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated because of a recorded patient intolerance to the proposed product.  (Intolerances are non-immune based sensitivities.)
+         */
+        INT, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated because of a potential patient reaction to a cross-sensitivity related product.
+         */
+        RREACT, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated because of a recorded patient allergy to a cross-sensitivity related product.  (Allergies are immune based reactions.)
+         */
+        RALG, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated because of a recorded prior adverse reaction to a cross-sensitivity related product.
+         */
+        RAR, 
+        /**
+         * Proposed therapy may be inappropriate or contraindicated because of a recorded patient intolerance to a cross-sensitivity related product.  (Intolerances are non-immune based sensitivities.)
+         */
+        RINT, 
+        /**
+         * Description:A local business rule relating multiple elements has been violated.
+         */
+        BUS, 
+        /**
+         * Description:The specified code is not valid against the list of codes allowed for the element.
+         */
+        CODEINVAL, 
+        /**
+         * Description:The specified code has been deprecated and should no longer be used.  Select another code from the code system.
+         */
+        CODEDEPREC, 
+        /**
+         * Description:The element does not follow the formatting or type rules defined for the field.
+         */
+        FORMAT, 
+        /**
+         * Description:The request is missing elements or contains elements which cause it to not meet the legal standards for actioning.
+         */
+        ILLEGAL, 
+        /**
+         * Description:The length of the data specified falls out of the range defined for the element.
+         */
+        LENRANGE, 
+        /**
+         * Description:The length of the data specified is greater than the maximum length defined for the element.
+         */
+        LENLONG, 
+        /**
+         * Description:The length of the data specified is less than the minimum length defined for the element.
+         */
+        LENSHORT, 
+        /**
+         * Description:The specified element must be specified with a non-null value under certain conditions.  In this case, the conditions are true but the element is still missing or null.
+         */
+        MISSCOND, 
+        /**
+         * Description:The specified element is mandatory and was not included in the instance.
+         */
+        MISSMAND, 
+        /**
+         * Description:More than one element with the same value exists in the set.  Duplicates not permission in this set in a set.
+         */
+        NODUPS, 
+        /**
+         * Description: Element in submitted message will not persist in data storage based on detected issue.
+         */
+        NOPERSIST, 
+        /**
+         * Description:The number of repeating elements falls outside the range of the allowed number of repetitions.
+         */
+        REPRANGE, 
+        /**
+         * Description:The number of repeating elements is above the maximum number of repetitions allowed.
+         */
+        MAXOCCURS, 
+        /**
+         * Description:The number of repeating elements is below the minimum number of repetitions allowed.
+         */
+        MINOCCURS, 
+        /**
+         * ActAdministrativeRuleDetectedIssueCode
+         */
+        _ACTADMINISTRATIVERULEDETECTEDISSUECODE, 
+        /**
+         * Description: Metadata associated with the identification (e.g. name or gender) does not match the identification being verified.
+         */
+        KEY206, 
+        /**
+         * Description: One or more records in the query response have a status of 'obsolete'.
+         */
+        OBSOLETE, 
+        /**
+         * Identifies types of detected issues regarding the administration or supply of an item to a patient.
+         */
+        _ACTSUPPLIEDITEMDETECTEDISSUECODE, 
+        /**
+         * Administration of the proposed therapy may be inappropriate or contraindicated as proposed
+         */
+        _ADMINISTRATIONDETECTEDISSUECODE, 
+        /**
+         * AppropriatenessDetectedIssueCode
+         */
+        _APPROPRIATENESSDETECTEDISSUECODE, 
+        /**
+         * InteractionDetectedIssueCode
+         */
+        _INTERACTIONDETECTEDISSUECODE, 
+        /**
+         * Proposed therapy may interact with certain foods
+         */
+        FOOD, 
+        /**
+         * Proposed therapy may interact with an existing or recent therapeutic product
+         */
+        TPROD, 
+        /**
+         * Proposed therapy may interact with an existing or recent drug therapy
+         */
+        DRG, 
+        /**
+         * Proposed therapy may interact with existing or recent natural health product therapy
+         */
+        NHP, 
+        /**
+         * Proposed therapy may interact with a non-prescription drug (e.g. alcohol, tobacco, Aspirin)
+         */
+        NONRX, 
+        /**
+         * Definition:The same or similar treatment has previously been attempted with the patient without achieving a positive effect.
+         */
+        PREVINEF, 
+        /**
+         * Description:Proposed therapy may be contraindicated or ineffective based on an existing or recent drug therapy.
+         */
+        DACT, 
+        /**
+         * Description:Proposed therapy may be inappropriate or ineffective based on the proposed start or end time.
+         */
+        TIME, 
+        /**
+         * Definition:Proposed therapy may be inappropriate or ineffective because the end of administration is too close to another planned therapy.
+         */
+        ALRTENDLATE, 
+        /**
+         * Definition:Proposed therapy may be inappropriate or ineffective because the start of administration is too late after the onset of the condition.
+         */
+        ALRTSTRTLATE, 
+        /**
+         * Proposed therapy may be inappropriate or ineffective based on the proposed start or end time.
+         */
+        _TIMINGDETECTEDISSUECODE, 
+        /**
+         * Proposed therapy may be inappropriate or ineffective because the end of administration is too close to another planned therapy
+         */
+        ENDLATE, 
+        /**
+         * Proposed therapy may be inappropriate or ineffective because the start of administration is too late after the onset of the condition
+         */
+        STRTLATE, 
+        /**
+         * Supplying the product at this time may be inappropriate or indicate compliance issues with the associated therapy
+         */
+        _SUPPLYDETECTEDISSUECODE, 
+        /**
+         * Definition:The requested action has already been performed and so this request has no effect
+         */
+        ALLDONE, 
+        /**
+         * Definition:The therapy being performed is in some way out of alignment with the requested therapy.
+         */
+        FULFIL, 
+        /**
+         * Definition:The status of the request being fulfilled has changed such that it is no longer actionable.  This may be because the request has expired, has already been completely fulfilled or has been otherwise stopped or disabled.  (Not used for 'suspended' orders.)
+         */
+        NOTACTN, 
+        /**
+         * Definition:The therapy being performed is not sufficiently equivalent to the therapy which was requested.
+         */
+        NOTEQUIV, 
+        /**
+         * Definition:The therapy being performed is not generically equivalent (having the identical biological action) to the therapy which was requested.
+         */
+        NOTEQUIVGEN, 
+        /**
+         * Definition:The therapy being performed is not therapeutically equivalent (having the same overall patient effect) to the therapy which was requested.
+         */
+        NOTEQUIVTHER, 
+        /**
+         * Definition:The therapy is being performed at a time which diverges from the time the therapy was requested
+         */
+        TIMING, 
+        /**
+         * Definition:The therapy action is being performed outside the bounds of the time period requested
+         */
+        INTERVAL, 
+        /**
+         * Definition:The therapy action is being performed too soon after the previous occurrence based on the requested frequency
+         */
+        MINFREQ, 
+        /**
+         * Definition:There should be no actions taken in fulfillment of a request that has been held or suspended.
+         */
+        HELD, 
+        /**
+         * The patient is receiving a subsequent fill significantly later than would be expected based on the amount previously supplied and the therapy dosage instructions
+         */
+        TOOLATE, 
+        /**
+         * The patient is receiving a subsequent fill significantly earlier than would be expected based on the amount previously supplied and the therapy dosage instructions
+         */
+        TOOSOON, 
+        /**
+         * Description: While the record was accepted in the repository, there is a more recent version of a record of this type.
+         */
+        HISTORIC, 
+        /**
+         * Definition:The proposed therapy goes against preferences or consent constraints recorded in the patient's record.
+         */
+        PATPREF, 
+        /**
+         * Definition:The proposed therapy goes against preferences or consent constraints recorded in the patient's record.  An alternate therapy meeting those constraints is available.
+         */
+        PATPREFALT, 
+        /**
+         * Categorization of types of observation that capture the main clinical knowledge subject which may be a medication, a laboratory test, a disease.
+         */
+        KSUBJ, 
+        /**
+         * Categorization of types of observation that capture a knowledge subtopic which might be treatment, etiology, or prognosis.
+         */
+        KSUBT, 
+        /**
+         * Hypersensitivity resulting in an adverse reaction upon exposure to an agent.
+         */
+        OINT, 
+        /**
+         * Hypersensitivity to an agent caused by an immunologic response to an initial exposure
+         */
+        ALG, 
+        /**
+         * An allergy to a pharmaceutical product.
+         */
+        DALG, 
+        /**
+         * An allergy to a substance other than a drug or a food.  E.g. Latex, pollen, etc.
+         */
+        EALG, 
+        /**
+         * An allergy to a substance generally consumed for nutritional purposes.
+         */
+        FALG, 
+        /**
+         * Hypersensitivity resulting in an adverse reaction upon exposure to a drug.
+         */
+        DINT, 
+        /**
+         * Hypersensitivity to an agent caused by a mechanism other than an immunologic response to an initial exposure
+         */
+        DNAINT, 
+        /**
+         * Hypersensitivity resulting in an adverse reaction upon exposure to environmental conditions.
+         */
+        EINT, 
+        /**
+         * Hypersensitivity to an agent caused by a mechanism other than an immunologic response to an initial exposure
+         */
+        ENAINT, 
+        /**
+         * Hypersensitivity resulting in an adverse reaction upon exposure to food.
+         */
+        FINT, 
+        /**
+         * Hypersensitivity to an agent caused by a mechanism other than an immunologic response to an initial exposure
+         */
+        FNAINT, 
+        /**
+         * Hypersensitivity to an agent caused by a mechanism other than an immunologic response to an initial exposure
+         */
+        NAINT, 
+        /**
+         * A subjective evaluation of the seriousness or intensity associated with another observation.
+         */
+        SEV, 
+        /**
+         * FDA label data
+         */
+        _FDALABELDATA, 
+        /**
+         * FDA label coating
+         */
+        FDACOATING, 
+        /**
+         * FDA label color
+         */
+        FDACOLOR, 
+        /**
+         * FDA label imprint code
+         */
+        FDAIMPRINTCD, 
+        /**
+         * FDA label logo
+         */
+        FDALOGO, 
+        /**
+         * FDA label scoring
+         */
+        FDASCORING, 
+        /**
+         * FDA label shape
+         */
+        FDASHAPE, 
+        /**
+         * FDA label size
+         */
+        FDASIZE, 
+        /**
+         * Shape of the region on the object being referenced
+         */
+        _ROIOVERLAYSHAPE, 
+        /**
+         * A circle defined by two (column,row) pairs. The first point is the center of the circle and the second point is a point on the perimeter of the circle.
+         */
+        CIRCLE, 
+        /**
+         * An ellipse defined by four (column,row) pairs, the first two points specifying the endpoints of the major axis and the second two points specifying the endpoints of the minor axis.
+         */
+        ELLIPSE, 
+        /**
+         * A single point denoted by a single (column,row) pair, or multiple points each denoted by a (column,row) pair.
+         */
+        POINT, 
+        /**
+         * A series of connected line segments with ordered vertices denoted by (column,row) pairs; if the first and last vertices are the same, it is a closed polygon.
+         */
+        POLY, 
+        /**
+         * Description:Indicates that result data has been corrected.
+         */
+        C, 
+        /**
+         * Code set to define specialized/allowed diets
+         */
+        DIET, 
+        /**
+         * A diet exclusively composed of oatmeal, semolina, or rice, to be extremely easy to eat and digest.
+         */
+        BR, 
+        /**
+         * A diet that uses carbohydrates sparingly.  Typically with a restriction in daily energy content (e.g. 1600-2000 kcal).
+         */
+        DM, 
+        /**
+         * No enteral intake of foot or liquids  whatsoever, no smoking.  Typically 6 to 8 hours before anesthesia.
+         */
+        FAST, 
+        /**
+         * A diet consisting of a formula feeding, either for an infant or an adult, to provide nutrition either orally or through the gastrointestinal tract via tube, catheter or stoma.
+         */
+        FORMULA, 
+        /**
+         * Gluten free diet for celiac disease.
+         */
+        GF, 
+        /**
+         * A diet low in fat, particularly to patients with hepatic diseases.
+         */
+        LF, 
+        /**
+         * A low protein diet for patients with renal failure.
+         */
+        LP, 
+        /**
+         * A strictly liquid diet, that can be fully absorbed in the intestine, and therefore may not contain fiber.  Used before enteral surgeries.
+         */
+        LQ, 
+        /**
+         * A diet low in sodium for patients with congestive heart failure and/or renal failure.
+         */
+        LS, 
+        /**
+         * A normal diet, i.e. no special preparations or restrictions for medical reasons. This is notwithstanding any preferences the patient might have regarding special foods, such as vegetarian, kosher, etc.
+         */
+        N, 
+        /**
+         * A no fat diet for acute hepatic diseases.
+         */
+        NF, 
+        /**
+         * Phenylketonuria diet.
+         */
+        PAF, 
+        /**
+         * Patient is supplied with parenteral nutrition, typically described in terms of i.v. medications.
+         */
+        PAR, 
+        /**
+         * A diet that seeks to reduce body fat, typically low energy content (800-1600 kcal).
+         */
+        RD, 
+        /**
+         * A diet that avoids ingredients that might cause digestion problems, e.g., avoid excessive fat, avoid too much fiber (cabbage, peas, beans).
+         */
+        SCH, 
+        /**
+         * A diet that is not intended to be complete but is added to other diets.
+         */
+        SUPPLEMENT, 
+        /**
+         * This is not really a diet, since it contains little nutritional value, but is essentially just water.  Used before coloscopy examinations.
+         */
+        T, 
+        /**
+         * Diet with low content of the amino-acids valin, leucin, and isoleucin, for "maple syrup disease."
+         */
+        VLI, 
+        /**
+         * Definition: A public or government health program that administers and funds coverage for prescription drugs to assist program eligible who meet financial and health status criteria.
+         */
+        DRUGPRG, 
+        /**
+         * Description:Indicates that a result is complete.  No further results are to come.  This maps to the 'complete' state in the observation result status code.
+         */
+        F, 
+        /**
+         * Description:Indicates that a result is incomplete.  There are further results to come.  This maps to the 'active' state in the observation result status code.
+         */
+        PRLMN, 
+        /**
+         * An observation identifying security metadata about an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.  Security metadata are used to name security labels.  
+
+                        
+                           Rationale: According to ISO/TS 22600-3:2009(E) A.9.1.7 SECURITY LABEL MATCHING, Security label matching compares the initiator's clearance to the target's security label.  All of the following must be true for authorization to be granted:
+
+                        
+                           The security policy identifiers shall be identical
+                           The classification level of the initiator shall be greater than or equal to that of the target (that is, there shall be at least one value in the classification list of the clearance greater than or equal to the classification of the target), and 
+                           For each security category in the target label, there shall be a security category of the same type in the initiator's clearance and the initiator's classification level shall dominate that of the target.
+                        
+                        
+                           Examples: SecurityObservationType  security label fields include:
+
+                        
+                           Confidentiality classification
+                           Compartment category
+                           Sensitivity category
+                           Security mechanisms used to ensure data integrity or to perform authorized data transformation
+                           Indicators of an IT resource completeness, veracity, reliability, trustworthiness, or provenance.
+                        
+                        
+                           Usage Note: SecurityObservationType codes designate security label field types, which are valued with an applicable SecurityObservationValue code as the "security label tag".
+         */
+        SECOBS, 
+        /**
+         * Type of security metadata observation made about the category of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions. Security category metadata is defined by ISO/IEC 2382-8:1998(E/F)/ T-REC-X.812-1995 as: "A nonhierarchical grouping of sensitive information used to control access to data more finely than with hierarchical security classification alone."
+
+                        
+                           Rationale: A security category observation supports requirement to specify the type of IT resource to facilitate application of appropriate levels of information security according to a range of levels of impact or consequences that might result from the unauthorized disclosure, modification, or use of the information or information system.  A resource is assigned to a specific category of information (e.g., privacy, medical, proprietary, financial, investigative, contractor sensitive, security management) defined by an organization or in some instances, by a specific law, Executive Order, directive, policy, or regulation. [FIPS 199]
+
+                        
+                           Examples: Types of security categories include:
+
+                        
+                           Compartment:  A division of data into isolated blocks with separate security controls for the purpose of reducing risk. (ISO 2382-8).  A security label tag that "segments" an IT resource by indicating that access and use is restricted to members of a defined community or project. (HL7 Healthcare Classification System)  
+                           Sensitivity:  The characteristic of an IT resource which implies its value or importance and may include its vulnerability. (ISO 7492-2)  Privacy metadata for information perceived as undesirable to share.  (HL7 Healthcare Classification System)
+         */
+        SECCATOBS, 
+        /**
+         * Type of security metadata observation made about the classification of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.  Security classification is defined by ISO/IEC 2382-8:1998(E/F)/ T-REC-X.812-1995 as: "The determination of which specific degree of protection against access the data or information requires, together with a designation of that degree of protection."  Security classification metadata is based on an analysis of applicable policies and the risk of financial, reputational, or other harm that could result from unauthorized disclosure.
+
+                        
+                           Rationale: A security classification observation may indicate that the confidentiality level indicated by an Act or Role confidentiality attribute has been overridden by the entity responsible for ascribing the SecurityClassificationObservationValue.  This supports the business requirement for increasing or decreasing the level of confidentiality (classification or declassification) based on parameters beyond the original assignment of an Act or Role confidentiality.
+
+                        
+                           Examples: Types of security classification include: HL7 Confidentiality Codes such as very restricted, unrestricted, and normal.  Intelligence community examples include top secret, secret, and confidential.
+
+                        
+                           Usage Note: Security classification observation type codes designate security label field types, which are valued with an applicable SecurityClassificationObservationValue code as the "security label tag".
+         */
+        SECCLASSOBS, 
+        /**
+         * Type of security metadata observation made about the control of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.  Security control metadata convey instructions to users and receivers for secure distribution, transmission, and storage; dictate obligations or mandated actions; specify any action prohibited by refrain policy such as dissemination controls; and stipulate the permissible purpose of use of an IT resource.  
+
+                        
+                           Rationale: A security control observation supports requirement to specify applicable management, operational, and technical controls (i.e., safeguards or countermeasures) prescribed for an information system to protect the confidentiality, integrity, and availability of the system and its information. [FIPS 199]
+
+                        
+                           Examples: Types of security control metadata include: 
+
+                        
+                           handling caveats
+                           dissemination controls
+                           obligations
+                           refrain policies
+                           purpose of use constraints
+         */
+        SECCONOBS, 
+        /**
+         * Type of security metadata observation made about the integrity of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.
+
+                        
+                           Rationale: A security integrity observation supports the requirement to guard against improper information modification or destruction, and includes ensuring information non-repudiation and authenticity. (44 U.S.C., SEC. 3542)
+
+                        
+                           Examples: Types of security integrity metadata include: 
+
+                        
+                           Integrity status, which indicates the completeness or workflow status of an IT resource (data, information object, service, or system capability)
+                           Integrity confidence, which indicates the reliability and trustworthiness of an IT resource
+                           Integrity control, which indicates pertinent handling caveats, obligations, refrain policies, and purpose of use for  the resource
+                           Data integrity, which indicate the security mechanisms used to ensure that the accuracy and consistency are preserved regardless of changes made (ISO/IEC DIS 2382-8)
+                           Alteration integrity, which indicate the security mechanisms used for authorized transformations of the resource
+                           Integrity provenance, which indicates the entity responsible for a report or assertion relayed "second-hand" about an IT resource
+         */
+        SECINTOBS, 
+        /**
+         * Type of security metadata observation made about the alteration integrity of an IT resource (data, information object, service, or system capability), which indicates the mechanism used for authorized transformations of the resource.
+
+                        
+                           Examples: Types of security alteration integrity observation metadata, which may value the observation with a code used to indicate the mechanism used for authorized transformation of an IT resource, including: 
+
+                        
+                           translation
+                           syntactic transformation
+                           semantic mapping
+                           redaction
+                           masking
+                           pseudonymization
+                           anonymization
+         */
+        SECALTINTOBS, 
+        /**
+         * Type of security metadata observation made about the data integrity of an IT resource (data, information object, service, or system capability), which indicates the security mechanism used to preserve resource accuracy and consistency.  Data integrity is defined by ISO 22600-23.3.21 as: "The property that data has not been altered or destroyed in an unauthorized manner", and by ISO/IEC 2382-8:  The property of data whose accuracy and consistency are preserved regardless of changes made."
+
+                        
+                           Examples: Types of security data integrity observation metadata, which may value the observation, include cryptographic hash function and digital signature.
+         */
+        SECDATINTOBS, 
+        /**
+         * Type of security metadata observation made about the integrity confidence of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.
+
+                        
+                           Examples: Types of security integrity confidence observation metadata, which may value the observation, include highly reliable, uncertain reliability, and not reliable.
+
+                        
+                           Usage Note: A security integrity confidence observation on an Act may indicate that a valued Act.uncertaintycode attribute has been overridden by the entity responsible for ascribing the SecurityIntegrityConfidenceObservationValue.  This supports the business requirements for increasing or decreasing the assessment of the reliability or trustworthiness of an IT resource based on parameters beyond the original assignment of an Act statement level of uncertainty.
+         */
+        SECINTCONOBS, 
+        /**
+         * Type of security metadata observation made about the provenance integrity of an IT resource (data, information object, service, or system capability), which indicates the lifecycle completeness of an IT resource in terms of workflow status such as its creation, modification, suspension, and deletion; locations in which the resource has been collected or archived, from which it may be retrieved, and the history of its distribution and disclosure.  Integrity provenance metadata about an IT resource may be used to assess its veracity, reliability, and trustworthiness.
+
+                        
+                           Examples: Types of security integrity provenance observation metadata, which may value the observation about an IT resource, include: 
+
+                        
+                           completeness or workflow status, such as authentication
+                           the entity responsible for original authoring or informing about an IT resource
+                           the entity responsible for a report or assertion about an IT resource relayed “second-hand�
+                           the entity responsible for excerpting, transforming, or compiling an IT resource
+         */
+        SECINTPRVOBS, 
+        /**
+         * Type of security metadata observation made about the integrity provenance of an IT resource (data, information object, service, or system capability), which indicates the entity that made assertions about the resource.  The asserting entity may not be the original informant about the resource.
+
+                        
+                           Examples: Types of security integrity provenance asserted by observation metadata, which may value the observation, including: 
+
+                        
+                           assertions about an IT resource by a patient
+                           assertions about an IT resource by a clinician
+                           assertions about an IT resource by a device
+         */
+        SECINTPRVABOBS, 
+        /**
+         * Type of security metadata observation made about the integrity provenance of an IT resource (data, information object, service, or system capability), which indicates the entity that reported the existence of the resource.  The reporting entity may not be the original author of the resource.
+
+                        
+                           Examples: Types of security integrity provenance reported by observation metadata, which may value the observation, include: 
+
+                        
+                           reports about an IT resource by a patient
+                           reports about an IT resource by a clinician
+                           reports about an IT resource by a device
+         */
+        SECINTPRVRBOBS, 
+        /**
+         * Type of security metadata observation made about the integrity status of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.  Indicates the completeness of an IT resource in terms of workflow status, which may impact users that are authorized to access and use the resource.
+
+                        
+                           Examples: Types of security integrity status observation metadata, which may value the observation, include codes from the HL7 DocumentCompletion code system such as legally authenticated, in progress, and incomplete.
+         */
+        SECINTSTOBS, 
+        /**
+         * An observation identifying trust metadata about an IT resource (data, information object, service, or system capability), which may be used as a trust attribute to populate a computable trust policy, trust credential, trust assertion, or trust label field in a security label or trust policy, which are principally used for authentication, authorization, and access control decisions.
+         */
+        SECTRSTOBS, 
+        /**
+         * Type of security metadata observation made about the formal declaration by an authority or neutral third party that validates the technical, security, trust, and business practice conformance of Trust Agents to facilitate security, interoperability, and trust among participants within a security domain or trust framework.
+         */
+        TRSTACCRDOBS, 
+        /**
+         * Type of security metadata observation made about privacy and security requirements with which a security domain must comply. [ISO IEC 10181-1]
+         */
+        TRSTAGREOBS, 
+        /**
+         * Type of security metadata observation made about a set of security-relevant data issued by a security authority or trusted third party, together with security information which is used to provide the integrity and data origin authentication services for an IT resource (data, information object, service, or system capability). [Based on ISO IEC 10181-1]
+
+                        
+                           For example,
+                        
+
+                        
+                           A Certificate Policy (CP), which is a named set of rules that indicates the applicability of a certificate to a particular community and/or class of application with common security requirements. For example, a particular Certificate Policy might indicate the applicability of a type of certificate to the authentication of electronic data interchange transactions for the trading of goods within a given price range. [Trust Service Principles and Criteria for Certification Authorities Version 2.0 March 2011 Copyright 2011 by Canadian Institute of Chartered Accountants.
+                           A Certificate Practice Statement (CSP), which is a statement of the practices which an Authority employs in issuing and managing certificates. [Trust Service Principles and Criteria for Certification Authorities Version 2.0 March 2011 Copyright 2011 by Canadian Institute of Chartered Accountants.]
+         */
+        TRSTCERTOBS, 
+        /**
+         * Type of security metadata observation made about a complete set of contracts, regulations or commitments that enable participating actors to rely on certain assertions by other actors to fulfill their information security requirements. [Kantara Initiative]
+         */
+        TRSTFWKOBS, 
+        /**
+         * Type of security metadata observation made about the digital quality or reliability of a trust assertion, activity, capability, information exchange, mechanism, process, or protocol.
+         */
+        TRSTLOAOBS, 
+        /**
+         * Type of security metadata observation made about a security architecture system component that supports enforcement of security policies.
+         */
+        TRSTMECOBS, 
+        /**
+         * Definition: A government health program that provides coverage on a fee for service basis for health services to persons meeting eligibility criteria such as income, location of residence, access to other coverages, health condition, and age, the cost of which is to some extent subsidized by public funds.
+
+                        
+                           Discussion: The structure and business processes for underwriting and administering a subsidized fee for service program is further specified by the Underwriter and Payer Role.class and Role.code.
+         */
+        SUBSIDFFS, 
+        /**
+         * Definition: Government mandated program providing coverage, disability income, and vocational rehabilitation for injuries sustained in the work place or in the course of employment.  Employers may either self-fund the program, purchase commercial coverage, or pay a premium to a government entity that administers the program.  Employees may be required to pay premiums toward the cost of coverage as well.
+         */
+        WRKCOMP, 
+        /**
+         * An identifying code for healthcare interventions/procedures.
+         */
+        _ACTPROCEDURECODE, 
+        /**
+         * Definition: An identifying code for billable services, as opposed to codes for similar services used to identify them for functional purposes.
+         */
+        _ACTBILLABLESERVICECODE, 
+        /**
+         * Domain provides the root for HL7-defined detailed or rich codes for the Act classes.
+         */
+        _HL7DEFINEDACTCODES, 
+        /**
+         * null
+         */
+        COPAY, 
+        /**
+         * null
+         */
+        DEDUCT, 
+        /**
+         * null
+         */
+        DOSEIND, 
+        /**
+         * null
+         */
+        PRA, 
+        /**
+         * The act of putting something away for safe keeping. The "something" may be physical object such as a specimen, or information, such as observations regarding a specimen.
+         */
+        STORE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ActAccountCode".equals(codeString))
+          return _ACTACCOUNTCODE;
+        if ("ACCTRECEIVABLE".equals(codeString))
+          return ACCTRECEIVABLE;
+        if ("CASH".equals(codeString))
+          return CASH;
+        if ("CC".equals(codeString))
+          return CC;
+        if ("AE".equals(codeString))
+          return AE;
+        if ("DN".equals(codeString))
+          return DN;
+        if ("DV".equals(codeString))
+          return DV;
+        if ("MC".equals(codeString))
+          return MC;
+        if ("V".equals(codeString))
+          return V;
+        if ("PBILLACCT".equals(codeString))
+          return PBILLACCT;
+        if ("_ActAdjudicationCode".equals(codeString))
+          return _ACTADJUDICATIONCODE;
+        if ("_ActAdjudicationGroupCode".equals(codeString))
+          return _ACTADJUDICATIONGROUPCODE;
+        if ("CONT".equals(codeString))
+          return CONT;
+        if ("DAY".equals(codeString))
+          return DAY;
+        if ("LOC".equals(codeString))
+          return LOC;
+        if ("MONTH".equals(codeString))
+          return MONTH;
+        if ("PERIOD".equals(codeString))
+          return PERIOD;
+        if ("PROV".equals(codeString))
+          return PROV;
+        if ("WEEK".equals(codeString))
+          return WEEK;
+        if ("YEAR".equals(codeString))
+          return YEAR;
+        if ("AA".equals(codeString))
+          return AA;
+        if ("ANF".equals(codeString))
+          return ANF;
+        if ("AR".equals(codeString))
+          return AR;
+        if ("AS".equals(codeString))
+          return AS;
+        if ("_ActAdjudicationResultActionCode".equals(codeString))
+          return _ACTADJUDICATIONRESULTACTIONCODE;
+        if ("DISPLAY".equals(codeString))
+          return DISPLAY;
+        if ("FORM".equals(codeString))
+          return FORM;
+        if ("_ActBillableModifierCode".equals(codeString))
+          return _ACTBILLABLEMODIFIERCODE;
+        if ("CPTM".equals(codeString))
+          return CPTM;
+        if ("HCPCSA".equals(codeString))
+          return HCPCSA;
+        if ("_ActBillingArrangementCode".equals(codeString))
+          return _ACTBILLINGARRANGEMENTCODE;
+        if ("BLK".equals(codeString))
+          return BLK;
+        if ("CAP".equals(codeString))
+          return CAP;
+        if ("CONTF".equals(codeString))
+          return CONTF;
+        if ("FINBILL".equals(codeString))
+          return FINBILL;
+        if ("ROST".equals(codeString))
+          return ROST;
+        if ("SESS".equals(codeString))
+          return SESS;
+        if ("FFS".equals(codeString))
+          return FFS;
+        if ("FFPS".equals(codeString))
+          return FFPS;
+        if ("FFCS".equals(codeString))
+          return FFCS;
+        if ("TFS".equals(codeString))
+          return TFS;
+        if ("_ActBoundedROICode".equals(codeString))
+          return _ACTBOUNDEDROICODE;
+        if ("ROIFS".equals(codeString))
+          return ROIFS;
+        if ("ROIPS".equals(codeString))
+          return ROIPS;
+        if ("_ActCareProvisionCode".equals(codeString))
+          return _ACTCAREPROVISIONCODE;
+        if ("_ActCredentialedCareCode".equals(codeString))
+          return _ACTCREDENTIALEDCARECODE;
+        if ("_ActCredentialedCareProvisionPersonCode".equals(codeString))
+          return _ACTCREDENTIALEDCAREPROVISIONPERSONCODE;
+        if ("CACC".equals(codeString))
+          return CACC;
+        if ("CAIC".equals(codeString))
+          return CAIC;
+        if ("CAMC".equals(codeString))
+          return CAMC;
+        if ("CANC".equals(codeString))
+          return CANC;
+        if ("CAPC".equals(codeString))
+          return CAPC;
+        if ("CBGC".equals(codeString))
+          return CBGC;
+        if ("CCCC".equals(codeString))
+          return CCCC;
+        if ("CCGC".equals(codeString))
+          return CCGC;
+        if ("CCPC".equals(codeString))
+          return CCPC;
+        if ("CCSC".equals(codeString))
+          return CCSC;
+        if ("CDEC".equals(codeString))
+          return CDEC;
+        if ("CDRC".equals(codeString))
+          return CDRC;
+        if ("CEMC".equals(codeString))
+          return CEMC;
+        if ("CFPC".equals(codeString))
+          return CFPC;
+        if ("CIMC".equals(codeString))
+          return CIMC;
+        if ("CMGC".equals(codeString))
+          return CMGC;
+        if ("CNEC".equals(codeString))
+          return CNEC;
+        if ("CNMC".equals(codeString))
+          return CNMC;
+        if ("CNQC".equals(codeString))
+          return CNQC;
+        if ("CNSC".equals(codeString))
+          return CNSC;
+        if ("COGC".equals(codeString))
+          return COGC;
+        if ("COMC".equals(codeString))
+          return COMC;
+        if ("COPC".equals(codeString))
+          return COPC;
+        if ("COSC".equals(codeString))
+          return COSC;
+        if ("COTC".equals(codeString))
+          return COTC;
+        if ("CPEC".equals(codeString))
+          return CPEC;
+        if ("CPGC".equals(codeString))
+          return CPGC;
+        if ("CPHC".equals(codeString))
+          return CPHC;
+        if ("CPRC".equals(codeString))
+          return CPRC;
+        if ("CPSC".equals(codeString))
+          return CPSC;
+        if ("CPYC".equals(codeString))
+          return CPYC;
+        if ("CROC".equals(codeString))
+          return CROC;
+        if ("CRPC".equals(codeString))
+          return CRPC;
+        if ("CSUC".equals(codeString))
+          return CSUC;
+        if ("CTSC".equals(codeString))
+          return CTSC;
+        if ("CURC".equals(codeString))
+          return CURC;
+        if ("CVSC".equals(codeString))
+          return CVSC;
+        if ("LGPC".equals(codeString))
+          return LGPC;
+        if ("_ActCredentialedCareProvisionProgramCode".equals(codeString))
+          return _ACTCREDENTIALEDCAREPROVISIONPROGRAMCODE;
+        if ("AALC".equals(codeString))
+          return AALC;
+        if ("AAMC".equals(codeString))
+          return AAMC;
+        if ("ABHC".equals(codeString))
+          return ABHC;
+        if ("ACAC".equals(codeString))
+          return ACAC;
+        if ("ACHC".equals(codeString))
+          return ACHC;
+        if ("AHOC".equals(codeString))
+          return AHOC;
+        if ("ALTC".equals(codeString))
+          return ALTC;
+        if ("AOSC".equals(codeString))
+          return AOSC;
+        if ("CACS".equals(codeString))
+          return CACS;
+        if ("CAMI".equals(codeString))
+          return CAMI;
+        if ("CAST".equals(codeString))
+          return CAST;
+        if ("CBAR".equals(codeString))
+          return CBAR;
+        if ("CCAD".equals(codeString))
+          return CCAD;
+        if ("CCAR".equals(codeString))
+          return CCAR;
+        if ("CDEP".equals(codeString))
+          return CDEP;
+        if ("CDGD".equals(codeString))
+          return CDGD;
+        if ("CDIA".equals(codeString))
+          return CDIA;
+        if ("CEPI".equals(codeString))
+          return CEPI;
+        if ("CFEL".equals(codeString))
+          return CFEL;
+        if ("CHFC".equals(codeString))
+          return CHFC;
+        if ("CHRO".equals(codeString))
+          return CHRO;
+        if ("CHYP".equals(codeString))
+          return CHYP;
+        if ("CMIH".equals(codeString))
+          return CMIH;
+        if ("CMSC".equals(codeString))
+          return CMSC;
+        if ("COJR".equals(codeString))
+          return COJR;
+        if ("CONC".equals(codeString))
+          return CONC;
+        if ("COPD".equals(codeString))
+          return COPD;
+        if ("CORT".equals(codeString))
+          return CORT;
+        if ("CPAD".equals(codeString))
+          return CPAD;
+        if ("CPND".equals(codeString))
+          return CPND;
+        if ("CPST".equals(codeString))
+          return CPST;
+        if ("CSDM".equals(codeString))
+          return CSDM;
+        if ("CSIC".equals(codeString))
+          return CSIC;
+        if ("CSLD".equals(codeString))
+          return CSLD;
+        if ("CSPT".equals(codeString))
+          return CSPT;
+        if ("CTBU".equals(codeString))
+          return CTBU;
+        if ("CVDC".equals(codeString))
+          return CVDC;
+        if ("CWMA".equals(codeString))
+          return CWMA;
+        if ("CWOH".equals(codeString))
+          return CWOH;
+        if ("_ActEncounterCode".equals(codeString))
+          return _ACTENCOUNTERCODE;
+        if ("AMB".equals(codeString))
+          return AMB;
+        if ("EMER".equals(codeString))
+          return EMER;
+        if ("FLD".equals(codeString))
+          return FLD;
+        if ("HH".equals(codeString))
+          return HH;
+        if ("IMP".equals(codeString))
+          return IMP;
+        if ("ACUTE".equals(codeString))
+          return ACUTE;
+        if ("NONAC".equals(codeString))
+          return NONAC;
+        if ("PRENC".equals(codeString))
+          return PRENC;
+        if ("SS".equals(codeString))
+          return SS;
+        if ("VR".equals(codeString))
+          return VR;
+        if ("_ActMedicalServiceCode".equals(codeString))
+          return _ACTMEDICALSERVICECODE;
+        if ("ALC".equals(codeString))
+          return ALC;
+        if ("CARD".equals(codeString))
+          return CARD;
+        if ("CHR".equals(codeString))
+          return CHR;
+        if ("DNTL".equals(codeString))
+          return DNTL;
+        if ("DRGRHB".equals(codeString))
+          return DRGRHB;
+        if ("GENRL".equals(codeString))
+          return GENRL;
+        if ("MED".equals(codeString))
+          return MED;
+        if ("OBS".equals(codeString))
+          return OBS;
+        if ("ONC".equals(codeString))
+          return ONC;
+        if ("PALL".equals(codeString))
+          return PALL;
+        if ("PED".equals(codeString))
+          return PED;
+        if ("PHAR".equals(codeString))
+          return PHAR;
+        if ("PHYRHB".equals(codeString))
+          return PHYRHB;
+        if ("PSYCH".equals(codeString))
+          return PSYCH;
+        if ("SURG".equals(codeString))
+          return SURG;
+        if ("_ActClaimAttachmentCategoryCode".equals(codeString))
+          return _ACTCLAIMATTACHMENTCATEGORYCODE;
+        if ("AUTOATTCH".equals(codeString))
+          return AUTOATTCH;
+        if ("DOCUMENT".equals(codeString))
+          return DOCUMENT;
+        if ("HEALTHREC".equals(codeString))
+          return HEALTHREC;
+        if ("IMG".equals(codeString))
+          return IMG;
+        if ("LABRESULTS".equals(codeString))
+          return LABRESULTS;
+        if ("MODEL".equals(codeString))
+          return MODEL;
+        if ("WIATTCH".equals(codeString))
+          return WIATTCH;
+        if ("XRAY".equals(codeString))
+          return XRAY;
+        if ("_ActConsentType".equals(codeString))
+          return _ACTCONSENTTYPE;
+        if ("ICOL".equals(codeString))
+          return ICOL;
+        if ("IDSCL".equals(codeString))
+          return IDSCL;
+        if ("INFA".equals(codeString))
+          return INFA;
+        if ("INFAO".equals(codeString))
+          return INFAO;
+        if ("INFASO".equals(codeString))
+          return INFASO;
+        if ("IRDSCL".equals(codeString))
+          return IRDSCL;
+        if ("RESEARCH".equals(codeString))
+          return RESEARCH;
+        if ("RSDID".equals(codeString))
+          return RSDID;
+        if ("RSREID".equals(codeString))
+          return RSREID;
+        if ("_ActContainerRegistrationCode".equals(codeString))
+          return _ACTCONTAINERREGISTRATIONCODE;
+        if ("ID".equals(codeString))
+          return ID;
+        if ("IP".equals(codeString))
+          return IP;
+        if ("L".equals(codeString))
+          return L;
+        if ("M".equals(codeString))
+          return M;
+        if ("O".equals(codeString))
+          return O;
+        if ("R".equals(codeString))
+          return R;
+        if ("X".equals(codeString))
+          return X;
+        if ("_ActControlVariable".equals(codeString))
+          return _ACTCONTROLVARIABLE;
+        if ("AUTO".equals(codeString))
+          return AUTO;
+        if ("ENDC".equals(codeString))
+          return ENDC;
+        if ("REFLEX".equals(codeString))
+          return REFLEX;
+        if ("_ActCoverageConfirmationCode".equals(codeString))
+          return _ACTCOVERAGECONFIRMATIONCODE;
+        if ("_ActCoverageAuthorizationConfirmationCode".equals(codeString))
+          return _ACTCOVERAGEAUTHORIZATIONCONFIRMATIONCODE;
+        if ("AUTH".equals(codeString))
+          return AUTH;
+        if ("NAUTH".equals(codeString))
+          return NAUTH;
+        if ("_ActCoverageEligibilityConfirmationCode".equals(codeString))
+          return _ACTCOVERAGEELIGIBILITYCONFIRMATIONCODE;
+        if ("ELG".equals(codeString))
+          return ELG;
+        if ("NELG".equals(codeString))
+          return NELG;
+        if ("_ActCoverageLimitCode".equals(codeString))
+          return _ACTCOVERAGELIMITCODE;
+        if ("_ActCoverageQuantityLimitCode".equals(codeString))
+          return _ACTCOVERAGEQUANTITYLIMITCODE;
+        if ("COVPRD".equals(codeString))
+          return COVPRD;
+        if ("LFEMX".equals(codeString))
+          return LFEMX;
+        if ("NETAMT".equals(codeString))
+          return NETAMT;
+        if ("PRDMX".equals(codeString))
+          return PRDMX;
+        if ("UNITPRICE".equals(codeString))
+          return UNITPRICE;
+        if ("UNITQTY".equals(codeString))
+          return UNITQTY;
+        if ("COVMX".equals(codeString))
+          return COVMX;
+        if ("_ActCoveredPartyLimitCode".equals(codeString))
+          return _ACTCOVEREDPARTYLIMITCODE;
+        if ("_ActCoverageTypeCode".equals(codeString))
+          return _ACTCOVERAGETYPECODE;
+        if ("_ActInsurancePolicyCode".equals(codeString))
+          return _ACTINSURANCEPOLICYCODE;
+        if ("EHCPOL".equals(codeString))
+          return EHCPOL;
+        if ("HSAPOL".equals(codeString))
+          return HSAPOL;
+        if ("AUTOPOL".equals(codeString))
+          return AUTOPOL;
+        if ("COL".equals(codeString))
+          return COL;
+        if ("UNINSMOT".equals(codeString))
+          return UNINSMOT;
+        if ("PUBLICPOL".equals(codeString))
+          return PUBLICPOL;
+        if ("DENTPRG".equals(codeString))
+          return DENTPRG;
+        if ("DISEASEPRG".equals(codeString))
+          return DISEASEPRG;
+        if ("CANPRG".equals(codeString))
+          return CANPRG;
+        if ("ENDRENAL".equals(codeString))
+          return ENDRENAL;
+        if ("HIVAIDS".equals(codeString))
+          return HIVAIDS;
+        if ("MANDPOL".equals(codeString))
+          return MANDPOL;
+        if ("MENTPRG".equals(codeString))
+          return MENTPRG;
+        if ("SAFNET".equals(codeString))
+          return SAFNET;
+        if ("SUBPRG".equals(codeString))
+          return SUBPRG;
+        if ("SUBSIDIZ".equals(codeString))
+          return SUBSIDIZ;
+        if ("SUBSIDMC".equals(codeString))
+          return SUBSIDMC;
+        if ("SUBSUPP".equals(codeString))
+          return SUBSUPP;
+        if ("WCBPOL".equals(codeString))
+          return WCBPOL;
+        if ("_ActInsuranceTypeCode".equals(codeString))
+          return _ACTINSURANCETYPECODE;
+        if ("_ActHealthInsuranceTypeCode".equals(codeString))
+          return _ACTHEALTHINSURANCETYPECODE;
+        if ("DENTAL".equals(codeString))
+          return DENTAL;
+        if ("DISEASE".equals(codeString))
+          return DISEASE;
+        if ("DRUGPOL".equals(codeString))
+          return DRUGPOL;
+        if ("HIP".equals(codeString))
+          return HIP;
+        if ("LTC".equals(codeString))
+          return LTC;
+        if ("MCPOL".equals(codeString))
+          return MCPOL;
+        if ("POS".equals(codeString))
+          return POS;
+        if ("HMO".equals(codeString))
+          return HMO;
+        if ("PPO".equals(codeString))
+          return PPO;
+        if ("MENTPOL".equals(codeString))
+          return MENTPOL;
+        if ("SUBPOL".equals(codeString))
+          return SUBPOL;
+        if ("VISPOL".equals(codeString))
+          return VISPOL;
+        if ("DIS".equals(codeString))
+          return DIS;
+        if ("EWB".equals(codeString))
+          return EWB;
+        if ("FLEXP".equals(codeString))
+          return FLEXP;
+        if ("LIFE".equals(codeString))
+          return LIFE;
+        if ("ANNU".equals(codeString))
+          return ANNU;
+        if ("TLIFE".equals(codeString))
+          return TLIFE;
+        if ("ULIFE".equals(codeString))
+          return ULIFE;
+        if ("PNC".equals(codeString))
+          return PNC;
+        if ("REI".equals(codeString))
+          return REI;
+        if ("SURPL".equals(codeString))
+          return SURPL;
+        if ("UMBRL".equals(codeString))
+          return UMBRL;
+        if ("_ActProgramTypeCode".equals(codeString))
+          return _ACTPROGRAMTYPECODE;
+        if ("CHAR".equals(codeString))
+          return CHAR;
+        if ("CRIME".equals(codeString))
+          return CRIME;
+        if ("EAP".equals(codeString))
+          return EAP;
+        if ("GOVEMP".equals(codeString))
+          return GOVEMP;
+        if ("HIRISK".equals(codeString))
+          return HIRISK;
+        if ("IND".equals(codeString))
+          return IND;
+        if ("MILITARY".equals(codeString))
+          return MILITARY;
+        if ("RETIRE".equals(codeString))
+          return RETIRE;
+        if ("SOCIAL".equals(codeString))
+          return SOCIAL;
+        if ("VET".equals(codeString))
+          return VET;
+        if ("_ActDetectedIssueManagementCode".equals(codeString))
+          return _ACTDETECTEDISSUEMANAGEMENTCODE;
+        if ("_ActAdministrativeDetectedIssueManagementCode".equals(codeString))
+          return _ACTADMINISTRATIVEDETECTEDISSUEMANAGEMENTCODE;
+        if ("_AuthorizationIssueManagementCode".equals(codeString))
+          return _AUTHORIZATIONISSUEMANAGEMENTCODE;
+        if ("EMAUTH".equals(codeString))
+          return EMAUTH;
+        if ("21".equals(codeString))
+          return _21;
+        if ("1".equals(codeString))
+          return _1;
+        if ("19".equals(codeString))
+          return _19;
+        if ("2".equals(codeString))
+          return _2;
+        if ("22".equals(codeString))
+          return _22;
+        if ("23".equals(codeString))
+          return _23;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("6".equals(codeString))
+          return _6;
+        if ("7".equals(codeString))
+          return _7;
+        if ("14".equals(codeString))
+          return _14;
+        if ("15".equals(codeString))
+          return _15;
+        if ("16".equals(codeString))
+          return _16;
+        if ("17".equals(codeString))
+          return _17;
+        if ("18".equals(codeString))
+          return _18;
+        if ("20".equals(codeString))
+          return _20;
+        if ("8".equals(codeString))
+          return _8;
+        if ("10".equals(codeString))
+          return _10;
+        if ("11".equals(codeString))
+          return _11;
+        if ("12".equals(codeString))
+          return _12;
+        if ("13".equals(codeString))
+          return _13;
+        if ("9".equals(codeString))
+          return _9;
+        if ("_ActExposureCode".equals(codeString))
+          return _ACTEXPOSURECODE;
+        if ("CHLDCARE".equals(codeString))
+          return CHLDCARE;
+        if ("CONVEYNC".equals(codeString))
+          return CONVEYNC;
+        if ("HLTHCARE".equals(codeString))
+          return HLTHCARE;
+        if ("HOMECARE".equals(codeString))
+          return HOMECARE;
+        if ("HOSPPTNT".equals(codeString))
+          return HOSPPTNT;
+        if ("HOSPVSTR".equals(codeString))
+          return HOSPVSTR;
+        if ("HOUSEHLD".equals(codeString))
+          return HOUSEHLD;
+        if ("INMATE".equals(codeString))
+          return INMATE;
+        if ("INTIMATE".equals(codeString))
+          return INTIMATE;
+        if ("LTRMCARE".equals(codeString))
+          return LTRMCARE;
+        if ("PLACE".equals(codeString))
+          return PLACE;
+        if ("PTNTCARE".equals(codeString))
+          return PTNTCARE;
+        if ("SCHOOL2".equals(codeString))
+          return SCHOOL2;
+        if ("SOCIAL2".equals(codeString))
+          return SOCIAL2;
+        if ("SUBSTNCE".equals(codeString))
+          return SUBSTNCE;
+        if ("TRAVINT".equals(codeString))
+          return TRAVINT;
+        if ("WORK2".equals(codeString))
+          return WORK2;
+        if ("_ActFinancialTransactionCode".equals(codeString))
+          return _ACTFINANCIALTRANSACTIONCODE;
+        if ("CHRG".equals(codeString))
+          return CHRG;
+        if ("REV".equals(codeString))
+          return REV;
+        if ("_ActIncidentCode".equals(codeString))
+          return _ACTINCIDENTCODE;
+        if ("MVA".equals(codeString))
+          return MVA;
+        if ("SCHOOL".equals(codeString))
+          return SCHOOL;
+        if ("SPT".equals(codeString))
+          return SPT;
+        if ("WPA".equals(codeString))
+          return WPA;
+        if ("_ActInformationAccessCode".equals(codeString))
+          return _ACTINFORMATIONACCESSCODE;
+        if ("ACADR".equals(codeString))
+          return ACADR;
+        if ("ACALL".equals(codeString))
+          return ACALL;
+        if ("ACALLG".equals(codeString))
+          return ACALLG;
+        if ("ACCONS".equals(codeString))
+          return ACCONS;
+        if ("ACDEMO".equals(codeString))
+          return ACDEMO;
+        if ("ACDI".equals(codeString))
+          return ACDI;
+        if ("ACIMMUN".equals(codeString))
+          return ACIMMUN;
+        if ("ACLAB".equals(codeString))
+          return ACLAB;
+        if ("ACMED".equals(codeString))
+          return ACMED;
+        if ("ACMEDC".equals(codeString))
+          return ACMEDC;
+        if ("ACMEN".equals(codeString))
+          return ACMEN;
+        if ("ACOBS".equals(codeString))
+          return ACOBS;
+        if ("ACPOLPRG".equals(codeString))
+          return ACPOLPRG;
+        if ("ACPROV".equals(codeString))
+          return ACPROV;
+        if ("ACPSERV".equals(codeString))
+          return ACPSERV;
+        if ("ACSUBSTAB".equals(codeString))
+          return ACSUBSTAB;
+        if ("_ActInformationAccessContextCode".equals(codeString))
+          return _ACTINFORMATIONACCESSCONTEXTCODE;
+        if ("INFAUT".equals(codeString))
+          return INFAUT;
+        if ("INFCON".equals(codeString))
+          return INFCON;
+        if ("INFCRT".equals(codeString))
+          return INFCRT;
+        if ("INFDNG".equals(codeString))
+          return INFDNG;
+        if ("INFEMER".equals(codeString))
+          return INFEMER;
+        if ("INFPWR".equals(codeString))
+          return INFPWR;
+        if ("INFREG".equals(codeString))
+          return INFREG;
+        if ("_ActInformationCategoryCode".equals(codeString))
+          return _ACTINFORMATIONCATEGORYCODE;
+        if ("ALLCAT".equals(codeString))
+          return ALLCAT;
+        if ("ALLGCAT".equals(codeString))
+          return ALLGCAT;
+        if ("ARCAT".equals(codeString))
+          return ARCAT;
+        if ("COBSCAT".equals(codeString))
+          return COBSCAT;
+        if ("DEMOCAT".equals(codeString))
+          return DEMOCAT;
+        if ("DICAT".equals(codeString))
+          return DICAT;
+        if ("IMMUCAT".equals(codeString))
+          return IMMUCAT;
+        if ("LABCAT".equals(codeString))
+          return LABCAT;
+        if ("MEDCCAT".equals(codeString))
+          return MEDCCAT;
+        if ("MENCAT".equals(codeString))
+          return MENCAT;
+        if ("PSVCCAT".equals(codeString))
+          return PSVCCAT;
+        if ("RXCAT".equals(codeString))
+          return RXCAT;
+        if ("_ActInvoiceElementCode".equals(codeString))
+          return _ACTINVOICEELEMENTCODE;
+        if ("_ActInvoiceAdjudicationPaymentCode".equals(codeString))
+          return _ACTINVOICEADJUDICATIONPAYMENTCODE;
+        if ("_ActInvoiceAdjudicationPaymentGroupCode".equals(codeString))
+          return _ACTINVOICEADJUDICATIONPAYMENTGROUPCODE;
+        if ("ALEC".equals(codeString))
+          return ALEC;
+        if ("BONUS".equals(codeString))
+          return BONUS;
+        if ("CFWD".equals(codeString))
+          return CFWD;
+        if ("EDU".equals(codeString))
+          return EDU;
+        if ("EPYMT".equals(codeString))
+          return EPYMT;
+        if ("GARN".equals(codeString))
+          return GARN;
+        if ("INVOICE".equals(codeString))
+          return INVOICE;
+        if ("PINV".equals(codeString))
+          return PINV;
+        if ("PPRD".equals(codeString))
+          return PPRD;
+        if ("PROA".equals(codeString))
+          return PROA;
+        if ("RECOV".equals(codeString))
+          return RECOV;
+        if ("RETRO".equals(codeString))
+          return RETRO;
+        if ("TRAN".equals(codeString))
+          return TRAN;
+        if ("_ActInvoiceAdjudicationPaymentSummaryCode".equals(codeString))
+          return _ACTINVOICEADJUDICATIONPAYMENTSUMMARYCODE;
+        if ("INVTYPE".equals(codeString))
+          return INVTYPE;
+        if ("PAYEE".equals(codeString))
+          return PAYEE;
+        if ("PAYOR".equals(codeString))
+          return PAYOR;
+        if ("SENDAPP".equals(codeString))
+          return SENDAPP;
+        if ("_ActInvoiceDetailCode".equals(codeString))
+          return _ACTINVOICEDETAILCODE;
+        if ("_ActInvoiceDetailClinicalProductCode".equals(codeString))
+          return _ACTINVOICEDETAILCLINICALPRODUCTCODE;
+        if ("UNSPSC".equals(codeString))
+          return UNSPSC;
+        if ("_ActInvoiceDetailDrugProductCode".equals(codeString))
+          return _ACTINVOICEDETAILDRUGPRODUCTCODE;
+        if ("GTIN".equals(codeString))
+          return GTIN;
+        if ("UPC".equals(codeString))
+          return UPC;
+        if ("_ActInvoiceDetailGenericCode".equals(codeString))
+          return _ACTINVOICEDETAILGENERICCODE;
+        if ("_ActInvoiceDetailGenericAdjudicatorCode".equals(codeString))
+          return _ACTINVOICEDETAILGENERICADJUDICATORCODE;
+        if ("COIN".equals(codeString))
+          return COIN;
+        if ("COPAYMENT".equals(codeString))
+          return COPAYMENT;
+        if ("DEDUCTIBLE".equals(codeString))
+          return DEDUCTIBLE;
+        if ("PAY".equals(codeString))
+          return PAY;
+        if ("SPEND".equals(codeString))
+          return SPEND;
+        if ("COINS".equals(codeString))
+          return COINS;
+        if ("_ActInvoiceDetailGenericModifierCode".equals(codeString))
+          return _ACTINVOICEDETAILGENERICMODIFIERCODE;
+        if ("AFTHRS".equals(codeString))
+          return AFTHRS;
+        if ("ISOL".equals(codeString))
+          return ISOL;
+        if ("OOO".equals(codeString))
+          return OOO;
+        if ("_ActInvoiceDetailGenericProviderCode".equals(codeString))
+          return _ACTINVOICEDETAILGENERICPROVIDERCODE;
+        if ("CANCAPT".equals(codeString))
+          return CANCAPT;
+        if ("DSC".equals(codeString))
+          return DSC;
+        if ("ESA".equals(codeString))
+          return ESA;
+        if ("FFSTOP".equals(codeString))
+          return FFSTOP;
+        if ("FNLFEE".equals(codeString))
+          return FNLFEE;
+        if ("FRSTFEE".equals(codeString))
+          return FRSTFEE;
+        if ("MARKUP".equals(codeString))
+          return MARKUP;
+        if ("MISSAPT".equals(codeString))
+          return MISSAPT;
+        if ("PERFEE".equals(codeString))
+          return PERFEE;
+        if ("PERMBNS".equals(codeString))
+          return PERMBNS;
+        if ("RESTOCK".equals(codeString))
+          return RESTOCK;
+        if ("TRAVEL".equals(codeString))
+          return TRAVEL;
+        if ("URGENT".equals(codeString))
+          return URGENT;
+        if ("_ActInvoiceDetailTaxCode".equals(codeString))
+          return _ACTINVOICEDETAILTAXCODE;
+        if ("FST".equals(codeString))
+          return FST;
+        if ("HST".equals(codeString))
+          return HST;
+        if ("PST".equals(codeString))
+          return PST;
+        if ("_ActInvoiceDetailPreferredAccommodationCode".equals(codeString))
+          return _ACTINVOICEDETAILPREFERREDACCOMMODATIONCODE;
+        if ("_ActEncounterAccommodationCode".equals(codeString))
+          return _ACTENCOUNTERACCOMMODATIONCODE;
+        if ("_HL7AccommodationCode".equals(codeString))
+          return _HL7ACCOMMODATIONCODE;
+        if ("I".equals(codeString))
+          return I;
+        if ("P".equals(codeString))
+          return P;
+        if ("S".equals(codeString))
+          return S;
+        if ("SP".equals(codeString))
+          return SP;
+        if ("W".equals(codeString))
+          return W;
+        if ("_ActInvoiceDetailClinicalServiceCode".equals(codeString))
+          return _ACTINVOICEDETAILCLINICALSERVICECODE;
+        if ("_ActInvoiceGroupCode".equals(codeString))
+          return _ACTINVOICEGROUPCODE;
+        if ("_ActInvoiceInterGroupCode".equals(codeString))
+          return _ACTINVOICEINTERGROUPCODE;
+        if ("CPNDDRGING".equals(codeString))
+          return CPNDDRGING;
+        if ("CPNDINDING".equals(codeString))
+          return CPNDINDING;
+        if ("CPNDSUPING".equals(codeString))
+          return CPNDSUPING;
+        if ("DRUGING".equals(codeString))
+          return DRUGING;
+        if ("FRAMEING".equals(codeString))
+          return FRAMEING;
+        if ("LENSING".equals(codeString))
+          return LENSING;
+        if ("PRDING".equals(codeString))
+          return PRDING;
+        if ("_ActInvoiceRootGroupCode".equals(codeString))
+          return _ACTINVOICEROOTGROUPCODE;
+        if ("CPINV".equals(codeString))
+          return CPINV;
+        if ("CSINV".equals(codeString))
+          return CSINV;
+        if ("CSPINV".equals(codeString))
+          return CSPINV;
+        if ("FININV".equals(codeString))
+          return FININV;
+        if ("OHSINV".equals(codeString))
+          return OHSINV;
+        if ("PAINV".equals(codeString))
+          return PAINV;
+        if ("RXCINV".equals(codeString))
+          return RXCINV;
+        if ("RXDINV".equals(codeString))
+          return RXDINV;
+        if ("SBFINV".equals(codeString))
+          return SBFINV;
+        if ("VRXINV".equals(codeString))
+          return VRXINV;
+        if ("_ActInvoiceElementSummaryCode".equals(codeString))
+          return _ACTINVOICEELEMENTSUMMARYCODE;
+        if ("_InvoiceElementAdjudicated".equals(codeString))
+          return _INVOICEELEMENTADJUDICATED;
+        if ("ADNFPPELAT".equals(codeString))
+          return ADNFPPELAT;
+        if ("ADNFPPELCT".equals(codeString))
+          return ADNFPPELCT;
+        if ("ADNFPPMNAT".equals(codeString))
+          return ADNFPPMNAT;
+        if ("ADNFPPMNCT".equals(codeString))
+          return ADNFPPMNCT;
+        if ("ADNFSPELAT".equals(codeString))
+          return ADNFSPELAT;
+        if ("ADNFSPELCT".equals(codeString))
+          return ADNFSPELCT;
+        if ("ADNFSPMNAT".equals(codeString))
+          return ADNFSPMNAT;
+        if ("ADNFSPMNCT".equals(codeString))
+          return ADNFSPMNCT;
+        if ("ADNPPPELAT".equals(codeString))
+          return ADNPPPELAT;
+        if ("ADNPPPELCT".equals(codeString))
+          return ADNPPPELCT;
+        if ("ADNPPPMNAT".equals(codeString))
+          return ADNPPPMNAT;
+        if ("ADNPPPMNCT".equals(codeString))
+          return ADNPPPMNCT;
+        if ("ADNPSPELAT".equals(codeString))
+          return ADNPSPELAT;
+        if ("ADNPSPELCT".equals(codeString))
+          return ADNPSPELCT;
+        if ("ADNPSPMNAT".equals(codeString))
+          return ADNPSPMNAT;
+        if ("ADNPSPMNCT".equals(codeString))
+          return ADNPSPMNCT;
+        if ("ADPPPPELAT".equals(codeString))
+          return ADPPPPELAT;
+        if ("ADPPPPELCT".equals(codeString))
+          return ADPPPPELCT;
+        if ("ADPPPPMNAT".equals(codeString))
+          return ADPPPPMNAT;
+        if ("ADPPPPMNCT".equals(codeString))
+          return ADPPPPMNCT;
+        if ("ADPPSPELAT".equals(codeString))
+          return ADPPSPELAT;
+        if ("ADPPSPELCT".equals(codeString))
+          return ADPPSPELCT;
+        if ("ADPPSPMNAT".equals(codeString))
+          return ADPPSPMNAT;
+        if ("ADPPSPMNCT".equals(codeString))
+          return ADPPSPMNCT;
+        if ("ADRFPPELAT".equals(codeString))
+          return ADRFPPELAT;
+        if ("ADRFPPELCT".equals(codeString))
+          return ADRFPPELCT;
+        if ("ADRFPPMNAT".equals(codeString))
+          return ADRFPPMNAT;
+        if ("ADRFPPMNCT".equals(codeString))
+          return ADRFPPMNCT;
+        if ("ADRFSPELAT".equals(codeString))
+          return ADRFSPELAT;
+        if ("ADRFSPELCT".equals(codeString))
+          return ADRFSPELCT;
+        if ("ADRFSPMNAT".equals(codeString))
+          return ADRFSPMNAT;
+        if ("ADRFSPMNCT".equals(codeString))
+          return ADRFSPMNCT;
+        if ("_InvoiceElementPaid".equals(codeString))
+          return _INVOICEELEMENTPAID;
+        if ("PDNFPPELAT".equals(codeString))
+          return PDNFPPELAT;
+        if ("PDNFPPELCT".equals(codeString))
+          return PDNFPPELCT;
+        if ("PDNFPPMNAT".equals(codeString))
+          return PDNFPPMNAT;
+        if ("PDNFPPMNCT".equals(codeString))
+          return PDNFPPMNCT;
+        if ("PDNFSPELAT".equals(codeString))
+          return PDNFSPELAT;
+        if ("PDNFSPELCT".equals(codeString))
+          return PDNFSPELCT;
+        if ("PDNFSPMNAT".equals(codeString))
+          return PDNFSPMNAT;
+        if ("PDNFSPMNCT".equals(codeString))
+          return PDNFSPMNCT;
+        if ("PDNPPPELAT".equals(codeString))
+          return PDNPPPELAT;
+        if ("PDNPPPELCT".equals(codeString))
+          return PDNPPPELCT;
+        if ("PDNPPPMNAT".equals(codeString))
+          return PDNPPPMNAT;
+        if ("PDNPPPMNCT".equals(codeString))
+          return PDNPPPMNCT;
+        if ("PDNPSPELAT".equals(codeString))
+          return PDNPSPELAT;
+        if ("PDNPSPELCT".equals(codeString))
+          return PDNPSPELCT;
+        if ("PDNPSPMNAT".equals(codeString))
+          return PDNPSPMNAT;
+        if ("PDNPSPMNCT".equals(codeString))
+          return PDNPSPMNCT;
+        if ("PDPPPPELAT".equals(codeString))
+          return PDPPPPELAT;
+        if ("PDPPPPELCT".equals(codeString))
+          return PDPPPPELCT;
+        if ("PDPPPPMNAT".equals(codeString))
+          return PDPPPPMNAT;
+        if ("PDPPPPMNCT".equals(codeString))
+          return PDPPPPMNCT;
+        if ("PDPPSPELAT".equals(codeString))
+          return PDPPSPELAT;
+        if ("PDPPSPELCT".equals(codeString))
+          return PDPPSPELCT;
+        if ("PDPPSPMNAT".equals(codeString))
+          return PDPPSPMNAT;
+        if ("PDPPSPMNCT".equals(codeString))
+          return PDPPSPMNCT;
+        if ("_InvoiceElementSubmitted".equals(codeString))
+          return _INVOICEELEMENTSUBMITTED;
+        if ("SBBLELAT".equals(codeString))
+          return SBBLELAT;
+        if ("SBBLELCT".equals(codeString))
+          return SBBLELCT;
+        if ("SBNFELAT".equals(codeString))
+          return SBNFELAT;
+        if ("SBNFELCT".equals(codeString))
+          return SBNFELCT;
+        if ("SBPDELAT".equals(codeString))
+          return SBPDELAT;
+        if ("SBPDELCT".equals(codeString))
+          return SBPDELCT;
+        if ("_ActInvoiceOverrideCode".equals(codeString))
+          return _ACTINVOICEOVERRIDECODE;
+        if ("COVGE".equals(codeString))
+          return COVGE;
+        if ("EFORM".equals(codeString))
+          return EFORM;
+        if ("FAX".equals(codeString))
+          return FAX;
+        if ("GFTH".equals(codeString))
+          return GFTH;
+        if ("LATE".equals(codeString))
+          return LATE;
+        if ("MANUAL".equals(codeString))
+          return MANUAL;
+        if ("OOJ".equals(codeString))
+          return OOJ;
+        if ("ORTHO".equals(codeString))
+          return ORTHO;
+        if ("PAPER".equals(codeString))
+          return PAPER;
+        if ("PIE".equals(codeString))
+          return PIE;
+        if ("PYRDELAY".equals(codeString))
+          return PYRDELAY;
+        if ("REFNR".equals(codeString))
+          return REFNR;
+        if ("REPSERV".equals(codeString))
+          return REPSERV;
+        if ("UNRELAT".equals(codeString))
+          return UNRELAT;
+        if ("VERBAUTH".equals(codeString))
+          return VERBAUTH;
+        if ("_ActListCode".equals(codeString))
+          return _ACTLISTCODE;
+        if ("_ActObservationList".equals(codeString))
+          return _ACTOBSERVATIONLIST;
+        if ("CARELIST".equals(codeString))
+          return CARELIST;
+        if ("CONDLIST".equals(codeString))
+          return CONDLIST;
+        if ("INTOLIST".equals(codeString))
+          return INTOLIST;
+        if ("PROBLIST".equals(codeString))
+          return PROBLIST;
+        if ("RISKLIST".equals(codeString))
+          return RISKLIST;
+        if ("GOALLIST".equals(codeString))
+          return GOALLIST;
+        if ("_ActTherapyDurationWorkingListCode".equals(codeString))
+          return _ACTTHERAPYDURATIONWORKINGLISTCODE;
+        if ("_ActMedicationTherapyDurationWorkingListCode".equals(codeString))
+          return _ACTMEDICATIONTHERAPYDURATIONWORKINGLISTCODE;
+        if ("ACU".equals(codeString))
+          return ACU;
+        if ("CHRON".equals(codeString))
+          return CHRON;
+        if ("ONET".equals(codeString))
+          return ONET;
+        if ("PRN".equals(codeString))
+          return PRN;
+        if ("MEDLIST".equals(codeString))
+          return MEDLIST;
+        if ("CURMEDLIST".equals(codeString))
+          return CURMEDLIST;
+        if ("DISCMEDLIST".equals(codeString))
+          return DISCMEDLIST;
+        if ("HISTMEDLIST".equals(codeString))
+          return HISTMEDLIST;
+        if ("_ActMonitoringProtocolCode".equals(codeString))
+          return _ACTMONITORINGPROTOCOLCODE;
+        if ("CTLSUB".equals(codeString))
+          return CTLSUB;
+        if ("INV".equals(codeString))
+          return INV;
+        if ("LU".equals(codeString))
+          return LU;
+        if ("OTC".equals(codeString))
+          return OTC;
+        if ("RX".equals(codeString))
+          return RX;
+        if ("SA".equals(codeString))
+          return SA;
+        if ("SAC".equals(codeString))
+          return SAC;
+        if ("_ActNonObservationIndicationCode".equals(codeString))
+          return _ACTNONOBSERVATIONINDICATIONCODE;
+        if ("IND01".equals(codeString))
+          return IND01;
+        if ("IND02".equals(codeString))
+          return IND02;
+        if ("IND03".equals(codeString))
+          return IND03;
+        if ("IND04".equals(codeString))
+          return IND04;
+        if ("IND05".equals(codeString))
+          return IND05;
+        if ("_ActObservationVerificationType".equals(codeString))
+          return _ACTOBSERVATIONVERIFICATIONTYPE;
+        if ("VFPAPER".equals(codeString))
+          return VFPAPER;
+        if ("_ActPaymentCode".equals(codeString))
+          return _ACTPAYMENTCODE;
+        if ("ACH".equals(codeString))
+          return ACH;
+        if ("CHK".equals(codeString))
+          return CHK;
+        if ("DDP".equals(codeString))
+          return DDP;
+        if ("NON".equals(codeString))
+          return NON;
+        if ("_ActPharmacySupplyType".equals(codeString))
+          return _ACTPHARMACYSUPPLYTYPE;
+        if ("DF".equals(codeString))
+          return DF;
+        if ("EM".equals(codeString))
+          return EM;
+        if ("SO".equals(codeString))
+          return SO;
+        if ("FF".equals(codeString))
+          return FF;
+        if ("FFC".equals(codeString))
+          return FFC;
+        if ("FFP".equals(codeString))
+          return FFP;
+        if ("FFSS".equals(codeString))
+          return FFSS;
+        if ("TF".equals(codeString))
+          return TF;
+        if ("FS".equals(codeString))
+          return FS;
+        if ("MS".equals(codeString))
+          return MS;
+        if ("RF".equals(codeString))
+          return RF;
+        if ("UD".equals(codeString))
+          return UD;
+        if ("RFC".equals(codeString))
+          return RFC;
+        if ("RFCS".equals(codeString))
+          return RFCS;
+        if ("RFF".equals(codeString))
+          return RFF;
+        if ("RFFS".equals(codeString))
+          return RFFS;
+        if ("RFP".equals(codeString))
+          return RFP;
+        if ("RFPS".equals(codeString))
+          return RFPS;
+        if ("RFS".equals(codeString))
+          return RFS;
+        if ("TB".equals(codeString))
+          return TB;
+        if ("TBS".equals(codeString))
+          return TBS;
+        if ("UDE".equals(codeString))
+          return UDE;
+        if ("_ActPolicyType".equals(codeString))
+          return _ACTPOLICYTYPE;
+        if ("_ActPrivacyPolicy".equals(codeString))
+          return _ACTPRIVACYPOLICY;
+        if ("_ActConsentDirective".equals(codeString))
+          return _ACTCONSENTDIRECTIVE;
+        if ("EMRGONLY".equals(codeString))
+          return EMRGONLY;
+        if ("GRANTORCHOICE".equals(codeString))
+          return GRANTORCHOICE;
+        if ("IMPLIED".equals(codeString))
+          return IMPLIED;
+        if ("IMPLIEDD".equals(codeString))
+          return IMPLIEDD;
+        if ("NOCONSENT".equals(codeString))
+          return NOCONSENT;
+        if ("NOPP".equals(codeString))
+          return NOPP;
+        if ("OPTIN".equals(codeString))
+          return OPTIN;
+        if ("OPTINR".equals(codeString))
+          return OPTINR;
+        if ("OPTOUT".equals(codeString))
+          return OPTOUT;
+        if ("OPTOUTE".equals(codeString))
+          return OPTOUTE;
+        if ("_ActPrivacyLaw".equals(codeString))
+          return _ACTPRIVACYLAW;
+        if ("_ActUSPrivacyLaw".equals(codeString))
+          return _ACTUSPRIVACYLAW;
+        if ("42CFRPart2".equals(codeString))
+          return _42CFRPART2;
+        if ("CommonRule".equals(codeString))
+          return COMMONRULE;
+        if ("HIPAANOPP".equals(codeString))
+          return HIPAANOPP;
+        if ("HIPAAPsyNotes".equals(codeString))
+          return HIPAAPSYNOTES;
+        if ("HIPAASelfPay".equals(codeString))
+          return HIPAASELFPAY;
+        if ("Title38Section7332".equals(codeString))
+          return TITLE38SECTION7332;
+        if ("_InformationSensitivityPolicy".equals(codeString))
+          return _INFORMATIONSENSITIVITYPOLICY;
+        if ("_ActInformationSensitivityPolicy".equals(codeString))
+          return _ACTINFORMATIONSENSITIVITYPOLICY;
+        if ("ETH".equals(codeString))
+          return ETH;
+        if ("GDIS".equals(codeString))
+          return GDIS;
+        if ("HIV".equals(codeString))
+          return HIV;
+        if ("PSY".equals(codeString))
+          return PSY;
+        if ("SCA".equals(codeString))
+          return SCA;
+        if ("SOC".equals(codeString))
+          return SOC;
+        if ("SDV".equals(codeString))
+          return SDV;
+        if ("SEX".equals(codeString))
+          return SEX;
+        if ("STD".equals(codeString))
+          return STD;
+        if ("TBOO".equals(codeString))
+          return TBOO;
+        if ("SICKLE".equals(codeString))
+          return SICKLE;
+        if ("_EntitySensitivityPolicyType".equals(codeString))
+          return _ENTITYSENSITIVITYPOLICYTYPE;
+        if ("DEMO".equals(codeString))
+          return DEMO;
+        if ("DOB".equals(codeString))
+          return DOB;
+        if ("GENDER".equals(codeString))
+          return GENDER;
+        if ("LIVARG".equals(codeString))
+          return LIVARG;
+        if ("MARST".equals(codeString))
+          return MARST;
+        if ("RACE".equals(codeString))
+          return RACE;
+        if ("REL".equals(codeString))
+          return REL;
+        if ("_RoleInformationSensitivityPolicy".equals(codeString))
+          return _ROLEINFORMATIONSENSITIVITYPOLICY;
+        if ("B".equals(codeString))
+          return B;
+        if ("EMPL".equals(codeString))
+          return EMPL;
+        if ("LOCIS".equals(codeString))
+          return LOCIS;
+        if ("SSP".equals(codeString))
+          return SSP;
+        if ("ADOL".equals(codeString))
+          return ADOL;
+        if ("CEL".equals(codeString))
+          return CEL;
+        if ("DIA".equals(codeString))
+          return DIA;
+        if ("DRGIS".equals(codeString))
+          return DRGIS;
+        if ("EMP".equals(codeString))
+          return EMP;
+        if ("PDS".equals(codeString))
+          return PDS;
+        if ("PRS".equals(codeString))
+          return PRS;
+        if ("COMPT".equals(codeString))
+          return COMPT;
+        if ("HRCOMPT".equals(codeString))
+          return HRCOMPT;
+        if ("RESCOMPT".equals(codeString))
+          return RESCOMPT;
+        if ("RMGTCOMPT".equals(codeString))
+          return RMGTCOMPT;
+        if ("ActTrustPolicyType".equals(codeString))
+          return ACTTRUSTPOLICYTYPE;
+        if ("TRSTACCRD".equals(codeString))
+          return TRSTACCRD;
+        if ("TRSTAGRE".equals(codeString))
+          return TRSTAGRE;
+        if ("TRSTASSUR".equals(codeString))
+          return TRSTASSUR;
+        if ("TRSTCERT".equals(codeString))
+          return TRSTCERT;
+        if ("TRSTFWK".equals(codeString))
+          return TRSTFWK;
+        if ("TRSTMEC".equals(codeString))
+          return TRSTMEC;
+        if ("COVPOL".equals(codeString))
+          return COVPOL;
+        if ("SecurityPolicy".equals(codeString))
+          return SECURITYPOLICY;
+        if ("ObligationPolicy".equals(codeString))
+          return OBLIGATIONPOLICY;
+        if ("ANONY".equals(codeString))
+          return ANONY;
+        if ("AOD".equals(codeString))
+          return AOD;
+        if ("AUDIT".equals(codeString))
+          return AUDIT;
+        if ("AUDTR".equals(codeString))
+          return AUDTR;
+        if ("CPLYCC".equals(codeString))
+          return CPLYCC;
+        if ("CPLYCD".equals(codeString))
+          return CPLYCD;
+        if ("CPLYJPP".equals(codeString))
+          return CPLYJPP;
+        if ("CPLYOPP".equals(codeString))
+          return CPLYOPP;
+        if ("CPLYOSP".equals(codeString))
+          return CPLYOSP;
+        if ("CPLYPOL".equals(codeString))
+          return CPLYPOL;
+        if ("DECLASSIFYLABEL".equals(codeString))
+          return DECLASSIFYLABEL;
+        if ("DEID".equals(codeString))
+          return DEID;
+        if ("DELAU".equals(codeString))
+          return DELAU;
+        if ("DOWNGRDLABEL".equals(codeString))
+          return DOWNGRDLABEL;
+        if ("DRIVLABEL".equals(codeString))
+          return DRIVLABEL;
+        if ("ENCRYPT".equals(codeString))
+          return ENCRYPT;
+        if ("ENCRYPTR".equals(codeString))
+          return ENCRYPTR;
+        if ("ENCRYPTT".equals(codeString))
+          return ENCRYPTT;
+        if ("ENCRYPTU".equals(codeString))
+          return ENCRYPTU;
+        if ("HUAPRV".equals(codeString))
+          return HUAPRV;
+        if ("LABEL".equals(codeString))
+          return LABEL;
+        if ("MASK".equals(codeString))
+          return MASK;
+        if ("MINEC".equals(codeString))
+          return MINEC;
+        if ("PERSISTLABEL".equals(codeString))
+          return PERSISTLABEL;
+        if ("PRIVMARK".equals(codeString))
+          return PRIVMARK;
+        if ("PSEUD".equals(codeString))
+          return PSEUD;
+        if ("REDACT".equals(codeString))
+          return REDACT;
+        if ("UPGRDLABEL".equals(codeString))
+          return UPGRDLABEL;
+        if ("RefrainPolicy".equals(codeString))
+          return REFRAINPOLICY;
+        if ("NOAUTH".equals(codeString))
+          return NOAUTH;
+        if ("NOCOLLECT".equals(codeString))
+          return NOCOLLECT;
+        if ("NODSCLCD".equals(codeString))
+          return NODSCLCD;
+        if ("NODSCLCDS".equals(codeString))
+          return NODSCLCDS;
+        if ("NOINTEGRATE".equals(codeString))
+          return NOINTEGRATE;
+        if ("NOLIST".equals(codeString))
+          return NOLIST;
+        if ("NOMOU".equals(codeString))
+          return NOMOU;
+        if ("NOORGPOL".equals(codeString))
+          return NOORGPOL;
+        if ("NOPAT".equals(codeString))
+          return NOPAT;
+        if ("NOPERSISTP".equals(codeString))
+          return NOPERSISTP;
+        if ("NORDSCLCD".equals(codeString))
+          return NORDSCLCD;
+        if ("NORDSCLCDS".equals(codeString))
+          return NORDSCLCDS;
+        if ("NORDSCLW".equals(codeString))
+          return NORDSCLW;
+        if ("NORELINK".equals(codeString))
+          return NORELINK;
+        if ("NOREUSE".equals(codeString))
+          return NOREUSE;
+        if ("NOVIP".equals(codeString))
+          return NOVIP;
+        if ("ORCON".equals(codeString))
+          return ORCON;
+        if ("_ActProductAcquisitionCode".equals(codeString))
+          return _ACTPRODUCTACQUISITIONCODE;
+        if ("LOAN".equals(codeString))
+          return LOAN;
+        if ("RENT".equals(codeString))
+          return RENT;
+        if ("TRANSFER".equals(codeString))
+          return TRANSFER;
+        if ("SALE".equals(codeString))
+          return SALE;
+        if ("_ActSpecimenTransportCode".equals(codeString))
+          return _ACTSPECIMENTRANSPORTCODE;
+        if ("SREC".equals(codeString))
+          return SREC;
+        if ("SSTOR".equals(codeString))
+          return SSTOR;
+        if ("STRAN".equals(codeString))
+          return STRAN;
+        if ("_ActSpecimenTreatmentCode".equals(codeString))
+          return _ACTSPECIMENTREATMENTCODE;
+        if ("ACID".equals(codeString))
+          return ACID;
+        if ("ALK".equals(codeString))
+          return ALK;
+        if ("DEFB".equals(codeString))
+          return DEFB;
+        if ("FILT".equals(codeString))
+          return FILT;
+        if ("LDLP".equals(codeString))
+          return LDLP;
+        if ("NEUT".equals(codeString))
+          return NEUT;
+        if ("RECA".equals(codeString))
+          return RECA;
+        if ("UFIL".equals(codeString))
+          return UFIL;
+        if ("_ActSubstanceAdministrationCode".equals(codeString))
+          return _ACTSUBSTANCEADMINISTRATIONCODE;
+        if ("DRUG".equals(codeString))
+          return DRUG;
+        if ("FD".equals(codeString))
+          return FD;
+        if ("IMMUNIZ".equals(codeString))
+          return IMMUNIZ;
+        if ("BOOSTER".equals(codeString))
+          return BOOSTER;
+        if ("INITIMMUNIZ".equals(codeString))
+          return INITIMMUNIZ;
+        if ("_ActTaskCode".equals(codeString))
+          return _ACTTASKCODE;
+        if ("OE".equals(codeString))
+          return OE;
+        if ("LABOE".equals(codeString))
+          return LABOE;
+        if ("MEDOE".equals(codeString))
+          return MEDOE;
+        if ("PATDOC".equals(codeString))
+          return PATDOC;
+        if ("ALLERLREV".equals(codeString))
+          return ALLERLREV;
+        if ("CLINNOTEE".equals(codeString))
+          return CLINNOTEE;
+        if ("DIAGLISTE".equals(codeString))
+          return DIAGLISTE;
+        if ("DISCHINSTE".equals(codeString))
+          return DISCHINSTE;
+        if ("DISCHSUME".equals(codeString))
+          return DISCHSUME;
+        if ("PATEDUE".equals(codeString))
+          return PATEDUE;
+        if ("PATREPE".equals(codeString))
+          return PATREPE;
+        if ("PROBLISTE".equals(codeString))
+          return PROBLISTE;
+        if ("RADREPE".equals(codeString))
+          return RADREPE;
+        if ("IMMLREV".equals(codeString))
+          return IMMLREV;
+        if ("REMLREV".equals(codeString))
+          return REMLREV;
+        if ("WELLREMLREV".equals(codeString))
+          return WELLREMLREV;
+        if ("PATINFO".equals(codeString))
+          return PATINFO;
+        if ("ALLERLE".equals(codeString))
+          return ALLERLE;
+        if ("CDSREV".equals(codeString))
+          return CDSREV;
+        if ("CLINNOTEREV".equals(codeString))
+          return CLINNOTEREV;
+        if ("DISCHSUMREV".equals(codeString))
+          return DISCHSUMREV;
+        if ("DIAGLISTREV".equals(codeString))
+          return DIAGLISTREV;
+        if ("IMMLE".equals(codeString))
+          return IMMLE;
+        if ("LABRREV".equals(codeString))
+          return LABRREV;
+        if ("MICRORREV".equals(codeString))
+          return MICRORREV;
+        if ("MICROORGRREV".equals(codeString))
+          return MICROORGRREV;
+        if ("MICROSENSRREV".equals(codeString))
+          return MICROSENSRREV;
+        if ("MLREV".equals(codeString))
+          return MLREV;
+        if ("MARWLREV".equals(codeString))
+          return MARWLREV;
+        if ("OREV".equals(codeString))
+          return OREV;
+        if ("PATREPREV".equals(codeString))
+          return PATREPREV;
+        if ("PROBLISTREV".equals(codeString))
+          return PROBLISTREV;
+        if ("RADREPREV".equals(codeString))
+          return RADREPREV;
+        if ("REMLE".equals(codeString))
+          return REMLE;
+        if ("WELLREMLE".equals(codeString))
+          return WELLREMLE;
+        if ("RISKASSESS".equals(codeString))
+          return RISKASSESS;
+        if ("FALLRISK".equals(codeString))
+          return FALLRISK;
+        if ("_ActTransportationModeCode".equals(codeString))
+          return _ACTTRANSPORTATIONMODECODE;
+        if ("_ActPatientTransportationModeCode".equals(codeString))
+          return _ACTPATIENTTRANSPORTATIONMODECODE;
+        if ("AFOOT".equals(codeString))
+          return AFOOT;
+        if ("AMBT".equals(codeString))
+          return AMBT;
+        if ("AMBAIR".equals(codeString))
+          return AMBAIR;
+        if ("AMBGRND".equals(codeString))
+          return AMBGRND;
+        if ("AMBHELO".equals(codeString))
+          return AMBHELO;
+        if ("LAWENF".equals(codeString))
+          return LAWENF;
+        if ("PRVTRN".equals(codeString))
+          return PRVTRN;
+        if ("PUBTRN".equals(codeString))
+          return PUBTRN;
+        if ("_ObservationType".equals(codeString))
+          return _OBSERVATIONTYPE;
+        if ("_ActSpecObsCode".equals(codeString))
+          return _ACTSPECOBSCODE;
+        if ("ARTBLD".equals(codeString))
+          return ARTBLD;
+        if ("DILUTION".equals(codeString))
+          return DILUTION;
+        if ("AUTO-HIGH".equals(codeString))
+          return AUTOHIGH;
+        if ("AUTO-LOW".equals(codeString))
+          return AUTOLOW;
+        if ("PRE".equals(codeString))
+          return PRE;
+        if ("RERUN".equals(codeString))
+          return RERUN;
+        if ("EVNFCTS".equals(codeString))
+          return EVNFCTS;
+        if ("INTFR".equals(codeString))
+          return INTFR;
+        if ("FIBRIN".equals(codeString))
+          return FIBRIN;
+        if ("HEMOLYSIS".equals(codeString))
+          return HEMOLYSIS;
+        if ("ICTERUS".equals(codeString))
+          return ICTERUS;
+        if ("LIPEMIA".equals(codeString))
+          return LIPEMIA;
+        if ("VOLUME".equals(codeString))
+          return VOLUME;
+        if ("AVAILABLE".equals(codeString))
+          return AVAILABLE;
+        if ("CONSUMPTION".equals(codeString))
+          return CONSUMPTION;
+        if ("CURRENT".equals(codeString))
+          return CURRENT;
+        if ("INITIAL".equals(codeString))
+          return INITIAL;
+        if ("_AnnotationType".equals(codeString))
+          return _ANNOTATIONTYPE;
+        if ("_ActPatientAnnotationType".equals(codeString))
+          return _ACTPATIENTANNOTATIONTYPE;
+        if ("ANNDI".equals(codeString))
+          return ANNDI;
+        if ("ANNGEN".equals(codeString))
+          return ANNGEN;
+        if ("ANNIMM".equals(codeString))
+          return ANNIMM;
+        if ("ANNLAB".equals(codeString))
+          return ANNLAB;
+        if ("ANNMED".equals(codeString))
+          return ANNMED;
+        if ("_GeneticObservationType".equals(codeString))
+          return _GENETICOBSERVATIONTYPE;
+        if ("GENE".equals(codeString))
+          return GENE;
+        if ("_ImmunizationObservationType".equals(codeString))
+          return _IMMUNIZATIONOBSERVATIONTYPE;
+        if ("OBSANTC".equals(codeString))
+          return OBSANTC;
+        if ("OBSANTV".equals(codeString))
+          return OBSANTV;
+        if ("_IndividualCaseSafetyReportType".equals(codeString))
+          return _INDIVIDUALCASESAFETYREPORTTYPE;
+        if ("PAT_ADV_EVNT".equals(codeString))
+          return PATADVEVNT;
+        if ("VAC_PROBLEM".equals(codeString))
+          return VACPROBLEM;
+        if ("_LOINCObservationActContextAgeType".equals(codeString))
+          return _LOINCOBSERVATIONACTCONTEXTAGETYPE;
+        if ("21611-9".equals(codeString))
+          return _216119;
+        if ("21612-7".equals(codeString))
+          return _216127;
+        if ("29553-5".equals(codeString))
+          return _295535;
+        if ("30525-0".equals(codeString))
+          return _305250;
+        if ("30972-4".equals(codeString))
+          return _309724;
+        if ("_MedicationObservationType".equals(codeString))
+          return _MEDICATIONOBSERVATIONTYPE;
+        if ("REP_HALF_LIFE".equals(codeString))
+          return REPHALFLIFE;
+        if ("SPLCOATING".equals(codeString))
+          return SPLCOATING;
+        if ("SPLCOLOR".equals(codeString))
+          return SPLCOLOR;
+        if ("SPLIMAGE".equals(codeString))
+          return SPLIMAGE;
+        if ("SPLIMPRINT".equals(codeString))
+          return SPLIMPRINT;
+        if ("SPLSCORING".equals(codeString))
+          return SPLSCORING;
+        if ("SPLSHAPE".equals(codeString))
+          return SPLSHAPE;
+        if ("SPLSIZE".equals(codeString))
+          return SPLSIZE;
+        if ("SPLSYMBOL".equals(codeString))
+          return SPLSYMBOL;
+        if ("_ObservationIssueTriggerCodedObservationType".equals(codeString))
+          return _OBSERVATIONISSUETRIGGERCODEDOBSERVATIONTYPE;
+        if ("_CaseTransmissionMode".equals(codeString))
+          return _CASETRANSMISSIONMODE;
+        if ("AIRTRNS".equals(codeString))
+          return AIRTRNS;
+        if ("ANANTRNS".equals(codeString))
+          return ANANTRNS;
+        if ("ANHUMTRNS".equals(codeString))
+          return ANHUMTRNS;
+        if ("BDYFLDTRNS".equals(codeString))
+          return BDYFLDTRNS;
+        if ("BLDTRNS".equals(codeString))
+          return BLDTRNS;
+        if ("DERMTRNS".equals(codeString))
+          return DERMTRNS;
+        if ("ENVTRNS".equals(codeString))
+          return ENVTRNS;
+        if ("FECTRNS".equals(codeString))
+          return FECTRNS;
+        if ("FOMTRNS".equals(codeString))
+          return FOMTRNS;
+        if ("FOODTRNS".equals(codeString))
+          return FOODTRNS;
+        if ("HUMHUMTRNS".equals(codeString))
+          return HUMHUMTRNS;
+        if ("INDTRNS".equals(codeString))
+          return INDTRNS;
+        if ("LACTTRNS".equals(codeString))
+          return LACTTRNS;
+        if ("NOSTRNS".equals(codeString))
+          return NOSTRNS;
+        if ("PARTRNS".equals(codeString))
+          return PARTRNS;
+        if ("PLACTRNS".equals(codeString))
+          return PLACTRNS;
+        if ("SEXTRNS".equals(codeString))
+          return SEXTRNS;
+        if ("TRNSFTRNS".equals(codeString))
+          return TRNSFTRNS;
+        if ("VECTRNS".equals(codeString))
+          return VECTRNS;
+        if ("WATTRNS".equals(codeString))
+          return WATTRNS;
+        if ("_ObservationQualityMeasureAttribute".equals(codeString))
+          return _OBSERVATIONQUALITYMEASUREATTRIBUTE;
+        if ("AGGREGATE".equals(codeString))
+          return AGGREGATE;
+        if ("CMPMSRMTH".equals(codeString))
+          return CMPMSRMTH;
+        if ("CMPMSRSCRWGHT".equals(codeString))
+          return CMPMSRSCRWGHT;
+        if ("COPY".equals(codeString))
+          return COPY;
+        if ("CRS".equals(codeString))
+          return CRS;
+        if ("DEF".equals(codeString))
+          return DEF;
+        if ("DISC".equals(codeString))
+          return DISC;
+        if ("FINALDT".equals(codeString))
+          return FINALDT;
+        if ("GUIDE".equals(codeString))
+          return GUIDE;
+        if ("IDUR".equals(codeString))
+          return IDUR;
+        if ("ITMCNT".equals(codeString))
+          return ITMCNT;
+        if ("KEY".equals(codeString))
+          return KEY;
+        if ("MEDT".equals(codeString))
+          return MEDT;
+        if ("MSD".equals(codeString))
+          return MSD;
+        if ("MSRADJ".equals(codeString))
+          return MSRADJ;
+        if ("MSRAGG".equals(codeString))
+          return MSRAGG;
+        if ("MSRIMPROV".equals(codeString))
+          return MSRIMPROV;
+        if ("MSRJUR".equals(codeString))
+          return MSRJUR;
+        if ("MSRRPTR".equals(codeString))
+          return MSRRPTR;
+        if ("MSRRPTTIME".equals(codeString))
+          return MSRRPTTIME;
+        if ("MSRSCORE".equals(codeString))
+          return MSRSCORE;
+        if ("MSRSET".equals(codeString))
+          return MSRSET;
+        if ("MSRTOPIC".equals(codeString))
+          return MSRTOPIC;
+        if ("MSRTP".equals(codeString))
+          return MSRTP;
+        if ("MSRTYPE".equals(codeString))
+          return MSRTYPE;
+        if ("RAT".equals(codeString))
+          return RAT;
+        if ("REF".equals(codeString))
+          return REF;
+        if ("SDE".equals(codeString))
+          return SDE;
+        if ("STRAT".equals(codeString))
+          return STRAT;
+        if ("TRANF".equals(codeString))
+          return TRANF;
+        if ("USE".equals(codeString))
+          return USE;
+        if ("_ObservationSequenceType".equals(codeString))
+          return _OBSERVATIONSEQUENCETYPE;
+        if ("TIME_ABSOLUTE".equals(codeString))
+          return TIMEABSOLUTE;
+        if ("TIME_RELATIVE".equals(codeString))
+          return TIMERELATIVE;
+        if ("_ObservationSeriesType".equals(codeString))
+          return _OBSERVATIONSERIESTYPE;
+        if ("_ECGObservationSeriesType".equals(codeString))
+          return _ECGOBSERVATIONSERIESTYPE;
+        if ("REPRESENTATIVE_BEAT".equals(codeString))
+          return REPRESENTATIVEBEAT;
+        if ("RHYTHM".equals(codeString))
+          return RHYTHM;
+        if ("_PatientImmunizationRelatedObservationType".equals(codeString))
+          return _PATIENTIMMUNIZATIONRELATEDOBSERVATIONTYPE;
+        if ("CLSSRM".equals(codeString))
+          return CLSSRM;
+        if ("GRADE".equals(codeString))
+          return GRADE;
+        if ("SCHL".equals(codeString))
+          return SCHL;
+        if ("SCHLDIV".equals(codeString))
+          return SCHLDIV;
+        if ("TEACHER".equals(codeString))
+          return TEACHER;
+        if ("_PopulationInclusionObservationType".equals(codeString))
+          return _POPULATIONINCLUSIONOBSERVATIONTYPE;
+        if ("DENEX".equals(codeString))
+          return DENEX;
+        if ("DENEXCEP".equals(codeString))
+          return DENEXCEP;
+        if ("DENOM".equals(codeString))
+          return DENOM;
+        if ("IPOP".equals(codeString))
+          return IPOP;
+        if ("IPPOP".equals(codeString))
+          return IPPOP;
+        if ("MSRPOPL".equals(codeString))
+          return MSRPOPL;
+        if ("MSRPOPLEX".equals(codeString))
+          return MSRPOPLEX;
+        if ("NUMER".equals(codeString))
+          return NUMER;
+        if ("NUMEX".equals(codeString))
+          return NUMEX;
+        if ("_PreferenceObservationType".equals(codeString))
+          return _PREFERENCEOBSERVATIONTYPE;
+        if ("PREFSTRENGTH".equals(codeString))
+          return PREFSTRENGTH;
+        if ("ADVERSE_REACTION".equals(codeString))
+          return ADVERSEREACTION;
+        if ("ASSERTION".equals(codeString))
+          return ASSERTION;
+        if ("CASESER".equals(codeString))
+          return CASESER;
+        if ("CDIO".equals(codeString))
+          return CDIO;
+        if ("CRIT".equals(codeString))
+          return CRIT;
+        if ("CTMO".equals(codeString))
+          return CTMO;
+        if ("DX".equals(codeString))
+          return DX;
+        if ("ADMDX".equals(codeString))
+          return ADMDX;
+        if ("DISDX".equals(codeString))
+          return DISDX;
+        if ("INTDX".equals(codeString))
+          return INTDX;
+        if ("NOI".equals(codeString))
+          return NOI;
+        if ("GISTIER".equals(codeString))
+          return GISTIER;
+        if ("HHOBS".equals(codeString))
+          return HHOBS;
+        if ("ISSUE".equals(codeString))
+          return ISSUE;
+        if ("_ActAdministrativeDetectedIssueCode".equals(codeString))
+          return _ACTADMINISTRATIVEDETECTEDISSUECODE;
+        if ("_ActAdministrativeAuthorizationDetectedIssueCode".equals(codeString))
+          return _ACTADMINISTRATIVEAUTHORIZATIONDETECTEDISSUECODE;
+        if ("NAT".equals(codeString))
+          return NAT;
+        if ("SUPPRESSED".equals(codeString))
+          return SUPPRESSED;
+        if ("VALIDAT".equals(codeString))
+          return VALIDAT;
+        if ("KEY204".equals(codeString))
+          return KEY204;
+        if ("KEY205".equals(codeString))
+          return KEY205;
+        if ("COMPLY".equals(codeString))
+          return COMPLY;
+        if ("DUPTHPY".equals(codeString))
+          return DUPTHPY;
+        if ("DUPTHPCLS".equals(codeString))
+          return DUPTHPCLS;
+        if ("DUPTHPGEN".equals(codeString))
+          return DUPTHPGEN;
+        if ("ABUSE".equals(codeString))
+          return ABUSE;
+        if ("FRAUD".equals(codeString))
+          return FRAUD;
+        if ("PLYDOC".equals(codeString))
+          return PLYDOC;
+        if ("PLYPHRM".equals(codeString))
+          return PLYPHRM;
+        if ("DOSE".equals(codeString))
+          return DOSE;
+        if ("DOSECOND".equals(codeString))
+          return DOSECOND;
+        if ("DOSEDUR".equals(codeString))
+          return DOSEDUR;
+        if ("DOSEDURH".equals(codeString))
+          return DOSEDURH;
+        if ("DOSEDURHIND".equals(codeString))
+          return DOSEDURHIND;
+        if ("DOSEDURL".equals(codeString))
+          return DOSEDURL;
+        if ("DOSEDURLIND".equals(codeString))
+          return DOSEDURLIND;
+        if ("DOSEH".equals(codeString))
+          return DOSEH;
+        if ("DOSEHINDA".equals(codeString))
+          return DOSEHINDA;
+        if ("DOSEHIND".equals(codeString))
+          return DOSEHIND;
+        if ("DOSEHINDSA".equals(codeString))
+          return DOSEHINDSA;
+        if ("DOSEHINDW".equals(codeString))
+          return DOSEHINDW;
+        if ("DOSEIVL".equals(codeString))
+          return DOSEIVL;
+        if ("DOSEIVLIND".equals(codeString))
+          return DOSEIVLIND;
+        if ("DOSEL".equals(codeString))
+          return DOSEL;
+        if ("DOSELINDA".equals(codeString))
+          return DOSELINDA;
+        if ("DOSELIND".equals(codeString))
+          return DOSELIND;
+        if ("DOSELINDSA".equals(codeString))
+          return DOSELINDSA;
+        if ("DOSELINDW".equals(codeString))
+          return DOSELINDW;
+        if ("MDOSE".equals(codeString))
+          return MDOSE;
+        if ("OBSA".equals(codeString))
+          return OBSA;
+        if ("AGE".equals(codeString))
+          return AGE;
+        if ("ADALRT".equals(codeString))
+          return ADALRT;
+        if ("GEALRT".equals(codeString))
+          return GEALRT;
+        if ("PEALRT".equals(codeString))
+          return PEALRT;
+        if ("COND".equals(codeString))
+          return COND;
+        if ("HGHT".equals(codeString))
+          return HGHT;
+        if ("LACT".equals(codeString))
+          return LACT;
+        if ("PREG".equals(codeString))
+          return PREG;
+        if ("WGHT".equals(codeString))
+          return WGHT;
+        if ("CREACT".equals(codeString))
+          return CREACT;
+        if ("GEN".equals(codeString))
+          return GEN;
+        if ("GEND".equals(codeString))
+          return GEND;
+        if ("LAB".equals(codeString))
+          return LAB;
+        if ("REACT".equals(codeString))
+          return REACT;
+        if ("ALGY".equals(codeString))
+          return ALGY;
+        if ("INT".equals(codeString))
+          return INT;
+        if ("RREACT".equals(codeString))
+          return RREACT;
+        if ("RALG".equals(codeString))
+          return RALG;
+        if ("RAR".equals(codeString))
+          return RAR;
+        if ("RINT".equals(codeString))
+          return RINT;
+        if ("BUS".equals(codeString))
+          return BUS;
+        if ("CODE_INVAL".equals(codeString))
+          return CODEINVAL;
+        if ("CODE_DEPREC".equals(codeString))
+          return CODEDEPREC;
+        if ("FORMAT".equals(codeString))
+          return FORMAT;
+        if ("ILLEGAL".equals(codeString))
+          return ILLEGAL;
+        if ("LEN_RANGE".equals(codeString))
+          return LENRANGE;
+        if ("LEN_LONG".equals(codeString))
+          return LENLONG;
+        if ("LEN_SHORT".equals(codeString))
+          return LENSHORT;
+        if ("MISSCOND".equals(codeString))
+          return MISSCOND;
+        if ("MISSMAND".equals(codeString))
+          return MISSMAND;
+        if ("NODUPS".equals(codeString))
+          return NODUPS;
+        if ("NOPERSIST".equals(codeString))
+          return NOPERSIST;
+        if ("REP_RANGE".equals(codeString))
+          return REPRANGE;
+        if ("MAXOCCURS".equals(codeString))
+          return MAXOCCURS;
+        if ("MINOCCURS".equals(codeString))
+          return MINOCCURS;
+        if ("_ActAdministrativeRuleDetectedIssueCode".equals(codeString))
+          return _ACTADMINISTRATIVERULEDETECTEDISSUECODE;
+        if ("KEY206".equals(codeString))
+          return KEY206;
+        if ("OBSOLETE".equals(codeString))
+          return OBSOLETE;
+        if ("_ActSuppliedItemDetectedIssueCode".equals(codeString))
+          return _ACTSUPPLIEDITEMDETECTEDISSUECODE;
+        if ("_AdministrationDetectedIssueCode".equals(codeString))
+          return _ADMINISTRATIONDETECTEDISSUECODE;
+        if ("_AppropriatenessDetectedIssueCode".equals(codeString))
+          return _APPROPRIATENESSDETECTEDISSUECODE;
+        if ("_InteractionDetectedIssueCode".equals(codeString))
+          return _INTERACTIONDETECTEDISSUECODE;
+        if ("FOOD".equals(codeString))
+          return FOOD;
+        if ("TPROD".equals(codeString))
+          return TPROD;
+        if ("DRG".equals(codeString))
+          return DRG;
+        if ("NHP".equals(codeString))
+          return NHP;
+        if ("NONRX".equals(codeString))
+          return NONRX;
+        if ("PREVINEF".equals(codeString))
+          return PREVINEF;
+        if ("DACT".equals(codeString))
+          return DACT;
+        if ("TIME".equals(codeString))
+          return TIME;
+        if ("ALRTENDLATE".equals(codeString))
+          return ALRTENDLATE;
+        if ("ALRTSTRTLATE".equals(codeString))
+          return ALRTSTRTLATE;
+        if ("_TimingDetectedIssueCode".equals(codeString))
+          return _TIMINGDETECTEDISSUECODE;
+        if ("ENDLATE".equals(codeString))
+          return ENDLATE;
+        if ("STRTLATE".equals(codeString))
+          return STRTLATE;
+        if ("_SupplyDetectedIssueCode".equals(codeString))
+          return _SUPPLYDETECTEDISSUECODE;
+        if ("ALLDONE".equals(codeString))
+          return ALLDONE;
+        if ("FULFIL".equals(codeString))
+          return FULFIL;
+        if ("NOTACTN".equals(codeString))
+          return NOTACTN;
+        if ("NOTEQUIV".equals(codeString))
+          return NOTEQUIV;
+        if ("NOTEQUIVGEN".equals(codeString))
+          return NOTEQUIVGEN;
+        if ("NOTEQUIVTHER".equals(codeString))
+          return NOTEQUIVTHER;
+        if ("TIMING".equals(codeString))
+          return TIMING;
+        if ("INTERVAL".equals(codeString))
+          return INTERVAL;
+        if ("MINFREQ".equals(codeString))
+          return MINFREQ;
+        if ("HELD".equals(codeString))
+          return HELD;
+        if ("TOOLATE".equals(codeString))
+          return TOOLATE;
+        if ("TOOSOON".equals(codeString))
+          return TOOSOON;
+        if ("HISTORIC".equals(codeString))
+          return HISTORIC;
+        if ("PATPREF".equals(codeString))
+          return PATPREF;
+        if ("PATPREFALT".equals(codeString))
+          return PATPREFALT;
+        if ("KSUBJ".equals(codeString))
+          return KSUBJ;
+        if ("KSUBT".equals(codeString))
+          return KSUBT;
+        if ("OINT".equals(codeString))
+          return OINT;
+        if ("ALG".equals(codeString))
+          return ALG;
+        if ("DALG".equals(codeString))
+          return DALG;
+        if ("EALG".equals(codeString))
+          return EALG;
+        if ("FALG".equals(codeString))
+          return FALG;
+        if ("DINT".equals(codeString))
+          return DINT;
+        if ("DNAINT".equals(codeString))
+          return DNAINT;
+        if ("EINT".equals(codeString))
+          return EINT;
+        if ("ENAINT".equals(codeString))
+          return ENAINT;
+        if ("FINT".equals(codeString))
+          return FINT;
+        if ("FNAINT".equals(codeString))
+          return FNAINT;
+        if ("NAINT".equals(codeString))
+          return NAINT;
+        if ("SEV".equals(codeString))
+          return SEV;
+        if ("_FDALabelData".equals(codeString))
+          return _FDALABELDATA;
+        if ("FDACOATING".equals(codeString))
+          return FDACOATING;
+        if ("FDACOLOR".equals(codeString))
+          return FDACOLOR;
+        if ("FDAIMPRINTCD".equals(codeString))
+          return FDAIMPRINTCD;
+        if ("FDALOGO".equals(codeString))
+          return FDALOGO;
+        if ("FDASCORING".equals(codeString))
+          return FDASCORING;
+        if ("FDASHAPE".equals(codeString))
+          return FDASHAPE;
+        if ("FDASIZE".equals(codeString))
+          return FDASIZE;
+        if ("_ROIOverlayShape".equals(codeString))
+          return _ROIOVERLAYSHAPE;
+        if ("CIRCLE".equals(codeString))
+          return CIRCLE;
+        if ("ELLIPSE".equals(codeString))
+          return ELLIPSE;
+        if ("POINT".equals(codeString))
+          return POINT;
+        if ("POLY".equals(codeString))
+          return POLY;
+        if ("C".equals(codeString))
+          return C;
+        if ("DIET".equals(codeString))
+          return DIET;
+        if ("BR".equals(codeString))
+          return BR;
+        if ("DM".equals(codeString))
+          return DM;
+        if ("FAST".equals(codeString))
+          return FAST;
+        if ("FORMULA".equals(codeString))
+          return FORMULA;
+        if ("GF".equals(codeString))
+          return GF;
+        if ("LF".equals(codeString))
+          return LF;
+        if ("LP".equals(codeString))
+          return LP;
+        if ("LQ".equals(codeString))
+          return LQ;
+        if ("LS".equals(codeString))
+          return LS;
+        if ("N".equals(codeString))
+          return N;
+        if ("NF".equals(codeString))
+          return NF;
+        if ("PAF".equals(codeString))
+          return PAF;
+        if ("PAR".equals(codeString))
+          return PAR;
+        if ("RD".equals(codeString))
+          return RD;
+        if ("SCH".equals(codeString))
+          return SCH;
+        if ("SUPPLEMENT".equals(codeString))
+          return SUPPLEMENT;
+        if ("T".equals(codeString))
+          return T;
+        if ("VLI".equals(codeString))
+          return VLI;
+        if ("DRUGPRG".equals(codeString))
+          return DRUGPRG;
+        if ("F".equals(codeString))
+          return F;
+        if ("PRLMN".equals(codeString))
+          return PRLMN;
+        if ("SECOBS".equals(codeString))
+          return SECOBS;
+        if ("SECCATOBS".equals(codeString))
+          return SECCATOBS;
+        if ("SECCLASSOBS".equals(codeString))
+          return SECCLASSOBS;
+        if ("SECCONOBS".equals(codeString))
+          return SECCONOBS;
+        if ("SECINTOBS".equals(codeString))
+          return SECINTOBS;
+        if ("SECALTINTOBS".equals(codeString))
+          return SECALTINTOBS;
+        if ("SECDATINTOBS".equals(codeString))
+          return SECDATINTOBS;
+        if ("SECINTCONOBS".equals(codeString))
+          return SECINTCONOBS;
+        if ("SECINTPRVOBS".equals(codeString))
+          return SECINTPRVOBS;
+        if ("SECINTPRVABOBS".equals(codeString))
+          return SECINTPRVABOBS;
+        if ("SECINTPRVRBOBS".equals(codeString))
+          return SECINTPRVRBOBS;
+        if ("SECINTSTOBS".equals(codeString))
+          return SECINTSTOBS;
+        if ("SECTRSTOBS".equals(codeString))
+          return SECTRSTOBS;
+        if ("TRSTACCRDOBS".equals(codeString))
+          return TRSTACCRDOBS;
+        if ("TRSTAGREOBS".equals(codeString))
+          return TRSTAGREOBS;
+        if ("TRSTCERTOBS".equals(codeString))
+          return TRSTCERTOBS;
+        if ("TRSTFWKOBS".equals(codeString))
+          return TRSTFWKOBS;
+        if ("TRSTLOAOBS".equals(codeString))
+          return TRSTLOAOBS;
+        if ("TRSTMECOBS".equals(codeString))
+          return TRSTMECOBS;
+        if ("SUBSIDFFS".equals(codeString))
+          return SUBSIDFFS;
+        if ("WRKCOMP".equals(codeString))
+          return WRKCOMP;
+        if ("_ActProcedureCode".equals(codeString))
+          return _ACTPROCEDURECODE;
+        if ("_ActBillableServiceCode".equals(codeString))
+          return _ACTBILLABLESERVICECODE;
+        if ("_HL7DefinedActCodes".equals(codeString))
+          return _HL7DEFINEDACTCODES;
+        if ("COPAY".equals(codeString))
+          return COPAY;
+        if ("DEDUCT".equals(codeString))
+          return DEDUCT;
+        if ("DOSEIND".equals(codeString))
+          return DOSEIND;
+        if ("PRA".equals(codeString))
+          return PRA;
+        if ("STORE".equals(codeString))
+          return STORE;
+        throw new FHIRException("Unknown V3ActCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ACTACCOUNTCODE: return "_ActAccountCode";
+            case ACCTRECEIVABLE: return "ACCTRECEIVABLE";
+            case CASH: return "CASH";
+            case CC: return "CC";
+            case AE: return "AE";
+            case DN: return "DN";
+            case DV: return "DV";
+            case MC: return "MC";
+            case V: return "V";
+            case PBILLACCT: return "PBILLACCT";
+            case _ACTADJUDICATIONCODE: return "_ActAdjudicationCode";
+            case _ACTADJUDICATIONGROUPCODE: return "_ActAdjudicationGroupCode";
+            case CONT: return "CONT";
+            case DAY: return "DAY";
+            case LOC: return "LOC";
+            case MONTH: return "MONTH";
+            case PERIOD: return "PERIOD";
+            case PROV: return "PROV";
+            case WEEK: return "WEEK";
+            case YEAR: return "YEAR";
+            case AA: return "AA";
+            case ANF: return "ANF";
+            case AR: return "AR";
+            case AS: return "AS";
+            case _ACTADJUDICATIONRESULTACTIONCODE: return "_ActAdjudicationResultActionCode";
+            case DISPLAY: return "DISPLAY";
+            case FORM: return "FORM";
+            case _ACTBILLABLEMODIFIERCODE: return "_ActBillableModifierCode";
+            case CPTM: return "CPTM";
+            case HCPCSA: return "HCPCSA";
+            case _ACTBILLINGARRANGEMENTCODE: return "_ActBillingArrangementCode";
+            case BLK: return "BLK";
+            case CAP: return "CAP";
+            case CONTF: return "CONTF";
+            case FINBILL: return "FINBILL";
+            case ROST: return "ROST";
+            case SESS: return "SESS";
+            case FFS: return "FFS";
+            case FFPS: return "FFPS";
+            case FFCS: return "FFCS";
+            case TFS: return "TFS";
+            case _ACTBOUNDEDROICODE: return "_ActBoundedROICode";
+            case ROIFS: return "ROIFS";
+            case ROIPS: return "ROIPS";
+            case _ACTCAREPROVISIONCODE: return "_ActCareProvisionCode";
+            case _ACTCREDENTIALEDCARECODE: return "_ActCredentialedCareCode";
+            case _ACTCREDENTIALEDCAREPROVISIONPERSONCODE: return "_ActCredentialedCareProvisionPersonCode";
+            case CACC: return "CACC";
+            case CAIC: return "CAIC";
+            case CAMC: return "CAMC";
+            case CANC: return "CANC";
+            case CAPC: return "CAPC";
+            case CBGC: return "CBGC";
+            case CCCC: return "CCCC";
+            case CCGC: return "CCGC";
+            case CCPC: return "CCPC";
+            case CCSC: return "CCSC";
+            case CDEC: return "CDEC";
+            case CDRC: return "CDRC";
+            case CEMC: return "CEMC";
+            case CFPC: return "CFPC";
+            case CIMC: return "CIMC";
+            case CMGC: return "CMGC";
+            case CNEC: return "CNEC";
+            case CNMC: return "CNMC";
+            case CNQC: return "CNQC";
+            case CNSC: return "CNSC";
+            case COGC: return "COGC";
+            case COMC: return "COMC";
+            case COPC: return "COPC";
+            case COSC: return "COSC";
+            case COTC: return "COTC";
+            case CPEC: return "CPEC";
+            case CPGC: return "CPGC";
+            case CPHC: return "CPHC";
+            case CPRC: return "CPRC";
+            case CPSC: return "CPSC";
+            case CPYC: return "CPYC";
+            case CROC: return "CROC";
+            case CRPC: return "CRPC";
+            case CSUC: return "CSUC";
+            case CTSC: return "CTSC";
+            case CURC: return "CURC";
+            case CVSC: return "CVSC";
+            case LGPC: return "LGPC";
+            case _ACTCREDENTIALEDCAREPROVISIONPROGRAMCODE: return "_ActCredentialedCareProvisionProgramCode";
+            case AALC: return "AALC";
+            case AAMC: return "AAMC";
+            case ABHC: return "ABHC";
+            case ACAC: return "ACAC";
+            case ACHC: return "ACHC";
+            case AHOC: return "AHOC";
+            case ALTC: return "ALTC";
+            case AOSC: return "AOSC";
+            case CACS: return "CACS";
+            case CAMI: return "CAMI";
+            case CAST: return "CAST";
+            case CBAR: return "CBAR";
+            case CCAD: return "CCAD";
+            case CCAR: return "CCAR";
+            case CDEP: return "CDEP";
+            case CDGD: return "CDGD";
+            case CDIA: return "CDIA";
+            case CEPI: return "CEPI";
+            case CFEL: return "CFEL";
+            case CHFC: return "CHFC";
+            case CHRO: return "CHRO";
+            case CHYP: return "CHYP";
+            case CMIH: return "CMIH";
+            case CMSC: return "CMSC";
+            case COJR: return "COJR";
+            case CONC: return "CONC";
+            case COPD: return "COPD";
+            case CORT: return "CORT";
+            case CPAD: return "CPAD";
+            case CPND: return "CPND";
+            case CPST: return "CPST";
+            case CSDM: return "CSDM";
+            case CSIC: return "CSIC";
+            case CSLD: return "CSLD";
+            case CSPT: return "CSPT";
+            case CTBU: return "CTBU";
+            case CVDC: return "CVDC";
+            case CWMA: return "CWMA";
+            case CWOH: return "CWOH";
+            case _ACTENCOUNTERCODE: return "_ActEncounterCode";
+            case AMB: return "AMB";
+            case EMER: return "EMER";
+            case FLD: return "FLD";
+            case HH: return "HH";
+            case IMP: return "IMP";
+            case ACUTE: return "ACUTE";
+            case NONAC: return "NONAC";
+            case PRENC: return "PRENC";
+            case SS: return "SS";
+            case VR: return "VR";
+            case _ACTMEDICALSERVICECODE: return "_ActMedicalServiceCode";
+            case ALC: return "ALC";
+            case CARD: return "CARD";
+            case CHR: return "CHR";
+            case DNTL: return "DNTL";
+            case DRGRHB: return "DRGRHB";
+            case GENRL: return "GENRL";
+            case MED: return "MED";
+            case OBS: return "OBS";
+            case ONC: return "ONC";
+            case PALL: return "PALL";
+            case PED: return "PED";
+            case PHAR: return "PHAR";
+            case PHYRHB: return "PHYRHB";
+            case PSYCH: return "PSYCH";
+            case SURG: return "SURG";
+            case _ACTCLAIMATTACHMENTCATEGORYCODE: return "_ActClaimAttachmentCategoryCode";
+            case AUTOATTCH: return "AUTOATTCH";
+            case DOCUMENT: return "DOCUMENT";
+            case HEALTHREC: return "HEALTHREC";
+            case IMG: return "IMG";
+            case LABRESULTS: return "LABRESULTS";
+            case MODEL: return "MODEL";
+            case WIATTCH: return "WIATTCH";
+            case XRAY: return "XRAY";
+            case _ACTCONSENTTYPE: return "_ActConsentType";
+            case ICOL: return "ICOL";
+            case IDSCL: return "IDSCL";
+            case INFA: return "INFA";
+            case INFAO: return "INFAO";
+            case INFASO: return "INFASO";
+            case IRDSCL: return "IRDSCL";
+            case RESEARCH: return "RESEARCH";
+            case RSDID: return "RSDID";
+            case RSREID: return "RSREID";
+            case _ACTCONTAINERREGISTRATIONCODE: return "_ActContainerRegistrationCode";
+            case ID: return "ID";
+            case IP: return "IP";
+            case L: return "L";
+            case M: return "M";
+            case O: return "O";
+            case R: return "R";
+            case X: return "X";
+            case _ACTCONTROLVARIABLE: return "_ActControlVariable";
+            case AUTO: return "AUTO";
+            case ENDC: return "ENDC";
+            case REFLEX: return "REFLEX";
+            case _ACTCOVERAGECONFIRMATIONCODE: return "_ActCoverageConfirmationCode";
+            case _ACTCOVERAGEAUTHORIZATIONCONFIRMATIONCODE: return "_ActCoverageAuthorizationConfirmationCode";
+            case AUTH: return "AUTH";
+            case NAUTH: return "NAUTH";
+            case _ACTCOVERAGEELIGIBILITYCONFIRMATIONCODE: return "_ActCoverageEligibilityConfirmationCode";
+            case ELG: return "ELG";
+            case NELG: return "NELG";
+            case _ACTCOVERAGELIMITCODE: return "_ActCoverageLimitCode";
+            case _ACTCOVERAGEQUANTITYLIMITCODE: return "_ActCoverageQuantityLimitCode";
+            case COVPRD: return "COVPRD";
+            case LFEMX: return "LFEMX";
+            case NETAMT: return "NETAMT";
+            case PRDMX: return "PRDMX";
+            case UNITPRICE: return "UNITPRICE";
+            case UNITQTY: return "UNITQTY";
+            case COVMX: return "COVMX";
+            case _ACTCOVEREDPARTYLIMITCODE: return "_ActCoveredPartyLimitCode";
+            case _ACTCOVERAGETYPECODE: return "_ActCoverageTypeCode";
+            case _ACTINSURANCEPOLICYCODE: return "_ActInsurancePolicyCode";
+            case EHCPOL: return "EHCPOL";
+            case HSAPOL: return "HSAPOL";
+            case AUTOPOL: return "AUTOPOL";
+            case COL: return "COL";
+            case UNINSMOT: return "UNINSMOT";
+            case PUBLICPOL: return "PUBLICPOL";
+            case DENTPRG: return "DENTPRG";
+            case DISEASEPRG: return "DISEASEPRG";
+            case CANPRG: return "CANPRG";
+            case ENDRENAL: return "ENDRENAL";
+            case HIVAIDS: return "HIVAIDS";
+            case MANDPOL: return "MANDPOL";
+            case MENTPRG: return "MENTPRG";
+            case SAFNET: return "SAFNET";
+            case SUBPRG: return "SUBPRG";
+            case SUBSIDIZ: return "SUBSIDIZ";
+            case SUBSIDMC: return "SUBSIDMC";
+            case SUBSUPP: return "SUBSUPP";
+            case WCBPOL: return "WCBPOL";
+            case _ACTINSURANCETYPECODE: return "_ActInsuranceTypeCode";
+            case _ACTHEALTHINSURANCETYPECODE: return "_ActHealthInsuranceTypeCode";
+            case DENTAL: return "DENTAL";
+            case DISEASE: return "DISEASE";
+            case DRUGPOL: return "DRUGPOL";
+            case HIP: return "HIP";
+            case LTC: return "LTC";
+            case MCPOL: return "MCPOL";
+            case POS: return "POS";
+            case HMO: return "HMO";
+            case PPO: return "PPO";
+            case MENTPOL: return "MENTPOL";
+            case SUBPOL: return "SUBPOL";
+            case VISPOL: return "VISPOL";
+            case DIS: return "DIS";
+            case EWB: return "EWB";
+            case FLEXP: return "FLEXP";
+            case LIFE: return "LIFE";
+            case ANNU: return "ANNU";
+            case TLIFE: return "TLIFE";
+            case ULIFE: return "ULIFE";
+            case PNC: return "PNC";
+            case REI: return "REI";
+            case SURPL: return "SURPL";
+            case UMBRL: return "UMBRL";
+            case _ACTPROGRAMTYPECODE: return "_ActProgramTypeCode";
+            case CHAR: return "CHAR";
+            case CRIME: return "CRIME";
+            case EAP: return "EAP";
+            case GOVEMP: return "GOVEMP";
+            case HIRISK: return "HIRISK";
+            case IND: return "IND";
+            case MILITARY: return "MILITARY";
+            case RETIRE: return "RETIRE";
+            case SOCIAL: return "SOCIAL";
+            case VET: return "VET";
+            case _ACTDETECTEDISSUEMANAGEMENTCODE: return "_ActDetectedIssueManagementCode";
+            case _ACTADMINISTRATIVEDETECTEDISSUEMANAGEMENTCODE: return "_ActAdministrativeDetectedIssueManagementCode";
+            case _AUTHORIZATIONISSUEMANAGEMENTCODE: return "_AuthorizationIssueManagementCode";
+            case EMAUTH: return "EMAUTH";
+            case _21: return "21";
+            case _1: return "1";
+            case _19: return "19";
+            case _2: return "2";
+            case _22: return "22";
+            case _23: return "23";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case _6: return "6";
+            case _7: return "7";
+            case _14: return "14";
+            case _15: return "15";
+            case _16: return "16";
+            case _17: return "17";
+            case _18: return "18";
+            case _20: return "20";
+            case _8: return "8";
+            case _10: return "10";
+            case _11: return "11";
+            case _12: return "12";
+            case _13: return "13";
+            case _9: return "9";
+            case _ACTEXPOSURECODE: return "_ActExposureCode";
+            case CHLDCARE: return "CHLDCARE";
+            case CONVEYNC: return "CONVEYNC";
+            case HLTHCARE: return "HLTHCARE";
+            case HOMECARE: return "HOMECARE";
+            case HOSPPTNT: return "HOSPPTNT";
+            case HOSPVSTR: return "HOSPVSTR";
+            case HOUSEHLD: return "HOUSEHLD";
+            case INMATE: return "INMATE";
+            case INTIMATE: return "INTIMATE";
+            case LTRMCARE: return "LTRMCARE";
+            case PLACE: return "PLACE";
+            case PTNTCARE: return "PTNTCARE";
+            case SCHOOL2: return "SCHOOL2";
+            case SOCIAL2: return "SOCIAL2";
+            case SUBSTNCE: return "SUBSTNCE";
+            case TRAVINT: return "TRAVINT";
+            case WORK2: return "WORK2";
+            case _ACTFINANCIALTRANSACTIONCODE: return "_ActFinancialTransactionCode";
+            case CHRG: return "CHRG";
+            case REV: return "REV";
+            case _ACTINCIDENTCODE: return "_ActIncidentCode";
+            case MVA: return "MVA";
+            case SCHOOL: return "SCHOOL";
+            case SPT: return "SPT";
+            case WPA: return "WPA";
+            case _ACTINFORMATIONACCESSCODE: return "_ActInformationAccessCode";
+            case ACADR: return "ACADR";
+            case ACALL: return "ACALL";
+            case ACALLG: return "ACALLG";
+            case ACCONS: return "ACCONS";
+            case ACDEMO: return "ACDEMO";
+            case ACDI: return "ACDI";
+            case ACIMMUN: return "ACIMMUN";
+            case ACLAB: return "ACLAB";
+            case ACMED: return "ACMED";
+            case ACMEDC: return "ACMEDC";
+            case ACMEN: return "ACMEN";
+            case ACOBS: return "ACOBS";
+            case ACPOLPRG: return "ACPOLPRG";
+            case ACPROV: return "ACPROV";
+            case ACPSERV: return "ACPSERV";
+            case ACSUBSTAB: return "ACSUBSTAB";
+            case _ACTINFORMATIONACCESSCONTEXTCODE: return "_ActInformationAccessContextCode";
+            case INFAUT: return "INFAUT";
+            case INFCON: return "INFCON";
+            case INFCRT: return "INFCRT";
+            case INFDNG: return "INFDNG";
+            case INFEMER: return "INFEMER";
+            case INFPWR: return "INFPWR";
+            case INFREG: return "INFREG";
+            case _ACTINFORMATIONCATEGORYCODE: return "_ActInformationCategoryCode";
+            case ALLCAT: return "ALLCAT";
+            case ALLGCAT: return "ALLGCAT";
+            case ARCAT: return "ARCAT";
+            case COBSCAT: return "COBSCAT";
+            case DEMOCAT: return "DEMOCAT";
+            case DICAT: return "DICAT";
+            case IMMUCAT: return "IMMUCAT";
+            case LABCAT: return "LABCAT";
+            case MEDCCAT: return "MEDCCAT";
+            case MENCAT: return "MENCAT";
+            case PSVCCAT: return "PSVCCAT";
+            case RXCAT: return "RXCAT";
+            case _ACTINVOICEELEMENTCODE: return "_ActInvoiceElementCode";
+            case _ACTINVOICEADJUDICATIONPAYMENTCODE: return "_ActInvoiceAdjudicationPaymentCode";
+            case _ACTINVOICEADJUDICATIONPAYMENTGROUPCODE: return "_ActInvoiceAdjudicationPaymentGroupCode";
+            case ALEC: return "ALEC";
+            case BONUS: return "BONUS";
+            case CFWD: return "CFWD";
+            case EDU: return "EDU";
+            case EPYMT: return "EPYMT";
+            case GARN: return "GARN";
+            case INVOICE: return "INVOICE";
+            case PINV: return "PINV";
+            case PPRD: return "PPRD";
+            case PROA: return "PROA";
+            case RECOV: return "RECOV";
+            case RETRO: return "RETRO";
+            case TRAN: return "TRAN";
+            case _ACTINVOICEADJUDICATIONPAYMENTSUMMARYCODE: return "_ActInvoiceAdjudicationPaymentSummaryCode";
+            case INVTYPE: return "INVTYPE";
+            case PAYEE: return "PAYEE";
+            case PAYOR: return "PAYOR";
+            case SENDAPP: return "SENDAPP";
+            case _ACTINVOICEDETAILCODE: return "_ActInvoiceDetailCode";
+            case _ACTINVOICEDETAILCLINICALPRODUCTCODE: return "_ActInvoiceDetailClinicalProductCode";
+            case UNSPSC: return "UNSPSC";
+            case _ACTINVOICEDETAILDRUGPRODUCTCODE: return "_ActInvoiceDetailDrugProductCode";
+            case GTIN: return "GTIN";
+            case UPC: return "UPC";
+            case _ACTINVOICEDETAILGENERICCODE: return "_ActInvoiceDetailGenericCode";
+            case _ACTINVOICEDETAILGENERICADJUDICATORCODE: return "_ActInvoiceDetailGenericAdjudicatorCode";
+            case COIN: return "COIN";
+            case COPAYMENT: return "COPAYMENT";
+            case DEDUCTIBLE: return "DEDUCTIBLE";
+            case PAY: return "PAY";
+            case SPEND: return "SPEND";
+            case COINS: return "COINS";
+            case _ACTINVOICEDETAILGENERICMODIFIERCODE: return "_ActInvoiceDetailGenericModifierCode";
+            case AFTHRS: return "AFTHRS";
+            case ISOL: return "ISOL";
+            case OOO: return "OOO";
+            case _ACTINVOICEDETAILGENERICPROVIDERCODE: return "_ActInvoiceDetailGenericProviderCode";
+            case CANCAPT: return "CANCAPT";
+            case DSC: return "DSC";
+            case ESA: return "ESA";
+            case FFSTOP: return "FFSTOP";
+            case FNLFEE: return "FNLFEE";
+            case FRSTFEE: return "FRSTFEE";
+            case MARKUP: return "MARKUP";
+            case MISSAPT: return "MISSAPT";
+            case PERFEE: return "PERFEE";
+            case PERMBNS: return "PERMBNS";
+            case RESTOCK: return "RESTOCK";
+            case TRAVEL: return "TRAVEL";
+            case URGENT: return "URGENT";
+            case _ACTINVOICEDETAILTAXCODE: return "_ActInvoiceDetailTaxCode";
+            case FST: return "FST";
+            case HST: return "HST";
+            case PST: return "PST";
+            case _ACTINVOICEDETAILPREFERREDACCOMMODATIONCODE: return "_ActInvoiceDetailPreferredAccommodationCode";
+            case _ACTENCOUNTERACCOMMODATIONCODE: return "_ActEncounterAccommodationCode";
+            case _HL7ACCOMMODATIONCODE: return "_HL7AccommodationCode";
+            case I: return "I";
+            case P: return "P";
+            case S: return "S";
+            case SP: return "SP";
+            case W: return "W";
+            case _ACTINVOICEDETAILCLINICALSERVICECODE: return "_ActInvoiceDetailClinicalServiceCode";
+            case _ACTINVOICEGROUPCODE: return "_ActInvoiceGroupCode";
+            case _ACTINVOICEINTERGROUPCODE: return "_ActInvoiceInterGroupCode";
+            case CPNDDRGING: return "CPNDDRGING";
+            case CPNDINDING: return "CPNDINDING";
+            case CPNDSUPING: return "CPNDSUPING";
+            case DRUGING: return "DRUGING";
+            case FRAMEING: return "FRAMEING";
+            case LENSING: return "LENSING";
+            case PRDING: return "PRDING";
+            case _ACTINVOICEROOTGROUPCODE: return "_ActInvoiceRootGroupCode";
+            case CPINV: return "CPINV";
+            case CSINV: return "CSINV";
+            case CSPINV: return "CSPINV";
+            case FININV: return "FININV";
+            case OHSINV: return "OHSINV";
+            case PAINV: return "PAINV";
+            case RXCINV: return "RXCINV";
+            case RXDINV: return "RXDINV";
+            case SBFINV: return "SBFINV";
+            case VRXINV: return "VRXINV";
+            case _ACTINVOICEELEMENTSUMMARYCODE: return "_ActInvoiceElementSummaryCode";
+            case _INVOICEELEMENTADJUDICATED: return "_InvoiceElementAdjudicated";
+            case ADNFPPELAT: return "ADNFPPELAT";
+            case ADNFPPELCT: return "ADNFPPELCT";
+            case ADNFPPMNAT: return "ADNFPPMNAT";
+            case ADNFPPMNCT: return "ADNFPPMNCT";
+            case ADNFSPELAT: return "ADNFSPELAT";
+            case ADNFSPELCT: return "ADNFSPELCT";
+            case ADNFSPMNAT: return "ADNFSPMNAT";
+            case ADNFSPMNCT: return "ADNFSPMNCT";
+            case ADNPPPELAT: return "ADNPPPELAT";
+            case ADNPPPELCT: return "ADNPPPELCT";
+            case ADNPPPMNAT: return "ADNPPPMNAT";
+            case ADNPPPMNCT: return "ADNPPPMNCT";
+            case ADNPSPELAT: return "ADNPSPELAT";
+            case ADNPSPELCT: return "ADNPSPELCT";
+            case ADNPSPMNAT: return "ADNPSPMNAT";
+            case ADNPSPMNCT: return "ADNPSPMNCT";
+            case ADPPPPELAT: return "ADPPPPELAT";
+            case ADPPPPELCT: return "ADPPPPELCT";
+            case ADPPPPMNAT: return "ADPPPPMNAT";
+            case ADPPPPMNCT: return "ADPPPPMNCT";
+            case ADPPSPELAT: return "ADPPSPELAT";
+            case ADPPSPELCT: return "ADPPSPELCT";
+            case ADPPSPMNAT: return "ADPPSPMNAT";
+            case ADPPSPMNCT: return "ADPPSPMNCT";
+            case ADRFPPELAT: return "ADRFPPELAT";
+            case ADRFPPELCT: return "ADRFPPELCT";
+            case ADRFPPMNAT: return "ADRFPPMNAT";
+            case ADRFPPMNCT: return "ADRFPPMNCT";
+            case ADRFSPELAT: return "ADRFSPELAT";
+            case ADRFSPELCT: return "ADRFSPELCT";
+            case ADRFSPMNAT: return "ADRFSPMNAT";
+            case ADRFSPMNCT: return "ADRFSPMNCT";
+            case _INVOICEELEMENTPAID: return "_InvoiceElementPaid";
+            case PDNFPPELAT: return "PDNFPPELAT";
+            case PDNFPPELCT: return "PDNFPPELCT";
+            case PDNFPPMNAT: return "PDNFPPMNAT";
+            case PDNFPPMNCT: return "PDNFPPMNCT";
+            case PDNFSPELAT: return "PDNFSPELAT";
+            case PDNFSPELCT: return "PDNFSPELCT";
+            case PDNFSPMNAT: return "PDNFSPMNAT";
+            case PDNFSPMNCT: return "PDNFSPMNCT";
+            case PDNPPPELAT: return "PDNPPPELAT";
+            case PDNPPPELCT: return "PDNPPPELCT";
+            case PDNPPPMNAT: return "PDNPPPMNAT";
+            case PDNPPPMNCT: return "PDNPPPMNCT";
+            case PDNPSPELAT: return "PDNPSPELAT";
+            case PDNPSPELCT: return "PDNPSPELCT";
+            case PDNPSPMNAT: return "PDNPSPMNAT";
+            case PDNPSPMNCT: return "PDNPSPMNCT";
+            case PDPPPPELAT: return "PDPPPPELAT";
+            case PDPPPPELCT: return "PDPPPPELCT";
+            case PDPPPPMNAT: return "PDPPPPMNAT";
+            case PDPPPPMNCT: return "PDPPPPMNCT";
+            case PDPPSPELAT: return "PDPPSPELAT";
+            case PDPPSPELCT: return "PDPPSPELCT";
+            case PDPPSPMNAT: return "PDPPSPMNAT";
+            case PDPPSPMNCT: return "PDPPSPMNCT";
+            case _INVOICEELEMENTSUBMITTED: return "_InvoiceElementSubmitted";
+            case SBBLELAT: return "SBBLELAT";
+            case SBBLELCT: return "SBBLELCT";
+            case SBNFELAT: return "SBNFELAT";
+            case SBNFELCT: return "SBNFELCT";
+            case SBPDELAT: return "SBPDELAT";
+            case SBPDELCT: return "SBPDELCT";
+            case _ACTINVOICEOVERRIDECODE: return "_ActInvoiceOverrideCode";
+            case COVGE: return "COVGE";
+            case EFORM: return "EFORM";
+            case FAX: return "FAX";
+            case GFTH: return "GFTH";
+            case LATE: return "LATE";
+            case MANUAL: return "MANUAL";
+            case OOJ: return "OOJ";
+            case ORTHO: return "ORTHO";
+            case PAPER: return "PAPER";
+            case PIE: return "PIE";
+            case PYRDELAY: return "PYRDELAY";
+            case REFNR: return "REFNR";
+            case REPSERV: return "REPSERV";
+            case UNRELAT: return "UNRELAT";
+            case VERBAUTH: return "VERBAUTH";
+            case _ACTLISTCODE: return "_ActListCode";
+            case _ACTOBSERVATIONLIST: return "_ActObservationList";
+            case CARELIST: return "CARELIST";
+            case CONDLIST: return "CONDLIST";
+            case INTOLIST: return "INTOLIST";
+            case PROBLIST: return "PROBLIST";
+            case RISKLIST: return "RISKLIST";
+            case GOALLIST: return "GOALLIST";
+            case _ACTTHERAPYDURATIONWORKINGLISTCODE: return "_ActTherapyDurationWorkingListCode";
+            case _ACTMEDICATIONTHERAPYDURATIONWORKINGLISTCODE: return "_ActMedicationTherapyDurationWorkingListCode";
+            case ACU: return "ACU";
+            case CHRON: return "CHRON";
+            case ONET: return "ONET";
+            case PRN: return "PRN";
+            case MEDLIST: return "MEDLIST";
+            case CURMEDLIST: return "CURMEDLIST";
+            case DISCMEDLIST: return "DISCMEDLIST";
+            case HISTMEDLIST: return "HISTMEDLIST";
+            case _ACTMONITORINGPROTOCOLCODE: return "_ActMonitoringProtocolCode";
+            case CTLSUB: return "CTLSUB";
+            case INV: return "INV";
+            case LU: return "LU";
+            case OTC: return "OTC";
+            case RX: return "RX";
+            case SA: return "SA";
+            case SAC: return "SAC";
+            case _ACTNONOBSERVATIONINDICATIONCODE: return "_ActNonObservationIndicationCode";
+            case IND01: return "IND01";
+            case IND02: return "IND02";
+            case IND03: return "IND03";
+            case IND04: return "IND04";
+            case IND05: return "IND05";
+            case _ACTOBSERVATIONVERIFICATIONTYPE: return "_ActObservationVerificationType";
+            case VFPAPER: return "VFPAPER";
+            case _ACTPAYMENTCODE: return "_ActPaymentCode";
+            case ACH: return "ACH";
+            case CHK: return "CHK";
+            case DDP: return "DDP";
+            case NON: return "NON";
+            case _ACTPHARMACYSUPPLYTYPE: return "_ActPharmacySupplyType";
+            case DF: return "DF";
+            case EM: return "EM";
+            case SO: return "SO";
+            case FF: return "FF";
+            case FFC: return "FFC";
+            case FFP: return "FFP";
+            case FFSS: return "FFSS";
+            case TF: return "TF";
+            case FS: return "FS";
+            case MS: return "MS";
+            case RF: return "RF";
+            case UD: return "UD";
+            case RFC: return "RFC";
+            case RFCS: return "RFCS";
+            case RFF: return "RFF";
+            case RFFS: return "RFFS";
+            case RFP: return "RFP";
+            case RFPS: return "RFPS";
+            case RFS: return "RFS";
+            case TB: return "TB";
+            case TBS: return "TBS";
+            case UDE: return "UDE";
+            case _ACTPOLICYTYPE: return "_ActPolicyType";
+            case _ACTPRIVACYPOLICY: return "_ActPrivacyPolicy";
+            case _ACTCONSENTDIRECTIVE: return "_ActConsentDirective";
+            case EMRGONLY: return "EMRGONLY";
+            case GRANTORCHOICE: return "GRANTORCHOICE";
+            case IMPLIED: return "IMPLIED";
+            case IMPLIEDD: return "IMPLIEDD";
+            case NOCONSENT: return "NOCONSENT";
+            case NOPP: return "NOPP";
+            case OPTIN: return "OPTIN";
+            case OPTINR: return "OPTINR";
+            case OPTOUT: return "OPTOUT";
+            case OPTOUTE: return "OPTOUTE";
+            case _ACTPRIVACYLAW: return "_ActPrivacyLaw";
+            case _ACTUSPRIVACYLAW: return "_ActUSPrivacyLaw";
+            case _42CFRPART2: return "42CFRPart2";
+            case COMMONRULE: return "CommonRule";
+            case HIPAANOPP: return "HIPAANOPP";
+            case HIPAAPSYNOTES: return "HIPAAPsyNotes";
+            case HIPAASELFPAY: return "HIPAASelfPay";
+            case TITLE38SECTION7332: return "Title38Section7332";
+            case _INFORMATIONSENSITIVITYPOLICY: return "_InformationSensitivityPolicy";
+            case _ACTINFORMATIONSENSITIVITYPOLICY: return "_ActInformationSensitivityPolicy";
+            case ETH: return "ETH";
+            case GDIS: return "GDIS";
+            case HIV: return "HIV";
+            case PSY: return "PSY";
+            case SCA: return "SCA";
+            case SOC: return "SOC";
+            case SDV: return "SDV";
+            case SEX: return "SEX";
+            case STD: return "STD";
+            case TBOO: return "TBOO";
+            case SICKLE: return "SICKLE";
+            case _ENTITYSENSITIVITYPOLICYTYPE: return "_EntitySensitivityPolicyType";
+            case DEMO: return "DEMO";
+            case DOB: return "DOB";
+            case GENDER: return "GENDER";
+            case LIVARG: return "LIVARG";
+            case MARST: return "MARST";
+            case RACE: return "RACE";
+            case REL: return "REL";
+            case _ROLEINFORMATIONSENSITIVITYPOLICY: return "_RoleInformationSensitivityPolicy";
+            case B: return "B";
+            case EMPL: return "EMPL";
+            case LOCIS: return "LOCIS";
+            case SSP: return "SSP";
+            case ADOL: return "ADOL";
+            case CEL: return "CEL";
+            case DIA: return "DIA";
+            case DRGIS: return "DRGIS";
+            case EMP: return "EMP";
+            case PDS: return "PDS";
+            case PRS: return "PRS";
+            case COMPT: return "COMPT";
+            case HRCOMPT: return "HRCOMPT";
+            case RESCOMPT: return "RESCOMPT";
+            case RMGTCOMPT: return "RMGTCOMPT";
+            case ACTTRUSTPOLICYTYPE: return "ActTrustPolicyType";
+            case TRSTACCRD: return "TRSTACCRD";
+            case TRSTAGRE: return "TRSTAGRE";
+            case TRSTASSUR: return "TRSTASSUR";
+            case TRSTCERT: return "TRSTCERT";
+            case TRSTFWK: return "TRSTFWK";
+            case TRSTMEC: return "TRSTMEC";
+            case COVPOL: return "COVPOL";
+            case SECURITYPOLICY: return "SecurityPolicy";
+            case OBLIGATIONPOLICY: return "ObligationPolicy";
+            case ANONY: return "ANONY";
+            case AOD: return "AOD";
+            case AUDIT: return "AUDIT";
+            case AUDTR: return "AUDTR";
+            case CPLYCC: return "CPLYCC";
+            case CPLYCD: return "CPLYCD";
+            case CPLYJPP: return "CPLYJPP";
+            case CPLYOPP: return "CPLYOPP";
+            case CPLYOSP: return "CPLYOSP";
+            case CPLYPOL: return "CPLYPOL";
+            case DECLASSIFYLABEL: return "DECLASSIFYLABEL";
+            case DEID: return "DEID";
+            case DELAU: return "DELAU";
+            case DOWNGRDLABEL: return "DOWNGRDLABEL";
+            case DRIVLABEL: return "DRIVLABEL";
+            case ENCRYPT: return "ENCRYPT";
+            case ENCRYPTR: return "ENCRYPTR";
+            case ENCRYPTT: return "ENCRYPTT";
+            case ENCRYPTU: return "ENCRYPTU";
+            case HUAPRV: return "HUAPRV";
+            case LABEL: return "LABEL";
+            case MASK: return "MASK";
+            case MINEC: return "MINEC";
+            case PERSISTLABEL: return "PERSISTLABEL";
+            case PRIVMARK: return "PRIVMARK";
+            case PSEUD: return "PSEUD";
+            case REDACT: return "REDACT";
+            case UPGRDLABEL: return "UPGRDLABEL";
+            case REFRAINPOLICY: return "RefrainPolicy";
+            case NOAUTH: return "NOAUTH";
+            case NOCOLLECT: return "NOCOLLECT";
+            case NODSCLCD: return "NODSCLCD";
+            case NODSCLCDS: return "NODSCLCDS";
+            case NOINTEGRATE: return "NOINTEGRATE";
+            case NOLIST: return "NOLIST";
+            case NOMOU: return "NOMOU";
+            case NOORGPOL: return "NOORGPOL";
+            case NOPAT: return "NOPAT";
+            case NOPERSISTP: return "NOPERSISTP";
+            case NORDSCLCD: return "NORDSCLCD";
+            case NORDSCLCDS: return "NORDSCLCDS";
+            case NORDSCLW: return "NORDSCLW";
+            case NORELINK: return "NORELINK";
+            case NOREUSE: return "NOREUSE";
+            case NOVIP: return "NOVIP";
+            case ORCON: return "ORCON";
+            case _ACTPRODUCTACQUISITIONCODE: return "_ActProductAcquisitionCode";
+            case LOAN: return "LOAN";
+            case RENT: return "RENT";
+            case TRANSFER: return "TRANSFER";
+            case SALE: return "SALE";
+            case _ACTSPECIMENTRANSPORTCODE: return "_ActSpecimenTransportCode";
+            case SREC: return "SREC";
+            case SSTOR: return "SSTOR";
+            case STRAN: return "STRAN";
+            case _ACTSPECIMENTREATMENTCODE: return "_ActSpecimenTreatmentCode";
+            case ACID: return "ACID";
+            case ALK: return "ALK";
+            case DEFB: return "DEFB";
+            case FILT: return "FILT";
+            case LDLP: return "LDLP";
+            case NEUT: return "NEUT";
+            case RECA: return "RECA";
+            case UFIL: return "UFIL";
+            case _ACTSUBSTANCEADMINISTRATIONCODE: return "_ActSubstanceAdministrationCode";
+            case DRUG: return "DRUG";
+            case FD: return "FD";
+            case IMMUNIZ: return "IMMUNIZ";
+            case BOOSTER: return "BOOSTER";
+            case INITIMMUNIZ: return "INITIMMUNIZ";
+            case _ACTTASKCODE: return "_ActTaskCode";
+            case OE: return "OE";
+            case LABOE: return "LABOE";
+            case MEDOE: return "MEDOE";
+            case PATDOC: return "PATDOC";
+            case ALLERLREV: return "ALLERLREV";
+            case CLINNOTEE: return "CLINNOTEE";
+            case DIAGLISTE: return "DIAGLISTE";
+            case DISCHINSTE: return "DISCHINSTE";
+            case DISCHSUME: return "DISCHSUME";
+            case PATEDUE: return "PATEDUE";
+            case PATREPE: return "PATREPE";
+            case PROBLISTE: return "PROBLISTE";
+            case RADREPE: return "RADREPE";
+            case IMMLREV: return "IMMLREV";
+            case REMLREV: return "REMLREV";
+            case WELLREMLREV: return "WELLREMLREV";
+            case PATINFO: return "PATINFO";
+            case ALLERLE: return "ALLERLE";
+            case CDSREV: return "CDSREV";
+            case CLINNOTEREV: return "CLINNOTEREV";
+            case DISCHSUMREV: return "DISCHSUMREV";
+            case DIAGLISTREV: return "DIAGLISTREV";
+            case IMMLE: return "IMMLE";
+            case LABRREV: return "LABRREV";
+            case MICRORREV: return "MICRORREV";
+            case MICROORGRREV: return "MICROORGRREV";
+            case MICROSENSRREV: return "MICROSENSRREV";
+            case MLREV: return "MLREV";
+            case MARWLREV: return "MARWLREV";
+            case OREV: return "OREV";
+            case PATREPREV: return "PATREPREV";
+            case PROBLISTREV: return "PROBLISTREV";
+            case RADREPREV: return "RADREPREV";
+            case REMLE: return "REMLE";
+            case WELLREMLE: return "WELLREMLE";
+            case RISKASSESS: return "RISKASSESS";
+            case FALLRISK: return "FALLRISK";
+            case _ACTTRANSPORTATIONMODECODE: return "_ActTransportationModeCode";
+            case _ACTPATIENTTRANSPORTATIONMODECODE: return "_ActPatientTransportationModeCode";
+            case AFOOT: return "AFOOT";
+            case AMBT: return "AMBT";
+            case AMBAIR: return "AMBAIR";
+            case AMBGRND: return "AMBGRND";
+            case AMBHELO: return "AMBHELO";
+            case LAWENF: return "LAWENF";
+            case PRVTRN: return "PRVTRN";
+            case PUBTRN: return "PUBTRN";
+            case _OBSERVATIONTYPE: return "_ObservationType";
+            case _ACTSPECOBSCODE: return "_ActSpecObsCode";
+            case ARTBLD: return "ARTBLD";
+            case DILUTION: return "DILUTION";
+            case AUTOHIGH: return "AUTO-HIGH";
+            case AUTOLOW: return "AUTO-LOW";
+            case PRE: return "PRE";
+            case RERUN: return "RERUN";
+            case EVNFCTS: return "EVNFCTS";
+            case INTFR: return "INTFR";
+            case FIBRIN: return "FIBRIN";
+            case HEMOLYSIS: return "HEMOLYSIS";
+            case ICTERUS: return "ICTERUS";
+            case LIPEMIA: return "LIPEMIA";
+            case VOLUME: return "VOLUME";
+            case AVAILABLE: return "AVAILABLE";
+            case CONSUMPTION: return "CONSUMPTION";
+            case CURRENT: return "CURRENT";
+            case INITIAL: return "INITIAL";
+            case _ANNOTATIONTYPE: return "_AnnotationType";
+            case _ACTPATIENTANNOTATIONTYPE: return "_ActPatientAnnotationType";
+            case ANNDI: return "ANNDI";
+            case ANNGEN: return "ANNGEN";
+            case ANNIMM: return "ANNIMM";
+            case ANNLAB: return "ANNLAB";
+            case ANNMED: return "ANNMED";
+            case _GENETICOBSERVATIONTYPE: return "_GeneticObservationType";
+            case GENE: return "GENE";
+            case _IMMUNIZATIONOBSERVATIONTYPE: return "_ImmunizationObservationType";
+            case OBSANTC: return "OBSANTC";
+            case OBSANTV: return "OBSANTV";
+            case _INDIVIDUALCASESAFETYREPORTTYPE: return "_IndividualCaseSafetyReportType";
+            case PATADVEVNT: return "PAT_ADV_EVNT";
+            case VACPROBLEM: return "VAC_PROBLEM";
+            case _LOINCOBSERVATIONACTCONTEXTAGETYPE: return "_LOINCObservationActContextAgeType";
+            case _216119: return "21611-9";
+            case _216127: return "21612-7";
+            case _295535: return "29553-5";
+            case _305250: return "30525-0";
+            case _309724: return "30972-4";
+            case _MEDICATIONOBSERVATIONTYPE: return "_MedicationObservationType";
+            case REPHALFLIFE: return "REP_HALF_LIFE";
+            case SPLCOATING: return "SPLCOATING";
+            case SPLCOLOR: return "SPLCOLOR";
+            case SPLIMAGE: return "SPLIMAGE";
+            case SPLIMPRINT: return "SPLIMPRINT";
+            case SPLSCORING: return "SPLSCORING";
+            case SPLSHAPE: return "SPLSHAPE";
+            case SPLSIZE: return "SPLSIZE";
+            case SPLSYMBOL: return "SPLSYMBOL";
+            case _OBSERVATIONISSUETRIGGERCODEDOBSERVATIONTYPE: return "_ObservationIssueTriggerCodedObservationType";
+            case _CASETRANSMISSIONMODE: return "_CaseTransmissionMode";
+            case AIRTRNS: return "AIRTRNS";
+            case ANANTRNS: return "ANANTRNS";
+            case ANHUMTRNS: return "ANHUMTRNS";
+            case BDYFLDTRNS: return "BDYFLDTRNS";
+            case BLDTRNS: return "BLDTRNS";
+            case DERMTRNS: return "DERMTRNS";
+            case ENVTRNS: return "ENVTRNS";
+            case FECTRNS: return "FECTRNS";
+            case FOMTRNS: return "FOMTRNS";
+            case FOODTRNS: return "FOODTRNS";
+            case HUMHUMTRNS: return "HUMHUMTRNS";
+            case INDTRNS: return "INDTRNS";
+            case LACTTRNS: return "LACTTRNS";
+            case NOSTRNS: return "NOSTRNS";
+            case PARTRNS: return "PARTRNS";
+            case PLACTRNS: return "PLACTRNS";
+            case SEXTRNS: return "SEXTRNS";
+            case TRNSFTRNS: return "TRNSFTRNS";
+            case VECTRNS: return "VECTRNS";
+            case WATTRNS: return "WATTRNS";
+            case _OBSERVATIONQUALITYMEASUREATTRIBUTE: return "_ObservationQualityMeasureAttribute";
+            case AGGREGATE: return "AGGREGATE";
+            case CMPMSRMTH: return "CMPMSRMTH";
+            case CMPMSRSCRWGHT: return "CMPMSRSCRWGHT";
+            case COPY: return "COPY";
+            case CRS: return "CRS";
+            case DEF: return "DEF";
+            case DISC: return "DISC";
+            case FINALDT: return "FINALDT";
+            case GUIDE: return "GUIDE";
+            case IDUR: return "IDUR";
+            case ITMCNT: return "ITMCNT";
+            case KEY: return "KEY";
+            case MEDT: return "MEDT";
+            case MSD: return "MSD";
+            case MSRADJ: return "MSRADJ";
+            case MSRAGG: return "MSRAGG";
+            case MSRIMPROV: return "MSRIMPROV";
+            case MSRJUR: return "MSRJUR";
+            case MSRRPTR: return "MSRRPTR";
+            case MSRRPTTIME: return "MSRRPTTIME";
+            case MSRSCORE: return "MSRSCORE";
+            case MSRSET: return "MSRSET";
+            case MSRTOPIC: return "MSRTOPIC";
+            case MSRTP: return "MSRTP";
+            case MSRTYPE: return "MSRTYPE";
+            case RAT: return "RAT";
+            case REF: return "REF";
+            case SDE: return "SDE";
+            case STRAT: return "STRAT";
+            case TRANF: return "TRANF";
+            case USE: return "USE";
+            case _OBSERVATIONSEQUENCETYPE: return "_ObservationSequenceType";
+            case TIMEABSOLUTE: return "TIME_ABSOLUTE";
+            case TIMERELATIVE: return "TIME_RELATIVE";
+            case _OBSERVATIONSERIESTYPE: return "_ObservationSeriesType";
+            case _ECGOBSERVATIONSERIESTYPE: return "_ECGObservationSeriesType";
+            case REPRESENTATIVEBEAT: return "REPRESENTATIVE_BEAT";
+            case RHYTHM: return "RHYTHM";
+            case _PATIENTIMMUNIZATIONRELATEDOBSERVATIONTYPE: return "_PatientImmunizationRelatedObservationType";
+            case CLSSRM: return "CLSSRM";
+            case GRADE: return "GRADE";
+            case SCHL: return "SCHL";
+            case SCHLDIV: return "SCHLDIV";
+            case TEACHER: return "TEACHER";
+            case _POPULATIONINCLUSIONOBSERVATIONTYPE: return "_PopulationInclusionObservationType";
+            case DENEX: return "DENEX";
+            case DENEXCEP: return "DENEXCEP";
+            case DENOM: return "DENOM";
+            case IPOP: return "IPOP";
+            case IPPOP: return "IPPOP";
+            case MSRPOPL: return "MSRPOPL";
+            case MSRPOPLEX: return "MSRPOPLEX";
+            case NUMER: return "NUMER";
+            case NUMEX: return "NUMEX";
+            case _PREFERENCEOBSERVATIONTYPE: return "_PreferenceObservationType";
+            case PREFSTRENGTH: return "PREFSTRENGTH";
+            case ADVERSEREACTION: return "ADVERSE_REACTION";
+            case ASSERTION: return "ASSERTION";
+            case CASESER: return "CASESER";
+            case CDIO: return "CDIO";
+            case CRIT: return "CRIT";
+            case CTMO: return "CTMO";
+            case DX: return "DX";
+            case ADMDX: return "ADMDX";
+            case DISDX: return "DISDX";
+            case INTDX: return "INTDX";
+            case NOI: return "NOI";
+            case GISTIER: return "GISTIER";
+            case HHOBS: return "HHOBS";
+            case ISSUE: return "ISSUE";
+            case _ACTADMINISTRATIVEDETECTEDISSUECODE: return "_ActAdministrativeDetectedIssueCode";
+            case _ACTADMINISTRATIVEAUTHORIZATIONDETECTEDISSUECODE: return "_ActAdministrativeAuthorizationDetectedIssueCode";
+            case NAT: return "NAT";
+            case SUPPRESSED: return "SUPPRESSED";
+            case VALIDAT: return "VALIDAT";
+            case KEY204: return "KEY204";
+            case KEY205: return "KEY205";
+            case COMPLY: return "COMPLY";
+            case DUPTHPY: return "DUPTHPY";
+            case DUPTHPCLS: return "DUPTHPCLS";
+            case DUPTHPGEN: return "DUPTHPGEN";
+            case ABUSE: return "ABUSE";
+            case FRAUD: return "FRAUD";
+            case PLYDOC: return "PLYDOC";
+            case PLYPHRM: return "PLYPHRM";
+            case DOSE: return "DOSE";
+            case DOSECOND: return "DOSECOND";
+            case DOSEDUR: return "DOSEDUR";
+            case DOSEDURH: return "DOSEDURH";
+            case DOSEDURHIND: return "DOSEDURHIND";
+            case DOSEDURL: return "DOSEDURL";
+            case DOSEDURLIND: return "DOSEDURLIND";
+            case DOSEH: return "DOSEH";
+            case DOSEHINDA: return "DOSEHINDA";
+            case DOSEHIND: return "DOSEHIND";
+            case DOSEHINDSA: return "DOSEHINDSA";
+            case DOSEHINDW: return "DOSEHINDW";
+            case DOSEIVL: return "DOSEIVL";
+            case DOSEIVLIND: return "DOSEIVLIND";
+            case DOSEL: return "DOSEL";
+            case DOSELINDA: return "DOSELINDA";
+            case DOSELIND: return "DOSELIND";
+            case DOSELINDSA: return "DOSELINDSA";
+            case DOSELINDW: return "DOSELINDW";
+            case MDOSE: return "MDOSE";
+            case OBSA: return "OBSA";
+            case AGE: return "AGE";
+            case ADALRT: return "ADALRT";
+            case GEALRT: return "GEALRT";
+            case PEALRT: return "PEALRT";
+            case COND: return "COND";
+            case HGHT: return "HGHT";
+            case LACT: return "LACT";
+            case PREG: return "PREG";
+            case WGHT: return "WGHT";
+            case CREACT: return "CREACT";
+            case GEN: return "GEN";
+            case GEND: return "GEND";
+            case LAB: return "LAB";
+            case REACT: return "REACT";
+            case ALGY: return "ALGY";
+            case INT: return "INT";
+            case RREACT: return "RREACT";
+            case RALG: return "RALG";
+            case RAR: return "RAR";
+            case RINT: return "RINT";
+            case BUS: return "BUS";
+            case CODEINVAL: return "CODE_INVAL";
+            case CODEDEPREC: return "CODE_DEPREC";
+            case FORMAT: return "FORMAT";
+            case ILLEGAL: return "ILLEGAL";
+            case LENRANGE: return "LEN_RANGE";
+            case LENLONG: return "LEN_LONG";
+            case LENSHORT: return "LEN_SHORT";
+            case MISSCOND: return "MISSCOND";
+            case MISSMAND: return "MISSMAND";
+            case NODUPS: return "NODUPS";
+            case NOPERSIST: return "NOPERSIST";
+            case REPRANGE: return "REP_RANGE";
+            case MAXOCCURS: return "MAXOCCURS";
+            case MINOCCURS: return "MINOCCURS";
+            case _ACTADMINISTRATIVERULEDETECTEDISSUECODE: return "_ActAdministrativeRuleDetectedIssueCode";
+            case KEY206: return "KEY206";
+            case OBSOLETE: return "OBSOLETE";
+            case _ACTSUPPLIEDITEMDETECTEDISSUECODE: return "_ActSuppliedItemDetectedIssueCode";
+            case _ADMINISTRATIONDETECTEDISSUECODE: return "_AdministrationDetectedIssueCode";
+            case _APPROPRIATENESSDETECTEDISSUECODE: return "_AppropriatenessDetectedIssueCode";
+            case _INTERACTIONDETECTEDISSUECODE: return "_InteractionDetectedIssueCode";
+            case FOOD: return "FOOD";
+            case TPROD: return "TPROD";
+            case DRG: return "DRG";
+            case NHP: return "NHP";
+            case NONRX: return "NONRX";
+            case PREVINEF: return "PREVINEF";
+            case DACT: return "DACT";
+            case TIME: return "TIME";
+            case ALRTENDLATE: return "ALRTENDLATE";
+            case ALRTSTRTLATE: return "ALRTSTRTLATE";
+            case _TIMINGDETECTEDISSUECODE: return "_TimingDetectedIssueCode";
+            case ENDLATE: return "ENDLATE";
+            case STRTLATE: return "STRTLATE";
+            case _SUPPLYDETECTEDISSUECODE: return "_SupplyDetectedIssueCode";
+            case ALLDONE: return "ALLDONE";
+            case FULFIL: return "FULFIL";
+            case NOTACTN: return "NOTACTN";
+            case NOTEQUIV: return "NOTEQUIV";
+            case NOTEQUIVGEN: return "NOTEQUIVGEN";
+            case NOTEQUIVTHER: return "NOTEQUIVTHER";
+            case TIMING: return "TIMING";
+            case INTERVAL: return "INTERVAL";
+            case MINFREQ: return "MINFREQ";
+            case HELD: return "HELD";
+            case TOOLATE: return "TOOLATE";
+            case TOOSOON: return "TOOSOON";
+            case HISTORIC: return "HISTORIC";
+            case PATPREF: return "PATPREF";
+            case PATPREFALT: return "PATPREFALT";
+            case KSUBJ: return "KSUBJ";
+            case KSUBT: return "KSUBT";
+            case OINT: return "OINT";
+            case ALG: return "ALG";
+            case DALG: return "DALG";
+            case EALG: return "EALG";
+            case FALG: return "FALG";
+            case DINT: return "DINT";
+            case DNAINT: return "DNAINT";
+            case EINT: return "EINT";
+            case ENAINT: return "ENAINT";
+            case FINT: return "FINT";
+            case FNAINT: return "FNAINT";
+            case NAINT: return "NAINT";
+            case SEV: return "SEV";
+            case _FDALABELDATA: return "_FDALabelData";
+            case FDACOATING: return "FDACOATING";
+            case FDACOLOR: return "FDACOLOR";
+            case FDAIMPRINTCD: return "FDAIMPRINTCD";
+            case FDALOGO: return "FDALOGO";
+            case FDASCORING: return "FDASCORING";
+            case FDASHAPE: return "FDASHAPE";
+            case FDASIZE: return "FDASIZE";
+            case _ROIOVERLAYSHAPE: return "_ROIOverlayShape";
+            case CIRCLE: return "CIRCLE";
+            case ELLIPSE: return "ELLIPSE";
+            case POINT: return "POINT";
+            case POLY: return "POLY";
+            case C: return "C";
+            case DIET: return "DIET";
+            case BR: return "BR";
+            case DM: return "DM";
+            case FAST: return "FAST";
+            case FORMULA: return "FORMULA";
+            case GF: return "GF";
+            case LF: return "LF";
+            case LP: return "LP";
+            case LQ: return "LQ";
+            case LS: return "LS";
+            case N: return "N";
+            case NF: return "NF";
+            case PAF: return "PAF";
+            case PAR: return "PAR";
+            case RD: return "RD";
+            case SCH: return "SCH";
+            case SUPPLEMENT: return "SUPPLEMENT";
+            case T: return "T";
+            case VLI: return "VLI";
+            case DRUGPRG: return "DRUGPRG";
+            case F: return "F";
+            case PRLMN: return "PRLMN";
+            case SECOBS: return "SECOBS";
+            case SECCATOBS: return "SECCATOBS";
+            case SECCLASSOBS: return "SECCLASSOBS";
+            case SECCONOBS: return "SECCONOBS";
+            case SECINTOBS: return "SECINTOBS";
+            case SECALTINTOBS: return "SECALTINTOBS";
+            case SECDATINTOBS: return "SECDATINTOBS";
+            case SECINTCONOBS: return "SECINTCONOBS";
+            case SECINTPRVOBS: return "SECINTPRVOBS";
+            case SECINTPRVABOBS: return "SECINTPRVABOBS";
+            case SECINTPRVRBOBS: return "SECINTPRVRBOBS";
+            case SECINTSTOBS: return "SECINTSTOBS";
+            case SECTRSTOBS: return "SECTRSTOBS";
+            case TRSTACCRDOBS: return "TRSTACCRDOBS";
+            case TRSTAGREOBS: return "TRSTAGREOBS";
+            case TRSTCERTOBS: return "TRSTCERTOBS";
+            case TRSTFWKOBS: return "TRSTFWKOBS";
+            case TRSTLOAOBS: return "TRSTLOAOBS";
+            case TRSTMECOBS: return "TRSTMECOBS";
+            case SUBSIDFFS: return "SUBSIDFFS";
+            case WRKCOMP: return "WRKCOMP";
+            case _ACTPROCEDURECODE: return "_ActProcedureCode";
+            case _ACTBILLABLESERVICECODE: return "_ActBillableServiceCode";
+            case _HL7DEFINEDACTCODES: return "_HL7DefinedActCodes";
+            case COPAY: return "COPAY";
+            case DEDUCT: return "DEDUCT";
+            case DOSEIND: return "DOSEIND";
+            case PRA: return "PRA";
+            case STORE: return "STORE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActCode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ACTACCOUNTCODE: return "An account represents a grouping of financial transactions that are tracked and reported together with a single balance. 	 	Examples of account codes (types) are Patient billing accounts (collection of charges), Cost centers; Cash.";
+            case ACCTRECEIVABLE: return "An account for collecting charges, reversals, adjustments and payments, including deductibles, copayments, coinsurance (financial transactions) credited or debited to the account receivable account for a patient's encounter.";
+            case CASH: return "Cash";
+            case CC: return "Description: Types of advance payment to be made on a plastic card usually issued by a financial institution used of purchasing services and/or products.";
+            case AE: return "American Express";
+            case DN: return "Diner's Club";
+            case DV: return "Discover Card";
+            case MC: return "Master Card";
+            case V: return "Visa";
+            case PBILLACCT: return "An account representing charges and credits (financial transactions) for a patient's encounter.";
+            case _ACTADJUDICATIONCODE: return "Includes coded responses that will occur as a result of the adjudication of an electronic invoice at a summary level and provides guidance on interpretation of the referenced adjudication results.";
+            case _ACTADJUDICATIONGROUPCODE: return "Catagorization of grouping criteria for the associated transactions and/or summary (totals, subtotals).";
+            case CONT: return "Transaction counts and value totals by Contract Identifier.";
+            case DAY: return "Transaction counts and value totals for each calendar day within the date range specified.";
+            case LOC: return "Transaction counts and value totals by service location (e.g clinic).";
+            case MONTH: return "Transaction counts and value totals for each calendar month within the date range specified.";
+            case PERIOD: return "Transaction counts and value totals for the date range specified.";
+            case PROV: return "Transaction counts and value totals by Provider Identifier.";
+            case WEEK: return "Transaction counts and value totals for each calendar week within the date range specified.";
+            case YEAR: return "Transaction counts and value totals for each calendar year within the date range specified.";
+            case AA: return "The invoice element has been accepted for payment but one or more adjustment(s) have been made to one or more invoice element line items (component charges).  \r\n\n                        Also includes the concept 'Adjudicate as zero' and items not covered under a particular Policy.  \r\n\n                        Invoice element can be reversed (nullified).  \r\n\n                        Recommend that the invoice element is saved for DUR (Drug Utilization Reporting).";
+            case ANF: return "The invoice element has been accepted for payment but one or more adjustment(s) have been made to one or more invoice element line items (component charges) without changing the amount.  \r\n\n                        Invoice element can be reversed (nullified).  \r\n\n                        Recommend that the invoice element is saved for DUR (Drug Utilization Reporting).";
+            case AR: return "The invoice element has passed through the adjudication process but payment is refused due to one or more reasons.\r\n\n                        Includes items such as patient not covered, or invoice element is not constructed according to payer rules (e.g. 'invoice submitted too late').\r\n\n                        If one invoice element line item in the invoice element structure is rejected, the remaining line items may not be adjudicated and the complete group is treated as rejected.\r\n\n                        A refused invoice element can be forwarded to the next payer (for Coordination of Benefits) or modified and resubmitted to refusing payer.\r\n\n                        Invoice element cannot be reversed (nullified) as there is nothing to reverse.  \r\n\n                        Recommend that the invoice element is not saved for DUR (Drug Utilization Reporting).";
+            case AS: return "The invoice element was/will be paid exactly as submitted, without financial adjustment(s).\r\n\n                        If the dollar amount stays the same, but the billing codes have been amended or financial adjustments have been applied through the adjudication process, the invoice element is treated as \"Adjudicated with Adjustment\".\r\n\n                        If information items are included in the adjudication results that do not affect the monetary amounts paid, then this is still Adjudicated as Submitted (e.g. 'reached Plan Maximum on this Claim').  \r\n\n                        Invoice element can be reversed (nullified).  \r\n\n                        Recommend that the invoice element is saved for DUR (Drug Utilization Reporting).";
+            case _ACTADJUDICATIONRESULTACTIONCODE: return "Actions to be carried out by the recipient of the Adjudication Result information.";
+            case DISPLAY: return "The adjudication result associated is to be displayed to the receiver of the adjudication result.";
+            case FORM: return "The adjudication result associated is to be printed on the specified form, which is then provided to the covered party.";
+            case _ACTBILLABLEMODIFIERCODE: return "Definition:An identifying modifier code for healthcare interventions or procedures.";
+            case CPTM: return "Description:CPT modifier codes are found in Appendix A of CPT 2000 Standard Edition.";
+            case HCPCSA: return "Description:HCPCS Level II (HCFA-assigned) and Carrier-assigned (Level III) modifiers are reported in Appendix A of CPT 2000 Standard Edition and in the Medicare Bulletin.";
+            case _ACTBILLINGARRANGEMENTCODE: return "The type of provision(s)  made for reimbursing for the deliver of healthcare services and/or goods provided by a Provider, over a specified period.";
+            case BLK: return "A billing arrangement where a Provider charges a lump sum to provide a prescribed group (volume) of services to a single patient which occur over a period of time.  Services included in the block may vary.  \r\n\n                        This billing arrangement is also known as Program of Care for some specific Payors and Program Fees for other Payors.";
+            case CAP: return "A billing arrangement where the payment made to a Provider is determined by analyzing one or more demographic attributes about the persons/patients who are enrolled with the Provider (in their practice).";
+            case CONTF: return "A billing arrangement where a Provider charges a lump sum to provide a particular volume of one or more interventions/procedures or groups of interventions/procedures.";
+            case FINBILL: return "A billing arrangement where a Provider charges for non-clinical items.  This includes interest in arrears, mileage, etc.  Clinical content is not 	included in Invoices submitted with this type of billing arrangement.";
+            case ROST: return "A billing arrangement where funding is based on a list of individuals registered as patients of the Provider.";
+            case SESS: return "A billing arrangement where a Provider charges a sum to provide a group (volume) of interventions/procedures to one or more patients within a defined period of time, typically on the same date.  Interventions/procedures included in the session may vary.";
+            case FFS: return "A billing arrangement where a Provider charges a separate fee for each intervention/procedure/event or product.\r\n\n                        Fee for Service is used when an individual intervention/procedure/event is used for billing purposes.  In other words, fees are associated with the  intervention/procedure/event.  For example, a specific CCI (Canadian Classification of Interventions) code has an associated fee and is used for billing purposes.";
+            case FFPS: return "A first fill where the quantity supplied is less than one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a partial fill might be for only 30 tablets.) and also where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets)";
+            case FFCS: return "A first fill where the quantity supplied is equal to one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a complete fill would be for the full 90 tablets) and also where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).";
+            case TFS: return "A fill where a small portion is provided to allow for determination of the therapy effectiveness and patient tolerance and also where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).";
+            case _ACTBOUNDEDROICODE: return "Type of bounded ROI.";
+            case ROIFS: return "A fully specified bounded Region of Interest (ROI) delineates a ROI in which only those dimensions participate that are specified by boundary criteria, whereas all other dimensions are excluded.  For example a ROI to mark an episode of \"ST elevation\" in a subset of the EKG leads V2, V3, and V4 would include 4 boundaries, one each for time, V2, V3, and V4.";
+            case ROIPS: return "A partially specified bounded Region of Interest (ROI) specifies a ROI in which at least all values in the dimensions specified by the boundary criteria participate. For example, if an episode of ventricular fibrillations (VFib) is observed, it usually doesn't make sense to exclude any EKG leads from the observation and the partially specified ROI would contain only one boundary for time indicating the time interval where VFib was observed.";
+            case _ACTCAREPROVISIONCODE: return "Description:The type and scope of responsibility taken-on by the performer of the Act for a specific subject of care.";
+            case _ACTCREDENTIALEDCARECODE: return "Description:The type and scope of legal and/or professional responsibility taken-on by the performer of the Act for a specific subject of care as described by a credentialing agency, i.e. government or non-government agency. Failure in executing this Act may result in loss of credential to the person or organization who participates as performer of the Act. Excludes employment agreements.\r\n\n                        \n                           Example:Hospital license; physician license; clinic accreditation.";
+            case _ACTCREDENTIALEDCAREPROVISIONPERSONCODE: return "Description:The type and scope of legal and/or professional responsibility taken-on by the performer of the Act for a specific subject of care as described by an agency for credentialing individuals.";
+            case CACC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CAIC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CAMC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CANC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CAPC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CBGC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CCCC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CCGC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CCPC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CCSC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CDEC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CDRC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CEMC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CFPC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CIMC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CMGC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CNEC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board";
+            case CNMC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CNQC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CNSC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case COGC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case COMC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case COPC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case COSC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case COTC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CPEC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CPGC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CPHC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CPRC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CPSC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CPYC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CROC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CRPC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CSUC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CTSC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CURC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case CVSC: return "Description:Scope of responsibility taken on for specialty care as defined by the respective Specialty Board.";
+            case LGPC: return "Description:Scope of responsibility taken-on for physician care of a patient as defined by a governmental licensing agency.";
+            case _ACTCREDENTIALEDCAREPROVISIONPROGRAMCODE: return "Description:The type and scope of legal and/or professional responsibility taken-on by the performer of the Act for a specific subject of care as described by an agency for credentialing programs within organizations.";
+            case AALC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.";
+            case AAMC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.";
+            case ABHC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.";
+            case ACAC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.";
+            case ACHC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.";
+            case AHOC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.";
+            case ALTC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.";
+            case AOSC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the respective accreditation agency.";
+            case CACS: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CAMI: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CAST: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CBAR: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CCAD: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CCAR: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CDEP: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CDGD: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CDIA: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CEPI: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CFEL: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CHFC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CHRO: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CHYP: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CMIH: return "Description:.";
+            case CMSC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case COJR: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CONC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case COPD: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CORT: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CPAD: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CPND: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CPST: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CSDM: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CSIC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CSLD: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CSPT: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CTBU: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CVDC: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CWMA: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case CWOH: return "Description:Scope of responsibility taken on by an organization for care of a patient as defined by the disease management certification agency.";
+            case _ACTENCOUNTERCODE: return "Domain provides codes that qualify the ActEncounterClass (ENC)";
+            case AMB: return "A comprehensive term for health care provided in a healthcare facility (e.g. a practitioneraTMs office, clinic setting, or hospital) on a nonresident basis. The term ambulatory usually implies that the patient has come to the location and is not assigned to a bed. Sometimes referred to as an outpatient encounter.";
+            case EMER: return "A patient encounter that takes place at a dedicated healthcare service delivery location where the patient receives immediate evaluation and treatment, provided until the patient can be discharged or responsibility for the patient's care is transferred elsewhere (for example, the patient could be admitted as an inpatient or transferred to another facility.)";
+            case FLD: return "A patient encounter that takes place both outside a dedicated service delivery location and outside a patient's residence. Example locations might include an accident site and at a supermarket.";
+            case HH: return "Healthcare encounter that takes place in the residence of the patient or a designee";
+            case IMP: return "A patient encounter where a patient is admitted by a hospital or equivalent facility, assigned to a location where patients generally stay at least overnight and provided with room, board, and continuous nursing service.";
+            case ACUTE: return "An acute inpatient encounter.";
+            case NONAC: return "Any category of inpatient encounter except 'acute'";
+            case PRENC: return "A patient encounter where patient is scheduled or planned to receive service delivery in the future, and the patient is given a pre-admission account number. When the patient comes back for subsequent service, the pre-admission encounter is selected and is encapsulated into the service registration, and a new account number is generated.\r\n\n                        \n                           Usage Note: This is intended to be used in advance of encounter types such as ambulatory, inpatient encounter, virtual, etc.";
+            case SS: return "An encounter where the patient is admitted to a health care facility for a predetermined length of time, usually less than 24 hours.";
+            case VR: return "A patient encounter where the patient and the practitioner(s) are not in the same physical location. Examples include telephone conference, email exchange, robotic surgery, and televideo conference.";
+            case _ACTMEDICALSERVICECODE: return "General category of medical service provided to the patient during their encounter.";
+            case ALC: return "Provision of Alternate Level of Care to a patient in an acute bed.  Patient is waiting for placement in a long-term care facility and is unable to return home.";
+            case CARD: return "Provision of diagnosis and treatment of diseases and disorders affecting the heart";
+            case CHR: return "Provision of recurring care for chronic illness.";
+            case DNTL: return "Provision of treatment for oral health and/or dental surgery.";
+            case DRGRHB: return "Provision of treatment for drug abuse.";
+            case GENRL: return "General care performed by a general practitioner or family doctor as a responsible provider for a patient.";
+            case MED: return "Provision of diagnostic and/or therapeutic treatment.";
+            case OBS: return "Provision of care of women during pregnancy, childbirth and immediate postpartum period.  Also known as Maternity.";
+            case ONC: return "Provision of treatment and/or diagnosis related to tumors and/or cancer.";
+            case PALL: return "Provision of care for patients who are living or dying from an advanced illness.";
+            case PED: return "Provision of diagnosis and treatment of diseases and disorders affecting children.";
+            case PHAR: return "Pharmaceutical care performed by a pharmacist.";
+            case PHYRHB: return "Provision of treatment for physical injury.";
+            case PSYCH: return "Provision of treatment of psychiatric disorder relating to mental illness.";
+            case SURG: return "Provision of surgical treatment.";
+            case _ACTCLAIMATTACHMENTCATEGORYCODE: return "Description: Coded types of attachments included to support a healthcare claim.";
+            case AUTOATTCH: return "Description: Automobile Information Attachment";
+            case DOCUMENT: return "Description: Document Attachment";
+            case HEALTHREC: return "Description: Health Record Attachment";
+            case IMG: return "Description: Image Attachment";
+            case LABRESULTS: return "Description: Lab Results Attachment";
+            case MODEL: return "Description: Digital Model Attachment";
+            case WIATTCH: return "Description: Work Injury related additional Information Attachment";
+            case XRAY: return "Description: Digital X-Ray Attachment";
+            case _ACTCONSENTTYPE: return "Definition: The type of consent directive, e.g., to consent or dissent to collect, access, or use in specific ways within an EHRS or for health information exchange; or to disclose  health information  for purposes such as research.";
+            case ICOL: return "Definition: Consent to have healthcare information collected in an electronic health record.  This entails that the information may be used in analysis, modified, updated.";
+            case IDSCL: return "Definition: Consent to have collected healthcare information disclosed.";
+            case INFA: return "Definition: Consent to access healthcare information.";
+            case INFAO: return "Definition: Consent to access or \"read\" only, which entails that the information is not to be copied, screen printed, saved, emailed, stored, re-disclosed or altered in any way.  This level ensures that data which is masked or to which access is restricted will not be.\r\n\n                        \n                           Example: Opened and then emailed or screen printed for use outside of the consent directive purpose.";
+            case INFASO: return "Definition: Consent to access and save only, which entails that access to the saved copy will remain locked.";
+            case IRDSCL: return "Definition: Information re-disclosed without the patient's consent.";
+            case RESEARCH: return "Definition: Consent to have healthcare information in an electronic health record accessed for research purposes.";
+            case RSDID: return "Definition: Consent to have de-identified healthcare information in an electronic health record that is accessed for research purposes, but without consent to re-identify the information under any circumstance.";
+            case RSREID: return "Definition: Consent to have de-identified healthcare information in an electronic health record that is accessed for research purposes re-identified under specific circumstances outlined in the consent.\r\n\n                        \n                           Example:: Where there is a need to inform the subject of potential health issues.";
+            case _ACTCONTAINERREGISTRATIONCODE: return "Constrains the ActCode to the domain of Container Registration";
+            case ID: return "Used by one system to inform another that it has received a container.";
+            case IP: return "Used by one system to inform another that the container is in position for specimen transfer (e.g., container removal from track, pipetting, etc.).";
+            case L: return "Used by one system to inform another that the container has been released from that system.";
+            case M: return "Used by one system to inform another that the container did not arrive at its next expected location.";
+            case O: return "Used by one system to inform another that the specific container is being processed by the equipment. It is useful as a response to a query about Container Status, when the specific step of the process is not relevant.";
+            case R: return "Status is used by one system to inform another that the processing has been completed, but the container has not been released from that system.";
+            case X: return "Used by one system to inform another that the container is no longer available within the scope of the system (e.g., tube broken or discarded).";
+            case _ACTCONTROLVARIABLE: return "An observation form that determines parameters or attributes of an Act. Examples are the settings of a ventilator machine as parameters of a ventilator treatment act; the controls on dillution factors of a chemical analyzer as a parameter of a laboratory observation act; the settings of a physiologic measurement assembly (e.g., time skew) or the position of the body while measuring blood pressure.\r\n\n                        Control variables are forms of observations because just as with clinical observations, the Observation.code determines the parameter and the Observation.value assigns the value. While control variables sometimes can be observed (by noting the control settings or an actually measured feedback loop) they are not primary observations, in the sense that a control variable without a primary act is of no use (e.g., it makes no sense to record a blood pressure position without recording a blood pressure, whereas it does make sense to record a systolic blood pressure without a diastolic blood pressure).";
+            case AUTO: return "Specifies whether or not automatic repeat testing is to be initiated on specimens.";
+            case ENDC: return "A baseline value for the measured test that is inherently contained in the diluent.  In the calculation of the actual result for the measured test, this baseline value is normally considered.";
+            case REFLEX: return "Specifies whether or not further testing may be automatically or manually initiated on specimens.";
+            case _ACTCOVERAGECONFIRMATIONCODE: return "Response to an insurance coverage eligibility query or authorization request.";
+            case _ACTCOVERAGEAUTHORIZATIONCONFIRMATIONCODE: return "Indication of authorization for healthcare service(s) and/or product(s).  If authorization is approved, funds are set aside.";
+            case AUTH: return "Authorization approved and funds have been set aside to pay for specified healthcare service(s) and/or product(s) within defined criteria for the authorization.";
+            case NAUTH: return "Authorization for specified healthcare service(s) and/or product(s) denied.";
+            case _ACTCOVERAGEELIGIBILITYCONFIRMATIONCODE: return "Indication of eligibility coverage for healthcare service(s) and/or product(s).";
+            case ELG: return "Insurance coverage is in effect for healthcare service(s) and/or product(s).";
+            case NELG: return "Insurance coverage is not in effect for healthcare service(s) and/or product(s). May optionally include reasons for the ineligibility.";
+            case _ACTCOVERAGELIMITCODE: return "Criteria that are applicable to the authorized coverage.";
+            case _ACTCOVERAGEQUANTITYLIMITCODE: return "Maximum amount paid or maximum number of services/products covered; or maximum amount or number covered during a specified time period under the policy or program.";
+            case COVPRD: return "Codes representing the time period during which coverage is available; or financial participation requirements are in effect.";
+            case LFEMX: return "Definition: Maximum amount paid by payer or covered party; or maximum number of services or products covered under the policy or program during a covered party's lifetime.";
+            case NETAMT: return "Maximum net amount that will be covered for the product or service specified.";
+            case PRDMX: return "Definition: Maximum amount paid by payer or covered party; or maximum number of services/products covered under the policy or program by time period specified by the effective time on the act.";
+            case UNITPRICE: return "Maximum unit price that will be covered for the authorized product or service.";
+            case UNITQTY: return "Maximum number of items that will be covered of the product or service specified.";
+            case COVMX: return "Definition: Codes representing the maximum coverate or financial participation requirements.";
+            case _ACTCOVEREDPARTYLIMITCODE: return "Codes representing the types of covered parties that may receive covered benefits under a policy or program.";
+            case _ACTCOVERAGETYPECODE: return "Definition: Set of codes indicating the type of insurance policy or program that pays for the cost of benefits provided to covered parties.";
+            case _ACTINSURANCEPOLICYCODE: return "Set of codes indicating the type of insurance policy or other source of funds to cover healthcare costs.";
+            case EHCPOL: return "Private insurance policy that provides coverage in addition to other policies (e.g. in addition to a Public Healthcare insurance policy).";
+            case HSAPOL: return "Insurance policy that provides for an allotment of funds replenished on a periodic (e.g. annual) basis. The use of the funds under this policy is at the 	discretion of the covered party.";
+            case AUTOPOL: return "Insurance policy for injuries sustained in an automobile accident.  Will also typically covered non-named parties to the policy, such as pedestrians 	and passengers.";
+            case COL: return "Definition: An automobile insurance policy under which the insurance company will cover the cost of damages to an automobile owned by the named insured that are caused by accident or intentionally by another party.";
+            case UNINSMOT: return "Definition: An automobile insurance policy under which the insurance company will indemnify a loss for which another motorist is liable if that motorist is unable to pay because he or she is uninsured.  Coverage under the policy applies to bodily injury damages only.  Injuries to the covered party caused by a hit-and-run driver are also covered.";
+            case PUBLICPOL: return "Insurance policy funded by a public health system such as a provincial or national health plan.  Examples include BC MSP (British Columbia 	Medical Services Plan) OHIP (Ontario Health Insurance Plan), NHS (National Health Service).";
+            case DENTPRG: return "Definition: A public or government health program that administers and funds coverage for dental care to assist program eligible who meet financial and health status criteria.";
+            case DISEASEPRG: return "Definition: A public or government health program that administers and funds coverage for health and social services to assist program eligible who meet financial and health status criteria related to a particular disease.\r\n\n                        \n                           Example: Reproductive health, sexually transmitted disease, and end renal disease programs.";
+            case CANPRG: return "Definition: A program that provides low-income, uninsured, and underserved women access to timely, high-quality screening and diagnostic services, to detect breast and cervical cancer at the earliest stages.\r\n\n                        \n                           Example: To improve women's access to screening for breast and cervical cancers, Congress passed the Breast and Cervical Cancer Mortality Prevention Act of 1990, which guided CDC in creating the National Breast and Cervical Cancer Early Detection Program (NBCCEDP), which  provides access to critical breast and cervical cancer screening services for underserved women in the United States.  An estimated 7 to 10% of U.S. women of screening age are eligible to receive NBCCEDP services. Federal guidelines establish an eligibility baseline to direct services to uninsured and underinsured women at or below 250% of federal poverty level; ages 18 to 64 for cervical screening; ages 40 to 64 for breast screening.";
+            case ENDRENAL: return "Definition: A public or government program that administers publicly funded coverage of kidney dialysis and kidney transplant services.\r\n\n                        Example: In the U.S., the Medicare End-stage Renal Disease program (ESRD), the National Kidney Foundation (NKF) American Kidney Fund (AKF) The Organ Transplant Fund.";
+            case HIVAIDS: return "Definition: Government administered and funded HIV-AIDS program for beneficiaries meeting financial and health status criteria.  Administration, funding levels, eligibility criteria, covered benefits, provider types, and financial participation are typically set by a regulatory process.  Payer responsibilities for administering the program may be delegated to contractors.\r\n\n                        \n                           Example: In the U.S., the Ryan White program, which is administered by the Health Resources and Services Administration.";
+            case MANDPOL: return "mandatory health program";
+            case MENTPRG: return "Definition: Government administered and funded mental health program for beneficiaries meeting financial and mental health status criteria.  Administration, funding levels, eligibility criteria, covered benefits, provider types, and financial participation are typically set by a regulatory process.  Payer responsibilities for administering the program may be delegated to contractors.\r\n\n                        \n                           Example: In the U.S., states receive funding for substance use programs from the Substance Abuse Mental Health Administration (SAMHSA).";
+            case SAFNET: return "Definition: Government administered and funded program to support provision of care to underserved populations through safety net clinics.\r\n\n                        \n                           Example: In the U.S., safety net providers such as federally qualified health centers (FQHC) receive funding under PHSA Section 330 grants administered by the Health Resources and Services Administration.";
+            case SUBPRG: return "Definition: Government administered and funded substance use program for beneficiaries meeting financial, substance use behavior, and health status criteria.  Beneficiaries may be required to enroll as a result of legal proceedings.  Administration, funding levels, eligibility criteria, covered benefits, provider types, and financial participation are typically set by a regulatory process.  Payer responsibilities for administering the program may be delegated to contractors.\r\n\n                        \n                           Example: In the U.S., states receive funding for substance use programs from the Substance Abuse Mental Health Administration (SAMHSA).";
+            case SUBSIDIZ: return "Definition: A government health program that provides coverage for health services to persons meeting eligibility criteria such as income, location of residence, access to other coverages, health condition, and age, the cost of which is to some extent subsidized by public funds.";
+            case SUBSIDMC: return "Definition: A government health program that provides coverage through managed care contracts for health services to persons meeting eligibility criteria such as income, location of residence, access to other coverages, health condition, and age, the cost of which is to some extent subsidized by public funds. \r\n\n                        \n                           Discussion: The structure and business processes for underwriting and administering a subsidized managed care program is further specified by the Underwriter and Payer Role.class and Role.code.";
+            case SUBSUPP: return "Definition: A government health program that provides coverage for health services to persons meeting eligibility criteria for a supplemental health policy or program such as income, location of residence, access to other coverages, health condition, and age, the cost of which is to some extent subsidized by public funds.\r\n\n                        \n                           Example:  Supplemental health coverage program may cover the cost of a health program or policy financial participations, such as the copays and the premiums, and may provide coverage for services in addition to those covered under the supplemented health program or policy.  In the U.S., Medicaid programs may pay the premium for a covered party who is also covered under the  Medicare program or a private health policy.\r\n\n                        \n                           Discussion: The structure and business processes for underwriting and administering a subsidized supplemental retiree health program is further specified by the Underwriter and Payer Role.class and Role.code.";
+            case WCBPOL: return "Insurance policy for injuries sustained in the work place or in the course of employment.";
+            case _ACTINSURANCETYPECODE: return "Definition: Set of codes indicating the type of insurance policy.  Insurance, in law and economics, is a form of risk management primarily used to hedge against the risk of potential financial loss. Insurance is defined as the equitable transfer of the risk of a potential loss, from one entity to another, in exchange for a premium and duty of care. A policy holder is an individual or an organization enters into a contract with an underwriter which stipulates that, in exchange for payment of a sum of money (a premium), one or more covered parties (insureds) is guaranteed compensation for losses resulting from certain perils under specified conditions.  The underwriter analyzes the risk of loss, makes a decision as to whether the risk is insurable, and prices the premium accordingly.  A policy provides benefits that indemnify or cover the cost of a loss incurred by a covered party, and may include coverage for services required to remediate a loss.  An insurance policy contains pertinent facts about the policy holder, the insurance coverage, the covered parties, and the insurer.  A policy may include exemptions and provisions specifying the extent to which the indemnification clause cannot be enforced for intentional tortious conduct of a covered party, e.g., whether the covered parties are jointly or severably insured.\r\n\n                        \n                           Discussion: In contrast to programs, an insurance policy has one or more policy holders, who own the policy.  The policy holder may be the covered party, a relative of the covered party, a partnership, or a corporation, e.g., an employer.  A subscriber of a self-insured health insurance policy is a policy holder.  A subscriber of an employer sponsored health insurance policy is holds a certificate of coverage, but is not a policy holder; the policy holder is the employer.  See CoveredRoleType.";
+            case _ACTHEALTHINSURANCETYPECODE: return "Definition: Set of codes indicating the type of health insurance policy that covers health services provided to covered parties.  A health insurance policy is a written contract for insurance between the insurance company and the policyholder, and contains pertinent facts about the policy owner (the policy holder), the health insurance coverage, the insured subscribers and dependents, and the insurer.  Health insurance is typically administered in accordance with a plan, which specifies (1) the type of health services and health conditions that will be covered under what circumstances (e.g., exclusion of a pre-existing condition, service must be deemed medically necessary; service must not be experimental; service must provided in accordance with a protocol; drug must be on a formulary; service must be prior authorized; or be a referral from a primary care provider); (2) the type and affiliation of providers (e.g., only allopathic physicians, only in network, only providers employed by an HMO); (3) financial participations required of covered parties (e.g., co-pays, coinsurance, deductibles, out-of-pocket); and (4) the manner in which services will be paid (e.g., under indemnity or fee-for-service health plans, the covered party typically pays out-of-pocket and then file a claim for reimbursement, while health plans that have contractual relationships with providers, i.e., network providers, typically do not allow the providers to bill the covered party for the cost of the service until after filing a claim with the payer and receiving reimbursement).";
+            case DENTAL: return "Definition: A health insurance policy that that covers benefits for dental services.";
+            case DISEASE: return "Definition: A health insurance policy that covers benefits for healthcare services provided for named conditions under the policy, e.g., cancer, diabetes, or HIV-AIDS.";
+            case DRUGPOL: return "Definition: A health insurance policy that covers benefits for prescription drugs, pharmaceuticals, and supplies.";
+            case HIP: return "Definition: A health insurance policy that covers healthcare benefits by protecting covered parties from medical expenses arising from health conditions, sickness, or accidental injury as well as preventive care. Health insurance policies explicitly exclude coverage for losses insured under a disability policy, workers' compensation program, liability insurance (including automobile insurance); or for medical expenses, coverage for on-site medical clinics or for limited dental or vision benefits when these are provided under a separate policy.\r\n\n                        \n                           Discussion: Health insurance policies are offered by health insurance plans that typically reimburse providers for covered services on a fee-for-service basis, that is, a fee that is the allowable amount that a provider may charge.  This is in contrast to managed care plans, which typically prepay providers a per-member/per-month amount or capitation as reimbursement for all covered services rendered.  Health insurance plans include indemnity and healthcare services plans.";
+            case LTC: return "Definition: An insurance policy that covers benefits for long-term care services people need when they no longer can care for themselves. This may be due to an accident, disability, prolonged illness or the simple process of aging. Long-term care services assist with activities of daily living including:\r\n\n                        \n                           \n                              Help at home with day-to-day activities, such as cooking, cleaning, bathing and dressing\r\n\n                           \n                           \n                              Care in the community, such as in an adult day care facility\r\n\n                           \n                           \n                              Supervised care provided in an assisted living facility\r\n\n                           \n                           \n                              Skilled care provided in a nursing home";
+            case MCPOL: return "Definition: Government mandated program providing coverage, disability income, and vocational rehabilitation for injuries sustained in the work place or in the course of employment.  Employers may either self-fund the program, purchase commercial coverage, or pay a premium to a government entity that administers the program.  Employees may be required to pay premiums toward the cost of coverage as well.\r\n\n                        Managed care policies specifically exclude coverage for losses insured under a disability policy, workers' compensation program, liability insurance (including automobile insurance); or for medical expenses, coverage for on-site medical clinics or for limited dental or vision benefits when these are provided under a separate policy.\r\n\n                        \n                           Discussion: Managed care policies are offered by managed care plans that contract with selected providers or health care organizations to provide comprehensive health care at a discount to covered parties and coordinate the financing and delivery of health care. Managed care uses medical protocols and procedures agreed on by the medical profession to be cost effective, also known as medical practice guidelines. Providers are typically reimbursed for covered services by a capitated amount on a per member per month basis that may reflect difference in the health status and level of services anticipated to be needed by the member.";
+            case POS: return "Definition: A policy for a health plan that has features of both an HMO and a FFS plan.  Like an HMO, a POS plan encourages the use its HMO network to maintain discounted fees with participating providers, but recognizes that sometimes covered parties want to choose their own provider.  The POS plan allows a covered party to use providers who are not part of the HMO network (non-participating providers).  However, there is a greater cost associated with choosing these non-network providers. A covered party will usually pay deductibles and coinsurances that are substantially higher than the payments when he or she uses a plan provider. Use of non-participating providers often requires the covered party to pay the provider directly and then to file a claim for reimbursement, like in an FFS plan.";
+            case HMO: return "Definition: A policy for a health plan that provides coverage for health care only through contracted or employed physicians and hospitals located in particular geographic or service areas.  HMOs emphasize prevention and early detection of illness. Eligibility to enroll in an HMO is determined by where a covered party lives or works.";
+            case PPO: return "Definition: A network-based, managed care plan that allows a covered party to choose any health care provider. However, if care is received from a \"preferred\" (participating in-network) provider, there are generally higher benefit coverage and lower deductibles.";
+            case MENTPOL: return "Definition: A health insurance policy that covers benefits for mental health services and prescriptions.";
+            case SUBPOL: return "Definition: A health insurance policy that covers benefits for substance use services.";
+            case VISPOL: return "Definition: Set of codes for a policy that provides coverage for health care expenses arising from vision services.\r\n\n                        A health insurance policy that covers benefits for vision care services, prescriptions, and products.";
+            case DIS: return "Definition: An insurance policy that provides a regular payment to compensate for income lost due to the covered party's inability to work because of illness or injury.";
+            case EWB: return "Definition: An insurance policy under a benefit plan run by an employer or employee organization for the purpose of providing benefits other than pension-related to employees and their families. Typically provides health-related benefits, benefits for disability, disease or unemployment, or day care and scholarship benefits, among others.  An employer sponsored health policy includes coverage of health care expenses arising from sickness or accidental injury, coverage for on-site medical clinics or for dental or vision benefits, which are typically provided under a separate policy.  Coverage excludes health care expenses covered by accident or disability, workers' compensation, liability or automobile insurance.";
+            case FLEXP: return "Definition:  An insurance policy that covers qualified benefits under a Flexible Benefit plan such as group medical insurance, long and short term disability income insurance, group term life insurance for employees only up to $50,000 face amount, specified disease coverage such as a cancer policy, dental and/or vision insurance, hospital indemnity insurance, accidental death and dismemberment insurance, a medical expense reimbursement plan and a dependent care reimbursement plan.\r\n\n                        \n                            Discussion: See UnderwriterRoleTypeCode flexible benefit plan which is defined as a benefit plan that allows employees to choose from several life, health, disability, dental, and other insurance plans according to their individual needs. Also known as cafeteria plans.  Authorized under Section 125 of the Revenue Act of 1978.";
+            case LIFE: return "Definition: A policy under which the insurer agrees to pay a sum of money upon the occurrence of the covered partys death. In return, the policyholder agrees to pay a stipulated amount called a premium at regular intervals.  Life insurance indemnifies the beneficiary for the loss of the insurable interest that a beneficiary has in the life of a covered party.  For persons related by blood, a substantial interest established through love and affection, and for all other persons, a lawful and substantial economic interest in having the life of the insured continue. An insurable interest is required when purchasing life insurance on another person. Specific exclusions are often written into the contract to limit the liability of the insurer; for example claims resulting from suicide or relating to war, riot and civil commotion.\r\n\n                        \n                           Discussion:A life insurance policy may be used by the covered party as a source of health care coverage in the case of  a viatical settlement, which is the sale of a life insurance policy by the policy owner, before the policy matures. Such a sale, at a price discounted from the face amount of the policy but usually in excess of the premiums paid or current cash surrender value, provides the seller an immediate cash settlement. Generally, viatical settlements involve insured individuals with a life expectancy of less than two years. In countries without state-subsidized healthcare and high healthcare costs (e.g. United States), this is a practical way to pay extremely high health insurance premiums that severely ill people face. Some people are also familiar with life settlements, which are similar transactions but involve insureds with longer life expectancies (two to fifteen years).";
+            case ANNU: return "Definition: A policy that, after an initial premium or premiums, pays out a sum at pre-determined intervals.\r\n\n                        For example, a policy holder may pay $10,000, and in return receive $150 each month until he dies; or $1,000 for each of 14 years or death benefits if he dies before the full term of the annuity has elapsed.";
+            case TLIFE: return "Definition: Life insurance under which the benefit is payable only if the insured dies during a specified period. If an insured dies during that period, the beneficiary receives the death payments. If the insured survives, the policy ends and the beneficiary receives nothing.";
+            case ULIFE: return "Definition: Life insurance under which the benefit is payable upon the insuredaTMs death or diagnosis of a terminal illness.  If an insured dies during that period, the beneficiary receives the death payments. If the insured survives, the policy ends and the beneficiary receives nothing";
+            case PNC: return "Definition: A type of insurance that covers damage to or loss of the policyholderaTMs property by providing payments for damages to property damage or the injury or death of living subjects.  The terms \"casualty\" and \"liability\" insurance are often used interchangeably. Both cover the policyholder's legal liability for damages caused to other persons and/or their property.";
+            case REI: return "Definition: An agreement between two or more insurance companies by which the risk of loss is proportioned. Thus the risk of loss is spread and a disproportionately large loss under a single policy does not fall on one insurance company. Acceptance by an insurer, called a reinsurer, of all or part of the risk of loss of another insurance company.\r\n\n                        \n                           Discussion: Reinsurance is a means by which an insurance company can protect itself against the risk of losses with other insurance companies. Individuals and corporations obtain insurance policies to provide protection for various risks (hurricanes, earthquakes, lawsuits, collisions, sickness and death, etc.). Reinsurers, in turn, provide insurance to insurance companies.\r\n\n                        For example, an HMO may purchase a reinsurance policy to protect itself from losing too much money from one insured's particularly expensive health care costs. An insurance company issuing an automobile liability policy, with a limit of $100,000 per accident may reinsure its liability in excess of $10,000. A fire insurance company which issues a large policy generally reinsures a portion of the risk with one or several other companies. Also called risk control insurance or stop-loss insurance.";
+            case SURPL: return "Definition: \n                        \r\n\n                        \n                           \n                              A risk or part of a risk for which there is no normal insurance market available.\r\n\n                           \n                           \n                              Insurance written by unauthorized insurance companies. Surplus lines insurance is insurance placed with unauthorized insurance companies through licensed surplus lines agents or brokers.";
+            case UMBRL: return "Definition: A form of insurance protection that provides additional liability coverage after the limits of your underlying policy are reached. An umbrella liability policy also protects you (the insured) in many situations not covered by the usual liability policies.";
+            case _ACTPROGRAMTYPECODE: return "Definition: A set of codes used to indicate coverage under a program.  A program is an organized structure for administering and funding coverage of a benefit package for covered parties meeting eligibility criteria, typically related to employment, health, financial, and demographic status. Programs are typically established or permitted by legislation with provisions for ongoing government oversight.  Regulations may mandate the structure of the program, the manner in which it is funded and administered, covered benefits, provider types, eligibility criteria and financial participation. A government agency may be charged with implementing the program in accordance to the regulation.  Risk of loss under a program in most cases would not meet what an underwriter would consider an insurable risk, i.e., the risk is not random in nature, not financially measurable, and likely requires subsidization with government funds.\r\n\n                        \n                           Discussion: Programs do not have policy holders or subscribers.  Program eligibles are enrolled based on health status, statutory eligibility, financial status, or age.  Program eligibles who are covered parties under the program may be referred to as members, beneficiaries, eligibles, or recipients.  Programs risk are underwritten by not for profit organizations such as governmental entities, and the beneficiaries typically do not pay for any or some portion of the cost of coverage.  See CoveredPartyRoleType.";
+            case CHAR: return "Definition: A program that covers the cost of services provided directly to a beneficiary who typically has no other source of coverage without charge.";
+            case CRIME: return "Definition: A program that covers the cost of services provided to crime victims for injuries or losses related to the occurrence of a crime.";
+            case EAP: return "Definition: An employee assistance program is run by an employer or employee organization for the purpose of providing benefits and covering all or part of the cost for employees to receive counseling, referrals, and advice in dealing with stressful issues in their lives. These may include substance abuse, bereavement, marital problems, weight issues, or general wellness issues.  The services are usually provided by a third-party, rather than the company itself, and the company receives only summary statistical data from the service provider. Employee's names and services received are kept confidential.";
+            case GOVEMP: return "Definition: A set of codes used to indicate a government program that is an organized structure for administering and funding coverage of a benefit package for covered parties meeting eligibility criteria, typically related to employment, health and financial status. Government programs are established or permitted by legislation with provisions for ongoing government oversight.  Regulation mandates the structure of the program, the manner in which it is funded and administered, covered benefits, provider types, eligibility criteria and financial participation. A government agency is charged with implementing the program in accordance to the regulation\r\n\n                        \n                           Example: Federal employee health benefit program in the U.S.";
+            case HIRISK: return "Definition: A government program that provides health coverage to individuals who are considered medically uninsurable or high risk, and who have been denied health insurance due to a serious health condition. In certain cases, it also applies to those who have been quoted very high premiums a\" again, due to a serious health condition.  The pool charges premiums for coverage.  Because the pool covers high-risk people, it incurs a higher level of claims than premiums can cover. The insurance industry pays into the pool to make up the difference and help it remain viable.";
+            case IND: return "Definition: Services provided directly and through contracted and operated indigenous peoples health programs.\r\n\n                        \n                           Example: Indian Health Service in the U.S.";
+            case MILITARY: return "Definition: A government program that provides coverage for health services to military personnel, retirees, and dependents.  A covered party who is a subscriber can choose from among Fee-for-Service (FFS) plans, and their Preferred Provider Organizations (PPO), or Plans offering a Point of Service (POS) Product, or Health Maintenance Organizations.\r\n\n                        \n                           Example: In the U.S., TRICARE, CHAMPUS.";
+            case RETIRE: return "Definition: A government mandated program with specific eligibility requirements based on premium contributions made during employment, length of employment, age, and employment status, e.g., being retired, disabled, or a dependent of a covered party under this program.   Benefits typically include ambulatory, inpatient, and long-term care, such as hospice care, home health care and respite care.";
+            case SOCIAL: return "Definition: A social service program funded by a public or governmental entity.\r\n\n                        \n                           Example: Programs providing habilitation, food, lodging, medicine, transportation, equipment, devices, products, education, training, counseling, alteration of living or work space, and other resources to persons meeting eligibility criteria.";
+            case VET: return "Definition: Services provided directly and through contracted and operated veteran health programs.";
+            case _ACTDETECTEDISSUEMANAGEMENTCODE: return "Codes dealing with the management of Detected Issue observations";
+            case _ACTADMINISTRATIVEDETECTEDISSUEMANAGEMENTCODE: return "Codes dealing with the management of Detected Issue observations for the administrative and patient administrative acts domains.";
+            case _AUTHORIZATIONISSUEMANAGEMENTCODE: return "Authorization Issue Management Code";
+            case EMAUTH: return "Used to temporarily override normal authorization rules to gain access to data in a case of emergency. Use of this override code will typically be monitored, and a procedure to verify its proper use may be triggered when used.";
+            case _21: return "Description: Indicates that the permissions have been externally verified and the request should be processed.";
+            case _1: return "Confirmed drug therapy appropriate";
+            case _19: return "Consulted other supplier/pharmacy, therapy confirmed";
+            case _2: return "Assessed patient, therapy is appropriate";
+            case _22: return "Description: The patient has the appropriate indication or diagnosis for the action to be taken.";
+            case _23: return "Description: It has been confirmed that the appropriate pre-requisite therapy has been tried.";
+            case _3: return "Patient gave adequate explanation";
+            case _4: return "Consulted other supply source, therapy still appropriate";
+            case _5: return "Consulted prescriber, therapy confirmed";
+            case _6: return "Consulted prescriber and recommended change, prescriber declined";
+            case _7: return "Concurrent therapy triggering alert is no longer on-going or planned";
+            case _14: return "Confirmed supply action appropriate";
+            case _15: return "Patient's existing supply was lost/wasted";
+            case _16: return "Supply date is due to patient vacation";
+            case _17: return "Supply date is intended to carry patient over weekend";
+            case _18: return "Supply is intended for use during a leave of absence from an institution.";
+            case _20: return "Description: Supply is different than expected as an additional quantity has been supplied in a separate dispense.";
+            case _8: return "Order is performed as issued, but other action taken to mitigate potential adverse effects";
+            case _10: return "Provided education or training to the patient on appropriate therapy use";
+            case _11: return "Instituted an additional therapy to mitigate potential negative effects";
+            case _12: return "Suspended existing therapy that triggered interaction for the duration of this therapy";
+            case _13: return "Aborted existing therapy that triggered interaction.";
+            case _9: return "Arranged to monitor patient for adverse effects";
+            case _ACTEXPOSURECODE: return "Concepts that identify the type or nature of exposure interaction.  Examples include \"household\", \"care giver\", \"intimate partner\", \"common space\", \"common substance\", etc. to further describe the nature of interaction.";
+            case CHLDCARE: return "Description: Exposure participants' interaction occurred in a child care setting";
+            case CONVEYNC: return "Description: An interaction where the exposure participants traveled in/on the same vehicle (not necessarily concurrently, e.g. both are passengers of the same plane, but on different flights of that plane).";
+            case HLTHCARE: return "Description: Exposure participants' interaction occurred during the course of health care delivery or in a health care delivery setting, but did not involve the direct provision of care (e.g. a janitor cleaning a patient's hospital room).";
+            case HOMECARE: return "Description: Exposure interaction occurred in context of one providing care for the other, i.e. a babysitter providing care for a child, a home-care aide providing assistance to a paraplegic.";
+            case HOSPPTNT: return "Description: Exposure participants' interaction occurred when both were patients being treated in the same (acute) health care delivery facility.";
+            case HOSPVSTR: return "Description: Exposure participants' interaction occurred when one visited the other who was a patient being treated in a health care delivery facility.";
+            case HOUSEHLD: return "Description: Exposure interaction occurred in context of domestic interaction, i.e. both participants reside in the same household.";
+            case INMATE: return "Description: Exposure participants' interaction occurred in the course of one or both participants being incarcerated at a correctional facility";
+            case INTIMATE: return "Description: Exposure interaction was intimate, i.e. participants are intimate companions (e.g. spouses, domestic partners).";
+            case LTRMCARE: return "Description: Exposure participants' interaction occurred in the course of one or both participants being resident at a long term care facility (second participant may be a visitor, worker, resident or a physical place or object within the facility).";
+            case PLACE: return "Description: An interaction where the exposure participants were both present in the same location/place/space.";
+            case PTNTCARE: return "Description: Exposure participants' interaction occurred during the course of  health care delivery by a provider (e.g. a physician treating a patient in her office).";
+            case SCHOOL2: return "Description: Exposure participants' interaction occurred in an academic setting (e.g., participants are fellow students, or student and teacher).";
+            case SOCIAL2: return "Description: An interaction where the exposure participants are social associates or members of the same extended family";
+            case SUBSTNCE: return "Description: An interaction where the exposure participants shared or co-used a common substance (e.g. drugs, needles, or common food item).";
+            case TRAVINT: return "Description: An interaction where the exposure participants traveled together in/on the same vehicle/trip (e.g. concurrent co-passengers).";
+            case WORK2: return "Description: Exposure interaction occurred in a work setting, i.e. participants are co-workers.";
+            case _ACTFINANCIALTRANSACTIONCODE: return "ActFinancialTransactionCode";
+            case CHRG: return "A type of transaction that represents a charge for a service or product.  Expressed in monetary terms.";
+            case REV: return "A type of transaction that represents a reversal of a previous charge for a service or product. Expressed in monetary terms.  It has the opposite effect of a standard charge.";
+            case _ACTINCIDENTCODE: return "Set of codes indicating the type of incident or accident.";
+            case MVA: return "Incident or accident as the result of a motor vehicle accident";
+            case SCHOOL: return "Incident or accident is the result of a school place accident.";
+            case SPT: return "Incident or accident is the result of a sporting accident.";
+            case WPA: return "Incident or accident is the result of a work place accident";
+            case _ACTINFORMATIONACCESSCODE: return "Description: The type of health information to which the subject of the information or the subject's delegate consents or dissents.";
+            case ACADR: return "Description: Provide consent to collect, use, disclose, or access adverse drug reaction information for a patient.";
+            case ACALL: return "Description: Provide consent to collect, use, disclose, or access all information for a patient.";
+            case ACALLG: return "Description: Provide consent to collect, use, disclose, or access allergy information for a patient.";
+            case ACCONS: return "Description: Provide consent to collect, use, disclose, or access informational consent information for a patient.";
+            case ACDEMO: return "Description: Provide consent to collect, use, disclose, or access demographics information for a patient.";
+            case ACDI: return "Description: Provide consent to collect, use, disclose, or access diagnostic imaging information for a patient.";
+            case ACIMMUN: return "Description: Provide consent to collect, use, disclose, or access immunization information for a patient.";
+            case ACLAB: return "Description: Provide consent to collect, use, disclose, or access lab test result information for a patient.";
+            case ACMED: return "Description: Provide consent to collect, use, disclose, or access medical condition information for a patient.";
+            case ACMEDC: return "Definition: Provide consent to view or access medical condition information for a patient.";
+            case ACMEN: return "Description:Provide consent to collect, use, disclose, or access mental health information for a patient.";
+            case ACOBS: return "Description: Provide consent to collect, use, disclose, or access common observation information for a patient.";
+            case ACPOLPRG: return "Description: Provide consent to collect, use, disclose, or access coverage policy or program for a patient.";
+            case ACPROV: return "Description: Provide consent to collect, use, disclose, or access provider information for a patient.";
+            case ACPSERV: return "Description: Provide consent to collect, use, disclose, or access professional service information for a patient.";
+            case ACSUBSTAB: return "Description:Provide consent to collect, use, disclose, or access substance abuse information for a patient.";
+            case _ACTINFORMATIONACCESSCONTEXTCODE: return "Concepts conveying the context in which authorization given under jurisdictional law, by organizational policy, or by a patient consent directive permits the collection, access, use or disclosure of specified patient health information.";
+            case INFAUT: return "Authorization to collect, access, use, or disclose specified patient health information in accordance with jurisdictional law, organizational policy, or a patient's consent directive, which may be implied, deemed, opt-in, opt-out, or explicit.";
+            case INFCON: return "Authorization to collect, access, use, or disclose specified patient health information as explicitly consented to by the subject of the information or the subject's representative.";
+            case INFCRT: return "Authorization to collect, access, use, or disclose specified patient health information in accordance with judicial system protocol, such as in the case of a subpoena or court order.";
+            case INFDNG: return "Authorization to collect, access, use, or disclose specified patient health information where deemed necessary to avert potential danger to other persons in accordance with jurisdictional law, organizational policy, or standards of practice.  For example, disclosure about a person threatening violence.";
+            case INFEMER: return "Authorization to collect, access, use, or disclose specified patient health information in accordance with emergency information transfer protocol dictated by jurisdictional law, organization policy, or standards of practice. For example, sharing of health information during disaster response.";
+            case INFPWR: return "Authorization to collect, access, use, or disclose specified patient health information necessary to avert potential public welfare risk in accordance with jurisdictional law, organizational policy, or standards of practice.  For example, reporting that a person is a victim of abuse or demonstrating suicidal tendencies.";
+            case INFREG: return "Authorization to collect, access, use, or disclose specified patient health information for public health, welfare, and safety purposes in accordance with jurisdictional law, organizational policy, or standards of practice.  For example, public health reporting of notifiable conditions.";
+            case _ACTINFORMATIONCATEGORYCODE: return "Definition:Indicates the set of information types which may be manipulated or referenced, such as for recommending access restrictions.";
+            case ALLCAT: return "Description: All patient information.";
+            case ALLGCAT: return "Definition:All information pertaining to a patient's allergy and intolerance records.";
+            case ARCAT: return "Description: All information pertaining to a patient's adverse drug reactions.";
+            case COBSCAT: return "Definition:All information pertaining to a patient's common observation records (height, weight, blood pressure, temperature, etc.).";
+            case DEMOCAT: return "Definition:All information pertaining to a patient's demographics (such as name, date of birth, gender, address, etc).";
+            case DICAT: return "Definition:All information pertaining to a patient's diagnostic image records (orders & results).";
+            case IMMUCAT: return "Definition:All information pertaining to a patient's vaccination records.";
+            case LABCAT: return "Description: All information pertaining to a patient's lab test records (orders & results)";
+            case MEDCCAT: return "Definition:All information pertaining to a patient's medical condition records.";
+            case MENCAT: return "Description: All information pertaining to a patient's mental health records.";
+            case PSVCCAT: return "Definition:All information pertaining to a patient's professional service records (such as smoking cessation, counseling, medication review, mental health).";
+            case RXCAT: return "Definition:All information pertaining to a patient's medication records (orders, dispenses and other active medications).";
+            case _ACTINVOICEELEMENTCODE: return "Type of invoice element that is used to assist in describing an Invoice that is either submitted for adjudication or for which is returned on adjudication results.";
+            case _ACTINVOICEADJUDICATIONPAYMENTCODE: return "Codes representing a grouping of invoice elements (totals, sub-totals), reported through a Payment Advice or a Statement of Financial Activity (SOFA).  The code can represent summaries by day, location, payee and other cost elements such as bonus, retroactive adjustment and transaction fees.";
+            case _ACTINVOICEADJUDICATIONPAYMENTGROUPCODE: return "Codes representing adjustments to a Payment Advice such as retroactive, clawback, garnishee, etc.";
+            case ALEC: return "Payment initiated by the payor as the result of adjudicating a submitted invoice that arrived to the payor from an electronic source that did not provide a conformant set of HL7 messages (e.g. web claim submission).";
+            case BONUS: return "Bonus payments based on performance, volume, etc. as agreed to by the payor.";
+            case CFWD: return "An amount still owing to the payor but the payment is 0$ and this cannot be settled until a future payment is made.";
+            case EDU: return "Fees deducted on behalf of a payee for tuition and continuing education.";
+            case EPYMT: return "Fees deducted on behalf of a payee for charges based on a shorter payment frequency (i.e. next day versus biweekly payments.";
+            case GARN: return "Fees deducted on behalf of a payee for charges based on a per-transaction or time-period (e.g. monthly) fee.";
+            case INVOICE: return "Payment is based on a payment intent for a previously submitted Invoice, based on formal adjudication results..";
+            case PINV: return "Payment initiated by the payor as the result of adjudicating a paper (original, may have been faxed) invoice.";
+            case PPRD: return "An amount that was owed to the payor as indicated, by a carry forward adjusment, in a previous payment advice";
+            case PROA: return "Professional association fee that is collected by the payor from the practitioner/provider on behalf of the association";
+            case RECOV: return "Retroactive adjustment such as fee rate adjustment due to contract negotiations.";
+            case RETRO: return "Bonus payments based on performance, volume, etc. as agreed to by the payor.";
+            case TRAN: return "Fees deducted on behalf of a payee for charges based on a per-transaction or time-period (e.g. monthly) fee.";
+            case _ACTINVOICEADJUDICATIONPAYMENTSUMMARYCODE: return "Codes representing a grouping of invoice elements (totals, sub-totals), reported through a Payment Advice or a Statement of Financial Activity (SOFA).  The code can represent summaries by day, location, payee, etc.";
+            case INVTYPE: return "Transaction counts and value totals by invoice type (e.g. RXDINV - Pharmacy Dispense)";
+            case PAYEE: return "Transaction counts and value totals by each instance of an invoice payee.";
+            case PAYOR: return "Transaction counts and value totals by each instance of an invoice payor.";
+            case SENDAPP: return "Transaction counts and value totals by each instance of a messaging application on a single processor. It is a registered identifier known to the receivers.";
+            case _ACTINVOICEDETAILCODE: return "Codes representing a service or product that is being invoiced (billed).  The code can represent such concepts as \"office visit\", \"drug X\", \"wheelchair\" and other billable items such as taxes, service charges and discounts.";
+            case _ACTINVOICEDETAILCLINICALPRODUCTCODE: return "An identifying data string for healthcare products.";
+            case UNSPSC: return "Description:United Nations Standard Products and Services Classification, managed by Uniform Code Council (UCC): www.unspsc.org";
+            case _ACTINVOICEDETAILDRUGPRODUCTCODE: return "An identifying data string for A substance used as a medication or in the preparation of medication.";
+            case GTIN: return "Description:Global Trade Item Number is an identifier for trade items developed by GS1 (comprising the former EAN International and Uniform Code Council).";
+            case UPC: return "Description:Universal Product Code is one of a wide variety of bar code languages widely used in the United States and Canada for items in stores.";
+            case _ACTINVOICEDETAILGENERICCODE: return "The detail item codes to identify charges or changes to the total billing of a claim due to insurance rules and payments.";
+            case _ACTINVOICEDETAILGENERICADJUDICATORCODE: return "The billable item codes to identify adjudicator specified components to the total billing of a claim.";
+            case COIN: return "That portion of the eligible charges which a covered party must pay for each service and/or product. It is a percentage of the eligible amount for the service/product that is typically charged after the covered party has met the policy deductible.  This amount represents the covered party's coinsurance that is applied to a particular adjudication result. It is expressed as a negative dollar amount in adjudication results.";
+            case COPAYMENT: return "That portion of the eligible charges which a covered party must pay for each service and/or product. It is a defined amount per service/product of the eligible amount for the service/product. This amount represents the covered party's copayment that is applied to a particular adjudication result. It is expressed as a negative dollar amount in adjudication results.";
+            case DEDUCTIBLE: return "That portion of the eligible charges which a covered party must pay in a particular period (e.g. annual) before the benefits are payable by the adjudicator. This amount represents the covered party's deductible that is applied to a particular adjudication result. It is expressed as a negative dollar amount in adjudication results.";
+            case PAY: return "The guarantor, who may be the patient, pays the entire charge for a service. Reasons for such action may include: there is no insurance coverage for the service (e.g. cosmetic surgery); the patient wishes to self-pay for the service; or the insurer denies payment for the service due to contractual provisions such as the need for prior authorization.";
+            case SPEND: return "That total amount of the eligible charges which a covered party must periodically pay for services and/or products prior to the Medicaid program providing any coverage. This amount represents the covered party's spend down that is applied to a particular adjudication result. It is expressed as a negative dollar amount in adjudication results";
+            case COINS: return "The covered party pays a percentage of the cost of covered services.";
+            case _ACTINVOICEDETAILGENERICMODIFIERCODE: return "The billable item codes to identify modifications to a billable item charge. As for example after hours increase in the office visit fee.";
+            case AFTHRS: return "Premium paid on service fees in compensation for practicing outside of normal working hours.";
+            case ISOL: return "Premium paid on service fees in compensation for practicing in a remote location.";
+            case OOO: return "Premium paid on service fees in compensation for practicing at a location other than normal working location.";
+            case _ACTINVOICEDETAILGENERICPROVIDERCODE: return "The billable item codes to identify provider supplied charges or changes to the total billing of a claim.";
+            case CANCAPT: return "A charge to compensate the provider when a patient cancels an appointment with insufficient time for the provider to make another appointment with another patient.";
+            case DSC: return "A reduction in the amount charged as a percentage of the amount. For example a 5% discount for volume purchase.";
+            case ESA: return "A premium on a service fee is requested because, due to extenuating circumstances, the service took an extraordinary amount of time or supplies.";
+            case FFSTOP: return "Under agreement between the parties (payor and provider), a guaranteed level of income is established for the provider over a specific, pre-determined period of time. The normal course of business for the provider is submission of fee-for-service claims. Should the fee-for-service income during the specified period of time be less than the agreed to amount, a top-up amount is paid to the provider equal to the difference between the fee-for-service total and the guaranteed income amount for that period of time. The details of the agreement may specify (or not) a requirement for repayment to the payor in the event that the fee-for-service income exceeds the guaranteed amount.";
+            case FNLFEE: return "Anticipated or actual final fee associated with treating a patient.";
+            case FRSTFEE: return "Anticipated or actual initial fee associated with treating a patient.";
+            case MARKUP: return "An increase in the amount charged as a percentage of the amount. For example, 12% markup on product cost.";
+            case MISSAPT: return "A charge to compensate the provider when a patient does not show for an appointment.";
+            case PERFEE: return "Anticipated or actual periodic fee associated with treating a patient. For example, expected billing cycle such as monthly, quarterly. The actual period (e.g. monthly, quarterly) is specified in the unit quantity of the Invoice Element.";
+            case PERMBNS: return "The amount for a performance bonus that is being requested from a payor for the performance of certain services (childhood immunizations, influenza immunizations, mammograms, pap smears) on a sliding scale. That is, for 90% of childhood immunizations to a maximum of $2200/yr. An invoice is created at the end of the service period (one year) and a code is submitted indicating the percentage achieved and the dollar amount claimed.";
+            case RESTOCK: return "A charge is requested because the patient failed to pick up the item and it took an amount of time to return it to stock for future use.";
+            case TRAVEL: return "A charge to cover the cost of travel time and/or cost in conjuction with providing a service or product. It may be charged per kilometer or per hour based on the effective agreement.";
+            case URGENT: return "Premium paid on service fees in compensation for providing an expedited response to an urgent situation.";
+            case _ACTINVOICEDETAILTAXCODE: return "The billable item codes to identify modifications to a billable item charge by a tax factor applied to the amount. As for example 7% provincial sales tax.";
+            case FST: return "Federal tax on transactions such as the Goods and Services Tax (GST)";
+            case HST: return "Joint Federal/Provincial Sales Tax";
+            case PST: return "Tax levied by the provincial or state jurisdiction such as Provincial Sales Tax";
+            case _ACTINVOICEDETAILPREFERREDACCOMMODATIONCODE: return "An identifying data string for medical facility accommodations.";
+            case _ACTENCOUNTERACCOMMODATIONCODE: return "Accommodation type.  In Intent mood, represents the accommodation type requested.  In Event mood, represents accommodation assigned/used.  In Definition mood, represents the available accommodation type.";
+            case _HL7ACCOMMODATIONCODE: return "Description:Accommodation type. In Intent mood, represents the accommodation type requested. In Event mood, represents accommodation assigned/used. In Definition mood, represents the available accommodation type.";
+            case I: return "Accommodations used in the care of diseases that are transmitted through casual contact or respiratory transmission.";
+            case P: return "Accommodations in which there is only 1 bed.";
+            case S: return "Uniquely designed and elegantly decorated accommodations with many amenities available for an additional charge.";
+            case SP: return "Accommodations in which there are 2 beds.";
+            case W: return "Accommodations in which there are 3 or more beds.";
+            case _ACTINVOICEDETAILCLINICALSERVICECODE: return "An identifying data string for healthcare procedures.";
+            case _ACTINVOICEGROUPCODE: return "Type of invoice element that is used to assist in describing an Invoice that is either submitted for adjudication or for which is returned on adjudication results.\r\n\n                        Invoice elements of this type signify a grouping of one or more children (detail) invoice elements.  They do not have intrinsic costing associated with them, but merely reflect the sum of all costing for it's immediate children invoice elements.";
+            case _ACTINVOICEINTERGROUPCODE: return "Type of invoice element that is used to assist in describing an Invoice that is either submitted for adjudication or for which is returned on adjudication results.\r\n\n                        Invoice elements of this type signify a grouping of one or more children (detail) invoice elements.  They do not have intrinsic costing associated with them, but merely reflect the sum of all costing for it's immediate children invoice elements.\r\n\n                        The domain is only specified for an intermediate invoice element group (non-root or non-top level) for an Invoice.";
+            case CPNDDRGING: return "A grouping of invoice element groups and details including the ones specifying the compound ingredients being invoiced. It may also contain generic detail items such as markup.";
+            case CPNDINDING: return "A grouping of invoice element details including the one specifying an ingredient drug being invoiced. It may also contain generic detail items such as tax or markup.";
+            case CPNDSUPING: return "A grouping of invoice element groups and details including the ones specifying the compound supplies being invoiced. It may also contain generic detail items such as markup.";
+            case DRUGING: return "A grouping of invoice element details including the one specifying the drug being invoiced. It may also contain generic detail items such as markup.";
+            case FRAMEING: return "A grouping of invoice element details including the ones specifying the frame fee and the frame dispensing cost that are being invoiced.";
+            case LENSING: return "A grouping of invoice element details including the ones specifying the lens fee and the lens dispensing cost that are being invoiced.";
+            case PRDING: return "A grouping of invoice element details including the one specifying the product (good or supply) being invoiced. It may also contain generic detail items such as tax or discount.";
+            case _ACTINVOICEROOTGROUPCODE: return "Type of invoice element that is used to assist in describing an Invoice that is either submitted for adjudication or for which is returned on adjudication results.\r\n\n                        Invoice elements of this type signify a grouping of one or more children (detail) invoice elements.  They do not have intrinsic costing associated with them, but merely reflect the sum of all costing for it's immediate children invoice elements.\r\n\n                        Codes from this domain reflect the type of Invoice such as Pharmacy Dispense, Clinical Service and Clinical Product.  The domain is only specified for the root (top level) invoice element group for an Invoice.";
+            case CPINV: return "Clinical product invoice where the Invoice Grouping contains one or more billable item and is supported by clinical product(s).\r\n\n                        For example, a crutch or a wheelchair.";
+            case CSINV: return "Clinical Services Invoice which can be used to describe a single service, multiple services or repeated services.\r\n\n                        [1] Single Clinical services invoice where the Invoice Grouping contains one billable item and is supported by one clinical service.\r\n\n                        For example, a single service for an office visit or simple clinical procedure (e.g. knee mobilization).\r\n\n                        [2] Multiple Clinical services invoice where the Invoice Grouping contains more than one billable item, supported by one or more clinical services.  The services can be distinct and over multiple dates, but for the same patient. This type of invoice includes a series of treatments which must be adjudicated together.\r\n\n                        For example, an adjustment and ultrasound for a chiropractic session where fees are associated for each of the services and adjudicated (invoiced) together.\r\n\n                        [3] Repeated Clinical services invoice where the Invoice Grouping contains one or more billable item, supported by the same clinical service repeated over a period of time.\r\n\n                        For example, the same Chiropractic adjustment (service or treatment) delivered on 3 separate occasions over a period of time at the discretion of the provider (e.g. month).";
+            case CSPINV: return "A clinical Invoice Grouping consisting of one or more services and one or more product.  Billing for these service(s) and product(s) are supported by multiple clinical billable events (acts).\r\n\n                        All items in the Invoice Grouping must be adjudicated together to be acceptable to the Adjudicator.\r\n\n                        For example , a brace (product) invoiced together with the fitting (service).";
+            case FININV: return "Invoice Grouping without clinical justification.  These will not require identification of participants and associations from a clinical context such as patient and provider.\r\n\n                        Examples are interest charges and mileage.";
+            case OHSINV: return "A clinical Invoice Grouping consisting of one or more oral health services. Billing for these service(s) are supported by multiple clinical billable events (acts).\r\n\n                        All items in the Invoice Grouping must be adjudicated together to be acceptable to the Adjudicator.";
+            case PAINV: return "HealthCare facility preferred accommodation invoice.";
+            case RXCINV: return "Pharmacy dispense invoice for a compound.";
+            case RXDINV: return "Pharmacy dispense invoice not involving a compound";
+            case SBFINV: return "Clinical services invoice where the Invoice Group contains one billable item for multiple clinical services in one or more sessions.";
+            case VRXINV: return "Vision dispense invoice for up to 2 lens (left and right), frame and optional discount.  Eye exams are invoiced as a clinical service invoice.";
+            case _ACTINVOICEELEMENTSUMMARYCODE: return "Identifies the different types of summary information that can be reported by queries dealing with Statement of Financial Activity (SOFA).  The summary information is generally used to help resolve balance discrepancies between providers and payors.";
+            case _INVOICEELEMENTADJUDICATED: return "Total counts and total net amounts adjudicated for all  Invoice Groupings that were adjudicated within a time period based on the adjudication date of the Invoice Grouping.";
+            case ADNFPPELAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted electronically.";
+            case ADNFPPELCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted electronically.";
+            case ADNFPPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted manually.";
+            case ADNFPPMNCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted manually.";
+            case ADNFSPELAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date), subsequently nullified in the specified period and submitted electronically.";
+            case ADNFSPELCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date), subsequently nullified in the specified period and submitted electronically.";
+            case ADNFSPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted manually.";
+            case ADNFSPMNCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date), subsequently cancelled in the specified period and submitted manually.";
+            case ADNPPPELAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted electronically.";
+            case ADNPPPELCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted electronically.";
+            case ADNPPPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted manually.";
+            case ADNPPPMNCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted manually.";
+            case ADNPSPELAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted electronically.";
+            case ADNPSPELCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted electronically.";
+            case ADNPSPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted manually.";
+            case ADNPSPMNCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that do not match a specified payee (e.g. pay patient) and submitted manually.";
+            case ADPPPPELAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted electronically.";
+            case ADPPPPELCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted electronically.";
+            case ADPPPPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted manually.";
+            case ADPPPPMNCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable prior to the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted manually.";
+            case ADPPSPELAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted electronically.";
+            case ADPPSPELCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted electronically.";
+            case ADPPSPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted manually.";
+            case ADPPSPMNCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as payable during the specified time period (based on adjudication date) that match a specified payee (e.g. pay provider) and submitted manually.";
+            case ADRFPPELAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as refused prior to the specified time period (based on adjudication date) and submitted electronically.";
+            case ADRFPPELCT: return "Identifies the  total number of all  Invoice Groupings that were adjudicated as refused prior to the specified time period (based on adjudication date) and submitted electronically.";
+            case ADRFPPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as refused prior to the specified time period (based on adjudication date) and submitted manually.";
+            case ADRFPPMNCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as refused prior to the specified time period (based on adjudication date) and submitted manually.";
+            case ADRFSPELAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as refused during the specified time period (based on adjudication date) and submitted electronically.";
+            case ADRFSPELCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as refused during the specified time period (based on adjudication date) and submitted electronically.";
+            case ADRFSPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were adjudicated as refused during the specified time period (based on adjudication date) and submitted manually.";
+            case ADRFSPMNCT: return "Identifies the total number of all  Invoice Groupings that were adjudicated as refused during the specified time period (based on adjudication date) and submitted manually.";
+            case _INVOICEELEMENTPAID: return "Total counts and total net amounts paid for all  Invoice Groupings that were paid within a time period based on the payment date.";
+            case PDNFPPELAT: return "Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date), subsequently nullified in the specified period and submitted electronically.";
+            case PDNFPPELCT: return "Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date), subsequently nullified in the specified period and submitted electronically.";
+            case PDNFPPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date), subsequently nullified in the specified period and submitted manually.";
+            case PDNFPPMNCT: return "Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date), subsequently nullified in the specified period and submitted manually.";
+            case PDNFSPELAT: return "Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date), subsequently nullified in the specified period and submitted electronically.";
+            case PDNFSPELCT: return "Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date), subsequently cancelled in the specified period and submitted electronically.";
+            case PDNFSPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date), subsequently nullified in the specified period and submitted manually.";
+            case PDNFSPMNCT: return "Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date), subsequently nullified in the specified period and submitted manually.";
+            case PDNPPPELAT: return "Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted electronically.";
+            case PDNPPPELCT: return "Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted electronically.";
+            case PDNPPPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted manually.";
+            case PDNPPPMNCT: return "Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted manually.";
+            case PDNPSPELAT: return "Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted electronically.";
+            case PDNPSPELCT: return "Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted electronically.";
+            case PDNPSPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted manually.";
+            case PDNPSPMNCT: return "Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date) that do not match a specified payee (e.g. pay patient) and submitted manually.";
+            case PDPPPPELAT: return "Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted electronically.";
+            case PDPPPPELCT: return "Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted electronically.";
+            case PDPPPPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted manually.";
+            case PDPPPPMNCT: return "Identifies the total number of all  Invoice Groupings that were paid prior to the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted manually.";
+            case PDPPSPELAT: return "Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted electronically.";
+            case PDPPSPELCT: return "Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted electronically.";
+            case PDPPSPMNAT: return "Identifies the total net amount of all  Invoice Groupings that were paid during the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted manually.";
+            case PDPPSPMNCT: return "Identifies the total number of all  Invoice Groupings that were paid during the specified time period (based on payment date) that match a specified payee (e.g. pay provider) and submitted manually.";
+            case _INVOICEELEMENTSUBMITTED: return "Total counts and total net amounts billed for all Invoice Groupings that were submitted within a time period.  Adjudicated invoice elements are included.";
+            case SBBLELAT: return "Identifies the total net amount billed for all submitted Invoice Groupings within a time period and submitted electronically.  Adjudicated invoice elements are included.";
+            case SBBLELCT: return "Identifies the total number of submitted Invoice Groupings within a time period and submitted electronically.  Adjudicated invoice elements are included.";
+            case SBNFELAT: return "Identifies the total net amount billed for all submitted  Invoice Groupings that were nullified within a time period and submitted electronically.  Adjudicated invoice elements are included.";
+            case SBNFELCT: return "Identifies the total number of submitted  Invoice Groupings that were nullified within a time period and submitted electronically.  Adjudicated invoice elements are included.";
+            case SBPDELAT: return "Identifies the total net amount billed for all submitted  Invoice Groupings that are pended or held by the payor, within a time period and submitted electronically.  Adjudicated invoice elements are not included.";
+            case SBPDELCT: return "Identifies the total number of submitted  Invoice Groupings that are pended or held by the payor, within a time period and submitted electronically.  Adjudicated invoice elements are not included.";
+            case _ACTINVOICEOVERRIDECODE: return "Includes coded responses that will occur as a result of the adjudication of an electronic invoice at a summary level and provides guidance on interpretation of the referenced adjudication results.";
+            case COVGE: return "Insurance coverage problems have been encountered. Additional explanation information to be supplied.";
+            case EFORM: return "Electronic form with supporting or additional information to follow.";
+            case FAX: return "Fax with supporting or additional information to follow.";
+            case GFTH: return "The medical service was provided to a patient in good faith that they had medical coverage, although no evidence of coverage was available before service was rendered.";
+            case LATE: return "Knowingly over the payor's published time limit for this invoice possibly due to a previous payor's delays in processing. Additional reason information will be supplied.";
+            case MANUAL: return "Manual review of the invoice is requested.  Additional information to be supplied.  This may be used in the case of an appeal.";
+            case OOJ: return "The medical service and/or product was provided to a patient that has coverage in another jurisdiction.";
+            case ORTHO: return "The service provided is required for orthodontic purposes. If the covered party has orthodontic coverage, then the service may be paid.";
+            case PAPER: return "Paper documentation (or other physical format) with supporting or additional information to follow.";
+            case PIE: return "Public Insurance has been exhausted.  Invoice has not been sent to Public Insuror and therefore no Explanation Of Benefits (EOB) is provided with this Invoice submission.";
+            case PYRDELAY: return "Allows provider to explain lateness of invoice to a subsequent payor.";
+            case REFNR: return "Rules of practice do not require a physician's referral for the provider to perform a billable service.";
+            case REPSERV: return "The same service was delivered within a time period that would usually indicate a duplicate billing.  However, the repeated service is a medical 	necessity and therefore not a duplicate.";
+            case UNRELAT: return "The service provided is not related to another billed service. For example, 2 unrelated services provided on the same day to the same patient which may normally result in a refused payment for one of the items.";
+            case VERBAUTH: return "The provider has received a verbal permission from an authoritative source to perform the service or supply the item being invoiced.";
+            case _ACTLISTCODE: return "Provides codes associated with ActClass value of LIST (working list)";
+            case _ACTOBSERVATIONLIST: return "ActObservationList";
+            case CARELIST: return "List of acts representing a care plan.  The acts can be in a varierty of moods including event (EVN) to record acts that have been carried out as part of the care plan.";
+            case CONDLIST: return "List of condition observations.";
+            case INTOLIST: return "List of intolerance observations.";
+            case PROBLIST: return "List of problem observations.";
+            case RISKLIST: return "List of risk factor observations.";
+            case GOALLIST: return "List of observations in goal mood.";
+            case _ACTTHERAPYDURATIONWORKINGLISTCODE: return "Codes used to identify different types of 'duration-based' working lists.  Examples include \"Continuous/Chronic\", \"Short-Term\" and \"As-Needed\".";
+            case _ACTMEDICATIONTHERAPYDURATIONWORKINGLISTCODE: return "Definition:A collection of concepts that identifies different types of 'duration-based' mediation working lists.\r\n\n                        \n                           Examples:\"Continuous/Chronic\" \"Short-Term\" and \"As Needed\"";
+            case ACU: return "Definition:A list of medications which the patient is only expected to consume for the duration of the current order or limited set of orders and which is not expected to be renewed.";
+            case CHRON: return "Definition:A list of medications which are expected to be continued beyond the present order and which the patient should be assumed to be taking unless explicitly stopped.";
+            case ONET: return "Definition:A list of medications which the patient is intended to be administered only once.";
+            case PRN: return "Definition:A list of medications which the patient will consume intermittently based on the behavior of the condition for which the medication is indicated.";
+            case MEDLIST: return "List of medications.";
+            case CURMEDLIST: return "List of current medications.";
+            case DISCMEDLIST: return "List of discharge medications.";
+            case HISTMEDLIST: return "Historical list of medications.";
+            case _ACTMONITORINGPROTOCOLCODE: return "Identifies types of monitoring programs";
+            case CTLSUB: return "A monitoring program that focuses on narcotics and/or commonly abused substances that are subject to legal restriction.";
+            case INV: return "Definition:A monitoring program that focuses on a drug which is under investigation and has not received regulatory approval for the condition being investigated";
+            case LU: return "Description:A drug that can be prescribed (and reimbursed) only if it meets certain criteria.";
+            case OTC: return "Medicines designated in this way may be supplied for patient use without a prescription.  The exact form of categorisation will vary in different realms.";
+            case RX: return "Some form of prescription is required before the related medicine can be supplied for a patient.  The exact form of regulation will vary in different realms.";
+            case SA: return "Definition:A drug that requires prior approval (to be reimbursed) before being dispensed";
+            case SAC: return "Description:A drug that requires special access permission to be prescribed and dispensed.";
+            case _ACTNONOBSERVATIONINDICATIONCODE: return "Description:Concepts representing indications (reasons for clinical action) other than diagnosis and symptoms.";
+            case IND01: return "Description:Contrast agent required for imaging study.";
+            case IND02: return "Description:Provision of prescription or direction to consume a product for purposes of bowel clearance in preparation for a colonoscopy.";
+            case IND03: return "Description:Provision of medication as a preventative measure during a treatment or other period of increased risk.";
+            case IND04: return "Description:Provision of medication during pre-operative phase; e.g., antibiotics before dental surgery or bowel prep before colon surgery.";
+            case IND05: return "Description:Provision of medication for pregnancy --e.g., vitamins, antibiotic treatments for vaginal tract colonization, etc.";
+            case _ACTOBSERVATIONVERIFICATIONTYPE: return "Identifies the type of verification investigation being undertaken with respect to the subject of the verification activity.\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           \n                              Verification of eligibility for coverage under a policy or program - aka enrolled/covered by a policy or program\r\n\n                           \n                           \n                              Verification of record - e.g., person has record in an immunization registry\r\n\n                           \n                           \n                              Verification of enumeration - e.g. NPI\r\n\n                           \n                           \n                              Verification of Board Certification - provider specific\r\n\n                           \n                           \n                              Verification of Certification - e.g. JAHCO, NCQA, URAC\r\n\n                           \n                           \n                              Verification of Conformance - e.g. entity use with HIPAA, conformant to the CCHIT EHR system criteria\r\n\n                           \n                           \n                              Verification of Provider Credentials\r\n\n                           \n                           \n                              Verification of no adverse findings - e.g. on National Provider Data Bank, Health Integrity Protection Data Base (HIPDB)";
+            case VFPAPER: return "Definition:Indicates that the paper version of the record has, should be or is being verified against the electronic version.";
+            case _ACTPAYMENTCODE: return "Code identifying the method or the movement of payment instructions.\r\n\n                        Codes are drawn from X12 data element 591 (PaymentMethodCode)";
+            case ACH: return "Automated Clearing House (ACH).";
+            case CHK: return "A written order to a bank to pay the amount specified from funds on deposit.";
+            case DDP: return "Electronic Funds Transfer (EFT) deposit into the payee's bank account";
+            case NON: return "Non-Payment Data.";
+            case _ACTPHARMACYSUPPLYTYPE: return "Identifies types of dispensing events";
+            case DF: return "A fill providing sufficient supply for one day";
+            case EM: return "A supply action where there is no 'valid' order for the supplied medication.  E.g. Emergency vacation supply, weekend supply (when prescriber is unavailable to provide a renewal prescription)";
+            case SO: return "An emergency supply where the expectation is that a formal order authorizing the supply will be provided at a later date.";
+            case FF: return "The initial fill against an order.  (This includes initial fills against refill orders.)";
+            case FFC: return "A first fill where the quantity supplied is equal to one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a complete fill would be for the full 90 tablets).";
+            case FFP: return "A first fill where the quantity supplied is less than one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a partial fill might be for only 30 tablets.)";
+            case FFSS: return "A first fill where the strength supplied is less than the ordered strength. (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).";
+            case TF: return "A fill where a small portion is provided to allow for determination of the therapy effectiveness and patient tolerance.";
+            case FS: return "A supply action to restock a smaller more local dispensary.";
+            case MS: return "A supply of a manufacturer sample";
+            case RF: return "A fill against an order that has already been filled (or partially filled) at least once.";
+            case UD: return "A supply action that provides sufficient material for a single dose.";
+            case RFC: return "A refill where the quantity supplied is equal to one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a complete fill would be for the full 90 tablets.)";
+            case RFCS: return "A refill where the quantity supplied is equal to one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a complete fill would be for the full 90 tablets.) and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).";
+            case RFF: return "The first fill against an order that has already been filled at least once at another facility.";
+            case RFFS: return "The first fill against an order that has already been filled at least once at another facility and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).";
+            case RFP: return "A refill where the quantity supplied is less than one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a partial fill might be for only 30 tablets.)";
+            case RFPS: return "A refill where the quantity supplied is less than one full repetition of the ordered amount. (e.g. If the order was 90 tablets, 3 refills, a partial fill might be for only 30 tablets.) and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).";
+            case RFS: return "A fill against an order that has already been filled (or partially filled) at least once and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).";
+            case TB: return "A fill where the remainder of a 'complete' fill is provided after a trial fill has been provided.";
+            case TBS: return "A fill where the remainder of a 'complete' fill is provided after a trial fill has been provided and where the strength supplied is less than the ordered strength (e.g. 10mg for an order of 50mg where a subsequent fill will dispense 40mg tablets).";
+            case UDE: return "A supply action that provides sufficient material for a single dose via multiple products.  E.g. 2 50mg tablets for a 100mg unit dose.";
+            case _ACTPOLICYTYPE: return "Description:Types of policies that further specify the ActClassPolicy value set.";
+            case _ACTPRIVACYPOLICY: return "A policy deeming certain information to be private to an individual or organization.\r\n\n                        \n                           Definition: A mandate, obligation, requirement, rule, or expectation relating to privacy.\r\n\n                        \n                           Discussion: ActPrivacyPolicyType codes support the designation of the 1..* policies that are applicable to an Act such as a Consent Directive, a Role such as a VIP Patient, or an Entity such as a patient who is a minor.  1..* ActPrivacyPolicyType values may be associated with an Act or Role to indicate the policies that govern the assignment of an Act or Role confidentialityCode.  Use of multiple ActPrivacyPolicyType values enables fine grain specification of applicable policies, but must be carefully assigned to ensure cogency and avoid creation of conflicting policy mandates.\r\n\n                        \n                           Usage Note: Statutory title may be named in the ActClassPolicy Act Act.title to specify which privacy policy is being referenced.";
+            case _ACTCONSENTDIRECTIVE: return "Specifies the type of agreement between one or more grantor and grantee in which rights and obligations related to one or more shared items of interest are allocated.\r\n\n                        \n                           Usage Note: Such agreements may be considered \"consent directives\" or \"contracts\" depending on the context, and are considered closely related or synonymous from a legal perspective.\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Healthcare Privacy Consent Directive permitting or restricting in whole or part the collection, access, use, and disclosure of health information, and any associated handling caveats.\n                           Healthcare Medical Consent Directive to receive medical procedures after being informed of risks and benefits, thereby reducing the grantee's liability.\n                           Research Informed Consent for participation in clinical trials and disclosure of health information after being informed of risks and benefits, thereby reducing the grantee's liability.\n                           Substitute decision maker delegation in which the grantee assumes responsibility to act on behalf of the grantor.\n                           Contracts in which the agreement requires assent/dissent by the grantor of terms offered by a grantee, a consumer opts out of an \"award\" system for use of a retailer's marketing or credit card vendor's point collection cards in exchange for allowing purchase tracking and profiling.\n                           A mobile device or App privacy policy and terms of service to which a user must agree in whole or in part in order to utilize the service.\n                           Agreements between a client and an authorization server or between an authorization server and a resource operator and/or resource owner permitting or restricting e.g., collection, access, use, and disclosure of information, and any associated handling caveats.";
+            case EMRGONLY: return "This general consent directive specifically limits disclosure of health information for purpose of emergency treatment. Additional parameters may further limit the disclosure to specific users, roles, duration, types of information, and impose uses obligations.\r\n\n                        \n                           Definition: Opt-in to disclosure of health information for emergency only consent directive.";
+            case GRANTORCHOICE: return "A grantor's terms of agreement to which a grantee may assent or dissent, and which may include an opportunity for a grantee to request restrictions or extensions.\r\n\n                        \n                           Comment: A grantor typically is able to stipulate preferred terms of agreement when the grantor has control over the topic of the agreement, which a grantee must accept in full or may be offered an opportunity to extend or restrict certain terms.\r\n\n                        \n                           Usage Note: If the grantor's term of agreement must be accepted in full, then this is considered \"basic consent\".  If a grantee is offered an opportunity to extend or restrict certain terms, then the agreement is considered \"granular consent\".\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Healthcare: A PHR account holder [grantor] may require any PHR user [grantee]  to accept the terms of agreement in full, or may permit a PHR user to extend or restrict terms selected by the account holder or requested by the PHR user.\n                           Non-healthcare: The owner of a resource server [grantor] may require any authorization server [grantee] to meet authorization requirements stipulated in the grantor's terms of agreement.";
+            case IMPLIED: return "A grantor's presumed assent to the grantee's terms of agreement is based on the grantor's behavior, which may result from not expressly assenting to the consent directive offered, or from having no right to assent or dissent offered by the grantee.\r\n\n                        \n                           Comment: Implied or \"implicit\" consent occurs when the behavior of the grantor is understood by a reasonable person to signal agreement to the grantee's terms.\r\n\n                        \n                           Usage Note: Implied consent with no opportunity to assent or dissent to certain terms is considered \"basic consent\".\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Healthcare: A patient schedules an appointment with a provider, and either does not take the opportunity to expressly assent or dissent to the provider's consent directive, does not have an opportunity to do so, as in the case where emergency care is required, or simply behaves as though the patient [grantor] agrees to the rights granted to the provider [grantee] in an implicit consent directive.\n                           An injured and unconscious patient is deemed to have assented to emergency treatment by those permitted to do so under jurisdictional laws, e.g., Good Samaritan laws.\n                           Non-healthcare: Upon receiving a driver's license, the driver is deemed to have assented without explicitly consenting to undergoing field sobriety tests.\n                           A corporation that does business in a foreign nation is deemed to have deemed to have assented without explicitly consenting to abide by that nation's laws.";
+            case IMPLIEDD: return "A grantor's presumed assent to the grantee's terms of agreement, which is based on the grantor's behavior, and includes a right to dissent to certain terms. \r\n\n                        \n                           Comment: A grantor assenting to the grantee's terms of agreement may or may not exercise a right to dissent to grantor selected terms or to grantee's selected terms to which a grantor may dissent.\r\n\n                        \n                           Usage Note: Implied or \"implicit\" consent with an \"opportunity to dissent\" occurs when the grantor's behavior is understood by a reasonable person to signal assent to the grantee's terms of agreement whether the grantor requests or the grantee approves further restrictions, is considered \"granular consent\".\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Healthcare Examples: A healthcare provider deems a patient's assent to disclosure of health information to family members and friends, but offers an opportunity or permits the patient to dissent to such disclosures.\n                           A health information exchanges deems a patient to have assented to disclosure of health information for treatment purposes, but offers the patient an opportunity to dissents to disclosure to particular provider organizations.\n                           Non-healthcare Examples: A bank deems a banking customer's assent to specified collection, access, use, or disclosure of financial information as a requirement of holding a bank account, but provides the user an opportunity to limit third-party collection, access, use or disclosure of that information for marketing purposes.";
+            case NOCONSENT: return "No notification or opportunity is provided for a grantor to assent or dissent to a grantee's terms of agreement.\r\n\n                        \n                           Comment: A \"No Consent\" policy scheme provides no opportunity for accommodation of an individual's preferences, and may not comply with Fair Information Practice Principles [FIPP] by enabling the data subject to object, access collected information, correct errors, or have accounting of disclosures.\r\n\n                        \n                           Usage Note: The grantee's terms of agreement, may be available to the grantor by reviewing the grantee's privacy policies, but there is no notice by which a grantor is apprised of the policy directly or able to acknowledge.\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Healthcare: Without notification or an opportunity to assent or dissent, a patient's health information is automatically included in and available (often according to certain rules) through a health information exchange.  Note that this differs from implied consent, where the patient is assumed to have consented.\n                           Without notification or an opportunity to assent or dissent, a patient's health information is collected, accessed, used, or disclosed for research, public health, security, fraud prevention, court order, or law enforcement.\n                           Non-healthcare: Without notification or an opportunity to assent or dissent, a consumer's healthcare or non-healthcare internet searches are aggregated for secondary uses such as behavioral tracking and profiling.\n                           Without notification or an opportunity to assent or dissent, a consumer's location and activities in a shopping mall are tracked by RFID tags on purchased items.";
+            case NOPP: return "Acknowledgement of custodian notice of privacy practices.\r\n\n                        \n                           Usage Notes: This type of consent directive acknowledges a custodian's notice of privacy practices including its permitted collection, access, use and disclosure of health information to users and for purposes of use specified.";
+            case OPTIN: return "A grantor's assent to the terms of an agreement offered by a grantee without an opportunity for to dissent to any terms.\r\n\n                        \n                           Comment: Acceptance of a grantee's terms pertaining, for example, to permissible activities, purposes of use, handling caveats, expiry date, and revocation policies.\r\n\n                        \n                           Usage Note: Opt-in with no opportunity for a grantor to restrict certain permissions sought by the grantee is considered \"basic consent\".\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Healthcare: A patient [grantor] signs a provider's [grantee's] consent directive form, which lists permissible collection, access, use, or disclosure activities, purposes of use, handling caveats, and revocation policies.\n                           Non-healthcare: An employee [grantor] signs an employer's [grantee's] non-disclosure and non-compete agreement.";
+            case OPTINR: return "A grantor's assent to the grantee's terms of an agreement with an opportunity for to dissent to certain grantor or grantee selected terms.\r\n\n                        \n                           Comment: A grantor dissenting to the grantee's terms of agreement may or may not exercise a right to assent to grantor's pre-approved restrictions or to grantee's selected terms to which a grantor may dissent.\r\n\n                        \n                           Usage Note: Opt-in with restrictions is considered \"granular consent\" because the grantor has an opportunity to narrow the permissions sought by the grantee.\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Healthcare:  A patient assent to grantee's consent directive terms for collection, access, use, or disclosure of health information, and dissents to disclosure to certain recipients as allowed by the provider's pre-approved restriction list.\n                           Non-Healthcare: A cell phone user assents to the cell phone's privacy practices and terms of use, but dissents from location tracking by turning off the cell phone's tracking capability.";
+            case OPTOUT: return "A grantor's dissent to the terms of agreement offered by a grantee without an opportunity for to assent to any terms.\r\n\n                        \n                           Comment: Rejection of a grantee's terms of agreement pertaining, for example, to permissible activities, purposes of use, handling caveats, expiry date, and revocation policies.\r\n\n                        \n                           Usage Note: Opt-out with no opportunity for a grantor to permit certain permissions sought by the grantee is considered \"basic consent\".\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Healthcare: A patient [grantor] declines to sign a provider's [grantee's] consent directive form, which lists permissible collection, access, use, or disclosure activities, purposes of use, handling caveats, revocation policies, and consequences of not assenting.\n                           Non-healthcare: An employee [grantor] refuses to sign an employer's [grantee's] agreement not to join unions or participate in a strike where state law protects employee's collective bargaining rights.\n                           A citizen [grantor] refuses to enroll in mandatory government [grantee] health insurance based on religious beliefs, which is an exemption.";
+            case OPTOUTE: return "A grantor's dissent to the grantee's terms of agreement except for certain grantor or grantee selected terms.\r\n\n                        \n                           Comment: A rejection of a grantee's terms of agreement while assenting to certain permissions sought by the grantee or requesting approval of additional grantor terms.\r\n\n                        \n                           Usage Note: Opt-out with exceptions is considered a \"granular consent\" because the grantor has an opportunity to accept certain permissions sought by the grantee or request additional grantor terms, while rejecting other grantee terms.\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Healthcare: A patient [grantor] dissents to a health information exchange consent directive with the exception of disclosure based on a limited \"time to live\" shared secret [e.g., a token or password], which the patient can give to a provider when seeking care.\n                           Non-healthcare: A social media user [grantor] dissents from public access to their account, but assents to access to a circle of friends.";
+            case _ACTPRIVACYLAW: return "A jurisdictional mandate, regulation, obligation, requirement, rule, or expectation deeming certain information to be private to an individual or organization, which is imposed on:\r\n\n                        \n                           The activity of a governed party\n                           The behavior of a governed party\n                           The manner in which an act is executed by a governed party";
+            case _ACTUSPRIVACYLAW: return "Definition: A jurisdictional mandate in the U.S. relating to privacy.\r\n\n                        \n                           Usage Note: ActPrivacyLaw codes may be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.  May be used to further specify rationale for assignment of other ActPrivacyPolicy codes in the US realm, e.g., ETH and 42CFRPart2 can be differentiated from ETH and Title38Part1.";
+            case _42CFRPART2: return "42 CFR Part 2 stipulates the right of an individual who has applied for or been given diagnosis or treatment for alcohol or drug abuse at a federally assisted program.\r\n\n                        \n                           Definition: Non-disclosure of health information relating to health care paid for by a federally assisted substance abuse program without patient consent.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.";
+            case COMMONRULE: return "U.S. Federal regulations governing the protection of human subjects in research (codified at Subpart A of 45 CFR part 46) that has been adopted by 15 U.S. Federal departments and agencies in an effort to promote uniformity, understanding, and compliance with human subject protections. Existing regulations governing the protection of human subjects in Food and Drug Administration (FDA)-regulated research (21 CFR parts 50, 56, 312, and 812) are separate from the Common Rule but include similar requirements.\r\n\n                        \n                           Definition: U.S. federal laws governing research-related privacy policies.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.";
+            case HIPAANOPP: return "The U.S. Public Law 104-191 Health Insurance Portability and Accountability Act (HIPAA) Privacy Rule (45 CFR Part 164 Subpart E) permits access, use and disclosure of certain personal health information (PHI as defined under the law) for purposes of Treatment, Payment, and Operations, and requires that the provider ask that patients acknowledge the Provider's Notice of Privacy Practices as permitted conduct under the law.\r\n\n                        \n                           Definition: Notification of HIPAA Privacy Practices.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.";
+            case HIPAAPSYNOTES: return "The U.S. Public Law 104-191 Health Insurance Portability and Accountability Act (HIPAA) Privacy Rule (45 CFR Part 164 Section 164.508) requires authorization for certain uses and disclosure of psychotherapy notes.\r\n\n                        \n                           Definition: Authorization that must be obtained for disclosure of psychotherapy notes.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.";
+            case HIPAASELFPAY: return "Section 13405(a) of the Health Information Technology for Economic and Clinical Health Act (HITECH) stipulates the right of an individual to have disclosures regarding certain health care items or services for which the individual pays out of pocket in full restricted from a health plan.\r\n\n                        \n                           Definition: Non-disclosure of health information to a health plan relating to health care items or services for which an individual pays out of pocket in full.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.";
+            case TITLE38SECTION7332: return "Title 38 Part 1-protected information may only be disclosed to a third party with the special written consent of the patient except where expressly authorized by 38 USC 7332. VA may disclose this information for specific purposes to: VA employees on a need to know basis - more restrictive than Privacy Act need to know; contractors who need the information in order to perform or fulfil the duties of the contract; and researchers who provide assurances that the information will not be identified in any report. This information may also be disclosed without consent where patient lacks decision-making capacity; in a medical emergency for the purpose of treating a condition which poses an immediate threat to the health of any individual and which requires immediate medical intervention; for eye, tissue, or organ donation purposes; and disclosure of HIV information for public health purposes.\r\n\n                        \n                           Definition: Title 38 Part 1 - Section 1.462 Confidentiality restrictions.\r\n\n                        (a) General. The patient records to which Sections 1.460 through 1.499 of this part apply may be disclosed or used only as permitted by these regulations and may not otherwise be disclosed or used in any civil, criminal, administrative, or legislative proceedings conducted by any Federal, State, or local authority. Any disclosure made under these regulations must be limited to that information which is necessary to carry out the purpose of the disclosure. SUBCHAPTER III--PROTECTION OF PATIENT RIGHTS Sec. 7332. Confidentiality of certain medical records (a)(1) Records of the identity, diagnosis, prognosis, or treatment of any patient or subject which are maintained in connection with the performance of any program or activity (including education, training, treatment, rehabilitation, or research) relating to drug abuse, alcoholism or alcohol abuse, infection with the human immunodeficiency virus, or sickle cell anemia which is carried out by or for the Department under this title shall, except as provided in subsections (e) and (f), be confidential, and (section 5701 of this title to the contrary notwithstanding) such records may be disclosed only for the purposes and under the circumstances expressly authorized under subsection (b).\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.";
+            case _INFORMATIONSENSITIVITYPOLICY: return "A mandate, obligation, requirement, rule, or expectation characterizing the value or importance of a resource and may include its vulnerability. (Based on ISO7498-2:1989. Note: The vulnerability of personally identifiable sensitive information may be based on concerns that the unauthorized disclosure may result in social stigmatization or discrimination.) Description:  Types of Sensitivity policy that apply to Acts or Roles.  A sensitivity policy is adopted by an enterprise or group of enterprises (a 'policy domain') through a formal data use agreement that stipulates the value, importance, and vulnerability of information. A sensitivity code representing a sensitivity policy may be associated with criteria such as categories of information or sets of information identifiers (e.g., a value set of clinical codes or branch in a code system hierarchy).   These criteria may in turn be used for the Policy Decision Point in a Security Engine.  A sensitivity code may be used to set the confidentiality code used on information about Acts and Roles to trigger the security mechanisms required to control how security principals (i.e., a person, a machine, a software application) may act on the information (e.g., collection, access, use, or disclosure). Sensitivity codes are never assigned to the transport or business envelope containing patient specific information being exchanged outside of a policy domain as this would disclose the information intended to be protected by the policy.  When sensitive information is exchanged with others outside of a policy domain, the confidentiality code on the transport or business envelope conveys the receiver's responsibilities and indicates the how the information is to be safeguarded without unauthorized disclosure of the sensitive information.  This ensures that sensitive information is treated by receivers as the sender intends, accomplishing interoperability without point to point negotiations.\r\n\n                        \n                           Usage Note: Sensitivity codes are not useful for interoperability outside of a policy domain because sensitivity policies are typically localized and vary drastically across policy domains even for the same information category because of differing organizational business rules, security policies, and jurisdictional requirements.  For example, an employee's sensitivity code would make little sense for use outside of a policy domain.   'Taboo' would rarely be useful outside of a policy domain unless there are jurisdictional requirements requiring that a provider disclose sensitive information to a patient directly.  Sensitivity codes may be more appropriate in a legacy system's Master Files in order to notify those who access a patient's orders and observations about the sensitivity policies that apply.  Newer systems may have a security engine that uses a sensitivity policy's criteria directly.  The specializable InformationSensitivityPolicy Act.code may be useful in some scenarios if used in combination with a sensitivity identifier and/or Act.title.";
+            case _ACTINFORMATIONSENSITIVITYPOLICY: return "Types of sensitivity policies that apply to Acts.  Act.confidentialityCode is defined in the RIM as \"constraints around appropriate disclosure of information about this Act, regardless of mood.\"\r\n\n                        \n                           Usage Note: ActSensitivity codes are used to bind information to an Act.confidentialityCode according to local sensitivity policy so that those confidentiality codes can then govern its handling across enterprises.  Internally to a policy domain, however, local policies guide the access control system on how end users in that policy domain are  able to use information tagged with these sensitivity values.";
+            case ETH: return "Policy for handling alcohol or drug-abuse information, which will be afforded heightened confidentiality.  Information handling protocols based on organizational policies related to alcohol or drug-abuse information that is deemed sensitive.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case GDIS: return "Policy for handling genetic disease information, which will be afforded heightened confidentiality. Information handling protocols based on organizational policies related to genetic disease information that is deemed sensitive.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case HIV: return "Policy for handling HIV or AIDS information, which will be afforded heightened confidentiality. Information handling protocols based on organizational policies related to HIV or AIDS information that is deemed sensitive.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case PSY: return "Policy for handling psychiatry information, which will be afforded heightened confidentiality. Information handling protocols based on organizational policies related to psychiatry information that is deemed sensitive.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case SCA: return "Policy for handling sickle cell disease information, which is afforded heightened confidentiality.  Information handling protocols are based on organizational policies related to sickle cell disease information, which is deemed sensitive.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then the Act valued with this ActCode should be associated with an Act valued with any applicable laws from the ActPrivacyLaw code system.";
+            case SOC: return "Information about provision of social services.\r\n\n                        \n                           Usage Note: This is a temporary addition to FHIR to be proposed in harmonization.";
+            case SDV: return "Policy for handling sexual assault, abuse, or domestic violence information, which will be afforded heightened confidentiality. Information handling protocols based on organizational policies related to sexual assault, abuse, or domestic violence information that is deemed sensitive.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case SEX: return "Policy for handling sexuality and reproductive health information, which will be afforded heightened confidentiality.  Information handling protocols based on organizational policies related to sexuality and reproductive health information that is deemed sensitive.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case STD: return "Policy for handling sexually transmitted disease information, which will be afforded heightened confidentiality.\n Information handling protocols based on organizational policies related to sexually transmitted disease information that is deemed sensitive.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case TBOO: return "Policy for handling information not to be initially disclosed or discussed with patient except by a physician assigned to patient in this case. Information handling protocols based on organizational policies related to sensitive patient information that must be initially discussed with the patient by an attending physician before being disclosed to the patient.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.\r\n\n                        \n                           Open Issue: This definition conflates a rule and a characteristic, and there may be a similar issue with ts sibling codes.";
+            case SICKLE: return "Types of sensitivity policies that apply to Acts.  Act.confidentialityCode is defined in the RIM as \"constraints around appropriate disclosure of information about this Act, regardless of mood.\"\r\n\n                        \n                           Usage Note: ActSensitivity codes are used to bind information to an Act.confidentialityCode according to local sensitivity policy so that those confidentiality codes can then govern its handling across enterprises.  Internally to a policy domain, however, local policies guide the access control system on how end users in that policy domain are able to use information tagged with these sensitivity values.";
+            case _ENTITYSENSITIVITYPOLICYTYPE: return "Types of sensitivity policies that may apply to a sensitive attribute on an Entity.\r\n\n                        \n                           Usage Note: EntitySensitivity codes are used to convey a policy that is applicable to sensitive information conveyed by an entity attribute.  May be used to bind a Role.confidentialityCode associated with an Entity per organizational policy.  Role.confidentialityCode is defined in the RIM as \"an indication of the appropriate disclosure of information about this Role with respect to the playing Entity.\"";
+            case DEMO: return "Policy for handling all demographic information about an information subject, which will be afforded heightened confidentiality. Policies may govern sensitivity of information related to all demographic about an information subject, the disclosure of which could impact the privacy, well-being, or safety of that subject.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case DOB: return "Policy for handling information related to an information subject's date of birth, which will be afforded heightened confidentiality.Policies may govern sensitivity of information related to an information subject's date of birth, the disclosure of which could impact the privacy, well-being, or safety of that subject.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case GENDER: return "Policy for handling information related to an information subject's gender and sexual orientation, which will be afforded heightened confidentiality.  Policies may govern sensitivity of information related to an information subject's gender and sexual orientation, the disclosure of which could impact the privacy, well-being, or safety of that subject.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case LIVARG: return "Policy for handling information related to an information subject's living arrangement, which will be afforded heightened confidentiality.  Policies may govern sensitivity of information related to an information subject's living arrangement, the disclosure of which could impact the privacy, well-being, or safety of that subject.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case MARST: return "Policy for handling information related to an information subject's marital status, which will be afforded heightened confidentiality. Policies may govern sensitivity of information related to an information subject's marital status, the disclosure of which could impact the privacy, well-being, or safety of that subject.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case RACE: return "Policy for handling information related to an information subject's race, which will be afforded heightened confidentiality.  Policies may govern sensitivity of information related to an information subject's race, the disclosure of which could impact the privacy, well-being, or safety of that subject.\r\n\n                        \n                           Usage Note: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case REL: return "Policy for handling information related to an information subject's religious affiliation, which will be afforded heightened confidentiality.  Policies may govern sensitivity of information related to an information subject's religion, the disclosure of which could impact the privacy, well-being, or safety of that subject.\r\n\n                        \n                           Usage Notes: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case _ROLEINFORMATIONSENSITIVITYPOLICY: return "Types of sensitivity policies that apply to Roles.\r\n\n                        \n                           Usage Notes: RoleSensitivity codes are used to bind information to a Role.confidentialityCode per organizational policy.  Role.confidentialityCode is defined in the RIM as \"an indication of the appropriate disclosure of information about this Role with respect to the playing Entity.\"";
+            case B: return "Policy for handling trade secrets such as financial information or intellectual property, which will be afforded heightened confidentiality.  Description:  Since the service class can represent knowledge structures that may be considered a trade or business secret, there is sometimes (though rarely) the need to flag those items as of business level confidentiality.\r\n\n                        \n                           Usage Notes: No patient related information may ever be of this confidentiality level.   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case EMPL: return "Policy for handling information related to an employer which is deemed classified to protect an employee who is the information subject, and which will be afforded heightened confidentiality.  Description:  Policies may govern sensitivity of information related to an employer, such as law enforcement or national security, the identity of which could impact the privacy, well-being, or safety of an information subject who is an employee.\r\n\n                        \n                           Usage Notes: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case LOCIS: return "Policy for handling information related to the location of the information subject, which will be afforded heightened confidentiality.  Description:  Policies may govern sensitivity of information related to the location of the information subject, the disclosure of which could impact the privacy, well-being, or safety of that subject.\r\n\n                        \n                           Usage Notes: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case SSP: return "Policy for handling information related to a provider of sensitive services, which will be afforded heightened confidentiality.  Description:  Policies may govern sensitivity of information related to providers who deliver sensitive healthcare services in order to protect the privacy, well-being, and safety of the provider and of patients receiving sensitive services.\r\n\n                        \n                           Usage Notes: If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case ADOL: return "Policy for handling information related to an adolescent, which will be afforded heightened confidentiality per applicable organizational or jurisdictional policy.  An enterprise may have a policy that requires that adolescent patient information be provided heightened confidentiality.  Information deemed sensitive typically includes health information and patient role information including patient status, demographics, next of kin, and location.\r\n\n                        \n                           Usage Note: For use within an enterprise in which an adolescent is the information subject.  If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case CEL: return "Policy for handling information related to a celebrity (people of public interest (VIP), which will be afforded heightened confidentiality.  Celebrities are people of public interest (VIP) about whose information an enterprise may have a policy that requires heightened confidentiality.  Information deemed sensitive may include health information and patient role information including patient status, demographics, next of kin, and location.\r\n\n                        \n                           Usage Note:  For use within an enterprise in which the information subject is deemed a celebrity or very important person.  If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case DIA: return "Policy for handling information related to a diagnosis, health condition or health problem, which will be afforded heightened confidentiality.  Diagnostic, health condition or health problem related information may be deemed sensitive by organizational policy, and require heightened confidentiality.\r\n\n                        \n                           Usage Note: For use within an enterprise that provides heightened confidentiality to  diagnostic, health condition or health problem related information deemed sensitive.   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case DRGIS: return "Policy for handling information related to a drug, which will be afforded heightened confidentiality. Drug information may be deemed sensitive by organizational policy, and require heightened confidentiality.\r\n\n                        \n                           Usage Note: For use within an enterprise that provides heightened confidentiality to drug information deemed sensitive.   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case EMP: return "Policy for handling information related to an employee, which will be afforded heightened confidentiality. When a patient is an employee, an enterprise may have a policy that requires heightened confidentiality.  Information deemed sensitive typically includes health information and patient role information including patient status, demographics, next of kin, and location.\r\n\n                        \n                           Usage Note: Policy for handling information related to an employee, which will be afforded heightened confidentiality.  Description:  When a patient is an employee, an enterprise may have a policy that requires heightened confidentiality.  Information deemed sensitive typically includes health information and patient role information including patient status, demographics, next of kin, and location.";
+            case PDS: return "Policy for handling information reported by the patient about another person, e.g., a family member, which will be afforded heightened confidentiality. Sensitive information reported by the patient about another person, e.g., family members may be deemed sensitive by default.  The flag may be set or cleared on patient's request.  \r\n\n                        \n                           Usage Note: For sensitive information relayed by or about a patient, which is deemed sensitive within the enterprise (i.e., by default regardless of whether the patient requested that the information be deemed sensitive.)   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case PRS: return "For sensitive information relayed by or about a patient, which is deemed sensitive within the enterprise (i.e., by default regardless of whether the patient requested that the information be deemed sensitive.)   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.\r\n\n                        \n                           Usage Note: For use within an enterprise that provides heightened confidentiality to certain types of information designated by a patient as sensitive.   If there is a jurisdictional mandate, then use the applicable ActPrivacyLaw code system, and specify the law rather than or in addition to this more generic code.";
+            case COMPT: return "This is the healthcare analog to the US Intelligence Community's concept of a Special Access Program.  Compartment codes may be used in as a field value in an initiator's clearance to indicate permission to access and use an IT Resource with a security label having the same compartment value in security category label field.\r\n\n                        Map: Aligns with ISO 2382-8 definition of Compartment - \"A division of data into isolated blocks with separate security controls for the purpose of reducing risk.\"";
+            case HRCOMPT: return "A security category label field value, which indicates that access and use of an IT resource is restricted to members of human resources department or workflow.";
+            case RESCOMPT: return "A security category label field value, which indicates that access and use of an IT resource is restricted to members of a research project.";
+            case RMGTCOMPT: return "A security category label field value, which indicates that access and use of an IT resource is restricted to members of records management department or workflow.";
+            case ACTTRUSTPOLICYTYPE: return "A mandate, obligation, requirement, rule, or expectation conveyed as security metadata between senders and receivers required to establish the reliability, authenticity, and trustworthiness of their transactions.\r\n\n                        Trust security metadata are observation made about aspects of trust applicable to an IT resource (data, information object, service, or system capability).\r\n\n                        Trust applicable to IT resources is established and maintained in and among security domains, and may be comprised of observations about the domain's trust authority, trust framework, trust policy, trust interaction rules, means for assessing and monitoring adherence to trust policies, mechanisms that enforce trust, and quality and reliability measures of assurance in those mechanisms. [Based on ISO IEC 10181-1 and NIST SP 800-63-2]\r\n\n                        For example, identity proofing , level of assurance, and Trust Framework.";
+            case TRSTACCRD: return "Type of security metadata about the formal declaration by an authority or neutral third party that validates the technical, security, trust, and business practice conformance of Trust Agents to facilitate security, interoperability, and trust among participants within a security domain or trust framework.";
+            case TRSTAGRE: return "Type of security metadata about privacy and security requirements with which a security domain must comply. [ISO IEC 10181-1]";
+            case TRSTASSUR: return "Type of security metadata about the digital quality or reliability of a trust assertion, activity, capability, information exchange, mechanism, process, or protocol.";
+            case TRSTCERT: return "Type of security metadata about a set of security-relevant data issued by a security authority or trusted third party, together with security information which is used to provide the integrity and data origin authentication services for an IT resource (data, information object, service, or system capability). [Based on ISO IEC 10181-1]";
+            case TRSTFWK: return "Type of security metadata about a complete set of contracts, regulations, or commitments that enable participating actors to rely on certain assertions by other actors to fulfill their information security requirements. [Kantara Initiative]";
+            case TRSTMEC: return "Type of security metadata about a security architecture system component that supports enforcement of security policies.";
+            case COVPOL: return "Description:A mandate, obligation, requirement, rule, or expectation unilaterally imposed on benefit coverage under a policy or program by a sponsor, underwriter or payor on:\r\n\n                        \n                           \n                              The activity of another party\r\n\n                           \n                           \n                              The behavior of another party\r\n\n                           \n                           \n                              The manner in which an act is executed\r\n\n                           \n                        \n                        \n                           Examples:A clinical protocol imposed by a payer to which a provider must adhere in order to be paid for providing the service.  A formulary from which a provider must select prescribed drugs in order for the patient to incur a lower copay.";
+            case SECURITYPOLICY: return "Types of security policies that further specify the ActClassPolicy value set.\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           obligation to encrypt\n                           refrain from redisclosure without consent";
+            case OBLIGATIONPOLICY: return "Conveys the mandated workflow action that an information custodian, receiver, or user must perform.  \r\n\n                        \n                           Usage Notes: Per ISO 22600-2, ObligationPolicy instances 'are event-triggered and define actions to be performed by manager agent'. Per HL7 Composite Security and Privacy Domain Analysis Model:  This value set refers to the action required to receive the permission specified in the privacy rule. Per OASIS XACML, an obligation is an operation specified in a policy or policy that is performed in conjunction with the enforcement of an access control decision.";
+            case ANONY: return "Custodian system must remove any information that could result in identifying the information subject.";
+            case AOD: return "Custodian system must make available to an information subject upon request an accounting of certain disclosures of the individual’s protected health information over a period of time.  Policy may dictate that the accounting include information about the information disclosed,  the date of disclosure, the identification of the receiver, the purpose of the disclosure, the time in which the disclosing entity must provide a response and the time period for which accountings of disclosure can be requested.";
+            case AUDIT: return "Custodian system must monitor systems to ensure that all users are authorized to operate on information objects.";
+            case AUDTR: return "Custodian system must monitor and maintain retrievable log for each user and operation on information.";
+            case CPLYCC: return "Custodian security system must retrieve, evaluate, and comply with the information handling directions of the Confidentiality Code associated with an information target.";
+            case CPLYCD: return "Custodian security system must retrieve, evaluate, and comply with applicable information subject consent directives.";
+            case CPLYJPP: return "Custodian security system must retrieve, evaluate, and comply with applicable jurisdictional privacy policies associated with the target information.";
+            case CPLYOPP: return "Custodian security system must retrieve, evaluate, and comply with applicable organizational privacy policies associated with the target information.";
+            case CPLYOSP: return "Custodian security system must retrieve, evaluate, and comply with the organizational security policies associated with the target information.";
+            case CPLYPOL: return "Custodian security system must retrieve, evaluate, and comply with applicable policies associated with the target information.";
+            case DECLASSIFYLABEL: return "Custodian security system must declassify information assigned security labels by instantiating a new version of the classified information so as to break the binding of the classifying security label when assigning a new security label that marks the information as unclassified in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the previous assignment and binding.";
+            case DEID: return "Custodian system must strip information of data that would allow the identification of the source of the information or the information subject.";
+            case DELAU: return "Custodian system must remove target information from access after use.";
+            case DOWNGRDLABEL: return "Custodian security system must downgrade information assigned security labels by instantiating a new version of the classified information so as to break the binding of the classifying security label when assigning a new security label that marks the information as classified at a less protected level in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the previous assignment and binding.";
+            case DRIVLABEL: return "Custodian security system must assign and bind security labels derived from compilations of information by aggregation or disaggregation in order to classify information compiled in the information systems under its control for collection, access, use and disclosure in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the previous assignment and binding.";
+            case ENCRYPT: return "Custodian system must render information unreadable by algorithmically transforming plaintext into ciphertext.  \r\n\n                        \r\n\n                        \n                           Usage Notes: A mathematical transposition of a file or data stream so that it cannot be deciphered at the receiving end without the proper key. Encryption is a security feature that assures that only the parties who are supposed to be participating in a videoconference or data transfer are able to do so. It can include a password, public and private keys, or a complex combination of all.  (Per Infoway.)";
+            case ENCRYPTR: return "Custodian system must render information unreadable and unusable by algorithmically transforming plaintext into ciphertext when \"at rest\" or in storage.";
+            case ENCRYPTT: return "Custodian system must render information unreadable and unusable by algorithmically transforming plaintext into ciphertext while \"in transit\" or being transported by any means.";
+            case ENCRYPTU: return "Custodian system must render information unreadable and unusable by algorithmically transforming plaintext into ciphertext while in use such that operations permitted on the target information are limited by the license granted to the end user.";
+            case HUAPRV: return "Custodian system must require human review and approval for permission requested.";
+            case LABEL: return "Custodian security system must assign and bind security labels in order to classify information created in the information systems under its control for collection, access, use and disclosure in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the assignment and binding.\r\n\n                        \n                           Usage Note: In security systems, security policy label assignments do not change, they may supersede prior assignments, and such reassignments are always tracked for auditing and other purposes.";
+            case MASK: return "Custodian system must render information unreadable and unusable by algorithmically transforming plaintext into ciphertext.  User may be provided a key to decrypt per license or \"shared secret\".";
+            case MINEC: return "Custodian must limit access and disclosure to the minimum information required to support an authorized user's purpose of use.  \r\n\n                        \n                           Usage Note: Limiting the information available for access and disclosure to that an authorized user or receiver \"needs to know\" in order to perform permitted workflow or purpose of use.";
+            case PERSISTLABEL: return "Custodian security system must persist the binding of security labels to classify information received or imported by information systems under its control for collection, access, use and disclosure in accordance with applicable jurisdictional privacy policies associated with the target information.  The system must retain an immutable record of the assignment and binding.";
+            case PRIVMARK: return "Custodian must create and/or maintain human readable security label tags as required by policy.\r\n\n                        Map:  Aligns with ISO 22600-3 Section A.3.4.3 description of privacy mark:  \"If present, the privacy-mark is not used for access control. The content of the privacy-mark may be defined by the security policy in force (identified by the security-policy-identifier) which may define a list of values to be used. Alternately, the value may be determined by the originator of the security-label.\"";
+            case PSEUD: return "Custodian system must strip information of data that would allow the identification of the source of the information or the information subject.  Custodian may retain a key to relink data necessary to reidentify the information subject.";
+            case REDACT: return "Custodian system must remove information, which is not authorized to be access, used, or disclosed from records made available to otherwise authorized users.";
+            case UPGRDLABEL: return "Custodian security system must declassify information assigned security labels by instantiating a new version of the classified information so as to break the binding of the classifying security label when assigning a new security label that marks the information as classified at a more protected level  in accordance with applicable jurisdictional privacy policies associated with the target information. The system must retain an immutable record of the previous assignment and binding.";
+            case REFRAINPOLICY: return "Conveys prohibited actions which an information custodian, receiver, or user is not permitted to perform unless otherwise authorized or permitted under specified circumstances.\r\n\n                        \r\n\n                        \n                           Usage Notes: ISO 22600-2 species that a Refrain Policy \"defines actions the subjects must refrain from performing\".  Per HL7 Composite Security and Privacy Domain Analysis Model:  May be used to indicate that a specific action is prohibited based on specific access control attributes e.g., purpose of use, information type, user role, etc.";
+            case NOAUTH: return "Prohibition on disclosure without information subject's authorization.";
+            case NOCOLLECT: return "Prohibition on collection or storage of the information.";
+            case NODSCLCD: return "Prohibition on disclosure without organizational approved patient restriction.";
+            case NODSCLCDS: return "Prohibition on disclosure without a consent directive from the information subject.";
+            case NOINTEGRATE: return "Prohibition on Integration into other records.";
+            case NOLIST: return "Prohibition on disclosure except to entities on specific access list.";
+            case NOMOU: return "Prohibition on disclosure without an interagency service agreement or memorandum of understanding (MOU).";
+            case NOORGPOL: return "Prohibition on disclosure without organizational authorization.";
+            case NOPAT: return "Prohibition on disclosing information to patient, family or caregivers without attending provider's authorization.\r\n\n                        \n                           Usage Note: The information may be labeled with the ActInformationSensitivity TBOO code, triggering application of this RefrainPolicy code as a handling caveat controlling access.\r\n\n                        Maps to FHIR NOPAT: Typically, this is used on an Alert resource, when the alert records information on patient abuse or non-compliance.\r\n\n                        FHIR print name is \"keep information from patient\". Maps to the French realm - code: INVISIBLE_PATIENT.\r\n\n                        \n                           displayName: Document non visible par le patient\n                           codingScheme: 1.2.250.1.213.1.1.4.13\n                        \n                        French use case:  A label for documents that the author  chose to hide from the patient until the content can be disclose to the patient in a face to face meeting between a healthcare professional and the patient (in French law some results like cancer diagnosis or AIDS diagnosis must be announced to the patient by a healthcare professional and should not be find out by the patient alone).";
+            case NOPERSISTP: return "Prohibition on collection of the information beyond time necessary to accomplish authorized purpose of use is prohibited.";
+            case NORDSCLCD: return "Prohibition on redisclosure without patient consent directive.";
+            case NORDSCLCDS: return "Prohibition on redisclosure without a consent directive from the information subject.";
+            case NORDSCLW: return "Prohibition on disclosure without authorization under jurisdictional law.";
+            case NORELINK: return "Prohibition on associating de-identified or pseudonymized information with other information in a manner that could or does result in disclosing information intended to be masked.";
+            case NOREUSE: return "Prohibition on use of the information beyond the purpose of use initially authorized.";
+            case NOVIP: return "Prohibition on disclosure except to principals with access permission to specific VIP information.";
+            case ORCON: return "Prohibition on disclosure except as permitted by the information originator.";
+            case _ACTPRODUCTACQUISITIONCODE: return "The method that a product is obtained for use by the subject of the supply act (e.g. patient).  Product examples are consumable or durable goods.";
+            case LOAN: return "Temporary supply of a product without transfer of ownership for the product.";
+            case RENT: return "Temporary supply of a product with financial compensation, without transfer of ownership for the product.";
+            case TRANSFER: return "Transfer of ownership for a product.";
+            case SALE: return "Transfer of ownership for a product for financial compensation.";
+            case _ACTSPECIMENTRANSPORTCODE: return "Transportation of a specimen.";
+            case SREC: return "Description:Specimen has been received by the participating organization/department.";
+            case SSTOR: return "Description:Specimen has been placed into storage at a participating location.";
+            case STRAN: return "Description:Specimen has been put in transit to a participating receiver.";
+            case _ACTSPECIMENTREATMENTCODE: return "Set of codes related to specimen treatments";
+            case ACID: return "The lowering of specimen pH through the addition of an acid";
+            case ALK: return "The act rendering alkaline by impregnating with an alkali; a conferring of alkaline qualities.";
+            case DEFB: return "The removal of fibrin from whole blood or plasma through physical or chemical means";
+            case FILT: return "The passage of a liquid through a filter, accomplished by gravity, pressure or vacuum (suction).";
+            case LDLP: return "LDL Precipitation";
+            case NEUT: return "The act or process by which an acid and a base are combined in such proportions that the resulting compound is neutral.";
+            case RECA: return "The addition of calcium back to a specimen after it was removed by chelating agents";
+            case UFIL: return "The filtration of a colloidal substance through a semipermeable medium that allows only the passage of small molecules.";
+            case _ACTSUBSTANCEADMINISTRATIONCODE: return "Description: Describes the type of substance administration being performed.  This should not be used to carry codes for identification of products.  Use an associated role or entity to carry such information.";
+            case DRUG: return "The introduction of a drug into a subject with the intention of altering its biologic state with the intent of improving its health status.";
+            case FD: return "Description: The introduction of material into a subject with the intent of providing nutrition or other dietary supplements (e.g. minerals or vitamins).";
+            case IMMUNIZ: return "The introduction of an immunogen with the intent of stimulating an immune response, aimed at preventing subsequent infections by more viable agents.";
+            case BOOSTER: return "An additional immunization administration within a series intended to bolster or enhance immunity.";
+            case INITIMMUNIZ: return "The first immunization administration in a series intended to produce immunity";
+            case _ACTTASKCODE: return "Description: A task or action that a user may perform in a clinical information system (e.g., medication order entry, laboratory test results review, problem list entry).";
+            case OE: return "A clinician creates a request for a service to be performed for a given patient.";
+            case LABOE: return "A clinician creates a request for a laboratory test to be done for a given patient.";
+            case MEDOE: return "A clinician creates a request for the administration of one or more medications to a given patient.";
+            case PATDOC: return "A person enters documentation about a given patient.";
+            case ALLERLREV: return "Description: A person reviews a list of known allergies of a given patient.";
+            case CLINNOTEE: return "A clinician enters a clinical note about a given patient";
+            case DIAGLISTE: return "A clinician enters a diagnosis for a given patient.";
+            case DISCHINSTE: return "A person provides a discharge instruction to a patient.";
+            case DISCHSUME: return "A clinician enters a discharge summary for a given patient.";
+            case PATEDUE: return "A person provides a patient-specific education handout to a patient.";
+            case PATREPE: return "A pathologist enters a report for a given patient.";
+            case PROBLISTE: return "A clinician enters a problem for a given patient.";
+            case RADREPE: return "A radiologist enters a report for a given patient.";
+            case IMMLREV: return "Description: A person reviews a list of immunizations due or received for a given patient.";
+            case REMLREV: return "Description: A person reviews a list of health care reminders for a given patient.";
+            case WELLREMLREV: return "Description: A person reviews a list of wellness or preventive care reminders for a given patient.";
+            case PATINFO: return "A person (e.g., clinician, the patient herself) reviews patient information in the electronic medical record.";
+            case ALLERLE: return "Description: A person enters a known allergy for a given patient.";
+            case CDSREV: return "A person reviews a recommendation/assessment provided automatically by a clinical decision support application for a given patient.";
+            case CLINNOTEREV: return "A person reviews a clinical note of a given patient.";
+            case DISCHSUMREV: return "A person reviews a discharge summary of a given patient.";
+            case DIAGLISTREV: return "A person reviews a list of diagnoses of a given patient.";
+            case IMMLE: return "Description: A person enters an immunization due or received for a given patient.";
+            case LABRREV: return "A person reviews a list of laboratory results of a given patient.";
+            case MICRORREV: return "A person reviews a list of microbiology results of a given patient.";
+            case MICROORGRREV: return "A person reviews organisms of microbiology results of a given patient.";
+            case MICROSENSRREV: return "A person reviews the sensitivity test of microbiology results of a given patient.";
+            case MLREV: return "A person reviews a list of medication orders submitted to a given patient";
+            case MARWLREV: return "A clinician reviews a work list of medications to be administered to a given patient.";
+            case OREV: return "A person reviews a list of orders submitted to a given patient.";
+            case PATREPREV: return "A person reviews a pathology report of a given patient.";
+            case PROBLISTREV: return "A person reviews a list of problems of a given patient.";
+            case RADREPREV: return "A person reviews a radiology report of a given patient.";
+            case REMLE: return "Description: A person enters a health care reminder for a given patient.";
+            case WELLREMLE: return "Description: A person enters a wellness or preventive care reminder for a given patient.";
+            case RISKASSESS: return "A person reviews a Risk Assessment Instrument report of a given patient.";
+            case FALLRISK: return "A person reviews a Falls Risk Assessment Instrument report of a given patient.";
+            case _ACTTRANSPORTATIONMODECODE: return "Characterizes how a transportation act was or will be carried out.\r\n\n                        \n                           Examples: Via private transport, via public transit, via courier.";
+            case _ACTPATIENTTRANSPORTATIONMODECODE: return "Definition: Characterizes how a patient was or will be transported to the site of a patient encounter.\r\n\n                        \n                           Examples: Via ambulance, via public transit, on foot.";
+            case AFOOT: return "pedestrian transport";
+            case AMBT: return "ambulance transport";
+            case AMBAIR: return "fixed-wing ambulance transport";
+            case AMBGRND: return "ground ambulance transport";
+            case AMBHELO: return "helicopter ambulance transport";
+            case LAWENF: return "law enforcement transport";
+            case PRVTRN: return "private transport";
+            case PUBTRN: return "public transport";
+            case _OBSERVATIONTYPE: return "Identifies the kinds of observations that can be performed";
+            case _ACTSPECOBSCODE: return "Identifies the type of observation that is made about a specimen that may affect its processing, analysis or further result interpretation";
+            case ARTBLD: return "Describes the artificial blood identifier that is associated with the specimen.";
+            case DILUTION: return "An observation that reports the dilution of a sample.";
+            case AUTOHIGH: return "The dilution of a sample performed by automated equipment.  The value is specified by the equipment";
+            case AUTOLOW: return "The dilution of a sample performed by automated equipment.  The value is specified by the equipment";
+            case PRE: return "The dilution of the specimen made prior to being loaded onto analytical equipment";
+            case RERUN: return "The value of the dilution of a sample after it had been analyzed at a prior dilution value";
+            case EVNFCTS: return "Domain provides codes that qualify the ActLabObsEnvfctsCode domain. (Environmental Factors)";
+            case INTFR: return "An observation that relates to factors that may potentially cause interference with the observation";
+            case FIBRIN: return "The Fibrin Index of the specimen. In the case of only differentiating between Absent and Present, recommend using 0 and 1";
+            case HEMOLYSIS: return "An observation of the hemolysis index of the specimen in g/L";
+            case ICTERUS: return "An observation that describes the icterus index of the specimen.  It is recommended to use mMol/L of bilirubin";
+            case LIPEMIA: return "An observation used to describe the Lipemia Index of the specimen. It is recommended to use the optical turbidity at 600 nm (in absorbance units).";
+            case VOLUME: return "An observation that reports the volume of a sample.";
+            case AVAILABLE: return "The available quantity of specimen.   This is the current quantity minus any planned consumption (e.g., tests that are planned)";
+            case CONSUMPTION: return "The quantity of specimen that is used each time the equipment uses this substance";
+            case CURRENT: return "The current quantity of the specimen, i.e., initial quantity minus what has been actually used.";
+            case INITIAL: return "The initial quantity of the specimen in inventory";
+            case _ANNOTATIONTYPE: return "AnnotationType";
+            case _ACTPATIENTANNOTATIONTYPE: return "Description:Provides a categorization for annotations recorded directly against the patient .";
+            case ANNDI: return "Description:A note that is specific to a patient's diagnostic images, either historical, current or planned.";
+            case ANNGEN: return "Description:A general or uncategorized note.";
+            case ANNIMM: return "A note that is specific to a patient's immunizations, either historical, current or planned.";
+            case ANNLAB: return "Description:A note that is specific to a patient's laboratory results, either historical, current or planned.";
+            case ANNMED: return "Description:A note that is specific to a patient's medications, either historical, current or planned.";
+            case _GENETICOBSERVATIONTYPE: return "Description: None provided";
+            case GENE: return "Description: A DNA segment that contributes to phenotype/function. In the absence of demonstrated function a gene may be characterized by sequence, transcription or homology";
+            case _IMMUNIZATIONOBSERVATIONTYPE: return "Description: Observation codes which describe characteristics of the immunization material.";
+            case OBSANTC: return "Description: Indicates the valid antigen count.";
+            case OBSANTV: return "Description: Indicates whether an antigen is valid or invalid.";
+            case _INDIVIDUALCASESAFETYREPORTTYPE: return "A code that is used to indicate the type of case safety report received from sender. The current code example reference is from the International Conference on Harmonisation (ICH) Expert Workgroup guideline on Clinical Safety Data Management: Data Elements for Transmission of Individual Case Safety Reports. The unknown/unavailable option allows the transmission of information from a secondary sender where the initial sender did not specify the type of report.\r\n\n                        Example concepts include: Spontaneous, Report from study, Other.";
+            case PATADVEVNT: return "Indicates that the ICSR is describing problems that a patient experienced after receiving a vaccine product.";
+            case VACPROBLEM: return "Indicates that the ICSR is describing a problem with the actual vaccine product such as physical defects (cloudy, particulate matter) or inability to confer immunity.";
+            case _LOINCOBSERVATIONACTCONTEXTAGETYPE: return "Definition:The set of LOINC codes for the act of determining the period of time that has elapsed since an entity was born or created.";
+            case _216119: return "Definition:Estimated age.";
+            case _216127: return "Definition:Reported age.";
+            case _295535: return "Definition:Calculated age.";
+            case _305250: return "Definition:General specification of age with no implied method of determination.";
+            case _309724: return "Definition:Age at onset of associated adverse event; no implied method of determination.";
+            case _MEDICATIONOBSERVATIONTYPE: return "MedicationObservationType";
+            case REPHALFLIFE: return "Description:This observation represents an 'average' or 'expected' half-life typical of the product.";
+            case SPLCOATING: return "Definition: A characteristic of an oral solid dosage form of a medicinal product, indicating whether it has one or more coatings such as sugar coating, film coating, or enteric coating.  Only coatings to the external surface or the dosage form should be considered (for example, coatings to individual pellets or granules inside a capsule or tablet are excluded from consideration).\r\n\n                        \n                           Constraints: The Observation.value must be a Boolean (BL) with true for the presence or false for the absence of one or more coatings on a solid dosage form.";
+            case SPLCOLOR: return "Definition:  A characteristic of an oral solid dosage form of a medicinal product, specifying the color or colors that most predominantly define the appearance of the dose form. SPLCOLOR is not an FDA specification for the actual color of solid dosage forms or the names of colors that can appear in labeling.\r\n\n                        \n                           Constraints: The Observation.value must be a single coded value or a list of multiple coded values, specifying one or more distinct colors that approximate of the color(s) of distinct areas of the solid dosage form, such as the different sides of a tablet or one-part capsule, or the different halves of a two-part capsule.  Bands on banded capsules, regardless of the color, are not considered when assigning an SPLCOLOR. Imprints on the dosage form, regardless of their color are not considered when assigning an SPLCOLOR. If more than one color exists on a particular side or half, then the most predominant color on that side or half is recorded.  If the gelatin capsule shell is colorless and transparent, use the predominant color of the contents that appears through the colorless and transparent capsule shell. Colors can include: Black;Gray;White;Red;Pink;Purple;Green;Yellow;Orange;Brown;Blue;Turquoise.";
+            case SPLIMAGE: return "Description: A characteristic representing a single file reference that contains two or more views of the same dosage form of the product; in most cases this should represent front and back views of the dosage form, but occasionally additional views might be needed in order to capture all of the important physical characteristics of the dosage form.  Any imprint and/or symbol should be clearly identifiable, and the viewer should not normally need to rotate the image in order to read it.  Images that are submitted with SPL should be included in the same directory as the SPL file.";
+            case SPLIMPRINT: return "Definition:  A characteristic of an oral solid dosage form of a medicinal product, specifying the alphanumeric text that appears on the solid dosage form, including text that is embossed, debossed, engraved or printed with ink. The presence of other non-textual distinguishing marks or symbols is recorded by SPLSYMBOL.\r\n\n                        \n                           Examples: Included in SPLIMPRINT are alphanumeric text that appears on the bands of banded capsules and logos and other symbols that can be interpreted as letters or numbers.\r\n\n                        \n                           Constraints: The Observation.value must be of type Character String (ST). Excluded from SPLIMPRINT are internal and external cut-outs in the form of alphanumeric text and the letter 'R' with a circle around it (when referring to a registered trademark) and the letters 'TM' (when referring to a 'trade mark').  To record text, begin on either side or part of the dosage form. Start at the top left and progress as one would normally read a book.  Enter a semicolon to show separation between words or line divisions.";
+            case SPLSCORING: return "Definition: A characteristic of an oral solid dosage form of a medicinal product, specifying the number of equal pieces that the solid dosage form can be divided into using score line(s). \r\n\n                        \n                           Example: One score line creating two equal pieces is given a value of 2, two parallel score lines creating three equal pieces is given a value of 3.\r\n\n                        \n                           Constraints: Whether three parallel score lines create four equal pieces or two intersecting score lines create two equal pieces using one score line and four equal pieces using both score lines, both have the scoring value of 4. Solid dosage forms that are not scored are given a value of 1. Solid dosage forms that can only be divided into unequal pieces are given a null-value with nullFlavor other (OTH).";
+            case SPLSHAPE: return "Description: A characteristic of an oral solid dosage form of a medicinal product, specifying the two dimensional representation of the solid dose form, in terms of the outside perimeter of a solid dosage form when the dosage form, resting on a flat surface, is viewed from directly above, including slight rounding of corners. SPLSHAPE does not include embossing, scoring, debossing, or internal cut-outs.  SPLSHAPE is independent of the orientation of the imprint and logo. Shapes can include: Triangle (3 sided); Square; Round; Semicircle; Pentagon (5 sided); Diamond; Double circle; Bullet; Hexagon (6 sided); Rectangle; Gear; Capsule; Heptagon (7 sided); Trapezoid; Oval; Clover; Octagon (8 sided); Tear; Freeform.";
+            case SPLSIZE: return "Definition: A characteristic of an oral solid dosage form of a medicinal product, specifying the longest single dimension of the solid dosage form as a physical quantity in the dimension of length (e.g., 3 mm). The length is should be specified in millimeters and should be rounded to the nearest whole millimeter.\r\n\n                        \n                           Example: SPLSIZE for a rectangular shaped tablet is the length and SPLSIZE for a round shaped tablet is the diameter.";
+            case SPLSYMBOL: return "Definition: A characteristic of an oral solid dosage form of a medicinal product, to describe whether or not the medicinal product has a mark or symbol appearing on it for easy and definite recognition.  Score lines, letters, numbers, and internal and external cut-outs are not considered marks or symbols. See SPLSCORING and SPLIMPRINT for these characteristics.\r\n\n                        \n                           Constraints: The Observation.value must be a Boolean (BL) with true indicating the presence and false for the absence of marks or symbols.\r\n\n                        \n                           Example:";
+            case _OBSERVATIONISSUETRIGGERCODEDOBSERVATIONTYPE: return "Distinguishes the kinds of coded observations that could be the trigger for clinical issue detection. These are observations that are not measurable, but instead can be defined with codes. Coded observation types include: Allergy, Intolerance, Medical Condition, Pregnancy status, etc.";
+            case _CASETRANSMISSIONMODE: return "Code for the mechanism by which disease was acquired by the living subject involved in the public health case. Includes sexually transmitted, airborne, bloodborne, vectorborne, foodborne, zoonotic, nosocomial, mechanical, dermal, congenital, environmental exposure, indeterminate.";
+            case AIRTRNS: return "Communication of an agent from a living subject or environmental source to a living subject through indirect contact via oral or nasal inhalation.";
+            case ANANTRNS: return "Communication of an agent from one animal to another proximate animal.";
+            case ANHUMTRNS: return "Communication of an agent from an animal to a proximate person.";
+            case BDYFLDTRNS: return "Communication of an agent from one living subject to another living subject through direct contact with any body fluid.";
+            case BLDTRNS: return "Communication of an agent to a living subject through direct contact with blood or blood products whether the contact with blood is part of  a therapeutic procedure or not.";
+            case DERMTRNS: return "Communication of an agent from a living subject or environmental source to a living subject via agent migration through intact skin.";
+            case ENVTRNS: return "Communication of an agent from an environmental surface or source to a living subject by direct contact.";
+            case FECTRNS: return "Communication of an agent from a living subject or environmental source to a living subject through oral contact with material contaminated by person or animal fecal material.";
+            case FOMTRNS: return "Communication of an agent from an non-living material to a living subject through direct contact.";
+            case FOODTRNS: return "Communication of an agent from a food source to a living subject via oral consumption.";
+            case HUMHUMTRNS: return "Communication of an agent from a person to a proximate person.";
+            case INDTRNS: return "Communication of an agent to a living subject via an undetermined route.";
+            case LACTTRNS: return "Communication of an agent from one living subject to another living subject through direct contact with mammalian milk or colostrum.";
+            case NOSTRNS: return "Communication of an agent from any entity to a living subject while the living subject is in the patient role in a healthcare facility.";
+            case PARTRNS: return "Communication of an agent from a living subject or environmental source to a living subject where the acquisition of the agent is not via the alimentary canal.";
+            case PLACTRNS: return "Communication of an agent from a living subject to the progeny of that living subject via agent migration across the maternal-fetal placental membranes while in utero.";
+            case SEXTRNS: return "Communication of an agent from one living subject to another living subject through direct contact with genital or oral tissues as part of a sexual act.";
+            case TRNSFTRNS: return "Communication of an agent from one living subject to another living subject through direct contact with blood or blood products where the contact with blood is part of  a therapeutic procedure.";
+            case VECTRNS: return "Communication of an agent from a living subject acting as a required intermediary in the agent transmission process to a recipient living subject via direct contact.";
+            case WATTRNS: return "Communication of an agent from a contaminated water source to a living subject whether the water is ingested as a food or not. The route of entry of the water may be through any bodily orifice.";
+            case _OBSERVATIONQUALITYMEASUREATTRIBUTE: return "Codes used to define various metadata aspects of a health quality measure.";
+            case AGGREGATE: return "Indicates that the observation is carrying out an aggregation calculation, contained in the value element.";
+            case CMPMSRMTH: return "Indicates what method is used in a quality measure to combine the component measure results included in an composite measure.";
+            case CMPMSRSCRWGHT: return "An attribute of a quality measure describing the weight this component measure score is to carry in determining the overall composite measure final score. The value is real value greater than 0 and less than 1.0. Each component measure score will be multiplied by its CMPMSRSCRWGHT and then summed with the other component measures to determine the final overall composite measure score. The sum across all CMPMSRSCRWGHT values within a single composite measure SHALL be 1.0. The value assigned is scoped to the composite measure referencing this component measure only.";
+            case COPY: return "Identifies the organization(s) who own the intellectual property represented by the eMeasure.";
+            case CRS: return "Summary of relevant clinical guidelines or other clinical recommendations supporting this eMeasure.";
+            case DEF: return "Description of individual terms, provided as needed.";
+            case DISC: return "Disclaimer information for the eMeasure.";
+            case FINALDT: return "The timestamp when the eMeasure was last packaged in the Measure Authoring Tool.";
+            case GUIDE: return "Used to allow measure developers to provide additional guidance for implementers to understand greater specificity than could be provided in the logic for data criteria.";
+            case IDUR: return "Information on whether an increase or decrease in score is the preferred result \n(e.g., a higher score indicates better quality OR a lower score indicates better quality OR quality is within a range).";
+            case ITMCNT: return "Describes the items counted by the measure (e.g., patients, encounters, procedures, etc.)";
+            case KEY: return "A significant word that aids in discoverability.";
+            case MEDT: return "The end date of the measurement period.";
+            case MSD: return "The start date of the measurement period.";
+            case MSRADJ: return "The method of adjusting for clinical severity and conditions present at the start of care that can influence patient outcomes for making valid comparisons of outcome measures across providers. Indicates whether an eMeasure is subject to the statistical process for reducing, removing, or clarifying the influences of confounding factors to allow more useful comparisons.";
+            case MSRAGG: return "Describes how to combine information calculated based on logic in each of several populations into one summarized result. It can also be used to describe how to risk adjust the data based on supplemental data elements described in the eMeasure. (e.g., pneumonia hospital measures antibiotic selection in the ICU versus non-ICU and then the roll-up of the two). \r\n\n                        \n                           Open Issue: The description does NOT align well with the definition used in the HQMF specfication; correct the MSGAGG definition, and the possible distinction of MSRAGG as a child of AGGREGATE.";
+            case MSRIMPROV: return "Information on whether an increase or decrease in score is the preferred result. This should reflect information on which way is better, an increase or decrease in score.";
+            case MSRJUR: return "The list of jurisdiction(s) for which the measure applies.";
+            case MSRRPTR: return "Type of person or organization that is expected to report the issue.";
+            case MSRRPTTIME: return "The maximum time that may elapse following completion of the measure until the measure report must be sent to the receiver.";
+            case MSRSCORE: return "Indicates how the calculation is performed for the eMeasure \n(e.g., proportion, continuous variable, ratio)";
+            case MSRSET: return "Location(s) in which care being measured is rendered\r\n\n                        Usage Note: MSRSET is used rather than RoleCode because the setting applies to what is being measured, as opposed to participating directly in the health quality measure documantion itself).";
+            case MSRTOPIC: return "health quality measure topic type";
+            case MSRTP: return "The time period for which the eMeasure applies.";
+            case MSRTYPE: return "Indicates whether the eMeasure is used to examine a process or an outcome over time \n(e.g., Structure, Process, Outcome).";
+            case RAT: return "Succinct statement of the need for the measure. Usually includes statements pertaining to Importance criterion: impact, gap in care and evidence.";
+            case REF: return "Identifies bibliographic citations or references to clinical practice guidelines, sources of evidence, or other relevant materials supporting the intent and rationale of the eMeasure.";
+            case SDE: return "Comparison of results across strata can be used to show where disparities exist or where there is a need to expose differences in results. For example, Centers for Medicare & Medicaid Services (CMS) in the U.S. defines four required Supplemental Data Elements (payer, ethnicity, race, and gender), which are variables used to aggregate data into various subgroups. Additional supplemental data elements required for risk adjustment or other purposes of data aggregation can be included in the Supplemental Data Element section.";
+            case STRAT: return "Describes the strata for which the measure is to be evaluated. There are three examples of reasons for stratification based on existing work. These include: (1) evaluate the measure based on different age groupings within the population described in the measure (e.g., evaluate the whole [age 14-25] and each sub-stratum [14-19] and [20-25]); (2) evaluate the eMeasure based on either a specific condition, a specific discharge location, or both; (3) evaluate the eMeasure based on different locations within a facility (e.g., evaluate the overall rate for all intensive care units and also some strata include additional findings [specific birth weights for neonatal intensive care units]).";
+            case TRANF: return "Can be a URL or hyperlinks that link to the transmission formats that are specified for a particular reporting program.";
+            case USE: return "Usage notes.";
+            case _OBSERVATIONSEQUENCETYPE: return "ObservationSequenceType";
+            case TIMEABSOLUTE: return "A sequence of values in the \"absolute\" time domain.  This is the same time domain that all HL7 timestamps use.  It is time as measured by the Gregorian calendar";
+            case TIMERELATIVE: return "A sequence of values in a \"relative\" time domain.  The time is measured relative to the earliest effective time in the Observation Series containing this sequence.";
+            case _OBSERVATIONSERIESTYPE: return "ObservationSeriesType";
+            case _ECGOBSERVATIONSERIESTYPE: return "ECGObservationSeriesType";
+            case REPRESENTATIVEBEAT: return "This Observation Series type contains waveforms of a \"representative beat\" (a.k.a. \"median beat\" or \"average beat\").  The waveform samples are measured in relative time, relative to the beginning of the beat as defined by the Observation Series effective time.  The waveforms are not directly acquired from the subject, but rather algorithmically derived from the \"rhythm\" waveforms.";
+            case RHYTHM: return "This Observation type contains ECG \"rhythm\" waveforms.  The waveform samples are measured in absolute time (a.k.a. \"subject time\" or \"effective time\").  These waveforms are usually \"raw\" with some minimal amount of noise reduction and baseline filtering applied.";
+            case _PATIENTIMMUNIZATIONRELATEDOBSERVATIONTYPE: return "Description: Reporting codes that are related to an immunization event.";
+            case CLSSRM: return "Description: The class room associated with the patient during the immunization event.";
+            case GRADE: return "Description: The school grade or level the patient was in when immunized.";
+            case SCHL: return "Description: The school the patient attended when immunized.";
+            case SCHLDIV: return "Description: The school division or district associated with the patient during the immunization event.";
+            case TEACHER: return "Description: The patient's teacher when immunized.";
+            case _POPULATIONINCLUSIONOBSERVATIONTYPE: return "Observation types for specifying criteria used to assert that a subject is included in a particular population.";
+            case DENEX: return "Criteria which specify subjects who should be removed from the eMeasure population and denominator before determining if numerator criteria are met. Denominator exclusions are used in proportion and ratio measures to help narrow the denominator.";
+            case DENEXCEP: return "Criteria which specify the removal of a subject, procedure or unit of measurement from the denominator, only if the numerator criteria are not met. Denominator exceptions allow for adjustment of the calculated score for those providers with higher risk populations. Denominator exceptions are used only in proportion eMeasures. They are not appropriate for ratio or continuous variable eMeasures. Denominator exceptions allow for the exercise of clinical judgment and should be specifically defined where capturing the information in a structured manner fits the clinical workflow. Generic denominator exception reasons used in proportion eMeasures fall into three general categories:\r\n\n                        \n                           Medical reasons\n                           Patient (or subject) reasons\n                           System reasons";
+            case DENOM: return "Criteria for specifying the entities to be evaluated by a specific quality measure, based on a shared common set of characteristics (within a specific measurement set to which a given measure belongs).  The denominator can be the same as the initial population, or it may be a subset of the initial population to further constrain it for the purpose of the eMeasure. Different measures within an eMeasure set may have different denominators. Continuous Variable eMeasures do not have a denominator, but instead define a measure population.";
+            case IPOP: return "Criteria for specifying the entities to be evaluated by a specific quality measure, based on a shared common set of characteristics (within a specific measurement set to which a given measure belongs).";
+            case IPPOP: return "Criteria for specifying the patients to be evaluated by a specific quality measure, based on a shared common set of characteristics (within a specific measurement set to which a given measure belongs). Details often include information based upon specific age groups, diagnoses, diagnostic and procedure codes, and enrollment periods.";
+            case MSRPOPL: return "Criteria for specifying\nthe measure population as a narrative description (e.g., all patients seen in the Emergency Department during the measurement period).  This is used only in continuous variable eMeasures.";
+            case MSRPOPLEX: return "Criteria for specifying subjects who should be removed from the eMeasure's Initial Population and Measure Population. Measure Population Exclusions are used in Continuous Variable measures to help narrow the Measure Population before determining the value(s) of the continuous variable(s).";
+            case NUMER: return "Criteria for specifying the processes or outcomes expected for each patient, procedure, or other unit of measurement defined in the denominator for proportion measures, or related to (but not directly derived from) the denominator for ratio measures (e.g., a numerator listing the number of central line blood stream infections and a denominator indicating the days per thousand of central line usage in a specific time period).";
+            case NUMEX: return "Criteria for specifying instances that should not be included in the numerator data. (e.g., if the number of central line blood stream infections per 1000 catheter days were to exclude infections with a specific bacterium, that bacterium would be listed as a numerator exclusion).  Numerator Exclusions are used only in ratio eMeasures.";
+            case _PREFERENCEOBSERVATIONTYPE: return "Types of observations that can be made about Preferences.";
+            case PREFSTRENGTH: return "An observation about how important a preference is to the target of the preference.";
+            case ADVERSEREACTION: return "Indicates that the observation is of an unexpected negative occurrence in the subject suspected to result from the subject's exposure to one or more agents.  Observation values would be the symptom resulting from the reaction.";
+            case ASSERTION: return "Description:Refines classCode OBS to indicate an observation in which observation.value contains a finding or other nominalized statement, where the encoded information in Observation.value is not altered by Observation.code.  For instance, observation.code=\"ASSERTION\" and observation.value=\"fracture of femur present\" is an assertion of a clinical finding of femur fracture.";
+            case CASESER: return "Definition:An observation that provides a characterization of the level of harm to an investigation subject as a result of a reaction or event.";
+            case CDIO: return "An observation that states whether the disease was likely acquired outside the jurisdiction of observation, and if so, the nature of the inter-jurisdictional relationship.\r\n\n                        \n                           OpenIssue: This code could be moved to LOINC if it can be done before there are significant implemenations using it.";
+            case CRIT: return "A clinical judgment as to the worst case result of a future exposure (including substance administration). When the worst case result is assessed to have a life-threatening or organ system threatening potential, it is considered to be of high criticality.";
+            case CTMO: return "An observation that states the mechanism by which disease was acquired by the living subject involved in the public health case.\r\n\n                        \n                           OpenIssue: This code could be moved to LOINC if it can be done before there are significant implemenations using it.";
+            case DX: return "Includes all codes defining types of indications such as diagnosis, symptom and other indications such as contrast agents for lab tests.";
+            case ADMDX: return "Admitting diagnosis are the diagnoses documented  for administrative purposes as the basis for a hospital admission.";
+            case DISDX: return "Discharge diagnosis are the diagnoses documented for administrative purposes as the time of hospital discharge.";
+            case INTDX: return "Intermediate diagnoses are those diagnoses documented for administrative purposes during the course of a hospital stay.";
+            case NOI: return "The type of injury that the injury coding specifies.";
+            case GISTIER: return "Description: Accuracy determined as per the GIS tier code system.";
+            case HHOBS: return "Indicates that the observation is of a person’s living situation in a household including the household composition and circumstances.";
+            case ISSUE: return "There is a clinical issue for the therapy that makes continuation of the therapy inappropriate.\r\n\n                        \n                           Open Issue: The definition of this code does not correctly represent the concept space of its specializations (children)";
+            case _ACTADMINISTRATIVEDETECTEDISSUECODE: return "Identifies types of detectyed issues for Act class \"ALRT\" for the administrative and patient administrative acts domains.";
+            case _ACTADMINISTRATIVEAUTHORIZATIONDETECTEDISSUECODE: return "ActAdministrativeAuthorizationDetectedIssueCode";
+            case NAT: return "The requesting party has insufficient authorization to invoke the interaction.";
+            case SUPPRESSED: return "Description: One or more records in the query response have been suppressed due to consent or privacy restrictions.";
+            case VALIDAT: return "Description:The specified element did not pass business-rule validation.";
+            case KEY204: return "The ID of the patient, order, etc., was not found. Used for transactions other than additions, e.g. transfer of a non-existent patient.";
+            case KEY205: return "The ID of the patient, order, etc., already exists. Used in response to addition transactions (Admit, New Order, etc.).";
+            case COMPLY: return "There may be an issue with the patient complying with the intentions of the proposed therapy";
+            case DUPTHPY: return "The proposed therapy appears to duplicate an existing therapy";
+            case DUPTHPCLS: return "Description:The proposed therapy appears to have the same intended therapeutic benefit as an existing therapy, though the specific mechanisms of action vary.";
+            case DUPTHPGEN: return "Description:The proposed therapy appears to have the same intended therapeutic benefit as an existing therapy and uses the same mechanisms of action as the existing therapy.";
+            case ABUSE: return "Description:The proposed therapy is frequently misused or abused and therefore should be used with caution and/or monitoring.";
+            case FRAUD: return "Description:The request is suspected to have a fraudulent basis.";
+            case PLYDOC: return "A similar or identical therapy was recently ordered by a different practitioner.";
+            case PLYPHRM: return "This patient was recently supplied a similar or identical therapy from a different pharmacy or supplier.";
+            case DOSE: return "Proposed dosage instructions for therapy differ from standard practice.";
+            case DOSECOND: return "Description:Proposed dosage is inappropriate due to patient's medical condition.";
+            case DOSEDUR: return "Proposed length of therapy differs from standard practice.";
+            case DOSEDURH: return "Proposed length of therapy is longer than standard practice";
+            case DOSEDURHIND: return "Proposed length of therapy is longer than standard practice for the identified indication or diagnosis";
+            case DOSEDURL: return "Proposed length of therapy is shorter than that necessary for therapeutic effect";
+            case DOSEDURLIND: return "Proposed length of therapy is shorter than standard practice for the identified indication or diagnosis";
+            case DOSEH: return "Proposed dosage exceeds standard practice";
+            case DOSEHINDA: return "Proposed dosage exceeds standard practice for the patient's age";
+            case DOSEHIND: return "High Dose for Indication Alert";
+            case DOSEHINDSA: return "Proposed dosage exceeds standard practice for the patient's height or body surface area";
+            case DOSEHINDW: return "Proposed dosage exceeds standard practice for the patient's weight";
+            case DOSEIVL: return "Proposed dosage interval/timing differs from standard practice";
+            case DOSEIVLIND: return "Proposed dosage interval/timing differs from standard practice for the identified indication or diagnosis";
+            case DOSEL: return "Proposed dosage is below suggested therapeutic levels";
+            case DOSELINDA: return "Proposed dosage is below suggested therapeutic levels for the patient's age";
+            case DOSELIND: return "Low Dose for Indication Alert";
+            case DOSELINDSA: return "Proposed dosage is below suggested therapeutic levels for the patient's height or body surface area";
+            case DOSELINDW: return "Proposed dosage is below suggested therapeutic levels for the patient's weight";
+            case MDOSE: return "Description:The maximum quantity of this drug allowed to be administered within a particular time-range (month, year, lifetime) has been reached or exceeded.";
+            case OBSA: return "Proposed therapy may be inappropriate or contraindicated due to conditions or characteristics of the patient";
+            case AGE: return "Proposed therapy may be inappropriate or contraindicated due to patient age";
+            case ADALRT: return "Proposed therapy is outside of the standard practice for an adult patient.";
+            case GEALRT: return "Proposed therapy is outside of standard practice for a geriatric patient.";
+            case PEALRT: return "Proposed therapy is outside of the standard practice for a pediatric patient.";
+            case COND: return "Proposed therapy may be inappropriate or contraindicated due to an existing/recent patient condition or diagnosis";
+            case HGHT: return "";
+            case LACT: return "Proposed therapy may be inappropriate or contraindicated when breast-feeding";
+            case PREG: return "Proposed therapy may be inappropriate or contraindicated during pregnancy";
+            case WGHT: return "";
+            case CREACT: return "Description:Proposed therapy may be inappropriate or contraindicated because of a common but non-patient specific reaction to the product.\r\n\n                        \n                           Example:There is no record of a specific sensitivity for the patient, but the presence of the sensitivity is common and therefore caution is warranted.";
+            case GEN: return "Proposed therapy may be inappropriate or contraindicated due to patient genetic indicators.";
+            case GEND: return "Proposed therapy may be inappropriate or contraindicated due to patient gender.";
+            case LAB: return "Proposed therapy may be inappropriate or contraindicated due to recent lab test results";
+            case REACT: return "Proposed therapy may be inappropriate or contraindicated based on the potential for a patient reaction to the proposed product";
+            case ALGY: return "Proposed therapy may be inappropriate or contraindicated because of a recorded patient allergy to the proposed product.  (Allergies are immune based reactions.)";
+            case INT: return "Proposed therapy may be inappropriate or contraindicated because of a recorded patient intolerance to the proposed product.  (Intolerances are non-immune based sensitivities.)";
+            case RREACT: return "Proposed therapy may be inappropriate or contraindicated because of a potential patient reaction to a cross-sensitivity related product.";
+            case RALG: return "Proposed therapy may be inappropriate or contraindicated because of a recorded patient allergy to a cross-sensitivity related product.  (Allergies are immune based reactions.)";
+            case RAR: return "Proposed therapy may be inappropriate or contraindicated because of a recorded prior adverse reaction to a cross-sensitivity related product.";
+            case RINT: return "Proposed therapy may be inappropriate or contraindicated because of a recorded patient intolerance to a cross-sensitivity related product.  (Intolerances are non-immune based sensitivities.)";
+            case BUS: return "Description:A local business rule relating multiple elements has been violated.";
+            case CODEINVAL: return "Description:The specified code is not valid against the list of codes allowed for the element.";
+            case CODEDEPREC: return "Description:The specified code has been deprecated and should no longer be used.  Select another code from the code system.";
+            case FORMAT: return "Description:The element does not follow the formatting or type rules defined for the field.";
+            case ILLEGAL: return "Description:The request is missing elements or contains elements which cause it to not meet the legal standards for actioning.";
+            case LENRANGE: return "Description:The length of the data specified falls out of the range defined for the element.";
+            case LENLONG: return "Description:The length of the data specified is greater than the maximum length defined for the element.";
+            case LENSHORT: return "Description:The length of the data specified is less than the minimum length defined for the element.";
+            case MISSCOND: return "Description:The specified element must be specified with a non-null value under certain conditions.  In this case, the conditions are true but the element is still missing or null.";
+            case MISSMAND: return "Description:The specified element is mandatory and was not included in the instance.";
+            case NODUPS: return "Description:More than one element with the same value exists in the set.  Duplicates not permission in this set in a set.";
+            case NOPERSIST: return "Description: Element in submitted message will not persist in data storage based on detected issue.";
+            case REPRANGE: return "Description:The number of repeating elements falls outside the range of the allowed number of repetitions.";
+            case MAXOCCURS: return "Description:The number of repeating elements is above the maximum number of repetitions allowed.";
+            case MINOCCURS: return "Description:The number of repeating elements is below the minimum number of repetitions allowed.";
+            case _ACTADMINISTRATIVERULEDETECTEDISSUECODE: return "ActAdministrativeRuleDetectedIssueCode";
+            case KEY206: return "Description: Metadata associated with the identification (e.g. name or gender) does not match the identification being verified.";
+            case OBSOLETE: return "Description: One or more records in the query response have a status of 'obsolete'.";
+            case _ACTSUPPLIEDITEMDETECTEDISSUECODE: return "Identifies types of detected issues regarding the administration or supply of an item to a patient.";
+            case _ADMINISTRATIONDETECTEDISSUECODE: return "Administration of the proposed therapy may be inappropriate or contraindicated as proposed";
+            case _APPROPRIATENESSDETECTEDISSUECODE: return "AppropriatenessDetectedIssueCode";
+            case _INTERACTIONDETECTEDISSUECODE: return "InteractionDetectedIssueCode";
+            case FOOD: return "Proposed therapy may interact with certain foods";
+            case TPROD: return "Proposed therapy may interact with an existing or recent therapeutic product";
+            case DRG: return "Proposed therapy may interact with an existing or recent drug therapy";
+            case NHP: return "Proposed therapy may interact with existing or recent natural health product therapy";
+            case NONRX: return "Proposed therapy may interact with a non-prescription drug (e.g. alcohol, tobacco, Aspirin)";
+            case PREVINEF: return "Definition:The same or similar treatment has previously been attempted with the patient without achieving a positive effect.";
+            case DACT: return "Description:Proposed therapy may be contraindicated or ineffective based on an existing or recent drug therapy.";
+            case TIME: return "Description:Proposed therapy may be inappropriate or ineffective based on the proposed start or end time.";
+            case ALRTENDLATE: return "Definition:Proposed therapy may be inappropriate or ineffective because the end of administration is too close to another planned therapy.";
+            case ALRTSTRTLATE: return "Definition:Proposed therapy may be inappropriate or ineffective because the start of administration is too late after the onset of the condition.";
+            case _TIMINGDETECTEDISSUECODE: return "Proposed therapy may be inappropriate or ineffective based on the proposed start or end time.";
+            case ENDLATE: return "Proposed therapy may be inappropriate or ineffective because the end of administration is too close to another planned therapy";
+            case STRTLATE: return "Proposed therapy may be inappropriate or ineffective because the start of administration is too late after the onset of the condition";
+            case _SUPPLYDETECTEDISSUECODE: return "Supplying the product at this time may be inappropriate or indicate compliance issues with the associated therapy";
+            case ALLDONE: return "Definition:The requested action has already been performed and so this request has no effect";
+            case FULFIL: return "Definition:The therapy being performed is in some way out of alignment with the requested therapy.";
+            case NOTACTN: return "Definition:The status of the request being fulfilled has changed such that it is no longer actionable.  This may be because the request has expired, has already been completely fulfilled or has been otherwise stopped or disabled.  (Not used for 'suspended' orders.)";
+            case NOTEQUIV: return "Definition:The therapy being performed is not sufficiently equivalent to the therapy which was requested.";
+            case NOTEQUIVGEN: return "Definition:The therapy being performed is not generically equivalent (having the identical biological action) to the therapy which was requested.";
+            case NOTEQUIVTHER: return "Definition:The therapy being performed is not therapeutically equivalent (having the same overall patient effect) to the therapy which was requested.";
+            case TIMING: return "Definition:The therapy is being performed at a time which diverges from the time the therapy was requested";
+            case INTERVAL: return "Definition:The therapy action is being performed outside the bounds of the time period requested";
+            case MINFREQ: return "Definition:The therapy action is being performed too soon after the previous occurrence based on the requested frequency";
+            case HELD: return "Definition:There should be no actions taken in fulfillment of a request that has been held or suspended.";
+            case TOOLATE: return "The patient is receiving a subsequent fill significantly later than would be expected based on the amount previously supplied and the therapy dosage instructions";
+            case TOOSOON: return "The patient is receiving a subsequent fill significantly earlier than would be expected based on the amount previously supplied and the therapy dosage instructions";
+            case HISTORIC: return "Description: While the record was accepted in the repository, there is a more recent version of a record of this type.";
+            case PATPREF: return "Definition:The proposed therapy goes against preferences or consent constraints recorded in the patient's record.";
+            case PATPREFALT: return "Definition:The proposed therapy goes against preferences or consent constraints recorded in the patient's record.  An alternate therapy meeting those constraints is available.";
+            case KSUBJ: return "Categorization of types of observation that capture the main clinical knowledge subject which may be a medication, a laboratory test, a disease.";
+            case KSUBT: return "Categorization of types of observation that capture a knowledge subtopic which might be treatment, etiology, or prognosis.";
+            case OINT: return "Hypersensitivity resulting in an adverse reaction upon exposure to an agent.";
+            case ALG: return "Hypersensitivity to an agent caused by an immunologic response to an initial exposure";
+            case DALG: return "An allergy to a pharmaceutical product.";
+            case EALG: return "An allergy to a substance other than a drug or a food.  E.g. Latex, pollen, etc.";
+            case FALG: return "An allergy to a substance generally consumed for nutritional purposes.";
+            case DINT: return "Hypersensitivity resulting in an adverse reaction upon exposure to a drug.";
+            case DNAINT: return "Hypersensitivity to an agent caused by a mechanism other than an immunologic response to an initial exposure";
+            case EINT: return "Hypersensitivity resulting in an adverse reaction upon exposure to environmental conditions.";
+            case ENAINT: return "Hypersensitivity to an agent caused by a mechanism other than an immunologic response to an initial exposure";
+            case FINT: return "Hypersensitivity resulting in an adverse reaction upon exposure to food.";
+            case FNAINT: return "Hypersensitivity to an agent caused by a mechanism other than an immunologic response to an initial exposure";
+            case NAINT: return "Hypersensitivity to an agent caused by a mechanism other than an immunologic response to an initial exposure";
+            case SEV: return "A subjective evaluation of the seriousness or intensity associated with another observation.";
+            case _FDALABELDATA: return "FDA label data";
+            case FDACOATING: return "FDA label coating";
+            case FDACOLOR: return "FDA label color";
+            case FDAIMPRINTCD: return "FDA label imprint code";
+            case FDALOGO: return "FDA label logo";
+            case FDASCORING: return "FDA label scoring";
+            case FDASHAPE: return "FDA label shape";
+            case FDASIZE: return "FDA label size";
+            case _ROIOVERLAYSHAPE: return "Shape of the region on the object being referenced";
+            case CIRCLE: return "A circle defined by two (column,row) pairs. The first point is the center of the circle and the second point is a point on the perimeter of the circle.";
+            case ELLIPSE: return "An ellipse defined by four (column,row) pairs, the first two points specifying the endpoints of the major axis and the second two points specifying the endpoints of the minor axis.";
+            case POINT: return "A single point denoted by a single (column,row) pair, or multiple points each denoted by a (column,row) pair.";
+            case POLY: return "A series of connected line segments with ordered vertices denoted by (column,row) pairs; if the first and last vertices are the same, it is a closed polygon.";
+            case C: return "Description:Indicates that result data has been corrected.";
+            case DIET: return "Code set to define specialized/allowed diets";
+            case BR: return "A diet exclusively composed of oatmeal, semolina, or rice, to be extremely easy to eat and digest.";
+            case DM: return "A diet that uses carbohydrates sparingly.  Typically with a restriction in daily energy content (e.g. 1600-2000 kcal).";
+            case FAST: return "No enteral intake of foot or liquids  whatsoever, no smoking.  Typically 6 to 8 hours before anesthesia.";
+            case FORMULA: return "A diet consisting of a formula feeding, either for an infant or an adult, to provide nutrition either orally or through the gastrointestinal tract via tube, catheter or stoma.";
+            case GF: return "Gluten free diet for celiac disease.";
+            case LF: return "A diet low in fat, particularly to patients with hepatic diseases.";
+            case LP: return "A low protein diet for patients with renal failure.";
+            case LQ: return "A strictly liquid diet, that can be fully absorbed in the intestine, and therefore may not contain fiber.  Used before enteral surgeries.";
+            case LS: return "A diet low in sodium for patients with congestive heart failure and/or renal failure.";
+            case N: return "A normal diet, i.e. no special preparations or restrictions for medical reasons. This is notwithstanding any preferences the patient might have regarding special foods, such as vegetarian, kosher, etc.";
+            case NF: return "A no fat diet for acute hepatic diseases.";
+            case PAF: return "Phenylketonuria diet.";
+            case PAR: return "Patient is supplied with parenteral nutrition, typically described in terms of i.v. medications.";
+            case RD: return "A diet that seeks to reduce body fat, typically low energy content (800-1600 kcal).";
+            case SCH: return "A diet that avoids ingredients that might cause digestion problems, e.g., avoid excessive fat, avoid too much fiber (cabbage, peas, beans).";
+            case SUPPLEMENT: return "A diet that is not intended to be complete but is added to other diets.";
+            case T: return "This is not really a diet, since it contains little nutritional value, but is essentially just water.  Used before coloscopy examinations.";
+            case VLI: return "Diet with low content of the amino-acids valin, leucin, and isoleucin, for \"maple syrup disease.\"";
+            case DRUGPRG: return "Definition: A public or government health program that administers and funds coverage for prescription drugs to assist program eligible who meet financial and health status criteria.";
+            case F: return "Description:Indicates that a result is complete.  No further results are to come.  This maps to the 'complete' state in the observation result status code.";
+            case PRLMN: return "Description:Indicates that a result is incomplete.  There are further results to come.  This maps to the 'active' state in the observation result status code.";
+            case SECOBS: return "An observation identifying security metadata about an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.  Security metadata are used to name security labels.  \r\n\n                        \n                           Rationale: According to ISO/TS 22600-3:2009(E) A.9.1.7 SECURITY LABEL MATCHING, Security label matching compares the initiator's clearance to the target's security label.  All of the following must be true for authorization to be granted:\r\n\n                        \n                           The security policy identifiers shall be identical\n                           The classification level of the initiator shall be greater than or equal to that of the target (that is, there shall be at least one value in the classification list of the clearance greater than or equal to the classification of the target), and \n                           For each security category in the target label, there shall be a security category of the same type in the initiator's clearance and the initiator's classification level shall dominate that of the target.\n                        \n                        \n                           Examples: SecurityObservationType  security label fields include:\r\n\n                        \n                           Confidentiality classification\n                           Compartment category\n                           Sensitivity category\n                           Security mechanisms used to ensure data integrity or to perform authorized data transformation\n                           Indicators of an IT resource completeness, veracity, reliability, trustworthiness, or provenance.\n                        \n                        \n                           Usage Note: SecurityObservationType codes designate security label field types, which are valued with an applicable SecurityObservationValue code as the \"security label tag\".";
+            case SECCATOBS: return "Type of security metadata observation made about the category of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions. Security category metadata is defined by ISO/IEC 2382-8:1998(E/F)/ T-REC-X.812-1995 as: \"A nonhierarchical grouping of sensitive information used to control access to data more finely than with hierarchical security classification alone.\"\r\n\n                        \n                           Rationale: A security category observation supports requirement to specify the type of IT resource to facilitate application of appropriate levels of information security according to a range of levels of impact or consequences that might result from the unauthorized disclosure, modification, or use of the information or information system.  A resource is assigned to a specific category of information (e.g., privacy, medical, proprietary, financial, investigative, contractor sensitive, security management) defined by an organization or in some instances, by a specific law, Executive Order, directive, policy, or regulation. [FIPS 199]\r\n\n                        \n                           Examples: Types of security categories include:\r\n\n                        \n                           Compartment:  A division of data into isolated blocks with separate security controls for the purpose of reducing risk. (ISO 2382-8).  A security label tag that \"segments\" an IT resource by indicating that access and use is restricted to members of a defined community or project. (HL7 Healthcare Classification System)  \n                           Sensitivity:  The characteristic of an IT resource which implies its value or importance and may include its vulnerability. (ISO 7492-2)  Privacy metadata for information perceived as undesirable to share.  (HL7 Healthcare Classification System)";
+            case SECCLASSOBS: return "Type of security metadata observation made about the classification of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.  Security classification is defined by ISO/IEC 2382-8:1998(E/F)/ T-REC-X.812-1995 as: \"The determination of which specific degree of protection against access the data or information requires, together with a designation of that degree of protection.\"  Security classification metadata is based on an analysis of applicable policies and the risk of financial, reputational, or other harm that could result from unauthorized disclosure.\r\n\n                        \n                           Rationale: A security classification observation may indicate that the confidentiality level indicated by an Act or Role confidentiality attribute has been overridden by the entity responsible for ascribing the SecurityClassificationObservationValue.  This supports the business requirement for increasing or decreasing the level of confidentiality (classification or declassification) based on parameters beyond the original assignment of an Act or Role confidentiality.\r\n\n                        \n                           Examples: Types of security classification include: HL7 Confidentiality Codes such as very restricted, unrestricted, and normal.  Intelligence community examples include top secret, secret, and confidential.\r\n\n                        \n                           Usage Note: Security classification observation type codes designate security label field types, which are valued with an applicable SecurityClassificationObservationValue code as the \"security label tag\".";
+            case SECCONOBS: return "Type of security metadata observation made about the control of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.  Security control metadata convey instructions to users and receivers for secure distribution, transmission, and storage; dictate obligations or mandated actions; specify any action prohibited by refrain policy such as dissemination controls; and stipulate the permissible purpose of use of an IT resource.  \r\n\n                        \n                           Rationale: A security control observation supports requirement to specify applicable management, operational, and technical controls (i.e., safeguards or countermeasures) prescribed for an information system to protect the confidentiality, integrity, and availability of the system and its information. [FIPS 199]\r\n\n                        \n                           Examples: Types of security control metadata include: \r\n\n                        \n                           handling caveats\n                           dissemination controls\n                           obligations\n                           refrain policies\n                           purpose of use constraints";
+            case SECINTOBS: return "Type of security metadata observation made about the integrity of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.\r\n\n                        \n                           Rationale: A security integrity observation supports the requirement to guard against improper information modification or destruction, and includes ensuring information non-repudiation and authenticity. (44 U.S.C., SEC. 3542)\r\n\n                        \n                           Examples: Types of security integrity metadata include: \r\n\n                        \n                           Integrity status, which indicates the completeness or workflow status of an IT resource (data, information object, service, or system capability)\n                           Integrity confidence, which indicates the reliability and trustworthiness of an IT resource\n                           Integrity control, which indicates pertinent handling caveats, obligations, refrain policies, and purpose of use for  the resource\n                           Data integrity, which indicate the security mechanisms used to ensure that the accuracy and consistency are preserved regardless of changes made (ISO/IEC DIS 2382-8)\n                           Alteration integrity, which indicate the security mechanisms used for authorized transformations of the resource\n                           Integrity provenance, which indicates the entity responsible for a report or assertion relayed \"second-hand\" about an IT resource";
+            case SECALTINTOBS: return "Type of security metadata observation made about the alteration integrity of an IT resource (data, information object, service, or system capability), which indicates the mechanism used for authorized transformations of the resource.\r\n\n                        \n                           Examples: Types of security alteration integrity observation metadata, which may value the observation with a code used to indicate the mechanism used for authorized transformation of an IT resource, including: \r\n\n                        \n                           translation\n                           syntactic transformation\n                           semantic mapping\n                           redaction\n                           masking\n                           pseudonymization\n                           anonymization";
+            case SECDATINTOBS: return "Type of security metadata observation made about the data integrity of an IT resource (data, information object, service, or system capability), which indicates the security mechanism used to preserve resource accuracy and consistency.  Data integrity is defined by ISO 22600-23.3.21 as: \"The property that data has not been altered or destroyed in an unauthorized manner\", and by ISO/IEC 2382-8:  The property of data whose accuracy and consistency are preserved regardless of changes made.\"\r\n\n                        \n                           Examples: Types of security data integrity observation metadata, which may value the observation, include cryptographic hash function and digital signature.";
+            case SECINTCONOBS: return "Type of security metadata observation made about the integrity confidence of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.\r\n\n                        \n                           Examples: Types of security integrity confidence observation metadata, which may value the observation, include highly reliable, uncertain reliability, and not reliable.\r\n\n                        \n                           Usage Note: A security integrity confidence observation on an Act may indicate that a valued Act.uncertaintycode attribute has been overridden by the entity responsible for ascribing the SecurityIntegrityConfidenceObservationValue.  This supports the business requirements for increasing or decreasing the assessment of the reliability or trustworthiness of an IT resource based on parameters beyond the original assignment of an Act statement level of uncertainty.";
+            case SECINTPRVOBS: return "Type of security metadata observation made about the provenance integrity of an IT resource (data, information object, service, or system capability), which indicates the lifecycle completeness of an IT resource in terms of workflow status such as its creation, modification, suspension, and deletion; locations in which the resource has been collected or archived, from which it may be retrieved, and the history of its distribution and disclosure.  Integrity provenance metadata about an IT resource may be used to assess its veracity, reliability, and trustworthiness.\r\n\n                        \n                           Examples: Types of security integrity provenance observation metadata, which may value the observation about an IT resource, include: \r\n\n                        \n                           completeness or workflow status, such as authentication\n                           the entity responsible for original authoring or informing about an IT resource\n                           the entity responsible for a report or assertion about an IT resource relayed “second-hand�\n                           the entity responsible for excerpting, transforming, or compiling an IT resource";
+            case SECINTPRVABOBS: return "Type of security metadata observation made about the integrity provenance of an IT resource (data, information object, service, or system capability), which indicates the entity that made assertions about the resource.  The asserting entity may not be the original informant about the resource.\r\n\n                        \n                           Examples: Types of security integrity provenance asserted by observation metadata, which may value the observation, including: \r\n\n                        \n                           assertions about an IT resource by a patient\n                           assertions about an IT resource by a clinician\n                           assertions about an IT resource by a device";
+            case SECINTPRVRBOBS: return "Type of security metadata observation made about the integrity provenance of an IT resource (data, information object, service, or system capability), which indicates the entity that reported the existence of the resource.  The reporting entity may not be the original author of the resource.\r\n\n                        \n                           Examples: Types of security integrity provenance reported by observation metadata, which may value the observation, include: \r\n\n                        \n                           reports about an IT resource by a patient\n                           reports about an IT resource by a clinician\n                           reports about an IT resource by a device";
+            case SECINTSTOBS: return "Type of security metadata observation made about the integrity status of an IT resource (data, information object, service, or system capability), which may be used to make access control decisions.  Indicates the completeness of an IT resource in terms of workflow status, which may impact users that are authorized to access and use the resource.\r\n\n                        \n                           Examples: Types of security integrity status observation metadata, which may value the observation, include codes from the HL7 DocumentCompletion code system such as legally authenticated, in progress, and incomplete.";
+            case SECTRSTOBS: return "An observation identifying trust metadata about an IT resource (data, information object, service, or system capability), which may be used as a trust attribute to populate a computable trust policy, trust credential, trust assertion, or trust label field in a security label or trust policy, which are principally used for authentication, authorization, and access control decisions.";
+            case TRSTACCRDOBS: return "Type of security metadata observation made about the formal declaration by an authority or neutral third party that validates the technical, security, trust, and business practice conformance of Trust Agents to facilitate security, interoperability, and trust among participants within a security domain or trust framework.";
+            case TRSTAGREOBS: return "Type of security metadata observation made about privacy and security requirements with which a security domain must comply. [ISO IEC 10181-1]";
+            case TRSTCERTOBS: return "Type of security metadata observation made about a set of security-relevant data issued by a security authority or trusted third party, together with security information which is used to provide the integrity and data origin authentication services for an IT resource (data, information object, service, or system capability). [Based on ISO IEC 10181-1]\r\n\n                        \n                           For example,\n                        \r\n\n                        \n                           A Certificate Policy (CP), which is a named set of rules that indicates the applicability of a certificate to a particular community and/or class of application with common security requirements. For example, a particular Certificate Policy might indicate the applicability of a type of certificate to the authentication of electronic data interchange transactions for the trading of goods within a given price range. [Trust Service Principles and Criteria for Certification Authorities Version 2.0 March 2011 Copyright 2011 by Canadian Institute of Chartered Accountants.\n                           A Certificate Practice Statement (CSP), which is a statement of the practices which an Authority employs in issuing and managing certificates. [Trust Service Principles and Criteria for Certification Authorities Version 2.0 March 2011 Copyright 2011 by Canadian Institute of Chartered Accountants.]";
+            case TRSTFWKOBS: return "Type of security metadata observation made about a complete set of contracts, regulations or commitments that enable participating actors to rely on certain assertions by other actors to fulfill their information security requirements. [Kantara Initiative]";
+            case TRSTLOAOBS: return "Type of security metadata observation made about the digital quality or reliability of a trust assertion, activity, capability, information exchange, mechanism, process, or protocol.";
+            case TRSTMECOBS: return "Type of security metadata observation made about a security architecture system component that supports enforcement of security policies.";
+            case SUBSIDFFS: return "Definition: A government health program that provides coverage on a fee for service basis for health services to persons meeting eligibility criteria such as income, location of residence, access to other coverages, health condition, and age, the cost of which is to some extent subsidized by public funds.\r\n\n                        \n                           Discussion: The structure and business processes for underwriting and administering a subsidized fee for service program is further specified by the Underwriter and Payer Role.class and Role.code.";
+            case WRKCOMP: return "Definition: Government mandated program providing coverage, disability income, and vocational rehabilitation for injuries sustained in the work place or in the course of employment.  Employers may either self-fund the program, purchase commercial coverage, or pay a premium to a government entity that administers the program.  Employees may be required to pay premiums toward the cost of coverage as well.";
+            case _ACTPROCEDURECODE: return "An identifying code for healthcare interventions/procedures.";
+            case _ACTBILLABLESERVICECODE: return "Definition: An identifying code for billable services, as opposed to codes for similar services used to identify them for functional purposes.";
+            case _HL7DEFINEDACTCODES: return "Domain provides the root for HL7-defined detailed or rich codes for the Act classes.";
+            case COPAY: return "";
+            case DEDUCT: return "";
+            case DOSEIND: return "";
+            case PRA: return "";
+            case STORE: return "The act of putting something away for safe keeping. The \"something\" may be physical object such as a specimen, or information, such as observations regarding a specimen.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ACTACCOUNTCODE: return "ActAccountCode";
+            case ACCTRECEIVABLE: return "account receivable";
+            case CASH: return "Cash";
+            case CC: return "credit card";
+            case AE: return "American Express";
+            case DN: return "Diner's Club";
+            case DV: return "Discover Card";
+            case MC: return "Master Card";
+            case V: return "Visa";
+            case PBILLACCT: return "patient billing account";
+            case _ACTADJUDICATIONCODE: return "ActAdjudicationCode";
+            case _ACTADJUDICATIONGROUPCODE: return "ActAdjudicationGroupCode";
+            case CONT: return "contract";
+            case DAY: return "day";
+            case LOC: return "location";
+            case MONTH: return "month";
+            case PERIOD: return "period";
+            case PROV: return "provider";
+            case WEEK: return "week";
+            case YEAR: return "year";
+            case AA: return "adjudicated with adjustments";
+            case ANF: return "adjudicated with adjustments and no financial impact";
+            case AR: return "adjudicated as refused";
+            case AS: return "adjudicated as submitted";
+            case _ACTADJUDICATIONRESULTACTIONCODE: return "ActAdjudicationResultActionCode";
+            case DISPLAY: return "Display";
+            case FORM: return "Print on Form";
+            case _ACTBILLABLEMODIFIERCODE: return "ActBillableModifierCode";
+            case CPTM: return "CPT modifier codes";
+            case HCPCSA: return "HCPCS Level II and Carrier-assigned";
+            case _ACTBILLINGARRANGEMENTCODE: return "ActBillingArrangementCode";
+            case BLK: return "block funding";
+            case CAP: return "capitation funding";
+            case CONTF: return "contract funding";
+            case FINBILL: return "financial";
+            case ROST: return "roster funding";
+            case SESS: return "sessional funding";
+            case FFS: return "fee for service";
+            case FFPS: return "first fill, part fill, partial strength";
+            case FFCS: return "first fill complete, partial strength";
+            case TFS: return "trial fill partial strength";
+            case _ACTBOUNDEDROICODE: return "ActBoundedROICode";
+            case ROIFS: return "fully specified ROI";
+            case ROIPS: return "partially specified ROI";
+            case _ACTCAREPROVISIONCODE: return "act care provision";
+            case _ACTCREDENTIALEDCARECODE: return "act credentialed care";
+            case _ACTCREDENTIALEDCAREPROVISIONPERSONCODE: return "act credentialed care provision peron";
+            case CACC: return "certified anatomic pathology and clinical pathology care";
+            case CAIC: return "certified allergy and immunology care";
+            case CAMC: return "certified aerospace medicine care";
+            case CANC: return "certified anesthesiology care";
+            case CAPC: return "certified anatomic pathology care";
+            case CBGC: return "certified clinical biochemical genetics care";
+            case CCCC: return "certified clinical cytogenetics care";
+            case CCGC: return "certified clinical genetics (M.D.) care";
+            case CCPC: return "certified clinical pathology care";
+            case CCSC: return "certified colon and rectal surgery care";
+            case CDEC: return "certified dermatology care";
+            case CDRC: return "certified diagnostic radiology care";
+            case CEMC: return "certified emergency medicine care";
+            case CFPC: return "certified family practice care";
+            case CIMC: return "certified internal medicine care";
+            case CMGC: return "certified clinical molecular genetics care";
+            case CNEC: return "certified neurology care";
+            case CNMC: return "certified nuclear medicine care";
+            case CNQC: return "certified neurology with special qualifications in child neurology care";
+            case CNSC: return "certified neurological surgery care";
+            case COGC: return "certified obstetrics and gynecology care";
+            case COMC: return "certified occupational medicine care";
+            case COPC: return "certified ophthalmology care";
+            case COSC: return "certified orthopaedic surgery care";
+            case COTC: return "certified otolaryngology care";
+            case CPEC: return "certified pediatrics care";
+            case CPGC: return "certified Ph.D. medical genetics care";
+            case CPHC: return "certified public health and general preventive medicine care";
+            case CPRC: return "certified physical medicine and rehabilitation care";
+            case CPSC: return "certified plastic surgery care";
+            case CPYC: return "certified psychiatry care";
+            case CROC: return "certified radiation oncology care";
+            case CRPC: return "certified radiological physics care";
+            case CSUC: return "certified surgery care";
+            case CTSC: return "certified thoracic surgery care";
+            case CURC: return "certified urology care";
+            case CVSC: return "certified vascular surgery care";
+            case LGPC: return "licensed general physician care";
+            case _ACTCREDENTIALEDCAREPROVISIONPROGRAMCODE: return "act credentialed care provision program";
+            case AALC: return "accredited assisted living care";
+            case AAMC: return "accredited ambulatory care";
+            case ABHC: return "accredited behavioral health care";
+            case ACAC: return "accredited critical access hospital care";
+            case ACHC: return "accredited hospital care";
+            case AHOC: return "accredited home care";
+            case ALTC: return "accredited long term care";
+            case AOSC: return "accredited office-based surgery care";
+            case CACS: return "certified acute coronary syndrome care";
+            case CAMI: return "certified acute myocardial infarction care";
+            case CAST: return "certified asthma care";
+            case CBAR: return "certified bariatric surgery care";
+            case CCAD: return "certified coronary artery disease care";
+            case CCAR: return "certified cardiac care";
+            case CDEP: return "certified depression care";
+            case CDGD: return "certified digestive/gastrointestinal disorders care";
+            case CDIA: return "certified diabetes care";
+            case CEPI: return "certified epilepsy care";
+            case CFEL: return "certified frail elderly care";
+            case CHFC: return "certified heart failure care";
+            case CHRO: return "certified high risk obstetrics care";
+            case CHYP: return "certified hyperlipidemia care";
+            case CMIH: return "certified migraine headache care";
+            case CMSC: return "certified multiple sclerosis care";
+            case COJR: return "certified orthopedic joint replacement care";
+            case CONC: return "certified oncology care";
+            case COPD: return "certified chronic obstructive pulmonary disease care";
+            case CORT: return "certified organ transplant care";
+            case CPAD: return "certified parkinsons disease care";
+            case CPND: return "certified pneumonia disease care";
+            case CPST: return "certified primary stroke center care";
+            case CSDM: return "certified stroke disease management care";
+            case CSIC: return "certified sickle cell care";
+            case CSLD: return "certified sleep disorders care";
+            case CSPT: return "certified spine treatment care";
+            case CTBU: return "certified trauma/burn center care";
+            case CVDC: return "certified vascular diseases care";
+            case CWMA: return "certified wound management care";
+            case CWOH: return "certified women's health care";
+            case _ACTENCOUNTERCODE: return "ActEncounterCode";
+            case AMB: return "ambulatory";
+            case EMER: return "emergency";
+            case FLD: return "field";
+            case HH: return "home health";
+            case IMP: return "inpatient encounter";
+            case ACUTE: return "inpatient acute";
+            case NONAC: return "inpatient non-acute";
+            case PRENC: return "pre-admission";
+            case SS: return "short stay";
+            case VR: return "virtual";
+            case _ACTMEDICALSERVICECODE: return "ActMedicalServiceCode";
+            case ALC: return "Alternative Level of Care";
+            case CARD: return "Cardiology";
+            case CHR: return "Chronic";
+            case DNTL: return "Dental";
+            case DRGRHB: return "Drug Rehab";
+            case GENRL: return "General";
+            case MED: return "Medical";
+            case OBS: return "Obstetrics";
+            case ONC: return "Oncology";
+            case PALL: return "Palliative";
+            case PED: return "Pediatrics";
+            case PHAR: return "Pharmaceutical";
+            case PHYRHB: return "Physical Rehab";
+            case PSYCH: return "Psychiatric";
+            case SURG: return "Surgical";
+            case _ACTCLAIMATTACHMENTCATEGORYCODE: return "ActClaimAttachmentCategoryCode";
+            case AUTOATTCH: return "auto attachment";
+            case DOCUMENT: return "document";
+            case HEALTHREC: return "health record";
+            case IMG: return "image attachment";
+            case LABRESULTS: return "lab results";
+            case MODEL: return "model";
+            case WIATTCH: return "work injury report attachment";
+            case XRAY: return "x-ray";
+            case _ACTCONSENTTYPE: return "ActConsentType";
+            case ICOL: return "information collection";
+            case IDSCL: return "information disclosure";
+            case INFA: return "information access";
+            case INFAO: return "access only";
+            case INFASO: return "access and save only";
+            case IRDSCL: return "information redisclosure";
+            case RESEARCH: return "research information access";
+            case RSDID: return "de-identified information access";
+            case RSREID: return "re-identifiable information access";
+            case _ACTCONTAINERREGISTRATIONCODE: return "ActContainerRegistrationCode";
+            case ID: return "Identified";
+            case IP: return "In Position";
+            case L: return "Left Equipment";
+            case M: return "Missing";
+            case O: return "In Process";
+            case R: return "Process Completed";
+            case X: return "Container Unavailable";
+            case _ACTCONTROLVARIABLE: return "ActControlVariable";
+            case AUTO: return "auto-repeat permission";
+            case ENDC: return "endogenous content";
+            case REFLEX: return "reflex permission";
+            case _ACTCOVERAGECONFIRMATIONCODE: return "ActCoverageConfirmationCode";
+            case _ACTCOVERAGEAUTHORIZATIONCONFIRMATIONCODE: return "ActCoverageAuthorizationConfirmationCode";
+            case AUTH: return "Authorized";
+            case NAUTH: return "Not Authorized";
+            case _ACTCOVERAGEELIGIBILITYCONFIRMATIONCODE: return "ActCoverageEligibilityConfirmationCode";
+            case ELG: return "Eligible";
+            case NELG: return "Not Eligible";
+            case _ACTCOVERAGELIMITCODE: return "ActCoverageLimitCode";
+            case _ACTCOVERAGEQUANTITYLIMITCODE: return "ActCoverageQuantityLimitCode";
+            case COVPRD: return "coverage period";
+            case LFEMX: return "life time maximum";
+            case NETAMT: return "Net Amount";
+            case PRDMX: return "period maximum";
+            case UNITPRICE: return "Unit Price";
+            case UNITQTY: return "Unit Quantity";
+            case COVMX: return "coverage maximum";
+            case _ACTCOVEREDPARTYLIMITCODE: return "ActCoveredPartyLimitCode";
+            case _ACTCOVERAGETYPECODE: return "ActCoverageTypeCode";
+            case _ACTINSURANCEPOLICYCODE: return "ActInsurancePolicyCode";
+            case EHCPOL: return "extended healthcare";
+            case HSAPOL: return "health spending account";
+            case AUTOPOL: return "automobile";
+            case COL: return "collision coverage policy";
+            case UNINSMOT: return "uninsured motorist policy";
+            case PUBLICPOL: return "public healthcare";
+            case DENTPRG: return "dental program";
+            case DISEASEPRG: return "public health program";
+            case CANPRG: return "women's cancer detection program";
+            case ENDRENAL: return "end renal program";
+            case HIVAIDS: return "HIV-AIDS program";
+            case MANDPOL: return "mandatory health program";
+            case MENTPRG: return "mental health program";
+            case SAFNET: return "safety net clinic program";
+            case SUBPRG: return "substance use program";
+            case SUBSIDIZ: return "subsidized health program";
+            case SUBSIDMC: return "subsidized managed care program";
+            case SUBSUPP: return "subsidized supplemental health program";
+            case WCBPOL: return "worker's compensation";
+            case _ACTINSURANCETYPECODE: return "ActInsuranceTypeCode";
+            case _ACTHEALTHINSURANCETYPECODE: return "ActHealthInsuranceTypeCode";
+            case DENTAL: return "dental care policy";
+            case DISEASE: return "disease specific policy";
+            case DRUGPOL: return "drug policy";
+            case HIP: return "health insurance plan policy";
+            case LTC: return "long term care policy";
+            case MCPOL: return "managed care policy";
+            case POS: return "point of service policy";
+            case HMO: return "health maintenance organization policy";
+            case PPO: return "preferred provider organization policy";
+            case MENTPOL: return "mental health policy";
+            case SUBPOL: return "substance use policy";
+            case VISPOL: return "vision care policy";
+            case DIS: return "disability insurance policy";
+            case EWB: return "employee welfare benefit plan policy";
+            case FLEXP: return "flexible benefit plan policy";
+            case LIFE: return "life insurance policy";
+            case ANNU: return "annuity policy";
+            case TLIFE: return "term life insurance policy";
+            case ULIFE: return "universal life insurance policy";
+            case PNC: return "property and casualty insurance policy";
+            case REI: return "reinsurance policy";
+            case SURPL: return "surplus line insurance policy";
+            case UMBRL: return "umbrella liability insurance policy";
+            case _ACTPROGRAMTYPECODE: return "ActProgramTypeCode";
+            case CHAR: return "charity program";
+            case CRIME: return "crime victim program";
+            case EAP: return "employee assistance program";
+            case GOVEMP: return "government employee health program";
+            case HIRISK: return "high risk pool program";
+            case IND: return "indigenous peoples health program";
+            case MILITARY: return "military health program";
+            case RETIRE: return "retiree health program";
+            case SOCIAL: return "social service program";
+            case VET: return "veteran health program";
+            case _ACTDETECTEDISSUEMANAGEMENTCODE: return "ActDetectedIssueManagementCode";
+            case _ACTADMINISTRATIVEDETECTEDISSUEMANAGEMENTCODE: return "ActAdministrativeDetectedIssueManagementCode";
+            case _AUTHORIZATIONISSUEMANAGEMENTCODE: return "Authorization Issue Management Code";
+            case EMAUTH: return "emergency authorization override";
+            case _21: return "authorization confirmed";
+            case _1: return "Therapy Appropriate";
+            case _19: return "Consulted Supplier";
+            case _2: return "Assessed Patient";
+            case _22: return "appropriate indication or diagnosis";
+            case _23: return "prior therapy documented";
+            case _3: return "Patient Explanation";
+            case _4: return "Consulted Other Source";
+            case _5: return "Consulted Prescriber";
+            case _6: return "Prescriber Declined Change";
+            case _7: return "Interacting Therapy No Longer Active/Planned";
+            case _14: return "Supply Appropriate";
+            case _15: return "Replacement";
+            case _16: return "Vacation Supply";
+            case _17: return "Weekend Supply";
+            case _18: return "Leave of Absence";
+            case _20: return "additional quantity on separate dispense";
+            case _8: return "Other Action Taken";
+            case _10: return "Provided Patient Education";
+            case _11: return "Added Concurrent Therapy";
+            case _12: return "Temporarily Suspended Concurrent Therapy";
+            case _13: return "Stopped Concurrent Therapy";
+            case _9: return "Instituted Ongoing Monitoring Program";
+            case _ACTEXPOSURECODE: return "ActExposureCode";
+            case CHLDCARE: return "Day care - Child care Interaction";
+            case CONVEYNC: return "Common Conveyance Interaction";
+            case HLTHCARE: return "Health Care Interaction - Not Patient Care";
+            case HOMECARE: return "Care Giver Interaction";
+            case HOSPPTNT: return "Hospital Patient Interaction";
+            case HOSPVSTR: return "Hospital Visitor Interaction";
+            case HOUSEHLD: return "Household Interaction";
+            case INMATE: return "Inmate Interaction";
+            case INTIMATE: return "Intimate Interaction";
+            case LTRMCARE: return "Long Term Care Facility Interaction";
+            case PLACE: return "Common Space Interaction";
+            case PTNTCARE: return "Health Care Interaction - Patient Care";
+            case SCHOOL2: return "School Interaction";
+            case SOCIAL2: return "Social/Extended Family Interaction";
+            case SUBSTNCE: return "Common Substance Interaction";
+            case TRAVINT: return "Common Travel Interaction";
+            case WORK2: return "Work Interaction";
+            case _ACTFINANCIALTRANSACTIONCODE: return "ActFinancialTransactionCode";
+            case CHRG: return "Standard Charge";
+            case REV: return "Standard Charge Reversal";
+            case _ACTINCIDENTCODE: return "ActIncidentCode";
+            case MVA: return "Motor vehicle accident";
+            case SCHOOL: return "School Accident";
+            case SPT: return "Sporting Accident";
+            case WPA: return "Workplace accident";
+            case _ACTINFORMATIONACCESSCODE: return "ActInformationAccessCode";
+            case ACADR: return "adverse drug reaction access";
+            case ACALL: return "all access";
+            case ACALLG: return "allergy access";
+            case ACCONS: return "informational consent access";
+            case ACDEMO: return "demographics access";
+            case ACDI: return "diagnostic imaging access";
+            case ACIMMUN: return "immunization access";
+            case ACLAB: return "lab test result access";
+            case ACMED: return "medication access";
+            case ACMEDC: return "medical condition access";
+            case ACMEN: return "mental health access";
+            case ACOBS: return "common observations access";
+            case ACPOLPRG: return "policy or program information access";
+            case ACPROV: return "provider information access";
+            case ACPSERV: return "professional service access";
+            case ACSUBSTAB: return "substance abuse access";
+            case _ACTINFORMATIONACCESSCONTEXTCODE: return "ActInformationAccessContextCode";
+            case INFAUT: return "authorized information transfer";
+            case INFCON: return "after explicit consent";
+            case INFCRT: return "only on court order";
+            case INFDNG: return "only if danger to others";
+            case INFEMER: return "only in an emergency";
+            case INFPWR: return "only if public welfare risk";
+            case INFREG: return "regulatory information transfer";
+            case _ACTINFORMATIONCATEGORYCODE: return "ActInformationCategoryCode";
+            case ALLCAT: return "all categories";
+            case ALLGCAT: return "allergy category";
+            case ARCAT: return "adverse drug reaction category";
+            case COBSCAT: return "common observation category";
+            case DEMOCAT: return "demographics category";
+            case DICAT: return "diagnostic image category";
+            case IMMUCAT: return "immunization category";
+            case LABCAT: return "lab test category";
+            case MEDCCAT: return "medical condition category";
+            case MENCAT: return "mental health category";
+            case PSVCCAT: return "professional service category";
+            case RXCAT: return "medication category";
+            case _ACTINVOICEELEMENTCODE: return "ActInvoiceElementCode";
+            case _ACTINVOICEADJUDICATIONPAYMENTCODE: return "ActInvoiceAdjudicationPaymentCode";
+            case _ACTINVOICEADJUDICATIONPAYMENTGROUPCODE: return "ActInvoiceAdjudicationPaymentGroupCode";
+            case ALEC: return "alternate electronic";
+            case BONUS: return "bonus";
+            case CFWD: return "carry forward adjusment";
+            case EDU: return "education fees";
+            case EPYMT: return "early payment fee";
+            case GARN: return "garnishee";
+            case INVOICE: return "submitted invoice";
+            case PINV: return "paper invoice";
+            case PPRD: return "prior period adjustment";
+            case PROA: return "professional association deduction";
+            case RECOV: return "recovery";
+            case RETRO: return "retro adjustment";
+            case TRAN: return "transaction fee";
+            case _ACTINVOICEADJUDICATIONPAYMENTSUMMARYCODE: return "ActInvoiceAdjudicationPaymentSummaryCode";
+            case INVTYPE: return "invoice type";
+            case PAYEE: return "payee";
+            case PAYOR: return "payor";
+            case SENDAPP: return "sending application";
+            case _ACTINVOICEDETAILCODE: return "ActInvoiceDetailCode";
+            case _ACTINVOICEDETAILCLINICALPRODUCTCODE: return "ActInvoiceDetailClinicalProductCode";
+            case UNSPSC: return "United Nations Standard Products and Services Classification";
+            case _ACTINVOICEDETAILDRUGPRODUCTCODE: return "ActInvoiceDetailDrugProductCode";
+            case GTIN: return "Global Trade Item Number";
+            case UPC: return "Universal Product Code";
+            case _ACTINVOICEDETAILGENERICCODE: return "ActInvoiceDetailGenericCode";
+            case _ACTINVOICEDETAILGENERICADJUDICATORCODE: return "ActInvoiceDetailGenericAdjudicatorCode";
+            case COIN: return "coinsurance";
+            case COPAYMENT: return "patient co-pay";
+            case DEDUCTIBLE: return "deductible";
+            case PAY: return "payment";
+            case SPEND: return "spend down";
+            case COINS: return "co-insurance";
+            case _ACTINVOICEDETAILGENERICMODIFIERCODE: return "ActInvoiceDetailGenericModifierCode";
+            case AFTHRS: return "non-normal hours";
+            case ISOL: return "isolation allowance";
+            case OOO: return "out of office";
+            case _ACTINVOICEDETAILGENERICPROVIDERCODE: return "ActInvoiceDetailGenericProviderCode";
+            case CANCAPT: return "cancelled appointment";
+            case DSC: return "discount";
+            case ESA: return "extraordinary service assessment";
+            case FFSTOP: return "fee for service top off";
+            case FNLFEE: return "final fee";
+            case FRSTFEE: return "first fee";
+            case MARKUP: return "markup or up-charge";
+            case MISSAPT: return "missed appointment";
+            case PERFEE: return "periodic fee";
+            case PERMBNS: return "performance bonus";
+            case RESTOCK: return "restocking fee";
+            case TRAVEL: return "travel";
+            case URGENT: return "urgent";
+            case _ACTINVOICEDETAILTAXCODE: return "ActInvoiceDetailTaxCode";
+            case FST: return "federal sales tax";
+            case HST: return "harmonized sales Tax";
+            case PST: return "provincial/state sales tax";
+            case _ACTINVOICEDETAILPREFERREDACCOMMODATIONCODE: return "ActInvoiceDetailPreferredAccommodationCode";
+            case _ACTENCOUNTERACCOMMODATIONCODE: return "ActEncounterAccommodationCode";
+            case _HL7ACCOMMODATIONCODE: return "HL7AccommodationCode";
+            case I: return "Isolation";
+            case P: return "Private";
+            case S: return "Suite";
+            case SP: return "Semi-private";
+            case W: return "Ward";
+            case _ACTINVOICEDETAILCLINICALSERVICECODE: return "ActInvoiceDetailClinicalServiceCode";
+            case _ACTINVOICEGROUPCODE: return "ActInvoiceGroupCode";
+            case _ACTINVOICEINTERGROUPCODE: return "ActInvoiceInterGroupCode";
+            case CPNDDRGING: return "compound drug invoice group";
+            case CPNDINDING: return "compound ingredient invoice group";
+            case CPNDSUPING: return "compound supply invoice group";
+            case DRUGING: return "drug invoice group";
+            case FRAMEING: return "frame invoice group";
+            case LENSING: return "lens invoice group";
+            case PRDING: return "product invoice group";
+            case _ACTINVOICEROOTGROUPCODE: return "ActInvoiceRootGroupCode";
+            case CPINV: return "clinical product invoice";
+            case CSINV: return "clinical service invoice";
+            case CSPINV: return "clinical service and product";
+            case FININV: return "financial invoice";
+            case OHSINV: return "oral health service";
+            case PAINV: return "preferred accommodation invoice";
+            case RXCINV: return "Rx compound invoice";
+            case RXDINV: return "Rx dispense invoice";
+            case SBFINV: return "sessional or block fee invoice";
+            case VRXINV: return "vision dispense invoice";
+            case _ACTINVOICEELEMENTSUMMARYCODE: return "ActInvoiceElementSummaryCode";
+            case _INVOICEELEMENTADJUDICATED: return "InvoiceElementAdjudicated";
+            case ADNFPPELAT: return "adjud. nullified prior-period electronic amount";
+            case ADNFPPELCT: return "adjud. nullified prior-period electronic count";
+            case ADNFPPMNAT: return "adjud. nullified prior-period manual amount";
+            case ADNFPPMNCT: return "adjud. nullified prior-period manual count";
+            case ADNFSPELAT: return "adjud. nullified same-period electronic amount";
+            case ADNFSPELCT: return "adjud. nullified same-period electronic count";
+            case ADNFSPMNAT: return "adjud. nullified same-period manual amount";
+            case ADNFSPMNCT: return "adjud. nullified same-period manual count";
+            case ADNPPPELAT: return "adjud. non-payee payable prior-period electronic amount";
+            case ADNPPPELCT: return "adjud. non-payee payable prior-period electronic count";
+            case ADNPPPMNAT: return "adjud. non-payee payable prior-period manual amount";
+            case ADNPPPMNCT: return "adjud. non-payee payable prior-period manual count";
+            case ADNPSPELAT: return "adjud. non-payee payable same-period electronic amount";
+            case ADNPSPELCT: return "adjud. non-payee payable same-period electronic count";
+            case ADNPSPMNAT: return "adjud. non-payee payable same-period manual amount";
+            case ADNPSPMNCT: return "adjud. non-payee payable same-period manual count";
+            case ADPPPPELAT: return "adjud. payee payable prior-period electronic amount";
+            case ADPPPPELCT: return "adjud. payee payable prior-period electronic count";
+            case ADPPPPMNAT: return "adjud. payee payable prior-period manual amout";
+            case ADPPPPMNCT: return "adjud. payee payable prior-period manual count";
+            case ADPPSPELAT: return "adjud. payee payable same-period electronic amount";
+            case ADPPSPELCT: return "adjud. payee payable same-period electronic count";
+            case ADPPSPMNAT: return "adjud. payee payable same-period manual amount";
+            case ADPPSPMNCT: return "adjud. payee payable same-period manual count";
+            case ADRFPPELAT: return "adjud. refused prior-period electronic amount";
+            case ADRFPPELCT: return "adjud. refused prior-period electronic count";
+            case ADRFPPMNAT: return "adjud. refused prior-period manual amount";
+            case ADRFPPMNCT: return "adjud. refused prior-period manual count";
+            case ADRFSPELAT: return "adjud. refused same-period electronic amount";
+            case ADRFSPELCT: return "adjud. refused same-period electronic count";
+            case ADRFSPMNAT: return "adjud. refused same-period manual amount";
+            case ADRFSPMNCT: return "adjud. refused same-period manual count";
+            case _INVOICEELEMENTPAID: return "InvoiceElementPaid";
+            case PDNFPPELAT: return "paid nullified prior-period electronic amount";
+            case PDNFPPELCT: return "paid nullified prior-period electronic count";
+            case PDNFPPMNAT: return "paid nullified prior-period manual amount";
+            case PDNFPPMNCT: return "paid nullified prior-period manual count";
+            case PDNFSPELAT: return "paid nullified same-period electronic amount";
+            case PDNFSPELCT: return "paid nullified same-period electronic count";
+            case PDNFSPMNAT: return "paid nullified same-period manual amount";
+            case PDNFSPMNCT: return "paid nullified same-period manual count";
+            case PDNPPPELAT: return "paid non-payee payable prior-period electronic amount";
+            case PDNPPPELCT: return "paid non-payee payable prior-period electronic count";
+            case PDNPPPMNAT: return "paid non-payee payable prior-period manual amount";
+            case PDNPPPMNCT: return "paid non-payee payable prior-period manual count";
+            case PDNPSPELAT: return "paid non-payee payable same-period electronic amount";
+            case PDNPSPELCT: return "paid non-payee payable same-period electronic count";
+            case PDNPSPMNAT: return "paid non-payee payable same-period manual amount";
+            case PDNPSPMNCT: return "paid non-payee payable same-period manual count";
+            case PDPPPPELAT: return "paid payee payable prior-period electronic amount";
+            case PDPPPPELCT: return "paid payee payable prior-period electronic count";
+            case PDPPPPMNAT: return "paid payee payable prior-period manual amount";
+            case PDPPPPMNCT: return "paid payee payable prior-period manual count";
+            case PDPPSPELAT: return "paid payee payable same-period electronic amount";
+            case PDPPSPELCT: return "paid payee payable same-period electronic count";
+            case PDPPSPMNAT: return "paid payee payable same-period manual amount";
+            case PDPPSPMNCT: return "paid payee payable same-period manual count";
+            case _INVOICEELEMENTSUBMITTED: return "InvoiceElementSubmitted";
+            case SBBLELAT: return "submitted billed electronic amount";
+            case SBBLELCT: return "submitted billed electronic count";
+            case SBNFELAT: return "submitted nullified electronic amount";
+            case SBNFELCT: return "submitted cancelled electronic count";
+            case SBPDELAT: return "submitted pending electronic amount";
+            case SBPDELCT: return "submitted pending electronic count";
+            case _ACTINVOICEOVERRIDECODE: return "ActInvoiceOverrideCode";
+            case COVGE: return "coverage problem";
+            case EFORM: return "electronic form to follow";
+            case FAX: return "fax to follow";
+            case GFTH: return "good faith indicator";
+            case LATE: return "late invoice";
+            case MANUAL: return "manual review";
+            case OOJ: return "out of jurisdiction";
+            case ORTHO: return "orthodontic service";
+            case PAPER: return "paper documentation to follow";
+            case PIE: return "public insurance exhausted";
+            case PYRDELAY: return "delayed by a previous payor";
+            case REFNR: return "referral not required";
+            case REPSERV: return "repeated service";
+            case UNRELAT: return "unrelated service";
+            case VERBAUTH: return "verbal authorization";
+            case _ACTLISTCODE: return "ActListCode";
+            case _ACTOBSERVATIONLIST: return "ActObservationList";
+            case CARELIST: return "care plan";
+            case CONDLIST: return "condition list";
+            case INTOLIST: return "intolerance list";
+            case PROBLIST: return "problem list";
+            case RISKLIST: return "risk factors";
+            case GOALLIST: return "goal list";
+            case _ACTTHERAPYDURATIONWORKINGLISTCODE: return "ActTherapyDurationWorkingListCode";
+            case _ACTMEDICATIONTHERAPYDURATIONWORKINGLISTCODE: return "act medication therapy duration working list";
+            case ACU: return "short term/acute";
+            case CHRON: return "continuous/chronic";
+            case ONET: return "one time";
+            case PRN: return "as needed";
+            case MEDLIST: return "medication list";
+            case CURMEDLIST: return "current medication list";
+            case DISCMEDLIST: return "discharge medication list";
+            case HISTMEDLIST: return "medication history";
+            case _ACTMONITORINGPROTOCOLCODE: return "ActMonitoringProtocolCode";
+            case CTLSUB: return "Controlled Substance";
+            case INV: return "investigational";
+            case LU: return "limited use";
+            case OTC: return "non prescription medicine";
+            case RX: return "prescription only medicine";
+            case SA: return "special authorization";
+            case SAC: return "special access";
+            case _ACTNONOBSERVATIONINDICATIONCODE: return "ActNonObservationIndicationCode";
+            case IND01: return "imaging study requiring contrast";
+            case IND02: return "colonoscopy prep";
+            case IND03: return "prophylaxis";
+            case IND04: return "surgical prophylaxis";
+            case IND05: return "pregnancy prophylaxis";
+            case _ACTOBSERVATIONVERIFICATIONTYPE: return "act observation verification";
+            case VFPAPER: return "verify paper";
+            case _ACTPAYMENTCODE: return "ActPaymentCode";
+            case ACH: return "Automated Clearing House";
+            case CHK: return "Cheque";
+            case DDP: return "Direct Deposit";
+            case NON: return "Non-Payment Data";
+            case _ACTPHARMACYSUPPLYTYPE: return "ActPharmacySupplyType";
+            case DF: return "Daily Fill";
+            case EM: return "Emergency Supply";
+            case SO: return "Script Owing";
+            case FF: return "First Fill";
+            case FFC: return "First Fill - Complete";
+            case FFP: return "First Fill - Part Fill";
+            case FFSS: return "first fill, partial strength";
+            case TF: return "Trial Fill";
+            case FS: return "Floor stock";
+            case MS: return "Manufacturer Sample";
+            case RF: return "Refill";
+            case UD: return "Unit Dose";
+            case RFC: return "Refill - Complete";
+            case RFCS: return "refill complete partial strength";
+            case RFF: return "Refill (First fill this facility)";
+            case RFFS: return "refill partial strength (first fill this facility)";
+            case RFP: return "Refill - Part Fill";
+            case RFPS: return "refill part fill partial strength";
+            case RFS: return "refill partial strength";
+            case TB: return "Trial Balance";
+            case TBS: return "trial balance partial strength";
+            case UDE: return "unit dose equivalent";
+            case _ACTPOLICYTYPE: return "ActPolicyType";
+            case _ACTPRIVACYPOLICY: return "ActPrivacyPolicy";
+            case _ACTCONSENTDIRECTIVE: return "ActConsentDirective";
+            case EMRGONLY: return "emergency only";
+            case GRANTORCHOICE: return "grantor choice";
+            case IMPLIED: return "implied consent";
+            case IMPLIEDD: return "implied consent with opportunity to dissent";
+            case NOCONSENT: return "no consent";
+            case NOPP: return "notice of privacy practices";
+            case OPTIN: return "opt-in";
+            case OPTINR: return "opt-in with restrictions";
+            case OPTOUT: return "op-out";
+            case OPTOUTE: return "opt-out with exceptions";
+            case _ACTPRIVACYLAW: return "ActPrivacyLaw";
+            case _ACTUSPRIVACYLAW: return "_ActUSPrivacyLaw";
+            case _42CFRPART2: return "42 CFR Part2";
+            case COMMONRULE: return "Common Rule";
+            case HIPAANOPP: return "HIPAA notice of privacy practices";
+            case HIPAAPSYNOTES: return "HIPAA psychotherapy notes";
+            case HIPAASELFPAY: return "HIPAA self-pay";
+            case TITLE38SECTION7332: return "Title 38 Section 7332";
+            case _INFORMATIONSENSITIVITYPOLICY: return "InformationSensitivityPolicy";
+            case _ACTINFORMATIONSENSITIVITYPOLICY: return "ActInformationSensitivityPolicy";
+            case ETH: return "substance abuse information sensitivity";
+            case GDIS: return "genetic disease information sensitivity";
+            case HIV: return "HIV/AIDS information sensitivity";
+            case PSY: return "psychiatry information sensitivity";
+            case SCA: return "sickle cell anemia";
+            case SOC: return "social services sensitivity";
+            case SDV: return "sexual assault, abuse, or domestic violence information sensitivity";
+            case SEX: return "sexuality and reproductive health information sensitivity";
+            case STD: return "sexually transmitted disease information sensitivity";
+            case TBOO: return "taboo";
+            case SICKLE: return "sickle cell";
+            case _ENTITYSENSITIVITYPOLICYTYPE: return "EntityInformationSensitivityPolicy";
+            case DEMO: return "all demographic information sensitivity";
+            case DOB: return "date of birth information sensitivity";
+            case GENDER: return "gender and sexual orientation information sensitivity";
+            case LIVARG: return "living arrangement information sensitivity";
+            case MARST: return "marital status information sensitivity";
+            case RACE: return "race information sensitivity";
+            case REL: return "religion information sensitivity";
+            case _ROLEINFORMATIONSENSITIVITYPOLICY: return "RoleInformationSensitivityPolicy";
+            case B: return "business information sensitivity";
+            case EMPL: return "employer information sensitivity";
+            case LOCIS: return "location information sensitivity";
+            case SSP: return "sensitive service provider information sensitivity";
+            case ADOL: return "adolescent information sensitivity";
+            case CEL: return "celebrity information sensitivity";
+            case DIA: return "diagnosis information sensitivity";
+            case DRGIS: return "drug information sensitivity";
+            case EMP: return "employee information sensitivity";
+            case PDS: return "patient default sensitivity";
+            case PRS: return "patient requested sensitivity";
+            case COMPT: return "compartment";
+            case HRCOMPT: return "human resource compartment";
+            case RESCOMPT: return "research project compartment";
+            case RMGTCOMPT: return "records management compartment";
+            case ACTTRUSTPOLICYTYPE: return "trust policy";
+            case TRSTACCRD: return "trust accreditation";
+            case TRSTAGRE: return "trust agreement";
+            case TRSTASSUR: return "trust assurance";
+            case TRSTCERT: return "trust certificate";
+            case TRSTFWK: return "trust framework";
+            case TRSTMEC: return "trust mechanism";
+            case COVPOL: return "benefit policy";
+            case SECURITYPOLICY: return "security policy";
+            case OBLIGATIONPOLICY: return "obligation policy";
+            case ANONY: return "anonymize";
+            case AOD: return "accounting of disclosure";
+            case AUDIT: return "audit";
+            case AUDTR: return "audit trail";
+            case CPLYCC: return "comply with confidentiality code";
+            case CPLYCD: return "comply with consent directive";
+            case CPLYJPP: return "comply with jurisdictional privacy policy";
+            case CPLYOPP: return "comply with organizational privacy policy";
+            case CPLYOSP: return "comply with organizational security policy";
+            case CPLYPOL: return "comply with policy";
+            case DECLASSIFYLABEL: return "declassify security label";
+            case DEID: return "deidentify";
+            case DELAU: return "delete after use";
+            case DOWNGRDLABEL: return "downgrade security label";
+            case DRIVLABEL: return "derive security label";
+            case ENCRYPT: return "encrypt";
+            case ENCRYPTR: return "encrypt at rest";
+            case ENCRYPTT: return "encrypt in transit";
+            case ENCRYPTU: return "encrypt in use";
+            case HUAPRV: return "human approval";
+            case LABEL: return "assign security label";
+            case MASK: return "mask";
+            case MINEC: return "minimum necessary";
+            case PERSISTLABEL: return "persist security label";
+            case PRIVMARK: return "privacy mark";
+            case PSEUD: return "pseudonymize";
+            case REDACT: return "redact";
+            case UPGRDLABEL: return "upgrade security label";
+            case REFRAINPOLICY: return "refrain policy";
+            case NOAUTH: return "no disclosure without subject authorization";
+            case NOCOLLECT: return "no collection";
+            case NODSCLCD: return "no disclosure without consent directive";
+            case NODSCLCDS: return "no disclosure without information subject's consent directive";
+            case NOINTEGRATE: return "no integration";
+            case NOLIST: return "no unlisted entity disclosure";
+            case NOMOU: return "no disclosure without MOU";
+            case NOORGPOL: return "no disclosure without organizational authorization";
+            case NOPAT: return "no disclosure to patient, family or caregivers without attending provider's authorization";
+            case NOPERSISTP: return "no collection beyond purpose of use";
+            case NORDSCLCD: return "no redisclosure without consent directive";
+            case NORDSCLCDS: return "no redisclosure without information subject's consent directive";
+            case NORDSCLW: return "no disclosure without jurisdictional authorization";
+            case NORELINK: return "no relinking";
+            case NOREUSE: return "no reuse beyond purpose of use";
+            case NOVIP: return "no unauthorized VIP disclosure";
+            case ORCON: return "no disclosure without originator authorization";
+            case _ACTPRODUCTACQUISITIONCODE: return "ActProductAcquisitionCode";
+            case LOAN: return "Loan";
+            case RENT: return "Rent";
+            case TRANSFER: return "Transfer";
+            case SALE: return "Sale";
+            case _ACTSPECIMENTRANSPORTCODE: return "ActSpecimenTransportCode";
+            case SREC: return "specimen received";
+            case SSTOR: return "specimen in storage";
+            case STRAN: return "specimen in transit";
+            case _ACTSPECIMENTREATMENTCODE: return "ActSpecimenTreatmentCode";
+            case ACID: return "Acidification";
+            case ALK: return "Alkalization";
+            case DEFB: return "Defibrination";
+            case FILT: return "Filtration";
+            case LDLP: return "LDL Precipitation";
+            case NEUT: return "Neutralization";
+            case RECA: return "Recalcification";
+            case UFIL: return "Ultrafiltration";
+            case _ACTSUBSTANCEADMINISTRATIONCODE: return "ActSubstanceAdministrationCode";
+            case DRUG: return "Drug therapy";
+            case FD: return "food";
+            case IMMUNIZ: return "Immunization";
+            case BOOSTER: return "Booster Immunization";
+            case INITIMMUNIZ: return "Initial Immunization";
+            case _ACTTASKCODE: return "ActTaskCode";
+            case OE: return "order entry task";
+            case LABOE: return "laboratory test order entry task";
+            case MEDOE: return "medication order entry task";
+            case PATDOC: return "patient documentation task";
+            case ALLERLREV: return "allergy list review";
+            case CLINNOTEE: return "clinical note entry task";
+            case DIAGLISTE: return "diagnosis list entry task";
+            case DISCHINSTE: return "discharge instruction entry";
+            case DISCHSUME: return "discharge summary entry task";
+            case PATEDUE: return "patient education entry";
+            case PATREPE: return "pathology report entry task";
+            case PROBLISTE: return "problem list entry task";
+            case RADREPE: return "radiology report entry task";
+            case IMMLREV: return "immunization list review";
+            case REMLREV: return "reminder list review";
+            case WELLREMLREV: return "wellness reminder list review";
+            case PATINFO: return "patient information review task";
+            case ALLERLE: return "allergy list entry";
+            case CDSREV: return "clinical decision support intervention review";
+            case CLINNOTEREV: return "clinical note review task";
+            case DISCHSUMREV: return "discharge summary review task";
+            case DIAGLISTREV: return "diagnosis list review task";
+            case IMMLE: return "immunization list entry";
+            case LABRREV: return "laboratory results review task";
+            case MICRORREV: return "microbiology results review task";
+            case MICROORGRREV: return "microbiology organisms results review task";
+            case MICROSENSRREV: return "microbiology sensitivity test results review task";
+            case MLREV: return "medication list review task";
+            case MARWLREV: return "medication administration record work list review task";
+            case OREV: return "orders review task";
+            case PATREPREV: return "pathology report review task";
+            case PROBLISTREV: return "problem list review task";
+            case RADREPREV: return "radiology report review task";
+            case REMLE: return "reminder list entry";
+            case WELLREMLE: return "wellness reminder list entry";
+            case RISKASSESS: return "risk assessment instrument task";
+            case FALLRISK: return "falls risk assessment instrument task";
+            case _ACTTRANSPORTATIONMODECODE: return "ActTransportationModeCode";
+            case _ACTPATIENTTRANSPORTATIONMODECODE: return "ActPatientTransportationModeCode";
+            case AFOOT: return "pedestrian transport";
+            case AMBT: return "ambulance transport";
+            case AMBAIR: return "fixed-wing ambulance transport";
+            case AMBGRND: return "ground ambulance transport";
+            case AMBHELO: return "helicopter ambulance transport";
+            case LAWENF: return "law enforcement transport";
+            case PRVTRN: return "private transport";
+            case PUBTRN: return "public transport";
+            case _OBSERVATIONTYPE: return "ObservationType";
+            case _ACTSPECOBSCODE: return "ActSpecObsCode";
+            case ARTBLD: return "ActSpecObsArtBldCode";
+            case DILUTION: return "ActSpecObsDilutionCode";
+            case AUTOHIGH: return "Auto-High Dilution";
+            case AUTOLOW: return "Auto-Low Dilution";
+            case PRE: return "Pre-Dilution";
+            case RERUN: return "Rerun Dilution";
+            case EVNFCTS: return "ActSpecObsEvntfctsCode";
+            case INTFR: return "ActSpecObsInterferenceCode";
+            case FIBRIN: return "Fibrin";
+            case HEMOLYSIS: return "Hemolysis";
+            case ICTERUS: return "Icterus";
+            case LIPEMIA: return "Lipemia";
+            case VOLUME: return "ActSpecObsVolumeCode";
+            case AVAILABLE: return "Available Volume";
+            case CONSUMPTION: return "Consumption Volume";
+            case CURRENT: return "Current Volume";
+            case INITIAL: return "Initial Volume";
+            case _ANNOTATIONTYPE: return "AnnotationType";
+            case _ACTPATIENTANNOTATIONTYPE: return "ActPatientAnnotationType";
+            case ANNDI: return "diagnostic image note";
+            case ANNGEN: return "general note";
+            case ANNIMM: return "immunization note";
+            case ANNLAB: return "laboratory note";
+            case ANNMED: return "medication note";
+            case _GENETICOBSERVATIONTYPE: return "GeneticObservationType";
+            case GENE: return "gene";
+            case _IMMUNIZATIONOBSERVATIONTYPE: return "ImmunizationObservationType";
+            case OBSANTC: return "antigen count";
+            case OBSANTV: return "antigen validity";
+            case _INDIVIDUALCASESAFETYREPORTTYPE: return "Individual Case Safety Report Type";
+            case PATADVEVNT: return "patient adverse event";
+            case VACPROBLEM: return "vaccine product problem";
+            case _LOINCOBSERVATIONACTCONTEXTAGETYPE: return "LOINCObservationActContextAgeType";
+            case _216119: return "age patient qn est";
+            case _216127: return "age patient qn reported";
+            case _295535: return "age patient qn calc";
+            case _305250: return "age patient qn definition";
+            case _309724: return "age at onset of adverse event";
+            case _MEDICATIONOBSERVATIONTYPE: return "MedicationObservationType";
+            case REPHALFLIFE: return "representative half-life";
+            case SPLCOATING: return "coating";
+            case SPLCOLOR: return "color";
+            case SPLIMAGE: return "image";
+            case SPLIMPRINT: return "imprint";
+            case SPLSCORING: return "scoring";
+            case SPLSHAPE: return "shape";
+            case SPLSIZE: return "size";
+            case SPLSYMBOL: return "symbol";
+            case _OBSERVATIONISSUETRIGGERCODEDOBSERVATIONTYPE: return "ObservationIssueTriggerCodedObservationType";
+            case _CASETRANSMISSIONMODE: return "case transmission mode";
+            case AIRTRNS: return "airborne transmission";
+            case ANANTRNS: return "animal to animal transmission";
+            case ANHUMTRNS: return "animal to human transmission";
+            case BDYFLDTRNS: return "body fluid contact transmission";
+            case BLDTRNS: return "blood borne transmission";
+            case DERMTRNS: return "transdermal transmission";
+            case ENVTRNS: return "environmental exposure transmission";
+            case FECTRNS: return "fecal-oral transmission";
+            case FOMTRNS: return "fomite transmission";
+            case FOODTRNS: return "food-borne transmission";
+            case HUMHUMTRNS: return "human to human transmission";
+            case INDTRNS: return "indeterminate disease transmission mode";
+            case LACTTRNS: return "lactation transmission";
+            case NOSTRNS: return "nosocomial transmission";
+            case PARTRNS: return "parenteral transmission";
+            case PLACTRNS: return "transplacental transmission";
+            case SEXTRNS: return "sexual transmission";
+            case TRNSFTRNS: return "transfusion transmission";
+            case VECTRNS: return "vector-borne transmission";
+            case WATTRNS: return "water-borne transmission";
+            case _OBSERVATIONQUALITYMEASUREATTRIBUTE: return "ObservationQualityMeasureAttribute";
+            case AGGREGATE: return "aggregate measure observation";
+            case CMPMSRMTH: return "composite measure method";
+            case CMPMSRSCRWGHT: return "component measure scoring weight";
+            case COPY: return "copyright";
+            case CRS: return "clinical recommendation statement";
+            case DEF: return "definition";
+            case DISC: return "disclaimer";
+            case FINALDT: return "finalized date/time";
+            case GUIDE: return "guidance";
+            case IDUR: return "improvement notation";
+            case ITMCNT: return "items counted";
+            case KEY: return "keyword";
+            case MEDT: return "measurement end date";
+            case MSD: return "measurement start date";
+            case MSRADJ: return "risk adjustment";
+            case MSRAGG: return "rate aggregation";
+            case MSRIMPROV: return "health quality measure improvement notation";
+            case MSRJUR: return "jurisdiction";
+            case MSRRPTR: return "reporter type";
+            case MSRRPTTIME: return "timeframe for reporting";
+            case MSRSCORE: return "measure scoring";
+            case MSRSET: return "health quality measure care setting";
+            case MSRTOPIC: return "health quality measure topic type";
+            case MSRTP: return "measurement period";
+            case MSRTYPE: return "measure type";
+            case RAT: return "rationale";
+            case REF: return "reference";
+            case SDE: return "supplemental data elements";
+            case STRAT: return "stratification";
+            case TRANF: return "transmission format";
+            case USE: return "notice of use";
+            case _OBSERVATIONSEQUENCETYPE: return "ObservationSequenceType";
+            case TIMEABSOLUTE: return "absolute time sequence";
+            case TIMERELATIVE: return "relative time sequence";
+            case _OBSERVATIONSERIESTYPE: return "ObservationSeriesType";
+            case _ECGOBSERVATIONSERIESTYPE: return "ECGObservationSeriesType";
+            case REPRESENTATIVEBEAT: return "ECG representative beat waveforms";
+            case RHYTHM: return "ECG rhythm waveforms";
+            case _PATIENTIMMUNIZATIONRELATEDOBSERVATIONTYPE: return "PatientImmunizationRelatedObservationType";
+            case CLSSRM: return "classroom";
+            case GRADE: return "grade";
+            case SCHL: return "school";
+            case SCHLDIV: return "school division";
+            case TEACHER: return "teacher";
+            case _POPULATIONINCLUSIONOBSERVATIONTYPE: return "PopulationInclusionObservationType";
+            case DENEX: return "denominator exclusions";
+            case DENEXCEP: return "denominator exceptions";
+            case DENOM: return "denominator";
+            case IPOP: return "initial population";
+            case IPPOP: return "initial patient population";
+            case MSRPOPL: return "measure population";
+            case MSRPOPLEX: return "measure population exclusions";
+            case NUMER: return "numerator";
+            case NUMEX: return "numerator exclusions";
+            case _PREFERENCEOBSERVATIONTYPE: return "_PreferenceObservationType";
+            case PREFSTRENGTH: return "preference strength";
+            case ADVERSEREACTION: return "Adverse Reaction";
+            case ASSERTION: return "Assertion";
+            case CASESER: return "case seriousness criteria";
+            case CDIO: return "case disease imported observation";
+            case CRIT: return "criticality";
+            case CTMO: return "case transmission mode observation";
+            case DX: return "ObservationDiagnosisTypes";
+            case ADMDX: return "admitting diagnosis";
+            case DISDX: return "discharge diagnosis";
+            case INTDX: return "intermediate diagnosis";
+            case NOI: return "nature of injury";
+            case GISTIER: return "GIS tier";
+            case HHOBS: return "household situation observation";
+            case ISSUE: return "detected issue";
+            case _ACTADMINISTRATIVEDETECTEDISSUECODE: return "ActAdministrativeDetectedIssueCode";
+            case _ACTADMINISTRATIVEAUTHORIZATIONDETECTEDISSUECODE: return "ActAdministrativeAuthorizationDetectedIssueCode";
+            case NAT: return "Insufficient authorization";
+            case SUPPRESSED: return "record suppressed";
+            case VALIDAT: return "validation issue";
+            case KEY204: return "Unknown key identifier";
+            case KEY205: return "Duplicate key identifier";
+            case COMPLY: return "Compliance Alert";
+            case DUPTHPY: return "Duplicate Therapy Alert";
+            case DUPTHPCLS: return "duplicate therapeutic alass alert";
+            case DUPTHPGEN: return "duplicate generic alert";
+            case ABUSE: return "commonly abused/misused alert";
+            case FRAUD: return "potential fraud";
+            case PLYDOC: return "Poly-orderer Alert";
+            case PLYPHRM: return "Poly-supplier Alert";
+            case DOSE: return "Dosage problem";
+            case DOSECOND: return "dosage-condition alert";
+            case DOSEDUR: return "Dose-Duration Alert";
+            case DOSEDURH: return "Dose-Duration High Alert";
+            case DOSEDURHIND: return "Dose-Duration High for Indication Alert";
+            case DOSEDURL: return "Dose-Duration Low Alert";
+            case DOSEDURLIND: return "Dose-Duration Low for Indication Alert";
+            case DOSEH: return "High Dose Alert";
+            case DOSEHINDA: return "High Dose for Age Alert";
+            case DOSEHIND: return "High Dose for Indication Alert";
+            case DOSEHINDSA: return "High Dose for Height/Surface Area Alert";
+            case DOSEHINDW: return "High Dose for Weight Alert";
+            case DOSEIVL: return "Dose-Interval Alert";
+            case DOSEIVLIND: return "Dose-Interval for Indication Alert";
+            case DOSEL: return "Low Dose Alert";
+            case DOSELINDA: return "Low Dose for Age Alert";
+            case DOSELIND: return "Low Dose for Indication Alert";
+            case DOSELINDSA: return "Low Dose for Height/Surface Area Alert";
+            case DOSELINDW: return "Low Dose for Weight Alert";
+            case MDOSE: return "maximum dosage reached";
+            case OBSA: return "Observation Alert";
+            case AGE: return "Age Alert";
+            case ADALRT: return "adult alert";
+            case GEALRT: return "geriatric alert";
+            case PEALRT: return "pediatric alert";
+            case COND: return "Condition Alert";
+            case HGHT: return "HGHT";
+            case LACT: return "Lactation Alert";
+            case PREG: return "Pregnancy Alert";
+            case WGHT: return "WGHT";
+            case CREACT: return "common reaction alert";
+            case GEN: return "Genetic Alert";
+            case GEND: return "Gender Alert";
+            case LAB: return "Lab Alert";
+            case REACT: return "Reaction Alert";
+            case ALGY: return "Allergy Alert";
+            case INT: return "Intolerance Alert";
+            case RREACT: return "Related Reaction Alert";
+            case RALG: return "Related Allergy Alert";
+            case RAR: return "Related Prior Reaction Alert";
+            case RINT: return "Related Intolerance Alert";
+            case BUS: return "business constraint violation";
+            case CODEINVAL: return "code is not valid";
+            case CODEDEPREC: return "code has been deprecated";
+            case FORMAT: return "invalid format";
+            case ILLEGAL: return "illegal";
+            case LENRANGE: return "length out of range";
+            case LENLONG: return "length is too long";
+            case LENSHORT: return "length is too short";
+            case MISSCOND: return "conditional element missing";
+            case MISSMAND: return "mandatory element missing";
+            case NODUPS: return "duplicate values are not permitted";
+            case NOPERSIST: return "element will not be persisted";
+            case REPRANGE: return "repetitions out of range";
+            case MAXOCCURS: return "repetitions above maximum";
+            case MINOCCURS: return "repetitions below minimum";
+            case _ACTADMINISTRATIVERULEDETECTEDISSUECODE: return "ActAdministrativeRuleDetectedIssueCode";
+            case KEY206: return "non-matching identification";
+            case OBSOLETE: return "obsolete record returned";
+            case _ACTSUPPLIEDITEMDETECTEDISSUECODE: return "ActSuppliedItemDetectedIssueCode";
+            case _ADMINISTRATIONDETECTEDISSUECODE: return "AdministrationDetectedIssueCode";
+            case _APPROPRIATENESSDETECTEDISSUECODE: return "AppropriatenessDetectedIssueCode";
+            case _INTERACTIONDETECTEDISSUECODE: return "InteractionDetectedIssueCode";
+            case FOOD: return "Food Interaction Alert";
+            case TPROD: return "Therapeutic Product Alert";
+            case DRG: return "Drug Interaction Alert";
+            case NHP: return "Natural Health Product Alert";
+            case NONRX: return "Non-Prescription Interaction Alert";
+            case PREVINEF: return "previously ineffective";
+            case DACT: return "drug action detected issue";
+            case TIME: return "timing detected issue";
+            case ALRTENDLATE: return "end too late alert";
+            case ALRTSTRTLATE: return "start too late alert";
+            case _TIMINGDETECTEDISSUECODE: return "TimingDetectedIssueCode";
+            case ENDLATE: return "End Too Late Alert";
+            case STRTLATE: return "Start Too Late Alert";
+            case _SUPPLYDETECTEDISSUECODE: return "SupplyDetectedIssueCode";
+            case ALLDONE: return "already performed";
+            case FULFIL: return "fulfillment alert";
+            case NOTACTN: return "no longer actionable";
+            case NOTEQUIV: return "not equivalent alert";
+            case NOTEQUIVGEN: return "not generically equivalent alert";
+            case NOTEQUIVTHER: return "not therapeutically equivalent alert";
+            case TIMING: return "event timing incorrect alert";
+            case INTERVAL: return "outside requested time";
+            case MINFREQ: return "too soon within frequency based on the usage";
+            case HELD: return "held/suspended alert";
+            case TOOLATE: return "Refill Too Late Alert";
+            case TOOSOON: return "Refill Too Soon Alert";
+            case HISTORIC: return "record recorded as historical";
+            case PATPREF: return "violates stated preferences";
+            case PATPREFALT: return "violates stated preferences, alternate available";
+            case KSUBJ: return "knowledge subject";
+            case KSUBT: return "knowledge subtopic";
+            case OINT: return "intolerance";
+            case ALG: return "Allergy";
+            case DALG: return "Drug Allergy";
+            case EALG: return "Environmental Allergy";
+            case FALG: return "Food Allergy";
+            case DINT: return "Drug Intolerance";
+            case DNAINT: return "Drug Non-Allergy Intolerance";
+            case EINT: return "Environmental Intolerance";
+            case ENAINT: return "Environmental Non-Allergy Intolerance";
+            case FINT: return "Food Intolerance";
+            case FNAINT: return "Food Non-Allergy Intolerance";
+            case NAINT: return "Non-Allergy Intolerance";
+            case SEV: return "Severity Observation";
+            case _FDALABELDATA: return "FDALabelData";
+            case FDACOATING: return "coating";
+            case FDACOLOR: return "color";
+            case FDAIMPRINTCD: return "imprint code";
+            case FDALOGO: return "logo";
+            case FDASCORING: return "scoring";
+            case FDASHAPE: return "shape";
+            case FDASIZE: return "size";
+            case _ROIOVERLAYSHAPE: return "ROIOverlayShape";
+            case CIRCLE: return "circle";
+            case ELLIPSE: return "ellipse";
+            case POINT: return "point";
+            case POLY: return "polyline";
+            case C: return "corrected";
+            case DIET: return "Diet";
+            case BR: return "breikost (GE)";
+            case DM: return "diabetes mellitus diet";
+            case FAST: return "fasting";
+            case FORMULA: return "formula diet";
+            case GF: return "gluten free";
+            case LF: return "low fat";
+            case LP: return "low protein";
+            case LQ: return "liquid";
+            case LS: return "low sodium";
+            case N: return "normal diet";
+            case NF: return "no fat";
+            case PAF: return "phenylalanine free";
+            case PAR: return "parenteral";
+            case RD: return "reduction diet";
+            case SCH: return "schonkost (GE)";
+            case SUPPLEMENT: return "nutritional supplement";
+            case T: return "tea only";
+            case VLI: return "low valin, leucin, isoleucin";
+            case DRUGPRG: return "drug program";
+            case F: return "final";
+            case PRLMN: return "preliminary";
+            case SECOBS: return "SecurityObservationType";
+            case SECCATOBS: return "security category observation";
+            case SECCLASSOBS: return "security classification observation";
+            case SECCONOBS: return "security control observation";
+            case SECINTOBS: return "security integrity observation";
+            case SECALTINTOBS: return "security alteration integrity observation";
+            case SECDATINTOBS: return "security data integrity observation";
+            case SECINTCONOBS: return "security integrity confidence observation";
+            case SECINTPRVOBS: return "security integrity provenance observation";
+            case SECINTPRVABOBS: return "security integrity provenance asserted by observation";
+            case SECINTPRVRBOBS: return "security integrity provenance reported by observation";
+            case SECINTSTOBS: return "security integrity status observation";
+            case SECTRSTOBS: return "SECTRSTOBS";
+            case TRSTACCRDOBS: return "trust accreditation observation";
+            case TRSTAGREOBS: return "trust agreement observation";
+            case TRSTCERTOBS: return "trust certificate observation";
+            case TRSTFWKOBS: return "trust framework observation";
+            case TRSTLOAOBS: return "trust assurance observation";
+            case TRSTMECOBS: return "trust mechanism observation";
+            case SUBSIDFFS: return "subsidized fee for service program";
+            case WRKCOMP: return "(workers compensation program";
+            case _ACTPROCEDURECODE: return "ActProcedureCode";
+            case _ACTBILLABLESERVICECODE: return "ActBillableServiceCode";
+            case _HL7DEFINEDACTCODES: return "HL7DefinedActCodes";
+            case COPAY: return "COPAY";
+            case DEDUCT: return "DEDUCT";
+            case DOSEIND: return "DOSEIND";
+            case PRA: return "PRA";
+            case STORE: return "Storage";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActCodeEnumFactory.java
new file mode 100644
index 00000000000..8751a50b1bd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActCodeEnumFactory.java
@@ -0,0 +1,4430 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActCodeEnumFactory implements EnumFactory {
+
+  public V3ActCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ActAccountCode".equals(codeString))
+      return V3ActCode._ACTACCOUNTCODE;
+    if ("ACCTRECEIVABLE".equals(codeString))
+      return V3ActCode.ACCTRECEIVABLE;
+    if ("CASH".equals(codeString))
+      return V3ActCode.CASH;
+    if ("CC".equals(codeString))
+      return V3ActCode.CC;
+    if ("AE".equals(codeString))
+      return V3ActCode.AE;
+    if ("DN".equals(codeString))
+      return V3ActCode.DN;
+    if ("DV".equals(codeString))
+      return V3ActCode.DV;
+    if ("MC".equals(codeString))
+      return V3ActCode.MC;
+    if ("V".equals(codeString))
+      return V3ActCode.V;
+    if ("PBILLACCT".equals(codeString))
+      return V3ActCode.PBILLACCT;
+    if ("_ActAdjudicationCode".equals(codeString))
+      return V3ActCode._ACTADJUDICATIONCODE;
+    if ("_ActAdjudicationGroupCode".equals(codeString))
+      return V3ActCode._ACTADJUDICATIONGROUPCODE;
+    if ("CONT".equals(codeString))
+      return V3ActCode.CONT;
+    if ("DAY".equals(codeString))
+      return V3ActCode.DAY;
+    if ("LOC".equals(codeString))
+      return V3ActCode.LOC;
+    if ("MONTH".equals(codeString))
+      return V3ActCode.MONTH;
+    if ("PERIOD".equals(codeString))
+      return V3ActCode.PERIOD;
+    if ("PROV".equals(codeString))
+      return V3ActCode.PROV;
+    if ("WEEK".equals(codeString))
+      return V3ActCode.WEEK;
+    if ("YEAR".equals(codeString))
+      return V3ActCode.YEAR;
+    if ("AA".equals(codeString))
+      return V3ActCode.AA;
+    if ("ANF".equals(codeString))
+      return V3ActCode.ANF;
+    if ("AR".equals(codeString))
+      return V3ActCode.AR;
+    if ("AS".equals(codeString))
+      return V3ActCode.AS;
+    if ("_ActAdjudicationResultActionCode".equals(codeString))
+      return V3ActCode._ACTADJUDICATIONRESULTACTIONCODE;
+    if ("DISPLAY".equals(codeString))
+      return V3ActCode.DISPLAY;
+    if ("FORM".equals(codeString))
+      return V3ActCode.FORM;
+    if ("_ActBillableModifierCode".equals(codeString))
+      return V3ActCode._ACTBILLABLEMODIFIERCODE;
+    if ("CPTM".equals(codeString))
+      return V3ActCode.CPTM;
+    if ("HCPCSA".equals(codeString))
+      return V3ActCode.HCPCSA;
+    if ("_ActBillingArrangementCode".equals(codeString))
+      return V3ActCode._ACTBILLINGARRANGEMENTCODE;
+    if ("BLK".equals(codeString))
+      return V3ActCode.BLK;
+    if ("CAP".equals(codeString))
+      return V3ActCode.CAP;
+    if ("CONTF".equals(codeString))
+      return V3ActCode.CONTF;
+    if ("FINBILL".equals(codeString))
+      return V3ActCode.FINBILL;
+    if ("ROST".equals(codeString))
+      return V3ActCode.ROST;
+    if ("SESS".equals(codeString))
+      return V3ActCode.SESS;
+    if ("FFS".equals(codeString))
+      return V3ActCode.FFS;
+    if ("FFPS".equals(codeString))
+      return V3ActCode.FFPS;
+    if ("FFCS".equals(codeString))
+      return V3ActCode.FFCS;
+    if ("TFS".equals(codeString))
+      return V3ActCode.TFS;
+    if ("_ActBoundedROICode".equals(codeString))
+      return V3ActCode._ACTBOUNDEDROICODE;
+    if ("ROIFS".equals(codeString))
+      return V3ActCode.ROIFS;
+    if ("ROIPS".equals(codeString))
+      return V3ActCode.ROIPS;
+    if ("_ActCareProvisionCode".equals(codeString))
+      return V3ActCode._ACTCAREPROVISIONCODE;
+    if ("_ActCredentialedCareCode".equals(codeString))
+      return V3ActCode._ACTCREDENTIALEDCARECODE;
+    if ("_ActCredentialedCareProvisionPersonCode".equals(codeString))
+      return V3ActCode._ACTCREDENTIALEDCAREPROVISIONPERSONCODE;
+    if ("CACC".equals(codeString))
+      return V3ActCode.CACC;
+    if ("CAIC".equals(codeString))
+      return V3ActCode.CAIC;
+    if ("CAMC".equals(codeString))
+      return V3ActCode.CAMC;
+    if ("CANC".equals(codeString))
+      return V3ActCode.CANC;
+    if ("CAPC".equals(codeString))
+      return V3ActCode.CAPC;
+    if ("CBGC".equals(codeString))
+      return V3ActCode.CBGC;
+    if ("CCCC".equals(codeString))
+      return V3ActCode.CCCC;
+    if ("CCGC".equals(codeString))
+      return V3ActCode.CCGC;
+    if ("CCPC".equals(codeString))
+      return V3ActCode.CCPC;
+    if ("CCSC".equals(codeString))
+      return V3ActCode.CCSC;
+    if ("CDEC".equals(codeString))
+      return V3ActCode.CDEC;
+    if ("CDRC".equals(codeString))
+      return V3ActCode.CDRC;
+    if ("CEMC".equals(codeString))
+      return V3ActCode.CEMC;
+    if ("CFPC".equals(codeString))
+      return V3ActCode.CFPC;
+    if ("CIMC".equals(codeString))
+      return V3ActCode.CIMC;
+    if ("CMGC".equals(codeString))
+      return V3ActCode.CMGC;
+    if ("CNEC".equals(codeString))
+      return V3ActCode.CNEC;
+    if ("CNMC".equals(codeString))
+      return V3ActCode.CNMC;
+    if ("CNQC".equals(codeString))
+      return V3ActCode.CNQC;
+    if ("CNSC".equals(codeString))
+      return V3ActCode.CNSC;
+    if ("COGC".equals(codeString))
+      return V3ActCode.COGC;
+    if ("COMC".equals(codeString))
+      return V3ActCode.COMC;
+    if ("COPC".equals(codeString))
+      return V3ActCode.COPC;
+    if ("COSC".equals(codeString))
+      return V3ActCode.COSC;
+    if ("COTC".equals(codeString))
+      return V3ActCode.COTC;
+    if ("CPEC".equals(codeString))
+      return V3ActCode.CPEC;
+    if ("CPGC".equals(codeString))
+      return V3ActCode.CPGC;
+    if ("CPHC".equals(codeString))
+      return V3ActCode.CPHC;
+    if ("CPRC".equals(codeString))
+      return V3ActCode.CPRC;
+    if ("CPSC".equals(codeString))
+      return V3ActCode.CPSC;
+    if ("CPYC".equals(codeString))
+      return V3ActCode.CPYC;
+    if ("CROC".equals(codeString))
+      return V3ActCode.CROC;
+    if ("CRPC".equals(codeString))
+      return V3ActCode.CRPC;
+    if ("CSUC".equals(codeString))
+      return V3ActCode.CSUC;
+    if ("CTSC".equals(codeString))
+      return V3ActCode.CTSC;
+    if ("CURC".equals(codeString))
+      return V3ActCode.CURC;
+    if ("CVSC".equals(codeString))
+      return V3ActCode.CVSC;
+    if ("LGPC".equals(codeString))
+      return V3ActCode.LGPC;
+    if ("_ActCredentialedCareProvisionProgramCode".equals(codeString))
+      return V3ActCode._ACTCREDENTIALEDCAREPROVISIONPROGRAMCODE;
+    if ("AALC".equals(codeString))
+      return V3ActCode.AALC;
+    if ("AAMC".equals(codeString))
+      return V3ActCode.AAMC;
+    if ("ABHC".equals(codeString))
+      return V3ActCode.ABHC;
+    if ("ACAC".equals(codeString))
+      return V3ActCode.ACAC;
+    if ("ACHC".equals(codeString))
+      return V3ActCode.ACHC;
+    if ("AHOC".equals(codeString))
+      return V3ActCode.AHOC;
+    if ("ALTC".equals(codeString))
+      return V3ActCode.ALTC;
+    if ("AOSC".equals(codeString))
+      return V3ActCode.AOSC;
+    if ("CACS".equals(codeString))
+      return V3ActCode.CACS;
+    if ("CAMI".equals(codeString))
+      return V3ActCode.CAMI;
+    if ("CAST".equals(codeString))
+      return V3ActCode.CAST;
+    if ("CBAR".equals(codeString))
+      return V3ActCode.CBAR;
+    if ("CCAD".equals(codeString))
+      return V3ActCode.CCAD;
+    if ("CCAR".equals(codeString))
+      return V3ActCode.CCAR;
+    if ("CDEP".equals(codeString))
+      return V3ActCode.CDEP;
+    if ("CDGD".equals(codeString))
+      return V3ActCode.CDGD;
+    if ("CDIA".equals(codeString))
+      return V3ActCode.CDIA;
+    if ("CEPI".equals(codeString))
+      return V3ActCode.CEPI;
+    if ("CFEL".equals(codeString))
+      return V3ActCode.CFEL;
+    if ("CHFC".equals(codeString))
+      return V3ActCode.CHFC;
+    if ("CHRO".equals(codeString))
+      return V3ActCode.CHRO;
+    if ("CHYP".equals(codeString))
+      return V3ActCode.CHYP;
+    if ("CMIH".equals(codeString))
+      return V3ActCode.CMIH;
+    if ("CMSC".equals(codeString))
+      return V3ActCode.CMSC;
+    if ("COJR".equals(codeString))
+      return V3ActCode.COJR;
+    if ("CONC".equals(codeString))
+      return V3ActCode.CONC;
+    if ("COPD".equals(codeString))
+      return V3ActCode.COPD;
+    if ("CORT".equals(codeString))
+      return V3ActCode.CORT;
+    if ("CPAD".equals(codeString))
+      return V3ActCode.CPAD;
+    if ("CPND".equals(codeString))
+      return V3ActCode.CPND;
+    if ("CPST".equals(codeString))
+      return V3ActCode.CPST;
+    if ("CSDM".equals(codeString))
+      return V3ActCode.CSDM;
+    if ("CSIC".equals(codeString))
+      return V3ActCode.CSIC;
+    if ("CSLD".equals(codeString))
+      return V3ActCode.CSLD;
+    if ("CSPT".equals(codeString))
+      return V3ActCode.CSPT;
+    if ("CTBU".equals(codeString))
+      return V3ActCode.CTBU;
+    if ("CVDC".equals(codeString))
+      return V3ActCode.CVDC;
+    if ("CWMA".equals(codeString))
+      return V3ActCode.CWMA;
+    if ("CWOH".equals(codeString))
+      return V3ActCode.CWOH;
+    if ("_ActEncounterCode".equals(codeString))
+      return V3ActCode._ACTENCOUNTERCODE;
+    if ("AMB".equals(codeString))
+      return V3ActCode.AMB;
+    if ("EMER".equals(codeString))
+      return V3ActCode.EMER;
+    if ("FLD".equals(codeString))
+      return V3ActCode.FLD;
+    if ("HH".equals(codeString))
+      return V3ActCode.HH;
+    if ("IMP".equals(codeString))
+      return V3ActCode.IMP;
+    if ("ACUTE".equals(codeString))
+      return V3ActCode.ACUTE;
+    if ("NONAC".equals(codeString))
+      return V3ActCode.NONAC;
+    if ("PRENC".equals(codeString))
+      return V3ActCode.PRENC;
+    if ("SS".equals(codeString))
+      return V3ActCode.SS;
+    if ("VR".equals(codeString))
+      return V3ActCode.VR;
+    if ("_ActMedicalServiceCode".equals(codeString))
+      return V3ActCode._ACTMEDICALSERVICECODE;
+    if ("ALC".equals(codeString))
+      return V3ActCode.ALC;
+    if ("CARD".equals(codeString))
+      return V3ActCode.CARD;
+    if ("CHR".equals(codeString))
+      return V3ActCode.CHR;
+    if ("DNTL".equals(codeString))
+      return V3ActCode.DNTL;
+    if ("DRGRHB".equals(codeString))
+      return V3ActCode.DRGRHB;
+    if ("GENRL".equals(codeString))
+      return V3ActCode.GENRL;
+    if ("MED".equals(codeString))
+      return V3ActCode.MED;
+    if ("OBS".equals(codeString))
+      return V3ActCode.OBS;
+    if ("ONC".equals(codeString))
+      return V3ActCode.ONC;
+    if ("PALL".equals(codeString))
+      return V3ActCode.PALL;
+    if ("PED".equals(codeString))
+      return V3ActCode.PED;
+    if ("PHAR".equals(codeString))
+      return V3ActCode.PHAR;
+    if ("PHYRHB".equals(codeString))
+      return V3ActCode.PHYRHB;
+    if ("PSYCH".equals(codeString))
+      return V3ActCode.PSYCH;
+    if ("SURG".equals(codeString))
+      return V3ActCode.SURG;
+    if ("_ActClaimAttachmentCategoryCode".equals(codeString))
+      return V3ActCode._ACTCLAIMATTACHMENTCATEGORYCODE;
+    if ("AUTOATTCH".equals(codeString))
+      return V3ActCode.AUTOATTCH;
+    if ("DOCUMENT".equals(codeString))
+      return V3ActCode.DOCUMENT;
+    if ("HEALTHREC".equals(codeString))
+      return V3ActCode.HEALTHREC;
+    if ("IMG".equals(codeString))
+      return V3ActCode.IMG;
+    if ("LABRESULTS".equals(codeString))
+      return V3ActCode.LABRESULTS;
+    if ("MODEL".equals(codeString))
+      return V3ActCode.MODEL;
+    if ("WIATTCH".equals(codeString))
+      return V3ActCode.WIATTCH;
+    if ("XRAY".equals(codeString))
+      return V3ActCode.XRAY;
+    if ("_ActConsentType".equals(codeString))
+      return V3ActCode._ACTCONSENTTYPE;
+    if ("ICOL".equals(codeString))
+      return V3ActCode.ICOL;
+    if ("IDSCL".equals(codeString))
+      return V3ActCode.IDSCL;
+    if ("INFA".equals(codeString))
+      return V3ActCode.INFA;
+    if ("INFAO".equals(codeString))
+      return V3ActCode.INFAO;
+    if ("INFASO".equals(codeString))
+      return V3ActCode.INFASO;
+    if ("IRDSCL".equals(codeString))
+      return V3ActCode.IRDSCL;
+    if ("RESEARCH".equals(codeString))
+      return V3ActCode.RESEARCH;
+    if ("RSDID".equals(codeString))
+      return V3ActCode.RSDID;
+    if ("RSREID".equals(codeString))
+      return V3ActCode.RSREID;
+    if ("_ActContainerRegistrationCode".equals(codeString))
+      return V3ActCode._ACTCONTAINERREGISTRATIONCODE;
+    if ("ID".equals(codeString))
+      return V3ActCode.ID;
+    if ("IP".equals(codeString))
+      return V3ActCode.IP;
+    if ("L".equals(codeString))
+      return V3ActCode.L;
+    if ("M".equals(codeString))
+      return V3ActCode.M;
+    if ("O".equals(codeString))
+      return V3ActCode.O;
+    if ("R".equals(codeString))
+      return V3ActCode.R;
+    if ("X".equals(codeString))
+      return V3ActCode.X;
+    if ("_ActControlVariable".equals(codeString))
+      return V3ActCode._ACTCONTROLVARIABLE;
+    if ("AUTO".equals(codeString))
+      return V3ActCode.AUTO;
+    if ("ENDC".equals(codeString))
+      return V3ActCode.ENDC;
+    if ("REFLEX".equals(codeString))
+      return V3ActCode.REFLEX;
+    if ("_ActCoverageConfirmationCode".equals(codeString))
+      return V3ActCode._ACTCOVERAGECONFIRMATIONCODE;
+    if ("_ActCoverageAuthorizationConfirmationCode".equals(codeString))
+      return V3ActCode._ACTCOVERAGEAUTHORIZATIONCONFIRMATIONCODE;
+    if ("AUTH".equals(codeString))
+      return V3ActCode.AUTH;
+    if ("NAUTH".equals(codeString))
+      return V3ActCode.NAUTH;
+    if ("_ActCoverageEligibilityConfirmationCode".equals(codeString))
+      return V3ActCode._ACTCOVERAGEELIGIBILITYCONFIRMATIONCODE;
+    if ("ELG".equals(codeString))
+      return V3ActCode.ELG;
+    if ("NELG".equals(codeString))
+      return V3ActCode.NELG;
+    if ("_ActCoverageLimitCode".equals(codeString))
+      return V3ActCode._ACTCOVERAGELIMITCODE;
+    if ("_ActCoverageQuantityLimitCode".equals(codeString))
+      return V3ActCode._ACTCOVERAGEQUANTITYLIMITCODE;
+    if ("COVPRD".equals(codeString))
+      return V3ActCode.COVPRD;
+    if ("LFEMX".equals(codeString))
+      return V3ActCode.LFEMX;
+    if ("NETAMT".equals(codeString))
+      return V3ActCode.NETAMT;
+    if ("PRDMX".equals(codeString))
+      return V3ActCode.PRDMX;
+    if ("UNITPRICE".equals(codeString))
+      return V3ActCode.UNITPRICE;
+    if ("UNITQTY".equals(codeString))
+      return V3ActCode.UNITQTY;
+    if ("COVMX".equals(codeString))
+      return V3ActCode.COVMX;
+    if ("_ActCoveredPartyLimitCode".equals(codeString))
+      return V3ActCode._ACTCOVEREDPARTYLIMITCODE;
+    if ("_ActCoverageTypeCode".equals(codeString))
+      return V3ActCode._ACTCOVERAGETYPECODE;
+    if ("_ActInsurancePolicyCode".equals(codeString))
+      return V3ActCode._ACTINSURANCEPOLICYCODE;
+    if ("EHCPOL".equals(codeString))
+      return V3ActCode.EHCPOL;
+    if ("HSAPOL".equals(codeString))
+      return V3ActCode.HSAPOL;
+    if ("AUTOPOL".equals(codeString))
+      return V3ActCode.AUTOPOL;
+    if ("COL".equals(codeString))
+      return V3ActCode.COL;
+    if ("UNINSMOT".equals(codeString))
+      return V3ActCode.UNINSMOT;
+    if ("PUBLICPOL".equals(codeString))
+      return V3ActCode.PUBLICPOL;
+    if ("DENTPRG".equals(codeString))
+      return V3ActCode.DENTPRG;
+    if ("DISEASEPRG".equals(codeString))
+      return V3ActCode.DISEASEPRG;
+    if ("CANPRG".equals(codeString))
+      return V3ActCode.CANPRG;
+    if ("ENDRENAL".equals(codeString))
+      return V3ActCode.ENDRENAL;
+    if ("HIVAIDS".equals(codeString))
+      return V3ActCode.HIVAIDS;
+    if ("MANDPOL".equals(codeString))
+      return V3ActCode.MANDPOL;
+    if ("MENTPRG".equals(codeString))
+      return V3ActCode.MENTPRG;
+    if ("SAFNET".equals(codeString))
+      return V3ActCode.SAFNET;
+    if ("SUBPRG".equals(codeString))
+      return V3ActCode.SUBPRG;
+    if ("SUBSIDIZ".equals(codeString))
+      return V3ActCode.SUBSIDIZ;
+    if ("SUBSIDMC".equals(codeString))
+      return V3ActCode.SUBSIDMC;
+    if ("SUBSUPP".equals(codeString))
+      return V3ActCode.SUBSUPP;
+    if ("WCBPOL".equals(codeString))
+      return V3ActCode.WCBPOL;
+    if ("_ActInsuranceTypeCode".equals(codeString))
+      return V3ActCode._ACTINSURANCETYPECODE;
+    if ("_ActHealthInsuranceTypeCode".equals(codeString))
+      return V3ActCode._ACTHEALTHINSURANCETYPECODE;
+    if ("DENTAL".equals(codeString))
+      return V3ActCode.DENTAL;
+    if ("DISEASE".equals(codeString))
+      return V3ActCode.DISEASE;
+    if ("DRUGPOL".equals(codeString))
+      return V3ActCode.DRUGPOL;
+    if ("HIP".equals(codeString))
+      return V3ActCode.HIP;
+    if ("LTC".equals(codeString))
+      return V3ActCode.LTC;
+    if ("MCPOL".equals(codeString))
+      return V3ActCode.MCPOL;
+    if ("POS".equals(codeString))
+      return V3ActCode.POS;
+    if ("HMO".equals(codeString))
+      return V3ActCode.HMO;
+    if ("PPO".equals(codeString))
+      return V3ActCode.PPO;
+    if ("MENTPOL".equals(codeString))
+      return V3ActCode.MENTPOL;
+    if ("SUBPOL".equals(codeString))
+      return V3ActCode.SUBPOL;
+    if ("VISPOL".equals(codeString))
+      return V3ActCode.VISPOL;
+    if ("DIS".equals(codeString))
+      return V3ActCode.DIS;
+    if ("EWB".equals(codeString))
+      return V3ActCode.EWB;
+    if ("FLEXP".equals(codeString))
+      return V3ActCode.FLEXP;
+    if ("LIFE".equals(codeString))
+      return V3ActCode.LIFE;
+    if ("ANNU".equals(codeString))
+      return V3ActCode.ANNU;
+    if ("TLIFE".equals(codeString))
+      return V3ActCode.TLIFE;
+    if ("ULIFE".equals(codeString))
+      return V3ActCode.ULIFE;
+    if ("PNC".equals(codeString))
+      return V3ActCode.PNC;
+    if ("REI".equals(codeString))
+      return V3ActCode.REI;
+    if ("SURPL".equals(codeString))
+      return V3ActCode.SURPL;
+    if ("UMBRL".equals(codeString))
+      return V3ActCode.UMBRL;
+    if ("_ActProgramTypeCode".equals(codeString))
+      return V3ActCode._ACTPROGRAMTYPECODE;
+    if ("CHAR".equals(codeString))
+      return V3ActCode.CHAR;
+    if ("CRIME".equals(codeString))
+      return V3ActCode.CRIME;
+    if ("EAP".equals(codeString))
+      return V3ActCode.EAP;
+    if ("GOVEMP".equals(codeString))
+      return V3ActCode.GOVEMP;
+    if ("HIRISK".equals(codeString))
+      return V3ActCode.HIRISK;
+    if ("IND".equals(codeString))
+      return V3ActCode.IND;
+    if ("MILITARY".equals(codeString))
+      return V3ActCode.MILITARY;
+    if ("RETIRE".equals(codeString))
+      return V3ActCode.RETIRE;
+    if ("SOCIAL".equals(codeString))
+      return V3ActCode.SOCIAL;
+    if ("VET".equals(codeString))
+      return V3ActCode.VET;
+    if ("_ActDetectedIssueManagementCode".equals(codeString))
+      return V3ActCode._ACTDETECTEDISSUEMANAGEMENTCODE;
+    if ("_ActAdministrativeDetectedIssueManagementCode".equals(codeString))
+      return V3ActCode._ACTADMINISTRATIVEDETECTEDISSUEMANAGEMENTCODE;
+    if ("_AuthorizationIssueManagementCode".equals(codeString))
+      return V3ActCode._AUTHORIZATIONISSUEMANAGEMENTCODE;
+    if ("EMAUTH".equals(codeString))
+      return V3ActCode.EMAUTH;
+    if ("21".equals(codeString))
+      return V3ActCode._21;
+    if ("1".equals(codeString))
+      return V3ActCode._1;
+    if ("19".equals(codeString))
+      return V3ActCode._19;
+    if ("2".equals(codeString))
+      return V3ActCode._2;
+    if ("22".equals(codeString))
+      return V3ActCode._22;
+    if ("23".equals(codeString))
+      return V3ActCode._23;
+    if ("3".equals(codeString))
+      return V3ActCode._3;
+    if ("4".equals(codeString))
+      return V3ActCode._4;
+    if ("5".equals(codeString))
+      return V3ActCode._5;
+    if ("6".equals(codeString))
+      return V3ActCode._6;
+    if ("7".equals(codeString))
+      return V3ActCode._7;
+    if ("14".equals(codeString))
+      return V3ActCode._14;
+    if ("15".equals(codeString))
+      return V3ActCode._15;
+    if ("16".equals(codeString))
+      return V3ActCode._16;
+    if ("17".equals(codeString))
+      return V3ActCode._17;
+    if ("18".equals(codeString))
+      return V3ActCode._18;
+    if ("20".equals(codeString))
+      return V3ActCode._20;
+    if ("8".equals(codeString))
+      return V3ActCode._8;
+    if ("10".equals(codeString))
+      return V3ActCode._10;
+    if ("11".equals(codeString))
+      return V3ActCode._11;
+    if ("12".equals(codeString))
+      return V3ActCode._12;
+    if ("13".equals(codeString))
+      return V3ActCode._13;
+    if ("9".equals(codeString))
+      return V3ActCode._9;
+    if ("_ActExposureCode".equals(codeString))
+      return V3ActCode._ACTEXPOSURECODE;
+    if ("CHLDCARE".equals(codeString))
+      return V3ActCode.CHLDCARE;
+    if ("CONVEYNC".equals(codeString))
+      return V3ActCode.CONVEYNC;
+    if ("HLTHCARE".equals(codeString))
+      return V3ActCode.HLTHCARE;
+    if ("HOMECARE".equals(codeString))
+      return V3ActCode.HOMECARE;
+    if ("HOSPPTNT".equals(codeString))
+      return V3ActCode.HOSPPTNT;
+    if ("HOSPVSTR".equals(codeString))
+      return V3ActCode.HOSPVSTR;
+    if ("HOUSEHLD".equals(codeString))
+      return V3ActCode.HOUSEHLD;
+    if ("INMATE".equals(codeString))
+      return V3ActCode.INMATE;
+    if ("INTIMATE".equals(codeString))
+      return V3ActCode.INTIMATE;
+    if ("LTRMCARE".equals(codeString))
+      return V3ActCode.LTRMCARE;
+    if ("PLACE".equals(codeString))
+      return V3ActCode.PLACE;
+    if ("PTNTCARE".equals(codeString))
+      return V3ActCode.PTNTCARE;
+    if ("SCHOOL2".equals(codeString))
+      return V3ActCode.SCHOOL2;
+    if ("SOCIAL2".equals(codeString))
+      return V3ActCode.SOCIAL2;
+    if ("SUBSTNCE".equals(codeString))
+      return V3ActCode.SUBSTNCE;
+    if ("TRAVINT".equals(codeString))
+      return V3ActCode.TRAVINT;
+    if ("WORK2".equals(codeString))
+      return V3ActCode.WORK2;
+    if ("_ActFinancialTransactionCode".equals(codeString))
+      return V3ActCode._ACTFINANCIALTRANSACTIONCODE;
+    if ("CHRG".equals(codeString))
+      return V3ActCode.CHRG;
+    if ("REV".equals(codeString))
+      return V3ActCode.REV;
+    if ("_ActIncidentCode".equals(codeString))
+      return V3ActCode._ACTINCIDENTCODE;
+    if ("MVA".equals(codeString))
+      return V3ActCode.MVA;
+    if ("SCHOOL".equals(codeString))
+      return V3ActCode.SCHOOL;
+    if ("SPT".equals(codeString))
+      return V3ActCode.SPT;
+    if ("WPA".equals(codeString))
+      return V3ActCode.WPA;
+    if ("_ActInformationAccessCode".equals(codeString))
+      return V3ActCode._ACTINFORMATIONACCESSCODE;
+    if ("ACADR".equals(codeString))
+      return V3ActCode.ACADR;
+    if ("ACALL".equals(codeString))
+      return V3ActCode.ACALL;
+    if ("ACALLG".equals(codeString))
+      return V3ActCode.ACALLG;
+    if ("ACCONS".equals(codeString))
+      return V3ActCode.ACCONS;
+    if ("ACDEMO".equals(codeString))
+      return V3ActCode.ACDEMO;
+    if ("ACDI".equals(codeString))
+      return V3ActCode.ACDI;
+    if ("ACIMMUN".equals(codeString))
+      return V3ActCode.ACIMMUN;
+    if ("ACLAB".equals(codeString))
+      return V3ActCode.ACLAB;
+    if ("ACMED".equals(codeString))
+      return V3ActCode.ACMED;
+    if ("ACMEDC".equals(codeString))
+      return V3ActCode.ACMEDC;
+    if ("ACMEN".equals(codeString))
+      return V3ActCode.ACMEN;
+    if ("ACOBS".equals(codeString))
+      return V3ActCode.ACOBS;
+    if ("ACPOLPRG".equals(codeString))
+      return V3ActCode.ACPOLPRG;
+    if ("ACPROV".equals(codeString))
+      return V3ActCode.ACPROV;
+    if ("ACPSERV".equals(codeString))
+      return V3ActCode.ACPSERV;
+    if ("ACSUBSTAB".equals(codeString))
+      return V3ActCode.ACSUBSTAB;
+    if ("_ActInformationAccessContextCode".equals(codeString))
+      return V3ActCode._ACTINFORMATIONACCESSCONTEXTCODE;
+    if ("INFAUT".equals(codeString))
+      return V3ActCode.INFAUT;
+    if ("INFCON".equals(codeString))
+      return V3ActCode.INFCON;
+    if ("INFCRT".equals(codeString))
+      return V3ActCode.INFCRT;
+    if ("INFDNG".equals(codeString))
+      return V3ActCode.INFDNG;
+    if ("INFEMER".equals(codeString))
+      return V3ActCode.INFEMER;
+    if ("INFPWR".equals(codeString))
+      return V3ActCode.INFPWR;
+    if ("INFREG".equals(codeString))
+      return V3ActCode.INFREG;
+    if ("_ActInformationCategoryCode".equals(codeString))
+      return V3ActCode._ACTINFORMATIONCATEGORYCODE;
+    if ("ALLCAT".equals(codeString))
+      return V3ActCode.ALLCAT;
+    if ("ALLGCAT".equals(codeString))
+      return V3ActCode.ALLGCAT;
+    if ("ARCAT".equals(codeString))
+      return V3ActCode.ARCAT;
+    if ("COBSCAT".equals(codeString))
+      return V3ActCode.COBSCAT;
+    if ("DEMOCAT".equals(codeString))
+      return V3ActCode.DEMOCAT;
+    if ("DICAT".equals(codeString))
+      return V3ActCode.DICAT;
+    if ("IMMUCAT".equals(codeString))
+      return V3ActCode.IMMUCAT;
+    if ("LABCAT".equals(codeString))
+      return V3ActCode.LABCAT;
+    if ("MEDCCAT".equals(codeString))
+      return V3ActCode.MEDCCAT;
+    if ("MENCAT".equals(codeString))
+      return V3ActCode.MENCAT;
+    if ("PSVCCAT".equals(codeString))
+      return V3ActCode.PSVCCAT;
+    if ("RXCAT".equals(codeString))
+      return V3ActCode.RXCAT;
+    if ("_ActInvoiceElementCode".equals(codeString))
+      return V3ActCode._ACTINVOICEELEMENTCODE;
+    if ("_ActInvoiceAdjudicationPaymentCode".equals(codeString))
+      return V3ActCode._ACTINVOICEADJUDICATIONPAYMENTCODE;
+    if ("_ActInvoiceAdjudicationPaymentGroupCode".equals(codeString))
+      return V3ActCode._ACTINVOICEADJUDICATIONPAYMENTGROUPCODE;
+    if ("ALEC".equals(codeString))
+      return V3ActCode.ALEC;
+    if ("BONUS".equals(codeString))
+      return V3ActCode.BONUS;
+    if ("CFWD".equals(codeString))
+      return V3ActCode.CFWD;
+    if ("EDU".equals(codeString))
+      return V3ActCode.EDU;
+    if ("EPYMT".equals(codeString))
+      return V3ActCode.EPYMT;
+    if ("GARN".equals(codeString))
+      return V3ActCode.GARN;
+    if ("INVOICE".equals(codeString))
+      return V3ActCode.INVOICE;
+    if ("PINV".equals(codeString))
+      return V3ActCode.PINV;
+    if ("PPRD".equals(codeString))
+      return V3ActCode.PPRD;
+    if ("PROA".equals(codeString))
+      return V3ActCode.PROA;
+    if ("RECOV".equals(codeString))
+      return V3ActCode.RECOV;
+    if ("RETRO".equals(codeString))
+      return V3ActCode.RETRO;
+    if ("TRAN".equals(codeString))
+      return V3ActCode.TRAN;
+    if ("_ActInvoiceAdjudicationPaymentSummaryCode".equals(codeString))
+      return V3ActCode._ACTINVOICEADJUDICATIONPAYMENTSUMMARYCODE;
+    if ("INVTYPE".equals(codeString))
+      return V3ActCode.INVTYPE;
+    if ("PAYEE".equals(codeString))
+      return V3ActCode.PAYEE;
+    if ("PAYOR".equals(codeString))
+      return V3ActCode.PAYOR;
+    if ("SENDAPP".equals(codeString))
+      return V3ActCode.SENDAPP;
+    if ("_ActInvoiceDetailCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILCODE;
+    if ("_ActInvoiceDetailClinicalProductCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILCLINICALPRODUCTCODE;
+    if ("UNSPSC".equals(codeString))
+      return V3ActCode.UNSPSC;
+    if ("_ActInvoiceDetailDrugProductCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILDRUGPRODUCTCODE;
+    if ("GTIN".equals(codeString))
+      return V3ActCode.GTIN;
+    if ("UPC".equals(codeString))
+      return V3ActCode.UPC;
+    if ("_ActInvoiceDetailGenericCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILGENERICCODE;
+    if ("_ActInvoiceDetailGenericAdjudicatorCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILGENERICADJUDICATORCODE;
+    if ("COIN".equals(codeString))
+      return V3ActCode.COIN;
+    if ("COPAYMENT".equals(codeString))
+      return V3ActCode.COPAYMENT;
+    if ("DEDUCTIBLE".equals(codeString))
+      return V3ActCode.DEDUCTIBLE;
+    if ("PAY".equals(codeString))
+      return V3ActCode.PAY;
+    if ("SPEND".equals(codeString))
+      return V3ActCode.SPEND;
+    if ("COINS".equals(codeString))
+      return V3ActCode.COINS;
+    if ("_ActInvoiceDetailGenericModifierCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILGENERICMODIFIERCODE;
+    if ("AFTHRS".equals(codeString))
+      return V3ActCode.AFTHRS;
+    if ("ISOL".equals(codeString))
+      return V3ActCode.ISOL;
+    if ("OOO".equals(codeString))
+      return V3ActCode.OOO;
+    if ("_ActInvoiceDetailGenericProviderCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILGENERICPROVIDERCODE;
+    if ("CANCAPT".equals(codeString))
+      return V3ActCode.CANCAPT;
+    if ("DSC".equals(codeString))
+      return V3ActCode.DSC;
+    if ("ESA".equals(codeString))
+      return V3ActCode.ESA;
+    if ("FFSTOP".equals(codeString))
+      return V3ActCode.FFSTOP;
+    if ("FNLFEE".equals(codeString))
+      return V3ActCode.FNLFEE;
+    if ("FRSTFEE".equals(codeString))
+      return V3ActCode.FRSTFEE;
+    if ("MARKUP".equals(codeString))
+      return V3ActCode.MARKUP;
+    if ("MISSAPT".equals(codeString))
+      return V3ActCode.MISSAPT;
+    if ("PERFEE".equals(codeString))
+      return V3ActCode.PERFEE;
+    if ("PERMBNS".equals(codeString))
+      return V3ActCode.PERMBNS;
+    if ("RESTOCK".equals(codeString))
+      return V3ActCode.RESTOCK;
+    if ("TRAVEL".equals(codeString))
+      return V3ActCode.TRAVEL;
+    if ("URGENT".equals(codeString))
+      return V3ActCode.URGENT;
+    if ("_ActInvoiceDetailTaxCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILTAXCODE;
+    if ("FST".equals(codeString))
+      return V3ActCode.FST;
+    if ("HST".equals(codeString))
+      return V3ActCode.HST;
+    if ("PST".equals(codeString))
+      return V3ActCode.PST;
+    if ("_ActInvoiceDetailPreferredAccommodationCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILPREFERREDACCOMMODATIONCODE;
+    if ("_ActEncounterAccommodationCode".equals(codeString))
+      return V3ActCode._ACTENCOUNTERACCOMMODATIONCODE;
+    if ("_HL7AccommodationCode".equals(codeString))
+      return V3ActCode._HL7ACCOMMODATIONCODE;
+    if ("I".equals(codeString))
+      return V3ActCode.I;
+    if ("P".equals(codeString))
+      return V3ActCode.P;
+    if ("S".equals(codeString))
+      return V3ActCode.S;
+    if ("SP".equals(codeString))
+      return V3ActCode.SP;
+    if ("W".equals(codeString))
+      return V3ActCode.W;
+    if ("_ActInvoiceDetailClinicalServiceCode".equals(codeString))
+      return V3ActCode._ACTINVOICEDETAILCLINICALSERVICECODE;
+    if ("_ActInvoiceGroupCode".equals(codeString))
+      return V3ActCode._ACTINVOICEGROUPCODE;
+    if ("_ActInvoiceInterGroupCode".equals(codeString))
+      return V3ActCode._ACTINVOICEINTERGROUPCODE;
+    if ("CPNDDRGING".equals(codeString))
+      return V3ActCode.CPNDDRGING;
+    if ("CPNDINDING".equals(codeString))
+      return V3ActCode.CPNDINDING;
+    if ("CPNDSUPING".equals(codeString))
+      return V3ActCode.CPNDSUPING;
+    if ("DRUGING".equals(codeString))
+      return V3ActCode.DRUGING;
+    if ("FRAMEING".equals(codeString))
+      return V3ActCode.FRAMEING;
+    if ("LENSING".equals(codeString))
+      return V3ActCode.LENSING;
+    if ("PRDING".equals(codeString))
+      return V3ActCode.PRDING;
+    if ("_ActInvoiceRootGroupCode".equals(codeString))
+      return V3ActCode._ACTINVOICEROOTGROUPCODE;
+    if ("CPINV".equals(codeString))
+      return V3ActCode.CPINV;
+    if ("CSINV".equals(codeString))
+      return V3ActCode.CSINV;
+    if ("CSPINV".equals(codeString))
+      return V3ActCode.CSPINV;
+    if ("FININV".equals(codeString))
+      return V3ActCode.FININV;
+    if ("OHSINV".equals(codeString))
+      return V3ActCode.OHSINV;
+    if ("PAINV".equals(codeString))
+      return V3ActCode.PAINV;
+    if ("RXCINV".equals(codeString))
+      return V3ActCode.RXCINV;
+    if ("RXDINV".equals(codeString))
+      return V3ActCode.RXDINV;
+    if ("SBFINV".equals(codeString))
+      return V3ActCode.SBFINV;
+    if ("VRXINV".equals(codeString))
+      return V3ActCode.VRXINV;
+    if ("_ActInvoiceElementSummaryCode".equals(codeString))
+      return V3ActCode._ACTINVOICEELEMENTSUMMARYCODE;
+    if ("_InvoiceElementAdjudicated".equals(codeString))
+      return V3ActCode._INVOICEELEMENTADJUDICATED;
+    if ("ADNFPPELAT".equals(codeString))
+      return V3ActCode.ADNFPPELAT;
+    if ("ADNFPPELCT".equals(codeString))
+      return V3ActCode.ADNFPPELCT;
+    if ("ADNFPPMNAT".equals(codeString))
+      return V3ActCode.ADNFPPMNAT;
+    if ("ADNFPPMNCT".equals(codeString))
+      return V3ActCode.ADNFPPMNCT;
+    if ("ADNFSPELAT".equals(codeString))
+      return V3ActCode.ADNFSPELAT;
+    if ("ADNFSPELCT".equals(codeString))
+      return V3ActCode.ADNFSPELCT;
+    if ("ADNFSPMNAT".equals(codeString))
+      return V3ActCode.ADNFSPMNAT;
+    if ("ADNFSPMNCT".equals(codeString))
+      return V3ActCode.ADNFSPMNCT;
+    if ("ADNPPPELAT".equals(codeString))
+      return V3ActCode.ADNPPPELAT;
+    if ("ADNPPPELCT".equals(codeString))
+      return V3ActCode.ADNPPPELCT;
+    if ("ADNPPPMNAT".equals(codeString))
+      return V3ActCode.ADNPPPMNAT;
+    if ("ADNPPPMNCT".equals(codeString))
+      return V3ActCode.ADNPPPMNCT;
+    if ("ADNPSPELAT".equals(codeString))
+      return V3ActCode.ADNPSPELAT;
+    if ("ADNPSPELCT".equals(codeString))
+      return V3ActCode.ADNPSPELCT;
+    if ("ADNPSPMNAT".equals(codeString))
+      return V3ActCode.ADNPSPMNAT;
+    if ("ADNPSPMNCT".equals(codeString))
+      return V3ActCode.ADNPSPMNCT;
+    if ("ADPPPPELAT".equals(codeString))
+      return V3ActCode.ADPPPPELAT;
+    if ("ADPPPPELCT".equals(codeString))
+      return V3ActCode.ADPPPPELCT;
+    if ("ADPPPPMNAT".equals(codeString))
+      return V3ActCode.ADPPPPMNAT;
+    if ("ADPPPPMNCT".equals(codeString))
+      return V3ActCode.ADPPPPMNCT;
+    if ("ADPPSPELAT".equals(codeString))
+      return V3ActCode.ADPPSPELAT;
+    if ("ADPPSPELCT".equals(codeString))
+      return V3ActCode.ADPPSPELCT;
+    if ("ADPPSPMNAT".equals(codeString))
+      return V3ActCode.ADPPSPMNAT;
+    if ("ADPPSPMNCT".equals(codeString))
+      return V3ActCode.ADPPSPMNCT;
+    if ("ADRFPPELAT".equals(codeString))
+      return V3ActCode.ADRFPPELAT;
+    if ("ADRFPPELCT".equals(codeString))
+      return V3ActCode.ADRFPPELCT;
+    if ("ADRFPPMNAT".equals(codeString))
+      return V3ActCode.ADRFPPMNAT;
+    if ("ADRFPPMNCT".equals(codeString))
+      return V3ActCode.ADRFPPMNCT;
+    if ("ADRFSPELAT".equals(codeString))
+      return V3ActCode.ADRFSPELAT;
+    if ("ADRFSPELCT".equals(codeString))
+      return V3ActCode.ADRFSPELCT;
+    if ("ADRFSPMNAT".equals(codeString))
+      return V3ActCode.ADRFSPMNAT;
+    if ("ADRFSPMNCT".equals(codeString))
+      return V3ActCode.ADRFSPMNCT;
+    if ("_InvoiceElementPaid".equals(codeString))
+      return V3ActCode._INVOICEELEMENTPAID;
+    if ("PDNFPPELAT".equals(codeString))
+      return V3ActCode.PDNFPPELAT;
+    if ("PDNFPPELCT".equals(codeString))
+      return V3ActCode.PDNFPPELCT;
+    if ("PDNFPPMNAT".equals(codeString))
+      return V3ActCode.PDNFPPMNAT;
+    if ("PDNFPPMNCT".equals(codeString))
+      return V3ActCode.PDNFPPMNCT;
+    if ("PDNFSPELAT".equals(codeString))
+      return V3ActCode.PDNFSPELAT;
+    if ("PDNFSPELCT".equals(codeString))
+      return V3ActCode.PDNFSPELCT;
+    if ("PDNFSPMNAT".equals(codeString))
+      return V3ActCode.PDNFSPMNAT;
+    if ("PDNFSPMNCT".equals(codeString))
+      return V3ActCode.PDNFSPMNCT;
+    if ("PDNPPPELAT".equals(codeString))
+      return V3ActCode.PDNPPPELAT;
+    if ("PDNPPPELCT".equals(codeString))
+      return V3ActCode.PDNPPPELCT;
+    if ("PDNPPPMNAT".equals(codeString))
+      return V3ActCode.PDNPPPMNAT;
+    if ("PDNPPPMNCT".equals(codeString))
+      return V3ActCode.PDNPPPMNCT;
+    if ("PDNPSPELAT".equals(codeString))
+      return V3ActCode.PDNPSPELAT;
+    if ("PDNPSPELCT".equals(codeString))
+      return V3ActCode.PDNPSPELCT;
+    if ("PDNPSPMNAT".equals(codeString))
+      return V3ActCode.PDNPSPMNAT;
+    if ("PDNPSPMNCT".equals(codeString))
+      return V3ActCode.PDNPSPMNCT;
+    if ("PDPPPPELAT".equals(codeString))
+      return V3ActCode.PDPPPPELAT;
+    if ("PDPPPPELCT".equals(codeString))
+      return V3ActCode.PDPPPPELCT;
+    if ("PDPPPPMNAT".equals(codeString))
+      return V3ActCode.PDPPPPMNAT;
+    if ("PDPPPPMNCT".equals(codeString))
+      return V3ActCode.PDPPPPMNCT;
+    if ("PDPPSPELAT".equals(codeString))
+      return V3ActCode.PDPPSPELAT;
+    if ("PDPPSPELCT".equals(codeString))
+      return V3ActCode.PDPPSPELCT;
+    if ("PDPPSPMNAT".equals(codeString))
+      return V3ActCode.PDPPSPMNAT;
+    if ("PDPPSPMNCT".equals(codeString))
+      return V3ActCode.PDPPSPMNCT;
+    if ("_InvoiceElementSubmitted".equals(codeString))
+      return V3ActCode._INVOICEELEMENTSUBMITTED;
+    if ("SBBLELAT".equals(codeString))
+      return V3ActCode.SBBLELAT;
+    if ("SBBLELCT".equals(codeString))
+      return V3ActCode.SBBLELCT;
+    if ("SBNFELAT".equals(codeString))
+      return V3ActCode.SBNFELAT;
+    if ("SBNFELCT".equals(codeString))
+      return V3ActCode.SBNFELCT;
+    if ("SBPDELAT".equals(codeString))
+      return V3ActCode.SBPDELAT;
+    if ("SBPDELCT".equals(codeString))
+      return V3ActCode.SBPDELCT;
+    if ("_ActInvoiceOverrideCode".equals(codeString))
+      return V3ActCode._ACTINVOICEOVERRIDECODE;
+    if ("COVGE".equals(codeString))
+      return V3ActCode.COVGE;
+    if ("EFORM".equals(codeString))
+      return V3ActCode.EFORM;
+    if ("FAX".equals(codeString))
+      return V3ActCode.FAX;
+    if ("GFTH".equals(codeString))
+      return V3ActCode.GFTH;
+    if ("LATE".equals(codeString))
+      return V3ActCode.LATE;
+    if ("MANUAL".equals(codeString))
+      return V3ActCode.MANUAL;
+    if ("OOJ".equals(codeString))
+      return V3ActCode.OOJ;
+    if ("ORTHO".equals(codeString))
+      return V3ActCode.ORTHO;
+    if ("PAPER".equals(codeString))
+      return V3ActCode.PAPER;
+    if ("PIE".equals(codeString))
+      return V3ActCode.PIE;
+    if ("PYRDELAY".equals(codeString))
+      return V3ActCode.PYRDELAY;
+    if ("REFNR".equals(codeString))
+      return V3ActCode.REFNR;
+    if ("REPSERV".equals(codeString))
+      return V3ActCode.REPSERV;
+    if ("UNRELAT".equals(codeString))
+      return V3ActCode.UNRELAT;
+    if ("VERBAUTH".equals(codeString))
+      return V3ActCode.VERBAUTH;
+    if ("_ActListCode".equals(codeString))
+      return V3ActCode._ACTLISTCODE;
+    if ("_ActObservationList".equals(codeString))
+      return V3ActCode._ACTOBSERVATIONLIST;
+    if ("CARELIST".equals(codeString))
+      return V3ActCode.CARELIST;
+    if ("CONDLIST".equals(codeString))
+      return V3ActCode.CONDLIST;
+    if ("INTOLIST".equals(codeString))
+      return V3ActCode.INTOLIST;
+    if ("PROBLIST".equals(codeString))
+      return V3ActCode.PROBLIST;
+    if ("RISKLIST".equals(codeString))
+      return V3ActCode.RISKLIST;
+    if ("GOALLIST".equals(codeString))
+      return V3ActCode.GOALLIST;
+    if ("_ActTherapyDurationWorkingListCode".equals(codeString))
+      return V3ActCode._ACTTHERAPYDURATIONWORKINGLISTCODE;
+    if ("_ActMedicationTherapyDurationWorkingListCode".equals(codeString))
+      return V3ActCode._ACTMEDICATIONTHERAPYDURATIONWORKINGLISTCODE;
+    if ("ACU".equals(codeString))
+      return V3ActCode.ACU;
+    if ("CHRON".equals(codeString))
+      return V3ActCode.CHRON;
+    if ("ONET".equals(codeString))
+      return V3ActCode.ONET;
+    if ("PRN".equals(codeString))
+      return V3ActCode.PRN;
+    if ("MEDLIST".equals(codeString))
+      return V3ActCode.MEDLIST;
+    if ("CURMEDLIST".equals(codeString))
+      return V3ActCode.CURMEDLIST;
+    if ("DISCMEDLIST".equals(codeString))
+      return V3ActCode.DISCMEDLIST;
+    if ("HISTMEDLIST".equals(codeString))
+      return V3ActCode.HISTMEDLIST;
+    if ("_ActMonitoringProtocolCode".equals(codeString))
+      return V3ActCode._ACTMONITORINGPROTOCOLCODE;
+    if ("CTLSUB".equals(codeString))
+      return V3ActCode.CTLSUB;
+    if ("INV".equals(codeString))
+      return V3ActCode.INV;
+    if ("LU".equals(codeString))
+      return V3ActCode.LU;
+    if ("OTC".equals(codeString))
+      return V3ActCode.OTC;
+    if ("RX".equals(codeString))
+      return V3ActCode.RX;
+    if ("SA".equals(codeString))
+      return V3ActCode.SA;
+    if ("SAC".equals(codeString))
+      return V3ActCode.SAC;
+    if ("_ActNonObservationIndicationCode".equals(codeString))
+      return V3ActCode._ACTNONOBSERVATIONINDICATIONCODE;
+    if ("IND01".equals(codeString))
+      return V3ActCode.IND01;
+    if ("IND02".equals(codeString))
+      return V3ActCode.IND02;
+    if ("IND03".equals(codeString))
+      return V3ActCode.IND03;
+    if ("IND04".equals(codeString))
+      return V3ActCode.IND04;
+    if ("IND05".equals(codeString))
+      return V3ActCode.IND05;
+    if ("_ActObservationVerificationType".equals(codeString))
+      return V3ActCode._ACTOBSERVATIONVERIFICATIONTYPE;
+    if ("VFPAPER".equals(codeString))
+      return V3ActCode.VFPAPER;
+    if ("_ActPaymentCode".equals(codeString))
+      return V3ActCode._ACTPAYMENTCODE;
+    if ("ACH".equals(codeString))
+      return V3ActCode.ACH;
+    if ("CHK".equals(codeString))
+      return V3ActCode.CHK;
+    if ("DDP".equals(codeString))
+      return V3ActCode.DDP;
+    if ("NON".equals(codeString))
+      return V3ActCode.NON;
+    if ("_ActPharmacySupplyType".equals(codeString))
+      return V3ActCode._ACTPHARMACYSUPPLYTYPE;
+    if ("DF".equals(codeString))
+      return V3ActCode.DF;
+    if ("EM".equals(codeString))
+      return V3ActCode.EM;
+    if ("SO".equals(codeString))
+      return V3ActCode.SO;
+    if ("FF".equals(codeString))
+      return V3ActCode.FF;
+    if ("FFC".equals(codeString))
+      return V3ActCode.FFC;
+    if ("FFP".equals(codeString))
+      return V3ActCode.FFP;
+    if ("FFSS".equals(codeString))
+      return V3ActCode.FFSS;
+    if ("TF".equals(codeString))
+      return V3ActCode.TF;
+    if ("FS".equals(codeString))
+      return V3ActCode.FS;
+    if ("MS".equals(codeString))
+      return V3ActCode.MS;
+    if ("RF".equals(codeString))
+      return V3ActCode.RF;
+    if ("UD".equals(codeString))
+      return V3ActCode.UD;
+    if ("RFC".equals(codeString))
+      return V3ActCode.RFC;
+    if ("RFCS".equals(codeString))
+      return V3ActCode.RFCS;
+    if ("RFF".equals(codeString))
+      return V3ActCode.RFF;
+    if ("RFFS".equals(codeString))
+      return V3ActCode.RFFS;
+    if ("RFP".equals(codeString))
+      return V3ActCode.RFP;
+    if ("RFPS".equals(codeString))
+      return V3ActCode.RFPS;
+    if ("RFS".equals(codeString))
+      return V3ActCode.RFS;
+    if ("TB".equals(codeString))
+      return V3ActCode.TB;
+    if ("TBS".equals(codeString))
+      return V3ActCode.TBS;
+    if ("UDE".equals(codeString))
+      return V3ActCode.UDE;
+    if ("_ActPolicyType".equals(codeString))
+      return V3ActCode._ACTPOLICYTYPE;
+    if ("_ActPrivacyPolicy".equals(codeString))
+      return V3ActCode._ACTPRIVACYPOLICY;
+    if ("_ActConsentDirective".equals(codeString))
+      return V3ActCode._ACTCONSENTDIRECTIVE;
+    if ("EMRGONLY".equals(codeString))
+      return V3ActCode.EMRGONLY;
+    if ("GRANTORCHOICE".equals(codeString))
+      return V3ActCode.GRANTORCHOICE;
+    if ("IMPLIED".equals(codeString))
+      return V3ActCode.IMPLIED;
+    if ("IMPLIEDD".equals(codeString))
+      return V3ActCode.IMPLIEDD;
+    if ("NOCONSENT".equals(codeString))
+      return V3ActCode.NOCONSENT;
+    if ("NOPP".equals(codeString))
+      return V3ActCode.NOPP;
+    if ("OPTIN".equals(codeString))
+      return V3ActCode.OPTIN;
+    if ("OPTINR".equals(codeString))
+      return V3ActCode.OPTINR;
+    if ("OPTOUT".equals(codeString))
+      return V3ActCode.OPTOUT;
+    if ("OPTOUTE".equals(codeString))
+      return V3ActCode.OPTOUTE;
+    if ("_ActPrivacyLaw".equals(codeString))
+      return V3ActCode._ACTPRIVACYLAW;
+    if ("_ActUSPrivacyLaw".equals(codeString))
+      return V3ActCode._ACTUSPRIVACYLAW;
+    if ("42CFRPart2".equals(codeString))
+      return V3ActCode._42CFRPART2;
+    if ("CommonRule".equals(codeString))
+      return V3ActCode.COMMONRULE;
+    if ("HIPAANOPP".equals(codeString))
+      return V3ActCode.HIPAANOPP;
+    if ("HIPAAPsyNotes".equals(codeString))
+      return V3ActCode.HIPAAPSYNOTES;
+    if ("HIPAASelfPay".equals(codeString))
+      return V3ActCode.HIPAASELFPAY;
+    if ("Title38Section7332".equals(codeString))
+      return V3ActCode.TITLE38SECTION7332;
+    if ("_InformationSensitivityPolicy".equals(codeString))
+      return V3ActCode._INFORMATIONSENSITIVITYPOLICY;
+    if ("_ActInformationSensitivityPolicy".equals(codeString))
+      return V3ActCode._ACTINFORMATIONSENSITIVITYPOLICY;
+    if ("ETH".equals(codeString))
+      return V3ActCode.ETH;
+    if ("GDIS".equals(codeString))
+      return V3ActCode.GDIS;
+    if ("HIV".equals(codeString))
+      return V3ActCode.HIV;
+    if ("PSY".equals(codeString))
+      return V3ActCode.PSY;
+    if ("SCA".equals(codeString))
+      return V3ActCode.SCA;
+    if ("SOC".equals(codeString))
+      return V3ActCode.SOC;
+    if ("SDV".equals(codeString))
+      return V3ActCode.SDV;
+    if ("SEX".equals(codeString))
+      return V3ActCode.SEX;
+    if ("STD".equals(codeString))
+      return V3ActCode.STD;
+    if ("TBOO".equals(codeString))
+      return V3ActCode.TBOO;
+    if ("SICKLE".equals(codeString))
+      return V3ActCode.SICKLE;
+    if ("_EntitySensitivityPolicyType".equals(codeString))
+      return V3ActCode._ENTITYSENSITIVITYPOLICYTYPE;
+    if ("DEMO".equals(codeString))
+      return V3ActCode.DEMO;
+    if ("DOB".equals(codeString))
+      return V3ActCode.DOB;
+    if ("GENDER".equals(codeString))
+      return V3ActCode.GENDER;
+    if ("LIVARG".equals(codeString))
+      return V3ActCode.LIVARG;
+    if ("MARST".equals(codeString))
+      return V3ActCode.MARST;
+    if ("RACE".equals(codeString))
+      return V3ActCode.RACE;
+    if ("REL".equals(codeString))
+      return V3ActCode.REL;
+    if ("_RoleInformationSensitivityPolicy".equals(codeString))
+      return V3ActCode._ROLEINFORMATIONSENSITIVITYPOLICY;
+    if ("B".equals(codeString))
+      return V3ActCode.B;
+    if ("EMPL".equals(codeString))
+      return V3ActCode.EMPL;
+    if ("LOCIS".equals(codeString))
+      return V3ActCode.LOCIS;
+    if ("SSP".equals(codeString))
+      return V3ActCode.SSP;
+    if ("ADOL".equals(codeString))
+      return V3ActCode.ADOL;
+    if ("CEL".equals(codeString))
+      return V3ActCode.CEL;
+    if ("DIA".equals(codeString))
+      return V3ActCode.DIA;
+    if ("DRGIS".equals(codeString))
+      return V3ActCode.DRGIS;
+    if ("EMP".equals(codeString))
+      return V3ActCode.EMP;
+    if ("PDS".equals(codeString))
+      return V3ActCode.PDS;
+    if ("PRS".equals(codeString))
+      return V3ActCode.PRS;
+    if ("COMPT".equals(codeString))
+      return V3ActCode.COMPT;
+    if ("HRCOMPT".equals(codeString))
+      return V3ActCode.HRCOMPT;
+    if ("RESCOMPT".equals(codeString))
+      return V3ActCode.RESCOMPT;
+    if ("RMGTCOMPT".equals(codeString))
+      return V3ActCode.RMGTCOMPT;
+    if ("ActTrustPolicyType".equals(codeString))
+      return V3ActCode.ACTTRUSTPOLICYTYPE;
+    if ("TRSTACCRD".equals(codeString))
+      return V3ActCode.TRSTACCRD;
+    if ("TRSTAGRE".equals(codeString))
+      return V3ActCode.TRSTAGRE;
+    if ("TRSTASSUR".equals(codeString))
+      return V3ActCode.TRSTASSUR;
+    if ("TRSTCERT".equals(codeString))
+      return V3ActCode.TRSTCERT;
+    if ("TRSTFWK".equals(codeString))
+      return V3ActCode.TRSTFWK;
+    if ("TRSTMEC".equals(codeString))
+      return V3ActCode.TRSTMEC;
+    if ("COVPOL".equals(codeString))
+      return V3ActCode.COVPOL;
+    if ("SecurityPolicy".equals(codeString))
+      return V3ActCode.SECURITYPOLICY;
+    if ("ObligationPolicy".equals(codeString))
+      return V3ActCode.OBLIGATIONPOLICY;
+    if ("ANONY".equals(codeString))
+      return V3ActCode.ANONY;
+    if ("AOD".equals(codeString))
+      return V3ActCode.AOD;
+    if ("AUDIT".equals(codeString))
+      return V3ActCode.AUDIT;
+    if ("AUDTR".equals(codeString))
+      return V3ActCode.AUDTR;
+    if ("CPLYCC".equals(codeString))
+      return V3ActCode.CPLYCC;
+    if ("CPLYCD".equals(codeString))
+      return V3ActCode.CPLYCD;
+    if ("CPLYJPP".equals(codeString))
+      return V3ActCode.CPLYJPP;
+    if ("CPLYOPP".equals(codeString))
+      return V3ActCode.CPLYOPP;
+    if ("CPLYOSP".equals(codeString))
+      return V3ActCode.CPLYOSP;
+    if ("CPLYPOL".equals(codeString))
+      return V3ActCode.CPLYPOL;
+    if ("DECLASSIFYLABEL".equals(codeString))
+      return V3ActCode.DECLASSIFYLABEL;
+    if ("DEID".equals(codeString))
+      return V3ActCode.DEID;
+    if ("DELAU".equals(codeString))
+      return V3ActCode.DELAU;
+    if ("DOWNGRDLABEL".equals(codeString))
+      return V3ActCode.DOWNGRDLABEL;
+    if ("DRIVLABEL".equals(codeString))
+      return V3ActCode.DRIVLABEL;
+    if ("ENCRYPT".equals(codeString))
+      return V3ActCode.ENCRYPT;
+    if ("ENCRYPTR".equals(codeString))
+      return V3ActCode.ENCRYPTR;
+    if ("ENCRYPTT".equals(codeString))
+      return V3ActCode.ENCRYPTT;
+    if ("ENCRYPTU".equals(codeString))
+      return V3ActCode.ENCRYPTU;
+    if ("HUAPRV".equals(codeString))
+      return V3ActCode.HUAPRV;
+    if ("LABEL".equals(codeString))
+      return V3ActCode.LABEL;
+    if ("MASK".equals(codeString))
+      return V3ActCode.MASK;
+    if ("MINEC".equals(codeString))
+      return V3ActCode.MINEC;
+    if ("PERSISTLABEL".equals(codeString))
+      return V3ActCode.PERSISTLABEL;
+    if ("PRIVMARK".equals(codeString))
+      return V3ActCode.PRIVMARK;
+    if ("PSEUD".equals(codeString))
+      return V3ActCode.PSEUD;
+    if ("REDACT".equals(codeString))
+      return V3ActCode.REDACT;
+    if ("UPGRDLABEL".equals(codeString))
+      return V3ActCode.UPGRDLABEL;
+    if ("RefrainPolicy".equals(codeString))
+      return V3ActCode.REFRAINPOLICY;
+    if ("NOAUTH".equals(codeString))
+      return V3ActCode.NOAUTH;
+    if ("NOCOLLECT".equals(codeString))
+      return V3ActCode.NOCOLLECT;
+    if ("NODSCLCD".equals(codeString))
+      return V3ActCode.NODSCLCD;
+    if ("NODSCLCDS".equals(codeString))
+      return V3ActCode.NODSCLCDS;
+    if ("NOINTEGRATE".equals(codeString))
+      return V3ActCode.NOINTEGRATE;
+    if ("NOLIST".equals(codeString))
+      return V3ActCode.NOLIST;
+    if ("NOMOU".equals(codeString))
+      return V3ActCode.NOMOU;
+    if ("NOORGPOL".equals(codeString))
+      return V3ActCode.NOORGPOL;
+    if ("NOPAT".equals(codeString))
+      return V3ActCode.NOPAT;
+    if ("NOPERSISTP".equals(codeString))
+      return V3ActCode.NOPERSISTP;
+    if ("NORDSCLCD".equals(codeString))
+      return V3ActCode.NORDSCLCD;
+    if ("NORDSCLCDS".equals(codeString))
+      return V3ActCode.NORDSCLCDS;
+    if ("NORDSCLW".equals(codeString))
+      return V3ActCode.NORDSCLW;
+    if ("NORELINK".equals(codeString))
+      return V3ActCode.NORELINK;
+    if ("NOREUSE".equals(codeString))
+      return V3ActCode.NOREUSE;
+    if ("NOVIP".equals(codeString))
+      return V3ActCode.NOVIP;
+    if ("ORCON".equals(codeString))
+      return V3ActCode.ORCON;
+    if ("_ActProductAcquisitionCode".equals(codeString))
+      return V3ActCode._ACTPRODUCTACQUISITIONCODE;
+    if ("LOAN".equals(codeString))
+      return V3ActCode.LOAN;
+    if ("RENT".equals(codeString))
+      return V3ActCode.RENT;
+    if ("TRANSFER".equals(codeString))
+      return V3ActCode.TRANSFER;
+    if ("SALE".equals(codeString))
+      return V3ActCode.SALE;
+    if ("_ActSpecimenTransportCode".equals(codeString))
+      return V3ActCode._ACTSPECIMENTRANSPORTCODE;
+    if ("SREC".equals(codeString))
+      return V3ActCode.SREC;
+    if ("SSTOR".equals(codeString))
+      return V3ActCode.SSTOR;
+    if ("STRAN".equals(codeString))
+      return V3ActCode.STRAN;
+    if ("_ActSpecimenTreatmentCode".equals(codeString))
+      return V3ActCode._ACTSPECIMENTREATMENTCODE;
+    if ("ACID".equals(codeString))
+      return V3ActCode.ACID;
+    if ("ALK".equals(codeString))
+      return V3ActCode.ALK;
+    if ("DEFB".equals(codeString))
+      return V3ActCode.DEFB;
+    if ("FILT".equals(codeString))
+      return V3ActCode.FILT;
+    if ("LDLP".equals(codeString))
+      return V3ActCode.LDLP;
+    if ("NEUT".equals(codeString))
+      return V3ActCode.NEUT;
+    if ("RECA".equals(codeString))
+      return V3ActCode.RECA;
+    if ("UFIL".equals(codeString))
+      return V3ActCode.UFIL;
+    if ("_ActSubstanceAdministrationCode".equals(codeString))
+      return V3ActCode._ACTSUBSTANCEADMINISTRATIONCODE;
+    if ("DRUG".equals(codeString))
+      return V3ActCode.DRUG;
+    if ("FD".equals(codeString))
+      return V3ActCode.FD;
+    if ("IMMUNIZ".equals(codeString))
+      return V3ActCode.IMMUNIZ;
+    if ("BOOSTER".equals(codeString))
+      return V3ActCode.BOOSTER;
+    if ("INITIMMUNIZ".equals(codeString))
+      return V3ActCode.INITIMMUNIZ;
+    if ("_ActTaskCode".equals(codeString))
+      return V3ActCode._ACTTASKCODE;
+    if ("OE".equals(codeString))
+      return V3ActCode.OE;
+    if ("LABOE".equals(codeString))
+      return V3ActCode.LABOE;
+    if ("MEDOE".equals(codeString))
+      return V3ActCode.MEDOE;
+    if ("PATDOC".equals(codeString))
+      return V3ActCode.PATDOC;
+    if ("ALLERLREV".equals(codeString))
+      return V3ActCode.ALLERLREV;
+    if ("CLINNOTEE".equals(codeString))
+      return V3ActCode.CLINNOTEE;
+    if ("DIAGLISTE".equals(codeString))
+      return V3ActCode.DIAGLISTE;
+    if ("DISCHINSTE".equals(codeString))
+      return V3ActCode.DISCHINSTE;
+    if ("DISCHSUME".equals(codeString))
+      return V3ActCode.DISCHSUME;
+    if ("PATEDUE".equals(codeString))
+      return V3ActCode.PATEDUE;
+    if ("PATREPE".equals(codeString))
+      return V3ActCode.PATREPE;
+    if ("PROBLISTE".equals(codeString))
+      return V3ActCode.PROBLISTE;
+    if ("RADREPE".equals(codeString))
+      return V3ActCode.RADREPE;
+    if ("IMMLREV".equals(codeString))
+      return V3ActCode.IMMLREV;
+    if ("REMLREV".equals(codeString))
+      return V3ActCode.REMLREV;
+    if ("WELLREMLREV".equals(codeString))
+      return V3ActCode.WELLREMLREV;
+    if ("PATINFO".equals(codeString))
+      return V3ActCode.PATINFO;
+    if ("ALLERLE".equals(codeString))
+      return V3ActCode.ALLERLE;
+    if ("CDSREV".equals(codeString))
+      return V3ActCode.CDSREV;
+    if ("CLINNOTEREV".equals(codeString))
+      return V3ActCode.CLINNOTEREV;
+    if ("DISCHSUMREV".equals(codeString))
+      return V3ActCode.DISCHSUMREV;
+    if ("DIAGLISTREV".equals(codeString))
+      return V3ActCode.DIAGLISTREV;
+    if ("IMMLE".equals(codeString))
+      return V3ActCode.IMMLE;
+    if ("LABRREV".equals(codeString))
+      return V3ActCode.LABRREV;
+    if ("MICRORREV".equals(codeString))
+      return V3ActCode.MICRORREV;
+    if ("MICROORGRREV".equals(codeString))
+      return V3ActCode.MICROORGRREV;
+    if ("MICROSENSRREV".equals(codeString))
+      return V3ActCode.MICROSENSRREV;
+    if ("MLREV".equals(codeString))
+      return V3ActCode.MLREV;
+    if ("MARWLREV".equals(codeString))
+      return V3ActCode.MARWLREV;
+    if ("OREV".equals(codeString))
+      return V3ActCode.OREV;
+    if ("PATREPREV".equals(codeString))
+      return V3ActCode.PATREPREV;
+    if ("PROBLISTREV".equals(codeString))
+      return V3ActCode.PROBLISTREV;
+    if ("RADREPREV".equals(codeString))
+      return V3ActCode.RADREPREV;
+    if ("REMLE".equals(codeString))
+      return V3ActCode.REMLE;
+    if ("WELLREMLE".equals(codeString))
+      return V3ActCode.WELLREMLE;
+    if ("RISKASSESS".equals(codeString))
+      return V3ActCode.RISKASSESS;
+    if ("FALLRISK".equals(codeString))
+      return V3ActCode.FALLRISK;
+    if ("_ActTransportationModeCode".equals(codeString))
+      return V3ActCode._ACTTRANSPORTATIONMODECODE;
+    if ("_ActPatientTransportationModeCode".equals(codeString))
+      return V3ActCode._ACTPATIENTTRANSPORTATIONMODECODE;
+    if ("AFOOT".equals(codeString))
+      return V3ActCode.AFOOT;
+    if ("AMBT".equals(codeString))
+      return V3ActCode.AMBT;
+    if ("AMBAIR".equals(codeString))
+      return V3ActCode.AMBAIR;
+    if ("AMBGRND".equals(codeString))
+      return V3ActCode.AMBGRND;
+    if ("AMBHELO".equals(codeString))
+      return V3ActCode.AMBHELO;
+    if ("LAWENF".equals(codeString))
+      return V3ActCode.LAWENF;
+    if ("PRVTRN".equals(codeString))
+      return V3ActCode.PRVTRN;
+    if ("PUBTRN".equals(codeString))
+      return V3ActCode.PUBTRN;
+    if ("_ObservationType".equals(codeString))
+      return V3ActCode._OBSERVATIONTYPE;
+    if ("_ActSpecObsCode".equals(codeString))
+      return V3ActCode._ACTSPECOBSCODE;
+    if ("ARTBLD".equals(codeString))
+      return V3ActCode.ARTBLD;
+    if ("DILUTION".equals(codeString))
+      return V3ActCode.DILUTION;
+    if ("AUTO-HIGH".equals(codeString))
+      return V3ActCode.AUTOHIGH;
+    if ("AUTO-LOW".equals(codeString))
+      return V3ActCode.AUTOLOW;
+    if ("PRE".equals(codeString))
+      return V3ActCode.PRE;
+    if ("RERUN".equals(codeString))
+      return V3ActCode.RERUN;
+    if ("EVNFCTS".equals(codeString))
+      return V3ActCode.EVNFCTS;
+    if ("INTFR".equals(codeString))
+      return V3ActCode.INTFR;
+    if ("FIBRIN".equals(codeString))
+      return V3ActCode.FIBRIN;
+    if ("HEMOLYSIS".equals(codeString))
+      return V3ActCode.HEMOLYSIS;
+    if ("ICTERUS".equals(codeString))
+      return V3ActCode.ICTERUS;
+    if ("LIPEMIA".equals(codeString))
+      return V3ActCode.LIPEMIA;
+    if ("VOLUME".equals(codeString))
+      return V3ActCode.VOLUME;
+    if ("AVAILABLE".equals(codeString))
+      return V3ActCode.AVAILABLE;
+    if ("CONSUMPTION".equals(codeString))
+      return V3ActCode.CONSUMPTION;
+    if ("CURRENT".equals(codeString))
+      return V3ActCode.CURRENT;
+    if ("INITIAL".equals(codeString))
+      return V3ActCode.INITIAL;
+    if ("_AnnotationType".equals(codeString))
+      return V3ActCode._ANNOTATIONTYPE;
+    if ("_ActPatientAnnotationType".equals(codeString))
+      return V3ActCode._ACTPATIENTANNOTATIONTYPE;
+    if ("ANNDI".equals(codeString))
+      return V3ActCode.ANNDI;
+    if ("ANNGEN".equals(codeString))
+      return V3ActCode.ANNGEN;
+    if ("ANNIMM".equals(codeString))
+      return V3ActCode.ANNIMM;
+    if ("ANNLAB".equals(codeString))
+      return V3ActCode.ANNLAB;
+    if ("ANNMED".equals(codeString))
+      return V3ActCode.ANNMED;
+    if ("_GeneticObservationType".equals(codeString))
+      return V3ActCode._GENETICOBSERVATIONTYPE;
+    if ("GENE".equals(codeString))
+      return V3ActCode.GENE;
+    if ("_ImmunizationObservationType".equals(codeString))
+      return V3ActCode._IMMUNIZATIONOBSERVATIONTYPE;
+    if ("OBSANTC".equals(codeString))
+      return V3ActCode.OBSANTC;
+    if ("OBSANTV".equals(codeString))
+      return V3ActCode.OBSANTV;
+    if ("_IndividualCaseSafetyReportType".equals(codeString))
+      return V3ActCode._INDIVIDUALCASESAFETYREPORTTYPE;
+    if ("PAT_ADV_EVNT".equals(codeString))
+      return V3ActCode.PATADVEVNT;
+    if ("VAC_PROBLEM".equals(codeString))
+      return V3ActCode.VACPROBLEM;
+    if ("_LOINCObservationActContextAgeType".equals(codeString))
+      return V3ActCode._LOINCOBSERVATIONACTCONTEXTAGETYPE;
+    if ("21611-9".equals(codeString))
+      return V3ActCode._216119;
+    if ("21612-7".equals(codeString))
+      return V3ActCode._216127;
+    if ("29553-5".equals(codeString))
+      return V3ActCode._295535;
+    if ("30525-0".equals(codeString))
+      return V3ActCode._305250;
+    if ("30972-4".equals(codeString))
+      return V3ActCode._309724;
+    if ("_MedicationObservationType".equals(codeString))
+      return V3ActCode._MEDICATIONOBSERVATIONTYPE;
+    if ("REP_HALF_LIFE".equals(codeString))
+      return V3ActCode.REPHALFLIFE;
+    if ("SPLCOATING".equals(codeString))
+      return V3ActCode.SPLCOATING;
+    if ("SPLCOLOR".equals(codeString))
+      return V3ActCode.SPLCOLOR;
+    if ("SPLIMAGE".equals(codeString))
+      return V3ActCode.SPLIMAGE;
+    if ("SPLIMPRINT".equals(codeString))
+      return V3ActCode.SPLIMPRINT;
+    if ("SPLSCORING".equals(codeString))
+      return V3ActCode.SPLSCORING;
+    if ("SPLSHAPE".equals(codeString))
+      return V3ActCode.SPLSHAPE;
+    if ("SPLSIZE".equals(codeString))
+      return V3ActCode.SPLSIZE;
+    if ("SPLSYMBOL".equals(codeString))
+      return V3ActCode.SPLSYMBOL;
+    if ("_ObservationIssueTriggerCodedObservationType".equals(codeString))
+      return V3ActCode._OBSERVATIONISSUETRIGGERCODEDOBSERVATIONTYPE;
+    if ("_CaseTransmissionMode".equals(codeString))
+      return V3ActCode._CASETRANSMISSIONMODE;
+    if ("AIRTRNS".equals(codeString))
+      return V3ActCode.AIRTRNS;
+    if ("ANANTRNS".equals(codeString))
+      return V3ActCode.ANANTRNS;
+    if ("ANHUMTRNS".equals(codeString))
+      return V3ActCode.ANHUMTRNS;
+    if ("BDYFLDTRNS".equals(codeString))
+      return V3ActCode.BDYFLDTRNS;
+    if ("BLDTRNS".equals(codeString))
+      return V3ActCode.BLDTRNS;
+    if ("DERMTRNS".equals(codeString))
+      return V3ActCode.DERMTRNS;
+    if ("ENVTRNS".equals(codeString))
+      return V3ActCode.ENVTRNS;
+    if ("FECTRNS".equals(codeString))
+      return V3ActCode.FECTRNS;
+    if ("FOMTRNS".equals(codeString))
+      return V3ActCode.FOMTRNS;
+    if ("FOODTRNS".equals(codeString))
+      return V3ActCode.FOODTRNS;
+    if ("HUMHUMTRNS".equals(codeString))
+      return V3ActCode.HUMHUMTRNS;
+    if ("INDTRNS".equals(codeString))
+      return V3ActCode.INDTRNS;
+    if ("LACTTRNS".equals(codeString))
+      return V3ActCode.LACTTRNS;
+    if ("NOSTRNS".equals(codeString))
+      return V3ActCode.NOSTRNS;
+    if ("PARTRNS".equals(codeString))
+      return V3ActCode.PARTRNS;
+    if ("PLACTRNS".equals(codeString))
+      return V3ActCode.PLACTRNS;
+    if ("SEXTRNS".equals(codeString))
+      return V3ActCode.SEXTRNS;
+    if ("TRNSFTRNS".equals(codeString))
+      return V3ActCode.TRNSFTRNS;
+    if ("VECTRNS".equals(codeString))
+      return V3ActCode.VECTRNS;
+    if ("WATTRNS".equals(codeString))
+      return V3ActCode.WATTRNS;
+    if ("_ObservationQualityMeasureAttribute".equals(codeString))
+      return V3ActCode._OBSERVATIONQUALITYMEASUREATTRIBUTE;
+    if ("AGGREGATE".equals(codeString))
+      return V3ActCode.AGGREGATE;
+    if ("CMPMSRMTH".equals(codeString))
+      return V3ActCode.CMPMSRMTH;
+    if ("CMPMSRSCRWGHT".equals(codeString))
+      return V3ActCode.CMPMSRSCRWGHT;
+    if ("COPY".equals(codeString))
+      return V3ActCode.COPY;
+    if ("CRS".equals(codeString))
+      return V3ActCode.CRS;
+    if ("DEF".equals(codeString))
+      return V3ActCode.DEF;
+    if ("DISC".equals(codeString))
+      return V3ActCode.DISC;
+    if ("FINALDT".equals(codeString))
+      return V3ActCode.FINALDT;
+    if ("GUIDE".equals(codeString))
+      return V3ActCode.GUIDE;
+    if ("IDUR".equals(codeString))
+      return V3ActCode.IDUR;
+    if ("ITMCNT".equals(codeString))
+      return V3ActCode.ITMCNT;
+    if ("KEY".equals(codeString))
+      return V3ActCode.KEY;
+    if ("MEDT".equals(codeString))
+      return V3ActCode.MEDT;
+    if ("MSD".equals(codeString))
+      return V3ActCode.MSD;
+    if ("MSRADJ".equals(codeString))
+      return V3ActCode.MSRADJ;
+    if ("MSRAGG".equals(codeString))
+      return V3ActCode.MSRAGG;
+    if ("MSRIMPROV".equals(codeString))
+      return V3ActCode.MSRIMPROV;
+    if ("MSRJUR".equals(codeString))
+      return V3ActCode.MSRJUR;
+    if ("MSRRPTR".equals(codeString))
+      return V3ActCode.MSRRPTR;
+    if ("MSRRPTTIME".equals(codeString))
+      return V3ActCode.MSRRPTTIME;
+    if ("MSRSCORE".equals(codeString))
+      return V3ActCode.MSRSCORE;
+    if ("MSRSET".equals(codeString))
+      return V3ActCode.MSRSET;
+    if ("MSRTOPIC".equals(codeString))
+      return V3ActCode.MSRTOPIC;
+    if ("MSRTP".equals(codeString))
+      return V3ActCode.MSRTP;
+    if ("MSRTYPE".equals(codeString))
+      return V3ActCode.MSRTYPE;
+    if ("RAT".equals(codeString))
+      return V3ActCode.RAT;
+    if ("REF".equals(codeString))
+      return V3ActCode.REF;
+    if ("SDE".equals(codeString))
+      return V3ActCode.SDE;
+    if ("STRAT".equals(codeString))
+      return V3ActCode.STRAT;
+    if ("TRANF".equals(codeString))
+      return V3ActCode.TRANF;
+    if ("USE".equals(codeString))
+      return V3ActCode.USE;
+    if ("_ObservationSequenceType".equals(codeString))
+      return V3ActCode._OBSERVATIONSEQUENCETYPE;
+    if ("TIME_ABSOLUTE".equals(codeString))
+      return V3ActCode.TIMEABSOLUTE;
+    if ("TIME_RELATIVE".equals(codeString))
+      return V3ActCode.TIMERELATIVE;
+    if ("_ObservationSeriesType".equals(codeString))
+      return V3ActCode._OBSERVATIONSERIESTYPE;
+    if ("_ECGObservationSeriesType".equals(codeString))
+      return V3ActCode._ECGOBSERVATIONSERIESTYPE;
+    if ("REPRESENTATIVE_BEAT".equals(codeString))
+      return V3ActCode.REPRESENTATIVEBEAT;
+    if ("RHYTHM".equals(codeString))
+      return V3ActCode.RHYTHM;
+    if ("_PatientImmunizationRelatedObservationType".equals(codeString))
+      return V3ActCode._PATIENTIMMUNIZATIONRELATEDOBSERVATIONTYPE;
+    if ("CLSSRM".equals(codeString))
+      return V3ActCode.CLSSRM;
+    if ("GRADE".equals(codeString))
+      return V3ActCode.GRADE;
+    if ("SCHL".equals(codeString))
+      return V3ActCode.SCHL;
+    if ("SCHLDIV".equals(codeString))
+      return V3ActCode.SCHLDIV;
+    if ("TEACHER".equals(codeString))
+      return V3ActCode.TEACHER;
+    if ("_PopulationInclusionObservationType".equals(codeString))
+      return V3ActCode._POPULATIONINCLUSIONOBSERVATIONTYPE;
+    if ("DENEX".equals(codeString))
+      return V3ActCode.DENEX;
+    if ("DENEXCEP".equals(codeString))
+      return V3ActCode.DENEXCEP;
+    if ("DENOM".equals(codeString))
+      return V3ActCode.DENOM;
+    if ("IPOP".equals(codeString))
+      return V3ActCode.IPOP;
+    if ("IPPOP".equals(codeString))
+      return V3ActCode.IPPOP;
+    if ("MSRPOPL".equals(codeString))
+      return V3ActCode.MSRPOPL;
+    if ("MSRPOPLEX".equals(codeString))
+      return V3ActCode.MSRPOPLEX;
+    if ("NUMER".equals(codeString))
+      return V3ActCode.NUMER;
+    if ("NUMEX".equals(codeString))
+      return V3ActCode.NUMEX;
+    if ("_PreferenceObservationType".equals(codeString))
+      return V3ActCode._PREFERENCEOBSERVATIONTYPE;
+    if ("PREFSTRENGTH".equals(codeString))
+      return V3ActCode.PREFSTRENGTH;
+    if ("ADVERSE_REACTION".equals(codeString))
+      return V3ActCode.ADVERSEREACTION;
+    if ("ASSERTION".equals(codeString))
+      return V3ActCode.ASSERTION;
+    if ("CASESER".equals(codeString))
+      return V3ActCode.CASESER;
+    if ("CDIO".equals(codeString))
+      return V3ActCode.CDIO;
+    if ("CRIT".equals(codeString))
+      return V3ActCode.CRIT;
+    if ("CTMO".equals(codeString))
+      return V3ActCode.CTMO;
+    if ("DX".equals(codeString))
+      return V3ActCode.DX;
+    if ("ADMDX".equals(codeString))
+      return V3ActCode.ADMDX;
+    if ("DISDX".equals(codeString))
+      return V3ActCode.DISDX;
+    if ("INTDX".equals(codeString))
+      return V3ActCode.INTDX;
+    if ("NOI".equals(codeString))
+      return V3ActCode.NOI;
+    if ("GISTIER".equals(codeString))
+      return V3ActCode.GISTIER;
+    if ("HHOBS".equals(codeString))
+      return V3ActCode.HHOBS;
+    if ("ISSUE".equals(codeString))
+      return V3ActCode.ISSUE;
+    if ("_ActAdministrativeDetectedIssueCode".equals(codeString))
+      return V3ActCode._ACTADMINISTRATIVEDETECTEDISSUECODE;
+    if ("_ActAdministrativeAuthorizationDetectedIssueCode".equals(codeString))
+      return V3ActCode._ACTADMINISTRATIVEAUTHORIZATIONDETECTEDISSUECODE;
+    if ("NAT".equals(codeString))
+      return V3ActCode.NAT;
+    if ("SUPPRESSED".equals(codeString))
+      return V3ActCode.SUPPRESSED;
+    if ("VALIDAT".equals(codeString))
+      return V3ActCode.VALIDAT;
+    if ("KEY204".equals(codeString))
+      return V3ActCode.KEY204;
+    if ("KEY205".equals(codeString))
+      return V3ActCode.KEY205;
+    if ("COMPLY".equals(codeString))
+      return V3ActCode.COMPLY;
+    if ("DUPTHPY".equals(codeString))
+      return V3ActCode.DUPTHPY;
+    if ("DUPTHPCLS".equals(codeString))
+      return V3ActCode.DUPTHPCLS;
+    if ("DUPTHPGEN".equals(codeString))
+      return V3ActCode.DUPTHPGEN;
+    if ("ABUSE".equals(codeString))
+      return V3ActCode.ABUSE;
+    if ("FRAUD".equals(codeString))
+      return V3ActCode.FRAUD;
+    if ("PLYDOC".equals(codeString))
+      return V3ActCode.PLYDOC;
+    if ("PLYPHRM".equals(codeString))
+      return V3ActCode.PLYPHRM;
+    if ("DOSE".equals(codeString))
+      return V3ActCode.DOSE;
+    if ("DOSECOND".equals(codeString))
+      return V3ActCode.DOSECOND;
+    if ("DOSEDUR".equals(codeString))
+      return V3ActCode.DOSEDUR;
+    if ("DOSEDURH".equals(codeString))
+      return V3ActCode.DOSEDURH;
+    if ("DOSEDURHIND".equals(codeString))
+      return V3ActCode.DOSEDURHIND;
+    if ("DOSEDURL".equals(codeString))
+      return V3ActCode.DOSEDURL;
+    if ("DOSEDURLIND".equals(codeString))
+      return V3ActCode.DOSEDURLIND;
+    if ("DOSEH".equals(codeString))
+      return V3ActCode.DOSEH;
+    if ("DOSEHINDA".equals(codeString))
+      return V3ActCode.DOSEHINDA;
+    if ("DOSEHIND".equals(codeString))
+      return V3ActCode.DOSEHIND;
+    if ("DOSEHINDSA".equals(codeString))
+      return V3ActCode.DOSEHINDSA;
+    if ("DOSEHINDW".equals(codeString))
+      return V3ActCode.DOSEHINDW;
+    if ("DOSEIVL".equals(codeString))
+      return V3ActCode.DOSEIVL;
+    if ("DOSEIVLIND".equals(codeString))
+      return V3ActCode.DOSEIVLIND;
+    if ("DOSEL".equals(codeString))
+      return V3ActCode.DOSEL;
+    if ("DOSELINDA".equals(codeString))
+      return V3ActCode.DOSELINDA;
+    if ("DOSELIND".equals(codeString))
+      return V3ActCode.DOSELIND;
+    if ("DOSELINDSA".equals(codeString))
+      return V3ActCode.DOSELINDSA;
+    if ("DOSELINDW".equals(codeString))
+      return V3ActCode.DOSELINDW;
+    if ("MDOSE".equals(codeString))
+      return V3ActCode.MDOSE;
+    if ("OBSA".equals(codeString))
+      return V3ActCode.OBSA;
+    if ("AGE".equals(codeString))
+      return V3ActCode.AGE;
+    if ("ADALRT".equals(codeString))
+      return V3ActCode.ADALRT;
+    if ("GEALRT".equals(codeString))
+      return V3ActCode.GEALRT;
+    if ("PEALRT".equals(codeString))
+      return V3ActCode.PEALRT;
+    if ("COND".equals(codeString))
+      return V3ActCode.COND;
+    if ("HGHT".equals(codeString))
+      return V3ActCode.HGHT;
+    if ("LACT".equals(codeString))
+      return V3ActCode.LACT;
+    if ("PREG".equals(codeString))
+      return V3ActCode.PREG;
+    if ("WGHT".equals(codeString))
+      return V3ActCode.WGHT;
+    if ("CREACT".equals(codeString))
+      return V3ActCode.CREACT;
+    if ("GEN".equals(codeString))
+      return V3ActCode.GEN;
+    if ("GEND".equals(codeString))
+      return V3ActCode.GEND;
+    if ("LAB".equals(codeString))
+      return V3ActCode.LAB;
+    if ("REACT".equals(codeString))
+      return V3ActCode.REACT;
+    if ("ALGY".equals(codeString))
+      return V3ActCode.ALGY;
+    if ("INT".equals(codeString))
+      return V3ActCode.INT;
+    if ("RREACT".equals(codeString))
+      return V3ActCode.RREACT;
+    if ("RALG".equals(codeString))
+      return V3ActCode.RALG;
+    if ("RAR".equals(codeString))
+      return V3ActCode.RAR;
+    if ("RINT".equals(codeString))
+      return V3ActCode.RINT;
+    if ("BUS".equals(codeString))
+      return V3ActCode.BUS;
+    if ("CODE_INVAL".equals(codeString))
+      return V3ActCode.CODEINVAL;
+    if ("CODE_DEPREC".equals(codeString))
+      return V3ActCode.CODEDEPREC;
+    if ("FORMAT".equals(codeString))
+      return V3ActCode.FORMAT;
+    if ("ILLEGAL".equals(codeString))
+      return V3ActCode.ILLEGAL;
+    if ("LEN_RANGE".equals(codeString))
+      return V3ActCode.LENRANGE;
+    if ("LEN_LONG".equals(codeString))
+      return V3ActCode.LENLONG;
+    if ("LEN_SHORT".equals(codeString))
+      return V3ActCode.LENSHORT;
+    if ("MISSCOND".equals(codeString))
+      return V3ActCode.MISSCOND;
+    if ("MISSMAND".equals(codeString))
+      return V3ActCode.MISSMAND;
+    if ("NODUPS".equals(codeString))
+      return V3ActCode.NODUPS;
+    if ("NOPERSIST".equals(codeString))
+      return V3ActCode.NOPERSIST;
+    if ("REP_RANGE".equals(codeString))
+      return V3ActCode.REPRANGE;
+    if ("MAXOCCURS".equals(codeString))
+      return V3ActCode.MAXOCCURS;
+    if ("MINOCCURS".equals(codeString))
+      return V3ActCode.MINOCCURS;
+    if ("_ActAdministrativeRuleDetectedIssueCode".equals(codeString))
+      return V3ActCode._ACTADMINISTRATIVERULEDETECTEDISSUECODE;
+    if ("KEY206".equals(codeString))
+      return V3ActCode.KEY206;
+    if ("OBSOLETE".equals(codeString))
+      return V3ActCode.OBSOLETE;
+    if ("_ActSuppliedItemDetectedIssueCode".equals(codeString))
+      return V3ActCode._ACTSUPPLIEDITEMDETECTEDISSUECODE;
+    if ("_AdministrationDetectedIssueCode".equals(codeString))
+      return V3ActCode._ADMINISTRATIONDETECTEDISSUECODE;
+    if ("_AppropriatenessDetectedIssueCode".equals(codeString))
+      return V3ActCode._APPROPRIATENESSDETECTEDISSUECODE;
+    if ("_InteractionDetectedIssueCode".equals(codeString))
+      return V3ActCode._INTERACTIONDETECTEDISSUECODE;
+    if ("FOOD".equals(codeString))
+      return V3ActCode.FOOD;
+    if ("TPROD".equals(codeString))
+      return V3ActCode.TPROD;
+    if ("DRG".equals(codeString))
+      return V3ActCode.DRG;
+    if ("NHP".equals(codeString))
+      return V3ActCode.NHP;
+    if ("NONRX".equals(codeString))
+      return V3ActCode.NONRX;
+    if ("PREVINEF".equals(codeString))
+      return V3ActCode.PREVINEF;
+    if ("DACT".equals(codeString))
+      return V3ActCode.DACT;
+    if ("TIME".equals(codeString))
+      return V3ActCode.TIME;
+    if ("ALRTENDLATE".equals(codeString))
+      return V3ActCode.ALRTENDLATE;
+    if ("ALRTSTRTLATE".equals(codeString))
+      return V3ActCode.ALRTSTRTLATE;
+    if ("_TimingDetectedIssueCode".equals(codeString))
+      return V3ActCode._TIMINGDETECTEDISSUECODE;
+    if ("ENDLATE".equals(codeString))
+      return V3ActCode.ENDLATE;
+    if ("STRTLATE".equals(codeString))
+      return V3ActCode.STRTLATE;
+    if ("_SupplyDetectedIssueCode".equals(codeString))
+      return V3ActCode._SUPPLYDETECTEDISSUECODE;
+    if ("ALLDONE".equals(codeString))
+      return V3ActCode.ALLDONE;
+    if ("FULFIL".equals(codeString))
+      return V3ActCode.FULFIL;
+    if ("NOTACTN".equals(codeString))
+      return V3ActCode.NOTACTN;
+    if ("NOTEQUIV".equals(codeString))
+      return V3ActCode.NOTEQUIV;
+    if ("NOTEQUIVGEN".equals(codeString))
+      return V3ActCode.NOTEQUIVGEN;
+    if ("NOTEQUIVTHER".equals(codeString))
+      return V3ActCode.NOTEQUIVTHER;
+    if ("TIMING".equals(codeString))
+      return V3ActCode.TIMING;
+    if ("INTERVAL".equals(codeString))
+      return V3ActCode.INTERVAL;
+    if ("MINFREQ".equals(codeString))
+      return V3ActCode.MINFREQ;
+    if ("HELD".equals(codeString))
+      return V3ActCode.HELD;
+    if ("TOOLATE".equals(codeString))
+      return V3ActCode.TOOLATE;
+    if ("TOOSOON".equals(codeString))
+      return V3ActCode.TOOSOON;
+    if ("HISTORIC".equals(codeString))
+      return V3ActCode.HISTORIC;
+    if ("PATPREF".equals(codeString))
+      return V3ActCode.PATPREF;
+    if ("PATPREFALT".equals(codeString))
+      return V3ActCode.PATPREFALT;
+    if ("KSUBJ".equals(codeString))
+      return V3ActCode.KSUBJ;
+    if ("KSUBT".equals(codeString))
+      return V3ActCode.KSUBT;
+    if ("OINT".equals(codeString))
+      return V3ActCode.OINT;
+    if ("ALG".equals(codeString))
+      return V3ActCode.ALG;
+    if ("DALG".equals(codeString))
+      return V3ActCode.DALG;
+    if ("EALG".equals(codeString))
+      return V3ActCode.EALG;
+    if ("FALG".equals(codeString))
+      return V3ActCode.FALG;
+    if ("DINT".equals(codeString))
+      return V3ActCode.DINT;
+    if ("DNAINT".equals(codeString))
+      return V3ActCode.DNAINT;
+    if ("EINT".equals(codeString))
+      return V3ActCode.EINT;
+    if ("ENAINT".equals(codeString))
+      return V3ActCode.ENAINT;
+    if ("FINT".equals(codeString))
+      return V3ActCode.FINT;
+    if ("FNAINT".equals(codeString))
+      return V3ActCode.FNAINT;
+    if ("NAINT".equals(codeString))
+      return V3ActCode.NAINT;
+    if ("SEV".equals(codeString))
+      return V3ActCode.SEV;
+    if ("_FDALabelData".equals(codeString))
+      return V3ActCode._FDALABELDATA;
+    if ("FDACOATING".equals(codeString))
+      return V3ActCode.FDACOATING;
+    if ("FDACOLOR".equals(codeString))
+      return V3ActCode.FDACOLOR;
+    if ("FDAIMPRINTCD".equals(codeString))
+      return V3ActCode.FDAIMPRINTCD;
+    if ("FDALOGO".equals(codeString))
+      return V3ActCode.FDALOGO;
+    if ("FDASCORING".equals(codeString))
+      return V3ActCode.FDASCORING;
+    if ("FDASHAPE".equals(codeString))
+      return V3ActCode.FDASHAPE;
+    if ("FDASIZE".equals(codeString))
+      return V3ActCode.FDASIZE;
+    if ("_ROIOverlayShape".equals(codeString))
+      return V3ActCode._ROIOVERLAYSHAPE;
+    if ("CIRCLE".equals(codeString))
+      return V3ActCode.CIRCLE;
+    if ("ELLIPSE".equals(codeString))
+      return V3ActCode.ELLIPSE;
+    if ("POINT".equals(codeString))
+      return V3ActCode.POINT;
+    if ("POLY".equals(codeString))
+      return V3ActCode.POLY;
+    if ("C".equals(codeString))
+      return V3ActCode.C;
+    if ("DIET".equals(codeString))
+      return V3ActCode.DIET;
+    if ("BR".equals(codeString))
+      return V3ActCode.BR;
+    if ("DM".equals(codeString))
+      return V3ActCode.DM;
+    if ("FAST".equals(codeString))
+      return V3ActCode.FAST;
+    if ("FORMULA".equals(codeString))
+      return V3ActCode.FORMULA;
+    if ("GF".equals(codeString))
+      return V3ActCode.GF;
+    if ("LF".equals(codeString))
+      return V3ActCode.LF;
+    if ("LP".equals(codeString))
+      return V3ActCode.LP;
+    if ("LQ".equals(codeString))
+      return V3ActCode.LQ;
+    if ("LS".equals(codeString))
+      return V3ActCode.LS;
+    if ("N".equals(codeString))
+      return V3ActCode.N;
+    if ("NF".equals(codeString))
+      return V3ActCode.NF;
+    if ("PAF".equals(codeString))
+      return V3ActCode.PAF;
+    if ("PAR".equals(codeString))
+      return V3ActCode.PAR;
+    if ("RD".equals(codeString))
+      return V3ActCode.RD;
+    if ("SCH".equals(codeString))
+      return V3ActCode.SCH;
+    if ("SUPPLEMENT".equals(codeString))
+      return V3ActCode.SUPPLEMENT;
+    if ("T".equals(codeString))
+      return V3ActCode.T;
+    if ("VLI".equals(codeString))
+      return V3ActCode.VLI;
+    if ("DRUGPRG".equals(codeString))
+      return V3ActCode.DRUGPRG;
+    if ("F".equals(codeString))
+      return V3ActCode.F;
+    if ("PRLMN".equals(codeString))
+      return V3ActCode.PRLMN;
+    if ("SECOBS".equals(codeString))
+      return V3ActCode.SECOBS;
+    if ("SECCATOBS".equals(codeString))
+      return V3ActCode.SECCATOBS;
+    if ("SECCLASSOBS".equals(codeString))
+      return V3ActCode.SECCLASSOBS;
+    if ("SECCONOBS".equals(codeString))
+      return V3ActCode.SECCONOBS;
+    if ("SECINTOBS".equals(codeString))
+      return V3ActCode.SECINTOBS;
+    if ("SECALTINTOBS".equals(codeString))
+      return V3ActCode.SECALTINTOBS;
+    if ("SECDATINTOBS".equals(codeString))
+      return V3ActCode.SECDATINTOBS;
+    if ("SECINTCONOBS".equals(codeString))
+      return V3ActCode.SECINTCONOBS;
+    if ("SECINTPRVOBS".equals(codeString))
+      return V3ActCode.SECINTPRVOBS;
+    if ("SECINTPRVABOBS".equals(codeString))
+      return V3ActCode.SECINTPRVABOBS;
+    if ("SECINTPRVRBOBS".equals(codeString))
+      return V3ActCode.SECINTPRVRBOBS;
+    if ("SECINTSTOBS".equals(codeString))
+      return V3ActCode.SECINTSTOBS;
+    if ("SECTRSTOBS".equals(codeString))
+      return V3ActCode.SECTRSTOBS;
+    if ("TRSTACCRDOBS".equals(codeString))
+      return V3ActCode.TRSTACCRDOBS;
+    if ("TRSTAGREOBS".equals(codeString))
+      return V3ActCode.TRSTAGREOBS;
+    if ("TRSTCERTOBS".equals(codeString))
+      return V3ActCode.TRSTCERTOBS;
+    if ("TRSTFWKOBS".equals(codeString))
+      return V3ActCode.TRSTFWKOBS;
+    if ("TRSTLOAOBS".equals(codeString))
+      return V3ActCode.TRSTLOAOBS;
+    if ("TRSTMECOBS".equals(codeString))
+      return V3ActCode.TRSTMECOBS;
+    if ("SUBSIDFFS".equals(codeString))
+      return V3ActCode.SUBSIDFFS;
+    if ("WRKCOMP".equals(codeString))
+      return V3ActCode.WRKCOMP;
+    if ("_ActProcedureCode".equals(codeString))
+      return V3ActCode._ACTPROCEDURECODE;
+    if ("_ActBillableServiceCode".equals(codeString))
+      return V3ActCode._ACTBILLABLESERVICECODE;
+    if ("_HL7DefinedActCodes".equals(codeString))
+      return V3ActCode._HL7DEFINEDACTCODES;
+    if ("COPAY".equals(codeString))
+      return V3ActCode.COPAY;
+    if ("DEDUCT".equals(codeString))
+      return V3ActCode.DEDUCT;
+    if ("DOSEIND".equals(codeString))
+      return V3ActCode.DOSEIND;
+    if ("PRA".equals(codeString))
+      return V3ActCode.PRA;
+    if ("STORE".equals(codeString))
+      return V3ActCode.STORE;
+    throw new IllegalArgumentException("Unknown V3ActCode code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActCode code) {
+    if (code == V3ActCode._ACTACCOUNTCODE)
+      return "_ActAccountCode";
+    if (code == V3ActCode.ACCTRECEIVABLE)
+      return "ACCTRECEIVABLE";
+    if (code == V3ActCode.CASH)
+      return "CASH";
+    if (code == V3ActCode.CC)
+      return "CC";
+    if (code == V3ActCode.AE)
+      return "AE";
+    if (code == V3ActCode.DN)
+      return "DN";
+    if (code == V3ActCode.DV)
+      return "DV";
+    if (code == V3ActCode.MC)
+      return "MC";
+    if (code == V3ActCode.V)
+      return "V";
+    if (code == V3ActCode.PBILLACCT)
+      return "PBILLACCT";
+    if (code == V3ActCode._ACTADJUDICATIONCODE)
+      return "_ActAdjudicationCode";
+    if (code == V3ActCode._ACTADJUDICATIONGROUPCODE)
+      return "_ActAdjudicationGroupCode";
+    if (code == V3ActCode.CONT)
+      return "CONT";
+    if (code == V3ActCode.DAY)
+      return "DAY";
+    if (code == V3ActCode.LOC)
+      return "LOC";
+    if (code == V3ActCode.MONTH)
+      return "MONTH";
+    if (code == V3ActCode.PERIOD)
+      return "PERIOD";
+    if (code == V3ActCode.PROV)
+      return "PROV";
+    if (code == V3ActCode.WEEK)
+      return "WEEK";
+    if (code == V3ActCode.YEAR)
+      return "YEAR";
+    if (code == V3ActCode.AA)
+      return "AA";
+    if (code == V3ActCode.ANF)
+      return "ANF";
+    if (code == V3ActCode.AR)
+      return "AR";
+    if (code == V3ActCode.AS)
+      return "AS";
+    if (code == V3ActCode._ACTADJUDICATIONRESULTACTIONCODE)
+      return "_ActAdjudicationResultActionCode";
+    if (code == V3ActCode.DISPLAY)
+      return "DISPLAY";
+    if (code == V3ActCode.FORM)
+      return "FORM";
+    if (code == V3ActCode._ACTBILLABLEMODIFIERCODE)
+      return "_ActBillableModifierCode";
+    if (code == V3ActCode.CPTM)
+      return "CPTM";
+    if (code == V3ActCode.HCPCSA)
+      return "HCPCSA";
+    if (code == V3ActCode._ACTBILLINGARRANGEMENTCODE)
+      return "_ActBillingArrangementCode";
+    if (code == V3ActCode.BLK)
+      return "BLK";
+    if (code == V3ActCode.CAP)
+      return "CAP";
+    if (code == V3ActCode.CONTF)
+      return "CONTF";
+    if (code == V3ActCode.FINBILL)
+      return "FINBILL";
+    if (code == V3ActCode.ROST)
+      return "ROST";
+    if (code == V3ActCode.SESS)
+      return "SESS";
+    if (code == V3ActCode.FFS)
+      return "FFS";
+    if (code == V3ActCode.FFPS)
+      return "FFPS";
+    if (code == V3ActCode.FFCS)
+      return "FFCS";
+    if (code == V3ActCode.TFS)
+      return "TFS";
+    if (code == V3ActCode._ACTBOUNDEDROICODE)
+      return "_ActBoundedROICode";
+    if (code == V3ActCode.ROIFS)
+      return "ROIFS";
+    if (code == V3ActCode.ROIPS)
+      return "ROIPS";
+    if (code == V3ActCode._ACTCAREPROVISIONCODE)
+      return "_ActCareProvisionCode";
+    if (code == V3ActCode._ACTCREDENTIALEDCARECODE)
+      return "_ActCredentialedCareCode";
+    if (code == V3ActCode._ACTCREDENTIALEDCAREPROVISIONPERSONCODE)
+      return "_ActCredentialedCareProvisionPersonCode";
+    if (code == V3ActCode.CACC)
+      return "CACC";
+    if (code == V3ActCode.CAIC)
+      return "CAIC";
+    if (code == V3ActCode.CAMC)
+      return "CAMC";
+    if (code == V3ActCode.CANC)
+      return "CANC";
+    if (code == V3ActCode.CAPC)
+      return "CAPC";
+    if (code == V3ActCode.CBGC)
+      return "CBGC";
+    if (code == V3ActCode.CCCC)
+      return "CCCC";
+    if (code == V3ActCode.CCGC)
+      return "CCGC";
+    if (code == V3ActCode.CCPC)
+      return "CCPC";
+    if (code == V3ActCode.CCSC)
+      return "CCSC";
+    if (code == V3ActCode.CDEC)
+      return "CDEC";
+    if (code == V3ActCode.CDRC)
+      return "CDRC";
+    if (code == V3ActCode.CEMC)
+      return "CEMC";
+    if (code == V3ActCode.CFPC)
+      return "CFPC";
+    if (code == V3ActCode.CIMC)
+      return "CIMC";
+    if (code == V3ActCode.CMGC)
+      return "CMGC";
+    if (code == V3ActCode.CNEC)
+      return "CNEC";
+    if (code == V3ActCode.CNMC)
+      return "CNMC";
+    if (code == V3ActCode.CNQC)
+      return "CNQC";
+    if (code == V3ActCode.CNSC)
+      return "CNSC";
+    if (code == V3ActCode.COGC)
+      return "COGC";
+    if (code == V3ActCode.COMC)
+      return "COMC";
+    if (code == V3ActCode.COPC)
+      return "COPC";
+    if (code == V3ActCode.COSC)
+      return "COSC";
+    if (code == V3ActCode.COTC)
+      return "COTC";
+    if (code == V3ActCode.CPEC)
+      return "CPEC";
+    if (code == V3ActCode.CPGC)
+      return "CPGC";
+    if (code == V3ActCode.CPHC)
+      return "CPHC";
+    if (code == V3ActCode.CPRC)
+      return "CPRC";
+    if (code == V3ActCode.CPSC)
+      return "CPSC";
+    if (code == V3ActCode.CPYC)
+      return "CPYC";
+    if (code == V3ActCode.CROC)
+      return "CROC";
+    if (code == V3ActCode.CRPC)
+      return "CRPC";
+    if (code == V3ActCode.CSUC)
+      return "CSUC";
+    if (code == V3ActCode.CTSC)
+      return "CTSC";
+    if (code == V3ActCode.CURC)
+      return "CURC";
+    if (code == V3ActCode.CVSC)
+      return "CVSC";
+    if (code == V3ActCode.LGPC)
+      return "LGPC";
+    if (code == V3ActCode._ACTCREDENTIALEDCAREPROVISIONPROGRAMCODE)
+      return "_ActCredentialedCareProvisionProgramCode";
+    if (code == V3ActCode.AALC)
+      return "AALC";
+    if (code == V3ActCode.AAMC)
+      return "AAMC";
+    if (code == V3ActCode.ABHC)
+      return "ABHC";
+    if (code == V3ActCode.ACAC)
+      return "ACAC";
+    if (code == V3ActCode.ACHC)
+      return "ACHC";
+    if (code == V3ActCode.AHOC)
+      return "AHOC";
+    if (code == V3ActCode.ALTC)
+      return "ALTC";
+    if (code == V3ActCode.AOSC)
+      return "AOSC";
+    if (code == V3ActCode.CACS)
+      return "CACS";
+    if (code == V3ActCode.CAMI)
+      return "CAMI";
+    if (code == V3ActCode.CAST)
+      return "CAST";
+    if (code == V3ActCode.CBAR)
+      return "CBAR";
+    if (code == V3ActCode.CCAD)
+      return "CCAD";
+    if (code == V3ActCode.CCAR)
+      return "CCAR";
+    if (code == V3ActCode.CDEP)
+      return "CDEP";
+    if (code == V3ActCode.CDGD)
+      return "CDGD";
+    if (code == V3ActCode.CDIA)
+      return "CDIA";
+    if (code == V3ActCode.CEPI)
+      return "CEPI";
+    if (code == V3ActCode.CFEL)
+      return "CFEL";
+    if (code == V3ActCode.CHFC)
+      return "CHFC";
+    if (code == V3ActCode.CHRO)
+      return "CHRO";
+    if (code == V3ActCode.CHYP)
+      return "CHYP";
+    if (code == V3ActCode.CMIH)
+      return "CMIH";
+    if (code == V3ActCode.CMSC)
+      return "CMSC";
+    if (code == V3ActCode.COJR)
+      return "COJR";
+    if (code == V3ActCode.CONC)
+      return "CONC";
+    if (code == V3ActCode.COPD)
+      return "COPD";
+    if (code == V3ActCode.CORT)
+      return "CORT";
+    if (code == V3ActCode.CPAD)
+      return "CPAD";
+    if (code == V3ActCode.CPND)
+      return "CPND";
+    if (code == V3ActCode.CPST)
+      return "CPST";
+    if (code == V3ActCode.CSDM)
+      return "CSDM";
+    if (code == V3ActCode.CSIC)
+      return "CSIC";
+    if (code == V3ActCode.CSLD)
+      return "CSLD";
+    if (code == V3ActCode.CSPT)
+      return "CSPT";
+    if (code == V3ActCode.CTBU)
+      return "CTBU";
+    if (code == V3ActCode.CVDC)
+      return "CVDC";
+    if (code == V3ActCode.CWMA)
+      return "CWMA";
+    if (code == V3ActCode.CWOH)
+      return "CWOH";
+    if (code == V3ActCode._ACTENCOUNTERCODE)
+      return "_ActEncounterCode";
+    if (code == V3ActCode.AMB)
+      return "AMB";
+    if (code == V3ActCode.EMER)
+      return "EMER";
+    if (code == V3ActCode.FLD)
+      return "FLD";
+    if (code == V3ActCode.HH)
+      return "HH";
+    if (code == V3ActCode.IMP)
+      return "IMP";
+    if (code == V3ActCode.ACUTE)
+      return "ACUTE";
+    if (code == V3ActCode.NONAC)
+      return "NONAC";
+    if (code == V3ActCode.PRENC)
+      return "PRENC";
+    if (code == V3ActCode.SS)
+      return "SS";
+    if (code == V3ActCode.VR)
+      return "VR";
+    if (code == V3ActCode._ACTMEDICALSERVICECODE)
+      return "_ActMedicalServiceCode";
+    if (code == V3ActCode.ALC)
+      return "ALC";
+    if (code == V3ActCode.CARD)
+      return "CARD";
+    if (code == V3ActCode.CHR)
+      return "CHR";
+    if (code == V3ActCode.DNTL)
+      return "DNTL";
+    if (code == V3ActCode.DRGRHB)
+      return "DRGRHB";
+    if (code == V3ActCode.GENRL)
+      return "GENRL";
+    if (code == V3ActCode.MED)
+      return "MED";
+    if (code == V3ActCode.OBS)
+      return "OBS";
+    if (code == V3ActCode.ONC)
+      return "ONC";
+    if (code == V3ActCode.PALL)
+      return "PALL";
+    if (code == V3ActCode.PED)
+      return "PED";
+    if (code == V3ActCode.PHAR)
+      return "PHAR";
+    if (code == V3ActCode.PHYRHB)
+      return "PHYRHB";
+    if (code == V3ActCode.PSYCH)
+      return "PSYCH";
+    if (code == V3ActCode.SURG)
+      return "SURG";
+    if (code == V3ActCode._ACTCLAIMATTACHMENTCATEGORYCODE)
+      return "_ActClaimAttachmentCategoryCode";
+    if (code == V3ActCode.AUTOATTCH)
+      return "AUTOATTCH";
+    if (code == V3ActCode.DOCUMENT)
+      return "DOCUMENT";
+    if (code == V3ActCode.HEALTHREC)
+      return "HEALTHREC";
+    if (code == V3ActCode.IMG)
+      return "IMG";
+    if (code == V3ActCode.LABRESULTS)
+      return "LABRESULTS";
+    if (code == V3ActCode.MODEL)
+      return "MODEL";
+    if (code == V3ActCode.WIATTCH)
+      return "WIATTCH";
+    if (code == V3ActCode.XRAY)
+      return "XRAY";
+    if (code == V3ActCode._ACTCONSENTTYPE)
+      return "_ActConsentType";
+    if (code == V3ActCode.ICOL)
+      return "ICOL";
+    if (code == V3ActCode.IDSCL)
+      return "IDSCL";
+    if (code == V3ActCode.INFA)
+      return "INFA";
+    if (code == V3ActCode.INFAO)
+      return "INFAO";
+    if (code == V3ActCode.INFASO)
+      return "INFASO";
+    if (code == V3ActCode.IRDSCL)
+      return "IRDSCL";
+    if (code == V3ActCode.RESEARCH)
+      return "RESEARCH";
+    if (code == V3ActCode.RSDID)
+      return "RSDID";
+    if (code == V3ActCode.RSREID)
+      return "RSREID";
+    if (code == V3ActCode._ACTCONTAINERREGISTRATIONCODE)
+      return "_ActContainerRegistrationCode";
+    if (code == V3ActCode.ID)
+      return "ID";
+    if (code == V3ActCode.IP)
+      return "IP";
+    if (code == V3ActCode.L)
+      return "L";
+    if (code == V3ActCode.M)
+      return "M";
+    if (code == V3ActCode.O)
+      return "O";
+    if (code == V3ActCode.R)
+      return "R";
+    if (code == V3ActCode.X)
+      return "X";
+    if (code == V3ActCode._ACTCONTROLVARIABLE)
+      return "_ActControlVariable";
+    if (code == V3ActCode.AUTO)
+      return "AUTO";
+    if (code == V3ActCode.ENDC)
+      return "ENDC";
+    if (code == V3ActCode.REFLEX)
+      return "REFLEX";
+    if (code == V3ActCode._ACTCOVERAGECONFIRMATIONCODE)
+      return "_ActCoverageConfirmationCode";
+    if (code == V3ActCode._ACTCOVERAGEAUTHORIZATIONCONFIRMATIONCODE)
+      return "_ActCoverageAuthorizationConfirmationCode";
+    if (code == V3ActCode.AUTH)
+      return "AUTH";
+    if (code == V3ActCode.NAUTH)
+      return "NAUTH";
+    if (code == V3ActCode._ACTCOVERAGEELIGIBILITYCONFIRMATIONCODE)
+      return "_ActCoverageEligibilityConfirmationCode";
+    if (code == V3ActCode.ELG)
+      return "ELG";
+    if (code == V3ActCode.NELG)
+      return "NELG";
+    if (code == V3ActCode._ACTCOVERAGELIMITCODE)
+      return "_ActCoverageLimitCode";
+    if (code == V3ActCode._ACTCOVERAGEQUANTITYLIMITCODE)
+      return "_ActCoverageQuantityLimitCode";
+    if (code == V3ActCode.COVPRD)
+      return "COVPRD";
+    if (code == V3ActCode.LFEMX)
+      return "LFEMX";
+    if (code == V3ActCode.NETAMT)
+      return "NETAMT";
+    if (code == V3ActCode.PRDMX)
+      return "PRDMX";
+    if (code == V3ActCode.UNITPRICE)
+      return "UNITPRICE";
+    if (code == V3ActCode.UNITQTY)
+      return "UNITQTY";
+    if (code == V3ActCode.COVMX)
+      return "COVMX";
+    if (code == V3ActCode._ACTCOVEREDPARTYLIMITCODE)
+      return "_ActCoveredPartyLimitCode";
+    if (code == V3ActCode._ACTCOVERAGETYPECODE)
+      return "_ActCoverageTypeCode";
+    if (code == V3ActCode._ACTINSURANCEPOLICYCODE)
+      return "_ActInsurancePolicyCode";
+    if (code == V3ActCode.EHCPOL)
+      return "EHCPOL";
+    if (code == V3ActCode.HSAPOL)
+      return "HSAPOL";
+    if (code == V3ActCode.AUTOPOL)
+      return "AUTOPOL";
+    if (code == V3ActCode.COL)
+      return "COL";
+    if (code == V3ActCode.UNINSMOT)
+      return "UNINSMOT";
+    if (code == V3ActCode.PUBLICPOL)
+      return "PUBLICPOL";
+    if (code == V3ActCode.DENTPRG)
+      return "DENTPRG";
+    if (code == V3ActCode.DISEASEPRG)
+      return "DISEASEPRG";
+    if (code == V3ActCode.CANPRG)
+      return "CANPRG";
+    if (code == V3ActCode.ENDRENAL)
+      return "ENDRENAL";
+    if (code == V3ActCode.HIVAIDS)
+      return "HIVAIDS";
+    if (code == V3ActCode.MANDPOL)
+      return "MANDPOL";
+    if (code == V3ActCode.MENTPRG)
+      return "MENTPRG";
+    if (code == V3ActCode.SAFNET)
+      return "SAFNET";
+    if (code == V3ActCode.SUBPRG)
+      return "SUBPRG";
+    if (code == V3ActCode.SUBSIDIZ)
+      return "SUBSIDIZ";
+    if (code == V3ActCode.SUBSIDMC)
+      return "SUBSIDMC";
+    if (code == V3ActCode.SUBSUPP)
+      return "SUBSUPP";
+    if (code == V3ActCode.WCBPOL)
+      return "WCBPOL";
+    if (code == V3ActCode._ACTINSURANCETYPECODE)
+      return "_ActInsuranceTypeCode";
+    if (code == V3ActCode._ACTHEALTHINSURANCETYPECODE)
+      return "_ActHealthInsuranceTypeCode";
+    if (code == V3ActCode.DENTAL)
+      return "DENTAL";
+    if (code == V3ActCode.DISEASE)
+      return "DISEASE";
+    if (code == V3ActCode.DRUGPOL)
+      return "DRUGPOL";
+    if (code == V3ActCode.HIP)
+      return "HIP";
+    if (code == V3ActCode.LTC)
+      return "LTC";
+    if (code == V3ActCode.MCPOL)
+      return "MCPOL";
+    if (code == V3ActCode.POS)
+      return "POS";
+    if (code == V3ActCode.HMO)
+      return "HMO";
+    if (code == V3ActCode.PPO)
+      return "PPO";
+    if (code == V3ActCode.MENTPOL)
+      return "MENTPOL";
+    if (code == V3ActCode.SUBPOL)
+      return "SUBPOL";
+    if (code == V3ActCode.VISPOL)
+      return "VISPOL";
+    if (code == V3ActCode.DIS)
+      return "DIS";
+    if (code == V3ActCode.EWB)
+      return "EWB";
+    if (code == V3ActCode.FLEXP)
+      return "FLEXP";
+    if (code == V3ActCode.LIFE)
+      return "LIFE";
+    if (code == V3ActCode.ANNU)
+      return "ANNU";
+    if (code == V3ActCode.TLIFE)
+      return "TLIFE";
+    if (code == V3ActCode.ULIFE)
+      return "ULIFE";
+    if (code == V3ActCode.PNC)
+      return "PNC";
+    if (code == V3ActCode.REI)
+      return "REI";
+    if (code == V3ActCode.SURPL)
+      return "SURPL";
+    if (code == V3ActCode.UMBRL)
+      return "UMBRL";
+    if (code == V3ActCode._ACTPROGRAMTYPECODE)
+      return "_ActProgramTypeCode";
+    if (code == V3ActCode.CHAR)
+      return "CHAR";
+    if (code == V3ActCode.CRIME)
+      return "CRIME";
+    if (code == V3ActCode.EAP)
+      return "EAP";
+    if (code == V3ActCode.GOVEMP)
+      return "GOVEMP";
+    if (code == V3ActCode.HIRISK)
+      return "HIRISK";
+    if (code == V3ActCode.IND)
+      return "IND";
+    if (code == V3ActCode.MILITARY)
+      return "MILITARY";
+    if (code == V3ActCode.RETIRE)
+      return "RETIRE";
+    if (code == V3ActCode.SOCIAL)
+      return "SOCIAL";
+    if (code == V3ActCode.VET)
+      return "VET";
+    if (code == V3ActCode._ACTDETECTEDISSUEMANAGEMENTCODE)
+      return "_ActDetectedIssueManagementCode";
+    if (code == V3ActCode._ACTADMINISTRATIVEDETECTEDISSUEMANAGEMENTCODE)
+      return "_ActAdministrativeDetectedIssueManagementCode";
+    if (code == V3ActCode._AUTHORIZATIONISSUEMANAGEMENTCODE)
+      return "_AuthorizationIssueManagementCode";
+    if (code == V3ActCode.EMAUTH)
+      return "EMAUTH";
+    if (code == V3ActCode._21)
+      return "21";
+    if (code == V3ActCode._1)
+      return "1";
+    if (code == V3ActCode._19)
+      return "19";
+    if (code == V3ActCode._2)
+      return "2";
+    if (code == V3ActCode._22)
+      return "22";
+    if (code == V3ActCode._23)
+      return "23";
+    if (code == V3ActCode._3)
+      return "3";
+    if (code == V3ActCode._4)
+      return "4";
+    if (code == V3ActCode._5)
+      return "5";
+    if (code == V3ActCode._6)
+      return "6";
+    if (code == V3ActCode._7)
+      return "7";
+    if (code == V3ActCode._14)
+      return "14";
+    if (code == V3ActCode._15)
+      return "15";
+    if (code == V3ActCode._16)
+      return "16";
+    if (code == V3ActCode._17)
+      return "17";
+    if (code == V3ActCode._18)
+      return "18";
+    if (code == V3ActCode._20)
+      return "20";
+    if (code == V3ActCode._8)
+      return "8";
+    if (code == V3ActCode._10)
+      return "10";
+    if (code == V3ActCode._11)
+      return "11";
+    if (code == V3ActCode._12)
+      return "12";
+    if (code == V3ActCode._13)
+      return "13";
+    if (code == V3ActCode._9)
+      return "9";
+    if (code == V3ActCode._ACTEXPOSURECODE)
+      return "_ActExposureCode";
+    if (code == V3ActCode.CHLDCARE)
+      return "CHLDCARE";
+    if (code == V3ActCode.CONVEYNC)
+      return "CONVEYNC";
+    if (code == V3ActCode.HLTHCARE)
+      return "HLTHCARE";
+    if (code == V3ActCode.HOMECARE)
+      return "HOMECARE";
+    if (code == V3ActCode.HOSPPTNT)
+      return "HOSPPTNT";
+    if (code == V3ActCode.HOSPVSTR)
+      return "HOSPVSTR";
+    if (code == V3ActCode.HOUSEHLD)
+      return "HOUSEHLD";
+    if (code == V3ActCode.INMATE)
+      return "INMATE";
+    if (code == V3ActCode.INTIMATE)
+      return "INTIMATE";
+    if (code == V3ActCode.LTRMCARE)
+      return "LTRMCARE";
+    if (code == V3ActCode.PLACE)
+      return "PLACE";
+    if (code == V3ActCode.PTNTCARE)
+      return "PTNTCARE";
+    if (code == V3ActCode.SCHOOL2)
+      return "SCHOOL2";
+    if (code == V3ActCode.SOCIAL2)
+      return "SOCIAL2";
+    if (code == V3ActCode.SUBSTNCE)
+      return "SUBSTNCE";
+    if (code == V3ActCode.TRAVINT)
+      return "TRAVINT";
+    if (code == V3ActCode.WORK2)
+      return "WORK2";
+    if (code == V3ActCode._ACTFINANCIALTRANSACTIONCODE)
+      return "_ActFinancialTransactionCode";
+    if (code == V3ActCode.CHRG)
+      return "CHRG";
+    if (code == V3ActCode.REV)
+      return "REV";
+    if (code == V3ActCode._ACTINCIDENTCODE)
+      return "_ActIncidentCode";
+    if (code == V3ActCode.MVA)
+      return "MVA";
+    if (code == V3ActCode.SCHOOL)
+      return "SCHOOL";
+    if (code == V3ActCode.SPT)
+      return "SPT";
+    if (code == V3ActCode.WPA)
+      return "WPA";
+    if (code == V3ActCode._ACTINFORMATIONACCESSCODE)
+      return "_ActInformationAccessCode";
+    if (code == V3ActCode.ACADR)
+      return "ACADR";
+    if (code == V3ActCode.ACALL)
+      return "ACALL";
+    if (code == V3ActCode.ACALLG)
+      return "ACALLG";
+    if (code == V3ActCode.ACCONS)
+      return "ACCONS";
+    if (code == V3ActCode.ACDEMO)
+      return "ACDEMO";
+    if (code == V3ActCode.ACDI)
+      return "ACDI";
+    if (code == V3ActCode.ACIMMUN)
+      return "ACIMMUN";
+    if (code == V3ActCode.ACLAB)
+      return "ACLAB";
+    if (code == V3ActCode.ACMED)
+      return "ACMED";
+    if (code == V3ActCode.ACMEDC)
+      return "ACMEDC";
+    if (code == V3ActCode.ACMEN)
+      return "ACMEN";
+    if (code == V3ActCode.ACOBS)
+      return "ACOBS";
+    if (code == V3ActCode.ACPOLPRG)
+      return "ACPOLPRG";
+    if (code == V3ActCode.ACPROV)
+      return "ACPROV";
+    if (code == V3ActCode.ACPSERV)
+      return "ACPSERV";
+    if (code == V3ActCode.ACSUBSTAB)
+      return "ACSUBSTAB";
+    if (code == V3ActCode._ACTINFORMATIONACCESSCONTEXTCODE)
+      return "_ActInformationAccessContextCode";
+    if (code == V3ActCode.INFAUT)
+      return "INFAUT";
+    if (code == V3ActCode.INFCON)
+      return "INFCON";
+    if (code == V3ActCode.INFCRT)
+      return "INFCRT";
+    if (code == V3ActCode.INFDNG)
+      return "INFDNG";
+    if (code == V3ActCode.INFEMER)
+      return "INFEMER";
+    if (code == V3ActCode.INFPWR)
+      return "INFPWR";
+    if (code == V3ActCode.INFREG)
+      return "INFREG";
+    if (code == V3ActCode._ACTINFORMATIONCATEGORYCODE)
+      return "_ActInformationCategoryCode";
+    if (code == V3ActCode.ALLCAT)
+      return "ALLCAT";
+    if (code == V3ActCode.ALLGCAT)
+      return "ALLGCAT";
+    if (code == V3ActCode.ARCAT)
+      return "ARCAT";
+    if (code == V3ActCode.COBSCAT)
+      return "COBSCAT";
+    if (code == V3ActCode.DEMOCAT)
+      return "DEMOCAT";
+    if (code == V3ActCode.DICAT)
+      return "DICAT";
+    if (code == V3ActCode.IMMUCAT)
+      return "IMMUCAT";
+    if (code == V3ActCode.LABCAT)
+      return "LABCAT";
+    if (code == V3ActCode.MEDCCAT)
+      return "MEDCCAT";
+    if (code == V3ActCode.MENCAT)
+      return "MENCAT";
+    if (code == V3ActCode.PSVCCAT)
+      return "PSVCCAT";
+    if (code == V3ActCode.RXCAT)
+      return "RXCAT";
+    if (code == V3ActCode._ACTINVOICEELEMENTCODE)
+      return "_ActInvoiceElementCode";
+    if (code == V3ActCode._ACTINVOICEADJUDICATIONPAYMENTCODE)
+      return "_ActInvoiceAdjudicationPaymentCode";
+    if (code == V3ActCode._ACTINVOICEADJUDICATIONPAYMENTGROUPCODE)
+      return "_ActInvoiceAdjudicationPaymentGroupCode";
+    if (code == V3ActCode.ALEC)
+      return "ALEC";
+    if (code == V3ActCode.BONUS)
+      return "BONUS";
+    if (code == V3ActCode.CFWD)
+      return "CFWD";
+    if (code == V3ActCode.EDU)
+      return "EDU";
+    if (code == V3ActCode.EPYMT)
+      return "EPYMT";
+    if (code == V3ActCode.GARN)
+      return "GARN";
+    if (code == V3ActCode.INVOICE)
+      return "INVOICE";
+    if (code == V3ActCode.PINV)
+      return "PINV";
+    if (code == V3ActCode.PPRD)
+      return "PPRD";
+    if (code == V3ActCode.PROA)
+      return "PROA";
+    if (code == V3ActCode.RECOV)
+      return "RECOV";
+    if (code == V3ActCode.RETRO)
+      return "RETRO";
+    if (code == V3ActCode.TRAN)
+      return "TRAN";
+    if (code == V3ActCode._ACTINVOICEADJUDICATIONPAYMENTSUMMARYCODE)
+      return "_ActInvoiceAdjudicationPaymentSummaryCode";
+    if (code == V3ActCode.INVTYPE)
+      return "INVTYPE";
+    if (code == V3ActCode.PAYEE)
+      return "PAYEE";
+    if (code == V3ActCode.PAYOR)
+      return "PAYOR";
+    if (code == V3ActCode.SENDAPP)
+      return "SENDAPP";
+    if (code == V3ActCode._ACTINVOICEDETAILCODE)
+      return "_ActInvoiceDetailCode";
+    if (code == V3ActCode._ACTINVOICEDETAILCLINICALPRODUCTCODE)
+      return "_ActInvoiceDetailClinicalProductCode";
+    if (code == V3ActCode.UNSPSC)
+      return "UNSPSC";
+    if (code == V3ActCode._ACTINVOICEDETAILDRUGPRODUCTCODE)
+      return "_ActInvoiceDetailDrugProductCode";
+    if (code == V3ActCode.GTIN)
+      return "GTIN";
+    if (code == V3ActCode.UPC)
+      return "UPC";
+    if (code == V3ActCode._ACTINVOICEDETAILGENERICCODE)
+      return "_ActInvoiceDetailGenericCode";
+    if (code == V3ActCode._ACTINVOICEDETAILGENERICADJUDICATORCODE)
+      return "_ActInvoiceDetailGenericAdjudicatorCode";
+    if (code == V3ActCode.COIN)
+      return "COIN";
+    if (code == V3ActCode.COPAYMENT)
+      return "COPAYMENT";
+    if (code == V3ActCode.DEDUCTIBLE)
+      return "DEDUCTIBLE";
+    if (code == V3ActCode.PAY)
+      return "PAY";
+    if (code == V3ActCode.SPEND)
+      return "SPEND";
+    if (code == V3ActCode.COINS)
+      return "COINS";
+    if (code == V3ActCode._ACTINVOICEDETAILGENERICMODIFIERCODE)
+      return "_ActInvoiceDetailGenericModifierCode";
+    if (code == V3ActCode.AFTHRS)
+      return "AFTHRS";
+    if (code == V3ActCode.ISOL)
+      return "ISOL";
+    if (code == V3ActCode.OOO)
+      return "OOO";
+    if (code == V3ActCode._ACTINVOICEDETAILGENERICPROVIDERCODE)
+      return "_ActInvoiceDetailGenericProviderCode";
+    if (code == V3ActCode.CANCAPT)
+      return "CANCAPT";
+    if (code == V3ActCode.DSC)
+      return "DSC";
+    if (code == V3ActCode.ESA)
+      return "ESA";
+    if (code == V3ActCode.FFSTOP)
+      return "FFSTOP";
+    if (code == V3ActCode.FNLFEE)
+      return "FNLFEE";
+    if (code == V3ActCode.FRSTFEE)
+      return "FRSTFEE";
+    if (code == V3ActCode.MARKUP)
+      return "MARKUP";
+    if (code == V3ActCode.MISSAPT)
+      return "MISSAPT";
+    if (code == V3ActCode.PERFEE)
+      return "PERFEE";
+    if (code == V3ActCode.PERMBNS)
+      return "PERMBNS";
+    if (code == V3ActCode.RESTOCK)
+      return "RESTOCK";
+    if (code == V3ActCode.TRAVEL)
+      return "TRAVEL";
+    if (code == V3ActCode.URGENT)
+      return "URGENT";
+    if (code == V3ActCode._ACTINVOICEDETAILTAXCODE)
+      return "_ActInvoiceDetailTaxCode";
+    if (code == V3ActCode.FST)
+      return "FST";
+    if (code == V3ActCode.HST)
+      return "HST";
+    if (code == V3ActCode.PST)
+      return "PST";
+    if (code == V3ActCode._ACTINVOICEDETAILPREFERREDACCOMMODATIONCODE)
+      return "_ActInvoiceDetailPreferredAccommodationCode";
+    if (code == V3ActCode._ACTENCOUNTERACCOMMODATIONCODE)
+      return "_ActEncounterAccommodationCode";
+    if (code == V3ActCode._HL7ACCOMMODATIONCODE)
+      return "_HL7AccommodationCode";
+    if (code == V3ActCode.I)
+      return "I";
+    if (code == V3ActCode.P)
+      return "P";
+    if (code == V3ActCode.S)
+      return "S";
+    if (code == V3ActCode.SP)
+      return "SP";
+    if (code == V3ActCode.W)
+      return "W";
+    if (code == V3ActCode._ACTINVOICEDETAILCLINICALSERVICECODE)
+      return "_ActInvoiceDetailClinicalServiceCode";
+    if (code == V3ActCode._ACTINVOICEGROUPCODE)
+      return "_ActInvoiceGroupCode";
+    if (code == V3ActCode._ACTINVOICEINTERGROUPCODE)
+      return "_ActInvoiceInterGroupCode";
+    if (code == V3ActCode.CPNDDRGING)
+      return "CPNDDRGING";
+    if (code == V3ActCode.CPNDINDING)
+      return "CPNDINDING";
+    if (code == V3ActCode.CPNDSUPING)
+      return "CPNDSUPING";
+    if (code == V3ActCode.DRUGING)
+      return "DRUGING";
+    if (code == V3ActCode.FRAMEING)
+      return "FRAMEING";
+    if (code == V3ActCode.LENSING)
+      return "LENSING";
+    if (code == V3ActCode.PRDING)
+      return "PRDING";
+    if (code == V3ActCode._ACTINVOICEROOTGROUPCODE)
+      return "_ActInvoiceRootGroupCode";
+    if (code == V3ActCode.CPINV)
+      return "CPINV";
+    if (code == V3ActCode.CSINV)
+      return "CSINV";
+    if (code == V3ActCode.CSPINV)
+      return "CSPINV";
+    if (code == V3ActCode.FININV)
+      return "FININV";
+    if (code == V3ActCode.OHSINV)
+      return "OHSINV";
+    if (code == V3ActCode.PAINV)
+      return "PAINV";
+    if (code == V3ActCode.RXCINV)
+      return "RXCINV";
+    if (code == V3ActCode.RXDINV)
+      return "RXDINV";
+    if (code == V3ActCode.SBFINV)
+      return "SBFINV";
+    if (code == V3ActCode.VRXINV)
+      return "VRXINV";
+    if (code == V3ActCode._ACTINVOICEELEMENTSUMMARYCODE)
+      return "_ActInvoiceElementSummaryCode";
+    if (code == V3ActCode._INVOICEELEMENTADJUDICATED)
+      return "_InvoiceElementAdjudicated";
+    if (code == V3ActCode.ADNFPPELAT)
+      return "ADNFPPELAT";
+    if (code == V3ActCode.ADNFPPELCT)
+      return "ADNFPPELCT";
+    if (code == V3ActCode.ADNFPPMNAT)
+      return "ADNFPPMNAT";
+    if (code == V3ActCode.ADNFPPMNCT)
+      return "ADNFPPMNCT";
+    if (code == V3ActCode.ADNFSPELAT)
+      return "ADNFSPELAT";
+    if (code == V3ActCode.ADNFSPELCT)
+      return "ADNFSPELCT";
+    if (code == V3ActCode.ADNFSPMNAT)
+      return "ADNFSPMNAT";
+    if (code == V3ActCode.ADNFSPMNCT)
+      return "ADNFSPMNCT";
+    if (code == V3ActCode.ADNPPPELAT)
+      return "ADNPPPELAT";
+    if (code == V3ActCode.ADNPPPELCT)
+      return "ADNPPPELCT";
+    if (code == V3ActCode.ADNPPPMNAT)
+      return "ADNPPPMNAT";
+    if (code == V3ActCode.ADNPPPMNCT)
+      return "ADNPPPMNCT";
+    if (code == V3ActCode.ADNPSPELAT)
+      return "ADNPSPELAT";
+    if (code == V3ActCode.ADNPSPELCT)
+      return "ADNPSPELCT";
+    if (code == V3ActCode.ADNPSPMNAT)
+      return "ADNPSPMNAT";
+    if (code == V3ActCode.ADNPSPMNCT)
+      return "ADNPSPMNCT";
+    if (code == V3ActCode.ADPPPPELAT)
+      return "ADPPPPELAT";
+    if (code == V3ActCode.ADPPPPELCT)
+      return "ADPPPPELCT";
+    if (code == V3ActCode.ADPPPPMNAT)
+      return "ADPPPPMNAT";
+    if (code == V3ActCode.ADPPPPMNCT)
+      return "ADPPPPMNCT";
+    if (code == V3ActCode.ADPPSPELAT)
+      return "ADPPSPELAT";
+    if (code == V3ActCode.ADPPSPELCT)
+      return "ADPPSPELCT";
+    if (code == V3ActCode.ADPPSPMNAT)
+      return "ADPPSPMNAT";
+    if (code == V3ActCode.ADPPSPMNCT)
+      return "ADPPSPMNCT";
+    if (code == V3ActCode.ADRFPPELAT)
+      return "ADRFPPELAT";
+    if (code == V3ActCode.ADRFPPELCT)
+      return "ADRFPPELCT";
+    if (code == V3ActCode.ADRFPPMNAT)
+      return "ADRFPPMNAT";
+    if (code == V3ActCode.ADRFPPMNCT)
+      return "ADRFPPMNCT";
+    if (code == V3ActCode.ADRFSPELAT)
+      return "ADRFSPELAT";
+    if (code == V3ActCode.ADRFSPELCT)
+      return "ADRFSPELCT";
+    if (code == V3ActCode.ADRFSPMNAT)
+      return "ADRFSPMNAT";
+    if (code == V3ActCode.ADRFSPMNCT)
+      return "ADRFSPMNCT";
+    if (code == V3ActCode._INVOICEELEMENTPAID)
+      return "_InvoiceElementPaid";
+    if (code == V3ActCode.PDNFPPELAT)
+      return "PDNFPPELAT";
+    if (code == V3ActCode.PDNFPPELCT)
+      return "PDNFPPELCT";
+    if (code == V3ActCode.PDNFPPMNAT)
+      return "PDNFPPMNAT";
+    if (code == V3ActCode.PDNFPPMNCT)
+      return "PDNFPPMNCT";
+    if (code == V3ActCode.PDNFSPELAT)
+      return "PDNFSPELAT";
+    if (code == V3ActCode.PDNFSPELCT)
+      return "PDNFSPELCT";
+    if (code == V3ActCode.PDNFSPMNAT)
+      return "PDNFSPMNAT";
+    if (code == V3ActCode.PDNFSPMNCT)
+      return "PDNFSPMNCT";
+    if (code == V3ActCode.PDNPPPELAT)
+      return "PDNPPPELAT";
+    if (code == V3ActCode.PDNPPPELCT)
+      return "PDNPPPELCT";
+    if (code == V3ActCode.PDNPPPMNAT)
+      return "PDNPPPMNAT";
+    if (code == V3ActCode.PDNPPPMNCT)
+      return "PDNPPPMNCT";
+    if (code == V3ActCode.PDNPSPELAT)
+      return "PDNPSPELAT";
+    if (code == V3ActCode.PDNPSPELCT)
+      return "PDNPSPELCT";
+    if (code == V3ActCode.PDNPSPMNAT)
+      return "PDNPSPMNAT";
+    if (code == V3ActCode.PDNPSPMNCT)
+      return "PDNPSPMNCT";
+    if (code == V3ActCode.PDPPPPELAT)
+      return "PDPPPPELAT";
+    if (code == V3ActCode.PDPPPPELCT)
+      return "PDPPPPELCT";
+    if (code == V3ActCode.PDPPPPMNAT)
+      return "PDPPPPMNAT";
+    if (code == V3ActCode.PDPPPPMNCT)
+      return "PDPPPPMNCT";
+    if (code == V3ActCode.PDPPSPELAT)
+      return "PDPPSPELAT";
+    if (code == V3ActCode.PDPPSPELCT)
+      return "PDPPSPELCT";
+    if (code == V3ActCode.PDPPSPMNAT)
+      return "PDPPSPMNAT";
+    if (code == V3ActCode.PDPPSPMNCT)
+      return "PDPPSPMNCT";
+    if (code == V3ActCode._INVOICEELEMENTSUBMITTED)
+      return "_InvoiceElementSubmitted";
+    if (code == V3ActCode.SBBLELAT)
+      return "SBBLELAT";
+    if (code == V3ActCode.SBBLELCT)
+      return "SBBLELCT";
+    if (code == V3ActCode.SBNFELAT)
+      return "SBNFELAT";
+    if (code == V3ActCode.SBNFELCT)
+      return "SBNFELCT";
+    if (code == V3ActCode.SBPDELAT)
+      return "SBPDELAT";
+    if (code == V3ActCode.SBPDELCT)
+      return "SBPDELCT";
+    if (code == V3ActCode._ACTINVOICEOVERRIDECODE)
+      return "_ActInvoiceOverrideCode";
+    if (code == V3ActCode.COVGE)
+      return "COVGE";
+    if (code == V3ActCode.EFORM)
+      return "EFORM";
+    if (code == V3ActCode.FAX)
+      return "FAX";
+    if (code == V3ActCode.GFTH)
+      return "GFTH";
+    if (code == V3ActCode.LATE)
+      return "LATE";
+    if (code == V3ActCode.MANUAL)
+      return "MANUAL";
+    if (code == V3ActCode.OOJ)
+      return "OOJ";
+    if (code == V3ActCode.ORTHO)
+      return "ORTHO";
+    if (code == V3ActCode.PAPER)
+      return "PAPER";
+    if (code == V3ActCode.PIE)
+      return "PIE";
+    if (code == V3ActCode.PYRDELAY)
+      return "PYRDELAY";
+    if (code == V3ActCode.REFNR)
+      return "REFNR";
+    if (code == V3ActCode.REPSERV)
+      return "REPSERV";
+    if (code == V3ActCode.UNRELAT)
+      return "UNRELAT";
+    if (code == V3ActCode.VERBAUTH)
+      return "VERBAUTH";
+    if (code == V3ActCode._ACTLISTCODE)
+      return "_ActListCode";
+    if (code == V3ActCode._ACTOBSERVATIONLIST)
+      return "_ActObservationList";
+    if (code == V3ActCode.CARELIST)
+      return "CARELIST";
+    if (code == V3ActCode.CONDLIST)
+      return "CONDLIST";
+    if (code == V3ActCode.INTOLIST)
+      return "INTOLIST";
+    if (code == V3ActCode.PROBLIST)
+      return "PROBLIST";
+    if (code == V3ActCode.RISKLIST)
+      return "RISKLIST";
+    if (code == V3ActCode.GOALLIST)
+      return "GOALLIST";
+    if (code == V3ActCode._ACTTHERAPYDURATIONWORKINGLISTCODE)
+      return "_ActTherapyDurationWorkingListCode";
+    if (code == V3ActCode._ACTMEDICATIONTHERAPYDURATIONWORKINGLISTCODE)
+      return "_ActMedicationTherapyDurationWorkingListCode";
+    if (code == V3ActCode.ACU)
+      return "ACU";
+    if (code == V3ActCode.CHRON)
+      return "CHRON";
+    if (code == V3ActCode.ONET)
+      return "ONET";
+    if (code == V3ActCode.PRN)
+      return "PRN";
+    if (code == V3ActCode.MEDLIST)
+      return "MEDLIST";
+    if (code == V3ActCode.CURMEDLIST)
+      return "CURMEDLIST";
+    if (code == V3ActCode.DISCMEDLIST)
+      return "DISCMEDLIST";
+    if (code == V3ActCode.HISTMEDLIST)
+      return "HISTMEDLIST";
+    if (code == V3ActCode._ACTMONITORINGPROTOCOLCODE)
+      return "_ActMonitoringProtocolCode";
+    if (code == V3ActCode.CTLSUB)
+      return "CTLSUB";
+    if (code == V3ActCode.INV)
+      return "INV";
+    if (code == V3ActCode.LU)
+      return "LU";
+    if (code == V3ActCode.OTC)
+      return "OTC";
+    if (code == V3ActCode.RX)
+      return "RX";
+    if (code == V3ActCode.SA)
+      return "SA";
+    if (code == V3ActCode.SAC)
+      return "SAC";
+    if (code == V3ActCode._ACTNONOBSERVATIONINDICATIONCODE)
+      return "_ActNonObservationIndicationCode";
+    if (code == V3ActCode.IND01)
+      return "IND01";
+    if (code == V3ActCode.IND02)
+      return "IND02";
+    if (code == V3ActCode.IND03)
+      return "IND03";
+    if (code == V3ActCode.IND04)
+      return "IND04";
+    if (code == V3ActCode.IND05)
+      return "IND05";
+    if (code == V3ActCode._ACTOBSERVATIONVERIFICATIONTYPE)
+      return "_ActObservationVerificationType";
+    if (code == V3ActCode.VFPAPER)
+      return "VFPAPER";
+    if (code == V3ActCode._ACTPAYMENTCODE)
+      return "_ActPaymentCode";
+    if (code == V3ActCode.ACH)
+      return "ACH";
+    if (code == V3ActCode.CHK)
+      return "CHK";
+    if (code == V3ActCode.DDP)
+      return "DDP";
+    if (code == V3ActCode.NON)
+      return "NON";
+    if (code == V3ActCode._ACTPHARMACYSUPPLYTYPE)
+      return "_ActPharmacySupplyType";
+    if (code == V3ActCode.DF)
+      return "DF";
+    if (code == V3ActCode.EM)
+      return "EM";
+    if (code == V3ActCode.SO)
+      return "SO";
+    if (code == V3ActCode.FF)
+      return "FF";
+    if (code == V3ActCode.FFC)
+      return "FFC";
+    if (code == V3ActCode.FFP)
+      return "FFP";
+    if (code == V3ActCode.FFSS)
+      return "FFSS";
+    if (code == V3ActCode.TF)
+      return "TF";
+    if (code == V3ActCode.FS)
+      return "FS";
+    if (code == V3ActCode.MS)
+      return "MS";
+    if (code == V3ActCode.RF)
+      return "RF";
+    if (code == V3ActCode.UD)
+      return "UD";
+    if (code == V3ActCode.RFC)
+      return "RFC";
+    if (code == V3ActCode.RFCS)
+      return "RFCS";
+    if (code == V3ActCode.RFF)
+      return "RFF";
+    if (code == V3ActCode.RFFS)
+      return "RFFS";
+    if (code == V3ActCode.RFP)
+      return "RFP";
+    if (code == V3ActCode.RFPS)
+      return "RFPS";
+    if (code == V3ActCode.RFS)
+      return "RFS";
+    if (code == V3ActCode.TB)
+      return "TB";
+    if (code == V3ActCode.TBS)
+      return "TBS";
+    if (code == V3ActCode.UDE)
+      return "UDE";
+    if (code == V3ActCode._ACTPOLICYTYPE)
+      return "_ActPolicyType";
+    if (code == V3ActCode._ACTPRIVACYPOLICY)
+      return "_ActPrivacyPolicy";
+    if (code == V3ActCode._ACTCONSENTDIRECTIVE)
+      return "_ActConsentDirective";
+    if (code == V3ActCode.EMRGONLY)
+      return "EMRGONLY";
+    if (code == V3ActCode.GRANTORCHOICE)
+      return "GRANTORCHOICE";
+    if (code == V3ActCode.IMPLIED)
+      return "IMPLIED";
+    if (code == V3ActCode.IMPLIEDD)
+      return "IMPLIEDD";
+    if (code == V3ActCode.NOCONSENT)
+      return "NOCONSENT";
+    if (code == V3ActCode.NOPP)
+      return "NOPP";
+    if (code == V3ActCode.OPTIN)
+      return "OPTIN";
+    if (code == V3ActCode.OPTINR)
+      return "OPTINR";
+    if (code == V3ActCode.OPTOUT)
+      return "OPTOUT";
+    if (code == V3ActCode.OPTOUTE)
+      return "OPTOUTE";
+    if (code == V3ActCode._ACTPRIVACYLAW)
+      return "_ActPrivacyLaw";
+    if (code == V3ActCode._ACTUSPRIVACYLAW)
+      return "_ActUSPrivacyLaw";
+    if (code == V3ActCode._42CFRPART2)
+      return "42CFRPart2";
+    if (code == V3ActCode.COMMONRULE)
+      return "CommonRule";
+    if (code == V3ActCode.HIPAANOPP)
+      return "HIPAANOPP";
+    if (code == V3ActCode.HIPAAPSYNOTES)
+      return "HIPAAPsyNotes";
+    if (code == V3ActCode.HIPAASELFPAY)
+      return "HIPAASelfPay";
+    if (code == V3ActCode.TITLE38SECTION7332)
+      return "Title38Section7332";
+    if (code == V3ActCode._INFORMATIONSENSITIVITYPOLICY)
+      return "_InformationSensitivityPolicy";
+    if (code == V3ActCode._ACTINFORMATIONSENSITIVITYPOLICY)
+      return "_ActInformationSensitivityPolicy";
+    if (code == V3ActCode.ETH)
+      return "ETH";
+    if (code == V3ActCode.GDIS)
+      return "GDIS";
+    if (code == V3ActCode.HIV)
+      return "HIV";
+    if (code == V3ActCode.PSY)
+      return "PSY";
+    if (code == V3ActCode.SCA)
+      return "SCA";
+    if (code == V3ActCode.SOC)
+      return "SOC";
+    if (code == V3ActCode.SDV)
+      return "SDV";
+    if (code == V3ActCode.SEX)
+      return "SEX";
+    if (code == V3ActCode.STD)
+      return "STD";
+    if (code == V3ActCode.TBOO)
+      return "TBOO";
+    if (code == V3ActCode.SICKLE)
+      return "SICKLE";
+    if (code == V3ActCode._ENTITYSENSITIVITYPOLICYTYPE)
+      return "_EntitySensitivityPolicyType";
+    if (code == V3ActCode.DEMO)
+      return "DEMO";
+    if (code == V3ActCode.DOB)
+      return "DOB";
+    if (code == V3ActCode.GENDER)
+      return "GENDER";
+    if (code == V3ActCode.LIVARG)
+      return "LIVARG";
+    if (code == V3ActCode.MARST)
+      return "MARST";
+    if (code == V3ActCode.RACE)
+      return "RACE";
+    if (code == V3ActCode.REL)
+      return "REL";
+    if (code == V3ActCode._ROLEINFORMATIONSENSITIVITYPOLICY)
+      return "_RoleInformationSensitivityPolicy";
+    if (code == V3ActCode.B)
+      return "B";
+    if (code == V3ActCode.EMPL)
+      return "EMPL";
+    if (code == V3ActCode.LOCIS)
+      return "LOCIS";
+    if (code == V3ActCode.SSP)
+      return "SSP";
+    if (code == V3ActCode.ADOL)
+      return "ADOL";
+    if (code == V3ActCode.CEL)
+      return "CEL";
+    if (code == V3ActCode.DIA)
+      return "DIA";
+    if (code == V3ActCode.DRGIS)
+      return "DRGIS";
+    if (code == V3ActCode.EMP)
+      return "EMP";
+    if (code == V3ActCode.PDS)
+      return "PDS";
+    if (code == V3ActCode.PRS)
+      return "PRS";
+    if (code == V3ActCode.COMPT)
+      return "COMPT";
+    if (code == V3ActCode.HRCOMPT)
+      return "HRCOMPT";
+    if (code == V3ActCode.RESCOMPT)
+      return "RESCOMPT";
+    if (code == V3ActCode.RMGTCOMPT)
+      return "RMGTCOMPT";
+    if (code == V3ActCode.ACTTRUSTPOLICYTYPE)
+      return "ActTrustPolicyType";
+    if (code == V3ActCode.TRSTACCRD)
+      return "TRSTACCRD";
+    if (code == V3ActCode.TRSTAGRE)
+      return "TRSTAGRE";
+    if (code == V3ActCode.TRSTASSUR)
+      return "TRSTASSUR";
+    if (code == V3ActCode.TRSTCERT)
+      return "TRSTCERT";
+    if (code == V3ActCode.TRSTFWK)
+      return "TRSTFWK";
+    if (code == V3ActCode.TRSTMEC)
+      return "TRSTMEC";
+    if (code == V3ActCode.COVPOL)
+      return "COVPOL";
+    if (code == V3ActCode.SECURITYPOLICY)
+      return "SecurityPolicy";
+    if (code == V3ActCode.OBLIGATIONPOLICY)
+      return "ObligationPolicy";
+    if (code == V3ActCode.ANONY)
+      return "ANONY";
+    if (code == V3ActCode.AOD)
+      return "AOD";
+    if (code == V3ActCode.AUDIT)
+      return "AUDIT";
+    if (code == V3ActCode.AUDTR)
+      return "AUDTR";
+    if (code == V3ActCode.CPLYCC)
+      return "CPLYCC";
+    if (code == V3ActCode.CPLYCD)
+      return "CPLYCD";
+    if (code == V3ActCode.CPLYJPP)
+      return "CPLYJPP";
+    if (code == V3ActCode.CPLYOPP)
+      return "CPLYOPP";
+    if (code == V3ActCode.CPLYOSP)
+      return "CPLYOSP";
+    if (code == V3ActCode.CPLYPOL)
+      return "CPLYPOL";
+    if (code == V3ActCode.DECLASSIFYLABEL)
+      return "DECLASSIFYLABEL";
+    if (code == V3ActCode.DEID)
+      return "DEID";
+    if (code == V3ActCode.DELAU)
+      return "DELAU";
+    if (code == V3ActCode.DOWNGRDLABEL)
+      return "DOWNGRDLABEL";
+    if (code == V3ActCode.DRIVLABEL)
+      return "DRIVLABEL";
+    if (code == V3ActCode.ENCRYPT)
+      return "ENCRYPT";
+    if (code == V3ActCode.ENCRYPTR)
+      return "ENCRYPTR";
+    if (code == V3ActCode.ENCRYPTT)
+      return "ENCRYPTT";
+    if (code == V3ActCode.ENCRYPTU)
+      return "ENCRYPTU";
+    if (code == V3ActCode.HUAPRV)
+      return "HUAPRV";
+    if (code == V3ActCode.LABEL)
+      return "LABEL";
+    if (code == V3ActCode.MASK)
+      return "MASK";
+    if (code == V3ActCode.MINEC)
+      return "MINEC";
+    if (code == V3ActCode.PERSISTLABEL)
+      return "PERSISTLABEL";
+    if (code == V3ActCode.PRIVMARK)
+      return "PRIVMARK";
+    if (code == V3ActCode.PSEUD)
+      return "PSEUD";
+    if (code == V3ActCode.REDACT)
+      return "REDACT";
+    if (code == V3ActCode.UPGRDLABEL)
+      return "UPGRDLABEL";
+    if (code == V3ActCode.REFRAINPOLICY)
+      return "RefrainPolicy";
+    if (code == V3ActCode.NOAUTH)
+      return "NOAUTH";
+    if (code == V3ActCode.NOCOLLECT)
+      return "NOCOLLECT";
+    if (code == V3ActCode.NODSCLCD)
+      return "NODSCLCD";
+    if (code == V3ActCode.NODSCLCDS)
+      return "NODSCLCDS";
+    if (code == V3ActCode.NOINTEGRATE)
+      return "NOINTEGRATE";
+    if (code == V3ActCode.NOLIST)
+      return "NOLIST";
+    if (code == V3ActCode.NOMOU)
+      return "NOMOU";
+    if (code == V3ActCode.NOORGPOL)
+      return "NOORGPOL";
+    if (code == V3ActCode.NOPAT)
+      return "NOPAT";
+    if (code == V3ActCode.NOPERSISTP)
+      return "NOPERSISTP";
+    if (code == V3ActCode.NORDSCLCD)
+      return "NORDSCLCD";
+    if (code == V3ActCode.NORDSCLCDS)
+      return "NORDSCLCDS";
+    if (code == V3ActCode.NORDSCLW)
+      return "NORDSCLW";
+    if (code == V3ActCode.NORELINK)
+      return "NORELINK";
+    if (code == V3ActCode.NOREUSE)
+      return "NOREUSE";
+    if (code == V3ActCode.NOVIP)
+      return "NOVIP";
+    if (code == V3ActCode.ORCON)
+      return "ORCON";
+    if (code == V3ActCode._ACTPRODUCTACQUISITIONCODE)
+      return "_ActProductAcquisitionCode";
+    if (code == V3ActCode.LOAN)
+      return "LOAN";
+    if (code == V3ActCode.RENT)
+      return "RENT";
+    if (code == V3ActCode.TRANSFER)
+      return "TRANSFER";
+    if (code == V3ActCode.SALE)
+      return "SALE";
+    if (code == V3ActCode._ACTSPECIMENTRANSPORTCODE)
+      return "_ActSpecimenTransportCode";
+    if (code == V3ActCode.SREC)
+      return "SREC";
+    if (code == V3ActCode.SSTOR)
+      return "SSTOR";
+    if (code == V3ActCode.STRAN)
+      return "STRAN";
+    if (code == V3ActCode._ACTSPECIMENTREATMENTCODE)
+      return "_ActSpecimenTreatmentCode";
+    if (code == V3ActCode.ACID)
+      return "ACID";
+    if (code == V3ActCode.ALK)
+      return "ALK";
+    if (code == V3ActCode.DEFB)
+      return "DEFB";
+    if (code == V3ActCode.FILT)
+      return "FILT";
+    if (code == V3ActCode.LDLP)
+      return "LDLP";
+    if (code == V3ActCode.NEUT)
+      return "NEUT";
+    if (code == V3ActCode.RECA)
+      return "RECA";
+    if (code == V3ActCode.UFIL)
+      return "UFIL";
+    if (code == V3ActCode._ACTSUBSTANCEADMINISTRATIONCODE)
+      return "_ActSubstanceAdministrationCode";
+    if (code == V3ActCode.DRUG)
+      return "DRUG";
+    if (code == V3ActCode.FD)
+      return "FD";
+    if (code == V3ActCode.IMMUNIZ)
+      return "IMMUNIZ";
+    if (code == V3ActCode.BOOSTER)
+      return "BOOSTER";
+    if (code == V3ActCode.INITIMMUNIZ)
+      return "INITIMMUNIZ";
+    if (code == V3ActCode._ACTTASKCODE)
+      return "_ActTaskCode";
+    if (code == V3ActCode.OE)
+      return "OE";
+    if (code == V3ActCode.LABOE)
+      return "LABOE";
+    if (code == V3ActCode.MEDOE)
+      return "MEDOE";
+    if (code == V3ActCode.PATDOC)
+      return "PATDOC";
+    if (code == V3ActCode.ALLERLREV)
+      return "ALLERLREV";
+    if (code == V3ActCode.CLINNOTEE)
+      return "CLINNOTEE";
+    if (code == V3ActCode.DIAGLISTE)
+      return "DIAGLISTE";
+    if (code == V3ActCode.DISCHINSTE)
+      return "DISCHINSTE";
+    if (code == V3ActCode.DISCHSUME)
+      return "DISCHSUME";
+    if (code == V3ActCode.PATEDUE)
+      return "PATEDUE";
+    if (code == V3ActCode.PATREPE)
+      return "PATREPE";
+    if (code == V3ActCode.PROBLISTE)
+      return "PROBLISTE";
+    if (code == V3ActCode.RADREPE)
+      return "RADREPE";
+    if (code == V3ActCode.IMMLREV)
+      return "IMMLREV";
+    if (code == V3ActCode.REMLREV)
+      return "REMLREV";
+    if (code == V3ActCode.WELLREMLREV)
+      return "WELLREMLREV";
+    if (code == V3ActCode.PATINFO)
+      return "PATINFO";
+    if (code == V3ActCode.ALLERLE)
+      return "ALLERLE";
+    if (code == V3ActCode.CDSREV)
+      return "CDSREV";
+    if (code == V3ActCode.CLINNOTEREV)
+      return "CLINNOTEREV";
+    if (code == V3ActCode.DISCHSUMREV)
+      return "DISCHSUMREV";
+    if (code == V3ActCode.DIAGLISTREV)
+      return "DIAGLISTREV";
+    if (code == V3ActCode.IMMLE)
+      return "IMMLE";
+    if (code == V3ActCode.LABRREV)
+      return "LABRREV";
+    if (code == V3ActCode.MICRORREV)
+      return "MICRORREV";
+    if (code == V3ActCode.MICROORGRREV)
+      return "MICROORGRREV";
+    if (code == V3ActCode.MICROSENSRREV)
+      return "MICROSENSRREV";
+    if (code == V3ActCode.MLREV)
+      return "MLREV";
+    if (code == V3ActCode.MARWLREV)
+      return "MARWLREV";
+    if (code == V3ActCode.OREV)
+      return "OREV";
+    if (code == V3ActCode.PATREPREV)
+      return "PATREPREV";
+    if (code == V3ActCode.PROBLISTREV)
+      return "PROBLISTREV";
+    if (code == V3ActCode.RADREPREV)
+      return "RADREPREV";
+    if (code == V3ActCode.REMLE)
+      return "REMLE";
+    if (code == V3ActCode.WELLREMLE)
+      return "WELLREMLE";
+    if (code == V3ActCode.RISKASSESS)
+      return "RISKASSESS";
+    if (code == V3ActCode.FALLRISK)
+      return "FALLRISK";
+    if (code == V3ActCode._ACTTRANSPORTATIONMODECODE)
+      return "_ActTransportationModeCode";
+    if (code == V3ActCode._ACTPATIENTTRANSPORTATIONMODECODE)
+      return "_ActPatientTransportationModeCode";
+    if (code == V3ActCode.AFOOT)
+      return "AFOOT";
+    if (code == V3ActCode.AMBT)
+      return "AMBT";
+    if (code == V3ActCode.AMBAIR)
+      return "AMBAIR";
+    if (code == V3ActCode.AMBGRND)
+      return "AMBGRND";
+    if (code == V3ActCode.AMBHELO)
+      return "AMBHELO";
+    if (code == V3ActCode.LAWENF)
+      return "LAWENF";
+    if (code == V3ActCode.PRVTRN)
+      return "PRVTRN";
+    if (code == V3ActCode.PUBTRN)
+      return "PUBTRN";
+    if (code == V3ActCode._OBSERVATIONTYPE)
+      return "_ObservationType";
+    if (code == V3ActCode._ACTSPECOBSCODE)
+      return "_ActSpecObsCode";
+    if (code == V3ActCode.ARTBLD)
+      return "ARTBLD";
+    if (code == V3ActCode.DILUTION)
+      return "DILUTION";
+    if (code == V3ActCode.AUTOHIGH)
+      return "AUTO-HIGH";
+    if (code == V3ActCode.AUTOLOW)
+      return "AUTO-LOW";
+    if (code == V3ActCode.PRE)
+      return "PRE";
+    if (code == V3ActCode.RERUN)
+      return "RERUN";
+    if (code == V3ActCode.EVNFCTS)
+      return "EVNFCTS";
+    if (code == V3ActCode.INTFR)
+      return "INTFR";
+    if (code == V3ActCode.FIBRIN)
+      return "FIBRIN";
+    if (code == V3ActCode.HEMOLYSIS)
+      return "HEMOLYSIS";
+    if (code == V3ActCode.ICTERUS)
+      return "ICTERUS";
+    if (code == V3ActCode.LIPEMIA)
+      return "LIPEMIA";
+    if (code == V3ActCode.VOLUME)
+      return "VOLUME";
+    if (code == V3ActCode.AVAILABLE)
+      return "AVAILABLE";
+    if (code == V3ActCode.CONSUMPTION)
+      return "CONSUMPTION";
+    if (code == V3ActCode.CURRENT)
+      return "CURRENT";
+    if (code == V3ActCode.INITIAL)
+      return "INITIAL";
+    if (code == V3ActCode._ANNOTATIONTYPE)
+      return "_AnnotationType";
+    if (code == V3ActCode._ACTPATIENTANNOTATIONTYPE)
+      return "_ActPatientAnnotationType";
+    if (code == V3ActCode.ANNDI)
+      return "ANNDI";
+    if (code == V3ActCode.ANNGEN)
+      return "ANNGEN";
+    if (code == V3ActCode.ANNIMM)
+      return "ANNIMM";
+    if (code == V3ActCode.ANNLAB)
+      return "ANNLAB";
+    if (code == V3ActCode.ANNMED)
+      return "ANNMED";
+    if (code == V3ActCode._GENETICOBSERVATIONTYPE)
+      return "_GeneticObservationType";
+    if (code == V3ActCode.GENE)
+      return "GENE";
+    if (code == V3ActCode._IMMUNIZATIONOBSERVATIONTYPE)
+      return "_ImmunizationObservationType";
+    if (code == V3ActCode.OBSANTC)
+      return "OBSANTC";
+    if (code == V3ActCode.OBSANTV)
+      return "OBSANTV";
+    if (code == V3ActCode._INDIVIDUALCASESAFETYREPORTTYPE)
+      return "_IndividualCaseSafetyReportType";
+    if (code == V3ActCode.PATADVEVNT)
+      return "PAT_ADV_EVNT";
+    if (code == V3ActCode.VACPROBLEM)
+      return "VAC_PROBLEM";
+    if (code == V3ActCode._LOINCOBSERVATIONACTCONTEXTAGETYPE)
+      return "_LOINCObservationActContextAgeType";
+    if (code == V3ActCode._216119)
+      return "21611-9";
+    if (code == V3ActCode._216127)
+      return "21612-7";
+    if (code == V3ActCode._295535)
+      return "29553-5";
+    if (code == V3ActCode._305250)
+      return "30525-0";
+    if (code == V3ActCode._309724)
+      return "30972-4";
+    if (code == V3ActCode._MEDICATIONOBSERVATIONTYPE)
+      return "_MedicationObservationType";
+    if (code == V3ActCode.REPHALFLIFE)
+      return "REP_HALF_LIFE";
+    if (code == V3ActCode.SPLCOATING)
+      return "SPLCOATING";
+    if (code == V3ActCode.SPLCOLOR)
+      return "SPLCOLOR";
+    if (code == V3ActCode.SPLIMAGE)
+      return "SPLIMAGE";
+    if (code == V3ActCode.SPLIMPRINT)
+      return "SPLIMPRINT";
+    if (code == V3ActCode.SPLSCORING)
+      return "SPLSCORING";
+    if (code == V3ActCode.SPLSHAPE)
+      return "SPLSHAPE";
+    if (code == V3ActCode.SPLSIZE)
+      return "SPLSIZE";
+    if (code == V3ActCode.SPLSYMBOL)
+      return "SPLSYMBOL";
+    if (code == V3ActCode._OBSERVATIONISSUETRIGGERCODEDOBSERVATIONTYPE)
+      return "_ObservationIssueTriggerCodedObservationType";
+    if (code == V3ActCode._CASETRANSMISSIONMODE)
+      return "_CaseTransmissionMode";
+    if (code == V3ActCode.AIRTRNS)
+      return "AIRTRNS";
+    if (code == V3ActCode.ANANTRNS)
+      return "ANANTRNS";
+    if (code == V3ActCode.ANHUMTRNS)
+      return "ANHUMTRNS";
+    if (code == V3ActCode.BDYFLDTRNS)
+      return "BDYFLDTRNS";
+    if (code == V3ActCode.BLDTRNS)
+      return "BLDTRNS";
+    if (code == V3ActCode.DERMTRNS)
+      return "DERMTRNS";
+    if (code == V3ActCode.ENVTRNS)
+      return "ENVTRNS";
+    if (code == V3ActCode.FECTRNS)
+      return "FECTRNS";
+    if (code == V3ActCode.FOMTRNS)
+      return "FOMTRNS";
+    if (code == V3ActCode.FOODTRNS)
+      return "FOODTRNS";
+    if (code == V3ActCode.HUMHUMTRNS)
+      return "HUMHUMTRNS";
+    if (code == V3ActCode.INDTRNS)
+      return "INDTRNS";
+    if (code == V3ActCode.LACTTRNS)
+      return "LACTTRNS";
+    if (code == V3ActCode.NOSTRNS)
+      return "NOSTRNS";
+    if (code == V3ActCode.PARTRNS)
+      return "PARTRNS";
+    if (code == V3ActCode.PLACTRNS)
+      return "PLACTRNS";
+    if (code == V3ActCode.SEXTRNS)
+      return "SEXTRNS";
+    if (code == V3ActCode.TRNSFTRNS)
+      return "TRNSFTRNS";
+    if (code == V3ActCode.VECTRNS)
+      return "VECTRNS";
+    if (code == V3ActCode.WATTRNS)
+      return "WATTRNS";
+    if (code == V3ActCode._OBSERVATIONQUALITYMEASUREATTRIBUTE)
+      return "_ObservationQualityMeasureAttribute";
+    if (code == V3ActCode.AGGREGATE)
+      return "AGGREGATE";
+    if (code == V3ActCode.CMPMSRMTH)
+      return "CMPMSRMTH";
+    if (code == V3ActCode.CMPMSRSCRWGHT)
+      return "CMPMSRSCRWGHT";
+    if (code == V3ActCode.COPY)
+      return "COPY";
+    if (code == V3ActCode.CRS)
+      return "CRS";
+    if (code == V3ActCode.DEF)
+      return "DEF";
+    if (code == V3ActCode.DISC)
+      return "DISC";
+    if (code == V3ActCode.FINALDT)
+      return "FINALDT";
+    if (code == V3ActCode.GUIDE)
+      return "GUIDE";
+    if (code == V3ActCode.IDUR)
+      return "IDUR";
+    if (code == V3ActCode.ITMCNT)
+      return "ITMCNT";
+    if (code == V3ActCode.KEY)
+      return "KEY";
+    if (code == V3ActCode.MEDT)
+      return "MEDT";
+    if (code == V3ActCode.MSD)
+      return "MSD";
+    if (code == V3ActCode.MSRADJ)
+      return "MSRADJ";
+    if (code == V3ActCode.MSRAGG)
+      return "MSRAGG";
+    if (code == V3ActCode.MSRIMPROV)
+      return "MSRIMPROV";
+    if (code == V3ActCode.MSRJUR)
+      return "MSRJUR";
+    if (code == V3ActCode.MSRRPTR)
+      return "MSRRPTR";
+    if (code == V3ActCode.MSRRPTTIME)
+      return "MSRRPTTIME";
+    if (code == V3ActCode.MSRSCORE)
+      return "MSRSCORE";
+    if (code == V3ActCode.MSRSET)
+      return "MSRSET";
+    if (code == V3ActCode.MSRTOPIC)
+      return "MSRTOPIC";
+    if (code == V3ActCode.MSRTP)
+      return "MSRTP";
+    if (code == V3ActCode.MSRTYPE)
+      return "MSRTYPE";
+    if (code == V3ActCode.RAT)
+      return "RAT";
+    if (code == V3ActCode.REF)
+      return "REF";
+    if (code == V3ActCode.SDE)
+      return "SDE";
+    if (code == V3ActCode.STRAT)
+      return "STRAT";
+    if (code == V3ActCode.TRANF)
+      return "TRANF";
+    if (code == V3ActCode.USE)
+      return "USE";
+    if (code == V3ActCode._OBSERVATIONSEQUENCETYPE)
+      return "_ObservationSequenceType";
+    if (code == V3ActCode.TIMEABSOLUTE)
+      return "TIME_ABSOLUTE";
+    if (code == V3ActCode.TIMERELATIVE)
+      return "TIME_RELATIVE";
+    if (code == V3ActCode._OBSERVATIONSERIESTYPE)
+      return "_ObservationSeriesType";
+    if (code == V3ActCode._ECGOBSERVATIONSERIESTYPE)
+      return "_ECGObservationSeriesType";
+    if (code == V3ActCode.REPRESENTATIVEBEAT)
+      return "REPRESENTATIVE_BEAT";
+    if (code == V3ActCode.RHYTHM)
+      return "RHYTHM";
+    if (code == V3ActCode._PATIENTIMMUNIZATIONRELATEDOBSERVATIONTYPE)
+      return "_PatientImmunizationRelatedObservationType";
+    if (code == V3ActCode.CLSSRM)
+      return "CLSSRM";
+    if (code == V3ActCode.GRADE)
+      return "GRADE";
+    if (code == V3ActCode.SCHL)
+      return "SCHL";
+    if (code == V3ActCode.SCHLDIV)
+      return "SCHLDIV";
+    if (code == V3ActCode.TEACHER)
+      return "TEACHER";
+    if (code == V3ActCode._POPULATIONINCLUSIONOBSERVATIONTYPE)
+      return "_PopulationInclusionObservationType";
+    if (code == V3ActCode.DENEX)
+      return "DENEX";
+    if (code == V3ActCode.DENEXCEP)
+      return "DENEXCEP";
+    if (code == V3ActCode.DENOM)
+      return "DENOM";
+    if (code == V3ActCode.IPOP)
+      return "IPOP";
+    if (code == V3ActCode.IPPOP)
+      return "IPPOP";
+    if (code == V3ActCode.MSRPOPL)
+      return "MSRPOPL";
+    if (code == V3ActCode.MSRPOPLEX)
+      return "MSRPOPLEX";
+    if (code == V3ActCode.NUMER)
+      return "NUMER";
+    if (code == V3ActCode.NUMEX)
+      return "NUMEX";
+    if (code == V3ActCode._PREFERENCEOBSERVATIONTYPE)
+      return "_PreferenceObservationType";
+    if (code == V3ActCode.PREFSTRENGTH)
+      return "PREFSTRENGTH";
+    if (code == V3ActCode.ADVERSEREACTION)
+      return "ADVERSE_REACTION";
+    if (code == V3ActCode.ASSERTION)
+      return "ASSERTION";
+    if (code == V3ActCode.CASESER)
+      return "CASESER";
+    if (code == V3ActCode.CDIO)
+      return "CDIO";
+    if (code == V3ActCode.CRIT)
+      return "CRIT";
+    if (code == V3ActCode.CTMO)
+      return "CTMO";
+    if (code == V3ActCode.DX)
+      return "DX";
+    if (code == V3ActCode.ADMDX)
+      return "ADMDX";
+    if (code == V3ActCode.DISDX)
+      return "DISDX";
+    if (code == V3ActCode.INTDX)
+      return "INTDX";
+    if (code == V3ActCode.NOI)
+      return "NOI";
+    if (code == V3ActCode.GISTIER)
+      return "GISTIER";
+    if (code == V3ActCode.HHOBS)
+      return "HHOBS";
+    if (code == V3ActCode.ISSUE)
+      return "ISSUE";
+    if (code == V3ActCode._ACTADMINISTRATIVEDETECTEDISSUECODE)
+      return "_ActAdministrativeDetectedIssueCode";
+    if (code == V3ActCode._ACTADMINISTRATIVEAUTHORIZATIONDETECTEDISSUECODE)
+      return "_ActAdministrativeAuthorizationDetectedIssueCode";
+    if (code == V3ActCode.NAT)
+      return "NAT";
+    if (code == V3ActCode.SUPPRESSED)
+      return "SUPPRESSED";
+    if (code == V3ActCode.VALIDAT)
+      return "VALIDAT";
+    if (code == V3ActCode.KEY204)
+      return "KEY204";
+    if (code == V3ActCode.KEY205)
+      return "KEY205";
+    if (code == V3ActCode.COMPLY)
+      return "COMPLY";
+    if (code == V3ActCode.DUPTHPY)
+      return "DUPTHPY";
+    if (code == V3ActCode.DUPTHPCLS)
+      return "DUPTHPCLS";
+    if (code == V3ActCode.DUPTHPGEN)
+      return "DUPTHPGEN";
+    if (code == V3ActCode.ABUSE)
+      return "ABUSE";
+    if (code == V3ActCode.FRAUD)
+      return "FRAUD";
+    if (code == V3ActCode.PLYDOC)
+      return "PLYDOC";
+    if (code == V3ActCode.PLYPHRM)
+      return "PLYPHRM";
+    if (code == V3ActCode.DOSE)
+      return "DOSE";
+    if (code == V3ActCode.DOSECOND)
+      return "DOSECOND";
+    if (code == V3ActCode.DOSEDUR)
+      return "DOSEDUR";
+    if (code == V3ActCode.DOSEDURH)
+      return "DOSEDURH";
+    if (code == V3ActCode.DOSEDURHIND)
+      return "DOSEDURHIND";
+    if (code == V3ActCode.DOSEDURL)
+      return "DOSEDURL";
+    if (code == V3ActCode.DOSEDURLIND)
+      return "DOSEDURLIND";
+    if (code == V3ActCode.DOSEH)
+      return "DOSEH";
+    if (code == V3ActCode.DOSEHINDA)
+      return "DOSEHINDA";
+    if (code == V3ActCode.DOSEHIND)
+      return "DOSEHIND";
+    if (code == V3ActCode.DOSEHINDSA)
+      return "DOSEHINDSA";
+    if (code == V3ActCode.DOSEHINDW)
+      return "DOSEHINDW";
+    if (code == V3ActCode.DOSEIVL)
+      return "DOSEIVL";
+    if (code == V3ActCode.DOSEIVLIND)
+      return "DOSEIVLIND";
+    if (code == V3ActCode.DOSEL)
+      return "DOSEL";
+    if (code == V3ActCode.DOSELINDA)
+      return "DOSELINDA";
+    if (code == V3ActCode.DOSELIND)
+      return "DOSELIND";
+    if (code == V3ActCode.DOSELINDSA)
+      return "DOSELINDSA";
+    if (code == V3ActCode.DOSELINDW)
+      return "DOSELINDW";
+    if (code == V3ActCode.MDOSE)
+      return "MDOSE";
+    if (code == V3ActCode.OBSA)
+      return "OBSA";
+    if (code == V3ActCode.AGE)
+      return "AGE";
+    if (code == V3ActCode.ADALRT)
+      return "ADALRT";
+    if (code == V3ActCode.GEALRT)
+      return "GEALRT";
+    if (code == V3ActCode.PEALRT)
+      return "PEALRT";
+    if (code == V3ActCode.COND)
+      return "COND";
+    if (code == V3ActCode.HGHT)
+      return "HGHT";
+    if (code == V3ActCode.LACT)
+      return "LACT";
+    if (code == V3ActCode.PREG)
+      return "PREG";
+    if (code == V3ActCode.WGHT)
+      return "WGHT";
+    if (code == V3ActCode.CREACT)
+      return "CREACT";
+    if (code == V3ActCode.GEN)
+      return "GEN";
+    if (code == V3ActCode.GEND)
+      return "GEND";
+    if (code == V3ActCode.LAB)
+      return "LAB";
+    if (code == V3ActCode.REACT)
+      return "REACT";
+    if (code == V3ActCode.ALGY)
+      return "ALGY";
+    if (code == V3ActCode.INT)
+      return "INT";
+    if (code == V3ActCode.RREACT)
+      return "RREACT";
+    if (code == V3ActCode.RALG)
+      return "RALG";
+    if (code == V3ActCode.RAR)
+      return "RAR";
+    if (code == V3ActCode.RINT)
+      return "RINT";
+    if (code == V3ActCode.BUS)
+      return "BUS";
+    if (code == V3ActCode.CODEINVAL)
+      return "CODE_INVAL";
+    if (code == V3ActCode.CODEDEPREC)
+      return "CODE_DEPREC";
+    if (code == V3ActCode.FORMAT)
+      return "FORMAT";
+    if (code == V3ActCode.ILLEGAL)
+      return "ILLEGAL";
+    if (code == V3ActCode.LENRANGE)
+      return "LEN_RANGE";
+    if (code == V3ActCode.LENLONG)
+      return "LEN_LONG";
+    if (code == V3ActCode.LENSHORT)
+      return "LEN_SHORT";
+    if (code == V3ActCode.MISSCOND)
+      return "MISSCOND";
+    if (code == V3ActCode.MISSMAND)
+      return "MISSMAND";
+    if (code == V3ActCode.NODUPS)
+      return "NODUPS";
+    if (code == V3ActCode.NOPERSIST)
+      return "NOPERSIST";
+    if (code == V3ActCode.REPRANGE)
+      return "REP_RANGE";
+    if (code == V3ActCode.MAXOCCURS)
+      return "MAXOCCURS";
+    if (code == V3ActCode.MINOCCURS)
+      return "MINOCCURS";
+    if (code == V3ActCode._ACTADMINISTRATIVERULEDETECTEDISSUECODE)
+      return "_ActAdministrativeRuleDetectedIssueCode";
+    if (code == V3ActCode.KEY206)
+      return "KEY206";
+    if (code == V3ActCode.OBSOLETE)
+      return "OBSOLETE";
+    if (code == V3ActCode._ACTSUPPLIEDITEMDETECTEDISSUECODE)
+      return "_ActSuppliedItemDetectedIssueCode";
+    if (code == V3ActCode._ADMINISTRATIONDETECTEDISSUECODE)
+      return "_AdministrationDetectedIssueCode";
+    if (code == V3ActCode._APPROPRIATENESSDETECTEDISSUECODE)
+      return "_AppropriatenessDetectedIssueCode";
+    if (code == V3ActCode._INTERACTIONDETECTEDISSUECODE)
+      return "_InteractionDetectedIssueCode";
+    if (code == V3ActCode.FOOD)
+      return "FOOD";
+    if (code == V3ActCode.TPROD)
+      return "TPROD";
+    if (code == V3ActCode.DRG)
+      return "DRG";
+    if (code == V3ActCode.NHP)
+      return "NHP";
+    if (code == V3ActCode.NONRX)
+      return "NONRX";
+    if (code == V3ActCode.PREVINEF)
+      return "PREVINEF";
+    if (code == V3ActCode.DACT)
+      return "DACT";
+    if (code == V3ActCode.TIME)
+      return "TIME";
+    if (code == V3ActCode.ALRTENDLATE)
+      return "ALRTENDLATE";
+    if (code == V3ActCode.ALRTSTRTLATE)
+      return "ALRTSTRTLATE";
+    if (code == V3ActCode._TIMINGDETECTEDISSUECODE)
+      return "_TimingDetectedIssueCode";
+    if (code == V3ActCode.ENDLATE)
+      return "ENDLATE";
+    if (code == V3ActCode.STRTLATE)
+      return "STRTLATE";
+    if (code == V3ActCode._SUPPLYDETECTEDISSUECODE)
+      return "_SupplyDetectedIssueCode";
+    if (code == V3ActCode.ALLDONE)
+      return "ALLDONE";
+    if (code == V3ActCode.FULFIL)
+      return "FULFIL";
+    if (code == V3ActCode.NOTACTN)
+      return "NOTACTN";
+    if (code == V3ActCode.NOTEQUIV)
+      return "NOTEQUIV";
+    if (code == V3ActCode.NOTEQUIVGEN)
+      return "NOTEQUIVGEN";
+    if (code == V3ActCode.NOTEQUIVTHER)
+      return "NOTEQUIVTHER";
+    if (code == V3ActCode.TIMING)
+      return "TIMING";
+    if (code == V3ActCode.INTERVAL)
+      return "INTERVAL";
+    if (code == V3ActCode.MINFREQ)
+      return "MINFREQ";
+    if (code == V3ActCode.HELD)
+      return "HELD";
+    if (code == V3ActCode.TOOLATE)
+      return "TOOLATE";
+    if (code == V3ActCode.TOOSOON)
+      return "TOOSOON";
+    if (code == V3ActCode.HISTORIC)
+      return "HISTORIC";
+    if (code == V3ActCode.PATPREF)
+      return "PATPREF";
+    if (code == V3ActCode.PATPREFALT)
+      return "PATPREFALT";
+    if (code == V3ActCode.KSUBJ)
+      return "KSUBJ";
+    if (code == V3ActCode.KSUBT)
+      return "KSUBT";
+    if (code == V3ActCode.OINT)
+      return "OINT";
+    if (code == V3ActCode.ALG)
+      return "ALG";
+    if (code == V3ActCode.DALG)
+      return "DALG";
+    if (code == V3ActCode.EALG)
+      return "EALG";
+    if (code == V3ActCode.FALG)
+      return "FALG";
+    if (code == V3ActCode.DINT)
+      return "DINT";
+    if (code == V3ActCode.DNAINT)
+      return "DNAINT";
+    if (code == V3ActCode.EINT)
+      return "EINT";
+    if (code == V3ActCode.ENAINT)
+      return "ENAINT";
+    if (code == V3ActCode.FINT)
+      return "FINT";
+    if (code == V3ActCode.FNAINT)
+      return "FNAINT";
+    if (code == V3ActCode.NAINT)
+      return "NAINT";
+    if (code == V3ActCode.SEV)
+      return "SEV";
+    if (code == V3ActCode._FDALABELDATA)
+      return "_FDALabelData";
+    if (code == V3ActCode.FDACOATING)
+      return "FDACOATING";
+    if (code == V3ActCode.FDACOLOR)
+      return "FDACOLOR";
+    if (code == V3ActCode.FDAIMPRINTCD)
+      return "FDAIMPRINTCD";
+    if (code == V3ActCode.FDALOGO)
+      return "FDALOGO";
+    if (code == V3ActCode.FDASCORING)
+      return "FDASCORING";
+    if (code == V3ActCode.FDASHAPE)
+      return "FDASHAPE";
+    if (code == V3ActCode.FDASIZE)
+      return "FDASIZE";
+    if (code == V3ActCode._ROIOVERLAYSHAPE)
+      return "_ROIOverlayShape";
+    if (code == V3ActCode.CIRCLE)
+      return "CIRCLE";
+    if (code == V3ActCode.ELLIPSE)
+      return "ELLIPSE";
+    if (code == V3ActCode.POINT)
+      return "POINT";
+    if (code == V3ActCode.POLY)
+      return "POLY";
+    if (code == V3ActCode.C)
+      return "C";
+    if (code == V3ActCode.DIET)
+      return "DIET";
+    if (code == V3ActCode.BR)
+      return "BR";
+    if (code == V3ActCode.DM)
+      return "DM";
+    if (code == V3ActCode.FAST)
+      return "FAST";
+    if (code == V3ActCode.FORMULA)
+      return "FORMULA";
+    if (code == V3ActCode.GF)
+      return "GF";
+    if (code == V3ActCode.LF)
+      return "LF";
+    if (code == V3ActCode.LP)
+      return "LP";
+    if (code == V3ActCode.LQ)
+      return "LQ";
+    if (code == V3ActCode.LS)
+      return "LS";
+    if (code == V3ActCode.N)
+      return "N";
+    if (code == V3ActCode.NF)
+      return "NF";
+    if (code == V3ActCode.PAF)
+      return "PAF";
+    if (code == V3ActCode.PAR)
+      return "PAR";
+    if (code == V3ActCode.RD)
+      return "RD";
+    if (code == V3ActCode.SCH)
+      return "SCH";
+    if (code == V3ActCode.SUPPLEMENT)
+      return "SUPPLEMENT";
+    if (code == V3ActCode.T)
+      return "T";
+    if (code == V3ActCode.VLI)
+      return "VLI";
+    if (code == V3ActCode.DRUGPRG)
+      return "DRUGPRG";
+    if (code == V3ActCode.F)
+      return "F";
+    if (code == V3ActCode.PRLMN)
+      return "PRLMN";
+    if (code == V3ActCode.SECOBS)
+      return "SECOBS";
+    if (code == V3ActCode.SECCATOBS)
+      return "SECCATOBS";
+    if (code == V3ActCode.SECCLASSOBS)
+      return "SECCLASSOBS";
+    if (code == V3ActCode.SECCONOBS)
+      return "SECCONOBS";
+    if (code == V3ActCode.SECINTOBS)
+      return "SECINTOBS";
+    if (code == V3ActCode.SECALTINTOBS)
+      return "SECALTINTOBS";
+    if (code == V3ActCode.SECDATINTOBS)
+      return "SECDATINTOBS";
+    if (code == V3ActCode.SECINTCONOBS)
+      return "SECINTCONOBS";
+    if (code == V3ActCode.SECINTPRVOBS)
+      return "SECINTPRVOBS";
+    if (code == V3ActCode.SECINTPRVABOBS)
+      return "SECINTPRVABOBS";
+    if (code == V3ActCode.SECINTPRVRBOBS)
+      return "SECINTPRVRBOBS";
+    if (code == V3ActCode.SECINTSTOBS)
+      return "SECINTSTOBS";
+    if (code == V3ActCode.SECTRSTOBS)
+      return "SECTRSTOBS";
+    if (code == V3ActCode.TRSTACCRDOBS)
+      return "TRSTACCRDOBS";
+    if (code == V3ActCode.TRSTAGREOBS)
+      return "TRSTAGREOBS";
+    if (code == V3ActCode.TRSTCERTOBS)
+      return "TRSTCERTOBS";
+    if (code == V3ActCode.TRSTFWKOBS)
+      return "TRSTFWKOBS";
+    if (code == V3ActCode.TRSTLOAOBS)
+      return "TRSTLOAOBS";
+    if (code == V3ActCode.TRSTMECOBS)
+      return "TRSTMECOBS";
+    if (code == V3ActCode.SUBSIDFFS)
+      return "SUBSIDFFS";
+    if (code == V3ActCode.WRKCOMP)
+      return "WRKCOMP";
+    if (code == V3ActCode._ACTPROCEDURECODE)
+      return "_ActProcedureCode";
+    if (code == V3ActCode._ACTBILLABLESERVICECODE)
+      return "_ActBillableServiceCode";
+    if (code == V3ActCode._HL7DEFINEDACTCODES)
+      return "_HL7DefinedActCodes";
+    if (code == V3ActCode.COPAY)
+      return "COPAY";
+    if (code == V3ActCode.DEDUCT)
+      return "DEDUCT";
+    if (code == V3ActCode.DOSEIND)
+      return "DOSEIND";
+    if (code == V3ActCode.PRA)
+      return "PRA";
+    if (code == V3ActCode.STORE)
+      return "STORE";
+    return "?";
+  }
+
+    public String toSystem(V3ActCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActExposureLevelCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActExposureLevelCode.java
new file mode 100644
index 00000000000..d115f90e410
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActExposureLevelCode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActExposureLevelCode {
+
+        /**
+         * A qualitative measure of the degree of exposure to the causative agent.  This includes concepts such as "low", "medium" and "high".  This quantifies how the quantity that was available to be administered to the target differs from typical or background levels of the substance.
+         */
+        _ACTEXPOSURELEVELCODE, 
+        /**
+         * Description: Exposure to an agent at a relatively high level above background.
+         */
+        HIGH, 
+        /**
+         * Description: Exposure to an agent at a relatively low level above background.
+         */
+        LOW, 
+        /**
+         * Description: Exposure to an agent at a relatively moderate level above background.A
+         */
+        MEDIUM, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActExposureLevelCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ActExposureLevelCode".equals(codeString))
+          return _ACTEXPOSURELEVELCODE;
+        if ("HIGH".equals(codeString))
+          return HIGH;
+        if ("LOW".equals(codeString))
+          return LOW;
+        if ("MEDIUM".equals(codeString))
+          return MEDIUM;
+        throw new FHIRException("Unknown V3ActExposureLevelCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ACTEXPOSURELEVELCODE: return "_ActExposureLevelCode";
+            case HIGH: return "HIGH";
+            case LOW: return "LOW";
+            case MEDIUM: return "MEDIUM";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActExposureLevelCode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ACTEXPOSURELEVELCODE: return "A qualitative measure of the degree of exposure to the causative agent.  This includes concepts such as \"low\", \"medium\" and \"high\".  This quantifies how the quantity that was available to be administered to the target differs from typical or background levels of the substance.";
+            case HIGH: return "Description: Exposure to an agent at a relatively high level above background.";
+            case LOW: return "Description: Exposure to an agent at a relatively low level above background.";
+            case MEDIUM: return "Description: Exposure to an agent at a relatively moderate level above background.A";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ACTEXPOSURELEVELCODE: return "ActExposureLevelCode";
+            case HIGH: return "high";
+            case LOW: return "low";
+            case MEDIUM: return "medium";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActExposureLevelCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActExposureLevelCodeEnumFactory.java
new file mode 100644
index 00000000000..fdd218dda53
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActExposureLevelCodeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActExposureLevelCodeEnumFactory implements EnumFactory {
+
+  public V3ActExposureLevelCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ActExposureLevelCode".equals(codeString))
+      return V3ActExposureLevelCode._ACTEXPOSURELEVELCODE;
+    if ("HIGH".equals(codeString))
+      return V3ActExposureLevelCode.HIGH;
+    if ("LOW".equals(codeString))
+      return V3ActExposureLevelCode.LOW;
+    if ("MEDIUM".equals(codeString))
+      return V3ActExposureLevelCode.MEDIUM;
+    throw new IllegalArgumentException("Unknown V3ActExposureLevelCode code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActExposureLevelCode code) {
+    if (code == V3ActExposureLevelCode._ACTEXPOSURELEVELCODE)
+      return "_ActExposureLevelCode";
+    if (code == V3ActExposureLevelCode.HIGH)
+      return "HIGH";
+    if (code == V3ActExposureLevelCode.LOW)
+      return "LOW";
+    if (code == V3ActExposureLevelCode.MEDIUM)
+      return "MEDIUM";
+    return "?";
+  }
+
+    public String toSystem(V3ActExposureLevelCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActInvoiceElementModifier.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActInvoiceElementModifier.java
new file mode 100644
index 00000000000..3dc175e1f43
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActInvoiceElementModifier.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActInvoiceElementModifier {
+
+        /**
+         * Electronic form with supporting information to follow.
+         */
+        EFORM, 
+        /**
+         * Fax with supporting information to follow.
+         */
+        FAX, 
+        /**
+         * Represents the last invoice from the perspective of the provider.
+         */
+        LINV, 
+        /**
+         * Paper documentation (or other physical format) with supporting information to follow.
+         */
+        PAPER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActInvoiceElementModifier fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("EFORM".equals(codeString))
+          return EFORM;
+        if ("FAX".equals(codeString))
+          return FAX;
+        if ("LINV".equals(codeString))
+          return LINV;
+        if ("PAPER".equals(codeString))
+          return PAPER;
+        throw new FHIRException("Unknown V3ActInvoiceElementModifier code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case EFORM: return "EFORM";
+            case FAX: return "FAX";
+            case LINV: return "LINV";
+            case PAPER: return "PAPER";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActInvoiceElementModifier";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case EFORM: return "Electronic form with supporting information to follow.";
+            case FAX: return "Fax with supporting information to follow.";
+            case LINV: return "Represents the last invoice from the perspective of the provider.";
+            case PAPER: return "Paper documentation (or other physical format) with supporting information to follow.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case EFORM: return "Electronic Form To Follow";
+            case FAX: return "Fax To Follow";
+            case LINV: return "Last Invoice";
+            case PAPER: return "Paper Documentation To Follow";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActInvoiceElementModifierEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActInvoiceElementModifierEnumFactory.java
new file mode 100644
index 00000000000..9b72bb205f4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActInvoiceElementModifierEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActInvoiceElementModifierEnumFactory implements EnumFactory {
+
+  public V3ActInvoiceElementModifier fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("EFORM".equals(codeString))
+      return V3ActInvoiceElementModifier.EFORM;
+    if ("FAX".equals(codeString))
+      return V3ActInvoiceElementModifier.FAX;
+    if ("LINV".equals(codeString))
+      return V3ActInvoiceElementModifier.LINV;
+    if ("PAPER".equals(codeString))
+      return V3ActInvoiceElementModifier.PAPER;
+    throw new IllegalArgumentException("Unknown V3ActInvoiceElementModifier code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActInvoiceElementModifier code) {
+    if (code == V3ActInvoiceElementModifier.EFORM)
+      return "EFORM";
+    if (code == V3ActInvoiceElementModifier.FAX)
+      return "FAX";
+    if (code == V3ActInvoiceElementModifier.LINV)
+      return "LINV";
+    if (code == V3ActInvoiceElementModifier.PAPER)
+      return "PAPER";
+    return "?";
+  }
+
+    public String toSystem(V3ActInvoiceElementModifier code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActMood.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActMood.java
new file mode 100644
index 00000000000..14a183d003d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActMood.java
@@ -0,0 +1,372 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActMood {
+
+        /**
+         * These are moods describing activities as they progress in the business cycle, from defined, through planned and ordered to completed.
+         */
+        _ACTMOODCOMPLETIONTRACK, 
+        /**
+         * Definition: A possible act.
+         */
+        _ACTMOODPOTENTIAL, 
+        /**
+         * Definition: A definition of a kind of act that can occur .
+
+                        
+                           OpenIssue: The semantic constructs embodied in DEF and CRT moods seem indistinguishable, and their uses can readily be determined by the context in which these are used. Therefore, this OpenIssue has been created to declare that it is likely that ActMood.DEF will be "retired" in the future in favor of the more general ActMood.CRT.
+         */
+        DEF, 
+        /**
+         * Definition: A kind of act that defines a permission that has been granted.
+         */
+        PERM, 
+        /**
+         * Definition: A kind of act that may occur during the specified time period.
+         */
+        SLOT, 
+        /**
+         * Definition: An act that actually happens (may be an ongoing act or a documentation of a past act).
+         */
+        EVN, 
+        /**
+         * Definition: An intention or plan for an act. 
+
+                        
+                           >UsageNotes: The final outcome of the intent, the act that is intended to occur, is always an event. However the final outcome may be reached indirectly via steps through other intents, such as promise, permission request, or an appointment that may lead to an actual event to occur. Alternatively, the intended act may never occur.
+         */
+        INT, 
+        /**
+         * Definition:  A desire to have an act occur.
+         */
+        _ACTMOODDESIRE, 
+        /**
+         * Definition: A request (or order) for an act that is part of a defined request/fulfillment cycle.
+
+                        
+                           UsageNotes: Use of an HL7 defined request/fulfillment framework is not required to use this mood code.
+         */
+        _ACTMOODACTREQUEST, 
+        /**
+         * Definition: A request act that is specialized for the appointment scheduling request/fulfillment cycle. An appointment request is fulfilled only and completely by an appointment (APT), i.e., all that the appointment request intends is to create an appointment (the actual act may well not happen if that is the professional decision during the appointment).
+         */
+        ARQ, 
+        /**
+         * Definition: A request for a permission to perform the act. Typically a payer (or possibly a supervisor) is being requested to give permission to perform the act. As opposed to the RQO, the requestee is not asked to perform or cause to perform the act but only to give the permission.
+         */
+        PERMRQ, 
+        /**
+         * Definition: A request act that is specialized for an event request/fulfillment cycle. 
+
+                        
+                           UsageNotes: The fulfillment cycle may involve intermediary fulfilling acts in moods such as PRMS, APT, or even another RQO before being fulfilled by the final event. 
+
+                        
+                           UsageNotes: The concepts of a "request" and an "order" are viewed as different, because there is an implication of a mandate associated with order.  In practice, however, this distinction has no general functional value in the inter-operation of health care computing.  "Orders" are commonly refused for a variety of clinical and business reasons, and the notion of a "request" obligates the recipient (the fulfiller) to respond to the sender (the author).  Indeed, in many regions, including Australia and Europe, the common term used is "request."
+
+                        Thus, the concept embodies both notions, as there is no useful distinction to be made.  If a mandate is to be associated with a request, this will be embodied in the "local" business rules applied to the transactions.  Should HL7 desire to provide a distinction between these in the future, the individual concepts could be added as specializations of this concept.
+
+                        The critical distinction here, is the difference between this concept and an "intent", of which it is a specialization.  An intent involves decisions by a single party, the author.  A request, however, involves decisions by two parties, the author and the fulfiller, with an obligation on the part of the fulfiller to respond to the request indicating that the fulfiller will indeed fulfill the request.
+         */
+        RQO, 
+        /**
+         * Definition: A suggestion that an act might be performed. Not an explicit request, and professional responsibility may or may not be present.
+         */
+        PRP, 
+        /**
+         * Definition: A suggestion that an act should be performed with an acceptance of some degree of professional responsibility for the resulting act. Not an explicit request. .
+
+                        
+                           UsageNotes: Where there is no clear definition or applicable concept of "professional responsibility�, RMD becomes indistinguishable from PRP. .
+         */
+        RMD, 
+        /**
+         * Definition: A commitment to perform an act (may be either solicited or unsolicited). The committer becomes responsible to the other party for executing the act, and, as a consequence, the other party may rely on the first party to perform or cause to perform the act.
+
+                        
+                           UsageNotes: Commitments may be retracted or cancelled.
+         */
+        PRMS, 
+        /**
+         * Definition: An act that has been scheduled to be performed at a specific place and time.
+         */
+        APT, 
+        /**
+         * Definition: An act that expresses condition statements for other acts.
+         */
+        _ACTMOODPREDICATE, 
+        /**
+         * Deprecation Comment: 
+                           This concept This codes should no longer be used.  Instead, set attribute Act.isCriterionInd to "true" and use the desired mood for your criterion.
+
+                        
+                           Definition: A condition that must be true for the source act to be considered.
+         */
+        CRT, 
+        /**
+         * Deprecation Comment: 
+                           This concept This codes should no longer be used.  Instead, set attribute Act.isCriterionInd to "true" and use the desired mood for your criterion.
+
+                        
+                           Definition: A criterion (CRT) that has_match = an event (EVN).
+         */
+        EVN_CRT, 
+        /**
+         * A criterion expressed over goals (ActMood.GOL).
+         */
+        GOL_CRT, 
+        /**
+         * A criterion expressed over intents (ActMood.INT).
+         */
+        INT_CRT, 
+        /**
+         * A criterion expressed over promises (ActMood.PRMS).
+         */
+        PRMS_CRT, 
+        /**
+         * A criterion expressed over requests or orders (ActMood.RQO).
+         */
+        RQO_CRT, 
+        /**
+         * A criterion expressed over risks (ActMood.RSK).
+         */
+        RSK_CRT, 
+        /**
+         * Definition: An act that is considered to have some noteworthy likelihood of occurring in the future (has_match = event).
+
+                        
+                           Examples:Prognosis of a condition, Expected date of discharge from hospital, patient will likely need an emergency decompression of the intracranial pressure by morning.
+
+                        
+                           UsageNotes:INT (intent) reflects a plan for the future, which is a declaration to do something. This contrasts with expectation, which is a prediction that something will happen in the future. GOL (goal) reflects a hope rather than a prediction. RSK (risk) reflects a potential negative event that may or may not be expected to happen.
+         */
+        EXPEC, 
+        /**
+         * Definition: An expectation that is considered to be desirable to occur in the future 
+
+                        
+                           Examples:Target weight below 80Kg, Stop smoking, Regain ability to walk, goal is to administer thrombolytics to candidate patients presenting with acute myocardial infarction.
+
+                        
+                           UsageNotes: INT (intent) reflects a plan for the future, which is a declaration to do something.  This contrasts with goal which doesn't represent an intention to act, merely a hope for an eventual result.  A goal is distinct from the intended actions to reach that goal.  "I will reduce the dose of drug x to 20mg" is an intent.  "I hope to be able to get the patient to the point where I can reduce the dose of drug x to 20mg" is a goal. EXPEC (expectation) reflects a prediction rather than a hope. RSK (risk) reflects a potential negative event rather than a hope.
+         */
+        GOL, 
+        /**
+         * Definition:An act that may occur in the future and which is regarded as undesirable 
+
+                        
+                           Examples:Increased risk of DVT, at risk for sub-acute bacterial endocarditis.
+
+                        
+                           UsageNotes:Note: An observation in RSK mood expresses the undesirable act, and not the underlying risk factor. A risk factor that is present (e.g. obesity, smoking, etc) should be expressed in event mood. INT (intent) reflects a plan for the future, which is a declaration to do something. This contrasts with RSK (risk), which is the potential that something negative will occur that may or may not ever happen. GOL (goal) reflects a hope to achieve something. EXPEC (expectation) is the prediction of a positive or negative event. This contrasts with RSK (risk), which is the potential that something negative will occur that may or may not ever happen, and may not be expected to happen.
+         */
+        RSK, 
+        /**
+         * Definition: One of a set of acts that specify an option for the property values that the parent act may have. Typically used in definitions or orders to describe alternatives. An option can only be used as a group, that is, all assigned values must be used together. The actual mood of the act is the same as the parent act, and they must be linked by an actrelationship with type = OPTN.
+         */
+        OPT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActMood fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ActMoodCompletionTrack".equals(codeString))
+          return _ACTMOODCOMPLETIONTRACK;
+        if ("_ActMoodPotential".equals(codeString))
+          return _ACTMOODPOTENTIAL;
+        if ("DEF".equals(codeString))
+          return DEF;
+        if ("PERM".equals(codeString))
+          return PERM;
+        if ("SLOT".equals(codeString))
+          return SLOT;
+        if ("EVN".equals(codeString))
+          return EVN;
+        if ("INT".equals(codeString))
+          return INT;
+        if ("_ActMoodDesire".equals(codeString))
+          return _ACTMOODDESIRE;
+        if ("_ActMoodActRequest".equals(codeString))
+          return _ACTMOODACTREQUEST;
+        if ("ARQ".equals(codeString))
+          return ARQ;
+        if ("PERMRQ".equals(codeString))
+          return PERMRQ;
+        if ("RQO".equals(codeString))
+          return RQO;
+        if ("PRP".equals(codeString))
+          return PRP;
+        if ("RMD".equals(codeString))
+          return RMD;
+        if ("PRMS".equals(codeString))
+          return PRMS;
+        if ("APT".equals(codeString))
+          return APT;
+        if ("_ActMoodPredicate".equals(codeString))
+          return _ACTMOODPREDICATE;
+        if ("CRT".equals(codeString))
+          return CRT;
+        if ("EVN.CRT".equals(codeString))
+          return EVN_CRT;
+        if ("GOL.CRT".equals(codeString))
+          return GOL_CRT;
+        if ("INT.CRT".equals(codeString))
+          return INT_CRT;
+        if ("PRMS.CRT".equals(codeString))
+          return PRMS_CRT;
+        if ("RQO.CRT".equals(codeString))
+          return RQO_CRT;
+        if ("RSK.CRT".equals(codeString))
+          return RSK_CRT;
+        if ("EXPEC".equals(codeString))
+          return EXPEC;
+        if ("GOL".equals(codeString))
+          return GOL;
+        if ("RSK".equals(codeString))
+          return RSK;
+        if ("OPT".equals(codeString))
+          return OPT;
+        throw new FHIRException("Unknown V3ActMood code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ACTMOODCOMPLETIONTRACK: return "_ActMoodCompletionTrack";
+            case _ACTMOODPOTENTIAL: return "_ActMoodPotential";
+            case DEF: return "DEF";
+            case PERM: return "PERM";
+            case SLOT: return "SLOT";
+            case EVN: return "EVN";
+            case INT: return "INT";
+            case _ACTMOODDESIRE: return "_ActMoodDesire";
+            case _ACTMOODACTREQUEST: return "_ActMoodActRequest";
+            case ARQ: return "ARQ";
+            case PERMRQ: return "PERMRQ";
+            case RQO: return "RQO";
+            case PRP: return "PRP";
+            case RMD: return "RMD";
+            case PRMS: return "PRMS";
+            case APT: return "APT";
+            case _ACTMOODPREDICATE: return "_ActMoodPredicate";
+            case CRT: return "CRT";
+            case EVN_CRT: return "EVN.CRT";
+            case GOL_CRT: return "GOL.CRT";
+            case INT_CRT: return "INT.CRT";
+            case PRMS_CRT: return "PRMS.CRT";
+            case RQO_CRT: return "RQO.CRT";
+            case RSK_CRT: return "RSK.CRT";
+            case EXPEC: return "EXPEC";
+            case GOL: return "GOL";
+            case RSK: return "RSK";
+            case OPT: return "OPT";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActMood";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ACTMOODCOMPLETIONTRACK: return "These are moods describing activities as they progress in the business cycle, from defined, through planned and ordered to completed.";
+            case _ACTMOODPOTENTIAL: return "Definition: A possible act.";
+            case DEF: return "Definition: A definition of a kind of act that can occur .\r\n\n                        \n                           OpenIssue: The semantic constructs embodied in DEF and CRT moods seem indistinguishable, and their uses can readily be determined by the context in which these are used. Therefore, this OpenIssue has been created to declare that it is likely that ActMood.DEF will be \"retired\" in the future in favor of the more general ActMood.CRT.";
+            case PERM: return "Definition: A kind of act that defines a permission that has been granted.";
+            case SLOT: return "Definition: A kind of act that may occur during the specified time period.";
+            case EVN: return "Definition: An act that actually happens (may be an ongoing act or a documentation of a past act).";
+            case INT: return "Definition: An intention or plan for an act. \r\n\n                        \n                           >UsageNotes: The final outcome of the intent, the act that is intended to occur, is always an event. However the final outcome may be reached indirectly via steps through other intents, such as promise, permission request, or an appointment that may lead to an actual event to occur. Alternatively, the intended act may never occur.";
+            case _ACTMOODDESIRE: return "Definition:  A desire to have an act occur.";
+            case _ACTMOODACTREQUEST: return "Definition: A request (or order) for an act that is part of a defined request/fulfillment cycle.\r\n\n                        \n                           UsageNotes: Use of an HL7 defined request/fulfillment framework is not required to use this mood code.";
+            case ARQ: return "Definition: A request act that is specialized for the appointment scheduling request/fulfillment cycle. An appointment request is fulfilled only and completely by an appointment (APT), i.e., all that the appointment request intends is to create an appointment (the actual act may well not happen if that is the professional decision during the appointment).";
+            case PERMRQ: return "Definition: A request for a permission to perform the act. Typically a payer (or possibly a supervisor) is being requested to give permission to perform the act. As opposed to the RQO, the requestee is not asked to perform or cause to perform the act but only to give the permission.";
+            case RQO: return "Definition: A request act that is specialized for an event request/fulfillment cycle. \r\n\n                        \n                           UsageNotes: The fulfillment cycle may involve intermediary fulfilling acts in moods such as PRMS, APT, or even another RQO before being fulfilled by the final event. \r\n\n                        \n                           UsageNotes: The concepts of a \"request\" and an \"order\" are viewed as different, because there is an implication of a mandate associated with order.  In practice, however, this distinction has no general functional value in the inter-operation of health care computing.  \"Orders\" are commonly refused for a variety of clinical and business reasons, and the notion of a \"request\" obligates the recipient (the fulfiller) to respond to the sender (the author).  Indeed, in many regions, including Australia and Europe, the common term used is \"request.\"\r\n\n                        Thus, the concept embodies both notions, as there is no useful distinction to be made.  If a mandate is to be associated with a request, this will be embodied in the \"local\" business rules applied to the transactions.  Should HL7 desire to provide a distinction between these in the future, the individual concepts could be added as specializations of this concept.\r\n\n                        The critical distinction here, is the difference between this concept and an \"intent\", of which it is a specialization.  An intent involves decisions by a single party, the author.  A request, however, involves decisions by two parties, the author and the fulfiller, with an obligation on the part of the fulfiller to respond to the request indicating that the fulfiller will indeed fulfill the request.";
+            case PRP: return "Definition: A suggestion that an act might be performed. Not an explicit request, and professional responsibility may or may not be present.";
+            case RMD: return "Definition: A suggestion that an act should be performed with an acceptance of some degree of professional responsibility for the resulting act. Not an explicit request. .\r\n\n                        \n                           UsageNotes: Where there is no clear definition or applicable concept of \"professional responsibility�, RMD becomes indistinguishable from PRP. .";
+            case PRMS: return "Definition: A commitment to perform an act (may be either solicited or unsolicited). The committer becomes responsible to the other party for executing the act, and, as a consequence, the other party may rely on the first party to perform or cause to perform the act.\r\n\n                        \n                           UsageNotes: Commitments may be retracted or cancelled.";
+            case APT: return "Definition: An act that has been scheduled to be performed at a specific place and time.";
+            case _ACTMOODPREDICATE: return "Definition: An act that expresses condition statements for other acts.";
+            case CRT: return "Deprecation Comment: \n                           This concept This codes should no longer be used.  Instead, set attribute Act.isCriterionInd to \"true\" and use the desired mood for your criterion.\r\n\n                        \n                           Definition: A condition that must be true for the source act to be considered.";
+            case EVN_CRT: return "Deprecation Comment: \n                           This concept This codes should no longer be used.  Instead, set attribute Act.isCriterionInd to \"true\" and use the desired mood for your criterion.\r\n\n                        \n                           Definition: A criterion (CRT) that has_match = an event (EVN).";
+            case GOL_CRT: return "A criterion expressed over goals (ActMood.GOL).";
+            case INT_CRT: return "A criterion expressed over intents (ActMood.INT).";
+            case PRMS_CRT: return "A criterion expressed over promises (ActMood.PRMS).";
+            case RQO_CRT: return "A criterion expressed over requests or orders (ActMood.RQO).";
+            case RSK_CRT: return "A criterion expressed over risks (ActMood.RSK).";
+            case EXPEC: return "Definition: An act that is considered to have some noteworthy likelihood of occurring in the future (has_match = event).\r\n\n                        \n                           Examples:Prognosis of a condition, Expected date of discharge from hospital, patient will likely need an emergency decompression of the intracranial pressure by morning.\r\n\n                        \n                           UsageNotes:INT (intent) reflects a plan for the future, which is a declaration to do something. This contrasts with expectation, which is a prediction that something will happen in the future. GOL (goal) reflects a hope rather than a prediction. RSK (risk) reflects a potential negative event that may or may not be expected to happen.";
+            case GOL: return "Definition: An expectation that is considered to be desirable to occur in the future \r\n\n                        \n                           Examples:Target weight below 80Kg, Stop smoking, Regain ability to walk, goal is to administer thrombolytics to candidate patients presenting with acute myocardial infarction.\r\n\n                        \n                           UsageNotes: INT (intent) reflects a plan for the future, which is a declaration to do something.  This contrasts with goal which doesn't represent an intention to act, merely a hope for an eventual result.  A goal is distinct from the intended actions to reach that goal.  \"I will reduce the dose of drug x to 20mg\" is an intent.  \"I hope to be able to get the patient to the point where I can reduce the dose of drug x to 20mg\" is a goal. EXPEC (expectation) reflects a prediction rather than a hope. RSK (risk) reflects a potential negative event rather than a hope.";
+            case RSK: return "Definition:An act that may occur in the future and which is regarded as undesirable \r\n\n                        \n                           Examples:Increased risk of DVT, at risk for sub-acute bacterial endocarditis.\r\n\n                        \n                           UsageNotes:Note: An observation in RSK mood expresses the undesirable act, and not the underlying risk factor. A risk factor that is present (e.g. obesity, smoking, etc) should be expressed in event mood. INT (intent) reflects a plan for the future, which is a declaration to do something. This contrasts with RSK (risk), which is the potential that something negative will occur that may or may not ever happen. GOL (goal) reflects a hope to achieve something. EXPEC (expectation) is the prediction of a positive or negative event. This contrasts with RSK (risk), which is the potential that something negative will occur that may or may not ever happen, and may not be expected to happen.";
+            case OPT: return "Definition: One of a set of acts that specify an option for the property values that the parent act may have. Typically used in definitions or orders to describe alternatives. An option can only be used as a group, that is, all assigned values must be used together. The actual mood of the act is the same as the parent act, and they must be linked by an actrelationship with type = OPTN.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ACTMOODCOMPLETIONTRACK: return "ActMoodCompletionTrack";
+            case _ACTMOODPOTENTIAL: return "potential";
+            case DEF: return "definition";
+            case PERM: return "permission";
+            case SLOT: return "resource slot";
+            case EVN: return "event (occurrence)";
+            case INT: return "intent";
+            case _ACTMOODDESIRE: return "desire";
+            case _ACTMOODACTREQUEST: return "act request";
+            case ARQ: return "appointment request";
+            case PERMRQ: return "permission request";
+            case RQO: return "request";
+            case PRP: return "proposal";
+            case RMD: return "recommendation";
+            case PRMS: return "promise";
+            case APT: return "appointment";
+            case _ACTMOODPREDICATE: return "ActMoodPredicate";
+            case CRT: return "criterion";
+            case EVN_CRT: return "event criterion";
+            case GOL_CRT: return "goal criterion";
+            case INT_CRT: return "intent criterion";
+            case PRMS_CRT: return "promise criterion";
+            case RQO_CRT: return "request criterion";
+            case RSK_CRT: return "risk criterion";
+            case EXPEC: return "expectation";
+            case GOL: return "Goal";
+            case RSK: return "risk";
+            case OPT: return "option";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActMoodEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActMoodEnumFactory.java
new file mode 100644
index 00000000000..99e98f7933e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActMoodEnumFactory.java
@@ -0,0 +1,166 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActMoodEnumFactory implements EnumFactory {
+
+  public V3ActMood fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ActMoodCompletionTrack".equals(codeString))
+      return V3ActMood._ACTMOODCOMPLETIONTRACK;
+    if ("_ActMoodPotential".equals(codeString))
+      return V3ActMood._ACTMOODPOTENTIAL;
+    if ("DEF".equals(codeString))
+      return V3ActMood.DEF;
+    if ("PERM".equals(codeString))
+      return V3ActMood.PERM;
+    if ("SLOT".equals(codeString))
+      return V3ActMood.SLOT;
+    if ("EVN".equals(codeString))
+      return V3ActMood.EVN;
+    if ("INT".equals(codeString))
+      return V3ActMood.INT;
+    if ("_ActMoodDesire".equals(codeString))
+      return V3ActMood._ACTMOODDESIRE;
+    if ("_ActMoodActRequest".equals(codeString))
+      return V3ActMood._ACTMOODACTREQUEST;
+    if ("ARQ".equals(codeString))
+      return V3ActMood.ARQ;
+    if ("PERMRQ".equals(codeString))
+      return V3ActMood.PERMRQ;
+    if ("RQO".equals(codeString))
+      return V3ActMood.RQO;
+    if ("PRP".equals(codeString))
+      return V3ActMood.PRP;
+    if ("RMD".equals(codeString))
+      return V3ActMood.RMD;
+    if ("PRMS".equals(codeString))
+      return V3ActMood.PRMS;
+    if ("APT".equals(codeString))
+      return V3ActMood.APT;
+    if ("_ActMoodPredicate".equals(codeString))
+      return V3ActMood._ACTMOODPREDICATE;
+    if ("CRT".equals(codeString))
+      return V3ActMood.CRT;
+    if ("EVN.CRT".equals(codeString))
+      return V3ActMood.EVN_CRT;
+    if ("GOL.CRT".equals(codeString))
+      return V3ActMood.GOL_CRT;
+    if ("INT.CRT".equals(codeString))
+      return V3ActMood.INT_CRT;
+    if ("PRMS.CRT".equals(codeString))
+      return V3ActMood.PRMS_CRT;
+    if ("RQO.CRT".equals(codeString))
+      return V3ActMood.RQO_CRT;
+    if ("RSK.CRT".equals(codeString))
+      return V3ActMood.RSK_CRT;
+    if ("EXPEC".equals(codeString))
+      return V3ActMood.EXPEC;
+    if ("GOL".equals(codeString))
+      return V3ActMood.GOL;
+    if ("RSK".equals(codeString))
+      return V3ActMood.RSK;
+    if ("OPT".equals(codeString))
+      return V3ActMood.OPT;
+    throw new IllegalArgumentException("Unknown V3ActMood code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActMood code) {
+    if (code == V3ActMood._ACTMOODCOMPLETIONTRACK)
+      return "_ActMoodCompletionTrack";
+    if (code == V3ActMood._ACTMOODPOTENTIAL)
+      return "_ActMoodPotential";
+    if (code == V3ActMood.DEF)
+      return "DEF";
+    if (code == V3ActMood.PERM)
+      return "PERM";
+    if (code == V3ActMood.SLOT)
+      return "SLOT";
+    if (code == V3ActMood.EVN)
+      return "EVN";
+    if (code == V3ActMood.INT)
+      return "INT";
+    if (code == V3ActMood._ACTMOODDESIRE)
+      return "_ActMoodDesire";
+    if (code == V3ActMood._ACTMOODACTREQUEST)
+      return "_ActMoodActRequest";
+    if (code == V3ActMood.ARQ)
+      return "ARQ";
+    if (code == V3ActMood.PERMRQ)
+      return "PERMRQ";
+    if (code == V3ActMood.RQO)
+      return "RQO";
+    if (code == V3ActMood.PRP)
+      return "PRP";
+    if (code == V3ActMood.RMD)
+      return "RMD";
+    if (code == V3ActMood.PRMS)
+      return "PRMS";
+    if (code == V3ActMood.APT)
+      return "APT";
+    if (code == V3ActMood._ACTMOODPREDICATE)
+      return "_ActMoodPredicate";
+    if (code == V3ActMood.CRT)
+      return "CRT";
+    if (code == V3ActMood.EVN_CRT)
+      return "EVN.CRT";
+    if (code == V3ActMood.GOL_CRT)
+      return "GOL.CRT";
+    if (code == V3ActMood.INT_CRT)
+      return "INT.CRT";
+    if (code == V3ActMood.PRMS_CRT)
+      return "PRMS.CRT";
+    if (code == V3ActMood.RQO_CRT)
+      return "RQO.CRT";
+    if (code == V3ActMood.RSK_CRT)
+      return "RSK.CRT";
+    if (code == V3ActMood.EXPEC)
+      return "EXPEC";
+    if (code == V3ActMood.GOL)
+      return "GOL";
+    if (code == V3ActMood.RSK)
+      return "RSK";
+    if (code == V3ActMood.OPT)
+      return "OPT";
+    return "?";
+  }
+
+    public String toSystem(V3ActMood code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActPriority.java
new file mode 100644
index 00000000000..ba8d65fd3b8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActPriority.java
@@ -0,0 +1,204 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActPriority {
+
+        /**
+         * As soon as possible, next highest priority after stat.
+         */
+        A, 
+        /**
+         * Filler should contact the placer as soon as results are available, even for preliminary results.  (Was "C" in HL7 version 2.3's reporting priority.)
+         */
+        CR, 
+        /**
+         * Filler should contact the placer (or target) to schedule the service.  (Was "C" in HL7 version 2.3's TQ-priority component.)
+         */
+        CS, 
+        /**
+         * Filler should contact the placer to schedule the service.  (Was "C" in HL7 version 2.3's TQ-priority component.)
+         */
+        CSP, 
+        /**
+         * Filler should contact the service recipient (target) to schedule the service.  (Was "C" in HL7 version 2.3's TQ-priority component.)
+         */
+        CSR, 
+        /**
+         * Beneficial to the patient but not essential for survival.
+         */
+        EL, 
+        /**
+         * An unforeseen combination of circumstances or the resulting state that calls for immediate action.
+         */
+        EM, 
+        /**
+         * Used to indicate that a service is to be performed prior to a scheduled surgery.  When ordering a service and using the pre-op priority, a check is done to see the amount of time that must be allowed for performance of the service.  When the order is placed, a message can be generated indicating the time needed for the service so that it is not ordered in conflict with a scheduled operation.
+         */
+        P, 
+        /**
+         * An "as needed" order should be accompanied by a description of what constitutes a need. This description is represented by an observation service predicate as a precondition.
+         */
+        PRN, 
+        /**
+         * Routine service, do at usual work hours.
+         */
+        R, 
+        /**
+         * A report should be prepared and sent as quickly as possible.
+         */
+        RR, 
+        /**
+         * With highest priority (e.g., emergency).
+         */
+        S, 
+        /**
+         * It is critical to come as close as possible to the requested time (e.g., for a through antimicrobial level).
+         */
+        T, 
+        /**
+         * Drug is to be used as directed by the prescriber.
+         */
+        UD, 
+        /**
+         * Calls for prompt action.
+         */
+        UR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("A".equals(codeString))
+          return A;
+        if ("CR".equals(codeString))
+          return CR;
+        if ("CS".equals(codeString))
+          return CS;
+        if ("CSP".equals(codeString))
+          return CSP;
+        if ("CSR".equals(codeString))
+          return CSR;
+        if ("EL".equals(codeString))
+          return EL;
+        if ("EM".equals(codeString))
+          return EM;
+        if ("P".equals(codeString))
+          return P;
+        if ("PRN".equals(codeString))
+          return PRN;
+        if ("R".equals(codeString))
+          return R;
+        if ("RR".equals(codeString))
+          return RR;
+        if ("S".equals(codeString))
+          return S;
+        if ("T".equals(codeString))
+          return T;
+        if ("UD".equals(codeString))
+          return UD;
+        if ("UR".equals(codeString))
+          return UR;
+        throw new FHIRException("Unknown V3ActPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A: return "A";
+            case CR: return "CR";
+            case CS: return "CS";
+            case CSP: return "CSP";
+            case CSR: return "CSR";
+            case EL: return "EL";
+            case EM: return "EM";
+            case P: return "P";
+            case PRN: return "PRN";
+            case R: return "R";
+            case RR: return "RR";
+            case S: return "S";
+            case T: return "T";
+            case UD: return "UD";
+            case UR: return "UR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActPriority";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A: return "As soon as possible, next highest priority after stat.";
+            case CR: return "Filler should contact the placer as soon as results are available, even for preliminary results.  (Was \"C\" in HL7 version 2.3's reporting priority.)";
+            case CS: return "Filler should contact the placer (or target) to schedule the service.  (Was \"C\" in HL7 version 2.3's TQ-priority component.)";
+            case CSP: return "Filler should contact the placer to schedule the service.  (Was \"C\" in HL7 version 2.3's TQ-priority component.)";
+            case CSR: return "Filler should contact the service recipient (target) to schedule the service.  (Was \"C\" in HL7 version 2.3's TQ-priority component.)";
+            case EL: return "Beneficial to the patient but not essential for survival.";
+            case EM: return "An unforeseen combination of circumstances or the resulting state that calls for immediate action.";
+            case P: return "Used to indicate that a service is to be performed prior to a scheduled surgery.  When ordering a service and using the pre-op priority, a check is done to see the amount of time that must be allowed for performance of the service.  When the order is placed, a message can be generated indicating the time needed for the service so that it is not ordered in conflict with a scheduled operation.";
+            case PRN: return "An \"as needed\" order should be accompanied by a description of what constitutes a need. This description is represented by an observation service predicate as a precondition.";
+            case R: return "Routine service, do at usual work hours.";
+            case RR: return "A report should be prepared and sent as quickly as possible.";
+            case S: return "With highest priority (e.g., emergency).";
+            case T: return "It is critical to come as close as possible to the requested time (e.g., for a through antimicrobial level).";
+            case UD: return "Drug is to be used as directed by the prescriber.";
+            case UR: return "Calls for prompt action.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A: return "ASAP";
+            case CR: return "callback results";
+            case CS: return "callback for scheduling";
+            case CSP: return "callback placer for scheduling";
+            case CSR: return "contact recipient for scheduling";
+            case EL: return "elective";
+            case EM: return "emergency";
+            case P: return "preop";
+            case PRN: return "as needed";
+            case R: return "routine";
+            case RR: return "rush reporting";
+            case S: return "stat";
+            case T: return "timing critical";
+            case UD: return "use as directed";
+            case UR: return "urgent";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActPriorityEnumFactory.java
new file mode 100644
index 00000000000..f66d137b2d1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActPriorityEnumFactory.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActPriorityEnumFactory implements EnumFactory {
+
+  public V3ActPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("A".equals(codeString))
+      return V3ActPriority.A;
+    if ("CR".equals(codeString))
+      return V3ActPriority.CR;
+    if ("CS".equals(codeString))
+      return V3ActPriority.CS;
+    if ("CSP".equals(codeString))
+      return V3ActPriority.CSP;
+    if ("CSR".equals(codeString))
+      return V3ActPriority.CSR;
+    if ("EL".equals(codeString))
+      return V3ActPriority.EL;
+    if ("EM".equals(codeString))
+      return V3ActPriority.EM;
+    if ("P".equals(codeString))
+      return V3ActPriority.P;
+    if ("PRN".equals(codeString))
+      return V3ActPriority.PRN;
+    if ("R".equals(codeString))
+      return V3ActPriority.R;
+    if ("RR".equals(codeString))
+      return V3ActPriority.RR;
+    if ("S".equals(codeString))
+      return V3ActPriority.S;
+    if ("T".equals(codeString))
+      return V3ActPriority.T;
+    if ("UD".equals(codeString))
+      return V3ActPriority.UD;
+    if ("UR".equals(codeString))
+      return V3ActPriority.UR;
+    throw new IllegalArgumentException("Unknown V3ActPriority code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActPriority code) {
+    if (code == V3ActPriority.A)
+      return "A";
+    if (code == V3ActPriority.CR)
+      return "CR";
+    if (code == V3ActPriority.CS)
+      return "CS";
+    if (code == V3ActPriority.CSP)
+      return "CSP";
+    if (code == V3ActPriority.CSR)
+      return "CSR";
+    if (code == V3ActPriority.EL)
+      return "EL";
+    if (code == V3ActPriority.EM)
+      return "EM";
+    if (code == V3ActPriority.P)
+      return "P";
+    if (code == V3ActPriority.PRN)
+      return "PRN";
+    if (code == V3ActPriority.R)
+      return "R";
+    if (code == V3ActPriority.RR)
+      return "RR";
+    if (code == V3ActPriority.S)
+      return "S";
+    if (code == V3ActPriority.T)
+      return "T";
+    if (code == V3ActPriority.UD)
+      return "UD";
+    if (code == V3ActPriority.UR)
+      return "UR";
+    return "?";
+  }
+
+    public String toSystem(V3ActPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActReason.java
new file mode 100644
index 00000000000..b6cb5a63015
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActReason.java
@@ -0,0 +1,2527 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActReason {
+
+        /**
+         * Identifies the reason the patient is assigned to this accommodation type
+         */
+        _ACTACCOMMODATIONREASON, 
+        /**
+         * Accommodation requested is not available.
+         */
+        ACCREQNA, 
+        /**
+         * Accommodation is assigned for floor convenience.
+         */
+        FLRCNV, 
+        /**
+         * Required for medical reasons(s).
+         */
+        MEDNEC, 
+        /**
+         * The Patient requested the action
+         */
+        PAT, 
+        /**
+         * Description:Codes used to specify reasons or criteria relating to coverage provided under a policy or program.  May be used to convey reasons pertaining to coverage contractual provisions, including criteria for eligibility, coverage limitations, coverage maximums, or financial participation required of covered parties.
+         */
+        _ACTCOVERAGEREASON, 
+        /**
+         * Identifies the reason or rational for why a person is eligibile for benefits under an insurance policy or progam. 
+
+                        
+                           Examples:  A person is a claimant under an automobile insurance policy are client deceased & adopted client has been given a new policy identifier.  A new employee is eligible for health insurance as an employment benefit.  A person meets a government program eligibility criteria for financial, age or health status.
+         */
+        _ELIGIBILITYACTREASONCODE, 
+        /**
+         * Identifies the reason or rational for why a person is not eligibile for benefits under an insurance policy.
+
+                        Examples are client deceased & adopted client has been given a new policy identifier.
+         */
+        _ACTINELIGIBILITYREASON, 
+        /**
+         * When a client has no contact with the health system for an extended period, coverage is suspended.  Client will be reinstated to original start date upon proof of identification, residency etc.
+
+                        Example: Coverage may be suspended during a strike situation, when employer benefits for employees are not covered (i.e. not in effect).
+         */
+        COVSUS, 
+        /**
+         * Client deceased.
+         */
+        DECSD, 
+        /**
+         * Client was registered in error.
+         */
+        REGERR, 
+        /**
+         * Definition: Identifies the reason or rational for why a person is eligibile for benefits under an insurance policy or progam. 
+
+                        
+                           Examples:  A person is a claimant under an automobile insurance policy are client deceased & adopted client has been given a new policy identifier.  A new employee is eligible for health insurance as an employment benefit.  A person meets a government program eligibility criteria for financial, age or health status.
+         */
+        _COVERAGEELIGIBILITYREASON, 
+        /**
+         * A person becomes eligible for a program based on age.
+
+                        
+                           Example:  In the U.S., a person who is 65 years of age or older is eligible for Medicare.
+         */
+        AGE, 
+        /**
+         * A person becomes eligible for insurance or a program because of crime related health condition or injury. 
+
+                        
+                           Example:  A person is a claimant under the U.S. Crime Victims Compensation program.
+         */
+        CRIME, 
+        /**
+         * A person becomes a claimant under a disability income insurance policy or a disability rehabilitation program because of a health condition or injury which limits the person's ability to earn an income or function without institutionalization.
+         */
+        DIS, 
+        /**
+         * A person becomes eligible for insurance provided as an employment benefit based on employment status.
+         */
+        EMPLOY, 
+        /**
+         * A person becomes eligible for a program based on financial criteria.
+
+                        
+                           Example:  A person whose family income is below a financial threshold for eligibility for Medicaid or SCHIP.
+         */
+        FINAN, 
+        /**
+         * A person becomes eligible for a program because of a qualifying health condition or injury. 
+
+                        
+                           Examples:  A person is determined to have a qualifying health conditions include pregnancy, HIV/AIDs, tuberculosis, end stage renal disease, breast or cervical cancer, or other condition requiring specialized health services, hospice, institutional or community based care provided under a program
+         */
+        HEALTH, 
+        /**
+         * A person becomes eligible for a program based on more than one criterion.
+
+                        
+                           Examples:  In the U.S., a child whose familiy income meets Medicaid financial thresholds and whose age is less than 18 is eligible for the Early and Periodic Screening, Diagnostic, and Treatment program (EPSDT).  A person whose family income meets Medicaid financial thresholds and whose age is 65 years or older is eligible for Medicaid and Medicare, and are referred to as dual eligibles.
+         */
+        MULTI, 
+        /**
+         * A person becomes a claimant under a property and casualty insurance policy because of a related health condition or injury resulting from a circumstance covered under the terms of the policy. 
+
+                        
+                           Example:  A person is a claimant under a homeowners insurance policy because of an injury sustained on the policyholderaTMs premises.
+         */
+        PNC, 
+        /**
+         * A person becomes eligible for a program based on statutory criteria.
+
+                        
+                           Examples:  A person is a member of an indigenous group, a veteran of military service, or  in the U.S., a recipient of adoption assistance and foster care under Title IV-E of the Social Security.
+         */
+        STATUTORY, 
+        /**
+         * A person becomes a claimant under a motor vehicle accident insurance because of a motor vehicle accident related health condition or injury.
+         */
+        VEHIC, 
+        /**
+         * A person becomes eligible for insurance or a program because of a work related health condition or injury. 
+
+                        
+                           Example:  A person is a claimant under the U.S. Black Lung Program.
+         */
+        WORK, 
+        /**
+         * Description:The rationale or purpose for an act relating to information management, such as archiving information for the purpose of complying with an enterprise data retention policy.
+         */
+        _ACTINFORMATIONMANAGEMENTREASON, 
+        /**
+         * Description:The rationale or purpose for an act relating to health information management, such as archiving information for the purpose of complying with an organization policy or jurisdictional law relating to  data retention.
+         */
+        _ACTHEALTHINFORMATIONMANAGEMENTREASON, 
+        /**
+         * To perform one or more operations on information to which the patient has not consented as deemed necessary by authorized entities for providing care in the best interest of the patient; providing immediately needed health care for an emergent condition;  or for protecting public or third party safety.
+
+                        
+                           Usage Notes: Used to convey the reason that a provider or other entity may or has accessed personal healthcare information.  Typically, this involves overriding the subject's consent directives.
+         */
+        _ACTCONSENTINFORMATIONACCESSOVERRIDEREASON, 
+        /**
+         * To perform one or more operations on information to which the patient has not consented by authorized entities for treating a condition which poses an immediate threat to the patient's health and which requires immediate medical intervention.
+
+                        
+                           Usage Notes: The patient is unable to provide consent, but the provider determines they have an urgent healthcare related reason to access the record.
+         */
+        OVRER, 
+        /**
+         * To perform one or more operations on information to which the patient declined to consent for providing health care.
+
+                        
+                           Usage Notes: The patient, while able to give consent, has not.  However the provider believes it is in the patient's interest to access the record without patient consent.
+         */
+        OVRPJ, 
+        /**
+         * To perform one or more operations on information to which the patient has not consented for public safety reasons.
+
+                        
+                           Usage Notes: The patient, while able to give consent, has not.  However, the provider believes that access to masked patient information is justified because of concerns related to public safety.
+         */
+        OVRPS, 
+        /**
+         * To perform one or more operations on information to which the patient has not consented for third party safety.  
+
+                        
+                           Usage Notes: The patient, while able to give consent, has not.  However, the provider believes that access to masked patient information is justified because of concerns related to the health and safety of one or more third parties.
+         */
+        OVRTPS, 
+        /**
+         * Reason for performing one or more operations on information, which may be permitted by source system's security policy in accordance with one or more privacy policies and consent directives.
+
+                        
+                           Usage Notes: The rationale or purpose for an act relating to the management of personal health information, such as collecting personal health information for research or public health purposes.
+         */
+        PURPOSEOFUSE, 
+        /**
+         * To perform one or more operations on information for marketing services and products related to health care.
+         */
+        HMARKT, 
+        /**
+         * To perform one or more operations on information used for conducting administrative and contractual activities related to the provision of health care.
+         */
+        HOPERAT, 
+        /**
+         * To perform one or more operations on information used for cadaveric organ, eye or tissue donation.
+         */
+        DONAT, 
+        /**
+         * To perform one or more operations on information used for fraud detection and prevention processes.
+         */
+        FRAUD, 
+        /**
+         * To perform one or more operations on information used within government processes.
+         */
+        GOV, 
+        /**
+         * To perform one or more operations on information for conducting activities related to meeting accreditation criteria.
+         */
+        HACCRED, 
+        /**
+         * To perform one or more operations on information used for conducting activities required to meet a mandate.
+         */
+        HCOMPL, 
+        /**
+         * To perform one or more operations on information used for handling deceased patient matters.
+         */
+        HDECD, 
+        /**
+         * To perform one or more operation operations on information used to manage a patient directory.
+
+                        
+                           Examples: 
+                        
+
+                        
+                           facility
+                           enterprise
+                           payer
+                           health information exchange patient directory
+         */
+        HDIRECT, 
+        /**
+         * To perform one or more operations on information for conducting activities required by legal proceeding.
+         */
+        HLEGAL, 
+        /**
+         * To perform one or more operations on information used for assessing results and comparative effectiveness achieved by health care practices and interventions.
+         */
+        HOUTCOMS, 
+        /**
+         * To perform one or more operations on information used for conducting activities to meet program accounting requirements.
+         */
+        HPRGRP, 
+        /**
+         * To perform one or more operations on information used for conducting administrative activities to improve health care quality.
+         */
+        HQUALIMP, 
+        /**
+         * To perform one or more operations on information to administer the electronic systems used for the delivery of health care.
+         */
+        HSYSADMIN, 
+        /**
+         * To perform one or more operations on information to administer health care coverage to an enrollee under a policy or program.
+         */
+        MEMADMIN, 
+        /**
+         * To perform one or more operations on information used for operational activities conducted to administer the delivery of health care to a patient.
+         */
+        PATADMIN, 
+        /**
+         * To perform one or more operations on information in processes related to ensuring the safety of health care.
+         */
+        PATSFTY, 
+        /**
+         * To perform one or more operations on information used for monitoring performance of recommended health care practices and interventions.
+         */
+        PERFMSR, 
+        /**
+         * To perform one or more operations on information used within the health records management process.
+         */
+        RECORDMGT, 
+        /**
+         * To perform one or more operations on information used in training and education.
+         */
+        TRAIN, 
+        /**
+         * To perform one or more operations on information for conducting financial or contractual activities related to payment for provision of health care.
+         */
+        HPAYMT, 
+        /**
+         * To perform one or more operations on information for provision of additional clinical evidence in support of a request for coverage or payment for health services.
+         */
+        CLMATTCH, 
+        /**
+         * To perform one or more operations on information for conducting prior authorization or predetermination of coverage for services.
+         */
+        COVAUTH, 
+        /**
+         * To perform one or more operations on information for conducting activities related to coverage under a program or policy.
+         */
+        COVERAGE, 
+        /**
+         * To perform one or more operations on information used for conducting eligibility determination for coverage in a program or policy.  May entail review of financial status or disability assessment.
+         */
+        ELIGDTRM, 
+        /**
+         * To perform one or more operations on information used for conducting eligibility verification of coverage in a program or policy.  May entail provider contacting coverage source (e.g., government health program such as workers compensation or health plan) for confirmation of enrollment, eligibility for specific services, and any applicable copays.
+         */
+        ELIGVER, 
+        /**
+         * To perform one or more operations on information used for enrolling a covered party in a program or policy.  May entail recording of covered party's and any dependent's demographic information and benefit choices.
+         */
+        ENROLLM, 
+        /**
+         * To perform one or more operations on information about the amount remitted for a health care claim.
+         */
+        REMITADV, 
+        /**
+         * To perform one or more operations on information for conducting scientific investigations to obtain health care knowledge.
+         */
+        HRESCH, 
+        /**
+         * To perform one or more operations on information for conducting scientific investigations in accordance with clinical trial protocols to obtain health care knowledge.
+         */
+        CLINTRCH, 
+        /**
+         * To perform one or more operations on information in response to a patient's request.
+         */
+        PATRQT, 
+        /**
+         * To perform one or more operations on information in response to a request by a family member authorized by the patient.
+         */
+        FAMRQT, 
+        /**
+         * To perform one or more operations on information in response to a request by a person appointed as the patient's legal representative.
+         */
+        PWATRNY, 
+        /**
+         * To perform one or more operations on information in response to a request by a person authorized by the patient.
+         */
+        SUPNWK, 
+        /**
+         * To perform one or more operations on information for conducting public health activities, such as the reporting of notifiable conditions.
+         */
+        PUBHLTH, 
+        /**
+         * To perform one or more operations on information used for provision of immediately needed health care to a population of living subjects located in a disaster zone.
+         */
+        DISASTER, 
+        /**
+         * To perform one or more operations on information used to prevent injury or disease to living subjects who may be the target of violence.
+         */
+        THREAT, 
+        /**
+         * To perform one or more operations on information for provision of health care.
+         */
+        TREAT, 
+        /**
+         * To perform one or more operations on information for provision of health care coordination.
+         */
+        CAREMGT, 
+        /**
+         * To perform health care as part of the clinical trial protocol.
+         */
+        CLINTRL, 
+        /**
+         * To perform one or more operations on information for provision of immediately needed health care for an emergent condition.
+         */
+        ETREAT, 
+        /**
+         * To perform one or more operations on information for provision of health care to a population of living subjects, e.g., needle exchange program.
+         */
+        POPHLTH, 
+        /**
+         * Description:The rationale or purpose for an act relating to the management of personal information, such as disclosing personal tax information for the purpose of complying with a court order.
+         */
+        _ACTINFORMATIONPRIVACYREASON, 
+        /**
+         * Description:
+         */
+        MARKT, 
+        /**
+         * Description:Administrative and contractual processes required to support an activity, product, or service
+         */
+        OPERAT, 
+        /**
+         * Definition:To provide information as a result of a subpoena.
+         */
+        LEGAL, 
+        /**
+         * Description:Operational activities conducted for the purposes of meeting of criteria defined by an accrediting entity for an activity, product, or service
+         */
+        ACCRED, 
+        /**
+         * Description:Operational activities required to meet a mandate related to an activity, product, or service
+         */
+        COMPL, 
+        /**
+         * Description:Operational activities conducted to administer information relating to entities involves with an activity, product, or service
+         */
+        ENADMIN, 
+        /**
+         * Description:Operational activities conducted for the purposes of assessing the results of an activity, product, or service
+         */
+        OUTCOMS, 
+        /**
+         * Description:Operational activities conducted to meet program accounting requirements related to an activity, product, or service
+         */
+        PRGRPT, 
+        /**
+         * Description:Operational activities conducted for the purposes of improving the quality of an activity, product, or service
+         */
+        QUALIMP, 
+        /**
+         * Description:Operational activities conducted to administer the electronic systems used for an activity, product, or service
+         */
+        SYSADMN, 
+        /**
+         * Description:Administrative, financial, and contractual processes related to payment for an activity, product, or service
+         */
+        PAYMT, 
+        /**
+         * Description:Investigative activities conducted for the purposes of obtaining knowledge
+         */
+        RESCH, 
+        /**
+         * Description:Provision of a service, product, or capability to an individual or organization
+         */
+        SRVC, 
+        /**
+         * Description: Types of reasons why a substance is invalid for use.
+         */
+        _ACTINVALIDREASON, 
+        /**
+         * Description: Storage conditions caused the substance to be ineffective.
+         */
+        ADVSTORAGE, 
+        /**
+         * Description: Cold chain was not maintained for the substance.
+         */
+        COLDCHNBRK, 
+        /**
+         * Description: The lot from which the substance was drawn was expired.
+         */
+        EXPLOT, 
+        /**
+         * The substance was administered outside of the recommended schedule or practice.
+         */
+        OUTSIDESCHED, 
+        /**
+         * Description: The substance was recalled by the manufacturer.
+         */
+        PRODRECALL, 
+        /**
+         * Domain specifies the codes used to describe reasons why a Provider is cancelling an Invoice or Invoice Grouping.
+         */
+        _ACTINVOICECANCELREASON, 
+        /**
+         * The covered party (patient) specified with the Invoice is not correct.
+         */
+        INCCOVPTY, 
+        /**
+         * The billing information, specified in the Invoice Elements, is not correct.  This could include incorrect costing for items included in the Invoice.
+         */
+        INCINVOICE, 
+        /**
+         * The policy specified with the Invoice is not correct.  For example, it may belong to another Adjudicator or Covered Party.
+         */
+        INCPOLICY, 
+        /**
+         * The provider specified with the Invoice is not correct.
+         */
+        INCPROV, 
+        /**
+         * A coded description of the reason for why a patient did not receive a scheduled immunization.
+
+                        (important for public health strategy
+         */
+        _ACTNOIMMUNIZATIONREASON, 
+        /**
+         * Definition:Testing has shown that the patient already has immunity to the agent targeted by the immunization.
+         */
+        IMMUNE, 
+        /**
+         * Definition:The patient currently has a medical condition for which the vaccine is contraindicated or for which precaution is warranted.
+         */
+        MEDPREC, 
+        /**
+         * Definition:There was no supply of the product on hand to perform the service.
+         */
+        OSTOCK, 
+        /**
+         * Definition:The patient or their guardian objects to receiving the vaccine.
+         */
+        PATOBJ, 
+        /**
+         * Definition:The patient or their guardian objects to receiving the vaccine because of philosophical beliefs.
+         */
+        PHILISOP, 
+        /**
+         * Definition:The patient or their guardian objects to receiving the vaccine on religious grounds.
+         */
+        RELIG, 
+        /**
+         * Definition:The intended vaccine has expired or is otherwise believed to no longer be effective.
+
+                        
+                           Example:Due to temperature exposure.
+         */
+        VACEFF, 
+        /**
+         * Definition:The patient or their guardian objects to receiving the vaccine because of concerns over its safety.
+         */
+        VACSAF, 
+        /**
+         * Indicates why a fulfiller refused to fulfill a supply order, and considered it important to notify other providers of their decision.  E.g. "Suspect fraud", "Possible abuse", "Contraindicated".
+
+                        (used when capturing 'refusal to fill' annotations)
+         */
+        _ACTSUPPLYFULFILLMENTREFUSALREASON, 
+        /**
+         * Definition:The order has been stopped by the prescriber but this fact has not necessarily captured electronically.
+
+                        
+                           Example:A verbal stop, a fax, etc.
+         */
+        FRR01, 
+        /**
+         * Definition:Order has not been fulfilled within a reasonable amount of time, and may not be current.
+         */
+        FRR02, 
+        /**
+         * Definition:Data needed to safely act on the order which was expected to become available independent of the order is not yet available
+
+                        
+                           Example:Lab results, diagnostic imaging, etc.
+         */
+        FRR03, 
+        /**
+         * Definition:Product not available or manufactured. Cannot supply.
+         */
+        FRR04, 
+        /**
+         * Definition:The dispenser has ethical, religious or moral objections to fulfilling the order/dispensing the product.
+         */
+        FRR05, 
+        /**
+         * Definition:Fulfiller not able to provide appropriate care associated with fulfilling the order.
+
+                        
+                           Example:Therapy requires ongoing monitoring by fulfiller and fulfiller will be ending practice, leaving town, unable to schedule necessary time, etc.
+         */
+        FRR06, 
+        /**
+         * Definition:Specifies the reason that an event occurred in a clinical research study.
+         */
+        _CLINICALRESEARCHEVENTREASON, 
+        /**
+         * Definition:The event occurred so that a test or observation performed at a prior event could be performed again due to conditions set forth in the protocol.
+         */
+        RET, 
+        /**
+         * Definition:The event occurred due to it being scheduled in the research protocol.
+         */
+        SCH, 
+        /**
+         * Definition:The event occurred in order to terminate the subject's participation in the study.
+         */
+        TRM, 
+        /**
+         * Definition:The event that occurred was initiated by a study participant (e.g. the subject or the investigator), and did not occur for protocol reasons.
+         */
+        UNS, 
+        /**
+         * Definition:SSpecifies the reason that a test was performed or observation collected in a clinical research study.
+
+                        
+                           Note:This set of codes are not strictly reasons, but are used in the currently Normative standard.  Future revisions of the specification will model these as ActRelationships and thes codes may subsequently be retired.  Thus, these codes should not be used for new specifications.
+         */
+        _CLINICALRESEARCHOBSERVATIONREASON, 
+        /**
+         * Definition:The observation or test was neither defined or scheduled in the study protocol.
+         */
+        NPT, 
+        /**
+         * Definition:The observation or test occurred due to it being defined in the research protocol, and during an activity or event that was scheduled in the protocol.
+         */
+        PPT, 
+        /**
+         * :The observation or test occurred as defined in the research protocol, but at a point in time not specified in the study protocol.
+         */
+        UPT, 
+        /**
+         * Description:Indicates why the prescription should be suspended.
+         */
+        _COMBINEDPHARMACYORDERSUSPENDREASONCODE, 
+        /**
+         * Description:This therapy has been ordered as a backup to a preferred therapy.  This order will be released when and if the preferred therapy is unsuccessful.
+         */
+        ALTCHOICE, 
+        /**
+         * Description:Clarification is required before the order can be acted upon.
+         */
+        CLARIF, 
+        /**
+         * Description:The current level of the medication in the patient's system is too high.  The medication is suspended to allow the level to subside to a safer level.
+         */
+        DRUGHIGH, 
+        /**
+         * Description:The patient has been admitted to a care facility and their community medications are suspended until hospital discharge.
+         */
+        HOSPADM, 
+        /**
+         * Description:The therapy would interfere with a planned lab test and the therapy is being withdrawn until the test is completed.
+         */
+        LABINT, 
+        /**
+         * Description:Patient not available for a period of time due to a scheduled therapy, leave of absence or other reason.
+         */
+        NONAVAIL, 
+        /**
+         * Description:The patient is pregnant or breast feeding.  The therapy will be resumed when the pregnancy is complete and the patient is no longer breastfeeding.
+         */
+        PREG, 
+        /**
+         * Description:The patient is believed to be allergic to a substance that is part of the therapy and the therapy is being temporarily withdrawn to confirm.
+         */
+        SALG, 
+        /**
+         * Description:The drug interacts with a short-term treatment that is more urgently required.  This order will be resumed when the short-term treatment is complete.
+         */
+        SDDI, 
+        /**
+         * Description:Another short-term co-occurring therapy fulfills the same purpose as this therapy.  This therapy will be resumed when the co-occuring therapy is complete.
+         */
+        SDUPTHER, 
+        /**
+         * Description:The patient is believed to have an intolerance to a substance that is part of the therapy and the therapy is being temporarily withdrawn to confirm.
+         */
+        SINTOL, 
+        /**
+         * Description:The drug is contraindicated for patients receiving surgery and the patient is scheduled to be admitted for surgery in the near future.  The drug will be resumed when the patient has sufficiently recovered from the surgery.
+         */
+        SURG, 
+        /**
+         * Description:The patient was previously receiving a medication contraindicated with the current medication.  The current medication will remain on hold until the prior medication has been cleansed from their system.
+         */
+        WASHOUT, 
+        /**
+         * Description:Identifies reasons for nullifying (retracting) a particular control act.
+         */
+        _CONTROLACTNULLIFICATIONREASONCODE, 
+        /**
+         * Description:The decision on which the recorded information was based was changed before the decision had an effect.
+
+                        
+                           Example:Aborted prescription before patient left office, released prescription before suspend took effect.
+         */
+        ALTD, 
+        /**
+         * Description:The information was recorded incorrectly or was recorded in the wrong record.
+         */
+        EIE, 
+        /**
+         * Description: There is no match for the record in the database.
+         */
+        NORECMTCH, 
+        /**
+         * Description: Reasons to refuse a transaction to be undone.
+         */
+        _CONTROLACTNULLIFICATIONREFUSALREASONTYPE, 
+        /**
+         * The record is already in the requested state.
+         */
+        INRQSTATE, 
+        /**
+         * Description: There is no match.
+         */
+        NOMATCH, 
+        /**
+         * Description: There is no match for the product in the master file repository.
+         */
+        NOPRODMTCH, 
+        /**
+         * Description: There is no match for the service in the master file repository.
+         */
+        NOSERMTCH, 
+        /**
+         * Description: There is no match for the record and version.
+         */
+        NOVERMTCH, 
+        /**
+         * Description: There is no permission.
+         */
+        NOPERM, 
+        /**
+         * Definition:The user does not have permission
+         */
+        NOUSERPERM, 
+        /**
+         * Description: The agent does not have permission.
+         */
+        NOAGNTPERM, 
+        /**
+         * Description: The user does not have permission.
+         */
+        NOUSRPERM, 
+        /**
+         * Description: The record and version requested to update is not the current version.
+         */
+        WRNGVER, 
+        /**
+         * Identifies why a specific query, request, or other trigger event occurred.
+         */
+        _CONTROLACTREASON, 
+        /**
+         * Description:Indicates the reason the medication order should be aborted.
+         */
+        _MEDICATIONORDERABORTREASONCODE, 
+        /**
+         * Description:The medication is no longer being manufactured or is otherwise no longer available.
+         */
+        DISCONT, 
+        /**
+         * Description:The therapy has been found to not have the desired therapeutic benefit on the patient.
+         */
+        INEFFECT, 
+        /**
+         * Description:Monitoring the patient while taking the medication, the decision has been made that the therapy is no longer appropriate.
+         */
+        MONIT, 
+        /**
+         * Description:The underlying condition has been resolved or has evolved such that a different treatment is no longer needed.
+         */
+        NOREQ, 
+        /**
+         * Description:The product does not have (or no longer has) coverage under the patientaTMs insurance policy.
+         */
+        NOTCOVER, 
+        /**
+         * Description:The patient refused to take the product.
+         */
+        PREFUS, 
+        /**
+         * Description:The manufacturer or other agency has requested that stocks of a medication be removed from circulation.
+         */
+        RECALL, 
+        /**
+         * Description:Item in current order is no longer in use as requested and a new one has/will be created to replace it.
+         */
+        REPLACE, 
+        /**
+         * Description:The medication is being re-prescribed at a different dosage.
+         */
+        DOSECHG, 
+        /**
+         * Description:Current order was issued with incorrect data and a new order has/will be created to replace it.
+         */
+        REPLACEFIX, 
+        /**
+         * Description: {
+
+  public V3ActReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ActAccommodationReason".equals(codeString))
+      return V3ActReason._ACTACCOMMODATIONREASON;
+    if ("ACCREQNA".equals(codeString))
+      return V3ActReason.ACCREQNA;
+    if ("FLRCNV".equals(codeString))
+      return V3ActReason.FLRCNV;
+    if ("MEDNEC".equals(codeString))
+      return V3ActReason.MEDNEC;
+    if ("PAT".equals(codeString))
+      return V3ActReason.PAT;
+    if ("_ActCoverageReason".equals(codeString))
+      return V3ActReason._ACTCOVERAGEREASON;
+    if ("_EligibilityActReasonCode".equals(codeString))
+      return V3ActReason._ELIGIBILITYACTREASONCODE;
+    if ("_ActIneligibilityReason".equals(codeString))
+      return V3ActReason._ACTINELIGIBILITYREASON;
+    if ("COVSUS".equals(codeString))
+      return V3ActReason.COVSUS;
+    if ("DECSD".equals(codeString))
+      return V3ActReason.DECSD;
+    if ("REGERR".equals(codeString))
+      return V3ActReason.REGERR;
+    if ("_CoverageEligibilityReason".equals(codeString))
+      return V3ActReason._COVERAGEELIGIBILITYREASON;
+    if ("AGE".equals(codeString))
+      return V3ActReason.AGE;
+    if ("CRIME".equals(codeString))
+      return V3ActReason.CRIME;
+    if ("DIS".equals(codeString))
+      return V3ActReason.DIS;
+    if ("EMPLOY".equals(codeString))
+      return V3ActReason.EMPLOY;
+    if ("FINAN".equals(codeString))
+      return V3ActReason.FINAN;
+    if ("HEALTH".equals(codeString))
+      return V3ActReason.HEALTH;
+    if ("MULTI".equals(codeString))
+      return V3ActReason.MULTI;
+    if ("PNC".equals(codeString))
+      return V3ActReason.PNC;
+    if ("STATUTORY".equals(codeString))
+      return V3ActReason.STATUTORY;
+    if ("VEHIC".equals(codeString))
+      return V3ActReason.VEHIC;
+    if ("WORK".equals(codeString))
+      return V3ActReason.WORK;
+    if ("_ActInformationManagementReason".equals(codeString))
+      return V3ActReason._ACTINFORMATIONMANAGEMENTREASON;
+    if ("_ActHealthInformationManagementReason".equals(codeString))
+      return V3ActReason._ACTHEALTHINFORMATIONMANAGEMENTREASON;
+    if ("_ActConsentInformationAccessOverrideReason".equals(codeString))
+      return V3ActReason._ACTCONSENTINFORMATIONACCESSOVERRIDEREASON;
+    if ("OVRER".equals(codeString))
+      return V3ActReason.OVRER;
+    if ("OVRPJ".equals(codeString))
+      return V3ActReason.OVRPJ;
+    if ("OVRPS".equals(codeString))
+      return V3ActReason.OVRPS;
+    if ("OVRTPS".equals(codeString))
+      return V3ActReason.OVRTPS;
+    if ("PurposeOfUse".equals(codeString))
+      return V3ActReason.PURPOSEOFUSE;
+    if ("HMARKT".equals(codeString))
+      return V3ActReason.HMARKT;
+    if ("HOPERAT".equals(codeString))
+      return V3ActReason.HOPERAT;
+    if ("DONAT".equals(codeString))
+      return V3ActReason.DONAT;
+    if ("FRAUD".equals(codeString))
+      return V3ActReason.FRAUD;
+    if ("GOV".equals(codeString))
+      return V3ActReason.GOV;
+    if ("HACCRED".equals(codeString))
+      return V3ActReason.HACCRED;
+    if ("HCOMPL".equals(codeString))
+      return V3ActReason.HCOMPL;
+    if ("HDECD".equals(codeString))
+      return V3ActReason.HDECD;
+    if ("HDIRECT".equals(codeString))
+      return V3ActReason.HDIRECT;
+    if ("HLEGAL".equals(codeString))
+      return V3ActReason.HLEGAL;
+    if ("HOUTCOMS".equals(codeString))
+      return V3ActReason.HOUTCOMS;
+    if ("HPRGRP".equals(codeString))
+      return V3ActReason.HPRGRP;
+    if ("HQUALIMP".equals(codeString))
+      return V3ActReason.HQUALIMP;
+    if ("HSYSADMIN".equals(codeString))
+      return V3ActReason.HSYSADMIN;
+    if ("MEMADMIN".equals(codeString))
+      return V3ActReason.MEMADMIN;
+    if ("PATADMIN".equals(codeString))
+      return V3ActReason.PATADMIN;
+    if ("PATSFTY".equals(codeString))
+      return V3ActReason.PATSFTY;
+    if ("PERFMSR".equals(codeString))
+      return V3ActReason.PERFMSR;
+    if ("RECORDMGT".equals(codeString))
+      return V3ActReason.RECORDMGT;
+    if ("TRAIN".equals(codeString))
+      return V3ActReason.TRAIN;
+    if ("HPAYMT".equals(codeString))
+      return V3ActReason.HPAYMT;
+    if ("CLMATTCH".equals(codeString))
+      return V3ActReason.CLMATTCH;
+    if ("COVAUTH".equals(codeString))
+      return V3ActReason.COVAUTH;
+    if ("COVERAGE".equals(codeString))
+      return V3ActReason.COVERAGE;
+    if ("ELIGDTRM".equals(codeString))
+      return V3ActReason.ELIGDTRM;
+    if ("ELIGVER".equals(codeString))
+      return V3ActReason.ELIGVER;
+    if ("ENROLLM".equals(codeString))
+      return V3ActReason.ENROLLM;
+    if ("REMITADV".equals(codeString))
+      return V3ActReason.REMITADV;
+    if ("HRESCH".equals(codeString))
+      return V3ActReason.HRESCH;
+    if ("CLINTRCH".equals(codeString))
+      return V3ActReason.CLINTRCH;
+    if ("PATRQT".equals(codeString))
+      return V3ActReason.PATRQT;
+    if ("FAMRQT".equals(codeString))
+      return V3ActReason.FAMRQT;
+    if ("PWATRNY".equals(codeString))
+      return V3ActReason.PWATRNY;
+    if ("SUPNWK".equals(codeString))
+      return V3ActReason.SUPNWK;
+    if ("PUBHLTH".equals(codeString))
+      return V3ActReason.PUBHLTH;
+    if ("DISASTER".equals(codeString))
+      return V3ActReason.DISASTER;
+    if ("THREAT".equals(codeString))
+      return V3ActReason.THREAT;
+    if ("TREAT".equals(codeString))
+      return V3ActReason.TREAT;
+    if ("CAREMGT".equals(codeString))
+      return V3ActReason.CAREMGT;
+    if ("CLINTRL".equals(codeString))
+      return V3ActReason.CLINTRL;
+    if ("ETREAT".equals(codeString))
+      return V3ActReason.ETREAT;
+    if ("POPHLTH".equals(codeString))
+      return V3ActReason.POPHLTH;
+    if ("_ActInformationPrivacyReason".equals(codeString))
+      return V3ActReason._ACTINFORMATIONPRIVACYREASON;
+    if ("MARKT".equals(codeString))
+      return V3ActReason.MARKT;
+    if ("OPERAT".equals(codeString))
+      return V3ActReason.OPERAT;
+    if ("LEGAL".equals(codeString))
+      return V3ActReason.LEGAL;
+    if ("ACCRED".equals(codeString))
+      return V3ActReason.ACCRED;
+    if ("COMPL".equals(codeString))
+      return V3ActReason.COMPL;
+    if ("ENADMIN".equals(codeString))
+      return V3ActReason.ENADMIN;
+    if ("OUTCOMS".equals(codeString))
+      return V3ActReason.OUTCOMS;
+    if ("PRGRPT".equals(codeString))
+      return V3ActReason.PRGRPT;
+    if ("QUALIMP".equals(codeString))
+      return V3ActReason.QUALIMP;
+    if ("SYSADMN".equals(codeString))
+      return V3ActReason.SYSADMN;
+    if ("PAYMT".equals(codeString))
+      return V3ActReason.PAYMT;
+    if ("RESCH".equals(codeString))
+      return V3ActReason.RESCH;
+    if ("SRVC".equals(codeString))
+      return V3ActReason.SRVC;
+    if ("_ActInvalidReason".equals(codeString))
+      return V3ActReason._ACTINVALIDREASON;
+    if ("ADVSTORAGE".equals(codeString))
+      return V3ActReason.ADVSTORAGE;
+    if ("COLDCHNBRK".equals(codeString))
+      return V3ActReason.COLDCHNBRK;
+    if ("EXPLOT".equals(codeString))
+      return V3ActReason.EXPLOT;
+    if ("OUTSIDESCHED".equals(codeString))
+      return V3ActReason.OUTSIDESCHED;
+    if ("PRODRECALL".equals(codeString))
+      return V3ActReason.PRODRECALL;
+    if ("_ActInvoiceCancelReason".equals(codeString))
+      return V3ActReason._ACTINVOICECANCELREASON;
+    if ("INCCOVPTY".equals(codeString))
+      return V3ActReason.INCCOVPTY;
+    if ("INCINVOICE".equals(codeString))
+      return V3ActReason.INCINVOICE;
+    if ("INCPOLICY".equals(codeString))
+      return V3ActReason.INCPOLICY;
+    if ("INCPROV".equals(codeString))
+      return V3ActReason.INCPROV;
+    if ("_ActNoImmunizationReason".equals(codeString))
+      return V3ActReason._ACTNOIMMUNIZATIONREASON;
+    if ("IMMUNE".equals(codeString))
+      return V3ActReason.IMMUNE;
+    if ("MEDPREC".equals(codeString))
+      return V3ActReason.MEDPREC;
+    if ("OSTOCK".equals(codeString))
+      return V3ActReason.OSTOCK;
+    if ("PATOBJ".equals(codeString))
+      return V3ActReason.PATOBJ;
+    if ("PHILISOP".equals(codeString))
+      return V3ActReason.PHILISOP;
+    if ("RELIG".equals(codeString))
+      return V3ActReason.RELIG;
+    if ("VACEFF".equals(codeString))
+      return V3ActReason.VACEFF;
+    if ("VACSAF".equals(codeString))
+      return V3ActReason.VACSAF;
+    if ("_ActSupplyFulfillmentRefusalReason".equals(codeString))
+      return V3ActReason._ACTSUPPLYFULFILLMENTREFUSALREASON;
+    if ("FRR01".equals(codeString))
+      return V3ActReason.FRR01;
+    if ("FRR02".equals(codeString))
+      return V3ActReason.FRR02;
+    if ("FRR03".equals(codeString))
+      return V3ActReason.FRR03;
+    if ("FRR04".equals(codeString))
+      return V3ActReason.FRR04;
+    if ("FRR05".equals(codeString))
+      return V3ActReason.FRR05;
+    if ("FRR06".equals(codeString))
+      return V3ActReason.FRR06;
+    if ("_ClinicalResearchEventReason".equals(codeString))
+      return V3ActReason._CLINICALRESEARCHEVENTREASON;
+    if ("RET".equals(codeString))
+      return V3ActReason.RET;
+    if ("SCH".equals(codeString))
+      return V3ActReason.SCH;
+    if ("TRM".equals(codeString))
+      return V3ActReason.TRM;
+    if ("UNS".equals(codeString))
+      return V3ActReason.UNS;
+    if ("_ClinicalResearchObservationReason".equals(codeString))
+      return V3ActReason._CLINICALRESEARCHOBSERVATIONREASON;
+    if ("NPT".equals(codeString))
+      return V3ActReason.NPT;
+    if ("PPT".equals(codeString))
+      return V3ActReason.PPT;
+    if ("UPT".equals(codeString))
+      return V3ActReason.UPT;
+    if ("_CombinedPharmacyOrderSuspendReasonCode".equals(codeString))
+      return V3ActReason._COMBINEDPHARMACYORDERSUSPENDREASONCODE;
+    if ("ALTCHOICE".equals(codeString))
+      return V3ActReason.ALTCHOICE;
+    if ("CLARIF".equals(codeString))
+      return V3ActReason.CLARIF;
+    if ("DRUGHIGH".equals(codeString))
+      return V3ActReason.DRUGHIGH;
+    if ("HOSPADM".equals(codeString))
+      return V3ActReason.HOSPADM;
+    if ("LABINT".equals(codeString))
+      return V3ActReason.LABINT;
+    if ("NON-AVAIL".equals(codeString))
+      return V3ActReason.NONAVAIL;
+    if ("PREG".equals(codeString))
+      return V3ActReason.PREG;
+    if ("SALG".equals(codeString))
+      return V3ActReason.SALG;
+    if ("SDDI".equals(codeString))
+      return V3ActReason.SDDI;
+    if ("SDUPTHER".equals(codeString))
+      return V3ActReason.SDUPTHER;
+    if ("SINTOL".equals(codeString))
+      return V3ActReason.SINTOL;
+    if ("SURG".equals(codeString))
+      return V3ActReason.SURG;
+    if ("WASHOUT".equals(codeString))
+      return V3ActReason.WASHOUT;
+    if ("_ControlActNullificationReasonCode".equals(codeString))
+      return V3ActReason._CONTROLACTNULLIFICATIONREASONCODE;
+    if ("ALTD".equals(codeString))
+      return V3ActReason.ALTD;
+    if ("EIE".equals(codeString))
+      return V3ActReason.EIE;
+    if ("NORECMTCH".equals(codeString))
+      return V3ActReason.NORECMTCH;
+    if ("_ControlActNullificationRefusalReasonType".equals(codeString))
+      return V3ActReason._CONTROLACTNULLIFICATIONREFUSALREASONTYPE;
+    if ("INRQSTATE".equals(codeString))
+      return V3ActReason.INRQSTATE;
+    if ("NOMATCH".equals(codeString))
+      return V3ActReason.NOMATCH;
+    if ("NOPRODMTCH".equals(codeString))
+      return V3ActReason.NOPRODMTCH;
+    if ("NOSERMTCH".equals(codeString))
+      return V3ActReason.NOSERMTCH;
+    if ("NOVERMTCH".equals(codeString))
+      return V3ActReason.NOVERMTCH;
+    if ("NOPERM".equals(codeString))
+      return V3ActReason.NOPERM;
+    if ("NOUSERPERM".equals(codeString))
+      return V3ActReason.NOUSERPERM;
+    if ("NOAGNTPERM".equals(codeString))
+      return V3ActReason.NOAGNTPERM;
+    if ("NOUSRPERM".equals(codeString))
+      return V3ActReason.NOUSRPERM;
+    if ("WRNGVER".equals(codeString))
+      return V3ActReason.WRNGVER;
+    if ("_ControlActReason".equals(codeString))
+      return V3ActReason._CONTROLACTREASON;
+    if ("_MedicationOrderAbortReasonCode".equals(codeString))
+      return V3ActReason._MEDICATIONORDERABORTREASONCODE;
+    if ("DISCONT".equals(codeString))
+      return V3ActReason.DISCONT;
+    if ("INEFFECT".equals(codeString))
+      return V3ActReason.INEFFECT;
+    if ("MONIT".equals(codeString))
+      return V3ActReason.MONIT;
+    if ("NOREQ".equals(codeString))
+      return V3ActReason.NOREQ;
+    if ("NOTCOVER".equals(codeString))
+      return V3ActReason.NOTCOVER;
+    if ("PREFUS".equals(codeString))
+      return V3ActReason.PREFUS;
+    if ("RECALL".equals(codeString))
+      return V3ActReason.RECALL;
+    if ("REPLACE".equals(codeString))
+      return V3ActReason.REPLACE;
+    if ("DOSECHG".equals(codeString))
+      return V3ActReason.DOSECHG;
+    if ("REPLACEFIX".equals(codeString))
+      return V3ActReason.REPLACEFIX;
+    if ("UNABLE".equals(codeString))
+      return V3ActReason.UNABLE;
+    if ("_MedicationOrderReleaseReasonCode".equals(codeString))
+      return V3ActReason._MEDICATIONORDERRELEASEREASONCODE;
+    if ("HOLDDONE".equals(codeString))
+      return V3ActReason.HOLDDONE;
+    if ("HOLDINAP".equals(codeString))
+      return V3ActReason.HOLDINAP;
+    if ("_ModifyPrescriptionReasonType".equals(codeString))
+      return V3ActReason._MODIFYPRESCRIPTIONREASONTYPE;
+    if ("ADMINERROR".equals(codeString))
+      return V3ActReason.ADMINERROR;
+    if ("CLINMOD".equals(codeString))
+      return V3ActReason.CLINMOD;
+    if ("_PharmacySupplyEventAbortReason".equals(codeString))
+      return V3ActReason._PHARMACYSUPPLYEVENTABORTREASON;
+    if ("CONTRA".equals(codeString))
+      return V3ActReason.CONTRA;
+    if ("FOABORT".equals(codeString))
+      return V3ActReason.FOABORT;
+    if ("FOSUSP".equals(codeString))
+      return V3ActReason.FOSUSP;
+    if ("NOPICK".equals(codeString))
+      return V3ActReason.NOPICK;
+    if ("PATDEC".equals(codeString))
+      return V3ActReason.PATDEC;
+    if ("QUANTCHG".equals(codeString))
+      return V3ActReason.QUANTCHG;
+    if ("_PharmacySupplyEventStockReasonCode".equals(codeString))
+      return V3ActReason._PHARMACYSUPPLYEVENTSTOCKREASONCODE;
+    if ("FLRSTCK".equals(codeString))
+      return V3ActReason.FLRSTCK;
+    if ("LTC".equals(codeString))
+      return V3ActReason.LTC;
+    if ("OFFICE".equals(codeString))
+      return V3ActReason.OFFICE;
+    if ("PHARM".equals(codeString))
+      return V3ActReason.PHARM;
+    if ("PROG".equals(codeString))
+      return V3ActReason.PROG;
+    if ("_PharmacySupplyRequestRenewalRefusalReasonCode".equals(codeString))
+      return V3ActReason._PHARMACYSUPPLYREQUESTRENEWALREFUSALREASONCODE;
+    if ("ALREADYRX".equals(codeString))
+      return V3ActReason.ALREADYRX;
+    if ("FAMPHYS".equals(codeString))
+      return V3ActReason.FAMPHYS;
+    if ("MODIFY".equals(codeString))
+      return V3ActReason.MODIFY;
+    if ("NEEDAPMT".equals(codeString))
+      return V3ActReason.NEEDAPMT;
+    if ("NOTAVAIL".equals(codeString))
+      return V3ActReason.NOTAVAIL;
+    if ("NOTPAT".equals(codeString))
+      return V3ActReason.NOTPAT;
+    if ("ONHOLD".equals(codeString))
+      return V3ActReason.ONHOLD;
+    if ("PRNA".equals(codeString))
+      return V3ActReason.PRNA;
+    if ("STOPMED".equals(codeString))
+      return V3ActReason.STOPMED;
+    if ("TOOEARLY".equals(codeString))
+      return V3ActReason.TOOEARLY;
+    if ("_SupplyOrderAbortReasonCode".equals(codeString))
+      return V3ActReason._SUPPLYORDERABORTREASONCODE;
+    if ("IMPROV".equals(codeString))
+      return V3ActReason.IMPROV;
+    if ("INTOL".equals(codeString))
+      return V3ActReason.INTOL;
+    if ("NEWSTR".equals(codeString))
+      return V3ActReason.NEWSTR;
+    if ("NEWTHER".equals(codeString))
+      return V3ActReason.NEWTHER;
+    if ("_GenericUpdateReasonCode".equals(codeString))
+      return V3ActReason._GENERICUPDATEREASONCODE;
+    if ("CHGDATA".equals(codeString))
+      return V3ActReason.CHGDATA;
+    if ("FIXDATA".equals(codeString))
+      return V3ActReason.FIXDATA;
+    if ("MDATA".equals(codeString))
+      return V3ActReason.MDATA;
+    if ("NEWDATA".equals(codeString))
+      return V3ActReason.NEWDATA;
+    if ("UMDATA".equals(codeString))
+      return V3ActReason.UMDATA;
+    if ("_PatientProfileQueryReasonCode".equals(codeString))
+      return V3ActReason._PATIENTPROFILEQUERYREASONCODE;
+    if ("ADMREV".equals(codeString))
+      return V3ActReason.ADMREV;
+    if ("PATCAR".equals(codeString))
+      return V3ActReason.PATCAR;
+    if ("PATREQ".equals(codeString))
+      return V3ActReason.PATREQ;
+    if ("PRCREV".equals(codeString))
+      return V3ActReason.PRCREV;
+    if ("REGUL".equals(codeString))
+      return V3ActReason.REGUL;
+    if ("RSRCH".equals(codeString))
+      return V3ActReason.RSRCH;
+    if ("VALIDATION".equals(codeString))
+      return V3ActReason.VALIDATION;
+    if ("_PharmacySupplyRequestFulfillerRevisionRefusalReasonCode".equals(codeString))
+      return V3ActReason._PHARMACYSUPPLYREQUESTFULFILLERREVISIONREFUSALREASONCODE;
+    if ("LOCKED".equals(codeString))
+      return V3ActReason.LOCKED;
+    if ("UNKWNTARGET".equals(codeString))
+      return V3ActReason.UNKWNTARGET;
+    if ("_RefusalReasonCode".equals(codeString))
+      return V3ActReason._REFUSALREASONCODE;
+    if ("_SchedulingActReason".equals(codeString))
+      return V3ActReason._SCHEDULINGACTREASON;
+    if ("BLK".equals(codeString))
+      return V3ActReason.BLK;
+    if ("DEC".equals(codeString))
+      return V3ActReason.DEC;
+    if ("FIN".equals(codeString))
+      return V3ActReason.FIN;
+    if ("MED".equals(codeString))
+      return V3ActReason.MED;
+    if ("MTG".equals(codeString))
+      return V3ActReason.MTG;
+    if ("PHY".equals(codeString))
+      return V3ActReason.PHY;
+    if ("_StatusRevisionRefusalReasonCode".equals(codeString))
+      return V3ActReason._STATUSREVISIONREFUSALREASONCODE;
+    if ("FILLED".equals(codeString))
+      return V3ActReason.FILLED;
+    if ("_SubstanceAdministrationPermissionRefusalReasonCode".equals(codeString))
+      return V3ActReason._SUBSTANCEADMINISTRATIONPERMISSIONREFUSALREASONCODE;
+    if ("PATINELIG".equals(codeString))
+      return V3ActReason.PATINELIG;
+    if ("PROTUNMET".equals(codeString))
+      return V3ActReason.PROTUNMET;
+    if ("PROVUNAUTH".equals(codeString))
+      return V3ActReason.PROVUNAUTH;
+    if ("_SubstanceAdminSubstitutionNotAllowedReason".equals(codeString))
+      return V3ActReason._SUBSTANCEADMINSUBSTITUTIONNOTALLOWEDREASON;
+    if ("ALGINT".equals(codeString))
+      return V3ActReason.ALGINT;
+    if ("COMPCON".equals(codeString))
+      return V3ActReason.COMPCON;
+    if ("THERCHAR".equals(codeString))
+      return V3ActReason.THERCHAR;
+    if ("TRIAL".equals(codeString))
+      return V3ActReason.TRIAL;
+    if ("_SubstanceAdminSubstitutionReason".equals(codeString))
+      return V3ActReason._SUBSTANCEADMINSUBSTITUTIONREASON;
+    if ("CT".equals(codeString))
+      return V3ActReason.CT;
+    if ("FP".equals(codeString))
+      return V3ActReason.FP;
+    if ("OS".equals(codeString))
+      return V3ActReason.OS;
+    if ("RR".equals(codeString))
+      return V3ActReason.RR;
+    if ("_TransferActReason".equals(codeString))
+      return V3ActReason._TRANSFERACTREASON;
+    if ("ER".equals(codeString))
+      return V3ActReason.ER;
+    if ("RQ".equals(codeString))
+      return V3ActReason.RQ;
+    if ("_ActBillableServiceReason".equals(codeString))
+      return V3ActReason._ACTBILLABLESERVICEREASON;
+    if ("_ActBillableClinicalServiceReason".equals(codeString))
+      return V3ActReason._ACTBILLABLECLINICALSERVICEREASON;
+    if ("BONUS".equals(codeString))
+      return V3ActReason.BONUS;
+    if ("CHD".equals(codeString))
+      return V3ActReason.CHD;
+    if ("DEP".equals(codeString))
+      return V3ActReason.DEP;
+    if ("ECH".equals(codeString))
+      return V3ActReason.ECH;
+    if ("EDU".equals(codeString))
+      return V3ActReason.EDU;
+    if ("EMP".equals(codeString))
+      return V3ActReason.EMP;
+    if ("ESP".equals(codeString))
+      return V3ActReason.ESP;
+    if ("FAM".equals(codeString))
+      return V3ActReason.FAM;
+    if ("IND".equals(codeString))
+      return V3ActReason.IND;
+    if ("INVOICE".equals(codeString))
+      return V3ActReason.INVOICE;
+    if ("PROA".equals(codeString))
+      return V3ActReason.PROA;
+    if ("RECOV".equals(codeString))
+      return V3ActReason.RECOV;
+    if ("RETRO".equals(codeString))
+      return V3ActReason.RETRO;
+    if ("SPC".equals(codeString))
+      return V3ActReason.SPC;
+    if ("SPO".equals(codeString))
+      return V3ActReason.SPO;
+    if ("TRAN".equals(codeString))
+      return V3ActReason.TRAN;
+    throw new IllegalArgumentException("Unknown V3ActReason code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActReason code) {
+    if (code == V3ActReason._ACTACCOMMODATIONREASON)
+      return "_ActAccommodationReason";
+    if (code == V3ActReason.ACCREQNA)
+      return "ACCREQNA";
+    if (code == V3ActReason.FLRCNV)
+      return "FLRCNV";
+    if (code == V3ActReason.MEDNEC)
+      return "MEDNEC";
+    if (code == V3ActReason.PAT)
+      return "PAT";
+    if (code == V3ActReason._ACTCOVERAGEREASON)
+      return "_ActCoverageReason";
+    if (code == V3ActReason._ELIGIBILITYACTREASONCODE)
+      return "_EligibilityActReasonCode";
+    if (code == V3ActReason._ACTINELIGIBILITYREASON)
+      return "_ActIneligibilityReason";
+    if (code == V3ActReason.COVSUS)
+      return "COVSUS";
+    if (code == V3ActReason.DECSD)
+      return "DECSD";
+    if (code == V3ActReason.REGERR)
+      return "REGERR";
+    if (code == V3ActReason._COVERAGEELIGIBILITYREASON)
+      return "_CoverageEligibilityReason";
+    if (code == V3ActReason.AGE)
+      return "AGE";
+    if (code == V3ActReason.CRIME)
+      return "CRIME";
+    if (code == V3ActReason.DIS)
+      return "DIS";
+    if (code == V3ActReason.EMPLOY)
+      return "EMPLOY";
+    if (code == V3ActReason.FINAN)
+      return "FINAN";
+    if (code == V3ActReason.HEALTH)
+      return "HEALTH";
+    if (code == V3ActReason.MULTI)
+      return "MULTI";
+    if (code == V3ActReason.PNC)
+      return "PNC";
+    if (code == V3ActReason.STATUTORY)
+      return "STATUTORY";
+    if (code == V3ActReason.VEHIC)
+      return "VEHIC";
+    if (code == V3ActReason.WORK)
+      return "WORK";
+    if (code == V3ActReason._ACTINFORMATIONMANAGEMENTREASON)
+      return "_ActInformationManagementReason";
+    if (code == V3ActReason._ACTHEALTHINFORMATIONMANAGEMENTREASON)
+      return "_ActHealthInformationManagementReason";
+    if (code == V3ActReason._ACTCONSENTINFORMATIONACCESSOVERRIDEREASON)
+      return "_ActConsentInformationAccessOverrideReason";
+    if (code == V3ActReason.OVRER)
+      return "OVRER";
+    if (code == V3ActReason.OVRPJ)
+      return "OVRPJ";
+    if (code == V3ActReason.OVRPS)
+      return "OVRPS";
+    if (code == V3ActReason.OVRTPS)
+      return "OVRTPS";
+    if (code == V3ActReason.PURPOSEOFUSE)
+      return "PurposeOfUse";
+    if (code == V3ActReason.HMARKT)
+      return "HMARKT";
+    if (code == V3ActReason.HOPERAT)
+      return "HOPERAT";
+    if (code == V3ActReason.DONAT)
+      return "DONAT";
+    if (code == V3ActReason.FRAUD)
+      return "FRAUD";
+    if (code == V3ActReason.GOV)
+      return "GOV";
+    if (code == V3ActReason.HACCRED)
+      return "HACCRED";
+    if (code == V3ActReason.HCOMPL)
+      return "HCOMPL";
+    if (code == V3ActReason.HDECD)
+      return "HDECD";
+    if (code == V3ActReason.HDIRECT)
+      return "HDIRECT";
+    if (code == V3ActReason.HLEGAL)
+      return "HLEGAL";
+    if (code == V3ActReason.HOUTCOMS)
+      return "HOUTCOMS";
+    if (code == V3ActReason.HPRGRP)
+      return "HPRGRP";
+    if (code == V3ActReason.HQUALIMP)
+      return "HQUALIMP";
+    if (code == V3ActReason.HSYSADMIN)
+      return "HSYSADMIN";
+    if (code == V3ActReason.MEMADMIN)
+      return "MEMADMIN";
+    if (code == V3ActReason.PATADMIN)
+      return "PATADMIN";
+    if (code == V3ActReason.PATSFTY)
+      return "PATSFTY";
+    if (code == V3ActReason.PERFMSR)
+      return "PERFMSR";
+    if (code == V3ActReason.RECORDMGT)
+      return "RECORDMGT";
+    if (code == V3ActReason.TRAIN)
+      return "TRAIN";
+    if (code == V3ActReason.HPAYMT)
+      return "HPAYMT";
+    if (code == V3ActReason.CLMATTCH)
+      return "CLMATTCH";
+    if (code == V3ActReason.COVAUTH)
+      return "COVAUTH";
+    if (code == V3ActReason.COVERAGE)
+      return "COVERAGE";
+    if (code == V3ActReason.ELIGDTRM)
+      return "ELIGDTRM";
+    if (code == V3ActReason.ELIGVER)
+      return "ELIGVER";
+    if (code == V3ActReason.ENROLLM)
+      return "ENROLLM";
+    if (code == V3ActReason.REMITADV)
+      return "REMITADV";
+    if (code == V3ActReason.HRESCH)
+      return "HRESCH";
+    if (code == V3ActReason.CLINTRCH)
+      return "CLINTRCH";
+    if (code == V3ActReason.PATRQT)
+      return "PATRQT";
+    if (code == V3ActReason.FAMRQT)
+      return "FAMRQT";
+    if (code == V3ActReason.PWATRNY)
+      return "PWATRNY";
+    if (code == V3ActReason.SUPNWK)
+      return "SUPNWK";
+    if (code == V3ActReason.PUBHLTH)
+      return "PUBHLTH";
+    if (code == V3ActReason.DISASTER)
+      return "DISASTER";
+    if (code == V3ActReason.THREAT)
+      return "THREAT";
+    if (code == V3ActReason.TREAT)
+      return "TREAT";
+    if (code == V3ActReason.CAREMGT)
+      return "CAREMGT";
+    if (code == V3ActReason.CLINTRL)
+      return "CLINTRL";
+    if (code == V3ActReason.ETREAT)
+      return "ETREAT";
+    if (code == V3ActReason.POPHLTH)
+      return "POPHLTH";
+    if (code == V3ActReason._ACTINFORMATIONPRIVACYREASON)
+      return "_ActInformationPrivacyReason";
+    if (code == V3ActReason.MARKT)
+      return "MARKT";
+    if (code == V3ActReason.OPERAT)
+      return "OPERAT";
+    if (code == V3ActReason.LEGAL)
+      return "LEGAL";
+    if (code == V3ActReason.ACCRED)
+      return "ACCRED";
+    if (code == V3ActReason.COMPL)
+      return "COMPL";
+    if (code == V3ActReason.ENADMIN)
+      return "ENADMIN";
+    if (code == V3ActReason.OUTCOMS)
+      return "OUTCOMS";
+    if (code == V3ActReason.PRGRPT)
+      return "PRGRPT";
+    if (code == V3ActReason.QUALIMP)
+      return "QUALIMP";
+    if (code == V3ActReason.SYSADMN)
+      return "SYSADMN";
+    if (code == V3ActReason.PAYMT)
+      return "PAYMT";
+    if (code == V3ActReason.RESCH)
+      return "RESCH";
+    if (code == V3ActReason.SRVC)
+      return "SRVC";
+    if (code == V3ActReason._ACTINVALIDREASON)
+      return "_ActInvalidReason";
+    if (code == V3ActReason.ADVSTORAGE)
+      return "ADVSTORAGE";
+    if (code == V3ActReason.COLDCHNBRK)
+      return "COLDCHNBRK";
+    if (code == V3ActReason.EXPLOT)
+      return "EXPLOT";
+    if (code == V3ActReason.OUTSIDESCHED)
+      return "OUTSIDESCHED";
+    if (code == V3ActReason.PRODRECALL)
+      return "PRODRECALL";
+    if (code == V3ActReason._ACTINVOICECANCELREASON)
+      return "_ActInvoiceCancelReason";
+    if (code == V3ActReason.INCCOVPTY)
+      return "INCCOVPTY";
+    if (code == V3ActReason.INCINVOICE)
+      return "INCINVOICE";
+    if (code == V3ActReason.INCPOLICY)
+      return "INCPOLICY";
+    if (code == V3ActReason.INCPROV)
+      return "INCPROV";
+    if (code == V3ActReason._ACTNOIMMUNIZATIONREASON)
+      return "_ActNoImmunizationReason";
+    if (code == V3ActReason.IMMUNE)
+      return "IMMUNE";
+    if (code == V3ActReason.MEDPREC)
+      return "MEDPREC";
+    if (code == V3ActReason.OSTOCK)
+      return "OSTOCK";
+    if (code == V3ActReason.PATOBJ)
+      return "PATOBJ";
+    if (code == V3ActReason.PHILISOP)
+      return "PHILISOP";
+    if (code == V3ActReason.RELIG)
+      return "RELIG";
+    if (code == V3ActReason.VACEFF)
+      return "VACEFF";
+    if (code == V3ActReason.VACSAF)
+      return "VACSAF";
+    if (code == V3ActReason._ACTSUPPLYFULFILLMENTREFUSALREASON)
+      return "_ActSupplyFulfillmentRefusalReason";
+    if (code == V3ActReason.FRR01)
+      return "FRR01";
+    if (code == V3ActReason.FRR02)
+      return "FRR02";
+    if (code == V3ActReason.FRR03)
+      return "FRR03";
+    if (code == V3ActReason.FRR04)
+      return "FRR04";
+    if (code == V3ActReason.FRR05)
+      return "FRR05";
+    if (code == V3ActReason.FRR06)
+      return "FRR06";
+    if (code == V3ActReason._CLINICALRESEARCHEVENTREASON)
+      return "_ClinicalResearchEventReason";
+    if (code == V3ActReason.RET)
+      return "RET";
+    if (code == V3ActReason.SCH)
+      return "SCH";
+    if (code == V3ActReason.TRM)
+      return "TRM";
+    if (code == V3ActReason.UNS)
+      return "UNS";
+    if (code == V3ActReason._CLINICALRESEARCHOBSERVATIONREASON)
+      return "_ClinicalResearchObservationReason";
+    if (code == V3ActReason.NPT)
+      return "NPT";
+    if (code == V3ActReason.PPT)
+      return "PPT";
+    if (code == V3ActReason.UPT)
+      return "UPT";
+    if (code == V3ActReason._COMBINEDPHARMACYORDERSUSPENDREASONCODE)
+      return "_CombinedPharmacyOrderSuspendReasonCode";
+    if (code == V3ActReason.ALTCHOICE)
+      return "ALTCHOICE";
+    if (code == V3ActReason.CLARIF)
+      return "CLARIF";
+    if (code == V3ActReason.DRUGHIGH)
+      return "DRUGHIGH";
+    if (code == V3ActReason.HOSPADM)
+      return "HOSPADM";
+    if (code == V3ActReason.LABINT)
+      return "LABINT";
+    if (code == V3ActReason.NONAVAIL)
+      return "NON-AVAIL";
+    if (code == V3ActReason.PREG)
+      return "PREG";
+    if (code == V3ActReason.SALG)
+      return "SALG";
+    if (code == V3ActReason.SDDI)
+      return "SDDI";
+    if (code == V3ActReason.SDUPTHER)
+      return "SDUPTHER";
+    if (code == V3ActReason.SINTOL)
+      return "SINTOL";
+    if (code == V3ActReason.SURG)
+      return "SURG";
+    if (code == V3ActReason.WASHOUT)
+      return "WASHOUT";
+    if (code == V3ActReason._CONTROLACTNULLIFICATIONREASONCODE)
+      return "_ControlActNullificationReasonCode";
+    if (code == V3ActReason.ALTD)
+      return "ALTD";
+    if (code == V3ActReason.EIE)
+      return "EIE";
+    if (code == V3ActReason.NORECMTCH)
+      return "NORECMTCH";
+    if (code == V3ActReason._CONTROLACTNULLIFICATIONREFUSALREASONTYPE)
+      return "_ControlActNullificationRefusalReasonType";
+    if (code == V3ActReason.INRQSTATE)
+      return "INRQSTATE";
+    if (code == V3ActReason.NOMATCH)
+      return "NOMATCH";
+    if (code == V3ActReason.NOPRODMTCH)
+      return "NOPRODMTCH";
+    if (code == V3ActReason.NOSERMTCH)
+      return "NOSERMTCH";
+    if (code == V3ActReason.NOVERMTCH)
+      return "NOVERMTCH";
+    if (code == V3ActReason.NOPERM)
+      return "NOPERM";
+    if (code == V3ActReason.NOUSERPERM)
+      return "NOUSERPERM";
+    if (code == V3ActReason.NOAGNTPERM)
+      return "NOAGNTPERM";
+    if (code == V3ActReason.NOUSRPERM)
+      return "NOUSRPERM";
+    if (code == V3ActReason.WRNGVER)
+      return "WRNGVER";
+    if (code == V3ActReason._CONTROLACTREASON)
+      return "_ControlActReason";
+    if (code == V3ActReason._MEDICATIONORDERABORTREASONCODE)
+      return "_MedicationOrderAbortReasonCode";
+    if (code == V3ActReason.DISCONT)
+      return "DISCONT";
+    if (code == V3ActReason.INEFFECT)
+      return "INEFFECT";
+    if (code == V3ActReason.MONIT)
+      return "MONIT";
+    if (code == V3ActReason.NOREQ)
+      return "NOREQ";
+    if (code == V3ActReason.NOTCOVER)
+      return "NOTCOVER";
+    if (code == V3ActReason.PREFUS)
+      return "PREFUS";
+    if (code == V3ActReason.RECALL)
+      return "RECALL";
+    if (code == V3ActReason.REPLACE)
+      return "REPLACE";
+    if (code == V3ActReason.DOSECHG)
+      return "DOSECHG";
+    if (code == V3ActReason.REPLACEFIX)
+      return "REPLACEFIX";
+    if (code == V3ActReason.UNABLE)
+      return "UNABLE";
+    if (code == V3ActReason._MEDICATIONORDERRELEASEREASONCODE)
+      return "_MedicationOrderReleaseReasonCode";
+    if (code == V3ActReason.HOLDDONE)
+      return "HOLDDONE";
+    if (code == V3ActReason.HOLDINAP)
+      return "HOLDINAP";
+    if (code == V3ActReason._MODIFYPRESCRIPTIONREASONTYPE)
+      return "_ModifyPrescriptionReasonType";
+    if (code == V3ActReason.ADMINERROR)
+      return "ADMINERROR";
+    if (code == V3ActReason.CLINMOD)
+      return "CLINMOD";
+    if (code == V3ActReason._PHARMACYSUPPLYEVENTABORTREASON)
+      return "_PharmacySupplyEventAbortReason";
+    if (code == V3ActReason.CONTRA)
+      return "CONTRA";
+    if (code == V3ActReason.FOABORT)
+      return "FOABORT";
+    if (code == V3ActReason.FOSUSP)
+      return "FOSUSP";
+    if (code == V3ActReason.NOPICK)
+      return "NOPICK";
+    if (code == V3ActReason.PATDEC)
+      return "PATDEC";
+    if (code == V3ActReason.QUANTCHG)
+      return "QUANTCHG";
+    if (code == V3ActReason._PHARMACYSUPPLYEVENTSTOCKREASONCODE)
+      return "_PharmacySupplyEventStockReasonCode";
+    if (code == V3ActReason.FLRSTCK)
+      return "FLRSTCK";
+    if (code == V3ActReason.LTC)
+      return "LTC";
+    if (code == V3ActReason.OFFICE)
+      return "OFFICE";
+    if (code == V3ActReason.PHARM)
+      return "PHARM";
+    if (code == V3ActReason.PROG)
+      return "PROG";
+    if (code == V3ActReason._PHARMACYSUPPLYREQUESTRENEWALREFUSALREASONCODE)
+      return "_PharmacySupplyRequestRenewalRefusalReasonCode";
+    if (code == V3ActReason.ALREADYRX)
+      return "ALREADYRX";
+    if (code == V3ActReason.FAMPHYS)
+      return "FAMPHYS";
+    if (code == V3ActReason.MODIFY)
+      return "MODIFY";
+    if (code == V3ActReason.NEEDAPMT)
+      return "NEEDAPMT";
+    if (code == V3ActReason.NOTAVAIL)
+      return "NOTAVAIL";
+    if (code == V3ActReason.NOTPAT)
+      return "NOTPAT";
+    if (code == V3ActReason.ONHOLD)
+      return "ONHOLD";
+    if (code == V3ActReason.PRNA)
+      return "PRNA";
+    if (code == V3ActReason.STOPMED)
+      return "STOPMED";
+    if (code == V3ActReason.TOOEARLY)
+      return "TOOEARLY";
+    if (code == V3ActReason._SUPPLYORDERABORTREASONCODE)
+      return "_SupplyOrderAbortReasonCode";
+    if (code == V3ActReason.IMPROV)
+      return "IMPROV";
+    if (code == V3ActReason.INTOL)
+      return "INTOL";
+    if (code == V3ActReason.NEWSTR)
+      return "NEWSTR";
+    if (code == V3ActReason.NEWTHER)
+      return "NEWTHER";
+    if (code == V3ActReason._GENERICUPDATEREASONCODE)
+      return "_GenericUpdateReasonCode";
+    if (code == V3ActReason.CHGDATA)
+      return "CHGDATA";
+    if (code == V3ActReason.FIXDATA)
+      return "FIXDATA";
+    if (code == V3ActReason.MDATA)
+      return "MDATA";
+    if (code == V3ActReason.NEWDATA)
+      return "NEWDATA";
+    if (code == V3ActReason.UMDATA)
+      return "UMDATA";
+    if (code == V3ActReason._PATIENTPROFILEQUERYREASONCODE)
+      return "_PatientProfileQueryReasonCode";
+    if (code == V3ActReason.ADMREV)
+      return "ADMREV";
+    if (code == V3ActReason.PATCAR)
+      return "PATCAR";
+    if (code == V3ActReason.PATREQ)
+      return "PATREQ";
+    if (code == V3ActReason.PRCREV)
+      return "PRCREV";
+    if (code == V3ActReason.REGUL)
+      return "REGUL";
+    if (code == V3ActReason.RSRCH)
+      return "RSRCH";
+    if (code == V3ActReason.VALIDATION)
+      return "VALIDATION";
+    if (code == V3ActReason._PHARMACYSUPPLYREQUESTFULFILLERREVISIONREFUSALREASONCODE)
+      return "_PharmacySupplyRequestFulfillerRevisionRefusalReasonCode";
+    if (code == V3ActReason.LOCKED)
+      return "LOCKED";
+    if (code == V3ActReason.UNKWNTARGET)
+      return "UNKWNTARGET";
+    if (code == V3ActReason._REFUSALREASONCODE)
+      return "_RefusalReasonCode";
+    if (code == V3ActReason._SCHEDULINGACTREASON)
+      return "_SchedulingActReason";
+    if (code == V3ActReason.BLK)
+      return "BLK";
+    if (code == V3ActReason.DEC)
+      return "DEC";
+    if (code == V3ActReason.FIN)
+      return "FIN";
+    if (code == V3ActReason.MED)
+      return "MED";
+    if (code == V3ActReason.MTG)
+      return "MTG";
+    if (code == V3ActReason.PHY)
+      return "PHY";
+    if (code == V3ActReason._STATUSREVISIONREFUSALREASONCODE)
+      return "_StatusRevisionRefusalReasonCode";
+    if (code == V3ActReason.FILLED)
+      return "FILLED";
+    if (code == V3ActReason._SUBSTANCEADMINISTRATIONPERMISSIONREFUSALREASONCODE)
+      return "_SubstanceAdministrationPermissionRefusalReasonCode";
+    if (code == V3ActReason.PATINELIG)
+      return "PATINELIG";
+    if (code == V3ActReason.PROTUNMET)
+      return "PROTUNMET";
+    if (code == V3ActReason.PROVUNAUTH)
+      return "PROVUNAUTH";
+    if (code == V3ActReason._SUBSTANCEADMINSUBSTITUTIONNOTALLOWEDREASON)
+      return "_SubstanceAdminSubstitutionNotAllowedReason";
+    if (code == V3ActReason.ALGINT)
+      return "ALGINT";
+    if (code == V3ActReason.COMPCON)
+      return "COMPCON";
+    if (code == V3ActReason.THERCHAR)
+      return "THERCHAR";
+    if (code == V3ActReason.TRIAL)
+      return "TRIAL";
+    if (code == V3ActReason._SUBSTANCEADMINSUBSTITUTIONREASON)
+      return "_SubstanceAdminSubstitutionReason";
+    if (code == V3ActReason.CT)
+      return "CT";
+    if (code == V3ActReason.FP)
+      return "FP";
+    if (code == V3ActReason.OS)
+      return "OS";
+    if (code == V3ActReason.RR)
+      return "RR";
+    if (code == V3ActReason._TRANSFERACTREASON)
+      return "_TransferActReason";
+    if (code == V3ActReason.ER)
+      return "ER";
+    if (code == V3ActReason.RQ)
+      return "RQ";
+    if (code == V3ActReason._ACTBILLABLESERVICEREASON)
+      return "_ActBillableServiceReason";
+    if (code == V3ActReason._ACTBILLABLECLINICALSERVICEREASON)
+      return "_ActBillableClinicalServiceReason";
+    if (code == V3ActReason.BONUS)
+      return "BONUS";
+    if (code == V3ActReason.CHD)
+      return "CHD";
+    if (code == V3ActReason.DEP)
+      return "DEP";
+    if (code == V3ActReason.ECH)
+      return "ECH";
+    if (code == V3ActReason.EDU)
+      return "EDU";
+    if (code == V3ActReason.EMP)
+      return "EMP";
+    if (code == V3ActReason.ESP)
+      return "ESP";
+    if (code == V3ActReason.FAM)
+      return "FAM";
+    if (code == V3ActReason.IND)
+      return "IND";
+    if (code == V3ActReason.INVOICE)
+      return "INVOICE";
+    if (code == V3ActReason.PROA)
+      return "PROA";
+    if (code == V3ActReason.RECOV)
+      return "RECOV";
+    if (code == V3ActReason.RETRO)
+      return "RETRO";
+    if (code == V3ActReason.SPC)
+      return "SPC";
+    if (code == V3ActReason.SPO)
+      return "SPO";
+    if (code == V3ActReason.TRAN)
+      return "TRAN";
+    return "?";
+  }
+
+    public String toSystem(V3ActReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipCheckpoint.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipCheckpoint.java
new file mode 100644
index 00000000000..9e16dc3b0c2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipCheckpoint.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActRelationshipCheckpoint {
+
+        /**
+         * Condition is tested every time before execution of the service (WHILE condition DO service).
+         */
+        B, 
+        /**
+         * Condition is tested at the end of a repeated service execution.  The service is repeated only if the condition is true (DO service WHILE condition).
+         */
+        E, 
+        /**
+         * Condition is tested once before the service is executed (IF condition THEN service).
+         */
+        S, 
+        /**
+         * Condition must be true throughout the execution and the service is interrupted (asynchronously) as soon as the condition turns false (asynchronous WHILE loop).  The service must be interruptible.
+         */
+        T, 
+        /**
+         * Condition is a loop checkpoint, i.e. it is a step of an activity plan and, if negative causes the containing loop to exit.
+         */
+        X, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActRelationshipCheckpoint fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("B".equals(codeString))
+          return B;
+        if ("E".equals(codeString))
+          return E;
+        if ("S".equals(codeString))
+          return S;
+        if ("T".equals(codeString))
+          return T;
+        if ("X".equals(codeString))
+          return X;
+        throw new FHIRException("Unknown V3ActRelationshipCheckpoint code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case B: return "B";
+            case E: return "E";
+            case S: return "S";
+            case T: return "T";
+            case X: return "X";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActRelationshipCheckpoint";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case B: return "Condition is tested every time before execution of the service (WHILE condition DO service).";
+            case E: return "Condition is tested at the end of a repeated service execution.  The service is repeated only if the condition is true (DO service WHILE condition).";
+            case S: return "Condition is tested once before the service is executed (IF condition THEN service).";
+            case T: return "Condition must be true throughout the execution and the service is interrupted (asynchronously) as soon as the condition turns false (asynchronous WHILE loop).  The service must be interruptible.";
+            case X: return "Condition is a loop checkpoint, i.e. it is a step of an activity plan and, if negative causes the containing loop to exit.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case B: return "beginning";
+            case E: return "end";
+            case S: return "entry";
+            case T: return "through";
+            case X: return "exit";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipCheckpointEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipCheckpointEnumFactory.java
new file mode 100644
index 00000000000..b361296bc38
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipCheckpointEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActRelationshipCheckpointEnumFactory implements EnumFactory {
+
+  public V3ActRelationshipCheckpoint fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("B".equals(codeString))
+      return V3ActRelationshipCheckpoint.B;
+    if ("E".equals(codeString))
+      return V3ActRelationshipCheckpoint.E;
+    if ("S".equals(codeString))
+      return V3ActRelationshipCheckpoint.S;
+    if ("T".equals(codeString))
+      return V3ActRelationshipCheckpoint.T;
+    if ("X".equals(codeString))
+      return V3ActRelationshipCheckpoint.X;
+    throw new IllegalArgumentException("Unknown V3ActRelationshipCheckpoint code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActRelationshipCheckpoint code) {
+    if (code == V3ActRelationshipCheckpoint.B)
+      return "B";
+    if (code == V3ActRelationshipCheckpoint.E)
+      return "E";
+    if (code == V3ActRelationshipCheckpoint.S)
+      return "S";
+    if (code == V3ActRelationshipCheckpoint.T)
+      return "T";
+    if (code == V3ActRelationshipCheckpoint.X)
+      return "X";
+    return "?";
+  }
+
+    public String toSystem(V3ActRelationshipCheckpoint code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipJoin.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipJoin.java
new file mode 100644
index 00000000000..ceb39269154
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipJoin.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActRelationshipJoin {
+
+        /**
+         * Detach this branch from the other branches so it will not be resynchronized with the other branches.
+         */
+        D, 
+        /**
+         * When all other concurrent branches are terminated, interrupt and discontinue this branch.
+         */
+        K, 
+        /**
+         * Wait for this branch to terminate.
+         */
+        W, 
+        /**
+         * Wait for any one of the branches in the set of exclusive wait branches to terminate, then discontinue all the other exclusive wait branches.
+         */
+        X, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActRelationshipJoin fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("D".equals(codeString))
+          return D;
+        if ("K".equals(codeString))
+          return K;
+        if ("W".equals(codeString))
+          return W;
+        if ("X".equals(codeString))
+          return X;
+        throw new FHIRException("Unknown V3ActRelationshipJoin code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case D: return "D";
+            case K: return "K";
+            case W: return "W";
+            case X: return "X";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActRelationshipJoin";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case D: return "Detach this branch from the other branches so it will not be resynchronized with the other branches.";
+            case K: return "When all other concurrent branches are terminated, interrupt and discontinue this branch.";
+            case W: return "Wait for this branch to terminate.";
+            case X: return "Wait for any one of the branches in the set of exclusive wait branches to terminate, then discontinue all the other exclusive wait branches.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case D: return "detached";
+            case K: return "kill";
+            case W: return "wait";
+            case X: return "exclusive wait";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipJoinEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipJoinEnumFactory.java
new file mode 100644
index 00000000000..68482a1f81e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipJoinEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActRelationshipJoinEnumFactory implements EnumFactory {
+
+  public V3ActRelationshipJoin fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("D".equals(codeString))
+      return V3ActRelationshipJoin.D;
+    if ("K".equals(codeString))
+      return V3ActRelationshipJoin.K;
+    if ("W".equals(codeString))
+      return V3ActRelationshipJoin.W;
+    if ("X".equals(codeString))
+      return V3ActRelationshipJoin.X;
+    throw new IllegalArgumentException("Unknown V3ActRelationshipJoin code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActRelationshipJoin code) {
+    if (code == V3ActRelationshipJoin.D)
+      return "D";
+    if (code == V3ActRelationshipJoin.K)
+      return "K";
+    if (code == V3ActRelationshipJoin.W)
+      return "W";
+    if (code == V3ActRelationshipJoin.X)
+      return "X";
+    return "?";
+  }
+
+    public String toSystem(V3ActRelationshipJoin code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSplit.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSplit.java
new file mode 100644
index 00000000000..1a65afb637c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSplit.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActRelationshipSplit {
+
+        /**
+         * The pre-condition associated with the branch is evaluated once and if true the branch may be entered. All other exclusive branches compete with each other and only one will be selected. This implements a COND, IF and CASE conditionals, or "XOR-split." The order in which the branches are considered may be specified in the priorityNumber attribute.
+         */
+        E1, 
+        /**
+         * A branch is selected as soon as the pre-condition associated with the branch evaluates to true.  If the condition is false, the branch may be entered later, when the condition turns true.  All other exclusive branches compete with each other and only one will be selected.  Each waiting branch executes in parallel with the default join code wait  (see below). The order in which the branches are considered may be specified in the Service_relationship.priority_nmb.
+         */
+        EW, 
+        /**
+         * A branch is executed if its associated preconditions permit. If associated preconditions do not permit, the branch is dropped.  Inclusive branches are not suppressed and do not suppress other branches.
+         */
+        I1, 
+        /**
+         * A branch is executed as soon as its associated conditions permit.  If the condition is false, the branch may be entered later, when the condition turns true.  Inclusive branches are not suppressed and do not suppress other branches.  Each waiting branch executes in parallel with the default join code wait  (see below).
+         */
+        IW, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActRelationshipSplit fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("E1".equals(codeString))
+          return E1;
+        if ("EW".equals(codeString))
+          return EW;
+        if ("I1".equals(codeString))
+          return I1;
+        if ("IW".equals(codeString))
+          return IW;
+        throw new FHIRException("Unknown V3ActRelationshipSplit code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case E1: return "E1";
+            case EW: return "EW";
+            case I1: return "I1";
+            case IW: return "IW";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActRelationshipSplit";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case E1: return "The pre-condition associated with the branch is evaluated once and if true the branch may be entered. All other exclusive branches compete with each other and only one will be selected. This implements a COND, IF and CASE conditionals, or \"XOR-split.\" The order in which the branches are considered may be specified in the priorityNumber attribute.";
+            case EW: return "A branch is selected as soon as the pre-condition associated with the branch evaluates to true.  If the condition is false, the branch may be entered later, when the condition turns true.  All other exclusive branches compete with each other and only one will be selected.  Each waiting branch executes in parallel with the default join code wait  (see below). The order in which the branches are considered may be specified in the Service_relationship.priority_nmb.";
+            case I1: return "A branch is executed if its associated preconditions permit. If associated preconditions do not permit, the branch is dropped.  Inclusive branches are not suppressed and do not suppress other branches.";
+            case IW: return "A branch is executed as soon as its associated conditions permit.  If the condition is false, the branch may be entered later, when the condition turns true.  Inclusive branches are not suppressed and do not suppress other branches.  Each waiting branch executes in parallel with the default join code wait  (see below).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case E1: return "exclusive try once";
+            case EW: return "exclusive wait";
+            case I1: return "inclusive try once";
+            case IW: return "inclusive wait";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSplitEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSplitEnumFactory.java
new file mode 100644
index 00000000000..d658d3e324c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSplitEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActRelationshipSplitEnumFactory implements EnumFactory {
+
+  public V3ActRelationshipSplit fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("E1".equals(codeString))
+      return V3ActRelationshipSplit.E1;
+    if ("EW".equals(codeString))
+      return V3ActRelationshipSplit.EW;
+    if ("I1".equals(codeString))
+      return V3ActRelationshipSplit.I1;
+    if ("IW".equals(codeString))
+      return V3ActRelationshipSplit.IW;
+    throw new IllegalArgumentException("Unknown V3ActRelationshipSplit code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActRelationshipSplit code) {
+    if (code == V3ActRelationshipSplit.E1)
+      return "E1";
+    if (code == V3ActRelationshipSplit.EW)
+      return "EW";
+    if (code == V3ActRelationshipSplit.I1)
+      return "I1";
+    if (code == V3ActRelationshipSplit.IW)
+      return "IW";
+    return "?";
+  }
+
+    public String toSystem(V3ActRelationshipSplit code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSubset.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSubset.java
new file mode 100644
index 00000000000..e141e916aa5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSubset.java
@@ -0,0 +1,197 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActRelationshipSubset {
+
+        /**
+         * Used to indicate that the participation is a filtered subset of the total participations of the same type owned by the Act. 
+
+                        Used when there is a need to limit the participations to the first, the last, the next or some other filtered subset.
+         */
+        _PARTICIPATIONSUBSET, 
+        /**
+         * An occurrence that is scheduled to occur in the future. An Act whose effective time is greater than 'now', where 'now' is the time the instance is authored.
+         */
+        FUTURE, 
+        /**
+         * Represents a 'summary' of all acts that are scheduled to occur in the future (whose effective time is greater than 'now' where is the time the instance is authored.). The effectiveTime represents the outer boundary of all occurrences, repeatNumber represents the total number of repetitions, etc.
+         */
+        FUTSUM, 
+        /**
+         * Restricted to the latest known occurrence that is scheduled to occur. The Act with the highest known effective time.
+         */
+        LAST, 
+        /**
+         * Restricted to the nearest recent known occurrence scheduled to occur in the future. The Act with the lowest effective time, still greater than 'now'. ('now' is the time the instance is authored.)
+         */
+        NEXT, 
+        /**
+         * An occurrence that occurred or was scheduled to occur in the past. An Act whose effective time is less than 'now'. ('now' is the time the instance is authored.)
+         */
+        PAST, 
+        /**
+         * Restricted to the earliest known occurrence that occurred or was scheduled to occur in the past. The Act with the lowest effective time. ('now' is the time the instance is authored.)
+         */
+        FIRST, 
+        /**
+         * Represents a 'summary' of all acts that previously occurred or were scheduled to occur. The effectiveTime represents the outer boundary of all occurrences, repeatNumber represents the total number of repetitions, etc. ('now' is the time the instance is authored.)
+         */
+        PREVSUM, 
+        /**
+         * Restricted to the most recent known occurrence that occurred or was scheduled to occur in the past. The Act with the most recent effective time, still less than 'now'. ('now' is the time the instance is authored.)
+         */
+        RECENT, 
+        /**
+         * Represents a 'summary' of all acts that have occurred or were scheduled to occur and which are scheduled to occur in the future. The effectiveTime represents the outer boundary of all occurrences, repeatNumber represents the total number of repetitions, etc.
+         */
+        SUM, 
+        /**
+         * ActRelationshipExpectedSubset
+         */
+        ACTRELATIONSHIPEXPECTEDSUBSET, 
+        /**
+         * ActRelationshipPastSubset
+         */
+        ACTRELATIONSHIPPASTSUBSET, 
+        /**
+         * The occurrence whose value attribute is greater than all other occurrences at the time the instance is created.
+         */
+        MAX, 
+        /**
+         * The occurrence whose value attribute is less than all other occurrences at the time the instance is created.
+         */
+        MIN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActRelationshipSubset fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ParticipationSubset".equals(codeString))
+          return _PARTICIPATIONSUBSET;
+        if ("FUTURE".equals(codeString))
+          return FUTURE;
+        if ("FUTSUM".equals(codeString))
+          return FUTSUM;
+        if ("LAST".equals(codeString))
+          return LAST;
+        if ("NEXT".equals(codeString))
+          return NEXT;
+        if ("PAST".equals(codeString))
+          return PAST;
+        if ("FIRST".equals(codeString))
+          return FIRST;
+        if ("PREVSUM".equals(codeString))
+          return PREVSUM;
+        if ("RECENT".equals(codeString))
+          return RECENT;
+        if ("SUM".equals(codeString))
+          return SUM;
+        if ("ActRelationshipExpectedSubset".equals(codeString))
+          return ACTRELATIONSHIPEXPECTEDSUBSET;
+        if ("ActRelationshipPastSubset".equals(codeString))
+          return ACTRELATIONSHIPPASTSUBSET;
+        if ("MAX".equals(codeString))
+          return MAX;
+        if ("MIN".equals(codeString))
+          return MIN;
+        throw new FHIRException("Unknown V3ActRelationshipSubset code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _PARTICIPATIONSUBSET: return "_ParticipationSubset";
+            case FUTURE: return "FUTURE";
+            case FUTSUM: return "FUTSUM";
+            case LAST: return "LAST";
+            case NEXT: return "NEXT";
+            case PAST: return "PAST";
+            case FIRST: return "FIRST";
+            case PREVSUM: return "PREVSUM";
+            case RECENT: return "RECENT";
+            case SUM: return "SUM";
+            case ACTRELATIONSHIPEXPECTEDSUBSET: return "ActRelationshipExpectedSubset";
+            case ACTRELATIONSHIPPASTSUBSET: return "ActRelationshipPastSubset";
+            case MAX: return "MAX";
+            case MIN: return "MIN";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActRelationshipSubset";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _PARTICIPATIONSUBSET: return "Used to indicate that the participation is a filtered subset of the total participations of the same type owned by the Act. \r\n\n                        Used when there is a need to limit the participations to the first, the last, the next or some other filtered subset.";
+            case FUTURE: return "An occurrence that is scheduled to occur in the future. An Act whose effective time is greater than 'now', where 'now' is the time the instance is authored.";
+            case FUTSUM: return "Represents a 'summary' of all acts that are scheduled to occur in the future (whose effective time is greater than 'now' where is the time the instance is authored.). The effectiveTime represents the outer boundary of all occurrences, repeatNumber represents the total number of repetitions, etc.";
+            case LAST: return "Restricted to the latest known occurrence that is scheduled to occur. The Act with the highest known effective time.";
+            case NEXT: return "Restricted to the nearest recent known occurrence scheduled to occur in the future. The Act with the lowest effective time, still greater than 'now'. ('now' is the time the instance is authored.)";
+            case PAST: return "An occurrence that occurred or was scheduled to occur in the past. An Act whose effective time is less than 'now'. ('now' is the time the instance is authored.)";
+            case FIRST: return "Restricted to the earliest known occurrence that occurred or was scheduled to occur in the past. The Act with the lowest effective time. ('now' is the time the instance is authored.)";
+            case PREVSUM: return "Represents a 'summary' of all acts that previously occurred or were scheduled to occur. The effectiveTime represents the outer boundary of all occurrences, repeatNumber represents the total number of repetitions, etc. ('now' is the time the instance is authored.)";
+            case RECENT: return "Restricted to the most recent known occurrence that occurred or was scheduled to occur in the past. The Act with the most recent effective time, still less than 'now'. ('now' is the time the instance is authored.)";
+            case SUM: return "Represents a 'summary' of all acts that have occurred or were scheduled to occur and which are scheduled to occur in the future. The effectiveTime represents the outer boundary of all occurrences, repeatNumber represents the total number of repetitions, etc.";
+            case ACTRELATIONSHIPEXPECTEDSUBSET: return "ActRelationshipExpectedSubset";
+            case ACTRELATIONSHIPPASTSUBSET: return "ActRelationshipPastSubset";
+            case MAX: return "The occurrence whose value attribute is greater than all other occurrences at the time the instance is created.";
+            case MIN: return "The occurrence whose value attribute is less than all other occurrences at the time the instance is created.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _PARTICIPATIONSUBSET: return "ParticipationSubset";
+            case FUTURE: return "expected future";
+            case FUTSUM: return "future summary";
+            case LAST: return "expected last";
+            case NEXT: return "expected next";
+            case PAST: return "previous";
+            case FIRST: return "first known";
+            case PREVSUM: return "previous summary";
+            case RECENT: return "most recent";
+            case SUM: return "summary";
+            case ACTRELATIONSHIPEXPECTEDSUBSET: return "ActRelationshipExpectedSubset";
+            case ACTRELATIONSHIPPASTSUBSET: return "ActRelationshipPastSubset";
+            case MAX: return "maximum";
+            case MIN: return "minimum";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSubsetEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSubsetEnumFactory.java
new file mode 100644
index 00000000000..fc5a4912e01
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipSubsetEnumFactory.java
@@ -0,0 +1,110 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActRelationshipSubsetEnumFactory implements EnumFactory {
+
+  public V3ActRelationshipSubset fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ParticipationSubset".equals(codeString))
+      return V3ActRelationshipSubset._PARTICIPATIONSUBSET;
+    if ("FUTURE".equals(codeString))
+      return V3ActRelationshipSubset.FUTURE;
+    if ("FUTSUM".equals(codeString))
+      return V3ActRelationshipSubset.FUTSUM;
+    if ("LAST".equals(codeString))
+      return V3ActRelationshipSubset.LAST;
+    if ("NEXT".equals(codeString))
+      return V3ActRelationshipSubset.NEXT;
+    if ("PAST".equals(codeString))
+      return V3ActRelationshipSubset.PAST;
+    if ("FIRST".equals(codeString))
+      return V3ActRelationshipSubset.FIRST;
+    if ("PREVSUM".equals(codeString))
+      return V3ActRelationshipSubset.PREVSUM;
+    if ("RECENT".equals(codeString))
+      return V3ActRelationshipSubset.RECENT;
+    if ("SUM".equals(codeString))
+      return V3ActRelationshipSubset.SUM;
+    if ("ActRelationshipExpectedSubset".equals(codeString))
+      return V3ActRelationshipSubset.ACTRELATIONSHIPEXPECTEDSUBSET;
+    if ("ActRelationshipPastSubset".equals(codeString))
+      return V3ActRelationshipSubset.ACTRELATIONSHIPPASTSUBSET;
+    if ("MAX".equals(codeString))
+      return V3ActRelationshipSubset.MAX;
+    if ("MIN".equals(codeString))
+      return V3ActRelationshipSubset.MIN;
+    throw new IllegalArgumentException("Unknown V3ActRelationshipSubset code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActRelationshipSubset code) {
+    if (code == V3ActRelationshipSubset._PARTICIPATIONSUBSET)
+      return "_ParticipationSubset";
+    if (code == V3ActRelationshipSubset.FUTURE)
+      return "FUTURE";
+    if (code == V3ActRelationshipSubset.FUTSUM)
+      return "FUTSUM";
+    if (code == V3ActRelationshipSubset.LAST)
+      return "LAST";
+    if (code == V3ActRelationshipSubset.NEXT)
+      return "NEXT";
+    if (code == V3ActRelationshipSubset.PAST)
+      return "PAST";
+    if (code == V3ActRelationshipSubset.FIRST)
+      return "FIRST";
+    if (code == V3ActRelationshipSubset.PREVSUM)
+      return "PREVSUM";
+    if (code == V3ActRelationshipSubset.RECENT)
+      return "RECENT";
+    if (code == V3ActRelationshipSubset.SUM)
+      return "SUM";
+    if (code == V3ActRelationshipSubset.ACTRELATIONSHIPEXPECTEDSUBSET)
+      return "ActRelationshipExpectedSubset";
+    if (code == V3ActRelationshipSubset.ACTRELATIONSHIPPASTSUBSET)
+      return "ActRelationshipPastSubset";
+    if (code == V3ActRelationshipSubset.MAX)
+      return "MAX";
+    if (code == V3ActRelationshipSubset.MIN)
+      return "MIN";
+    return "?";
+  }
+
+    public String toSystem(V3ActRelationshipSubset code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipType.java
new file mode 100644
index 00000000000..0d3f4874d96
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipType.java
@@ -0,0 +1,1538 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActRelationshipType {
+
+        /**
+         * Description: A directed association between a source Act and a target Act.
+
+                        
+                           Usage Note: This code should never be transmitted in an instance as the value of ActRelationship.typeCode (attribute)
+         */
+        ART, 
+        /**
+         * ActClassTemporallyPertains
+         */
+        _ACTCLASSTEMPORALLYPERTAINS, 
+        /**
+         * Codes that describe the relationship between an Act and a financial instrument such as a financial transaction, account or invoice element.
+         */
+        _ACTRELATIONSHIPACCOUNTING, 
+        /**
+         * Expresses values for describing the relationship relationship between an InvoiceElement or InvoiceElementGroup and a billable act.
+         */
+        _ACTRELATIONSHIPCOSTTRACKING, 
+        /**
+         * A relationship that provides an ability to associate a financial transaction (target) as a charge to a clinical act (source).  A clinical act may have a charge associated with the execution or delivery of the service.
+
+                        The financial transaction will define the charge (bill) for delivery or performance of the service.
+
+                        Charges and costs are distinct terms.  A charge defines what is charged or billed to another organization or entity within an organization.  The cost defines what it costs an organization to perform or deliver a service or product.
+         */
+        CHRG, 
+        /**
+         * A relationship that provides an ability to associate a financial transaction (target) as a cost to a clinical act (source).  A clinical act may have an inherit cost associated with the execution or delivery of the service.
+
+                        The financial transaction will define the cost of delivery or performance of the service.
+
+                        Charges and costs are distinct terms.  A charge defines what is charged or billed to another organization or entity within an organization.  The cost defines what it costs an organization to perform or deliver a service or product.
+         */
+        COST, 
+        /**
+         * Expresses values for describing the relationship between a FinancialTransaction and an Account.
+         */
+        _ACTRELATIONSHIPPOSTING, 
+        /**
+         * A credit relationship ties a financial transaction (target) to an account (source). A credit, once applied (posted), may have either a positive or negative effect on the account balance, depending on the type of account. An asset account credit will decrease the account balance. A non-asset account credit will decrease the account balance.
+         */
+        CREDIT, 
+        /**
+         * A debit relationship ties a financial transaction (target) to an account (source).  A debit, once applied (posted), may have either a positive or negative effect on the account balance, depending on the type of account.  An asset account debit will increase the account balance.  A non-asset account debit will decrease the account balance.
+         */
+        DEBIT, 
+        /**
+         * Specifies under what circumstances (target Act) the source-Act may, must, must not or has occurred
+         */
+        _ACTRELATIONSHIPCONDITIONAL, 
+        /**
+         * A contraindication is just a negation of a reason, i.e. it gives a condition under which the action is not to be done. Both, source and target can be any kind of service; target service is in criterion mood. How the strength of a contraindication is expressed (e.g., relative, absolute) is left as an open issue. The priorityNumber attribute could be used.
+         */
+        CIND, 
+        /**
+         * A requirement to be true before a service is performed. The target can be any service in criterion mood.  For multiple pre-conditions a conjunction attribute (AND, OR, XOR) is applicable.
+         */
+        PRCN, 
+        /**
+         * Description: The reason or rationale for a service. A reason link is weaker than a trigger, it only suggests that some service may be or might have been a reason for some action, but not that this reason requires/required the action to be taken. Also, as opposed to the trigger, there is no strong timely relation between the reason and the action.  As well as providing various types of information about the rationale for a service, the RSON act relationship is routinely used between a SBADM act and an OBS act to describe the indication for use of a medication.  Child concepts may be used to describe types of indication. 
+
+                        
+                           Discussion: In prior releases, the code "SUGG" (suggests) was expressed as "an inversion of the reason link." That code has been retired in favor of the inversion indicator that is an attribute of ActRelationship.
+         */
+        RSON, 
+        /**
+         * Definition: The source act is performed to block the effects of the target act.  This act relationship should be used when describing near miss type incidents where potential harm could have occurred, but the action described in the source act blocked the potential harmful effects of the incident actually occurring.
+         */
+        BLOCK, 
+        /**
+         * Description: The source act is intended to help establish the presence of a (an adverse) situation described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.
+         */
+        DIAG, 
+        /**
+         * Description: The source act is intented to provide immunity against the effects of the target act (the target act describes an infectious disease)
+         */
+        IMM, 
+        /**
+         * Description: The source act is intended to provide active immunity against the effects of the target act (the target act describes an infectious disease)
+         */
+        ACTIMM, 
+        /**
+         * Description: The source act is intended to provide passive immunity against the effects of the target act (the target act describes an infectious disease).
+         */
+        PASSIMM, 
+        /**
+         * The source act removes or lessens the occurrence or effect of the target act.
+         */
+        MITGT, 
+        /**
+         * Definition: The source act is performed to recover from the effects of the target act.
+         */
+        RCVY, 
+        /**
+         * Description: The source act is intended to reduce the risk of of an adverse situation to emerge as described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.
+         */
+        PRYLX, 
+        /**
+         * Description: The source act is intended to improve a pre-existing adverse situation described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.
+         */
+        TREAT, 
+        /**
+         * Description: The source act is intended to offer an additional treatment for the management or cure of a pre-existing adverse situation described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.  It is not a requirement that the non-adjunctive treatment is explicitly specified.
+         */
+        ADJUNCT, 
+        /**
+         * Description: The source act is intended to provide long term maintenance improvement or management of a pre-existing adverse situation described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.
+         */
+        MTREAT, 
+        /**
+         * Description: The source act is intended to provide palliation for the effects of the target act.
+         */
+        PALLTREAT, 
+        /**
+         * Description: The source act is intented to provide symptomatic relief for the effects of the target act.
+         */
+        SYMP, 
+        /**
+         * A pre-condition that if true should result in the source Act being executed.  The target is in typically in criterion mood.  When reported after the fact (i.e. the criterion has been met) it may be in Event mood.  A delay between the trigger and the triggered action can be specified.
+
+                        
+                           Discussion: This includes the concept of a  required act for a service or financial instrument such as an insurance plan or policy. In such cases, the trigger is the occurrence of a specific condition such as coverage limits being exceeded.
+         */
+        TRIG, 
+        /**
+         * Abstract collector for ActRelationhsip types that relate two acts by their timing.
+         */
+        _ACTRELATIONSHIPTEMPORALLYPERTAINS, 
+        /**
+         * Abstract collector for ActRelationship types that relate two acts by their approximate timing.
+         */
+        _ACTRELATIONSHIPTEMPORALLYPERTAINSAPPROXIMATES, 
+        /**
+         * A relationship in which the source act's effective time ends near the end of the target act's effective time. Near is defined separately as a time interval.
+
+                        
+                           Usage Note: Inverse code is ENS
+         */
+        ENE, 
+        /**
+         * A relationship in which the source act's effective time ends with the end of the target act's effective time.
+
+                        
+                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.
+         */
+        ECW, 
+        /**
+         * A relationship in which the source act's effective time is the same as the target act's effective time.
+
+                        
+                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.
+         */
+        CONCURRENT, 
+        /**
+         * The source Act starts before the start of the target Act, and ends with the target Act.
+
+                        
+                           UsageNote: Inverse code is SASECWE
+         */
+        SBSECWE, 
+        /**
+         * A relationship in which the source act's effective time ends near the start of the target act's effective time. Near is defined separately as a time interval.
+
+                        
+                           Usage Note: Inverse code is ENE
+         */
+        ENS, 
+        /**
+         * The source Act ends when the target act starts (i.e. if we say "ActOne ECWS ActTwo", it means that ActOne ends when ActTwo starts, therefore ActOne is the source and ActTwo is the target).
+
+                        
+                           UsageNote: Inverse code is SCWE
+         */
+        ECWS, 
+        /**
+         * A relationship in which the source act's effective time starts near the end of the target act's effective time. Near is defined separately as a time interval.
+
+                        
+                           Usage Note: Inverse code is SNS
+         */
+        SNE, 
+        /**
+         * The source Act starts when the target act ends (i.e. if we say "ActOne SCWE ActTwo", it means that ActOne starts when ActTwo ends, therefore ActOne is the source and ActTwo is the target).
+
+                        
+                           UsageNote: Inverse code is SBSECWS
+         */
+        SCWE, 
+        /**
+         * A relationship in which the source act's effective time starts near the start of the target act's effective time. Near is defined separately as a time interval.
+
+                        
+                           Usage Note: Inverse code is SNE
+         */
+        SNS, 
+        /**
+         * A relationship in which the source act's effective time starts with the start of the target act's effective time.
+
+                        
+                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.
+         */
+        SCW, 
+        /**
+         * The source Act starts with.the target Act and ends before the end of the target Act.
+
+                        
+                           UsageNote: Inverse code is SCWSEAE
+         */
+        SCWSEBE, 
+        /**
+         * The source Act starts with the target Act, and ends after the end of the target Act.
+         */
+        SCWSEAE, 
+        /**
+         * A relationship in which the source act ends after the target act starts.
+
+                        
+                           UsageNote: Inverse code is SBE
+         */
+        EAS, 
+        /**
+         * A relationship in which the source act ends after the target act ends.
+
+                        
+                           UsageNote: Inverse code is EBE
+         */
+        EAE, 
+        /**
+         * The source Act starts after start of the target Act and ends after end of the target Act.
+
+                        
+                           UsageNote: Inverse code is SBSEBE
+         */
+        SASEAE, 
+        /**
+         * The source Act contains the end of the target Act.
+
+                        
+                           UsageNote: Inverse code is EDU
+         */
+        SBEEAE, 
+        /**
+         * The source Act start after the start of the target Act, and contains the end of the target Act.
+
+                        
+                           UsageNote: Inverse code is SBSEASEBE
+         */
+        SASSBEEAS, 
+        /**
+         * The source Act contains the time of the target Act.
+
+                        
+                           UsageNote: Inverse code is DURING
+         */
+        SBSEAE, 
+        /**
+         * The source Act starts after the start of the target Act (i.e. if we say "ActOne SAS ActTwo", it means that ActOne starts after the start of ActTwo, therefore ActOne is the source and ActTwo is the target).
+
+                        
+                           UsageNote: Inverse code is SBS
+         */
+        SAS, 
+        /**
+         * A relationship in which the source act starts after the target act ends.
+
+                        
+                           UsageNote: Inverse code is EBS
+         */
+        SAE, 
+        /**
+         * A relationship in which the source act's effective time is wholly within the target act's effective time (including end points, as defined in the act's effective times)
+
+                        
+                           UsageNote: Inverse code is SBSEAE
+         */
+        DURING, 
+        /**
+         * The source Act starts after start of the target Act, and ends with the target Act.
+
+                        
+                           UsageNote: Inverse code is SBSECWE
+         */
+        SASECWE, 
+        /**
+         * A relationship in which the source act's effective time ends after or concurrent with the start of the target act's effective time.
+
+                        
+                           Usage Note: Inverse code is EBSORECWS
+         */
+        EASORECWS, 
+        /**
+         * A relationship in which the source act's effective time ends after or concurrent with the end of the target act's effective time.
+
+                        
+                           Usage Note: Inverse code is EBEORECW
+         */
+        EAEORECW, 
+        /**
+         * The source Act is independent of the time of the target Act.
+
+                        
+                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.
+         */
+        INDEPENDENT, 
+        /**
+         * A relationship in which the source act's effective time starts after or concurrent with the end of the target act's effective time.
+
+                        
+                           Usage Note: Inverse code is SBEORSCWE
+         */
+        SAEORSCWE, 
+        /**
+         * A relationship in which the source act's effective time starts after or concurrent with the start of the target act's effective time.
+
+                        
+                           Usage Note: Inverse code is SBSORSCW
+         */
+        SASORSCW, 
+        /**
+         * A relationship in which the source act's effective time starts before or concurrent with the end of the target act's effective time.
+
+                        
+                           Usage Note: Inverse code is SAEORSCWE
+         */
+        SBEORSCWE, 
+        /**
+         * A relationship in which the source act's effective time overlaps the target act's effective time in any way.
+
+                        
+                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.
+         */
+        OVERLAP, 
+        /**
+         * A relationship in which the source act ends within the target act's effective time (including end points, as defined in the act's effective times)
+
+                        
+                           UsageNote: Inverse code is SBEEAE
+         */
+        EDU, 
+        /**
+         * The source Act contains the start of the target Act,  and ends before the end of the target Act.
+
+                        
+                           UsageNote: Inverse code is SASSBEEAS
+         */
+        SBSEASEBE, 
+        /**
+         * The source Act contains the start of the target Act.
+
+                        
+                           UsageNote: Inverse code is SDU
+         */
+        SBSEAS, 
+        /**
+         * A relationship in which the source act starts within the target act's effective time (including end points, as defined in the act's effective times)
+
+                        
+                           UsageNote: Inverse code is SBSEAS
+         */
+        SDU, 
+        /**
+         * The source Act starts before the end of the target Act (i.e. if we say "ActOne SBE ActTwo", it means that ActOne starts before the end of ActTwo, therefore ActOne is the source and ActTwo is the target).
+
+                        
+                           UsageNote: Inverse code is EAS
+         */
+        SBE, 
+        /**
+         * The source Act ends before the end of the target Act (i.e. if we say "ActOne EBE ActTwo", it means that ActOne ends before the end of ActTwo, therefore ActOne is the source and ActTwo is the target).
+
+                        
+                           UsageNote: Inverse code is EAE
+         */
+        EBE, 
+        /**
+         * The source Act starts before the start of the target Act, and ends before the end of the target Act.
+
+                        
+                           UsageNote: Inverse code is SASEAE
+         */
+        SBSEBE, 
+        /**
+         * A relationship in which the source act's effective time ends before or concurrent with the start of the target act's effective time.
+
+                        
+                           Usage Note: Inverse code is EASORECWS
+         */
+        EBSORECWS, 
+        /**
+         * A relationship in which the source act ends before the target act starts.
+
+                        
+                           UsageNote: Inverse code is SAE
+         */
+        EBS, 
+        /**
+         * A relationship in which the source act's effective time ends before or concurrent with the end of the target act's effective time.
+
+                        
+                           Usage Note: Inverse code is EAEORECW
+         */
+        EBEORECW, 
+        /**
+         * A relationship in which the source act's effective time starts before or concurrent with the start of the target act's effective time.
+
+                        
+                           Usage Note: Inverse code is SASORSCW
+         */
+        SBSORSCW, 
+        /**
+         * A relationship in which the source act begins before the target act begins.
+
+                        
+                           UsageNote: Inverse code is SAS
+         */
+        SBS, 
+        /**
+         * A relationship in which the target act authorizes or certifies the source act.
+         */
+        AUTH, 
+        /**
+         * Description: An assertion that an act was the cause of another act.This is stronger and more specific than the support link. The source (cause) is typically an observation, but may be any act, while the target may be any act.
+
+                        
+                           Examples:
+                        
+
+                        
+                           a growth of Staphylococcus aureus may be considered the cause of an abscess
+                           contamination of the infusion bag was deemed to be the cause of the infection that the patient experienced
+                           lack of staff on the shift was deemed to be a supporting factor (proximal factor) causing the patient safety incident where the patient fell out of bed because the  bed-sides had not been put up which caused the night patient to fall out of bed
+         */
+        CAUS, 
+        /**
+         * The target act is a component of the source act, with no semantics regarding composition or aggregation implied.
+         */
+        COMP, 
+        /**
+         * A relationship from an Act to a Control Variable.  For example, if a Device makes an Observation, this relates the Observation to its Control Variables documenting  the device's settings that influenced the observation.
+         */
+        CTRLV, 
+        /**
+         * The target Acts are aggregated by the source Act.  Target Acts may have independent existence, participate in multiple ActRelationships, and do not contribute to the meaning of the source.
+
+                        
+                           UsageNotes: This explicitly represents the conventional notion of aggregation.  The target Act is part of a collection of Acts (no implication is made of cardinality, a source of Acts may contain zero, one, or more member target Acts).
+
+                        It is expected that this will be primarily used with _ActClassRecordOrganizer, BATTERY, and LIST
+         */
+        MBR, 
+        /**
+         * A collection of sub-services as steps or subtasks performed for the source service. Services may be performed sequentially or concurrently.
+
+                        
+                           UsageNotes: Sequence of steps may be indicated by use of _ActRelationshipTemporallyPertains, as well as via  ActRelationship.sequenceNumber, ActRelationship.pauseQuantity, Target.priorityCode.
+
+                        
+                           OpenIssue: Need Additional guidelines on when each approach should be used.
+         */
+        STEP, 
+        /**
+         * The relationship that links to a Transportation Act (target) from another Act (source) indicating that the subject of the source Act entered into the source Act by means of the target Transportation act.
+         */
+        ARR, 
+        /**
+         * The relationship that links to a Transportation Act (target) from another Act (source) indicating that the subject of the source Act departed from the source Act by means of the target Transportation act.
+         */
+        DEP, 
+        /**
+         * The source Act is a composite of the target Acts. The target Acts do not have an existence independent of the source Act.
+
+                        
+                           UsageNote: In UML 1.1, this is a "composition" defined as: 
+                           "A form of aggregation with strong ownership and coincident lifetime as part of the whole. Parts with non-fixed multiplicity may be created after the composite itself, but once created they live and die with it (i.e., they share lifetimes). Such parts can also be explicitly removed before the death of the composite. Composition may be recursive."
+         */
+        PART, 
+        /**
+         * A relationship in which the source act is covered by or is under the authority of a target act.  A financial instrument such as an Invoice Element is covered by one or more specific instances of an Insurance Policy.
+         */
+        COVBY, 
+        /**
+         * Associates a derived Act with its input parameters. E.G., an anion-gap observation can be associated as being derived from given sodium-, (potassium-,), chloride-, and bicarbonate-observations. The narrative content (Act.text) of a source act is wholly machine-derived from the collection of target acts.
+         */
+        DRIV, 
+        /**
+         * Expresses an association that links two instances of the same act over time, indicating that the instance are part of the same episode, e.g. linking two condition nodes for episode of illness; linking two encounters for episode of encounter.
+         */
+        ELNK, 
+        /**
+         * Indicates that the target Act provides evidence in support of the action represented by the source Act. The target is not a 'reason' for the source act, but rather gives supporting information on why the source act is an appropriate course of action. Possible targets might be clinical trial results, journal articles, similar successful therapies, etc.
+
+                        
+                           Rationale: Provides a mechanism for conveying clinical justification for non-approved or otherwise non-traditional therapies.
+         */
+        EVID, 
+        /**
+         * Description:The source act is aggravated by the target act. (Example "chest pain" EXACBY "exercise")
+         */
+        EXACBY, 
+        /**
+         * This is the inversion of support.  Used to indicate that a given observation is explained by another observation or condition.
+         */
+        EXPL, 
+        /**
+         * the target act documents a set of circumstances (events, risks) which prevent successful completion, or degradation of quality of, the source Act.
+
+                        
+                           UsageNote: This provides the semantics to document barriers to care
+         */
+        INTF, 
+        /**
+         * Items located
+         */
+        ITEMSLOC, 
+        /**
+         * A relationship that limits or restricts the source act by the elements of the target act.  For example, an authorization may be limited by a financial amount (up to $500). Target Act must be in EVN.CRIT mood.
+         */
+        LIMIT, 
+        /**
+         * Definition: Indicates that the attributes and associations of the target act provide metadata (for example, identifiers, authorship, etc.) for the source act.
+
+                        
+                           Constraint:  Source act must have either a mood code that is not "EVN" (event) or its "isCriterion" attribute must set to "true".  Target act must be an Act with a mood code of EVN and with isCriterionInd attribute set to "true".
+         */
+        META, 
+        /**
+         * An assertion that a new observation may be the manifestation of another existing observation or action.  This assumption is attributed to the same actor who asserts the manifestation.  This is stronger and more specific than an inverted support link.  For example, an agitated appearance can be asserted to be the manifestation (effect) of a known hyperthyroxia.  This expresses that one might not have realized a symptom if it would not be a common manifestation of a known condition.  The target (cause) may be any service, while the source (manifestation) must be an observation.
+         */
+        MFST, 
+        /**
+         * Used to assign a "name" to a condition thread. Source is a condition node, target can be any service.
+         */
+        NAME, 
+        /**
+         * An observation that should follow or does actually follow as a result or consequence of a condition or action (sometimes called "post-conditional".) Target must be an observation as a goal, risk or any criterion. For complex outcomes a conjunction attribute (AND, OR, XOR) can be used.  An outcome link is often inverted to describe an outcome assessment.
+         */
+        OUTC, 
+        /**
+         * The target act is a desired outcome of the source act. Source is any act (typically an intervention). Target must be an observation in criterion mood.
+         */
+        _ACTRELATIONSIPOBJECTIVE, 
+        /**
+         * A desired state that a service action aims to maintain.  E.g., keep systolic blood pressure between 90 and 110 mm Hg.  Source is an intervention service.  Target must be an observation in criterion mood.
+         */
+        OBJC, 
+        /**
+         * A desired outcome that a service action aims to meet finally.  Source is any service (typically an intervention).  Target must be an observation in criterion mood.
+         */
+        OBJF, 
+        /**
+         * A goal that one defines given a patient's health condition.  Subsequently planned actions aim to meet that goal.  Source is an observation or condition node, target must be an observation in goal mood.
+         */
+        GOAL, 
+        /**
+         * A noteworthy undesired outcome of a patient's condition that is either likely enough to become an issue or is less likely but dangerous enough to be addressed.
+         */
+        RISK, 
+        /**
+         * This is a very unspecific relationship from one item of clinical information to another.  It does not judge about the role the pertinent information plays.
+         */
+        PERT, 
+        /**
+         * A relationship in which the target act is a predecessor instance to the source act.  Generally each of these instances is similar, but no identical.  In healthcare coverage it is used to link a claim item to a previous claim item that might have claimed for the same set of services.
+         */
+        PREV, 
+        /**
+         * A relationship in which the target act is referred to by the source act.  This permits a simple reference relationship that distinguishes between the referent and the referee.
+         */
+        REFR, 
+        /**
+         * Indicates that the source act makes use of (or will make use of) the information content of the target act.
+
+                        
+                           UsageNotes: A usage relationship only makes sense if the target act is authored and occurs independently of the source act.  Otherwise a simpler relationship such as COMP would be appropriate.
+
+                        
+                           Rationale: There is a need when defining a clinical trial protocol to indicate that the protocol makes use of other protocol or treatment specifications.  This is stronger than the assertion of "references".  References may exist without usage, and in a clinical trial protocol is common to assert both: what other specifications does this trial use and what other specifications does it merely reference.
+         */
+        USE, 
+        /**
+         * Reference ranges are essentially descriptors of a class of result values assumed to be "normal", "abnormal", or "critical."  Those can vary by sex, age, or any other criterion. Source and target are observations, the target is in criterion mood.  This link type can act as a trigger in case of alarms being triggered by critical results.
+         */
+        REFV, 
+        /**
+         * Description:The source act is wholly or partially alleviated by the target act. (Example "chest pain" RELVBY "sublingual nitroglycerin administration")
+         */
+        RELVBY, 
+        /**
+         * An act relationship indicating that the source act follows the target act. The source act should in principle represent the same kind of act as the target. Source and target need not have the same mood code (mood will often differ). The target of a sequel is called antecedent. Examples for sequel relationships are: revision, transformation, derivation from a prototype (as a specialization is a derivation of a generalization), followup, realization, instantiation.
+         */
+        SEQL, 
+        /**
+         * An addendum (source) to an existing service object (target), containing supplemental information.  The addendum is itself an original service object linked to the supplemented service object.  The supplemented service object remains in place and its content and status are unaltered.
+         */
+        APND, 
+        /**
+         * Indicates that the target observation(s) provide an initial reference for the source observation or observation group.
+
+                        
+                           UsageConstraints: Both source and target must be Observations or specializations thereof.
+         */
+        BSLN, 
+        /**
+         * Description:The source act complies with, adheres to, conforms to, or is permissible under (in whole or in part) the policy, contract, agreement, law, conformance criteria, certification guidelines or requirement conveyed by the target act.
+
+                        Examples for compliance relationships are: audits of adherence with a security policy, certificate of conformance to system certification requirements, or consent directive in compliance with or permissible under a privacy policy.
+         */
+        COMPLY, 
+        /**
+         * The source act documents the target act.
+         */
+        DOC, 
+        /**
+         * The source act fulfills (in whole or in part) the target act. Source act must be in a mood equal or more actual than the target act.
+         */
+        FLFS, 
+        /**
+         * The source act is a single occurrence of a repeatable target act. The source and target act can be in any mood on the "completion track" but the source act must be as far as or further along the track than the target act (i.e., the occurrence of an intent can be an event but not vice versa).
+         */
+        OCCR, 
+        /**
+         * Relates either an appointment request or an appointment to the order for the service being scheduled.
+         */
+        OREF, 
+        /**
+         * Associates a specific time (and associated resources) with a scheduling request or other intent.
+         */
+        SCH, 
+        /**
+         * The generalization relationship can be used to express categorical knowledge about services (e.g., amilorid, triamterene, and spironolactone have the common generalization potassium sparing diuretic).
+         */
+        GEN, 
+        /**
+         * A goal-evaluation links an observation (intent or actual) to a goal to indicate that the observation evaluates the goal. Given the goal and the observation, a "goal distance" (e.g., goal to observation) can be "calculated" and need not be sent explicitly.
+         */
+        GEVL, 
+        /**
+         * Used to capture the link between a potential service ("master" or plan) and an actual service, where the actual service instantiates the potential service. The instantiation may override the master's defaults.
+         */
+        INST, 
+        /**
+         * Definition: Used to link a newer version or 'snapshot' of a business object (source) to an older version or 'snapshot' of the same business object (target).
+
+                        
+                           Usage:The identifier of the Act should be the same for both source and target. If the identifiers are distinct, RPLC should be used instead.
+
+                        Name from source to target = "modifiesPrior"
+
+                        Name from target to source = "modifiesByNew"
+         */
+        MOD, 
+        /**
+         * A trigger-match links an actual service (e.g., an observation or procedure that took place) with a service in criterion mood.  For example if the trigger is "observation of pain" and pain is actually observed, and if that pain-observation caused the trigger to fire, that pain-observation can be linked with the trigger.
+         */
+        MTCH, 
+        /**
+         * A relationship between a source Act that provides more detailed properties to the target Act.
+
+                        The source act thus is a specialization of the target act, but instead of mentioning all the inherited properties it only mentions new property bindings or refinements.
+
+                        The typical use case is to specify certain alternative variants of one kind of Act. The priorityNumber attribute is used to weigh refinements as preferred over other alternative refinements.
+
+                        Example: several routing options for a drug are specified as one SubstanceAdministration for the general treatment with attached refinements for the various routing options.
+         */
+        OPTN, 
+        /**
+         * Description:A relationship in which the target act is carried out to determine whether an effect attributed to the source act can be recreated.
+         */
+        RCHAL, 
+        /**
+         * A relationship between a source Act that seeks to reverse or undo the action of the prior target Act.
+
+                        Example: A posted financial transaction (e.g., a debit transaction) was applied in error and must be reversed (e.g., by a credit transaction) the credit transaction is identified as an undo (or reversal) of the prior target transaction.
+
+                        Constraints: the "completion track" mood of the target Act must be equally or more "actual" than the source act. I.e., when the target act is EVN the source act can be EVN, or any INT. If the target act is INT, the source act can be INT.
+         */
+        REV, 
+        /**
+         * A replacement source act replaces an existing target act. The state of the target act being replaced becomes obselete, but the act is typically still retained in the system for historical reference.  The source and target must be of the same type.
+         */
+        RPLC, 
+        /**
+         * Definition:  A new act that carries forward the intention of the original act, but does not completely replace it.  The status of the predecessor act must be 'completed'.  The original act is the target act and the successor is the source act.
+         */
+        SUCC, 
+        /**
+         * A condition thread relationship specifically links condition nodes together to form a condition thread. The source is the new condition node and the target links to the most recent node of the existing condition thread.
+         */
+        UPDT, 
+        /**
+         * The source is an excerpt from the target.
+         */
+        XCRPT, 
+        /**
+         * The source is a direct quote from the target.
+         */
+        VRXCRPT, 
+        /**
+         * Used when the target Act is a transformation of the source Act. (For instance, used to show that a CDA document is a transformation of a DICOM SR document.)
+         */
+        XFRM, 
+        /**
+         * Used to indicate that an existing service is suggesting evidence for a new observation. The assumption of support is attributed to the same actor who asserts the observation. Source must be an observation, target may be any service  (e.g., to indicate a status post).
+         */
+        SPRT, 
+        /**
+         * A specialization of "has support" (SPRT), used to relate a secondary observation to a Region of Interest on a multidimensional observation, if the ROI specifies the true boundaries of the secondary observation as opposed to only marking the approximate area.  For example, if the start and end of an ST elevation episode is visible in an EKG, this relation would indicate the ROI bounds the  "ST elevation" observation -- the ROI defines the true beginning and ending of the episode.  Conversely, if a ROI simply contains ST elevation, but it does not define the bounds (start and end) of the episode, the more general "has support" relation is used.  Likewise, if a ROI on an image defines the true bounds of a "1st degree burn", the relation "has bounded support" is used; but if the ROI only points to the approximate area of the burn, the general "has support" relation is used.
+         */
+        SPRTBND, 
+        /**
+         * Relates an Act to its subject Act that the first Act is primarily concerned with.
+
+                        Examples
+
+                        
+                           
+                              The first Act may be a ControlAct manipulating the subject Act 
+
+                           
+                           
+                              The first act is a region of interest (ROI) that defines a region within the subject Act.
+
+                           
+                           
+                              The first act is a reporting or notification Act, that echos the subject Act for a specific new purpose.
+
+                           
+                        
+                        Constraints
+
+                        An Act may have multiple subject acts.
+
+                        Rationale
+
+                        The ActRelationshipType "has subject" is similar to the ParticipationType "subject", Acts that primarily operate on physical subjects use the Participation, those Acts that primarily operate on other Acts (other information) use the ActRelationship.
+         */
+        SUBJ, 
+        /**
+         * The target observation qualifies (refines) the semantics of the source observation.
+
+                        
+                           UsageNote: This is not intended to replace concept refinement and qualification via vocabulary.  It is used when there are multiple components which together provide the complete understanding of the source Act.
+         */
+        QUALF, 
+        /**
+         * An act that contains summary values for a list or set of subordinate acts.  For example, a summary of transactions for a particular accounting period.
+         */
+        SUMM, 
+        /**
+         * Description:Indicates that the target Act represents the result of the source observation Act.
+
+                        
+                           FormalConstraint: Source Act must be an Observation or specialization there-of. Source Act must not have the value attribute specified
+
+                        
+                           UsageNote: This relationship allows the result of an observation to be fully expressed as RIM acts as opposed to being embedded in the value attribute.  For example, sending a Document act as the result of an imaging observation, sending a list of Procedures and/or other acts as the result of a medical history observation.
+
+                        The valueNegationInd attribute on the source Act has the same semantics of "negated finding" when it applies to the target of a VALUE ActRelationship as it does to the value attribute.  On the other hand, if the ActRelationship.negationInd is true for a VALUE ActRelationship, that means the specified observation does not have the indicated value but does not imply a negated finding.  Because the semantics are extremely close, it is recommended that Observation.valueNegationInd be used, not ActRelationship.negationInd.
+
+                        
+                           OpenIssue: The implications of negationInd on ActRelationship and the valueNegationind on Observation.
+         */
+        VALUE, 
+        /**
+         * curative indication
+         */
+        CURE, 
+        /**
+         * adjunct curative indication
+         */
+        CURE_ADJ, 
+        /**
+         * adjunct mitigation
+         */
+        MTGT_ADJ, 
+        /**
+         * null
+         */
+        RACT, 
+        /**
+         * null
+         */
+        SUGG, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActRelationshipType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ART".equals(codeString))
+          return ART;
+        if ("_ActClassTemporallyPertains".equals(codeString))
+          return _ACTCLASSTEMPORALLYPERTAINS;
+        if ("_ActRelationshipAccounting".equals(codeString))
+          return _ACTRELATIONSHIPACCOUNTING;
+        if ("_ActRelationshipCostTracking".equals(codeString))
+          return _ACTRELATIONSHIPCOSTTRACKING;
+        if ("CHRG".equals(codeString))
+          return CHRG;
+        if ("COST".equals(codeString))
+          return COST;
+        if ("_ActRelationshipPosting".equals(codeString))
+          return _ACTRELATIONSHIPPOSTING;
+        if ("CREDIT".equals(codeString))
+          return CREDIT;
+        if ("DEBIT".equals(codeString))
+          return DEBIT;
+        if ("_ActRelationshipConditional".equals(codeString))
+          return _ACTRELATIONSHIPCONDITIONAL;
+        if ("CIND".equals(codeString))
+          return CIND;
+        if ("PRCN".equals(codeString))
+          return PRCN;
+        if ("RSON".equals(codeString))
+          return RSON;
+        if ("BLOCK".equals(codeString))
+          return BLOCK;
+        if ("DIAG".equals(codeString))
+          return DIAG;
+        if ("IMM".equals(codeString))
+          return IMM;
+        if ("ACTIMM".equals(codeString))
+          return ACTIMM;
+        if ("PASSIMM".equals(codeString))
+          return PASSIMM;
+        if ("MITGT".equals(codeString))
+          return MITGT;
+        if ("RCVY".equals(codeString))
+          return RCVY;
+        if ("PRYLX".equals(codeString))
+          return PRYLX;
+        if ("TREAT".equals(codeString))
+          return TREAT;
+        if ("ADJUNCT".equals(codeString))
+          return ADJUNCT;
+        if ("MTREAT".equals(codeString))
+          return MTREAT;
+        if ("PALLTREAT".equals(codeString))
+          return PALLTREAT;
+        if ("SYMP".equals(codeString))
+          return SYMP;
+        if ("TRIG".equals(codeString))
+          return TRIG;
+        if ("_ActRelationshipTemporallyPertains".equals(codeString))
+          return _ACTRELATIONSHIPTEMPORALLYPERTAINS;
+        if ("_ActRelationshipTemporallyPertainsApproximates".equals(codeString))
+          return _ACTRELATIONSHIPTEMPORALLYPERTAINSAPPROXIMATES;
+        if ("ENE".equals(codeString))
+          return ENE;
+        if ("ECW".equals(codeString))
+          return ECW;
+        if ("CONCURRENT".equals(codeString))
+          return CONCURRENT;
+        if ("SBSECWE".equals(codeString))
+          return SBSECWE;
+        if ("ENS".equals(codeString))
+          return ENS;
+        if ("ECWS".equals(codeString))
+          return ECWS;
+        if ("SNE".equals(codeString))
+          return SNE;
+        if ("SCWE".equals(codeString))
+          return SCWE;
+        if ("SNS".equals(codeString))
+          return SNS;
+        if ("SCW".equals(codeString))
+          return SCW;
+        if ("SCWSEBE".equals(codeString))
+          return SCWSEBE;
+        if ("SCWSEAE".equals(codeString))
+          return SCWSEAE;
+        if ("EAS".equals(codeString))
+          return EAS;
+        if ("EAE".equals(codeString))
+          return EAE;
+        if ("SASEAE".equals(codeString))
+          return SASEAE;
+        if ("SBEEAE".equals(codeString))
+          return SBEEAE;
+        if ("SASSBEEAS".equals(codeString))
+          return SASSBEEAS;
+        if ("SBSEAE".equals(codeString))
+          return SBSEAE;
+        if ("SAS".equals(codeString))
+          return SAS;
+        if ("SAE".equals(codeString))
+          return SAE;
+        if ("DURING".equals(codeString))
+          return DURING;
+        if ("SASECWE".equals(codeString))
+          return SASECWE;
+        if ("EASORECWS".equals(codeString))
+          return EASORECWS;
+        if ("EAEORECW".equals(codeString))
+          return EAEORECW;
+        if ("INDEPENDENT".equals(codeString))
+          return INDEPENDENT;
+        if ("SAEORSCWE".equals(codeString))
+          return SAEORSCWE;
+        if ("SASORSCW".equals(codeString))
+          return SASORSCW;
+        if ("SBEORSCWE".equals(codeString))
+          return SBEORSCWE;
+        if ("OVERLAP".equals(codeString))
+          return OVERLAP;
+        if ("EDU".equals(codeString))
+          return EDU;
+        if ("SBSEASEBE".equals(codeString))
+          return SBSEASEBE;
+        if ("SBSEAS".equals(codeString))
+          return SBSEAS;
+        if ("SDU".equals(codeString))
+          return SDU;
+        if ("SBE".equals(codeString))
+          return SBE;
+        if ("EBE".equals(codeString))
+          return EBE;
+        if ("SBSEBE".equals(codeString))
+          return SBSEBE;
+        if ("EBSORECWS".equals(codeString))
+          return EBSORECWS;
+        if ("EBS".equals(codeString))
+          return EBS;
+        if ("EBEORECW".equals(codeString))
+          return EBEORECW;
+        if ("SBSORSCW".equals(codeString))
+          return SBSORSCW;
+        if ("SBS".equals(codeString))
+          return SBS;
+        if ("AUTH".equals(codeString))
+          return AUTH;
+        if ("CAUS".equals(codeString))
+          return CAUS;
+        if ("COMP".equals(codeString))
+          return COMP;
+        if ("CTRLV".equals(codeString))
+          return CTRLV;
+        if ("MBR".equals(codeString))
+          return MBR;
+        if ("STEP".equals(codeString))
+          return STEP;
+        if ("ARR".equals(codeString))
+          return ARR;
+        if ("DEP".equals(codeString))
+          return DEP;
+        if ("PART".equals(codeString))
+          return PART;
+        if ("COVBY".equals(codeString))
+          return COVBY;
+        if ("DRIV".equals(codeString))
+          return DRIV;
+        if ("ELNK".equals(codeString))
+          return ELNK;
+        if ("EVID".equals(codeString))
+          return EVID;
+        if ("EXACBY".equals(codeString))
+          return EXACBY;
+        if ("EXPL".equals(codeString))
+          return EXPL;
+        if ("INTF".equals(codeString))
+          return INTF;
+        if ("ITEMSLOC".equals(codeString))
+          return ITEMSLOC;
+        if ("LIMIT".equals(codeString))
+          return LIMIT;
+        if ("META".equals(codeString))
+          return META;
+        if ("MFST".equals(codeString))
+          return MFST;
+        if ("NAME".equals(codeString))
+          return NAME;
+        if ("OUTC".equals(codeString))
+          return OUTC;
+        if ("_ActRelationsipObjective".equals(codeString))
+          return _ACTRELATIONSIPOBJECTIVE;
+        if ("OBJC".equals(codeString))
+          return OBJC;
+        if ("OBJF".equals(codeString))
+          return OBJF;
+        if ("GOAL".equals(codeString))
+          return GOAL;
+        if ("RISK".equals(codeString))
+          return RISK;
+        if ("PERT".equals(codeString))
+          return PERT;
+        if ("PREV".equals(codeString))
+          return PREV;
+        if ("REFR".equals(codeString))
+          return REFR;
+        if ("USE".equals(codeString))
+          return USE;
+        if ("REFV".equals(codeString))
+          return REFV;
+        if ("RELVBY".equals(codeString))
+          return RELVBY;
+        if ("SEQL".equals(codeString))
+          return SEQL;
+        if ("APND".equals(codeString))
+          return APND;
+        if ("BSLN".equals(codeString))
+          return BSLN;
+        if ("COMPLY".equals(codeString))
+          return COMPLY;
+        if ("DOC".equals(codeString))
+          return DOC;
+        if ("FLFS".equals(codeString))
+          return FLFS;
+        if ("OCCR".equals(codeString))
+          return OCCR;
+        if ("OREF".equals(codeString))
+          return OREF;
+        if ("SCH".equals(codeString))
+          return SCH;
+        if ("GEN".equals(codeString))
+          return GEN;
+        if ("GEVL".equals(codeString))
+          return GEVL;
+        if ("INST".equals(codeString))
+          return INST;
+        if ("MOD".equals(codeString))
+          return MOD;
+        if ("MTCH".equals(codeString))
+          return MTCH;
+        if ("OPTN".equals(codeString))
+          return OPTN;
+        if ("RCHAL".equals(codeString))
+          return RCHAL;
+        if ("REV".equals(codeString))
+          return REV;
+        if ("RPLC".equals(codeString))
+          return RPLC;
+        if ("SUCC".equals(codeString))
+          return SUCC;
+        if ("UPDT".equals(codeString))
+          return UPDT;
+        if ("XCRPT".equals(codeString))
+          return XCRPT;
+        if ("VRXCRPT".equals(codeString))
+          return VRXCRPT;
+        if ("XFRM".equals(codeString))
+          return XFRM;
+        if ("SPRT".equals(codeString))
+          return SPRT;
+        if ("SPRTBND".equals(codeString))
+          return SPRTBND;
+        if ("SUBJ".equals(codeString))
+          return SUBJ;
+        if ("QUALF".equals(codeString))
+          return QUALF;
+        if ("SUMM".equals(codeString))
+          return SUMM;
+        if ("VALUE".equals(codeString))
+          return VALUE;
+        if ("CURE".equals(codeString))
+          return CURE;
+        if ("CURE.ADJ".equals(codeString))
+          return CURE_ADJ;
+        if ("MTGT.ADJ".equals(codeString))
+          return MTGT_ADJ;
+        if ("RACT".equals(codeString))
+          return RACT;
+        if ("SUGG".equals(codeString))
+          return SUGG;
+        throw new FHIRException("Unknown V3ActRelationshipType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ART: return "ART";
+            case _ACTCLASSTEMPORALLYPERTAINS: return "_ActClassTemporallyPertains";
+            case _ACTRELATIONSHIPACCOUNTING: return "_ActRelationshipAccounting";
+            case _ACTRELATIONSHIPCOSTTRACKING: return "_ActRelationshipCostTracking";
+            case CHRG: return "CHRG";
+            case COST: return "COST";
+            case _ACTRELATIONSHIPPOSTING: return "_ActRelationshipPosting";
+            case CREDIT: return "CREDIT";
+            case DEBIT: return "DEBIT";
+            case _ACTRELATIONSHIPCONDITIONAL: return "_ActRelationshipConditional";
+            case CIND: return "CIND";
+            case PRCN: return "PRCN";
+            case RSON: return "RSON";
+            case BLOCK: return "BLOCK";
+            case DIAG: return "DIAG";
+            case IMM: return "IMM";
+            case ACTIMM: return "ACTIMM";
+            case PASSIMM: return "PASSIMM";
+            case MITGT: return "MITGT";
+            case RCVY: return "RCVY";
+            case PRYLX: return "PRYLX";
+            case TREAT: return "TREAT";
+            case ADJUNCT: return "ADJUNCT";
+            case MTREAT: return "MTREAT";
+            case PALLTREAT: return "PALLTREAT";
+            case SYMP: return "SYMP";
+            case TRIG: return "TRIG";
+            case _ACTRELATIONSHIPTEMPORALLYPERTAINS: return "_ActRelationshipTemporallyPertains";
+            case _ACTRELATIONSHIPTEMPORALLYPERTAINSAPPROXIMATES: return "_ActRelationshipTemporallyPertainsApproximates";
+            case ENE: return "ENE";
+            case ECW: return "ECW";
+            case CONCURRENT: return "CONCURRENT";
+            case SBSECWE: return "SBSECWE";
+            case ENS: return "ENS";
+            case ECWS: return "ECWS";
+            case SNE: return "SNE";
+            case SCWE: return "SCWE";
+            case SNS: return "SNS";
+            case SCW: return "SCW";
+            case SCWSEBE: return "SCWSEBE";
+            case SCWSEAE: return "SCWSEAE";
+            case EAS: return "EAS";
+            case EAE: return "EAE";
+            case SASEAE: return "SASEAE";
+            case SBEEAE: return "SBEEAE";
+            case SASSBEEAS: return "SASSBEEAS";
+            case SBSEAE: return "SBSEAE";
+            case SAS: return "SAS";
+            case SAE: return "SAE";
+            case DURING: return "DURING";
+            case SASECWE: return "SASECWE";
+            case EASORECWS: return "EASORECWS";
+            case EAEORECW: return "EAEORECW";
+            case INDEPENDENT: return "INDEPENDENT";
+            case SAEORSCWE: return "SAEORSCWE";
+            case SASORSCW: return "SASORSCW";
+            case SBEORSCWE: return "SBEORSCWE";
+            case OVERLAP: return "OVERLAP";
+            case EDU: return "EDU";
+            case SBSEASEBE: return "SBSEASEBE";
+            case SBSEAS: return "SBSEAS";
+            case SDU: return "SDU";
+            case SBE: return "SBE";
+            case EBE: return "EBE";
+            case SBSEBE: return "SBSEBE";
+            case EBSORECWS: return "EBSORECWS";
+            case EBS: return "EBS";
+            case EBEORECW: return "EBEORECW";
+            case SBSORSCW: return "SBSORSCW";
+            case SBS: return "SBS";
+            case AUTH: return "AUTH";
+            case CAUS: return "CAUS";
+            case COMP: return "COMP";
+            case CTRLV: return "CTRLV";
+            case MBR: return "MBR";
+            case STEP: return "STEP";
+            case ARR: return "ARR";
+            case DEP: return "DEP";
+            case PART: return "PART";
+            case COVBY: return "COVBY";
+            case DRIV: return "DRIV";
+            case ELNK: return "ELNK";
+            case EVID: return "EVID";
+            case EXACBY: return "EXACBY";
+            case EXPL: return "EXPL";
+            case INTF: return "INTF";
+            case ITEMSLOC: return "ITEMSLOC";
+            case LIMIT: return "LIMIT";
+            case META: return "META";
+            case MFST: return "MFST";
+            case NAME: return "NAME";
+            case OUTC: return "OUTC";
+            case _ACTRELATIONSIPOBJECTIVE: return "_ActRelationsipObjective";
+            case OBJC: return "OBJC";
+            case OBJF: return "OBJF";
+            case GOAL: return "GOAL";
+            case RISK: return "RISK";
+            case PERT: return "PERT";
+            case PREV: return "PREV";
+            case REFR: return "REFR";
+            case USE: return "USE";
+            case REFV: return "REFV";
+            case RELVBY: return "RELVBY";
+            case SEQL: return "SEQL";
+            case APND: return "APND";
+            case BSLN: return "BSLN";
+            case COMPLY: return "COMPLY";
+            case DOC: return "DOC";
+            case FLFS: return "FLFS";
+            case OCCR: return "OCCR";
+            case OREF: return "OREF";
+            case SCH: return "SCH";
+            case GEN: return "GEN";
+            case GEVL: return "GEVL";
+            case INST: return "INST";
+            case MOD: return "MOD";
+            case MTCH: return "MTCH";
+            case OPTN: return "OPTN";
+            case RCHAL: return "RCHAL";
+            case REV: return "REV";
+            case RPLC: return "RPLC";
+            case SUCC: return "SUCC";
+            case UPDT: return "UPDT";
+            case XCRPT: return "XCRPT";
+            case VRXCRPT: return "VRXCRPT";
+            case XFRM: return "XFRM";
+            case SPRT: return "SPRT";
+            case SPRTBND: return "SPRTBND";
+            case SUBJ: return "SUBJ";
+            case QUALF: return "QUALF";
+            case SUMM: return "SUMM";
+            case VALUE: return "VALUE";
+            case CURE: return "CURE";
+            case CURE_ADJ: return "CURE.ADJ";
+            case MTGT_ADJ: return "MTGT.ADJ";
+            case RACT: return "RACT";
+            case SUGG: return "SUGG";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActRelationshipType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ART: return "Description: A directed association between a source Act and a target Act.\r\n\n                        \n                           Usage Note: This code should never be transmitted in an instance as the value of ActRelationship.typeCode (attribute)";
+            case _ACTCLASSTEMPORALLYPERTAINS: return "ActClassTemporallyPertains";
+            case _ACTRELATIONSHIPACCOUNTING: return "Codes that describe the relationship between an Act and a financial instrument such as a financial transaction, account or invoice element.";
+            case _ACTRELATIONSHIPCOSTTRACKING: return "Expresses values for describing the relationship relationship between an InvoiceElement or InvoiceElementGroup and a billable act.";
+            case CHRG: return "A relationship that provides an ability to associate a financial transaction (target) as a charge to a clinical act (source).  A clinical act may have a charge associated with the execution or delivery of the service.\r\n\n                        The financial transaction will define the charge (bill) for delivery or performance of the service.\r\n\n                        Charges and costs are distinct terms.  A charge defines what is charged or billed to another organization or entity within an organization.  The cost defines what it costs an organization to perform or deliver a service or product.";
+            case COST: return "A relationship that provides an ability to associate a financial transaction (target) as a cost to a clinical act (source).  A clinical act may have an inherit cost associated with the execution or delivery of the service.\r\n\n                        The financial transaction will define the cost of delivery or performance of the service.\r\n\n                        Charges and costs are distinct terms.  A charge defines what is charged or billed to another organization or entity within an organization.  The cost defines what it costs an organization to perform or deliver a service or product.";
+            case _ACTRELATIONSHIPPOSTING: return "Expresses values for describing the relationship between a FinancialTransaction and an Account.";
+            case CREDIT: return "A credit relationship ties a financial transaction (target) to an account (source). A credit, once applied (posted), may have either a positive or negative effect on the account balance, depending on the type of account. An asset account credit will decrease the account balance. A non-asset account credit will decrease the account balance.";
+            case DEBIT: return "A debit relationship ties a financial transaction (target) to an account (source).  A debit, once applied (posted), may have either a positive or negative effect on the account balance, depending on the type of account.  An asset account debit will increase the account balance.  A non-asset account debit will decrease the account balance.";
+            case _ACTRELATIONSHIPCONDITIONAL: return "Specifies under what circumstances (target Act) the source-Act may, must, must not or has occurred";
+            case CIND: return "A contraindication is just a negation of a reason, i.e. it gives a condition under which the action is not to be done. Both, source and target can be any kind of service; target service is in criterion mood. How the strength of a contraindication is expressed (e.g., relative, absolute) is left as an open issue. The priorityNumber attribute could be used.";
+            case PRCN: return "A requirement to be true before a service is performed. The target can be any service in criterion mood.  For multiple pre-conditions a conjunction attribute (AND, OR, XOR) is applicable.";
+            case RSON: return "Description: The reason or rationale for a service. A reason link is weaker than a trigger, it only suggests that some service may be or might have been a reason for some action, but not that this reason requires/required the action to be taken. Also, as opposed to the trigger, there is no strong timely relation between the reason and the action.  As well as providing various types of information about the rationale for a service, the RSON act relationship is routinely used between a SBADM act and an OBS act to describe the indication for use of a medication.  Child concepts may be used to describe types of indication. \r\n\n                        \n                           Discussion: In prior releases, the code \"SUGG\" (suggests) was expressed as \"an inversion of the reason link.\" That code has been retired in favor of the inversion indicator that is an attribute of ActRelationship.";
+            case BLOCK: return "Definition: The source act is performed to block the effects of the target act.  This act relationship should be used when describing near miss type incidents where potential harm could have occurred, but the action described in the source act blocked the potential harmful effects of the incident actually occurring.";
+            case DIAG: return "Description: The source act is intended to help establish the presence of a (an adverse) situation described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.";
+            case IMM: return "Description: The source act is intented to provide immunity against the effects of the target act (the target act describes an infectious disease)";
+            case ACTIMM: return "Description: The source act is intended to provide active immunity against the effects of the target act (the target act describes an infectious disease)";
+            case PASSIMM: return "Description: The source act is intended to provide passive immunity against the effects of the target act (the target act describes an infectious disease).";
+            case MITGT: return "The source act removes or lessens the occurrence or effect of the target act.";
+            case RCVY: return "Definition: The source act is performed to recover from the effects of the target act.";
+            case PRYLX: return "Description: The source act is intended to reduce the risk of of an adverse situation to emerge as described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.";
+            case TREAT: return "Description: The source act is intended to improve a pre-existing adverse situation described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.";
+            case ADJUNCT: return "Description: The source act is intended to offer an additional treatment for the management or cure of a pre-existing adverse situation described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.  It is not a requirement that the non-adjunctive treatment is explicitly specified.";
+            case MTREAT: return "Description: The source act is intended to provide long term maintenance improvement or management of a pre-existing adverse situation described by the target act. This is not limited to diseases but can apply to any adverse situation or condition of medical or technical nature.";
+            case PALLTREAT: return "Description: The source act is intended to provide palliation for the effects of the target act.";
+            case SYMP: return "Description: The source act is intented to provide symptomatic relief for the effects of the target act.";
+            case TRIG: return "A pre-condition that if true should result in the source Act being executed.  The target is in typically in criterion mood.  When reported after the fact (i.e. the criterion has been met) it may be in Event mood.  A delay between the trigger and the triggered action can be specified.\r\n\n                        \n                           Discussion: This includes the concept of a  required act for a service or financial instrument such as an insurance plan or policy. In such cases, the trigger is the occurrence of a specific condition such as coverage limits being exceeded.";
+            case _ACTRELATIONSHIPTEMPORALLYPERTAINS: return "Abstract collector for ActRelationhsip types that relate two acts by their timing.";
+            case _ACTRELATIONSHIPTEMPORALLYPERTAINSAPPROXIMATES: return "Abstract collector for ActRelationship types that relate two acts by their approximate timing.";
+            case ENE: return "A relationship in which the source act's effective time ends near the end of the target act's effective time. Near is defined separately as a time interval.\r\n\n                        \n                           Usage Note: Inverse code is ENS";
+            case ECW: return "A relationship in which the source act's effective time ends with the end of the target act's effective time.\r\n\n                        \n                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.";
+            case CONCURRENT: return "A relationship in which the source act's effective time is the same as the target act's effective time.\r\n\n                        \n                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.";
+            case SBSECWE: return "The source Act starts before the start of the target Act, and ends with the target Act.\r\n\n                        \n                           UsageNote: Inverse code is SASECWE";
+            case ENS: return "A relationship in which the source act's effective time ends near the start of the target act's effective time. Near is defined separately as a time interval.\r\n\n                        \n                           Usage Note: Inverse code is ENE";
+            case ECWS: return "The source Act ends when the target act starts (i.e. if we say \"ActOne ECWS ActTwo\", it means that ActOne ends when ActTwo starts, therefore ActOne is the source and ActTwo is the target).\r\n\n                        \n                           UsageNote: Inverse code is SCWE";
+            case SNE: return "A relationship in which the source act's effective time starts near the end of the target act's effective time. Near is defined separately as a time interval.\r\n\n                        \n                           Usage Note: Inverse code is SNS";
+            case SCWE: return "The source Act starts when the target act ends (i.e. if we say \"ActOne SCWE ActTwo\", it means that ActOne starts when ActTwo ends, therefore ActOne is the source and ActTwo is the target).\r\n\n                        \n                           UsageNote: Inverse code is SBSECWS";
+            case SNS: return "A relationship in which the source act's effective time starts near the start of the target act's effective time. Near is defined separately as a time interval.\r\n\n                        \n                           Usage Note: Inverse code is SNE";
+            case SCW: return "A relationship in which the source act's effective time starts with the start of the target act's effective time.\r\n\n                        \n                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.";
+            case SCWSEBE: return "The source Act starts with.the target Act and ends before the end of the target Act.\r\n\n                        \n                           UsageNote: Inverse code is SCWSEAE";
+            case SCWSEAE: return "The source Act starts with the target Act, and ends after the end of the target Act.";
+            case EAS: return "A relationship in which the source act ends after the target act starts.\r\n\n                        \n                           UsageNote: Inverse code is SBE";
+            case EAE: return "A relationship in which the source act ends after the target act ends.\r\n\n                        \n                           UsageNote: Inverse code is EBE";
+            case SASEAE: return "The source Act starts after start of the target Act and ends after end of the target Act.\r\n\n                        \n                           UsageNote: Inverse code is SBSEBE";
+            case SBEEAE: return "The source Act contains the end of the target Act.\r\n\n                        \n                           UsageNote: Inverse code is EDU";
+            case SASSBEEAS: return "The source Act start after the start of the target Act, and contains the end of the target Act.\r\n\n                        \n                           UsageNote: Inverse code is SBSEASEBE";
+            case SBSEAE: return "The source Act contains the time of the target Act.\r\n\n                        \n                           UsageNote: Inverse code is DURING";
+            case SAS: return "The source Act starts after the start of the target Act (i.e. if we say \"ActOne SAS ActTwo\", it means that ActOne starts after the start of ActTwo, therefore ActOne is the source and ActTwo is the target).\r\n\n                        \n                           UsageNote: Inverse code is SBS";
+            case SAE: return "A relationship in which the source act starts after the target act ends.\r\n\n                        \n                           UsageNote: Inverse code is EBS";
+            case DURING: return "A relationship in which the source act's effective time is wholly within the target act's effective time (including end points, as defined in the act's effective times)\r\n\n                        \n                           UsageNote: Inverse code is SBSEAE";
+            case SASECWE: return "The source Act starts after start of the target Act, and ends with the target Act.\r\n\n                        \n                           UsageNote: Inverse code is SBSECWE";
+            case EASORECWS: return "A relationship in which the source act's effective time ends after or concurrent with the start of the target act's effective time.\r\n\n                        \n                           Usage Note: Inverse code is EBSORECWS";
+            case EAEORECW: return "A relationship in which the source act's effective time ends after or concurrent with the end of the target act's effective time.\r\n\n                        \n                           Usage Note: Inverse code is EBEORECW";
+            case INDEPENDENT: return "The source Act is independent of the time of the target Act.\r\n\n                        \n                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.";
+            case SAEORSCWE: return "A relationship in which the source act's effective time starts after or concurrent with the end of the target act's effective time.\r\n\n                        \n                           Usage Note: Inverse code is SBEORSCWE";
+            case SASORSCW: return "A relationship in which the source act's effective time starts after or concurrent with the start of the target act's effective time.\r\n\n                        \n                           Usage Note: Inverse code is SBSORSCW";
+            case SBEORSCWE: return "A relationship in which the source act's effective time starts before or concurrent with the end of the target act's effective time.\r\n\n                        \n                           Usage Note: Inverse code is SAEORSCWE";
+            case OVERLAP: return "A relationship in which the source act's effective time overlaps the target act's effective time in any way.\r\n\n                        \n                           UsageNote: This code is reflexive.  Therefore its inverse code is itself.";
+            case EDU: return "A relationship in which the source act ends within the target act's effective time (including end points, as defined in the act's effective times)\r\n\n                        \n                           UsageNote: Inverse code is SBEEAE";
+            case SBSEASEBE: return "The source Act contains the start of the target Act,  and ends before the end of the target Act.\r\n\n                        \n                           UsageNote: Inverse code is SASSBEEAS";
+            case SBSEAS: return "The source Act contains the start of the target Act.\r\n\n                        \n                           UsageNote: Inverse code is SDU";
+            case SDU: return "A relationship in which the source act starts within the target act's effective time (including end points, as defined in the act's effective times)\r\n\n                        \n                           UsageNote: Inverse code is SBSEAS";
+            case SBE: return "The source Act starts before the end of the target Act (i.e. if we say \"ActOne SBE ActTwo\", it means that ActOne starts before the end of ActTwo, therefore ActOne is the source and ActTwo is the target).\r\n\n                        \n                           UsageNote: Inverse code is EAS";
+            case EBE: return "The source Act ends before the end of the target Act (i.e. if we say \"ActOne EBE ActTwo\", it means that ActOne ends before the end of ActTwo, therefore ActOne is the source and ActTwo is the target).\r\n\n                        \n                           UsageNote: Inverse code is EAE";
+            case SBSEBE: return "The source Act starts before the start of the target Act, and ends before the end of the target Act.\r\n\n                        \n                           UsageNote: Inverse code is SASEAE";
+            case EBSORECWS: return "A relationship in which the source act's effective time ends before or concurrent with the start of the target act's effective time.\r\n\n                        \n                           Usage Note: Inverse code is EASORECWS";
+            case EBS: return "A relationship in which the source act ends before the target act starts.\r\n\n                        \n                           UsageNote: Inverse code is SAE";
+            case EBEORECW: return "A relationship in which the source act's effective time ends before or concurrent with the end of the target act's effective time.\r\n\n                        \n                           Usage Note: Inverse code is EAEORECW";
+            case SBSORSCW: return "A relationship in which the source act's effective time starts before or concurrent with the start of the target act's effective time.\r\n\n                        \n                           Usage Note: Inverse code is SASORSCW";
+            case SBS: return "A relationship in which the source act begins before the target act begins.\r\n\n                        \n                           UsageNote: Inverse code is SAS";
+            case AUTH: return "A relationship in which the target act authorizes or certifies the source act.";
+            case CAUS: return "Description: An assertion that an act was the cause of another act.This is stronger and more specific than the support link. The source (cause) is typically an observation, but may be any act, while the target may be any act.\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           a growth of Staphylococcus aureus may be considered the cause of an abscess\n                           contamination of the infusion bag was deemed to be the cause of the infection that the patient experienced\n                           lack of staff on the shift was deemed to be a supporting factor (proximal factor) causing the patient safety incident where the patient fell out of bed because the  bed-sides had not been put up which caused the night patient to fall out of bed";
+            case COMP: return "The target act is a component of the source act, with no semantics regarding composition or aggregation implied.";
+            case CTRLV: return "A relationship from an Act to a Control Variable.  For example, if a Device makes an Observation, this relates the Observation to its Control Variables documenting  the device's settings that influenced the observation.";
+            case MBR: return "The target Acts are aggregated by the source Act.  Target Acts may have independent existence, participate in multiple ActRelationships, and do not contribute to the meaning of the source.\r\n\n                        \n                           UsageNotes: This explicitly represents the conventional notion of aggregation.  The target Act is part of a collection of Acts (no implication is made of cardinality, a source of Acts may contain zero, one, or more member target Acts).\r\n\n                        It is expected that this will be primarily used with _ActClassRecordOrganizer, BATTERY, and LIST";
+            case STEP: return "A collection of sub-services as steps or subtasks performed for the source service. Services may be performed sequentially or concurrently.\r\n\n                        \n                           UsageNotes: Sequence of steps may be indicated by use of _ActRelationshipTemporallyPertains, as well as via  ActRelationship.sequenceNumber, ActRelationship.pauseQuantity, Target.priorityCode.\r\n\n                        \n                           OpenIssue: Need Additional guidelines on when each approach should be used.";
+            case ARR: return "The relationship that links to a Transportation Act (target) from another Act (source) indicating that the subject of the source Act entered into the source Act by means of the target Transportation act.";
+            case DEP: return "The relationship that links to a Transportation Act (target) from another Act (source) indicating that the subject of the source Act departed from the source Act by means of the target Transportation act.";
+            case PART: return "The source Act is a composite of the target Acts. The target Acts do not have an existence independent of the source Act.\r\n\n                        \n                           UsageNote: In UML 1.1, this is a \"composition\" defined as: \n                           \"A form of aggregation with strong ownership and coincident lifetime as part of the whole. Parts with non-fixed multiplicity may be created after the composite itself, but once created they live and die with it (i.e., they share lifetimes). Such parts can also be explicitly removed before the death of the composite. Composition may be recursive.\"";
+            case COVBY: return "A relationship in which the source act is covered by or is under the authority of a target act.  A financial instrument such as an Invoice Element is covered by one or more specific instances of an Insurance Policy.";
+            case DRIV: return "Associates a derived Act with its input parameters. E.G., an anion-gap observation can be associated as being derived from given sodium-, (potassium-,), chloride-, and bicarbonate-observations. The narrative content (Act.text) of a source act is wholly machine-derived from the collection of target acts.";
+            case ELNK: return "Expresses an association that links two instances of the same act over time, indicating that the instance are part of the same episode, e.g. linking two condition nodes for episode of illness; linking two encounters for episode of encounter.";
+            case EVID: return "Indicates that the target Act provides evidence in support of the action represented by the source Act. The target is not a 'reason' for the source act, but rather gives supporting information on why the source act is an appropriate course of action. Possible targets might be clinical trial results, journal articles, similar successful therapies, etc.\r\n\n                        \n                           Rationale: Provides a mechanism for conveying clinical justification for non-approved or otherwise non-traditional therapies.";
+            case EXACBY: return "Description:The source act is aggravated by the target act. (Example \"chest pain\" EXACBY \"exercise\")";
+            case EXPL: return "This is the inversion of support.  Used to indicate that a given observation is explained by another observation or condition.";
+            case INTF: return "the target act documents a set of circumstances (events, risks) which prevent successful completion, or degradation of quality of, the source Act.\r\n\n                        \n                           UsageNote: This provides the semantics to document barriers to care";
+            case ITEMSLOC: return "Items located";
+            case LIMIT: return "A relationship that limits or restricts the source act by the elements of the target act.  For example, an authorization may be limited by a financial amount (up to $500). Target Act must be in EVN.CRIT mood.";
+            case META: return "Definition: Indicates that the attributes and associations of the target act provide metadata (for example, identifiers, authorship, etc.) for the source act.\r\n\n                        \n                           Constraint:  Source act must have either a mood code that is not \"EVN\" (event) or its \"isCriterion\" attribute must set to \"true\".  Target act must be an Act with a mood code of EVN and with isCriterionInd attribute set to \"true\".";
+            case MFST: return "An assertion that a new observation may be the manifestation of another existing observation or action.  This assumption is attributed to the same actor who asserts the manifestation.  This is stronger and more specific than an inverted support link.  For example, an agitated appearance can be asserted to be the manifestation (effect) of a known hyperthyroxia.  This expresses that one might not have realized a symptom if it would not be a common manifestation of a known condition.  The target (cause) may be any service, while the source (manifestation) must be an observation.";
+            case NAME: return "Used to assign a \"name\" to a condition thread. Source is a condition node, target can be any service.";
+            case OUTC: return "An observation that should follow or does actually follow as a result or consequence of a condition or action (sometimes called \"post-conditional\".) Target must be an observation as a goal, risk or any criterion. For complex outcomes a conjunction attribute (AND, OR, XOR) can be used.  An outcome link is often inverted to describe an outcome assessment.";
+            case _ACTRELATIONSIPOBJECTIVE: return "The target act is a desired outcome of the source act. Source is any act (typically an intervention). Target must be an observation in criterion mood.";
+            case OBJC: return "A desired state that a service action aims to maintain.  E.g., keep systolic blood pressure between 90 and 110 mm Hg.  Source is an intervention service.  Target must be an observation in criterion mood.";
+            case OBJF: return "A desired outcome that a service action aims to meet finally.  Source is any service (typically an intervention).  Target must be an observation in criterion mood.";
+            case GOAL: return "A goal that one defines given a patient's health condition.  Subsequently planned actions aim to meet that goal.  Source is an observation or condition node, target must be an observation in goal mood.";
+            case RISK: return "A noteworthy undesired outcome of a patient's condition that is either likely enough to become an issue or is less likely but dangerous enough to be addressed.";
+            case PERT: return "This is a very unspecific relationship from one item of clinical information to another.  It does not judge about the role the pertinent information plays.";
+            case PREV: return "A relationship in which the target act is a predecessor instance to the source act.  Generally each of these instances is similar, but no identical.  In healthcare coverage it is used to link a claim item to a previous claim item that might have claimed for the same set of services.";
+            case REFR: return "A relationship in which the target act is referred to by the source act.  This permits a simple reference relationship that distinguishes between the referent and the referee.";
+            case USE: return "Indicates that the source act makes use of (or will make use of) the information content of the target act.\r\n\n                        \n                           UsageNotes: A usage relationship only makes sense if the target act is authored and occurs independently of the source act.  Otherwise a simpler relationship such as COMP would be appropriate.\r\n\n                        \n                           Rationale: There is a need when defining a clinical trial protocol to indicate that the protocol makes use of other protocol or treatment specifications.  This is stronger than the assertion of \"references\".  References may exist without usage, and in a clinical trial protocol is common to assert both: what other specifications does this trial use and what other specifications does it merely reference.";
+            case REFV: return "Reference ranges are essentially descriptors of a class of result values assumed to be \"normal\", \"abnormal\", or \"critical.\"  Those can vary by sex, age, or any other criterion. Source and target are observations, the target is in criterion mood.  This link type can act as a trigger in case of alarms being triggered by critical results.";
+            case RELVBY: return "Description:The source act is wholly or partially alleviated by the target act. (Example \"chest pain\" RELVBY \"sublingual nitroglycerin administration\")";
+            case SEQL: return "An act relationship indicating that the source act follows the target act. The source act should in principle represent the same kind of act as the target. Source and target need not have the same mood code (mood will often differ). The target of a sequel is called antecedent. Examples for sequel relationships are: revision, transformation, derivation from a prototype (as a specialization is a derivation of a generalization), followup, realization, instantiation.";
+            case APND: return "An addendum (source) to an existing service object (target), containing supplemental information.  The addendum is itself an original service object linked to the supplemented service object.  The supplemented service object remains in place and its content and status are unaltered.";
+            case BSLN: return "Indicates that the target observation(s) provide an initial reference for the source observation or observation group.\r\n\n                        \n                           UsageConstraints: Both source and target must be Observations or specializations thereof.";
+            case COMPLY: return "Description:The source act complies with, adheres to, conforms to, or is permissible under (in whole or in part) the policy, contract, agreement, law, conformance criteria, certification guidelines or requirement conveyed by the target act.\r\n\n                        Examples for compliance relationships are: audits of adherence with a security policy, certificate of conformance to system certification requirements, or consent directive in compliance with or permissible under a privacy policy.";
+            case DOC: return "The source act documents the target act.";
+            case FLFS: return "The source act fulfills (in whole or in part) the target act. Source act must be in a mood equal or more actual than the target act.";
+            case OCCR: return "The source act is a single occurrence of a repeatable target act. The source and target act can be in any mood on the \"completion track\" but the source act must be as far as or further along the track than the target act (i.e., the occurrence of an intent can be an event but not vice versa).";
+            case OREF: return "Relates either an appointment request or an appointment to the order for the service being scheduled.";
+            case SCH: return "Associates a specific time (and associated resources) with a scheduling request or other intent.";
+            case GEN: return "The generalization relationship can be used to express categorical knowledge about services (e.g., amilorid, triamterene, and spironolactone have the common generalization potassium sparing diuretic).";
+            case GEVL: return "A goal-evaluation links an observation (intent or actual) to a goal to indicate that the observation evaluates the goal. Given the goal and the observation, a \"goal distance\" (e.g., goal to observation) can be \"calculated\" and need not be sent explicitly.";
+            case INST: return "Used to capture the link between a potential service (\"master\" or plan) and an actual service, where the actual service instantiates the potential service. The instantiation may override the master's defaults.";
+            case MOD: return "Definition: Used to link a newer version or 'snapshot' of a business object (source) to an older version or 'snapshot' of the same business object (target).\r\n\n                        \n                           Usage:The identifier of the Act should be the same for both source and target. If the identifiers are distinct, RPLC should be used instead.\r\n\n                        Name from source to target = \"modifiesPrior\"\r\n\n                        Name from target to source = \"modifiesByNew\"";
+            case MTCH: return "A trigger-match links an actual service (e.g., an observation or procedure that took place) with a service in criterion mood.  For example if the trigger is \"observation of pain\" and pain is actually observed, and if that pain-observation caused the trigger to fire, that pain-observation can be linked with the trigger.";
+            case OPTN: return "A relationship between a source Act that provides more detailed properties to the target Act.\r\n\n                        The source act thus is a specialization of the target act, but instead of mentioning all the inherited properties it only mentions new property bindings or refinements.\r\n\n                        The typical use case is to specify certain alternative variants of one kind of Act. The priorityNumber attribute is used to weigh refinements as preferred over other alternative refinements.\r\n\n                        Example: several routing options for a drug are specified as one SubstanceAdministration for the general treatment with attached refinements for the various routing options.";
+            case RCHAL: return "Description:A relationship in which the target act is carried out to determine whether an effect attributed to the source act can be recreated.";
+            case REV: return "A relationship between a source Act that seeks to reverse or undo the action of the prior target Act.\r\n\n                        Example: A posted financial transaction (e.g., a debit transaction) was applied in error and must be reversed (e.g., by a credit transaction) the credit transaction is identified as an undo (or reversal) of the prior target transaction.\r\n\n                        Constraints: the \"completion track\" mood of the target Act must be equally or more \"actual\" than the source act. I.e., when the target act is EVN the source act can be EVN, or any INT. If the target act is INT, the source act can be INT.";
+            case RPLC: return "A replacement source act replaces an existing target act. The state of the target act being replaced becomes obselete, but the act is typically still retained in the system for historical reference.  The source and target must be of the same type.";
+            case SUCC: return "Definition:  A new act that carries forward the intention of the original act, but does not completely replace it.  The status of the predecessor act must be 'completed'.  The original act is the target act and the successor is the source act.";
+            case UPDT: return "A condition thread relationship specifically links condition nodes together to form a condition thread. The source is the new condition node and the target links to the most recent node of the existing condition thread.";
+            case XCRPT: return "The source is an excerpt from the target.";
+            case VRXCRPT: return "The source is a direct quote from the target.";
+            case XFRM: return "Used when the target Act is a transformation of the source Act. (For instance, used to show that a CDA document is a transformation of a DICOM SR document.)";
+            case SPRT: return "Used to indicate that an existing service is suggesting evidence for a new observation. The assumption of support is attributed to the same actor who asserts the observation. Source must be an observation, target may be any service  (e.g., to indicate a status post).";
+            case SPRTBND: return "A specialization of \"has support\" (SPRT), used to relate a secondary observation to a Region of Interest on a multidimensional observation, if the ROI specifies the true boundaries of the secondary observation as opposed to only marking the approximate area.  For example, if the start and end of an ST elevation episode is visible in an EKG, this relation would indicate the ROI bounds the  \"ST elevation\" observation -- the ROI defines the true beginning and ending of the episode.  Conversely, if a ROI simply contains ST elevation, but it does not define the bounds (start and end) of the episode, the more general \"has support\" relation is used.  Likewise, if a ROI on an image defines the true bounds of a \"1st degree burn\", the relation \"has bounded support\" is used; but if the ROI only points to the approximate area of the burn, the general \"has support\" relation is used.";
+            case SUBJ: return "Relates an Act to its subject Act that the first Act is primarily concerned with.\r\n\n                        Examples\r\n\n                        \n                           \n                              The first Act may be a ControlAct manipulating the subject Act \r\n\n                           \n                           \n                              The first act is a region of interest (ROI) that defines a region within the subject Act.\r\n\n                           \n                           \n                              The first act is a reporting or notification Act, that echos the subject Act for a specific new purpose.\r\n\n                           \n                        \n                        Constraints\r\n\n                        An Act may have multiple subject acts.\r\n\n                        Rationale\r\n\n                        The ActRelationshipType \"has subject\" is similar to the ParticipationType \"subject\", Acts that primarily operate on physical subjects use the Participation, those Acts that primarily operate on other Acts (other information) use the ActRelationship.";
+            case QUALF: return "The target observation qualifies (refines) the semantics of the source observation.\r\n\n                        \n                           UsageNote: This is not intended to replace concept refinement and qualification via vocabulary.  It is used when there are multiple components which together provide the complete understanding of the source Act.";
+            case SUMM: return "An act that contains summary values for a list or set of subordinate acts.  For example, a summary of transactions for a particular accounting period.";
+            case VALUE: return "Description:Indicates that the target Act represents the result of the source observation Act.\r\n\n                        \n                           FormalConstraint: Source Act must be an Observation or specialization there-of. Source Act must not have the value attribute specified\r\n\n                        \n                           UsageNote: This relationship allows the result of an observation to be fully expressed as RIM acts as opposed to being embedded in the value attribute.  For example, sending a Document act as the result of an imaging observation, sending a list of Procedures and/or other acts as the result of a medical history observation.\r\n\n                        The valueNegationInd attribute on the source Act has the same semantics of \"negated finding\" when it applies to the target of a VALUE ActRelationship as it does to the value attribute.  On the other hand, if the ActRelationship.negationInd is true for a VALUE ActRelationship, that means the specified observation does not have the indicated value but does not imply a negated finding.  Because the semantics are extremely close, it is recommended that Observation.valueNegationInd be used, not ActRelationship.negationInd.\r\n\n                        \n                           OpenIssue: The implications of negationInd on ActRelationship and the valueNegationind on Observation.";
+            case CURE: return "curative indication";
+            case CURE_ADJ: return "adjunct curative indication";
+            case MTGT_ADJ: return "adjunct mitigation";
+            case RACT: return "";
+            case SUGG: return "";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ART: return "act relationship type";
+            case _ACTCLASSTEMPORALLYPERTAINS: return "ActClassTemporallyPertains";
+            case _ACTRELATIONSHIPACCOUNTING: return "ActRelationshipAccounting";
+            case _ACTRELATIONSHIPCOSTTRACKING: return "ActRelationshipCostTracking";
+            case CHRG: return "has charge";
+            case COST: return "has cost";
+            case _ACTRELATIONSHIPPOSTING: return "ActRelationshipPosting";
+            case CREDIT: return "has credit";
+            case DEBIT: return "has debit";
+            case _ACTRELATIONSHIPCONDITIONAL: return "ActRelationshipConditional";
+            case CIND: return "has contra-indication";
+            case PRCN: return "has pre-condition";
+            case RSON: return "has reason";
+            case BLOCK: return "blocks";
+            case DIAG: return "diagnoses";
+            case IMM: return "immunization against";
+            case ACTIMM: return "active immunization against";
+            case PASSIMM: return "passive immunization against";
+            case MITGT: return "mitigates";
+            case RCVY: return "recovers";
+            case PRYLX: return "prophylaxis of";
+            case TREAT: return "treats";
+            case ADJUNCT: return "adjunctive treatment";
+            case MTREAT: return "maintenance treatment";
+            case PALLTREAT: return "palliates";
+            case SYMP: return "symptomatic relief";
+            case TRIG: return "has trigger";
+            case _ACTRELATIONSHIPTEMPORALLYPERTAINS: return "ActRelationshipTemporallyPertains";
+            case _ACTRELATIONSHIPTEMPORALLYPERTAINSAPPROXIMATES: return "ActRelationshipTemporallyPertainsApproximates";
+            case ENE: return "ends near end";
+            case ECW: return "ends concurrent with";
+            case CONCURRENT: return "concurrent with";
+            case SBSECWE: return "starts before start of, ends with";
+            case ENS: return "ends near start";
+            case ECWS: return "ends concurrent with start of";
+            case SNE: return "starts near end";
+            case SCWE: return "starts concurrent with end of";
+            case SNS: return "starts near start";
+            case SCW: return "starts concurrent with";
+            case SCWSEBE: return "starts with. ends before end of";
+            case SCWSEAE: return "starts with, ends after end of";
+            case EAS: return "ends after start of";
+            case EAE: return "ends after end of";
+            case SASEAE: return "starts after start of, ends after end of";
+            case SBEEAE: return "contains end of";
+            case SASSBEEAS: return "start after start of, contains end of";
+            case SBSEAE: return "contains time of";
+            case SAS: return "starts after start of";
+            case SAE: return "starts after end of";
+            case DURING: return "occurs during";
+            case SASECWE: return "starts after start of, ends with";
+            case EASORECWS: return "ends after or concurrent with start of";
+            case EAEORECW: return "ends after or concurrent with end of";
+            case INDEPENDENT: return "independent of time of";
+            case SAEORSCWE: return "starts after or concurrent with end of";
+            case SASORSCW: return "starts after or concurrent with start of";
+            case SBEORSCWE: return "starts before or concurrent with end of";
+            case OVERLAP: return "overlaps with";
+            case EDU: return "ends during";
+            case SBSEASEBE: return "contains start of, ends before end of";
+            case SBSEAS: return "contains start of";
+            case SDU: return "starts during";
+            case SBE: return "starts before end of";
+            case EBE: return "ends before end of";
+            case SBSEBE: return "starts before start of, ends before end of";
+            case EBSORECWS: return "ends before or concurrent with start of";
+            case EBS: return "ends before start of";
+            case EBEORECW: return "ends before or concurrent with end of";
+            case SBSORSCW: return "starts before or concurrent with start of";
+            case SBS: return "starts before start of";
+            case AUTH: return "authorized by";
+            case CAUS: return "is etiology for";
+            case COMP: return "has component";
+            case CTRLV: return "has control variable";
+            case MBR: return "has member";
+            case STEP: return "has step";
+            case ARR: return "arrival";
+            case DEP: return "departure";
+            case PART: return "has part";
+            case COVBY: return "covered by";
+            case DRIV: return "is derived from";
+            case ELNK: return "episodeLink";
+            case EVID: return "provides evidence for";
+            case EXACBY: return "exacerbated by";
+            case EXPL: return "has explanation";
+            case INTF: return "interfered by";
+            case ITEMSLOC: return "items located";
+            case LIMIT: return "limited by";
+            case META: return "has metadata";
+            case MFST: return "is manifestation of";
+            case NAME: return "assigns name";
+            case OUTC: return "has outcome";
+            case _ACTRELATIONSIPOBJECTIVE: return "Act Relationsip Objective";
+            case OBJC: return "has continuing objective";
+            case OBJF: return "has final objective";
+            case GOAL: return "has goal";
+            case RISK: return "has risk";
+            case PERT: return "has pertinent information";
+            case PREV: return "has previous instance";
+            case REFR: return "refers to";
+            case USE: return "uses";
+            case REFV: return "has reference values";
+            case RELVBY: return "relieved by";
+            case SEQL: return "is sequel";
+            case APND: return "is appendage";
+            case BSLN: return "has baseline";
+            case COMPLY: return "complies with";
+            case DOC: return "documents";
+            case FLFS: return "fulfills";
+            case OCCR: return "occurrence";
+            case OREF: return "references order";
+            case SCH: return "schedules request";
+            case GEN: return "has generalization";
+            case GEVL: return "evaluates (goal)";
+            case INST: return "instantiates (master)";
+            case MOD: return "modifies";
+            case MTCH: return "matches (trigger)";
+            case OPTN: return "has option";
+            case RCHAL: return "re-challenge";
+            case REV: return "reverses";
+            case RPLC: return "replaces";
+            case SUCC: return "succeeds";
+            case UPDT: return "updates (condition)";
+            case XCRPT: return "Excerpts";
+            case VRXCRPT: return "Excerpt verbatim";
+            case XFRM: return "transformation";
+            case SPRT: return "has support";
+            case SPRTBND: return "has bounded support";
+            case SUBJ: return "has subject";
+            case QUALF: return "has qualifier";
+            case SUMM: return "summarized by";
+            case VALUE: return "has value";
+            case CURE: return "curative indication";
+            case CURE_ADJ: return "adjunct curative indication";
+            case MTGT_ADJ: return "adjunct mitigation";
+            case RACT: return "RACT";
+            case SUGG: return "SUGG";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipTypeEnumFactory.java
new file mode 100644
index 00000000000..70804b86381
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActRelationshipTypeEnumFactory.java
@@ -0,0 +1,602 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActRelationshipTypeEnumFactory implements EnumFactory {
+
+  public V3ActRelationshipType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ART".equals(codeString))
+      return V3ActRelationshipType.ART;
+    if ("_ActClassTemporallyPertains".equals(codeString))
+      return V3ActRelationshipType._ACTCLASSTEMPORALLYPERTAINS;
+    if ("_ActRelationshipAccounting".equals(codeString))
+      return V3ActRelationshipType._ACTRELATIONSHIPACCOUNTING;
+    if ("_ActRelationshipCostTracking".equals(codeString))
+      return V3ActRelationshipType._ACTRELATIONSHIPCOSTTRACKING;
+    if ("CHRG".equals(codeString))
+      return V3ActRelationshipType.CHRG;
+    if ("COST".equals(codeString))
+      return V3ActRelationshipType.COST;
+    if ("_ActRelationshipPosting".equals(codeString))
+      return V3ActRelationshipType._ACTRELATIONSHIPPOSTING;
+    if ("CREDIT".equals(codeString))
+      return V3ActRelationshipType.CREDIT;
+    if ("DEBIT".equals(codeString))
+      return V3ActRelationshipType.DEBIT;
+    if ("_ActRelationshipConditional".equals(codeString))
+      return V3ActRelationshipType._ACTRELATIONSHIPCONDITIONAL;
+    if ("CIND".equals(codeString))
+      return V3ActRelationshipType.CIND;
+    if ("PRCN".equals(codeString))
+      return V3ActRelationshipType.PRCN;
+    if ("RSON".equals(codeString))
+      return V3ActRelationshipType.RSON;
+    if ("BLOCK".equals(codeString))
+      return V3ActRelationshipType.BLOCK;
+    if ("DIAG".equals(codeString))
+      return V3ActRelationshipType.DIAG;
+    if ("IMM".equals(codeString))
+      return V3ActRelationshipType.IMM;
+    if ("ACTIMM".equals(codeString))
+      return V3ActRelationshipType.ACTIMM;
+    if ("PASSIMM".equals(codeString))
+      return V3ActRelationshipType.PASSIMM;
+    if ("MITGT".equals(codeString))
+      return V3ActRelationshipType.MITGT;
+    if ("RCVY".equals(codeString))
+      return V3ActRelationshipType.RCVY;
+    if ("PRYLX".equals(codeString))
+      return V3ActRelationshipType.PRYLX;
+    if ("TREAT".equals(codeString))
+      return V3ActRelationshipType.TREAT;
+    if ("ADJUNCT".equals(codeString))
+      return V3ActRelationshipType.ADJUNCT;
+    if ("MTREAT".equals(codeString))
+      return V3ActRelationshipType.MTREAT;
+    if ("PALLTREAT".equals(codeString))
+      return V3ActRelationshipType.PALLTREAT;
+    if ("SYMP".equals(codeString))
+      return V3ActRelationshipType.SYMP;
+    if ("TRIG".equals(codeString))
+      return V3ActRelationshipType.TRIG;
+    if ("_ActRelationshipTemporallyPertains".equals(codeString))
+      return V3ActRelationshipType._ACTRELATIONSHIPTEMPORALLYPERTAINS;
+    if ("_ActRelationshipTemporallyPertainsApproximates".equals(codeString))
+      return V3ActRelationshipType._ACTRELATIONSHIPTEMPORALLYPERTAINSAPPROXIMATES;
+    if ("ENE".equals(codeString))
+      return V3ActRelationshipType.ENE;
+    if ("ECW".equals(codeString))
+      return V3ActRelationshipType.ECW;
+    if ("CONCURRENT".equals(codeString))
+      return V3ActRelationshipType.CONCURRENT;
+    if ("SBSECWE".equals(codeString))
+      return V3ActRelationshipType.SBSECWE;
+    if ("ENS".equals(codeString))
+      return V3ActRelationshipType.ENS;
+    if ("ECWS".equals(codeString))
+      return V3ActRelationshipType.ECWS;
+    if ("SNE".equals(codeString))
+      return V3ActRelationshipType.SNE;
+    if ("SCWE".equals(codeString))
+      return V3ActRelationshipType.SCWE;
+    if ("SNS".equals(codeString))
+      return V3ActRelationshipType.SNS;
+    if ("SCW".equals(codeString))
+      return V3ActRelationshipType.SCW;
+    if ("SCWSEBE".equals(codeString))
+      return V3ActRelationshipType.SCWSEBE;
+    if ("SCWSEAE".equals(codeString))
+      return V3ActRelationshipType.SCWSEAE;
+    if ("EAS".equals(codeString))
+      return V3ActRelationshipType.EAS;
+    if ("EAE".equals(codeString))
+      return V3ActRelationshipType.EAE;
+    if ("SASEAE".equals(codeString))
+      return V3ActRelationshipType.SASEAE;
+    if ("SBEEAE".equals(codeString))
+      return V3ActRelationshipType.SBEEAE;
+    if ("SASSBEEAS".equals(codeString))
+      return V3ActRelationshipType.SASSBEEAS;
+    if ("SBSEAE".equals(codeString))
+      return V3ActRelationshipType.SBSEAE;
+    if ("SAS".equals(codeString))
+      return V3ActRelationshipType.SAS;
+    if ("SAE".equals(codeString))
+      return V3ActRelationshipType.SAE;
+    if ("DURING".equals(codeString))
+      return V3ActRelationshipType.DURING;
+    if ("SASECWE".equals(codeString))
+      return V3ActRelationshipType.SASECWE;
+    if ("EASORECWS".equals(codeString))
+      return V3ActRelationshipType.EASORECWS;
+    if ("EAEORECW".equals(codeString))
+      return V3ActRelationshipType.EAEORECW;
+    if ("INDEPENDENT".equals(codeString))
+      return V3ActRelationshipType.INDEPENDENT;
+    if ("SAEORSCWE".equals(codeString))
+      return V3ActRelationshipType.SAEORSCWE;
+    if ("SASORSCW".equals(codeString))
+      return V3ActRelationshipType.SASORSCW;
+    if ("SBEORSCWE".equals(codeString))
+      return V3ActRelationshipType.SBEORSCWE;
+    if ("OVERLAP".equals(codeString))
+      return V3ActRelationshipType.OVERLAP;
+    if ("EDU".equals(codeString))
+      return V3ActRelationshipType.EDU;
+    if ("SBSEASEBE".equals(codeString))
+      return V3ActRelationshipType.SBSEASEBE;
+    if ("SBSEAS".equals(codeString))
+      return V3ActRelationshipType.SBSEAS;
+    if ("SDU".equals(codeString))
+      return V3ActRelationshipType.SDU;
+    if ("SBE".equals(codeString))
+      return V3ActRelationshipType.SBE;
+    if ("EBE".equals(codeString))
+      return V3ActRelationshipType.EBE;
+    if ("SBSEBE".equals(codeString))
+      return V3ActRelationshipType.SBSEBE;
+    if ("EBSORECWS".equals(codeString))
+      return V3ActRelationshipType.EBSORECWS;
+    if ("EBS".equals(codeString))
+      return V3ActRelationshipType.EBS;
+    if ("EBEORECW".equals(codeString))
+      return V3ActRelationshipType.EBEORECW;
+    if ("SBSORSCW".equals(codeString))
+      return V3ActRelationshipType.SBSORSCW;
+    if ("SBS".equals(codeString))
+      return V3ActRelationshipType.SBS;
+    if ("AUTH".equals(codeString))
+      return V3ActRelationshipType.AUTH;
+    if ("CAUS".equals(codeString))
+      return V3ActRelationshipType.CAUS;
+    if ("COMP".equals(codeString))
+      return V3ActRelationshipType.COMP;
+    if ("CTRLV".equals(codeString))
+      return V3ActRelationshipType.CTRLV;
+    if ("MBR".equals(codeString))
+      return V3ActRelationshipType.MBR;
+    if ("STEP".equals(codeString))
+      return V3ActRelationshipType.STEP;
+    if ("ARR".equals(codeString))
+      return V3ActRelationshipType.ARR;
+    if ("DEP".equals(codeString))
+      return V3ActRelationshipType.DEP;
+    if ("PART".equals(codeString))
+      return V3ActRelationshipType.PART;
+    if ("COVBY".equals(codeString))
+      return V3ActRelationshipType.COVBY;
+    if ("DRIV".equals(codeString))
+      return V3ActRelationshipType.DRIV;
+    if ("ELNK".equals(codeString))
+      return V3ActRelationshipType.ELNK;
+    if ("EVID".equals(codeString))
+      return V3ActRelationshipType.EVID;
+    if ("EXACBY".equals(codeString))
+      return V3ActRelationshipType.EXACBY;
+    if ("EXPL".equals(codeString))
+      return V3ActRelationshipType.EXPL;
+    if ("INTF".equals(codeString))
+      return V3ActRelationshipType.INTF;
+    if ("ITEMSLOC".equals(codeString))
+      return V3ActRelationshipType.ITEMSLOC;
+    if ("LIMIT".equals(codeString))
+      return V3ActRelationshipType.LIMIT;
+    if ("META".equals(codeString))
+      return V3ActRelationshipType.META;
+    if ("MFST".equals(codeString))
+      return V3ActRelationshipType.MFST;
+    if ("NAME".equals(codeString))
+      return V3ActRelationshipType.NAME;
+    if ("OUTC".equals(codeString))
+      return V3ActRelationshipType.OUTC;
+    if ("_ActRelationsipObjective".equals(codeString))
+      return V3ActRelationshipType._ACTRELATIONSIPOBJECTIVE;
+    if ("OBJC".equals(codeString))
+      return V3ActRelationshipType.OBJC;
+    if ("OBJF".equals(codeString))
+      return V3ActRelationshipType.OBJF;
+    if ("GOAL".equals(codeString))
+      return V3ActRelationshipType.GOAL;
+    if ("RISK".equals(codeString))
+      return V3ActRelationshipType.RISK;
+    if ("PERT".equals(codeString))
+      return V3ActRelationshipType.PERT;
+    if ("PREV".equals(codeString))
+      return V3ActRelationshipType.PREV;
+    if ("REFR".equals(codeString))
+      return V3ActRelationshipType.REFR;
+    if ("USE".equals(codeString))
+      return V3ActRelationshipType.USE;
+    if ("REFV".equals(codeString))
+      return V3ActRelationshipType.REFV;
+    if ("RELVBY".equals(codeString))
+      return V3ActRelationshipType.RELVBY;
+    if ("SEQL".equals(codeString))
+      return V3ActRelationshipType.SEQL;
+    if ("APND".equals(codeString))
+      return V3ActRelationshipType.APND;
+    if ("BSLN".equals(codeString))
+      return V3ActRelationshipType.BSLN;
+    if ("COMPLY".equals(codeString))
+      return V3ActRelationshipType.COMPLY;
+    if ("DOC".equals(codeString))
+      return V3ActRelationshipType.DOC;
+    if ("FLFS".equals(codeString))
+      return V3ActRelationshipType.FLFS;
+    if ("OCCR".equals(codeString))
+      return V3ActRelationshipType.OCCR;
+    if ("OREF".equals(codeString))
+      return V3ActRelationshipType.OREF;
+    if ("SCH".equals(codeString))
+      return V3ActRelationshipType.SCH;
+    if ("GEN".equals(codeString))
+      return V3ActRelationshipType.GEN;
+    if ("GEVL".equals(codeString))
+      return V3ActRelationshipType.GEVL;
+    if ("INST".equals(codeString))
+      return V3ActRelationshipType.INST;
+    if ("MOD".equals(codeString))
+      return V3ActRelationshipType.MOD;
+    if ("MTCH".equals(codeString))
+      return V3ActRelationshipType.MTCH;
+    if ("OPTN".equals(codeString))
+      return V3ActRelationshipType.OPTN;
+    if ("RCHAL".equals(codeString))
+      return V3ActRelationshipType.RCHAL;
+    if ("REV".equals(codeString))
+      return V3ActRelationshipType.REV;
+    if ("RPLC".equals(codeString))
+      return V3ActRelationshipType.RPLC;
+    if ("SUCC".equals(codeString))
+      return V3ActRelationshipType.SUCC;
+    if ("UPDT".equals(codeString))
+      return V3ActRelationshipType.UPDT;
+    if ("XCRPT".equals(codeString))
+      return V3ActRelationshipType.XCRPT;
+    if ("VRXCRPT".equals(codeString))
+      return V3ActRelationshipType.VRXCRPT;
+    if ("XFRM".equals(codeString))
+      return V3ActRelationshipType.XFRM;
+    if ("SPRT".equals(codeString))
+      return V3ActRelationshipType.SPRT;
+    if ("SPRTBND".equals(codeString))
+      return V3ActRelationshipType.SPRTBND;
+    if ("SUBJ".equals(codeString))
+      return V3ActRelationshipType.SUBJ;
+    if ("QUALF".equals(codeString))
+      return V3ActRelationshipType.QUALF;
+    if ("SUMM".equals(codeString))
+      return V3ActRelationshipType.SUMM;
+    if ("VALUE".equals(codeString))
+      return V3ActRelationshipType.VALUE;
+    if ("CURE".equals(codeString))
+      return V3ActRelationshipType.CURE;
+    if ("CURE.ADJ".equals(codeString))
+      return V3ActRelationshipType.CURE_ADJ;
+    if ("MTGT.ADJ".equals(codeString))
+      return V3ActRelationshipType.MTGT_ADJ;
+    if ("RACT".equals(codeString))
+      return V3ActRelationshipType.RACT;
+    if ("SUGG".equals(codeString))
+      return V3ActRelationshipType.SUGG;
+    throw new IllegalArgumentException("Unknown V3ActRelationshipType code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActRelationshipType code) {
+    if (code == V3ActRelationshipType.ART)
+      return "ART";
+    if (code == V3ActRelationshipType._ACTCLASSTEMPORALLYPERTAINS)
+      return "_ActClassTemporallyPertains";
+    if (code == V3ActRelationshipType._ACTRELATIONSHIPACCOUNTING)
+      return "_ActRelationshipAccounting";
+    if (code == V3ActRelationshipType._ACTRELATIONSHIPCOSTTRACKING)
+      return "_ActRelationshipCostTracking";
+    if (code == V3ActRelationshipType.CHRG)
+      return "CHRG";
+    if (code == V3ActRelationshipType.COST)
+      return "COST";
+    if (code == V3ActRelationshipType._ACTRELATIONSHIPPOSTING)
+      return "_ActRelationshipPosting";
+    if (code == V3ActRelationshipType.CREDIT)
+      return "CREDIT";
+    if (code == V3ActRelationshipType.DEBIT)
+      return "DEBIT";
+    if (code == V3ActRelationshipType._ACTRELATIONSHIPCONDITIONAL)
+      return "_ActRelationshipConditional";
+    if (code == V3ActRelationshipType.CIND)
+      return "CIND";
+    if (code == V3ActRelationshipType.PRCN)
+      return "PRCN";
+    if (code == V3ActRelationshipType.RSON)
+      return "RSON";
+    if (code == V3ActRelationshipType.BLOCK)
+      return "BLOCK";
+    if (code == V3ActRelationshipType.DIAG)
+      return "DIAG";
+    if (code == V3ActRelationshipType.IMM)
+      return "IMM";
+    if (code == V3ActRelationshipType.ACTIMM)
+      return "ACTIMM";
+    if (code == V3ActRelationshipType.PASSIMM)
+      return "PASSIMM";
+    if (code == V3ActRelationshipType.MITGT)
+      return "MITGT";
+    if (code == V3ActRelationshipType.RCVY)
+      return "RCVY";
+    if (code == V3ActRelationshipType.PRYLX)
+      return "PRYLX";
+    if (code == V3ActRelationshipType.TREAT)
+      return "TREAT";
+    if (code == V3ActRelationshipType.ADJUNCT)
+      return "ADJUNCT";
+    if (code == V3ActRelationshipType.MTREAT)
+      return "MTREAT";
+    if (code == V3ActRelationshipType.PALLTREAT)
+      return "PALLTREAT";
+    if (code == V3ActRelationshipType.SYMP)
+      return "SYMP";
+    if (code == V3ActRelationshipType.TRIG)
+      return "TRIG";
+    if (code == V3ActRelationshipType._ACTRELATIONSHIPTEMPORALLYPERTAINS)
+      return "_ActRelationshipTemporallyPertains";
+    if (code == V3ActRelationshipType._ACTRELATIONSHIPTEMPORALLYPERTAINSAPPROXIMATES)
+      return "_ActRelationshipTemporallyPertainsApproximates";
+    if (code == V3ActRelationshipType.ENE)
+      return "ENE";
+    if (code == V3ActRelationshipType.ECW)
+      return "ECW";
+    if (code == V3ActRelationshipType.CONCURRENT)
+      return "CONCURRENT";
+    if (code == V3ActRelationshipType.SBSECWE)
+      return "SBSECWE";
+    if (code == V3ActRelationshipType.ENS)
+      return "ENS";
+    if (code == V3ActRelationshipType.ECWS)
+      return "ECWS";
+    if (code == V3ActRelationshipType.SNE)
+      return "SNE";
+    if (code == V3ActRelationshipType.SCWE)
+      return "SCWE";
+    if (code == V3ActRelationshipType.SNS)
+      return "SNS";
+    if (code == V3ActRelationshipType.SCW)
+      return "SCW";
+    if (code == V3ActRelationshipType.SCWSEBE)
+      return "SCWSEBE";
+    if (code == V3ActRelationshipType.SCWSEAE)
+      return "SCWSEAE";
+    if (code == V3ActRelationshipType.EAS)
+      return "EAS";
+    if (code == V3ActRelationshipType.EAE)
+      return "EAE";
+    if (code == V3ActRelationshipType.SASEAE)
+      return "SASEAE";
+    if (code == V3ActRelationshipType.SBEEAE)
+      return "SBEEAE";
+    if (code == V3ActRelationshipType.SASSBEEAS)
+      return "SASSBEEAS";
+    if (code == V3ActRelationshipType.SBSEAE)
+      return "SBSEAE";
+    if (code == V3ActRelationshipType.SAS)
+      return "SAS";
+    if (code == V3ActRelationshipType.SAE)
+      return "SAE";
+    if (code == V3ActRelationshipType.DURING)
+      return "DURING";
+    if (code == V3ActRelationshipType.SASECWE)
+      return "SASECWE";
+    if (code == V3ActRelationshipType.EASORECWS)
+      return "EASORECWS";
+    if (code == V3ActRelationshipType.EAEORECW)
+      return "EAEORECW";
+    if (code == V3ActRelationshipType.INDEPENDENT)
+      return "INDEPENDENT";
+    if (code == V3ActRelationshipType.SAEORSCWE)
+      return "SAEORSCWE";
+    if (code == V3ActRelationshipType.SASORSCW)
+      return "SASORSCW";
+    if (code == V3ActRelationshipType.SBEORSCWE)
+      return "SBEORSCWE";
+    if (code == V3ActRelationshipType.OVERLAP)
+      return "OVERLAP";
+    if (code == V3ActRelationshipType.EDU)
+      return "EDU";
+    if (code == V3ActRelationshipType.SBSEASEBE)
+      return "SBSEASEBE";
+    if (code == V3ActRelationshipType.SBSEAS)
+      return "SBSEAS";
+    if (code == V3ActRelationshipType.SDU)
+      return "SDU";
+    if (code == V3ActRelationshipType.SBE)
+      return "SBE";
+    if (code == V3ActRelationshipType.EBE)
+      return "EBE";
+    if (code == V3ActRelationshipType.SBSEBE)
+      return "SBSEBE";
+    if (code == V3ActRelationshipType.EBSORECWS)
+      return "EBSORECWS";
+    if (code == V3ActRelationshipType.EBS)
+      return "EBS";
+    if (code == V3ActRelationshipType.EBEORECW)
+      return "EBEORECW";
+    if (code == V3ActRelationshipType.SBSORSCW)
+      return "SBSORSCW";
+    if (code == V3ActRelationshipType.SBS)
+      return "SBS";
+    if (code == V3ActRelationshipType.AUTH)
+      return "AUTH";
+    if (code == V3ActRelationshipType.CAUS)
+      return "CAUS";
+    if (code == V3ActRelationshipType.COMP)
+      return "COMP";
+    if (code == V3ActRelationshipType.CTRLV)
+      return "CTRLV";
+    if (code == V3ActRelationshipType.MBR)
+      return "MBR";
+    if (code == V3ActRelationshipType.STEP)
+      return "STEP";
+    if (code == V3ActRelationshipType.ARR)
+      return "ARR";
+    if (code == V3ActRelationshipType.DEP)
+      return "DEP";
+    if (code == V3ActRelationshipType.PART)
+      return "PART";
+    if (code == V3ActRelationshipType.COVBY)
+      return "COVBY";
+    if (code == V3ActRelationshipType.DRIV)
+      return "DRIV";
+    if (code == V3ActRelationshipType.ELNK)
+      return "ELNK";
+    if (code == V3ActRelationshipType.EVID)
+      return "EVID";
+    if (code == V3ActRelationshipType.EXACBY)
+      return "EXACBY";
+    if (code == V3ActRelationshipType.EXPL)
+      return "EXPL";
+    if (code == V3ActRelationshipType.INTF)
+      return "INTF";
+    if (code == V3ActRelationshipType.ITEMSLOC)
+      return "ITEMSLOC";
+    if (code == V3ActRelationshipType.LIMIT)
+      return "LIMIT";
+    if (code == V3ActRelationshipType.META)
+      return "META";
+    if (code == V3ActRelationshipType.MFST)
+      return "MFST";
+    if (code == V3ActRelationshipType.NAME)
+      return "NAME";
+    if (code == V3ActRelationshipType.OUTC)
+      return "OUTC";
+    if (code == V3ActRelationshipType._ACTRELATIONSIPOBJECTIVE)
+      return "_ActRelationsipObjective";
+    if (code == V3ActRelationshipType.OBJC)
+      return "OBJC";
+    if (code == V3ActRelationshipType.OBJF)
+      return "OBJF";
+    if (code == V3ActRelationshipType.GOAL)
+      return "GOAL";
+    if (code == V3ActRelationshipType.RISK)
+      return "RISK";
+    if (code == V3ActRelationshipType.PERT)
+      return "PERT";
+    if (code == V3ActRelationshipType.PREV)
+      return "PREV";
+    if (code == V3ActRelationshipType.REFR)
+      return "REFR";
+    if (code == V3ActRelationshipType.USE)
+      return "USE";
+    if (code == V3ActRelationshipType.REFV)
+      return "REFV";
+    if (code == V3ActRelationshipType.RELVBY)
+      return "RELVBY";
+    if (code == V3ActRelationshipType.SEQL)
+      return "SEQL";
+    if (code == V3ActRelationshipType.APND)
+      return "APND";
+    if (code == V3ActRelationshipType.BSLN)
+      return "BSLN";
+    if (code == V3ActRelationshipType.COMPLY)
+      return "COMPLY";
+    if (code == V3ActRelationshipType.DOC)
+      return "DOC";
+    if (code == V3ActRelationshipType.FLFS)
+      return "FLFS";
+    if (code == V3ActRelationshipType.OCCR)
+      return "OCCR";
+    if (code == V3ActRelationshipType.OREF)
+      return "OREF";
+    if (code == V3ActRelationshipType.SCH)
+      return "SCH";
+    if (code == V3ActRelationshipType.GEN)
+      return "GEN";
+    if (code == V3ActRelationshipType.GEVL)
+      return "GEVL";
+    if (code == V3ActRelationshipType.INST)
+      return "INST";
+    if (code == V3ActRelationshipType.MOD)
+      return "MOD";
+    if (code == V3ActRelationshipType.MTCH)
+      return "MTCH";
+    if (code == V3ActRelationshipType.OPTN)
+      return "OPTN";
+    if (code == V3ActRelationshipType.RCHAL)
+      return "RCHAL";
+    if (code == V3ActRelationshipType.REV)
+      return "REV";
+    if (code == V3ActRelationshipType.RPLC)
+      return "RPLC";
+    if (code == V3ActRelationshipType.SUCC)
+      return "SUCC";
+    if (code == V3ActRelationshipType.UPDT)
+      return "UPDT";
+    if (code == V3ActRelationshipType.XCRPT)
+      return "XCRPT";
+    if (code == V3ActRelationshipType.VRXCRPT)
+      return "VRXCRPT";
+    if (code == V3ActRelationshipType.XFRM)
+      return "XFRM";
+    if (code == V3ActRelationshipType.SPRT)
+      return "SPRT";
+    if (code == V3ActRelationshipType.SPRTBND)
+      return "SPRTBND";
+    if (code == V3ActRelationshipType.SUBJ)
+      return "SUBJ";
+    if (code == V3ActRelationshipType.QUALF)
+      return "QUALF";
+    if (code == V3ActRelationshipType.SUMM)
+      return "SUMM";
+    if (code == V3ActRelationshipType.VALUE)
+      return "VALUE";
+    if (code == V3ActRelationshipType.CURE)
+      return "CURE";
+    if (code == V3ActRelationshipType.CURE_ADJ)
+      return "CURE.ADJ";
+    if (code == V3ActRelationshipType.MTGT_ADJ)
+      return "MTGT.ADJ";
+    if (code == V3ActRelationshipType.RACT)
+      return "RACT";
+    if (code == V3ActRelationshipType.SUGG)
+      return "SUGG";
+    return "?";
+  }
+
+    public String toSystem(V3ActRelationshipType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActSite.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActSite.java
new file mode 100644
index 00000000000..74a063cb929
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActSite.java
@@ -0,0 +1,555 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActSite {
+
+        /**
+         * An anatomical location on a human which can be the focus of an act.
+         */
+        _HUMANACTSITE, 
+        /**
+         * The set of body locations to or through which a drug product may be administered.
+         */
+        _HUMANSUBSTANCEADMINISTRATIONSITE, 
+        /**
+         * bilateral ears
+         */
+        BE, 
+        /**
+         * bilateral nares
+         */
+        BN, 
+        /**
+         * buttock
+         */
+        BU, 
+        /**
+         * left arm
+         */
+        LA, 
+        /**
+         * left anterior chest
+         */
+        LAC, 
+        /**
+         * left antecubital fossa
+         */
+        LACF, 
+        /**
+         * left deltoid
+         */
+        LD, 
+        /**
+         * left ear
+         */
+        LE, 
+        /**
+         * left external jugular
+         */
+        LEJ, 
+        /**
+         * left foot
+         */
+        LF, 
+        /**
+         * left gluteus medius
+         */
+        LG, 
+        /**
+         * left hand
+         */
+        LH, 
+        /**
+         * left internal jugular
+         */
+        LIJ, 
+        /**
+         * left lower abd quadrant
+         */
+        LLAQ, 
+        /**
+         * left lower forearm
+         */
+        LLFA, 
+        /**
+         * left mid forearm
+         */
+        LMFA, 
+        /**
+         * left naris
+         */
+        LN, 
+        /**
+         * left posterior chest
+         */
+        LPC, 
+        /**
+         * left subclavian
+         */
+        LSC, 
+        /**
+         * left thigh
+         */
+        LT, 
+        /**
+         * left upper arm
+         */
+        LUA, 
+        /**
+         * left upper abd quadrant
+         */
+        LUAQ, 
+        /**
+         * left upper forearm
+         */
+        LUFA, 
+        /**
+         * left ventragluteal
+         */
+        LVG, 
+        /**
+         * left vastus lateralis
+         */
+        LVL, 
+        /**
+         * right eye
+         */
+        OD, 
+        /**
+         * left eye
+         */
+        OS, 
+        /**
+         * bilateral eyes
+         */
+        OU, 
+        /**
+         * perianal
+         */
+        PA, 
+        /**
+         * perineal
+         */
+        PERIN, 
+        /**
+         * right arm
+         */
+        RA, 
+        /**
+         * right anterior chest
+         */
+        RAC, 
+        /**
+         * right antecubital fossa
+         */
+        RACF, 
+        /**
+         * right deltoid
+         */
+        RD, 
+        /**
+         * right ear
+         */
+        RE, 
+        /**
+         * right external jugular
+         */
+        REJ, 
+        /**
+         * right foot
+         */
+        RF, 
+        /**
+         * right gluteus medius
+         */
+        RG, 
+        /**
+         * right hand
+         */
+        RH, 
+        /**
+         * right internal jugular
+         */
+        RIJ, 
+        /**
+         * right lower abd quadrant
+         */
+        RLAQ, 
+        /**
+         * right lower forearm
+         */
+        RLFA, 
+        /**
+         * right mid forearm
+         */
+        RMFA, 
+        /**
+         * right naris
+         */
+        RN, 
+        /**
+         * right posterior chest
+         */
+        RPC, 
+        /**
+         * right subclavian
+         */
+        RSC, 
+        /**
+         * right thigh
+         */
+        RT, 
+        /**
+         * right upper arm
+         */
+        RUA, 
+        /**
+         * right upper abd quadrant
+         */
+        RUAQ, 
+        /**
+         * right upper forearm
+         */
+        RUFA, 
+        /**
+         * right ventragluteal
+         */
+        RVG, 
+        /**
+         * right vastus lateralis
+         */
+        RVL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActSite fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_HumanActSite".equals(codeString))
+          return _HUMANACTSITE;
+        if ("_HumanSubstanceAdministrationSite".equals(codeString))
+          return _HUMANSUBSTANCEADMINISTRATIONSITE;
+        if ("BE".equals(codeString))
+          return BE;
+        if ("BN".equals(codeString))
+          return BN;
+        if ("BU".equals(codeString))
+          return BU;
+        if ("LA".equals(codeString))
+          return LA;
+        if ("LAC".equals(codeString))
+          return LAC;
+        if ("LACF".equals(codeString))
+          return LACF;
+        if ("LD".equals(codeString))
+          return LD;
+        if ("LE".equals(codeString))
+          return LE;
+        if ("LEJ".equals(codeString))
+          return LEJ;
+        if ("LF".equals(codeString))
+          return LF;
+        if ("LG".equals(codeString))
+          return LG;
+        if ("LH".equals(codeString))
+          return LH;
+        if ("LIJ".equals(codeString))
+          return LIJ;
+        if ("LLAQ".equals(codeString))
+          return LLAQ;
+        if ("LLFA".equals(codeString))
+          return LLFA;
+        if ("LMFA".equals(codeString))
+          return LMFA;
+        if ("LN".equals(codeString))
+          return LN;
+        if ("LPC".equals(codeString))
+          return LPC;
+        if ("LSC".equals(codeString))
+          return LSC;
+        if ("LT".equals(codeString))
+          return LT;
+        if ("LUA".equals(codeString))
+          return LUA;
+        if ("LUAQ".equals(codeString))
+          return LUAQ;
+        if ("LUFA".equals(codeString))
+          return LUFA;
+        if ("LVG".equals(codeString))
+          return LVG;
+        if ("LVL".equals(codeString))
+          return LVL;
+        if ("OD".equals(codeString))
+          return OD;
+        if ("OS".equals(codeString))
+          return OS;
+        if ("OU".equals(codeString))
+          return OU;
+        if ("PA".equals(codeString))
+          return PA;
+        if ("PERIN".equals(codeString))
+          return PERIN;
+        if ("RA".equals(codeString))
+          return RA;
+        if ("RAC".equals(codeString))
+          return RAC;
+        if ("RACF".equals(codeString))
+          return RACF;
+        if ("RD".equals(codeString))
+          return RD;
+        if ("RE".equals(codeString))
+          return RE;
+        if ("REJ".equals(codeString))
+          return REJ;
+        if ("RF".equals(codeString))
+          return RF;
+        if ("RG".equals(codeString))
+          return RG;
+        if ("RH".equals(codeString))
+          return RH;
+        if ("RIJ".equals(codeString))
+          return RIJ;
+        if ("RLAQ".equals(codeString))
+          return RLAQ;
+        if ("RLFA".equals(codeString))
+          return RLFA;
+        if ("RMFA".equals(codeString))
+          return RMFA;
+        if ("RN".equals(codeString))
+          return RN;
+        if ("RPC".equals(codeString))
+          return RPC;
+        if ("RSC".equals(codeString))
+          return RSC;
+        if ("RT".equals(codeString))
+          return RT;
+        if ("RUA".equals(codeString))
+          return RUA;
+        if ("RUAQ".equals(codeString))
+          return RUAQ;
+        if ("RUFA".equals(codeString))
+          return RUFA;
+        if ("RVG".equals(codeString))
+          return RVG;
+        if ("RVL".equals(codeString))
+          return RVL;
+        throw new FHIRException("Unknown V3ActSite code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _HUMANACTSITE: return "_HumanActSite";
+            case _HUMANSUBSTANCEADMINISTRATIONSITE: return "_HumanSubstanceAdministrationSite";
+            case BE: return "BE";
+            case BN: return "BN";
+            case BU: return "BU";
+            case LA: return "LA";
+            case LAC: return "LAC";
+            case LACF: return "LACF";
+            case LD: return "LD";
+            case LE: return "LE";
+            case LEJ: return "LEJ";
+            case LF: return "LF";
+            case LG: return "LG";
+            case LH: return "LH";
+            case LIJ: return "LIJ";
+            case LLAQ: return "LLAQ";
+            case LLFA: return "LLFA";
+            case LMFA: return "LMFA";
+            case LN: return "LN";
+            case LPC: return "LPC";
+            case LSC: return "LSC";
+            case LT: return "LT";
+            case LUA: return "LUA";
+            case LUAQ: return "LUAQ";
+            case LUFA: return "LUFA";
+            case LVG: return "LVG";
+            case LVL: return "LVL";
+            case OD: return "OD";
+            case OS: return "OS";
+            case OU: return "OU";
+            case PA: return "PA";
+            case PERIN: return "PERIN";
+            case RA: return "RA";
+            case RAC: return "RAC";
+            case RACF: return "RACF";
+            case RD: return "RD";
+            case RE: return "RE";
+            case REJ: return "REJ";
+            case RF: return "RF";
+            case RG: return "RG";
+            case RH: return "RH";
+            case RIJ: return "RIJ";
+            case RLAQ: return "RLAQ";
+            case RLFA: return "RLFA";
+            case RMFA: return "RMFA";
+            case RN: return "RN";
+            case RPC: return "RPC";
+            case RSC: return "RSC";
+            case RT: return "RT";
+            case RUA: return "RUA";
+            case RUAQ: return "RUAQ";
+            case RUFA: return "RUFA";
+            case RVG: return "RVG";
+            case RVL: return "RVL";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActSite";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _HUMANACTSITE: return "An anatomical location on a human which can be the focus of an act.";
+            case _HUMANSUBSTANCEADMINISTRATIONSITE: return "The set of body locations to or through which a drug product may be administered.";
+            case BE: return "bilateral ears";
+            case BN: return "bilateral nares";
+            case BU: return "buttock";
+            case LA: return "left arm";
+            case LAC: return "left anterior chest";
+            case LACF: return "left antecubital fossa";
+            case LD: return "left deltoid";
+            case LE: return "left ear";
+            case LEJ: return "left external jugular";
+            case LF: return "left foot";
+            case LG: return "left gluteus medius";
+            case LH: return "left hand";
+            case LIJ: return "left internal jugular";
+            case LLAQ: return "left lower abd quadrant";
+            case LLFA: return "left lower forearm";
+            case LMFA: return "left mid forearm";
+            case LN: return "left naris";
+            case LPC: return "left posterior chest";
+            case LSC: return "left subclavian";
+            case LT: return "left thigh";
+            case LUA: return "left upper arm";
+            case LUAQ: return "left upper abd quadrant";
+            case LUFA: return "left upper forearm";
+            case LVG: return "left ventragluteal";
+            case LVL: return "left vastus lateralis";
+            case OD: return "right eye";
+            case OS: return "left eye";
+            case OU: return "bilateral eyes";
+            case PA: return "perianal";
+            case PERIN: return "perineal";
+            case RA: return "right arm";
+            case RAC: return "right anterior chest";
+            case RACF: return "right antecubital fossa";
+            case RD: return "right deltoid";
+            case RE: return "right ear";
+            case REJ: return "right external jugular";
+            case RF: return "right foot";
+            case RG: return "right gluteus medius";
+            case RH: return "right hand";
+            case RIJ: return "right internal jugular";
+            case RLAQ: return "right lower abd quadrant";
+            case RLFA: return "right lower forearm";
+            case RMFA: return "right mid forearm";
+            case RN: return "right naris";
+            case RPC: return "right posterior chest";
+            case RSC: return "right subclavian";
+            case RT: return "right thigh";
+            case RUA: return "right upper arm";
+            case RUAQ: return "right upper abd quadrant";
+            case RUFA: return "right upper forearm";
+            case RVG: return "right ventragluteal";
+            case RVL: return "right vastus lateralis";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _HUMANACTSITE: return "HumanActSite";
+            case _HUMANSUBSTANCEADMINISTRATIONSITE: return "HumanSubstanceAdministrationSite";
+            case BE: return "bilateral ears";
+            case BN: return "bilateral nares";
+            case BU: return "buttock";
+            case LA: return "left arm";
+            case LAC: return "left anterior chest";
+            case LACF: return "left antecubital fossa";
+            case LD: return "left deltoid";
+            case LE: return "left ear";
+            case LEJ: return "left external jugular";
+            case LF: return "left foot";
+            case LG: return "left gluteus medius";
+            case LH: return "left hand";
+            case LIJ: return "left internal jugular";
+            case LLAQ: return "left lower abd quadrant";
+            case LLFA: return "left lower forearm";
+            case LMFA: return "left mid forearm";
+            case LN: return "left naris";
+            case LPC: return "left posterior chest";
+            case LSC: return "left subclavian";
+            case LT: return "left thigh";
+            case LUA: return "left upper arm";
+            case LUAQ: return "left upper abd quadrant";
+            case LUFA: return "left upper forearm";
+            case LVG: return "left ventragluteal";
+            case LVL: return "left vastus lateralis";
+            case OD: return "right eye";
+            case OS: return "left eye";
+            case OU: return "bilateral eyes";
+            case PA: return "perianal";
+            case PERIN: return "perineal";
+            case RA: return "right arm";
+            case RAC: return "right anterior chest";
+            case RACF: return "right antecubital fossa";
+            case RD: return "right deltoid";
+            case RE: return "right ear";
+            case REJ: return "right external jugular";
+            case RF: return "right foot";
+            case RG: return "right gluteus medius";
+            case RH: return "right hand";
+            case RIJ: return "right internal jugular";
+            case RLAQ: return "right lower abd quadrant";
+            case RLFA: return "right lower forearm";
+            case RMFA: return "right mid forearm";
+            case RN: return "right naris";
+            case RPC: return "right posterior chest";
+            case RSC: return "right subclavian";
+            case RT: return "right thigh";
+            case RUA: return "right upper arm";
+            case RUAQ: return "right upper abd quadrant";
+            case RUFA: return "right upper forearm";
+            case RVG: return "right ventragluteal";
+            case RVL: return "right vastus lateralis";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActSiteEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActSiteEnumFactory.java
new file mode 100644
index 00000000000..b5a4f70acad
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActSiteEnumFactory.java
@@ -0,0 +1,270 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActSiteEnumFactory implements EnumFactory {
+
+  public V3ActSite fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_HumanActSite".equals(codeString))
+      return V3ActSite._HUMANACTSITE;
+    if ("_HumanSubstanceAdministrationSite".equals(codeString))
+      return V3ActSite._HUMANSUBSTANCEADMINISTRATIONSITE;
+    if ("BE".equals(codeString))
+      return V3ActSite.BE;
+    if ("BN".equals(codeString))
+      return V3ActSite.BN;
+    if ("BU".equals(codeString))
+      return V3ActSite.BU;
+    if ("LA".equals(codeString))
+      return V3ActSite.LA;
+    if ("LAC".equals(codeString))
+      return V3ActSite.LAC;
+    if ("LACF".equals(codeString))
+      return V3ActSite.LACF;
+    if ("LD".equals(codeString))
+      return V3ActSite.LD;
+    if ("LE".equals(codeString))
+      return V3ActSite.LE;
+    if ("LEJ".equals(codeString))
+      return V3ActSite.LEJ;
+    if ("LF".equals(codeString))
+      return V3ActSite.LF;
+    if ("LG".equals(codeString))
+      return V3ActSite.LG;
+    if ("LH".equals(codeString))
+      return V3ActSite.LH;
+    if ("LIJ".equals(codeString))
+      return V3ActSite.LIJ;
+    if ("LLAQ".equals(codeString))
+      return V3ActSite.LLAQ;
+    if ("LLFA".equals(codeString))
+      return V3ActSite.LLFA;
+    if ("LMFA".equals(codeString))
+      return V3ActSite.LMFA;
+    if ("LN".equals(codeString))
+      return V3ActSite.LN;
+    if ("LPC".equals(codeString))
+      return V3ActSite.LPC;
+    if ("LSC".equals(codeString))
+      return V3ActSite.LSC;
+    if ("LT".equals(codeString))
+      return V3ActSite.LT;
+    if ("LUA".equals(codeString))
+      return V3ActSite.LUA;
+    if ("LUAQ".equals(codeString))
+      return V3ActSite.LUAQ;
+    if ("LUFA".equals(codeString))
+      return V3ActSite.LUFA;
+    if ("LVG".equals(codeString))
+      return V3ActSite.LVG;
+    if ("LVL".equals(codeString))
+      return V3ActSite.LVL;
+    if ("OD".equals(codeString))
+      return V3ActSite.OD;
+    if ("OS".equals(codeString))
+      return V3ActSite.OS;
+    if ("OU".equals(codeString))
+      return V3ActSite.OU;
+    if ("PA".equals(codeString))
+      return V3ActSite.PA;
+    if ("PERIN".equals(codeString))
+      return V3ActSite.PERIN;
+    if ("RA".equals(codeString))
+      return V3ActSite.RA;
+    if ("RAC".equals(codeString))
+      return V3ActSite.RAC;
+    if ("RACF".equals(codeString))
+      return V3ActSite.RACF;
+    if ("RD".equals(codeString))
+      return V3ActSite.RD;
+    if ("RE".equals(codeString))
+      return V3ActSite.RE;
+    if ("REJ".equals(codeString))
+      return V3ActSite.REJ;
+    if ("RF".equals(codeString))
+      return V3ActSite.RF;
+    if ("RG".equals(codeString))
+      return V3ActSite.RG;
+    if ("RH".equals(codeString))
+      return V3ActSite.RH;
+    if ("RIJ".equals(codeString))
+      return V3ActSite.RIJ;
+    if ("RLAQ".equals(codeString))
+      return V3ActSite.RLAQ;
+    if ("RLFA".equals(codeString))
+      return V3ActSite.RLFA;
+    if ("RMFA".equals(codeString))
+      return V3ActSite.RMFA;
+    if ("RN".equals(codeString))
+      return V3ActSite.RN;
+    if ("RPC".equals(codeString))
+      return V3ActSite.RPC;
+    if ("RSC".equals(codeString))
+      return V3ActSite.RSC;
+    if ("RT".equals(codeString))
+      return V3ActSite.RT;
+    if ("RUA".equals(codeString))
+      return V3ActSite.RUA;
+    if ("RUAQ".equals(codeString))
+      return V3ActSite.RUAQ;
+    if ("RUFA".equals(codeString))
+      return V3ActSite.RUFA;
+    if ("RVG".equals(codeString))
+      return V3ActSite.RVG;
+    if ("RVL".equals(codeString))
+      return V3ActSite.RVL;
+    throw new IllegalArgumentException("Unknown V3ActSite code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActSite code) {
+    if (code == V3ActSite._HUMANACTSITE)
+      return "_HumanActSite";
+    if (code == V3ActSite._HUMANSUBSTANCEADMINISTRATIONSITE)
+      return "_HumanSubstanceAdministrationSite";
+    if (code == V3ActSite.BE)
+      return "BE";
+    if (code == V3ActSite.BN)
+      return "BN";
+    if (code == V3ActSite.BU)
+      return "BU";
+    if (code == V3ActSite.LA)
+      return "LA";
+    if (code == V3ActSite.LAC)
+      return "LAC";
+    if (code == V3ActSite.LACF)
+      return "LACF";
+    if (code == V3ActSite.LD)
+      return "LD";
+    if (code == V3ActSite.LE)
+      return "LE";
+    if (code == V3ActSite.LEJ)
+      return "LEJ";
+    if (code == V3ActSite.LF)
+      return "LF";
+    if (code == V3ActSite.LG)
+      return "LG";
+    if (code == V3ActSite.LH)
+      return "LH";
+    if (code == V3ActSite.LIJ)
+      return "LIJ";
+    if (code == V3ActSite.LLAQ)
+      return "LLAQ";
+    if (code == V3ActSite.LLFA)
+      return "LLFA";
+    if (code == V3ActSite.LMFA)
+      return "LMFA";
+    if (code == V3ActSite.LN)
+      return "LN";
+    if (code == V3ActSite.LPC)
+      return "LPC";
+    if (code == V3ActSite.LSC)
+      return "LSC";
+    if (code == V3ActSite.LT)
+      return "LT";
+    if (code == V3ActSite.LUA)
+      return "LUA";
+    if (code == V3ActSite.LUAQ)
+      return "LUAQ";
+    if (code == V3ActSite.LUFA)
+      return "LUFA";
+    if (code == V3ActSite.LVG)
+      return "LVG";
+    if (code == V3ActSite.LVL)
+      return "LVL";
+    if (code == V3ActSite.OD)
+      return "OD";
+    if (code == V3ActSite.OS)
+      return "OS";
+    if (code == V3ActSite.OU)
+      return "OU";
+    if (code == V3ActSite.PA)
+      return "PA";
+    if (code == V3ActSite.PERIN)
+      return "PERIN";
+    if (code == V3ActSite.RA)
+      return "RA";
+    if (code == V3ActSite.RAC)
+      return "RAC";
+    if (code == V3ActSite.RACF)
+      return "RACF";
+    if (code == V3ActSite.RD)
+      return "RD";
+    if (code == V3ActSite.RE)
+      return "RE";
+    if (code == V3ActSite.REJ)
+      return "REJ";
+    if (code == V3ActSite.RF)
+      return "RF";
+    if (code == V3ActSite.RG)
+      return "RG";
+    if (code == V3ActSite.RH)
+      return "RH";
+    if (code == V3ActSite.RIJ)
+      return "RIJ";
+    if (code == V3ActSite.RLAQ)
+      return "RLAQ";
+    if (code == V3ActSite.RLFA)
+      return "RLFA";
+    if (code == V3ActSite.RMFA)
+      return "RMFA";
+    if (code == V3ActSite.RN)
+      return "RN";
+    if (code == V3ActSite.RPC)
+      return "RPC";
+    if (code == V3ActSite.RSC)
+      return "RSC";
+    if (code == V3ActSite.RT)
+      return "RT";
+    if (code == V3ActSite.RUA)
+      return "RUA";
+    if (code == V3ActSite.RUAQ)
+      return "RUAQ";
+    if (code == V3ActSite.RUFA)
+      return "RUFA";
+    if (code == V3ActSite.RVG)
+      return "RVG";
+    if (code == V3ActSite.RVL)
+      return "RVL";
+    return "?";
+  }
+
+    public String toSystem(V3ActSite code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActStatus.java
new file mode 100644
index 00000000000..fc1bd390dea
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActStatus.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActStatus {
+
+        /**
+         * Encompasses the expected states of an Act, but excludes "nullified" and "obsolete" which represent unusual terminal states for the life-cycle.
+         */
+        NORMAL, 
+        /**
+         * The Act has been terminated prior to the originally intended completion.
+         */
+        ABORTED, 
+        /**
+         * The Act can be performed or is being performed
+         */
+        ACTIVE, 
+        /**
+         * The Act has been abandoned before activation.
+         */
+        CANCELLED, 
+        /**
+         * An Act that has terminated normally after all of its constituents have been performed.
+         */
+        COMPLETED, 
+        /**
+         * An Act that is still in the preparatory stages has been put aside.  No action can occur until the Act is released.
+         */
+        HELD, 
+        /**
+         * An Act that is in the preparatory stages and may not yet be acted upon
+         */
+        NEW, 
+        /**
+         * An Act that has been activated (actions could or have been performed against it), but has been temporarily disabled.  No further action should be taken against it until it is released
+         */
+        SUSPENDED, 
+        /**
+         * This Act instance was created in error and has been 'removed' and is treated as though it never existed.  A record is retained for audit purposes only.
+         */
+        NULLIFIED, 
+        /**
+         * This Act instance has been replaced by a new instance.
+         */
+        OBSOLETE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("normal".equals(codeString))
+          return NORMAL;
+        if ("aborted".equals(codeString))
+          return ABORTED;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("held".equals(codeString))
+          return HELD;
+        if ("new".equals(codeString))
+          return NEW;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("nullified".equals(codeString))
+          return NULLIFIED;
+        if ("obsolete".equals(codeString))
+          return OBSOLETE;
+        throw new FHIRException("Unknown V3ActStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case ABORTED: return "aborted";
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case HELD: return "held";
+            case NEW: return "new";
+            case SUSPENDED: return "suspended";
+            case NULLIFIED: return "nullified";
+            case OBSOLETE: return "obsolete";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActStatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NORMAL: return "Encompasses the expected states of an Act, but excludes \"nullified\" and \"obsolete\" which represent unusual terminal states for the life-cycle.";
+            case ABORTED: return "The Act has been terminated prior to the originally intended completion.";
+            case ACTIVE: return "The Act can be performed or is being performed";
+            case CANCELLED: return "The Act has been abandoned before activation.";
+            case COMPLETED: return "An Act that has terminated normally after all of its constituents have been performed.";
+            case HELD: return "An Act that is still in the preparatory stages has been put aside.  No action can occur until the Act is released.";
+            case NEW: return "An Act that is in the preparatory stages and may not yet be acted upon";
+            case SUSPENDED: return "An Act that has been activated (actions could or have been performed against it), but has been temporarily disabled.  No further action should be taken against it until it is released";
+            case NULLIFIED: return "This Act instance was created in error and has been 'removed' and is treated as though it never existed.  A record is retained for audit purposes only.";
+            case OBSOLETE: return "This Act instance has been replaced by a new instance.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case ABORTED: return "aborted";
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case HELD: return "held";
+            case NEW: return "new";
+            case SUSPENDED: return "suspended";
+            case NULLIFIED: return "nullified";
+            case OBSOLETE: return "obsolete";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActStatusEnumFactory.java
new file mode 100644
index 00000000000..cce0f7a476e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActStatusEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActStatusEnumFactory implements EnumFactory {
+
+  public V3ActStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("normal".equals(codeString))
+      return V3ActStatus.NORMAL;
+    if ("aborted".equals(codeString))
+      return V3ActStatus.ABORTED;
+    if ("active".equals(codeString))
+      return V3ActStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return V3ActStatus.CANCELLED;
+    if ("completed".equals(codeString))
+      return V3ActStatus.COMPLETED;
+    if ("held".equals(codeString))
+      return V3ActStatus.HELD;
+    if ("new".equals(codeString))
+      return V3ActStatus.NEW;
+    if ("suspended".equals(codeString))
+      return V3ActStatus.SUSPENDED;
+    if ("nullified".equals(codeString))
+      return V3ActStatus.NULLIFIED;
+    if ("obsolete".equals(codeString))
+      return V3ActStatus.OBSOLETE;
+    throw new IllegalArgumentException("Unknown V3ActStatus code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActStatus code) {
+    if (code == V3ActStatus.NORMAL)
+      return "normal";
+    if (code == V3ActStatus.ABORTED)
+      return "aborted";
+    if (code == V3ActStatus.ACTIVE)
+      return "active";
+    if (code == V3ActStatus.CANCELLED)
+      return "cancelled";
+    if (code == V3ActStatus.COMPLETED)
+      return "completed";
+    if (code == V3ActStatus.HELD)
+      return "held";
+    if (code == V3ActStatus.NEW)
+      return "new";
+    if (code == V3ActStatus.SUSPENDED)
+      return "suspended";
+    if (code == V3ActStatus.NULLIFIED)
+      return "nullified";
+    if (code == V3ActStatus.OBSOLETE)
+      return "obsolete";
+    return "?";
+  }
+
+    public String toSystem(V3ActStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUSPrivacyLaw.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUSPrivacyLaw.java
new file mode 100644
index 00000000000..e026292fd76
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUSPrivacyLaw.java
@@ -0,0 +1,174 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActUSPrivacyLaw {
+
+        /**
+         * Definition: A jurisdictional mandate in the U.S. relating to privacy.
+
+                        
+                           Usage Note: ActPrivacyLaw codes may be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.  May be used to further specify rationale for assignment of other ActPrivacyPolicy codes in the US realm, e.g., ETH and 42CFRPart2 can be differentiated from ETH and Title38Part1.
+         */
+        _ACTUSPRIVACYLAW, 
+        /**
+         * 42 CFR Part 2 stipulates the right of an individual who has applied for or been given diagnosis or treatment for alcohol or drug abuse at a federally assisted program.
+
+                        
+                           Definition: Non-disclosure of health information relating to health care paid for by a federally assisted substance abuse program without patient consent.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.
+         */
+        _42CFRPART2, 
+        /**
+         * U.S. Federal regulations governing the protection of human subjects in research (codified at Subpart A of 45 CFR part 46) that has been adopted by 15 U.S. Federal departments and agencies in an effort to promote uniformity, understanding, and compliance with human subject protections. Existing regulations governing the protection of human subjects in Food and Drug Administration (FDA)-regulated research (21 CFR parts 50, 56, 312, and 812) are separate from the Common Rule but include similar requirements.
+
+                        
+                           Definition: U.S. federal laws governing research-related privacy policies.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.
+         */
+        COMMONRULE, 
+        /**
+         * The U.S. Public Law 104-191 Health Insurance Portability and Accountability Act (HIPAA) Privacy Rule (45 CFR Part 164 Subpart E) permits access, use and disclosure of certain personal health information (PHI as defined under the law) for purposes of Treatment, Payment, and Operations, and requires that the provider ask that patients acknowledge the Provider's Notice of Privacy Practices as permitted conduct under the law.
+
+                        
+                           Definition: Notification of HIPAA Privacy Practices.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.
+         */
+        HIPAANOPP, 
+        /**
+         * The U.S. Public Law 104-191 Health Insurance Portability and Accountability Act (HIPAA) Privacy Rule (45 CFR Part 164 Section 164.508) requires authorization for certain uses and disclosure of psychotherapy notes.
+
+                        
+                           Definition: Authorization that must be obtained for disclosure of psychotherapy notes.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.
+         */
+        HIPAAPSYNOTES, 
+        /**
+         * Section 13405(a) of the Health Information Technology for Economic and Clinical Health Act (HITECH) stipulates the right of an individual to have disclosures regarding certain health care items or services for which the individual pays out of pocket in full restricted from a health plan.
+
+                        
+                           Definition: Non-disclosure of health information to a health plan relating to health care items or services for which an individual pays out of pocket in full.
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.
+         */
+        HIPAASELFPAY, 
+        /**
+         * Title 38 Part 1-protected information may only be disclosed to a third party with the special written consent of the patient except where expressly authorized by 38 USC 7332. VA may disclose this information for specific purposes to: VA employees on a need to know basis - more restrictive than Privacy Act need to know; contractors who need the information in order to perform or fulfill the duties of the contract; and researchers who provide assurances that the information will not be identified in any report.  This information may also be disclosed without consent where patient lacks decision-making capacity; in a medical emergency for the purpose of treating a condition which poses an immediate threat to the health of any individual and which requires immediate medical intervention; for eye, tissue, or organ donation purposes; and disclosure of HIV information for public health purposes.
+
+                        
+                           Definition: Title 38 Part 1 - §1.462 Confidentiality restrictions.
+
+                        
+(a) General. The patient records to which §§1.460 through 1.499 of this part apply may be disclosed or used only as permitted by these regulations and may not otherwise be disclosed or used in any civil, criminal, administrative, or legislative proceedings conducted by any Federal, State, or local authority. Any disclosure made under these regulations must be limited to that information which is necessary to carry out the purpose of the disclosure. SUBCHAPTER III--PROTECTION OF PATIENT RIGHTS Sec. 7332. Confidentiality of certain medical records (a)(1) Records of the identity, diagnosis, prognosis, or treatment of any patient or subject which are maintained in connection with the performance of any program or activity (including education, training, treatment, rehabilitation, or research) relating to drug abuse, alcoholism or alcohol abuse, infection with the human immunodeficiency virus, or sickle cell anemia which is carried out by or for the Department under this title shall, except as provided in subsections (e) and (f), be confidential, and (section 5701 of this title to the contrary notwithstanding) such records may be disclosed only for the purposes and under the circumstances expressly authorized under subsection (b).
+
+                        
+                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.
+         */
+        TITLE38SECTION7332, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActUSPrivacyLaw fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ActUSPrivacyLaw".equals(codeString))
+          return _ACTUSPRIVACYLAW;
+        if ("42CFRPart2".equals(codeString))
+          return _42CFRPART2;
+        if ("CommonRule".equals(codeString))
+          return COMMONRULE;
+        if ("HIPAANOPP".equals(codeString))
+          return HIPAANOPP;
+        if ("HIPAAPsyNotes".equals(codeString))
+          return HIPAAPSYNOTES;
+        if ("HIPAASelfPay".equals(codeString))
+          return HIPAASELFPAY;
+        if ("Title38Section7332".equals(codeString))
+          return TITLE38SECTION7332;
+        throw new FHIRException("Unknown V3ActUSPrivacyLaw code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ACTUSPRIVACYLAW: return "_ActUSPrivacyLaw";
+            case _42CFRPART2: return "42CFRPart2";
+            case COMMONRULE: return "CommonRule";
+            case HIPAANOPP: return "HIPAANOPP";
+            case HIPAAPSYNOTES: return "HIPAAPsyNotes";
+            case HIPAASELFPAY: return "HIPAASelfPay";
+            case TITLE38SECTION7332: return "Title38Section7332";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActUSPrivacyLaw";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ACTUSPRIVACYLAW: return "Definition: A jurisdictional mandate in the U.S. relating to privacy.\r\n\n                        \n                           Usage Note: ActPrivacyLaw codes may be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.  May be used to further specify rationale for assignment of other ActPrivacyPolicy codes in the US realm, e.g., ETH and 42CFRPart2 can be differentiated from ETH and Title38Part1.";
+            case _42CFRPART2: return "42 CFR Part 2 stipulates the right of an individual who has applied for or been given diagnosis or treatment for alcohol or drug abuse at a federally assisted program.\r\n\n                        \n                           Definition: Non-disclosure of health information relating to health care paid for by a federally assisted substance abuse program without patient consent.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.";
+            case COMMONRULE: return "U.S. Federal regulations governing the protection of human subjects in research (codified at Subpart A of 45 CFR part 46) that has been adopted by 15 U.S. Federal departments and agencies in an effort to promote uniformity, understanding, and compliance with human subject protections. Existing regulations governing the protection of human subjects in Food and Drug Administration (FDA)-regulated research (21 CFR parts 50, 56, 312, and 812) are separate from the Common Rule but include similar requirements.\r\n\n                        \n                           Definition: U.S. federal laws governing research-related privacy policies.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.";
+            case HIPAANOPP: return "The U.S. Public Law 104-191 Health Insurance Portability and Accountability Act (HIPAA) Privacy Rule (45 CFR Part 164 Subpart E) permits access, use and disclosure of certain personal health information (PHI as defined under the law) for purposes of Treatment, Payment, and Operations, and requires that the provider ask that patients acknowledge the Provider's Notice of Privacy Practices as permitted conduct under the law.\r\n\n                        \n                           Definition: Notification of HIPAA Privacy Practices.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialtyCode complies.";
+            case HIPAAPSYNOTES: return "The U.S. Public Law 104-191 Health Insurance Portability and Accountability Act (HIPAA) Privacy Rule (45 CFR Part 164 Section 164.508) requires authorization for certain uses and disclosure of psychotherapy notes.\r\n\n                        \n                           Definition: Authorization that must be obtained for disclosure of psychotherapy notes.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.";
+            case HIPAASELFPAY: return "Section 13405(a) of the Health Information Technology for Economic and Clinical Health Act (HITECH) stipulates the right of an individual to have disclosures regarding certain health care items or services for which the individual pays out of pocket in full restricted from a health plan.\r\n\n                        \n                           Definition: Non-disclosure of health information to a health plan relating to health care items or services for which an individual pays out of pocket in full.\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.";
+            case TITLE38SECTION7332: return "Title 38 Part 1-protected information may only be disclosed to a third party with the special written consent of the patient except where expressly authorized by 38 USC 7332. VA may disclose this information for specific purposes to: VA employees on a need to know basis - more restrictive than Privacy Act need to know; contractors who need the information in order to perform or fulfill the duties of the contract; and researchers who provide assurances that the information will not be identified in any report.  This information may also be disclosed without consent where patient lacks decision-making capacity; in a medical emergency for the purpose of treating a condition which poses an immediate threat to the health of any individual and which requires immediate medical intervention; for eye, tissue, or organ donation purposes; and disclosure of HIV information for public health purposes.\r\n\n                        \n                           Definition: Title 38 Part 1 - §1.462 Confidentiality restrictions.\r\n\n                        \n(a) General. The patient records to which §§1.460 through 1.499 of this part apply may be disclosed or used only as permitted by these regulations and may not otherwise be disclosed or used in any civil, criminal, administrative, or legislative proceedings conducted by any Federal, State, or local authority. Any disclosure made under these regulations must be limited to that information which is necessary to carry out the purpose of the disclosure. SUBCHAPTER III--PROTECTION OF PATIENT RIGHTS Sec. 7332. Confidentiality of certain medical records (a)(1) Records of the identity, diagnosis, prognosis, or treatment of any patient or subject which are maintained in connection with the performance of any program or activity (including education, training, treatment, rehabilitation, or research) relating to drug abuse, alcoholism or alcohol abuse, infection with the human immunodeficiency virus, or sickle cell anemia which is carried out by or for the Department under this title shall, except as provided in subsections (e) and (f), be confidential, and (section 5701 of this title to the contrary notwithstanding) such records may be disclosed only for the purposes and under the circumstances expressly authorized under subsection (b).\r\n\n                        \n                           Usage Note: May be associated with an Act or a Role to indicate the legal provision to which the assignment of an Act.confidentialityCode or Role.confidentialityCode complies.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ACTUSPRIVACYLAW: return "ActUSPrivacyLaw";
+            case _42CFRPART2: return "42 CFR Part2";
+            case COMMONRULE: return "Common Rule";
+            case HIPAANOPP: return "HIPAA notice of privacy practices";
+            case HIPAAPSYNOTES: return "HIPAA psychotherapy notes";
+            case HIPAASELFPAY: return "HIPAA self-pay";
+            case TITLE38SECTION7332: return "Title 38 Section 7332";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUSPrivacyLawEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUSPrivacyLawEnumFactory.java
new file mode 100644
index 00000000000..e7214d8b3d8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUSPrivacyLawEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActUSPrivacyLawEnumFactory implements EnumFactory {
+
+  public V3ActUSPrivacyLaw fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ActUSPrivacyLaw".equals(codeString))
+      return V3ActUSPrivacyLaw._ACTUSPRIVACYLAW;
+    if ("42CFRPart2".equals(codeString))
+      return V3ActUSPrivacyLaw._42CFRPART2;
+    if ("CommonRule".equals(codeString))
+      return V3ActUSPrivacyLaw.COMMONRULE;
+    if ("HIPAANOPP".equals(codeString))
+      return V3ActUSPrivacyLaw.HIPAANOPP;
+    if ("HIPAAPsyNotes".equals(codeString))
+      return V3ActUSPrivacyLaw.HIPAAPSYNOTES;
+    if ("HIPAASelfPay".equals(codeString))
+      return V3ActUSPrivacyLaw.HIPAASELFPAY;
+    if ("Title38Section7332".equals(codeString))
+      return V3ActUSPrivacyLaw.TITLE38SECTION7332;
+    throw new IllegalArgumentException("Unknown V3ActUSPrivacyLaw code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActUSPrivacyLaw code) {
+    if (code == V3ActUSPrivacyLaw._ACTUSPRIVACYLAW)
+      return "_ActUSPrivacyLaw";
+    if (code == V3ActUSPrivacyLaw._42CFRPART2)
+      return "42CFRPart2";
+    if (code == V3ActUSPrivacyLaw.COMMONRULE)
+      return "CommonRule";
+    if (code == V3ActUSPrivacyLaw.HIPAANOPP)
+      return "HIPAANOPP";
+    if (code == V3ActUSPrivacyLaw.HIPAAPSYNOTES)
+      return "HIPAAPsyNotes";
+    if (code == V3ActUSPrivacyLaw.HIPAASELFPAY)
+      return "HIPAASelfPay";
+    if (code == V3ActUSPrivacyLaw.TITLE38SECTION7332)
+      return "Title38Section7332";
+    return "?";
+  }
+
+    public String toSystem(V3ActUSPrivacyLaw code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUncertainty.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUncertainty.java
new file mode 100644
index 00000000000..24da0c73978
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUncertainty.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ActUncertainty {
+
+        /**
+         * Specifies that the act statement is made without explicit tagging of uncertainty. This is the normal statement, meaning that it is not free of errors and uncertainty may still exist.
+         */
+        N, 
+        /**
+         * Specifies that the originator of the Act statement does not have full confidence in the applicability (i.e., in event mood: factual truth) of the statement.
+         */
+        U, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ActUncertainty fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("N".equals(codeString))
+          return N;
+        if ("U".equals(codeString))
+          return U;
+        throw new FHIRException("Unknown V3ActUncertainty code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case N: return "N";
+            case U: return "U";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ActUncertainty";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case N: return "Specifies that the act statement is made without explicit tagging of uncertainty. This is the normal statement, meaning that it is not free of errors and uncertainty may still exist.";
+            case U: return "Specifies that the originator of the Act statement does not have full confidence in the applicability (i.e., in event mood: factual truth) of the statement.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case N: return "stated with no assertion of uncertainty";
+            case U: return "stated with uncertainty";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUncertaintyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUncertaintyEnumFactory.java
new file mode 100644
index 00000000000..4b39080ec42
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ActUncertaintyEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ActUncertaintyEnumFactory implements EnumFactory {
+
+  public V3ActUncertainty fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("N".equals(codeString))
+      return V3ActUncertainty.N;
+    if ("U".equals(codeString))
+      return V3ActUncertainty.U;
+    throw new IllegalArgumentException("Unknown V3ActUncertainty code '"+codeString+"'");
+  }
+
+  public String toCode(V3ActUncertainty code) {
+    if (code == V3ActUncertainty.N)
+      return "N";
+    if (code == V3ActUncertainty.U)
+      return "U";
+    return "?";
+  }
+
+    public String toSystem(V3ActUncertainty code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressPartType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressPartType.java
new file mode 100644
index 00000000000..91a975d288f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressPartType.java
@@ -0,0 +1,339 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3AddressPartType {
+
+        /**
+         * This can be a unit designator, such as apartment number, suite number, or floor. There may be several unit designators in an address (e.g., "3rd floor, Appt. 342"). This can also be a designator pointing away from the location, rather than specifying a smaller location within some larger one (e.g., Dutch "t.o." means "opposite to" for house boats located across the street facing houses).
+         */
+        ADL, 
+        /**
+         * Description: An address line is for either an additional locator, a delivery address or a street address.
+         */
+        AL, 
+        /**
+         * A delivery address line is frequently used instead of breaking out delivery mode, delivery installation, etc.  An address generally has only a delivery address line or a street address line, but not both.
+         */
+        DAL, 
+        /**
+         * Description: A street address line is frequently used instead of breaking out build number, street name, street type, etc. An address generally has only a delivery address line or a street address line, but not both.
+         */
+        SAL, 
+        /**
+         * The numeric portion of a building number
+         */
+        BNN, 
+        /**
+         * The number of a building, house or lot alongside the street.  Also known as "primary street number".  This does not number the street but rather the building.
+         */
+        BNR, 
+        /**
+         * Any alphabetic character, fraction or other text that may appear after the numeric portion of a building number
+         */
+        BNS, 
+        /**
+         * The name of the party who will take receipt at the specified address, and will take on responsibility for ensuring delivery to the target recipient
+         */
+        CAR, 
+        /**
+         * A geographic sub-unit delineated for demographic purposes.
+         */
+        CEN, 
+        /**
+         * Country
+         */
+        CNT, 
+        /**
+         * A sub-unit of a state or province. (49 of the United States of America use the term "county;" Louisiana uses the term "parish".)
+         */
+        CPA, 
+        /**
+         * The name of the city, town, village, or other community or delivery center
+         */
+        CTY, 
+        /**
+         * Delimiters are printed without framing white space.  If no value component is provided, the delimiter appears as a line break.
+         */
+        DEL, 
+        /**
+         * Indicates the type of delivery installation (the facility to which the mail will be delivered prior to final shipping via the delivery mode.) Example: post office, letter carrier depot, community mail center, station, etc.
+         */
+        DINST, 
+        /**
+         * The location of the delivery installation, usually a town or city, and is only required if the area is different from the municipality. Area to which mail delivery service is provided from any postal facility or service such as an individual letter carrier, rural route, or postal route.
+         */
+        DINSTA, 
+        /**
+         * A number, letter or name identifying a delivery installation.  E.g., for Station A, the delivery installation qualifier would be 'A'.
+         */
+        DINSTQ, 
+        /**
+         * Direction (e.g., N, S, W, E)
+         */
+        DIR, 
+        /**
+         * Indicates the type of service offered, method of delivery.  For example: post office box, rural route, general delivery, etc.
+         */
+        DMOD, 
+        /**
+         * Represents the routing information such as a letter carrier route number.  It is the identifying number of the designator (the box number or rural route number).
+         */
+        DMODID, 
+        /**
+         * A value that uniquely identifies the postal address.
+         */
+        DPID, 
+        /**
+         * Description:An intersection denotes that the actual address is located AT or CLOSE TO the intersection OF two or more streets.
+         */
+        INT, 
+        /**
+         * A numbered box located in a post station.
+         */
+        POB, 
+        /**
+         * A subsection of a municipality
+         */
+        PRE, 
+        /**
+         * A sub-unit of a country with limited sovereignty in a federally organized country.
+         */
+        STA, 
+        /**
+         * The base name of a roadway or artery recognized by a municipality (excluding street type and direction)
+         */
+        STB, 
+        /**
+         * street name
+         */
+        STR, 
+        /**
+         * The designation given to the street.  (e.g. Street, Avenue, Crescent, etc.)
+         */
+        STTYP, 
+        /**
+         * The number or name of a specific unit contained within a building or complex, as assigned by that building or complex.
+         */
+        UNID, 
+        /**
+         * Indicates the type of specific unit contained within a building or complex.  E.g. Appartment, Floor
+         */
+        UNIT, 
+        /**
+         * A postal code designating a region defined by the postal service.
+         */
+        ZIP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3AddressPartType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ADL".equals(codeString))
+          return ADL;
+        if ("AL".equals(codeString))
+          return AL;
+        if ("DAL".equals(codeString))
+          return DAL;
+        if ("SAL".equals(codeString))
+          return SAL;
+        if ("BNN".equals(codeString))
+          return BNN;
+        if ("BNR".equals(codeString))
+          return BNR;
+        if ("BNS".equals(codeString))
+          return BNS;
+        if ("CAR".equals(codeString))
+          return CAR;
+        if ("CEN".equals(codeString))
+          return CEN;
+        if ("CNT".equals(codeString))
+          return CNT;
+        if ("CPA".equals(codeString))
+          return CPA;
+        if ("CTY".equals(codeString))
+          return CTY;
+        if ("DEL".equals(codeString))
+          return DEL;
+        if ("DINST".equals(codeString))
+          return DINST;
+        if ("DINSTA".equals(codeString))
+          return DINSTA;
+        if ("DINSTQ".equals(codeString))
+          return DINSTQ;
+        if ("DIR".equals(codeString))
+          return DIR;
+        if ("DMOD".equals(codeString))
+          return DMOD;
+        if ("DMODID".equals(codeString))
+          return DMODID;
+        if ("DPID".equals(codeString))
+          return DPID;
+        if ("INT".equals(codeString))
+          return INT;
+        if ("POB".equals(codeString))
+          return POB;
+        if ("PRE".equals(codeString))
+          return PRE;
+        if ("STA".equals(codeString))
+          return STA;
+        if ("STB".equals(codeString))
+          return STB;
+        if ("STR".equals(codeString))
+          return STR;
+        if ("STTYP".equals(codeString))
+          return STTYP;
+        if ("UNID".equals(codeString))
+          return UNID;
+        if ("UNIT".equals(codeString))
+          return UNIT;
+        if ("ZIP".equals(codeString))
+          return ZIP;
+        throw new FHIRException("Unknown V3AddressPartType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ADL: return "ADL";
+            case AL: return "AL";
+            case DAL: return "DAL";
+            case SAL: return "SAL";
+            case BNN: return "BNN";
+            case BNR: return "BNR";
+            case BNS: return "BNS";
+            case CAR: return "CAR";
+            case CEN: return "CEN";
+            case CNT: return "CNT";
+            case CPA: return "CPA";
+            case CTY: return "CTY";
+            case DEL: return "DEL";
+            case DINST: return "DINST";
+            case DINSTA: return "DINSTA";
+            case DINSTQ: return "DINSTQ";
+            case DIR: return "DIR";
+            case DMOD: return "DMOD";
+            case DMODID: return "DMODID";
+            case DPID: return "DPID";
+            case INT: return "INT";
+            case POB: return "POB";
+            case PRE: return "PRE";
+            case STA: return "STA";
+            case STB: return "STB";
+            case STR: return "STR";
+            case STTYP: return "STTYP";
+            case UNID: return "UNID";
+            case UNIT: return "UNIT";
+            case ZIP: return "ZIP";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/AddressPartType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ADL: return "This can be a unit designator, such as apartment number, suite number, or floor. There may be several unit designators in an address (e.g., \"3rd floor, Appt. 342\"). This can also be a designator pointing away from the location, rather than specifying a smaller location within some larger one (e.g., Dutch \"t.o.\" means \"opposite to\" for house boats located across the street facing houses).";
+            case AL: return "Description: An address line is for either an additional locator, a delivery address or a street address.";
+            case DAL: return "A delivery address line is frequently used instead of breaking out delivery mode, delivery installation, etc.  An address generally has only a delivery address line or a street address line, but not both.";
+            case SAL: return "Description: A street address line is frequently used instead of breaking out build number, street name, street type, etc. An address generally has only a delivery address line or a street address line, but not both.";
+            case BNN: return "The numeric portion of a building number";
+            case BNR: return "The number of a building, house or lot alongside the street.  Also known as \"primary street number\".  This does not number the street but rather the building.";
+            case BNS: return "Any alphabetic character, fraction or other text that may appear after the numeric portion of a building number";
+            case CAR: return "The name of the party who will take receipt at the specified address, and will take on responsibility for ensuring delivery to the target recipient";
+            case CEN: return "A geographic sub-unit delineated for demographic purposes.";
+            case CNT: return "Country";
+            case CPA: return "A sub-unit of a state or province. (49 of the United States of America use the term \"county;\" Louisiana uses the term \"parish\".)";
+            case CTY: return "The name of the city, town, village, or other community or delivery center";
+            case DEL: return "Delimiters are printed without framing white space.  If no value component is provided, the delimiter appears as a line break.";
+            case DINST: return "Indicates the type of delivery installation (the facility to which the mail will be delivered prior to final shipping via the delivery mode.) Example: post office, letter carrier depot, community mail center, station, etc.";
+            case DINSTA: return "The location of the delivery installation, usually a town or city, and is only required if the area is different from the municipality. Area to which mail delivery service is provided from any postal facility or service such as an individual letter carrier, rural route, or postal route.";
+            case DINSTQ: return "A number, letter or name identifying a delivery installation.  E.g., for Station A, the delivery installation qualifier would be 'A'.";
+            case DIR: return "Direction (e.g., N, S, W, E)";
+            case DMOD: return "Indicates the type of service offered, method of delivery.  For example: post office box, rural route, general delivery, etc.";
+            case DMODID: return "Represents the routing information such as a letter carrier route number.  It is the identifying number of the designator (the box number or rural route number).";
+            case DPID: return "A value that uniquely identifies the postal address.";
+            case INT: return "Description:An intersection denotes that the actual address is located AT or CLOSE TO the intersection OF two or more streets.";
+            case POB: return "A numbered box located in a post station.";
+            case PRE: return "A subsection of a municipality";
+            case STA: return "A sub-unit of a country with limited sovereignty in a federally organized country.";
+            case STB: return "The base name of a roadway or artery recognized by a municipality (excluding street type and direction)";
+            case STR: return "street name";
+            case STTYP: return "The designation given to the street.  (e.g. Street, Avenue, Crescent, etc.)";
+            case UNID: return "The number or name of a specific unit contained within a building or complex, as assigned by that building or complex.";
+            case UNIT: return "Indicates the type of specific unit contained within a building or complex.  E.g. Appartment, Floor";
+            case ZIP: return "A postal code designating a region defined by the postal service.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ADL: return "additional locator";
+            case AL: return "address line";
+            case DAL: return "delivery address line";
+            case SAL: return "street address line";
+            case BNN: return "building number numeric";
+            case BNR: return "building number";
+            case BNS: return "building number suffix";
+            case CAR: return "care of";
+            case CEN: return "census tract";
+            case CNT: return "country";
+            case CPA: return "county or parish";
+            case CTY: return "municipality";
+            case DEL: return "delimiter";
+            case DINST: return "delivery installation type";
+            case DINSTA: return "delivery installation area";
+            case DINSTQ: return "delivery installation qualifier";
+            case DIR: return "direction";
+            case DMOD: return "delivery mode";
+            case DMODID: return "delivery mode identifier";
+            case DPID: return "delivery point identifier";
+            case INT: return "intersection";
+            case POB: return "post box";
+            case PRE: return "precinct";
+            case STA: return "state or province";
+            case STB: return "street name base";
+            case STR: return "street name";
+            case STTYP: return "street type";
+            case UNID: return "unit identifier";
+            case UNIT: return "unit designator";
+            case ZIP: return "postal code";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressPartTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressPartTypeEnumFactory.java
new file mode 100644
index 00000000000..5acce30bc86
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressPartTypeEnumFactory.java
@@ -0,0 +1,174 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3AddressPartTypeEnumFactory implements EnumFactory {
+
+  public V3AddressPartType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ADL".equals(codeString))
+      return V3AddressPartType.ADL;
+    if ("AL".equals(codeString))
+      return V3AddressPartType.AL;
+    if ("DAL".equals(codeString))
+      return V3AddressPartType.DAL;
+    if ("SAL".equals(codeString))
+      return V3AddressPartType.SAL;
+    if ("BNN".equals(codeString))
+      return V3AddressPartType.BNN;
+    if ("BNR".equals(codeString))
+      return V3AddressPartType.BNR;
+    if ("BNS".equals(codeString))
+      return V3AddressPartType.BNS;
+    if ("CAR".equals(codeString))
+      return V3AddressPartType.CAR;
+    if ("CEN".equals(codeString))
+      return V3AddressPartType.CEN;
+    if ("CNT".equals(codeString))
+      return V3AddressPartType.CNT;
+    if ("CPA".equals(codeString))
+      return V3AddressPartType.CPA;
+    if ("CTY".equals(codeString))
+      return V3AddressPartType.CTY;
+    if ("DEL".equals(codeString))
+      return V3AddressPartType.DEL;
+    if ("DINST".equals(codeString))
+      return V3AddressPartType.DINST;
+    if ("DINSTA".equals(codeString))
+      return V3AddressPartType.DINSTA;
+    if ("DINSTQ".equals(codeString))
+      return V3AddressPartType.DINSTQ;
+    if ("DIR".equals(codeString))
+      return V3AddressPartType.DIR;
+    if ("DMOD".equals(codeString))
+      return V3AddressPartType.DMOD;
+    if ("DMODID".equals(codeString))
+      return V3AddressPartType.DMODID;
+    if ("DPID".equals(codeString))
+      return V3AddressPartType.DPID;
+    if ("INT".equals(codeString))
+      return V3AddressPartType.INT;
+    if ("POB".equals(codeString))
+      return V3AddressPartType.POB;
+    if ("PRE".equals(codeString))
+      return V3AddressPartType.PRE;
+    if ("STA".equals(codeString))
+      return V3AddressPartType.STA;
+    if ("STB".equals(codeString))
+      return V3AddressPartType.STB;
+    if ("STR".equals(codeString))
+      return V3AddressPartType.STR;
+    if ("STTYP".equals(codeString))
+      return V3AddressPartType.STTYP;
+    if ("UNID".equals(codeString))
+      return V3AddressPartType.UNID;
+    if ("UNIT".equals(codeString))
+      return V3AddressPartType.UNIT;
+    if ("ZIP".equals(codeString))
+      return V3AddressPartType.ZIP;
+    throw new IllegalArgumentException("Unknown V3AddressPartType code '"+codeString+"'");
+  }
+
+  public String toCode(V3AddressPartType code) {
+    if (code == V3AddressPartType.ADL)
+      return "ADL";
+    if (code == V3AddressPartType.AL)
+      return "AL";
+    if (code == V3AddressPartType.DAL)
+      return "DAL";
+    if (code == V3AddressPartType.SAL)
+      return "SAL";
+    if (code == V3AddressPartType.BNN)
+      return "BNN";
+    if (code == V3AddressPartType.BNR)
+      return "BNR";
+    if (code == V3AddressPartType.BNS)
+      return "BNS";
+    if (code == V3AddressPartType.CAR)
+      return "CAR";
+    if (code == V3AddressPartType.CEN)
+      return "CEN";
+    if (code == V3AddressPartType.CNT)
+      return "CNT";
+    if (code == V3AddressPartType.CPA)
+      return "CPA";
+    if (code == V3AddressPartType.CTY)
+      return "CTY";
+    if (code == V3AddressPartType.DEL)
+      return "DEL";
+    if (code == V3AddressPartType.DINST)
+      return "DINST";
+    if (code == V3AddressPartType.DINSTA)
+      return "DINSTA";
+    if (code == V3AddressPartType.DINSTQ)
+      return "DINSTQ";
+    if (code == V3AddressPartType.DIR)
+      return "DIR";
+    if (code == V3AddressPartType.DMOD)
+      return "DMOD";
+    if (code == V3AddressPartType.DMODID)
+      return "DMODID";
+    if (code == V3AddressPartType.DPID)
+      return "DPID";
+    if (code == V3AddressPartType.INT)
+      return "INT";
+    if (code == V3AddressPartType.POB)
+      return "POB";
+    if (code == V3AddressPartType.PRE)
+      return "PRE";
+    if (code == V3AddressPartType.STA)
+      return "STA";
+    if (code == V3AddressPartType.STB)
+      return "STB";
+    if (code == V3AddressPartType.STR)
+      return "STR";
+    if (code == V3AddressPartType.STTYP)
+      return "STTYP";
+    if (code == V3AddressPartType.UNID)
+      return "UNID";
+    if (code == V3AddressPartType.UNIT)
+      return "UNIT";
+    if (code == V3AddressPartType.ZIP)
+      return "ZIP";
+    return "?";
+  }
+
+    public String toSystem(V3AddressPartType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressUse.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressUse.java
new file mode 100644
index 00000000000..0e3f1aeada3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressUse.java
@@ -0,0 +1,243 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3AddressUse {
+
+        /**
+         * Description: Address uses that can apply to both postal and telecommunication addresses.
+         */
+        _GENERALADDRESSUSE, 
+        /**
+         * Description: A flag indicating that the address is bad, in fact, useless.
+         */
+        BAD, 
+        /**
+         * Description: Indicates that the address is considered sensitive and should only be shared or published in accordance with organizational controls governing patient demographic information with increased sensitivity. Uses of Addresses.   Lloyd to supply more complete description.
+         */
+        CONF, 
+        /**
+         * Description: A communication address at a home, attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available.
+         */
+        H, 
+        /**
+         * Description: The primary home, to reach a person after business hours.
+         */
+        HP, 
+        /**
+         * Description: A vacation home, to reach a person while on vacation.
+         */
+        HV, 
+        /**
+         * This address is no longer in use.
+
+                        
+                           Usage Note: Address may also carry valid time ranges. This code is used to cover the situations where it is known that the address is no longer valid, but no particular time range for its use is known.
+         */
+        OLD, 
+        /**
+         * Description: A temporary address, may be good for visit or mailing. Note that an address history can provide more detailed information.
+         */
+        TMP, 
+        /**
+         * Description: An office address. First choice for business related contacts during business hours.
+         */
+        WP, 
+        /**
+         * Description: Indicates a work place address or telecommunication address that reaches the individual or organization directly without intermediaries. For phones, often referred to as a 'private line'.
+         */
+        DIR, 
+        /**
+         * Description: Indicates a work place address or telecommunication address that is a 'standard' address which may reach a reception service, mail-room, or other intermediary prior to the target entity.
+         */
+        PUB, 
+        /**
+         * Description: Address uses that only apply to postal addresses, not telecommunication addresses.
+         */
+        _POSTALADDRESSUSE, 
+        /**
+         * Description: Used primarily to visit an address.
+         */
+        PHYS, 
+        /**
+         * Description: Used to send mail.
+         */
+        PST, 
+        /**
+         * Description: Address uses that only apply to telecommunication addresses, not postal addresses.
+         */
+        _TELECOMMUNICATIONADDRESSUSE, 
+        /**
+         * Description: An automated answering machine used for less urgent cases and if the main purpose of contact is to leave a message or access an automated announcement.
+         */
+        AS, 
+        /**
+         * Description: A contact specifically designated to be used for emergencies. This is the first choice in emergencies, independent of any other use codes.
+         */
+        EC, 
+        /**
+         * Description: A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business.
+         */
+        MC, 
+        /**
+         * Description: A paging device suitable to solicit a callback or to leave a very short message.
+         */
+        PG, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3AddressUse fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_GeneralAddressUse".equals(codeString))
+          return _GENERALADDRESSUSE;
+        if ("BAD".equals(codeString))
+          return BAD;
+        if ("CONF".equals(codeString))
+          return CONF;
+        if ("H".equals(codeString))
+          return H;
+        if ("HP".equals(codeString))
+          return HP;
+        if ("HV".equals(codeString))
+          return HV;
+        if ("OLD".equals(codeString))
+          return OLD;
+        if ("TMP".equals(codeString))
+          return TMP;
+        if ("WP".equals(codeString))
+          return WP;
+        if ("DIR".equals(codeString))
+          return DIR;
+        if ("PUB".equals(codeString))
+          return PUB;
+        if ("_PostalAddressUse".equals(codeString))
+          return _POSTALADDRESSUSE;
+        if ("PHYS".equals(codeString))
+          return PHYS;
+        if ("PST".equals(codeString))
+          return PST;
+        if ("_TelecommunicationAddressUse".equals(codeString))
+          return _TELECOMMUNICATIONADDRESSUSE;
+        if ("AS".equals(codeString))
+          return AS;
+        if ("EC".equals(codeString))
+          return EC;
+        if ("MC".equals(codeString))
+          return MC;
+        if ("PG".equals(codeString))
+          return PG;
+        throw new FHIRException("Unknown V3AddressUse code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _GENERALADDRESSUSE: return "_GeneralAddressUse";
+            case BAD: return "BAD";
+            case CONF: return "CONF";
+            case H: return "H";
+            case HP: return "HP";
+            case HV: return "HV";
+            case OLD: return "OLD";
+            case TMP: return "TMP";
+            case WP: return "WP";
+            case DIR: return "DIR";
+            case PUB: return "PUB";
+            case _POSTALADDRESSUSE: return "_PostalAddressUse";
+            case PHYS: return "PHYS";
+            case PST: return "PST";
+            case _TELECOMMUNICATIONADDRESSUSE: return "_TelecommunicationAddressUse";
+            case AS: return "AS";
+            case EC: return "EC";
+            case MC: return "MC";
+            case PG: return "PG";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/AddressUse";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _GENERALADDRESSUSE: return "Description: Address uses that can apply to both postal and telecommunication addresses.";
+            case BAD: return "Description: A flag indicating that the address is bad, in fact, useless.";
+            case CONF: return "Description: Indicates that the address is considered sensitive and should only be shared or published in accordance with organizational controls governing patient demographic information with increased sensitivity. Uses of Addresses.   Lloyd to supply more complete description.";
+            case H: return "Description: A communication address at a home, attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available.";
+            case HP: return "Description: The primary home, to reach a person after business hours.";
+            case HV: return "Description: A vacation home, to reach a person while on vacation.";
+            case OLD: return "This address is no longer in use.\r\n\n                        \n                           Usage Note: Address may also carry valid time ranges. This code is used to cover the situations where it is known that the address is no longer valid, but no particular time range for its use is known.";
+            case TMP: return "Description: A temporary address, may be good for visit or mailing. Note that an address history can provide more detailed information.";
+            case WP: return "Description: An office address. First choice for business related contacts during business hours.";
+            case DIR: return "Description: Indicates a work place address or telecommunication address that reaches the individual or organization directly without intermediaries. For phones, often referred to as a 'private line'.";
+            case PUB: return "Description: Indicates a work place address or telecommunication address that is a 'standard' address which may reach a reception service, mail-room, or other intermediary prior to the target entity.";
+            case _POSTALADDRESSUSE: return "Description: Address uses that only apply to postal addresses, not telecommunication addresses.";
+            case PHYS: return "Description: Used primarily to visit an address.";
+            case PST: return "Description: Used to send mail.";
+            case _TELECOMMUNICATIONADDRESSUSE: return "Description: Address uses that only apply to telecommunication addresses, not postal addresses.";
+            case AS: return "Description: An automated answering machine used for less urgent cases and if the main purpose of contact is to leave a message or access an automated announcement.";
+            case EC: return "Description: A contact specifically designated to be used for emergencies. This is the first choice in emergencies, independent of any other use codes.";
+            case MC: return "Description: A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business.";
+            case PG: return "Description: A paging device suitable to solicit a callback or to leave a very short message.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _GENERALADDRESSUSE: return "_GeneralAddressUse";
+            case BAD: return "bad address";
+            case CONF: return "confidential address";
+            case H: return "home address";
+            case HP: return "primary home";
+            case HV: return "vacation home";
+            case OLD: return "no longer in use";
+            case TMP: return "temporary address";
+            case WP: return "work place";
+            case DIR: return "direct";
+            case PUB: return "public";
+            case _POSTALADDRESSUSE: return "_PostalAddressUse";
+            case PHYS: return "physical visit address";
+            case PST: return "postal address";
+            case _TELECOMMUNICATIONADDRESSUSE: return "_TelecommunicationAddressUse";
+            case AS: return "answering service";
+            case EC: return "emergency contact";
+            case MC: return "mobile contact)";
+            case PG: return "pager";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressUseEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressUseEnumFactory.java
new file mode 100644
index 00000000000..768f4c5fcf3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AddressUseEnumFactory.java
@@ -0,0 +1,130 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3AddressUseEnumFactory implements EnumFactory {
+
+  public V3AddressUse fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_GeneralAddressUse".equals(codeString))
+      return V3AddressUse._GENERALADDRESSUSE;
+    if ("BAD".equals(codeString))
+      return V3AddressUse.BAD;
+    if ("CONF".equals(codeString))
+      return V3AddressUse.CONF;
+    if ("H".equals(codeString))
+      return V3AddressUse.H;
+    if ("HP".equals(codeString))
+      return V3AddressUse.HP;
+    if ("HV".equals(codeString))
+      return V3AddressUse.HV;
+    if ("OLD".equals(codeString))
+      return V3AddressUse.OLD;
+    if ("TMP".equals(codeString))
+      return V3AddressUse.TMP;
+    if ("WP".equals(codeString))
+      return V3AddressUse.WP;
+    if ("DIR".equals(codeString))
+      return V3AddressUse.DIR;
+    if ("PUB".equals(codeString))
+      return V3AddressUse.PUB;
+    if ("_PostalAddressUse".equals(codeString))
+      return V3AddressUse._POSTALADDRESSUSE;
+    if ("PHYS".equals(codeString))
+      return V3AddressUse.PHYS;
+    if ("PST".equals(codeString))
+      return V3AddressUse.PST;
+    if ("_TelecommunicationAddressUse".equals(codeString))
+      return V3AddressUse._TELECOMMUNICATIONADDRESSUSE;
+    if ("AS".equals(codeString))
+      return V3AddressUse.AS;
+    if ("EC".equals(codeString))
+      return V3AddressUse.EC;
+    if ("MC".equals(codeString))
+      return V3AddressUse.MC;
+    if ("PG".equals(codeString))
+      return V3AddressUse.PG;
+    throw new IllegalArgumentException("Unknown V3AddressUse code '"+codeString+"'");
+  }
+
+  public String toCode(V3AddressUse code) {
+    if (code == V3AddressUse._GENERALADDRESSUSE)
+      return "_GeneralAddressUse";
+    if (code == V3AddressUse.BAD)
+      return "BAD";
+    if (code == V3AddressUse.CONF)
+      return "CONF";
+    if (code == V3AddressUse.H)
+      return "H";
+    if (code == V3AddressUse.HP)
+      return "HP";
+    if (code == V3AddressUse.HV)
+      return "HV";
+    if (code == V3AddressUse.OLD)
+      return "OLD";
+    if (code == V3AddressUse.TMP)
+      return "TMP";
+    if (code == V3AddressUse.WP)
+      return "WP";
+    if (code == V3AddressUse.DIR)
+      return "DIR";
+    if (code == V3AddressUse.PUB)
+      return "PUB";
+    if (code == V3AddressUse._POSTALADDRESSUSE)
+      return "_PostalAddressUse";
+    if (code == V3AddressUse.PHYS)
+      return "PHYS";
+    if (code == V3AddressUse.PST)
+      return "PST";
+    if (code == V3AddressUse._TELECOMMUNICATIONADDRESSUSE)
+      return "_TelecommunicationAddressUse";
+    if (code == V3AddressUse.AS)
+      return "AS";
+    if (code == V3AddressUse.EC)
+      return "EC";
+    if (code == V3AddressUse.MC)
+      return "MC";
+    if (code == V3AddressUse.PG)
+      return "PG";
+    return "?";
+  }
+
+    public String toSystem(V3AddressUse code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AdministrativeGender.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AdministrativeGender.java
new file mode 100644
index 00000000000..5e7658d10ab
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AdministrativeGender.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3AdministrativeGender {
+
+        /**
+         * Female
+         */
+        F, 
+        /**
+         * Male
+         */
+        M, 
+        /**
+         * The gender of a person could not be uniquely defined as male or female, such as hermaphrodite.
+         */
+        UN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3AdministrativeGender fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("F".equals(codeString))
+          return F;
+        if ("M".equals(codeString))
+          return M;
+        if ("UN".equals(codeString))
+          return UN;
+        throw new FHIRException("Unknown V3AdministrativeGender code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case F: return "F";
+            case M: return "M";
+            case UN: return "UN";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/AdministrativeGender";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case F: return "Female";
+            case M: return "Male";
+            case UN: return "The gender of a person could not be uniquely defined as male or female, such as hermaphrodite.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case F: return "Female";
+            case M: return "Male";
+            case UN: return "Undifferentiated";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AdministrativeGenderEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AdministrativeGenderEnumFactory.java
new file mode 100644
index 00000000000..fd47d4f0c52
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AdministrativeGenderEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3AdministrativeGenderEnumFactory implements EnumFactory {
+
+  public V3AdministrativeGender fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("F".equals(codeString))
+      return V3AdministrativeGender.F;
+    if ("M".equals(codeString))
+      return V3AdministrativeGender.M;
+    if ("UN".equals(codeString))
+      return V3AdministrativeGender.UN;
+    throw new IllegalArgumentException("Unknown V3AdministrativeGender code '"+codeString+"'");
+  }
+
+  public String toCode(V3AdministrativeGender code) {
+    if (code == V3AdministrativeGender.F)
+      return "F";
+    if (code == V3AdministrativeGender.M)
+      return "M";
+    if (code == V3AdministrativeGender.UN)
+      return "UN";
+    return "?";
+  }
+
+    public String toSystem(V3AdministrativeGender code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AmericanIndianAlaskaNativeLanguages.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AmericanIndianAlaskaNativeLanguages.java
new file mode 100644
index 00000000000..2b7c150f4fb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AmericanIndianAlaskaNativeLanguages.java
@@ -0,0 +1,2364 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3AmericanIndianAlaskaNativeLanguages {
+
+        /**
+         * Algic
+         */
+        _ALGIC, 
+        /**
+         * Algonquian
+         */
+        _ALGONQUIAN, 
+        /**
+         * Arapahoan
+         */
+        _ARAPAHOAN, 
+        /**
+         * ArapahoGrosVentre
+         */
+        _ARAPAHOGROSVENTRE, 
+        /**
+         * Arapaho
+         */
+        XARP, 
+        /**
+         * Gros Ventre
+         */
+        XATS, 
+        /**
+         * CreeMontagnais
+         */
+        _CREEMONTAGNAIS, 
+        /**
+         * Cree
+         */
+        _CREE, 
+        /**
+         * Western Cree
+         */
+        XCRP, 
+        /**
+         * EasternAlgonquin
+         */
+        _EASTERNALGONQUIN, 
+        /**
+         * Abenakian
+         */
+        _ABENAKIAN, 
+        /**
+         * Eastern Abenaki
+         */
+        XAAQ, 
+        /**
+         * Western Abenaki
+         */
+        XABE, 
+        /**
+         * Maliseet-Passamaquoddy
+         */
+        XMAC, 
+        /**
+         * Delawaran
+         */
+        _DELAWARAN, 
+        /**
+         * Unami Delaware
+         */
+        XDEL, 
+        /**
+         * Micmac
+         */
+        XMIC, 
+        /**
+         * Ojibwayan
+         */
+        _OJIBWAYAN, 
+        /**
+         * Southern Ojibwa
+         */
+        XOJB, 
+        /**
+         * Potawatami
+         */
+        XPOT, 
+        /**
+         * SaukFoxKickapoo
+         */
+        _SAUKFOXKICKAPOO, 
+        /**
+         * Kickapoo
+         */
+        XKIC, 
+        /**
+         * Mesquakie
+         */
+        XSAC, 
+        /**
+         * Shawnee
+         */
+        XSJW, 
+        /**
+         * Blackfoot
+         */
+        XBLC, 
+        /**
+         * Cheyenne
+         */
+        XCHY, 
+        /**
+         * Menominee
+         */
+        XMEZ, 
+        /**
+         * Ritwan
+         */
+        _RITWAN, 
+        /**
+         * Yurok
+         */
+        XYUR, 
+        /**
+         * Caddoan
+         */
+        _CADDOAN, 
+        /**
+         * NorthernCaddoan
+         */
+        _NORTHERNCADDOAN, 
+        /**
+         * Arikara
+         */
+        XARI, 
+        /**
+         * Pawnee
+         */
+        XPAW, 
+        /**
+         * Wichita
+         */
+        XWIC, 
+        /**
+         * SouthernCaddoan
+         */
+        _SOUTHERNCADDOAN, 
+        /**
+         * Caddo
+         */
+        XCAD, 
+        /**
+         * Chimakuan
+         */
+        _CHIMAKUAN, 
+        /**
+         * Quileute
+         */
+        XQUI, 
+        /**
+         * EskimoAleut
+         */
+        _ESKIMOALEUT, 
+        /**
+         * Aleut
+         */
+        _ALEUT, 
+        /**
+         * Aleut
+         */
+        XALW, 
+        /**
+         * Eskimoan
+         */
+        _ESKIMOAN, 
+        /**
+         * InuitInupiaq
+         */
+        _INUITINUPIAQ, 
+        /**
+         * North Alaskan Inuktitut
+         */
+        XESI, 
+        /**
+         * Northwest Alaska Inuktitut
+         */
+        XESK, 
+        /**
+         * SirenikskiYupik
+         */
+        _SIRENIKSKIYUPIK, 
+        /**
+         * Pacific Yupik Gulf
+         */
+        XEMS, 
+        /**
+         * Central Siberian Yupik
+         */
+        XESS, 
+        /**
+         * Central Alaskan Yupik
+         */
+        XESU, 
+        /**
+         * Hokan
+         */
+        _HOKAN, 
+        /**
+         * CochimiYuman
+         */
+        _COCHIMIYUMAN, 
+        /**
+         * Yuman
+         */
+        _YUMAN, 
+        /**
+         * DeltaCalifornia
+         */
+        _DELTACALIFORNIA, 
+        /**
+         * Diegueno
+         */
+        _DIEGUENO, 
+        /**
+         * Kumeyaay
+         */
+        XDIH, 
+        /**
+         * Cocopa
+         */
+        XCOC, 
+        /**
+         * Pai
+         */
+        _PAI, 
+        /**
+         * Havasupai
+         */
+        XYUF, 
+        /**
+         * River
+         */
+        _RIVER, 
+        /**
+         * Mohave
+         */
+        XMOV, 
+        /**
+         * Maricopa
+         */
+        XMRC, 
+        /**
+         * Quechan
+         */
+        XYUM, 
+        /**
+         * Palaihnihan
+         */
+        _PALAIHNIHAN, 
+        /**
+         * Achumawi
+         */
+        XACH, 
+        /**
+         * Atsugewi
+         */
+        XATW, 
+        /**
+         * Pomoan
+         */
+        _POMOAN, 
+        /**
+         * Kashaya
+         */
+        XKJU, 
+        /**
+         * Northeastern Pomo
+         */
+        XPEF, 
+        /**
+         * Southeastern Pomo
+         */
+        XPEO, 
+        /**
+         * Southern Pomo
+         */
+        XPEQ, 
+        /**
+         * Central Pomo
+         */
+        XPOO, 
+        /**
+         * Shasta
+         */
+        _SHASTA, 
+        /**
+         * Shasta
+         */
+        XSHT, 
+        /**
+         * Karok
+         */
+        XKYH, 
+        /**
+         * Washoe
+         */
+        XWAS, 
+        /**
+         * Iroquoian
+         */
+        _IROQUOIAN, 
+        /**
+         * NorthernIroquoian
+         */
+        _NORTHERNIROQUOIAN, 
+        /**
+         * Cayuga
+         */
+        XCAY, 
+        /**
+         * Mohawk
+         */
+        XMOH, 
+        /**
+         * Oneida
+         */
+        XONE, 
+        /**
+         * Onondaga
+         */
+        XONO, 
+        /**
+         * Seneca
+         */
+        XSEE, 
+        /**
+         * Tuscarora
+         */
+        XTUS, 
+        /**
+         * Cherokee
+         */
+        XCER, 
+        /**
+         * Keresan
+         */
+        _KERESAN, 
+        /**
+         * Rio Grande Keresan
+         */
+        XKEE, 
+        /**
+         * Acoma-Laguna
+         */
+        XKJQ, 
+        /**
+         * KiowaTanoan
+         */
+        _KIOWATANOAN, 
+        /**
+         * Tiwa
+         */
+        _TIWA, 
+        /**
+         * Northern Tiwa
+         */
+        XTAO, 
+        /**
+         * Southern Tiwa
+         */
+        XTIX, 
+        /**
+         * Kiowa
+         */
+        XKIO, 
+        /**
+         * Tewa
+         */
+        XTEW, 
+        /**
+         * Jemez
+         */
+        XTOW, 
+        /**
+         * Muskogean
+         */
+        _MUSKOGEAN, 
+        /**
+         * CentralMuskogean
+         */
+        _CENTRALMUSKOGEAN, 
+        /**
+         * Alabama
+         */
+        XAKZ, 
+        /**
+         * Koasati
+         */
+        XCKU, 
+        /**
+         * Mikasuki
+         */
+        XMIK, 
+        /**
+         * WesternMuskogean
+         */
+        _WESTERNMUSKOGEAN, 
+        /**
+         * Choctaw
+         */
+        XCCT, 
+        /**
+         * Chickasaw
+         */
+        XCIC, 
+        /**
+         * Creek
+         */
+        XCRK, 
+        /**
+         * Nadene
+         */
+        _NADENE, 
+        /**
+         * AthapaskanEyak
+         */
+        _ATHAPASKANEYAK, 
+        /**
+         * Athapaskan
+         */
+        _ATHAPASKAN, 
+        /**
+         * Apachean
+         */
+        _APACHEAN, 
+        /**
+         * EasternApachean
+         */
+        _EASTERNAPACHEAN, 
+        /**
+         * Jicarilla
+         */
+        XAPJ, 
+        /**
+         * Lipan
+         */
+        XAPL, 
+        /**
+         * WesternApachean
+         */
+        _WESTERNAPACHEAN, 
+        /**
+         * Mescalero-Chiricahua
+         */
+        XAPM, 
+        /**
+         * Western Apache
+         */
+        XAPW, 
+        /**
+         * Dine
+         */
+        XNAV, 
+        /**
+         * Kiowa Apache
+         */
+        XAPK, 
+        /**
+         * CentralAlaskaYukon
+         */
+        _CENTRALALASKAYUKON, 
+        /**
+         * KoyukonIngalik
+         */
+        _KOYUKONINGALIK, 
+        /**
+         * Holikachuk
+         */
+        XHOI, 
+        /**
+         * Degexit'an
+         */
+        XING, 
+        /**
+         * Koyukon
+         */
+        XKOY, 
+        /**
+         * KutchinHan
+         */
+        _KUTCHINHAN, 
+        /**
+         * Han
+         */
+        XHAA, 
+        /**
+         * Kutchin
+         */
+        XKUC, 
+        /**
+         * TananaTutchone
+         */
+        _TANANATUTCHONE, 
+        /**
+         * Tanana
+         */
+        _TANANA, 
+        /**
+         * Lower Tanana
+         */
+        XTAA, 
+        /**
+         * Upper Tanana
+         */
+        XTAU, 
+        /**
+         * Tanacross
+         */
+        XTCB, 
+        /**
+         * Upper Kuskokwim
+         */
+        XKUU, 
+        /**
+         * PacificCoastAthapaskan
+         */
+        _PACIFICCOASTATHAPASKAN, 
+        /**
+         * CaliforniaAthapaskan
+         */
+        _CALIFORNIAATHAPASKAN, 
+        /**
+         * Hupa
+         */
+        XHUP, 
+        /**
+         * Cahto
+         */
+        XKTW, 
+        /**
+         * OregonAthapaskan
+         */
+        _OREGONATHAPASKAN, 
+        /**
+         * Tolowa
+         */
+        XTOL, 
+        /**
+         * Tututni
+         */
+        XTUU, 
+        /**
+         * SouthernAlaska
+         */
+        _SOUTHERNALASKA, 
+        /**
+         * Ahtna
+         */
+        XAHT, 
+        /**
+         * Tanaina
+         */
+        XTFN, 
+        /**
+         * Eyak
+         */
+        XEYA, 
+        /**
+         * Tlingit
+         */
+        XTLI, 
+        /**
+         * Penutian
+         */
+        _PENUTIAN, 
+        /**
+         * Chinookan
+         */
+        _CHINOOKAN, 
+        /**
+         * UpperChinook
+         */
+        _UPPERCHINOOK, 
+        /**
+         * Kiksht
+         */
+        XWAC, 
+        /**
+         * Coosan
+         */
+        _COOSAN, 
+        /**
+         * Hanis
+         */
+        XCOS, 
+        /**
+         * Maiduan
+         */
+        _MAIDUAN, 
+        /**
+         * Northwest Maidu
+         */
+        XMAI, 
+        /**
+         * Northeast Maidu
+         */
+        XNMU, 
+        /**
+         * Nisenan
+         */
+        XNSZ, 
+        /**
+         * PlateauPenutian
+         */
+        _PLATEAUPENUTIAN, 
+        /**
+         * Sahaptian
+         */
+        _SAHAPTIAN, 
+        /**
+         * Umatilla
+         */
+        XUMA, 
+        /**
+         * Walla Walla
+         */
+        XWAA, 
+        /**
+         * Tenino
+         */
+        XWAR, 
+        /**
+         * Yakima
+         */
+        XYAK, 
+        /**
+         * Klamath-Modoc
+         */
+        XKLA, 
+        /**
+         * Nez Perce
+         */
+        XNEZ, 
+        /**
+         * Takelman
+         */
+        _TAKELMAN, 
+        /**
+         * Kalapuyan
+         */
+        _KALAPUYAN, 
+        /**
+         * Central Kalapuyan
+         */
+        XKAL, 
+        /**
+         * Tsimshianic
+         */
+        _TSIMSHIANIC, 
+        /**
+         * Coast Tsimshain
+         */
+        XTSI, 
+        /**
+         * Utian
+         */
+        _UTIAN, 
+        /**
+         * Miwokan
+         */
+        _MIWOKAN, 
+        /**
+         * EasternMiwok
+         */
+        _EASTERNMIWOK, 
+        /**
+         * Central Sierra Miwok
+         */
+        XCSM, 
+        /**
+         * Northern Sierra Miwok
+         */
+        XNSQ, 
+        /**
+         * Plains Miwok
+         */
+        XPMW, 
+        /**
+         * Southern Sierra Miwok
+         */
+        XSKD, 
+        /**
+         * WesternMiwok
+         */
+        _WESTERNMIWOK, 
+        /**
+         * Coast Miwok
+         */
+        XCSI, 
+        /**
+         * Lake Miwok
+         */
+        XLMW, 
+        /**
+         * Wintuan
+         */
+        _WINTUAN, 
+        /**
+         * Wintu-Nomlaki
+         */
+        XWIT, 
+        /**
+         * Yokutsan
+         */
+        _YOKUTSAN, 
+        /**
+         * Kings River
+         */
+        XENH, 
+        /**
+         * Gashowu
+         */
+        XGSH, 
+        /**
+         * Poso Creek
+         */
+        XPYL, 
+        /**
+         * Tule-Kaweah
+         */
+        XTKH, 
+        /**
+         * Pidgin
+         */
+        _PIDGIN, 
+        /**
+         * Chinook Wawa
+         */
+        XCHH, 
+        /**
+         * Salishan
+         */
+        _SALISHAN, 
+        /**
+         * CentralSalish
+         */
+        _CENTRALSALISH, 
+        /**
+         * Clallam
+         */
+        XCLM, 
+        /**
+         * Lushootseed
+         */
+        XLUT, 
+        /**
+         * Northern Straits
+         */
+        XSTR, 
+        /**
+         * InteriorSalish
+         */
+        _INTERIORSALISH, 
+        /**
+         * Columbian
+         */
+        XCOL, 
+        /**
+         * Coeur D'alene
+         */
+        XCRD, 
+        /**
+         * Kalispel
+         */
+        XFLA, 
+        /**
+         * Okanagan
+         */
+        XOKA, 
+        /**
+         * Tsamosan
+         */
+        _TSAMOSAN, 
+        /**
+         * Lower Chehalis
+         */
+        XCEA, 
+        /**
+         * Upper Chehalis
+         */
+        XCJH, 
+        /**
+         * Cowlitz
+         */
+        XCOW, 
+        /**
+         * Quinault
+         */
+        XQUN, 
+        /**
+         * SiouanCatawba
+         */
+        _SIOUANCATAWBA, 
+        /**
+         * Siouan
+         */
+        _SIOUAN, 
+        /**
+         * MississippiValley
+         */
+        _MISSISSIPPIVALLEY, 
+        /**
+         * ChiwereWinnebago
+         */
+        _CHIWEREWINNEBAGO, 
+        /**
+         * Chiwere
+         */
+        XIOW, 
+        /**
+         * Hocak
+         */
+        XWIN, 
+        /**
+         * Dakotan
+         */
+        _DAKOTAN, 
+        /**
+         * Assiniboine
+         */
+        XASB, 
+        /**
+         * Dakota
+         */
+        XDHG, 
+        /**
+         * Lakota
+         */
+        XLKT, 
+        /**
+         * Nakota
+         */
+        XNKT, 
+        /**
+         * Dhegiha
+         */
+        _DHEGIHA, 
+        /**
+         * Kansa
+         */
+        XKAA, 
+        /**
+         * Omaha-Ponca
+         */
+        XOMA, 
+        /**
+         * Osage
+         */
+        XOSA, 
+        /**
+         * Quapaw
+         */
+        XQUA, 
+        /**
+         * MissouriRiver
+         */
+        _MISSOURIRIVER, 
+        /**
+         * Crow
+         */
+        XCRO, 
+        /**
+         * Hidatsa
+         */
+        XHID, 
+        /**
+         * Mandan
+         */
+        XMHQ, 
+        /**
+         * UtoAztecan
+         */
+        _UTOAZTECAN, 
+        /**
+         * Numic
+         */
+        _NUMIC, 
+        /**
+         * CentralNumic
+         */
+        _CENTRALNUMIC, 
+        /**
+         * Comanche
+         */
+        XCOM, 
+        /**
+         * Panamint
+         */
+        XPAR, 
+        /**
+         * Shoshone
+         */
+        XSHH, 
+        /**
+         * SouthernNumic
+         */
+        _SOUTHERNNUMIC, 
+        /**
+         * Kawaiisu
+         */
+        XKAW, 
+        /**
+         * Ute-Southern Paiute
+         */
+        XUTE, 
+        /**
+         * WesternNumic
+         */
+        _WESTERNNUMIC, 
+        /**
+         * Mono
+         */
+        XMON, 
+        /**
+         * Northern Paiute-Bannock
+         */
+        XPAO, 
+        /**
+         * Takic
+         */
+        _TAKIC, 
+        /**
+         * Cupan
+         */
+        _CUPAN, 
+        /**
+         * Cahuilla
+         */
+        XCHL, 
+        /**
+         * Cupeno
+         */
+        XCUP, 
+        /**
+         * Luiseno
+         */
+        XLUI, 
+        /**
+         * SerranoGabrielino
+         */
+        _SERRANOGABRIELINO, 
+        /**
+         * Serrano
+         */
+        XSER, 
+        /**
+         * Taracahitan
+         */
+        _TARACAHITAN, 
+        /**
+         * Cahitan
+         */
+        _CAHITAN, 
+        /**
+         * Yaqui
+         */
+        XYAQ, 
+        /**
+         * Tepiman
+         */
+        _TEPIMAN, 
+        /**
+         * Papago-Pima
+         */
+        XPAP, 
+        /**
+         * Hopi
+         */
+        XHOP, 
+        /**
+         * Tubatululabal
+         */
+        XTUB, 
+        /**
+         * Wakashan
+         */
+        _WAKASHAN, 
+        /**
+         * Nootkan
+         */
+        _NOOTKAN, 
+        /**
+         * Makah
+         */
+        XMYH, 
+        /**
+         * Yukian
+         */
+        _YUKIAN, 
+        /**
+         * Wappo
+         */
+        XWAO, 
+        /**
+         * Yuki
+         */
+        XYUK, 
+        /**
+         * Haida
+         */
+        XHAI, 
+        /**
+         * Kootenai
+         */
+        XKUN, 
+        /**
+         * Plains Indian Sign Language
+         */
+        XPSD, 
+        /**
+         * Yuchi
+         */
+        XYUC, 
+        /**
+         * Zuni
+         */
+        XZUN, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3AmericanIndianAlaskaNativeLanguages fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_Algic".equals(codeString))
+          return _ALGIC;
+        if ("_Algonquian".equals(codeString))
+          return _ALGONQUIAN;
+        if ("_Arapahoan".equals(codeString))
+          return _ARAPAHOAN;
+        if ("_ArapahoGrosVentre".equals(codeString))
+          return _ARAPAHOGROSVENTRE;
+        if ("x-ARP".equals(codeString))
+          return XARP;
+        if ("x-ATS".equals(codeString))
+          return XATS;
+        if ("_CreeMontagnais".equals(codeString))
+          return _CREEMONTAGNAIS;
+        if ("_Cree".equals(codeString))
+          return _CREE;
+        if ("x-CRP".equals(codeString))
+          return XCRP;
+        if ("_EasternAlgonquin".equals(codeString))
+          return _EASTERNALGONQUIN;
+        if ("_Abenakian".equals(codeString))
+          return _ABENAKIAN;
+        if ("x-AAQ".equals(codeString))
+          return XAAQ;
+        if ("x-ABE".equals(codeString))
+          return XABE;
+        if ("x-MAC".equals(codeString))
+          return XMAC;
+        if ("_Delawaran".equals(codeString))
+          return _DELAWARAN;
+        if ("x-DEL".equals(codeString))
+          return XDEL;
+        if ("x-MIC".equals(codeString))
+          return XMIC;
+        if ("_Ojibwayan".equals(codeString))
+          return _OJIBWAYAN;
+        if ("x-OJB".equals(codeString))
+          return XOJB;
+        if ("x-POT".equals(codeString))
+          return XPOT;
+        if ("_SaukFoxKickapoo".equals(codeString))
+          return _SAUKFOXKICKAPOO;
+        if ("x-KIC".equals(codeString))
+          return XKIC;
+        if ("x-SAC".equals(codeString))
+          return XSAC;
+        if ("x-SJW".equals(codeString))
+          return XSJW;
+        if ("x-BLC".equals(codeString))
+          return XBLC;
+        if ("x-CHY".equals(codeString))
+          return XCHY;
+        if ("x-MEZ".equals(codeString))
+          return XMEZ;
+        if ("_Ritwan".equals(codeString))
+          return _RITWAN;
+        if ("x-YUR".equals(codeString))
+          return XYUR;
+        if ("_Caddoan".equals(codeString))
+          return _CADDOAN;
+        if ("_NorthernCaddoan".equals(codeString))
+          return _NORTHERNCADDOAN;
+        if ("x-ARI".equals(codeString))
+          return XARI;
+        if ("x-PAW".equals(codeString))
+          return XPAW;
+        if ("x-WIC".equals(codeString))
+          return XWIC;
+        if ("_SouthernCaddoan".equals(codeString))
+          return _SOUTHERNCADDOAN;
+        if ("x-CAD".equals(codeString))
+          return XCAD;
+        if ("_Chimakuan".equals(codeString))
+          return _CHIMAKUAN;
+        if ("x-QUI".equals(codeString))
+          return XQUI;
+        if ("_EskimoAleut".equals(codeString))
+          return _ESKIMOALEUT;
+        if ("_Aleut".equals(codeString))
+          return _ALEUT;
+        if ("x-ALW".equals(codeString))
+          return XALW;
+        if ("_Eskimoan".equals(codeString))
+          return _ESKIMOAN;
+        if ("_InuitInupiaq".equals(codeString))
+          return _INUITINUPIAQ;
+        if ("x-ESI".equals(codeString))
+          return XESI;
+        if ("x-ESK".equals(codeString))
+          return XESK;
+        if ("_SirenikskiYupik".equals(codeString))
+          return _SIRENIKSKIYUPIK;
+        if ("x-EMS".equals(codeString))
+          return XEMS;
+        if ("x-ESS".equals(codeString))
+          return XESS;
+        if ("x-ESU".equals(codeString))
+          return XESU;
+        if ("_Hokan".equals(codeString))
+          return _HOKAN;
+        if ("_CochimiYuman".equals(codeString))
+          return _COCHIMIYUMAN;
+        if ("_Yuman".equals(codeString))
+          return _YUMAN;
+        if ("_DeltaCalifornia".equals(codeString))
+          return _DELTACALIFORNIA;
+        if ("_Diegueno".equals(codeString))
+          return _DIEGUENO;
+        if ("x-DIH".equals(codeString))
+          return XDIH;
+        if ("x-COC".equals(codeString))
+          return XCOC;
+        if ("_Pai".equals(codeString))
+          return _PAI;
+        if ("x-YUF".equals(codeString))
+          return XYUF;
+        if ("_River".equals(codeString))
+          return _RIVER;
+        if ("x-MOV".equals(codeString))
+          return XMOV;
+        if ("x-MRC".equals(codeString))
+          return XMRC;
+        if ("x-YUM".equals(codeString))
+          return XYUM;
+        if ("_Palaihnihan".equals(codeString))
+          return _PALAIHNIHAN;
+        if ("x-ACH".equals(codeString))
+          return XACH;
+        if ("x-ATW".equals(codeString))
+          return XATW;
+        if ("_Pomoan".equals(codeString))
+          return _POMOAN;
+        if ("x-KJU".equals(codeString))
+          return XKJU;
+        if ("x-PEF".equals(codeString))
+          return XPEF;
+        if ("x-PEO".equals(codeString))
+          return XPEO;
+        if ("x-PEQ".equals(codeString))
+          return XPEQ;
+        if ("x-POO".equals(codeString))
+          return XPOO;
+        if ("_Shasta".equals(codeString))
+          return _SHASTA;
+        if ("x-SHT".equals(codeString))
+          return XSHT;
+        if ("x-KYH".equals(codeString))
+          return XKYH;
+        if ("x-WAS".equals(codeString))
+          return XWAS;
+        if ("_Iroquoian".equals(codeString))
+          return _IROQUOIAN;
+        if ("_NorthernIroquoian".equals(codeString))
+          return _NORTHERNIROQUOIAN;
+        if ("x-CAY".equals(codeString))
+          return XCAY;
+        if ("x-MOH".equals(codeString))
+          return XMOH;
+        if ("x-ONE".equals(codeString))
+          return XONE;
+        if ("x-ONO".equals(codeString))
+          return XONO;
+        if ("x-SEE".equals(codeString))
+          return XSEE;
+        if ("x-TUS".equals(codeString))
+          return XTUS;
+        if ("x-CER".equals(codeString))
+          return XCER;
+        if ("_Keresan".equals(codeString))
+          return _KERESAN;
+        if ("x-KEE".equals(codeString))
+          return XKEE;
+        if ("x-KJQ".equals(codeString))
+          return XKJQ;
+        if ("_KiowaTanoan".equals(codeString))
+          return _KIOWATANOAN;
+        if ("_Tiwa".equals(codeString))
+          return _TIWA;
+        if ("x-TAO".equals(codeString))
+          return XTAO;
+        if ("x-TIX".equals(codeString))
+          return XTIX;
+        if ("x-KIO".equals(codeString))
+          return XKIO;
+        if ("x-TEW".equals(codeString))
+          return XTEW;
+        if ("x-TOW".equals(codeString))
+          return XTOW;
+        if ("_Muskogean".equals(codeString))
+          return _MUSKOGEAN;
+        if ("_CentralMuskogean".equals(codeString))
+          return _CENTRALMUSKOGEAN;
+        if ("x-AKZ".equals(codeString))
+          return XAKZ;
+        if ("x-CKU".equals(codeString))
+          return XCKU;
+        if ("x-MIK".equals(codeString))
+          return XMIK;
+        if ("_WesternMuskogean".equals(codeString))
+          return _WESTERNMUSKOGEAN;
+        if ("x-CCT".equals(codeString))
+          return XCCT;
+        if ("x-CIC".equals(codeString))
+          return XCIC;
+        if ("x-CRK".equals(codeString))
+          return XCRK;
+        if ("_Nadene".equals(codeString))
+          return _NADENE;
+        if ("_AthapaskanEyak".equals(codeString))
+          return _ATHAPASKANEYAK;
+        if ("_Athapaskan".equals(codeString))
+          return _ATHAPASKAN;
+        if ("_Apachean".equals(codeString))
+          return _APACHEAN;
+        if ("_EasternApachean".equals(codeString))
+          return _EASTERNAPACHEAN;
+        if ("x-APJ".equals(codeString))
+          return XAPJ;
+        if ("x-APL".equals(codeString))
+          return XAPL;
+        if ("_WesternApachean".equals(codeString))
+          return _WESTERNAPACHEAN;
+        if ("x-APM".equals(codeString))
+          return XAPM;
+        if ("x-APW".equals(codeString))
+          return XAPW;
+        if ("x-NAV".equals(codeString))
+          return XNAV;
+        if ("x-APK".equals(codeString))
+          return XAPK;
+        if ("_CentralAlaskaYukon".equals(codeString))
+          return _CENTRALALASKAYUKON;
+        if ("_KoyukonIngalik".equals(codeString))
+          return _KOYUKONINGALIK;
+        if ("x-HOI".equals(codeString))
+          return XHOI;
+        if ("x-ING".equals(codeString))
+          return XING;
+        if ("x-KOY".equals(codeString))
+          return XKOY;
+        if ("_KutchinHan".equals(codeString))
+          return _KUTCHINHAN;
+        if ("x-HAA".equals(codeString))
+          return XHAA;
+        if ("x-KUC".equals(codeString))
+          return XKUC;
+        if ("_TananaTutchone".equals(codeString))
+          return _TANANATUTCHONE;
+        if ("_Tanana".equals(codeString))
+          return _TANANA;
+        if ("x-TAA".equals(codeString))
+          return XTAA;
+        if ("x-TAU".equals(codeString))
+          return XTAU;
+        if ("x-TCB".equals(codeString))
+          return XTCB;
+        if ("x-KUU".equals(codeString))
+          return XKUU;
+        if ("_PacificCoastAthapaskan".equals(codeString))
+          return _PACIFICCOASTATHAPASKAN;
+        if ("_CaliforniaAthapaskan".equals(codeString))
+          return _CALIFORNIAATHAPASKAN;
+        if ("x-HUP".equals(codeString))
+          return XHUP;
+        if ("x-KTW".equals(codeString))
+          return XKTW;
+        if ("_OregonAthapaskan".equals(codeString))
+          return _OREGONATHAPASKAN;
+        if ("x-TOL".equals(codeString))
+          return XTOL;
+        if ("x-TUU".equals(codeString))
+          return XTUU;
+        if ("_SouthernAlaska".equals(codeString))
+          return _SOUTHERNALASKA;
+        if ("x-AHT".equals(codeString))
+          return XAHT;
+        if ("x-TFN".equals(codeString))
+          return XTFN;
+        if ("x-EYA".equals(codeString))
+          return XEYA;
+        if ("x-TLI".equals(codeString))
+          return XTLI;
+        if ("_Penutian".equals(codeString))
+          return _PENUTIAN;
+        if ("_Chinookan".equals(codeString))
+          return _CHINOOKAN;
+        if ("_UpperChinook".equals(codeString))
+          return _UPPERCHINOOK;
+        if ("x-WAC".equals(codeString))
+          return XWAC;
+        if ("_Coosan".equals(codeString))
+          return _COOSAN;
+        if ("x-COS".equals(codeString))
+          return XCOS;
+        if ("_Maiduan".equals(codeString))
+          return _MAIDUAN;
+        if ("x-MAI".equals(codeString))
+          return XMAI;
+        if ("x-NMU".equals(codeString))
+          return XNMU;
+        if ("x-NSZ".equals(codeString))
+          return XNSZ;
+        if ("_PlateauPenutian".equals(codeString))
+          return _PLATEAUPENUTIAN;
+        if ("_Sahaptian".equals(codeString))
+          return _SAHAPTIAN;
+        if ("x-UMA".equals(codeString))
+          return XUMA;
+        if ("x-WAA".equals(codeString))
+          return XWAA;
+        if ("x-WAR".equals(codeString))
+          return XWAR;
+        if ("x-YAK".equals(codeString))
+          return XYAK;
+        if ("x-KLA".equals(codeString))
+          return XKLA;
+        if ("x-NEZ".equals(codeString))
+          return XNEZ;
+        if ("_Takelman".equals(codeString))
+          return _TAKELMAN;
+        if ("_Kalapuyan".equals(codeString))
+          return _KALAPUYAN;
+        if ("x-KAL".equals(codeString))
+          return XKAL;
+        if ("_Tsimshianic".equals(codeString))
+          return _TSIMSHIANIC;
+        if ("x-TSI".equals(codeString))
+          return XTSI;
+        if ("_Utian".equals(codeString))
+          return _UTIAN;
+        if ("_Miwokan".equals(codeString))
+          return _MIWOKAN;
+        if ("_EasternMiwok".equals(codeString))
+          return _EASTERNMIWOK;
+        if ("x-CSM".equals(codeString))
+          return XCSM;
+        if ("x-NSQ".equals(codeString))
+          return XNSQ;
+        if ("x-PMW".equals(codeString))
+          return XPMW;
+        if ("x-SKD".equals(codeString))
+          return XSKD;
+        if ("_WesternMiwok".equals(codeString))
+          return _WESTERNMIWOK;
+        if ("x-CSI".equals(codeString))
+          return XCSI;
+        if ("x-LMW".equals(codeString))
+          return XLMW;
+        if ("_Wintuan".equals(codeString))
+          return _WINTUAN;
+        if ("x-WIT".equals(codeString))
+          return XWIT;
+        if ("_Yokutsan".equals(codeString))
+          return _YOKUTSAN;
+        if ("x-ENH".equals(codeString))
+          return XENH;
+        if ("x-GSH".equals(codeString))
+          return XGSH;
+        if ("x-PYL".equals(codeString))
+          return XPYL;
+        if ("x-TKH".equals(codeString))
+          return XTKH;
+        if ("_Pidgin".equals(codeString))
+          return _PIDGIN;
+        if ("x-CHH".equals(codeString))
+          return XCHH;
+        if ("_Salishan".equals(codeString))
+          return _SALISHAN;
+        if ("_CentralSalish".equals(codeString))
+          return _CENTRALSALISH;
+        if ("x-CLM".equals(codeString))
+          return XCLM;
+        if ("x-LUT".equals(codeString))
+          return XLUT;
+        if ("x-STR".equals(codeString))
+          return XSTR;
+        if ("_InteriorSalish".equals(codeString))
+          return _INTERIORSALISH;
+        if ("x-COL".equals(codeString))
+          return XCOL;
+        if ("x-CRD".equals(codeString))
+          return XCRD;
+        if ("x-FLA".equals(codeString))
+          return XFLA;
+        if ("x-OKA".equals(codeString))
+          return XOKA;
+        if ("_Tsamosan".equals(codeString))
+          return _TSAMOSAN;
+        if ("x-CEA".equals(codeString))
+          return XCEA;
+        if ("x-CJH".equals(codeString))
+          return XCJH;
+        if ("x-COW".equals(codeString))
+          return XCOW;
+        if ("x-QUN".equals(codeString))
+          return XQUN;
+        if ("_SiouanCatawba".equals(codeString))
+          return _SIOUANCATAWBA;
+        if ("_Siouan".equals(codeString))
+          return _SIOUAN;
+        if ("_MississippiValley".equals(codeString))
+          return _MISSISSIPPIVALLEY;
+        if ("_ChiwereWinnebago".equals(codeString))
+          return _CHIWEREWINNEBAGO;
+        if ("x-IOW".equals(codeString))
+          return XIOW;
+        if ("x-WIN".equals(codeString))
+          return XWIN;
+        if ("_Dakotan".equals(codeString))
+          return _DAKOTAN;
+        if ("x-ASB".equals(codeString))
+          return XASB;
+        if ("x-DHG".equals(codeString))
+          return XDHG;
+        if ("x-LKT".equals(codeString))
+          return XLKT;
+        if ("x-NKT".equals(codeString))
+          return XNKT;
+        if ("_Dhegiha".equals(codeString))
+          return _DHEGIHA;
+        if ("x-KAA".equals(codeString))
+          return XKAA;
+        if ("x-OMA".equals(codeString))
+          return XOMA;
+        if ("x-OSA".equals(codeString))
+          return XOSA;
+        if ("x-QUA".equals(codeString))
+          return XQUA;
+        if ("_MissouriRiver".equals(codeString))
+          return _MISSOURIRIVER;
+        if ("x-CRO".equals(codeString))
+          return XCRO;
+        if ("x-HID".equals(codeString))
+          return XHID;
+        if ("x-MHQ".equals(codeString))
+          return XMHQ;
+        if ("_UtoAztecan".equals(codeString))
+          return _UTOAZTECAN;
+        if ("_Numic".equals(codeString))
+          return _NUMIC;
+        if ("_CentralNumic".equals(codeString))
+          return _CENTRALNUMIC;
+        if ("x-COM".equals(codeString))
+          return XCOM;
+        if ("x-PAR".equals(codeString))
+          return XPAR;
+        if ("x-SHH".equals(codeString))
+          return XSHH;
+        if ("_SouthernNumic".equals(codeString))
+          return _SOUTHERNNUMIC;
+        if ("x-KAW".equals(codeString))
+          return XKAW;
+        if ("x-UTE".equals(codeString))
+          return XUTE;
+        if ("_WesternNumic".equals(codeString))
+          return _WESTERNNUMIC;
+        if ("x-MON".equals(codeString))
+          return XMON;
+        if ("x-PAO".equals(codeString))
+          return XPAO;
+        if ("_Takic".equals(codeString))
+          return _TAKIC;
+        if ("_Cupan".equals(codeString))
+          return _CUPAN;
+        if ("x-CHL".equals(codeString))
+          return XCHL;
+        if ("x-CUP".equals(codeString))
+          return XCUP;
+        if ("x-LUI".equals(codeString))
+          return XLUI;
+        if ("_SerranoGabrielino".equals(codeString))
+          return _SERRANOGABRIELINO;
+        if ("x-SER".equals(codeString))
+          return XSER;
+        if ("_Taracahitan".equals(codeString))
+          return _TARACAHITAN;
+        if ("_Cahitan".equals(codeString))
+          return _CAHITAN;
+        if ("x-YAQ".equals(codeString))
+          return XYAQ;
+        if ("_Tepiman".equals(codeString))
+          return _TEPIMAN;
+        if ("x-PAP".equals(codeString))
+          return XPAP;
+        if ("x-HOP".equals(codeString))
+          return XHOP;
+        if ("x-TUB".equals(codeString))
+          return XTUB;
+        if ("_Wakashan".equals(codeString))
+          return _WAKASHAN;
+        if ("_Nootkan".equals(codeString))
+          return _NOOTKAN;
+        if ("x-MYH".equals(codeString))
+          return XMYH;
+        if ("_Yukian".equals(codeString))
+          return _YUKIAN;
+        if ("x-WAO".equals(codeString))
+          return XWAO;
+        if ("x-YUK".equals(codeString))
+          return XYUK;
+        if ("x-HAI".equals(codeString))
+          return XHAI;
+        if ("x-KUN".equals(codeString))
+          return XKUN;
+        if ("x-PSD".equals(codeString))
+          return XPSD;
+        if ("x-YUC".equals(codeString))
+          return XYUC;
+        if ("x-ZUN".equals(codeString))
+          return XZUN;
+        throw new FHIRException("Unknown V3AmericanIndianAlaskaNativeLanguages code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ALGIC: return "_Algic";
+            case _ALGONQUIAN: return "_Algonquian";
+            case _ARAPAHOAN: return "_Arapahoan";
+            case _ARAPAHOGROSVENTRE: return "_ArapahoGrosVentre";
+            case XARP: return "x-ARP";
+            case XATS: return "x-ATS";
+            case _CREEMONTAGNAIS: return "_CreeMontagnais";
+            case _CREE: return "_Cree";
+            case XCRP: return "x-CRP";
+            case _EASTERNALGONQUIN: return "_EasternAlgonquin";
+            case _ABENAKIAN: return "_Abenakian";
+            case XAAQ: return "x-AAQ";
+            case XABE: return "x-ABE";
+            case XMAC: return "x-MAC";
+            case _DELAWARAN: return "_Delawaran";
+            case XDEL: return "x-DEL";
+            case XMIC: return "x-MIC";
+            case _OJIBWAYAN: return "_Ojibwayan";
+            case XOJB: return "x-OJB";
+            case XPOT: return "x-POT";
+            case _SAUKFOXKICKAPOO: return "_SaukFoxKickapoo";
+            case XKIC: return "x-KIC";
+            case XSAC: return "x-SAC";
+            case XSJW: return "x-SJW";
+            case XBLC: return "x-BLC";
+            case XCHY: return "x-CHY";
+            case XMEZ: return "x-MEZ";
+            case _RITWAN: return "_Ritwan";
+            case XYUR: return "x-YUR";
+            case _CADDOAN: return "_Caddoan";
+            case _NORTHERNCADDOAN: return "_NorthernCaddoan";
+            case XARI: return "x-ARI";
+            case XPAW: return "x-PAW";
+            case XWIC: return "x-WIC";
+            case _SOUTHERNCADDOAN: return "_SouthernCaddoan";
+            case XCAD: return "x-CAD";
+            case _CHIMAKUAN: return "_Chimakuan";
+            case XQUI: return "x-QUI";
+            case _ESKIMOALEUT: return "_EskimoAleut";
+            case _ALEUT: return "_Aleut";
+            case XALW: return "x-ALW";
+            case _ESKIMOAN: return "_Eskimoan";
+            case _INUITINUPIAQ: return "_InuitInupiaq";
+            case XESI: return "x-ESI";
+            case XESK: return "x-ESK";
+            case _SIRENIKSKIYUPIK: return "_SirenikskiYupik";
+            case XEMS: return "x-EMS";
+            case XESS: return "x-ESS";
+            case XESU: return "x-ESU";
+            case _HOKAN: return "_Hokan";
+            case _COCHIMIYUMAN: return "_CochimiYuman";
+            case _YUMAN: return "_Yuman";
+            case _DELTACALIFORNIA: return "_DeltaCalifornia";
+            case _DIEGUENO: return "_Diegueno";
+            case XDIH: return "x-DIH";
+            case XCOC: return "x-COC";
+            case _PAI: return "_Pai";
+            case XYUF: return "x-YUF";
+            case _RIVER: return "_River";
+            case XMOV: return "x-MOV";
+            case XMRC: return "x-MRC";
+            case XYUM: return "x-YUM";
+            case _PALAIHNIHAN: return "_Palaihnihan";
+            case XACH: return "x-ACH";
+            case XATW: return "x-ATW";
+            case _POMOAN: return "_Pomoan";
+            case XKJU: return "x-KJU";
+            case XPEF: return "x-PEF";
+            case XPEO: return "x-PEO";
+            case XPEQ: return "x-PEQ";
+            case XPOO: return "x-POO";
+            case _SHASTA: return "_Shasta";
+            case XSHT: return "x-SHT";
+            case XKYH: return "x-KYH";
+            case XWAS: return "x-WAS";
+            case _IROQUOIAN: return "_Iroquoian";
+            case _NORTHERNIROQUOIAN: return "_NorthernIroquoian";
+            case XCAY: return "x-CAY";
+            case XMOH: return "x-MOH";
+            case XONE: return "x-ONE";
+            case XONO: return "x-ONO";
+            case XSEE: return "x-SEE";
+            case XTUS: return "x-TUS";
+            case XCER: return "x-CER";
+            case _KERESAN: return "_Keresan";
+            case XKEE: return "x-KEE";
+            case XKJQ: return "x-KJQ";
+            case _KIOWATANOAN: return "_KiowaTanoan";
+            case _TIWA: return "_Tiwa";
+            case XTAO: return "x-TAO";
+            case XTIX: return "x-TIX";
+            case XKIO: return "x-KIO";
+            case XTEW: return "x-TEW";
+            case XTOW: return "x-TOW";
+            case _MUSKOGEAN: return "_Muskogean";
+            case _CENTRALMUSKOGEAN: return "_CentralMuskogean";
+            case XAKZ: return "x-AKZ";
+            case XCKU: return "x-CKU";
+            case XMIK: return "x-MIK";
+            case _WESTERNMUSKOGEAN: return "_WesternMuskogean";
+            case XCCT: return "x-CCT";
+            case XCIC: return "x-CIC";
+            case XCRK: return "x-CRK";
+            case _NADENE: return "_Nadene";
+            case _ATHAPASKANEYAK: return "_AthapaskanEyak";
+            case _ATHAPASKAN: return "_Athapaskan";
+            case _APACHEAN: return "_Apachean";
+            case _EASTERNAPACHEAN: return "_EasternApachean";
+            case XAPJ: return "x-APJ";
+            case XAPL: return "x-APL";
+            case _WESTERNAPACHEAN: return "_WesternApachean";
+            case XAPM: return "x-APM";
+            case XAPW: return "x-APW";
+            case XNAV: return "x-NAV";
+            case XAPK: return "x-APK";
+            case _CENTRALALASKAYUKON: return "_CentralAlaskaYukon";
+            case _KOYUKONINGALIK: return "_KoyukonIngalik";
+            case XHOI: return "x-HOI";
+            case XING: return "x-ING";
+            case XKOY: return "x-KOY";
+            case _KUTCHINHAN: return "_KutchinHan";
+            case XHAA: return "x-HAA";
+            case XKUC: return "x-KUC";
+            case _TANANATUTCHONE: return "_TananaTutchone";
+            case _TANANA: return "_Tanana";
+            case XTAA: return "x-TAA";
+            case XTAU: return "x-TAU";
+            case XTCB: return "x-TCB";
+            case XKUU: return "x-KUU";
+            case _PACIFICCOASTATHAPASKAN: return "_PacificCoastAthapaskan";
+            case _CALIFORNIAATHAPASKAN: return "_CaliforniaAthapaskan";
+            case XHUP: return "x-HUP";
+            case XKTW: return "x-KTW";
+            case _OREGONATHAPASKAN: return "_OregonAthapaskan";
+            case XTOL: return "x-TOL";
+            case XTUU: return "x-TUU";
+            case _SOUTHERNALASKA: return "_SouthernAlaska";
+            case XAHT: return "x-AHT";
+            case XTFN: return "x-TFN";
+            case XEYA: return "x-EYA";
+            case XTLI: return "x-TLI";
+            case _PENUTIAN: return "_Penutian";
+            case _CHINOOKAN: return "_Chinookan";
+            case _UPPERCHINOOK: return "_UpperChinook";
+            case XWAC: return "x-WAC";
+            case _COOSAN: return "_Coosan";
+            case XCOS: return "x-COS";
+            case _MAIDUAN: return "_Maiduan";
+            case XMAI: return "x-MAI";
+            case XNMU: return "x-NMU";
+            case XNSZ: return "x-NSZ";
+            case _PLATEAUPENUTIAN: return "_PlateauPenutian";
+            case _SAHAPTIAN: return "_Sahaptian";
+            case XUMA: return "x-UMA";
+            case XWAA: return "x-WAA";
+            case XWAR: return "x-WAR";
+            case XYAK: return "x-YAK";
+            case XKLA: return "x-KLA";
+            case XNEZ: return "x-NEZ";
+            case _TAKELMAN: return "_Takelman";
+            case _KALAPUYAN: return "_Kalapuyan";
+            case XKAL: return "x-KAL";
+            case _TSIMSHIANIC: return "_Tsimshianic";
+            case XTSI: return "x-TSI";
+            case _UTIAN: return "_Utian";
+            case _MIWOKAN: return "_Miwokan";
+            case _EASTERNMIWOK: return "_EasternMiwok";
+            case XCSM: return "x-CSM";
+            case XNSQ: return "x-NSQ";
+            case XPMW: return "x-PMW";
+            case XSKD: return "x-SKD";
+            case _WESTERNMIWOK: return "_WesternMiwok";
+            case XCSI: return "x-CSI";
+            case XLMW: return "x-LMW";
+            case _WINTUAN: return "_Wintuan";
+            case XWIT: return "x-WIT";
+            case _YOKUTSAN: return "_Yokutsan";
+            case XENH: return "x-ENH";
+            case XGSH: return "x-GSH";
+            case XPYL: return "x-PYL";
+            case XTKH: return "x-TKH";
+            case _PIDGIN: return "_Pidgin";
+            case XCHH: return "x-CHH";
+            case _SALISHAN: return "_Salishan";
+            case _CENTRALSALISH: return "_CentralSalish";
+            case XCLM: return "x-CLM";
+            case XLUT: return "x-LUT";
+            case XSTR: return "x-STR";
+            case _INTERIORSALISH: return "_InteriorSalish";
+            case XCOL: return "x-COL";
+            case XCRD: return "x-CRD";
+            case XFLA: return "x-FLA";
+            case XOKA: return "x-OKA";
+            case _TSAMOSAN: return "_Tsamosan";
+            case XCEA: return "x-CEA";
+            case XCJH: return "x-CJH";
+            case XCOW: return "x-COW";
+            case XQUN: return "x-QUN";
+            case _SIOUANCATAWBA: return "_SiouanCatawba";
+            case _SIOUAN: return "_Siouan";
+            case _MISSISSIPPIVALLEY: return "_MississippiValley";
+            case _CHIWEREWINNEBAGO: return "_ChiwereWinnebago";
+            case XIOW: return "x-IOW";
+            case XWIN: return "x-WIN";
+            case _DAKOTAN: return "_Dakotan";
+            case XASB: return "x-ASB";
+            case XDHG: return "x-DHG";
+            case XLKT: return "x-LKT";
+            case XNKT: return "x-NKT";
+            case _DHEGIHA: return "_Dhegiha";
+            case XKAA: return "x-KAA";
+            case XOMA: return "x-OMA";
+            case XOSA: return "x-OSA";
+            case XQUA: return "x-QUA";
+            case _MISSOURIRIVER: return "_MissouriRiver";
+            case XCRO: return "x-CRO";
+            case XHID: return "x-HID";
+            case XMHQ: return "x-MHQ";
+            case _UTOAZTECAN: return "_UtoAztecan";
+            case _NUMIC: return "_Numic";
+            case _CENTRALNUMIC: return "_CentralNumic";
+            case XCOM: return "x-COM";
+            case XPAR: return "x-PAR";
+            case XSHH: return "x-SHH";
+            case _SOUTHERNNUMIC: return "_SouthernNumic";
+            case XKAW: return "x-KAW";
+            case XUTE: return "x-UTE";
+            case _WESTERNNUMIC: return "_WesternNumic";
+            case XMON: return "x-MON";
+            case XPAO: return "x-PAO";
+            case _TAKIC: return "_Takic";
+            case _CUPAN: return "_Cupan";
+            case XCHL: return "x-CHL";
+            case XCUP: return "x-CUP";
+            case XLUI: return "x-LUI";
+            case _SERRANOGABRIELINO: return "_SerranoGabrielino";
+            case XSER: return "x-SER";
+            case _TARACAHITAN: return "_Taracahitan";
+            case _CAHITAN: return "_Cahitan";
+            case XYAQ: return "x-YAQ";
+            case _TEPIMAN: return "_Tepiman";
+            case XPAP: return "x-PAP";
+            case XHOP: return "x-HOP";
+            case XTUB: return "x-TUB";
+            case _WAKASHAN: return "_Wakashan";
+            case _NOOTKAN: return "_Nootkan";
+            case XMYH: return "x-MYH";
+            case _YUKIAN: return "_Yukian";
+            case XWAO: return "x-WAO";
+            case XYUK: return "x-YUK";
+            case XHAI: return "x-HAI";
+            case XKUN: return "x-KUN";
+            case XPSD: return "x-PSD";
+            case XYUC: return "x-YUC";
+            case XZUN: return "x-ZUN";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/AmericanIndianAlaskaNativeLanguages";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ALGIC: return "Algic";
+            case _ALGONQUIAN: return "Algonquian";
+            case _ARAPAHOAN: return "Arapahoan";
+            case _ARAPAHOGROSVENTRE: return "ArapahoGrosVentre";
+            case XARP: return "Arapaho";
+            case XATS: return "Gros Ventre";
+            case _CREEMONTAGNAIS: return "CreeMontagnais";
+            case _CREE: return "Cree";
+            case XCRP: return "Western Cree";
+            case _EASTERNALGONQUIN: return "EasternAlgonquin";
+            case _ABENAKIAN: return "Abenakian";
+            case XAAQ: return "Eastern Abenaki";
+            case XABE: return "Western Abenaki";
+            case XMAC: return "Maliseet-Passamaquoddy";
+            case _DELAWARAN: return "Delawaran";
+            case XDEL: return "Unami Delaware";
+            case XMIC: return "Micmac";
+            case _OJIBWAYAN: return "Ojibwayan";
+            case XOJB: return "Southern Ojibwa";
+            case XPOT: return "Potawatami";
+            case _SAUKFOXKICKAPOO: return "SaukFoxKickapoo";
+            case XKIC: return "Kickapoo";
+            case XSAC: return "Mesquakie";
+            case XSJW: return "Shawnee";
+            case XBLC: return "Blackfoot";
+            case XCHY: return "Cheyenne";
+            case XMEZ: return "Menominee";
+            case _RITWAN: return "Ritwan";
+            case XYUR: return "Yurok";
+            case _CADDOAN: return "Caddoan";
+            case _NORTHERNCADDOAN: return "NorthernCaddoan";
+            case XARI: return "Arikara";
+            case XPAW: return "Pawnee";
+            case XWIC: return "Wichita";
+            case _SOUTHERNCADDOAN: return "SouthernCaddoan";
+            case XCAD: return "Caddo";
+            case _CHIMAKUAN: return "Chimakuan";
+            case XQUI: return "Quileute";
+            case _ESKIMOALEUT: return "EskimoAleut";
+            case _ALEUT: return "Aleut";
+            case XALW: return "Aleut";
+            case _ESKIMOAN: return "Eskimoan";
+            case _INUITINUPIAQ: return "InuitInupiaq";
+            case XESI: return "North Alaskan Inuktitut";
+            case XESK: return "Northwest Alaska Inuktitut";
+            case _SIRENIKSKIYUPIK: return "SirenikskiYupik";
+            case XEMS: return "Pacific Yupik Gulf";
+            case XESS: return "Central Siberian Yupik";
+            case XESU: return "Central Alaskan Yupik";
+            case _HOKAN: return "Hokan";
+            case _COCHIMIYUMAN: return "CochimiYuman";
+            case _YUMAN: return "Yuman";
+            case _DELTACALIFORNIA: return "DeltaCalifornia";
+            case _DIEGUENO: return "Diegueno";
+            case XDIH: return "Kumeyaay";
+            case XCOC: return "Cocopa";
+            case _PAI: return "Pai";
+            case XYUF: return "Havasupai";
+            case _RIVER: return "River";
+            case XMOV: return "Mohave";
+            case XMRC: return "Maricopa";
+            case XYUM: return "Quechan";
+            case _PALAIHNIHAN: return "Palaihnihan";
+            case XACH: return "Achumawi";
+            case XATW: return "Atsugewi";
+            case _POMOAN: return "Pomoan";
+            case XKJU: return "Kashaya";
+            case XPEF: return "Northeastern Pomo";
+            case XPEO: return "Southeastern Pomo";
+            case XPEQ: return "Southern Pomo";
+            case XPOO: return "Central Pomo";
+            case _SHASTA: return "Shasta";
+            case XSHT: return "Shasta";
+            case XKYH: return "Karok";
+            case XWAS: return "Washoe";
+            case _IROQUOIAN: return "Iroquoian";
+            case _NORTHERNIROQUOIAN: return "NorthernIroquoian";
+            case XCAY: return "Cayuga";
+            case XMOH: return "Mohawk";
+            case XONE: return "Oneida";
+            case XONO: return "Onondaga";
+            case XSEE: return "Seneca";
+            case XTUS: return "Tuscarora";
+            case XCER: return "Cherokee";
+            case _KERESAN: return "Keresan";
+            case XKEE: return "Rio Grande Keresan";
+            case XKJQ: return "Acoma-Laguna";
+            case _KIOWATANOAN: return "KiowaTanoan";
+            case _TIWA: return "Tiwa";
+            case XTAO: return "Northern Tiwa";
+            case XTIX: return "Southern Tiwa";
+            case XKIO: return "Kiowa";
+            case XTEW: return "Tewa";
+            case XTOW: return "Jemez";
+            case _MUSKOGEAN: return "Muskogean";
+            case _CENTRALMUSKOGEAN: return "CentralMuskogean";
+            case XAKZ: return "Alabama";
+            case XCKU: return "Koasati";
+            case XMIK: return "Mikasuki";
+            case _WESTERNMUSKOGEAN: return "WesternMuskogean";
+            case XCCT: return "Choctaw";
+            case XCIC: return "Chickasaw";
+            case XCRK: return "Creek";
+            case _NADENE: return "Nadene";
+            case _ATHAPASKANEYAK: return "AthapaskanEyak";
+            case _ATHAPASKAN: return "Athapaskan";
+            case _APACHEAN: return "Apachean";
+            case _EASTERNAPACHEAN: return "EasternApachean";
+            case XAPJ: return "Jicarilla";
+            case XAPL: return "Lipan";
+            case _WESTERNAPACHEAN: return "WesternApachean";
+            case XAPM: return "Mescalero-Chiricahua";
+            case XAPW: return "Western Apache";
+            case XNAV: return "Dine";
+            case XAPK: return "Kiowa Apache";
+            case _CENTRALALASKAYUKON: return "CentralAlaskaYukon";
+            case _KOYUKONINGALIK: return "KoyukonIngalik";
+            case XHOI: return "Holikachuk";
+            case XING: return "Degexit'an";
+            case XKOY: return "Koyukon";
+            case _KUTCHINHAN: return "KutchinHan";
+            case XHAA: return "Han";
+            case XKUC: return "Kutchin";
+            case _TANANATUTCHONE: return "TananaTutchone";
+            case _TANANA: return "Tanana";
+            case XTAA: return "Lower Tanana";
+            case XTAU: return "Upper Tanana";
+            case XTCB: return "Tanacross";
+            case XKUU: return "Upper Kuskokwim";
+            case _PACIFICCOASTATHAPASKAN: return "PacificCoastAthapaskan";
+            case _CALIFORNIAATHAPASKAN: return "CaliforniaAthapaskan";
+            case XHUP: return "Hupa";
+            case XKTW: return "Cahto";
+            case _OREGONATHAPASKAN: return "OregonAthapaskan";
+            case XTOL: return "Tolowa";
+            case XTUU: return "Tututni";
+            case _SOUTHERNALASKA: return "SouthernAlaska";
+            case XAHT: return "Ahtna";
+            case XTFN: return "Tanaina";
+            case XEYA: return "Eyak";
+            case XTLI: return "Tlingit";
+            case _PENUTIAN: return "Penutian";
+            case _CHINOOKAN: return "Chinookan";
+            case _UPPERCHINOOK: return "UpperChinook";
+            case XWAC: return "Kiksht";
+            case _COOSAN: return "Coosan";
+            case XCOS: return "Hanis";
+            case _MAIDUAN: return "Maiduan";
+            case XMAI: return "Northwest Maidu";
+            case XNMU: return "Northeast Maidu";
+            case XNSZ: return "Nisenan";
+            case _PLATEAUPENUTIAN: return "PlateauPenutian";
+            case _SAHAPTIAN: return "Sahaptian";
+            case XUMA: return "Umatilla";
+            case XWAA: return "Walla Walla";
+            case XWAR: return "Tenino";
+            case XYAK: return "Yakima";
+            case XKLA: return "Klamath-Modoc";
+            case XNEZ: return "Nez Perce";
+            case _TAKELMAN: return "Takelman";
+            case _KALAPUYAN: return "Kalapuyan";
+            case XKAL: return "Central Kalapuyan";
+            case _TSIMSHIANIC: return "Tsimshianic";
+            case XTSI: return "Coast Tsimshain";
+            case _UTIAN: return "Utian";
+            case _MIWOKAN: return "Miwokan";
+            case _EASTERNMIWOK: return "EasternMiwok";
+            case XCSM: return "Central Sierra Miwok";
+            case XNSQ: return "Northern Sierra Miwok";
+            case XPMW: return "Plains Miwok";
+            case XSKD: return "Southern Sierra Miwok";
+            case _WESTERNMIWOK: return "WesternMiwok";
+            case XCSI: return "Coast Miwok";
+            case XLMW: return "Lake Miwok";
+            case _WINTUAN: return "Wintuan";
+            case XWIT: return "Wintu-Nomlaki";
+            case _YOKUTSAN: return "Yokutsan";
+            case XENH: return "Kings River";
+            case XGSH: return "Gashowu";
+            case XPYL: return "Poso Creek";
+            case XTKH: return "Tule-Kaweah";
+            case _PIDGIN: return "Pidgin";
+            case XCHH: return "Chinook Wawa";
+            case _SALISHAN: return "Salishan";
+            case _CENTRALSALISH: return "CentralSalish";
+            case XCLM: return "Clallam";
+            case XLUT: return "Lushootseed";
+            case XSTR: return "Northern Straits";
+            case _INTERIORSALISH: return "InteriorSalish";
+            case XCOL: return "Columbian";
+            case XCRD: return "Coeur D'alene";
+            case XFLA: return "Kalispel";
+            case XOKA: return "Okanagan";
+            case _TSAMOSAN: return "Tsamosan";
+            case XCEA: return "Lower Chehalis";
+            case XCJH: return "Upper Chehalis";
+            case XCOW: return "Cowlitz";
+            case XQUN: return "Quinault";
+            case _SIOUANCATAWBA: return "SiouanCatawba";
+            case _SIOUAN: return "Siouan";
+            case _MISSISSIPPIVALLEY: return "MississippiValley";
+            case _CHIWEREWINNEBAGO: return "ChiwereWinnebago";
+            case XIOW: return "Chiwere";
+            case XWIN: return "Hocak";
+            case _DAKOTAN: return "Dakotan";
+            case XASB: return "Assiniboine";
+            case XDHG: return "Dakota";
+            case XLKT: return "Lakota";
+            case XNKT: return "Nakota";
+            case _DHEGIHA: return "Dhegiha";
+            case XKAA: return "Kansa";
+            case XOMA: return "Omaha-Ponca";
+            case XOSA: return "Osage";
+            case XQUA: return "Quapaw";
+            case _MISSOURIRIVER: return "MissouriRiver";
+            case XCRO: return "Crow";
+            case XHID: return "Hidatsa";
+            case XMHQ: return "Mandan";
+            case _UTOAZTECAN: return "UtoAztecan";
+            case _NUMIC: return "Numic";
+            case _CENTRALNUMIC: return "CentralNumic";
+            case XCOM: return "Comanche";
+            case XPAR: return "Panamint";
+            case XSHH: return "Shoshone";
+            case _SOUTHERNNUMIC: return "SouthernNumic";
+            case XKAW: return "Kawaiisu";
+            case XUTE: return "Ute-Southern Paiute";
+            case _WESTERNNUMIC: return "WesternNumic";
+            case XMON: return "Mono";
+            case XPAO: return "Northern Paiute-Bannock";
+            case _TAKIC: return "Takic";
+            case _CUPAN: return "Cupan";
+            case XCHL: return "Cahuilla";
+            case XCUP: return "Cupeno";
+            case XLUI: return "Luiseno";
+            case _SERRANOGABRIELINO: return "SerranoGabrielino";
+            case XSER: return "Serrano";
+            case _TARACAHITAN: return "Taracahitan";
+            case _CAHITAN: return "Cahitan";
+            case XYAQ: return "Yaqui";
+            case _TEPIMAN: return "Tepiman";
+            case XPAP: return "Papago-Pima";
+            case XHOP: return "Hopi";
+            case XTUB: return "Tubatululabal";
+            case _WAKASHAN: return "Wakashan";
+            case _NOOTKAN: return "Nootkan";
+            case XMYH: return "Makah";
+            case _YUKIAN: return "Yukian";
+            case XWAO: return "Wappo";
+            case XYUK: return "Yuki";
+            case XHAI: return "Haida";
+            case XKUN: return "Kootenai";
+            case XPSD: return "Plains Indian Sign Language";
+            case XYUC: return "Yuchi";
+            case XZUN: return "Zuni";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ALGIC: return "Algic";
+            case _ALGONQUIAN: return "Algonquian";
+            case _ARAPAHOAN: return "Arapahoan";
+            case _ARAPAHOGROSVENTRE: return "ArapahoGrosVentre";
+            case XARP: return "Arapaho";
+            case XATS: return "Gros Ventre";
+            case _CREEMONTAGNAIS: return "CreeMontagnais";
+            case _CREE: return "Cree";
+            case XCRP: return "Western Cree";
+            case _EASTERNALGONQUIN: return "EasternAlgonquin";
+            case _ABENAKIAN: return "Abenakian";
+            case XAAQ: return "Eastern Abenaki";
+            case XABE: return "Western Abenaki";
+            case XMAC: return "Maliseet-Passamaquoddy";
+            case _DELAWARAN: return "Delawaran";
+            case XDEL: return "Unami Delaware";
+            case XMIC: return "Micmac";
+            case _OJIBWAYAN: return "Ojibwayan";
+            case XOJB: return "Southern Ojibwa";
+            case XPOT: return "Potawatami";
+            case _SAUKFOXKICKAPOO: return "SaukFoxKickapoo";
+            case XKIC: return "Kickapoo";
+            case XSAC: return "Mesquakie";
+            case XSJW: return "Shawnee";
+            case XBLC: return "Blackfoot";
+            case XCHY: return "Cheyenne";
+            case XMEZ: return "Menominee";
+            case _RITWAN: return "Ritwan";
+            case XYUR: return "Yurok";
+            case _CADDOAN: return "Caddoan";
+            case _NORTHERNCADDOAN: return "NorthernCaddoan";
+            case XARI: return "Arikara";
+            case XPAW: return "Pawnee";
+            case XWIC: return "Wichita";
+            case _SOUTHERNCADDOAN: return "SouthernCaddoan";
+            case XCAD: return "Caddo";
+            case _CHIMAKUAN: return "Chimakuan";
+            case XQUI: return "Quileute";
+            case _ESKIMOALEUT: return "EskimoAleut";
+            case _ALEUT: return "Aleut";
+            case XALW: return "Aleut";
+            case _ESKIMOAN: return "Eskimoan";
+            case _INUITINUPIAQ: return "InuitInupiaq";
+            case XESI: return "North Alaskan Inuktitut";
+            case XESK: return "Northwest Alaska Inuktitut";
+            case _SIRENIKSKIYUPIK: return "SirenikskiYupik";
+            case XEMS: return "Pacific Yupik Gulf";
+            case XESS: return "Central Siberian Yupik";
+            case XESU: return "Central Alaskan Yupik";
+            case _HOKAN: return "Hokan";
+            case _COCHIMIYUMAN: return "CochimiYuman";
+            case _YUMAN: return "Yuman";
+            case _DELTACALIFORNIA: return "DeltaCalifornia";
+            case _DIEGUENO: return "Diegueno";
+            case XDIH: return "Kumeyaay";
+            case XCOC: return "Cocopa";
+            case _PAI: return "Pai";
+            case XYUF: return "Havasupai";
+            case _RIVER: return "River";
+            case XMOV: return "Mohave";
+            case XMRC: return "Maricopa";
+            case XYUM: return "Quechan";
+            case _PALAIHNIHAN: return "Palaihnihan";
+            case XACH: return "Achumawi";
+            case XATW: return "Atsugewi";
+            case _POMOAN: return "Pomoan";
+            case XKJU: return "Kashaya";
+            case XPEF: return "Northeastern Pomo";
+            case XPEO: return "Southeastern Pomo";
+            case XPEQ: return "Southern Pomo";
+            case XPOO: return "Central Pomo";
+            case _SHASTA: return "Shasta";
+            case XSHT: return "Shasta";
+            case XKYH: return "Karok";
+            case XWAS: return "Washoe";
+            case _IROQUOIAN: return "Iroquoian";
+            case _NORTHERNIROQUOIAN: return "NorthernIroquoian";
+            case XCAY: return "Cayuga";
+            case XMOH: return "Mohawk";
+            case XONE: return "Oneida";
+            case XONO: return "Onondaga";
+            case XSEE: return "Seneca";
+            case XTUS: return "Tuscarora";
+            case XCER: return "Cherokee";
+            case _KERESAN: return "Keresan";
+            case XKEE: return "Rio Grande Keresan";
+            case XKJQ: return "Acoma-Laguna";
+            case _KIOWATANOAN: return "KiowaTanoan";
+            case _TIWA: return "Tiwa";
+            case XTAO: return "Northern Tiwa";
+            case XTIX: return "Southern Tiwa";
+            case XKIO: return "Kiowa";
+            case XTEW: return "Tewa";
+            case XTOW: return "Jemez";
+            case _MUSKOGEAN: return "Muskogean";
+            case _CENTRALMUSKOGEAN: return "CentralMuskogean";
+            case XAKZ: return "Alabama";
+            case XCKU: return "Koasati";
+            case XMIK: return "Mikasuki";
+            case _WESTERNMUSKOGEAN: return "WesternMuskogean";
+            case XCCT: return "Choctaw";
+            case XCIC: return "Chickasaw";
+            case XCRK: return "Creek";
+            case _NADENE: return "Nadene";
+            case _ATHAPASKANEYAK: return "AthapaskanEyak";
+            case _ATHAPASKAN: return "Athapaskan";
+            case _APACHEAN: return "Apachean";
+            case _EASTERNAPACHEAN: return "EasternApachean";
+            case XAPJ: return "Jicarilla";
+            case XAPL: return "Lipan";
+            case _WESTERNAPACHEAN: return "WesternApachean";
+            case XAPM: return "Mescalero-Chiricahua";
+            case XAPW: return "Western Apache";
+            case XNAV: return "Dine";
+            case XAPK: return "Kiowa Apache";
+            case _CENTRALALASKAYUKON: return "CentralAlaskaYukon";
+            case _KOYUKONINGALIK: return "KoyukonIngalik";
+            case XHOI: return "Holikachuk";
+            case XING: return "Degexit'an";
+            case XKOY: return "Koyukon";
+            case _KUTCHINHAN: return "KutchinHan";
+            case XHAA: return "Han";
+            case XKUC: return "Kutchin";
+            case _TANANATUTCHONE: return "TananaTutchone";
+            case _TANANA: return "Tanana";
+            case XTAA: return "Lower Tanana";
+            case XTAU: return "Upper Tanana";
+            case XTCB: return "Tanacross";
+            case XKUU: return "Upper Kuskokwim";
+            case _PACIFICCOASTATHAPASKAN: return "PacificCoastAthapaskan";
+            case _CALIFORNIAATHAPASKAN: return "CaliforniaAthapaskan";
+            case XHUP: return "Hupa";
+            case XKTW: return "Cahto";
+            case _OREGONATHAPASKAN: return "OregonAthapaskan";
+            case XTOL: return "Tolowa";
+            case XTUU: return "Tututni";
+            case _SOUTHERNALASKA: return "SouthernAlaska";
+            case XAHT: return "Ahtna";
+            case XTFN: return "Tanaina";
+            case XEYA: return "Eyak";
+            case XTLI: return "Tlingit";
+            case _PENUTIAN: return "Penutian";
+            case _CHINOOKAN: return "Chinookan";
+            case _UPPERCHINOOK: return "UpperChinook";
+            case XWAC: return "Kiksht";
+            case _COOSAN: return "Coosan";
+            case XCOS: return "Hanis";
+            case _MAIDUAN: return "Maiduan";
+            case XMAI: return "Northwest Maidu";
+            case XNMU: return "Northeast Maidu";
+            case XNSZ: return "Nisenan";
+            case _PLATEAUPENUTIAN: return "PlateauPenutian";
+            case _SAHAPTIAN: return "Sahaptian";
+            case XUMA: return "Umatilla";
+            case XWAA: return "Walla Walla";
+            case XWAR: return "Tenino";
+            case XYAK: return "Yakima";
+            case XKLA: return "Klamath-Modoc";
+            case XNEZ: return "Nez Perce";
+            case _TAKELMAN: return "Takelman";
+            case _KALAPUYAN: return "Kalapuyan";
+            case XKAL: return "Central Kalapuyan";
+            case _TSIMSHIANIC: return "Tsimshianic";
+            case XTSI: return "Coast Tsimshain";
+            case _UTIAN: return "Utian";
+            case _MIWOKAN: return "Miwokan";
+            case _EASTERNMIWOK: return "EasternMiwok";
+            case XCSM: return "Central Sierra Miwok";
+            case XNSQ: return "Northern Sierra Miwok";
+            case XPMW: return "Plains Miwok";
+            case XSKD: return "Southern Sierra Miwok";
+            case _WESTERNMIWOK: return "WesternMiwok";
+            case XCSI: return "Coast Miwok";
+            case XLMW: return "Lake Miwok";
+            case _WINTUAN: return "Wintuan";
+            case XWIT: return "Wintu-Nomlaki";
+            case _YOKUTSAN: return "Yokutsan";
+            case XENH: return "Kings River";
+            case XGSH: return "Gashowu";
+            case XPYL: return "Poso Creek";
+            case XTKH: return "Tule-Kaweah";
+            case _PIDGIN: return "Pidgin";
+            case XCHH: return "Chinook Wawa";
+            case _SALISHAN: return "Salishan";
+            case _CENTRALSALISH: return "CentralSalish";
+            case XCLM: return "Clallam";
+            case XLUT: return "Lushootseed";
+            case XSTR: return "Northern Straits";
+            case _INTERIORSALISH: return "InteriorSalish";
+            case XCOL: return "Columbian";
+            case XCRD: return "Coeur D'alene";
+            case XFLA: return "Kalispel";
+            case XOKA: return "Okanagan";
+            case _TSAMOSAN: return "Tsamosan";
+            case XCEA: return "Lower Chehalis";
+            case XCJH: return "Upper Chehalis";
+            case XCOW: return "Cowlitz";
+            case XQUN: return "Quinault";
+            case _SIOUANCATAWBA: return "SiouanCatawba";
+            case _SIOUAN: return "Siouan";
+            case _MISSISSIPPIVALLEY: return "MississippiValley";
+            case _CHIWEREWINNEBAGO: return "ChiwereWinnebago";
+            case XIOW: return "Chiwere";
+            case XWIN: return "Hocak";
+            case _DAKOTAN: return "Dakotan";
+            case XASB: return "Assiniboine";
+            case XDHG: return "Dakota";
+            case XLKT: return "Lakota";
+            case XNKT: return "Nakota";
+            case _DHEGIHA: return "Dhegiha";
+            case XKAA: return "Kansa";
+            case XOMA: return "Omaha-Ponca";
+            case XOSA: return "Osage";
+            case XQUA: return "Quapaw";
+            case _MISSOURIRIVER: return "MissouriRiver";
+            case XCRO: return "Crow";
+            case XHID: return "Hidatsa";
+            case XMHQ: return "Mandan";
+            case _UTOAZTECAN: return "UtoAztecan";
+            case _NUMIC: return "Numic";
+            case _CENTRALNUMIC: return "CentralNumic";
+            case XCOM: return "Comanche";
+            case XPAR: return "Panamint";
+            case XSHH: return "Shoshone";
+            case _SOUTHERNNUMIC: return "SouthernNumic";
+            case XKAW: return "Kawaiisu";
+            case XUTE: return "Ute-Southern Paiute";
+            case _WESTERNNUMIC: return "WesternNumic";
+            case XMON: return "Mono";
+            case XPAO: return "Northern Paiute-Bannock";
+            case _TAKIC: return "Takic";
+            case _CUPAN: return "Cupan";
+            case XCHL: return "Cahuilla";
+            case XCUP: return "Cupeno";
+            case XLUI: return "Luiseno";
+            case _SERRANOGABRIELINO: return "SerranoGabrielino";
+            case XSER: return "Serrano";
+            case _TARACAHITAN: return "Taracahitan";
+            case _CAHITAN: return "Cahitan";
+            case XYAQ: return "Yaqui";
+            case _TEPIMAN: return "Tepiman";
+            case XPAP: return "Papago-Pima";
+            case XHOP: return "Hopi";
+            case XTUB: return "Tubatululabal";
+            case _WAKASHAN: return "Wakashan";
+            case _NOOTKAN: return "Nootkan";
+            case XMYH: return "Makah";
+            case _YUKIAN: return "Yukian";
+            case XWAO: return "Wappo";
+            case XYUK: return "Yuki";
+            case XHAI: return "Haida";
+            case XKUN: return "Kootenai";
+            case XPSD: return "Plains Indian Sign Language";
+            case XYUC: return "Yuchi";
+            case XZUN: return "Zuni";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AmericanIndianAlaskaNativeLanguagesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AmericanIndianAlaskaNativeLanguagesEnumFactory.java
new file mode 100644
index 00000000000..42e29faa990
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3AmericanIndianAlaskaNativeLanguagesEnumFactory.java
@@ -0,0 +1,1074 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3AmericanIndianAlaskaNativeLanguagesEnumFactory implements EnumFactory {
+
+  public V3AmericanIndianAlaskaNativeLanguages fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_Algic".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ALGIC;
+    if ("_Algonquian".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ALGONQUIAN;
+    if ("_Arapahoan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ARAPAHOAN;
+    if ("_ArapahoGrosVentre".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ARAPAHOGROSVENTRE;
+    if ("x-ARP".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XARP;
+    if ("x-ATS".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XATS;
+    if ("_CreeMontagnais".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CREEMONTAGNAIS;
+    if ("_Cree".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CREE;
+    if ("x-CRP".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCRP;
+    if ("_EasternAlgonquin".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._EASTERNALGONQUIN;
+    if ("_Abenakian".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ABENAKIAN;
+    if ("x-AAQ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XAAQ;
+    if ("x-ABE".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XABE;
+    if ("x-MAC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMAC;
+    if ("_Delawaran".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._DELAWARAN;
+    if ("x-DEL".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XDEL;
+    if ("x-MIC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMIC;
+    if ("_Ojibwayan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._OJIBWAYAN;
+    if ("x-OJB".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XOJB;
+    if ("x-POT".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPOT;
+    if ("_SaukFoxKickapoo".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SAUKFOXKICKAPOO;
+    if ("x-KIC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKIC;
+    if ("x-SAC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XSAC;
+    if ("x-SJW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XSJW;
+    if ("x-BLC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XBLC;
+    if ("x-CHY".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCHY;
+    if ("x-MEZ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMEZ;
+    if ("_Ritwan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._RITWAN;
+    if ("x-YUR".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XYUR;
+    if ("_Caddoan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CADDOAN;
+    if ("_NorthernCaddoan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._NORTHERNCADDOAN;
+    if ("x-ARI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XARI;
+    if ("x-PAW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPAW;
+    if ("x-WIC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XWIC;
+    if ("_SouthernCaddoan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SOUTHERNCADDOAN;
+    if ("x-CAD".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCAD;
+    if ("_Chimakuan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CHIMAKUAN;
+    if ("x-QUI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XQUI;
+    if ("_EskimoAleut".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ESKIMOALEUT;
+    if ("_Aleut".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ALEUT;
+    if ("x-ALW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XALW;
+    if ("_Eskimoan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ESKIMOAN;
+    if ("_InuitInupiaq".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._INUITINUPIAQ;
+    if ("x-ESI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XESI;
+    if ("x-ESK".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XESK;
+    if ("_SirenikskiYupik".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SIRENIKSKIYUPIK;
+    if ("x-EMS".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XEMS;
+    if ("x-ESS".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XESS;
+    if ("x-ESU".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XESU;
+    if ("_Hokan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._HOKAN;
+    if ("_CochimiYuman".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._COCHIMIYUMAN;
+    if ("_Yuman".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._YUMAN;
+    if ("_DeltaCalifornia".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._DELTACALIFORNIA;
+    if ("_Diegueno".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._DIEGUENO;
+    if ("x-DIH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XDIH;
+    if ("x-COC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCOC;
+    if ("_Pai".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._PAI;
+    if ("x-YUF".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XYUF;
+    if ("_River".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._RIVER;
+    if ("x-MOV".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMOV;
+    if ("x-MRC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMRC;
+    if ("x-YUM".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XYUM;
+    if ("_Palaihnihan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._PALAIHNIHAN;
+    if ("x-ACH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XACH;
+    if ("x-ATW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XATW;
+    if ("_Pomoan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._POMOAN;
+    if ("x-KJU".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKJU;
+    if ("x-PEF".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPEF;
+    if ("x-PEO".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPEO;
+    if ("x-PEQ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPEQ;
+    if ("x-POO".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPOO;
+    if ("_Shasta".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SHASTA;
+    if ("x-SHT".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XSHT;
+    if ("x-KYH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKYH;
+    if ("x-WAS".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XWAS;
+    if ("_Iroquoian".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._IROQUOIAN;
+    if ("_NorthernIroquoian".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._NORTHERNIROQUOIAN;
+    if ("x-CAY".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCAY;
+    if ("x-MOH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMOH;
+    if ("x-ONE".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XONE;
+    if ("x-ONO".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XONO;
+    if ("x-SEE".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XSEE;
+    if ("x-TUS".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTUS;
+    if ("x-CER".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCER;
+    if ("_Keresan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._KERESAN;
+    if ("x-KEE".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKEE;
+    if ("x-KJQ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKJQ;
+    if ("_KiowaTanoan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._KIOWATANOAN;
+    if ("_Tiwa".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._TIWA;
+    if ("x-TAO".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTAO;
+    if ("x-TIX".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTIX;
+    if ("x-KIO".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKIO;
+    if ("x-TEW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTEW;
+    if ("x-TOW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTOW;
+    if ("_Muskogean".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._MUSKOGEAN;
+    if ("_CentralMuskogean".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CENTRALMUSKOGEAN;
+    if ("x-AKZ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XAKZ;
+    if ("x-CKU".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCKU;
+    if ("x-MIK".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMIK;
+    if ("_WesternMuskogean".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._WESTERNMUSKOGEAN;
+    if ("x-CCT".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCCT;
+    if ("x-CIC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCIC;
+    if ("x-CRK".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCRK;
+    if ("_Nadene".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._NADENE;
+    if ("_AthapaskanEyak".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ATHAPASKANEYAK;
+    if ("_Athapaskan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._ATHAPASKAN;
+    if ("_Apachean".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._APACHEAN;
+    if ("_EasternApachean".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._EASTERNAPACHEAN;
+    if ("x-APJ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XAPJ;
+    if ("x-APL".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XAPL;
+    if ("_WesternApachean".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._WESTERNAPACHEAN;
+    if ("x-APM".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XAPM;
+    if ("x-APW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XAPW;
+    if ("x-NAV".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XNAV;
+    if ("x-APK".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XAPK;
+    if ("_CentralAlaskaYukon".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CENTRALALASKAYUKON;
+    if ("_KoyukonIngalik".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._KOYUKONINGALIK;
+    if ("x-HOI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XHOI;
+    if ("x-ING".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XING;
+    if ("x-KOY".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKOY;
+    if ("_KutchinHan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._KUTCHINHAN;
+    if ("x-HAA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XHAA;
+    if ("x-KUC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKUC;
+    if ("_TananaTutchone".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._TANANATUTCHONE;
+    if ("_Tanana".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._TANANA;
+    if ("x-TAA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTAA;
+    if ("x-TAU".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTAU;
+    if ("x-TCB".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTCB;
+    if ("x-KUU".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKUU;
+    if ("_PacificCoastAthapaskan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._PACIFICCOASTATHAPASKAN;
+    if ("_CaliforniaAthapaskan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CALIFORNIAATHAPASKAN;
+    if ("x-HUP".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XHUP;
+    if ("x-KTW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKTW;
+    if ("_OregonAthapaskan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._OREGONATHAPASKAN;
+    if ("x-TOL".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTOL;
+    if ("x-TUU".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTUU;
+    if ("_SouthernAlaska".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SOUTHERNALASKA;
+    if ("x-AHT".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XAHT;
+    if ("x-TFN".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTFN;
+    if ("x-EYA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XEYA;
+    if ("x-TLI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTLI;
+    if ("_Penutian".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._PENUTIAN;
+    if ("_Chinookan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CHINOOKAN;
+    if ("_UpperChinook".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._UPPERCHINOOK;
+    if ("x-WAC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XWAC;
+    if ("_Coosan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._COOSAN;
+    if ("x-COS".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCOS;
+    if ("_Maiduan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._MAIDUAN;
+    if ("x-MAI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMAI;
+    if ("x-NMU".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XNMU;
+    if ("x-NSZ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XNSZ;
+    if ("_PlateauPenutian".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._PLATEAUPENUTIAN;
+    if ("_Sahaptian".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SAHAPTIAN;
+    if ("x-UMA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XUMA;
+    if ("x-WAA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XWAA;
+    if ("x-WAR".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XWAR;
+    if ("x-YAK".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XYAK;
+    if ("x-KLA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKLA;
+    if ("x-NEZ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XNEZ;
+    if ("_Takelman".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._TAKELMAN;
+    if ("_Kalapuyan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._KALAPUYAN;
+    if ("x-KAL".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKAL;
+    if ("_Tsimshianic".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._TSIMSHIANIC;
+    if ("x-TSI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTSI;
+    if ("_Utian".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._UTIAN;
+    if ("_Miwokan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._MIWOKAN;
+    if ("_EasternMiwok".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._EASTERNMIWOK;
+    if ("x-CSM".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCSM;
+    if ("x-NSQ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XNSQ;
+    if ("x-PMW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPMW;
+    if ("x-SKD".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XSKD;
+    if ("_WesternMiwok".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._WESTERNMIWOK;
+    if ("x-CSI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCSI;
+    if ("x-LMW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XLMW;
+    if ("_Wintuan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._WINTUAN;
+    if ("x-WIT".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XWIT;
+    if ("_Yokutsan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._YOKUTSAN;
+    if ("x-ENH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XENH;
+    if ("x-GSH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XGSH;
+    if ("x-PYL".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPYL;
+    if ("x-TKH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTKH;
+    if ("_Pidgin".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._PIDGIN;
+    if ("x-CHH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCHH;
+    if ("_Salishan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SALISHAN;
+    if ("_CentralSalish".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CENTRALSALISH;
+    if ("x-CLM".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCLM;
+    if ("x-LUT".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XLUT;
+    if ("x-STR".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XSTR;
+    if ("_InteriorSalish".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._INTERIORSALISH;
+    if ("x-COL".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCOL;
+    if ("x-CRD".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCRD;
+    if ("x-FLA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XFLA;
+    if ("x-OKA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XOKA;
+    if ("_Tsamosan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._TSAMOSAN;
+    if ("x-CEA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCEA;
+    if ("x-CJH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCJH;
+    if ("x-COW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCOW;
+    if ("x-QUN".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XQUN;
+    if ("_SiouanCatawba".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SIOUANCATAWBA;
+    if ("_Siouan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SIOUAN;
+    if ("_MississippiValley".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._MISSISSIPPIVALLEY;
+    if ("_ChiwereWinnebago".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CHIWEREWINNEBAGO;
+    if ("x-IOW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XIOW;
+    if ("x-WIN".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XWIN;
+    if ("_Dakotan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._DAKOTAN;
+    if ("x-ASB".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XASB;
+    if ("x-DHG".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XDHG;
+    if ("x-LKT".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XLKT;
+    if ("x-NKT".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XNKT;
+    if ("_Dhegiha".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._DHEGIHA;
+    if ("x-KAA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKAA;
+    if ("x-OMA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XOMA;
+    if ("x-OSA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XOSA;
+    if ("x-QUA".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XQUA;
+    if ("_MissouriRiver".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._MISSOURIRIVER;
+    if ("x-CRO".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCRO;
+    if ("x-HID".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XHID;
+    if ("x-MHQ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMHQ;
+    if ("_UtoAztecan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._UTOAZTECAN;
+    if ("_Numic".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._NUMIC;
+    if ("_CentralNumic".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CENTRALNUMIC;
+    if ("x-COM".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCOM;
+    if ("x-PAR".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPAR;
+    if ("x-SHH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XSHH;
+    if ("_SouthernNumic".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SOUTHERNNUMIC;
+    if ("x-KAW".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKAW;
+    if ("x-UTE".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XUTE;
+    if ("_WesternNumic".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._WESTERNNUMIC;
+    if ("x-MON".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMON;
+    if ("x-PAO".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPAO;
+    if ("_Takic".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._TAKIC;
+    if ("_Cupan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CUPAN;
+    if ("x-CHL".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCHL;
+    if ("x-CUP".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XCUP;
+    if ("x-LUI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XLUI;
+    if ("_SerranoGabrielino".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._SERRANOGABRIELINO;
+    if ("x-SER".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XSER;
+    if ("_Taracahitan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._TARACAHITAN;
+    if ("_Cahitan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._CAHITAN;
+    if ("x-YAQ".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XYAQ;
+    if ("_Tepiman".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._TEPIMAN;
+    if ("x-PAP".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPAP;
+    if ("x-HOP".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XHOP;
+    if ("x-TUB".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XTUB;
+    if ("_Wakashan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._WAKASHAN;
+    if ("_Nootkan".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._NOOTKAN;
+    if ("x-MYH".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XMYH;
+    if ("_Yukian".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages._YUKIAN;
+    if ("x-WAO".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XWAO;
+    if ("x-YUK".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XYUK;
+    if ("x-HAI".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XHAI;
+    if ("x-KUN".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XKUN;
+    if ("x-PSD".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XPSD;
+    if ("x-YUC".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XYUC;
+    if ("x-ZUN".equals(codeString))
+      return V3AmericanIndianAlaskaNativeLanguages.XZUN;
+    throw new IllegalArgumentException("Unknown V3AmericanIndianAlaskaNativeLanguages code '"+codeString+"'");
+  }
+
+  public String toCode(V3AmericanIndianAlaskaNativeLanguages code) {
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ALGIC)
+      return "_Algic";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ALGONQUIAN)
+      return "_Algonquian";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ARAPAHOAN)
+      return "_Arapahoan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ARAPAHOGROSVENTRE)
+      return "_ArapahoGrosVentre";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XARP)
+      return "x-ARP";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XATS)
+      return "x-ATS";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CREEMONTAGNAIS)
+      return "_CreeMontagnais";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CREE)
+      return "_Cree";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCRP)
+      return "x-CRP";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._EASTERNALGONQUIN)
+      return "_EasternAlgonquin";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ABENAKIAN)
+      return "_Abenakian";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XAAQ)
+      return "x-AAQ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XABE)
+      return "x-ABE";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMAC)
+      return "x-MAC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._DELAWARAN)
+      return "_Delawaran";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XDEL)
+      return "x-DEL";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMIC)
+      return "x-MIC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._OJIBWAYAN)
+      return "_Ojibwayan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XOJB)
+      return "x-OJB";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPOT)
+      return "x-POT";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SAUKFOXKICKAPOO)
+      return "_SaukFoxKickapoo";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKIC)
+      return "x-KIC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XSAC)
+      return "x-SAC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XSJW)
+      return "x-SJW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XBLC)
+      return "x-BLC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCHY)
+      return "x-CHY";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMEZ)
+      return "x-MEZ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._RITWAN)
+      return "_Ritwan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XYUR)
+      return "x-YUR";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CADDOAN)
+      return "_Caddoan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._NORTHERNCADDOAN)
+      return "_NorthernCaddoan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XARI)
+      return "x-ARI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPAW)
+      return "x-PAW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XWIC)
+      return "x-WIC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SOUTHERNCADDOAN)
+      return "_SouthernCaddoan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCAD)
+      return "x-CAD";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CHIMAKUAN)
+      return "_Chimakuan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XQUI)
+      return "x-QUI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ESKIMOALEUT)
+      return "_EskimoAleut";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ALEUT)
+      return "_Aleut";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XALW)
+      return "x-ALW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ESKIMOAN)
+      return "_Eskimoan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._INUITINUPIAQ)
+      return "_InuitInupiaq";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XESI)
+      return "x-ESI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XESK)
+      return "x-ESK";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SIRENIKSKIYUPIK)
+      return "_SirenikskiYupik";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XEMS)
+      return "x-EMS";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XESS)
+      return "x-ESS";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XESU)
+      return "x-ESU";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._HOKAN)
+      return "_Hokan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._COCHIMIYUMAN)
+      return "_CochimiYuman";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._YUMAN)
+      return "_Yuman";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._DELTACALIFORNIA)
+      return "_DeltaCalifornia";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._DIEGUENO)
+      return "_Diegueno";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XDIH)
+      return "x-DIH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCOC)
+      return "x-COC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._PAI)
+      return "_Pai";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XYUF)
+      return "x-YUF";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._RIVER)
+      return "_River";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMOV)
+      return "x-MOV";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMRC)
+      return "x-MRC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XYUM)
+      return "x-YUM";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._PALAIHNIHAN)
+      return "_Palaihnihan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XACH)
+      return "x-ACH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XATW)
+      return "x-ATW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._POMOAN)
+      return "_Pomoan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKJU)
+      return "x-KJU";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPEF)
+      return "x-PEF";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPEO)
+      return "x-PEO";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPEQ)
+      return "x-PEQ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPOO)
+      return "x-POO";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SHASTA)
+      return "_Shasta";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XSHT)
+      return "x-SHT";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKYH)
+      return "x-KYH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XWAS)
+      return "x-WAS";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._IROQUOIAN)
+      return "_Iroquoian";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._NORTHERNIROQUOIAN)
+      return "_NorthernIroquoian";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCAY)
+      return "x-CAY";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMOH)
+      return "x-MOH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XONE)
+      return "x-ONE";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XONO)
+      return "x-ONO";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XSEE)
+      return "x-SEE";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTUS)
+      return "x-TUS";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCER)
+      return "x-CER";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._KERESAN)
+      return "_Keresan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKEE)
+      return "x-KEE";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKJQ)
+      return "x-KJQ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._KIOWATANOAN)
+      return "_KiowaTanoan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._TIWA)
+      return "_Tiwa";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTAO)
+      return "x-TAO";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTIX)
+      return "x-TIX";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKIO)
+      return "x-KIO";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTEW)
+      return "x-TEW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTOW)
+      return "x-TOW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._MUSKOGEAN)
+      return "_Muskogean";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CENTRALMUSKOGEAN)
+      return "_CentralMuskogean";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XAKZ)
+      return "x-AKZ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCKU)
+      return "x-CKU";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMIK)
+      return "x-MIK";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._WESTERNMUSKOGEAN)
+      return "_WesternMuskogean";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCCT)
+      return "x-CCT";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCIC)
+      return "x-CIC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCRK)
+      return "x-CRK";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._NADENE)
+      return "_Nadene";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ATHAPASKANEYAK)
+      return "_AthapaskanEyak";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._ATHAPASKAN)
+      return "_Athapaskan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._APACHEAN)
+      return "_Apachean";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._EASTERNAPACHEAN)
+      return "_EasternApachean";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XAPJ)
+      return "x-APJ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XAPL)
+      return "x-APL";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._WESTERNAPACHEAN)
+      return "_WesternApachean";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XAPM)
+      return "x-APM";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XAPW)
+      return "x-APW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XNAV)
+      return "x-NAV";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XAPK)
+      return "x-APK";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CENTRALALASKAYUKON)
+      return "_CentralAlaskaYukon";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._KOYUKONINGALIK)
+      return "_KoyukonIngalik";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XHOI)
+      return "x-HOI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XING)
+      return "x-ING";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKOY)
+      return "x-KOY";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._KUTCHINHAN)
+      return "_KutchinHan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XHAA)
+      return "x-HAA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKUC)
+      return "x-KUC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._TANANATUTCHONE)
+      return "_TananaTutchone";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._TANANA)
+      return "_Tanana";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTAA)
+      return "x-TAA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTAU)
+      return "x-TAU";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTCB)
+      return "x-TCB";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKUU)
+      return "x-KUU";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._PACIFICCOASTATHAPASKAN)
+      return "_PacificCoastAthapaskan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CALIFORNIAATHAPASKAN)
+      return "_CaliforniaAthapaskan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XHUP)
+      return "x-HUP";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKTW)
+      return "x-KTW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._OREGONATHAPASKAN)
+      return "_OregonAthapaskan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTOL)
+      return "x-TOL";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTUU)
+      return "x-TUU";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SOUTHERNALASKA)
+      return "_SouthernAlaska";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XAHT)
+      return "x-AHT";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTFN)
+      return "x-TFN";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XEYA)
+      return "x-EYA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTLI)
+      return "x-TLI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._PENUTIAN)
+      return "_Penutian";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CHINOOKAN)
+      return "_Chinookan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._UPPERCHINOOK)
+      return "_UpperChinook";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XWAC)
+      return "x-WAC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._COOSAN)
+      return "_Coosan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCOS)
+      return "x-COS";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._MAIDUAN)
+      return "_Maiduan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMAI)
+      return "x-MAI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XNMU)
+      return "x-NMU";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XNSZ)
+      return "x-NSZ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._PLATEAUPENUTIAN)
+      return "_PlateauPenutian";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SAHAPTIAN)
+      return "_Sahaptian";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XUMA)
+      return "x-UMA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XWAA)
+      return "x-WAA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XWAR)
+      return "x-WAR";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XYAK)
+      return "x-YAK";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKLA)
+      return "x-KLA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XNEZ)
+      return "x-NEZ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._TAKELMAN)
+      return "_Takelman";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._KALAPUYAN)
+      return "_Kalapuyan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKAL)
+      return "x-KAL";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._TSIMSHIANIC)
+      return "_Tsimshianic";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTSI)
+      return "x-TSI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._UTIAN)
+      return "_Utian";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._MIWOKAN)
+      return "_Miwokan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._EASTERNMIWOK)
+      return "_EasternMiwok";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCSM)
+      return "x-CSM";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XNSQ)
+      return "x-NSQ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPMW)
+      return "x-PMW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XSKD)
+      return "x-SKD";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._WESTERNMIWOK)
+      return "_WesternMiwok";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCSI)
+      return "x-CSI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XLMW)
+      return "x-LMW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._WINTUAN)
+      return "_Wintuan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XWIT)
+      return "x-WIT";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._YOKUTSAN)
+      return "_Yokutsan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XENH)
+      return "x-ENH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XGSH)
+      return "x-GSH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPYL)
+      return "x-PYL";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTKH)
+      return "x-TKH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._PIDGIN)
+      return "_Pidgin";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCHH)
+      return "x-CHH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SALISHAN)
+      return "_Salishan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CENTRALSALISH)
+      return "_CentralSalish";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCLM)
+      return "x-CLM";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XLUT)
+      return "x-LUT";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XSTR)
+      return "x-STR";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._INTERIORSALISH)
+      return "_InteriorSalish";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCOL)
+      return "x-COL";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCRD)
+      return "x-CRD";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XFLA)
+      return "x-FLA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XOKA)
+      return "x-OKA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._TSAMOSAN)
+      return "_Tsamosan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCEA)
+      return "x-CEA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCJH)
+      return "x-CJH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCOW)
+      return "x-COW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XQUN)
+      return "x-QUN";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SIOUANCATAWBA)
+      return "_SiouanCatawba";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SIOUAN)
+      return "_Siouan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._MISSISSIPPIVALLEY)
+      return "_MississippiValley";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CHIWEREWINNEBAGO)
+      return "_ChiwereWinnebago";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XIOW)
+      return "x-IOW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XWIN)
+      return "x-WIN";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._DAKOTAN)
+      return "_Dakotan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XASB)
+      return "x-ASB";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XDHG)
+      return "x-DHG";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XLKT)
+      return "x-LKT";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XNKT)
+      return "x-NKT";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._DHEGIHA)
+      return "_Dhegiha";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKAA)
+      return "x-KAA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XOMA)
+      return "x-OMA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XOSA)
+      return "x-OSA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XQUA)
+      return "x-QUA";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._MISSOURIRIVER)
+      return "_MissouriRiver";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCRO)
+      return "x-CRO";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XHID)
+      return "x-HID";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMHQ)
+      return "x-MHQ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._UTOAZTECAN)
+      return "_UtoAztecan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._NUMIC)
+      return "_Numic";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CENTRALNUMIC)
+      return "_CentralNumic";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCOM)
+      return "x-COM";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPAR)
+      return "x-PAR";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XSHH)
+      return "x-SHH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SOUTHERNNUMIC)
+      return "_SouthernNumic";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKAW)
+      return "x-KAW";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XUTE)
+      return "x-UTE";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._WESTERNNUMIC)
+      return "_WesternNumic";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMON)
+      return "x-MON";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPAO)
+      return "x-PAO";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._TAKIC)
+      return "_Takic";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CUPAN)
+      return "_Cupan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCHL)
+      return "x-CHL";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XCUP)
+      return "x-CUP";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XLUI)
+      return "x-LUI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._SERRANOGABRIELINO)
+      return "_SerranoGabrielino";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XSER)
+      return "x-SER";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._TARACAHITAN)
+      return "_Taracahitan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._CAHITAN)
+      return "_Cahitan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XYAQ)
+      return "x-YAQ";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._TEPIMAN)
+      return "_Tepiman";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPAP)
+      return "x-PAP";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XHOP)
+      return "x-HOP";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XTUB)
+      return "x-TUB";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._WAKASHAN)
+      return "_Wakashan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._NOOTKAN)
+      return "_Nootkan";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XMYH)
+      return "x-MYH";
+    if (code == V3AmericanIndianAlaskaNativeLanguages._YUKIAN)
+      return "_Yukian";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XWAO)
+      return "x-WAO";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XYUK)
+      return "x-YUK";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XHAI)
+      return "x-HAI";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XKUN)
+      return "x-KUN";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XPSD)
+      return "x-PSD";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XYUC)
+      return "x-YUC";
+    if (code == V3AmericanIndianAlaskaNativeLanguages.XZUN)
+      return "x-ZUN";
+    return "?";
+  }
+
+    public String toSystem(V3AmericanIndianAlaskaNativeLanguages code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Calendar.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Calendar.java
new file mode 100644
index 00000000000..b940db6db8d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Calendar.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3Calendar {
+
+        /**
+         * The Gregorian calendar is the calendar in effect in most countries of Christian influence since approximately 1582. This calendar superceded the Julian calendar.
+         */
+        GREG, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3Calendar fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("GREG".equals(codeString))
+          return GREG;
+        throw new FHIRException("Unknown V3Calendar code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GREG: return "GREG";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/Calendar";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GREG: return "The Gregorian calendar is the calendar in effect in most countries of Christian influence since approximately 1582. This calendar superceded the Julian calendar.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GREG: return "Gregorian";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarCycle.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarCycle.java
new file mode 100644
index 00000000000..ed43c3bcb22
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarCycle.java
@@ -0,0 +1,231 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3CalendarCycle {
+
+        /**
+         * CalendarCycleOneLetter
+         */
+        _CALENDARCYCLEONELETTER, 
+        /**
+         * week (continuous)
+         */
+        CW, 
+        /**
+         * year
+         */
+        CY, 
+        /**
+         * day of the month
+         */
+        D, 
+        /**
+         * day of the week (begins with Monday)
+         */
+        DW, 
+        /**
+         * hour of the day
+         */
+        H, 
+        /**
+         * month of the year
+         */
+        M, 
+        /**
+         * minute of the hour
+         */
+        N, 
+        /**
+         * second of the minute
+         */
+        S, 
+        /**
+         * CalendarCycleTwoLetter
+         */
+        _CALENDARCYCLETWOLETTER, 
+        /**
+         * day (continuous)
+         */
+        CD, 
+        /**
+         * hour (continuous)
+         */
+        CH, 
+        /**
+         * month (continuous)
+         */
+        CM, 
+        /**
+         * minute (continuous)
+         */
+        CN, 
+        /**
+         * second (continuous)
+         */
+        CS, 
+        /**
+         * day of the year
+         */
+        DY, 
+        /**
+         * week of the year
+         */
+        WY, 
+        /**
+         * The week with the month's first Thursday in it (analagous to the ISO 8601 definition for week of the year).
+         */
+        WM, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3CalendarCycle fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_CalendarCycleOneLetter".equals(codeString))
+          return _CALENDARCYCLEONELETTER;
+        if ("CW".equals(codeString))
+          return CW;
+        if ("CY".equals(codeString))
+          return CY;
+        if ("D".equals(codeString))
+          return D;
+        if ("DW".equals(codeString))
+          return DW;
+        if ("H".equals(codeString))
+          return H;
+        if ("M".equals(codeString))
+          return M;
+        if ("N".equals(codeString))
+          return N;
+        if ("S".equals(codeString))
+          return S;
+        if ("_CalendarCycleTwoLetter".equals(codeString))
+          return _CALENDARCYCLETWOLETTER;
+        if ("CD".equals(codeString))
+          return CD;
+        if ("CH".equals(codeString))
+          return CH;
+        if ("CM".equals(codeString))
+          return CM;
+        if ("CN".equals(codeString))
+          return CN;
+        if ("CS".equals(codeString))
+          return CS;
+        if ("DY".equals(codeString))
+          return DY;
+        if ("WY".equals(codeString))
+          return WY;
+        if ("WM".equals(codeString))
+          return WM;
+        throw new FHIRException("Unknown V3CalendarCycle code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _CALENDARCYCLEONELETTER: return "_CalendarCycleOneLetter";
+            case CW: return "CW";
+            case CY: return "CY";
+            case D: return "D";
+            case DW: return "DW";
+            case H: return "H";
+            case M: return "M";
+            case N: return "N";
+            case S: return "S";
+            case _CALENDARCYCLETWOLETTER: return "_CalendarCycleTwoLetter";
+            case CD: return "CD";
+            case CH: return "CH";
+            case CM: return "CM";
+            case CN: return "CN";
+            case CS: return "CS";
+            case DY: return "DY";
+            case WY: return "WY";
+            case WM: return "WM";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/CalendarCycle";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _CALENDARCYCLEONELETTER: return "CalendarCycleOneLetter";
+            case CW: return "week (continuous)";
+            case CY: return "year";
+            case D: return "day of the month";
+            case DW: return "day of the week (begins with Monday)";
+            case H: return "hour of the day";
+            case M: return "month of the year";
+            case N: return "minute of the hour";
+            case S: return "second of the minute";
+            case _CALENDARCYCLETWOLETTER: return "CalendarCycleTwoLetter";
+            case CD: return "day (continuous)";
+            case CH: return "hour (continuous)";
+            case CM: return "month (continuous)";
+            case CN: return "minute (continuous)";
+            case CS: return "second (continuous)";
+            case DY: return "day of the year";
+            case WY: return "week of the year";
+            case WM: return "The week with the month's first Thursday in it (analagous to the ISO 8601 definition for week of the year).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _CALENDARCYCLEONELETTER: return "CalendarCycleOneLetter";
+            case CW: return "week (continuous)";
+            case CY: return "year";
+            case D: return "day of the month";
+            case DW: return "day of the week (begins with Monday)";
+            case H: return "hour of the day";
+            case M: return "month of the year";
+            case N: return "minute of the hour";
+            case S: return "second of the minute";
+            case _CALENDARCYCLETWOLETTER: return "CalendarCycleTwoLetter";
+            case CD: return "day (continuous)";
+            case CH: return "hour (continuous)";
+            case CM: return "month (continuous)";
+            case CN: return "minute (continuous)";
+            case CS: return "second (continuous)";
+            case DY: return "day of the year";
+            case WY: return "week of the year";
+            case WM: return "week of the month";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarCycleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarCycleEnumFactory.java
new file mode 100644
index 00000000000..927c888f3be
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarCycleEnumFactory.java
@@ -0,0 +1,126 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3CalendarCycleEnumFactory implements EnumFactory {
+
+  public V3CalendarCycle fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_CalendarCycleOneLetter".equals(codeString))
+      return V3CalendarCycle._CALENDARCYCLEONELETTER;
+    if ("CW".equals(codeString))
+      return V3CalendarCycle.CW;
+    if ("CY".equals(codeString))
+      return V3CalendarCycle.CY;
+    if ("D".equals(codeString))
+      return V3CalendarCycle.D;
+    if ("DW".equals(codeString))
+      return V3CalendarCycle.DW;
+    if ("H".equals(codeString))
+      return V3CalendarCycle.H;
+    if ("M".equals(codeString))
+      return V3CalendarCycle.M;
+    if ("N".equals(codeString))
+      return V3CalendarCycle.N;
+    if ("S".equals(codeString))
+      return V3CalendarCycle.S;
+    if ("_CalendarCycleTwoLetter".equals(codeString))
+      return V3CalendarCycle._CALENDARCYCLETWOLETTER;
+    if ("CD".equals(codeString))
+      return V3CalendarCycle.CD;
+    if ("CH".equals(codeString))
+      return V3CalendarCycle.CH;
+    if ("CM".equals(codeString))
+      return V3CalendarCycle.CM;
+    if ("CN".equals(codeString))
+      return V3CalendarCycle.CN;
+    if ("CS".equals(codeString))
+      return V3CalendarCycle.CS;
+    if ("DY".equals(codeString))
+      return V3CalendarCycle.DY;
+    if ("WY".equals(codeString))
+      return V3CalendarCycle.WY;
+    if ("WM".equals(codeString))
+      return V3CalendarCycle.WM;
+    throw new IllegalArgumentException("Unknown V3CalendarCycle code '"+codeString+"'");
+  }
+
+  public String toCode(V3CalendarCycle code) {
+    if (code == V3CalendarCycle._CALENDARCYCLEONELETTER)
+      return "_CalendarCycleOneLetter";
+    if (code == V3CalendarCycle.CW)
+      return "CW";
+    if (code == V3CalendarCycle.CY)
+      return "CY";
+    if (code == V3CalendarCycle.D)
+      return "D";
+    if (code == V3CalendarCycle.DW)
+      return "DW";
+    if (code == V3CalendarCycle.H)
+      return "H";
+    if (code == V3CalendarCycle.M)
+      return "M";
+    if (code == V3CalendarCycle.N)
+      return "N";
+    if (code == V3CalendarCycle.S)
+      return "S";
+    if (code == V3CalendarCycle._CALENDARCYCLETWOLETTER)
+      return "_CalendarCycleTwoLetter";
+    if (code == V3CalendarCycle.CD)
+      return "CD";
+    if (code == V3CalendarCycle.CH)
+      return "CH";
+    if (code == V3CalendarCycle.CM)
+      return "CM";
+    if (code == V3CalendarCycle.CN)
+      return "CN";
+    if (code == V3CalendarCycle.CS)
+      return "CS";
+    if (code == V3CalendarCycle.DY)
+      return "DY";
+    if (code == V3CalendarCycle.WY)
+      return "WY";
+    if (code == V3CalendarCycle.WM)
+      return "WM";
+    return "?";
+  }
+
+    public String toSystem(V3CalendarCycle code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarEnumFactory.java
new file mode 100644
index 00000000000..5b1722732da
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3CalendarEnumFactory implements EnumFactory {
+
+  public V3Calendar fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("GREG".equals(codeString))
+      return V3Calendar.GREG;
+    throw new IllegalArgumentException("Unknown V3Calendar code '"+codeString+"'");
+  }
+
+  public String toCode(V3Calendar code) {
+    if (code == V3Calendar.GREG)
+      return "GREG";
+    return "?";
+  }
+
+    public String toSystem(V3Calendar code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarType.java
new file mode 100644
index 00000000000..30ab09373b1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarType.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3CalendarType {
+
+        /**
+         * The Gregorian calendar is in effect in the most countries of Christian influence since approximately 1582.  This calendar superceded the Julian calendar.
+         */
+        GREG, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3CalendarType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("GREG".equals(codeString))
+          return GREG;
+        throw new FHIRException("Unknown V3CalendarType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GREG: return "GREG";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/CalendarType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GREG: return "The Gregorian calendar is in effect in the most countries of Christian influence since approximately 1582.  This calendar superceded the Julian calendar.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GREG: return "Gregorian";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarTypeEnumFactory.java
new file mode 100644
index 00000000000..3e483ae8be0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CalendarTypeEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3CalendarTypeEnumFactory implements EnumFactory {
+
+  public V3CalendarType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("GREG".equals(codeString))
+      return V3CalendarType.GREG;
+    throw new IllegalArgumentException("Unknown V3CalendarType code '"+codeString+"'");
+  }
+
+  public String toCode(V3CalendarType code) {
+    if (code == V3CalendarType.GREG)
+      return "GREG";
+    return "?";
+  }
+
+    public String toSystem(V3CalendarType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Charset.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Charset.java
new file mode 100644
index 00000000000..2a579bcb895
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Charset.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3Charset {
+
+        /**
+         * HL7 is indifferent to the use of this Charset.
+         */
+        EBCDIC, 
+        /**
+         * Deprecated for HL7 use.
+         */
+        ISO10646UCS2, 
+        /**
+         * Deprecated for HL7 use.
+         */
+        ISO10646UCS4, 
+        /**
+         * HL7 is indifferent to the use of this Charset.
+         */
+        ISO88591, 
+        /**
+         * HL7 is indifferent to the use of this Charset.
+         */
+        ISO88592, 
+        /**
+         * HL7 is indifferent to the use of this Charset.
+         */
+        ISO88595, 
+        /**
+         * HL7 is indifferent to the use of this Charset.
+         */
+        JIS2022JP, 
+        /**
+         * Required for HL7 use.
+         */
+        USASCII, 
+        /**
+         * HL7 is indifferent to the use of this Charset.
+         */
+        UTF7, 
+        /**
+         * Required for Unicode support.
+         */
+        UTF8, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3Charset fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("EBCDIC".equals(codeString))
+          return EBCDIC;
+        if ("ISO-10646-UCS-2".equals(codeString))
+          return ISO10646UCS2;
+        if ("ISO-10646-UCS-4".equals(codeString))
+          return ISO10646UCS4;
+        if ("ISO-8859-1".equals(codeString))
+          return ISO88591;
+        if ("ISO-8859-2".equals(codeString))
+          return ISO88592;
+        if ("ISO-8859-5".equals(codeString))
+          return ISO88595;
+        if ("JIS-2022-JP".equals(codeString))
+          return JIS2022JP;
+        if ("US-ASCII".equals(codeString))
+          return USASCII;
+        if ("UTF-7".equals(codeString))
+          return UTF7;
+        if ("UTF-8".equals(codeString))
+          return UTF8;
+        throw new FHIRException("Unknown V3Charset code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case EBCDIC: return "EBCDIC";
+            case ISO10646UCS2: return "ISO-10646-UCS-2";
+            case ISO10646UCS4: return "ISO-10646-UCS-4";
+            case ISO88591: return "ISO-8859-1";
+            case ISO88592: return "ISO-8859-2";
+            case ISO88595: return "ISO-8859-5";
+            case JIS2022JP: return "JIS-2022-JP";
+            case USASCII: return "US-ASCII";
+            case UTF7: return "UTF-7";
+            case UTF8: return "UTF-8";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/Charset";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case EBCDIC: return "HL7 is indifferent to the use of this Charset.";
+            case ISO10646UCS2: return "Deprecated for HL7 use.";
+            case ISO10646UCS4: return "Deprecated for HL7 use.";
+            case ISO88591: return "HL7 is indifferent to the use of this Charset.";
+            case ISO88592: return "HL7 is indifferent to the use of this Charset.";
+            case ISO88595: return "HL7 is indifferent to the use of this Charset.";
+            case JIS2022JP: return "HL7 is indifferent to the use of this Charset.";
+            case USASCII: return "Required for HL7 use.";
+            case UTF7: return "HL7 is indifferent to the use of this Charset.";
+            case UTF8: return "Required for Unicode support.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case EBCDIC: return "EBCDIC";
+            case ISO10646UCS2: return "ISO-10646-UCS-2";
+            case ISO10646UCS4: return "ISO-10646-UCS-4";
+            case ISO88591: return "ISO-8859-1";
+            case ISO88592: return "ISO-8859-2";
+            case ISO88595: return "ISO-8859-5";
+            case JIS2022JP: return "JIS-2022-JP";
+            case USASCII: return "US-ASCII";
+            case UTF7: return "UTF-7";
+            case UTF8: return "UTF-8";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CharsetEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CharsetEnumFactory.java
new file mode 100644
index 00000000000..ad79ab8475d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CharsetEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3CharsetEnumFactory implements EnumFactory {
+
+  public V3Charset fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("EBCDIC".equals(codeString))
+      return V3Charset.EBCDIC;
+    if ("ISO-10646-UCS-2".equals(codeString))
+      return V3Charset.ISO10646UCS2;
+    if ("ISO-10646-UCS-4".equals(codeString))
+      return V3Charset.ISO10646UCS4;
+    if ("ISO-8859-1".equals(codeString))
+      return V3Charset.ISO88591;
+    if ("ISO-8859-2".equals(codeString))
+      return V3Charset.ISO88592;
+    if ("ISO-8859-5".equals(codeString))
+      return V3Charset.ISO88595;
+    if ("JIS-2022-JP".equals(codeString))
+      return V3Charset.JIS2022JP;
+    if ("US-ASCII".equals(codeString))
+      return V3Charset.USASCII;
+    if ("UTF-7".equals(codeString))
+      return V3Charset.UTF7;
+    if ("UTF-8".equals(codeString))
+      return V3Charset.UTF8;
+    throw new IllegalArgumentException("Unknown V3Charset code '"+codeString+"'");
+  }
+
+  public String toCode(V3Charset code) {
+    if (code == V3Charset.EBCDIC)
+      return "EBCDIC";
+    if (code == V3Charset.ISO10646UCS2)
+      return "ISO-10646-UCS-2";
+    if (code == V3Charset.ISO10646UCS4)
+      return "ISO-10646-UCS-4";
+    if (code == V3Charset.ISO88591)
+      return "ISO-8859-1";
+    if (code == V3Charset.ISO88592)
+      return "ISO-8859-2";
+    if (code == V3Charset.ISO88595)
+      return "ISO-8859-5";
+    if (code == V3Charset.JIS2022JP)
+      return "JIS-2022-JP";
+    if (code == V3Charset.USASCII)
+      return "US-ASCII";
+    if (code == V3Charset.UTF7)
+      return "UTF-7";
+    if (code == V3Charset.UTF8)
+      return "UTF-8";
+    return "?";
+  }
+
+    public String toSystem(V3Charset code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CodingRationale.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CodingRationale.java
new file mode 100644
index 00000000000..cb6a686b5f1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CodingRationale.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3CodingRationale {
+
+        /**
+         * Description: Originally produced code.
+         */
+        O, 
+        /**
+         * Originally produced code, required by the specification describing the use of the coded concept.
+         */
+        OR, 
+        /**
+         * Description: Post-coded from free text source
+         */
+        P, 
+        /**
+         * Post-coded from free text source, required by the specification describing the use of the coded concept.
+         */
+        PR, 
+        /**
+         * Description: Required standard code for HL7.
+         */
+        R, 
+        /**
+         * HL7 Specified or Mandated
+         */
+        HL7, 
+        /**
+         * Both HL7 mandated and the original code (precoordination)
+         */
+        SH, 
+        /**
+         * Source (or original) code
+         */
+        SRC, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3CodingRationale fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("O".equals(codeString))
+          return O;
+        if ("OR".equals(codeString))
+          return OR;
+        if ("P".equals(codeString))
+          return P;
+        if ("PR".equals(codeString))
+          return PR;
+        if ("R".equals(codeString))
+          return R;
+        if ("HL7".equals(codeString))
+          return HL7;
+        if ("SH".equals(codeString))
+          return SH;
+        if ("SRC".equals(codeString))
+          return SRC;
+        throw new FHIRException("Unknown V3CodingRationale code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case O: return "O";
+            case OR: return "OR";
+            case P: return "P";
+            case PR: return "PR";
+            case R: return "R";
+            case HL7: return "HL7";
+            case SH: return "SH";
+            case SRC: return "SRC";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/CodingRationale";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case O: return "Description: Originally produced code.";
+            case OR: return "Originally produced code, required by the specification describing the use of the coded concept.";
+            case P: return "Description: Post-coded from free text source";
+            case PR: return "Post-coded from free text source, required by the specification describing the use of the coded concept.";
+            case R: return "Description: Required standard code for HL7.";
+            case HL7: return "HL7 Specified or Mandated";
+            case SH: return "Both HL7 mandated and the original code (precoordination)";
+            case SRC: return "Source (or original) code";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case O: return "originally produced code";
+            case OR: return "original and required";
+            case P: return "post-coded";
+            case PR: return "post-coded and required";
+            case R: return "required";
+            case HL7: return "HL7 Specified or Mandated";
+            case SH: return "Both HL7 mandated and the original code";
+            case SRC: return "Source (or original) code";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CodingRationaleEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CodingRationaleEnumFactory.java
new file mode 100644
index 00000000000..c90c9d0bcee
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CodingRationaleEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3CodingRationaleEnumFactory implements EnumFactory {
+
+  public V3CodingRationale fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("O".equals(codeString))
+      return V3CodingRationale.O;
+    if ("OR".equals(codeString))
+      return V3CodingRationale.OR;
+    if ("P".equals(codeString))
+      return V3CodingRationale.P;
+    if ("PR".equals(codeString))
+      return V3CodingRationale.PR;
+    if ("R".equals(codeString))
+      return V3CodingRationale.R;
+    if ("HL7".equals(codeString))
+      return V3CodingRationale.HL7;
+    if ("SH".equals(codeString))
+      return V3CodingRationale.SH;
+    if ("SRC".equals(codeString))
+      return V3CodingRationale.SRC;
+    throw new IllegalArgumentException("Unknown V3CodingRationale code '"+codeString+"'");
+  }
+
+  public String toCode(V3CodingRationale code) {
+    if (code == V3CodingRationale.O)
+      return "O";
+    if (code == V3CodingRationale.OR)
+      return "OR";
+    if (code == V3CodingRationale.P)
+      return "P";
+    if (code == V3CodingRationale.PR)
+      return "PR";
+    if (code == V3CodingRationale.R)
+      return "R";
+    if (code == V3CodingRationale.HL7)
+      return "HL7";
+    if (code == V3CodingRationale.SH)
+      return "SH";
+    if (code == V3CodingRationale.SRC)
+      return "SRC";
+    return "?";
+  }
+
+    public String toSystem(V3CodingRationale code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CommunicationFunctionType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CommunicationFunctionType.java
new file mode 100644
index 00000000000..a8e2db7e45e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CommunicationFunctionType.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3CommunicationFunctionType {
+
+        /**
+         * The entity is the receiver of the transmission.
+         */
+        RCV, 
+        /**
+         * The entity is the one to which the response or reply to the transmission should be sent.
+         */
+        RSP, 
+        /**
+         * The entity is the sender of the transmission.
+         */
+        SND, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3CommunicationFunctionType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("RCV".equals(codeString))
+          return RCV;
+        if ("RSP".equals(codeString))
+          return RSP;
+        if ("SND".equals(codeString))
+          return SND;
+        throw new FHIRException("Unknown V3CommunicationFunctionType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case RCV: return "RCV";
+            case RSP: return "RSP";
+            case SND: return "SND";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/CommunicationFunctionType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case RCV: return "The entity is the receiver of the transmission.";
+            case RSP: return "The entity is the one to which the response or reply to the transmission should be sent.";
+            case SND: return "The entity is the sender of the transmission.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case RCV: return "receiver";
+            case RSP: return "respond to";
+            case SND: return "sender";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CommunicationFunctionTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CommunicationFunctionTypeEnumFactory.java
new file mode 100644
index 00000000000..649016751c9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CommunicationFunctionTypeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3CommunicationFunctionTypeEnumFactory implements EnumFactory {
+
+  public V3CommunicationFunctionType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("RCV".equals(codeString))
+      return V3CommunicationFunctionType.RCV;
+    if ("RSP".equals(codeString))
+      return V3CommunicationFunctionType.RSP;
+    if ("SND".equals(codeString))
+      return V3CommunicationFunctionType.SND;
+    throw new IllegalArgumentException("Unknown V3CommunicationFunctionType code '"+codeString+"'");
+  }
+
+  public String toCode(V3CommunicationFunctionType code) {
+    if (code == V3CommunicationFunctionType.RCV)
+      return "RCV";
+    if (code == V3CommunicationFunctionType.RSP)
+      return "RSP";
+    if (code == V3CommunicationFunctionType.SND)
+      return "SND";
+    return "?";
+  }
+
+    public String toSystem(V3CommunicationFunctionType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CompressionAlgorithm.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CompressionAlgorithm.java
new file mode 100644
index 00000000000..9364b4e4884
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CompressionAlgorithm.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3CompressionAlgorithm {
+
+        /**
+         * bzip-2 compression format. See [http://www.bzip.org/] for more information.
+         */
+        BZ, 
+        /**
+         * The deflate compressed data format as specified in RFC 1951 [http://www.ietf.org/rfc/rfc1951.txt].
+         */
+        DF, 
+        /**
+         * A compressed data format that is compatible with the widely used GZIP utility as specified in RFC 1952 [http://www.ietf.org/rfc/rfc1952.txt] (uses the deflate algorithm).
+         */
+        GZ, 
+        /**
+         * Original UNIX compress algorithm and file format using the LZC algorithm (a variant of LZW).  Patent encumbered and less efficient than deflate.
+         */
+        Z, 
+        /**
+         * 7z compression file format. See [http://www.7-zip.org/7z.html] for more information.
+         */
+        Z7, 
+        /**
+         * A compressed data format that also uses the deflate algorithm.  Specified as RFC 1950 [http://www.ietf.org/rfc/rfc1952.txt]
+         */
+        ZL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3CompressionAlgorithm fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("BZ".equals(codeString))
+          return BZ;
+        if ("DF".equals(codeString))
+          return DF;
+        if ("GZ".equals(codeString))
+          return GZ;
+        if ("Z".equals(codeString))
+          return Z;
+        if ("Z7".equals(codeString))
+          return Z7;
+        if ("ZL".equals(codeString))
+          return ZL;
+        throw new FHIRException("Unknown V3CompressionAlgorithm code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BZ: return "BZ";
+            case DF: return "DF";
+            case GZ: return "GZ";
+            case Z: return "Z";
+            case Z7: return "Z7";
+            case ZL: return "ZL";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/CompressionAlgorithm";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BZ: return "bzip-2 compression format. See [http://www.bzip.org/] for more information.";
+            case DF: return "The deflate compressed data format as specified in RFC 1951 [http://www.ietf.org/rfc/rfc1951.txt].";
+            case GZ: return "A compressed data format that is compatible with the widely used GZIP utility as specified in RFC 1952 [http://www.ietf.org/rfc/rfc1952.txt] (uses the deflate algorithm).";
+            case Z: return "Original UNIX compress algorithm and file format using the LZC algorithm (a variant of LZW).  Patent encumbered and less efficient than deflate.";
+            case Z7: return "7z compression file format. See [http://www.7-zip.org/7z.html] for more information.";
+            case ZL: return "A compressed data format that also uses the deflate algorithm.  Specified as RFC 1950 [http://www.ietf.org/rfc/rfc1952.txt]";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BZ: return "bzip";
+            case DF: return "deflate";
+            case GZ: return "gzip";
+            case Z: return "compress";
+            case Z7: return "Z7";
+            case ZL: return "zlib";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CompressionAlgorithmEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CompressionAlgorithmEnumFactory.java
new file mode 100644
index 00000000000..f97c9f61fd0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3CompressionAlgorithmEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3CompressionAlgorithmEnumFactory implements EnumFactory {
+
+  public V3CompressionAlgorithm fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("BZ".equals(codeString))
+      return V3CompressionAlgorithm.BZ;
+    if ("DF".equals(codeString))
+      return V3CompressionAlgorithm.DF;
+    if ("GZ".equals(codeString))
+      return V3CompressionAlgorithm.GZ;
+    if ("Z".equals(codeString))
+      return V3CompressionAlgorithm.Z;
+    if ("Z7".equals(codeString))
+      return V3CompressionAlgorithm.Z7;
+    if ("ZL".equals(codeString))
+      return V3CompressionAlgorithm.ZL;
+    throw new IllegalArgumentException("Unknown V3CompressionAlgorithm code '"+codeString+"'");
+  }
+
+  public String toCode(V3CompressionAlgorithm code) {
+    if (code == V3CompressionAlgorithm.BZ)
+      return "BZ";
+    if (code == V3CompressionAlgorithm.DF)
+      return "DF";
+    if (code == V3CompressionAlgorithm.GZ)
+      return "GZ";
+    if (code == V3CompressionAlgorithm.Z)
+      return "Z";
+    if (code == V3CompressionAlgorithm.Z7)
+      return "Z7";
+    if (code == V3CompressionAlgorithm.ZL)
+      return "ZL";
+    return "?";
+  }
+
+    public String toSystem(V3CompressionAlgorithm code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Confidentiality.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Confidentiality.java
new file mode 100644
index 00000000000..e14bf46b8b2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Confidentiality.java
@@ -0,0 +1,339 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3Confidentiality {
+
+        /**
+         * A specializable code and its leaf codes used in Confidentiality value sets to value the Act.Confidentiality and Role.Confidentiality attribute in accordance with the definition for concept domain "Confidentiality".
+         */
+        _CONFIDENTIALITY, 
+        /**
+         * Definition: Privacy metadata indicating that the information has been de-identified, and there are mitigating circumstances that prevent re-identification, which minimize risk of harm from unauthorized disclosure.  The information requires protection to maintain low sensitivity.
+
+                        
+                           Examples: Includes anonymized, pseudonymized, or non-personally identifiable information such as HIPAA limited data sets.
+
+                        
+                           Map: No clear map to ISO 13606-4 Sensitivity Level (1) Care Management:   RECORD_COMPONENTs that might need to be accessed by a wide range of administrative staff to manage the subject of care's access to health services.
+
+                        
+                           Usage Note: This metadata indicates the receiver may have an obligation to comply with a data use agreement.
+         */
+        L, 
+        /**
+         * Definition: Privacy metadata indicating moderately sensitive information, which presents moderate risk of harm if disclosed without authorization.
+
+                        
+                           Examples: Includes allergies of non-sensitive nature used inform food service; health information a patient authorizes to be used for marketing, released to a bank for a health credit card or savings account; or information in personal health record systems that are not governed under health privacy laws.
+
+                        
+                           Map: Partial Map to ISO 13606-4 Sensitivity Level (2) Clinical Management:  Less sensitive RECORD_COMPONENTs that might need to be accessed by a wider range of personnel not all of whom are actively caring for the patient (e.g. radiology staff).
+
+                        
+                           Usage Note: This metadata indicates that the receiver may be obligated to comply with the receiver's terms of use or privacy policies.
+         */
+        M, 
+        /**
+         * Definition: Privacy metadata indicating that the information is typical, non-stigmatizing health information, which presents typical risk of harm if disclosed without authorization.
+
+                        
+                           Examples: In the US, this includes what HIPAA identifies as the minimum necessary protected health information (PHI) given a covered purpose of use (treatment, payment, or operations).  Includes typical, non-stigmatizing health information disclosed in an application for health, workers compensation, disability, or life insurance.
+
+                        
+                           Map: Partial Map to ISO 13606-4 Sensitivity Level (3) Clinical Care:   Default for normal clinical care access (i.e. most clinical staff directly caring for the patient should be able to access nearly all of the EHR).   Maps to normal confidentiality for treatment information but not to ancillary care, payment and operations.
+
+                        
+                           Usage Note: This metadata indicates that the receiver may be obligated to comply with applicable jurisdictional privacy law or disclosure authorization.
+         */
+        N, 
+        /**
+         * Privacy metadata indicating highly sensitive, potentially stigmatizing information, which presents a high risk to the information subject if disclosed without authorization. May be pre-empted by jurisdictional law, e.g., for public health reporting or emergency treatment.
+
+                        
+                           Examples: Includes information that is additionally protected such as sensitive conditions mental health, HIV, substance abuse, domestic violence, child abuse, genetic disease, and reproductive health; or sensitive demographic information such as a patient's standing as an employee or a celebrity. May be used to indicate proprietary or classified information that is not related to an individual, e.g., secret ingredients in a therapeutic substance; or the name of a manufacturer.
+
+                        
+                           Map: Partial Map to ISO 13606-4 Sensitivity Level (3) Clinical Care: Default for normal clinical care access (i.e. most clinical staff directly caring for the patient should be able to access nearly all of the EHR). Maps to normal confidentiality for treatment information but not to ancillary care, payment and operations..
+
+                        
+                           Usage Note: This metadata indicates that the receiver may be obligated to comply with applicable, prevailing (default) jurisdictional privacy law or disclosure authorization..
+         */
+        R, 
+        /**
+         * Definition: Privacy metadata indicating that the information is not classified as sensitive.
+
+                        
+                           Examples: Includes publicly available information, e.g., business name, phone, email or physical address.
+
+                        
+                           Usage Note: This metadata indicates that the receiver has no obligation to consider additional policies when making access control decisions.   Note that in some jurisdictions, personally identifiable information must be protected as confidential, so it would not be appropriate to assign a confidentiality code of "unrestricted"  to that information even if it is publicly available.
+         */
+        U, 
+        /**
+         * . Privacy metadata indicating that the information is extremely sensitive and likely stigmatizing health information that presents a very high risk if disclosed without authorization.  This information must be kept in the highest confidence.  
+
+                        
+                           Examples:  Includes information about a victim of abuse, patient requested information sensitivity, and taboo subjects relating to health status that must be discussed with the patient by an attending provider before sharing with the patient.  May also include information held under “legal lock� or attorney-client privilege
+
+                        
+                           Map:  This metadata indicates that the receiver may not disclose this information except as directed by the information custodian, who may be the information subject.
+
+                        
+                           Usage Note:  This metadata indicates that the receiver may not disclose this information except as directed by the information custodian, who may be the information subject.
+         */
+        V, 
+        /**
+         * Description: By accessing subject / role and relationship based  rights  (These concepts are mutually exclusive, one and only one is required for a valid confidentiality coding.)
+
+                        
+                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode
+         */
+        _CONFIDENTIALITYBYACCESSKIND, 
+        /**
+         * Description: Since the service class can represent knowledge structures that may be considered a trade or business secret, there is sometimes (though rarely) the need to flag those items as of business level confidentiality.  However, no patient related information may ever be of this confidentiality level.
+
+                        
+                           Deprecation Comment: Replced by ActCode.B
+         */
+        B, 
+        /**
+         * Description: Only clinicians may see this item, billing and administration persons can not access this item without special permission.
+
+                        
+                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode
+         */
+        D, 
+        /**
+         * Description: Access only to individual persons who are mentioned explicitly as actors of this service and whose actor type warrants that access (cf. to actor type code).
+
+                        
+                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode
+         */
+        I, 
+        /**
+         * Description: By information type, only for service catalog entries (multiples allowed). Not to be used with actual patient data!
+
+                        
+                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode
+         */
+        _CONFIDENTIALITYBYINFOTYPE, 
+        /**
+         * Description: Alcohol/drug-abuse related item
+
+                        
+                           Deprecation Comment:Replced by ActCode.ETH
+         */
+        ETH, 
+        /**
+         * Description: HIV and AIDS related item
+
+                        
+                           Deprecation Comment:Replced by ActCode.HIV
+         */
+        HIV, 
+        /**
+         * Description: Psychiatry related item
+
+                        
+                           Deprecation Comment:Replced by ActCode.PSY
+         */
+        PSY, 
+        /**
+         * Description: Sexual assault / domestic violence related item
+
+                        
+                           Deprecation Comment:Replced by ActCode.SDV
+         */
+        SDV, 
+        /**
+         * Description: Modifiers of role based access rights  (multiple allowed)
+
+                        
+                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode
+         */
+        _CONFIDENTIALITYMODIFIERS, 
+        /**
+         * Description: Celebrities are people of public interest (VIP) including employees, whose information require special protection.
+
+                        
+                           Deprecation Comment:Replced by ActCode.CEL
+         */
+        C, 
+        /**
+         * Description: 
+                        
+Information for which the patient seeks heightened confidentiality. Sensitive information is not to be shared with family members.  Information reported by the patient about family members is sensitive by default. Flag can be set or cleared on patient's request.
+                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode
+         */
+        S, 
+        /**
+         * Description: Information not to be disclosed or discussed with patient except through physician assigned to patient in this case.  This is usually a temporary constraint only, example use is a new fatal diagnosis or finding, such as malignancy or HIV.
+
+                        
+                           Deprecation Note:Replced by ActCode.TBOO
+         */
+        T, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3Confidentiality fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_Confidentiality".equals(codeString))
+          return _CONFIDENTIALITY;
+        if ("L".equals(codeString))
+          return L;
+        if ("M".equals(codeString))
+          return M;
+        if ("N".equals(codeString))
+          return N;
+        if ("R".equals(codeString))
+          return R;
+        if ("U".equals(codeString))
+          return U;
+        if ("V".equals(codeString))
+          return V;
+        if ("_ConfidentialityByAccessKind".equals(codeString))
+          return _CONFIDENTIALITYBYACCESSKIND;
+        if ("B".equals(codeString))
+          return B;
+        if ("D".equals(codeString))
+          return D;
+        if ("I".equals(codeString))
+          return I;
+        if ("_ConfidentialityByInfoType".equals(codeString))
+          return _CONFIDENTIALITYBYINFOTYPE;
+        if ("ETH".equals(codeString))
+          return ETH;
+        if ("HIV".equals(codeString))
+          return HIV;
+        if ("PSY".equals(codeString))
+          return PSY;
+        if ("SDV".equals(codeString))
+          return SDV;
+        if ("_ConfidentialityModifiers".equals(codeString))
+          return _CONFIDENTIALITYMODIFIERS;
+        if ("C".equals(codeString))
+          return C;
+        if ("S".equals(codeString))
+          return S;
+        if ("T".equals(codeString))
+          return T;
+        throw new FHIRException("Unknown V3Confidentiality code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _CONFIDENTIALITY: return "_Confidentiality";
+            case L: return "L";
+            case M: return "M";
+            case N: return "N";
+            case R: return "R";
+            case U: return "U";
+            case V: return "V";
+            case _CONFIDENTIALITYBYACCESSKIND: return "_ConfidentialityByAccessKind";
+            case B: return "B";
+            case D: return "D";
+            case I: return "I";
+            case _CONFIDENTIALITYBYINFOTYPE: return "_ConfidentialityByInfoType";
+            case ETH: return "ETH";
+            case HIV: return "HIV";
+            case PSY: return "PSY";
+            case SDV: return "SDV";
+            case _CONFIDENTIALITYMODIFIERS: return "_ConfidentialityModifiers";
+            case C: return "C";
+            case S: return "S";
+            case T: return "T";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/Confidentiality";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _CONFIDENTIALITY: return "A specializable code and its leaf codes used in Confidentiality value sets to value the Act.Confidentiality and Role.Confidentiality attribute in accordance with the definition for concept domain \"Confidentiality\".";
+            case L: return "Definition: Privacy metadata indicating that the information has been de-identified, and there are mitigating circumstances that prevent re-identification, which minimize risk of harm from unauthorized disclosure.  The information requires protection to maintain low sensitivity.\r\n\n                        \n                           Examples: Includes anonymized, pseudonymized, or non-personally identifiable information such as HIPAA limited data sets.\r\n\n                        \n                           Map: No clear map to ISO 13606-4 Sensitivity Level (1) Care Management:   RECORD_COMPONENTs that might need to be accessed by a wide range of administrative staff to manage the subject of care's access to health services.\r\n\n                        \n                           Usage Note: This metadata indicates the receiver may have an obligation to comply with a data use agreement.";
+            case M: return "Definition: Privacy metadata indicating moderately sensitive information, which presents moderate risk of harm if disclosed without authorization.\r\n\n                        \n                           Examples: Includes allergies of non-sensitive nature used inform food service; health information a patient authorizes to be used for marketing, released to a bank for a health credit card or savings account; or information in personal health record systems that are not governed under health privacy laws.\r\n\n                        \n                           Map: Partial Map to ISO 13606-4 Sensitivity Level (2) Clinical Management:  Less sensitive RECORD_COMPONENTs that might need to be accessed by a wider range of personnel not all of whom are actively caring for the patient (e.g. radiology staff).\r\n\n                        \n                           Usage Note: This metadata indicates that the receiver may be obligated to comply with the receiver's terms of use or privacy policies.";
+            case N: return "Definition: Privacy metadata indicating that the information is typical, non-stigmatizing health information, which presents typical risk of harm if disclosed without authorization.\r\n\n                        \n                           Examples: In the US, this includes what HIPAA identifies as the minimum necessary protected health information (PHI) given a covered purpose of use (treatment, payment, or operations).  Includes typical, non-stigmatizing health information disclosed in an application for health, workers compensation, disability, or life insurance.\r\n\n                        \n                           Map: Partial Map to ISO 13606-4 Sensitivity Level (3) Clinical Care:   Default for normal clinical care access (i.e. most clinical staff directly caring for the patient should be able to access nearly all of the EHR).   Maps to normal confidentiality for treatment information but not to ancillary care, payment and operations.\r\n\n                        \n                           Usage Note: This metadata indicates that the receiver may be obligated to comply with applicable jurisdictional privacy law or disclosure authorization.";
+            case R: return "Privacy metadata indicating highly sensitive, potentially stigmatizing information, which presents a high risk to the information subject if disclosed without authorization. May be pre-empted by jurisdictional law, e.g., for public health reporting or emergency treatment.\r\n\n                        \n                           Examples: Includes information that is additionally protected such as sensitive conditions mental health, HIV, substance abuse, domestic violence, child abuse, genetic disease, and reproductive health; or sensitive demographic information such as a patient's standing as an employee or a celebrity. May be used to indicate proprietary or classified information that is not related to an individual, e.g., secret ingredients in a therapeutic substance; or the name of a manufacturer.\r\n\n                        \n                           Map: Partial Map to ISO 13606-4 Sensitivity Level (3) Clinical Care: Default for normal clinical care access (i.e. most clinical staff directly caring for the patient should be able to access nearly all of the EHR). Maps to normal confidentiality for treatment information but not to ancillary care, payment and operations..\r\n\n                        \n                           Usage Note: This metadata indicates that the receiver may be obligated to comply with applicable, prevailing (default) jurisdictional privacy law or disclosure authorization..";
+            case U: return "Definition: Privacy metadata indicating that the information is not classified as sensitive.\r\n\n                        \n                           Examples: Includes publicly available information, e.g., business name, phone, email or physical address.\r\n\n                        \n                           Usage Note: This metadata indicates that the receiver has no obligation to consider additional policies when making access control decisions.   Note that in some jurisdictions, personally identifiable information must be protected as confidential, so it would not be appropriate to assign a confidentiality code of \"unrestricted\"  to that information even if it is publicly available.";
+            case V: return ". Privacy metadata indicating that the information is extremely sensitive and likely stigmatizing health information that presents a very high risk if disclosed without authorization.  This information must be kept in the highest confidence.  \r\n\n                        \n                           Examples:  Includes information about a victim of abuse, patient requested information sensitivity, and taboo subjects relating to health status that must be discussed with the patient by an attending provider before sharing with the patient.  May also include information held under “legal lock� or attorney-client privilege\r\n\n                        \n                           Map:  This metadata indicates that the receiver may not disclose this information except as directed by the information custodian, who may be the information subject.\r\n\n                        \n                           Usage Note:  This metadata indicates that the receiver may not disclose this information except as directed by the information custodian, who may be the information subject.";
+            case _CONFIDENTIALITYBYACCESSKIND: return "Description: By accessing subject / role and relationship based  rights  (These concepts are mutually exclusive, one and only one is required for a valid confidentiality coding.)\r\n\n                        \n                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode";
+            case B: return "Description: Since the service class can represent knowledge structures that may be considered a trade or business secret, there is sometimes (though rarely) the need to flag those items as of business level confidentiality.  However, no patient related information may ever be of this confidentiality level.\r\n\n                        \n                           Deprecation Comment: Replced by ActCode.B";
+            case D: return "Description: Only clinicians may see this item, billing and administration persons can not access this item without special permission.\r\n\n                        \n                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode";
+            case I: return "Description: Access only to individual persons who are mentioned explicitly as actors of this service and whose actor type warrants that access (cf. to actor type code).\r\n\n                        \n                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode";
+            case _CONFIDENTIALITYBYINFOTYPE: return "Description: By information type, only for service catalog entries (multiples allowed). Not to be used with actual patient data!\r\n\n                        \n                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode";
+            case ETH: return "Description: Alcohol/drug-abuse related item\r\n\n                        \n                           Deprecation Comment:Replced by ActCode.ETH";
+            case HIV: return "Description: HIV and AIDS related item\r\n\n                        \n                           Deprecation Comment:Replced by ActCode.HIV";
+            case PSY: return "Description: Psychiatry related item\r\n\n                        \n                           Deprecation Comment:Replced by ActCode.PSY";
+            case SDV: return "Description: Sexual assault / domestic violence related item\r\n\n                        \n                           Deprecation Comment:Replced by ActCode.SDV";
+            case _CONFIDENTIALITYMODIFIERS: return "Description: Modifiers of role based access rights  (multiple allowed)\r\n\n                        \n                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode";
+            case C: return "Description: Celebrities are people of public interest (VIP) including employees, whose information require special protection.\r\n\n                        \n                           Deprecation Comment:Replced by ActCode.CEL";
+            case S: return "Description: \n                        \r\nInformation for which the patient seeks heightened confidentiality. Sensitive information is not to be shared with family members.  Information reported by the patient about family members is sensitive by default. Flag can be set or cleared on patient's request.\n                           Deprecation Comment:Deprecated due to updated confidentiality codes under ActCode";
+            case T: return "Description: Information not to be disclosed or discussed with patient except through physician assigned to patient in this case.  This is usually a temporary constraint only, example use is a new fatal diagnosis or finding, such as malignancy or HIV.\r\n\n                        \n                           Deprecation Note:Replced by ActCode.TBOO";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _CONFIDENTIALITY: return "Confidentiality";
+            case L: return "low";
+            case M: return "moderate";
+            case N: return "normal";
+            case R: return "restricted";
+            case U: return "unrestricted";
+            case V: return "very restricted";
+            case _CONFIDENTIALITYBYACCESSKIND: return "ConfidentialityByAccessKind";
+            case B: return "business";
+            case D: return "clinician";
+            case I: return "individual";
+            case _CONFIDENTIALITYBYINFOTYPE: return "ConfidentialityByInfoType";
+            case ETH: return "substance abuse related";
+            case HIV: return "HIV related";
+            case PSY: return "psychiatry relate";
+            case SDV: return "sexual and domestic violence related";
+            case _CONFIDENTIALITYMODIFIERS: return "ConfidentialityModifiers";
+            case C: return "celebrity";
+            case S: return "sensitive";
+            case T: return "taboo";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ConfidentialityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ConfidentialityEnumFactory.java
new file mode 100644
index 00000000000..e39a85d3336
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ConfidentialityEnumFactory.java
@@ -0,0 +1,134 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ConfidentialityEnumFactory implements EnumFactory {
+
+  public V3Confidentiality fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_Confidentiality".equals(codeString))
+      return V3Confidentiality._CONFIDENTIALITY;
+    if ("L".equals(codeString))
+      return V3Confidentiality.L;
+    if ("M".equals(codeString))
+      return V3Confidentiality.M;
+    if ("N".equals(codeString))
+      return V3Confidentiality.N;
+    if ("R".equals(codeString))
+      return V3Confidentiality.R;
+    if ("U".equals(codeString))
+      return V3Confidentiality.U;
+    if ("V".equals(codeString))
+      return V3Confidentiality.V;
+    if ("_ConfidentialityByAccessKind".equals(codeString))
+      return V3Confidentiality._CONFIDENTIALITYBYACCESSKIND;
+    if ("B".equals(codeString))
+      return V3Confidentiality.B;
+    if ("D".equals(codeString))
+      return V3Confidentiality.D;
+    if ("I".equals(codeString))
+      return V3Confidentiality.I;
+    if ("_ConfidentialityByInfoType".equals(codeString))
+      return V3Confidentiality._CONFIDENTIALITYBYINFOTYPE;
+    if ("ETH".equals(codeString))
+      return V3Confidentiality.ETH;
+    if ("HIV".equals(codeString))
+      return V3Confidentiality.HIV;
+    if ("PSY".equals(codeString))
+      return V3Confidentiality.PSY;
+    if ("SDV".equals(codeString))
+      return V3Confidentiality.SDV;
+    if ("_ConfidentialityModifiers".equals(codeString))
+      return V3Confidentiality._CONFIDENTIALITYMODIFIERS;
+    if ("C".equals(codeString))
+      return V3Confidentiality.C;
+    if ("S".equals(codeString))
+      return V3Confidentiality.S;
+    if ("T".equals(codeString))
+      return V3Confidentiality.T;
+    throw new IllegalArgumentException("Unknown V3Confidentiality code '"+codeString+"'");
+  }
+
+  public String toCode(V3Confidentiality code) {
+    if (code == V3Confidentiality._CONFIDENTIALITY)
+      return "_Confidentiality";
+    if (code == V3Confidentiality.L)
+      return "L";
+    if (code == V3Confidentiality.M)
+      return "M";
+    if (code == V3Confidentiality.N)
+      return "N";
+    if (code == V3Confidentiality.R)
+      return "R";
+    if (code == V3Confidentiality.U)
+      return "U";
+    if (code == V3Confidentiality.V)
+      return "V";
+    if (code == V3Confidentiality._CONFIDENTIALITYBYACCESSKIND)
+      return "_ConfidentialityByAccessKind";
+    if (code == V3Confidentiality.B)
+      return "B";
+    if (code == V3Confidentiality.D)
+      return "D";
+    if (code == V3Confidentiality.I)
+      return "I";
+    if (code == V3Confidentiality._CONFIDENTIALITYBYINFOTYPE)
+      return "_ConfidentialityByInfoType";
+    if (code == V3Confidentiality.ETH)
+      return "ETH";
+    if (code == V3Confidentiality.HIV)
+      return "HIV";
+    if (code == V3Confidentiality.PSY)
+      return "PSY";
+    if (code == V3Confidentiality.SDV)
+      return "SDV";
+    if (code == V3Confidentiality._CONFIDENTIALITYMODIFIERS)
+      return "_ConfidentialityModifiers";
+    if (code == V3Confidentiality.C)
+      return "C";
+    if (code == V3Confidentiality.S)
+      return "S";
+    if (code == V3Confidentiality.T)
+      return "T";
+    return "?";
+  }
+
+    public String toSystem(V3Confidentiality code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerCap.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerCap.java
new file mode 100644
index 00000000000..abe34bed9c5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerCap.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ContainerCap {
+
+        /**
+         * Cap types for medication containers
+         */
+        _MEDICATIONCAP, 
+        /**
+         * A cap designed to be difficult to open for children.  Generally requires multiple simultaneous actions (e.g. squeeze and twist) to open.  Used for products that may be dangerous if ingested or overdosed by children.
+         */
+        CHILD, 
+        /**
+         * A cap designed to be easily removed.  For products intended to be opened by persons with limited strength or dexterity.
+         */
+        EASY, 
+        /**
+         * A non-reactive plastic film covering over the opening of a container.
+         */
+        FILM, 
+        /**
+         * A foil covering (type of foil not specified) over the opening of a container
+         */
+        FOIL, 
+        /**
+         * A non-threaded cap that forms a tight-fitting closure on a container by pushing the fitted end into the conatiner opening
+         */
+        PUSH, 
+        /**
+         * A threaded cap that is screwed onto the opening of a container
+         */
+        SCR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ContainerCap fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_MedicationCap".equals(codeString))
+          return _MEDICATIONCAP;
+        if ("CHILD".equals(codeString))
+          return CHILD;
+        if ("EASY".equals(codeString))
+          return EASY;
+        if ("FILM".equals(codeString))
+          return FILM;
+        if ("FOIL".equals(codeString))
+          return FOIL;
+        if ("PUSH".equals(codeString))
+          return PUSH;
+        if ("SCR".equals(codeString))
+          return SCR;
+        throw new FHIRException("Unknown V3ContainerCap code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _MEDICATIONCAP: return "_MedicationCap";
+            case CHILD: return "CHILD";
+            case EASY: return "EASY";
+            case FILM: return "FILM";
+            case FOIL: return "FOIL";
+            case PUSH: return "PUSH";
+            case SCR: return "SCR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ContainerCap";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _MEDICATIONCAP: return "Cap types for medication containers";
+            case CHILD: return "A cap designed to be difficult to open for children.  Generally requires multiple simultaneous actions (e.g. squeeze and twist) to open.  Used for products that may be dangerous if ingested or overdosed by children.";
+            case EASY: return "A cap designed to be easily removed.  For products intended to be opened by persons with limited strength or dexterity.";
+            case FILM: return "A non-reactive plastic film covering over the opening of a container.";
+            case FOIL: return "A foil covering (type of foil not specified) over the opening of a container";
+            case PUSH: return "A non-threaded cap that forms a tight-fitting closure on a container by pushing the fitted end into the conatiner opening";
+            case SCR: return "A threaded cap that is screwed onto the opening of a container";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _MEDICATIONCAP: return "MedicationCap";
+            case CHILD: return "ChildProof";
+            case EASY: return "EasyOpen";
+            case FILM: return "Film";
+            case FOIL: return "Foil";
+            case PUSH: return "Push Cap";
+            case SCR: return "Screw Cap";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerCapEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerCapEnumFactory.java
new file mode 100644
index 00000000000..b6afa63395b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerCapEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ContainerCapEnumFactory implements EnumFactory {
+
+  public V3ContainerCap fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_MedicationCap".equals(codeString))
+      return V3ContainerCap._MEDICATIONCAP;
+    if ("CHILD".equals(codeString))
+      return V3ContainerCap.CHILD;
+    if ("EASY".equals(codeString))
+      return V3ContainerCap.EASY;
+    if ("FILM".equals(codeString))
+      return V3ContainerCap.FILM;
+    if ("FOIL".equals(codeString))
+      return V3ContainerCap.FOIL;
+    if ("PUSH".equals(codeString))
+      return V3ContainerCap.PUSH;
+    if ("SCR".equals(codeString))
+      return V3ContainerCap.SCR;
+    throw new IllegalArgumentException("Unknown V3ContainerCap code '"+codeString+"'");
+  }
+
+  public String toCode(V3ContainerCap code) {
+    if (code == V3ContainerCap._MEDICATIONCAP)
+      return "_MedicationCap";
+    if (code == V3ContainerCap.CHILD)
+      return "CHILD";
+    if (code == V3ContainerCap.EASY)
+      return "EASY";
+    if (code == V3ContainerCap.FILM)
+      return "FILM";
+    if (code == V3ContainerCap.FOIL)
+      return "FOIL";
+    if (code == V3ContainerCap.PUSH)
+      return "PUSH";
+    if (code == V3ContainerCap.SCR)
+      return "SCR";
+    return "?";
+  }
+
+    public String toSystem(V3ContainerCap code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerSeparator.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerSeparator.java
new file mode 100644
index 00000000000..87472c580a8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerSeparator.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ContainerSeparator {
+
+        /**
+         * A gelatinous type of separator material.
+         */
+        GEL, 
+        /**
+         * No separator material is present in the container.
+         */
+        NONE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ContainerSeparator fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("GEL".equals(codeString))
+          return GEL;
+        if ("NONE".equals(codeString))
+          return NONE;
+        throw new FHIRException("Unknown V3ContainerSeparator code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GEL: return "GEL";
+            case NONE: return "NONE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ContainerSeparator";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GEL: return "A gelatinous type of separator material.";
+            case NONE: return "No separator material is present in the container.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GEL: return "Gel";
+            case NONE: return "None";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerSeparatorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerSeparatorEnumFactory.java
new file mode 100644
index 00000000000..354a54d9076
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContainerSeparatorEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ContainerSeparatorEnumFactory implements EnumFactory {
+
+  public V3ContainerSeparator fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("GEL".equals(codeString))
+      return V3ContainerSeparator.GEL;
+    if ("NONE".equals(codeString))
+      return V3ContainerSeparator.NONE;
+    throw new IllegalArgumentException("Unknown V3ContainerSeparator code '"+codeString+"'");
+  }
+
+  public String toCode(V3ContainerSeparator code) {
+    if (code == V3ContainerSeparator.GEL)
+      return "GEL";
+    if (code == V3ContainerSeparator.NONE)
+      return "NONE";
+    return "?";
+  }
+
+    public String toSystem(V3ContainerSeparator code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContentProcessingMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContentProcessingMode.java
new file mode 100644
index 00000000000..70efffe0103
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContentProcessingMode.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ContentProcessingMode {
+
+        /**
+         * Description:The content should be processed in a sequential fashion.
+         */
+        SEQL, 
+        /**
+         * Description:The content may be processed in any order.
+         */
+        UNOR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ContentProcessingMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("SEQL".equals(codeString))
+          return SEQL;
+        if ("UNOR".equals(codeString))
+          return UNOR;
+        throw new FHIRException("Unknown V3ContentProcessingMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SEQL: return "SEQL";
+            case UNOR: return "UNOR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ContentProcessingMode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SEQL: return "Description:The content should be processed in a sequential fashion.";
+            case UNOR: return "Description:The content may be processed in any order.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SEQL: return "Sequential";
+            case UNOR: return "Unordered";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContentProcessingModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContentProcessingModeEnumFactory.java
new file mode 100644
index 00000000000..c72c79e19f2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContentProcessingModeEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ContentProcessingModeEnumFactory implements EnumFactory {
+
+  public V3ContentProcessingMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("SEQL".equals(codeString))
+      return V3ContentProcessingMode.SEQL;
+    if ("UNOR".equals(codeString))
+      return V3ContentProcessingMode.UNOR;
+    throw new IllegalArgumentException("Unknown V3ContentProcessingMode code '"+codeString+"'");
+  }
+
+  public String toCode(V3ContentProcessingMode code) {
+    if (code == V3ContentProcessingMode.SEQL)
+      return "SEQL";
+    if (code == V3ContentProcessingMode.UNOR)
+      return "UNOR";
+    return "?";
+  }
+
+    public String toSystem(V3ContentProcessingMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContextControl.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContextControl.java
new file mode 100644
index 00000000000..e7139917ed9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContextControl.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ContextControl {
+
+        /**
+         * The association adds to the existing context associated with the Act.  Both this association and any associations propagated from ancestor Acts are interpreted as being related to this Act.
+         */
+        _CONTEXTCONTROLADDITIVE, 
+        /**
+         * The association adds to the existing context associated with the Act, but will not propagate to any descendant Acts reached by conducting ActRelationships (see contextControlCode). Examples: If an 'Author' Participation were marked as "Additive, Non-Propagating" it means that the author will be added to the set of author participations that have propagated from ancestor Acts for the purpose of this Act. However only the previously propagated authors will propagate to any child Acts that allow context to be propagated.
+         */
+        AN, 
+        /**
+         * The association adds to the existing context associated with the Act, and will propagate to any descendant Acts reached by conducting ActRelationships (see contextControlCode). Examples: If an 'Author' Participation were marked as "Additive, Propagating" it means that the author will be added to the set of author participations that have propagated from ancestor Acts, and will itself propagate with the other authors to any child Acts that allow context to be propagated.
+         */
+        AP, 
+        /**
+         * The association applies only to the current Act and will not propagate to any child Acts that are related via a conducting ActRelationship (refer to contextConductionInd).
+         */
+        _CONTEXTCONTROLNONPROPAGATING, 
+        /**
+         * The association is added to the existing context associated with the Act, but overrides an association with the same typeCode. However, this overriding association will not propagate to any descendant Acts reached by conducting ActRelationships (see contextControlCode). Examples: If an 'Author' Participation were marked as "Overriding, Non-Propagating" it means that the author will replace the set of author participations that have propagated from ancestor Acts. Furthermore, no author participations whatsoever will propagate to any child Acts that allow context to be propagated.
+         */
+        ON, 
+        /**
+         * The association adds to the existing context associated with the Act, but replaces associations propagated from ancestor Acts whose typeCodes are the same or more specific.
+         */
+        _CONTEXTCONTROLOVERRIDING, 
+        /**
+         * The association is added to the existing context associated with the Act, but overrides an association with the same typeCode. This overriding association will propagate to any descendant Acts reached by conducting ActRelationships (see contextControlCode). Examples: If an 'Author' Participation were marked as "Overriding, Propagating" it means that the author will replace the set of author participations that have propagated from ancestor Acts, and will itself be the only author to propagate to any child Acts that allow context to be propagated.
+         */
+        OP, 
+        /**
+         * The association propagates to any child Acts that are related via a conducting ActRelationship (refer to contextConductionInd).
+         */
+        _CONTEXTCONTROLPROPAGATING, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ContextControl fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ContextControlAdditive".equals(codeString))
+          return _CONTEXTCONTROLADDITIVE;
+        if ("AN".equals(codeString))
+          return AN;
+        if ("AP".equals(codeString))
+          return AP;
+        if ("_ContextControlNonPropagating".equals(codeString))
+          return _CONTEXTCONTROLNONPROPAGATING;
+        if ("ON".equals(codeString))
+          return ON;
+        if ("_ContextControlOverriding".equals(codeString))
+          return _CONTEXTCONTROLOVERRIDING;
+        if ("OP".equals(codeString))
+          return OP;
+        if ("_ContextControlPropagating".equals(codeString))
+          return _CONTEXTCONTROLPROPAGATING;
+        throw new FHIRException("Unknown V3ContextControl code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _CONTEXTCONTROLADDITIVE: return "_ContextControlAdditive";
+            case AN: return "AN";
+            case AP: return "AP";
+            case _CONTEXTCONTROLNONPROPAGATING: return "_ContextControlNonPropagating";
+            case ON: return "ON";
+            case _CONTEXTCONTROLOVERRIDING: return "_ContextControlOverriding";
+            case OP: return "OP";
+            case _CONTEXTCONTROLPROPAGATING: return "_ContextControlPropagating";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ContextControl";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _CONTEXTCONTROLADDITIVE: return "The association adds to the existing context associated with the Act.  Both this association and any associations propagated from ancestor Acts are interpreted as being related to this Act.";
+            case AN: return "The association adds to the existing context associated with the Act, but will not propagate to any descendant Acts reached by conducting ActRelationships (see contextControlCode). Examples: If an 'Author' Participation were marked as \"Additive, Non-Propagating\" it means that the author will be added to the set of author participations that have propagated from ancestor Acts for the purpose of this Act. However only the previously propagated authors will propagate to any child Acts that allow context to be propagated.";
+            case AP: return "The association adds to the existing context associated with the Act, and will propagate to any descendant Acts reached by conducting ActRelationships (see contextControlCode). Examples: If an 'Author' Participation were marked as \"Additive, Propagating\" it means that the author will be added to the set of author participations that have propagated from ancestor Acts, and will itself propagate with the other authors to any child Acts that allow context to be propagated.";
+            case _CONTEXTCONTROLNONPROPAGATING: return "The association applies only to the current Act and will not propagate to any child Acts that are related via a conducting ActRelationship (refer to contextConductionInd).";
+            case ON: return "The association is added to the existing context associated with the Act, but overrides an association with the same typeCode. However, this overriding association will not propagate to any descendant Acts reached by conducting ActRelationships (see contextControlCode). Examples: If an 'Author' Participation were marked as \"Overriding, Non-Propagating\" it means that the author will replace the set of author participations that have propagated from ancestor Acts. Furthermore, no author participations whatsoever will propagate to any child Acts that allow context to be propagated.";
+            case _CONTEXTCONTROLOVERRIDING: return "The association adds to the existing context associated with the Act, but replaces associations propagated from ancestor Acts whose typeCodes are the same or more specific.";
+            case OP: return "The association is added to the existing context associated with the Act, but overrides an association with the same typeCode. This overriding association will propagate to any descendant Acts reached by conducting ActRelationships (see contextControlCode). Examples: If an 'Author' Participation were marked as \"Overriding, Propagating\" it means that the author will replace the set of author participations that have propagated from ancestor Acts, and will itself be the only author to propagate to any child Acts that allow context to be propagated.";
+            case _CONTEXTCONTROLPROPAGATING: return "The association propagates to any child Acts that are related via a conducting ActRelationship (refer to contextConductionInd).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _CONTEXTCONTROLADDITIVE: return "ContextControlAdditive";
+            case AN: return "additive, non-propagating";
+            case AP: return "additive, propagating";
+            case _CONTEXTCONTROLNONPROPAGATING: return "ContextControlNonPropagating";
+            case ON: return "overriding, non-propagating";
+            case _CONTEXTCONTROLOVERRIDING: return "ContextControlOverriding";
+            case OP: return "overriding, propagating";
+            case _CONTEXTCONTROLPROPAGATING: return "ContextControlPropagating";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContextControlEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContextControlEnumFactory.java
new file mode 100644
index 00000000000..3af887b548f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ContextControlEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ContextControlEnumFactory implements EnumFactory {
+
+  public V3ContextControl fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ContextControlAdditive".equals(codeString))
+      return V3ContextControl._CONTEXTCONTROLADDITIVE;
+    if ("AN".equals(codeString))
+      return V3ContextControl.AN;
+    if ("AP".equals(codeString))
+      return V3ContextControl.AP;
+    if ("_ContextControlNonPropagating".equals(codeString))
+      return V3ContextControl._CONTEXTCONTROLNONPROPAGATING;
+    if ("ON".equals(codeString))
+      return V3ContextControl.ON;
+    if ("_ContextControlOverriding".equals(codeString))
+      return V3ContextControl._CONTEXTCONTROLOVERRIDING;
+    if ("OP".equals(codeString))
+      return V3ContextControl.OP;
+    if ("_ContextControlPropagating".equals(codeString))
+      return V3ContextControl._CONTEXTCONTROLPROPAGATING;
+    throw new IllegalArgumentException("Unknown V3ContextControl code '"+codeString+"'");
+  }
+
+  public String toCode(V3ContextControl code) {
+    if (code == V3ContextControl._CONTEXTCONTROLADDITIVE)
+      return "_ContextControlAdditive";
+    if (code == V3ContextControl.AN)
+      return "AN";
+    if (code == V3ContextControl.AP)
+      return "AP";
+    if (code == V3ContextControl._CONTEXTCONTROLNONPROPAGATING)
+      return "_ContextControlNonPropagating";
+    if (code == V3ContextControl.ON)
+      return "ON";
+    if (code == V3ContextControl._CONTEXTCONTROLOVERRIDING)
+      return "_ContextControlOverriding";
+    if (code == V3ContextControl.OP)
+      return "OP";
+    if (code == V3ContextControl._CONTEXTCONTROLPROPAGATING)
+      return "_ContextControlPropagating";
+    return "?";
+  }
+
+    public String toSystem(V3ContextControl code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DataOperation.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DataOperation.java
new file mode 100644
index 00000000000..9dee0f6048f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DataOperation.java
@@ -0,0 +1,249 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3DataOperation {
+
+        /**
+         * Description:Act on an object or objects.
+         */
+        OPERATE, 
+        /**
+         * Description:Fundamental operation in an Information System (IS) that results only in the act of bringing an object into existence. Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        CREATE, 
+        /**
+         * Description:Fundamental operation in an Information System (IS) that results only in the removal of information about an object from memory or storage. Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface.
+         */
+        DELETE, 
+        /**
+         * Description:Fundamental operation in an IS that results only in initiating performance of a single or set of programs (i.e., software objects). Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface.
+         */
+        EXECUTE, 
+        /**
+         * Description:Fundamental operation in an Information System (IS) that results only in the flow of information about an object to a subject. Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface.
+         */
+        READ, 
+        /**
+         * Definition:Fundamental operation in an Information System (IS) that results only in the revision or alteration of an object. Note: The preceding definition is taken from the HL7 RBAC specification. There is no restriction on how the operation is invoked, e.g., via a user interface.
+         */
+        UPDATE, 
+        /**
+         * Description:Fundamental operation in an Information System (IS) that results only in the addition of information to an object already in existence. Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface.
+         */
+        APPEND, 
+        /**
+         * Description:Change the status of an object representing an Act.
+         */
+        MODIFYSTATUS, 
+        /**
+         * Description:Change the status of an object representing an Act to "aborted", i.e., terminated prior to the originally intended completion. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        ABORT, 
+        /**
+         * Description:Change the status of an object representing an Act to "active", i.e., so it can be performed or is being performed, for the first time. (Contrast with REACTIVATE.) For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        ACTIVATE, 
+        /**
+         * Description:Change the status of an object representing an Act to "cancelled", i.e., abandoned before activation. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        CANCEL, 
+        /**
+         * Description:Change the status of an object representing an Act to "completed", i.e., terminated normally after all of its constituents have been performed. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        COMPLETE, 
+        /**
+         * Description:Change the status of an object representing an Act to "held", i.e., put aside an Act that is still in preparatory stages.  No action can occur until the Act is released. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        HOLD, 
+        /**
+         * Description:Change the status of an object representing an Act to a normal state. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        JUMP, 
+        /**
+         * Description:Change the status of an object representing an Act to "nullified", i.e., treat as though it never existed. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        NULLIFY, 
+        /**
+         * Description:Change the status of an object representing an Act to "obsolete" when it has been replaced by a new instance. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        OBSOLETE, 
+        /**
+         * Description:Change the status of a formerly active object representing an Act to "active", i.e., so it can again be performed or is being performed. (Contrast with ACTIVATE.) For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        REACTIVATE, 
+        /**
+         * Description:Change the status of an object representing an Act so it is no longer "held", i.e., allow action to occur. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        RELEASE, 
+        /**
+         * Description:Change the status of a suspended object representing an Act to "active", i.e., so it can be performed or is being performed. For an HL7 Act, the state transitions per the HL7 Reference Information Model.
+         */
+        RESUME, 
+        /**
+         * Definition:Change the status of an object representing an Act to suspended, i.e., so it is temporarily not in service.
+         */
+        SUSPEND, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3DataOperation fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("OPERATE".equals(codeString))
+          return OPERATE;
+        if ("CREATE".equals(codeString))
+          return CREATE;
+        if ("DELETE".equals(codeString))
+          return DELETE;
+        if ("EXECUTE".equals(codeString))
+          return EXECUTE;
+        if ("READ".equals(codeString))
+          return READ;
+        if ("UPDATE".equals(codeString))
+          return UPDATE;
+        if ("APPEND".equals(codeString))
+          return APPEND;
+        if ("MODIFYSTATUS".equals(codeString))
+          return MODIFYSTATUS;
+        if ("ABORT".equals(codeString))
+          return ABORT;
+        if ("ACTIVATE".equals(codeString))
+          return ACTIVATE;
+        if ("CANCEL".equals(codeString))
+          return CANCEL;
+        if ("COMPLETE".equals(codeString))
+          return COMPLETE;
+        if ("HOLD".equals(codeString))
+          return HOLD;
+        if ("JUMP".equals(codeString))
+          return JUMP;
+        if ("NULLIFY".equals(codeString))
+          return NULLIFY;
+        if ("OBSOLETE".equals(codeString))
+          return OBSOLETE;
+        if ("REACTIVATE".equals(codeString))
+          return REACTIVATE;
+        if ("RELEASE".equals(codeString))
+          return RELEASE;
+        if ("RESUME".equals(codeString))
+          return RESUME;
+        if ("SUSPEND".equals(codeString))
+          return SUSPEND;
+        throw new FHIRException("Unknown V3DataOperation code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case OPERATE: return "OPERATE";
+            case CREATE: return "CREATE";
+            case DELETE: return "DELETE";
+            case EXECUTE: return "EXECUTE";
+            case READ: return "READ";
+            case UPDATE: return "UPDATE";
+            case APPEND: return "APPEND";
+            case MODIFYSTATUS: return "MODIFYSTATUS";
+            case ABORT: return "ABORT";
+            case ACTIVATE: return "ACTIVATE";
+            case CANCEL: return "CANCEL";
+            case COMPLETE: return "COMPLETE";
+            case HOLD: return "HOLD";
+            case JUMP: return "JUMP";
+            case NULLIFY: return "NULLIFY";
+            case OBSOLETE: return "OBSOLETE";
+            case REACTIVATE: return "REACTIVATE";
+            case RELEASE: return "RELEASE";
+            case RESUME: return "RESUME";
+            case SUSPEND: return "SUSPEND";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/DataOperation";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case OPERATE: return "Description:Act on an object or objects.";
+            case CREATE: return "Description:Fundamental operation in an Information System (IS) that results only in the act of bringing an object into existence. Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case DELETE: return "Description:Fundamental operation in an Information System (IS) that results only in the removal of information about an object from memory or storage. Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface.";
+            case EXECUTE: return "Description:Fundamental operation in an IS that results only in initiating performance of a single or set of programs (i.e., software objects). Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface.";
+            case READ: return "Description:Fundamental operation in an Information System (IS) that results only in the flow of information about an object to a subject. Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface.";
+            case UPDATE: return "Definition:Fundamental operation in an Information System (IS) that results only in the revision or alteration of an object. Note: The preceding definition is taken from the HL7 RBAC specification. There is no restriction on how the operation is invoked, e.g., via a user interface.";
+            case APPEND: return "Description:Fundamental operation in an Information System (IS) that results only in the addition of information to an object already in existence. Note: The preceding definition is taken from the HL7 RBAC specification.  There is no restriction on how the operation is invoked, e.g., via a user interface.";
+            case MODIFYSTATUS: return "Description:Change the status of an object representing an Act.";
+            case ABORT: return "Description:Change the status of an object representing an Act to \"aborted\", i.e., terminated prior to the originally intended completion. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case ACTIVATE: return "Description:Change the status of an object representing an Act to \"active\", i.e., so it can be performed or is being performed, for the first time. (Contrast with REACTIVATE.) For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case CANCEL: return "Description:Change the status of an object representing an Act to \"cancelled\", i.e., abandoned before activation. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case COMPLETE: return "Description:Change the status of an object representing an Act to \"completed\", i.e., terminated normally after all of its constituents have been performed. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case HOLD: return "Description:Change the status of an object representing an Act to \"held\", i.e., put aside an Act that is still in preparatory stages.  No action can occur until the Act is released. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case JUMP: return "Description:Change the status of an object representing an Act to a normal state. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case NULLIFY: return "Description:Change the status of an object representing an Act to \"nullified\", i.e., treat as though it never existed. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case OBSOLETE: return "Description:Change the status of an object representing an Act to \"obsolete\" when it has been replaced by a new instance. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case REACTIVATE: return "Description:Change the status of a formerly active object representing an Act to \"active\", i.e., so it can again be performed or is being performed. (Contrast with ACTIVATE.) For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case RELEASE: return "Description:Change the status of an object representing an Act so it is no longer \"held\", i.e., allow action to occur. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case RESUME: return "Description:Change the status of a suspended object representing an Act to \"active\", i.e., so it can be performed or is being performed. For an HL7 Act, the state transitions per the HL7 Reference Information Model.";
+            case SUSPEND: return "Definition:Change the status of an object representing an Act to suspended, i.e., so it is temporarily not in service.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case OPERATE: return "operate";
+            case CREATE: return "create";
+            case DELETE: return "delete";
+            case EXECUTE: return "execute";
+            case READ: return "read";
+            case UPDATE: return "revise";
+            case APPEND: return "append";
+            case MODIFYSTATUS: return "modify status";
+            case ABORT: return "abort";
+            case ACTIVATE: return "activate";
+            case CANCEL: return "cancel";
+            case COMPLETE: return "complete";
+            case HOLD: return "hold";
+            case JUMP: return "jump";
+            case NULLIFY: return "nullify";
+            case OBSOLETE: return "obsolete";
+            case REACTIVATE: return "reactivate";
+            case RELEASE: return "release";
+            case RESUME: return "resume";
+            case SUSPEND: return "suspend";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DataOperationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DataOperationEnumFactory.java
new file mode 100644
index 00000000000..03a21230ef1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DataOperationEnumFactory.java
@@ -0,0 +1,134 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3DataOperationEnumFactory implements EnumFactory {
+
+  public V3DataOperation fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("OPERATE".equals(codeString))
+      return V3DataOperation.OPERATE;
+    if ("CREATE".equals(codeString))
+      return V3DataOperation.CREATE;
+    if ("DELETE".equals(codeString))
+      return V3DataOperation.DELETE;
+    if ("EXECUTE".equals(codeString))
+      return V3DataOperation.EXECUTE;
+    if ("READ".equals(codeString))
+      return V3DataOperation.READ;
+    if ("UPDATE".equals(codeString))
+      return V3DataOperation.UPDATE;
+    if ("APPEND".equals(codeString))
+      return V3DataOperation.APPEND;
+    if ("MODIFYSTATUS".equals(codeString))
+      return V3DataOperation.MODIFYSTATUS;
+    if ("ABORT".equals(codeString))
+      return V3DataOperation.ABORT;
+    if ("ACTIVATE".equals(codeString))
+      return V3DataOperation.ACTIVATE;
+    if ("CANCEL".equals(codeString))
+      return V3DataOperation.CANCEL;
+    if ("COMPLETE".equals(codeString))
+      return V3DataOperation.COMPLETE;
+    if ("HOLD".equals(codeString))
+      return V3DataOperation.HOLD;
+    if ("JUMP".equals(codeString))
+      return V3DataOperation.JUMP;
+    if ("NULLIFY".equals(codeString))
+      return V3DataOperation.NULLIFY;
+    if ("OBSOLETE".equals(codeString))
+      return V3DataOperation.OBSOLETE;
+    if ("REACTIVATE".equals(codeString))
+      return V3DataOperation.REACTIVATE;
+    if ("RELEASE".equals(codeString))
+      return V3DataOperation.RELEASE;
+    if ("RESUME".equals(codeString))
+      return V3DataOperation.RESUME;
+    if ("SUSPEND".equals(codeString))
+      return V3DataOperation.SUSPEND;
+    throw new IllegalArgumentException("Unknown V3DataOperation code '"+codeString+"'");
+  }
+
+  public String toCode(V3DataOperation code) {
+    if (code == V3DataOperation.OPERATE)
+      return "OPERATE";
+    if (code == V3DataOperation.CREATE)
+      return "CREATE";
+    if (code == V3DataOperation.DELETE)
+      return "DELETE";
+    if (code == V3DataOperation.EXECUTE)
+      return "EXECUTE";
+    if (code == V3DataOperation.READ)
+      return "READ";
+    if (code == V3DataOperation.UPDATE)
+      return "UPDATE";
+    if (code == V3DataOperation.APPEND)
+      return "APPEND";
+    if (code == V3DataOperation.MODIFYSTATUS)
+      return "MODIFYSTATUS";
+    if (code == V3DataOperation.ABORT)
+      return "ABORT";
+    if (code == V3DataOperation.ACTIVATE)
+      return "ACTIVATE";
+    if (code == V3DataOperation.CANCEL)
+      return "CANCEL";
+    if (code == V3DataOperation.COMPLETE)
+      return "COMPLETE";
+    if (code == V3DataOperation.HOLD)
+      return "HOLD";
+    if (code == V3DataOperation.JUMP)
+      return "JUMP";
+    if (code == V3DataOperation.NULLIFY)
+      return "NULLIFY";
+    if (code == V3DataOperation.OBSOLETE)
+      return "OBSOLETE";
+    if (code == V3DataOperation.REACTIVATE)
+      return "REACTIVATE";
+    if (code == V3DataOperation.RELEASE)
+      return "RELEASE";
+    if (code == V3DataOperation.RESUME)
+      return "RESUME";
+    if (code == V3DataOperation.SUSPEND)
+      return "SUSPEND";
+    return "?";
+  }
+
+    public String toSystem(V3DataOperation code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DeviceAlertLevel.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DeviceAlertLevel.java
new file mode 100644
index 00000000000..05269af1f54
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DeviceAlertLevel.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3DeviceAlertLevel {
+
+        /**
+         * Shut Down, Fix Problem and Re-initialize
+         */
+        C, 
+        /**
+         * No Corrective Action Needed
+         */
+        N, 
+        /**
+         * Corrective Action Required
+         */
+        S, 
+        /**
+         * Corrective Action Anticipated
+         */
+        W, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3DeviceAlertLevel fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("C".equals(codeString))
+          return C;
+        if ("N".equals(codeString))
+          return N;
+        if ("S".equals(codeString))
+          return S;
+        if ("W".equals(codeString))
+          return W;
+        throw new FHIRException("Unknown V3DeviceAlertLevel code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case C: return "C";
+            case N: return "N";
+            case S: return "S";
+            case W: return "W";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/DeviceAlertLevel";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case C: return "Shut Down, Fix Problem and Re-initialize";
+            case N: return "No Corrective Action Needed";
+            case S: return "Corrective Action Required";
+            case W: return "Corrective Action Anticipated";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case C: return "Critical";
+            case N: return "Normal";
+            case S: return "Serious";
+            case W: return "Warning";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DeviceAlertLevelEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DeviceAlertLevelEnumFactory.java
new file mode 100644
index 00000000000..7f1869a5c43
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DeviceAlertLevelEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3DeviceAlertLevelEnumFactory implements EnumFactory {
+
+  public V3DeviceAlertLevel fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("C".equals(codeString))
+      return V3DeviceAlertLevel.C;
+    if ("N".equals(codeString))
+      return V3DeviceAlertLevel.N;
+    if ("S".equals(codeString))
+      return V3DeviceAlertLevel.S;
+    if ("W".equals(codeString))
+      return V3DeviceAlertLevel.W;
+    throw new IllegalArgumentException("Unknown V3DeviceAlertLevel code '"+codeString+"'");
+  }
+
+  public String toCode(V3DeviceAlertLevel code) {
+    if (code == V3DeviceAlertLevel.C)
+      return "C";
+    if (code == V3DeviceAlertLevel.N)
+      return "N";
+    if (code == V3DeviceAlertLevel.S)
+      return "S";
+    if (code == V3DeviceAlertLevel.W)
+      return "W";
+    return "?";
+  }
+
+    public String toSystem(V3DeviceAlertLevel code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentCompletion.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentCompletion.java
new file mode 100644
index 00000000000..0eb4b5d687e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentCompletion.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3DocumentCompletion {
+
+        /**
+         * A completion status in which a document has been signed manually or electronically by one or more individuals who attest to its accuracy.  No explicit determination is made that the assigned individual has performed the authentication.  While the standard allows multiple instances of authentication, it would be typical to have a single instance of authentication, usually by the assigned individual.
+         */
+        AU, 
+        /**
+         * A completion status in which information has been orally recorded but not yet transcribed.
+         */
+        DI, 
+        /**
+         * A completion status in which document content, other than dictation, has been received but has not been translated into the final electronic format.  Examples include paper documents, whether hand-written or typewritten, and intermediate electronic forms, such as voice to text.
+         */
+        DO, 
+        /**
+         * A completion status in which information is known to be missing from a transcribed document.
+         */
+        IN, 
+        /**
+         * A workflow status where the material has been assigned to personnel to perform the task of transcription. The document remains in this state until the document is transcribed.
+         */
+        IP, 
+        /**
+         * A completion status in which a document has been signed manually or electronically by the individual who is legally responsible for that document. This is the most mature state in the workflow progression.
+         */
+        LA, 
+        /**
+         * A completion status in which a document was created in error or was placed in the wrong chart. The document is no longer available.
+         */
+        NU, 
+        /**
+         * A completion status in which a document is transcribed but not authenticated.
+         */
+        PA, 
+        /**
+         * A completion status where the document is complete and there is no expectation that the document will be signed.
+         */
+        UC, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3DocumentCompletion fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AU".equals(codeString))
+          return AU;
+        if ("DI".equals(codeString))
+          return DI;
+        if ("DO".equals(codeString))
+          return DO;
+        if ("IN".equals(codeString))
+          return IN;
+        if ("IP".equals(codeString))
+          return IP;
+        if ("LA".equals(codeString))
+          return LA;
+        if ("NU".equals(codeString))
+          return NU;
+        if ("PA".equals(codeString))
+          return PA;
+        if ("UC".equals(codeString))
+          return UC;
+        throw new FHIRException("Unknown V3DocumentCompletion code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AU: return "AU";
+            case DI: return "DI";
+            case DO: return "DO";
+            case IN: return "IN";
+            case IP: return "IP";
+            case LA: return "LA";
+            case NU: return "NU";
+            case PA: return "PA";
+            case UC: return "UC";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/DocumentCompletion";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AU: return "A completion status in which a document has been signed manually or electronically by one or more individuals who attest to its accuracy.  No explicit determination is made that the assigned individual has performed the authentication.  While the standard allows multiple instances of authentication, it would be typical to have a single instance of authentication, usually by the assigned individual.";
+            case DI: return "A completion status in which information has been orally recorded but not yet transcribed.";
+            case DO: return "A completion status in which document content, other than dictation, has been received but has not been translated into the final electronic format.  Examples include paper documents, whether hand-written or typewritten, and intermediate electronic forms, such as voice to text.";
+            case IN: return "A completion status in which information is known to be missing from a transcribed document.";
+            case IP: return "A workflow status where the material has been assigned to personnel to perform the task of transcription. The document remains in this state until the document is transcribed.";
+            case LA: return "A completion status in which a document has been signed manually or electronically by the individual who is legally responsible for that document. This is the most mature state in the workflow progression.";
+            case NU: return "A completion status in which a document was created in error or was placed in the wrong chart. The document is no longer available.";
+            case PA: return "A completion status in which a document is transcribed but not authenticated.";
+            case UC: return "A completion status where the document is complete and there is no expectation that the document will be signed.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AU: return "authenticated";
+            case DI: return "dictated";
+            case DO: return "documented";
+            case IN: return "incomplete";
+            case IP: return "in progress";
+            case LA: return "legally authenticated";
+            case NU: return "nullified document";
+            case PA: return "pre-authenticated";
+            case UC: return "unsigned completed document";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentCompletionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentCompletionEnumFactory.java
new file mode 100644
index 00000000000..e8d023d00ea
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentCompletionEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3DocumentCompletionEnumFactory implements EnumFactory {
+
+  public V3DocumentCompletion fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AU".equals(codeString))
+      return V3DocumentCompletion.AU;
+    if ("DI".equals(codeString))
+      return V3DocumentCompletion.DI;
+    if ("DO".equals(codeString))
+      return V3DocumentCompletion.DO;
+    if ("IN".equals(codeString))
+      return V3DocumentCompletion.IN;
+    if ("IP".equals(codeString))
+      return V3DocumentCompletion.IP;
+    if ("LA".equals(codeString))
+      return V3DocumentCompletion.LA;
+    if ("NU".equals(codeString))
+      return V3DocumentCompletion.NU;
+    if ("PA".equals(codeString))
+      return V3DocumentCompletion.PA;
+    if ("UC".equals(codeString))
+      return V3DocumentCompletion.UC;
+    throw new IllegalArgumentException("Unknown V3DocumentCompletion code '"+codeString+"'");
+  }
+
+  public String toCode(V3DocumentCompletion code) {
+    if (code == V3DocumentCompletion.AU)
+      return "AU";
+    if (code == V3DocumentCompletion.DI)
+      return "DI";
+    if (code == V3DocumentCompletion.DO)
+      return "DO";
+    if (code == V3DocumentCompletion.IN)
+      return "IN";
+    if (code == V3DocumentCompletion.IP)
+      return "IP";
+    if (code == V3DocumentCompletion.LA)
+      return "LA";
+    if (code == V3DocumentCompletion.NU)
+      return "NU";
+    if (code == V3DocumentCompletion.PA)
+      return "PA";
+    if (code == V3DocumentCompletion.UC)
+      return "UC";
+    return "?";
+  }
+
+    public String toSystem(V3DocumentCompletion code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentStorage.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentStorage.java
new file mode 100644
index 00000000000..33faff0a775
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentStorage.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3DocumentStorage {
+
+        /**
+         * A storage status in which a document is available on-line.
+         */
+        AC, 
+        /**
+         * A storage status in which a document is available on-line and is also stored off-line for long-term access.
+         */
+        AA, 
+        /**
+         * A storage status in which a document has been stored off-line for long-term access.
+         */
+        AR, 
+        /**
+         * A storage status in which a document is no longer available in this system.
+         */
+        PU, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3DocumentStorage fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AC".equals(codeString))
+          return AC;
+        if ("AA".equals(codeString))
+          return AA;
+        if ("AR".equals(codeString))
+          return AR;
+        if ("PU".equals(codeString))
+          return PU;
+        throw new FHIRException("Unknown V3DocumentStorage code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AC: return "AC";
+            case AA: return "AA";
+            case AR: return "AR";
+            case PU: return "PU";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/DocumentStorage";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AC: return "A storage status in which a document is available on-line.";
+            case AA: return "A storage status in which a document is available on-line and is also stored off-line for long-term access.";
+            case AR: return "A storage status in which a document has been stored off-line for long-term access.";
+            case PU: return "A storage status in which a document is no longer available in this system.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AC: return "active";
+            case AA: return "active and archived";
+            case AR: return "archived (not active)";
+            case PU: return "purged";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentStorageEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentStorageEnumFactory.java
new file mode 100644
index 00000000000..ab361c06d09
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3DocumentStorageEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3DocumentStorageEnumFactory implements EnumFactory {
+
+  public V3DocumentStorage fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AC".equals(codeString))
+      return V3DocumentStorage.AC;
+    if ("AA".equals(codeString))
+      return V3DocumentStorage.AA;
+    if ("AR".equals(codeString))
+      return V3DocumentStorage.AR;
+    if ("PU".equals(codeString))
+      return V3DocumentStorage.PU;
+    throw new IllegalArgumentException("Unknown V3DocumentStorage code '"+codeString+"'");
+  }
+
+  public String toCode(V3DocumentStorage code) {
+    if (code == V3DocumentStorage.AC)
+      return "AC";
+    if (code == V3DocumentStorage.AA)
+      return "AA";
+    if (code == V3DocumentStorage.AR)
+      return "AR";
+    if (code == V3DocumentStorage.PU)
+      return "PU";
+    return "?";
+  }
+
+    public String toSystem(V3DocumentStorage code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EducationLevel.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EducationLevel.java
new file mode 100644
index 00000000000..795425a01f6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EducationLevel.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EducationLevel {
+
+        /**
+         * Associate's or technical degree complete
+         */
+        ASSOC, 
+        /**
+         * College or baccalaureate degree complete
+         */
+        BD, 
+        /**
+         * Elementary School
+         */
+        ELEM, 
+        /**
+         * Graduate or professional Degree complete
+         */
+        GD, 
+        /**
+         * High School or secondary school degree complete
+         */
+        HS, 
+        /**
+         * Some post-baccalaureate education
+         */
+        PB, 
+        /**
+         * Doctoral or post graduate education
+         */
+        POSTG, 
+        /**
+         * Some College education
+         */
+        SCOL, 
+        /**
+         * Some secondary or high school education
+         */
+        SEC, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EducationLevel fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ASSOC".equals(codeString))
+          return ASSOC;
+        if ("BD".equals(codeString))
+          return BD;
+        if ("ELEM".equals(codeString))
+          return ELEM;
+        if ("GD".equals(codeString))
+          return GD;
+        if ("HS".equals(codeString))
+          return HS;
+        if ("PB".equals(codeString))
+          return PB;
+        if ("POSTG".equals(codeString))
+          return POSTG;
+        if ("SCOL".equals(codeString))
+          return SCOL;
+        if ("SEC".equals(codeString))
+          return SEC;
+        throw new FHIRException("Unknown V3EducationLevel code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ASSOC: return "ASSOC";
+            case BD: return "BD";
+            case ELEM: return "ELEM";
+            case GD: return "GD";
+            case HS: return "HS";
+            case PB: return "PB";
+            case POSTG: return "POSTG";
+            case SCOL: return "SCOL";
+            case SEC: return "SEC";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EducationLevel";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ASSOC: return "Associate's or technical degree complete";
+            case BD: return "College or baccalaureate degree complete";
+            case ELEM: return "Elementary School";
+            case GD: return "Graduate or professional Degree complete";
+            case HS: return "High School or secondary school degree complete";
+            case PB: return "Some post-baccalaureate education";
+            case POSTG: return "Doctoral or post graduate education";
+            case SCOL: return "Some College education";
+            case SEC: return "Some secondary or high school education";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ASSOC: return "Associate's or technical degree complete";
+            case BD: return "College or baccalaureate degree complete";
+            case ELEM: return "Elementary School";
+            case GD: return "Graduate or professional Degree complete";
+            case HS: return "High School or secondary school degree complete";
+            case PB: return "Some post-baccalaureate education";
+            case POSTG: return "Doctoral or post graduate education";
+            case SCOL: return "Some College education";
+            case SEC: return "Some secondary or high school education";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EducationLevelEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EducationLevelEnumFactory.java
new file mode 100644
index 00000000000..4f79730808f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EducationLevelEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EducationLevelEnumFactory implements EnumFactory {
+
+  public V3EducationLevel fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ASSOC".equals(codeString))
+      return V3EducationLevel.ASSOC;
+    if ("BD".equals(codeString))
+      return V3EducationLevel.BD;
+    if ("ELEM".equals(codeString))
+      return V3EducationLevel.ELEM;
+    if ("GD".equals(codeString))
+      return V3EducationLevel.GD;
+    if ("HS".equals(codeString))
+      return V3EducationLevel.HS;
+    if ("PB".equals(codeString))
+      return V3EducationLevel.PB;
+    if ("POSTG".equals(codeString))
+      return V3EducationLevel.POSTG;
+    if ("SCOL".equals(codeString))
+      return V3EducationLevel.SCOL;
+    if ("SEC".equals(codeString))
+      return V3EducationLevel.SEC;
+    throw new IllegalArgumentException("Unknown V3EducationLevel code '"+codeString+"'");
+  }
+
+  public String toCode(V3EducationLevel code) {
+    if (code == V3EducationLevel.ASSOC)
+      return "ASSOC";
+    if (code == V3EducationLevel.BD)
+      return "BD";
+    if (code == V3EducationLevel.ELEM)
+      return "ELEM";
+    if (code == V3EducationLevel.GD)
+      return "GD";
+    if (code == V3EducationLevel.HS)
+      return "HS";
+    if (code == V3EducationLevel.PB)
+      return "PB";
+    if (code == V3EducationLevel.POSTG)
+      return "POSTG";
+    if (code == V3EducationLevel.SCOL)
+      return "SCOL";
+    if (code == V3EducationLevel.SEC)
+      return "SEC";
+    return "?";
+  }
+
+    public String toSystem(V3EducationLevel code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EmployeeJobClass.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EmployeeJobClass.java
new file mode 100644
index 00000000000..8bd385af84e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EmployeeJobClass.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EmployeeJobClass {
+
+        /**
+         * Employment in which the employee is expected to work at least a standard work week (defined by the US Bureau of Labor Statistics as 35-44 hours per week)
+         */
+        FT, 
+        /**
+         * Employment in which the employee is expected to work less than a standard work week (defined by the US Bureau of Labor Statistics as 35-44 hours per week)
+         */
+        PT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EmployeeJobClass fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("FT".equals(codeString))
+          return FT;
+        if ("PT".equals(codeString))
+          return PT;
+        throw new FHIRException("Unknown V3EmployeeJobClass code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case FT: return "FT";
+            case PT: return "PT";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EmployeeJobClass";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case FT: return "Employment in which the employee is expected to work at least a standard work week (defined by the US Bureau of Labor Statistics as 35-44 hours per week)";
+            case PT: return "Employment in which the employee is expected to work less than a standard work week (defined by the US Bureau of Labor Statistics as 35-44 hours per week)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case FT: return "full-time";
+            case PT: return "part-time";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EmployeeJobClassEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EmployeeJobClassEnumFactory.java
new file mode 100644
index 00000000000..2ceeba8219c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EmployeeJobClassEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EmployeeJobClassEnumFactory implements EnumFactory {
+
+  public V3EmployeeJobClass fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("FT".equals(codeString))
+      return V3EmployeeJobClass.FT;
+    if ("PT".equals(codeString))
+      return V3EmployeeJobClass.PT;
+    throw new IllegalArgumentException("Unknown V3EmployeeJobClass code '"+codeString+"'");
+  }
+
+  public String toCode(V3EmployeeJobClass code) {
+    if (code == V3EmployeeJobClass.FT)
+      return "FT";
+    if (code == V3EmployeeJobClass.PT)
+      return "PT";
+    return "?";
+  }
+
+    public String toSystem(V3EmployeeJobClass code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterAdmissionSource.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterAdmissionSource.java
new file mode 100644
index 00000000000..7d424054d90
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterAdmissionSource.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EncounterAdmissionSource {
+
+        /**
+         * emergency
+         */
+        E, 
+        /**
+         * labor and delivery
+         */
+        LD, 
+        /**
+         * newborn
+         */
+        NB, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EncounterAdmissionSource fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("E".equals(codeString))
+          return E;
+        if ("LD".equals(codeString))
+          return LD;
+        if ("NB".equals(codeString))
+          return NB;
+        throw new FHIRException("Unknown V3EncounterAdmissionSource code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case E: return "E";
+            case LD: return "LD";
+            case NB: return "NB";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EncounterAdmissionSource";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case E: return "emergency";
+            case LD: return "labor and delivery";
+            case NB: return "newborn";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case E: return "emergency";
+            case LD: return "labor and delivery";
+            case NB: return "newborn";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterAdmissionSourceEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterAdmissionSourceEnumFactory.java
new file mode 100644
index 00000000000..5eef38d9ebd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterAdmissionSourceEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EncounterAdmissionSourceEnumFactory implements EnumFactory {
+
+  public V3EncounterAdmissionSource fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("E".equals(codeString))
+      return V3EncounterAdmissionSource.E;
+    if ("LD".equals(codeString))
+      return V3EncounterAdmissionSource.LD;
+    if ("NB".equals(codeString))
+      return V3EncounterAdmissionSource.NB;
+    throw new IllegalArgumentException("Unknown V3EncounterAdmissionSource code '"+codeString+"'");
+  }
+
+  public String toCode(V3EncounterAdmissionSource code) {
+    if (code == V3EncounterAdmissionSource.E)
+      return "E";
+    if (code == V3EncounterAdmissionSource.LD)
+      return "LD";
+    if (code == V3EncounterAdmissionSource.NB)
+      return "NB";
+    return "?";
+  }
+
+    public String toSystem(V3EncounterAdmissionSource code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterSpecialCourtesy.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterSpecialCourtesy.java
new file mode 100644
index 00000000000..a0bd4a9653e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterSpecialCourtesy.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EncounterSpecialCourtesy {
+
+        /**
+         * extended courtesy
+         */
+        EXT, 
+        /**
+         * normal courtesy
+         */
+        NRM, 
+        /**
+         * professional courtesy
+         */
+        PRF, 
+        /**
+         * Courtesies extended to the staff of the entity providing service.
+         */
+        STF, 
+        /**
+         * very important person
+         */
+        VIP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EncounterSpecialCourtesy fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("EXT".equals(codeString))
+          return EXT;
+        if ("NRM".equals(codeString))
+          return NRM;
+        if ("PRF".equals(codeString))
+          return PRF;
+        if ("STF".equals(codeString))
+          return STF;
+        if ("VIP".equals(codeString))
+          return VIP;
+        throw new FHIRException("Unknown V3EncounterSpecialCourtesy code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case EXT: return "EXT";
+            case NRM: return "NRM";
+            case PRF: return "PRF";
+            case STF: return "STF";
+            case VIP: return "VIP";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EncounterSpecialCourtesy";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case EXT: return "extended courtesy";
+            case NRM: return "normal courtesy";
+            case PRF: return "professional courtesy";
+            case STF: return "Courtesies extended to the staff of the entity providing service.";
+            case VIP: return "very important person";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case EXT: return "extended courtesy";
+            case NRM: return "normal courtesy";
+            case PRF: return "professional courtesy";
+            case STF: return "staff";
+            case VIP: return "very important person";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterSpecialCourtesyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterSpecialCourtesyEnumFactory.java
new file mode 100644
index 00000000000..7263ff55154
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EncounterSpecialCourtesyEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EncounterSpecialCourtesyEnumFactory implements EnumFactory {
+
+  public V3EncounterSpecialCourtesy fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("EXT".equals(codeString))
+      return V3EncounterSpecialCourtesy.EXT;
+    if ("NRM".equals(codeString))
+      return V3EncounterSpecialCourtesy.NRM;
+    if ("PRF".equals(codeString))
+      return V3EncounterSpecialCourtesy.PRF;
+    if ("STF".equals(codeString))
+      return V3EncounterSpecialCourtesy.STF;
+    if ("VIP".equals(codeString))
+      return V3EncounterSpecialCourtesy.VIP;
+    throw new IllegalArgumentException("Unknown V3EncounterSpecialCourtesy code '"+codeString+"'");
+  }
+
+  public String toCode(V3EncounterSpecialCourtesy code) {
+    if (code == V3EncounterSpecialCourtesy.EXT)
+      return "EXT";
+    if (code == V3EncounterSpecialCourtesy.NRM)
+      return "NRM";
+    if (code == V3EncounterSpecialCourtesy.PRF)
+      return "PRF";
+    if (code == V3EncounterSpecialCourtesy.STF)
+      return "STF";
+    if (code == V3EncounterSpecialCourtesy.VIP)
+      return "VIP";
+    return "?";
+  }
+
+    public String toSystem(V3EncounterSpecialCourtesy code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityClass.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityClass.java
new file mode 100644
index 00000000000..7a718dd4022
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityClass.java
@@ -0,0 +1,315 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityClass {
+
+        /**
+         * Corresponds to the Entity class
+         */
+        ENT, 
+        /**
+         * A health chart included to serve as a document receiving entity in the management of medical records.
+         */
+        HCE, 
+        /**
+         * Anything that essentially has the property of life, independent of current state (a dead human corpse is still essentially a living subject).
+         */
+        LIV, 
+        /**
+         * A subtype of living subject that includes all living things except the species Homo Sapiens.
+         */
+        NLIV, 
+        /**
+         * A living subject from the animal kingdom.
+         */
+        ANM, 
+        /**
+         * All single celled living organisms including protozoa, bacteria, yeast, viruses, etc.
+         */
+        MIC, 
+        /**
+         * A living subject from the order of plants.
+         */
+        PLNT, 
+        /**
+         * A living subject of the species homo sapiens.
+         */
+        PSN, 
+        /**
+         * Any thing that has extension in space and mass, may be of living or non-living origin.
+         */
+        MAT, 
+        /**
+         * A substance that is fully defined by an organic or inorganic chemical formula, includes mixtures of other chemical substances. Refine using, e.g., IUPAC codes.
+         */
+        CHEM, 
+        /**
+         * Naturally occurring, processed or manufactured entities that are primarily used as food for humans and animals.
+         */
+        FOOD, 
+        /**
+         * Corresponds to the ManufacturedMaterial class
+         */
+        MMAT, 
+        /**
+         * A container of other entities.
+         */
+        CONT, 
+        /**
+         * A type of container that can hold other containers or other holders.
+         */
+        HOLD, 
+        /**
+         * A subtype of ManufacturedMaterial used in an activity, without being substantially changed through that activity.  The kind of device is identified by the code attribute inherited from Entity.
+
+                        
+                           Usage: This includes durable (reusable) medical equipment as well as disposable equipment.
+         */
+        DEV, 
+        /**
+         * A physical artifact that stores information about the granting of authorization.
+         */
+        CER, 
+        /**
+         * Class to contain unique attributes of diagnostic imaging equipment.
+         */
+        MODDV, 
+        /**
+         * A social or legal structure formed by human beings.
+         */
+        ORG, 
+        /**
+         * An agency of the people of a state often assuming some authority over a certain matter. Includes government, governmental agencies, associations.
+         */
+        PUB, 
+        /**
+         * A politically organized body of people bonded by territory, culture, or ethnicity, having sovereignty (to a certain extent) granted by other states (enclosing or neighboring states). This includes countries (nations), provinces (e.g., one of the United States of America or a French departement), counties or municipalities. Refine using, e.g., ISO country codes, FIPS-PUB state codes, etc.
+         */
+        STATE, 
+        /**
+         * A politically organized body of people bonded by territory and known as a nation.
+         */
+        NAT, 
+        /**
+         * A physical place or site with its containing structure. May be natural or man-made. The geographic position of a place may or may not be constant.
+         */
+        PLC, 
+        /**
+         * The territory of a city, town or other municipality.
+         */
+        CITY, 
+        /**
+         * The territory of a sovereign nation.
+         */
+        COUNTRY, 
+        /**
+         * The territory of a county, parish or other division of a state or province.
+         */
+        COUNTY, 
+        /**
+         * The territory of a state, province, department or other division of a sovereign country.
+         */
+        PROVINCE, 
+        /**
+         * A grouping of resources (personnel, material, or places) to be used for scheduling purposes.  May be a pool of like-type resources, a team, or combination of personnel, material and places.
+         */
+        RGRP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityClass fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ENT".equals(codeString))
+          return ENT;
+        if ("HCE".equals(codeString))
+          return HCE;
+        if ("LIV".equals(codeString))
+          return LIV;
+        if ("NLIV".equals(codeString))
+          return NLIV;
+        if ("ANM".equals(codeString))
+          return ANM;
+        if ("MIC".equals(codeString))
+          return MIC;
+        if ("PLNT".equals(codeString))
+          return PLNT;
+        if ("PSN".equals(codeString))
+          return PSN;
+        if ("MAT".equals(codeString))
+          return MAT;
+        if ("CHEM".equals(codeString))
+          return CHEM;
+        if ("FOOD".equals(codeString))
+          return FOOD;
+        if ("MMAT".equals(codeString))
+          return MMAT;
+        if ("CONT".equals(codeString))
+          return CONT;
+        if ("HOLD".equals(codeString))
+          return HOLD;
+        if ("DEV".equals(codeString))
+          return DEV;
+        if ("CER".equals(codeString))
+          return CER;
+        if ("MODDV".equals(codeString))
+          return MODDV;
+        if ("ORG".equals(codeString))
+          return ORG;
+        if ("PUB".equals(codeString))
+          return PUB;
+        if ("STATE".equals(codeString))
+          return STATE;
+        if ("NAT".equals(codeString))
+          return NAT;
+        if ("PLC".equals(codeString))
+          return PLC;
+        if ("CITY".equals(codeString))
+          return CITY;
+        if ("COUNTRY".equals(codeString))
+          return COUNTRY;
+        if ("COUNTY".equals(codeString))
+          return COUNTY;
+        if ("PROVINCE".equals(codeString))
+          return PROVINCE;
+        if ("RGRP".equals(codeString))
+          return RGRP;
+        throw new FHIRException("Unknown V3EntityClass code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ENT: return "ENT";
+            case HCE: return "HCE";
+            case LIV: return "LIV";
+            case NLIV: return "NLIV";
+            case ANM: return "ANM";
+            case MIC: return "MIC";
+            case PLNT: return "PLNT";
+            case PSN: return "PSN";
+            case MAT: return "MAT";
+            case CHEM: return "CHEM";
+            case FOOD: return "FOOD";
+            case MMAT: return "MMAT";
+            case CONT: return "CONT";
+            case HOLD: return "HOLD";
+            case DEV: return "DEV";
+            case CER: return "CER";
+            case MODDV: return "MODDV";
+            case ORG: return "ORG";
+            case PUB: return "PUB";
+            case STATE: return "STATE";
+            case NAT: return "NAT";
+            case PLC: return "PLC";
+            case CITY: return "CITY";
+            case COUNTRY: return "COUNTRY";
+            case COUNTY: return "COUNTY";
+            case PROVINCE: return "PROVINCE";
+            case RGRP: return "RGRP";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityClass";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ENT: return "Corresponds to the Entity class";
+            case HCE: return "A health chart included to serve as a document receiving entity in the management of medical records.";
+            case LIV: return "Anything that essentially has the property of life, independent of current state (a dead human corpse is still essentially a living subject).";
+            case NLIV: return "A subtype of living subject that includes all living things except the species Homo Sapiens.";
+            case ANM: return "A living subject from the animal kingdom.";
+            case MIC: return "All single celled living organisms including protozoa, bacteria, yeast, viruses, etc.";
+            case PLNT: return "A living subject from the order of plants.";
+            case PSN: return "A living subject of the species homo sapiens.";
+            case MAT: return "Any thing that has extension in space and mass, may be of living or non-living origin.";
+            case CHEM: return "A substance that is fully defined by an organic or inorganic chemical formula, includes mixtures of other chemical substances. Refine using, e.g., IUPAC codes.";
+            case FOOD: return "Naturally occurring, processed or manufactured entities that are primarily used as food for humans and animals.";
+            case MMAT: return "Corresponds to the ManufacturedMaterial class";
+            case CONT: return "A container of other entities.";
+            case HOLD: return "A type of container that can hold other containers or other holders.";
+            case DEV: return "A subtype of ManufacturedMaterial used in an activity, without being substantially changed through that activity.  The kind of device is identified by the code attribute inherited from Entity.\r\n\n                        \n                           Usage: This includes durable (reusable) medical equipment as well as disposable equipment.";
+            case CER: return "A physical artifact that stores information about the granting of authorization.";
+            case MODDV: return "Class to contain unique attributes of diagnostic imaging equipment.";
+            case ORG: return "A social or legal structure formed by human beings.";
+            case PUB: return "An agency of the people of a state often assuming some authority over a certain matter. Includes government, governmental agencies, associations.";
+            case STATE: return "A politically organized body of people bonded by territory, culture, or ethnicity, having sovereignty (to a certain extent) granted by other states (enclosing or neighboring states). This includes countries (nations), provinces (e.g., one of the United States of America or a French departement), counties or municipalities. Refine using, e.g., ISO country codes, FIPS-PUB state codes, etc.";
+            case NAT: return "A politically organized body of people bonded by territory and known as a nation.";
+            case PLC: return "A physical place or site with its containing structure. May be natural or man-made. The geographic position of a place may or may not be constant.";
+            case CITY: return "The territory of a city, town or other municipality.";
+            case COUNTRY: return "The territory of a sovereign nation.";
+            case COUNTY: return "The territory of a county, parish or other division of a state or province.";
+            case PROVINCE: return "The territory of a state, province, department or other division of a sovereign country.";
+            case RGRP: return "A grouping of resources (personnel, material, or places) to be used for scheduling purposes.  May be a pool of like-type resources, a team, or combination of personnel, material and places.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ENT: return "entity";
+            case HCE: return "health chart entity";
+            case LIV: return "living subject";
+            case NLIV: return "non-person living subject";
+            case ANM: return "animal";
+            case MIC: return "microorganism";
+            case PLNT: return "plant";
+            case PSN: return "person";
+            case MAT: return "material";
+            case CHEM: return "chemical substance";
+            case FOOD: return "food";
+            case MMAT: return "manufactured material";
+            case CONT: return "container";
+            case HOLD: return "holder";
+            case DEV: return "device";
+            case CER: return "certificate representation";
+            case MODDV: return "imaging modality";
+            case ORG: return "organization";
+            case PUB: return "public institution";
+            case STATE: return "state";
+            case NAT: return "Nation";
+            case PLC: return "place";
+            case CITY: return "city or town";
+            case COUNTRY: return "country";
+            case COUNTY: return "county or parish";
+            case PROVINCE: return "state or province";
+            case RGRP: return "group";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityClassEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityClassEnumFactory.java
new file mode 100644
index 00000000000..13d2782ac8e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityClassEnumFactory.java
@@ -0,0 +1,162 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityClassEnumFactory implements EnumFactory {
+
+  public V3EntityClass fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ENT".equals(codeString))
+      return V3EntityClass.ENT;
+    if ("HCE".equals(codeString))
+      return V3EntityClass.HCE;
+    if ("LIV".equals(codeString))
+      return V3EntityClass.LIV;
+    if ("NLIV".equals(codeString))
+      return V3EntityClass.NLIV;
+    if ("ANM".equals(codeString))
+      return V3EntityClass.ANM;
+    if ("MIC".equals(codeString))
+      return V3EntityClass.MIC;
+    if ("PLNT".equals(codeString))
+      return V3EntityClass.PLNT;
+    if ("PSN".equals(codeString))
+      return V3EntityClass.PSN;
+    if ("MAT".equals(codeString))
+      return V3EntityClass.MAT;
+    if ("CHEM".equals(codeString))
+      return V3EntityClass.CHEM;
+    if ("FOOD".equals(codeString))
+      return V3EntityClass.FOOD;
+    if ("MMAT".equals(codeString))
+      return V3EntityClass.MMAT;
+    if ("CONT".equals(codeString))
+      return V3EntityClass.CONT;
+    if ("HOLD".equals(codeString))
+      return V3EntityClass.HOLD;
+    if ("DEV".equals(codeString))
+      return V3EntityClass.DEV;
+    if ("CER".equals(codeString))
+      return V3EntityClass.CER;
+    if ("MODDV".equals(codeString))
+      return V3EntityClass.MODDV;
+    if ("ORG".equals(codeString))
+      return V3EntityClass.ORG;
+    if ("PUB".equals(codeString))
+      return V3EntityClass.PUB;
+    if ("STATE".equals(codeString))
+      return V3EntityClass.STATE;
+    if ("NAT".equals(codeString))
+      return V3EntityClass.NAT;
+    if ("PLC".equals(codeString))
+      return V3EntityClass.PLC;
+    if ("CITY".equals(codeString))
+      return V3EntityClass.CITY;
+    if ("COUNTRY".equals(codeString))
+      return V3EntityClass.COUNTRY;
+    if ("COUNTY".equals(codeString))
+      return V3EntityClass.COUNTY;
+    if ("PROVINCE".equals(codeString))
+      return V3EntityClass.PROVINCE;
+    if ("RGRP".equals(codeString))
+      return V3EntityClass.RGRP;
+    throw new IllegalArgumentException("Unknown V3EntityClass code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityClass code) {
+    if (code == V3EntityClass.ENT)
+      return "ENT";
+    if (code == V3EntityClass.HCE)
+      return "HCE";
+    if (code == V3EntityClass.LIV)
+      return "LIV";
+    if (code == V3EntityClass.NLIV)
+      return "NLIV";
+    if (code == V3EntityClass.ANM)
+      return "ANM";
+    if (code == V3EntityClass.MIC)
+      return "MIC";
+    if (code == V3EntityClass.PLNT)
+      return "PLNT";
+    if (code == V3EntityClass.PSN)
+      return "PSN";
+    if (code == V3EntityClass.MAT)
+      return "MAT";
+    if (code == V3EntityClass.CHEM)
+      return "CHEM";
+    if (code == V3EntityClass.FOOD)
+      return "FOOD";
+    if (code == V3EntityClass.MMAT)
+      return "MMAT";
+    if (code == V3EntityClass.CONT)
+      return "CONT";
+    if (code == V3EntityClass.HOLD)
+      return "HOLD";
+    if (code == V3EntityClass.DEV)
+      return "DEV";
+    if (code == V3EntityClass.CER)
+      return "CER";
+    if (code == V3EntityClass.MODDV)
+      return "MODDV";
+    if (code == V3EntityClass.ORG)
+      return "ORG";
+    if (code == V3EntityClass.PUB)
+      return "PUB";
+    if (code == V3EntityClass.STATE)
+      return "STATE";
+    if (code == V3EntityClass.NAT)
+      return "NAT";
+    if (code == V3EntityClass.PLC)
+      return "PLC";
+    if (code == V3EntityClass.CITY)
+      return "CITY";
+    if (code == V3EntityClass.COUNTRY)
+      return "COUNTRY";
+    if (code == V3EntityClass.COUNTY)
+      return "COUNTY";
+    if (code == V3EntityClass.PROVINCE)
+      return "PROVINCE";
+    if (code == V3EntityClass.RGRP)
+      return "RGRP";
+    return "?";
+  }
+
+    public String toSystem(V3EntityClass code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityCode.java
new file mode 100644
index 00000000000..76e1ef76fbc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityCode.java
@@ -0,0 +1,1382 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityCode {
+
+        /**
+         * Types of Material for EntityClass "MAT"
+         */
+        _MATERIALENTITYCLASSTYPE, 
+        /**
+         * Material intended to hold another material for purpose of storage or transport.
+         */
+        _CONTAINERENTITYTYPE, 
+        /**
+         * A material intended to hold other materials for purposes of storage or transportation
+         */
+        PKG, 
+        /**
+         * A container having dimensions that adjust somewhat based on the amount and shape of the material placed within it.
+         */
+        _NONRIGIDCONTAINERENTITYTYPE, 
+        /**
+         * A pouched or pendulous container.
+         */
+        BAG, 
+        /**
+         * A paper
+         */
+        PACKT, 
+        /**
+         * A small bag or container made of a soft material.
+         */
+        PCH, 
+        /**
+         * A small bag or packet containing a small portion of a substance.
+         */
+        SACH, 
+        /**
+         * A container having a fixed and inflexible dimensions and volume
+         */
+        _RIGIDCONTAINERENTITYTYPE, 
+        /**
+         * Container intended to contain sufficient material for only one use.
+         */
+        _INDIVIDUALPACKAGEENTITYTYPE, 
+        /**
+         * A small sealed glass container that holds a measured amount of a medicinal substance.
+         */
+        AMP, 
+        /**
+         * Individually dosed ophthalmic solution.  One time eye dropper dispenser.
+         */
+        MINIM, 
+        /**
+         * Individually dosed inhalation solution.
+         */
+        NEBAMP, 
+        /**
+         * A container either glass or plastic and a narrow neck, for storing liquid.
+         */
+        OVUL, 
+        /**
+         * A container intended to contain sufficient material for more than one use.  (I.e. Material is intended to be removed from the container at more than one discrete time period.)
+         */
+        _MULTIUSECONTAINERENTITYTYPE, 
+        /**
+         * A container, typically rounded, either glass or plastic with a narrow neck and capable of storing liquid.
+         */
+        BOT, 
+        /**
+         * A bottle of yellow to brown color.  Used to store light-sensitive materials
+         */
+        BOTA, 
+        /**
+         * A bottle with a cap designed to release the contained liquid in droplets of a specific size.
+         */
+        BOTD, 
+        /**
+         * A bottle made of glass
+         */
+        BOTG, 
+        /**
+         * A bottle made of plastic
+         */
+        BOTP, 
+        /**
+         * A bottle made of polyethylene
+         */
+        BOTPLY, 
+        /**
+         * A 6-sided container commonly made from paper or cardboard used for solid forms.
+         */
+        BOX, 
+        /**
+         * A metal container in which a material is hermetically sealed to enable storage over long periods.
+         */
+        CAN, 
+        /**
+         * A sealed container of liquid or powder intended to be loaded into a device.
+         */
+        CART, 
+        /**
+         * A pressurized metal container holding a substance released as a spray or aerosol.
+         */
+        CNSTR, 
+        /**
+         * A container of glass, earthenware, plastic, etc.  Top of the container has a diameter of similar size to the diameter of the container as a whole
+         */
+        JAR, 
+        /**
+         * A deep vessel  for holding liquids, with a handle and often with a spout or lip shape for pouring.
+         */
+        JUG, 
+        /**
+         * A lidded container made of thin sheet metal.
+         */
+        TIN, 
+        /**
+         * An open flat bottomed round container.
+         */
+        TUB, 
+        /**
+         * A long hollow rigid or flexible cylinder.  Material is extruded by squeezing the container.
+         */
+        TUBE, 
+        /**
+         * A small cylindrical glass for holding liquid medicines.
+         */
+        VIAL, 
+        /**
+         * A bubblepack.  Medications sealed individually, separated into doses.
+         */
+        BLSTRPK, 
+        /**
+         * A bubble pack card.  Multiple individual/separated doses.
+         */
+        CARD, 
+        /**
+         * A container intended to contain sufficient material for more than one use, but grouped or organized to provide individual access to sufficient material for a single use.  Often used to ensure that the proper type and amount of material is consumed/expended for each use.
+         */
+        COMPPKG, 
+        /**
+         * Rotatable dispenser.  Eg. Birth control package.
+         */
+        DIALPK, 
+        /**
+         * Object that is thin, flat, and circular.  Doses of medication often contained in bubbles on the disk.
+         */
+        DISK, 
+        /**
+         * Special packaging that will help patients take their medications on a regular basis.
+         */
+        DOSET, 
+        /**
+         * A continuous strip of plastic sectioned into individual pouches, each one containing the quantity of 1 or more medications intended to be administered at a specific time
+         */
+        STRIP, 
+        /**
+         * A container for a diverse collection of products intended to be used together for some purpose (e.g. Medicinal kits often contain a syringe, a needle and the injectable medication).
+         */
+        KIT, 
+        /**
+         * A kit in which the components are interconnected.
+         */
+        SYSTM, 
+        /**
+         * A device with direct or indirect therapeutic purpose.  Values for EntityCode when EntityClass = "DEV"
+         */
+        _MEDICALDEVICE, 
+        /**
+         * A device used to allow access to a part of a body
+         */
+        _ACCESSMEDICALDEVICE, 
+        /**
+         * A hollow tube used to administer a substance into a vein, artery or body cavity
+         */
+        LINE, 
+        /**
+         * A line used to administer a substance into an artery
+         */
+        IALINE, 
+        /**
+         * A line used to administer a substance into a vein
+         */
+        IVLINE, 
+        /**
+         * A device intended to administer a substance to a subject
+         */
+        _ADMINISTRATIONMEDICALDEVICE, 
+        /**
+         * A device intended to administer liquid into a subject via a
+         */
+        _INJECTIONMEDICALDEVICE, 
+        /**
+         * Automatically injects medication.
+         */
+        AINJ, 
+        /**
+         * A device which can contain a cartridge for injection purposes.  Eg. Insulin pen.
+         */
+        PEN, 
+        /**
+         * A barrel with a plunger.
+         */
+        SYR, 
+        /**
+         * A device used to apply a liquid or powder to a surface.
+         */
+        APLCTR, 
+        /**
+         * A small device used for inhaling medicine in the form of a vapour or gas in order to ease a respiratory condition such as asthma or to relieve nasal congestion.
+         */
+        INH, 
+        /**
+         * The device used to inhale the doses of medication contained in the disk form.
+         */
+        DSKS, 
+        /**
+         * The device used to inhale the doses of medication contained in the disk form.
+         */
+        DSKUNH, 
+        /**
+         * Asthma medication delivery device.
+         */
+        TRBINH, 
+        /**
+         * A device that is used to raise, compress, or transfer liquids or gases and is operated by a piston or similar mechanism.
+         */
+        PMP, 
+        /**
+         * Set of codes related to specimen additives
+         */
+        _SPECIMENADDITIVEENTITY, 
+        /**
+         * ACD Solution A of trisodium citrate, 22.0g/L; citric acid, 8.0 g/L; and dextrose 24.5 g/L. Used in Blood banking and histocompatibilty testing
+         */
+        ACDA, 
+        /**
+         * ACD Solution B of trisodium citrate, 13.2g/L; citric acid, 4.8 g/L; and dextrose 14.7 g/L. Used in Blood banking and histocompatibilty testing.
+         */
+        ACDB, 
+        /**
+         * 50% V/V acetic acid in water.  Used as  a urine preservative
+         */
+        ACET, 
+        /**
+         * Sodium Chloride 3.0g, Potassium Chloride 0.2g, Calcium Chloride 0.1g, Magnesium Chloride 0.1g, Monopotassium Phosphate 0.2g, Disodium Phosphate 1.15g, Sodium Thiogly collate 1.0g, Distilled Water 1 liter
+         */
+        AMIES, 
+        /**
+         * Any medium used to maintain bacterial viability (e.g. Stuart's, Cary-Blair, Amies)
+         */
+        BACTM, 
+        /**
+         * Formaldehyde 4% w/v; methyl alcohol 1% w/v; phosphate buffering salts. Tissue preservative
+         */
+        BF10, 
+        /**
+         * Powdered boric acid (usually 10 g) added to 24-hour urine collections as a preservative.
+         */
+        BOR, 
+        /**
+         * Picric acid, saturated aqueous solution (750.0 ml), 37-40% formalin (250.0 ml), glacial acetic acid (50.0 ml). Tissue preservative.
+         */
+        BOUIN, 
+        /**
+         * 50% skim milk in 0.01 M phosphate-buffered saline.  Maintain virus viability
+         */
+        BSKM, 
+        /**
+         * A 3.2% solution of Sodium Citrate in water.  Used as a blood preservative
+         */
+        C32, 
+        /**
+         * A 3.8% solution of Sodium Citrate in water. Used as a blood preservative
+         */
+        C38, 
+        /**
+         * A modification of buffered 10% formalin used as a general tissue preservative.
+         */
+        CARS, 
+        /**
+         * Sodium Thioglycollate 1.5 g, Disodium Hydrogen Phosphate 1.1 g, Sodium Chloride 5.0 g, Calcium Chloride 0.09 g, Agar 5.0 g, per Liter of Water
+         */
+        CARY, 
+        /**
+         * Any of a number of non-nutritive buffered media used to maintain Chlamydia viability during transportation to the laboratory
+         */
+        CHLTM, 
+        /**
+         * Buffered tri-sodium citrate solution with theophylline, adenosine and dipyridamole
+         */
+        CTAD, 
+        /**
+         * Potassium EDTA 15% solution in water
+         */
+        EDTK15, 
+        /**
+         * Potassium EDTA 7.5% solution in water
+         */
+        EDTK75, 
+        /**
+         * Sodium fluoride and Disodium EDTA
+         */
+        EDTN, 
+        /**
+         * Any of a number of non-nutritive buffered media used to maintain enteric bacterial viability during transportation to the laboratory
+         */
+        ENT, 
+        /**
+         * A 10% v/v solution in water of formalin( a 37% solution of formaldehyde and water).  Used for tissue preservation.
+         */
+        F10, 
+        /**
+         * Thrombin plus soybean trypsin inhibitor.  For use in identifying fibrn degredation products.
+         */
+        FDP, 
+        /**
+         * Sodium fluoride, 10mg added as a urine preservative.
+         */
+        FL10, 
+        /**
+         * Sodium fluoride, 100mg added as a urine preservative.
+         */
+        FL100, 
+        /**
+         * A solution of HCl containing 6moles of hydrogen ion/L. Used as a Urine Preservative.
+         */
+        HCL6, 
+        /**
+         * Ammonium heparin
+         */
+        HEPA, 
+        /**
+         * Lithium heparin salt
+         */
+        HEPL, 
+        /**
+         * Sodium heparin salt
+         */
+        HEPN, 
+        /**
+         * 6N Nitric acid used to preserve urine for heavy metal analysis.
+         */
+        HNO3, 
+        /**
+         * A transport medium formulated to maintain Bordetella pertussis viability.
+         */
+        JKM, 
+        /**
+         * 5% Glutaraldehyde, 4% Formaldehyde in 0.08M buffer. Tissue preservation
+         */
+        KARN, 
+        /**
+         * Potassium oxalate and sodium fluoride in a 1.25:1 ratio
+         */
+        KOX, 
+        /**
+         * Iodoacetate lithium salt
+         */
+        LIA, 
+        /**
+         * Modified Hank's balanced salt solution supplemented with bovine serum albumin, gelatin, sucrose and glutamic acid. It is buffered to pH 7.3+ or - 0.2 with HEPES buffer. Phenol red is used to indicate pH. Vancomycin, Amphotericin B and Colistin are used to
+         */
+        M4, 
+        /**
+         * Modified Hank's balanced salt solution supplemented with bovine serum albumin, gelatin, sucrose and glutamic acid. It is buffered to pH 7.3+ or - 0.2 with Hepes buffer. Phenol red is used to indicate pH. Gentamicin and amphotericin B are used to inhibit c
+         */
+        M4RT, 
+        /**
+         * Modified Hank's balanced salt solution supplemented with protein stabilizers, sucrose and glutamic acid. It is buffered to pH 7.3+ or - 0.2 with Hepes buffer. Phenol red is used to indicate pH. Vancomycin, Amphotericin B and Colistin are used to inhibit c
+         */
+        M5, 
+        /**
+         * 1M potassium citrate, pH 7.0 2.5 ml, 0.1M magnesium sulfate 5.0 ml, 0.1M N-ethyl malemide  5.0 ml, dH2O 87.5 ml, ammonium sulfate 55gm. Preserve antigens for Immunofluorescence procedures
+         */
+        MICHTM, 
+        /**
+         * A buffered medium with ammonium sulfate added to preserve antigens for Immunofluorescence procedures
+         */
+        MMDTM, 
+        /**
+         * Sodium fluoride
+         */
+        NAF, 
+        /**
+         * No additive. Specifically identifes the specimen as having no additives.
+         */
+        NONE, 
+        /**
+         * 0.12 g NaCl, 0.004 g MgSO, 0.004 g, CaCl, 0.142 g Na2HPO4 and 0.136 g KH2PO4 per liter of distilled water. Maintain Acanthaoemba viability.
+         */
+        PAGE, 
+        /**
+         * Phenol. Urine preservative
+         */
+        PHENOL, 
+        /**
+         * Polyvinyl alcohol
+         */
+        PVA, 
+        /**
+         * A transport medium formulated to maintain Bordetella pertussis viability.
+         */
+        RLM, 
+        /**
+         * Diatomaceous earth. For glucose determination blood samples
+         */
+        SILICA, 
+        /**
+         * Sodium polyanethol sulfonate in saline. Anticomplementary and antiphagocytic properties. Used in blood culture collection.
+         */
+        SPS, 
+        /**
+         * Polymer separator gel with clot activator
+         */
+        SST, 
+        /**
+         * Sodium Glycerophosphate 10.0g, Calcium Chloride 0.1g, Mercaptoacetic Acid 1.0ml, Distilled Water 1 liter
+         */
+        STUTM, 
+        /**
+         * Thrombin. Accelerates clotting.
+         */
+        THROM, 
+        /**
+         * 2-Isopropyl-5-methyl phenol. A preservative for 24 Hr Urine samples
+         */
+        THYMOL, 
+        /**
+         * A nutritive medium with a reducing agent  (sodium thioglycolate) which, due to a chemical reaction, removes oxygen from the broth.
+         */
+        THYO, 
+        /**
+         * Also known as Methylbenzene; Toluol; Phenylmethane. A preservative for 24 Hr Urine samples
+         */
+        TOLU, 
+        /**
+         * A buffered salt solution with antifungal agents added for the collection and transport of Ureaplasma specimens.
+         */
+        URETM, 
+        /**
+         * Sucrose 74.6g, Potassium hydrogenphosphate 0.52g, L-glutamic acid 0.72g, Bovine serum albumin 5.0g, Gentamicin 50mg, Potassium dihydrogenphosphate 1.25g, L-15 medium 9.9L, Water to 10L. Maintain Virus viability.
+         */
+        VIRTM, 
+        /**
+         * 3.8% Citrate buffered to a pH of 5.5 for Westergren Sedimentation Rate
+         */
+        WEST, 
+        /**
+         * A manufactured product that is produced from the raw blood oi a donor with the intention of using it in a recipient transfusion.
+         */
+        BLDPRD, 
+        /**
+         * A Type of medicine that creates an immune protection without the recipient experiencing the disease.
+         */
+        VCCNE, 
+        /**
+         * A substance whose therapeutic effect is produced by chemical action within the body.
+         */
+        _DRUGENTITY, 
+        /**
+         * Any substance or mixture of substances manufactured, sold or represented for use in: (a) the diagnosis, treatment, mitigation or prevention of a disease, disorder, abnormal physical state, or its symptoms, in human beings or animals; (b) restoring, correcting or modifying organic functions in human beings or animals.
+         */
+        _CLINICALDRUG, 
+        /**
+         * Indicates types of allergy and intolerance agents which are non-drugs.  (E.g. foods, latex, etc.)
+         */
+        _NONDRUGAGENTENTITY, 
+        /**
+         * egg
+         */
+        NDA01, 
+        /**
+         * fish
+         */
+        NDA02, 
+        /**
+         * lactose
+         */
+        NDA03, 
+        /**
+         * peanut
+         */
+        NDA04, 
+        /**
+         * soy
+         */
+        NDA05, 
+        /**
+         * sulfites
+         */
+        NDA06, 
+        /**
+         * wheat or gluten
+         */
+        NDA07, 
+        /**
+         * isocyanates
+         */
+        NDA08, 
+        /**
+         * solvents
+         */
+        NDA09, 
+        /**
+         * oils
+         */
+        NDA10, 
+        /**
+         * venoms
+         */
+        NDA11, 
+        /**
+         * latex
+         */
+        NDA12, 
+        /**
+         * shellfish
+         */
+        NDA13, 
+        /**
+         * strawberries
+         */
+        NDA14, 
+        /**
+         * tomatoes
+         */
+        NDA15, 
+        /**
+         * dust
+         */
+        NDA16, 
+        /**
+         * dust mites
+         */
+        NDA17, 
+        /**
+         * Further classifies entities of classCode ORG.
+         */
+        _ORGANIZATIONENTITYTYPE, 
+        /**
+         * The group of persons who occupy a single housing unit.
+         */
+        HHOLD, 
+        /**
+         * Codes identifying nation states.  Allows for finer grained specification of Entity with classcode <= NAT
+
+                        
+                           Example:ISO3166 country codes.
+         */
+        NAT, 
+        /**
+         * An organization that provides religious rites of worship.
+         */
+        RELIG, 
+        /**
+         * Types of places for EntityClass "PLC"
+         */
+        _PLACEENTITYTYPE, 
+        /**
+         * The location of a bed
+         */
+        BED, 
+        /**
+         * The location of a building
+         */
+        BLDG, 
+        /**
+         * The location of a floor of a building
+         */
+        FLOOR, 
+        /**
+         * The location of a room
+         */
+        ROOM, 
+        /**
+         * The location of a wing of a building (e.g. East Wing).  The same room number for the same floor number can be distinguished by wing number in some situations
+         */
+        WING, 
+        /**
+         * Codes to characterize a Resource Group using categories that typify its membership and/or function
+
+                        .
+
+                        
+                           Example: PractitionerGroup
+         */
+        _RESOURCEGROUPENTITYTYPE, 
+        /**
+         * PractitionerGroup
+         */
+        PRAC, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_MaterialEntityClassType".equals(codeString))
+          return _MATERIALENTITYCLASSTYPE;
+        if ("_ContainerEntityType".equals(codeString))
+          return _CONTAINERENTITYTYPE;
+        if ("PKG".equals(codeString))
+          return PKG;
+        if ("_NonRigidContainerEntityType".equals(codeString))
+          return _NONRIGIDCONTAINERENTITYTYPE;
+        if ("BAG".equals(codeString))
+          return BAG;
+        if ("PACKT".equals(codeString))
+          return PACKT;
+        if ("PCH".equals(codeString))
+          return PCH;
+        if ("SACH".equals(codeString))
+          return SACH;
+        if ("_RigidContainerEntityType".equals(codeString))
+          return _RIGIDCONTAINERENTITYTYPE;
+        if ("_IndividualPackageEntityType".equals(codeString))
+          return _INDIVIDUALPACKAGEENTITYTYPE;
+        if ("AMP".equals(codeString))
+          return AMP;
+        if ("MINIM".equals(codeString))
+          return MINIM;
+        if ("NEBAMP".equals(codeString))
+          return NEBAMP;
+        if ("OVUL".equals(codeString))
+          return OVUL;
+        if ("_MultiUseContainerEntityType".equals(codeString))
+          return _MULTIUSECONTAINERENTITYTYPE;
+        if ("BOT".equals(codeString))
+          return BOT;
+        if ("BOTA".equals(codeString))
+          return BOTA;
+        if ("BOTD".equals(codeString))
+          return BOTD;
+        if ("BOTG".equals(codeString))
+          return BOTG;
+        if ("BOTP".equals(codeString))
+          return BOTP;
+        if ("BOTPLY".equals(codeString))
+          return BOTPLY;
+        if ("BOX".equals(codeString))
+          return BOX;
+        if ("CAN".equals(codeString))
+          return CAN;
+        if ("CART".equals(codeString))
+          return CART;
+        if ("CNSTR".equals(codeString))
+          return CNSTR;
+        if ("JAR".equals(codeString))
+          return JAR;
+        if ("JUG".equals(codeString))
+          return JUG;
+        if ("TIN".equals(codeString))
+          return TIN;
+        if ("TUB".equals(codeString))
+          return TUB;
+        if ("TUBE".equals(codeString))
+          return TUBE;
+        if ("VIAL".equals(codeString))
+          return VIAL;
+        if ("BLSTRPK".equals(codeString))
+          return BLSTRPK;
+        if ("CARD".equals(codeString))
+          return CARD;
+        if ("COMPPKG".equals(codeString))
+          return COMPPKG;
+        if ("DIALPK".equals(codeString))
+          return DIALPK;
+        if ("DISK".equals(codeString))
+          return DISK;
+        if ("DOSET".equals(codeString))
+          return DOSET;
+        if ("STRIP".equals(codeString))
+          return STRIP;
+        if ("KIT".equals(codeString))
+          return KIT;
+        if ("SYSTM".equals(codeString))
+          return SYSTM;
+        if ("_MedicalDevice".equals(codeString))
+          return _MEDICALDEVICE;
+        if ("_AccessMedicalDevice".equals(codeString))
+          return _ACCESSMEDICALDEVICE;
+        if ("LINE".equals(codeString))
+          return LINE;
+        if ("IALINE".equals(codeString))
+          return IALINE;
+        if ("IVLINE".equals(codeString))
+          return IVLINE;
+        if ("_AdministrationMedicalDevice".equals(codeString))
+          return _ADMINISTRATIONMEDICALDEVICE;
+        if ("_InjectionMedicalDevice".equals(codeString))
+          return _INJECTIONMEDICALDEVICE;
+        if ("AINJ".equals(codeString))
+          return AINJ;
+        if ("PEN".equals(codeString))
+          return PEN;
+        if ("SYR".equals(codeString))
+          return SYR;
+        if ("APLCTR".equals(codeString))
+          return APLCTR;
+        if ("INH".equals(codeString))
+          return INH;
+        if ("DSKS".equals(codeString))
+          return DSKS;
+        if ("DSKUNH".equals(codeString))
+          return DSKUNH;
+        if ("TRBINH".equals(codeString))
+          return TRBINH;
+        if ("PMP".equals(codeString))
+          return PMP;
+        if ("_SpecimenAdditiveEntity".equals(codeString))
+          return _SPECIMENADDITIVEENTITY;
+        if ("ACDA".equals(codeString))
+          return ACDA;
+        if ("ACDB".equals(codeString))
+          return ACDB;
+        if ("ACET".equals(codeString))
+          return ACET;
+        if ("AMIES".equals(codeString))
+          return AMIES;
+        if ("BACTM".equals(codeString))
+          return BACTM;
+        if ("BF10".equals(codeString))
+          return BF10;
+        if ("BOR".equals(codeString))
+          return BOR;
+        if ("BOUIN".equals(codeString))
+          return BOUIN;
+        if ("BSKM".equals(codeString))
+          return BSKM;
+        if ("C32".equals(codeString))
+          return C32;
+        if ("C38".equals(codeString))
+          return C38;
+        if ("CARS".equals(codeString))
+          return CARS;
+        if ("CARY".equals(codeString))
+          return CARY;
+        if ("CHLTM".equals(codeString))
+          return CHLTM;
+        if ("CTAD".equals(codeString))
+          return CTAD;
+        if ("EDTK15".equals(codeString))
+          return EDTK15;
+        if ("EDTK75".equals(codeString))
+          return EDTK75;
+        if ("EDTN".equals(codeString))
+          return EDTN;
+        if ("ENT".equals(codeString))
+          return ENT;
+        if ("F10".equals(codeString))
+          return F10;
+        if ("FDP".equals(codeString))
+          return FDP;
+        if ("FL10".equals(codeString))
+          return FL10;
+        if ("FL100".equals(codeString))
+          return FL100;
+        if ("HCL6".equals(codeString))
+          return HCL6;
+        if ("HEPA".equals(codeString))
+          return HEPA;
+        if ("HEPL".equals(codeString))
+          return HEPL;
+        if ("HEPN".equals(codeString))
+          return HEPN;
+        if ("HNO3".equals(codeString))
+          return HNO3;
+        if ("JKM".equals(codeString))
+          return JKM;
+        if ("KARN".equals(codeString))
+          return KARN;
+        if ("KOX".equals(codeString))
+          return KOX;
+        if ("LIA".equals(codeString))
+          return LIA;
+        if ("M4".equals(codeString))
+          return M4;
+        if ("M4RT".equals(codeString))
+          return M4RT;
+        if ("M5".equals(codeString))
+          return M5;
+        if ("MICHTM".equals(codeString))
+          return MICHTM;
+        if ("MMDTM".equals(codeString))
+          return MMDTM;
+        if ("NAF".equals(codeString))
+          return NAF;
+        if ("NONE".equals(codeString))
+          return NONE;
+        if ("PAGE".equals(codeString))
+          return PAGE;
+        if ("PHENOL".equals(codeString))
+          return PHENOL;
+        if ("PVA".equals(codeString))
+          return PVA;
+        if ("RLM".equals(codeString))
+          return RLM;
+        if ("SILICA".equals(codeString))
+          return SILICA;
+        if ("SPS".equals(codeString))
+          return SPS;
+        if ("SST".equals(codeString))
+          return SST;
+        if ("STUTM".equals(codeString))
+          return STUTM;
+        if ("THROM".equals(codeString))
+          return THROM;
+        if ("THYMOL".equals(codeString))
+          return THYMOL;
+        if ("THYO".equals(codeString))
+          return THYO;
+        if ("TOLU".equals(codeString))
+          return TOLU;
+        if ("URETM".equals(codeString))
+          return URETM;
+        if ("VIRTM".equals(codeString))
+          return VIRTM;
+        if ("WEST".equals(codeString))
+          return WEST;
+        if ("BLDPRD".equals(codeString))
+          return BLDPRD;
+        if ("VCCNE".equals(codeString))
+          return VCCNE;
+        if ("_DrugEntity".equals(codeString))
+          return _DRUGENTITY;
+        if ("_ClinicalDrug".equals(codeString))
+          return _CLINICALDRUG;
+        if ("_NonDrugAgentEntity".equals(codeString))
+          return _NONDRUGAGENTENTITY;
+        if ("NDA01".equals(codeString))
+          return NDA01;
+        if ("NDA02".equals(codeString))
+          return NDA02;
+        if ("NDA03".equals(codeString))
+          return NDA03;
+        if ("NDA04".equals(codeString))
+          return NDA04;
+        if ("NDA05".equals(codeString))
+          return NDA05;
+        if ("NDA06".equals(codeString))
+          return NDA06;
+        if ("NDA07".equals(codeString))
+          return NDA07;
+        if ("NDA08".equals(codeString))
+          return NDA08;
+        if ("NDA09".equals(codeString))
+          return NDA09;
+        if ("NDA10".equals(codeString))
+          return NDA10;
+        if ("NDA11".equals(codeString))
+          return NDA11;
+        if ("NDA12".equals(codeString))
+          return NDA12;
+        if ("NDA13".equals(codeString))
+          return NDA13;
+        if ("NDA14".equals(codeString))
+          return NDA14;
+        if ("NDA15".equals(codeString))
+          return NDA15;
+        if ("NDA16".equals(codeString))
+          return NDA16;
+        if ("NDA17".equals(codeString))
+          return NDA17;
+        if ("_OrganizationEntityType".equals(codeString))
+          return _ORGANIZATIONENTITYTYPE;
+        if ("HHOLD".equals(codeString))
+          return HHOLD;
+        if ("NAT".equals(codeString))
+          return NAT;
+        if ("RELIG".equals(codeString))
+          return RELIG;
+        if ("_PlaceEntityType".equals(codeString))
+          return _PLACEENTITYTYPE;
+        if ("BED".equals(codeString))
+          return BED;
+        if ("BLDG".equals(codeString))
+          return BLDG;
+        if ("FLOOR".equals(codeString))
+          return FLOOR;
+        if ("ROOM".equals(codeString))
+          return ROOM;
+        if ("WING".equals(codeString))
+          return WING;
+        if ("_ResourceGroupEntityType".equals(codeString))
+          return _RESOURCEGROUPENTITYTYPE;
+        if ("PRAC".equals(codeString))
+          return PRAC;
+        throw new FHIRException("Unknown V3EntityCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _MATERIALENTITYCLASSTYPE: return "_MaterialEntityClassType";
+            case _CONTAINERENTITYTYPE: return "_ContainerEntityType";
+            case PKG: return "PKG";
+            case _NONRIGIDCONTAINERENTITYTYPE: return "_NonRigidContainerEntityType";
+            case BAG: return "BAG";
+            case PACKT: return "PACKT";
+            case PCH: return "PCH";
+            case SACH: return "SACH";
+            case _RIGIDCONTAINERENTITYTYPE: return "_RigidContainerEntityType";
+            case _INDIVIDUALPACKAGEENTITYTYPE: return "_IndividualPackageEntityType";
+            case AMP: return "AMP";
+            case MINIM: return "MINIM";
+            case NEBAMP: return "NEBAMP";
+            case OVUL: return "OVUL";
+            case _MULTIUSECONTAINERENTITYTYPE: return "_MultiUseContainerEntityType";
+            case BOT: return "BOT";
+            case BOTA: return "BOTA";
+            case BOTD: return "BOTD";
+            case BOTG: return "BOTG";
+            case BOTP: return "BOTP";
+            case BOTPLY: return "BOTPLY";
+            case BOX: return "BOX";
+            case CAN: return "CAN";
+            case CART: return "CART";
+            case CNSTR: return "CNSTR";
+            case JAR: return "JAR";
+            case JUG: return "JUG";
+            case TIN: return "TIN";
+            case TUB: return "TUB";
+            case TUBE: return "TUBE";
+            case VIAL: return "VIAL";
+            case BLSTRPK: return "BLSTRPK";
+            case CARD: return "CARD";
+            case COMPPKG: return "COMPPKG";
+            case DIALPK: return "DIALPK";
+            case DISK: return "DISK";
+            case DOSET: return "DOSET";
+            case STRIP: return "STRIP";
+            case KIT: return "KIT";
+            case SYSTM: return "SYSTM";
+            case _MEDICALDEVICE: return "_MedicalDevice";
+            case _ACCESSMEDICALDEVICE: return "_AccessMedicalDevice";
+            case LINE: return "LINE";
+            case IALINE: return "IALINE";
+            case IVLINE: return "IVLINE";
+            case _ADMINISTRATIONMEDICALDEVICE: return "_AdministrationMedicalDevice";
+            case _INJECTIONMEDICALDEVICE: return "_InjectionMedicalDevice";
+            case AINJ: return "AINJ";
+            case PEN: return "PEN";
+            case SYR: return "SYR";
+            case APLCTR: return "APLCTR";
+            case INH: return "INH";
+            case DSKS: return "DSKS";
+            case DSKUNH: return "DSKUNH";
+            case TRBINH: return "TRBINH";
+            case PMP: return "PMP";
+            case _SPECIMENADDITIVEENTITY: return "_SpecimenAdditiveEntity";
+            case ACDA: return "ACDA";
+            case ACDB: return "ACDB";
+            case ACET: return "ACET";
+            case AMIES: return "AMIES";
+            case BACTM: return "BACTM";
+            case BF10: return "BF10";
+            case BOR: return "BOR";
+            case BOUIN: return "BOUIN";
+            case BSKM: return "BSKM";
+            case C32: return "C32";
+            case C38: return "C38";
+            case CARS: return "CARS";
+            case CARY: return "CARY";
+            case CHLTM: return "CHLTM";
+            case CTAD: return "CTAD";
+            case EDTK15: return "EDTK15";
+            case EDTK75: return "EDTK75";
+            case EDTN: return "EDTN";
+            case ENT: return "ENT";
+            case F10: return "F10";
+            case FDP: return "FDP";
+            case FL10: return "FL10";
+            case FL100: return "FL100";
+            case HCL6: return "HCL6";
+            case HEPA: return "HEPA";
+            case HEPL: return "HEPL";
+            case HEPN: return "HEPN";
+            case HNO3: return "HNO3";
+            case JKM: return "JKM";
+            case KARN: return "KARN";
+            case KOX: return "KOX";
+            case LIA: return "LIA";
+            case M4: return "M4";
+            case M4RT: return "M4RT";
+            case M5: return "M5";
+            case MICHTM: return "MICHTM";
+            case MMDTM: return "MMDTM";
+            case NAF: return "NAF";
+            case NONE: return "NONE";
+            case PAGE: return "PAGE";
+            case PHENOL: return "PHENOL";
+            case PVA: return "PVA";
+            case RLM: return "RLM";
+            case SILICA: return "SILICA";
+            case SPS: return "SPS";
+            case SST: return "SST";
+            case STUTM: return "STUTM";
+            case THROM: return "THROM";
+            case THYMOL: return "THYMOL";
+            case THYO: return "THYO";
+            case TOLU: return "TOLU";
+            case URETM: return "URETM";
+            case VIRTM: return "VIRTM";
+            case WEST: return "WEST";
+            case BLDPRD: return "BLDPRD";
+            case VCCNE: return "VCCNE";
+            case _DRUGENTITY: return "_DrugEntity";
+            case _CLINICALDRUG: return "_ClinicalDrug";
+            case _NONDRUGAGENTENTITY: return "_NonDrugAgentEntity";
+            case NDA01: return "NDA01";
+            case NDA02: return "NDA02";
+            case NDA03: return "NDA03";
+            case NDA04: return "NDA04";
+            case NDA05: return "NDA05";
+            case NDA06: return "NDA06";
+            case NDA07: return "NDA07";
+            case NDA08: return "NDA08";
+            case NDA09: return "NDA09";
+            case NDA10: return "NDA10";
+            case NDA11: return "NDA11";
+            case NDA12: return "NDA12";
+            case NDA13: return "NDA13";
+            case NDA14: return "NDA14";
+            case NDA15: return "NDA15";
+            case NDA16: return "NDA16";
+            case NDA17: return "NDA17";
+            case _ORGANIZATIONENTITYTYPE: return "_OrganizationEntityType";
+            case HHOLD: return "HHOLD";
+            case NAT: return "NAT";
+            case RELIG: return "RELIG";
+            case _PLACEENTITYTYPE: return "_PlaceEntityType";
+            case BED: return "BED";
+            case BLDG: return "BLDG";
+            case FLOOR: return "FLOOR";
+            case ROOM: return "ROOM";
+            case WING: return "WING";
+            case _RESOURCEGROUPENTITYTYPE: return "_ResourceGroupEntityType";
+            case PRAC: return "PRAC";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityCode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _MATERIALENTITYCLASSTYPE: return "Types of Material for EntityClass \"MAT\"";
+            case _CONTAINERENTITYTYPE: return "Material intended to hold another material for purpose of storage or transport.";
+            case PKG: return "A material intended to hold other materials for purposes of storage or transportation";
+            case _NONRIGIDCONTAINERENTITYTYPE: return "A container having dimensions that adjust somewhat based on the amount and shape of the material placed within it.";
+            case BAG: return "A pouched or pendulous container.";
+            case PACKT: return "A paper";
+            case PCH: return "A small bag or container made of a soft material.";
+            case SACH: return "A small bag or packet containing a small portion of a substance.";
+            case _RIGIDCONTAINERENTITYTYPE: return "A container having a fixed and inflexible dimensions and volume";
+            case _INDIVIDUALPACKAGEENTITYTYPE: return "Container intended to contain sufficient material for only one use.";
+            case AMP: return "A small sealed glass container that holds a measured amount of a medicinal substance.";
+            case MINIM: return "Individually dosed ophthalmic solution.  One time eye dropper dispenser.";
+            case NEBAMP: return "Individually dosed inhalation solution.";
+            case OVUL: return "A container either glass or plastic and a narrow neck, for storing liquid.";
+            case _MULTIUSECONTAINERENTITYTYPE: return "A container intended to contain sufficient material for more than one use.  (I.e. Material is intended to be removed from the container at more than one discrete time period.)";
+            case BOT: return "A container, typically rounded, either glass or plastic with a narrow neck and capable of storing liquid.";
+            case BOTA: return "A bottle of yellow to brown color.  Used to store light-sensitive materials";
+            case BOTD: return "A bottle with a cap designed to release the contained liquid in droplets of a specific size.";
+            case BOTG: return "A bottle made of glass";
+            case BOTP: return "A bottle made of plastic";
+            case BOTPLY: return "A bottle made of polyethylene";
+            case BOX: return "A 6-sided container commonly made from paper or cardboard used for solid forms.";
+            case CAN: return "A metal container in which a material is hermetically sealed to enable storage over long periods.";
+            case CART: return "A sealed container of liquid or powder intended to be loaded into a device.";
+            case CNSTR: return "A pressurized metal container holding a substance released as a spray or aerosol.";
+            case JAR: return "A container of glass, earthenware, plastic, etc.  Top of the container has a diameter of similar size to the diameter of the container as a whole";
+            case JUG: return "A deep vessel  for holding liquids, with a handle and often with a spout or lip shape for pouring.";
+            case TIN: return "A lidded container made of thin sheet metal.";
+            case TUB: return "An open flat bottomed round container.";
+            case TUBE: return "A long hollow rigid or flexible cylinder.  Material is extruded by squeezing the container.";
+            case VIAL: return "A small cylindrical glass for holding liquid medicines.";
+            case BLSTRPK: return "A bubblepack.  Medications sealed individually, separated into doses.";
+            case CARD: return "A bubble pack card.  Multiple individual/separated doses.";
+            case COMPPKG: return "A container intended to contain sufficient material for more than one use, but grouped or organized to provide individual access to sufficient material for a single use.  Often used to ensure that the proper type and amount of material is consumed/expended for each use.";
+            case DIALPK: return "Rotatable dispenser.  Eg. Birth control package.";
+            case DISK: return "Object that is thin, flat, and circular.  Doses of medication often contained in bubbles on the disk.";
+            case DOSET: return "Special packaging that will help patients take their medications on a regular basis.";
+            case STRIP: return "A continuous strip of plastic sectioned into individual pouches, each one containing the quantity of 1 or more medications intended to be administered at a specific time";
+            case KIT: return "A container for a diverse collection of products intended to be used together for some purpose (e.g. Medicinal kits often contain a syringe, a needle and the injectable medication).";
+            case SYSTM: return "A kit in which the components are interconnected.";
+            case _MEDICALDEVICE: return "A device with direct or indirect therapeutic purpose.  Values for EntityCode when EntityClass = \"DEV\"";
+            case _ACCESSMEDICALDEVICE: return "A device used to allow access to a part of a body";
+            case LINE: return "A hollow tube used to administer a substance into a vein, artery or body cavity";
+            case IALINE: return "A line used to administer a substance into an artery";
+            case IVLINE: return "A line used to administer a substance into a vein";
+            case _ADMINISTRATIONMEDICALDEVICE: return "A device intended to administer a substance to a subject";
+            case _INJECTIONMEDICALDEVICE: return "A device intended to administer liquid into a subject via a";
+            case AINJ: return "Automatically injects medication.";
+            case PEN: return "A device which can contain a cartridge for injection purposes.  Eg. Insulin pen.";
+            case SYR: return "A barrel with a plunger.";
+            case APLCTR: return "A device used to apply a liquid or powder to a surface.";
+            case INH: return "A small device used for inhaling medicine in the form of a vapour or gas in order to ease a respiratory condition such as asthma or to relieve nasal congestion.";
+            case DSKS: return "The device used to inhale the doses of medication contained in the disk form.";
+            case DSKUNH: return "The device used to inhale the doses of medication contained in the disk form.";
+            case TRBINH: return "Asthma medication delivery device.";
+            case PMP: return "A device that is used to raise, compress, or transfer liquids or gases and is operated by a piston or similar mechanism.";
+            case _SPECIMENADDITIVEENTITY: return "Set of codes related to specimen additives";
+            case ACDA: return "ACD Solution A of trisodium citrate, 22.0g/L; citric acid, 8.0 g/L; and dextrose 24.5 g/L. Used in Blood banking and histocompatibilty testing";
+            case ACDB: return "ACD Solution B of trisodium citrate, 13.2g/L; citric acid, 4.8 g/L; and dextrose 14.7 g/L. Used in Blood banking and histocompatibilty testing.";
+            case ACET: return "50% V/V acetic acid in water.  Used as  a urine preservative";
+            case AMIES: return "Sodium Chloride 3.0g, Potassium Chloride 0.2g, Calcium Chloride 0.1g, Magnesium Chloride 0.1g, Monopotassium Phosphate 0.2g, Disodium Phosphate 1.15g, Sodium Thiogly collate 1.0g, Distilled Water 1 liter";
+            case BACTM: return "Any medium used to maintain bacterial viability (e.g. Stuart's, Cary-Blair, Amies)";
+            case BF10: return "Formaldehyde 4% w/v; methyl alcohol 1% w/v; phosphate buffering salts. Tissue preservative";
+            case BOR: return "Powdered boric acid (usually 10 g) added to 24-hour urine collections as a preservative.";
+            case BOUIN: return "Picric acid, saturated aqueous solution (750.0 ml), 37-40% formalin (250.0 ml), glacial acetic acid (50.0 ml). Tissue preservative.";
+            case BSKM: return "50% skim milk in 0.01 M phosphate-buffered saline.  Maintain virus viability";
+            case C32: return "A 3.2% solution of Sodium Citrate in water.  Used as a blood preservative";
+            case C38: return "A 3.8% solution of Sodium Citrate in water. Used as a blood preservative";
+            case CARS: return "A modification of buffered 10% formalin used as a general tissue preservative.";
+            case CARY: return "Sodium Thioglycollate 1.5 g, Disodium Hydrogen Phosphate 1.1 g, Sodium Chloride 5.0 g, Calcium Chloride 0.09 g, Agar 5.0 g, per Liter of Water";
+            case CHLTM: return "Any of a number of non-nutritive buffered media used to maintain Chlamydia viability during transportation to the laboratory";
+            case CTAD: return "Buffered tri-sodium citrate solution with theophylline, adenosine and dipyridamole";
+            case EDTK15: return "Potassium EDTA 15% solution in water";
+            case EDTK75: return "Potassium EDTA 7.5% solution in water";
+            case EDTN: return "Sodium fluoride and Disodium EDTA";
+            case ENT: return "Any of a number of non-nutritive buffered media used to maintain enteric bacterial viability during transportation to the laboratory";
+            case F10: return "A 10% v/v solution in water of formalin( a 37% solution of formaldehyde and water).  Used for tissue preservation.";
+            case FDP: return "Thrombin plus soybean trypsin inhibitor.  For use in identifying fibrn degredation products.";
+            case FL10: return "Sodium fluoride, 10mg added as a urine preservative.";
+            case FL100: return "Sodium fluoride, 100mg added as a urine preservative.";
+            case HCL6: return "A solution of HCl containing 6moles of hydrogen ion/L. Used as a Urine Preservative.";
+            case HEPA: return "Ammonium heparin";
+            case HEPL: return "Lithium heparin salt";
+            case HEPN: return "Sodium heparin salt";
+            case HNO3: return "6N Nitric acid used to preserve urine for heavy metal analysis.";
+            case JKM: return "A transport medium formulated to maintain Bordetella pertussis viability.";
+            case KARN: return "5% Glutaraldehyde, 4% Formaldehyde in 0.08M buffer. Tissue preservation";
+            case KOX: return "Potassium oxalate and sodium fluoride in a 1.25:1 ratio";
+            case LIA: return "Iodoacetate lithium salt";
+            case M4: return "Modified Hank's balanced salt solution supplemented with bovine serum albumin, gelatin, sucrose and glutamic acid. It is buffered to pH 7.3+ or - 0.2 with HEPES buffer. Phenol red is used to indicate pH. Vancomycin, Amphotericin B and Colistin are used to";
+            case M4RT: return "Modified Hank's balanced salt solution supplemented with bovine serum albumin, gelatin, sucrose and glutamic acid. It is buffered to pH 7.3+ or - 0.2 with Hepes buffer. Phenol red is used to indicate pH. Gentamicin and amphotericin B are used to inhibit c";
+            case M5: return "Modified Hank's balanced salt solution supplemented with protein stabilizers, sucrose and glutamic acid. It is buffered to pH 7.3+ or - 0.2 with Hepes buffer. Phenol red is used to indicate pH. Vancomycin, Amphotericin B and Colistin are used to inhibit c";
+            case MICHTM: return "1M potassium citrate, pH 7.0 2.5 ml, 0.1M magnesium sulfate 5.0 ml, 0.1M N-ethyl malemide  5.0 ml, dH2O 87.5 ml, ammonium sulfate 55gm. Preserve antigens for Immunofluorescence procedures";
+            case MMDTM: return "A buffered medium with ammonium sulfate added to preserve antigens for Immunofluorescence procedures";
+            case NAF: return "Sodium fluoride";
+            case NONE: return "No additive. Specifically identifes the specimen as having no additives.";
+            case PAGE: return "0.12 g NaCl, 0.004 g MgSO, 0.004 g, CaCl, 0.142 g Na2HPO4 and 0.136 g KH2PO4 per liter of distilled water. Maintain Acanthaoemba viability.";
+            case PHENOL: return "Phenol. Urine preservative";
+            case PVA: return "Polyvinyl alcohol";
+            case RLM: return "A transport medium formulated to maintain Bordetella pertussis viability.";
+            case SILICA: return "Diatomaceous earth. For glucose determination blood samples";
+            case SPS: return "Sodium polyanethol sulfonate in saline. Anticomplementary and antiphagocytic properties. Used in blood culture collection.";
+            case SST: return "Polymer separator gel with clot activator";
+            case STUTM: return "Sodium Glycerophosphate 10.0g, Calcium Chloride 0.1g, Mercaptoacetic Acid 1.0ml, Distilled Water 1 liter";
+            case THROM: return "Thrombin. Accelerates clotting.";
+            case THYMOL: return "2-Isopropyl-5-methyl phenol. A preservative for 24 Hr Urine samples";
+            case THYO: return "A nutritive medium with a reducing agent  (sodium thioglycolate) which, due to a chemical reaction, removes oxygen from the broth.";
+            case TOLU: return "Also known as Methylbenzene; Toluol; Phenylmethane. A preservative for 24 Hr Urine samples";
+            case URETM: return "A buffered salt solution with antifungal agents added for the collection and transport of Ureaplasma specimens.";
+            case VIRTM: return "Sucrose 74.6g, Potassium hydrogenphosphate 0.52g, L-glutamic acid 0.72g, Bovine serum albumin 5.0g, Gentamicin 50mg, Potassium dihydrogenphosphate 1.25g, L-15 medium 9.9L, Water to 10L. Maintain Virus viability.";
+            case WEST: return "3.8% Citrate buffered to a pH of 5.5 for Westergren Sedimentation Rate";
+            case BLDPRD: return "A manufactured product that is produced from the raw blood oi a donor with the intention of using it in a recipient transfusion.";
+            case VCCNE: return "A Type of medicine that creates an immune protection without the recipient experiencing the disease.";
+            case _DRUGENTITY: return "A substance whose therapeutic effect is produced by chemical action within the body.";
+            case _CLINICALDRUG: return "Any substance or mixture of substances manufactured, sold or represented for use in: (a) the diagnosis, treatment, mitigation or prevention of a disease, disorder, abnormal physical state, or its symptoms, in human beings or animals; (b) restoring, correcting or modifying organic functions in human beings or animals.";
+            case _NONDRUGAGENTENTITY: return "Indicates types of allergy and intolerance agents which are non-drugs.  (E.g. foods, latex, etc.)";
+            case NDA01: return "egg";
+            case NDA02: return "fish";
+            case NDA03: return "lactose";
+            case NDA04: return "peanut";
+            case NDA05: return "soy";
+            case NDA06: return "sulfites";
+            case NDA07: return "wheat or gluten";
+            case NDA08: return "isocyanates";
+            case NDA09: return "solvents";
+            case NDA10: return "oils";
+            case NDA11: return "venoms";
+            case NDA12: return "latex";
+            case NDA13: return "shellfish";
+            case NDA14: return "strawberries";
+            case NDA15: return "tomatoes";
+            case NDA16: return "dust";
+            case NDA17: return "dust mites";
+            case _ORGANIZATIONENTITYTYPE: return "Further classifies entities of classCode ORG.";
+            case HHOLD: return "The group of persons who occupy a single housing unit.";
+            case NAT: return "Codes identifying nation states.  Allows for finer grained specification of Entity with classcode <= NAT\r\n\n                        \n                           Example:ISO3166 country codes.";
+            case RELIG: return "An organization that provides religious rites of worship.";
+            case _PLACEENTITYTYPE: return "Types of places for EntityClass \"PLC\"";
+            case BED: return "The location of a bed";
+            case BLDG: return "The location of a building";
+            case FLOOR: return "The location of a floor of a building";
+            case ROOM: return "The location of a room";
+            case WING: return "The location of a wing of a building (e.g. East Wing).  The same room number for the same floor number can be distinguished by wing number in some situations";
+            case _RESOURCEGROUPENTITYTYPE: return "Codes to characterize a Resource Group using categories that typify its membership and/or function\r\n\n                        .\r\n\n                        \n                           Example: PractitionerGroup";
+            case PRAC: return "PractitionerGroup";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _MATERIALENTITYCLASSTYPE: return "MaterialEntityClassType";
+            case _CONTAINERENTITYTYPE: return "ContainerEntityType";
+            case PKG: return "Package";
+            case _NONRIGIDCONTAINERENTITYTYPE: return "NonRigidContainerEntityType";
+            case BAG: return "Bag";
+            case PACKT: return "Packet";
+            case PCH: return "Pouch";
+            case SACH: return "Sachet";
+            case _RIGIDCONTAINERENTITYTYPE: return "RigidContainerEntityType";
+            case _INDIVIDUALPACKAGEENTITYTYPE: return "IndividualPackageEntityType";
+            case AMP: return "Ampule";
+            case MINIM: return "Minim";
+            case NEBAMP: return "Nebuamp";
+            case OVUL: return "Ovule";
+            case _MULTIUSECONTAINERENTITYTYPE: return "MultiUseContainerEntityType";
+            case BOT: return "Bottle";
+            case BOTA: return "Amber Bottle";
+            case BOTD: return "Dropper Bottle";
+            case BOTG: return "Glass Bottle";
+            case BOTP: return "Plastic Bottle";
+            case BOTPLY: return "Polyethylene Bottle";
+            case BOX: return "Box";
+            case CAN: return "Can";
+            case CART: return "Cartridge";
+            case CNSTR: return "Canister";
+            case JAR: return "Jar";
+            case JUG: return "Jug";
+            case TIN: return "Tin";
+            case TUB: return "Tub";
+            case TUBE: return "Tube";
+            case VIAL: return "Vial";
+            case BLSTRPK: return "Blister Pack";
+            case CARD: return "Card";
+            case COMPPKG: return "Compliance Package";
+            case DIALPK: return "Dial Pack";
+            case DISK: return "Disk";
+            case DOSET: return "Dosette";
+            case STRIP: return "Strip";
+            case KIT: return "Kit";
+            case SYSTM: return "System";
+            case _MEDICALDEVICE: return "MedicalDevice";
+            case _ACCESSMEDICALDEVICE: return "AccessMedicalDevice";
+            case LINE: return "Line";
+            case IALINE: return "Intra-arterial Line";
+            case IVLINE: return "Intraveneous Line";
+            case _ADMINISTRATIONMEDICALDEVICE: return "AdministrationMedicalDevice";
+            case _INJECTIONMEDICALDEVICE: return "InjectionMedicalDevice";
+            case AINJ: return "AutoInjector";
+            case PEN: return "Pen";
+            case SYR: return "Syringe";
+            case APLCTR: return "Applicator";
+            case INH: return "Inhaler";
+            case DSKS: return "Diskus";
+            case DSKUNH: return "Diskhaler";
+            case TRBINH: return "Turbuhaler";
+            case PMP: return "Pump";
+            case _SPECIMENADDITIVEENTITY: return "SpecimenAdditiveEntity";
+            case ACDA: return "ACD Solution A";
+            case ACDB: return "ACD Solution B";
+            case ACET: return "Acetic Acid";
+            case AMIES: return "Amies transport medium";
+            case BACTM: return "Bacterial Transport medium";
+            case BF10: return "Buffered 10% formalin";
+            case BOR: return "Boric Acid";
+            case BOUIN: return "Bouin's solution";
+            case BSKM: return "Buffered skim milk";
+            case C32: return "3.2% Citrate";
+            case C38: return "3.8% Citrate";
+            case CARS: return "Carson's Modified 10% formalin";
+            case CARY: return "Cary Blair Medium";
+            case CHLTM: return "Chlamydia transport medium";
+            case CTAD: return "CTAD";
+            case EDTK15: return "Potassium/K EDTA 15%";
+            case EDTK75: return "Potassium/K EDTA 7.5%";
+            case EDTN: return "Sodium/Na EDTA";
+            case ENT: return "Enteric bacteria transport medium";
+            case F10: return "10% Formalin";
+            case FDP: return "Thrombin NIH; soybean trypsin inhibitor";
+            case FL10: return "Sodium Fluoride, 10mg";
+            case FL100: return "Sodium Fluoride, 100mg";
+            case HCL6: return "6N HCL";
+            case HEPA: return "Ammonium heparin";
+            case HEPL: return "Lithium/Li Heparin";
+            case HEPN: return "Sodium/Na Heparin";
+            case HNO3: return "Nitric Acid";
+            case JKM: return "Jones Kendrick Medium";
+            case KARN: return "Karnovsky's fixative";
+            case KOX: return "Potassium Oxalate";
+            case LIA: return "Lithium iodoacetate";
+            case M4: return "M4";
+            case M4RT: return "M4-RT";
+            case M5: return "M5";
+            case MICHTM: return "Michel's transport medium";
+            case MMDTM: return "MMD transport medium";
+            case NAF: return "Sodium Fluoride";
+            case NONE: return "None";
+            case PAGE: return "Page's Saline";
+            case PHENOL: return "Phenol";
+            case PVA: return "Polyvinylalcohol";
+            case RLM: return "Reagan Lowe Medium";
+            case SILICA: return "Siliceous earth";
+            case SPS: return "Sodium polyanethol sulfonate 0.35% in 0.85% sodium chloride";
+            case SST: return "Serum Separator Tube";
+            case STUTM: return "Stuart transport medium";
+            case THROM: return "Thrombin";
+            case THYMOL: return "Thymol";
+            case THYO: return "Thyoglycolate broth";
+            case TOLU: return "Toluene";
+            case URETM: return "Ureaplasma transport medium";
+            case VIRTM: return "Viral Transport medium";
+            case WEST: return "Buffered Citrate";
+            case BLDPRD: return "Blood Product";
+            case VCCNE: return "Vaccine";
+            case _DRUGENTITY: return "DrugEntity";
+            case _CLINICALDRUG: return "ClinicalDrug";
+            case _NONDRUGAGENTENTITY: return "NonDrugAgentEntity";
+            case NDA01: return "egg";
+            case NDA02: return "fish";
+            case NDA03: return "lactose";
+            case NDA04: return "peanut";
+            case NDA05: return "soy";
+            case NDA06: return "sulfites";
+            case NDA07: return "wheat or gluten";
+            case NDA08: return "isocyanates";
+            case NDA09: return "solvents";
+            case NDA10: return "oils";
+            case NDA11: return "venoms";
+            case NDA12: return "latex";
+            case NDA13: return "shellfish";
+            case NDA14: return "strawberries";
+            case NDA15: return "tomatoes";
+            case NDA16: return "dust";
+            case NDA17: return "dust mites";
+            case _ORGANIZATIONENTITYTYPE: return "OrganizationEntityType";
+            case HHOLD: return "household";
+            case NAT: return "NationEntityType";
+            case RELIG: return "religious institution";
+            case _PLACEENTITYTYPE: return "PlaceEntityType";
+            case BED: return "Bed Location";
+            case BLDG: return "Building Location";
+            case FLOOR: return "Floor Location";
+            case ROOM: return "Room Location";
+            case WING: return "Wing Location";
+            case _RESOURCEGROUPENTITYTYPE: return "ResourceGroupEntityType";
+            case PRAC: return "PractitionerGroup";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityCodeEnumFactory.java
new file mode 100644
index 00000000000..9a3ca024883
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityCodeEnumFactory.java
@@ -0,0 +1,634 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityCodeEnumFactory implements EnumFactory {
+
+  public V3EntityCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_MaterialEntityClassType".equals(codeString))
+      return V3EntityCode._MATERIALENTITYCLASSTYPE;
+    if ("_ContainerEntityType".equals(codeString))
+      return V3EntityCode._CONTAINERENTITYTYPE;
+    if ("PKG".equals(codeString))
+      return V3EntityCode.PKG;
+    if ("_NonRigidContainerEntityType".equals(codeString))
+      return V3EntityCode._NONRIGIDCONTAINERENTITYTYPE;
+    if ("BAG".equals(codeString))
+      return V3EntityCode.BAG;
+    if ("PACKT".equals(codeString))
+      return V3EntityCode.PACKT;
+    if ("PCH".equals(codeString))
+      return V3EntityCode.PCH;
+    if ("SACH".equals(codeString))
+      return V3EntityCode.SACH;
+    if ("_RigidContainerEntityType".equals(codeString))
+      return V3EntityCode._RIGIDCONTAINERENTITYTYPE;
+    if ("_IndividualPackageEntityType".equals(codeString))
+      return V3EntityCode._INDIVIDUALPACKAGEENTITYTYPE;
+    if ("AMP".equals(codeString))
+      return V3EntityCode.AMP;
+    if ("MINIM".equals(codeString))
+      return V3EntityCode.MINIM;
+    if ("NEBAMP".equals(codeString))
+      return V3EntityCode.NEBAMP;
+    if ("OVUL".equals(codeString))
+      return V3EntityCode.OVUL;
+    if ("_MultiUseContainerEntityType".equals(codeString))
+      return V3EntityCode._MULTIUSECONTAINERENTITYTYPE;
+    if ("BOT".equals(codeString))
+      return V3EntityCode.BOT;
+    if ("BOTA".equals(codeString))
+      return V3EntityCode.BOTA;
+    if ("BOTD".equals(codeString))
+      return V3EntityCode.BOTD;
+    if ("BOTG".equals(codeString))
+      return V3EntityCode.BOTG;
+    if ("BOTP".equals(codeString))
+      return V3EntityCode.BOTP;
+    if ("BOTPLY".equals(codeString))
+      return V3EntityCode.BOTPLY;
+    if ("BOX".equals(codeString))
+      return V3EntityCode.BOX;
+    if ("CAN".equals(codeString))
+      return V3EntityCode.CAN;
+    if ("CART".equals(codeString))
+      return V3EntityCode.CART;
+    if ("CNSTR".equals(codeString))
+      return V3EntityCode.CNSTR;
+    if ("JAR".equals(codeString))
+      return V3EntityCode.JAR;
+    if ("JUG".equals(codeString))
+      return V3EntityCode.JUG;
+    if ("TIN".equals(codeString))
+      return V3EntityCode.TIN;
+    if ("TUB".equals(codeString))
+      return V3EntityCode.TUB;
+    if ("TUBE".equals(codeString))
+      return V3EntityCode.TUBE;
+    if ("VIAL".equals(codeString))
+      return V3EntityCode.VIAL;
+    if ("BLSTRPK".equals(codeString))
+      return V3EntityCode.BLSTRPK;
+    if ("CARD".equals(codeString))
+      return V3EntityCode.CARD;
+    if ("COMPPKG".equals(codeString))
+      return V3EntityCode.COMPPKG;
+    if ("DIALPK".equals(codeString))
+      return V3EntityCode.DIALPK;
+    if ("DISK".equals(codeString))
+      return V3EntityCode.DISK;
+    if ("DOSET".equals(codeString))
+      return V3EntityCode.DOSET;
+    if ("STRIP".equals(codeString))
+      return V3EntityCode.STRIP;
+    if ("KIT".equals(codeString))
+      return V3EntityCode.KIT;
+    if ("SYSTM".equals(codeString))
+      return V3EntityCode.SYSTM;
+    if ("_MedicalDevice".equals(codeString))
+      return V3EntityCode._MEDICALDEVICE;
+    if ("_AccessMedicalDevice".equals(codeString))
+      return V3EntityCode._ACCESSMEDICALDEVICE;
+    if ("LINE".equals(codeString))
+      return V3EntityCode.LINE;
+    if ("IALINE".equals(codeString))
+      return V3EntityCode.IALINE;
+    if ("IVLINE".equals(codeString))
+      return V3EntityCode.IVLINE;
+    if ("_AdministrationMedicalDevice".equals(codeString))
+      return V3EntityCode._ADMINISTRATIONMEDICALDEVICE;
+    if ("_InjectionMedicalDevice".equals(codeString))
+      return V3EntityCode._INJECTIONMEDICALDEVICE;
+    if ("AINJ".equals(codeString))
+      return V3EntityCode.AINJ;
+    if ("PEN".equals(codeString))
+      return V3EntityCode.PEN;
+    if ("SYR".equals(codeString))
+      return V3EntityCode.SYR;
+    if ("APLCTR".equals(codeString))
+      return V3EntityCode.APLCTR;
+    if ("INH".equals(codeString))
+      return V3EntityCode.INH;
+    if ("DSKS".equals(codeString))
+      return V3EntityCode.DSKS;
+    if ("DSKUNH".equals(codeString))
+      return V3EntityCode.DSKUNH;
+    if ("TRBINH".equals(codeString))
+      return V3EntityCode.TRBINH;
+    if ("PMP".equals(codeString))
+      return V3EntityCode.PMP;
+    if ("_SpecimenAdditiveEntity".equals(codeString))
+      return V3EntityCode._SPECIMENADDITIVEENTITY;
+    if ("ACDA".equals(codeString))
+      return V3EntityCode.ACDA;
+    if ("ACDB".equals(codeString))
+      return V3EntityCode.ACDB;
+    if ("ACET".equals(codeString))
+      return V3EntityCode.ACET;
+    if ("AMIES".equals(codeString))
+      return V3EntityCode.AMIES;
+    if ("BACTM".equals(codeString))
+      return V3EntityCode.BACTM;
+    if ("BF10".equals(codeString))
+      return V3EntityCode.BF10;
+    if ("BOR".equals(codeString))
+      return V3EntityCode.BOR;
+    if ("BOUIN".equals(codeString))
+      return V3EntityCode.BOUIN;
+    if ("BSKM".equals(codeString))
+      return V3EntityCode.BSKM;
+    if ("C32".equals(codeString))
+      return V3EntityCode.C32;
+    if ("C38".equals(codeString))
+      return V3EntityCode.C38;
+    if ("CARS".equals(codeString))
+      return V3EntityCode.CARS;
+    if ("CARY".equals(codeString))
+      return V3EntityCode.CARY;
+    if ("CHLTM".equals(codeString))
+      return V3EntityCode.CHLTM;
+    if ("CTAD".equals(codeString))
+      return V3EntityCode.CTAD;
+    if ("EDTK15".equals(codeString))
+      return V3EntityCode.EDTK15;
+    if ("EDTK75".equals(codeString))
+      return V3EntityCode.EDTK75;
+    if ("EDTN".equals(codeString))
+      return V3EntityCode.EDTN;
+    if ("ENT".equals(codeString))
+      return V3EntityCode.ENT;
+    if ("F10".equals(codeString))
+      return V3EntityCode.F10;
+    if ("FDP".equals(codeString))
+      return V3EntityCode.FDP;
+    if ("FL10".equals(codeString))
+      return V3EntityCode.FL10;
+    if ("FL100".equals(codeString))
+      return V3EntityCode.FL100;
+    if ("HCL6".equals(codeString))
+      return V3EntityCode.HCL6;
+    if ("HEPA".equals(codeString))
+      return V3EntityCode.HEPA;
+    if ("HEPL".equals(codeString))
+      return V3EntityCode.HEPL;
+    if ("HEPN".equals(codeString))
+      return V3EntityCode.HEPN;
+    if ("HNO3".equals(codeString))
+      return V3EntityCode.HNO3;
+    if ("JKM".equals(codeString))
+      return V3EntityCode.JKM;
+    if ("KARN".equals(codeString))
+      return V3EntityCode.KARN;
+    if ("KOX".equals(codeString))
+      return V3EntityCode.KOX;
+    if ("LIA".equals(codeString))
+      return V3EntityCode.LIA;
+    if ("M4".equals(codeString))
+      return V3EntityCode.M4;
+    if ("M4RT".equals(codeString))
+      return V3EntityCode.M4RT;
+    if ("M5".equals(codeString))
+      return V3EntityCode.M5;
+    if ("MICHTM".equals(codeString))
+      return V3EntityCode.MICHTM;
+    if ("MMDTM".equals(codeString))
+      return V3EntityCode.MMDTM;
+    if ("NAF".equals(codeString))
+      return V3EntityCode.NAF;
+    if ("NONE".equals(codeString))
+      return V3EntityCode.NONE;
+    if ("PAGE".equals(codeString))
+      return V3EntityCode.PAGE;
+    if ("PHENOL".equals(codeString))
+      return V3EntityCode.PHENOL;
+    if ("PVA".equals(codeString))
+      return V3EntityCode.PVA;
+    if ("RLM".equals(codeString))
+      return V3EntityCode.RLM;
+    if ("SILICA".equals(codeString))
+      return V3EntityCode.SILICA;
+    if ("SPS".equals(codeString))
+      return V3EntityCode.SPS;
+    if ("SST".equals(codeString))
+      return V3EntityCode.SST;
+    if ("STUTM".equals(codeString))
+      return V3EntityCode.STUTM;
+    if ("THROM".equals(codeString))
+      return V3EntityCode.THROM;
+    if ("THYMOL".equals(codeString))
+      return V3EntityCode.THYMOL;
+    if ("THYO".equals(codeString))
+      return V3EntityCode.THYO;
+    if ("TOLU".equals(codeString))
+      return V3EntityCode.TOLU;
+    if ("URETM".equals(codeString))
+      return V3EntityCode.URETM;
+    if ("VIRTM".equals(codeString))
+      return V3EntityCode.VIRTM;
+    if ("WEST".equals(codeString))
+      return V3EntityCode.WEST;
+    if ("BLDPRD".equals(codeString))
+      return V3EntityCode.BLDPRD;
+    if ("VCCNE".equals(codeString))
+      return V3EntityCode.VCCNE;
+    if ("_DrugEntity".equals(codeString))
+      return V3EntityCode._DRUGENTITY;
+    if ("_ClinicalDrug".equals(codeString))
+      return V3EntityCode._CLINICALDRUG;
+    if ("_NonDrugAgentEntity".equals(codeString))
+      return V3EntityCode._NONDRUGAGENTENTITY;
+    if ("NDA01".equals(codeString))
+      return V3EntityCode.NDA01;
+    if ("NDA02".equals(codeString))
+      return V3EntityCode.NDA02;
+    if ("NDA03".equals(codeString))
+      return V3EntityCode.NDA03;
+    if ("NDA04".equals(codeString))
+      return V3EntityCode.NDA04;
+    if ("NDA05".equals(codeString))
+      return V3EntityCode.NDA05;
+    if ("NDA06".equals(codeString))
+      return V3EntityCode.NDA06;
+    if ("NDA07".equals(codeString))
+      return V3EntityCode.NDA07;
+    if ("NDA08".equals(codeString))
+      return V3EntityCode.NDA08;
+    if ("NDA09".equals(codeString))
+      return V3EntityCode.NDA09;
+    if ("NDA10".equals(codeString))
+      return V3EntityCode.NDA10;
+    if ("NDA11".equals(codeString))
+      return V3EntityCode.NDA11;
+    if ("NDA12".equals(codeString))
+      return V3EntityCode.NDA12;
+    if ("NDA13".equals(codeString))
+      return V3EntityCode.NDA13;
+    if ("NDA14".equals(codeString))
+      return V3EntityCode.NDA14;
+    if ("NDA15".equals(codeString))
+      return V3EntityCode.NDA15;
+    if ("NDA16".equals(codeString))
+      return V3EntityCode.NDA16;
+    if ("NDA17".equals(codeString))
+      return V3EntityCode.NDA17;
+    if ("_OrganizationEntityType".equals(codeString))
+      return V3EntityCode._ORGANIZATIONENTITYTYPE;
+    if ("HHOLD".equals(codeString))
+      return V3EntityCode.HHOLD;
+    if ("NAT".equals(codeString))
+      return V3EntityCode.NAT;
+    if ("RELIG".equals(codeString))
+      return V3EntityCode.RELIG;
+    if ("_PlaceEntityType".equals(codeString))
+      return V3EntityCode._PLACEENTITYTYPE;
+    if ("BED".equals(codeString))
+      return V3EntityCode.BED;
+    if ("BLDG".equals(codeString))
+      return V3EntityCode.BLDG;
+    if ("FLOOR".equals(codeString))
+      return V3EntityCode.FLOOR;
+    if ("ROOM".equals(codeString))
+      return V3EntityCode.ROOM;
+    if ("WING".equals(codeString))
+      return V3EntityCode.WING;
+    if ("_ResourceGroupEntityType".equals(codeString))
+      return V3EntityCode._RESOURCEGROUPENTITYTYPE;
+    if ("PRAC".equals(codeString))
+      return V3EntityCode.PRAC;
+    throw new IllegalArgumentException("Unknown V3EntityCode code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityCode code) {
+    if (code == V3EntityCode._MATERIALENTITYCLASSTYPE)
+      return "_MaterialEntityClassType";
+    if (code == V3EntityCode._CONTAINERENTITYTYPE)
+      return "_ContainerEntityType";
+    if (code == V3EntityCode.PKG)
+      return "PKG";
+    if (code == V3EntityCode._NONRIGIDCONTAINERENTITYTYPE)
+      return "_NonRigidContainerEntityType";
+    if (code == V3EntityCode.BAG)
+      return "BAG";
+    if (code == V3EntityCode.PACKT)
+      return "PACKT";
+    if (code == V3EntityCode.PCH)
+      return "PCH";
+    if (code == V3EntityCode.SACH)
+      return "SACH";
+    if (code == V3EntityCode._RIGIDCONTAINERENTITYTYPE)
+      return "_RigidContainerEntityType";
+    if (code == V3EntityCode._INDIVIDUALPACKAGEENTITYTYPE)
+      return "_IndividualPackageEntityType";
+    if (code == V3EntityCode.AMP)
+      return "AMP";
+    if (code == V3EntityCode.MINIM)
+      return "MINIM";
+    if (code == V3EntityCode.NEBAMP)
+      return "NEBAMP";
+    if (code == V3EntityCode.OVUL)
+      return "OVUL";
+    if (code == V3EntityCode._MULTIUSECONTAINERENTITYTYPE)
+      return "_MultiUseContainerEntityType";
+    if (code == V3EntityCode.BOT)
+      return "BOT";
+    if (code == V3EntityCode.BOTA)
+      return "BOTA";
+    if (code == V3EntityCode.BOTD)
+      return "BOTD";
+    if (code == V3EntityCode.BOTG)
+      return "BOTG";
+    if (code == V3EntityCode.BOTP)
+      return "BOTP";
+    if (code == V3EntityCode.BOTPLY)
+      return "BOTPLY";
+    if (code == V3EntityCode.BOX)
+      return "BOX";
+    if (code == V3EntityCode.CAN)
+      return "CAN";
+    if (code == V3EntityCode.CART)
+      return "CART";
+    if (code == V3EntityCode.CNSTR)
+      return "CNSTR";
+    if (code == V3EntityCode.JAR)
+      return "JAR";
+    if (code == V3EntityCode.JUG)
+      return "JUG";
+    if (code == V3EntityCode.TIN)
+      return "TIN";
+    if (code == V3EntityCode.TUB)
+      return "TUB";
+    if (code == V3EntityCode.TUBE)
+      return "TUBE";
+    if (code == V3EntityCode.VIAL)
+      return "VIAL";
+    if (code == V3EntityCode.BLSTRPK)
+      return "BLSTRPK";
+    if (code == V3EntityCode.CARD)
+      return "CARD";
+    if (code == V3EntityCode.COMPPKG)
+      return "COMPPKG";
+    if (code == V3EntityCode.DIALPK)
+      return "DIALPK";
+    if (code == V3EntityCode.DISK)
+      return "DISK";
+    if (code == V3EntityCode.DOSET)
+      return "DOSET";
+    if (code == V3EntityCode.STRIP)
+      return "STRIP";
+    if (code == V3EntityCode.KIT)
+      return "KIT";
+    if (code == V3EntityCode.SYSTM)
+      return "SYSTM";
+    if (code == V3EntityCode._MEDICALDEVICE)
+      return "_MedicalDevice";
+    if (code == V3EntityCode._ACCESSMEDICALDEVICE)
+      return "_AccessMedicalDevice";
+    if (code == V3EntityCode.LINE)
+      return "LINE";
+    if (code == V3EntityCode.IALINE)
+      return "IALINE";
+    if (code == V3EntityCode.IVLINE)
+      return "IVLINE";
+    if (code == V3EntityCode._ADMINISTRATIONMEDICALDEVICE)
+      return "_AdministrationMedicalDevice";
+    if (code == V3EntityCode._INJECTIONMEDICALDEVICE)
+      return "_InjectionMedicalDevice";
+    if (code == V3EntityCode.AINJ)
+      return "AINJ";
+    if (code == V3EntityCode.PEN)
+      return "PEN";
+    if (code == V3EntityCode.SYR)
+      return "SYR";
+    if (code == V3EntityCode.APLCTR)
+      return "APLCTR";
+    if (code == V3EntityCode.INH)
+      return "INH";
+    if (code == V3EntityCode.DSKS)
+      return "DSKS";
+    if (code == V3EntityCode.DSKUNH)
+      return "DSKUNH";
+    if (code == V3EntityCode.TRBINH)
+      return "TRBINH";
+    if (code == V3EntityCode.PMP)
+      return "PMP";
+    if (code == V3EntityCode._SPECIMENADDITIVEENTITY)
+      return "_SpecimenAdditiveEntity";
+    if (code == V3EntityCode.ACDA)
+      return "ACDA";
+    if (code == V3EntityCode.ACDB)
+      return "ACDB";
+    if (code == V3EntityCode.ACET)
+      return "ACET";
+    if (code == V3EntityCode.AMIES)
+      return "AMIES";
+    if (code == V3EntityCode.BACTM)
+      return "BACTM";
+    if (code == V3EntityCode.BF10)
+      return "BF10";
+    if (code == V3EntityCode.BOR)
+      return "BOR";
+    if (code == V3EntityCode.BOUIN)
+      return "BOUIN";
+    if (code == V3EntityCode.BSKM)
+      return "BSKM";
+    if (code == V3EntityCode.C32)
+      return "C32";
+    if (code == V3EntityCode.C38)
+      return "C38";
+    if (code == V3EntityCode.CARS)
+      return "CARS";
+    if (code == V3EntityCode.CARY)
+      return "CARY";
+    if (code == V3EntityCode.CHLTM)
+      return "CHLTM";
+    if (code == V3EntityCode.CTAD)
+      return "CTAD";
+    if (code == V3EntityCode.EDTK15)
+      return "EDTK15";
+    if (code == V3EntityCode.EDTK75)
+      return "EDTK75";
+    if (code == V3EntityCode.EDTN)
+      return "EDTN";
+    if (code == V3EntityCode.ENT)
+      return "ENT";
+    if (code == V3EntityCode.F10)
+      return "F10";
+    if (code == V3EntityCode.FDP)
+      return "FDP";
+    if (code == V3EntityCode.FL10)
+      return "FL10";
+    if (code == V3EntityCode.FL100)
+      return "FL100";
+    if (code == V3EntityCode.HCL6)
+      return "HCL6";
+    if (code == V3EntityCode.HEPA)
+      return "HEPA";
+    if (code == V3EntityCode.HEPL)
+      return "HEPL";
+    if (code == V3EntityCode.HEPN)
+      return "HEPN";
+    if (code == V3EntityCode.HNO3)
+      return "HNO3";
+    if (code == V3EntityCode.JKM)
+      return "JKM";
+    if (code == V3EntityCode.KARN)
+      return "KARN";
+    if (code == V3EntityCode.KOX)
+      return "KOX";
+    if (code == V3EntityCode.LIA)
+      return "LIA";
+    if (code == V3EntityCode.M4)
+      return "M4";
+    if (code == V3EntityCode.M4RT)
+      return "M4RT";
+    if (code == V3EntityCode.M5)
+      return "M5";
+    if (code == V3EntityCode.MICHTM)
+      return "MICHTM";
+    if (code == V3EntityCode.MMDTM)
+      return "MMDTM";
+    if (code == V3EntityCode.NAF)
+      return "NAF";
+    if (code == V3EntityCode.NONE)
+      return "NONE";
+    if (code == V3EntityCode.PAGE)
+      return "PAGE";
+    if (code == V3EntityCode.PHENOL)
+      return "PHENOL";
+    if (code == V3EntityCode.PVA)
+      return "PVA";
+    if (code == V3EntityCode.RLM)
+      return "RLM";
+    if (code == V3EntityCode.SILICA)
+      return "SILICA";
+    if (code == V3EntityCode.SPS)
+      return "SPS";
+    if (code == V3EntityCode.SST)
+      return "SST";
+    if (code == V3EntityCode.STUTM)
+      return "STUTM";
+    if (code == V3EntityCode.THROM)
+      return "THROM";
+    if (code == V3EntityCode.THYMOL)
+      return "THYMOL";
+    if (code == V3EntityCode.THYO)
+      return "THYO";
+    if (code == V3EntityCode.TOLU)
+      return "TOLU";
+    if (code == V3EntityCode.URETM)
+      return "URETM";
+    if (code == V3EntityCode.VIRTM)
+      return "VIRTM";
+    if (code == V3EntityCode.WEST)
+      return "WEST";
+    if (code == V3EntityCode.BLDPRD)
+      return "BLDPRD";
+    if (code == V3EntityCode.VCCNE)
+      return "VCCNE";
+    if (code == V3EntityCode._DRUGENTITY)
+      return "_DrugEntity";
+    if (code == V3EntityCode._CLINICALDRUG)
+      return "_ClinicalDrug";
+    if (code == V3EntityCode._NONDRUGAGENTENTITY)
+      return "_NonDrugAgentEntity";
+    if (code == V3EntityCode.NDA01)
+      return "NDA01";
+    if (code == V3EntityCode.NDA02)
+      return "NDA02";
+    if (code == V3EntityCode.NDA03)
+      return "NDA03";
+    if (code == V3EntityCode.NDA04)
+      return "NDA04";
+    if (code == V3EntityCode.NDA05)
+      return "NDA05";
+    if (code == V3EntityCode.NDA06)
+      return "NDA06";
+    if (code == V3EntityCode.NDA07)
+      return "NDA07";
+    if (code == V3EntityCode.NDA08)
+      return "NDA08";
+    if (code == V3EntityCode.NDA09)
+      return "NDA09";
+    if (code == V3EntityCode.NDA10)
+      return "NDA10";
+    if (code == V3EntityCode.NDA11)
+      return "NDA11";
+    if (code == V3EntityCode.NDA12)
+      return "NDA12";
+    if (code == V3EntityCode.NDA13)
+      return "NDA13";
+    if (code == V3EntityCode.NDA14)
+      return "NDA14";
+    if (code == V3EntityCode.NDA15)
+      return "NDA15";
+    if (code == V3EntityCode.NDA16)
+      return "NDA16";
+    if (code == V3EntityCode.NDA17)
+      return "NDA17";
+    if (code == V3EntityCode._ORGANIZATIONENTITYTYPE)
+      return "_OrganizationEntityType";
+    if (code == V3EntityCode.HHOLD)
+      return "HHOLD";
+    if (code == V3EntityCode.NAT)
+      return "NAT";
+    if (code == V3EntityCode.RELIG)
+      return "RELIG";
+    if (code == V3EntityCode._PLACEENTITYTYPE)
+      return "_PlaceEntityType";
+    if (code == V3EntityCode.BED)
+      return "BED";
+    if (code == V3EntityCode.BLDG)
+      return "BLDG";
+    if (code == V3EntityCode.FLOOR)
+      return "FLOOR";
+    if (code == V3EntityCode.ROOM)
+      return "ROOM";
+    if (code == V3EntityCode.WING)
+      return "WING";
+    if (code == V3EntityCode._RESOURCEGROUPENTITYTYPE)
+      return "_ResourceGroupEntityType";
+    if (code == V3EntityCode.PRAC)
+      return "PRAC";
+    return "?";
+  }
+
+    public String toSystem(V3EntityCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityDeterminer.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityDeterminer.java
new file mode 100644
index 00000000000..7e2a3e351c5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityDeterminer.java
@@ -0,0 +1,117 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityDeterminer {
+
+        /**
+         * Description:A determiner that specifies that the Entity object represents a particular physical thing (as opposed to a universal, kind, or class of physical thing).
+
+                        
+                           Discussion: It does not matter whether an INSTANCE still exists as a whole at the point in time (or process) when we mention it, for example, a drug product lot is an INSTANCE even though it has been portioned out for retail purpose.
+         */
+        INSTANCE, 
+        /**
+         * A determiner that specifies that the Entity object represents a particular collection of physical things (as opposed to a universal, kind, or class of physical thing).  While the collection may resolve to having only a single individual (or even no individuals), the potential should exist for it to cover multiple individuals.
+         */
+        GROUP, 
+        /**
+         * Description:A determiner that specifies that the Entity object represents a universal, kind or class of physical thing (as opposed to a particular thing).
+         */
+        KIND, 
+        /**
+         * A determiner that specifies that the Entity object represents a universal, kind or class of collections physical things.  While the collection may resolve to having only a single individual (or even no individuals), the potential should exist for it to cover multiple individuals.
+         */
+        GROUPKIND, 
+        /**
+         * The described quantified determiner indicates that the given Entity is taken as a general description of a specific amount of a thing. For example, QUANTIFIED_KIND of syringe (quantity = 3,) stands for exactly three syringes.
+         */
+        QUANTIFIEDKIND, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityDeterminer fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("INSTANCE".equals(codeString))
+          return INSTANCE;
+        if ("GROUP".equals(codeString))
+          return GROUP;
+        if ("KIND".equals(codeString))
+          return KIND;
+        if ("GROUPKIND".equals(codeString))
+          return GROUPKIND;
+        if ("QUANTIFIED_KIND".equals(codeString))
+          return QUANTIFIEDKIND;
+        throw new FHIRException("Unknown V3EntityDeterminer code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case INSTANCE: return "INSTANCE";
+            case GROUP: return "GROUP";
+            case KIND: return "KIND";
+            case GROUPKIND: return "GROUPKIND";
+            case QUANTIFIEDKIND: return "QUANTIFIED_KIND";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityDeterminer";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case INSTANCE: return "Description:A determiner that specifies that the Entity object represents a particular physical thing (as opposed to a universal, kind, or class of physical thing).\r\n\n                        \n                           Discussion: It does not matter whether an INSTANCE still exists as a whole at the point in time (or process) when we mention it, for example, a drug product lot is an INSTANCE even though it has been portioned out for retail purpose.";
+            case GROUP: return "A determiner that specifies that the Entity object represents a particular collection of physical things (as opposed to a universal, kind, or class of physical thing).  While the collection may resolve to having only a single individual (or even no individuals), the potential should exist for it to cover multiple individuals.";
+            case KIND: return "Description:A determiner that specifies that the Entity object represents a universal, kind or class of physical thing (as opposed to a particular thing).";
+            case GROUPKIND: return "A determiner that specifies that the Entity object represents a universal, kind or class of collections physical things.  While the collection may resolve to having only a single individual (or even no individuals), the potential should exist for it to cover multiple individuals.";
+            case QUANTIFIEDKIND: return "The described quantified determiner indicates that the given Entity is taken as a general description of a specific amount of a thing. For example, QUANTIFIED_KIND of syringe (quantity = 3,) stands for exactly three syringes.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case INSTANCE: return "specific";
+            case GROUP: return "specific group";
+            case KIND: return "described";
+            case GROUPKIND: return "described group";
+            case QUANTIFIEDKIND: return "described quantified";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityDeterminerEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityDeterminerEnumFactory.java
new file mode 100644
index 00000000000..cc4bdcc7c05
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityDeterminerEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityDeterminerEnumFactory implements EnumFactory {
+
+  public V3EntityDeterminer fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("INSTANCE".equals(codeString))
+      return V3EntityDeterminer.INSTANCE;
+    if ("GROUP".equals(codeString))
+      return V3EntityDeterminer.GROUP;
+    if ("KIND".equals(codeString))
+      return V3EntityDeterminer.KIND;
+    if ("GROUPKIND".equals(codeString))
+      return V3EntityDeterminer.GROUPKIND;
+    if ("QUANTIFIED_KIND".equals(codeString))
+      return V3EntityDeterminer.QUANTIFIEDKIND;
+    throw new IllegalArgumentException("Unknown V3EntityDeterminer code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityDeterminer code) {
+    if (code == V3EntityDeterminer.INSTANCE)
+      return "INSTANCE";
+    if (code == V3EntityDeterminer.GROUP)
+      return "GROUP";
+    if (code == V3EntityDeterminer.KIND)
+      return "KIND";
+    if (code == V3EntityDeterminer.GROUPKIND)
+      return "GROUPKIND";
+    if (code == V3EntityDeterminer.QUANTIFIEDKIND)
+      return "QUANTIFIED_KIND";
+    return "?";
+  }
+
+    public String toSystem(V3EntityDeterminer code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityHandling.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityHandling.java
new file mode 100644
index 00000000000..dc135f154d8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityHandling.java
@@ -0,0 +1,231 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityHandling {
+
+        /**
+         * Keep at ambient temperature, 22 +/- 2C
+         */
+        AMB, 
+        /**
+         * Critical to keep at body temperature 36-38C
+         */
+        C37, 
+        /**
+         * Critical ambient - must not be refrigerated or frozen.
+         */
+        CAMB, 
+        /**
+         * Critical. Do not expose to atmosphere.  Do not uncap.
+         */
+        CATM, 
+        /**
+         * Critical frozen. Specimen must not be allowed to thaw until immediately prior to testing.
+         */
+        CFRZ, 
+        /**
+         * Critical refrigerated - must not be allowed to freeze or warm until imediately prior to testing.
+         */
+        CREF, 
+        /**
+         * Deep Frozen -16 to -20C.
+         */
+        DFRZ, 
+        /**
+         * Keep in a dry environment
+         */
+        DRY, 
+        /**
+         * Keep frozen below 0 ?C
+         */
+        FRZ, 
+        /**
+         * Container is free of heavy metals, including lead.
+         */
+        MTLF, 
+        /**
+         * Keep in liquid nitrogen
+         */
+        NTR, 
+        /**
+         * Protect from light (eg. Wrap in aluminum foil).
+         */
+        PRTL, 
+        /**
+         * Do not shake
+         */
+        PSA, 
+        /**
+         * Protect against shock
+         */
+        PSO, 
+        /**
+         * Keep at refrigerated temperature:4-8C Accidental warming or freezing is of little consequence.
+         */
+        REF, 
+        /**
+         * Shake thoroughly before using
+         */
+        SBU, 
+        /**
+         * Ultra cold frozen -75 to -85C.  Ultra cold freezer is typically at temperature of dry ice.
+         */
+        UFRZ, 
+        /**
+         * Keep upright, do not turn upside down
+         */
+        UPR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityHandling fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AMB".equals(codeString))
+          return AMB;
+        if ("C37".equals(codeString))
+          return C37;
+        if ("CAMB".equals(codeString))
+          return CAMB;
+        if ("CATM".equals(codeString))
+          return CATM;
+        if ("CFRZ".equals(codeString))
+          return CFRZ;
+        if ("CREF".equals(codeString))
+          return CREF;
+        if ("DFRZ".equals(codeString))
+          return DFRZ;
+        if ("DRY".equals(codeString))
+          return DRY;
+        if ("FRZ".equals(codeString))
+          return FRZ;
+        if ("MTLF".equals(codeString))
+          return MTLF;
+        if ("NTR".equals(codeString))
+          return NTR;
+        if ("PRTL".equals(codeString))
+          return PRTL;
+        if ("PSA".equals(codeString))
+          return PSA;
+        if ("PSO".equals(codeString))
+          return PSO;
+        if ("REF".equals(codeString))
+          return REF;
+        if ("SBU".equals(codeString))
+          return SBU;
+        if ("UFRZ".equals(codeString))
+          return UFRZ;
+        if ("UPR".equals(codeString))
+          return UPR;
+        throw new FHIRException("Unknown V3EntityHandling code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AMB: return "AMB";
+            case C37: return "C37";
+            case CAMB: return "CAMB";
+            case CATM: return "CATM";
+            case CFRZ: return "CFRZ";
+            case CREF: return "CREF";
+            case DFRZ: return "DFRZ";
+            case DRY: return "DRY";
+            case FRZ: return "FRZ";
+            case MTLF: return "MTLF";
+            case NTR: return "NTR";
+            case PRTL: return "PRTL";
+            case PSA: return "PSA";
+            case PSO: return "PSO";
+            case REF: return "REF";
+            case SBU: return "SBU";
+            case UFRZ: return "UFRZ";
+            case UPR: return "UPR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityHandling";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AMB: return "Keep at ambient temperature, 22 +/- 2C";
+            case C37: return "Critical to keep at body temperature 36-38C";
+            case CAMB: return "Critical ambient - must not be refrigerated or frozen.";
+            case CATM: return "Critical. Do not expose to atmosphere.  Do not uncap.";
+            case CFRZ: return "Critical frozen. Specimen must not be allowed to thaw until immediately prior to testing.";
+            case CREF: return "Critical refrigerated - must not be allowed to freeze or warm until imediately prior to testing.";
+            case DFRZ: return "Deep Frozen -16 to -20C.";
+            case DRY: return "Keep in a dry environment";
+            case FRZ: return "Keep frozen below 0 ?C";
+            case MTLF: return "Container is free of heavy metals, including lead.";
+            case NTR: return "Keep in liquid nitrogen";
+            case PRTL: return "Protect from light (eg. Wrap in aluminum foil).";
+            case PSA: return "Do not shake";
+            case PSO: return "Protect against shock";
+            case REF: return "Keep at refrigerated temperature:4-8C Accidental warming or freezing is of little consequence.";
+            case SBU: return "Shake thoroughly before using";
+            case UFRZ: return "Ultra cold frozen -75 to -85C.  Ultra cold freezer is typically at temperature of dry ice.";
+            case UPR: return "Keep upright, do not turn upside down";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AMB: return "Ambient Temperature";
+            case C37: return "Body Temperature";
+            case CAMB: return "Critical Ambient temperature";
+            case CATM: return "Protect from Air";
+            case CFRZ: return "Critical frozen";
+            case CREF: return "Critical refrigerated temperature";
+            case DFRZ: return "Deep Frozen";
+            case DRY: return "dry";
+            case FRZ: return "frozen";
+            case MTLF: return "Metal Free";
+            case NTR: return "nitrogen";
+            case PRTL: return "Protect from Light";
+            case PSA: return "do not shake";
+            case PSO: return "no shock";
+            case REF: return "Refrigerated temperature";
+            case SBU: return "Shake before use";
+            case UFRZ: return "Ultra frozen";
+            case UPR: return "upright";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityHandlingEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityHandlingEnumFactory.java
new file mode 100644
index 00000000000..e6f11903e71
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityHandlingEnumFactory.java
@@ -0,0 +1,126 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityHandlingEnumFactory implements EnumFactory {
+
+  public V3EntityHandling fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AMB".equals(codeString))
+      return V3EntityHandling.AMB;
+    if ("C37".equals(codeString))
+      return V3EntityHandling.C37;
+    if ("CAMB".equals(codeString))
+      return V3EntityHandling.CAMB;
+    if ("CATM".equals(codeString))
+      return V3EntityHandling.CATM;
+    if ("CFRZ".equals(codeString))
+      return V3EntityHandling.CFRZ;
+    if ("CREF".equals(codeString))
+      return V3EntityHandling.CREF;
+    if ("DFRZ".equals(codeString))
+      return V3EntityHandling.DFRZ;
+    if ("DRY".equals(codeString))
+      return V3EntityHandling.DRY;
+    if ("FRZ".equals(codeString))
+      return V3EntityHandling.FRZ;
+    if ("MTLF".equals(codeString))
+      return V3EntityHandling.MTLF;
+    if ("NTR".equals(codeString))
+      return V3EntityHandling.NTR;
+    if ("PRTL".equals(codeString))
+      return V3EntityHandling.PRTL;
+    if ("PSA".equals(codeString))
+      return V3EntityHandling.PSA;
+    if ("PSO".equals(codeString))
+      return V3EntityHandling.PSO;
+    if ("REF".equals(codeString))
+      return V3EntityHandling.REF;
+    if ("SBU".equals(codeString))
+      return V3EntityHandling.SBU;
+    if ("UFRZ".equals(codeString))
+      return V3EntityHandling.UFRZ;
+    if ("UPR".equals(codeString))
+      return V3EntityHandling.UPR;
+    throw new IllegalArgumentException("Unknown V3EntityHandling code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityHandling code) {
+    if (code == V3EntityHandling.AMB)
+      return "AMB";
+    if (code == V3EntityHandling.C37)
+      return "C37";
+    if (code == V3EntityHandling.CAMB)
+      return "CAMB";
+    if (code == V3EntityHandling.CATM)
+      return "CATM";
+    if (code == V3EntityHandling.CFRZ)
+      return "CFRZ";
+    if (code == V3EntityHandling.CREF)
+      return "CREF";
+    if (code == V3EntityHandling.DFRZ)
+      return "DFRZ";
+    if (code == V3EntityHandling.DRY)
+      return "DRY";
+    if (code == V3EntityHandling.FRZ)
+      return "FRZ";
+    if (code == V3EntityHandling.MTLF)
+      return "MTLF";
+    if (code == V3EntityHandling.NTR)
+      return "NTR";
+    if (code == V3EntityHandling.PRTL)
+      return "PRTL";
+    if (code == V3EntityHandling.PSA)
+      return "PSA";
+    if (code == V3EntityHandling.PSO)
+      return "PSO";
+    if (code == V3EntityHandling.REF)
+      return "REF";
+    if (code == V3EntityHandling.SBU)
+      return "SBU";
+    if (code == V3EntityHandling.UFRZ)
+      return "UFRZ";
+    if (code == V3EntityHandling.UPR)
+      return "UPR";
+    return "?";
+  }
+
+    public String toSystem(V3EntityHandling code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifier.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifier.java
new file mode 100644
index 00000000000..7e0d8189692
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifier.java
@@ -0,0 +1,444 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityNamePartQualifier {
+
+        /**
+         * OrganizationNamePartQualifier
+         */
+        _ORGANIZATIONNAMEPARTQUALIFIER, 
+        /**
+         * Indicates that a prefix like "Dr." or a suffix like "M.D." or "Ph.D." is an academic title.
+         */
+        AC, 
+        /**
+         * The name the person was given at the time of adoption.
+         */
+        AD, 
+        /**
+         * A name that a person had shortly after being born. Usually for family names but may be used to mark given names at birth that may have changed later.
+         */
+        BR, 
+        /**
+         * A callme name is (usually a given name) that is preferred when a person is directly addressed.
+         */
+        CL, 
+        /**
+         * Indicates that a name part is just an initial. Initials do not imply a trailing period since this would not work with non-Latin scripts.  Initials may consist of more than one letter, e.g., "Ph." could stand for "Philippe" or "Th." for "Thomas".
+         */
+        IN, 
+        /**
+         * For organizations a suffix indicating the legal status, e.g., "Inc.", "Co.", "AG", "GmbH", "B.V." "S.A.",  "Ltd." etc.
+         */
+        LS, 
+        /**
+         * In Europe and Asia, there are still people with nobility titles (aristocrats).  German "von" is generally a nobility title, not a mere voorvoegsel.  Others are "Earl of" or "His Majesty King of..." etc.  Rarely used nowadays, but some systems do keep track of this.
+         */
+        NB, 
+        /**
+         * Primarily in the British Imperial culture people tend to have an abbreviation of their professional organization as part of their credential suffices.
+         */
+        PR, 
+        /**
+         * The name assumed from the partner in a marital relationship (hence the "SP"). Usually the spouse's family name. Note that no inference about gender can be made from the existence of spouse names.
+         */
+        SP, 
+        /**
+         * Indicates that a prefix or a suffix is a title that applies to the whole name, not just the adjacent name part.
+         */
+        TITLE, 
+        /**
+         * A Dutch "voorvoegsel" is something like "van" or "de" that might have indicated nobility in the past but no longer so. Similar prefixes exist in other languages such as Spanish, French or Portugese.
+         */
+        VV, 
+        /**
+         * Description: Medication Name Parts are a means of specifying a range of acceptable "official" forms of the name of a product.  They are used as patterns against which input name strings may be matched for automatic identification of products from input text reports.   While they cover the concepts held under "doseForm" or "route" or "strength" the name parts are not the same and do not fit into a controlled vocabulary in the same way. By specifying up to 8 name parts a much larger range of possible names can be generated.
+         */
+        PHARMACEUTICALENTITYNAMEPARTQUALIFIERS, 
+        /**
+         * Description: This refers to the container if present in the medicinal product name.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): pre-filled syringe
+         */
+        CON, 
+        /**
+         * Description: This refers to the qualifiers in the name for devices and is at the moment mainly applicable to insulins and inhalation products.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              For the medicinal product Actrapid FlexPen 100 IU/ml Solution for injection Subcutaneous use: FlexPen.
+         */
+        DEV, 
+        /**
+         * Description: This refers to a flavor of the medicinal product if present in the medicinal product name.
+
+                        
+                           Examples:
+                        
+
+                        
+                           For 'CoughCure Linctus Orange Flavor', the flavor part is "Orange"
+                           For 'Wonderdrug Syrup Cherry Flavor', the flavor part is "Cherry"
+         */
+        FLAV, 
+        /**
+         * Description: This refers to the formulation of the medicinal product if present in the medicinal product name.
+
+                        
+                           Examples:
+                        
+
+                        
+                           For 'SpecialMed Sugar Free Cough Syrup', the formulation name part is "Sugar Free"
+                           For 'QuickCure Gluten-free Bulk Fibre', the formulation name part is "gluten-free"
+         */
+        FORMUL, 
+        /**
+         * Description: This refers to the pharmaceutical form/ if present in the medicinal product name.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              For Agenerase 50 mg soft capsules: Soft Capsules
+
+                           
+                           
+                              For Ludiomil 25mg-Filmtabletten: Filmtabletten
+
+                           
+                           
+                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): suspension for injection
+         */
+        FRM, 
+        /**
+         * Description: This refers to the product name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name and, if appropriate, whether it is intended e.g. for babies, children or adults. 
+
+                        EXAMPLES: 
+
+                        
+                           
+                              Agenerase
+
+                           
+                           
+                              Optaflu
+
+                           
+                           
+                              Ludiomil
+         */
+        INV, 
+        /**
+         * Description: This refers to the target population for the medicinal product if present in the medicinal product name
+
+                        
+                           Examples:
+                        
+
+                        
+                           For 'Broncho-Drug 3.5 mg-capsules for children', the target population part is "children"
+                           For 'Adult Chesty Cough Syrup', the target population part is "adult"
+         */
+        POPUL, 
+        /**
+         * Description: This refers to the product common or scientific name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              For Agenerase: N/A
+
+                           
+                           
+                              For Optaflu: Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season)
+
+                           
+                           
+                              For Ludiomil: N/A
+         */
+        SCI, 
+        /**
+         * Description: This refers to the strength if present in the medicinal product name. The use of decimal points should be accommodated if required.
+
+                        EXAMPLES:
+
+                        
+                           
+                              For Agenerase 50 mg soft capsules: 50mg
+
+                           
+                           
+                              For Ludiomil 25mg-Filmtabletten: 25 mg
+
+                           
+                           
+                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): N/A
+         */
+        STR, 
+        /**
+         * Description: This refers to a time or time period that may be specified in the text of the medicinal product name
+
+                        
+                           Example:
+                        
+
+                        
+                           For an influenza vaccine 'Drug-FLU season 2008/2009', the time/period part is "2008/2009 season"
+         */
+        TIME, 
+        /**
+         * Description: This refers to trademark/company element if present in the medicinal product name.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              for Insulin Human Winthrop Comb 15: Winthrop
+         */
+        TMK, 
+        /**
+         * Description: This refers to the intended use if present in the medicinal product name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name.
+
+
+                        
+                           Examples:
+                        
+
+                        
+                           For 'Drug-BI Caplets - Heartburn Relief', the intended use part is: "Heartburn Relief"
+                           For 'Medicine Honey Syrup for Soothing Coughs' the intended use part is "Soothing Coughs"
+         */
+        USE, 
+        /**
+         * PersonNamePartQualifier
+         */
+        _PERSONNAMEPARTQUALIFIER, 
+        /**
+         * PersonNamePartAffixTypes
+         */
+        _PERSONNAMEPARTAFFIXTYPES, 
+        /**
+         * PersonNamePartChangeQualifier
+         */
+        _PERSONNAMEPARTCHANGEQUALIFIER, 
+        /**
+         * PersonNamePartMiscQualifier
+         */
+        _PERSONNAMEPARTMISCQUALIFIER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityNamePartQualifier fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_OrganizationNamePartQualifier".equals(codeString))
+          return _ORGANIZATIONNAMEPARTQUALIFIER;
+        if ("AC".equals(codeString))
+          return AC;
+        if ("AD".equals(codeString))
+          return AD;
+        if ("BR".equals(codeString))
+          return BR;
+        if ("CL".equals(codeString))
+          return CL;
+        if ("IN".equals(codeString))
+          return IN;
+        if ("LS".equals(codeString))
+          return LS;
+        if ("NB".equals(codeString))
+          return NB;
+        if ("PR".equals(codeString))
+          return PR;
+        if ("SP".equals(codeString))
+          return SP;
+        if ("TITLE".equals(codeString))
+          return TITLE;
+        if ("VV".equals(codeString))
+          return VV;
+        if ("PharmaceuticalEntityNamePartQualifiers".equals(codeString))
+          return PHARMACEUTICALENTITYNAMEPARTQUALIFIERS;
+        if ("CON".equals(codeString))
+          return CON;
+        if ("DEV".equals(codeString))
+          return DEV;
+        if ("FLAV".equals(codeString))
+          return FLAV;
+        if ("FORMUL".equals(codeString))
+          return FORMUL;
+        if ("FRM".equals(codeString))
+          return FRM;
+        if ("INV".equals(codeString))
+          return INV;
+        if ("POPUL".equals(codeString))
+          return POPUL;
+        if ("SCI".equals(codeString))
+          return SCI;
+        if ("STR".equals(codeString))
+          return STR;
+        if ("TIME".equals(codeString))
+          return TIME;
+        if ("TMK".equals(codeString))
+          return TMK;
+        if ("USE".equals(codeString))
+          return USE;
+        if ("_PersonNamePartQualifier".equals(codeString))
+          return _PERSONNAMEPARTQUALIFIER;
+        if ("_PersonNamePartAffixTypes".equals(codeString))
+          return _PERSONNAMEPARTAFFIXTYPES;
+        if ("_PersonNamePartChangeQualifier".equals(codeString))
+          return _PERSONNAMEPARTCHANGEQUALIFIER;
+        if ("_PersonNamePartMiscQualifier".equals(codeString))
+          return _PERSONNAMEPARTMISCQUALIFIER;
+        throw new FHIRException("Unknown V3EntityNamePartQualifier code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ORGANIZATIONNAMEPARTQUALIFIER: return "_OrganizationNamePartQualifier";
+            case AC: return "AC";
+            case AD: return "AD";
+            case BR: return "BR";
+            case CL: return "CL";
+            case IN: return "IN";
+            case LS: return "LS";
+            case NB: return "NB";
+            case PR: return "PR";
+            case SP: return "SP";
+            case TITLE: return "TITLE";
+            case VV: return "VV";
+            case PHARMACEUTICALENTITYNAMEPARTQUALIFIERS: return "PharmaceuticalEntityNamePartQualifiers";
+            case CON: return "CON";
+            case DEV: return "DEV";
+            case FLAV: return "FLAV";
+            case FORMUL: return "FORMUL";
+            case FRM: return "FRM";
+            case INV: return "INV";
+            case POPUL: return "POPUL";
+            case SCI: return "SCI";
+            case STR: return "STR";
+            case TIME: return "TIME";
+            case TMK: return "TMK";
+            case USE: return "USE";
+            case _PERSONNAMEPARTQUALIFIER: return "_PersonNamePartQualifier";
+            case _PERSONNAMEPARTAFFIXTYPES: return "_PersonNamePartAffixTypes";
+            case _PERSONNAMEPARTCHANGEQUALIFIER: return "_PersonNamePartChangeQualifier";
+            case _PERSONNAMEPARTMISCQUALIFIER: return "_PersonNamePartMiscQualifier";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityNamePartQualifier";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ORGANIZATIONNAMEPARTQUALIFIER: return "OrganizationNamePartQualifier";
+            case AC: return "Indicates that a prefix like \"Dr.\" or a suffix like \"M.D.\" or \"Ph.D.\" is an academic title.";
+            case AD: return "The name the person was given at the time of adoption.";
+            case BR: return "A name that a person had shortly after being born. Usually for family names but may be used to mark given names at birth that may have changed later.";
+            case CL: return "A callme name is (usually a given name) that is preferred when a person is directly addressed.";
+            case IN: return "Indicates that a name part is just an initial. Initials do not imply a trailing period since this would not work with non-Latin scripts.  Initials may consist of more than one letter, e.g., \"Ph.\" could stand for \"Philippe\" or \"Th.\" for \"Thomas\".";
+            case LS: return "For organizations a suffix indicating the legal status, e.g., \"Inc.\", \"Co.\", \"AG\", \"GmbH\", \"B.V.\" \"S.A.\",  \"Ltd.\" etc.";
+            case NB: return "In Europe and Asia, there are still people with nobility titles (aristocrats).  German \"von\" is generally a nobility title, not a mere voorvoegsel.  Others are \"Earl of\" or \"His Majesty King of...\" etc.  Rarely used nowadays, but some systems do keep track of this.";
+            case PR: return "Primarily in the British Imperial culture people tend to have an abbreviation of their professional organization as part of their credential suffices.";
+            case SP: return "The name assumed from the partner in a marital relationship (hence the \"SP\"). Usually the spouse's family name. Note that no inference about gender can be made from the existence of spouse names.";
+            case TITLE: return "Indicates that a prefix or a suffix is a title that applies to the whole name, not just the adjacent name part.";
+            case VV: return "A Dutch \"voorvoegsel\" is something like \"van\" or \"de\" that might have indicated nobility in the past but no longer so. Similar prefixes exist in other languages such as Spanish, French or Portugese.";
+            case PHARMACEUTICALENTITYNAMEPARTQUALIFIERS: return "Description: Medication Name Parts are a means of specifying a range of acceptable \"official\" forms of the name of a product.  They are used as patterns against which input name strings may be matched for automatic identification of products from input text reports.   While they cover the concepts held under \"doseForm\" or \"route\" or \"strength\" the name parts are not the same and do not fit into a controlled vocabulary in the same way. By specifying up to 8 name parts a much larger range of possible names can be generated.";
+            case CON: return "Description: This refers to the container if present in the medicinal product name.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): pre-filled syringe";
+            case DEV: return "Description: This refers to the qualifiers in the name for devices and is at the moment mainly applicable to insulins and inhalation products.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              For the medicinal product Actrapid FlexPen 100 IU/ml Solution for injection Subcutaneous use: FlexPen.";
+            case FLAV: return "Description: This refers to a flavor of the medicinal product if present in the medicinal product name.\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           For 'CoughCure Linctus Orange Flavor', the flavor part is \"Orange\"\n                           For 'Wonderdrug Syrup Cherry Flavor', the flavor part is \"Cherry\"";
+            case FORMUL: return "Description: This refers to the formulation of the medicinal product if present in the medicinal product name.\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           For 'SpecialMed Sugar Free Cough Syrup', the formulation name part is \"Sugar Free\"\n                           For 'QuickCure Gluten-free Bulk Fibre', the formulation name part is \"gluten-free\"";
+            case FRM: return "Description: This refers to the pharmaceutical form/ if present in the medicinal product name.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              For Agenerase 50 mg soft capsules: Soft Capsules\r\n\n                           \n                           \n                              For Ludiomil 25mg-Filmtabletten: Filmtabletten\r\n\n                           \n                           \n                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): suspension for injection";
+            case INV: return "Description: This refers to the product name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name and, if appropriate, whether it is intended e.g. for babies, children or adults. \r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              Agenerase\r\n\n                           \n                           \n                              Optaflu\r\n\n                           \n                           \n                              Ludiomil";
+            case POPUL: return "Description: This refers to the target population for the medicinal product if present in the medicinal product name\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           For 'Broncho-Drug 3.5 mg-capsules for children', the target population part is \"children\"\n                           For 'Adult Chesty Cough Syrup', the target population part is \"adult\"";
+            case SCI: return "Description: This refers to the product common or scientific name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              For Agenerase: N/A\r\n\n                           \n                           \n                              For Optaflu: Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season)\r\n\n                           \n                           \n                              For Ludiomil: N/A";
+            case STR: return "Description: This refers to the strength if present in the medicinal product name. The use of decimal points should be accommodated if required.\r\n\n                        EXAMPLES:\r\n\n                        \n                           \n                              For Agenerase 50 mg soft capsules: 50mg\r\n\n                           \n                           \n                              For Ludiomil 25mg-Filmtabletten: 25 mg\r\n\n                           \n                           \n                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): N/A";
+            case TIME: return "Description: This refers to a time or time period that may be specified in the text of the medicinal product name\r\n\n                        \n                           Example:\n                        \r\n\n                        \n                           For an influenza vaccine 'Drug-FLU season 2008/2009', the time/period part is \"2008/2009 season\"";
+            case TMK: return "Description: This refers to trademark/company element if present in the medicinal product name.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              for Insulin Human Winthrop Comb 15: Winthrop";
+            case USE: return "Description: This refers to the intended use if present in the medicinal product name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name.\n\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           For 'Drug-BI Caplets - Heartburn Relief', the intended use part is: \"Heartburn Relief\"\n                           For 'Medicine Honey Syrup for Soothing Coughs' the intended use part is \"Soothing Coughs\"";
+            case _PERSONNAMEPARTQUALIFIER: return "PersonNamePartQualifier";
+            case _PERSONNAMEPARTAFFIXTYPES: return "PersonNamePartAffixTypes";
+            case _PERSONNAMEPARTCHANGEQUALIFIER: return "PersonNamePartChangeQualifier";
+            case _PERSONNAMEPARTMISCQUALIFIER: return "PersonNamePartMiscQualifier";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ORGANIZATIONNAMEPARTQUALIFIER: return "OrganizationNamePartQualifier";
+            case AC: return "academic";
+            case AD: return "adopted";
+            case BR: return "birth";
+            case CL: return "callme";
+            case IN: return "initial";
+            case LS: return "Legal status";
+            case NB: return "nobility";
+            case PR: return "professional";
+            case SP: return "spouse";
+            case TITLE: return "title";
+            case VV: return "voorvoegsel";
+            case PHARMACEUTICALENTITYNAMEPARTQUALIFIERS: return "PharmaceuticalEntityNamePartQualifiers";
+            case CON: return "container name";
+            case DEV: return "device name";
+            case FLAV: return "FlavorName";
+            case FORMUL: return "FormulationPartName";
+            case FRM: return "form name";
+            case INV: return "invented name";
+            case POPUL: return "TargetPopulationName";
+            case SCI: return "scientific name";
+            case STR: return "strength name";
+            case TIME: return "TimeOrPeriodName";
+            case TMK: return "trademark name";
+            case USE: return "intended use name";
+            case _PERSONNAMEPARTQUALIFIER: return "PersonNamePartQualifier";
+            case _PERSONNAMEPARTAFFIXTYPES: return "PersonNamePartAffixTypes";
+            case _PERSONNAMEPARTCHANGEQUALIFIER: return "PersonNamePartChangeQualifier";
+            case _PERSONNAMEPARTMISCQUALIFIER: return "PersonNamePartMiscQualifier";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifierEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifierEnumFactory.java
new file mode 100644
index 00000000000..45be8d983b0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifierEnumFactory.java
@@ -0,0 +1,170 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityNamePartQualifierEnumFactory implements EnumFactory {
+
+  public V3EntityNamePartQualifier fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_OrganizationNamePartQualifier".equals(codeString))
+      return V3EntityNamePartQualifier._ORGANIZATIONNAMEPARTQUALIFIER;
+    if ("AC".equals(codeString))
+      return V3EntityNamePartQualifier.AC;
+    if ("AD".equals(codeString))
+      return V3EntityNamePartQualifier.AD;
+    if ("BR".equals(codeString))
+      return V3EntityNamePartQualifier.BR;
+    if ("CL".equals(codeString))
+      return V3EntityNamePartQualifier.CL;
+    if ("IN".equals(codeString))
+      return V3EntityNamePartQualifier.IN;
+    if ("LS".equals(codeString))
+      return V3EntityNamePartQualifier.LS;
+    if ("NB".equals(codeString))
+      return V3EntityNamePartQualifier.NB;
+    if ("PR".equals(codeString))
+      return V3EntityNamePartQualifier.PR;
+    if ("SP".equals(codeString))
+      return V3EntityNamePartQualifier.SP;
+    if ("TITLE".equals(codeString))
+      return V3EntityNamePartQualifier.TITLE;
+    if ("VV".equals(codeString))
+      return V3EntityNamePartQualifier.VV;
+    if ("PharmaceuticalEntityNamePartQualifiers".equals(codeString))
+      return V3EntityNamePartQualifier.PHARMACEUTICALENTITYNAMEPARTQUALIFIERS;
+    if ("CON".equals(codeString))
+      return V3EntityNamePartQualifier.CON;
+    if ("DEV".equals(codeString))
+      return V3EntityNamePartQualifier.DEV;
+    if ("FLAV".equals(codeString))
+      return V3EntityNamePartQualifier.FLAV;
+    if ("FORMUL".equals(codeString))
+      return V3EntityNamePartQualifier.FORMUL;
+    if ("FRM".equals(codeString))
+      return V3EntityNamePartQualifier.FRM;
+    if ("INV".equals(codeString))
+      return V3EntityNamePartQualifier.INV;
+    if ("POPUL".equals(codeString))
+      return V3EntityNamePartQualifier.POPUL;
+    if ("SCI".equals(codeString))
+      return V3EntityNamePartQualifier.SCI;
+    if ("STR".equals(codeString))
+      return V3EntityNamePartQualifier.STR;
+    if ("TIME".equals(codeString))
+      return V3EntityNamePartQualifier.TIME;
+    if ("TMK".equals(codeString))
+      return V3EntityNamePartQualifier.TMK;
+    if ("USE".equals(codeString))
+      return V3EntityNamePartQualifier.USE;
+    if ("_PersonNamePartQualifier".equals(codeString))
+      return V3EntityNamePartQualifier._PERSONNAMEPARTQUALIFIER;
+    if ("_PersonNamePartAffixTypes".equals(codeString))
+      return V3EntityNamePartQualifier._PERSONNAMEPARTAFFIXTYPES;
+    if ("_PersonNamePartChangeQualifier".equals(codeString))
+      return V3EntityNamePartQualifier._PERSONNAMEPARTCHANGEQUALIFIER;
+    if ("_PersonNamePartMiscQualifier".equals(codeString))
+      return V3EntityNamePartQualifier._PERSONNAMEPARTMISCQUALIFIER;
+    throw new IllegalArgumentException("Unknown V3EntityNamePartQualifier code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityNamePartQualifier code) {
+    if (code == V3EntityNamePartQualifier._ORGANIZATIONNAMEPARTQUALIFIER)
+      return "_OrganizationNamePartQualifier";
+    if (code == V3EntityNamePartQualifier.AC)
+      return "AC";
+    if (code == V3EntityNamePartQualifier.AD)
+      return "AD";
+    if (code == V3EntityNamePartQualifier.BR)
+      return "BR";
+    if (code == V3EntityNamePartQualifier.CL)
+      return "CL";
+    if (code == V3EntityNamePartQualifier.IN)
+      return "IN";
+    if (code == V3EntityNamePartQualifier.LS)
+      return "LS";
+    if (code == V3EntityNamePartQualifier.NB)
+      return "NB";
+    if (code == V3EntityNamePartQualifier.PR)
+      return "PR";
+    if (code == V3EntityNamePartQualifier.SP)
+      return "SP";
+    if (code == V3EntityNamePartQualifier.TITLE)
+      return "TITLE";
+    if (code == V3EntityNamePartQualifier.VV)
+      return "VV";
+    if (code == V3EntityNamePartQualifier.PHARMACEUTICALENTITYNAMEPARTQUALIFIERS)
+      return "PharmaceuticalEntityNamePartQualifiers";
+    if (code == V3EntityNamePartQualifier.CON)
+      return "CON";
+    if (code == V3EntityNamePartQualifier.DEV)
+      return "DEV";
+    if (code == V3EntityNamePartQualifier.FLAV)
+      return "FLAV";
+    if (code == V3EntityNamePartQualifier.FORMUL)
+      return "FORMUL";
+    if (code == V3EntityNamePartQualifier.FRM)
+      return "FRM";
+    if (code == V3EntityNamePartQualifier.INV)
+      return "INV";
+    if (code == V3EntityNamePartQualifier.POPUL)
+      return "POPUL";
+    if (code == V3EntityNamePartQualifier.SCI)
+      return "SCI";
+    if (code == V3EntityNamePartQualifier.STR)
+      return "STR";
+    if (code == V3EntityNamePartQualifier.TIME)
+      return "TIME";
+    if (code == V3EntityNamePartQualifier.TMK)
+      return "TMK";
+    if (code == V3EntityNamePartQualifier.USE)
+      return "USE";
+    if (code == V3EntityNamePartQualifier._PERSONNAMEPARTQUALIFIER)
+      return "_PersonNamePartQualifier";
+    if (code == V3EntityNamePartQualifier._PERSONNAMEPARTAFFIXTYPES)
+      return "_PersonNamePartAffixTypes";
+    if (code == V3EntityNamePartQualifier._PERSONNAMEPARTCHANGEQUALIFIER)
+      return "_PersonNamePartChangeQualifier";
+    if (code == V3EntityNamePartQualifier._PERSONNAMEPARTMISCQUALIFIER)
+      return "_PersonNamePartMiscQualifier";
+    return "?";
+  }
+
+    public String toSystem(V3EntityNamePartQualifier code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifierR2.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifierR2.java
new file mode 100644
index 00000000000..2e2634ccc98
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifierR2.java
@@ -0,0 +1,435 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityNamePartQualifierR2 {
+
+        /**
+         * Description:A name part a person acquired.  The name part may be acquired by adoption, or the person may have chosen to use the name part for some other reason.
+
+                        
+                           Note: this differs from an Other/Psuedonym/Alias in that an acquired name part is acquired on a formal basis rather than an informal one (e.g. registered as part of the official name).
+         */
+        AD, 
+        /**
+         * Description:The name assumed from the partner in a marital relationship.  Usually the spouse's family name.  Note that no inference about gender can be made from the existence of spouse names.
+         */
+        SP, 
+        /**
+         * Description:A name that a person was given at birth or established as a consequence of adoption. 
+
+                        
+                           Note: This is not used for temporary names assigned at birth such as "Baby of Smith" a" which is just a name with a use code of "TEMP".
+         */
+        BR, 
+        /**
+         * Description:Used to indicate which of the various name parts is used when interacting with the person.
+         */
+        CL, 
+        /**
+         * Description:Indicates that a name part is just an initial.  Initials do not imply a trailing period since this would not work with non-Latin scripts.  In some languages, initials may consist of more than one letter, e.g., "Ph" could stand for "Philippe" or "Th" For "Thomas".
+         */
+        IN, 
+        /**
+         * Description:For organizations a suffix indicating the legal status, e.g., "Inc.", "Co.", "AG", "GmbH", "B.V." "S.A.", "Ltd." etc.
+         */
+        LS, 
+        /**
+         * Description:Indicates that the name part is a middle name.
+
+                        
+                           Usage Notes: In general, the english "middle name" concept is all of the given names after the first. This qualifier may be used to explicitly indicate which given names are considered to be middle names. The middle name qualifier may also be used with family names. This is a Scandinavian use case, matching the concept of "mellomnavn","mellannamn". Note that there are specific rules that indicate what names may be taken as a mellannamn in different Scandinavian countries.
+         */
+        MID, 
+        /**
+         * Description:A prefix has a strong association to the immediately following name part. A prefix has no implicit trailing white space (it has implicit leading white space though).
+         */
+        PFX, 
+        /**
+         * Description: Medication Name Parts are a means of specifying a range of acceptable "official" forms of the name of a product.  They are used as patterns against which input name strings may be matched for automatic identification of products from input text reports.   While they cover the concepts held under "doseForm" or "route" or "strength" the name parts are not the same and do not fit into a controlled vocabulary in the same way. By specifying up to 8 name parts a much larger range of possible names can be generated.
+         */
+        PHARMACEUTICALENTITYNAMEPARTQUALIFIERS, 
+        /**
+         * Description: This refers to the container if present in the medicinal product name.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): pre-filled syringe
+         */
+        CON, 
+        /**
+         * Description: This refers to the qualifiers in the name for devices and is at the moment mainly applicable to insulins and inhalation products.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              For the medicinal product Actrapid FlexPen 100 IU/ml Solution for injection Subcutaneous use: FlexPen.
+         */
+        DEV, 
+        /**
+         * Description: This refers to a flavor of the medicinal product if present in the medicinal product name.
+
+                        
+                           Examples:
+                        
+
+                        
+                           For 'CoughCure Linctus Orange Flavor', the flavor part is "Orange"
+                           For 'Wonderdrug Syrup Cherry Flavor', the flavor part is "Cherry"
+         */
+        FLAV, 
+        /**
+         * Description: This refers to the formulation of the medicinal product if present in the medicinal product name.
+
+                        
+                           Examples:
+                        
+
+                        
+                           For 'SpecialMed Sugar Free Cough Syrup', the formulation name part is "Sugar Free"
+                           For 'QuickCure Gluten-free Bulk Fibre', the formulation name part is "gluten-free"
+         */
+        FORMUL, 
+        /**
+         * Description: This refers to the pharmaceutical form/ if present in the medicinal product name.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              For Agenerase 50 mg soft capsules: Soft Capsules
+
+                           
+                           
+                              For Ludiomil 25mg-Filmtabletten: Filmtabletten
+
+                           
+                           
+                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): suspension for injection
+         */
+        FRM, 
+        /**
+         * Description: This refers to the product name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name and, if appropriate, whether it is intended e.g. for babies, children or adults. 
+
+                        EXAMPLES: 
+
+                        
+                           
+                              Agenerase
+
+                           
+                           
+                              Optaflu
+
+                           
+                           
+                              Ludiomil
+         */
+        INV, 
+        /**
+         * Description: This refers to the target population for the medicinal product if present in the medicinal product name
+
+                        
+                           Examples:
+                        
+
+                        
+                           For 'Broncho-Drug 3.5 mg-capsules for children', the target population part is "children"
+                           For 'Adult Chesty Cough Syrup', the target population part is "adult"
+         */
+        POPUL, 
+        /**
+         * Description: This refers to the product common or scientific name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              For Agenerase: N/A
+
+                           
+                           
+                              For Optaflu: Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season)
+
+                           
+                           
+                              For Ludiomil: N/A
+         */
+        SCI, 
+        /**
+         * Description: This refers to the strength if present in the medicinal product name. The use of decimal points should be accommodated if required.
+
+                        EXAMPLES:
+
+                        
+                           
+                              For Agenerase 50 mg soft capsules: 50mg
+
+                           
+                           
+                              For Ludiomil 25mg-Filmtabletten: 25 mg
+
+                           
+                           
+                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): N/A
+         */
+        STR, 
+        /**
+         * Description: This refers to a time or time period that may be specified in the text of the medicinal product name
+
+                        
+                           Example:
+                        
+
+                        
+                           For an influenza vaccine 'Drug-FLU season 2008/2009', the time/period part is "2008/2009 season"
+         */
+        TIME, 
+        /**
+         * Description: This refers to trademark/company element if present in the medicinal product name.
+
+                        EXAMPLES: 
+
+                        
+                           
+                              for Insulin Human Winthrop Comb 15: Winthrop
+         */
+        TMK, 
+        /**
+         * Description: This refers to the intended use if present in the medicinal product name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name.
+
+
+                        
+                           Examples:
+                        
+
+                        
+                           For 'Drug-BI Caplets - Heartburn Relief', the intended use part is: "Heartburn Relief"
+                           For 'Medicine Honey Syrup for Soothing Coughs' the intended use part is "Soothing Coughs"
+         */
+        USE, 
+        /**
+         * Description:A suffix has a strong association to the immediately preceding name part. A suffix has no implicit leading white space (it has implicit trailing white space though).
+         */
+        SFX, 
+        /**
+         * Description:Extra information about the style of a title
+         */
+        TITLESTYLES, 
+        /**
+         * Description:Indicates that a title like "Dr.", "M.D." or "Ph.D." is an academic title.
+         */
+        AC, 
+        /**
+         * Description:A honorific such as "The Right Honourable" or "Weledelgeleerde Heer".
+         */
+        HON, 
+        /**
+         * Description:A nobility title such as Sir, Count, Grafin.
+         */
+        NB, 
+        /**
+         * Description:Primarily in the British Imperial culture people tend to have an abbreviation of their professional organization as part of their credential titles.
+         */
+        PR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityNamePartQualifierR2 fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AD".equals(codeString))
+          return AD;
+        if ("SP".equals(codeString))
+          return SP;
+        if ("BR".equals(codeString))
+          return BR;
+        if ("CL".equals(codeString))
+          return CL;
+        if ("IN".equals(codeString))
+          return IN;
+        if ("LS".equals(codeString))
+          return LS;
+        if ("MID".equals(codeString))
+          return MID;
+        if ("PFX".equals(codeString))
+          return PFX;
+        if ("PharmaceuticalEntityNamePartQualifiers".equals(codeString))
+          return PHARMACEUTICALENTITYNAMEPARTQUALIFIERS;
+        if ("CON".equals(codeString))
+          return CON;
+        if ("DEV".equals(codeString))
+          return DEV;
+        if ("FLAV".equals(codeString))
+          return FLAV;
+        if ("FORMUL".equals(codeString))
+          return FORMUL;
+        if ("FRM".equals(codeString))
+          return FRM;
+        if ("INV".equals(codeString))
+          return INV;
+        if ("POPUL".equals(codeString))
+          return POPUL;
+        if ("SCI".equals(codeString))
+          return SCI;
+        if ("STR".equals(codeString))
+          return STR;
+        if ("TIME".equals(codeString))
+          return TIME;
+        if ("TMK".equals(codeString))
+          return TMK;
+        if ("USE".equals(codeString))
+          return USE;
+        if ("SFX".equals(codeString))
+          return SFX;
+        if ("TitleStyles".equals(codeString))
+          return TITLESTYLES;
+        if ("AC".equals(codeString))
+          return AC;
+        if ("HON".equals(codeString))
+          return HON;
+        if ("NB".equals(codeString))
+          return NB;
+        if ("PR".equals(codeString))
+          return PR;
+        throw new FHIRException("Unknown V3EntityNamePartQualifierR2 code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AD: return "AD";
+            case SP: return "SP";
+            case BR: return "BR";
+            case CL: return "CL";
+            case IN: return "IN";
+            case LS: return "LS";
+            case MID: return "MID";
+            case PFX: return "PFX";
+            case PHARMACEUTICALENTITYNAMEPARTQUALIFIERS: return "PharmaceuticalEntityNamePartQualifiers";
+            case CON: return "CON";
+            case DEV: return "DEV";
+            case FLAV: return "FLAV";
+            case FORMUL: return "FORMUL";
+            case FRM: return "FRM";
+            case INV: return "INV";
+            case POPUL: return "POPUL";
+            case SCI: return "SCI";
+            case STR: return "STR";
+            case TIME: return "TIME";
+            case TMK: return "TMK";
+            case USE: return "USE";
+            case SFX: return "SFX";
+            case TITLESTYLES: return "TitleStyles";
+            case AC: return "AC";
+            case HON: return "HON";
+            case NB: return "NB";
+            case PR: return "PR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityNamePartQualifierR2";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AD: return "Description:A name part a person acquired.  The name part may be acquired by adoption, or the person may have chosen to use the name part for some other reason.\r\n\n                        \n                           Note: this differs from an Other/Psuedonym/Alias in that an acquired name part is acquired on a formal basis rather than an informal one (e.g. registered as part of the official name).";
+            case SP: return "Description:The name assumed from the partner in a marital relationship.  Usually the spouse's family name.  Note that no inference about gender can be made from the existence of spouse names.";
+            case BR: return "Description:A name that a person was given at birth or established as a consequence of adoption. \r\n\n                        \n                           Note: This is not used for temporary names assigned at birth such as \"Baby of Smith\" a\" which is just a name with a use code of \"TEMP\".";
+            case CL: return "Description:Used to indicate which of the various name parts is used when interacting with the person.";
+            case IN: return "Description:Indicates that a name part is just an initial.  Initials do not imply a trailing period since this would not work with non-Latin scripts.  In some languages, initials may consist of more than one letter, e.g., \"Ph\" could stand for \"Philippe\" or \"Th\" For \"Thomas\".";
+            case LS: return "Description:For organizations a suffix indicating the legal status, e.g., \"Inc.\", \"Co.\", \"AG\", \"GmbH\", \"B.V.\" \"S.A.\", \"Ltd.\" etc.";
+            case MID: return "Description:Indicates that the name part is a middle name.\r\n\n                        \n                           Usage Notes: In general, the english \"middle name\" concept is all of the given names after the first. This qualifier may be used to explicitly indicate which given names are considered to be middle names. The middle name qualifier may also be used with family names. This is a Scandinavian use case, matching the concept of \"mellomnavn\",\"mellannamn\". Note that there are specific rules that indicate what names may be taken as a mellannamn in different Scandinavian countries.";
+            case PFX: return "Description:A prefix has a strong association to the immediately following name part. A prefix has no implicit trailing white space (it has implicit leading white space though).";
+            case PHARMACEUTICALENTITYNAMEPARTQUALIFIERS: return "Description: Medication Name Parts are a means of specifying a range of acceptable \"official\" forms of the name of a product.  They are used as patterns against which input name strings may be matched for automatic identification of products from input text reports.   While they cover the concepts held under \"doseForm\" or \"route\" or \"strength\" the name parts are not the same and do not fit into a controlled vocabulary in the same way. By specifying up to 8 name parts a much larger range of possible names can be generated.";
+            case CON: return "Description: This refers to the container if present in the medicinal product name.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): pre-filled syringe";
+            case DEV: return "Description: This refers to the qualifiers in the name for devices and is at the moment mainly applicable to insulins and inhalation products.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              For the medicinal product Actrapid FlexPen 100 IU/ml Solution for injection Subcutaneous use: FlexPen.";
+            case FLAV: return "Description: This refers to a flavor of the medicinal product if present in the medicinal product name.\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           For 'CoughCure Linctus Orange Flavor', the flavor part is \"Orange\"\n                           For 'Wonderdrug Syrup Cherry Flavor', the flavor part is \"Cherry\"";
+            case FORMUL: return "Description: This refers to the formulation of the medicinal product if present in the medicinal product name.\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           For 'SpecialMed Sugar Free Cough Syrup', the formulation name part is \"Sugar Free\"\n                           For 'QuickCure Gluten-free Bulk Fibre', the formulation name part is \"gluten-free\"";
+            case FRM: return "Description: This refers to the pharmaceutical form/ if present in the medicinal product name.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              For Agenerase 50 mg soft capsules: Soft Capsules\r\n\n                           \n                           \n                              For Ludiomil 25mg-Filmtabletten: Filmtabletten\r\n\n                           \n                           \n                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): suspension for injection";
+            case INV: return "Description: This refers to the product name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name and, if appropriate, whether it is intended e.g. for babies, children or adults. \r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              Agenerase\r\n\n                           \n                           \n                              Optaflu\r\n\n                           \n                           \n                              Ludiomil";
+            case POPUL: return "Description: This refers to the target population for the medicinal product if present in the medicinal product name\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           For 'Broncho-Drug 3.5 mg-capsules for children', the target population part is \"children\"\n                           For 'Adult Chesty Cough Syrup', the target population part is \"adult\"";
+            case SCI: return "Description: This refers to the product common or scientific name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              For Agenerase: N/A\r\n\n                           \n                           \n                              For Optaflu: Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season)\r\n\n                           \n                           \n                              For Ludiomil: N/A";
+            case STR: return "Description: This refers to the strength if present in the medicinal product name. The use of decimal points should be accommodated if required.\r\n\n                        EXAMPLES:\r\n\n                        \n                           \n                              For Agenerase 50 mg soft capsules: 50mg\r\n\n                           \n                           \n                              For Ludiomil 25mg-Filmtabletten: 25 mg\r\n\n                           \n                           \n                              For Optaflu suspension for injection in pre-filled syringe Influenza vaccine (surface antigen, inactivated, prepared in cell culture) (2007/2008 season): N/A";
+            case TIME: return "Description: This refers to a time or time period that may be specified in the text of the medicinal product name\r\n\n                        \n                           Example:\n                        \r\n\n                        \n                           For an influenza vaccine 'Drug-FLU season 2008/2009', the time/period part is \"2008/2009 season\"";
+            case TMK: return "Description: This refers to trademark/company element if present in the medicinal product name.\r\n\n                        EXAMPLES: \r\n\n                        \n                           \n                              for Insulin Human Winthrop Comb 15: Winthrop";
+            case USE: return "Description: This refers to the intended use if present in the medicinal product name without the trademark or the name of the marketing authorization holder or any other descriptor reflected in the product name.\n\r\n\n                        \n                           Examples:\n                        \r\n\n                        \n                           For 'Drug-BI Caplets - Heartburn Relief', the intended use part is: \"Heartburn Relief\"\n                           For 'Medicine Honey Syrup for Soothing Coughs' the intended use part is \"Soothing Coughs\"";
+            case SFX: return "Description:A suffix has a strong association to the immediately preceding name part. A suffix has no implicit leading white space (it has implicit trailing white space though).";
+            case TITLESTYLES: return "Description:Extra information about the style of a title";
+            case AC: return "Description:Indicates that a title like \"Dr.\", \"M.D.\" or \"Ph.D.\" is an academic title.";
+            case HON: return "Description:A honorific such as \"The Right Honourable\" or \"Weledelgeleerde Heer\".";
+            case NB: return "Description:A nobility title such as Sir, Count, Grafin.";
+            case PR: return "Description:Primarily in the British Imperial culture people tend to have an abbreviation of their professional organization as part of their credential titles.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AD: return "acquired";
+            case SP: return "spouse";
+            case BR: return "birth";
+            case CL: return "callme";
+            case IN: return "initial";
+            case LS: return "legal status";
+            case MID: return "middle name";
+            case PFX: return "prefix";
+            case PHARMACEUTICALENTITYNAMEPARTQUALIFIERS: return "PharmaceuticalEntityNamePartQualifiers";
+            case CON: return "container name";
+            case DEV: return "device name";
+            case FLAV: return "FlavorName";
+            case FORMUL: return "FormulationPartName";
+            case FRM: return "form name";
+            case INV: return "invented name";
+            case POPUL: return "TargetPopulationName";
+            case SCI: return "scientific name";
+            case STR: return "strength name";
+            case TIME: return "TimeOrPeriodName";
+            case TMK: return "trademark name";
+            case USE: return "intended use name";
+            case SFX: return "suffix";
+            case TITLESTYLES: return "TitleStyles";
+            case AC: return "academic";
+            case HON: return "honorific";
+            case NB: return "nobility";
+            case PR: return "professional";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifierR2EnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifierR2EnumFactory.java
new file mode 100644
index 00000000000..4e3579f889e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartQualifierR2EnumFactory.java
@@ -0,0 +1,162 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityNamePartQualifierR2EnumFactory implements EnumFactory {
+
+  public V3EntityNamePartQualifierR2 fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AD".equals(codeString))
+      return V3EntityNamePartQualifierR2.AD;
+    if ("SP".equals(codeString))
+      return V3EntityNamePartQualifierR2.SP;
+    if ("BR".equals(codeString))
+      return V3EntityNamePartQualifierR2.BR;
+    if ("CL".equals(codeString))
+      return V3EntityNamePartQualifierR2.CL;
+    if ("IN".equals(codeString))
+      return V3EntityNamePartQualifierR2.IN;
+    if ("LS".equals(codeString))
+      return V3EntityNamePartQualifierR2.LS;
+    if ("MID".equals(codeString))
+      return V3EntityNamePartQualifierR2.MID;
+    if ("PFX".equals(codeString))
+      return V3EntityNamePartQualifierR2.PFX;
+    if ("PharmaceuticalEntityNamePartQualifiers".equals(codeString))
+      return V3EntityNamePartQualifierR2.PHARMACEUTICALENTITYNAMEPARTQUALIFIERS;
+    if ("CON".equals(codeString))
+      return V3EntityNamePartQualifierR2.CON;
+    if ("DEV".equals(codeString))
+      return V3EntityNamePartQualifierR2.DEV;
+    if ("FLAV".equals(codeString))
+      return V3EntityNamePartQualifierR2.FLAV;
+    if ("FORMUL".equals(codeString))
+      return V3EntityNamePartQualifierR2.FORMUL;
+    if ("FRM".equals(codeString))
+      return V3EntityNamePartQualifierR2.FRM;
+    if ("INV".equals(codeString))
+      return V3EntityNamePartQualifierR2.INV;
+    if ("POPUL".equals(codeString))
+      return V3EntityNamePartQualifierR2.POPUL;
+    if ("SCI".equals(codeString))
+      return V3EntityNamePartQualifierR2.SCI;
+    if ("STR".equals(codeString))
+      return V3EntityNamePartQualifierR2.STR;
+    if ("TIME".equals(codeString))
+      return V3EntityNamePartQualifierR2.TIME;
+    if ("TMK".equals(codeString))
+      return V3EntityNamePartQualifierR2.TMK;
+    if ("USE".equals(codeString))
+      return V3EntityNamePartQualifierR2.USE;
+    if ("SFX".equals(codeString))
+      return V3EntityNamePartQualifierR2.SFX;
+    if ("TitleStyles".equals(codeString))
+      return V3EntityNamePartQualifierR2.TITLESTYLES;
+    if ("AC".equals(codeString))
+      return V3EntityNamePartQualifierR2.AC;
+    if ("HON".equals(codeString))
+      return V3EntityNamePartQualifierR2.HON;
+    if ("NB".equals(codeString))
+      return V3EntityNamePartQualifierR2.NB;
+    if ("PR".equals(codeString))
+      return V3EntityNamePartQualifierR2.PR;
+    throw new IllegalArgumentException("Unknown V3EntityNamePartQualifierR2 code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityNamePartQualifierR2 code) {
+    if (code == V3EntityNamePartQualifierR2.AD)
+      return "AD";
+    if (code == V3EntityNamePartQualifierR2.SP)
+      return "SP";
+    if (code == V3EntityNamePartQualifierR2.BR)
+      return "BR";
+    if (code == V3EntityNamePartQualifierR2.CL)
+      return "CL";
+    if (code == V3EntityNamePartQualifierR2.IN)
+      return "IN";
+    if (code == V3EntityNamePartQualifierR2.LS)
+      return "LS";
+    if (code == V3EntityNamePartQualifierR2.MID)
+      return "MID";
+    if (code == V3EntityNamePartQualifierR2.PFX)
+      return "PFX";
+    if (code == V3EntityNamePartQualifierR2.PHARMACEUTICALENTITYNAMEPARTQUALIFIERS)
+      return "PharmaceuticalEntityNamePartQualifiers";
+    if (code == V3EntityNamePartQualifierR2.CON)
+      return "CON";
+    if (code == V3EntityNamePartQualifierR2.DEV)
+      return "DEV";
+    if (code == V3EntityNamePartQualifierR2.FLAV)
+      return "FLAV";
+    if (code == V3EntityNamePartQualifierR2.FORMUL)
+      return "FORMUL";
+    if (code == V3EntityNamePartQualifierR2.FRM)
+      return "FRM";
+    if (code == V3EntityNamePartQualifierR2.INV)
+      return "INV";
+    if (code == V3EntityNamePartQualifierR2.POPUL)
+      return "POPUL";
+    if (code == V3EntityNamePartQualifierR2.SCI)
+      return "SCI";
+    if (code == V3EntityNamePartQualifierR2.STR)
+      return "STR";
+    if (code == V3EntityNamePartQualifierR2.TIME)
+      return "TIME";
+    if (code == V3EntityNamePartQualifierR2.TMK)
+      return "TMK";
+    if (code == V3EntityNamePartQualifierR2.USE)
+      return "USE";
+    if (code == V3EntityNamePartQualifierR2.SFX)
+      return "SFX";
+    if (code == V3EntityNamePartQualifierR2.TITLESTYLES)
+      return "TitleStyles";
+    if (code == V3EntityNamePartQualifierR2.AC)
+      return "AC";
+    if (code == V3EntityNamePartQualifierR2.HON)
+      return "HON";
+    if (code == V3EntityNamePartQualifierR2.NB)
+      return "NB";
+    if (code == V3EntityNamePartQualifierR2.PR)
+      return "PR";
+    return "?";
+  }
+
+    public String toSystem(V3EntityNamePartQualifierR2 code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartType.java
new file mode 100644
index 00000000000..0126959f047
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityNamePartType {
+
+        /**
+         * A delimiter has no meaning other than being literally printed in this name representation.  A delimiter has no implicit leading and trailing white space.
+         */
+        DEL, 
+        /**
+         * Family name, this is the name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.
+         */
+        FAM, 
+        /**
+         * Given name (don't call it "first name" since this given names do not always come first)
+         */
+        GIV, 
+        /**
+         * A prefix has a strong association to the immediately following name part. A prefix has no implicit trailing white space (it has implicit leading white space though). Note that prefixes can be inverted.
+         */
+        PFX, 
+        /**
+         * Description:A suffix has a strong association to the immediately preceding name part. A suffix has no implicit leading white space (it has implicit trailing white space though). Suffices cannot be inverted.
+         */
+        SFX, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityNamePartType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("DEL".equals(codeString))
+          return DEL;
+        if ("FAM".equals(codeString))
+          return FAM;
+        if ("GIV".equals(codeString))
+          return GIV;
+        if ("PFX".equals(codeString))
+          return PFX;
+        if ("SFX".equals(codeString))
+          return SFX;
+        throw new FHIRException("Unknown V3EntityNamePartType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DEL: return "DEL";
+            case FAM: return "FAM";
+            case GIV: return "GIV";
+            case PFX: return "PFX";
+            case SFX: return "SFX";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityNamePartType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DEL: return "A delimiter has no meaning other than being literally printed in this name representation.  A delimiter has no implicit leading and trailing white space.";
+            case FAM: return "Family name, this is the name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.";
+            case GIV: return "Given name (don't call it \"first name\" since this given names do not always come first)";
+            case PFX: return "A prefix has a strong association to the immediately following name part. A prefix has no implicit trailing white space (it has implicit leading white space though). Note that prefixes can be inverted.";
+            case SFX: return "Description:A suffix has a strong association to the immediately preceding name part. A suffix has no implicit leading white space (it has implicit trailing white space though). Suffices cannot be inverted.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DEL: return "delimiter";
+            case FAM: return "family";
+            case GIV: return "given";
+            case PFX: return "prefix";
+            case SFX: return "suffix";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartTypeEnumFactory.java
new file mode 100644
index 00000000000..cc4d8eddf45
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityNamePartTypeEnumFactory implements EnumFactory {
+
+  public V3EntityNamePartType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("DEL".equals(codeString))
+      return V3EntityNamePartType.DEL;
+    if ("FAM".equals(codeString))
+      return V3EntityNamePartType.FAM;
+    if ("GIV".equals(codeString))
+      return V3EntityNamePartType.GIV;
+    if ("PFX".equals(codeString))
+      return V3EntityNamePartType.PFX;
+    if ("SFX".equals(codeString))
+      return V3EntityNamePartType.SFX;
+    throw new IllegalArgumentException("Unknown V3EntityNamePartType code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityNamePartType code) {
+    if (code == V3EntityNamePartType.DEL)
+      return "DEL";
+    if (code == V3EntityNamePartType.FAM)
+      return "FAM";
+    if (code == V3EntityNamePartType.GIV)
+      return "GIV";
+    if (code == V3EntityNamePartType.PFX)
+      return "PFX";
+    if (code == V3EntityNamePartType.SFX)
+      return "SFX";
+    return "?";
+  }
+
+    public String toSystem(V3EntityNamePartType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartTypeR2.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartTypeR2.java
new file mode 100644
index 00000000000..0cc44e7c0b6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartTypeR2.java
@@ -0,0 +1,108 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityNamePartTypeR2 {
+
+        /**
+         * Description:A delimiter has no meaning other than being literally printed in this name representation. A delimiter has no implicit leading and trailing white space.
+         */
+        DEL, 
+        /**
+         * Description:Family name, this is the name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.
+         */
+        FAM, 
+        /**
+         * Description:Given name. Note: don't call it "first name" since the given names do not always come first.
+         */
+        GIV, 
+        /**
+         * Description:Part of the name that is acquired as a title due to academic, legal, employment or nobility status etc.
+
+                        
+                           Note:Title name parts include name parts that come after the name such as qualifications, even if they are not always considered to be titles.
+         */
+        TITLE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityNamePartTypeR2 fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("DEL".equals(codeString))
+          return DEL;
+        if ("FAM".equals(codeString))
+          return FAM;
+        if ("GIV".equals(codeString))
+          return GIV;
+        if ("TITLE".equals(codeString))
+          return TITLE;
+        throw new FHIRException("Unknown V3EntityNamePartTypeR2 code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DEL: return "DEL";
+            case FAM: return "FAM";
+            case GIV: return "GIV";
+            case TITLE: return "TITLE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityNamePartTypeR2";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DEL: return "Description:A delimiter has no meaning other than being literally printed in this name representation. A delimiter has no implicit leading and trailing white space.";
+            case FAM: return "Description:Family name, this is the name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.";
+            case GIV: return "Description:Given name. Note: don't call it \"first name\" since the given names do not always come first.";
+            case TITLE: return "Description:Part of the name that is acquired as a title due to academic, legal, employment or nobility status etc.\r\n\n                        \n                           Note:Title name parts include name parts that come after the name such as qualifications, even if they are not always considered to be titles.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DEL: return "delimiter";
+            case FAM: return "family";
+            case GIV: return "given";
+            case TITLE: return "title";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartTypeR2EnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartTypeR2EnumFactory.java
new file mode 100644
index 00000000000..ebeeddd7221
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNamePartTypeR2EnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityNamePartTypeR2EnumFactory implements EnumFactory {
+
+  public V3EntityNamePartTypeR2 fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("DEL".equals(codeString))
+      return V3EntityNamePartTypeR2.DEL;
+    if ("FAM".equals(codeString))
+      return V3EntityNamePartTypeR2.FAM;
+    if ("GIV".equals(codeString))
+      return V3EntityNamePartTypeR2.GIV;
+    if ("TITLE".equals(codeString))
+      return V3EntityNamePartTypeR2.TITLE;
+    throw new IllegalArgumentException("Unknown V3EntityNamePartTypeR2 code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityNamePartTypeR2 code) {
+    if (code == V3EntityNamePartTypeR2.DEL)
+      return "DEL";
+    if (code == V3EntityNamePartTypeR2.FAM)
+      return "FAM";
+    if (code == V3EntityNamePartTypeR2.GIV)
+      return "GIV";
+    if (code == V3EntityNamePartTypeR2.TITLE)
+      return "TITLE";
+    return "?";
+  }
+
+    public String toSystem(V3EntityNamePartTypeR2 code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUse.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUse.java
new file mode 100644
index 00000000000..57a88da065d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUse.java
@@ -0,0 +1,206 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityNameUse {
+
+        /**
+         * Identifies the different representations of a name.  The representation may affect how the name is used.  (E.g. use of Ideographic for formal communications.)
+         */
+        _NAMEREPRESENTATIONUSE, 
+        /**
+         * Alphabetic transcription of name (Japanese: romaji)
+         */
+        ABC, 
+        /**
+         * Ideographic representation of name (e.g., Japanese kanji, Chinese characters)
+         */
+        IDE, 
+        /**
+         * Syllabic transcription of name (e.g., Japanese kana, Korean hangul)
+         */
+        SYL, 
+        /**
+         * A name assigned to a person. Reasons some organizations assign alternate names may include not knowing the person's name, or to maintain anonymity. Some, but not necessarily all, of the name types that people call "alias" may fit into this category.
+         */
+        ASGN, 
+        /**
+         * As recorded on a license, record, certificate, etc. (only if different from legal name)
+         */
+        C, 
+        /**
+         * e.g. Chief Red Cloud
+         */
+        I, 
+        /**
+         * Known as/conventional/the one you use
+         */
+        L, 
+        /**
+         * Definition:The formal name as registered in an official (government) registry, but which name might not be commonly used. Particularly used in countries with a law system based on Napoleonic law.
+         */
+        OR, 
+        /**
+         * A self asserted name that the person is using or has used.
+         */
+        P, 
+        /**
+         * Includes writer's pseudonym, stage name, etc
+         */
+        A, 
+        /**
+         * e.g. Sister Mary Francis, Brother John
+         */
+        R, 
+        /**
+         * A name intended for use in searching or matching.
+         */
+        SRCH, 
+        /**
+         * A name spelled phonetically.
+
+                        There are a variety of phonetic spelling algorithms. This code value does not distinguish between these.Discussion:
+         */
+        PHON, 
+        /**
+         * A name spelled according to the SoundEx algorithm.
+         */
+        SNDX, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityNameUse fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_NameRepresentationUse".equals(codeString))
+          return _NAMEREPRESENTATIONUSE;
+        if ("ABC".equals(codeString))
+          return ABC;
+        if ("IDE".equals(codeString))
+          return IDE;
+        if ("SYL".equals(codeString))
+          return SYL;
+        if ("ASGN".equals(codeString))
+          return ASGN;
+        if ("C".equals(codeString))
+          return C;
+        if ("I".equals(codeString))
+          return I;
+        if ("L".equals(codeString))
+          return L;
+        if ("OR".equals(codeString))
+          return OR;
+        if ("P".equals(codeString))
+          return P;
+        if ("A".equals(codeString))
+          return A;
+        if ("R".equals(codeString))
+          return R;
+        if ("SRCH".equals(codeString))
+          return SRCH;
+        if ("PHON".equals(codeString))
+          return PHON;
+        if ("SNDX".equals(codeString))
+          return SNDX;
+        throw new FHIRException("Unknown V3EntityNameUse code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _NAMEREPRESENTATIONUSE: return "_NameRepresentationUse";
+            case ABC: return "ABC";
+            case IDE: return "IDE";
+            case SYL: return "SYL";
+            case ASGN: return "ASGN";
+            case C: return "C";
+            case I: return "I";
+            case L: return "L";
+            case OR: return "OR";
+            case P: return "P";
+            case A: return "A";
+            case R: return "R";
+            case SRCH: return "SRCH";
+            case PHON: return "PHON";
+            case SNDX: return "SNDX";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityNameUse";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _NAMEREPRESENTATIONUSE: return "Identifies the different representations of a name.  The representation may affect how the name is used.  (E.g. use of Ideographic for formal communications.)";
+            case ABC: return "Alphabetic transcription of name (Japanese: romaji)";
+            case IDE: return "Ideographic representation of name (e.g., Japanese kanji, Chinese characters)";
+            case SYL: return "Syllabic transcription of name (e.g., Japanese kana, Korean hangul)";
+            case ASGN: return "A name assigned to a person. Reasons some organizations assign alternate names may include not knowing the person's name, or to maintain anonymity. Some, but not necessarily all, of the name types that people call \"alias\" may fit into this category.";
+            case C: return "As recorded on a license, record, certificate, etc. (only if different from legal name)";
+            case I: return "e.g. Chief Red Cloud";
+            case L: return "Known as/conventional/the one you use";
+            case OR: return "Definition:The formal name as registered in an official (government) registry, but which name might not be commonly used. Particularly used in countries with a law system based on Napoleonic law.";
+            case P: return "A self asserted name that the person is using or has used.";
+            case A: return "Includes writer's pseudonym, stage name, etc";
+            case R: return "e.g. Sister Mary Francis, Brother John";
+            case SRCH: return "A name intended for use in searching or matching.";
+            case PHON: return "A name spelled phonetically.\r\n\n                        There are a variety of phonetic spelling algorithms. This code value does not distinguish between these.Discussion:";
+            case SNDX: return "A name spelled according to the SoundEx algorithm.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _NAMEREPRESENTATIONUSE: return "NameRepresentationUse";
+            case ABC: return "Alphabetic";
+            case IDE: return "Ideographic";
+            case SYL: return "Syllabic";
+            case ASGN: return "assigned";
+            case C: return "License";
+            case I: return "Indigenous/Tribal";
+            case L: return "Legal";
+            case OR: return "official registry";
+            case P: return "pseudonym";
+            case A: return "Artist/Stage";
+            case R: return "Religious";
+            case SRCH: return "search";
+            case PHON: return "phonetic";
+            case SNDX: return "Soundex";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUseEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUseEnumFactory.java
new file mode 100644
index 00000000000..66c0a871c87
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUseEnumFactory.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityNameUseEnumFactory implements EnumFactory {
+
+  public V3EntityNameUse fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_NameRepresentationUse".equals(codeString))
+      return V3EntityNameUse._NAMEREPRESENTATIONUSE;
+    if ("ABC".equals(codeString))
+      return V3EntityNameUse.ABC;
+    if ("IDE".equals(codeString))
+      return V3EntityNameUse.IDE;
+    if ("SYL".equals(codeString))
+      return V3EntityNameUse.SYL;
+    if ("ASGN".equals(codeString))
+      return V3EntityNameUse.ASGN;
+    if ("C".equals(codeString))
+      return V3EntityNameUse.C;
+    if ("I".equals(codeString))
+      return V3EntityNameUse.I;
+    if ("L".equals(codeString))
+      return V3EntityNameUse.L;
+    if ("OR".equals(codeString))
+      return V3EntityNameUse.OR;
+    if ("P".equals(codeString))
+      return V3EntityNameUse.P;
+    if ("A".equals(codeString))
+      return V3EntityNameUse.A;
+    if ("R".equals(codeString))
+      return V3EntityNameUse.R;
+    if ("SRCH".equals(codeString))
+      return V3EntityNameUse.SRCH;
+    if ("PHON".equals(codeString))
+      return V3EntityNameUse.PHON;
+    if ("SNDX".equals(codeString))
+      return V3EntityNameUse.SNDX;
+    throw new IllegalArgumentException("Unknown V3EntityNameUse code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityNameUse code) {
+    if (code == V3EntityNameUse._NAMEREPRESENTATIONUSE)
+      return "_NameRepresentationUse";
+    if (code == V3EntityNameUse.ABC)
+      return "ABC";
+    if (code == V3EntityNameUse.IDE)
+      return "IDE";
+    if (code == V3EntityNameUse.SYL)
+      return "SYL";
+    if (code == V3EntityNameUse.ASGN)
+      return "ASGN";
+    if (code == V3EntityNameUse.C)
+      return "C";
+    if (code == V3EntityNameUse.I)
+      return "I";
+    if (code == V3EntityNameUse.L)
+      return "L";
+    if (code == V3EntityNameUse.OR)
+      return "OR";
+    if (code == V3EntityNameUse.P)
+      return "P";
+    if (code == V3EntityNameUse.A)
+      return "A";
+    if (code == V3EntityNameUse.R)
+      return "R";
+    if (code == V3EntityNameUse.SRCH)
+      return "SRCH";
+    if (code == V3EntityNameUse.PHON)
+      return "PHON";
+    if (code == V3EntityNameUse.SNDX)
+      return "SNDX";
+    return "?";
+  }
+
+    public String toSystem(V3EntityNameUse code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUseR2.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUseR2.java
new file mode 100644
index 00000000000..ad710df96aa
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUseR2.java
@@ -0,0 +1,231 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityNameUseR2 {
+
+        /**
+         * Description:A name that a person has assumed or has been assumed to them.
+         */
+        ASSUMED, 
+        /**
+         * Description:A name used in a Professional or Business context .  Examples: Continuing to use a maiden name in a professional context, or using a stage performing name (some of these names are also pseudonyms)
+         */
+        A, 
+        /**
+         * Description:Anonymous assigned name (used to protect a persons identity for privacy reasons)
+         */
+        ANON, 
+        /**
+         * Description:e.g .  Chief Red Cloud
+         */
+        I, 
+        /**
+         * Description:A non-official name by which the person is sometimes known.  (This may also be used to record informal names such as a nickname)
+         */
+        P, 
+        /**
+         * Description:A name assumed as part of a religious vocation .  e.g .  Sister Mary Francis, Brother John
+         */
+        R, 
+        /**
+         * Description:Known as/conventional/the one you normally use
+         */
+        C, 
+        /**
+         * Description:A name used prior to marriage.Note that marriage naming customs vary greatly around the world.  This name use is for use by applications that collect and store maiden names.  Though the concept of maiden name is often gender specific, the use of this term is not gender specific.  The use of this term does not imply any particular history for a person's name, nor should the maiden name be determined algorithmically
+         */
+        M, 
+        /**
+         * Description:Identifies the different representations of a name .  The representation may affect how the name is used .  (E.g .  use of Ideographic for formal communications.)
+         */
+        NAMEREPRESENTATIONUSE, 
+        /**
+         * Description:Alphabetic transcription of name in latin alphabet (Japanese: romaji)
+         */
+        ABC, 
+        /**
+         * Description:Ideographic representation of name (e.g., Japanese kanji, Chinese characters)
+         */
+        IDE, 
+        /**
+         * Description:Syllabic transcription of name (e.g., Japanese kana, Korean hangul)
+         */
+        SYL, 
+        /**
+         * Description:This name is no longer in use (note: Names may also carry valid time ranges .  This code is used to cover the situations where it is known that the name is no longer valid, but no particular time range for its use is known)
+         */
+        OLD, 
+        /**
+         * Description:This name should no longer be used when interacting with the person (i.e .  in addition to no longer being used, the name should not be even mentioned when interacting with the person)Note: applications are not required to compare names labeled "Do Not Use" and other names in order to eliminate name parts that are common between the other name and a name labeled "Do Not Use".
+         */
+        DN, 
+        /**
+         * Description:The formal name as registered in an official (government) registry, but which name might not be commonly used .  May correspond to the concept of legal name
+         */
+        OR, 
+        /**
+         * Description:The name as understood by the data enterer, i.e. a close approximation of a phonetic spelling of the name, not based on a phonetic algorithm.
+         */
+        PHON, 
+        /**
+         * Description:A name intended for use in searching or matching.  This is used when the name is incomplete and contains enough details for search matching, but not enough for other uses.
+         */
+        SRCH, 
+        /**
+         * Description:A temporary name.  Note that a name valid time can provide more detailed information.  This may also be used for temporary names assigned at birth or in emergency situations.
+         */
+        T, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityNameUseR2 fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("Assumed".equals(codeString))
+          return ASSUMED;
+        if ("A".equals(codeString))
+          return A;
+        if ("ANON".equals(codeString))
+          return ANON;
+        if ("I".equals(codeString))
+          return I;
+        if ("P".equals(codeString))
+          return P;
+        if ("R".equals(codeString))
+          return R;
+        if ("C".equals(codeString))
+          return C;
+        if ("M".equals(codeString))
+          return M;
+        if ("NameRepresentationUse".equals(codeString))
+          return NAMEREPRESENTATIONUSE;
+        if ("ABC".equals(codeString))
+          return ABC;
+        if ("IDE".equals(codeString))
+          return IDE;
+        if ("SYL".equals(codeString))
+          return SYL;
+        if ("OLD".equals(codeString))
+          return OLD;
+        if ("DN".equals(codeString))
+          return DN;
+        if ("OR".equals(codeString))
+          return OR;
+        if ("PHON".equals(codeString))
+          return PHON;
+        if ("SRCH".equals(codeString))
+          return SRCH;
+        if ("T".equals(codeString))
+          return T;
+        throw new FHIRException("Unknown V3EntityNameUseR2 code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ASSUMED: return "Assumed";
+            case A: return "A";
+            case ANON: return "ANON";
+            case I: return "I";
+            case P: return "P";
+            case R: return "R";
+            case C: return "C";
+            case M: return "M";
+            case NAMEREPRESENTATIONUSE: return "NameRepresentationUse";
+            case ABC: return "ABC";
+            case IDE: return "IDE";
+            case SYL: return "SYL";
+            case OLD: return "OLD";
+            case DN: return "DN";
+            case OR: return "OR";
+            case PHON: return "PHON";
+            case SRCH: return "SRCH";
+            case T: return "T";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityNameUseR2";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ASSUMED: return "Description:A name that a person has assumed or has been assumed to them.";
+            case A: return "Description:A name used in a Professional or Business context .  Examples: Continuing to use a maiden name in a professional context, or using a stage performing name (some of these names are also pseudonyms)";
+            case ANON: return "Description:Anonymous assigned name (used to protect a persons identity for privacy reasons)";
+            case I: return "Description:e.g .  Chief Red Cloud";
+            case P: return "Description:A non-official name by which the person is sometimes known.  (This may also be used to record informal names such as a nickname)";
+            case R: return "Description:A name assumed as part of a religious vocation .  e.g .  Sister Mary Francis, Brother John";
+            case C: return "Description:Known as/conventional/the one you normally use";
+            case M: return "Description:A name used prior to marriage.Note that marriage naming customs vary greatly around the world.  This name use is for use by applications that collect and store maiden names.  Though the concept of maiden name is often gender specific, the use of this term is not gender specific.  The use of this term does not imply any particular history for a person's name, nor should the maiden name be determined algorithmically";
+            case NAMEREPRESENTATIONUSE: return "Description:Identifies the different representations of a name .  The representation may affect how the name is used .  (E.g .  use of Ideographic for formal communications.)";
+            case ABC: return "Description:Alphabetic transcription of name in latin alphabet (Japanese: romaji)";
+            case IDE: return "Description:Ideographic representation of name (e.g., Japanese kanji, Chinese characters)";
+            case SYL: return "Description:Syllabic transcription of name (e.g., Japanese kana, Korean hangul)";
+            case OLD: return "Description:This name is no longer in use (note: Names may also carry valid time ranges .  This code is used to cover the situations where it is known that the name is no longer valid, but no particular time range for its use is known)";
+            case DN: return "Description:This name should no longer be used when interacting with the person (i.e .  in addition to no longer being used, the name should not be even mentioned when interacting with the person)Note: applications are not required to compare names labeled \"Do Not Use\" and other names in order to eliminate name parts that are common between the other name and a name labeled \"Do Not Use\".";
+            case OR: return "Description:The formal name as registered in an official (government) registry, but which name might not be commonly used .  May correspond to the concept of legal name";
+            case PHON: return "Description:The name as understood by the data enterer, i.e. a close approximation of a phonetic spelling of the name, not based on a phonetic algorithm.";
+            case SRCH: return "Description:A name intended for use in searching or matching.  This is used when the name is incomplete and contains enough details for search matching, but not enough for other uses.";
+            case T: return "Description:A temporary name.  Note that a name valid time can provide more detailed information.  This may also be used for temporary names assigned at birth or in emergency situations.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ASSUMED: return "Assumed";
+            case A: return "business name";
+            case ANON: return "Anonymous";
+            case I: return "Indigenous/Tribal";
+            case P: return "Other/Pseudonym/Alias";
+            case R: return "religious";
+            case C: return "customary";
+            case M: return "maiden name";
+            case NAMEREPRESENTATIONUSE: return "NameRepresentationUse";
+            case ABC: return "alphabetic";
+            case IDE: return "ideographic";
+            case SYL: return "syllabic";
+            case OLD: return "no longer in use";
+            case DN: return "do not use";
+            case OR: return "official registry name";
+            case PHON: return "phonetic";
+            case SRCH: return "search";
+            case T: return "temporary";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUseR2EnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUseR2EnumFactory.java
new file mode 100644
index 00000000000..87e531f1d6d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityNameUseR2EnumFactory.java
@@ -0,0 +1,126 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityNameUseR2EnumFactory implements EnumFactory {
+
+  public V3EntityNameUseR2 fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("Assumed".equals(codeString))
+      return V3EntityNameUseR2.ASSUMED;
+    if ("A".equals(codeString))
+      return V3EntityNameUseR2.A;
+    if ("ANON".equals(codeString))
+      return V3EntityNameUseR2.ANON;
+    if ("I".equals(codeString))
+      return V3EntityNameUseR2.I;
+    if ("P".equals(codeString))
+      return V3EntityNameUseR2.P;
+    if ("R".equals(codeString))
+      return V3EntityNameUseR2.R;
+    if ("C".equals(codeString))
+      return V3EntityNameUseR2.C;
+    if ("M".equals(codeString))
+      return V3EntityNameUseR2.M;
+    if ("NameRepresentationUse".equals(codeString))
+      return V3EntityNameUseR2.NAMEREPRESENTATIONUSE;
+    if ("ABC".equals(codeString))
+      return V3EntityNameUseR2.ABC;
+    if ("IDE".equals(codeString))
+      return V3EntityNameUseR2.IDE;
+    if ("SYL".equals(codeString))
+      return V3EntityNameUseR2.SYL;
+    if ("OLD".equals(codeString))
+      return V3EntityNameUseR2.OLD;
+    if ("DN".equals(codeString))
+      return V3EntityNameUseR2.DN;
+    if ("OR".equals(codeString))
+      return V3EntityNameUseR2.OR;
+    if ("PHON".equals(codeString))
+      return V3EntityNameUseR2.PHON;
+    if ("SRCH".equals(codeString))
+      return V3EntityNameUseR2.SRCH;
+    if ("T".equals(codeString))
+      return V3EntityNameUseR2.T;
+    throw new IllegalArgumentException("Unknown V3EntityNameUseR2 code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityNameUseR2 code) {
+    if (code == V3EntityNameUseR2.ASSUMED)
+      return "Assumed";
+    if (code == V3EntityNameUseR2.A)
+      return "A";
+    if (code == V3EntityNameUseR2.ANON)
+      return "ANON";
+    if (code == V3EntityNameUseR2.I)
+      return "I";
+    if (code == V3EntityNameUseR2.P)
+      return "P";
+    if (code == V3EntityNameUseR2.R)
+      return "R";
+    if (code == V3EntityNameUseR2.C)
+      return "C";
+    if (code == V3EntityNameUseR2.M)
+      return "M";
+    if (code == V3EntityNameUseR2.NAMEREPRESENTATIONUSE)
+      return "NameRepresentationUse";
+    if (code == V3EntityNameUseR2.ABC)
+      return "ABC";
+    if (code == V3EntityNameUseR2.IDE)
+      return "IDE";
+    if (code == V3EntityNameUseR2.SYL)
+      return "SYL";
+    if (code == V3EntityNameUseR2.OLD)
+      return "OLD";
+    if (code == V3EntityNameUseR2.DN)
+      return "DN";
+    if (code == V3EntityNameUseR2.OR)
+      return "OR";
+    if (code == V3EntityNameUseR2.PHON)
+      return "PHON";
+    if (code == V3EntityNameUseR2.SRCH)
+      return "SRCH";
+    if (code == V3EntityNameUseR2.T)
+      return "T";
+    return "?";
+  }
+
+    public String toSystem(V3EntityNameUseR2 code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityRisk.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityRisk.java
new file mode 100644
index 00000000000..c6a72fc3293
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityRisk.java
@@ -0,0 +1,168 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityRisk {
+
+        /**
+         * A danger that can be associated with certain living subjects, including humans.
+         */
+        AGG, 
+        /**
+         * The dangers associated with normal biological materials. I.e. potential risk of unknown infections.  Routine biological materials from living subjects.
+         */
+        BIO, 
+        /**
+         * Material is corrosive and may cause severe injury to skin, mucous membranes and eyes. Avoid any unprotected contact.
+         */
+        COR, 
+        /**
+         * The entity is at risk for escaping from containment or control.
+         */
+        ESC, 
+        /**
+         * Material is highly inflammable and in certain mixtures (with air) may lead to explosions.  Keep away from fire, sparks and excessive heat.
+         */
+        IFL, 
+        /**
+         * Material is an explosive mixture.  Keep away from fire, sparks, and heat.
+         */
+        EXP, 
+        /**
+         * Material known to be infectious with human pathogenic microorganisms.  Those who handle this material must take precautions for their protection.
+         */
+        INF, 
+        /**
+         * Material contains microorganisms that is an environmental hazard.  Must be handled with special care.
+         */
+        BHZ, 
+        /**
+         * Material is solid and sharp (e.g., cannulas).  Dispose in hard container.
+         */
+        INJ, 
+        /**
+         * Material is poisonous to humans and/or animals.  Special care must be taken to avoid incorporation, even of small amounts.
+         */
+        POI, 
+        /**
+         * Material is a source for ionizing radiation and must be handled with special care to avoid injury of those who handle it and to avoid environmental hazards.
+         */
+        RAD, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityRisk fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AGG".equals(codeString))
+          return AGG;
+        if ("BIO".equals(codeString))
+          return BIO;
+        if ("COR".equals(codeString))
+          return COR;
+        if ("ESC".equals(codeString))
+          return ESC;
+        if ("IFL".equals(codeString))
+          return IFL;
+        if ("EXP".equals(codeString))
+          return EXP;
+        if ("INF".equals(codeString))
+          return INF;
+        if ("BHZ".equals(codeString))
+          return BHZ;
+        if ("INJ".equals(codeString))
+          return INJ;
+        if ("POI".equals(codeString))
+          return POI;
+        if ("RAD".equals(codeString))
+          return RAD;
+        throw new FHIRException("Unknown V3EntityRisk code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AGG: return "AGG";
+            case BIO: return "BIO";
+            case COR: return "COR";
+            case ESC: return "ESC";
+            case IFL: return "IFL";
+            case EXP: return "EXP";
+            case INF: return "INF";
+            case BHZ: return "BHZ";
+            case INJ: return "INJ";
+            case POI: return "POI";
+            case RAD: return "RAD";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityRisk";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AGG: return "A danger that can be associated with certain living subjects, including humans.";
+            case BIO: return "The dangers associated with normal biological materials. I.e. potential risk of unknown infections.  Routine biological materials from living subjects.";
+            case COR: return "Material is corrosive and may cause severe injury to skin, mucous membranes and eyes. Avoid any unprotected contact.";
+            case ESC: return "The entity is at risk for escaping from containment or control.";
+            case IFL: return "Material is highly inflammable and in certain mixtures (with air) may lead to explosions.  Keep away from fire, sparks and excessive heat.";
+            case EXP: return "Material is an explosive mixture.  Keep away from fire, sparks, and heat.";
+            case INF: return "Material known to be infectious with human pathogenic microorganisms.  Those who handle this material must take precautions for their protection.";
+            case BHZ: return "Material contains microorganisms that is an environmental hazard.  Must be handled with special care.";
+            case INJ: return "Material is solid and sharp (e.g., cannulas).  Dispose in hard container.";
+            case POI: return "Material is poisonous to humans and/or animals.  Special care must be taken to avoid incorporation, even of small amounts.";
+            case RAD: return "Material is a source for ionizing radiation and must be handled with special care to avoid injury of those who handle it and to avoid environmental hazards.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AGG: return "aggressive";
+            case BIO: return "Biological";
+            case COR: return "Corrosive";
+            case ESC: return "Escape Risk";
+            case IFL: return "inflammable";
+            case EXP: return "explosive";
+            case INF: return "infectious";
+            case BHZ: return "biohazard";
+            case INJ: return "injury hazard";
+            case POI: return "poison";
+            case RAD: return "radioactive";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityRiskEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityRiskEnumFactory.java
new file mode 100644
index 00000000000..1ade9b18f51
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityRiskEnumFactory.java
@@ -0,0 +1,98 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityRiskEnumFactory implements EnumFactory {
+
+  public V3EntityRisk fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AGG".equals(codeString))
+      return V3EntityRisk.AGG;
+    if ("BIO".equals(codeString))
+      return V3EntityRisk.BIO;
+    if ("COR".equals(codeString))
+      return V3EntityRisk.COR;
+    if ("ESC".equals(codeString))
+      return V3EntityRisk.ESC;
+    if ("IFL".equals(codeString))
+      return V3EntityRisk.IFL;
+    if ("EXP".equals(codeString))
+      return V3EntityRisk.EXP;
+    if ("INF".equals(codeString))
+      return V3EntityRisk.INF;
+    if ("BHZ".equals(codeString))
+      return V3EntityRisk.BHZ;
+    if ("INJ".equals(codeString))
+      return V3EntityRisk.INJ;
+    if ("POI".equals(codeString))
+      return V3EntityRisk.POI;
+    if ("RAD".equals(codeString))
+      return V3EntityRisk.RAD;
+    throw new IllegalArgumentException("Unknown V3EntityRisk code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityRisk code) {
+    if (code == V3EntityRisk.AGG)
+      return "AGG";
+    if (code == V3EntityRisk.BIO)
+      return "BIO";
+    if (code == V3EntityRisk.COR)
+      return "COR";
+    if (code == V3EntityRisk.ESC)
+      return "ESC";
+    if (code == V3EntityRisk.IFL)
+      return "IFL";
+    if (code == V3EntityRisk.EXP)
+      return "EXP";
+    if (code == V3EntityRisk.INF)
+      return "INF";
+    if (code == V3EntityRisk.BHZ)
+      return "BHZ";
+    if (code == V3EntityRisk.INJ)
+      return "INJ";
+    if (code == V3EntityRisk.POI)
+      return "POI";
+    if (code == V3EntityRisk.RAD)
+      return "RAD";
+    return "?";
+  }
+
+    public String toSystem(V3EntityRisk code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityStatus.java
new file mode 100644
index 00000000000..dbd74fea241
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityStatus.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EntityStatus {
+
+        /**
+         * The 'typical' state. Excludes "nullified" which represents the termination state of an Entity record instance that was created in error.
+         */
+        NORMAL, 
+        /**
+         * The state representing the fact that the Entity record is currently active.
+         */
+        ACTIVE, 
+        /**
+         * Definition: The state representing the fact that the entity is inactive.
+         */
+        INACTIVE, 
+        /**
+         * The state representing the normal termination of an Entity record.
+         */
+        TERMINATED, 
+        /**
+         * The state representing the termination of an Entity record instance that was created in error.
+         */
+        NULLIFIED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EntityStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("normal".equals(codeString))
+          return NORMAL;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("inactive".equals(codeString))
+          return INACTIVE;
+        if ("terminated".equals(codeString))
+          return TERMINATED;
+        if ("nullified".equals(codeString))
+          return NULLIFIED;
+        throw new FHIRException("Unknown V3EntityStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case ACTIVE: return "active";
+            case INACTIVE: return "inactive";
+            case TERMINATED: return "terminated";
+            case NULLIFIED: return "nullified";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EntityStatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NORMAL: return "The 'typical' state. Excludes \"nullified\" which represents the termination state of an Entity record instance that was created in error.";
+            case ACTIVE: return "The state representing the fact that the Entity record is currently active.";
+            case INACTIVE: return "Definition: The state representing the fact that the entity is inactive.";
+            case TERMINATED: return "The state representing the normal termination of an Entity record.";
+            case NULLIFIED: return "The state representing the termination of an Entity record instance that was created in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case ACTIVE: return "active";
+            case INACTIVE: return "inactive";
+            case TERMINATED: return "terminated";
+            case NULLIFIED: return "nullified";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityStatusEnumFactory.java
new file mode 100644
index 00000000000..45444e9e7d0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EntityStatusEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EntityStatusEnumFactory implements EnumFactory {
+
+  public V3EntityStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("normal".equals(codeString))
+      return V3EntityStatus.NORMAL;
+    if ("active".equals(codeString))
+      return V3EntityStatus.ACTIVE;
+    if ("inactive".equals(codeString))
+      return V3EntityStatus.INACTIVE;
+    if ("terminated".equals(codeString))
+      return V3EntityStatus.TERMINATED;
+    if ("nullified".equals(codeString))
+      return V3EntityStatus.NULLIFIED;
+    throw new IllegalArgumentException("Unknown V3EntityStatus code '"+codeString+"'");
+  }
+
+  public String toCode(V3EntityStatus code) {
+    if (code == V3EntityStatus.NORMAL)
+      return "normal";
+    if (code == V3EntityStatus.ACTIVE)
+      return "active";
+    if (code == V3EntityStatus.INACTIVE)
+      return "inactive";
+    if (code == V3EntityStatus.TERMINATED)
+      return "terminated";
+    if (code == V3EntityStatus.NULLIFIED)
+      return "nullified";
+    return "?";
+  }
+
+    public String toSystem(V3EntityStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EquipmentAlertLevel.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EquipmentAlertLevel.java
new file mode 100644
index 00000000000..e6aeeba94c7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EquipmentAlertLevel.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3EquipmentAlertLevel {
+
+        /**
+         * Shut Down, Fix Problem and Re-init
+         */
+        C, 
+        /**
+         * No Corrective Action Needed
+         */
+        N, 
+        /**
+         * Corrective Action Required
+         */
+        S, 
+        /**
+         * Corrective Action Anticipated
+         */
+        W, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3EquipmentAlertLevel fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("C".equals(codeString))
+          return C;
+        if ("N".equals(codeString))
+          return N;
+        if ("S".equals(codeString))
+          return S;
+        if ("W".equals(codeString))
+          return W;
+        throw new FHIRException("Unknown V3EquipmentAlertLevel code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case C: return "C";
+            case N: return "N";
+            case S: return "S";
+            case W: return "W";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/EquipmentAlertLevel";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case C: return "Shut Down, Fix Problem and Re-init";
+            case N: return "No Corrective Action Needed";
+            case S: return "Corrective Action Required";
+            case W: return "Corrective Action Anticipated";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case C: return "Critical";
+            case N: return "Normal";
+            case S: return "Serious";
+            case W: return "Warning";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EquipmentAlertLevelEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EquipmentAlertLevelEnumFactory.java
new file mode 100644
index 00000000000..08ef0fe36bc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EquipmentAlertLevelEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EquipmentAlertLevelEnumFactory implements EnumFactory {
+
+  public V3EquipmentAlertLevel fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("C".equals(codeString))
+      return V3EquipmentAlertLevel.C;
+    if ("N".equals(codeString))
+      return V3EquipmentAlertLevel.N;
+    if ("S".equals(codeString))
+      return V3EquipmentAlertLevel.S;
+    if ("W".equals(codeString))
+      return V3EquipmentAlertLevel.W;
+    throw new IllegalArgumentException("Unknown V3EquipmentAlertLevel code '"+codeString+"'");
+  }
+
+  public String toCode(V3EquipmentAlertLevel code) {
+    if (code == V3EquipmentAlertLevel.C)
+      return "C";
+    if (code == V3EquipmentAlertLevel.N)
+      return "N";
+    if (code == V3EquipmentAlertLevel.S)
+      return "S";
+    if (code == V3EquipmentAlertLevel.W)
+      return "W";
+    return "?";
+  }
+
+    public String toSystem(V3EquipmentAlertLevel code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Ethnicity.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Ethnicity.java
new file mode 100644
index 00000000000..1ebb6bf37dd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Ethnicity.java
@@ -0,0 +1,456 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3Ethnicity {
+
+        /**
+         * Hispanic or Latino
+         */
+        _21352, 
+        /**
+         * Spaniard
+         */
+        _21378, 
+        /**
+         * Andalusian
+         */
+        _21386, 
+        /**
+         * Asturian
+         */
+        _21394, 
+        /**
+         * Castillian
+         */
+        _21402, 
+        /**
+         * Catalonian
+         */
+        _21410, 
+        /**
+         * Belearic Islander
+         */
+        _21428, 
+        /**
+         * Gallego
+         */
+        _21436, 
+        /**
+         * Valencian
+         */
+        _21444, 
+        /**
+         * Canarian
+         */
+        _21451, 
+        /**
+         * Spanish Basque
+         */
+        _21469, 
+        /**
+         * Mexican
+         */
+        _21485, 
+        /**
+         * Mexican American
+         */
+        _21493, 
+        /**
+         * Mexicano
+         */
+        _21501, 
+        /**
+         * Chicano
+         */
+        _21519, 
+        /**
+         * La Raza
+         */
+        _21527, 
+        /**
+         * Mexican American Indian
+         */
+        _21535, 
+        /**
+         * Central American
+         */
+        _21550, 
+        /**
+         * Costa Rican
+         */
+        _21568, 
+        /**
+         * Guatemalan
+         */
+        _21576, 
+        /**
+         * Honduran
+         */
+        _21584, 
+        /**
+         * Nicaraguan
+         */
+        _21592, 
+        /**
+         * Panamanian
+         */
+        _21600, 
+        /**
+         * Salvadoran
+         */
+        _21618, 
+        /**
+         * Central American Indian
+         */
+        _21626, 
+        /**
+         * Canal Zone
+         */
+        _21634, 
+        /**
+         * South American
+         */
+        _21659, 
+        /**
+         * Argentinean
+         */
+        _21667, 
+        /**
+         * Bolivian
+         */
+        _21675, 
+        /**
+         * Chilean
+         */
+        _21683, 
+        /**
+         * Colombian
+         */
+        _21691, 
+        /**
+         * Ecuadorian
+         */
+        _21709, 
+        /**
+         * Paraguayan
+         */
+        _21717, 
+        /**
+         * Peruvian
+         */
+        _21725, 
+        /**
+         * Uruguayan
+         */
+        _21733, 
+        /**
+         * Venezuelan
+         */
+        _21741, 
+        /**
+         * South American Indian
+         */
+        _21758, 
+        /**
+         * Criollo
+         */
+        _21766, 
+        /**
+         * Latin American
+         */
+        _21782, 
+        /**
+         * Puerto Rican
+         */
+        _21808, 
+        /**
+         * Cuban
+         */
+        _21824, 
+        /**
+         * Dominican
+         */
+        _21840, 
+        /**
+         * Note that this term remains in the table for completeness, even though within HL7, the notion of "not otherwise coded" term is deprecated.
+         */
+        _21865, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3Ethnicity fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("2135-2".equals(codeString))
+          return _21352;
+        if ("2137-8".equals(codeString))
+          return _21378;
+        if ("2138-6".equals(codeString))
+          return _21386;
+        if ("2139-4".equals(codeString))
+          return _21394;
+        if ("2140-2".equals(codeString))
+          return _21402;
+        if ("2141-0".equals(codeString))
+          return _21410;
+        if ("2142-8".equals(codeString))
+          return _21428;
+        if ("2143-6".equals(codeString))
+          return _21436;
+        if ("2144-4".equals(codeString))
+          return _21444;
+        if ("2145-1".equals(codeString))
+          return _21451;
+        if ("2146-9".equals(codeString))
+          return _21469;
+        if ("2148-5".equals(codeString))
+          return _21485;
+        if ("2149-3".equals(codeString))
+          return _21493;
+        if ("2150-1".equals(codeString))
+          return _21501;
+        if ("2151-9".equals(codeString))
+          return _21519;
+        if ("2152-7".equals(codeString))
+          return _21527;
+        if ("2153-5".equals(codeString))
+          return _21535;
+        if ("2155-0".equals(codeString))
+          return _21550;
+        if ("2156-8".equals(codeString))
+          return _21568;
+        if ("2157-6".equals(codeString))
+          return _21576;
+        if ("2158-4".equals(codeString))
+          return _21584;
+        if ("2159-2".equals(codeString))
+          return _21592;
+        if ("2160-0".equals(codeString))
+          return _21600;
+        if ("2161-8".equals(codeString))
+          return _21618;
+        if ("2162-6".equals(codeString))
+          return _21626;
+        if ("2163-4".equals(codeString))
+          return _21634;
+        if ("2165-9".equals(codeString))
+          return _21659;
+        if ("2166-7".equals(codeString))
+          return _21667;
+        if ("2167-5".equals(codeString))
+          return _21675;
+        if ("2168-3".equals(codeString))
+          return _21683;
+        if ("2169-1".equals(codeString))
+          return _21691;
+        if ("2170-9".equals(codeString))
+          return _21709;
+        if ("2171-7".equals(codeString))
+          return _21717;
+        if ("2172-5".equals(codeString))
+          return _21725;
+        if ("2173-3".equals(codeString))
+          return _21733;
+        if ("2174-1".equals(codeString))
+          return _21741;
+        if ("2175-8".equals(codeString))
+          return _21758;
+        if ("2176-6".equals(codeString))
+          return _21766;
+        if ("2178-2".equals(codeString))
+          return _21782;
+        if ("2180-8".equals(codeString))
+          return _21808;
+        if ("2182-4".equals(codeString))
+          return _21824;
+        if ("2184-0".equals(codeString))
+          return _21840;
+        if ("2186-5".equals(codeString))
+          return _21865;
+        throw new FHIRException("Unknown V3Ethnicity code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _21352: return "2135-2";
+            case _21378: return "2137-8";
+            case _21386: return "2138-6";
+            case _21394: return "2139-4";
+            case _21402: return "2140-2";
+            case _21410: return "2141-0";
+            case _21428: return "2142-8";
+            case _21436: return "2143-6";
+            case _21444: return "2144-4";
+            case _21451: return "2145-1";
+            case _21469: return "2146-9";
+            case _21485: return "2148-5";
+            case _21493: return "2149-3";
+            case _21501: return "2150-1";
+            case _21519: return "2151-9";
+            case _21527: return "2152-7";
+            case _21535: return "2153-5";
+            case _21550: return "2155-0";
+            case _21568: return "2156-8";
+            case _21576: return "2157-6";
+            case _21584: return "2158-4";
+            case _21592: return "2159-2";
+            case _21600: return "2160-0";
+            case _21618: return "2161-8";
+            case _21626: return "2162-6";
+            case _21634: return "2163-4";
+            case _21659: return "2165-9";
+            case _21667: return "2166-7";
+            case _21675: return "2167-5";
+            case _21683: return "2168-3";
+            case _21691: return "2169-1";
+            case _21709: return "2170-9";
+            case _21717: return "2171-7";
+            case _21725: return "2172-5";
+            case _21733: return "2173-3";
+            case _21741: return "2174-1";
+            case _21758: return "2175-8";
+            case _21766: return "2176-6";
+            case _21782: return "2178-2";
+            case _21808: return "2180-8";
+            case _21824: return "2182-4";
+            case _21840: return "2184-0";
+            case _21865: return "2186-5";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/Ethnicity";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _21352: return "Hispanic or Latino";
+            case _21378: return "Spaniard";
+            case _21386: return "Andalusian";
+            case _21394: return "Asturian";
+            case _21402: return "Castillian";
+            case _21410: return "Catalonian";
+            case _21428: return "Belearic Islander";
+            case _21436: return "Gallego";
+            case _21444: return "Valencian";
+            case _21451: return "Canarian";
+            case _21469: return "Spanish Basque";
+            case _21485: return "Mexican";
+            case _21493: return "Mexican American";
+            case _21501: return "Mexicano";
+            case _21519: return "Chicano";
+            case _21527: return "La Raza";
+            case _21535: return "Mexican American Indian";
+            case _21550: return "Central American";
+            case _21568: return "Costa Rican";
+            case _21576: return "Guatemalan";
+            case _21584: return "Honduran";
+            case _21592: return "Nicaraguan";
+            case _21600: return "Panamanian";
+            case _21618: return "Salvadoran";
+            case _21626: return "Central American Indian";
+            case _21634: return "Canal Zone";
+            case _21659: return "South American";
+            case _21667: return "Argentinean";
+            case _21675: return "Bolivian";
+            case _21683: return "Chilean";
+            case _21691: return "Colombian";
+            case _21709: return "Ecuadorian";
+            case _21717: return "Paraguayan";
+            case _21725: return "Peruvian";
+            case _21733: return "Uruguayan";
+            case _21741: return "Venezuelan";
+            case _21758: return "South American Indian";
+            case _21766: return "Criollo";
+            case _21782: return "Latin American";
+            case _21808: return "Puerto Rican";
+            case _21824: return "Cuban";
+            case _21840: return "Dominican";
+            case _21865: return "Note that this term remains in the table for completeness, even though within HL7, the notion of \"not otherwise coded\" term is deprecated.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _21352: return "Hispanic or Latino";
+            case _21378: return "Spaniard";
+            case _21386: return "Andalusian";
+            case _21394: return "Asturian";
+            case _21402: return "Castillian";
+            case _21410: return "Catalonian";
+            case _21428: return "Belearic Islander";
+            case _21436: return "Gallego";
+            case _21444: return "Valencian";
+            case _21451: return "Canarian";
+            case _21469: return "Spanish Basque";
+            case _21485: return "Mexican";
+            case _21493: return "Mexican American";
+            case _21501: return "Mexicano";
+            case _21519: return "Chicano";
+            case _21527: return "La Raza";
+            case _21535: return "Mexican American Indian";
+            case _21550: return "Central American";
+            case _21568: return "Costa Rican";
+            case _21576: return "Guatemalan";
+            case _21584: return "Honduran";
+            case _21592: return "Nicaraguan";
+            case _21600: return "Panamanian";
+            case _21618: return "Salvadoran";
+            case _21626: return "Central American Indian";
+            case _21634: return "Canal Zone";
+            case _21659: return "South American";
+            case _21667: return "Argentinean";
+            case _21675: return "Bolivian";
+            case _21683: return "Chilean";
+            case _21691: return "Colombian";
+            case _21709: return "Ecuadorian";
+            case _21717: return "Paraguayan";
+            case _21725: return "Peruvian";
+            case _21733: return "Uruguayan";
+            case _21741: return "Venezuelan";
+            case _21758: return "South American Indian";
+            case _21766: return "Criollo";
+            case _21782: return "Latin American";
+            case _21808: return "Puerto Rican";
+            case _21824: return "Cuban";
+            case _21840: return "Dominican";
+            case _21865: return "Not Hispanic or Latino";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EthnicityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EthnicityEnumFactory.java
new file mode 100644
index 00000000000..e1ed8919d30
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3EthnicityEnumFactory.java
@@ -0,0 +1,226 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3EthnicityEnumFactory implements EnumFactory {
+
+  public V3Ethnicity fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("2135-2".equals(codeString))
+      return V3Ethnicity._21352;
+    if ("2137-8".equals(codeString))
+      return V3Ethnicity._21378;
+    if ("2138-6".equals(codeString))
+      return V3Ethnicity._21386;
+    if ("2139-4".equals(codeString))
+      return V3Ethnicity._21394;
+    if ("2140-2".equals(codeString))
+      return V3Ethnicity._21402;
+    if ("2141-0".equals(codeString))
+      return V3Ethnicity._21410;
+    if ("2142-8".equals(codeString))
+      return V3Ethnicity._21428;
+    if ("2143-6".equals(codeString))
+      return V3Ethnicity._21436;
+    if ("2144-4".equals(codeString))
+      return V3Ethnicity._21444;
+    if ("2145-1".equals(codeString))
+      return V3Ethnicity._21451;
+    if ("2146-9".equals(codeString))
+      return V3Ethnicity._21469;
+    if ("2148-5".equals(codeString))
+      return V3Ethnicity._21485;
+    if ("2149-3".equals(codeString))
+      return V3Ethnicity._21493;
+    if ("2150-1".equals(codeString))
+      return V3Ethnicity._21501;
+    if ("2151-9".equals(codeString))
+      return V3Ethnicity._21519;
+    if ("2152-7".equals(codeString))
+      return V3Ethnicity._21527;
+    if ("2153-5".equals(codeString))
+      return V3Ethnicity._21535;
+    if ("2155-0".equals(codeString))
+      return V3Ethnicity._21550;
+    if ("2156-8".equals(codeString))
+      return V3Ethnicity._21568;
+    if ("2157-6".equals(codeString))
+      return V3Ethnicity._21576;
+    if ("2158-4".equals(codeString))
+      return V3Ethnicity._21584;
+    if ("2159-2".equals(codeString))
+      return V3Ethnicity._21592;
+    if ("2160-0".equals(codeString))
+      return V3Ethnicity._21600;
+    if ("2161-8".equals(codeString))
+      return V3Ethnicity._21618;
+    if ("2162-6".equals(codeString))
+      return V3Ethnicity._21626;
+    if ("2163-4".equals(codeString))
+      return V3Ethnicity._21634;
+    if ("2165-9".equals(codeString))
+      return V3Ethnicity._21659;
+    if ("2166-7".equals(codeString))
+      return V3Ethnicity._21667;
+    if ("2167-5".equals(codeString))
+      return V3Ethnicity._21675;
+    if ("2168-3".equals(codeString))
+      return V3Ethnicity._21683;
+    if ("2169-1".equals(codeString))
+      return V3Ethnicity._21691;
+    if ("2170-9".equals(codeString))
+      return V3Ethnicity._21709;
+    if ("2171-7".equals(codeString))
+      return V3Ethnicity._21717;
+    if ("2172-5".equals(codeString))
+      return V3Ethnicity._21725;
+    if ("2173-3".equals(codeString))
+      return V3Ethnicity._21733;
+    if ("2174-1".equals(codeString))
+      return V3Ethnicity._21741;
+    if ("2175-8".equals(codeString))
+      return V3Ethnicity._21758;
+    if ("2176-6".equals(codeString))
+      return V3Ethnicity._21766;
+    if ("2178-2".equals(codeString))
+      return V3Ethnicity._21782;
+    if ("2180-8".equals(codeString))
+      return V3Ethnicity._21808;
+    if ("2182-4".equals(codeString))
+      return V3Ethnicity._21824;
+    if ("2184-0".equals(codeString))
+      return V3Ethnicity._21840;
+    if ("2186-5".equals(codeString))
+      return V3Ethnicity._21865;
+    throw new IllegalArgumentException("Unknown V3Ethnicity code '"+codeString+"'");
+  }
+
+  public String toCode(V3Ethnicity code) {
+    if (code == V3Ethnicity._21352)
+      return "2135-2";
+    if (code == V3Ethnicity._21378)
+      return "2137-8";
+    if (code == V3Ethnicity._21386)
+      return "2138-6";
+    if (code == V3Ethnicity._21394)
+      return "2139-4";
+    if (code == V3Ethnicity._21402)
+      return "2140-2";
+    if (code == V3Ethnicity._21410)
+      return "2141-0";
+    if (code == V3Ethnicity._21428)
+      return "2142-8";
+    if (code == V3Ethnicity._21436)
+      return "2143-6";
+    if (code == V3Ethnicity._21444)
+      return "2144-4";
+    if (code == V3Ethnicity._21451)
+      return "2145-1";
+    if (code == V3Ethnicity._21469)
+      return "2146-9";
+    if (code == V3Ethnicity._21485)
+      return "2148-5";
+    if (code == V3Ethnicity._21493)
+      return "2149-3";
+    if (code == V3Ethnicity._21501)
+      return "2150-1";
+    if (code == V3Ethnicity._21519)
+      return "2151-9";
+    if (code == V3Ethnicity._21527)
+      return "2152-7";
+    if (code == V3Ethnicity._21535)
+      return "2153-5";
+    if (code == V3Ethnicity._21550)
+      return "2155-0";
+    if (code == V3Ethnicity._21568)
+      return "2156-8";
+    if (code == V3Ethnicity._21576)
+      return "2157-6";
+    if (code == V3Ethnicity._21584)
+      return "2158-4";
+    if (code == V3Ethnicity._21592)
+      return "2159-2";
+    if (code == V3Ethnicity._21600)
+      return "2160-0";
+    if (code == V3Ethnicity._21618)
+      return "2161-8";
+    if (code == V3Ethnicity._21626)
+      return "2162-6";
+    if (code == V3Ethnicity._21634)
+      return "2163-4";
+    if (code == V3Ethnicity._21659)
+      return "2165-9";
+    if (code == V3Ethnicity._21667)
+      return "2166-7";
+    if (code == V3Ethnicity._21675)
+      return "2167-5";
+    if (code == V3Ethnicity._21683)
+      return "2168-3";
+    if (code == V3Ethnicity._21691)
+      return "2169-1";
+    if (code == V3Ethnicity._21709)
+      return "2170-9";
+    if (code == V3Ethnicity._21717)
+      return "2171-7";
+    if (code == V3Ethnicity._21725)
+      return "2172-5";
+    if (code == V3Ethnicity._21733)
+      return "2173-3";
+    if (code == V3Ethnicity._21741)
+      return "2174-1";
+    if (code == V3Ethnicity._21758)
+      return "2175-8";
+    if (code == V3Ethnicity._21766)
+      return "2176-6";
+    if (code == V3Ethnicity._21782)
+      return "2178-2";
+    if (code == V3Ethnicity._21808)
+      return "2180-8";
+    if (code == V3Ethnicity._21824)
+      return "2182-4";
+    if (code == V3Ethnicity._21840)
+      return "2184-0";
+    if (code == V3Ethnicity._21865)
+      return "2186-5";
+    return "?";
+  }
+
+    public String toSystem(V3Ethnicity code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ExposureMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ExposureMode.java
new file mode 100644
index 00000000000..a9f620daef6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ExposureMode.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ExposureMode {
+
+        /**
+         * Code for the mechanism by which the exposure agent was exchanged or potentially exchanged by the participants involved in the exposure.
+         */
+        _EXPOSUREMODE, 
+        /**
+         * Description: Communication of an agent from a living subject or environmental source to a living subject through indirect contact via oral or nasal inhalation.
+         */
+        AIRBORNE, 
+        /**
+         * Description: Communication of an agent from a living subject or environmental source to a living subject through direct physical contact.
+         */
+        CONTACT, 
+        /**
+         * Description: Communication of an agent from a food source to a living subject via oral consumption.
+         */
+        FOODBORNE, 
+        /**
+         * Description: Communication of an agent to a living subject by contact and/or consumption via an aqueous medium
+         */
+        WATERBORNE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ExposureMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ExposureMode".equals(codeString))
+          return _EXPOSUREMODE;
+        if ("AIRBORNE".equals(codeString))
+          return AIRBORNE;
+        if ("CONTACT".equals(codeString))
+          return CONTACT;
+        if ("FOODBORNE".equals(codeString))
+          return FOODBORNE;
+        if ("WATERBORNE".equals(codeString))
+          return WATERBORNE;
+        throw new FHIRException("Unknown V3ExposureMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _EXPOSUREMODE: return "_ExposureMode";
+            case AIRBORNE: return "AIRBORNE";
+            case CONTACT: return "CONTACT";
+            case FOODBORNE: return "FOODBORNE";
+            case WATERBORNE: return "WATERBORNE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ExposureMode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _EXPOSUREMODE: return "Code for the mechanism by which the exposure agent was exchanged or potentially exchanged by the participants involved in the exposure.";
+            case AIRBORNE: return "Description: Communication of an agent from a living subject or environmental source to a living subject through indirect contact via oral or nasal inhalation.";
+            case CONTACT: return "Description: Communication of an agent from a living subject or environmental source to a living subject through direct physical contact.";
+            case FOODBORNE: return "Description: Communication of an agent from a food source to a living subject via oral consumption.";
+            case WATERBORNE: return "Description: Communication of an agent to a living subject by contact and/or consumption via an aqueous medium";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _EXPOSUREMODE: return "ExposureMode";
+            case AIRBORNE: return "airborne";
+            case CONTACT: return "contact";
+            case FOODBORNE: return "foodborne";
+            case WATERBORNE: return "waterborne";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ExposureModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ExposureModeEnumFactory.java
new file mode 100644
index 00000000000..a2f962d2991
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ExposureModeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ExposureModeEnumFactory implements EnumFactory {
+
+  public V3ExposureMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ExposureMode".equals(codeString))
+      return V3ExposureMode._EXPOSUREMODE;
+    if ("AIRBORNE".equals(codeString))
+      return V3ExposureMode.AIRBORNE;
+    if ("CONTACT".equals(codeString))
+      return V3ExposureMode.CONTACT;
+    if ("FOODBORNE".equals(codeString))
+      return V3ExposureMode.FOODBORNE;
+    if ("WATERBORNE".equals(codeString))
+      return V3ExposureMode.WATERBORNE;
+    throw new IllegalArgumentException("Unknown V3ExposureMode code '"+codeString+"'");
+  }
+
+  public String toCode(V3ExposureMode code) {
+    if (code == V3ExposureMode._EXPOSUREMODE)
+      return "_ExposureMode";
+    if (code == V3ExposureMode.AIRBORNE)
+      return "AIRBORNE";
+    if (code == V3ExposureMode.CONTACT)
+      return "CONTACT";
+    if (code == V3ExposureMode.FOODBORNE)
+      return "FOODBORNE";
+    if (code == V3ExposureMode.WATERBORNE)
+      return "WATERBORNE";
+    return "?";
+  }
+
+    public String toSystem(V3ExposureMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GTSAbbreviation.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GTSAbbreviation.java
new file mode 100644
index 00000000000..2cdeb959114
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GTSAbbreviation.java
@@ -0,0 +1,402 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3GTSAbbreviation {
+
+        /**
+         * Every morning at institution specified times.
+         */
+        AM, 
+        /**
+         * Two times a day at institution specified time
+         */
+        BID, 
+        /**
+         * Regular business days (Monday to Friday excluding holidays)
+         */
+        JB, 
+        /**
+         * Regular weekends (Saturday and Sunday excluding holidays)
+         */
+        JE, 
+        /**
+         * Holidays
+         */
+        JH, 
+        /**
+         * Christian Holidays (Roman/Gregorian [Western] Tradition.)
+         */
+        _GTSABBREVIATIONHOLIDAYSCHRISTIANROMAN, 
+        /**
+         * Easter Sunday.  The Easter date is a rather complex calculation based on Astronomical tables describing full moon dates.  Details can be found at [http://www.assa.org.au/edm.html, and http://aa.usno.navy.mil/AA/faq/docs/easter.html].  Note that the Christian Orthodox Holidays are based on the Julian calendar.
+         */
+        JHCHREAS, 
+        /**
+         * Good Friday, is the Friday right before Easter Sunday.
+         */
+        JHCHRGFR, 
+        /**
+         * New Year's Day (January 1)
+         */
+        JHCHRNEW, 
+        /**
+         * Pentecost Sunday, is seven weeks after Easter (the 50th day of Easter).
+         */
+        JHCHRPEN, 
+        /**
+         * Christmas Eve (December 24)
+         */
+        JHCHRXME, 
+        /**
+         * Christmas Day (December 25)
+         */
+        JHCHRXMS, 
+        /**
+         * Description:The Netherlands National Holidays.
+         */
+        JHNNL, 
+        /**
+         * Description:Liberation day  (May 5 every five years)
+         */
+        JHNNLLD, 
+        /**
+         * Description:Queen's day (April 30)
+         */
+        JHNNLQD, 
+        /**
+         * Description:Sinterklaas (December 5)
+         */
+        JHNNLSK, 
+        /**
+         * United States National Holidays (public holidays for federal employees established by U.S. Federal law 5 U.S.C. 6103).
+         */
+        JHNUS, 
+        /**
+         * Columbus Day, the second Monday in October.
+         */
+        JHNUSCLM, 
+        /**
+         * Independence Day (4th of July)
+         */
+        JHNUSIND, 
+        /**
+         * Alternative Monday after 4th of July Weekend [5 U.S.C. 6103(b)].
+         */
+        JHNUSIND1, 
+        /**
+         * Alternative Friday before 4th of July Weekend [5 U.S.C. 6103(b)].
+         */
+        JHNUSIND5, 
+        /**
+         * Labor Day, the first Monday in September.
+         */
+        JHNUSLBR, 
+        /**
+         * Memorial Day, the last Monday in May.
+         */
+        JHNUSMEM, 
+        /**
+         * Friday before Memorial Day Weekend
+         */
+        JHNUSMEM5, 
+        /**
+         * Saturday of Memorial Day Weekend
+         */
+        JHNUSMEM6, 
+        /**
+         * Dr. Martin Luther King, Jr. Day, the third Monday in January.
+         */
+        JHNUSMLK, 
+        /**
+         * Washington's Birthday (Presidential Day) the third Monday in February.
+         */
+        JHNUSPRE, 
+        /**
+         * Thanksgiving Day, the fourth Thursday in November.
+         */
+        JHNUSTKS, 
+        /**
+         * Friday after Thanksgiving.
+         */
+        JHNUSTKS5, 
+        /**
+         * Veteran's Day, November 11.
+         */
+        JHNUSVET, 
+        /**
+         * Every afternoon at institution specified times.
+         */
+        PM, 
+        /**
+         * Every 4 hours at institution specified time
+         */
+        Q4H, 
+        /**
+         * Every 6 hours at institution specified time
+         */
+        Q6H, 
+        /**
+         * Every day at institution specified times.
+         */
+        QD, 
+        /**
+         * Four times a day at institution specified time
+         */
+        QID, 
+        /**
+         * Every other day at institution specified times.
+         */
+        QOD, 
+        /**
+         * Three times a day at institution specified time
+         */
+        TID, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3GTSAbbreviation fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AM".equals(codeString))
+          return AM;
+        if ("BID".equals(codeString))
+          return BID;
+        if ("JB".equals(codeString))
+          return JB;
+        if ("JE".equals(codeString))
+          return JE;
+        if ("JH".equals(codeString))
+          return JH;
+        if ("_GTSAbbreviationHolidaysChristianRoman".equals(codeString))
+          return _GTSABBREVIATIONHOLIDAYSCHRISTIANROMAN;
+        if ("JHCHREAS".equals(codeString))
+          return JHCHREAS;
+        if ("JHCHRGFR".equals(codeString))
+          return JHCHRGFR;
+        if ("JHCHRNEW".equals(codeString))
+          return JHCHRNEW;
+        if ("JHCHRPEN".equals(codeString))
+          return JHCHRPEN;
+        if ("JHCHRXME".equals(codeString))
+          return JHCHRXME;
+        if ("JHCHRXMS".equals(codeString))
+          return JHCHRXMS;
+        if ("JHNNL".equals(codeString))
+          return JHNNL;
+        if ("JHNNLLD".equals(codeString))
+          return JHNNLLD;
+        if ("JHNNLQD".equals(codeString))
+          return JHNNLQD;
+        if ("JHNNLSK".equals(codeString))
+          return JHNNLSK;
+        if ("JHNUS".equals(codeString))
+          return JHNUS;
+        if ("JHNUSCLM".equals(codeString))
+          return JHNUSCLM;
+        if ("JHNUSIND".equals(codeString))
+          return JHNUSIND;
+        if ("JHNUSIND1".equals(codeString))
+          return JHNUSIND1;
+        if ("JHNUSIND5".equals(codeString))
+          return JHNUSIND5;
+        if ("JHNUSLBR".equals(codeString))
+          return JHNUSLBR;
+        if ("JHNUSMEM".equals(codeString))
+          return JHNUSMEM;
+        if ("JHNUSMEM5".equals(codeString))
+          return JHNUSMEM5;
+        if ("JHNUSMEM6".equals(codeString))
+          return JHNUSMEM6;
+        if ("JHNUSMLK".equals(codeString))
+          return JHNUSMLK;
+        if ("JHNUSPRE".equals(codeString))
+          return JHNUSPRE;
+        if ("JHNUSTKS".equals(codeString))
+          return JHNUSTKS;
+        if ("JHNUSTKS5".equals(codeString))
+          return JHNUSTKS5;
+        if ("JHNUSVET".equals(codeString))
+          return JHNUSVET;
+        if ("PM".equals(codeString))
+          return PM;
+        if ("Q4H".equals(codeString))
+          return Q4H;
+        if ("Q6H".equals(codeString))
+          return Q6H;
+        if ("QD".equals(codeString))
+          return QD;
+        if ("QID".equals(codeString))
+          return QID;
+        if ("QOD".equals(codeString))
+          return QOD;
+        if ("TID".equals(codeString))
+          return TID;
+        throw new FHIRException("Unknown V3GTSAbbreviation code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AM: return "AM";
+            case BID: return "BID";
+            case JB: return "JB";
+            case JE: return "JE";
+            case JH: return "JH";
+            case _GTSABBREVIATIONHOLIDAYSCHRISTIANROMAN: return "_GTSAbbreviationHolidaysChristianRoman";
+            case JHCHREAS: return "JHCHREAS";
+            case JHCHRGFR: return "JHCHRGFR";
+            case JHCHRNEW: return "JHCHRNEW";
+            case JHCHRPEN: return "JHCHRPEN";
+            case JHCHRXME: return "JHCHRXME";
+            case JHCHRXMS: return "JHCHRXMS";
+            case JHNNL: return "JHNNL";
+            case JHNNLLD: return "JHNNLLD";
+            case JHNNLQD: return "JHNNLQD";
+            case JHNNLSK: return "JHNNLSK";
+            case JHNUS: return "JHNUS";
+            case JHNUSCLM: return "JHNUSCLM";
+            case JHNUSIND: return "JHNUSIND";
+            case JHNUSIND1: return "JHNUSIND1";
+            case JHNUSIND5: return "JHNUSIND5";
+            case JHNUSLBR: return "JHNUSLBR";
+            case JHNUSMEM: return "JHNUSMEM";
+            case JHNUSMEM5: return "JHNUSMEM5";
+            case JHNUSMEM6: return "JHNUSMEM6";
+            case JHNUSMLK: return "JHNUSMLK";
+            case JHNUSPRE: return "JHNUSPRE";
+            case JHNUSTKS: return "JHNUSTKS";
+            case JHNUSTKS5: return "JHNUSTKS5";
+            case JHNUSVET: return "JHNUSVET";
+            case PM: return "PM";
+            case Q4H: return "Q4H";
+            case Q6H: return "Q6H";
+            case QD: return "QD";
+            case QID: return "QID";
+            case QOD: return "QOD";
+            case TID: return "TID";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/GTSAbbreviation";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AM: return "Every morning at institution specified times.";
+            case BID: return "Two times a day at institution specified time";
+            case JB: return "Regular business days (Monday to Friday excluding holidays)";
+            case JE: return "Regular weekends (Saturday and Sunday excluding holidays)";
+            case JH: return "Holidays";
+            case _GTSABBREVIATIONHOLIDAYSCHRISTIANROMAN: return "Christian Holidays (Roman/Gregorian [Western] Tradition.)";
+            case JHCHREAS: return "Easter Sunday.  The Easter date is a rather complex calculation based on Astronomical tables describing full moon dates.  Details can be found at [http://www.assa.org.au/edm.html, and http://aa.usno.navy.mil/AA/faq/docs/easter.html].  Note that the Christian Orthodox Holidays are based on the Julian calendar.";
+            case JHCHRGFR: return "Good Friday, is the Friday right before Easter Sunday.";
+            case JHCHRNEW: return "New Year's Day (January 1)";
+            case JHCHRPEN: return "Pentecost Sunday, is seven weeks after Easter (the 50th day of Easter).";
+            case JHCHRXME: return "Christmas Eve (December 24)";
+            case JHCHRXMS: return "Christmas Day (December 25)";
+            case JHNNL: return "Description:The Netherlands National Holidays.";
+            case JHNNLLD: return "Description:Liberation day  (May 5 every five years)";
+            case JHNNLQD: return "Description:Queen's day (April 30)";
+            case JHNNLSK: return "Description:Sinterklaas (December 5)";
+            case JHNUS: return "United States National Holidays (public holidays for federal employees established by U.S. Federal law 5 U.S.C. 6103).";
+            case JHNUSCLM: return "Columbus Day, the second Monday in October.";
+            case JHNUSIND: return "Independence Day (4th of July)";
+            case JHNUSIND1: return "Alternative Monday after 4th of July Weekend [5 U.S.C. 6103(b)].";
+            case JHNUSIND5: return "Alternative Friday before 4th of July Weekend [5 U.S.C. 6103(b)].";
+            case JHNUSLBR: return "Labor Day, the first Monday in September.";
+            case JHNUSMEM: return "Memorial Day, the last Monday in May.";
+            case JHNUSMEM5: return "Friday before Memorial Day Weekend";
+            case JHNUSMEM6: return "Saturday of Memorial Day Weekend";
+            case JHNUSMLK: return "Dr. Martin Luther King, Jr. Day, the third Monday in January.";
+            case JHNUSPRE: return "Washington's Birthday (Presidential Day) the third Monday in February.";
+            case JHNUSTKS: return "Thanksgiving Day, the fourth Thursday in November.";
+            case JHNUSTKS5: return "Friday after Thanksgiving.";
+            case JHNUSVET: return "Veteran's Day, November 11.";
+            case PM: return "Every afternoon at institution specified times.";
+            case Q4H: return "Every 4 hours at institution specified time";
+            case Q6H: return "Every 6 hours at institution specified time";
+            case QD: return "Every day at institution specified times.";
+            case QID: return "Four times a day at institution specified time";
+            case QOD: return "Every other day at institution specified times.";
+            case TID: return "Three times a day at institution specified time";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AM: return "AM";
+            case BID: return "BID";
+            case JB: return "JB";
+            case JE: return "JE";
+            case JH: return "GTSAbbreviationHolidays";
+            case _GTSABBREVIATIONHOLIDAYSCHRISTIANROMAN: return "GTSAbbreviationHolidaysChristianRoman";
+            case JHCHREAS: return "JHCHREAS";
+            case JHCHRGFR: return "JHCHRGFR";
+            case JHCHRNEW: return "JHCHRNEW";
+            case JHCHRPEN: return "JHCHRPEN";
+            case JHCHRXME: return "JHCHRXME";
+            case JHCHRXMS: return "JHCHRXMS";
+            case JHNNL: return "The Netherlands National Holidays";
+            case JHNNLLD: return "Liberation day (May 5 every five years)";
+            case JHNNLQD: return "Queen's day (April 30)";
+            case JHNNLSK: return "Sinterklaas (December 5)";
+            case JHNUS: return "GTSAbbreviationHolidaysUSNational";
+            case JHNUSCLM: return "JHNUSCLM";
+            case JHNUSIND: return "JHNUSIND";
+            case JHNUSIND1: return "JHNUSIND1";
+            case JHNUSIND5: return "JHNUSIND5";
+            case JHNUSLBR: return "JHNUSLBR";
+            case JHNUSMEM: return "JHNUSMEM";
+            case JHNUSMEM5: return "JHNUSMEM5";
+            case JHNUSMEM6: return "JHNUSMEM6";
+            case JHNUSMLK: return "JHNUSMLK";
+            case JHNUSPRE: return "JHNUSPRE";
+            case JHNUSTKS: return "JHNUSTKS";
+            case JHNUSTKS5: return "JHNUSTKS5";
+            case JHNUSVET: return "JHNUSVET";
+            case PM: return "PM";
+            case Q4H: return "Q4H";
+            case Q6H: return "Q6H";
+            case QD: return "QD";
+            case QID: return "QID";
+            case QOD: return "QOD";
+            case TID: return "TID";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GTSAbbreviationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GTSAbbreviationEnumFactory.java
new file mode 100644
index 00000000000..22ade91d63a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GTSAbbreviationEnumFactory.java
@@ -0,0 +1,202 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3GTSAbbreviationEnumFactory implements EnumFactory {
+
+  public V3GTSAbbreviation fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AM".equals(codeString))
+      return V3GTSAbbreviation.AM;
+    if ("BID".equals(codeString))
+      return V3GTSAbbreviation.BID;
+    if ("JB".equals(codeString))
+      return V3GTSAbbreviation.JB;
+    if ("JE".equals(codeString))
+      return V3GTSAbbreviation.JE;
+    if ("JH".equals(codeString))
+      return V3GTSAbbreviation.JH;
+    if ("_GTSAbbreviationHolidaysChristianRoman".equals(codeString))
+      return V3GTSAbbreviation._GTSABBREVIATIONHOLIDAYSCHRISTIANROMAN;
+    if ("JHCHREAS".equals(codeString))
+      return V3GTSAbbreviation.JHCHREAS;
+    if ("JHCHRGFR".equals(codeString))
+      return V3GTSAbbreviation.JHCHRGFR;
+    if ("JHCHRNEW".equals(codeString))
+      return V3GTSAbbreviation.JHCHRNEW;
+    if ("JHCHRPEN".equals(codeString))
+      return V3GTSAbbreviation.JHCHRPEN;
+    if ("JHCHRXME".equals(codeString))
+      return V3GTSAbbreviation.JHCHRXME;
+    if ("JHCHRXMS".equals(codeString))
+      return V3GTSAbbreviation.JHCHRXMS;
+    if ("JHNNL".equals(codeString))
+      return V3GTSAbbreviation.JHNNL;
+    if ("JHNNLLD".equals(codeString))
+      return V3GTSAbbreviation.JHNNLLD;
+    if ("JHNNLQD".equals(codeString))
+      return V3GTSAbbreviation.JHNNLQD;
+    if ("JHNNLSK".equals(codeString))
+      return V3GTSAbbreviation.JHNNLSK;
+    if ("JHNUS".equals(codeString))
+      return V3GTSAbbreviation.JHNUS;
+    if ("JHNUSCLM".equals(codeString))
+      return V3GTSAbbreviation.JHNUSCLM;
+    if ("JHNUSIND".equals(codeString))
+      return V3GTSAbbreviation.JHNUSIND;
+    if ("JHNUSIND1".equals(codeString))
+      return V3GTSAbbreviation.JHNUSIND1;
+    if ("JHNUSIND5".equals(codeString))
+      return V3GTSAbbreviation.JHNUSIND5;
+    if ("JHNUSLBR".equals(codeString))
+      return V3GTSAbbreviation.JHNUSLBR;
+    if ("JHNUSMEM".equals(codeString))
+      return V3GTSAbbreviation.JHNUSMEM;
+    if ("JHNUSMEM5".equals(codeString))
+      return V3GTSAbbreviation.JHNUSMEM5;
+    if ("JHNUSMEM6".equals(codeString))
+      return V3GTSAbbreviation.JHNUSMEM6;
+    if ("JHNUSMLK".equals(codeString))
+      return V3GTSAbbreviation.JHNUSMLK;
+    if ("JHNUSPRE".equals(codeString))
+      return V3GTSAbbreviation.JHNUSPRE;
+    if ("JHNUSTKS".equals(codeString))
+      return V3GTSAbbreviation.JHNUSTKS;
+    if ("JHNUSTKS5".equals(codeString))
+      return V3GTSAbbreviation.JHNUSTKS5;
+    if ("JHNUSVET".equals(codeString))
+      return V3GTSAbbreviation.JHNUSVET;
+    if ("PM".equals(codeString))
+      return V3GTSAbbreviation.PM;
+    if ("Q4H".equals(codeString))
+      return V3GTSAbbreviation.Q4H;
+    if ("Q6H".equals(codeString))
+      return V3GTSAbbreviation.Q6H;
+    if ("QD".equals(codeString))
+      return V3GTSAbbreviation.QD;
+    if ("QID".equals(codeString))
+      return V3GTSAbbreviation.QID;
+    if ("QOD".equals(codeString))
+      return V3GTSAbbreviation.QOD;
+    if ("TID".equals(codeString))
+      return V3GTSAbbreviation.TID;
+    throw new IllegalArgumentException("Unknown V3GTSAbbreviation code '"+codeString+"'");
+  }
+
+  public String toCode(V3GTSAbbreviation code) {
+    if (code == V3GTSAbbreviation.AM)
+      return "AM";
+    if (code == V3GTSAbbreviation.BID)
+      return "BID";
+    if (code == V3GTSAbbreviation.JB)
+      return "JB";
+    if (code == V3GTSAbbreviation.JE)
+      return "JE";
+    if (code == V3GTSAbbreviation.JH)
+      return "JH";
+    if (code == V3GTSAbbreviation._GTSABBREVIATIONHOLIDAYSCHRISTIANROMAN)
+      return "_GTSAbbreviationHolidaysChristianRoman";
+    if (code == V3GTSAbbreviation.JHCHREAS)
+      return "JHCHREAS";
+    if (code == V3GTSAbbreviation.JHCHRGFR)
+      return "JHCHRGFR";
+    if (code == V3GTSAbbreviation.JHCHRNEW)
+      return "JHCHRNEW";
+    if (code == V3GTSAbbreviation.JHCHRPEN)
+      return "JHCHRPEN";
+    if (code == V3GTSAbbreviation.JHCHRXME)
+      return "JHCHRXME";
+    if (code == V3GTSAbbreviation.JHCHRXMS)
+      return "JHCHRXMS";
+    if (code == V3GTSAbbreviation.JHNNL)
+      return "JHNNL";
+    if (code == V3GTSAbbreviation.JHNNLLD)
+      return "JHNNLLD";
+    if (code == V3GTSAbbreviation.JHNNLQD)
+      return "JHNNLQD";
+    if (code == V3GTSAbbreviation.JHNNLSK)
+      return "JHNNLSK";
+    if (code == V3GTSAbbreviation.JHNUS)
+      return "JHNUS";
+    if (code == V3GTSAbbreviation.JHNUSCLM)
+      return "JHNUSCLM";
+    if (code == V3GTSAbbreviation.JHNUSIND)
+      return "JHNUSIND";
+    if (code == V3GTSAbbreviation.JHNUSIND1)
+      return "JHNUSIND1";
+    if (code == V3GTSAbbreviation.JHNUSIND5)
+      return "JHNUSIND5";
+    if (code == V3GTSAbbreviation.JHNUSLBR)
+      return "JHNUSLBR";
+    if (code == V3GTSAbbreviation.JHNUSMEM)
+      return "JHNUSMEM";
+    if (code == V3GTSAbbreviation.JHNUSMEM5)
+      return "JHNUSMEM5";
+    if (code == V3GTSAbbreviation.JHNUSMEM6)
+      return "JHNUSMEM6";
+    if (code == V3GTSAbbreviation.JHNUSMLK)
+      return "JHNUSMLK";
+    if (code == V3GTSAbbreviation.JHNUSPRE)
+      return "JHNUSPRE";
+    if (code == V3GTSAbbreviation.JHNUSTKS)
+      return "JHNUSTKS";
+    if (code == V3GTSAbbreviation.JHNUSTKS5)
+      return "JHNUSTKS5";
+    if (code == V3GTSAbbreviation.JHNUSVET)
+      return "JHNUSVET";
+    if (code == V3GTSAbbreviation.PM)
+      return "PM";
+    if (code == V3GTSAbbreviation.Q4H)
+      return "Q4H";
+    if (code == V3GTSAbbreviation.Q6H)
+      return "Q6H";
+    if (code == V3GTSAbbreviation.QD)
+      return "QD";
+    if (code == V3GTSAbbreviation.QID)
+      return "QID";
+    if (code == V3GTSAbbreviation.QOD)
+      return "QOD";
+    if (code == V3GTSAbbreviation.TID)
+      return "TID";
+    return "?";
+  }
+
+    public String toSystem(V3GTSAbbreviation code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GenderStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GenderStatus.java
new file mode 100644
index 00000000000..3d18d0d160b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GenderStatus.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3GenderStatus {
+
+        /**
+         * Reproductively intact
+         */
+        I, 
+        /**
+         * Reproductively neutered
+         */
+        N, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3GenderStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("I".equals(codeString))
+          return I;
+        if ("N".equals(codeString))
+          return N;
+        throw new FHIRException("Unknown V3GenderStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case I: return "I";
+            case N: return "N";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/GenderStatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case I: return "Reproductively intact";
+            case N: return "Reproductively neutered";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case I: return "Intact";
+            case N: return "Neutered";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GenderStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GenderStatusEnumFactory.java
new file mode 100644
index 00000000000..c3eb41a80d7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3GenderStatusEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3GenderStatusEnumFactory implements EnumFactory {
+
+  public V3GenderStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("I".equals(codeString))
+      return V3GenderStatus.I;
+    if ("N".equals(codeString))
+      return V3GenderStatus.N;
+    throw new IllegalArgumentException("Unknown V3GenderStatus code '"+codeString+"'");
+  }
+
+  public String toCode(V3GenderStatus code) {
+    if (code == V3GenderStatus.I)
+      return "I";
+    if (code == V3GenderStatus.N)
+      return "N";
+    return "?";
+  }
+
+    public String toSystem(V3GenderStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HL7UpdateMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HL7UpdateMode.java
new file mode 100644
index 00000000000..23246e8d9b1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HL7UpdateMode.java
@@ -0,0 +1,213 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3HL7UpdateMode {
+
+        /**
+         * Description:The item was (or is to be) added, having not been present immediately before. (If it is already present, this may be treated as an error condition.)
+         */
+        A, 
+        /**
+         * Description:The item was (or is to be) either added or replaced.
+         */
+        AR, 
+        /**
+         * Description:The item was (or is to be) removed (sometimes referred to as deleted). If the item is part of a collection, delete any matching items.
+         */
+        D, 
+        /**
+         * Description:This item is part of the identifying information for this object.
+         */
+        K, 
+        /**
+         * Description:There was (or is to be) no change to the item. This is primarily used when this element has not changed, but other attributes in the instance have changed.
+         */
+        N, 
+        /**
+         * Description:The item existed previously and has (or is to be) revised. (If an item does not already exist, this may be treated as an error condition.)
+         */
+        R, 
+        /**
+         * Description:This item provides enough information to allow a processing system to locate the full applicable record by identifying the object.
+         */
+        REF, 
+        /**
+         * Description:Description:It is not specified whether or what kind of change has occurred to the item, or whether the item is present as a reference or identifying property.
+         */
+        U, 
+        /**
+         * These concepts apply when the element and/or message is updating a set of items.
+         */
+        _SETUPDATEMODE, 
+        /**
+         * Add the message element to the collection of items on the receiving system that correspond to the message element.
+         */
+        ESA, 
+        /**
+         * Change the item on the receiving system that corresponds to this message element; if a matching element does not exist, add a new one created with the values in the message.
+         */
+        ESAC, 
+        /**
+         * Change the item on the receiving system that corresponds to this message element; do not process if a matching element does not exist.
+         */
+        ESC, 
+        /**
+         * Delete the item on the receiving system that corresponds to this message element.
+         */
+        ESD, 
+        /**
+         * Description: AU: If this item exists, update it with these values. If it does not exist, create it with these values. If the item is part of the collection, update each item that matches this item, and if no items match, add a new item to the collection.
+         */
+        AU, 
+        /**
+         * Ignore this role, it is not relevant to the update.
+         */
+        I, 
+        /**
+         * Verify - this message element must match a value already in the receiving systems database in order to process the message.
+         */
+        V, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3HL7UpdateMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("A".equals(codeString))
+          return A;
+        if ("AR".equals(codeString))
+          return AR;
+        if ("D".equals(codeString))
+          return D;
+        if ("K".equals(codeString))
+          return K;
+        if ("N".equals(codeString))
+          return N;
+        if ("R".equals(codeString))
+          return R;
+        if ("REF".equals(codeString))
+          return REF;
+        if ("U".equals(codeString))
+          return U;
+        if ("_SetUpdateMode".equals(codeString))
+          return _SETUPDATEMODE;
+        if ("ESA".equals(codeString))
+          return ESA;
+        if ("ESAC".equals(codeString))
+          return ESAC;
+        if ("ESC".equals(codeString))
+          return ESC;
+        if ("ESD".equals(codeString))
+          return ESD;
+        if ("AU".equals(codeString))
+          return AU;
+        if ("I".equals(codeString))
+          return I;
+        if ("V".equals(codeString))
+          return V;
+        throw new FHIRException("Unknown V3HL7UpdateMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A: return "A";
+            case AR: return "AR";
+            case D: return "D";
+            case K: return "K";
+            case N: return "N";
+            case R: return "R";
+            case REF: return "REF";
+            case U: return "U";
+            case _SETUPDATEMODE: return "_SetUpdateMode";
+            case ESA: return "ESA";
+            case ESAC: return "ESAC";
+            case ESC: return "ESC";
+            case ESD: return "ESD";
+            case AU: return "AU";
+            case I: return "I";
+            case V: return "V";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/HL7UpdateMode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A: return "Description:The item was (or is to be) added, having not been present immediately before. (If it is already present, this may be treated as an error condition.)";
+            case AR: return "Description:The item was (or is to be) either added or replaced.";
+            case D: return "Description:The item was (or is to be) removed (sometimes referred to as deleted). If the item is part of a collection, delete any matching items.";
+            case K: return "Description:This item is part of the identifying information for this object.";
+            case N: return "Description:There was (or is to be) no change to the item. This is primarily used when this element has not changed, but other attributes in the instance have changed.";
+            case R: return "Description:The item existed previously and has (or is to be) revised. (If an item does not already exist, this may be treated as an error condition.)";
+            case REF: return "Description:This item provides enough information to allow a processing system to locate the full applicable record by identifying the object.";
+            case U: return "Description:Description:It is not specified whether or what kind of change has occurred to the item, or whether the item is present as a reference or identifying property.";
+            case _SETUPDATEMODE: return "These concepts apply when the element and/or message is updating a set of items.";
+            case ESA: return "Add the message element to the collection of items on the receiving system that correspond to the message element.";
+            case ESAC: return "Change the item on the receiving system that corresponds to this message element; if a matching element does not exist, add a new one created with the values in the message.";
+            case ESC: return "Change the item on the receiving system that corresponds to this message element; do not process if a matching element does not exist.";
+            case ESD: return "Delete the item on the receiving system that corresponds to this message element.";
+            case AU: return "Description: AU: If this item exists, update it with these values. If it does not exist, create it with these values. If the item is part of the collection, update each item that matches this item, and if no items match, add a new item to the collection.";
+            case I: return "Ignore this role, it is not relevant to the update.";
+            case V: return "Verify - this message element must match a value already in the receiving systems database in order to process the message.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A: return "Add";
+            case AR: return "Add or Replace";
+            case D: return "Remove";
+            case K: return "Key";
+            case N: return "No Change";
+            case R: return "Replace";
+            case REF: return "Reference";
+            case U: return "Unknown";
+            case _SETUPDATEMODE: return "SetUpdateMode";
+            case ESA: return "Set Add";
+            case ESAC: return "Set Add or Change";
+            case ESC: return "Set Change";
+            case ESD: return "Set Delete";
+            case AU: return "Add or Update";
+            case I: return "Ignore";
+            case V: return "Verify";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HL7UpdateModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HL7UpdateModeEnumFactory.java
new file mode 100644
index 00000000000..6fd11dbdcbf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HL7UpdateModeEnumFactory.java
@@ -0,0 +1,118 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3HL7UpdateModeEnumFactory implements EnumFactory {
+
+  public V3HL7UpdateMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("A".equals(codeString))
+      return V3HL7UpdateMode.A;
+    if ("AR".equals(codeString))
+      return V3HL7UpdateMode.AR;
+    if ("D".equals(codeString))
+      return V3HL7UpdateMode.D;
+    if ("K".equals(codeString))
+      return V3HL7UpdateMode.K;
+    if ("N".equals(codeString))
+      return V3HL7UpdateMode.N;
+    if ("R".equals(codeString))
+      return V3HL7UpdateMode.R;
+    if ("REF".equals(codeString))
+      return V3HL7UpdateMode.REF;
+    if ("U".equals(codeString))
+      return V3HL7UpdateMode.U;
+    if ("_SetUpdateMode".equals(codeString))
+      return V3HL7UpdateMode._SETUPDATEMODE;
+    if ("ESA".equals(codeString))
+      return V3HL7UpdateMode.ESA;
+    if ("ESAC".equals(codeString))
+      return V3HL7UpdateMode.ESAC;
+    if ("ESC".equals(codeString))
+      return V3HL7UpdateMode.ESC;
+    if ("ESD".equals(codeString))
+      return V3HL7UpdateMode.ESD;
+    if ("AU".equals(codeString))
+      return V3HL7UpdateMode.AU;
+    if ("I".equals(codeString))
+      return V3HL7UpdateMode.I;
+    if ("V".equals(codeString))
+      return V3HL7UpdateMode.V;
+    throw new IllegalArgumentException("Unknown V3HL7UpdateMode code '"+codeString+"'");
+  }
+
+  public String toCode(V3HL7UpdateMode code) {
+    if (code == V3HL7UpdateMode.A)
+      return "A";
+    if (code == V3HL7UpdateMode.AR)
+      return "AR";
+    if (code == V3HL7UpdateMode.D)
+      return "D";
+    if (code == V3HL7UpdateMode.K)
+      return "K";
+    if (code == V3HL7UpdateMode.N)
+      return "N";
+    if (code == V3HL7UpdateMode.R)
+      return "R";
+    if (code == V3HL7UpdateMode.REF)
+      return "REF";
+    if (code == V3HL7UpdateMode.U)
+      return "U";
+    if (code == V3HL7UpdateMode._SETUPDATEMODE)
+      return "_SetUpdateMode";
+    if (code == V3HL7UpdateMode.ESA)
+      return "ESA";
+    if (code == V3HL7UpdateMode.ESAC)
+      return "ESAC";
+    if (code == V3HL7UpdateMode.ESC)
+      return "ESC";
+    if (code == V3HL7UpdateMode.ESD)
+      return "ESD";
+    if (code == V3HL7UpdateMode.AU)
+      return "AU";
+    if (code == V3HL7UpdateMode.I)
+      return "I";
+    if (code == V3HL7UpdateMode.V)
+      return "V";
+    return "?";
+  }
+
+    public String toSystem(V3HL7UpdateMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7Realm.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7Realm.java
new file mode 100644
index 00000000000..ca3a6bb665f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7Realm.java
@@ -0,0 +1,474 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3Hl7Realm {
+
+        /**
+         * Description: Concepts that can be used as Binding Realms when creating Binding Statements.  These codes are permitted to appear in the InfrastructureRoot.realmCode attribute.
+         */
+        BINDINGREALMS, 
+        /**
+         * Description: Realm codes for official HL7 organizational bodies.  This includes both the HL7 International organization as well as all recognized international affiliates (past and present).  These groups have the ability to bind vocabulary and develop artifacts.  As well, they have the ability to have "ownership" over other binding realms and namespace realms via the owningAffiliate property of those other realm codes.
+         */
+        AFFILIATEREALMS, 
+        /**
+         * Description: Realm code for use of Argentina
+         */
+        AR, 
+        /**
+         * Description: Realm code for use of Austria
+         */
+        AT, 
+        /**
+         * Description: Realm code for use of Australia
+         */
+        AU, 
+        /**
+         * Description: Realm code for use of Brazil
+         */
+        BR, 
+        /**
+         * Description: Realm code for use of Canada
+         */
+        CA, 
+        /**
+         * Description: Realm code for use of Switzerland
+         */
+        CH, 
+        /**
+         * Description: Realm code for use of Chile
+         */
+        CL, 
+        /**
+         * Description: Realm code for use of China
+         */
+        CN, 
+        /**
+         * Description: Realm code for use of Localized Version
+         */
+        CO, 
+        /**
+         * Description: Realm code for use of Czech Republic
+         */
+        CZ, 
+        /**
+         * Description: Realm code for use of Germany
+         */
+        DE, 
+        /**
+         * Description: Realm code for use of Denmark
+         */
+        DK, 
+        /**
+         * Description: Realm code for use of Spain
+         */
+        ES, 
+        /**
+         * Description: Realm code for use of Finland
+         */
+        FI, 
+        /**
+         * Description: Realm code for use of France
+         */
+        FR, 
+        /**
+         * Description: Realm code for use of Greece
+         */
+        GR, 
+        /**
+         * Description: Realm code for use of Croatia
+         */
+        HR, 
+        /**
+         * Description: Realm code for use of Ireland
+         */
+        IE, 
+        /**
+         * Description: Realm code for use of India
+         */
+        IN, 
+        /**
+         * Description: Realm code for use of Italy
+         */
+        IT, 
+        /**
+         * Description: Realm code for use of Japan
+         */
+        JP, 
+        /**
+         * Description: Realm code for use of Korea
+         */
+        KR, 
+        /**
+         * Description: Realm code for use of Lithuania
+         */
+        LT, 
+        /**
+         * Description: Realm code for use of Mexico
+         */
+        MX, 
+        /**
+         * Description: Realm code for use of The Netherlands
+         */
+        NL, 
+        /**
+         * Description: Realm code for use of New Zealand
+         */
+        NZ, 
+        /**
+         * Description: Realm code for use of Romania
+         */
+        RO, 
+        /**
+         * Description: Realm code for use of Russian Federation
+         */
+        RU, 
+        /**
+         * Description: Realm code for use of Sweden
+         */
+        SE, 
+        /**
+         * Description: Realm code for use of Localized Version
+         */
+        SG, 
+        /**
+         * Description: Realm code for use of Southern Africa
+         */
+        SOA, 
+        /**
+         * Description: Realm code for use of Turkey
+         */
+        TR, 
+        /**
+         * Description: Realm code for use of Taiwan
+         */
+        TW, 
+        /**
+         * Description: Realm code for use of United Kingdom
+         */
+        UK, 
+        /**
+         * Description: Realm code for use of United States of America
+         */
+        US, 
+        /**
+         * Description: Realm code for use of Universal realm or context, used in every instance
+         */
+        UV, 
+        /**
+         * Description: Realm code for use of Uruguay
+         */
+        UY, 
+        /**
+         * Description: Realm code for use of Unclassified Realm
+         */
+        C1, 
+        /**
+         * Description: Realm code for use of Great Britain
+         */
+        GB, 
+        /**
+         * Description: Realm code for use of Representative Realm
+         */
+        R1, 
+        /**
+         * Description: Realm code for use of Example Realm
+         */
+        X1, 
+        /**
+         * Description: Codes that can be used in the "realm" portion of HL7 v3 artifact identifiers.
+         */
+        NAMESPACEREALMS, 
+        /**
+         * Description: An artifact created for local use only.  This realm namespace has no owning affiliate.  Its use is uncontrolled, i.e. anyone can create artifacts using this realm namespace.  Because of this, there is a significant likelihood of artifact identifier collisions.  Implementers are encouraged to register their artifacts under an affiliate owned and controlled namespace to avoid such collision problems where possible.
+         */
+        ZZ, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3Hl7Realm fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("BindingRealms".equals(codeString))
+          return BINDINGREALMS;
+        if ("AffiliateRealms".equals(codeString))
+          return AFFILIATEREALMS;
+        if ("AR".equals(codeString))
+          return AR;
+        if ("AT".equals(codeString))
+          return AT;
+        if ("AU".equals(codeString))
+          return AU;
+        if ("BR".equals(codeString))
+          return BR;
+        if ("CA".equals(codeString))
+          return CA;
+        if ("CH".equals(codeString))
+          return CH;
+        if ("CL".equals(codeString))
+          return CL;
+        if ("CN".equals(codeString))
+          return CN;
+        if ("CO".equals(codeString))
+          return CO;
+        if ("CZ".equals(codeString))
+          return CZ;
+        if ("DE".equals(codeString))
+          return DE;
+        if ("DK".equals(codeString))
+          return DK;
+        if ("ES".equals(codeString))
+          return ES;
+        if ("FI".equals(codeString))
+          return FI;
+        if ("FR".equals(codeString))
+          return FR;
+        if ("GR".equals(codeString))
+          return GR;
+        if ("HR".equals(codeString))
+          return HR;
+        if ("IE".equals(codeString))
+          return IE;
+        if ("IN".equals(codeString))
+          return IN;
+        if ("IT".equals(codeString))
+          return IT;
+        if ("JP".equals(codeString))
+          return JP;
+        if ("KR".equals(codeString))
+          return KR;
+        if ("LT".equals(codeString))
+          return LT;
+        if ("MX".equals(codeString))
+          return MX;
+        if ("NL".equals(codeString))
+          return NL;
+        if ("NZ".equals(codeString))
+          return NZ;
+        if ("RO".equals(codeString))
+          return RO;
+        if ("RU".equals(codeString))
+          return RU;
+        if ("SE".equals(codeString))
+          return SE;
+        if ("SG".equals(codeString))
+          return SG;
+        if ("SOA".equals(codeString))
+          return SOA;
+        if ("TR".equals(codeString))
+          return TR;
+        if ("TW".equals(codeString))
+          return TW;
+        if ("UK".equals(codeString))
+          return UK;
+        if ("US".equals(codeString))
+          return US;
+        if ("UV".equals(codeString))
+          return UV;
+        if ("UY".equals(codeString))
+          return UY;
+        if ("C1".equals(codeString))
+          return C1;
+        if ("GB".equals(codeString))
+          return GB;
+        if ("R1".equals(codeString))
+          return R1;
+        if ("X1".equals(codeString))
+          return X1;
+        if ("NamespaceRealms".equals(codeString))
+          return NAMESPACEREALMS;
+        if ("ZZ".equals(codeString))
+          return ZZ;
+        throw new FHIRException("Unknown V3Hl7Realm code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BINDINGREALMS: return "BindingRealms";
+            case AFFILIATEREALMS: return "AffiliateRealms";
+            case AR: return "AR";
+            case AT: return "AT";
+            case AU: return "AU";
+            case BR: return "BR";
+            case CA: return "CA";
+            case CH: return "CH";
+            case CL: return "CL";
+            case CN: return "CN";
+            case CO: return "CO";
+            case CZ: return "CZ";
+            case DE: return "DE";
+            case DK: return "DK";
+            case ES: return "ES";
+            case FI: return "FI";
+            case FR: return "FR";
+            case GR: return "GR";
+            case HR: return "HR";
+            case IE: return "IE";
+            case IN: return "IN";
+            case IT: return "IT";
+            case JP: return "JP";
+            case KR: return "KR";
+            case LT: return "LT";
+            case MX: return "MX";
+            case NL: return "NL";
+            case NZ: return "NZ";
+            case RO: return "RO";
+            case RU: return "RU";
+            case SE: return "SE";
+            case SG: return "SG";
+            case SOA: return "SOA";
+            case TR: return "TR";
+            case TW: return "TW";
+            case UK: return "UK";
+            case US: return "US";
+            case UV: return "UV";
+            case UY: return "UY";
+            case C1: return "C1";
+            case GB: return "GB";
+            case R1: return "R1";
+            case X1: return "X1";
+            case NAMESPACEREALMS: return "NamespaceRealms";
+            case ZZ: return "ZZ";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/hl7Realm";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BINDINGREALMS: return "Description: Concepts that can be used as Binding Realms when creating Binding Statements.  These codes are permitted to appear in the InfrastructureRoot.realmCode attribute.";
+            case AFFILIATEREALMS: return "Description: Realm codes for official HL7 organizational bodies.  This includes both the HL7 International organization as well as all recognized international affiliates (past and present).  These groups have the ability to bind vocabulary and develop artifacts.  As well, they have the ability to have \"ownership\" over other binding realms and namespace realms via the owningAffiliate property of those other realm codes.";
+            case AR: return "Description: Realm code for use of Argentina";
+            case AT: return "Description: Realm code for use of Austria";
+            case AU: return "Description: Realm code for use of Australia";
+            case BR: return "Description: Realm code for use of Brazil";
+            case CA: return "Description: Realm code for use of Canada";
+            case CH: return "Description: Realm code for use of Switzerland";
+            case CL: return "Description: Realm code for use of Chile";
+            case CN: return "Description: Realm code for use of China";
+            case CO: return "Description: Realm code for use of Localized Version";
+            case CZ: return "Description: Realm code for use of Czech Republic";
+            case DE: return "Description: Realm code for use of Germany";
+            case DK: return "Description: Realm code for use of Denmark";
+            case ES: return "Description: Realm code for use of Spain";
+            case FI: return "Description: Realm code for use of Finland";
+            case FR: return "Description: Realm code for use of France";
+            case GR: return "Description: Realm code for use of Greece";
+            case HR: return "Description: Realm code for use of Croatia";
+            case IE: return "Description: Realm code for use of Ireland";
+            case IN: return "Description: Realm code for use of India";
+            case IT: return "Description: Realm code for use of Italy";
+            case JP: return "Description: Realm code for use of Japan";
+            case KR: return "Description: Realm code for use of Korea";
+            case LT: return "Description: Realm code for use of Lithuania";
+            case MX: return "Description: Realm code for use of Mexico";
+            case NL: return "Description: Realm code for use of The Netherlands";
+            case NZ: return "Description: Realm code for use of New Zealand";
+            case RO: return "Description: Realm code for use of Romania";
+            case RU: return "Description: Realm code for use of Russian Federation";
+            case SE: return "Description: Realm code for use of Sweden";
+            case SG: return "Description: Realm code for use of Localized Version";
+            case SOA: return "Description: Realm code for use of Southern Africa";
+            case TR: return "Description: Realm code for use of Turkey";
+            case TW: return "Description: Realm code for use of Taiwan";
+            case UK: return "Description: Realm code for use of United Kingdom";
+            case US: return "Description: Realm code for use of United States of America";
+            case UV: return "Description: Realm code for use of Universal realm or context, used in every instance";
+            case UY: return "Description: Realm code for use of Uruguay";
+            case C1: return "Description: Realm code for use of Unclassified Realm";
+            case GB: return "Description: Realm code for use of Great Britain";
+            case R1: return "Description: Realm code for use of Representative Realm";
+            case X1: return "Description: Realm code for use of Example Realm";
+            case NAMESPACEREALMS: return "Description: Codes that can be used in the \"realm\" portion of HL7 v3 artifact identifiers.";
+            case ZZ: return "Description: An artifact created for local use only.  This realm namespace has no owning affiliate.  Its use is uncontrolled, i.e. anyone can create artifacts using this realm namespace.  Because of this, there is a significant likelihood of artifact identifier collisions.  Implementers are encouraged to register their artifacts under an affiliate owned and controlled namespace to avoid such collision problems where possible.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BINDINGREALMS: return "binding realms";
+            case AFFILIATEREALMS: return "Affiliate Realms";
+            case AR: return "Argentina";
+            case AT: return "Austria";
+            case AU: return "Australia";
+            case BR: return "Brazil";
+            case CA: return "Canada";
+            case CH: return "Switzerland";
+            case CL: return "Chile";
+            case CN: return "China";
+            case CO: return "Columbia";
+            case CZ: return "Czech Republic";
+            case DE: return "Germany";
+            case DK: return "Denmark";
+            case ES: return "Spain";
+            case FI: return "Finland";
+            case FR: return "France";
+            case GR: return "Greece";
+            case HR: return "Croatia";
+            case IE: return "Ireland";
+            case IN: return "India";
+            case IT: return "Italy";
+            case JP: return "Japan";
+            case KR: return "Korea";
+            case LT: return "Lithuania";
+            case MX: return "Mexico";
+            case NL: return "The Netherlands";
+            case NZ: return "New Zealand";
+            case RO: return "Romania";
+            case RU: return "Russian Federation";
+            case SE: return "Sweden";
+            case SG: return "Singapore";
+            case SOA: return "Southern Africa";
+            case TR: return "Turkey";
+            case TW: return "Taiwan";
+            case UK: return "United Kingdom";
+            case US: return "United States of America";
+            case UV: return "Universal";
+            case UY: return "Uruguay";
+            case C1: return "Unclassified Realm";
+            case GB: return "Great Britain";
+            case R1: return "Representative Realm";
+            case X1: return "Example Realm";
+            case NAMESPACEREALMS: return "namespace realms";
+            case ZZ: return "Localized Version";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7RealmEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7RealmEnumFactory.java
new file mode 100644
index 00000000000..c296a45511d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7RealmEnumFactory.java
@@ -0,0 +1,234 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3Hl7RealmEnumFactory implements EnumFactory {
+
+  public V3Hl7Realm fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("BindingRealms".equals(codeString))
+      return V3Hl7Realm.BINDINGREALMS;
+    if ("AffiliateRealms".equals(codeString))
+      return V3Hl7Realm.AFFILIATEREALMS;
+    if ("AR".equals(codeString))
+      return V3Hl7Realm.AR;
+    if ("AT".equals(codeString))
+      return V3Hl7Realm.AT;
+    if ("AU".equals(codeString))
+      return V3Hl7Realm.AU;
+    if ("BR".equals(codeString))
+      return V3Hl7Realm.BR;
+    if ("CA".equals(codeString))
+      return V3Hl7Realm.CA;
+    if ("CH".equals(codeString))
+      return V3Hl7Realm.CH;
+    if ("CL".equals(codeString))
+      return V3Hl7Realm.CL;
+    if ("CN".equals(codeString))
+      return V3Hl7Realm.CN;
+    if ("CO".equals(codeString))
+      return V3Hl7Realm.CO;
+    if ("CZ".equals(codeString))
+      return V3Hl7Realm.CZ;
+    if ("DE".equals(codeString))
+      return V3Hl7Realm.DE;
+    if ("DK".equals(codeString))
+      return V3Hl7Realm.DK;
+    if ("ES".equals(codeString))
+      return V3Hl7Realm.ES;
+    if ("FI".equals(codeString))
+      return V3Hl7Realm.FI;
+    if ("FR".equals(codeString))
+      return V3Hl7Realm.FR;
+    if ("GR".equals(codeString))
+      return V3Hl7Realm.GR;
+    if ("HR".equals(codeString))
+      return V3Hl7Realm.HR;
+    if ("IE".equals(codeString))
+      return V3Hl7Realm.IE;
+    if ("IN".equals(codeString))
+      return V3Hl7Realm.IN;
+    if ("IT".equals(codeString))
+      return V3Hl7Realm.IT;
+    if ("JP".equals(codeString))
+      return V3Hl7Realm.JP;
+    if ("KR".equals(codeString))
+      return V3Hl7Realm.KR;
+    if ("LT".equals(codeString))
+      return V3Hl7Realm.LT;
+    if ("MX".equals(codeString))
+      return V3Hl7Realm.MX;
+    if ("NL".equals(codeString))
+      return V3Hl7Realm.NL;
+    if ("NZ".equals(codeString))
+      return V3Hl7Realm.NZ;
+    if ("RO".equals(codeString))
+      return V3Hl7Realm.RO;
+    if ("RU".equals(codeString))
+      return V3Hl7Realm.RU;
+    if ("SE".equals(codeString))
+      return V3Hl7Realm.SE;
+    if ("SG".equals(codeString))
+      return V3Hl7Realm.SG;
+    if ("SOA".equals(codeString))
+      return V3Hl7Realm.SOA;
+    if ("TR".equals(codeString))
+      return V3Hl7Realm.TR;
+    if ("TW".equals(codeString))
+      return V3Hl7Realm.TW;
+    if ("UK".equals(codeString))
+      return V3Hl7Realm.UK;
+    if ("US".equals(codeString))
+      return V3Hl7Realm.US;
+    if ("UV".equals(codeString))
+      return V3Hl7Realm.UV;
+    if ("UY".equals(codeString))
+      return V3Hl7Realm.UY;
+    if ("C1".equals(codeString))
+      return V3Hl7Realm.C1;
+    if ("GB".equals(codeString))
+      return V3Hl7Realm.GB;
+    if ("R1".equals(codeString))
+      return V3Hl7Realm.R1;
+    if ("X1".equals(codeString))
+      return V3Hl7Realm.X1;
+    if ("NamespaceRealms".equals(codeString))
+      return V3Hl7Realm.NAMESPACEREALMS;
+    if ("ZZ".equals(codeString))
+      return V3Hl7Realm.ZZ;
+    throw new IllegalArgumentException("Unknown V3Hl7Realm code '"+codeString+"'");
+  }
+
+  public String toCode(V3Hl7Realm code) {
+    if (code == V3Hl7Realm.BINDINGREALMS)
+      return "BindingRealms";
+    if (code == V3Hl7Realm.AFFILIATEREALMS)
+      return "AffiliateRealms";
+    if (code == V3Hl7Realm.AR)
+      return "AR";
+    if (code == V3Hl7Realm.AT)
+      return "AT";
+    if (code == V3Hl7Realm.AU)
+      return "AU";
+    if (code == V3Hl7Realm.BR)
+      return "BR";
+    if (code == V3Hl7Realm.CA)
+      return "CA";
+    if (code == V3Hl7Realm.CH)
+      return "CH";
+    if (code == V3Hl7Realm.CL)
+      return "CL";
+    if (code == V3Hl7Realm.CN)
+      return "CN";
+    if (code == V3Hl7Realm.CO)
+      return "CO";
+    if (code == V3Hl7Realm.CZ)
+      return "CZ";
+    if (code == V3Hl7Realm.DE)
+      return "DE";
+    if (code == V3Hl7Realm.DK)
+      return "DK";
+    if (code == V3Hl7Realm.ES)
+      return "ES";
+    if (code == V3Hl7Realm.FI)
+      return "FI";
+    if (code == V3Hl7Realm.FR)
+      return "FR";
+    if (code == V3Hl7Realm.GR)
+      return "GR";
+    if (code == V3Hl7Realm.HR)
+      return "HR";
+    if (code == V3Hl7Realm.IE)
+      return "IE";
+    if (code == V3Hl7Realm.IN)
+      return "IN";
+    if (code == V3Hl7Realm.IT)
+      return "IT";
+    if (code == V3Hl7Realm.JP)
+      return "JP";
+    if (code == V3Hl7Realm.KR)
+      return "KR";
+    if (code == V3Hl7Realm.LT)
+      return "LT";
+    if (code == V3Hl7Realm.MX)
+      return "MX";
+    if (code == V3Hl7Realm.NL)
+      return "NL";
+    if (code == V3Hl7Realm.NZ)
+      return "NZ";
+    if (code == V3Hl7Realm.RO)
+      return "RO";
+    if (code == V3Hl7Realm.RU)
+      return "RU";
+    if (code == V3Hl7Realm.SE)
+      return "SE";
+    if (code == V3Hl7Realm.SG)
+      return "SG";
+    if (code == V3Hl7Realm.SOA)
+      return "SOA";
+    if (code == V3Hl7Realm.TR)
+      return "TR";
+    if (code == V3Hl7Realm.TW)
+      return "TW";
+    if (code == V3Hl7Realm.UK)
+      return "UK";
+    if (code == V3Hl7Realm.US)
+      return "US";
+    if (code == V3Hl7Realm.UV)
+      return "UV";
+    if (code == V3Hl7Realm.UY)
+      return "UY";
+    if (code == V3Hl7Realm.C1)
+      return "C1";
+    if (code == V3Hl7Realm.GB)
+      return "GB";
+    if (code == V3Hl7Realm.R1)
+      return "R1";
+    if (code == V3Hl7Realm.X1)
+      return "X1";
+    if (code == V3Hl7Realm.NAMESPACEREALMS)
+      return "NamespaceRealms";
+    if (code == V3Hl7Realm.ZZ)
+      return "ZZ";
+    return "?";
+  }
+
+    public String toSystem(V3Hl7Realm code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7V3Conformance.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7V3Conformance.java
new file mode 100644
index 00000000000..9b913b091ac
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7V3Conformance.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3Hl7V3Conformance {
+
+        /**
+         * Description: Implementers receiving this property must not raise an error if the data is received, but will not perform any useful function with the data.  This conformance level is not used in profiles or other artifacts that are specific to the "sender" or "initiator" of a communication.
+         */
+        I, 
+        /**
+         * Description: All implementers are prohibited from transmitting this content, and may raise an error if they receive it.
+         */
+        NP, 
+        /**
+         * Description: All implementers must support this property.  I.e. they must be able to transmit, or to receive and usefully handle the concept.
+         */
+        R, 
+        /**
+         * Description: The element is considered "required" (i.e. must be supported) from the perspective of systems that consume  instances, but is "undetermined" for systems that generate instances.  Used only as part of specifications that define both initiator and consumer expectations.
+         */
+        RC, 
+        /**
+         * Description: The element is considered "required" (i.e. must be supported) from the perspective of systems that generate instances, but is "undetermined" for systems that consume instances.  Used only as part of specifications that define both initiator and consumer expectations.
+         */
+        RI, 
+        /**
+         * Description: The conformance expectations for this element have not yet been determined.
+         */
+        U, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3Hl7V3Conformance fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("I".equals(codeString))
+          return I;
+        if ("NP".equals(codeString))
+          return NP;
+        if ("R".equals(codeString))
+          return R;
+        if ("RC".equals(codeString))
+          return RC;
+        if ("RI".equals(codeString))
+          return RI;
+        if ("U".equals(codeString))
+          return U;
+        throw new FHIRException("Unknown V3Hl7V3Conformance code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case I: return "I";
+            case NP: return "NP";
+            case R: return "R";
+            case RC: return "RC";
+            case RI: return "RI";
+            case U: return "U";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/hl7V3Conformance";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case I: return "Description: Implementers receiving this property must not raise an error if the data is received, but will not perform any useful function with the data.  This conformance level is not used in profiles or other artifacts that are specific to the \"sender\" or \"initiator\" of a communication.";
+            case NP: return "Description: All implementers are prohibited from transmitting this content, and may raise an error if they receive it.";
+            case R: return "Description: All implementers must support this property.  I.e. they must be able to transmit, or to receive and usefully handle the concept.";
+            case RC: return "Description: The element is considered \"required\" (i.e. must be supported) from the perspective of systems that consume  instances, but is \"undetermined\" for systems that generate instances.  Used only as part of specifications that define both initiator and consumer expectations.";
+            case RI: return "Description: The element is considered \"required\" (i.e. must be supported) from the perspective of systems that generate instances, but is \"undetermined\" for systems that consume instances.  Used only as part of specifications that define both initiator and consumer expectations.";
+            case U: return "Description: The conformance expectations for this element have not yet been determined.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case I: return "ignored";
+            case NP: return "not permitted";
+            case R: return "required";
+            case RC: return "required for consumer";
+            case RI: return "required for initiator";
+            case U: return "undetermined";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7V3ConformanceEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7V3ConformanceEnumFactory.java
new file mode 100644
index 00000000000..91a25b3c5d5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Hl7V3ConformanceEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3Hl7V3ConformanceEnumFactory implements EnumFactory {
+
+  public V3Hl7V3Conformance fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("I".equals(codeString))
+      return V3Hl7V3Conformance.I;
+    if ("NP".equals(codeString))
+      return V3Hl7V3Conformance.NP;
+    if ("R".equals(codeString))
+      return V3Hl7V3Conformance.R;
+    if ("RC".equals(codeString))
+      return V3Hl7V3Conformance.RC;
+    if ("RI".equals(codeString))
+      return V3Hl7V3Conformance.RI;
+    if ("U".equals(codeString))
+      return V3Hl7V3Conformance.U;
+    throw new IllegalArgumentException("Unknown V3Hl7V3Conformance code '"+codeString+"'");
+  }
+
+  public String toCode(V3Hl7V3Conformance code) {
+    if (code == V3Hl7V3Conformance.I)
+      return "I";
+    if (code == V3Hl7V3Conformance.NP)
+      return "NP";
+    if (code == V3Hl7V3Conformance.R)
+      return "R";
+    if (code == V3Hl7V3Conformance.RC)
+      return "RC";
+    if (code == V3Hl7V3Conformance.RI)
+      return "RI";
+    if (code == V3Hl7V3Conformance.U)
+      return "U";
+    return "?";
+  }
+
+    public String toSystem(V3Hl7V3Conformance code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HtmlLinkType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HtmlLinkType.java
new file mode 100644
index 00000000000..3124c2f69b5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HtmlLinkType.java
@@ -0,0 +1,204 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3HtmlLinkType {
+
+        /**
+         * Designates substitute versions for the document in which the link occurs. When used together with the lang attribute, it implies a translated version of the document. When used together with the media attribute, it implies a version designed for a different medium (or media).
+         */
+        ALTERNATE, 
+        /**
+         * Refers to a document serving as an appendix in a collection of documents.
+         */
+        APPENDIX, 
+        /**
+         * Refers to a bookmark. A bookmark is a link to a key entry point within an extended document. The title attribute may be used, for example, to label the bookmark. Note that several bookmarks may be defined in each document.
+         */
+        BOOKMARK, 
+        /**
+         * Refers to a document serving as a chapter in a collection of documents.
+         */
+        CHAPTER, 
+        /**
+         * Refers to a document serving as a table of contents. Some user agents also support the synonym ToC (from "Table of Contents").
+         */
+        CONTENTS, 
+        /**
+         * Refers to a copyright statement for the current document.
+         */
+        COPYRIGHT, 
+        /**
+         * Refers to a document providing a glossary of terms that pertain to the current document.
+         */
+        GLOSSARY, 
+        /**
+         * Refers to a document offering help (more information, links to other sources of information, etc.).
+         */
+        HELP, 
+        /**
+         * Refers to a document providing an index for the current document.
+         */
+        INDEX, 
+        /**
+         * Refers to the next document in a linear sequence of documents. User agents may choose to preload the "next" document, to reduce the perceived load time.
+         */
+        NEXT, 
+        /**
+         * Refers to the previous document in an ordered series of documents. Some user agents also support the synonym "Previous".
+         */
+        PREV, 
+        /**
+         * Refers to a document serving as a section in a collection of documents.
+         */
+        SECTION, 
+        /**
+         * Refers to the first document in a collection of documents. This link type tells search engines which document is considered by the author to be the starting point of the collection.
+         */
+        START, 
+        /**
+         * Refers to an external style sheet. See the section on external style sheets for details. This is used together with the link type "Alternate" for user-selectable alternate style sheets.
+         */
+        STYLESHEET, 
+        /**
+         * Refers to a document serving as a subsection in a collection of documents.
+         */
+        SUBSECTION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3HtmlLinkType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("alternate".equals(codeString))
+          return ALTERNATE;
+        if ("appendix".equals(codeString))
+          return APPENDIX;
+        if ("bookmark".equals(codeString))
+          return BOOKMARK;
+        if ("chapter".equals(codeString))
+          return CHAPTER;
+        if ("contents".equals(codeString))
+          return CONTENTS;
+        if ("copyright".equals(codeString))
+          return COPYRIGHT;
+        if ("glossary".equals(codeString))
+          return GLOSSARY;
+        if ("help".equals(codeString))
+          return HELP;
+        if ("index".equals(codeString))
+          return INDEX;
+        if ("next".equals(codeString))
+          return NEXT;
+        if ("prev".equals(codeString))
+          return PREV;
+        if ("section".equals(codeString))
+          return SECTION;
+        if ("start".equals(codeString))
+          return START;
+        if ("stylesheet".equals(codeString))
+          return STYLESHEET;
+        if ("subsection".equals(codeString))
+          return SUBSECTION;
+        throw new FHIRException("Unknown V3HtmlLinkType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ALTERNATE: return "alternate";
+            case APPENDIX: return "appendix";
+            case BOOKMARK: return "bookmark";
+            case CHAPTER: return "chapter";
+            case CONTENTS: return "contents";
+            case COPYRIGHT: return "copyright";
+            case GLOSSARY: return "glossary";
+            case HELP: return "help";
+            case INDEX: return "index";
+            case NEXT: return "next";
+            case PREV: return "prev";
+            case SECTION: return "section";
+            case START: return "start";
+            case STYLESHEET: return "stylesheet";
+            case SUBSECTION: return "subsection";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/HtmlLinkType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ALTERNATE: return "Designates substitute versions for the document in which the link occurs. When used together with the lang attribute, it implies a translated version of the document. When used together with the media attribute, it implies a version designed for a different medium (or media).";
+            case APPENDIX: return "Refers to a document serving as an appendix in a collection of documents.";
+            case BOOKMARK: return "Refers to a bookmark. A bookmark is a link to a key entry point within an extended document. The title attribute may be used, for example, to label the bookmark. Note that several bookmarks may be defined in each document.";
+            case CHAPTER: return "Refers to a document serving as a chapter in a collection of documents.";
+            case CONTENTS: return "Refers to a document serving as a table of contents. Some user agents also support the synonym ToC (from \"Table of Contents\").";
+            case COPYRIGHT: return "Refers to a copyright statement for the current document.";
+            case GLOSSARY: return "Refers to a document providing a glossary of terms that pertain to the current document.";
+            case HELP: return "Refers to a document offering help (more information, links to other sources of information, etc.).";
+            case INDEX: return "Refers to a document providing an index for the current document.";
+            case NEXT: return "Refers to the next document in a linear sequence of documents. User agents may choose to preload the \"next\" document, to reduce the perceived load time.";
+            case PREV: return "Refers to the previous document in an ordered series of documents. Some user agents also support the synonym \"Previous\".";
+            case SECTION: return "Refers to a document serving as a section in a collection of documents.";
+            case START: return "Refers to the first document in a collection of documents. This link type tells search engines which document is considered by the author to be the starting point of the collection.";
+            case STYLESHEET: return "Refers to an external style sheet. See the section on external style sheets for details. This is used together with the link type \"Alternate\" for user-selectable alternate style sheets.";
+            case SUBSECTION: return "Refers to a document serving as a subsection in a collection of documents.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ALTERNATE: return "alternate";
+            case APPENDIX: return "appendix";
+            case BOOKMARK: return "bookmark";
+            case CHAPTER: return "chapter";
+            case CONTENTS: return "contents";
+            case COPYRIGHT: return "copyright";
+            case GLOSSARY: return "glossary";
+            case HELP: return "help";
+            case INDEX: return "index";
+            case NEXT: return "next";
+            case PREV: return "prev";
+            case SECTION: return "section";
+            case START: return "start";
+            case STYLESHEET: return "stylesheet";
+            case SUBSECTION: return "subsection";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HtmlLinkTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HtmlLinkTypeEnumFactory.java
new file mode 100644
index 00000000000..86f23f031ef
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3HtmlLinkTypeEnumFactory.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3HtmlLinkTypeEnumFactory implements EnumFactory {
+
+  public V3HtmlLinkType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("alternate".equals(codeString))
+      return V3HtmlLinkType.ALTERNATE;
+    if ("appendix".equals(codeString))
+      return V3HtmlLinkType.APPENDIX;
+    if ("bookmark".equals(codeString))
+      return V3HtmlLinkType.BOOKMARK;
+    if ("chapter".equals(codeString))
+      return V3HtmlLinkType.CHAPTER;
+    if ("contents".equals(codeString))
+      return V3HtmlLinkType.CONTENTS;
+    if ("copyright".equals(codeString))
+      return V3HtmlLinkType.COPYRIGHT;
+    if ("glossary".equals(codeString))
+      return V3HtmlLinkType.GLOSSARY;
+    if ("help".equals(codeString))
+      return V3HtmlLinkType.HELP;
+    if ("index".equals(codeString))
+      return V3HtmlLinkType.INDEX;
+    if ("next".equals(codeString))
+      return V3HtmlLinkType.NEXT;
+    if ("prev".equals(codeString))
+      return V3HtmlLinkType.PREV;
+    if ("section".equals(codeString))
+      return V3HtmlLinkType.SECTION;
+    if ("start".equals(codeString))
+      return V3HtmlLinkType.START;
+    if ("stylesheet".equals(codeString))
+      return V3HtmlLinkType.STYLESHEET;
+    if ("subsection".equals(codeString))
+      return V3HtmlLinkType.SUBSECTION;
+    throw new IllegalArgumentException("Unknown V3HtmlLinkType code '"+codeString+"'");
+  }
+
+  public String toCode(V3HtmlLinkType code) {
+    if (code == V3HtmlLinkType.ALTERNATE)
+      return "alternate";
+    if (code == V3HtmlLinkType.APPENDIX)
+      return "appendix";
+    if (code == V3HtmlLinkType.BOOKMARK)
+      return "bookmark";
+    if (code == V3HtmlLinkType.CHAPTER)
+      return "chapter";
+    if (code == V3HtmlLinkType.CONTENTS)
+      return "contents";
+    if (code == V3HtmlLinkType.COPYRIGHT)
+      return "copyright";
+    if (code == V3HtmlLinkType.GLOSSARY)
+      return "glossary";
+    if (code == V3HtmlLinkType.HELP)
+      return "help";
+    if (code == V3HtmlLinkType.INDEX)
+      return "index";
+    if (code == V3HtmlLinkType.NEXT)
+      return "next";
+    if (code == V3HtmlLinkType.PREV)
+      return "prev";
+    if (code == V3HtmlLinkType.SECTION)
+      return "section";
+    if (code == V3HtmlLinkType.START)
+      return "start";
+    if (code == V3HtmlLinkType.STYLESHEET)
+      return "stylesheet";
+    if (code == V3HtmlLinkType.SUBSECTION)
+      return "subsection";
+    return "?";
+  }
+
+    public String toSystem(V3HtmlLinkType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierReliability.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierReliability.java
new file mode 100644
index 00000000000..7d1fb107c96
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierReliability.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3IdentifierReliability {
+
+        /**
+         * Description: The identifier was issued by the system responsible for constructing the instance.
+         */
+        ISS, 
+        /**
+         * Description: The identifier was provided to the system that constructed the instance, but has not been verified. e.g. a Drivers  license entered manually into a system by a user.
+         */
+        UNV, 
+        /**
+         * Description: The identifier was not issued by the system responsible for constructing the instance, but the system that captured the id has verified the identifier with the issuing authority, or with another system that has verified the identifier.
+         */
+        VRF, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3IdentifierReliability fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ISS".equals(codeString))
+          return ISS;
+        if ("UNV".equals(codeString))
+          return UNV;
+        if ("VRF".equals(codeString))
+          return VRF;
+        throw new FHIRException("Unknown V3IdentifierReliability code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ISS: return "ISS";
+            case UNV: return "UNV";
+            case VRF: return "VRF";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/IdentifierReliability";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ISS: return "Description: The identifier was issued by the system responsible for constructing the instance.";
+            case UNV: return "Description: The identifier was provided to the system that constructed the instance, but has not been verified. e.g. a Drivers  license entered manually into a system by a user.";
+            case VRF: return "Description: The identifier was not issued by the system responsible for constructing the instance, but the system that captured the id has verified the identifier with the issuing authority, or with another system that has verified the identifier.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ISS: return "Issued by System";
+            case UNV: return "Unverified by system";
+            case VRF: return "Verified by system";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierReliabilityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierReliabilityEnumFactory.java
new file mode 100644
index 00000000000..f3269f195a7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierReliabilityEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3IdentifierReliabilityEnumFactory implements EnumFactory {
+
+  public V3IdentifierReliability fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ISS".equals(codeString))
+      return V3IdentifierReliability.ISS;
+    if ("UNV".equals(codeString))
+      return V3IdentifierReliability.UNV;
+    if ("VRF".equals(codeString))
+      return V3IdentifierReliability.VRF;
+    throw new IllegalArgumentException("Unknown V3IdentifierReliability code '"+codeString+"'");
+  }
+
+  public String toCode(V3IdentifierReliability code) {
+    if (code == V3IdentifierReliability.ISS)
+      return "ISS";
+    if (code == V3IdentifierReliability.UNV)
+      return "UNV";
+    if (code == V3IdentifierReliability.VRF)
+      return "VRF";
+    return "?";
+  }
+
+    public String toSystem(V3IdentifierReliability code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierScope.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierScope.java
new file mode 100644
index 00000000000..888e34e6869
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierScope.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3IdentifierScope {
+
+        /**
+         * Description: An identifier whose scope is defined by the business practices associated with the object. In contrast to the other scope identifiers, the scope of the use of the id is not necessarily restricted to a single object, but may be reused for other objects closely associated with the object due to business practice.
+         */
+        BUSN, 
+        /**
+         * Description: The identifier associated with a particular object. It remains consistent as the object undergoes state transitions.
+         */
+        OBJ, 
+        /**
+         * Description: An identifier that references a particular object as it existed at a given point in time. The identifier SHALL change with each state transition on the object. I.e. The version identifier of an object prior to a 'suspend' state transition is distinct from the identifier of the object after the state transition. Each version identifier can be tied to exactly one ControlAct event which brought that version into being (though the control act may never be instantiated).
+
+                        
+                            NOTE: Applications that do not support versioning of objects must ignore and not persist these ids to avoid confusion resulting from leaving the same identifier on an object that undergoes changes.
+         */
+        VER, 
+        /**
+         * Description: An identifier that references a particular object as it existed at a given point in time. The identifier SHALL change with each state transition on the object.
+
+                        
+                           Example The version identifier of an object prior to a 'suspend' state transition is distinct from the identifier of the object after the state transition. Each version identifier can be tied to exactly one ControlAct event which brought that version into being (though the control act may never be instantiated).
+
+                        
+                            NOTE: Applications that do not support versioning of objects must ignore and not persist these ids to avoid confusion resulting from leaving the same identifier on an object that undergoes changes.
+         */
+        VW, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3IdentifierScope fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("BUSN".equals(codeString))
+          return BUSN;
+        if ("OBJ".equals(codeString))
+          return OBJ;
+        if ("VER".equals(codeString))
+          return VER;
+        if ("VW".equals(codeString))
+          return VW;
+        throw new FHIRException("Unknown V3IdentifierScope code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BUSN: return "BUSN";
+            case OBJ: return "OBJ";
+            case VER: return "VER";
+            case VW: return "VW";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/IdentifierScope";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BUSN: return "Description: An identifier whose scope is defined by the business practices associated with the object. In contrast to the other scope identifiers, the scope of the use of the id is not necessarily restricted to a single object, but may be reused for other objects closely associated with the object due to business practice.";
+            case OBJ: return "Description: The identifier associated with a particular object. It remains consistent as the object undergoes state transitions.";
+            case VER: return "Description: An identifier that references a particular object as it existed at a given point in time. The identifier SHALL change with each state transition on the object. I.e. The version identifier of an object prior to a 'suspend' state transition is distinct from the identifier of the object after the state transition. Each version identifier can be tied to exactly one ControlAct event which brought that version into being (though the control act may never be instantiated).\r\n\n                        \n                            NOTE: Applications that do not support versioning of objects must ignore and not persist these ids to avoid confusion resulting from leaving the same identifier on an object that undergoes changes.";
+            case VW: return "Description: An identifier that references a particular object as it existed at a given point in time. The identifier SHALL change with each state transition on the object.\r\n\n                        \n                           Example The version identifier of an object prior to a 'suspend' state transition is distinct from the identifier of the object after the state transition. Each version identifier can be tied to exactly one ControlAct event which brought that version into being (though the control act may never be instantiated).\r\n\n                        \n                            NOTE: Applications that do not support versioning of objects must ignore and not persist these ids to avoid confusion resulting from leaving the same identifier on an object that undergoes changes.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BUSN: return "Business Identifier";
+            case OBJ: return "Object Identifier";
+            case VER: return "Version Identifier";
+            case VW: return "View Specific Identifier";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierScopeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierScopeEnumFactory.java
new file mode 100644
index 00000000000..4c4d0303dd8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IdentifierScopeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3IdentifierScopeEnumFactory implements EnumFactory {
+
+  public V3IdentifierScope fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("BUSN".equals(codeString))
+      return V3IdentifierScope.BUSN;
+    if ("OBJ".equals(codeString))
+      return V3IdentifierScope.OBJ;
+    if ("VER".equals(codeString))
+      return V3IdentifierScope.VER;
+    if ("VW".equals(codeString))
+      return V3IdentifierScope.VW;
+    throw new IllegalArgumentException("Unknown V3IdentifierScope code '"+codeString+"'");
+  }
+
+  public String toCode(V3IdentifierScope code) {
+    if (code == V3IdentifierScope.BUSN)
+      return "BUSN";
+    if (code == V3IdentifierScope.OBJ)
+      return "OBJ";
+    if (code == V3IdentifierScope.VER)
+      return "VER";
+    if (code == V3IdentifierScope.VW)
+      return "VW";
+    return "?";
+  }
+
+    public String toSystem(V3IdentifierScope code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IntegrityCheckAlgorithm.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IntegrityCheckAlgorithm.java
new file mode 100644
index 00000000000..6a9f2fea90e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IntegrityCheckAlgorithm.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3IntegrityCheckAlgorithm {
+
+        /**
+         * This algorithm is defined in FIPS PUB 180-1: Secure Hash Standard.  As of April 17, 1995.
+         */
+        SHA1, 
+        /**
+         * This algorithm is defined in FIPS PUB 180-2: Secure Hash Standard.
+         */
+        SHA256, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3IntegrityCheckAlgorithm fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("SHA-1".equals(codeString))
+          return SHA1;
+        if ("SHA-256".equals(codeString))
+          return SHA256;
+        throw new FHIRException("Unknown V3IntegrityCheckAlgorithm code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SHA1: return "SHA-1";
+            case SHA256: return "SHA-256";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/IntegrityCheckAlgorithm";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SHA1: return "This algorithm is defined in FIPS PUB 180-1: Secure Hash Standard.  As of April 17, 1995.";
+            case SHA256: return "This algorithm is defined in FIPS PUB 180-2: Secure Hash Standard.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SHA1: return "secure hash algorithm - 1";
+            case SHA256: return "secure hash algorithm - 256";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IntegrityCheckAlgorithmEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IntegrityCheckAlgorithmEnumFactory.java
new file mode 100644
index 00000000000..3a2847d206a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3IntegrityCheckAlgorithmEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3IntegrityCheckAlgorithmEnumFactory implements EnumFactory {
+
+  public V3IntegrityCheckAlgorithm fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("SHA-1".equals(codeString))
+      return V3IntegrityCheckAlgorithm.SHA1;
+    if ("SHA-256".equals(codeString))
+      return V3IntegrityCheckAlgorithm.SHA256;
+    throw new IllegalArgumentException("Unknown V3IntegrityCheckAlgorithm code '"+codeString+"'");
+  }
+
+  public String toCode(V3IntegrityCheckAlgorithm code) {
+    if (code == V3IntegrityCheckAlgorithm.SHA1)
+      return "SHA-1";
+    if (code == V3IntegrityCheckAlgorithm.SHA256)
+      return "SHA-256";
+    return "?";
+  }
+
+    public String toSystem(V3IntegrityCheckAlgorithm code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityMode.java
new file mode 100644
index 00000000000..b4db7f84633
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityMode.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3LanguageAbilityMode {
+
+        /**
+         * Expressed signed
+         */
+        ESGN, 
+        /**
+         * Expressed spoken
+         */
+        ESP, 
+        /**
+         * Expressed written
+         */
+        EWR, 
+        /**
+         * Received signed
+         */
+        RSGN, 
+        /**
+         * Received spoken
+         */
+        RSP, 
+        /**
+         * Received written
+         */
+        RWR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3LanguageAbilityMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ESGN".equals(codeString))
+          return ESGN;
+        if ("ESP".equals(codeString))
+          return ESP;
+        if ("EWR".equals(codeString))
+          return EWR;
+        if ("RSGN".equals(codeString))
+          return RSGN;
+        if ("RSP".equals(codeString))
+          return RSP;
+        if ("RWR".equals(codeString))
+          return RWR;
+        throw new FHIRException("Unknown V3LanguageAbilityMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ESGN: return "ESGN";
+            case ESP: return "ESP";
+            case EWR: return "EWR";
+            case RSGN: return "RSGN";
+            case RSP: return "RSP";
+            case RWR: return "RWR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/LanguageAbilityMode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ESGN: return "Expressed signed";
+            case ESP: return "Expressed spoken";
+            case EWR: return "Expressed written";
+            case RSGN: return "Received signed";
+            case RSP: return "Received spoken";
+            case RWR: return "Received written";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ESGN: return "Expressed signed";
+            case ESP: return "Expressed spoken";
+            case EWR: return "Expressed written";
+            case RSGN: return "Received signed";
+            case RSP: return "Received spoken";
+            case RWR: return "Received written";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityModeEnumFactory.java
new file mode 100644
index 00000000000..b8fdce176c6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityModeEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3LanguageAbilityModeEnumFactory implements EnumFactory {
+
+  public V3LanguageAbilityMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ESGN".equals(codeString))
+      return V3LanguageAbilityMode.ESGN;
+    if ("ESP".equals(codeString))
+      return V3LanguageAbilityMode.ESP;
+    if ("EWR".equals(codeString))
+      return V3LanguageAbilityMode.EWR;
+    if ("RSGN".equals(codeString))
+      return V3LanguageAbilityMode.RSGN;
+    if ("RSP".equals(codeString))
+      return V3LanguageAbilityMode.RSP;
+    if ("RWR".equals(codeString))
+      return V3LanguageAbilityMode.RWR;
+    throw new IllegalArgumentException("Unknown V3LanguageAbilityMode code '"+codeString+"'");
+  }
+
+  public String toCode(V3LanguageAbilityMode code) {
+    if (code == V3LanguageAbilityMode.ESGN)
+      return "ESGN";
+    if (code == V3LanguageAbilityMode.ESP)
+      return "ESP";
+    if (code == V3LanguageAbilityMode.EWR)
+      return "EWR";
+    if (code == V3LanguageAbilityMode.RSGN)
+      return "RSGN";
+    if (code == V3LanguageAbilityMode.RSP)
+      return "RSP";
+    if (code == V3LanguageAbilityMode.RWR)
+      return "RWR";
+    return "?";
+  }
+
+    public String toSystem(V3LanguageAbilityMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityProficiency.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityProficiency.java
new file mode 100644
index 00000000000..4d2b8058dbd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityProficiency.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3LanguageAbilityProficiency {
+
+        /**
+         * Excellent
+         */
+        E, 
+        /**
+         * Fair
+         */
+        F, 
+        /**
+         * Good
+         */
+        G, 
+        /**
+         * Poor
+         */
+        P, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3LanguageAbilityProficiency fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("E".equals(codeString))
+          return E;
+        if ("F".equals(codeString))
+          return F;
+        if ("G".equals(codeString))
+          return G;
+        if ("P".equals(codeString))
+          return P;
+        throw new FHIRException("Unknown V3LanguageAbilityProficiency code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case E: return "E";
+            case F: return "F";
+            case G: return "G";
+            case P: return "P";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/LanguageAbilityProficiency";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case E: return "Excellent";
+            case F: return "Fair";
+            case G: return "Good";
+            case P: return "Poor";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case E: return "Excellent";
+            case F: return "Fair";
+            case G: return "Good";
+            case P: return "Poor";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityProficiencyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityProficiencyEnumFactory.java
new file mode 100644
index 00000000000..e6d6e23111a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LanguageAbilityProficiencyEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3LanguageAbilityProficiencyEnumFactory implements EnumFactory {
+
+  public V3LanguageAbilityProficiency fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("E".equals(codeString))
+      return V3LanguageAbilityProficiency.E;
+    if ("F".equals(codeString))
+      return V3LanguageAbilityProficiency.F;
+    if ("G".equals(codeString))
+      return V3LanguageAbilityProficiency.G;
+    if ("P".equals(codeString))
+      return V3LanguageAbilityProficiency.P;
+    throw new IllegalArgumentException("Unknown V3LanguageAbilityProficiency code '"+codeString+"'");
+  }
+
+  public String toCode(V3LanguageAbilityProficiency code) {
+    if (code == V3LanguageAbilityProficiency.E)
+      return "E";
+    if (code == V3LanguageAbilityProficiency.F)
+      return "F";
+    if (code == V3LanguageAbilityProficiency.G)
+      return "G";
+    if (code == V3LanguageAbilityProficiency.P)
+      return "P";
+    return "?";
+  }
+
+    public String toSystem(V3LanguageAbilityProficiency code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LivingArrangement.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LivingArrangement.java
new file mode 100644
index 00000000000..e7513044219
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LivingArrangement.java
@@ -0,0 +1,177 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3LivingArrangement {
+
+        /**
+         * Definition: Living arrangements lacking a permanent residence.
+         */
+        HL, 
+        /**
+         * Nomadic
+         */
+        M, 
+        /**
+         * Transient
+         */
+        T, 
+        /**
+         * Institution
+         */
+        I, 
+        /**
+         * Definition: A group living arrangement specifically for the care of those in need of temporary and crisis housing assistance.  Examples include domestic violence shelters, shelters for displaced or homeless individuals, Salvation Army, Jesus House, etc.  Community based services may be provided.
+         */
+        CS, 
+        /**
+         * Group Home
+         */
+        G, 
+        /**
+         * Nursing Home
+         */
+        N, 
+        /**
+         * Extended care facility
+         */
+        X, 
+        /**
+         * Definition:  A living arrangement within a private residence for single family.
+         */
+        PR, 
+        /**
+         * Independent Household
+         */
+        H, 
+        /**
+         * Retirement Community
+         */
+        R, 
+        /**
+         * Definition: Assisted living in a single family residence for persons with physical, behavioral, or functional health, or socio-economic challenges.  There may or may not be on-site supervision but the housing is designed to assist the client with developing independent living skills. Community based services may be provided.
+         */
+        SL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3LivingArrangement fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("HL".equals(codeString))
+          return HL;
+        if ("M".equals(codeString))
+          return M;
+        if ("T".equals(codeString))
+          return T;
+        if ("I".equals(codeString))
+          return I;
+        if ("CS".equals(codeString))
+          return CS;
+        if ("G".equals(codeString))
+          return G;
+        if ("N".equals(codeString))
+          return N;
+        if ("X".equals(codeString))
+          return X;
+        if ("PR".equals(codeString))
+          return PR;
+        if ("H".equals(codeString))
+          return H;
+        if ("R".equals(codeString))
+          return R;
+        if ("SL".equals(codeString))
+          return SL;
+        throw new FHIRException("Unknown V3LivingArrangement code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case HL: return "HL";
+            case M: return "M";
+            case T: return "T";
+            case I: return "I";
+            case CS: return "CS";
+            case G: return "G";
+            case N: return "N";
+            case X: return "X";
+            case PR: return "PR";
+            case H: return "H";
+            case R: return "R";
+            case SL: return "SL";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/LivingArrangement";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case HL: return "Definition: Living arrangements lacking a permanent residence.";
+            case M: return "Nomadic";
+            case T: return "Transient";
+            case I: return "Institution";
+            case CS: return "Definition: A group living arrangement specifically for the care of those in need of temporary and crisis housing assistance.  Examples include domestic violence shelters, shelters for displaced or homeless individuals, Salvation Army, Jesus House, etc.  Community based services may be provided.";
+            case G: return "Group Home";
+            case N: return "Nursing Home";
+            case X: return "Extended care facility";
+            case PR: return "Definition:  A living arrangement within a private residence for single family.";
+            case H: return "Independent Household";
+            case R: return "Retirement Community";
+            case SL: return "Definition: Assisted living in a single family residence for persons with physical, behavioral, or functional health, or socio-economic challenges.  There may or may not be on-site supervision but the housing is designed to assist the client with developing independent living skills. Community based services may be provided.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case HL: return "homeless";
+            case M: return "Nomadic";
+            case T: return "Transient";
+            case I: return "Institution";
+            case CS: return "community shelter";
+            case G: return "Group Home";
+            case N: return "Nursing Home";
+            case X: return "Extended care facility";
+            case PR: return "private residence";
+            case H: return "Independent Household";
+            case R: return "Retirement Community";
+            case SL: return "supported living";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LivingArrangementEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LivingArrangementEnumFactory.java
new file mode 100644
index 00000000000..45e311fec71
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LivingArrangementEnumFactory.java
@@ -0,0 +1,102 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3LivingArrangementEnumFactory implements EnumFactory {
+
+  public V3LivingArrangement fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("HL".equals(codeString))
+      return V3LivingArrangement.HL;
+    if ("M".equals(codeString))
+      return V3LivingArrangement.M;
+    if ("T".equals(codeString))
+      return V3LivingArrangement.T;
+    if ("I".equals(codeString))
+      return V3LivingArrangement.I;
+    if ("CS".equals(codeString))
+      return V3LivingArrangement.CS;
+    if ("G".equals(codeString))
+      return V3LivingArrangement.G;
+    if ("N".equals(codeString))
+      return V3LivingArrangement.N;
+    if ("X".equals(codeString))
+      return V3LivingArrangement.X;
+    if ("PR".equals(codeString))
+      return V3LivingArrangement.PR;
+    if ("H".equals(codeString))
+      return V3LivingArrangement.H;
+    if ("R".equals(codeString))
+      return V3LivingArrangement.R;
+    if ("SL".equals(codeString))
+      return V3LivingArrangement.SL;
+    throw new IllegalArgumentException("Unknown V3LivingArrangement code '"+codeString+"'");
+  }
+
+  public String toCode(V3LivingArrangement code) {
+    if (code == V3LivingArrangement.HL)
+      return "HL";
+    if (code == V3LivingArrangement.M)
+      return "M";
+    if (code == V3LivingArrangement.T)
+      return "T";
+    if (code == V3LivingArrangement.I)
+      return "I";
+    if (code == V3LivingArrangement.CS)
+      return "CS";
+    if (code == V3LivingArrangement.G)
+      return "G";
+    if (code == V3LivingArrangement.N)
+      return "N";
+    if (code == V3LivingArrangement.X)
+      return "X";
+    if (code == V3LivingArrangement.PR)
+      return "PR";
+    if (code == V3LivingArrangement.H)
+      return "H";
+    if (code == V3LivingArrangement.R)
+      return "R";
+    if (code == V3LivingArrangement.SL)
+      return "SL";
+    return "?";
+  }
+
+    public String toSystem(V3LivingArrangement code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalMarkupIgnore.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalMarkupIgnore.java
new file mode 100644
index 00000000000..4e8ce7c3dbe
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalMarkupIgnore.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3LocalMarkupIgnore {
+
+        /**
+         * all
+         */
+        ALL, 
+        /**
+         * markup
+         */
+        MARKUP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3LocalMarkupIgnore fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("all".equals(codeString))
+          return ALL;
+        if ("markup".equals(codeString))
+          return MARKUP;
+        throw new FHIRException("Unknown V3LocalMarkupIgnore code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ALL: return "all";
+            case MARKUP: return "markup";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/LocalMarkupIgnore";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ALL: return "all";
+            case MARKUP: return "markup";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ALL: return "all";
+            case MARKUP: return "markup";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalMarkupIgnoreEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalMarkupIgnoreEnumFactory.java
new file mode 100644
index 00000000000..5d1de4ba93b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalMarkupIgnoreEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3LocalMarkupIgnoreEnumFactory implements EnumFactory {
+
+  public V3LocalMarkupIgnore fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("all".equals(codeString))
+      return V3LocalMarkupIgnore.ALL;
+    if ("markup".equals(codeString))
+      return V3LocalMarkupIgnore.MARKUP;
+    throw new IllegalArgumentException("Unknown V3LocalMarkupIgnore code '"+codeString+"'");
+  }
+
+  public String toCode(V3LocalMarkupIgnore code) {
+    if (code == V3LocalMarkupIgnore.ALL)
+      return "all";
+    if (code == V3LocalMarkupIgnore.MARKUP)
+      return "markup";
+    return "?";
+  }
+
+    public String toSystem(V3LocalMarkupIgnore code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalRemoteControlState.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalRemoteControlState.java
new file mode 100644
index 00000000000..c5868ea9951
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalRemoteControlState.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3LocalRemoteControlState {
+
+        /**
+         * An equipment can either work autonomously ('Local' control state).
+         */
+        L, 
+        /**
+         * An equipment can be controlled by another system, e.g., LAS computer ('Remote' control state).
+         */
+        R, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3LocalRemoteControlState fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("L".equals(codeString))
+          return L;
+        if ("R".equals(codeString))
+          return R;
+        throw new FHIRException("Unknown V3LocalRemoteControlState code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case L: return "L";
+            case R: return "R";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/LocalRemoteControlState";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case L: return "An equipment can either work autonomously ('Local' control state).";
+            case R: return "An equipment can be controlled by another system, e.g., LAS computer ('Remote' control state).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case L: return "Local";
+            case R: return "Remote";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalRemoteControlStateEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalRemoteControlStateEnumFactory.java
new file mode 100644
index 00000000000..e412f3a2fdd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3LocalRemoteControlStateEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3LocalRemoteControlStateEnumFactory implements EnumFactory {
+
+  public V3LocalRemoteControlState fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("L".equals(codeString))
+      return V3LocalRemoteControlState.L;
+    if ("R".equals(codeString))
+      return V3LocalRemoteControlState.R;
+    throw new IllegalArgumentException("Unknown V3LocalRemoteControlState code '"+codeString+"'");
+  }
+
+  public String toCode(V3LocalRemoteControlState code) {
+    if (code == V3LocalRemoteControlState.L)
+      return "L";
+    if (code == V3LocalRemoteControlState.R)
+      return "R";
+    return "?";
+  }
+
+    public String toSystem(V3LocalRemoteControlState code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ManagedParticipationStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ManagedParticipationStatus.java
new file mode 100644
index 00000000000..41fe4b599af
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ManagedParticipationStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ManagedParticipationStatus {
+
+        /**
+         * The 'typical' state. Excludes "nullified" which represents the termination state of a participation instance that was created in error.
+         */
+        NORMAL, 
+        /**
+         * The state representing the fact that the Participation is in progress.
+         */
+        ACTIVE, 
+        /**
+         * The terminal state resulting from cancellation of the Participation prior to activation.
+         */
+        CANCELLED, 
+        /**
+         * The terminal state representing the successful completion of the Participation.
+         */
+        COMPLETED, 
+        /**
+         * The state representing that fact that the Participation has not yet become active.
+         */
+        PENDING, 
+        /**
+         * The state representing the termination of a Participation instance that was created in error.
+         */
+        NULLIFIED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ManagedParticipationStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("normal".equals(codeString))
+          return NORMAL;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("completed".equals(codeString))
+          return COMPLETED;
+        if ("pending".equals(codeString))
+          return PENDING;
+        if ("nullified".equals(codeString))
+          return NULLIFIED;
+        throw new FHIRException("Unknown V3ManagedParticipationStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case PENDING: return "pending";
+            case NULLIFIED: return "nullified";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ManagedParticipationStatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NORMAL: return "The 'typical' state. Excludes \"nullified\" which represents the termination state of a participation instance that was created in error.";
+            case ACTIVE: return "The state representing the fact that the Participation is in progress.";
+            case CANCELLED: return "The terminal state resulting from cancellation of the Participation prior to activation.";
+            case COMPLETED: return "The terminal state representing the successful completion of the Participation.";
+            case PENDING: return "The state representing that fact that the Participation has not yet become active.";
+            case NULLIFIED: return "The state representing the termination of a Participation instance that was created in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case PENDING: return "pending";
+            case NULLIFIED: return "nullified";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ManagedParticipationStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ManagedParticipationStatusEnumFactory.java
new file mode 100644
index 00000000000..f30a8524466
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ManagedParticipationStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ManagedParticipationStatusEnumFactory implements EnumFactory {
+
+  public V3ManagedParticipationStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("normal".equals(codeString))
+      return V3ManagedParticipationStatus.NORMAL;
+    if ("active".equals(codeString))
+      return V3ManagedParticipationStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return V3ManagedParticipationStatus.CANCELLED;
+    if ("completed".equals(codeString))
+      return V3ManagedParticipationStatus.COMPLETED;
+    if ("pending".equals(codeString))
+      return V3ManagedParticipationStatus.PENDING;
+    if ("nullified".equals(codeString))
+      return V3ManagedParticipationStatus.NULLIFIED;
+    throw new IllegalArgumentException("Unknown V3ManagedParticipationStatus code '"+codeString+"'");
+  }
+
+  public String toCode(V3ManagedParticipationStatus code) {
+    if (code == V3ManagedParticipationStatus.NORMAL)
+      return "normal";
+    if (code == V3ManagedParticipationStatus.ACTIVE)
+      return "active";
+    if (code == V3ManagedParticipationStatus.CANCELLED)
+      return "cancelled";
+    if (code == V3ManagedParticipationStatus.COMPLETED)
+      return "completed";
+    if (code == V3ManagedParticipationStatus.PENDING)
+      return "pending";
+    if (code == V3ManagedParticipationStatus.NULLIFIED)
+      return "nullified";
+    return "?";
+  }
+
+    public String toSystem(V3ManagedParticipationStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MapRelationship.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MapRelationship.java
new file mode 100644
index 00000000000..e777a4e85f0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MapRelationship.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3MapRelationship {
+
+        /**
+         * The first concept is at a more abstract level than the second concept.  For example, Hepatitis is broader than Hepatitis A, and endocrine disease is broader than Diabetes Mellitus.  Broader than is the opposite of the narrower than relationship.
+         */
+        BT, 
+        /**
+         * The two concepts have identical meaning.
+         */
+        E, 
+        /**
+         * The first concept is at a more detailed level than the second concept.  For example, Pennicillin G is narrower than Pennicillin, and vellus hair is narrower than hair.  Narrower than is the opposite of broader than.
+         */
+        NT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3MapRelationship fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("BT".equals(codeString))
+          return BT;
+        if ("E".equals(codeString))
+          return E;
+        if ("NT".equals(codeString))
+          return NT;
+        throw new FHIRException("Unknown V3MapRelationship code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BT: return "BT";
+            case E: return "E";
+            case NT: return "NT";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/MapRelationship";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BT: return "The first concept is at a more abstract level than the second concept.  For example, Hepatitis is broader than Hepatitis A, and endocrine disease is broader than Diabetes Mellitus.  Broader than is the opposite of the narrower than relationship.";
+            case E: return "The two concepts have identical meaning.";
+            case NT: return "The first concept is at a more detailed level than the second concept.  For example, Pennicillin G is narrower than Pennicillin, and vellus hair is narrower than hair.  Narrower than is the opposite of broader than.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BT: return "Broader Than";
+            case E: return "Exact";
+            case NT: return "Narrower Than";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MapRelationshipEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MapRelationshipEnumFactory.java
new file mode 100644
index 00000000000..2378cee3a26
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MapRelationshipEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3MapRelationshipEnumFactory implements EnumFactory {
+
+  public V3MapRelationship fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("BT".equals(codeString))
+      return V3MapRelationship.BT;
+    if ("E".equals(codeString))
+      return V3MapRelationship.E;
+    if ("NT".equals(codeString))
+      return V3MapRelationship.NT;
+    throw new IllegalArgumentException("Unknown V3MapRelationship code '"+codeString+"'");
+  }
+
+  public String toCode(V3MapRelationship code) {
+    if (code == V3MapRelationship.BT)
+      return "BT";
+    if (code == V3MapRelationship.E)
+      return "E";
+    if (code == V3MapRelationship.NT)
+      return "NT";
+    return "?";
+  }
+
+    public String toSystem(V3MapRelationship code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MaritalStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MaritalStatus.java
new file mode 100644
index 00000000000..971acb19044
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MaritalStatus.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3MaritalStatus {
+
+        /**
+         * Marriage contract has been declared null and to not have existed
+         */
+        A, 
+        /**
+         * Marriage contract has been declared dissolved and inactive
+         */
+        D, 
+        /**
+         * Subject to an Interlocutory Decree.
+         */
+        I, 
+        /**
+         * Legally Separated
+         */
+        L, 
+        /**
+         * A current marriage contract is active
+         */
+        M, 
+        /**
+         * More than 1 current spouse
+         */
+        P, 
+        /**
+         * No marriage contract has ever been entered
+         */
+        S, 
+        /**
+         * Person declares that a domestic partner relationship exists.
+         */
+        T, 
+        /**
+         * Currently not in a marriage contract.
+         */
+        U, 
+        /**
+         * The spouse has died
+         */
+        W, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3MaritalStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("A".equals(codeString))
+          return A;
+        if ("D".equals(codeString))
+          return D;
+        if ("I".equals(codeString))
+          return I;
+        if ("L".equals(codeString))
+          return L;
+        if ("M".equals(codeString))
+          return M;
+        if ("P".equals(codeString))
+          return P;
+        if ("S".equals(codeString))
+          return S;
+        if ("T".equals(codeString))
+          return T;
+        if ("U".equals(codeString))
+          return U;
+        if ("W".equals(codeString))
+          return W;
+        throw new FHIRException("Unknown V3MaritalStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A: return "A";
+            case D: return "D";
+            case I: return "I";
+            case L: return "L";
+            case M: return "M";
+            case P: return "P";
+            case S: return "S";
+            case T: return "T";
+            case U: return "U";
+            case W: return "W";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/MaritalStatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A: return "Marriage contract has been declared null and to not have existed";
+            case D: return "Marriage contract has been declared dissolved and inactive";
+            case I: return "Subject to an Interlocutory Decree.";
+            case L: return "Legally Separated";
+            case M: return "A current marriage contract is active";
+            case P: return "More than 1 current spouse";
+            case S: return "No marriage contract has ever been entered";
+            case T: return "Person declares that a domestic partner relationship exists.";
+            case U: return "Currently not in a marriage contract.";
+            case W: return "The spouse has died";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A: return "Annulled";
+            case D: return "Divorced";
+            case I: return "Interlocutory";
+            case L: return "Legally Separated";
+            case M: return "Married";
+            case P: return "Polygamous";
+            case S: return "Never Married";
+            case T: return "Domestic partner";
+            case U: return "unmarried";
+            case W: return "Widowed";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MaritalStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MaritalStatusEnumFactory.java
new file mode 100644
index 00000000000..972a3124028
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MaritalStatusEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3MaritalStatusEnumFactory implements EnumFactory {
+
+  public V3MaritalStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("A".equals(codeString))
+      return V3MaritalStatus.A;
+    if ("D".equals(codeString))
+      return V3MaritalStatus.D;
+    if ("I".equals(codeString))
+      return V3MaritalStatus.I;
+    if ("L".equals(codeString))
+      return V3MaritalStatus.L;
+    if ("M".equals(codeString))
+      return V3MaritalStatus.M;
+    if ("P".equals(codeString))
+      return V3MaritalStatus.P;
+    if ("S".equals(codeString))
+      return V3MaritalStatus.S;
+    if ("T".equals(codeString))
+      return V3MaritalStatus.T;
+    if ("U".equals(codeString))
+      return V3MaritalStatus.U;
+    if ("W".equals(codeString))
+      return V3MaritalStatus.W;
+    throw new IllegalArgumentException("Unknown V3MaritalStatus code '"+codeString+"'");
+  }
+
+  public String toCode(V3MaritalStatus code) {
+    if (code == V3MaritalStatus.A)
+      return "A";
+    if (code == V3MaritalStatus.D)
+      return "D";
+    if (code == V3MaritalStatus.I)
+      return "I";
+    if (code == V3MaritalStatus.L)
+      return "L";
+    if (code == V3MaritalStatus.M)
+      return "M";
+    if (code == V3MaritalStatus.P)
+      return "P";
+    if (code == V3MaritalStatus.S)
+      return "S";
+    if (code == V3MaritalStatus.T)
+      return "T";
+    if (code == V3MaritalStatus.U)
+      return "U";
+    if (code == V3MaritalStatus.W)
+      return "W";
+    return "?";
+  }
+
+    public String toSystem(V3MaritalStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MessageWaitingPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MessageWaitingPriority.java
new file mode 100644
index 00000000000..0f9241412e9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MessageWaitingPriority.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3MessageWaitingPriority {
+
+        /**
+         * High priority messages are available
+         */
+        H, 
+        /**
+         * Low priority messages are available
+         */
+        L, 
+        /**
+         * Medium priority messages are available
+         */
+        M, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3MessageWaitingPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("H".equals(codeString))
+          return H;
+        if ("L".equals(codeString))
+          return L;
+        if ("M".equals(codeString))
+          return M;
+        throw new FHIRException("Unknown V3MessageWaitingPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case H: return "H";
+            case L: return "L";
+            case M: return "M";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/MessageWaitingPriority";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case H: return "High priority messages are available";
+            case L: return "Low priority messages are available";
+            case M: return "Medium priority messages are available";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case H: return "High";
+            case L: return "Low";
+            case M: return "Medium";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MessageWaitingPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MessageWaitingPriorityEnumFactory.java
new file mode 100644
index 00000000000..9ce6483530b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3MessageWaitingPriorityEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3MessageWaitingPriorityEnumFactory implements EnumFactory {
+
+  public V3MessageWaitingPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("H".equals(codeString))
+      return V3MessageWaitingPriority.H;
+    if ("L".equals(codeString))
+      return V3MessageWaitingPriority.L;
+    if ("M".equals(codeString))
+      return V3MessageWaitingPriority.M;
+    throw new IllegalArgumentException("Unknown V3MessageWaitingPriority code '"+codeString+"'");
+  }
+
+  public String toCode(V3MessageWaitingPriority code) {
+    if (code == V3MessageWaitingPriority.H)
+      return "H";
+    if (code == V3MessageWaitingPriority.L)
+      return "L";
+    if (code == V3MessageWaitingPriority.M)
+      return "M";
+    return "?";
+  }
+
+    public String toSystem(V3MessageWaitingPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ModifyIndicator.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ModifyIndicator.java
new file mode 100644
index 00000000000..45f96df550c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ModifyIndicator.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ModifyIndicator {
+
+        /**
+         * Modified subscription to a query server.
+         */
+        M, 
+        /**
+         * New subscription to a query server.
+         */
+        N, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ModifyIndicator fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("M".equals(codeString))
+          return M;
+        if ("N".equals(codeString))
+          return N;
+        throw new FHIRException("Unknown V3ModifyIndicator code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case M: return "M";
+            case N: return "N";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ModifyIndicator";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case M: return "Modified subscription to a query server.";
+            case N: return "New subscription to a query server.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case M: return "Modified subscription";
+            case N: return "New subscription";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ModifyIndicatorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ModifyIndicatorEnumFactory.java
new file mode 100644
index 00000000000..523e112f8cc
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ModifyIndicatorEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ModifyIndicatorEnumFactory implements EnumFactory {
+
+  public V3ModifyIndicator fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("M".equals(codeString))
+      return V3ModifyIndicator.M;
+    if ("N".equals(codeString))
+      return V3ModifyIndicator.N;
+    throw new IllegalArgumentException("Unknown V3ModifyIndicator code '"+codeString+"'");
+  }
+
+  public String toCode(V3ModifyIndicator code) {
+    if (code == V3ModifyIndicator.M)
+      return "M";
+    if (code == V3ModifyIndicator.N)
+      return "N";
+    return "?";
+  }
+
+    public String toSystem(V3ModifyIndicator code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3NullFlavor.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3NullFlavor.java
new file mode 100644
index 00000000000..722facaf120
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3NullFlavor.java
@@ -0,0 +1,244 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3NullFlavor {
+
+        /**
+         * Description:The value is exceptional (missing, omitted, incomplete, improper). No information as to the reason for being an exceptional value is provided. This is the most general exceptional value. It is also the default exceptional value.
+         */
+        NI, 
+        /**
+         * Description:The value as represented in the instance is not a member of the set of permitted data values in the constrained value domain of a variable.
+         */
+        INV, 
+        /**
+         * Description:An actual value may exist, but it must be derived from the provided information (usually an EXPR generic data type extension will be used to convey the derivation expressionexpression .
+         */
+        DER, 
+        /**
+         * Description:The actual value is not a member of the set of permitted data values in the constrained value domain of a variable. (e.g., concept not provided by required code system).
+
+                        
+                           Usage Notes: This flavor and its specializations are most commonly used with the CD datatype and its flavors.  However, it may apply to *any* datatype where the constraints of the type are tighter than can be conveyed.  For example, a PQ that is for a true measured amount whose units are not supported in UCUM, a need to convey a REAL when the type has been constrained to INT, etc.
+
+                        With coded datatypes, this null flavor may only be used if the vocabulary binding has a coding strength of CNE.  By definition, all local codes and original text are part of the value set if the coding strength is CWE.
+         */
+        OTH, 
+        /**
+         * Negative infinity of numbers.
+         */
+        NINF, 
+        /**
+         * Positive infinity of numbers.
+         */
+        PINF, 
+        /**
+         * Description: The actual value has not yet been encoded within the approved value domain.
+
+                        
+                           Example: Original text or a local code has been specified but translation or encoding to the approved value set has not yet occurred due to limitations of the sending system.  Original text has been captured for a PQ, but not attempt has been made to split the value and unit or to encode the unit in UCUM.
+
+                        
+                           Usage Notes: If it is known that it is not possible to encode the concept, OTH should be used instead.  However, use of UNC does not necessarily guarantee the concept will be encodable, only that encoding has not been attempted.
+
+                        Data type properties such as original text and translations may be present when this null flavor is included.
+         */
+        UNC, 
+        /**
+         * There is information on this item available but it has not been provided by the sender due to security, privacy or other reasons. There may be an alternate mechanism for gaining access to this information.
+
+                        Note: using this null flavor does provide information that may be a breach of confidentiality, even though no detail data is provided.  Its primary purpose is for those circumstances where it is necessary to inform the receiver that the information does exist without providing any detail.
+         */
+        MSK, 
+        /**
+         * Known to have no proper value (e.g., last menstrual period for a male).
+         */
+        NA, 
+        /**
+         * Description:A proper value is applicable, but not known.
+
+                        
+                           Usage Notes: This means the actual value is not known.  If the only thing that is unknown is how to properly express the value in the necessary constraints (value set, datatype, etc.), then the OTH or UNC flavor should be used.  No properties should be included for a datatype with this property unless:
+
+                        
+                           Those properties themselves directly translate to a semantic of "unknown".  (E.g. a local code sent as a translation that conveys 'unknown')
+                           Those properties further qualify the nature of what is unknown.  (E.g. specifying a use code of "H" and a URL prefix of "tel:" to convey that it is the home phone number that is unknown.)
+         */
+        UNK, 
+        /**
+         * Information was sought but not found (e.g., patient was asked but didn't know)
+         */
+        ASKU, 
+        /**
+         * Information is not available at this time but it is expected that it will be available later.
+         */
+        NAV, 
+        /**
+         * This information has not been sought (e.g., patient was not asked)
+         */
+        NASK, 
+        /**
+         * Information is not available at this time (with no expectation regarding whether it will or will not be available in the future).
+         */
+        NAVU, 
+        /**
+         * Description:The specific quantity is not known, but is known to be non-zero and is not specified because it makes up the bulk of the material. e.g. 'Add 10mg of ingredient X, 50mg of ingredient Y, and sufficient quantity of water to 100mL.' The null flavor would be used to express the quantity of water.
+         */
+        QS, 
+        /**
+         * The content is greater than zero, but too small to be quantified.
+         */
+        TRC, 
+        /**
+         * Value is not present in a message.  This is only defined in messages, never in application data!  All values not present in the message must be replaced by the applicable default, or no-information (NI) as the default of all defaults.
+         */
+        NP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3NullFlavor fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("NI".equals(codeString))
+          return NI;
+        if ("INV".equals(codeString))
+          return INV;
+        if ("DER".equals(codeString))
+          return DER;
+        if ("OTH".equals(codeString))
+          return OTH;
+        if ("NINF".equals(codeString))
+          return NINF;
+        if ("PINF".equals(codeString))
+          return PINF;
+        if ("UNC".equals(codeString))
+          return UNC;
+        if ("MSK".equals(codeString))
+          return MSK;
+        if ("NA".equals(codeString))
+          return NA;
+        if ("UNK".equals(codeString))
+          return UNK;
+        if ("ASKU".equals(codeString))
+          return ASKU;
+        if ("NAV".equals(codeString))
+          return NAV;
+        if ("NASK".equals(codeString))
+          return NASK;
+        if ("NAVU".equals(codeString))
+          return NAVU;
+        if ("QS".equals(codeString))
+          return QS;
+        if ("TRC".equals(codeString))
+          return TRC;
+        if ("NP".equals(codeString))
+          return NP;
+        throw new FHIRException("Unknown V3NullFlavor code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NI: return "NI";
+            case INV: return "INV";
+            case DER: return "DER";
+            case OTH: return "OTH";
+            case NINF: return "NINF";
+            case PINF: return "PINF";
+            case UNC: return "UNC";
+            case MSK: return "MSK";
+            case NA: return "NA";
+            case UNK: return "UNK";
+            case ASKU: return "ASKU";
+            case NAV: return "NAV";
+            case NASK: return "NASK";
+            case NAVU: return "NAVU";
+            case QS: return "QS";
+            case TRC: return "TRC";
+            case NP: return "NP";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/NullFlavor";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NI: return "Description:The value is exceptional (missing, omitted, incomplete, improper). No information as to the reason for being an exceptional value is provided. This is the most general exceptional value. It is also the default exceptional value.";
+            case INV: return "Description:The value as represented in the instance is not a member of the set of permitted data values in the constrained value domain of a variable.";
+            case DER: return "Description:An actual value may exist, but it must be derived from the provided information (usually an EXPR generic data type extension will be used to convey the derivation expressionexpression .";
+            case OTH: return "Description:The actual value is not a member of the set of permitted data values in the constrained value domain of a variable. (e.g., concept not provided by required code system).\r\n\n                        \n                           Usage Notes: This flavor and its specializations are most commonly used with the CD datatype and its flavors.  However, it may apply to *any* datatype where the constraints of the type are tighter than can be conveyed.  For example, a PQ that is for a true measured amount whose units are not supported in UCUM, a need to convey a REAL when the type has been constrained to INT, etc.\r\n\n                        With coded datatypes, this null flavor may only be used if the vocabulary binding has a coding strength of CNE.  By definition, all local codes and original text are part of the value set if the coding strength is CWE.";
+            case NINF: return "Negative infinity of numbers.";
+            case PINF: return "Positive infinity of numbers.";
+            case UNC: return "Description: The actual value has not yet been encoded within the approved value domain.\r\n\n                        \n                           Example: Original text or a local code has been specified but translation or encoding to the approved value set has not yet occurred due to limitations of the sending system.  Original text has been captured for a PQ, but not attempt has been made to split the value and unit or to encode the unit in UCUM.\r\n\n                        \n                           Usage Notes: If it is known that it is not possible to encode the concept, OTH should be used instead.  However, use of UNC does not necessarily guarantee the concept will be encodable, only that encoding has not been attempted.\r\n\n                        Data type properties such as original text and translations may be present when this null flavor is included.";
+            case MSK: return "There is information on this item available but it has not been provided by the sender due to security, privacy or other reasons. There may be an alternate mechanism for gaining access to this information.\r\n\n                        Note: using this null flavor does provide information that may be a breach of confidentiality, even though no detail data is provided.  Its primary purpose is for those circumstances where it is necessary to inform the receiver that the information does exist without providing any detail.";
+            case NA: return "Known to have no proper value (e.g., last menstrual period for a male).";
+            case UNK: return "Description:A proper value is applicable, but not known.\r\n\n                        \n                           Usage Notes: This means the actual value is not known.  If the only thing that is unknown is how to properly express the value in the necessary constraints (value set, datatype, etc.), then the OTH or UNC flavor should be used.  No properties should be included for a datatype with this property unless:\r\n\n                        \n                           Those properties themselves directly translate to a semantic of \"unknown\".  (E.g. a local code sent as a translation that conveys 'unknown')\n                           Those properties further qualify the nature of what is unknown.  (E.g. specifying a use code of \"H\" and a URL prefix of \"tel:\" to convey that it is the home phone number that is unknown.)";
+            case ASKU: return "Information was sought but not found (e.g., patient was asked but didn't know)";
+            case NAV: return "Information is not available at this time but it is expected that it will be available later.";
+            case NASK: return "This information has not been sought (e.g., patient was not asked)";
+            case NAVU: return "Information is not available at this time (with no expectation regarding whether it will or will not be available in the future).";
+            case QS: return "Description:The specific quantity is not known, but is known to be non-zero and is not specified because it makes up the bulk of the material. e.g. 'Add 10mg of ingredient X, 50mg of ingredient Y, and sufficient quantity of water to 100mL.' The null flavor would be used to express the quantity of water.";
+            case TRC: return "The content is greater than zero, but too small to be quantified.";
+            case NP: return "Value is not present in a message.  This is only defined in messages, never in application data!  All values not present in the message must be replaced by the applicable default, or no-information (NI) as the default of all defaults.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NI: return "NoInformation";
+            case INV: return "invalid";
+            case DER: return "derived";
+            case OTH: return "other";
+            case NINF: return "negative infinity";
+            case PINF: return "positive infinity";
+            case UNC: return "un-encoded";
+            case MSK: return "masked";
+            case NA: return "not applicable";
+            case UNK: return "unknown";
+            case ASKU: return "asked but unknown";
+            case NAV: return "temporarily unavailable";
+            case NASK: return "not asked";
+            case NAVU: return "Not available";
+            case QS: return "Sufficient Quantity";
+            case TRC: return "trace";
+            case NP: return "not present";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3NullFlavorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3NullFlavorEnumFactory.java
new file mode 100644
index 00000000000..5114aefca31
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3NullFlavorEnumFactory.java
@@ -0,0 +1,122 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3NullFlavorEnumFactory implements EnumFactory {
+
+  public V3NullFlavor fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("NI".equals(codeString))
+      return V3NullFlavor.NI;
+    if ("INV".equals(codeString))
+      return V3NullFlavor.INV;
+    if ("DER".equals(codeString))
+      return V3NullFlavor.DER;
+    if ("OTH".equals(codeString))
+      return V3NullFlavor.OTH;
+    if ("NINF".equals(codeString))
+      return V3NullFlavor.NINF;
+    if ("PINF".equals(codeString))
+      return V3NullFlavor.PINF;
+    if ("UNC".equals(codeString))
+      return V3NullFlavor.UNC;
+    if ("MSK".equals(codeString))
+      return V3NullFlavor.MSK;
+    if ("NA".equals(codeString))
+      return V3NullFlavor.NA;
+    if ("UNK".equals(codeString))
+      return V3NullFlavor.UNK;
+    if ("ASKU".equals(codeString))
+      return V3NullFlavor.ASKU;
+    if ("NAV".equals(codeString))
+      return V3NullFlavor.NAV;
+    if ("NASK".equals(codeString))
+      return V3NullFlavor.NASK;
+    if ("NAVU".equals(codeString))
+      return V3NullFlavor.NAVU;
+    if ("QS".equals(codeString))
+      return V3NullFlavor.QS;
+    if ("TRC".equals(codeString))
+      return V3NullFlavor.TRC;
+    if ("NP".equals(codeString))
+      return V3NullFlavor.NP;
+    throw new IllegalArgumentException("Unknown V3NullFlavor code '"+codeString+"'");
+  }
+
+  public String toCode(V3NullFlavor code) {
+    if (code == V3NullFlavor.NI)
+      return "NI";
+    if (code == V3NullFlavor.INV)
+      return "INV";
+    if (code == V3NullFlavor.DER)
+      return "DER";
+    if (code == V3NullFlavor.OTH)
+      return "OTH";
+    if (code == V3NullFlavor.NINF)
+      return "NINF";
+    if (code == V3NullFlavor.PINF)
+      return "PINF";
+    if (code == V3NullFlavor.UNC)
+      return "UNC";
+    if (code == V3NullFlavor.MSK)
+      return "MSK";
+    if (code == V3NullFlavor.NA)
+      return "NA";
+    if (code == V3NullFlavor.UNK)
+      return "UNK";
+    if (code == V3NullFlavor.ASKU)
+      return "ASKU";
+    if (code == V3NullFlavor.NAV)
+      return "NAV";
+    if (code == V3NullFlavor.NASK)
+      return "NASK";
+    if (code == V3NullFlavor.NAVU)
+      return "NAVU";
+    if (code == V3NullFlavor.QS)
+      return "QS";
+    if (code == V3NullFlavor.TRC)
+      return "TRC";
+    if (code == V3NullFlavor.NP)
+      return "NP";
+    return "?";
+  }
+
+    public String toSystem(V3NullFlavor code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationInterpretation.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationInterpretation.java
new file mode 100644
index 00000000000..0db6f5dffea
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationInterpretation.java
@@ -0,0 +1,702 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ObservationInterpretation {
+
+        /**
+         * Codes that specify interpretation of genetic analysis, such as "positive", "negative", "carrier", "responsive", etc.
+         */
+        _GENETICOBSERVATIONINTERPRETATION, 
+        /**
+         * The patient is considered as carrier based on the testing results. A carrier is an individual who carries an altered form of a gene which can lead to having a child or offspring in future generations with a genetic disorder.
+         */
+        CAR, 
+        /**
+         * The patient is considered as carrier based on the testing results. A carrier is an individual who carries an altered form of a gene which can lead to having a child or offspring in future generations with a genetic disorder.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This code is currently the same string as the print name for this concept and is inconsistent with the conventions being used for the other codes in the coding system, as it is a full word with initial capitalization, rather than an all upper case mnemonic.  The recommendation from OO is to deprecate the code "Carrier" and to add "CAR" as the new active code representation for this concept.
+         */
+        CARRIER, 
+        /**
+         * Interpretations of change of quantity and/or severity. At most one of B or W and one of U or D allowed.
+         */
+        _OBSERVATIONINTERPRETATIONCHANGE, 
+        /**
+         * The current result or observation value has improved compared to the previous result or observation value (the change is significant as defined in the respective test procedure).
+
+                        [Note: This can be applied to quantitative or qualitative observations.]
+         */
+        B, 
+        /**
+         * The current result has decreased from the previous result for a quantitative observation (the change is significant as defined in the respective test procedure).
+         */
+        D, 
+        /**
+         * The current result has increased from the previous result for a quantitative observation (the change is significant as defined in the respective test procedure).
+         */
+        U, 
+        /**
+         * The current result or observation value has degraded compared to the previous result or observation value (the change is significant as defined in the respective test procedure).
+
+                        [Note: This can be applied to quantitative or qualitative observations.]
+         */
+        W, 
+        /**
+         * Technical exceptions resulting in the inability to provide an interpretation. At most one allowed. Does not imply normality or severity.
+         */
+        _OBSERVATIONINTERPRETATIONEXCEPTIONS, 
+        /**
+         * The result is below the minimum detection limit (the test procedure or equipment is the limiting factor).
+
+                        Synonyms: Below analytical limit, low off scale.
+         */
+        LESS_THAN, 
+        /**
+         * The result is above the maximum quantifiable limit (the test procedure or equipment is the limiting factor).
+
+                        Synonyms: Above analytical limit, high off scale.
+         */
+        GREATER_THAN, 
+        /**
+         * A valid result cannot be obtained for the specified component / analyte due to the presence of anti-complementary substances in the sample.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This code is being deprecated to match the status in V2 Table 0078 "Interpretation Codes.
+         */
+        AC, 
+        /**
+         * There is insufficient evidence that the species in question is a good target for therapy with the drug.  A categorical interpretation is not possible.
+
+                        [Note: A MIC with "IE" and/or a comment may be reported (without an accompanying S, I or R-categorization).]
+         */
+        IE, 
+        /**
+         * A result cannot be considered valid for the specified component / analyte or organism due to failure in the quality control testing component.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This code is being deprecated to match the status in V2 Table 0078 "Interpretation Codes.
+         */
+        QCF, 
+        /**
+         * A valid result cannot be obtained for the specified organism or cell line due to the presence of cytotoxic substances in the sample or culture.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This code is being deprecated to match the status in V2 Table 0078 "Interpretation Codes.
+         */
+        TOX, 
+        /**
+         * Interpretation of normality or degree of abnormality (including critical or "alert" level). Concepts in this category are mutually exclusive, i.e., at most one is allowed.
+         */
+        _OBSERVATIONINTERPRETATIONNORMALITY, 
+        /**
+         * The result or observation value is outside the reference range or expected norm (as defined for the respective test procedure).
+
+                        [Note: Typically applies to non-numeric results.]
+         */
+        A, 
+        /**
+         * The result or observation value is outside a reference range or expected norm at a level at which immediate action should be considered for patient safety (as defined for the respective test procedure).
+
+                        [Note: Typically applies to non-numeric results.  Analogous to critical/panic limits for numeric results.]
+         */
+        AA, 
+        /**
+         * The result for a quantitative observation is above a reference level at which immediate action should be considered for patient safety (as defined for the respective test procedure).
+
+                        Synonym: Above upper panic limits.
+         */
+        HH, 
+        /**
+         * The result for a quantitative observation is below a reference level at which immediate action should be considered for patient safety (as defined for the respective test procedure).
+
+                        Synonym: Below lower panic limits.
+         */
+        LL, 
+        /**
+         * The result for a quantitative observation is above the upper limit of the reference range (as defined for the respective test procedure).
+
+                        Synonym: Above high normal
+         */
+        H, 
+        /**
+         * A test result that is significantly higher than the reference (normal) or therapeutic interval, but has not reached the critically high value and might need special attention, as defined by the laboratory or the clinician.[Note: This level is situated between 'H' and 'HH'.]
+
+                        
+                           Deprecation Comment: The code 'H>' is being deprecated in order to align with the use of the code 'HU' for "Very high" in V2 Table 0078 "Interpretation Codes".
+
+                        [Note: The use of code 'H>' is non-preferred, as this code is deprecated and on track to be retired; use code 'HU' instead.
+         */
+        H_, 
+        /**
+         * A test result that is significantly higher than the reference (normal) or therapeutic interval, but has not reached the critically high value and might need special attention, as defined by the laboratory or the clinician.
+         */
+        HU, 
+        /**
+         * The result for a quantitative observation is below the lower limit of the reference range (as defined for the respective test procedure).
+
+                        Synonym: Below low normal
+         */
+        L, 
+        /**
+         * A test result that is significantly lower than the reference (normal) or therapeutic interval, but has not reached the critically low value and might need special attention, as defined by the laboratory or the clinician.[Note: This level is situated between 'L' and 'LL'.]
+
+                        
+                           Deprecation Comment: The code 'L<' is being deprecated in order to align with the use of the code 'LU' for "Very low" in V2 Table 0078 "Interpretation Codes".
+
+                        [Note: The use of code 'L<' is non-preferred, as this code is deprecated and on track to be retired; use code 'LU' instead.
+         */
+        L_, 
+        /**
+         * A test result that is significantly lower than the reference (normal) or therapeutic interval, but has not reached the critically low value and might need special attention, as defined by the laboratory or the clinician.
+         */
+        LU, 
+        /**
+         * The result or observation value is within the reference range or expected norm (as defined for the respective test procedure).
+
+                        [Note: Applies to numeric or non-numeric results.]
+         */
+        N, 
+        /**
+         * Interpretations of anti-microbial susceptibility testing results (microbiology). At most one allowed.
+         */
+        _OBSERVATIONINTERPRETATIONSUSCEPTIBILITY, 
+        /**
+         * Bacterial strain inhibited in vitro by a concentration of an antimicrobial agent that is associated with uncertain therapeutic effect. Reference: CLSI (http://www.clsi.org/Content/NavigationMenu/Resources/HarmonizedTerminologyDatabase/Harmonized_Terminolo.htm)
+Projects: ISO 20776-1, ISO 20776-2
+
+                        [Note 1: Bacterial strains are categorized as intermediate by applying the appropriate breakpoints in a defined phenotypic test system.]
+
+                        [Note 2: This class of susceptibility implies that an infection due to the isolate can be appropriately treated in body sites where the drugs are physiologically concentrated or when a high dosage of drug can be used.]
+
+                        [Note 3: This class also indicates a "buffer zone," to prevent small, uncontrolled, technical factors from causing major discrepancies in interpretations.]
+
+                        [Note 4: These breakpoints can be altered due to changes in circumstances (e.g., changes in commonly used drug dosages, emergence of new resistance mechanisms).]
+         */
+        I, 
+        /**
+         * The patient is considered as carrier based on the testing results. A carrier is an individual who carries an altered form of a gene which can lead to having a child or offspring in future generations with a genetic disorder.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This antimicrobial susceptibility test interpretation concept is recommended by OO to be deprecated as it is no longer recommended for use in susceptibility testing by CLSI (reference CLSI document M100-S22; Vol. 32 No.3; CLSI Performance Standards for Antimicrobial Susceptibility Testing; Twenty-Second Informational Supplement. Jan 2012).
+         */
+        MS, 
+        /**
+         * A category used for isolates for which only a susceptible interpretive criterion has been designated because of the absence or rare occurrence of resistant strains. Isolates that have MICs above or zone diameters below the value indicated for the susceptible breakpoint should be reported as non-susceptible.
+
+                        NOTE 1: An isolate that is interpreted as non-susceptible does not necessarily mean that the isolate has a resistance mechanism. It is possible that isolates with MICs above the susceptible breakpoint that lack resistance mechanisms may be encountered within the wild-type distribution subsequent to the time the susceptible-only breakpoint is set. 
+
+                        NOTE 2: For strains yielding results in the "nonsusceptible" category, organism identification and antimicrobial susceptibility test results should be confirmed.
+
+                        Synonym: decreased susceptibility.
+         */
+        NS, 
+        /**
+         * Bacterial strain inhibited in vitro by a concentration of an antimicrobial agent that is associated with a high likelihood of therapeutic failure.
+Reference: CLSI (http://www.clsi.org/Content/NavigationMenu/Resources/HarmonizedTerminologyDatabase/Harmonized_Terminolo.htm)  
+Projects: ISO 20776-1, ISO 20776-2
+
+                        [Note 1: Bacterial strains are categorized as resistant by applying the appropriate breakpoints in a defined phenotypic test system.]
+
+                        [Note 2: This breakpoint can be altered due to changes in circumstances (e.g., changes in commonly used drug dosages, emergence of new resistance mechanisms).]
+         */
+        R, 
+        /**
+         * A category for isolates where the bacteria (e.g. enterococci) are not susceptible in vitro to a combination therapy (e.g., high-level aminoglycoside and cell wall active agent).  This is predictive that this combination therapy will not be effective. 
+
+                        
+                           Usage Note: Since the use of penicillin or ampicillin alone often results in treatment failure of serious enterococcal or other bacterial infections, combination therapy is usually indicated to enhance bactericidal activity. The synergy between a cell wall active agent (such as penicillin, ampicillin, or vancomycin) and an aminoglycoside (such as gentamicin, kanamycin or streptomycin) is best predicted by screening for high-level bacterial resistance to the aminoglycoside.
+
+                        
+                           Open Issue: The print name of the code is very general and the description is very specific to a pair of classes of agents, which may lead to confusion of these concepts in the future should other synergies be found.
+         */
+        SYNR, 
+        /**
+         * Bacterial strain inhibited by in vitro concentration of an antimicrobial agent that is associated with a high likelihood of therapeutic success.
+Reference: CLSI (http://www.clsi.org/Content/NavigationMenu/Resources/HarmonizedTerminologyDatabase/Harmonized_Terminolo.htm)
+Synonym (earlier term): Sensitive Projects: ISO 20776-1, ISO 20776-2
+
+                        [Note 1: Bacterial strains are categorized as susceptible by applying the appropriate breakpoints in a defined phenotypic system.]
+
+                        [Note 2: This breakpoint can be altered due to changes in circumstances (e.g., changes in commonly used drug dosages, emergence of new resistance mechanisms).]
+         */
+        S, 
+        /**
+         * A category that includes isolates with antimicrobial agent minimum inhibitory concentrations (MICs) that approach usually attainable blood and tissue levels and for which response rates may be lower than for susceptible isolates.
+
+                        Reference: CLSI document M44-A2 2009 "Method for antifungal disk diffusion susceptibility testing of yeasts; approved guideline - second edition" - page 2.
+         */
+        SDD, 
+        /**
+         * A category for isolates where the bacteria (e.g. enterococci) are susceptible in vitro to a combination therapy (e.g., high-level aminoglycoside and cell wall active agent).  This is predictive that this combination therapy will be effective. 
+
+                        
+                           Usage Note: Since the use of penicillin or ampicillin alone often results in treatment failure of serious enterococcal or other bacterial infections, combination therapy is usually indicated to enhance bactericidal activity. The synergy between a cell wall active agent (such as penicillin, ampicillin, or vancomycin) and an aminoglycoside (such as gentamicin, kanamycin or streptomycin) is best predicted by screening for high-level bacterial resistance to the aminoglycoside.
+
+                        
+                           Open Issue: The print name of the code is very general and the description is very specific to a pair of classes of agents, which may lead to confusion of these concepts in the future should other synergies be found.
+         */
+        SYNS, 
+        /**
+         * The patient is considered as carrier based on the testing results. A carrier is an individual who carries an altered form of a gene which can lead to having a child or offspring in future generations with a genetic disorder.
+
+                        
+                           
+                              Deprecation Comment: 
+                           This antimicrobial susceptibility test interpretation concept is recommended by OO to be deprecated as it is no longer recommended for use in susceptibility testing by CLSI (reference CLSI document M100-S22; Vol. 32 No.3; CLSI Performance Standards for Antimicrobial Susceptibility Testing; Twenty-Second Informational Supplement. Jan 2012).
+         */
+        VS, 
+        /**
+         * The observation/test result is interpreted as being outside the inclusion range for a particular protocol within which the result is being reported.
+
+
+                        Example: A positive result on a Hepatitis screening test.
+                           Open Issue: EX, HX, LX: These three concepts do not seem to meet a clear need in the vocabulary, and their use in observation interpretation appears likely to be covered by other existing concepts (e.g., A, H, L).  The only apparent significant difference is their reference to use in protocols for exclusion of study subjects.
+These concepts/codes were proposed by RCRIM for use in the CTLaboratory message.  They were submitted and approved in the November 2005 Harmonization cycle in proposal "030103C_VOCAB_RCRIM_l_quade_RCRIM Obs Interp_20051028154455".  However, this proposal was not fully implemented in the vocabulary.  The proposal recommended creation of the x_ClinicalResearchExclusion domain in ObservationInterpretation with a value set including those three concepts/codes, but there is no subdomain of that name or equivalent with a binding to either of the value sets that contain these concepts/codes.
+Members of the OO WG have recently attempted to contact members of RCRIM regarding these concepts, both by email and at the recent WGM in Atlanta, without response.  It is felt by OO that the best course of action to take at this time is to add this comprehensive Open Issue rather than deprecate these three concepts at this time, until further discussion is held.
+         */
+        EX, 
+        /**
+         * The observation/test result is interpreted as being outside the inclusion range for a particular protocol within which the result is being reported.
+
+
+                        Example: A positive result on a Hepatitis screening test.
+                           Open Issue: EX, HX, LX: These three concepts do not seem to meet a clear need in the vocabulary, and their use in observation interpretation appears likely to be covered by other existing concepts (e.g., A, H, L).  The only apparent significant difference is their reference to use in protocols for exclusion of study subjects.  These concepts/codes were proposed by RCRIM for use in the CTLaboratory message.  They were submitted and approved in the November 2005 Harmonization cycle in proposal "030103C_VOCAB_RCRIM_l_quade_RCRIM Obs Interp_20051028154455". However, this proposal was not fully implemented in the vocabulary.  The proposal recommended creation of the x_ClinicalResearchExclusion domain in ObservationInterpretation with a value set including those three concepts/codes, but there is no subdomain of that name or equivalent with a binding to either of the value sets that contain these concepts/codes.  Members of the OO WG have recently attempted to contact members of RCRIM regarding these concepts, both by email and at the recent WGM in Atlanta, without response.  It is felt by OO that the best course of action to take at this time is to add this comprehensive Open Issue rather than deprecate these three concepts at this time, until further discussion is held.
+         */
+        HX, 
+        /**
+         * The numeric observation/test result is interpreted as being below the low threshold value for a particular protocol within which the result is being reported.
+
+                        Example: A Total White Blood Cell Count falling below a protocol-defined threshold value of 3000/mm^3
+                           Open Issue: EX, HX, LX: These three concepts do not seem to meet a clear need in the vocabulary, and their use in observation interpretation appears likely to be covered by other existing concepts (e.g., A, H, L).  The only apparent significant difference is their reference to use in protocols for exclusion of study subjects.  These concepts/codes were proposed by RCRIM for use in the CTLaboratory message.  They were submitted and approved in the November 2005 Harmonization cycle in proposal "030103C_VOCAB_RCRIM_l_quade_RCRIM Obs Interp_20051028154455".  However, this proposal was not fully implemented in the vocabulary.  The proposal recommended creation of the x_ClinicalResearchExclusion domain in ObservationInterpretation with a value set including those three concepts/codes, but there is no subdomain of that name or equivalent with a binding to either of the value sets that contain these concepts/codes.  Members of the OO WG have recently attempted to contact members of RCRIM regarding these concepts, both by email and at the recent WGM in Atlanta, without response.  It is felt by OO that the best course of action to take at this time is to add this comprehensive Open Issue rather than deprecate these three concepts at this time, until further discussion is held.
+         */
+        LX, 
+        /**
+         * Hold for Medical Review
+
+                        
+                           Usage Note: This code is not intended for use in V3 artifacts.  It is included in the code system to maintain alignment with the V2 Table 0078 "Interpretation Codes."
+         */
+        HM, 
+        /**
+         * Interpretations of the presence or absence of a component / analyte or organism in a test or of a sign in a clinical observation. In keeping with laboratory data processing practice, these concepts provide a categorical interpretation of the "meaning" of the quantitative value for the same observation.
+         */
+        OBSERVATIONINTERPRETATIONDETECTION, 
+        /**
+         * The specified component / analyte, organism or clinical sign could neither be declared positive / negative nor detected / not detected by the performed test or procedure.
+
+                        
+                           Usage Note: For example, if the specimen was degraded, poorly processed, or was missing the required anatomic structures, then "indeterminate" (i.e. "cannot be determined") is the appropriate response, not "equivocal".
+         */
+        IND, 
+        /**
+         * The test or procedure was successfully performed, but the results are borderline and can neither be declared positive / negative nor detected / not detected according to the current established criteria.
+         */
+        E, 
+        /**
+         * An absence finding of the specified component / analyte, organism or clinical sign based on the established threshold of the performed test or procedure.
+
+                        [Note: Negative does not necessarily imply the complete absence of the specified item.]
+         */
+        NEG, 
+        /**
+         * The presence of the specified component / analyte, organism or clinical sign could not be determined within the limit of detection of the performed test or procedure.
+         */
+        ND, 
+        /**
+         * A presence finding of the specified component / analyte, organism or clinical sign based on the established threshold of the performed test or procedure.
+         */
+        POS, 
+        /**
+         * The measurement of the specified component / analyte, organism or clinical sign above the limit of detection of the performed test or procedure.
+         */
+        DET, 
+        /**
+         * Interpretation of the observed result taking into account additional information (contraindicators) about the patient's situation. Concepts in this category are mutually exclusive, i.e., at most one is allowed.
+         */
+        OBSERVATIONINTERPRETATIONEXPECTATION, 
+        /**
+         * This result has been evaluated in light of known contraindicators.  Once those contraindicators have been taken into account the result is determined to be "Expected"  (e.g., presence of drugs in a patient that is taking prescription medication for pain management).
+         */
+        EXP, 
+        /**
+         * This result has been evaluated in light of known contraindicators.  Once those contraindicators have been taken into account the result is determined to be "Unexpected" (e.g., presence of non-prescribed drugs in a patient that is taking prescription medication for pain management).
+         */
+        UNE, 
+        /**
+         * Interpretation qualifiers in separate OBX segments
+
+                        
+                           Usage Note: This code is not intended for use in V3 artifacts.  It is included in the code system to maintain alignment with the V2 Table 0078 "Interpretation Codes."
+         */
+        OBX, 
+        /**
+         * Interpretations of the presence and level of reactivity of the specified component / analyte with the reagent in the performed laboratory test.
+         */
+        REACTIVITYOBSERVATIONINTERPRETATION, 
+        /**
+         * An absence finding used to indicate that the specified component / analyte did not react measurably with the reagent.
+         */
+        NR, 
+        /**
+         * A presence finding used to indicate that the specified component / analyte reacted with the reagent above the reliably measurable limit of the performed test.
+         */
+        RR, 
+        /**
+         * A weighted presence finding used to indicate that the specified component / analyte reacted with the reagent, but below the reliably measurable limit of the performed test.
+         */
+        WR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ObservationInterpretation fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_GeneticObservationInterpretation".equals(codeString))
+          return _GENETICOBSERVATIONINTERPRETATION;
+        if ("CAR".equals(codeString))
+          return CAR;
+        if ("Carrier".equals(codeString))
+          return CARRIER;
+        if ("_ObservationInterpretationChange".equals(codeString))
+          return _OBSERVATIONINTERPRETATIONCHANGE;
+        if ("B".equals(codeString))
+          return B;
+        if ("D".equals(codeString))
+          return D;
+        if ("U".equals(codeString))
+          return U;
+        if ("W".equals(codeString))
+          return W;
+        if ("_ObservationInterpretationExceptions".equals(codeString))
+          return _OBSERVATIONINTERPRETATIONEXCEPTIONS;
+        if ("<".equals(codeString))
+          return LESS_THAN;
+        if (">".equals(codeString))
+          return GREATER_THAN;
+        if ("AC".equals(codeString))
+          return AC;
+        if ("IE".equals(codeString))
+          return IE;
+        if ("QCF".equals(codeString))
+          return QCF;
+        if ("TOX".equals(codeString))
+          return TOX;
+        if ("_ObservationInterpretationNormality".equals(codeString))
+          return _OBSERVATIONINTERPRETATIONNORMALITY;
+        if ("A".equals(codeString))
+          return A;
+        if ("AA".equals(codeString))
+          return AA;
+        if ("HH".equals(codeString))
+          return HH;
+        if ("LL".equals(codeString))
+          return LL;
+        if ("H".equals(codeString))
+          return H;
+        if ("H>".equals(codeString))
+          return H_;
+        if ("HU".equals(codeString))
+          return HU;
+        if ("L".equals(codeString))
+          return L;
+        if ("L<".equals(codeString))
+          return L_;
+        if ("LU".equals(codeString))
+          return LU;
+        if ("N".equals(codeString))
+          return N;
+        if ("_ObservationInterpretationSusceptibility".equals(codeString))
+          return _OBSERVATIONINTERPRETATIONSUSCEPTIBILITY;
+        if ("I".equals(codeString))
+          return I;
+        if ("MS".equals(codeString))
+          return MS;
+        if ("NS".equals(codeString))
+          return NS;
+        if ("R".equals(codeString))
+          return R;
+        if ("SYN-R".equals(codeString))
+          return SYNR;
+        if ("S".equals(codeString))
+          return S;
+        if ("SDD".equals(codeString))
+          return SDD;
+        if ("SYN-S".equals(codeString))
+          return SYNS;
+        if ("VS".equals(codeString))
+          return VS;
+        if ("EX".equals(codeString))
+          return EX;
+        if ("HX".equals(codeString))
+          return HX;
+        if ("LX".equals(codeString))
+          return LX;
+        if ("HM".equals(codeString))
+          return HM;
+        if ("ObservationInterpretationDetection".equals(codeString))
+          return OBSERVATIONINTERPRETATIONDETECTION;
+        if ("IND".equals(codeString))
+          return IND;
+        if ("E".equals(codeString))
+          return E;
+        if ("NEG".equals(codeString))
+          return NEG;
+        if ("ND".equals(codeString))
+          return ND;
+        if ("POS".equals(codeString))
+          return POS;
+        if ("DET".equals(codeString))
+          return DET;
+        if ("ObservationInterpretationExpectation".equals(codeString))
+          return OBSERVATIONINTERPRETATIONEXPECTATION;
+        if ("EXP".equals(codeString))
+          return EXP;
+        if ("UNE".equals(codeString))
+          return UNE;
+        if ("OBX".equals(codeString))
+          return OBX;
+        if ("ReactivityObservationInterpretation".equals(codeString))
+          return REACTIVITYOBSERVATIONINTERPRETATION;
+        if ("NR".equals(codeString))
+          return NR;
+        if ("RR".equals(codeString))
+          return RR;
+        if ("WR".equals(codeString))
+          return WR;
+        throw new FHIRException("Unknown V3ObservationInterpretation code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _GENETICOBSERVATIONINTERPRETATION: return "_GeneticObservationInterpretation";
+            case CAR: return "CAR";
+            case CARRIER: return "Carrier";
+            case _OBSERVATIONINTERPRETATIONCHANGE: return "_ObservationInterpretationChange";
+            case B: return "B";
+            case D: return "D";
+            case U: return "U";
+            case W: return "W";
+            case _OBSERVATIONINTERPRETATIONEXCEPTIONS: return "_ObservationInterpretationExceptions";
+            case LESS_THAN: return "<";
+            case GREATER_THAN: return ">";
+            case AC: return "AC";
+            case IE: return "IE";
+            case QCF: return "QCF";
+            case TOX: return "TOX";
+            case _OBSERVATIONINTERPRETATIONNORMALITY: return "_ObservationInterpretationNormality";
+            case A: return "A";
+            case AA: return "AA";
+            case HH: return "HH";
+            case LL: return "LL";
+            case H: return "H";
+            case H_: return "H>";
+            case HU: return "HU";
+            case L: return "L";
+            case L_: return "L<";
+            case LU: return "LU";
+            case N: return "N";
+            case _OBSERVATIONINTERPRETATIONSUSCEPTIBILITY: return "_ObservationInterpretationSusceptibility";
+            case I: return "I";
+            case MS: return "MS";
+            case NS: return "NS";
+            case R: return "R";
+            case SYNR: return "SYN-R";
+            case S: return "S";
+            case SDD: return "SDD";
+            case SYNS: return "SYN-S";
+            case VS: return "VS";
+            case EX: return "EX";
+            case HX: return "HX";
+            case LX: return "LX";
+            case HM: return "HM";
+            case OBSERVATIONINTERPRETATIONDETECTION: return "ObservationInterpretationDetection";
+            case IND: return "IND";
+            case E: return "E";
+            case NEG: return "NEG";
+            case ND: return "ND";
+            case POS: return "POS";
+            case DET: return "DET";
+            case OBSERVATIONINTERPRETATIONEXPECTATION: return "ObservationInterpretationExpectation";
+            case EXP: return "EXP";
+            case UNE: return "UNE";
+            case OBX: return "OBX";
+            case REACTIVITYOBSERVATIONINTERPRETATION: return "ReactivityObservationInterpretation";
+            case NR: return "NR";
+            case RR: return "RR";
+            case WR: return "WR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ObservationInterpretation";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _GENETICOBSERVATIONINTERPRETATION: return "Codes that specify interpretation of genetic analysis, such as \"positive\", \"negative\", \"carrier\", \"responsive\", etc.";
+            case CAR: return "The patient is considered as carrier based on the testing results. A carrier is an individual who carries an altered form of a gene which can lead to having a child or offspring in future generations with a genetic disorder.";
+            case CARRIER: return "The patient is considered as carrier based on the testing results. A carrier is an individual who carries an altered form of a gene which can lead to having a child or offspring in future generations with a genetic disorder.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This code is currently the same string as the print name for this concept and is inconsistent with the conventions being used for the other codes in the coding system, as it is a full word with initial capitalization, rather than an all upper case mnemonic.  The recommendation from OO is to deprecate the code \"Carrier\" and to add \"CAR\" as the new active code representation for this concept.";
+            case _OBSERVATIONINTERPRETATIONCHANGE: return "Interpretations of change of quantity and/or severity. At most one of B or W and one of U or D allowed.";
+            case B: return "The current result or observation value has improved compared to the previous result or observation value (the change is significant as defined in the respective test procedure).\r\n\n                        [Note: This can be applied to quantitative or qualitative observations.]";
+            case D: return "The current result has decreased from the previous result for a quantitative observation (the change is significant as defined in the respective test procedure).";
+            case U: return "The current result has increased from the previous result for a quantitative observation (the change is significant as defined in the respective test procedure).";
+            case W: return "The current result or observation value has degraded compared to the previous result or observation value (the change is significant as defined in the respective test procedure).\r\n\n                        [Note: This can be applied to quantitative or qualitative observations.]";
+            case _OBSERVATIONINTERPRETATIONEXCEPTIONS: return "Technical exceptions resulting in the inability to provide an interpretation. At most one allowed. Does not imply normality or severity.";
+            case LESS_THAN: return "The result is below the minimum detection limit (the test procedure or equipment is the limiting factor).\r\n\n                        Synonyms: Below analytical limit, low off scale.";
+            case GREATER_THAN: return "The result is above the maximum quantifiable limit (the test procedure or equipment is the limiting factor).\r\n\n                        Synonyms: Above analytical limit, high off scale.";
+            case AC: return "A valid result cannot be obtained for the specified component / analyte due to the presence of anti-complementary substances in the sample.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This code is being deprecated to match the status in V2 Table 0078 \"Interpretation Codes.";
+            case IE: return "There is insufficient evidence that the species in question is a good target for therapy with the drug.  A categorical interpretation is not possible.\r\n\n                        [Note: A MIC with \"IE\" and/or a comment may be reported (without an accompanying S, I or R-categorization).]";
+            case QCF: return "A result cannot be considered valid for the specified component / analyte or organism due to failure in the quality control testing component.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This code is being deprecated to match the status in V2 Table 0078 \"Interpretation Codes.";
+            case TOX: return "A valid result cannot be obtained for the specified organism or cell line due to the presence of cytotoxic substances in the sample or culture.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This code is being deprecated to match the status in V2 Table 0078 \"Interpretation Codes.";
+            case _OBSERVATIONINTERPRETATIONNORMALITY: return "Interpretation of normality or degree of abnormality (including critical or \"alert\" level). Concepts in this category are mutually exclusive, i.e., at most one is allowed.";
+            case A: return "The result or observation value is outside the reference range or expected norm (as defined for the respective test procedure).\r\n\n                        [Note: Typically applies to non-numeric results.]";
+            case AA: return "The result or observation value is outside a reference range or expected norm at a level at which immediate action should be considered for patient safety (as defined for the respective test procedure).\r\n\n                        [Note: Typically applies to non-numeric results.  Analogous to critical/panic limits for numeric results.]";
+            case HH: return "The result for a quantitative observation is above a reference level at which immediate action should be considered for patient safety (as defined for the respective test procedure).\r\n\n                        Synonym: Above upper panic limits.";
+            case LL: return "The result for a quantitative observation is below a reference level at which immediate action should be considered for patient safety (as defined for the respective test procedure).\r\n\n                        Synonym: Below lower panic limits.";
+            case H: return "The result for a quantitative observation is above the upper limit of the reference range (as defined for the respective test procedure).\r\n\n                        Synonym: Above high normal";
+            case H_: return "A test result that is significantly higher than the reference (normal) or therapeutic interval, but has not reached the critically high value and might need special attention, as defined by the laboratory or the clinician.[Note: This level is situated between 'H' and 'HH'.]\r\n\n                        \n                           Deprecation Comment: The code 'H>' is being deprecated in order to align with the use of the code 'HU' for \"Very high\" in V2 Table 0078 \"Interpretation Codes\".\r\n\n                        [Note: The use of code 'H>' is non-preferred, as this code is deprecated and on track to be retired; use code 'HU' instead.";
+            case HU: return "A test result that is significantly higher than the reference (normal) or therapeutic interval, but has not reached the critically high value and might need special attention, as defined by the laboratory or the clinician.";
+            case L: return "The result for a quantitative observation is below the lower limit of the reference range (as defined for the respective test procedure).\r\n\n                        Synonym: Below low normal";
+            case L_: return "A test result that is significantly lower than the reference (normal) or therapeutic interval, but has not reached the critically low value and might need special attention, as defined by the laboratory or the clinician.[Note: This level is situated between 'L' and 'LL'.]\r\n\n                        \n                           Deprecation Comment: The code 'L<' is being deprecated in order to align with the use of the code 'LU' for \"Very low\" in V2 Table 0078 \"Interpretation Codes\".\r\n\n                        [Note: The use of code 'L<' is non-preferred, as this code is deprecated and on track to be retired; use code 'LU' instead.";
+            case LU: return "A test result that is significantly lower than the reference (normal) or therapeutic interval, but has not reached the critically low value and might need special attention, as defined by the laboratory or the clinician.";
+            case N: return "The result or observation value is within the reference range or expected norm (as defined for the respective test procedure).\r\n\n                        [Note: Applies to numeric or non-numeric results.]";
+            case _OBSERVATIONINTERPRETATIONSUSCEPTIBILITY: return "Interpretations of anti-microbial susceptibility testing results (microbiology). At most one allowed.";
+            case I: return "Bacterial strain inhibited in vitro by a concentration of an antimicrobial agent that is associated with uncertain therapeutic effect. Reference: CLSI (http://www.clsi.org/Content/NavigationMenu/Resources/HarmonizedTerminologyDatabase/Harmonized_Terminolo.htm)\nProjects: ISO 20776-1, ISO 20776-2\r\n\n                        [Note 1: Bacterial strains are categorized as intermediate by applying the appropriate breakpoints in a defined phenotypic test system.]\r\n\n                        [Note 2: This class of susceptibility implies that an infection due to the isolate can be appropriately treated in body sites where the drugs are physiologically concentrated or when a high dosage of drug can be used.]\r\n\n                        [Note 3: This class also indicates a \"buffer zone,\" to prevent small, uncontrolled, technical factors from causing major discrepancies in interpretations.]\r\n\n                        [Note 4: These breakpoints can be altered due to changes in circumstances (e.g., changes in commonly used drug dosages, emergence of new resistance mechanisms).]";
+            case MS: return "The patient is considered as carrier based on the testing results. A carrier is an individual who carries an altered form of a gene which can lead to having a child or offspring in future generations with a genetic disorder.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This antimicrobial susceptibility test interpretation concept is recommended by OO to be deprecated as it is no longer recommended for use in susceptibility testing by CLSI (reference CLSI document M100-S22; Vol. 32 No.3; CLSI Performance Standards for Antimicrobial Susceptibility Testing; Twenty-Second Informational Supplement. Jan 2012).";
+            case NS: return "A category used for isolates for which only a susceptible interpretive criterion has been designated because of the absence or rare occurrence of resistant strains. Isolates that have MICs above or zone diameters below the value indicated for the susceptible breakpoint should be reported as non-susceptible.\r\n\n                        NOTE 1: An isolate that is interpreted as non-susceptible does not necessarily mean that the isolate has a resistance mechanism. It is possible that isolates with MICs above the susceptible breakpoint that lack resistance mechanisms may be encountered within the wild-type distribution subsequent to the time the susceptible-only breakpoint is set. \r\n\n                        NOTE 2: For strains yielding results in the \"nonsusceptible\" category, organism identification and antimicrobial susceptibility test results should be confirmed.\r\n\n                        Synonym: decreased susceptibility.";
+            case R: return "Bacterial strain inhibited in vitro by a concentration of an antimicrobial agent that is associated with a high likelihood of therapeutic failure.\nReference: CLSI (http://www.clsi.org/Content/NavigationMenu/Resources/HarmonizedTerminologyDatabase/Harmonized_Terminolo.htm)  \nProjects: ISO 20776-1, ISO 20776-2\r\n\n                        [Note 1: Bacterial strains are categorized as resistant by applying the appropriate breakpoints in a defined phenotypic test system.]\r\n\n                        [Note 2: This breakpoint can be altered due to changes in circumstances (e.g., changes in commonly used drug dosages, emergence of new resistance mechanisms).]";
+            case SYNR: return "A category for isolates where the bacteria (e.g. enterococci) are not susceptible in vitro to a combination therapy (e.g., high-level aminoglycoside and cell wall active agent).  This is predictive that this combination therapy will not be effective. \r\n\n                        \n                           Usage Note: Since the use of penicillin or ampicillin alone often results in treatment failure of serious enterococcal or other bacterial infections, combination therapy is usually indicated to enhance bactericidal activity. The synergy between a cell wall active agent (such as penicillin, ampicillin, or vancomycin) and an aminoglycoside (such as gentamicin, kanamycin or streptomycin) is best predicted by screening for high-level bacterial resistance to the aminoglycoside.\r\n\n                        \n                           Open Issue: The print name of the code is very general and the description is very specific to a pair of classes of agents, which may lead to confusion of these concepts in the future should other synergies be found.";
+            case S: return "Bacterial strain inhibited by in vitro concentration of an antimicrobial agent that is associated with a high likelihood of therapeutic success.\nReference: CLSI (http://www.clsi.org/Content/NavigationMenu/Resources/HarmonizedTerminologyDatabase/Harmonized_Terminolo.htm)\nSynonym (earlier term): Sensitive Projects: ISO 20776-1, ISO 20776-2\r\n\n                        [Note 1: Bacterial strains are categorized as susceptible by applying the appropriate breakpoints in a defined phenotypic system.]\r\n\n                        [Note 2: This breakpoint can be altered due to changes in circumstances (e.g., changes in commonly used drug dosages, emergence of new resistance mechanisms).]";
+            case SDD: return "A category that includes isolates with antimicrobial agent minimum inhibitory concentrations (MICs) that approach usually attainable blood and tissue levels and for which response rates may be lower than for susceptible isolates.\r\n\n                        Reference: CLSI document M44-A2 2009 \"Method for antifungal disk diffusion susceptibility testing of yeasts; approved guideline - second edition\" - page 2.";
+            case SYNS: return "A category for isolates where the bacteria (e.g. enterococci) are susceptible in vitro to a combination therapy (e.g., high-level aminoglycoside and cell wall active agent).  This is predictive that this combination therapy will be effective. \r\n\n                        \n                           Usage Note: Since the use of penicillin or ampicillin alone often results in treatment failure of serious enterococcal or other bacterial infections, combination therapy is usually indicated to enhance bactericidal activity. The synergy between a cell wall active agent (such as penicillin, ampicillin, or vancomycin) and an aminoglycoside (such as gentamicin, kanamycin or streptomycin) is best predicted by screening for high-level bacterial resistance to the aminoglycoside.\r\n\n                        \n                           Open Issue: The print name of the code is very general and the description is very specific to a pair of classes of agents, which may lead to confusion of these concepts in the future should other synergies be found.";
+            case VS: return "The patient is considered as carrier based on the testing results. A carrier is an individual who carries an altered form of a gene which can lead to having a child or offspring in future generations with a genetic disorder.\r\n\n                        \n                           \n                              Deprecation Comment: \n                           This antimicrobial susceptibility test interpretation concept is recommended by OO to be deprecated as it is no longer recommended for use in susceptibility testing by CLSI (reference CLSI document M100-S22; Vol. 32 No.3; CLSI Performance Standards for Antimicrobial Susceptibility Testing; Twenty-Second Informational Supplement. Jan 2012).";
+            case EX: return "The observation/test result is interpreted as being outside the inclusion range for a particular protocol within which the result is being reported.\n\r\n\n                        Example: A positive result on a Hepatitis screening test.\n                           Open Issue: EX, HX, LX: These three concepts do not seem to meet a clear need in the vocabulary, and their use in observation interpretation appears likely to be covered by other existing concepts (e.g., A, H, L).  The only apparent significant difference is their reference to use in protocols for exclusion of study subjects.\nThese concepts/codes were proposed by RCRIM for use in the CTLaboratory message.  They were submitted and approved in the November 2005 Harmonization cycle in proposal \"030103C_VOCAB_RCRIM_l_quade_RCRIM Obs Interp_20051028154455\".  However, this proposal was not fully implemented in the vocabulary.  The proposal recommended creation of the x_ClinicalResearchExclusion domain in ObservationInterpretation with a value set including those three concepts/codes, but there is no subdomain of that name or equivalent with a binding to either of the value sets that contain these concepts/codes.\nMembers of the OO WG have recently attempted to contact members of RCRIM regarding these concepts, both by email and at the recent WGM in Atlanta, without response.  It is felt by OO that the best course of action to take at this time is to add this comprehensive Open Issue rather than deprecate these three concepts at this time, until further discussion is held.";
+            case HX: return "The observation/test result is interpreted as being outside the inclusion range for a particular protocol within which the result is being reported.\n\r\n\n                        Example: A positive result on a Hepatitis screening test.\n                           Open Issue: EX, HX, LX: These three concepts do not seem to meet a clear need in the vocabulary, and their use in observation interpretation appears likely to be covered by other existing concepts (e.g., A, H, L).  The only apparent significant difference is their reference to use in protocols for exclusion of study subjects.  These concepts/codes were proposed by RCRIM for use in the CTLaboratory message.  They were submitted and approved in the November 2005 Harmonization cycle in proposal \"030103C_VOCAB_RCRIM_l_quade_RCRIM Obs Interp_20051028154455\". However, this proposal was not fully implemented in the vocabulary.  The proposal recommended creation of the x_ClinicalResearchExclusion domain in ObservationInterpretation with a value set including those three concepts/codes, but there is no subdomain of that name or equivalent with a binding to either of the value sets that contain these concepts/codes.  Members of the OO WG have recently attempted to contact members of RCRIM regarding these concepts, both by email and at the recent WGM in Atlanta, without response.  It is felt by OO that the best course of action to take at this time is to add this comprehensive Open Issue rather than deprecate these three concepts at this time, until further discussion is held.";
+            case LX: return "The numeric observation/test result is interpreted as being below the low threshold value for a particular protocol within which the result is being reported.\r\n\n                        Example: A Total White Blood Cell Count falling below a protocol-defined threshold value of 3000/mm^3\n                           Open Issue: EX, HX, LX: These three concepts do not seem to meet a clear need in the vocabulary, and their use in observation interpretation appears likely to be covered by other existing concepts (e.g., A, H, L).  The only apparent significant difference is their reference to use in protocols for exclusion of study subjects.  These concepts/codes were proposed by RCRIM for use in the CTLaboratory message.  They were submitted and approved in the November 2005 Harmonization cycle in proposal \"030103C_VOCAB_RCRIM_l_quade_RCRIM Obs Interp_20051028154455\".  However, this proposal was not fully implemented in the vocabulary.  The proposal recommended creation of the x_ClinicalResearchExclusion domain in ObservationInterpretation with a value set including those three concepts/codes, but there is no subdomain of that name or equivalent with a binding to either of the value sets that contain these concepts/codes.  Members of the OO WG have recently attempted to contact members of RCRIM regarding these concepts, both by email and at the recent WGM in Atlanta, without response.  It is felt by OO that the best course of action to take at this time is to add this comprehensive Open Issue rather than deprecate these three concepts at this time, until further discussion is held.";
+            case HM: return "Hold for Medical Review\r\n\n                        \n                           Usage Note: This code is not intended for use in V3 artifacts.  It is included in the code system to maintain alignment with the V2 Table 0078 \"Interpretation Codes.\"";
+            case OBSERVATIONINTERPRETATIONDETECTION: return "Interpretations of the presence or absence of a component / analyte or organism in a test or of a sign in a clinical observation. In keeping with laboratory data processing practice, these concepts provide a categorical interpretation of the \"meaning\" of the quantitative value for the same observation.";
+            case IND: return "The specified component / analyte, organism or clinical sign could neither be declared positive / negative nor detected / not detected by the performed test or procedure.\r\n\n                        \n                           Usage Note: For example, if the specimen was degraded, poorly processed, or was missing the required anatomic structures, then \"indeterminate\" (i.e. \"cannot be determined\") is the appropriate response, not \"equivocal\".";
+            case E: return "The test or procedure was successfully performed, but the results are borderline and can neither be declared positive / negative nor detected / not detected according to the current established criteria.";
+            case NEG: return "An absence finding of the specified component / analyte, organism or clinical sign based on the established threshold of the performed test or procedure.\r\n\n                        [Note: Negative does not necessarily imply the complete absence of the specified item.]";
+            case ND: return "The presence of the specified component / analyte, organism or clinical sign could not be determined within the limit of detection of the performed test or procedure.";
+            case POS: return "A presence finding of the specified component / analyte, organism or clinical sign based on the established threshold of the performed test or procedure.";
+            case DET: return "The measurement of the specified component / analyte, organism or clinical sign above the limit of detection of the performed test or procedure.";
+            case OBSERVATIONINTERPRETATIONEXPECTATION: return "Interpretation of the observed result taking into account additional information (contraindicators) about the patient's situation. Concepts in this category are mutually exclusive, i.e., at most one is allowed.";
+            case EXP: return "This result has been evaluated in light of known contraindicators.  Once those contraindicators have been taken into account the result is determined to be \"Expected\"  (e.g., presence of drugs in a patient that is taking prescription medication for pain management).";
+            case UNE: return "This result has been evaluated in light of known contraindicators.  Once those contraindicators have been taken into account the result is determined to be \"Unexpected\" (e.g., presence of non-prescribed drugs in a patient that is taking prescription medication for pain management).";
+            case OBX: return "Interpretation qualifiers in separate OBX segments\r\n\n                        \n                           Usage Note: This code is not intended for use in V3 artifacts.  It is included in the code system to maintain alignment with the V2 Table 0078 \"Interpretation Codes.\"";
+            case REACTIVITYOBSERVATIONINTERPRETATION: return "Interpretations of the presence and level of reactivity of the specified component / analyte with the reagent in the performed laboratory test.";
+            case NR: return "An absence finding used to indicate that the specified component / analyte did not react measurably with the reagent.";
+            case RR: return "A presence finding used to indicate that the specified component / analyte reacted with the reagent above the reliably measurable limit of the performed test.";
+            case WR: return "A weighted presence finding used to indicate that the specified component / analyte reacted with the reagent, but below the reliably measurable limit of the performed test.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _GENETICOBSERVATIONINTERPRETATION: return "GeneticObservationInterpretation";
+            case CAR: return "Carrier";
+            case CARRIER: return "Carrier";
+            case _OBSERVATIONINTERPRETATIONCHANGE: return "ObservationInterpretationChange";
+            case B: return "Better";
+            case D: return "Significant change down";
+            case U: return "Significant change up";
+            case W: return "Worse";
+            case _OBSERVATIONINTERPRETATIONEXCEPTIONS: return "ObservationInterpretationExceptions";
+            case LESS_THAN: return "Off scale low";
+            case GREATER_THAN: return "Off scale high";
+            case AC: return "Anti-complementary substances present";
+            case IE: return "Insufficient evidence";
+            case QCF: return "Quality control failure";
+            case TOX: return "Cytotoxic substance present";
+            case _OBSERVATIONINTERPRETATIONNORMALITY: return "ObservationInterpretationNormality";
+            case A: return "Abnormal";
+            case AA: return "Critical abnormal";
+            case HH: return "Critical high";
+            case LL: return "Critical low";
+            case H: return "High";
+            case H_: return "Significantly high";
+            case HU: return "Significantly high";
+            case L: return "Low";
+            case L_: return "Significantly low";
+            case LU: return "Significantly low";
+            case N: return "Normal";
+            case _OBSERVATIONINTERPRETATIONSUSCEPTIBILITY: return "ObservationInterpretationSusceptibility";
+            case I: return "Intermediate";
+            case MS: return "moderately susceptible";
+            case NS: return "Non-susceptible";
+            case R: return "Resistant";
+            case SYNR: return "Synergy - resistant";
+            case S: return "Susceptible";
+            case SDD: return "Susceptible-dose dependent";
+            case SYNS: return "Synergy - susceptible";
+            case VS: return "very susceptible";
+            case EX: return "outside threshold";
+            case HX: return "above high threshold";
+            case LX: return "below low threshold";
+            case HM: return "Hold for Medical Review";
+            case OBSERVATIONINTERPRETATIONDETECTION: return "ObservationInterpretationDetection";
+            case IND: return "Indeterminate";
+            case E: return "Equivocal";
+            case NEG: return "Negative";
+            case ND: return "Not detected";
+            case POS: return "Positive";
+            case DET: return "Detected";
+            case OBSERVATIONINTERPRETATIONEXPECTATION: return "ObservationInterpretationExpectation";
+            case EXP: return "Expected";
+            case UNE: return "Unexpected";
+            case OBX: return "Interpretation qualifiers in separate OBX segments";
+            case REACTIVITYOBSERVATIONINTERPRETATION: return "ReactivityObservationInterpretation";
+            case NR: return "Non-reactive";
+            case RR: return "Reactive";
+            case WR: return "Weakly reactive";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationInterpretationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationInterpretationEnumFactory.java
new file mode 100644
index 00000000000..a2db15cc7a5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationInterpretationEnumFactory.java
@@ -0,0 +1,278 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ObservationInterpretationEnumFactory implements EnumFactory {
+
+  public V3ObservationInterpretation fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_GeneticObservationInterpretation".equals(codeString))
+      return V3ObservationInterpretation._GENETICOBSERVATIONINTERPRETATION;
+    if ("CAR".equals(codeString))
+      return V3ObservationInterpretation.CAR;
+    if ("Carrier".equals(codeString))
+      return V3ObservationInterpretation.CARRIER;
+    if ("_ObservationInterpretationChange".equals(codeString))
+      return V3ObservationInterpretation._OBSERVATIONINTERPRETATIONCHANGE;
+    if ("B".equals(codeString))
+      return V3ObservationInterpretation.B;
+    if ("D".equals(codeString))
+      return V3ObservationInterpretation.D;
+    if ("U".equals(codeString))
+      return V3ObservationInterpretation.U;
+    if ("W".equals(codeString))
+      return V3ObservationInterpretation.W;
+    if ("_ObservationInterpretationExceptions".equals(codeString))
+      return V3ObservationInterpretation._OBSERVATIONINTERPRETATIONEXCEPTIONS;
+    if ("<".equals(codeString))
+      return V3ObservationInterpretation.LESS_THAN;
+    if (">".equals(codeString))
+      return V3ObservationInterpretation.GREATER_THAN;
+    if ("AC".equals(codeString))
+      return V3ObservationInterpretation.AC;
+    if ("IE".equals(codeString))
+      return V3ObservationInterpretation.IE;
+    if ("QCF".equals(codeString))
+      return V3ObservationInterpretation.QCF;
+    if ("TOX".equals(codeString))
+      return V3ObservationInterpretation.TOX;
+    if ("_ObservationInterpretationNormality".equals(codeString))
+      return V3ObservationInterpretation._OBSERVATIONINTERPRETATIONNORMALITY;
+    if ("A".equals(codeString))
+      return V3ObservationInterpretation.A;
+    if ("AA".equals(codeString))
+      return V3ObservationInterpretation.AA;
+    if ("HH".equals(codeString))
+      return V3ObservationInterpretation.HH;
+    if ("LL".equals(codeString))
+      return V3ObservationInterpretation.LL;
+    if ("H".equals(codeString))
+      return V3ObservationInterpretation.H;
+    if ("H>".equals(codeString))
+      return V3ObservationInterpretation.H_;
+    if ("HU".equals(codeString))
+      return V3ObservationInterpretation.HU;
+    if ("L".equals(codeString))
+      return V3ObservationInterpretation.L;
+    if ("L<".equals(codeString))
+      return V3ObservationInterpretation.L_;
+    if ("LU".equals(codeString))
+      return V3ObservationInterpretation.LU;
+    if ("N".equals(codeString))
+      return V3ObservationInterpretation.N;
+    if ("_ObservationInterpretationSusceptibility".equals(codeString))
+      return V3ObservationInterpretation._OBSERVATIONINTERPRETATIONSUSCEPTIBILITY;
+    if ("I".equals(codeString))
+      return V3ObservationInterpretation.I;
+    if ("MS".equals(codeString))
+      return V3ObservationInterpretation.MS;
+    if ("NS".equals(codeString))
+      return V3ObservationInterpretation.NS;
+    if ("R".equals(codeString))
+      return V3ObservationInterpretation.R;
+    if ("SYN-R".equals(codeString))
+      return V3ObservationInterpretation.SYNR;
+    if ("S".equals(codeString))
+      return V3ObservationInterpretation.S;
+    if ("SDD".equals(codeString))
+      return V3ObservationInterpretation.SDD;
+    if ("SYN-S".equals(codeString))
+      return V3ObservationInterpretation.SYNS;
+    if ("VS".equals(codeString))
+      return V3ObservationInterpretation.VS;
+    if ("EX".equals(codeString))
+      return V3ObservationInterpretation.EX;
+    if ("HX".equals(codeString))
+      return V3ObservationInterpretation.HX;
+    if ("LX".equals(codeString))
+      return V3ObservationInterpretation.LX;
+    if ("HM".equals(codeString))
+      return V3ObservationInterpretation.HM;
+    if ("ObservationInterpretationDetection".equals(codeString))
+      return V3ObservationInterpretation.OBSERVATIONINTERPRETATIONDETECTION;
+    if ("IND".equals(codeString))
+      return V3ObservationInterpretation.IND;
+    if ("E".equals(codeString))
+      return V3ObservationInterpretation.E;
+    if ("NEG".equals(codeString))
+      return V3ObservationInterpretation.NEG;
+    if ("ND".equals(codeString))
+      return V3ObservationInterpretation.ND;
+    if ("POS".equals(codeString))
+      return V3ObservationInterpretation.POS;
+    if ("DET".equals(codeString))
+      return V3ObservationInterpretation.DET;
+    if ("ObservationInterpretationExpectation".equals(codeString))
+      return V3ObservationInterpretation.OBSERVATIONINTERPRETATIONEXPECTATION;
+    if ("EXP".equals(codeString))
+      return V3ObservationInterpretation.EXP;
+    if ("UNE".equals(codeString))
+      return V3ObservationInterpretation.UNE;
+    if ("OBX".equals(codeString))
+      return V3ObservationInterpretation.OBX;
+    if ("ReactivityObservationInterpretation".equals(codeString))
+      return V3ObservationInterpretation.REACTIVITYOBSERVATIONINTERPRETATION;
+    if ("NR".equals(codeString))
+      return V3ObservationInterpretation.NR;
+    if ("RR".equals(codeString))
+      return V3ObservationInterpretation.RR;
+    if ("WR".equals(codeString))
+      return V3ObservationInterpretation.WR;
+    throw new IllegalArgumentException("Unknown V3ObservationInterpretation code '"+codeString+"'");
+  }
+
+  public String toCode(V3ObservationInterpretation code) {
+    if (code == V3ObservationInterpretation._GENETICOBSERVATIONINTERPRETATION)
+      return "_GeneticObservationInterpretation";
+    if (code == V3ObservationInterpretation.CAR)
+      return "CAR";
+    if (code == V3ObservationInterpretation.CARRIER)
+      return "Carrier";
+    if (code == V3ObservationInterpretation._OBSERVATIONINTERPRETATIONCHANGE)
+      return "_ObservationInterpretationChange";
+    if (code == V3ObservationInterpretation.B)
+      return "B";
+    if (code == V3ObservationInterpretation.D)
+      return "D";
+    if (code == V3ObservationInterpretation.U)
+      return "U";
+    if (code == V3ObservationInterpretation.W)
+      return "W";
+    if (code == V3ObservationInterpretation._OBSERVATIONINTERPRETATIONEXCEPTIONS)
+      return "_ObservationInterpretationExceptions";
+    if (code == V3ObservationInterpretation.LESS_THAN)
+      return "<";
+    if (code == V3ObservationInterpretation.GREATER_THAN)
+      return ">";
+    if (code == V3ObservationInterpretation.AC)
+      return "AC";
+    if (code == V3ObservationInterpretation.IE)
+      return "IE";
+    if (code == V3ObservationInterpretation.QCF)
+      return "QCF";
+    if (code == V3ObservationInterpretation.TOX)
+      return "TOX";
+    if (code == V3ObservationInterpretation._OBSERVATIONINTERPRETATIONNORMALITY)
+      return "_ObservationInterpretationNormality";
+    if (code == V3ObservationInterpretation.A)
+      return "A";
+    if (code == V3ObservationInterpretation.AA)
+      return "AA";
+    if (code == V3ObservationInterpretation.HH)
+      return "HH";
+    if (code == V3ObservationInterpretation.LL)
+      return "LL";
+    if (code == V3ObservationInterpretation.H)
+      return "H";
+    if (code == V3ObservationInterpretation.H_)
+      return "H>";
+    if (code == V3ObservationInterpretation.HU)
+      return "HU";
+    if (code == V3ObservationInterpretation.L)
+      return "L";
+    if (code == V3ObservationInterpretation.L_)
+      return "L<";
+    if (code == V3ObservationInterpretation.LU)
+      return "LU";
+    if (code == V3ObservationInterpretation.N)
+      return "N";
+    if (code == V3ObservationInterpretation._OBSERVATIONINTERPRETATIONSUSCEPTIBILITY)
+      return "_ObservationInterpretationSusceptibility";
+    if (code == V3ObservationInterpretation.I)
+      return "I";
+    if (code == V3ObservationInterpretation.MS)
+      return "MS";
+    if (code == V3ObservationInterpretation.NS)
+      return "NS";
+    if (code == V3ObservationInterpretation.R)
+      return "R";
+    if (code == V3ObservationInterpretation.SYNR)
+      return "SYN-R";
+    if (code == V3ObservationInterpretation.S)
+      return "S";
+    if (code == V3ObservationInterpretation.SDD)
+      return "SDD";
+    if (code == V3ObservationInterpretation.SYNS)
+      return "SYN-S";
+    if (code == V3ObservationInterpretation.VS)
+      return "VS";
+    if (code == V3ObservationInterpretation.EX)
+      return "EX";
+    if (code == V3ObservationInterpretation.HX)
+      return "HX";
+    if (code == V3ObservationInterpretation.LX)
+      return "LX";
+    if (code == V3ObservationInterpretation.HM)
+      return "HM";
+    if (code == V3ObservationInterpretation.OBSERVATIONINTERPRETATIONDETECTION)
+      return "ObservationInterpretationDetection";
+    if (code == V3ObservationInterpretation.IND)
+      return "IND";
+    if (code == V3ObservationInterpretation.E)
+      return "E";
+    if (code == V3ObservationInterpretation.NEG)
+      return "NEG";
+    if (code == V3ObservationInterpretation.ND)
+      return "ND";
+    if (code == V3ObservationInterpretation.POS)
+      return "POS";
+    if (code == V3ObservationInterpretation.DET)
+      return "DET";
+    if (code == V3ObservationInterpretation.OBSERVATIONINTERPRETATIONEXPECTATION)
+      return "ObservationInterpretationExpectation";
+    if (code == V3ObservationInterpretation.EXP)
+      return "EXP";
+    if (code == V3ObservationInterpretation.UNE)
+      return "UNE";
+    if (code == V3ObservationInterpretation.OBX)
+      return "OBX";
+    if (code == V3ObservationInterpretation.REACTIVITYOBSERVATIONINTERPRETATION)
+      return "ReactivityObservationInterpretation";
+    if (code == V3ObservationInterpretation.NR)
+      return "NR";
+    if (code == V3ObservationInterpretation.RR)
+      return "RR";
+    if (code == V3ObservationInterpretation.WR)
+      return "WR";
+    return "?";
+  }
+
+    public String toSystem(V3ObservationInterpretation code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationMethod.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationMethod.java
new file mode 100644
index 00000000000..bc7ecbb3f0b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationMethod.java
@@ -0,0 +1,2821 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ObservationMethod {
+
+        /**
+         * Provides codes for decision methods, initially for assessing the causality of events.
+         */
+        _DECISIONOBSERVATIONMETHOD, 
+        /**
+         * Reaching a decision through the application of an algorithm designed to weigh the different factors involved.
+         */
+        ALGM, 
+        /**
+         * Reaching a decision through the use of Bayesian statistical analysis.
+         */
+        BYCL, 
+        /**
+         * Reaching a decision by consideration of the totality of factors involved in order to reach a judgement.
+         */
+        GINT, 
+        /**
+         * A code that provides additional detail about the means or technique used to ascertain the genetic analysis. Example, PCR, Micro Array
+         */
+        _GENETICOBSERVATIONMETHOD, 
+        /**
+         * Description: Polymerase Chain Reaction
+         */
+        PCR, 
+        /**
+         * Provides additional detail about the aggregation methods used to compute the aggregated values for an observation. This is an abstract code.
+         */
+        _OBSERVATIONMETHODAGGREGATE, 
+        /**
+         * Average of non-null values in the referenced set of values
+         */
+        AVERAGE, 
+        /**
+         * Count of non-null values in the referenced set of values
+         */
+        COUNT, 
+        /**
+         * Largest of all non-null values in the referenced set of values.
+         */
+        MAX, 
+        /**
+         * The median of all non-null values in the referenced set of values.
+         */
+        MEDIAN, 
+        /**
+         * Smallest of all non-null values in the referenced set of values.
+         */
+        MIN, 
+        /**
+         * The most common value of all non-null values in the referenced set of values.
+         */
+        MODE, 
+        /**
+         * Standard Deviation of the values in the referenced set of values, computed over the population.
+         */
+        STDEV_P, 
+        /**
+         * Standard Deviation of the values in the referenced set of values, computed over a sample of the population.
+         */
+        STDEV_S, 
+        /**
+         * Sum of non-null values in the referenced set of values
+         */
+        SUM, 
+        /**
+         * Variance of the values in the referenced set of values, computed over the population.
+         */
+        VARIANCE_P, 
+        /**
+         * Variance of the values in the referenced set of values, computed over a sample of the population.
+         */
+        VARIANCE_S, 
+        /**
+         * VerificationMethod
+         */
+        _VERIFICATIONMETHOD, 
+        /**
+         * Verification by means of document.
+
+                        
+                           Example: Fax, letter, attachment to e-mail.
+         */
+        VDOC, 
+        /**
+         * verification by means of  a response to an electronic query
+
+                        
+                           Example: query message to a Covered Party registry application or Coverage Administrator.
+         */
+        VREG, 
+        /**
+         * Verification by means of electronic token.
+
+                        
+                           Example: smartcard, magnetic swipe card, RFID device.
+         */
+        VTOKEN, 
+        /**
+         * Verification by means of voice.
+
+                        
+                           Example: By speaking with or calling the Coverage Administrator or Covered Party
+         */
+        VVOICE, 
+        /**
+         * Complement fixation
+         */
+        _0001, 
+        /**
+         * Computed axial tomography
+         */
+        _0002, 
+        /**
+         * Susceptibility, High Level Aminoglycoside Resistance agar test
+         */
+        _0003, 
+        /**
+         * Visual, Macroscopic observation
+         */
+        _0004, 
+        /**
+         * Computed, Magnetic resonance
+         */
+        _0005, 
+        /**
+         * Computed, Morphometry
+         */
+        _0006, 
+        /**
+         * Computed, Positron emission tomography
+         */
+        _0007, 
+        /**
+         * SAMHSA drug assay confirmation
+         */
+        _0008, 
+        /**
+         * SAMHSA drug assay screening
+         */
+        _0009, 
+        /**
+         * Serum Neutralization
+         */
+        _0010, 
+        /**
+         * Titration
+         */
+        _0011, 
+        /**
+         * Ultrasound
+         */
+        _0012, 
+        /**
+         * X-ray crystallography
+         */
+        _0013, 
+        /**
+         * Agglutination
+         */
+        _0014, 
+        /**
+         * Agglutination, Buffered acidified plate
+         */
+        _0015, 
+        /**
+         * Agglutination, Card
+         */
+        _0016, 
+        /**
+         * Agglutination, Hemagglutination
+         */
+        _0017, 
+        /**
+         * Agglutination, Hemagglutination inhibition
+         */
+        _0018, 
+        /**
+         * Agglutination, Latex
+         */
+        _0019, 
+        /**
+         * Agglutination, Plate
+         */
+        _0020, 
+        /**
+         * Agglutination, Rapid Plate
+         */
+        _0021, 
+        /**
+         * Agglutination, RBC
+         */
+        _0022, 
+        /**
+         * Agglutination, Rivanol
+         */
+        _0023, 
+        /**
+         * Agglutination, Tube
+         */
+        _0024, 
+        /**
+         * Bioassay
+         */
+        _0025, 
+        /**
+         * Bioassay, Animal Inoculation
+         */
+        _0026, 
+        /**
+         * Bioassay, Cytotoxicity
+         */
+        _0027, 
+        /**
+         * Bioassay, Embryo Infective Dose 50
+         */
+        _0028, 
+        /**
+         * Bioassay, Embryo Lethal Dose 50
+         */
+        _0029, 
+        /**
+         * Bioassay, Mouse intercerebral inoculation
+         */
+        _0030, 
+        /**
+         * Bioassay, qualitative
+         */
+        _0031, 
+        /**
+         * Bioassay, quantitative
+         */
+        _0032, 
+        /**
+         * Chemical
+         */
+        _0033, 
+        /**
+         * Chemical, Differential light absorption
+         */
+        _0034, 
+        /**
+         * Chemical, Dipstick
+         */
+        _0035, 
+        /**
+         * Chemical, Dipstick colorimetric laboratory test
+         */
+        _0036, 
+        /**
+         * Chemical, Test strip
+         */
+        _0037, 
+        /**
+         * Chromatography
+         */
+        _0038, 
+        /**
+         * Chromatography, Affinity
+         */
+        _0039, 
+        /**
+         * Chromatography, Gas liquid
+         */
+        _0040, 
+        /**
+         * Chromatography, High performance liquid
+         */
+        _0041, 
+        /**
+         * Chromatography, Liquid
+         */
+        _0042, 
+        /**
+         * Chromatography, Protein A affinity
+         */
+        _0043, 
+        /**
+         * Coagulation
+         */
+        _0044, 
+        /**
+         * Coagulation, Tilt tube
+         */
+        _0045, 
+        /**
+         * Coagulation, Tilt tube reptilase induced
+         */
+        _0046, 
+        /**
+         * Count, Automated
+         */
+        _0047, 
+        /**
+         * Count, Manual
+         */
+        _0048, 
+        /**
+         * Count, Platelet, Rees-Ecker
+         */
+        _0049, 
+        /**
+         * Culture, Aerobic
+         */
+        _0050, 
+        /**
+         * Culture, Anaerobic
+         */
+        _0051, 
+        /**
+         * Culture, Chicken Embryo
+         */
+        _0052, 
+        /**
+         * Culture, Delayed secondary enrichment
+         */
+        _0053, 
+        /**
+         * Culture, Microaerophilic
+         */
+        _0054, 
+        /**
+         * Culture, Quantitative microbial, cup
+         */
+        _0055, 
+        /**
+         * Culture, Quantitative microbial, droplet
+         */
+        _0056, 
+        /**
+         * Culture, Quantitative microbial, filter paper
+         */
+        _0057, 
+        /**
+         * Culture, Quantitative microbial, pad
+         */
+        _0058, 
+        /**
+         * Culture, Quantitative microbial, pour plate
+         */
+        _0059, 
+        /**
+         * Culture, Quantitative microbial, surface streak
+         */
+        _0060, 
+        /**
+         * Culture, Somatic Cell
+         */
+        _0061, 
+        /**
+         * Diffusion, Agar
+         */
+        _0062, 
+        /**
+         * Diffusion, Agar Gel Immunodiffusion
+         */
+        _0063, 
+        /**
+         * Electrophoresis
+         */
+        _0064, 
+        /**
+         * Electrophoresis, Agaorse gel
+         */
+        _0065, 
+        /**
+         * Electrophoresis, citrate agar
+         */
+        _0066, 
+        /**
+         * Electrophoresis, Immuno
+         */
+        _0067, 
+        /**
+         * Electrophoresis, Polyacrylamide gel
+         */
+        _0068, 
+        /**
+         * Electrophoresis, Starch gel
+         */
+        _0069, 
+        /**
+         * ELISA
+         */
+        _0070, 
+        /**
+         * ELISA, antigen capture
+         */
+        _0071, 
+        /**
+         * ELISA, avidin biotin peroxidase complex
+         */
+        _0072, 
+        /**
+         * ELISA, Kinetic
+         */
+        _0073, 
+        /**
+         * ELISA, peroxidase-antiperoxidase
+         */
+        _0074, 
+        /**
+         * Identification, API 20 Strep
+         */
+        _0075, 
+        /**
+         * Identification, API 20A
+         */
+        _0076, 
+        /**
+         * Identification, API 20C AUX
+         */
+        _0077, 
+        /**
+         * Identification, API 20E
+         */
+        _0078, 
+        /**
+         * Identification, API 20NE
+         */
+        _0079, 
+        /**
+         * Identification, API 50 CH
+         */
+        _0080, 
+        /**
+         * Identification, API An-IDENT
+         */
+        _0081, 
+        /**
+         * Identification, API Coryne
+         */
+        _0082, 
+        /**
+         * Identification, API Rapid 20E
+         */
+        _0083, 
+        /**
+         * Identification, API Staph
+         */
+        _0084, 
+        /**
+         * Identification, API ZYM
+         */
+        _0085, 
+        /**
+         * Identification, Bacterial
+         */
+        _0086, 
+        /**
+         * Identification, mini VIDAS
+         */
+        _0087, 
+        /**
+         * Identification, Phage susceptibility typing
+         */
+        _0088, 
+        /**
+         * Identification, Quad-FERM+
+         */
+        _0089, 
+        /**
+         * Identification, RAPIDEC Staph
+         */
+        _0090, 
+        /**
+         * Identification, Staphaurex
+         */
+        _0091, 
+        /**
+         * Identification, VIDAS
+         */
+        _0092, 
+        /**
+         * Identification, Vitek
+         */
+        _0093, 
+        /**
+         * Identification, VITEK 2
+         */
+        _0094, 
+        /**
+         * Immune stain
+         */
+        _0095, 
+        /**
+         * Immune stain, Immunofluorescent antibody, direct
+         */
+        _0096, 
+        /**
+         * Immune stain, Immunofluorescent antibody, indirect
+         */
+        _0097, 
+        /**
+         * Immune stain, Immunoperoxidase, Avidin-Biotin Complex
+         */
+        _0098, 
+        /**
+         * Immune stain, Immunoperoxidase, Peroxidase anti-peroxidase complex
+         */
+        _0099, 
+        /**
+         * Immune stain, Immunoperoxidase, Protein A-peroxidase complex
+         */
+        _0100, 
+        /**
+         * Immunoassay
+         */
+        _0101, 
+        /**
+         * Immunoassay, qualitative, multiple step
+         */
+        _0102, 
+        /**
+         * Immunoassay, qualitative, single step
+         */
+        _0103, 
+        /**
+         * Immunoassay, Radioimmunoassay
+         */
+        _0104, 
+        /**
+         * Immunoassay, semi-quantitative, multiple step
+         */
+        _0105, 
+        /**
+         * Immunoassay, semi-quantitative, single step
+         */
+        _0106, 
+        /**
+         * Microscopy
+         */
+        _0107, 
+        /**
+         * Microscopy, Darkfield
+         */
+        _0108, 
+        /**
+         * Microscopy, Electron
+         */
+        _0109, 
+        /**
+         * Microscopy, Electron microscopy tomography
+         */
+        _0110, 
+        /**
+         * Microscopy, Electron, negative stain
+         */
+        _0111, 
+        /**
+         * Microscopy, Electron, thick section transmission
+         */
+        _0112, 
+        /**
+         * Microscopy, Electron, thin section transmission
+         */
+        _0113, 
+        /**
+         * Microscopy, Light
+         */
+        _0114, 
+        /**
+         * Microscopy, Polarized light
+         */
+        _0115, 
+        /**
+         * Microscopy, Scanning electron
+         */
+        _0116, 
+        /**
+         * Microscopy, Transmission electron
+         */
+        _0117, 
+        /**
+         * Microscopy, Transparent tape direct examination
+         */
+        _0118, 
+        /**
+         * Molecular, 3 Self-Sustaining Sequence Replication
+         */
+        _0119, 
+        /**
+         * Molecular, Branched Chain DNA
+         */
+        _0120, 
+        /**
+         * Molecular, Hybridization Protection Assay
+         */
+        _0121, 
+        /**
+         * Molecular, Immune blot
+         */
+        _0122, 
+        /**
+         * Molecular, In-situ hybridization
+         */
+        _0123, 
+        /**
+         * Molecular, Ligase Chain Reaction
+         */
+        _0124, 
+        /**
+         * Molecular, Ligation Activated Transcription
+         */
+        _0125, 
+        /**
+         * Molecular, Nucleic Acid Probe
+         */
+        _0126, 
+        /**
+         * Molecular, Nucleic acid probe with amplification
+
+                        
+
+                        Rationale: Duplicate of code 0126. Use code 0126 instead.
+         */
+        _0128, 
+        /**
+         * Molecular, Nucleic acid probe with target amplification
+         */
+        _0129, 
+        /**
+         * Molecular, Nucleic acid reverse transcription
+         */
+        _0130, 
+        /**
+         * Molecular, Nucleic Acid Sequence Based Analysis
+         */
+        _0131, 
+        /**
+         * Molecular, Polymerase chain reaction
+         */
+        _0132, 
+        /**
+         * Molecular, Q-Beta Replicase or probe amplification category method
+         */
+        _0133, 
+        /**
+         * Molecular, Restriction Fragment Length Polymorphism
+         */
+        _0134, 
+        /**
+         * Molecular, Southern Blot
+         */
+        _0135, 
+        /**
+         * Molecular, Strand Displacement Amplification
+         */
+        _0136, 
+        /**
+         * Molecular, Transcription Mediated Amplification
+         */
+        _0137, 
+        /**
+         * Molecular, Western Blot
+         */
+        _0138, 
+        /**
+         * Precipitation, Flocculation
+         */
+        _0139, 
+        /**
+         * Precipitation, Immune precipitation
+         */
+        _0140, 
+        /**
+         * Precipitation, Milk ring test
+         */
+        _0141, 
+        /**
+         * Precipitation, Precipitin
+         */
+        _0142, 
+        /**
+         * Stain, Acid fast
+         */
+        _0143, 
+        /**
+         * Stain, Acid fast, fluorochrome
+         */
+        _0144, 
+        /**
+         * Stain, Acid fast, Kinyoun's cold carbolfuchsin
+         */
+        _0145, 
+        /**
+         * Stain, Acid fast, Ziehl-Neelsen
+         */
+        _0146, 
+        /**
+         * Stain, Acid phosphatase
+         */
+        _0147, 
+        /**
+         * Stain, Acridine orange
+         */
+        _0148, 
+        /**
+         * Stain, Active brilliant orange KH
+         */
+        _0149, 
+        /**
+         * Stain, Alazarin red S
+         */
+        _0150, 
+        /**
+         * Stain, Alcian blue
+         */
+        _0151, 
+        /**
+         * Stain, Alcian blue with Periodic acid Schiff
+         */
+        _0152, 
+        /**
+         * Stain, Argentaffin
+         */
+        _0153, 
+        /**
+         * Stain, Argentaffin silver
+         */
+        _0154, 
+        /**
+         * Stain, Azure-eosin
+         */
+        _0155, 
+        /**
+         * Stain, Basic Fuschin
+         */
+        _0156, 
+        /**
+         * Stain, Bennhold
+         */
+        _0157, 
+        /**
+         * Stain, Bennhold's Congo red
+         */
+        _0158, 
+        /**
+         * Stain, Bielschowsky
+         */
+        _0159, 
+        /**
+         * Stain, Bielschowsky's silver
+         */
+        _0160, 
+        /**
+         * Stain, Bleach
+         */
+        _0161, 
+        /**
+         * Stain, Bodian
+         */
+        _0162, 
+        /**
+         * Stain, Brown-Brenn
+         */
+        _0163, 
+        /**
+         * Stain, Butyrate-esterase
+         */
+        _0164, 
+        /**
+         * Stain, Calcofluor white fluorescent
+         */
+        _0165, 
+        /**
+         * Stain, Carbol-fuchsin
+         */
+        _0166, 
+        /**
+         * Stain, Carmine
+         */
+        _0167, 
+        /**
+         * Stain, Churukian-Schenk
+         */
+        _0168, 
+        /**
+         * Stain, Congo red
+         */
+        _0169, 
+        /**
+         * Stain, Cresyl echt violet
+         */
+        _0170, 
+        /**
+         * Stain, Crystal violet
+         */
+        _0171, 
+        /**
+         * Stain, De Galantha
+         */
+        _0172, 
+        /**
+         * Stain, Dieterle silver impregnation
+         */
+        _0173, 
+        /**
+         * Stain, Fite-Farco
+         */
+        _0174, 
+        /**
+         * Stain, Fontana-Masson silver
+         */
+        _0175, 
+        /**
+         * Stain, Fouchet
+         */
+        _0176, 
+        /**
+         * Stain, Gomori
+         */
+        _0177, 
+        /**
+         * Stain, Gomori methenamine silver
+         */
+        _0178, 
+        /**
+         * Stain, Gomori-Wheatly trichrome
+         */
+        _0179, 
+        /**
+         * Stain, Gridley
+         */
+        _0180, 
+        /**
+         * Stain, Grimelius silver
+         */
+        _0181, 
+        /**
+         * Stain, Grocott
+         */
+        _0182, 
+        /**
+         * Stain, Grocott methenamine silver
+         */
+        _0183, 
+        /**
+         * Stain, Hale's colloidal ferric oxide
+         */
+        _0184, 
+        /**
+         * Stain, Hale's colloidal iron
+         */
+        _0185, 
+        /**
+         * Stain, Hansel
+         */
+        _0186, 
+        /**
+         * Stain, Harris regressive hematoxylin and eosin
+         */
+        _0187, 
+        /**
+         * Stain, Hematoxylin and eosin
+         */
+        _0188, 
+        /**
+         * Stain, Highman
+         */
+        _0189, 
+        /**
+         * Stain, Holzer
+         */
+        _0190, 
+        /**
+         * Stain, Iron hematoxylin
+         */
+        _0191, 
+        /**
+         * Stain, Jones
+         */
+        _0192, 
+        /**
+         * Stain, Jones methenamine silver
+         */
+        _0193, 
+        /**
+         * Stain, Kossa
+         */
+        _0194, 
+        /**
+         * Stain, Lawson-Van Gieson
+         */
+        _0195, 
+        /**
+         * Stain, Loeffler methylene blue
+         */
+        _0196, 
+        /**
+         * Stain, Luxol fast blue with cresyl violet
+         */
+        _0197, 
+        /**
+         * Stain, Luxol fast blue with Periodic acid-Schiff
+         */
+        _0198, 
+        /**
+         * Stain, MacNeal's tetrachrome blood
+         */
+        _0199, 
+        /**
+         * Stain, Mallory-Heidenhain
+         */
+        _0200, 
+        /**
+         * Stain, Masson trichrome
+         */
+        _0201, 
+        /**
+         * Stain, Mayer mucicarmine
+         */
+        _0202, 
+        /**
+         * Stain, Mayers progressive hematoxylin and eosin
+         */
+        _0203, 
+        /**
+         * Stain, May-Grunwald Giemsa
+         */
+        _0204, 
+        /**
+         * Stain, Methyl green
+         */
+        _0205, 
+        /**
+         * Stain, Methyl green pyronin
+         */
+        _0206, 
+        /**
+         * Stain, Modified Gomori-Wheatly trichrome
+         */
+        _0207, 
+        /**
+         * Stain, Modified Masson trichrome
+         */
+        _0208, 
+        /**
+         * Stain, Modified trichrome
+         */
+        _0209, 
+        /**
+         * Stain, Movat pentachrome
+         */
+        _0210, 
+        /**
+         * Stain, Mucicarmine
+         */
+        _0211, 
+        /**
+         * Stain, Neutral red
+         */
+        _0212, 
+        /**
+         * Stain, Night blue
+         */
+        _0213, 
+        /**
+         * Stain, Non-specific esterase
+         */
+        _0214, 
+        /**
+         * Stain, Oil red-O
+         */
+        _0215, 
+        /**
+         * Stain, Orcein
+         */
+        _0216, 
+        /**
+         * Stain, Perls'
+         */
+        _0217, 
+        /**
+         * Stain, Phosphotungstic acid-hematoxylin
+         */
+        _0218, 
+        /**
+         * Stain, Potassium ferrocyanide
+         */
+        _0219, 
+        /**
+         * Stain, Prussian blue
+         */
+        _0220, 
+        /**
+         * Stain, Putchler modified Bennhold
+         */
+        _0221, 
+        /**
+         * Stain, Quinacrine fluorescent
+         */
+        _0222, 
+        /**
+         * Stain, Reticulin
+         */
+        _0223, 
+        /**
+         * Stain, Rhodamine
+         */
+        _0224, 
+        /**
+         * Stain, Safranin
+         */
+        _0225, 
+        /**
+         * Stain, Schmorl
+         */
+        _0226, 
+        /**
+         * Stain, Seiver-Munger
+         */
+        _0227, 
+        /**
+         * Stain, Silver
+         */
+        _0228, 
+        /**
+         * Stain, Specific esterase
+         */
+        _0229, 
+        /**
+         * Stain, Steiner silver
+         */
+        _0230, 
+        /**
+         * Stain, Sudan III
+         */
+        _0231, 
+        /**
+         * Stain, Sudan IVI
+         */
+        _0232, 
+        /**
+         * Stain, Sulfated alcian blue
+         */
+        _0233, 
+        /**
+         * Stain, Supravital
+         */
+        _0234, 
+        /**
+         * Stain, Thioflavine-S
+         */
+        _0235, 
+        /**
+         * Stain, Three micron Giemsa
+         */
+        _0236, 
+        /**
+         * Stain, Vassar-Culling
+         */
+        _0237, 
+        /**
+         * Stain, Vital
+         */
+        _0238, 
+        /**
+         * Stain, von Kossa
+         */
+        _0239, 
+        /**
+         * Susceptibility, Minimum bactericidal concentration, macrodilution
+         */
+        _0243, 
+        /**
+         * Susceptibility, Minimum bactericidal concentration, microdilution
+         */
+        _0244, 
+        /**
+         * Turbidometric
+         */
+        _0247, 
+        /**
+         * Turbidometric, Refractometric
+         */
+        _0248, 
+        /**
+         * Chromatography, Thin Layer
+         */
+        _0249, 
+        /**
+         * Immunoassay, enzyme-multiplied technique (EMIT)
+         */
+        _0250, 
+        /**
+         * Flow Cytometry
+         */
+        _0251, 
+        /**
+         * Radial Immunodiffusion
+         */
+        _0252, 
+        /**
+         * Immunoassay, Fluorescence Polarization
+         */
+        _0253, 
+        /**
+         * Electrophoresis, Immunofixation
+         */
+        _0254, 
+        /**
+         * Dialysis, Direct Equilibrium
+         */
+        _0255, 
+        /**
+         * Acid Elution, Kleihauer-Betke Method
+         */
+        _0256, 
+        /**
+         * Immunofluorescence, Anti-Complement
+         */
+        _0257, 
+        /**
+         * Gas Chromatography/Mass Spectroscopy
+         */
+        _0258, 
+        /**
+         * Light Scatter, Nephelometry
+         */
+        _0259, 
+        /**
+         * Immunoassay, IgE Antibody Test
+         */
+        _0260, 
+        /**
+         * Lymphocyte Microcytotoxicity Assay
+         */
+        _0261, 
+        /**
+         * Spectrophotometry
+         */
+        _0262, 
+        /**
+         * Spectrophotometry, Atomic Absorption
+         */
+        _0263, 
+        /**
+         * Electrochemical, Ion Selective Electrode
+         */
+        _0264, 
+        /**
+         * Chromatography, Gas
+         */
+        _0265, 
+        /**
+         * Isoelectric Focusing
+         */
+        _0266, 
+        /**
+         * Immunoassay, Chemiluminescent
+         */
+        _0267, 
+        /**
+         * Immunoassay, Microparticle Enzyme
+         */
+        _0268, 
+        /**
+         * Inductively-Coupled Plasma/Mass Spectrometry
+         */
+        _0269, 
+        /**
+         * Immunoassay, Immunoradiometric Assay
+         */
+        _0270, 
+        /**
+         * Coagulation, Photo Optical Clot Detection
+         */
+        _0271, 
+        /**
+         * Test methods designed to determine a microorganismaTMs susceptibility to being killed by an antibiotic.
+         */
+        _0280, 
+        /**
+         * Susceptibility, Antibiotic sensitivity, disk
+         */
+        _0240, 
+        /**
+         * Susceptibility, BACTEC susceptibility test
+         */
+        _0241, 
+        /**
+         * Susceptibility, Disk dilution
+         */
+        _0242, 
+        /**
+         * Testing to measure the minimum concentration of the antibacterial agent in a given culture medium below which bacterial growth is not inhibited.
+         */
+        _0272, 
+        /**
+         * Susceptibility, Minimum Inhibitory concentration, macrodilution
+         */
+        _0245, 
+        /**
+         * Susceptibility, Minimum Inhibitory concentration, microdilution
+         */
+        _0246, 
+        /**
+         * Viral Genotype Susceptibility
+         */
+        _0273, 
+        /**
+         * Viral Phenotype Susceptibility
+         */
+        _0274, 
+        /**
+         * Gradient Strip
+         */
+        _0275, 
+        /**
+         * Minimum Lethal Concentration (MLC)
+         */
+        _0275A, 
+        /**
+         * Testing to measure the minimum concentration of the antibacterial agent in a given culture medium below which bacterial growth is not inhibited.
+         */
+        _0276, 
+        /**
+         * Serum bactericidal titer
+         */
+        _0277, 
+        /**
+         * Agar screen
+         */
+        _0278, 
+        /**
+         * Disk induction
+         */
+        _0279, 
+        /**
+         * Molecular, Nucleic acid probe
+         */
+        _0127, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ObservationMethod fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_DecisionObservationMethod".equals(codeString))
+          return _DECISIONOBSERVATIONMETHOD;
+        if ("ALGM".equals(codeString))
+          return ALGM;
+        if ("BYCL".equals(codeString))
+          return BYCL;
+        if ("GINT".equals(codeString))
+          return GINT;
+        if ("_GeneticObservationMethod".equals(codeString))
+          return _GENETICOBSERVATIONMETHOD;
+        if ("PCR".equals(codeString))
+          return PCR;
+        if ("_ObservationMethodAggregate".equals(codeString))
+          return _OBSERVATIONMETHODAGGREGATE;
+        if ("AVERAGE".equals(codeString))
+          return AVERAGE;
+        if ("COUNT".equals(codeString))
+          return COUNT;
+        if ("MAX".equals(codeString))
+          return MAX;
+        if ("MEDIAN".equals(codeString))
+          return MEDIAN;
+        if ("MIN".equals(codeString))
+          return MIN;
+        if ("MODE".equals(codeString))
+          return MODE;
+        if ("STDEV.P".equals(codeString))
+          return STDEV_P;
+        if ("STDEV.S".equals(codeString))
+          return STDEV_S;
+        if ("SUM".equals(codeString))
+          return SUM;
+        if ("VARIANCE.P".equals(codeString))
+          return VARIANCE_P;
+        if ("VARIANCE.S".equals(codeString))
+          return VARIANCE_S;
+        if ("_VerificationMethod".equals(codeString))
+          return _VERIFICATIONMETHOD;
+        if ("VDOC".equals(codeString))
+          return VDOC;
+        if ("VREG".equals(codeString))
+          return VREG;
+        if ("VTOKEN".equals(codeString))
+          return VTOKEN;
+        if ("VVOICE".equals(codeString))
+          return VVOICE;
+        if ("0001".equals(codeString))
+          return _0001;
+        if ("0002".equals(codeString))
+          return _0002;
+        if ("0003".equals(codeString))
+          return _0003;
+        if ("0004".equals(codeString))
+          return _0004;
+        if ("0005".equals(codeString))
+          return _0005;
+        if ("0006".equals(codeString))
+          return _0006;
+        if ("0007".equals(codeString))
+          return _0007;
+        if ("0008".equals(codeString))
+          return _0008;
+        if ("0009".equals(codeString))
+          return _0009;
+        if ("0010".equals(codeString))
+          return _0010;
+        if ("0011".equals(codeString))
+          return _0011;
+        if ("0012".equals(codeString))
+          return _0012;
+        if ("0013".equals(codeString))
+          return _0013;
+        if ("0014".equals(codeString))
+          return _0014;
+        if ("0015".equals(codeString))
+          return _0015;
+        if ("0016".equals(codeString))
+          return _0016;
+        if ("0017".equals(codeString))
+          return _0017;
+        if ("0018".equals(codeString))
+          return _0018;
+        if ("0019".equals(codeString))
+          return _0019;
+        if ("0020".equals(codeString))
+          return _0020;
+        if ("0021".equals(codeString))
+          return _0021;
+        if ("0022".equals(codeString))
+          return _0022;
+        if ("0023".equals(codeString))
+          return _0023;
+        if ("0024".equals(codeString))
+          return _0024;
+        if ("0025".equals(codeString))
+          return _0025;
+        if ("0026".equals(codeString))
+          return _0026;
+        if ("0027".equals(codeString))
+          return _0027;
+        if ("0028".equals(codeString))
+          return _0028;
+        if ("0029".equals(codeString))
+          return _0029;
+        if ("0030".equals(codeString))
+          return _0030;
+        if ("0031".equals(codeString))
+          return _0031;
+        if ("0032".equals(codeString))
+          return _0032;
+        if ("0033".equals(codeString))
+          return _0033;
+        if ("0034".equals(codeString))
+          return _0034;
+        if ("0035".equals(codeString))
+          return _0035;
+        if ("0036".equals(codeString))
+          return _0036;
+        if ("0037".equals(codeString))
+          return _0037;
+        if ("0038".equals(codeString))
+          return _0038;
+        if ("0039".equals(codeString))
+          return _0039;
+        if ("0040".equals(codeString))
+          return _0040;
+        if ("0041".equals(codeString))
+          return _0041;
+        if ("0042".equals(codeString))
+          return _0042;
+        if ("0043".equals(codeString))
+          return _0043;
+        if ("0044".equals(codeString))
+          return _0044;
+        if ("0045".equals(codeString))
+          return _0045;
+        if ("0046".equals(codeString))
+          return _0046;
+        if ("0047".equals(codeString))
+          return _0047;
+        if ("0048".equals(codeString))
+          return _0048;
+        if ("0049".equals(codeString))
+          return _0049;
+        if ("0050".equals(codeString))
+          return _0050;
+        if ("0051".equals(codeString))
+          return _0051;
+        if ("0052".equals(codeString))
+          return _0052;
+        if ("0053".equals(codeString))
+          return _0053;
+        if ("0054".equals(codeString))
+          return _0054;
+        if ("0055".equals(codeString))
+          return _0055;
+        if ("0056".equals(codeString))
+          return _0056;
+        if ("0057".equals(codeString))
+          return _0057;
+        if ("0058".equals(codeString))
+          return _0058;
+        if ("0059".equals(codeString))
+          return _0059;
+        if ("0060".equals(codeString))
+          return _0060;
+        if ("0061".equals(codeString))
+          return _0061;
+        if ("0062".equals(codeString))
+          return _0062;
+        if ("0063".equals(codeString))
+          return _0063;
+        if ("0064".equals(codeString))
+          return _0064;
+        if ("0065".equals(codeString))
+          return _0065;
+        if ("0066".equals(codeString))
+          return _0066;
+        if ("0067".equals(codeString))
+          return _0067;
+        if ("0068".equals(codeString))
+          return _0068;
+        if ("0069".equals(codeString))
+          return _0069;
+        if ("0070".equals(codeString))
+          return _0070;
+        if ("0071".equals(codeString))
+          return _0071;
+        if ("0072".equals(codeString))
+          return _0072;
+        if ("0073".equals(codeString))
+          return _0073;
+        if ("0074".equals(codeString))
+          return _0074;
+        if ("0075".equals(codeString))
+          return _0075;
+        if ("0076".equals(codeString))
+          return _0076;
+        if ("0077".equals(codeString))
+          return _0077;
+        if ("0078".equals(codeString))
+          return _0078;
+        if ("0079".equals(codeString))
+          return _0079;
+        if ("0080".equals(codeString))
+          return _0080;
+        if ("0081".equals(codeString))
+          return _0081;
+        if ("0082".equals(codeString))
+          return _0082;
+        if ("0083".equals(codeString))
+          return _0083;
+        if ("0084".equals(codeString))
+          return _0084;
+        if ("0085".equals(codeString))
+          return _0085;
+        if ("0086".equals(codeString))
+          return _0086;
+        if ("0087".equals(codeString))
+          return _0087;
+        if ("0088".equals(codeString))
+          return _0088;
+        if ("0089".equals(codeString))
+          return _0089;
+        if ("0090".equals(codeString))
+          return _0090;
+        if ("0091".equals(codeString))
+          return _0091;
+        if ("0092".equals(codeString))
+          return _0092;
+        if ("0093".equals(codeString))
+          return _0093;
+        if ("0094".equals(codeString))
+          return _0094;
+        if ("0095".equals(codeString))
+          return _0095;
+        if ("0096".equals(codeString))
+          return _0096;
+        if ("0097".equals(codeString))
+          return _0097;
+        if ("0098".equals(codeString))
+          return _0098;
+        if ("0099".equals(codeString))
+          return _0099;
+        if ("0100".equals(codeString))
+          return _0100;
+        if ("0101".equals(codeString))
+          return _0101;
+        if ("0102".equals(codeString))
+          return _0102;
+        if ("0103".equals(codeString))
+          return _0103;
+        if ("0104".equals(codeString))
+          return _0104;
+        if ("0105".equals(codeString))
+          return _0105;
+        if ("0106".equals(codeString))
+          return _0106;
+        if ("0107".equals(codeString))
+          return _0107;
+        if ("0108".equals(codeString))
+          return _0108;
+        if ("0109".equals(codeString))
+          return _0109;
+        if ("0110".equals(codeString))
+          return _0110;
+        if ("0111".equals(codeString))
+          return _0111;
+        if ("0112".equals(codeString))
+          return _0112;
+        if ("0113".equals(codeString))
+          return _0113;
+        if ("0114".equals(codeString))
+          return _0114;
+        if ("0115".equals(codeString))
+          return _0115;
+        if ("0116".equals(codeString))
+          return _0116;
+        if ("0117".equals(codeString))
+          return _0117;
+        if ("0118".equals(codeString))
+          return _0118;
+        if ("0119".equals(codeString))
+          return _0119;
+        if ("0120".equals(codeString))
+          return _0120;
+        if ("0121".equals(codeString))
+          return _0121;
+        if ("0122".equals(codeString))
+          return _0122;
+        if ("0123".equals(codeString))
+          return _0123;
+        if ("0124".equals(codeString))
+          return _0124;
+        if ("0125".equals(codeString))
+          return _0125;
+        if ("0126".equals(codeString))
+          return _0126;
+        if ("0128".equals(codeString))
+          return _0128;
+        if ("0129".equals(codeString))
+          return _0129;
+        if ("0130".equals(codeString))
+          return _0130;
+        if ("0131".equals(codeString))
+          return _0131;
+        if ("0132".equals(codeString))
+          return _0132;
+        if ("0133".equals(codeString))
+          return _0133;
+        if ("0134".equals(codeString))
+          return _0134;
+        if ("0135".equals(codeString))
+          return _0135;
+        if ("0136".equals(codeString))
+          return _0136;
+        if ("0137".equals(codeString))
+          return _0137;
+        if ("0138".equals(codeString))
+          return _0138;
+        if ("0139".equals(codeString))
+          return _0139;
+        if ("0140".equals(codeString))
+          return _0140;
+        if ("0141".equals(codeString))
+          return _0141;
+        if ("0142".equals(codeString))
+          return _0142;
+        if ("0143".equals(codeString))
+          return _0143;
+        if ("0144".equals(codeString))
+          return _0144;
+        if ("0145".equals(codeString))
+          return _0145;
+        if ("0146".equals(codeString))
+          return _0146;
+        if ("0147".equals(codeString))
+          return _0147;
+        if ("0148".equals(codeString))
+          return _0148;
+        if ("0149".equals(codeString))
+          return _0149;
+        if ("0150".equals(codeString))
+          return _0150;
+        if ("0151".equals(codeString))
+          return _0151;
+        if ("0152".equals(codeString))
+          return _0152;
+        if ("0153".equals(codeString))
+          return _0153;
+        if ("0154".equals(codeString))
+          return _0154;
+        if ("0155".equals(codeString))
+          return _0155;
+        if ("0156".equals(codeString))
+          return _0156;
+        if ("0157".equals(codeString))
+          return _0157;
+        if ("0158".equals(codeString))
+          return _0158;
+        if ("0159".equals(codeString))
+          return _0159;
+        if ("0160".equals(codeString))
+          return _0160;
+        if ("0161".equals(codeString))
+          return _0161;
+        if ("0162".equals(codeString))
+          return _0162;
+        if ("0163".equals(codeString))
+          return _0163;
+        if ("0164".equals(codeString))
+          return _0164;
+        if ("0165".equals(codeString))
+          return _0165;
+        if ("0166".equals(codeString))
+          return _0166;
+        if ("0167".equals(codeString))
+          return _0167;
+        if ("0168".equals(codeString))
+          return _0168;
+        if ("0169".equals(codeString))
+          return _0169;
+        if ("0170".equals(codeString))
+          return _0170;
+        if ("0171".equals(codeString))
+          return _0171;
+        if ("0172".equals(codeString))
+          return _0172;
+        if ("0173".equals(codeString))
+          return _0173;
+        if ("0174".equals(codeString))
+          return _0174;
+        if ("0175".equals(codeString))
+          return _0175;
+        if ("0176".equals(codeString))
+          return _0176;
+        if ("0177".equals(codeString))
+          return _0177;
+        if ("0178".equals(codeString))
+          return _0178;
+        if ("0179".equals(codeString))
+          return _0179;
+        if ("0180".equals(codeString))
+          return _0180;
+        if ("0181".equals(codeString))
+          return _0181;
+        if ("0182".equals(codeString))
+          return _0182;
+        if ("0183".equals(codeString))
+          return _0183;
+        if ("0184".equals(codeString))
+          return _0184;
+        if ("0185".equals(codeString))
+          return _0185;
+        if ("0186".equals(codeString))
+          return _0186;
+        if ("0187".equals(codeString))
+          return _0187;
+        if ("0188".equals(codeString))
+          return _0188;
+        if ("0189".equals(codeString))
+          return _0189;
+        if ("0190".equals(codeString))
+          return _0190;
+        if ("0191".equals(codeString))
+          return _0191;
+        if ("0192".equals(codeString))
+          return _0192;
+        if ("0193".equals(codeString))
+          return _0193;
+        if ("0194".equals(codeString))
+          return _0194;
+        if ("0195".equals(codeString))
+          return _0195;
+        if ("0196".equals(codeString))
+          return _0196;
+        if ("0197".equals(codeString))
+          return _0197;
+        if ("0198".equals(codeString))
+          return _0198;
+        if ("0199".equals(codeString))
+          return _0199;
+        if ("0200".equals(codeString))
+          return _0200;
+        if ("0201".equals(codeString))
+          return _0201;
+        if ("0202".equals(codeString))
+          return _0202;
+        if ("0203".equals(codeString))
+          return _0203;
+        if ("0204".equals(codeString))
+          return _0204;
+        if ("0205".equals(codeString))
+          return _0205;
+        if ("0206".equals(codeString))
+          return _0206;
+        if ("0207".equals(codeString))
+          return _0207;
+        if ("0208".equals(codeString))
+          return _0208;
+        if ("0209".equals(codeString))
+          return _0209;
+        if ("0210".equals(codeString))
+          return _0210;
+        if ("0211".equals(codeString))
+          return _0211;
+        if ("0212".equals(codeString))
+          return _0212;
+        if ("0213".equals(codeString))
+          return _0213;
+        if ("0214".equals(codeString))
+          return _0214;
+        if ("0215".equals(codeString))
+          return _0215;
+        if ("0216".equals(codeString))
+          return _0216;
+        if ("0217".equals(codeString))
+          return _0217;
+        if ("0218".equals(codeString))
+          return _0218;
+        if ("0219".equals(codeString))
+          return _0219;
+        if ("0220".equals(codeString))
+          return _0220;
+        if ("0221".equals(codeString))
+          return _0221;
+        if ("0222".equals(codeString))
+          return _0222;
+        if ("0223".equals(codeString))
+          return _0223;
+        if ("0224".equals(codeString))
+          return _0224;
+        if ("0225".equals(codeString))
+          return _0225;
+        if ("0226".equals(codeString))
+          return _0226;
+        if ("0227".equals(codeString))
+          return _0227;
+        if ("0228".equals(codeString))
+          return _0228;
+        if ("0229".equals(codeString))
+          return _0229;
+        if ("0230".equals(codeString))
+          return _0230;
+        if ("0231".equals(codeString))
+          return _0231;
+        if ("0232".equals(codeString))
+          return _0232;
+        if ("0233".equals(codeString))
+          return _0233;
+        if ("0234".equals(codeString))
+          return _0234;
+        if ("0235".equals(codeString))
+          return _0235;
+        if ("0236".equals(codeString))
+          return _0236;
+        if ("0237".equals(codeString))
+          return _0237;
+        if ("0238".equals(codeString))
+          return _0238;
+        if ("0239".equals(codeString))
+          return _0239;
+        if ("0243".equals(codeString))
+          return _0243;
+        if ("0244".equals(codeString))
+          return _0244;
+        if ("0247".equals(codeString))
+          return _0247;
+        if ("0248".equals(codeString))
+          return _0248;
+        if ("0249".equals(codeString))
+          return _0249;
+        if ("0250".equals(codeString))
+          return _0250;
+        if ("0251".equals(codeString))
+          return _0251;
+        if ("0252".equals(codeString))
+          return _0252;
+        if ("0253".equals(codeString))
+          return _0253;
+        if ("0254".equals(codeString))
+          return _0254;
+        if ("0255".equals(codeString))
+          return _0255;
+        if ("0256".equals(codeString))
+          return _0256;
+        if ("0257".equals(codeString))
+          return _0257;
+        if ("0258".equals(codeString))
+          return _0258;
+        if ("0259".equals(codeString))
+          return _0259;
+        if ("0260".equals(codeString))
+          return _0260;
+        if ("0261".equals(codeString))
+          return _0261;
+        if ("0262".equals(codeString))
+          return _0262;
+        if ("0263".equals(codeString))
+          return _0263;
+        if ("0264".equals(codeString))
+          return _0264;
+        if ("0265".equals(codeString))
+          return _0265;
+        if ("0266".equals(codeString))
+          return _0266;
+        if ("0267".equals(codeString))
+          return _0267;
+        if ("0268".equals(codeString))
+          return _0268;
+        if ("0269".equals(codeString))
+          return _0269;
+        if ("0270".equals(codeString))
+          return _0270;
+        if ("0271".equals(codeString))
+          return _0271;
+        if ("0280".equals(codeString))
+          return _0280;
+        if ("0240".equals(codeString))
+          return _0240;
+        if ("0241".equals(codeString))
+          return _0241;
+        if ("0242".equals(codeString))
+          return _0242;
+        if ("0272".equals(codeString))
+          return _0272;
+        if ("0245".equals(codeString))
+          return _0245;
+        if ("0246".equals(codeString))
+          return _0246;
+        if ("0273".equals(codeString))
+          return _0273;
+        if ("0274".equals(codeString))
+          return _0274;
+        if ("0275".equals(codeString))
+          return _0275;
+        if ("0275a".equals(codeString))
+          return _0275A;
+        if ("0276".equals(codeString))
+          return _0276;
+        if ("0277".equals(codeString))
+          return _0277;
+        if ("0278".equals(codeString))
+          return _0278;
+        if ("0279".equals(codeString))
+          return _0279;
+        if ("0127".equals(codeString))
+          return _0127;
+        throw new FHIRException("Unknown V3ObservationMethod code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _DECISIONOBSERVATIONMETHOD: return "_DecisionObservationMethod";
+            case ALGM: return "ALGM";
+            case BYCL: return "BYCL";
+            case GINT: return "GINT";
+            case _GENETICOBSERVATIONMETHOD: return "_GeneticObservationMethod";
+            case PCR: return "PCR";
+            case _OBSERVATIONMETHODAGGREGATE: return "_ObservationMethodAggregate";
+            case AVERAGE: return "AVERAGE";
+            case COUNT: return "COUNT";
+            case MAX: return "MAX";
+            case MEDIAN: return "MEDIAN";
+            case MIN: return "MIN";
+            case MODE: return "MODE";
+            case STDEV_P: return "STDEV.P";
+            case STDEV_S: return "STDEV.S";
+            case SUM: return "SUM";
+            case VARIANCE_P: return "VARIANCE.P";
+            case VARIANCE_S: return "VARIANCE.S";
+            case _VERIFICATIONMETHOD: return "_VerificationMethod";
+            case VDOC: return "VDOC";
+            case VREG: return "VREG";
+            case VTOKEN: return "VTOKEN";
+            case VVOICE: return "VVOICE";
+            case _0001: return "0001";
+            case _0002: return "0002";
+            case _0003: return "0003";
+            case _0004: return "0004";
+            case _0005: return "0005";
+            case _0006: return "0006";
+            case _0007: return "0007";
+            case _0008: return "0008";
+            case _0009: return "0009";
+            case _0010: return "0010";
+            case _0011: return "0011";
+            case _0012: return "0012";
+            case _0013: return "0013";
+            case _0014: return "0014";
+            case _0015: return "0015";
+            case _0016: return "0016";
+            case _0017: return "0017";
+            case _0018: return "0018";
+            case _0019: return "0019";
+            case _0020: return "0020";
+            case _0021: return "0021";
+            case _0022: return "0022";
+            case _0023: return "0023";
+            case _0024: return "0024";
+            case _0025: return "0025";
+            case _0026: return "0026";
+            case _0027: return "0027";
+            case _0028: return "0028";
+            case _0029: return "0029";
+            case _0030: return "0030";
+            case _0031: return "0031";
+            case _0032: return "0032";
+            case _0033: return "0033";
+            case _0034: return "0034";
+            case _0035: return "0035";
+            case _0036: return "0036";
+            case _0037: return "0037";
+            case _0038: return "0038";
+            case _0039: return "0039";
+            case _0040: return "0040";
+            case _0041: return "0041";
+            case _0042: return "0042";
+            case _0043: return "0043";
+            case _0044: return "0044";
+            case _0045: return "0045";
+            case _0046: return "0046";
+            case _0047: return "0047";
+            case _0048: return "0048";
+            case _0049: return "0049";
+            case _0050: return "0050";
+            case _0051: return "0051";
+            case _0052: return "0052";
+            case _0053: return "0053";
+            case _0054: return "0054";
+            case _0055: return "0055";
+            case _0056: return "0056";
+            case _0057: return "0057";
+            case _0058: return "0058";
+            case _0059: return "0059";
+            case _0060: return "0060";
+            case _0061: return "0061";
+            case _0062: return "0062";
+            case _0063: return "0063";
+            case _0064: return "0064";
+            case _0065: return "0065";
+            case _0066: return "0066";
+            case _0067: return "0067";
+            case _0068: return "0068";
+            case _0069: return "0069";
+            case _0070: return "0070";
+            case _0071: return "0071";
+            case _0072: return "0072";
+            case _0073: return "0073";
+            case _0074: return "0074";
+            case _0075: return "0075";
+            case _0076: return "0076";
+            case _0077: return "0077";
+            case _0078: return "0078";
+            case _0079: return "0079";
+            case _0080: return "0080";
+            case _0081: return "0081";
+            case _0082: return "0082";
+            case _0083: return "0083";
+            case _0084: return "0084";
+            case _0085: return "0085";
+            case _0086: return "0086";
+            case _0087: return "0087";
+            case _0088: return "0088";
+            case _0089: return "0089";
+            case _0090: return "0090";
+            case _0091: return "0091";
+            case _0092: return "0092";
+            case _0093: return "0093";
+            case _0094: return "0094";
+            case _0095: return "0095";
+            case _0096: return "0096";
+            case _0097: return "0097";
+            case _0098: return "0098";
+            case _0099: return "0099";
+            case _0100: return "0100";
+            case _0101: return "0101";
+            case _0102: return "0102";
+            case _0103: return "0103";
+            case _0104: return "0104";
+            case _0105: return "0105";
+            case _0106: return "0106";
+            case _0107: return "0107";
+            case _0108: return "0108";
+            case _0109: return "0109";
+            case _0110: return "0110";
+            case _0111: return "0111";
+            case _0112: return "0112";
+            case _0113: return "0113";
+            case _0114: return "0114";
+            case _0115: return "0115";
+            case _0116: return "0116";
+            case _0117: return "0117";
+            case _0118: return "0118";
+            case _0119: return "0119";
+            case _0120: return "0120";
+            case _0121: return "0121";
+            case _0122: return "0122";
+            case _0123: return "0123";
+            case _0124: return "0124";
+            case _0125: return "0125";
+            case _0126: return "0126";
+            case _0128: return "0128";
+            case _0129: return "0129";
+            case _0130: return "0130";
+            case _0131: return "0131";
+            case _0132: return "0132";
+            case _0133: return "0133";
+            case _0134: return "0134";
+            case _0135: return "0135";
+            case _0136: return "0136";
+            case _0137: return "0137";
+            case _0138: return "0138";
+            case _0139: return "0139";
+            case _0140: return "0140";
+            case _0141: return "0141";
+            case _0142: return "0142";
+            case _0143: return "0143";
+            case _0144: return "0144";
+            case _0145: return "0145";
+            case _0146: return "0146";
+            case _0147: return "0147";
+            case _0148: return "0148";
+            case _0149: return "0149";
+            case _0150: return "0150";
+            case _0151: return "0151";
+            case _0152: return "0152";
+            case _0153: return "0153";
+            case _0154: return "0154";
+            case _0155: return "0155";
+            case _0156: return "0156";
+            case _0157: return "0157";
+            case _0158: return "0158";
+            case _0159: return "0159";
+            case _0160: return "0160";
+            case _0161: return "0161";
+            case _0162: return "0162";
+            case _0163: return "0163";
+            case _0164: return "0164";
+            case _0165: return "0165";
+            case _0166: return "0166";
+            case _0167: return "0167";
+            case _0168: return "0168";
+            case _0169: return "0169";
+            case _0170: return "0170";
+            case _0171: return "0171";
+            case _0172: return "0172";
+            case _0173: return "0173";
+            case _0174: return "0174";
+            case _0175: return "0175";
+            case _0176: return "0176";
+            case _0177: return "0177";
+            case _0178: return "0178";
+            case _0179: return "0179";
+            case _0180: return "0180";
+            case _0181: return "0181";
+            case _0182: return "0182";
+            case _0183: return "0183";
+            case _0184: return "0184";
+            case _0185: return "0185";
+            case _0186: return "0186";
+            case _0187: return "0187";
+            case _0188: return "0188";
+            case _0189: return "0189";
+            case _0190: return "0190";
+            case _0191: return "0191";
+            case _0192: return "0192";
+            case _0193: return "0193";
+            case _0194: return "0194";
+            case _0195: return "0195";
+            case _0196: return "0196";
+            case _0197: return "0197";
+            case _0198: return "0198";
+            case _0199: return "0199";
+            case _0200: return "0200";
+            case _0201: return "0201";
+            case _0202: return "0202";
+            case _0203: return "0203";
+            case _0204: return "0204";
+            case _0205: return "0205";
+            case _0206: return "0206";
+            case _0207: return "0207";
+            case _0208: return "0208";
+            case _0209: return "0209";
+            case _0210: return "0210";
+            case _0211: return "0211";
+            case _0212: return "0212";
+            case _0213: return "0213";
+            case _0214: return "0214";
+            case _0215: return "0215";
+            case _0216: return "0216";
+            case _0217: return "0217";
+            case _0218: return "0218";
+            case _0219: return "0219";
+            case _0220: return "0220";
+            case _0221: return "0221";
+            case _0222: return "0222";
+            case _0223: return "0223";
+            case _0224: return "0224";
+            case _0225: return "0225";
+            case _0226: return "0226";
+            case _0227: return "0227";
+            case _0228: return "0228";
+            case _0229: return "0229";
+            case _0230: return "0230";
+            case _0231: return "0231";
+            case _0232: return "0232";
+            case _0233: return "0233";
+            case _0234: return "0234";
+            case _0235: return "0235";
+            case _0236: return "0236";
+            case _0237: return "0237";
+            case _0238: return "0238";
+            case _0239: return "0239";
+            case _0243: return "0243";
+            case _0244: return "0244";
+            case _0247: return "0247";
+            case _0248: return "0248";
+            case _0249: return "0249";
+            case _0250: return "0250";
+            case _0251: return "0251";
+            case _0252: return "0252";
+            case _0253: return "0253";
+            case _0254: return "0254";
+            case _0255: return "0255";
+            case _0256: return "0256";
+            case _0257: return "0257";
+            case _0258: return "0258";
+            case _0259: return "0259";
+            case _0260: return "0260";
+            case _0261: return "0261";
+            case _0262: return "0262";
+            case _0263: return "0263";
+            case _0264: return "0264";
+            case _0265: return "0265";
+            case _0266: return "0266";
+            case _0267: return "0267";
+            case _0268: return "0268";
+            case _0269: return "0269";
+            case _0270: return "0270";
+            case _0271: return "0271";
+            case _0280: return "0280";
+            case _0240: return "0240";
+            case _0241: return "0241";
+            case _0242: return "0242";
+            case _0272: return "0272";
+            case _0245: return "0245";
+            case _0246: return "0246";
+            case _0273: return "0273";
+            case _0274: return "0274";
+            case _0275: return "0275";
+            case _0275A: return "0275a";
+            case _0276: return "0276";
+            case _0277: return "0277";
+            case _0278: return "0278";
+            case _0279: return "0279";
+            case _0127: return "0127";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ObservationMethod";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _DECISIONOBSERVATIONMETHOD: return "Provides codes for decision methods, initially for assessing the causality of events.";
+            case ALGM: return "Reaching a decision through the application of an algorithm designed to weigh the different factors involved.";
+            case BYCL: return "Reaching a decision through the use of Bayesian statistical analysis.";
+            case GINT: return "Reaching a decision by consideration of the totality of factors involved in order to reach a judgement.";
+            case _GENETICOBSERVATIONMETHOD: return "A code that provides additional detail about the means or technique used to ascertain the genetic analysis. Example, PCR, Micro Array";
+            case PCR: return "Description: Polymerase Chain Reaction";
+            case _OBSERVATIONMETHODAGGREGATE: return "Provides additional detail about the aggregation methods used to compute the aggregated values for an observation. This is an abstract code.";
+            case AVERAGE: return "Average of non-null values in the referenced set of values";
+            case COUNT: return "Count of non-null values in the referenced set of values";
+            case MAX: return "Largest of all non-null values in the referenced set of values.";
+            case MEDIAN: return "The median of all non-null values in the referenced set of values.";
+            case MIN: return "Smallest of all non-null values in the referenced set of values.";
+            case MODE: return "The most common value of all non-null values in the referenced set of values.";
+            case STDEV_P: return "Standard Deviation of the values in the referenced set of values, computed over the population.";
+            case STDEV_S: return "Standard Deviation of the values in the referenced set of values, computed over a sample of the population.";
+            case SUM: return "Sum of non-null values in the referenced set of values";
+            case VARIANCE_P: return "Variance of the values in the referenced set of values, computed over the population.";
+            case VARIANCE_S: return "Variance of the values in the referenced set of values, computed over a sample of the population.";
+            case _VERIFICATIONMETHOD: return "VerificationMethod";
+            case VDOC: return "Verification by means of document.\r\n\n                        \n                           Example: Fax, letter, attachment to e-mail.";
+            case VREG: return "verification by means of  a response to an electronic query\r\n\n                        \n                           Example: query message to a Covered Party registry application or Coverage Administrator.";
+            case VTOKEN: return "Verification by means of electronic token.\r\n\n                        \n                           Example: smartcard, magnetic swipe card, RFID device.";
+            case VVOICE: return "Verification by means of voice.\r\n\n                        \n                           Example: By speaking with or calling the Coverage Administrator or Covered Party";
+            case _0001: return "Complement fixation";
+            case _0002: return "Computed axial tomography";
+            case _0003: return "Susceptibility, High Level Aminoglycoside Resistance agar test";
+            case _0004: return "Visual, Macroscopic observation";
+            case _0005: return "Computed, Magnetic resonance";
+            case _0006: return "Computed, Morphometry";
+            case _0007: return "Computed, Positron emission tomography";
+            case _0008: return "SAMHSA drug assay confirmation";
+            case _0009: return "SAMHSA drug assay screening";
+            case _0010: return "Serum Neutralization";
+            case _0011: return "Titration";
+            case _0012: return "Ultrasound";
+            case _0013: return "X-ray crystallography";
+            case _0014: return "Agglutination";
+            case _0015: return "Agglutination, Buffered acidified plate";
+            case _0016: return "Agglutination, Card";
+            case _0017: return "Agglutination, Hemagglutination";
+            case _0018: return "Agglutination, Hemagglutination inhibition";
+            case _0019: return "Agglutination, Latex";
+            case _0020: return "Agglutination, Plate";
+            case _0021: return "Agglutination, Rapid Plate";
+            case _0022: return "Agglutination, RBC";
+            case _0023: return "Agglutination, Rivanol";
+            case _0024: return "Agglutination, Tube";
+            case _0025: return "Bioassay";
+            case _0026: return "Bioassay, Animal Inoculation";
+            case _0027: return "Bioassay, Cytotoxicity";
+            case _0028: return "Bioassay, Embryo Infective Dose 50";
+            case _0029: return "Bioassay, Embryo Lethal Dose 50";
+            case _0030: return "Bioassay, Mouse intercerebral inoculation";
+            case _0031: return "Bioassay, qualitative";
+            case _0032: return "Bioassay, quantitative";
+            case _0033: return "Chemical";
+            case _0034: return "Chemical, Differential light absorption";
+            case _0035: return "Chemical, Dipstick";
+            case _0036: return "Chemical, Dipstick colorimetric laboratory test";
+            case _0037: return "Chemical, Test strip";
+            case _0038: return "Chromatography";
+            case _0039: return "Chromatography, Affinity";
+            case _0040: return "Chromatography, Gas liquid";
+            case _0041: return "Chromatography, High performance liquid";
+            case _0042: return "Chromatography, Liquid";
+            case _0043: return "Chromatography, Protein A affinity";
+            case _0044: return "Coagulation";
+            case _0045: return "Coagulation, Tilt tube";
+            case _0046: return "Coagulation, Tilt tube reptilase induced";
+            case _0047: return "Count, Automated";
+            case _0048: return "Count, Manual";
+            case _0049: return "Count, Platelet, Rees-Ecker";
+            case _0050: return "Culture, Aerobic";
+            case _0051: return "Culture, Anaerobic";
+            case _0052: return "Culture, Chicken Embryo";
+            case _0053: return "Culture, Delayed secondary enrichment";
+            case _0054: return "Culture, Microaerophilic";
+            case _0055: return "Culture, Quantitative microbial, cup";
+            case _0056: return "Culture, Quantitative microbial, droplet";
+            case _0057: return "Culture, Quantitative microbial, filter paper";
+            case _0058: return "Culture, Quantitative microbial, pad";
+            case _0059: return "Culture, Quantitative microbial, pour plate";
+            case _0060: return "Culture, Quantitative microbial, surface streak";
+            case _0061: return "Culture, Somatic Cell";
+            case _0062: return "Diffusion, Agar";
+            case _0063: return "Diffusion, Agar Gel Immunodiffusion";
+            case _0064: return "Electrophoresis";
+            case _0065: return "Electrophoresis, Agaorse gel";
+            case _0066: return "Electrophoresis, citrate agar";
+            case _0067: return "Electrophoresis, Immuno";
+            case _0068: return "Electrophoresis, Polyacrylamide gel";
+            case _0069: return "Electrophoresis, Starch gel";
+            case _0070: return "ELISA";
+            case _0071: return "ELISA, antigen capture";
+            case _0072: return "ELISA, avidin biotin peroxidase complex";
+            case _0073: return "ELISA, Kinetic";
+            case _0074: return "ELISA, peroxidase-antiperoxidase";
+            case _0075: return "Identification, API 20 Strep";
+            case _0076: return "Identification, API 20A";
+            case _0077: return "Identification, API 20C AUX";
+            case _0078: return "Identification, API 20E";
+            case _0079: return "Identification, API 20NE";
+            case _0080: return "Identification, API 50 CH";
+            case _0081: return "Identification, API An-IDENT";
+            case _0082: return "Identification, API Coryne";
+            case _0083: return "Identification, API Rapid 20E";
+            case _0084: return "Identification, API Staph";
+            case _0085: return "Identification, API ZYM";
+            case _0086: return "Identification, Bacterial";
+            case _0087: return "Identification, mini VIDAS";
+            case _0088: return "Identification, Phage susceptibility typing";
+            case _0089: return "Identification, Quad-FERM+";
+            case _0090: return "Identification, RAPIDEC Staph";
+            case _0091: return "Identification, Staphaurex";
+            case _0092: return "Identification, VIDAS";
+            case _0093: return "Identification, Vitek";
+            case _0094: return "Identification, VITEK 2";
+            case _0095: return "Immune stain";
+            case _0096: return "Immune stain, Immunofluorescent antibody, direct";
+            case _0097: return "Immune stain, Immunofluorescent antibody, indirect";
+            case _0098: return "Immune stain, Immunoperoxidase, Avidin-Biotin Complex";
+            case _0099: return "Immune stain, Immunoperoxidase, Peroxidase anti-peroxidase complex";
+            case _0100: return "Immune stain, Immunoperoxidase, Protein A-peroxidase complex";
+            case _0101: return "Immunoassay";
+            case _0102: return "Immunoassay, qualitative, multiple step";
+            case _0103: return "Immunoassay, qualitative, single step";
+            case _0104: return "Immunoassay, Radioimmunoassay";
+            case _0105: return "Immunoassay, semi-quantitative, multiple step";
+            case _0106: return "Immunoassay, semi-quantitative, single step";
+            case _0107: return "Microscopy";
+            case _0108: return "Microscopy, Darkfield";
+            case _0109: return "Microscopy, Electron";
+            case _0110: return "Microscopy, Electron microscopy tomography";
+            case _0111: return "Microscopy, Electron, negative stain";
+            case _0112: return "Microscopy, Electron, thick section transmission";
+            case _0113: return "Microscopy, Electron, thin section transmission";
+            case _0114: return "Microscopy, Light";
+            case _0115: return "Microscopy, Polarized light";
+            case _0116: return "Microscopy, Scanning electron";
+            case _0117: return "Microscopy, Transmission electron";
+            case _0118: return "Microscopy, Transparent tape direct examination";
+            case _0119: return "Molecular, 3 Self-Sustaining Sequence Replication";
+            case _0120: return "Molecular, Branched Chain DNA";
+            case _0121: return "Molecular, Hybridization Protection Assay";
+            case _0122: return "Molecular, Immune blot";
+            case _0123: return "Molecular, In-situ hybridization";
+            case _0124: return "Molecular, Ligase Chain Reaction";
+            case _0125: return "Molecular, Ligation Activated Transcription";
+            case _0126: return "Molecular, Nucleic Acid Probe";
+            case _0128: return "Molecular, Nucleic acid probe with amplification\r\n\n                        \r\n\n                        Rationale: Duplicate of code 0126. Use code 0126 instead.";
+            case _0129: return "Molecular, Nucleic acid probe with target amplification";
+            case _0130: return "Molecular, Nucleic acid reverse transcription";
+            case _0131: return "Molecular, Nucleic Acid Sequence Based Analysis";
+            case _0132: return "Molecular, Polymerase chain reaction";
+            case _0133: return "Molecular, Q-Beta Replicase or probe amplification category method";
+            case _0134: return "Molecular, Restriction Fragment Length Polymorphism";
+            case _0135: return "Molecular, Southern Blot";
+            case _0136: return "Molecular, Strand Displacement Amplification";
+            case _0137: return "Molecular, Transcription Mediated Amplification";
+            case _0138: return "Molecular, Western Blot";
+            case _0139: return "Precipitation, Flocculation";
+            case _0140: return "Precipitation, Immune precipitation";
+            case _0141: return "Precipitation, Milk ring test";
+            case _0142: return "Precipitation, Precipitin";
+            case _0143: return "Stain, Acid fast";
+            case _0144: return "Stain, Acid fast, fluorochrome";
+            case _0145: return "Stain, Acid fast, Kinyoun's cold carbolfuchsin";
+            case _0146: return "Stain, Acid fast, Ziehl-Neelsen";
+            case _0147: return "Stain, Acid phosphatase";
+            case _0148: return "Stain, Acridine orange";
+            case _0149: return "Stain, Active brilliant orange KH";
+            case _0150: return "Stain, Alazarin red S";
+            case _0151: return "Stain, Alcian blue";
+            case _0152: return "Stain, Alcian blue with Periodic acid Schiff";
+            case _0153: return "Stain, Argentaffin";
+            case _0154: return "Stain, Argentaffin silver";
+            case _0155: return "Stain, Azure-eosin";
+            case _0156: return "Stain, Basic Fuschin";
+            case _0157: return "Stain, Bennhold";
+            case _0158: return "Stain, Bennhold's Congo red";
+            case _0159: return "Stain, Bielschowsky";
+            case _0160: return "Stain, Bielschowsky's silver";
+            case _0161: return "Stain, Bleach";
+            case _0162: return "Stain, Bodian";
+            case _0163: return "Stain, Brown-Brenn";
+            case _0164: return "Stain, Butyrate-esterase";
+            case _0165: return "Stain, Calcofluor white fluorescent";
+            case _0166: return "Stain, Carbol-fuchsin";
+            case _0167: return "Stain, Carmine";
+            case _0168: return "Stain, Churukian-Schenk";
+            case _0169: return "Stain, Congo red";
+            case _0170: return "Stain, Cresyl echt violet";
+            case _0171: return "Stain, Crystal violet";
+            case _0172: return "Stain, De Galantha";
+            case _0173: return "Stain, Dieterle silver impregnation";
+            case _0174: return "Stain, Fite-Farco";
+            case _0175: return "Stain, Fontana-Masson silver";
+            case _0176: return "Stain, Fouchet";
+            case _0177: return "Stain, Gomori";
+            case _0178: return "Stain, Gomori methenamine silver";
+            case _0179: return "Stain, Gomori-Wheatly trichrome";
+            case _0180: return "Stain, Gridley";
+            case _0181: return "Stain, Grimelius silver";
+            case _0182: return "Stain, Grocott";
+            case _0183: return "Stain, Grocott methenamine silver";
+            case _0184: return "Stain, Hale's colloidal ferric oxide";
+            case _0185: return "Stain, Hale's colloidal iron";
+            case _0186: return "Stain, Hansel";
+            case _0187: return "Stain, Harris regressive hematoxylin and eosin";
+            case _0188: return "Stain, Hematoxylin and eosin";
+            case _0189: return "Stain, Highman";
+            case _0190: return "Stain, Holzer";
+            case _0191: return "Stain, Iron hematoxylin";
+            case _0192: return "Stain, Jones";
+            case _0193: return "Stain, Jones methenamine silver";
+            case _0194: return "Stain, Kossa";
+            case _0195: return "Stain, Lawson-Van Gieson";
+            case _0196: return "Stain, Loeffler methylene blue";
+            case _0197: return "Stain, Luxol fast blue with cresyl violet";
+            case _0198: return "Stain, Luxol fast blue with Periodic acid-Schiff";
+            case _0199: return "Stain, MacNeal's tetrachrome blood";
+            case _0200: return "Stain, Mallory-Heidenhain";
+            case _0201: return "Stain, Masson trichrome";
+            case _0202: return "Stain, Mayer mucicarmine";
+            case _0203: return "Stain, Mayers progressive hematoxylin and eosin";
+            case _0204: return "Stain, May-Grunwald Giemsa";
+            case _0205: return "Stain, Methyl green";
+            case _0206: return "Stain, Methyl green pyronin";
+            case _0207: return "Stain, Modified Gomori-Wheatly trichrome";
+            case _0208: return "Stain, Modified Masson trichrome";
+            case _0209: return "Stain, Modified trichrome";
+            case _0210: return "Stain, Movat pentachrome";
+            case _0211: return "Stain, Mucicarmine";
+            case _0212: return "Stain, Neutral red";
+            case _0213: return "Stain, Night blue";
+            case _0214: return "Stain, Non-specific esterase";
+            case _0215: return "Stain, Oil red-O";
+            case _0216: return "Stain, Orcein";
+            case _0217: return "Stain, Perls'";
+            case _0218: return "Stain, Phosphotungstic acid-hematoxylin";
+            case _0219: return "Stain, Potassium ferrocyanide";
+            case _0220: return "Stain, Prussian blue";
+            case _0221: return "Stain, Putchler modified Bennhold";
+            case _0222: return "Stain, Quinacrine fluorescent";
+            case _0223: return "Stain, Reticulin";
+            case _0224: return "Stain, Rhodamine";
+            case _0225: return "Stain, Safranin";
+            case _0226: return "Stain, Schmorl";
+            case _0227: return "Stain, Seiver-Munger";
+            case _0228: return "Stain, Silver";
+            case _0229: return "Stain, Specific esterase";
+            case _0230: return "Stain, Steiner silver";
+            case _0231: return "Stain, Sudan III";
+            case _0232: return "Stain, Sudan IVI";
+            case _0233: return "Stain, Sulfated alcian blue";
+            case _0234: return "Stain, Supravital";
+            case _0235: return "Stain, Thioflavine-S";
+            case _0236: return "Stain, Three micron Giemsa";
+            case _0237: return "Stain, Vassar-Culling";
+            case _0238: return "Stain, Vital";
+            case _0239: return "Stain, von Kossa";
+            case _0243: return "Susceptibility, Minimum bactericidal concentration, macrodilution";
+            case _0244: return "Susceptibility, Minimum bactericidal concentration, microdilution";
+            case _0247: return "Turbidometric";
+            case _0248: return "Turbidometric, Refractometric";
+            case _0249: return "Chromatography, Thin Layer";
+            case _0250: return "Immunoassay, enzyme-multiplied technique (EMIT)";
+            case _0251: return "Flow Cytometry";
+            case _0252: return "Radial Immunodiffusion";
+            case _0253: return "Immunoassay, Fluorescence Polarization";
+            case _0254: return "Electrophoresis, Immunofixation";
+            case _0255: return "Dialysis, Direct Equilibrium";
+            case _0256: return "Acid Elution, Kleihauer-Betke Method";
+            case _0257: return "Immunofluorescence, Anti-Complement";
+            case _0258: return "Gas Chromatography/Mass Spectroscopy";
+            case _0259: return "Light Scatter, Nephelometry";
+            case _0260: return "Immunoassay, IgE Antibody Test";
+            case _0261: return "Lymphocyte Microcytotoxicity Assay";
+            case _0262: return "Spectrophotometry";
+            case _0263: return "Spectrophotometry, Atomic Absorption";
+            case _0264: return "Electrochemical, Ion Selective Electrode";
+            case _0265: return "Chromatography, Gas";
+            case _0266: return "Isoelectric Focusing";
+            case _0267: return "Immunoassay, Chemiluminescent";
+            case _0268: return "Immunoassay, Microparticle Enzyme";
+            case _0269: return "Inductively-Coupled Plasma/Mass Spectrometry";
+            case _0270: return "Immunoassay, Immunoradiometric Assay";
+            case _0271: return "Coagulation, Photo Optical Clot Detection";
+            case _0280: return "Test methods designed to determine a microorganismaTMs susceptibility to being killed by an antibiotic.";
+            case _0240: return "Susceptibility, Antibiotic sensitivity, disk";
+            case _0241: return "Susceptibility, BACTEC susceptibility test";
+            case _0242: return "Susceptibility, Disk dilution";
+            case _0272: return "Testing to measure the minimum concentration of the antibacterial agent in a given culture medium below which bacterial growth is not inhibited.";
+            case _0245: return "Susceptibility, Minimum Inhibitory concentration, macrodilution";
+            case _0246: return "Susceptibility, Minimum Inhibitory concentration, microdilution";
+            case _0273: return "Viral Genotype Susceptibility";
+            case _0274: return "Viral Phenotype Susceptibility";
+            case _0275: return "Gradient Strip";
+            case _0275A: return "Minimum Lethal Concentration (MLC)";
+            case _0276: return "Testing to measure the minimum concentration of the antibacterial agent in a given culture medium below which bacterial growth is not inhibited.";
+            case _0277: return "Serum bactericidal titer";
+            case _0278: return "Agar screen";
+            case _0279: return "Disk induction";
+            case _0127: return "Molecular, Nucleic acid probe";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _DECISIONOBSERVATIONMETHOD: return "DecisionObservationMethod";
+            case ALGM: return "algorithm";
+            case BYCL: return "bayesian calculation";
+            case GINT: return "global introspection";
+            case _GENETICOBSERVATIONMETHOD: return "GeneticObservationMethod";
+            case PCR: return "PCR";
+            case _OBSERVATIONMETHODAGGREGATE: return "observation method aggregate";
+            case AVERAGE: return "average";
+            case COUNT: return "count";
+            case MAX: return "maxima";
+            case MEDIAN: return "median";
+            case MIN: return "minima";
+            case MODE: return "mode";
+            case STDEV_P: return "population standard deviation";
+            case STDEV_S: return "sample standard deviation";
+            case SUM: return "sum";
+            case VARIANCE_P: return "population variance";
+            case VARIANCE_S: return "sample variance";
+            case _VERIFICATIONMETHOD: return "VerificationMethod";
+            case VDOC: return "document verification";
+            case VREG: return "registry verification";
+            case VTOKEN: return "electronic token verification";
+            case VVOICE: return "voice-based verification";
+            case _0001: return "Complement fixation";
+            case _0002: return "Computed axial tomography";
+            case _0003: return "HLAR agar test";
+            case _0004: return "Macroscopic observation";
+            case _0005: return "Magnetic resonance";
+            case _0006: return "Morphometry";
+            case _0007: return "Positron emission tomography";
+            case _0008: return "SAMHSA confirmation";
+            case _0009: return "SAMHSA screening";
+            case _0010: return "Serum Neutralization";
+            case _0011: return "Titration";
+            case _0012: return "Ultrasound";
+            case _0013: return "X-ray crystallography";
+            case _0014: return "Agglutination";
+            case _0015: return "Buffered acidified plate agglutination";
+            case _0016: return "Card agglutination";
+            case _0017: return "Hemagglutination";
+            case _0018: return "Hemagglutination inhibition";
+            case _0019: return "Latex agglutination";
+            case _0020: return "Plate agglutination";
+            case _0021: return "Rapid agglutination";
+            case _0022: return "RBC agglutination";
+            case _0023: return "Rivanol agglutination";
+            case _0024: return "Tube agglutination";
+            case _0025: return "Bioassay";
+            case _0026: return "Animal Inoculation";
+            case _0027: return "Cytotoxicity";
+            case _0028: return "Embryo infective dose 50";
+            case _0029: return "Embryo lethal dose 50";
+            case _0030: return "Mouse intercerebral inoculation";
+            case _0031: return "Bioassay, qualitative";
+            case _0032: return "Bioassay, quantitative";
+            case _0033: return "Chemical method";
+            case _0034: return "Differential light absorption chemical test";
+            case _0035: return "Dipstick";
+            case _0036: return "Dipstick colorimetric laboratory test";
+            case _0037: return "Test strip";
+            case _0038: return "Chromatography";
+            case _0039: return "Affinity chromatography";
+            case _0040: return "Gas liquid chromatography";
+            case _0041: return "High performance liquid chromatography";
+            case _0042: return "Liquid Chromatography";
+            case _0043: return "Protein A affinity chromatography";
+            case _0044: return "Coagulation";
+            case _0045: return "Tilt tube coagulation time";
+            case _0046: return "Tilt tube reptilase induced coagulation";
+            case _0047: return "Automated count";
+            case _0048: return "Manual cell count";
+            case _0049: return "Platelet count, Rees-Ecker";
+            case _0050: return "Aerobic Culture";
+            case _0051: return "Anaerobic Culture";
+            case _0052: return "Chicken embryo culture";
+            case _0053: return "Delayed secondary enrichment";
+            case _0054: return "Microaerophilic Culture";
+            case _0055: return "Quantitative microbial culture, cup";
+            case _0056: return "Quantitative microbial culture, droplet";
+            case _0057: return "Quantitative microbial culture, filter paper";
+            case _0058: return "Quantitative microbial culture, pad culture";
+            case _0059: return "Quantitative microbial culture, pour plate";
+            case _0060: return "Quantitative microbial culture, surface streak";
+            case _0061: return "Somatic Cell culture";
+            case _0062: return "Agar diffusion";
+            case _0063: return "Agar Gel Immunodiffusion";
+            case _0064: return "Electrophoresis";
+            case _0065: return "Agaorse gel electrophoresis";
+            case _0066: return "Electrophoresis, citrate agar";
+            case _0067: return "Immunoelectrophoresis";
+            case _0068: return "Polyacrylamide gel electrophoresis";
+            case _0069: return "Starch gel electrophoresis";
+            case _0070: return "ELISA";
+            case _0071: return "ELISA, antigen capture";
+            case _0072: return "ELISA, avidin biotin peroxidase complex";
+            case _0073: return "Kinetic ELISA";
+            case _0074: return "ELISA, peroxidase-antiperoxidase";
+            case _0075: return "API 20 Strep";
+            case _0076: return "API 20A";
+            case _0077: return "API 20C AUX";
+            case _0078: return "API 20E";
+            case _0079: return "API 20NE";
+            case _0080: return "API 50 CH";
+            case _0081: return "API An-IDENT";
+            case _0082: return "API Coryne";
+            case _0083: return "API Rapid 20E";
+            case _0084: return "API Staph";
+            case _0085: return "API ZYM";
+            case _0086: return "Bacterial identification";
+            case _0087: return "mini VIDAS";
+            case _0088: return "Phage susceptibility typing";
+            case _0089: return "Quad-FERM+";
+            case _0090: return "RAPIDEC Staph";
+            case _0091: return "Staphaurex";
+            case _0092: return "VIDAS";
+            case _0093: return "Vitek";
+            case _0094: return "VITEK 2";
+            case _0095: return "Immune stain";
+            case _0096: return "Immunofluorescent antibody, direct";
+            case _0097: return "Immunofluorescent antibody, indirect";
+            case _0098: return "Immunoperoxidase, Avidin-Biotin Complex";
+            case _0099: return "Immunoperoxidase, Peroxidase anti-peroxidase complex";
+            case _0100: return "Immunoperoxidase, Protein A-peroxidase complex";
+            case _0101: return "Immunoassay";
+            case _0102: return "Immunoassay, qualitative, multiple step";
+            case _0103: return "Immunoassay, qualitative, single step";
+            case _0104: return "Radioimmunoassay";
+            case _0105: return "Immunoassay, semi-quantitative, multiple step";
+            case _0106: return "Immunoassay, semi-quantitative, single step";
+            case _0107: return "Microscopy";
+            case _0108: return "Darkfield microscopy";
+            case _0109: return "Electron microscopy";
+            case _0110: return "Electron microscopy tomography";
+            case _0111: return "Electron microscopy, negative stain";
+            case _0112: return "Electron microscopy, thick section";
+            case _0113: return "Electron microscopy, thin section";
+            case _0114: return "Microscopy, Light";
+            case _0115: return "Polarizing light microscopy";
+            case _0116: return "Scanning electron microscopy";
+            case _0117: return "Transmission electron microscopy";
+            case _0118: return "Transparent tape direct examination";
+            case _0119: return "3 Self-Sustaining Sequence Replication";
+            case _0120: return "Branched Chain DNA";
+            case _0121: return "Hybridization Protection Assay";
+            case _0122: return "Immune blot";
+            case _0123: return "In-situ hybridization";
+            case _0124: return "Ligase Chain Reaction";
+            case _0125: return "Ligation Activated Transcription";
+            case _0126: return "Nucleic Acid Probe";
+            case _0128: return "Nucleic acid probe with amplification";
+            case _0129: return "Nucleic acid probe with target amplification";
+            case _0130: return "Nucleic acid reverse transcription";
+            case _0131: return "Nucleic Acid Sequence Based Analysis";
+            case _0132: return "Polymerase chain reaction";
+            case _0133: return "Q-Beta Replicase or probe amplification category method";
+            case _0134: return "Restriction Fragment Length Polymorphism";
+            case _0135: return "Southern Blot";
+            case _0136: return "Strand Displacement Amplification";
+            case _0137: return "Transcription Mediated Amplification";
+            case _0138: return "Western Blot";
+            case _0139: return "Flocculation";
+            case _0140: return "Immune precipitation";
+            case _0141: return "Milk ring test";
+            case _0142: return "Precipitin";
+            case _0143: return "Acid fast stain";
+            case _0144: return "Acid fast stain, fluorochrome";
+            case _0145: return "Acid fast stain, Kinyoun's cold carbolfuchsin";
+            case _0146: return "Acid fast stain, Ziehl-Neelsen";
+            case _0147: return "Acid phosphatase stain";
+            case _0148: return "Acridine orange stain";
+            case _0149: return "Active brilliant orange KH stain";
+            case _0150: return "Alazarin red S stain";
+            case _0151: return "Alcian blue stain";
+            case _0152: return "Alcian blue with Periodic acid Schiff stain";
+            case _0153: return "Argentaffin stain";
+            case _0154: return "Argentaffin silver stain";
+            case _0155: return "Azure-eosin stain";
+            case _0156: return "Basic Fuschin stain";
+            case _0157: return "Bennhold stain";
+            case _0158: return "Bennhold's Congo red stain";
+            case _0159: return "Bielschowsky stain";
+            case _0160: return "Bielschowsky's silver stain";
+            case _0161: return "Bleach stain";
+            case _0162: return "Bodian stain";
+            case _0163: return "Brown-Brenn stain";
+            case _0164: return "Butyrate-esterase stain";
+            case _0165: return "Calcofluor white fluorescent stain";
+            case _0166: return "Carbol-fuchsin stain";
+            case _0167: return "Carmine stain";
+            case _0168: return "Churukian-Schenk stain";
+            case _0169: return "Congo red stain";
+            case _0170: return "Cresyl echt violet stain";
+            case _0171: return "Crystal violet stain";
+            case _0172: return "De Galantha stain";
+            case _0173: return "Dieterle silver impregnation stain";
+            case _0174: return "Fite-Farco stain";
+            case _0175: return "Fontana-Masson silver stain";
+            case _0176: return "Fouchet stain";
+            case _0177: return "Gomori stain";
+            case _0178: return "Gomori methenamine silver stain";
+            case _0179: return "Gomori-Wheatly trichrome stain";
+            case _0180: return "Gridley stain";
+            case _0181: return "Grimelius silver stain";
+            case _0182: return "Grocott stain";
+            case _0183: return "Grocott methenamine silver stain";
+            case _0184: return "Hale's colloidal ferric oxide stain";
+            case _0185: return "Hale's colloidal iron stain";
+            case _0186: return "Hansel stain";
+            case _0187: return "Harris regressive hematoxylin and eosin stain";
+            case _0188: return "Hematoxylin and eosin stain";
+            case _0189: return "Highman stain";
+            case _0190: return "Holzer stain";
+            case _0191: return "Iron hematoxylin stain";
+            case _0192: return "Jones stain";
+            case _0193: return "Jones methenamine silver stain";
+            case _0194: return "Kossa stain";
+            case _0195: return "Lawson-Van Gieson stain";
+            case _0196: return "Loeffler methylene blue stain";
+            case _0197: return "Luxol fast blue with cresyl violet stain";
+            case _0198: return "Luxol fast blue with Periodic acid-Schiff stain";
+            case _0199: return "MacNeal's tetrachrome blood stain";
+            case _0200: return "Mallory-Heidenhain stain";
+            case _0201: return "Masson trichrome stain";
+            case _0202: return "Mayer mucicarmine stain";
+            case _0203: return "Mayers progressive hematoxylin and eosin stain";
+            case _0204: return "May-Grunwald Giemsa stain";
+            case _0205: return "Methyl green stain";
+            case _0206: return "Methyl green pyronin stain";
+            case _0207: return "Modified Gomori-Wheatly trichrome stain";
+            case _0208: return "Modified Masson trichrome stain";
+            case _0209: return "Modified trichrome stain";
+            case _0210: return "Movat pentachrome stain";
+            case _0211: return "Mucicarmine stain";
+            case _0212: return "Neutral red stain";
+            case _0213: return "Night blue stain";
+            case _0214: return "Non-specific esterase stain";
+            case _0215: return "Oil red-O stain";
+            case _0216: return "Orcein stain";
+            case _0217: return "Perls' stain";
+            case _0218: return "Phosphotungstic acid-hematoxylin stain";
+            case _0219: return "Potassium ferrocyanide stain";
+            case _0220: return "Prussian blue stain";
+            case _0221: return "Putchler modified Bennhold stain";
+            case _0222: return "Quinacrine fluorescent stain";
+            case _0223: return "Reticulin stain";
+            case _0224: return "Rhodamine stain";
+            case _0225: return "Safranin stain";
+            case _0226: return "Schmorl stain";
+            case _0227: return "Seiver-Munger stain";
+            case _0228: return "Silver stain";
+            case _0229: return "Specific esterase stain";
+            case _0230: return "Steiner silver stain";
+            case _0231: return "Sudan III stain";
+            case _0232: return "Sudan IVI stain";
+            case _0233: return "Sulfated alcian blue stain";
+            case _0234: return "Supravital stain";
+            case _0235: return "Thioflavine-S stain";
+            case _0236: return "Three micron Giemsa stain";
+            case _0237: return "Vassar-Culling stain";
+            case _0238: return "Vital Stain";
+            case _0239: return "von Kossa stain";
+            case _0243: return "Minimum bactericidal concentration test, macrodilution";
+            case _0244: return "Minimum bactericidal concentration test, microdilution";
+            case _0247: return "Turbidometric";
+            case _0248: return "Refractometric";
+            case _0249: return "Thin layer chromatography (TLC)";
+            case _0250: return "EMIT";
+            case _0251: return "Flow cytometry (FC)";
+            case _0252: return "Radial immunodiffusion (RID)";
+            case _0253: return "Fluorescence polarization immunoassay (FPIA)";
+            case _0254: return "Immunofixation electrophoresis (IFE)";
+            case _0255: return "Equilibrium dialysis";
+            case _0256: return "Kleihauer-Betke acid elution";
+            case _0257: return "Anti-complement immunofluorescence (ACIF)";
+            case _0258: return "GC/MS";
+            case _0259: return "Nephelometry";
+            case _0260: return "IgE immunoassay antibody";
+            case _0261: return "Lymphocyte Microcytotoxicity Assay";
+            case _0262: return "Spectrophotometry";
+            case _0263: return "Atomic absorption spectrophotometry (AAS)";
+            case _0264: return "Ion selective electrode (ISE)";
+            case _0265: return "Gas chromatography (GC)";
+            case _0266: return "Isoelectric focusing (IEF)";
+            case _0267: return "Immunochemiluminescence";
+            case _0268: return "Microparticle enzyme immunoassay (MEIA)";
+            case _0269: return "ICP/MS";
+            case _0270: return "Immunoradiometric assay (IRMA)";
+            case _0271: return "Photo optical clot detection";
+            case _0280: return "Susceptibility Testing";
+            case _0240: return "Antibiotic sensitivity, disk";
+            case _0241: return "BACTEC susceptibility test";
+            case _0242: return "Disk dilution";
+            case _0272: return "Minimum Inhibitory Concentration";
+            case _0245: return "Minimum Inhibitory Concentration, macrodilution";
+            case _0246: return "Minimum Inhibitory Concentration, microdilution";
+            case _0273: return "Viral Genotype Susceptibility";
+            case _0274: return "Viral Phenotype Susceptibility";
+            case _0275: return "Gradient Strip";
+            case _0275A: return "Minimum Lethal Concentration (MLC)";
+            case _0276: return "Slow Mycobacteria Susceptibility";
+            case _0277: return "Serum bactericidal titer";
+            case _0278: return "Agar screen";
+            case _0279: return "Disk induction";
+            case _0127: return "Nucleic acid probe";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationMethodEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationMethodEnumFactory.java
new file mode 100644
index 00000000000..e5fb9fb012f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationMethodEnumFactory.java
@@ -0,0 +1,1270 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ObservationMethodEnumFactory implements EnumFactory {
+
+  public V3ObservationMethod fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_DecisionObservationMethod".equals(codeString))
+      return V3ObservationMethod._DECISIONOBSERVATIONMETHOD;
+    if ("ALGM".equals(codeString))
+      return V3ObservationMethod.ALGM;
+    if ("BYCL".equals(codeString))
+      return V3ObservationMethod.BYCL;
+    if ("GINT".equals(codeString))
+      return V3ObservationMethod.GINT;
+    if ("_GeneticObservationMethod".equals(codeString))
+      return V3ObservationMethod._GENETICOBSERVATIONMETHOD;
+    if ("PCR".equals(codeString))
+      return V3ObservationMethod.PCR;
+    if ("_ObservationMethodAggregate".equals(codeString))
+      return V3ObservationMethod._OBSERVATIONMETHODAGGREGATE;
+    if ("AVERAGE".equals(codeString))
+      return V3ObservationMethod.AVERAGE;
+    if ("COUNT".equals(codeString))
+      return V3ObservationMethod.COUNT;
+    if ("MAX".equals(codeString))
+      return V3ObservationMethod.MAX;
+    if ("MEDIAN".equals(codeString))
+      return V3ObservationMethod.MEDIAN;
+    if ("MIN".equals(codeString))
+      return V3ObservationMethod.MIN;
+    if ("MODE".equals(codeString))
+      return V3ObservationMethod.MODE;
+    if ("STDEV.P".equals(codeString))
+      return V3ObservationMethod.STDEV_P;
+    if ("STDEV.S".equals(codeString))
+      return V3ObservationMethod.STDEV_S;
+    if ("SUM".equals(codeString))
+      return V3ObservationMethod.SUM;
+    if ("VARIANCE.P".equals(codeString))
+      return V3ObservationMethod.VARIANCE_P;
+    if ("VARIANCE.S".equals(codeString))
+      return V3ObservationMethod.VARIANCE_S;
+    if ("_VerificationMethod".equals(codeString))
+      return V3ObservationMethod._VERIFICATIONMETHOD;
+    if ("VDOC".equals(codeString))
+      return V3ObservationMethod.VDOC;
+    if ("VREG".equals(codeString))
+      return V3ObservationMethod.VREG;
+    if ("VTOKEN".equals(codeString))
+      return V3ObservationMethod.VTOKEN;
+    if ("VVOICE".equals(codeString))
+      return V3ObservationMethod.VVOICE;
+    if ("0001".equals(codeString))
+      return V3ObservationMethod._0001;
+    if ("0002".equals(codeString))
+      return V3ObservationMethod._0002;
+    if ("0003".equals(codeString))
+      return V3ObservationMethod._0003;
+    if ("0004".equals(codeString))
+      return V3ObservationMethod._0004;
+    if ("0005".equals(codeString))
+      return V3ObservationMethod._0005;
+    if ("0006".equals(codeString))
+      return V3ObservationMethod._0006;
+    if ("0007".equals(codeString))
+      return V3ObservationMethod._0007;
+    if ("0008".equals(codeString))
+      return V3ObservationMethod._0008;
+    if ("0009".equals(codeString))
+      return V3ObservationMethod._0009;
+    if ("0010".equals(codeString))
+      return V3ObservationMethod._0010;
+    if ("0011".equals(codeString))
+      return V3ObservationMethod._0011;
+    if ("0012".equals(codeString))
+      return V3ObservationMethod._0012;
+    if ("0013".equals(codeString))
+      return V3ObservationMethod._0013;
+    if ("0014".equals(codeString))
+      return V3ObservationMethod._0014;
+    if ("0015".equals(codeString))
+      return V3ObservationMethod._0015;
+    if ("0016".equals(codeString))
+      return V3ObservationMethod._0016;
+    if ("0017".equals(codeString))
+      return V3ObservationMethod._0017;
+    if ("0018".equals(codeString))
+      return V3ObservationMethod._0018;
+    if ("0019".equals(codeString))
+      return V3ObservationMethod._0019;
+    if ("0020".equals(codeString))
+      return V3ObservationMethod._0020;
+    if ("0021".equals(codeString))
+      return V3ObservationMethod._0021;
+    if ("0022".equals(codeString))
+      return V3ObservationMethod._0022;
+    if ("0023".equals(codeString))
+      return V3ObservationMethod._0023;
+    if ("0024".equals(codeString))
+      return V3ObservationMethod._0024;
+    if ("0025".equals(codeString))
+      return V3ObservationMethod._0025;
+    if ("0026".equals(codeString))
+      return V3ObservationMethod._0026;
+    if ("0027".equals(codeString))
+      return V3ObservationMethod._0027;
+    if ("0028".equals(codeString))
+      return V3ObservationMethod._0028;
+    if ("0029".equals(codeString))
+      return V3ObservationMethod._0029;
+    if ("0030".equals(codeString))
+      return V3ObservationMethod._0030;
+    if ("0031".equals(codeString))
+      return V3ObservationMethod._0031;
+    if ("0032".equals(codeString))
+      return V3ObservationMethod._0032;
+    if ("0033".equals(codeString))
+      return V3ObservationMethod._0033;
+    if ("0034".equals(codeString))
+      return V3ObservationMethod._0034;
+    if ("0035".equals(codeString))
+      return V3ObservationMethod._0035;
+    if ("0036".equals(codeString))
+      return V3ObservationMethod._0036;
+    if ("0037".equals(codeString))
+      return V3ObservationMethod._0037;
+    if ("0038".equals(codeString))
+      return V3ObservationMethod._0038;
+    if ("0039".equals(codeString))
+      return V3ObservationMethod._0039;
+    if ("0040".equals(codeString))
+      return V3ObservationMethod._0040;
+    if ("0041".equals(codeString))
+      return V3ObservationMethod._0041;
+    if ("0042".equals(codeString))
+      return V3ObservationMethod._0042;
+    if ("0043".equals(codeString))
+      return V3ObservationMethod._0043;
+    if ("0044".equals(codeString))
+      return V3ObservationMethod._0044;
+    if ("0045".equals(codeString))
+      return V3ObservationMethod._0045;
+    if ("0046".equals(codeString))
+      return V3ObservationMethod._0046;
+    if ("0047".equals(codeString))
+      return V3ObservationMethod._0047;
+    if ("0048".equals(codeString))
+      return V3ObservationMethod._0048;
+    if ("0049".equals(codeString))
+      return V3ObservationMethod._0049;
+    if ("0050".equals(codeString))
+      return V3ObservationMethod._0050;
+    if ("0051".equals(codeString))
+      return V3ObservationMethod._0051;
+    if ("0052".equals(codeString))
+      return V3ObservationMethod._0052;
+    if ("0053".equals(codeString))
+      return V3ObservationMethod._0053;
+    if ("0054".equals(codeString))
+      return V3ObservationMethod._0054;
+    if ("0055".equals(codeString))
+      return V3ObservationMethod._0055;
+    if ("0056".equals(codeString))
+      return V3ObservationMethod._0056;
+    if ("0057".equals(codeString))
+      return V3ObservationMethod._0057;
+    if ("0058".equals(codeString))
+      return V3ObservationMethod._0058;
+    if ("0059".equals(codeString))
+      return V3ObservationMethod._0059;
+    if ("0060".equals(codeString))
+      return V3ObservationMethod._0060;
+    if ("0061".equals(codeString))
+      return V3ObservationMethod._0061;
+    if ("0062".equals(codeString))
+      return V3ObservationMethod._0062;
+    if ("0063".equals(codeString))
+      return V3ObservationMethod._0063;
+    if ("0064".equals(codeString))
+      return V3ObservationMethod._0064;
+    if ("0065".equals(codeString))
+      return V3ObservationMethod._0065;
+    if ("0066".equals(codeString))
+      return V3ObservationMethod._0066;
+    if ("0067".equals(codeString))
+      return V3ObservationMethod._0067;
+    if ("0068".equals(codeString))
+      return V3ObservationMethod._0068;
+    if ("0069".equals(codeString))
+      return V3ObservationMethod._0069;
+    if ("0070".equals(codeString))
+      return V3ObservationMethod._0070;
+    if ("0071".equals(codeString))
+      return V3ObservationMethod._0071;
+    if ("0072".equals(codeString))
+      return V3ObservationMethod._0072;
+    if ("0073".equals(codeString))
+      return V3ObservationMethod._0073;
+    if ("0074".equals(codeString))
+      return V3ObservationMethod._0074;
+    if ("0075".equals(codeString))
+      return V3ObservationMethod._0075;
+    if ("0076".equals(codeString))
+      return V3ObservationMethod._0076;
+    if ("0077".equals(codeString))
+      return V3ObservationMethod._0077;
+    if ("0078".equals(codeString))
+      return V3ObservationMethod._0078;
+    if ("0079".equals(codeString))
+      return V3ObservationMethod._0079;
+    if ("0080".equals(codeString))
+      return V3ObservationMethod._0080;
+    if ("0081".equals(codeString))
+      return V3ObservationMethod._0081;
+    if ("0082".equals(codeString))
+      return V3ObservationMethod._0082;
+    if ("0083".equals(codeString))
+      return V3ObservationMethod._0083;
+    if ("0084".equals(codeString))
+      return V3ObservationMethod._0084;
+    if ("0085".equals(codeString))
+      return V3ObservationMethod._0085;
+    if ("0086".equals(codeString))
+      return V3ObservationMethod._0086;
+    if ("0087".equals(codeString))
+      return V3ObservationMethod._0087;
+    if ("0088".equals(codeString))
+      return V3ObservationMethod._0088;
+    if ("0089".equals(codeString))
+      return V3ObservationMethod._0089;
+    if ("0090".equals(codeString))
+      return V3ObservationMethod._0090;
+    if ("0091".equals(codeString))
+      return V3ObservationMethod._0091;
+    if ("0092".equals(codeString))
+      return V3ObservationMethod._0092;
+    if ("0093".equals(codeString))
+      return V3ObservationMethod._0093;
+    if ("0094".equals(codeString))
+      return V3ObservationMethod._0094;
+    if ("0095".equals(codeString))
+      return V3ObservationMethod._0095;
+    if ("0096".equals(codeString))
+      return V3ObservationMethod._0096;
+    if ("0097".equals(codeString))
+      return V3ObservationMethod._0097;
+    if ("0098".equals(codeString))
+      return V3ObservationMethod._0098;
+    if ("0099".equals(codeString))
+      return V3ObservationMethod._0099;
+    if ("0100".equals(codeString))
+      return V3ObservationMethod._0100;
+    if ("0101".equals(codeString))
+      return V3ObservationMethod._0101;
+    if ("0102".equals(codeString))
+      return V3ObservationMethod._0102;
+    if ("0103".equals(codeString))
+      return V3ObservationMethod._0103;
+    if ("0104".equals(codeString))
+      return V3ObservationMethod._0104;
+    if ("0105".equals(codeString))
+      return V3ObservationMethod._0105;
+    if ("0106".equals(codeString))
+      return V3ObservationMethod._0106;
+    if ("0107".equals(codeString))
+      return V3ObservationMethod._0107;
+    if ("0108".equals(codeString))
+      return V3ObservationMethod._0108;
+    if ("0109".equals(codeString))
+      return V3ObservationMethod._0109;
+    if ("0110".equals(codeString))
+      return V3ObservationMethod._0110;
+    if ("0111".equals(codeString))
+      return V3ObservationMethod._0111;
+    if ("0112".equals(codeString))
+      return V3ObservationMethod._0112;
+    if ("0113".equals(codeString))
+      return V3ObservationMethod._0113;
+    if ("0114".equals(codeString))
+      return V3ObservationMethod._0114;
+    if ("0115".equals(codeString))
+      return V3ObservationMethod._0115;
+    if ("0116".equals(codeString))
+      return V3ObservationMethod._0116;
+    if ("0117".equals(codeString))
+      return V3ObservationMethod._0117;
+    if ("0118".equals(codeString))
+      return V3ObservationMethod._0118;
+    if ("0119".equals(codeString))
+      return V3ObservationMethod._0119;
+    if ("0120".equals(codeString))
+      return V3ObservationMethod._0120;
+    if ("0121".equals(codeString))
+      return V3ObservationMethod._0121;
+    if ("0122".equals(codeString))
+      return V3ObservationMethod._0122;
+    if ("0123".equals(codeString))
+      return V3ObservationMethod._0123;
+    if ("0124".equals(codeString))
+      return V3ObservationMethod._0124;
+    if ("0125".equals(codeString))
+      return V3ObservationMethod._0125;
+    if ("0126".equals(codeString))
+      return V3ObservationMethod._0126;
+    if ("0128".equals(codeString))
+      return V3ObservationMethod._0128;
+    if ("0129".equals(codeString))
+      return V3ObservationMethod._0129;
+    if ("0130".equals(codeString))
+      return V3ObservationMethod._0130;
+    if ("0131".equals(codeString))
+      return V3ObservationMethod._0131;
+    if ("0132".equals(codeString))
+      return V3ObservationMethod._0132;
+    if ("0133".equals(codeString))
+      return V3ObservationMethod._0133;
+    if ("0134".equals(codeString))
+      return V3ObservationMethod._0134;
+    if ("0135".equals(codeString))
+      return V3ObservationMethod._0135;
+    if ("0136".equals(codeString))
+      return V3ObservationMethod._0136;
+    if ("0137".equals(codeString))
+      return V3ObservationMethod._0137;
+    if ("0138".equals(codeString))
+      return V3ObservationMethod._0138;
+    if ("0139".equals(codeString))
+      return V3ObservationMethod._0139;
+    if ("0140".equals(codeString))
+      return V3ObservationMethod._0140;
+    if ("0141".equals(codeString))
+      return V3ObservationMethod._0141;
+    if ("0142".equals(codeString))
+      return V3ObservationMethod._0142;
+    if ("0143".equals(codeString))
+      return V3ObservationMethod._0143;
+    if ("0144".equals(codeString))
+      return V3ObservationMethod._0144;
+    if ("0145".equals(codeString))
+      return V3ObservationMethod._0145;
+    if ("0146".equals(codeString))
+      return V3ObservationMethod._0146;
+    if ("0147".equals(codeString))
+      return V3ObservationMethod._0147;
+    if ("0148".equals(codeString))
+      return V3ObservationMethod._0148;
+    if ("0149".equals(codeString))
+      return V3ObservationMethod._0149;
+    if ("0150".equals(codeString))
+      return V3ObservationMethod._0150;
+    if ("0151".equals(codeString))
+      return V3ObservationMethod._0151;
+    if ("0152".equals(codeString))
+      return V3ObservationMethod._0152;
+    if ("0153".equals(codeString))
+      return V3ObservationMethod._0153;
+    if ("0154".equals(codeString))
+      return V3ObservationMethod._0154;
+    if ("0155".equals(codeString))
+      return V3ObservationMethod._0155;
+    if ("0156".equals(codeString))
+      return V3ObservationMethod._0156;
+    if ("0157".equals(codeString))
+      return V3ObservationMethod._0157;
+    if ("0158".equals(codeString))
+      return V3ObservationMethod._0158;
+    if ("0159".equals(codeString))
+      return V3ObservationMethod._0159;
+    if ("0160".equals(codeString))
+      return V3ObservationMethod._0160;
+    if ("0161".equals(codeString))
+      return V3ObservationMethod._0161;
+    if ("0162".equals(codeString))
+      return V3ObservationMethod._0162;
+    if ("0163".equals(codeString))
+      return V3ObservationMethod._0163;
+    if ("0164".equals(codeString))
+      return V3ObservationMethod._0164;
+    if ("0165".equals(codeString))
+      return V3ObservationMethod._0165;
+    if ("0166".equals(codeString))
+      return V3ObservationMethod._0166;
+    if ("0167".equals(codeString))
+      return V3ObservationMethod._0167;
+    if ("0168".equals(codeString))
+      return V3ObservationMethod._0168;
+    if ("0169".equals(codeString))
+      return V3ObservationMethod._0169;
+    if ("0170".equals(codeString))
+      return V3ObservationMethod._0170;
+    if ("0171".equals(codeString))
+      return V3ObservationMethod._0171;
+    if ("0172".equals(codeString))
+      return V3ObservationMethod._0172;
+    if ("0173".equals(codeString))
+      return V3ObservationMethod._0173;
+    if ("0174".equals(codeString))
+      return V3ObservationMethod._0174;
+    if ("0175".equals(codeString))
+      return V3ObservationMethod._0175;
+    if ("0176".equals(codeString))
+      return V3ObservationMethod._0176;
+    if ("0177".equals(codeString))
+      return V3ObservationMethod._0177;
+    if ("0178".equals(codeString))
+      return V3ObservationMethod._0178;
+    if ("0179".equals(codeString))
+      return V3ObservationMethod._0179;
+    if ("0180".equals(codeString))
+      return V3ObservationMethod._0180;
+    if ("0181".equals(codeString))
+      return V3ObservationMethod._0181;
+    if ("0182".equals(codeString))
+      return V3ObservationMethod._0182;
+    if ("0183".equals(codeString))
+      return V3ObservationMethod._0183;
+    if ("0184".equals(codeString))
+      return V3ObservationMethod._0184;
+    if ("0185".equals(codeString))
+      return V3ObservationMethod._0185;
+    if ("0186".equals(codeString))
+      return V3ObservationMethod._0186;
+    if ("0187".equals(codeString))
+      return V3ObservationMethod._0187;
+    if ("0188".equals(codeString))
+      return V3ObservationMethod._0188;
+    if ("0189".equals(codeString))
+      return V3ObservationMethod._0189;
+    if ("0190".equals(codeString))
+      return V3ObservationMethod._0190;
+    if ("0191".equals(codeString))
+      return V3ObservationMethod._0191;
+    if ("0192".equals(codeString))
+      return V3ObservationMethod._0192;
+    if ("0193".equals(codeString))
+      return V3ObservationMethod._0193;
+    if ("0194".equals(codeString))
+      return V3ObservationMethod._0194;
+    if ("0195".equals(codeString))
+      return V3ObservationMethod._0195;
+    if ("0196".equals(codeString))
+      return V3ObservationMethod._0196;
+    if ("0197".equals(codeString))
+      return V3ObservationMethod._0197;
+    if ("0198".equals(codeString))
+      return V3ObservationMethod._0198;
+    if ("0199".equals(codeString))
+      return V3ObservationMethod._0199;
+    if ("0200".equals(codeString))
+      return V3ObservationMethod._0200;
+    if ("0201".equals(codeString))
+      return V3ObservationMethod._0201;
+    if ("0202".equals(codeString))
+      return V3ObservationMethod._0202;
+    if ("0203".equals(codeString))
+      return V3ObservationMethod._0203;
+    if ("0204".equals(codeString))
+      return V3ObservationMethod._0204;
+    if ("0205".equals(codeString))
+      return V3ObservationMethod._0205;
+    if ("0206".equals(codeString))
+      return V3ObservationMethod._0206;
+    if ("0207".equals(codeString))
+      return V3ObservationMethod._0207;
+    if ("0208".equals(codeString))
+      return V3ObservationMethod._0208;
+    if ("0209".equals(codeString))
+      return V3ObservationMethod._0209;
+    if ("0210".equals(codeString))
+      return V3ObservationMethod._0210;
+    if ("0211".equals(codeString))
+      return V3ObservationMethod._0211;
+    if ("0212".equals(codeString))
+      return V3ObservationMethod._0212;
+    if ("0213".equals(codeString))
+      return V3ObservationMethod._0213;
+    if ("0214".equals(codeString))
+      return V3ObservationMethod._0214;
+    if ("0215".equals(codeString))
+      return V3ObservationMethod._0215;
+    if ("0216".equals(codeString))
+      return V3ObservationMethod._0216;
+    if ("0217".equals(codeString))
+      return V3ObservationMethod._0217;
+    if ("0218".equals(codeString))
+      return V3ObservationMethod._0218;
+    if ("0219".equals(codeString))
+      return V3ObservationMethod._0219;
+    if ("0220".equals(codeString))
+      return V3ObservationMethod._0220;
+    if ("0221".equals(codeString))
+      return V3ObservationMethod._0221;
+    if ("0222".equals(codeString))
+      return V3ObservationMethod._0222;
+    if ("0223".equals(codeString))
+      return V3ObservationMethod._0223;
+    if ("0224".equals(codeString))
+      return V3ObservationMethod._0224;
+    if ("0225".equals(codeString))
+      return V3ObservationMethod._0225;
+    if ("0226".equals(codeString))
+      return V3ObservationMethod._0226;
+    if ("0227".equals(codeString))
+      return V3ObservationMethod._0227;
+    if ("0228".equals(codeString))
+      return V3ObservationMethod._0228;
+    if ("0229".equals(codeString))
+      return V3ObservationMethod._0229;
+    if ("0230".equals(codeString))
+      return V3ObservationMethod._0230;
+    if ("0231".equals(codeString))
+      return V3ObservationMethod._0231;
+    if ("0232".equals(codeString))
+      return V3ObservationMethod._0232;
+    if ("0233".equals(codeString))
+      return V3ObservationMethod._0233;
+    if ("0234".equals(codeString))
+      return V3ObservationMethod._0234;
+    if ("0235".equals(codeString))
+      return V3ObservationMethod._0235;
+    if ("0236".equals(codeString))
+      return V3ObservationMethod._0236;
+    if ("0237".equals(codeString))
+      return V3ObservationMethod._0237;
+    if ("0238".equals(codeString))
+      return V3ObservationMethod._0238;
+    if ("0239".equals(codeString))
+      return V3ObservationMethod._0239;
+    if ("0243".equals(codeString))
+      return V3ObservationMethod._0243;
+    if ("0244".equals(codeString))
+      return V3ObservationMethod._0244;
+    if ("0247".equals(codeString))
+      return V3ObservationMethod._0247;
+    if ("0248".equals(codeString))
+      return V3ObservationMethod._0248;
+    if ("0249".equals(codeString))
+      return V3ObservationMethod._0249;
+    if ("0250".equals(codeString))
+      return V3ObservationMethod._0250;
+    if ("0251".equals(codeString))
+      return V3ObservationMethod._0251;
+    if ("0252".equals(codeString))
+      return V3ObservationMethod._0252;
+    if ("0253".equals(codeString))
+      return V3ObservationMethod._0253;
+    if ("0254".equals(codeString))
+      return V3ObservationMethod._0254;
+    if ("0255".equals(codeString))
+      return V3ObservationMethod._0255;
+    if ("0256".equals(codeString))
+      return V3ObservationMethod._0256;
+    if ("0257".equals(codeString))
+      return V3ObservationMethod._0257;
+    if ("0258".equals(codeString))
+      return V3ObservationMethod._0258;
+    if ("0259".equals(codeString))
+      return V3ObservationMethod._0259;
+    if ("0260".equals(codeString))
+      return V3ObservationMethod._0260;
+    if ("0261".equals(codeString))
+      return V3ObservationMethod._0261;
+    if ("0262".equals(codeString))
+      return V3ObservationMethod._0262;
+    if ("0263".equals(codeString))
+      return V3ObservationMethod._0263;
+    if ("0264".equals(codeString))
+      return V3ObservationMethod._0264;
+    if ("0265".equals(codeString))
+      return V3ObservationMethod._0265;
+    if ("0266".equals(codeString))
+      return V3ObservationMethod._0266;
+    if ("0267".equals(codeString))
+      return V3ObservationMethod._0267;
+    if ("0268".equals(codeString))
+      return V3ObservationMethod._0268;
+    if ("0269".equals(codeString))
+      return V3ObservationMethod._0269;
+    if ("0270".equals(codeString))
+      return V3ObservationMethod._0270;
+    if ("0271".equals(codeString))
+      return V3ObservationMethod._0271;
+    if ("0280".equals(codeString))
+      return V3ObservationMethod._0280;
+    if ("0240".equals(codeString))
+      return V3ObservationMethod._0240;
+    if ("0241".equals(codeString))
+      return V3ObservationMethod._0241;
+    if ("0242".equals(codeString))
+      return V3ObservationMethod._0242;
+    if ("0272".equals(codeString))
+      return V3ObservationMethod._0272;
+    if ("0245".equals(codeString))
+      return V3ObservationMethod._0245;
+    if ("0246".equals(codeString))
+      return V3ObservationMethod._0246;
+    if ("0273".equals(codeString))
+      return V3ObservationMethod._0273;
+    if ("0274".equals(codeString))
+      return V3ObservationMethod._0274;
+    if ("0275".equals(codeString))
+      return V3ObservationMethod._0275;
+    if ("0275a".equals(codeString))
+      return V3ObservationMethod._0275A;
+    if ("0276".equals(codeString))
+      return V3ObservationMethod._0276;
+    if ("0277".equals(codeString))
+      return V3ObservationMethod._0277;
+    if ("0278".equals(codeString))
+      return V3ObservationMethod._0278;
+    if ("0279".equals(codeString))
+      return V3ObservationMethod._0279;
+    if ("0127".equals(codeString))
+      return V3ObservationMethod._0127;
+    throw new IllegalArgumentException("Unknown V3ObservationMethod code '"+codeString+"'");
+  }
+
+  public String toCode(V3ObservationMethod code) {
+    if (code == V3ObservationMethod._DECISIONOBSERVATIONMETHOD)
+      return "_DecisionObservationMethod";
+    if (code == V3ObservationMethod.ALGM)
+      return "ALGM";
+    if (code == V3ObservationMethod.BYCL)
+      return "BYCL";
+    if (code == V3ObservationMethod.GINT)
+      return "GINT";
+    if (code == V3ObservationMethod._GENETICOBSERVATIONMETHOD)
+      return "_GeneticObservationMethod";
+    if (code == V3ObservationMethod.PCR)
+      return "PCR";
+    if (code == V3ObservationMethod._OBSERVATIONMETHODAGGREGATE)
+      return "_ObservationMethodAggregate";
+    if (code == V3ObservationMethod.AVERAGE)
+      return "AVERAGE";
+    if (code == V3ObservationMethod.COUNT)
+      return "COUNT";
+    if (code == V3ObservationMethod.MAX)
+      return "MAX";
+    if (code == V3ObservationMethod.MEDIAN)
+      return "MEDIAN";
+    if (code == V3ObservationMethod.MIN)
+      return "MIN";
+    if (code == V3ObservationMethod.MODE)
+      return "MODE";
+    if (code == V3ObservationMethod.STDEV_P)
+      return "STDEV.P";
+    if (code == V3ObservationMethod.STDEV_S)
+      return "STDEV.S";
+    if (code == V3ObservationMethod.SUM)
+      return "SUM";
+    if (code == V3ObservationMethod.VARIANCE_P)
+      return "VARIANCE.P";
+    if (code == V3ObservationMethod.VARIANCE_S)
+      return "VARIANCE.S";
+    if (code == V3ObservationMethod._VERIFICATIONMETHOD)
+      return "_VerificationMethod";
+    if (code == V3ObservationMethod.VDOC)
+      return "VDOC";
+    if (code == V3ObservationMethod.VREG)
+      return "VREG";
+    if (code == V3ObservationMethod.VTOKEN)
+      return "VTOKEN";
+    if (code == V3ObservationMethod.VVOICE)
+      return "VVOICE";
+    if (code == V3ObservationMethod._0001)
+      return "0001";
+    if (code == V3ObservationMethod._0002)
+      return "0002";
+    if (code == V3ObservationMethod._0003)
+      return "0003";
+    if (code == V3ObservationMethod._0004)
+      return "0004";
+    if (code == V3ObservationMethod._0005)
+      return "0005";
+    if (code == V3ObservationMethod._0006)
+      return "0006";
+    if (code == V3ObservationMethod._0007)
+      return "0007";
+    if (code == V3ObservationMethod._0008)
+      return "0008";
+    if (code == V3ObservationMethod._0009)
+      return "0009";
+    if (code == V3ObservationMethod._0010)
+      return "0010";
+    if (code == V3ObservationMethod._0011)
+      return "0011";
+    if (code == V3ObservationMethod._0012)
+      return "0012";
+    if (code == V3ObservationMethod._0013)
+      return "0013";
+    if (code == V3ObservationMethod._0014)
+      return "0014";
+    if (code == V3ObservationMethod._0015)
+      return "0015";
+    if (code == V3ObservationMethod._0016)
+      return "0016";
+    if (code == V3ObservationMethod._0017)
+      return "0017";
+    if (code == V3ObservationMethod._0018)
+      return "0018";
+    if (code == V3ObservationMethod._0019)
+      return "0019";
+    if (code == V3ObservationMethod._0020)
+      return "0020";
+    if (code == V3ObservationMethod._0021)
+      return "0021";
+    if (code == V3ObservationMethod._0022)
+      return "0022";
+    if (code == V3ObservationMethod._0023)
+      return "0023";
+    if (code == V3ObservationMethod._0024)
+      return "0024";
+    if (code == V3ObservationMethod._0025)
+      return "0025";
+    if (code == V3ObservationMethod._0026)
+      return "0026";
+    if (code == V3ObservationMethod._0027)
+      return "0027";
+    if (code == V3ObservationMethod._0028)
+      return "0028";
+    if (code == V3ObservationMethod._0029)
+      return "0029";
+    if (code == V3ObservationMethod._0030)
+      return "0030";
+    if (code == V3ObservationMethod._0031)
+      return "0031";
+    if (code == V3ObservationMethod._0032)
+      return "0032";
+    if (code == V3ObservationMethod._0033)
+      return "0033";
+    if (code == V3ObservationMethod._0034)
+      return "0034";
+    if (code == V3ObservationMethod._0035)
+      return "0035";
+    if (code == V3ObservationMethod._0036)
+      return "0036";
+    if (code == V3ObservationMethod._0037)
+      return "0037";
+    if (code == V3ObservationMethod._0038)
+      return "0038";
+    if (code == V3ObservationMethod._0039)
+      return "0039";
+    if (code == V3ObservationMethod._0040)
+      return "0040";
+    if (code == V3ObservationMethod._0041)
+      return "0041";
+    if (code == V3ObservationMethod._0042)
+      return "0042";
+    if (code == V3ObservationMethod._0043)
+      return "0043";
+    if (code == V3ObservationMethod._0044)
+      return "0044";
+    if (code == V3ObservationMethod._0045)
+      return "0045";
+    if (code == V3ObservationMethod._0046)
+      return "0046";
+    if (code == V3ObservationMethod._0047)
+      return "0047";
+    if (code == V3ObservationMethod._0048)
+      return "0048";
+    if (code == V3ObservationMethod._0049)
+      return "0049";
+    if (code == V3ObservationMethod._0050)
+      return "0050";
+    if (code == V3ObservationMethod._0051)
+      return "0051";
+    if (code == V3ObservationMethod._0052)
+      return "0052";
+    if (code == V3ObservationMethod._0053)
+      return "0053";
+    if (code == V3ObservationMethod._0054)
+      return "0054";
+    if (code == V3ObservationMethod._0055)
+      return "0055";
+    if (code == V3ObservationMethod._0056)
+      return "0056";
+    if (code == V3ObservationMethod._0057)
+      return "0057";
+    if (code == V3ObservationMethod._0058)
+      return "0058";
+    if (code == V3ObservationMethod._0059)
+      return "0059";
+    if (code == V3ObservationMethod._0060)
+      return "0060";
+    if (code == V3ObservationMethod._0061)
+      return "0061";
+    if (code == V3ObservationMethod._0062)
+      return "0062";
+    if (code == V3ObservationMethod._0063)
+      return "0063";
+    if (code == V3ObservationMethod._0064)
+      return "0064";
+    if (code == V3ObservationMethod._0065)
+      return "0065";
+    if (code == V3ObservationMethod._0066)
+      return "0066";
+    if (code == V3ObservationMethod._0067)
+      return "0067";
+    if (code == V3ObservationMethod._0068)
+      return "0068";
+    if (code == V3ObservationMethod._0069)
+      return "0069";
+    if (code == V3ObservationMethod._0070)
+      return "0070";
+    if (code == V3ObservationMethod._0071)
+      return "0071";
+    if (code == V3ObservationMethod._0072)
+      return "0072";
+    if (code == V3ObservationMethod._0073)
+      return "0073";
+    if (code == V3ObservationMethod._0074)
+      return "0074";
+    if (code == V3ObservationMethod._0075)
+      return "0075";
+    if (code == V3ObservationMethod._0076)
+      return "0076";
+    if (code == V3ObservationMethod._0077)
+      return "0077";
+    if (code == V3ObservationMethod._0078)
+      return "0078";
+    if (code == V3ObservationMethod._0079)
+      return "0079";
+    if (code == V3ObservationMethod._0080)
+      return "0080";
+    if (code == V3ObservationMethod._0081)
+      return "0081";
+    if (code == V3ObservationMethod._0082)
+      return "0082";
+    if (code == V3ObservationMethod._0083)
+      return "0083";
+    if (code == V3ObservationMethod._0084)
+      return "0084";
+    if (code == V3ObservationMethod._0085)
+      return "0085";
+    if (code == V3ObservationMethod._0086)
+      return "0086";
+    if (code == V3ObservationMethod._0087)
+      return "0087";
+    if (code == V3ObservationMethod._0088)
+      return "0088";
+    if (code == V3ObservationMethod._0089)
+      return "0089";
+    if (code == V3ObservationMethod._0090)
+      return "0090";
+    if (code == V3ObservationMethod._0091)
+      return "0091";
+    if (code == V3ObservationMethod._0092)
+      return "0092";
+    if (code == V3ObservationMethod._0093)
+      return "0093";
+    if (code == V3ObservationMethod._0094)
+      return "0094";
+    if (code == V3ObservationMethod._0095)
+      return "0095";
+    if (code == V3ObservationMethod._0096)
+      return "0096";
+    if (code == V3ObservationMethod._0097)
+      return "0097";
+    if (code == V3ObservationMethod._0098)
+      return "0098";
+    if (code == V3ObservationMethod._0099)
+      return "0099";
+    if (code == V3ObservationMethod._0100)
+      return "0100";
+    if (code == V3ObservationMethod._0101)
+      return "0101";
+    if (code == V3ObservationMethod._0102)
+      return "0102";
+    if (code == V3ObservationMethod._0103)
+      return "0103";
+    if (code == V3ObservationMethod._0104)
+      return "0104";
+    if (code == V3ObservationMethod._0105)
+      return "0105";
+    if (code == V3ObservationMethod._0106)
+      return "0106";
+    if (code == V3ObservationMethod._0107)
+      return "0107";
+    if (code == V3ObservationMethod._0108)
+      return "0108";
+    if (code == V3ObservationMethod._0109)
+      return "0109";
+    if (code == V3ObservationMethod._0110)
+      return "0110";
+    if (code == V3ObservationMethod._0111)
+      return "0111";
+    if (code == V3ObservationMethod._0112)
+      return "0112";
+    if (code == V3ObservationMethod._0113)
+      return "0113";
+    if (code == V3ObservationMethod._0114)
+      return "0114";
+    if (code == V3ObservationMethod._0115)
+      return "0115";
+    if (code == V3ObservationMethod._0116)
+      return "0116";
+    if (code == V3ObservationMethod._0117)
+      return "0117";
+    if (code == V3ObservationMethod._0118)
+      return "0118";
+    if (code == V3ObservationMethod._0119)
+      return "0119";
+    if (code == V3ObservationMethod._0120)
+      return "0120";
+    if (code == V3ObservationMethod._0121)
+      return "0121";
+    if (code == V3ObservationMethod._0122)
+      return "0122";
+    if (code == V3ObservationMethod._0123)
+      return "0123";
+    if (code == V3ObservationMethod._0124)
+      return "0124";
+    if (code == V3ObservationMethod._0125)
+      return "0125";
+    if (code == V3ObservationMethod._0126)
+      return "0126";
+    if (code == V3ObservationMethod._0128)
+      return "0128";
+    if (code == V3ObservationMethod._0129)
+      return "0129";
+    if (code == V3ObservationMethod._0130)
+      return "0130";
+    if (code == V3ObservationMethod._0131)
+      return "0131";
+    if (code == V3ObservationMethod._0132)
+      return "0132";
+    if (code == V3ObservationMethod._0133)
+      return "0133";
+    if (code == V3ObservationMethod._0134)
+      return "0134";
+    if (code == V3ObservationMethod._0135)
+      return "0135";
+    if (code == V3ObservationMethod._0136)
+      return "0136";
+    if (code == V3ObservationMethod._0137)
+      return "0137";
+    if (code == V3ObservationMethod._0138)
+      return "0138";
+    if (code == V3ObservationMethod._0139)
+      return "0139";
+    if (code == V3ObservationMethod._0140)
+      return "0140";
+    if (code == V3ObservationMethod._0141)
+      return "0141";
+    if (code == V3ObservationMethod._0142)
+      return "0142";
+    if (code == V3ObservationMethod._0143)
+      return "0143";
+    if (code == V3ObservationMethod._0144)
+      return "0144";
+    if (code == V3ObservationMethod._0145)
+      return "0145";
+    if (code == V3ObservationMethod._0146)
+      return "0146";
+    if (code == V3ObservationMethod._0147)
+      return "0147";
+    if (code == V3ObservationMethod._0148)
+      return "0148";
+    if (code == V3ObservationMethod._0149)
+      return "0149";
+    if (code == V3ObservationMethod._0150)
+      return "0150";
+    if (code == V3ObservationMethod._0151)
+      return "0151";
+    if (code == V3ObservationMethod._0152)
+      return "0152";
+    if (code == V3ObservationMethod._0153)
+      return "0153";
+    if (code == V3ObservationMethod._0154)
+      return "0154";
+    if (code == V3ObservationMethod._0155)
+      return "0155";
+    if (code == V3ObservationMethod._0156)
+      return "0156";
+    if (code == V3ObservationMethod._0157)
+      return "0157";
+    if (code == V3ObservationMethod._0158)
+      return "0158";
+    if (code == V3ObservationMethod._0159)
+      return "0159";
+    if (code == V3ObservationMethod._0160)
+      return "0160";
+    if (code == V3ObservationMethod._0161)
+      return "0161";
+    if (code == V3ObservationMethod._0162)
+      return "0162";
+    if (code == V3ObservationMethod._0163)
+      return "0163";
+    if (code == V3ObservationMethod._0164)
+      return "0164";
+    if (code == V3ObservationMethod._0165)
+      return "0165";
+    if (code == V3ObservationMethod._0166)
+      return "0166";
+    if (code == V3ObservationMethod._0167)
+      return "0167";
+    if (code == V3ObservationMethod._0168)
+      return "0168";
+    if (code == V3ObservationMethod._0169)
+      return "0169";
+    if (code == V3ObservationMethod._0170)
+      return "0170";
+    if (code == V3ObservationMethod._0171)
+      return "0171";
+    if (code == V3ObservationMethod._0172)
+      return "0172";
+    if (code == V3ObservationMethod._0173)
+      return "0173";
+    if (code == V3ObservationMethod._0174)
+      return "0174";
+    if (code == V3ObservationMethod._0175)
+      return "0175";
+    if (code == V3ObservationMethod._0176)
+      return "0176";
+    if (code == V3ObservationMethod._0177)
+      return "0177";
+    if (code == V3ObservationMethod._0178)
+      return "0178";
+    if (code == V3ObservationMethod._0179)
+      return "0179";
+    if (code == V3ObservationMethod._0180)
+      return "0180";
+    if (code == V3ObservationMethod._0181)
+      return "0181";
+    if (code == V3ObservationMethod._0182)
+      return "0182";
+    if (code == V3ObservationMethod._0183)
+      return "0183";
+    if (code == V3ObservationMethod._0184)
+      return "0184";
+    if (code == V3ObservationMethod._0185)
+      return "0185";
+    if (code == V3ObservationMethod._0186)
+      return "0186";
+    if (code == V3ObservationMethod._0187)
+      return "0187";
+    if (code == V3ObservationMethod._0188)
+      return "0188";
+    if (code == V3ObservationMethod._0189)
+      return "0189";
+    if (code == V3ObservationMethod._0190)
+      return "0190";
+    if (code == V3ObservationMethod._0191)
+      return "0191";
+    if (code == V3ObservationMethod._0192)
+      return "0192";
+    if (code == V3ObservationMethod._0193)
+      return "0193";
+    if (code == V3ObservationMethod._0194)
+      return "0194";
+    if (code == V3ObservationMethod._0195)
+      return "0195";
+    if (code == V3ObservationMethod._0196)
+      return "0196";
+    if (code == V3ObservationMethod._0197)
+      return "0197";
+    if (code == V3ObservationMethod._0198)
+      return "0198";
+    if (code == V3ObservationMethod._0199)
+      return "0199";
+    if (code == V3ObservationMethod._0200)
+      return "0200";
+    if (code == V3ObservationMethod._0201)
+      return "0201";
+    if (code == V3ObservationMethod._0202)
+      return "0202";
+    if (code == V3ObservationMethod._0203)
+      return "0203";
+    if (code == V3ObservationMethod._0204)
+      return "0204";
+    if (code == V3ObservationMethod._0205)
+      return "0205";
+    if (code == V3ObservationMethod._0206)
+      return "0206";
+    if (code == V3ObservationMethod._0207)
+      return "0207";
+    if (code == V3ObservationMethod._0208)
+      return "0208";
+    if (code == V3ObservationMethod._0209)
+      return "0209";
+    if (code == V3ObservationMethod._0210)
+      return "0210";
+    if (code == V3ObservationMethod._0211)
+      return "0211";
+    if (code == V3ObservationMethod._0212)
+      return "0212";
+    if (code == V3ObservationMethod._0213)
+      return "0213";
+    if (code == V3ObservationMethod._0214)
+      return "0214";
+    if (code == V3ObservationMethod._0215)
+      return "0215";
+    if (code == V3ObservationMethod._0216)
+      return "0216";
+    if (code == V3ObservationMethod._0217)
+      return "0217";
+    if (code == V3ObservationMethod._0218)
+      return "0218";
+    if (code == V3ObservationMethod._0219)
+      return "0219";
+    if (code == V3ObservationMethod._0220)
+      return "0220";
+    if (code == V3ObservationMethod._0221)
+      return "0221";
+    if (code == V3ObservationMethod._0222)
+      return "0222";
+    if (code == V3ObservationMethod._0223)
+      return "0223";
+    if (code == V3ObservationMethod._0224)
+      return "0224";
+    if (code == V3ObservationMethod._0225)
+      return "0225";
+    if (code == V3ObservationMethod._0226)
+      return "0226";
+    if (code == V3ObservationMethod._0227)
+      return "0227";
+    if (code == V3ObservationMethod._0228)
+      return "0228";
+    if (code == V3ObservationMethod._0229)
+      return "0229";
+    if (code == V3ObservationMethod._0230)
+      return "0230";
+    if (code == V3ObservationMethod._0231)
+      return "0231";
+    if (code == V3ObservationMethod._0232)
+      return "0232";
+    if (code == V3ObservationMethod._0233)
+      return "0233";
+    if (code == V3ObservationMethod._0234)
+      return "0234";
+    if (code == V3ObservationMethod._0235)
+      return "0235";
+    if (code == V3ObservationMethod._0236)
+      return "0236";
+    if (code == V3ObservationMethod._0237)
+      return "0237";
+    if (code == V3ObservationMethod._0238)
+      return "0238";
+    if (code == V3ObservationMethod._0239)
+      return "0239";
+    if (code == V3ObservationMethod._0243)
+      return "0243";
+    if (code == V3ObservationMethod._0244)
+      return "0244";
+    if (code == V3ObservationMethod._0247)
+      return "0247";
+    if (code == V3ObservationMethod._0248)
+      return "0248";
+    if (code == V3ObservationMethod._0249)
+      return "0249";
+    if (code == V3ObservationMethod._0250)
+      return "0250";
+    if (code == V3ObservationMethod._0251)
+      return "0251";
+    if (code == V3ObservationMethod._0252)
+      return "0252";
+    if (code == V3ObservationMethod._0253)
+      return "0253";
+    if (code == V3ObservationMethod._0254)
+      return "0254";
+    if (code == V3ObservationMethod._0255)
+      return "0255";
+    if (code == V3ObservationMethod._0256)
+      return "0256";
+    if (code == V3ObservationMethod._0257)
+      return "0257";
+    if (code == V3ObservationMethod._0258)
+      return "0258";
+    if (code == V3ObservationMethod._0259)
+      return "0259";
+    if (code == V3ObservationMethod._0260)
+      return "0260";
+    if (code == V3ObservationMethod._0261)
+      return "0261";
+    if (code == V3ObservationMethod._0262)
+      return "0262";
+    if (code == V3ObservationMethod._0263)
+      return "0263";
+    if (code == V3ObservationMethod._0264)
+      return "0264";
+    if (code == V3ObservationMethod._0265)
+      return "0265";
+    if (code == V3ObservationMethod._0266)
+      return "0266";
+    if (code == V3ObservationMethod._0267)
+      return "0267";
+    if (code == V3ObservationMethod._0268)
+      return "0268";
+    if (code == V3ObservationMethod._0269)
+      return "0269";
+    if (code == V3ObservationMethod._0270)
+      return "0270";
+    if (code == V3ObservationMethod._0271)
+      return "0271";
+    if (code == V3ObservationMethod._0280)
+      return "0280";
+    if (code == V3ObservationMethod._0240)
+      return "0240";
+    if (code == V3ObservationMethod._0241)
+      return "0241";
+    if (code == V3ObservationMethod._0242)
+      return "0242";
+    if (code == V3ObservationMethod._0272)
+      return "0272";
+    if (code == V3ObservationMethod._0245)
+      return "0245";
+    if (code == V3ObservationMethod._0246)
+      return "0246";
+    if (code == V3ObservationMethod._0273)
+      return "0273";
+    if (code == V3ObservationMethod._0274)
+      return "0274";
+    if (code == V3ObservationMethod._0275)
+      return "0275";
+    if (code == V3ObservationMethod._0275A)
+      return "0275a";
+    if (code == V3ObservationMethod._0276)
+      return "0276";
+    if (code == V3ObservationMethod._0277)
+      return "0277";
+    if (code == V3ObservationMethod._0278)
+      return "0278";
+    if (code == V3ObservationMethod._0279)
+      return "0279";
+    if (code == V3ObservationMethod._0127)
+      return "0127";
+    return "?";
+  }
+
+    public String toSystem(V3ObservationMethod code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationValue.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationValue.java
new file mode 100644
index 00000000000..47ff090150b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationValue.java
@@ -0,0 +1,2288 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ObservationValue {
+
+        /**
+         * Codes specify the category of observation, evidence, or document used to assess for services, e.g., discharge planning, or to establish eligibility for coverage under a policy or program. The type of evidence is coded as observation values.
+         */
+        _ACTCOVERAGEASSESSMENTOBSERVATIONVALUE, 
+        /**
+         * Code specifying financial indicators used to assess or establish eligibility for coverage under a policy or program; e.g., pay stub; tax or income document; asset document; living expenses.
+         */
+        _ACTFINANCIALSTATUSOBSERVATIONVALUE, 
+        /**
+         * Codes specifying asset indicators used to assess or establish eligibility for coverage under a policy or program.
+         */
+        ASSET, 
+        /**
+         * Indicator of annuity ownership or status as beneficiary.
+         */
+        ANNUITY, 
+        /**
+         * Indicator of real property ownership, e.g., deed or real estate contract.
+         */
+        PROP, 
+        /**
+         * Indicator of retirement investment account ownership.
+         */
+        RETACCT, 
+        /**
+         * Indicator of status as trust beneficiary.
+         */
+        TRUST, 
+        /**
+         * Code specifying income indicators used to assess or establish eligibility for coverage under a policy or program; e.g., pay or pension check, child support payments received or provided, and taxes paid.
+         */
+        INCOME, 
+        /**
+         * Indicator of child support payments received or provided.
+         */
+        CHILD, 
+        /**
+         * Indicator of disability income replacement payment.
+         */
+        DISABL, 
+        /**
+         * Indicator of investment income, e.g., dividend check, annuity payment; real estate rent, investment divestiture proceeds; trust or endowment check.
+         */
+        INVEST, 
+        /**
+         * Indicator of paid employment, e.g., letter of hire, contract, employer letter; copy of pay check or pay stub.
+         */
+        PAY, 
+        /**
+         * Indicator of retirement payment, e.g., pension check.
+         */
+        RETIRE, 
+        /**
+         * Indicator of spousal or partner support payments received or provided; e.g., alimony payment; support stipulations in a divorce settlement.
+         */
+        SPOUSAL, 
+        /**
+         * Indicator of income supplement, e.g., gifting, parental income support; stipend, or grant.
+         */
+        SUPPLE, 
+        /**
+         * Indicator of tax obligation or payment, e.g., statement of taxable income.
+         */
+        TAX, 
+        /**
+         * Codes specifying living expense indicators used to assess or establish eligibility for coverage under a policy or program.
+         */
+        LIVEXP, 
+        /**
+         * Indicator of clothing expenses.
+         */
+        CLOTH, 
+        /**
+         * Indicator of transportation expenses.
+         */
+        FOOD, 
+        /**
+         * Indicator of health expenses; including medication costs, health service costs, financial participations, and health coverage premiums.
+         */
+        HEALTH, 
+        /**
+         * Indicator of housing expense, e.g., household appliances, fixtures, furnishings, and maintenance and repairs.
+         */
+        HOUSE, 
+        /**
+         * Indicator of legal expenses.
+         */
+        LEGAL, 
+        /**
+         * Indicator of mortgage amount, interest, and payments.
+         */
+        MORTG, 
+        /**
+         * Indicator of rental or lease payments.
+         */
+        RENT, 
+        /**
+         * Indicator of transportation expenses.
+         */
+        SUNDRY, 
+        /**
+         * Indicator of transportation expenses, e.g., vehicle payments, vehicle insurance, vehicle fuel, and vehicle maintenance and repairs.
+         */
+        TRANS, 
+        /**
+         * Indicator of transportation expenses.
+         */
+        UTIL, 
+        /**
+         * Code specifying eligibility indicators used to assess or establish eligibility for coverage under a policy or program eligibility status, e.g., certificates of creditable coverage; student enrollment; adoption, marriage or birth certificate.
+         */
+        ELSTAT, 
+        /**
+         * Indicator of adoption.
+         */
+        ADOPT, 
+        /**
+         * Indicator of birth.
+         */
+        BTHCERT, 
+        /**
+         * Indicator of creditable coverage.
+         */
+        CCOC, 
+        /**
+         * Indicator of driving status.
+         */
+        DRLIC, 
+        /**
+         * Indicator of foster child status.
+         */
+        FOSTER, 
+        /**
+         * Indicator of status as covered member under a policy or program, e.g., member id card or coverage document.
+         */
+        MEMBER, 
+        /**
+         * Indicator of military status.
+         */
+        MIL, 
+        /**
+         * Indicator of marriage status.
+         */
+        MRGCERT, 
+        /**
+         * Indicator of citizenship.
+         */
+        PASSPORT, 
+        /**
+         * Indicator of student status.
+         */
+        STUDENRL, 
+        /**
+         * Code specifying non-clinical indicators related to health status used to assess or establish eligibility for coverage under a policy or program, e.g., pregnancy, disability, drug use, mental health issues.
+         */
+        HLSTAT, 
+        /**
+         * Indication of disability.
+         */
+        DISABLE, 
+        /**
+         * Indication of drug use.
+         */
+        DRUG, 
+        /**
+         * Indication of IV drug use .
+         */
+        IVDRG, 
+        /**
+         * Non-clinical report of pregnancy.
+         */
+        PGNT, 
+        /**
+         * Code specifying observations related to living dependency, such as dependent upon spouse for activities of daily living.
+         */
+        LIVDEP, 
+        /**
+         * Continued living in private residence requires functional and health care assistance from one or more relatives.
+         */
+        RELDEP, 
+        /**
+         * Continued living in private residence requires functional and health care assistance from spouse or life partner.
+         */
+        SPSDEP, 
+        /**
+         * Continued living in private residence requires functional and health care assistance from one or more unrelated persons.
+         */
+        URELDEP, 
+        /**
+         * Code specifying observations related to living situation for a person in a private residence.
+         */
+        LIVSIT, 
+        /**
+         * Living alone.  Maps to PD1-2   Living arrangement   (IS)   00742 [A]
+         */
+        ALONE, 
+        /**
+         * Living with one or more dependent children requiring moderate supervision.
+         */
+        DEPCHD, 
+        /**
+         * Living with disabled spouse requiring functional and health care assistance
+         */
+        DEPSPS, 
+        /**
+         * Living with one or more dependent children requiring intensive supervision
+         */
+        DEPYGCHD, 
+        /**
+         * Living with family. Maps to PD1-2   Living arrangement   (IS)   00742 [F]
+         */
+        FAM, 
+        /**
+         * Living with one or more relatives. Maps to PD1-2   Living arrangement   (IS)   00742 [R]
+         */
+        RELAT, 
+        /**
+         * Living only with spouse or life partner. Maps to PD1-2   Living arrangement   (IS)   00742 [S]
+         */
+        SPS, 
+        /**
+         * Living with one or more unrelated persons.
+         */
+        UNREL, 
+        /**
+         * Code specifying observations or indicators related to socio-economic status used to assess to assess for services, e.g., discharge planning, or to establish eligibility for coverage under a policy or program.
+         */
+        SOECSTAT, 
+        /**
+         * Indication of abuse victim.
+         */
+        ABUSE, 
+        /**
+         * Indication of status as homeless.
+         */
+        HMLESS, 
+        /**
+         * Indication of status as illegal immigrant.
+         */
+        ILGIM, 
+        /**
+         * Indication of status as incarcerated.
+         */
+        INCAR, 
+        /**
+         * Indication of probation status.
+         */
+        PROB, 
+        /**
+         * Indication of refugee status.
+         */
+        REFUG, 
+        /**
+         * Indication of unemployed status.
+         */
+        UNEMPL, 
+        /**
+         * Indicates the result of a particular allergy test.  E.g. Negative, Mild, Moderate, Severe
+         */
+        _ALLERGYTESTVALUE, 
+        /**
+         * Description:Patient exhibits no reaction to the challenge agent.
+         */
+        A0, 
+        /**
+         * Description:Patient exhibits a minimal reaction to the challenge agent.
+         */
+        A1, 
+        /**
+         * Description:Patient exhibits a mild reaction to the challenge agent.
+         */
+        A2, 
+        /**
+         * Description:Patient exhibits moderate reaction to the challenge agent.
+         */
+        A3, 
+        /**
+         * Description:Patient exhibits a severe reaction to the challenge agent.
+         */
+        A4, 
+        /**
+         * Observation values that communicate the method used in a quality measure to combine the component measure results included in an composite measure.
+         */
+        _COMPOSITEMEASURESCORING, 
+        /**
+         * Code specifying that the measure uses all-or-nothing scoring. All-or-nothing scoring places an individual in the numerator of the composite measure if and only if they are in the numerator of all component measures in which they are in the denominator.
+         */
+        ALLORNONESCR, 
+        /**
+         * Code specifying that the measure uses linear scoring. Linear scoring computes the fraction of component measures in which the individual appears in the numerator, giving equal weight to each component measure.
+         */
+        LINEARSCR, 
+        /**
+         * Code specifying that the measure uses opportunity-based scoring. In opportunity-based scoring the measure score is determined by combining the denominator and numerator of each component measure to determine an overall composite score.
+         */
+        OPPORSCR, 
+        /**
+         * Code specifying that the measure uses weighted scoring. Weighted scoring assigns a factor to each component measure to weight that measure's contribution to the overall score.
+         */
+        WEIGHTSCR, 
+        /**
+         * Description:Coded observation values for coverage limitations, for e.g., types of claims or types of parties covered under a policy or program.
+         */
+        _COVERAGELIMITOBSERVATIONVALUE, 
+        /**
+         * Description:Coded observation values for types of covered parties under a policy or program based on their personal relationships or employment status.
+         */
+        _COVERAGELEVELOBSERVATIONVALUE, 
+        /**
+         * Description:Child over an age as specified by coverage policy or program, e.g., student, differently abled, and income dependent.
+         */
+        ADC, 
+        /**
+         * Description:Dependent biological, adopted, foster child as specified by coverage policy or program.
+         */
+        CHD, 
+        /**
+         * Description:Person requiring functional and/or financial assistance from another person as specified by coverage policy or program.
+         */
+        DEP, 
+        /**
+         * Description:Persons registered as a family unit in a domestic partner registry as specified by law and by coverage policy or program.
+         */
+        DP, 
+        /**
+         * Description:An individual employed by an employer who receive remuneration in wages, salary, commission, tips, piece-rates, or pay-in-kind through the employeraTMs payment system (i.e., not a contractor) as specified by coverage policy or program.
+         */
+        ECH, 
+        /**
+         * Description:As specified by coverage policy or program.
+         */
+        FLY, 
+        /**
+         * Description:Person as specified by coverage policy or program.
+         */
+        IND, 
+        /**
+         * Description:A pair of people of the same gender who live together as a family as specified by coverage policy or program, e.g., Naomi and Ruth from the Book of Ruth; Socrates and Alcibiades
+         */
+        SSP, 
+        /**
+         * A clinical judgment as to the worst case result of a future exposure (including substance administration). When the worst case result is assessed to have a life-threatening or organ system threatening potential, it is considered to be of high criticality.
+         */
+        _CRITICALITYOBSERVATIONVALUE, 
+        /**
+         * Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.
+         */
+        CRITH, 
+        /**
+         * Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.
+         */
+        CRITL, 
+        /**
+         * Unable to assess the worst case result of a future exposure.
+         */
+        CRITU, 
+        /**
+         * Description: The domain contains genetic analysis specific observation values, e.g. Homozygote, Heterozygote, etc.
+         */
+        _GENETICOBSERVATIONVALUE, 
+        /**
+         * Description: An individual having different alleles at one or more loci regarding a specific character
+         */
+        HOMOZYGOTE, 
+        /**
+         * Observation values used to indicate the type of scoring (e.g. proportion, ratio) used by a health quality measure.
+         */
+        _OBSERVATIONMEASURESCORING, 
+        /**
+         * A measure in which either short-term cross-section or long-term longitudinal analysis is performed over a group of subjects defined by a set of common properties or defining characteristics (e.g., Male smokers between the ages of 40 and 50 years, exposure to treatment, exposure duration).
+         */
+        COHORT, 
+        /**
+         * A measure score in which each individual value for the measure can fall anywhere along a continuous scale (e.g., mean time to thrombolytics which aggregates the time in minutes from a case presenting with chest pain to the time of administration of thrombolytics).
+         */
+        CONTVAR, 
+        /**
+         * A score derived by dividing the number of cases that meet a criterion for quality (the numerator) by the number of eligible cases within a given time frame (the denominator) where the numerator cases are a subset of the denominator cases (e.g., percentage of eligible women with a mammogram performed in the last year).
+         */
+        PROPOR, 
+        /**
+         * A score that may have a value of zero or greater that is derived by dividing a count of one type of data by a count of another type of data (e.g., the number of patients with central lines who develop infection divided by the number of central line days).
+         */
+        RATIO, 
+        /**
+         * Observation values used to indicate what kind of health quality measure is used.
+         */
+        _OBSERVATIONMEASURETYPE, 
+        /**
+         * A measure that is composed from one or more other measures and indicates an overall summary of those measures.
+         */
+        COMPOSITE, 
+        /**
+         * A measure related to the efficiency of medical treatment.
+         */
+        EFFICIENCY, 
+        /**
+         * A measure related to the level of patient engagement or patient experience of care.
+         */
+        EXPERIENCE, 
+        /**
+         * A measure that indicates the result of the performance (or non-performance) of a function or process.
+         */
+        OUTCOME, 
+        /**
+         * A measure which focuses on a process which leads to a certain outcome, meaning that a scientific basis exists for believing that the process, when executed well, will increase the probability of achieving a desired outcome.
+         */
+        PROCESS, 
+        /**
+         * A measure related to the extent of use of clinical resources or cost of care.
+         */
+        RESOURCE, 
+        /**
+         * A measure related to the structure of patient care.
+         */
+        STRUCTURE, 
+        /**
+         * Observation values used to assert various populations that a subject falls into.
+         */
+        _OBSERVATIONPOPULATIONINCLUSION, 
+        /**
+         * Patients who should be removed from the eMeasure population and denominator before determining if numerator criteria are met. Denominator exclusions are used in proportion and ratio measures to help narrow the denominator.
+         */
+        DENEX, 
+        /**
+         * Denominator exceptions are those conditions that should remove a patient, procedure or unit of measurement from the denominator only if the numerator criteria are not met. Denominator exceptions allow for adjustment of the calculated score for those providers with higher risk populations. Denominator exceptions are used only in proportion eMeasures. They are not appropriate for ratio or continuous variable eMeasures.  Denominator exceptions allow for the exercise of clinical judgment and should be specifically defined where capturing the information in a structured manner fits the clinical workflow. Generic denominator exception reasons used in proportion eMeasures fall into three general categories:
+
+                        
+                           Medical reasons
+                           Patient reasons
+                           System reasons
+         */
+        DENEXCEP, 
+        /**
+         * It can be the same as the initial patient population or a subset of the initial patient population to further constrain the population for the purpose of the eMeasure. Different measures within an eMeasure set may have different Denominators. Continuous Variable eMeasures do not have a Denominator, but instead define a Measure Population.
+         */
+        DENOM, 
+        /**
+         * The initial population refers to all entities to be evaluated by a specific quality measure who share a common set of specified characteristics within a specific measurement set to which a given measure belongs.
+         */
+        IP, 
+        /**
+         * The initial patient population refers to all patients to be evaluated by a specific quality measure who share a common set of specified characteristics within a specific measurement set to which a given measure belongs. Details often include information based upon specific age groups, diagnoses, diagnostic and procedure codes, and enrollment periods.
+         */
+        IPP, 
+        /**
+         * Measure population is used only in continuous variable eMeasures. It is a narrative description of the eMeasure population. 
+(e.g., all patients seen in the Emergency Department during the measurement period).
+         */
+        MSRPOPL, 
+        /**
+         * Numerators are used in proportion and ratio eMeasures. In proportion measures the numerator criteria are the processes or outcomes expected for each patient, procedure, or other unit of measurement defined in the denominator. In ratio measures the numerator is related, but not directly derived from the denominator (e.g., a numerator listing the number of central line blood stream infections and a denominator indicating the days per thousand of central line usage in a specific time period).
+         */
+        NUMER, 
+        /**
+         * Numerator Exclusions are used only in ratio eMeasures to define instances that should not be included in the numerator data. (e.g., if the number of central line blood stream infections per 1000 catheter days were to exclude infections with a specific bacterium, that bacterium would be listed as a numerator exclusion.)
+         */
+        NUMEX, 
+        /**
+         * PartialCompletionScale
+         */
+        _PARTIALCOMPLETIONSCALE, 
+        /**
+         * Value for Act.partialCompletionCode attribute that implies 81-99% completion
+         */
+        G, 
+        /**
+         * Value for Act.partialCompletionCode attribute that implies 61-80% completion
+         */
+        LE, 
+        /**
+         * Value for Act.partialCompletionCode attribute that implies 41-60% completion
+         */
+        ME, 
+        /**
+         * Value for Act.partialCompletionCode attribute that implies 1-20% completion
+         */
+        MI, 
+        /**
+         * Value for Act.partialCompletionCode attribute that implies 0% completion
+         */
+        N, 
+        /**
+         * Value for Act.partialCompletionCode attribute that implies 21-40% completion
+         */
+        S, 
+        /**
+         * Observation values used to indicate security observation metadata.
+         */
+        _SECURITYOBSERVATIONVALUE, 
+        /**
+         * Abstract security observation values used to indicate security integrity metadata.
+
+                        
+                           Examples: Codes conveying integrity status, integrity confidence, and provenance.
+         */
+        _SECINTOBV, 
+        /**
+         * Abstract security metadata observation values used to indicate mechanism used for authorized alteration of an IT resource (data, information object, service, or system capability)
+         */
+        _SECALTINTOBV, 
+        /**
+         * Security metadata observation values used to indicate the use of a more abstract version of the content, e.g., replacing exact value of an age or date field with a range, or remove the left digits of a credit card number or SSN.
+         */
+        ABSTRED, 
+        /**
+         * Security metadata observation values used to indicate the use of an algorithmic combination of actual values with the result of an aggregate function, e.g., average, sum, or count in order to limit disclosure of an IT resource (data, information object, service, or system capability) to the minimum necessary.
+         */
+        AGGRED, 
+        /**
+         * Security metadata observation value conveying the alteration integrity of an IT resource (data, information object, service, or system capability) by used to indicate the mechanism by which software systems can strip portions of the resource that could allow the identification of the source of the information or the information subject.  No key to relink the data is retained.
+         */
+        ANONYED, 
+        /**
+         * Security metadata observation value used to indicate that the IT resource semantic content has been transformed from one encoding to another.
+
+                        
+                           Usage Note: "MAP" code does not indicate the semantic fidelity of the transformed content.
+
+                        To indicate semantic fidelity for maps of HL7 to other code systems, this security alteration integrity observation may be further specified using an Act valued with Value Set: MapRelationship (2.16.840.1.113883.1.11.11052).
+
+                        Semantic fidelity of the mapped IT Resource may also be indicated using a SecurityIntegrityConfidenceObservation.
+         */
+        MAPPED, 
+        /**
+         * Security metadata observation value conveying the alteration integrity of an IT resource (data, information object, service, or system capability) by indicating the mechanism by which software systems can make data unintelligible (that is, as unreadable and unusable by algorithmically transforming plaintext into ciphertext) such that it can only be accessed or used by authorized users.  An authorized user may be provided a key to decrypt per license or "shared secret".
+
+                        
+                           Usage Note: "MASKED" may be used, per applicable policy, as a flag to indicate to a user or receiver that some portion of an IT resource has been further encrypted, and may be accessed only by an authorized user or receiver to which a decryption key is provided.
+         */
+        MASKED, 
+        /**
+         * Security metadata observation value conveying the alteration integrity of an IT resource (data, information object, service, or system capability), by indicating the mechanism by which software systems can strip portions of the resource that could allow the identification of the source of the information or the information subject.  Custodian may retain a key to relink data necessary to reidentify the information subject.
+
+                        
+                           Rationale: Personal data which has been processed to make it impossible to know whose data it is. Used particularly for secondary use of health data. In some cases, it may be possible for authorized individuals to restore the identity of the individual, e.g.,for public health case management.  Based on ISO/TS 25237:2008 Health informatics—Pseudonymization
+         */
+        PSEUDED, 
+        /**
+         * Security metadata observation value used to indicate the mechanism by which software systems can filter an IT resource (data, information object, service, or system capability) to remove any portion of the resource that is not authorized to be access, used, or disclosed.
+
+                        
+                           Usage Note: "REDACTED" may be used, per applicable policy, as a flag to indicate to a user or receiver that some portion of an IT resource has filtered and not included in the content accessed or received.
+         */
+        REDACTED, 
+        /**
+         * Metadata observation used to indicate that some information has been removed from the source object when the view this object contains was constructed because of configuration options when the view was created. The content may not be suitable for use as the basis of a record update
+
+                        
+                           Usage Note: This is not suitable to be used when information is removed for security reasons - see the code REDACTED for this use.
+         */
+        SUBSETTED, 
+        /**
+         * Security metadata observation value used to indicate that the IT resource syntax has been transformed from one syntactical representation to another.  
+
+                        
+                           Usage Note: "SYNTAC" code does not indicate the syntactical correctness of the syntactically transformed IT resource.
+         */
+        SYNTAC, 
+        /**
+         * Security metadata observation value used to indicate that the IT resource has been translated from one human language to another.  
+
+                        
+                           Usage Note: "TRSLT" does not indicate the fidelity of the translation or the languages translated.
+
+                        The fidelity of the IT Resource translation may be indicated using a SecurityIntegrityConfidenceObservation.
+
+                        To indicate languages, use the Value Set:HumanLanguage (2.16.840.1.113883.1.11.11526)
+         */
+        TRSLT, 
+        /**
+         * Security metadata observation value conveying the alteration integrity of an IT resource (data, information object, service, or system capability)  which indicates that the resource only retains versions of an IT resource  for access and use per applicable policy
+
+                        
+                           Usage Note: When this code is used, expectation is that the system has removed historical versions of the data that falls outside the time period deemed to be the effective time of the applicable version.
+         */
+        VERSIONED, 
+        /**
+         * Abstract security observation values used to indicate data integrity metadata.
+
+                        
+                           Examples: Codes conveying the mechanism used to preserve the accuracy and consistency of an IT resource such as a digital signature and a cryptographic hash function.
+         */
+        _SECDATINTOBV, 
+        /**
+         * Security metadata observation value used to indicate the mechanism by which software systems can establish that data was not modified in transit.
+
+                        
+                           Rationale: This definition is intended to align with the ISO 22600-2 3.3.19 definition of cryptographic checkvalue: Information which is derived by performing a cryptographic transformation (see cryptography) on the data unit.  The derivation of the checkvalue may be performed in one or more steps and is a result of a mathematical function of the key and a data unit. It is usually used to check the integrity of a data unit.
+
+                        
+                           Examples: 
+                        
+
+                        
+                           SHA-1
+                           SHA-2 (Secure Hash Algorithm)
+         */
+        CRYTOHASH, 
+        /**
+         * Security metadata observation value used to indicate the mechanism by which software systems use digital signature to establish that data has not been modified.  
+
+                        
+                           Rationale: This definition is intended to align with the ISO 22600-2 3.3.26 definition of digital signature:  Data appended to, or a cryptographic transformation (see cryptography) of, a data unit that allows a recipient of the data unit to prove the source and integrity of the data unit and protect against forgery e.g., by the recipient.
+         */
+        DIGSIG, 
+        /**
+         * Abstract security observation value used to indicate integrity confidence metadata.
+
+                        
+                           Examples: Codes conveying the level of reliability and trustworthiness of an IT resource.
+         */
+        _SECINTCONOBV, 
+        /**
+         * Security metadata observation value used to indicate that the veracity or trustworthiness of an IT resource (data, information object, service, or system capability) for a specified purpose of use is perceived to be or deemed by policy to be very high.
+         */
+        HRELIABLE, 
+        /**
+         * Security metadata observation value used to indicate that the veracity or trustworthiness of an IT resource (data, information object, service, or system capability) for a specified purpose of use is perceived to be or deemed by policy to be adequate.
+         */
+        RELIABLE, 
+        /**
+         * Security metadata observation value used to indicate that the veracity or trustworthiness of an IT resource (data, information object, service, or system capability) for a specified purpose of use is perceived to be or deemed by policy to be uncertain.
+         */
+        UNCERTREL, 
+        /**
+         * Security metadata observation value used to indicate that the veracity or trustworthiness of an IT resource (data, information object, service, or system capability) for a specified purpose of use is perceived to be or deemed by policy to be inadequate.
+         */
+        UNRELIABLE, 
+        /**
+         * Abstract security metadata observation value used to indicate the provenance of an IT resource (data, information object, service, or system capability).
+
+                        
+                           Examples: Codes conveying the provenance metadata about the entity reporting an IT resource.
+         */
+        _SECINTPRVOBV, 
+        /**
+         * Abstract security provenance metadata observation value used to indicate the entity that asserted an IT resource (data, information object, service, or system capability).
+
+                        
+                           Examples: Codes conveying the provenance metadata about the entity asserting the resource.
+         */
+        _SECINTPRVABOBV, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a clinician.
+         */
+        CLINAST, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a device.
+         */
+        DEVAST, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a healthcare professional.
+         */
+        HCPAST, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a patient acquaintance.
+         */
+        PACQAST, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a patient.
+         */
+        PATAST, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a payer.
+         */
+        PAYAST, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a professional.
+         */
+        PROAST, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a substitute decision maker.
+         */
+        SDMAST, 
+        /**
+         * Abstract security provenance metadata observation value used to indicate the entity that reported the resource (data, information object, service, or system capability).
+
+                        
+                           Examples: Codes conveying the provenance metadata about the entity reporting an IT resource.
+         */
+        _SECINTPRVRBOBV, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a clinician.
+         */
+        CLINRPT, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a device.
+         */
+        DEVRPT, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a healthcare professional.
+         */
+        HCPRPT, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a patient acquaintance.
+         */
+        PACQRPT, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a patient.
+         */
+        PATRPT, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a payer.
+         */
+        PAYRPT, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a professional.
+         */
+        PRORPT, 
+        /**
+         * Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a substitute decision maker.
+         */
+        SDMRPT, 
+        /**
+         * Observation value used to indicate aspects of trust applicable to an IT resource (data, information object, service, or system capability).
+         */
+        SECTRSTOBV, 
+        /**
+         * Values for security trust accreditation metadata observation made about the formal declaration by an authority or neutral third party that validates the technical, security, trust, and business practice conformance of Trust Agents to facilitate security, interoperability, and trust among participants within a security domain or trust framework.
+         */
+        TRSTACCRDOBV, 
+        /**
+         * Values for security trust agreement metadata observation made about privacy and security requirements with which a security domain must comply. [ISO IEC 10181-1]
+[ISO IEC 10181-1]
+         */
+        TRSTAGREOBV, 
+        /**
+         * Values for security trust certificate metadata observation made about a set of security-relevant data issued by a security authority or trusted third party, together with security information which is used to provide the integrity and data origin authentication services for an IT resource (data, information object, service, or system capability). [Based on ISO IEC 10181-1]
+
+                        For example, a Certificate Policy (CP), which is a named set of rules that indicates the applicability of a certificate to a particular community and/or class of application with common security requirements.  A particular Certificate Policy might indicate the applicability of a type of certificate to the authentication of electronic data interchange transactions for the trading of goods within a given price range.  Another example is Cross Certification with Federal Bridge.
+         */
+        TRSTCERTOBV, 
+        /**
+         * Values for security trust assurance metadata observation made about the digital quality or reliability of a trust assertion, activity, capability, information exchange, mechanism, process, or protocol.
+         */
+        TRSTLOAOBV, 
+        /**
+         * The value assigned as the indicator of the digital quality or reliability of the verification and validation process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2]
+
+                        For example, the degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies]
+         */
+        LOAAN, 
+        /**
+         * Indicator of low digital quality or reliability of the digital reliability of the verification and validation process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2] 
+
+                        The degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies] 
+
+                        Low authentication level of assurance indicates that the relying party may have little or no confidence in the asserted identity's validity. Level 1 requires little or no confidence in the asserted identity. No identity proofing is required at this level, but the authentication mechanism should provide some assurance that the same claimant is accessing the protected transaction or data. A wide range of available authentication technologies can be employed and any of the token methods of Levels 2, 3, or 4, including Personal Identification Numbers (PINs), may be used. To be authenticated, the claimant must prove control of the token through a secure authentication protocol. At Level 1, long-term shared authentication secrets may be revealed to verifiers.  Assertions issued about claimants as a result of a successful authentication are either cryptographically authenticated by relying parties (using approved methods) or are obtained directly from a trusted party via a secure authentication protocol.   [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAN1, 
+        /**
+         * Indicator of basic digital quality or reliability of the digital reliability of the verification and validation process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2] 
+
+                        The degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies]
+
+                        Basic authentication level of assurance indicates that the relying party may have some confidence in the asserted identity's validity. Level 2 requires confidence that the asserted identity is accurate. Level 2 provides for single-factor remote network authentication, including identity-proofing requirements for presentation of identifying materials or information. A wide range of available authentication technologies can be employed, including any of the token methods of Levels 3 or 4, as well as passwords. Successful authentication requires that the claimant prove through a secure authentication protocol that the claimant controls the token.  Eavesdropper, replay, and online guessing attacks are prevented.  
+Long-term shared authentication secrets, if used, are never revealed to any party except the claimant and verifiers operated by the CSP; however, session (temporary) shared secrets may be provided to independent verifiers by the CSP. Approved cryptographic techniques are required. Assertions issued about claimants as a result of a successful authentication are either cryptographically authenticated by relying parties (using approved methods) or are obtained directly from a trusted party via a secure authentication protocol.   [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAN2, 
+        /**
+         * Indicator of medium digital quality or reliability of the digital reliability of verification and validation of the process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2] 
+
+                        The degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies] 
+
+                        Medium authentication level of assurance indicates that the relying party may have high confidence in the asserted identity's validity.  Level 3 is appropriate for transactions that need high confidence in the accuracy of the asserted identity. Level 3 provides multifactor remote network authentication. At this level, identity-proofing procedures require verification of identifying materials and information. Authentication is based on proof of possession of a key or password through a cryptographic protocol. Cryptographic strength mechanisms should protect the primary authentication token (a cryptographic key) against compromise by the protocol threats, including eavesdropper, replay, online guessing, verifier impersonation, and man-in-the-middle attacks. A minimum of two authentication factors is required. Three kinds of tokens may be used:
+
+                        
+                           "soft" cryptographic token, which has the key stored on a general-purpose computer, 
+                           "hard" cryptographic token, which has the key stored on a special hardware device, and 
+                           "one-time password" device token, which has symmetric key stored on a personal hardware device that is a cryptographic module validated at FIPS 140-2 Level 1 or higher. Validation testing of cryptographic modules and algorithms for conformance to Federal Information Processing Standard (FIPS) 140-2, Security Requirements for Cryptographic Modules, is managed by NIST.
+                        
+                        Authentication requires that the claimant prove control of the token through a secure authentication protocol. The token must be unlocked with a password or biometric representation, or a password must be used in a secure authentication protocol, to establish two-factor authentication. Long-term shared authentication secrets, if used, are never revealed to any party except the claimant and verifiers operated directly by the CSP; however, session (temporary) shared secrets may be provided to independent verifiers by the CSP. Approved cryptographic techniques are used for all operations.  Assertions issued about claimants as a result of a successful authentication are either cryptographically authenticated by relying parties (using approved methods) or are obtained directly from a trusted party via a secure authentication protocol.    [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAN3, 
+        /**
+         * Indicator of high digital quality or reliability of the digital reliability of the verification and validation process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2] 
+
+                        The degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies]
+
+                        High authentication level of assurance indicates that the relying party may have very high confidence in the asserted identity's validity. Level 4 is for transactions that need very high confidence in the accuracy of the asserted identity. Level 4 provides the highest practical assurance of remote network authentication. Authentication is based on proof of possession of a key through a cryptographic protocol. This level is similar to Level 3 except that only “hard� cryptographic tokens are allowed, cryptographic module validation requirements are strengthened, and subsequent critical data transfers must be authenticated via a key that is bound to the authentication process. The token should be a hardware cryptographic module validated at FIPS 140-2 Level 2 or higher overall with at least FIPS 140-2 Level 3 physical security. This level requires a physical token, which cannot readily be copied, and operator authentication at Level 2 and higher, and ensures good, two-factor remote authentication.
+
+                        Level 4 requires strong cryptographic authentication of all parties and all sensitive data transfers between the parties. Either public key or symmetric key technology may be used. Authentication requires that the claimant prove through a secure authentication protocol that the claimant controls the token. Eavesdropper, replay, online guessing, verifier impersonation, and man-in-the-middle attacks are prevented. Long-term shared authentication secrets, if used, are never revealed to any party except the claimant and verifiers operated directly by the CSP; however, session (temporary) shared secrets may be provided to independent verifiers by the CSP. Strong approved cryptographic techniques are used for all operations. All sensitive data transfers are cryptographically authenticated using keys bound to the authentication process.   [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAN4, 
+        /**
+         * The value assigned as the indicator of the digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]
+         */
+        LOAAP, 
+        /**
+         * Indicator of the low digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]
+
+                        Low authentication process level of assurance indicates that (1) long-term shared authentication secrets may be revealed to verifiers; and (2) assertions and assertion references require protection from manufacture/modification and reuse attacks.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAP1, 
+        /**
+         * Indicator of the basic digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]
+
+                        Basic authentication process level of assurance indicates that long-term shared authentication secrets are never revealed to any other party except Credential Service Provider (CSP).  Sessions (temporary) shared secrets may be provided to independent verifiers by CSP. Long-term shared authentication secrets, if used, are never revealed to any other party except Verifiers operated by the Credential Service Provider (CSP); however, session (temporary) shared secrets may be provided to independent Verifiers by the CSP. In addition to Level 1 requirements, assertions are resistant to disclosure, redirection, capture and substitution attacks. Approved cryptographic techniques are required.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAP2, 
+        /**
+         * Indicator of the medium digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]
+
+                        Medium authentication process level of assurance indicates that the token can be unlocked with password, biometric, or uses a secure multi-token authentication protocol to establish two-factor authentication.  Long-term shared authentication secrets are never revealed to any party except the Claimant and Credential Service Provider (CSP).
+
+                        Authentication requires that the Claimant prove, through a secure authentication protocol, that he or she controls the token. The Claimant unlocks the token with a password or biometric, or uses a secure multi-token authentication protocol to establish two-factor authentication (through proof of possession of a physical or software token in combination with some memorized secret knowledge). Long-term shared authentication secrets, if used, are never revealed to any party except the Claimant and Verifiers operated directly by the CSP; however, session (temporary) shared secrets may be provided to independent Verifiers by the CSP. In addition to Level 2 requirements, assertions are protected against repudiation by the Verifier.
+         */
+        LOAAP3, 
+        /**
+         * Indicator of the high digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]
+
+                        High authentication process level of assurance indicates all sensitive data transfer are cryptographically authenticated using keys bound to the authentication process.  Level 4 requires strong cryptographic authentication of all communicating parties and all sensitive data transfers between the parties. Either public key or symmetric key technology may be used. Authentication requires that the Claimant prove through a secure authentication protocol that he or she controls the token. All protocol threats at Level 3 are required to be prevented at Level 4. Protocols shall also be strongly resistant to man-in-the-middle attacks. Long-term shared authentication secrets, if used, are never revealed to any party except the Claimant and Verifiers operated directly by the CSP; however, session (temporary) shared secrets may be provided to independent Verifiers by the CSP. Approved cryptographic techniques are used for all operations. All sensitive data transfers are cryptographically authenticated using keys bound to the authentication process.   [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAP4, 
+        /**
+         * The value assigned as the indicator of the high quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.
+         */
+        LOAAS, 
+        /**
+         * Indicator of the low quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.
+
+                        Assertions and assertion references require protection from modification and reuse attacks.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAS1, 
+        /**
+         * Indicator of the basic quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.
+
+                        Assertions are resistant to disclosure, redirection, capture and substitution attacks.  Approved cryptographic techniques are required for all assertion protocols.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAS2, 
+        /**
+         * Indicator of the medium quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.
+
+                        Assertions are protected against repudiation by the verifier.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAS3, 
+        /**
+         * Indicator of the high quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.
+
+                        Strongly resistant to man-in-the-middle attacks. "Bearer" assertions are not used.  "Holder-of-key" assertions may be used. RP maintains records of the assertions.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]
+         */
+        LOAAS4, 
+        /**
+         * Indicator of the digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and its binding to an identity. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOACM, 
+        /**
+         * Indicator of the low digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and its binding to an identity. Little or no confidence that an individual has maintained control over a token that has been entrusted to him or her and that that token has not been compromised. Characteristics include weak identity binding to tokens and plaintext passwords or secrets not transmitted across a network. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOACM1, 
+        /**
+         * Indicator of the basic digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and its binding to an identity.  Some confidence that an individual has maintained control over a token that has been entrusted to him or her and that that token has not been compromised. Characteristics include:  Verification must prove claimant controls the token; token resists online guessing, replay, session hijacking, and eavesdropping attacks; and  token is at least weakly resistant to man-in-the middle attacks. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOACM2, 
+        /**
+         * Indicator of the medium digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and it’s binding to an identity.  High confidence that an individual has maintained control over a token that has been entrusted to him or her and that that token has not been compromised. Characteristics  include: Ownership of token verifiable through security authentication protocol and credential management protects against verifier impersonation attacks. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOACM3, 
+        /**
+         * Indicator of the high digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and it’s binding to an identity.  Very high confidence that an individual has maintained control over a token that has been entrusted to him or her and that that token has not been compromised. Characteristics include: Verifier can prove control of token through a secure protocol; credential management supports strong cryptographic authentication of all communication parties. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOACM4, 
+        /**
+         * Indicator of the quality or reliability in the process of ascertaining that an individual is who he or she claims to be.
+         */
+        LOAID, 
+        /**
+         * Indicator of low digital quality or reliability in the process of ascertaining that an individual is who he or she claims to be.  Requires that a continuity of identity be maintained but does not require identity proofing. [Based on Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOAID1, 
+        /**
+         * Indicator of some digital quality or reliability in the process of ascertaining that that an individual is who he or she claims to be. Requires identity proofing via presentation of identifying material or information. [Based on Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOAID2, 
+        /**
+         * Indicator of high digital quality or reliability in the process of ascertaining that an individual is who he or she claims to be.  Requires identity proofing procedures for verification of identifying materials and information. [Based on Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOAID3, 
+        /**
+         * Indicator of high digital quality or reliability in the process of ascertaining that an individual is who he or she claims to be.  Requires identity proofing procedures for verification of identifying materials and information. [Based on Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOAID4, 
+        /**
+         * Indicator of the digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]
+         */
+        LOANR, 
+        /**
+         * Indicator of low digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]
+         */
+        LOANR1, 
+        /**
+         * Indicator of basic digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]
+         */
+        LOANR2, 
+        /**
+         * Indicator of medium digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]
+         */
+        LOANR3, 
+        /**
+         * Indicator of high digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]
+         */
+        LOANR4, 
+        /**
+         * Indicator of the digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization’s security controls. [Based on NIST SP 800-63-2]
+         */
+        LOARA, 
+        /**
+         * Indicator of low digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization’s security controls. [Based on NIST SP 800-63-2]
+         */
+        LOARA1, 
+        /**
+         * Indicator of basic digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization’s security controls. [Based on NIST SP 800-63-2]
+         */
+        LOARA2, 
+        /**
+         * Indicator of medium digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization’s security controls. [Based on NIST SP 800-63-2]
+         */
+        LOARA3, 
+        /**
+         * Indicator of high digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization's security controls. [Based on NIST SP 800-63-2]
+         */
+        LOARA4, 
+        /**
+         * Indicator of the digital quality or reliability of single and multi-token authentication. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOATK, 
+        /**
+         * Indicator of the low digital quality or reliability of single and multi-token authentication. Permits the use of any of the token methods of Levels 2, 3, or 4. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOATK1, 
+        /**
+         * Indicator of the basic digital quality or reliability of single and multi-token authentication. Requires single factor authentication using memorized secret tokens, pre-registered knowledge tokens, look-up secret tokens, out of band tokens, or single factor one-time password devices. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOATK2, 
+        /**
+         * Indicator of the medium digital quality or reliability of single and multi-token authentication. Requires two authentication factors. Provides multi-factor remote network authentication. Permits multi-factor software cryptographic token. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOATK3, 
+        /**
+         * Indicator of the high digital quality or reliability of single and multi-token authentication. Requires token that is a hardware cryptographic module validated at validated at Federal Information Processing Standard (FIPS) 140-2 Level 2 or higher overall with at least FIPS 140-2 Level 3 physical security. Level 4 token requirements can be met by using the PIV authentication key of a FIPS 201 compliant Personal Identity Verification (PIV) Card.  [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]
+         */
+        LOATK4, 
+        /**
+         * Values for security trust mechanism metadata observation made about a security architecture system component that supports enforcement of security policies.
+         */
+        TRSTMECOBV, 
+        /**
+         * Potential values for observations of severity.
+         */
+        _SEVERITYOBSERVATION, 
+        /**
+         * Indicates the condition may be life-threatening or has the potential to cause permanent injury.
+         */
+        H, 
+        /**
+         * Indicates the condition may result in some adverse consequences but is unlikely to substantially affect the situation of the subject.
+         */
+        L, 
+        /**
+         * Indicates the condition may result in noticable adverse adverse consequences but is unlikely to be life-threatening or cause permanent injury.
+         */
+        M, 
+        /**
+         * Contains codes for defining the observed, physical position of a subject, such as during an observation, assessment, collection of a specimen, etc.  ECG waveforms and vital signs, such as blood pressure, are two examples where a general, observed position typically needs to be noted.
+         */
+        _SUBJECTBODYPOSITION, 
+        /**
+         * Lying on the left side.
+         */
+        LLD, 
+        /**
+         * Lying with the front or ventral surface downward; lying face down.
+         */
+        PRN, 
+        /**
+         * Lying on the right side.
+         */
+        RLD, 
+        /**
+         * A semi-sitting position in bed with the head of the bed elevated approximately 45 degrees.
+         */
+        SFWL, 
+        /**
+         * Resting the body on the buttocks, typically with upper torso erect or semi erect.
+         */
+        SIT, 
+        /**
+         * To be stationary, upright, vertical, on one's legs.
+         */
+        STN, 
+        /**
+         * supine
+         */
+        SUP, 
+        /**
+         * Lying on the back, on an inclined plane, typically about 30-45 degrees with head raised and feet lowered.
+         */
+        RTRD, 
+        /**
+         * Lying on the back, on an inclined plane, typically about 30-45 degrees, with  head lowered and feet raised.
+         */
+        TRD, 
+        /**
+         * Values for observations of verification act results
+
+                        
+                           Examples: Verified, not verified, verified with warning.
+         */
+        _VERIFICATIONOUTCOMEVALUE, 
+        /**
+         * Definition: Coverage is in effect for healthcare service(s) and/or product(s).
+         */
+        ACT, 
+        /**
+         * Definition: Coverage is in effect for healthcare service(s) and/or product(s) - Pending Investigation
+         */
+        ACTPEND, 
+        /**
+         * Definition: Coverage is in effect for healthcare service(s) and/or product(s).
+         */
+        ELG, 
+        /**
+         * Definition: Coverage is not in effect for healthcare service(s) and/or product(s).
+         */
+        INACT, 
+        /**
+         * Definition: Coverage is not in effect for healthcare service(s) and/or product(s) - Pending Investigation.
+         */
+        INPNDINV, 
+        /**
+         * Definition: Coverage is not in effect for healthcare service(s) and/or product(s) - Pending Eligibility Update.
+         */
+        INPNDUPD, 
+        /**
+         * Definition: Coverage is not in effect for healthcare service(s) and/or product(s). May optionally include reasons for the ineligibility.
+         */
+        NELG, 
+        /**
+         * AnnotationValue
+         */
+        _ANNOTATIONVALUE, 
+        /**
+         * Description:Used in a patient care message to value simple clinical (non-lab) observations.
+         */
+        _COMMONCLINICALOBSERVATIONVALUE, 
+        /**
+         * This domain is established as a parent to a variety of value domains being defined to support the communication of Individual Case Safety Reports to regulatory bodies. Arguably, this aggregation is not taxonomically pure, but the grouping will facilitate the management of these domains.
+         */
+        _INDIVIDUALCASESAFETYREPORTVALUEDOMAINS, 
+        /**
+         * Indicates the specific observation result which is the reason for the action (prescription, lab test, etc.). E.g. Headache, Ear infection, planned diagnostic image (requiring contrast agent), etc.
+         */
+        _INDICATIONVALUE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ObservationValue fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ActCoverageAssessmentObservationValue".equals(codeString))
+          return _ACTCOVERAGEASSESSMENTOBSERVATIONVALUE;
+        if ("_ActFinancialStatusObservationValue".equals(codeString))
+          return _ACTFINANCIALSTATUSOBSERVATIONVALUE;
+        if ("ASSET".equals(codeString))
+          return ASSET;
+        if ("ANNUITY".equals(codeString))
+          return ANNUITY;
+        if ("PROP".equals(codeString))
+          return PROP;
+        if ("RETACCT".equals(codeString))
+          return RETACCT;
+        if ("TRUST".equals(codeString))
+          return TRUST;
+        if ("INCOME".equals(codeString))
+          return INCOME;
+        if ("CHILD".equals(codeString))
+          return CHILD;
+        if ("DISABL".equals(codeString))
+          return DISABL;
+        if ("INVEST".equals(codeString))
+          return INVEST;
+        if ("PAY".equals(codeString))
+          return PAY;
+        if ("RETIRE".equals(codeString))
+          return RETIRE;
+        if ("SPOUSAL".equals(codeString))
+          return SPOUSAL;
+        if ("SUPPLE".equals(codeString))
+          return SUPPLE;
+        if ("TAX".equals(codeString))
+          return TAX;
+        if ("LIVEXP".equals(codeString))
+          return LIVEXP;
+        if ("CLOTH".equals(codeString))
+          return CLOTH;
+        if ("FOOD".equals(codeString))
+          return FOOD;
+        if ("HEALTH".equals(codeString))
+          return HEALTH;
+        if ("HOUSE".equals(codeString))
+          return HOUSE;
+        if ("LEGAL".equals(codeString))
+          return LEGAL;
+        if ("MORTG".equals(codeString))
+          return MORTG;
+        if ("RENT".equals(codeString))
+          return RENT;
+        if ("SUNDRY".equals(codeString))
+          return SUNDRY;
+        if ("TRANS".equals(codeString))
+          return TRANS;
+        if ("UTIL".equals(codeString))
+          return UTIL;
+        if ("ELSTAT".equals(codeString))
+          return ELSTAT;
+        if ("ADOPT".equals(codeString))
+          return ADOPT;
+        if ("BTHCERT".equals(codeString))
+          return BTHCERT;
+        if ("CCOC".equals(codeString))
+          return CCOC;
+        if ("DRLIC".equals(codeString))
+          return DRLIC;
+        if ("FOSTER".equals(codeString))
+          return FOSTER;
+        if ("MEMBER".equals(codeString))
+          return MEMBER;
+        if ("MIL".equals(codeString))
+          return MIL;
+        if ("MRGCERT".equals(codeString))
+          return MRGCERT;
+        if ("PASSPORT".equals(codeString))
+          return PASSPORT;
+        if ("STUDENRL".equals(codeString))
+          return STUDENRL;
+        if ("HLSTAT".equals(codeString))
+          return HLSTAT;
+        if ("DISABLE".equals(codeString))
+          return DISABLE;
+        if ("DRUG".equals(codeString))
+          return DRUG;
+        if ("IVDRG".equals(codeString))
+          return IVDRG;
+        if ("PGNT".equals(codeString))
+          return PGNT;
+        if ("LIVDEP".equals(codeString))
+          return LIVDEP;
+        if ("RELDEP".equals(codeString))
+          return RELDEP;
+        if ("SPSDEP".equals(codeString))
+          return SPSDEP;
+        if ("URELDEP".equals(codeString))
+          return URELDEP;
+        if ("LIVSIT".equals(codeString))
+          return LIVSIT;
+        if ("ALONE".equals(codeString))
+          return ALONE;
+        if ("DEPCHD".equals(codeString))
+          return DEPCHD;
+        if ("DEPSPS".equals(codeString))
+          return DEPSPS;
+        if ("DEPYGCHD".equals(codeString))
+          return DEPYGCHD;
+        if ("FAM".equals(codeString))
+          return FAM;
+        if ("RELAT".equals(codeString))
+          return RELAT;
+        if ("SPS".equals(codeString))
+          return SPS;
+        if ("UNREL".equals(codeString))
+          return UNREL;
+        if ("SOECSTAT".equals(codeString))
+          return SOECSTAT;
+        if ("ABUSE".equals(codeString))
+          return ABUSE;
+        if ("HMLESS".equals(codeString))
+          return HMLESS;
+        if ("ILGIM".equals(codeString))
+          return ILGIM;
+        if ("INCAR".equals(codeString))
+          return INCAR;
+        if ("PROB".equals(codeString))
+          return PROB;
+        if ("REFUG".equals(codeString))
+          return REFUG;
+        if ("UNEMPL".equals(codeString))
+          return UNEMPL;
+        if ("_AllergyTestValue".equals(codeString))
+          return _ALLERGYTESTVALUE;
+        if ("A0".equals(codeString))
+          return A0;
+        if ("A1".equals(codeString))
+          return A1;
+        if ("A2".equals(codeString))
+          return A2;
+        if ("A3".equals(codeString))
+          return A3;
+        if ("A4".equals(codeString))
+          return A4;
+        if ("_CompositeMeasureScoring".equals(codeString))
+          return _COMPOSITEMEASURESCORING;
+        if ("ALLORNONESCR".equals(codeString))
+          return ALLORNONESCR;
+        if ("LINEARSCR".equals(codeString))
+          return LINEARSCR;
+        if ("OPPORSCR".equals(codeString))
+          return OPPORSCR;
+        if ("WEIGHTSCR".equals(codeString))
+          return WEIGHTSCR;
+        if ("_CoverageLimitObservationValue".equals(codeString))
+          return _COVERAGELIMITOBSERVATIONVALUE;
+        if ("_CoverageLevelObservationValue".equals(codeString))
+          return _COVERAGELEVELOBSERVATIONVALUE;
+        if ("ADC".equals(codeString))
+          return ADC;
+        if ("CHD".equals(codeString))
+          return CHD;
+        if ("DEP".equals(codeString))
+          return DEP;
+        if ("DP".equals(codeString))
+          return DP;
+        if ("ECH".equals(codeString))
+          return ECH;
+        if ("FLY".equals(codeString))
+          return FLY;
+        if ("IND".equals(codeString))
+          return IND;
+        if ("SSP".equals(codeString))
+          return SSP;
+        if ("_CriticalityObservationValue".equals(codeString))
+          return _CRITICALITYOBSERVATIONVALUE;
+        if ("CRITH".equals(codeString))
+          return CRITH;
+        if ("CRITL".equals(codeString))
+          return CRITL;
+        if ("CRITU".equals(codeString))
+          return CRITU;
+        if ("_GeneticObservationValue".equals(codeString))
+          return _GENETICOBSERVATIONVALUE;
+        if ("Homozygote".equals(codeString))
+          return HOMOZYGOTE;
+        if ("_ObservationMeasureScoring".equals(codeString))
+          return _OBSERVATIONMEASURESCORING;
+        if ("COHORT".equals(codeString))
+          return COHORT;
+        if ("CONTVAR".equals(codeString))
+          return CONTVAR;
+        if ("PROPOR".equals(codeString))
+          return PROPOR;
+        if ("RATIO".equals(codeString))
+          return RATIO;
+        if ("_ObservationMeasureType".equals(codeString))
+          return _OBSERVATIONMEASURETYPE;
+        if ("COMPOSITE".equals(codeString))
+          return COMPOSITE;
+        if ("EFFICIENCY".equals(codeString))
+          return EFFICIENCY;
+        if ("EXPERIENCE".equals(codeString))
+          return EXPERIENCE;
+        if ("OUTCOME".equals(codeString))
+          return OUTCOME;
+        if ("PROCESS".equals(codeString))
+          return PROCESS;
+        if ("RESOURCE".equals(codeString))
+          return RESOURCE;
+        if ("STRUCTURE".equals(codeString))
+          return STRUCTURE;
+        if ("_ObservationPopulationInclusion".equals(codeString))
+          return _OBSERVATIONPOPULATIONINCLUSION;
+        if ("DENEX".equals(codeString))
+          return DENEX;
+        if ("DENEXCEP".equals(codeString))
+          return DENEXCEP;
+        if ("DENOM".equals(codeString))
+          return DENOM;
+        if ("IP".equals(codeString))
+          return IP;
+        if ("IPP".equals(codeString))
+          return IPP;
+        if ("MSRPOPL".equals(codeString))
+          return MSRPOPL;
+        if ("NUMER".equals(codeString))
+          return NUMER;
+        if ("NUMEX".equals(codeString))
+          return NUMEX;
+        if ("_PartialCompletionScale".equals(codeString))
+          return _PARTIALCOMPLETIONSCALE;
+        if ("G".equals(codeString))
+          return G;
+        if ("LE".equals(codeString))
+          return LE;
+        if ("ME".equals(codeString))
+          return ME;
+        if ("MI".equals(codeString))
+          return MI;
+        if ("N".equals(codeString))
+          return N;
+        if ("S".equals(codeString))
+          return S;
+        if ("_SecurityObservationValue".equals(codeString))
+          return _SECURITYOBSERVATIONVALUE;
+        if ("_SECINTOBV".equals(codeString))
+          return _SECINTOBV;
+        if ("_SECALTINTOBV".equals(codeString))
+          return _SECALTINTOBV;
+        if ("ABSTRED".equals(codeString))
+          return ABSTRED;
+        if ("AGGRED".equals(codeString))
+          return AGGRED;
+        if ("ANONYED".equals(codeString))
+          return ANONYED;
+        if ("MAPPED".equals(codeString))
+          return MAPPED;
+        if ("MASKED".equals(codeString))
+          return MASKED;
+        if ("PSEUDED".equals(codeString))
+          return PSEUDED;
+        if ("REDACTED".equals(codeString))
+          return REDACTED;
+        if ("SUBSETTED".equals(codeString))
+          return SUBSETTED;
+        if ("SYNTAC".equals(codeString))
+          return SYNTAC;
+        if ("TRSLT".equals(codeString))
+          return TRSLT;
+        if ("VERSIONED".equals(codeString))
+          return VERSIONED;
+        if ("_SECDATINTOBV".equals(codeString))
+          return _SECDATINTOBV;
+        if ("CRYTOHASH".equals(codeString))
+          return CRYTOHASH;
+        if ("DIGSIG".equals(codeString))
+          return DIGSIG;
+        if ("_SECINTCONOBV".equals(codeString))
+          return _SECINTCONOBV;
+        if ("HRELIABLE".equals(codeString))
+          return HRELIABLE;
+        if ("RELIABLE".equals(codeString))
+          return RELIABLE;
+        if ("UNCERTREL".equals(codeString))
+          return UNCERTREL;
+        if ("UNRELIABLE".equals(codeString))
+          return UNRELIABLE;
+        if ("_SECINTPRVOBV".equals(codeString))
+          return _SECINTPRVOBV;
+        if ("_SECINTPRVABOBV".equals(codeString))
+          return _SECINTPRVABOBV;
+        if ("CLINAST".equals(codeString))
+          return CLINAST;
+        if ("DEVAST".equals(codeString))
+          return DEVAST;
+        if ("HCPAST".equals(codeString))
+          return HCPAST;
+        if ("PACQAST".equals(codeString))
+          return PACQAST;
+        if ("PATAST".equals(codeString))
+          return PATAST;
+        if ("PAYAST".equals(codeString))
+          return PAYAST;
+        if ("PROAST".equals(codeString))
+          return PROAST;
+        if ("SDMAST".equals(codeString))
+          return SDMAST;
+        if ("_SECINTPRVRBOBV".equals(codeString))
+          return _SECINTPRVRBOBV;
+        if ("CLINRPT".equals(codeString))
+          return CLINRPT;
+        if ("DEVRPT".equals(codeString))
+          return DEVRPT;
+        if ("HCPRPT".equals(codeString))
+          return HCPRPT;
+        if ("PACQRPT".equals(codeString))
+          return PACQRPT;
+        if ("PATRPT".equals(codeString))
+          return PATRPT;
+        if ("PAYRPT".equals(codeString))
+          return PAYRPT;
+        if ("PRORPT".equals(codeString))
+          return PRORPT;
+        if ("SDMRPT".equals(codeString))
+          return SDMRPT;
+        if ("SECTRSTOBV".equals(codeString))
+          return SECTRSTOBV;
+        if ("TRSTACCRDOBV".equals(codeString))
+          return TRSTACCRDOBV;
+        if ("TRSTAGREOBV".equals(codeString))
+          return TRSTAGREOBV;
+        if ("TRSTCERTOBV".equals(codeString))
+          return TRSTCERTOBV;
+        if ("TRSTLOAOBV".equals(codeString))
+          return TRSTLOAOBV;
+        if ("LOAAN".equals(codeString))
+          return LOAAN;
+        if ("LOAAN1".equals(codeString))
+          return LOAAN1;
+        if ("LOAAN2".equals(codeString))
+          return LOAAN2;
+        if ("LOAAN3".equals(codeString))
+          return LOAAN3;
+        if ("LOAAN4".equals(codeString))
+          return LOAAN4;
+        if ("LOAAP".equals(codeString))
+          return LOAAP;
+        if ("LOAAP1".equals(codeString))
+          return LOAAP1;
+        if ("LOAAP2".equals(codeString))
+          return LOAAP2;
+        if ("LOAAP3".equals(codeString))
+          return LOAAP3;
+        if ("LOAAP4".equals(codeString))
+          return LOAAP4;
+        if ("LOAAS".equals(codeString))
+          return LOAAS;
+        if ("LOAAS1".equals(codeString))
+          return LOAAS1;
+        if ("LOAAS2".equals(codeString))
+          return LOAAS2;
+        if ("LOAAS3".equals(codeString))
+          return LOAAS3;
+        if ("LOAAS4".equals(codeString))
+          return LOAAS4;
+        if ("LOACM".equals(codeString))
+          return LOACM;
+        if ("LOACM1".equals(codeString))
+          return LOACM1;
+        if ("LOACM2".equals(codeString))
+          return LOACM2;
+        if ("LOACM3".equals(codeString))
+          return LOACM3;
+        if ("LOACM4".equals(codeString))
+          return LOACM4;
+        if ("LOAID".equals(codeString))
+          return LOAID;
+        if ("LOAID1".equals(codeString))
+          return LOAID1;
+        if ("LOAID2".equals(codeString))
+          return LOAID2;
+        if ("LOAID3".equals(codeString))
+          return LOAID3;
+        if ("LOAID4".equals(codeString))
+          return LOAID4;
+        if ("LOANR".equals(codeString))
+          return LOANR;
+        if ("LOANR1".equals(codeString))
+          return LOANR1;
+        if ("LOANR2".equals(codeString))
+          return LOANR2;
+        if ("LOANR3".equals(codeString))
+          return LOANR3;
+        if ("LOANR4".equals(codeString))
+          return LOANR4;
+        if ("LOARA".equals(codeString))
+          return LOARA;
+        if ("LOARA1".equals(codeString))
+          return LOARA1;
+        if ("LOARA2".equals(codeString))
+          return LOARA2;
+        if ("LOARA3".equals(codeString))
+          return LOARA3;
+        if ("LOARA4".equals(codeString))
+          return LOARA4;
+        if ("LOATK".equals(codeString))
+          return LOATK;
+        if ("LOATK1".equals(codeString))
+          return LOATK1;
+        if ("LOATK2".equals(codeString))
+          return LOATK2;
+        if ("LOATK3".equals(codeString))
+          return LOATK3;
+        if ("LOATK4".equals(codeString))
+          return LOATK4;
+        if ("TRSTMECOBV".equals(codeString))
+          return TRSTMECOBV;
+        if ("_SeverityObservation".equals(codeString))
+          return _SEVERITYOBSERVATION;
+        if ("H".equals(codeString))
+          return H;
+        if ("L".equals(codeString))
+          return L;
+        if ("M".equals(codeString))
+          return M;
+        if ("_SubjectBodyPosition".equals(codeString))
+          return _SUBJECTBODYPOSITION;
+        if ("LLD".equals(codeString))
+          return LLD;
+        if ("PRN".equals(codeString))
+          return PRN;
+        if ("RLD".equals(codeString))
+          return RLD;
+        if ("SFWL".equals(codeString))
+          return SFWL;
+        if ("SIT".equals(codeString))
+          return SIT;
+        if ("STN".equals(codeString))
+          return STN;
+        if ("SUP".equals(codeString))
+          return SUP;
+        if ("RTRD".equals(codeString))
+          return RTRD;
+        if ("TRD".equals(codeString))
+          return TRD;
+        if ("_VerificationOutcomeValue".equals(codeString))
+          return _VERIFICATIONOUTCOMEVALUE;
+        if ("ACT".equals(codeString))
+          return ACT;
+        if ("ACTPEND".equals(codeString))
+          return ACTPEND;
+        if ("ELG".equals(codeString))
+          return ELG;
+        if ("INACT".equals(codeString))
+          return INACT;
+        if ("INPNDINV".equals(codeString))
+          return INPNDINV;
+        if ("INPNDUPD".equals(codeString))
+          return INPNDUPD;
+        if ("NELG".equals(codeString))
+          return NELG;
+        if ("_AnnotationValue".equals(codeString))
+          return _ANNOTATIONVALUE;
+        if ("_CommonClinicalObservationValue".equals(codeString))
+          return _COMMONCLINICALOBSERVATIONVALUE;
+        if ("_IndividualCaseSafetyReportValueDomains".equals(codeString))
+          return _INDIVIDUALCASESAFETYREPORTVALUEDOMAINS;
+        if ("_IndicationValue".equals(codeString))
+          return _INDICATIONVALUE;
+        throw new FHIRException("Unknown V3ObservationValue code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ACTCOVERAGEASSESSMENTOBSERVATIONVALUE: return "_ActCoverageAssessmentObservationValue";
+            case _ACTFINANCIALSTATUSOBSERVATIONVALUE: return "_ActFinancialStatusObservationValue";
+            case ASSET: return "ASSET";
+            case ANNUITY: return "ANNUITY";
+            case PROP: return "PROP";
+            case RETACCT: return "RETACCT";
+            case TRUST: return "TRUST";
+            case INCOME: return "INCOME";
+            case CHILD: return "CHILD";
+            case DISABL: return "DISABL";
+            case INVEST: return "INVEST";
+            case PAY: return "PAY";
+            case RETIRE: return "RETIRE";
+            case SPOUSAL: return "SPOUSAL";
+            case SUPPLE: return "SUPPLE";
+            case TAX: return "TAX";
+            case LIVEXP: return "LIVEXP";
+            case CLOTH: return "CLOTH";
+            case FOOD: return "FOOD";
+            case HEALTH: return "HEALTH";
+            case HOUSE: return "HOUSE";
+            case LEGAL: return "LEGAL";
+            case MORTG: return "MORTG";
+            case RENT: return "RENT";
+            case SUNDRY: return "SUNDRY";
+            case TRANS: return "TRANS";
+            case UTIL: return "UTIL";
+            case ELSTAT: return "ELSTAT";
+            case ADOPT: return "ADOPT";
+            case BTHCERT: return "BTHCERT";
+            case CCOC: return "CCOC";
+            case DRLIC: return "DRLIC";
+            case FOSTER: return "FOSTER";
+            case MEMBER: return "MEMBER";
+            case MIL: return "MIL";
+            case MRGCERT: return "MRGCERT";
+            case PASSPORT: return "PASSPORT";
+            case STUDENRL: return "STUDENRL";
+            case HLSTAT: return "HLSTAT";
+            case DISABLE: return "DISABLE";
+            case DRUG: return "DRUG";
+            case IVDRG: return "IVDRG";
+            case PGNT: return "PGNT";
+            case LIVDEP: return "LIVDEP";
+            case RELDEP: return "RELDEP";
+            case SPSDEP: return "SPSDEP";
+            case URELDEP: return "URELDEP";
+            case LIVSIT: return "LIVSIT";
+            case ALONE: return "ALONE";
+            case DEPCHD: return "DEPCHD";
+            case DEPSPS: return "DEPSPS";
+            case DEPYGCHD: return "DEPYGCHD";
+            case FAM: return "FAM";
+            case RELAT: return "RELAT";
+            case SPS: return "SPS";
+            case UNREL: return "UNREL";
+            case SOECSTAT: return "SOECSTAT";
+            case ABUSE: return "ABUSE";
+            case HMLESS: return "HMLESS";
+            case ILGIM: return "ILGIM";
+            case INCAR: return "INCAR";
+            case PROB: return "PROB";
+            case REFUG: return "REFUG";
+            case UNEMPL: return "UNEMPL";
+            case _ALLERGYTESTVALUE: return "_AllergyTestValue";
+            case A0: return "A0";
+            case A1: return "A1";
+            case A2: return "A2";
+            case A3: return "A3";
+            case A4: return "A4";
+            case _COMPOSITEMEASURESCORING: return "_CompositeMeasureScoring";
+            case ALLORNONESCR: return "ALLORNONESCR";
+            case LINEARSCR: return "LINEARSCR";
+            case OPPORSCR: return "OPPORSCR";
+            case WEIGHTSCR: return "WEIGHTSCR";
+            case _COVERAGELIMITOBSERVATIONVALUE: return "_CoverageLimitObservationValue";
+            case _COVERAGELEVELOBSERVATIONVALUE: return "_CoverageLevelObservationValue";
+            case ADC: return "ADC";
+            case CHD: return "CHD";
+            case DEP: return "DEP";
+            case DP: return "DP";
+            case ECH: return "ECH";
+            case FLY: return "FLY";
+            case IND: return "IND";
+            case SSP: return "SSP";
+            case _CRITICALITYOBSERVATIONVALUE: return "_CriticalityObservationValue";
+            case CRITH: return "CRITH";
+            case CRITL: return "CRITL";
+            case CRITU: return "CRITU";
+            case _GENETICOBSERVATIONVALUE: return "_GeneticObservationValue";
+            case HOMOZYGOTE: return "Homozygote";
+            case _OBSERVATIONMEASURESCORING: return "_ObservationMeasureScoring";
+            case COHORT: return "COHORT";
+            case CONTVAR: return "CONTVAR";
+            case PROPOR: return "PROPOR";
+            case RATIO: return "RATIO";
+            case _OBSERVATIONMEASURETYPE: return "_ObservationMeasureType";
+            case COMPOSITE: return "COMPOSITE";
+            case EFFICIENCY: return "EFFICIENCY";
+            case EXPERIENCE: return "EXPERIENCE";
+            case OUTCOME: return "OUTCOME";
+            case PROCESS: return "PROCESS";
+            case RESOURCE: return "RESOURCE";
+            case STRUCTURE: return "STRUCTURE";
+            case _OBSERVATIONPOPULATIONINCLUSION: return "_ObservationPopulationInclusion";
+            case DENEX: return "DENEX";
+            case DENEXCEP: return "DENEXCEP";
+            case DENOM: return "DENOM";
+            case IP: return "IP";
+            case IPP: return "IPP";
+            case MSRPOPL: return "MSRPOPL";
+            case NUMER: return "NUMER";
+            case NUMEX: return "NUMEX";
+            case _PARTIALCOMPLETIONSCALE: return "_PartialCompletionScale";
+            case G: return "G";
+            case LE: return "LE";
+            case ME: return "ME";
+            case MI: return "MI";
+            case N: return "N";
+            case S: return "S";
+            case _SECURITYOBSERVATIONVALUE: return "_SecurityObservationValue";
+            case _SECINTOBV: return "_SECINTOBV";
+            case _SECALTINTOBV: return "_SECALTINTOBV";
+            case ABSTRED: return "ABSTRED";
+            case AGGRED: return "AGGRED";
+            case ANONYED: return "ANONYED";
+            case MAPPED: return "MAPPED";
+            case MASKED: return "MASKED";
+            case PSEUDED: return "PSEUDED";
+            case REDACTED: return "REDACTED";
+            case SUBSETTED: return "SUBSETTED";
+            case SYNTAC: return "SYNTAC";
+            case TRSLT: return "TRSLT";
+            case VERSIONED: return "VERSIONED";
+            case _SECDATINTOBV: return "_SECDATINTOBV";
+            case CRYTOHASH: return "CRYTOHASH";
+            case DIGSIG: return "DIGSIG";
+            case _SECINTCONOBV: return "_SECINTCONOBV";
+            case HRELIABLE: return "HRELIABLE";
+            case RELIABLE: return "RELIABLE";
+            case UNCERTREL: return "UNCERTREL";
+            case UNRELIABLE: return "UNRELIABLE";
+            case _SECINTPRVOBV: return "_SECINTPRVOBV";
+            case _SECINTPRVABOBV: return "_SECINTPRVABOBV";
+            case CLINAST: return "CLINAST";
+            case DEVAST: return "DEVAST";
+            case HCPAST: return "HCPAST";
+            case PACQAST: return "PACQAST";
+            case PATAST: return "PATAST";
+            case PAYAST: return "PAYAST";
+            case PROAST: return "PROAST";
+            case SDMAST: return "SDMAST";
+            case _SECINTPRVRBOBV: return "_SECINTPRVRBOBV";
+            case CLINRPT: return "CLINRPT";
+            case DEVRPT: return "DEVRPT";
+            case HCPRPT: return "HCPRPT";
+            case PACQRPT: return "PACQRPT";
+            case PATRPT: return "PATRPT";
+            case PAYRPT: return "PAYRPT";
+            case PRORPT: return "PRORPT";
+            case SDMRPT: return "SDMRPT";
+            case SECTRSTOBV: return "SECTRSTOBV";
+            case TRSTACCRDOBV: return "TRSTACCRDOBV";
+            case TRSTAGREOBV: return "TRSTAGREOBV";
+            case TRSTCERTOBV: return "TRSTCERTOBV";
+            case TRSTLOAOBV: return "TRSTLOAOBV";
+            case LOAAN: return "LOAAN";
+            case LOAAN1: return "LOAAN1";
+            case LOAAN2: return "LOAAN2";
+            case LOAAN3: return "LOAAN3";
+            case LOAAN4: return "LOAAN4";
+            case LOAAP: return "LOAAP";
+            case LOAAP1: return "LOAAP1";
+            case LOAAP2: return "LOAAP2";
+            case LOAAP3: return "LOAAP3";
+            case LOAAP4: return "LOAAP4";
+            case LOAAS: return "LOAAS";
+            case LOAAS1: return "LOAAS1";
+            case LOAAS2: return "LOAAS2";
+            case LOAAS3: return "LOAAS3";
+            case LOAAS4: return "LOAAS4";
+            case LOACM: return "LOACM";
+            case LOACM1: return "LOACM1";
+            case LOACM2: return "LOACM2";
+            case LOACM3: return "LOACM3";
+            case LOACM4: return "LOACM4";
+            case LOAID: return "LOAID";
+            case LOAID1: return "LOAID1";
+            case LOAID2: return "LOAID2";
+            case LOAID3: return "LOAID3";
+            case LOAID4: return "LOAID4";
+            case LOANR: return "LOANR";
+            case LOANR1: return "LOANR1";
+            case LOANR2: return "LOANR2";
+            case LOANR3: return "LOANR3";
+            case LOANR4: return "LOANR4";
+            case LOARA: return "LOARA";
+            case LOARA1: return "LOARA1";
+            case LOARA2: return "LOARA2";
+            case LOARA3: return "LOARA3";
+            case LOARA4: return "LOARA4";
+            case LOATK: return "LOATK";
+            case LOATK1: return "LOATK1";
+            case LOATK2: return "LOATK2";
+            case LOATK3: return "LOATK3";
+            case LOATK4: return "LOATK4";
+            case TRSTMECOBV: return "TRSTMECOBV";
+            case _SEVERITYOBSERVATION: return "_SeverityObservation";
+            case H: return "H";
+            case L: return "L";
+            case M: return "M";
+            case _SUBJECTBODYPOSITION: return "_SubjectBodyPosition";
+            case LLD: return "LLD";
+            case PRN: return "PRN";
+            case RLD: return "RLD";
+            case SFWL: return "SFWL";
+            case SIT: return "SIT";
+            case STN: return "STN";
+            case SUP: return "SUP";
+            case RTRD: return "RTRD";
+            case TRD: return "TRD";
+            case _VERIFICATIONOUTCOMEVALUE: return "_VerificationOutcomeValue";
+            case ACT: return "ACT";
+            case ACTPEND: return "ACTPEND";
+            case ELG: return "ELG";
+            case INACT: return "INACT";
+            case INPNDINV: return "INPNDINV";
+            case INPNDUPD: return "INPNDUPD";
+            case NELG: return "NELG";
+            case _ANNOTATIONVALUE: return "_AnnotationValue";
+            case _COMMONCLINICALOBSERVATIONVALUE: return "_CommonClinicalObservationValue";
+            case _INDIVIDUALCASESAFETYREPORTVALUEDOMAINS: return "_IndividualCaseSafetyReportValueDomains";
+            case _INDICATIONVALUE: return "_IndicationValue";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ObservationValue";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ACTCOVERAGEASSESSMENTOBSERVATIONVALUE: return "Codes specify the category of observation, evidence, or document used to assess for services, e.g., discharge planning, or to establish eligibility for coverage under a policy or program. The type of evidence is coded as observation values.";
+            case _ACTFINANCIALSTATUSOBSERVATIONVALUE: return "Code specifying financial indicators used to assess or establish eligibility for coverage under a policy or program; e.g., pay stub; tax or income document; asset document; living expenses.";
+            case ASSET: return "Codes specifying asset indicators used to assess or establish eligibility for coverage under a policy or program.";
+            case ANNUITY: return "Indicator of annuity ownership or status as beneficiary.";
+            case PROP: return "Indicator of real property ownership, e.g., deed or real estate contract.";
+            case RETACCT: return "Indicator of retirement investment account ownership.";
+            case TRUST: return "Indicator of status as trust beneficiary.";
+            case INCOME: return "Code specifying income indicators used to assess or establish eligibility for coverage under a policy or program; e.g., pay or pension check, child support payments received or provided, and taxes paid.";
+            case CHILD: return "Indicator of child support payments received or provided.";
+            case DISABL: return "Indicator of disability income replacement payment.";
+            case INVEST: return "Indicator of investment income, e.g., dividend check, annuity payment; real estate rent, investment divestiture proceeds; trust or endowment check.";
+            case PAY: return "Indicator of paid employment, e.g., letter of hire, contract, employer letter; copy of pay check or pay stub.";
+            case RETIRE: return "Indicator of retirement payment, e.g., pension check.";
+            case SPOUSAL: return "Indicator of spousal or partner support payments received or provided; e.g., alimony payment; support stipulations in a divorce settlement.";
+            case SUPPLE: return "Indicator of income supplement, e.g., gifting, parental income support; stipend, or grant.";
+            case TAX: return "Indicator of tax obligation or payment, e.g., statement of taxable income.";
+            case LIVEXP: return "Codes specifying living expense indicators used to assess or establish eligibility for coverage under a policy or program.";
+            case CLOTH: return "Indicator of clothing expenses.";
+            case FOOD: return "Indicator of transportation expenses.";
+            case HEALTH: return "Indicator of health expenses; including medication costs, health service costs, financial participations, and health coverage premiums.";
+            case HOUSE: return "Indicator of housing expense, e.g., household appliances, fixtures, furnishings, and maintenance and repairs.";
+            case LEGAL: return "Indicator of legal expenses.";
+            case MORTG: return "Indicator of mortgage amount, interest, and payments.";
+            case RENT: return "Indicator of rental or lease payments.";
+            case SUNDRY: return "Indicator of transportation expenses.";
+            case TRANS: return "Indicator of transportation expenses, e.g., vehicle payments, vehicle insurance, vehicle fuel, and vehicle maintenance and repairs.";
+            case UTIL: return "Indicator of transportation expenses.";
+            case ELSTAT: return "Code specifying eligibility indicators used to assess or establish eligibility for coverage under a policy or program eligibility status, e.g., certificates of creditable coverage; student enrollment; adoption, marriage or birth certificate.";
+            case ADOPT: return "Indicator of adoption.";
+            case BTHCERT: return "Indicator of birth.";
+            case CCOC: return "Indicator of creditable coverage.";
+            case DRLIC: return "Indicator of driving status.";
+            case FOSTER: return "Indicator of foster child status.";
+            case MEMBER: return "Indicator of status as covered member under a policy or program, e.g., member id card or coverage document.";
+            case MIL: return "Indicator of military status.";
+            case MRGCERT: return "Indicator of marriage status.";
+            case PASSPORT: return "Indicator of citizenship.";
+            case STUDENRL: return "Indicator of student status.";
+            case HLSTAT: return "Code specifying non-clinical indicators related to health status used to assess or establish eligibility for coverage under a policy or program, e.g., pregnancy, disability, drug use, mental health issues.";
+            case DISABLE: return "Indication of disability.";
+            case DRUG: return "Indication of drug use.";
+            case IVDRG: return "Indication of IV drug use .";
+            case PGNT: return "Non-clinical report of pregnancy.";
+            case LIVDEP: return "Code specifying observations related to living dependency, such as dependent upon spouse for activities of daily living.";
+            case RELDEP: return "Continued living in private residence requires functional and health care assistance from one or more relatives.";
+            case SPSDEP: return "Continued living in private residence requires functional and health care assistance from spouse or life partner.";
+            case URELDEP: return "Continued living in private residence requires functional and health care assistance from one or more unrelated persons.";
+            case LIVSIT: return "Code specifying observations related to living situation for a person in a private residence.";
+            case ALONE: return "Living alone.  Maps to PD1-2   Living arrangement   (IS)   00742 [A]";
+            case DEPCHD: return "Living with one or more dependent children requiring moderate supervision.";
+            case DEPSPS: return "Living with disabled spouse requiring functional and health care assistance";
+            case DEPYGCHD: return "Living with one or more dependent children requiring intensive supervision";
+            case FAM: return "Living with family. Maps to PD1-2   Living arrangement   (IS)   00742 [F]";
+            case RELAT: return "Living with one or more relatives. Maps to PD1-2   Living arrangement   (IS)   00742 [R]";
+            case SPS: return "Living only with spouse or life partner. Maps to PD1-2   Living arrangement   (IS)   00742 [S]";
+            case UNREL: return "Living with one or more unrelated persons.";
+            case SOECSTAT: return "Code specifying observations or indicators related to socio-economic status used to assess to assess for services, e.g., discharge planning, or to establish eligibility for coverage under a policy or program.";
+            case ABUSE: return "Indication of abuse victim.";
+            case HMLESS: return "Indication of status as homeless.";
+            case ILGIM: return "Indication of status as illegal immigrant.";
+            case INCAR: return "Indication of status as incarcerated.";
+            case PROB: return "Indication of probation status.";
+            case REFUG: return "Indication of refugee status.";
+            case UNEMPL: return "Indication of unemployed status.";
+            case _ALLERGYTESTVALUE: return "Indicates the result of a particular allergy test.  E.g. Negative, Mild, Moderate, Severe";
+            case A0: return "Description:Patient exhibits no reaction to the challenge agent.";
+            case A1: return "Description:Patient exhibits a minimal reaction to the challenge agent.";
+            case A2: return "Description:Patient exhibits a mild reaction to the challenge agent.";
+            case A3: return "Description:Patient exhibits moderate reaction to the challenge agent.";
+            case A4: return "Description:Patient exhibits a severe reaction to the challenge agent.";
+            case _COMPOSITEMEASURESCORING: return "Observation values that communicate the method used in a quality measure to combine the component measure results included in an composite measure.";
+            case ALLORNONESCR: return "Code specifying that the measure uses all-or-nothing scoring. All-or-nothing scoring places an individual in the numerator of the composite measure if and only if they are in the numerator of all component measures in which they are in the denominator.";
+            case LINEARSCR: return "Code specifying that the measure uses linear scoring. Linear scoring computes the fraction of component measures in which the individual appears in the numerator, giving equal weight to each component measure.";
+            case OPPORSCR: return "Code specifying that the measure uses opportunity-based scoring. In opportunity-based scoring the measure score is determined by combining the denominator and numerator of each component measure to determine an overall composite score.";
+            case WEIGHTSCR: return "Code specifying that the measure uses weighted scoring. Weighted scoring assigns a factor to each component measure to weight that measure's contribution to the overall score.";
+            case _COVERAGELIMITOBSERVATIONVALUE: return "Description:Coded observation values for coverage limitations, for e.g., types of claims or types of parties covered under a policy or program.";
+            case _COVERAGELEVELOBSERVATIONVALUE: return "Description:Coded observation values for types of covered parties under a policy or program based on their personal relationships or employment status.";
+            case ADC: return "Description:Child over an age as specified by coverage policy or program, e.g., student, differently abled, and income dependent.";
+            case CHD: return "Description:Dependent biological, adopted, foster child as specified by coverage policy or program.";
+            case DEP: return "Description:Person requiring functional and/or financial assistance from another person as specified by coverage policy or program.";
+            case DP: return "Description:Persons registered as a family unit in a domestic partner registry as specified by law and by coverage policy or program.";
+            case ECH: return "Description:An individual employed by an employer who receive remuneration in wages, salary, commission, tips, piece-rates, or pay-in-kind through the employeraTMs payment system (i.e., not a contractor) as specified by coverage policy or program.";
+            case FLY: return "Description:As specified by coverage policy or program.";
+            case IND: return "Description:Person as specified by coverage policy or program.";
+            case SSP: return "Description:A pair of people of the same gender who live together as a family as specified by coverage policy or program, e.g., Naomi and Ruth from the Book of Ruth; Socrates and Alcibiades";
+            case _CRITICALITYOBSERVATIONVALUE: return "A clinical judgment as to the worst case result of a future exposure (including substance administration). When the worst case result is assessed to have a life-threatening or organ system threatening potential, it is considered to be of high criticality.";
+            case CRITH: return "Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.";
+            case CRITL: return "Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.";
+            case CRITU: return "Unable to assess the worst case result of a future exposure.";
+            case _GENETICOBSERVATIONVALUE: return "Description: The domain contains genetic analysis specific observation values, e.g. Homozygote, Heterozygote, etc.";
+            case HOMOZYGOTE: return "Description: An individual having different alleles at one or more loci regarding a specific character";
+            case _OBSERVATIONMEASURESCORING: return "Observation values used to indicate the type of scoring (e.g. proportion, ratio) used by a health quality measure.";
+            case COHORT: return "A measure in which either short-term cross-section or long-term longitudinal analysis is performed over a group of subjects defined by a set of common properties or defining characteristics (e.g., Male smokers between the ages of 40 and 50 years, exposure to treatment, exposure duration).";
+            case CONTVAR: return "A measure score in which each individual value for the measure can fall anywhere along a continuous scale (e.g., mean time to thrombolytics which aggregates the time in minutes from a case presenting with chest pain to the time of administration of thrombolytics).";
+            case PROPOR: return "A score derived by dividing the number of cases that meet a criterion for quality (the numerator) by the number of eligible cases within a given time frame (the denominator) where the numerator cases are a subset of the denominator cases (e.g., percentage of eligible women with a mammogram performed in the last year).";
+            case RATIO: return "A score that may have a value of zero or greater that is derived by dividing a count of one type of data by a count of another type of data (e.g., the number of patients with central lines who develop infection divided by the number of central line days).";
+            case _OBSERVATIONMEASURETYPE: return "Observation values used to indicate what kind of health quality measure is used.";
+            case COMPOSITE: return "A measure that is composed from one or more other measures and indicates an overall summary of those measures.";
+            case EFFICIENCY: return "A measure related to the efficiency of medical treatment.";
+            case EXPERIENCE: return "A measure related to the level of patient engagement or patient experience of care.";
+            case OUTCOME: return "A measure that indicates the result of the performance (or non-performance) of a function or process.";
+            case PROCESS: return "A measure which focuses on a process which leads to a certain outcome, meaning that a scientific basis exists for believing that the process, when executed well, will increase the probability of achieving a desired outcome.";
+            case RESOURCE: return "A measure related to the extent of use of clinical resources or cost of care.";
+            case STRUCTURE: return "A measure related to the structure of patient care.";
+            case _OBSERVATIONPOPULATIONINCLUSION: return "Observation values used to assert various populations that a subject falls into.";
+            case DENEX: return "Patients who should be removed from the eMeasure population and denominator before determining if numerator criteria are met. Denominator exclusions are used in proportion and ratio measures to help narrow the denominator.";
+            case DENEXCEP: return "Denominator exceptions are those conditions that should remove a patient, procedure or unit of measurement from the denominator only if the numerator criteria are not met. Denominator exceptions allow for adjustment of the calculated score for those providers with higher risk populations. Denominator exceptions are used only in proportion eMeasures. They are not appropriate for ratio or continuous variable eMeasures.  Denominator exceptions allow for the exercise of clinical judgment and should be specifically defined where capturing the information in a structured manner fits the clinical workflow. Generic denominator exception reasons used in proportion eMeasures fall into three general categories:\r\n\n                        \n                           Medical reasons\n                           Patient reasons\n                           System reasons";
+            case DENOM: return "It can be the same as the initial patient population or a subset of the initial patient population to further constrain the population for the purpose of the eMeasure. Different measures within an eMeasure set may have different Denominators. Continuous Variable eMeasures do not have a Denominator, but instead define a Measure Population.";
+            case IP: return "The initial population refers to all entities to be evaluated by a specific quality measure who share a common set of specified characteristics within a specific measurement set to which a given measure belongs.";
+            case IPP: return "The initial patient population refers to all patients to be evaluated by a specific quality measure who share a common set of specified characteristics within a specific measurement set to which a given measure belongs. Details often include information based upon specific age groups, diagnoses, diagnostic and procedure codes, and enrollment periods.";
+            case MSRPOPL: return "Measure population is used only in continuous variable eMeasures. It is a narrative description of the eMeasure population. \n(e.g., all patients seen in the Emergency Department during the measurement period).";
+            case NUMER: return "Numerators are used in proportion and ratio eMeasures. In proportion measures the numerator criteria are the processes or outcomes expected for each patient, procedure, or other unit of measurement defined in the denominator. In ratio measures the numerator is related, but not directly derived from the denominator (e.g., a numerator listing the number of central line blood stream infections and a denominator indicating the days per thousand of central line usage in a specific time period).";
+            case NUMEX: return "Numerator Exclusions are used only in ratio eMeasures to define instances that should not be included in the numerator data. (e.g., if the number of central line blood stream infections per 1000 catheter days were to exclude infections with a specific bacterium, that bacterium would be listed as a numerator exclusion.)";
+            case _PARTIALCOMPLETIONSCALE: return "PartialCompletionScale";
+            case G: return "Value for Act.partialCompletionCode attribute that implies 81-99% completion";
+            case LE: return "Value for Act.partialCompletionCode attribute that implies 61-80% completion";
+            case ME: return "Value for Act.partialCompletionCode attribute that implies 41-60% completion";
+            case MI: return "Value for Act.partialCompletionCode attribute that implies 1-20% completion";
+            case N: return "Value for Act.partialCompletionCode attribute that implies 0% completion";
+            case S: return "Value for Act.partialCompletionCode attribute that implies 21-40% completion";
+            case _SECURITYOBSERVATIONVALUE: return "Observation values used to indicate security observation metadata.";
+            case _SECINTOBV: return "Abstract security observation values used to indicate security integrity metadata.\r\n\n                        \n                           Examples: Codes conveying integrity status, integrity confidence, and provenance.";
+            case _SECALTINTOBV: return "Abstract security metadata observation values used to indicate mechanism used for authorized alteration of an IT resource (data, information object, service, or system capability)";
+            case ABSTRED: return "Security metadata observation values used to indicate the use of a more abstract version of the content, e.g., replacing exact value of an age or date field with a range, or remove the left digits of a credit card number or SSN.";
+            case AGGRED: return "Security metadata observation values used to indicate the use of an algorithmic combination of actual values with the result of an aggregate function, e.g., average, sum, or count in order to limit disclosure of an IT resource (data, information object, service, or system capability) to the minimum necessary.";
+            case ANONYED: return "Security metadata observation value conveying the alteration integrity of an IT resource (data, information object, service, or system capability) by used to indicate the mechanism by which software systems can strip portions of the resource that could allow the identification of the source of the information or the information subject.  No key to relink the data is retained.";
+            case MAPPED: return "Security metadata observation value used to indicate that the IT resource semantic content has been transformed from one encoding to another.\r\n\n                        \n                           Usage Note: \"MAP\" code does not indicate the semantic fidelity of the transformed content.\r\n\n                        To indicate semantic fidelity for maps of HL7 to other code systems, this security alteration integrity observation may be further specified using an Act valued with Value Set: MapRelationship (2.16.840.1.113883.1.11.11052).\r\n\n                        Semantic fidelity of the mapped IT Resource may also be indicated using a SecurityIntegrityConfidenceObservation.";
+            case MASKED: return "Security metadata observation value conveying the alteration integrity of an IT resource (data, information object, service, or system capability) by indicating the mechanism by which software systems can make data unintelligible (that is, as unreadable and unusable by algorithmically transforming plaintext into ciphertext) such that it can only be accessed or used by authorized users.  An authorized user may be provided a key to decrypt per license or \"shared secret\".\r\n\n                        \n                           Usage Note: \"MASKED\" may be used, per applicable policy, as a flag to indicate to a user or receiver that some portion of an IT resource has been further encrypted, and may be accessed only by an authorized user or receiver to which a decryption key is provided.";
+            case PSEUDED: return "Security metadata observation value conveying the alteration integrity of an IT resource (data, information object, service, or system capability), by indicating the mechanism by which software systems can strip portions of the resource that could allow the identification of the source of the information or the information subject.  Custodian may retain a key to relink data necessary to reidentify the information subject.\r\n\n                        \n                           Rationale: Personal data which has been processed to make it impossible to know whose data it is. Used particularly for secondary use of health data. In some cases, it may be possible for authorized individuals to restore the identity of the individual, e.g.,for public health case management.  Based on ISO/TS 25237:2008 Health informatics—Pseudonymization";
+            case REDACTED: return "Security metadata observation value used to indicate the mechanism by which software systems can filter an IT resource (data, information object, service, or system capability) to remove any portion of the resource that is not authorized to be access, used, or disclosed.\r\n\n                        \n                           Usage Note: \"REDACTED\" may be used, per applicable policy, as a flag to indicate to a user or receiver that some portion of an IT resource has filtered and not included in the content accessed or received.";
+            case SUBSETTED: return "Metadata observation used to indicate that some information has been removed from the source object when the view this object contains was constructed because of configuration options when the view was created. The content may not be suitable for use as the basis of a record update\r\n\n                        \n                           Usage Note: This is not suitable to be used when information is removed for security reasons - see the code REDACTED for this use.";
+            case SYNTAC: return "Security metadata observation value used to indicate that the IT resource syntax has been transformed from one syntactical representation to another.  \r\n\n                        \n                           Usage Note: \"SYNTAC\" code does not indicate the syntactical correctness of the syntactically transformed IT resource.";
+            case TRSLT: return "Security metadata observation value used to indicate that the IT resource has been translated from one human language to another.  \r\n\n                        \n                           Usage Note: \"TRSLT\" does not indicate the fidelity of the translation or the languages translated.\r\n\n                        The fidelity of the IT Resource translation may be indicated using a SecurityIntegrityConfidenceObservation.\r\n\n                        To indicate languages, use the Value Set:HumanLanguage (2.16.840.1.113883.1.11.11526)";
+            case VERSIONED: return "Security metadata observation value conveying the alteration integrity of an IT resource (data, information object, service, or system capability)  which indicates that the resource only retains versions of an IT resource  for access and use per applicable policy\r\n\n                        \n                           Usage Note: When this code is used, expectation is that the system has removed historical versions of the data that falls outside the time period deemed to be the effective time of the applicable version.";
+            case _SECDATINTOBV: return "Abstract security observation values used to indicate data integrity metadata.\r\n\n                        \n                           Examples: Codes conveying the mechanism used to preserve the accuracy and consistency of an IT resource such as a digital signature and a cryptographic hash function.";
+            case CRYTOHASH: return "Security metadata observation value used to indicate the mechanism by which software systems can establish that data was not modified in transit.\r\n\n                        \n                           Rationale: This definition is intended to align with the ISO 22600-2 3.3.19 definition of cryptographic checkvalue: Information which is derived by performing a cryptographic transformation (see cryptography) on the data unit.  The derivation of the checkvalue may be performed in one or more steps and is a result of a mathematical function of the key and a data unit. It is usually used to check the integrity of a data unit.\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           SHA-1\n                           SHA-2 (Secure Hash Algorithm)";
+            case DIGSIG: return "Security metadata observation value used to indicate the mechanism by which software systems use digital signature to establish that data has not been modified.  \r\n\n                        \n                           Rationale: This definition is intended to align with the ISO 22600-2 3.3.26 definition of digital signature:  Data appended to, or a cryptographic transformation (see cryptography) of, a data unit that allows a recipient of the data unit to prove the source and integrity of the data unit and protect against forgery e.g., by the recipient.";
+            case _SECINTCONOBV: return "Abstract security observation value used to indicate integrity confidence metadata.\r\n\n                        \n                           Examples: Codes conveying the level of reliability and trustworthiness of an IT resource.";
+            case HRELIABLE: return "Security metadata observation value used to indicate that the veracity or trustworthiness of an IT resource (data, information object, service, or system capability) for a specified purpose of use is perceived to be or deemed by policy to be very high.";
+            case RELIABLE: return "Security metadata observation value used to indicate that the veracity or trustworthiness of an IT resource (data, information object, service, or system capability) for a specified purpose of use is perceived to be or deemed by policy to be adequate.";
+            case UNCERTREL: return "Security metadata observation value used to indicate that the veracity or trustworthiness of an IT resource (data, information object, service, or system capability) for a specified purpose of use is perceived to be or deemed by policy to be uncertain.";
+            case UNRELIABLE: return "Security metadata observation value used to indicate that the veracity or trustworthiness of an IT resource (data, information object, service, or system capability) for a specified purpose of use is perceived to be or deemed by policy to be inadequate.";
+            case _SECINTPRVOBV: return "Abstract security metadata observation value used to indicate the provenance of an IT resource (data, information object, service, or system capability).\r\n\n                        \n                           Examples: Codes conveying the provenance metadata about the entity reporting an IT resource.";
+            case _SECINTPRVABOBV: return "Abstract security provenance metadata observation value used to indicate the entity that asserted an IT resource (data, information object, service, or system capability).\r\n\n                        \n                           Examples: Codes conveying the provenance metadata about the entity asserting the resource.";
+            case CLINAST: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a clinician.";
+            case DEVAST: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a device.";
+            case HCPAST: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a healthcare professional.";
+            case PACQAST: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a patient acquaintance.";
+            case PATAST: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a patient.";
+            case PAYAST: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a payer.";
+            case PROAST: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a professional.";
+            case SDMAST: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was asserted by a substitute decision maker.";
+            case _SECINTPRVRBOBV: return "Abstract security provenance metadata observation value used to indicate the entity that reported the resource (data, information object, service, or system capability).\r\n\n                        \n                           Examples: Codes conveying the provenance metadata about the entity reporting an IT resource.";
+            case CLINRPT: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a clinician.";
+            case DEVRPT: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a device.";
+            case HCPRPT: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a healthcare professional.";
+            case PACQRPT: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a patient acquaintance.";
+            case PATRPT: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a patient.";
+            case PAYRPT: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a payer.";
+            case PRORPT: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a professional.";
+            case SDMRPT: return "Security provenance metadata observation value used to indicate that an IT resource (data, information object, service, or system capability) was reported by a substitute decision maker.";
+            case SECTRSTOBV: return "Observation value used to indicate aspects of trust applicable to an IT resource (data, information object, service, or system capability).";
+            case TRSTACCRDOBV: return "Values for security trust accreditation metadata observation made about the formal declaration by an authority or neutral third party that validates the technical, security, trust, and business practice conformance of Trust Agents to facilitate security, interoperability, and trust among participants within a security domain or trust framework.";
+            case TRSTAGREOBV: return "Values for security trust agreement metadata observation made about privacy and security requirements with which a security domain must comply. [ISO IEC 10181-1]\n[ISO IEC 10181-1]";
+            case TRSTCERTOBV: return "Values for security trust certificate metadata observation made about a set of security-relevant data issued by a security authority or trusted third party, together with security information which is used to provide the integrity and data origin authentication services for an IT resource (data, information object, service, or system capability). [Based on ISO IEC 10181-1]\r\n\n                        For example, a Certificate Policy (CP), which is a named set of rules that indicates the applicability of a certificate to a particular community and/or class of application with common security requirements.  A particular Certificate Policy might indicate the applicability of a type of certificate to the authentication of electronic data interchange transactions for the trading of goods within a given price range.  Another example is Cross Certification with Federal Bridge.";
+            case TRSTLOAOBV: return "Values for security trust assurance metadata observation made about the digital quality or reliability of a trust assertion, activity, capability, information exchange, mechanism, process, or protocol.";
+            case LOAAN: return "The value assigned as the indicator of the digital quality or reliability of the verification and validation process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2]\r\n\n                        For example, the degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies]";
+            case LOAAN1: return "Indicator of low digital quality or reliability of the digital reliability of the verification and validation process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2] \r\n\n                        The degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies] \r\n\n                        Low authentication level of assurance indicates that the relying party may have little or no confidence in the asserted identity's validity. Level 1 requires little or no confidence in the asserted identity. No identity proofing is required at this level, but the authentication mechanism should provide some assurance that the same claimant is accessing the protected transaction or data. A wide range of available authentication technologies can be employed and any of the token methods of Levels 2, 3, or 4, including Personal Identification Numbers (PINs), may be used. To be authenticated, the claimant must prove control of the token through a secure authentication protocol. At Level 1, long-term shared authentication secrets may be revealed to verifiers.  Assertions issued about claimants as a result of a successful authentication are either cryptographically authenticated by relying parties (using approved methods) or are obtained directly from a trusted party via a secure authentication protocol.   [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAN2: return "Indicator of basic digital quality or reliability of the digital reliability of the verification and validation process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2] \r\n\n                        The degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies]\r\n\n                        Basic authentication level of assurance indicates that the relying party may have some confidence in the asserted identity's validity. Level 2 requires confidence that the asserted identity is accurate. Level 2 provides for single-factor remote network authentication, including identity-proofing requirements for presentation of identifying materials or information. A wide range of available authentication technologies can be employed, including any of the token methods of Levels 3 or 4, as well as passwords. Successful authentication requires that the claimant prove through a secure authentication protocol that the claimant controls the token.  Eavesdropper, replay, and online guessing attacks are prevented.  \nLong-term shared authentication secrets, if used, are never revealed to any party except the claimant and verifiers operated by the CSP; however, session (temporary) shared secrets may be provided to independent verifiers by the CSP. Approved cryptographic techniques are required. Assertions issued about claimants as a result of a successful authentication are either cryptographically authenticated by relying parties (using approved methods) or are obtained directly from a trusted party via a secure authentication protocol.   [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAN3: return "Indicator of medium digital quality or reliability of the digital reliability of verification and validation of the process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2] \r\n\n                        The degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies] \r\n\n                        Medium authentication level of assurance indicates that the relying party may have high confidence in the asserted identity's validity.  Level 3 is appropriate for transactions that need high confidence in the accuracy of the asserted identity. Level 3 provides multifactor remote network authentication. At this level, identity-proofing procedures require verification of identifying materials and information. Authentication is based on proof of possession of a key or password through a cryptographic protocol. Cryptographic strength mechanisms should protect the primary authentication token (a cryptographic key) against compromise by the protocol threats, including eavesdropper, replay, online guessing, verifier impersonation, and man-in-the-middle attacks. A minimum of two authentication factors is required. Three kinds of tokens may be used:\r\n\n                        \n                           \"soft\" cryptographic token, which has the key stored on a general-purpose computer, \n                           \"hard\" cryptographic token, which has the key stored on a special hardware device, and \n                           \"one-time password\" device token, which has symmetric key stored on a personal hardware device that is a cryptographic module validated at FIPS 140-2 Level 1 or higher. Validation testing of cryptographic modules and algorithms for conformance to Federal Information Processing Standard (FIPS) 140-2, Security Requirements for Cryptographic Modules, is managed by NIST.\n                        \n                        Authentication requires that the claimant prove control of the token through a secure authentication protocol. The token must be unlocked with a password or biometric representation, or a password must be used in a secure authentication protocol, to establish two-factor authentication. Long-term shared authentication secrets, if used, are never revealed to any party except the claimant and verifiers operated directly by the CSP; however, session (temporary) shared secrets may be provided to independent verifiers by the CSP. Approved cryptographic techniques are used for all operations.  Assertions issued about claimants as a result of a successful authentication are either cryptographically authenticated by relying parties (using approved methods) or are obtained directly from a trusted party via a secure authentication protocol.    [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAN4: return "Indicator of high digital quality or reliability of the digital reliability of the verification and validation process used to verify the claimed identity of an entity by securely associating an identifier and its authenticator. [Based on ISO 7498-2] \r\n\n                        The degree of confidence in the vetting process used to establish the identity of the individual to whom the credential was issued, and 2) the degree of confidence that the individual who uses the credential is the individual to whom the credential was issued. [OMB M-04-04 E-Authentication Guidance for Federal Agencies]\r\n\n                        High authentication level of assurance indicates that the relying party may have very high confidence in the asserted identity's validity. Level 4 is for transactions that need very high confidence in the accuracy of the asserted identity. Level 4 provides the highest practical assurance of remote network authentication. Authentication is based on proof of possession of a key through a cryptographic protocol. This level is similar to Level 3 except that only “hard� cryptographic tokens are allowed, cryptographic module validation requirements are strengthened, and subsequent critical data transfers must be authenticated via a key that is bound to the authentication process. The token should be a hardware cryptographic module validated at FIPS 140-2 Level 2 or higher overall with at least FIPS 140-2 Level 3 physical security. This level requires a physical token, which cannot readily be copied, and operator authentication at Level 2 and higher, and ensures good, two-factor remote authentication.\r\n\n                        Level 4 requires strong cryptographic authentication of all parties and all sensitive data transfers between the parties. Either public key or symmetric key technology may be used. Authentication requires that the claimant prove through a secure authentication protocol that the claimant controls the token. Eavesdropper, replay, online guessing, verifier impersonation, and man-in-the-middle attacks are prevented. Long-term shared authentication secrets, if used, are never revealed to any party except the claimant and verifiers operated directly by the CSP; however, session (temporary) shared secrets may be provided to independent verifiers by the CSP. Strong approved cryptographic techniques are used for all operations. All sensitive data transfers are cryptographically authenticated using keys bound to the authentication process.   [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAP: return "The value assigned as the indicator of the digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]";
+            case LOAAP1: return "Indicator of the low digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]\r\n\n                        Low authentication process level of assurance indicates that (1) long-term shared authentication secrets may be revealed to verifiers; and (2) assertions and assertion references require protection from manufacture/modification and reuse attacks.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAP2: return "Indicator of the basic digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]\r\n\n                        Basic authentication process level of assurance indicates that long-term shared authentication secrets are never revealed to any other party except Credential Service Provider (CSP).  Sessions (temporary) shared secrets may be provided to independent verifiers by CSP. Long-term shared authentication secrets, if used, are never revealed to any other party except Verifiers operated by the Credential Service Provider (CSP); however, session (temporary) shared secrets may be provided to independent Verifiers by the CSP. In addition to Level 1 requirements, assertions are resistant to disclosure, redirection, capture and substitution attacks. Approved cryptographic techniques are required.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAP3: return "Indicator of the medium digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]\r\n\n                        Medium authentication process level of assurance indicates that the token can be unlocked with password, biometric, or uses a secure multi-token authentication protocol to establish two-factor authentication.  Long-term shared authentication secrets are never revealed to any party except the Claimant and Credential Service Provider (CSP).\r\n\n                        Authentication requires that the Claimant prove, through a secure authentication protocol, that he or she controls the token. The Claimant unlocks the token with a password or biometric, or uses a secure multi-token authentication protocol to establish two-factor authentication (through proof of possession of a physical or software token in combination with some memorized secret knowledge). Long-term shared authentication secrets, if used, are never revealed to any party except the Claimant and Verifiers operated directly by the CSP; however, session (temporary) shared secrets may be provided to independent Verifiers by the CSP. In addition to Level 2 requirements, assertions are protected against repudiation by the Verifier.";
+            case LOAAP4: return "Indicator of the high digital quality or reliability of a defined sequence of messages between a Claimant and a Verifier that demonstrates that the Claimant has possession and control of a valid token to establish his/her identity, and optionally, demonstrates to the Claimant that he or she is communicating with the intended Verifier. [Based on NIST SP 800-63-2]\r\n\n                        High authentication process level of assurance indicates all sensitive data transfer are cryptographically authenticated using keys bound to the authentication process.  Level 4 requires strong cryptographic authentication of all communicating parties and all sensitive data transfers between the parties. Either public key or symmetric key technology may be used. Authentication requires that the Claimant prove through a secure authentication protocol that he or she controls the token. All protocol threats at Level 3 are required to be prevented at Level 4. Protocols shall also be strongly resistant to man-in-the-middle attacks. Long-term shared authentication secrets, if used, are never revealed to any party except the Claimant and Verifiers operated directly by the CSP; however, session (temporary) shared secrets may be provided to independent Verifiers by the CSP. Approved cryptographic techniques are used for all operations. All sensitive data transfers are cryptographically authenticated using keys bound to the authentication process.   [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAS: return "The value assigned as the indicator of the high quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.";
+            case LOAAS1: return "Indicator of the low quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.\r\n\n                        Assertions and assertion references require protection from modification and reuse attacks.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAS2: return "Indicator of the basic quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.\r\n\n                        Assertions are resistant to disclosure, redirection, capture and substitution attacks.  Approved cryptographic techniques are required for all assertion protocols.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAS3: return "Indicator of the medium quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.\r\n\n                        Assertions are protected against repudiation by the verifier.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOAAS4: return "Indicator of the high quality or reliability of the statement from a Verifier to a Relying Party (RP) that contains identity information about a Subscriber. Assertions may also contain verified attributes.\r\n\n                        Strongly resistant to man-in-the-middle attacks. \"Bearer\" assertions are not used.  \"Holder-of-key\" assertions may be used. RP maintains records of the assertions.  [Summary of the technical requirements specified in NIST SP 800-63 for the four levels of assurance defined by the December 2003, the Office of Management and Budget (OMB) issued Memorandum M-04-04, E-Authentication Guidance for Federal Agencies.]";
+            case LOACM: return "Indicator of the digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and its binding to an identity. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOACM1: return "Indicator of the low digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and its binding to an identity. Little or no confidence that an individual has maintained control over a token that has been entrusted to him or her and that that token has not been compromised. Characteristics include weak identity binding to tokens and plaintext passwords or secrets not transmitted across a network. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOACM2: return "Indicator of the basic digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and its binding to an identity.  Some confidence that an individual has maintained control over a token that has been entrusted to him or her and that that token has not been compromised. Characteristics include:  Verification must prove claimant controls the token; token resists online guessing, replay, session hijacking, and eavesdropping attacks; and  token is at least weakly resistant to man-in-the middle attacks. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOACM3: return "Indicator of the medium digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and it’s binding to an identity.  High confidence that an individual has maintained control over a token that has been entrusted to him or her and that that token has not been compromised. Characteristics  include: Ownership of token verifiable through security authentication protocol and credential management protects against verifier impersonation attacks. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOACM4: return "Indicator of the high digital quality or reliability of the activities performed by the Credential Service Provider (CSP) subsequent to electronic authentication registration, identity proofing and issuance activities to manage and safeguard the integrity of an issued credential and it’s binding to an identity.  Very high confidence that an individual has maintained control over a token that has been entrusted to him or her and that that token has not been compromised. Characteristics include: Verifier can prove control of token through a secure protocol; credential management supports strong cryptographic authentication of all communication parties. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOAID: return "Indicator of the quality or reliability in the process of ascertaining that an individual is who he or she claims to be.";
+            case LOAID1: return "Indicator of low digital quality or reliability in the process of ascertaining that an individual is who he or she claims to be.  Requires that a continuity of identity be maintained but does not require identity proofing. [Based on Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOAID2: return "Indicator of some digital quality or reliability in the process of ascertaining that that an individual is who he or she claims to be. Requires identity proofing via presentation of identifying material or information. [Based on Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOAID3: return "Indicator of high digital quality or reliability in the process of ascertaining that an individual is who he or she claims to be.  Requires identity proofing procedures for verification of identifying materials and information. [Based on Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOAID4: return "Indicator of high digital quality or reliability in the process of ascertaining that an individual is who he or she claims to be.  Requires identity proofing procedures for verification of identifying materials and information. [Based on Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOANR: return "Indicator of the digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]";
+            case LOANR1: return "Indicator of low digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]";
+            case LOANR2: return "Indicator of basic digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]";
+            case LOANR3: return "Indicator of medium digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]";
+            case LOANR4: return "Indicator of high digital quality or reliability in the process of establishing proof of delivery and proof of origin. [Based on ISO 7498-2]";
+            case LOARA: return "Indicator of the digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization’s security controls. [Based on NIST SP 800-63-2]";
+            case LOARA1: return "Indicator of low digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization’s security controls. [Based on NIST SP 800-63-2]";
+            case LOARA2: return "Indicator of basic digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization’s security controls. [Based on NIST SP 800-63-2]";
+            case LOARA3: return "Indicator of medium digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization’s security controls. [Based on NIST SP 800-63-2]";
+            case LOARA4: return "Indicator of high digital quality or reliability of the information exchange between network-connected devices where the information cannot be reliably protected end-to-end by a single organization's security controls. [Based on NIST SP 800-63-2]";
+            case LOATK: return "Indicator of the digital quality or reliability of single and multi-token authentication. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOATK1: return "Indicator of the low digital quality or reliability of single and multi-token authentication. Permits the use of any of the token methods of Levels 2, 3, or 4. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOATK2: return "Indicator of the basic digital quality or reliability of single and multi-token authentication. Requires single factor authentication using memorized secret tokens, pre-registered knowledge tokens, look-up secret tokens, out of band tokens, or single factor one-time password devices. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOATK3: return "Indicator of the medium digital quality or reliability of single and multi-token authentication. Requires two authentication factors. Provides multi-factor remote network authentication. Permits multi-factor software cryptographic token. [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case LOATK4: return "Indicator of the high digital quality or reliability of single and multi-token authentication. Requires token that is a hardware cryptographic module validated at validated at Federal Information Processing Standard (FIPS) 140-2 Level 2 or higher overall with at least FIPS 140-2 Level 3 physical security. Level 4 token requirements can be met by using the PIV authentication key of a FIPS 201 compliant Personal Identity Verification (PIV) Card.  [Electronic Authentication Guideline - Recommendations of the National Institute of Standards and Technology, NIST Special Publication 800-63-1, Dec 2011]";
+            case TRSTMECOBV: return "Values for security trust mechanism metadata observation made about a security architecture system component that supports enforcement of security policies.";
+            case _SEVERITYOBSERVATION: return "Potential values for observations of severity.";
+            case H: return "Indicates the condition may be life-threatening or has the potential to cause permanent injury.";
+            case L: return "Indicates the condition may result in some adverse consequences but is unlikely to substantially affect the situation of the subject.";
+            case M: return "Indicates the condition may result in noticable adverse adverse consequences but is unlikely to be life-threatening or cause permanent injury.";
+            case _SUBJECTBODYPOSITION: return "Contains codes for defining the observed, physical position of a subject, such as during an observation, assessment, collection of a specimen, etc.  ECG waveforms and vital signs, such as blood pressure, are two examples where a general, observed position typically needs to be noted.";
+            case LLD: return "Lying on the left side.";
+            case PRN: return "Lying with the front or ventral surface downward; lying face down.";
+            case RLD: return "Lying on the right side.";
+            case SFWL: return "A semi-sitting position in bed with the head of the bed elevated approximately 45 degrees.";
+            case SIT: return "Resting the body on the buttocks, typically with upper torso erect or semi erect.";
+            case STN: return "To be stationary, upright, vertical, on one's legs.";
+            case SUP: return "supine";
+            case RTRD: return "Lying on the back, on an inclined plane, typically about 30-45 degrees with head raised and feet lowered.";
+            case TRD: return "Lying on the back, on an inclined plane, typically about 30-45 degrees, with  head lowered and feet raised.";
+            case _VERIFICATIONOUTCOMEVALUE: return "Values for observations of verification act results\r\n\n                        \n                           Examples: Verified, not verified, verified with warning.";
+            case ACT: return "Definition: Coverage is in effect for healthcare service(s) and/or product(s).";
+            case ACTPEND: return "Definition: Coverage is in effect for healthcare service(s) and/or product(s) - Pending Investigation";
+            case ELG: return "Definition: Coverage is in effect for healthcare service(s) and/or product(s).";
+            case INACT: return "Definition: Coverage is not in effect for healthcare service(s) and/or product(s).";
+            case INPNDINV: return "Definition: Coverage is not in effect for healthcare service(s) and/or product(s) - Pending Investigation.";
+            case INPNDUPD: return "Definition: Coverage is not in effect for healthcare service(s) and/or product(s) - Pending Eligibility Update.";
+            case NELG: return "Definition: Coverage is not in effect for healthcare service(s) and/or product(s). May optionally include reasons for the ineligibility.";
+            case _ANNOTATIONVALUE: return "AnnotationValue";
+            case _COMMONCLINICALOBSERVATIONVALUE: return "Description:Used in a patient care message to value simple clinical (non-lab) observations.";
+            case _INDIVIDUALCASESAFETYREPORTVALUEDOMAINS: return "This domain is established as a parent to a variety of value domains being defined to support the communication of Individual Case Safety Reports to regulatory bodies. Arguably, this aggregation is not taxonomically pure, but the grouping will facilitate the management of these domains.";
+            case _INDICATIONVALUE: return "Indicates the specific observation result which is the reason for the action (prescription, lab test, etc.). E.g. Headache, Ear infection, planned diagnostic image (requiring contrast agent), etc.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ACTCOVERAGEASSESSMENTOBSERVATIONVALUE: return "ActCoverageAssessmentObservationValue";
+            case _ACTFINANCIALSTATUSOBSERVATIONVALUE: return "ActFinancialStatusObservationValue";
+            case ASSET: return "asset";
+            case ANNUITY: return "annuity";
+            case PROP: return "real property";
+            case RETACCT: return "retirement investment account";
+            case TRUST: return "trust";
+            case INCOME: return "income";
+            case CHILD: return "child support";
+            case DISABL: return "disability pay";
+            case INVEST: return "investment income";
+            case PAY: return "paid employment";
+            case RETIRE: return "retirement pay";
+            case SPOUSAL: return "spousal or partner support";
+            case SUPPLE: return "income supplement";
+            case TAX: return "tax obligation";
+            case LIVEXP: return "living expense";
+            case CLOTH: return "clothing expense";
+            case FOOD: return "food expense";
+            case HEALTH: return "health expense";
+            case HOUSE: return "household expense";
+            case LEGAL: return "legal expense";
+            case MORTG: return "mortgage";
+            case RENT: return "rent";
+            case SUNDRY: return "sundry expense";
+            case TRANS: return "transportation expense";
+            case UTIL: return "utility expense";
+            case ELSTAT: return "eligibility indicator";
+            case ADOPT: return "adoption document";
+            case BTHCERT: return "birth certificate";
+            case CCOC: return "creditable coverage document";
+            case DRLIC: return "driver license";
+            case FOSTER: return "foster child document";
+            case MEMBER: return "program or policy member";
+            case MIL: return "military identification";
+            case MRGCERT: return "marriage certificate";
+            case PASSPORT: return "passport";
+            case STUDENRL: return "student enrollment";
+            case HLSTAT: return "health status";
+            case DISABLE: return "disabled";
+            case DRUG: return "drug use";
+            case IVDRG: return "IV drug use";
+            case PGNT: return "pregnant";
+            case LIVDEP: return "living dependency";
+            case RELDEP: return "relative dependent";
+            case SPSDEP: return "spouse dependent";
+            case URELDEP: return "unrelated person dependent";
+            case LIVSIT: return "living situation";
+            case ALONE: return "alone";
+            case DEPCHD: return "dependent children";
+            case DEPSPS: return "dependent spouse";
+            case DEPYGCHD: return "dependent young children";
+            case FAM: return "live with family";
+            case RELAT: return "relative";
+            case SPS: return "spouse only";
+            case UNREL: return "unrelated person";
+            case SOECSTAT: return "socio economic status";
+            case ABUSE: return "abuse victim";
+            case HMLESS: return "homeless";
+            case ILGIM: return "illegal immigrant";
+            case INCAR: return "incarcerated";
+            case PROB: return "probation";
+            case REFUG: return "refugee";
+            case UNEMPL: return "unemployed";
+            case _ALLERGYTESTVALUE: return "AllergyTestValue";
+            case A0: return "no reaction";
+            case A1: return "minimal reaction";
+            case A2: return "mild reaction";
+            case A3: return "moderate reaction";
+            case A4: return "severe reaction";
+            case _COMPOSITEMEASURESCORING: return "CompositeMeasureScoring";
+            case ALLORNONESCR: return "All-or-nothing Scoring";
+            case LINEARSCR: return "Linear Scoring";
+            case OPPORSCR: return "Opportunity Scoring";
+            case WEIGHTSCR: return "Weighted Scoring";
+            case _COVERAGELIMITOBSERVATIONVALUE: return "CoverageLimitObservationValue";
+            case _COVERAGELEVELOBSERVATIONVALUE: return "CoverageLevelObservationValue";
+            case ADC: return "adult child";
+            case CHD: return "child";
+            case DEP: return "dependent";
+            case DP: return "domestic partner";
+            case ECH: return "employee";
+            case FLY: return "family coverage";
+            case IND: return "individual";
+            case SSP: return "same sex partner";
+            case _CRITICALITYOBSERVATIONVALUE: return "CriticalityObservationValue";
+            case CRITH: return "high criticality";
+            case CRITL: return "low criticality";
+            case CRITU: return "unable to assess criticality";
+            case _GENETICOBSERVATIONVALUE: return "GeneticObservationValue";
+            case HOMOZYGOTE: return "HOMO";
+            case _OBSERVATIONMEASURESCORING: return "ObservationMeasureScoring";
+            case COHORT: return "cohort measure scoring";
+            case CONTVAR: return "continuous variable measure scoring";
+            case PROPOR: return "proportion measure scoring";
+            case RATIO: return "ratio measure scoring";
+            case _OBSERVATIONMEASURETYPE: return "ObservationMeasureType";
+            case COMPOSITE: return "composite measure type";
+            case EFFICIENCY: return "efficiency measure type";
+            case EXPERIENCE: return "experience measure type";
+            case OUTCOME: return "outcome measure type";
+            case PROCESS: return "process measure type";
+            case RESOURCE: return "resource use measure type";
+            case STRUCTURE: return "structure measure type";
+            case _OBSERVATIONPOPULATIONINCLUSION: return "ObservationPopulationInclusion";
+            case DENEX: return "denominator exclusions";
+            case DENEXCEP: return "denominator exceptions";
+            case DENOM: return "denominator";
+            case IP: return "initial population";
+            case IPP: return "initial patient population";
+            case MSRPOPL: return "measure population";
+            case NUMER: return "numerator";
+            case NUMEX: return "numerator exclusions";
+            case _PARTIALCOMPLETIONSCALE: return "PartialCompletionScale";
+            case G: return "Great extent";
+            case LE: return "Large extent";
+            case ME: return "Medium extent";
+            case MI: return "Minimal extent";
+            case N: return "None";
+            case S: return "Some extent";
+            case _SECURITYOBSERVATIONVALUE: return "SecurityObservationValue";
+            case _SECINTOBV: return "security integrity";
+            case _SECALTINTOBV: return "alteration integrity";
+            case ABSTRED: return "abstracted";
+            case AGGRED: return "aggregated";
+            case ANONYED: return "anonymized";
+            case MAPPED: return "mapped";
+            case MASKED: return "masked";
+            case PSEUDED: return "pseudonymized";
+            case REDACTED: return "redacted";
+            case SUBSETTED: return "subsetted";
+            case SYNTAC: return "syntactic transform";
+            case TRSLT: return "translated";
+            case VERSIONED: return "versioned";
+            case _SECDATINTOBV: return "data integrity";
+            case CRYTOHASH: return "cryptographic hash function";
+            case DIGSIG: return "digital signature";
+            case _SECINTCONOBV: return "integrity confidence";
+            case HRELIABLE: return "highly reliable";
+            case RELIABLE: return "reliable";
+            case UNCERTREL: return "uncertain reliability";
+            case UNRELIABLE: return "unreliable";
+            case _SECINTPRVOBV: return "provenance";
+            case _SECINTPRVABOBV: return "provenance asserted by";
+            case CLINAST: return "clinician asserted";
+            case DEVAST: return "device asserted";
+            case HCPAST: return "healthcare professional asserted";
+            case PACQAST: return "patient acquaintance asserted";
+            case PATAST: return "patient asserted";
+            case PAYAST: return "payer asserted";
+            case PROAST: return "professional asserted";
+            case SDMAST: return "substitute decision maker asserted";
+            case _SECINTPRVRBOBV: return "provenance reported by";
+            case CLINRPT: return "clinician reported";
+            case DEVRPT: return "device reported";
+            case HCPRPT: return "healthcare professional reported";
+            case PACQRPT: return "patient acquaintance reported";
+            case PATRPT: return "patient reported";
+            case PAYRPT: return "payer reported";
+            case PRORPT: return "professional reported";
+            case SDMRPT: return "substitute decision maker reported";
+            case SECTRSTOBV: return "security trust observation";
+            case TRSTACCRDOBV: return "trust accreditation observation";
+            case TRSTAGREOBV: return "trust agreement observation";
+            case TRSTCERTOBV: return "trust certificate observation";
+            case TRSTLOAOBV: return "trust assurance observation";
+            case LOAAN: return "authentication level of assurance value";
+            case LOAAN1: return "low authentication level of assurance";
+            case LOAAN2: return "basic authentication level of assurance";
+            case LOAAN3: return "medium authentication level of assurance";
+            case LOAAN4: return "high authentication level of assurance";
+            case LOAAP: return "authentication process level of assurance value";
+            case LOAAP1: return "low authentication process level of assurance";
+            case LOAAP2: return "basic authentication process level of assurance";
+            case LOAAP3: return "medium authentication process level of assurance";
+            case LOAAP4: return "high authentication process level of assurance";
+            case LOAAS: return "assertion level of assurance value";
+            case LOAAS1: return "low assertion level of assurance";
+            case LOAAS2: return "basic assertion level of assurance";
+            case LOAAS3: return "medium assertion level of assurance";
+            case LOAAS4: return "high assertion level of assurance";
+            case LOACM: return "token and credential management level of assurance value)";
+            case LOACM1: return "low token and credential management level of assurance";
+            case LOACM2: return "basic token and credential management level of assurance";
+            case LOACM3: return "medium token and credential management level of assurance";
+            case LOACM4: return "high token and credential management level of assurance";
+            case LOAID: return "identity proofing level of assurance";
+            case LOAID1: return "low identity proofing level of assurance";
+            case LOAID2: return "basic identity proofing level of assurance";
+            case LOAID3: return "medium identity proofing level of assurance";
+            case LOAID4: return "high identity proofing level of assurance";
+            case LOANR: return "non-repudiation level of assurance value";
+            case LOANR1: return "low non-repudiation level of assurance";
+            case LOANR2: return "basic non-repudiation level of assurance";
+            case LOANR3: return "medium non-repudiation level of assurance";
+            case LOANR4: return "high non-repudiation level of assurance";
+            case LOARA: return "remote access level of assurance value";
+            case LOARA1: return "low remote access level of assurance";
+            case LOARA2: return "basic remote access level of assurance";
+            case LOARA3: return "medium remote access level of assurance";
+            case LOARA4: return "high remote access level of assurance";
+            case LOATK: return "token level of assurance value";
+            case LOATK1: return "low token level of assurance";
+            case LOATK2: return "basic token level of assurance";
+            case LOATK3: return "medium token level of assurance";
+            case LOATK4: return "high token level of assurance";
+            case TRSTMECOBV: return "none supplied 6";
+            case _SEVERITYOBSERVATION: return "SeverityObservation";
+            case H: return "High";
+            case L: return "Low";
+            case M: return "Moderate";
+            case _SUBJECTBODYPOSITION: return "_SubjectBodyPosition";
+            case LLD: return "left lateral decubitus";
+            case PRN: return "prone";
+            case RLD: return "right lateral decubitus";
+            case SFWL: return "Semi-Fowler's";
+            case SIT: return "sitting";
+            case STN: return "standing";
+            case SUP: return "supine";
+            case RTRD: return "reverse trendelenburg";
+            case TRD: return "trendelenburg";
+            case _VERIFICATIONOUTCOMEVALUE: return "verification outcome";
+            case ACT: return "active coverage";
+            case ACTPEND: return "active - pending investigation";
+            case ELG: return "eligible";
+            case INACT: return "inactive";
+            case INPNDINV: return "inactive - pending investigation";
+            case INPNDUPD: return "inactive - pending eligibility update";
+            case NELG: return "not eligible";
+            case _ANNOTATIONVALUE: return "AnnotationValue";
+            case _COMMONCLINICALOBSERVATIONVALUE: return "common clinical observation";
+            case _INDIVIDUALCASESAFETYREPORTVALUEDOMAINS: return "Individual Case Safety Report Value Domains";
+            case _INDICATIONVALUE: return "IndicationValue";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationValueEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationValueEnumFactory.java
new file mode 100644
index 00000000000..6b1e5b2ff5f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ObservationValueEnumFactory.java
@@ -0,0 +1,986 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ObservationValueEnumFactory implements EnumFactory {
+
+  public V3ObservationValue fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ActCoverageAssessmentObservationValue".equals(codeString))
+      return V3ObservationValue._ACTCOVERAGEASSESSMENTOBSERVATIONVALUE;
+    if ("_ActFinancialStatusObservationValue".equals(codeString))
+      return V3ObservationValue._ACTFINANCIALSTATUSOBSERVATIONVALUE;
+    if ("ASSET".equals(codeString))
+      return V3ObservationValue.ASSET;
+    if ("ANNUITY".equals(codeString))
+      return V3ObservationValue.ANNUITY;
+    if ("PROP".equals(codeString))
+      return V3ObservationValue.PROP;
+    if ("RETACCT".equals(codeString))
+      return V3ObservationValue.RETACCT;
+    if ("TRUST".equals(codeString))
+      return V3ObservationValue.TRUST;
+    if ("INCOME".equals(codeString))
+      return V3ObservationValue.INCOME;
+    if ("CHILD".equals(codeString))
+      return V3ObservationValue.CHILD;
+    if ("DISABL".equals(codeString))
+      return V3ObservationValue.DISABL;
+    if ("INVEST".equals(codeString))
+      return V3ObservationValue.INVEST;
+    if ("PAY".equals(codeString))
+      return V3ObservationValue.PAY;
+    if ("RETIRE".equals(codeString))
+      return V3ObservationValue.RETIRE;
+    if ("SPOUSAL".equals(codeString))
+      return V3ObservationValue.SPOUSAL;
+    if ("SUPPLE".equals(codeString))
+      return V3ObservationValue.SUPPLE;
+    if ("TAX".equals(codeString))
+      return V3ObservationValue.TAX;
+    if ("LIVEXP".equals(codeString))
+      return V3ObservationValue.LIVEXP;
+    if ("CLOTH".equals(codeString))
+      return V3ObservationValue.CLOTH;
+    if ("FOOD".equals(codeString))
+      return V3ObservationValue.FOOD;
+    if ("HEALTH".equals(codeString))
+      return V3ObservationValue.HEALTH;
+    if ("HOUSE".equals(codeString))
+      return V3ObservationValue.HOUSE;
+    if ("LEGAL".equals(codeString))
+      return V3ObservationValue.LEGAL;
+    if ("MORTG".equals(codeString))
+      return V3ObservationValue.MORTG;
+    if ("RENT".equals(codeString))
+      return V3ObservationValue.RENT;
+    if ("SUNDRY".equals(codeString))
+      return V3ObservationValue.SUNDRY;
+    if ("TRANS".equals(codeString))
+      return V3ObservationValue.TRANS;
+    if ("UTIL".equals(codeString))
+      return V3ObservationValue.UTIL;
+    if ("ELSTAT".equals(codeString))
+      return V3ObservationValue.ELSTAT;
+    if ("ADOPT".equals(codeString))
+      return V3ObservationValue.ADOPT;
+    if ("BTHCERT".equals(codeString))
+      return V3ObservationValue.BTHCERT;
+    if ("CCOC".equals(codeString))
+      return V3ObservationValue.CCOC;
+    if ("DRLIC".equals(codeString))
+      return V3ObservationValue.DRLIC;
+    if ("FOSTER".equals(codeString))
+      return V3ObservationValue.FOSTER;
+    if ("MEMBER".equals(codeString))
+      return V3ObservationValue.MEMBER;
+    if ("MIL".equals(codeString))
+      return V3ObservationValue.MIL;
+    if ("MRGCERT".equals(codeString))
+      return V3ObservationValue.MRGCERT;
+    if ("PASSPORT".equals(codeString))
+      return V3ObservationValue.PASSPORT;
+    if ("STUDENRL".equals(codeString))
+      return V3ObservationValue.STUDENRL;
+    if ("HLSTAT".equals(codeString))
+      return V3ObservationValue.HLSTAT;
+    if ("DISABLE".equals(codeString))
+      return V3ObservationValue.DISABLE;
+    if ("DRUG".equals(codeString))
+      return V3ObservationValue.DRUG;
+    if ("IVDRG".equals(codeString))
+      return V3ObservationValue.IVDRG;
+    if ("PGNT".equals(codeString))
+      return V3ObservationValue.PGNT;
+    if ("LIVDEP".equals(codeString))
+      return V3ObservationValue.LIVDEP;
+    if ("RELDEP".equals(codeString))
+      return V3ObservationValue.RELDEP;
+    if ("SPSDEP".equals(codeString))
+      return V3ObservationValue.SPSDEP;
+    if ("URELDEP".equals(codeString))
+      return V3ObservationValue.URELDEP;
+    if ("LIVSIT".equals(codeString))
+      return V3ObservationValue.LIVSIT;
+    if ("ALONE".equals(codeString))
+      return V3ObservationValue.ALONE;
+    if ("DEPCHD".equals(codeString))
+      return V3ObservationValue.DEPCHD;
+    if ("DEPSPS".equals(codeString))
+      return V3ObservationValue.DEPSPS;
+    if ("DEPYGCHD".equals(codeString))
+      return V3ObservationValue.DEPYGCHD;
+    if ("FAM".equals(codeString))
+      return V3ObservationValue.FAM;
+    if ("RELAT".equals(codeString))
+      return V3ObservationValue.RELAT;
+    if ("SPS".equals(codeString))
+      return V3ObservationValue.SPS;
+    if ("UNREL".equals(codeString))
+      return V3ObservationValue.UNREL;
+    if ("SOECSTAT".equals(codeString))
+      return V3ObservationValue.SOECSTAT;
+    if ("ABUSE".equals(codeString))
+      return V3ObservationValue.ABUSE;
+    if ("HMLESS".equals(codeString))
+      return V3ObservationValue.HMLESS;
+    if ("ILGIM".equals(codeString))
+      return V3ObservationValue.ILGIM;
+    if ("INCAR".equals(codeString))
+      return V3ObservationValue.INCAR;
+    if ("PROB".equals(codeString))
+      return V3ObservationValue.PROB;
+    if ("REFUG".equals(codeString))
+      return V3ObservationValue.REFUG;
+    if ("UNEMPL".equals(codeString))
+      return V3ObservationValue.UNEMPL;
+    if ("_AllergyTestValue".equals(codeString))
+      return V3ObservationValue._ALLERGYTESTVALUE;
+    if ("A0".equals(codeString))
+      return V3ObservationValue.A0;
+    if ("A1".equals(codeString))
+      return V3ObservationValue.A1;
+    if ("A2".equals(codeString))
+      return V3ObservationValue.A2;
+    if ("A3".equals(codeString))
+      return V3ObservationValue.A3;
+    if ("A4".equals(codeString))
+      return V3ObservationValue.A4;
+    if ("_CompositeMeasureScoring".equals(codeString))
+      return V3ObservationValue._COMPOSITEMEASURESCORING;
+    if ("ALLORNONESCR".equals(codeString))
+      return V3ObservationValue.ALLORNONESCR;
+    if ("LINEARSCR".equals(codeString))
+      return V3ObservationValue.LINEARSCR;
+    if ("OPPORSCR".equals(codeString))
+      return V3ObservationValue.OPPORSCR;
+    if ("WEIGHTSCR".equals(codeString))
+      return V3ObservationValue.WEIGHTSCR;
+    if ("_CoverageLimitObservationValue".equals(codeString))
+      return V3ObservationValue._COVERAGELIMITOBSERVATIONVALUE;
+    if ("_CoverageLevelObservationValue".equals(codeString))
+      return V3ObservationValue._COVERAGELEVELOBSERVATIONVALUE;
+    if ("ADC".equals(codeString))
+      return V3ObservationValue.ADC;
+    if ("CHD".equals(codeString))
+      return V3ObservationValue.CHD;
+    if ("DEP".equals(codeString))
+      return V3ObservationValue.DEP;
+    if ("DP".equals(codeString))
+      return V3ObservationValue.DP;
+    if ("ECH".equals(codeString))
+      return V3ObservationValue.ECH;
+    if ("FLY".equals(codeString))
+      return V3ObservationValue.FLY;
+    if ("IND".equals(codeString))
+      return V3ObservationValue.IND;
+    if ("SSP".equals(codeString))
+      return V3ObservationValue.SSP;
+    if ("_CriticalityObservationValue".equals(codeString))
+      return V3ObservationValue._CRITICALITYOBSERVATIONVALUE;
+    if ("CRITH".equals(codeString))
+      return V3ObservationValue.CRITH;
+    if ("CRITL".equals(codeString))
+      return V3ObservationValue.CRITL;
+    if ("CRITU".equals(codeString))
+      return V3ObservationValue.CRITU;
+    if ("_GeneticObservationValue".equals(codeString))
+      return V3ObservationValue._GENETICOBSERVATIONVALUE;
+    if ("Homozygote".equals(codeString))
+      return V3ObservationValue.HOMOZYGOTE;
+    if ("_ObservationMeasureScoring".equals(codeString))
+      return V3ObservationValue._OBSERVATIONMEASURESCORING;
+    if ("COHORT".equals(codeString))
+      return V3ObservationValue.COHORT;
+    if ("CONTVAR".equals(codeString))
+      return V3ObservationValue.CONTVAR;
+    if ("PROPOR".equals(codeString))
+      return V3ObservationValue.PROPOR;
+    if ("RATIO".equals(codeString))
+      return V3ObservationValue.RATIO;
+    if ("_ObservationMeasureType".equals(codeString))
+      return V3ObservationValue._OBSERVATIONMEASURETYPE;
+    if ("COMPOSITE".equals(codeString))
+      return V3ObservationValue.COMPOSITE;
+    if ("EFFICIENCY".equals(codeString))
+      return V3ObservationValue.EFFICIENCY;
+    if ("EXPERIENCE".equals(codeString))
+      return V3ObservationValue.EXPERIENCE;
+    if ("OUTCOME".equals(codeString))
+      return V3ObservationValue.OUTCOME;
+    if ("PROCESS".equals(codeString))
+      return V3ObservationValue.PROCESS;
+    if ("RESOURCE".equals(codeString))
+      return V3ObservationValue.RESOURCE;
+    if ("STRUCTURE".equals(codeString))
+      return V3ObservationValue.STRUCTURE;
+    if ("_ObservationPopulationInclusion".equals(codeString))
+      return V3ObservationValue._OBSERVATIONPOPULATIONINCLUSION;
+    if ("DENEX".equals(codeString))
+      return V3ObservationValue.DENEX;
+    if ("DENEXCEP".equals(codeString))
+      return V3ObservationValue.DENEXCEP;
+    if ("DENOM".equals(codeString))
+      return V3ObservationValue.DENOM;
+    if ("IP".equals(codeString))
+      return V3ObservationValue.IP;
+    if ("IPP".equals(codeString))
+      return V3ObservationValue.IPP;
+    if ("MSRPOPL".equals(codeString))
+      return V3ObservationValue.MSRPOPL;
+    if ("NUMER".equals(codeString))
+      return V3ObservationValue.NUMER;
+    if ("NUMEX".equals(codeString))
+      return V3ObservationValue.NUMEX;
+    if ("_PartialCompletionScale".equals(codeString))
+      return V3ObservationValue._PARTIALCOMPLETIONSCALE;
+    if ("G".equals(codeString))
+      return V3ObservationValue.G;
+    if ("LE".equals(codeString))
+      return V3ObservationValue.LE;
+    if ("ME".equals(codeString))
+      return V3ObservationValue.ME;
+    if ("MI".equals(codeString))
+      return V3ObservationValue.MI;
+    if ("N".equals(codeString))
+      return V3ObservationValue.N;
+    if ("S".equals(codeString))
+      return V3ObservationValue.S;
+    if ("_SecurityObservationValue".equals(codeString))
+      return V3ObservationValue._SECURITYOBSERVATIONVALUE;
+    if ("_SECINTOBV".equals(codeString))
+      return V3ObservationValue._SECINTOBV;
+    if ("_SECALTINTOBV".equals(codeString))
+      return V3ObservationValue._SECALTINTOBV;
+    if ("ABSTRED".equals(codeString))
+      return V3ObservationValue.ABSTRED;
+    if ("AGGRED".equals(codeString))
+      return V3ObservationValue.AGGRED;
+    if ("ANONYED".equals(codeString))
+      return V3ObservationValue.ANONYED;
+    if ("MAPPED".equals(codeString))
+      return V3ObservationValue.MAPPED;
+    if ("MASKED".equals(codeString))
+      return V3ObservationValue.MASKED;
+    if ("PSEUDED".equals(codeString))
+      return V3ObservationValue.PSEUDED;
+    if ("REDACTED".equals(codeString))
+      return V3ObservationValue.REDACTED;
+    if ("SUBSETTED".equals(codeString))
+      return V3ObservationValue.SUBSETTED;
+    if ("SYNTAC".equals(codeString))
+      return V3ObservationValue.SYNTAC;
+    if ("TRSLT".equals(codeString))
+      return V3ObservationValue.TRSLT;
+    if ("VERSIONED".equals(codeString))
+      return V3ObservationValue.VERSIONED;
+    if ("_SECDATINTOBV".equals(codeString))
+      return V3ObservationValue._SECDATINTOBV;
+    if ("CRYTOHASH".equals(codeString))
+      return V3ObservationValue.CRYTOHASH;
+    if ("DIGSIG".equals(codeString))
+      return V3ObservationValue.DIGSIG;
+    if ("_SECINTCONOBV".equals(codeString))
+      return V3ObservationValue._SECINTCONOBV;
+    if ("HRELIABLE".equals(codeString))
+      return V3ObservationValue.HRELIABLE;
+    if ("RELIABLE".equals(codeString))
+      return V3ObservationValue.RELIABLE;
+    if ("UNCERTREL".equals(codeString))
+      return V3ObservationValue.UNCERTREL;
+    if ("UNRELIABLE".equals(codeString))
+      return V3ObservationValue.UNRELIABLE;
+    if ("_SECINTPRVOBV".equals(codeString))
+      return V3ObservationValue._SECINTPRVOBV;
+    if ("_SECINTPRVABOBV".equals(codeString))
+      return V3ObservationValue._SECINTPRVABOBV;
+    if ("CLINAST".equals(codeString))
+      return V3ObservationValue.CLINAST;
+    if ("DEVAST".equals(codeString))
+      return V3ObservationValue.DEVAST;
+    if ("HCPAST".equals(codeString))
+      return V3ObservationValue.HCPAST;
+    if ("PACQAST".equals(codeString))
+      return V3ObservationValue.PACQAST;
+    if ("PATAST".equals(codeString))
+      return V3ObservationValue.PATAST;
+    if ("PAYAST".equals(codeString))
+      return V3ObservationValue.PAYAST;
+    if ("PROAST".equals(codeString))
+      return V3ObservationValue.PROAST;
+    if ("SDMAST".equals(codeString))
+      return V3ObservationValue.SDMAST;
+    if ("_SECINTPRVRBOBV".equals(codeString))
+      return V3ObservationValue._SECINTPRVRBOBV;
+    if ("CLINRPT".equals(codeString))
+      return V3ObservationValue.CLINRPT;
+    if ("DEVRPT".equals(codeString))
+      return V3ObservationValue.DEVRPT;
+    if ("HCPRPT".equals(codeString))
+      return V3ObservationValue.HCPRPT;
+    if ("PACQRPT".equals(codeString))
+      return V3ObservationValue.PACQRPT;
+    if ("PATRPT".equals(codeString))
+      return V3ObservationValue.PATRPT;
+    if ("PAYRPT".equals(codeString))
+      return V3ObservationValue.PAYRPT;
+    if ("PRORPT".equals(codeString))
+      return V3ObservationValue.PRORPT;
+    if ("SDMRPT".equals(codeString))
+      return V3ObservationValue.SDMRPT;
+    if ("SECTRSTOBV".equals(codeString))
+      return V3ObservationValue.SECTRSTOBV;
+    if ("TRSTACCRDOBV".equals(codeString))
+      return V3ObservationValue.TRSTACCRDOBV;
+    if ("TRSTAGREOBV".equals(codeString))
+      return V3ObservationValue.TRSTAGREOBV;
+    if ("TRSTCERTOBV".equals(codeString))
+      return V3ObservationValue.TRSTCERTOBV;
+    if ("TRSTLOAOBV".equals(codeString))
+      return V3ObservationValue.TRSTLOAOBV;
+    if ("LOAAN".equals(codeString))
+      return V3ObservationValue.LOAAN;
+    if ("LOAAN1".equals(codeString))
+      return V3ObservationValue.LOAAN1;
+    if ("LOAAN2".equals(codeString))
+      return V3ObservationValue.LOAAN2;
+    if ("LOAAN3".equals(codeString))
+      return V3ObservationValue.LOAAN3;
+    if ("LOAAN4".equals(codeString))
+      return V3ObservationValue.LOAAN4;
+    if ("LOAAP".equals(codeString))
+      return V3ObservationValue.LOAAP;
+    if ("LOAAP1".equals(codeString))
+      return V3ObservationValue.LOAAP1;
+    if ("LOAAP2".equals(codeString))
+      return V3ObservationValue.LOAAP2;
+    if ("LOAAP3".equals(codeString))
+      return V3ObservationValue.LOAAP3;
+    if ("LOAAP4".equals(codeString))
+      return V3ObservationValue.LOAAP4;
+    if ("LOAAS".equals(codeString))
+      return V3ObservationValue.LOAAS;
+    if ("LOAAS1".equals(codeString))
+      return V3ObservationValue.LOAAS1;
+    if ("LOAAS2".equals(codeString))
+      return V3ObservationValue.LOAAS2;
+    if ("LOAAS3".equals(codeString))
+      return V3ObservationValue.LOAAS3;
+    if ("LOAAS4".equals(codeString))
+      return V3ObservationValue.LOAAS4;
+    if ("LOACM".equals(codeString))
+      return V3ObservationValue.LOACM;
+    if ("LOACM1".equals(codeString))
+      return V3ObservationValue.LOACM1;
+    if ("LOACM2".equals(codeString))
+      return V3ObservationValue.LOACM2;
+    if ("LOACM3".equals(codeString))
+      return V3ObservationValue.LOACM3;
+    if ("LOACM4".equals(codeString))
+      return V3ObservationValue.LOACM4;
+    if ("LOAID".equals(codeString))
+      return V3ObservationValue.LOAID;
+    if ("LOAID1".equals(codeString))
+      return V3ObservationValue.LOAID1;
+    if ("LOAID2".equals(codeString))
+      return V3ObservationValue.LOAID2;
+    if ("LOAID3".equals(codeString))
+      return V3ObservationValue.LOAID3;
+    if ("LOAID4".equals(codeString))
+      return V3ObservationValue.LOAID4;
+    if ("LOANR".equals(codeString))
+      return V3ObservationValue.LOANR;
+    if ("LOANR1".equals(codeString))
+      return V3ObservationValue.LOANR1;
+    if ("LOANR2".equals(codeString))
+      return V3ObservationValue.LOANR2;
+    if ("LOANR3".equals(codeString))
+      return V3ObservationValue.LOANR3;
+    if ("LOANR4".equals(codeString))
+      return V3ObservationValue.LOANR4;
+    if ("LOARA".equals(codeString))
+      return V3ObservationValue.LOARA;
+    if ("LOARA1".equals(codeString))
+      return V3ObservationValue.LOARA1;
+    if ("LOARA2".equals(codeString))
+      return V3ObservationValue.LOARA2;
+    if ("LOARA3".equals(codeString))
+      return V3ObservationValue.LOARA3;
+    if ("LOARA4".equals(codeString))
+      return V3ObservationValue.LOARA4;
+    if ("LOATK".equals(codeString))
+      return V3ObservationValue.LOATK;
+    if ("LOATK1".equals(codeString))
+      return V3ObservationValue.LOATK1;
+    if ("LOATK2".equals(codeString))
+      return V3ObservationValue.LOATK2;
+    if ("LOATK3".equals(codeString))
+      return V3ObservationValue.LOATK3;
+    if ("LOATK4".equals(codeString))
+      return V3ObservationValue.LOATK4;
+    if ("TRSTMECOBV".equals(codeString))
+      return V3ObservationValue.TRSTMECOBV;
+    if ("_SeverityObservation".equals(codeString))
+      return V3ObservationValue._SEVERITYOBSERVATION;
+    if ("H".equals(codeString))
+      return V3ObservationValue.H;
+    if ("L".equals(codeString))
+      return V3ObservationValue.L;
+    if ("M".equals(codeString))
+      return V3ObservationValue.M;
+    if ("_SubjectBodyPosition".equals(codeString))
+      return V3ObservationValue._SUBJECTBODYPOSITION;
+    if ("LLD".equals(codeString))
+      return V3ObservationValue.LLD;
+    if ("PRN".equals(codeString))
+      return V3ObservationValue.PRN;
+    if ("RLD".equals(codeString))
+      return V3ObservationValue.RLD;
+    if ("SFWL".equals(codeString))
+      return V3ObservationValue.SFWL;
+    if ("SIT".equals(codeString))
+      return V3ObservationValue.SIT;
+    if ("STN".equals(codeString))
+      return V3ObservationValue.STN;
+    if ("SUP".equals(codeString))
+      return V3ObservationValue.SUP;
+    if ("RTRD".equals(codeString))
+      return V3ObservationValue.RTRD;
+    if ("TRD".equals(codeString))
+      return V3ObservationValue.TRD;
+    if ("_VerificationOutcomeValue".equals(codeString))
+      return V3ObservationValue._VERIFICATIONOUTCOMEVALUE;
+    if ("ACT".equals(codeString))
+      return V3ObservationValue.ACT;
+    if ("ACTPEND".equals(codeString))
+      return V3ObservationValue.ACTPEND;
+    if ("ELG".equals(codeString))
+      return V3ObservationValue.ELG;
+    if ("INACT".equals(codeString))
+      return V3ObservationValue.INACT;
+    if ("INPNDINV".equals(codeString))
+      return V3ObservationValue.INPNDINV;
+    if ("INPNDUPD".equals(codeString))
+      return V3ObservationValue.INPNDUPD;
+    if ("NELG".equals(codeString))
+      return V3ObservationValue.NELG;
+    if ("_AnnotationValue".equals(codeString))
+      return V3ObservationValue._ANNOTATIONVALUE;
+    if ("_CommonClinicalObservationValue".equals(codeString))
+      return V3ObservationValue._COMMONCLINICALOBSERVATIONVALUE;
+    if ("_IndividualCaseSafetyReportValueDomains".equals(codeString))
+      return V3ObservationValue._INDIVIDUALCASESAFETYREPORTVALUEDOMAINS;
+    if ("_IndicationValue".equals(codeString))
+      return V3ObservationValue._INDICATIONVALUE;
+    throw new IllegalArgumentException("Unknown V3ObservationValue code '"+codeString+"'");
+  }
+
+  public String toCode(V3ObservationValue code) {
+    if (code == V3ObservationValue._ACTCOVERAGEASSESSMENTOBSERVATIONVALUE)
+      return "_ActCoverageAssessmentObservationValue";
+    if (code == V3ObservationValue._ACTFINANCIALSTATUSOBSERVATIONVALUE)
+      return "_ActFinancialStatusObservationValue";
+    if (code == V3ObservationValue.ASSET)
+      return "ASSET";
+    if (code == V3ObservationValue.ANNUITY)
+      return "ANNUITY";
+    if (code == V3ObservationValue.PROP)
+      return "PROP";
+    if (code == V3ObservationValue.RETACCT)
+      return "RETACCT";
+    if (code == V3ObservationValue.TRUST)
+      return "TRUST";
+    if (code == V3ObservationValue.INCOME)
+      return "INCOME";
+    if (code == V3ObservationValue.CHILD)
+      return "CHILD";
+    if (code == V3ObservationValue.DISABL)
+      return "DISABL";
+    if (code == V3ObservationValue.INVEST)
+      return "INVEST";
+    if (code == V3ObservationValue.PAY)
+      return "PAY";
+    if (code == V3ObservationValue.RETIRE)
+      return "RETIRE";
+    if (code == V3ObservationValue.SPOUSAL)
+      return "SPOUSAL";
+    if (code == V3ObservationValue.SUPPLE)
+      return "SUPPLE";
+    if (code == V3ObservationValue.TAX)
+      return "TAX";
+    if (code == V3ObservationValue.LIVEXP)
+      return "LIVEXP";
+    if (code == V3ObservationValue.CLOTH)
+      return "CLOTH";
+    if (code == V3ObservationValue.FOOD)
+      return "FOOD";
+    if (code == V3ObservationValue.HEALTH)
+      return "HEALTH";
+    if (code == V3ObservationValue.HOUSE)
+      return "HOUSE";
+    if (code == V3ObservationValue.LEGAL)
+      return "LEGAL";
+    if (code == V3ObservationValue.MORTG)
+      return "MORTG";
+    if (code == V3ObservationValue.RENT)
+      return "RENT";
+    if (code == V3ObservationValue.SUNDRY)
+      return "SUNDRY";
+    if (code == V3ObservationValue.TRANS)
+      return "TRANS";
+    if (code == V3ObservationValue.UTIL)
+      return "UTIL";
+    if (code == V3ObservationValue.ELSTAT)
+      return "ELSTAT";
+    if (code == V3ObservationValue.ADOPT)
+      return "ADOPT";
+    if (code == V3ObservationValue.BTHCERT)
+      return "BTHCERT";
+    if (code == V3ObservationValue.CCOC)
+      return "CCOC";
+    if (code == V3ObservationValue.DRLIC)
+      return "DRLIC";
+    if (code == V3ObservationValue.FOSTER)
+      return "FOSTER";
+    if (code == V3ObservationValue.MEMBER)
+      return "MEMBER";
+    if (code == V3ObservationValue.MIL)
+      return "MIL";
+    if (code == V3ObservationValue.MRGCERT)
+      return "MRGCERT";
+    if (code == V3ObservationValue.PASSPORT)
+      return "PASSPORT";
+    if (code == V3ObservationValue.STUDENRL)
+      return "STUDENRL";
+    if (code == V3ObservationValue.HLSTAT)
+      return "HLSTAT";
+    if (code == V3ObservationValue.DISABLE)
+      return "DISABLE";
+    if (code == V3ObservationValue.DRUG)
+      return "DRUG";
+    if (code == V3ObservationValue.IVDRG)
+      return "IVDRG";
+    if (code == V3ObservationValue.PGNT)
+      return "PGNT";
+    if (code == V3ObservationValue.LIVDEP)
+      return "LIVDEP";
+    if (code == V3ObservationValue.RELDEP)
+      return "RELDEP";
+    if (code == V3ObservationValue.SPSDEP)
+      return "SPSDEP";
+    if (code == V3ObservationValue.URELDEP)
+      return "URELDEP";
+    if (code == V3ObservationValue.LIVSIT)
+      return "LIVSIT";
+    if (code == V3ObservationValue.ALONE)
+      return "ALONE";
+    if (code == V3ObservationValue.DEPCHD)
+      return "DEPCHD";
+    if (code == V3ObservationValue.DEPSPS)
+      return "DEPSPS";
+    if (code == V3ObservationValue.DEPYGCHD)
+      return "DEPYGCHD";
+    if (code == V3ObservationValue.FAM)
+      return "FAM";
+    if (code == V3ObservationValue.RELAT)
+      return "RELAT";
+    if (code == V3ObservationValue.SPS)
+      return "SPS";
+    if (code == V3ObservationValue.UNREL)
+      return "UNREL";
+    if (code == V3ObservationValue.SOECSTAT)
+      return "SOECSTAT";
+    if (code == V3ObservationValue.ABUSE)
+      return "ABUSE";
+    if (code == V3ObservationValue.HMLESS)
+      return "HMLESS";
+    if (code == V3ObservationValue.ILGIM)
+      return "ILGIM";
+    if (code == V3ObservationValue.INCAR)
+      return "INCAR";
+    if (code == V3ObservationValue.PROB)
+      return "PROB";
+    if (code == V3ObservationValue.REFUG)
+      return "REFUG";
+    if (code == V3ObservationValue.UNEMPL)
+      return "UNEMPL";
+    if (code == V3ObservationValue._ALLERGYTESTVALUE)
+      return "_AllergyTestValue";
+    if (code == V3ObservationValue.A0)
+      return "A0";
+    if (code == V3ObservationValue.A1)
+      return "A1";
+    if (code == V3ObservationValue.A2)
+      return "A2";
+    if (code == V3ObservationValue.A3)
+      return "A3";
+    if (code == V3ObservationValue.A4)
+      return "A4";
+    if (code == V3ObservationValue._COMPOSITEMEASURESCORING)
+      return "_CompositeMeasureScoring";
+    if (code == V3ObservationValue.ALLORNONESCR)
+      return "ALLORNONESCR";
+    if (code == V3ObservationValue.LINEARSCR)
+      return "LINEARSCR";
+    if (code == V3ObservationValue.OPPORSCR)
+      return "OPPORSCR";
+    if (code == V3ObservationValue.WEIGHTSCR)
+      return "WEIGHTSCR";
+    if (code == V3ObservationValue._COVERAGELIMITOBSERVATIONVALUE)
+      return "_CoverageLimitObservationValue";
+    if (code == V3ObservationValue._COVERAGELEVELOBSERVATIONVALUE)
+      return "_CoverageLevelObservationValue";
+    if (code == V3ObservationValue.ADC)
+      return "ADC";
+    if (code == V3ObservationValue.CHD)
+      return "CHD";
+    if (code == V3ObservationValue.DEP)
+      return "DEP";
+    if (code == V3ObservationValue.DP)
+      return "DP";
+    if (code == V3ObservationValue.ECH)
+      return "ECH";
+    if (code == V3ObservationValue.FLY)
+      return "FLY";
+    if (code == V3ObservationValue.IND)
+      return "IND";
+    if (code == V3ObservationValue.SSP)
+      return "SSP";
+    if (code == V3ObservationValue._CRITICALITYOBSERVATIONVALUE)
+      return "_CriticalityObservationValue";
+    if (code == V3ObservationValue.CRITH)
+      return "CRITH";
+    if (code == V3ObservationValue.CRITL)
+      return "CRITL";
+    if (code == V3ObservationValue.CRITU)
+      return "CRITU";
+    if (code == V3ObservationValue._GENETICOBSERVATIONVALUE)
+      return "_GeneticObservationValue";
+    if (code == V3ObservationValue.HOMOZYGOTE)
+      return "Homozygote";
+    if (code == V3ObservationValue._OBSERVATIONMEASURESCORING)
+      return "_ObservationMeasureScoring";
+    if (code == V3ObservationValue.COHORT)
+      return "COHORT";
+    if (code == V3ObservationValue.CONTVAR)
+      return "CONTVAR";
+    if (code == V3ObservationValue.PROPOR)
+      return "PROPOR";
+    if (code == V3ObservationValue.RATIO)
+      return "RATIO";
+    if (code == V3ObservationValue._OBSERVATIONMEASURETYPE)
+      return "_ObservationMeasureType";
+    if (code == V3ObservationValue.COMPOSITE)
+      return "COMPOSITE";
+    if (code == V3ObservationValue.EFFICIENCY)
+      return "EFFICIENCY";
+    if (code == V3ObservationValue.EXPERIENCE)
+      return "EXPERIENCE";
+    if (code == V3ObservationValue.OUTCOME)
+      return "OUTCOME";
+    if (code == V3ObservationValue.PROCESS)
+      return "PROCESS";
+    if (code == V3ObservationValue.RESOURCE)
+      return "RESOURCE";
+    if (code == V3ObservationValue.STRUCTURE)
+      return "STRUCTURE";
+    if (code == V3ObservationValue._OBSERVATIONPOPULATIONINCLUSION)
+      return "_ObservationPopulationInclusion";
+    if (code == V3ObservationValue.DENEX)
+      return "DENEX";
+    if (code == V3ObservationValue.DENEXCEP)
+      return "DENEXCEP";
+    if (code == V3ObservationValue.DENOM)
+      return "DENOM";
+    if (code == V3ObservationValue.IP)
+      return "IP";
+    if (code == V3ObservationValue.IPP)
+      return "IPP";
+    if (code == V3ObservationValue.MSRPOPL)
+      return "MSRPOPL";
+    if (code == V3ObservationValue.NUMER)
+      return "NUMER";
+    if (code == V3ObservationValue.NUMEX)
+      return "NUMEX";
+    if (code == V3ObservationValue._PARTIALCOMPLETIONSCALE)
+      return "_PartialCompletionScale";
+    if (code == V3ObservationValue.G)
+      return "G";
+    if (code == V3ObservationValue.LE)
+      return "LE";
+    if (code == V3ObservationValue.ME)
+      return "ME";
+    if (code == V3ObservationValue.MI)
+      return "MI";
+    if (code == V3ObservationValue.N)
+      return "N";
+    if (code == V3ObservationValue.S)
+      return "S";
+    if (code == V3ObservationValue._SECURITYOBSERVATIONVALUE)
+      return "_SecurityObservationValue";
+    if (code == V3ObservationValue._SECINTOBV)
+      return "_SECINTOBV";
+    if (code == V3ObservationValue._SECALTINTOBV)
+      return "_SECALTINTOBV";
+    if (code == V3ObservationValue.ABSTRED)
+      return "ABSTRED";
+    if (code == V3ObservationValue.AGGRED)
+      return "AGGRED";
+    if (code == V3ObservationValue.ANONYED)
+      return "ANONYED";
+    if (code == V3ObservationValue.MAPPED)
+      return "MAPPED";
+    if (code == V3ObservationValue.MASKED)
+      return "MASKED";
+    if (code == V3ObservationValue.PSEUDED)
+      return "PSEUDED";
+    if (code == V3ObservationValue.REDACTED)
+      return "REDACTED";
+    if (code == V3ObservationValue.SUBSETTED)
+      return "SUBSETTED";
+    if (code == V3ObservationValue.SYNTAC)
+      return "SYNTAC";
+    if (code == V3ObservationValue.TRSLT)
+      return "TRSLT";
+    if (code == V3ObservationValue.VERSIONED)
+      return "VERSIONED";
+    if (code == V3ObservationValue._SECDATINTOBV)
+      return "_SECDATINTOBV";
+    if (code == V3ObservationValue.CRYTOHASH)
+      return "CRYTOHASH";
+    if (code == V3ObservationValue.DIGSIG)
+      return "DIGSIG";
+    if (code == V3ObservationValue._SECINTCONOBV)
+      return "_SECINTCONOBV";
+    if (code == V3ObservationValue.HRELIABLE)
+      return "HRELIABLE";
+    if (code == V3ObservationValue.RELIABLE)
+      return "RELIABLE";
+    if (code == V3ObservationValue.UNCERTREL)
+      return "UNCERTREL";
+    if (code == V3ObservationValue.UNRELIABLE)
+      return "UNRELIABLE";
+    if (code == V3ObservationValue._SECINTPRVOBV)
+      return "_SECINTPRVOBV";
+    if (code == V3ObservationValue._SECINTPRVABOBV)
+      return "_SECINTPRVABOBV";
+    if (code == V3ObservationValue.CLINAST)
+      return "CLINAST";
+    if (code == V3ObservationValue.DEVAST)
+      return "DEVAST";
+    if (code == V3ObservationValue.HCPAST)
+      return "HCPAST";
+    if (code == V3ObservationValue.PACQAST)
+      return "PACQAST";
+    if (code == V3ObservationValue.PATAST)
+      return "PATAST";
+    if (code == V3ObservationValue.PAYAST)
+      return "PAYAST";
+    if (code == V3ObservationValue.PROAST)
+      return "PROAST";
+    if (code == V3ObservationValue.SDMAST)
+      return "SDMAST";
+    if (code == V3ObservationValue._SECINTPRVRBOBV)
+      return "_SECINTPRVRBOBV";
+    if (code == V3ObservationValue.CLINRPT)
+      return "CLINRPT";
+    if (code == V3ObservationValue.DEVRPT)
+      return "DEVRPT";
+    if (code == V3ObservationValue.HCPRPT)
+      return "HCPRPT";
+    if (code == V3ObservationValue.PACQRPT)
+      return "PACQRPT";
+    if (code == V3ObservationValue.PATRPT)
+      return "PATRPT";
+    if (code == V3ObservationValue.PAYRPT)
+      return "PAYRPT";
+    if (code == V3ObservationValue.PRORPT)
+      return "PRORPT";
+    if (code == V3ObservationValue.SDMRPT)
+      return "SDMRPT";
+    if (code == V3ObservationValue.SECTRSTOBV)
+      return "SECTRSTOBV";
+    if (code == V3ObservationValue.TRSTACCRDOBV)
+      return "TRSTACCRDOBV";
+    if (code == V3ObservationValue.TRSTAGREOBV)
+      return "TRSTAGREOBV";
+    if (code == V3ObservationValue.TRSTCERTOBV)
+      return "TRSTCERTOBV";
+    if (code == V3ObservationValue.TRSTLOAOBV)
+      return "TRSTLOAOBV";
+    if (code == V3ObservationValue.LOAAN)
+      return "LOAAN";
+    if (code == V3ObservationValue.LOAAN1)
+      return "LOAAN1";
+    if (code == V3ObservationValue.LOAAN2)
+      return "LOAAN2";
+    if (code == V3ObservationValue.LOAAN3)
+      return "LOAAN3";
+    if (code == V3ObservationValue.LOAAN4)
+      return "LOAAN4";
+    if (code == V3ObservationValue.LOAAP)
+      return "LOAAP";
+    if (code == V3ObservationValue.LOAAP1)
+      return "LOAAP1";
+    if (code == V3ObservationValue.LOAAP2)
+      return "LOAAP2";
+    if (code == V3ObservationValue.LOAAP3)
+      return "LOAAP3";
+    if (code == V3ObservationValue.LOAAP4)
+      return "LOAAP4";
+    if (code == V3ObservationValue.LOAAS)
+      return "LOAAS";
+    if (code == V3ObservationValue.LOAAS1)
+      return "LOAAS1";
+    if (code == V3ObservationValue.LOAAS2)
+      return "LOAAS2";
+    if (code == V3ObservationValue.LOAAS3)
+      return "LOAAS3";
+    if (code == V3ObservationValue.LOAAS4)
+      return "LOAAS4";
+    if (code == V3ObservationValue.LOACM)
+      return "LOACM";
+    if (code == V3ObservationValue.LOACM1)
+      return "LOACM1";
+    if (code == V3ObservationValue.LOACM2)
+      return "LOACM2";
+    if (code == V3ObservationValue.LOACM3)
+      return "LOACM3";
+    if (code == V3ObservationValue.LOACM4)
+      return "LOACM4";
+    if (code == V3ObservationValue.LOAID)
+      return "LOAID";
+    if (code == V3ObservationValue.LOAID1)
+      return "LOAID1";
+    if (code == V3ObservationValue.LOAID2)
+      return "LOAID2";
+    if (code == V3ObservationValue.LOAID3)
+      return "LOAID3";
+    if (code == V3ObservationValue.LOAID4)
+      return "LOAID4";
+    if (code == V3ObservationValue.LOANR)
+      return "LOANR";
+    if (code == V3ObservationValue.LOANR1)
+      return "LOANR1";
+    if (code == V3ObservationValue.LOANR2)
+      return "LOANR2";
+    if (code == V3ObservationValue.LOANR3)
+      return "LOANR3";
+    if (code == V3ObservationValue.LOANR4)
+      return "LOANR4";
+    if (code == V3ObservationValue.LOARA)
+      return "LOARA";
+    if (code == V3ObservationValue.LOARA1)
+      return "LOARA1";
+    if (code == V3ObservationValue.LOARA2)
+      return "LOARA2";
+    if (code == V3ObservationValue.LOARA3)
+      return "LOARA3";
+    if (code == V3ObservationValue.LOARA4)
+      return "LOARA4";
+    if (code == V3ObservationValue.LOATK)
+      return "LOATK";
+    if (code == V3ObservationValue.LOATK1)
+      return "LOATK1";
+    if (code == V3ObservationValue.LOATK2)
+      return "LOATK2";
+    if (code == V3ObservationValue.LOATK3)
+      return "LOATK3";
+    if (code == V3ObservationValue.LOATK4)
+      return "LOATK4";
+    if (code == V3ObservationValue.TRSTMECOBV)
+      return "TRSTMECOBV";
+    if (code == V3ObservationValue._SEVERITYOBSERVATION)
+      return "_SeverityObservation";
+    if (code == V3ObservationValue.H)
+      return "H";
+    if (code == V3ObservationValue.L)
+      return "L";
+    if (code == V3ObservationValue.M)
+      return "M";
+    if (code == V3ObservationValue._SUBJECTBODYPOSITION)
+      return "_SubjectBodyPosition";
+    if (code == V3ObservationValue.LLD)
+      return "LLD";
+    if (code == V3ObservationValue.PRN)
+      return "PRN";
+    if (code == V3ObservationValue.RLD)
+      return "RLD";
+    if (code == V3ObservationValue.SFWL)
+      return "SFWL";
+    if (code == V3ObservationValue.SIT)
+      return "SIT";
+    if (code == V3ObservationValue.STN)
+      return "STN";
+    if (code == V3ObservationValue.SUP)
+      return "SUP";
+    if (code == V3ObservationValue.RTRD)
+      return "RTRD";
+    if (code == V3ObservationValue.TRD)
+      return "TRD";
+    if (code == V3ObservationValue._VERIFICATIONOUTCOMEVALUE)
+      return "_VerificationOutcomeValue";
+    if (code == V3ObservationValue.ACT)
+      return "ACT";
+    if (code == V3ObservationValue.ACTPEND)
+      return "ACTPEND";
+    if (code == V3ObservationValue.ELG)
+      return "ELG";
+    if (code == V3ObservationValue.INACT)
+      return "INACT";
+    if (code == V3ObservationValue.INPNDINV)
+      return "INPNDINV";
+    if (code == V3ObservationValue.INPNDUPD)
+      return "INPNDUPD";
+    if (code == V3ObservationValue.NELG)
+      return "NELG";
+    if (code == V3ObservationValue._ANNOTATIONVALUE)
+      return "_AnnotationValue";
+    if (code == V3ObservationValue._COMMONCLINICALOBSERVATIONVALUE)
+      return "_CommonClinicalObservationValue";
+    if (code == V3ObservationValue._INDIVIDUALCASESAFETYREPORTVALUEDOMAINS)
+      return "_IndividualCaseSafetyReportValueDomains";
+    if (code == V3ObservationValue._INDICATIONVALUE)
+      return "_IndicationValue";
+    return "?";
+  }
+
+    public String toSystem(V3ObservationValue code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3OrderableDrugForm.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3OrderableDrugForm.java
new file mode 100644
index 00000000000..49cad66a24d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3OrderableDrugForm.java
@@ -0,0 +1,1518 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3OrderableDrugForm {
+
+        /**
+         * AdministrableDrugForm
+         */
+        _ADMINISTRABLEDRUGFORM, 
+        /**
+         * Applicatorful
+         */
+        APPFUL, 
+        /**
+         * Drops
+         */
+        DROP, 
+        /**
+         * Nasal Drops
+         */
+        NDROP, 
+        /**
+         * Ophthalmic Drops
+         */
+        OPDROP, 
+        /**
+         * Oral Drops
+         */
+        ORDROP, 
+        /**
+         * Otic Drops
+         */
+        OTDROP, 
+        /**
+         * Puff
+         */
+        PUFF, 
+        /**
+         * Scoops
+         */
+        SCOOP, 
+        /**
+         * Sprays
+         */
+        SPRY, 
+        /**
+         * DispensableDrugForm
+         */
+        _DISPENSABLEDRUGFORM, 
+        /**
+         * Any elastic aeriform fluid in which the molecules are separated from one another and have free paths.
+         */
+        _GASDRUGFORM, 
+        /**
+         * Gas for Inhalation
+         */
+        GASINHL, 
+        /**
+         * GasLiquidMixture
+         */
+        _GASLIQUIDMIXTURE, 
+        /**
+         * Aerosol
+         */
+        AER, 
+        /**
+         * Breath Activated Inhaler
+         */
+        BAINHL, 
+        /**
+         * Inhalant Solution
+         */
+        INHLSOL, 
+        /**
+         * Metered Dose Inhaler
+         */
+        MDINHL, 
+        /**
+         * Nasal Spray
+         */
+        NASSPRY, 
+        /**
+         * Dermal Spray
+         */
+        DERMSPRY, 
+        /**
+         * Foam
+         */
+        FOAM, 
+        /**
+         * Foam with Applicator
+         */
+        FOAMAPL, 
+        /**
+         * Rectal foam
+         */
+        RECFORM, 
+        /**
+         * Vaginal foam
+         */
+        VAGFOAM, 
+        /**
+         * Vaginal foam with applicator
+         */
+        VAGFOAMAPL, 
+        /**
+         * Rectal Spray
+         */
+        RECSPRY, 
+        /**
+         * Vaginal Spray
+         */
+        VAGSPRY, 
+        /**
+         * GasSolidSpray
+         */
+        _GASSOLIDSPRAY, 
+        /**
+         * Inhalant
+         */
+        INHL, 
+        /**
+         * Breath Activated Powder Inhaler
+         */
+        BAINHLPWD, 
+        /**
+         * Inhalant Powder
+         */
+        INHLPWD, 
+        /**
+         * Metered Dose Powder Inhaler
+         */
+        MDINHLPWD, 
+        /**
+         * Nasal Inhalant
+         */
+        NASINHL, 
+        /**
+         * Oral Inhalant
+         */
+        ORINHL, 
+        /**
+         * Powder Spray
+         */
+        PWDSPRY, 
+        /**
+         * Spray with Adaptor
+         */
+        SPRYADAPT, 
+        /**
+         * A state of substance that is an intermediate one entered into as matter goes from solid to gas; liquids are also intermediate in that they have neither the orderliness of a crystal nor the randomness of a gas. (Note: This term should not be used to describe solutions, only pure chemicals in their liquid state.)
+         */
+        _LIQUID, 
+        /**
+         * Liquid Cleanser
+         */
+        LIQCLN, 
+        /**
+         * Medicated Liquid Soap
+         */
+        LIQSOAP, 
+        /**
+         * A liquid soap or detergent used to clean the hair and scalp and is often used as a vehicle for dermatologic agents.
+         */
+        SHMP, 
+        /**
+         * An unctuous, combustible substance which is liquid, or easily liquefiable, on warming, and is soluble in ether but insoluble in water. Such substances, depending on their origin, are classified as animal, mineral, or vegetable oils.
+         */
+        OIL, 
+        /**
+         * Topical Oil
+         */
+        TOPOIL, 
+        /**
+         * A liquid preparation that contains one or more chemical substances dissolved, i.e., molecularly dispersed, in a suitable solvent or mixture of mutually miscible solvents.
+         */
+        SOL, 
+        /**
+         * Intraperitoneal Solution
+         */
+        IPSOL, 
+        /**
+         * A sterile solution intended to bathe or flush open wounds or body cavities; they're used topically, never parenterally.
+         */
+        IRSOL, 
+        /**
+         * A liquid preparation, intended for the irrigative cleansing of the vagina, that is prepared from powders, liquid solutions, or liquid concentrates and contains one or more chemical substances dissolved in a suitable solvent or mutually miscible solvents.
+         */
+        DOUCHE, 
+        /**
+         * A rectal preparation for therapeutic, diagnostic, or nutritive purposes.
+         */
+        ENEMA, 
+        /**
+         * Ophthalmic Irrigation Solution
+         */
+        OPIRSOL, 
+        /**
+         * Intravenous Solution
+         */
+        IVSOL, 
+        /**
+         * Oral Solution
+         */
+        ORALSOL, 
+        /**
+         * A clear, pleasantly flavored, sweetened hydroalcoholic liquid containing dissolved medicinal agents; it is intended for oral use.
+         */
+        ELIXIR, 
+        /**
+         * An aqueous solution which is most often used for its deodorant, refreshing, or antiseptic effect.
+         */
+        RINSE, 
+        /**
+         * An oral solution containing high concentrations of sucrose or other sugars; the term has also been used to include any other liquid dosage form prepared in a sweet and viscid vehicle, including oral suspensions.
+         */
+        SYRUP, 
+        /**
+         * Rectal Solution
+         */
+        RECSOL, 
+        /**
+         * Topical Solution
+         */
+        TOPSOL, 
+        /**
+         * A solution or mixture of various substances in oil, alcoholic solutions of soap, or emulsions intended for external application.
+         */
+        LIN, 
+        /**
+         * Mucous Membrane Topical Solution
+         */
+        MUCTOPSOL, 
+        /**
+         * Tincture
+         */
+        TINC, 
+        /**
+         * A two-phase system in which one liquid is dispersed throughout another liquid in the form of small droplets.
+         */
+        _LIQUIDLIQUIDEMULSION, 
+        /**
+         * A semisolid dosage form containing one or more drug substances dissolved or dispersed in a suitable base; more recently, the term has been restricted to products consisting of oil-in-water emulsions or aqueous microcrystalline dispersions of long chain fatty acids or alcohols that are water washable and more cosmetically and aesthetically acceptable.
+         */
+        CRM, 
+        /**
+         * Nasal Cream
+         */
+        NASCRM, 
+        /**
+         * Ophthalmic Cream
+         */
+        OPCRM, 
+        /**
+         * Oral Cream
+         */
+        ORCRM, 
+        /**
+         * Otic Cream
+         */
+        OTCRM, 
+        /**
+         * Rectal Cream
+         */
+        RECCRM, 
+        /**
+         * Topical Cream
+         */
+        TOPCRM, 
+        /**
+         * Vaginal Cream
+         */
+        VAGCRM, 
+        /**
+         * Vaginal Cream with Applicator
+         */
+        VAGCRMAPL, 
+        /**
+         * The term "lotion" has been used to categorize many topical suspensions, solutions and emulsions intended for application to the skin.
+         */
+        LTN, 
+        /**
+         * Topical Lotion
+         */
+        TOPLTN, 
+        /**
+         * A semisolid preparation intended for external application to the skin or mucous membranes.
+         */
+        OINT, 
+        /**
+         * Nasal Ointment
+         */
+        NASOINT, 
+        /**
+         * Ointment with Applicator
+         */
+        OINTAPL, 
+        /**
+         * Ophthalmic Ointment
+         */
+        OPOINT, 
+        /**
+         * Otic Ointment
+         */
+        OTOINT, 
+        /**
+         * Rectal Ointment
+         */
+        RECOINT, 
+        /**
+         * Topical Ointment
+         */
+        TOPOINT, 
+        /**
+         * Vaginal Ointment
+         */
+        VAGOINT, 
+        /**
+         * Vaginal Ointment with Applicator
+         */
+        VAGOINTAPL, 
+        /**
+         * A liquid preparation which consists of solid particles dispersed throughout a liquid phase in which the particles are not soluble.
+         */
+        _LIQUIDSOLIDSUSPENSION, 
+        /**
+         * A semisolid system consisting of either suspensions made up of small inorganic particles or large organic molecules interpenetrated by a liquid.
+         */
+        GEL, 
+        /**
+         * Gel with Applicator
+         */
+        GELAPL, 
+        /**
+         * Nasal Gel
+         */
+        NASGEL, 
+        /**
+         * Ophthalmic Gel
+         */
+        OPGEL, 
+        /**
+         * Otic Gel
+         */
+        OTGEL, 
+        /**
+         * Topical Gel
+         */
+        TOPGEL, 
+        /**
+         * Urethral Gel
+         */
+        URETHGEL, 
+        /**
+         * Vaginal Gel
+         */
+        VAGGEL, 
+        /**
+         * Vaginal Gel with Applicator
+         */
+        VGELAPL, 
+        /**
+         * A semisolid dosage form that contains one or more drug substances intended for topical application.
+         */
+        PASTE, 
+        /**
+         * Pudding
+         */
+        PUD, 
+        /**
+         * A paste formulation intended to clean and/or polish the teeth, and which may contain certain additional agents.
+         */
+        TPASTE, 
+        /**
+         * Suspension
+         */
+        SUSP, 
+        /**
+         * Intrathecal Suspension
+         */
+        ITSUSP, 
+        /**
+         * Ophthalmic Suspension
+         */
+        OPSUSP, 
+        /**
+         * Oral Suspension
+         */
+        ORSUSP, 
+        /**
+         * Extended-Release Suspension
+         */
+        ERSUSP, 
+        /**
+         * 12 Hour Extended-Release Suspension
+         */
+        ERSUSP12, 
+        /**
+         * 24 Hour Extended Release Suspension
+         */
+        ERSUSP24, 
+        /**
+         * Otic Suspension
+         */
+        OTSUSP, 
+        /**
+         * Rectal Suspension
+         */
+        RECSUSP, 
+        /**
+         * SolidDrugForm
+         */
+        _SOLIDDRUGFORM, 
+        /**
+         * Bar
+         */
+        BAR, 
+        /**
+         * Bar Soap
+         */
+        BARSOAP, 
+        /**
+         * Medicated Bar Soap
+         */
+        MEDBAR, 
+        /**
+         * A solid dosage form usually in the form of a rectangle that is meant to be chewed.
+         */
+        CHEWBAR, 
+        /**
+         * A solid dosage form in the shape of a small ball.
+         */
+        BEAD, 
+        /**
+         * Cake
+         */
+        CAKE, 
+        /**
+         * A substance that serves to produce solid union between two surfaces.
+         */
+        CEMENT, 
+        /**
+         * A naturally produced angular solid of definite form in which the ultimate units from which it is built up are systematically arranged; they are usually evenly spaced on a regular space lattice.
+         */
+        CRYS, 
+        /**
+         * A circular plate-like organ or structure.
+         */
+        DISK, 
+        /**
+         * Flakes
+         */
+        FLAKE, 
+        /**
+         * A small particle or grain.
+         */
+        GRAN, 
+        /**
+         * A sweetened and flavored insoluble plastic material of various shapes which when chewed, releases a drug substance into the oral cavity.
+         */
+        GUM, 
+        /**
+         * Pad
+         */
+        PAD, 
+        /**
+         * Medicated Pad
+         */
+        MEDPAD, 
+        /**
+         * A drug delivery system that contains an adhesived backing and that permits its ingredients to diffuse from some portion of it (e.g., the backing itself, a reservoir, the adhesive, or some other component) into the body from the external site where it is applied.
+         */
+        PATCH, 
+        /**
+         * Transdermal Patch
+         */
+        TPATCH, 
+        /**
+         * 16 Hour Transdermal Patch
+         */
+        TPATH16, 
+        /**
+         * 24 Hour Transdermal Patch
+         */
+        TPATH24, 
+        /**
+         * Biweekly Transdermal Patch
+         */
+        TPATH2WK, 
+        /**
+         * 72 Hour Transdermal Patch
+         */
+        TPATH72, 
+        /**
+         * Weekly Transdermal Patch
+         */
+        TPATHWK, 
+        /**
+         * A small sterile solid mass consisting of a highly purified drug (with or without excipients) made by the formation of granules, or by compression and molding.
+         */
+        PELLET, 
+        /**
+         * A small, round solid dosage form containing a medicinal agent intended for oral administration.
+         */
+        PILL, 
+        /**
+         * A solid dosage form in which the drug is enclosed within either a hard or soft soluble container or "shell" made from a suitable form of gelatin.
+         */
+        CAP, 
+        /**
+         * Oral Capsule
+         */
+        ORCAP, 
+        /**
+         * Enteric Coated Capsule
+         */
+        ENTCAP, 
+        /**
+         * Extended Release Enteric Coated Capsule
+         */
+        ERENTCAP, 
+        /**
+         * A solid dosage form in which the drug is enclosed within either a hard or soft soluble container made from a suitable form of gelatin, and which releases a drug (or drugs) in such a manner to allow a reduction in dosing frequency as compared to that drug (or drugs) presented as a conventional dosage form.
+         */
+        ERCAP, 
+        /**
+         * 12 Hour Extended Release Capsule
+         */
+        ERCAP12, 
+        /**
+         * 24 Hour Extended Release Capsule
+         */
+        ERCAP24, 
+        /**
+         * Rationale: Duplicate of code ERENTCAP. Use code ERENTCAP instead.
+         */
+        ERECCAP, 
+        /**
+         * A solid dosage form containing medicinal substances with or without suitable diluents.
+         */
+        TAB, 
+        /**
+         * Oral Tablet
+         */
+        ORTAB, 
+        /**
+         * Buccal Tablet
+         */
+        BUCTAB, 
+        /**
+         * Sustained Release Buccal Tablet
+         */
+        SRBUCTAB, 
+        /**
+         * Caplet
+         */
+        CAPLET, 
+        /**
+         * A solid dosage form containing medicinal substances with or without suitable diluents that is intended to be chewed, producing a pleasant tasting residue in the oral cavity that is easily swallowed and does not leave a bitter or unpleasant after-taste.
+         */
+        CHEWTAB, 
+        /**
+         * Coated Particles Tablet
+         */
+        CPTAB, 
+        /**
+         * A solid dosage form containing medicinal substances which disintegrates rapidly, usually within a matter of seconds, when placed upon the tongue.
+         */
+        DISINTAB, 
+        /**
+         * Delayed Release Tablet
+         */
+        DRTAB, 
+        /**
+         * Enteric Coated Tablet
+         */
+        ECTAB, 
+        /**
+         * Extended Release Enteric Coated Tablet
+         */
+        ERECTAB, 
+        /**
+         * A solid dosage form containing a drug which allows at least a reduction in dosing frequency as compared to that drug presented in conventional dosage form.
+         */
+        ERTAB, 
+        /**
+         * 12 Hour Extended Release Tablet
+         */
+        ERTAB12, 
+        /**
+         * 24 Hour Extended Release Tablet
+         */
+        ERTAB24, 
+        /**
+         * A solid preparation containing one or more medicaments, usually in a flavored, sweetened base which is intended to dissolve or disintegrate slowly in the mouth.
+         */
+        ORTROCHE, 
+        /**
+         * Sublingual Tablet
+         */
+        SLTAB, 
+        /**
+         * Vaginal Tablet
+         */
+        VAGTAB, 
+        /**
+         * An intimate mixture of dry, finely divided drugs and/or chemicals that may be intended for internal or external use.
+         */
+        POWD, 
+        /**
+         * Topical Powder
+         */
+        TOPPWD, 
+        /**
+         * Rectal Powder
+         */
+        RECPWD, 
+        /**
+         * Vaginal Powder
+         */
+        VAGPWD, 
+        /**
+         * A solid body of various weights and shapes, adapted for introduction into the rectal, vaginal, or urethral orifice of the human body; they usually melt, soften, or dissolve at body temperature.
+         */
+        SUPP, 
+        /**
+         * Rectal Suppository
+         */
+        RECSUPP, 
+        /**
+         * Urethral suppository
+         */
+        URETHSUPP, 
+        /**
+         * Vaginal Suppository
+         */
+        VAGSUPP, 
+        /**
+         * A wad of absorbent material usually wound around one end of a small stick and used for applying medication or for removing material from an area.
+         */
+        SWAB, 
+        /**
+         * Medicated swab
+         */
+        MEDSWAB, 
+        /**
+         * A thin slice of material containing a medicinal agent.
+         */
+        WAFER, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3OrderableDrugForm fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_AdministrableDrugForm".equals(codeString))
+          return _ADMINISTRABLEDRUGFORM;
+        if ("APPFUL".equals(codeString))
+          return APPFUL;
+        if ("DROP".equals(codeString))
+          return DROP;
+        if ("NDROP".equals(codeString))
+          return NDROP;
+        if ("OPDROP".equals(codeString))
+          return OPDROP;
+        if ("ORDROP".equals(codeString))
+          return ORDROP;
+        if ("OTDROP".equals(codeString))
+          return OTDROP;
+        if ("PUFF".equals(codeString))
+          return PUFF;
+        if ("SCOOP".equals(codeString))
+          return SCOOP;
+        if ("SPRY".equals(codeString))
+          return SPRY;
+        if ("_DispensableDrugForm".equals(codeString))
+          return _DISPENSABLEDRUGFORM;
+        if ("_GasDrugForm".equals(codeString))
+          return _GASDRUGFORM;
+        if ("GASINHL".equals(codeString))
+          return GASINHL;
+        if ("_GasLiquidMixture".equals(codeString))
+          return _GASLIQUIDMIXTURE;
+        if ("AER".equals(codeString))
+          return AER;
+        if ("BAINHL".equals(codeString))
+          return BAINHL;
+        if ("INHLSOL".equals(codeString))
+          return INHLSOL;
+        if ("MDINHL".equals(codeString))
+          return MDINHL;
+        if ("NASSPRY".equals(codeString))
+          return NASSPRY;
+        if ("DERMSPRY".equals(codeString))
+          return DERMSPRY;
+        if ("FOAM".equals(codeString))
+          return FOAM;
+        if ("FOAMAPL".equals(codeString))
+          return FOAMAPL;
+        if ("RECFORM".equals(codeString))
+          return RECFORM;
+        if ("VAGFOAM".equals(codeString))
+          return VAGFOAM;
+        if ("VAGFOAMAPL".equals(codeString))
+          return VAGFOAMAPL;
+        if ("RECSPRY".equals(codeString))
+          return RECSPRY;
+        if ("VAGSPRY".equals(codeString))
+          return VAGSPRY;
+        if ("_GasSolidSpray".equals(codeString))
+          return _GASSOLIDSPRAY;
+        if ("INHL".equals(codeString))
+          return INHL;
+        if ("BAINHLPWD".equals(codeString))
+          return BAINHLPWD;
+        if ("INHLPWD".equals(codeString))
+          return INHLPWD;
+        if ("MDINHLPWD".equals(codeString))
+          return MDINHLPWD;
+        if ("NASINHL".equals(codeString))
+          return NASINHL;
+        if ("ORINHL".equals(codeString))
+          return ORINHL;
+        if ("PWDSPRY".equals(codeString))
+          return PWDSPRY;
+        if ("SPRYADAPT".equals(codeString))
+          return SPRYADAPT;
+        if ("_Liquid".equals(codeString))
+          return _LIQUID;
+        if ("LIQCLN".equals(codeString))
+          return LIQCLN;
+        if ("LIQSOAP".equals(codeString))
+          return LIQSOAP;
+        if ("SHMP".equals(codeString))
+          return SHMP;
+        if ("OIL".equals(codeString))
+          return OIL;
+        if ("TOPOIL".equals(codeString))
+          return TOPOIL;
+        if ("SOL".equals(codeString))
+          return SOL;
+        if ("IPSOL".equals(codeString))
+          return IPSOL;
+        if ("IRSOL".equals(codeString))
+          return IRSOL;
+        if ("DOUCHE".equals(codeString))
+          return DOUCHE;
+        if ("ENEMA".equals(codeString))
+          return ENEMA;
+        if ("OPIRSOL".equals(codeString))
+          return OPIRSOL;
+        if ("IVSOL".equals(codeString))
+          return IVSOL;
+        if ("ORALSOL".equals(codeString))
+          return ORALSOL;
+        if ("ELIXIR".equals(codeString))
+          return ELIXIR;
+        if ("RINSE".equals(codeString))
+          return RINSE;
+        if ("SYRUP".equals(codeString))
+          return SYRUP;
+        if ("RECSOL".equals(codeString))
+          return RECSOL;
+        if ("TOPSOL".equals(codeString))
+          return TOPSOL;
+        if ("LIN".equals(codeString))
+          return LIN;
+        if ("MUCTOPSOL".equals(codeString))
+          return MUCTOPSOL;
+        if ("TINC".equals(codeString))
+          return TINC;
+        if ("_LiquidLiquidEmulsion".equals(codeString))
+          return _LIQUIDLIQUIDEMULSION;
+        if ("CRM".equals(codeString))
+          return CRM;
+        if ("NASCRM".equals(codeString))
+          return NASCRM;
+        if ("OPCRM".equals(codeString))
+          return OPCRM;
+        if ("ORCRM".equals(codeString))
+          return ORCRM;
+        if ("OTCRM".equals(codeString))
+          return OTCRM;
+        if ("RECCRM".equals(codeString))
+          return RECCRM;
+        if ("TOPCRM".equals(codeString))
+          return TOPCRM;
+        if ("VAGCRM".equals(codeString))
+          return VAGCRM;
+        if ("VAGCRMAPL".equals(codeString))
+          return VAGCRMAPL;
+        if ("LTN".equals(codeString))
+          return LTN;
+        if ("TOPLTN".equals(codeString))
+          return TOPLTN;
+        if ("OINT".equals(codeString))
+          return OINT;
+        if ("NASOINT".equals(codeString))
+          return NASOINT;
+        if ("OINTAPL".equals(codeString))
+          return OINTAPL;
+        if ("OPOINT".equals(codeString))
+          return OPOINT;
+        if ("OTOINT".equals(codeString))
+          return OTOINT;
+        if ("RECOINT".equals(codeString))
+          return RECOINT;
+        if ("TOPOINT".equals(codeString))
+          return TOPOINT;
+        if ("VAGOINT".equals(codeString))
+          return VAGOINT;
+        if ("VAGOINTAPL".equals(codeString))
+          return VAGOINTAPL;
+        if ("_LiquidSolidSuspension".equals(codeString))
+          return _LIQUIDSOLIDSUSPENSION;
+        if ("GEL".equals(codeString))
+          return GEL;
+        if ("GELAPL".equals(codeString))
+          return GELAPL;
+        if ("NASGEL".equals(codeString))
+          return NASGEL;
+        if ("OPGEL".equals(codeString))
+          return OPGEL;
+        if ("OTGEL".equals(codeString))
+          return OTGEL;
+        if ("TOPGEL".equals(codeString))
+          return TOPGEL;
+        if ("URETHGEL".equals(codeString))
+          return URETHGEL;
+        if ("VAGGEL".equals(codeString))
+          return VAGGEL;
+        if ("VGELAPL".equals(codeString))
+          return VGELAPL;
+        if ("PASTE".equals(codeString))
+          return PASTE;
+        if ("PUD".equals(codeString))
+          return PUD;
+        if ("TPASTE".equals(codeString))
+          return TPASTE;
+        if ("SUSP".equals(codeString))
+          return SUSP;
+        if ("ITSUSP".equals(codeString))
+          return ITSUSP;
+        if ("OPSUSP".equals(codeString))
+          return OPSUSP;
+        if ("ORSUSP".equals(codeString))
+          return ORSUSP;
+        if ("ERSUSP".equals(codeString))
+          return ERSUSP;
+        if ("ERSUSP12".equals(codeString))
+          return ERSUSP12;
+        if ("ERSUSP24".equals(codeString))
+          return ERSUSP24;
+        if ("OTSUSP".equals(codeString))
+          return OTSUSP;
+        if ("RECSUSP".equals(codeString))
+          return RECSUSP;
+        if ("_SolidDrugForm".equals(codeString))
+          return _SOLIDDRUGFORM;
+        if ("BAR".equals(codeString))
+          return BAR;
+        if ("BARSOAP".equals(codeString))
+          return BARSOAP;
+        if ("MEDBAR".equals(codeString))
+          return MEDBAR;
+        if ("CHEWBAR".equals(codeString))
+          return CHEWBAR;
+        if ("BEAD".equals(codeString))
+          return BEAD;
+        if ("CAKE".equals(codeString))
+          return CAKE;
+        if ("CEMENT".equals(codeString))
+          return CEMENT;
+        if ("CRYS".equals(codeString))
+          return CRYS;
+        if ("DISK".equals(codeString))
+          return DISK;
+        if ("FLAKE".equals(codeString))
+          return FLAKE;
+        if ("GRAN".equals(codeString))
+          return GRAN;
+        if ("GUM".equals(codeString))
+          return GUM;
+        if ("PAD".equals(codeString))
+          return PAD;
+        if ("MEDPAD".equals(codeString))
+          return MEDPAD;
+        if ("PATCH".equals(codeString))
+          return PATCH;
+        if ("TPATCH".equals(codeString))
+          return TPATCH;
+        if ("TPATH16".equals(codeString))
+          return TPATH16;
+        if ("TPATH24".equals(codeString))
+          return TPATH24;
+        if ("TPATH2WK".equals(codeString))
+          return TPATH2WK;
+        if ("TPATH72".equals(codeString))
+          return TPATH72;
+        if ("TPATHWK".equals(codeString))
+          return TPATHWK;
+        if ("PELLET".equals(codeString))
+          return PELLET;
+        if ("PILL".equals(codeString))
+          return PILL;
+        if ("CAP".equals(codeString))
+          return CAP;
+        if ("ORCAP".equals(codeString))
+          return ORCAP;
+        if ("ENTCAP".equals(codeString))
+          return ENTCAP;
+        if ("ERENTCAP".equals(codeString))
+          return ERENTCAP;
+        if ("ERCAP".equals(codeString))
+          return ERCAP;
+        if ("ERCAP12".equals(codeString))
+          return ERCAP12;
+        if ("ERCAP24".equals(codeString))
+          return ERCAP24;
+        if ("ERECCAP".equals(codeString))
+          return ERECCAP;
+        if ("TAB".equals(codeString))
+          return TAB;
+        if ("ORTAB".equals(codeString))
+          return ORTAB;
+        if ("BUCTAB".equals(codeString))
+          return BUCTAB;
+        if ("SRBUCTAB".equals(codeString))
+          return SRBUCTAB;
+        if ("CAPLET".equals(codeString))
+          return CAPLET;
+        if ("CHEWTAB".equals(codeString))
+          return CHEWTAB;
+        if ("CPTAB".equals(codeString))
+          return CPTAB;
+        if ("DISINTAB".equals(codeString))
+          return DISINTAB;
+        if ("DRTAB".equals(codeString))
+          return DRTAB;
+        if ("ECTAB".equals(codeString))
+          return ECTAB;
+        if ("ERECTAB".equals(codeString))
+          return ERECTAB;
+        if ("ERTAB".equals(codeString))
+          return ERTAB;
+        if ("ERTAB12".equals(codeString))
+          return ERTAB12;
+        if ("ERTAB24".equals(codeString))
+          return ERTAB24;
+        if ("ORTROCHE".equals(codeString))
+          return ORTROCHE;
+        if ("SLTAB".equals(codeString))
+          return SLTAB;
+        if ("VAGTAB".equals(codeString))
+          return VAGTAB;
+        if ("POWD".equals(codeString))
+          return POWD;
+        if ("TOPPWD".equals(codeString))
+          return TOPPWD;
+        if ("RECPWD".equals(codeString))
+          return RECPWD;
+        if ("VAGPWD".equals(codeString))
+          return VAGPWD;
+        if ("SUPP".equals(codeString))
+          return SUPP;
+        if ("RECSUPP".equals(codeString))
+          return RECSUPP;
+        if ("URETHSUPP".equals(codeString))
+          return URETHSUPP;
+        if ("VAGSUPP".equals(codeString))
+          return VAGSUPP;
+        if ("SWAB".equals(codeString))
+          return SWAB;
+        if ("MEDSWAB".equals(codeString))
+          return MEDSWAB;
+        if ("WAFER".equals(codeString))
+          return WAFER;
+        throw new FHIRException("Unknown V3OrderableDrugForm code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ADMINISTRABLEDRUGFORM: return "_AdministrableDrugForm";
+            case APPFUL: return "APPFUL";
+            case DROP: return "DROP";
+            case NDROP: return "NDROP";
+            case OPDROP: return "OPDROP";
+            case ORDROP: return "ORDROP";
+            case OTDROP: return "OTDROP";
+            case PUFF: return "PUFF";
+            case SCOOP: return "SCOOP";
+            case SPRY: return "SPRY";
+            case _DISPENSABLEDRUGFORM: return "_DispensableDrugForm";
+            case _GASDRUGFORM: return "_GasDrugForm";
+            case GASINHL: return "GASINHL";
+            case _GASLIQUIDMIXTURE: return "_GasLiquidMixture";
+            case AER: return "AER";
+            case BAINHL: return "BAINHL";
+            case INHLSOL: return "INHLSOL";
+            case MDINHL: return "MDINHL";
+            case NASSPRY: return "NASSPRY";
+            case DERMSPRY: return "DERMSPRY";
+            case FOAM: return "FOAM";
+            case FOAMAPL: return "FOAMAPL";
+            case RECFORM: return "RECFORM";
+            case VAGFOAM: return "VAGFOAM";
+            case VAGFOAMAPL: return "VAGFOAMAPL";
+            case RECSPRY: return "RECSPRY";
+            case VAGSPRY: return "VAGSPRY";
+            case _GASSOLIDSPRAY: return "_GasSolidSpray";
+            case INHL: return "INHL";
+            case BAINHLPWD: return "BAINHLPWD";
+            case INHLPWD: return "INHLPWD";
+            case MDINHLPWD: return "MDINHLPWD";
+            case NASINHL: return "NASINHL";
+            case ORINHL: return "ORINHL";
+            case PWDSPRY: return "PWDSPRY";
+            case SPRYADAPT: return "SPRYADAPT";
+            case _LIQUID: return "_Liquid";
+            case LIQCLN: return "LIQCLN";
+            case LIQSOAP: return "LIQSOAP";
+            case SHMP: return "SHMP";
+            case OIL: return "OIL";
+            case TOPOIL: return "TOPOIL";
+            case SOL: return "SOL";
+            case IPSOL: return "IPSOL";
+            case IRSOL: return "IRSOL";
+            case DOUCHE: return "DOUCHE";
+            case ENEMA: return "ENEMA";
+            case OPIRSOL: return "OPIRSOL";
+            case IVSOL: return "IVSOL";
+            case ORALSOL: return "ORALSOL";
+            case ELIXIR: return "ELIXIR";
+            case RINSE: return "RINSE";
+            case SYRUP: return "SYRUP";
+            case RECSOL: return "RECSOL";
+            case TOPSOL: return "TOPSOL";
+            case LIN: return "LIN";
+            case MUCTOPSOL: return "MUCTOPSOL";
+            case TINC: return "TINC";
+            case _LIQUIDLIQUIDEMULSION: return "_LiquidLiquidEmulsion";
+            case CRM: return "CRM";
+            case NASCRM: return "NASCRM";
+            case OPCRM: return "OPCRM";
+            case ORCRM: return "ORCRM";
+            case OTCRM: return "OTCRM";
+            case RECCRM: return "RECCRM";
+            case TOPCRM: return "TOPCRM";
+            case VAGCRM: return "VAGCRM";
+            case VAGCRMAPL: return "VAGCRMAPL";
+            case LTN: return "LTN";
+            case TOPLTN: return "TOPLTN";
+            case OINT: return "OINT";
+            case NASOINT: return "NASOINT";
+            case OINTAPL: return "OINTAPL";
+            case OPOINT: return "OPOINT";
+            case OTOINT: return "OTOINT";
+            case RECOINT: return "RECOINT";
+            case TOPOINT: return "TOPOINT";
+            case VAGOINT: return "VAGOINT";
+            case VAGOINTAPL: return "VAGOINTAPL";
+            case _LIQUIDSOLIDSUSPENSION: return "_LiquidSolidSuspension";
+            case GEL: return "GEL";
+            case GELAPL: return "GELAPL";
+            case NASGEL: return "NASGEL";
+            case OPGEL: return "OPGEL";
+            case OTGEL: return "OTGEL";
+            case TOPGEL: return "TOPGEL";
+            case URETHGEL: return "URETHGEL";
+            case VAGGEL: return "VAGGEL";
+            case VGELAPL: return "VGELAPL";
+            case PASTE: return "PASTE";
+            case PUD: return "PUD";
+            case TPASTE: return "TPASTE";
+            case SUSP: return "SUSP";
+            case ITSUSP: return "ITSUSP";
+            case OPSUSP: return "OPSUSP";
+            case ORSUSP: return "ORSUSP";
+            case ERSUSP: return "ERSUSP";
+            case ERSUSP12: return "ERSUSP12";
+            case ERSUSP24: return "ERSUSP24";
+            case OTSUSP: return "OTSUSP";
+            case RECSUSP: return "RECSUSP";
+            case _SOLIDDRUGFORM: return "_SolidDrugForm";
+            case BAR: return "BAR";
+            case BARSOAP: return "BARSOAP";
+            case MEDBAR: return "MEDBAR";
+            case CHEWBAR: return "CHEWBAR";
+            case BEAD: return "BEAD";
+            case CAKE: return "CAKE";
+            case CEMENT: return "CEMENT";
+            case CRYS: return "CRYS";
+            case DISK: return "DISK";
+            case FLAKE: return "FLAKE";
+            case GRAN: return "GRAN";
+            case GUM: return "GUM";
+            case PAD: return "PAD";
+            case MEDPAD: return "MEDPAD";
+            case PATCH: return "PATCH";
+            case TPATCH: return "TPATCH";
+            case TPATH16: return "TPATH16";
+            case TPATH24: return "TPATH24";
+            case TPATH2WK: return "TPATH2WK";
+            case TPATH72: return "TPATH72";
+            case TPATHWK: return "TPATHWK";
+            case PELLET: return "PELLET";
+            case PILL: return "PILL";
+            case CAP: return "CAP";
+            case ORCAP: return "ORCAP";
+            case ENTCAP: return "ENTCAP";
+            case ERENTCAP: return "ERENTCAP";
+            case ERCAP: return "ERCAP";
+            case ERCAP12: return "ERCAP12";
+            case ERCAP24: return "ERCAP24";
+            case ERECCAP: return "ERECCAP";
+            case TAB: return "TAB";
+            case ORTAB: return "ORTAB";
+            case BUCTAB: return "BUCTAB";
+            case SRBUCTAB: return "SRBUCTAB";
+            case CAPLET: return "CAPLET";
+            case CHEWTAB: return "CHEWTAB";
+            case CPTAB: return "CPTAB";
+            case DISINTAB: return "DISINTAB";
+            case DRTAB: return "DRTAB";
+            case ECTAB: return "ECTAB";
+            case ERECTAB: return "ERECTAB";
+            case ERTAB: return "ERTAB";
+            case ERTAB12: return "ERTAB12";
+            case ERTAB24: return "ERTAB24";
+            case ORTROCHE: return "ORTROCHE";
+            case SLTAB: return "SLTAB";
+            case VAGTAB: return "VAGTAB";
+            case POWD: return "POWD";
+            case TOPPWD: return "TOPPWD";
+            case RECPWD: return "RECPWD";
+            case VAGPWD: return "VAGPWD";
+            case SUPP: return "SUPP";
+            case RECSUPP: return "RECSUPP";
+            case URETHSUPP: return "URETHSUPP";
+            case VAGSUPP: return "VAGSUPP";
+            case SWAB: return "SWAB";
+            case MEDSWAB: return "MEDSWAB";
+            case WAFER: return "WAFER";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/orderableDrugForm";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ADMINISTRABLEDRUGFORM: return "AdministrableDrugForm";
+            case APPFUL: return "Applicatorful";
+            case DROP: return "Drops";
+            case NDROP: return "Nasal Drops";
+            case OPDROP: return "Ophthalmic Drops";
+            case ORDROP: return "Oral Drops";
+            case OTDROP: return "Otic Drops";
+            case PUFF: return "Puff";
+            case SCOOP: return "Scoops";
+            case SPRY: return "Sprays";
+            case _DISPENSABLEDRUGFORM: return "DispensableDrugForm";
+            case _GASDRUGFORM: return "Any elastic aeriform fluid in which the molecules are separated from one another and have free paths.";
+            case GASINHL: return "Gas for Inhalation";
+            case _GASLIQUIDMIXTURE: return "GasLiquidMixture";
+            case AER: return "Aerosol";
+            case BAINHL: return "Breath Activated Inhaler";
+            case INHLSOL: return "Inhalant Solution";
+            case MDINHL: return "Metered Dose Inhaler";
+            case NASSPRY: return "Nasal Spray";
+            case DERMSPRY: return "Dermal Spray";
+            case FOAM: return "Foam";
+            case FOAMAPL: return "Foam with Applicator";
+            case RECFORM: return "Rectal foam";
+            case VAGFOAM: return "Vaginal foam";
+            case VAGFOAMAPL: return "Vaginal foam with applicator";
+            case RECSPRY: return "Rectal Spray";
+            case VAGSPRY: return "Vaginal Spray";
+            case _GASSOLIDSPRAY: return "GasSolidSpray";
+            case INHL: return "Inhalant";
+            case BAINHLPWD: return "Breath Activated Powder Inhaler";
+            case INHLPWD: return "Inhalant Powder";
+            case MDINHLPWD: return "Metered Dose Powder Inhaler";
+            case NASINHL: return "Nasal Inhalant";
+            case ORINHL: return "Oral Inhalant";
+            case PWDSPRY: return "Powder Spray";
+            case SPRYADAPT: return "Spray with Adaptor";
+            case _LIQUID: return "A state of substance that is an intermediate one entered into as matter goes from solid to gas; liquids are also intermediate in that they have neither the orderliness of a crystal nor the randomness of a gas. (Note: This term should not be used to describe solutions, only pure chemicals in their liquid state.)";
+            case LIQCLN: return "Liquid Cleanser";
+            case LIQSOAP: return "Medicated Liquid Soap";
+            case SHMP: return "A liquid soap or detergent used to clean the hair and scalp and is often used as a vehicle for dermatologic agents.";
+            case OIL: return "An unctuous, combustible substance which is liquid, or easily liquefiable, on warming, and is soluble in ether but insoluble in water. Such substances, depending on their origin, are classified as animal, mineral, or vegetable oils.";
+            case TOPOIL: return "Topical Oil";
+            case SOL: return "A liquid preparation that contains one or more chemical substances dissolved, i.e., molecularly dispersed, in a suitable solvent or mixture of mutually miscible solvents.";
+            case IPSOL: return "Intraperitoneal Solution";
+            case IRSOL: return "A sterile solution intended to bathe or flush open wounds or body cavities; they're used topically, never parenterally.";
+            case DOUCHE: return "A liquid preparation, intended for the irrigative cleansing of the vagina, that is prepared from powders, liquid solutions, or liquid concentrates and contains one or more chemical substances dissolved in a suitable solvent or mutually miscible solvents.";
+            case ENEMA: return "A rectal preparation for therapeutic, diagnostic, or nutritive purposes.";
+            case OPIRSOL: return "Ophthalmic Irrigation Solution";
+            case IVSOL: return "Intravenous Solution";
+            case ORALSOL: return "Oral Solution";
+            case ELIXIR: return "A clear, pleasantly flavored, sweetened hydroalcoholic liquid containing dissolved medicinal agents; it is intended for oral use.";
+            case RINSE: return "An aqueous solution which is most often used for its deodorant, refreshing, or antiseptic effect.";
+            case SYRUP: return "An oral solution containing high concentrations of sucrose or other sugars; the term has also been used to include any other liquid dosage form prepared in a sweet and viscid vehicle, including oral suspensions.";
+            case RECSOL: return "Rectal Solution";
+            case TOPSOL: return "Topical Solution";
+            case LIN: return "A solution or mixture of various substances in oil, alcoholic solutions of soap, or emulsions intended for external application.";
+            case MUCTOPSOL: return "Mucous Membrane Topical Solution";
+            case TINC: return "Tincture";
+            case _LIQUIDLIQUIDEMULSION: return "A two-phase system in which one liquid is dispersed throughout another liquid in the form of small droplets.";
+            case CRM: return "A semisolid dosage form containing one or more drug substances dissolved or dispersed in a suitable base; more recently, the term has been restricted to products consisting of oil-in-water emulsions or aqueous microcrystalline dispersions of long chain fatty acids or alcohols that are water washable and more cosmetically and aesthetically acceptable.";
+            case NASCRM: return "Nasal Cream";
+            case OPCRM: return "Ophthalmic Cream";
+            case ORCRM: return "Oral Cream";
+            case OTCRM: return "Otic Cream";
+            case RECCRM: return "Rectal Cream";
+            case TOPCRM: return "Topical Cream";
+            case VAGCRM: return "Vaginal Cream";
+            case VAGCRMAPL: return "Vaginal Cream with Applicator";
+            case LTN: return "The term \"lotion\" has been used to categorize many topical suspensions, solutions and emulsions intended for application to the skin.";
+            case TOPLTN: return "Topical Lotion";
+            case OINT: return "A semisolid preparation intended for external application to the skin or mucous membranes.";
+            case NASOINT: return "Nasal Ointment";
+            case OINTAPL: return "Ointment with Applicator";
+            case OPOINT: return "Ophthalmic Ointment";
+            case OTOINT: return "Otic Ointment";
+            case RECOINT: return "Rectal Ointment";
+            case TOPOINT: return "Topical Ointment";
+            case VAGOINT: return "Vaginal Ointment";
+            case VAGOINTAPL: return "Vaginal Ointment with Applicator";
+            case _LIQUIDSOLIDSUSPENSION: return "A liquid preparation which consists of solid particles dispersed throughout a liquid phase in which the particles are not soluble.";
+            case GEL: return "A semisolid system consisting of either suspensions made up of small inorganic particles or large organic molecules interpenetrated by a liquid.";
+            case GELAPL: return "Gel with Applicator";
+            case NASGEL: return "Nasal Gel";
+            case OPGEL: return "Ophthalmic Gel";
+            case OTGEL: return "Otic Gel";
+            case TOPGEL: return "Topical Gel";
+            case URETHGEL: return "Urethral Gel";
+            case VAGGEL: return "Vaginal Gel";
+            case VGELAPL: return "Vaginal Gel with Applicator";
+            case PASTE: return "A semisolid dosage form that contains one or more drug substances intended for topical application.";
+            case PUD: return "Pudding";
+            case TPASTE: return "A paste formulation intended to clean and/or polish the teeth, and which may contain certain additional agents.";
+            case SUSP: return "Suspension";
+            case ITSUSP: return "Intrathecal Suspension";
+            case OPSUSP: return "Ophthalmic Suspension";
+            case ORSUSP: return "Oral Suspension";
+            case ERSUSP: return "Extended-Release Suspension";
+            case ERSUSP12: return "12 Hour Extended-Release Suspension";
+            case ERSUSP24: return "24 Hour Extended Release Suspension";
+            case OTSUSP: return "Otic Suspension";
+            case RECSUSP: return "Rectal Suspension";
+            case _SOLIDDRUGFORM: return "SolidDrugForm";
+            case BAR: return "Bar";
+            case BARSOAP: return "Bar Soap";
+            case MEDBAR: return "Medicated Bar Soap";
+            case CHEWBAR: return "A solid dosage form usually in the form of a rectangle that is meant to be chewed.";
+            case BEAD: return "A solid dosage form in the shape of a small ball.";
+            case CAKE: return "Cake";
+            case CEMENT: return "A substance that serves to produce solid union between two surfaces.";
+            case CRYS: return "A naturally produced angular solid of definite form in which the ultimate units from which it is built up are systematically arranged; they are usually evenly spaced on a regular space lattice.";
+            case DISK: return "A circular plate-like organ or structure.";
+            case FLAKE: return "Flakes";
+            case GRAN: return "A small particle or grain.";
+            case GUM: return "A sweetened and flavored insoluble plastic material of various shapes which when chewed, releases a drug substance into the oral cavity.";
+            case PAD: return "Pad";
+            case MEDPAD: return "Medicated Pad";
+            case PATCH: return "A drug delivery system that contains an adhesived backing and that permits its ingredients to diffuse from some portion of it (e.g., the backing itself, a reservoir, the adhesive, or some other component) into the body from the external site where it is applied.";
+            case TPATCH: return "Transdermal Patch";
+            case TPATH16: return "16 Hour Transdermal Patch";
+            case TPATH24: return "24 Hour Transdermal Patch";
+            case TPATH2WK: return "Biweekly Transdermal Patch";
+            case TPATH72: return "72 Hour Transdermal Patch";
+            case TPATHWK: return "Weekly Transdermal Patch";
+            case PELLET: return "A small sterile solid mass consisting of a highly purified drug (with or without excipients) made by the formation of granules, or by compression and molding.";
+            case PILL: return "A small, round solid dosage form containing a medicinal agent intended for oral administration.";
+            case CAP: return "A solid dosage form in which the drug is enclosed within either a hard or soft soluble container or \"shell\" made from a suitable form of gelatin.";
+            case ORCAP: return "Oral Capsule";
+            case ENTCAP: return "Enteric Coated Capsule";
+            case ERENTCAP: return "Extended Release Enteric Coated Capsule";
+            case ERCAP: return "A solid dosage form in which the drug is enclosed within either a hard or soft soluble container made from a suitable form of gelatin, and which releases a drug (or drugs) in such a manner to allow a reduction in dosing frequency as compared to that drug (or drugs) presented as a conventional dosage form.";
+            case ERCAP12: return "12 Hour Extended Release Capsule";
+            case ERCAP24: return "24 Hour Extended Release Capsule";
+            case ERECCAP: return "Rationale: Duplicate of code ERENTCAP. Use code ERENTCAP instead.";
+            case TAB: return "A solid dosage form containing medicinal substances with or without suitable diluents.";
+            case ORTAB: return "Oral Tablet";
+            case BUCTAB: return "Buccal Tablet";
+            case SRBUCTAB: return "Sustained Release Buccal Tablet";
+            case CAPLET: return "Caplet";
+            case CHEWTAB: return "A solid dosage form containing medicinal substances with or without suitable diluents that is intended to be chewed, producing a pleasant tasting residue in the oral cavity that is easily swallowed and does not leave a bitter or unpleasant after-taste.";
+            case CPTAB: return "Coated Particles Tablet";
+            case DISINTAB: return "A solid dosage form containing medicinal substances which disintegrates rapidly, usually within a matter of seconds, when placed upon the tongue.";
+            case DRTAB: return "Delayed Release Tablet";
+            case ECTAB: return "Enteric Coated Tablet";
+            case ERECTAB: return "Extended Release Enteric Coated Tablet";
+            case ERTAB: return "A solid dosage form containing a drug which allows at least a reduction in dosing frequency as compared to that drug presented in conventional dosage form.";
+            case ERTAB12: return "12 Hour Extended Release Tablet";
+            case ERTAB24: return "24 Hour Extended Release Tablet";
+            case ORTROCHE: return "A solid preparation containing one or more medicaments, usually in a flavored, sweetened base which is intended to dissolve or disintegrate slowly in the mouth.";
+            case SLTAB: return "Sublingual Tablet";
+            case VAGTAB: return "Vaginal Tablet";
+            case POWD: return "An intimate mixture of dry, finely divided drugs and/or chemicals that may be intended for internal or external use.";
+            case TOPPWD: return "Topical Powder";
+            case RECPWD: return "Rectal Powder";
+            case VAGPWD: return "Vaginal Powder";
+            case SUPP: return "A solid body of various weights and shapes, adapted for introduction into the rectal, vaginal, or urethral orifice of the human body; they usually melt, soften, or dissolve at body temperature.";
+            case RECSUPP: return "Rectal Suppository";
+            case URETHSUPP: return "Urethral suppository";
+            case VAGSUPP: return "Vaginal Suppository";
+            case SWAB: return "A wad of absorbent material usually wound around one end of a small stick and used for applying medication or for removing material from an area.";
+            case MEDSWAB: return "Medicated swab";
+            case WAFER: return "A thin slice of material containing a medicinal agent.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ADMINISTRABLEDRUGFORM: return "AdministrableDrugForm";
+            case APPFUL: return "Applicatorful";
+            case DROP: return "Drops";
+            case NDROP: return "Nasal Drops";
+            case OPDROP: return "Ophthalmic Drops";
+            case ORDROP: return "Oral Drops";
+            case OTDROP: return "Otic Drops";
+            case PUFF: return "Puff";
+            case SCOOP: return "Scoops";
+            case SPRY: return "Sprays";
+            case _DISPENSABLEDRUGFORM: return "DispensableDrugForm";
+            case _GASDRUGFORM: return "GasDrugForm";
+            case GASINHL: return "Gas for Inhalation";
+            case _GASLIQUIDMIXTURE: return "GasLiquidMixture";
+            case AER: return "Aerosol";
+            case BAINHL: return "Breath Activated Inhaler";
+            case INHLSOL: return "Inhalant Solution";
+            case MDINHL: return "Metered Dose Inhaler";
+            case NASSPRY: return "Nasal Spray";
+            case DERMSPRY: return "Dermal Spray";
+            case FOAM: return "Foam";
+            case FOAMAPL: return "Foam with Applicator";
+            case RECFORM: return "Rectal foam";
+            case VAGFOAM: return "Vaginal foam";
+            case VAGFOAMAPL: return "Vaginal foam with applicator";
+            case RECSPRY: return "Rectal Spray";
+            case VAGSPRY: return "Vaginal Spray";
+            case _GASSOLIDSPRAY: return "GasSolidSpray";
+            case INHL: return "Inhalant";
+            case BAINHLPWD: return "Breath Activated Powder Inhaler";
+            case INHLPWD: return "Inhalant Powder";
+            case MDINHLPWD: return "Metered Dose Powder Inhaler";
+            case NASINHL: return "Nasal Inhalant";
+            case ORINHL: return "Oral Inhalant";
+            case PWDSPRY: return "Powder Spray";
+            case SPRYADAPT: return "Spray with Adaptor";
+            case _LIQUID: return "Liquid";
+            case LIQCLN: return "Liquid Cleanser";
+            case LIQSOAP: return "Medicated Liquid Soap";
+            case SHMP: return "Shampoo";
+            case OIL: return "Oil";
+            case TOPOIL: return "Topical Oil";
+            case SOL: return "Solution";
+            case IPSOL: return "Intraperitoneal Solution";
+            case IRSOL: return "Irrigation Solution";
+            case DOUCHE: return "Douche";
+            case ENEMA: return "Enema";
+            case OPIRSOL: return "Ophthalmic Irrigation Solution";
+            case IVSOL: return "Intravenous Solution";
+            case ORALSOL: return "Oral Solution";
+            case ELIXIR: return "Elixir";
+            case RINSE: return "Mouthwash/Rinse";
+            case SYRUP: return "Syrup";
+            case RECSOL: return "Rectal Solution";
+            case TOPSOL: return "Topical Solution";
+            case LIN: return "Liniment";
+            case MUCTOPSOL: return "Mucous Membrane Topical Solution";
+            case TINC: return "Tincture";
+            case _LIQUIDLIQUIDEMULSION: return "LiquidLiquidEmulsion";
+            case CRM: return "Cream";
+            case NASCRM: return "Nasal Cream";
+            case OPCRM: return "Ophthalmic Cream";
+            case ORCRM: return "Oral Cream";
+            case OTCRM: return "Otic Cream";
+            case RECCRM: return "Rectal Cream";
+            case TOPCRM: return "Topical Cream";
+            case VAGCRM: return "Vaginal Cream";
+            case VAGCRMAPL: return "Vaginal Cream with Applicator";
+            case LTN: return "Lotion";
+            case TOPLTN: return "Topical Lotion";
+            case OINT: return "Ointment";
+            case NASOINT: return "Nasal Ointment";
+            case OINTAPL: return "Ointment with Applicator";
+            case OPOINT: return "Ophthalmic Ointment";
+            case OTOINT: return "Otic Ointment";
+            case RECOINT: return "Rectal Ointment";
+            case TOPOINT: return "Topical Ointment";
+            case VAGOINT: return "Vaginal Ointment";
+            case VAGOINTAPL: return "Vaginal Ointment with Applicator";
+            case _LIQUIDSOLIDSUSPENSION: return "LiquidSolidSuspension";
+            case GEL: return "Gel";
+            case GELAPL: return "Gel with Applicator";
+            case NASGEL: return "Nasal Gel";
+            case OPGEL: return "Ophthalmic Gel";
+            case OTGEL: return "Otic Gel";
+            case TOPGEL: return "Topical Gel";
+            case URETHGEL: return "Urethral Gel";
+            case VAGGEL: return "Vaginal Gel";
+            case VGELAPL: return "Vaginal Gel with Applicator";
+            case PASTE: return "Paste";
+            case PUD: return "Pudding";
+            case TPASTE: return "Toothpaste";
+            case SUSP: return "Suspension";
+            case ITSUSP: return "Intrathecal Suspension";
+            case OPSUSP: return "Ophthalmic Suspension";
+            case ORSUSP: return "Oral Suspension";
+            case ERSUSP: return "Extended-Release Suspension";
+            case ERSUSP12: return "12 Hour Extended-Release Suspension";
+            case ERSUSP24: return "24 Hour Extended Release Suspension";
+            case OTSUSP: return "Otic Suspension";
+            case RECSUSP: return "Rectal Suspension";
+            case _SOLIDDRUGFORM: return "SolidDrugForm";
+            case BAR: return "Bar";
+            case BARSOAP: return "Bar Soap";
+            case MEDBAR: return "Medicated Bar Soap";
+            case CHEWBAR: return "Chewable Bar";
+            case BEAD: return "Beads";
+            case CAKE: return "Cake";
+            case CEMENT: return "Cement";
+            case CRYS: return "Crystals";
+            case DISK: return "Disk";
+            case FLAKE: return "Flakes";
+            case GRAN: return "Granules";
+            case GUM: return "ChewingGum";
+            case PAD: return "Pad";
+            case MEDPAD: return "Medicated Pad";
+            case PATCH: return "Patch";
+            case TPATCH: return "Transdermal Patch";
+            case TPATH16: return "16 Hour Transdermal Patch";
+            case TPATH24: return "24 Hour Transdermal Patch";
+            case TPATH2WK: return "Biweekly Transdermal Patch";
+            case TPATH72: return "72 Hour Transdermal Patch";
+            case TPATHWK: return "Weekly Transdermal Patch";
+            case PELLET: return "Pellet";
+            case PILL: return "Pill";
+            case CAP: return "Capsule";
+            case ORCAP: return "Oral Capsule";
+            case ENTCAP: return "Enteric Coated Capsule";
+            case ERENTCAP: return "Extended Release Enteric Coated Capsule";
+            case ERCAP: return "Extended Release Capsule";
+            case ERCAP12: return "12 Hour Extended Release Capsule";
+            case ERCAP24: return "24 Hour Extended Release Capsule";
+            case ERECCAP: return "Extended Release Enteric Coated Capsule";
+            case TAB: return "Tablet";
+            case ORTAB: return "Oral Tablet";
+            case BUCTAB: return "Buccal Tablet";
+            case SRBUCTAB: return "Sustained Release Buccal Tablet";
+            case CAPLET: return "Caplet";
+            case CHEWTAB: return "Chewable Tablet";
+            case CPTAB: return "Coated Particles Tablet";
+            case DISINTAB: return "Disintegrating Tablet";
+            case DRTAB: return "Delayed Release Tablet";
+            case ECTAB: return "Enteric Coated Tablet";
+            case ERECTAB: return "Extended Release Enteric Coated Tablet";
+            case ERTAB: return "Extended Release Tablet";
+            case ERTAB12: return "12 Hour Extended Release Tablet";
+            case ERTAB24: return "24 Hour Extended Release Tablet";
+            case ORTROCHE: return "Lozenge/Oral Troche";
+            case SLTAB: return "Sublingual Tablet";
+            case VAGTAB: return "Vaginal Tablet";
+            case POWD: return "Powder";
+            case TOPPWD: return "Topical Powder";
+            case RECPWD: return "Rectal Powder";
+            case VAGPWD: return "Vaginal Powder";
+            case SUPP: return "Suppository";
+            case RECSUPP: return "Rectal Suppository";
+            case URETHSUPP: return "Urethral suppository";
+            case VAGSUPP: return "Vaginal Suppository";
+            case SWAB: return "Swab";
+            case MEDSWAB: return "Medicated swab";
+            case WAFER: return "Wafer";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3OrderableDrugFormEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3OrderableDrugFormEnumFactory.java
new file mode 100644
index 00000000000..dc7435073e4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3OrderableDrugFormEnumFactory.java
@@ -0,0 +1,698 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3OrderableDrugFormEnumFactory implements EnumFactory {
+
+  public V3OrderableDrugForm fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_AdministrableDrugForm".equals(codeString))
+      return V3OrderableDrugForm._ADMINISTRABLEDRUGFORM;
+    if ("APPFUL".equals(codeString))
+      return V3OrderableDrugForm.APPFUL;
+    if ("DROP".equals(codeString))
+      return V3OrderableDrugForm.DROP;
+    if ("NDROP".equals(codeString))
+      return V3OrderableDrugForm.NDROP;
+    if ("OPDROP".equals(codeString))
+      return V3OrderableDrugForm.OPDROP;
+    if ("ORDROP".equals(codeString))
+      return V3OrderableDrugForm.ORDROP;
+    if ("OTDROP".equals(codeString))
+      return V3OrderableDrugForm.OTDROP;
+    if ("PUFF".equals(codeString))
+      return V3OrderableDrugForm.PUFF;
+    if ("SCOOP".equals(codeString))
+      return V3OrderableDrugForm.SCOOP;
+    if ("SPRY".equals(codeString))
+      return V3OrderableDrugForm.SPRY;
+    if ("_DispensableDrugForm".equals(codeString))
+      return V3OrderableDrugForm._DISPENSABLEDRUGFORM;
+    if ("_GasDrugForm".equals(codeString))
+      return V3OrderableDrugForm._GASDRUGFORM;
+    if ("GASINHL".equals(codeString))
+      return V3OrderableDrugForm.GASINHL;
+    if ("_GasLiquidMixture".equals(codeString))
+      return V3OrderableDrugForm._GASLIQUIDMIXTURE;
+    if ("AER".equals(codeString))
+      return V3OrderableDrugForm.AER;
+    if ("BAINHL".equals(codeString))
+      return V3OrderableDrugForm.BAINHL;
+    if ("INHLSOL".equals(codeString))
+      return V3OrderableDrugForm.INHLSOL;
+    if ("MDINHL".equals(codeString))
+      return V3OrderableDrugForm.MDINHL;
+    if ("NASSPRY".equals(codeString))
+      return V3OrderableDrugForm.NASSPRY;
+    if ("DERMSPRY".equals(codeString))
+      return V3OrderableDrugForm.DERMSPRY;
+    if ("FOAM".equals(codeString))
+      return V3OrderableDrugForm.FOAM;
+    if ("FOAMAPL".equals(codeString))
+      return V3OrderableDrugForm.FOAMAPL;
+    if ("RECFORM".equals(codeString))
+      return V3OrderableDrugForm.RECFORM;
+    if ("VAGFOAM".equals(codeString))
+      return V3OrderableDrugForm.VAGFOAM;
+    if ("VAGFOAMAPL".equals(codeString))
+      return V3OrderableDrugForm.VAGFOAMAPL;
+    if ("RECSPRY".equals(codeString))
+      return V3OrderableDrugForm.RECSPRY;
+    if ("VAGSPRY".equals(codeString))
+      return V3OrderableDrugForm.VAGSPRY;
+    if ("_GasSolidSpray".equals(codeString))
+      return V3OrderableDrugForm._GASSOLIDSPRAY;
+    if ("INHL".equals(codeString))
+      return V3OrderableDrugForm.INHL;
+    if ("BAINHLPWD".equals(codeString))
+      return V3OrderableDrugForm.BAINHLPWD;
+    if ("INHLPWD".equals(codeString))
+      return V3OrderableDrugForm.INHLPWD;
+    if ("MDINHLPWD".equals(codeString))
+      return V3OrderableDrugForm.MDINHLPWD;
+    if ("NASINHL".equals(codeString))
+      return V3OrderableDrugForm.NASINHL;
+    if ("ORINHL".equals(codeString))
+      return V3OrderableDrugForm.ORINHL;
+    if ("PWDSPRY".equals(codeString))
+      return V3OrderableDrugForm.PWDSPRY;
+    if ("SPRYADAPT".equals(codeString))
+      return V3OrderableDrugForm.SPRYADAPT;
+    if ("_Liquid".equals(codeString))
+      return V3OrderableDrugForm._LIQUID;
+    if ("LIQCLN".equals(codeString))
+      return V3OrderableDrugForm.LIQCLN;
+    if ("LIQSOAP".equals(codeString))
+      return V3OrderableDrugForm.LIQSOAP;
+    if ("SHMP".equals(codeString))
+      return V3OrderableDrugForm.SHMP;
+    if ("OIL".equals(codeString))
+      return V3OrderableDrugForm.OIL;
+    if ("TOPOIL".equals(codeString))
+      return V3OrderableDrugForm.TOPOIL;
+    if ("SOL".equals(codeString))
+      return V3OrderableDrugForm.SOL;
+    if ("IPSOL".equals(codeString))
+      return V3OrderableDrugForm.IPSOL;
+    if ("IRSOL".equals(codeString))
+      return V3OrderableDrugForm.IRSOL;
+    if ("DOUCHE".equals(codeString))
+      return V3OrderableDrugForm.DOUCHE;
+    if ("ENEMA".equals(codeString))
+      return V3OrderableDrugForm.ENEMA;
+    if ("OPIRSOL".equals(codeString))
+      return V3OrderableDrugForm.OPIRSOL;
+    if ("IVSOL".equals(codeString))
+      return V3OrderableDrugForm.IVSOL;
+    if ("ORALSOL".equals(codeString))
+      return V3OrderableDrugForm.ORALSOL;
+    if ("ELIXIR".equals(codeString))
+      return V3OrderableDrugForm.ELIXIR;
+    if ("RINSE".equals(codeString))
+      return V3OrderableDrugForm.RINSE;
+    if ("SYRUP".equals(codeString))
+      return V3OrderableDrugForm.SYRUP;
+    if ("RECSOL".equals(codeString))
+      return V3OrderableDrugForm.RECSOL;
+    if ("TOPSOL".equals(codeString))
+      return V3OrderableDrugForm.TOPSOL;
+    if ("LIN".equals(codeString))
+      return V3OrderableDrugForm.LIN;
+    if ("MUCTOPSOL".equals(codeString))
+      return V3OrderableDrugForm.MUCTOPSOL;
+    if ("TINC".equals(codeString))
+      return V3OrderableDrugForm.TINC;
+    if ("_LiquidLiquidEmulsion".equals(codeString))
+      return V3OrderableDrugForm._LIQUIDLIQUIDEMULSION;
+    if ("CRM".equals(codeString))
+      return V3OrderableDrugForm.CRM;
+    if ("NASCRM".equals(codeString))
+      return V3OrderableDrugForm.NASCRM;
+    if ("OPCRM".equals(codeString))
+      return V3OrderableDrugForm.OPCRM;
+    if ("ORCRM".equals(codeString))
+      return V3OrderableDrugForm.ORCRM;
+    if ("OTCRM".equals(codeString))
+      return V3OrderableDrugForm.OTCRM;
+    if ("RECCRM".equals(codeString))
+      return V3OrderableDrugForm.RECCRM;
+    if ("TOPCRM".equals(codeString))
+      return V3OrderableDrugForm.TOPCRM;
+    if ("VAGCRM".equals(codeString))
+      return V3OrderableDrugForm.VAGCRM;
+    if ("VAGCRMAPL".equals(codeString))
+      return V3OrderableDrugForm.VAGCRMAPL;
+    if ("LTN".equals(codeString))
+      return V3OrderableDrugForm.LTN;
+    if ("TOPLTN".equals(codeString))
+      return V3OrderableDrugForm.TOPLTN;
+    if ("OINT".equals(codeString))
+      return V3OrderableDrugForm.OINT;
+    if ("NASOINT".equals(codeString))
+      return V3OrderableDrugForm.NASOINT;
+    if ("OINTAPL".equals(codeString))
+      return V3OrderableDrugForm.OINTAPL;
+    if ("OPOINT".equals(codeString))
+      return V3OrderableDrugForm.OPOINT;
+    if ("OTOINT".equals(codeString))
+      return V3OrderableDrugForm.OTOINT;
+    if ("RECOINT".equals(codeString))
+      return V3OrderableDrugForm.RECOINT;
+    if ("TOPOINT".equals(codeString))
+      return V3OrderableDrugForm.TOPOINT;
+    if ("VAGOINT".equals(codeString))
+      return V3OrderableDrugForm.VAGOINT;
+    if ("VAGOINTAPL".equals(codeString))
+      return V3OrderableDrugForm.VAGOINTAPL;
+    if ("_LiquidSolidSuspension".equals(codeString))
+      return V3OrderableDrugForm._LIQUIDSOLIDSUSPENSION;
+    if ("GEL".equals(codeString))
+      return V3OrderableDrugForm.GEL;
+    if ("GELAPL".equals(codeString))
+      return V3OrderableDrugForm.GELAPL;
+    if ("NASGEL".equals(codeString))
+      return V3OrderableDrugForm.NASGEL;
+    if ("OPGEL".equals(codeString))
+      return V3OrderableDrugForm.OPGEL;
+    if ("OTGEL".equals(codeString))
+      return V3OrderableDrugForm.OTGEL;
+    if ("TOPGEL".equals(codeString))
+      return V3OrderableDrugForm.TOPGEL;
+    if ("URETHGEL".equals(codeString))
+      return V3OrderableDrugForm.URETHGEL;
+    if ("VAGGEL".equals(codeString))
+      return V3OrderableDrugForm.VAGGEL;
+    if ("VGELAPL".equals(codeString))
+      return V3OrderableDrugForm.VGELAPL;
+    if ("PASTE".equals(codeString))
+      return V3OrderableDrugForm.PASTE;
+    if ("PUD".equals(codeString))
+      return V3OrderableDrugForm.PUD;
+    if ("TPASTE".equals(codeString))
+      return V3OrderableDrugForm.TPASTE;
+    if ("SUSP".equals(codeString))
+      return V3OrderableDrugForm.SUSP;
+    if ("ITSUSP".equals(codeString))
+      return V3OrderableDrugForm.ITSUSP;
+    if ("OPSUSP".equals(codeString))
+      return V3OrderableDrugForm.OPSUSP;
+    if ("ORSUSP".equals(codeString))
+      return V3OrderableDrugForm.ORSUSP;
+    if ("ERSUSP".equals(codeString))
+      return V3OrderableDrugForm.ERSUSP;
+    if ("ERSUSP12".equals(codeString))
+      return V3OrderableDrugForm.ERSUSP12;
+    if ("ERSUSP24".equals(codeString))
+      return V3OrderableDrugForm.ERSUSP24;
+    if ("OTSUSP".equals(codeString))
+      return V3OrderableDrugForm.OTSUSP;
+    if ("RECSUSP".equals(codeString))
+      return V3OrderableDrugForm.RECSUSP;
+    if ("_SolidDrugForm".equals(codeString))
+      return V3OrderableDrugForm._SOLIDDRUGFORM;
+    if ("BAR".equals(codeString))
+      return V3OrderableDrugForm.BAR;
+    if ("BARSOAP".equals(codeString))
+      return V3OrderableDrugForm.BARSOAP;
+    if ("MEDBAR".equals(codeString))
+      return V3OrderableDrugForm.MEDBAR;
+    if ("CHEWBAR".equals(codeString))
+      return V3OrderableDrugForm.CHEWBAR;
+    if ("BEAD".equals(codeString))
+      return V3OrderableDrugForm.BEAD;
+    if ("CAKE".equals(codeString))
+      return V3OrderableDrugForm.CAKE;
+    if ("CEMENT".equals(codeString))
+      return V3OrderableDrugForm.CEMENT;
+    if ("CRYS".equals(codeString))
+      return V3OrderableDrugForm.CRYS;
+    if ("DISK".equals(codeString))
+      return V3OrderableDrugForm.DISK;
+    if ("FLAKE".equals(codeString))
+      return V3OrderableDrugForm.FLAKE;
+    if ("GRAN".equals(codeString))
+      return V3OrderableDrugForm.GRAN;
+    if ("GUM".equals(codeString))
+      return V3OrderableDrugForm.GUM;
+    if ("PAD".equals(codeString))
+      return V3OrderableDrugForm.PAD;
+    if ("MEDPAD".equals(codeString))
+      return V3OrderableDrugForm.MEDPAD;
+    if ("PATCH".equals(codeString))
+      return V3OrderableDrugForm.PATCH;
+    if ("TPATCH".equals(codeString))
+      return V3OrderableDrugForm.TPATCH;
+    if ("TPATH16".equals(codeString))
+      return V3OrderableDrugForm.TPATH16;
+    if ("TPATH24".equals(codeString))
+      return V3OrderableDrugForm.TPATH24;
+    if ("TPATH2WK".equals(codeString))
+      return V3OrderableDrugForm.TPATH2WK;
+    if ("TPATH72".equals(codeString))
+      return V3OrderableDrugForm.TPATH72;
+    if ("TPATHWK".equals(codeString))
+      return V3OrderableDrugForm.TPATHWK;
+    if ("PELLET".equals(codeString))
+      return V3OrderableDrugForm.PELLET;
+    if ("PILL".equals(codeString))
+      return V3OrderableDrugForm.PILL;
+    if ("CAP".equals(codeString))
+      return V3OrderableDrugForm.CAP;
+    if ("ORCAP".equals(codeString))
+      return V3OrderableDrugForm.ORCAP;
+    if ("ENTCAP".equals(codeString))
+      return V3OrderableDrugForm.ENTCAP;
+    if ("ERENTCAP".equals(codeString))
+      return V3OrderableDrugForm.ERENTCAP;
+    if ("ERCAP".equals(codeString))
+      return V3OrderableDrugForm.ERCAP;
+    if ("ERCAP12".equals(codeString))
+      return V3OrderableDrugForm.ERCAP12;
+    if ("ERCAP24".equals(codeString))
+      return V3OrderableDrugForm.ERCAP24;
+    if ("ERECCAP".equals(codeString))
+      return V3OrderableDrugForm.ERECCAP;
+    if ("TAB".equals(codeString))
+      return V3OrderableDrugForm.TAB;
+    if ("ORTAB".equals(codeString))
+      return V3OrderableDrugForm.ORTAB;
+    if ("BUCTAB".equals(codeString))
+      return V3OrderableDrugForm.BUCTAB;
+    if ("SRBUCTAB".equals(codeString))
+      return V3OrderableDrugForm.SRBUCTAB;
+    if ("CAPLET".equals(codeString))
+      return V3OrderableDrugForm.CAPLET;
+    if ("CHEWTAB".equals(codeString))
+      return V3OrderableDrugForm.CHEWTAB;
+    if ("CPTAB".equals(codeString))
+      return V3OrderableDrugForm.CPTAB;
+    if ("DISINTAB".equals(codeString))
+      return V3OrderableDrugForm.DISINTAB;
+    if ("DRTAB".equals(codeString))
+      return V3OrderableDrugForm.DRTAB;
+    if ("ECTAB".equals(codeString))
+      return V3OrderableDrugForm.ECTAB;
+    if ("ERECTAB".equals(codeString))
+      return V3OrderableDrugForm.ERECTAB;
+    if ("ERTAB".equals(codeString))
+      return V3OrderableDrugForm.ERTAB;
+    if ("ERTAB12".equals(codeString))
+      return V3OrderableDrugForm.ERTAB12;
+    if ("ERTAB24".equals(codeString))
+      return V3OrderableDrugForm.ERTAB24;
+    if ("ORTROCHE".equals(codeString))
+      return V3OrderableDrugForm.ORTROCHE;
+    if ("SLTAB".equals(codeString))
+      return V3OrderableDrugForm.SLTAB;
+    if ("VAGTAB".equals(codeString))
+      return V3OrderableDrugForm.VAGTAB;
+    if ("POWD".equals(codeString))
+      return V3OrderableDrugForm.POWD;
+    if ("TOPPWD".equals(codeString))
+      return V3OrderableDrugForm.TOPPWD;
+    if ("RECPWD".equals(codeString))
+      return V3OrderableDrugForm.RECPWD;
+    if ("VAGPWD".equals(codeString))
+      return V3OrderableDrugForm.VAGPWD;
+    if ("SUPP".equals(codeString))
+      return V3OrderableDrugForm.SUPP;
+    if ("RECSUPP".equals(codeString))
+      return V3OrderableDrugForm.RECSUPP;
+    if ("URETHSUPP".equals(codeString))
+      return V3OrderableDrugForm.URETHSUPP;
+    if ("VAGSUPP".equals(codeString))
+      return V3OrderableDrugForm.VAGSUPP;
+    if ("SWAB".equals(codeString))
+      return V3OrderableDrugForm.SWAB;
+    if ("MEDSWAB".equals(codeString))
+      return V3OrderableDrugForm.MEDSWAB;
+    if ("WAFER".equals(codeString))
+      return V3OrderableDrugForm.WAFER;
+    throw new IllegalArgumentException("Unknown V3OrderableDrugForm code '"+codeString+"'");
+  }
+
+  public String toCode(V3OrderableDrugForm code) {
+    if (code == V3OrderableDrugForm._ADMINISTRABLEDRUGFORM)
+      return "_AdministrableDrugForm";
+    if (code == V3OrderableDrugForm.APPFUL)
+      return "APPFUL";
+    if (code == V3OrderableDrugForm.DROP)
+      return "DROP";
+    if (code == V3OrderableDrugForm.NDROP)
+      return "NDROP";
+    if (code == V3OrderableDrugForm.OPDROP)
+      return "OPDROP";
+    if (code == V3OrderableDrugForm.ORDROP)
+      return "ORDROP";
+    if (code == V3OrderableDrugForm.OTDROP)
+      return "OTDROP";
+    if (code == V3OrderableDrugForm.PUFF)
+      return "PUFF";
+    if (code == V3OrderableDrugForm.SCOOP)
+      return "SCOOP";
+    if (code == V3OrderableDrugForm.SPRY)
+      return "SPRY";
+    if (code == V3OrderableDrugForm._DISPENSABLEDRUGFORM)
+      return "_DispensableDrugForm";
+    if (code == V3OrderableDrugForm._GASDRUGFORM)
+      return "_GasDrugForm";
+    if (code == V3OrderableDrugForm.GASINHL)
+      return "GASINHL";
+    if (code == V3OrderableDrugForm._GASLIQUIDMIXTURE)
+      return "_GasLiquidMixture";
+    if (code == V3OrderableDrugForm.AER)
+      return "AER";
+    if (code == V3OrderableDrugForm.BAINHL)
+      return "BAINHL";
+    if (code == V3OrderableDrugForm.INHLSOL)
+      return "INHLSOL";
+    if (code == V3OrderableDrugForm.MDINHL)
+      return "MDINHL";
+    if (code == V3OrderableDrugForm.NASSPRY)
+      return "NASSPRY";
+    if (code == V3OrderableDrugForm.DERMSPRY)
+      return "DERMSPRY";
+    if (code == V3OrderableDrugForm.FOAM)
+      return "FOAM";
+    if (code == V3OrderableDrugForm.FOAMAPL)
+      return "FOAMAPL";
+    if (code == V3OrderableDrugForm.RECFORM)
+      return "RECFORM";
+    if (code == V3OrderableDrugForm.VAGFOAM)
+      return "VAGFOAM";
+    if (code == V3OrderableDrugForm.VAGFOAMAPL)
+      return "VAGFOAMAPL";
+    if (code == V3OrderableDrugForm.RECSPRY)
+      return "RECSPRY";
+    if (code == V3OrderableDrugForm.VAGSPRY)
+      return "VAGSPRY";
+    if (code == V3OrderableDrugForm._GASSOLIDSPRAY)
+      return "_GasSolidSpray";
+    if (code == V3OrderableDrugForm.INHL)
+      return "INHL";
+    if (code == V3OrderableDrugForm.BAINHLPWD)
+      return "BAINHLPWD";
+    if (code == V3OrderableDrugForm.INHLPWD)
+      return "INHLPWD";
+    if (code == V3OrderableDrugForm.MDINHLPWD)
+      return "MDINHLPWD";
+    if (code == V3OrderableDrugForm.NASINHL)
+      return "NASINHL";
+    if (code == V3OrderableDrugForm.ORINHL)
+      return "ORINHL";
+    if (code == V3OrderableDrugForm.PWDSPRY)
+      return "PWDSPRY";
+    if (code == V3OrderableDrugForm.SPRYADAPT)
+      return "SPRYADAPT";
+    if (code == V3OrderableDrugForm._LIQUID)
+      return "_Liquid";
+    if (code == V3OrderableDrugForm.LIQCLN)
+      return "LIQCLN";
+    if (code == V3OrderableDrugForm.LIQSOAP)
+      return "LIQSOAP";
+    if (code == V3OrderableDrugForm.SHMP)
+      return "SHMP";
+    if (code == V3OrderableDrugForm.OIL)
+      return "OIL";
+    if (code == V3OrderableDrugForm.TOPOIL)
+      return "TOPOIL";
+    if (code == V3OrderableDrugForm.SOL)
+      return "SOL";
+    if (code == V3OrderableDrugForm.IPSOL)
+      return "IPSOL";
+    if (code == V3OrderableDrugForm.IRSOL)
+      return "IRSOL";
+    if (code == V3OrderableDrugForm.DOUCHE)
+      return "DOUCHE";
+    if (code == V3OrderableDrugForm.ENEMA)
+      return "ENEMA";
+    if (code == V3OrderableDrugForm.OPIRSOL)
+      return "OPIRSOL";
+    if (code == V3OrderableDrugForm.IVSOL)
+      return "IVSOL";
+    if (code == V3OrderableDrugForm.ORALSOL)
+      return "ORALSOL";
+    if (code == V3OrderableDrugForm.ELIXIR)
+      return "ELIXIR";
+    if (code == V3OrderableDrugForm.RINSE)
+      return "RINSE";
+    if (code == V3OrderableDrugForm.SYRUP)
+      return "SYRUP";
+    if (code == V3OrderableDrugForm.RECSOL)
+      return "RECSOL";
+    if (code == V3OrderableDrugForm.TOPSOL)
+      return "TOPSOL";
+    if (code == V3OrderableDrugForm.LIN)
+      return "LIN";
+    if (code == V3OrderableDrugForm.MUCTOPSOL)
+      return "MUCTOPSOL";
+    if (code == V3OrderableDrugForm.TINC)
+      return "TINC";
+    if (code == V3OrderableDrugForm._LIQUIDLIQUIDEMULSION)
+      return "_LiquidLiquidEmulsion";
+    if (code == V3OrderableDrugForm.CRM)
+      return "CRM";
+    if (code == V3OrderableDrugForm.NASCRM)
+      return "NASCRM";
+    if (code == V3OrderableDrugForm.OPCRM)
+      return "OPCRM";
+    if (code == V3OrderableDrugForm.ORCRM)
+      return "ORCRM";
+    if (code == V3OrderableDrugForm.OTCRM)
+      return "OTCRM";
+    if (code == V3OrderableDrugForm.RECCRM)
+      return "RECCRM";
+    if (code == V3OrderableDrugForm.TOPCRM)
+      return "TOPCRM";
+    if (code == V3OrderableDrugForm.VAGCRM)
+      return "VAGCRM";
+    if (code == V3OrderableDrugForm.VAGCRMAPL)
+      return "VAGCRMAPL";
+    if (code == V3OrderableDrugForm.LTN)
+      return "LTN";
+    if (code == V3OrderableDrugForm.TOPLTN)
+      return "TOPLTN";
+    if (code == V3OrderableDrugForm.OINT)
+      return "OINT";
+    if (code == V3OrderableDrugForm.NASOINT)
+      return "NASOINT";
+    if (code == V3OrderableDrugForm.OINTAPL)
+      return "OINTAPL";
+    if (code == V3OrderableDrugForm.OPOINT)
+      return "OPOINT";
+    if (code == V3OrderableDrugForm.OTOINT)
+      return "OTOINT";
+    if (code == V3OrderableDrugForm.RECOINT)
+      return "RECOINT";
+    if (code == V3OrderableDrugForm.TOPOINT)
+      return "TOPOINT";
+    if (code == V3OrderableDrugForm.VAGOINT)
+      return "VAGOINT";
+    if (code == V3OrderableDrugForm.VAGOINTAPL)
+      return "VAGOINTAPL";
+    if (code == V3OrderableDrugForm._LIQUIDSOLIDSUSPENSION)
+      return "_LiquidSolidSuspension";
+    if (code == V3OrderableDrugForm.GEL)
+      return "GEL";
+    if (code == V3OrderableDrugForm.GELAPL)
+      return "GELAPL";
+    if (code == V3OrderableDrugForm.NASGEL)
+      return "NASGEL";
+    if (code == V3OrderableDrugForm.OPGEL)
+      return "OPGEL";
+    if (code == V3OrderableDrugForm.OTGEL)
+      return "OTGEL";
+    if (code == V3OrderableDrugForm.TOPGEL)
+      return "TOPGEL";
+    if (code == V3OrderableDrugForm.URETHGEL)
+      return "URETHGEL";
+    if (code == V3OrderableDrugForm.VAGGEL)
+      return "VAGGEL";
+    if (code == V3OrderableDrugForm.VGELAPL)
+      return "VGELAPL";
+    if (code == V3OrderableDrugForm.PASTE)
+      return "PASTE";
+    if (code == V3OrderableDrugForm.PUD)
+      return "PUD";
+    if (code == V3OrderableDrugForm.TPASTE)
+      return "TPASTE";
+    if (code == V3OrderableDrugForm.SUSP)
+      return "SUSP";
+    if (code == V3OrderableDrugForm.ITSUSP)
+      return "ITSUSP";
+    if (code == V3OrderableDrugForm.OPSUSP)
+      return "OPSUSP";
+    if (code == V3OrderableDrugForm.ORSUSP)
+      return "ORSUSP";
+    if (code == V3OrderableDrugForm.ERSUSP)
+      return "ERSUSP";
+    if (code == V3OrderableDrugForm.ERSUSP12)
+      return "ERSUSP12";
+    if (code == V3OrderableDrugForm.ERSUSP24)
+      return "ERSUSP24";
+    if (code == V3OrderableDrugForm.OTSUSP)
+      return "OTSUSP";
+    if (code == V3OrderableDrugForm.RECSUSP)
+      return "RECSUSP";
+    if (code == V3OrderableDrugForm._SOLIDDRUGFORM)
+      return "_SolidDrugForm";
+    if (code == V3OrderableDrugForm.BAR)
+      return "BAR";
+    if (code == V3OrderableDrugForm.BARSOAP)
+      return "BARSOAP";
+    if (code == V3OrderableDrugForm.MEDBAR)
+      return "MEDBAR";
+    if (code == V3OrderableDrugForm.CHEWBAR)
+      return "CHEWBAR";
+    if (code == V3OrderableDrugForm.BEAD)
+      return "BEAD";
+    if (code == V3OrderableDrugForm.CAKE)
+      return "CAKE";
+    if (code == V3OrderableDrugForm.CEMENT)
+      return "CEMENT";
+    if (code == V3OrderableDrugForm.CRYS)
+      return "CRYS";
+    if (code == V3OrderableDrugForm.DISK)
+      return "DISK";
+    if (code == V3OrderableDrugForm.FLAKE)
+      return "FLAKE";
+    if (code == V3OrderableDrugForm.GRAN)
+      return "GRAN";
+    if (code == V3OrderableDrugForm.GUM)
+      return "GUM";
+    if (code == V3OrderableDrugForm.PAD)
+      return "PAD";
+    if (code == V3OrderableDrugForm.MEDPAD)
+      return "MEDPAD";
+    if (code == V3OrderableDrugForm.PATCH)
+      return "PATCH";
+    if (code == V3OrderableDrugForm.TPATCH)
+      return "TPATCH";
+    if (code == V3OrderableDrugForm.TPATH16)
+      return "TPATH16";
+    if (code == V3OrderableDrugForm.TPATH24)
+      return "TPATH24";
+    if (code == V3OrderableDrugForm.TPATH2WK)
+      return "TPATH2WK";
+    if (code == V3OrderableDrugForm.TPATH72)
+      return "TPATH72";
+    if (code == V3OrderableDrugForm.TPATHWK)
+      return "TPATHWK";
+    if (code == V3OrderableDrugForm.PELLET)
+      return "PELLET";
+    if (code == V3OrderableDrugForm.PILL)
+      return "PILL";
+    if (code == V3OrderableDrugForm.CAP)
+      return "CAP";
+    if (code == V3OrderableDrugForm.ORCAP)
+      return "ORCAP";
+    if (code == V3OrderableDrugForm.ENTCAP)
+      return "ENTCAP";
+    if (code == V3OrderableDrugForm.ERENTCAP)
+      return "ERENTCAP";
+    if (code == V3OrderableDrugForm.ERCAP)
+      return "ERCAP";
+    if (code == V3OrderableDrugForm.ERCAP12)
+      return "ERCAP12";
+    if (code == V3OrderableDrugForm.ERCAP24)
+      return "ERCAP24";
+    if (code == V3OrderableDrugForm.ERECCAP)
+      return "ERECCAP";
+    if (code == V3OrderableDrugForm.TAB)
+      return "TAB";
+    if (code == V3OrderableDrugForm.ORTAB)
+      return "ORTAB";
+    if (code == V3OrderableDrugForm.BUCTAB)
+      return "BUCTAB";
+    if (code == V3OrderableDrugForm.SRBUCTAB)
+      return "SRBUCTAB";
+    if (code == V3OrderableDrugForm.CAPLET)
+      return "CAPLET";
+    if (code == V3OrderableDrugForm.CHEWTAB)
+      return "CHEWTAB";
+    if (code == V3OrderableDrugForm.CPTAB)
+      return "CPTAB";
+    if (code == V3OrderableDrugForm.DISINTAB)
+      return "DISINTAB";
+    if (code == V3OrderableDrugForm.DRTAB)
+      return "DRTAB";
+    if (code == V3OrderableDrugForm.ECTAB)
+      return "ECTAB";
+    if (code == V3OrderableDrugForm.ERECTAB)
+      return "ERECTAB";
+    if (code == V3OrderableDrugForm.ERTAB)
+      return "ERTAB";
+    if (code == V3OrderableDrugForm.ERTAB12)
+      return "ERTAB12";
+    if (code == V3OrderableDrugForm.ERTAB24)
+      return "ERTAB24";
+    if (code == V3OrderableDrugForm.ORTROCHE)
+      return "ORTROCHE";
+    if (code == V3OrderableDrugForm.SLTAB)
+      return "SLTAB";
+    if (code == V3OrderableDrugForm.VAGTAB)
+      return "VAGTAB";
+    if (code == V3OrderableDrugForm.POWD)
+      return "POWD";
+    if (code == V3OrderableDrugForm.TOPPWD)
+      return "TOPPWD";
+    if (code == V3OrderableDrugForm.RECPWD)
+      return "RECPWD";
+    if (code == V3OrderableDrugForm.VAGPWD)
+      return "VAGPWD";
+    if (code == V3OrderableDrugForm.SUPP)
+      return "SUPP";
+    if (code == V3OrderableDrugForm.RECSUPP)
+      return "RECSUPP";
+    if (code == V3OrderableDrugForm.URETHSUPP)
+      return "URETHSUPP";
+    if (code == V3OrderableDrugForm.VAGSUPP)
+      return "VAGSUPP";
+    if (code == V3OrderableDrugForm.SWAB)
+      return "SWAB";
+    if (code == V3OrderableDrugForm.MEDSWAB)
+      return "MEDSWAB";
+    if (code == V3OrderableDrugForm.WAFER)
+      return "WAFER";
+    return "?";
+  }
+
+    public String toSystem(V3OrderableDrugForm code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationFunction.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationFunction.java
new file mode 100644
index 00000000000..c15e34bb590
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationFunction.java
@@ -0,0 +1,520 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ParticipationFunction {
+
+        /**
+         * This code is used to specify the exact function an actor is authorized to have in a service in all necessary detail.
+         */
+        _AUTHORIZEDPARTICIPATIONFUNCTION, 
+        /**
+         * This code is used to specify the exact function an actor is authorized to have as a receiver of information that is the subject of a consent directive or consent override.
+         */
+        _AUTHORIZEDRECEIVERPARTICIPATIONFUNCTION, 
+        /**
+         * Description:Caregiver authorized to receive patient health information.
+         */
+        AUCG, 
+        /**
+         * Description:Provider with legitimate relationship authorized to receive patient health information.
+         */
+        AULR, 
+        /**
+         * Description:Member of care team authorized to receive patient health information.
+         */
+        AUTM, 
+        /**
+         * Description:Entities within specified work area authorized to receive patient health information.
+         */
+        AUWA, 
+        /**
+         * This code is used to specify the exact function an actor is authorized to have in authoring a consent directive.
+         */
+        _CONSENTERPARTICIPATIONFUNCTION, 
+        /**
+         * Description:Legal guardian of the subject of consent authorized to author a consent directive for the subject of consent.
+         */
+        GRDCON, 
+        /**
+         * Description:Person authorized with healthcare power of attorney to author a  consent directive for the subject of consent.
+         */
+        POACON, 
+        /**
+         * Description:Personal representative of the subject of consent authorized to author a consent directive for the subject of consent.
+         */
+        PRCON, 
+        /**
+         * Definition:Provider authorized to mask information to protect the patient, a third party, or to ensure that the provider has consulted with the patient prior to release of this information.
+         */
+        PROMSK, 
+        /**
+         * Description:Subject of consent authorized to author a consent directive.
+         */
+        SUBCON, 
+        /**
+         * This code is used to specify the exact function an actor is authorized to have in authoring a consent override.
+         */
+        _OVERRIDERPARTICIPATIONFUNCTION, 
+        /**
+         * Description:Entity authorized to override a consent directive.
+         */
+        AUCOV, 
+        /**
+         * Description:Entity  authorized to override a consent directive or privacy policy in an emergency.
+         */
+        AUEMROV, 
+        /**
+         * Definition: Set of codes indicating the manner in which sponsors, underwriters, and payers participate in a policy or program.
+         */
+        _COVERAGEPARTICIPATIONFUNCTION, 
+        /**
+         * Definition: Set of codes indicating the manner in which payors participate in a policy or program. {
+
+  public V3ParticipationFunction fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_AuthorizedParticipationFunction".equals(codeString))
+      return V3ParticipationFunction._AUTHORIZEDPARTICIPATIONFUNCTION;
+    if ("_AuthorizedReceiverParticipationFunction".equals(codeString))
+      return V3ParticipationFunction._AUTHORIZEDRECEIVERPARTICIPATIONFUNCTION;
+    if ("AUCG".equals(codeString))
+      return V3ParticipationFunction.AUCG;
+    if ("AULR".equals(codeString))
+      return V3ParticipationFunction.AULR;
+    if ("AUTM".equals(codeString))
+      return V3ParticipationFunction.AUTM;
+    if ("AUWA".equals(codeString))
+      return V3ParticipationFunction.AUWA;
+    if ("_ConsenterParticipationFunction".equals(codeString))
+      return V3ParticipationFunction._CONSENTERPARTICIPATIONFUNCTION;
+    if ("GRDCON".equals(codeString))
+      return V3ParticipationFunction.GRDCON;
+    if ("POACON".equals(codeString))
+      return V3ParticipationFunction.POACON;
+    if ("PRCON".equals(codeString))
+      return V3ParticipationFunction.PRCON;
+    if ("PROMSK".equals(codeString))
+      return V3ParticipationFunction.PROMSK;
+    if ("SUBCON".equals(codeString))
+      return V3ParticipationFunction.SUBCON;
+    if ("_OverriderParticipationFunction".equals(codeString))
+      return V3ParticipationFunction._OVERRIDERPARTICIPATIONFUNCTION;
+    if ("AUCOV".equals(codeString))
+      return V3ParticipationFunction.AUCOV;
+    if ("AUEMROV".equals(codeString))
+      return V3ParticipationFunction.AUEMROV;
+    if ("_CoverageParticipationFunction".equals(codeString))
+      return V3ParticipationFunction._COVERAGEPARTICIPATIONFUNCTION;
+    if ("_PayorParticipationFunction".equals(codeString))
+      return V3ParticipationFunction._PAYORPARTICIPATIONFUNCTION;
+    if ("CLMADJ".equals(codeString))
+      return V3ParticipationFunction.CLMADJ;
+    if ("ENROLL".equals(codeString))
+      return V3ParticipationFunction.ENROLL;
+    if ("FFSMGT".equals(codeString))
+      return V3ParticipationFunction.FFSMGT;
+    if ("MCMGT".equals(codeString))
+      return V3ParticipationFunction.MCMGT;
+    if ("PROVMGT".equals(codeString))
+      return V3ParticipationFunction.PROVMGT;
+    if ("UMGT".equals(codeString))
+      return V3ParticipationFunction.UMGT;
+    if ("_SponsorParticipationFunction".equals(codeString))
+      return V3ParticipationFunction._SPONSORPARTICIPATIONFUNCTION;
+    if ("FULINRD".equals(codeString))
+      return V3ParticipationFunction.FULINRD;
+    if ("SELFINRD".equals(codeString))
+      return V3ParticipationFunction.SELFINRD;
+    if ("_UnderwriterParticipationFunction".equals(codeString))
+      return V3ParticipationFunction._UNDERWRITERPARTICIPATIONFUNCTION;
+    if ("PAYORCNTR".equals(codeString))
+      return V3ParticipationFunction.PAYORCNTR;
+    if ("REINS".equals(codeString))
+      return V3ParticipationFunction.REINS;
+    if ("RETROCES".equals(codeString))
+      return V3ParticipationFunction.RETROCES;
+    if ("SUBCTRT".equals(codeString))
+      return V3ParticipationFunction.SUBCTRT;
+    if ("UNDERWRTNG".equals(codeString))
+      return V3ParticipationFunction.UNDERWRTNG;
+    if ("ADMPHYS".equals(codeString))
+      return V3ParticipationFunction.ADMPHYS;
+    if ("ANEST".equals(codeString))
+      return V3ParticipationFunction.ANEST;
+    if ("ANRS".equals(codeString))
+      return V3ParticipationFunction.ANRS;
+    if ("ASSEMBLER".equals(codeString))
+      return V3ParticipationFunction.ASSEMBLER;
+    if ("ATTPHYS".equals(codeString))
+      return V3ParticipationFunction.ATTPHYS;
+    if ("COMPOSER".equals(codeString))
+      return V3ParticipationFunction.COMPOSER;
+    if ("DISPHYS".equals(codeString))
+      return V3ParticipationFunction.DISPHYS;
+    if ("FASST".equals(codeString))
+      return V3ParticipationFunction.FASST;
+    if ("MDWF".equals(codeString))
+      return V3ParticipationFunction.MDWF;
+    if ("NASST".equals(codeString))
+      return V3ParticipationFunction.NASST;
+    if ("PCP".equals(codeString))
+      return V3ParticipationFunction.PCP;
+    if ("PRISURG".equals(codeString))
+      return V3ParticipationFunction.PRISURG;
+    if ("REVIEWER".equals(codeString))
+      return V3ParticipationFunction.REVIEWER;
+    if ("RNDPHYS".equals(codeString))
+      return V3ParticipationFunction.RNDPHYS;
+    if ("SASST".equals(codeString))
+      return V3ParticipationFunction.SASST;
+    if ("SNRS".equals(codeString))
+      return V3ParticipationFunction.SNRS;
+    if ("TASST".equals(codeString))
+      return V3ParticipationFunction.TASST;
+    throw new IllegalArgumentException("Unknown V3ParticipationFunction code '"+codeString+"'");
+  }
+
+  public String toCode(V3ParticipationFunction code) {
+    if (code == V3ParticipationFunction._AUTHORIZEDPARTICIPATIONFUNCTION)
+      return "_AuthorizedParticipationFunction";
+    if (code == V3ParticipationFunction._AUTHORIZEDRECEIVERPARTICIPATIONFUNCTION)
+      return "_AuthorizedReceiverParticipationFunction";
+    if (code == V3ParticipationFunction.AUCG)
+      return "AUCG";
+    if (code == V3ParticipationFunction.AULR)
+      return "AULR";
+    if (code == V3ParticipationFunction.AUTM)
+      return "AUTM";
+    if (code == V3ParticipationFunction.AUWA)
+      return "AUWA";
+    if (code == V3ParticipationFunction._CONSENTERPARTICIPATIONFUNCTION)
+      return "_ConsenterParticipationFunction";
+    if (code == V3ParticipationFunction.GRDCON)
+      return "GRDCON";
+    if (code == V3ParticipationFunction.POACON)
+      return "POACON";
+    if (code == V3ParticipationFunction.PRCON)
+      return "PRCON";
+    if (code == V3ParticipationFunction.PROMSK)
+      return "PROMSK";
+    if (code == V3ParticipationFunction.SUBCON)
+      return "SUBCON";
+    if (code == V3ParticipationFunction._OVERRIDERPARTICIPATIONFUNCTION)
+      return "_OverriderParticipationFunction";
+    if (code == V3ParticipationFunction.AUCOV)
+      return "AUCOV";
+    if (code == V3ParticipationFunction.AUEMROV)
+      return "AUEMROV";
+    if (code == V3ParticipationFunction._COVERAGEPARTICIPATIONFUNCTION)
+      return "_CoverageParticipationFunction";
+    if (code == V3ParticipationFunction._PAYORPARTICIPATIONFUNCTION)
+      return "_PayorParticipationFunction";
+    if (code == V3ParticipationFunction.CLMADJ)
+      return "CLMADJ";
+    if (code == V3ParticipationFunction.ENROLL)
+      return "ENROLL";
+    if (code == V3ParticipationFunction.FFSMGT)
+      return "FFSMGT";
+    if (code == V3ParticipationFunction.MCMGT)
+      return "MCMGT";
+    if (code == V3ParticipationFunction.PROVMGT)
+      return "PROVMGT";
+    if (code == V3ParticipationFunction.UMGT)
+      return "UMGT";
+    if (code == V3ParticipationFunction._SPONSORPARTICIPATIONFUNCTION)
+      return "_SponsorParticipationFunction";
+    if (code == V3ParticipationFunction.FULINRD)
+      return "FULINRD";
+    if (code == V3ParticipationFunction.SELFINRD)
+      return "SELFINRD";
+    if (code == V3ParticipationFunction._UNDERWRITERPARTICIPATIONFUNCTION)
+      return "_UnderwriterParticipationFunction";
+    if (code == V3ParticipationFunction.PAYORCNTR)
+      return "PAYORCNTR";
+    if (code == V3ParticipationFunction.REINS)
+      return "REINS";
+    if (code == V3ParticipationFunction.RETROCES)
+      return "RETROCES";
+    if (code == V3ParticipationFunction.SUBCTRT)
+      return "SUBCTRT";
+    if (code == V3ParticipationFunction.UNDERWRTNG)
+      return "UNDERWRTNG";
+    if (code == V3ParticipationFunction.ADMPHYS)
+      return "ADMPHYS";
+    if (code == V3ParticipationFunction.ANEST)
+      return "ANEST";
+    if (code == V3ParticipationFunction.ANRS)
+      return "ANRS";
+    if (code == V3ParticipationFunction.ASSEMBLER)
+      return "ASSEMBLER";
+    if (code == V3ParticipationFunction.ATTPHYS)
+      return "ATTPHYS";
+    if (code == V3ParticipationFunction.COMPOSER)
+      return "COMPOSER";
+    if (code == V3ParticipationFunction.DISPHYS)
+      return "DISPHYS";
+    if (code == V3ParticipationFunction.FASST)
+      return "FASST";
+    if (code == V3ParticipationFunction.MDWF)
+      return "MDWF";
+    if (code == V3ParticipationFunction.NASST)
+      return "NASST";
+    if (code == V3ParticipationFunction.PCP)
+      return "PCP";
+    if (code == V3ParticipationFunction.PRISURG)
+      return "PRISURG";
+    if (code == V3ParticipationFunction.REVIEWER)
+      return "REVIEWER";
+    if (code == V3ParticipationFunction.RNDPHYS)
+      return "RNDPHYS";
+    if (code == V3ParticipationFunction.SASST)
+      return "SASST";
+    if (code == V3ParticipationFunction.SNRS)
+      return "SNRS";
+    if (code == V3ParticipationFunction.TASST)
+      return "TASST";
+    return "?";
+  }
+
+    public String toSystem(V3ParticipationFunction code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationMode.java
new file mode 100644
index 00000000000..3f2c4a336d4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationMode.java
@@ -0,0 +1,204 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ParticipationMode {
+
+        /**
+         * Participation by non-human-languaged based electronic signal
+         */
+        ELECTRONIC, 
+        /**
+         * Participation by direct action where subject and actor are in the same location. (The participation involves more than communication.)
+         */
+        PHYSICAL, 
+        /**
+         * Participation by direct action where subject and actor are in separate locations, and the actions of the actor are transmitted by electronic or mechanical means. (The participation involves more than communication.)
+         */
+        REMOTE, 
+        /**
+         * Participation by voice communication
+         */
+        VERBAL, 
+        /**
+         * Participation by pre-recorded voice.  Communication is limited to one direction (from the recorder to recipient).
+         */
+        DICTATE, 
+        /**
+         * Participation by voice communication where parties speak to each other directly.
+         */
+        FACE, 
+        /**
+         * Participation by voice communication where the voices of the communicating parties are transported over an electronic medium
+         */
+        PHONE, 
+        /**
+         * Participation by voice and visual communication where the voices and images of the communicating parties are transported over an electronic medium
+         */
+        VIDEOCONF, 
+        /**
+         * Participation by human language recorded on a physical material
+         */
+        WRITTEN, 
+        /**
+         * Participation by text or diagrams printed on paper that have been transmitted over a fax device
+         */
+        FAXWRIT, 
+        /**
+         * Participation by text or diagrams printed on paper or other recording medium
+         */
+        HANDWRIT, 
+        /**
+         * Participation by text or diagrams printed on paper transmitted physically (e.g. by courier service, postal service).
+         */
+        MAILWRIT, 
+        /**
+         * Participation by text or diagrams submitted by computer network, e.g. online survey.
+         */
+        ONLINEWRIT, 
+        /**
+         * Participation by text or diagrams transmitted over an electronic mail system.
+         */
+        EMAILWRIT, 
+        /**
+         * Participation by text or diagrams printed on paper or other recording medium where the recording was performed using a typewriter, typesetter, computer or similar mechanism.
+         */
+        TYPEWRIT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ParticipationMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ELECTRONIC".equals(codeString))
+          return ELECTRONIC;
+        if ("PHYSICAL".equals(codeString))
+          return PHYSICAL;
+        if ("REMOTE".equals(codeString))
+          return REMOTE;
+        if ("VERBAL".equals(codeString))
+          return VERBAL;
+        if ("DICTATE".equals(codeString))
+          return DICTATE;
+        if ("FACE".equals(codeString))
+          return FACE;
+        if ("PHONE".equals(codeString))
+          return PHONE;
+        if ("VIDEOCONF".equals(codeString))
+          return VIDEOCONF;
+        if ("WRITTEN".equals(codeString))
+          return WRITTEN;
+        if ("FAXWRIT".equals(codeString))
+          return FAXWRIT;
+        if ("HANDWRIT".equals(codeString))
+          return HANDWRIT;
+        if ("MAILWRIT".equals(codeString))
+          return MAILWRIT;
+        if ("ONLINEWRIT".equals(codeString))
+          return ONLINEWRIT;
+        if ("EMAILWRIT".equals(codeString))
+          return EMAILWRIT;
+        if ("TYPEWRIT".equals(codeString))
+          return TYPEWRIT;
+        throw new FHIRException("Unknown V3ParticipationMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ELECTRONIC: return "ELECTRONIC";
+            case PHYSICAL: return "PHYSICAL";
+            case REMOTE: return "REMOTE";
+            case VERBAL: return "VERBAL";
+            case DICTATE: return "DICTATE";
+            case FACE: return "FACE";
+            case PHONE: return "PHONE";
+            case VIDEOCONF: return "VIDEOCONF";
+            case WRITTEN: return "WRITTEN";
+            case FAXWRIT: return "FAXWRIT";
+            case HANDWRIT: return "HANDWRIT";
+            case MAILWRIT: return "MAILWRIT";
+            case ONLINEWRIT: return "ONLINEWRIT";
+            case EMAILWRIT: return "EMAILWRIT";
+            case TYPEWRIT: return "TYPEWRIT";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ParticipationMode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ELECTRONIC: return "Participation by non-human-languaged based electronic signal";
+            case PHYSICAL: return "Participation by direct action where subject and actor are in the same location. (The participation involves more than communication.)";
+            case REMOTE: return "Participation by direct action where subject and actor are in separate locations, and the actions of the actor are transmitted by electronic or mechanical means. (The participation involves more than communication.)";
+            case VERBAL: return "Participation by voice communication";
+            case DICTATE: return "Participation by pre-recorded voice.  Communication is limited to one direction (from the recorder to recipient).";
+            case FACE: return "Participation by voice communication where parties speak to each other directly.";
+            case PHONE: return "Participation by voice communication where the voices of the communicating parties are transported over an electronic medium";
+            case VIDEOCONF: return "Participation by voice and visual communication where the voices and images of the communicating parties are transported over an electronic medium";
+            case WRITTEN: return "Participation by human language recorded on a physical material";
+            case FAXWRIT: return "Participation by text or diagrams printed on paper that have been transmitted over a fax device";
+            case HANDWRIT: return "Participation by text or diagrams printed on paper or other recording medium";
+            case MAILWRIT: return "Participation by text or diagrams printed on paper transmitted physically (e.g. by courier service, postal service).";
+            case ONLINEWRIT: return "Participation by text or diagrams submitted by computer network, e.g. online survey.";
+            case EMAILWRIT: return "Participation by text or diagrams transmitted over an electronic mail system.";
+            case TYPEWRIT: return "Participation by text or diagrams printed on paper or other recording medium where the recording was performed using a typewriter, typesetter, computer or similar mechanism.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ELECTRONIC: return "electronic data";
+            case PHYSICAL: return "physical presence";
+            case REMOTE: return "remote presence";
+            case VERBAL: return "verbal";
+            case DICTATE: return "dictated";
+            case FACE: return "face-to-face";
+            case PHONE: return "telephone";
+            case VIDEOCONF: return "videoconferencing";
+            case WRITTEN: return "written";
+            case FAXWRIT: return "telefax";
+            case HANDWRIT: return "handwritten";
+            case MAILWRIT: return "mail";
+            case ONLINEWRIT: return "online written";
+            case EMAILWRIT: return "email";
+            case TYPEWRIT: return "typewritten";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationModeEnumFactory.java
new file mode 100644
index 00000000000..89e82b4e4cf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationModeEnumFactory.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ParticipationModeEnumFactory implements EnumFactory {
+
+  public V3ParticipationMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ELECTRONIC".equals(codeString))
+      return V3ParticipationMode.ELECTRONIC;
+    if ("PHYSICAL".equals(codeString))
+      return V3ParticipationMode.PHYSICAL;
+    if ("REMOTE".equals(codeString))
+      return V3ParticipationMode.REMOTE;
+    if ("VERBAL".equals(codeString))
+      return V3ParticipationMode.VERBAL;
+    if ("DICTATE".equals(codeString))
+      return V3ParticipationMode.DICTATE;
+    if ("FACE".equals(codeString))
+      return V3ParticipationMode.FACE;
+    if ("PHONE".equals(codeString))
+      return V3ParticipationMode.PHONE;
+    if ("VIDEOCONF".equals(codeString))
+      return V3ParticipationMode.VIDEOCONF;
+    if ("WRITTEN".equals(codeString))
+      return V3ParticipationMode.WRITTEN;
+    if ("FAXWRIT".equals(codeString))
+      return V3ParticipationMode.FAXWRIT;
+    if ("HANDWRIT".equals(codeString))
+      return V3ParticipationMode.HANDWRIT;
+    if ("MAILWRIT".equals(codeString))
+      return V3ParticipationMode.MAILWRIT;
+    if ("ONLINEWRIT".equals(codeString))
+      return V3ParticipationMode.ONLINEWRIT;
+    if ("EMAILWRIT".equals(codeString))
+      return V3ParticipationMode.EMAILWRIT;
+    if ("TYPEWRIT".equals(codeString))
+      return V3ParticipationMode.TYPEWRIT;
+    throw new IllegalArgumentException("Unknown V3ParticipationMode code '"+codeString+"'");
+  }
+
+  public String toCode(V3ParticipationMode code) {
+    if (code == V3ParticipationMode.ELECTRONIC)
+      return "ELECTRONIC";
+    if (code == V3ParticipationMode.PHYSICAL)
+      return "PHYSICAL";
+    if (code == V3ParticipationMode.REMOTE)
+      return "REMOTE";
+    if (code == V3ParticipationMode.VERBAL)
+      return "VERBAL";
+    if (code == V3ParticipationMode.DICTATE)
+      return "DICTATE";
+    if (code == V3ParticipationMode.FACE)
+      return "FACE";
+    if (code == V3ParticipationMode.PHONE)
+      return "PHONE";
+    if (code == V3ParticipationMode.VIDEOCONF)
+      return "VIDEOCONF";
+    if (code == V3ParticipationMode.WRITTEN)
+      return "WRITTEN";
+    if (code == V3ParticipationMode.FAXWRIT)
+      return "FAXWRIT";
+    if (code == V3ParticipationMode.HANDWRIT)
+      return "HANDWRIT";
+    if (code == V3ParticipationMode.MAILWRIT)
+      return "MAILWRIT";
+    if (code == V3ParticipationMode.ONLINEWRIT)
+      return "ONLINEWRIT";
+    if (code == V3ParticipationMode.EMAILWRIT)
+      return "EMAILWRIT";
+    if (code == V3ParticipationMode.TYPEWRIT)
+      return "TYPEWRIT";
+    return "?";
+  }
+
+    public String toSystem(V3ParticipationMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationSignature.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationSignature.java
new file mode 100644
index 00000000000..d8621b68dbe
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationSignature.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ParticipationSignature {
+
+        /**
+         * The particpant intends to provide a signature.
+         */
+        I, 
+        /**
+         * Signature has been affixed, either written on file, or electronic (incl. digital) signature in Participation.signatureText.
+         */
+        S, 
+        /**
+         * A signature for the service is required of this actor.
+         */
+        X, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ParticipationSignature fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("I".equals(codeString))
+          return I;
+        if ("S".equals(codeString))
+          return S;
+        if ("X".equals(codeString))
+          return X;
+        throw new FHIRException("Unknown V3ParticipationSignature code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case I: return "I";
+            case S: return "S";
+            case X: return "X";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ParticipationSignature";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case I: return "The particpant intends to provide a signature.";
+            case S: return "Signature has been affixed, either written on file, or electronic (incl. digital) signature in Participation.signatureText.";
+            case X: return "A signature for the service is required of this actor.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case I: return "intended";
+            case S: return "signed";
+            case X: return "required";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationSignatureEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationSignatureEnumFactory.java
new file mode 100644
index 00000000000..9c23561174d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationSignatureEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ParticipationSignatureEnumFactory implements EnumFactory {
+
+  public V3ParticipationSignature fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("I".equals(codeString))
+      return V3ParticipationSignature.I;
+    if ("S".equals(codeString))
+      return V3ParticipationSignature.S;
+    if ("X".equals(codeString))
+      return V3ParticipationSignature.X;
+    throw new IllegalArgumentException("Unknown V3ParticipationSignature code '"+codeString+"'");
+  }
+
+  public String toCode(V3ParticipationSignature code) {
+    if (code == V3ParticipationSignature.I)
+      return "I";
+    if (code == V3ParticipationSignature.S)
+      return "S";
+    if (code == V3ParticipationSignature.X)
+      return "X";
+    return "?";
+  }
+
+    public String toSystem(V3ParticipationSignature code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationType.java
new file mode 100644
index 00000000000..7518b69e5c1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationType.java
@@ -0,0 +1,668 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ParticipationType {
+
+        /**
+         * Indicates that the target of the participation is involved in some manner in the act, but does not qualify how.
+         */
+        PART, 
+        /**
+         * Participations related, but not primary to an act. The Referring, Admitting, and Discharging practitioners must be the same person as those authoring the ControlAct event for their respective trigger events.
+         */
+        _PARTICIPATIONANCILLARY, 
+        /**
+         * The practitioner who is responsible for admitting a patient to a patient encounter.
+         */
+        ADM, 
+        /**
+         * The practitioner that has responsibility for overseeing a patient's care during a patient encounter.
+         */
+        ATND, 
+        /**
+         * A person or organization who should be contacted for follow-up questions about the act in place of the author.
+         */
+        CALLBCK, 
+        /**
+         * An advisor participating in the service by performing evaluations and making recommendations.
+         */
+        CON, 
+        /**
+         * The practitioner who is responsible for the discharge of a patient from a patient encounter.
+         */
+        DIS, 
+        /**
+         * Only with Transportation services.  A person who escorts the patient.
+         */
+        ESC, 
+        /**
+         * A person having referred the subject of the service to the performer (referring physician).  Typically, a referring physician will receive a report.
+         */
+        REF, 
+        /**
+         * 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).
+         */
+        _PARTICIPATIONINFORMATIONGENERATOR, 
+        /**
+         * Definition: A party that originates the Act and therefore has responsibility for the information given in the Act and ownership of this Act.
+
+                        
+                           Example: the report writer, the person writing the act definition, the guideline author, the placer of an order, the EKG cart (device) creating a report etc. Every Act should have an author. Authorship is regardless of mood always actual authorship. 
+
+                        Examples of such policies might include:
+
+                        
+                           
+                              The author and anyone they explicitly delegate may update the report;
+
+                           
+                           
+                              All administrators within the same clinic may cancel and reschedule appointments created by other administrators within that clinic;
+
+                           
+                        
+                        A party that is neither an author nor a party who is extended authorship maintenance rights by policy, may only amend, reverse, override, replace, or follow up in other ways on this Act, whereby the Act remains intact and is linked to another Act authored by that other party.
+         */
+        AUT, 
+        /**
+         * A source of reported information (e.g., a next of kin who answers questions about the patient's history).  For history questions, the patient is logically an informant, yet the informant of history questions is implicitly the subject.
+         */
+        INF, 
+        /**
+         * An entity entering the data into the originating system. The data entry entity is collected optionally for internal quality control purposes. This includes the transcriptionist for dictated text transcribed into electronic form.
+         */
+        TRANS, 
+        /**
+         * A person entering the data into the originating system.  The data entry person is collected optionally for internal quality control purposes.  This includes the transcriptionist for dictated text.
+         */
+        ENT, 
+        /**
+         * Only with service events.  A person witnessing the action happening without doing anything.  A witness is not necessarily aware, much less approves of anything stated in the service event.  Example for a witness is students watching an operation or an advanced directive witness.
+         */
+        WIT, 
+        /**
+         * An entity (person, organization or device) that is in charge of maintaining the information of this act (e.g., who maintains the report or the master service catalog item, etc.).
+         */
+        CST, 
+        /**
+         * Target participant  that is substantially present in the act  and which is directly involved in the action (includes consumed material, devices, etc.).
+         */
+        DIR, 
+        /**
+         * The target of an Observation action. Links an observation to a Role whose player is the substance or most specific component entity (material, micro-organism, etc.) being measured within the subject.
+
+                        
+                           Examples: A "plasma porcelain substance concentration" has analyte a Role with player substance Entity "porcelain".
+
+                        
+                           UsageNotes: The Role that this participation connects to may be any Role whose player is that substance measured. Very often, the scoper may indicate the system in which the component is being measured. E.g., for "plasma porcelain" the scoper could be "Plasma".
+         */
+        ALY, 
+        /**
+         * In an obstetric service, the baby.
+         */
+        BBY, 
+        /**
+         * The catalyst of a chemical reaction, such as an enzyme or a platinum surface. In biochemical reactions, connects the enzyme with the molecular interaction
+         */
+        CAT, 
+        /**
+         * Participant material that is taken up, diminished, altered, or disappears in the act.
+         */
+        CSM, 
+        /**
+         * Something incorporated in the subject of a therapy service to achieve a physiologic effect (e.g., heal, relieve, provoke a condition, etc.) on the subject.  In an administration service the therapeutic agent is a consumable, in a preparation or dispense service, it is a product.  Thus, consumable or product must be specified in accordance with the kind of service.
+         */
+        TPA, 
+        /**
+         * Participant used in performing the act without being substantially affected by the act (i.e. durable or inert with respect to that particular service).
+
+                        
+                           Examples: monitoring equipment, tools, but also access/drainage lines, prostheses, pace maker, etc.
+         */
+        DEV, 
+        /**
+         * A device that changes ownership due to the service, e.g., a pacemaker, a prosthesis, an insulin injection equipment (pen), etc.  Such material may need to be restocked after he service.
+         */
+        NRD, 
+        /**
+         * A device that does not change ownership due to the service, i.e., a surgical instrument or tool or an endoscope.  The distinction between reuseable and non-reuseable must be made in order to know whether material must be re-stocked.
+         */
+        RDV, 
+        /**
+         * In some organ transplantation services and rarely in transfusion services a donor will be a target participant in the service.  However, in most cases transplantation is decomposed in three services: explantation, transport, and implantation.  The identity of the donor (recipient) is often irrelevant for the explantation (implantation) service.
+         */
+        DON, 
+        /**
+         * Description: The entity playing the associated role is the physical (including energy), chemical or biological substance that is participating in the exposure.  For example in communicable diseases, the associated playing entity is the disease causing pathogen.
+         */
+        EXPAGNT, 
+        /**
+         * Description:Direct participation in an exposure act where it is unknown that the participant is the source or subject of the exposure.  If the participant is known to be the contact of an exposure then the SBJ participation type should be used.  If the participant is known to be the source then the EXSRC participation type should be used.
+         */
+        EXPART, 
+        /**
+         * Description: The entity playing the associated role is the target (contact) of exposure.
+         */
+        EXPTRGT, 
+        /**
+         * Description:The entity playing the associated role is the source of exposure.
+         */
+        EXSRC, 
+        /**
+         * Participant material that is brought forth (produced) in the act (e.g., specimen in a specimen collection, access or drainage in a placement service, medication package in a dispense service). It does not matter whether the material produced had existence prior to the service, or whether it is created in the service (e.g., in supply services the product is taken from a stock).
+         */
+        PRD, 
+        /**
+         * The principle target on which the action happens.
+
+                        
+                           Examples: The patient in physical examination, a specimen in a lab observation. May also be a patient's family member (teaching) or a device or room (cleaning, disinfecting, housekeeping). 
+
+                        
+                           UsageNotes: Not all direct targets are subjects. Consumables and devices used as tools for an act are not subjects. However, a device may be a subject of a maintenance action.
+         */
+        SBJ, 
+        /**
+         * The subject of non-clinical (e.g. laboratory) observation services is a specimen.
+         */
+        SPC, 
+        /**
+         * Target that is not substantially present in the act and which is not directly affected by the act, but which will be a focus of the record or documentation of the act.
+         */
+        IND, 
+        /**
+         * Target on behalf of whom the service happens, but that is not necessarily present in the service.  Can occur together with direct target to indicate that a target is both, as in the case where the patient is the indirect beneficiary of a service rendered to a family member, e.g. counseling or given home care instructions.  This concept includes a participant, such as a covered party, who derives benefits from a service act covered by a coverage act.
+
+                        Note that the semantic role of the intended recipient who benefits from the happening denoted by the verb in the clause.  Thus, a patient who has no coverage under a policy or program may be a beneficiary of a health service while not being the beneficiary of coverage for that service.
+         */
+        BEN, 
+        /**
+         * Definition: A factor, such as a microorganism, chemical substance, or form of radiation, whose presence, excessive presence, or (in deficiency diseases) relative absence is essential, in whole or in part, for the occurrence of a condition.
+
+                        Constraint:  The use of this participation is limited to observations.
+         */
+        CAGNT, 
+        /**
+         * The target participation for an individual in a health care coverage act in which the target role is either the policy holder of the coverage, or a covered party under the coverage.
+         */
+        COV, 
+        /**
+         * The target person or organization contractually recognized by the issuer as a participant who has assumed fiscal responsibility for another personaTMs financial obligations by guaranteeing to pay for amounts owed to a particular account
+
+                        
+                           Example:The subscriber of the patientaTMs health insurance policy signs a contract with the provider to be fiscally responsible for the patient billing account balance amount owed.
+         */
+        GUAR, 
+        /**
+         * Participant who posses an instrument such as a financial contract (insurance policy) usually based on some agreement with the author.
+         */
+        HLD, 
+        /**
+         * The record target indicates whose medical record holds the documentation of this act.  This is especially important when the subject of a service is not the patient himself.
+         */
+        RCT, 
+        /**
+         * The person (or organization) who receives the product of an Act.
+         */
+        RCV, 
+        /**
+         * A party, who may or should receive or who has recieved the Act or subsequent or derivative information of that Act. Information recipient is inert, i.e., independent of mood." Rationale: this is a generalization of a too diverse family that the definition can't be any more specific, and the concept is abstract so one of the specializations should be used.
+         */
+        IRCP, 
+        /**
+         * An information recipient to notify for urgent matters about this Act. (e.g., in a laboratory order, critical results are being called by phone right away, this is the contact to call; or for an inpatient encounter, a next of kin to notify when the patient becomes critically ill).
+         */
+        NOT, 
+        /**
+         * Information recipient to whom an act statement is primarily directed. E.g., a primary care provider receiving a discharge letter from a hospitalist, a health department receiving information on a suspected case of infectious disease. Multiple of these participations may exist on the same act without requiring that recipients be ranked as primary vs. secondary.
+         */
+        PRCP, 
+        /**
+         * A participant (e.g. provider) who has referred the subject of an act (e.g. patient).
+
+                        Typically, a referred by participant will provide a report (e.g. referral).
+         */
+        REFB, 
+        /**
+         * The person who receives the patient
+         */
+        REFT, 
+        /**
+         * A secondary information recipient, who receives copies (e.g., a primary care provider receiving copies of results as ordered by specialist).
+         */
+        TRC, 
+        /**
+         * The facility where the service is done.  May be a static building (or room therein) or a moving location (e.g., ambulance, helicopter, aircraft, train, truck, ship, etc.)
+         */
+        LOC, 
+        /**
+         * The destination for services.  May be a static building (or room therein) or a movable facility (e.g., ship).
+         */
+        DST, 
+        /**
+         * A location where data about an Act was entered.
+         */
+        ELOC, 
+        /**
+         * The location of origin for services.  May be a static building (or room therein) or a movable facility (e.g., ship).
+         */
+        ORG, 
+        /**
+         * Some services take place at multiple concurrent locations (e.g., telemedicine, telephone consultation).  The location where the principal performing actor is located is taken as the primary location (LOC) while the other location(s) are considered "remote."
+         */
+        RML, 
+        /**
+         * For services, an intermediate location that specifies a path between origin an destination.
+         */
+        VIA, 
+        /**
+         * Definition: A person, non-person living subject, organization or device that who actually and principally carries out the action. Device should only be assigned as a performer in circumstances where the device is performing independent of human intervention.  Need not be the principal responsible actor.
+
+                        
+                           Exampe: A surgery resident operating under supervision of attending surgeon, a search and rescue dog locating survivors, an electronic laboratory analyzer or the laboratory discipline requested to perform a laboratory test. The performer may also be the patient in self-care, e.g. fingerstick blood sugar. The traditional order filler is a performer. This information should accompany every service event.
+
+                        
+                           Note: that existing HL7 designs assign an organization as the playing entity of the Role that is the performer.  These designs should be revised in subsequent releases to make this the scooping entity for the role involved.
+         */
+        PRF, 
+        /**
+         * Distributes material used in or generated during the act.
+         */
+        DIST, 
+        /**
+         * The principal or primary performer of the act.
+         */
+        PPRF, 
+        /**
+         * A person assisting in an act through his substantial presence and involvement   This includes: assistants, technicians, associates, or whatever the job titles may be.
+         */
+        SPRF, 
+        /**
+         * The person or organization that has primary responsibility for the act.  The responsible party is not necessarily present in an action, but is accountable for the action through the power to delegate, and the duty to review actions with the performing actor after the fact.  This responsibility may be ethical, legal, contractual, fiscal, or fiduciary in nature.
+
+                        
+                           Example: A person who is the head of a biochemical laboratory; a sponsor for a policy or government program.
+         */
+        RESP, 
+        /**
+         * A person who verifies the correctness and appropriateness of the service (plan, order, event, etc.) and hence takes on accountability.
+         */
+        VRF, 
+        /**
+         * A verifier who attests to the accuracy of an act, but who does not have privileges to legally authenticate the act. An example would be a resident physician who sees a patient and dictates a note, then later signs it. Their signature constitutes an authentication.
+         */
+        AUTHEN, 
+        /**
+         * A verifier who legally authenticates the accuracy of an act. An example would be a staff physician who sees a patient and dictates a note, then later signs it. Their signature constitutes a legal authentication.
+         */
+        LA, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ParticipationType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("PART".equals(codeString))
+          return PART;
+        if ("_ParticipationAncillary".equals(codeString))
+          return _PARTICIPATIONANCILLARY;
+        if ("ADM".equals(codeString))
+          return ADM;
+        if ("ATND".equals(codeString))
+          return ATND;
+        if ("CALLBCK".equals(codeString))
+          return CALLBCK;
+        if ("CON".equals(codeString))
+          return CON;
+        if ("DIS".equals(codeString))
+          return DIS;
+        if ("ESC".equals(codeString))
+          return ESC;
+        if ("REF".equals(codeString))
+          return REF;
+        if ("_ParticipationInformationGenerator".equals(codeString))
+          return _PARTICIPATIONINFORMATIONGENERATOR;
+        if ("AUT".equals(codeString))
+          return AUT;
+        if ("INF".equals(codeString))
+          return INF;
+        if ("TRANS".equals(codeString))
+          return TRANS;
+        if ("ENT".equals(codeString))
+          return ENT;
+        if ("WIT".equals(codeString))
+          return WIT;
+        if ("CST".equals(codeString))
+          return CST;
+        if ("DIR".equals(codeString))
+          return DIR;
+        if ("ALY".equals(codeString))
+          return ALY;
+        if ("BBY".equals(codeString))
+          return BBY;
+        if ("CAT".equals(codeString))
+          return CAT;
+        if ("CSM".equals(codeString))
+          return CSM;
+        if ("TPA".equals(codeString))
+          return TPA;
+        if ("DEV".equals(codeString))
+          return DEV;
+        if ("NRD".equals(codeString))
+          return NRD;
+        if ("RDV".equals(codeString))
+          return RDV;
+        if ("DON".equals(codeString))
+          return DON;
+        if ("EXPAGNT".equals(codeString))
+          return EXPAGNT;
+        if ("EXPART".equals(codeString))
+          return EXPART;
+        if ("EXPTRGT".equals(codeString))
+          return EXPTRGT;
+        if ("EXSRC".equals(codeString))
+          return EXSRC;
+        if ("PRD".equals(codeString))
+          return PRD;
+        if ("SBJ".equals(codeString))
+          return SBJ;
+        if ("SPC".equals(codeString))
+          return SPC;
+        if ("IND".equals(codeString))
+          return IND;
+        if ("BEN".equals(codeString))
+          return BEN;
+        if ("CAGNT".equals(codeString))
+          return CAGNT;
+        if ("COV".equals(codeString))
+          return COV;
+        if ("GUAR".equals(codeString))
+          return GUAR;
+        if ("HLD".equals(codeString))
+          return HLD;
+        if ("RCT".equals(codeString))
+          return RCT;
+        if ("RCV".equals(codeString))
+          return RCV;
+        if ("IRCP".equals(codeString))
+          return IRCP;
+        if ("NOT".equals(codeString))
+          return NOT;
+        if ("PRCP".equals(codeString))
+          return PRCP;
+        if ("REFB".equals(codeString))
+          return REFB;
+        if ("REFT".equals(codeString))
+          return REFT;
+        if ("TRC".equals(codeString))
+          return TRC;
+        if ("LOC".equals(codeString))
+          return LOC;
+        if ("DST".equals(codeString))
+          return DST;
+        if ("ELOC".equals(codeString))
+          return ELOC;
+        if ("ORG".equals(codeString))
+          return ORG;
+        if ("RML".equals(codeString))
+          return RML;
+        if ("VIA".equals(codeString))
+          return VIA;
+        if ("PRF".equals(codeString))
+          return PRF;
+        if ("DIST".equals(codeString))
+          return DIST;
+        if ("PPRF".equals(codeString))
+          return PPRF;
+        if ("SPRF".equals(codeString))
+          return SPRF;
+        if ("RESP".equals(codeString))
+          return RESP;
+        if ("VRF".equals(codeString))
+          return VRF;
+        if ("AUTHEN".equals(codeString))
+          return AUTHEN;
+        if ("LA".equals(codeString))
+          return LA;
+        throw new FHIRException("Unknown V3ParticipationType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case PART: return "PART";
+            case _PARTICIPATIONANCILLARY: return "_ParticipationAncillary";
+            case ADM: return "ADM";
+            case ATND: return "ATND";
+            case CALLBCK: return "CALLBCK";
+            case CON: return "CON";
+            case DIS: return "DIS";
+            case ESC: return "ESC";
+            case REF: return "REF";
+            case _PARTICIPATIONINFORMATIONGENERATOR: return "_ParticipationInformationGenerator";
+            case AUT: return "AUT";
+            case INF: return "INF";
+            case TRANS: return "TRANS";
+            case ENT: return "ENT";
+            case WIT: return "WIT";
+            case CST: return "CST";
+            case DIR: return "DIR";
+            case ALY: return "ALY";
+            case BBY: return "BBY";
+            case CAT: return "CAT";
+            case CSM: return "CSM";
+            case TPA: return "TPA";
+            case DEV: return "DEV";
+            case NRD: return "NRD";
+            case RDV: return "RDV";
+            case DON: return "DON";
+            case EXPAGNT: return "EXPAGNT";
+            case EXPART: return "EXPART";
+            case EXPTRGT: return "EXPTRGT";
+            case EXSRC: return "EXSRC";
+            case PRD: return "PRD";
+            case SBJ: return "SBJ";
+            case SPC: return "SPC";
+            case IND: return "IND";
+            case BEN: return "BEN";
+            case CAGNT: return "CAGNT";
+            case COV: return "COV";
+            case GUAR: return "GUAR";
+            case HLD: return "HLD";
+            case RCT: return "RCT";
+            case RCV: return "RCV";
+            case IRCP: return "IRCP";
+            case NOT: return "NOT";
+            case PRCP: return "PRCP";
+            case REFB: return "REFB";
+            case REFT: return "REFT";
+            case TRC: return "TRC";
+            case LOC: return "LOC";
+            case DST: return "DST";
+            case ELOC: return "ELOC";
+            case ORG: return "ORG";
+            case RML: return "RML";
+            case VIA: return "VIA";
+            case PRF: return "PRF";
+            case DIST: return "DIST";
+            case PPRF: return "PPRF";
+            case SPRF: return "SPRF";
+            case RESP: return "RESP";
+            case VRF: return "VRF";
+            case AUTHEN: return "AUTHEN";
+            case LA: return "LA";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ParticipationType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case PART: return "Indicates that the target of the participation is involved in some manner in the act, but does not qualify how.";
+            case _PARTICIPATIONANCILLARY: return "Participations related, but not primary to an act. The Referring, Admitting, and Discharging practitioners must be the same person as those authoring the ControlAct event for their respective trigger events.";
+            case ADM: return "The practitioner who is responsible for admitting a patient to a patient encounter.";
+            case ATND: return "The practitioner that has responsibility for overseeing a patient's care during a patient encounter.";
+            case CALLBCK: return "A person or organization who should be contacted for follow-up questions about the act in place of the author.";
+            case CON: return "An advisor participating in the service by performing evaluations and making recommendations.";
+            case DIS: return "The practitioner who is responsible for the discharge of a patient from a patient encounter.";
+            case ESC: return "Only with Transportation services.  A person who escorts the patient.";
+            case REF: return "A person having referred the subject of the service to the performer (referring physician).  Typically, a referring physician will receive a report.";
+            case _PARTICIPATIONINFORMATIONGENERATOR: return "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).";
+            case AUT: return "Definition: A party that originates the Act and therefore has responsibility for the information given in the Act and ownership of this Act.\r\n\n                        \n                           Example: the report writer, the person writing the act definition, the guideline author, the placer of an order, the EKG cart (device) creating a report etc. Every Act should have an author. Authorship is regardless of mood always actual authorship. \r\n\n                        Examples of such policies might include:\r\n\n                        \n                           \n                              The author and anyone they explicitly delegate may update the report;\r\n\n                           \n                           \n                              All administrators within the same clinic may cancel and reschedule appointments created by other administrators within that clinic;\r\n\n                           \n                        \n                        A party that is neither an author nor a party who is extended authorship maintenance rights by policy, may only amend, reverse, override, replace, or follow up in other ways on this Act, whereby the Act remains intact and is linked to another Act authored by that other party.";
+            case INF: return "A source of reported information (e.g., a next of kin who answers questions about the patient's history).  For history questions, the patient is logically an informant, yet the informant of history questions is implicitly the subject.";
+            case TRANS: return "An entity entering the data into the originating system. The data entry entity is collected optionally for internal quality control purposes. This includes the transcriptionist for dictated text transcribed into electronic form.";
+            case ENT: return "A person entering the data into the originating system.  The data entry person is collected optionally for internal quality control purposes.  This includes the transcriptionist for dictated text.";
+            case WIT: return "Only with service events.  A person witnessing the action happening without doing anything.  A witness is not necessarily aware, much less approves of anything stated in the service event.  Example for a witness is students watching an operation or an advanced directive witness.";
+            case CST: return "An entity (person, organization or device) that is in charge of maintaining the information of this act (e.g., who maintains the report or the master service catalog item, etc.).";
+            case DIR: return "Target participant  that is substantially present in the act  and which is directly involved in the action (includes consumed material, devices, etc.).";
+            case ALY: return "The target of an Observation action. Links an observation to a Role whose player is the substance or most specific component entity (material, micro-organism, etc.) being measured within the subject.\r\n\n                        \n                           Examples: A \"plasma porcelain substance concentration\" has analyte a Role with player substance Entity \"porcelain\".\r\n\n                        \n                           UsageNotes: The Role that this participation connects to may be any Role whose player is that substance measured. Very often, the scoper may indicate the system in which the component is being measured. E.g., for \"plasma porcelain\" the scoper could be \"Plasma\".";
+            case BBY: return "In an obstetric service, the baby.";
+            case CAT: return "The catalyst of a chemical reaction, such as an enzyme or a platinum surface. In biochemical reactions, connects the enzyme with the molecular interaction";
+            case CSM: return "Participant material that is taken up, diminished, altered, or disappears in the act.";
+            case TPA: return "Something incorporated in the subject of a therapy service to achieve a physiologic effect (e.g., heal, relieve, provoke a condition, etc.) on the subject.  In an administration service the therapeutic agent is a consumable, in a preparation or dispense service, it is a product.  Thus, consumable or product must be specified in accordance with the kind of service.";
+            case DEV: return "Participant used in performing the act without being substantially affected by the act (i.e. durable or inert with respect to that particular service).\r\n\n                        \n                           Examples: monitoring equipment, tools, but also access/drainage lines, prostheses, pace maker, etc.";
+            case NRD: return "A device that changes ownership due to the service, e.g., a pacemaker, a prosthesis, an insulin injection equipment (pen), etc.  Such material may need to be restocked after he service.";
+            case RDV: return "A device that does not change ownership due to the service, i.e., a surgical instrument or tool or an endoscope.  The distinction between reuseable and non-reuseable must be made in order to know whether material must be re-stocked.";
+            case DON: return "In some organ transplantation services and rarely in transfusion services a donor will be a target participant in the service.  However, in most cases transplantation is decomposed in three services: explantation, transport, and implantation.  The identity of the donor (recipient) is often irrelevant for the explantation (implantation) service.";
+            case EXPAGNT: return "Description: The entity playing the associated role is the physical (including energy), chemical or biological substance that is participating in the exposure.  For example in communicable diseases, the associated playing entity is the disease causing pathogen.";
+            case EXPART: return "Description:Direct participation in an exposure act where it is unknown that the participant is the source or subject of the exposure.  If the participant is known to be the contact of an exposure then the SBJ participation type should be used.  If the participant is known to be the source then the EXSRC participation type should be used.";
+            case EXPTRGT: return "Description: The entity playing the associated role is the target (contact) of exposure.";
+            case EXSRC: return "Description:The entity playing the associated role is the source of exposure.";
+            case PRD: return "Participant material that is brought forth (produced) in the act (e.g., specimen in a specimen collection, access or drainage in a placement service, medication package in a dispense service). It does not matter whether the material produced had existence prior to the service, or whether it is created in the service (e.g., in supply services the product is taken from a stock).";
+            case SBJ: return "The principle target on which the action happens.\r\n\n                        \n                           Examples: The patient in physical examination, a specimen in a lab observation. May also be a patient's family member (teaching) or a device or room (cleaning, disinfecting, housekeeping). \r\n\n                        \n                           UsageNotes: Not all direct targets are subjects. Consumables and devices used as tools for an act are not subjects. However, a device may be a subject of a maintenance action.";
+            case SPC: return "The subject of non-clinical (e.g. laboratory) observation services is a specimen.";
+            case IND: return "Target that is not substantially present in the act and which is not directly affected by the act, but which will be a focus of the record or documentation of the act.";
+            case BEN: return "Target on behalf of whom the service happens, but that is not necessarily present in the service.  Can occur together with direct target to indicate that a target is both, as in the case where the patient is the indirect beneficiary of a service rendered to a family member, e.g. counseling or given home care instructions.  This concept includes a participant, such as a covered party, who derives benefits from a service act covered by a coverage act.\r\n\n                        Note that the semantic role of the intended recipient who benefits from the happening denoted by the verb in the clause.  Thus, a patient who has no coverage under a policy or program may be a beneficiary of a health service while not being the beneficiary of coverage for that service.";
+            case CAGNT: return "Definition: A factor, such as a microorganism, chemical substance, or form of radiation, whose presence, excessive presence, or (in deficiency diseases) relative absence is essential, in whole or in part, for the occurrence of a condition.\r\n\n                        Constraint:  The use of this participation is limited to observations.";
+            case COV: return "The target participation for an individual in a health care coverage act in which the target role is either the policy holder of the coverage, or a covered party under the coverage.";
+            case GUAR: return "The target person or organization contractually recognized by the issuer as a participant who has assumed fiscal responsibility for another personaTMs financial obligations by guaranteeing to pay for amounts owed to a particular account\r\n\n                        \n                           Example:The subscriber of the patientaTMs health insurance policy signs a contract with the provider to be fiscally responsible for the patient billing account balance amount owed.";
+            case HLD: return "Participant who posses an instrument such as a financial contract (insurance policy) usually based on some agreement with the author.";
+            case RCT: return "The record target indicates whose medical record holds the documentation of this act.  This is especially important when the subject of a service is not the patient himself.";
+            case RCV: return "The person (or organization) who receives the product of an Act.";
+            case IRCP: return "A party, who may or should receive or who has recieved the Act or subsequent or derivative information of that Act. Information recipient is inert, i.e., independent of mood.\" Rationale: this is a generalization of a too diverse family that the definition can't be any more specific, and the concept is abstract so one of the specializations should be used.";
+            case NOT: return "An information recipient to notify for urgent matters about this Act. (e.g., in a laboratory order, critical results are being called by phone right away, this is the contact to call; or for an inpatient encounter, a next of kin to notify when the patient becomes critically ill).";
+            case PRCP: return "Information recipient to whom an act statement is primarily directed. E.g., a primary care provider receiving a discharge letter from a hospitalist, a health department receiving information on a suspected case of infectious disease. Multiple of these participations may exist on the same act without requiring that recipients be ranked as primary vs. secondary.";
+            case REFB: return "A participant (e.g. provider) who has referred the subject of an act (e.g. patient).\r\n\n                        Typically, a referred by participant will provide a report (e.g. referral).";
+            case REFT: return "The person who receives the patient";
+            case TRC: return "A secondary information recipient, who receives copies (e.g., a primary care provider receiving copies of results as ordered by specialist).";
+            case LOC: return "The facility where the service is done.  May be a static building (or room therein) or a moving location (e.g., ambulance, helicopter, aircraft, train, truck, ship, etc.)";
+            case DST: return "The destination for services.  May be a static building (or room therein) or a movable facility (e.g., ship).";
+            case ELOC: return "A location where data about an Act was entered.";
+            case ORG: return "The location of origin for services.  May be a static building (or room therein) or a movable facility (e.g., ship).";
+            case RML: return "Some services take place at multiple concurrent locations (e.g., telemedicine, telephone consultation).  The location where the principal performing actor is located is taken as the primary location (LOC) while the other location(s) are considered \"remote.\"";
+            case VIA: return "For services, an intermediate location that specifies a path between origin an destination.";
+            case PRF: return "Definition: A person, non-person living subject, organization or device that who actually and principally carries out the action. Device should only be assigned as a performer in circumstances where the device is performing independent of human intervention.  Need not be the principal responsible actor.\r\n\n                        \n                           Exampe: A surgery resident operating under supervision of attending surgeon, a search and rescue dog locating survivors, an electronic laboratory analyzer or the laboratory discipline requested to perform a laboratory test. The performer may also be the patient in self-care, e.g. fingerstick blood sugar. The traditional order filler is a performer. This information should accompany every service event.\r\n\n                        \n                           Note: that existing HL7 designs assign an organization as the playing entity of the Role that is the performer.  These designs should be revised in subsequent releases to make this the scooping entity for the role involved.";
+            case DIST: return "Distributes material used in or generated during the act.";
+            case PPRF: return "The principal or primary performer of the act.";
+            case SPRF: return "A person assisting in an act through his substantial presence and involvement   This includes: assistants, technicians, associates, or whatever the job titles may be.";
+            case RESP: return "The person or organization that has primary responsibility for the act.  The responsible party is not necessarily present in an action, but is accountable for the action through the power to delegate, and the duty to review actions with the performing actor after the fact.  This responsibility may be ethical, legal, contractual, fiscal, or fiduciary in nature.\r\n\n                        \n                           Example: A person who is the head of a biochemical laboratory; a sponsor for a policy or government program.";
+            case VRF: return "A person who verifies the correctness and appropriateness of the service (plan, order, event, etc.) and hence takes on accountability.";
+            case AUTHEN: return "A verifier who attests to the accuracy of an act, but who does not have privileges to legally authenticate the act. An example would be a resident physician who sees a patient and dictates a note, then later signs it. Their signature constitutes an authentication.";
+            case LA: return "A verifier who legally authenticates the accuracy of an act. An example would be a staff physician who sees a patient and dictates a note, then later signs it. Their signature constitutes a legal authentication.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case PART: return "Participation";
+            case _PARTICIPATIONANCILLARY: return "ParticipationAncillary";
+            case ADM: return "admitter";
+            case ATND: return "attender";
+            case CALLBCK: return "callback contact";
+            case CON: return "consultant";
+            case DIS: return "discharger";
+            case ESC: return "escort";
+            case REF: return "referrer";
+            case _PARTICIPATIONINFORMATIONGENERATOR: return "ParticipationInformationGenerator";
+            case AUT: return "author (originator)";
+            case INF: return "informant";
+            case TRANS: return "Transcriber";
+            case ENT: return "data entry person";
+            case WIT: return "witness";
+            case CST: return "custodian";
+            case DIR: return "direct target";
+            case ALY: return "analyte";
+            case BBY: return "baby";
+            case CAT: return "catalyst";
+            case CSM: return "consumable";
+            case TPA: return "therapeutic agent";
+            case DEV: return "device";
+            case NRD: return "non-reuseable device";
+            case RDV: return "reusable device";
+            case DON: return "donor";
+            case EXPAGNT: return "ExposureAgent";
+            case EXPART: return "ExposureParticipation";
+            case EXPTRGT: return "ExposureTarget";
+            case EXSRC: return "ExposureSource";
+            case PRD: return "product";
+            case SBJ: return "subject";
+            case SPC: return "specimen";
+            case IND: return "indirect target";
+            case BEN: return "beneficiary";
+            case CAGNT: return "causative agent";
+            case COV: return "coverage target";
+            case GUAR: return "guarantor party";
+            case HLD: return "holder";
+            case RCT: return "record target";
+            case RCV: return "receiver";
+            case IRCP: return "information recipient";
+            case NOT: return "ugent notification contact";
+            case PRCP: return "primary information recipient";
+            case REFB: return "Referred By";
+            case REFT: return "Referred to";
+            case TRC: return "tracker";
+            case LOC: return "location";
+            case DST: return "destination";
+            case ELOC: return "entry location";
+            case ORG: return "origin";
+            case RML: return "remote";
+            case VIA: return "via";
+            case PRF: return "performer";
+            case DIST: return "distributor";
+            case PPRF: return "primary performer";
+            case SPRF: return "secondary performer";
+            case RESP: return "responsible party";
+            case VRF: return "verifier";
+            case AUTHEN: return "authenticator";
+            case LA: return "legal authenticator";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationTypeEnumFactory.java
new file mode 100644
index 00000000000..33258cb437c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ParticipationTypeEnumFactory.java
@@ -0,0 +1,298 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ParticipationTypeEnumFactory implements EnumFactory {
+
+  public V3ParticipationType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("PART".equals(codeString))
+      return V3ParticipationType.PART;
+    if ("_ParticipationAncillary".equals(codeString))
+      return V3ParticipationType._PARTICIPATIONANCILLARY;
+    if ("ADM".equals(codeString))
+      return V3ParticipationType.ADM;
+    if ("ATND".equals(codeString))
+      return V3ParticipationType.ATND;
+    if ("CALLBCK".equals(codeString))
+      return V3ParticipationType.CALLBCK;
+    if ("CON".equals(codeString))
+      return V3ParticipationType.CON;
+    if ("DIS".equals(codeString))
+      return V3ParticipationType.DIS;
+    if ("ESC".equals(codeString))
+      return V3ParticipationType.ESC;
+    if ("REF".equals(codeString))
+      return V3ParticipationType.REF;
+    if ("_ParticipationInformationGenerator".equals(codeString))
+      return V3ParticipationType._PARTICIPATIONINFORMATIONGENERATOR;
+    if ("AUT".equals(codeString))
+      return V3ParticipationType.AUT;
+    if ("INF".equals(codeString))
+      return V3ParticipationType.INF;
+    if ("TRANS".equals(codeString))
+      return V3ParticipationType.TRANS;
+    if ("ENT".equals(codeString))
+      return V3ParticipationType.ENT;
+    if ("WIT".equals(codeString))
+      return V3ParticipationType.WIT;
+    if ("CST".equals(codeString))
+      return V3ParticipationType.CST;
+    if ("DIR".equals(codeString))
+      return V3ParticipationType.DIR;
+    if ("ALY".equals(codeString))
+      return V3ParticipationType.ALY;
+    if ("BBY".equals(codeString))
+      return V3ParticipationType.BBY;
+    if ("CAT".equals(codeString))
+      return V3ParticipationType.CAT;
+    if ("CSM".equals(codeString))
+      return V3ParticipationType.CSM;
+    if ("TPA".equals(codeString))
+      return V3ParticipationType.TPA;
+    if ("DEV".equals(codeString))
+      return V3ParticipationType.DEV;
+    if ("NRD".equals(codeString))
+      return V3ParticipationType.NRD;
+    if ("RDV".equals(codeString))
+      return V3ParticipationType.RDV;
+    if ("DON".equals(codeString))
+      return V3ParticipationType.DON;
+    if ("EXPAGNT".equals(codeString))
+      return V3ParticipationType.EXPAGNT;
+    if ("EXPART".equals(codeString))
+      return V3ParticipationType.EXPART;
+    if ("EXPTRGT".equals(codeString))
+      return V3ParticipationType.EXPTRGT;
+    if ("EXSRC".equals(codeString))
+      return V3ParticipationType.EXSRC;
+    if ("PRD".equals(codeString))
+      return V3ParticipationType.PRD;
+    if ("SBJ".equals(codeString))
+      return V3ParticipationType.SBJ;
+    if ("SPC".equals(codeString))
+      return V3ParticipationType.SPC;
+    if ("IND".equals(codeString))
+      return V3ParticipationType.IND;
+    if ("BEN".equals(codeString))
+      return V3ParticipationType.BEN;
+    if ("CAGNT".equals(codeString))
+      return V3ParticipationType.CAGNT;
+    if ("COV".equals(codeString))
+      return V3ParticipationType.COV;
+    if ("GUAR".equals(codeString))
+      return V3ParticipationType.GUAR;
+    if ("HLD".equals(codeString))
+      return V3ParticipationType.HLD;
+    if ("RCT".equals(codeString))
+      return V3ParticipationType.RCT;
+    if ("RCV".equals(codeString))
+      return V3ParticipationType.RCV;
+    if ("IRCP".equals(codeString))
+      return V3ParticipationType.IRCP;
+    if ("NOT".equals(codeString))
+      return V3ParticipationType.NOT;
+    if ("PRCP".equals(codeString))
+      return V3ParticipationType.PRCP;
+    if ("REFB".equals(codeString))
+      return V3ParticipationType.REFB;
+    if ("REFT".equals(codeString))
+      return V3ParticipationType.REFT;
+    if ("TRC".equals(codeString))
+      return V3ParticipationType.TRC;
+    if ("LOC".equals(codeString))
+      return V3ParticipationType.LOC;
+    if ("DST".equals(codeString))
+      return V3ParticipationType.DST;
+    if ("ELOC".equals(codeString))
+      return V3ParticipationType.ELOC;
+    if ("ORG".equals(codeString))
+      return V3ParticipationType.ORG;
+    if ("RML".equals(codeString))
+      return V3ParticipationType.RML;
+    if ("VIA".equals(codeString))
+      return V3ParticipationType.VIA;
+    if ("PRF".equals(codeString))
+      return V3ParticipationType.PRF;
+    if ("DIST".equals(codeString))
+      return V3ParticipationType.DIST;
+    if ("PPRF".equals(codeString))
+      return V3ParticipationType.PPRF;
+    if ("SPRF".equals(codeString))
+      return V3ParticipationType.SPRF;
+    if ("RESP".equals(codeString))
+      return V3ParticipationType.RESP;
+    if ("VRF".equals(codeString))
+      return V3ParticipationType.VRF;
+    if ("AUTHEN".equals(codeString))
+      return V3ParticipationType.AUTHEN;
+    if ("LA".equals(codeString))
+      return V3ParticipationType.LA;
+    throw new IllegalArgumentException("Unknown V3ParticipationType code '"+codeString+"'");
+  }
+
+  public String toCode(V3ParticipationType code) {
+    if (code == V3ParticipationType.PART)
+      return "PART";
+    if (code == V3ParticipationType._PARTICIPATIONANCILLARY)
+      return "_ParticipationAncillary";
+    if (code == V3ParticipationType.ADM)
+      return "ADM";
+    if (code == V3ParticipationType.ATND)
+      return "ATND";
+    if (code == V3ParticipationType.CALLBCK)
+      return "CALLBCK";
+    if (code == V3ParticipationType.CON)
+      return "CON";
+    if (code == V3ParticipationType.DIS)
+      return "DIS";
+    if (code == V3ParticipationType.ESC)
+      return "ESC";
+    if (code == V3ParticipationType.REF)
+      return "REF";
+    if (code == V3ParticipationType._PARTICIPATIONINFORMATIONGENERATOR)
+      return "_ParticipationInformationGenerator";
+    if (code == V3ParticipationType.AUT)
+      return "AUT";
+    if (code == V3ParticipationType.INF)
+      return "INF";
+    if (code == V3ParticipationType.TRANS)
+      return "TRANS";
+    if (code == V3ParticipationType.ENT)
+      return "ENT";
+    if (code == V3ParticipationType.WIT)
+      return "WIT";
+    if (code == V3ParticipationType.CST)
+      return "CST";
+    if (code == V3ParticipationType.DIR)
+      return "DIR";
+    if (code == V3ParticipationType.ALY)
+      return "ALY";
+    if (code == V3ParticipationType.BBY)
+      return "BBY";
+    if (code == V3ParticipationType.CAT)
+      return "CAT";
+    if (code == V3ParticipationType.CSM)
+      return "CSM";
+    if (code == V3ParticipationType.TPA)
+      return "TPA";
+    if (code == V3ParticipationType.DEV)
+      return "DEV";
+    if (code == V3ParticipationType.NRD)
+      return "NRD";
+    if (code == V3ParticipationType.RDV)
+      return "RDV";
+    if (code == V3ParticipationType.DON)
+      return "DON";
+    if (code == V3ParticipationType.EXPAGNT)
+      return "EXPAGNT";
+    if (code == V3ParticipationType.EXPART)
+      return "EXPART";
+    if (code == V3ParticipationType.EXPTRGT)
+      return "EXPTRGT";
+    if (code == V3ParticipationType.EXSRC)
+      return "EXSRC";
+    if (code == V3ParticipationType.PRD)
+      return "PRD";
+    if (code == V3ParticipationType.SBJ)
+      return "SBJ";
+    if (code == V3ParticipationType.SPC)
+      return "SPC";
+    if (code == V3ParticipationType.IND)
+      return "IND";
+    if (code == V3ParticipationType.BEN)
+      return "BEN";
+    if (code == V3ParticipationType.CAGNT)
+      return "CAGNT";
+    if (code == V3ParticipationType.COV)
+      return "COV";
+    if (code == V3ParticipationType.GUAR)
+      return "GUAR";
+    if (code == V3ParticipationType.HLD)
+      return "HLD";
+    if (code == V3ParticipationType.RCT)
+      return "RCT";
+    if (code == V3ParticipationType.RCV)
+      return "RCV";
+    if (code == V3ParticipationType.IRCP)
+      return "IRCP";
+    if (code == V3ParticipationType.NOT)
+      return "NOT";
+    if (code == V3ParticipationType.PRCP)
+      return "PRCP";
+    if (code == V3ParticipationType.REFB)
+      return "REFB";
+    if (code == V3ParticipationType.REFT)
+      return "REFT";
+    if (code == V3ParticipationType.TRC)
+      return "TRC";
+    if (code == V3ParticipationType.LOC)
+      return "LOC";
+    if (code == V3ParticipationType.DST)
+      return "DST";
+    if (code == V3ParticipationType.ELOC)
+      return "ELOC";
+    if (code == V3ParticipationType.ORG)
+      return "ORG";
+    if (code == V3ParticipationType.RML)
+      return "RML";
+    if (code == V3ParticipationType.VIA)
+      return "VIA";
+    if (code == V3ParticipationType.PRF)
+      return "PRF";
+    if (code == V3ParticipationType.DIST)
+      return "DIST";
+    if (code == V3ParticipationType.PPRF)
+      return "PPRF";
+    if (code == V3ParticipationType.SPRF)
+      return "SPRF";
+    if (code == V3ParticipationType.RESP)
+      return "RESP";
+    if (code == V3ParticipationType.VRF)
+      return "VRF";
+    if (code == V3ParticipationType.AUTHEN)
+      return "AUTHEN";
+    if (code == V3ParticipationType.LA)
+      return "LA";
+    return "?";
+  }
+
+    public String toSystem(V3ParticipationType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PatientImportance.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PatientImportance.java
new file mode 100644
index 00000000000..48c565d28e6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PatientImportance.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3PatientImportance {
+
+        /**
+         * Board member of health care organization
+         */
+        BM, 
+        /**
+         * Family member of staff physician
+         */
+        DFM, 
+        /**
+         * Member of the health care organization physician staff
+         */
+        DR, 
+        /**
+         * Financial donor to the health care organization
+         */
+        FD, 
+        /**
+         * Foreign citizen dignitary of interest to the health care organization
+         */
+        FOR, 
+        /**
+         * Government dignitary of interest to the organization
+         */
+        GOVT, 
+        /**
+         * Family member of staff member
+         */
+        SFM, 
+        /**
+         * Staff member of the health care organization
+         */
+        STF, 
+        /**
+         * Very important person of interest to the health care organization
+         */
+        VIP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3PatientImportance fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("BM".equals(codeString))
+          return BM;
+        if ("DFM".equals(codeString))
+          return DFM;
+        if ("DR".equals(codeString))
+          return DR;
+        if ("FD".equals(codeString))
+          return FD;
+        if ("FOR".equals(codeString))
+          return FOR;
+        if ("GOVT".equals(codeString))
+          return GOVT;
+        if ("SFM".equals(codeString))
+          return SFM;
+        if ("STF".equals(codeString))
+          return STF;
+        if ("VIP".equals(codeString))
+          return VIP;
+        throw new FHIRException("Unknown V3PatientImportance code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BM: return "BM";
+            case DFM: return "DFM";
+            case DR: return "DR";
+            case FD: return "FD";
+            case FOR: return "FOR";
+            case GOVT: return "GOVT";
+            case SFM: return "SFM";
+            case STF: return "STF";
+            case VIP: return "VIP";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/PatientImportance";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BM: return "Board member of health care organization";
+            case DFM: return "Family member of staff physician";
+            case DR: return "Member of the health care organization physician staff";
+            case FD: return "Financial donor to the health care organization";
+            case FOR: return "Foreign citizen dignitary of interest to the health care organization";
+            case GOVT: return "Government dignitary of interest to the organization";
+            case SFM: return "Family member of staff member";
+            case STF: return "Staff member of the health care organization";
+            case VIP: return "Very important person of interest to the health care organization";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BM: return "Board Member";
+            case DFM: return "Physician Family Member";
+            case DR: return "Staff Physician";
+            case FD: return "Financial Donor";
+            case FOR: return "Foreign Dignitary";
+            case GOVT: return "Government Dignitary";
+            case SFM: return "Staff Family Member";
+            case STF: return "Staff Member";
+            case VIP: return "Very Important Person";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PatientImportanceEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PatientImportanceEnumFactory.java
new file mode 100644
index 00000000000..e25d3ae9d2f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PatientImportanceEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3PatientImportanceEnumFactory implements EnumFactory {
+
+  public V3PatientImportance fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("BM".equals(codeString))
+      return V3PatientImportance.BM;
+    if ("DFM".equals(codeString))
+      return V3PatientImportance.DFM;
+    if ("DR".equals(codeString))
+      return V3PatientImportance.DR;
+    if ("FD".equals(codeString))
+      return V3PatientImportance.FD;
+    if ("FOR".equals(codeString))
+      return V3PatientImportance.FOR;
+    if ("GOVT".equals(codeString))
+      return V3PatientImportance.GOVT;
+    if ("SFM".equals(codeString))
+      return V3PatientImportance.SFM;
+    if ("STF".equals(codeString))
+      return V3PatientImportance.STF;
+    if ("VIP".equals(codeString))
+      return V3PatientImportance.VIP;
+    throw new IllegalArgumentException("Unknown V3PatientImportance code '"+codeString+"'");
+  }
+
+  public String toCode(V3PatientImportance code) {
+    if (code == V3PatientImportance.BM)
+      return "BM";
+    if (code == V3PatientImportance.DFM)
+      return "DFM";
+    if (code == V3PatientImportance.DR)
+      return "DR";
+    if (code == V3PatientImportance.FD)
+      return "FD";
+    if (code == V3PatientImportance.FOR)
+      return "FOR";
+    if (code == V3PatientImportance.GOVT)
+      return "GOVT";
+    if (code == V3PatientImportance.SFM)
+      return "SFM";
+    if (code == V3PatientImportance.STF)
+      return "STF";
+    if (code == V3PatientImportance.VIP)
+      return "VIP";
+    return "?";
+  }
+
+    public String toSystem(V3PatientImportance code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PaymentTerms.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PaymentTerms.java
new file mode 100644
index 00000000000..9b85cee6513
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PaymentTerms.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3PaymentTerms {
+
+        /**
+         * Payment in full for products and/or services is required as soon as the service is performed or goods delivered.
+         */
+        COD, 
+        /**
+         * Payment in full for products and/or services is required 30 days from the time the service is performed or goods delivered.
+         */
+        N30, 
+        /**
+         * Payment in full for products and/or services is required 60 days from the time the service is performed or goods delivered.
+         */
+        N60, 
+        /**
+         * Payment in full for products and/or services is required 90 days from the time the service is performed or goods delivered.
+         */
+        N90, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3PaymentTerms fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("COD".equals(codeString))
+          return COD;
+        if ("N30".equals(codeString))
+          return N30;
+        if ("N60".equals(codeString))
+          return N60;
+        if ("N90".equals(codeString))
+          return N90;
+        throw new FHIRException("Unknown V3PaymentTerms code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COD: return "COD";
+            case N30: return "N30";
+            case N60: return "N60";
+            case N90: return "N90";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/PaymentTerms";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COD: return "Payment in full for products and/or services is required as soon as the service is performed or goods delivered.";
+            case N30: return "Payment in full for products and/or services is required 30 days from the time the service is performed or goods delivered.";
+            case N60: return "Payment in full for products and/or services is required 60 days from the time the service is performed or goods delivered.";
+            case N90: return "Payment in full for products and/or services is required 90 days from the time the service is performed or goods delivered.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COD: return "Cash on Delivery";
+            case N30: return "Net 30 days";
+            case N60: return "Net 60 days";
+            case N90: return "Net 90 days";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PaymentTermsEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PaymentTermsEnumFactory.java
new file mode 100644
index 00000000000..e9d474808ff
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PaymentTermsEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3PaymentTermsEnumFactory implements EnumFactory {
+
+  public V3PaymentTerms fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("COD".equals(codeString))
+      return V3PaymentTerms.COD;
+    if ("N30".equals(codeString))
+      return V3PaymentTerms.N30;
+    if ("N60".equals(codeString))
+      return V3PaymentTerms.N60;
+    if ("N90".equals(codeString))
+      return V3PaymentTerms.N90;
+    throw new IllegalArgumentException("Unknown V3PaymentTerms code '"+codeString+"'");
+  }
+
+  public String toCode(V3PaymentTerms code) {
+    if (code == V3PaymentTerms.COD)
+      return "COD";
+    if (code == V3PaymentTerms.N30)
+      return "N30";
+    if (code == V3PaymentTerms.N60)
+      return "N60";
+    if (code == V3PaymentTerms.N90)
+      return "N90";
+    return "?";
+  }
+
+    public String toSystem(V3PaymentTerms code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PersonDisabilityType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PersonDisabilityType.java
new file mode 100644
index 00000000000..21c01c9a6d3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PersonDisabilityType.java
@@ -0,0 +1,159 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3PersonDisabilityType {
+
+        /**
+         * Vision impaired
+         */
+        _1, 
+        /**
+         * Hearing impaired
+         */
+        _2, 
+        /**
+         * Speech impaired
+         */
+        _3, 
+        /**
+         * Mentally impaired
+         */
+        _4, 
+        /**
+         * Mobility impaired
+         */
+        _5, 
+        /**
+         * A crib is required to move the person
+         */
+        CB, 
+        /**
+         * Person requires crutches to ambulate
+         */
+        CR, 
+        /**
+         * A gurney is required to move the person
+         */
+        G, 
+        /**
+         * Person requires a wheelchair to be ambulatory
+         */
+        WC, 
+        /**
+         * Person requires a walker to ambulate
+         */
+        WK, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3PersonDisabilityType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1".equals(codeString))
+          return _1;
+        if ("2".equals(codeString))
+          return _2;
+        if ("3".equals(codeString))
+          return _3;
+        if ("4".equals(codeString))
+          return _4;
+        if ("5".equals(codeString))
+          return _5;
+        if ("CB".equals(codeString))
+          return CB;
+        if ("CR".equals(codeString))
+          return CR;
+        if ("G".equals(codeString))
+          return G;
+        if ("WC".equals(codeString))
+          return WC;
+        if ("WK".equals(codeString))
+          return WK;
+        throw new FHIRException("Unknown V3PersonDisabilityType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1: return "1";
+            case _2: return "2";
+            case _3: return "3";
+            case _4: return "4";
+            case _5: return "5";
+            case CB: return "CB";
+            case CR: return "CR";
+            case G: return "G";
+            case WC: return "WC";
+            case WK: return "WK";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/PersonDisabilityType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1: return "Vision impaired";
+            case _2: return "Hearing impaired";
+            case _3: return "Speech impaired";
+            case _4: return "Mentally impaired";
+            case _5: return "Mobility impaired";
+            case CB: return "A crib is required to move the person";
+            case CR: return "Person requires crutches to ambulate";
+            case G: return "A gurney is required to move the person";
+            case WC: return "Person requires a wheelchair to be ambulatory";
+            case WK: return "Person requires a walker to ambulate";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1: return "Vision impaired";
+            case _2: return "Hearing impaired";
+            case _3: return "Speech impaired";
+            case _4: return "Mentally impaired";
+            case _5: return "Mobility impaired";
+            case CB: return "Requires crib";
+            case CR: return "Requires crutches";
+            case G: return "Requires gurney";
+            case WC: return "Requires wheelchair";
+            case WK: return "Requires walker";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PersonDisabilityTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PersonDisabilityTypeEnumFactory.java
new file mode 100644
index 00000000000..c5146bdb10d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3PersonDisabilityTypeEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3PersonDisabilityTypeEnumFactory implements EnumFactory {
+
+  public V3PersonDisabilityType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1".equals(codeString))
+      return V3PersonDisabilityType._1;
+    if ("2".equals(codeString))
+      return V3PersonDisabilityType._2;
+    if ("3".equals(codeString))
+      return V3PersonDisabilityType._3;
+    if ("4".equals(codeString))
+      return V3PersonDisabilityType._4;
+    if ("5".equals(codeString))
+      return V3PersonDisabilityType._5;
+    if ("CB".equals(codeString))
+      return V3PersonDisabilityType.CB;
+    if ("CR".equals(codeString))
+      return V3PersonDisabilityType.CR;
+    if ("G".equals(codeString))
+      return V3PersonDisabilityType.G;
+    if ("WC".equals(codeString))
+      return V3PersonDisabilityType.WC;
+    if ("WK".equals(codeString))
+      return V3PersonDisabilityType.WK;
+    throw new IllegalArgumentException("Unknown V3PersonDisabilityType code '"+codeString+"'");
+  }
+
+  public String toCode(V3PersonDisabilityType code) {
+    if (code == V3PersonDisabilityType._1)
+      return "1";
+    if (code == V3PersonDisabilityType._2)
+      return "2";
+    if (code == V3PersonDisabilityType._3)
+      return "3";
+    if (code == V3PersonDisabilityType._4)
+      return "4";
+    if (code == V3PersonDisabilityType._5)
+      return "5";
+    if (code == V3PersonDisabilityType.CB)
+      return "CB";
+    if (code == V3PersonDisabilityType.CR)
+      return "CR";
+    if (code == V3PersonDisabilityType.G)
+      return "G";
+    if (code == V3PersonDisabilityType.WC)
+      return "WC";
+    if (code == V3PersonDisabilityType.WK)
+      return "WK";
+    return "?";
+  }
+
+    public String toSystem(V3PersonDisabilityType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProbabilityDistributionType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProbabilityDistributionType.java
new file mode 100644
index 00000000000..ee5118e01b1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProbabilityDistributionType.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ProbabilityDistributionType {
+
+        /**
+         * The beta-distribution is used for data that is bounded on both sides and may or may not be skewed (e.g., occurs when probabilities are estimated.)  Two parameters a and b  are available to adjust the curve.  The mean m and variance s2 relate as follows: m = a/ (a + b) and s2 = ab/((a + b)2 (a + b + 1)).
+         */
+        B, 
+        /**
+         * Used for data that describes extinction.  The exponential distribution is a special form of g-distribution where a = 1, hence, the relationship to mean m and variance s2 are m = b and s2 = b2.
+         */
+        E, 
+        /**
+         * Used to describe the quotient of two c2 random variables.  The F-distribution has two parameters n1 and n2, which are the numbers of degrees of freedom of the numerator and denominator variable respectively. The relationship to mean m  and variance s2 are: m = n2 / (n2 - 2) and s2 = (2 n2 (n2 + n1 - 2)) / (n1 (n2 - 2)2 (n2 - 4)).
+         */
+        F, 
+        /**
+         * The gamma-distribution used for data that is skewed and bounded to the right, i.e. where the maximum of the distribution curve is located near the origin.  The g-distribution has a two parameters a and b.  The relationship to mean m and variance s2 is m = a b and s2 = a b2.
+         */
+        G, 
+        /**
+         * The logarithmic normal distribution is used to transform skewed random variable X into a normally distributed random variable U = log X. The log-normal distribution can be specified with the properties mean m and standard deviation s.  Note however that mean m and standard deviation s are the parameters of the raw value distribution, not the transformed parameters of the lognormal distribution that are conventionally referred to by the same letters.  Those log-normal parameters mlog and slog relate to the mean m and standard deviation s of the data value through slog2 = log (s2/m2 + 1) and mlog = log m - slog2/2.
+         */
+        LN, 
+        /**
+         * This is the well-known bell-shaped normal distribution.  Because of the central limit theorem, the normal distribution is the distribution of choice for an unbounded random variable that is an outcome of a combination of many stochastic processes.  Even for values bounded on a single side (i.e. greater than 0) the normal distribution may be accurate enough if the mean is "far away" from the bound of the scale measured in terms of standard deviations.
+         */
+        N, 
+        /**
+         * Used to describe the quotient of a normal random variable and the square root of a c2 random variable.  The t-distribution has one parameter n, the number of degrees of freedom. The relationship to mean m  and variance s2 are: m = 0 and s2 = n / (n - 2)
+         */
+        T, 
+        /**
+         * The uniform distribution assigns a constant probability over the entire interval of possible outcomes, while all outcomes outside this interval are assumed to have zero probability.  The width of this interval is 2s sqrt(3).  Thus, the uniform distribution assigns the probability densities f(x) = sqrt(2 s sqrt(3))  to values m - s sqrt(3) >= x <= m + s sqrt(3) and f(x) = 0 otherwise.
+         */
+        U, 
+        /**
+         * Used to describe the sum of squares of random variables which occurs when a variance is estimated (rather than presumed) from the sample.  The only parameter of the c2-distribution is n, so called the number of degrees of freedom (which is the number of independent parts in the sum).  The c2-distribution is a special type of g-distribution with parameter a = n /2 and b  = 2.  Hence, m = n and s2 = 2 n.
+         */
+        X2, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ProbabilityDistributionType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("B".equals(codeString))
+          return B;
+        if ("E".equals(codeString))
+          return E;
+        if ("F".equals(codeString))
+          return F;
+        if ("G".equals(codeString))
+          return G;
+        if ("LN".equals(codeString))
+          return LN;
+        if ("N".equals(codeString))
+          return N;
+        if ("T".equals(codeString))
+          return T;
+        if ("U".equals(codeString))
+          return U;
+        if ("X2".equals(codeString))
+          return X2;
+        throw new FHIRException("Unknown V3ProbabilityDistributionType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case B: return "B";
+            case E: return "E";
+            case F: return "F";
+            case G: return "G";
+            case LN: return "LN";
+            case N: return "N";
+            case T: return "T";
+            case U: return "U";
+            case X2: return "X2";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ProbabilityDistributionType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case B: return "The beta-distribution is used for data that is bounded on both sides and may or may not be skewed (e.g., occurs when probabilities are estimated.)  Two parameters a and b  are available to adjust the curve.  The mean m and variance s2 relate as follows: m = a/ (a + b) and s2 = ab/((a + b)2 (a + b + 1)).";
+            case E: return "Used for data that describes extinction.  The exponential distribution is a special form of g-distribution where a = 1, hence, the relationship to mean m and variance s2 are m = b and s2 = b2.";
+            case F: return "Used to describe the quotient of two c2 random variables.  The F-distribution has two parameters n1 and n2, which are the numbers of degrees of freedom of the numerator and denominator variable respectively. The relationship to mean m  and variance s2 are: m = n2 / (n2 - 2) and s2 = (2 n2 (n2 + n1 - 2)) / (n1 (n2 - 2)2 (n2 - 4)).";
+            case G: return "The gamma-distribution used for data that is skewed and bounded to the right, i.e. where the maximum of the distribution curve is located near the origin.  The g-distribution has a two parameters a and b.  The relationship to mean m and variance s2 is m = a b and s2 = a b2.";
+            case LN: return "The logarithmic normal distribution is used to transform skewed random variable X into a normally distributed random variable U = log X. The log-normal distribution can be specified with the properties mean m and standard deviation s.  Note however that mean m and standard deviation s are the parameters of the raw value distribution, not the transformed parameters of the lognormal distribution that are conventionally referred to by the same letters.  Those log-normal parameters mlog and slog relate to the mean m and standard deviation s of the data value through slog2 = log (s2/m2 + 1) and mlog = log m - slog2/2.";
+            case N: return "This is the well-known bell-shaped normal distribution.  Because of the central limit theorem, the normal distribution is the distribution of choice for an unbounded random variable that is an outcome of a combination of many stochastic processes.  Even for values bounded on a single side (i.e. greater than 0) the normal distribution may be accurate enough if the mean is \"far away\" from the bound of the scale measured in terms of standard deviations.";
+            case T: return "Used to describe the quotient of a normal random variable and the square root of a c2 random variable.  The t-distribution has one parameter n, the number of degrees of freedom. The relationship to mean m  and variance s2 are: m = 0 and s2 = n / (n - 2)";
+            case U: return "The uniform distribution assigns a constant probability over the entire interval of possible outcomes, while all outcomes outside this interval are assumed to have zero probability.  The width of this interval is 2s sqrt(3).  Thus, the uniform distribution assigns the probability densities f(x) = sqrt(2 s sqrt(3))  to values m - s sqrt(3) >= x <= m + s sqrt(3) and f(x) = 0 otherwise.";
+            case X2: return "Used to describe the sum of squares of random variables which occurs when a variance is estimated (rather than presumed) from the sample.  The only parameter of the c2-distribution is n, so called the number of degrees of freedom (which is the number of independent parts in the sum).  The c2-distribution is a special type of g-distribution with parameter a = n /2 and b  = 2.  Hence, m = n and s2 = 2 n.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case B: return "beta";
+            case E: return "exponential";
+            case F: return "F";
+            case G: return "(gamma)";
+            case LN: return "log-normal";
+            case N: return "normal (Gaussian)";
+            case T: return "T";
+            case U: return "uniform";
+            case X2: return "chi square";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProbabilityDistributionTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProbabilityDistributionTypeEnumFactory.java
new file mode 100644
index 00000000000..c8b1799d36b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProbabilityDistributionTypeEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ProbabilityDistributionTypeEnumFactory implements EnumFactory {
+
+  public V3ProbabilityDistributionType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("B".equals(codeString))
+      return V3ProbabilityDistributionType.B;
+    if ("E".equals(codeString))
+      return V3ProbabilityDistributionType.E;
+    if ("F".equals(codeString))
+      return V3ProbabilityDistributionType.F;
+    if ("G".equals(codeString))
+      return V3ProbabilityDistributionType.G;
+    if ("LN".equals(codeString))
+      return V3ProbabilityDistributionType.LN;
+    if ("N".equals(codeString))
+      return V3ProbabilityDistributionType.N;
+    if ("T".equals(codeString))
+      return V3ProbabilityDistributionType.T;
+    if ("U".equals(codeString))
+      return V3ProbabilityDistributionType.U;
+    if ("X2".equals(codeString))
+      return V3ProbabilityDistributionType.X2;
+    throw new IllegalArgumentException("Unknown V3ProbabilityDistributionType code '"+codeString+"'");
+  }
+
+  public String toCode(V3ProbabilityDistributionType code) {
+    if (code == V3ProbabilityDistributionType.B)
+      return "B";
+    if (code == V3ProbabilityDistributionType.E)
+      return "E";
+    if (code == V3ProbabilityDistributionType.F)
+      return "F";
+    if (code == V3ProbabilityDistributionType.G)
+      return "G";
+    if (code == V3ProbabilityDistributionType.LN)
+      return "LN";
+    if (code == V3ProbabilityDistributionType.N)
+      return "N";
+    if (code == V3ProbabilityDistributionType.T)
+      return "T";
+    if (code == V3ProbabilityDistributionType.U)
+      return "U";
+    if (code == V3ProbabilityDistributionType.X2)
+      return "X2";
+    return "?";
+  }
+
+    public String toSystem(V3ProbabilityDistributionType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingID.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingID.java
new file mode 100644
index 00000000000..43124e8e5e2
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingID.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ProcessingID {
+
+        /**
+         * Identifies debugging type of processing.
+         */
+        D, 
+        /**
+         * Identifies production type of processing.
+         */
+        P, 
+        /**
+         * Identifies training type of processing.
+         */
+        T, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ProcessingID fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("D".equals(codeString))
+          return D;
+        if ("P".equals(codeString))
+          return P;
+        if ("T".equals(codeString))
+          return T;
+        throw new FHIRException("Unknown V3ProcessingID code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case D: return "D";
+            case P: return "P";
+            case T: return "T";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ProcessingID";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case D: return "Identifies debugging type of processing.";
+            case P: return "Identifies production type of processing.";
+            case T: return "Identifies training type of processing.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case D: return "Debugging";
+            case P: return "Production";
+            case T: return "Training";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingIDEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingIDEnumFactory.java
new file mode 100644
index 00000000000..03e0f6510c6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingIDEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ProcessingIDEnumFactory implements EnumFactory {
+
+  public V3ProcessingID fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("D".equals(codeString))
+      return V3ProcessingID.D;
+    if ("P".equals(codeString))
+      return V3ProcessingID.P;
+    if ("T".equals(codeString))
+      return V3ProcessingID.T;
+    throw new IllegalArgumentException("Unknown V3ProcessingID code '"+codeString+"'");
+  }
+
+  public String toCode(V3ProcessingID code) {
+    if (code == V3ProcessingID.D)
+      return "D";
+    if (code == V3ProcessingID.P)
+      return "P";
+    if (code == V3ProcessingID.T)
+      return "T";
+    return "?";
+  }
+
+    public String toSystem(V3ProcessingID code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingMode.java
new file mode 100644
index 00000000000..cdb557515cf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingMode.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ProcessingMode {
+
+        /**
+         * Identifies archive mode of processing.
+         */
+        A, 
+        /**
+         * Identifies initial load mode of processing.
+         */
+        I, 
+        /**
+         * Identifies restore mode of processing.
+         */
+        R, 
+        /**
+         * Identifies on-line mode of processing.
+         */
+        T, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ProcessingMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("A".equals(codeString))
+          return A;
+        if ("I".equals(codeString))
+          return I;
+        if ("R".equals(codeString))
+          return R;
+        if ("T".equals(codeString))
+          return T;
+        throw new FHIRException("Unknown V3ProcessingMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A: return "A";
+            case I: return "I";
+            case R: return "R";
+            case T: return "T";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ProcessingMode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A: return "Identifies archive mode of processing.";
+            case I: return "Identifies initial load mode of processing.";
+            case R: return "Identifies restore mode of processing.";
+            case T: return "Identifies on-line mode of processing.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A: return "Archive";
+            case I: return "Initial load";
+            case R: return "Restore from archive";
+            case T: return "Current processing";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingModeEnumFactory.java
new file mode 100644
index 00000000000..d5255c5f739
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ProcessingModeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ProcessingModeEnumFactory implements EnumFactory {
+
+  public V3ProcessingMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("A".equals(codeString))
+      return V3ProcessingMode.A;
+    if ("I".equals(codeString))
+      return V3ProcessingMode.I;
+    if ("R".equals(codeString))
+      return V3ProcessingMode.R;
+    if ("T".equals(codeString))
+      return V3ProcessingMode.T;
+    throw new IllegalArgumentException("Unknown V3ProcessingMode code '"+codeString+"'");
+  }
+
+  public String toCode(V3ProcessingMode code) {
+    if (code == V3ProcessingMode.A)
+      return "A";
+    if (code == V3ProcessingMode.I)
+      return "I";
+    if (code == V3ProcessingMode.R)
+      return "R";
+    if (code == V3ProcessingMode.T)
+      return "T";
+    return "?";
+  }
+
+    public String toSystem(V3ProcessingMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryParameterValue.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryParameterValue.java
new file mode 100644
index 00000000000..4fcc4ecaec0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryParameterValue.java
@@ -0,0 +1,213 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3QueryParameterValue {
+
+        /**
+         * Description:Filter codes used to manage volume of dispenses returned by  a parameter-based queries.
+         */
+        _DISPENSEQUERYFILTERCODE, 
+        /**
+         * Description:Returns all dispenses to date for a prescription.
+         */
+        ALLDISP, 
+        /**
+         * Description:Returns the most recent dispense for a prescription.
+         */
+        LASTDISP, 
+        /**
+         * Description:Returns no dispense for a prescription.
+         */
+        NODISP, 
+        /**
+         * Filter codes used to manage types of orders being returned by a parameter-based query.
+         */
+        _ORDERFILTERCODE, 
+        /**
+         * Return all orders.
+         */
+        AO, 
+        /**
+         * Return only those orders that do not have results.
+         */
+        ONR, 
+        /**
+         * Return only those orders that have results.
+         */
+        OWR, 
+        /**
+         * A "helper" vocabulary used to construct complex query filters based on how and whether a prescription has been dispensed.
+         */
+        _PRESCRIPTIONDISPENSEFILTERCODE, 
+        /**
+         * Filter to only include SubstanceAdministration orders which have no remaining quantity authorized to be dispensed.
+         */
+        C, 
+        /**
+         * Filter to only include SubstanceAdministration orders which have no fulfilling supply events performed.
+         */
+        N, 
+        /**
+         * Filter to only include SubstanceAdministration orders which have had at least one fulfilling supply event, but which still have outstanding quantity remaining to be authorized.
+         */
+        R, 
+        /**
+         * Description:Indicates how result sets should be filtered based on whether they have associated issues.
+         */
+        _QUERYPARAMETERVALUE, 
+        /**
+         * Description:Result set should not be filtered based on the presence of issues.
+         */
+        ISSFA, 
+        /**
+         * Description:Result set should be filtered to only include records with associated issues.
+         */
+        ISSFI, 
+        /**
+         * Description:Result set should be filtered to only include records with associated unmanaged issues.
+         */
+        ISSFU, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3QueryParameterValue fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_DispenseQueryFilterCode".equals(codeString))
+          return _DISPENSEQUERYFILTERCODE;
+        if ("ALLDISP".equals(codeString))
+          return ALLDISP;
+        if ("LASTDISP".equals(codeString))
+          return LASTDISP;
+        if ("NODISP".equals(codeString))
+          return NODISP;
+        if ("_OrderFilterCode".equals(codeString))
+          return _ORDERFILTERCODE;
+        if ("AO".equals(codeString))
+          return AO;
+        if ("ONR".equals(codeString))
+          return ONR;
+        if ("OWR".equals(codeString))
+          return OWR;
+        if ("_PrescriptionDispenseFilterCode".equals(codeString))
+          return _PRESCRIPTIONDISPENSEFILTERCODE;
+        if ("C".equals(codeString))
+          return C;
+        if ("N".equals(codeString))
+          return N;
+        if ("R".equals(codeString))
+          return R;
+        if ("_QueryParameterValue".equals(codeString))
+          return _QUERYPARAMETERVALUE;
+        if ("ISSFA".equals(codeString))
+          return ISSFA;
+        if ("ISSFI".equals(codeString))
+          return ISSFI;
+        if ("ISSFU".equals(codeString))
+          return ISSFU;
+        throw new FHIRException("Unknown V3QueryParameterValue code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _DISPENSEQUERYFILTERCODE: return "_DispenseQueryFilterCode";
+            case ALLDISP: return "ALLDISP";
+            case LASTDISP: return "LASTDISP";
+            case NODISP: return "NODISP";
+            case _ORDERFILTERCODE: return "_OrderFilterCode";
+            case AO: return "AO";
+            case ONR: return "ONR";
+            case OWR: return "OWR";
+            case _PRESCRIPTIONDISPENSEFILTERCODE: return "_PrescriptionDispenseFilterCode";
+            case C: return "C";
+            case N: return "N";
+            case R: return "R";
+            case _QUERYPARAMETERVALUE: return "_QueryParameterValue";
+            case ISSFA: return "ISSFA";
+            case ISSFI: return "ISSFI";
+            case ISSFU: return "ISSFU";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/QueryParameterValue";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _DISPENSEQUERYFILTERCODE: return "Description:Filter codes used to manage volume of dispenses returned by  a parameter-based queries.";
+            case ALLDISP: return "Description:Returns all dispenses to date for a prescription.";
+            case LASTDISP: return "Description:Returns the most recent dispense for a prescription.";
+            case NODISP: return "Description:Returns no dispense for a prescription.";
+            case _ORDERFILTERCODE: return "Filter codes used to manage types of orders being returned by a parameter-based query.";
+            case AO: return "Return all orders.";
+            case ONR: return "Return only those orders that do not have results.";
+            case OWR: return "Return only those orders that have results.";
+            case _PRESCRIPTIONDISPENSEFILTERCODE: return "A \"helper\" vocabulary used to construct complex query filters based on how and whether a prescription has been dispensed.";
+            case C: return "Filter to only include SubstanceAdministration orders which have no remaining quantity authorized to be dispensed.";
+            case N: return "Filter to only include SubstanceAdministration orders which have no fulfilling supply events performed.";
+            case R: return "Filter to only include SubstanceAdministration orders which have had at least one fulfilling supply event, but which still have outstanding quantity remaining to be authorized.";
+            case _QUERYPARAMETERVALUE: return "Description:Indicates how result sets should be filtered based on whether they have associated issues.";
+            case ISSFA: return "Description:Result set should not be filtered based on the presence of issues.";
+            case ISSFI: return "Description:Result set should be filtered to only include records with associated issues.";
+            case ISSFU: return "Description:Result set should be filtered to only include records with associated unmanaged issues.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _DISPENSEQUERYFILTERCODE: return "dispense query filter code";
+            case ALLDISP: return "all dispenses";
+            case LASTDISP: return "last dispense";
+            case NODISP: return "no dispense";
+            case _ORDERFILTERCODE: return "_OrderFilterCode";
+            case AO: return "all orders";
+            case ONR: return "orders without results";
+            case OWR: return "orders with results";
+            case _PRESCRIPTIONDISPENSEFILTERCODE: return "Prescription Dispense Filter Code";
+            case C: return "Completely dispensed";
+            case N: return "Never Dispensed";
+            case R: return "Dispensed with remaining fills";
+            case _QUERYPARAMETERVALUE: return "QueryParameterValue";
+            case ISSFA: return "all";
+            case ISSFI: return "with issues";
+            case ISSFU: return "with unmanaged issues";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryParameterValueEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryParameterValueEnumFactory.java
new file mode 100644
index 00000000000..3ad5feb6c37
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryParameterValueEnumFactory.java
@@ -0,0 +1,118 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3QueryParameterValueEnumFactory implements EnumFactory {
+
+  public V3QueryParameterValue fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_DispenseQueryFilterCode".equals(codeString))
+      return V3QueryParameterValue._DISPENSEQUERYFILTERCODE;
+    if ("ALLDISP".equals(codeString))
+      return V3QueryParameterValue.ALLDISP;
+    if ("LASTDISP".equals(codeString))
+      return V3QueryParameterValue.LASTDISP;
+    if ("NODISP".equals(codeString))
+      return V3QueryParameterValue.NODISP;
+    if ("_OrderFilterCode".equals(codeString))
+      return V3QueryParameterValue._ORDERFILTERCODE;
+    if ("AO".equals(codeString))
+      return V3QueryParameterValue.AO;
+    if ("ONR".equals(codeString))
+      return V3QueryParameterValue.ONR;
+    if ("OWR".equals(codeString))
+      return V3QueryParameterValue.OWR;
+    if ("_PrescriptionDispenseFilterCode".equals(codeString))
+      return V3QueryParameterValue._PRESCRIPTIONDISPENSEFILTERCODE;
+    if ("C".equals(codeString))
+      return V3QueryParameterValue.C;
+    if ("N".equals(codeString))
+      return V3QueryParameterValue.N;
+    if ("R".equals(codeString))
+      return V3QueryParameterValue.R;
+    if ("_QueryParameterValue".equals(codeString))
+      return V3QueryParameterValue._QUERYPARAMETERVALUE;
+    if ("ISSFA".equals(codeString))
+      return V3QueryParameterValue.ISSFA;
+    if ("ISSFI".equals(codeString))
+      return V3QueryParameterValue.ISSFI;
+    if ("ISSFU".equals(codeString))
+      return V3QueryParameterValue.ISSFU;
+    throw new IllegalArgumentException("Unknown V3QueryParameterValue code '"+codeString+"'");
+  }
+
+  public String toCode(V3QueryParameterValue code) {
+    if (code == V3QueryParameterValue._DISPENSEQUERYFILTERCODE)
+      return "_DispenseQueryFilterCode";
+    if (code == V3QueryParameterValue.ALLDISP)
+      return "ALLDISP";
+    if (code == V3QueryParameterValue.LASTDISP)
+      return "LASTDISP";
+    if (code == V3QueryParameterValue.NODISP)
+      return "NODISP";
+    if (code == V3QueryParameterValue._ORDERFILTERCODE)
+      return "_OrderFilterCode";
+    if (code == V3QueryParameterValue.AO)
+      return "AO";
+    if (code == V3QueryParameterValue.ONR)
+      return "ONR";
+    if (code == V3QueryParameterValue.OWR)
+      return "OWR";
+    if (code == V3QueryParameterValue._PRESCRIPTIONDISPENSEFILTERCODE)
+      return "_PrescriptionDispenseFilterCode";
+    if (code == V3QueryParameterValue.C)
+      return "C";
+    if (code == V3QueryParameterValue.N)
+      return "N";
+    if (code == V3QueryParameterValue.R)
+      return "R";
+    if (code == V3QueryParameterValue._QUERYPARAMETERVALUE)
+      return "_QueryParameterValue";
+    if (code == V3QueryParameterValue.ISSFA)
+      return "ISSFA";
+    if (code == V3QueryParameterValue.ISSFI)
+      return "ISSFI";
+    if (code == V3QueryParameterValue.ISSFU)
+      return "ISSFU";
+    return "?";
+  }
+
+    public String toSystem(V3QueryParameterValue code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryPriority.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryPriority.java
new file mode 100644
index 00000000000..d8dc2b1ee4d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryPriority.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3QueryPriority {
+
+        /**
+         * Query response is deferred.
+         */
+        D, 
+        /**
+         * Query response is immediate.
+         */
+        I, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3QueryPriority fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("D".equals(codeString))
+          return D;
+        if ("I".equals(codeString))
+          return I;
+        throw new FHIRException("Unknown V3QueryPriority code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case D: return "D";
+            case I: return "I";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/QueryPriority";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case D: return "Query response is deferred.";
+            case I: return "Query response is immediate.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case D: return "Deferred";
+            case I: return "Immediate";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryPriorityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryPriorityEnumFactory.java
new file mode 100644
index 00000000000..ee6adab5a64
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryPriorityEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3QueryPriorityEnumFactory implements EnumFactory {
+
+  public V3QueryPriority fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("D".equals(codeString))
+      return V3QueryPriority.D;
+    if ("I".equals(codeString))
+      return V3QueryPriority.I;
+    throw new IllegalArgumentException("Unknown V3QueryPriority code '"+codeString+"'");
+  }
+
+  public String toCode(V3QueryPriority code) {
+    if (code == V3QueryPriority.D)
+      return "D";
+    if (code == V3QueryPriority.I)
+      return "I";
+    return "?";
+  }
+
+    public String toSystem(V3QueryPriority code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryRequestLimit.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryRequestLimit.java
new file mode 100644
index 00000000000..9a38935fe3b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryRequestLimit.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3QueryRequestLimit {
+
+        /**
+         * Definition: The number of matching instances (number of focal classes). The document header class is the focal class of a document, a record would therefore be equal to a document.
+         */
+        _QUERYREQUESTLIMIT, 
+        /**
+         * Definition: The number of matching instances (number of focal classes). The document header class is the focal class of a document, a record would therefore be equal to a document.
+         */
+        RD, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3QueryRequestLimit fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_QueryRequestLimit".equals(codeString))
+          return _QUERYREQUESTLIMIT;
+        if ("RD".equals(codeString))
+          return RD;
+        throw new FHIRException("Unknown V3QueryRequestLimit code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _QUERYREQUESTLIMIT: return "_QueryRequestLimit";
+            case RD: return "RD";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/QueryRequestLimit";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _QUERYREQUESTLIMIT: return "Definition: The number of matching instances (number of focal classes). The document header class is the focal class of a document, a record would therefore be equal to a document.";
+            case RD: return "Definition: The number of matching instances (number of focal classes). The document header class is the focal class of a document, a record would therefore be equal to a document.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _QUERYREQUESTLIMIT: return "QueryRequestLimit";
+            case RD: return "record";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryRequestLimitEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryRequestLimitEnumFactory.java
new file mode 100644
index 00000000000..bf32e6bc04a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryRequestLimitEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3QueryRequestLimitEnumFactory implements EnumFactory {
+
+  public V3QueryRequestLimit fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_QueryRequestLimit".equals(codeString))
+      return V3QueryRequestLimit._QUERYREQUESTLIMIT;
+    if ("RD".equals(codeString))
+      return V3QueryRequestLimit.RD;
+    throw new IllegalArgumentException("Unknown V3QueryRequestLimit code '"+codeString+"'");
+  }
+
+  public String toCode(V3QueryRequestLimit code) {
+    if (code == V3QueryRequestLimit._QUERYREQUESTLIMIT)
+      return "_QueryRequestLimit";
+    if (code == V3QueryRequestLimit.RD)
+      return "RD";
+    return "?";
+  }
+
+    public String toSystem(V3QueryRequestLimit code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryResponse.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryResponse.java
new file mode 100644
index 00000000000..4ecbef85414
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryResponse.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3QueryResponse {
+
+        /**
+         * Query Error.  Application Error.
+         */
+        AE, 
+        /**
+         * No errors, but no data was found matching the query request specification.
+         */
+        NF, 
+        /**
+         * Query reponse data found for 1 or more result sets matching the query request specification.
+         */
+        OK, 
+        /**
+         * QueryError. Problem with input ParmetersError
+         */
+        QE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3QueryResponse fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AE".equals(codeString))
+          return AE;
+        if ("NF".equals(codeString))
+          return NF;
+        if ("OK".equals(codeString))
+          return OK;
+        if ("QE".equals(codeString))
+          return QE;
+        throw new FHIRException("Unknown V3QueryResponse code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AE: return "AE";
+            case NF: return "NF";
+            case OK: return "OK";
+            case QE: return "QE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/QueryResponse";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AE: return "Query Error.  Application Error.";
+            case NF: return "No errors, but no data was found matching the query request specification.";
+            case OK: return "Query reponse data found for 1 or more result sets matching the query request specification.";
+            case QE: return "QueryError. Problem with input ParmetersError";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AE: return "ApplicationError";
+            case NF: return "No data found";
+            case OK: return "Data found";
+            case QE: return "QueryParameterError";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryResponseEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryResponseEnumFactory.java
new file mode 100644
index 00000000000..16e936f6447
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryResponseEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3QueryResponseEnumFactory implements EnumFactory {
+
+  public V3QueryResponse fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AE".equals(codeString))
+      return V3QueryResponse.AE;
+    if ("NF".equals(codeString))
+      return V3QueryResponse.NF;
+    if ("OK".equals(codeString))
+      return V3QueryResponse.OK;
+    if ("QE".equals(codeString))
+      return V3QueryResponse.QE;
+    throw new IllegalArgumentException("Unknown V3QueryResponse code '"+codeString+"'");
+  }
+
+  public String toCode(V3QueryResponse code) {
+    if (code == V3QueryResponse.AE)
+      return "AE";
+    if (code == V3QueryResponse.NF)
+      return "NF";
+    if (code == V3QueryResponse.OK)
+      return "OK";
+    if (code == V3QueryResponse.QE)
+      return "QE";
+    return "?";
+  }
+
+    public String toSystem(V3QueryResponse code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryStatusCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryStatusCode.java
new file mode 100644
index 00000000000..d82b53ab4f8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryStatusCode.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3QueryStatusCode {
+
+        /**
+         * Query status aborted
+         */
+        ABORTED, 
+        /**
+         * Query Status delivered response
+         */
+        DELIVEREDRESPONSE, 
+        /**
+         * Query Status executing
+         */
+        EXECUTING, 
+        /**
+         * Query Status new
+         */
+        NEW, 
+        /**
+         * Query Status wait continued
+         */
+        WAITCONTINUEDQUERYRESPONSE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3QueryStatusCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("aborted".equals(codeString))
+          return ABORTED;
+        if ("deliveredResponse".equals(codeString))
+          return DELIVEREDRESPONSE;
+        if ("executing".equals(codeString))
+          return EXECUTING;
+        if ("new".equals(codeString))
+          return NEW;
+        if ("waitContinuedQueryResponse".equals(codeString))
+          return WAITCONTINUEDQUERYRESPONSE;
+        throw new FHIRException("Unknown V3QueryStatusCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ABORTED: return "aborted";
+            case DELIVEREDRESPONSE: return "deliveredResponse";
+            case EXECUTING: return "executing";
+            case NEW: return "new";
+            case WAITCONTINUEDQUERYRESPONSE: return "waitContinuedQueryResponse";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/QueryStatusCode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ABORTED: return "Query status aborted";
+            case DELIVEREDRESPONSE: return "Query Status delivered response";
+            case EXECUTING: return "Query Status executing";
+            case NEW: return "Query Status new";
+            case WAITCONTINUEDQUERYRESPONSE: return "Query Status wait continued";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ABORTED: return "aborted";
+            case DELIVEREDRESPONSE: return "deliveredResponse";
+            case EXECUTING: return "executing";
+            case NEW: return "new";
+            case WAITCONTINUEDQUERYRESPONSE: return "waitContinuedQueryResponse";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryStatusCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryStatusCodeEnumFactory.java
new file mode 100644
index 00000000000..aad8bfc4a1c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3QueryStatusCodeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3QueryStatusCodeEnumFactory implements EnumFactory {
+
+  public V3QueryStatusCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("aborted".equals(codeString))
+      return V3QueryStatusCode.ABORTED;
+    if ("deliveredResponse".equals(codeString))
+      return V3QueryStatusCode.DELIVEREDRESPONSE;
+    if ("executing".equals(codeString))
+      return V3QueryStatusCode.EXECUTING;
+    if ("new".equals(codeString))
+      return V3QueryStatusCode.NEW;
+    if ("waitContinuedQueryResponse".equals(codeString))
+      return V3QueryStatusCode.WAITCONTINUEDQUERYRESPONSE;
+    throw new IllegalArgumentException("Unknown V3QueryStatusCode code '"+codeString+"'");
+  }
+
+  public String toCode(V3QueryStatusCode code) {
+    if (code == V3QueryStatusCode.ABORTED)
+      return "aborted";
+    if (code == V3QueryStatusCode.DELIVEREDRESPONSE)
+      return "deliveredResponse";
+    if (code == V3QueryStatusCode.EXECUTING)
+      return "executing";
+    if (code == V3QueryStatusCode.NEW)
+      return "new";
+    if (code == V3QueryStatusCode.WAITCONTINUEDQUERYRESPONSE)
+      return "waitContinuedQueryResponse";
+    return "?";
+  }
+
+    public String toSystem(V3QueryStatusCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Race.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Race.java
new file mode 100644
index 00000000000..26a8a20f3ec
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Race.java
@@ -0,0 +1,8358 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3Race {
+
+        /**
+         * American Indian or Alaska Native
+         */
+        _10025, 
+        /**
+         * American Indian
+         */
+        _10041, 
+        /**
+         * Abenaki
+         */
+        _10066, 
+        /**
+         * Algonquian
+         */
+        _10082, 
+        /**
+         * Apache
+         */
+        _10108, 
+        /**
+         * Chiricahua
+         */
+        _10116, 
+        /**
+         * Fort Sill Apache
+         */
+        _10124, 
+        /**
+         * Jicarilla Apache
+         */
+        _10132, 
+        /**
+         * Lipan Apache
+         */
+        _10140, 
+        /**
+         * Mescalero Apache
+         */
+        _10157, 
+        /**
+         * Oklahoma Apache
+         */
+        _10165, 
+        /**
+         * Payson Apache
+         */
+        _10173, 
+        /**
+         * San Carlos Apache
+         */
+        _10181, 
+        /**
+         * White Mountain Apache
+         */
+        _10199, 
+        /**
+         * Arapaho
+         */
+        _10215, 
+        /**
+         * Northern Arapaho
+         */
+        _10223, 
+        /**
+         * Southern Arapaho
+         */
+        _10231, 
+        /**
+         * Wind River Arapaho
+         */
+        _10249, 
+        /**
+         * Arikara
+         */
+        _10264, 
+        /**
+         * Assiniboine
+         */
+        _10280, 
+        /**
+         * Assiniboine Sioux
+         */
+        _10306, 
+        /**
+         * Fort Peck Assiniboine Sioux
+         */
+        _10314, 
+        /**
+         * Bannock
+         */
+        _10330, 
+        /**
+         * Blackfeet
+         */
+        _10355, 
+        /**
+         * Brotherton
+         */
+        _10371, 
+        /**
+         * Burt Lake Band
+         */
+        _10397, 
+        /**
+         * Caddo
+         */
+        _10413, 
+        /**
+         * Oklahoma Cado
+         */
+        _10421, 
+        /**
+         * Cahuilla
+         */
+        _10447, 
+        /**
+         * Agua Caliente Cahuilla
+         */
+        _10454, 
+        /**
+         * Augustine
+         */
+        _10462, 
+        /**
+         * Cabazon
+         */
+        _10470, 
+        /**
+         * Los Coyotes
+         */
+        _10488, 
+        /**
+         * Morongo
+         */
+        _10496, 
+        /**
+         * Santa Rosa Cahuilla
+         */
+        _10504, 
+        /**
+         * Torres-Martinez
+         */
+        _10512, 
+        /**
+         * California Tribes
+         */
+        _10538, 
+        /**
+         * Cahto
+         */
+        _10546, 
+        /**
+         * Chimariko
+         */
+        _10553, 
+        /**
+         * Coast Miwok
+         */
+        _10561, 
+        /**
+         * Digger
+         */
+        _10579, 
+        /**
+         * Kawaiisu
+         */
+        _10587, 
+        /**
+         * Kern River
+         */
+        _10595, 
+        /**
+         * Mattole
+         */
+        _10603, 
+        /**
+         * Red Wood
+         */
+        _10611, 
+        /**
+         * Santa Rosa
+         */
+        _10629, 
+        /**
+         * Takelma
+         */
+        _10637, 
+        /**
+         * Wappo
+         */
+        _10645, 
+        /**
+         * Yana
+         */
+        _10652, 
+        /**
+         * Yuki
+         */
+        _10660, 
+        /**
+         * Canadian and Latin American Indian
+         */
+        _10686, 
+        /**
+         * Canadian Indian
+         */
+        _10694, 
+        /**
+         * Central American Indian
+         */
+        _10702, 
+        /**
+         * French American Indian
+         */
+        _10710, 
+        /**
+         * Mexican American Indian
+         */
+        _10728, 
+        /**
+         * South American Indian
+         */
+        _10736, 
+        /**
+         * Spanish American Indian
+         */
+        _10744, 
+        /**
+         * Catawba
+         */
+        _10769, 
+        /**
+         * Alatna
+         */
+        _17418, 
+        /**
+         * Alexander
+         */
+        _17426, 
+        /**
+         * Allakaket
+         */
+        _17434, 
+        /**
+         * Alanvik
+         */
+        _17442, 
+        /**
+         * Anvik
+         */
+        _17459, 
+        /**
+         * Arctic
+         */
+        _17467, 
+        /**
+         * Beaver
+         */
+        _17475, 
+        /**
+         * Birch Creek
+         */
+        _17483, 
+        /**
+         * Cantwell
+         */
+        _17491, 
+        /**
+         * Chalkyitsik
+         */
+        _17509, 
+        /**
+         * Chickaloon
+         */
+        _17517, 
+        /**
+         * Chistochina
+         */
+        _17525, 
+        /**
+         * Chitina
+         */
+        _17533, 
+        /**
+         * Circle
+         */
+        _17541, 
+        /**
+         * Cook Inlet
+         */
+        _17558, 
+        /**
+         * Copper Center
+         */
+        _17566, 
+        /**
+         * Copper River
+         */
+        _17574, 
+        /**
+         * Dot Lake
+         */
+        _17582, 
+        /**
+         * Doyon
+         */
+        _17590, 
+        /**
+         * Eagle
+         */
+        _17608, 
+        /**
+         * Eklutna
+         */
+        _17616, 
+        /**
+         * Evansville
+         */
+        _17624, 
+        /**
+         * Fort Yukon
+         */
+        _17632, 
+        /**
+         * Gakona
+         */
+        _17640, 
+        /**
+         * Galena
+         */
+        _17657, 
+        /**
+         * Grayling
+         */
+        _17665, 
+        /**
+         * Gulkana
+         */
+        _17673, 
+        /**
+         * Healy Lake
+         */
+        _17681, 
+        /**
+         * Holy Cross
+         */
+        _17699, 
+        /**
+         * Hughes
+         */
+        _17707, 
+        /**
+         * Huslia
+         */
+        _17715, 
+        /**
+         * Iliamna
+         */
+        _17723, 
+        /**
+         * Kaltag
+         */
+        _17731, 
+        /**
+         * Kluti Kaah
+         */
+        _17749, 
+        /**
+         * Knik
+         */
+        _17756, 
+        /**
+         * Koyukuk
+         */
+        _17764, 
+        /**
+         * Lake Minchumina
+         */
+        _17772, 
+        /**
+         * Lime
+         */
+        _17780, 
+        /**
+         * Mcgrath
+         */
+        _17798, 
+        /**
+         * Manley Hot Springs
+         */
+        _17806, 
+        /**
+         * Mentasta Lake
+         */
+        _17814, 
+        /**
+         * Minto
+         */
+        _17822, 
+        /**
+         * Nenana
+         */
+        _17830, 
+        /**
+         * Nikolai
+         */
+        _17848, 
+        /**
+         * Ninilchik
+         */
+        _17855, 
+        /**
+         * Nondalton
+         */
+        _17863, 
+        /**
+         * Northway
+         */
+        _17871, 
+        /**
+         * Nulato
+         */
+        _17889, 
+        /**
+         * Pedro Bay
+         */
+        _17897, 
+        /**
+         * Rampart
+         */
+        _17905, 
+        /**
+         * Ruby
+         */
+        _17913, 
+        /**
+         * Salamatof
+         */
+        _17921, 
+        /**
+         * Seldovia
+         */
+        _17939, 
+        /**
+         * Slana
+         */
+        _17947, 
+        /**
+         * Shageluk
+         */
+        _17954, 
+        /**
+         * Stevens
+         */
+        _17962, 
+        /**
+         * Stony River
+         */
+        _17970, 
+        /**
+         * Takotna
+         */
+        _17988, 
+        /**
+         * Tanacross
+         */
+        _17996, 
+        /**
+         * Tanaina
+         */
+        _18002, 
+        /**
+         * Tanana
+         */
+        _18010, 
+        /**
+         * Tanana Chiefs
+         */
+        _18028, 
+        /**
+         * Tazlina
+         */
+        _18036, 
+        /**
+         * Telida
+         */
+        _18044, 
+        /**
+         * Tetlin
+         */
+        _18051, 
+        /**
+         * Tok
+         */
+        _18069, 
+        /**
+         * Tyonek
+         */
+        _18077, 
+        /**
+         * Venetie
+         */
+        _18085, 
+        /**
+         * Wiseman
+         */
+        _18093, 
+        /**
+         * Cayuse
+         */
+        _10785, 
+        /**
+         * Chehalis
+         */
+        _10801, 
+        /**
+         * Chemakuan
+         */
+        _10827, 
+        /**
+         * Hoh
+         */
+        _10835, 
+        /**
+         * Quileute
+         */
+        _10843, 
+        /**
+         * Chemehuevi
+         */
+        _10868, 
+        /**
+         * Cherokee
+         */
+        _10884, 
+        /**
+         * Cherokee Alabama
+         */
+        _10892, 
+        /**
+         * Cherokees of Northeast Alabama
+         */
+        _10900, 
+        /**
+         * Cherokees of Southeast Alabama
+         */
+        _10918, 
+        /**
+         * Eastern Cherokee
+         */
+        _10926, 
+        /**
+         * Echota Cherokee
+         */
+        _10934, 
+        /**
+         * Etowah Cherokee
+         */
+        _10942, 
+        /**
+         * Northern Cherokee
+         */
+        _10959, 
+        /**
+         * Tuscola
+         */
+        _10967, 
+        /**
+         * United Keetowah Band of Cherokee
+         */
+        _10975, 
+        /**
+         * Western Cherokee
+         */
+        _10983, 
+        /**
+         * Cherokee Shawnee
+         */
+        _11007, 
+        /**
+         * Cheyenne
+         */
+        _11023, 
+        /**
+         * Northern Cheyenne
+         */
+        _11031, 
+        /**
+         * Southern Cheyenne
+         */
+        _11049, 
+        /**
+         * Cheyenne-Arapaho
+         */
+        _11064, 
+        /**
+         * Chickahominy
+         */
+        _11080, 
+        /**
+         * Eastern Chickahominy
+         */
+        _11098, 
+        /**
+         * Western Chickahominy
+         */
+        _11106, 
+        /**
+         * Chickasaw
+         */
+        _11122, 
+        /**
+         * Chinook
+         */
+        _11148, 
+        /**
+         * Clatsop
+         */
+        _11155, 
+        /**
+         * Columbia River Chinook
+         */
+        _11163, 
+        /**
+         * Kathlamet
+         */
+        _11171, 
+        /**
+         * Upper Chinook
+         */
+        _11189, 
+        /**
+         * Wakiakum Chinook
+         */
+        _11197, 
+        /**
+         * Willapa Chinook
+         */
+        _11205, 
+        /**
+         * Wishram
+         */
+        _11213, 
+        /**
+         * Chippewa
+         */
+        _11239, 
+        /**
+         * Bad River
+         */
+        _11247, 
+        /**
+         * Bay Mills Chippewa
+         */
+        _11254, 
+        /**
+         * Bois Forte
+         */
+        _11262, 
+        /**
+         * Burt Lake Chippewa
+         */
+        _11270, 
+        /**
+         * Fond du Lac
+         */
+        _11288, 
+        /**
+         * Grand Portage
+         */
+        _11296, 
+        /**
+         * Grand Traverse Band of Ottawa-Chippewa
+         */
+        _11304, 
+        /**
+         * Keweenaw
+         */
+        _11312, 
+        /**
+         * Lac Courte Oreilles
+         */
+        _11320, 
+        /**
+         * Lac du Flambeau
+         */
+        _11338, 
+        /**
+         * Lac Vieux Desert Chippewa
+         */
+        _11346, 
+        /**
+         * Lake Superior
+         */
+        _11353, 
+        /**
+         * Leech Lake
+         */
+        _11361, 
+        /**
+         * Little Shell Chippewa
+         */
+        _11379, 
+        /**
+         * Mille Lacs
+         */
+        _11387, 
+        /**
+         * Minnesota Chippewa
+         */
+        _11395, 
+        /**
+         * Ontonagon
+         */
+        _11403, 
+        /**
+         * Red Cliff Chippewa
+         */
+        _11411, 
+        /**
+         * Red Lake Chippewa
+         */
+        _11429, 
+        /**
+         * Saginaw Chippewa
+         */
+        _11437, 
+        /**
+         * St. Croix Chippewa
+         */
+        _11445, 
+        /**
+         * Sault Ste. Marie Chippewa
+         */
+        _11452, 
+        /**
+         * Sokoagon Chippewa
+         */
+        _11460, 
+        /**
+         * Turtle Mountain
+         */
+        _11478, 
+        /**
+         * White Earth
+         */
+        _11486, 
+        /**
+         * Chippewa Cree
+         */
+        _11502, 
+        /**
+         * Rocky Boy's Chippewa Cree
+         */
+        _11510, 
+        /**
+         * Chitimacha
+         */
+        _11536, 
+        /**
+         * Choctaw
+         */
+        _11551, 
+        /**
+         * Clifton Choctaw
+         */
+        _11569, 
+        /**
+         * Jena Choctaw
+         */
+        _11577, 
+        /**
+         * Mississippi Choctaw
+         */
+        _11585, 
+        /**
+         * Mowa Band of Choctaw
+         */
+        _11593, 
+        /**
+         * Oklahoma Choctaw
+         */
+        _11601, 
+        /**
+         * Chumash
+         */
+        _11627, 
+        /**
+         * Santa Ynez
+         */
+        _11635, 
+        /**
+         * Clear Lake
+         */
+        _11650, 
+        /**
+         * Coeur D'Alene
+         */
+        _11676, 
+        /**
+         * Coharie
+         */
+        _11692, 
+        /**
+         * Colorado River
+         */
+        _11718, 
+        /**
+         * Colville
+         */
+        _11734, 
+        /**
+         * Comanche
+         */
+        _11759, 
+        /**
+         * Oklahoma Comanche
+         */
+        _11767, 
+        /**
+         * Coos, Lower Umpqua, Siuslaw
+         */
+        _11783, 
+        /**
+         * Coos
+         */
+        _11809, 
+        /**
+         * Coquilles
+         */
+        _11825, 
+        /**
+         * Costanoan
+         */
+        _11841, 
+        /**
+         * Coushatta
+         */
+        _11866, 
+        /**
+         * Alabama Coushatta
+         */
+        _11874, 
+        /**
+         * Cowlitz
+         */
+        _11890, 
+        /**
+         * Cree
+         */
+        _11916, 
+        /**
+         * Creek
+         */
+        _11932, 
+        /**
+         * Alabama Creek
+         */
+        _11940, 
+        /**
+         * Alabama Quassarte
+         */
+        _11957, 
+        /**
+         * Eastern Creek
+         */
+        _11965, 
+        /**
+         * Eastern Muscogee
+         */
+        _11973, 
+        /**
+         * Kialegee
+         */
+        _11981, 
+        /**
+         * Lower Muscogee
+         */
+        _11999, 
+        /**
+         * Machis Lower Creek Indian
+         */
+        _12005, 
+        /**
+         * Poarch Band
+         */
+        _12013, 
+        /**
+         * Principal Creek Indian Nation
+         */
+        _12021, 
+        /**
+         * Star Clan of Muscogee Creeks
+         */
+        _12039, 
+        /**
+         * Thlopthlocco
+         */
+        _12047, 
+        /**
+         * Tuckabachee
+         */
+        _12054, 
+        /**
+         * Croatan
+         */
+        _12070, 
+        /**
+         * Crow
+         */
+        _12096, 
+        /**
+         * Cupeno
+         */
+        _12112, 
+        /**
+         * Agua Caliente
+         */
+        _12120, 
+        /**
+         * Delaware
+         */
+        _12146, 
+        /**
+         * Eastern Delaware
+         */
+        _12153, 
+        /**
+         * Lenni-Lenape
+         */
+        _12161, 
+        /**
+         * Munsee
+         */
+        _12179, 
+        /**
+         * Oklahoma Delaware
+         */
+        _12187, 
+        /**
+         * Rampough Mountain
+         */
+        _12195, 
+        /**
+         * Sand Hill
+         */
+        _12203, 
+        /**
+         * Diegueno
+         */
+        _12229, 
+        /**
+         * Campo
+         */
+        _12237, 
+        /**
+         * Capitan Grande
+         */
+        _12245, 
+        /**
+         * Cuyapaipe
+         */
+        _12252, 
+        /**
+         * La Posta
+         */
+        _12260, 
+        /**
+         * Manzanita
+         */
+        _12278, 
+        /**
+         * Mesa Grande
+         */
+        _12286, 
+        /**
+         * San Pasqual
+         */
+        _12294, 
+        /**
+         * Santa Ysabel
+         */
+        _12302, 
+        /**
+         * Sycuan
+         */
+        _12310, 
+        /**
+         * Eastern Tribes
+         */
+        _12336, 
+        /**
+         * Attacapa
+         */
+        _12344, 
+        /**
+         * Biloxi
+         */
+        _12351, 
+        /**
+         * Georgetown
+         */
+        _12369, 
+        /**
+         * Moor
+         */
+        _12377, 
+        /**
+         * Nansemond
+         */
+        _12385, 
+        /**
+         * Natchez
+         */
+        _12393, 
+        /**
+         * Nausu Waiwash
+         */
+        _12401, 
+        /**
+         * Nipmuc
+         */
+        _12419, 
+        /**
+         * Paugussett
+         */
+        _12427, 
+        /**
+         * Pocomoke Acohonock
+         */
+        _12435, 
+        /**
+         * Southeastern Indians
+         */
+        _12443, 
+        /**
+         * Susquehanock
+         */
+        _12450, 
+        /**
+         * Tunica Biloxi
+         */
+        _12468, 
+        /**
+         * Waccamaw-Siousan
+         */
+        _12476, 
+        /**
+         * Wicomico
+         */
+        _12484, 
+        /**
+         * Esselen
+         */
+        _12500, 
+        /**
+         * Fort Belknap
+         */
+        _12526, 
+        /**
+         * Fort Berthold
+         */
+        _12542, 
+        /**
+         * Fort Mcdowell
+         */
+        _12567, 
+        /**
+         * Fort Hall
+         */
+        _12583, 
+        /**
+         * Gabrieleno
+         */
+        _12609, 
+        /**
+         * Grand Ronde
+         */
+        _12625, 
+        /**
+         * Gros Ventres
+         */
+        _12641, 
+        /**
+         * Atsina
+         */
+        _12658, 
+        /**
+         * Haliwa
+         */
+        _12674, 
+        /**
+         * Hidatsa
+         */
+        _12690, 
+        /**
+         * Hoopa
+         */
+        _12716, 
+        /**
+         * Trinity
+         */
+        _12724, 
+        /**
+         * Whilkut
+         */
+        _12732, 
+        /**
+         * Hoopa Extension
+         */
+        _12757, 
+        /**
+         * Houma
+         */
+        _12773, 
+        /**
+         * Inaja-Cosmit
+         */
+        _12799, 
+        /**
+         * Iowa
+         */
+        _12815, 
+        /**
+         * Iowa of Kansas-Nebraska
+         */
+        _12823, 
+        /**
+         * Iowa of Oklahoma
+         */
+        _12831, 
+        /**
+         * Iroquois
+         */
+        _12856, 
+        /**
+         * Cayuga
+         */
+        _12864, 
+        /**
+         * Mohawk
+         */
+        _12872, 
+        /**
+         * Oneida
+         */
+        _12880, 
+        /**
+         * Onondaga
+         */
+        _12898, 
+        /**
+         * Seneca
+         */
+        _12906, 
+        /**
+         * Seneca Nation
+         */
+        _12914, 
+        /**
+         * Seneca-Cayuga
+         */
+        _12922, 
+        /**
+         * Tonawanda Seneca
+         */
+        _12930, 
+        /**
+         * Tuscarora
+         */
+        _12948, 
+        /**
+         * Wyandotte
+         */
+        _12955, 
+        /**
+         * Juaneno
+         */
+        _12971, 
+        /**
+         * Kalispel
+         */
+        _12997, 
+        /**
+         * Karuk
+         */
+        _13011, 
+        /**
+         * Kaw
+         */
+        _13037, 
+        /**
+         * Kickapoo
+         */
+        _13052, 
+        /**
+         * Oklahoma Kickapoo
+         */
+        _13060, 
+        /**
+         * Texas Kickapoo
+         */
+        _13078, 
+        /**
+         * Kiowa
+         */
+        _13094, 
+        /**
+         * Oklahoma Kiowa
+         */
+        _13102, 
+        /**
+         * Klallam
+         */
+        _13128, 
+        /**
+         * Jamestown
+         */
+        _13136, 
+        /**
+         * Lower Elwha
+         */
+        _13144, 
+        /**
+         * Port Gamble Klallam
+         */
+        _13151, 
+        /**
+         * Klamath
+         */
+        _13177, 
+        /**
+         * Konkow
+         */
+        _13193, 
+        /**
+         * Kootenai
+         */
+        _13219, 
+        /**
+         * Lassik
+         */
+        _13235, 
+        /**
+         * Long Island
+         */
+        _13250, 
+        /**
+         * Matinecock
+         */
+        _13268, 
+        /**
+         * Montauk
+         */
+        _13276, 
+        /**
+         * Poospatuck
+         */
+        _13284, 
+        /**
+         * Setauket
+         */
+        _13292, 
+        /**
+         * Luiseno
+         */
+        _13318, 
+        /**
+         * La Jolla
+         */
+        _13326, 
+        /**
+         * Pala
+         */
+        _13334, 
+        /**
+         * Pauma
+         */
+        _13342, 
+        /**
+         * Pechanga
+         */
+        _13359, 
+        /**
+         * Soboba
+         */
+        _13367, 
+        /**
+         * Twenty-Nine Palms
+         */
+        _13375, 
+        /**
+         * Temecula
+         */
+        _13383, 
+        /**
+         * Lumbee
+         */
+        _13409, 
+        /**
+         * Lummi
+         */
+        _13425, 
+        /**
+         * Maidu
+         */
+        _13441, 
+        /**
+         * Mountain Maidu
+         */
+        _13458, 
+        /**
+         * Nishinam
+         */
+        _13466, 
+        /**
+         * Makah
+         */
+        _13482, 
+        /**
+         * Maliseet
+         */
+        _13508, 
+        /**
+         * Mandan
+         */
+        _13524, 
+        /**
+         * Mattaponi
+         */
+        _13540, 
+        /**
+         * Menominee
+         */
+        _13565, 
+        /**
+         * Miami
+         */
+        _13581, 
+        /**
+         * Illinois Miami
+         */
+        _13599, 
+        /**
+         * Indiana Miami
+         */
+        _13607, 
+        /**
+         * Oklahoma Miami
+         */
+        _13615, 
+        /**
+         * Miccosukee
+         */
+        _13631, 
+        /**
+         * Micmac
+         */
+        _13656, 
+        /**
+         * Aroostook
+         */
+        _13664, 
+        /**
+         * Mission Indians
+         */
+        _13680, 
+        /**
+         * Miwok
+         */
+        _13706, 
+        /**
+         * Modoc
+         */
+        _13722, 
+        /**
+         * Mohegan
+         */
+        _13748, 
+        /**
+         * Mono
+         */
+        _13763, 
+        /**
+         * Nanticoke
+         */
+        _13789, 
+        /**
+         * Narragansett
+         */
+        _13805, 
+        /**
+         * Navajo
+         */
+        _13821, 
+        /**
+         * Alamo Navajo
+         */
+        _13839, 
+        /**
+         * Canoncito Navajo
+         */
+        _13847, 
+        /**
+         * Ramah Navajo
+         */
+        _13854, 
+        /**
+         * Nez Perce
+         */
+        _13870, 
+        /**
+         * Nomalaki
+         */
+        _13896, 
+        /**
+         * Northwest Tribes
+         */
+        _13912, 
+        /**
+         * Alsea
+         */
+        _13920, 
+        /**
+         * Celilo
+         */
+        _13938, 
+        /**
+         * Columbia
+         */
+        _13946, 
+        /**
+         * Kalapuya
+         */
+        _13953, 
+        /**
+         * Molala
+         */
+        _13961, 
+        /**
+         * Talakamish
+         */
+        _13979, 
+        /**
+         * Tenino
+         */
+        _13987, 
+        /**
+         * Tillamook
+         */
+        _13995, 
+        /**
+         * Wenatchee
+         */
+        _14001, 
+        /**
+         * Yahooskin
+         */
+        _14019, 
+        /**
+         * Omaha
+         */
+        _14035, 
+        /**
+         * Oregon Athabaskan
+         */
+        _14050, 
+        /**
+         * Osage
+         */
+        _14076, 
+        /**
+         * Otoe-Missouria
+         */
+        _14092, 
+        /**
+         * Ottawa
+         */
+        _14118, 
+        /**
+         * Burt Lake Ottawa
+         */
+        _14126, 
+        /**
+         * Michigan Ottawa
+         */
+        _14134, 
+        /**
+         * Oklahoma Ottawa
+         */
+        _14142, 
+        /**
+         * Paiute
+         */
+        _14167, 
+        /**
+         * Bishop
+         */
+        _14175, 
+        /**
+         * Bridgeport
+         */
+        _14183, 
+        /**
+         * Burns Paiute
+         */
+        _14191, 
+        /**
+         * Cedarville
+         */
+        _14209, 
+        /**
+         * Fort Bidwell
+         */
+        _14217, 
+        /**
+         * Fort Independence
+         */
+        _14225, 
+        /**
+         * Kaibab
+         */
+        _14233, 
+        /**
+         * Las Vegas
+         */
+        _14241, 
+        /**
+         * Lone Pine
+         */
+        _14258, 
+        /**
+         * Lovelock
+         */
+        _14266, 
+        /**
+         * Malheur Paiute
+         */
+        _14274, 
+        /**
+         * Moapa
+         */
+        _14282, 
+        /**
+         * Northern Paiute
+         */
+        _14290, 
+        /**
+         * Owens Valley
+         */
+        _14308, 
+        /**
+         * Pyramid Lake
+         */
+        _14316, 
+        /**
+         * San Juan Southern Paiute
+         */
+        _14324, 
+        /**
+         * Southern Paiute
+         */
+        _14332, 
+        /**
+         * Summit Lake
+         */
+        _14340, 
+        /**
+         * Utu Utu Gwaitu Paiute
+         */
+        _14357, 
+        /**
+         * Walker River
+         */
+        _14365, 
+        /**
+         * Yerington Paiute
+         */
+        _14373, 
+        /**
+         * Pamunkey
+         */
+        _14399, 
+        /**
+         * Passamaquoddy
+         */
+        _14415, 
+        /**
+         * Indian Township
+         */
+        _14423, 
+        /**
+         * Pleasant Point Passamaquoddy
+         */
+        _14431, 
+        /**
+         * Pawnee
+         */
+        _14456, 
+        /**
+         * Oklahoma Pawnee
+         */
+        _14464, 
+        /**
+         * Penobscot
+         */
+        _14480, 
+        /**
+         * Peoria
+         */
+        _14506, 
+        /**
+         * Oklahoma Peoria
+         */
+        _14514, 
+        /**
+         * Pequot
+         */
+        _14530, 
+        /**
+         * Marshantucket Pequot
+         */
+        _14548, 
+        /**
+         * Pima
+         */
+        _14563, 
+        /**
+         * Gila River Pima-Maricopa
+         */
+        _14571, 
+        /**
+         * Salt River Pima-Maricopa
+         */
+        _14589, 
+        /**
+         * Piscataway
+         */
+        _14605, 
+        /**
+         * Pit River
+         */
+        _14621, 
+        /**
+         * Pomo
+         */
+        _14647, 
+        /**
+         * Central Pomo
+         */
+        _14654, 
+        /**
+         * Dry Creek
+         */
+        _14662, 
+        /**
+         * Eastern Pomo
+         */
+        _14670, 
+        /**
+         * Kashia
+         */
+        _14688, 
+        /**
+         * Northern Pomo
+         */
+        _14696, 
+        /**
+         * Scotts Valley
+         */
+        _14704, 
+        /**
+         * Stonyford
+         */
+        _14712, 
+        /**
+         * Sulphur Bank
+         */
+        _14720, 
+        /**
+         * Ponca
+         */
+        _14746, 
+        /**
+         * Nebraska Ponca
+         */
+        _14753, 
+        /**
+         * Oklahoma Ponca
+         */
+        _14761, 
+        /**
+         * Potawatomi
+         */
+        _14787, 
+        /**
+         * Citizen Band Potawatomi
+         */
+        _14795, 
+        /**
+         * Forest County
+         */
+        _14803, 
+        /**
+         * Hannahville
+         */
+        _14811, 
+        /**
+         * Huron Potawatomi
+         */
+        _14829, 
+        /**
+         * Pokagon Potawatomi
+         */
+        _14837, 
+        /**
+         * Prairie Band
+         */
+        _14845, 
+        /**
+         * Wisconsin Potawatomi
+         */
+        _14852, 
+        /**
+         * Powhatan
+         */
+        _14878, 
+        /**
+         * Pueblo
+         */
+        _14894, 
+        /**
+         * Acoma
+         */
+        _14902, 
+        /**
+         * Arizona Tewa
+         */
+        _14910, 
+        /**
+         * Cochiti
+         */
+        _14928, 
+        /**
+         * Hopi
+         */
+        _14936, 
+        /**
+         * Isleta
+         */
+        _14944, 
+        /**
+         * Jemez
+         */
+        _14951, 
+        /**
+         * Keres
+         */
+        _14969, 
+        /**
+         * Laguna
+         */
+        _14977, 
+        /**
+         * Nambe
+         */
+        _14985, 
+        /**
+         * Picuris
+         */
+        _14993, 
+        /**
+         * Piro
+         */
+        _15008, 
+        /**
+         * Pojoaque
+         */
+        _15016, 
+        /**
+         * San Felipe
+         */
+        _15024, 
+        /**
+         * San Ildefonso
+         */
+        _15032, 
+        /**
+         * San Juan Pueblo
+         */
+        _15040, 
+        /**
+         * San Juan De
+         */
+        _15057, 
+        /**
+         * San Juan
+         */
+        _15065, 
+        /**
+         * Sandia
+         */
+        _15073, 
+        /**
+         * Santa Ana
+         */
+        _15081, 
+        /**
+         * Santa Clara
+         */
+        _15099, 
+        /**
+         * Santo Domingo
+         */
+        _15107, 
+        /**
+         * Taos
+         */
+        _15115, 
+        /**
+         * Tesuque
+         */
+        _15123, 
+        /**
+         * Tewa
+         */
+        _15131, 
+        /**
+         * Tigua
+         */
+        _15149, 
+        /**
+         * Zia
+         */
+        _15156, 
+        /**
+         * Zuni
+         */
+        _15164, 
+        /**
+         * Puget Sound Salish
+         */
+        _15180, 
+        /**
+         * Duwamish
+         */
+        _15198, 
+        /**
+         * Kikiallus
+         */
+        _15206, 
+        /**
+         * Lower Skagit
+         */
+        _15214, 
+        /**
+         * Muckleshoot
+         */
+        _15222, 
+        /**
+         * Nisqually
+         */
+        _15230, 
+        /**
+         * Nooksack
+         */
+        _15248, 
+        /**
+         * Port Madison
+         */
+        _15255, 
+        /**
+         * Puyallup
+         */
+        _15263, 
+        /**
+         * Samish
+         */
+        _15271, 
+        /**
+         * Sauk-Suiattle
+         */
+        _15289, 
+        /**
+         * Skokomish
+         */
+        _15297, 
+        /**
+         * Skykomish
+         */
+        _15305, 
+        /**
+         * Snohomish
+         */
+        _15313, 
+        /**
+         * Snoqualmie
+         */
+        _15321, 
+        /**
+         * Squaxin Island
+         */
+        _15339, 
+        /**
+         * Steilacoom
+         */
+        _15347, 
+        /**
+         * Stillaguamish
+         */
+        _15354, 
+        /**
+         * Suquamish
+         */
+        _15362, 
+        /**
+         * Swinomish
+         */
+        _15370, 
+        /**
+         * Tulalip
+         */
+        _15388, 
+        /**
+         * Upper Skagit
+         */
+        _15396, 
+        /**
+         * Quapaw
+         */
+        _15412, 
+        /**
+         * Quinault
+         */
+        _15438, 
+        /**
+         * Rappahannock
+         */
+        _15453, 
+        /**
+         * Reno-Sparks
+         */
+        _15479, 
+        /**
+         * Round Valley
+         */
+        _15495, 
+        /**
+         * Sac and Fox
+         */
+        _15511, 
+        /**
+         * Iowa Sac and Fox
+         */
+        _15529, 
+        /**
+         * Missouri Sac and Fox
+         */
+        _15537, 
+        /**
+         * Oklahoma Sac and Fox
+         */
+        _15545, 
+        /**
+         * Salinan
+         */
+        _15560, 
+        /**
+         * Salish
+         */
+        _15586, 
+        /**
+         * Salish and Kootenai
+         */
+        _15602, 
+        /**
+         * Schaghticoke
+         */
+        _15628, 
+        /**
+         * Scott Valley
+         */
+        _15644, 
+        /**
+         * Seminole
+         */
+        _15669, 
+        /**
+         * Big Cypress
+         */
+        _15677, 
+        /**
+         * Brighton
+         */
+        _15685, 
+        /**
+         * Florida Seminole
+         */
+        _15693, 
+        /**
+         * Hollywood Seminole
+         */
+        _15701, 
+        /**
+         * Oklahoma Seminole
+         */
+        _15719, 
+        /**
+         * Serrano
+         */
+        _15735, 
+        /**
+         * San Manual
+         */
+        _15743, 
+        /**
+         * Shasta
+         */
+        _15768, 
+        /**
+         * Shawnee
+         */
+        _15784, 
+        /**
+         * Absentee Shawnee
+         */
+        _15792, 
+        /**
+         * Eastern Shawnee
+         */
+        _15800, 
+        /**
+         * Shinnecock
+         */
+        _15826, 
+        /**
+         * Shoalwater Bay
+         */
+        _15842, 
+        /**
+         * Shoshone
+         */
+        _15867, 
+        /**
+         * Battle Mountain
+         */
+        _15875, 
+        /**
+         * Duckwater
+         */
+        _15883, 
+        /**
+         * Elko
+         */
+        _15891, 
+        /**
+         * Ely
+         */
+        _15909, 
+        /**
+         * Goshute
+         */
+        _15917, 
+        /**
+         * Panamint
+         */
+        _15925, 
+        /**
+         * Ruby Valley
+         */
+        _15933, 
+        /**
+         * Skull Valley
+         */
+        _15941, 
+        /**
+         * South Fork Shoshone
+         */
+        _15958, 
+        /**
+         * Te-Moak Western Shoshone
+         */
+        _15966, 
+        /**
+         * Timbi-Sha Shoshone
+         */
+        _15974, 
+        /**
+         * Washakie
+         */
+        _15982, 
+        /**
+         * Wind River Shoshone
+         */
+        _15990, 
+        /**
+         * Yomba
+         */
+        _16006, 
+        /**
+         * Shoshone Paiute
+         */
+        _16022, 
+        /**
+         * Duck Valley
+         */
+        _16030, 
+        /**
+         * Fallon
+         */
+        _16048, 
+        /**
+         * Fort McDermitt
+         */
+        _16055, 
+        /**
+         * Siletz
+         */
+        _16071, 
+        /**
+         * Sioux
+         */
+        _16097, 
+        /**
+         * Blackfoot Sioux
+         */
+        _16105, 
+        /**
+         * Brule Sioux
+         */
+        _16113, 
+        /**
+         * Cheyenne River Sioux
+         */
+        _16121, 
+        /**
+         * Crow Creek Sioux
+         */
+        _16139, 
+        /**
+         * Dakota Sioux
+         */
+        _16147, 
+        /**
+         * Flandreau Santee
+         */
+        _16154, 
+        /**
+         * Fort Peck
+         */
+        _16162, 
+        /**
+         * Lake Traverse Sioux
+         */
+        _16170, 
+        /**
+         * Lower Brule Sioux
+         */
+        _16188, 
+        /**
+         * Lower Sioux
+         */
+        _16196, 
+        /**
+         * Mdewakanton Sioux
+         */
+        _16204, 
+        /**
+         * Miniconjou
+         */
+        _16212, 
+        /**
+         * Oglala Sioux
+         */
+        _16220, 
+        /**
+         * Pine Ridge Sioux
+         */
+        _16238, 
+        /**
+         * Pipestone Sioux
+         */
+        _16246, 
+        /**
+         * Prairie Island Sioux
+         */
+        _16253, 
+        /**
+         * Prior Lake Sioux
+         */
+        _16261, 
+        /**
+         * Rosebud Sioux
+         */
+        _16279, 
+        /**
+         * Sans Arc Sioux
+         */
+        _16287, 
+        /**
+         * Santee Sioux
+         */
+        _16295, 
+        /**
+         * Sisseton-Wahpeton
+         */
+        _16303, 
+        /**
+         * Sisseton Sioux
+         */
+        _16311, 
+        /**
+         * Spirit Lake Sioux
+         */
+        _16329, 
+        /**
+         * Standing Rock Sioux
+         */
+        _16337, 
+        /**
+         * Teton Sioux
+         */
+        _16345, 
+        /**
+         * Two Kettle Sioux
+         */
+        _16352, 
+        /**
+         * Upper Sioux
+         */
+        _16360, 
+        /**
+         * Wahpekute Sioux
+         */
+        _16378, 
+        /**
+         * Wahpeton Sioux
+         */
+        _16386, 
+        /**
+         * Wazhaza Sioux
+         */
+        _16394, 
+        /**
+         * Yankton Sioux
+         */
+        _16402, 
+        /**
+         * Yanktonai Sioux
+         */
+        _16410, 
+        /**
+         * Siuslaw
+         */
+        _16436, 
+        /**
+         * Spokane
+         */
+        _16451, 
+        /**
+         * Stewart
+         */
+        _16477, 
+        /**
+         * Stockbridge
+         */
+        _16493, 
+        /**
+         * Susanville
+         */
+        _16519, 
+        /**
+         * Tohono O'Odham
+         */
+        _16535, 
+        /**
+         * Ak-Chin
+         */
+        _16543, 
+        /**
+         * Gila Bend
+         */
+        _16550, 
+        /**
+         * San Xavier
+         */
+        _16568, 
+        /**
+         * Sells
+         */
+        _16576, 
+        /**
+         * Tolowa
+         */
+        _16592, 
+        /**
+         * Tonkawa
+         */
+        _16618, 
+        /**
+         * Tygh
+         */
+        _16634, 
+        /**
+         * Umatilla
+         */
+        _16659, 
+        /**
+         * Umpqua
+         */
+        _16675, 
+        /**
+         * Cow Creek Umpqua
+         */
+        _16683, 
+        /**
+         * Ute
+         */
+        _16709, 
+        /**
+         * Allen Canyon
+         */
+        _16717, 
+        /**
+         * Uintah Ute
+         */
+        _16725, 
+        /**
+         * Ute Mountain Ute
+         */
+        _16733, 
+        /**
+         * Wailaki
+         */
+        _16758, 
+        /**
+         * Walla-Walla
+         */
+        _16774, 
+        /**
+         * Wampanoag
+         */
+        _16790, 
+        /**
+         * Gay Head Wampanoag
+         */
+        _16808, 
+        /**
+         * Mashpee Wampanoag
+         */
+        _16816, 
+        /**
+         * Warm Springs
+         */
+        _16832, 
+        /**
+         * Wascopum
+         */
+        _16857, 
+        /**
+         * Washoe
+         */
+        _16873, 
+        /**
+         * Alpine
+         */
+        _16881, 
+        /**
+         * Carson
+         */
+        _16899, 
+        /**
+         * Dresslerville
+         */
+        _16907, 
+        /**
+         * Wichita
+         */
+        _16923, 
+        /**
+         * Wind River
+         */
+        _16949, 
+        /**
+         * Winnebago
+         */
+        _16964, 
+        /**
+         * Ho-chunk
+         */
+        _16972, 
+        /**
+         * Nebraska Winnebago
+         */
+        _16980, 
+        /**
+         * Winnemucca
+         */
+        _17004, 
+        /**
+         * Wintun
+         */
+        _17020, 
+        /**
+         * Wiyot
+         */
+        _17046, 
+        /**
+         * Table Bluff
+         */
+        _17053, 
+        /**
+         * Yakama
+         */
+        _17079, 
+        /**
+         * Yakama Cowlitz
+         */
+        _17095, 
+        /**
+         * Yaqui
+         */
+        _17111, 
+        /**
+         * Barrio Libre
+         */
+        _17129, 
+        /**
+         * Pascua Yaqui
+         */
+        _17137, 
+        /**
+         * Yavapai Apache
+         */
+        _17152, 
+        /**
+         * Yokuts
+         */
+        _17178, 
+        /**
+         * Chukchansi
+         */
+        _17186, 
+        /**
+         * Tachi
+         */
+        _17194, 
+        /**
+         * Tule River
+         */
+        _17202, 
+        /**
+         * Yuchi
+         */
+        _17228, 
+        /**
+         * Yuman
+         */
+        _17244, 
+        /**
+         * Cocopah
+         */
+        _17251, 
+        /**
+         * Havasupai
+         */
+        _17269, 
+        /**
+         * Hualapai
+         */
+        _17277, 
+        /**
+         * Maricopa
+         */
+        _17285, 
+        /**
+         * Mohave
+         */
+        _17293, 
+        /**
+         * Quechan
+         */
+        _17301, 
+        /**
+         * Yavapai
+         */
+        _17319, 
+        /**
+         * Yurok
+         */
+        _17327, 
+        /**
+         * Coast Yurok
+         */
+        _17335, 
+        /**
+         * Alaska Native
+         */
+        _17350, 
+        /**
+         * Alaska Indian
+         */
+        _17376, 
+        /**
+         * Alaskan Athabascan
+         */
+        _17392, 
+        /**
+         * Ahtna
+         */
+        _17400, 
+        /**
+         * Southeast Alaska
+         */
+        _18119, 
+        /**
+         * Tlingit-Haida
+         */
+        _18135, 
+        /**
+         * Angoon
+         */
+        _18143, 
+        /**
+         * Central Council of Tlingit and Haida Tribes
+         */
+        _18150, 
+        /**
+         * Chilkat
+         */
+        _18168, 
+        /**
+         * Chilkoot
+         */
+        _18176, 
+        /**
+         * Craig
+         */
+        _18184, 
+        /**
+         * Douglas
+         */
+        _18192, 
+        /**
+         * Haida
+         */
+        _18200, 
+        /**
+         * Hoonah
+         */
+        _18218, 
+        /**
+         * Hydaburg
+         */
+        _18226, 
+        /**
+         * Kake
+         */
+        _18234, 
+        /**
+         * Kasaan
+         */
+        _18242, 
+        /**
+         * Kenaitze
+         */
+        _18259, 
+        /**
+         * Ketchikan
+         */
+        _18267, 
+        /**
+         * Klawock
+         */
+        _18275, 
+        /**
+         * Pelican
+         */
+        _18283, 
+        /**
+         * Petersburg
+         */
+        _18291, 
+        /**
+         * Saxman
+         */
+        _18309, 
+        /**
+         * Sitka
+         */
+        _18317, 
+        /**
+         * Tenakee Springs
+         */
+        _18325, 
+        /**
+         * Tlingit
+         */
+        _18333, 
+        /**
+         * Wrangell
+         */
+        _18341, 
+        /**
+         * Yakutat
+         */
+        _18358, 
+        /**
+         * Tsimshian
+         */
+        _18374, 
+        /**
+         * Metlakatla
+         */
+        _18382, 
+        /**
+         * Eskimo
+         */
+        _18408, 
+        /**
+         * Greenland Eskimo
+         */
+        _18424, 
+        /**
+         * Inupiat Eskimo
+         */
+        _18440, 
+        /**
+         * Ambler
+         */
+        _18457, 
+        /**
+         * Anaktuvuk
+         */
+        _18465, 
+        /**
+         * Anaktuvuk Pass
+         */
+        _18473, 
+        /**
+         * Arctic Slope Inupiat
+         */
+        _18481, 
+        /**
+         * Arctic Slope Corporation
+         */
+        _18499, 
+        /**
+         * Atqasuk
+         */
+        _18507, 
+        /**
+         * Barrow
+         */
+        _18515, 
+        /**
+         * Bering Straits Inupiat
+         */
+        _18523, 
+        /**
+         * Brevig Mission
+         */
+        _18531, 
+        /**
+         * Buckland
+         */
+        _18549, 
+        /**
+         * Chinik
+         */
+        _18556, 
+        /**
+         * Council
+         */
+        _18564, 
+        /**
+         * Deering
+         */
+        _18572, 
+        /**
+         * Elim
+         */
+        _18580, 
+        /**
+         * Golovin
+         */
+        _18598, 
+        /**
+         * Inalik Diomede
+         */
+        _18606, 
+        /**
+         * Inupiaq
+         */
+        _18614, 
+        /**
+         * Kaktovik
+         */
+        _18622, 
+        /**
+         * Kawerak
+         */
+        _18630, 
+        /**
+         * Kiana
+         */
+        _18648, 
+        /**
+         * Kivalina
+         */
+        _18655, 
+        /**
+         * Kobuk
+         */
+        _18663, 
+        /**
+         * Kotzebue
+         */
+        _18671, 
+        /**
+         * Koyuk
+         */
+        _18689, 
+        /**
+         * Kwiguk
+         */
+        _18697, 
+        /**
+         * Mauneluk Inupiat
+         */
+        _18705, 
+        /**
+         * Nana Inupiat
+         */
+        _18713, 
+        /**
+         * Noatak
+         */
+        _18721, 
+        /**
+         * Nome
+         */
+        _18739, 
+        /**
+         * Noorvik
+         */
+        _18747, 
+        /**
+         * Nuiqsut
+         */
+        _18754, 
+        /**
+         * Point Hope
+         */
+        _18762, 
+        /**
+         * Point Lay
+         */
+        _18770, 
+        /**
+         * Selawik
+         */
+        _18788, 
+        /**
+         * Shaktoolik
+         */
+        _18796, 
+        /**
+         * Shishmaref
+         */
+        _18804, 
+        /**
+         * Shungnak
+         */
+        _18812, 
+        /**
+         * Solomon
+         */
+        _18820, 
+        /**
+         * Teller
+         */
+        _18838, 
+        /**
+         * Unalakleet
+         */
+        _18846, 
+        /**
+         * Wainwright
+         */
+        _18853, 
+        /**
+         * Wales
+         */
+        _18861, 
+        /**
+         * White Mountain
+         */
+        _18879, 
+        /**
+         * White Mountain Inupiat
+         */
+        _18887, 
+        /**
+         * Mary's Igloo
+         */
+        _18895, 
+        /**
+         * Siberian Eskimo
+         */
+        _18911, 
+        /**
+         * Gambell
+         */
+        _18929, 
+        /**
+         * Savoonga
+         */
+        _18937, 
+        /**
+         * Siberian Yupik
+         */
+        _18945, 
+        /**
+         * Yupik Eskimo
+         */
+        _18960, 
+        /**
+         * Akiachak
+         */
+        _18978, 
+        /**
+         * Akiak
+         */
+        _18986, 
+        /**
+         * Alakanuk
+         */
+        _18994, 
+        /**
+         * Aleknagik
+         */
+        _19000, 
+        /**
+         * Andreafsky
+         */
+        _19018, 
+        /**
+         * Aniak
+         */
+        _19026, 
+        /**
+         * Atmautluak
+         */
+        _19034, 
+        /**
+         * Bethel
+         */
+        _19042, 
+        /**
+         * Bill Moore's Slough
+         */
+        _19059, 
+        /**
+         * Bristol Bay Yupik
+         */
+        _19067, 
+        /**
+         * Calista Yupik
+         */
+        _19075, 
+        /**
+         * Chefornak
+         */
+        _19083, 
+        /**
+         * Chevak
+         */
+        _19091, 
+        /**
+         * Chuathbaluk
+         */
+        _19109, 
+        /**
+         * Clark's Point
+         */
+        _19117, 
+        /**
+         * Crooked Creek
+         */
+        _19125, 
+        /**
+         * Dillingham
+         */
+        _19133, 
+        /**
+         * Eek
+         */
+        _19141, 
+        /**
+         * Ekuk
+         */
+        _19158, 
+        /**
+         * Ekwok
+         */
+        _19166, 
+        /**
+         * Emmonak
+         */
+        _19174, 
+        /**
+         * Goodnews Bay
+         */
+        _19182, 
+        /**
+         * Hooper Bay
+         */
+        _19190, 
+        /**
+         * Iqurmuit (Russian Mission)
+         */
+        _19208, 
+        /**
+         * Kalskag
+         */
+        _19216, 
+        /**
+         * Kasigluk
+         */
+        _19224, 
+        /**
+         * Kipnuk
+         */
+        _19232, 
+        /**
+         * Koliganek
+         */
+        _19240, 
+        /**
+         * Kongiganak
+         */
+        _19257, 
+        /**
+         * Kotlik
+         */
+        _19265, 
+        /**
+         * Kwethluk
+         */
+        _19273, 
+        /**
+         * Kwigillingok
+         */
+        _19281, 
+        /**
+         * Levelock
+         */
+        _19299, 
+        /**
+         * Lower Kalskag
+         */
+        _19307, 
+        /**
+         * Manokotak
+         */
+        _19315, 
+        /**
+         * Marshall
+         */
+        _19323, 
+        /**
+         * Mekoryuk
+         */
+        _19331, 
+        /**
+         * Mountain Village
+         */
+        _19349, 
+        /**
+         * Naknek
+         */
+        _19356, 
+        /**
+         * Napaumute
+         */
+        _19364, 
+        /**
+         * Napakiak
+         */
+        _19372, 
+        /**
+         * Napaskiak
+         */
+        _19380, 
+        /**
+         * Newhalen
+         */
+        _19398, 
+        /**
+         * New Stuyahok
+         */
+        _19406, 
+        /**
+         * Newtok
+         */
+        _19414, 
+        /**
+         * Nightmute
+         */
+        _19422, 
+        /**
+         * Nunapitchukv
+         */
+        _19430, 
+        /**
+         * Oscarville
+         */
+        _19448, 
+        /**
+         * Pilot Station
+         */
+        _19455, 
+        /**
+         * Pitkas Point
+         */
+        _19463, 
+        /**
+         * Platinum
+         */
+        _19471, 
+        /**
+         * Portage Creek
+         */
+        _19489, 
+        /**
+         * Quinhagak
+         */
+        _19497, 
+        /**
+         * Red Devil
+         */
+        _19505, 
+        /**
+         * St. Michael
+         */
+        _19513, 
+        /**
+         * Scammon Bay
+         */
+        _19521, 
+        /**
+         * Sheldon's Point
+         */
+        _19539, 
+        /**
+         * Sleetmute
+         */
+        _19547, 
+        /**
+         * Stebbins
+         */
+        _19554, 
+        /**
+         * Togiak
+         */
+        _19562, 
+        /**
+         * Toksook
+         */
+        _19570, 
+        /**
+         * Tulukskak
+         */
+        _19588, 
+        /**
+         * Tuntutuliak
+         */
+        _19596, 
+        /**
+         * Tununak
+         */
+        _19604, 
+        /**
+         * Twin Hills
+         */
+        _19612, 
+        /**
+         * Georgetown
+         */
+        _19620, 
+        /**
+         * St. Mary's
+         */
+        _19638, 
+        /**
+         * Umkumiate
+         */
+        _19646, 
+        /**
+         * Aleut
+         */
+        _19661, 
+        /**
+         * Alutiiq Aleut
+         */
+        _19687, 
+        /**
+         * Tatitlek
+         */
+        _19695, 
+        /**
+         * Ugashik
+         */
+        _19703, 
+        /**
+         * Bristol Bay Aleut
+         */
+        _19729, 
+        /**
+         * Chignik
+         */
+        _19737, 
+        /**
+         * Chignik Lake
+         */
+        _19745, 
+        /**
+         * Egegik
+         */
+        _19752, 
+        /**
+         * Igiugig
+         */
+        _19760, 
+        /**
+         * Ivanof Bay
+         */
+        _19778, 
+        /**
+         * King Salmon
+         */
+        _19786, 
+        /**
+         * Kokhanok
+         */
+        _19794, 
+        /**
+         * Perryville
+         */
+        _19802, 
+        /**
+         * Pilot Point
+         */
+        _19810, 
+        /**
+         * Port Heiden
+         */
+        _19828, 
+        /**
+         * Chugach Aleut
+         */
+        _19844, 
+        /**
+         * Chenega
+         */
+        _19851, 
+        /**
+         * Chugach Corporation
+         */
+        _19869, 
+        /**
+         * English Bay
+         */
+        _19877, 
+        /**
+         * Port Graham
+         */
+        _19885, 
+        /**
+         * Eyak
+         */
+        _19901, 
+        /**
+         * Koniag Aleut
+         */
+        _19927, 
+        /**
+         * Akhiok
+         */
+        _19935, 
+        /**
+         * Agdaagux
+         */
+        _19943, 
+        /**
+         * Karluk
+         */
+        _19950, 
+        /**
+         * Kodiak
+         */
+        _19968, 
+        /**
+         * Larsen Bay
+         */
+        _19976, 
+        /**
+         * Old Harbor
+         */
+        _19984, 
+        /**
+         * Ouzinkie
+         */
+        _19992, 
+        /**
+         * Port Lions
+         */
+        _20008, 
+        /**
+         * Sugpiaq
+         */
+        _20024, 
+        /**
+         * Suqpigaq
+         */
+        _20040, 
+        /**
+         * Unangan Aleut
+         */
+        _20065, 
+        /**
+         * Akutan
+         */
+        _20073, 
+        /**
+         * Aleut Corporation
+         */
+        _20081, 
+        /**
+         * Aleutian
+         */
+        _20099, 
+        /**
+         * Aleutian Islander
+         */
+        _20107, 
+        /**
+         * Atka
+         */
+        _20115, 
+        /**
+         * Belkofski
+         */
+        _20123, 
+        /**
+         * Chignik Lagoon
+         */
+        _20131, 
+        /**
+         * King Cove
+         */
+        _20149, 
+        /**
+         * False Pass
+         */
+        _20156, 
+        /**
+         * Nelson Lagoon
+         */
+        _20164, 
+        /**
+         * Nikolski
+         */
+        _20172, 
+        /**
+         * Pauloff Harbor
+         */
+        _20180, 
+        /**
+         * Qagan Toyagungin
+         */
+        _20198, 
+        /**
+         * Qawalangin
+         */
+        _20206, 
+        /**
+         * St. George
+         */
+        _20214, 
+        /**
+         * St. Paul
+         */
+        _20222, 
+        /**
+         * Sand Point
+         */
+        _20230, 
+        /**
+         * South Naknek
+         */
+        _20248, 
+        /**
+         * Unalaska
+         */
+        _20255, 
+        /**
+         * Unga
+         */
+        _20263, 
+        /**
+         * Asian
+         */
+        _20289, 
+        /**
+         * Asian Indian
+         */
+        _20297, 
+        /**
+         * Bangladeshi
+         */
+        _20305, 
+        /**
+         * Bhutanese
+         */
+        _20313, 
+        /**
+         * Burmese
+         */
+        _20321, 
+        /**
+         * Cambodian
+         */
+        _20339, 
+        /**
+         * Chinese
+         */
+        _20347, 
+        /**
+         * Taiwanese
+         */
+        _20354, 
+        /**
+         * Filipino
+         */
+        _20362, 
+        /**
+         * Hmong
+         */
+        _20370, 
+        /**
+         * Indonesian
+         */
+        _20388, 
+        /**
+         * Japanese
+         */
+        _20396, 
+        /**
+         * Korean
+         */
+        _20404, 
+        /**
+         * Laotian
+         */
+        _20412, 
+        /**
+         * Malaysian
+         */
+        _20420, 
+        /**
+         * Okinawan
+         */
+        _20438, 
+        /**
+         * Pakistani
+         */
+        _20446, 
+        /**
+         * Sri Lankan
+         */
+        _20453, 
+        /**
+         * Thai
+         */
+        _20461, 
+        /**
+         * Vietnamese
+         */
+        _20479, 
+        /**
+         * Iwo Jiman
+         */
+        _20487, 
+        /**
+         * Maldivian
+         */
+        _20495, 
+        /**
+         * Nepalese
+         */
+        _20503, 
+        /**
+         * Singaporean
+         */
+        _20511, 
+        /**
+         * Madagascar
+         */
+        _20529, 
+        /**
+         * Black or African American
+         */
+        _20545, 
+        /**
+         * Black
+         */
+        _20560, 
+        /**
+         * African American
+         */
+        _20586, 
+        /**
+         * African
+         */
+        _20602, 
+        /**
+         * Botswanan
+         */
+        _20610, 
+        /**
+         * Ethiopian
+         */
+        _20628, 
+        /**
+         * Liberian
+         */
+        _20636, 
+        /**
+         * Namibian
+         */
+        _20644, 
+        /**
+         * Nigerian
+         */
+        _20651, 
+        /**
+         * Zairean
+         */
+        _20669, 
+        /**
+         * Bahamian
+         */
+        _20677, 
+        /**
+         * Barbadian
+         */
+        _20685, 
+        /**
+         * Dominican
+         */
+        _20693, 
+        /**
+         * Dominica Islander
+         */
+        _20701, 
+        /**
+         * Haitian
+         */
+        _20719, 
+        /**
+         * Jamaican
+         */
+        _20727, 
+        /**
+         * Tobagoan
+         */
+        _20735, 
+        /**
+         * Trinidadian
+         */
+        _20743, 
+        /**
+         * West Indian
+         */
+        _20750, 
+        /**
+         * Native Hawaiian or Other Pacific Islander
+         */
+        _20768, 
+        /**
+         * Polynesian
+         */
+        _20784, 
+        /**
+         * Native Hawaiian
+         */
+        _20792, 
+        /**
+         * Samoan
+         */
+        _20800, 
+        /**
+         * Tahitian
+         */
+        _20818, 
+        /**
+         * Tongan
+         */
+        _20826, 
+        /**
+         * Tokelauan
+         */
+        _20834, 
+        /**
+         * Micronesian
+         */
+        _20859, 
+        /**
+         * Guamanian or Chamorro
+         */
+        _20867, 
+        /**
+         * Guamanian
+         */
+        _20875, 
+        /**
+         * Chamorro
+         */
+        _20883, 
+        /**
+         * Mariana Islander
+         */
+        _20891, 
+        /**
+         * Marshallese
+         */
+        _20909, 
+        /**
+         * Palauan
+         */
+        _20917, 
+        /**
+         * Carolinian
+         */
+        _20925, 
+        /**
+         * Kosraean
+         */
+        _20933, 
+        /**
+         * Pohnpeian
+         */
+        _20941, 
+        /**
+         * Saipanese
+         */
+        _20958, 
+        /**
+         * Kiribati
+         */
+        _20966, 
+        /**
+         * Chuukese
+         */
+        _20974, 
+        /**
+         * Yapese
+         */
+        _20982, 
+        /**
+         * Melanesian
+         */
+        _21006, 
+        /**
+         * Fijian
+         */
+        _21014, 
+        /**
+         * Papua New Guinean
+         */
+        _21022, 
+        /**
+         * Solomon Islander
+         */
+        _21030, 
+        /**
+         * New Hebrides
+         */
+        _21048, 
+        /**
+         * Note that this term remains in the table for completeness, even though within HL7, the notion of Other code is deprecated.
+         */
+        _25007, 
+        /**
+         * White
+         */
+        _21063, 
+        /**
+         * European
+         */
+        _21089, 
+        /**
+         * Armenian
+         */
+        _21097, 
+        /**
+         * English
+         */
+        _21105, 
+        /**
+         * French
+         */
+        _21113, 
+        /**
+         * German
+         */
+        _21121, 
+        /**
+         * Irish
+         */
+        _21139, 
+        /**
+         * Italian
+         */
+        _21147, 
+        /**
+         * Polish
+         */
+        _21154, 
+        /**
+         * Scottish
+         */
+        _21162, 
+        /**
+         * Middle Eastern or North African
+         */
+        _21188, 
+        /**
+         * Assyrian
+         */
+        _21196, 
+        /**
+         * Egyptian
+         */
+        _21204, 
+        /**
+         * Iranian
+         */
+        _21212, 
+        /**
+         * Iraqi
+         */
+        _21220, 
+        /**
+         * Lebanese
+         */
+        _21238, 
+        /**
+         * Palestinian
+         */
+        _21246, 
+        /**
+         * Syrian
+         */
+        _21253, 
+        /**
+         * Afghanistani
+         */
+        _21261, 
+        /**
+         * Israeili
+         */
+        _21279, 
+        /**
+         * Arab
+         */
+        _21295, 
+        /**
+         * Note that this term remains in the table for completeness, even though within HL7, the notion of Other code is deprecated.
+         */
+        _21311, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3Race fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1002-5".equals(codeString))
+          return _10025;
+        if ("1004-1".equals(codeString))
+          return _10041;
+        if ("1006-6".equals(codeString))
+          return _10066;
+        if ("1008-2".equals(codeString))
+          return _10082;
+        if ("1010-8".equals(codeString))
+          return _10108;
+        if ("1011-6".equals(codeString))
+          return _10116;
+        if ("1012-4".equals(codeString))
+          return _10124;
+        if ("1013-2".equals(codeString))
+          return _10132;
+        if ("1014-0".equals(codeString))
+          return _10140;
+        if ("1015-7".equals(codeString))
+          return _10157;
+        if ("1016-5".equals(codeString))
+          return _10165;
+        if ("1017-3".equals(codeString))
+          return _10173;
+        if ("1018-1".equals(codeString))
+          return _10181;
+        if ("1019-9".equals(codeString))
+          return _10199;
+        if ("1021-5".equals(codeString))
+          return _10215;
+        if ("1022-3".equals(codeString))
+          return _10223;
+        if ("1023-1".equals(codeString))
+          return _10231;
+        if ("1024-9".equals(codeString))
+          return _10249;
+        if ("1026-4".equals(codeString))
+          return _10264;
+        if ("1028-0".equals(codeString))
+          return _10280;
+        if ("1030-6".equals(codeString))
+          return _10306;
+        if ("1031-4".equals(codeString))
+          return _10314;
+        if ("1033-0".equals(codeString))
+          return _10330;
+        if ("1035-5".equals(codeString))
+          return _10355;
+        if ("1037-1".equals(codeString))
+          return _10371;
+        if ("1039-7".equals(codeString))
+          return _10397;
+        if ("1041-3".equals(codeString))
+          return _10413;
+        if ("1042-1".equals(codeString))
+          return _10421;
+        if ("1044-7".equals(codeString))
+          return _10447;
+        if ("1045-4".equals(codeString))
+          return _10454;
+        if ("1046-2".equals(codeString))
+          return _10462;
+        if ("1047-0".equals(codeString))
+          return _10470;
+        if ("1048-8".equals(codeString))
+          return _10488;
+        if ("1049-6".equals(codeString))
+          return _10496;
+        if ("1050-4".equals(codeString))
+          return _10504;
+        if ("1051-2".equals(codeString))
+          return _10512;
+        if ("1053-8".equals(codeString))
+          return _10538;
+        if ("1054-6".equals(codeString))
+          return _10546;
+        if ("1055-3".equals(codeString))
+          return _10553;
+        if ("1056-1".equals(codeString))
+          return _10561;
+        if ("1057-9".equals(codeString))
+          return _10579;
+        if ("1058-7".equals(codeString))
+          return _10587;
+        if ("1059-5".equals(codeString))
+          return _10595;
+        if ("1060-3".equals(codeString))
+          return _10603;
+        if ("1061-1".equals(codeString))
+          return _10611;
+        if ("1062-9".equals(codeString))
+          return _10629;
+        if ("1063-7".equals(codeString))
+          return _10637;
+        if ("1064-5".equals(codeString))
+          return _10645;
+        if ("1065-2".equals(codeString))
+          return _10652;
+        if ("1066-0".equals(codeString))
+          return _10660;
+        if ("1068-6".equals(codeString))
+          return _10686;
+        if ("1069-4".equals(codeString))
+          return _10694;
+        if ("1070-2".equals(codeString))
+          return _10702;
+        if ("1071-0".equals(codeString))
+          return _10710;
+        if ("1072-8".equals(codeString))
+          return _10728;
+        if ("1073-6".equals(codeString))
+          return _10736;
+        if ("1074-4".equals(codeString))
+          return _10744;
+        if ("1076-9".equals(codeString))
+          return _10769;
+        if ("1741-8".equals(codeString))
+          return _17418;
+        if ("1742-6".equals(codeString))
+          return _17426;
+        if ("1743-4".equals(codeString))
+          return _17434;
+        if ("1744-2".equals(codeString))
+          return _17442;
+        if ("1745-9".equals(codeString))
+          return _17459;
+        if ("1746-7".equals(codeString))
+          return _17467;
+        if ("1747-5".equals(codeString))
+          return _17475;
+        if ("1748-3".equals(codeString))
+          return _17483;
+        if ("1749-1".equals(codeString))
+          return _17491;
+        if ("1750-9".equals(codeString))
+          return _17509;
+        if ("1751-7".equals(codeString))
+          return _17517;
+        if ("1752-5".equals(codeString))
+          return _17525;
+        if ("1753-3".equals(codeString))
+          return _17533;
+        if ("1754-1".equals(codeString))
+          return _17541;
+        if ("1755-8".equals(codeString))
+          return _17558;
+        if ("1756-6".equals(codeString))
+          return _17566;
+        if ("1757-4".equals(codeString))
+          return _17574;
+        if ("1758-2".equals(codeString))
+          return _17582;
+        if ("1759-0".equals(codeString))
+          return _17590;
+        if ("1760-8".equals(codeString))
+          return _17608;
+        if ("1761-6".equals(codeString))
+          return _17616;
+        if ("1762-4".equals(codeString))
+          return _17624;
+        if ("1763-2".equals(codeString))
+          return _17632;
+        if ("1764-0".equals(codeString))
+          return _17640;
+        if ("1765-7".equals(codeString))
+          return _17657;
+        if ("1766-5".equals(codeString))
+          return _17665;
+        if ("1767-3".equals(codeString))
+          return _17673;
+        if ("1768-1".equals(codeString))
+          return _17681;
+        if ("1769-9".equals(codeString))
+          return _17699;
+        if ("1770-7".equals(codeString))
+          return _17707;
+        if ("1771-5".equals(codeString))
+          return _17715;
+        if ("1772-3".equals(codeString))
+          return _17723;
+        if ("1773-1".equals(codeString))
+          return _17731;
+        if ("1774-9".equals(codeString))
+          return _17749;
+        if ("1775-6".equals(codeString))
+          return _17756;
+        if ("1776-4".equals(codeString))
+          return _17764;
+        if ("1777-2".equals(codeString))
+          return _17772;
+        if ("1778-0".equals(codeString))
+          return _17780;
+        if ("1779-8".equals(codeString))
+          return _17798;
+        if ("1780-6".equals(codeString))
+          return _17806;
+        if ("1781-4".equals(codeString))
+          return _17814;
+        if ("1782-2".equals(codeString))
+          return _17822;
+        if ("1783-0".equals(codeString))
+          return _17830;
+        if ("1784-8".equals(codeString))
+          return _17848;
+        if ("1785-5".equals(codeString))
+          return _17855;
+        if ("1786-3".equals(codeString))
+          return _17863;
+        if ("1787-1".equals(codeString))
+          return _17871;
+        if ("1788-9".equals(codeString))
+          return _17889;
+        if ("1789-7".equals(codeString))
+          return _17897;
+        if ("1790-5".equals(codeString))
+          return _17905;
+        if ("1791-3".equals(codeString))
+          return _17913;
+        if ("1792-1".equals(codeString))
+          return _17921;
+        if ("1793-9".equals(codeString))
+          return _17939;
+        if ("1794-7".equals(codeString))
+          return _17947;
+        if ("1795-4".equals(codeString))
+          return _17954;
+        if ("1796-2".equals(codeString))
+          return _17962;
+        if ("1797-0".equals(codeString))
+          return _17970;
+        if ("1798-8".equals(codeString))
+          return _17988;
+        if ("1799-6".equals(codeString))
+          return _17996;
+        if ("1800-2".equals(codeString))
+          return _18002;
+        if ("1801-0".equals(codeString))
+          return _18010;
+        if ("1802-8".equals(codeString))
+          return _18028;
+        if ("1803-6".equals(codeString))
+          return _18036;
+        if ("1804-4".equals(codeString))
+          return _18044;
+        if ("1805-1".equals(codeString))
+          return _18051;
+        if ("1806-9".equals(codeString))
+          return _18069;
+        if ("1807-7".equals(codeString))
+          return _18077;
+        if ("1808-5".equals(codeString))
+          return _18085;
+        if ("1809-3".equals(codeString))
+          return _18093;
+        if ("1078-5".equals(codeString))
+          return _10785;
+        if ("1080-1".equals(codeString))
+          return _10801;
+        if ("1082-7".equals(codeString))
+          return _10827;
+        if ("1083-5".equals(codeString))
+          return _10835;
+        if ("1084-3".equals(codeString))
+          return _10843;
+        if ("1086-8".equals(codeString))
+          return _10868;
+        if ("1088-4".equals(codeString))
+          return _10884;
+        if ("1089-2".equals(codeString))
+          return _10892;
+        if ("1090-0".equals(codeString))
+          return _10900;
+        if ("1091-8".equals(codeString))
+          return _10918;
+        if ("1092-6".equals(codeString))
+          return _10926;
+        if ("1093-4".equals(codeString))
+          return _10934;
+        if ("1094-2".equals(codeString))
+          return _10942;
+        if ("1095-9".equals(codeString))
+          return _10959;
+        if ("1096-7".equals(codeString))
+          return _10967;
+        if ("1097-5".equals(codeString))
+          return _10975;
+        if ("1098-3".equals(codeString))
+          return _10983;
+        if ("1100-7".equals(codeString))
+          return _11007;
+        if ("1102-3".equals(codeString))
+          return _11023;
+        if ("1103-1".equals(codeString))
+          return _11031;
+        if ("1104-9".equals(codeString))
+          return _11049;
+        if ("1106-4".equals(codeString))
+          return _11064;
+        if ("1108-0".equals(codeString))
+          return _11080;
+        if ("1109-8".equals(codeString))
+          return _11098;
+        if ("1110-6".equals(codeString))
+          return _11106;
+        if ("1112-2".equals(codeString))
+          return _11122;
+        if ("1114-8".equals(codeString))
+          return _11148;
+        if ("1115-5".equals(codeString))
+          return _11155;
+        if ("1116-3".equals(codeString))
+          return _11163;
+        if ("1117-1".equals(codeString))
+          return _11171;
+        if ("1118-9".equals(codeString))
+          return _11189;
+        if ("1119-7".equals(codeString))
+          return _11197;
+        if ("1120-5".equals(codeString))
+          return _11205;
+        if ("1121-3".equals(codeString))
+          return _11213;
+        if ("1123-9".equals(codeString))
+          return _11239;
+        if ("1124-7".equals(codeString))
+          return _11247;
+        if ("1125-4".equals(codeString))
+          return _11254;
+        if ("1126-2".equals(codeString))
+          return _11262;
+        if ("1127-0".equals(codeString))
+          return _11270;
+        if ("1128-8".equals(codeString))
+          return _11288;
+        if ("1129-6".equals(codeString))
+          return _11296;
+        if ("1130-4".equals(codeString))
+          return _11304;
+        if ("1131-2".equals(codeString))
+          return _11312;
+        if ("1132-0".equals(codeString))
+          return _11320;
+        if ("1133-8".equals(codeString))
+          return _11338;
+        if ("1134-6".equals(codeString))
+          return _11346;
+        if ("1135-3".equals(codeString))
+          return _11353;
+        if ("1136-1".equals(codeString))
+          return _11361;
+        if ("1137-9".equals(codeString))
+          return _11379;
+        if ("1138-7".equals(codeString))
+          return _11387;
+        if ("1139-5".equals(codeString))
+          return _11395;
+        if ("1140-3".equals(codeString))
+          return _11403;
+        if ("1141-1".equals(codeString))
+          return _11411;
+        if ("1142-9".equals(codeString))
+          return _11429;
+        if ("1143-7".equals(codeString))
+          return _11437;
+        if ("1144-5".equals(codeString))
+          return _11445;
+        if ("1145-2".equals(codeString))
+          return _11452;
+        if ("1146-0".equals(codeString))
+          return _11460;
+        if ("1147-8".equals(codeString))
+          return _11478;
+        if ("1148-6".equals(codeString))
+          return _11486;
+        if ("1150-2".equals(codeString))
+          return _11502;
+        if ("1151-0".equals(codeString))
+          return _11510;
+        if ("1153-6".equals(codeString))
+          return _11536;
+        if ("1155-1".equals(codeString))
+          return _11551;
+        if ("1156-9".equals(codeString))
+          return _11569;
+        if ("1157-7".equals(codeString))
+          return _11577;
+        if ("1158-5".equals(codeString))
+          return _11585;
+        if ("1159-3".equals(codeString))
+          return _11593;
+        if ("1160-1".equals(codeString))
+          return _11601;
+        if ("1162-7".equals(codeString))
+          return _11627;
+        if ("1163-5".equals(codeString))
+          return _11635;
+        if ("1165-0".equals(codeString))
+          return _11650;
+        if ("1167-6".equals(codeString))
+          return _11676;
+        if ("1169-2".equals(codeString))
+          return _11692;
+        if ("1171-8".equals(codeString))
+          return _11718;
+        if ("1173-4".equals(codeString))
+          return _11734;
+        if ("1175-9".equals(codeString))
+          return _11759;
+        if ("1176-7".equals(codeString))
+          return _11767;
+        if ("1178-3".equals(codeString))
+          return _11783;
+        if ("1180-9".equals(codeString))
+          return _11809;
+        if ("1182-5".equals(codeString))
+          return _11825;
+        if ("1184-1".equals(codeString))
+          return _11841;
+        if ("1186-6".equals(codeString))
+          return _11866;
+        if ("1187-4".equals(codeString))
+          return _11874;
+        if ("1189-0".equals(codeString))
+          return _11890;
+        if ("1191-6".equals(codeString))
+          return _11916;
+        if ("1193-2".equals(codeString))
+          return _11932;
+        if ("1194-0".equals(codeString))
+          return _11940;
+        if ("1195-7".equals(codeString))
+          return _11957;
+        if ("1196-5".equals(codeString))
+          return _11965;
+        if ("1197-3".equals(codeString))
+          return _11973;
+        if ("1198-1".equals(codeString))
+          return _11981;
+        if ("1199-9".equals(codeString))
+          return _11999;
+        if ("1200-5".equals(codeString))
+          return _12005;
+        if ("1201-3".equals(codeString))
+          return _12013;
+        if ("1202-1".equals(codeString))
+          return _12021;
+        if ("1203-9".equals(codeString))
+          return _12039;
+        if ("1204-7".equals(codeString))
+          return _12047;
+        if ("1205-4".equals(codeString))
+          return _12054;
+        if ("1207-0".equals(codeString))
+          return _12070;
+        if ("1209-6".equals(codeString))
+          return _12096;
+        if ("1211-2".equals(codeString))
+          return _12112;
+        if ("1212-0".equals(codeString))
+          return _12120;
+        if ("1214-6".equals(codeString))
+          return _12146;
+        if ("1215-3".equals(codeString))
+          return _12153;
+        if ("1216-1".equals(codeString))
+          return _12161;
+        if ("1217-9".equals(codeString))
+          return _12179;
+        if ("1218-7".equals(codeString))
+          return _12187;
+        if ("1219-5".equals(codeString))
+          return _12195;
+        if ("1220-3".equals(codeString))
+          return _12203;
+        if ("1222-9".equals(codeString))
+          return _12229;
+        if ("1223-7".equals(codeString))
+          return _12237;
+        if ("1224-5".equals(codeString))
+          return _12245;
+        if ("1225-2".equals(codeString))
+          return _12252;
+        if ("1226-0".equals(codeString))
+          return _12260;
+        if ("1227-8".equals(codeString))
+          return _12278;
+        if ("1228-6".equals(codeString))
+          return _12286;
+        if ("1229-4".equals(codeString))
+          return _12294;
+        if ("1230-2".equals(codeString))
+          return _12302;
+        if ("1231-0".equals(codeString))
+          return _12310;
+        if ("1233-6".equals(codeString))
+          return _12336;
+        if ("1234-4".equals(codeString))
+          return _12344;
+        if ("1235-1".equals(codeString))
+          return _12351;
+        if ("1236-9".equals(codeString))
+          return _12369;
+        if ("1237-7".equals(codeString))
+          return _12377;
+        if ("1238-5".equals(codeString))
+          return _12385;
+        if ("1239-3".equals(codeString))
+          return _12393;
+        if ("1240-1".equals(codeString))
+          return _12401;
+        if ("1241-9".equals(codeString))
+          return _12419;
+        if ("1242-7".equals(codeString))
+          return _12427;
+        if ("1243-5".equals(codeString))
+          return _12435;
+        if ("1244-3".equals(codeString))
+          return _12443;
+        if ("1245-0".equals(codeString))
+          return _12450;
+        if ("1246-8".equals(codeString))
+          return _12468;
+        if ("1247-6".equals(codeString))
+          return _12476;
+        if ("1248-4".equals(codeString))
+          return _12484;
+        if ("1250-0".equals(codeString))
+          return _12500;
+        if ("1252-6".equals(codeString))
+          return _12526;
+        if ("1254-2".equals(codeString))
+          return _12542;
+        if ("1256-7".equals(codeString))
+          return _12567;
+        if ("1258-3".equals(codeString))
+          return _12583;
+        if ("1260-9".equals(codeString))
+          return _12609;
+        if ("1262-5".equals(codeString))
+          return _12625;
+        if ("1264-1".equals(codeString))
+          return _12641;
+        if ("1265-8".equals(codeString))
+          return _12658;
+        if ("1267-4".equals(codeString))
+          return _12674;
+        if ("1269-0".equals(codeString))
+          return _12690;
+        if ("1271-6".equals(codeString))
+          return _12716;
+        if ("1272-4".equals(codeString))
+          return _12724;
+        if ("1273-2".equals(codeString))
+          return _12732;
+        if ("1275-7".equals(codeString))
+          return _12757;
+        if ("1277-3".equals(codeString))
+          return _12773;
+        if ("1279-9".equals(codeString))
+          return _12799;
+        if ("1281-5".equals(codeString))
+          return _12815;
+        if ("1282-3".equals(codeString))
+          return _12823;
+        if ("1283-1".equals(codeString))
+          return _12831;
+        if ("1285-6".equals(codeString))
+          return _12856;
+        if ("1286-4".equals(codeString))
+          return _12864;
+        if ("1287-2".equals(codeString))
+          return _12872;
+        if ("1288-0".equals(codeString))
+          return _12880;
+        if ("1289-8".equals(codeString))
+          return _12898;
+        if ("1290-6".equals(codeString))
+          return _12906;
+        if ("1291-4".equals(codeString))
+          return _12914;
+        if ("1292-2".equals(codeString))
+          return _12922;
+        if ("1293-0".equals(codeString))
+          return _12930;
+        if ("1294-8".equals(codeString))
+          return _12948;
+        if ("1295-5".equals(codeString))
+          return _12955;
+        if ("1297-1".equals(codeString))
+          return _12971;
+        if ("1299-7".equals(codeString))
+          return _12997;
+        if ("1301-1".equals(codeString))
+          return _13011;
+        if ("1303-7".equals(codeString))
+          return _13037;
+        if ("1305-2".equals(codeString))
+          return _13052;
+        if ("1306-0".equals(codeString))
+          return _13060;
+        if ("1307-8".equals(codeString))
+          return _13078;
+        if ("1309-4".equals(codeString))
+          return _13094;
+        if ("1310-2".equals(codeString))
+          return _13102;
+        if ("1312-8".equals(codeString))
+          return _13128;
+        if ("1313-6".equals(codeString))
+          return _13136;
+        if ("1314-4".equals(codeString))
+          return _13144;
+        if ("1315-1".equals(codeString))
+          return _13151;
+        if ("1317-7".equals(codeString))
+          return _13177;
+        if ("1319-3".equals(codeString))
+          return _13193;
+        if ("1321-9".equals(codeString))
+          return _13219;
+        if ("1323-5".equals(codeString))
+          return _13235;
+        if ("1325-0".equals(codeString))
+          return _13250;
+        if ("1326-8".equals(codeString))
+          return _13268;
+        if ("1327-6".equals(codeString))
+          return _13276;
+        if ("1328-4".equals(codeString))
+          return _13284;
+        if ("1329-2".equals(codeString))
+          return _13292;
+        if ("1331-8".equals(codeString))
+          return _13318;
+        if ("1332-6".equals(codeString))
+          return _13326;
+        if ("1333-4".equals(codeString))
+          return _13334;
+        if ("1334-2".equals(codeString))
+          return _13342;
+        if ("1335-9".equals(codeString))
+          return _13359;
+        if ("1336-7".equals(codeString))
+          return _13367;
+        if ("1337-5".equals(codeString))
+          return _13375;
+        if ("1338-3".equals(codeString))
+          return _13383;
+        if ("1340-9".equals(codeString))
+          return _13409;
+        if ("1342-5".equals(codeString))
+          return _13425;
+        if ("1344-1".equals(codeString))
+          return _13441;
+        if ("1345-8".equals(codeString))
+          return _13458;
+        if ("1346-6".equals(codeString))
+          return _13466;
+        if ("1348-2".equals(codeString))
+          return _13482;
+        if ("1350-8".equals(codeString))
+          return _13508;
+        if ("1352-4".equals(codeString))
+          return _13524;
+        if ("1354-0".equals(codeString))
+          return _13540;
+        if ("1356-5".equals(codeString))
+          return _13565;
+        if ("1358-1".equals(codeString))
+          return _13581;
+        if ("1359-9".equals(codeString))
+          return _13599;
+        if ("1360-7".equals(codeString))
+          return _13607;
+        if ("1361-5".equals(codeString))
+          return _13615;
+        if ("1363-1".equals(codeString))
+          return _13631;
+        if ("1365-6".equals(codeString))
+          return _13656;
+        if ("1366-4".equals(codeString))
+          return _13664;
+        if ("1368-0".equals(codeString))
+          return _13680;
+        if ("1370-6".equals(codeString))
+          return _13706;
+        if ("1372-2".equals(codeString))
+          return _13722;
+        if ("1374-8".equals(codeString))
+          return _13748;
+        if ("1376-3".equals(codeString))
+          return _13763;
+        if ("1378-9".equals(codeString))
+          return _13789;
+        if ("1380-5".equals(codeString))
+          return _13805;
+        if ("1382-1".equals(codeString))
+          return _13821;
+        if ("1383-9".equals(codeString))
+          return _13839;
+        if ("1384-7".equals(codeString))
+          return _13847;
+        if ("1385-4".equals(codeString))
+          return _13854;
+        if ("1387-0".equals(codeString))
+          return _13870;
+        if ("1389-6".equals(codeString))
+          return _13896;
+        if ("1391-2".equals(codeString))
+          return _13912;
+        if ("1392-0".equals(codeString))
+          return _13920;
+        if ("1393-8".equals(codeString))
+          return _13938;
+        if ("1394-6".equals(codeString))
+          return _13946;
+        if ("1395-3".equals(codeString))
+          return _13953;
+        if ("1396-1".equals(codeString))
+          return _13961;
+        if ("1397-9".equals(codeString))
+          return _13979;
+        if ("1398-7".equals(codeString))
+          return _13987;
+        if ("1399-5".equals(codeString))
+          return _13995;
+        if ("1400-1".equals(codeString))
+          return _14001;
+        if ("1401-9".equals(codeString))
+          return _14019;
+        if ("1403-5".equals(codeString))
+          return _14035;
+        if ("1405-0".equals(codeString))
+          return _14050;
+        if ("1407-6".equals(codeString))
+          return _14076;
+        if ("1409-2".equals(codeString))
+          return _14092;
+        if ("1411-8".equals(codeString))
+          return _14118;
+        if ("1412-6".equals(codeString))
+          return _14126;
+        if ("1413-4".equals(codeString))
+          return _14134;
+        if ("1414-2".equals(codeString))
+          return _14142;
+        if ("1416-7".equals(codeString))
+          return _14167;
+        if ("1417-5".equals(codeString))
+          return _14175;
+        if ("1418-3".equals(codeString))
+          return _14183;
+        if ("1419-1".equals(codeString))
+          return _14191;
+        if ("1420-9".equals(codeString))
+          return _14209;
+        if ("1421-7".equals(codeString))
+          return _14217;
+        if ("1422-5".equals(codeString))
+          return _14225;
+        if ("1423-3".equals(codeString))
+          return _14233;
+        if ("1424-1".equals(codeString))
+          return _14241;
+        if ("1425-8".equals(codeString))
+          return _14258;
+        if ("1426-6".equals(codeString))
+          return _14266;
+        if ("1427-4".equals(codeString))
+          return _14274;
+        if ("1428-2".equals(codeString))
+          return _14282;
+        if ("1429-0".equals(codeString))
+          return _14290;
+        if ("1430-8".equals(codeString))
+          return _14308;
+        if ("1431-6".equals(codeString))
+          return _14316;
+        if ("1432-4".equals(codeString))
+          return _14324;
+        if ("1433-2".equals(codeString))
+          return _14332;
+        if ("1434-0".equals(codeString))
+          return _14340;
+        if ("1435-7".equals(codeString))
+          return _14357;
+        if ("1436-5".equals(codeString))
+          return _14365;
+        if ("1437-3".equals(codeString))
+          return _14373;
+        if ("1439-9".equals(codeString))
+          return _14399;
+        if ("1441-5".equals(codeString))
+          return _14415;
+        if ("1442-3".equals(codeString))
+          return _14423;
+        if ("1443-1".equals(codeString))
+          return _14431;
+        if ("1445-6".equals(codeString))
+          return _14456;
+        if ("1446-4".equals(codeString))
+          return _14464;
+        if ("1448-0".equals(codeString))
+          return _14480;
+        if ("1450-6".equals(codeString))
+          return _14506;
+        if ("1451-4".equals(codeString))
+          return _14514;
+        if ("1453-0".equals(codeString))
+          return _14530;
+        if ("1454-8".equals(codeString))
+          return _14548;
+        if ("1456-3".equals(codeString))
+          return _14563;
+        if ("1457-1".equals(codeString))
+          return _14571;
+        if ("1458-9".equals(codeString))
+          return _14589;
+        if ("1460-5".equals(codeString))
+          return _14605;
+        if ("1462-1".equals(codeString))
+          return _14621;
+        if ("1464-7".equals(codeString))
+          return _14647;
+        if ("1465-4".equals(codeString))
+          return _14654;
+        if ("1466-2".equals(codeString))
+          return _14662;
+        if ("1467-0".equals(codeString))
+          return _14670;
+        if ("1468-8".equals(codeString))
+          return _14688;
+        if ("1469-6".equals(codeString))
+          return _14696;
+        if ("1470-4".equals(codeString))
+          return _14704;
+        if ("1471-2".equals(codeString))
+          return _14712;
+        if ("1472-0".equals(codeString))
+          return _14720;
+        if ("1474-6".equals(codeString))
+          return _14746;
+        if ("1475-3".equals(codeString))
+          return _14753;
+        if ("1476-1".equals(codeString))
+          return _14761;
+        if ("1478-7".equals(codeString))
+          return _14787;
+        if ("1479-5".equals(codeString))
+          return _14795;
+        if ("1480-3".equals(codeString))
+          return _14803;
+        if ("1481-1".equals(codeString))
+          return _14811;
+        if ("1482-9".equals(codeString))
+          return _14829;
+        if ("1483-7".equals(codeString))
+          return _14837;
+        if ("1484-5".equals(codeString))
+          return _14845;
+        if ("1485-2".equals(codeString))
+          return _14852;
+        if ("1487-8".equals(codeString))
+          return _14878;
+        if ("1489-4".equals(codeString))
+          return _14894;
+        if ("1490-2".equals(codeString))
+          return _14902;
+        if ("1491-0".equals(codeString))
+          return _14910;
+        if ("1492-8".equals(codeString))
+          return _14928;
+        if ("1493-6".equals(codeString))
+          return _14936;
+        if ("1494-4".equals(codeString))
+          return _14944;
+        if ("1495-1".equals(codeString))
+          return _14951;
+        if ("1496-9".equals(codeString))
+          return _14969;
+        if ("1497-7".equals(codeString))
+          return _14977;
+        if ("1498-5".equals(codeString))
+          return _14985;
+        if ("1499-3".equals(codeString))
+          return _14993;
+        if ("1500-8".equals(codeString))
+          return _15008;
+        if ("1501-6".equals(codeString))
+          return _15016;
+        if ("1502-4".equals(codeString))
+          return _15024;
+        if ("1503-2".equals(codeString))
+          return _15032;
+        if ("1504-0".equals(codeString))
+          return _15040;
+        if ("1505-7".equals(codeString))
+          return _15057;
+        if ("1506-5".equals(codeString))
+          return _15065;
+        if ("1507-3".equals(codeString))
+          return _15073;
+        if ("1508-1".equals(codeString))
+          return _15081;
+        if ("1509-9".equals(codeString))
+          return _15099;
+        if ("1510-7".equals(codeString))
+          return _15107;
+        if ("1511-5".equals(codeString))
+          return _15115;
+        if ("1512-3".equals(codeString))
+          return _15123;
+        if ("1513-1".equals(codeString))
+          return _15131;
+        if ("1514-9".equals(codeString))
+          return _15149;
+        if ("1515-6".equals(codeString))
+          return _15156;
+        if ("1516-4".equals(codeString))
+          return _15164;
+        if ("1518-0".equals(codeString))
+          return _15180;
+        if ("1519-8".equals(codeString))
+          return _15198;
+        if ("1520-6".equals(codeString))
+          return _15206;
+        if ("1521-4".equals(codeString))
+          return _15214;
+        if ("1522-2".equals(codeString))
+          return _15222;
+        if ("1523-0".equals(codeString))
+          return _15230;
+        if ("1524-8".equals(codeString))
+          return _15248;
+        if ("1525-5".equals(codeString))
+          return _15255;
+        if ("1526-3".equals(codeString))
+          return _15263;
+        if ("1527-1".equals(codeString))
+          return _15271;
+        if ("1528-9".equals(codeString))
+          return _15289;
+        if ("1529-7".equals(codeString))
+          return _15297;
+        if ("1530-5".equals(codeString))
+          return _15305;
+        if ("1531-3".equals(codeString))
+          return _15313;
+        if ("1532-1".equals(codeString))
+          return _15321;
+        if ("1533-9".equals(codeString))
+          return _15339;
+        if ("1534-7".equals(codeString))
+          return _15347;
+        if ("1535-4".equals(codeString))
+          return _15354;
+        if ("1536-2".equals(codeString))
+          return _15362;
+        if ("1537-0".equals(codeString))
+          return _15370;
+        if ("1538-8".equals(codeString))
+          return _15388;
+        if ("1539-6".equals(codeString))
+          return _15396;
+        if ("1541-2".equals(codeString))
+          return _15412;
+        if ("1543-8".equals(codeString))
+          return _15438;
+        if ("1545-3".equals(codeString))
+          return _15453;
+        if ("1547-9".equals(codeString))
+          return _15479;
+        if ("1549-5".equals(codeString))
+          return _15495;
+        if ("1551-1".equals(codeString))
+          return _15511;
+        if ("1552-9".equals(codeString))
+          return _15529;
+        if ("1553-7".equals(codeString))
+          return _15537;
+        if ("1554-5".equals(codeString))
+          return _15545;
+        if ("1556-0".equals(codeString))
+          return _15560;
+        if ("1558-6".equals(codeString))
+          return _15586;
+        if ("1560-2".equals(codeString))
+          return _15602;
+        if ("1562-8".equals(codeString))
+          return _15628;
+        if ("1564-4".equals(codeString))
+          return _15644;
+        if ("1566-9".equals(codeString))
+          return _15669;
+        if ("1567-7".equals(codeString))
+          return _15677;
+        if ("1568-5".equals(codeString))
+          return _15685;
+        if ("1569-3".equals(codeString))
+          return _15693;
+        if ("1570-1".equals(codeString))
+          return _15701;
+        if ("1571-9".equals(codeString))
+          return _15719;
+        if ("1573-5".equals(codeString))
+          return _15735;
+        if ("1574-3".equals(codeString))
+          return _15743;
+        if ("1576-8".equals(codeString))
+          return _15768;
+        if ("1578-4".equals(codeString))
+          return _15784;
+        if ("1579-2".equals(codeString))
+          return _15792;
+        if ("1580-0".equals(codeString))
+          return _15800;
+        if ("1582-6".equals(codeString))
+          return _15826;
+        if ("1584-2".equals(codeString))
+          return _15842;
+        if ("1586-7".equals(codeString))
+          return _15867;
+        if ("1587-5".equals(codeString))
+          return _15875;
+        if ("1588-3".equals(codeString))
+          return _15883;
+        if ("1589-1".equals(codeString))
+          return _15891;
+        if ("1590-9".equals(codeString))
+          return _15909;
+        if ("1591-7".equals(codeString))
+          return _15917;
+        if ("1592-5".equals(codeString))
+          return _15925;
+        if ("1593-3".equals(codeString))
+          return _15933;
+        if ("1594-1".equals(codeString))
+          return _15941;
+        if ("1595-8".equals(codeString))
+          return _15958;
+        if ("1596-6".equals(codeString))
+          return _15966;
+        if ("1597-4".equals(codeString))
+          return _15974;
+        if ("1598-2".equals(codeString))
+          return _15982;
+        if ("1599-0".equals(codeString))
+          return _15990;
+        if ("1600-6".equals(codeString))
+          return _16006;
+        if ("1602-2".equals(codeString))
+          return _16022;
+        if ("1603-0".equals(codeString))
+          return _16030;
+        if ("1604-8".equals(codeString))
+          return _16048;
+        if ("1605-5".equals(codeString))
+          return _16055;
+        if ("1607-1".equals(codeString))
+          return _16071;
+        if ("1609-7".equals(codeString))
+          return _16097;
+        if ("1610-5".equals(codeString))
+          return _16105;
+        if ("1611-3".equals(codeString))
+          return _16113;
+        if ("1612-1".equals(codeString))
+          return _16121;
+        if ("1613-9".equals(codeString))
+          return _16139;
+        if ("1614-7".equals(codeString))
+          return _16147;
+        if ("1615-4".equals(codeString))
+          return _16154;
+        if ("1616-2".equals(codeString))
+          return _16162;
+        if ("1617-0".equals(codeString))
+          return _16170;
+        if ("1618-8".equals(codeString))
+          return _16188;
+        if ("1619-6".equals(codeString))
+          return _16196;
+        if ("1620-4".equals(codeString))
+          return _16204;
+        if ("1621-2".equals(codeString))
+          return _16212;
+        if ("1622-0".equals(codeString))
+          return _16220;
+        if ("1623-8".equals(codeString))
+          return _16238;
+        if ("1624-6".equals(codeString))
+          return _16246;
+        if ("1625-3".equals(codeString))
+          return _16253;
+        if ("1626-1".equals(codeString))
+          return _16261;
+        if ("1627-9".equals(codeString))
+          return _16279;
+        if ("1628-7".equals(codeString))
+          return _16287;
+        if ("1629-5".equals(codeString))
+          return _16295;
+        if ("1630-3".equals(codeString))
+          return _16303;
+        if ("1631-1".equals(codeString))
+          return _16311;
+        if ("1632-9".equals(codeString))
+          return _16329;
+        if ("1633-7".equals(codeString))
+          return _16337;
+        if ("1634-5".equals(codeString))
+          return _16345;
+        if ("1635-2".equals(codeString))
+          return _16352;
+        if ("1636-0".equals(codeString))
+          return _16360;
+        if ("1637-8".equals(codeString))
+          return _16378;
+        if ("1638-6".equals(codeString))
+          return _16386;
+        if ("1639-4".equals(codeString))
+          return _16394;
+        if ("1640-2".equals(codeString))
+          return _16402;
+        if ("1641-0".equals(codeString))
+          return _16410;
+        if ("1643-6".equals(codeString))
+          return _16436;
+        if ("1645-1".equals(codeString))
+          return _16451;
+        if ("1647-7".equals(codeString))
+          return _16477;
+        if ("1649-3".equals(codeString))
+          return _16493;
+        if ("1651-9".equals(codeString))
+          return _16519;
+        if ("1653-5".equals(codeString))
+          return _16535;
+        if ("1654-3".equals(codeString))
+          return _16543;
+        if ("1655-0".equals(codeString))
+          return _16550;
+        if ("1656-8".equals(codeString))
+          return _16568;
+        if ("1657-6".equals(codeString))
+          return _16576;
+        if ("1659-2".equals(codeString))
+          return _16592;
+        if ("1661-8".equals(codeString))
+          return _16618;
+        if ("1663-4".equals(codeString))
+          return _16634;
+        if ("1665-9".equals(codeString))
+          return _16659;
+        if ("1667-5".equals(codeString))
+          return _16675;
+        if ("1668-3".equals(codeString))
+          return _16683;
+        if ("1670-9".equals(codeString))
+          return _16709;
+        if ("1671-7".equals(codeString))
+          return _16717;
+        if ("1672-5".equals(codeString))
+          return _16725;
+        if ("1673-3".equals(codeString))
+          return _16733;
+        if ("1675-8".equals(codeString))
+          return _16758;
+        if ("1677-4".equals(codeString))
+          return _16774;
+        if ("1679-0".equals(codeString))
+          return _16790;
+        if ("1680-8".equals(codeString))
+          return _16808;
+        if ("1681-6".equals(codeString))
+          return _16816;
+        if ("1683-2".equals(codeString))
+          return _16832;
+        if ("1685-7".equals(codeString))
+          return _16857;
+        if ("1687-3".equals(codeString))
+          return _16873;
+        if ("1688-1".equals(codeString))
+          return _16881;
+        if ("1689-9".equals(codeString))
+          return _16899;
+        if ("1690-7".equals(codeString))
+          return _16907;
+        if ("1692-3".equals(codeString))
+          return _16923;
+        if ("1694-9".equals(codeString))
+          return _16949;
+        if ("1696-4".equals(codeString))
+          return _16964;
+        if ("1697-2".equals(codeString))
+          return _16972;
+        if ("1698-0".equals(codeString))
+          return _16980;
+        if ("1700-4".equals(codeString))
+          return _17004;
+        if ("1702-0".equals(codeString))
+          return _17020;
+        if ("1704-6".equals(codeString))
+          return _17046;
+        if ("1705-3".equals(codeString))
+          return _17053;
+        if ("1707-9".equals(codeString))
+          return _17079;
+        if ("1709-5".equals(codeString))
+          return _17095;
+        if ("1711-1".equals(codeString))
+          return _17111;
+        if ("1712-9".equals(codeString))
+          return _17129;
+        if ("1713-7".equals(codeString))
+          return _17137;
+        if ("1715-2".equals(codeString))
+          return _17152;
+        if ("1717-8".equals(codeString))
+          return _17178;
+        if ("1718-6".equals(codeString))
+          return _17186;
+        if ("1719-4".equals(codeString))
+          return _17194;
+        if ("1720-2".equals(codeString))
+          return _17202;
+        if ("1722-8".equals(codeString))
+          return _17228;
+        if ("1724-4".equals(codeString))
+          return _17244;
+        if ("1725-1".equals(codeString))
+          return _17251;
+        if ("1726-9".equals(codeString))
+          return _17269;
+        if ("1727-7".equals(codeString))
+          return _17277;
+        if ("1728-5".equals(codeString))
+          return _17285;
+        if ("1729-3".equals(codeString))
+          return _17293;
+        if ("1730-1".equals(codeString))
+          return _17301;
+        if ("1731-9".equals(codeString))
+          return _17319;
+        if ("1732-7".equals(codeString))
+          return _17327;
+        if ("1733-5".equals(codeString))
+          return _17335;
+        if ("1735-0".equals(codeString))
+          return _17350;
+        if ("1737-6".equals(codeString))
+          return _17376;
+        if ("1739-2".equals(codeString))
+          return _17392;
+        if ("1740-0".equals(codeString))
+          return _17400;
+        if ("1811-9".equals(codeString))
+          return _18119;
+        if ("1813-5".equals(codeString))
+          return _18135;
+        if ("1814-3".equals(codeString))
+          return _18143;
+        if ("1815-0".equals(codeString))
+          return _18150;
+        if ("1816-8".equals(codeString))
+          return _18168;
+        if ("1817-6".equals(codeString))
+          return _18176;
+        if ("1818-4".equals(codeString))
+          return _18184;
+        if ("1819-2".equals(codeString))
+          return _18192;
+        if ("1820-0".equals(codeString))
+          return _18200;
+        if ("1821-8".equals(codeString))
+          return _18218;
+        if ("1822-6".equals(codeString))
+          return _18226;
+        if ("1823-4".equals(codeString))
+          return _18234;
+        if ("1824-2".equals(codeString))
+          return _18242;
+        if ("1825-9".equals(codeString))
+          return _18259;
+        if ("1826-7".equals(codeString))
+          return _18267;
+        if ("1827-5".equals(codeString))
+          return _18275;
+        if ("1828-3".equals(codeString))
+          return _18283;
+        if ("1829-1".equals(codeString))
+          return _18291;
+        if ("1830-9".equals(codeString))
+          return _18309;
+        if ("1831-7".equals(codeString))
+          return _18317;
+        if ("1832-5".equals(codeString))
+          return _18325;
+        if ("1833-3".equals(codeString))
+          return _18333;
+        if ("1834-1".equals(codeString))
+          return _18341;
+        if ("1835-8".equals(codeString))
+          return _18358;
+        if ("1837-4".equals(codeString))
+          return _18374;
+        if ("1838-2".equals(codeString))
+          return _18382;
+        if ("1840-8".equals(codeString))
+          return _18408;
+        if ("1842-4".equals(codeString))
+          return _18424;
+        if ("1844-0".equals(codeString))
+          return _18440;
+        if ("1845-7".equals(codeString))
+          return _18457;
+        if ("1846-5".equals(codeString))
+          return _18465;
+        if ("1847-3".equals(codeString))
+          return _18473;
+        if ("1848-1".equals(codeString))
+          return _18481;
+        if ("1849-9".equals(codeString))
+          return _18499;
+        if ("1850-7".equals(codeString))
+          return _18507;
+        if ("1851-5".equals(codeString))
+          return _18515;
+        if ("1852-3".equals(codeString))
+          return _18523;
+        if ("1853-1".equals(codeString))
+          return _18531;
+        if ("1854-9".equals(codeString))
+          return _18549;
+        if ("1855-6".equals(codeString))
+          return _18556;
+        if ("1856-4".equals(codeString))
+          return _18564;
+        if ("1857-2".equals(codeString))
+          return _18572;
+        if ("1858-0".equals(codeString))
+          return _18580;
+        if ("1859-8".equals(codeString))
+          return _18598;
+        if ("1860-6".equals(codeString))
+          return _18606;
+        if ("1861-4".equals(codeString))
+          return _18614;
+        if ("1862-2".equals(codeString))
+          return _18622;
+        if ("1863-0".equals(codeString))
+          return _18630;
+        if ("1864-8".equals(codeString))
+          return _18648;
+        if ("1865-5".equals(codeString))
+          return _18655;
+        if ("1866-3".equals(codeString))
+          return _18663;
+        if ("1867-1".equals(codeString))
+          return _18671;
+        if ("1868-9".equals(codeString))
+          return _18689;
+        if ("1869-7".equals(codeString))
+          return _18697;
+        if ("1870-5".equals(codeString))
+          return _18705;
+        if ("1871-3".equals(codeString))
+          return _18713;
+        if ("1872-1".equals(codeString))
+          return _18721;
+        if ("1873-9".equals(codeString))
+          return _18739;
+        if ("1874-7".equals(codeString))
+          return _18747;
+        if ("1875-4".equals(codeString))
+          return _18754;
+        if ("1876-2".equals(codeString))
+          return _18762;
+        if ("1877-0".equals(codeString))
+          return _18770;
+        if ("1878-8".equals(codeString))
+          return _18788;
+        if ("1879-6".equals(codeString))
+          return _18796;
+        if ("1880-4".equals(codeString))
+          return _18804;
+        if ("1881-2".equals(codeString))
+          return _18812;
+        if ("1882-0".equals(codeString))
+          return _18820;
+        if ("1883-8".equals(codeString))
+          return _18838;
+        if ("1884-6".equals(codeString))
+          return _18846;
+        if ("1885-3".equals(codeString))
+          return _18853;
+        if ("1886-1".equals(codeString))
+          return _18861;
+        if ("1887-9".equals(codeString))
+          return _18879;
+        if ("1888-7".equals(codeString))
+          return _18887;
+        if ("1889-5".equals(codeString))
+          return _18895;
+        if ("1891-1".equals(codeString))
+          return _18911;
+        if ("1892-9".equals(codeString))
+          return _18929;
+        if ("1893-7".equals(codeString))
+          return _18937;
+        if ("1894-5".equals(codeString))
+          return _18945;
+        if ("1896-0".equals(codeString))
+          return _18960;
+        if ("1897-8".equals(codeString))
+          return _18978;
+        if ("1898-6".equals(codeString))
+          return _18986;
+        if ("1899-4".equals(codeString))
+          return _18994;
+        if ("1900-0".equals(codeString))
+          return _19000;
+        if ("1901-8".equals(codeString))
+          return _19018;
+        if ("1902-6".equals(codeString))
+          return _19026;
+        if ("1903-4".equals(codeString))
+          return _19034;
+        if ("1904-2".equals(codeString))
+          return _19042;
+        if ("1905-9".equals(codeString))
+          return _19059;
+        if ("1906-7".equals(codeString))
+          return _19067;
+        if ("1907-5".equals(codeString))
+          return _19075;
+        if ("1908-3".equals(codeString))
+          return _19083;
+        if ("1909-1".equals(codeString))
+          return _19091;
+        if ("1910-9".equals(codeString))
+          return _19109;
+        if ("1911-7".equals(codeString))
+          return _19117;
+        if ("1912-5".equals(codeString))
+          return _19125;
+        if ("1913-3".equals(codeString))
+          return _19133;
+        if ("1914-1".equals(codeString))
+          return _19141;
+        if ("1915-8".equals(codeString))
+          return _19158;
+        if ("1916-6".equals(codeString))
+          return _19166;
+        if ("1917-4".equals(codeString))
+          return _19174;
+        if ("1918-2".equals(codeString))
+          return _19182;
+        if ("1919-0".equals(codeString))
+          return _19190;
+        if ("1920-8".equals(codeString))
+          return _19208;
+        if ("1921-6".equals(codeString))
+          return _19216;
+        if ("1922-4".equals(codeString))
+          return _19224;
+        if ("1923-2".equals(codeString))
+          return _19232;
+        if ("1924-0".equals(codeString))
+          return _19240;
+        if ("1925-7".equals(codeString))
+          return _19257;
+        if ("1926-5".equals(codeString))
+          return _19265;
+        if ("1927-3".equals(codeString))
+          return _19273;
+        if ("1928-1".equals(codeString))
+          return _19281;
+        if ("1929-9".equals(codeString))
+          return _19299;
+        if ("1930-7".equals(codeString))
+          return _19307;
+        if ("1931-5".equals(codeString))
+          return _19315;
+        if ("1932-3".equals(codeString))
+          return _19323;
+        if ("1933-1".equals(codeString))
+          return _19331;
+        if ("1934-9".equals(codeString))
+          return _19349;
+        if ("1935-6".equals(codeString))
+          return _19356;
+        if ("1936-4".equals(codeString))
+          return _19364;
+        if ("1937-2".equals(codeString))
+          return _19372;
+        if ("1938-0".equals(codeString))
+          return _19380;
+        if ("1939-8".equals(codeString))
+          return _19398;
+        if ("1940-6".equals(codeString))
+          return _19406;
+        if ("1941-4".equals(codeString))
+          return _19414;
+        if ("1942-2".equals(codeString))
+          return _19422;
+        if ("1943-0".equals(codeString))
+          return _19430;
+        if ("1944-8".equals(codeString))
+          return _19448;
+        if ("1945-5".equals(codeString))
+          return _19455;
+        if ("1946-3".equals(codeString))
+          return _19463;
+        if ("1947-1".equals(codeString))
+          return _19471;
+        if ("1948-9".equals(codeString))
+          return _19489;
+        if ("1949-7".equals(codeString))
+          return _19497;
+        if ("1950-5".equals(codeString))
+          return _19505;
+        if ("1951-3".equals(codeString))
+          return _19513;
+        if ("1952-1".equals(codeString))
+          return _19521;
+        if ("1953-9".equals(codeString))
+          return _19539;
+        if ("1954-7".equals(codeString))
+          return _19547;
+        if ("1955-4".equals(codeString))
+          return _19554;
+        if ("1956-2".equals(codeString))
+          return _19562;
+        if ("1957-0".equals(codeString))
+          return _19570;
+        if ("1958-8".equals(codeString))
+          return _19588;
+        if ("1959-6".equals(codeString))
+          return _19596;
+        if ("1960-4".equals(codeString))
+          return _19604;
+        if ("1961-2".equals(codeString))
+          return _19612;
+        if ("1962-0".equals(codeString))
+          return _19620;
+        if ("1963-8".equals(codeString))
+          return _19638;
+        if ("1964-6".equals(codeString))
+          return _19646;
+        if ("1966-1".equals(codeString))
+          return _19661;
+        if ("1968-7".equals(codeString))
+          return _19687;
+        if ("1969-5".equals(codeString))
+          return _19695;
+        if ("1970-3".equals(codeString))
+          return _19703;
+        if ("1972-9".equals(codeString))
+          return _19729;
+        if ("1973-7".equals(codeString))
+          return _19737;
+        if ("1974-5".equals(codeString))
+          return _19745;
+        if ("1975-2".equals(codeString))
+          return _19752;
+        if ("1976-0".equals(codeString))
+          return _19760;
+        if ("1977-8".equals(codeString))
+          return _19778;
+        if ("1978-6".equals(codeString))
+          return _19786;
+        if ("1979-4".equals(codeString))
+          return _19794;
+        if ("1980-2".equals(codeString))
+          return _19802;
+        if ("1981-0".equals(codeString))
+          return _19810;
+        if ("1982-8".equals(codeString))
+          return _19828;
+        if ("1984-4".equals(codeString))
+          return _19844;
+        if ("1985-1".equals(codeString))
+          return _19851;
+        if ("1986-9".equals(codeString))
+          return _19869;
+        if ("1987-7".equals(codeString))
+          return _19877;
+        if ("1988-5".equals(codeString))
+          return _19885;
+        if ("1990-1".equals(codeString))
+          return _19901;
+        if ("1992-7".equals(codeString))
+          return _19927;
+        if ("1993-5".equals(codeString))
+          return _19935;
+        if ("1994-3".equals(codeString))
+          return _19943;
+        if ("1995-0".equals(codeString))
+          return _19950;
+        if ("1996-8".equals(codeString))
+          return _19968;
+        if ("1997-6".equals(codeString))
+          return _19976;
+        if ("1998-4".equals(codeString))
+          return _19984;
+        if ("1999-2".equals(codeString))
+          return _19992;
+        if ("2000-8".equals(codeString))
+          return _20008;
+        if ("2002-4".equals(codeString))
+          return _20024;
+        if ("2004-0".equals(codeString))
+          return _20040;
+        if ("2006-5".equals(codeString))
+          return _20065;
+        if ("2007-3".equals(codeString))
+          return _20073;
+        if ("2008-1".equals(codeString))
+          return _20081;
+        if ("2009-9".equals(codeString))
+          return _20099;
+        if ("2010-7".equals(codeString))
+          return _20107;
+        if ("2011-5".equals(codeString))
+          return _20115;
+        if ("2012-3".equals(codeString))
+          return _20123;
+        if ("2013-1".equals(codeString))
+          return _20131;
+        if ("2014-9".equals(codeString))
+          return _20149;
+        if ("2015-6".equals(codeString))
+          return _20156;
+        if ("2016-4".equals(codeString))
+          return _20164;
+        if ("2017-2".equals(codeString))
+          return _20172;
+        if ("2018-0".equals(codeString))
+          return _20180;
+        if ("2019-8".equals(codeString))
+          return _20198;
+        if ("2020-6".equals(codeString))
+          return _20206;
+        if ("2021-4".equals(codeString))
+          return _20214;
+        if ("2022-2".equals(codeString))
+          return _20222;
+        if ("2023-0".equals(codeString))
+          return _20230;
+        if ("2024-8".equals(codeString))
+          return _20248;
+        if ("2025-5".equals(codeString))
+          return _20255;
+        if ("2026-3".equals(codeString))
+          return _20263;
+        if ("2028-9".equals(codeString))
+          return _20289;
+        if ("2029-7".equals(codeString))
+          return _20297;
+        if ("2030-5".equals(codeString))
+          return _20305;
+        if ("2031-3".equals(codeString))
+          return _20313;
+        if ("2032-1".equals(codeString))
+          return _20321;
+        if ("2033-9".equals(codeString))
+          return _20339;
+        if ("2034-7".equals(codeString))
+          return _20347;
+        if ("2035-4".equals(codeString))
+          return _20354;
+        if ("2036-2".equals(codeString))
+          return _20362;
+        if ("2037-0".equals(codeString))
+          return _20370;
+        if ("2038-8".equals(codeString))
+          return _20388;
+        if ("2039-6".equals(codeString))
+          return _20396;
+        if ("2040-4".equals(codeString))
+          return _20404;
+        if ("2041-2".equals(codeString))
+          return _20412;
+        if ("2042-0".equals(codeString))
+          return _20420;
+        if ("2043-8".equals(codeString))
+          return _20438;
+        if ("2044-6".equals(codeString))
+          return _20446;
+        if ("2045-3".equals(codeString))
+          return _20453;
+        if ("2046-1".equals(codeString))
+          return _20461;
+        if ("2047-9".equals(codeString))
+          return _20479;
+        if ("2048-7".equals(codeString))
+          return _20487;
+        if ("2049-5".equals(codeString))
+          return _20495;
+        if ("2050-3".equals(codeString))
+          return _20503;
+        if ("2051-1".equals(codeString))
+          return _20511;
+        if ("2052-9".equals(codeString))
+          return _20529;
+        if ("2054-5".equals(codeString))
+          return _20545;
+        if ("2056-0".equals(codeString))
+          return _20560;
+        if ("2058-6".equals(codeString))
+          return _20586;
+        if ("2060-2".equals(codeString))
+          return _20602;
+        if ("2061-0".equals(codeString))
+          return _20610;
+        if ("2062-8".equals(codeString))
+          return _20628;
+        if ("2063-6".equals(codeString))
+          return _20636;
+        if ("2064-4".equals(codeString))
+          return _20644;
+        if ("2065-1".equals(codeString))
+          return _20651;
+        if ("2066-9".equals(codeString))
+          return _20669;
+        if ("2067-7".equals(codeString))
+          return _20677;
+        if ("2068-5".equals(codeString))
+          return _20685;
+        if ("2069-3".equals(codeString))
+          return _20693;
+        if ("2070-1".equals(codeString))
+          return _20701;
+        if ("2071-9".equals(codeString))
+          return _20719;
+        if ("2072-7".equals(codeString))
+          return _20727;
+        if ("2073-5".equals(codeString))
+          return _20735;
+        if ("2074-3".equals(codeString))
+          return _20743;
+        if ("2075-0".equals(codeString))
+          return _20750;
+        if ("2076-8".equals(codeString))
+          return _20768;
+        if ("2078-4".equals(codeString))
+          return _20784;
+        if ("2079-2".equals(codeString))
+          return _20792;
+        if ("2080-0".equals(codeString))
+          return _20800;
+        if ("2081-8".equals(codeString))
+          return _20818;
+        if ("2082-6".equals(codeString))
+          return _20826;
+        if ("2083-4".equals(codeString))
+          return _20834;
+        if ("2085-9".equals(codeString))
+          return _20859;
+        if ("2086-7".equals(codeString))
+          return _20867;
+        if ("2087-5".equals(codeString))
+          return _20875;
+        if ("2088-3".equals(codeString))
+          return _20883;
+        if ("2089-1".equals(codeString))
+          return _20891;
+        if ("2090-9".equals(codeString))
+          return _20909;
+        if ("2091-7".equals(codeString))
+          return _20917;
+        if ("2092-5".equals(codeString))
+          return _20925;
+        if ("2093-3".equals(codeString))
+          return _20933;
+        if ("2094-1".equals(codeString))
+          return _20941;
+        if ("2095-8".equals(codeString))
+          return _20958;
+        if ("2096-6".equals(codeString))
+          return _20966;
+        if ("2097-4".equals(codeString))
+          return _20974;
+        if ("2098-2".equals(codeString))
+          return _20982;
+        if ("2100-6".equals(codeString))
+          return _21006;
+        if ("2101-4".equals(codeString))
+          return _21014;
+        if ("2102-2".equals(codeString))
+          return _21022;
+        if ("2103-0".equals(codeString))
+          return _21030;
+        if ("2104-8".equals(codeString))
+          return _21048;
+        if ("2500-7".equals(codeString))
+          return _25007;
+        if ("2106-3".equals(codeString))
+          return _21063;
+        if ("2108-9".equals(codeString))
+          return _21089;
+        if ("2109-7".equals(codeString))
+          return _21097;
+        if ("2110-5".equals(codeString))
+          return _21105;
+        if ("2111-3".equals(codeString))
+          return _21113;
+        if ("2112-1".equals(codeString))
+          return _21121;
+        if ("2113-9".equals(codeString))
+          return _21139;
+        if ("2114-7".equals(codeString))
+          return _21147;
+        if ("2115-4".equals(codeString))
+          return _21154;
+        if ("2116-2".equals(codeString))
+          return _21162;
+        if ("2118-8".equals(codeString))
+          return _21188;
+        if ("2119-6".equals(codeString))
+          return _21196;
+        if ("2120-4".equals(codeString))
+          return _21204;
+        if ("2121-2".equals(codeString))
+          return _21212;
+        if ("2122-0".equals(codeString))
+          return _21220;
+        if ("2123-8".equals(codeString))
+          return _21238;
+        if ("2124-6".equals(codeString))
+          return _21246;
+        if ("2125-3".equals(codeString))
+          return _21253;
+        if ("2126-1".equals(codeString))
+          return _21261;
+        if ("2127-9".equals(codeString))
+          return _21279;
+        if ("2129-5".equals(codeString))
+          return _21295;
+        if ("2131-1".equals(codeString))
+          return _21311;
+        throw new FHIRException("Unknown V3Race code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _10025: return "1002-5";
+            case _10041: return "1004-1";
+            case _10066: return "1006-6";
+            case _10082: return "1008-2";
+            case _10108: return "1010-8";
+            case _10116: return "1011-6";
+            case _10124: return "1012-4";
+            case _10132: return "1013-2";
+            case _10140: return "1014-0";
+            case _10157: return "1015-7";
+            case _10165: return "1016-5";
+            case _10173: return "1017-3";
+            case _10181: return "1018-1";
+            case _10199: return "1019-9";
+            case _10215: return "1021-5";
+            case _10223: return "1022-3";
+            case _10231: return "1023-1";
+            case _10249: return "1024-9";
+            case _10264: return "1026-4";
+            case _10280: return "1028-0";
+            case _10306: return "1030-6";
+            case _10314: return "1031-4";
+            case _10330: return "1033-0";
+            case _10355: return "1035-5";
+            case _10371: return "1037-1";
+            case _10397: return "1039-7";
+            case _10413: return "1041-3";
+            case _10421: return "1042-1";
+            case _10447: return "1044-7";
+            case _10454: return "1045-4";
+            case _10462: return "1046-2";
+            case _10470: return "1047-0";
+            case _10488: return "1048-8";
+            case _10496: return "1049-6";
+            case _10504: return "1050-4";
+            case _10512: return "1051-2";
+            case _10538: return "1053-8";
+            case _10546: return "1054-6";
+            case _10553: return "1055-3";
+            case _10561: return "1056-1";
+            case _10579: return "1057-9";
+            case _10587: return "1058-7";
+            case _10595: return "1059-5";
+            case _10603: return "1060-3";
+            case _10611: return "1061-1";
+            case _10629: return "1062-9";
+            case _10637: return "1063-7";
+            case _10645: return "1064-5";
+            case _10652: return "1065-2";
+            case _10660: return "1066-0";
+            case _10686: return "1068-6";
+            case _10694: return "1069-4";
+            case _10702: return "1070-2";
+            case _10710: return "1071-0";
+            case _10728: return "1072-8";
+            case _10736: return "1073-6";
+            case _10744: return "1074-4";
+            case _10769: return "1076-9";
+            case _17418: return "1741-8";
+            case _17426: return "1742-6";
+            case _17434: return "1743-4";
+            case _17442: return "1744-2";
+            case _17459: return "1745-9";
+            case _17467: return "1746-7";
+            case _17475: return "1747-5";
+            case _17483: return "1748-3";
+            case _17491: return "1749-1";
+            case _17509: return "1750-9";
+            case _17517: return "1751-7";
+            case _17525: return "1752-5";
+            case _17533: return "1753-3";
+            case _17541: return "1754-1";
+            case _17558: return "1755-8";
+            case _17566: return "1756-6";
+            case _17574: return "1757-4";
+            case _17582: return "1758-2";
+            case _17590: return "1759-0";
+            case _17608: return "1760-8";
+            case _17616: return "1761-6";
+            case _17624: return "1762-4";
+            case _17632: return "1763-2";
+            case _17640: return "1764-0";
+            case _17657: return "1765-7";
+            case _17665: return "1766-5";
+            case _17673: return "1767-3";
+            case _17681: return "1768-1";
+            case _17699: return "1769-9";
+            case _17707: return "1770-7";
+            case _17715: return "1771-5";
+            case _17723: return "1772-3";
+            case _17731: return "1773-1";
+            case _17749: return "1774-9";
+            case _17756: return "1775-6";
+            case _17764: return "1776-4";
+            case _17772: return "1777-2";
+            case _17780: return "1778-0";
+            case _17798: return "1779-8";
+            case _17806: return "1780-6";
+            case _17814: return "1781-4";
+            case _17822: return "1782-2";
+            case _17830: return "1783-0";
+            case _17848: return "1784-8";
+            case _17855: return "1785-5";
+            case _17863: return "1786-3";
+            case _17871: return "1787-1";
+            case _17889: return "1788-9";
+            case _17897: return "1789-7";
+            case _17905: return "1790-5";
+            case _17913: return "1791-3";
+            case _17921: return "1792-1";
+            case _17939: return "1793-9";
+            case _17947: return "1794-7";
+            case _17954: return "1795-4";
+            case _17962: return "1796-2";
+            case _17970: return "1797-0";
+            case _17988: return "1798-8";
+            case _17996: return "1799-6";
+            case _18002: return "1800-2";
+            case _18010: return "1801-0";
+            case _18028: return "1802-8";
+            case _18036: return "1803-6";
+            case _18044: return "1804-4";
+            case _18051: return "1805-1";
+            case _18069: return "1806-9";
+            case _18077: return "1807-7";
+            case _18085: return "1808-5";
+            case _18093: return "1809-3";
+            case _10785: return "1078-5";
+            case _10801: return "1080-1";
+            case _10827: return "1082-7";
+            case _10835: return "1083-5";
+            case _10843: return "1084-3";
+            case _10868: return "1086-8";
+            case _10884: return "1088-4";
+            case _10892: return "1089-2";
+            case _10900: return "1090-0";
+            case _10918: return "1091-8";
+            case _10926: return "1092-6";
+            case _10934: return "1093-4";
+            case _10942: return "1094-2";
+            case _10959: return "1095-9";
+            case _10967: return "1096-7";
+            case _10975: return "1097-5";
+            case _10983: return "1098-3";
+            case _11007: return "1100-7";
+            case _11023: return "1102-3";
+            case _11031: return "1103-1";
+            case _11049: return "1104-9";
+            case _11064: return "1106-4";
+            case _11080: return "1108-0";
+            case _11098: return "1109-8";
+            case _11106: return "1110-6";
+            case _11122: return "1112-2";
+            case _11148: return "1114-8";
+            case _11155: return "1115-5";
+            case _11163: return "1116-3";
+            case _11171: return "1117-1";
+            case _11189: return "1118-9";
+            case _11197: return "1119-7";
+            case _11205: return "1120-5";
+            case _11213: return "1121-3";
+            case _11239: return "1123-9";
+            case _11247: return "1124-7";
+            case _11254: return "1125-4";
+            case _11262: return "1126-2";
+            case _11270: return "1127-0";
+            case _11288: return "1128-8";
+            case _11296: return "1129-6";
+            case _11304: return "1130-4";
+            case _11312: return "1131-2";
+            case _11320: return "1132-0";
+            case _11338: return "1133-8";
+            case _11346: return "1134-6";
+            case _11353: return "1135-3";
+            case _11361: return "1136-1";
+            case _11379: return "1137-9";
+            case _11387: return "1138-7";
+            case _11395: return "1139-5";
+            case _11403: return "1140-3";
+            case _11411: return "1141-1";
+            case _11429: return "1142-9";
+            case _11437: return "1143-7";
+            case _11445: return "1144-5";
+            case _11452: return "1145-2";
+            case _11460: return "1146-0";
+            case _11478: return "1147-8";
+            case _11486: return "1148-6";
+            case _11502: return "1150-2";
+            case _11510: return "1151-0";
+            case _11536: return "1153-6";
+            case _11551: return "1155-1";
+            case _11569: return "1156-9";
+            case _11577: return "1157-7";
+            case _11585: return "1158-5";
+            case _11593: return "1159-3";
+            case _11601: return "1160-1";
+            case _11627: return "1162-7";
+            case _11635: return "1163-5";
+            case _11650: return "1165-0";
+            case _11676: return "1167-6";
+            case _11692: return "1169-2";
+            case _11718: return "1171-8";
+            case _11734: return "1173-4";
+            case _11759: return "1175-9";
+            case _11767: return "1176-7";
+            case _11783: return "1178-3";
+            case _11809: return "1180-9";
+            case _11825: return "1182-5";
+            case _11841: return "1184-1";
+            case _11866: return "1186-6";
+            case _11874: return "1187-4";
+            case _11890: return "1189-0";
+            case _11916: return "1191-6";
+            case _11932: return "1193-2";
+            case _11940: return "1194-0";
+            case _11957: return "1195-7";
+            case _11965: return "1196-5";
+            case _11973: return "1197-3";
+            case _11981: return "1198-1";
+            case _11999: return "1199-9";
+            case _12005: return "1200-5";
+            case _12013: return "1201-3";
+            case _12021: return "1202-1";
+            case _12039: return "1203-9";
+            case _12047: return "1204-7";
+            case _12054: return "1205-4";
+            case _12070: return "1207-0";
+            case _12096: return "1209-6";
+            case _12112: return "1211-2";
+            case _12120: return "1212-0";
+            case _12146: return "1214-6";
+            case _12153: return "1215-3";
+            case _12161: return "1216-1";
+            case _12179: return "1217-9";
+            case _12187: return "1218-7";
+            case _12195: return "1219-5";
+            case _12203: return "1220-3";
+            case _12229: return "1222-9";
+            case _12237: return "1223-7";
+            case _12245: return "1224-5";
+            case _12252: return "1225-2";
+            case _12260: return "1226-0";
+            case _12278: return "1227-8";
+            case _12286: return "1228-6";
+            case _12294: return "1229-4";
+            case _12302: return "1230-2";
+            case _12310: return "1231-0";
+            case _12336: return "1233-6";
+            case _12344: return "1234-4";
+            case _12351: return "1235-1";
+            case _12369: return "1236-9";
+            case _12377: return "1237-7";
+            case _12385: return "1238-5";
+            case _12393: return "1239-3";
+            case _12401: return "1240-1";
+            case _12419: return "1241-9";
+            case _12427: return "1242-7";
+            case _12435: return "1243-5";
+            case _12443: return "1244-3";
+            case _12450: return "1245-0";
+            case _12468: return "1246-8";
+            case _12476: return "1247-6";
+            case _12484: return "1248-4";
+            case _12500: return "1250-0";
+            case _12526: return "1252-6";
+            case _12542: return "1254-2";
+            case _12567: return "1256-7";
+            case _12583: return "1258-3";
+            case _12609: return "1260-9";
+            case _12625: return "1262-5";
+            case _12641: return "1264-1";
+            case _12658: return "1265-8";
+            case _12674: return "1267-4";
+            case _12690: return "1269-0";
+            case _12716: return "1271-6";
+            case _12724: return "1272-4";
+            case _12732: return "1273-2";
+            case _12757: return "1275-7";
+            case _12773: return "1277-3";
+            case _12799: return "1279-9";
+            case _12815: return "1281-5";
+            case _12823: return "1282-3";
+            case _12831: return "1283-1";
+            case _12856: return "1285-6";
+            case _12864: return "1286-4";
+            case _12872: return "1287-2";
+            case _12880: return "1288-0";
+            case _12898: return "1289-8";
+            case _12906: return "1290-6";
+            case _12914: return "1291-4";
+            case _12922: return "1292-2";
+            case _12930: return "1293-0";
+            case _12948: return "1294-8";
+            case _12955: return "1295-5";
+            case _12971: return "1297-1";
+            case _12997: return "1299-7";
+            case _13011: return "1301-1";
+            case _13037: return "1303-7";
+            case _13052: return "1305-2";
+            case _13060: return "1306-0";
+            case _13078: return "1307-8";
+            case _13094: return "1309-4";
+            case _13102: return "1310-2";
+            case _13128: return "1312-8";
+            case _13136: return "1313-6";
+            case _13144: return "1314-4";
+            case _13151: return "1315-1";
+            case _13177: return "1317-7";
+            case _13193: return "1319-3";
+            case _13219: return "1321-9";
+            case _13235: return "1323-5";
+            case _13250: return "1325-0";
+            case _13268: return "1326-8";
+            case _13276: return "1327-6";
+            case _13284: return "1328-4";
+            case _13292: return "1329-2";
+            case _13318: return "1331-8";
+            case _13326: return "1332-6";
+            case _13334: return "1333-4";
+            case _13342: return "1334-2";
+            case _13359: return "1335-9";
+            case _13367: return "1336-7";
+            case _13375: return "1337-5";
+            case _13383: return "1338-3";
+            case _13409: return "1340-9";
+            case _13425: return "1342-5";
+            case _13441: return "1344-1";
+            case _13458: return "1345-8";
+            case _13466: return "1346-6";
+            case _13482: return "1348-2";
+            case _13508: return "1350-8";
+            case _13524: return "1352-4";
+            case _13540: return "1354-0";
+            case _13565: return "1356-5";
+            case _13581: return "1358-1";
+            case _13599: return "1359-9";
+            case _13607: return "1360-7";
+            case _13615: return "1361-5";
+            case _13631: return "1363-1";
+            case _13656: return "1365-6";
+            case _13664: return "1366-4";
+            case _13680: return "1368-0";
+            case _13706: return "1370-6";
+            case _13722: return "1372-2";
+            case _13748: return "1374-8";
+            case _13763: return "1376-3";
+            case _13789: return "1378-9";
+            case _13805: return "1380-5";
+            case _13821: return "1382-1";
+            case _13839: return "1383-9";
+            case _13847: return "1384-7";
+            case _13854: return "1385-4";
+            case _13870: return "1387-0";
+            case _13896: return "1389-6";
+            case _13912: return "1391-2";
+            case _13920: return "1392-0";
+            case _13938: return "1393-8";
+            case _13946: return "1394-6";
+            case _13953: return "1395-3";
+            case _13961: return "1396-1";
+            case _13979: return "1397-9";
+            case _13987: return "1398-7";
+            case _13995: return "1399-5";
+            case _14001: return "1400-1";
+            case _14019: return "1401-9";
+            case _14035: return "1403-5";
+            case _14050: return "1405-0";
+            case _14076: return "1407-6";
+            case _14092: return "1409-2";
+            case _14118: return "1411-8";
+            case _14126: return "1412-6";
+            case _14134: return "1413-4";
+            case _14142: return "1414-2";
+            case _14167: return "1416-7";
+            case _14175: return "1417-5";
+            case _14183: return "1418-3";
+            case _14191: return "1419-1";
+            case _14209: return "1420-9";
+            case _14217: return "1421-7";
+            case _14225: return "1422-5";
+            case _14233: return "1423-3";
+            case _14241: return "1424-1";
+            case _14258: return "1425-8";
+            case _14266: return "1426-6";
+            case _14274: return "1427-4";
+            case _14282: return "1428-2";
+            case _14290: return "1429-0";
+            case _14308: return "1430-8";
+            case _14316: return "1431-6";
+            case _14324: return "1432-4";
+            case _14332: return "1433-2";
+            case _14340: return "1434-0";
+            case _14357: return "1435-7";
+            case _14365: return "1436-5";
+            case _14373: return "1437-3";
+            case _14399: return "1439-9";
+            case _14415: return "1441-5";
+            case _14423: return "1442-3";
+            case _14431: return "1443-1";
+            case _14456: return "1445-6";
+            case _14464: return "1446-4";
+            case _14480: return "1448-0";
+            case _14506: return "1450-6";
+            case _14514: return "1451-4";
+            case _14530: return "1453-0";
+            case _14548: return "1454-8";
+            case _14563: return "1456-3";
+            case _14571: return "1457-1";
+            case _14589: return "1458-9";
+            case _14605: return "1460-5";
+            case _14621: return "1462-1";
+            case _14647: return "1464-7";
+            case _14654: return "1465-4";
+            case _14662: return "1466-2";
+            case _14670: return "1467-0";
+            case _14688: return "1468-8";
+            case _14696: return "1469-6";
+            case _14704: return "1470-4";
+            case _14712: return "1471-2";
+            case _14720: return "1472-0";
+            case _14746: return "1474-6";
+            case _14753: return "1475-3";
+            case _14761: return "1476-1";
+            case _14787: return "1478-7";
+            case _14795: return "1479-5";
+            case _14803: return "1480-3";
+            case _14811: return "1481-1";
+            case _14829: return "1482-9";
+            case _14837: return "1483-7";
+            case _14845: return "1484-5";
+            case _14852: return "1485-2";
+            case _14878: return "1487-8";
+            case _14894: return "1489-4";
+            case _14902: return "1490-2";
+            case _14910: return "1491-0";
+            case _14928: return "1492-8";
+            case _14936: return "1493-6";
+            case _14944: return "1494-4";
+            case _14951: return "1495-1";
+            case _14969: return "1496-9";
+            case _14977: return "1497-7";
+            case _14985: return "1498-5";
+            case _14993: return "1499-3";
+            case _15008: return "1500-8";
+            case _15016: return "1501-6";
+            case _15024: return "1502-4";
+            case _15032: return "1503-2";
+            case _15040: return "1504-0";
+            case _15057: return "1505-7";
+            case _15065: return "1506-5";
+            case _15073: return "1507-3";
+            case _15081: return "1508-1";
+            case _15099: return "1509-9";
+            case _15107: return "1510-7";
+            case _15115: return "1511-5";
+            case _15123: return "1512-3";
+            case _15131: return "1513-1";
+            case _15149: return "1514-9";
+            case _15156: return "1515-6";
+            case _15164: return "1516-4";
+            case _15180: return "1518-0";
+            case _15198: return "1519-8";
+            case _15206: return "1520-6";
+            case _15214: return "1521-4";
+            case _15222: return "1522-2";
+            case _15230: return "1523-0";
+            case _15248: return "1524-8";
+            case _15255: return "1525-5";
+            case _15263: return "1526-3";
+            case _15271: return "1527-1";
+            case _15289: return "1528-9";
+            case _15297: return "1529-7";
+            case _15305: return "1530-5";
+            case _15313: return "1531-3";
+            case _15321: return "1532-1";
+            case _15339: return "1533-9";
+            case _15347: return "1534-7";
+            case _15354: return "1535-4";
+            case _15362: return "1536-2";
+            case _15370: return "1537-0";
+            case _15388: return "1538-8";
+            case _15396: return "1539-6";
+            case _15412: return "1541-2";
+            case _15438: return "1543-8";
+            case _15453: return "1545-3";
+            case _15479: return "1547-9";
+            case _15495: return "1549-5";
+            case _15511: return "1551-1";
+            case _15529: return "1552-9";
+            case _15537: return "1553-7";
+            case _15545: return "1554-5";
+            case _15560: return "1556-0";
+            case _15586: return "1558-6";
+            case _15602: return "1560-2";
+            case _15628: return "1562-8";
+            case _15644: return "1564-4";
+            case _15669: return "1566-9";
+            case _15677: return "1567-7";
+            case _15685: return "1568-5";
+            case _15693: return "1569-3";
+            case _15701: return "1570-1";
+            case _15719: return "1571-9";
+            case _15735: return "1573-5";
+            case _15743: return "1574-3";
+            case _15768: return "1576-8";
+            case _15784: return "1578-4";
+            case _15792: return "1579-2";
+            case _15800: return "1580-0";
+            case _15826: return "1582-6";
+            case _15842: return "1584-2";
+            case _15867: return "1586-7";
+            case _15875: return "1587-5";
+            case _15883: return "1588-3";
+            case _15891: return "1589-1";
+            case _15909: return "1590-9";
+            case _15917: return "1591-7";
+            case _15925: return "1592-5";
+            case _15933: return "1593-3";
+            case _15941: return "1594-1";
+            case _15958: return "1595-8";
+            case _15966: return "1596-6";
+            case _15974: return "1597-4";
+            case _15982: return "1598-2";
+            case _15990: return "1599-0";
+            case _16006: return "1600-6";
+            case _16022: return "1602-2";
+            case _16030: return "1603-0";
+            case _16048: return "1604-8";
+            case _16055: return "1605-5";
+            case _16071: return "1607-1";
+            case _16097: return "1609-7";
+            case _16105: return "1610-5";
+            case _16113: return "1611-3";
+            case _16121: return "1612-1";
+            case _16139: return "1613-9";
+            case _16147: return "1614-7";
+            case _16154: return "1615-4";
+            case _16162: return "1616-2";
+            case _16170: return "1617-0";
+            case _16188: return "1618-8";
+            case _16196: return "1619-6";
+            case _16204: return "1620-4";
+            case _16212: return "1621-2";
+            case _16220: return "1622-0";
+            case _16238: return "1623-8";
+            case _16246: return "1624-6";
+            case _16253: return "1625-3";
+            case _16261: return "1626-1";
+            case _16279: return "1627-9";
+            case _16287: return "1628-7";
+            case _16295: return "1629-5";
+            case _16303: return "1630-3";
+            case _16311: return "1631-1";
+            case _16329: return "1632-9";
+            case _16337: return "1633-7";
+            case _16345: return "1634-5";
+            case _16352: return "1635-2";
+            case _16360: return "1636-0";
+            case _16378: return "1637-8";
+            case _16386: return "1638-6";
+            case _16394: return "1639-4";
+            case _16402: return "1640-2";
+            case _16410: return "1641-0";
+            case _16436: return "1643-6";
+            case _16451: return "1645-1";
+            case _16477: return "1647-7";
+            case _16493: return "1649-3";
+            case _16519: return "1651-9";
+            case _16535: return "1653-5";
+            case _16543: return "1654-3";
+            case _16550: return "1655-0";
+            case _16568: return "1656-8";
+            case _16576: return "1657-6";
+            case _16592: return "1659-2";
+            case _16618: return "1661-8";
+            case _16634: return "1663-4";
+            case _16659: return "1665-9";
+            case _16675: return "1667-5";
+            case _16683: return "1668-3";
+            case _16709: return "1670-9";
+            case _16717: return "1671-7";
+            case _16725: return "1672-5";
+            case _16733: return "1673-3";
+            case _16758: return "1675-8";
+            case _16774: return "1677-4";
+            case _16790: return "1679-0";
+            case _16808: return "1680-8";
+            case _16816: return "1681-6";
+            case _16832: return "1683-2";
+            case _16857: return "1685-7";
+            case _16873: return "1687-3";
+            case _16881: return "1688-1";
+            case _16899: return "1689-9";
+            case _16907: return "1690-7";
+            case _16923: return "1692-3";
+            case _16949: return "1694-9";
+            case _16964: return "1696-4";
+            case _16972: return "1697-2";
+            case _16980: return "1698-0";
+            case _17004: return "1700-4";
+            case _17020: return "1702-0";
+            case _17046: return "1704-6";
+            case _17053: return "1705-3";
+            case _17079: return "1707-9";
+            case _17095: return "1709-5";
+            case _17111: return "1711-1";
+            case _17129: return "1712-9";
+            case _17137: return "1713-7";
+            case _17152: return "1715-2";
+            case _17178: return "1717-8";
+            case _17186: return "1718-6";
+            case _17194: return "1719-4";
+            case _17202: return "1720-2";
+            case _17228: return "1722-8";
+            case _17244: return "1724-4";
+            case _17251: return "1725-1";
+            case _17269: return "1726-9";
+            case _17277: return "1727-7";
+            case _17285: return "1728-5";
+            case _17293: return "1729-3";
+            case _17301: return "1730-1";
+            case _17319: return "1731-9";
+            case _17327: return "1732-7";
+            case _17335: return "1733-5";
+            case _17350: return "1735-0";
+            case _17376: return "1737-6";
+            case _17392: return "1739-2";
+            case _17400: return "1740-0";
+            case _18119: return "1811-9";
+            case _18135: return "1813-5";
+            case _18143: return "1814-3";
+            case _18150: return "1815-0";
+            case _18168: return "1816-8";
+            case _18176: return "1817-6";
+            case _18184: return "1818-4";
+            case _18192: return "1819-2";
+            case _18200: return "1820-0";
+            case _18218: return "1821-8";
+            case _18226: return "1822-6";
+            case _18234: return "1823-4";
+            case _18242: return "1824-2";
+            case _18259: return "1825-9";
+            case _18267: return "1826-7";
+            case _18275: return "1827-5";
+            case _18283: return "1828-3";
+            case _18291: return "1829-1";
+            case _18309: return "1830-9";
+            case _18317: return "1831-7";
+            case _18325: return "1832-5";
+            case _18333: return "1833-3";
+            case _18341: return "1834-1";
+            case _18358: return "1835-8";
+            case _18374: return "1837-4";
+            case _18382: return "1838-2";
+            case _18408: return "1840-8";
+            case _18424: return "1842-4";
+            case _18440: return "1844-0";
+            case _18457: return "1845-7";
+            case _18465: return "1846-5";
+            case _18473: return "1847-3";
+            case _18481: return "1848-1";
+            case _18499: return "1849-9";
+            case _18507: return "1850-7";
+            case _18515: return "1851-5";
+            case _18523: return "1852-3";
+            case _18531: return "1853-1";
+            case _18549: return "1854-9";
+            case _18556: return "1855-6";
+            case _18564: return "1856-4";
+            case _18572: return "1857-2";
+            case _18580: return "1858-0";
+            case _18598: return "1859-8";
+            case _18606: return "1860-6";
+            case _18614: return "1861-4";
+            case _18622: return "1862-2";
+            case _18630: return "1863-0";
+            case _18648: return "1864-8";
+            case _18655: return "1865-5";
+            case _18663: return "1866-3";
+            case _18671: return "1867-1";
+            case _18689: return "1868-9";
+            case _18697: return "1869-7";
+            case _18705: return "1870-5";
+            case _18713: return "1871-3";
+            case _18721: return "1872-1";
+            case _18739: return "1873-9";
+            case _18747: return "1874-7";
+            case _18754: return "1875-4";
+            case _18762: return "1876-2";
+            case _18770: return "1877-0";
+            case _18788: return "1878-8";
+            case _18796: return "1879-6";
+            case _18804: return "1880-4";
+            case _18812: return "1881-2";
+            case _18820: return "1882-0";
+            case _18838: return "1883-8";
+            case _18846: return "1884-6";
+            case _18853: return "1885-3";
+            case _18861: return "1886-1";
+            case _18879: return "1887-9";
+            case _18887: return "1888-7";
+            case _18895: return "1889-5";
+            case _18911: return "1891-1";
+            case _18929: return "1892-9";
+            case _18937: return "1893-7";
+            case _18945: return "1894-5";
+            case _18960: return "1896-0";
+            case _18978: return "1897-8";
+            case _18986: return "1898-6";
+            case _18994: return "1899-4";
+            case _19000: return "1900-0";
+            case _19018: return "1901-8";
+            case _19026: return "1902-6";
+            case _19034: return "1903-4";
+            case _19042: return "1904-2";
+            case _19059: return "1905-9";
+            case _19067: return "1906-7";
+            case _19075: return "1907-5";
+            case _19083: return "1908-3";
+            case _19091: return "1909-1";
+            case _19109: return "1910-9";
+            case _19117: return "1911-7";
+            case _19125: return "1912-5";
+            case _19133: return "1913-3";
+            case _19141: return "1914-1";
+            case _19158: return "1915-8";
+            case _19166: return "1916-6";
+            case _19174: return "1917-4";
+            case _19182: return "1918-2";
+            case _19190: return "1919-0";
+            case _19208: return "1920-8";
+            case _19216: return "1921-6";
+            case _19224: return "1922-4";
+            case _19232: return "1923-2";
+            case _19240: return "1924-0";
+            case _19257: return "1925-7";
+            case _19265: return "1926-5";
+            case _19273: return "1927-3";
+            case _19281: return "1928-1";
+            case _19299: return "1929-9";
+            case _19307: return "1930-7";
+            case _19315: return "1931-5";
+            case _19323: return "1932-3";
+            case _19331: return "1933-1";
+            case _19349: return "1934-9";
+            case _19356: return "1935-6";
+            case _19364: return "1936-4";
+            case _19372: return "1937-2";
+            case _19380: return "1938-0";
+            case _19398: return "1939-8";
+            case _19406: return "1940-6";
+            case _19414: return "1941-4";
+            case _19422: return "1942-2";
+            case _19430: return "1943-0";
+            case _19448: return "1944-8";
+            case _19455: return "1945-5";
+            case _19463: return "1946-3";
+            case _19471: return "1947-1";
+            case _19489: return "1948-9";
+            case _19497: return "1949-7";
+            case _19505: return "1950-5";
+            case _19513: return "1951-3";
+            case _19521: return "1952-1";
+            case _19539: return "1953-9";
+            case _19547: return "1954-7";
+            case _19554: return "1955-4";
+            case _19562: return "1956-2";
+            case _19570: return "1957-0";
+            case _19588: return "1958-8";
+            case _19596: return "1959-6";
+            case _19604: return "1960-4";
+            case _19612: return "1961-2";
+            case _19620: return "1962-0";
+            case _19638: return "1963-8";
+            case _19646: return "1964-6";
+            case _19661: return "1966-1";
+            case _19687: return "1968-7";
+            case _19695: return "1969-5";
+            case _19703: return "1970-3";
+            case _19729: return "1972-9";
+            case _19737: return "1973-7";
+            case _19745: return "1974-5";
+            case _19752: return "1975-2";
+            case _19760: return "1976-0";
+            case _19778: return "1977-8";
+            case _19786: return "1978-6";
+            case _19794: return "1979-4";
+            case _19802: return "1980-2";
+            case _19810: return "1981-0";
+            case _19828: return "1982-8";
+            case _19844: return "1984-4";
+            case _19851: return "1985-1";
+            case _19869: return "1986-9";
+            case _19877: return "1987-7";
+            case _19885: return "1988-5";
+            case _19901: return "1990-1";
+            case _19927: return "1992-7";
+            case _19935: return "1993-5";
+            case _19943: return "1994-3";
+            case _19950: return "1995-0";
+            case _19968: return "1996-8";
+            case _19976: return "1997-6";
+            case _19984: return "1998-4";
+            case _19992: return "1999-2";
+            case _20008: return "2000-8";
+            case _20024: return "2002-4";
+            case _20040: return "2004-0";
+            case _20065: return "2006-5";
+            case _20073: return "2007-3";
+            case _20081: return "2008-1";
+            case _20099: return "2009-9";
+            case _20107: return "2010-7";
+            case _20115: return "2011-5";
+            case _20123: return "2012-3";
+            case _20131: return "2013-1";
+            case _20149: return "2014-9";
+            case _20156: return "2015-6";
+            case _20164: return "2016-4";
+            case _20172: return "2017-2";
+            case _20180: return "2018-0";
+            case _20198: return "2019-8";
+            case _20206: return "2020-6";
+            case _20214: return "2021-4";
+            case _20222: return "2022-2";
+            case _20230: return "2023-0";
+            case _20248: return "2024-8";
+            case _20255: return "2025-5";
+            case _20263: return "2026-3";
+            case _20289: return "2028-9";
+            case _20297: return "2029-7";
+            case _20305: return "2030-5";
+            case _20313: return "2031-3";
+            case _20321: return "2032-1";
+            case _20339: return "2033-9";
+            case _20347: return "2034-7";
+            case _20354: return "2035-4";
+            case _20362: return "2036-2";
+            case _20370: return "2037-0";
+            case _20388: return "2038-8";
+            case _20396: return "2039-6";
+            case _20404: return "2040-4";
+            case _20412: return "2041-2";
+            case _20420: return "2042-0";
+            case _20438: return "2043-8";
+            case _20446: return "2044-6";
+            case _20453: return "2045-3";
+            case _20461: return "2046-1";
+            case _20479: return "2047-9";
+            case _20487: return "2048-7";
+            case _20495: return "2049-5";
+            case _20503: return "2050-3";
+            case _20511: return "2051-1";
+            case _20529: return "2052-9";
+            case _20545: return "2054-5";
+            case _20560: return "2056-0";
+            case _20586: return "2058-6";
+            case _20602: return "2060-2";
+            case _20610: return "2061-0";
+            case _20628: return "2062-8";
+            case _20636: return "2063-6";
+            case _20644: return "2064-4";
+            case _20651: return "2065-1";
+            case _20669: return "2066-9";
+            case _20677: return "2067-7";
+            case _20685: return "2068-5";
+            case _20693: return "2069-3";
+            case _20701: return "2070-1";
+            case _20719: return "2071-9";
+            case _20727: return "2072-7";
+            case _20735: return "2073-5";
+            case _20743: return "2074-3";
+            case _20750: return "2075-0";
+            case _20768: return "2076-8";
+            case _20784: return "2078-4";
+            case _20792: return "2079-2";
+            case _20800: return "2080-0";
+            case _20818: return "2081-8";
+            case _20826: return "2082-6";
+            case _20834: return "2083-4";
+            case _20859: return "2085-9";
+            case _20867: return "2086-7";
+            case _20875: return "2087-5";
+            case _20883: return "2088-3";
+            case _20891: return "2089-1";
+            case _20909: return "2090-9";
+            case _20917: return "2091-7";
+            case _20925: return "2092-5";
+            case _20933: return "2093-3";
+            case _20941: return "2094-1";
+            case _20958: return "2095-8";
+            case _20966: return "2096-6";
+            case _20974: return "2097-4";
+            case _20982: return "2098-2";
+            case _21006: return "2100-6";
+            case _21014: return "2101-4";
+            case _21022: return "2102-2";
+            case _21030: return "2103-0";
+            case _21048: return "2104-8";
+            case _25007: return "2500-7";
+            case _21063: return "2106-3";
+            case _21089: return "2108-9";
+            case _21097: return "2109-7";
+            case _21105: return "2110-5";
+            case _21113: return "2111-3";
+            case _21121: return "2112-1";
+            case _21139: return "2113-9";
+            case _21147: return "2114-7";
+            case _21154: return "2115-4";
+            case _21162: return "2116-2";
+            case _21188: return "2118-8";
+            case _21196: return "2119-6";
+            case _21204: return "2120-4";
+            case _21212: return "2121-2";
+            case _21220: return "2122-0";
+            case _21238: return "2123-8";
+            case _21246: return "2124-6";
+            case _21253: return "2125-3";
+            case _21261: return "2126-1";
+            case _21279: return "2127-9";
+            case _21295: return "2129-5";
+            case _21311: return "2131-1";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/Race";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _10025: return "American Indian or Alaska Native";
+            case _10041: return "American Indian";
+            case _10066: return "Abenaki";
+            case _10082: return "Algonquian";
+            case _10108: return "Apache";
+            case _10116: return "Chiricahua";
+            case _10124: return "Fort Sill Apache";
+            case _10132: return "Jicarilla Apache";
+            case _10140: return "Lipan Apache";
+            case _10157: return "Mescalero Apache";
+            case _10165: return "Oklahoma Apache";
+            case _10173: return "Payson Apache";
+            case _10181: return "San Carlos Apache";
+            case _10199: return "White Mountain Apache";
+            case _10215: return "Arapaho";
+            case _10223: return "Northern Arapaho";
+            case _10231: return "Southern Arapaho";
+            case _10249: return "Wind River Arapaho";
+            case _10264: return "Arikara";
+            case _10280: return "Assiniboine";
+            case _10306: return "Assiniboine Sioux";
+            case _10314: return "Fort Peck Assiniboine Sioux";
+            case _10330: return "Bannock";
+            case _10355: return "Blackfeet";
+            case _10371: return "Brotherton";
+            case _10397: return "Burt Lake Band";
+            case _10413: return "Caddo";
+            case _10421: return "Oklahoma Cado";
+            case _10447: return "Cahuilla";
+            case _10454: return "Agua Caliente Cahuilla";
+            case _10462: return "Augustine";
+            case _10470: return "Cabazon";
+            case _10488: return "Los Coyotes";
+            case _10496: return "Morongo";
+            case _10504: return "Santa Rosa Cahuilla";
+            case _10512: return "Torres-Martinez";
+            case _10538: return "California Tribes";
+            case _10546: return "Cahto";
+            case _10553: return "Chimariko";
+            case _10561: return "Coast Miwok";
+            case _10579: return "Digger";
+            case _10587: return "Kawaiisu";
+            case _10595: return "Kern River";
+            case _10603: return "Mattole";
+            case _10611: return "Red Wood";
+            case _10629: return "Santa Rosa";
+            case _10637: return "Takelma";
+            case _10645: return "Wappo";
+            case _10652: return "Yana";
+            case _10660: return "Yuki";
+            case _10686: return "Canadian and Latin American Indian";
+            case _10694: return "Canadian Indian";
+            case _10702: return "Central American Indian";
+            case _10710: return "French American Indian";
+            case _10728: return "Mexican American Indian";
+            case _10736: return "South American Indian";
+            case _10744: return "Spanish American Indian";
+            case _10769: return "Catawba";
+            case _17418: return "Alatna";
+            case _17426: return "Alexander";
+            case _17434: return "Allakaket";
+            case _17442: return "Alanvik";
+            case _17459: return "Anvik";
+            case _17467: return "Arctic";
+            case _17475: return "Beaver";
+            case _17483: return "Birch Creek";
+            case _17491: return "Cantwell";
+            case _17509: return "Chalkyitsik";
+            case _17517: return "Chickaloon";
+            case _17525: return "Chistochina";
+            case _17533: return "Chitina";
+            case _17541: return "Circle";
+            case _17558: return "Cook Inlet";
+            case _17566: return "Copper Center";
+            case _17574: return "Copper River";
+            case _17582: return "Dot Lake";
+            case _17590: return "Doyon";
+            case _17608: return "Eagle";
+            case _17616: return "Eklutna";
+            case _17624: return "Evansville";
+            case _17632: return "Fort Yukon";
+            case _17640: return "Gakona";
+            case _17657: return "Galena";
+            case _17665: return "Grayling";
+            case _17673: return "Gulkana";
+            case _17681: return "Healy Lake";
+            case _17699: return "Holy Cross";
+            case _17707: return "Hughes";
+            case _17715: return "Huslia";
+            case _17723: return "Iliamna";
+            case _17731: return "Kaltag";
+            case _17749: return "Kluti Kaah";
+            case _17756: return "Knik";
+            case _17764: return "Koyukuk";
+            case _17772: return "Lake Minchumina";
+            case _17780: return "Lime";
+            case _17798: return "Mcgrath";
+            case _17806: return "Manley Hot Springs";
+            case _17814: return "Mentasta Lake";
+            case _17822: return "Minto";
+            case _17830: return "Nenana";
+            case _17848: return "Nikolai";
+            case _17855: return "Ninilchik";
+            case _17863: return "Nondalton";
+            case _17871: return "Northway";
+            case _17889: return "Nulato";
+            case _17897: return "Pedro Bay";
+            case _17905: return "Rampart";
+            case _17913: return "Ruby";
+            case _17921: return "Salamatof";
+            case _17939: return "Seldovia";
+            case _17947: return "Slana";
+            case _17954: return "Shageluk";
+            case _17962: return "Stevens";
+            case _17970: return "Stony River";
+            case _17988: return "Takotna";
+            case _17996: return "Tanacross";
+            case _18002: return "Tanaina";
+            case _18010: return "Tanana";
+            case _18028: return "Tanana Chiefs";
+            case _18036: return "Tazlina";
+            case _18044: return "Telida";
+            case _18051: return "Tetlin";
+            case _18069: return "Tok";
+            case _18077: return "Tyonek";
+            case _18085: return "Venetie";
+            case _18093: return "Wiseman";
+            case _10785: return "Cayuse";
+            case _10801: return "Chehalis";
+            case _10827: return "Chemakuan";
+            case _10835: return "Hoh";
+            case _10843: return "Quileute";
+            case _10868: return "Chemehuevi";
+            case _10884: return "Cherokee";
+            case _10892: return "Cherokee Alabama";
+            case _10900: return "Cherokees of Northeast Alabama";
+            case _10918: return "Cherokees of Southeast Alabama";
+            case _10926: return "Eastern Cherokee";
+            case _10934: return "Echota Cherokee";
+            case _10942: return "Etowah Cherokee";
+            case _10959: return "Northern Cherokee";
+            case _10967: return "Tuscola";
+            case _10975: return "United Keetowah Band of Cherokee";
+            case _10983: return "Western Cherokee";
+            case _11007: return "Cherokee Shawnee";
+            case _11023: return "Cheyenne";
+            case _11031: return "Northern Cheyenne";
+            case _11049: return "Southern Cheyenne";
+            case _11064: return "Cheyenne-Arapaho";
+            case _11080: return "Chickahominy";
+            case _11098: return "Eastern Chickahominy";
+            case _11106: return "Western Chickahominy";
+            case _11122: return "Chickasaw";
+            case _11148: return "Chinook";
+            case _11155: return "Clatsop";
+            case _11163: return "Columbia River Chinook";
+            case _11171: return "Kathlamet";
+            case _11189: return "Upper Chinook";
+            case _11197: return "Wakiakum Chinook";
+            case _11205: return "Willapa Chinook";
+            case _11213: return "Wishram";
+            case _11239: return "Chippewa";
+            case _11247: return "Bad River";
+            case _11254: return "Bay Mills Chippewa";
+            case _11262: return "Bois Forte";
+            case _11270: return "Burt Lake Chippewa";
+            case _11288: return "Fond du Lac";
+            case _11296: return "Grand Portage";
+            case _11304: return "Grand Traverse Band of Ottawa-Chippewa";
+            case _11312: return "Keweenaw";
+            case _11320: return "Lac Courte Oreilles";
+            case _11338: return "Lac du Flambeau";
+            case _11346: return "Lac Vieux Desert Chippewa";
+            case _11353: return "Lake Superior";
+            case _11361: return "Leech Lake";
+            case _11379: return "Little Shell Chippewa";
+            case _11387: return "Mille Lacs";
+            case _11395: return "Minnesota Chippewa";
+            case _11403: return "Ontonagon";
+            case _11411: return "Red Cliff Chippewa";
+            case _11429: return "Red Lake Chippewa";
+            case _11437: return "Saginaw Chippewa";
+            case _11445: return "St. Croix Chippewa";
+            case _11452: return "Sault Ste. Marie Chippewa";
+            case _11460: return "Sokoagon Chippewa";
+            case _11478: return "Turtle Mountain";
+            case _11486: return "White Earth";
+            case _11502: return "Chippewa Cree";
+            case _11510: return "Rocky Boy's Chippewa Cree";
+            case _11536: return "Chitimacha";
+            case _11551: return "Choctaw";
+            case _11569: return "Clifton Choctaw";
+            case _11577: return "Jena Choctaw";
+            case _11585: return "Mississippi Choctaw";
+            case _11593: return "Mowa Band of Choctaw";
+            case _11601: return "Oklahoma Choctaw";
+            case _11627: return "Chumash";
+            case _11635: return "Santa Ynez";
+            case _11650: return "Clear Lake";
+            case _11676: return "Coeur D'Alene";
+            case _11692: return "Coharie";
+            case _11718: return "Colorado River";
+            case _11734: return "Colville";
+            case _11759: return "Comanche";
+            case _11767: return "Oklahoma Comanche";
+            case _11783: return "Coos, Lower Umpqua, Siuslaw";
+            case _11809: return "Coos";
+            case _11825: return "Coquilles";
+            case _11841: return "Costanoan";
+            case _11866: return "Coushatta";
+            case _11874: return "Alabama Coushatta";
+            case _11890: return "Cowlitz";
+            case _11916: return "Cree";
+            case _11932: return "Creek";
+            case _11940: return "Alabama Creek";
+            case _11957: return "Alabama Quassarte";
+            case _11965: return "Eastern Creek";
+            case _11973: return "Eastern Muscogee";
+            case _11981: return "Kialegee";
+            case _11999: return "Lower Muscogee";
+            case _12005: return "Machis Lower Creek Indian";
+            case _12013: return "Poarch Band";
+            case _12021: return "Principal Creek Indian Nation";
+            case _12039: return "Star Clan of Muscogee Creeks";
+            case _12047: return "Thlopthlocco";
+            case _12054: return "Tuckabachee";
+            case _12070: return "Croatan";
+            case _12096: return "Crow";
+            case _12112: return "Cupeno";
+            case _12120: return "Agua Caliente";
+            case _12146: return "Delaware";
+            case _12153: return "Eastern Delaware";
+            case _12161: return "Lenni-Lenape";
+            case _12179: return "Munsee";
+            case _12187: return "Oklahoma Delaware";
+            case _12195: return "Rampough Mountain";
+            case _12203: return "Sand Hill";
+            case _12229: return "Diegueno";
+            case _12237: return "Campo";
+            case _12245: return "Capitan Grande";
+            case _12252: return "Cuyapaipe";
+            case _12260: return "La Posta";
+            case _12278: return "Manzanita";
+            case _12286: return "Mesa Grande";
+            case _12294: return "San Pasqual";
+            case _12302: return "Santa Ysabel";
+            case _12310: return "Sycuan";
+            case _12336: return "Eastern Tribes";
+            case _12344: return "Attacapa";
+            case _12351: return "Biloxi";
+            case _12369: return "Georgetown";
+            case _12377: return "Moor";
+            case _12385: return "Nansemond";
+            case _12393: return "Natchez";
+            case _12401: return "Nausu Waiwash";
+            case _12419: return "Nipmuc";
+            case _12427: return "Paugussett";
+            case _12435: return "Pocomoke Acohonock";
+            case _12443: return "Southeastern Indians";
+            case _12450: return "Susquehanock";
+            case _12468: return "Tunica Biloxi";
+            case _12476: return "Waccamaw-Siousan";
+            case _12484: return "Wicomico";
+            case _12500: return "Esselen";
+            case _12526: return "Fort Belknap";
+            case _12542: return "Fort Berthold";
+            case _12567: return "Fort Mcdowell";
+            case _12583: return "Fort Hall";
+            case _12609: return "Gabrieleno";
+            case _12625: return "Grand Ronde";
+            case _12641: return "Gros Ventres";
+            case _12658: return "Atsina";
+            case _12674: return "Haliwa";
+            case _12690: return "Hidatsa";
+            case _12716: return "Hoopa";
+            case _12724: return "Trinity";
+            case _12732: return "Whilkut";
+            case _12757: return "Hoopa Extension";
+            case _12773: return "Houma";
+            case _12799: return "Inaja-Cosmit";
+            case _12815: return "Iowa";
+            case _12823: return "Iowa of Kansas-Nebraska";
+            case _12831: return "Iowa of Oklahoma";
+            case _12856: return "Iroquois";
+            case _12864: return "Cayuga";
+            case _12872: return "Mohawk";
+            case _12880: return "Oneida";
+            case _12898: return "Onondaga";
+            case _12906: return "Seneca";
+            case _12914: return "Seneca Nation";
+            case _12922: return "Seneca-Cayuga";
+            case _12930: return "Tonawanda Seneca";
+            case _12948: return "Tuscarora";
+            case _12955: return "Wyandotte";
+            case _12971: return "Juaneno";
+            case _12997: return "Kalispel";
+            case _13011: return "Karuk";
+            case _13037: return "Kaw";
+            case _13052: return "Kickapoo";
+            case _13060: return "Oklahoma Kickapoo";
+            case _13078: return "Texas Kickapoo";
+            case _13094: return "Kiowa";
+            case _13102: return "Oklahoma Kiowa";
+            case _13128: return "Klallam";
+            case _13136: return "Jamestown";
+            case _13144: return "Lower Elwha";
+            case _13151: return "Port Gamble Klallam";
+            case _13177: return "Klamath";
+            case _13193: return "Konkow";
+            case _13219: return "Kootenai";
+            case _13235: return "Lassik";
+            case _13250: return "Long Island";
+            case _13268: return "Matinecock";
+            case _13276: return "Montauk";
+            case _13284: return "Poospatuck";
+            case _13292: return "Setauket";
+            case _13318: return "Luiseno";
+            case _13326: return "La Jolla";
+            case _13334: return "Pala";
+            case _13342: return "Pauma";
+            case _13359: return "Pechanga";
+            case _13367: return "Soboba";
+            case _13375: return "Twenty-Nine Palms";
+            case _13383: return "Temecula";
+            case _13409: return "Lumbee";
+            case _13425: return "Lummi";
+            case _13441: return "Maidu";
+            case _13458: return "Mountain Maidu";
+            case _13466: return "Nishinam";
+            case _13482: return "Makah";
+            case _13508: return "Maliseet";
+            case _13524: return "Mandan";
+            case _13540: return "Mattaponi";
+            case _13565: return "Menominee";
+            case _13581: return "Miami";
+            case _13599: return "Illinois Miami";
+            case _13607: return "Indiana Miami";
+            case _13615: return "Oklahoma Miami";
+            case _13631: return "Miccosukee";
+            case _13656: return "Micmac";
+            case _13664: return "Aroostook";
+            case _13680: return "Mission Indians";
+            case _13706: return "Miwok";
+            case _13722: return "Modoc";
+            case _13748: return "Mohegan";
+            case _13763: return "Mono";
+            case _13789: return "Nanticoke";
+            case _13805: return "Narragansett";
+            case _13821: return "Navajo";
+            case _13839: return "Alamo Navajo";
+            case _13847: return "Canoncito Navajo";
+            case _13854: return "Ramah Navajo";
+            case _13870: return "Nez Perce";
+            case _13896: return "Nomalaki";
+            case _13912: return "Northwest Tribes";
+            case _13920: return "Alsea";
+            case _13938: return "Celilo";
+            case _13946: return "Columbia";
+            case _13953: return "Kalapuya";
+            case _13961: return "Molala";
+            case _13979: return "Talakamish";
+            case _13987: return "Tenino";
+            case _13995: return "Tillamook";
+            case _14001: return "Wenatchee";
+            case _14019: return "Yahooskin";
+            case _14035: return "Omaha";
+            case _14050: return "Oregon Athabaskan";
+            case _14076: return "Osage";
+            case _14092: return "Otoe-Missouria";
+            case _14118: return "Ottawa";
+            case _14126: return "Burt Lake Ottawa";
+            case _14134: return "Michigan Ottawa";
+            case _14142: return "Oklahoma Ottawa";
+            case _14167: return "Paiute";
+            case _14175: return "Bishop";
+            case _14183: return "Bridgeport";
+            case _14191: return "Burns Paiute";
+            case _14209: return "Cedarville";
+            case _14217: return "Fort Bidwell";
+            case _14225: return "Fort Independence";
+            case _14233: return "Kaibab";
+            case _14241: return "Las Vegas";
+            case _14258: return "Lone Pine";
+            case _14266: return "Lovelock";
+            case _14274: return "Malheur Paiute";
+            case _14282: return "Moapa";
+            case _14290: return "Northern Paiute";
+            case _14308: return "Owens Valley";
+            case _14316: return "Pyramid Lake";
+            case _14324: return "San Juan Southern Paiute";
+            case _14332: return "Southern Paiute";
+            case _14340: return "Summit Lake";
+            case _14357: return "Utu Utu Gwaitu Paiute";
+            case _14365: return "Walker River";
+            case _14373: return "Yerington Paiute";
+            case _14399: return "Pamunkey";
+            case _14415: return "Passamaquoddy";
+            case _14423: return "Indian Township";
+            case _14431: return "Pleasant Point Passamaquoddy";
+            case _14456: return "Pawnee";
+            case _14464: return "Oklahoma Pawnee";
+            case _14480: return "Penobscot";
+            case _14506: return "Peoria";
+            case _14514: return "Oklahoma Peoria";
+            case _14530: return "Pequot";
+            case _14548: return "Marshantucket Pequot";
+            case _14563: return "Pima";
+            case _14571: return "Gila River Pima-Maricopa";
+            case _14589: return "Salt River Pima-Maricopa";
+            case _14605: return "Piscataway";
+            case _14621: return "Pit River";
+            case _14647: return "Pomo";
+            case _14654: return "Central Pomo";
+            case _14662: return "Dry Creek";
+            case _14670: return "Eastern Pomo";
+            case _14688: return "Kashia";
+            case _14696: return "Northern Pomo";
+            case _14704: return "Scotts Valley";
+            case _14712: return "Stonyford";
+            case _14720: return "Sulphur Bank";
+            case _14746: return "Ponca";
+            case _14753: return "Nebraska Ponca";
+            case _14761: return "Oklahoma Ponca";
+            case _14787: return "Potawatomi";
+            case _14795: return "Citizen Band Potawatomi";
+            case _14803: return "Forest County";
+            case _14811: return "Hannahville";
+            case _14829: return "Huron Potawatomi";
+            case _14837: return "Pokagon Potawatomi";
+            case _14845: return "Prairie Band";
+            case _14852: return "Wisconsin Potawatomi";
+            case _14878: return "Powhatan";
+            case _14894: return "Pueblo";
+            case _14902: return "Acoma";
+            case _14910: return "Arizona Tewa";
+            case _14928: return "Cochiti";
+            case _14936: return "Hopi";
+            case _14944: return "Isleta";
+            case _14951: return "Jemez";
+            case _14969: return "Keres";
+            case _14977: return "Laguna";
+            case _14985: return "Nambe";
+            case _14993: return "Picuris";
+            case _15008: return "Piro";
+            case _15016: return "Pojoaque";
+            case _15024: return "San Felipe";
+            case _15032: return "San Ildefonso";
+            case _15040: return "San Juan Pueblo";
+            case _15057: return "San Juan De";
+            case _15065: return "San Juan";
+            case _15073: return "Sandia";
+            case _15081: return "Santa Ana";
+            case _15099: return "Santa Clara";
+            case _15107: return "Santo Domingo";
+            case _15115: return "Taos";
+            case _15123: return "Tesuque";
+            case _15131: return "Tewa";
+            case _15149: return "Tigua";
+            case _15156: return "Zia";
+            case _15164: return "Zuni";
+            case _15180: return "Puget Sound Salish";
+            case _15198: return "Duwamish";
+            case _15206: return "Kikiallus";
+            case _15214: return "Lower Skagit";
+            case _15222: return "Muckleshoot";
+            case _15230: return "Nisqually";
+            case _15248: return "Nooksack";
+            case _15255: return "Port Madison";
+            case _15263: return "Puyallup";
+            case _15271: return "Samish";
+            case _15289: return "Sauk-Suiattle";
+            case _15297: return "Skokomish";
+            case _15305: return "Skykomish";
+            case _15313: return "Snohomish";
+            case _15321: return "Snoqualmie";
+            case _15339: return "Squaxin Island";
+            case _15347: return "Steilacoom";
+            case _15354: return "Stillaguamish";
+            case _15362: return "Suquamish";
+            case _15370: return "Swinomish";
+            case _15388: return "Tulalip";
+            case _15396: return "Upper Skagit";
+            case _15412: return "Quapaw";
+            case _15438: return "Quinault";
+            case _15453: return "Rappahannock";
+            case _15479: return "Reno-Sparks";
+            case _15495: return "Round Valley";
+            case _15511: return "Sac and Fox";
+            case _15529: return "Iowa Sac and Fox";
+            case _15537: return "Missouri Sac and Fox";
+            case _15545: return "Oklahoma Sac and Fox";
+            case _15560: return "Salinan";
+            case _15586: return "Salish";
+            case _15602: return "Salish and Kootenai";
+            case _15628: return "Schaghticoke";
+            case _15644: return "Scott Valley";
+            case _15669: return "Seminole";
+            case _15677: return "Big Cypress";
+            case _15685: return "Brighton";
+            case _15693: return "Florida Seminole";
+            case _15701: return "Hollywood Seminole";
+            case _15719: return "Oklahoma Seminole";
+            case _15735: return "Serrano";
+            case _15743: return "San Manual";
+            case _15768: return "Shasta";
+            case _15784: return "Shawnee";
+            case _15792: return "Absentee Shawnee";
+            case _15800: return "Eastern Shawnee";
+            case _15826: return "Shinnecock";
+            case _15842: return "Shoalwater Bay";
+            case _15867: return "Shoshone";
+            case _15875: return "Battle Mountain";
+            case _15883: return "Duckwater";
+            case _15891: return "Elko";
+            case _15909: return "Ely";
+            case _15917: return "Goshute";
+            case _15925: return "Panamint";
+            case _15933: return "Ruby Valley";
+            case _15941: return "Skull Valley";
+            case _15958: return "South Fork Shoshone";
+            case _15966: return "Te-Moak Western Shoshone";
+            case _15974: return "Timbi-Sha Shoshone";
+            case _15982: return "Washakie";
+            case _15990: return "Wind River Shoshone";
+            case _16006: return "Yomba";
+            case _16022: return "Shoshone Paiute";
+            case _16030: return "Duck Valley";
+            case _16048: return "Fallon";
+            case _16055: return "Fort McDermitt";
+            case _16071: return "Siletz";
+            case _16097: return "Sioux";
+            case _16105: return "Blackfoot Sioux";
+            case _16113: return "Brule Sioux";
+            case _16121: return "Cheyenne River Sioux";
+            case _16139: return "Crow Creek Sioux";
+            case _16147: return "Dakota Sioux";
+            case _16154: return "Flandreau Santee";
+            case _16162: return "Fort Peck";
+            case _16170: return "Lake Traverse Sioux";
+            case _16188: return "Lower Brule Sioux";
+            case _16196: return "Lower Sioux";
+            case _16204: return "Mdewakanton Sioux";
+            case _16212: return "Miniconjou";
+            case _16220: return "Oglala Sioux";
+            case _16238: return "Pine Ridge Sioux";
+            case _16246: return "Pipestone Sioux";
+            case _16253: return "Prairie Island Sioux";
+            case _16261: return "Prior Lake Sioux";
+            case _16279: return "Rosebud Sioux";
+            case _16287: return "Sans Arc Sioux";
+            case _16295: return "Santee Sioux";
+            case _16303: return "Sisseton-Wahpeton";
+            case _16311: return "Sisseton Sioux";
+            case _16329: return "Spirit Lake Sioux";
+            case _16337: return "Standing Rock Sioux";
+            case _16345: return "Teton Sioux";
+            case _16352: return "Two Kettle Sioux";
+            case _16360: return "Upper Sioux";
+            case _16378: return "Wahpekute Sioux";
+            case _16386: return "Wahpeton Sioux";
+            case _16394: return "Wazhaza Sioux";
+            case _16402: return "Yankton Sioux";
+            case _16410: return "Yanktonai Sioux";
+            case _16436: return "Siuslaw";
+            case _16451: return "Spokane";
+            case _16477: return "Stewart";
+            case _16493: return "Stockbridge";
+            case _16519: return "Susanville";
+            case _16535: return "Tohono O'Odham";
+            case _16543: return "Ak-Chin";
+            case _16550: return "Gila Bend";
+            case _16568: return "San Xavier";
+            case _16576: return "Sells";
+            case _16592: return "Tolowa";
+            case _16618: return "Tonkawa";
+            case _16634: return "Tygh";
+            case _16659: return "Umatilla";
+            case _16675: return "Umpqua";
+            case _16683: return "Cow Creek Umpqua";
+            case _16709: return "Ute";
+            case _16717: return "Allen Canyon";
+            case _16725: return "Uintah Ute";
+            case _16733: return "Ute Mountain Ute";
+            case _16758: return "Wailaki";
+            case _16774: return "Walla-Walla";
+            case _16790: return "Wampanoag";
+            case _16808: return "Gay Head Wampanoag";
+            case _16816: return "Mashpee Wampanoag";
+            case _16832: return "Warm Springs";
+            case _16857: return "Wascopum";
+            case _16873: return "Washoe";
+            case _16881: return "Alpine";
+            case _16899: return "Carson";
+            case _16907: return "Dresslerville";
+            case _16923: return "Wichita";
+            case _16949: return "Wind River";
+            case _16964: return "Winnebago";
+            case _16972: return "Ho-chunk";
+            case _16980: return "Nebraska Winnebago";
+            case _17004: return "Winnemucca";
+            case _17020: return "Wintun";
+            case _17046: return "Wiyot";
+            case _17053: return "Table Bluff";
+            case _17079: return "Yakama";
+            case _17095: return "Yakama Cowlitz";
+            case _17111: return "Yaqui";
+            case _17129: return "Barrio Libre";
+            case _17137: return "Pascua Yaqui";
+            case _17152: return "Yavapai Apache";
+            case _17178: return "Yokuts";
+            case _17186: return "Chukchansi";
+            case _17194: return "Tachi";
+            case _17202: return "Tule River";
+            case _17228: return "Yuchi";
+            case _17244: return "Yuman";
+            case _17251: return "Cocopah";
+            case _17269: return "Havasupai";
+            case _17277: return "Hualapai";
+            case _17285: return "Maricopa";
+            case _17293: return "Mohave";
+            case _17301: return "Quechan";
+            case _17319: return "Yavapai";
+            case _17327: return "Yurok";
+            case _17335: return "Coast Yurok";
+            case _17350: return "Alaska Native";
+            case _17376: return "Alaska Indian";
+            case _17392: return "Alaskan Athabascan";
+            case _17400: return "Ahtna";
+            case _18119: return "Southeast Alaska";
+            case _18135: return "Tlingit-Haida";
+            case _18143: return "Angoon";
+            case _18150: return "Central Council of Tlingit and Haida Tribes";
+            case _18168: return "Chilkat";
+            case _18176: return "Chilkoot";
+            case _18184: return "Craig";
+            case _18192: return "Douglas";
+            case _18200: return "Haida";
+            case _18218: return "Hoonah";
+            case _18226: return "Hydaburg";
+            case _18234: return "Kake";
+            case _18242: return "Kasaan";
+            case _18259: return "Kenaitze";
+            case _18267: return "Ketchikan";
+            case _18275: return "Klawock";
+            case _18283: return "Pelican";
+            case _18291: return "Petersburg";
+            case _18309: return "Saxman";
+            case _18317: return "Sitka";
+            case _18325: return "Tenakee Springs";
+            case _18333: return "Tlingit";
+            case _18341: return "Wrangell";
+            case _18358: return "Yakutat";
+            case _18374: return "Tsimshian";
+            case _18382: return "Metlakatla";
+            case _18408: return "Eskimo";
+            case _18424: return "Greenland Eskimo";
+            case _18440: return "Inupiat Eskimo";
+            case _18457: return "Ambler";
+            case _18465: return "Anaktuvuk";
+            case _18473: return "Anaktuvuk Pass";
+            case _18481: return "Arctic Slope Inupiat";
+            case _18499: return "Arctic Slope Corporation";
+            case _18507: return "Atqasuk";
+            case _18515: return "Barrow";
+            case _18523: return "Bering Straits Inupiat";
+            case _18531: return "Brevig Mission";
+            case _18549: return "Buckland";
+            case _18556: return "Chinik";
+            case _18564: return "Council";
+            case _18572: return "Deering";
+            case _18580: return "Elim";
+            case _18598: return "Golovin";
+            case _18606: return "Inalik Diomede";
+            case _18614: return "Inupiaq";
+            case _18622: return "Kaktovik";
+            case _18630: return "Kawerak";
+            case _18648: return "Kiana";
+            case _18655: return "Kivalina";
+            case _18663: return "Kobuk";
+            case _18671: return "Kotzebue";
+            case _18689: return "Koyuk";
+            case _18697: return "Kwiguk";
+            case _18705: return "Mauneluk Inupiat";
+            case _18713: return "Nana Inupiat";
+            case _18721: return "Noatak";
+            case _18739: return "Nome";
+            case _18747: return "Noorvik";
+            case _18754: return "Nuiqsut";
+            case _18762: return "Point Hope";
+            case _18770: return "Point Lay";
+            case _18788: return "Selawik";
+            case _18796: return "Shaktoolik";
+            case _18804: return "Shishmaref";
+            case _18812: return "Shungnak";
+            case _18820: return "Solomon";
+            case _18838: return "Teller";
+            case _18846: return "Unalakleet";
+            case _18853: return "Wainwright";
+            case _18861: return "Wales";
+            case _18879: return "White Mountain";
+            case _18887: return "White Mountain Inupiat";
+            case _18895: return "Mary's Igloo";
+            case _18911: return "Siberian Eskimo";
+            case _18929: return "Gambell";
+            case _18937: return "Savoonga";
+            case _18945: return "Siberian Yupik";
+            case _18960: return "Yupik Eskimo";
+            case _18978: return "Akiachak";
+            case _18986: return "Akiak";
+            case _18994: return "Alakanuk";
+            case _19000: return "Aleknagik";
+            case _19018: return "Andreafsky";
+            case _19026: return "Aniak";
+            case _19034: return "Atmautluak";
+            case _19042: return "Bethel";
+            case _19059: return "Bill Moore's Slough";
+            case _19067: return "Bristol Bay Yupik";
+            case _19075: return "Calista Yupik";
+            case _19083: return "Chefornak";
+            case _19091: return "Chevak";
+            case _19109: return "Chuathbaluk";
+            case _19117: return "Clark's Point";
+            case _19125: return "Crooked Creek";
+            case _19133: return "Dillingham";
+            case _19141: return "Eek";
+            case _19158: return "Ekuk";
+            case _19166: return "Ekwok";
+            case _19174: return "Emmonak";
+            case _19182: return "Goodnews Bay";
+            case _19190: return "Hooper Bay";
+            case _19208: return "Iqurmuit (Russian Mission)";
+            case _19216: return "Kalskag";
+            case _19224: return "Kasigluk";
+            case _19232: return "Kipnuk";
+            case _19240: return "Koliganek";
+            case _19257: return "Kongiganak";
+            case _19265: return "Kotlik";
+            case _19273: return "Kwethluk";
+            case _19281: return "Kwigillingok";
+            case _19299: return "Levelock";
+            case _19307: return "Lower Kalskag";
+            case _19315: return "Manokotak";
+            case _19323: return "Marshall";
+            case _19331: return "Mekoryuk";
+            case _19349: return "Mountain Village";
+            case _19356: return "Naknek";
+            case _19364: return "Napaumute";
+            case _19372: return "Napakiak";
+            case _19380: return "Napaskiak";
+            case _19398: return "Newhalen";
+            case _19406: return "New Stuyahok";
+            case _19414: return "Newtok";
+            case _19422: return "Nightmute";
+            case _19430: return "Nunapitchukv";
+            case _19448: return "Oscarville";
+            case _19455: return "Pilot Station";
+            case _19463: return "Pitkas Point";
+            case _19471: return "Platinum";
+            case _19489: return "Portage Creek";
+            case _19497: return "Quinhagak";
+            case _19505: return "Red Devil";
+            case _19513: return "St. Michael";
+            case _19521: return "Scammon Bay";
+            case _19539: return "Sheldon's Point";
+            case _19547: return "Sleetmute";
+            case _19554: return "Stebbins";
+            case _19562: return "Togiak";
+            case _19570: return "Toksook";
+            case _19588: return "Tulukskak";
+            case _19596: return "Tuntutuliak";
+            case _19604: return "Tununak";
+            case _19612: return "Twin Hills";
+            case _19620: return "Georgetown";
+            case _19638: return "St. Mary's";
+            case _19646: return "Umkumiate";
+            case _19661: return "Aleut";
+            case _19687: return "Alutiiq Aleut";
+            case _19695: return "Tatitlek";
+            case _19703: return "Ugashik";
+            case _19729: return "Bristol Bay Aleut";
+            case _19737: return "Chignik";
+            case _19745: return "Chignik Lake";
+            case _19752: return "Egegik";
+            case _19760: return "Igiugig";
+            case _19778: return "Ivanof Bay";
+            case _19786: return "King Salmon";
+            case _19794: return "Kokhanok";
+            case _19802: return "Perryville";
+            case _19810: return "Pilot Point";
+            case _19828: return "Port Heiden";
+            case _19844: return "Chugach Aleut";
+            case _19851: return "Chenega";
+            case _19869: return "Chugach Corporation";
+            case _19877: return "English Bay";
+            case _19885: return "Port Graham";
+            case _19901: return "Eyak";
+            case _19927: return "Koniag Aleut";
+            case _19935: return "Akhiok";
+            case _19943: return "Agdaagux";
+            case _19950: return "Karluk";
+            case _19968: return "Kodiak";
+            case _19976: return "Larsen Bay";
+            case _19984: return "Old Harbor";
+            case _19992: return "Ouzinkie";
+            case _20008: return "Port Lions";
+            case _20024: return "Sugpiaq";
+            case _20040: return "Suqpigaq";
+            case _20065: return "Unangan Aleut";
+            case _20073: return "Akutan";
+            case _20081: return "Aleut Corporation";
+            case _20099: return "Aleutian";
+            case _20107: return "Aleutian Islander";
+            case _20115: return "Atka";
+            case _20123: return "Belkofski";
+            case _20131: return "Chignik Lagoon";
+            case _20149: return "King Cove";
+            case _20156: return "False Pass";
+            case _20164: return "Nelson Lagoon";
+            case _20172: return "Nikolski";
+            case _20180: return "Pauloff Harbor";
+            case _20198: return "Qagan Toyagungin";
+            case _20206: return "Qawalangin";
+            case _20214: return "St. George";
+            case _20222: return "St. Paul";
+            case _20230: return "Sand Point";
+            case _20248: return "South Naknek";
+            case _20255: return "Unalaska";
+            case _20263: return "Unga";
+            case _20289: return "Asian";
+            case _20297: return "Asian Indian";
+            case _20305: return "Bangladeshi";
+            case _20313: return "Bhutanese";
+            case _20321: return "Burmese";
+            case _20339: return "Cambodian";
+            case _20347: return "Chinese";
+            case _20354: return "Taiwanese";
+            case _20362: return "Filipino";
+            case _20370: return "Hmong";
+            case _20388: return "Indonesian";
+            case _20396: return "Japanese";
+            case _20404: return "Korean";
+            case _20412: return "Laotian";
+            case _20420: return "Malaysian";
+            case _20438: return "Okinawan";
+            case _20446: return "Pakistani";
+            case _20453: return "Sri Lankan";
+            case _20461: return "Thai";
+            case _20479: return "Vietnamese";
+            case _20487: return "Iwo Jiman";
+            case _20495: return "Maldivian";
+            case _20503: return "Nepalese";
+            case _20511: return "Singaporean";
+            case _20529: return "Madagascar";
+            case _20545: return "Black or African American";
+            case _20560: return "Black";
+            case _20586: return "African American";
+            case _20602: return "African";
+            case _20610: return "Botswanan";
+            case _20628: return "Ethiopian";
+            case _20636: return "Liberian";
+            case _20644: return "Namibian";
+            case _20651: return "Nigerian";
+            case _20669: return "Zairean";
+            case _20677: return "Bahamian";
+            case _20685: return "Barbadian";
+            case _20693: return "Dominican";
+            case _20701: return "Dominica Islander";
+            case _20719: return "Haitian";
+            case _20727: return "Jamaican";
+            case _20735: return "Tobagoan";
+            case _20743: return "Trinidadian";
+            case _20750: return "West Indian";
+            case _20768: return "Native Hawaiian or Other Pacific Islander";
+            case _20784: return "Polynesian";
+            case _20792: return "Native Hawaiian";
+            case _20800: return "Samoan";
+            case _20818: return "Tahitian";
+            case _20826: return "Tongan";
+            case _20834: return "Tokelauan";
+            case _20859: return "Micronesian";
+            case _20867: return "Guamanian or Chamorro";
+            case _20875: return "Guamanian";
+            case _20883: return "Chamorro";
+            case _20891: return "Mariana Islander";
+            case _20909: return "Marshallese";
+            case _20917: return "Palauan";
+            case _20925: return "Carolinian";
+            case _20933: return "Kosraean";
+            case _20941: return "Pohnpeian";
+            case _20958: return "Saipanese";
+            case _20966: return "Kiribati";
+            case _20974: return "Chuukese";
+            case _20982: return "Yapese";
+            case _21006: return "Melanesian";
+            case _21014: return "Fijian";
+            case _21022: return "Papua New Guinean";
+            case _21030: return "Solomon Islander";
+            case _21048: return "New Hebrides";
+            case _25007: return "Note that this term remains in the table for completeness, even though within HL7, the notion of Other code is deprecated.";
+            case _21063: return "White";
+            case _21089: return "European";
+            case _21097: return "Armenian";
+            case _21105: return "English";
+            case _21113: return "French";
+            case _21121: return "German";
+            case _21139: return "Irish";
+            case _21147: return "Italian";
+            case _21154: return "Polish";
+            case _21162: return "Scottish";
+            case _21188: return "Middle Eastern or North African";
+            case _21196: return "Assyrian";
+            case _21204: return "Egyptian";
+            case _21212: return "Iranian";
+            case _21220: return "Iraqi";
+            case _21238: return "Lebanese";
+            case _21246: return "Palestinian";
+            case _21253: return "Syrian";
+            case _21261: return "Afghanistani";
+            case _21279: return "Israeili";
+            case _21295: return "Arab";
+            case _21311: return "Note that this term remains in the table for completeness, even though within HL7, the notion of Other code is deprecated.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _10025: return "American Indian or Alaska Native";
+            case _10041: return "American Indian";
+            case _10066: return "Abenaki";
+            case _10082: return "Algonquian";
+            case _10108: return "Apache";
+            case _10116: return "Chiricahua";
+            case _10124: return "Fort Sill Apache";
+            case _10132: return "Jicarilla Apache";
+            case _10140: return "Lipan Apache";
+            case _10157: return "Mescalero Apache";
+            case _10165: return "Oklahoma Apache";
+            case _10173: return "Payson Apache";
+            case _10181: return "San Carlos Apache";
+            case _10199: return "White Mountain Apache";
+            case _10215: return "Arapaho";
+            case _10223: return "Northern Arapaho";
+            case _10231: return "Southern Arapaho";
+            case _10249: return "Wind River Arapaho";
+            case _10264: return "Arikara";
+            case _10280: return "Assiniboine";
+            case _10306: return "Assiniboine Sioux";
+            case _10314: return "Fort Peck Assiniboine Sioux";
+            case _10330: return "Bannock";
+            case _10355: return "Blackfeet";
+            case _10371: return "Brotherton";
+            case _10397: return "Burt Lake Band";
+            case _10413: return "Caddo";
+            case _10421: return "Oklahoma Cado";
+            case _10447: return "Cahuilla";
+            case _10454: return "Agua Caliente Cahuilla";
+            case _10462: return "Augustine";
+            case _10470: return "Cabazon";
+            case _10488: return "Los Coyotes";
+            case _10496: return "Morongo";
+            case _10504: return "Santa Rosa Cahuilla";
+            case _10512: return "Torres-Martinez";
+            case _10538: return "California Tribes";
+            case _10546: return "Cahto";
+            case _10553: return "Chimariko";
+            case _10561: return "Coast Miwok";
+            case _10579: return "Digger";
+            case _10587: return "Kawaiisu";
+            case _10595: return "Kern River";
+            case _10603: return "Mattole";
+            case _10611: return "Red Wood";
+            case _10629: return "Santa Rosa";
+            case _10637: return "Takelma";
+            case _10645: return "Wappo";
+            case _10652: return "Yana";
+            case _10660: return "Yuki";
+            case _10686: return "Canadian and Latin American Indian";
+            case _10694: return "Canadian Indian";
+            case _10702: return "Central American Indian";
+            case _10710: return "French American Indian";
+            case _10728: return "Mexican American Indian";
+            case _10736: return "South American Indian";
+            case _10744: return "Spanish American Indian";
+            case _10769: return "Catawba";
+            case _17418: return "Alatna";
+            case _17426: return "Alexander";
+            case _17434: return "Allakaket";
+            case _17442: return "Alanvik";
+            case _17459: return "Anvik";
+            case _17467: return "Arctic";
+            case _17475: return "Beaver";
+            case _17483: return "Birch Creek";
+            case _17491: return "Cantwell";
+            case _17509: return "Chalkyitsik";
+            case _17517: return "Chickaloon";
+            case _17525: return "Chistochina";
+            case _17533: return "Chitina";
+            case _17541: return "Circle";
+            case _17558: return "Cook Inlet";
+            case _17566: return "Copper Center";
+            case _17574: return "Copper River";
+            case _17582: return "Dot Lake";
+            case _17590: return "Doyon";
+            case _17608: return "Eagle";
+            case _17616: return "Eklutna";
+            case _17624: return "Evansville";
+            case _17632: return "Fort Yukon";
+            case _17640: return "Gakona";
+            case _17657: return "Galena";
+            case _17665: return "Grayling";
+            case _17673: return "Gulkana";
+            case _17681: return "Healy Lake";
+            case _17699: return "Holy Cross";
+            case _17707: return "Hughes";
+            case _17715: return "Huslia";
+            case _17723: return "Iliamna";
+            case _17731: return "Kaltag";
+            case _17749: return "Kluti Kaah";
+            case _17756: return "Knik";
+            case _17764: return "Koyukuk";
+            case _17772: return "Lake Minchumina";
+            case _17780: return "Lime";
+            case _17798: return "Mcgrath";
+            case _17806: return "Manley Hot Springs";
+            case _17814: return "Mentasta Lake";
+            case _17822: return "Minto";
+            case _17830: return "Nenana";
+            case _17848: return "Nikolai";
+            case _17855: return "Ninilchik";
+            case _17863: return "Nondalton";
+            case _17871: return "Northway";
+            case _17889: return "Nulato";
+            case _17897: return "Pedro Bay";
+            case _17905: return "Rampart";
+            case _17913: return "Ruby";
+            case _17921: return "Salamatof";
+            case _17939: return "Seldovia";
+            case _17947: return "Slana";
+            case _17954: return "Shageluk";
+            case _17962: return "Stevens";
+            case _17970: return "Stony River";
+            case _17988: return "Takotna";
+            case _17996: return "Tanacross";
+            case _18002: return "Tanaina";
+            case _18010: return "Tanana";
+            case _18028: return "Tanana Chiefs";
+            case _18036: return "Tazlina";
+            case _18044: return "Telida";
+            case _18051: return "Tetlin";
+            case _18069: return "Tok";
+            case _18077: return "Tyonek";
+            case _18085: return "Venetie";
+            case _18093: return "Wiseman";
+            case _10785: return "Cayuse";
+            case _10801: return "Chehalis";
+            case _10827: return "Chemakuan";
+            case _10835: return "Hoh";
+            case _10843: return "Quileute";
+            case _10868: return "Chemehuevi";
+            case _10884: return "Cherokee";
+            case _10892: return "Cherokee Alabama";
+            case _10900: return "Cherokees of Northeast Alabama";
+            case _10918: return "Cherokees of Southeast Alabama";
+            case _10926: return "Eastern Cherokee";
+            case _10934: return "Echota Cherokee";
+            case _10942: return "Etowah Cherokee";
+            case _10959: return "Northern Cherokee";
+            case _10967: return "Tuscola";
+            case _10975: return "United Keetowah Band of Cherokee";
+            case _10983: return "Western Cherokee";
+            case _11007: return "Cherokee Shawnee";
+            case _11023: return "Cheyenne";
+            case _11031: return "Northern Cheyenne";
+            case _11049: return "Southern Cheyenne";
+            case _11064: return "Cheyenne-Arapaho";
+            case _11080: return "Chickahominy";
+            case _11098: return "Eastern Chickahominy";
+            case _11106: return "Western Chickahominy";
+            case _11122: return "Chickasaw";
+            case _11148: return "Chinook";
+            case _11155: return "Clatsop";
+            case _11163: return "Columbia River Chinook";
+            case _11171: return "Kathlamet";
+            case _11189: return "Upper Chinook";
+            case _11197: return "Wakiakum Chinook";
+            case _11205: return "Willapa Chinook";
+            case _11213: return "Wishram";
+            case _11239: return "Chippewa";
+            case _11247: return "Bad River";
+            case _11254: return "Bay Mills Chippewa";
+            case _11262: return "Bois Forte";
+            case _11270: return "Burt Lake Chippewa";
+            case _11288: return "Fond du Lac";
+            case _11296: return "Grand Portage";
+            case _11304: return "Grand Traverse Band of Ottawa-Chippewa";
+            case _11312: return "Keweenaw";
+            case _11320: return "Lac Courte Oreilles";
+            case _11338: return "Lac du Flambeau";
+            case _11346: return "Lac Vieux Desert Chippewa";
+            case _11353: return "Lake Superior";
+            case _11361: return "Leech Lake";
+            case _11379: return "Little Shell Chippewa";
+            case _11387: return "Mille Lacs";
+            case _11395: return "Minnesota Chippewa";
+            case _11403: return "Ontonagon";
+            case _11411: return "Red Cliff Chippewa";
+            case _11429: return "Red Lake Chippewa";
+            case _11437: return "Saginaw Chippewa";
+            case _11445: return "St. Croix Chippewa";
+            case _11452: return "Sault Ste. Marie Chippewa";
+            case _11460: return "Sokoagon Chippewa";
+            case _11478: return "Turtle Mountain";
+            case _11486: return "White Earth";
+            case _11502: return "Chippewa Cree";
+            case _11510: return "Rocky Boy's Chippewa Cree";
+            case _11536: return "Chitimacha";
+            case _11551: return "Choctaw";
+            case _11569: return "Clifton Choctaw";
+            case _11577: return "Jena Choctaw";
+            case _11585: return "Mississippi Choctaw";
+            case _11593: return "Mowa Band of Choctaw";
+            case _11601: return "Oklahoma Choctaw";
+            case _11627: return "Chumash";
+            case _11635: return "Santa Ynez";
+            case _11650: return "Clear Lake";
+            case _11676: return "Coeur D'Alene";
+            case _11692: return "Coharie";
+            case _11718: return "Colorado River";
+            case _11734: return "Colville";
+            case _11759: return "Comanche";
+            case _11767: return "Oklahoma Comanche";
+            case _11783: return "Coos, Lower Umpqua, Siuslaw";
+            case _11809: return "Coos";
+            case _11825: return "Coquilles";
+            case _11841: return "Costanoan";
+            case _11866: return "Coushatta";
+            case _11874: return "Alabama Coushatta";
+            case _11890: return "Cowlitz";
+            case _11916: return "Cree";
+            case _11932: return "Creek";
+            case _11940: return "Alabama Creek";
+            case _11957: return "Alabama Quassarte";
+            case _11965: return "Eastern Creek";
+            case _11973: return "Eastern Muscogee";
+            case _11981: return "Kialegee";
+            case _11999: return "Lower Muscogee";
+            case _12005: return "Machis Lower Creek Indian";
+            case _12013: return "Poarch Band";
+            case _12021: return "Principal Creek Indian Nation";
+            case _12039: return "Star Clan of Muscogee Creeks";
+            case _12047: return "Thlopthlocco";
+            case _12054: return "Tuckabachee";
+            case _12070: return "Croatan";
+            case _12096: return "Crow";
+            case _12112: return "Cupeno";
+            case _12120: return "Agua Caliente";
+            case _12146: return "Delaware";
+            case _12153: return "Eastern Delaware";
+            case _12161: return "Lenni-Lenape";
+            case _12179: return "Munsee";
+            case _12187: return "Oklahoma Delaware";
+            case _12195: return "Rampough Mountain";
+            case _12203: return "Sand Hill";
+            case _12229: return "Diegueno";
+            case _12237: return "Campo";
+            case _12245: return "Capitan Grande";
+            case _12252: return "Cuyapaipe";
+            case _12260: return "La Posta";
+            case _12278: return "Manzanita";
+            case _12286: return "Mesa Grande";
+            case _12294: return "San Pasqual";
+            case _12302: return "Santa Ysabel";
+            case _12310: return "Sycuan";
+            case _12336: return "Eastern Tribes";
+            case _12344: return "Attacapa";
+            case _12351: return "Biloxi";
+            case _12369: return "Georgetown";
+            case _12377: return "Moor";
+            case _12385: return "Nansemond";
+            case _12393: return "Natchez";
+            case _12401: return "Nausu Waiwash";
+            case _12419: return "Nipmuc";
+            case _12427: return "Paugussett";
+            case _12435: return "Pocomoke Acohonock";
+            case _12443: return "Southeastern Indians";
+            case _12450: return "Susquehanock";
+            case _12468: return "Tunica Biloxi";
+            case _12476: return "Waccamaw-Siousan";
+            case _12484: return "Wicomico";
+            case _12500: return "Esselen";
+            case _12526: return "Fort Belknap";
+            case _12542: return "Fort Berthold";
+            case _12567: return "Fort Mcdowell";
+            case _12583: return "Fort Hall";
+            case _12609: return "Gabrieleno";
+            case _12625: return "Grand Ronde";
+            case _12641: return "Gros Ventres";
+            case _12658: return "Atsina";
+            case _12674: return "Haliwa";
+            case _12690: return "Hidatsa";
+            case _12716: return "Hoopa";
+            case _12724: return "Trinity";
+            case _12732: return "Whilkut";
+            case _12757: return "Hoopa Extension";
+            case _12773: return "Houma";
+            case _12799: return "Inaja-Cosmit";
+            case _12815: return "Iowa";
+            case _12823: return "Iowa of Kansas-Nebraska";
+            case _12831: return "Iowa of Oklahoma";
+            case _12856: return "Iroquois";
+            case _12864: return "Cayuga";
+            case _12872: return "Mohawk";
+            case _12880: return "Oneida";
+            case _12898: return "Onondaga";
+            case _12906: return "Seneca";
+            case _12914: return "Seneca Nation";
+            case _12922: return "Seneca-Cayuga";
+            case _12930: return "Tonawanda Seneca";
+            case _12948: return "Tuscarora";
+            case _12955: return "Wyandotte";
+            case _12971: return "Juaneno";
+            case _12997: return "Kalispel";
+            case _13011: return "Karuk";
+            case _13037: return "Kaw";
+            case _13052: return "Kickapoo";
+            case _13060: return "Oklahoma Kickapoo";
+            case _13078: return "Texas Kickapoo";
+            case _13094: return "Kiowa";
+            case _13102: return "Oklahoma Kiowa";
+            case _13128: return "Klallam";
+            case _13136: return "Jamestown";
+            case _13144: return "Lower Elwha";
+            case _13151: return "Port Gamble Klallam";
+            case _13177: return "Klamath";
+            case _13193: return "Konkow";
+            case _13219: return "Kootenai";
+            case _13235: return "Lassik";
+            case _13250: return "Long Island";
+            case _13268: return "Matinecock";
+            case _13276: return "Montauk";
+            case _13284: return "Poospatuck";
+            case _13292: return "Setauket";
+            case _13318: return "Luiseno";
+            case _13326: return "La Jolla";
+            case _13334: return "Pala";
+            case _13342: return "Pauma";
+            case _13359: return "Pechanga";
+            case _13367: return "Soboba";
+            case _13375: return "Twenty-Nine Palms";
+            case _13383: return "Temecula";
+            case _13409: return "Lumbee";
+            case _13425: return "Lummi";
+            case _13441: return "Maidu";
+            case _13458: return "Mountain Maidu";
+            case _13466: return "Nishinam";
+            case _13482: return "Makah";
+            case _13508: return "Maliseet";
+            case _13524: return "Mandan";
+            case _13540: return "Mattaponi";
+            case _13565: return "Menominee";
+            case _13581: return "Miami";
+            case _13599: return "Illinois Miami";
+            case _13607: return "Indiana Miami";
+            case _13615: return "Oklahoma Miami";
+            case _13631: return "Miccosukee";
+            case _13656: return "Micmac";
+            case _13664: return "Aroostook";
+            case _13680: return "Mission Indians";
+            case _13706: return "Miwok";
+            case _13722: return "Modoc";
+            case _13748: return "Mohegan";
+            case _13763: return "Mono";
+            case _13789: return "Nanticoke";
+            case _13805: return "Narragansett";
+            case _13821: return "Navajo";
+            case _13839: return "Alamo Navajo";
+            case _13847: return "Canoncito Navajo";
+            case _13854: return "Ramah Navajo";
+            case _13870: return "Nez Perce";
+            case _13896: return "Nomalaki";
+            case _13912: return "Northwest Tribes";
+            case _13920: return "Alsea";
+            case _13938: return "Celilo";
+            case _13946: return "Columbia";
+            case _13953: return "Kalapuya";
+            case _13961: return "Molala";
+            case _13979: return "Talakamish";
+            case _13987: return "Tenino";
+            case _13995: return "Tillamook";
+            case _14001: return "Wenatchee";
+            case _14019: return "Yahooskin";
+            case _14035: return "Omaha";
+            case _14050: return "Oregon Athabaskan";
+            case _14076: return "Osage";
+            case _14092: return "Otoe-Missouria";
+            case _14118: return "Ottawa";
+            case _14126: return "Burt Lake Ottawa";
+            case _14134: return "Michigan Ottawa";
+            case _14142: return "Oklahoma Ottawa";
+            case _14167: return "Paiute";
+            case _14175: return "Bishop";
+            case _14183: return "Bridgeport";
+            case _14191: return "Burns Paiute";
+            case _14209: return "Cedarville";
+            case _14217: return "Fort Bidwell";
+            case _14225: return "Fort Independence";
+            case _14233: return "Kaibab";
+            case _14241: return "Las Vegas";
+            case _14258: return "Lone Pine";
+            case _14266: return "Lovelock";
+            case _14274: return "Malheur Paiute";
+            case _14282: return "Moapa";
+            case _14290: return "Northern Paiute";
+            case _14308: return "Owens Valley";
+            case _14316: return "Pyramid Lake";
+            case _14324: return "San Juan Southern Paiute";
+            case _14332: return "Southern Paiute";
+            case _14340: return "Summit Lake";
+            case _14357: return "Utu Utu Gwaitu Paiute";
+            case _14365: return "Walker River";
+            case _14373: return "Yerington Paiute";
+            case _14399: return "Pamunkey";
+            case _14415: return "Passamaquoddy";
+            case _14423: return "Indian Township";
+            case _14431: return "Pleasant Point Passamaquoddy";
+            case _14456: return "Pawnee";
+            case _14464: return "Oklahoma Pawnee";
+            case _14480: return "Penobscot";
+            case _14506: return "Peoria";
+            case _14514: return "Oklahoma Peoria";
+            case _14530: return "Pequot";
+            case _14548: return "Marshantucket Pequot";
+            case _14563: return "Pima";
+            case _14571: return "Gila River Pima-Maricopa";
+            case _14589: return "Salt River Pima-Maricopa";
+            case _14605: return "Piscataway";
+            case _14621: return "Pit River";
+            case _14647: return "Pomo";
+            case _14654: return "Central Pomo";
+            case _14662: return "Dry Creek";
+            case _14670: return "Eastern Pomo";
+            case _14688: return "Kashia";
+            case _14696: return "Northern Pomo";
+            case _14704: return "Scotts Valley";
+            case _14712: return "Stonyford";
+            case _14720: return "Sulphur Bank";
+            case _14746: return "Ponca";
+            case _14753: return "Nebraska Ponca";
+            case _14761: return "Oklahoma Ponca";
+            case _14787: return "Potawatomi";
+            case _14795: return "Citizen Band Potawatomi";
+            case _14803: return "Forest County";
+            case _14811: return "Hannahville";
+            case _14829: return "Huron Potawatomi";
+            case _14837: return "Pokagon Potawatomi";
+            case _14845: return "Prairie Band";
+            case _14852: return "Wisconsin Potawatomi";
+            case _14878: return "Powhatan";
+            case _14894: return "Pueblo";
+            case _14902: return "Acoma";
+            case _14910: return "Arizona Tewa";
+            case _14928: return "Cochiti";
+            case _14936: return "Hopi";
+            case _14944: return "Isleta";
+            case _14951: return "Jemez";
+            case _14969: return "Keres";
+            case _14977: return "Laguna";
+            case _14985: return "Nambe";
+            case _14993: return "Picuris";
+            case _15008: return "Piro";
+            case _15016: return "Pojoaque";
+            case _15024: return "San Felipe";
+            case _15032: return "San Ildefonso";
+            case _15040: return "San Juan Pueblo";
+            case _15057: return "San Juan De";
+            case _15065: return "San Juan";
+            case _15073: return "Sandia";
+            case _15081: return "Santa Ana";
+            case _15099: return "Santa Clara";
+            case _15107: return "Santo Domingo";
+            case _15115: return "Taos";
+            case _15123: return "Tesuque";
+            case _15131: return "Tewa";
+            case _15149: return "Tigua";
+            case _15156: return "Zia";
+            case _15164: return "Zuni";
+            case _15180: return "Puget Sound Salish";
+            case _15198: return "Duwamish";
+            case _15206: return "Kikiallus";
+            case _15214: return "Lower Skagit";
+            case _15222: return "Muckleshoot";
+            case _15230: return "Nisqually";
+            case _15248: return "Nooksack";
+            case _15255: return "Port Madison";
+            case _15263: return "Puyallup";
+            case _15271: return "Samish";
+            case _15289: return "Sauk-Suiattle";
+            case _15297: return "Skokomish";
+            case _15305: return "Skykomish";
+            case _15313: return "Snohomish";
+            case _15321: return "Snoqualmie";
+            case _15339: return "Squaxin Island";
+            case _15347: return "Steilacoom";
+            case _15354: return "Stillaguamish";
+            case _15362: return "Suquamish";
+            case _15370: return "Swinomish";
+            case _15388: return "Tulalip";
+            case _15396: return "Upper Skagit";
+            case _15412: return "Quapaw";
+            case _15438: return "Quinault";
+            case _15453: return "Rappahannock";
+            case _15479: return "Reno-Sparks";
+            case _15495: return "Round Valley";
+            case _15511: return "Sac and Fox";
+            case _15529: return "Iowa Sac and Fox";
+            case _15537: return "Missouri Sac and Fox";
+            case _15545: return "Oklahoma Sac and Fox";
+            case _15560: return "Salinan";
+            case _15586: return "Salish";
+            case _15602: return "Salish and Kootenai";
+            case _15628: return "Schaghticoke";
+            case _15644: return "Scott Valley";
+            case _15669: return "Seminole";
+            case _15677: return "Big Cypress";
+            case _15685: return "Brighton";
+            case _15693: return "Florida Seminole";
+            case _15701: return "Hollywood Seminole";
+            case _15719: return "Oklahoma Seminole";
+            case _15735: return "Serrano";
+            case _15743: return "San Manual";
+            case _15768: return "Shasta";
+            case _15784: return "Shawnee";
+            case _15792: return "Absentee Shawnee";
+            case _15800: return "Eastern Shawnee";
+            case _15826: return "Shinnecock";
+            case _15842: return "Shoalwater Bay";
+            case _15867: return "Shoshone";
+            case _15875: return "Battle Mountain";
+            case _15883: return "Duckwater";
+            case _15891: return "Elko";
+            case _15909: return "Ely";
+            case _15917: return "Goshute";
+            case _15925: return "Panamint";
+            case _15933: return "Ruby Valley";
+            case _15941: return "Skull Valley";
+            case _15958: return "South Fork Shoshone";
+            case _15966: return "Te-Moak Western Shoshone";
+            case _15974: return "Timbi-Sha Shoshone";
+            case _15982: return "Washakie";
+            case _15990: return "Wind River Shoshone";
+            case _16006: return "Yomba";
+            case _16022: return "Shoshone Paiute";
+            case _16030: return "Duck Valley";
+            case _16048: return "Fallon";
+            case _16055: return "Fort McDermitt";
+            case _16071: return "Siletz";
+            case _16097: return "Sioux";
+            case _16105: return "Blackfoot Sioux";
+            case _16113: return "Brule Sioux";
+            case _16121: return "Cheyenne River Sioux";
+            case _16139: return "Crow Creek Sioux";
+            case _16147: return "Dakota Sioux";
+            case _16154: return "Flandreau Santee";
+            case _16162: return "Fort Peck";
+            case _16170: return "Lake Traverse Sioux";
+            case _16188: return "Lower Brule Sioux";
+            case _16196: return "Lower Sioux";
+            case _16204: return "Mdewakanton Sioux";
+            case _16212: return "Miniconjou";
+            case _16220: return "Oglala Sioux";
+            case _16238: return "Pine Ridge Sioux";
+            case _16246: return "Pipestone Sioux";
+            case _16253: return "Prairie Island Sioux";
+            case _16261: return "Prior Lake Sioux";
+            case _16279: return "Rosebud Sioux";
+            case _16287: return "Sans Arc Sioux";
+            case _16295: return "Santee Sioux";
+            case _16303: return "Sisseton-Wahpeton";
+            case _16311: return "Sisseton Sioux";
+            case _16329: return "Spirit Lake Sioux";
+            case _16337: return "Standing Rock Sioux";
+            case _16345: return "Teton Sioux";
+            case _16352: return "Two Kettle Sioux";
+            case _16360: return "Upper Sioux";
+            case _16378: return "Wahpekute Sioux";
+            case _16386: return "Wahpeton Sioux";
+            case _16394: return "Wazhaza Sioux";
+            case _16402: return "Yankton Sioux";
+            case _16410: return "Yanktonai Sioux";
+            case _16436: return "Siuslaw";
+            case _16451: return "Spokane";
+            case _16477: return "Stewart";
+            case _16493: return "Stockbridge";
+            case _16519: return "Susanville";
+            case _16535: return "Tohono O'Odham";
+            case _16543: return "Ak-Chin";
+            case _16550: return "Gila Bend";
+            case _16568: return "San Xavier";
+            case _16576: return "Sells";
+            case _16592: return "Tolowa";
+            case _16618: return "Tonkawa";
+            case _16634: return "Tygh";
+            case _16659: return "Umatilla";
+            case _16675: return "Umpqua";
+            case _16683: return "Cow Creek Umpqua";
+            case _16709: return "Ute";
+            case _16717: return "Allen Canyon";
+            case _16725: return "Uintah Ute";
+            case _16733: return "Ute Mountain Ute";
+            case _16758: return "Wailaki";
+            case _16774: return "Walla-Walla";
+            case _16790: return "Wampanoag";
+            case _16808: return "Gay Head Wampanoag";
+            case _16816: return "Mashpee Wampanoag";
+            case _16832: return "Warm Springs";
+            case _16857: return "Wascopum";
+            case _16873: return "Washoe";
+            case _16881: return "Alpine";
+            case _16899: return "Carson";
+            case _16907: return "Dresslerville";
+            case _16923: return "Wichita";
+            case _16949: return "Wind River";
+            case _16964: return "Winnebago";
+            case _16972: return "Ho-chunk";
+            case _16980: return "Nebraska Winnebago";
+            case _17004: return "Winnemucca";
+            case _17020: return "Wintun";
+            case _17046: return "Wiyot";
+            case _17053: return "Table Bluff";
+            case _17079: return "Yakama";
+            case _17095: return "Yakama Cowlitz";
+            case _17111: return "Yaqui";
+            case _17129: return "Barrio Libre";
+            case _17137: return "Pascua Yaqui";
+            case _17152: return "Yavapai Apache";
+            case _17178: return "Yokuts";
+            case _17186: return "Chukchansi";
+            case _17194: return "Tachi";
+            case _17202: return "Tule River";
+            case _17228: return "Yuchi";
+            case _17244: return "Yuman";
+            case _17251: return "Cocopah";
+            case _17269: return "Havasupai";
+            case _17277: return "Hualapai";
+            case _17285: return "Maricopa";
+            case _17293: return "Mohave";
+            case _17301: return "Quechan";
+            case _17319: return "Yavapai";
+            case _17327: return "Yurok";
+            case _17335: return "Coast Yurok";
+            case _17350: return "Alaska Native";
+            case _17376: return "Alaska Indian";
+            case _17392: return "Alaskan Athabascan";
+            case _17400: return "Ahtna";
+            case _18119: return "Southeast Alaska";
+            case _18135: return "Tlingit-Haida";
+            case _18143: return "Angoon";
+            case _18150: return "Central Council of Tlingit and Haida Tribes";
+            case _18168: return "Chilkat";
+            case _18176: return "Chilkoot";
+            case _18184: return "Craig";
+            case _18192: return "Douglas";
+            case _18200: return "Haida";
+            case _18218: return "Hoonah";
+            case _18226: return "Hydaburg";
+            case _18234: return "Kake";
+            case _18242: return "Kasaan";
+            case _18259: return "Kenaitze";
+            case _18267: return "Ketchikan";
+            case _18275: return "Klawock";
+            case _18283: return "Pelican";
+            case _18291: return "Petersburg";
+            case _18309: return "Saxman";
+            case _18317: return "Sitka";
+            case _18325: return "Tenakee Springs";
+            case _18333: return "Tlingit";
+            case _18341: return "Wrangell";
+            case _18358: return "Yakutat";
+            case _18374: return "Tsimshian";
+            case _18382: return "Metlakatla";
+            case _18408: return "Eskimo";
+            case _18424: return "Greenland Eskimo";
+            case _18440: return "Inupiat Eskimo";
+            case _18457: return "Ambler";
+            case _18465: return "Anaktuvuk";
+            case _18473: return "Anaktuvuk Pass";
+            case _18481: return "Arctic Slope Inupiat";
+            case _18499: return "Arctic Slope Corporation";
+            case _18507: return "Atqasuk";
+            case _18515: return "Barrow";
+            case _18523: return "Bering Straits Inupiat";
+            case _18531: return "Brevig Mission";
+            case _18549: return "Buckland";
+            case _18556: return "Chinik";
+            case _18564: return "Council";
+            case _18572: return "Deering";
+            case _18580: return "Elim";
+            case _18598: return "Golovin";
+            case _18606: return "Inalik Diomede";
+            case _18614: return "Inupiaq";
+            case _18622: return "Kaktovik";
+            case _18630: return "Kawerak";
+            case _18648: return "Kiana";
+            case _18655: return "Kivalina";
+            case _18663: return "Kobuk";
+            case _18671: return "Kotzebue";
+            case _18689: return "Koyuk";
+            case _18697: return "Kwiguk";
+            case _18705: return "Mauneluk Inupiat";
+            case _18713: return "Nana Inupiat";
+            case _18721: return "Noatak";
+            case _18739: return "Nome";
+            case _18747: return "Noorvik";
+            case _18754: return "Nuiqsut";
+            case _18762: return "Point Hope";
+            case _18770: return "Point Lay";
+            case _18788: return "Selawik";
+            case _18796: return "Shaktoolik";
+            case _18804: return "Shishmaref";
+            case _18812: return "Shungnak";
+            case _18820: return "Solomon";
+            case _18838: return "Teller";
+            case _18846: return "Unalakleet";
+            case _18853: return "Wainwright";
+            case _18861: return "Wales";
+            case _18879: return "White Mountain";
+            case _18887: return "White Mountain Inupiat";
+            case _18895: return "Mary's Igloo";
+            case _18911: return "Siberian Eskimo";
+            case _18929: return "Gambell";
+            case _18937: return "Savoonga";
+            case _18945: return "Siberian Yupik";
+            case _18960: return "Yupik Eskimo";
+            case _18978: return "Akiachak";
+            case _18986: return "Akiak";
+            case _18994: return "Alakanuk";
+            case _19000: return "Aleknagik";
+            case _19018: return "Andreafsky";
+            case _19026: return "Aniak";
+            case _19034: return "Atmautluak";
+            case _19042: return "Bethel";
+            case _19059: return "Bill Moore's Slough";
+            case _19067: return "Bristol Bay Yupik";
+            case _19075: return "Calista Yupik";
+            case _19083: return "Chefornak";
+            case _19091: return "Chevak";
+            case _19109: return "Chuathbaluk";
+            case _19117: return "Clark's Point";
+            case _19125: return "Crooked Creek";
+            case _19133: return "Dillingham";
+            case _19141: return "Eek";
+            case _19158: return "Ekuk";
+            case _19166: return "Ekwok";
+            case _19174: return "Emmonak";
+            case _19182: return "Goodnews Bay";
+            case _19190: return "Hooper Bay";
+            case _19208: return "Iqurmuit (Russian Mission)";
+            case _19216: return "Kalskag";
+            case _19224: return "Kasigluk";
+            case _19232: return "Kipnuk";
+            case _19240: return "Koliganek";
+            case _19257: return "Kongiganak";
+            case _19265: return "Kotlik";
+            case _19273: return "Kwethluk";
+            case _19281: return "Kwigillingok";
+            case _19299: return "Levelock";
+            case _19307: return "Lower Kalskag";
+            case _19315: return "Manokotak";
+            case _19323: return "Marshall";
+            case _19331: return "Mekoryuk";
+            case _19349: return "Mountain Village";
+            case _19356: return "Naknek";
+            case _19364: return "Napaumute";
+            case _19372: return "Napakiak";
+            case _19380: return "Napaskiak";
+            case _19398: return "Newhalen";
+            case _19406: return "New Stuyahok";
+            case _19414: return "Newtok";
+            case _19422: return "Nightmute";
+            case _19430: return "Nunapitchukv";
+            case _19448: return "Oscarville";
+            case _19455: return "Pilot Station";
+            case _19463: return "Pitkas Point";
+            case _19471: return "Platinum";
+            case _19489: return "Portage Creek";
+            case _19497: return "Quinhagak";
+            case _19505: return "Red Devil";
+            case _19513: return "St. Michael";
+            case _19521: return "Scammon Bay";
+            case _19539: return "Sheldon's Point";
+            case _19547: return "Sleetmute";
+            case _19554: return "Stebbins";
+            case _19562: return "Togiak";
+            case _19570: return "Toksook";
+            case _19588: return "Tulukskak";
+            case _19596: return "Tuntutuliak";
+            case _19604: return "Tununak";
+            case _19612: return "Twin Hills";
+            case _19620: return "Georgetown";
+            case _19638: return "St. Mary's";
+            case _19646: return "Umkumiate";
+            case _19661: return "Aleut";
+            case _19687: return "Alutiiq Aleut";
+            case _19695: return "Tatitlek";
+            case _19703: return "Ugashik";
+            case _19729: return "Bristol Bay Aleut";
+            case _19737: return "Chignik";
+            case _19745: return "Chignik Lake";
+            case _19752: return "Egegik";
+            case _19760: return "Igiugig";
+            case _19778: return "Ivanof Bay";
+            case _19786: return "King Salmon";
+            case _19794: return "Kokhanok";
+            case _19802: return "Perryville";
+            case _19810: return "Pilot Point";
+            case _19828: return "Port Heiden";
+            case _19844: return "Chugach Aleut";
+            case _19851: return "Chenega";
+            case _19869: return "Chugach Corporation";
+            case _19877: return "English Bay";
+            case _19885: return "Port Graham";
+            case _19901: return "Eyak";
+            case _19927: return "Koniag Aleut";
+            case _19935: return "Akhiok";
+            case _19943: return "Agdaagux";
+            case _19950: return "Karluk";
+            case _19968: return "Kodiak";
+            case _19976: return "Larsen Bay";
+            case _19984: return "Old Harbor";
+            case _19992: return "Ouzinkie";
+            case _20008: return "Port Lions";
+            case _20024: return "Sugpiaq";
+            case _20040: return "Suqpigaq";
+            case _20065: return "Unangan Aleut";
+            case _20073: return "Akutan";
+            case _20081: return "Aleut Corporation";
+            case _20099: return "Aleutian";
+            case _20107: return "Aleutian Islander";
+            case _20115: return "Atka";
+            case _20123: return "Belkofski";
+            case _20131: return "Chignik Lagoon";
+            case _20149: return "King Cove";
+            case _20156: return "False Pass";
+            case _20164: return "Nelson Lagoon";
+            case _20172: return "Nikolski";
+            case _20180: return "Pauloff Harbor";
+            case _20198: return "Qagan Toyagungin";
+            case _20206: return "Qawalangin";
+            case _20214: return "St. George";
+            case _20222: return "St. Paul";
+            case _20230: return "Sand Point";
+            case _20248: return "South Naknek";
+            case _20255: return "Unalaska";
+            case _20263: return "Unga";
+            case _20289: return "Asian";
+            case _20297: return "Asian Indian";
+            case _20305: return "Bangladeshi";
+            case _20313: return "Bhutanese";
+            case _20321: return "Burmese";
+            case _20339: return "Cambodian";
+            case _20347: return "Chinese";
+            case _20354: return "Taiwanese";
+            case _20362: return "Filipino";
+            case _20370: return "Hmong";
+            case _20388: return "Indonesian";
+            case _20396: return "Japanese";
+            case _20404: return "Korean";
+            case _20412: return "Laotian";
+            case _20420: return "Malaysian";
+            case _20438: return "Okinawan";
+            case _20446: return "Pakistani";
+            case _20453: return "Sri Lankan";
+            case _20461: return "Thai";
+            case _20479: return "Vietnamese";
+            case _20487: return "Iwo Jiman";
+            case _20495: return "Maldivian";
+            case _20503: return "Nepalese";
+            case _20511: return "Singaporean";
+            case _20529: return "Madagascar";
+            case _20545: return "Black or African American";
+            case _20560: return "Black";
+            case _20586: return "African American";
+            case _20602: return "African";
+            case _20610: return "Botswanan";
+            case _20628: return "Ethiopian";
+            case _20636: return "Liberian";
+            case _20644: return "Namibian";
+            case _20651: return "Nigerian";
+            case _20669: return "Zairean";
+            case _20677: return "Bahamian";
+            case _20685: return "Barbadian";
+            case _20693: return "Dominican";
+            case _20701: return "Dominica Islander";
+            case _20719: return "Haitian";
+            case _20727: return "Jamaican";
+            case _20735: return "Tobagoan";
+            case _20743: return "Trinidadian";
+            case _20750: return "West Indian";
+            case _20768: return "Native Hawaiian or Other Pacific Islander";
+            case _20784: return "Polynesian";
+            case _20792: return "Native Hawaiian";
+            case _20800: return "Samoan";
+            case _20818: return "Tahitian";
+            case _20826: return "Tongan";
+            case _20834: return "Tokelauan";
+            case _20859: return "Micronesian";
+            case _20867: return "Guamanian or Chamorro";
+            case _20875: return "Guamanian";
+            case _20883: return "Chamorro";
+            case _20891: return "Mariana Islander";
+            case _20909: return "Marshallese";
+            case _20917: return "Palauan";
+            case _20925: return "Carolinian";
+            case _20933: return "Kosraean";
+            case _20941: return "Pohnpeian";
+            case _20958: return "Saipanese";
+            case _20966: return "Kiribati";
+            case _20974: return "Chuukese";
+            case _20982: return "Yapese";
+            case _21006: return "Melanesian";
+            case _21014: return "Fijian";
+            case _21022: return "Papua New Guinean";
+            case _21030: return "Solomon Islander";
+            case _21048: return "New Hebrides";
+            case _25007: return "Other Pacific Islander";
+            case _21063: return "White";
+            case _21089: return "European";
+            case _21097: return "Armenian";
+            case _21105: return "English";
+            case _21113: return "French";
+            case _21121: return "German";
+            case _21139: return "Irish";
+            case _21147: return "Italian";
+            case _21154: return "Polish";
+            case _21162: return "Scottish";
+            case _21188: return "Middle Eastern or North African";
+            case _21196: return "Assyrian";
+            case _21204: return "Egyptian";
+            case _21212: return "Iranian";
+            case _21220: return "Iraqi";
+            case _21238: return "Lebanese";
+            case _21246: return "Palestinian";
+            case _21253: return "Syrian";
+            case _21261: return "Afghanistani";
+            case _21279: return "Israeili";
+            case _21295: return "Arab";
+            case _21311: return "Other Race";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RaceEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RaceEnumFactory.java
new file mode 100644
index 00000000000..180c857a5b9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RaceEnumFactory.java
@@ -0,0 +1,3738 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3RaceEnumFactory implements EnumFactory {
+
+  public V3Race fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1002-5".equals(codeString))
+      return V3Race._10025;
+    if ("1004-1".equals(codeString))
+      return V3Race._10041;
+    if ("1006-6".equals(codeString))
+      return V3Race._10066;
+    if ("1008-2".equals(codeString))
+      return V3Race._10082;
+    if ("1010-8".equals(codeString))
+      return V3Race._10108;
+    if ("1011-6".equals(codeString))
+      return V3Race._10116;
+    if ("1012-4".equals(codeString))
+      return V3Race._10124;
+    if ("1013-2".equals(codeString))
+      return V3Race._10132;
+    if ("1014-0".equals(codeString))
+      return V3Race._10140;
+    if ("1015-7".equals(codeString))
+      return V3Race._10157;
+    if ("1016-5".equals(codeString))
+      return V3Race._10165;
+    if ("1017-3".equals(codeString))
+      return V3Race._10173;
+    if ("1018-1".equals(codeString))
+      return V3Race._10181;
+    if ("1019-9".equals(codeString))
+      return V3Race._10199;
+    if ("1021-5".equals(codeString))
+      return V3Race._10215;
+    if ("1022-3".equals(codeString))
+      return V3Race._10223;
+    if ("1023-1".equals(codeString))
+      return V3Race._10231;
+    if ("1024-9".equals(codeString))
+      return V3Race._10249;
+    if ("1026-4".equals(codeString))
+      return V3Race._10264;
+    if ("1028-0".equals(codeString))
+      return V3Race._10280;
+    if ("1030-6".equals(codeString))
+      return V3Race._10306;
+    if ("1031-4".equals(codeString))
+      return V3Race._10314;
+    if ("1033-0".equals(codeString))
+      return V3Race._10330;
+    if ("1035-5".equals(codeString))
+      return V3Race._10355;
+    if ("1037-1".equals(codeString))
+      return V3Race._10371;
+    if ("1039-7".equals(codeString))
+      return V3Race._10397;
+    if ("1041-3".equals(codeString))
+      return V3Race._10413;
+    if ("1042-1".equals(codeString))
+      return V3Race._10421;
+    if ("1044-7".equals(codeString))
+      return V3Race._10447;
+    if ("1045-4".equals(codeString))
+      return V3Race._10454;
+    if ("1046-2".equals(codeString))
+      return V3Race._10462;
+    if ("1047-0".equals(codeString))
+      return V3Race._10470;
+    if ("1048-8".equals(codeString))
+      return V3Race._10488;
+    if ("1049-6".equals(codeString))
+      return V3Race._10496;
+    if ("1050-4".equals(codeString))
+      return V3Race._10504;
+    if ("1051-2".equals(codeString))
+      return V3Race._10512;
+    if ("1053-8".equals(codeString))
+      return V3Race._10538;
+    if ("1054-6".equals(codeString))
+      return V3Race._10546;
+    if ("1055-3".equals(codeString))
+      return V3Race._10553;
+    if ("1056-1".equals(codeString))
+      return V3Race._10561;
+    if ("1057-9".equals(codeString))
+      return V3Race._10579;
+    if ("1058-7".equals(codeString))
+      return V3Race._10587;
+    if ("1059-5".equals(codeString))
+      return V3Race._10595;
+    if ("1060-3".equals(codeString))
+      return V3Race._10603;
+    if ("1061-1".equals(codeString))
+      return V3Race._10611;
+    if ("1062-9".equals(codeString))
+      return V3Race._10629;
+    if ("1063-7".equals(codeString))
+      return V3Race._10637;
+    if ("1064-5".equals(codeString))
+      return V3Race._10645;
+    if ("1065-2".equals(codeString))
+      return V3Race._10652;
+    if ("1066-0".equals(codeString))
+      return V3Race._10660;
+    if ("1068-6".equals(codeString))
+      return V3Race._10686;
+    if ("1069-4".equals(codeString))
+      return V3Race._10694;
+    if ("1070-2".equals(codeString))
+      return V3Race._10702;
+    if ("1071-0".equals(codeString))
+      return V3Race._10710;
+    if ("1072-8".equals(codeString))
+      return V3Race._10728;
+    if ("1073-6".equals(codeString))
+      return V3Race._10736;
+    if ("1074-4".equals(codeString))
+      return V3Race._10744;
+    if ("1076-9".equals(codeString))
+      return V3Race._10769;
+    if ("1741-8".equals(codeString))
+      return V3Race._17418;
+    if ("1742-6".equals(codeString))
+      return V3Race._17426;
+    if ("1743-4".equals(codeString))
+      return V3Race._17434;
+    if ("1744-2".equals(codeString))
+      return V3Race._17442;
+    if ("1745-9".equals(codeString))
+      return V3Race._17459;
+    if ("1746-7".equals(codeString))
+      return V3Race._17467;
+    if ("1747-5".equals(codeString))
+      return V3Race._17475;
+    if ("1748-3".equals(codeString))
+      return V3Race._17483;
+    if ("1749-1".equals(codeString))
+      return V3Race._17491;
+    if ("1750-9".equals(codeString))
+      return V3Race._17509;
+    if ("1751-7".equals(codeString))
+      return V3Race._17517;
+    if ("1752-5".equals(codeString))
+      return V3Race._17525;
+    if ("1753-3".equals(codeString))
+      return V3Race._17533;
+    if ("1754-1".equals(codeString))
+      return V3Race._17541;
+    if ("1755-8".equals(codeString))
+      return V3Race._17558;
+    if ("1756-6".equals(codeString))
+      return V3Race._17566;
+    if ("1757-4".equals(codeString))
+      return V3Race._17574;
+    if ("1758-2".equals(codeString))
+      return V3Race._17582;
+    if ("1759-0".equals(codeString))
+      return V3Race._17590;
+    if ("1760-8".equals(codeString))
+      return V3Race._17608;
+    if ("1761-6".equals(codeString))
+      return V3Race._17616;
+    if ("1762-4".equals(codeString))
+      return V3Race._17624;
+    if ("1763-2".equals(codeString))
+      return V3Race._17632;
+    if ("1764-0".equals(codeString))
+      return V3Race._17640;
+    if ("1765-7".equals(codeString))
+      return V3Race._17657;
+    if ("1766-5".equals(codeString))
+      return V3Race._17665;
+    if ("1767-3".equals(codeString))
+      return V3Race._17673;
+    if ("1768-1".equals(codeString))
+      return V3Race._17681;
+    if ("1769-9".equals(codeString))
+      return V3Race._17699;
+    if ("1770-7".equals(codeString))
+      return V3Race._17707;
+    if ("1771-5".equals(codeString))
+      return V3Race._17715;
+    if ("1772-3".equals(codeString))
+      return V3Race._17723;
+    if ("1773-1".equals(codeString))
+      return V3Race._17731;
+    if ("1774-9".equals(codeString))
+      return V3Race._17749;
+    if ("1775-6".equals(codeString))
+      return V3Race._17756;
+    if ("1776-4".equals(codeString))
+      return V3Race._17764;
+    if ("1777-2".equals(codeString))
+      return V3Race._17772;
+    if ("1778-0".equals(codeString))
+      return V3Race._17780;
+    if ("1779-8".equals(codeString))
+      return V3Race._17798;
+    if ("1780-6".equals(codeString))
+      return V3Race._17806;
+    if ("1781-4".equals(codeString))
+      return V3Race._17814;
+    if ("1782-2".equals(codeString))
+      return V3Race._17822;
+    if ("1783-0".equals(codeString))
+      return V3Race._17830;
+    if ("1784-8".equals(codeString))
+      return V3Race._17848;
+    if ("1785-5".equals(codeString))
+      return V3Race._17855;
+    if ("1786-3".equals(codeString))
+      return V3Race._17863;
+    if ("1787-1".equals(codeString))
+      return V3Race._17871;
+    if ("1788-9".equals(codeString))
+      return V3Race._17889;
+    if ("1789-7".equals(codeString))
+      return V3Race._17897;
+    if ("1790-5".equals(codeString))
+      return V3Race._17905;
+    if ("1791-3".equals(codeString))
+      return V3Race._17913;
+    if ("1792-1".equals(codeString))
+      return V3Race._17921;
+    if ("1793-9".equals(codeString))
+      return V3Race._17939;
+    if ("1794-7".equals(codeString))
+      return V3Race._17947;
+    if ("1795-4".equals(codeString))
+      return V3Race._17954;
+    if ("1796-2".equals(codeString))
+      return V3Race._17962;
+    if ("1797-0".equals(codeString))
+      return V3Race._17970;
+    if ("1798-8".equals(codeString))
+      return V3Race._17988;
+    if ("1799-6".equals(codeString))
+      return V3Race._17996;
+    if ("1800-2".equals(codeString))
+      return V3Race._18002;
+    if ("1801-0".equals(codeString))
+      return V3Race._18010;
+    if ("1802-8".equals(codeString))
+      return V3Race._18028;
+    if ("1803-6".equals(codeString))
+      return V3Race._18036;
+    if ("1804-4".equals(codeString))
+      return V3Race._18044;
+    if ("1805-1".equals(codeString))
+      return V3Race._18051;
+    if ("1806-9".equals(codeString))
+      return V3Race._18069;
+    if ("1807-7".equals(codeString))
+      return V3Race._18077;
+    if ("1808-5".equals(codeString))
+      return V3Race._18085;
+    if ("1809-3".equals(codeString))
+      return V3Race._18093;
+    if ("1078-5".equals(codeString))
+      return V3Race._10785;
+    if ("1080-1".equals(codeString))
+      return V3Race._10801;
+    if ("1082-7".equals(codeString))
+      return V3Race._10827;
+    if ("1083-5".equals(codeString))
+      return V3Race._10835;
+    if ("1084-3".equals(codeString))
+      return V3Race._10843;
+    if ("1086-8".equals(codeString))
+      return V3Race._10868;
+    if ("1088-4".equals(codeString))
+      return V3Race._10884;
+    if ("1089-2".equals(codeString))
+      return V3Race._10892;
+    if ("1090-0".equals(codeString))
+      return V3Race._10900;
+    if ("1091-8".equals(codeString))
+      return V3Race._10918;
+    if ("1092-6".equals(codeString))
+      return V3Race._10926;
+    if ("1093-4".equals(codeString))
+      return V3Race._10934;
+    if ("1094-2".equals(codeString))
+      return V3Race._10942;
+    if ("1095-9".equals(codeString))
+      return V3Race._10959;
+    if ("1096-7".equals(codeString))
+      return V3Race._10967;
+    if ("1097-5".equals(codeString))
+      return V3Race._10975;
+    if ("1098-3".equals(codeString))
+      return V3Race._10983;
+    if ("1100-7".equals(codeString))
+      return V3Race._11007;
+    if ("1102-3".equals(codeString))
+      return V3Race._11023;
+    if ("1103-1".equals(codeString))
+      return V3Race._11031;
+    if ("1104-9".equals(codeString))
+      return V3Race._11049;
+    if ("1106-4".equals(codeString))
+      return V3Race._11064;
+    if ("1108-0".equals(codeString))
+      return V3Race._11080;
+    if ("1109-8".equals(codeString))
+      return V3Race._11098;
+    if ("1110-6".equals(codeString))
+      return V3Race._11106;
+    if ("1112-2".equals(codeString))
+      return V3Race._11122;
+    if ("1114-8".equals(codeString))
+      return V3Race._11148;
+    if ("1115-5".equals(codeString))
+      return V3Race._11155;
+    if ("1116-3".equals(codeString))
+      return V3Race._11163;
+    if ("1117-1".equals(codeString))
+      return V3Race._11171;
+    if ("1118-9".equals(codeString))
+      return V3Race._11189;
+    if ("1119-7".equals(codeString))
+      return V3Race._11197;
+    if ("1120-5".equals(codeString))
+      return V3Race._11205;
+    if ("1121-3".equals(codeString))
+      return V3Race._11213;
+    if ("1123-9".equals(codeString))
+      return V3Race._11239;
+    if ("1124-7".equals(codeString))
+      return V3Race._11247;
+    if ("1125-4".equals(codeString))
+      return V3Race._11254;
+    if ("1126-2".equals(codeString))
+      return V3Race._11262;
+    if ("1127-0".equals(codeString))
+      return V3Race._11270;
+    if ("1128-8".equals(codeString))
+      return V3Race._11288;
+    if ("1129-6".equals(codeString))
+      return V3Race._11296;
+    if ("1130-4".equals(codeString))
+      return V3Race._11304;
+    if ("1131-2".equals(codeString))
+      return V3Race._11312;
+    if ("1132-0".equals(codeString))
+      return V3Race._11320;
+    if ("1133-8".equals(codeString))
+      return V3Race._11338;
+    if ("1134-6".equals(codeString))
+      return V3Race._11346;
+    if ("1135-3".equals(codeString))
+      return V3Race._11353;
+    if ("1136-1".equals(codeString))
+      return V3Race._11361;
+    if ("1137-9".equals(codeString))
+      return V3Race._11379;
+    if ("1138-7".equals(codeString))
+      return V3Race._11387;
+    if ("1139-5".equals(codeString))
+      return V3Race._11395;
+    if ("1140-3".equals(codeString))
+      return V3Race._11403;
+    if ("1141-1".equals(codeString))
+      return V3Race._11411;
+    if ("1142-9".equals(codeString))
+      return V3Race._11429;
+    if ("1143-7".equals(codeString))
+      return V3Race._11437;
+    if ("1144-5".equals(codeString))
+      return V3Race._11445;
+    if ("1145-2".equals(codeString))
+      return V3Race._11452;
+    if ("1146-0".equals(codeString))
+      return V3Race._11460;
+    if ("1147-8".equals(codeString))
+      return V3Race._11478;
+    if ("1148-6".equals(codeString))
+      return V3Race._11486;
+    if ("1150-2".equals(codeString))
+      return V3Race._11502;
+    if ("1151-0".equals(codeString))
+      return V3Race._11510;
+    if ("1153-6".equals(codeString))
+      return V3Race._11536;
+    if ("1155-1".equals(codeString))
+      return V3Race._11551;
+    if ("1156-9".equals(codeString))
+      return V3Race._11569;
+    if ("1157-7".equals(codeString))
+      return V3Race._11577;
+    if ("1158-5".equals(codeString))
+      return V3Race._11585;
+    if ("1159-3".equals(codeString))
+      return V3Race._11593;
+    if ("1160-1".equals(codeString))
+      return V3Race._11601;
+    if ("1162-7".equals(codeString))
+      return V3Race._11627;
+    if ("1163-5".equals(codeString))
+      return V3Race._11635;
+    if ("1165-0".equals(codeString))
+      return V3Race._11650;
+    if ("1167-6".equals(codeString))
+      return V3Race._11676;
+    if ("1169-2".equals(codeString))
+      return V3Race._11692;
+    if ("1171-8".equals(codeString))
+      return V3Race._11718;
+    if ("1173-4".equals(codeString))
+      return V3Race._11734;
+    if ("1175-9".equals(codeString))
+      return V3Race._11759;
+    if ("1176-7".equals(codeString))
+      return V3Race._11767;
+    if ("1178-3".equals(codeString))
+      return V3Race._11783;
+    if ("1180-9".equals(codeString))
+      return V3Race._11809;
+    if ("1182-5".equals(codeString))
+      return V3Race._11825;
+    if ("1184-1".equals(codeString))
+      return V3Race._11841;
+    if ("1186-6".equals(codeString))
+      return V3Race._11866;
+    if ("1187-4".equals(codeString))
+      return V3Race._11874;
+    if ("1189-0".equals(codeString))
+      return V3Race._11890;
+    if ("1191-6".equals(codeString))
+      return V3Race._11916;
+    if ("1193-2".equals(codeString))
+      return V3Race._11932;
+    if ("1194-0".equals(codeString))
+      return V3Race._11940;
+    if ("1195-7".equals(codeString))
+      return V3Race._11957;
+    if ("1196-5".equals(codeString))
+      return V3Race._11965;
+    if ("1197-3".equals(codeString))
+      return V3Race._11973;
+    if ("1198-1".equals(codeString))
+      return V3Race._11981;
+    if ("1199-9".equals(codeString))
+      return V3Race._11999;
+    if ("1200-5".equals(codeString))
+      return V3Race._12005;
+    if ("1201-3".equals(codeString))
+      return V3Race._12013;
+    if ("1202-1".equals(codeString))
+      return V3Race._12021;
+    if ("1203-9".equals(codeString))
+      return V3Race._12039;
+    if ("1204-7".equals(codeString))
+      return V3Race._12047;
+    if ("1205-4".equals(codeString))
+      return V3Race._12054;
+    if ("1207-0".equals(codeString))
+      return V3Race._12070;
+    if ("1209-6".equals(codeString))
+      return V3Race._12096;
+    if ("1211-2".equals(codeString))
+      return V3Race._12112;
+    if ("1212-0".equals(codeString))
+      return V3Race._12120;
+    if ("1214-6".equals(codeString))
+      return V3Race._12146;
+    if ("1215-3".equals(codeString))
+      return V3Race._12153;
+    if ("1216-1".equals(codeString))
+      return V3Race._12161;
+    if ("1217-9".equals(codeString))
+      return V3Race._12179;
+    if ("1218-7".equals(codeString))
+      return V3Race._12187;
+    if ("1219-5".equals(codeString))
+      return V3Race._12195;
+    if ("1220-3".equals(codeString))
+      return V3Race._12203;
+    if ("1222-9".equals(codeString))
+      return V3Race._12229;
+    if ("1223-7".equals(codeString))
+      return V3Race._12237;
+    if ("1224-5".equals(codeString))
+      return V3Race._12245;
+    if ("1225-2".equals(codeString))
+      return V3Race._12252;
+    if ("1226-0".equals(codeString))
+      return V3Race._12260;
+    if ("1227-8".equals(codeString))
+      return V3Race._12278;
+    if ("1228-6".equals(codeString))
+      return V3Race._12286;
+    if ("1229-4".equals(codeString))
+      return V3Race._12294;
+    if ("1230-2".equals(codeString))
+      return V3Race._12302;
+    if ("1231-0".equals(codeString))
+      return V3Race._12310;
+    if ("1233-6".equals(codeString))
+      return V3Race._12336;
+    if ("1234-4".equals(codeString))
+      return V3Race._12344;
+    if ("1235-1".equals(codeString))
+      return V3Race._12351;
+    if ("1236-9".equals(codeString))
+      return V3Race._12369;
+    if ("1237-7".equals(codeString))
+      return V3Race._12377;
+    if ("1238-5".equals(codeString))
+      return V3Race._12385;
+    if ("1239-3".equals(codeString))
+      return V3Race._12393;
+    if ("1240-1".equals(codeString))
+      return V3Race._12401;
+    if ("1241-9".equals(codeString))
+      return V3Race._12419;
+    if ("1242-7".equals(codeString))
+      return V3Race._12427;
+    if ("1243-5".equals(codeString))
+      return V3Race._12435;
+    if ("1244-3".equals(codeString))
+      return V3Race._12443;
+    if ("1245-0".equals(codeString))
+      return V3Race._12450;
+    if ("1246-8".equals(codeString))
+      return V3Race._12468;
+    if ("1247-6".equals(codeString))
+      return V3Race._12476;
+    if ("1248-4".equals(codeString))
+      return V3Race._12484;
+    if ("1250-0".equals(codeString))
+      return V3Race._12500;
+    if ("1252-6".equals(codeString))
+      return V3Race._12526;
+    if ("1254-2".equals(codeString))
+      return V3Race._12542;
+    if ("1256-7".equals(codeString))
+      return V3Race._12567;
+    if ("1258-3".equals(codeString))
+      return V3Race._12583;
+    if ("1260-9".equals(codeString))
+      return V3Race._12609;
+    if ("1262-5".equals(codeString))
+      return V3Race._12625;
+    if ("1264-1".equals(codeString))
+      return V3Race._12641;
+    if ("1265-8".equals(codeString))
+      return V3Race._12658;
+    if ("1267-4".equals(codeString))
+      return V3Race._12674;
+    if ("1269-0".equals(codeString))
+      return V3Race._12690;
+    if ("1271-6".equals(codeString))
+      return V3Race._12716;
+    if ("1272-4".equals(codeString))
+      return V3Race._12724;
+    if ("1273-2".equals(codeString))
+      return V3Race._12732;
+    if ("1275-7".equals(codeString))
+      return V3Race._12757;
+    if ("1277-3".equals(codeString))
+      return V3Race._12773;
+    if ("1279-9".equals(codeString))
+      return V3Race._12799;
+    if ("1281-5".equals(codeString))
+      return V3Race._12815;
+    if ("1282-3".equals(codeString))
+      return V3Race._12823;
+    if ("1283-1".equals(codeString))
+      return V3Race._12831;
+    if ("1285-6".equals(codeString))
+      return V3Race._12856;
+    if ("1286-4".equals(codeString))
+      return V3Race._12864;
+    if ("1287-2".equals(codeString))
+      return V3Race._12872;
+    if ("1288-0".equals(codeString))
+      return V3Race._12880;
+    if ("1289-8".equals(codeString))
+      return V3Race._12898;
+    if ("1290-6".equals(codeString))
+      return V3Race._12906;
+    if ("1291-4".equals(codeString))
+      return V3Race._12914;
+    if ("1292-2".equals(codeString))
+      return V3Race._12922;
+    if ("1293-0".equals(codeString))
+      return V3Race._12930;
+    if ("1294-8".equals(codeString))
+      return V3Race._12948;
+    if ("1295-5".equals(codeString))
+      return V3Race._12955;
+    if ("1297-1".equals(codeString))
+      return V3Race._12971;
+    if ("1299-7".equals(codeString))
+      return V3Race._12997;
+    if ("1301-1".equals(codeString))
+      return V3Race._13011;
+    if ("1303-7".equals(codeString))
+      return V3Race._13037;
+    if ("1305-2".equals(codeString))
+      return V3Race._13052;
+    if ("1306-0".equals(codeString))
+      return V3Race._13060;
+    if ("1307-8".equals(codeString))
+      return V3Race._13078;
+    if ("1309-4".equals(codeString))
+      return V3Race._13094;
+    if ("1310-2".equals(codeString))
+      return V3Race._13102;
+    if ("1312-8".equals(codeString))
+      return V3Race._13128;
+    if ("1313-6".equals(codeString))
+      return V3Race._13136;
+    if ("1314-4".equals(codeString))
+      return V3Race._13144;
+    if ("1315-1".equals(codeString))
+      return V3Race._13151;
+    if ("1317-7".equals(codeString))
+      return V3Race._13177;
+    if ("1319-3".equals(codeString))
+      return V3Race._13193;
+    if ("1321-9".equals(codeString))
+      return V3Race._13219;
+    if ("1323-5".equals(codeString))
+      return V3Race._13235;
+    if ("1325-0".equals(codeString))
+      return V3Race._13250;
+    if ("1326-8".equals(codeString))
+      return V3Race._13268;
+    if ("1327-6".equals(codeString))
+      return V3Race._13276;
+    if ("1328-4".equals(codeString))
+      return V3Race._13284;
+    if ("1329-2".equals(codeString))
+      return V3Race._13292;
+    if ("1331-8".equals(codeString))
+      return V3Race._13318;
+    if ("1332-6".equals(codeString))
+      return V3Race._13326;
+    if ("1333-4".equals(codeString))
+      return V3Race._13334;
+    if ("1334-2".equals(codeString))
+      return V3Race._13342;
+    if ("1335-9".equals(codeString))
+      return V3Race._13359;
+    if ("1336-7".equals(codeString))
+      return V3Race._13367;
+    if ("1337-5".equals(codeString))
+      return V3Race._13375;
+    if ("1338-3".equals(codeString))
+      return V3Race._13383;
+    if ("1340-9".equals(codeString))
+      return V3Race._13409;
+    if ("1342-5".equals(codeString))
+      return V3Race._13425;
+    if ("1344-1".equals(codeString))
+      return V3Race._13441;
+    if ("1345-8".equals(codeString))
+      return V3Race._13458;
+    if ("1346-6".equals(codeString))
+      return V3Race._13466;
+    if ("1348-2".equals(codeString))
+      return V3Race._13482;
+    if ("1350-8".equals(codeString))
+      return V3Race._13508;
+    if ("1352-4".equals(codeString))
+      return V3Race._13524;
+    if ("1354-0".equals(codeString))
+      return V3Race._13540;
+    if ("1356-5".equals(codeString))
+      return V3Race._13565;
+    if ("1358-1".equals(codeString))
+      return V3Race._13581;
+    if ("1359-9".equals(codeString))
+      return V3Race._13599;
+    if ("1360-7".equals(codeString))
+      return V3Race._13607;
+    if ("1361-5".equals(codeString))
+      return V3Race._13615;
+    if ("1363-1".equals(codeString))
+      return V3Race._13631;
+    if ("1365-6".equals(codeString))
+      return V3Race._13656;
+    if ("1366-4".equals(codeString))
+      return V3Race._13664;
+    if ("1368-0".equals(codeString))
+      return V3Race._13680;
+    if ("1370-6".equals(codeString))
+      return V3Race._13706;
+    if ("1372-2".equals(codeString))
+      return V3Race._13722;
+    if ("1374-8".equals(codeString))
+      return V3Race._13748;
+    if ("1376-3".equals(codeString))
+      return V3Race._13763;
+    if ("1378-9".equals(codeString))
+      return V3Race._13789;
+    if ("1380-5".equals(codeString))
+      return V3Race._13805;
+    if ("1382-1".equals(codeString))
+      return V3Race._13821;
+    if ("1383-9".equals(codeString))
+      return V3Race._13839;
+    if ("1384-7".equals(codeString))
+      return V3Race._13847;
+    if ("1385-4".equals(codeString))
+      return V3Race._13854;
+    if ("1387-0".equals(codeString))
+      return V3Race._13870;
+    if ("1389-6".equals(codeString))
+      return V3Race._13896;
+    if ("1391-2".equals(codeString))
+      return V3Race._13912;
+    if ("1392-0".equals(codeString))
+      return V3Race._13920;
+    if ("1393-8".equals(codeString))
+      return V3Race._13938;
+    if ("1394-6".equals(codeString))
+      return V3Race._13946;
+    if ("1395-3".equals(codeString))
+      return V3Race._13953;
+    if ("1396-1".equals(codeString))
+      return V3Race._13961;
+    if ("1397-9".equals(codeString))
+      return V3Race._13979;
+    if ("1398-7".equals(codeString))
+      return V3Race._13987;
+    if ("1399-5".equals(codeString))
+      return V3Race._13995;
+    if ("1400-1".equals(codeString))
+      return V3Race._14001;
+    if ("1401-9".equals(codeString))
+      return V3Race._14019;
+    if ("1403-5".equals(codeString))
+      return V3Race._14035;
+    if ("1405-0".equals(codeString))
+      return V3Race._14050;
+    if ("1407-6".equals(codeString))
+      return V3Race._14076;
+    if ("1409-2".equals(codeString))
+      return V3Race._14092;
+    if ("1411-8".equals(codeString))
+      return V3Race._14118;
+    if ("1412-6".equals(codeString))
+      return V3Race._14126;
+    if ("1413-4".equals(codeString))
+      return V3Race._14134;
+    if ("1414-2".equals(codeString))
+      return V3Race._14142;
+    if ("1416-7".equals(codeString))
+      return V3Race._14167;
+    if ("1417-5".equals(codeString))
+      return V3Race._14175;
+    if ("1418-3".equals(codeString))
+      return V3Race._14183;
+    if ("1419-1".equals(codeString))
+      return V3Race._14191;
+    if ("1420-9".equals(codeString))
+      return V3Race._14209;
+    if ("1421-7".equals(codeString))
+      return V3Race._14217;
+    if ("1422-5".equals(codeString))
+      return V3Race._14225;
+    if ("1423-3".equals(codeString))
+      return V3Race._14233;
+    if ("1424-1".equals(codeString))
+      return V3Race._14241;
+    if ("1425-8".equals(codeString))
+      return V3Race._14258;
+    if ("1426-6".equals(codeString))
+      return V3Race._14266;
+    if ("1427-4".equals(codeString))
+      return V3Race._14274;
+    if ("1428-2".equals(codeString))
+      return V3Race._14282;
+    if ("1429-0".equals(codeString))
+      return V3Race._14290;
+    if ("1430-8".equals(codeString))
+      return V3Race._14308;
+    if ("1431-6".equals(codeString))
+      return V3Race._14316;
+    if ("1432-4".equals(codeString))
+      return V3Race._14324;
+    if ("1433-2".equals(codeString))
+      return V3Race._14332;
+    if ("1434-0".equals(codeString))
+      return V3Race._14340;
+    if ("1435-7".equals(codeString))
+      return V3Race._14357;
+    if ("1436-5".equals(codeString))
+      return V3Race._14365;
+    if ("1437-3".equals(codeString))
+      return V3Race._14373;
+    if ("1439-9".equals(codeString))
+      return V3Race._14399;
+    if ("1441-5".equals(codeString))
+      return V3Race._14415;
+    if ("1442-3".equals(codeString))
+      return V3Race._14423;
+    if ("1443-1".equals(codeString))
+      return V3Race._14431;
+    if ("1445-6".equals(codeString))
+      return V3Race._14456;
+    if ("1446-4".equals(codeString))
+      return V3Race._14464;
+    if ("1448-0".equals(codeString))
+      return V3Race._14480;
+    if ("1450-6".equals(codeString))
+      return V3Race._14506;
+    if ("1451-4".equals(codeString))
+      return V3Race._14514;
+    if ("1453-0".equals(codeString))
+      return V3Race._14530;
+    if ("1454-8".equals(codeString))
+      return V3Race._14548;
+    if ("1456-3".equals(codeString))
+      return V3Race._14563;
+    if ("1457-1".equals(codeString))
+      return V3Race._14571;
+    if ("1458-9".equals(codeString))
+      return V3Race._14589;
+    if ("1460-5".equals(codeString))
+      return V3Race._14605;
+    if ("1462-1".equals(codeString))
+      return V3Race._14621;
+    if ("1464-7".equals(codeString))
+      return V3Race._14647;
+    if ("1465-4".equals(codeString))
+      return V3Race._14654;
+    if ("1466-2".equals(codeString))
+      return V3Race._14662;
+    if ("1467-0".equals(codeString))
+      return V3Race._14670;
+    if ("1468-8".equals(codeString))
+      return V3Race._14688;
+    if ("1469-6".equals(codeString))
+      return V3Race._14696;
+    if ("1470-4".equals(codeString))
+      return V3Race._14704;
+    if ("1471-2".equals(codeString))
+      return V3Race._14712;
+    if ("1472-0".equals(codeString))
+      return V3Race._14720;
+    if ("1474-6".equals(codeString))
+      return V3Race._14746;
+    if ("1475-3".equals(codeString))
+      return V3Race._14753;
+    if ("1476-1".equals(codeString))
+      return V3Race._14761;
+    if ("1478-7".equals(codeString))
+      return V3Race._14787;
+    if ("1479-5".equals(codeString))
+      return V3Race._14795;
+    if ("1480-3".equals(codeString))
+      return V3Race._14803;
+    if ("1481-1".equals(codeString))
+      return V3Race._14811;
+    if ("1482-9".equals(codeString))
+      return V3Race._14829;
+    if ("1483-7".equals(codeString))
+      return V3Race._14837;
+    if ("1484-5".equals(codeString))
+      return V3Race._14845;
+    if ("1485-2".equals(codeString))
+      return V3Race._14852;
+    if ("1487-8".equals(codeString))
+      return V3Race._14878;
+    if ("1489-4".equals(codeString))
+      return V3Race._14894;
+    if ("1490-2".equals(codeString))
+      return V3Race._14902;
+    if ("1491-0".equals(codeString))
+      return V3Race._14910;
+    if ("1492-8".equals(codeString))
+      return V3Race._14928;
+    if ("1493-6".equals(codeString))
+      return V3Race._14936;
+    if ("1494-4".equals(codeString))
+      return V3Race._14944;
+    if ("1495-1".equals(codeString))
+      return V3Race._14951;
+    if ("1496-9".equals(codeString))
+      return V3Race._14969;
+    if ("1497-7".equals(codeString))
+      return V3Race._14977;
+    if ("1498-5".equals(codeString))
+      return V3Race._14985;
+    if ("1499-3".equals(codeString))
+      return V3Race._14993;
+    if ("1500-8".equals(codeString))
+      return V3Race._15008;
+    if ("1501-6".equals(codeString))
+      return V3Race._15016;
+    if ("1502-4".equals(codeString))
+      return V3Race._15024;
+    if ("1503-2".equals(codeString))
+      return V3Race._15032;
+    if ("1504-0".equals(codeString))
+      return V3Race._15040;
+    if ("1505-7".equals(codeString))
+      return V3Race._15057;
+    if ("1506-5".equals(codeString))
+      return V3Race._15065;
+    if ("1507-3".equals(codeString))
+      return V3Race._15073;
+    if ("1508-1".equals(codeString))
+      return V3Race._15081;
+    if ("1509-9".equals(codeString))
+      return V3Race._15099;
+    if ("1510-7".equals(codeString))
+      return V3Race._15107;
+    if ("1511-5".equals(codeString))
+      return V3Race._15115;
+    if ("1512-3".equals(codeString))
+      return V3Race._15123;
+    if ("1513-1".equals(codeString))
+      return V3Race._15131;
+    if ("1514-9".equals(codeString))
+      return V3Race._15149;
+    if ("1515-6".equals(codeString))
+      return V3Race._15156;
+    if ("1516-4".equals(codeString))
+      return V3Race._15164;
+    if ("1518-0".equals(codeString))
+      return V3Race._15180;
+    if ("1519-8".equals(codeString))
+      return V3Race._15198;
+    if ("1520-6".equals(codeString))
+      return V3Race._15206;
+    if ("1521-4".equals(codeString))
+      return V3Race._15214;
+    if ("1522-2".equals(codeString))
+      return V3Race._15222;
+    if ("1523-0".equals(codeString))
+      return V3Race._15230;
+    if ("1524-8".equals(codeString))
+      return V3Race._15248;
+    if ("1525-5".equals(codeString))
+      return V3Race._15255;
+    if ("1526-3".equals(codeString))
+      return V3Race._15263;
+    if ("1527-1".equals(codeString))
+      return V3Race._15271;
+    if ("1528-9".equals(codeString))
+      return V3Race._15289;
+    if ("1529-7".equals(codeString))
+      return V3Race._15297;
+    if ("1530-5".equals(codeString))
+      return V3Race._15305;
+    if ("1531-3".equals(codeString))
+      return V3Race._15313;
+    if ("1532-1".equals(codeString))
+      return V3Race._15321;
+    if ("1533-9".equals(codeString))
+      return V3Race._15339;
+    if ("1534-7".equals(codeString))
+      return V3Race._15347;
+    if ("1535-4".equals(codeString))
+      return V3Race._15354;
+    if ("1536-2".equals(codeString))
+      return V3Race._15362;
+    if ("1537-0".equals(codeString))
+      return V3Race._15370;
+    if ("1538-8".equals(codeString))
+      return V3Race._15388;
+    if ("1539-6".equals(codeString))
+      return V3Race._15396;
+    if ("1541-2".equals(codeString))
+      return V3Race._15412;
+    if ("1543-8".equals(codeString))
+      return V3Race._15438;
+    if ("1545-3".equals(codeString))
+      return V3Race._15453;
+    if ("1547-9".equals(codeString))
+      return V3Race._15479;
+    if ("1549-5".equals(codeString))
+      return V3Race._15495;
+    if ("1551-1".equals(codeString))
+      return V3Race._15511;
+    if ("1552-9".equals(codeString))
+      return V3Race._15529;
+    if ("1553-7".equals(codeString))
+      return V3Race._15537;
+    if ("1554-5".equals(codeString))
+      return V3Race._15545;
+    if ("1556-0".equals(codeString))
+      return V3Race._15560;
+    if ("1558-6".equals(codeString))
+      return V3Race._15586;
+    if ("1560-2".equals(codeString))
+      return V3Race._15602;
+    if ("1562-8".equals(codeString))
+      return V3Race._15628;
+    if ("1564-4".equals(codeString))
+      return V3Race._15644;
+    if ("1566-9".equals(codeString))
+      return V3Race._15669;
+    if ("1567-7".equals(codeString))
+      return V3Race._15677;
+    if ("1568-5".equals(codeString))
+      return V3Race._15685;
+    if ("1569-3".equals(codeString))
+      return V3Race._15693;
+    if ("1570-1".equals(codeString))
+      return V3Race._15701;
+    if ("1571-9".equals(codeString))
+      return V3Race._15719;
+    if ("1573-5".equals(codeString))
+      return V3Race._15735;
+    if ("1574-3".equals(codeString))
+      return V3Race._15743;
+    if ("1576-8".equals(codeString))
+      return V3Race._15768;
+    if ("1578-4".equals(codeString))
+      return V3Race._15784;
+    if ("1579-2".equals(codeString))
+      return V3Race._15792;
+    if ("1580-0".equals(codeString))
+      return V3Race._15800;
+    if ("1582-6".equals(codeString))
+      return V3Race._15826;
+    if ("1584-2".equals(codeString))
+      return V3Race._15842;
+    if ("1586-7".equals(codeString))
+      return V3Race._15867;
+    if ("1587-5".equals(codeString))
+      return V3Race._15875;
+    if ("1588-3".equals(codeString))
+      return V3Race._15883;
+    if ("1589-1".equals(codeString))
+      return V3Race._15891;
+    if ("1590-9".equals(codeString))
+      return V3Race._15909;
+    if ("1591-7".equals(codeString))
+      return V3Race._15917;
+    if ("1592-5".equals(codeString))
+      return V3Race._15925;
+    if ("1593-3".equals(codeString))
+      return V3Race._15933;
+    if ("1594-1".equals(codeString))
+      return V3Race._15941;
+    if ("1595-8".equals(codeString))
+      return V3Race._15958;
+    if ("1596-6".equals(codeString))
+      return V3Race._15966;
+    if ("1597-4".equals(codeString))
+      return V3Race._15974;
+    if ("1598-2".equals(codeString))
+      return V3Race._15982;
+    if ("1599-0".equals(codeString))
+      return V3Race._15990;
+    if ("1600-6".equals(codeString))
+      return V3Race._16006;
+    if ("1602-2".equals(codeString))
+      return V3Race._16022;
+    if ("1603-0".equals(codeString))
+      return V3Race._16030;
+    if ("1604-8".equals(codeString))
+      return V3Race._16048;
+    if ("1605-5".equals(codeString))
+      return V3Race._16055;
+    if ("1607-1".equals(codeString))
+      return V3Race._16071;
+    if ("1609-7".equals(codeString))
+      return V3Race._16097;
+    if ("1610-5".equals(codeString))
+      return V3Race._16105;
+    if ("1611-3".equals(codeString))
+      return V3Race._16113;
+    if ("1612-1".equals(codeString))
+      return V3Race._16121;
+    if ("1613-9".equals(codeString))
+      return V3Race._16139;
+    if ("1614-7".equals(codeString))
+      return V3Race._16147;
+    if ("1615-4".equals(codeString))
+      return V3Race._16154;
+    if ("1616-2".equals(codeString))
+      return V3Race._16162;
+    if ("1617-0".equals(codeString))
+      return V3Race._16170;
+    if ("1618-8".equals(codeString))
+      return V3Race._16188;
+    if ("1619-6".equals(codeString))
+      return V3Race._16196;
+    if ("1620-4".equals(codeString))
+      return V3Race._16204;
+    if ("1621-2".equals(codeString))
+      return V3Race._16212;
+    if ("1622-0".equals(codeString))
+      return V3Race._16220;
+    if ("1623-8".equals(codeString))
+      return V3Race._16238;
+    if ("1624-6".equals(codeString))
+      return V3Race._16246;
+    if ("1625-3".equals(codeString))
+      return V3Race._16253;
+    if ("1626-1".equals(codeString))
+      return V3Race._16261;
+    if ("1627-9".equals(codeString))
+      return V3Race._16279;
+    if ("1628-7".equals(codeString))
+      return V3Race._16287;
+    if ("1629-5".equals(codeString))
+      return V3Race._16295;
+    if ("1630-3".equals(codeString))
+      return V3Race._16303;
+    if ("1631-1".equals(codeString))
+      return V3Race._16311;
+    if ("1632-9".equals(codeString))
+      return V3Race._16329;
+    if ("1633-7".equals(codeString))
+      return V3Race._16337;
+    if ("1634-5".equals(codeString))
+      return V3Race._16345;
+    if ("1635-2".equals(codeString))
+      return V3Race._16352;
+    if ("1636-0".equals(codeString))
+      return V3Race._16360;
+    if ("1637-8".equals(codeString))
+      return V3Race._16378;
+    if ("1638-6".equals(codeString))
+      return V3Race._16386;
+    if ("1639-4".equals(codeString))
+      return V3Race._16394;
+    if ("1640-2".equals(codeString))
+      return V3Race._16402;
+    if ("1641-0".equals(codeString))
+      return V3Race._16410;
+    if ("1643-6".equals(codeString))
+      return V3Race._16436;
+    if ("1645-1".equals(codeString))
+      return V3Race._16451;
+    if ("1647-7".equals(codeString))
+      return V3Race._16477;
+    if ("1649-3".equals(codeString))
+      return V3Race._16493;
+    if ("1651-9".equals(codeString))
+      return V3Race._16519;
+    if ("1653-5".equals(codeString))
+      return V3Race._16535;
+    if ("1654-3".equals(codeString))
+      return V3Race._16543;
+    if ("1655-0".equals(codeString))
+      return V3Race._16550;
+    if ("1656-8".equals(codeString))
+      return V3Race._16568;
+    if ("1657-6".equals(codeString))
+      return V3Race._16576;
+    if ("1659-2".equals(codeString))
+      return V3Race._16592;
+    if ("1661-8".equals(codeString))
+      return V3Race._16618;
+    if ("1663-4".equals(codeString))
+      return V3Race._16634;
+    if ("1665-9".equals(codeString))
+      return V3Race._16659;
+    if ("1667-5".equals(codeString))
+      return V3Race._16675;
+    if ("1668-3".equals(codeString))
+      return V3Race._16683;
+    if ("1670-9".equals(codeString))
+      return V3Race._16709;
+    if ("1671-7".equals(codeString))
+      return V3Race._16717;
+    if ("1672-5".equals(codeString))
+      return V3Race._16725;
+    if ("1673-3".equals(codeString))
+      return V3Race._16733;
+    if ("1675-8".equals(codeString))
+      return V3Race._16758;
+    if ("1677-4".equals(codeString))
+      return V3Race._16774;
+    if ("1679-0".equals(codeString))
+      return V3Race._16790;
+    if ("1680-8".equals(codeString))
+      return V3Race._16808;
+    if ("1681-6".equals(codeString))
+      return V3Race._16816;
+    if ("1683-2".equals(codeString))
+      return V3Race._16832;
+    if ("1685-7".equals(codeString))
+      return V3Race._16857;
+    if ("1687-3".equals(codeString))
+      return V3Race._16873;
+    if ("1688-1".equals(codeString))
+      return V3Race._16881;
+    if ("1689-9".equals(codeString))
+      return V3Race._16899;
+    if ("1690-7".equals(codeString))
+      return V3Race._16907;
+    if ("1692-3".equals(codeString))
+      return V3Race._16923;
+    if ("1694-9".equals(codeString))
+      return V3Race._16949;
+    if ("1696-4".equals(codeString))
+      return V3Race._16964;
+    if ("1697-2".equals(codeString))
+      return V3Race._16972;
+    if ("1698-0".equals(codeString))
+      return V3Race._16980;
+    if ("1700-4".equals(codeString))
+      return V3Race._17004;
+    if ("1702-0".equals(codeString))
+      return V3Race._17020;
+    if ("1704-6".equals(codeString))
+      return V3Race._17046;
+    if ("1705-3".equals(codeString))
+      return V3Race._17053;
+    if ("1707-9".equals(codeString))
+      return V3Race._17079;
+    if ("1709-5".equals(codeString))
+      return V3Race._17095;
+    if ("1711-1".equals(codeString))
+      return V3Race._17111;
+    if ("1712-9".equals(codeString))
+      return V3Race._17129;
+    if ("1713-7".equals(codeString))
+      return V3Race._17137;
+    if ("1715-2".equals(codeString))
+      return V3Race._17152;
+    if ("1717-8".equals(codeString))
+      return V3Race._17178;
+    if ("1718-6".equals(codeString))
+      return V3Race._17186;
+    if ("1719-4".equals(codeString))
+      return V3Race._17194;
+    if ("1720-2".equals(codeString))
+      return V3Race._17202;
+    if ("1722-8".equals(codeString))
+      return V3Race._17228;
+    if ("1724-4".equals(codeString))
+      return V3Race._17244;
+    if ("1725-1".equals(codeString))
+      return V3Race._17251;
+    if ("1726-9".equals(codeString))
+      return V3Race._17269;
+    if ("1727-7".equals(codeString))
+      return V3Race._17277;
+    if ("1728-5".equals(codeString))
+      return V3Race._17285;
+    if ("1729-3".equals(codeString))
+      return V3Race._17293;
+    if ("1730-1".equals(codeString))
+      return V3Race._17301;
+    if ("1731-9".equals(codeString))
+      return V3Race._17319;
+    if ("1732-7".equals(codeString))
+      return V3Race._17327;
+    if ("1733-5".equals(codeString))
+      return V3Race._17335;
+    if ("1735-0".equals(codeString))
+      return V3Race._17350;
+    if ("1737-6".equals(codeString))
+      return V3Race._17376;
+    if ("1739-2".equals(codeString))
+      return V3Race._17392;
+    if ("1740-0".equals(codeString))
+      return V3Race._17400;
+    if ("1811-9".equals(codeString))
+      return V3Race._18119;
+    if ("1813-5".equals(codeString))
+      return V3Race._18135;
+    if ("1814-3".equals(codeString))
+      return V3Race._18143;
+    if ("1815-0".equals(codeString))
+      return V3Race._18150;
+    if ("1816-8".equals(codeString))
+      return V3Race._18168;
+    if ("1817-6".equals(codeString))
+      return V3Race._18176;
+    if ("1818-4".equals(codeString))
+      return V3Race._18184;
+    if ("1819-2".equals(codeString))
+      return V3Race._18192;
+    if ("1820-0".equals(codeString))
+      return V3Race._18200;
+    if ("1821-8".equals(codeString))
+      return V3Race._18218;
+    if ("1822-6".equals(codeString))
+      return V3Race._18226;
+    if ("1823-4".equals(codeString))
+      return V3Race._18234;
+    if ("1824-2".equals(codeString))
+      return V3Race._18242;
+    if ("1825-9".equals(codeString))
+      return V3Race._18259;
+    if ("1826-7".equals(codeString))
+      return V3Race._18267;
+    if ("1827-5".equals(codeString))
+      return V3Race._18275;
+    if ("1828-3".equals(codeString))
+      return V3Race._18283;
+    if ("1829-1".equals(codeString))
+      return V3Race._18291;
+    if ("1830-9".equals(codeString))
+      return V3Race._18309;
+    if ("1831-7".equals(codeString))
+      return V3Race._18317;
+    if ("1832-5".equals(codeString))
+      return V3Race._18325;
+    if ("1833-3".equals(codeString))
+      return V3Race._18333;
+    if ("1834-1".equals(codeString))
+      return V3Race._18341;
+    if ("1835-8".equals(codeString))
+      return V3Race._18358;
+    if ("1837-4".equals(codeString))
+      return V3Race._18374;
+    if ("1838-2".equals(codeString))
+      return V3Race._18382;
+    if ("1840-8".equals(codeString))
+      return V3Race._18408;
+    if ("1842-4".equals(codeString))
+      return V3Race._18424;
+    if ("1844-0".equals(codeString))
+      return V3Race._18440;
+    if ("1845-7".equals(codeString))
+      return V3Race._18457;
+    if ("1846-5".equals(codeString))
+      return V3Race._18465;
+    if ("1847-3".equals(codeString))
+      return V3Race._18473;
+    if ("1848-1".equals(codeString))
+      return V3Race._18481;
+    if ("1849-9".equals(codeString))
+      return V3Race._18499;
+    if ("1850-7".equals(codeString))
+      return V3Race._18507;
+    if ("1851-5".equals(codeString))
+      return V3Race._18515;
+    if ("1852-3".equals(codeString))
+      return V3Race._18523;
+    if ("1853-1".equals(codeString))
+      return V3Race._18531;
+    if ("1854-9".equals(codeString))
+      return V3Race._18549;
+    if ("1855-6".equals(codeString))
+      return V3Race._18556;
+    if ("1856-4".equals(codeString))
+      return V3Race._18564;
+    if ("1857-2".equals(codeString))
+      return V3Race._18572;
+    if ("1858-0".equals(codeString))
+      return V3Race._18580;
+    if ("1859-8".equals(codeString))
+      return V3Race._18598;
+    if ("1860-6".equals(codeString))
+      return V3Race._18606;
+    if ("1861-4".equals(codeString))
+      return V3Race._18614;
+    if ("1862-2".equals(codeString))
+      return V3Race._18622;
+    if ("1863-0".equals(codeString))
+      return V3Race._18630;
+    if ("1864-8".equals(codeString))
+      return V3Race._18648;
+    if ("1865-5".equals(codeString))
+      return V3Race._18655;
+    if ("1866-3".equals(codeString))
+      return V3Race._18663;
+    if ("1867-1".equals(codeString))
+      return V3Race._18671;
+    if ("1868-9".equals(codeString))
+      return V3Race._18689;
+    if ("1869-7".equals(codeString))
+      return V3Race._18697;
+    if ("1870-5".equals(codeString))
+      return V3Race._18705;
+    if ("1871-3".equals(codeString))
+      return V3Race._18713;
+    if ("1872-1".equals(codeString))
+      return V3Race._18721;
+    if ("1873-9".equals(codeString))
+      return V3Race._18739;
+    if ("1874-7".equals(codeString))
+      return V3Race._18747;
+    if ("1875-4".equals(codeString))
+      return V3Race._18754;
+    if ("1876-2".equals(codeString))
+      return V3Race._18762;
+    if ("1877-0".equals(codeString))
+      return V3Race._18770;
+    if ("1878-8".equals(codeString))
+      return V3Race._18788;
+    if ("1879-6".equals(codeString))
+      return V3Race._18796;
+    if ("1880-4".equals(codeString))
+      return V3Race._18804;
+    if ("1881-2".equals(codeString))
+      return V3Race._18812;
+    if ("1882-0".equals(codeString))
+      return V3Race._18820;
+    if ("1883-8".equals(codeString))
+      return V3Race._18838;
+    if ("1884-6".equals(codeString))
+      return V3Race._18846;
+    if ("1885-3".equals(codeString))
+      return V3Race._18853;
+    if ("1886-1".equals(codeString))
+      return V3Race._18861;
+    if ("1887-9".equals(codeString))
+      return V3Race._18879;
+    if ("1888-7".equals(codeString))
+      return V3Race._18887;
+    if ("1889-5".equals(codeString))
+      return V3Race._18895;
+    if ("1891-1".equals(codeString))
+      return V3Race._18911;
+    if ("1892-9".equals(codeString))
+      return V3Race._18929;
+    if ("1893-7".equals(codeString))
+      return V3Race._18937;
+    if ("1894-5".equals(codeString))
+      return V3Race._18945;
+    if ("1896-0".equals(codeString))
+      return V3Race._18960;
+    if ("1897-8".equals(codeString))
+      return V3Race._18978;
+    if ("1898-6".equals(codeString))
+      return V3Race._18986;
+    if ("1899-4".equals(codeString))
+      return V3Race._18994;
+    if ("1900-0".equals(codeString))
+      return V3Race._19000;
+    if ("1901-8".equals(codeString))
+      return V3Race._19018;
+    if ("1902-6".equals(codeString))
+      return V3Race._19026;
+    if ("1903-4".equals(codeString))
+      return V3Race._19034;
+    if ("1904-2".equals(codeString))
+      return V3Race._19042;
+    if ("1905-9".equals(codeString))
+      return V3Race._19059;
+    if ("1906-7".equals(codeString))
+      return V3Race._19067;
+    if ("1907-5".equals(codeString))
+      return V3Race._19075;
+    if ("1908-3".equals(codeString))
+      return V3Race._19083;
+    if ("1909-1".equals(codeString))
+      return V3Race._19091;
+    if ("1910-9".equals(codeString))
+      return V3Race._19109;
+    if ("1911-7".equals(codeString))
+      return V3Race._19117;
+    if ("1912-5".equals(codeString))
+      return V3Race._19125;
+    if ("1913-3".equals(codeString))
+      return V3Race._19133;
+    if ("1914-1".equals(codeString))
+      return V3Race._19141;
+    if ("1915-8".equals(codeString))
+      return V3Race._19158;
+    if ("1916-6".equals(codeString))
+      return V3Race._19166;
+    if ("1917-4".equals(codeString))
+      return V3Race._19174;
+    if ("1918-2".equals(codeString))
+      return V3Race._19182;
+    if ("1919-0".equals(codeString))
+      return V3Race._19190;
+    if ("1920-8".equals(codeString))
+      return V3Race._19208;
+    if ("1921-6".equals(codeString))
+      return V3Race._19216;
+    if ("1922-4".equals(codeString))
+      return V3Race._19224;
+    if ("1923-2".equals(codeString))
+      return V3Race._19232;
+    if ("1924-0".equals(codeString))
+      return V3Race._19240;
+    if ("1925-7".equals(codeString))
+      return V3Race._19257;
+    if ("1926-5".equals(codeString))
+      return V3Race._19265;
+    if ("1927-3".equals(codeString))
+      return V3Race._19273;
+    if ("1928-1".equals(codeString))
+      return V3Race._19281;
+    if ("1929-9".equals(codeString))
+      return V3Race._19299;
+    if ("1930-7".equals(codeString))
+      return V3Race._19307;
+    if ("1931-5".equals(codeString))
+      return V3Race._19315;
+    if ("1932-3".equals(codeString))
+      return V3Race._19323;
+    if ("1933-1".equals(codeString))
+      return V3Race._19331;
+    if ("1934-9".equals(codeString))
+      return V3Race._19349;
+    if ("1935-6".equals(codeString))
+      return V3Race._19356;
+    if ("1936-4".equals(codeString))
+      return V3Race._19364;
+    if ("1937-2".equals(codeString))
+      return V3Race._19372;
+    if ("1938-0".equals(codeString))
+      return V3Race._19380;
+    if ("1939-8".equals(codeString))
+      return V3Race._19398;
+    if ("1940-6".equals(codeString))
+      return V3Race._19406;
+    if ("1941-4".equals(codeString))
+      return V3Race._19414;
+    if ("1942-2".equals(codeString))
+      return V3Race._19422;
+    if ("1943-0".equals(codeString))
+      return V3Race._19430;
+    if ("1944-8".equals(codeString))
+      return V3Race._19448;
+    if ("1945-5".equals(codeString))
+      return V3Race._19455;
+    if ("1946-3".equals(codeString))
+      return V3Race._19463;
+    if ("1947-1".equals(codeString))
+      return V3Race._19471;
+    if ("1948-9".equals(codeString))
+      return V3Race._19489;
+    if ("1949-7".equals(codeString))
+      return V3Race._19497;
+    if ("1950-5".equals(codeString))
+      return V3Race._19505;
+    if ("1951-3".equals(codeString))
+      return V3Race._19513;
+    if ("1952-1".equals(codeString))
+      return V3Race._19521;
+    if ("1953-9".equals(codeString))
+      return V3Race._19539;
+    if ("1954-7".equals(codeString))
+      return V3Race._19547;
+    if ("1955-4".equals(codeString))
+      return V3Race._19554;
+    if ("1956-2".equals(codeString))
+      return V3Race._19562;
+    if ("1957-0".equals(codeString))
+      return V3Race._19570;
+    if ("1958-8".equals(codeString))
+      return V3Race._19588;
+    if ("1959-6".equals(codeString))
+      return V3Race._19596;
+    if ("1960-4".equals(codeString))
+      return V3Race._19604;
+    if ("1961-2".equals(codeString))
+      return V3Race._19612;
+    if ("1962-0".equals(codeString))
+      return V3Race._19620;
+    if ("1963-8".equals(codeString))
+      return V3Race._19638;
+    if ("1964-6".equals(codeString))
+      return V3Race._19646;
+    if ("1966-1".equals(codeString))
+      return V3Race._19661;
+    if ("1968-7".equals(codeString))
+      return V3Race._19687;
+    if ("1969-5".equals(codeString))
+      return V3Race._19695;
+    if ("1970-3".equals(codeString))
+      return V3Race._19703;
+    if ("1972-9".equals(codeString))
+      return V3Race._19729;
+    if ("1973-7".equals(codeString))
+      return V3Race._19737;
+    if ("1974-5".equals(codeString))
+      return V3Race._19745;
+    if ("1975-2".equals(codeString))
+      return V3Race._19752;
+    if ("1976-0".equals(codeString))
+      return V3Race._19760;
+    if ("1977-8".equals(codeString))
+      return V3Race._19778;
+    if ("1978-6".equals(codeString))
+      return V3Race._19786;
+    if ("1979-4".equals(codeString))
+      return V3Race._19794;
+    if ("1980-2".equals(codeString))
+      return V3Race._19802;
+    if ("1981-0".equals(codeString))
+      return V3Race._19810;
+    if ("1982-8".equals(codeString))
+      return V3Race._19828;
+    if ("1984-4".equals(codeString))
+      return V3Race._19844;
+    if ("1985-1".equals(codeString))
+      return V3Race._19851;
+    if ("1986-9".equals(codeString))
+      return V3Race._19869;
+    if ("1987-7".equals(codeString))
+      return V3Race._19877;
+    if ("1988-5".equals(codeString))
+      return V3Race._19885;
+    if ("1990-1".equals(codeString))
+      return V3Race._19901;
+    if ("1992-7".equals(codeString))
+      return V3Race._19927;
+    if ("1993-5".equals(codeString))
+      return V3Race._19935;
+    if ("1994-3".equals(codeString))
+      return V3Race._19943;
+    if ("1995-0".equals(codeString))
+      return V3Race._19950;
+    if ("1996-8".equals(codeString))
+      return V3Race._19968;
+    if ("1997-6".equals(codeString))
+      return V3Race._19976;
+    if ("1998-4".equals(codeString))
+      return V3Race._19984;
+    if ("1999-2".equals(codeString))
+      return V3Race._19992;
+    if ("2000-8".equals(codeString))
+      return V3Race._20008;
+    if ("2002-4".equals(codeString))
+      return V3Race._20024;
+    if ("2004-0".equals(codeString))
+      return V3Race._20040;
+    if ("2006-5".equals(codeString))
+      return V3Race._20065;
+    if ("2007-3".equals(codeString))
+      return V3Race._20073;
+    if ("2008-1".equals(codeString))
+      return V3Race._20081;
+    if ("2009-9".equals(codeString))
+      return V3Race._20099;
+    if ("2010-7".equals(codeString))
+      return V3Race._20107;
+    if ("2011-5".equals(codeString))
+      return V3Race._20115;
+    if ("2012-3".equals(codeString))
+      return V3Race._20123;
+    if ("2013-1".equals(codeString))
+      return V3Race._20131;
+    if ("2014-9".equals(codeString))
+      return V3Race._20149;
+    if ("2015-6".equals(codeString))
+      return V3Race._20156;
+    if ("2016-4".equals(codeString))
+      return V3Race._20164;
+    if ("2017-2".equals(codeString))
+      return V3Race._20172;
+    if ("2018-0".equals(codeString))
+      return V3Race._20180;
+    if ("2019-8".equals(codeString))
+      return V3Race._20198;
+    if ("2020-6".equals(codeString))
+      return V3Race._20206;
+    if ("2021-4".equals(codeString))
+      return V3Race._20214;
+    if ("2022-2".equals(codeString))
+      return V3Race._20222;
+    if ("2023-0".equals(codeString))
+      return V3Race._20230;
+    if ("2024-8".equals(codeString))
+      return V3Race._20248;
+    if ("2025-5".equals(codeString))
+      return V3Race._20255;
+    if ("2026-3".equals(codeString))
+      return V3Race._20263;
+    if ("2028-9".equals(codeString))
+      return V3Race._20289;
+    if ("2029-7".equals(codeString))
+      return V3Race._20297;
+    if ("2030-5".equals(codeString))
+      return V3Race._20305;
+    if ("2031-3".equals(codeString))
+      return V3Race._20313;
+    if ("2032-1".equals(codeString))
+      return V3Race._20321;
+    if ("2033-9".equals(codeString))
+      return V3Race._20339;
+    if ("2034-7".equals(codeString))
+      return V3Race._20347;
+    if ("2035-4".equals(codeString))
+      return V3Race._20354;
+    if ("2036-2".equals(codeString))
+      return V3Race._20362;
+    if ("2037-0".equals(codeString))
+      return V3Race._20370;
+    if ("2038-8".equals(codeString))
+      return V3Race._20388;
+    if ("2039-6".equals(codeString))
+      return V3Race._20396;
+    if ("2040-4".equals(codeString))
+      return V3Race._20404;
+    if ("2041-2".equals(codeString))
+      return V3Race._20412;
+    if ("2042-0".equals(codeString))
+      return V3Race._20420;
+    if ("2043-8".equals(codeString))
+      return V3Race._20438;
+    if ("2044-6".equals(codeString))
+      return V3Race._20446;
+    if ("2045-3".equals(codeString))
+      return V3Race._20453;
+    if ("2046-1".equals(codeString))
+      return V3Race._20461;
+    if ("2047-9".equals(codeString))
+      return V3Race._20479;
+    if ("2048-7".equals(codeString))
+      return V3Race._20487;
+    if ("2049-5".equals(codeString))
+      return V3Race._20495;
+    if ("2050-3".equals(codeString))
+      return V3Race._20503;
+    if ("2051-1".equals(codeString))
+      return V3Race._20511;
+    if ("2052-9".equals(codeString))
+      return V3Race._20529;
+    if ("2054-5".equals(codeString))
+      return V3Race._20545;
+    if ("2056-0".equals(codeString))
+      return V3Race._20560;
+    if ("2058-6".equals(codeString))
+      return V3Race._20586;
+    if ("2060-2".equals(codeString))
+      return V3Race._20602;
+    if ("2061-0".equals(codeString))
+      return V3Race._20610;
+    if ("2062-8".equals(codeString))
+      return V3Race._20628;
+    if ("2063-6".equals(codeString))
+      return V3Race._20636;
+    if ("2064-4".equals(codeString))
+      return V3Race._20644;
+    if ("2065-1".equals(codeString))
+      return V3Race._20651;
+    if ("2066-9".equals(codeString))
+      return V3Race._20669;
+    if ("2067-7".equals(codeString))
+      return V3Race._20677;
+    if ("2068-5".equals(codeString))
+      return V3Race._20685;
+    if ("2069-3".equals(codeString))
+      return V3Race._20693;
+    if ("2070-1".equals(codeString))
+      return V3Race._20701;
+    if ("2071-9".equals(codeString))
+      return V3Race._20719;
+    if ("2072-7".equals(codeString))
+      return V3Race._20727;
+    if ("2073-5".equals(codeString))
+      return V3Race._20735;
+    if ("2074-3".equals(codeString))
+      return V3Race._20743;
+    if ("2075-0".equals(codeString))
+      return V3Race._20750;
+    if ("2076-8".equals(codeString))
+      return V3Race._20768;
+    if ("2078-4".equals(codeString))
+      return V3Race._20784;
+    if ("2079-2".equals(codeString))
+      return V3Race._20792;
+    if ("2080-0".equals(codeString))
+      return V3Race._20800;
+    if ("2081-8".equals(codeString))
+      return V3Race._20818;
+    if ("2082-6".equals(codeString))
+      return V3Race._20826;
+    if ("2083-4".equals(codeString))
+      return V3Race._20834;
+    if ("2085-9".equals(codeString))
+      return V3Race._20859;
+    if ("2086-7".equals(codeString))
+      return V3Race._20867;
+    if ("2087-5".equals(codeString))
+      return V3Race._20875;
+    if ("2088-3".equals(codeString))
+      return V3Race._20883;
+    if ("2089-1".equals(codeString))
+      return V3Race._20891;
+    if ("2090-9".equals(codeString))
+      return V3Race._20909;
+    if ("2091-7".equals(codeString))
+      return V3Race._20917;
+    if ("2092-5".equals(codeString))
+      return V3Race._20925;
+    if ("2093-3".equals(codeString))
+      return V3Race._20933;
+    if ("2094-1".equals(codeString))
+      return V3Race._20941;
+    if ("2095-8".equals(codeString))
+      return V3Race._20958;
+    if ("2096-6".equals(codeString))
+      return V3Race._20966;
+    if ("2097-4".equals(codeString))
+      return V3Race._20974;
+    if ("2098-2".equals(codeString))
+      return V3Race._20982;
+    if ("2100-6".equals(codeString))
+      return V3Race._21006;
+    if ("2101-4".equals(codeString))
+      return V3Race._21014;
+    if ("2102-2".equals(codeString))
+      return V3Race._21022;
+    if ("2103-0".equals(codeString))
+      return V3Race._21030;
+    if ("2104-8".equals(codeString))
+      return V3Race._21048;
+    if ("2500-7".equals(codeString))
+      return V3Race._25007;
+    if ("2106-3".equals(codeString))
+      return V3Race._21063;
+    if ("2108-9".equals(codeString))
+      return V3Race._21089;
+    if ("2109-7".equals(codeString))
+      return V3Race._21097;
+    if ("2110-5".equals(codeString))
+      return V3Race._21105;
+    if ("2111-3".equals(codeString))
+      return V3Race._21113;
+    if ("2112-1".equals(codeString))
+      return V3Race._21121;
+    if ("2113-9".equals(codeString))
+      return V3Race._21139;
+    if ("2114-7".equals(codeString))
+      return V3Race._21147;
+    if ("2115-4".equals(codeString))
+      return V3Race._21154;
+    if ("2116-2".equals(codeString))
+      return V3Race._21162;
+    if ("2118-8".equals(codeString))
+      return V3Race._21188;
+    if ("2119-6".equals(codeString))
+      return V3Race._21196;
+    if ("2120-4".equals(codeString))
+      return V3Race._21204;
+    if ("2121-2".equals(codeString))
+      return V3Race._21212;
+    if ("2122-0".equals(codeString))
+      return V3Race._21220;
+    if ("2123-8".equals(codeString))
+      return V3Race._21238;
+    if ("2124-6".equals(codeString))
+      return V3Race._21246;
+    if ("2125-3".equals(codeString))
+      return V3Race._21253;
+    if ("2126-1".equals(codeString))
+      return V3Race._21261;
+    if ("2127-9".equals(codeString))
+      return V3Race._21279;
+    if ("2129-5".equals(codeString))
+      return V3Race._21295;
+    if ("2131-1".equals(codeString))
+      return V3Race._21311;
+    throw new IllegalArgumentException("Unknown V3Race code '"+codeString+"'");
+  }
+
+  public String toCode(V3Race code) {
+    if (code == V3Race._10025)
+      return "1002-5";
+    if (code == V3Race._10041)
+      return "1004-1";
+    if (code == V3Race._10066)
+      return "1006-6";
+    if (code == V3Race._10082)
+      return "1008-2";
+    if (code == V3Race._10108)
+      return "1010-8";
+    if (code == V3Race._10116)
+      return "1011-6";
+    if (code == V3Race._10124)
+      return "1012-4";
+    if (code == V3Race._10132)
+      return "1013-2";
+    if (code == V3Race._10140)
+      return "1014-0";
+    if (code == V3Race._10157)
+      return "1015-7";
+    if (code == V3Race._10165)
+      return "1016-5";
+    if (code == V3Race._10173)
+      return "1017-3";
+    if (code == V3Race._10181)
+      return "1018-1";
+    if (code == V3Race._10199)
+      return "1019-9";
+    if (code == V3Race._10215)
+      return "1021-5";
+    if (code == V3Race._10223)
+      return "1022-3";
+    if (code == V3Race._10231)
+      return "1023-1";
+    if (code == V3Race._10249)
+      return "1024-9";
+    if (code == V3Race._10264)
+      return "1026-4";
+    if (code == V3Race._10280)
+      return "1028-0";
+    if (code == V3Race._10306)
+      return "1030-6";
+    if (code == V3Race._10314)
+      return "1031-4";
+    if (code == V3Race._10330)
+      return "1033-0";
+    if (code == V3Race._10355)
+      return "1035-5";
+    if (code == V3Race._10371)
+      return "1037-1";
+    if (code == V3Race._10397)
+      return "1039-7";
+    if (code == V3Race._10413)
+      return "1041-3";
+    if (code == V3Race._10421)
+      return "1042-1";
+    if (code == V3Race._10447)
+      return "1044-7";
+    if (code == V3Race._10454)
+      return "1045-4";
+    if (code == V3Race._10462)
+      return "1046-2";
+    if (code == V3Race._10470)
+      return "1047-0";
+    if (code == V3Race._10488)
+      return "1048-8";
+    if (code == V3Race._10496)
+      return "1049-6";
+    if (code == V3Race._10504)
+      return "1050-4";
+    if (code == V3Race._10512)
+      return "1051-2";
+    if (code == V3Race._10538)
+      return "1053-8";
+    if (code == V3Race._10546)
+      return "1054-6";
+    if (code == V3Race._10553)
+      return "1055-3";
+    if (code == V3Race._10561)
+      return "1056-1";
+    if (code == V3Race._10579)
+      return "1057-9";
+    if (code == V3Race._10587)
+      return "1058-7";
+    if (code == V3Race._10595)
+      return "1059-5";
+    if (code == V3Race._10603)
+      return "1060-3";
+    if (code == V3Race._10611)
+      return "1061-1";
+    if (code == V3Race._10629)
+      return "1062-9";
+    if (code == V3Race._10637)
+      return "1063-7";
+    if (code == V3Race._10645)
+      return "1064-5";
+    if (code == V3Race._10652)
+      return "1065-2";
+    if (code == V3Race._10660)
+      return "1066-0";
+    if (code == V3Race._10686)
+      return "1068-6";
+    if (code == V3Race._10694)
+      return "1069-4";
+    if (code == V3Race._10702)
+      return "1070-2";
+    if (code == V3Race._10710)
+      return "1071-0";
+    if (code == V3Race._10728)
+      return "1072-8";
+    if (code == V3Race._10736)
+      return "1073-6";
+    if (code == V3Race._10744)
+      return "1074-4";
+    if (code == V3Race._10769)
+      return "1076-9";
+    if (code == V3Race._17418)
+      return "1741-8";
+    if (code == V3Race._17426)
+      return "1742-6";
+    if (code == V3Race._17434)
+      return "1743-4";
+    if (code == V3Race._17442)
+      return "1744-2";
+    if (code == V3Race._17459)
+      return "1745-9";
+    if (code == V3Race._17467)
+      return "1746-7";
+    if (code == V3Race._17475)
+      return "1747-5";
+    if (code == V3Race._17483)
+      return "1748-3";
+    if (code == V3Race._17491)
+      return "1749-1";
+    if (code == V3Race._17509)
+      return "1750-9";
+    if (code == V3Race._17517)
+      return "1751-7";
+    if (code == V3Race._17525)
+      return "1752-5";
+    if (code == V3Race._17533)
+      return "1753-3";
+    if (code == V3Race._17541)
+      return "1754-1";
+    if (code == V3Race._17558)
+      return "1755-8";
+    if (code == V3Race._17566)
+      return "1756-6";
+    if (code == V3Race._17574)
+      return "1757-4";
+    if (code == V3Race._17582)
+      return "1758-2";
+    if (code == V3Race._17590)
+      return "1759-0";
+    if (code == V3Race._17608)
+      return "1760-8";
+    if (code == V3Race._17616)
+      return "1761-6";
+    if (code == V3Race._17624)
+      return "1762-4";
+    if (code == V3Race._17632)
+      return "1763-2";
+    if (code == V3Race._17640)
+      return "1764-0";
+    if (code == V3Race._17657)
+      return "1765-7";
+    if (code == V3Race._17665)
+      return "1766-5";
+    if (code == V3Race._17673)
+      return "1767-3";
+    if (code == V3Race._17681)
+      return "1768-1";
+    if (code == V3Race._17699)
+      return "1769-9";
+    if (code == V3Race._17707)
+      return "1770-7";
+    if (code == V3Race._17715)
+      return "1771-5";
+    if (code == V3Race._17723)
+      return "1772-3";
+    if (code == V3Race._17731)
+      return "1773-1";
+    if (code == V3Race._17749)
+      return "1774-9";
+    if (code == V3Race._17756)
+      return "1775-6";
+    if (code == V3Race._17764)
+      return "1776-4";
+    if (code == V3Race._17772)
+      return "1777-2";
+    if (code == V3Race._17780)
+      return "1778-0";
+    if (code == V3Race._17798)
+      return "1779-8";
+    if (code == V3Race._17806)
+      return "1780-6";
+    if (code == V3Race._17814)
+      return "1781-4";
+    if (code == V3Race._17822)
+      return "1782-2";
+    if (code == V3Race._17830)
+      return "1783-0";
+    if (code == V3Race._17848)
+      return "1784-8";
+    if (code == V3Race._17855)
+      return "1785-5";
+    if (code == V3Race._17863)
+      return "1786-3";
+    if (code == V3Race._17871)
+      return "1787-1";
+    if (code == V3Race._17889)
+      return "1788-9";
+    if (code == V3Race._17897)
+      return "1789-7";
+    if (code == V3Race._17905)
+      return "1790-5";
+    if (code == V3Race._17913)
+      return "1791-3";
+    if (code == V3Race._17921)
+      return "1792-1";
+    if (code == V3Race._17939)
+      return "1793-9";
+    if (code == V3Race._17947)
+      return "1794-7";
+    if (code == V3Race._17954)
+      return "1795-4";
+    if (code == V3Race._17962)
+      return "1796-2";
+    if (code == V3Race._17970)
+      return "1797-0";
+    if (code == V3Race._17988)
+      return "1798-8";
+    if (code == V3Race._17996)
+      return "1799-6";
+    if (code == V3Race._18002)
+      return "1800-2";
+    if (code == V3Race._18010)
+      return "1801-0";
+    if (code == V3Race._18028)
+      return "1802-8";
+    if (code == V3Race._18036)
+      return "1803-6";
+    if (code == V3Race._18044)
+      return "1804-4";
+    if (code == V3Race._18051)
+      return "1805-1";
+    if (code == V3Race._18069)
+      return "1806-9";
+    if (code == V3Race._18077)
+      return "1807-7";
+    if (code == V3Race._18085)
+      return "1808-5";
+    if (code == V3Race._18093)
+      return "1809-3";
+    if (code == V3Race._10785)
+      return "1078-5";
+    if (code == V3Race._10801)
+      return "1080-1";
+    if (code == V3Race._10827)
+      return "1082-7";
+    if (code == V3Race._10835)
+      return "1083-5";
+    if (code == V3Race._10843)
+      return "1084-3";
+    if (code == V3Race._10868)
+      return "1086-8";
+    if (code == V3Race._10884)
+      return "1088-4";
+    if (code == V3Race._10892)
+      return "1089-2";
+    if (code == V3Race._10900)
+      return "1090-0";
+    if (code == V3Race._10918)
+      return "1091-8";
+    if (code == V3Race._10926)
+      return "1092-6";
+    if (code == V3Race._10934)
+      return "1093-4";
+    if (code == V3Race._10942)
+      return "1094-2";
+    if (code == V3Race._10959)
+      return "1095-9";
+    if (code == V3Race._10967)
+      return "1096-7";
+    if (code == V3Race._10975)
+      return "1097-5";
+    if (code == V3Race._10983)
+      return "1098-3";
+    if (code == V3Race._11007)
+      return "1100-7";
+    if (code == V3Race._11023)
+      return "1102-3";
+    if (code == V3Race._11031)
+      return "1103-1";
+    if (code == V3Race._11049)
+      return "1104-9";
+    if (code == V3Race._11064)
+      return "1106-4";
+    if (code == V3Race._11080)
+      return "1108-0";
+    if (code == V3Race._11098)
+      return "1109-8";
+    if (code == V3Race._11106)
+      return "1110-6";
+    if (code == V3Race._11122)
+      return "1112-2";
+    if (code == V3Race._11148)
+      return "1114-8";
+    if (code == V3Race._11155)
+      return "1115-5";
+    if (code == V3Race._11163)
+      return "1116-3";
+    if (code == V3Race._11171)
+      return "1117-1";
+    if (code == V3Race._11189)
+      return "1118-9";
+    if (code == V3Race._11197)
+      return "1119-7";
+    if (code == V3Race._11205)
+      return "1120-5";
+    if (code == V3Race._11213)
+      return "1121-3";
+    if (code == V3Race._11239)
+      return "1123-9";
+    if (code == V3Race._11247)
+      return "1124-7";
+    if (code == V3Race._11254)
+      return "1125-4";
+    if (code == V3Race._11262)
+      return "1126-2";
+    if (code == V3Race._11270)
+      return "1127-0";
+    if (code == V3Race._11288)
+      return "1128-8";
+    if (code == V3Race._11296)
+      return "1129-6";
+    if (code == V3Race._11304)
+      return "1130-4";
+    if (code == V3Race._11312)
+      return "1131-2";
+    if (code == V3Race._11320)
+      return "1132-0";
+    if (code == V3Race._11338)
+      return "1133-8";
+    if (code == V3Race._11346)
+      return "1134-6";
+    if (code == V3Race._11353)
+      return "1135-3";
+    if (code == V3Race._11361)
+      return "1136-1";
+    if (code == V3Race._11379)
+      return "1137-9";
+    if (code == V3Race._11387)
+      return "1138-7";
+    if (code == V3Race._11395)
+      return "1139-5";
+    if (code == V3Race._11403)
+      return "1140-3";
+    if (code == V3Race._11411)
+      return "1141-1";
+    if (code == V3Race._11429)
+      return "1142-9";
+    if (code == V3Race._11437)
+      return "1143-7";
+    if (code == V3Race._11445)
+      return "1144-5";
+    if (code == V3Race._11452)
+      return "1145-2";
+    if (code == V3Race._11460)
+      return "1146-0";
+    if (code == V3Race._11478)
+      return "1147-8";
+    if (code == V3Race._11486)
+      return "1148-6";
+    if (code == V3Race._11502)
+      return "1150-2";
+    if (code == V3Race._11510)
+      return "1151-0";
+    if (code == V3Race._11536)
+      return "1153-6";
+    if (code == V3Race._11551)
+      return "1155-1";
+    if (code == V3Race._11569)
+      return "1156-9";
+    if (code == V3Race._11577)
+      return "1157-7";
+    if (code == V3Race._11585)
+      return "1158-5";
+    if (code == V3Race._11593)
+      return "1159-3";
+    if (code == V3Race._11601)
+      return "1160-1";
+    if (code == V3Race._11627)
+      return "1162-7";
+    if (code == V3Race._11635)
+      return "1163-5";
+    if (code == V3Race._11650)
+      return "1165-0";
+    if (code == V3Race._11676)
+      return "1167-6";
+    if (code == V3Race._11692)
+      return "1169-2";
+    if (code == V3Race._11718)
+      return "1171-8";
+    if (code == V3Race._11734)
+      return "1173-4";
+    if (code == V3Race._11759)
+      return "1175-9";
+    if (code == V3Race._11767)
+      return "1176-7";
+    if (code == V3Race._11783)
+      return "1178-3";
+    if (code == V3Race._11809)
+      return "1180-9";
+    if (code == V3Race._11825)
+      return "1182-5";
+    if (code == V3Race._11841)
+      return "1184-1";
+    if (code == V3Race._11866)
+      return "1186-6";
+    if (code == V3Race._11874)
+      return "1187-4";
+    if (code == V3Race._11890)
+      return "1189-0";
+    if (code == V3Race._11916)
+      return "1191-6";
+    if (code == V3Race._11932)
+      return "1193-2";
+    if (code == V3Race._11940)
+      return "1194-0";
+    if (code == V3Race._11957)
+      return "1195-7";
+    if (code == V3Race._11965)
+      return "1196-5";
+    if (code == V3Race._11973)
+      return "1197-3";
+    if (code == V3Race._11981)
+      return "1198-1";
+    if (code == V3Race._11999)
+      return "1199-9";
+    if (code == V3Race._12005)
+      return "1200-5";
+    if (code == V3Race._12013)
+      return "1201-3";
+    if (code == V3Race._12021)
+      return "1202-1";
+    if (code == V3Race._12039)
+      return "1203-9";
+    if (code == V3Race._12047)
+      return "1204-7";
+    if (code == V3Race._12054)
+      return "1205-4";
+    if (code == V3Race._12070)
+      return "1207-0";
+    if (code == V3Race._12096)
+      return "1209-6";
+    if (code == V3Race._12112)
+      return "1211-2";
+    if (code == V3Race._12120)
+      return "1212-0";
+    if (code == V3Race._12146)
+      return "1214-6";
+    if (code == V3Race._12153)
+      return "1215-3";
+    if (code == V3Race._12161)
+      return "1216-1";
+    if (code == V3Race._12179)
+      return "1217-9";
+    if (code == V3Race._12187)
+      return "1218-7";
+    if (code == V3Race._12195)
+      return "1219-5";
+    if (code == V3Race._12203)
+      return "1220-3";
+    if (code == V3Race._12229)
+      return "1222-9";
+    if (code == V3Race._12237)
+      return "1223-7";
+    if (code == V3Race._12245)
+      return "1224-5";
+    if (code == V3Race._12252)
+      return "1225-2";
+    if (code == V3Race._12260)
+      return "1226-0";
+    if (code == V3Race._12278)
+      return "1227-8";
+    if (code == V3Race._12286)
+      return "1228-6";
+    if (code == V3Race._12294)
+      return "1229-4";
+    if (code == V3Race._12302)
+      return "1230-2";
+    if (code == V3Race._12310)
+      return "1231-0";
+    if (code == V3Race._12336)
+      return "1233-6";
+    if (code == V3Race._12344)
+      return "1234-4";
+    if (code == V3Race._12351)
+      return "1235-1";
+    if (code == V3Race._12369)
+      return "1236-9";
+    if (code == V3Race._12377)
+      return "1237-7";
+    if (code == V3Race._12385)
+      return "1238-5";
+    if (code == V3Race._12393)
+      return "1239-3";
+    if (code == V3Race._12401)
+      return "1240-1";
+    if (code == V3Race._12419)
+      return "1241-9";
+    if (code == V3Race._12427)
+      return "1242-7";
+    if (code == V3Race._12435)
+      return "1243-5";
+    if (code == V3Race._12443)
+      return "1244-3";
+    if (code == V3Race._12450)
+      return "1245-0";
+    if (code == V3Race._12468)
+      return "1246-8";
+    if (code == V3Race._12476)
+      return "1247-6";
+    if (code == V3Race._12484)
+      return "1248-4";
+    if (code == V3Race._12500)
+      return "1250-0";
+    if (code == V3Race._12526)
+      return "1252-6";
+    if (code == V3Race._12542)
+      return "1254-2";
+    if (code == V3Race._12567)
+      return "1256-7";
+    if (code == V3Race._12583)
+      return "1258-3";
+    if (code == V3Race._12609)
+      return "1260-9";
+    if (code == V3Race._12625)
+      return "1262-5";
+    if (code == V3Race._12641)
+      return "1264-1";
+    if (code == V3Race._12658)
+      return "1265-8";
+    if (code == V3Race._12674)
+      return "1267-4";
+    if (code == V3Race._12690)
+      return "1269-0";
+    if (code == V3Race._12716)
+      return "1271-6";
+    if (code == V3Race._12724)
+      return "1272-4";
+    if (code == V3Race._12732)
+      return "1273-2";
+    if (code == V3Race._12757)
+      return "1275-7";
+    if (code == V3Race._12773)
+      return "1277-3";
+    if (code == V3Race._12799)
+      return "1279-9";
+    if (code == V3Race._12815)
+      return "1281-5";
+    if (code == V3Race._12823)
+      return "1282-3";
+    if (code == V3Race._12831)
+      return "1283-1";
+    if (code == V3Race._12856)
+      return "1285-6";
+    if (code == V3Race._12864)
+      return "1286-4";
+    if (code == V3Race._12872)
+      return "1287-2";
+    if (code == V3Race._12880)
+      return "1288-0";
+    if (code == V3Race._12898)
+      return "1289-8";
+    if (code == V3Race._12906)
+      return "1290-6";
+    if (code == V3Race._12914)
+      return "1291-4";
+    if (code == V3Race._12922)
+      return "1292-2";
+    if (code == V3Race._12930)
+      return "1293-0";
+    if (code == V3Race._12948)
+      return "1294-8";
+    if (code == V3Race._12955)
+      return "1295-5";
+    if (code == V3Race._12971)
+      return "1297-1";
+    if (code == V3Race._12997)
+      return "1299-7";
+    if (code == V3Race._13011)
+      return "1301-1";
+    if (code == V3Race._13037)
+      return "1303-7";
+    if (code == V3Race._13052)
+      return "1305-2";
+    if (code == V3Race._13060)
+      return "1306-0";
+    if (code == V3Race._13078)
+      return "1307-8";
+    if (code == V3Race._13094)
+      return "1309-4";
+    if (code == V3Race._13102)
+      return "1310-2";
+    if (code == V3Race._13128)
+      return "1312-8";
+    if (code == V3Race._13136)
+      return "1313-6";
+    if (code == V3Race._13144)
+      return "1314-4";
+    if (code == V3Race._13151)
+      return "1315-1";
+    if (code == V3Race._13177)
+      return "1317-7";
+    if (code == V3Race._13193)
+      return "1319-3";
+    if (code == V3Race._13219)
+      return "1321-9";
+    if (code == V3Race._13235)
+      return "1323-5";
+    if (code == V3Race._13250)
+      return "1325-0";
+    if (code == V3Race._13268)
+      return "1326-8";
+    if (code == V3Race._13276)
+      return "1327-6";
+    if (code == V3Race._13284)
+      return "1328-4";
+    if (code == V3Race._13292)
+      return "1329-2";
+    if (code == V3Race._13318)
+      return "1331-8";
+    if (code == V3Race._13326)
+      return "1332-6";
+    if (code == V3Race._13334)
+      return "1333-4";
+    if (code == V3Race._13342)
+      return "1334-2";
+    if (code == V3Race._13359)
+      return "1335-9";
+    if (code == V3Race._13367)
+      return "1336-7";
+    if (code == V3Race._13375)
+      return "1337-5";
+    if (code == V3Race._13383)
+      return "1338-3";
+    if (code == V3Race._13409)
+      return "1340-9";
+    if (code == V3Race._13425)
+      return "1342-5";
+    if (code == V3Race._13441)
+      return "1344-1";
+    if (code == V3Race._13458)
+      return "1345-8";
+    if (code == V3Race._13466)
+      return "1346-6";
+    if (code == V3Race._13482)
+      return "1348-2";
+    if (code == V3Race._13508)
+      return "1350-8";
+    if (code == V3Race._13524)
+      return "1352-4";
+    if (code == V3Race._13540)
+      return "1354-0";
+    if (code == V3Race._13565)
+      return "1356-5";
+    if (code == V3Race._13581)
+      return "1358-1";
+    if (code == V3Race._13599)
+      return "1359-9";
+    if (code == V3Race._13607)
+      return "1360-7";
+    if (code == V3Race._13615)
+      return "1361-5";
+    if (code == V3Race._13631)
+      return "1363-1";
+    if (code == V3Race._13656)
+      return "1365-6";
+    if (code == V3Race._13664)
+      return "1366-4";
+    if (code == V3Race._13680)
+      return "1368-0";
+    if (code == V3Race._13706)
+      return "1370-6";
+    if (code == V3Race._13722)
+      return "1372-2";
+    if (code == V3Race._13748)
+      return "1374-8";
+    if (code == V3Race._13763)
+      return "1376-3";
+    if (code == V3Race._13789)
+      return "1378-9";
+    if (code == V3Race._13805)
+      return "1380-5";
+    if (code == V3Race._13821)
+      return "1382-1";
+    if (code == V3Race._13839)
+      return "1383-9";
+    if (code == V3Race._13847)
+      return "1384-7";
+    if (code == V3Race._13854)
+      return "1385-4";
+    if (code == V3Race._13870)
+      return "1387-0";
+    if (code == V3Race._13896)
+      return "1389-6";
+    if (code == V3Race._13912)
+      return "1391-2";
+    if (code == V3Race._13920)
+      return "1392-0";
+    if (code == V3Race._13938)
+      return "1393-8";
+    if (code == V3Race._13946)
+      return "1394-6";
+    if (code == V3Race._13953)
+      return "1395-3";
+    if (code == V3Race._13961)
+      return "1396-1";
+    if (code == V3Race._13979)
+      return "1397-9";
+    if (code == V3Race._13987)
+      return "1398-7";
+    if (code == V3Race._13995)
+      return "1399-5";
+    if (code == V3Race._14001)
+      return "1400-1";
+    if (code == V3Race._14019)
+      return "1401-9";
+    if (code == V3Race._14035)
+      return "1403-5";
+    if (code == V3Race._14050)
+      return "1405-0";
+    if (code == V3Race._14076)
+      return "1407-6";
+    if (code == V3Race._14092)
+      return "1409-2";
+    if (code == V3Race._14118)
+      return "1411-8";
+    if (code == V3Race._14126)
+      return "1412-6";
+    if (code == V3Race._14134)
+      return "1413-4";
+    if (code == V3Race._14142)
+      return "1414-2";
+    if (code == V3Race._14167)
+      return "1416-7";
+    if (code == V3Race._14175)
+      return "1417-5";
+    if (code == V3Race._14183)
+      return "1418-3";
+    if (code == V3Race._14191)
+      return "1419-1";
+    if (code == V3Race._14209)
+      return "1420-9";
+    if (code == V3Race._14217)
+      return "1421-7";
+    if (code == V3Race._14225)
+      return "1422-5";
+    if (code == V3Race._14233)
+      return "1423-3";
+    if (code == V3Race._14241)
+      return "1424-1";
+    if (code == V3Race._14258)
+      return "1425-8";
+    if (code == V3Race._14266)
+      return "1426-6";
+    if (code == V3Race._14274)
+      return "1427-4";
+    if (code == V3Race._14282)
+      return "1428-2";
+    if (code == V3Race._14290)
+      return "1429-0";
+    if (code == V3Race._14308)
+      return "1430-8";
+    if (code == V3Race._14316)
+      return "1431-6";
+    if (code == V3Race._14324)
+      return "1432-4";
+    if (code == V3Race._14332)
+      return "1433-2";
+    if (code == V3Race._14340)
+      return "1434-0";
+    if (code == V3Race._14357)
+      return "1435-7";
+    if (code == V3Race._14365)
+      return "1436-5";
+    if (code == V3Race._14373)
+      return "1437-3";
+    if (code == V3Race._14399)
+      return "1439-9";
+    if (code == V3Race._14415)
+      return "1441-5";
+    if (code == V3Race._14423)
+      return "1442-3";
+    if (code == V3Race._14431)
+      return "1443-1";
+    if (code == V3Race._14456)
+      return "1445-6";
+    if (code == V3Race._14464)
+      return "1446-4";
+    if (code == V3Race._14480)
+      return "1448-0";
+    if (code == V3Race._14506)
+      return "1450-6";
+    if (code == V3Race._14514)
+      return "1451-4";
+    if (code == V3Race._14530)
+      return "1453-0";
+    if (code == V3Race._14548)
+      return "1454-8";
+    if (code == V3Race._14563)
+      return "1456-3";
+    if (code == V3Race._14571)
+      return "1457-1";
+    if (code == V3Race._14589)
+      return "1458-9";
+    if (code == V3Race._14605)
+      return "1460-5";
+    if (code == V3Race._14621)
+      return "1462-1";
+    if (code == V3Race._14647)
+      return "1464-7";
+    if (code == V3Race._14654)
+      return "1465-4";
+    if (code == V3Race._14662)
+      return "1466-2";
+    if (code == V3Race._14670)
+      return "1467-0";
+    if (code == V3Race._14688)
+      return "1468-8";
+    if (code == V3Race._14696)
+      return "1469-6";
+    if (code == V3Race._14704)
+      return "1470-4";
+    if (code == V3Race._14712)
+      return "1471-2";
+    if (code == V3Race._14720)
+      return "1472-0";
+    if (code == V3Race._14746)
+      return "1474-6";
+    if (code == V3Race._14753)
+      return "1475-3";
+    if (code == V3Race._14761)
+      return "1476-1";
+    if (code == V3Race._14787)
+      return "1478-7";
+    if (code == V3Race._14795)
+      return "1479-5";
+    if (code == V3Race._14803)
+      return "1480-3";
+    if (code == V3Race._14811)
+      return "1481-1";
+    if (code == V3Race._14829)
+      return "1482-9";
+    if (code == V3Race._14837)
+      return "1483-7";
+    if (code == V3Race._14845)
+      return "1484-5";
+    if (code == V3Race._14852)
+      return "1485-2";
+    if (code == V3Race._14878)
+      return "1487-8";
+    if (code == V3Race._14894)
+      return "1489-4";
+    if (code == V3Race._14902)
+      return "1490-2";
+    if (code == V3Race._14910)
+      return "1491-0";
+    if (code == V3Race._14928)
+      return "1492-8";
+    if (code == V3Race._14936)
+      return "1493-6";
+    if (code == V3Race._14944)
+      return "1494-4";
+    if (code == V3Race._14951)
+      return "1495-1";
+    if (code == V3Race._14969)
+      return "1496-9";
+    if (code == V3Race._14977)
+      return "1497-7";
+    if (code == V3Race._14985)
+      return "1498-5";
+    if (code == V3Race._14993)
+      return "1499-3";
+    if (code == V3Race._15008)
+      return "1500-8";
+    if (code == V3Race._15016)
+      return "1501-6";
+    if (code == V3Race._15024)
+      return "1502-4";
+    if (code == V3Race._15032)
+      return "1503-2";
+    if (code == V3Race._15040)
+      return "1504-0";
+    if (code == V3Race._15057)
+      return "1505-7";
+    if (code == V3Race._15065)
+      return "1506-5";
+    if (code == V3Race._15073)
+      return "1507-3";
+    if (code == V3Race._15081)
+      return "1508-1";
+    if (code == V3Race._15099)
+      return "1509-9";
+    if (code == V3Race._15107)
+      return "1510-7";
+    if (code == V3Race._15115)
+      return "1511-5";
+    if (code == V3Race._15123)
+      return "1512-3";
+    if (code == V3Race._15131)
+      return "1513-1";
+    if (code == V3Race._15149)
+      return "1514-9";
+    if (code == V3Race._15156)
+      return "1515-6";
+    if (code == V3Race._15164)
+      return "1516-4";
+    if (code == V3Race._15180)
+      return "1518-0";
+    if (code == V3Race._15198)
+      return "1519-8";
+    if (code == V3Race._15206)
+      return "1520-6";
+    if (code == V3Race._15214)
+      return "1521-4";
+    if (code == V3Race._15222)
+      return "1522-2";
+    if (code == V3Race._15230)
+      return "1523-0";
+    if (code == V3Race._15248)
+      return "1524-8";
+    if (code == V3Race._15255)
+      return "1525-5";
+    if (code == V3Race._15263)
+      return "1526-3";
+    if (code == V3Race._15271)
+      return "1527-1";
+    if (code == V3Race._15289)
+      return "1528-9";
+    if (code == V3Race._15297)
+      return "1529-7";
+    if (code == V3Race._15305)
+      return "1530-5";
+    if (code == V3Race._15313)
+      return "1531-3";
+    if (code == V3Race._15321)
+      return "1532-1";
+    if (code == V3Race._15339)
+      return "1533-9";
+    if (code == V3Race._15347)
+      return "1534-7";
+    if (code == V3Race._15354)
+      return "1535-4";
+    if (code == V3Race._15362)
+      return "1536-2";
+    if (code == V3Race._15370)
+      return "1537-0";
+    if (code == V3Race._15388)
+      return "1538-8";
+    if (code == V3Race._15396)
+      return "1539-6";
+    if (code == V3Race._15412)
+      return "1541-2";
+    if (code == V3Race._15438)
+      return "1543-8";
+    if (code == V3Race._15453)
+      return "1545-3";
+    if (code == V3Race._15479)
+      return "1547-9";
+    if (code == V3Race._15495)
+      return "1549-5";
+    if (code == V3Race._15511)
+      return "1551-1";
+    if (code == V3Race._15529)
+      return "1552-9";
+    if (code == V3Race._15537)
+      return "1553-7";
+    if (code == V3Race._15545)
+      return "1554-5";
+    if (code == V3Race._15560)
+      return "1556-0";
+    if (code == V3Race._15586)
+      return "1558-6";
+    if (code == V3Race._15602)
+      return "1560-2";
+    if (code == V3Race._15628)
+      return "1562-8";
+    if (code == V3Race._15644)
+      return "1564-4";
+    if (code == V3Race._15669)
+      return "1566-9";
+    if (code == V3Race._15677)
+      return "1567-7";
+    if (code == V3Race._15685)
+      return "1568-5";
+    if (code == V3Race._15693)
+      return "1569-3";
+    if (code == V3Race._15701)
+      return "1570-1";
+    if (code == V3Race._15719)
+      return "1571-9";
+    if (code == V3Race._15735)
+      return "1573-5";
+    if (code == V3Race._15743)
+      return "1574-3";
+    if (code == V3Race._15768)
+      return "1576-8";
+    if (code == V3Race._15784)
+      return "1578-4";
+    if (code == V3Race._15792)
+      return "1579-2";
+    if (code == V3Race._15800)
+      return "1580-0";
+    if (code == V3Race._15826)
+      return "1582-6";
+    if (code == V3Race._15842)
+      return "1584-2";
+    if (code == V3Race._15867)
+      return "1586-7";
+    if (code == V3Race._15875)
+      return "1587-5";
+    if (code == V3Race._15883)
+      return "1588-3";
+    if (code == V3Race._15891)
+      return "1589-1";
+    if (code == V3Race._15909)
+      return "1590-9";
+    if (code == V3Race._15917)
+      return "1591-7";
+    if (code == V3Race._15925)
+      return "1592-5";
+    if (code == V3Race._15933)
+      return "1593-3";
+    if (code == V3Race._15941)
+      return "1594-1";
+    if (code == V3Race._15958)
+      return "1595-8";
+    if (code == V3Race._15966)
+      return "1596-6";
+    if (code == V3Race._15974)
+      return "1597-4";
+    if (code == V3Race._15982)
+      return "1598-2";
+    if (code == V3Race._15990)
+      return "1599-0";
+    if (code == V3Race._16006)
+      return "1600-6";
+    if (code == V3Race._16022)
+      return "1602-2";
+    if (code == V3Race._16030)
+      return "1603-0";
+    if (code == V3Race._16048)
+      return "1604-8";
+    if (code == V3Race._16055)
+      return "1605-5";
+    if (code == V3Race._16071)
+      return "1607-1";
+    if (code == V3Race._16097)
+      return "1609-7";
+    if (code == V3Race._16105)
+      return "1610-5";
+    if (code == V3Race._16113)
+      return "1611-3";
+    if (code == V3Race._16121)
+      return "1612-1";
+    if (code == V3Race._16139)
+      return "1613-9";
+    if (code == V3Race._16147)
+      return "1614-7";
+    if (code == V3Race._16154)
+      return "1615-4";
+    if (code == V3Race._16162)
+      return "1616-2";
+    if (code == V3Race._16170)
+      return "1617-0";
+    if (code == V3Race._16188)
+      return "1618-8";
+    if (code == V3Race._16196)
+      return "1619-6";
+    if (code == V3Race._16204)
+      return "1620-4";
+    if (code == V3Race._16212)
+      return "1621-2";
+    if (code == V3Race._16220)
+      return "1622-0";
+    if (code == V3Race._16238)
+      return "1623-8";
+    if (code == V3Race._16246)
+      return "1624-6";
+    if (code == V3Race._16253)
+      return "1625-3";
+    if (code == V3Race._16261)
+      return "1626-1";
+    if (code == V3Race._16279)
+      return "1627-9";
+    if (code == V3Race._16287)
+      return "1628-7";
+    if (code == V3Race._16295)
+      return "1629-5";
+    if (code == V3Race._16303)
+      return "1630-3";
+    if (code == V3Race._16311)
+      return "1631-1";
+    if (code == V3Race._16329)
+      return "1632-9";
+    if (code == V3Race._16337)
+      return "1633-7";
+    if (code == V3Race._16345)
+      return "1634-5";
+    if (code == V3Race._16352)
+      return "1635-2";
+    if (code == V3Race._16360)
+      return "1636-0";
+    if (code == V3Race._16378)
+      return "1637-8";
+    if (code == V3Race._16386)
+      return "1638-6";
+    if (code == V3Race._16394)
+      return "1639-4";
+    if (code == V3Race._16402)
+      return "1640-2";
+    if (code == V3Race._16410)
+      return "1641-0";
+    if (code == V3Race._16436)
+      return "1643-6";
+    if (code == V3Race._16451)
+      return "1645-1";
+    if (code == V3Race._16477)
+      return "1647-7";
+    if (code == V3Race._16493)
+      return "1649-3";
+    if (code == V3Race._16519)
+      return "1651-9";
+    if (code == V3Race._16535)
+      return "1653-5";
+    if (code == V3Race._16543)
+      return "1654-3";
+    if (code == V3Race._16550)
+      return "1655-0";
+    if (code == V3Race._16568)
+      return "1656-8";
+    if (code == V3Race._16576)
+      return "1657-6";
+    if (code == V3Race._16592)
+      return "1659-2";
+    if (code == V3Race._16618)
+      return "1661-8";
+    if (code == V3Race._16634)
+      return "1663-4";
+    if (code == V3Race._16659)
+      return "1665-9";
+    if (code == V3Race._16675)
+      return "1667-5";
+    if (code == V3Race._16683)
+      return "1668-3";
+    if (code == V3Race._16709)
+      return "1670-9";
+    if (code == V3Race._16717)
+      return "1671-7";
+    if (code == V3Race._16725)
+      return "1672-5";
+    if (code == V3Race._16733)
+      return "1673-3";
+    if (code == V3Race._16758)
+      return "1675-8";
+    if (code == V3Race._16774)
+      return "1677-4";
+    if (code == V3Race._16790)
+      return "1679-0";
+    if (code == V3Race._16808)
+      return "1680-8";
+    if (code == V3Race._16816)
+      return "1681-6";
+    if (code == V3Race._16832)
+      return "1683-2";
+    if (code == V3Race._16857)
+      return "1685-7";
+    if (code == V3Race._16873)
+      return "1687-3";
+    if (code == V3Race._16881)
+      return "1688-1";
+    if (code == V3Race._16899)
+      return "1689-9";
+    if (code == V3Race._16907)
+      return "1690-7";
+    if (code == V3Race._16923)
+      return "1692-3";
+    if (code == V3Race._16949)
+      return "1694-9";
+    if (code == V3Race._16964)
+      return "1696-4";
+    if (code == V3Race._16972)
+      return "1697-2";
+    if (code == V3Race._16980)
+      return "1698-0";
+    if (code == V3Race._17004)
+      return "1700-4";
+    if (code == V3Race._17020)
+      return "1702-0";
+    if (code == V3Race._17046)
+      return "1704-6";
+    if (code == V3Race._17053)
+      return "1705-3";
+    if (code == V3Race._17079)
+      return "1707-9";
+    if (code == V3Race._17095)
+      return "1709-5";
+    if (code == V3Race._17111)
+      return "1711-1";
+    if (code == V3Race._17129)
+      return "1712-9";
+    if (code == V3Race._17137)
+      return "1713-7";
+    if (code == V3Race._17152)
+      return "1715-2";
+    if (code == V3Race._17178)
+      return "1717-8";
+    if (code == V3Race._17186)
+      return "1718-6";
+    if (code == V3Race._17194)
+      return "1719-4";
+    if (code == V3Race._17202)
+      return "1720-2";
+    if (code == V3Race._17228)
+      return "1722-8";
+    if (code == V3Race._17244)
+      return "1724-4";
+    if (code == V3Race._17251)
+      return "1725-1";
+    if (code == V3Race._17269)
+      return "1726-9";
+    if (code == V3Race._17277)
+      return "1727-7";
+    if (code == V3Race._17285)
+      return "1728-5";
+    if (code == V3Race._17293)
+      return "1729-3";
+    if (code == V3Race._17301)
+      return "1730-1";
+    if (code == V3Race._17319)
+      return "1731-9";
+    if (code == V3Race._17327)
+      return "1732-7";
+    if (code == V3Race._17335)
+      return "1733-5";
+    if (code == V3Race._17350)
+      return "1735-0";
+    if (code == V3Race._17376)
+      return "1737-6";
+    if (code == V3Race._17392)
+      return "1739-2";
+    if (code == V3Race._17400)
+      return "1740-0";
+    if (code == V3Race._18119)
+      return "1811-9";
+    if (code == V3Race._18135)
+      return "1813-5";
+    if (code == V3Race._18143)
+      return "1814-3";
+    if (code == V3Race._18150)
+      return "1815-0";
+    if (code == V3Race._18168)
+      return "1816-8";
+    if (code == V3Race._18176)
+      return "1817-6";
+    if (code == V3Race._18184)
+      return "1818-4";
+    if (code == V3Race._18192)
+      return "1819-2";
+    if (code == V3Race._18200)
+      return "1820-0";
+    if (code == V3Race._18218)
+      return "1821-8";
+    if (code == V3Race._18226)
+      return "1822-6";
+    if (code == V3Race._18234)
+      return "1823-4";
+    if (code == V3Race._18242)
+      return "1824-2";
+    if (code == V3Race._18259)
+      return "1825-9";
+    if (code == V3Race._18267)
+      return "1826-7";
+    if (code == V3Race._18275)
+      return "1827-5";
+    if (code == V3Race._18283)
+      return "1828-3";
+    if (code == V3Race._18291)
+      return "1829-1";
+    if (code == V3Race._18309)
+      return "1830-9";
+    if (code == V3Race._18317)
+      return "1831-7";
+    if (code == V3Race._18325)
+      return "1832-5";
+    if (code == V3Race._18333)
+      return "1833-3";
+    if (code == V3Race._18341)
+      return "1834-1";
+    if (code == V3Race._18358)
+      return "1835-8";
+    if (code == V3Race._18374)
+      return "1837-4";
+    if (code == V3Race._18382)
+      return "1838-2";
+    if (code == V3Race._18408)
+      return "1840-8";
+    if (code == V3Race._18424)
+      return "1842-4";
+    if (code == V3Race._18440)
+      return "1844-0";
+    if (code == V3Race._18457)
+      return "1845-7";
+    if (code == V3Race._18465)
+      return "1846-5";
+    if (code == V3Race._18473)
+      return "1847-3";
+    if (code == V3Race._18481)
+      return "1848-1";
+    if (code == V3Race._18499)
+      return "1849-9";
+    if (code == V3Race._18507)
+      return "1850-7";
+    if (code == V3Race._18515)
+      return "1851-5";
+    if (code == V3Race._18523)
+      return "1852-3";
+    if (code == V3Race._18531)
+      return "1853-1";
+    if (code == V3Race._18549)
+      return "1854-9";
+    if (code == V3Race._18556)
+      return "1855-6";
+    if (code == V3Race._18564)
+      return "1856-4";
+    if (code == V3Race._18572)
+      return "1857-2";
+    if (code == V3Race._18580)
+      return "1858-0";
+    if (code == V3Race._18598)
+      return "1859-8";
+    if (code == V3Race._18606)
+      return "1860-6";
+    if (code == V3Race._18614)
+      return "1861-4";
+    if (code == V3Race._18622)
+      return "1862-2";
+    if (code == V3Race._18630)
+      return "1863-0";
+    if (code == V3Race._18648)
+      return "1864-8";
+    if (code == V3Race._18655)
+      return "1865-5";
+    if (code == V3Race._18663)
+      return "1866-3";
+    if (code == V3Race._18671)
+      return "1867-1";
+    if (code == V3Race._18689)
+      return "1868-9";
+    if (code == V3Race._18697)
+      return "1869-7";
+    if (code == V3Race._18705)
+      return "1870-5";
+    if (code == V3Race._18713)
+      return "1871-3";
+    if (code == V3Race._18721)
+      return "1872-1";
+    if (code == V3Race._18739)
+      return "1873-9";
+    if (code == V3Race._18747)
+      return "1874-7";
+    if (code == V3Race._18754)
+      return "1875-4";
+    if (code == V3Race._18762)
+      return "1876-2";
+    if (code == V3Race._18770)
+      return "1877-0";
+    if (code == V3Race._18788)
+      return "1878-8";
+    if (code == V3Race._18796)
+      return "1879-6";
+    if (code == V3Race._18804)
+      return "1880-4";
+    if (code == V3Race._18812)
+      return "1881-2";
+    if (code == V3Race._18820)
+      return "1882-0";
+    if (code == V3Race._18838)
+      return "1883-8";
+    if (code == V3Race._18846)
+      return "1884-6";
+    if (code == V3Race._18853)
+      return "1885-3";
+    if (code == V3Race._18861)
+      return "1886-1";
+    if (code == V3Race._18879)
+      return "1887-9";
+    if (code == V3Race._18887)
+      return "1888-7";
+    if (code == V3Race._18895)
+      return "1889-5";
+    if (code == V3Race._18911)
+      return "1891-1";
+    if (code == V3Race._18929)
+      return "1892-9";
+    if (code == V3Race._18937)
+      return "1893-7";
+    if (code == V3Race._18945)
+      return "1894-5";
+    if (code == V3Race._18960)
+      return "1896-0";
+    if (code == V3Race._18978)
+      return "1897-8";
+    if (code == V3Race._18986)
+      return "1898-6";
+    if (code == V3Race._18994)
+      return "1899-4";
+    if (code == V3Race._19000)
+      return "1900-0";
+    if (code == V3Race._19018)
+      return "1901-8";
+    if (code == V3Race._19026)
+      return "1902-6";
+    if (code == V3Race._19034)
+      return "1903-4";
+    if (code == V3Race._19042)
+      return "1904-2";
+    if (code == V3Race._19059)
+      return "1905-9";
+    if (code == V3Race._19067)
+      return "1906-7";
+    if (code == V3Race._19075)
+      return "1907-5";
+    if (code == V3Race._19083)
+      return "1908-3";
+    if (code == V3Race._19091)
+      return "1909-1";
+    if (code == V3Race._19109)
+      return "1910-9";
+    if (code == V3Race._19117)
+      return "1911-7";
+    if (code == V3Race._19125)
+      return "1912-5";
+    if (code == V3Race._19133)
+      return "1913-3";
+    if (code == V3Race._19141)
+      return "1914-1";
+    if (code == V3Race._19158)
+      return "1915-8";
+    if (code == V3Race._19166)
+      return "1916-6";
+    if (code == V3Race._19174)
+      return "1917-4";
+    if (code == V3Race._19182)
+      return "1918-2";
+    if (code == V3Race._19190)
+      return "1919-0";
+    if (code == V3Race._19208)
+      return "1920-8";
+    if (code == V3Race._19216)
+      return "1921-6";
+    if (code == V3Race._19224)
+      return "1922-4";
+    if (code == V3Race._19232)
+      return "1923-2";
+    if (code == V3Race._19240)
+      return "1924-0";
+    if (code == V3Race._19257)
+      return "1925-7";
+    if (code == V3Race._19265)
+      return "1926-5";
+    if (code == V3Race._19273)
+      return "1927-3";
+    if (code == V3Race._19281)
+      return "1928-1";
+    if (code == V3Race._19299)
+      return "1929-9";
+    if (code == V3Race._19307)
+      return "1930-7";
+    if (code == V3Race._19315)
+      return "1931-5";
+    if (code == V3Race._19323)
+      return "1932-3";
+    if (code == V3Race._19331)
+      return "1933-1";
+    if (code == V3Race._19349)
+      return "1934-9";
+    if (code == V3Race._19356)
+      return "1935-6";
+    if (code == V3Race._19364)
+      return "1936-4";
+    if (code == V3Race._19372)
+      return "1937-2";
+    if (code == V3Race._19380)
+      return "1938-0";
+    if (code == V3Race._19398)
+      return "1939-8";
+    if (code == V3Race._19406)
+      return "1940-6";
+    if (code == V3Race._19414)
+      return "1941-4";
+    if (code == V3Race._19422)
+      return "1942-2";
+    if (code == V3Race._19430)
+      return "1943-0";
+    if (code == V3Race._19448)
+      return "1944-8";
+    if (code == V3Race._19455)
+      return "1945-5";
+    if (code == V3Race._19463)
+      return "1946-3";
+    if (code == V3Race._19471)
+      return "1947-1";
+    if (code == V3Race._19489)
+      return "1948-9";
+    if (code == V3Race._19497)
+      return "1949-7";
+    if (code == V3Race._19505)
+      return "1950-5";
+    if (code == V3Race._19513)
+      return "1951-3";
+    if (code == V3Race._19521)
+      return "1952-1";
+    if (code == V3Race._19539)
+      return "1953-9";
+    if (code == V3Race._19547)
+      return "1954-7";
+    if (code == V3Race._19554)
+      return "1955-4";
+    if (code == V3Race._19562)
+      return "1956-2";
+    if (code == V3Race._19570)
+      return "1957-0";
+    if (code == V3Race._19588)
+      return "1958-8";
+    if (code == V3Race._19596)
+      return "1959-6";
+    if (code == V3Race._19604)
+      return "1960-4";
+    if (code == V3Race._19612)
+      return "1961-2";
+    if (code == V3Race._19620)
+      return "1962-0";
+    if (code == V3Race._19638)
+      return "1963-8";
+    if (code == V3Race._19646)
+      return "1964-6";
+    if (code == V3Race._19661)
+      return "1966-1";
+    if (code == V3Race._19687)
+      return "1968-7";
+    if (code == V3Race._19695)
+      return "1969-5";
+    if (code == V3Race._19703)
+      return "1970-3";
+    if (code == V3Race._19729)
+      return "1972-9";
+    if (code == V3Race._19737)
+      return "1973-7";
+    if (code == V3Race._19745)
+      return "1974-5";
+    if (code == V3Race._19752)
+      return "1975-2";
+    if (code == V3Race._19760)
+      return "1976-0";
+    if (code == V3Race._19778)
+      return "1977-8";
+    if (code == V3Race._19786)
+      return "1978-6";
+    if (code == V3Race._19794)
+      return "1979-4";
+    if (code == V3Race._19802)
+      return "1980-2";
+    if (code == V3Race._19810)
+      return "1981-0";
+    if (code == V3Race._19828)
+      return "1982-8";
+    if (code == V3Race._19844)
+      return "1984-4";
+    if (code == V3Race._19851)
+      return "1985-1";
+    if (code == V3Race._19869)
+      return "1986-9";
+    if (code == V3Race._19877)
+      return "1987-7";
+    if (code == V3Race._19885)
+      return "1988-5";
+    if (code == V3Race._19901)
+      return "1990-1";
+    if (code == V3Race._19927)
+      return "1992-7";
+    if (code == V3Race._19935)
+      return "1993-5";
+    if (code == V3Race._19943)
+      return "1994-3";
+    if (code == V3Race._19950)
+      return "1995-0";
+    if (code == V3Race._19968)
+      return "1996-8";
+    if (code == V3Race._19976)
+      return "1997-6";
+    if (code == V3Race._19984)
+      return "1998-4";
+    if (code == V3Race._19992)
+      return "1999-2";
+    if (code == V3Race._20008)
+      return "2000-8";
+    if (code == V3Race._20024)
+      return "2002-4";
+    if (code == V3Race._20040)
+      return "2004-0";
+    if (code == V3Race._20065)
+      return "2006-5";
+    if (code == V3Race._20073)
+      return "2007-3";
+    if (code == V3Race._20081)
+      return "2008-1";
+    if (code == V3Race._20099)
+      return "2009-9";
+    if (code == V3Race._20107)
+      return "2010-7";
+    if (code == V3Race._20115)
+      return "2011-5";
+    if (code == V3Race._20123)
+      return "2012-3";
+    if (code == V3Race._20131)
+      return "2013-1";
+    if (code == V3Race._20149)
+      return "2014-9";
+    if (code == V3Race._20156)
+      return "2015-6";
+    if (code == V3Race._20164)
+      return "2016-4";
+    if (code == V3Race._20172)
+      return "2017-2";
+    if (code == V3Race._20180)
+      return "2018-0";
+    if (code == V3Race._20198)
+      return "2019-8";
+    if (code == V3Race._20206)
+      return "2020-6";
+    if (code == V3Race._20214)
+      return "2021-4";
+    if (code == V3Race._20222)
+      return "2022-2";
+    if (code == V3Race._20230)
+      return "2023-0";
+    if (code == V3Race._20248)
+      return "2024-8";
+    if (code == V3Race._20255)
+      return "2025-5";
+    if (code == V3Race._20263)
+      return "2026-3";
+    if (code == V3Race._20289)
+      return "2028-9";
+    if (code == V3Race._20297)
+      return "2029-7";
+    if (code == V3Race._20305)
+      return "2030-5";
+    if (code == V3Race._20313)
+      return "2031-3";
+    if (code == V3Race._20321)
+      return "2032-1";
+    if (code == V3Race._20339)
+      return "2033-9";
+    if (code == V3Race._20347)
+      return "2034-7";
+    if (code == V3Race._20354)
+      return "2035-4";
+    if (code == V3Race._20362)
+      return "2036-2";
+    if (code == V3Race._20370)
+      return "2037-0";
+    if (code == V3Race._20388)
+      return "2038-8";
+    if (code == V3Race._20396)
+      return "2039-6";
+    if (code == V3Race._20404)
+      return "2040-4";
+    if (code == V3Race._20412)
+      return "2041-2";
+    if (code == V3Race._20420)
+      return "2042-0";
+    if (code == V3Race._20438)
+      return "2043-8";
+    if (code == V3Race._20446)
+      return "2044-6";
+    if (code == V3Race._20453)
+      return "2045-3";
+    if (code == V3Race._20461)
+      return "2046-1";
+    if (code == V3Race._20479)
+      return "2047-9";
+    if (code == V3Race._20487)
+      return "2048-7";
+    if (code == V3Race._20495)
+      return "2049-5";
+    if (code == V3Race._20503)
+      return "2050-3";
+    if (code == V3Race._20511)
+      return "2051-1";
+    if (code == V3Race._20529)
+      return "2052-9";
+    if (code == V3Race._20545)
+      return "2054-5";
+    if (code == V3Race._20560)
+      return "2056-0";
+    if (code == V3Race._20586)
+      return "2058-6";
+    if (code == V3Race._20602)
+      return "2060-2";
+    if (code == V3Race._20610)
+      return "2061-0";
+    if (code == V3Race._20628)
+      return "2062-8";
+    if (code == V3Race._20636)
+      return "2063-6";
+    if (code == V3Race._20644)
+      return "2064-4";
+    if (code == V3Race._20651)
+      return "2065-1";
+    if (code == V3Race._20669)
+      return "2066-9";
+    if (code == V3Race._20677)
+      return "2067-7";
+    if (code == V3Race._20685)
+      return "2068-5";
+    if (code == V3Race._20693)
+      return "2069-3";
+    if (code == V3Race._20701)
+      return "2070-1";
+    if (code == V3Race._20719)
+      return "2071-9";
+    if (code == V3Race._20727)
+      return "2072-7";
+    if (code == V3Race._20735)
+      return "2073-5";
+    if (code == V3Race._20743)
+      return "2074-3";
+    if (code == V3Race._20750)
+      return "2075-0";
+    if (code == V3Race._20768)
+      return "2076-8";
+    if (code == V3Race._20784)
+      return "2078-4";
+    if (code == V3Race._20792)
+      return "2079-2";
+    if (code == V3Race._20800)
+      return "2080-0";
+    if (code == V3Race._20818)
+      return "2081-8";
+    if (code == V3Race._20826)
+      return "2082-6";
+    if (code == V3Race._20834)
+      return "2083-4";
+    if (code == V3Race._20859)
+      return "2085-9";
+    if (code == V3Race._20867)
+      return "2086-7";
+    if (code == V3Race._20875)
+      return "2087-5";
+    if (code == V3Race._20883)
+      return "2088-3";
+    if (code == V3Race._20891)
+      return "2089-1";
+    if (code == V3Race._20909)
+      return "2090-9";
+    if (code == V3Race._20917)
+      return "2091-7";
+    if (code == V3Race._20925)
+      return "2092-5";
+    if (code == V3Race._20933)
+      return "2093-3";
+    if (code == V3Race._20941)
+      return "2094-1";
+    if (code == V3Race._20958)
+      return "2095-8";
+    if (code == V3Race._20966)
+      return "2096-6";
+    if (code == V3Race._20974)
+      return "2097-4";
+    if (code == V3Race._20982)
+      return "2098-2";
+    if (code == V3Race._21006)
+      return "2100-6";
+    if (code == V3Race._21014)
+      return "2101-4";
+    if (code == V3Race._21022)
+      return "2102-2";
+    if (code == V3Race._21030)
+      return "2103-0";
+    if (code == V3Race._21048)
+      return "2104-8";
+    if (code == V3Race._25007)
+      return "2500-7";
+    if (code == V3Race._21063)
+      return "2106-3";
+    if (code == V3Race._21089)
+      return "2108-9";
+    if (code == V3Race._21097)
+      return "2109-7";
+    if (code == V3Race._21105)
+      return "2110-5";
+    if (code == V3Race._21113)
+      return "2111-3";
+    if (code == V3Race._21121)
+      return "2112-1";
+    if (code == V3Race._21139)
+      return "2113-9";
+    if (code == V3Race._21147)
+      return "2114-7";
+    if (code == V3Race._21154)
+      return "2115-4";
+    if (code == V3Race._21162)
+      return "2116-2";
+    if (code == V3Race._21188)
+      return "2118-8";
+    if (code == V3Race._21196)
+      return "2119-6";
+    if (code == V3Race._21204)
+      return "2120-4";
+    if (code == V3Race._21212)
+      return "2121-2";
+    if (code == V3Race._21220)
+      return "2122-0";
+    if (code == V3Race._21238)
+      return "2123-8";
+    if (code == V3Race._21246)
+      return "2124-6";
+    if (code == V3Race._21253)
+      return "2125-3";
+    if (code == V3Race._21261)
+      return "2126-1";
+    if (code == V3Race._21279)
+      return "2127-9";
+    if (code == V3Race._21295)
+      return "2129-5";
+    if (code == V3Race._21311)
+      return "2131-1";
+    return "?";
+  }
+
+    public String toSystem(V3Race code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationalOperator.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationalOperator.java
new file mode 100644
index 00000000000..7359cd0f3e7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationalOperator.java
@@ -0,0 +1,141 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3RelationalOperator {
+
+        /**
+         * Specified set of things includes value being evaluated.
+         */
+        CT, 
+        /**
+         * Equal condition applied to comparisons.
+         */
+        EQ, 
+        /**
+         * Greater than or equal condition applied to comparisons.
+         */
+        GE, 
+        /**
+         * A generic comparison selects a record for inclusion in the response if the beginning of the designated element value matches the select string.
+         */
+        GN, 
+        /**
+         * Greater than condition applied to comparisons.
+         */
+        GT, 
+        /**
+         * Less than or equal condition applied to comparisons.
+         */
+        LE, 
+        /**
+         * Less than condition applied to comparisons.
+         */
+        LT, 
+        /**
+         * Not equal condition applied to comparisons.
+         */
+        NE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3RelationalOperator fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("CT".equals(codeString))
+          return CT;
+        if ("EQ".equals(codeString))
+          return EQ;
+        if ("GE".equals(codeString))
+          return GE;
+        if ("GN".equals(codeString))
+          return GN;
+        if ("GT".equals(codeString))
+          return GT;
+        if ("LE".equals(codeString))
+          return LE;
+        if ("LT".equals(codeString))
+          return LT;
+        if ("NE".equals(codeString))
+          return NE;
+        throw new FHIRException("Unknown V3RelationalOperator code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CT: return "CT";
+            case EQ: return "EQ";
+            case GE: return "GE";
+            case GN: return "GN";
+            case GT: return "GT";
+            case LE: return "LE";
+            case LT: return "LT";
+            case NE: return "NE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/RelationalOperator";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CT: return "Specified set of things includes value being evaluated.";
+            case EQ: return "Equal condition applied to comparisons.";
+            case GE: return "Greater than or equal condition applied to comparisons.";
+            case GN: return "A generic comparison selects a record for inclusion in the response if the beginning of the designated element value matches the select string.";
+            case GT: return "Greater than condition applied to comparisons.";
+            case LE: return "Less than or equal condition applied to comparisons.";
+            case LT: return "Less than condition applied to comparisons.";
+            case NE: return "Not equal condition applied to comparisons.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CT: return "Contains";
+            case EQ: return "Equal";
+            case GE: return "Greater than or equal";
+            case GN: return "Generic";
+            case GT: return "Greater than";
+            case LE: return "Less than or equal";
+            case LT: return "Less than";
+            case NE: return "Not Equal";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationalOperatorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationalOperatorEnumFactory.java
new file mode 100644
index 00000000000..8a3916d688e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationalOperatorEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3RelationalOperatorEnumFactory implements EnumFactory {
+
+  public V3RelationalOperator fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("CT".equals(codeString))
+      return V3RelationalOperator.CT;
+    if ("EQ".equals(codeString))
+      return V3RelationalOperator.EQ;
+    if ("GE".equals(codeString))
+      return V3RelationalOperator.GE;
+    if ("GN".equals(codeString))
+      return V3RelationalOperator.GN;
+    if ("GT".equals(codeString))
+      return V3RelationalOperator.GT;
+    if ("LE".equals(codeString))
+      return V3RelationalOperator.LE;
+    if ("LT".equals(codeString))
+      return V3RelationalOperator.LT;
+    if ("NE".equals(codeString))
+      return V3RelationalOperator.NE;
+    throw new IllegalArgumentException("Unknown V3RelationalOperator code '"+codeString+"'");
+  }
+
+  public String toCode(V3RelationalOperator code) {
+    if (code == V3RelationalOperator.CT)
+      return "CT";
+    if (code == V3RelationalOperator.EQ)
+      return "EQ";
+    if (code == V3RelationalOperator.GE)
+      return "GE";
+    if (code == V3RelationalOperator.GN)
+      return "GN";
+    if (code == V3RelationalOperator.GT)
+      return "GT";
+    if (code == V3RelationalOperator.LE)
+      return "LE";
+    if (code == V3RelationalOperator.LT)
+      return "LT";
+    if (code == V3RelationalOperator.NE)
+      return "NE";
+    return "?";
+  }
+
+    public String toSystem(V3RelationalOperator code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationshipConjunction.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationshipConjunction.java
new file mode 100644
index 00000000000..c1e164de3f3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationshipConjunction.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3RelationshipConjunction {
+
+        /**
+         * This condition must be true.
+         */
+        AND, 
+        /**
+         * At least one of the condition among all OR conditions must be true.
+         */
+        OR, 
+        /**
+         * One and only one of the XOR conditions must be true.
+         */
+        XOR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3RelationshipConjunction fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AND".equals(codeString))
+          return AND;
+        if ("OR".equals(codeString))
+          return OR;
+        if ("XOR".equals(codeString))
+          return XOR;
+        throw new FHIRException("Unknown V3RelationshipConjunction code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AND: return "AND";
+            case OR: return "OR";
+            case XOR: return "XOR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/RelationshipConjunction";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AND: return "This condition must be true.";
+            case OR: return "At least one of the condition among all OR conditions must be true.";
+            case XOR: return "One and only one of the XOR conditions must be true.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AND: return "and";
+            case OR: return "or";
+            case XOR: return "exclusive or";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationshipConjunctionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationshipConjunctionEnumFactory.java
new file mode 100644
index 00000000000..f61b6714105
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RelationshipConjunctionEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3RelationshipConjunctionEnumFactory implements EnumFactory {
+
+  public V3RelationshipConjunction fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AND".equals(codeString))
+      return V3RelationshipConjunction.AND;
+    if ("OR".equals(codeString))
+      return V3RelationshipConjunction.OR;
+    if ("XOR".equals(codeString))
+      return V3RelationshipConjunction.XOR;
+    throw new IllegalArgumentException("Unknown V3RelationshipConjunction code '"+codeString+"'");
+  }
+
+  public String toCode(V3RelationshipConjunction code) {
+    if (code == V3RelationshipConjunction.AND)
+      return "AND";
+    if (code == V3RelationshipConjunction.OR)
+      return "OR";
+    if (code == V3RelationshipConjunction.XOR)
+      return "XOR";
+    return "?";
+  }
+
+    public String toSystem(V3RelationshipConjunction code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ReligiousAffiliation.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ReligiousAffiliation.java
new file mode 100644
index 00000000000..96763196812
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ReligiousAffiliation.java
@@ -0,0 +1,807 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ReligiousAffiliation {
+
+        /**
+         * Adventist
+         */
+        _1001, 
+        /**
+         * African Religions
+         */
+        _1002, 
+        /**
+         * Afro-Caribbean Religions
+         */
+        _1003, 
+        /**
+         * Agnosticism
+         */
+        _1004, 
+        /**
+         * Anglican
+         */
+        _1005, 
+        /**
+         * Animism
+         */
+        _1006, 
+        /**
+         * Atheism
+         */
+        _1007, 
+        /**
+         * Babi & Baha'I faiths
+         */
+        _1008, 
+        /**
+         * Baptist
+         */
+        _1009, 
+        /**
+         * Bon
+         */
+        _1010, 
+        /**
+         * Cao Dai
+         */
+        _1011, 
+        /**
+         * Celticism
+         */
+        _1012, 
+        /**
+         * Christian (non-Catholic, non-specific)
+         */
+        _1013, 
+        /**
+         * Confucianism
+         */
+        _1014, 
+        /**
+         * Cyberculture Religions
+         */
+        _1015, 
+        /**
+         * Divination
+         */
+        _1016, 
+        /**
+         * Fourth Way
+         */
+        _1017, 
+        /**
+         * Free Daism
+         */
+        _1018, 
+        /**
+         * Gnosis
+         */
+        _1019, 
+        /**
+         * Hinduism
+         */
+        _1020, 
+        /**
+         * Humanism
+         */
+        _1021, 
+        /**
+         * Independent
+         */
+        _1022, 
+        /**
+         * Islam
+         */
+        _1023, 
+        /**
+         * Jainism
+         */
+        _1024, 
+        /**
+         * Jehovah's Witnesses
+         */
+        _1025, 
+        /**
+         * Judaism
+         */
+        _1026, 
+        /**
+         * Latter Day Saints
+         */
+        _1027, 
+        /**
+         * Lutheran
+         */
+        _1028, 
+        /**
+         * Mahayana
+         */
+        _1029, 
+        /**
+         * Meditation
+         */
+        _1030, 
+        /**
+         * Messianic Judaism
+         */
+        _1031, 
+        /**
+         * Mitraism
+         */
+        _1032, 
+        /**
+         * New Age
+         */
+        _1033, 
+        /**
+         * non-Roman Catholic
+         */
+        _1034, 
+        /**
+         * Occult
+         */
+        _1035, 
+        /**
+         * Orthodox
+         */
+        _1036, 
+        /**
+         * Paganism
+         */
+        _1037, 
+        /**
+         * Pentecostal
+         */
+        _1038, 
+        /**
+         * Process, The
+         */
+        _1039, 
+        /**
+         * Reformed/Presbyterian
+         */
+        _1040, 
+        /**
+         * Roman Catholic Church
+         */
+        _1041, 
+        /**
+         * Satanism
+         */
+        _1042, 
+        /**
+         * Scientology
+         */
+        _1043, 
+        /**
+         * Shamanism
+         */
+        _1044, 
+        /**
+         * Shiite (Islam)
+         */
+        _1045, 
+        /**
+         * Shinto
+         */
+        _1046, 
+        /**
+         * Sikism
+         */
+        _1047, 
+        /**
+         * Spiritualism
+         */
+        _1048, 
+        /**
+         * Sunni (Islam)
+         */
+        _1049, 
+        /**
+         * Taoism
+         */
+        _1050, 
+        /**
+         * Theravada
+         */
+        _1051, 
+        /**
+         * Unitarian-Universalism
+         */
+        _1052, 
+        /**
+         * Universal Life Church
+         */
+        _1053, 
+        /**
+         * Vajrayana (Tibetan)
+         */
+        _1054, 
+        /**
+         * Veda
+         */
+        _1055, 
+        /**
+         * Voodoo
+         */
+        _1056, 
+        /**
+         * Wicca
+         */
+        _1057, 
+        /**
+         * Yaohushua
+         */
+        _1058, 
+        /**
+         * Zen Buddhism
+         */
+        _1059, 
+        /**
+         * Zoroastrianism
+         */
+        _1060, 
+        /**
+         * Assembly of God
+         */
+        _1061, 
+        /**
+         * Brethren
+         */
+        _1062, 
+        /**
+         * Christian Scientist
+         */
+        _1063, 
+        /**
+         * Church of Christ
+         */
+        _1064, 
+        /**
+         * Church of God
+         */
+        _1065, 
+        /**
+         * Congregational
+         */
+        _1066, 
+        /**
+         * Disciples of Christ
+         */
+        _1067, 
+        /**
+         * Eastern Orthodox
+         */
+        _1068, 
+        /**
+         * Episcopalian
+         */
+        _1069, 
+        /**
+         * Evangelical Covenant
+         */
+        _1070, 
+        /**
+         * Friends
+         */
+        _1071, 
+        /**
+         * Full Gospel
+         */
+        _1072, 
+        /**
+         * Methodist
+         */
+        _1073, 
+        /**
+         * Native American
+         */
+        _1074, 
+        /**
+         * Nazarene
+         */
+        _1075, 
+        /**
+         * Presbyterian
+         */
+        _1076, 
+        /**
+         * Protestant
+         */
+        _1077, 
+        /**
+         * Protestant, No Denomination
+         */
+        _1078, 
+        /**
+         * Reformed
+         */
+        _1079, 
+        /**
+         * Salvation Army
+         */
+        _1080, 
+        /**
+         * Unitarian Universalist
+         */
+        _1081, 
+        /**
+         * United Church of Christ
+         */
+        _1082, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ReligiousAffiliation fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1001".equals(codeString))
+          return _1001;
+        if ("1002".equals(codeString))
+          return _1002;
+        if ("1003".equals(codeString))
+          return _1003;
+        if ("1004".equals(codeString))
+          return _1004;
+        if ("1005".equals(codeString))
+          return _1005;
+        if ("1006".equals(codeString))
+          return _1006;
+        if ("1007".equals(codeString))
+          return _1007;
+        if ("1008".equals(codeString))
+          return _1008;
+        if ("1009".equals(codeString))
+          return _1009;
+        if ("1010".equals(codeString))
+          return _1010;
+        if ("1011".equals(codeString))
+          return _1011;
+        if ("1012".equals(codeString))
+          return _1012;
+        if ("1013".equals(codeString))
+          return _1013;
+        if ("1014".equals(codeString))
+          return _1014;
+        if ("1015".equals(codeString))
+          return _1015;
+        if ("1016".equals(codeString))
+          return _1016;
+        if ("1017".equals(codeString))
+          return _1017;
+        if ("1018".equals(codeString))
+          return _1018;
+        if ("1019".equals(codeString))
+          return _1019;
+        if ("1020".equals(codeString))
+          return _1020;
+        if ("1021".equals(codeString))
+          return _1021;
+        if ("1022".equals(codeString))
+          return _1022;
+        if ("1023".equals(codeString))
+          return _1023;
+        if ("1024".equals(codeString))
+          return _1024;
+        if ("1025".equals(codeString))
+          return _1025;
+        if ("1026".equals(codeString))
+          return _1026;
+        if ("1027".equals(codeString))
+          return _1027;
+        if ("1028".equals(codeString))
+          return _1028;
+        if ("1029".equals(codeString))
+          return _1029;
+        if ("1030".equals(codeString))
+          return _1030;
+        if ("1031".equals(codeString))
+          return _1031;
+        if ("1032".equals(codeString))
+          return _1032;
+        if ("1033".equals(codeString))
+          return _1033;
+        if ("1034".equals(codeString))
+          return _1034;
+        if ("1035".equals(codeString))
+          return _1035;
+        if ("1036".equals(codeString))
+          return _1036;
+        if ("1037".equals(codeString))
+          return _1037;
+        if ("1038".equals(codeString))
+          return _1038;
+        if ("1039".equals(codeString))
+          return _1039;
+        if ("1040".equals(codeString))
+          return _1040;
+        if ("1041".equals(codeString))
+          return _1041;
+        if ("1042".equals(codeString))
+          return _1042;
+        if ("1043".equals(codeString))
+          return _1043;
+        if ("1044".equals(codeString))
+          return _1044;
+        if ("1045".equals(codeString))
+          return _1045;
+        if ("1046".equals(codeString))
+          return _1046;
+        if ("1047".equals(codeString))
+          return _1047;
+        if ("1048".equals(codeString))
+          return _1048;
+        if ("1049".equals(codeString))
+          return _1049;
+        if ("1050".equals(codeString))
+          return _1050;
+        if ("1051".equals(codeString))
+          return _1051;
+        if ("1052".equals(codeString))
+          return _1052;
+        if ("1053".equals(codeString))
+          return _1053;
+        if ("1054".equals(codeString))
+          return _1054;
+        if ("1055".equals(codeString))
+          return _1055;
+        if ("1056".equals(codeString))
+          return _1056;
+        if ("1057".equals(codeString))
+          return _1057;
+        if ("1058".equals(codeString))
+          return _1058;
+        if ("1059".equals(codeString))
+          return _1059;
+        if ("1060".equals(codeString))
+          return _1060;
+        if ("1061".equals(codeString))
+          return _1061;
+        if ("1062".equals(codeString))
+          return _1062;
+        if ("1063".equals(codeString))
+          return _1063;
+        if ("1064".equals(codeString))
+          return _1064;
+        if ("1065".equals(codeString))
+          return _1065;
+        if ("1066".equals(codeString))
+          return _1066;
+        if ("1067".equals(codeString))
+          return _1067;
+        if ("1068".equals(codeString))
+          return _1068;
+        if ("1069".equals(codeString))
+          return _1069;
+        if ("1070".equals(codeString))
+          return _1070;
+        if ("1071".equals(codeString))
+          return _1071;
+        if ("1072".equals(codeString))
+          return _1072;
+        if ("1073".equals(codeString))
+          return _1073;
+        if ("1074".equals(codeString))
+          return _1074;
+        if ("1075".equals(codeString))
+          return _1075;
+        if ("1076".equals(codeString))
+          return _1076;
+        if ("1077".equals(codeString))
+          return _1077;
+        if ("1078".equals(codeString))
+          return _1078;
+        if ("1079".equals(codeString))
+          return _1079;
+        if ("1080".equals(codeString))
+          return _1080;
+        if ("1081".equals(codeString))
+          return _1081;
+        if ("1082".equals(codeString))
+          return _1082;
+        throw new FHIRException("Unknown V3ReligiousAffiliation code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1001: return "1001";
+            case _1002: return "1002";
+            case _1003: return "1003";
+            case _1004: return "1004";
+            case _1005: return "1005";
+            case _1006: return "1006";
+            case _1007: return "1007";
+            case _1008: return "1008";
+            case _1009: return "1009";
+            case _1010: return "1010";
+            case _1011: return "1011";
+            case _1012: return "1012";
+            case _1013: return "1013";
+            case _1014: return "1014";
+            case _1015: return "1015";
+            case _1016: return "1016";
+            case _1017: return "1017";
+            case _1018: return "1018";
+            case _1019: return "1019";
+            case _1020: return "1020";
+            case _1021: return "1021";
+            case _1022: return "1022";
+            case _1023: return "1023";
+            case _1024: return "1024";
+            case _1025: return "1025";
+            case _1026: return "1026";
+            case _1027: return "1027";
+            case _1028: return "1028";
+            case _1029: return "1029";
+            case _1030: return "1030";
+            case _1031: return "1031";
+            case _1032: return "1032";
+            case _1033: return "1033";
+            case _1034: return "1034";
+            case _1035: return "1035";
+            case _1036: return "1036";
+            case _1037: return "1037";
+            case _1038: return "1038";
+            case _1039: return "1039";
+            case _1040: return "1040";
+            case _1041: return "1041";
+            case _1042: return "1042";
+            case _1043: return "1043";
+            case _1044: return "1044";
+            case _1045: return "1045";
+            case _1046: return "1046";
+            case _1047: return "1047";
+            case _1048: return "1048";
+            case _1049: return "1049";
+            case _1050: return "1050";
+            case _1051: return "1051";
+            case _1052: return "1052";
+            case _1053: return "1053";
+            case _1054: return "1054";
+            case _1055: return "1055";
+            case _1056: return "1056";
+            case _1057: return "1057";
+            case _1058: return "1058";
+            case _1059: return "1059";
+            case _1060: return "1060";
+            case _1061: return "1061";
+            case _1062: return "1062";
+            case _1063: return "1063";
+            case _1064: return "1064";
+            case _1065: return "1065";
+            case _1066: return "1066";
+            case _1067: return "1067";
+            case _1068: return "1068";
+            case _1069: return "1069";
+            case _1070: return "1070";
+            case _1071: return "1071";
+            case _1072: return "1072";
+            case _1073: return "1073";
+            case _1074: return "1074";
+            case _1075: return "1075";
+            case _1076: return "1076";
+            case _1077: return "1077";
+            case _1078: return "1078";
+            case _1079: return "1079";
+            case _1080: return "1080";
+            case _1081: return "1081";
+            case _1082: return "1082";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ReligiousAffiliation";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1001: return "Adventist";
+            case _1002: return "African Religions";
+            case _1003: return "Afro-Caribbean Religions";
+            case _1004: return "Agnosticism";
+            case _1005: return "Anglican";
+            case _1006: return "Animism";
+            case _1007: return "Atheism";
+            case _1008: return "Babi & Baha'I faiths";
+            case _1009: return "Baptist";
+            case _1010: return "Bon";
+            case _1011: return "Cao Dai";
+            case _1012: return "Celticism";
+            case _1013: return "Christian (non-Catholic, non-specific)";
+            case _1014: return "Confucianism";
+            case _1015: return "Cyberculture Religions";
+            case _1016: return "Divination";
+            case _1017: return "Fourth Way";
+            case _1018: return "Free Daism";
+            case _1019: return "Gnosis";
+            case _1020: return "Hinduism";
+            case _1021: return "Humanism";
+            case _1022: return "Independent";
+            case _1023: return "Islam";
+            case _1024: return "Jainism";
+            case _1025: return "Jehovah's Witnesses";
+            case _1026: return "Judaism";
+            case _1027: return "Latter Day Saints";
+            case _1028: return "Lutheran";
+            case _1029: return "Mahayana";
+            case _1030: return "Meditation";
+            case _1031: return "Messianic Judaism";
+            case _1032: return "Mitraism";
+            case _1033: return "New Age";
+            case _1034: return "non-Roman Catholic";
+            case _1035: return "Occult";
+            case _1036: return "Orthodox";
+            case _1037: return "Paganism";
+            case _1038: return "Pentecostal";
+            case _1039: return "Process, The";
+            case _1040: return "Reformed/Presbyterian";
+            case _1041: return "Roman Catholic Church";
+            case _1042: return "Satanism";
+            case _1043: return "Scientology";
+            case _1044: return "Shamanism";
+            case _1045: return "Shiite (Islam)";
+            case _1046: return "Shinto";
+            case _1047: return "Sikism";
+            case _1048: return "Spiritualism";
+            case _1049: return "Sunni (Islam)";
+            case _1050: return "Taoism";
+            case _1051: return "Theravada";
+            case _1052: return "Unitarian-Universalism";
+            case _1053: return "Universal Life Church";
+            case _1054: return "Vajrayana (Tibetan)";
+            case _1055: return "Veda";
+            case _1056: return "Voodoo";
+            case _1057: return "Wicca";
+            case _1058: return "Yaohushua";
+            case _1059: return "Zen Buddhism";
+            case _1060: return "Zoroastrianism";
+            case _1061: return "Assembly of God";
+            case _1062: return "Brethren";
+            case _1063: return "Christian Scientist";
+            case _1064: return "Church of Christ";
+            case _1065: return "Church of God";
+            case _1066: return "Congregational";
+            case _1067: return "Disciples of Christ";
+            case _1068: return "Eastern Orthodox";
+            case _1069: return "Episcopalian";
+            case _1070: return "Evangelical Covenant";
+            case _1071: return "Friends";
+            case _1072: return "Full Gospel";
+            case _1073: return "Methodist";
+            case _1074: return "Native American";
+            case _1075: return "Nazarene";
+            case _1076: return "Presbyterian";
+            case _1077: return "Protestant";
+            case _1078: return "Protestant, No Denomination";
+            case _1079: return "Reformed";
+            case _1080: return "Salvation Army";
+            case _1081: return "Unitarian Universalist";
+            case _1082: return "United Church of Christ";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1001: return "Adventist";
+            case _1002: return "African Religions";
+            case _1003: return "Afro-Caribbean Religions";
+            case _1004: return "Agnosticism";
+            case _1005: return "Anglican";
+            case _1006: return "Animism";
+            case _1007: return "Atheism";
+            case _1008: return "Babi & Baha'I faiths";
+            case _1009: return "Baptist";
+            case _1010: return "Bon";
+            case _1011: return "Cao Dai";
+            case _1012: return "Celticism";
+            case _1013: return "Christian (non-Catholic, non-specific)";
+            case _1014: return "Confucianism";
+            case _1015: return "Cyberculture Religions";
+            case _1016: return "Divination";
+            case _1017: return "Fourth Way";
+            case _1018: return "Free Daism";
+            case _1019: return "Gnosis";
+            case _1020: return "Hinduism";
+            case _1021: return "Humanism";
+            case _1022: return "Independent";
+            case _1023: return "Islam";
+            case _1024: return "Jainism";
+            case _1025: return "Jehovah's Witnesses";
+            case _1026: return "Judaism";
+            case _1027: return "Latter Day Saints";
+            case _1028: return "Lutheran";
+            case _1029: return "Mahayana";
+            case _1030: return "Meditation";
+            case _1031: return "Messianic Judaism";
+            case _1032: return "Mitraism";
+            case _1033: return "New Age";
+            case _1034: return "non-Roman Catholic";
+            case _1035: return "Occult";
+            case _1036: return "Orthodox";
+            case _1037: return "Paganism";
+            case _1038: return "Pentecostal";
+            case _1039: return "Process, The";
+            case _1040: return "Reformed/Presbyterian";
+            case _1041: return "Roman Catholic Church";
+            case _1042: return "Satanism";
+            case _1043: return "Scientology";
+            case _1044: return "Shamanism";
+            case _1045: return "Shiite (Islam)";
+            case _1046: return "Shinto";
+            case _1047: return "Sikism";
+            case _1048: return "Spiritualism";
+            case _1049: return "Sunni (Islam)";
+            case _1050: return "Taoism";
+            case _1051: return "Theravada";
+            case _1052: return "Unitarian-Universalism";
+            case _1053: return "Universal Life Church";
+            case _1054: return "Vajrayana (Tibetan)";
+            case _1055: return "Veda";
+            case _1056: return "Voodoo";
+            case _1057: return "Wicca";
+            case _1058: return "Yaohushua";
+            case _1059: return "Zen Buddhism";
+            case _1060: return "Zoroastrianism";
+            case _1061: return "Assembly of God";
+            case _1062: return "Brethren";
+            case _1063: return "Christian Scientist";
+            case _1064: return "Church of Christ";
+            case _1065: return "Church of God";
+            case _1066: return "Congregational";
+            case _1067: return "Disciples of Christ";
+            case _1068: return "Eastern Orthodox";
+            case _1069: return "Episcopalian";
+            case _1070: return "Evangelical Covenant";
+            case _1071: return "Friends";
+            case _1072: return "Full Gospel";
+            case _1073: return "Methodist";
+            case _1074: return "Native American";
+            case _1075: return "Nazarene";
+            case _1076: return "Presbyterian";
+            case _1077: return "Protestant";
+            case _1078: return "Protestant, No Denomination";
+            case _1079: return "Reformed";
+            case _1080: return "Salvation Army";
+            case _1081: return "Unitarian Universalist";
+            case _1082: return "United Church of Christ";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ReligiousAffiliationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ReligiousAffiliationEnumFactory.java
new file mode 100644
index 00000000000..ff1d9bc8ae0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ReligiousAffiliationEnumFactory.java
@@ -0,0 +1,382 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ReligiousAffiliationEnumFactory implements EnumFactory {
+
+  public V3ReligiousAffiliation fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1001".equals(codeString))
+      return V3ReligiousAffiliation._1001;
+    if ("1002".equals(codeString))
+      return V3ReligiousAffiliation._1002;
+    if ("1003".equals(codeString))
+      return V3ReligiousAffiliation._1003;
+    if ("1004".equals(codeString))
+      return V3ReligiousAffiliation._1004;
+    if ("1005".equals(codeString))
+      return V3ReligiousAffiliation._1005;
+    if ("1006".equals(codeString))
+      return V3ReligiousAffiliation._1006;
+    if ("1007".equals(codeString))
+      return V3ReligiousAffiliation._1007;
+    if ("1008".equals(codeString))
+      return V3ReligiousAffiliation._1008;
+    if ("1009".equals(codeString))
+      return V3ReligiousAffiliation._1009;
+    if ("1010".equals(codeString))
+      return V3ReligiousAffiliation._1010;
+    if ("1011".equals(codeString))
+      return V3ReligiousAffiliation._1011;
+    if ("1012".equals(codeString))
+      return V3ReligiousAffiliation._1012;
+    if ("1013".equals(codeString))
+      return V3ReligiousAffiliation._1013;
+    if ("1014".equals(codeString))
+      return V3ReligiousAffiliation._1014;
+    if ("1015".equals(codeString))
+      return V3ReligiousAffiliation._1015;
+    if ("1016".equals(codeString))
+      return V3ReligiousAffiliation._1016;
+    if ("1017".equals(codeString))
+      return V3ReligiousAffiliation._1017;
+    if ("1018".equals(codeString))
+      return V3ReligiousAffiliation._1018;
+    if ("1019".equals(codeString))
+      return V3ReligiousAffiliation._1019;
+    if ("1020".equals(codeString))
+      return V3ReligiousAffiliation._1020;
+    if ("1021".equals(codeString))
+      return V3ReligiousAffiliation._1021;
+    if ("1022".equals(codeString))
+      return V3ReligiousAffiliation._1022;
+    if ("1023".equals(codeString))
+      return V3ReligiousAffiliation._1023;
+    if ("1024".equals(codeString))
+      return V3ReligiousAffiliation._1024;
+    if ("1025".equals(codeString))
+      return V3ReligiousAffiliation._1025;
+    if ("1026".equals(codeString))
+      return V3ReligiousAffiliation._1026;
+    if ("1027".equals(codeString))
+      return V3ReligiousAffiliation._1027;
+    if ("1028".equals(codeString))
+      return V3ReligiousAffiliation._1028;
+    if ("1029".equals(codeString))
+      return V3ReligiousAffiliation._1029;
+    if ("1030".equals(codeString))
+      return V3ReligiousAffiliation._1030;
+    if ("1031".equals(codeString))
+      return V3ReligiousAffiliation._1031;
+    if ("1032".equals(codeString))
+      return V3ReligiousAffiliation._1032;
+    if ("1033".equals(codeString))
+      return V3ReligiousAffiliation._1033;
+    if ("1034".equals(codeString))
+      return V3ReligiousAffiliation._1034;
+    if ("1035".equals(codeString))
+      return V3ReligiousAffiliation._1035;
+    if ("1036".equals(codeString))
+      return V3ReligiousAffiliation._1036;
+    if ("1037".equals(codeString))
+      return V3ReligiousAffiliation._1037;
+    if ("1038".equals(codeString))
+      return V3ReligiousAffiliation._1038;
+    if ("1039".equals(codeString))
+      return V3ReligiousAffiliation._1039;
+    if ("1040".equals(codeString))
+      return V3ReligiousAffiliation._1040;
+    if ("1041".equals(codeString))
+      return V3ReligiousAffiliation._1041;
+    if ("1042".equals(codeString))
+      return V3ReligiousAffiliation._1042;
+    if ("1043".equals(codeString))
+      return V3ReligiousAffiliation._1043;
+    if ("1044".equals(codeString))
+      return V3ReligiousAffiliation._1044;
+    if ("1045".equals(codeString))
+      return V3ReligiousAffiliation._1045;
+    if ("1046".equals(codeString))
+      return V3ReligiousAffiliation._1046;
+    if ("1047".equals(codeString))
+      return V3ReligiousAffiliation._1047;
+    if ("1048".equals(codeString))
+      return V3ReligiousAffiliation._1048;
+    if ("1049".equals(codeString))
+      return V3ReligiousAffiliation._1049;
+    if ("1050".equals(codeString))
+      return V3ReligiousAffiliation._1050;
+    if ("1051".equals(codeString))
+      return V3ReligiousAffiliation._1051;
+    if ("1052".equals(codeString))
+      return V3ReligiousAffiliation._1052;
+    if ("1053".equals(codeString))
+      return V3ReligiousAffiliation._1053;
+    if ("1054".equals(codeString))
+      return V3ReligiousAffiliation._1054;
+    if ("1055".equals(codeString))
+      return V3ReligiousAffiliation._1055;
+    if ("1056".equals(codeString))
+      return V3ReligiousAffiliation._1056;
+    if ("1057".equals(codeString))
+      return V3ReligiousAffiliation._1057;
+    if ("1058".equals(codeString))
+      return V3ReligiousAffiliation._1058;
+    if ("1059".equals(codeString))
+      return V3ReligiousAffiliation._1059;
+    if ("1060".equals(codeString))
+      return V3ReligiousAffiliation._1060;
+    if ("1061".equals(codeString))
+      return V3ReligiousAffiliation._1061;
+    if ("1062".equals(codeString))
+      return V3ReligiousAffiliation._1062;
+    if ("1063".equals(codeString))
+      return V3ReligiousAffiliation._1063;
+    if ("1064".equals(codeString))
+      return V3ReligiousAffiliation._1064;
+    if ("1065".equals(codeString))
+      return V3ReligiousAffiliation._1065;
+    if ("1066".equals(codeString))
+      return V3ReligiousAffiliation._1066;
+    if ("1067".equals(codeString))
+      return V3ReligiousAffiliation._1067;
+    if ("1068".equals(codeString))
+      return V3ReligiousAffiliation._1068;
+    if ("1069".equals(codeString))
+      return V3ReligiousAffiliation._1069;
+    if ("1070".equals(codeString))
+      return V3ReligiousAffiliation._1070;
+    if ("1071".equals(codeString))
+      return V3ReligiousAffiliation._1071;
+    if ("1072".equals(codeString))
+      return V3ReligiousAffiliation._1072;
+    if ("1073".equals(codeString))
+      return V3ReligiousAffiliation._1073;
+    if ("1074".equals(codeString))
+      return V3ReligiousAffiliation._1074;
+    if ("1075".equals(codeString))
+      return V3ReligiousAffiliation._1075;
+    if ("1076".equals(codeString))
+      return V3ReligiousAffiliation._1076;
+    if ("1077".equals(codeString))
+      return V3ReligiousAffiliation._1077;
+    if ("1078".equals(codeString))
+      return V3ReligiousAffiliation._1078;
+    if ("1079".equals(codeString))
+      return V3ReligiousAffiliation._1079;
+    if ("1080".equals(codeString))
+      return V3ReligiousAffiliation._1080;
+    if ("1081".equals(codeString))
+      return V3ReligiousAffiliation._1081;
+    if ("1082".equals(codeString))
+      return V3ReligiousAffiliation._1082;
+    throw new IllegalArgumentException("Unknown V3ReligiousAffiliation code '"+codeString+"'");
+  }
+
+  public String toCode(V3ReligiousAffiliation code) {
+    if (code == V3ReligiousAffiliation._1001)
+      return "1001";
+    if (code == V3ReligiousAffiliation._1002)
+      return "1002";
+    if (code == V3ReligiousAffiliation._1003)
+      return "1003";
+    if (code == V3ReligiousAffiliation._1004)
+      return "1004";
+    if (code == V3ReligiousAffiliation._1005)
+      return "1005";
+    if (code == V3ReligiousAffiliation._1006)
+      return "1006";
+    if (code == V3ReligiousAffiliation._1007)
+      return "1007";
+    if (code == V3ReligiousAffiliation._1008)
+      return "1008";
+    if (code == V3ReligiousAffiliation._1009)
+      return "1009";
+    if (code == V3ReligiousAffiliation._1010)
+      return "1010";
+    if (code == V3ReligiousAffiliation._1011)
+      return "1011";
+    if (code == V3ReligiousAffiliation._1012)
+      return "1012";
+    if (code == V3ReligiousAffiliation._1013)
+      return "1013";
+    if (code == V3ReligiousAffiliation._1014)
+      return "1014";
+    if (code == V3ReligiousAffiliation._1015)
+      return "1015";
+    if (code == V3ReligiousAffiliation._1016)
+      return "1016";
+    if (code == V3ReligiousAffiliation._1017)
+      return "1017";
+    if (code == V3ReligiousAffiliation._1018)
+      return "1018";
+    if (code == V3ReligiousAffiliation._1019)
+      return "1019";
+    if (code == V3ReligiousAffiliation._1020)
+      return "1020";
+    if (code == V3ReligiousAffiliation._1021)
+      return "1021";
+    if (code == V3ReligiousAffiliation._1022)
+      return "1022";
+    if (code == V3ReligiousAffiliation._1023)
+      return "1023";
+    if (code == V3ReligiousAffiliation._1024)
+      return "1024";
+    if (code == V3ReligiousAffiliation._1025)
+      return "1025";
+    if (code == V3ReligiousAffiliation._1026)
+      return "1026";
+    if (code == V3ReligiousAffiliation._1027)
+      return "1027";
+    if (code == V3ReligiousAffiliation._1028)
+      return "1028";
+    if (code == V3ReligiousAffiliation._1029)
+      return "1029";
+    if (code == V3ReligiousAffiliation._1030)
+      return "1030";
+    if (code == V3ReligiousAffiliation._1031)
+      return "1031";
+    if (code == V3ReligiousAffiliation._1032)
+      return "1032";
+    if (code == V3ReligiousAffiliation._1033)
+      return "1033";
+    if (code == V3ReligiousAffiliation._1034)
+      return "1034";
+    if (code == V3ReligiousAffiliation._1035)
+      return "1035";
+    if (code == V3ReligiousAffiliation._1036)
+      return "1036";
+    if (code == V3ReligiousAffiliation._1037)
+      return "1037";
+    if (code == V3ReligiousAffiliation._1038)
+      return "1038";
+    if (code == V3ReligiousAffiliation._1039)
+      return "1039";
+    if (code == V3ReligiousAffiliation._1040)
+      return "1040";
+    if (code == V3ReligiousAffiliation._1041)
+      return "1041";
+    if (code == V3ReligiousAffiliation._1042)
+      return "1042";
+    if (code == V3ReligiousAffiliation._1043)
+      return "1043";
+    if (code == V3ReligiousAffiliation._1044)
+      return "1044";
+    if (code == V3ReligiousAffiliation._1045)
+      return "1045";
+    if (code == V3ReligiousAffiliation._1046)
+      return "1046";
+    if (code == V3ReligiousAffiliation._1047)
+      return "1047";
+    if (code == V3ReligiousAffiliation._1048)
+      return "1048";
+    if (code == V3ReligiousAffiliation._1049)
+      return "1049";
+    if (code == V3ReligiousAffiliation._1050)
+      return "1050";
+    if (code == V3ReligiousAffiliation._1051)
+      return "1051";
+    if (code == V3ReligiousAffiliation._1052)
+      return "1052";
+    if (code == V3ReligiousAffiliation._1053)
+      return "1053";
+    if (code == V3ReligiousAffiliation._1054)
+      return "1054";
+    if (code == V3ReligiousAffiliation._1055)
+      return "1055";
+    if (code == V3ReligiousAffiliation._1056)
+      return "1056";
+    if (code == V3ReligiousAffiliation._1057)
+      return "1057";
+    if (code == V3ReligiousAffiliation._1058)
+      return "1058";
+    if (code == V3ReligiousAffiliation._1059)
+      return "1059";
+    if (code == V3ReligiousAffiliation._1060)
+      return "1060";
+    if (code == V3ReligiousAffiliation._1061)
+      return "1061";
+    if (code == V3ReligiousAffiliation._1062)
+      return "1062";
+    if (code == V3ReligiousAffiliation._1063)
+      return "1063";
+    if (code == V3ReligiousAffiliation._1064)
+      return "1064";
+    if (code == V3ReligiousAffiliation._1065)
+      return "1065";
+    if (code == V3ReligiousAffiliation._1066)
+      return "1066";
+    if (code == V3ReligiousAffiliation._1067)
+      return "1067";
+    if (code == V3ReligiousAffiliation._1068)
+      return "1068";
+    if (code == V3ReligiousAffiliation._1069)
+      return "1069";
+    if (code == V3ReligiousAffiliation._1070)
+      return "1070";
+    if (code == V3ReligiousAffiliation._1071)
+      return "1071";
+    if (code == V3ReligiousAffiliation._1072)
+      return "1072";
+    if (code == V3ReligiousAffiliation._1073)
+      return "1073";
+    if (code == V3ReligiousAffiliation._1074)
+      return "1074";
+    if (code == V3ReligiousAffiliation._1075)
+      return "1075";
+    if (code == V3ReligiousAffiliation._1076)
+      return "1076";
+    if (code == V3ReligiousAffiliation._1077)
+      return "1077";
+    if (code == V3ReligiousAffiliation._1078)
+      return "1078";
+    if (code == V3ReligiousAffiliation._1079)
+      return "1079";
+    if (code == V3ReligiousAffiliation._1080)
+      return "1080";
+    if (code == V3ReligiousAffiliation._1081)
+      return "1081";
+    if (code == V3ReligiousAffiliation._1082)
+      return "1082";
+    return "?";
+  }
+
+    public String toSystem(V3ReligiousAffiliation code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseLevel.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseLevel.java
new file mode 100644
index 00000000000..232979a5c33
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseLevel.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ResponseLevel {
+
+        /**
+         * Respond with exceptions and a notification of completion
+         */
+        C, 
+        /**
+         * Respond with exceptions, completion, modifications and include more detail information (if applicable)
+         */
+        D, 
+        /**
+         * Respond with exceptions only
+         */
+        E, 
+        /**
+         * Respond with exceptions, completion, and modification with detail (as above), and send positive confirmations even if no modifications are being made.
+         */
+        F, 
+        /**
+         * Respond only with message level acknowledgements, i.e., only notify acceptance or rejection of the message, do not include any application-level detail
+         */
+        N, 
+        /**
+         * Respond with exceptions, completions and modifications or revisions done before completion
+         */
+        R, 
+        /**
+         * Do not send any kind of response
+         */
+        X, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ResponseLevel fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("C".equals(codeString))
+          return C;
+        if ("D".equals(codeString))
+          return D;
+        if ("E".equals(codeString))
+          return E;
+        if ("F".equals(codeString))
+          return F;
+        if ("N".equals(codeString))
+          return N;
+        if ("R".equals(codeString))
+          return R;
+        if ("X".equals(codeString))
+          return X;
+        throw new FHIRException("Unknown V3ResponseLevel code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case C: return "C";
+            case D: return "D";
+            case E: return "E";
+            case F: return "F";
+            case N: return "N";
+            case R: return "R";
+            case X: return "X";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ResponseLevel";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case C: return "Respond with exceptions and a notification of completion";
+            case D: return "Respond with exceptions, completion, modifications and include more detail information (if applicable)";
+            case E: return "Respond with exceptions only";
+            case F: return "Respond with exceptions, completion, and modification with detail (as above), and send positive confirmations even if no modifications are being made.";
+            case N: return "Respond only with message level acknowledgements, i.e., only notify acceptance or rejection of the message, do not include any application-level detail";
+            case R: return "Respond with exceptions, completions and modifications or revisions done before completion";
+            case X: return "Do not send any kind of response";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case C: return "completion";
+            case D: return "detail";
+            case E: return "exception";
+            case F: return "confirmation";
+            case N: return "message-control";
+            case R: return "modification";
+            case X: return "none";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseLevelEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseLevelEnumFactory.java
new file mode 100644
index 00000000000..1ab3212a3c4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseLevelEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ResponseLevelEnumFactory implements EnumFactory {
+
+  public V3ResponseLevel fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("C".equals(codeString))
+      return V3ResponseLevel.C;
+    if ("D".equals(codeString))
+      return V3ResponseLevel.D;
+    if ("E".equals(codeString))
+      return V3ResponseLevel.E;
+    if ("F".equals(codeString))
+      return V3ResponseLevel.F;
+    if ("N".equals(codeString))
+      return V3ResponseLevel.N;
+    if ("R".equals(codeString))
+      return V3ResponseLevel.R;
+    if ("X".equals(codeString))
+      return V3ResponseLevel.X;
+    throw new IllegalArgumentException("Unknown V3ResponseLevel code '"+codeString+"'");
+  }
+
+  public String toCode(V3ResponseLevel code) {
+    if (code == V3ResponseLevel.C)
+      return "C";
+    if (code == V3ResponseLevel.D)
+      return "D";
+    if (code == V3ResponseLevel.E)
+      return "E";
+    if (code == V3ResponseLevel.F)
+      return "F";
+    if (code == V3ResponseLevel.N)
+      return "N";
+    if (code == V3ResponseLevel.R)
+      return "R";
+    if (code == V3ResponseLevel.X)
+      return "X";
+    return "?";
+  }
+
+    public String toSystem(V3ResponseLevel code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseModality.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseModality.java
new file mode 100644
index 00000000000..00cfa66819d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseModality.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ResponseModality {
+
+        /**
+         * Query response to be sent as an HL7 Batch.
+         */
+        B, 
+        /**
+         * Query response to occur in real time.
+         */
+        R, 
+        /**
+         * Query response to sent as a series of responses at the same time without the use of batch formatting.
+         */
+        T, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ResponseModality fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("B".equals(codeString))
+          return B;
+        if ("R".equals(codeString))
+          return R;
+        if ("T".equals(codeString))
+          return T;
+        throw new FHIRException("Unknown V3ResponseModality code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case B: return "B";
+            case R: return "R";
+            case T: return "T";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ResponseModality";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case B: return "Query response to be sent as an HL7 Batch.";
+            case R: return "Query response to occur in real time.";
+            case T: return "Query response to sent as a series of responses at the same time without the use of batch formatting.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case B: return "Batch";
+            case R: return "Real Time";
+            case T: return "Bolus";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseModalityEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseModalityEnumFactory.java
new file mode 100644
index 00000000000..77b4dd66b1e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseModalityEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ResponseModalityEnumFactory implements EnumFactory {
+
+  public V3ResponseModality fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("B".equals(codeString))
+      return V3ResponseModality.B;
+    if ("R".equals(codeString))
+      return V3ResponseModality.R;
+    if ("T".equals(codeString))
+      return V3ResponseModality.T;
+    throw new IllegalArgumentException("Unknown V3ResponseModality code '"+codeString+"'");
+  }
+
+  public String toCode(V3ResponseModality code) {
+    if (code == V3ResponseModality.B)
+      return "B";
+    if (code == V3ResponseModality.R)
+      return "R";
+    if (code == V3ResponseModality.T)
+      return "T";
+    return "?";
+  }
+
+    public String toSystem(V3ResponseModality code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseMode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseMode.java
new file mode 100644
index 00000000000..6b3c52771fa
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseMode.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3ResponseMode {
+
+        /**
+         * The receiver may respond in a non-immediate manner. Note: this will be the default value.
+         */
+        D, 
+        /**
+         * The receiver is required to assume that the sender is blocking and behave appropriately by sending an immediate response.
+         */
+        I, 
+        /**
+         * The receiver shall keep any application responses in a queue until such time as the queue is polled.
+         */
+        Q, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3ResponseMode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("D".equals(codeString))
+          return D;
+        if ("I".equals(codeString))
+          return I;
+        if ("Q".equals(codeString))
+          return Q;
+        throw new FHIRException("Unknown V3ResponseMode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case D: return "D";
+            case I: return "I";
+            case Q: return "Q";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/ResponseMode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case D: return "The receiver may respond in a non-immediate manner. Note: this will be the default value.";
+            case I: return "The receiver is required to assume that the sender is blocking and behave appropriately by sending an immediate response.";
+            case Q: return "The receiver shall keep any application responses in a queue until such time as the queue is polled.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case D: return "deferred";
+            case I: return "immediate";
+            case Q: return "queue";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseModeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseModeEnumFactory.java
new file mode 100644
index 00000000000..35b3307e2af
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3ResponseModeEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3ResponseModeEnumFactory implements EnumFactory {
+
+  public V3ResponseMode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("D".equals(codeString))
+      return V3ResponseMode.D;
+    if ("I".equals(codeString))
+      return V3ResponseMode.I;
+    if ("Q".equals(codeString))
+      return V3ResponseMode.Q;
+    throw new IllegalArgumentException("Unknown V3ResponseMode code '"+codeString+"'");
+  }
+
+  public String toCode(V3ResponseMode code) {
+    if (code == V3ResponseMode.D)
+      return "D";
+    if (code == V3ResponseMode.I)
+      return "I";
+    if (code == V3ResponseMode.Q)
+      return "Q";
+    return "?";
+  }
+
+    public String toSystem(V3ResponseMode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleClass.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleClass.java
new file mode 100644
index 00000000000..5dfae9044af
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleClass.java
@@ -0,0 +1,1278 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3RoleClass {
+
+        /**
+         * Corresponds to the Role class
+         */
+        ROL, 
+        /**
+         * A general association between two entities that is neither partitive nor ontological.
+         */
+        _ROLECLASSASSOCIATIVE, 
+        /**
+         * A relationship that is based on mutual behavior of the two Entities as being related. The basis of such relationship may be agreements (e.g., spouses, contract parties) or they may be de facto behavior (e.g. friends) or may be an incidental involvement with each other (e.g. parties over a dispute, siblings, children).
+         */
+        _ROLECLASSMUTUALRELATIONSHIP, 
+        /**
+         * A relationship between two entities that is formally recognized, frequently by a contract or similar agreement.
+         */
+        _ROLECLASSRELATIONSHIPFORMAL, 
+        /**
+         * Player of the Affiliate role has a business/professional relationship with scoper.  Player and scoper may be persons or organization.  The Affiliate relationship does not imply membership in a group, nor does it exist for resource scheduling purposes.
+
+                        
+                           Example: A healthcare provider is affiliated with another provider as a business associate.
+         */
+        AFFL, 
+        /**
+         * An entity (player) that acts or is authorized to act on behalf of another entity (scoper).
+         */
+        AGNT, 
+        /**
+         * An agent role in which the agent is an Entity acting in the employ of an organization.  The focus is on functional role on behalf of the organization, unlike the Employee role where the focus is on the 'Human Resources' relationship between the employee and the organization.
+         */
+        ASSIGNED, 
+        /**
+         * An Entity that is authorized to issue or instantiate permissions, privileges, credentials or other formal/legal authorizations.
+         */
+        COMPAR, 
+        /**
+         * The role of a person (player) who is the officer or signature authority for of a scoping entity, usually an organization (scoper).
+         */
+        SGNOFF, 
+        /**
+         * A person or an organization (player) which provides or receives information regarding another entity (scoper).  Examples; patient NOK and emergency contacts; guarantor contact; employer contact.
+         */
+        CON, 
+        /**
+         * An entity to be contacted in the event of an emergency.
+         */
+        ECON, 
+        /**
+         * An individual designated for notification as the next of kin for a given entity.
+         */
+        NOK, 
+        /**
+         * Guardian of a ward
+         */
+        GUARD, 
+        /**
+         * Citizen of apolitical entity
+         */
+        CIT, 
+        /**
+         * A role class played by a person who receives benefit coverage under the terms of a particular insurance policy.  The underwriter of that policy is the scoping entity.  The covered party receives coverage because of some contractual or other relationship with the holder of that policy.
+
+                        
+                           Discussion:This reason for coverage is captured in 'Role.code' and a relationship link with type code of indirect authority should be included using the policy holder role as the source, and the covered party role as the target.
+
+                        Note that a particular policy may cover several individuals one of whom may be, but need not be, the policy holder.  Thus the notion of covered party is a role that is distinct from that of the policy holder.
+         */
+        COVPTY, 
+        /**
+         * Description: A role played by a party making a claim for coverage under a policy or program.  A claimant must be either a person or organization, or a group of persons or organizations.  A claimant is not a named insured or a program eligible.
+
+                        
+                           Discussion: With respect to liability insurance such as property and casualty insurance, a claimant must file a claim requesting indemnification for a loss that the claimant considers covered under the policy of a named insured.  The claims adjuster for the policy underwriter will review the claim to determine whether the loss meets the benefit coverage criteria under a policy, and base any indemnification or coverage payment on that review.  If a third party is liable in whole or part for the loss, the underwriter may pursue third party liability recovery.  A claimant may be involved in civil or criminal legal proceedings involving claims against a defendant party that is indemnified by an insurance policy or to protest the finding of a claims adjustor. With respect to life insurance, a beneficiary designated by a named insured becomes a claimant of the proceeds of coverage, as in the case of a life insurance policy.  However, a claimant for coverage under life insurance is not necessarily a designated beneficiary.
+
+                        
+                           Note: A claimant is not a named insured.  However, a named insured may make a claim under a policy, e.g., an insured driver may make a claim for an injury under his or her comprehensive automobile insurance policy.  Similarly, a program eligible may make a claim under program, e.g., an unemployed worker may claim benefits under an unemployment insurance program, but parties playing these covered party role classes are not, for purposes of this vocabulary and in an effort to clearly distinguish role classes, considered claimants.
+
+                        In the case of a named insured making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that either a named insured or an individual insured has filed a claim for a loss.  In the case of a program eligible, a role type code INJWKR (injured worker) subtypes the class to indicate that the covered party in a workers compensation program is an injured worker, and as such, has filed a "claim" under the program for benefits.  Likewise, a covered role type code UNEMP (unemployed worker) subtypes the program eligible class to indicate that the covered party in an unemployment insurance program has filed a claim for unemployment benefits.
+
+                        
+                           Example: A claimant under automobile policy that is not the named insured.
+         */
+        CLAIM, 
+        /**
+         * Description: A role played by a party to an insurance policy to which the insurer agrees to indemnify for losses, provides benefits for, or renders services.  A named insured may be either a person, non-person living subject, or an organization, or a group of persons, non-person living subjects, or organizations.
+
+                        
+                           Discussion: The coded concept NAMED should not be used where a more specific child concept in this Specializable value set applies.  In some cases, the named insured may not be the policy holder, e.g., where a policy holder purchases life insurance policy in which another party is the named insured and the policy holder is the beneficiary of the policy.
+
+                        
+                           Note: The party playing the role of a named insured is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However, a named insured may make a claim under a policy, e.g., e.g., a party that is the named insured and policy holder under a comprehensive automobile insurance policy may become the claimant for coverage under that policy e.g., if injured in an automobile accident and there is no liable third party.  In the case of a named insured making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that a named insured has filed a claim for a loss.
+
+                        
+                           Example: The named insured under a comprehensive automobile, disability, or property and casualty policy that is the named insured and may or may not be the policy holder.
+         */
+        NAMED, 
+        /**
+         * Description: A role played by a person covered under a policy or program based on an association with a subscriber, which is recognized by the policy holder.
+
+                        
+                           Note:  The party playing the role of a dependent is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However, a dependent may make a claim under a policy, e.g., a dependent under a health insurance policy may become the claimant for coverage under that policy for wellness examines or if injured and there is no liable third party.  In the case of a dependent making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that the dependent has filed a claim for services covered under the health insurance policy.
+
+                        
+                           Example: The dependent has an association with the subscriber such as a financial dependency or personal relationship such as that of a spouse, or a natural or adopted child.  The policy holder may be required by law to recognize certain associations or may have discretion about the associations.  For example, a policy holder may dictate the criteria for the dependent status of adult children who are students, such as requiring full time enrollment, or may recognize domestic partners as dependents.  Under certain circumstances, the dependent may be under the indirect authority of a responsible party acting as a surrogate for the subscriber, for example, if the subscriber is differently abled or deceased, a guardian ad Lidem or estate executor may be appointed to assume the subscriberaTMs legal standing in the relationship with the dependent.
+         */
+        DEPEN, 
+        /**
+         * Description: A role played by a party covered under a policy as the policy holder.  An individual may be either a person or an organization.
+
+                        
+                           Note: The party playing the role of an individual insured is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However, a named insured may make a claim under a policy, e.g., a party that is the named insured and policy holder under a comprehensive automobile insurance policy may become the claimant for coverage under that policy if injured in an automobile accident and there is no liable third party.  In the case of an individual insured making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that an individual insured has filed a claim for a loss.
+
+                        
+                           Example: The individual insured under a comprehensive automobile, disability, or property and casualty policy that is the policy holder.
+         */
+        INDIV, 
+        /**
+         * Description: A role played by a person covered under a policy based on association with a sponsor who is the policy holder, and whose association may provide for the eligibility of dependents for coverage.
+
+                        
+                           Discussion: The policy holder holds the contract with the policy or program underwriter.  The subscriber holds a certificate of coverage under the contract.  In legal proceedings concerning the policy or program, the terms of the contract takes precedence over the terms of the certificate of coverage if there are any inconsistencies.
+
+                        
+                           Note: The party playing the role of a subscriber is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However, a subscriber may make a claim under a policy, e.g., a subscriber under a health insurance policy may become the claimant for coverage under that policy for wellness examines or if injured and there is no liable third party.  In the case of a subscriber making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that the subscriber has filed a claim for services covered under the health insurance policy.
+
+                        
+                           Example: An employee or a member of an association.
+         */
+        SUBSCR, 
+        /**
+         * Description: A role played by a party that meets the eligibility criteria for coverage under a program.  A program eligible may be either a person, non-person living subject, or an organization, or a group of persons, non-person living subjects, or organizations.
+
+                        
+                           Discussion: A program as typically government administered coverage for parties determined eligible under the terms of the program.
+
+                        
+                           Note: The party playing a program eligible is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However a program eligible may make a claim under program, e.g., an unemployed worker may claim benefits under an unemployment insurance program, but parties playing these covered party role classes are not, for purposes of this vocabulary and in an effort to clearly distinguish role classes, considered claimants.
+
+                        In the case of a program eligible, a role type code INJWKR (injured worker) subtypes the class to indicate that the covered party in a workers compensation program is an injured worker, and as such, has filed a "claim" under the program for benefits.  Likewise, a covered role type code UNEMP (unemployed worker) subtypes the program eligible class to indicate that the covered party in an unemployment insurance program has filed a claim for unemployment benefits.
+
+                        
+                           Example: A party meeting eligibility criteria related to health or financial status, e.g., in the U.S., persons meeting health, demographic, or financial criteria established by state and federal law are eligible for Medicaid.
+         */
+        PROG, 
+        /**
+         * A role played by a provider, always a person, who has agency authority from a Clinical Research Sponsor to direct the conduct of a clinical research trial or study on behalf of the sponsor.
+         */
+        CRINV, 
+        /**
+         * A role played by an entity, usually an organization, that is the sponsor of a clinical research trial or study.  The sponsor commissions the study, bears the expenses, is responsible for satisfying all legal requirements concerning subject safety and privacy, and is generally responsible for collection, storage and analysis of the data generated during the trial.  No scoper is necessary, as a clinical research sponsor undertakes the role on its own authority and declaration. Clinical research sponsors are usually educational or other research organizations, government agencies or biopharmaceutical companies.
+         */
+        CRSPNSR, 
+        /**
+         * A relationship between a person or organization and a person or organization formed for the purpose of exchanging work for compensation.  The purpose of the role is to identify the type of relationship the employee has to the employer, rather than the nature of the work actually performed.  (Contrast with AssignedEntity.)
+         */
+        EMP, 
+        /**
+         * A role played by a member of a military service. Scoper is the military service (e.g. Army, Navy, Air Force, etc.) or, more specifically, the unit (e.g. Company C, 3rd Battalion, 4th Division, etc.)
+         */
+        MIL, 
+        /**
+         * A person or organization (player) that serves as a financial guarantor for another person or organization (scoper).
+         */
+        GUAR, 
+        /**
+         * An entity that is the subject of an investigation. This role is scoped by the party responsible for the investigation.
+         */
+        INVSBJ, 
+        /**
+         * A person, non-person living subject, or place that is the subject of an investigation related to a notifiable condition (health circumstance that is reportable within the applicable public health jurisdiction)
+         */
+        CASEBJ, 
+        /**
+         * Definition:Specifies the administrative functionality within a formal experimental design for which the ResearchSubject role was established.
+
+                        
+                           Examples: Screening - role is used for pre-enrollment evaluation portion of the design; enrolled - role is used for subjects admitted to the experimental portion of the design.
+         */
+        RESBJ, 
+        /**
+         * A relationship in which the scoper certifies the player ( e. g. a medical care giver, a medical device or a provider organization) to perform certain activities that fall under the jurisdiction of the scoper (e.g., a health authority licensing healthcare providers, a medical quality authority certifying healthcare professionals).
+         */
+        LIC, 
+        /**
+         * notary public
+         */
+        NOT, 
+        /**
+         * An Entity (player) that is authorized to provide health care services by some authorizing agency (scoper).
+         */
+        PROV, 
+        /**
+         * A Role of a LivingSubject (player) as an actual or potential recipient of health care services from a healthcare provider organization (scoper).
+
+                        
+                           Usage Note: Communication about relationships between patients and specific healthcare practitioners (people) is not done via scoper.  Instead this is generally done using the CareProvision act.  This allows linkage between patient and a particular healthcare practitioner role and also allows description of the type of care involved in the relationship.
+         */
+        PAT, 
+        /**
+         * The role of an organization or individual designated to receive payment for a claim against a particular coverage. The scoping entity is the organization that is the submitter of the invoice in question.
+         */
+        PAYEE, 
+        /**
+         * The role of an organization that undertakes to accept claims invoices, assess the coverage or payments due for those invoices and pay to the designated payees for those invoices.  This role may be either the underwriter or a third-party organization authorized by the underwriter.  The scoping entity is the organization that underwrites the claimed coverage.
+         */
+        PAYOR, 
+        /**
+         * A role played by a person or organization that holds an insurance policy.  The underwriter of that policy is the scoping entity.
+
+                        
+                           Discussion:The identifier of the policy is captured in 'Role.id' when the Role is a policy holder.
+
+                        A particular policy may cover several individuals one of whom may be, but need not be, the policy holder.  Thus the notion of covered party is a role that is distinct from that of the policy holder.
+         */
+        POLHOLD, 
+        /**
+         * An entity (player) that has been recognized as having certain training/experience or other characteristics that would make said entity an appropriate performer for a certain activity. The scoper is an organization that educates or qualifies entities.
+         */
+        QUAL, 
+        /**
+         * A role played by an entity, usually an organization that is the sponsor of an insurance plan or a health program. A sponsor is the party that is ultimately accountable for the coverage by employment contract or by law.  A sponsor can be an employer, union, government agency, or association.  Fully insured sponsors establish the terms of the plan and contract with health insurance plans to assume the risk and to administer the plan.  Self-insured sponsors delegate coverage administration, but not risk, to third-party administrators.  Program sponsors designate services to be covered in accordance with statute.   Program sponsors may administer the coverage themselves, delegate coverage administration, but not risk to third-party administrators, or contract with health insurance plans to assume the risk and administrator a program. Sponsors qualify individuals who may become 
+
+                        
+                           
+                              a policy holder of the plan;
+
+                           
+                           
+                              where the sponsor is the policy holder, who may become a subscriber or a dependent to a policy under the plan; or
+
+                           
+                           
+                              where the sponsor is a government agency, who may become program eligibles under a program. 
+
+                           
+                        
+                        The sponsor role may be further qualified by the SponsorRole.code.  Entities playing the sponsor role may also play the role of a Coverage Administrator.
+
+                        
+                           Example: An employer, union, government agency, or association.
+         */
+        SPNSR, 
+        /**
+         * A role played by an individual who is a student of a school, which is the scoping entity.
+         */
+        STD, 
+        /**
+         * A role played by a person or an organization.  It is the party that 
+
+                        
+                           
+                              accepts fiscal responsibility for insurance plans and the policies created under those plans;
+
+                           
+                           
+                              administers and accepts fiscal responsibility for a program that provides coverage for services to eligible individuals; and/or
+
+                           
+                           
+                              has the responsibility to assess the merits of each risk and decide a suitable premium for accepting all or part of the risk.  If played by an organization, this role may be further specified by an appropriate RoleCode.
+
+                           
+                        
+                        
+                           Example:
+                        
+
+                        
+                           
+                              A health insurer; 
+
+                           
+                           
+                              Medicaid Program;
+
+                           
+                           
+                              Lloyd's of London
+         */
+        UNDWRT, 
+        /**
+         * A person responsible for the primary care of a patient at home.
+         */
+        CAREGIVER, 
+        /**
+         * Links two entities with classCode PSN (person) in a personal relationship. The character of the relationship must be defined by a PersonalRelationshipRoleType code. The player and scoper are determined by PersonalRelationshipRoleType code as well.
+         */
+        PRS, 
+        /**
+         * The "same" roleclass asserts an identity between playing and scoping entities: that they are in fact instances of the same entity and, in the case of discrepancies (e.g different DOB, gender), that one or both are in error.
+
+                        
+                           Usage:
+                        
+
+                        playing and scoping entities must have same classcode, but need not have identical attributes or values. 
+
+                        
+                           Example: 
+                        
+
+                        a provider registry maintains sets of conflicting demographic data for what is reported to be the same individual.
+         */
+        SELF, 
+        /**
+         * An association for a playing Entity that is used, known, treated, handled, built, or destroyed, etc. under the auspices of the scoping Entity. The playing Entity is passive in these roles (even though it may be active in other roles), in the sense that the kinds of things done to it in this role happen without an agreement from the playing Entity.
+         */
+        _ROLECLASSPASSIVE, 
+        /**
+         * A role in which the playing entity (material) provides access to another entity. The principal use case is intravenous (or other bodily) access lines that preexist and need to be referred to for medication routing instructions.
+         */
+        ACCESS, 
+        /**
+         * A physical association whereby two Entities are in some (even lose) spatial relationship with each other such that they touch each other in some way.
+
+                        
+                           Examples: the colon is connected (and therefore adjacent) to the jejunum; the colon is adjacent to the liver (even if not actually connected.)
+
+                        
+                           UsageConstraints: Adjacency is in principle a symmetrical connection, but scoper and player of the role should, where applicable, be assigned to have scoper be the larger, more central Entity and player the smaller, more distant, appendage.
+         */
+        ADJY, 
+        /**
+         * An adjacency of two Entities held together by a bond which attaches to each of the two entities. 
+
+                        
+                           Examples: biceps brachii muscle connected to the radius bone, port 3 on a network switch connected to port 5 on a patch panel.
+
+                        
+                           UsageConstraints: See Adjacency for the assignment of scoper (larger, more central) and player (smaller, more distant).
+         */
+        CONC, 
+        /**
+         * A connection between two atoms of a molecule.
+
+                        
+                           Examples: double bond between first and second C in ethane, peptide bond between two amino-acid, disulfide bridge between two proteins, chelate and ion associations, even the much weaker van-der-Waals bonds can be considered molecular bonds.
+
+                        
+                           UsageConstraints: See connection and adjacency for the assignment of player and scoper.
+         */
+        BOND, 
+        /**
+         * A connection between two regional parts.
+
+                        
+                           Examples:  the connection between ascending aorta and the aortic arc, connection between descending colon and sigmoid.
+
+                        
+                           UsageConstraints: See connection and adjacency for the assignment of player and scoper.
+         */
+        CONY, 
+        /**
+         * A material (player) that can be administered to an Entity (scoper).
+         */
+        ADMM, 
+        /**
+         * Relates a place (playing Entity) as the location where a living subject (scoping Entity) was born.
+         */
+        BIRTHPL, 
+        /**
+         * Definition: Relates a place (playing Entity) as the location where a living subject (scoping Entity) died.
+         */
+        DEATHPLC, 
+        /**
+         * A material (player) distributed by a distributor (scoper) who functions between a manufacturer and a buyer or retailer.
+         */
+        DST, 
+        /**
+         * Material (player) sold by a retailer (scoper), who also give advice to prospective buyers.
+         */
+        RET, 
+        /**
+         * A role played by a place at which the location of an event may be recorded.
+         */
+        EXLOC, 
+        /**
+         * A role played by a place at which services may be provided.
+         */
+        SDLOC, 
+        /**
+         * A role of a place (player) that is intended to house the provision of services. Scoper is the Entity (typically Organization) that provides these services. This is not synonymous with "ownership."
+         */
+        DSDLOC, 
+        /**
+         * A role played by a place at which health care services may be provided without prior designation or authorization.
+         */
+        ISDLOC, 
+        /**
+         * A role played by an entity that has been exposed to a person or animal suffering a contagious disease, or with a location from which a toxin has been distributed.  The player of the role is normally a person or animal, but it is possible that other entity types could become exposed.  The role is scoped by the source of the exposure, and it is quite possible for a person playing the role of exposed party to also become the scoper a role played by another person.  That is to say, once a person has become infected, it is possible, perhaps likely, for that person to infect others.
+
+                        Management of exposures and tracking exposed parties is a key function within public health, and within most public health contexts - exposed parties are known as "contacts."
+         */
+        EXPR, 
+        /**
+         * Entity that is currently in the possession of a holder (scoper), who holds, or uses it, usually based on some agreement with the owner.
+         */
+        HLD, 
+        /**
+         * The role of a material (player) that is the physical health chart belonging to an organization (scoper).
+         */
+        HLTHCHRT, 
+        /**
+         * A role in which the scoping entity designates an identifier for a playing entity.
+         */
+        IDENT, 
+        /**
+         * Scoped by the manufacturer
+         */
+        MANU, 
+        /**
+         * A manufactured material (player) that is used for its therapeutic properties.  The manufacturer is the scoper.
+         */
+        THER, 
+        /**
+         * An entity (player) that is maintained by another entity (scoper).  This is typical role held by durable equipment. The scoper assumes responsibility for proper operation, quality, and safety.
+         */
+        MNT, 
+        /**
+         * An Entity (player) for which someone (scoper) is granted by law the right to call the material (player) his own.  This entitles the scoper to make decisions about the disposition of that material.
+         */
+        OWN, 
+        /**
+         * A product regulated by some governmentatl orgnization.  The role is played by Material and scoped by Organization.
+
+                        Rationale: To support an entity clone used to identify the NDC number for a drug product.
+         */
+        RGPR, 
+        /**
+         * Relates a place entity (player) as the region over which the scoper (typically an Organization) has certain authority (jurisdiction). For example, the Calgary Regional Health Authority (scoper) has authority over the territory "Region 4 of Alberta" (player) in matters of health.
+         */
+        TERR, 
+        /**
+         * Description:An entity (player) that is used by another entity (scoper)
+         */
+        USED, 
+        /**
+         * A role a product plays when a guarantee is given to the purchaser by the seller (scoping entity) stating that the product is reliable and free from known defects and that the seller will repair or replace defective parts within a given time limit and under certain conditions.
+         */
+        WRTE, 
+        /**
+         * A relationship in which the scoping Entity defines or specifies what the playing Entity is.  Thus, the player's "being" (Greek: ontos) is specified.
+         */
+        _ROLECLASSONTOLOGICAL, 
+        /**
+         * Description: Specifies the player Entity (the equivalent Entity) as an Entity that is considered to be equivalent to a reference Entity (scoper).  The equivalence is in principle a symmetric relationship, however, it is expected that the scoper is a reference entity which serves as reference entity for multiple different equivalent entities. 
+
+                        
+                           Examples: An innovator's medicine formulation is the reference for "generics", i.e., formulations manufactured differently but having been proven to be biologically equivalent to the reference medicine. Another example is a reference ingredient that serves as basis for quantity specifications (basis of strength, e.g., metoprolol succinate specified in terms of metoprolol tartrate.)
+         */
+        EQUIV, 
+        /**
+         * The "same" role asserts an identity between playing and scoping entities, i.e., that they are in fact two records of the same entity instance, and, in the case of discrepancies (e.g different DOB, gender), that one or both are in error.
+
+                        
+                           Usage:
+                        
+
+                        playing and scoping entities must have same classCode, but need not have identical attributes or values.
+
+                        
+                           Example: 
+                        
+
+                        a provider registry maintains sets of conflicting demographic data for what is reported to be the same individual.
+         */
+        SAME, 
+        /**
+         * Relates a prevailing record of an Entity (scoper) with another record (player) that it subsumes.
+
+                        
+                           Examples: Show a correct new Person object (scoper) that subsumes one or more duplicate Person objects that had accidentally been created for the same physical person.
+
+                        
+                           Constraints: Both the player and scoper must have the same classCode.
+         */
+        SUBY, 
+        /**
+         * Relates a specialized material concept (player) to its generalization (scoper).
+         */
+        GEN, 
+        /**
+         * A special link between pharmaceuticals indicating that the target (scoper) is a generic for the source (player).
+         */
+        GRIC, 
+        /**
+         * An individual piece of material (player) instantiating a class of material (scoper).
+         */
+        INST, 
+        /**
+         * An entity that subsumes the identity of another.  Used in the context of merging documented entity instances. Both the player and scoper must have the same classCode.
+
+                        The use of this code is deprecated in favor of the term SUBY which is its inverse and is more ontologically correct.
+         */
+        SUBS, 
+        /**
+         * An association between two Entities where the playing Entity is considered in some way "part" of the scoping Entity, e.g., as a member, component, ingredient, or content. Being "part" in the broadest sense of the word can mean anything from being an integral structural component to a mere incidental temporary association of a playing Entity with a (generally larger) scoping Entity.
+         */
+        _ROLECLASSPARTITIVE, 
+        /**
+         * Relates a material as the content (player) to a container (scoper).  Unlike ingredients, the content and a container remain separate (not mixed) and the content can be removed from the container.  A content is not part of an empty container.
+         */
+        CONT, 
+        /**
+         * An exposure agent carrier is an entity that is capable of conveying an exposure agent from one entity to another.  The scoper of the role must be the exposure agent (e.g., pathogen).
+         */
+        EXPAGTCAR, 
+        /**
+         * Description: A vector is a living subject that carries an exposure agent.  The vector does not cause the disease itself, but exposes targets to the exposure agent.  A mosquito carrying malaria is an example of a vector.  The scoper of the role must be the exposure agent (e.g., pathogen).
+         */
+        EXPVECTOR, 
+        /**
+         * Description: A fomite is a non-living entity that is capable of conveying exposure agent from one entity to another.  A doorknob contaminated with a Norovirus is an example of a fomite.  Anyone touching the doorknob would be exposed to the virus.  The scoper of the role must be the exposure agent (e.g., pathogen).
+         */
+        FOMITE, 
+        /**
+         * Relates a component (player) to a mixture (scoper). E.g., Glucose and Water are ingredients of D5W, latex may be an ingredient in a tracheal tube.
+         */
+        INGR, 
+        /**
+         * Definition: a therapeutically active ingredient (player) in a mixture (scoper), where the mixture is typically a manufactured pharmaceutical.  It is unknown if the quantity of such an ingredient is expressed precisely in terms of the playing ingredient substance, or, if it is specified in terms of a closely related substance (active moiety or reference substance).
+         */
+        ACTI, 
+        /**
+         * Description:  Active ingredient, where the ingredient substance (player) is itself the "basis of strength", i.e., where the Role.quantity specifies exactly the quantity of the player substance in the medicine formulation. 
+
+                        
+                           Examples: Lopressor 50 mg actually contains 50 mg of metoprolol succinate, even though the active moiety is metoprolol,  but also: Tenormin 50 mg contain 50 mg of atenolol, as free base, i.e., where the active ingredient atenolol is also the active moiety.
+         */
+        ACTIB, 
+        /**
+         * Description: Active ingredient, where not the ingredient substance (player), but itaTMs active moiety is the "basis of strength", i.e., where the Role.quantity specifies the quantity of the player substance's active moiety in the medicine formulation.
+
+                        
+                           Examples: 1 mL of Betopic 5mg/mL eye drops contains 5.6 mg betaxolol hydrochloride equivalent to betaxolol base 5 mg.
+         */
+        ACTIM, 
+        /**
+         * Description: Active ingredient, where not the ingredient substance (player) but another reference substance with the same active moiety, is the "basis of strength", i.e., where the Role.quantity specifies the quantity of a reference substance, similar but different from the player substance's in the medicine formulation.
+
+                        
+                           Examples: Toprol-XL 50 mg contains 47.5 mg of metoprolol succinate equivalent to 50 mg of metoprolol tartrate.
+         */
+        ACTIR, 
+        /**
+         * A component (player) added to enhance the action of an active ingredient (scoper) (in the manner of a catalyst) but which has no active effect in and of itself.  Such ingredients are significant in defining equivalence of products in a way that inactive ingredients are not.
+         */
+        ADJV, 
+        /**
+         * An ingredient (player)  that is added to a base (scoper), that amounts to a minor part of the overall mixture.
+         */
+        ADTV, 
+        /**
+         * A base ingredient (player) is what comprises the major part of a mixture (scoper). E.g., Water in most i.v. solutions, or Vaseline in salves. Among all ingredients of a material, there should be only one base. A base substance can, in turn, be a mixture.
+         */
+        BASE, 
+        /**
+         * An ingredient whose presence is not intended but may not be reasonably avoided given the circumstances of the mixture's nature or origin.
+         */
+        CNTM, 
+        /**
+         * An ingredient which is not considered therapeutically active, e.g., colors, flavors, stabilizers, or preservatives, fillers, or structural components added to an active ingredient in order to facilitate administration of the active ingredient but without being considered therapeutically active. An inactive ingredient need not be biologically inert, e.g., might be active as an allergen or might have a pleasant taste, but is not an essential constituent delivering the therapeutic effect.
+         */
+        IACT, 
+        /**
+         * A substance (player) influencing the optical aspect of material (scoper).
+         */
+        COLR, 
+        /**
+         * A substance (player) added to a mixture (scoper) to make it taste a certain way.  In food the use is obvious, in pharmaceuticals flavors can hide disgusting taste of the active ingredient (important in pediatric treatments).
+         */
+        FLVR, 
+        /**
+         * A substance (player) added to a mixture (scoper) to prevent microorganisms (fungi, bacteria) to spoil the mixture.
+         */
+        PRSV, 
+        /**
+         * A stabilizer (player) added to a mixture (scoper) in order to prevent the molecular disintegration of the main substance.
+         */
+        STBL, 
+        /**
+         * An ingredient (player) of a medication (scoper) that is inseparable from the active ingredients, but has no intended chemical or pharmaceutical effect itself, but which may have some systemic effect on the patient.
+
+                        An example is a collagen matrix used as a base for transplanting skin cells.  The collagen matrix can be left permanently in the graft site.  Because it is of bovine origin, the patient may exhibit allergies or may have cultural objections to its use.
+         */
+        MECH, 
+        /**
+         * Relates an entity (player) to a location (scoper) at which it is present in some way. This presence may be limited in time.
+         */
+        LOCE, 
+        /**
+         * Relates an entity (player) (e.g. a device) to a location (scoper) at which it is normally found or stored when not used.
+         */
+        STOR, 
+        /**
+         * A role played by an entity that is a member of a group.  The group provides the scope for this role.
+
+                        Among other uses, groups as used in insurance (groups of covered individuals) and in scheduling where resources may be grouped for scheduling and logistical purposes.
+         */
+        MBR, 
+        /**
+         * Definition:  an association between two Entities where the playing Entity (the part) is a component of the whole (scoper) in the sense of an integral structural component, that is distinct from other parts in the same whole, has a distinct function in the whole, and, as an effect, the full integrity of the whole depends (to some degree) on the presence of this part, even though the part may often be separable from the whole.
+
+                        
+                           Discussion: Part is defined in opposition to (a) ingredient (not separable), (b) content (not a functional component), and (c) member (not functionally distinct from other members).
+         */
+        PART, 
+        /**
+         * The molecule or ion that is responsible for the intended pharmacological action of the drug substance, excluding those appended or associated parts of the molecule that make the molecule an ester, salt (including a salt with hydrogen or coordination bonds), or other noncovalent derivative (such as a complex, chelate, or clathrate).
+
+                        Examples: heparin-sodium and heparin-potassium have the same active moiety, heparin; the active moiety of morphine-hydrochloride is morphine.
+         */
+        ACTM, 
+        /**
+         * A role played by a material entity that is a specimen for an act. It is scoped by the source of the specimen.
+         */
+        SPEC, 
+        /**
+         * A portion (player) of an original or source specimen (scoper) used for testing or transportation.
+         */
+        ALQT, 
+        /**
+         * A microorganism that has been isolated from other microorganisms or a source matrix.
+         */
+        ISLT, 
+        /**
+         * The player of the role is a child of the scoping entity, in a generic sense.
+         */
+        CHILD, 
+        /**
+         * A role played by an entity that receives credentials from the scoping entity.
+         */
+        CRED, 
+        /**
+         * nurse practitioner
+         */
+        NURPRAC, 
+        /**
+         * nurse
+         */
+        NURS, 
+        /**
+         * physician assistant
+         */
+        PA, 
+        /**
+         * physician
+         */
+        PHYS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3RoleClass fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("ROL".equals(codeString))
+          return ROL;
+        if ("_RoleClassAssociative".equals(codeString))
+          return _ROLECLASSASSOCIATIVE;
+        if ("_RoleClassMutualRelationship".equals(codeString))
+          return _ROLECLASSMUTUALRELATIONSHIP;
+        if ("_RoleClassRelationshipFormal".equals(codeString))
+          return _ROLECLASSRELATIONSHIPFORMAL;
+        if ("AFFL".equals(codeString))
+          return AFFL;
+        if ("AGNT".equals(codeString))
+          return AGNT;
+        if ("ASSIGNED".equals(codeString))
+          return ASSIGNED;
+        if ("COMPAR".equals(codeString))
+          return COMPAR;
+        if ("SGNOFF".equals(codeString))
+          return SGNOFF;
+        if ("CON".equals(codeString))
+          return CON;
+        if ("ECON".equals(codeString))
+          return ECON;
+        if ("NOK".equals(codeString))
+          return NOK;
+        if ("GUARD".equals(codeString))
+          return GUARD;
+        if ("CIT".equals(codeString))
+          return CIT;
+        if ("COVPTY".equals(codeString))
+          return COVPTY;
+        if ("CLAIM".equals(codeString))
+          return CLAIM;
+        if ("NAMED".equals(codeString))
+          return NAMED;
+        if ("DEPEN".equals(codeString))
+          return DEPEN;
+        if ("INDIV".equals(codeString))
+          return INDIV;
+        if ("SUBSCR".equals(codeString))
+          return SUBSCR;
+        if ("PROG".equals(codeString))
+          return PROG;
+        if ("CRINV".equals(codeString))
+          return CRINV;
+        if ("CRSPNSR".equals(codeString))
+          return CRSPNSR;
+        if ("EMP".equals(codeString))
+          return EMP;
+        if ("MIL".equals(codeString))
+          return MIL;
+        if ("GUAR".equals(codeString))
+          return GUAR;
+        if ("INVSBJ".equals(codeString))
+          return INVSBJ;
+        if ("CASEBJ".equals(codeString))
+          return CASEBJ;
+        if ("RESBJ".equals(codeString))
+          return RESBJ;
+        if ("LIC".equals(codeString))
+          return LIC;
+        if ("NOT".equals(codeString))
+          return NOT;
+        if ("PROV".equals(codeString))
+          return PROV;
+        if ("PAT".equals(codeString))
+          return PAT;
+        if ("PAYEE".equals(codeString))
+          return PAYEE;
+        if ("PAYOR".equals(codeString))
+          return PAYOR;
+        if ("POLHOLD".equals(codeString))
+          return POLHOLD;
+        if ("QUAL".equals(codeString))
+          return QUAL;
+        if ("SPNSR".equals(codeString))
+          return SPNSR;
+        if ("STD".equals(codeString))
+          return STD;
+        if ("UNDWRT".equals(codeString))
+          return UNDWRT;
+        if ("CAREGIVER".equals(codeString))
+          return CAREGIVER;
+        if ("PRS".equals(codeString))
+          return PRS;
+        if ("SELF".equals(codeString))
+          return SELF;
+        if ("_RoleClassPassive".equals(codeString))
+          return _ROLECLASSPASSIVE;
+        if ("ACCESS".equals(codeString))
+          return ACCESS;
+        if ("ADJY".equals(codeString))
+          return ADJY;
+        if ("CONC".equals(codeString))
+          return CONC;
+        if ("BOND".equals(codeString))
+          return BOND;
+        if ("CONY".equals(codeString))
+          return CONY;
+        if ("ADMM".equals(codeString))
+          return ADMM;
+        if ("BIRTHPL".equals(codeString))
+          return BIRTHPL;
+        if ("DEATHPLC".equals(codeString))
+          return DEATHPLC;
+        if ("DST".equals(codeString))
+          return DST;
+        if ("RET".equals(codeString))
+          return RET;
+        if ("EXLOC".equals(codeString))
+          return EXLOC;
+        if ("SDLOC".equals(codeString))
+          return SDLOC;
+        if ("DSDLOC".equals(codeString))
+          return DSDLOC;
+        if ("ISDLOC".equals(codeString))
+          return ISDLOC;
+        if ("EXPR".equals(codeString))
+          return EXPR;
+        if ("HLD".equals(codeString))
+          return HLD;
+        if ("HLTHCHRT".equals(codeString))
+          return HLTHCHRT;
+        if ("IDENT".equals(codeString))
+          return IDENT;
+        if ("MANU".equals(codeString))
+          return MANU;
+        if ("THER".equals(codeString))
+          return THER;
+        if ("MNT".equals(codeString))
+          return MNT;
+        if ("OWN".equals(codeString))
+          return OWN;
+        if ("RGPR".equals(codeString))
+          return RGPR;
+        if ("TERR".equals(codeString))
+          return TERR;
+        if ("USED".equals(codeString))
+          return USED;
+        if ("WRTE".equals(codeString))
+          return WRTE;
+        if ("_RoleClassOntological".equals(codeString))
+          return _ROLECLASSONTOLOGICAL;
+        if ("EQUIV".equals(codeString))
+          return EQUIV;
+        if ("SAME".equals(codeString))
+          return SAME;
+        if ("SUBY".equals(codeString))
+          return SUBY;
+        if ("GEN".equals(codeString))
+          return GEN;
+        if ("GRIC".equals(codeString))
+          return GRIC;
+        if ("INST".equals(codeString))
+          return INST;
+        if ("SUBS".equals(codeString))
+          return SUBS;
+        if ("_RoleClassPartitive".equals(codeString))
+          return _ROLECLASSPARTITIVE;
+        if ("CONT".equals(codeString))
+          return CONT;
+        if ("EXPAGTCAR".equals(codeString))
+          return EXPAGTCAR;
+        if ("EXPVECTOR".equals(codeString))
+          return EXPVECTOR;
+        if ("FOMITE".equals(codeString))
+          return FOMITE;
+        if ("INGR".equals(codeString))
+          return INGR;
+        if ("ACTI".equals(codeString))
+          return ACTI;
+        if ("ACTIB".equals(codeString))
+          return ACTIB;
+        if ("ACTIM".equals(codeString))
+          return ACTIM;
+        if ("ACTIR".equals(codeString))
+          return ACTIR;
+        if ("ADJV".equals(codeString))
+          return ADJV;
+        if ("ADTV".equals(codeString))
+          return ADTV;
+        if ("BASE".equals(codeString))
+          return BASE;
+        if ("CNTM".equals(codeString))
+          return CNTM;
+        if ("IACT".equals(codeString))
+          return IACT;
+        if ("COLR".equals(codeString))
+          return COLR;
+        if ("FLVR".equals(codeString))
+          return FLVR;
+        if ("PRSV".equals(codeString))
+          return PRSV;
+        if ("STBL".equals(codeString))
+          return STBL;
+        if ("MECH".equals(codeString))
+          return MECH;
+        if ("LOCE".equals(codeString))
+          return LOCE;
+        if ("STOR".equals(codeString))
+          return STOR;
+        if ("MBR".equals(codeString))
+          return MBR;
+        if ("PART".equals(codeString))
+          return PART;
+        if ("ACTM".equals(codeString))
+          return ACTM;
+        if ("SPEC".equals(codeString))
+          return SPEC;
+        if ("ALQT".equals(codeString))
+          return ALQT;
+        if ("ISLT".equals(codeString))
+          return ISLT;
+        if ("CHILD".equals(codeString))
+          return CHILD;
+        if ("CRED".equals(codeString))
+          return CRED;
+        if ("NURPRAC".equals(codeString))
+          return NURPRAC;
+        if ("NURS".equals(codeString))
+          return NURS;
+        if ("PA".equals(codeString))
+          return PA;
+        if ("PHYS".equals(codeString))
+          return PHYS;
+        throw new FHIRException("Unknown V3RoleClass code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ROL: return "ROL";
+            case _ROLECLASSASSOCIATIVE: return "_RoleClassAssociative";
+            case _ROLECLASSMUTUALRELATIONSHIP: return "_RoleClassMutualRelationship";
+            case _ROLECLASSRELATIONSHIPFORMAL: return "_RoleClassRelationshipFormal";
+            case AFFL: return "AFFL";
+            case AGNT: return "AGNT";
+            case ASSIGNED: return "ASSIGNED";
+            case COMPAR: return "COMPAR";
+            case SGNOFF: return "SGNOFF";
+            case CON: return "CON";
+            case ECON: return "ECON";
+            case NOK: return "NOK";
+            case GUARD: return "GUARD";
+            case CIT: return "CIT";
+            case COVPTY: return "COVPTY";
+            case CLAIM: return "CLAIM";
+            case NAMED: return "NAMED";
+            case DEPEN: return "DEPEN";
+            case INDIV: return "INDIV";
+            case SUBSCR: return "SUBSCR";
+            case PROG: return "PROG";
+            case CRINV: return "CRINV";
+            case CRSPNSR: return "CRSPNSR";
+            case EMP: return "EMP";
+            case MIL: return "MIL";
+            case GUAR: return "GUAR";
+            case INVSBJ: return "INVSBJ";
+            case CASEBJ: return "CASEBJ";
+            case RESBJ: return "RESBJ";
+            case LIC: return "LIC";
+            case NOT: return "NOT";
+            case PROV: return "PROV";
+            case PAT: return "PAT";
+            case PAYEE: return "PAYEE";
+            case PAYOR: return "PAYOR";
+            case POLHOLD: return "POLHOLD";
+            case QUAL: return "QUAL";
+            case SPNSR: return "SPNSR";
+            case STD: return "STD";
+            case UNDWRT: return "UNDWRT";
+            case CAREGIVER: return "CAREGIVER";
+            case PRS: return "PRS";
+            case SELF: return "SELF";
+            case _ROLECLASSPASSIVE: return "_RoleClassPassive";
+            case ACCESS: return "ACCESS";
+            case ADJY: return "ADJY";
+            case CONC: return "CONC";
+            case BOND: return "BOND";
+            case CONY: return "CONY";
+            case ADMM: return "ADMM";
+            case BIRTHPL: return "BIRTHPL";
+            case DEATHPLC: return "DEATHPLC";
+            case DST: return "DST";
+            case RET: return "RET";
+            case EXLOC: return "EXLOC";
+            case SDLOC: return "SDLOC";
+            case DSDLOC: return "DSDLOC";
+            case ISDLOC: return "ISDLOC";
+            case EXPR: return "EXPR";
+            case HLD: return "HLD";
+            case HLTHCHRT: return "HLTHCHRT";
+            case IDENT: return "IDENT";
+            case MANU: return "MANU";
+            case THER: return "THER";
+            case MNT: return "MNT";
+            case OWN: return "OWN";
+            case RGPR: return "RGPR";
+            case TERR: return "TERR";
+            case USED: return "USED";
+            case WRTE: return "WRTE";
+            case _ROLECLASSONTOLOGICAL: return "_RoleClassOntological";
+            case EQUIV: return "EQUIV";
+            case SAME: return "SAME";
+            case SUBY: return "SUBY";
+            case GEN: return "GEN";
+            case GRIC: return "GRIC";
+            case INST: return "INST";
+            case SUBS: return "SUBS";
+            case _ROLECLASSPARTITIVE: return "_RoleClassPartitive";
+            case CONT: return "CONT";
+            case EXPAGTCAR: return "EXPAGTCAR";
+            case EXPVECTOR: return "EXPVECTOR";
+            case FOMITE: return "FOMITE";
+            case INGR: return "INGR";
+            case ACTI: return "ACTI";
+            case ACTIB: return "ACTIB";
+            case ACTIM: return "ACTIM";
+            case ACTIR: return "ACTIR";
+            case ADJV: return "ADJV";
+            case ADTV: return "ADTV";
+            case BASE: return "BASE";
+            case CNTM: return "CNTM";
+            case IACT: return "IACT";
+            case COLR: return "COLR";
+            case FLVR: return "FLVR";
+            case PRSV: return "PRSV";
+            case STBL: return "STBL";
+            case MECH: return "MECH";
+            case LOCE: return "LOCE";
+            case STOR: return "STOR";
+            case MBR: return "MBR";
+            case PART: return "PART";
+            case ACTM: return "ACTM";
+            case SPEC: return "SPEC";
+            case ALQT: return "ALQT";
+            case ISLT: return "ISLT";
+            case CHILD: return "CHILD";
+            case CRED: return "CRED";
+            case NURPRAC: return "NURPRAC";
+            case NURS: return "NURS";
+            case PA: return "PA";
+            case PHYS: return "PHYS";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/RoleClass";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ROL: return "Corresponds to the Role class";
+            case _ROLECLASSASSOCIATIVE: return "A general association between two entities that is neither partitive nor ontological.";
+            case _ROLECLASSMUTUALRELATIONSHIP: return "A relationship that is based on mutual behavior of the two Entities as being related. The basis of such relationship may be agreements (e.g., spouses, contract parties) or they may be de facto behavior (e.g. friends) or may be an incidental involvement with each other (e.g. parties over a dispute, siblings, children).";
+            case _ROLECLASSRELATIONSHIPFORMAL: return "A relationship between two entities that is formally recognized, frequently by a contract or similar agreement.";
+            case AFFL: return "Player of the Affiliate role has a business/professional relationship with scoper.  Player and scoper may be persons or organization.  The Affiliate relationship does not imply membership in a group, nor does it exist for resource scheduling purposes.\r\n\n                        \n                           Example: A healthcare provider is affiliated with another provider as a business associate.";
+            case AGNT: return "An entity (player) that acts or is authorized to act on behalf of another entity (scoper).";
+            case ASSIGNED: return "An agent role in which the agent is an Entity acting in the employ of an organization.  The focus is on functional role on behalf of the organization, unlike the Employee role where the focus is on the 'Human Resources' relationship between the employee and the organization.";
+            case COMPAR: return "An Entity that is authorized to issue or instantiate permissions, privileges, credentials or other formal/legal authorizations.";
+            case SGNOFF: return "The role of a person (player) who is the officer or signature authority for of a scoping entity, usually an organization (scoper).";
+            case CON: return "A person or an organization (player) which provides or receives information regarding another entity (scoper).  Examples; patient NOK and emergency contacts; guarantor contact; employer contact.";
+            case ECON: return "An entity to be contacted in the event of an emergency.";
+            case NOK: return "An individual designated for notification as the next of kin for a given entity.";
+            case GUARD: return "Guardian of a ward";
+            case CIT: return "Citizen of apolitical entity";
+            case COVPTY: return "A role class played by a person who receives benefit coverage under the terms of a particular insurance policy.  The underwriter of that policy is the scoping entity.  The covered party receives coverage because of some contractual or other relationship with the holder of that policy.\r\n\n                        \n                           Discussion:This reason for coverage is captured in 'Role.code' and a relationship link with type code of indirect authority should be included using the policy holder role as the source, and the covered party role as the target.\r\n\n                        Note that a particular policy may cover several individuals one of whom may be, but need not be, the policy holder.  Thus the notion of covered party is a role that is distinct from that of the policy holder.";
+            case CLAIM: return "Description: A role played by a party making a claim for coverage under a policy or program.  A claimant must be either a person or organization, or a group of persons or organizations.  A claimant is not a named insured or a program eligible.\r\n\n                        \n                           Discussion: With respect to liability insurance such as property and casualty insurance, a claimant must file a claim requesting indemnification for a loss that the claimant considers covered under the policy of a named insured.  The claims adjuster for the policy underwriter will review the claim to determine whether the loss meets the benefit coverage criteria under a policy, and base any indemnification or coverage payment on that review.  If a third party is liable in whole or part for the loss, the underwriter may pursue third party liability recovery.  A claimant may be involved in civil or criminal legal proceedings involving claims against a defendant party that is indemnified by an insurance policy or to protest the finding of a claims adjustor. With respect to life insurance, a beneficiary designated by a named insured becomes a claimant of the proceeds of coverage, as in the case of a life insurance policy.  However, a claimant for coverage under life insurance is not necessarily a designated beneficiary.\r\n\n                        \n                           Note: A claimant is not a named insured.  However, a named insured may make a claim under a policy, e.g., an insured driver may make a claim for an injury under his or her comprehensive automobile insurance policy.  Similarly, a program eligible may make a claim under program, e.g., an unemployed worker may claim benefits under an unemployment insurance program, but parties playing these covered party role classes are not, for purposes of this vocabulary and in an effort to clearly distinguish role classes, considered claimants.\r\n\n                        In the case of a named insured making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that either a named insured or an individual insured has filed a claim for a loss.  In the case of a program eligible, a role type code INJWKR (injured worker) subtypes the class to indicate that the covered party in a workers compensation program is an injured worker, and as such, has filed a \"claim\" under the program for benefits.  Likewise, a covered role type code UNEMP (unemployed worker) subtypes the program eligible class to indicate that the covered party in an unemployment insurance program has filed a claim for unemployment benefits.\r\n\n                        \n                           Example: A claimant under automobile policy that is not the named insured.";
+            case NAMED: return "Description: A role played by a party to an insurance policy to which the insurer agrees to indemnify for losses, provides benefits for, or renders services.  A named insured may be either a person, non-person living subject, or an organization, or a group of persons, non-person living subjects, or organizations.\r\n\n                        \n                           Discussion: The coded concept NAMED should not be used where a more specific child concept in this Specializable value set applies.  In some cases, the named insured may not be the policy holder, e.g., where a policy holder purchases life insurance policy in which another party is the named insured and the policy holder is the beneficiary of the policy.\r\n\n                        \n                           Note: The party playing the role of a named insured is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However, a named insured may make a claim under a policy, e.g., e.g., a party that is the named insured and policy holder under a comprehensive automobile insurance policy may become the claimant for coverage under that policy e.g., if injured in an automobile accident and there is no liable third party.  In the case of a named insured making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that a named insured has filed a claim for a loss.\r\n\n                        \n                           Example: The named insured under a comprehensive automobile, disability, or property and casualty policy that is the named insured and may or may not be the policy holder.";
+            case DEPEN: return "Description: A role played by a person covered under a policy or program based on an association with a subscriber, which is recognized by the policy holder.\r\n\n                        \n                           Note:  The party playing the role of a dependent is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However, a dependent may make a claim under a policy, e.g., a dependent under a health insurance policy may become the claimant for coverage under that policy for wellness examines or if injured and there is no liable third party.  In the case of a dependent making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that the dependent has filed a claim for services covered under the health insurance policy.\r\n\n                        \n                           Example: The dependent has an association with the subscriber such as a financial dependency or personal relationship such as that of a spouse, or a natural or adopted child.  The policy holder may be required by law to recognize certain associations or may have discretion about the associations.  For example, a policy holder may dictate the criteria for the dependent status of adult children who are students, such as requiring full time enrollment, or may recognize domestic partners as dependents.  Under certain circumstances, the dependent may be under the indirect authority of a responsible party acting as a surrogate for the subscriber, for example, if the subscriber is differently abled or deceased, a guardian ad Lidem or estate executor may be appointed to assume the subscriberaTMs legal standing in the relationship with the dependent.";
+            case INDIV: return "Description: A role played by a party covered under a policy as the policy holder.  An individual may be either a person or an organization.\r\n\n                        \n                           Note: The party playing the role of an individual insured is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However, a named insured may make a claim under a policy, e.g., a party that is the named insured and policy holder under a comprehensive automobile insurance policy may become the claimant for coverage under that policy if injured in an automobile accident and there is no liable third party.  In the case of an individual insured making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that an individual insured has filed a claim for a loss.\r\n\n                        \n                           Example: The individual insured under a comprehensive automobile, disability, or property and casualty policy that is the policy holder.";
+            case SUBSCR: return "Description: A role played by a person covered under a policy based on association with a sponsor who is the policy holder, and whose association may provide for the eligibility of dependents for coverage.\r\n\n                        \n                           Discussion: The policy holder holds the contract with the policy or program underwriter.  The subscriber holds a certificate of coverage under the contract.  In legal proceedings concerning the policy or program, the terms of the contract takes precedence over the terms of the certificate of coverage if there are any inconsistencies.\r\n\n                        \n                           Note: The party playing the role of a subscriber is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However, a subscriber may make a claim under a policy, e.g., a subscriber under a health insurance policy may become the claimant for coverage under that policy for wellness examines or if injured and there is no liable third party.  In the case of a subscriber making a claim, a role type code INSCLM (insured claimant) subtypes the class to indicate that the subscriber has filed a claim for services covered under the health insurance policy.\r\n\n                        \n                           Example: An employee or a member of an association.";
+            case PROG: return "Description: A role played by a party that meets the eligibility criteria for coverage under a program.  A program eligible may be either a person, non-person living subject, or an organization, or a group of persons, non-person living subjects, or organizations.\r\n\n                        \n                           Discussion: A program as typically government administered coverage for parties determined eligible under the terms of the program.\r\n\n                        \n                           Note: The party playing a program eligible is not a claimant in the sense conveyed by the RoleClassCoveredParty CLAIM (claimant).  However a program eligible may make a claim under program, e.g., an unemployed worker may claim benefits under an unemployment insurance program, but parties playing these covered party role classes are not, for purposes of this vocabulary and in an effort to clearly distinguish role classes, considered claimants.\r\n\n                        In the case of a program eligible, a role type code INJWKR (injured worker) subtypes the class to indicate that the covered party in a workers compensation program is an injured worker, and as such, has filed a \"claim\" under the program for benefits.  Likewise, a covered role type code UNEMP (unemployed worker) subtypes the program eligible class to indicate that the covered party in an unemployment insurance program has filed a claim for unemployment benefits.\r\n\n                        \n                           Example: A party meeting eligibility criteria related to health or financial status, e.g., in the U.S., persons meeting health, demographic, or financial criteria established by state and federal law are eligible for Medicaid.";
+            case CRINV: return "A role played by a provider, always a person, who has agency authority from a Clinical Research Sponsor to direct the conduct of a clinical research trial or study on behalf of the sponsor.";
+            case CRSPNSR: return "A role played by an entity, usually an organization, that is the sponsor of a clinical research trial or study.  The sponsor commissions the study, bears the expenses, is responsible for satisfying all legal requirements concerning subject safety and privacy, and is generally responsible for collection, storage and analysis of the data generated during the trial.  No scoper is necessary, as a clinical research sponsor undertakes the role on its own authority and declaration. Clinical research sponsors are usually educational or other research organizations, government agencies or biopharmaceutical companies.";
+            case EMP: return "A relationship between a person or organization and a person or organization formed for the purpose of exchanging work for compensation.  The purpose of the role is to identify the type of relationship the employee has to the employer, rather than the nature of the work actually performed.  (Contrast with AssignedEntity.)";
+            case MIL: return "A role played by a member of a military service. Scoper is the military service (e.g. Army, Navy, Air Force, etc.) or, more specifically, the unit (e.g. Company C, 3rd Battalion, 4th Division, etc.)";
+            case GUAR: return "A person or organization (player) that serves as a financial guarantor for another person or organization (scoper).";
+            case INVSBJ: return "An entity that is the subject of an investigation. This role is scoped by the party responsible for the investigation.";
+            case CASEBJ: return "A person, non-person living subject, or place that is the subject of an investigation related to a notifiable condition (health circumstance that is reportable within the applicable public health jurisdiction)";
+            case RESBJ: return "Definition:Specifies the administrative functionality within a formal experimental design for which the ResearchSubject role was established.\r\n\n                        \n                           Examples: Screening - role is used for pre-enrollment evaluation portion of the design; enrolled - role is used for subjects admitted to the experimental portion of the design.";
+            case LIC: return "A relationship in which the scoper certifies the player ( e. g. a medical care giver, a medical device or a provider organization) to perform certain activities that fall under the jurisdiction of the scoper (e.g., a health authority licensing healthcare providers, a medical quality authority certifying healthcare professionals).";
+            case NOT: return "notary public";
+            case PROV: return "An Entity (player) that is authorized to provide health care services by some authorizing agency (scoper).";
+            case PAT: return "A Role of a LivingSubject (player) as an actual or potential recipient of health care services from a healthcare provider organization (scoper).\r\n\n                        \n                           Usage Note: Communication about relationships between patients and specific healthcare practitioners (people) is not done via scoper.  Instead this is generally done using the CareProvision act.  This allows linkage between patient and a particular healthcare practitioner role and also allows description of the type of care involved in the relationship.";
+            case PAYEE: return "The role of an organization or individual designated to receive payment for a claim against a particular coverage. The scoping entity is the organization that is the submitter of the invoice in question.";
+            case PAYOR: return "The role of an organization that undertakes to accept claims invoices, assess the coverage or payments due for those invoices and pay to the designated payees for those invoices.  This role may be either the underwriter or a third-party organization authorized by the underwriter.  The scoping entity is the organization that underwrites the claimed coverage.";
+            case POLHOLD: return "A role played by a person or organization that holds an insurance policy.  The underwriter of that policy is the scoping entity.\r\n\n                        \n                           Discussion:The identifier of the policy is captured in 'Role.id' when the Role is a policy holder.\r\n\n                        A particular policy may cover several individuals one of whom may be, but need not be, the policy holder.  Thus the notion of covered party is a role that is distinct from that of the policy holder.";
+            case QUAL: return "An entity (player) that has been recognized as having certain training/experience or other characteristics that would make said entity an appropriate performer for a certain activity. The scoper is an organization that educates or qualifies entities.";
+            case SPNSR: return "A role played by an entity, usually an organization that is the sponsor of an insurance plan or a health program. A sponsor is the party that is ultimately accountable for the coverage by employment contract or by law.  A sponsor can be an employer, union, government agency, or association.  Fully insured sponsors establish the terms of the plan and contract with health insurance plans to assume the risk and to administer the plan.  Self-insured sponsors delegate coverage administration, but not risk, to third-party administrators.  Program sponsors designate services to be covered in accordance with statute.   Program sponsors may administer the coverage themselves, delegate coverage administration, but not risk to third-party administrators, or contract with health insurance plans to assume the risk and administrator a program. Sponsors qualify individuals who may become \r\n\n                        \n                           \n                              a policy holder of the plan;\r\n\n                           \n                           \n                              where the sponsor is the policy holder, who may become a subscriber or a dependent to a policy under the plan; or\r\n\n                           \n                           \n                              where the sponsor is a government agency, who may become program eligibles under a program. \r\n\n                           \n                        \n                        The sponsor role may be further qualified by the SponsorRole.code.  Entities playing the sponsor role may also play the role of a Coverage Administrator.\r\n\n                        \n                           Example: An employer, union, government agency, or association.";
+            case STD: return "A role played by an individual who is a student of a school, which is the scoping entity.";
+            case UNDWRT: return "A role played by a person or an organization.  It is the party that \r\n\n                        \n                           \n                              accepts fiscal responsibility for insurance plans and the policies created under those plans;\r\n\n                           \n                           \n                              administers and accepts fiscal responsibility for a program that provides coverage for services to eligible individuals; and/or\r\n\n                           \n                           \n                              has the responsibility to assess the merits of each risk and decide a suitable premium for accepting all or part of the risk.  If played by an organization, this role may be further specified by an appropriate RoleCode.\r\n\n                           \n                        \n                        \n                           Example:\n                        \r\n\n                        \n                           \n                              A health insurer; \r\n\n                           \n                           \n                              Medicaid Program;\r\n\n                           \n                           \n                              Lloyd's of London";
+            case CAREGIVER: return "A person responsible for the primary care of a patient at home.";
+            case PRS: return "Links two entities with classCode PSN (person) in a personal relationship. The character of the relationship must be defined by a PersonalRelationshipRoleType code. The player and scoper are determined by PersonalRelationshipRoleType code as well.";
+            case SELF: return "The \"same\" roleclass asserts an identity between playing and scoping entities: that they are in fact instances of the same entity and, in the case of discrepancies (e.g different DOB, gender), that one or both are in error.\r\n\n                        \n                           Usage:\n                        \r\n\n                        playing and scoping entities must have same classcode, but need not have identical attributes or values. \r\n\n                        \n                           Example: \n                        \r\n\n                        a provider registry maintains sets of conflicting demographic data for what is reported to be the same individual.";
+            case _ROLECLASSPASSIVE: return "An association for a playing Entity that is used, known, treated, handled, built, or destroyed, etc. under the auspices of the scoping Entity. The playing Entity is passive in these roles (even though it may be active in other roles), in the sense that the kinds of things done to it in this role happen without an agreement from the playing Entity.";
+            case ACCESS: return "A role in which the playing entity (material) provides access to another entity. The principal use case is intravenous (or other bodily) access lines that preexist and need to be referred to for medication routing instructions.";
+            case ADJY: return "A physical association whereby two Entities are in some (even lose) spatial relationship with each other such that they touch each other in some way.\r\n\n                        \n                           Examples: the colon is connected (and therefore adjacent) to the jejunum; the colon is adjacent to the liver (even if not actually connected.)\r\n\n                        \n                           UsageConstraints: Adjacency is in principle a symmetrical connection, but scoper and player of the role should, where applicable, be assigned to have scoper be the larger, more central Entity and player the smaller, more distant, appendage.";
+            case CONC: return "An adjacency of two Entities held together by a bond which attaches to each of the two entities. \r\n\n                        \n                           Examples: biceps brachii muscle connected to the radius bone, port 3 on a network switch connected to port 5 on a patch panel.\r\n\n                        \n                           UsageConstraints: See Adjacency for the assignment of scoper (larger, more central) and player (smaller, more distant).";
+            case BOND: return "A connection between two atoms of a molecule.\r\n\n                        \n                           Examples: double bond between first and second C in ethane, peptide bond between two amino-acid, disulfide bridge between two proteins, chelate and ion associations, even the much weaker van-der-Waals bonds can be considered molecular bonds.\r\n\n                        \n                           UsageConstraints: See connection and adjacency for the assignment of player and scoper.";
+            case CONY: return "A connection between two regional parts.\r\n\n                        \n                           Examples:  the connection between ascending aorta and the aortic arc, connection between descending colon and sigmoid.\r\n\n                        \n                           UsageConstraints: See connection and adjacency for the assignment of player and scoper.";
+            case ADMM: return "A material (player) that can be administered to an Entity (scoper).";
+            case BIRTHPL: return "Relates a place (playing Entity) as the location where a living subject (scoping Entity) was born.";
+            case DEATHPLC: return "Definition: Relates a place (playing Entity) as the location where a living subject (scoping Entity) died.";
+            case DST: return "A material (player) distributed by a distributor (scoper) who functions between a manufacturer and a buyer or retailer.";
+            case RET: return "Material (player) sold by a retailer (scoper), who also give advice to prospective buyers.";
+            case EXLOC: return "A role played by a place at which the location of an event may be recorded.";
+            case SDLOC: return "A role played by a place at which services may be provided.";
+            case DSDLOC: return "A role of a place (player) that is intended to house the provision of services. Scoper is the Entity (typically Organization) that provides these services. This is not synonymous with \"ownership.\"";
+            case ISDLOC: return "A role played by a place at which health care services may be provided without prior designation or authorization.";
+            case EXPR: return "A role played by an entity that has been exposed to a person or animal suffering a contagious disease, or with a location from which a toxin has been distributed.  The player of the role is normally a person or animal, but it is possible that other entity types could become exposed.  The role is scoped by the source of the exposure, and it is quite possible for a person playing the role of exposed party to also become the scoper a role played by another person.  That is to say, once a person has become infected, it is possible, perhaps likely, for that person to infect others.\r\n\n                        Management of exposures and tracking exposed parties is a key function within public health, and within most public health contexts - exposed parties are known as \"contacts.\"";
+            case HLD: return "Entity that is currently in the possession of a holder (scoper), who holds, or uses it, usually based on some agreement with the owner.";
+            case HLTHCHRT: return "The role of a material (player) that is the physical health chart belonging to an organization (scoper).";
+            case IDENT: return "A role in which the scoping entity designates an identifier for a playing entity.";
+            case MANU: return "Scoped by the manufacturer";
+            case THER: return "A manufactured material (player) that is used for its therapeutic properties.  The manufacturer is the scoper.";
+            case MNT: return "An entity (player) that is maintained by another entity (scoper).  This is typical role held by durable equipment. The scoper assumes responsibility for proper operation, quality, and safety.";
+            case OWN: return "An Entity (player) for which someone (scoper) is granted by law the right to call the material (player) his own.  This entitles the scoper to make decisions about the disposition of that material.";
+            case RGPR: return "A product regulated by some governmentatl orgnization.  The role is played by Material and scoped by Organization.\r\n\n                        Rationale: To support an entity clone used to identify the NDC number for a drug product.";
+            case TERR: return "Relates a place entity (player) as the region over which the scoper (typically an Organization) has certain authority (jurisdiction). For example, the Calgary Regional Health Authority (scoper) has authority over the territory \"Region 4 of Alberta\" (player) in matters of health.";
+            case USED: return "Description:An entity (player) that is used by another entity (scoper)";
+            case WRTE: return "A role a product plays when a guarantee is given to the purchaser by the seller (scoping entity) stating that the product is reliable and free from known defects and that the seller will repair or replace defective parts within a given time limit and under certain conditions.";
+            case _ROLECLASSONTOLOGICAL: return "A relationship in which the scoping Entity defines or specifies what the playing Entity is.  Thus, the player's \"being\" (Greek: ontos) is specified.";
+            case EQUIV: return "Description: Specifies the player Entity (the equivalent Entity) as an Entity that is considered to be equivalent to a reference Entity (scoper).  The equivalence is in principle a symmetric relationship, however, it is expected that the scoper is a reference entity which serves as reference entity for multiple different equivalent entities. \r\n\n                        \n                           Examples: An innovator's medicine formulation is the reference for \"generics\", i.e., formulations manufactured differently but having been proven to be biologically equivalent to the reference medicine. Another example is a reference ingredient that serves as basis for quantity specifications (basis of strength, e.g., metoprolol succinate specified in terms of metoprolol tartrate.)";
+            case SAME: return "The \"same\" role asserts an identity between playing and scoping entities, i.e., that they are in fact two records of the same entity instance, and, in the case of discrepancies (e.g different DOB, gender), that one or both are in error.\r\n\n                        \n                           Usage:\n                        \r\n\n                        playing and scoping entities must have same classCode, but need not have identical attributes or values.\r\n\n                        \n                           Example: \n                        \r\n\n                        a provider registry maintains sets of conflicting demographic data for what is reported to be the same individual.";
+            case SUBY: return "Relates a prevailing record of an Entity (scoper) with another record (player) that it subsumes.\r\n\n                        \n                           Examples: Show a correct new Person object (scoper) that subsumes one or more duplicate Person objects that had accidentally been created for the same physical person.\r\n\n                        \n                           Constraints: Both the player and scoper must have the same classCode.";
+            case GEN: return "Relates a specialized material concept (player) to its generalization (scoper).";
+            case GRIC: return "A special link between pharmaceuticals indicating that the target (scoper) is a generic for the source (player).";
+            case INST: return "An individual piece of material (player) instantiating a class of material (scoper).";
+            case SUBS: return "An entity that subsumes the identity of another.  Used in the context of merging documented entity instances. Both the player and scoper must have the same classCode.\r\n\n                        The use of this code is deprecated in favor of the term SUBY which is its inverse and is more ontologically correct.";
+            case _ROLECLASSPARTITIVE: return "An association between two Entities where the playing Entity is considered in some way \"part\" of the scoping Entity, e.g., as a member, component, ingredient, or content. Being \"part\" in the broadest sense of the word can mean anything from being an integral structural component to a mere incidental temporary association of a playing Entity with a (generally larger) scoping Entity.";
+            case CONT: return "Relates a material as the content (player) to a container (scoper).  Unlike ingredients, the content and a container remain separate (not mixed) and the content can be removed from the container.  A content is not part of an empty container.";
+            case EXPAGTCAR: return "An exposure agent carrier is an entity that is capable of conveying an exposure agent from one entity to another.  The scoper of the role must be the exposure agent (e.g., pathogen).";
+            case EXPVECTOR: return "Description: A vector is a living subject that carries an exposure agent.  The vector does not cause the disease itself, but exposes targets to the exposure agent.  A mosquito carrying malaria is an example of a vector.  The scoper of the role must be the exposure agent (e.g., pathogen).";
+            case FOMITE: return "Description: A fomite is a non-living entity that is capable of conveying exposure agent from one entity to another.  A doorknob contaminated with a Norovirus is an example of a fomite.  Anyone touching the doorknob would be exposed to the virus.  The scoper of the role must be the exposure agent (e.g., pathogen).";
+            case INGR: return "Relates a component (player) to a mixture (scoper). E.g., Glucose and Water are ingredients of D5W, latex may be an ingredient in a tracheal tube.";
+            case ACTI: return "Definition: a therapeutically active ingredient (player) in a mixture (scoper), where the mixture is typically a manufactured pharmaceutical.  It is unknown if the quantity of such an ingredient is expressed precisely in terms of the playing ingredient substance, or, if it is specified in terms of a closely related substance (active moiety or reference substance).";
+            case ACTIB: return "Description:  Active ingredient, where the ingredient substance (player) is itself the \"basis of strength\", i.e., where the Role.quantity specifies exactly the quantity of the player substance in the medicine formulation. \r\n\n                        \n                           Examples: Lopressor 50 mg actually contains 50 mg of metoprolol succinate, even though the active moiety is metoprolol,  but also: Tenormin 50 mg contain 50 mg of atenolol, as free base, i.e., where the active ingredient atenolol is also the active moiety.";
+            case ACTIM: return "Description: Active ingredient, where not the ingredient substance (player), but itaTMs active moiety is the \"basis of strength\", i.e., where the Role.quantity specifies the quantity of the player substance's active moiety in the medicine formulation.\r\n\n                        \n                           Examples: 1 mL of Betopic 5mg/mL eye drops contains 5.6 mg betaxolol hydrochloride equivalent to betaxolol base 5 mg.";
+            case ACTIR: return "Description: Active ingredient, where not the ingredient substance (player) but another reference substance with the same active moiety, is the \"basis of strength\", i.e., where the Role.quantity specifies the quantity of a reference substance, similar but different from the player substance's in the medicine formulation.\r\n\n                        \n                           Examples: Toprol-XL 50 mg contains 47.5 mg of metoprolol succinate equivalent to 50 mg of metoprolol tartrate.";
+            case ADJV: return "A component (player) added to enhance the action of an active ingredient (scoper) (in the manner of a catalyst) but which has no active effect in and of itself.  Such ingredients are significant in defining equivalence of products in a way that inactive ingredients are not.";
+            case ADTV: return "An ingredient (player)  that is added to a base (scoper), that amounts to a minor part of the overall mixture.";
+            case BASE: return "A base ingredient (player) is what comprises the major part of a mixture (scoper). E.g., Water in most i.v. solutions, or Vaseline in salves. Among all ingredients of a material, there should be only one base. A base substance can, in turn, be a mixture.";
+            case CNTM: return "An ingredient whose presence is not intended but may not be reasonably avoided given the circumstances of the mixture's nature or origin.";
+            case IACT: return "An ingredient which is not considered therapeutically active, e.g., colors, flavors, stabilizers, or preservatives, fillers, or structural components added to an active ingredient in order to facilitate administration of the active ingredient but without being considered therapeutically active. An inactive ingredient need not be biologically inert, e.g., might be active as an allergen or might have a pleasant taste, but is not an essential constituent delivering the therapeutic effect.";
+            case COLR: return "A substance (player) influencing the optical aspect of material (scoper).";
+            case FLVR: return "A substance (player) added to a mixture (scoper) to make it taste a certain way.  In food the use is obvious, in pharmaceuticals flavors can hide disgusting taste of the active ingredient (important in pediatric treatments).";
+            case PRSV: return "A substance (player) added to a mixture (scoper) to prevent microorganisms (fungi, bacteria) to spoil the mixture.";
+            case STBL: return "A stabilizer (player) added to a mixture (scoper) in order to prevent the molecular disintegration of the main substance.";
+            case MECH: return "An ingredient (player) of a medication (scoper) that is inseparable from the active ingredients, but has no intended chemical or pharmaceutical effect itself, but which may have some systemic effect on the patient.\r\n\n                        An example is a collagen matrix used as a base for transplanting skin cells.  The collagen matrix can be left permanently in the graft site.  Because it is of bovine origin, the patient may exhibit allergies or may have cultural objections to its use.";
+            case LOCE: return "Relates an entity (player) to a location (scoper) at which it is present in some way. This presence may be limited in time.";
+            case STOR: return "Relates an entity (player) (e.g. a device) to a location (scoper) at which it is normally found or stored when not used.";
+            case MBR: return "A role played by an entity that is a member of a group.  The group provides the scope for this role.\r\n\n                        Among other uses, groups as used in insurance (groups of covered individuals) and in scheduling where resources may be grouped for scheduling and logistical purposes.";
+            case PART: return "Definition:  an association between two Entities where the playing Entity (the part) is a component of the whole (scoper) in the sense of an integral structural component, that is distinct from other parts in the same whole, has a distinct function in the whole, and, as an effect, the full integrity of the whole depends (to some degree) on the presence of this part, even though the part may often be separable from the whole.\r\n\n                        \n                           Discussion: Part is defined in opposition to (a) ingredient (not separable), (b) content (not a functional component), and (c) member (not functionally distinct from other members).";
+            case ACTM: return "The molecule or ion that is responsible for the intended pharmacological action of the drug substance, excluding those appended or associated parts of the molecule that make the molecule an ester, salt (including a salt with hydrogen or coordination bonds), or other noncovalent derivative (such as a complex, chelate, or clathrate).\r\n\n                        Examples: heparin-sodium and heparin-potassium have the same active moiety, heparin; the active moiety of morphine-hydrochloride is morphine.";
+            case SPEC: return "A role played by a material entity that is a specimen for an act. It is scoped by the source of the specimen.";
+            case ALQT: return "A portion (player) of an original or source specimen (scoper) used for testing or transportation.";
+            case ISLT: return "A microorganism that has been isolated from other microorganisms or a source matrix.";
+            case CHILD: return "The player of the role is a child of the scoping entity, in a generic sense.";
+            case CRED: return "A role played by an entity that receives credentials from the scoping entity.";
+            case NURPRAC: return "nurse practitioner";
+            case NURS: return "nurse";
+            case PA: return "physician assistant";
+            case PHYS: return "physician";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ROL: return "role";
+            case _ROLECLASSASSOCIATIVE: return "RoleClassAssociative";
+            case _ROLECLASSMUTUALRELATIONSHIP: return "RoleClassMutualRelationship";
+            case _ROLECLASSRELATIONSHIPFORMAL: return "RoleClassRelationshipFormal";
+            case AFFL: return "affiliate";
+            case AGNT: return "agent";
+            case ASSIGNED: return "assigned entity";
+            case COMPAR: return "commissioning party";
+            case SGNOFF: return "signing authority or officer";
+            case CON: return "contact";
+            case ECON: return "emergency contact";
+            case NOK: return "next of kin";
+            case GUARD: return "guardian";
+            case CIT: return "citizen";
+            case COVPTY: return "covered party";
+            case CLAIM: return "claimant";
+            case NAMED: return "named insured";
+            case DEPEN: return "dependent";
+            case INDIV: return "individual";
+            case SUBSCR: return "subscriber";
+            case PROG: return "program eligible";
+            case CRINV: return "clinical research investigator";
+            case CRSPNSR: return "clinical research sponsor";
+            case EMP: return "employee";
+            case MIL: return "military person";
+            case GUAR: return "guarantor";
+            case INVSBJ: return "Investigation Subject";
+            case CASEBJ: return "Case Subject";
+            case RESBJ: return "research subject";
+            case LIC: return "licensed entity";
+            case NOT: return "notary public";
+            case PROV: return "healthcare provider";
+            case PAT: return "patient";
+            case PAYEE: return "payee";
+            case PAYOR: return "invoice payor";
+            case POLHOLD: return "policy holder";
+            case QUAL: return "qualified entity";
+            case SPNSR: return "coverage sponsor";
+            case STD: return "student";
+            case UNDWRT: return "underwriter";
+            case CAREGIVER: return "caregiver";
+            case PRS: return "personal relationship";
+            case SELF: return "self";
+            case _ROLECLASSPASSIVE: return "RoleClassPassive";
+            case ACCESS: return "access";
+            case ADJY: return "adjacency";
+            case CONC: return "connection";
+            case BOND: return "molecular bond";
+            case CONY: return "continuity";
+            case ADMM: return "Administerable Material";
+            case BIRTHPL: return "birthplace";
+            case DEATHPLC: return "place of death";
+            case DST: return "distributed material";
+            case RET: return "retailed material";
+            case EXLOC: return "event location";
+            case SDLOC: return "service delivery location";
+            case DSDLOC: return "dedicated service delivery location";
+            case ISDLOC: return "incidental service delivery location";
+            case EXPR: return "exposed entity";
+            case HLD: return "held entity";
+            case HLTHCHRT: return "health chart";
+            case IDENT: return "identified entity";
+            case MANU: return "manufactured product";
+            case THER: return "therapeutic agent";
+            case MNT: return "maintained entity";
+            case OWN: return "owned entity";
+            case RGPR: return "regulated product";
+            case TERR: return "territory of authority";
+            case USED: return "used entity";
+            case WRTE: return "warranted product";
+            case _ROLECLASSONTOLOGICAL: return "RoleClassOntological";
+            case EQUIV: return "equivalent entity";
+            case SAME: return "same";
+            case SUBY: return "subsumed by";
+            case GEN: return "has generalization";
+            case GRIC: return "has generic";
+            case INST: return "instance";
+            case SUBS: return "subsumer";
+            case _ROLECLASSPARTITIVE: return "RoleClassPartitive";
+            case CONT: return "content";
+            case EXPAGTCAR: return "exposure agent carrier";
+            case EXPVECTOR: return "exposure vector";
+            case FOMITE: return "fomite";
+            case INGR: return "ingredient";
+            case ACTI: return "active ingredient";
+            case ACTIB: return "active ingredient - basis of strength";
+            case ACTIM: return "active ingredient - moiety is basis of strength";
+            case ACTIR: return "active ingredient - reference substance is basis of strength";
+            case ADJV: return "adjuvant";
+            case ADTV: return "additive";
+            case BASE: return "base";
+            case CNTM: return "contaminant ingredient";
+            case IACT: return "inactive ingredient";
+            case COLR: return "color additive";
+            case FLVR: return "flavor additive";
+            case PRSV: return "preservative";
+            case STBL: return "stabilizer";
+            case MECH: return "mechanical ingredient";
+            case LOCE: return "located entity";
+            case STOR: return "stored entity";
+            case MBR: return "member";
+            case PART: return "part";
+            case ACTM: return "active moiety";
+            case SPEC: return "specimen";
+            case ALQT: return "aliquot";
+            case ISLT: return "isolate";
+            case CHILD: return "child";
+            case CRED: return "credentialed entity";
+            case NURPRAC: return "nurse practitioner";
+            case NURS: return "nurse";
+            case PA: return "physician assistant";
+            case PHYS: return "physician";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleClassEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleClassEnumFactory.java
new file mode 100644
index 00000000000..eb66061dd90
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleClassEnumFactory.java
@@ -0,0 +1,502 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3RoleClassEnumFactory implements EnumFactory {
+
+  public V3RoleClass fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("ROL".equals(codeString))
+      return V3RoleClass.ROL;
+    if ("_RoleClassAssociative".equals(codeString))
+      return V3RoleClass._ROLECLASSASSOCIATIVE;
+    if ("_RoleClassMutualRelationship".equals(codeString))
+      return V3RoleClass._ROLECLASSMUTUALRELATIONSHIP;
+    if ("_RoleClassRelationshipFormal".equals(codeString))
+      return V3RoleClass._ROLECLASSRELATIONSHIPFORMAL;
+    if ("AFFL".equals(codeString))
+      return V3RoleClass.AFFL;
+    if ("AGNT".equals(codeString))
+      return V3RoleClass.AGNT;
+    if ("ASSIGNED".equals(codeString))
+      return V3RoleClass.ASSIGNED;
+    if ("COMPAR".equals(codeString))
+      return V3RoleClass.COMPAR;
+    if ("SGNOFF".equals(codeString))
+      return V3RoleClass.SGNOFF;
+    if ("CON".equals(codeString))
+      return V3RoleClass.CON;
+    if ("ECON".equals(codeString))
+      return V3RoleClass.ECON;
+    if ("NOK".equals(codeString))
+      return V3RoleClass.NOK;
+    if ("GUARD".equals(codeString))
+      return V3RoleClass.GUARD;
+    if ("CIT".equals(codeString))
+      return V3RoleClass.CIT;
+    if ("COVPTY".equals(codeString))
+      return V3RoleClass.COVPTY;
+    if ("CLAIM".equals(codeString))
+      return V3RoleClass.CLAIM;
+    if ("NAMED".equals(codeString))
+      return V3RoleClass.NAMED;
+    if ("DEPEN".equals(codeString))
+      return V3RoleClass.DEPEN;
+    if ("INDIV".equals(codeString))
+      return V3RoleClass.INDIV;
+    if ("SUBSCR".equals(codeString))
+      return V3RoleClass.SUBSCR;
+    if ("PROG".equals(codeString))
+      return V3RoleClass.PROG;
+    if ("CRINV".equals(codeString))
+      return V3RoleClass.CRINV;
+    if ("CRSPNSR".equals(codeString))
+      return V3RoleClass.CRSPNSR;
+    if ("EMP".equals(codeString))
+      return V3RoleClass.EMP;
+    if ("MIL".equals(codeString))
+      return V3RoleClass.MIL;
+    if ("GUAR".equals(codeString))
+      return V3RoleClass.GUAR;
+    if ("INVSBJ".equals(codeString))
+      return V3RoleClass.INVSBJ;
+    if ("CASEBJ".equals(codeString))
+      return V3RoleClass.CASEBJ;
+    if ("RESBJ".equals(codeString))
+      return V3RoleClass.RESBJ;
+    if ("LIC".equals(codeString))
+      return V3RoleClass.LIC;
+    if ("NOT".equals(codeString))
+      return V3RoleClass.NOT;
+    if ("PROV".equals(codeString))
+      return V3RoleClass.PROV;
+    if ("PAT".equals(codeString))
+      return V3RoleClass.PAT;
+    if ("PAYEE".equals(codeString))
+      return V3RoleClass.PAYEE;
+    if ("PAYOR".equals(codeString))
+      return V3RoleClass.PAYOR;
+    if ("POLHOLD".equals(codeString))
+      return V3RoleClass.POLHOLD;
+    if ("QUAL".equals(codeString))
+      return V3RoleClass.QUAL;
+    if ("SPNSR".equals(codeString))
+      return V3RoleClass.SPNSR;
+    if ("STD".equals(codeString))
+      return V3RoleClass.STD;
+    if ("UNDWRT".equals(codeString))
+      return V3RoleClass.UNDWRT;
+    if ("CAREGIVER".equals(codeString))
+      return V3RoleClass.CAREGIVER;
+    if ("PRS".equals(codeString))
+      return V3RoleClass.PRS;
+    if ("SELF".equals(codeString))
+      return V3RoleClass.SELF;
+    if ("_RoleClassPassive".equals(codeString))
+      return V3RoleClass._ROLECLASSPASSIVE;
+    if ("ACCESS".equals(codeString))
+      return V3RoleClass.ACCESS;
+    if ("ADJY".equals(codeString))
+      return V3RoleClass.ADJY;
+    if ("CONC".equals(codeString))
+      return V3RoleClass.CONC;
+    if ("BOND".equals(codeString))
+      return V3RoleClass.BOND;
+    if ("CONY".equals(codeString))
+      return V3RoleClass.CONY;
+    if ("ADMM".equals(codeString))
+      return V3RoleClass.ADMM;
+    if ("BIRTHPL".equals(codeString))
+      return V3RoleClass.BIRTHPL;
+    if ("DEATHPLC".equals(codeString))
+      return V3RoleClass.DEATHPLC;
+    if ("DST".equals(codeString))
+      return V3RoleClass.DST;
+    if ("RET".equals(codeString))
+      return V3RoleClass.RET;
+    if ("EXLOC".equals(codeString))
+      return V3RoleClass.EXLOC;
+    if ("SDLOC".equals(codeString))
+      return V3RoleClass.SDLOC;
+    if ("DSDLOC".equals(codeString))
+      return V3RoleClass.DSDLOC;
+    if ("ISDLOC".equals(codeString))
+      return V3RoleClass.ISDLOC;
+    if ("EXPR".equals(codeString))
+      return V3RoleClass.EXPR;
+    if ("HLD".equals(codeString))
+      return V3RoleClass.HLD;
+    if ("HLTHCHRT".equals(codeString))
+      return V3RoleClass.HLTHCHRT;
+    if ("IDENT".equals(codeString))
+      return V3RoleClass.IDENT;
+    if ("MANU".equals(codeString))
+      return V3RoleClass.MANU;
+    if ("THER".equals(codeString))
+      return V3RoleClass.THER;
+    if ("MNT".equals(codeString))
+      return V3RoleClass.MNT;
+    if ("OWN".equals(codeString))
+      return V3RoleClass.OWN;
+    if ("RGPR".equals(codeString))
+      return V3RoleClass.RGPR;
+    if ("TERR".equals(codeString))
+      return V3RoleClass.TERR;
+    if ("USED".equals(codeString))
+      return V3RoleClass.USED;
+    if ("WRTE".equals(codeString))
+      return V3RoleClass.WRTE;
+    if ("_RoleClassOntological".equals(codeString))
+      return V3RoleClass._ROLECLASSONTOLOGICAL;
+    if ("EQUIV".equals(codeString))
+      return V3RoleClass.EQUIV;
+    if ("SAME".equals(codeString))
+      return V3RoleClass.SAME;
+    if ("SUBY".equals(codeString))
+      return V3RoleClass.SUBY;
+    if ("GEN".equals(codeString))
+      return V3RoleClass.GEN;
+    if ("GRIC".equals(codeString))
+      return V3RoleClass.GRIC;
+    if ("INST".equals(codeString))
+      return V3RoleClass.INST;
+    if ("SUBS".equals(codeString))
+      return V3RoleClass.SUBS;
+    if ("_RoleClassPartitive".equals(codeString))
+      return V3RoleClass._ROLECLASSPARTITIVE;
+    if ("CONT".equals(codeString))
+      return V3RoleClass.CONT;
+    if ("EXPAGTCAR".equals(codeString))
+      return V3RoleClass.EXPAGTCAR;
+    if ("EXPVECTOR".equals(codeString))
+      return V3RoleClass.EXPVECTOR;
+    if ("FOMITE".equals(codeString))
+      return V3RoleClass.FOMITE;
+    if ("INGR".equals(codeString))
+      return V3RoleClass.INGR;
+    if ("ACTI".equals(codeString))
+      return V3RoleClass.ACTI;
+    if ("ACTIB".equals(codeString))
+      return V3RoleClass.ACTIB;
+    if ("ACTIM".equals(codeString))
+      return V3RoleClass.ACTIM;
+    if ("ACTIR".equals(codeString))
+      return V3RoleClass.ACTIR;
+    if ("ADJV".equals(codeString))
+      return V3RoleClass.ADJV;
+    if ("ADTV".equals(codeString))
+      return V3RoleClass.ADTV;
+    if ("BASE".equals(codeString))
+      return V3RoleClass.BASE;
+    if ("CNTM".equals(codeString))
+      return V3RoleClass.CNTM;
+    if ("IACT".equals(codeString))
+      return V3RoleClass.IACT;
+    if ("COLR".equals(codeString))
+      return V3RoleClass.COLR;
+    if ("FLVR".equals(codeString))
+      return V3RoleClass.FLVR;
+    if ("PRSV".equals(codeString))
+      return V3RoleClass.PRSV;
+    if ("STBL".equals(codeString))
+      return V3RoleClass.STBL;
+    if ("MECH".equals(codeString))
+      return V3RoleClass.MECH;
+    if ("LOCE".equals(codeString))
+      return V3RoleClass.LOCE;
+    if ("STOR".equals(codeString))
+      return V3RoleClass.STOR;
+    if ("MBR".equals(codeString))
+      return V3RoleClass.MBR;
+    if ("PART".equals(codeString))
+      return V3RoleClass.PART;
+    if ("ACTM".equals(codeString))
+      return V3RoleClass.ACTM;
+    if ("SPEC".equals(codeString))
+      return V3RoleClass.SPEC;
+    if ("ALQT".equals(codeString))
+      return V3RoleClass.ALQT;
+    if ("ISLT".equals(codeString))
+      return V3RoleClass.ISLT;
+    if ("CHILD".equals(codeString))
+      return V3RoleClass.CHILD;
+    if ("CRED".equals(codeString))
+      return V3RoleClass.CRED;
+    if ("NURPRAC".equals(codeString))
+      return V3RoleClass.NURPRAC;
+    if ("NURS".equals(codeString))
+      return V3RoleClass.NURS;
+    if ("PA".equals(codeString))
+      return V3RoleClass.PA;
+    if ("PHYS".equals(codeString))
+      return V3RoleClass.PHYS;
+    throw new IllegalArgumentException("Unknown V3RoleClass code '"+codeString+"'");
+  }
+
+  public String toCode(V3RoleClass code) {
+    if (code == V3RoleClass.ROL)
+      return "ROL";
+    if (code == V3RoleClass._ROLECLASSASSOCIATIVE)
+      return "_RoleClassAssociative";
+    if (code == V3RoleClass._ROLECLASSMUTUALRELATIONSHIP)
+      return "_RoleClassMutualRelationship";
+    if (code == V3RoleClass._ROLECLASSRELATIONSHIPFORMAL)
+      return "_RoleClassRelationshipFormal";
+    if (code == V3RoleClass.AFFL)
+      return "AFFL";
+    if (code == V3RoleClass.AGNT)
+      return "AGNT";
+    if (code == V3RoleClass.ASSIGNED)
+      return "ASSIGNED";
+    if (code == V3RoleClass.COMPAR)
+      return "COMPAR";
+    if (code == V3RoleClass.SGNOFF)
+      return "SGNOFF";
+    if (code == V3RoleClass.CON)
+      return "CON";
+    if (code == V3RoleClass.ECON)
+      return "ECON";
+    if (code == V3RoleClass.NOK)
+      return "NOK";
+    if (code == V3RoleClass.GUARD)
+      return "GUARD";
+    if (code == V3RoleClass.CIT)
+      return "CIT";
+    if (code == V3RoleClass.COVPTY)
+      return "COVPTY";
+    if (code == V3RoleClass.CLAIM)
+      return "CLAIM";
+    if (code == V3RoleClass.NAMED)
+      return "NAMED";
+    if (code == V3RoleClass.DEPEN)
+      return "DEPEN";
+    if (code == V3RoleClass.INDIV)
+      return "INDIV";
+    if (code == V3RoleClass.SUBSCR)
+      return "SUBSCR";
+    if (code == V3RoleClass.PROG)
+      return "PROG";
+    if (code == V3RoleClass.CRINV)
+      return "CRINV";
+    if (code == V3RoleClass.CRSPNSR)
+      return "CRSPNSR";
+    if (code == V3RoleClass.EMP)
+      return "EMP";
+    if (code == V3RoleClass.MIL)
+      return "MIL";
+    if (code == V3RoleClass.GUAR)
+      return "GUAR";
+    if (code == V3RoleClass.INVSBJ)
+      return "INVSBJ";
+    if (code == V3RoleClass.CASEBJ)
+      return "CASEBJ";
+    if (code == V3RoleClass.RESBJ)
+      return "RESBJ";
+    if (code == V3RoleClass.LIC)
+      return "LIC";
+    if (code == V3RoleClass.NOT)
+      return "NOT";
+    if (code == V3RoleClass.PROV)
+      return "PROV";
+    if (code == V3RoleClass.PAT)
+      return "PAT";
+    if (code == V3RoleClass.PAYEE)
+      return "PAYEE";
+    if (code == V3RoleClass.PAYOR)
+      return "PAYOR";
+    if (code == V3RoleClass.POLHOLD)
+      return "POLHOLD";
+    if (code == V3RoleClass.QUAL)
+      return "QUAL";
+    if (code == V3RoleClass.SPNSR)
+      return "SPNSR";
+    if (code == V3RoleClass.STD)
+      return "STD";
+    if (code == V3RoleClass.UNDWRT)
+      return "UNDWRT";
+    if (code == V3RoleClass.CAREGIVER)
+      return "CAREGIVER";
+    if (code == V3RoleClass.PRS)
+      return "PRS";
+    if (code == V3RoleClass.SELF)
+      return "SELF";
+    if (code == V3RoleClass._ROLECLASSPASSIVE)
+      return "_RoleClassPassive";
+    if (code == V3RoleClass.ACCESS)
+      return "ACCESS";
+    if (code == V3RoleClass.ADJY)
+      return "ADJY";
+    if (code == V3RoleClass.CONC)
+      return "CONC";
+    if (code == V3RoleClass.BOND)
+      return "BOND";
+    if (code == V3RoleClass.CONY)
+      return "CONY";
+    if (code == V3RoleClass.ADMM)
+      return "ADMM";
+    if (code == V3RoleClass.BIRTHPL)
+      return "BIRTHPL";
+    if (code == V3RoleClass.DEATHPLC)
+      return "DEATHPLC";
+    if (code == V3RoleClass.DST)
+      return "DST";
+    if (code == V3RoleClass.RET)
+      return "RET";
+    if (code == V3RoleClass.EXLOC)
+      return "EXLOC";
+    if (code == V3RoleClass.SDLOC)
+      return "SDLOC";
+    if (code == V3RoleClass.DSDLOC)
+      return "DSDLOC";
+    if (code == V3RoleClass.ISDLOC)
+      return "ISDLOC";
+    if (code == V3RoleClass.EXPR)
+      return "EXPR";
+    if (code == V3RoleClass.HLD)
+      return "HLD";
+    if (code == V3RoleClass.HLTHCHRT)
+      return "HLTHCHRT";
+    if (code == V3RoleClass.IDENT)
+      return "IDENT";
+    if (code == V3RoleClass.MANU)
+      return "MANU";
+    if (code == V3RoleClass.THER)
+      return "THER";
+    if (code == V3RoleClass.MNT)
+      return "MNT";
+    if (code == V3RoleClass.OWN)
+      return "OWN";
+    if (code == V3RoleClass.RGPR)
+      return "RGPR";
+    if (code == V3RoleClass.TERR)
+      return "TERR";
+    if (code == V3RoleClass.USED)
+      return "USED";
+    if (code == V3RoleClass.WRTE)
+      return "WRTE";
+    if (code == V3RoleClass._ROLECLASSONTOLOGICAL)
+      return "_RoleClassOntological";
+    if (code == V3RoleClass.EQUIV)
+      return "EQUIV";
+    if (code == V3RoleClass.SAME)
+      return "SAME";
+    if (code == V3RoleClass.SUBY)
+      return "SUBY";
+    if (code == V3RoleClass.GEN)
+      return "GEN";
+    if (code == V3RoleClass.GRIC)
+      return "GRIC";
+    if (code == V3RoleClass.INST)
+      return "INST";
+    if (code == V3RoleClass.SUBS)
+      return "SUBS";
+    if (code == V3RoleClass._ROLECLASSPARTITIVE)
+      return "_RoleClassPartitive";
+    if (code == V3RoleClass.CONT)
+      return "CONT";
+    if (code == V3RoleClass.EXPAGTCAR)
+      return "EXPAGTCAR";
+    if (code == V3RoleClass.EXPVECTOR)
+      return "EXPVECTOR";
+    if (code == V3RoleClass.FOMITE)
+      return "FOMITE";
+    if (code == V3RoleClass.INGR)
+      return "INGR";
+    if (code == V3RoleClass.ACTI)
+      return "ACTI";
+    if (code == V3RoleClass.ACTIB)
+      return "ACTIB";
+    if (code == V3RoleClass.ACTIM)
+      return "ACTIM";
+    if (code == V3RoleClass.ACTIR)
+      return "ACTIR";
+    if (code == V3RoleClass.ADJV)
+      return "ADJV";
+    if (code == V3RoleClass.ADTV)
+      return "ADTV";
+    if (code == V3RoleClass.BASE)
+      return "BASE";
+    if (code == V3RoleClass.CNTM)
+      return "CNTM";
+    if (code == V3RoleClass.IACT)
+      return "IACT";
+    if (code == V3RoleClass.COLR)
+      return "COLR";
+    if (code == V3RoleClass.FLVR)
+      return "FLVR";
+    if (code == V3RoleClass.PRSV)
+      return "PRSV";
+    if (code == V3RoleClass.STBL)
+      return "STBL";
+    if (code == V3RoleClass.MECH)
+      return "MECH";
+    if (code == V3RoleClass.LOCE)
+      return "LOCE";
+    if (code == V3RoleClass.STOR)
+      return "STOR";
+    if (code == V3RoleClass.MBR)
+      return "MBR";
+    if (code == V3RoleClass.PART)
+      return "PART";
+    if (code == V3RoleClass.ACTM)
+      return "ACTM";
+    if (code == V3RoleClass.SPEC)
+      return "SPEC";
+    if (code == V3RoleClass.ALQT)
+      return "ALQT";
+    if (code == V3RoleClass.ISLT)
+      return "ISLT";
+    if (code == V3RoleClass.CHILD)
+      return "CHILD";
+    if (code == V3RoleClass.CRED)
+      return "CRED";
+    if (code == V3RoleClass.NURPRAC)
+      return "NURPRAC";
+    if (code == V3RoleClass.NURS)
+      return "NURS";
+    if (code == V3RoleClass.PA)
+      return "PA";
+    if (code == V3RoleClass.PHYS)
+      return "PHYS";
+    return "?";
+  }
+
+    public String toSystem(V3RoleClass code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleCode.java
new file mode 100644
index 00000000000..8cbe6b5a116
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleCode.java
@@ -0,0 +1,3740 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3RoleCode {
+
+        /**
+         * Concepts characterizing the type of association formed by player and scoper when there is a recognized Affiliate role by which the two parties are related.
+
+                        
+                           Examples: Business Partner, Business Associate, Colleague
+         */
+        _AFFILIATIONROLETYPE, 
+        /**
+         * Parties that may or should contribute or have contributed to an Act.
+         */
+        _AGENTROLETYPE, 
+        /**
+         * An entity which corrected, edited, or amended pre-existing information.
+         */
+        AMENDER, 
+        /**
+         * An individual authorized to assign an original classification to information, including compilations of unclassified information, based on a determination that the information requires protection against unauthorized disclosure. The individual marks the information with immutable, computable, and human readable security labels in accordance with applicable security labeling policies.  The labeling policies provide instructions on whether and if so how the security labels may be later reclassified [i.e., upgraded, downgraded, used in derivative classification, or declassified] in a manner that preserves the overridden original classification binding and provenance.
+         */
+        CLASSIFIER, 
+        /**
+         * An entity or an entity's delegatee who is the grantee in an agreement such as a consent for services, advanced directive, or a privacy consent directive in accordance with jurisdictional, organizational, or patient policy.
+         */
+        CONSENTER, 
+        /**
+         * An entity which has witnessed and attests to observing another entity being counseled about an agreement such as a consent for services, advanced directive, or a privacy consent directive.
+         */
+        CONSWIT, 
+        /**
+         * An entity which participates in the generation of and attest to veracity of content, but is not an author or coauthor. For example a surgeon who is required by institutional, regulatory, or legal rules to sign an operative report, but who was not involved in the authorship of that report.
+         */
+        COPART, 
+        /**
+         * An individual which is authorized to declassify information based on a determination that the information no longer requires protection against unauthorized disclosure.  The individual marks the information being declassified using computable and human readable security labels indicating that this is copy of previously classified information is unclassified in accordance with applicable security labeling policies.  The labeling policies provide instructions on whether and if so how the security labels may be later reclassified [i.e., upgraded or used in derivative classification] in a manner that preserves the overridden original classification binding and provenance.
+         */
+        DECLASSIFIER, 
+        /**
+         * A party to whom some right or authority is granted by a delegator.
+         */
+        DELEGATEE, 
+        /**
+         * A party that grants all or some portion its right or authority to another party.
+         */
+        DELEGATOR, 
+        /**
+         * An individual authorized to lower the classification level of labeled content and provide rationale for doing so as directed by a classification guide.
+         */
+        DOWNGRDER, 
+        /**
+         * An individual who is only authorized to classify reproduced, extracted, or summarized classified information, or compile classified and unclassified information by applying classification markings derived from source material or as directed by a classification guide.
+         */
+        DRIVCLASSIFIER, 
+        /**
+         * An entity which accepts certain rights or authority from a grantor.
+         */
+        GRANTEE, 
+        /**
+         * An entity which agrees to confer certain rights or authority to a grantee.
+         */
+        GRANTOR, 
+        /**
+         * An entity which converts spoken or written language into the language of key participants in an event such as when a provider is obtaining a patient's consent to treatment or permission to disclose information.
+         */
+        INTPRTER, 
+        /**
+         * An entity authorized to filter information according to approved criteria.
+         */
+        REVIEWER, 
+        /**
+         * An entity authorized to validate information for inclusion in a record.
+         */
+        VALIDATOR, 
+        /**
+         * Description:Codes that indicate a specific type of sponsor.  Used when the sponsor's role is only either as a fully insured sponsor or only as a self-insured sponsor.  NOTE: Where a sponsor may be either, use the SponsorParticipationFunction.code (fully insured or self insured) to indicate the type of responsibility. (CO6-0057)
+         */
+        _COVERAGESPONSORROLETYPE, 
+        /**
+         * Description:An employer or organization that contracts with an underwriter to assumes the financial risk and administrative responsibility for coverage of health services for covered parties.
+         */
+        FULLINS, 
+        /**
+         * Description:An employer or organization that assumes the financial risk and administrative responsibility for coverage of health services for covered parties.
+         */
+        SELFINS, 
+        /**
+         * Description:PayorRoleType for a particular type of policy or program benefit package or plan where more detail about the coverage administration role of the Payor is required.  The functions performed by a Payor qualified by a PayorRoleType may be specified by the PayorParticpationFunction value set.
+
+                        
+                           Examples:A Payor that is a TPA may administer a managed care plan without underwriting the risk.
+         */
+        _PAYORROLETYPE, 
+        /**
+         * Description:A payor that is responsible for functions related to the enrollment of covered parties.
+         */
+        ENROLBKR, 
+        /**
+         * Description:Third party administrator (TPA) is a payor organization that processes health care claims without carrying insurance risk. Third party administrators are prominent players in the managed care industry and have the expertise and capability to administer all or a portion of the claims process. They are normally contracted by a health insurer or self-insuring companies to administer services, including claims administration, premium collection, enrollment and other administrative activities.
+
+                        Self-insured employers often contract with third party administrator to handle their insurance functions. Insurance companies oftentimes outsource the claims, utilization review or membership functions to a TPA. Sometimes TPAs only manage provider networks, only claims or only utilization review.
+
+                        While some third-party administrators may operate as units of insurance companies, they are often independent. However, hospitals or provider organizations desiring to set up their own health plans will often outsource certain responsibilities to TPAs.  TPAs may perform one or several payor functions, specified by the PayorParticipationFunction value set, such as provider management, enrollment, utilization management, and fee for service claims adjudication management.
+         */
+        TPA, 
+        /**
+         * Description:A payor that is responsible for review and case management of health services covered under a policy or program.
+         */
+        UMO, 
+        /**
+         * The role played by a party who has legal responsibility for another party.
+         */
+        RESPRSN, 
+        /**
+         * The role played by a person acting as the estate executor for a deceased subscriber or policyholder who was the responsible party
+         */
+        EXCEST, 
+        /**
+         * The role played by a person appointed by the court to look out for the best interests of a minor child during the course of legal proceedings.
+         */
+        GUADLTM, 
+        /**
+         * The role played by a person or institution legally empowered with responsibility for the care of a ward.
+         */
+        GUARD, 
+        /**
+         * A relationship between two people in which one person authorizes another to act for him in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts.
+         */
+        POWATT, 
+        /**
+         * A relationship between two people in which one person authorizes another, usually a family member or relative, to act for him or her in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts that is often limited in the kinds of powers that can be assigned.  Unlike ordinary powers of attorney, durable powers can survive for long periods of time, and again, unlike standard powers of attorney, durable powers can continue after incompetency.
+         */
+        DPOWATT, 
+        /**
+         * A relationship between two people in which one person authorizes another to act for him or her in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts that continues (by its terms) to be effective even though the grantor has become mentally incompetent after signing the document.
+         */
+        HPOWATT, 
+        /**
+         * A relationship between two people in which one person authorizes another to act for him or her in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts that is often limited in the kinds of powers that can be assigned.
+         */
+        SPOWATT, 
+        /**
+         * AssignedRoleType
+         */
+        _ASSIGNEDROLETYPE, 
+        /**
+         * Description:A role type that is used to further qualify a non-person subject playing a role where the role class attribute is set to RoleClass AssignedEntity
+         */
+        _ASSIGNEDNONPERSONLIVINGSUBJECTROLETYPE, 
+        /**
+         * Description:Dogs trained to assist the ill or physically challenged.
+         */
+        ASSIST, 
+        /**
+         * Description:Animals, including fish and insects, and microorganisms which may participate as assigned entities in biotherapies.
+         */
+        BIOTH, 
+        /**
+         * Description:Non-person living subject used as antibiotic.
+
+                        
+                           Examples:Bacteriophage, is a virus that infects bacteria.
+         */
+        ANTIBIOT, 
+        /**
+         * Description:Maggots raised for biodebridement.
+
+                        
+                           Discussion: Maggot Debridement Therapy is the medical use of live maggots for cleaning non-healing wounds.
+
+                        
+                           Examples:Removal of burnt skin.
+         */
+        DEBR, 
+        /**
+         * Description:Companion animals, such as dogs, cats, and rabbits, which may be provided to patients to improve general mood, decrease depression and loneliness, and distract from stress-inducing concerns to improve quality of life.
+         */
+        CCO, 
+        /**
+         * Description:Dogs trained to assist persons who are seeing impaired or blind.
+         */
+        SEE, 
+        /**
+         * Description:Dogs trained or having the ability to detect imminent seizures or cancers in humans, probably as a result of volatile chemical (odors) given off by the malignancy of the host.
+         */
+        SNIFF, 
+        /**
+         * Defines types of certifications for all entities
+         */
+        _CERTIFIEDENTITYTYPE, 
+        /**
+         * A role type used to qualify a person's legal status within a country or nation.
+         */
+        _CITIZENROLETYPE, 
+        /**
+         * A person who has fled his or her home country to find a safe place elsewhere.
+         */
+        CAS, 
+        /**
+         * A person who is someone of below legal age who has fled his or her home country, without his or her parents, to find a safe place elsewhere at time of categorization.
+         */
+        CASM, 
+        /**
+         * A person who is legally recognized as a member of a nation or country, with associated rights and obligations.
+         */
+        CN, 
+        /**
+         * A foreigner who is present in a country (which is foreign to him/her) unlawfully or without the country's authorization (may be called an illegal alien).
+         */
+        CNRP, 
+        /**
+         * A person who is below legal age present in a country, without his or her parents, (which is foreign to him/her) unlawfully or without the country's authorization.
+         */
+        CNRPM, 
+        /**
+         * A non-country member admitted to the territory of a nation or country as a non-resident for an explicit purpose.
+         */
+        CPCA, 
+        /**
+         * A foreigner who is a resident of the country but does not have citizenship.
+         */
+        CRP, 
+        /**
+         * A person who is a resident below legal age of the country without his or her parents and does not have citizenship.
+         */
+        CRPM, 
+        /**
+         * Types of contact for Role code "CON"
+         */
+        _CONTACTROLETYPE, 
+        /**
+         * A contact role used for business and/or administrative purposes.
+         */
+        _ADMINISTRATIVECONTACTROLETYPE, 
+        /**
+         * A contact role used to identify a person within a Provider organization that can be contacted for billing purposes (e.g. about the content of the Invoice).
+         */
+        BILL, 
+        /**
+         * A contact for an organization for administrative purposes. Contact role specifies a person acting as a liason for the organization.
+
+                        Example: HR Department representative.
+         */
+        ORG, 
+        /**
+         * A contact role used to identify a person within a Payor organization to whom this communication is addressed.
+         */
+        PAYOR, 
+        /**
+         * A contact designated for contact in emergent situations.
+         */
+        ECON, 
+        /**
+         * Played by an individual who is designated as the next of kin for another individual which scopes the role.
+         */
+        NOK, 
+        /**
+         * Definition: A code representing the type of identifier that has been assigned to the identified entity (IDENT).
+
+                        
+                           Examples: Example values include Social Insurance Number, Product Catalog ID, Product Model Number.
+         */
+        _IDENTIFIEDENTITYTYPE, 
+        /**
+         * Description:Describes types of identifiers other than the primary location registry identifier for a service delivery location.  Identifiers may be assigned by a local service delivery organization, a formal body capable of accrediting the location for the capability to provide specific services or the identifier may be assigned at a jurisdictional level.
+         */
+        _LOCATIONIDENTIFIEDENTITYROLECODE, 
+        /**
+         * Description:Identifier assigned to a  location by the organization responsible for accrediting the location.
+         */
+        ACHFID, 
+        /**
+         * Description:Identifier assigned to a location by a jurisdiction.
+         */
+        JURID, 
+        /**
+         * Description:Identifier assigned to a  location by a local party (which could be the facility itself or organization overseeing a group of facilities).
+         */
+        LOCHFID, 
+        /**
+         * Code indicating the primary use for which a living subject is bred or grown
+         */
+        _LIVINGSUBJECTPRODUCTIONCLASS, 
+        /**
+         * Cattle used for meat production
+         */
+        BF, 
+        /**
+         * Chickens raised for meat
+         */
+        BL, 
+        /**
+         * Breeding/genetic stock
+         */
+        BR, 
+        /**
+         * Companion animals
+         */
+        CO, 
+        /**
+         * Milk production
+         */
+        DA, 
+        /**
+         * Draft animals
+         */
+        DR, 
+        /**
+         * Dual purpose.  Defined purposes based on species and breed
+         */
+        DU, 
+        /**
+         * Animals raised for their fur, hair or skins
+         */
+        FI, 
+        /**
+         * Chickens raised for egg production
+         */
+        LY, 
+        /**
+         * Animals raised for meat production
+         */
+        MT, 
+        /**
+         * Poultry flocks used for chick/poult production
+         */
+        MU, 
+        /**
+         * Animals rasied for recreation
+         */
+        PL, 
+        /**
+         * Animals raised for racing perfomance
+         */
+        RC, 
+        /**
+         * Animals raised for shows
+         */
+        SH, 
+        /**
+         * Cattle raised for veal meat production.  Implicit is the husbandry method.
+         */
+        VL, 
+        /**
+         * Sheep, goats and other mammals raised for their fiber
+         */
+        WL, 
+        /**
+         * Animals used to perform work
+         */
+        WO, 
+        /**
+         * Identifies the specific hierarchical relationship between the playing and scoping medications. 
+
+                        
+                           Examples: Generic, Generic Formulation, Therapeutic Class, etc.
+         */
+        _MEDICATIONGENERALIZATIONROLETYPE, 
+        /**
+         * Description:A categorization of medicinal products by their therapeutic properties and/or main therapeutic use.
+         */
+        DC, 
+        /**
+         * Relates a manufactured drug product to the non-proprietary (generic) representation of its ingredients independent of strength, and form.
+
+                        The scoping entity identifies a unique combination of medicine ingredients; sometimes referred to as "ingredient set".
+         */
+        GD, 
+        /**
+         * Relates a manufactured drug product to the non-proprietary (generic) representation of its ingredients and dose form, independent of strength of the ingredients. The scoping entity identifies a unique combination of medicine ingredients in a specific dose form.
+         */
+        GDF, 
+        /**
+         * Relates a manufactured drug product to the non-proprietary (generic) representation of is ingredients with their strength.  The scoping entity identifies a unique combination of medicine ingredients with their strength.
+         */
+        GDS, 
+        /**
+         * Relates a manufactured drug product to the non-proprietary (generic) representation of its ingredients with their strength in a specific dose form. The scoping entity identifies a unique combination of medicine ingredients with their strength in a single dose form.
+         */
+        GDSF, 
+        /**
+         * Relates a manufactured drug product to the non-proprietary (generic) representation of its ingredients with their strength in a specific dose form. The scoping entity identifies a unique combination of medicine ingredients with their strength in a single dose form.
+         */
+        MGDSF, 
+        /**
+         * Types of membership for Role code "MBR"
+         */
+        _MEMBERROLETYPE, 
+        /**
+         * A person who is a member of a tribe.
+         */
+        TRB, 
+        /**
+         * PersonalRelationshipRoleType
+         */
+        _PERSONALRELATIONSHIPROLETYPE, 
+        /**
+         * A relationship between two people characterizing their "familial" relationship
+         */
+        FAMMEMB, 
+        /**
+         * The player of the role is a child of the scoping entity.
+         */
+        CHILD, 
+        /**
+         * The player of the role is a child taken into a family through legal means and raised by the scoping person (parent) as his or her own child.
+         */
+        CHLDADOPT, 
+        /**
+         * The player of the role is a female child taken into a family through legal means and raised by the scoping person (parent) as his or her own child.
+         */
+        DAUADOPT, 
+        /**
+         * The player of the role is a male child taken into a family through legal means and raised by the scoping person (parent) as his or her own child.
+         */
+        SONADOPT, 
+        /**
+         * The player of the role is a child receiving parental care and nurture from the scoping person (parent) but not related to him or her through legal or blood ties.
+         */
+        CHLDFOST, 
+        /**
+         * The player of the role is a female child receiving parental care and nurture from the scoping person (parent) but not related to him or her through legal or blood ties.
+         */
+        DAUFOST, 
+        /**
+         * The player of the role is a male child receiving parental care and nurture from the scoping person (parent) but not related to him or her through legal or blood ties.
+         */
+        SONFOST, 
+        /**
+         * Description: The player of the role is a female child (of any type) of scoping entity (parent)
+         */
+        DAUC, 
+        /**
+         * The player of the role is a female offspring of the scoping entity (parent).
+         */
+        DAU, 
+        /**
+         * The player of the role is a daughter of the scoping person's spouse by a previous union.
+         */
+        STPDAU, 
+        /**
+         * The player of the role is an offspring of the scoping entity as determined by birth.
+         */
+        NCHILD, 
+        /**
+         * The player of the role is a male offspring of the scoping entity (parent).
+         */
+        SON, 
+        /**
+         * Description: The player of the role is a male child (of any type) of scoping entity (parent)
+         */
+        SONC, 
+        /**
+         * The player of the role is a son of the scoping person's spouse by a previous union.
+         */
+        STPSON, 
+        /**
+         * The player of the role is a child of the scoping person's spouse by a previous union.
+         */
+        STPCHLD, 
+        /**
+         * Description: A family member not having an immediate genetic or legal relationship e.g. Aunt, cousin, great grandparent, grandchild, grandparent, niece, nephew or uncle.
+         */
+        EXT, 
+        /**
+         * The player of the role is a sister of the scoping person's mother or father.
+         */
+        AUNT, 
+        /**
+         * Description:The player of the role is a biological sister of the scoping person's biological mother.
+         */
+        MAUNT, 
+        /**
+         * Description:The player of the role is a biological sister of the scoping person's biological father.
+         */
+        PAUNT, 
+        /**
+         * The player of the role is a relative of the scoping person descended from a common ancestor, such as a 	grandparent, by two or more steps in a diverging line.
+         */
+        COUSN, 
+        /**
+         * Description:The player of the role is a biological relative of the scoping person descended from a common ancestor on the player's mother's side, such as a grandparent, by two or more steps in a diverging line.
+         */
+        MCOUSN, 
+        /**
+         * Description:The player of the role is a biological relative of the scoping person descended from a common ancestor on the player's father's side, such as a grandparent, by two or more steps in a diverging line.
+         */
+        PCOUSN, 
+        /**
+         * The player of the role is a parent of the scoping person's grandparent.
+         */
+        GGRPRN, 
+        /**
+         * The player of the role is the father of the scoping person's grandparent.
+         */
+        GGRFTH, 
+        /**
+         * Description:The player of the role is the biological father of the scoping person's biological mother's parent.
+         */
+        MGGRFTH, 
+        /**
+         * Description:The player of the role is the biological father of the scoping person's biological father's parent.
+         */
+        PGGRFTH, 
+        /**
+         * The player of the role is the mother of the scoping person's grandparent.
+         */
+        GGRMTH, 
+        /**
+         * Description:The player of the role is the biological mother of the scoping person's biological mother's parent.
+         */
+        MGGRMTH, 
+        /**
+         * Description:The player of the role is the biological mother of the scoping person's biological father's parent.
+         */
+        PGGRMTH, 
+        /**
+         * Description:The player of the role is a biological parent of the scoping person's biological mother's parent.
+         */
+        MGGRPRN, 
+        /**
+         * Description:The player of the role is a biological parent of the scoping person's biological father's parent.
+         */
+        PGGRPRN, 
+        /**
+         * The player of the role is a child of the scoping person's son or daughter.
+         */
+        GRNDCHILD, 
+        /**
+         * The player of the role is a daughter of the scoping person's son or daughter.
+         */
+        GRNDDAU, 
+        /**
+         * The player of the role is a son of the scoping person's son or daughter.
+         */
+        GRNDSON, 
+        /**
+         * The player of the role is a parent of the scoping person's mother or father.
+         */
+        GRPRN, 
+        /**
+         * The player of the role is the father of the scoping person's mother or father.
+         */
+        GRFTH, 
+        /**
+         * Description:The player of the role is the biological father of the scoping person's biological mother.
+         */
+        MGRFTH, 
+        /**
+         * Description:The player of the role is the biological father of the scoping person's biological father.
+         */
+        PGRFTH, 
+        /**
+         * The player of the role is the mother of the scoping person's mother or father.
+         */
+        GRMTH, 
+        /**
+         * Description:The player of the role is the biological mother of the scoping person's biological mother.
+         */
+        MGRMTH, 
+        /**
+         * Description:The player of the role is the biological mother of the scoping person's biological father.
+         */
+        PGRMTH, 
+        /**
+         * Description:The player of the role is the biological parent of the scoping person's biological mother.
+         */
+        MGRPRN, 
+        /**
+         * Description:The player of the role is the biological parent of the scoping person's biological father.
+         */
+        PGRPRN, 
+        /**
+         * A relationship between an individual and a member of their spousal partner's immediate family.
+         */
+        INLAW, 
+        /**
+         * The player of the role is the spouse of scoping person's child.
+         */
+        CHLDINLAW, 
+        /**
+         * The player of the role is the wife of scoping person's son.
+         */
+        DAUINLAW, 
+        /**
+         * The player of the role is the husband of scoping person's daughter.
+         */
+        SONINLAW, 
+        /**
+         * The player of the role is the parent of scoping person's husband or wife.
+         */
+        PRNINLAW, 
+        /**
+         * The player of the role is the father of the scoping person's husband or wife.
+         */
+        FTHINLAW, 
+        /**
+         * The player of the role is the mother of the scoping person's husband or wife.
+         */
+        MTHINLAW, 
+        /**
+         * The player of the role is: (1) a sibling of the scoping person's spouse, or (2) the spouse of the scoping person's sibling, or (3) the spouse of a sibling of the scoping person's spouse.
+         */
+        SIBINLAW, 
+        /**
+         * The player of the role is: (1) a brother of the scoping person's spouse, or (2) the husband of the scoping person's sister, or (3) the husband of a sister of the scoping person's spouse.
+         */
+        BROINLAW, 
+        /**
+         * The player of the role is: (1) a sister of the scoping person's spouse, or (2) the wife of the scoping person's brother, or (3) the wife of a brother of the scoping person's spouse.
+         */
+        SISINLAW, 
+        /**
+         * The player of the role is a child of scoping person's brother or sister or of the brother or sister of the 	scoping person's spouse.
+         */
+        NIENEPH, 
+        /**
+         * The player of the role is a son of the scoping person's brother or sister or of the brother or sister of the 	scoping person's spouse.
+         */
+        NEPHEW, 
+        /**
+         * The player of the role is a daughter of the scoping person's brother or sister or of the brother or sister of the 	scoping person's spouse.
+         */
+        NIECE, 
+        /**
+         * The player of the role is a brother of the scoping person's mother or father.
+         */
+        UNCLE, 
+        /**
+         * Description:The player of the role is a biological brother of the scoping person's biological mother.
+         */
+        MUNCLE, 
+        /**
+         * Description:The player of the role is a biological brother of the scoping person's biological father.
+         */
+        PUNCLE, 
+        /**
+         * The player of the role is one who begets, gives birth to, or nurtures and raises the scoping entity (child).
+         */
+        PRN, 
+        /**
+         * The player of the role (parent) has taken the scoper (child) into their family through legal means and raises them as his or her own child.
+         */
+        ADOPTP, 
+        /**
+         * The player of the role (father) is a male who has taken the scoper (child) into their family through legal means and raises them as his own child.
+         */
+        ADOPTF, 
+        /**
+         * The player of the role (father) is a female who has taken the scoper (child) into their family through legal means and raises them as her own child.
+         */
+        ADOPTM, 
+        /**
+         * The player of the role is a male who begets or raises or nurtures the scoping entity (child).
+         */
+        FTH, 
+        /**
+         * The player of the role (parent) who is a male state-certified caregiver responsible for the scoper (child) who has been placed in the parent's care. The placement of the child is usually arranged through the government or a social-service agency, and temporary.
+
+                        The state, via a jurisdiction recognized child protection agency, stands as in loco parentis to the child, making all legal decisions while the foster parent is responsible for the day-to-day care of the specified child.
+         */
+        FTHFOST, 
+        /**
+         * The player of the role is a male who begets the scoping entity (child).
+         */
+        NFTH, 
+        /**
+         * Indicates the biologic male parent of a fetus.
+         */
+        NFTHF, 
+        /**
+         * The player of the role is the husband of scoping person's mother and not the scoping person's natural father.
+         */
+        STPFTH, 
+        /**
+         * The player of the role is a female who conceives, gives birth to, or raises and nurtures the scoping entity (child).
+         */
+        MTH, 
+        /**
+         * The player is a female whose womb carries the fetus of the scoper.  Generally used when the gestational mother and natural mother are not the same.
+         */
+        GESTM, 
+        /**
+         * The player of the role (parent) who is a female state-certified caregiver responsible for the scoper (child) who has been placed in the parent's care. The placement of the child is usually arranged through the government or a social-service agency, and temporary.
+
+                        The state, via a jurisdiction recognized child protection agency, stands as in loco parentis to the child, making all legal decisions while the foster parent is responsible for the day-to-day care of the specified child.
+         */
+        MTHFOST, 
+        /**
+         * The player of the role is a female who conceives or gives birth to the scoping entity (child).
+         */
+        NMTH, 
+        /**
+         * The player is the biologic female parent of the scoping fetus.
+         */
+        NMTHF, 
+        /**
+         * The player of the role is the wife of scoping person's father and not the scoping person's natural mother.
+         */
+        STPMTH, 
+        /**
+         * natural parent
+         */
+        NPRN, 
+        /**
+         * The player of the role (parent) who is a state-certified caregiver responsible for the scoper (child) who has been placed in the parent's care. The placement of the child is usually arranged through the government or a social-service agency, and temporary.
+
+                        The state, via a jurisdiction recognized child protection agency, stands as in loco parentis to the child, making all legal decisions while the foster parent is responsible for the day-to-day care of the specified child.
+         */
+        PRNFOST, 
+        /**
+         * The player of the role is the spouse of the scoping person's parent and not the scoping person's natural parent.
+         */
+        STPPRN, 
+        /**
+         * The player of the role shares one or both parents in common with the scoping entity.
+         */
+        SIB, 
+        /**
+         * The player of the role is a male sharing one or both parents in common with the scoping entity.
+         */
+        BRO, 
+        /**
+         * The player of the role is a male related to the scoping entity by sharing only one biological parent.
+         */
+        HBRO, 
+        /**
+         * The player of the role is a male having the same biological parents as the scoping entity.
+         */
+        NBRO, 
+        /**
+         * The scoper was carried in the same womb as the male player and shares common biological parents.
+         */
+        TWINBRO, 
+        /**
+         * The scoper was carried in the same womb as the male player and shares common biological parents but is the product of a distinct egg/sperm pair.
+         */
+        FTWINBRO, 
+        /**
+         * The male scoper is an offspring of the same egg-sperm pair as the male player.
+         */
+        ITWINBRO, 
+        /**
+         * The player of the role is a son of the scoping person's stepparent.
+         */
+        STPBRO, 
+        /**
+         * The player of the role is related to the scoping entity by sharing only one biological parent.
+         */
+        HSIB, 
+        /**
+         * The player of the role is a female related to the scoping entity by sharing only one biological parent.
+         */
+        HSIS, 
+        /**
+         * The player of the role has both biological parents in common with the scoping entity.
+         */
+        NSIB, 
+        /**
+         * The player of the role is a female having the same biological parents as the scoping entity.
+         */
+        NSIS, 
+        /**
+         * The scoper was carried in the same womb as the female player and shares common biological parents.
+         */
+        TWINSIS, 
+        /**
+         * The scoper was carried in the same womb as the female player and shares common biological parents but is the product of a distinct egg/sperm pair.
+         */
+        FTWINSIS, 
+        /**
+         * The female scoper is an offspring of the same egg-sperm pair as the female player.
+         */
+        ITWINSIS, 
+        /**
+         * The scoper and player were carried in the same womb and shared common biological parents.
+         */
+        TWIN, 
+        /**
+         * The scoper and player were carried in the same womb and share common biological parents but are the product of distinct egg/sperm pairs.
+         */
+        FTWIN, 
+        /**
+         * The scoper and player are offspring of the same egg-sperm pair.
+         */
+        ITWIN, 
+        /**
+         * The player of the role is a female sharing one or both parents in common with the scoping entity.
+         */
+        SIS, 
+        /**
+         * The player of the role is a daughter of the scoping person's stepparent.
+         */
+        STPSIS, 
+        /**
+         * The player of the role is a child of the scoping person's stepparent.
+         */
+        STPSIB, 
+        /**
+         * A person who is important to one's well being; especially a spouse or one in a similar relationship.  (The player is the one who is important)
+         */
+        SIGOTHR, 
+        /**
+         * The player of the role cohabits with the scoping person but is not the scoping person's spouse.
+         */
+        DOMPART, 
+        /**
+         * Player of the role was previously joined to the scoping person in marriage and this marriage is now dissolved and inactive.
+
+                        
+                           Usage Note: This is significant to indicate as some jurisdictions have different legal requirements for former spouse to access the patient's record, from a general friend.
+         */
+        FMRSPS, 
+        /**
+         * The player of the role is a marriage partner of the scoping person.
+         */
+        SPS, 
+        /**
+         * The player of the role is a man joined to a woman (scoping person) in marriage.
+         */
+        HUSB, 
+        /**
+         * The player of the role is a woman joined to a man (scoping person) in marriage.
+         */
+        WIFE, 
+        /**
+         * The player of the role is a person who is known, liked, and trusted by the scoping person.
+         */
+        FRND, 
+        /**
+         * The player of the role lives near or next to the 	scoping person.
+         */
+        NBOR, 
+        /**
+         * The relationship that a person has with his or her self.
+         */
+        ONESELF, 
+        /**
+         * One who shares living quarters with the subject.
+         */
+        ROOM, 
+        /**
+         * Description: A role recognized through the eligibility of an identified party for benefits covered under an insurance policy or a program based on meeting eligibility criteria.
+
+                        Eligibility as a covered party may be conditioned on the party meeting criteria to qualify for coverage under a policy or program, which may be mandated by law.  These criteria may be: 
+
+                        
+                           
+                              The sole basis for coverage, e.g., being differently abled may qualify a person for disability coverage
+
+                           
+                           
+                              May more fully qualify a covered party role e.g, being differently abled may qualify an adult child as a dependent
+
+                           
+                           
+                              May impact the level of coverage for a covered party under a policy or program, e.g., being differently abled may qualify a program eligible for additional benefits.
+
+                           
+                        
+                        
+                           Discussion:  The Abstract Value Set "CoverageRoleType", which was developed for use in the Canadian realm "pre-coordinate" coverage roles with other roles that a covered party must play in order to be eligible for coverage, e.g., "handicapped dependent".   These role.codes may only be used with COVPTY to avoid overlapping concepts that would result from using them to specify the specializations of COVPTY, e.g., the role.class DEPEN should not be used with the role.code family dependent because that relationship has overlapping concepts due to the role.code precoodination and is conveyed in FICO with the personal relationship role that has a PART role link to the covered party role.  For the same reasons, the role.class DEPEN should not be used with the role.code HANDIC (handicapped dependent); the role.code DIFFABLE (differently abled) should be used instead.
+
+                        In summary, the coded concepts in the Abstract Value Set "CoveredPartyRoleType" can be "post-coordinated" with the "RoleClassCoveredParty" Abstract Value Set.  Decoupling these concepts is intended to support an expansive range of covered party concepts and their semantic comparability.
+         */
+        _POLICYORPROGRAMCOVERAGEROLETYPE, 
+        /**
+         * Role recognized through the issuance of insurance coverage to an identified covered party who has this relationship with the policy holder such as the policy holder themselves (self), spouse, child, etc
+         */
+        _COVERAGEROLETYPE, 
+        /**
+         * The player of the role is dependent of the scoping entity.
+         */
+        FAMDEP, 
+        /**
+         * Covered party is a dependent of the policy holder with a physical or mental disability causing a disadvantage that makes independent achievement unusually difficult.
+         */
+        HANDIC, 
+        /**
+         * Covered party is an injured party with a legal claim for compensation against a policy holder under an insurance policy.
+         */
+        INJ, 
+        /**
+         * Covered party is the policy holder.  Also known as the subscriber.
+         */
+        SELF, 
+        /**
+         * Covered party is an individual that the policy holder has assumed responsibility for, such as foster child or legal ward.
+         */
+        SPON, 
+        /**
+         * Covered party to an insurance policy has coverage through full-time or part-time attendance at a recognized educational institution as defined by a particular insurance policy.
+         */
+        STUD, 
+        /**
+         * Covered party to an insurance policy has coverage through full-time attendance at a recognized educational institution as defined by a particular insurance policy.
+         */
+        FSTUD, 
+        /**
+         * Covered party to an insurance policy has coverage through part-time attendance at a recognized educational institution as defined by a particular insurance policy.
+         */
+        PSTUD, 
+        /**
+         * A child taken into one's family through legal means and raised as one's own child.
+         */
+        ADOPT, 
+        /**
+         * A child of one's son or daughter.
+         */
+        GCHILD, 
+        /**
+         * parent of a parent of the subject.
+         */
+        GPARNT, 
+        /**
+         * A child as determined by birth.
+         */
+        NAT, 
+        /**
+         * A child of one's brother or sister or of the brother or sister of one's spouse.
+         */
+        NIENE, 
+        /**
+         * One that begets or brings forth offspring or a person who brings up and cares for for another (Webster's Collegiate Dictionary)
+         */
+        PARNT, 
+        /**
+         * A marriage partner; a husband or wife.
+         */
+        SPSE, 
+        /**
+         * A child receiving parental care and nurture from a person who is related to them through marriage to their parent.
+         */
+        STEP, 
+        /**
+         * A role recognized through the eligibility of an identified living subject for benefits covered under an insurance policy or a program.  Eligibility as a covered party may be conditioned on a relationship with (1) the policy holder such as the policy holder who is covered as an individual under a poliy or as a party sponsored for coverage by the policy holder.
+
+                        
+                           Example:An employee as a subscriber; or (2) on being scoped another covered party such as the subscriber, as in the case of a dependent. 
+
+                        
+                           Discussion:  The Abstract Value Set "CoverageRoleType", which was developed for use in the Canadian realm "pre-coordinate" coverage roles with other roles that a covered party must play in order to be eligible for coverage, e.g., "handicapped dependent".  Other codes in the Abstract Value Set CoveredPartyRoleType domain can be "post-coordinated" with the EligiblePartyRoleType codes to denote comparable concepts.  Decoupling the concepts is intended to support a wider range of concepts and semantic comparability of coded concepts.
+         */
+        _COVEREDPARTYROLETYPE, 
+        /**
+         * DescriptionA role recognized through the eligibility of a party play a claimant for benefits covered or provided under an insurance policy.
+         */
+        _CLAIMANTCOVEREDPARTYROLETYPE, 
+        /**
+         * Description: A person playing the role of program eligible under a program based on allegations of being the victim of a crime.
+
+                        
+                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is "program eligible" and the person's status as a crime victim meets jurisdictional or program criteria.
+         */
+        CRIMEVIC, 
+        /**
+         * Description: A person playing the role of program eligible under a workers compensation program based on the filing of work-related injury claim.
+
+                        
+                           Discussion:  This CoveredPartyRoleType.code is used when the CoveredPartyRole class code is either "program eligible", a "named insured", and "individual insured",  or "dependent", and the person's status as differently abled or "handicapped" meets jurisdictional, policy, or program criteria.
+         */
+        INJWKR, 
+        /**
+         * Description: A role recognized through the eligibility of a party to play a dependent for benefits covered or provided under a health insurance policy because of an association with the subscriber that is recognized by the policy underwriter.
+         */
+        _DEPENDENTCOVEREDPARTYROLETYPE, 
+        /**
+         * Description: A person playing the role of an individual insured with continuity of coverage under a policy which is being terminated based on loss of original status that was the basis for coverage.  Criteria for qualifying for continuity of coverage may be set by law.
+
+                        
+                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either "program eligible" or "subscriber" and the person's status as a continuity of coverage beneficiary meets jurisdictional or policy criteria.
+         */
+        COCBEN, 
+        /**
+         * Description: A person playing the role of program eligible under a program based on meeting criteria for health or functional limitation set by law or by the program.
+
+                        
+                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either "program eligible", "named insured", "individual insured", or "dependent", and the person's status as differently abled meets jurisdictional, policy, or program criteria.
+         */
+        DIFFABL, 
+        /**
+         * Description: A person, who is a minor or is deemed incompetent, who plays the role of a program eligible where eligibility for coverage is based on meeting program eligibility criteria for status as a ward of a court or jurisdiction.
+
+                        
+                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is a "claimant", "program eligible", a "named insured", an "individual Insured" or a "dependent", and the person's status as a ward meets program or policy criteria. In the case of a ward covered under a program providing financial or health benefits, a governmental agency may take temporary custody of a minor or incompetent for his/her protection and care, e.g., if the ward is suffering from neglect or abuse, or has been in trouble with the law.
+         */
+        WARD, 
+        /**
+         * A role recognized through the eligibility of a party to play an individual insured for benefits covered or provided under an insurance policy where the party is also the policy holder.
+         */
+        _INDIVIDUALINSUREDPARTYROLETYPE, 
+        /**
+         * Description: A person playing the role of an individual insured under a policy based on meeting criteria for the employment status of retired set by law or the policy.
+
+                        
+                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either "program eligible" or "subscriber" and the person's status as a retiree meets jurisdictional or policy criteria.
+         */
+        RETIREE, 
+        /**
+         * Description:A role recognized through the eligibility of a party to play a program eligible for benefits covered or provided under a program.
+         */
+        _PROGRAMELIGIBLEPARTYROLETYPE, 
+        /**
+         * Description: A person playing the role of program eligible under a program based on aboriginal ancestry or as a member of an aboriginal community.
+
+                        
+                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is "program eligible" and the person's status as a member of an indigenous people meets jurisdictional or program criteria.
+         */
+        INDIG, 
+        /**
+         * Definition: A person playing the role of program eligible under a program based on military status.
+
+                        
+                           Discussion:  This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either "program eligible" or "subscriber" and the person's status as a member of the military meets jurisdictional or program criteria
+         */
+        MIL, 
+        /**
+         * Description: A person playing the role of program eligible under a program based on active military status.
+
+                        
+                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either "program eligible" or "subscriber" and the persons status as active duty military meets jurisdictional or program criteria.
+         */
+        ACTMIL, 
+        /**
+         * Description: A person playing the role of program eligible under a program based on retired military status.
+
+                        
+                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either "program eligible" or "subscriber" and the persons status as retired military meets jurisdictional or program criteria.
+         */
+        RETMIL, 
+        /**
+         * Description: A person playing the role of program eligible under a program based on status as a military veteran.
+
+                        
+                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either "program eligible" or "subscriber" and the persons status as a veteran meets jurisdictional or program criteria.
+         */
+        VET, 
+        /**
+         * Description: A role recognized through the eligibility of a party to play a subscriber for benefits covered or provided under a health insurance policy.
+         */
+        _SUBSCRIBERCOVEREDPARTYROLETYPE, 
+        /**
+         * Specifies the administrative functionality within a formal experimental design for which the ResearchSubject role was established.  Examples: screening - role is used for pre-enrollment evaluation portion of the design; enrolled - role is used for subjects admitted to the active treatment portion of the design.
+         */
+        _RESEARCHSUBJECTROLEBASIS, 
+        /**
+         * Definition:The specific role being played by a research subject participating in the active treatment or primary data collection portion of a research study.
+         */
+        ERL, 
+        /**
+         * Definition:The specific role being played by a research subject participating in the pre-enrollment evaluation portion of  a research study.
+         */
+        SCN, 
+        /**
+         * A role of a place that further classifies the setting (e.g., accident site, road side, work site, community location) in which services are delivered.
+         */
+        _SERVICEDELIVERYLOCATIONROLETYPE, 
+        /**
+         * A role of a place that further classifies a setting that is intended to house the provision of services.
+         */
+        _DEDICATEDSERVICEDELIVERYLOCATIONROLETYPE, 
+        /**
+         * A role of a place that further classifies the clinical setting (e.g., cardiology clinic, primary care clinic, rehabilitation hospital, skilled nursing facility) in which care is delivered during an encounter.
+         */
+        _DEDICATEDCLINICALLOCATIONROLETYPE, 
+        /**
+         * A practice setting where diagnostic procedures or therapeutic interventions are performed
+         */
+        DX, 
+        /**
+         * A practice setting where cardiovascular diagnostic procedures or therapeutic interventions are performed (e.g., cardiac catheterization lab, echocardiography suite)
+         */
+        CVDX, 
+        /**
+         * Cardiac catheterization lab
+         */
+        CATH, 
+        /**
+         * Echocardiography lab
+         */
+        ECHO, 
+        /**
+         * A practice setting where GI procedures (such as endoscopies) are performed
+         */
+        GIDX, 
+        /**
+         * (X12N 261QD0000N)
+         */
+        ENDOS, 
+        /**
+         * A practice setting where radiology services (diagnostic or therapeutic) are provided            (X12N 261QR0200N)
+         */
+        RADDX, 
+        /**
+         * (X12N 261QX0203N)
+         */
+        RADO, 
+        /**
+         * Neuroradiology unit
+         */
+        RNEU, 
+        /**
+         * An acute care institution that provides medical, surgical, or psychiatric care and treatment for the sick or the injured.
+         */
+        HOSP, 
+        /**
+         * (1) A hospital including a physical plant and personnel that provides multidisciplinary diagnosis and treatment for diseases that have one or more of the following characteristics: is permanent; leaves residual disability; is caused by nonreversible pathological alteration; requires special training of the patient for rehabilitation; and/or may be expected to require a long period of supervision or care. In addition, patients require the safety, security, and shelter of these specialized inpatient or partial hospitalization settings. (2) A hospital that provides medical and skilled nursing services to patients with long-term illnesses who are not in an acute phase but who require an intensity of services not available in nursing homes
+         */
+        CHR, 
+        /**
+         * (X12N 282N00000N)
+         */
+        GACH, 
+        /**
+         * A health care facility operated by the Department of Defense or other military operation.
+         */
+        MHSP, 
+        /**
+         * Healthcare facility that cares for patients with psychiatric illness(s).
+         */
+        PSYCHF, 
+        /**
+         * (X12N 283X00000N)
+         */
+        RH, 
+        /**
+         * Description: A location that plays the role of delivering services which may include life training and/or social support to people with addictions.
+         */
+        RHAT, 
+        /**
+         * Description: A location that plays the role of delivering services which may include adaptation, rehabilitation and social integration services for people with intellectual and/or pervasive development disorders such as autism or severe behaviour disorder.
+         */
+        RHII, 
+        /**
+         * Description: A location that plays the role of delivering services which may social support services for adolescents who are pregnant or have child and are experiencing adaptation issues/difficulties in their current or eventual parenting role.
+         */
+        RHMAD, 
+        /**
+         * Description: A location that plays the role of delivering services which may include adaptation, rehabilitation and social integration services for people with physical impairments.
+         */
+        RHPI, 
+        /**
+         * Description: A location that plays the role of delivering services for people with hearing impairments.
+         */
+        RHPIH, 
+        /**
+         * Description: A location that plays the role of delivering services for people with motor skill impairments.
+         */
+        RHPIMS, 
+        /**
+         * Description: A location that plays the role of delivering services for people with visual skill impairments.
+         */
+        RHPIVS, 
+        /**
+         * Description: A location that plays the role of delivering services which may include life training and/or social support services for the adaption, rehabilitation and social integration of youths with adjustment difficulties.
+         */
+        RHYAD, 
+        /**
+         * Hospital unit
+         */
+        HU, 
+        /**
+         * Bone marrow transplant unit
+         */
+        BMTU, 
+        /**
+         * Coronary care unit
+         */
+        CCU, 
+        /**
+         * A specialty unit in hospital that focuses on chronic respirator patients and pulmonary failure
+         */
+        CHEST, 
+        /**
+         * Epilepsy unit
+         */
+        EPIL, 
+        /**
+         * The section of a health care facility for providing rapid treatment to victims of sudden illness or trauma.
+         */
+        ER, 
+        /**
+         * Emergency trauma unit
+         */
+        ETU, 
+        /**
+         * Hemodialysis unit
+         */
+        HD, 
+        /**
+         * Description: A location that plays the role of delivering services which may include tests done based on clinical specimens to get health information about a patient as pertaining to the diagnosis, treatment and prevention of disease.  Hospital laboratories may be further divided into specialized units such as Anatomic Pathology, Microbiology, and Biochemistry.
+         */
+        HLAB, 
+        /**
+         * Description: A location that plays the role of delivering services which may include tests are done on clinical specimens to get health information about a patient pertaining to the diagnosis, treatment, and prevention of disease for a hospital visit longer than one day.
+         */
+        INLAB, 
+        /**
+         * Description: A location that plays the role of delivering services which may include tests are done on clinical specimens to get health information about a patient pertaining to the diagnosis, treatment, and prevention of disease for same day visits.
+         */
+        OUTLAB, 
+        /**
+         * Description: A location that plays the role of delivering services which may include the branch of medicine that uses ionizing and non-ionizing radiation to diagnose and treat diseases.  The radiology unit may be further divided into subspecialties such as Imaging, Cardiovascular, Thoracic, and Ultrasound.
+         */
+        HRAD, 
+        /**
+         * Description: A location that plays the role of delivering services which may include collecting specimens and/or samples from patients for laboratory testing purposes, but does not perform any tests or analysis functions.
+         */
+        HUSCS, 
+        /**
+         * Intensive care unit
+         */
+        ICU, 
+        /**
+         * Pediatric intensive care unit
+         */
+        PEDICU, 
+        /**
+         * Pediatric neonatal intensive care unit
+         */
+        PEDNICU, 
+        /**
+         * Description: A location that plays the role of delivering services which may include providing judicious, safe, efficacious, appropriate and cost effective use of medicines for treatment of patients for visits longer than one day. The distinction between inpatient pharmacies and retail (or outpatient) pharmacies is that they are part of a patient's continuity of care while staying in the hospital.
+         */
+        INPHARM, 
+        /**
+         * Description: A location that plays the role of delivering services which include biochemistry, hematology, microbiology, immunochemistry, and toxicology.
+         */
+        MBL, 
+        /**
+         * Neurology critical care and stroke unit
+         */
+        NCCS, 
+        /**
+         * Neurosurgery unit
+         */
+        NS, 
+        /**
+         * Description: A location that plays the role of delivering services which may include providing judicious, safe, efficacious, appropriate and cost effective use of medicines for treatment of patients for outpatient visits and may also be used for discharge prescriptions.
+         */
+        OUTPHARM, 
+        /**
+         * Pediatric unit
+         */
+        PEDU, 
+        /**
+         * (X12N 273R00000N)
+         */
+        PHU, 
+        /**
+         * Rehabilitation hospital unit
+         */
+        RHU, 
+        /**
+         * (X12N 261QA1200N)
+         */
+        SLEEP, 
+        /**
+         * Nursing or custodial care facility
+         */
+        NCCF, 
+        /**
+         * (X12N 314000000N)
+         */
+        SNF, 
+        /**
+         * Outpatient facility
+         */
+        OF, 
+        /**
+         * Allergy clinic
+         */
+        ALL, 
+        /**
+         * Amputee clinic
+         */
+        AMPUT, 
+        /**
+         * Bone marrow transplant clinic
+         */
+        BMTC, 
+        /**
+         * Breast clinic
+         */
+        BREAST, 
+        /**
+         * Child and adolescent neurology clinic
+         */
+        CANC, 
+        /**
+         * Child and adolescent psychiatry clinic
+         */
+        CAPC, 
+        /**
+         * Ambulatory Health Care Facilities; Clinic/Center; Rehabilitation: Cardiac Facilities
+         */
+        CARD, 
+        /**
+         * Pediatric cardiology clinic
+         */
+        PEDCARD, 
+        /**
+         * Coagulation clinic
+         */
+        COAG, 
+        /**
+         * Colon and rectal surgery clinic
+         */
+        CRS, 
+        /**
+         * Dermatology clinic
+         */
+        DERM, 
+        /**
+         * Endocrinology clinic
+         */
+        ENDO, 
+        /**
+         * Pediatric endocrinology clinic
+         */
+        PEDE, 
+        /**
+         * Otorhinolaryngology clinic
+         */
+        ENT, 
+        /**
+         * Family medicine clinic
+         */
+        FMC, 
+        /**
+         * Gastroenterology clinic
+         */
+        GI, 
+        /**
+         * Pediatric gastroenterology clinic
+         */
+        PEDGI, 
+        /**
+         * General internal medicine clinic
+         */
+        GIM, 
+        /**
+         * Gynecology clinic
+         */
+        GYN, 
+        /**
+         * Hematology clinic
+         */
+        HEM, 
+        /**
+         * Pediatric hematology clinic
+         */
+        PEDHEM, 
+        /**
+         * Hypertension clinic
+         */
+        HTN, 
+        /**
+         * Focuses on assessing disability
+         */
+        IEC, 
+        /**
+         * Infectious disease clinic
+         */
+        INFD, 
+        /**
+         * Pediatric infectious disease clinic
+         */
+        PEDID, 
+        /**
+         * Infertility clinic
+         */
+        INV, 
+        /**
+         * Lympedema clinic
+         */
+        LYMPH, 
+        /**
+         * Medical genetics clinic
+         */
+        MGEN, 
+        /**
+         * Nephrology clinic
+         */
+        NEPH, 
+        /**
+         * Pediatric nephrology clinic
+         */
+        PEDNEPH, 
+        /**
+         * Neurology clinic
+         */
+        NEUR, 
+        /**
+         * Obstetrics clinic
+         */
+        OB, 
+        /**
+         * Oral and maxillofacial surgery clinic
+         */
+        OMS, 
+        /**
+         * Medical oncology clinic
+         */
+        ONCL, 
+        /**
+         * Pediatric oncology clinic
+         */
+        PEDHO, 
+        /**
+         * Opthalmology clinic
+         */
+        OPH, 
+        /**
+         * Description: A location that plays the role of delivering services which may include examination, diagnosis, treatment, management, and prevention of diseases and disorders of the eye as well as prescribing and fitting appropriate corrective lenses (glasses or contact lenses) as needed.  Optometry clinics may also provide tests for visual field screening, measuring intra-ocular pressure and ophthalmoscopy, as and when required.
+         */
+        OPTC, 
+        /**
+         * Orthopedics clinic
+         */
+        ORTHO, 
+        /**
+         * Hand clinic
+         */
+        HAND, 
+        /**
+         * (X12N 261QP3300N)
+         */
+        PAINCL, 
+        /**
+         * (X12N 261QP2300N)
+         */
+        PC, 
+        /**
+         * Pediatrics clinic
+         */
+        PEDC, 
+        /**
+         * Pediatric rheumatology clinic
+         */
+        PEDRHEUM, 
+        /**
+         * (X12N 261QP1100N)
+         */
+        POD, 
+        /**
+         * Preventive medicine clinic
+         */
+        PREV, 
+        /**
+         * Proctology clinic
+         */
+        PROCTO, 
+        /**
+         * Location where healthcare service was delivered, identified as the healthcare provider's practice office.
+         */
+        PROFF, 
+        /**
+         * Prosthodontics clinic
+         */
+        PROS, 
+        /**
+         * Psychology clinic
+         */
+        PSI, 
+        /**
+         * Psychiatry clinic
+         */
+        PSY, 
+        /**
+         * Rheumatology clinic
+         */
+        RHEUM, 
+        /**
+         * Sports medicine clinic
+         */
+        SPMED, 
+        /**
+         * Surgery clinic
+         */
+        SU, 
+        /**
+         * Plastic surgery clinic
+         */
+        PLS, 
+        /**
+         * Urology clinic
+         */
+        URO, 
+        /**
+         * Transplant clinic
+         */
+        TR, 
+        /**
+         * Travel and geographic medicine clinic
+         */
+        TRAVEL, 
+        /**
+         * Wound clinic
+         */
+        WND, 
+        /**
+         * Residential treatment facility
+         */
+        RTF, 
+        /**
+         * Pain rehabilitation center
+         */
+        PRC, 
+        /**
+         * (X12N 324500000N)
+         */
+        SURF, 
+        /**
+         * A role of a place that further classifies a setting that is intended to house the provision of non-clinical services.
+         */
+        _DEDICATEDNONCLINICALLOCATIONROLETYPE, 
+        /**
+         * Location address where medical supplies were transported to for use.
+         */
+        DADDR, 
+        /**
+         * Location (mobile) where healthcare service was delivered.
+         */
+        MOBL, 
+        /**
+         * Location (mobile) where healthcare service was delivered, identified specifically as an ambulance.
+         */
+        AMB, 
+        /**
+         * Location where healthcare service was delivered, identified as a pharmacy.
+         */
+        PHARM, 
+        /**
+         * IncidentalServiceDeliveryLocationRoleType
+         */
+        _INCIDENTALSERVICEDELIVERYLOCATIONROLETYPE, 
+        /**
+         * Location of an accident where healthcare service was delivered, such as a roadside.
+         */
+        ACC, 
+        /**
+         * Community location where healthcare is delivered.
+         */
+        COMM, 
+        /**
+         * Description: A location that plays the role of delivering services which may include providing front-line services to the population of a defined geographic area such as: healthcare services and social services, preventive or curative, rehabilitation or reintegration.
+         */
+        CSC, 
+        /**
+         * location where healthcare was delivered which is the residence of the Patient.
+         */
+        PTRES, 
+        /**
+         * Location where healthcare service was delivered, identified as a school or educational facility.
+         */
+        SCHOOL, 
+        /**
+         * Description: A location that plays the role of delivering services which may include: social emergency services required for a young person as required under any jurisdictional youth laws, child placement, and family mediation in the defined geographical area the SDL is responsible for. It may provide expertise in a judiciary setting on child custody, adoption and biological history research.
+         */
+        UPC, 
+        /**
+         * Location where healthcare service was delivered, identified as a work place.
+         */
+        WORK, 
+        /**
+         * SpecimenRoleType
+         */
+        _SPECIMENROLETYPE, 
+        /**
+         * A specimen used for initial calibration settings of an instrument
+         */
+        C, 
+        /**
+         * A set of patient samples in which the individuals of the group may or may not be identified.
+         */
+        G, 
+        /**
+         * Aliquots of individual specimens combined to form a single specimen representing all of the included individuals.
+         */
+        L, 
+        /**
+         * A specimen that has been collected from a patient.
+         */
+        P, 
+        /**
+         * A specimen specifically used to verify the sensitivity, specificity, accuracy or other perfomance parameter of a diagnostic test.
+         */
+        Q, 
+        /**
+         * Quality Control specimen submitted to the lab whose identity and composition is not known to the lab.
+         */
+        B, 
+        /**
+         * An electronically simulated QC specimen
+         */
+        E, 
+        /**
+         * Specimen used for testing proficiency of an organization performing testing (how does this differ from O?)
+         */
+        F, 
+        /**
+         * A specimen used for evaluation of operator proficiency (operator in what context?)
+         */
+        O, 
+        /**
+         * A specimen used for periodic calibration checks of instruments
+         */
+        V, 
+        /**
+         * A portion of an original patent sample that is tested at the same time as the original sample
+         */
+        R, 
+        /**
+         * A party that makes a claim for coverage under a policy.
+         */
+        CLAIM, 
+        /**
+         * Community Laboratory
+         */
+        COMMUNITYLABORATORY, 
+        /**
+         * An individual or organization that makes or gives a promise, assurance, pledge to pay or has paid the healthcare service provider.
+         */
+        GT, 
+        /**
+         * Home Health
+         */
+        HOMEHEALTH, 
+        /**
+         * Laboratory
+         */
+        LABORATORY, 
+        /**
+         * Pathologist
+         */
+        PATHOLOGIST, 
+        /**
+         * Policy holder for the insurance policy.
+         */
+        PH, 
+        /**
+         * Phlebotomist
+         */
+        PHLEBOTOMIST, 
+        /**
+         * A party that meets the eligibility criteria for coverage under a program.
+         */
+        PROG, 
+        /**
+         * The recipient for the service(s) and/or product(s) when they are not the covered party.
+         */
+        PT, 
+        /**
+         * Self
+         */
+        SUBJECT, 
+        /**
+         * Third Party
+         */
+        THIRDPARTY, 
+        /**
+         * null
+         */
+        DEP, 
+        /**
+         * A party covered under a policy based on association with a subscriber.
+         */
+        DEPEN, 
+        /**
+         * A member of the covered party's family. This could be the spouse, a parent, a grand parent, a sibling, etc.
+         */
+        FM, 
+        /**
+         * A party covered under a policy as the policyholder.
+         */
+        INDIV, 
+        /**
+         * A party to an insurance policy to whom the insurer agrees to indemnify for losses, provides benefits for, or renders services.
+         */
+        NAMED, 
+        /**
+         * null
+         */
+        PSYCHCF, 
+        /**
+         * A party covered under a policy based on association with a sponsor who is the policy holder, and whose association may provide for the eligibility of dependents for coverage
+         */
+        SUBSCR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3RoleCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_AffiliationRoleType".equals(codeString))
+          return _AFFILIATIONROLETYPE;
+        if ("_AgentRoleType".equals(codeString))
+          return _AGENTROLETYPE;
+        if ("AMENDER".equals(codeString))
+          return AMENDER;
+        if ("CLASSIFIER".equals(codeString))
+          return CLASSIFIER;
+        if ("CONSENTER".equals(codeString))
+          return CONSENTER;
+        if ("CONSWIT".equals(codeString))
+          return CONSWIT;
+        if ("COPART".equals(codeString))
+          return COPART;
+        if ("DECLASSIFIER".equals(codeString))
+          return DECLASSIFIER;
+        if ("DELEGATEE".equals(codeString))
+          return DELEGATEE;
+        if ("DELEGATOR".equals(codeString))
+          return DELEGATOR;
+        if ("DOWNGRDER".equals(codeString))
+          return DOWNGRDER;
+        if ("DRIVCLASSIFIER".equals(codeString))
+          return DRIVCLASSIFIER;
+        if ("GRANTEE".equals(codeString))
+          return GRANTEE;
+        if ("GRANTOR".equals(codeString))
+          return GRANTOR;
+        if ("INTPRTER".equals(codeString))
+          return INTPRTER;
+        if ("REVIEWER".equals(codeString))
+          return REVIEWER;
+        if ("VALIDATOR".equals(codeString))
+          return VALIDATOR;
+        if ("_CoverageSponsorRoleType".equals(codeString))
+          return _COVERAGESPONSORROLETYPE;
+        if ("FULLINS".equals(codeString))
+          return FULLINS;
+        if ("SELFINS".equals(codeString))
+          return SELFINS;
+        if ("_PayorRoleType".equals(codeString))
+          return _PAYORROLETYPE;
+        if ("ENROLBKR".equals(codeString))
+          return ENROLBKR;
+        if ("TPA".equals(codeString))
+          return TPA;
+        if ("UMO".equals(codeString))
+          return UMO;
+        if ("RESPRSN".equals(codeString))
+          return RESPRSN;
+        if ("EXCEST".equals(codeString))
+          return EXCEST;
+        if ("GUADLTM".equals(codeString))
+          return GUADLTM;
+        if ("GUARD".equals(codeString))
+          return GUARD;
+        if ("POWATT".equals(codeString))
+          return POWATT;
+        if ("DPOWATT".equals(codeString))
+          return DPOWATT;
+        if ("HPOWATT".equals(codeString))
+          return HPOWATT;
+        if ("SPOWATT".equals(codeString))
+          return SPOWATT;
+        if ("_AssignedRoleType".equals(codeString))
+          return _ASSIGNEDROLETYPE;
+        if ("_AssignedNonPersonLivingSubjectRoleType".equals(codeString))
+          return _ASSIGNEDNONPERSONLIVINGSUBJECTROLETYPE;
+        if ("ASSIST".equals(codeString))
+          return ASSIST;
+        if ("BIOTH".equals(codeString))
+          return BIOTH;
+        if ("ANTIBIOT".equals(codeString))
+          return ANTIBIOT;
+        if ("DEBR".equals(codeString))
+          return DEBR;
+        if ("CCO".equals(codeString))
+          return CCO;
+        if ("SEE".equals(codeString))
+          return SEE;
+        if ("SNIFF".equals(codeString))
+          return SNIFF;
+        if ("_CertifiedEntityType".equals(codeString))
+          return _CERTIFIEDENTITYTYPE;
+        if ("_CitizenRoleType".equals(codeString))
+          return _CITIZENROLETYPE;
+        if ("CAS".equals(codeString))
+          return CAS;
+        if ("CASM".equals(codeString))
+          return CASM;
+        if ("CN".equals(codeString))
+          return CN;
+        if ("CNRP".equals(codeString))
+          return CNRP;
+        if ("CNRPM".equals(codeString))
+          return CNRPM;
+        if ("CPCA".equals(codeString))
+          return CPCA;
+        if ("CRP".equals(codeString))
+          return CRP;
+        if ("CRPM".equals(codeString))
+          return CRPM;
+        if ("_ContactRoleType".equals(codeString))
+          return _CONTACTROLETYPE;
+        if ("_AdministrativeContactRoleType".equals(codeString))
+          return _ADMINISTRATIVECONTACTROLETYPE;
+        if ("BILL".equals(codeString))
+          return BILL;
+        if ("ORG".equals(codeString))
+          return ORG;
+        if ("PAYOR".equals(codeString))
+          return PAYOR;
+        if ("ECON".equals(codeString))
+          return ECON;
+        if ("NOK".equals(codeString))
+          return NOK;
+        if ("_IdentifiedEntityType".equals(codeString))
+          return _IDENTIFIEDENTITYTYPE;
+        if ("_LocationIdentifiedEntityRoleCode".equals(codeString))
+          return _LOCATIONIDENTIFIEDENTITYROLECODE;
+        if ("ACHFID".equals(codeString))
+          return ACHFID;
+        if ("JURID".equals(codeString))
+          return JURID;
+        if ("LOCHFID".equals(codeString))
+          return LOCHFID;
+        if ("_LivingSubjectProductionClass".equals(codeString))
+          return _LIVINGSUBJECTPRODUCTIONCLASS;
+        if ("BF".equals(codeString))
+          return BF;
+        if ("BL".equals(codeString))
+          return BL;
+        if ("BR".equals(codeString))
+          return BR;
+        if ("CO".equals(codeString))
+          return CO;
+        if ("DA".equals(codeString))
+          return DA;
+        if ("DR".equals(codeString))
+          return DR;
+        if ("DU".equals(codeString))
+          return DU;
+        if ("FI".equals(codeString))
+          return FI;
+        if ("LY".equals(codeString))
+          return LY;
+        if ("MT".equals(codeString))
+          return MT;
+        if ("MU".equals(codeString))
+          return MU;
+        if ("PL".equals(codeString))
+          return PL;
+        if ("RC".equals(codeString))
+          return RC;
+        if ("SH".equals(codeString))
+          return SH;
+        if ("VL".equals(codeString))
+          return VL;
+        if ("WL".equals(codeString))
+          return WL;
+        if ("WO".equals(codeString))
+          return WO;
+        if ("_MedicationGeneralizationRoleType".equals(codeString))
+          return _MEDICATIONGENERALIZATIONROLETYPE;
+        if ("DC".equals(codeString))
+          return DC;
+        if ("GD".equals(codeString))
+          return GD;
+        if ("GDF".equals(codeString))
+          return GDF;
+        if ("GDS".equals(codeString))
+          return GDS;
+        if ("GDSF".equals(codeString))
+          return GDSF;
+        if ("MGDSF".equals(codeString))
+          return MGDSF;
+        if ("_MemberRoleType".equals(codeString))
+          return _MEMBERROLETYPE;
+        if ("TRB".equals(codeString))
+          return TRB;
+        if ("_PersonalRelationshipRoleType".equals(codeString))
+          return _PERSONALRELATIONSHIPROLETYPE;
+        if ("FAMMEMB".equals(codeString))
+          return FAMMEMB;
+        if ("CHILD".equals(codeString))
+          return CHILD;
+        if ("CHLDADOPT".equals(codeString))
+          return CHLDADOPT;
+        if ("DAUADOPT".equals(codeString))
+          return DAUADOPT;
+        if ("SONADOPT".equals(codeString))
+          return SONADOPT;
+        if ("CHLDFOST".equals(codeString))
+          return CHLDFOST;
+        if ("DAUFOST".equals(codeString))
+          return DAUFOST;
+        if ("SONFOST".equals(codeString))
+          return SONFOST;
+        if ("DAUC".equals(codeString))
+          return DAUC;
+        if ("DAU".equals(codeString))
+          return DAU;
+        if ("STPDAU".equals(codeString))
+          return STPDAU;
+        if ("NCHILD".equals(codeString))
+          return NCHILD;
+        if ("SON".equals(codeString))
+          return SON;
+        if ("SONC".equals(codeString))
+          return SONC;
+        if ("STPSON".equals(codeString))
+          return STPSON;
+        if ("STPCHLD".equals(codeString))
+          return STPCHLD;
+        if ("EXT".equals(codeString))
+          return EXT;
+        if ("AUNT".equals(codeString))
+          return AUNT;
+        if ("MAUNT".equals(codeString))
+          return MAUNT;
+        if ("PAUNT".equals(codeString))
+          return PAUNT;
+        if ("COUSN".equals(codeString))
+          return COUSN;
+        if ("MCOUSN".equals(codeString))
+          return MCOUSN;
+        if ("PCOUSN".equals(codeString))
+          return PCOUSN;
+        if ("GGRPRN".equals(codeString))
+          return GGRPRN;
+        if ("GGRFTH".equals(codeString))
+          return GGRFTH;
+        if ("MGGRFTH".equals(codeString))
+          return MGGRFTH;
+        if ("PGGRFTH".equals(codeString))
+          return PGGRFTH;
+        if ("GGRMTH".equals(codeString))
+          return GGRMTH;
+        if ("MGGRMTH".equals(codeString))
+          return MGGRMTH;
+        if ("PGGRMTH".equals(codeString))
+          return PGGRMTH;
+        if ("MGGRPRN".equals(codeString))
+          return MGGRPRN;
+        if ("PGGRPRN".equals(codeString))
+          return PGGRPRN;
+        if ("GRNDCHILD".equals(codeString))
+          return GRNDCHILD;
+        if ("GRNDDAU".equals(codeString))
+          return GRNDDAU;
+        if ("GRNDSON".equals(codeString))
+          return GRNDSON;
+        if ("GRPRN".equals(codeString))
+          return GRPRN;
+        if ("GRFTH".equals(codeString))
+          return GRFTH;
+        if ("MGRFTH".equals(codeString))
+          return MGRFTH;
+        if ("PGRFTH".equals(codeString))
+          return PGRFTH;
+        if ("GRMTH".equals(codeString))
+          return GRMTH;
+        if ("MGRMTH".equals(codeString))
+          return MGRMTH;
+        if ("PGRMTH".equals(codeString))
+          return PGRMTH;
+        if ("MGRPRN".equals(codeString))
+          return MGRPRN;
+        if ("PGRPRN".equals(codeString))
+          return PGRPRN;
+        if ("INLAW".equals(codeString))
+          return INLAW;
+        if ("CHLDINLAW".equals(codeString))
+          return CHLDINLAW;
+        if ("DAUINLAW".equals(codeString))
+          return DAUINLAW;
+        if ("SONINLAW".equals(codeString))
+          return SONINLAW;
+        if ("PRNINLAW".equals(codeString))
+          return PRNINLAW;
+        if ("FTHINLAW".equals(codeString))
+          return FTHINLAW;
+        if ("MTHINLAW".equals(codeString))
+          return MTHINLAW;
+        if ("SIBINLAW".equals(codeString))
+          return SIBINLAW;
+        if ("BROINLAW".equals(codeString))
+          return BROINLAW;
+        if ("SISINLAW".equals(codeString))
+          return SISINLAW;
+        if ("NIENEPH".equals(codeString))
+          return NIENEPH;
+        if ("NEPHEW".equals(codeString))
+          return NEPHEW;
+        if ("NIECE".equals(codeString))
+          return NIECE;
+        if ("UNCLE".equals(codeString))
+          return UNCLE;
+        if ("MUNCLE".equals(codeString))
+          return MUNCLE;
+        if ("PUNCLE".equals(codeString))
+          return PUNCLE;
+        if ("PRN".equals(codeString))
+          return PRN;
+        if ("ADOPTP".equals(codeString))
+          return ADOPTP;
+        if ("ADOPTF".equals(codeString))
+          return ADOPTF;
+        if ("ADOPTM".equals(codeString))
+          return ADOPTM;
+        if ("FTH".equals(codeString))
+          return FTH;
+        if ("FTHFOST".equals(codeString))
+          return FTHFOST;
+        if ("NFTH".equals(codeString))
+          return NFTH;
+        if ("NFTHF".equals(codeString))
+          return NFTHF;
+        if ("STPFTH".equals(codeString))
+          return STPFTH;
+        if ("MTH".equals(codeString))
+          return MTH;
+        if ("GESTM".equals(codeString))
+          return GESTM;
+        if ("MTHFOST".equals(codeString))
+          return MTHFOST;
+        if ("NMTH".equals(codeString))
+          return NMTH;
+        if ("NMTHF".equals(codeString))
+          return NMTHF;
+        if ("STPMTH".equals(codeString))
+          return STPMTH;
+        if ("NPRN".equals(codeString))
+          return NPRN;
+        if ("PRNFOST".equals(codeString))
+          return PRNFOST;
+        if ("STPPRN".equals(codeString))
+          return STPPRN;
+        if ("SIB".equals(codeString))
+          return SIB;
+        if ("BRO".equals(codeString))
+          return BRO;
+        if ("HBRO".equals(codeString))
+          return HBRO;
+        if ("NBRO".equals(codeString))
+          return NBRO;
+        if ("TWINBRO".equals(codeString))
+          return TWINBRO;
+        if ("FTWINBRO".equals(codeString))
+          return FTWINBRO;
+        if ("ITWINBRO".equals(codeString))
+          return ITWINBRO;
+        if ("STPBRO".equals(codeString))
+          return STPBRO;
+        if ("HSIB".equals(codeString))
+          return HSIB;
+        if ("HSIS".equals(codeString))
+          return HSIS;
+        if ("NSIB".equals(codeString))
+          return NSIB;
+        if ("NSIS".equals(codeString))
+          return NSIS;
+        if ("TWINSIS".equals(codeString))
+          return TWINSIS;
+        if ("FTWINSIS".equals(codeString))
+          return FTWINSIS;
+        if ("ITWINSIS".equals(codeString))
+          return ITWINSIS;
+        if ("TWIN".equals(codeString))
+          return TWIN;
+        if ("FTWIN".equals(codeString))
+          return FTWIN;
+        if ("ITWIN".equals(codeString))
+          return ITWIN;
+        if ("SIS".equals(codeString))
+          return SIS;
+        if ("STPSIS".equals(codeString))
+          return STPSIS;
+        if ("STPSIB".equals(codeString))
+          return STPSIB;
+        if ("SIGOTHR".equals(codeString))
+          return SIGOTHR;
+        if ("DOMPART".equals(codeString))
+          return DOMPART;
+        if ("FMRSPS".equals(codeString))
+          return FMRSPS;
+        if ("SPS".equals(codeString))
+          return SPS;
+        if ("HUSB".equals(codeString))
+          return HUSB;
+        if ("WIFE".equals(codeString))
+          return WIFE;
+        if ("FRND".equals(codeString))
+          return FRND;
+        if ("NBOR".equals(codeString))
+          return NBOR;
+        if ("ONESELF".equals(codeString))
+          return ONESELF;
+        if ("ROOM".equals(codeString))
+          return ROOM;
+        if ("_PolicyOrProgramCoverageRoleType".equals(codeString))
+          return _POLICYORPROGRAMCOVERAGEROLETYPE;
+        if ("_CoverageRoleType".equals(codeString))
+          return _COVERAGEROLETYPE;
+        if ("FAMDEP".equals(codeString))
+          return FAMDEP;
+        if ("HANDIC".equals(codeString))
+          return HANDIC;
+        if ("INJ".equals(codeString))
+          return INJ;
+        if ("SELF".equals(codeString))
+          return SELF;
+        if ("SPON".equals(codeString))
+          return SPON;
+        if ("STUD".equals(codeString))
+          return STUD;
+        if ("FSTUD".equals(codeString))
+          return FSTUD;
+        if ("PSTUD".equals(codeString))
+          return PSTUD;
+        if ("ADOPT".equals(codeString))
+          return ADOPT;
+        if ("GCHILD".equals(codeString))
+          return GCHILD;
+        if ("GPARNT".equals(codeString))
+          return GPARNT;
+        if ("NAT".equals(codeString))
+          return NAT;
+        if ("NIENE".equals(codeString))
+          return NIENE;
+        if ("PARNT".equals(codeString))
+          return PARNT;
+        if ("SPSE".equals(codeString))
+          return SPSE;
+        if ("STEP".equals(codeString))
+          return STEP;
+        if ("_CoveredPartyRoleType".equals(codeString))
+          return _COVEREDPARTYROLETYPE;
+        if ("_ClaimantCoveredPartyRoleType".equals(codeString))
+          return _CLAIMANTCOVEREDPARTYROLETYPE;
+        if ("CRIMEVIC".equals(codeString))
+          return CRIMEVIC;
+        if ("INJWKR".equals(codeString))
+          return INJWKR;
+        if ("_DependentCoveredPartyRoleType".equals(codeString))
+          return _DEPENDENTCOVEREDPARTYROLETYPE;
+        if ("COCBEN".equals(codeString))
+          return COCBEN;
+        if ("DIFFABL".equals(codeString))
+          return DIFFABL;
+        if ("WARD".equals(codeString))
+          return WARD;
+        if ("_IndividualInsuredPartyRoleType".equals(codeString))
+          return _INDIVIDUALINSUREDPARTYROLETYPE;
+        if ("RETIREE".equals(codeString))
+          return RETIREE;
+        if ("_ProgramEligiblePartyRoleType".equals(codeString))
+          return _PROGRAMELIGIBLEPARTYROLETYPE;
+        if ("INDIG".equals(codeString))
+          return INDIG;
+        if ("MIL".equals(codeString))
+          return MIL;
+        if ("ACTMIL".equals(codeString))
+          return ACTMIL;
+        if ("RETMIL".equals(codeString))
+          return RETMIL;
+        if ("VET".equals(codeString))
+          return VET;
+        if ("_SubscriberCoveredPartyRoleType".equals(codeString))
+          return _SUBSCRIBERCOVEREDPARTYROLETYPE;
+        if ("_ResearchSubjectRoleBasis".equals(codeString))
+          return _RESEARCHSUBJECTROLEBASIS;
+        if ("ERL".equals(codeString))
+          return ERL;
+        if ("SCN".equals(codeString))
+          return SCN;
+        if ("_ServiceDeliveryLocationRoleType".equals(codeString))
+          return _SERVICEDELIVERYLOCATIONROLETYPE;
+        if ("_DedicatedServiceDeliveryLocationRoleType".equals(codeString))
+          return _DEDICATEDSERVICEDELIVERYLOCATIONROLETYPE;
+        if ("_DedicatedClinicalLocationRoleType".equals(codeString))
+          return _DEDICATEDCLINICALLOCATIONROLETYPE;
+        if ("DX".equals(codeString))
+          return DX;
+        if ("CVDX".equals(codeString))
+          return CVDX;
+        if ("CATH".equals(codeString))
+          return CATH;
+        if ("ECHO".equals(codeString))
+          return ECHO;
+        if ("GIDX".equals(codeString))
+          return GIDX;
+        if ("ENDOS".equals(codeString))
+          return ENDOS;
+        if ("RADDX".equals(codeString))
+          return RADDX;
+        if ("RADO".equals(codeString))
+          return RADO;
+        if ("RNEU".equals(codeString))
+          return RNEU;
+        if ("HOSP".equals(codeString))
+          return HOSP;
+        if ("CHR".equals(codeString))
+          return CHR;
+        if ("GACH".equals(codeString))
+          return GACH;
+        if ("MHSP".equals(codeString))
+          return MHSP;
+        if ("PSYCHF".equals(codeString))
+          return PSYCHF;
+        if ("RH".equals(codeString))
+          return RH;
+        if ("RHAT".equals(codeString))
+          return RHAT;
+        if ("RHII".equals(codeString))
+          return RHII;
+        if ("RHMAD".equals(codeString))
+          return RHMAD;
+        if ("RHPI".equals(codeString))
+          return RHPI;
+        if ("RHPIH".equals(codeString))
+          return RHPIH;
+        if ("RHPIMS".equals(codeString))
+          return RHPIMS;
+        if ("RHPIVS".equals(codeString))
+          return RHPIVS;
+        if ("RHYAD".equals(codeString))
+          return RHYAD;
+        if ("HU".equals(codeString))
+          return HU;
+        if ("BMTU".equals(codeString))
+          return BMTU;
+        if ("CCU".equals(codeString))
+          return CCU;
+        if ("CHEST".equals(codeString))
+          return CHEST;
+        if ("EPIL".equals(codeString))
+          return EPIL;
+        if ("ER".equals(codeString))
+          return ER;
+        if ("ETU".equals(codeString))
+          return ETU;
+        if ("HD".equals(codeString))
+          return HD;
+        if ("HLAB".equals(codeString))
+          return HLAB;
+        if ("INLAB".equals(codeString))
+          return INLAB;
+        if ("OUTLAB".equals(codeString))
+          return OUTLAB;
+        if ("HRAD".equals(codeString))
+          return HRAD;
+        if ("HUSCS".equals(codeString))
+          return HUSCS;
+        if ("ICU".equals(codeString))
+          return ICU;
+        if ("PEDICU".equals(codeString))
+          return PEDICU;
+        if ("PEDNICU".equals(codeString))
+          return PEDNICU;
+        if ("INPHARM".equals(codeString))
+          return INPHARM;
+        if ("MBL".equals(codeString))
+          return MBL;
+        if ("NCCS".equals(codeString))
+          return NCCS;
+        if ("NS".equals(codeString))
+          return NS;
+        if ("OUTPHARM".equals(codeString))
+          return OUTPHARM;
+        if ("PEDU".equals(codeString))
+          return PEDU;
+        if ("PHU".equals(codeString))
+          return PHU;
+        if ("RHU".equals(codeString))
+          return RHU;
+        if ("SLEEP".equals(codeString))
+          return SLEEP;
+        if ("NCCF".equals(codeString))
+          return NCCF;
+        if ("SNF".equals(codeString))
+          return SNF;
+        if ("OF".equals(codeString))
+          return OF;
+        if ("ALL".equals(codeString))
+          return ALL;
+        if ("AMPUT".equals(codeString))
+          return AMPUT;
+        if ("BMTC".equals(codeString))
+          return BMTC;
+        if ("BREAST".equals(codeString))
+          return BREAST;
+        if ("CANC".equals(codeString))
+          return CANC;
+        if ("CAPC".equals(codeString))
+          return CAPC;
+        if ("CARD".equals(codeString))
+          return CARD;
+        if ("PEDCARD".equals(codeString))
+          return PEDCARD;
+        if ("COAG".equals(codeString))
+          return COAG;
+        if ("CRS".equals(codeString))
+          return CRS;
+        if ("DERM".equals(codeString))
+          return DERM;
+        if ("ENDO".equals(codeString))
+          return ENDO;
+        if ("PEDE".equals(codeString))
+          return PEDE;
+        if ("ENT".equals(codeString))
+          return ENT;
+        if ("FMC".equals(codeString))
+          return FMC;
+        if ("GI".equals(codeString))
+          return GI;
+        if ("PEDGI".equals(codeString))
+          return PEDGI;
+        if ("GIM".equals(codeString))
+          return GIM;
+        if ("GYN".equals(codeString))
+          return GYN;
+        if ("HEM".equals(codeString))
+          return HEM;
+        if ("PEDHEM".equals(codeString))
+          return PEDHEM;
+        if ("HTN".equals(codeString))
+          return HTN;
+        if ("IEC".equals(codeString))
+          return IEC;
+        if ("INFD".equals(codeString))
+          return INFD;
+        if ("PEDID".equals(codeString))
+          return PEDID;
+        if ("INV".equals(codeString))
+          return INV;
+        if ("LYMPH".equals(codeString))
+          return LYMPH;
+        if ("MGEN".equals(codeString))
+          return MGEN;
+        if ("NEPH".equals(codeString))
+          return NEPH;
+        if ("PEDNEPH".equals(codeString))
+          return PEDNEPH;
+        if ("NEUR".equals(codeString))
+          return NEUR;
+        if ("OB".equals(codeString))
+          return OB;
+        if ("OMS".equals(codeString))
+          return OMS;
+        if ("ONCL".equals(codeString))
+          return ONCL;
+        if ("PEDHO".equals(codeString))
+          return PEDHO;
+        if ("OPH".equals(codeString))
+          return OPH;
+        if ("OPTC".equals(codeString))
+          return OPTC;
+        if ("ORTHO".equals(codeString))
+          return ORTHO;
+        if ("HAND".equals(codeString))
+          return HAND;
+        if ("PAINCL".equals(codeString))
+          return PAINCL;
+        if ("PC".equals(codeString))
+          return PC;
+        if ("PEDC".equals(codeString))
+          return PEDC;
+        if ("PEDRHEUM".equals(codeString))
+          return PEDRHEUM;
+        if ("POD".equals(codeString))
+          return POD;
+        if ("PREV".equals(codeString))
+          return PREV;
+        if ("PROCTO".equals(codeString))
+          return PROCTO;
+        if ("PROFF".equals(codeString))
+          return PROFF;
+        if ("PROS".equals(codeString))
+          return PROS;
+        if ("PSI".equals(codeString))
+          return PSI;
+        if ("PSY".equals(codeString))
+          return PSY;
+        if ("RHEUM".equals(codeString))
+          return RHEUM;
+        if ("SPMED".equals(codeString))
+          return SPMED;
+        if ("SU".equals(codeString))
+          return SU;
+        if ("PLS".equals(codeString))
+          return PLS;
+        if ("URO".equals(codeString))
+          return URO;
+        if ("TR".equals(codeString))
+          return TR;
+        if ("TRAVEL".equals(codeString))
+          return TRAVEL;
+        if ("WND".equals(codeString))
+          return WND;
+        if ("RTF".equals(codeString))
+          return RTF;
+        if ("PRC".equals(codeString))
+          return PRC;
+        if ("SURF".equals(codeString))
+          return SURF;
+        if ("_DedicatedNonClinicalLocationRoleType".equals(codeString))
+          return _DEDICATEDNONCLINICALLOCATIONROLETYPE;
+        if ("DADDR".equals(codeString))
+          return DADDR;
+        if ("MOBL".equals(codeString))
+          return MOBL;
+        if ("AMB".equals(codeString))
+          return AMB;
+        if ("PHARM".equals(codeString))
+          return PHARM;
+        if ("_IncidentalServiceDeliveryLocationRoleType".equals(codeString))
+          return _INCIDENTALSERVICEDELIVERYLOCATIONROLETYPE;
+        if ("ACC".equals(codeString))
+          return ACC;
+        if ("COMM".equals(codeString))
+          return COMM;
+        if ("CSC".equals(codeString))
+          return CSC;
+        if ("PTRES".equals(codeString))
+          return PTRES;
+        if ("SCHOOL".equals(codeString))
+          return SCHOOL;
+        if ("UPC".equals(codeString))
+          return UPC;
+        if ("WORK".equals(codeString))
+          return WORK;
+        if ("_SpecimenRoleType".equals(codeString))
+          return _SPECIMENROLETYPE;
+        if ("C".equals(codeString))
+          return C;
+        if ("G".equals(codeString))
+          return G;
+        if ("L".equals(codeString))
+          return L;
+        if ("P".equals(codeString))
+          return P;
+        if ("Q".equals(codeString))
+          return Q;
+        if ("B".equals(codeString))
+          return B;
+        if ("E".equals(codeString))
+          return E;
+        if ("F".equals(codeString))
+          return F;
+        if ("O".equals(codeString))
+          return O;
+        if ("V".equals(codeString))
+          return V;
+        if ("R".equals(codeString))
+          return R;
+        if ("CLAIM".equals(codeString))
+          return CLAIM;
+        if ("communityLaboratory".equals(codeString))
+          return COMMUNITYLABORATORY;
+        if ("GT".equals(codeString))
+          return GT;
+        if ("homeHealth".equals(codeString))
+          return HOMEHEALTH;
+        if ("laboratory".equals(codeString))
+          return LABORATORY;
+        if ("pathologist".equals(codeString))
+          return PATHOLOGIST;
+        if ("PH".equals(codeString))
+          return PH;
+        if ("phlebotomist".equals(codeString))
+          return PHLEBOTOMIST;
+        if ("PROG".equals(codeString))
+          return PROG;
+        if ("PT".equals(codeString))
+          return PT;
+        if ("subject".equals(codeString))
+          return SUBJECT;
+        if ("thirdParty".equals(codeString))
+          return THIRDPARTY;
+        if ("DEP".equals(codeString))
+          return DEP;
+        if ("DEPEN".equals(codeString))
+          return DEPEN;
+        if ("FM".equals(codeString))
+          return FM;
+        if ("INDIV".equals(codeString))
+          return INDIV;
+        if ("NAMED".equals(codeString))
+          return NAMED;
+        if ("PSYCHCF".equals(codeString))
+          return PSYCHCF;
+        if ("SUBSCR".equals(codeString))
+          return SUBSCR;
+        throw new FHIRException("Unknown V3RoleCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _AFFILIATIONROLETYPE: return "_AffiliationRoleType";
+            case _AGENTROLETYPE: return "_AgentRoleType";
+            case AMENDER: return "AMENDER";
+            case CLASSIFIER: return "CLASSIFIER";
+            case CONSENTER: return "CONSENTER";
+            case CONSWIT: return "CONSWIT";
+            case COPART: return "COPART";
+            case DECLASSIFIER: return "DECLASSIFIER";
+            case DELEGATEE: return "DELEGATEE";
+            case DELEGATOR: return "DELEGATOR";
+            case DOWNGRDER: return "DOWNGRDER";
+            case DRIVCLASSIFIER: return "DRIVCLASSIFIER";
+            case GRANTEE: return "GRANTEE";
+            case GRANTOR: return "GRANTOR";
+            case INTPRTER: return "INTPRTER";
+            case REVIEWER: return "REVIEWER";
+            case VALIDATOR: return "VALIDATOR";
+            case _COVERAGESPONSORROLETYPE: return "_CoverageSponsorRoleType";
+            case FULLINS: return "FULLINS";
+            case SELFINS: return "SELFINS";
+            case _PAYORROLETYPE: return "_PayorRoleType";
+            case ENROLBKR: return "ENROLBKR";
+            case TPA: return "TPA";
+            case UMO: return "UMO";
+            case RESPRSN: return "RESPRSN";
+            case EXCEST: return "EXCEST";
+            case GUADLTM: return "GUADLTM";
+            case GUARD: return "GUARD";
+            case POWATT: return "POWATT";
+            case DPOWATT: return "DPOWATT";
+            case HPOWATT: return "HPOWATT";
+            case SPOWATT: return "SPOWATT";
+            case _ASSIGNEDROLETYPE: return "_AssignedRoleType";
+            case _ASSIGNEDNONPERSONLIVINGSUBJECTROLETYPE: return "_AssignedNonPersonLivingSubjectRoleType";
+            case ASSIST: return "ASSIST";
+            case BIOTH: return "BIOTH";
+            case ANTIBIOT: return "ANTIBIOT";
+            case DEBR: return "DEBR";
+            case CCO: return "CCO";
+            case SEE: return "SEE";
+            case SNIFF: return "SNIFF";
+            case _CERTIFIEDENTITYTYPE: return "_CertifiedEntityType";
+            case _CITIZENROLETYPE: return "_CitizenRoleType";
+            case CAS: return "CAS";
+            case CASM: return "CASM";
+            case CN: return "CN";
+            case CNRP: return "CNRP";
+            case CNRPM: return "CNRPM";
+            case CPCA: return "CPCA";
+            case CRP: return "CRP";
+            case CRPM: return "CRPM";
+            case _CONTACTROLETYPE: return "_ContactRoleType";
+            case _ADMINISTRATIVECONTACTROLETYPE: return "_AdministrativeContactRoleType";
+            case BILL: return "BILL";
+            case ORG: return "ORG";
+            case PAYOR: return "PAYOR";
+            case ECON: return "ECON";
+            case NOK: return "NOK";
+            case _IDENTIFIEDENTITYTYPE: return "_IdentifiedEntityType";
+            case _LOCATIONIDENTIFIEDENTITYROLECODE: return "_LocationIdentifiedEntityRoleCode";
+            case ACHFID: return "ACHFID";
+            case JURID: return "JURID";
+            case LOCHFID: return "LOCHFID";
+            case _LIVINGSUBJECTPRODUCTIONCLASS: return "_LivingSubjectProductionClass";
+            case BF: return "BF";
+            case BL: return "BL";
+            case BR: return "BR";
+            case CO: return "CO";
+            case DA: return "DA";
+            case DR: return "DR";
+            case DU: return "DU";
+            case FI: return "FI";
+            case LY: return "LY";
+            case MT: return "MT";
+            case MU: return "MU";
+            case PL: return "PL";
+            case RC: return "RC";
+            case SH: return "SH";
+            case VL: return "VL";
+            case WL: return "WL";
+            case WO: return "WO";
+            case _MEDICATIONGENERALIZATIONROLETYPE: return "_MedicationGeneralizationRoleType";
+            case DC: return "DC";
+            case GD: return "GD";
+            case GDF: return "GDF";
+            case GDS: return "GDS";
+            case GDSF: return "GDSF";
+            case MGDSF: return "MGDSF";
+            case _MEMBERROLETYPE: return "_MemberRoleType";
+            case TRB: return "TRB";
+            case _PERSONALRELATIONSHIPROLETYPE: return "_PersonalRelationshipRoleType";
+            case FAMMEMB: return "FAMMEMB";
+            case CHILD: return "CHILD";
+            case CHLDADOPT: return "CHLDADOPT";
+            case DAUADOPT: return "DAUADOPT";
+            case SONADOPT: return "SONADOPT";
+            case CHLDFOST: return "CHLDFOST";
+            case DAUFOST: return "DAUFOST";
+            case SONFOST: return "SONFOST";
+            case DAUC: return "DAUC";
+            case DAU: return "DAU";
+            case STPDAU: return "STPDAU";
+            case NCHILD: return "NCHILD";
+            case SON: return "SON";
+            case SONC: return "SONC";
+            case STPSON: return "STPSON";
+            case STPCHLD: return "STPCHLD";
+            case EXT: return "EXT";
+            case AUNT: return "AUNT";
+            case MAUNT: return "MAUNT";
+            case PAUNT: return "PAUNT";
+            case COUSN: return "COUSN";
+            case MCOUSN: return "MCOUSN";
+            case PCOUSN: return "PCOUSN";
+            case GGRPRN: return "GGRPRN";
+            case GGRFTH: return "GGRFTH";
+            case MGGRFTH: return "MGGRFTH";
+            case PGGRFTH: return "PGGRFTH";
+            case GGRMTH: return "GGRMTH";
+            case MGGRMTH: return "MGGRMTH";
+            case PGGRMTH: return "PGGRMTH";
+            case MGGRPRN: return "MGGRPRN";
+            case PGGRPRN: return "PGGRPRN";
+            case GRNDCHILD: return "GRNDCHILD";
+            case GRNDDAU: return "GRNDDAU";
+            case GRNDSON: return "GRNDSON";
+            case GRPRN: return "GRPRN";
+            case GRFTH: return "GRFTH";
+            case MGRFTH: return "MGRFTH";
+            case PGRFTH: return "PGRFTH";
+            case GRMTH: return "GRMTH";
+            case MGRMTH: return "MGRMTH";
+            case PGRMTH: return "PGRMTH";
+            case MGRPRN: return "MGRPRN";
+            case PGRPRN: return "PGRPRN";
+            case INLAW: return "INLAW";
+            case CHLDINLAW: return "CHLDINLAW";
+            case DAUINLAW: return "DAUINLAW";
+            case SONINLAW: return "SONINLAW";
+            case PRNINLAW: return "PRNINLAW";
+            case FTHINLAW: return "FTHINLAW";
+            case MTHINLAW: return "MTHINLAW";
+            case SIBINLAW: return "SIBINLAW";
+            case BROINLAW: return "BROINLAW";
+            case SISINLAW: return "SISINLAW";
+            case NIENEPH: return "NIENEPH";
+            case NEPHEW: return "NEPHEW";
+            case NIECE: return "NIECE";
+            case UNCLE: return "UNCLE";
+            case MUNCLE: return "MUNCLE";
+            case PUNCLE: return "PUNCLE";
+            case PRN: return "PRN";
+            case ADOPTP: return "ADOPTP";
+            case ADOPTF: return "ADOPTF";
+            case ADOPTM: return "ADOPTM";
+            case FTH: return "FTH";
+            case FTHFOST: return "FTHFOST";
+            case NFTH: return "NFTH";
+            case NFTHF: return "NFTHF";
+            case STPFTH: return "STPFTH";
+            case MTH: return "MTH";
+            case GESTM: return "GESTM";
+            case MTHFOST: return "MTHFOST";
+            case NMTH: return "NMTH";
+            case NMTHF: return "NMTHF";
+            case STPMTH: return "STPMTH";
+            case NPRN: return "NPRN";
+            case PRNFOST: return "PRNFOST";
+            case STPPRN: return "STPPRN";
+            case SIB: return "SIB";
+            case BRO: return "BRO";
+            case HBRO: return "HBRO";
+            case NBRO: return "NBRO";
+            case TWINBRO: return "TWINBRO";
+            case FTWINBRO: return "FTWINBRO";
+            case ITWINBRO: return "ITWINBRO";
+            case STPBRO: return "STPBRO";
+            case HSIB: return "HSIB";
+            case HSIS: return "HSIS";
+            case NSIB: return "NSIB";
+            case NSIS: return "NSIS";
+            case TWINSIS: return "TWINSIS";
+            case FTWINSIS: return "FTWINSIS";
+            case ITWINSIS: return "ITWINSIS";
+            case TWIN: return "TWIN";
+            case FTWIN: return "FTWIN";
+            case ITWIN: return "ITWIN";
+            case SIS: return "SIS";
+            case STPSIS: return "STPSIS";
+            case STPSIB: return "STPSIB";
+            case SIGOTHR: return "SIGOTHR";
+            case DOMPART: return "DOMPART";
+            case FMRSPS: return "FMRSPS";
+            case SPS: return "SPS";
+            case HUSB: return "HUSB";
+            case WIFE: return "WIFE";
+            case FRND: return "FRND";
+            case NBOR: return "NBOR";
+            case ONESELF: return "ONESELF";
+            case ROOM: return "ROOM";
+            case _POLICYORPROGRAMCOVERAGEROLETYPE: return "_PolicyOrProgramCoverageRoleType";
+            case _COVERAGEROLETYPE: return "_CoverageRoleType";
+            case FAMDEP: return "FAMDEP";
+            case HANDIC: return "HANDIC";
+            case INJ: return "INJ";
+            case SELF: return "SELF";
+            case SPON: return "SPON";
+            case STUD: return "STUD";
+            case FSTUD: return "FSTUD";
+            case PSTUD: return "PSTUD";
+            case ADOPT: return "ADOPT";
+            case GCHILD: return "GCHILD";
+            case GPARNT: return "GPARNT";
+            case NAT: return "NAT";
+            case NIENE: return "NIENE";
+            case PARNT: return "PARNT";
+            case SPSE: return "SPSE";
+            case STEP: return "STEP";
+            case _COVEREDPARTYROLETYPE: return "_CoveredPartyRoleType";
+            case _CLAIMANTCOVEREDPARTYROLETYPE: return "_ClaimantCoveredPartyRoleType";
+            case CRIMEVIC: return "CRIMEVIC";
+            case INJWKR: return "INJWKR";
+            case _DEPENDENTCOVEREDPARTYROLETYPE: return "_DependentCoveredPartyRoleType";
+            case COCBEN: return "COCBEN";
+            case DIFFABL: return "DIFFABL";
+            case WARD: return "WARD";
+            case _INDIVIDUALINSUREDPARTYROLETYPE: return "_IndividualInsuredPartyRoleType";
+            case RETIREE: return "RETIREE";
+            case _PROGRAMELIGIBLEPARTYROLETYPE: return "_ProgramEligiblePartyRoleType";
+            case INDIG: return "INDIG";
+            case MIL: return "MIL";
+            case ACTMIL: return "ACTMIL";
+            case RETMIL: return "RETMIL";
+            case VET: return "VET";
+            case _SUBSCRIBERCOVEREDPARTYROLETYPE: return "_SubscriberCoveredPartyRoleType";
+            case _RESEARCHSUBJECTROLEBASIS: return "_ResearchSubjectRoleBasis";
+            case ERL: return "ERL";
+            case SCN: return "SCN";
+            case _SERVICEDELIVERYLOCATIONROLETYPE: return "_ServiceDeliveryLocationRoleType";
+            case _DEDICATEDSERVICEDELIVERYLOCATIONROLETYPE: return "_DedicatedServiceDeliveryLocationRoleType";
+            case _DEDICATEDCLINICALLOCATIONROLETYPE: return "_DedicatedClinicalLocationRoleType";
+            case DX: return "DX";
+            case CVDX: return "CVDX";
+            case CATH: return "CATH";
+            case ECHO: return "ECHO";
+            case GIDX: return "GIDX";
+            case ENDOS: return "ENDOS";
+            case RADDX: return "RADDX";
+            case RADO: return "RADO";
+            case RNEU: return "RNEU";
+            case HOSP: return "HOSP";
+            case CHR: return "CHR";
+            case GACH: return "GACH";
+            case MHSP: return "MHSP";
+            case PSYCHF: return "PSYCHF";
+            case RH: return "RH";
+            case RHAT: return "RHAT";
+            case RHII: return "RHII";
+            case RHMAD: return "RHMAD";
+            case RHPI: return "RHPI";
+            case RHPIH: return "RHPIH";
+            case RHPIMS: return "RHPIMS";
+            case RHPIVS: return "RHPIVS";
+            case RHYAD: return "RHYAD";
+            case HU: return "HU";
+            case BMTU: return "BMTU";
+            case CCU: return "CCU";
+            case CHEST: return "CHEST";
+            case EPIL: return "EPIL";
+            case ER: return "ER";
+            case ETU: return "ETU";
+            case HD: return "HD";
+            case HLAB: return "HLAB";
+            case INLAB: return "INLAB";
+            case OUTLAB: return "OUTLAB";
+            case HRAD: return "HRAD";
+            case HUSCS: return "HUSCS";
+            case ICU: return "ICU";
+            case PEDICU: return "PEDICU";
+            case PEDNICU: return "PEDNICU";
+            case INPHARM: return "INPHARM";
+            case MBL: return "MBL";
+            case NCCS: return "NCCS";
+            case NS: return "NS";
+            case OUTPHARM: return "OUTPHARM";
+            case PEDU: return "PEDU";
+            case PHU: return "PHU";
+            case RHU: return "RHU";
+            case SLEEP: return "SLEEP";
+            case NCCF: return "NCCF";
+            case SNF: return "SNF";
+            case OF: return "OF";
+            case ALL: return "ALL";
+            case AMPUT: return "AMPUT";
+            case BMTC: return "BMTC";
+            case BREAST: return "BREAST";
+            case CANC: return "CANC";
+            case CAPC: return "CAPC";
+            case CARD: return "CARD";
+            case PEDCARD: return "PEDCARD";
+            case COAG: return "COAG";
+            case CRS: return "CRS";
+            case DERM: return "DERM";
+            case ENDO: return "ENDO";
+            case PEDE: return "PEDE";
+            case ENT: return "ENT";
+            case FMC: return "FMC";
+            case GI: return "GI";
+            case PEDGI: return "PEDGI";
+            case GIM: return "GIM";
+            case GYN: return "GYN";
+            case HEM: return "HEM";
+            case PEDHEM: return "PEDHEM";
+            case HTN: return "HTN";
+            case IEC: return "IEC";
+            case INFD: return "INFD";
+            case PEDID: return "PEDID";
+            case INV: return "INV";
+            case LYMPH: return "LYMPH";
+            case MGEN: return "MGEN";
+            case NEPH: return "NEPH";
+            case PEDNEPH: return "PEDNEPH";
+            case NEUR: return "NEUR";
+            case OB: return "OB";
+            case OMS: return "OMS";
+            case ONCL: return "ONCL";
+            case PEDHO: return "PEDHO";
+            case OPH: return "OPH";
+            case OPTC: return "OPTC";
+            case ORTHO: return "ORTHO";
+            case HAND: return "HAND";
+            case PAINCL: return "PAINCL";
+            case PC: return "PC";
+            case PEDC: return "PEDC";
+            case PEDRHEUM: return "PEDRHEUM";
+            case POD: return "POD";
+            case PREV: return "PREV";
+            case PROCTO: return "PROCTO";
+            case PROFF: return "PROFF";
+            case PROS: return "PROS";
+            case PSI: return "PSI";
+            case PSY: return "PSY";
+            case RHEUM: return "RHEUM";
+            case SPMED: return "SPMED";
+            case SU: return "SU";
+            case PLS: return "PLS";
+            case URO: return "URO";
+            case TR: return "TR";
+            case TRAVEL: return "TRAVEL";
+            case WND: return "WND";
+            case RTF: return "RTF";
+            case PRC: return "PRC";
+            case SURF: return "SURF";
+            case _DEDICATEDNONCLINICALLOCATIONROLETYPE: return "_DedicatedNonClinicalLocationRoleType";
+            case DADDR: return "DADDR";
+            case MOBL: return "MOBL";
+            case AMB: return "AMB";
+            case PHARM: return "PHARM";
+            case _INCIDENTALSERVICEDELIVERYLOCATIONROLETYPE: return "_IncidentalServiceDeliveryLocationRoleType";
+            case ACC: return "ACC";
+            case COMM: return "COMM";
+            case CSC: return "CSC";
+            case PTRES: return "PTRES";
+            case SCHOOL: return "SCHOOL";
+            case UPC: return "UPC";
+            case WORK: return "WORK";
+            case _SPECIMENROLETYPE: return "_SpecimenRoleType";
+            case C: return "C";
+            case G: return "G";
+            case L: return "L";
+            case P: return "P";
+            case Q: return "Q";
+            case B: return "B";
+            case E: return "E";
+            case F: return "F";
+            case O: return "O";
+            case V: return "V";
+            case R: return "R";
+            case CLAIM: return "CLAIM";
+            case COMMUNITYLABORATORY: return "communityLaboratory";
+            case GT: return "GT";
+            case HOMEHEALTH: return "homeHealth";
+            case LABORATORY: return "laboratory";
+            case PATHOLOGIST: return "pathologist";
+            case PH: return "PH";
+            case PHLEBOTOMIST: return "phlebotomist";
+            case PROG: return "PROG";
+            case PT: return "PT";
+            case SUBJECT: return "subject";
+            case THIRDPARTY: return "thirdParty";
+            case DEP: return "DEP";
+            case DEPEN: return "DEPEN";
+            case FM: return "FM";
+            case INDIV: return "INDIV";
+            case NAMED: return "NAMED";
+            case PSYCHCF: return "PSYCHCF";
+            case SUBSCR: return "SUBSCR";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/RoleCode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _AFFILIATIONROLETYPE: return "Concepts characterizing the type of association formed by player and scoper when there is a recognized Affiliate role by which the two parties are related.\r\n\n                        \n                           Examples: Business Partner, Business Associate, Colleague";
+            case _AGENTROLETYPE: return "Parties that may or should contribute or have contributed to an Act.";
+            case AMENDER: return "An entity which corrected, edited, or amended pre-existing information.";
+            case CLASSIFIER: return "An individual authorized to assign an original classification to information, including compilations of unclassified information, based on a determination that the information requires protection against unauthorized disclosure. The individual marks the information with immutable, computable, and human readable security labels in accordance with applicable security labeling policies.  The labeling policies provide instructions on whether and if so how the security labels may be later reclassified [i.e., upgraded, downgraded, used in derivative classification, or declassified] in a manner that preserves the overridden original classification binding and provenance.";
+            case CONSENTER: return "An entity or an entity's delegatee who is the grantee in an agreement such as a consent for services, advanced directive, or a privacy consent directive in accordance with jurisdictional, organizational, or patient policy.";
+            case CONSWIT: return "An entity which has witnessed and attests to observing another entity being counseled about an agreement such as a consent for services, advanced directive, or a privacy consent directive.";
+            case COPART: return "An entity which participates in the generation of and attest to veracity of content, but is not an author or coauthor. For example a surgeon who is required by institutional, regulatory, or legal rules to sign an operative report, but who was not involved in the authorship of that report.";
+            case DECLASSIFIER: return "An individual which is authorized to declassify information based on a determination that the information no longer requires protection against unauthorized disclosure.  The individual marks the information being declassified using computable and human readable security labels indicating that this is copy of previously classified information is unclassified in accordance with applicable security labeling policies.  The labeling policies provide instructions on whether and if so how the security labels may be later reclassified [i.e., upgraded or used in derivative classification] in a manner that preserves the overridden original classification binding and provenance.";
+            case DELEGATEE: return "A party to whom some right or authority is granted by a delegator.";
+            case DELEGATOR: return "A party that grants all or some portion its right or authority to another party.";
+            case DOWNGRDER: return "An individual authorized to lower the classification level of labeled content and provide rationale for doing so as directed by a classification guide.";
+            case DRIVCLASSIFIER: return "An individual who is only authorized to classify reproduced, extracted, or summarized classified information, or compile classified and unclassified information by applying classification markings derived from source material or as directed by a classification guide.";
+            case GRANTEE: return "An entity which accepts certain rights or authority from a grantor.";
+            case GRANTOR: return "An entity which agrees to confer certain rights or authority to a grantee.";
+            case INTPRTER: return "An entity which converts spoken or written language into the language of key participants in an event such as when a provider is obtaining a patient's consent to treatment or permission to disclose information.";
+            case REVIEWER: return "An entity authorized to filter information according to approved criteria.";
+            case VALIDATOR: return "An entity authorized to validate information for inclusion in a record.";
+            case _COVERAGESPONSORROLETYPE: return "Description:Codes that indicate a specific type of sponsor.  Used when the sponsor's role is only either as a fully insured sponsor or only as a self-insured sponsor.  NOTE: Where a sponsor may be either, use the SponsorParticipationFunction.code (fully insured or self insured) to indicate the type of responsibility. (CO6-0057)";
+            case FULLINS: return "Description:An employer or organization that contracts with an underwriter to assumes the financial risk and administrative responsibility for coverage of health services for covered parties.";
+            case SELFINS: return "Description:An employer or organization that assumes the financial risk and administrative responsibility for coverage of health services for covered parties.";
+            case _PAYORROLETYPE: return "Description:PayorRoleType for a particular type of policy or program benefit package or plan where more detail about the coverage administration role of the Payor is required.  The functions performed by a Payor qualified by a PayorRoleType may be specified by the PayorParticpationFunction value set.\r\n\n                        \n                           Examples:A Payor that is a TPA may administer a managed care plan without underwriting the risk.";
+            case ENROLBKR: return "Description:A payor that is responsible for functions related to the enrollment of covered parties.";
+            case TPA: return "Description:Third party administrator (TPA) is a payor organization that processes health care claims without carrying insurance risk. Third party administrators are prominent players in the managed care industry and have the expertise and capability to administer all or a portion of the claims process. They are normally contracted by a health insurer or self-insuring companies to administer services, including claims administration, premium collection, enrollment and other administrative activities.\r\n\n                        Self-insured employers often contract with third party administrator to handle their insurance functions. Insurance companies oftentimes outsource the claims, utilization review or membership functions to a TPA. Sometimes TPAs only manage provider networks, only claims or only utilization review.\r\n\n                        While some third-party administrators may operate as units of insurance companies, they are often independent. However, hospitals or provider organizations desiring to set up their own health plans will often outsource certain responsibilities to TPAs.  TPAs may perform one or several payor functions, specified by the PayorParticipationFunction value set, such as provider management, enrollment, utilization management, and fee for service claims adjudication management.";
+            case UMO: return "Description:A payor that is responsible for review and case management of health services covered under a policy or program.";
+            case RESPRSN: return "The role played by a party who has legal responsibility for another party.";
+            case EXCEST: return "The role played by a person acting as the estate executor for a deceased subscriber or policyholder who was the responsible party";
+            case GUADLTM: return "The role played by a person appointed by the court to look out for the best interests of a minor child during the course of legal proceedings.";
+            case GUARD: return "The role played by a person or institution legally empowered with responsibility for the care of a ward.";
+            case POWATT: return "A relationship between two people in which one person authorizes another to act for him in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts.";
+            case DPOWATT: return "A relationship between two people in which one person authorizes another, usually a family member or relative, to act for him or her in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts that is often limited in the kinds of powers that can be assigned.  Unlike ordinary powers of attorney, durable powers can survive for long periods of time, and again, unlike standard powers of attorney, durable powers can continue after incompetency.";
+            case HPOWATT: return "A relationship between two people in which one person authorizes another to act for him or her in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts that continues (by its terms) to be effective even though the grantor has become mentally incompetent after signing the document.";
+            case SPOWATT: return "A relationship between two people in which one person authorizes another to act for him or her in a manner which is a legally binding upon the person giving such authority as if he or she personally were to do the acts that is often limited in the kinds of powers that can be assigned.";
+            case _ASSIGNEDROLETYPE: return "AssignedRoleType";
+            case _ASSIGNEDNONPERSONLIVINGSUBJECTROLETYPE: return "Description:A role type that is used to further qualify a non-person subject playing a role where the role class attribute is set to RoleClass AssignedEntity";
+            case ASSIST: return "Description:Dogs trained to assist the ill or physically challenged.";
+            case BIOTH: return "Description:Animals, including fish and insects, and microorganisms which may participate as assigned entities in biotherapies.";
+            case ANTIBIOT: return "Description:Non-person living subject used as antibiotic.\r\n\n                        \n                           Examples:Bacteriophage, is a virus that infects bacteria.";
+            case DEBR: return "Description:Maggots raised for biodebridement.\r\n\n                        \n                           Discussion: Maggot Debridement Therapy is the medical use of live maggots for cleaning non-healing wounds.\r\n\n                        \n                           Examples:Removal of burnt skin.";
+            case CCO: return "Description:Companion animals, such as dogs, cats, and rabbits, which may be provided to patients to improve general mood, decrease depression and loneliness, and distract from stress-inducing concerns to improve quality of life.";
+            case SEE: return "Description:Dogs trained to assist persons who are seeing impaired or blind.";
+            case SNIFF: return "Description:Dogs trained or having the ability to detect imminent seizures or cancers in humans, probably as a result of volatile chemical (odors) given off by the malignancy of the host.";
+            case _CERTIFIEDENTITYTYPE: return "Defines types of certifications for all entities";
+            case _CITIZENROLETYPE: return "A role type used to qualify a person's legal status within a country or nation.";
+            case CAS: return "A person who has fled his or her home country to find a safe place elsewhere.";
+            case CASM: return "A person who is someone of below legal age who has fled his or her home country, without his or her parents, to find a safe place elsewhere at time of categorization.";
+            case CN: return "A person who is legally recognized as a member of a nation or country, with associated rights and obligations.";
+            case CNRP: return "A foreigner who is present in a country (which is foreign to him/her) unlawfully or without the country's authorization (may be called an illegal alien).";
+            case CNRPM: return "A person who is below legal age present in a country, without his or her parents, (which is foreign to him/her) unlawfully or without the country's authorization.";
+            case CPCA: return "A non-country member admitted to the territory of a nation or country as a non-resident for an explicit purpose.";
+            case CRP: return "A foreigner who is a resident of the country but does not have citizenship.";
+            case CRPM: return "A person who is a resident below legal age of the country without his or her parents and does not have citizenship.";
+            case _CONTACTROLETYPE: return "Types of contact for Role code \"CON\"";
+            case _ADMINISTRATIVECONTACTROLETYPE: return "A contact role used for business and/or administrative purposes.";
+            case BILL: return "A contact role used to identify a person within a Provider organization that can be contacted for billing purposes (e.g. about the content of the Invoice).";
+            case ORG: return "A contact for an organization for administrative purposes. Contact role specifies a person acting as a liason for the organization.\r\n\n                        Example: HR Department representative.";
+            case PAYOR: return "A contact role used to identify a person within a Payor organization to whom this communication is addressed.";
+            case ECON: return "A contact designated for contact in emergent situations.";
+            case NOK: return "Played by an individual who is designated as the next of kin for another individual which scopes the role.";
+            case _IDENTIFIEDENTITYTYPE: return "Definition: A code representing the type of identifier that has been assigned to the identified entity (IDENT).\r\n\n                        \n                           Examples: Example values include Social Insurance Number, Product Catalog ID, Product Model Number.";
+            case _LOCATIONIDENTIFIEDENTITYROLECODE: return "Description:Describes types of identifiers other than the primary location registry identifier for a service delivery location.  Identifiers may be assigned by a local service delivery organization, a formal body capable of accrediting the location for the capability to provide specific services or the identifier may be assigned at a jurisdictional level.";
+            case ACHFID: return "Description:Identifier assigned to a  location by the organization responsible for accrediting the location.";
+            case JURID: return "Description:Identifier assigned to a location by a jurisdiction.";
+            case LOCHFID: return "Description:Identifier assigned to a  location by a local party (which could be the facility itself or organization overseeing a group of facilities).";
+            case _LIVINGSUBJECTPRODUCTIONCLASS: return "Code indicating the primary use for which a living subject is bred or grown";
+            case BF: return "Cattle used for meat production";
+            case BL: return "Chickens raised for meat";
+            case BR: return "Breeding/genetic stock";
+            case CO: return "Companion animals";
+            case DA: return "Milk production";
+            case DR: return "Draft animals";
+            case DU: return "Dual purpose.  Defined purposes based on species and breed";
+            case FI: return "Animals raised for their fur, hair or skins";
+            case LY: return "Chickens raised for egg production";
+            case MT: return "Animals raised for meat production";
+            case MU: return "Poultry flocks used for chick/poult production";
+            case PL: return "Animals rasied for recreation";
+            case RC: return "Animals raised for racing perfomance";
+            case SH: return "Animals raised for shows";
+            case VL: return "Cattle raised for veal meat production.  Implicit is the husbandry method.";
+            case WL: return "Sheep, goats and other mammals raised for their fiber";
+            case WO: return "Animals used to perform work";
+            case _MEDICATIONGENERALIZATIONROLETYPE: return "Identifies the specific hierarchical relationship between the playing and scoping medications. \r\n\n                        \n                           Examples: Generic, Generic Formulation, Therapeutic Class, etc.";
+            case DC: return "Description:A categorization of medicinal products by their therapeutic properties and/or main therapeutic use.";
+            case GD: return "Relates a manufactured drug product to the non-proprietary (generic) representation of its ingredients independent of strength, and form.\r\n\n                        The scoping entity identifies a unique combination of medicine ingredients; sometimes referred to as \"ingredient set\".";
+            case GDF: return "Relates a manufactured drug product to the non-proprietary (generic) representation of its ingredients and dose form, independent of strength of the ingredients. The scoping entity identifies a unique combination of medicine ingredients in a specific dose form.";
+            case GDS: return "Relates a manufactured drug product to the non-proprietary (generic) representation of is ingredients with their strength.  The scoping entity identifies a unique combination of medicine ingredients with their strength.";
+            case GDSF: return "Relates a manufactured drug product to the non-proprietary (generic) representation of its ingredients with their strength in a specific dose form. The scoping entity identifies a unique combination of medicine ingredients with their strength in a single dose form.";
+            case MGDSF: return "Relates a manufactured drug product to the non-proprietary (generic) representation of its ingredients with their strength in a specific dose form. The scoping entity identifies a unique combination of medicine ingredients with their strength in a single dose form.";
+            case _MEMBERROLETYPE: return "Types of membership for Role code \"MBR\"";
+            case TRB: return "A person who is a member of a tribe.";
+            case _PERSONALRELATIONSHIPROLETYPE: return "PersonalRelationshipRoleType";
+            case FAMMEMB: return "A relationship between two people characterizing their \"familial\" relationship";
+            case CHILD: return "The player of the role is a child of the scoping entity.";
+            case CHLDADOPT: return "The player of the role is a child taken into a family through legal means and raised by the scoping person (parent) as his or her own child.";
+            case DAUADOPT: return "The player of the role is a female child taken into a family through legal means and raised by the scoping person (parent) as his or her own child.";
+            case SONADOPT: return "The player of the role is a male child taken into a family through legal means and raised by the scoping person (parent) as his or her own child.";
+            case CHLDFOST: return "The player of the role is a child receiving parental care and nurture from the scoping person (parent) but not related to him or her through legal or blood ties.";
+            case DAUFOST: return "The player of the role is a female child receiving parental care and nurture from the scoping person (parent) but not related to him or her through legal or blood ties.";
+            case SONFOST: return "The player of the role is a male child receiving parental care and nurture from the scoping person (parent) but not related to him or her through legal or blood ties.";
+            case DAUC: return "Description: The player of the role is a female child (of any type) of scoping entity (parent)";
+            case DAU: return "The player of the role is a female offspring of the scoping entity (parent).";
+            case STPDAU: return "The player of the role is a daughter of the scoping person's spouse by a previous union.";
+            case NCHILD: return "The player of the role is an offspring of the scoping entity as determined by birth.";
+            case SON: return "The player of the role is a male offspring of the scoping entity (parent).";
+            case SONC: return "Description: The player of the role is a male child (of any type) of scoping entity (parent)";
+            case STPSON: return "The player of the role is a son of the scoping person's spouse by a previous union.";
+            case STPCHLD: return "The player of the role is a child of the scoping person's spouse by a previous union.";
+            case EXT: return "Description: A family member not having an immediate genetic or legal relationship e.g. Aunt, cousin, great grandparent, grandchild, grandparent, niece, nephew or uncle.";
+            case AUNT: return "The player of the role is a sister of the scoping person's mother or father.";
+            case MAUNT: return "Description:The player of the role is a biological sister of the scoping person's biological mother.";
+            case PAUNT: return "Description:The player of the role is a biological sister of the scoping person's biological father.";
+            case COUSN: return "The player of the role is a relative of the scoping person descended from a common ancestor, such as a 	grandparent, by two or more steps in a diverging line.";
+            case MCOUSN: return "Description:The player of the role is a biological relative of the scoping person descended from a common ancestor on the player's mother's side, such as a grandparent, by two or more steps in a diverging line.";
+            case PCOUSN: return "Description:The player of the role is a biological relative of the scoping person descended from a common ancestor on the player's father's side, such as a grandparent, by two or more steps in a diverging line.";
+            case GGRPRN: return "The player of the role is a parent of the scoping person's grandparent.";
+            case GGRFTH: return "The player of the role is the father of the scoping person's grandparent.";
+            case MGGRFTH: return "Description:The player of the role is the biological father of the scoping person's biological mother's parent.";
+            case PGGRFTH: return "Description:The player of the role is the biological father of the scoping person's biological father's parent.";
+            case GGRMTH: return "The player of the role is the mother of the scoping person's grandparent.";
+            case MGGRMTH: return "Description:The player of the role is the biological mother of the scoping person's biological mother's parent.";
+            case PGGRMTH: return "Description:The player of the role is the biological mother of the scoping person's biological father's parent.";
+            case MGGRPRN: return "Description:The player of the role is a biological parent of the scoping person's biological mother's parent.";
+            case PGGRPRN: return "Description:The player of the role is a biological parent of the scoping person's biological father's parent.";
+            case GRNDCHILD: return "The player of the role is a child of the scoping person's son or daughter.";
+            case GRNDDAU: return "The player of the role is a daughter of the scoping person's son or daughter.";
+            case GRNDSON: return "The player of the role is a son of the scoping person's son or daughter.";
+            case GRPRN: return "The player of the role is a parent of the scoping person's mother or father.";
+            case GRFTH: return "The player of the role is the father of the scoping person's mother or father.";
+            case MGRFTH: return "Description:The player of the role is the biological father of the scoping person's biological mother.";
+            case PGRFTH: return "Description:The player of the role is the biological father of the scoping person's biological father.";
+            case GRMTH: return "The player of the role is the mother of the scoping person's mother or father.";
+            case MGRMTH: return "Description:The player of the role is the biological mother of the scoping person's biological mother.";
+            case PGRMTH: return "Description:The player of the role is the biological mother of the scoping person's biological father.";
+            case MGRPRN: return "Description:The player of the role is the biological parent of the scoping person's biological mother.";
+            case PGRPRN: return "Description:The player of the role is the biological parent of the scoping person's biological father.";
+            case INLAW: return "A relationship between an individual and a member of their spousal partner's immediate family.";
+            case CHLDINLAW: return "The player of the role is the spouse of scoping person's child.";
+            case DAUINLAW: return "The player of the role is the wife of scoping person's son.";
+            case SONINLAW: return "The player of the role is the husband of scoping person's daughter.";
+            case PRNINLAW: return "The player of the role is the parent of scoping person's husband or wife.";
+            case FTHINLAW: return "The player of the role is the father of the scoping person's husband or wife.";
+            case MTHINLAW: return "The player of the role is the mother of the scoping person's husband or wife.";
+            case SIBINLAW: return "The player of the role is: (1) a sibling of the scoping person's spouse, or (2) the spouse of the scoping person's sibling, or (3) the spouse of a sibling of the scoping person's spouse.";
+            case BROINLAW: return "The player of the role is: (1) a brother of the scoping person's spouse, or (2) the husband of the scoping person's sister, or (3) the husband of a sister of the scoping person's spouse.";
+            case SISINLAW: return "The player of the role is: (1) a sister of the scoping person's spouse, or (2) the wife of the scoping person's brother, or (3) the wife of a brother of the scoping person's spouse.";
+            case NIENEPH: return "The player of the role is a child of scoping person's brother or sister or of the brother or sister of the 	scoping person's spouse.";
+            case NEPHEW: return "The player of the role is a son of the scoping person's brother or sister or of the brother or sister of the 	scoping person's spouse.";
+            case NIECE: return "The player of the role is a daughter of the scoping person's brother or sister or of the brother or sister of the 	scoping person's spouse.";
+            case UNCLE: return "The player of the role is a brother of the scoping person's mother or father.";
+            case MUNCLE: return "Description:The player of the role is a biological brother of the scoping person's biological mother.";
+            case PUNCLE: return "Description:The player of the role is a biological brother of the scoping person's biological father.";
+            case PRN: return "The player of the role is one who begets, gives birth to, or nurtures and raises the scoping entity (child).";
+            case ADOPTP: return "The player of the role (parent) has taken the scoper (child) into their family through legal means and raises them as his or her own child.";
+            case ADOPTF: return "The player of the role (father) is a male who has taken the scoper (child) into their family through legal means and raises them as his own child.";
+            case ADOPTM: return "The player of the role (father) is a female who has taken the scoper (child) into their family through legal means and raises them as her own child.";
+            case FTH: return "The player of the role is a male who begets or raises or nurtures the scoping entity (child).";
+            case FTHFOST: return "The player of the role (parent) who is a male state-certified caregiver responsible for the scoper (child) who has been placed in the parent's care. The placement of the child is usually arranged through the government or a social-service agency, and temporary.\r\n\n                        The state, via a jurisdiction recognized child protection agency, stands as in loco parentis to the child, making all legal decisions while the foster parent is responsible for the day-to-day care of the specified child.";
+            case NFTH: return "The player of the role is a male who begets the scoping entity (child).";
+            case NFTHF: return "Indicates the biologic male parent of a fetus.";
+            case STPFTH: return "The player of the role is the husband of scoping person's mother and not the scoping person's natural father.";
+            case MTH: return "The player of the role is a female who conceives, gives birth to, or raises and nurtures the scoping entity (child).";
+            case GESTM: return "The player is a female whose womb carries the fetus of the scoper.  Generally used when the gestational mother and natural mother are not the same.";
+            case MTHFOST: return "The player of the role (parent) who is a female state-certified caregiver responsible for the scoper (child) who has been placed in the parent's care. The placement of the child is usually arranged through the government or a social-service agency, and temporary.\r\n\n                        The state, via a jurisdiction recognized child protection agency, stands as in loco parentis to the child, making all legal decisions while the foster parent is responsible for the day-to-day care of the specified child.";
+            case NMTH: return "The player of the role is a female who conceives or gives birth to the scoping entity (child).";
+            case NMTHF: return "The player is the biologic female parent of the scoping fetus.";
+            case STPMTH: return "The player of the role is the wife of scoping person's father and not the scoping person's natural mother.";
+            case NPRN: return "natural parent";
+            case PRNFOST: return "The player of the role (parent) who is a state-certified caregiver responsible for the scoper (child) who has been placed in the parent's care. The placement of the child is usually arranged through the government or a social-service agency, and temporary.\r\n\n                        The state, via a jurisdiction recognized child protection agency, stands as in loco parentis to the child, making all legal decisions while the foster parent is responsible for the day-to-day care of the specified child.";
+            case STPPRN: return "The player of the role is the spouse of the scoping person's parent and not the scoping person's natural parent.";
+            case SIB: return "The player of the role shares one or both parents in common with the scoping entity.";
+            case BRO: return "The player of the role is a male sharing one or both parents in common with the scoping entity.";
+            case HBRO: return "The player of the role is a male related to the scoping entity by sharing only one biological parent.";
+            case NBRO: return "The player of the role is a male having the same biological parents as the scoping entity.";
+            case TWINBRO: return "The scoper was carried in the same womb as the male player and shares common biological parents.";
+            case FTWINBRO: return "The scoper was carried in the same womb as the male player and shares common biological parents but is the product of a distinct egg/sperm pair.";
+            case ITWINBRO: return "The male scoper is an offspring of the same egg-sperm pair as the male player.";
+            case STPBRO: return "The player of the role is a son of the scoping person's stepparent.";
+            case HSIB: return "The player of the role is related to the scoping entity by sharing only one biological parent.";
+            case HSIS: return "The player of the role is a female related to the scoping entity by sharing only one biological parent.";
+            case NSIB: return "The player of the role has both biological parents in common with the scoping entity.";
+            case NSIS: return "The player of the role is a female having the same biological parents as the scoping entity.";
+            case TWINSIS: return "The scoper was carried in the same womb as the female player and shares common biological parents.";
+            case FTWINSIS: return "The scoper was carried in the same womb as the female player and shares common biological parents but is the product of a distinct egg/sperm pair.";
+            case ITWINSIS: return "The female scoper is an offspring of the same egg-sperm pair as the female player.";
+            case TWIN: return "The scoper and player were carried in the same womb and shared common biological parents.";
+            case FTWIN: return "The scoper and player were carried in the same womb and share common biological parents but are the product of distinct egg/sperm pairs.";
+            case ITWIN: return "The scoper and player are offspring of the same egg-sperm pair.";
+            case SIS: return "The player of the role is a female sharing one or both parents in common with the scoping entity.";
+            case STPSIS: return "The player of the role is a daughter of the scoping person's stepparent.";
+            case STPSIB: return "The player of the role is a child of the scoping person's stepparent.";
+            case SIGOTHR: return "A person who is important to one's well being; especially a spouse or one in a similar relationship.  (The player is the one who is important)";
+            case DOMPART: return "The player of the role cohabits with the scoping person but is not the scoping person's spouse.";
+            case FMRSPS: return "Player of the role was previously joined to the scoping person in marriage and this marriage is now dissolved and inactive.\r\n\n                        \n                           Usage Note: This is significant to indicate as some jurisdictions have different legal requirements for former spouse to access the patient's record, from a general friend.";
+            case SPS: return "The player of the role is a marriage partner of the scoping person.";
+            case HUSB: return "The player of the role is a man joined to a woman (scoping person) in marriage.";
+            case WIFE: return "The player of the role is a woman joined to a man (scoping person) in marriage.";
+            case FRND: return "The player of the role is a person who is known, liked, and trusted by the scoping person.";
+            case NBOR: return "The player of the role lives near or next to the 	scoping person.";
+            case ONESELF: return "The relationship that a person has with his or her self.";
+            case ROOM: return "One who shares living quarters with the subject.";
+            case _POLICYORPROGRAMCOVERAGEROLETYPE: return "Description: A role recognized through the eligibility of an identified party for benefits covered under an insurance policy or a program based on meeting eligibility criteria.\r\n\n                        Eligibility as a covered party may be conditioned on the party meeting criteria to qualify for coverage under a policy or program, which may be mandated by law.  These criteria may be: \r\n\n                        \n                           \n                              The sole basis for coverage, e.g., being differently abled may qualify a person for disability coverage\r\n\n                           \n                           \n                              May more fully qualify a covered party role e.g, being differently abled may qualify an adult child as a dependent\r\n\n                           \n                           \n                              May impact the level of coverage for a covered party under a policy or program, e.g., being differently abled may qualify a program eligible for additional benefits.\r\n\n                           \n                        \n                        \n                           Discussion:  The Abstract Value Set \"CoverageRoleType\", which was developed for use in the Canadian realm \"pre-coordinate\" coverage roles with other roles that a covered party must play in order to be eligible for coverage, e.g., \"handicapped dependent\".   These role.codes may only be used with COVPTY to avoid overlapping concepts that would result from using them to specify the specializations of COVPTY, e.g., the role.class DEPEN should not be used with the role.code family dependent because that relationship has overlapping concepts due to the role.code precoodination and is conveyed in FICO with the personal relationship role that has a PART role link to the covered party role.  For the same reasons, the role.class DEPEN should not be used with the role.code HANDIC (handicapped dependent); the role.code DIFFABLE (differently abled) should be used instead.\r\n\n                        In summary, the coded concepts in the Abstract Value Set \"CoveredPartyRoleType\" can be \"post-coordinated\" with the \"RoleClassCoveredParty\" Abstract Value Set.  Decoupling these concepts is intended to support an expansive range of covered party concepts and their semantic comparability.";
+            case _COVERAGEROLETYPE: return "Role recognized through the issuance of insurance coverage to an identified covered party who has this relationship with the policy holder such as the policy holder themselves (self), spouse, child, etc";
+            case FAMDEP: return "The player of the role is dependent of the scoping entity.";
+            case HANDIC: return "Covered party is a dependent of the policy holder with a physical or mental disability causing a disadvantage that makes independent achievement unusually difficult.";
+            case INJ: return "Covered party is an injured party with a legal claim for compensation against a policy holder under an insurance policy.";
+            case SELF: return "Covered party is the policy holder.  Also known as the subscriber.";
+            case SPON: return "Covered party is an individual that the policy holder has assumed responsibility for, such as foster child or legal ward.";
+            case STUD: return "Covered party to an insurance policy has coverage through full-time or part-time attendance at a recognized educational institution as defined by a particular insurance policy.";
+            case FSTUD: return "Covered party to an insurance policy has coverage through full-time attendance at a recognized educational institution as defined by a particular insurance policy.";
+            case PSTUD: return "Covered party to an insurance policy has coverage through part-time attendance at a recognized educational institution as defined by a particular insurance policy.";
+            case ADOPT: return "A child taken into one's family through legal means and raised as one's own child.";
+            case GCHILD: return "A child of one's son or daughter.";
+            case GPARNT: return "parent of a parent of the subject.";
+            case NAT: return "A child as determined by birth.";
+            case NIENE: return "A child of one's brother or sister or of the brother or sister of one's spouse.";
+            case PARNT: return "One that begets or brings forth offspring or a person who brings up and cares for for another (Webster's Collegiate Dictionary)";
+            case SPSE: return "A marriage partner; a husband or wife.";
+            case STEP: return "A child receiving parental care and nurture from a person who is related to them through marriage to their parent.";
+            case _COVEREDPARTYROLETYPE: return "A role recognized through the eligibility of an identified living subject for benefits covered under an insurance policy or a program.  Eligibility as a covered party may be conditioned on a relationship with (1) the policy holder such as the policy holder who is covered as an individual under a poliy or as a party sponsored for coverage by the policy holder.\r\n\n                        \n                           Example:An employee as a subscriber; or (2) on being scoped another covered party such as the subscriber, as in the case of a dependent. \r\n\n                        \n                           Discussion:  The Abstract Value Set \"CoverageRoleType\", which was developed for use in the Canadian realm \"pre-coordinate\" coverage roles with other roles that a covered party must play in order to be eligible for coverage, e.g., \"handicapped dependent\".  Other codes in the Abstract Value Set CoveredPartyRoleType domain can be \"post-coordinated\" with the EligiblePartyRoleType codes to denote comparable concepts.  Decoupling the concepts is intended to support a wider range of concepts and semantic comparability of coded concepts.";
+            case _CLAIMANTCOVEREDPARTYROLETYPE: return "DescriptionA role recognized through the eligibility of a party play a claimant for benefits covered or provided under an insurance policy.";
+            case CRIMEVIC: return "Description: A person playing the role of program eligible under a program based on allegations of being the victim of a crime.\r\n\n                        \n                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is \"program eligible\" and the person's status as a crime victim meets jurisdictional or program criteria.";
+            case INJWKR: return "Description: A person playing the role of program eligible under a workers compensation program based on the filing of work-related injury claim.\r\n\n                        \n                           Discussion:  This CoveredPartyRoleType.code is used when the CoveredPartyRole class code is either \"program eligible\", a \"named insured\", and \"individual insured\",  or \"dependent\", and the person's status as differently abled or \"handicapped\" meets jurisdictional, policy, or program criteria.";
+            case _DEPENDENTCOVEREDPARTYROLETYPE: return "Description: A role recognized through the eligibility of a party to play a dependent for benefits covered or provided under a health insurance policy because of an association with the subscriber that is recognized by the policy underwriter.";
+            case COCBEN: return "Description: A person playing the role of an individual insured with continuity of coverage under a policy which is being terminated based on loss of original status that was the basis for coverage.  Criteria for qualifying for continuity of coverage may be set by law.\r\n\n                        \n                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either \"program eligible\" or \"subscriber\" and the person's status as a continuity of coverage beneficiary meets jurisdictional or policy criteria.";
+            case DIFFABL: return "Description: A person playing the role of program eligible under a program based on meeting criteria for health or functional limitation set by law or by the program.\r\n\n                        \n                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either \"program eligible\", \"named insured\", \"individual insured\", or \"dependent\", and the person's status as differently abled meets jurisdictional, policy, or program criteria.";
+            case WARD: return "Description: A person, who is a minor or is deemed incompetent, who plays the role of a program eligible where eligibility for coverage is based on meeting program eligibility criteria for status as a ward of a court or jurisdiction.\r\n\n                        \n                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is a \"claimant\", \"program eligible\", a \"named insured\", an \"individual Insured\" or a \"dependent\", and the person's status as a ward meets program or policy criteria. In the case of a ward covered under a program providing financial or health benefits, a governmental agency may take temporary custody of a minor or incompetent for his/her protection and care, e.g., if the ward is suffering from neglect or abuse, or has been in trouble with the law.";
+            case _INDIVIDUALINSUREDPARTYROLETYPE: return "A role recognized through the eligibility of a party to play an individual insured for benefits covered or provided under an insurance policy where the party is also the policy holder.";
+            case RETIREE: return "Description: A person playing the role of an individual insured under a policy based on meeting criteria for the employment status of retired set by law or the policy.\r\n\n                        \n                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either \"program eligible\" or \"subscriber\" and the person's status as a retiree meets jurisdictional or policy criteria.";
+            case _PROGRAMELIGIBLEPARTYROLETYPE: return "Description:A role recognized through the eligibility of a party to play a program eligible for benefits covered or provided under a program.";
+            case INDIG: return "Description: A person playing the role of program eligible under a program based on aboriginal ancestry or as a member of an aboriginal community.\r\n\n                        \n                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is \"program eligible\" and the person's status as a member of an indigenous people meets jurisdictional or program criteria.";
+            case MIL: return "Definition: A person playing the role of program eligible under a program based on military status.\r\n\n                        \n                           Discussion:  This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either \"program eligible\" or \"subscriber\" and the person's status as a member of the military meets jurisdictional or program criteria";
+            case ACTMIL: return "Description: A person playing the role of program eligible under a program based on active military status.\r\n\n                        \n                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either \"program eligible\" or \"subscriber\" and the persons status as active duty military meets jurisdictional or program criteria.";
+            case RETMIL: return "Description: A person playing the role of program eligible under a program based on retired military status.\r\n\n                        \n                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either \"program eligible\" or \"subscriber\" and the persons status as retired military meets jurisdictional or program criteria.";
+            case VET: return "Description: A person playing the role of program eligible under a program based on status as a military veteran.\r\n\n                        \n                           Discussion: This CoveredPartyRoleType.code is typically used when the CoveredPartyRole class code is either \"program eligible\" or \"subscriber\" and the persons status as a veteran meets jurisdictional or program criteria.";
+            case _SUBSCRIBERCOVEREDPARTYROLETYPE: return "Description: A role recognized through the eligibility of a party to play a subscriber for benefits covered or provided under a health insurance policy.";
+            case _RESEARCHSUBJECTROLEBASIS: return "Specifies the administrative functionality within a formal experimental design for which the ResearchSubject role was established.  Examples: screening - role is used for pre-enrollment evaluation portion of the design; enrolled - role is used for subjects admitted to the active treatment portion of the design.";
+            case ERL: return "Definition:The specific role being played by a research subject participating in the active treatment or primary data collection portion of a research study.";
+            case SCN: return "Definition:The specific role being played by a research subject participating in the pre-enrollment evaluation portion of  a research study.";
+            case _SERVICEDELIVERYLOCATIONROLETYPE: return "A role of a place that further classifies the setting (e.g., accident site, road side, work site, community location) in which services are delivered.";
+            case _DEDICATEDSERVICEDELIVERYLOCATIONROLETYPE: return "A role of a place that further classifies a setting that is intended to house the provision of services.";
+            case _DEDICATEDCLINICALLOCATIONROLETYPE: return "A role of a place that further classifies the clinical setting (e.g., cardiology clinic, primary care clinic, rehabilitation hospital, skilled nursing facility) in which care is delivered during an encounter.";
+            case DX: return "A practice setting where diagnostic procedures or therapeutic interventions are performed";
+            case CVDX: return "A practice setting where cardiovascular diagnostic procedures or therapeutic interventions are performed (e.g., cardiac catheterization lab, echocardiography suite)";
+            case CATH: return "Cardiac catheterization lab";
+            case ECHO: return "Echocardiography lab";
+            case GIDX: return "A practice setting where GI procedures (such as endoscopies) are performed";
+            case ENDOS: return "(X12N 261QD0000N)";
+            case RADDX: return "A practice setting where radiology services (diagnostic or therapeutic) are provided            (X12N 261QR0200N)";
+            case RADO: return "(X12N 261QX0203N)";
+            case RNEU: return "Neuroradiology unit";
+            case HOSP: return "An acute care institution that provides medical, surgical, or psychiatric care and treatment for the sick or the injured.";
+            case CHR: return "(1) A hospital including a physical plant and personnel that provides multidisciplinary diagnosis and treatment for diseases that have one or more of the following characteristics: is permanent; leaves residual disability; is caused by nonreversible pathological alteration; requires special training of the patient for rehabilitation; and/or may be expected to require a long period of supervision or care. In addition, patients require the safety, security, and shelter of these specialized inpatient or partial hospitalization settings. (2) A hospital that provides medical and skilled nursing services to patients with long-term illnesses who are not in an acute phase but who require an intensity of services not available in nursing homes";
+            case GACH: return "(X12N 282N00000N)";
+            case MHSP: return "A health care facility operated by the Department of Defense or other military operation.";
+            case PSYCHF: return "Healthcare facility that cares for patients with psychiatric illness(s).";
+            case RH: return "(X12N 283X00000N)";
+            case RHAT: return "Description: A location that plays the role of delivering services which may include life training and/or social support to people with addictions.";
+            case RHII: return "Description: A location that plays the role of delivering services which may include adaptation, rehabilitation and social integration services for people with intellectual and/or pervasive development disorders such as autism or severe behaviour disorder.";
+            case RHMAD: return "Description: A location that plays the role of delivering services which may social support services for adolescents who are pregnant or have child and are experiencing adaptation issues/difficulties in their current or eventual parenting role.";
+            case RHPI: return "Description: A location that plays the role of delivering services which may include adaptation, rehabilitation and social integration services for people with physical impairments.";
+            case RHPIH: return "Description: A location that plays the role of delivering services for people with hearing impairments.";
+            case RHPIMS: return "Description: A location that plays the role of delivering services for people with motor skill impairments.";
+            case RHPIVS: return "Description: A location that plays the role of delivering services for people with visual skill impairments.";
+            case RHYAD: return "Description: A location that plays the role of delivering services which may include life training and/or social support services for the adaption, rehabilitation and social integration of youths with adjustment difficulties.";
+            case HU: return "Hospital unit";
+            case BMTU: return "Bone marrow transplant unit";
+            case CCU: return "Coronary care unit";
+            case CHEST: return "A specialty unit in hospital that focuses on chronic respirator patients and pulmonary failure";
+            case EPIL: return "Epilepsy unit";
+            case ER: return "The section of a health care facility for providing rapid treatment to victims of sudden illness or trauma.";
+            case ETU: return "Emergency trauma unit";
+            case HD: return "Hemodialysis unit";
+            case HLAB: return "Description: A location that plays the role of delivering services which may include tests done based on clinical specimens to get health information about a patient as pertaining to the diagnosis, treatment and prevention of disease.  Hospital laboratories may be further divided into specialized units such as Anatomic Pathology, Microbiology, and Biochemistry.";
+            case INLAB: return "Description: A location that plays the role of delivering services which may include tests are done on clinical specimens to get health information about a patient pertaining to the diagnosis, treatment, and prevention of disease for a hospital visit longer than one day.";
+            case OUTLAB: return "Description: A location that plays the role of delivering services which may include tests are done on clinical specimens to get health information about a patient pertaining to the diagnosis, treatment, and prevention of disease for same day visits.";
+            case HRAD: return "Description: A location that plays the role of delivering services which may include the branch of medicine that uses ionizing and non-ionizing radiation to diagnose and treat diseases.  The radiology unit may be further divided into subspecialties such as Imaging, Cardiovascular, Thoracic, and Ultrasound.";
+            case HUSCS: return "Description: A location that plays the role of delivering services which may include collecting specimens and/or samples from patients for laboratory testing purposes, but does not perform any tests or analysis functions.";
+            case ICU: return "Intensive care unit";
+            case PEDICU: return "Pediatric intensive care unit";
+            case PEDNICU: return "Pediatric neonatal intensive care unit";
+            case INPHARM: return "Description: A location that plays the role of delivering services which may include providing judicious, safe, efficacious, appropriate and cost effective use of medicines for treatment of patients for visits longer than one day. The distinction between inpatient pharmacies and retail (or outpatient) pharmacies is that they are part of a patient's continuity of care while staying in the hospital.";
+            case MBL: return "Description: A location that plays the role of delivering services which include biochemistry, hematology, microbiology, immunochemistry, and toxicology.";
+            case NCCS: return "Neurology critical care and stroke unit";
+            case NS: return "Neurosurgery unit";
+            case OUTPHARM: return "Description: A location that plays the role of delivering services which may include providing judicious, safe, efficacious, appropriate and cost effective use of medicines for treatment of patients for outpatient visits and may also be used for discharge prescriptions.";
+            case PEDU: return "Pediatric unit";
+            case PHU: return "(X12N 273R00000N)";
+            case RHU: return "Rehabilitation hospital unit";
+            case SLEEP: return "(X12N 261QA1200N)";
+            case NCCF: return "Nursing or custodial care facility";
+            case SNF: return "(X12N 314000000N)";
+            case OF: return "Outpatient facility";
+            case ALL: return "Allergy clinic";
+            case AMPUT: return "Amputee clinic";
+            case BMTC: return "Bone marrow transplant clinic";
+            case BREAST: return "Breast clinic";
+            case CANC: return "Child and adolescent neurology clinic";
+            case CAPC: return "Child and adolescent psychiatry clinic";
+            case CARD: return "Ambulatory Health Care Facilities; Clinic/Center; Rehabilitation: Cardiac Facilities";
+            case PEDCARD: return "Pediatric cardiology clinic";
+            case COAG: return "Coagulation clinic";
+            case CRS: return "Colon and rectal surgery clinic";
+            case DERM: return "Dermatology clinic";
+            case ENDO: return "Endocrinology clinic";
+            case PEDE: return "Pediatric endocrinology clinic";
+            case ENT: return "Otorhinolaryngology clinic";
+            case FMC: return "Family medicine clinic";
+            case GI: return "Gastroenterology clinic";
+            case PEDGI: return "Pediatric gastroenterology clinic";
+            case GIM: return "General internal medicine clinic";
+            case GYN: return "Gynecology clinic";
+            case HEM: return "Hematology clinic";
+            case PEDHEM: return "Pediatric hematology clinic";
+            case HTN: return "Hypertension clinic";
+            case IEC: return "Focuses on assessing disability";
+            case INFD: return "Infectious disease clinic";
+            case PEDID: return "Pediatric infectious disease clinic";
+            case INV: return "Infertility clinic";
+            case LYMPH: return "Lympedema clinic";
+            case MGEN: return "Medical genetics clinic";
+            case NEPH: return "Nephrology clinic";
+            case PEDNEPH: return "Pediatric nephrology clinic";
+            case NEUR: return "Neurology clinic";
+            case OB: return "Obstetrics clinic";
+            case OMS: return "Oral and maxillofacial surgery clinic";
+            case ONCL: return "Medical oncology clinic";
+            case PEDHO: return "Pediatric oncology clinic";
+            case OPH: return "Opthalmology clinic";
+            case OPTC: return "Description: A location that plays the role of delivering services which may include examination, diagnosis, treatment, management, and prevention of diseases and disorders of the eye as well as prescribing and fitting appropriate corrective lenses (glasses or contact lenses) as needed.  Optometry clinics may also provide tests for visual field screening, measuring intra-ocular pressure and ophthalmoscopy, as and when required.";
+            case ORTHO: return "Orthopedics clinic";
+            case HAND: return "Hand clinic";
+            case PAINCL: return "(X12N 261QP3300N)";
+            case PC: return "(X12N 261QP2300N)";
+            case PEDC: return "Pediatrics clinic";
+            case PEDRHEUM: return "Pediatric rheumatology clinic";
+            case POD: return "(X12N 261QP1100N)";
+            case PREV: return "Preventive medicine clinic";
+            case PROCTO: return "Proctology clinic";
+            case PROFF: return "Location where healthcare service was delivered, identified as the healthcare provider's practice office.";
+            case PROS: return "Prosthodontics clinic";
+            case PSI: return "Psychology clinic";
+            case PSY: return "Psychiatry clinic";
+            case RHEUM: return "Rheumatology clinic";
+            case SPMED: return "Sports medicine clinic";
+            case SU: return "Surgery clinic";
+            case PLS: return "Plastic surgery clinic";
+            case URO: return "Urology clinic";
+            case TR: return "Transplant clinic";
+            case TRAVEL: return "Travel and geographic medicine clinic";
+            case WND: return "Wound clinic";
+            case RTF: return "Residential treatment facility";
+            case PRC: return "Pain rehabilitation center";
+            case SURF: return "(X12N 324500000N)";
+            case _DEDICATEDNONCLINICALLOCATIONROLETYPE: return "A role of a place that further classifies a setting that is intended to house the provision of non-clinical services.";
+            case DADDR: return "Location address where medical supplies were transported to for use.";
+            case MOBL: return "Location (mobile) where healthcare service was delivered.";
+            case AMB: return "Location (mobile) where healthcare service was delivered, identified specifically as an ambulance.";
+            case PHARM: return "Location where healthcare service was delivered, identified as a pharmacy.";
+            case _INCIDENTALSERVICEDELIVERYLOCATIONROLETYPE: return "IncidentalServiceDeliveryLocationRoleType";
+            case ACC: return "Location of an accident where healthcare service was delivered, such as a roadside.";
+            case COMM: return "Community location where healthcare is delivered.";
+            case CSC: return "Description: A location that plays the role of delivering services which may include providing front-line services to the population of a defined geographic area such as: healthcare services and social services, preventive or curative, rehabilitation or reintegration.";
+            case PTRES: return "location where healthcare was delivered which is the residence of the Patient.";
+            case SCHOOL: return "Location where healthcare service was delivered, identified as a school or educational facility.";
+            case UPC: return "Description: A location that plays the role of delivering services which may include: social emergency services required for a young person as required under any jurisdictional youth laws, child placement, and family mediation in the defined geographical area the SDL is responsible for. It may provide expertise in a judiciary setting on child custody, adoption and biological history research.";
+            case WORK: return "Location where healthcare service was delivered, identified as a work place.";
+            case _SPECIMENROLETYPE: return "SpecimenRoleType";
+            case C: return "A specimen used for initial calibration settings of an instrument";
+            case G: return "A set of patient samples in which the individuals of the group may or may not be identified.";
+            case L: return "Aliquots of individual specimens combined to form a single specimen representing all of the included individuals.";
+            case P: return "A specimen that has been collected from a patient.";
+            case Q: return "A specimen specifically used to verify the sensitivity, specificity, accuracy or other perfomance parameter of a diagnostic test.";
+            case B: return "Quality Control specimen submitted to the lab whose identity and composition is not known to the lab.";
+            case E: return "An electronically simulated QC specimen";
+            case F: return "Specimen used for testing proficiency of an organization performing testing (how does this differ from O?)";
+            case O: return "A specimen used for evaluation of operator proficiency (operator in what context?)";
+            case V: return "A specimen used for periodic calibration checks of instruments";
+            case R: return "A portion of an original patent sample that is tested at the same time as the original sample";
+            case CLAIM: return "A party that makes a claim for coverage under a policy.";
+            case COMMUNITYLABORATORY: return "Community Laboratory";
+            case GT: return "An individual or organization that makes or gives a promise, assurance, pledge to pay or has paid the healthcare service provider.";
+            case HOMEHEALTH: return "Home Health";
+            case LABORATORY: return "Laboratory";
+            case PATHOLOGIST: return "Pathologist";
+            case PH: return "Policy holder for the insurance policy.";
+            case PHLEBOTOMIST: return "Phlebotomist";
+            case PROG: return "A party that meets the eligibility criteria for coverage under a program.";
+            case PT: return "The recipient for the service(s) and/or product(s) when they are not the covered party.";
+            case SUBJECT: return "Self";
+            case THIRDPARTY: return "Third Party";
+            case DEP: return "";
+            case DEPEN: return "A party covered under a policy based on association with a subscriber.";
+            case FM: return "A member of the covered party's family. This could be the spouse, a parent, a grand parent, a sibling, etc.";
+            case INDIV: return "A party covered under a policy as the policyholder.";
+            case NAMED: return "A party to an insurance policy to whom the insurer agrees to indemnify for losses, provides benefits for, or renders services.";
+            case PSYCHCF: return "";
+            case SUBSCR: return "A party covered under a policy based on association with a sponsor who is the policy holder, and whose association may provide for the eligibility of dependents for coverage";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _AFFILIATIONROLETYPE: return "AffiliationRoleType";
+            case _AGENTROLETYPE: return "AgentRoleType";
+            case AMENDER: return "amender";
+            case CLASSIFIER: return "classifier";
+            case CONSENTER: return "consenter";
+            case CONSWIT: return "consent witness";
+            case COPART: return "co-participant";
+            case DECLASSIFIER: return "declassifier";
+            case DELEGATEE: return "delegatee";
+            case DELEGATOR: return "delegator";
+            case DOWNGRDER: return "downgrader";
+            case DRIVCLASSIFIER: return "derivative classifier";
+            case GRANTEE: return "grantee";
+            case GRANTOR: return "grantor";
+            case INTPRTER: return "interpreter";
+            case REVIEWER: return "reviewer";
+            case VALIDATOR: return "validator";
+            case _COVERAGESPONSORROLETYPE: return "CoverageSponsorRoleType";
+            case FULLINS: return "Fully insured coverage sponsor";
+            case SELFINS: return "Self insured coverage sponsor";
+            case _PAYORROLETYPE: return "PayorRoleType";
+            case ENROLBKR: return "Enrollment Broker";
+            case TPA: return "Third party administrator";
+            case UMO: return "Utilization management organization";
+            case RESPRSN: return "responsible party";
+            case EXCEST: return "executor of estate";
+            case GUADLTM: return "guardian ad lidem";
+            case GUARD: return "guardian";
+            case POWATT: return "power of attorney";
+            case DPOWATT: return "durable power of attorney";
+            case HPOWATT: return "healthcare power of attorney";
+            case SPOWATT: return "special power of attorney";
+            case _ASSIGNEDROLETYPE: return "AssignedRoleType";
+            case _ASSIGNEDNONPERSONLIVINGSUBJECTROLETYPE: return "AssignedNonPersonLivingSubjectRoleType";
+            case ASSIST: return "Assistive non-person living subject";
+            case BIOTH: return "Biotherapeutic non-person living subject";
+            case ANTIBIOT: return "Antibiotic";
+            case DEBR: return "Debridement";
+            case CCO: return "Clinical Companion";
+            case SEE: return "Seeing";
+            case SNIFF: return "Sniffing";
+            case _CERTIFIEDENTITYTYPE: return "CertifiedEntityType";
+            case _CITIZENROLETYPE: return "CitizenRoleType";
+            case CAS: return "asylum seeker";
+            case CASM: return "single minor asylum seeker";
+            case CN: return "national";
+            case CNRP: return "non-country member without residence permit";
+            case CNRPM: return "non-country member minor without residence permit";
+            case CPCA: return "permit card applicant";
+            case CRP: return "non-country member with residence permit";
+            case CRPM: return "non-country member minor with residence permit";
+            case _CONTACTROLETYPE: return "ContactRoleType";
+            case _ADMINISTRATIVECONTACTROLETYPE: return "AdministrativeContactRoleType";
+            case BILL: return "Billing Contact";
+            case ORG: return "organizational contact";
+            case PAYOR: return "Payor Contact";
+            case ECON: return "emergency contact";
+            case NOK: return "next of kin";
+            case _IDENTIFIEDENTITYTYPE: return "IdentifiedEntityType";
+            case _LOCATIONIDENTIFIEDENTITYROLECODE: return "LocationIdentifiedEntityRoleCode";
+            case ACHFID: return "accreditation location identifier";
+            case JURID: return "jurisdiction location identifier";
+            case LOCHFID: return "local location identifier";
+            case _LIVINGSUBJECTPRODUCTIONCLASS: return "LivingSubjectProductionClass";
+            case BF: return "Beef";
+            case BL: return "Broiler";
+            case BR: return "Breeder";
+            case CO: return "Companion";
+            case DA: return "Dairy";
+            case DR: return "Draft";
+            case DU: return "Dual";
+            case FI: return "Fiber";
+            case LY: return "Layer";
+            case MT: return "Meat";
+            case MU: return "Multiplier";
+            case PL: return "Pleasure";
+            case RC: return "Racing";
+            case SH: return "Show";
+            case VL: return "Veal";
+            case WL: return "Wool";
+            case WO: return "Working";
+            case _MEDICATIONGENERALIZATIONROLETYPE: return "MedicationGeneralizationRoleType";
+            case DC: return "therapeutic class";
+            case GD: return "generic drug";
+            case GDF: return "generic drug form";
+            case GDS: return "generic drug strength";
+            case GDSF: return "generic drug strength form";
+            case MGDSF: return "manufactured drug strength form";
+            case _MEMBERROLETYPE: return "MemberRoleType";
+            case TRB: return "Tribal Member";
+            case _PERSONALRELATIONSHIPROLETYPE: return "PersonalRelationshipRoleType";
+            case FAMMEMB: return "family member";
+            case CHILD: return "child";
+            case CHLDADOPT: return "adopted child";
+            case DAUADOPT: return "adopted daughter";
+            case SONADOPT: return "adopted son";
+            case CHLDFOST: return "foster child";
+            case DAUFOST: return "foster daughter";
+            case SONFOST: return "foster son";
+            case DAUC: return "daughter";
+            case DAU: return "natural daughter";
+            case STPDAU: return "stepdaughter";
+            case NCHILD: return "natural child";
+            case SON: return "natural son";
+            case SONC: return "son";
+            case STPSON: return "stepson";
+            case STPCHLD: return "step child";
+            case EXT: return "extended family member";
+            case AUNT: return "aunt";
+            case MAUNT: return "maternal aunt";
+            case PAUNT: return "paternal aunt";
+            case COUSN: return "cousin";
+            case MCOUSN: return "maternal cousin";
+            case PCOUSN: return "paternal cousin";
+            case GGRPRN: return "great grandparent";
+            case GGRFTH: return "great grandfather";
+            case MGGRFTH: return "maternal great-grandfather";
+            case PGGRFTH: return "paternal great-grandfather";
+            case GGRMTH: return "great grandmother";
+            case MGGRMTH: return "maternal great-grandmother";
+            case PGGRMTH: return "paternal great-grandmother";
+            case MGGRPRN: return "maternal great-grandparent";
+            case PGGRPRN: return "paternal great-grandparent";
+            case GRNDCHILD: return "grandchild";
+            case GRNDDAU: return "granddaughter";
+            case GRNDSON: return "grandson";
+            case GRPRN: return "grandparent";
+            case GRFTH: return "grandfather";
+            case MGRFTH: return "maternal grandfather";
+            case PGRFTH: return "paternal grandfather";
+            case GRMTH: return "grandmother";
+            case MGRMTH: return "maternal grandmother";
+            case PGRMTH: return "paternal grandmother";
+            case MGRPRN: return "maternal grandparent";
+            case PGRPRN: return "paternal grandparent";
+            case INLAW: return "inlaw";
+            case CHLDINLAW: return "child-in-law";
+            case DAUINLAW: return "daughter in-law";
+            case SONINLAW: return "son in-law";
+            case PRNINLAW: return "parent in-law";
+            case FTHINLAW: return "father-in-law";
+            case MTHINLAW: return "mother-in-law";
+            case SIBINLAW: return "sibling in-law";
+            case BROINLAW: return "brother-in-law";
+            case SISINLAW: return "sister-in-law";
+            case NIENEPH: return "niece/nephew";
+            case NEPHEW: return "nephew";
+            case NIECE: return "niece";
+            case UNCLE: return "uncle";
+            case MUNCLE: return "maternal uncle";
+            case PUNCLE: return "paternal uncle";
+            case PRN: return "parent";
+            case ADOPTP: return "adoptive parent";
+            case ADOPTF: return "adoptive father";
+            case ADOPTM: return "adoptive mother";
+            case FTH: return "father";
+            case FTHFOST: return "foster father";
+            case NFTH: return "natural father";
+            case NFTHF: return "natural father of fetus";
+            case STPFTH: return "stepfather";
+            case MTH: return "mother";
+            case GESTM: return "gestational mother";
+            case MTHFOST: return "foster mother";
+            case NMTH: return "natural mother";
+            case NMTHF: return "natural mother of fetus";
+            case STPMTH: return "stepmother";
+            case NPRN: return "natural parent";
+            case PRNFOST: return "foster parent";
+            case STPPRN: return "step parent";
+            case SIB: return "sibling";
+            case BRO: return "brother";
+            case HBRO: return "half-brother";
+            case NBRO: return "natural brother";
+            case TWINBRO: return "twin brother";
+            case FTWINBRO: return "fraternal twin brother";
+            case ITWINBRO: return "identical twin brother";
+            case STPBRO: return "stepbrother";
+            case HSIB: return "half-sibling";
+            case HSIS: return "half-sister";
+            case NSIB: return "natural sibling";
+            case NSIS: return "natural sister";
+            case TWINSIS: return "twin sister";
+            case FTWINSIS: return "fraternal twin sister";
+            case ITWINSIS: return "identical twin sister";
+            case TWIN: return "twin";
+            case FTWIN: return "fraternal twin";
+            case ITWIN: return "identical twin";
+            case SIS: return "sister";
+            case STPSIS: return "stepsister";
+            case STPSIB: return "step sibling";
+            case SIGOTHR: return "significant other";
+            case DOMPART: return "domestic partner";
+            case FMRSPS: return "former spouse";
+            case SPS: return "spouse";
+            case HUSB: return "husband";
+            case WIFE: return "wife";
+            case FRND: return "unrelated friend";
+            case NBOR: return "neighbor";
+            case ONESELF: return "self";
+            case ROOM: return "Roommate";
+            case _POLICYORPROGRAMCOVERAGEROLETYPE: return "PolicyOrProgramCoverageRoleType";
+            case _COVERAGEROLETYPE: return "CoverageRoleType";
+            case FAMDEP: return "family dependent";
+            case HANDIC: return "handicapped dependent";
+            case INJ: return "injured plaintiff";
+            case SELF: return "self";
+            case SPON: return "sponsored dependent";
+            case STUD: return "student";
+            case FSTUD: return "full-time student";
+            case PSTUD: return "part-time student";
+            case ADOPT: return "adopted child";
+            case GCHILD: return "grandchild";
+            case GPARNT: return "grandparent";
+            case NAT: return "natural child";
+            case NIENE: return "niece/nephew";
+            case PARNT: return "parent";
+            case SPSE: return "spouse";
+            case STEP: return "step child";
+            case _COVEREDPARTYROLETYPE: return "covered party role type";
+            case _CLAIMANTCOVEREDPARTYROLETYPE: return "ClaimantCoveredPartyRoleType";
+            case CRIMEVIC: return "crime victim";
+            case INJWKR: return "injured worker";
+            case _DEPENDENTCOVEREDPARTYROLETYPE: return "DependentCoveredPartyRoleType";
+            case COCBEN: return "continuity of coverage beneficiary";
+            case DIFFABL: return "differently abled";
+            case WARD: return "ward";
+            case _INDIVIDUALINSUREDPARTYROLETYPE: return "IndividualInsuredPartyRoleType";
+            case RETIREE: return "retiree";
+            case _PROGRAMELIGIBLEPARTYROLETYPE: return "ProgramEligiblePartyRoleType";
+            case INDIG: return "member of an indigenous people";
+            case MIL: return "military";
+            case ACTMIL: return "active duty military";
+            case RETMIL: return "retired military";
+            case VET: return "veteran";
+            case _SUBSCRIBERCOVEREDPARTYROLETYPE: return "SubscriberCoveredPartyRoleType";
+            case _RESEARCHSUBJECTROLEBASIS: return "ResearchSubjectRoleBasis";
+            case ERL: return "enrollment";
+            case SCN: return "screening";
+            case _SERVICEDELIVERYLOCATIONROLETYPE: return "ServiceDeliveryLocationRoleType";
+            case _DEDICATEDSERVICEDELIVERYLOCATIONROLETYPE: return "DedicatedServiceDeliveryLocationRoleType";
+            case _DEDICATEDCLINICALLOCATIONROLETYPE: return "DedicatedClinicalLocationRoleType";
+            case DX: return "Diagnostics or therapeutics unit";
+            case CVDX: return "Cardiovascular diagnostics or therapeutics unit";
+            case CATH: return "Cardiac catheterization lab";
+            case ECHO: return "Echocardiography lab";
+            case GIDX: return "Gastroenterology diagnostics or therapeutics lab";
+            case ENDOS: return "Endoscopy lab";
+            case RADDX: return "Radiology diagnostics or therapeutics unit";
+            case RADO: return "Radiation oncology unit";
+            case RNEU: return "Neuroradiology unit";
+            case HOSP: return "Hospital";
+            case CHR: return "Chronic Care Facility";
+            case GACH: return "Hospitals; General Acute Care Hospital";
+            case MHSP: return "Military Hospital";
+            case PSYCHF: return "Psychatric Care Facility";
+            case RH: return "Rehabilitation hospital";
+            case RHAT: return "addiction treatment center";
+            case RHII: return "intellectual impairment center";
+            case RHMAD: return "parents with adjustment difficulties center";
+            case RHPI: return "physical impairment center";
+            case RHPIH: return "physical impairment - hearing center";
+            case RHPIMS: return "physical impairment - motor skills center";
+            case RHPIVS: return "physical impairment - visual skills center";
+            case RHYAD: return "youths with adjustment difficulties center";
+            case HU: return "Hospital unit";
+            case BMTU: return "Bone marrow transplant unit";
+            case CCU: return "Coronary care unit";
+            case CHEST: return "Chest unit";
+            case EPIL: return "Epilepsy unit";
+            case ER: return "Emergency room";
+            case ETU: return "Emergency trauma unit";
+            case HD: return "Hemodialysis unit";
+            case HLAB: return "hospital laboratory";
+            case INLAB: return "inpatient laboratory";
+            case OUTLAB: return "outpatient laboratory";
+            case HRAD: return "radiology unit";
+            case HUSCS: return "specimen collection site";
+            case ICU: return "Intensive care unit";
+            case PEDICU: return "Pediatric intensive care unit";
+            case PEDNICU: return "Pediatric neonatal intensive care unit";
+            case INPHARM: return "inpatient pharmacy";
+            case MBL: return "medical laboratory";
+            case NCCS: return "Neurology critical care and stroke unit";
+            case NS: return "Neurosurgery unit";
+            case OUTPHARM: return "outpatient pharmacy";
+            case PEDU: return "Pediatric unit";
+            case PHU: return "Psychiatric hospital unit";
+            case RHU: return "Rehabilitation hospital unit";
+            case SLEEP: return "Sleep disorders unit";
+            case NCCF: return "Nursing or custodial care facility";
+            case SNF: return "Skilled nursing facility";
+            case OF: return "Outpatient facility";
+            case ALL: return "Allergy clinic";
+            case AMPUT: return "Amputee clinic";
+            case BMTC: return "Bone marrow transplant clinic";
+            case BREAST: return "Breast clinic";
+            case CANC: return "Child and adolescent neurology clinic";
+            case CAPC: return "Child and adolescent psychiatry clinic";
+            case CARD: return "Ambulatory Health Care Facilities; Clinic/Center; Rehabilitation: Cardiac Facilities";
+            case PEDCARD: return "Pediatric cardiology clinic";
+            case COAG: return "Coagulation clinic";
+            case CRS: return "Colon and rectal surgery clinic";
+            case DERM: return "Dermatology clinic";
+            case ENDO: return "Endocrinology clinic";
+            case PEDE: return "Pediatric endocrinology clinic";
+            case ENT: return "Otorhinolaryngology clinic";
+            case FMC: return "Family medicine clinic";
+            case GI: return "Gastroenterology clinic";
+            case PEDGI: return "Pediatric gastroenterology clinic";
+            case GIM: return "General internal medicine clinic";
+            case GYN: return "Gynecology clinic";
+            case HEM: return "Hematology clinic";
+            case PEDHEM: return "Pediatric hematology clinic";
+            case HTN: return "Hypertension clinic";
+            case IEC: return "Impairment evaluation center";
+            case INFD: return "Infectious disease clinic";
+            case PEDID: return "Pediatric infectious disease clinic";
+            case INV: return "Infertility clinic";
+            case LYMPH: return "Lympedema clinic";
+            case MGEN: return "Medical genetics clinic";
+            case NEPH: return "Nephrology clinic";
+            case PEDNEPH: return "Pediatric nephrology clinic";
+            case NEUR: return "Neurology clinic";
+            case OB: return "Obstetrics clinic";
+            case OMS: return "Oral and maxillofacial surgery clinic";
+            case ONCL: return "Medical oncology clinic";
+            case PEDHO: return "Pediatric oncology clinic";
+            case OPH: return "Opthalmology clinic";
+            case OPTC: return "optometry clinic";
+            case ORTHO: return "Orthopedics clinic";
+            case HAND: return "Hand clinic";
+            case PAINCL: return "Pain clinic";
+            case PC: return "Primary care clinic";
+            case PEDC: return "Pediatrics clinic";
+            case PEDRHEUM: return "Pediatric rheumatology clinic";
+            case POD: return "Podiatry clinic";
+            case PREV: return "Preventive medicine clinic";
+            case PROCTO: return "Proctology clinic";
+            case PROFF: return "Provider's Office";
+            case PROS: return "Prosthodontics clinic";
+            case PSI: return "Psychology clinic";
+            case PSY: return "Psychiatry clinic";
+            case RHEUM: return "Rheumatology clinic";
+            case SPMED: return "Sports medicine clinic";
+            case SU: return "Surgery clinic";
+            case PLS: return "Plastic surgery clinic";
+            case URO: return "Urology clinic";
+            case TR: return "Transplant clinic";
+            case TRAVEL: return "Travel and geographic medicine clinic";
+            case WND: return "Wound clinic";
+            case RTF: return "Residential treatment facility";
+            case PRC: return "Pain rehabilitation center";
+            case SURF: return "Substance use rehabilitation facility";
+            case _DEDICATEDNONCLINICALLOCATIONROLETYPE: return "DedicatedNonClinicalLocationRoleType";
+            case DADDR: return "Delivery Address";
+            case MOBL: return "Mobile Unit";
+            case AMB: return "Ambulance";
+            case PHARM: return "Pharmacy";
+            case _INCIDENTALSERVICEDELIVERYLOCATIONROLETYPE: return "IncidentalServiceDeliveryLocationRoleType";
+            case ACC: return "accident site";
+            case COMM: return "Community Location";
+            case CSC: return "community service center";
+            case PTRES: return "Patient's Residence";
+            case SCHOOL: return "school";
+            case UPC: return "underage protection center";
+            case WORK: return "work site";
+            case _SPECIMENROLETYPE: return "SpecimenRoleType";
+            case C: return "Calibrator";
+            case G: return "Group";
+            case L: return "Pool";
+            case P: return "Patient";
+            case Q: return "Quality Control";
+            case B: return "Blind";
+            case E: return "Electronic QC";
+            case F: return "Filler Proficiency";
+            case O: return "Operator Proficiency";
+            case V: return "Verifying";
+            case R: return "Replicate";
+            case CLAIM: return "claimant";
+            case COMMUNITYLABORATORY: return "Community Laboratory";
+            case GT: return "Guarantor";
+            case HOMEHEALTH: return "Home Health";
+            case LABORATORY: return "Laboratory";
+            case PATHOLOGIST: return "Pathologist";
+            case PH: return "Policy Holder";
+            case PHLEBOTOMIST: return "Phlebotomist";
+            case PROG: return "program eligible";
+            case PT: return "Patient";
+            case SUBJECT: return "Self";
+            case THIRDPARTY: return "Third Party";
+            case DEP: return "DEP";
+            case DEPEN: return "dependent";
+            case FM: return "Family Member";
+            case INDIV: return "individual";
+            case NAMED: return "named insured";
+            case PSYCHCF: return "PSYCHCF";
+            case SUBSCR: return "subscriber";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleCodeEnumFactory.java
new file mode 100644
index 00000000000..098ce49567f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleCodeEnumFactory.java
@@ -0,0 +1,1642 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3RoleCodeEnumFactory implements EnumFactory {
+
+  public V3RoleCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_AffiliationRoleType".equals(codeString))
+      return V3RoleCode._AFFILIATIONROLETYPE;
+    if ("_AgentRoleType".equals(codeString))
+      return V3RoleCode._AGENTROLETYPE;
+    if ("AMENDER".equals(codeString))
+      return V3RoleCode.AMENDER;
+    if ("CLASSIFIER".equals(codeString))
+      return V3RoleCode.CLASSIFIER;
+    if ("CONSENTER".equals(codeString))
+      return V3RoleCode.CONSENTER;
+    if ("CONSWIT".equals(codeString))
+      return V3RoleCode.CONSWIT;
+    if ("COPART".equals(codeString))
+      return V3RoleCode.COPART;
+    if ("DECLASSIFIER".equals(codeString))
+      return V3RoleCode.DECLASSIFIER;
+    if ("DELEGATEE".equals(codeString))
+      return V3RoleCode.DELEGATEE;
+    if ("DELEGATOR".equals(codeString))
+      return V3RoleCode.DELEGATOR;
+    if ("DOWNGRDER".equals(codeString))
+      return V3RoleCode.DOWNGRDER;
+    if ("DRIVCLASSIFIER".equals(codeString))
+      return V3RoleCode.DRIVCLASSIFIER;
+    if ("GRANTEE".equals(codeString))
+      return V3RoleCode.GRANTEE;
+    if ("GRANTOR".equals(codeString))
+      return V3RoleCode.GRANTOR;
+    if ("INTPRTER".equals(codeString))
+      return V3RoleCode.INTPRTER;
+    if ("REVIEWER".equals(codeString))
+      return V3RoleCode.REVIEWER;
+    if ("VALIDATOR".equals(codeString))
+      return V3RoleCode.VALIDATOR;
+    if ("_CoverageSponsorRoleType".equals(codeString))
+      return V3RoleCode._COVERAGESPONSORROLETYPE;
+    if ("FULLINS".equals(codeString))
+      return V3RoleCode.FULLINS;
+    if ("SELFINS".equals(codeString))
+      return V3RoleCode.SELFINS;
+    if ("_PayorRoleType".equals(codeString))
+      return V3RoleCode._PAYORROLETYPE;
+    if ("ENROLBKR".equals(codeString))
+      return V3RoleCode.ENROLBKR;
+    if ("TPA".equals(codeString))
+      return V3RoleCode.TPA;
+    if ("UMO".equals(codeString))
+      return V3RoleCode.UMO;
+    if ("RESPRSN".equals(codeString))
+      return V3RoleCode.RESPRSN;
+    if ("EXCEST".equals(codeString))
+      return V3RoleCode.EXCEST;
+    if ("GUADLTM".equals(codeString))
+      return V3RoleCode.GUADLTM;
+    if ("GUARD".equals(codeString))
+      return V3RoleCode.GUARD;
+    if ("POWATT".equals(codeString))
+      return V3RoleCode.POWATT;
+    if ("DPOWATT".equals(codeString))
+      return V3RoleCode.DPOWATT;
+    if ("HPOWATT".equals(codeString))
+      return V3RoleCode.HPOWATT;
+    if ("SPOWATT".equals(codeString))
+      return V3RoleCode.SPOWATT;
+    if ("_AssignedRoleType".equals(codeString))
+      return V3RoleCode._ASSIGNEDROLETYPE;
+    if ("_AssignedNonPersonLivingSubjectRoleType".equals(codeString))
+      return V3RoleCode._ASSIGNEDNONPERSONLIVINGSUBJECTROLETYPE;
+    if ("ASSIST".equals(codeString))
+      return V3RoleCode.ASSIST;
+    if ("BIOTH".equals(codeString))
+      return V3RoleCode.BIOTH;
+    if ("ANTIBIOT".equals(codeString))
+      return V3RoleCode.ANTIBIOT;
+    if ("DEBR".equals(codeString))
+      return V3RoleCode.DEBR;
+    if ("CCO".equals(codeString))
+      return V3RoleCode.CCO;
+    if ("SEE".equals(codeString))
+      return V3RoleCode.SEE;
+    if ("SNIFF".equals(codeString))
+      return V3RoleCode.SNIFF;
+    if ("_CertifiedEntityType".equals(codeString))
+      return V3RoleCode._CERTIFIEDENTITYTYPE;
+    if ("_CitizenRoleType".equals(codeString))
+      return V3RoleCode._CITIZENROLETYPE;
+    if ("CAS".equals(codeString))
+      return V3RoleCode.CAS;
+    if ("CASM".equals(codeString))
+      return V3RoleCode.CASM;
+    if ("CN".equals(codeString))
+      return V3RoleCode.CN;
+    if ("CNRP".equals(codeString))
+      return V3RoleCode.CNRP;
+    if ("CNRPM".equals(codeString))
+      return V3RoleCode.CNRPM;
+    if ("CPCA".equals(codeString))
+      return V3RoleCode.CPCA;
+    if ("CRP".equals(codeString))
+      return V3RoleCode.CRP;
+    if ("CRPM".equals(codeString))
+      return V3RoleCode.CRPM;
+    if ("_ContactRoleType".equals(codeString))
+      return V3RoleCode._CONTACTROLETYPE;
+    if ("_AdministrativeContactRoleType".equals(codeString))
+      return V3RoleCode._ADMINISTRATIVECONTACTROLETYPE;
+    if ("BILL".equals(codeString))
+      return V3RoleCode.BILL;
+    if ("ORG".equals(codeString))
+      return V3RoleCode.ORG;
+    if ("PAYOR".equals(codeString))
+      return V3RoleCode.PAYOR;
+    if ("ECON".equals(codeString))
+      return V3RoleCode.ECON;
+    if ("NOK".equals(codeString))
+      return V3RoleCode.NOK;
+    if ("_IdentifiedEntityType".equals(codeString))
+      return V3RoleCode._IDENTIFIEDENTITYTYPE;
+    if ("_LocationIdentifiedEntityRoleCode".equals(codeString))
+      return V3RoleCode._LOCATIONIDENTIFIEDENTITYROLECODE;
+    if ("ACHFID".equals(codeString))
+      return V3RoleCode.ACHFID;
+    if ("JURID".equals(codeString))
+      return V3RoleCode.JURID;
+    if ("LOCHFID".equals(codeString))
+      return V3RoleCode.LOCHFID;
+    if ("_LivingSubjectProductionClass".equals(codeString))
+      return V3RoleCode._LIVINGSUBJECTPRODUCTIONCLASS;
+    if ("BF".equals(codeString))
+      return V3RoleCode.BF;
+    if ("BL".equals(codeString))
+      return V3RoleCode.BL;
+    if ("BR".equals(codeString))
+      return V3RoleCode.BR;
+    if ("CO".equals(codeString))
+      return V3RoleCode.CO;
+    if ("DA".equals(codeString))
+      return V3RoleCode.DA;
+    if ("DR".equals(codeString))
+      return V3RoleCode.DR;
+    if ("DU".equals(codeString))
+      return V3RoleCode.DU;
+    if ("FI".equals(codeString))
+      return V3RoleCode.FI;
+    if ("LY".equals(codeString))
+      return V3RoleCode.LY;
+    if ("MT".equals(codeString))
+      return V3RoleCode.MT;
+    if ("MU".equals(codeString))
+      return V3RoleCode.MU;
+    if ("PL".equals(codeString))
+      return V3RoleCode.PL;
+    if ("RC".equals(codeString))
+      return V3RoleCode.RC;
+    if ("SH".equals(codeString))
+      return V3RoleCode.SH;
+    if ("VL".equals(codeString))
+      return V3RoleCode.VL;
+    if ("WL".equals(codeString))
+      return V3RoleCode.WL;
+    if ("WO".equals(codeString))
+      return V3RoleCode.WO;
+    if ("_MedicationGeneralizationRoleType".equals(codeString))
+      return V3RoleCode._MEDICATIONGENERALIZATIONROLETYPE;
+    if ("DC".equals(codeString))
+      return V3RoleCode.DC;
+    if ("GD".equals(codeString))
+      return V3RoleCode.GD;
+    if ("GDF".equals(codeString))
+      return V3RoleCode.GDF;
+    if ("GDS".equals(codeString))
+      return V3RoleCode.GDS;
+    if ("GDSF".equals(codeString))
+      return V3RoleCode.GDSF;
+    if ("MGDSF".equals(codeString))
+      return V3RoleCode.MGDSF;
+    if ("_MemberRoleType".equals(codeString))
+      return V3RoleCode._MEMBERROLETYPE;
+    if ("TRB".equals(codeString))
+      return V3RoleCode.TRB;
+    if ("_PersonalRelationshipRoleType".equals(codeString))
+      return V3RoleCode._PERSONALRELATIONSHIPROLETYPE;
+    if ("FAMMEMB".equals(codeString))
+      return V3RoleCode.FAMMEMB;
+    if ("CHILD".equals(codeString))
+      return V3RoleCode.CHILD;
+    if ("CHLDADOPT".equals(codeString))
+      return V3RoleCode.CHLDADOPT;
+    if ("DAUADOPT".equals(codeString))
+      return V3RoleCode.DAUADOPT;
+    if ("SONADOPT".equals(codeString))
+      return V3RoleCode.SONADOPT;
+    if ("CHLDFOST".equals(codeString))
+      return V3RoleCode.CHLDFOST;
+    if ("DAUFOST".equals(codeString))
+      return V3RoleCode.DAUFOST;
+    if ("SONFOST".equals(codeString))
+      return V3RoleCode.SONFOST;
+    if ("DAUC".equals(codeString))
+      return V3RoleCode.DAUC;
+    if ("DAU".equals(codeString))
+      return V3RoleCode.DAU;
+    if ("STPDAU".equals(codeString))
+      return V3RoleCode.STPDAU;
+    if ("NCHILD".equals(codeString))
+      return V3RoleCode.NCHILD;
+    if ("SON".equals(codeString))
+      return V3RoleCode.SON;
+    if ("SONC".equals(codeString))
+      return V3RoleCode.SONC;
+    if ("STPSON".equals(codeString))
+      return V3RoleCode.STPSON;
+    if ("STPCHLD".equals(codeString))
+      return V3RoleCode.STPCHLD;
+    if ("EXT".equals(codeString))
+      return V3RoleCode.EXT;
+    if ("AUNT".equals(codeString))
+      return V3RoleCode.AUNT;
+    if ("MAUNT".equals(codeString))
+      return V3RoleCode.MAUNT;
+    if ("PAUNT".equals(codeString))
+      return V3RoleCode.PAUNT;
+    if ("COUSN".equals(codeString))
+      return V3RoleCode.COUSN;
+    if ("MCOUSN".equals(codeString))
+      return V3RoleCode.MCOUSN;
+    if ("PCOUSN".equals(codeString))
+      return V3RoleCode.PCOUSN;
+    if ("GGRPRN".equals(codeString))
+      return V3RoleCode.GGRPRN;
+    if ("GGRFTH".equals(codeString))
+      return V3RoleCode.GGRFTH;
+    if ("MGGRFTH".equals(codeString))
+      return V3RoleCode.MGGRFTH;
+    if ("PGGRFTH".equals(codeString))
+      return V3RoleCode.PGGRFTH;
+    if ("GGRMTH".equals(codeString))
+      return V3RoleCode.GGRMTH;
+    if ("MGGRMTH".equals(codeString))
+      return V3RoleCode.MGGRMTH;
+    if ("PGGRMTH".equals(codeString))
+      return V3RoleCode.PGGRMTH;
+    if ("MGGRPRN".equals(codeString))
+      return V3RoleCode.MGGRPRN;
+    if ("PGGRPRN".equals(codeString))
+      return V3RoleCode.PGGRPRN;
+    if ("GRNDCHILD".equals(codeString))
+      return V3RoleCode.GRNDCHILD;
+    if ("GRNDDAU".equals(codeString))
+      return V3RoleCode.GRNDDAU;
+    if ("GRNDSON".equals(codeString))
+      return V3RoleCode.GRNDSON;
+    if ("GRPRN".equals(codeString))
+      return V3RoleCode.GRPRN;
+    if ("GRFTH".equals(codeString))
+      return V3RoleCode.GRFTH;
+    if ("MGRFTH".equals(codeString))
+      return V3RoleCode.MGRFTH;
+    if ("PGRFTH".equals(codeString))
+      return V3RoleCode.PGRFTH;
+    if ("GRMTH".equals(codeString))
+      return V3RoleCode.GRMTH;
+    if ("MGRMTH".equals(codeString))
+      return V3RoleCode.MGRMTH;
+    if ("PGRMTH".equals(codeString))
+      return V3RoleCode.PGRMTH;
+    if ("MGRPRN".equals(codeString))
+      return V3RoleCode.MGRPRN;
+    if ("PGRPRN".equals(codeString))
+      return V3RoleCode.PGRPRN;
+    if ("INLAW".equals(codeString))
+      return V3RoleCode.INLAW;
+    if ("CHLDINLAW".equals(codeString))
+      return V3RoleCode.CHLDINLAW;
+    if ("DAUINLAW".equals(codeString))
+      return V3RoleCode.DAUINLAW;
+    if ("SONINLAW".equals(codeString))
+      return V3RoleCode.SONINLAW;
+    if ("PRNINLAW".equals(codeString))
+      return V3RoleCode.PRNINLAW;
+    if ("FTHINLAW".equals(codeString))
+      return V3RoleCode.FTHINLAW;
+    if ("MTHINLAW".equals(codeString))
+      return V3RoleCode.MTHINLAW;
+    if ("SIBINLAW".equals(codeString))
+      return V3RoleCode.SIBINLAW;
+    if ("BROINLAW".equals(codeString))
+      return V3RoleCode.BROINLAW;
+    if ("SISINLAW".equals(codeString))
+      return V3RoleCode.SISINLAW;
+    if ("NIENEPH".equals(codeString))
+      return V3RoleCode.NIENEPH;
+    if ("NEPHEW".equals(codeString))
+      return V3RoleCode.NEPHEW;
+    if ("NIECE".equals(codeString))
+      return V3RoleCode.NIECE;
+    if ("UNCLE".equals(codeString))
+      return V3RoleCode.UNCLE;
+    if ("MUNCLE".equals(codeString))
+      return V3RoleCode.MUNCLE;
+    if ("PUNCLE".equals(codeString))
+      return V3RoleCode.PUNCLE;
+    if ("PRN".equals(codeString))
+      return V3RoleCode.PRN;
+    if ("ADOPTP".equals(codeString))
+      return V3RoleCode.ADOPTP;
+    if ("ADOPTF".equals(codeString))
+      return V3RoleCode.ADOPTF;
+    if ("ADOPTM".equals(codeString))
+      return V3RoleCode.ADOPTM;
+    if ("FTH".equals(codeString))
+      return V3RoleCode.FTH;
+    if ("FTHFOST".equals(codeString))
+      return V3RoleCode.FTHFOST;
+    if ("NFTH".equals(codeString))
+      return V3RoleCode.NFTH;
+    if ("NFTHF".equals(codeString))
+      return V3RoleCode.NFTHF;
+    if ("STPFTH".equals(codeString))
+      return V3RoleCode.STPFTH;
+    if ("MTH".equals(codeString))
+      return V3RoleCode.MTH;
+    if ("GESTM".equals(codeString))
+      return V3RoleCode.GESTM;
+    if ("MTHFOST".equals(codeString))
+      return V3RoleCode.MTHFOST;
+    if ("NMTH".equals(codeString))
+      return V3RoleCode.NMTH;
+    if ("NMTHF".equals(codeString))
+      return V3RoleCode.NMTHF;
+    if ("STPMTH".equals(codeString))
+      return V3RoleCode.STPMTH;
+    if ("NPRN".equals(codeString))
+      return V3RoleCode.NPRN;
+    if ("PRNFOST".equals(codeString))
+      return V3RoleCode.PRNFOST;
+    if ("STPPRN".equals(codeString))
+      return V3RoleCode.STPPRN;
+    if ("SIB".equals(codeString))
+      return V3RoleCode.SIB;
+    if ("BRO".equals(codeString))
+      return V3RoleCode.BRO;
+    if ("HBRO".equals(codeString))
+      return V3RoleCode.HBRO;
+    if ("NBRO".equals(codeString))
+      return V3RoleCode.NBRO;
+    if ("TWINBRO".equals(codeString))
+      return V3RoleCode.TWINBRO;
+    if ("FTWINBRO".equals(codeString))
+      return V3RoleCode.FTWINBRO;
+    if ("ITWINBRO".equals(codeString))
+      return V3RoleCode.ITWINBRO;
+    if ("STPBRO".equals(codeString))
+      return V3RoleCode.STPBRO;
+    if ("HSIB".equals(codeString))
+      return V3RoleCode.HSIB;
+    if ("HSIS".equals(codeString))
+      return V3RoleCode.HSIS;
+    if ("NSIB".equals(codeString))
+      return V3RoleCode.NSIB;
+    if ("NSIS".equals(codeString))
+      return V3RoleCode.NSIS;
+    if ("TWINSIS".equals(codeString))
+      return V3RoleCode.TWINSIS;
+    if ("FTWINSIS".equals(codeString))
+      return V3RoleCode.FTWINSIS;
+    if ("ITWINSIS".equals(codeString))
+      return V3RoleCode.ITWINSIS;
+    if ("TWIN".equals(codeString))
+      return V3RoleCode.TWIN;
+    if ("FTWIN".equals(codeString))
+      return V3RoleCode.FTWIN;
+    if ("ITWIN".equals(codeString))
+      return V3RoleCode.ITWIN;
+    if ("SIS".equals(codeString))
+      return V3RoleCode.SIS;
+    if ("STPSIS".equals(codeString))
+      return V3RoleCode.STPSIS;
+    if ("STPSIB".equals(codeString))
+      return V3RoleCode.STPSIB;
+    if ("SIGOTHR".equals(codeString))
+      return V3RoleCode.SIGOTHR;
+    if ("DOMPART".equals(codeString))
+      return V3RoleCode.DOMPART;
+    if ("FMRSPS".equals(codeString))
+      return V3RoleCode.FMRSPS;
+    if ("SPS".equals(codeString))
+      return V3RoleCode.SPS;
+    if ("HUSB".equals(codeString))
+      return V3RoleCode.HUSB;
+    if ("WIFE".equals(codeString))
+      return V3RoleCode.WIFE;
+    if ("FRND".equals(codeString))
+      return V3RoleCode.FRND;
+    if ("NBOR".equals(codeString))
+      return V3RoleCode.NBOR;
+    if ("ONESELF".equals(codeString))
+      return V3RoleCode.ONESELF;
+    if ("ROOM".equals(codeString))
+      return V3RoleCode.ROOM;
+    if ("_PolicyOrProgramCoverageRoleType".equals(codeString))
+      return V3RoleCode._POLICYORPROGRAMCOVERAGEROLETYPE;
+    if ("_CoverageRoleType".equals(codeString))
+      return V3RoleCode._COVERAGEROLETYPE;
+    if ("FAMDEP".equals(codeString))
+      return V3RoleCode.FAMDEP;
+    if ("HANDIC".equals(codeString))
+      return V3RoleCode.HANDIC;
+    if ("INJ".equals(codeString))
+      return V3RoleCode.INJ;
+    if ("SELF".equals(codeString))
+      return V3RoleCode.SELF;
+    if ("SPON".equals(codeString))
+      return V3RoleCode.SPON;
+    if ("STUD".equals(codeString))
+      return V3RoleCode.STUD;
+    if ("FSTUD".equals(codeString))
+      return V3RoleCode.FSTUD;
+    if ("PSTUD".equals(codeString))
+      return V3RoleCode.PSTUD;
+    if ("ADOPT".equals(codeString))
+      return V3RoleCode.ADOPT;
+    if ("GCHILD".equals(codeString))
+      return V3RoleCode.GCHILD;
+    if ("GPARNT".equals(codeString))
+      return V3RoleCode.GPARNT;
+    if ("NAT".equals(codeString))
+      return V3RoleCode.NAT;
+    if ("NIENE".equals(codeString))
+      return V3RoleCode.NIENE;
+    if ("PARNT".equals(codeString))
+      return V3RoleCode.PARNT;
+    if ("SPSE".equals(codeString))
+      return V3RoleCode.SPSE;
+    if ("STEP".equals(codeString))
+      return V3RoleCode.STEP;
+    if ("_CoveredPartyRoleType".equals(codeString))
+      return V3RoleCode._COVEREDPARTYROLETYPE;
+    if ("_ClaimantCoveredPartyRoleType".equals(codeString))
+      return V3RoleCode._CLAIMANTCOVEREDPARTYROLETYPE;
+    if ("CRIMEVIC".equals(codeString))
+      return V3RoleCode.CRIMEVIC;
+    if ("INJWKR".equals(codeString))
+      return V3RoleCode.INJWKR;
+    if ("_DependentCoveredPartyRoleType".equals(codeString))
+      return V3RoleCode._DEPENDENTCOVEREDPARTYROLETYPE;
+    if ("COCBEN".equals(codeString))
+      return V3RoleCode.COCBEN;
+    if ("DIFFABL".equals(codeString))
+      return V3RoleCode.DIFFABL;
+    if ("WARD".equals(codeString))
+      return V3RoleCode.WARD;
+    if ("_IndividualInsuredPartyRoleType".equals(codeString))
+      return V3RoleCode._INDIVIDUALINSUREDPARTYROLETYPE;
+    if ("RETIREE".equals(codeString))
+      return V3RoleCode.RETIREE;
+    if ("_ProgramEligiblePartyRoleType".equals(codeString))
+      return V3RoleCode._PROGRAMELIGIBLEPARTYROLETYPE;
+    if ("INDIG".equals(codeString))
+      return V3RoleCode.INDIG;
+    if ("MIL".equals(codeString))
+      return V3RoleCode.MIL;
+    if ("ACTMIL".equals(codeString))
+      return V3RoleCode.ACTMIL;
+    if ("RETMIL".equals(codeString))
+      return V3RoleCode.RETMIL;
+    if ("VET".equals(codeString))
+      return V3RoleCode.VET;
+    if ("_SubscriberCoveredPartyRoleType".equals(codeString))
+      return V3RoleCode._SUBSCRIBERCOVEREDPARTYROLETYPE;
+    if ("_ResearchSubjectRoleBasis".equals(codeString))
+      return V3RoleCode._RESEARCHSUBJECTROLEBASIS;
+    if ("ERL".equals(codeString))
+      return V3RoleCode.ERL;
+    if ("SCN".equals(codeString))
+      return V3RoleCode.SCN;
+    if ("_ServiceDeliveryLocationRoleType".equals(codeString))
+      return V3RoleCode._SERVICEDELIVERYLOCATIONROLETYPE;
+    if ("_DedicatedServiceDeliveryLocationRoleType".equals(codeString))
+      return V3RoleCode._DEDICATEDSERVICEDELIVERYLOCATIONROLETYPE;
+    if ("_DedicatedClinicalLocationRoleType".equals(codeString))
+      return V3RoleCode._DEDICATEDCLINICALLOCATIONROLETYPE;
+    if ("DX".equals(codeString))
+      return V3RoleCode.DX;
+    if ("CVDX".equals(codeString))
+      return V3RoleCode.CVDX;
+    if ("CATH".equals(codeString))
+      return V3RoleCode.CATH;
+    if ("ECHO".equals(codeString))
+      return V3RoleCode.ECHO;
+    if ("GIDX".equals(codeString))
+      return V3RoleCode.GIDX;
+    if ("ENDOS".equals(codeString))
+      return V3RoleCode.ENDOS;
+    if ("RADDX".equals(codeString))
+      return V3RoleCode.RADDX;
+    if ("RADO".equals(codeString))
+      return V3RoleCode.RADO;
+    if ("RNEU".equals(codeString))
+      return V3RoleCode.RNEU;
+    if ("HOSP".equals(codeString))
+      return V3RoleCode.HOSP;
+    if ("CHR".equals(codeString))
+      return V3RoleCode.CHR;
+    if ("GACH".equals(codeString))
+      return V3RoleCode.GACH;
+    if ("MHSP".equals(codeString))
+      return V3RoleCode.MHSP;
+    if ("PSYCHF".equals(codeString))
+      return V3RoleCode.PSYCHF;
+    if ("RH".equals(codeString))
+      return V3RoleCode.RH;
+    if ("RHAT".equals(codeString))
+      return V3RoleCode.RHAT;
+    if ("RHII".equals(codeString))
+      return V3RoleCode.RHII;
+    if ("RHMAD".equals(codeString))
+      return V3RoleCode.RHMAD;
+    if ("RHPI".equals(codeString))
+      return V3RoleCode.RHPI;
+    if ("RHPIH".equals(codeString))
+      return V3RoleCode.RHPIH;
+    if ("RHPIMS".equals(codeString))
+      return V3RoleCode.RHPIMS;
+    if ("RHPIVS".equals(codeString))
+      return V3RoleCode.RHPIVS;
+    if ("RHYAD".equals(codeString))
+      return V3RoleCode.RHYAD;
+    if ("HU".equals(codeString))
+      return V3RoleCode.HU;
+    if ("BMTU".equals(codeString))
+      return V3RoleCode.BMTU;
+    if ("CCU".equals(codeString))
+      return V3RoleCode.CCU;
+    if ("CHEST".equals(codeString))
+      return V3RoleCode.CHEST;
+    if ("EPIL".equals(codeString))
+      return V3RoleCode.EPIL;
+    if ("ER".equals(codeString))
+      return V3RoleCode.ER;
+    if ("ETU".equals(codeString))
+      return V3RoleCode.ETU;
+    if ("HD".equals(codeString))
+      return V3RoleCode.HD;
+    if ("HLAB".equals(codeString))
+      return V3RoleCode.HLAB;
+    if ("INLAB".equals(codeString))
+      return V3RoleCode.INLAB;
+    if ("OUTLAB".equals(codeString))
+      return V3RoleCode.OUTLAB;
+    if ("HRAD".equals(codeString))
+      return V3RoleCode.HRAD;
+    if ("HUSCS".equals(codeString))
+      return V3RoleCode.HUSCS;
+    if ("ICU".equals(codeString))
+      return V3RoleCode.ICU;
+    if ("PEDICU".equals(codeString))
+      return V3RoleCode.PEDICU;
+    if ("PEDNICU".equals(codeString))
+      return V3RoleCode.PEDNICU;
+    if ("INPHARM".equals(codeString))
+      return V3RoleCode.INPHARM;
+    if ("MBL".equals(codeString))
+      return V3RoleCode.MBL;
+    if ("NCCS".equals(codeString))
+      return V3RoleCode.NCCS;
+    if ("NS".equals(codeString))
+      return V3RoleCode.NS;
+    if ("OUTPHARM".equals(codeString))
+      return V3RoleCode.OUTPHARM;
+    if ("PEDU".equals(codeString))
+      return V3RoleCode.PEDU;
+    if ("PHU".equals(codeString))
+      return V3RoleCode.PHU;
+    if ("RHU".equals(codeString))
+      return V3RoleCode.RHU;
+    if ("SLEEP".equals(codeString))
+      return V3RoleCode.SLEEP;
+    if ("NCCF".equals(codeString))
+      return V3RoleCode.NCCF;
+    if ("SNF".equals(codeString))
+      return V3RoleCode.SNF;
+    if ("OF".equals(codeString))
+      return V3RoleCode.OF;
+    if ("ALL".equals(codeString))
+      return V3RoleCode.ALL;
+    if ("AMPUT".equals(codeString))
+      return V3RoleCode.AMPUT;
+    if ("BMTC".equals(codeString))
+      return V3RoleCode.BMTC;
+    if ("BREAST".equals(codeString))
+      return V3RoleCode.BREAST;
+    if ("CANC".equals(codeString))
+      return V3RoleCode.CANC;
+    if ("CAPC".equals(codeString))
+      return V3RoleCode.CAPC;
+    if ("CARD".equals(codeString))
+      return V3RoleCode.CARD;
+    if ("PEDCARD".equals(codeString))
+      return V3RoleCode.PEDCARD;
+    if ("COAG".equals(codeString))
+      return V3RoleCode.COAG;
+    if ("CRS".equals(codeString))
+      return V3RoleCode.CRS;
+    if ("DERM".equals(codeString))
+      return V3RoleCode.DERM;
+    if ("ENDO".equals(codeString))
+      return V3RoleCode.ENDO;
+    if ("PEDE".equals(codeString))
+      return V3RoleCode.PEDE;
+    if ("ENT".equals(codeString))
+      return V3RoleCode.ENT;
+    if ("FMC".equals(codeString))
+      return V3RoleCode.FMC;
+    if ("GI".equals(codeString))
+      return V3RoleCode.GI;
+    if ("PEDGI".equals(codeString))
+      return V3RoleCode.PEDGI;
+    if ("GIM".equals(codeString))
+      return V3RoleCode.GIM;
+    if ("GYN".equals(codeString))
+      return V3RoleCode.GYN;
+    if ("HEM".equals(codeString))
+      return V3RoleCode.HEM;
+    if ("PEDHEM".equals(codeString))
+      return V3RoleCode.PEDHEM;
+    if ("HTN".equals(codeString))
+      return V3RoleCode.HTN;
+    if ("IEC".equals(codeString))
+      return V3RoleCode.IEC;
+    if ("INFD".equals(codeString))
+      return V3RoleCode.INFD;
+    if ("PEDID".equals(codeString))
+      return V3RoleCode.PEDID;
+    if ("INV".equals(codeString))
+      return V3RoleCode.INV;
+    if ("LYMPH".equals(codeString))
+      return V3RoleCode.LYMPH;
+    if ("MGEN".equals(codeString))
+      return V3RoleCode.MGEN;
+    if ("NEPH".equals(codeString))
+      return V3RoleCode.NEPH;
+    if ("PEDNEPH".equals(codeString))
+      return V3RoleCode.PEDNEPH;
+    if ("NEUR".equals(codeString))
+      return V3RoleCode.NEUR;
+    if ("OB".equals(codeString))
+      return V3RoleCode.OB;
+    if ("OMS".equals(codeString))
+      return V3RoleCode.OMS;
+    if ("ONCL".equals(codeString))
+      return V3RoleCode.ONCL;
+    if ("PEDHO".equals(codeString))
+      return V3RoleCode.PEDHO;
+    if ("OPH".equals(codeString))
+      return V3RoleCode.OPH;
+    if ("OPTC".equals(codeString))
+      return V3RoleCode.OPTC;
+    if ("ORTHO".equals(codeString))
+      return V3RoleCode.ORTHO;
+    if ("HAND".equals(codeString))
+      return V3RoleCode.HAND;
+    if ("PAINCL".equals(codeString))
+      return V3RoleCode.PAINCL;
+    if ("PC".equals(codeString))
+      return V3RoleCode.PC;
+    if ("PEDC".equals(codeString))
+      return V3RoleCode.PEDC;
+    if ("PEDRHEUM".equals(codeString))
+      return V3RoleCode.PEDRHEUM;
+    if ("POD".equals(codeString))
+      return V3RoleCode.POD;
+    if ("PREV".equals(codeString))
+      return V3RoleCode.PREV;
+    if ("PROCTO".equals(codeString))
+      return V3RoleCode.PROCTO;
+    if ("PROFF".equals(codeString))
+      return V3RoleCode.PROFF;
+    if ("PROS".equals(codeString))
+      return V3RoleCode.PROS;
+    if ("PSI".equals(codeString))
+      return V3RoleCode.PSI;
+    if ("PSY".equals(codeString))
+      return V3RoleCode.PSY;
+    if ("RHEUM".equals(codeString))
+      return V3RoleCode.RHEUM;
+    if ("SPMED".equals(codeString))
+      return V3RoleCode.SPMED;
+    if ("SU".equals(codeString))
+      return V3RoleCode.SU;
+    if ("PLS".equals(codeString))
+      return V3RoleCode.PLS;
+    if ("URO".equals(codeString))
+      return V3RoleCode.URO;
+    if ("TR".equals(codeString))
+      return V3RoleCode.TR;
+    if ("TRAVEL".equals(codeString))
+      return V3RoleCode.TRAVEL;
+    if ("WND".equals(codeString))
+      return V3RoleCode.WND;
+    if ("RTF".equals(codeString))
+      return V3RoleCode.RTF;
+    if ("PRC".equals(codeString))
+      return V3RoleCode.PRC;
+    if ("SURF".equals(codeString))
+      return V3RoleCode.SURF;
+    if ("_DedicatedNonClinicalLocationRoleType".equals(codeString))
+      return V3RoleCode._DEDICATEDNONCLINICALLOCATIONROLETYPE;
+    if ("DADDR".equals(codeString))
+      return V3RoleCode.DADDR;
+    if ("MOBL".equals(codeString))
+      return V3RoleCode.MOBL;
+    if ("AMB".equals(codeString))
+      return V3RoleCode.AMB;
+    if ("PHARM".equals(codeString))
+      return V3RoleCode.PHARM;
+    if ("_IncidentalServiceDeliveryLocationRoleType".equals(codeString))
+      return V3RoleCode._INCIDENTALSERVICEDELIVERYLOCATIONROLETYPE;
+    if ("ACC".equals(codeString))
+      return V3RoleCode.ACC;
+    if ("COMM".equals(codeString))
+      return V3RoleCode.COMM;
+    if ("CSC".equals(codeString))
+      return V3RoleCode.CSC;
+    if ("PTRES".equals(codeString))
+      return V3RoleCode.PTRES;
+    if ("SCHOOL".equals(codeString))
+      return V3RoleCode.SCHOOL;
+    if ("UPC".equals(codeString))
+      return V3RoleCode.UPC;
+    if ("WORK".equals(codeString))
+      return V3RoleCode.WORK;
+    if ("_SpecimenRoleType".equals(codeString))
+      return V3RoleCode._SPECIMENROLETYPE;
+    if ("C".equals(codeString))
+      return V3RoleCode.C;
+    if ("G".equals(codeString))
+      return V3RoleCode.G;
+    if ("L".equals(codeString))
+      return V3RoleCode.L;
+    if ("P".equals(codeString))
+      return V3RoleCode.P;
+    if ("Q".equals(codeString))
+      return V3RoleCode.Q;
+    if ("B".equals(codeString))
+      return V3RoleCode.B;
+    if ("E".equals(codeString))
+      return V3RoleCode.E;
+    if ("F".equals(codeString))
+      return V3RoleCode.F;
+    if ("O".equals(codeString))
+      return V3RoleCode.O;
+    if ("V".equals(codeString))
+      return V3RoleCode.V;
+    if ("R".equals(codeString))
+      return V3RoleCode.R;
+    if ("CLAIM".equals(codeString))
+      return V3RoleCode.CLAIM;
+    if ("communityLaboratory".equals(codeString))
+      return V3RoleCode.COMMUNITYLABORATORY;
+    if ("GT".equals(codeString))
+      return V3RoleCode.GT;
+    if ("homeHealth".equals(codeString))
+      return V3RoleCode.HOMEHEALTH;
+    if ("laboratory".equals(codeString))
+      return V3RoleCode.LABORATORY;
+    if ("pathologist".equals(codeString))
+      return V3RoleCode.PATHOLOGIST;
+    if ("PH".equals(codeString))
+      return V3RoleCode.PH;
+    if ("phlebotomist".equals(codeString))
+      return V3RoleCode.PHLEBOTOMIST;
+    if ("PROG".equals(codeString))
+      return V3RoleCode.PROG;
+    if ("PT".equals(codeString))
+      return V3RoleCode.PT;
+    if ("subject".equals(codeString))
+      return V3RoleCode.SUBJECT;
+    if ("thirdParty".equals(codeString))
+      return V3RoleCode.THIRDPARTY;
+    if ("DEP".equals(codeString))
+      return V3RoleCode.DEP;
+    if ("DEPEN".equals(codeString))
+      return V3RoleCode.DEPEN;
+    if ("FM".equals(codeString))
+      return V3RoleCode.FM;
+    if ("INDIV".equals(codeString))
+      return V3RoleCode.INDIV;
+    if ("NAMED".equals(codeString))
+      return V3RoleCode.NAMED;
+    if ("PSYCHCF".equals(codeString))
+      return V3RoleCode.PSYCHCF;
+    if ("SUBSCR".equals(codeString))
+      return V3RoleCode.SUBSCR;
+    throw new IllegalArgumentException("Unknown V3RoleCode code '"+codeString+"'");
+  }
+
+  public String toCode(V3RoleCode code) {
+    if (code == V3RoleCode._AFFILIATIONROLETYPE)
+      return "_AffiliationRoleType";
+    if (code == V3RoleCode._AGENTROLETYPE)
+      return "_AgentRoleType";
+    if (code == V3RoleCode.AMENDER)
+      return "AMENDER";
+    if (code == V3RoleCode.CLASSIFIER)
+      return "CLASSIFIER";
+    if (code == V3RoleCode.CONSENTER)
+      return "CONSENTER";
+    if (code == V3RoleCode.CONSWIT)
+      return "CONSWIT";
+    if (code == V3RoleCode.COPART)
+      return "COPART";
+    if (code == V3RoleCode.DECLASSIFIER)
+      return "DECLASSIFIER";
+    if (code == V3RoleCode.DELEGATEE)
+      return "DELEGATEE";
+    if (code == V3RoleCode.DELEGATOR)
+      return "DELEGATOR";
+    if (code == V3RoleCode.DOWNGRDER)
+      return "DOWNGRDER";
+    if (code == V3RoleCode.DRIVCLASSIFIER)
+      return "DRIVCLASSIFIER";
+    if (code == V3RoleCode.GRANTEE)
+      return "GRANTEE";
+    if (code == V3RoleCode.GRANTOR)
+      return "GRANTOR";
+    if (code == V3RoleCode.INTPRTER)
+      return "INTPRTER";
+    if (code == V3RoleCode.REVIEWER)
+      return "REVIEWER";
+    if (code == V3RoleCode.VALIDATOR)
+      return "VALIDATOR";
+    if (code == V3RoleCode._COVERAGESPONSORROLETYPE)
+      return "_CoverageSponsorRoleType";
+    if (code == V3RoleCode.FULLINS)
+      return "FULLINS";
+    if (code == V3RoleCode.SELFINS)
+      return "SELFINS";
+    if (code == V3RoleCode._PAYORROLETYPE)
+      return "_PayorRoleType";
+    if (code == V3RoleCode.ENROLBKR)
+      return "ENROLBKR";
+    if (code == V3RoleCode.TPA)
+      return "TPA";
+    if (code == V3RoleCode.UMO)
+      return "UMO";
+    if (code == V3RoleCode.RESPRSN)
+      return "RESPRSN";
+    if (code == V3RoleCode.EXCEST)
+      return "EXCEST";
+    if (code == V3RoleCode.GUADLTM)
+      return "GUADLTM";
+    if (code == V3RoleCode.GUARD)
+      return "GUARD";
+    if (code == V3RoleCode.POWATT)
+      return "POWATT";
+    if (code == V3RoleCode.DPOWATT)
+      return "DPOWATT";
+    if (code == V3RoleCode.HPOWATT)
+      return "HPOWATT";
+    if (code == V3RoleCode.SPOWATT)
+      return "SPOWATT";
+    if (code == V3RoleCode._ASSIGNEDROLETYPE)
+      return "_AssignedRoleType";
+    if (code == V3RoleCode._ASSIGNEDNONPERSONLIVINGSUBJECTROLETYPE)
+      return "_AssignedNonPersonLivingSubjectRoleType";
+    if (code == V3RoleCode.ASSIST)
+      return "ASSIST";
+    if (code == V3RoleCode.BIOTH)
+      return "BIOTH";
+    if (code == V3RoleCode.ANTIBIOT)
+      return "ANTIBIOT";
+    if (code == V3RoleCode.DEBR)
+      return "DEBR";
+    if (code == V3RoleCode.CCO)
+      return "CCO";
+    if (code == V3RoleCode.SEE)
+      return "SEE";
+    if (code == V3RoleCode.SNIFF)
+      return "SNIFF";
+    if (code == V3RoleCode._CERTIFIEDENTITYTYPE)
+      return "_CertifiedEntityType";
+    if (code == V3RoleCode._CITIZENROLETYPE)
+      return "_CitizenRoleType";
+    if (code == V3RoleCode.CAS)
+      return "CAS";
+    if (code == V3RoleCode.CASM)
+      return "CASM";
+    if (code == V3RoleCode.CN)
+      return "CN";
+    if (code == V3RoleCode.CNRP)
+      return "CNRP";
+    if (code == V3RoleCode.CNRPM)
+      return "CNRPM";
+    if (code == V3RoleCode.CPCA)
+      return "CPCA";
+    if (code == V3RoleCode.CRP)
+      return "CRP";
+    if (code == V3RoleCode.CRPM)
+      return "CRPM";
+    if (code == V3RoleCode._CONTACTROLETYPE)
+      return "_ContactRoleType";
+    if (code == V3RoleCode._ADMINISTRATIVECONTACTROLETYPE)
+      return "_AdministrativeContactRoleType";
+    if (code == V3RoleCode.BILL)
+      return "BILL";
+    if (code == V3RoleCode.ORG)
+      return "ORG";
+    if (code == V3RoleCode.PAYOR)
+      return "PAYOR";
+    if (code == V3RoleCode.ECON)
+      return "ECON";
+    if (code == V3RoleCode.NOK)
+      return "NOK";
+    if (code == V3RoleCode._IDENTIFIEDENTITYTYPE)
+      return "_IdentifiedEntityType";
+    if (code == V3RoleCode._LOCATIONIDENTIFIEDENTITYROLECODE)
+      return "_LocationIdentifiedEntityRoleCode";
+    if (code == V3RoleCode.ACHFID)
+      return "ACHFID";
+    if (code == V3RoleCode.JURID)
+      return "JURID";
+    if (code == V3RoleCode.LOCHFID)
+      return "LOCHFID";
+    if (code == V3RoleCode._LIVINGSUBJECTPRODUCTIONCLASS)
+      return "_LivingSubjectProductionClass";
+    if (code == V3RoleCode.BF)
+      return "BF";
+    if (code == V3RoleCode.BL)
+      return "BL";
+    if (code == V3RoleCode.BR)
+      return "BR";
+    if (code == V3RoleCode.CO)
+      return "CO";
+    if (code == V3RoleCode.DA)
+      return "DA";
+    if (code == V3RoleCode.DR)
+      return "DR";
+    if (code == V3RoleCode.DU)
+      return "DU";
+    if (code == V3RoleCode.FI)
+      return "FI";
+    if (code == V3RoleCode.LY)
+      return "LY";
+    if (code == V3RoleCode.MT)
+      return "MT";
+    if (code == V3RoleCode.MU)
+      return "MU";
+    if (code == V3RoleCode.PL)
+      return "PL";
+    if (code == V3RoleCode.RC)
+      return "RC";
+    if (code == V3RoleCode.SH)
+      return "SH";
+    if (code == V3RoleCode.VL)
+      return "VL";
+    if (code == V3RoleCode.WL)
+      return "WL";
+    if (code == V3RoleCode.WO)
+      return "WO";
+    if (code == V3RoleCode._MEDICATIONGENERALIZATIONROLETYPE)
+      return "_MedicationGeneralizationRoleType";
+    if (code == V3RoleCode.DC)
+      return "DC";
+    if (code == V3RoleCode.GD)
+      return "GD";
+    if (code == V3RoleCode.GDF)
+      return "GDF";
+    if (code == V3RoleCode.GDS)
+      return "GDS";
+    if (code == V3RoleCode.GDSF)
+      return "GDSF";
+    if (code == V3RoleCode.MGDSF)
+      return "MGDSF";
+    if (code == V3RoleCode._MEMBERROLETYPE)
+      return "_MemberRoleType";
+    if (code == V3RoleCode.TRB)
+      return "TRB";
+    if (code == V3RoleCode._PERSONALRELATIONSHIPROLETYPE)
+      return "_PersonalRelationshipRoleType";
+    if (code == V3RoleCode.FAMMEMB)
+      return "FAMMEMB";
+    if (code == V3RoleCode.CHILD)
+      return "CHILD";
+    if (code == V3RoleCode.CHLDADOPT)
+      return "CHLDADOPT";
+    if (code == V3RoleCode.DAUADOPT)
+      return "DAUADOPT";
+    if (code == V3RoleCode.SONADOPT)
+      return "SONADOPT";
+    if (code == V3RoleCode.CHLDFOST)
+      return "CHLDFOST";
+    if (code == V3RoleCode.DAUFOST)
+      return "DAUFOST";
+    if (code == V3RoleCode.SONFOST)
+      return "SONFOST";
+    if (code == V3RoleCode.DAUC)
+      return "DAUC";
+    if (code == V3RoleCode.DAU)
+      return "DAU";
+    if (code == V3RoleCode.STPDAU)
+      return "STPDAU";
+    if (code == V3RoleCode.NCHILD)
+      return "NCHILD";
+    if (code == V3RoleCode.SON)
+      return "SON";
+    if (code == V3RoleCode.SONC)
+      return "SONC";
+    if (code == V3RoleCode.STPSON)
+      return "STPSON";
+    if (code == V3RoleCode.STPCHLD)
+      return "STPCHLD";
+    if (code == V3RoleCode.EXT)
+      return "EXT";
+    if (code == V3RoleCode.AUNT)
+      return "AUNT";
+    if (code == V3RoleCode.MAUNT)
+      return "MAUNT";
+    if (code == V3RoleCode.PAUNT)
+      return "PAUNT";
+    if (code == V3RoleCode.COUSN)
+      return "COUSN";
+    if (code == V3RoleCode.MCOUSN)
+      return "MCOUSN";
+    if (code == V3RoleCode.PCOUSN)
+      return "PCOUSN";
+    if (code == V3RoleCode.GGRPRN)
+      return "GGRPRN";
+    if (code == V3RoleCode.GGRFTH)
+      return "GGRFTH";
+    if (code == V3RoleCode.MGGRFTH)
+      return "MGGRFTH";
+    if (code == V3RoleCode.PGGRFTH)
+      return "PGGRFTH";
+    if (code == V3RoleCode.GGRMTH)
+      return "GGRMTH";
+    if (code == V3RoleCode.MGGRMTH)
+      return "MGGRMTH";
+    if (code == V3RoleCode.PGGRMTH)
+      return "PGGRMTH";
+    if (code == V3RoleCode.MGGRPRN)
+      return "MGGRPRN";
+    if (code == V3RoleCode.PGGRPRN)
+      return "PGGRPRN";
+    if (code == V3RoleCode.GRNDCHILD)
+      return "GRNDCHILD";
+    if (code == V3RoleCode.GRNDDAU)
+      return "GRNDDAU";
+    if (code == V3RoleCode.GRNDSON)
+      return "GRNDSON";
+    if (code == V3RoleCode.GRPRN)
+      return "GRPRN";
+    if (code == V3RoleCode.GRFTH)
+      return "GRFTH";
+    if (code == V3RoleCode.MGRFTH)
+      return "MGRFTH";
+    if (code == V3RoleCode.PGRFTH)
+      return "PGRFTH";
+    if (code == V3RoleCode.GRMTH)
+      return "GRMTH";
+    if (code == V3RoleCode.MGRMTH)
+      return "MGRMTH";
+    if (code == V3RoleCode.PGRMTH)
+      return "PGRMTH";
+    if (code == V3RoleCode.MGRPRN)
+      return "MGRPRN";
+    if (code == V3RoleCode.PGRPRN)
+      return "PGRPRN";
+    if (code == V3RoleCode.INLAW)
+      return "INLAW";
+    if (code == V3RoleCode.CHLDINLAW)
+      return "CHLDINLAW";
+    if (code == V3RoleCode.DAUINLAW)
+      return "DAUINLAW";
+    if (code == V3RoleCode.SONINLAW)
+      return "SONINLAW";
+    if (code == V3RoleCode.PRNINLAW)
+      return "PRNINLAW";
+    if (code == V3RoleCode.FTHINLAW)
+      return "FTHINLAW";
+    if (code == V3RoleCode.MTHINLAW)
+      return "MTHINLAW";
+    if (code == V3RoleCode.SIBINLAW)
+      return "SIBINLAW";
+    if (code == V3RoleCode.BROINLAW)
+      return "BROINLAW";
+    if (code == V3RoleCode.SISINLAW)
+      return "SISINLAW";
+    if (code == V3RoleCode.NIENEPH)
+      return "NIENEPH";
+    if (code == V3RoleCode.NEPHEW)
+      return "NEPHEW";
+    if (code == V3RoleCode.NIECE)
+      return "NIECE";
+    if (code == V3RoleCode.UNCLE)
+      return "UNCLE";
+    if (code == V3RoleCode.MUNCLE)
+      return "MUNCLE";
+    if (code == V3RoleCode.PUNCLE)
+      return "PUNCLE";
+    if (code == V3RoleCode.PRN)
+      return "PRN";
+    if (code == V3RoleCode.ADOPTP)
+      return "ADOPTP";
+    if (code == V3RoleCode.ADOPTF)
+      return "ADOPTF";
+    if (code == V3RoleCode.ADOPTM)
+      return "ADOPTM";
+    if (code == V3RoleCode.FTH)
+      return "FTH";
+    if (code == V3RoleCode.FTHFOST)
+      return "FTHFOST";
+    if (code == V3RoleCode.NFTH)
+      return "NFTH";
+    if (code == V3RoleCode.NFTHF)
+      return "NFTHF";
+    if (code == V3RoleCode.STPFTH)
+      return "STPFTH";
+    if (code == V3RoleCode.MTH)
+      return "MTH";
+    if (code == V3RoleCode.GESTM)
+      return "GESTM";
+    if (code == V3RoleCode.MTHFOST)
+      return "MTHFOST";
+    if (code == V3RoleCode.NMTH)
+      return "NMTH";
+    if (code == V3RoleCode.NMTHF)
+      return "NMTHF";
+    if (code == V3RoleCode.STPMTH)
+      return "STPMTH";
+    if (code == V3RoleCode.NPRN)
+      return "NPRN";
+    if (code == V3RoleCode.PRNFOST)
+      return "PRNFOST";
+    if (code == V3RoleCode.STPPRN)
+      return "STPPRN";
+    if (code == V3RoleCode.SIB)
+      return "SIB";
+    if (code == V3RoleCode.BRO)
+      return "BRO";
+    if (code == V3RoleCode.HBRO)
+      return "HBRO";
+    if (code == V3RoleCode.NBRO)
+      return "NBRO";
+    if (code == V3RoleCode.TWINBRO)
+      return "TWINBRO";
+    if (code == V3RoleCode.FTWINBRO)
+      return "FTWINBRO";
+    if (code == V3RoleCode.ITWINBRO)
+      return "ITWINBRO";
+    if (code == V3RoleCode.STPBRO)
+      return "STPBRO";
+    if (code == V3RoleCode.HSIB)
+      return "HSIB";
+    if (code == V3RoleCode.HSIS)
+      return "HSIS";
+    if (code == V3RoleCode.NSIB)
+      return "NSIB";
+    if (code == V3RoleCode.NSIS)
+      return "NSIS";
+    if (code == V3RoleCode.TWINSIS)
+      return "TWINSIS";
+    if (code == V3RoleCode.FTWINSIS)
+      return "FTWINSIS";
+    if (code == V3RoleCode.ITWINSIS)
+      return "ITWINSIS";
+    if (code == V3RoleCode.TWIN)
+      return "TWIN";
+    if (code == V3RoleCode.FTWIN)
+      return "FTWIN";
+    if (code == V3RoleCode.ITWIN)
+      return "ITWIN";
+    if (code == V3RoleCode.SIS)
+      return "SIS";
+    if (code == V3RoleCode.STPSIS)
+      return "STPSIS";
+    if (code == V3RoleCode.STPSIB)
+      return "STPSIB";
+    if (code == V3RoleCode.SIGOTHR)
+      return "SIGOTHR";
+    if (code == V3RoleCode.DOMPART)
+      return "DOMPART";
+    if (code == V3RoleCode.FMRSPS)
+      return "FMRSPS";
+    if (code == V3RoleCode.SPS)
+      return "SPS";
+    if (code == V3RoleCode.HUSB)
+      return "HUSB";
+    if (code == V3RoleCode.WIFE)
+      return "WIFE";
+    if (code == V3RoleCode.FRND)
+      return "FRND";
+    if (code == V3RoleCode.NBOR)
+      return "NBOR";
+    if (code == V3RoleCode.ONESELF)
+      return "ONESELF";
+    if (code == V3RoleCode.ROOM)
+      return "ROOM";
+    if (code == V3RoleCode._POLICYORPROGRAMCOVERAGEROLETYPE)
+      return "_PolicyOrProgramCoverageRoleType";
+    if (code == V3RoleCode._COVERAGEROLETYPE)
+      return "_CoverageRoleType";
+    if (code == V3RoleCode.FAMDEP)
+      return "FAMDEP";
+    if (code == V3RoleCode.HANDIC)
+      return "HANDIC";
+    if (code == V3RoleCode.INJ)
+      return "INJ";
+    if (code == V3RoleCode.SELF)
+      return "SELF";
+    if (code == V3RoleCode.SPON)
+      return "SPON";
+    if (code == V3RoleCode.STUD)
+      return "STUD";
+    if (code == V3RoleCode.FSTUD)
+      return "FSTUD";
+    if (code == V3RoleCode.PSTUD)
+      return "PSTUD";
+    if (code == V3RoleCode.ADOPT)
+      return "ADOPT";
+    if (code == V3RoleCode.GCHILD)
+      return "GCHILD";
+    if (code == V3RoleCode.GPARNT)
+      return "GPARNT";
+    if (code == V3RoleCode.NAT)
+      return "NAT";
+    if (code == V3RoleCode.NIENE)
+      return "NIENE";
+    if (code == V3RoleCode.PARNT)
+      return "PARNT";
+    if (code == V3RoleCode.SPSE)
+      return "SPSE";
+    if (code == V3RoleCode.STEP)
+      return "STEP";
+    if (code == V3RoleCode._COVEREDPARTYROLETYPE)
+      return "_CoveredPartyRoleType";
+    if (code == V3RoleCode._CLAIMANTCOVEREDPARTYROLETYPE)
+      return "_ClaimantCoveredPartyRoleType";
+    if (code == V3RoleCode.CRIMEVIC)
+      return "CRIMEVIC";
+    if (code == V3RoleCode.INJWKR)
+      return "INJWKR";
+    if (code == V3RoleCode._DEPENDENTCOVEREDPARTYROLETYPE)
+      return "_DependentCoveredPartyRoleType";
+    if (code == V3RoleCode.COCBEN)
+      return "COCBEN";
+    if (code == V3RoleCode.DIFFABL)
+      return "DIFFABL";
+    if (code == V3RoleCode.WARD)
+      return "WARD";
+    if (code == V3RoleCode._INDIVIDUALINSUREDPARTYROLETYPE)
+      return "_IndividualInsuredPartyRoleType";
+    if (code == V3RoleCode.RETIREE)
+      return "RETIREE";
+    if (code == V3RoleCode._PROGRAMELIGIBLEPARTYROLETYPE)
+      return "_ProgramEligiblePartyRoleType";
+    if (code == V3RoleCode.INDIG)
+      return "INDIG";
+    if (code == V3RoleCode.MIL)
+      return "MIL";
+    if (code == V3RoleCode.ACTMIL)
+      return "ACTMIL";
+    if (code == V3RoleCode.RETMIL)
+      return "RETMIL";
+    if (code == V3RoleCode.VET)
+      return "VET";
+    if (code == V3RoleCode._SUBSCRIBERCOVEREDPARTYROLETYPE)
+      return "_SubscriberCoveredPartyRoleType";
+    if (code == V3RoleCode._RESEARCHSUBJECTROLEBASIS)
+      return "_ResearchSubjectRoleBasis";
+    if (code == V3RoleCode.ERL)
+      return "ERL";
+    if (code == V3RoleCode.SCN)
+      return "SCN";
+    if (code == V3RoleCode._SERVICEDELIVERYLOCATIONROLETYPE)
+      return "_ServiceDeliveryLocationRoleType";
+    if (code == V3RoleCode._DEDICATEDSERVICEDELIVERYLOCATIONROLETYPE)
+      return "_DedicatedServiceDeliveryLocationRoleType";
+    if (code == V3RoleCode._DEDICATEDCLINICALLOCATIONROLETYPE)
+      return "_DedicatedClinicalLocationRoleType";
+    if (code == V3RoleCode.DX)
+      return "DX";
+    if (code == V3RoleCode.CVDX)
+      return "CVDX";
+    if (code == V3RoleCode.CATH)
+      return "CATH";
+    if (code == V3RoleCode.ECHO)
+      return "ECHO";
+    if (code == V3RoleCode.GIDX)
+      return "GIDX";
+    if (code == V3RoleCode.ENDOS)
+      return "ENDOS";
+    if (code == V3RoleCode.RADDX)
+      return "RADDX";
+    if (code == V3RoleCode.RADO)
+      return "RADO";
+    if (code == V3RoleCode.RNEU)
+      return "RNEU";
+    if (code == V3RoleCode.HOSP)
+      return "HOSP";
+    if (code == V3RoleCode.CHR)
+      return "CHR";
+    if (code == V3RoleCode.GACH)
+      return "GACH";
+    if (code == V3RoleCode.MHSP)
+      return "MHSP";
+    if (code == V3RoleCode.PSYCHF)
+      return "PSYCHF";
+    if (code == V3RoleCode.RH)
+      return "RH";
+    if (code == V3RoleCode.RHAT)
+      return "RHAT";
+    if (code == V3RoleCode.RHII)
+      return "RHII";
+    if (code == V3RoleCode.RHMAD)
+      return "RHMAD";
+    if (code == V3RoleCode.RHPI)
+      return "RHPI";
+    if (code == V3RoleCode.RHPIH)
+      return "RHPIH";
+    if (code == V3RoleCode.RHPIMS)
+      return "RHPIMS";
+    if (code == V3RoleCode.RHPIVS)
+      return "RHPIVS";
+    if (code == V3RoleCode.RHYAD)
+      return "RHYAD";
+    if (code == V3RoleCode.HU)
+      return "HU";
+    if (code == V3RoleCode.BMTU)
+      return "BMTU";
+    if (code == V3RoleCode.CCU)
+      return "CCU";
+    if (code == V3RoleCode.CHEST)
+      return "CHEST";
+    if (code == V3RoleCode.EPIL)
+      return "EPIL";
+    if (code == V3RoleCode.ER)
+      return "ER";
+    if (code == V3RoleCode.ETU)
+      return "ETU";
+    if (code == V3RoleCode.HD)
+      return "HD";
+    if (code == V3RoleCode.HLAB)
+      return "HLAB";
+    if (code == V3RoleCode.INLAB)
+      return "INLAB";
+    if (code == V3RoleCode.OUTLAB)
+      return "OUTLAB";
+    if (code == V3RoleCode.HRAD)
+      return "HRAD";
+    if (code == V3RoleCode.HUSCS)
+      return "HUSCS";
+    if (code == V3RoleCode.ICU)
+      return "ICU";
+    if (code == V3RoleCode.PEDICU)
+      return "PEDICU";
+    if (code == V3RoleCode.PEDNICU)
+      return "PEDNICU";
+    if (code == V3RoleCode.INPHARM)
+      return "INPHARM";
+    if (code == V3RoleCode.MBL)
+      return "MBL";
+    if (code == V3RoleCode.NCCS)
+      return "NCCS";
+    if (code == V3RoleCode.NS)
+      return "NS";
+    if (code == V3RoleCode.OUTPHARM)
+      return "OUTPHARM";
+    if (code == V3RoleCode.PEDU)
+      return "PEDU";
+    if (code == V3RoleCode.PHU)
+      return "PHU";
+    if (code == V3RoleCode.RHU)
+      return "RHU";
+    if (code == V3RoleCode.SLEEP)
+      return "SLEEP";
+    if (code == V3RoleCode.NCCF)
+      return "NCCF";
+    if (code == V3RoleCode.SNF)
+      return "SNF";
+    if (code == V3RoleCode.OF)
+      return "OF";
+    if (code == V3RoleCode.ALL)
+      return "ALL";
+    if (code == V3RoleCode.AMPUT)
+      return "AMPUT";
+    if (code == V3RoleCode.BMTC)
+      return "BMTC";
+    if (code == V3RoleCode.BREAST)
+      return "BREAST";
+    if (code == V3RoleCode.CANC)
+      return "CANC";
+    if (code == V3RoleCode.CAPC)
+      return "CAPC";
+    if (code == V3RoleCode.CARD)
+      return "CARD";
+    if (code == V3RoleCode.PEDCARD)
+      return "PEDCARD";
+    if (code == V3RoleCode.COAG)
+      return "COAG";
+    if (code == V3RoleCode.CRS)
+      return "CRS";
+    if (code == V3RoleCode.DERM)
+      return "DERM";
+    if (code == V3RoleCode.ENDO)
+      return "ENDO";
+    if (code == V3RoleCode.PEDE)
+      return "PEDE";
+    if (code == V3RoleCode.ENT)
+      return "ENT";
+    if (code == V3RoleCode.FMC)
+      return "FMC";
+    if (code == V3RoleCode.GI)
+      return "GI";
+    if (code == V3RoleCode.PEDGI)
+      return "PEDGI";
+    if (code == V3RoleCode.GIM)
+      return "GIM";
+    if (code == V3RoleCode.GYN)
+      return "GYN";
+    if (code == V3RoleCode.HEM)
+      return "HEM";
+    if (code == V3RoleCode.PEDHEM)
+      return "PEDHEM";
+    if (code == V3RoleCode.HTN)
+      return "HTN";
+    if (code == V3RoleCode.IEC)
+      return "IEC";
+    if (code == V3RoleCode.INFD)
+      return "INFD";
+    if (code == V3RoleCode.PEDID)
+      return "PEDID";
+    if (code == V3RoleCode.INV)
+      return "INV";
+    if (code == V3RoleCode.LYMPH)
+      return "LYMPH";
+    if (code == V3RoleCode.MGEN)
+      return "MGEN";
+    if (code == V3RoleCode.NEPH)
+      return "NEPH";
+    if (code == V3RoleCode.PEDNEPH)
+      return "PEDNEPH";
+    if (code == V3RoleCode.NEUR)
+      return "NEUR";
+    if (code == V3RoleCode.OB)
+      return "OB";
+    if (code == V3RoleCode.OMS)
+      return "OMS";
+    if (code == V3RoleCode.ONCL)
+      return "ONCL";
+    if (code == V3RoleCode.PEDHO)
+      return "PEDHO";
+    if (code == V3RoleCode.OPH)
+      return "OPH";
+    if (code == V3RoleCode.OPTC)
+      return "OPTC";
+    if (code == V3RoleCode.ORTHO)
+      return "ORTHO";
+    if (code == V3RoleCode.HAND)
+      return "HAND";
+    if (code == V3RoleCode.PAINCL)
+      return "PAINCL";
+    if (code == V3RoleCode.PC)
+      return "PC";
+    if (code == V3RoleCode.PEDC)
+      return "PEDC";
+    if (code == V3RoleCode.PEDRHEUM)
+      return "PEDRHEUM";
+    if (code == V3RoleCode.POD)
+      return "POD";
+    if (code == V3RoleCode.PREV)
+      return "PREV";
+    if (code == V3RoleCode.PROCTO)
+      return "PROCTO";
+    if (code == V3RoleCode.PROFF)
+      return "PROFF";
+    if (code == V3RoleCode.PROS)
+      return "PROS";
+    if (code == V3RoleCode.PSI)
+      return "PSI";
+    if (code == V3RoleCode.PSY)
+      return "PSY";
+    if (code == V3RoleCode.RHEUM)
+      return "RHEUM";
+    if (code == V3RoleCode.SPMED)
+      return "SPMED";
+    if (code == V3RoleCode.SU)
+      return "SU";
+    if (code == V3RoleCode.PLS)
+      return "PLS";
+    if (code == V3RoleCode.URO)
+      return "URO";
+    if (code == V3RoleCode.TR)
+      return "TR";
+    if (code == V3RoleCode.TRAVEL)
+      return "TRAVEL";
+    if (code == V3RoleCode.WND)
+      return "WND";
+    if (code == V3RoleCode.RTF)
+      return "RTF";
+    if (code == V3RoleCode.PRC)
+      return "PRC";
+    if (code == V3RoleCode.SURF)
+      return "SURF";
+    if (code == V3RoleCode._DEDICATEDNONCLINICALLOCATIONROLETYPE)
+      return "_DedicatedNonClinicalLocationRoleType";
+    if (code == V3RoleCode.DADDR)
+      return "DADDR";
+    if (code == V3RoleCode.MOBL)
+      return "MOBL";
+    if (code == V3RoleCode.AMB)
+      return "AMB";
+    if (code == V3RoleCode.PHARM)
+      return "PHARM";
+    if (code == V3RoleCode._INCIDENTALSERVICEDELIVERYLOCATIONROLETYPE)
+      return "_IncidentalServiceDeliveryLocationRoleType";
+    if (code == V3RoleCode.ACC)
+      return "ACC";
+    if (code == V3RoleCode.COMM)
+      return "COMM";
+    if (code == V3RoleCode.CSC)
+      return "CSC";
+    if (code == V3RoleCode.PTRES)
+      return "PTRES";
+    if (code == V3RoleCode.SCHOOL)
+      return "SCHOOL";
+    if (code == V3RoleCode.UPC)
+      return "UPC";
+    if (code == V3RoleCode.WORK)
+      return "WORK";
+    if (code == V3RoleCode._SPECIMENROLETYPE)
+      return "_SpecimenRoleType";
+    if (code == V3RoleCode.C)
+      return "C";
+    if (code == V3RoleCode.G)
+      return "G";
+    if (code == V3RoleCode.L)
+      return "L";
+    if (code == V3RoleCode.P)
+      return "P";
+    if (code == V3RoleCode.Q)
+      return "Q";
+    if (code == V3RoleCode.B)
+      return "B";
+    if (code == V3RoleCode.E)
+      return "E";
+    if (code == V3RoleCode.F)
+      return "F";
+    if (code == V3RoleCode.O)
+      return "O";
+    if (code == V3RoleCode.V)
+      return "V";
+    if (code == V3RoleCode.R)
+      return "R";
+    if (code == V3RoleCode.CLAIM)
+      return "CLAIM";
+    if (code == V3RoleCode.COMMUNITYLABORATORY)
+      return "communityLaboratory";
+    if (code == V3RoleCode.GT)
+      return "GT";
+    if (code == V3RoleCode.HOMEHEALTH)
+      return "homeHealth";
+    if (code == V3RoleCode.LABORATORY)
+      return "laboratory";
+    if (code == V3RoleCode.PATHOLOGIST)
+      return "pathologist";
+    if (code == V3RoleCode.PH)
+      return "PH";
+    if (code == V3RoleCode.PHLEBOTOMIST)
+      return "phlebotomist";
+    if (code == V3RoleCode.PROG)
+      return "PROG";
+    if (code == V3RoleCode.PT)
+      return "PT";
+    if (code == V3RoleCode.SUBJECT)
+      return "subject";
+    if (code == V3RoleCode.THIRDPARTY)
+      return "thirdParty";
+    if (code == V3RoleCode.DEP)
+      return "DEP";
+    if (code == V3RoleCode.DEPEN)
+      return "DEPEN";
+    if (code == V3RoleCode.FM)
+      return "FM";
+    if (code == V3RoleCode.INDIV)
+      return "INDIV";
+    if (code == V3RoleCode.NAMED)
+      return "NAMED";
+    if (code == V3RoleCode.PSYCHCF)
+      return "PSYCHCF";
+    if (code == V3RoleCode.SUBSCR)
+      return "SUBSCR";
+    return "?";
+  }
+
+    public String toSystem(V3RoleCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkStatus.java
new file mode 100644
index 00000000000..c8237d66f36
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkStatus.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3RoleLinkStatus {
+
+        /**
+         * Description: The 'typical' state. Excludes "nullified" which represents the termination state of a RoleLink instance that was created in error.
+         */
+        NORMAL, 
+        /**
+         * Description: The state indicates the RoleLink is in progress.
+         */
+        ACTIVE, 
+        /**
+         * Description: The terminal state resulting from abandoning the RoleLink prior to or after activation.
+         */
+        CANCELLED, 
+        /**
+         * Description: The terminal state representing the successful completion of the RoleLink.
+         */
+        COMPLETED, 
+        /**
+         * Description: The state indicates the RoleLink has not yet become active.
+         */
+        PENDING, 
+        /**
+         * Description: The state representing the termination of a RoleLink instance that was created in error.
+         */
+        NULLIFIED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3RoleLinkStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("NORMAL".equals(codeString))
+          return NORMAL;
+        if ("ACTIVE".equals(codeString))
+          return ACTIVE;
+        if ("CANCELLED".equals(codeString))
+          return CANCELLED;
+        if ("COMPLETED".equals(codeString))
+          return COMPLETED;
+        if ("PENDING".equals(codeString))
+          return PENDING;
+        if ("NULLIFIED".equals(codeString))
+          return NULLIFIED;
+        throw new FHIRException("Unknown V3RoleLinkStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NORMAL: return "NORMAL";
+            case ACTIVE: return "ACTIVE";
+            case CANCELLED: return "CANCELLED";
+            case COMPLETED: return "COMPLETED";
+            case PENDING: return "PENDING";
+            case NULLIFIED: return "NULLIFIED";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/RoleLinkStatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NORMAL: return "Description: The 'typical' state. Excludes \"nullified\" which represents the termination state of a RoleLink instance that was created in error.";
+            case ACTIVE: return "Description: The state indicates the RoleLink is in progress.";
+            case CANCELLED: return "Description: The terminal state resulting from abandoning the RoleLink prior to or after activation.";
+            case COMPLETED: return "Description: The terminal state representing the successful completion of the RoleLink.";
+            case PENDING: return "Description: The state indicates the RoleLink has not yet become active.";
+            case NULLIFIED: return "Description: The state representing the termination of a RoleLink instance that was created in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case COMPLETED: return "completed";
+            case PENDING: return "pending";
+            case NULLIFIED: return "nullified";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkStatusEnumFactory.java
new file mode 100644
index 00000000000..b2b990611db
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkStatusEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3RoleLinkStatusEnumFactory implements EnumFactory {
+
+  public V3RoleLinkStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("NORMAL".equals(codeString))
+      return V3RoleLinkStatus.NORMAL;
+    if ("ACTIVE".equals(codeString))
+      return V3RoleLinkStatus.ACTIVE;
+    if ("CANCELLED".equals(codeString))
+      return V3RoleLinkStatus.CANCELLED;
+    if ("COMPLETED".equals(codeString))
+      return V3RoleLinkStatus.COMPLETED;
+    if ("PENDING".equals(codeString))
+      return V3RoleLinkStatus.PENDING;
+    if ("NULLIFIED".equals(codeString))
+      return V3RoleLinkStatus.NULLIFIED;
+    throw new IllegalArgumentException("Unknown V3RoleLinkStatus code '"+codeString+"'");
+  }
+
+  public String toCode(V3RoleLinkStatus code) {
+    if (code == V3RoleLinkStatus.NORMAL)
+      return "NORMAL";
+    if (code == V3RoleLinkStatus.ACTIVE)
+      return "ACTIVE";
+    if (code == V3RoleLinkStatus.CANCELLED)
+      return "CANCELLED";
+    if (code == V3RoleLinkStatus.COMPLETED)
+      return "COMPLETED";
+    if (code == V3RoleLinkStatus.PENDING)
+      return "PENDING";
+    if (code == V3RoleLinkStatus.NULLIFIED)
+      return "NULLIFIED";
+    return "?";
+  }
+
+    public String toSystem(V3RoleLinkStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkType.java
new file mode 100644
index 00000000000..131acec940e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkType.java
@@ -0,0 +1,143 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3RoleLinkType {
+
+        /**
+         * An action taken with respect to a subject Entity by a regulatory or authoritative body with supervisory capacity over that entity. The action is taken in response to behavior by the subject Entity that body finds to be undesirable.
+
+                        Suspension, license restrictions, monetary fine, letter of reprimand, mandated training, mandated supervision, etc.Examples:
+         */
+        REL, 
+        /**
+         * This relationship indicates the source Role is available to the target Role as a backup. An entity in a backup role will be available as a substitute or replacement in the event that the entity assigned the role is unavailable. In medical roles where it is critical that the function be performed and there is a possibility that the individual assigned may be ill or otherwise indisposed, another individual is assigned to cover for the individual originally assigned the role. A backup may be required to be identified, but unless the backup is actually used, he/she would not assume the assigned entity role.
+         */
+        BACKUP, 
+        /**
+         * This relationship indicates the target Role provides or receives information regarding the target role.  For example, AssignedEntity is a contact for a ServiceDeliveryLocation.
+         */
+        CONT, 
+        /**
+         * The source Role has direct authority over the target role in a chain of authority.
+         */
+        DIRAUTH, 
+        /**
+         * Description: The source role provides identification for the target role. The source role must be IDENT. The player entity of the source role is constrained to be the same as (i.e. the equivalent of, or equal to) the player of the target role if present. If the player is absent from the source role, then it is assumed to be the same as the player of the target role.
+         */
+        IDENT, 
+        /**
+         * The source Role has indirect authority over the target role in a chain of authority.
+         */
+        INDAUTH, 
+        /**
+         * The target Role is part of the Source Role.
+         */
+        PART, 
+        /**
+         * This relationship indicates that the source Role replaces (or subsumes) the target Role.  Allows for new identifiers and/or new effective time for a registry entry or a certification, etc.
+         */
+        REPL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3RoleLinkType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("REL".equals(codeString))
+          return REL;
+        if ("BACKUP".equals(codeString))
+          return BACKUP;
+        if ("CONT".equals(codeString))
+          return CONT;
+        if ("DIRAUTH".equals(codeString))
+          return DIRAUTH;
+        if ("IDENT".equals(codeString))
+          return IDENT;
+        if ("INDAUTH".equals(codeString))
+          return INDAUTH;
+        if ("PART".equals(codeString))
+          return PART;
+        if ("REPL".equals(codeString))
+          return REPL;
+        throw new FHIRException("Unknown V3RoleLinkType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case REL: return "REL";
+            case BACKUP: return "BACKUP";
+            case CONT: return "CONT";
+            case DIRAUTH: return "DIRAUTH";
+            case IDENT: return "IDENT";
+            case INDAUTH: return "INDAUTH";
+            case PART: return "PART";
+            case REPL: return "REPL";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/RoleLinkType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case REL: return "An action taken with respect to a subject Entity by a regulatory or authoritative body with supervisory capacity over that entity. The action is taken in response to behavior by the subject Entity that body finds to be undesirable.\r\n\n                        Suspension, license restrictions, monetary fine, letter of reprimand, mandated training, mandated supervision, etc.Examples:";
+            case BACKUP: return "This relationship indicates the source Role is available to the target Role as a backup. An entity in a backup role will be available as a substitute or replacement in the event that the entity assigned the role is unavailable. In medical roles where it is critical that the function be performed and there is a possibility that the individual assigned may be ill or otherwise indisposed, another individual is assigned to cover for the individual originally assigned the role. A backup may be required to be identified, but unless the backup is actually used, he/she would not assume the assigned entity role.";
+            case CONT: return "This relationship indicates the target Role provides or receives information regarding the target role.  For example, AssignedEntity is a contact for a ServiceDeliveryLocation.";
+            case DIRAUTH: return "The source Role has direct authority over the target role in a chain of authority.";
+            case IDENT: return "Description: The source role provides identification for the target role. The source role must be IDENT. The player entity of the source role is constrained to be the same as (i.e. the equivalent of, or equal to) the player of the target role if present. If the player is absent from the source role, then it is assumed to be the same as the player of the target role.";
+            case INDAUTH: return "The source Role has indirect authority over the target role in a chain of authority.";
+            case PART: return "The target Role is part of the Source Role.";
+            case REPL: return "This relationship indicates that the source Role replaces (or subsumes) the target Role.  Allows for new identifiers and/or new effective time for a registry entry or a certification, etc.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case REL: return "related";
+            case BACKUP: return "is backup for";
+            case CONT: return "has contact";
+            case DIRAUTH: return "has direct authority over";
+            case IDENT: return "Identification";
+            case INDAUTH: return "has indirect authority over";
+            case PART: return "has part";
+            case REPL: return "replaces";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkTypeEnumFactory.java
new file mode 100644
index 00000000000..27aad801922
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleLinkTypeEnumFactory.java
@@ -0,0 +1,86 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3RoleLinkTypeEnumFactory implements EnumFactory {
+
+  public V3RoleLinkType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("REL".equals(codeString))
+      return V3RoleLinkType.REL;
+    if ("BACKUP".equals(codeString))
+      return V3RoleLinkType.BACKUP;
+    if ("CONT".equals(codeString))
+      return V3RoleLinkType.CONT;
+    if ("DIRAUTH".equals(codeString))
+      return V3RoleLinkType.DIRAUTH;
+    if ("IDENT".equals(codeString))
+      return V3RoleLinkType.IDENT;
+    if ("INDAUTH".equals(codeString))
+      return V3RoleLinkType.INDAUTH;
+    if ("PART".equals(codeString))
+      return V3RoleLinkType.PART;
+    if ("REPL".equals(codeString))
+      return V3RoleLinkType.REPL;
+    throw new IllegalArgumentException("Unknown V3RoleLinkType code '"+codeString+"'");
+  }
+
+  public String toCode(V3RoleLinkType code) {
+    if (code == V3RoleLinkType.REL)
+      return "REL";
+    if (code == V3RoleLinkType.BACKUP)
+      return "BACKUP";
+    if (code == V3RoleLinkType.CONT)
+      return "CONT";
+    if (code == V3RoleLinkType.DIRAUTH)
+      return "DIRAUTH";
+    if (code == V3RoleLinkType.IDENT)
+      return "IDENT";
+    if (code == V3RoleLinkType.INDAUTH)
+      return "INDAUTH";
+    if (code == V3RoleLinkType.PART)
+      return "PART";
+    if (code == V3RoleLinkType.REPL)
+      return "REPL";
+    return "?";
+  }
+
+    public String toSystem(V3RoleLinkType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleStatus.java
new file mode 100644
index 00000000000..cfced6c4bed
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleStatus.java
@@ -0,0 +1,132 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3RoleStatus {
+
+        /**
+         * The 'typical' state. Excludes "nullified" which represents the termination state of a Role instance that was created in error.
+         */
+        NORMAL, 
+        /**
+         * The state representing the fact that the Entity is currently active in the Role.
+         */
+        ACTIVE, 
+        /**
+         * The terminal state resulting from cancellation of the role prior to activation.
+         */
+        CANCELLED, 
+        /**
+         * The state representing that fact that the role has not yet become active.
+         */
+        PENDING, 
+        /**
+         * The state that represents a suspension of the Entity playing the Role. This state is arrived at from the "active" state.
+         */
+        SUSPENDED, 
+        /**
+         * The state representing the successful termination of the Role.
+         */
+        TERMINATED, 
+        /**
+         * The state representing the termination of a Role instance that was created in error.
+         */
+        NULLIFIED, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3RoleStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("normal".equals(codeString))
+          return NORMAL;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("pending".equals(codeString))
+          return PENDING;
+        if ("suspended".equals(codeString))
+          return SUSPENDED;
+        if ("terminated".equals(codeString))
+          return TERMINATED;
+        if ("nullified".equals(codeString))
+          return NULLIFIED;
+        throw new FHIRException("Unknown V3RoleStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case PENDING: return "pending";
+            case SUSPENDED: return "suspended";
+            case TERMINATED: return "terminated";
+            case NULLIFIED: return "nullified";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/RoleStatus";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NORMAL: return "The 'typical' state. Excludes \"nullified\" which represents the termination state of a Role instance that was created in error.";
+            case ACTIVE: return "The state representing the fact that the Entity is currently active in the Role.";
+            case CANCELLED: return "The terminal state resulting from cancellation of the role prior to activation.";
+            case PENDING: return "The state representing that fact that the role has not yet become active.";
+            case SUSPENDED: return "The state that represents a suspension of the Entity playing the Role. This state is arrived at from the \"active\" state.";
+            case TERMINATED: return "The state representing the successful termination of the Role.";
+            case NULLIFIED: return "The state representing the termination of a Role instance that was created in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NORMAL: return "normal";
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case PENDING: return "pending";
+            case SUSPENDED: return "suspended";
+            case TERMINATED: return "terminated";
+            case NULLIFIED: return "nullified";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleStatusEnumFactory.java
new file mode 100644
index 00000000000..262f406117b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RoleStatusEnumFactory.java
@@ -0,0 +1,82 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3RoleStatusEnumFactory implements EnumFactory {
+
+  public V3RoleStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("normal".equals(codeString))
+      return V3RoleStatus.NORMAL;
+    if ("active".equals(codeString))
+      return V3RoleStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return V3RoleStatus.CANCELLED;
+    if ("pending".equals(codeString))
+      return V3RoleStatus.PENDING;
+    if ("suspended".equals(codeString))
+      return V3RoleStatus.SUSPENDED;
+    if ("terminated".equals(codeString))
+      return V3RoleStatus.TERMINATED;
+    if ("nullified".equals(codeString))
+      return V3RoleStatus.NULLIFIED;
+    throw new IllegalArgumentException("Unknown V3RoleStatus code '"+codeString+"'");
+  }
+
+  public String toCode(V3RoleStatus code) {
+    if (code == V3RoleStatus.NORMAL)
+      return "normal";
+    if (code == V3RoleStatus.ACTIVE)
+      return "active";
+    if (code == V3RoleStatus.CANCELLED)
+      return "cancelled";
+    if (code == V3RoleStatus.PENDING)
+      return "pending";
+    if (code == V3RoleStatus.SUSPENDED)
+      return "suspended";
+    if (code == V3RoleStatus.TERMINATED)
+      return "terminated";
+    if (code == V3RoleStatus.NULLIFIED)
+      return "nullified";
+    return "?";
+  }
+
+    public String toSystem(V3RoleStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RouteOfAdministration.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RouteOfAdministration.java
new file mode 100644
index 00000000000..07baff266d0
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RouteOfAdministration.java
@@ -0,0 +1,3543 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3RouteOfAdministration {
+
+        /**
+         * Route of substance administration classified by administration method.
+         */
+        _ROUTEBYMETHOD, 
+        /**
+         * Immersion (soak)
+         */
+        SOAK, 
+        /**
+         * Shampoo
+         */
+        SHAMPOO, 
+        /**
+         * Translingual
+         */
+        TRNSLING, 
+        /**
+         * Swallow, oral
+         */
+        PO, 
+        /**
+         * Gargle
+         */
+        GARGLE, 
+        /**
+         * Suck, oromucosal
+         */
+        SUCK, 
+        /**
+         * Chew
+         */
+        _CHEW, 
+        /**
+         * Chew, oral
+         */
+        CHEW, 
+        /**
+         * Diffusion
+         */
+        _DIFFUSION, 
+        /**
+         * Diffusion, extracorporeal
+         */
+        EXTCORPDIF, 
+        /**
+         * Diffusion, hemodialysis
+         */
+        HEMODIFF, 
+        /**
+         * Diffusion, transdermal
+         */
+        TRNSDERMD, 
+        /**
+         * Dissolve
+         */
+        _DISSOLVE, 
+        /**
+         * Dissolve, oral
+         */
+        DISSOLVE, 
+        /**
+         * Dissolve, sublingual
+         */
+        SL, 
+        /**
+         * Douche
+         */
+        _DOUCHE, 
+        /**
+         * Douche, vaginal
+         */
+        DOUCHE, 
+        /**
+         * Electro-osmosis
+         */
+        _ELECTROOSMOSISROUTE, 
+        /**
+         * Electro-osmosis
+         */
+        ELECTOSMOS, 
+        /**
+         * Enema
+         */
+        _ENEMA, 
+        /**
+         * Enema, rectal
+         */
+        ENEMA, 
+        /**
+         * Enema, rectal retention
+         */
+        RETENEMA, 
+        /**
+         * Flush
+         */
+        _FLUSH, 
+        /**
+         * Flush, intravenous catheter
+         */
+        IVFLUSH, 
+        /**
+         * Implantation
+         */
+        _IMPLANTATION, 
+        /**
+         * Implantation, intradermal
+         */
+        IDIMPLNT, 
+        /**
+         * Implantation, intravitreal
+         */
+        IVITIMPLNT, 
+        /**
+         * Implantation, subcutaneous
+         */
+        SQIMPLNT, 
+        /**
+         * Infusion
+         */
+        _INFUSION, 
+        /**
+         * Infusion, epidural
+         */
+        EPI, 
+        /**
+         * Infusion, intraarterial catheter
+         */
+        IA, 
+        /**
+         * Infusion, intracardiac
+         */
+        IC, 
+        /**
+         * Infusion, intracoronary
+         */
+        ICOR, 
+        /**
+         * Infusion, intraosseous, continuous
+         */
+        IOSSC, 
+        /**
+         * Infusion, intrathecal
+         */
+        IT, 
+        /**
+         * Infusion, intravenous
+         */
+        IV, 
+        /**
+         * Infusion, intravenous catheter
+         */
+        IVC, 
+        /**
+         * Infusion, intravenous catheter, continuous
+         */
+        IVCC, 
+        /**
+         * Infusion, intravenous catheter, intermittent
+         */
+        IVCI, 
+        /**
+         * Infusion, intravenous catheter, pca pump
+         */
+        PCA, 
+        /**
+         * Infusion, intravascular
+         */
+        IVASCINFUS, 
+        /**
+         * Infusion, subcutaneous
+         */
+        SQINFUS, 
+        /**
+         * Inhalation
+         */
+        _INHALATION, 
+        /**
+         * Inhalation, oral
+         */
+        IPINHL, 
+        /**
+         * Inhalation, oral intermittent flow
+         */
+        ORIFINHL, 
+        /**
+         * Inhalation, oral rebreather mask
+         */
+        REBREATH, 
+        /**
+         * Inhalation, intermittent positive pressure breathing (ippb)
+         */
+        IPPB, 
+        /**
+         * Inhalation, nasal
+         */
+        NASINHL, 
+        /**
+         * Inhalation, nasal, prongs
+         */
+        NASINHLC, 
+        /**
+         * Inhalation, nebulization
+         */
+        NEB, 
+        /**
+         * Inhalation, nebulization, nasal
+         */
+        NASNEB, 
+        /**
+         * Inhalation, nebulization, oral
+         */
+        ORNEB, 
+        /**
+         * Inhalation, tracheostomy
+         */
+        TRACH, 
+        /**
+         * Inhalation, ventilator
+         */
+        VENT, 
+        /**
+         * Inhalation, ventimask
+         */
+        VENTMASK, 
+        /**
+         * Injection
+         */
+        _INJECTION, 
+        /**
+         * Injection, amniotic fluid
+         */
+        AMNINJ, 
+        /**
+         * Injection, biliary tract
+         */
+        BILINJ, 
+        /**
+         * Injection, for cholangiography
+         */
+        CHOLINJ, 
+        /**
+         * Injection, cervical
+         */
+        CERVINJ, 
+        /**
+         * Injection, epidural
+         */
+        EPIDURINJ, 
+        /**
+         * Injection, epidural, push
+         */
+        EPIINJ, 
+        /**
+         * Injection, epidural, slow push
+         */
+        EPINJSP, 
+        /**
+         * Injection, extra-amniotic
+         */
+        EXTRAMNINJ, 
+        /**
+         * Injection, extracorporeal
+         */
+        EXTCORPINJ, 
+        /**
+         * Injection, gastric button
+         */
+        GBINJ, 
+        /**
+         * Injection, gingival
+         */
+        GINGINJ, 
+        /**
+         * Injection, urinary bladder
+         */
+        BLADINJ, 
+        /**
+         * Injection, endosinusial
+         */
+        ENDOSININJ, 
+        /**
+         * Injection, hemodialysis port
+         */
+        HEMOPORT, 
+        /**
+         * Injection, intra-abdominal
+         */
+        IABDINJ, 
+        /**
+         * Injection, intraarterial
+         */
+        IAINJ, 
+        /**
+         * Injection, intraarterial, push
+         */
+        IAINJP, 
+        /**
+         * Injection, intraarterial, slow push
+         */
+        IAINJSP, 
+        /**
+         * Injection, intraarticular
+         */
+        IARTINJ, 
+        /**
+         * Injection, intrabursal
+         */
+        IBURSINJ, 
+        /**
+         * Injection, intracardiac
+         */
+        ICARDINJ, 
+        /**
+         * Injection, intracardiac, rapid push
+         */
+        ICARDINJRP, 
+        /**
+         * Injection, intracardiac, slow push
+         */
+        ICARDINJSP, 
+        /**
+         * Injection, intracardiac, push
+         */
+        ICARINJP, 
+        /**
+         * Injection, intracartilaginous
+         */
+        ICARTINJ, 
+        /**
+         * Injection, intracaudal
+         */
+        ICAUDINJ, 
+        /**
+         * Injection, intracavernous
+         */
+        ICAVINJ, 
+        /**
+         * Injection, intracavitary
+         */
+        ICAVITINJ, 
+        /**
+         * Injection, intracerebral
+         */
+        ICEREBINJ, 
+        /**
+         * Injection, intracisternal
+         */
+        ICISTERNINJ, 
+        /**
+         * Injection, intracoronary
+         */
+        ICORONINJ, 
+        /**
+         * Injection, intracoronary, push
+         */
+        ICORONINJP, 
+        /**
+         * Injection, intracorpus cavernosum
+         */
+        ICORPCAVINJ, 
+        /**
+         * Injection, intradermal
+         */
+        IDINJ, 
+        /**
+         * Injection, intradiscal
+         */
+        IDISCINJ, 
+        /**
+         * Injection, intraductal
+         */
+        IDUCTINJ, 
+        /**
+         * Injection, intradural
+         */
+        IDURINJ, 
+        /**
+         * Injection, intraepidermal
+         */
+        IEPIDINJ, 
+        /**
+         * Injection, intraepithelial
+         */
+        IEPITHINJ, 
+        /**
+         * Injection, intralesional
+         */
+        ILESINJ, 
+        /**
+         * Injection, intraluminal
+         */
+        ILUMINJ, 
+        /**
+         * Injection, intralymphatic
+         */
+        ILYMPJINJ, 
+        /**
+         * Injection, intramuscular
+         */
+        IM, 
+        /**
+         * Injection, intramuscular, deep
+         */
+        IMD, 
+        /**
+         * Injection, intramuscular, z track
+         */
+        IMZ, 
+        /**
+         * Injection, intramedullary
+         */
+        IMEDULINJ, 
+        /**
+         * Injection, interameningeal
+         */
+        INTERMENINJ, 
+        /**
+         * Injection, interstitial
+         */
+        INTERSTITINJ, 
+        /**
+         * Injection, intraocular
+         */
+        IOINJ, 
+        /**
+         * Injection, intraosseous
+         */
+        IOSSINJ, 
+        /**
+         * Injection, intraovarian
+         */
+        IOVARINJ, 
+        /**
+         * Injection, intrapericardial
+         */
+        IPCARDINJ, 
+        /**
+         * Injection, intraperitoneal
+         */
+        IPERINJ, 
+        /**
+         * Injection, intrapulmonary
+         */
+        IPINJ, 
+        /**
+         * Injection, intrapleural
+         */
+        IPLRINJ, 
+        /**
+         * Injection, intraprostatic
+         */
+        IPROSTINJ, 
+        /**
+         * Injection, insulin pump
+         */
+        IPUMPINJ, 
+        /**
+         * Injection, intraspinal
+         */
+        ISINJ, 
+        /**
+         * Injection, intrasternal
+         */
+        ISTERINJ, 
+        /**
+         * Injection, intrasynovial
+         */
+        ISYNINJ, 
+        /**
+         * Injection, intratendinous
+         */
+        ITENDINJ, 
+        /**
+         * Injection, intratesticular
+         */
+        ITESTINJ, 
+        /**
+         * Injection, intrathoracic
+         */
+        ITHORINJ, 
+        /**
+         * Injection, intrathecal
+         */
+        ITINJ, 
+        /**
+         * Injection, intratubular
+         */
+        ITUBINJ, 
+        /**
+         * Injection, intratumor
+         */
+        ITUMINJ, 
+        /**
+         * Injection, intratympanic
+         */
+        ITYMPINJ, 
+        /**
+         * Injection, intracervical (uterus)
+         */
+        IUINJ, 
+        /**
+         * Injection, intracervical (uterus)
+         */
+        IUINJC, 
+        /**
+         * Injection, intraureteral, retrograde
+         */
+        IURETINJ, 
+        /**
+         * Injection, intravascular
+         */
+        IVASCINJ, 
+        /**
+         * Injection, intraventricular (heart)
+         */
+        IVENTINJ, 
+        /**
+         * Injection, intravesicle
+         */
+        IVESINJ, 
+        /**
+         * Injection, intravenous
+         */
+        IVINJ, 
+        /**
+         * Injection, intravenous, bolus
+         */
+        IVINJBOL, 
+        /**
+         * Injection, intravenous, push
+         */
+        IVPUSH, 
+        /**
+         * Injection, intravenous, rapid push
+         */
+        IVRPUSH, 
+        /**
+         * Injection, intravenous, slow push
+         */
+        IVSPUSH, 
+        /**
+         * Injection, intravitreal
+         */
+        IVITINJ, 
+        /**
+         * Injection, periarticular
+         */
+        PAINJ, 
+        /**
+         * Injection, parenteral
+         */
+        PARENTINJ, 
+        /**
+         * Injection, periodontal
+         */
+        PDONTINJ, 
+        /**
+         * Injection, peritoneal dialysis port
+         */
+        PDPINJ, 
+        /**
+         * Injection, peridural
+         */
+        PDURINJ, 
+        /**
+         * Injection, perineural
+         */
+        PNINJ, 
+        /**
+         * Injection, paranasal sinuses
+         */
+        PNSINJ, 
+        /**
+         * Injection, retrobulbar
+         */
+        RBINJ, 
+        /**
+         * Injection, subconjunctival
+         */
+        SCINJ, 
+        /**
+         * Injection, sublesional
+         */
+        SLESINJ, 
+        /**
+         * Injection, soft tissue
+         */
+        SOFTISINJ, 
+        /**
+         * Injection, subcutaneous
+         */
+        SQ, 
+        /**
+         * Injection, subarachnoid
+         */
+        SUBARACHINJ, 
+        /**
+         * Injection, submucosal
+         */
+        SUBMUCINJ, 
+        /**
+         * Injection, transplacental
+         */
+        TRPLACINJ, 
+        /**
+         * Injection, transtracheal
+         */
+        TRTRACHINJ, 
+        /**
+         * Injection, urethral
+         */
+        URETHINJ, 
+        /**
+         * Injection, ureteral
+         */
+        URETINJ, 
+        /**
+         * Insertion
+         */
+        _INSERTION, 
+        /**
+         * Insertion, cervical (uterine)
+         */
+        CERVINS, 
+        /**
+         * Insertion, intraocular, surgical
+         */
+        IOSURGINS, 
+        /**
+         * Insertion, intrauterine
+         */
+        IU, 
+        /**
+         * Insertion, lacrimal puncta
+         */
+        LPINS, 
+        /**
+         * Insertion, rectal
+         */
+        PR, 
+        /**
+         * Insertion, subcutaneous, surgical
+         */
+        SQSURGINS, 
+        /**
+         * Insertion, urethral
+         */
+        URETHINS, 
+        /**
+         * Insertion, vaginal
+         */
+        VAGINSI, 
+        /**
+         * Instillation
+         */
+        _INSTILLATION, 
+        /**
+         * Instillation, cecostomy
+         */
+        CECINSTL, 
+        /**
+         * Instillation, enteral feeding tube
+         */
+        EFT, 
+        /**
+         * Instillation, enteral
+         */
+        ENTINSTL, 
+        /**
+         * Instillation, gastrostomy tube
+         */
+        GT, 
+        /**
+         * Instillation, nasogastric tube
+         */
+        NGT, 
+        /**
+         * Instillation, orogastric tube
+         */
+        OGT, 
+        /**
+         * Instillation, urinary catheter
+         */
+        BLADINSTL, 
+        /**
+         * Instillation, continuous ambulatory peritoneal dialysis port
+         */
+        CAPDINSTL, 
+        /**
+         * Instillation, chest tube
+         */
+        CTINSTL, 
+        /**
+         * Instillation, endotracheal tube
+         */
+        ETINSTL, 
+        /**
+         * Instillation, gastro-jejunostomy tube
+         */
+        GJT, 
+        /**
+         * Instillation, intrabronchial
+         */
+        IBRONCHINSTIL, 
+        /**
+         * Instillation, intraduodenal
+         */
+        IDUODINSTIL, 
+        /**
+         * Instillation, intraesophageal
+         */
+        IESOPHINSTIL, 
+        /**
+         * Instillation, intragastric
+         */
+        IGASTINSTIL, 
+        /**
+         * Instillation, intraileal
+         */
+        IILEALINJ, 
+        /**
+         * Instillation, intraocular
+         */
+        IOINSTL, 
+        /**
+         * Instillation, intrasinal
+         */
+        ISININSTIL, 
+        /**
+         * Instillation, intratracheal
+         */
+        ITRACHINSTIL, 
+        /**
+         * Instillation, intrauterine
+         */
+        IUINSTL, 
+        /**
+         * Instillation, jejunostomy tube
+         */
+        JJTINSTL, 
+        /**
+         * Instillation, laryngeal
+         */
+        LARYNGINSTIL, 
+        /**
+         * Instillation, nasal
+         */
+        NASALINSTIL, 
+        /**
+         * Instillation, nasogastric
+         */
+        NASOGASINSTIL, 
+        /**
+         * Instillation, nasotracheal tube
+         */
+        NTT, 
+        /**
+         * Instillation, orojejunum tube
+         */
+        OJJ, 
+        /**
+         * Instillation, otic
+         */
+        OT, 
+        /**
+         * Instillation, peritoneal dialysis port
+         */
+        PDPINSTL, 
+        /**
+         * Instillation, paranasal sinuses
+         */
+        PNSINSTL, 
+        /**
+         * Instillation, rectal
+         */
+        RECINSTL, 
+        /**
+         * Instillation, rectal tube
+         */
+        RECTINSTL, 
+        /**
+         * Instillation, sinus, unspecified
+         */
+        SININSTIL, 
+        /**
+         * Instillation, soft tissue
+         */
+        SOFTISINSTIL, 
+        /**
+         * Instillation, tracheostomy
+         */
+        TRACHINSTL, 
+        /**
+         * Instillation, transtympanic
+         */
+        TRTYMPINSTIL, 
+        /**
+         * Instillation, urethral
+         */
+        URETHINSTL, 
+        /**
+         * Iontophoresis
+         */
+        _IONTOPHORESISROUTE, 
+        /**
+         * Topical application, iontophoresis
+         */
+        IONTO, 
+        /**
+         * Irrigation
+         */
+        _IRRIGATION, 
+        /**
+         * Irrigation, genitourinary
+         */
+        GUIRR, 
+        /**
+         * Irrigation, intragastric
+         */
+        IGASTIRR, 
+        /**
+         * Irrigation, intralesional
+         */
+        ILESIRR, 
+        /**
+         * Irrigation, intraocular
+         */
+        IOIRR, 
+        /**
+         * Irrigation, urinary bladder
+         */
+        BLADIRR, 
+        /**
+         * Irrigation, urinary bladder, continuous
+         */
+        BLADIRRC, 
+        /**
+         * Irrigation, urinary bladder, tidal
+         */
+        BLADIRRT, 
+        /**
+         * Irrigation, rectal
+         */
+        RECIRR, 
+        /**
+         * Lavage
+         */
+        _LAVAGEROUTE, 
+        /**
+         * Lavage, intragastric
+         */
+        IGASTLAV, 
+        /**
+         * Mucosal absorption
+         */
+        _MUCOSALABSORPTIONROUTE, 
+        /**
+         * Mucosal absorption, intraduodenal
+         */
+        IDOUDMAB, 
+        /**
+         * Mucosal absorption, intratracheal
+         */
+        ITRACHMAB, 
+        /**
+         * Mucosal absorption, submucosal
+         */
+        SMUCMAB, 
+        /**
+         * Nebulization
+         */
+        _NEBULIZATION, 
+        /**
+         * Nebulization, endotracheal tube
+         */
+        ETNEB, 
+        /**
+         * Rinse
+         */
+        _RINSE, 
+        /**
+         * Rinse, dental
+         */
+        DENRINSE, 
+        /**
+         * Rinse, oral
+         */
+        ORRINSE, 
+        /**
+         * Suppository
+         */
+        _SUPPOSITORYROUTE, 
+        /**
+         * Suppository, urethral
+         */
+        URETHSUP, 
+        /**
+         * Swish
+         */
+        _SWISH, 
+        /**
+         * Swish and spit out, oromucosal
+         */
+        SWISHSPIT, 
+        /**
+         * Swish and swallow, oromucosal
+         */
+        SWISHSWAL, 
+        /**
+         * Topical absorption
+         */
+        _TOPICALABSORPTIONROUTE, 
+        /**
+         * Topical absorption, transtympanic
+         */
+        TTYMPTABSORP, 
+        /**
+         * Topical application
+         */
+        _TOPICALAPPLICATION, 
+        /**
+         * Topical application, soaked dressing
+         */
+        DRESS, 
+        /**
+         * Topical application, swab
+         */
+        SWAB, 
+        /**
+         * Topical
+         */
+        TOPICAL, 
+        /**
+         * Topical application, buccal
+         */
+        BUC, 
+        /**
+         * Topical application, cervical
+         */
+        CERV, 
+        /**
+         * Topical application, dental
+         */
+        DEN, 
+        /**
+         * Topical application, gingival
+         */
+        GIN, 
+        /**
+         * Topical application, hair
+         */
+        HAIR, 
+        /**
+         * Topical application, intracorneal
+         */
+        ICORNTA, 
+        /**
+         * Topical application, intracoronal (dental)
+         */
+        ICORONTA, 
+        /**
+         * Topical application, intraesophageal
+         */
+        IESOPHTA, 
+        /**
+         * Topical application, intraileal
+         */
+        IILEALTA, 
+        /**
+         * Topical application, intralesional
+         */
+        ILTOP, 
+        /**
+         * Topical application, intraluminal
+         */
+        ILUMTA, 
+        /**
+         * Topical application, intraocular
+         */
+        IOTOP, 
+        /**
+         * Topical application, laryngeal
+         */
+        LARYNGTA, 
+        /**
+         * Topical application, mucous membrane
+         */
+        MUC, 
+        /**
+         * Topical application, nail
+         */
+        NAIL, 
+        /**
+         * Topical application, nasal
+         */
+        NASAL, 
+        /**
+         * Topical application, ophthalmic
+         */
+        OPTHALTA, 
+        /**
+         * Topical application, oral
+         */
+        ORALTA, 
+        /**
+         * Topical application, oromucosal
+         */
+        ORMUC, 
+        /**
+         * Topical application, oropharyngeal
+         */
+        OROPHARTA, 
+        /**
+         * Topical application, perianal
+         */
+        PERIANAL, 
+        /**
+         * Topical application, perineal
+         */
+        PERINEAL, 
+        /**
+         * Topical application, periodontal
+         */
+        PDONTTA, 
+        /**
+         * Topical application, rectal
+         */
+        RECTAL, 
+        /**
+         * Topical application, scalp
+         */
+        SCALP, 
+        /**
+         * Occlusive dressing technique
+         */
+        OCDRESTA, 
+        /**
+         * Topical application, skin
+         */
+        SKIN, 
+        /**
+         * Subconjunctival
+         */
+        SUBCONJTA, 
+        /**
+         * Topical application, transmucosal
+         */
+        TMUCTA, 
+        /**
+         * Insertion, vaginal
+         */
+        VAGINS, 
+        /**
+         * Insufflation
+         */
+        INSUF, 
+        /**
+         * Transdermal
+         */
+        TRNSDERM, 
+        /**
+         * Route of substance administration classified by site.
+         */
+        _ROUTEBYSITE, 
+        /**
+         * Amniotic fluid sac
+         */
+        _AMNIOTICFLUIDSACROUTE, 
+        /**
+         * Biliary tract
+         */
+        _BILIARYROUTE, 
+        /**
+         * Body surface
+         */
+        _BODYSURFACEROUTE, 
+        /**
+         * Buccal mucosa
+         */
+        _BUCCALMUCOSAROUTE, 
+        /**
+         * Cecostomy
+         */
+        _CECOSTOMYROUTE, 
+        /**
+         * Cervix of the uterus
+         */
+        _CERVICALROUTE, 
+        /**
+         * Endocervical
+         */
+        _ENDOCERVICALROUTE, 
+        /**
+         * Enteral
+         */
+        _ENTERALROUTE, 
+        /**
+         * Epidural
+         */
+        _EPIDURALROUTE, 
+        /**
+         * Extra-amniotic
+         */
+        _EXTRAAMNIOTICROUTE, 
+        /**
+         * Extracorporeal circulation
+         */
+        _EXTRACORPOREALCIRCULATIONROUTE, 
+        /**
+         * Gastric
+         */
+        _GASTRICROUTE, 
+        /**
+         * Genitourinary
+         */
+        _GENITOURINARYROUTE, 
+        /**
+         * Gingival
+         */
+        _GINGIVALROUTE, 
+        /**
+         * Hair
+         */
+        _HAIRROUTE, 
+        /**
+         * Interameningeal
+         */
+        _INTERAMENINGEALROUTE, 
+        /**
+         * Interstitial
+         */
+        _INTERSTITIALROUTE, 
+        /**
+         * Intra-abdominal
+         */
+        _INTRAABDOMINALROUTE, 
+        /**
+         * Intra-arterial
+         */
+        _INTRAARTERIALROUTE, 
+        /**
+         * Intraarticular
+         */
+        _INTRAARTICULARROUTE, 
+        /**
+         * Intrabronchial
+         */
+        _INTRABRONCHIALROUTE, 
+        /**
+         * Intrabursal
+         */
+        _INTRABURSALROUTE, 
+        /**
+         * Intracardiac
+         */
+        _INTRACARDIACROUTE, 
+        /**
+         * Intracartilaginous
+         */
+        _INTRACARTILAGINOUSROUTE, 
+        /**
+         * Intracaudal
+         */
+        _INTRACAUDALROUTE, 
+        /**
+         * Intracavernosal
+         */
+        _INTRACAVERNOSALROUTE, 
+        /**
+         * Intracavitary
+         */
+        _INTRACAVITARYROUTE, 
+        /**
+         * Intracerebral
+         */
+        _INTRACEREBRALROUTE, 
+        /**
+         * Intracervical
+         */
+        _INTRACERVICALROUTE, 
+        /**
+         * Intracisternal
+         */
+        _INTRACISTERNALROUTE, 
+        /**
+         * Intracorneal
+         */
+        _INTRACORNEALROUTE, 
+        /**
+         * Intracoronal (dental)
+         */
+        _INTRACORONALROUTE, 
+        /**
+         * Intracoronary
+         */
+        _INTRACORONARYROUTE, 
+        /**
+         * Intracorpus cavernosum
+         */
+        _INTRACORPUSCAVERNOSUMROUTE, 
+        /**
+         * Intradermal
+         */
+        _INTRADERMALROUTE, 
+        /**
+         * Intradiscal
+         */
+        _INTRADISCALROUTE, 
+        /**
+         * Intraductal
+         */
+        _INTRADUCTALROUTE, 
+        /**
+         * Intraduodenal
+         */
+        _INTRADUODENALROUTE, 
+        /**
+         * Intradural
+         */
+        _INTRADURALROUTE, 
+        /**
+         * Intraepidermal
+         */
+        _INTRAEPIDERMALROUTE, 
+        /**
+         * Intraepithelial
+         */
+        _INTRAEPITHELIALROUTE, 
+        /**
+         * Intraesophageal
+         */
+        _INTRAESOPHAGEALROUTE, 
+        /**
+         * Intragastric
+         */
+        _INTRAGASTRICROUTE, 
+        /**
+         * Intraileal
+         */
+        _INTRAILEALROUTE, 
+        /**
+         * Intralesional
+         */
+        _INTRALESIONALROUTE, 
+        /**
+         * Intraluminal
+         */
+        _INTRALUMINALROUTE, 
+        /**
+         * Intralymphatic
+         */
+        _INTRALYMPHATICROUTE, 
+        /**
+         * Intramedullary
+         */
+        _INTRAMEDULLARYROUTE, 
+        /**
+         * Intramuscular
+         */
+        _INTRAMUSCULARROUTE, 
+        /**
+         * Intraocular
+         */
+        _INTRAOCULARROUTE, 
+        /**
+         * Intraosseous
+         */
+        _INTRAOSSEOUSROUTE, 
+        /**
+         * Intraovarian
+         */
+        _INTRAOVARIANROUTE, 
+        /**
+         * Intrapericardial
+         */
+        _INTRAPERICARDIALROUTE, 
+        /**
+         * Intraperitoneal
+         */
+        _INTRAPERITONEALROUTE, 
+        /**
+         * Intrapleural
+         */
+        _INTRAPLEURALROUTE, 
+        /**
+         * Intraprostatic
+         */
+        _INTRAPROSTATICROUTE, 
+        /**
+         * Intrapulmonary
+         */
+        _INTRAPULMONARYROUTE, 
+        /**
+         * Intrasinal
+         */
+        _INTRASINALROUTE, 
+        /**
+         * Intraspinal
+         */
+        _INTRASPINALROUTE, 
+        /**
+         * Intrasternal
+         */
+        _INTRASTERNALROUTE, 
+        /**
+         * Intrasynovial
+         */
+        _INTRASYNOVIALROUTE, 
+        /**
+         * Intratendinous
+         */
+        _INTRATENDINOUSROUTE, 
+        /**
+         * Intratesticular
+         */
+        _INTRATESTICULARROUTE, 
+        /**
+         * Intrathecal
+         */
+        _INTRATHECALROUTE, 
+        /**
+         * Intrathoracic
+         */
+        _INTRATHORACICROUTE, 
+        /**
+         * Intratracheal
+         */
+        _INTRATRACHEALROUTE, 
+        /**
+         * Intratubular
+         */
+        _INTRATUBULARROUTE, 
+        /**
+         * Intratumor
+         */
+        _INTRATUMORROUTE, 
+        /**
+         * Intratympanic
+         */
+        _INTRATYMPANICROUTE, 
+        /**
+         * Intrauterine
+         */
+        _INTRAUTERINEROUTE, 
+        /**
+         * Intravascular
+         */
+        _INTRAVASCULARROUTE, 
+        /**
+         * Intravenous
+         */
+        _INTRAVENOUSROUTE, 
+        /**
+         * Intraventricular
+         */
+        _INTRAVENTRICULARROUTE, 
+        /**
+         * Intravesicle
+         */
+        _INTRAVESICLEROUTE, 
+        /**
+         * Intravitreal
+         */
+        _INTRAVITREALROUTE, 
+        /**
+         * Jejunum
+         */
+        _JEJUNUMROUTE, 
+        /**
+         * Lacrimal puncta
+         */
+        _LACRIMALPUNCTAROUTE, 
+        /**
+         * Laryngeal
+         */
+        _LARYNGEALROUTE, 
+        /**
+         * Lingual
+         */
+        _LINGUALROUTE, 
+        /**
+         * Mucous membrane
+         */
+        _MUCOUSMEMBRANEROUTE, 
+        /**
+         * Nail
+         */
+        _NAILROUTE, 
+        /**
+         * Nasal
+         */
+        _NASALROUTE, 
+        /**
+         * Ophthalmic
+         */
+        _OPHTHALMICROUTE, 
+        /**
+         * Oral
+         */
+        _ORALROUTE, 
+        /**
+         * Oromucosal
+         */
+        _OROMUCOSALROUTE, 
+        /**
+         * Oropharyngeal
+         */
+        _OROPHARYNGEALROUTE, 
+        /**
+         * Otic
+         */
+        _OTICROUTE, 
+        /**
+         * Paranasal sinuses
+         */
+        _PARANASALSINUSESROUTE, 
+        /**
+         * Parenteral
+         */
+        _PARENTERALROUTE, 
+        /**
+         * Perianal
+         */
+        _PERIANALROUTE, 
+        /**
+         * Periarticular
+         */
+        _PERIARTICULARROUTE, 
+        /**
+         * Peridural
+         */
+        _PERIDURALROUTE, 
+        /**
+         * Perineal
+         */
+        _PERINEALROUTE, 
+        /**
+         * Perineural
+         */
+        _PERINEURALROUTE, 
+        /**
+         * Periodontal
+         */
+        _PERIODONTALROUTE, 
+        /**
+         * Pulmonary
+         */
+        _PULMONARYROUTE, 
+        /**
+         * Rectal
+         */
+        _RECTALROUTE, 
+        /**
+         * Respiratory tract
+         */
+        _RESPIRATORYTRACTROUTE, 
+        /**
+         * Retrobulbar
+         */
+        _RETROBULBARROUTE, 
+        /**
+         * Scalp
+         */
+        _SCALPROUTE, 
+        /**
+         * Sinus, unspecified
+         */
+        _SINUSUNSPECIFIEDROUTE, 
+        /**
+         * Skin
+         */
+        _SKINROUTE, 
+        /**
+         * Soft tissue
+         */
+        _SOFTTISSUEROUTE, 
+        /**
+         * Subarachnoid
+         */
+        _SUBARACHNOIDROUTE, 
+        /**
+         * Subconjunctival
+         */
+        _SUBCONJUNCTIVALROUTE, 
+        /**
+         * Subcutaneous
+         */
+        _SUBCUTANEOUSROUTE, 
+        /**
+         * Sublesional
+         */
+        _SUBLESIONALROUTE, 
+        /**
+         * Sublingual
+         */
+        _SUBLINGUALROUTE, 
+        /**
+         * Submucosal
+         */
+        _SUBMUCOSALROUTE, 
+        /**
+         * Tracheostomy
+         */
+        _TRACHEOSTOMYROUTE, 
+        /**
+         * Transmucosal
+         */
+        _TRANSMUCOSALROUTE, 
+        /**
+         * Transplacental
+         */
+        _TRANSPLACENTALROUTE, 
+        /**
+         * Transtracheal
+         */
+        _TRANSTRACHEALROUTE, 
+        /**
+         * Transtympanic
+         */
+        _TRANSTYMPANICROUTE, 
+        /**
+         * Ureteral
+         */
+        _URETERALROUTE, 
+        /**
+         * Urethral
+         */
+        _URETHRALROUTE, 
+        /**
+         * Urinary bladder
+         */
+        _URINARYBLADDERROUTE, 
+        /**
+         * Urinary tract
+         */
+        _URINARYTRACTROUTE, 
+        /**
+         * Vaginal
+         */
+        _VAGINALROUTE, 
+        /**
+         * Vitreous humour
+         */
+        _VITREOUSHUMOURROUTE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3RouteOfAdministration fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_RouteByMethod".equals(codeString))
+          return _ROUTEBYMETHOD;
+        if ("SOAK".equals(codeString))
+          return SOAK;
+        if ("SHAMPOO".equals(codeString))
+          return SHAMPOO;
+        if ("TRNSLING".equals(codeString))
+          return TRNSLING;
+        if ("PO".equals(codeString))
+          return PO;
+        if ("GARGLE".equals(codeString))
+          return GARGLE;
+        if ("SUCK".equals(codeString))
+          return SUCK;
+        if ("_Chew".equals(codeString))
+          return _CHEW;
+        if ("CHEW".equals(codeString))
+          return CHEW;
+        if ("_Diffusion".equals(codeString))
+          return _DIFFUSION;
+        if ("EXTCORPDIF".equals(codeString))
+          return EXTCORPDIF;
+        if ("HEMODIFF".equals(codeString))
+          return HEMODIFF;
+        if ("TRNSDERMD".equals(codeString))
+          return TRNSDERMD;
+        if ("_Dissolve".equals(codeString))
+          return _DISSOLVE;
+        if ("DISSOLVE".equals(codeString))
+          return DISSOLVE;
+        if ("SL".equals(codeString))
+          return SL;
+        if ("_Douche".equals(codeString))
+          return _DOUCHE;
+        if ("DOUCHE".equals(codeString))
+          return DOUCHE;
+        if ("_ElectroOsmosisRoute".equals(codeString))
+          return _ELECTROOSMOSISROUTE;
+        if ("ELECTOSMOS".equals(codeString))
+          return ELECTOSMOS;
+        if ("_Enema".equals(codeString))
+          return _ENEMA;
+        if ("ENEMA".equals(codeString))
+          return ENEMA;
+        if ("RETENEMA".equals(codeString))
+          return RETENEMA;
+        if ("_Flush".equals(codeString))
+          return _FLUSH;
+        if ("IVFLUSH".equals(codeString))
+          return IVFLUSH;
+        if ("_Implantation".equals(codeString))
+          return _IMPLANTATION;
+        if ("IDIMPLNT".equals(codeString))
+          return IDIMPLNT;
+        if ("IVITIMPLNT".equals(codeString))
+          return IVITIMPLNT;
+        if ("SQIMPLNT".equals(codeString))
+          return SQIMPLNT;
+        if ("_Infusion".equals(codeString))
+          return _INFUSION;
+        if ("EPI".equals(codeString))
+          return EPI;
+        if ("IA".equals(codeString))
+          return IA;
+        if ("IC".equals(codeString))
+          return IC;
+        if ("ICOR".equals(codeString))
+          return ICOR;
+        if ("IOSSC".equals(codeString))
+          return IOSSC;
+        if ("IT".equals(codeString))
+          return IT;
+        if ("IV".equals(codeString))
+          return IV;
+        if ("IVC".equals(codeString))
+          return IVC;
+        if ("IVCC".equals(codeString))
+          return IVCC;
+        if ("IVCI".equals(codeString))
+          return IVCI;
+        if ("PCA".equals(codeString))
+          return PCA;
+        if ("IVASCINFUS".equals(codeString))
+          return IVASCINFUS;
+        if ("SQINFUS".equals(codeString))
+          return SQINFUS;
+        if ("_Inhalation".equals(codeString))
+          return _INHALATION;
+        if ("IPINHL".equals(codeString))
+          return IPINHL;
+        if ("ORIFINHL".equals(codeString))
+          return ORIFINHL;
+        if ("REBREATH".equals(codeString))
+          return REBREATH;
+        if ("IPPB".equals(codeString))
+          return IPPB;
+        if ("NASINHL".equals(codeString))
+          return NASINHL;
+        if ("NASINHLC".equals(codeString))
+          return NASINHLC;
+        if ("NEB".equals(codeString))
+          return NEB;
+        if ("NASNEB".equals(codeString))
+          return NASNEB;
+        if ("ORNEB".equals(codeString))
+          return ORNEB;
+        if ("TRACH".equals(codeString))
+          return TRACH;
+        if ("VENT".equals(codeString))
+          return VENT;
+        if ("VENTMASK".equals(codeString))
+          return VENTMASK;
+        if ("_Injection".equals(codeString))
+          return _INJECTION;
+        if ("AMNINJ".equals(codeString))
+          return AMNINJ;
+        if ("BILINJ".equals(codeString))
+          return BILINJ;
+        if ("CHOLINJ".equals(codeString))
+          return CHOLINJ;
+        if ("CERVINJ".equals(codeString))
+          return CERVINJ;
+        if ("EPIDURINJ".equals(codeString))
+          return EPIDURINJ;
+        if ("EPIINJ".equals(codeString))
+          return EPIINJ;
+        if ("EPINJSP".equals(codeString))
+          return EPINJSP;
+        if ("EXTRAMNINJ".equals(codeString))
+          return EXTRAMNINJ;
+        if ("EXTCORPINJ".equals(codeString))
+          return EXTCORPINJ;
+        if ("GBINJ".equals(codeString))
+          return GBINJ;
+        if ("GINGINJ".equals(codeString))
+          return GINGINJ;
+        if ("BLADINJ".equals(codeString))
+          return BLADINJ;
+        if ("ENDOSININJ".equals(codeString))
+          return ENDOSININJ;
+        if ("HEMOPORT".equals(codeString))
+          return HEMOPORT;
+        if ("IABDINJ".equals(codeString))
+          return IABDINJ;
+        if ("IAINJ".equals(codeString))
+          return IAINJ;
+        if ("IAINJP".equals(codeString))
+          return IAINJP;
+        if ("IAINJSP".equals(codeString))
+          return IAINJSP;
+        if ("IARTINJ".equals(codeString))
+          return IARTINJ;
+        if ("IBURSINJ".equals(codeString))
+          return IBURSINJ;
+        if ("ICARDINJ".equals(codeString))
+          return ICARDINJ;
+        if ("ICARDINJRP".equals(codeString))
+          return ICARDINJRP;
+        if ("ICARDINJSP".equals(codeString))
+          return ICARDINJSP;
+        if ("ICARINJP".equals(codeString))
+          return ICARINJP;
+        if ("ICARTINJ".equals(codeString))
+          return ICARTINJ;
+        if ("ICAUDINJ".equals(codeString))
+          return ICAUDINJ;
+        if ("ICAVINJ".equals(codeString))
+          return ICAVINJ;
+        if ("ICAVITINJ".equals(codeString))
+          return ICAVITINJ;
+        if ("ICEREBINJ".equals(codeString))
+          return ICEREBINJ;
+        if ("ICISTERNINJ".equals(codeString))
+          return ICISTERNINJ;
+        if ("ICORONINJ".equals(codeString))
+          return ICORONINJ;
+        if ("ICORONINJP".equals(codeString))
+          return ICORONINJP;
+        if ("ICORPCAVINJ".equals(codeString))
+          return ICORPCAVINJ;
+        if ("IDINJ".equals(codeString))
+          return IDINJ;
+        if ("IDISCINJ".equals(codeString))
+          return IDISCINJ;
+        if ("IDUCTINJ".equals(codeString))
+          return IDUCTINJ;
+        if ("IDURINJ".equals(codeString))
+          return IDURINJ;
+        if ("IEPIDINJ".equals(codeString))
+          return IEPIDINJ;
+        if ("IEPITHINJ".equals(codeString))
+          return IEPITHINJ;
+        if ("ILESINJ".equals(codeString))
+          return ILESINJ;
+        if ("ILUMINJ".equals(codeString))
+          return ILUMINJ;
+        if ("ILYMPJINJ".equals(codeString))
+          return ILYMPJINJ;
+        if ("IM".equals(codeString))
+          return IM;
+        if ("IMD".equals(codeString))
+          return IMD;
+        if ("IMZ".equals(codeString))
+          return IMZ;
+        if ("IMEDULINJ".equals(codeString))
+          return IMEDULINJ;
+        if ("INTERMENINJ".equals(codeString))
+          return INTERMENINJ;
+        if ("INTERSTITINJ".equals(codeString))
+          return INTERSTITINJ;
+        if ("IOINJ".equals(codeString))
+          return IOINJ;
+        if ("IOSSINJ".equals(codeString))
+          return IOSSINJ;
+        if ("IOVARINJ".equals(codeString))
+          return IOVARINJ;
+        if ("IPCARDINJ".equals(codeString))
+          return IPCARDINJ;
+        if ("IPERINJ".equals(codeString))
+          return IPERINJ;
+        if ("IPINJ".equals(codeString))
+          return IPINJ;
+        if ("IPLRINJ".equals(codeString))
+          return IPLRINJ;
+        if ("IPROSTINJ".equals(codeString))
+          return IPROSTINJ;
+        if ("IPUMPINJ".equals(codeString))
+          return IPUMPINJ;
+        if ("ISINJ".equals(codeString))
+          return ISINJ;
+        if ("ISTERINJ".equals(codeString))
+          return ISTERINJ;
+        if ("ISYNINJ".equals(codeString))
+          return ISYNINJ;
+        if ("ITENDINJ".equals(codeString))
+          return ITENDINJ;
+        if ("ITESTINJ".equals(codeString))
+          return ITESTINJ;
+        if ("ITHORINJ".equals(codeString))
+          return ITHORINJ;
+        if ("ITINJ".equals(codeString))
+          return ITINJ;
+        if ("ITUBINJ".equals(codeString))
+          return ITUBINJ;
+        if ("ITUMINJ".equals(codeString))
+          return ITUMINJ;
+        if ("ITYMPINJ".equals(codeString))
+          return ITYMPINJ;
+        if ("IUINJ".equals(codeString))
+          return IUINJ;
+        if ("IUINJC".equals(codeString))
+          return IUINJC;
+        if ("IURETINJ".equals(codeString))
+          return IURETINJ;
+        if ("IVASCINJ".equals(codeString))
+          return IVASCINJ;
+        if ("IVENTINJ".equals(codeString))
+          return IVENTINJ;
+        if ("IVESINJ".equals(codeString))
+          return IVESINJ;
+        if ("IVINJ".equals(codeString))
+          return IVINJ;
+        if ("IVINJBOL".equals(codeString))
+          return IVINJBOL;
+        if ("IVPUSH".equals(codeString))
+          return IVPUSH;
+        if ("IVRPUSH".equals(codeString))
+          return IVRPUSH;
+        if ("IVSPUSH".equals(codeString))
+          return IVSPUSH;
+        if ("IVITINJ".equals(codeString))
+          return IVITINJ;
+        if ("PAINJ".equals(codeString))
+          return PAINJ;
+        if ("PARENTINJ".equals(codeString))
+          return PARENTINJ;
+        if ("PDONTINJ".equals(codeString))
+          return PDONTINJ;
+        if ("PDPINJ".equals(codeString))
+          return PDPINJ;
+        if ("PDURINJ".equals(codeString))
+          return PDURINJ;
+        if ("PNINJ".equals(codeString))
+          return PNINJ;
+        if ("PNSINJ".equals(codeString))
+          return PNSINJ;
+        if ("RBINJ".equals(codeString))
+          return RBINJ;
+        if ("SCINJ".equals(codeString))
+          return SCINJ;
+        if ("SLESINJ".equals(codeString))
+          return SLESINJ;
+        if ("SOFTISINJ".equals(codeString))
+          return SOFTISINJ;
+        if ("SQ".equals(codeString))
+          return SQ;
+        if ("SUBARACHINJ".equals(codeString))
+          return SUBARACHINJ;
+        if ("SUBMUCINJ".equals(codeString))
+          return SUBMUCINJ;
+        if ("TRPLACINJ".equals(codeString))
+          return TRPLACINJ;
+        if ("TRTRACHINJ".equals(codeString))
+          return TRTRACHINJ;
+        if ("URETHINJ".equals(codeString))
+          return URETHINJ;
+        if ("URETINJ".equals(codeString))
+          return URETINJ;
+        if ("_Insertion".equals(codeString))
+          return _INSERTION;
+        if ("CERVINS".equals(codeString))
+          return CERVINS;
+        if ("IOSURGINS".equals(codeString))
+          return IOSURGINS;
+        if ("IU".equals(codeString))
+          return IU;
+        if ("LPINS".equals(codeString))
+          return LPINS;
+        if ("PR".equals(codeString))
+          return PR;
+        if ("SQSURGINS".equals(codeString))
+          return SQSURGINS;
+        if ("URETHINS".equals(codeString))
+          return URETHINS;
+        if ("VAGINSI".equals(codeString))
+          return VAGINSI;
+        if ("_Instillation".equals(codeString))
+          return _INSTILLATION;
+        if ("CECINSTL".equals(codeString))
+          return CECINSTL;
+        if ("EFT".equals(codeString))
+          return EFT;
+        if ("ENTINSTL".equals(codeString))
+          return ENTINSTL;
+        if ("GT".equals(codeString))
+          return GT;
+        if ("NGT".equals(codeString))
+          return NGT;
+        if ("OGT".equals(codeString))
+          return OGT;
+        if ("BLADINSTL".equals(codeString))
+          return BLADINSTL;
+        if ("CAPDINSTL".equals(codeString))
+          return CAPDINSTL;
+        if ("CTINSTL".equals(codeString))
+          return CTINSTL;
+        if ("ETINSTL".equals(codeString))
+          return ETINSTL;
+        if ("GJT".equals(codeString))
+          return GJT;
+        if ("IBRONCHINSTIL".equals(codeString))
+          return IBRONCHINSTIL;
+        if ("IDUODINSTIL".equals(codeString))
+          return IDUODINSTIL;
+        if ("IESOPHINSTIL".equals(codeString))
+          return IESOPHINSTIL;
+        if ("IGASTINSTIL".equals(codeString))
+          return IGASTINSTIL;
+        if ("IILEALINJ".equals(codeString))
+          return IILEALINJ;
+        if ("IOINSTL".equals(codeString))
+          return IOINSTL;
+        if ("ISININSTIL".equals(codeString))
+          return ISININSTIL;
+        if ("ITRACHINSTIL".equals(codeString))
+          return ITRACHINSTIL;
+        if ("IUINSTL".equals(codeString))
+          return IUINSTL;
+        if ("JJTINSTL".equals(codeString))
+          return JJTINSTL;
+        if ("LARYNGINSTIL".equals(codeString))
+          return LARYNGINSTIL;
+        if ("NASALINSTIL".equals(codeString))
+          return NASALINSTIL;
+        if ("NASOGASINSTIL".equals(codeString))
+          return NASOGASINSTIL;
+        if ("NTT".equals(codeString))
+          return NTT;
+        if ("OJJ".equals(codeString))
+          return OJJ;
+        if ("OT".equals(codeString))
+          return OT;
+        if ("PDPINSTL".equals(codeString))
+          return PDPINSTL;
+        if ("PNSINSTL".equals(codeString))
+          return PNSINSTL;
+        if ("RECINSTL".equals(codeString))
+          return RECINSTL;
+        if ("RECTINSTL".equals(codeString))
+          return RECTINSTL;
+        if ("SININSTIL".equals(codeString))
+          return SININSTIL;
+        if ("SOFTISINSTIL".equals(codeString))
+          return SOFTISINSTIL;
+        if ("TRACHINSTL".equals(codeString))
+          return TRACHINSTL;
+        if ("TRTYMPINSTIL".equals(codeString))
+          return TRTYMPINSTIL;
+        if ("URETHINSTL".equals(codeString))
+          return URETHINSTL;
+        if ("_IontophoresisRoute".equals(codeString))
+          return _IONTOPHORESISROUTE;
+        if ("IONTO".equals(codeString))
+          return IONTO;
+        if ("_Irrigation".equals(codeString))
+          return _IRRIGATION;
+        if ("GUIRR".equals(codeString))
+          return GUIRR;
+        if ("IGASTIRR".equals(codeString))
+          return IGASTIRR;
+        if ("ILESIRR".equals(codeString))
+          return ILESIRR;
+        if ("IOIRR".equals(codeString))
+          return IOIRR;
+        if ("BLADIRR".equals(codeString))
+          return BLADIRR;
+        if ("BLADIRRC".equals(codeString))
+          return BLADIRRC;
+        if ("BLADIRRT".equals(codeString))
+          return BLADIRRT;
+        if ("RECIRR".equals(codeString))
+          return RECIRR;
+        if ("_LavageRoute".equals(codeString))
+          return _LAVAGEROUTE;
+        if ("IGASTLAV".equals(codeString))
+          return IGASTLAV;
+        if ("_MucosalAbsorptionRoute".equals(codeString))
+          return _MUCOSALABSORPTIONROUTE;
+        if ("IDOUDMAB".equals(codeString))
+          return IDOUDMAB;
+        if ("ITRACHMAB".equals(codeString))
+          return ITRACHMAB;
+        if ("SMUCMAB".equals(codeString))
+          return SMUCMAB;
+        if ("_Nebulization".equals(codeString))
+          return _NEBULIZATION;
+        if ("ETNEB".equals(codeString))
+          return ETNEB;
+        if ("_Rinse".equals(codeString))
+          return _RINSE;
+        if ("DENRINSE".equals(codeString))
+          return DENRINSE;
+        if ("ORRINSE".equals(codeString))
+          return ORRINSE;
+        if ("_SuppositoryRoute".equals(codeString))
+          return _SUPPOSITORYROUTE;
+        if ("URETHSUP".equals(codeString))
+          return URETHSUP;
+        if ("_Swish".equals(codeString))
+          return _SWISH;
+        if ("SWISHSPIT".equals(codeString))
+          return SWISHSPIT;
+        if ("SWISHSWAL".equals(codeString))
+          return SWISHSWAL;
+        if ("_TopicalAbsorptionRoute".equals(codeString))
+          return _TOPICALABSORPTIONROUTE;
+        if ("TTYMPTABSORP".equals(codeString))
+          return TTYMPTABSORP;
+        if ("_TopicalApplication".equals(codeString))
+          return _TOPICALAPPLICATION;
+        if ("DRESS".equals(codeString))
+          return DRESS;
+        if ("SWAB".equals(codeString))
+          return SWAB;
+        if ("TOPICAL".equals(codeString))
+          return TOPICAL;
+        if ("BUC".equals(codeString))
+          return BUC;
+        if ("CERV".equals(codeString))
+          return CERV;
+        if ("DEN".equals(codeString))
+          return DEN;
+        if ("GIN".equals(codeString))
+          return GIN;
+        if ("HAIR".equals(codeString))
+          return HAIR;
+        if ("ICORNTA".equals(codeString))
+          return ICORNTA;
+        if ("ICORONTA".equals(codeString))
+          return ICORONTA;
+        if ("IESOPHTA".equals(codeString))
+          return IESOPHTA;
+        if ("IILEALTA".equals(codeString))
+          return IILEALTA;
+        if ("ILTOP".equals(codeString))
+          return ILTOP;
+        if ("ILUMTA".equals(codeString))
+          return ILUMTA;
+        if ("IOTOP".equals(codeString))
+          return IOTOP;
+        if ("LARYNGTA".equals(codeString))
+          return LARYNGTA;
+        if ("MUC".equals(codeString))
+          return MUC;
+        if ("NAIL".equals(codeString))
+          return NAIL;
+        if ("NASAL".equals(codeString))
+          return NASAL;
+        if ("OPTHALTA".equals(codeString))
+          return OPTHALTA;
+        if ("ORALTA".equals(codeString))
+          return ORALTA;
+        if ("ORMUC".equals(codeString))
+          return ORMUC;
+        if ("OROPHARTA".equals(codeString))
+          return OROPHARTA;
+        if ("PERIANAL".equals(codeString))
+          return PERIANAL;
+        if ("PERINEAL".equals(codeString))
+          return PERINEAL;
+        if ("PDONTTA".equals(codeString))
+          return PDONTTA;
+        if ("RECTAL".equals(codeString))
+          return RECTAL;
+        if ("SCALP".equals(codeString))
+          return SCALP;
+        if ("OCDRESTA".equals(codeString))
+          return OCDRESTA;
+        if ("SKIN".equals(codeString))
+          return SKIN;
+        if ("SUBCONJTA".equals(codeString))
+          return SUBCONJTA;
+        if ("TMUCTA".equals(codeString))
+          return TMUCTA;
+        if ("VAGINS".equals(codeString))
+          return VAGINS;
+        if ("INSUF".equals(codeString))
+          return INSUF;
+        if ("TRNSDERM".equals(codeString))
+          return TRNSDERM;
+        if ("_RouteBySite".equals(codeString))
+          return _ROUTEBYSITE;
+        if ("_AmnioticFluidSacRoute".equals(codeString))
+          return _AMNIOTICFLUIDSACROUTE;
+        if ("_BiliaryRoute".equals(codeString))
+          return _BILIARYROUTE;
+        if ("_BodySurfaceRoute".equals(codeString))
+          return _BODYSURFACEROUTE;
+        if ("_BuccalMucosaRoute".equals(codeString))
+          return _BUCCALMUCOSAROUTE;
+        if ("_CecostomyRoute".equals(codeString))
+          return _CECOSTOMYROUTE;
+        if ("_CervicalRoute".equals(codeString))
+          return _CERVICALROUTE;
+        if ("_EndocervicalRoute".equals(codeString))
+          return _ENDOCERVICALROUTE;
+        if ("_EnteralRoute".equals(codeString))
+          return _ENTERALROUTE;
+        if ("_EpiduralRoute".equals(codeString))
+          return _EPIDURALROUTE;
+        if ("_ExtraAmnioticRoute".equals(codeString))
+          return _EXTRAAMNIOTICROUTE;
+        if ("_ExtracorporealCirculationRoute".equals(codeString))
+          return _EXTRACORPOREALCIRCULATIONROUTE;
+        if ("_GastricRoute".equals(codeString))
+          return _GASTRICROUTE;
+        if ("_GenitourinaryRoute".equals(codeString))
+          return _GENITOURINARYROUTE;
+        if ("_GingivalRoute".equals(codeString))
+          return _GINGIVALROUTE;
+        if ("_HairRoute".equals(codeString))
+          return _HAIRROUTE;
+        if ("_InterameningealRoute".equals(codeString))
+          return _INTERAMENINGEALROUTE;
+        if ("_InterstitialRoute".equals(codeString))
+          return _INTERSTITIALROUTE;
+        if ("_IntraabdominalRoute".equals(codeString))
+          return _INTRAABDOMINALROUTE;
+        if ("_IntraarterialRoute".equals(codeString))
+          return _INTRAARTERIALROUTE;
+        if ("_IntraarticularRoute".equals(codeString))
+          return _INTRAARTICULARROUTE;
+        if ("_IntrabronchialRoute".equals(codeString))
+          return _INTRABRONCHIALROUTE;
+        if ("_IntrabursalRoute".equals(codeString))
+          return _INTRABURSALROUTE;
+        if ("_IntracardiacRoute".equals(codeString))
+          return _INTRACARDIACROUTE;
+        if ("_IntracartilaginousRoute".equals(codeString))
+          return _INTRACARTILAGINOUSROUTE;
+        if ("_IntracaudalRoute".equals(codeString))
+          return _INTRACAUDALROUTE;
+        if ("_IntracavernosalRoute".equals(codeString))
+          return _INTRACAVERNOSALROUTE;
+        if ("_IntracavitaryRoute".equals(codeString))
+          return _INTRACAVITARYROUTE;
+        if ("_IntracerebralRoute".equals(codeString))
+          return _INTRACEREBRALROUTE;
+        if ("_IntracervicalRoute".equals(codeString))
+          return _INTRACERVICALROUTE;
+        if ("_IntracisternalRoute".equals(codeString))
+          return _INTRACISTERNALROUTE;
+        if ("_IntracornealRoute".equals(codeString))
+          return _INTRACORNEALROUTE;
+        if ("_IntracoronalRoute".equals(codeString))
+          return _INTRACORONALROUTE;
+        if ("_IntracoronaryRoute".equals(codeString))
+          return _INTRACORONARYROUTE;
+        if ("_IntracorpusCavernosumRoute".equals(codeString))
+          return _INTRACORPUSCAVERNOSUMROUTE;
+        if ("_IntradermalRoute".equals(codeString))
+          return _INTRADERMALROUTE;
+        if ("_IntradiscalRoute".equals(codeString))
+          return _INTRADISCALROUTE;
+        if ("_IntraductalRoute".equals(codeString))
+          return _INTRADUCTALROUTE;
+        if ("_IntraduodenalRoute".equals(codeString))
+          return _INTRADUODENALROUTE;
+        if ("_IntraduralRoute".equals(codeString))
+          return _INTRADURALROUTE;
+        if ("_IntraepidermalRoute".equals(codeString))
+          return _INTRAEPIDERMALROUTE;
+        if ("_IntraepithelialRoute".equals(codeString))
+          return _INTRAEPITHELIALROUTE;
+        if ("_IntraesophagealRoute".equals(codeString))
+          return _INTRAESOPHAGEALROUTE;
+        if ("_IntragastricRoute".equals(codeString))
+          return _INTRAGASTRICROUTE;
+        if ("_IntrailealRoute".equals(codeString))
+          return _INTRAILEALROUTE;
+        if ("_IntralesionalRoute".equals(codeString))
+          return _INTRALESIONALROUTE;
+        if ("_IntraluminalRoute".equals(codeString))
+          return _INTRALUMINALROUTE;
+        if ("_IntralymphaticRoute".equals(codeString))
+          return _INTRALYMPHATICROUTE;
+        if ("_IntramedullaryRoute".equals(codeString))
+          return _INTRAMEDULLARYROUTE;
+        if ("_IntramuscularRoute".equals(codeString))
+          return _INTRAMUSCULARROUTE;
+        if ("_IntraocularRoute".equals(codeString))
+          return _INTRAOCULARROUTE;
+        if ("_IntraosseousRoute".equals(codeString))
+          return _INTRAOSSEOUSROUTE;
+        if ("_IntraovarianRoute".equals(codeString))
+          return _INTRAOVARIANROUTE;
+        if ("_IntrapericardialRoute".equals(codeString))
+          return _INTRAPERICARDIALROUTE;
+        if ("_IntraperitonealRoute".equals(codeString))
+          return _INTRAPERITONEALROUTE;
+        if ("_IntrapleuralRoute".equals(codeString))
+          return _INTRAPLEURALROUTE;
+        if ("_IntraprostaticRoute".equals(codeString))
+          return _INTRAPROSTATICROUTE;
+        if ("_IntrapulmonaryRoute".equals(codeString))
+          return _INTRAPULMONARYROUTE;
+        if ("_IntrasinalRoute".equals(codeString))
+          return _INTRASINALROUTE;
+        if ("_IntraspinalRoute".equals(codeString))
+          return _INTRASPINALROUTE;
+        if ("_IntrasternalRoute".equals(codeString))
+          return _INTRASTERNALROUTE;
+        if ("_IntrasynovialRoute".equals(codeString))
+          return _INTRASYNOVIALROUTE;
+        if ("_IntratendinousRoute".equals(codeString))
+          return _INTRATENDINOUSROUTE;
+        if ("_IntratesticularRoute".equals(codeString))
+          return _INTRATESTICULARROUTE;
+        if ("_IntrathecalRoute".equals(codeString))
+          return _INTRATHECALROUTE;
+        if ("_IntrathoracicRoute".equals(codeString))
+          return _INTRATHORACICROUTE;
+        if ("_IntratrachealRoute".equals(codeString))
+          return _INTRATRACHEALROUTE;
+        if ("_IntratubularRoute".equals(codeString))
+          return _INTRATUBULARROUTE;
+        if ("_IntratumorRoute".equals(codeString))
+          return _INTRATUMORROUTE;
+        if ("_IntratympanicRoute".equals(codeString))
+          return _INTRATYMPANICROUTE;
+        if ("_IntrauterineRoute".equals(codeString))
+          return _INTRAUTERINEROUTE;
+        if ("_IntravascularRoute".equals(codeString))
+          return _INTRAVASCULARROUTE;
+        if ("_IntravenousRoute".equals(codeString))
+          return _INTRAVENOUSROUTE;
+        if ("_IntraventricularRoute".equals(codeString))
+          return _INTRAVENTRICULARROUTE;
+        if ("_IntravesicleRoute".equals(codeString))
+          return _INTRAVESICLEROUTE;
+        if ("_IntravitrealRoute".equals(codeString))
+          return _INTRAVITREALROUTE;
+        if ("_JejunumRoute".equals(codeString))
+          return _JEJUNUMROUTE;
+        if ("_LacrimalPunctaRoute".equals(codeString))
+          return _LACRIMALPUNCTAROUTE;
+        if ("_LaryngealRoute".equals(codeString))
+          return _LARYNGEALROUTE;
+        if ("_LingualRoute".equals(codeString))
+          return _LINGUALROUTE;
+        if ("_MucousMembraneRoute".equals(codeString))
+          return _MUCOUSMEMBRANEROUTE;
+        if ("_NailRoute".equals(codeString))
+          return _NAILROUTE;
+        if ("_NasalRoute".equals(codeString))
+          return _NASALROUTE;
+        if ("_OphthalmicRoute".equals(codeString))
+          return _OPHTHALMICROUTE;
+        if ("_OralRoute".equals(codeString))
+          return _ORALROUTE;
+        if ("_OromucosalRoute".equals(codeString))
+          return _OROMUCOSALROUTE;
+        if ("_OropharyngealRoute".equals(codeString))
+          return _OROPHARYNGEALROUTE;
+        if ("_OticRoute".equals(codeString))
+          return _OTICROUTE;
+        if ("_ParanasalSinusesRoute".equals(codeString))
+          return _PARANASALSINUSESROUTE;
+        if ("_ParenteralRoute".equals(codeString))
+          return _PARENTERALROUTE;
+        if ("_PerianalRoute".equals(codeString))
+          return _PERIANALROUTE;
+        if ("_PeriarticularRoute".equals(codeString))
+          return _PERIARTICULARROUTE;
+        if ("_PeriduralRoute".equals(codeString))
+          return _PERIDURALROUTE;
+        if ("_PerinealRoute".equals(codeString))
+          return _PERINEALROUTE;
+        if ("_PerineuralRoute".equals(codeString))
+          return _PERINEURALROUTE;
+        if ("_PeriodontalRoute".equals(codeString))
+          return _PERIODONTALROUTE;
+        if ("_PulmonaryRoute".equals(codeString))
+          return _PULMONARYROUTE;
+        if ("_RectalRoute".equals(codeString))
+          return _RECTALROUTE;
+        if ("_RespiratoryTractRoute".equals(codeString))
+          return _RESPIRATORYTRACTROUTE;
+        if ("_RetrobulbarRoute".equals(codeString))
+          return _RETROBULBARROUTE;
+        if ("_ScalpRoute".equals(codeString))
+          return _SCALPROUTE;
+        if ("_SinusUnspecifiedRoute".equals(codeString))
+          return _SINUSUNSPECIFIEDROUTE;
+        if ("_SkinRoute".equals(codeString))
+          return _SKINROUTE;
+        if ("_SoftTissueRoute".equals(codeString))
+          return _SOFTTISSUEROUTE;
+        if ("_SubarachnoidRoute".equals(codeString))
+          return _SUBARACHNOIDROUTE;
+        if ("_SubconjunctivalRoute".equals(codeString))
+          return _SUBCONJUNCTIVALROUTE;
+        if ("_SubcutaneousRoute".equals(codeString))
+          return _SUBCUTANEOUSROUTE;
+        if ("_SublesionalRoute".equals(codeString))
+          return _SUBLESIONALROUTE;
+        if ("_SublingualRoute".equals(codeString))
+          return _SUBLINGUALROUTE;
+        if ("_SubmucosalRoute".equals(codeString))
+          return _SUBMUCOSALROUTE;
+        if ("_TracheostomyRoute".equals(codeString))
+          return _TRACHEOSTOMYROUTE;
+        if ("_TransmucosalRoute".equals(codeString))
+          return _TRANSMUCOSALROUTE;
+        if ("_TransplacentalRoute".equals(codeString))
+          return _TRANSPLACENTALROUTE;
+        if ("_TranstrachealRoute".equals(codeString))
+          return _TRANSTRACHEALROUTE;
+        if ("_TranstympanicRoute".equals(codeString))
+          return _TRANSTYMPANICROUTE;
+        if ("_UreteralRoute".equals(codeString))
+          return _URETERALROUTE;
+        if ("_UrethralRoute".equals(codeString))
+          return _URETHRALROUTE;
+        if ("_UrinaryBladderRoute".equals(codeString))
+          return _URINARYBLADDERROUTE;
+        if ("_UrinaryTractRoute".equals(codeString))
+          return _URINARYTRACTROUTE;
+        if ("_VaginalRoute".equals(codeString))
+          return _VAGINALROUTE;
+        if ("_VitreousHumourRoute".equals(codeString))
+          return _VITREOUSHUMOURROUTE;
+        throw new FHIRException("Unknown V3RouteOfAdministration code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ROUTEBYMETHOD: return "_RouteByMethod";
+            case SOAK: return "SOAK";
+            case SHAMPOO: return "SHAMPOO";
+            case TRNSLING: return "TRNSLING";
+            case PO: return "PO";
+            case GARGLE: return "GARGLE";
+            case SUCK: return "SUCK";
+            case _CHEW: return "_Chew";
+            case CHEW: return "CHEW";
+            case _DIFFUSION: return "_Diffusion";
+            case EXTCORPDIF: return "EXTCORPDIF";
+            case HEMODIFF: return "HEMODIFF";
+            case TRNSDERMD: return "TRNSDERMD";
+            case _DISSOLVE: return "_Dissolve";
+            case DISSOLVE: return "DISSOLVE";
+            case SL: return "SL";
+            case _DOUCHE: return "_Douche";
+            case DOUCHE: return "DOUCHE";
+            case _ELECTROOSMOSISROUTE: return "_ElectroOsmosisRoute";
+            case ELECTOSMOS: return "ELECTOSMOS";
+            case _ENEMA: return "_Enema";
+            case ENEMA: return "ENEMA";
+            case RETENEMA: return "RETENEMA";
+            case _FLUSH: return "_Flush";
+            case IVFLUSH: return "IVFLUSH";
+            case _IMPLANTATION: return "_Implantation";
+            case IDIMPLNT: return "IDIMPLNT";
+            case IVITIMPLNT: return "IVITIMPLNT";
+            case SQIMPLNT: return "SQIMPLNT";
+            case _INFUSION: return "_Infusion";
+            case EPI: return "EPI";
+            case IA: return "IA";
+            case IC: return "IC";
+            case ICOR: return "ICOR";
+            case IOSSC: return "IOSSC";
+            case IT: return "IT";
+            case IV: return "IV";
+            case IVC: return "IVC";
+            case IVCC: return "IVCC";
+            case IVCI: return "IVCI";
+            case PCA: return "PCA";
+            case IVASCINFUS: return "IVASCINFUS";
+            case SQINFUS: return "SQINFUS";
+            case _INHALATION: return "_Inhalation";
+            case IPINHL: return "IPINHL";
+            case ORIFINHL: return "ORIFINHL";
+            case REBREATH: return "REBREATH";
+            case IPPB: return "IPPB";
+            case NASINHL: return "NASINHL";
+            case NASINHLC: return "NASINHLC";
+            case NEB: return "NEB";
+            case NASNEB: return "NASNEB";
+            case ORNEB: return "ORNEB";
+            case TRACH: return "TRACH";
+            case VENT: return "VENT";
+            case VENTMASK: return "VENTMASK";
+            case _INJECTION: return "_Injection";
+            case AMNINJ: return "AMNINJ";
+            case BILINJ: return "BILINJ";
+            case CHOLINJ: return "CHOLINJ";
+            case CERVINJ: return "CERVINJ";
+            case EPIDURINJ: return "EPIDURINJ";
+            case EPIINJ: return "EPIINJ";
+            case EPINJSP: return "EPINJSP";
+            case EXTRAMNINJ: return "EXTRAMNINJ";
+            case EXTCORPINJ: return "EXTCORPINJ";
+            case GBINJ: return "GBINJ";
+            case GINGINJ: return "GINGINJ";
+            case BLADINJ: return "BLADINJ";
+            case ENDOSININJ: return "ENDOSININJ";
+            case HEMOPORT: return "HEMOPORT";
+            case IABDINJ: return "IABDINJ";
+            case IAINJ: return "IAINJ";
+            case IAINJP: return "IAINJP";
+            case IAINJSP: return "IAINJSP";
+            case IARTINJ: return "IARTINJ";
+            case IBURSINJ: return "IBURSINJ";
+            case ICARDINJ: return "ICARDINJ";
+            case ICARDINJRP: return "ICARDINJRP";
+            case ICARDINJSP: return "ICARDINJSP";
+            case ICARINJP: return "ICARINJP";
+            case ICARTINJ: return "ICARTINJ";
+            case ICAUDINJ: return "ICAUDINJ";
+            case ICAVINJ: return "ICAVINJ";
+            case ICAVITINJ: return "ICAVITINJ";
+            case ICEREBINJ: return "ICEREBINJ";
+            case ICISTERNINJ: return "ICISTERNINJ";
+            case ICORONINJ: return "ICORONINJ";
+            case ICORONINJP: return "ICORONINJP";
+            case ICORPCAVINJ: return "ICORPCAVINJ";
+            case IDINJ: return "IDINJ";
+            case IDISCINJ: return "IDISCINJ";
+            case IDUCTINJ: return "IDUCTINJ";
+            case IDURINJ: return "IDURINJ";
+            case IEPIDINJ: return "IEPIDINJ";
+            case IEPITHINJ: return "IEPITHINJ";
+            case ILESINJ: return "ILESINJ";
+            case ILUMINJ: return "ILUMINJ";
+            case ILYMPJINJ: return "ILYMPJINJ";
+            case IM: return "IM";
+            case IMD: return "IMD";
+            case IMZ: return "IMZ";
+            case IMEDULINJ: return "IMEDULINJ";
+            case INTERMENINJ: return "INTERMENINJ";
+            case INTERSTITINJ: return "INTERSTITINJ";
+            case IOINJ: return "IOINJ";
+            case IOSSINJ: return "IOSSINJ";
+            case IOVARINJ: return "IOVARINJ";
+            case IPCARDINJ: return "IPCARDINJ";
+            case IPERINJ: return "IPERINJ";
+            case IPINJ: return "IPINJ";
+            case IPLRINJ: return "IPLRINJ";
+            case IPROSTINJ: return "IPROSTINJ";
+            case IPUMPINJ: return "IPUMPINJ";
+            case ISINJ: return "ISINJ";
+            case ISTERINJ: return "ISTERINJ";
+            case ISYNINJ: return "ISYNINJ";
+            case ITENDINJ: return "ITENDINJ";
+            case ITESTINJ: return "ITESTINJ";
+            case ITHORINJ: return "ITHORINJ";
+            case ITINJ: return "ITINJ";
+            case ITUBINJ: return "ITUBINJ";
+            case ITUMINJ: return "ITUMINJ";
+            case ITYMPINJ: return "ITYMPINJ";
+            case IUINJ: return "IUINJ";
+            case IUINJC: return "IUINJC";
+            case IURETINJ: return "IURETINJ";
+            case IVASCINJ: return "IVASCINJ";
+            case IVENTINJ: return "IVENTINJ";
+            case IVESINJ: return "IVESINJ";
+            case IVINJ: return "IVINJ";
+            case IVINJBOL: return "IVINJBOL";
+            case IVPUSH: return "IVPUSH";
+            case IVRPUSH: return "IVRPUSH";
+            case IVSPUSH: return "IVSPUSH";
+            case IVITINJ: return "IVITINJ";
+            case PAINJ: return "PAINJ";
+            case PARENTINJ: return "PARENTINJ";
+            case PDONTINJ: return "PDONTINJ";
+            case PDPINJ: return "PDPINJ";
+            case PDURINJ: return "PDURINJ";
+            case PNINJ: return "PNINJ";
+            case PNSINJ: return "PNSINJ";
+            case RBINJ: return "RBINJ";
+            case SCINJ: return "SCINJ";
+            case SLESINJ: return "SLESINJ";
+            case SOFTISINJ: return "SOFTISINJ";
+            case SQ: return "SQ";
+            case SUBARACHINJ: return "SUBARACHINJ";
+            case SUBMUCINJ: return "SUBMUCINJ";
+            case TRPLACINJ: return "TRPLACINJ";
+            case TRTRACHINJ: return "TRTRACHINJ";
+            case URETHINJ: return "URETHINJ";
+            case URETINJ: return "URETINJ";
+            case _INSERTION: return "_Insertion";
+            case CERVINS: return "CERVINS";
+            case IOSURGINS: return "IOSURGINS";
+            case IU: return "IU";
+            case LPINS: return "LPINS";
+            case PR: return "PR";
+            case SQSURGINS: return "SQSURGINS";
+            case URETHINS: return "URETHINS";
+            case VAGINSI: return "VAGINSI";
+            case _INSTILLATION: return "_Instillation";
+            case CECINSTL: return "CECINSTL";
+            case EFT: return "EFT";
+            case ENTINSTL: return "ENTINSTL";
+            case GT: return "GT";
+            case NGT: return "NGT";
+            case OGT: return "OGT";
+            case BLADINSTL: return "BLADINSTL";
+            case CAPDINSTL: return "CAPDINSTL";
+            case CTINSTL: return "CTINSTL";
+            case ETINSTL: return "ETINSTL";
+            case GJT: return "GJT";
+            case IBRONCHINSTIL: return "IBRONCHINSTIL";
+            case IDUODINSTIL: return "IDUODINSTIL";
+            case IESOPHINSTIL: return "IESOPHINSTIL";
+            case IGASTINSTIL: return "IGASTINSTIL";
+            case IILEALINJ: return "IILEALINJ";
+            case IOINSTL: return "IOINSTL";
+            case ISININSTIL: return "ISININSTIL";
+            case ITRACHINSTIL: return "ITRACHINSTIL";
+            case IUINSTL: return "IUINSTL";
+            case JJTINSTL: return "JJTINSTL";
+            case LARYNGINSTIL: return "LARYNGINSTIL";
+            case NASALINSTIL: return "NASALINSTIL";
+            case NASOGASINSTIL: return "NASOGASINSTIL";
+            case NTT: return "NTT";
+            case OJJ: return "OJJ";
+            case OT: return "OT";
+            case PDPINSTL: return "PDPINSTL";
+            case PNSINSTL: return "PNSINSTL";
+            case RECINSTL: return "RECINSTL";
+            case RECTINSTL: return "RECTINSTL";
+            case SININSTIL: return "SININSTIL";
+            case SOFTISINSTIL: return "SOFTISINSTIL";
+            case TRACHINSTL: return "TRACHINSTL";
+            case TRTYMPINSTIL: return "TRTYMPINSTIL";
+            case URETHINSTL: return "URETHINSTL";
+            case _IONTOPHORESISROUTE: return "_IontophoresisRoute";
+            case IONTO: return "IONTO";
+            case _IRRIGATION: return "_Irrigation";
+            case GUIRR: return "GUIRR";
+            case IGASTIRR: return "IGASTIRR";
+            case ILESIRR: return "ILESIRR";
+            case IOIRR: return "IOIRR";
+            case BLADIRR: return "BLADIRR";
+            case BLADIRRC: return "BLADIRRC";
+            case BLADIRRT: return "BLADIRRT";
+            case RECIRR: return "RECIRR";
+            case _LAVAGEROUTE: return "_LavageRoute";
+            case IGASTLAV: return "IGASTLAV";
+            case _MUCOSALABSORPTIONROUTE: return "_MucosalAbsorptionRoute";
+            case IDOUDMAB: return "IDOUDMAB";
+            case ITRACHMAB: return "ITRACHMAB";
+            case SMUCMAB: return "SMUCMAB";
+            case _NEBULIZATION: return "_Nebulization";
+            case ETNEB: return "ETNEB";
+            case _RINSE: return "_Rinse";
+            case DENRINSE: return "DENRINSE";
+            case ORRINSE: return "ORRINSE";
+            case _SUPPOSITORYROUTE: return "_SuppositoryRoute";
+            case URETHSUP: return "URETHSUP";
+            case _SWISH: return "_Swish";
+            case SWISHSPIT: return "SWISHSPIT";
+            case SWISHSWAL: return "SWISHSWAL";
+            case _TOPICALABSORPTIONROUTE: return "_TopicalAbsorptionRoute";
+            case TTYMPTABSORP: return "TTYMPTABSORP";
+            case _TOPICALAPPLICATION: return "_TopicalApplication";
+            case DRESS: return "DRESS";
+            case SWAB: return "SWAB";
+            case TOPICAL: return "TOPICAL";
+            case BUC: return "BUC";
+            case CERV: return "CERV";
+            case DEN: return "DEN";
+            case GIN: return "GIN";
+            case HAIR: return "HAIR";
+            case ICORNTA: return "ICORNTA";
+            case ICORONTA: return "ICORONTA";
+            case IESOPHTA: return "IESOPHTA";
+            case IILEALTA: return "IILEALTA";
+            case ILTOP: return "ILTOP";
+            case ILUMTA: return "ILUMTA";
+            case IOTOP: return "IOTOP";
+            case LARYNGTA: return "LARYNGTA";
+            case MUC: return "MUC";
+            case NAIL: return "NAIL";
+            case NASAL: return "NASAL";
+            case OPTHALTA: return "OPTHALTA";
+            case ORALTA: return "ORALTA";
+            case ORMUC: return "ORMUC";
+            case OROPHARTA: return "OROPHARTA";
+            case PERIANAL: return "PERIANAL";
+            case PERINEAL: return "PERINEAL";
+            case PDONTTA: return "PDONTTA";
+            case RECTAL: return "RECTAL";
+            case SCALP: return "SCALP";
+            case OCDRESTA: return "OCDRESTA";
+            case SKIN: return "SKIN";
+            case SUBCONJTA: return "SUBCONJTA";
+            case TMUCTA: return "TMUCTA";
+            case VAGINS: return "VAGINS";
+            case INSUF: return "INSUF";
+            case TRNSDERM: return "TRNSDERM";
+            case _ROUTEBYSITE: return "_RouteBySite";
+            case _AMNIOTICFLUIDSACROUTE: return "_AmnioticFluidSacRoute";
+            case _BILIARYROUTE: return "_BiliaryRoute";
+            case _BODYSURFACEROUTE: return "_BodySurfaceRoute";
+            case _BUCCALMUCOSAROUTE: return "_BuccalMucosaRoute";
+            case _CECOSTOMYROUTE: return "_CecostomyRoute";
+            case _CERVICALROUTE: return "_CervicalRoute";
+            case _ENDOCERVICALROUTE: return "_EndocervicalRoute";
+            case _ENTERALROUTE: return "_EnteralRoute";
+            case _EPIDURALROUTE: return "_EpiduralRoute";
+            case _EXTRAAMNIOTICROUTE: return "_ExtraAmnioticRoute";
+            case _EXTRACORPOREALCIRCULATIONROUTE: return "_ExtracorporealCirculationRoute";
+            case _GASTRICROUTE: return "_GastricRoute";
+            case _GENITOURINARYROUTE: return "_GenitourinaryRoute";
+            case _GINGIVALROUTE: return "_GingivalRoute";
+            case _HAIRROUTE: return "_HairRoute";
+            case _INTERAMENINGEALROUTE: return "_InterameningealRoute";
+            case _INTERSTITIALROUTE: return "_InterstitialRoute";
+            case _INTRAABDOMINALROUTE: return "_IntraabdominalRoute";
+            case _INTRAARTERIALROUTE: return "_IntraarterialRoute";
+            case _INTRAARTICULARROUTE: return "_IntraarticularRoute";
+            case _INTRABRONCHIALROUTE: return "_IntrabronchialRoute";
+            case _INTRABURSALROUTE: return "_IntrabursalRoute";
+            case _INTRACARDIACROUTE: return "_IntracardiacRoute";
+            case _INTRACARTILAGINOUSROUTE: return "_IntracartilaginousRoute";
+            case _INTRACAUDALROUTE: return "_IntracaudalRoute";
+            case _INTRACAVERNOSALROUTE: return "_IntracavernosalRoute";
+            case _INTRACAVITARYROUTE: return "_IntracavitaryRoute";
+            case _INTRACEREBRALROUTE: return "_IntracerebralRoute";
+            case _INTRACERVICALROUTE: return "_IntracervicalRoute";
+            case _INTRACISTERNALROUTE: return "_IntracisternalRoute";
+            case _INTRACORNEALROUTE: return "_IntracornealRoute";
+            case _INTRACORONALROUTE: return "_IntracoronalRoute";
+            case _INTRACORONARYROUTE: return "_IntracoronaryRoute";
+            case _INTRACORPUSCAVERNOSUMROUTE: return "_IntracorpusCavernosumRoute";
+            case _INTRADERMALROUTE: return "_IntradermalRoute";
+            case _INTRADISCALROUTE: return "_IntradiscalRoute";
+            case _INTRADUCTALROUTE: return "_IntraductalRoute";
+            case _INTRADUODENALROUTE: return "_IntraduodenalRoute";
+            case _INTRADURALROUTE: return "_IntraduralRoute";
+            case _INTRAEPIDERMALROUTE: return "_IntraepidermalRoute";
+            case _INTRAEPITHELIALROUTE: return "_IntraepithelialRoute";
+            case _INTRAESOPHAGEALROUTE: return "_IntraesophagealRoute";
+            case _INTRAGASTRICROUTE: return "_IntragastricRoute";
+            case _INTRAILEALROUTE: return "_IntrailealRoute";
+            case _INTRALESIONALROUTE: return "_IntralesionalRoute";
+            case _INTRALUMINALROUTE: return "_IntraluminalRoute";
+            case _INTRALYMPHATICROUTE: return "_IntralymphaticRoute";
+            case _INTRAMEDULLARYROUTE: return "_IntramedullaryRoute";
+            case _INTRAMUSCULARROUTE: return "_IntramuscularRoute";
+            case _INTRAOCULARROUTE: return "_IntraocularRoute";
+            case _INTRAOSSEOUSROUTE: return "_IntraosseousRoute";
+            case _INTRAOVARIANROUTE: return "_IntraovarianRoute";
+            case _INTRAPERICARDIALROUTE: return "_IntrapericardialRoute";
+            case _INTRAPERITONEALROUTE: return "_IntraperitonealRoute";
+            case _INTRAPLEURALROUTE: return "_IntrapleuralRoute";
+            case _INTRAPROSTATICROUTE: return "_IntraprostaticRoute";
+            case _INTRAPULMONARYROUTE: return "_IntrapulmonaryRoute";
+            case _INTRASINALROUTE: return "_IntrasinalRoute";
+            case _INTRASPINALROUTE: return "_IntraspinalRoute";
+            case _INTRASTERNALROUTE: return "_IntrasternalRoute";
+            case _INTRASYNOVIALROUTE: return "_IntrasynovialRoute";
+            case _INTRATENDINOUSROUTE: return "_IntratendinousRoute";
+            case _INTRATESTICULARROUTE: return "_IntratesticularRoute";
+            case _INTRATHECALROUTE: return "_IntrathecalRoute";
+            case _INTRATHORACICROUTE: return "_IntrathoracicRoute";
+            case _INTRATRACHEALROUTE: return "_IntratrachealRoute";
+            case _INTRATUBULARROUTE: return "_IntratubularRoute";
+            case _INTRATUMORROUTE: return "_IntratumorRoute";
+            case _INTRATYMPANICROUTE: return "_IntratympanicRoute";
+            case _INTRAUTERINEROUTE: return "_IntrauterineRoute";
+            case _INTRAVASCULARROUTE: return "_IntravascularRoute";
+            case _INTRAVENOUSROUTE: return "_IntravenousRoute";
+            case _INTRAVENTRICULARROUTE: return "_IntraventricularRoute";
+            case _INTRAVESICLEROUTE: return "_IntravesicleRoute";
+            case _INTRAVITREALROUTE: return "_IntravitrealRoute";
+            case _JEJUNUMROUTE: return "_JejunumRoute";
+            case _LACRIMALPUNCTAROUTE: return "_LacrimalPunctaRoute";
+            case _LARYNGEALROUTE: return "_LaryngealRoute";
+            case _LINGUALROUTE: return "_LingualRoute";
+            case _MUCOUSMEMBRANEROUTE: return "_MucousMembraneRoute";
+            case _NAILROUTE: return "_NailRoute";
+            case _NASALROUTE: return "_NasalRoute";
+            case _OPHTHALMICROUTE: return "_OphthalmicRoute";
+            case _ORALROUTE: return "_OralRoute";
+            case _OROMUCOSALROUTE: return "_OromucosalRoute";
+            case _OROPHARYNGEALROUTE: return "_OropharyngealRoute";
+            case _OTICROUTE: return "_OticRoute";
+            case _PARANASALSINUSESROUTE: return "_ParanasalSinusesRoute";
+            case _PARENTERALROUTE: return "_ParenteralRoute";
+            case _PERIANALROUTE: return "_PerianalRoute";
+            case _PERIARTICULARROUTE: return "_PeriarticularRoute";
+            case _PERIDURALROUTE: return "_PeriduralRoute";
+            case _PERINEALROUTE: return "_PerinealRoute";
+            case _PERINEURALROUTE: return "_PerineuralRoute";
+            case _PERIODONTALROUTE: return "_PeriodontalRoute";
+            case _PULMONARYROUTE: return "_PulmonaryRoute";
+            case _RECTALROUTE: return "_RectalRoute";
+            case _RESPIRATORYTRACTROUTE: return "_RespiratoryTractRoute";
+            case _RETROBULBARROUTE: return "_RetrobulbarRoute";
+            case _SCALPROUTE: return "_ScalpRoute";
+            case _SINUSUNSPECIFIEDROUTE: return "_SinusUnspecifiedRoute";
+            case _SKINROUTE: return "_SkinRoute";
+            case _SOFTTISSUEROUTE: return "_SoftTissueRoute";
+            case _SUBARACHNOIDROUTE: return "_SubarachnoidRoute";
+            case _SUBCONJUNCTIVALROUTE: return "_SubconjunctivalRoute";
+            case _SUBCUTANEOUSROUTE: return "_SubcutaneousRoute";
+            case _SUBLESIONALROUTE: return "_SublesionalRoute";
+            case _SUBLINGUALROUTE: return "_SublingualRoute";
+            case _SUBMUCOSALROUTE: return "_SubmucosalRoute";
+            case _TRACHEOSTOMYROUTE: return "_TracheostomyRoute";
+            case _TRANSMUCOSALROUTE: return "_TransmucosalRoute";
+            case _TRANSPLACENTALROUTE: return "_TransplacentalRoute";
+            case _TRANSTRACHEALROUTE: return "_TranstrachealRoute";
+            case _TRANSTYMPANICROUTE: return "_TranstympanicRoute";
+            case _URETERALROUTE: return "_UreteralRoute";
+            case _URETHRALROUTE: return "_UrethralRoute";
+            case _URINARYBLADDERROUTE: return "_UrinaryBladderRoute";
+            case _URINARYTRACTROUTE: return "_UrinaryTractRoute";
+            case _VAGINALROUTE: return "_VaginalRoute";
+            case _VITREOUSHUMOURROUTE: return "_VitreousHumourRoute";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/RouteOfAdministration";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ROUTEBYMETHOD: return "Route of substance administration classified by administration method.";
+            case SOAK: return "Immersion (soak)";
+            case SHAMPOO: return "Shampoo";
+            case TRNSLING: return "Translingual";
+            case PO: return "Swallow, oral";
+            case GARGLE: return "Gargle";
+            case SUCK: return "Suck, oromucosal";
+            case _CHEW: return "Chew";
+            case CHEW: return "Chew, oral";
+            case _DIFFUSION: return "Diffusion";
+            case EXTCORPDIF: return "Diffusion, extracorporeal";
+            case HEMODIFF: return "Diffusion, hemodialysis";
+            case TRNSDERMD: return "Diffusion, transdermal";
+            case _DISSOLVE: return "Dissolve";
+            case DISSOLVE: return "Dissolve, oral";
+            case SL: return "Dissolve, sublingual";
+            case _DOUCHE: return "Douche";
+            case DOUCHE: return "Douche, vaginal";
+            case _ELECTROOSMOSISROUTE: return "Electro-osmosis";
+            case ELECTOSMOS: return "Electro-osmosis";
+            case _ENEMA: return "Enema";
+            case ENEMA: return "Enema, rectal";
+            case RETENEMA: return "Enema, rectal retention";
+            case _FLUSH: return "Flush";
+            case IVFLUSH: return "Flush, intravenous catheter";
+            case _IMPLANTATION: return "Implantation";
+            case IDIMPLNT: return "Implantation, intradermal";
+            case IVITIMPLNT: return "Implantation, intravitreal";
+            case SQIMPLNT: return "Implantation, subcutaneous";
+            case _INFUSION: return "Infusion";
+            case EPI: return "Infusion, epidural";
+            case IA: return "Infusion, intraarterial catheter";
+            case IC: return "Infusion, intracardiac";
+            case ICOR: return "Infusion, intracoronary";
+            case IOSSC: return "Infusion, intraosseous, continuous";
+            case IT: return "Infusion, intrathecal";
+            case IV: return "Infusion, intravenous";
+            case IVC: return "Infusion, intravenous catheter";
+            case IVCC: return "Infusion, intravenous catheter, continuous";
+            case IVCI: return "Infusion, intravenous catheter, intermittent";
+            case PCA: return "Infusion, intravenous catheter, pca pump";
+            case IVASCINFUS: return "Infusion, intravascular";
+            case SQINFUS: return "Infusion, subcutaneous";
+            case _INHALATION: return "Inhalation";
+            case IPINHL: return "Inhalation, oral";
+            case ORIFINHL: return "Inhalation, oral intermittent flow";
+            case REBREATH: return "Inhalation, oral rebreather mask";
+            case IPPB: return "Inhalation, intermittent positive pressure breathing (ippb)";
+            case NASINHL: return "Inhalation, nasal";
+            case NASINHLC: return "Inhalation, nasal, prongs";
+            case NEB: return "Inhalation, nebulization";
+            case NASNEB: return "Inhalation, nebulization, nasal";
+            case ORNEB: return "Inhalation, nebulization, oral";
+            case TRACH: return "Inhalation, tracheostomy";
+            case VENT: return "Inhalation, ventilator";
+            case VENTMASK: return "Inhalation, ventimask";
+            case _INJECTION: return "Injection";
+            case AMNINJ: return "Injection, amniotic fluid";
+            case BILINJ: return "Injection, biliary tract";
+            case CHOLINJ: return "Injection, for cholangiography";
+            case CERVINJ: return "Injection, cervical";
+            case EPIDURINJ: return "Injection, epidural";
+            case EPIINJ: return "Injection, epidural, push";
+            case EPINJSP: return "Injection, epidural, slow push";
+            case EXTRAMNINJ: return "Injection, extra-amniotic";
+            case EXTCORPINJ: return "Injection, extracorporeal";
+            case GBINJ: return "Injection, gastric button";
+            case GINGINJ: return "Injection, gingival";
+            case BLADINJ: return "Injection, urinary bladder";
+            case ENDOSININJ: return "Injection, endosinusial";
+            case HEMOPORT: return "Injection, hemodialysis port";
+            case IABDINJ: return "Injection, intra-abdominal";
+            case IAINJ: return "Injection, intraarterial";
+            case IAINJP: return "Injection, intraarterial, push";
+            case IAINJSP: return "Injection, intraarterial, slow push";
+            case IARTINJ: return "Injection, intraarticular";
+            case IBURSINJ: return "Injection, intrabursal";
+            case ICARDINJ: return "Injection, intracardiac";
+            case ICARDINJRP: return "Injection, intracardiac, rapid push";
+            case ICARDINJSP: return "Injection, intracardiac, slow push";
+            case ICARINJP: return "Injection, intracardiac, push";
+            case ICARTINJ: return "Injection, intracartilaginous";
+            case ICAUDINJ: return "Injection, intracaudal";
+            case ICAVINJ: return "Injection, intracavernous";
+            case ICAVITINJ: return "Injection, intracavitary";
+            case ICEREBINJ: return "Injection, intracerebral";
+            case ICISTERNINJ: return "Injection, intracisternal";
+            case ICORONINJ: return "Injection, intracoronary";
+            case ICORONINJP: return "Injection, intracoronary, push";
+            case ICORPCAVINJ: return "Injection, intracorpus cavernosum";
+            case IDINJ: return "Injection, intradermal";
+            case IDISCINJ: return "Injection, intradiscal";
+            case IDUCTINJ: return "Injection, intraductal";
+            case IDURINJ: return "Injection, intradural";
+            case IEPIDINJ: return "Injection, intraepidermal";
+            case IEPITHINJ: return "Injection, intraepithelial";
+            case ILESINJ: return "Injection, intralesional";
+            case ILUMINJ: return "Injection, intraluminal";
+            case ILYMPJINJ: return "Injection, intralymphatic";
+            case IM: return "Injection, intramuscular";
+            case IMD: return "Injection, intramuscular, deep";
+            case IMZ: return "Injection, intramuscular, z track";
+            case IMEDULINJ: return "Injection, intramedullary";
+            case INTERMENINJ: return "Injection, interameningeal";
+            case INTERSTITINJ: return "Injection, interstitial";
+            case IOINJ: return "Injection, intraocular";
+            case IOSSINJ: return "Injection, intraosseous";
+            case IOVARINJ: return "Injection, intraovarian";
+            case IPCARDINJ: return "Injection, intrapericardial";
+            case IPERINJ: return "Injection, intraperitoneal";
+            case IPINJ: return "Injection, intrapulmonary";
+            case IPLRINJ: return "Injection, intrapleural";
+            case IPROSTINJ: return "Injection, intraprostatic";
+            case IPUMPINJ: return "Injection, insulin pump";
+            case ISINJ: return "Injection, intraspinal";
+            case ISTERINJ: return "Injection, intrasternal";
+            case ISYNINJ: return "Injection, intrasynovial";
+            case ITENDINJ: return "Injection, intratendinous";
+            case ITESTINJ: return "Injection, intratesticular";
+            case ITHORINJ: return "Injection, intrathoracic";
+            case ITINJ: return "Injection, intrathecal";
+            case ITUBINJ: return "Injection, intratubular";
+            case ITUMINJ: return "Injection, intratumor";
+            case ITYMPINJ: return "Injection, intratympanic";
+            case IUINJ: return "Injection, intracervical (uterus)";
+            case IUINJC: return "Injection, intracervical (uterus)";
+            case IURETINJ: return "Injection, intraureteral, retrograde";
+            case IVASCINJ: return "Injection, intravascular";
+            case IVENTINJ: return "Injection, intraventricular (heart)";
+            case IVESINJ: return "Injection, intravesicle";
+            case IVINJ: return "Injection, intravenous";
+            case IVINJBOL: return "Injection, intravenous, bolus";
+            case IVPUSH: return "Injection, intravenous, push";
+            case IVRPUSH: return "Injection, intravenous, rapid push";
+            case IVSPUSH: return "Injection, intravenous, slow push";
+            case IVITINJ: return "Injection, intravitreal";
+            case PAINJ: return "Injection, periarticular";
+            case PARENTINJ: return "Injection, parenteral";
+            case PDONTINJ: return "Injection, periodontal";
+            case PDPINJ: return "Injection, peritoneal dialysis port";
+            case PDURINJ: return "Injection, peridural";
+            case PNINJ: return "Injection, perineural";
+            case PNSINJ: return "Injection, paranasal sinuses";
+            case RBINJ: return "Injection, retrobulbar";
+            case SCINJ: return "Injection, subconjunctival";
+            case SLESINJ: return "Injection, sublesional";
+            case SOFTISINJ: return "Injection, soft tissue";
+            case SQ: return "Injection, subcutaneous";
+            case SUBARACHINJ: return "Injection, subarachnoid";
+            case SUBMUCINJ: return "Injection, submucosal";
+            case TRPLACINJ: return "Injection, transplacental";
+            case TRTRACHINJ: return "Injection, transtracheal";
+            case URETHINJ: return "Injection, urethral";
+            case URETINJ: return "Injection, ureteral";
+            case _INSERTION: return "Insertion";
+            case CERVINS: return "Insertion, cervical (uterine)";
+            case IOSURGINS: return "Insertion, intraocular, surgical";
+            case IU: return "Insertion, intrauterine";
+            case LPINS: return "Insertion, lacrimal puncta";
+            case PR: return "Insertion, rectal";
+            case SQSURGINS: return "Insertion, subcutaneous, surgical";
+            case URETHINS: return "Insertion, urethral";
+            case VAGINSI: return "Insertion, vaginal";
+            case _INSTILLATION: return "Instillation";
+            case CECINSTL: return "Instillation, cecostomy";
+            case EFT: return "Instillation, enteral feeding tube";
+            case ENTINSTL: return "Instillation, enteral";
+            case GT: return "Instillation, gastrostomy tube";
+            case NGT: return "Instillation, nasogastric tube";
+            case OGT: return "Instillation, orogastric tube";
+            case BLADINSTL: return "Instillation, urinary catheter";
+            case CAPDINSTL: return "Instillation, continuous ambulatory peritoneal dialysis port";
+            case CTINSTL: return "Instillation, chest tube";
+            case ETINSTL: return "Instillation, endotracheal tube";
+            case GJT: return "Instillation, gastro-jejunostomy tube";
+            case IBRONCHINSTIL: return "Instillation, intrabronchial";
+            case IDUODINSTIL: return "Instillation, intraduodenal";
+            case IESOPHINSTIL: return "Instillation, intraesophageal";
+            case IGASTINSTIL: return "Instillation, intragastric";
+            case IILEALINJ: return "Instillation, intraileal";
+            case IOINSTL: return "Instillation, intraocular";
+            case ISININSTIL: return "Instillation, intrasinal";
+            case ITRACHINSTIL: return "Instillation, intratracheal";
+            case IUINSTL: return "Instillation, intrauterine";
+            case JJTINSTL: return "Instillation, jejunostomy tube";
+            case LARYNGINSTIL: return "Instillation, laryngeal";
+            case NASALINSTIL: return "Instillation, nasal";
+            case NASOGASINSTIL: return "Instillation, nasogastric";
+            case NTT: return "Instillation, nasotracheal tube";
+            case OJJ: return "Instillation, orojejunum tube";
+            case OT: return "Instillation, otic";
+            case PDPINSTL: return "Instillation, peritoneal dialysis port";
+            case PNSINSTL: return "Instillation, paranasal sinuses";
+            case RECINSTL: return "Instillation, rectal";
+            case RECTINSTL: return "Instillation, rectal tube";
+            case SININSTIL: return "Instillation, sinus, unspecified";
+            case SOFTISINSTIL: return "Instillation, soft tissue";
+            case TRACHINSTL: return "Instillation, tracheostomy";
+            case TRTYMPINSTIL: return "Instillation, transtympanic";
+            case URETHINSTL: return "Instillation, urethral";
+            case _IONTOPHORESISROUTE: return "Iontophoresis";
+            case IONTO: return "Topical application, iontophoresis";
+            case _IRRIGATION: return "Irrigation";
+            case GUIRR: return "Irrigation, genitourinary";
+            case IGASTIRR: return "Irrigation, intragastric";
+            case ILESIRR: return "Irrigation, intralesional";
+            case IOIRR: return "Irrigation, intraocular";
+            case BLADIRR: return "Irrigation, urinary bladder";
+            case BLADIRRC: return "Irrigation, urinary bladder, continuous";
+            case BLADIRRT: return "Irrigation, urinary bladder, tidal";
+            case RECIRR: return "Irrigation, rectal";
+            case _LAVAGEROUTE: return "Lavage";
+            case IGASTLAV: return "Lavage, intragastric";
+            case _MUCOSALABSORPTIONROUTE: return "Mucosal absorption";
+            case IDOUDMAB: return "Mucosal absorption, intraduodenal";
+            case ITRACHMAB: return "Mucosal absorption, intratracheal";
+            case SMUCMAB: return "Mucosal absorption, submucosal";
+            case _NEBULIZATION: return "Nebulization";
+            case ETNEB: return "Nebulization, endotracheal tube";
+            case _RINSE: return "Rinse";
+            case DENRINSE: return "Rinse, dental";
+            case ORRINSE: return "Rinse, oral";
+            case _SUPPOSITORYROUTE: return "Suppository";
+            case URETHSUP: return "Suppository, urethral";
+            case _SWISH: return "Swish";
+            case SWISHSPIT: return "Swish and spit out, oromucosal";
+            case SWISHSWAL: return "Swish and swallow, oromucosal";
+            case _TOPICALABSORPTIONROUTE: return "Topical absorption";
+            case TTYMPTABSORP: return "Topical absorption, transtympanic";
+            case _TOPICALAPPLICATION: return "Topical application";
+            case DRESS: return "Topical application, soaked dressing";
+            case SWAB: return "Topical application, swab";
+            case TOPICAL: return "Topical";
+            case BUC: return "Topical application, buccal";
+            case CERV: return "Topical application, cervical";
+            case DEN: return "Topical application, dental";
+            case GIN: return "Topical application, gingival";
+            case HAIR: return "Topical application, hair";
+            case ICORNTA: return "Topical application, intracorneal";
+            case ICORONTA: return "Topical application, intracoronal (dental)";
+            case IESOPHTA: return "Topical application, intraesophageal";
+            case IILEALTA: return "Topical application, intraileal";
+            case ILTOP: return "Topical application, intralesional";
+            case ILUMTA: return "Topical application, intraluminal";
+            case IOTOP: return "Topical application, intraocular";
+            case LARYNGTA: return "Topical application, laryngeal";
+            case MUC: return "Topical application, mucous membrane";
+            case NAIL: return "Topical application, nail";
+            case NASAL: return "Topical application, nasal";
+            case OPTHALTA: return "Topical application, ophthalmic";
+            case ORALTA: return "Topical application, oral";
+            case ORMUC: return "Topical application, oromucosal";
+            case OROPHARTA: return "Topical application, oropharyngeal";
+            case PERIANAL: return "Topical application, perianal";
+            case PERINEAL: return "Topical application, perineal";
+            case PDONTTA: return "Topical application, periodontal";
+            case RECTAL: return "Topical application, rectal";
+            case SCALP: return "Topical application, scalp";
+            case OCDRESTA: return "Occlusive dressing technique";
+            case SKIN: return "Topical application, skin";
+            case SUBCONJTA: return "Subconjunctival";
+            case TMUCTA: return "Topical application, transmucosal";
+            case VAGINS: return "Insertion, vaginal";
+            case INSUF: return "Insufflation";
+            case TRNSDERM: return "Transdermal";
+            case _ROUTEBYSITE: return "Route of substance administration classified by site.";
+            case _AMNIOTICFLUIDSACROUTE: return "Amniotic fluid sac";
+            case _BILIARYROUTE: return "Biliary tract";
+            case _BODYSURFACEROUTE: return "Body surface";
+            case _BUCCALMUCOSAROUTE: return "Buccal mucosa";
+            case _CECOSTOMYROUTE: return "Cecostomy";
+            case _CERVICALROUTE: return "Cervix of the uterus";
+            case _ENDOCERVICALROUTE: return "Endocervical";
+            case _ENTERALROUTE: return "Enteral";
+            case _EPIDURALROUTE: return "Epidural";
+            case _EXTRAAMNIOTICROUTE: return "Extra-amniotic";
+            case _EXTRACORPOREALCIRCULATIONROUTE: return "Extracorporeal circulation";
+            case _GASTRICROUTE: return "Gastric";
+            case _GENITOURINARYROUTE: return "Genitourinary";
+            case _GINGIVALROUTE: return "Gingival";
+            case _HAIRROUTE: return "Hair";
+            case _INTERAMENINGEALROUTE: return "Interameningeal";
+            case _INTERSTITIALROUTE: return "Interstitial";
+            case _INTRAABDOMINALROUTE: return "Intra-abdominal";
+            case _INTRAARTERIALROUTE: return "Intra-arterial";
+            case _INTRAARTICULARROUTE: return "Intraarticular";
+            case _INTRABRONCHIALROUTE: return "Intrabronchial";
+            case _INTRABURSALROUTE: return "Intrabursal";
+            case _INTRACARDIACROUTE: return "Intracardiac";
+            case _INTRACARTILAGINOUSROUTE: return "Intracartilaginous";
+            case _INTRACAUDALROUTE: return "Intracaudal";
+            case _INTRACAVERNOSALROUTE: return "Intracavernosal";
+            case _INTRACAVITARYROUTE: return "Intracavitary";
+            case _INTRACEREBRALROUTE: return "Intracerebral";
+            case _INTRACERVICALROUTE: return "Intracervical";
+            case _INTRACISTERNALROUTE: return "Intracisternal";
+            case _INTRACORNEALROUTE: return "Intracorneal";
+            case _INTRACORONALROUTE: return "Intracoronal (dental)";
+            case _INTRACORONARYROUTE: return "Intracoronary";
+            case _INTRACORPUSCAVERNOSUMROUTE: return "Intracorpus cavernosum";
+            case _INTRADERMALROUTE: return "Intradermal";
+            case _INTRADISCALROUTE: return "Intradiscal";
+            case _INTRADUCTALROUTE: return "Intraductal";
+            case _INTRADUODENALROUTE: return "Intraduodenal";
+            case _INTRADURALROUTE: return "Intradural";
+            case _INTRAEPIDERMALROUTE: return "Intraepidermal";
+            case _INTRAEPITHELIALROUTE: return "Intraepithelial";
+            case _INTRAESOPHAGEALROUTE: return "Intraesophageal";
+            case _INTRAGASTRICROUTE: return "Intragastric";
+            case _INTRAILEALROUTE: return "Intraileal";
+            case _INTRALESIONALROUTE: return "Intralesional";
+            case _INTRALUMINALROUTE: return "Intraluminal";
+            case _INTRALYMPHATICROUTE: return "Intralymphatic";
+            case _INTRAMEDULLARYROUTE: return "Intramedullary";
+            case _INTRAMUSCULARROUTE: return "Intramuscular";
+            case _INTRAOCULARROUTE: return "Intraocular";
+            case _INTRAOSSEOUSROUTE: return "Intraosseous";
+            case _INTRAOVARIANROUTE: return "Intraovarian";
+            case _INTRAPERICARDIALROUTE: return "Intrapericardial";
+            case _INTRAPERITONEALROUTE: return "Intraperitoneal";
+            case _INTRAPLEURALROUTE: return "Intrapleural";
+            case _INTRAPROSTATICROUTE: return "Intraprostatic";
+            case _INTRAPULMONARYROUTE: return "Intrapulmonary";
+            case _INTRASINALROUTE: return "Intrasinal";
+            case _INTRASPINALROUTE: return "Intraspinal";
+            case _INTRASTERNALROUTE: return "Intrasternal";
+            case _INTRASYNOVIALROUTE: return "Intrasynovial";
+            case _INTRATENDINOUSROUTE: return "Intratendinous";
+            case _INTRATESTICULARROUTE: return "Intratesticular";
+            case _INTRATHECALROUTE: return "Intrathecal";
+            case _INTRATHORACICROUTE: return "Intrathoracic";
+            case _INTRATRACHEALROUTE: return "Intratracheal";
+            case _INTRATUBULARROUTE: return "Intratubular";
+            case _INTRATUMORROUTE: return "Intratumor";
+            case _INTRATYMPANICROUTE: return "Intratympanic";
+            case _INTRAUTERINEROUTE: return "Intrauterine";
+            case _INTRAVASCULARROUTE: return "Intravascular";
+            case _INTRAVENOUSROUTE: return "Intravenous";
+            case _INTRAVENTRICULARROUTE: return "Intraventricular";
+            case _INTRAVESICLEROUTE: return "Intravesicle";
+            case _INTRAVITREALROUTE: return "Intravitreal";
+            case _JEJUNUMROUTE: return "Jejunum";
+            case _LACRIMALPUNCTAROUTE: return "Lacrimal puncta";
+            case _LARYNGEALROUTE: return "Laryngeal";
+            case _LINGUALROUTE: return "Lingual";
+            case _MUCOUSMEMBRANEROUTE: return "Mucous membrane";
+            case _NAILROUTE: return "Nail";
+            case _NASALROUTE: return "Nasal";
+            case _OPHTHALMICROUTE: return "Ophthalmic";
+            case _ORALROUTE: return "Oral";
+            case _OROMUCOSALROUTE: return "Oromucosal";
+            case _OROPHARYNGEALROUTE: return "Oropharyngeal";
+            case _OTICROUTE: return "Otic";
+            case _PARANASALSINUSESROUTE: return "Paranasal sinuses";
+            case _PARENTERALROUTE: return "Parenteral";
+            case _PERIANALROUTE: return "Perianal";
+            case _PERIARTICULARROUTE: return "Periarticular";
+            case _PERIDURALROUTE: return "Peridural";
+            case _PERINEALROUTE: return "Perineal";
+            case _PERINEURALROUTE: return "Perineural";
+            case _PERIODONTALROUTE: return "Periodontal";
+            case _PULMONARYROUTE: return "Pulmonary";
+            case _RECTALROUTE: return "Rectal";
+            case _RESPIRATORYTRACTROUTE: return "Respiratory tract";
+            case _RETROBULBARROUTE: return "Retrobulbar";
+            case _SCALPROUTE: return "Scalp";
+            case _SINUSUNSPECIFIEDROUTE: return "Sinus, unspecified";
+            case _SKINROUTE: return "Skin";
+            case _SOFTTISSUEROUTE: return "Soft tissue";
+            case _SUBARACHNOIDROUTE: return "Subarachnoid";
+            case _SUBCONJUNCTIVALROUTE: return "Subconjunctival";
+            case _SUBCUTANEOUSROUTE: return "Subcutaneous";
+            case _SUBLESIONALROUTE: return "Sublesional";
+            case _SUBLINGUALROUTE: return "Sublingual";
+            case _SUBMUCOSALROUTE: return "Submucosal";
+            case _TRACHEOSTOMYROUTE: return "Tracheostomy";
+            case _TRANSMUCOSALROUTE: return "Transmucosal";
+            case _TRANSPLACENTALROUTE: return "Transplacental";
+            case _TRANSTRACHEALROUTE: return "Transtracheal";
+            case _TRANSTYMPANICROUTE: return "Transtympanic";
+            case _URETERALROUTE: return "Ureteral";
+            case _URETHRALROUTE: return "Urethral";
+            case _URINARYBLADDERROUTE: return "Urinary bladder";
+            case _URINARYTRACTROUTE: return "Urinary tract";
+            case _VAGINALROUTE: return "Vaginal";
+            case _VITREOUSHUMOURROUTE: return "Vitreous humour";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ROUTEBYMETHOD: return "RouteByMethod";
+            case SOAK: return "Immersion (soak)";
+            case SHAMPOO: return "Shampoo";
+            case TRNSLING: return "Translingual";
+            case PO: return "Swallow, oral";
+            case GARGLE: return "Gargle";
+            case SUCK: return "Suck, oromucosal";
+            case _CHEW: return "Chew";
+            case CHEW: return "Chew, oral";
+            case _DIFFUSION: return "Diffusion";
+            case EXTCORPDIF: return "Diffusion, extracorporeal";
+            case HEMODIFF: return "Diffusion, hemodialysis";
+            case TRNSDERMD: return "Diffusion, transdermal";
+            case _DISSOLVE: return "Dissolve";
+            case DISSOLVE: return "Dissolve, oral";
+            case SL: return "Dissolve, sublingual";
+            case _DOUCHE: return "Douche";
+            case DOUCHE: return "Douche, vaginal";
+            case _ELECTROOSMOSISROUTE: return "ElectroOsmosisRoute";
+            case ELECTOSMOS: return "Electro-osmosis";
+            case _ENEMA: return "Enema";
+            case ENEMA: return "Enema, rectal";
+            case RETENEMA: return "Enema, rectal retention";
+            case _FLUSH: return "Flush";
+            case IVFLUSH: return "Flush, intravenous catheter";
+            case _IMPLANTATION: return "Implantation";
+            case IDIMPLNT: return "Implantation, intradermal";
+            case IVITIMPLNT: return "Implantation, intravitreal";
+            case SQIMPLNT: return "Implantation, subcutaneous";
+            case _INFUSION: return "Infusion";
+            case EPI: return "Infusion, epidural";
+            case IA: return "Infusion, intraarterial catheter";
+            case IC: return "Infusion, intracardiac";
+            case ICOR: return "Infusion, intracoronary";
+            case IOSSC: return "Infusion, intraosseous, continuous";
+            case IT: return "Infusion, intrathecal";
+            case IV: return "Infusion, intravenous";
+            case IVC: return "Infusion, intravenous catheter";
+            case IVCC: return "Infusion, intravenous catheter, continuous";
+            case IVCI: return "Infusion, intravenous catheter, intermittent";
+            case PCA: return "Infusion, intravenous catheter, pca pump";
+            case IVASCINFUS: return "Infusion, intravascular";
+            case SQINFUS: return "Infusion, subcutaneous";
+            case _INHALATION: return "Inhalation";
+            case IPINHL: return "Inhalation, respiratory";
+            case ORIFINHL: return "Inhalation, oral intermittent flow";
+            case REBREATH: return "Inhalation, oral rebreather mask";
+            case IPPB: return "Inhalation, intermittent positive pressure breathing (ippb)";
+            case NASINHL: return "Inhalation, nasal";
+            case NASINHLC: return "Inhalation, nasal cannula";
+            case NEB: return "Inhalation, nebulization";
+            case NASNEB: return "Inhalation, nebulization, nasal";
+            case ORNEB: return "Inhalation, nebulization, oral";
+            case TRACH: return "Inhalation, tracheostomy";
+            case VENT: return "Inhalation, ventilator";
+            case VENTMASK: return "Inhalation, ventimask";
+            case _INJECTION: return "Injection";
+            case AMNINJ: return "Injection, amniotic fluid";
+            case BILINJ: return "Injection, biliary tract";
+            case CHOLINJ: return "Injection, for cholangiography";
+            case CERVINJ: return "Injection, cervical";
+            case EPIDURINJ: return "Injection, epidural";
+            case EPIINJ: return "Injection, epidural, push";
+            case EPINJSP: return "Injection, epidural, slow push";
+            case EXTRAMNINJ: return "Injection, extra-amniotic";
+            case EXTCORPINJ: return "Injection, extracorporeal";
+            case GBINJ: return "Injection, gastric button";
+            case GINGINJ: return "Injection, gingival";
+            case BLADINJ: return "Injection, urinary bladder";
+            case ENDOSININJ: return "Injection, endosinusial";
+            case HEMOPORT: return "Injection, hemodialysis port";
+            case IABDINJ: return "Injection, intra-abdominal";
+            case IAINJ: return "Injection, intraarterial";
+            case IAINJP: return "Injection, intraarterial, push";
+            case IAINJSP: return "Injection, intraarterial, slow push";
+            case IARTINJ: return "Injection, intraarticular";
+            case IBURSINJ: return "Injection, intrabursal";
+            case ICARDINJ: return "Injection, intracardiac";
+            case ICARDINJRP: return "Injection, intracardiac, rapid push";
+            case ICARDINJSP: return "Injection, intracardiac, slow push";
+            case ICARINJP: return "Injection, intracardiac, push";
+            case ICARTINJ: return "Injection, intracartilaginous";
+            case ICAUDINJ: return "Injection, intracaudal";
+            case ICAVINJ: return "Injection, intracavernous";
+            case ICAVITINJ: return "Injection, intracavitary";
+            case ICEREBINJ: return "Injection, intracerebral";
+            case ICISTERNINJ: return "Injection, intracisternal";
+            case ICORONINJ: return "Injection, intracoronary";
+            case ICORONINJP: return "Injection, intracoronary, push";
+            case ICORPCAVINJ: return "Injection, intracorpus cavernosum";
+            case IDINJ: return "Injection, intradermal";
+            case IDISCINJ: return "Injection, intradiscal";
+            case IDUCTINJ: return "Injection, intraductal";
+            case IDURINJ: return "Injection, intradural";
+            case IEPIDINJ: return "Injection, intraepidermal";
+            case IEPITHINJ: return "Injection, intraepithelial";
+            case ILESINJ: return "Injection, intralesional";
+            case ILUMINJ: return "Injection, intraluminal";
+            case ILYMPJINJ: return "Injection, intralymphatic";
+            case IM: return "Injection, intramuscular";
+            case IMD: return "Injection, intramuscular, deep";
+            case IMZ: return "Injection, intramuscular, z track";
+            case IMEDULINJ: return "Injection, intramedullary";
+            case INTERMENINJ: return "Injection, interameningeal";
+            case INTERSTITINJ: return "Injection, interstitial";
+            case IOINJ: return "Injection, intraocular";
+            case IOSSINJ: return "Injection, intraosseous";
+            case IOVARINJ: return "Injection, intraovarian";
+            case IPCARDINJ: return "Injection, intrapericardial";
+            case IPERINJ: return "Injection, intraperitoneal";
+            case IPINJ: return "Injection, intrapulmonary";
+            case IPLRINJ: return "Injection, intrapleural";
+            case IPROSTINJ: return "Injection, intraprostatic";
+            case IPUMPINJ: return "Injection, insulin pump";
+            case ISINJ: return "Injection, intraspinal";
+            case ISTERINJ: return "Injection, intrasternal";
+            case ISYNINJ: return "Injection, intrasynovial";
+            case ITENDINJ: return "Injection, intratendinous";
+            case ITESTINJ: return "Injection, intratesticular";
+            case ITHORINJ: return "Injection, intrathoracic";
+            case ITINJ: return "Injection, intrathecal";
+            case ITUBINJ: return "Injection, intratubular";
+            case ITUMINJ: return "Injection, intratumor";
+            case ITYMPINJ: return "Injection, intratympanic";
+            case IUINJ: return "Injection, intrauterine";
+            case IUINJC: return "Injection, intracervical (uterus)";
+            case IURETINJ: return "Injection, intraureteral, retrograde";
+            case IVASCINJ: return "Injection, intravascular";
+            case IVENTINJ: return "Injection, intraventricular (heart)";
+            case IVESINJ: return "Injection, intravesicle";
+            case IVINJ: return "Injection, intravenous";
+            case IVINJBOL: return "Injection, intravenous, bolus";
+            case IVPUSH: return "Injection, intravenous, push";
+            case IVRPUSH: return "Injection, intravenous, rapid push";
+            case IVSPUSH: return "Injection, intravenous, slow push";
+            case IVITINJ: return "Injection, intravitreal";
+            case PAINJ: return "Injection, periarticular";
+            case PARENTINJ: return "Injection, parenteral";
+            case PDONTINJ: return "Injection, periodontal";
+            case PDPINJ: return "Injection, peritoneal dialysis port";
+            case PDURINJ: return "Injection, peridural";
+            case PNINJ: return "Injection, perineural";
+            case PNSINJ: return "Injection, paranasal sinuses";
+            case RBINJ: return "Injection, retrobulbar";
+            case SCINJ: return "Injection, subconjunctival";
+            case SLESINJ: return "Injection, sublesional";
+            case SOFTISINJ: return "Injection, soft tissue";
+            case SQ: return "Injection, subcutaneous";
+            case SUBARACHINJ: return "Injection, subarachnoid";
+            case SUBMUCINJ: return "Injection, submucosal";
+            case TRPLACINJ: return "Injection, transplacental";
+            case TRTRACHINJ: return "Injection, transtracheal";
+            case URETHINJ: return "Injection, urethral";
+            case URETINJ: return "Injection, ureteral";
+            case _INSERTION: return "Insertion";
+            case CERVINS: return "Insertion, cervical (uterine)";
+            case IOSURGINS: return "Insertion, intraocular, surgical";
+            case IU: return "Insertion, intrauterine";
+            case LPINS: return "Insertion, lacrimal puncta";
+            case PR: return "Insertion, rectal";
+            case SQSURGINS: return "Insertion, subcutaneous, surgical";
+            case URETHINS: return "Insertion, urethral";
+            case VAGINSI: return "Insertion, vaginal";
+            case _INSTILLATION: return "Instillation";
+            case CECINSTL: return "Instillation, cecostomy";
+            case EFT: return "Instillation, enteral feeding tube";
+            case ENTINSTL: return "Instillation, enteral";
+            case GT: return "Instillation, gastrostomy tube";
+            case NGT: return "Instillation, nasogastric tube";
+            case OGT: return "Instillation, orogastric tube";
+            case BLADINSTL: return "Instillation, urinary catheter";
+            case CAPDINSTL: return "Instillation, continuous ambulatory peritoneal dialysis port";
+            case CTINSTL: return "Instillation, chest tube";
+            case ETINSTL: return "Instillation, endotracheal tube";
+            case GJT: return "Instillation, gastro-jejunostomy tube";
+            case IBRONCHINSTIL: return "Instillation, intrabronchial";
+            case IDUODINSTIL: return "Instillation, intraduodenal";
+            case IESOPHINSTIL: return "Instillation, intraesophageal";
+            case IGASTINSTIL: return "Instillation, intragastric";
+            case IILEALINJ: return "Instillation, intraileal";
+            case IOINSTL: return "Instillation, intraocular";
+            case ISININSTIL: return "Instillation, intrasinal";
+            case ITRACHINSTIL: return "Instillation, intratracheal";
+            case IUINSTL: return "Instillation, intrauterine";
+            case JJTINSTL: return "Instillation, jejunostomy tube";
+            case LARYNGINSTIL: return "Instillation, laryngeal";
+            case NASALINSTIL: return "Instillation, nasal";
+            case NASOGASINSTIL: return "Instillation, nasogastric";
+            case NTT: return "Instillation, nasotracheal tube";
+            case OJJ: return "Instillation, orojejunum tube";
+            case OT: return "Instillation, otic";
+            case PDPINSTL: return "Instillation, peritoneal dialysis port";
+            case PNSINSTL: return "Instillation, paranasal sinuses";
+            case RECINSTL: return "Instillation, rectal";
+            case RECTINSTL: return "Instillation, rectal tube";
+            case SININSTIL: return "Instillation, sinus, unspecified";
+            case SOFTISINSTIL: return "Instillation, soft tissue";
+            case TRACHINSTL: return "Instillation, tracheostomy";
+            case TRTYMPINSTIL: return "Instillation, transtympanic";
+            case URETHINSTL: return "instillation, urethral";
+            case _IONTOPHORESISROUTE: return "IontophoresisRoute";
+            case IONTO: return "Topical application, iontophoresis";
+            case _IRRIGATION: return "Irrigation";
+            case GUIRR: return "Irrigation, genitourinary";
+            case IGASTIRR: return "Irrigation, intragastric";
+            case ILESIRR: return "Irrigation, intralesional";
+            case IOIRR: return "Irrigation, intraocular";
+            case BLADIRR: return "Irrigation, urinary bladder";
+            case BLADIRRC: return "Irrigation, urinary bladder, continuous";
+            case BLADIRRT: return "Irrigation, urinary bladder, tidal";
+            case RECIRR: return "Irrigation, rectal";
+            case _LAVAGEROUTE: return "LavageRoute";
+            case IGASTLAV: return "Lavage, intragastric";
+            case _MUCOSALABSORPTIONROUTE: return "MucosalAbsorptionRoute";
+            case IDOUDMAB: return "Mucosal absorption, intraduodenal";
+            case ITRACHMAB: return "Mucosal absorption, intratracheal";
+            case SMUCMAB: return "Mucosal absorption, submucosal";
+            case _NEBULIZATION: return "Nebulization";
+            case ETNEB: return "Nebulization, endotracheal tube";
+            case _RINSE: return "Rinse";
+            case DENRINSE: return "Rinse, dental";
+            case ORRINSE: return "Rinse, oral";
+            case _SUPPOSITORYROUTE: return "SuppositoryRoute";
+            case URETHSUP: return "Suppository, urethral";
+            case _SWISH: return "Swish";
+            case SWISHSPIT: return "Swish and spit out, oromucosal";
+            case SWISHSWAL: return "Swish and swallow, oromucosal";
+            case _TOPICALABSORPTIONROUTE: return "TopicalAbsorptionRoute";
+            case TTYMPTABSORP: return "Topical absorption, transtympanic";
+            case _TOPICALAPPLICATION: return "TopicalApplication";
+            case DRESS: return "Topical application, soaked dressing";
+            case SWAB: return "Topical application, swab";
+            case TOPICAL: return "Topical";
+            case BUC: return "Topical application, buccal";
+            case CERV: return "Topical application, cervical";
+            case DEN: return "Topical application, dental";
+            case GIN: return "Topical application, gingival";
+            case HAIR: return "Topical application, hair";
+            case ICORNTA: return "Topical application, intracorneal";
+            case ICORONTA: return "Topical application, intracoronal (dental)";
+            case IESOPHTA: return "Topical application, intraesophageal";
+            case IILEALTA: return "Topical application, intraileal";
+            case ILTOP: return "Topical application, intralesional";
+            case ILUMTA: return "Topical application, intraluminal";
+            case IOTOP: return "Topical application, intraocular";
+            case LARYNGTA: return "Topical application, laryngeal";
+            case MUC: return "Topical application, mucous membrane";
+            case NAIL: return "Topical application, nail";
+            case NASAL: return "Topical application, nasal";
+            case OPTHALTA: return "Topical application, ophthalmic";
+            case ORALTA: return "Topical application, oral";
+            case ORMUC: return "Topical application, oromucosal";
+            case OROPHARTA: return "Topical application, oropharyngeal";
+            case PERIANAL: return "Topical application, perianal";
+            case PERINEAL: return "Topical application, perineal";
+            case PDONTTA: return "Topical application, periodontal";
+            case RECTAL: return "Topical application, rectal";
+            case SCALP: return "Topical application, scalp";
+            case OCDRESTA: return "Occlusive dressing technique";
+            case SKIN: return "Topical application, skin";
+            case SUBCONJTA: return "Subconjunctival";
+            case TMUCTA: return "Topical application, transmucosal";
+            case VAGINS: return "Topical application, vaginal";
+            case INSUF: return "Insufflation";
+            case TRNSDERM: return "Transdermal";
+            case _ROUTEBYSITE: return "RouteBySite";
+            case _AMNIOTICFLUIDSACROUTE: return "AmnioticFluidSacRoute";
+            case _BILIARYROUTE: return "BiliaryRoute";
+            case _BODYSURFACEROUTE: return "BodySurfaceRoute";
+            case _BUCCALMUCOSAROUTE: return "BuccalMucosaRoute";
+            case _CECOSTOMYROUTE: return "CecostomyRoute";
+            case _CERVICALROUTE: return "CervicalRoute";
+            case _ENDOCERVICALROUTE: return "EndocervicalRoute";
+            case _ENTERALROUTE: return "EnteralRoute";
+            case _EPIDURALROUTE: return "EpiduralRoute";
+            case _EXTRAAMNIOTICROUTE: return "ExtraAmnioticRoute";
+            case _EXTRACORPOREALCIRCULATIONROUTE: return "ExtracorporealCirculationRoute";
+            case _GASTRICROUTE: return "GastricRoute";
+            case _GENITOURINARYROUTE: return "GenitourinaryRoute";
+            case _GINGIVALROUTE: return "GingivalRoute";
+            case _HAIRROUTE: return "HairRoute";
+            case _INTERAMENINGEALROUTE: return "InterameningealRoute";
+            case _INTERSTITIALROUTE: return "InterstitialRoute";
+            case _INTRAABDOMINALROUTE: return "IntraabdominalRoute";
+            case _INTRAARTERIALROUTE: return "IntraarterialRoute";
+            case _INTRAARTICULARROUTE: return "IntraarticularRoute";
+            case _INTRABRONCHIALROUTE: return "IntrabronchialRoute";
+            case _INTRABURSALROUTE: return "IntrabursalRoute";
+            case _INTRACARDIACROUTE: return "IntracardiacRoute";
+            case _INTRACARTILAGINOUSROUTE: return "IntracartilaginousRoute";
+            case _INTRACAUDALROUTE: return "IntracaudalRoute";
+            case _INTRACAVERNOSALROUTE: return "IntracavernosalRoute";
+            case _INTRACAVITARYROUTE: return "IntracavitaryRoute";
+            case _INTRACEREBRALROUTE: return "IntracerebralRoute";
+            case _INTRACERVICALROUTE: return "IntracervicalRoute";
+            case _INTRACISTERNALROUTE: return "IntracisternalRoute";
+            case _INTRACORNEALROUTE: return "IntracornealRoute";
+            case _INTRACORONALROUTE: return "IntracoronalRoute";
+            case _INTRACORONARYROUTE: return "IntracoronaryRoute";
+            case _INTRACORPUSCAVERNOSUMROUTE: return "IntracorpusCavernosumRoute";
+            case _INTRADERMALROUTE: return "IntradermalRoute";
+            case _INTRADISCALROUTE: return "IntradiscalRoute";
+            case _INTRADUCTALROUTE: return "IntraductalRoute";
+            case _INTRADUODENALROUTE: return "IntraduodenalRoute";
+            case _INTRADURALROUTE: return "IntraduralRoute";
+            case _INTRAEPIDERMALROUTE: return "IntraepidermalRoute";
+            case _INTRAEPITHELIALROUTE: return "IntraepithelialRoute";
+            case _INTRAESOPHAGEALROUTE: return "IntraesophagealRoute";
+            case _INTRAGASTRICROUTE: return "IntragastricRoute";
+            case _INTRAILEALROUTE: return "IntrailealRoute";
+            case _INTRALESIONALROUTE: return "IntralesionalRoute";
+            case _INTRALUMINALROUTE: return "IntraluminalRoute";
+            case _INTRALYMPHATICROUTE: return "IntralymphaticRoute";
+            case _INTRAMEDULLARYROUTE: return "IntramedullaryRoute";
+            case _INTRAMUSCULARROUTE: return "IntramuscularRoute";
+            case _INTRAOCULARROUTE: return "IntraocularRoute";
+            case _INTRAOSSEOUSROUTE: return "IntraosseousRoute";
+            case _INTRAOVARIANROUTE: return "IntraovarianRoute";
+            case _INTRAPERICARDIALROUTE: return "IntrapericardialRoute";
+            case _INTRAPERITONEALROUTE: return "IntraperitonealRoute";
+            case _INTRAPLEURALROUTE: return "IntrapleuralRoute";
+            case _INTRAPROSTATICROUTE: return "IntraprostaticRoute";
+            case _INTRAPULMONARYROUTE: return "IntrapulmonaryRoute";
+            case _INTRASINALROUTE: return "IntrasinalRoute";
+            case _INTRASPINALROUTE: return "IntraspinalRoute";
+            case _INTRASTERNALROUTE: return "IntrasternalRoute";
+            case _INTRASYNOVIALROUTE: return "IntrasynovialRoute";
+            case _INTRATENDINOUSROUTE: return "IntratendinousRoute";
+            case _INTRATESTICULARROUTE: return "IntratesticularRoute";
+            case _INTRATHECALROUTE: return "IntrathecalRoute";
+            case _INTRATHORACICROUTE: return "IntrathoracicRoute";
+            case _INTRATRACHEALROUTE: return "IntratrachealRoute";
+            case _INTRATUBULARROUTE: return "IntratubularRoute";
+            case _INTRATUMORROUTE: return "IntratumorRoute";
+            case _INTRATYMPANICROUTE: return "IntratympanicRoute";
+            case _INTRAUTERINEROUTE: return "IntrauterineRoute";
+            case _INTRAVASCULARROUTE: return "IntravascularRoute";
+            case _INTRAVENOUSROUTE: return "IntravenousRoute";
+            case _INTRAVENTRICULARROUTE: return "IntraventricularRoute";
+            case _INTRAVESICLEROUTE: return "IntravesicleRoute";
+            case _INTRAVITREALROUTE: return "IntravitrealRoute";
+            case _JEJUNUMROUTE: return "JejunumRoute";
+            case _LACRIMALPUNCTAROUTE: return "LacrimalPunctaRoute";
+            case _LARYNGEALROUTE: return "LaryngealRoute";
+            case _LINGUALROUTE: return "LingualRoute";
+            case _MUCOUSMEMBRANEROUTE: return "MucousMembraneRoute";
+            case _NAILROUTE: return "NailRoute";
+            case _NASALROUTE: return "NasalRoute";
+            case _OPHTHALMICROUTE: return "OphthalmicRoute";
+            case _ORALROUTE: return "OralRoute";
+            case _OROMUCOSALROUTE: return "OromucosalRoute";
+            case _OROPHARYNGEALROUTE: return "OropharyngealRoute";
+            case _OTICROUTE: return "OticRoute";
+            case _PARANASALSINUSESROUTE: return "ParanasalSinusesRoute";
+            case _PARENTERALROUTE: return "ParenteralRoute";
+            case _PERIANALROUTE: return "PerianalRoute";
+            case _PERIARTICULARROUTE: return "PeriarticularRoute";
+            case _PERIDURALROUTE: return "PeriduralRoute";
+            case _PERINEALROUTE: return "PerinealRoute";
+            case _PERINEURALROUTE: return "PerineuralRoute";
+            case _PERIODONTALROUTE: return "PeriodontalRoute";
+            case _PULMONARYROUTE: return "PulmonaryRoute";
+            case _RECTALROUTE: return "RectalRoute";
+            case _RESPIRATORYTRACTROUTE: return "RespiratoryTractRoute";
+            case _RETROBULBARROUTE: return "RetrobulbarRoute";
+            case _SCALPROUTE: return "ScalpRoute";
+            case _SINUSUNSPECIFIEDROUTE: return "SinusUnspecifiedRoute";
+            case _SKINROUTE: return "SkinRoute";
+            case _SOFTTISSUEROUTE: return "SoftTissueRoute";
+            case _SUBARACHNOIDROUTE: return "SubarachnoidRoute";
+            case _SUBCONJUNCTIVALROUTE: return "SubconjunctivalRoute";
+            case _SUBCUTANEOUSROUTE: return "SubcutaneousRoute";
+            case _SUBLESIONALROUTE: return "SublesionalRoute";
+            case _SUBLINGUALROUTE: return "SublingualRoute";
+            case _SUBMUCOSALROUTE: return "SubmucosalRoute";
+            case _TRACHEOSTOMYROUTE: return "TracheostomyRoute";
+            case _TRANSMUCOSALROUTE: return "TransmucosalRoute";
+            case _TRANSPLACENTALROUTE: return "TransplacentalRoute";
+            case _TRANSTRACHEALROUTE: return "TranstrachealRoute";
+            case _TRANSTYMPANICROUTE: return "TranstympanicRoute";
+            case _URETERALROUTE: return "UreteralRoute";
+            case _URETHRALROUTE: return "UrethralRoute";
+            case _URINARYBLADDERROUTE: return "UrinaryBladderRoute";
+            case _URINARYTRACTROUTE: return "UrinaryTractRoute";
+            case _VAGINALROUTE: return "VaginalRoute";
+            case _VITREOUSHUMOURROUTE: return "VitreousHumourRoute";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RouteOfAdministrationEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RouteOfAdministrationEnumFactory.java
new file mode 100644
index 00000000000..4512fa02509
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3RouteOfAdministrationEnumFactory.java
@@ -0,0 +1,1598 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3RouteOfAdministrationEnumFactory implements EnumFactory {
+
+  public V3RouteOfAdministration fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_RouteByMethod".equals(codeString))
+      return V3RouteOfAdministration._ROUTEBYMETHOD;
+    if ("SOAK".equals(codeString))
+      return V3RouteOfAdministration.SOAK;
+    if ("SHAMPOO".equals(codeString))
+      return V3RouteOfAdministration.SHAMPOO;
+    if ("TRNSLING".equals(codeString))
+      return V3RouteOfAdministration.TRNSLING;
+    if ("PO".equals(codeString))
+      return V3RouteOfAdministration.PO;
+    if ("GARGLE".equals(codeString))
+      return V3RouteOfAdministration.GARGLE;
+    if ("SUCK".equals(codeString))
+      return V3RouteOfAdministration.SUCK;
+    if ("_Chew".equals(codeString))
+      return V3RouteOfAdministration._CHEW;
+    if ("CHEW".equals(codeString))
+      return V3RouteOfAdministration.CHEW;
+    if ("_Diffusion".equals(codeString))
+      return V3RouteOfAdministration._DIFFUSION;
+    if ("EXTCORPDIF".equals(codeString))
+      return V3RouteOfAdministration.EXTCORPDIF;
+    if ("HEMODIFF".equals(codeString))
+      return V3RouteOfAdministration.HEMODIFF;
+    if ("TRNSDERMD".equals(codeString))
+      return V3RouteOfAdministration.TRNSDERMD;
+    if ("_Dissolve".equals(codeString))
+      return V3RouteOfAdministration._DISSOLVE;
+    if ("DISSOLVE".equals(codeString))
+      return V3RouteOfAdministration.DISSOLVE;
+    if ("SL".equals(codeString))
+      return V3RouteOfAdministration.SL;
+    if ("_Douche".equals(codeString))
+      return V3RouteOfAdministration._DOUCHE;
+    if ("DOUCHE".equals(codeString))
+      return V3RouteOfAdministration.DOUCHE;
+    if ("_ElectroOsmosisRoute".equals(codeString))
+      return V3RouteOfAdministration._ELECTROOSMOSISROUTE;
+    if ("ELECTOSMOS".equals(codeString))
+      return V3RouteOfAdministration.ELECTOSMOS;
+    if ("_Enema".equals(codeString))
+      return V3RouteOfAdministration._ENEMA;
+    if ("ENEMA".equals(codeString))
+      return V3RouteOfAdministration.ENEMA;
+    if ("RETENEMA".equals(codeString))
+      return V3RouteOfAdministration.RETENEMA;
+    if ("_Flush".equals(codeString))
+      return V3RouteOfAdministration._FLUSH;
+    if ("IVFLUSH".equals(codeString))
+      return V3RouteOfAdministration.IVFLUSH;
+    if ("_Implantation".equals(codeString))
+      return V3RouteOfAdministration._IMPLANTATION;
+    if ("IDIMPLNT".equals(codeString))
+      return V3RouteOfAdministration.IDIMPLNT;
+    if ("IVITIMPLNT".equals(codeString))
+      return V3RouteOfAdministration.IVITIMPLNT;
+    if ("SQIMPLNT".equals(codeString))
+      return V3RouteOfAdministration.SQIMPLNT;
+    if ("_Infusion".equals(codeString))
+      return V3RouteOfAdministration._INFUSION;
+    if ("EPI".equals(codeString))
+      return V3RouteOfAdministration.EPI;
+    if ("IA".equals(codeString))
+      return V3RouteOfAdministration.IA;
+    if ("IC".equals(codeString))
+      return V3RouteOfAdministration.IC;
+    if ("ICOR".equals(codeString))
+      return V3RouteOfAdministration.ICOR;
+    if ("IOSSC".equals(codeString))
+      return V3RouteOfAdministration.IOSSC;
+    if ("IT".equals(codeString))
+      return V3RouteOfAdministration.IT;
+    if ("IV".equals(codeString))
+      return V3RouteOfAdministration.IV;
+    if ("IVC".equals(codeString))
+      return V3RouteOfAdministration.IVC;
+    if ("IVCC".equals(codeString))
+      return V3RouteOfAdministration.IVCC;
+    if ("IVCI".equals(codeString))
+      return V3RouteOfAdministration.IVCI;
+    if ("PCA".equals(codeString))
+      return V3RouteOfAdministration.PCA;
+    if ("IVASCINFUS".equals(codeString))
+      return V3RouteOfAdministration.IVASCINFUS;
+    if ("SQINFUS".equals(codeString))
+      return V3RouteOfAdministration.SQINFUS;
+    if ("_Inhalation".equals(codeString))
+      return V3RouteOfAdministration._INHALATION;
+    if ("IPINHL".equals(codeString))
+      return V3RouteOfAdministration.IPINHL;
+    if ("ORIFINHL".equals(codeString))
+      return V3RouteOfAdministration.ORIFINHL;
+    if ("REBREATH".equals(codeString))
+      return V3RouteOfAdministration.REBREATH;
+    if ("IPPB".equals(codeString))
+      return V3RouteOfAdministration.IPPB;
+    if ("NASINHL".equals(codeString))
+      return V3RouteOfAdministration.NASINHL;
+    if ("NASINHLC".equals(codeString))
+      return V3RouteOfAdministration.NASINHLC;
+    if ("NEB".equals(codeString))
+      return V3RouteOfAdministration.NEB;
+    if ("NASNEB".equals(codeString))
+      return V3RouteOfAdministration.NASNEB;
+    if ("ORNEB".equals(codeString))
+      return V3RouteOfAdministration.ORNEB;
+    if ("TRACH".equals(codeString))
+      return V3RouteOfAdministration.TRACH;
+    if ("VENT".equals(codeString))
+      return V3RouteOfAdministration.VENT;
+    if ("VENTMASK".equals(codeString))
+      return V3RouteOfAdministration.VENTMASK;
+    if ("_Injection".equals(codeString))
+      return V3RouteOfAdministration._INJECTION;
+    if ("AMNINJ".equals(codeString))
+      return V3RouteOfAdministration.AMNINJ;
+    if ("BILINJ".equals(codeString))
+      return V3RouteOfAdministration.BILINJ;
+    if ("CHOLINJ".equals(codeString))
+      return V3RouteOfAdministration.CHOLINJ;
+    if ("CERVINJ".equals(codeString))
+      return V3RouteOfAdministration.CERVINJ;
+    if ("EPIDURINJ".equals(codeString))
+      return V3RouteOfAdministration.EPIDURINJ;
+    if ("EPIINJ".equals(codeString))
+      return V3RouteOfAdministration.EPIINJ;
+    if ("EPINJSP".equals(codeString))
+      return V3RouteOfAdministration.EPINJSP;
+    if ("EXTRAMNINJ".equals(codeString))
+      return V3RouteOfAdministration.EXTRAMNINJ;
+    if ("EXTCORPINJ".equals(codeString))
+      return V3RouteOfAdministration.EXTCORPINJ;
+    if ("GBINJ".equals(codeString))
+      return V3RouteOfAdministration.GBINJ;
+    if ("GINGINJ".equals(codeString))
+      return V3RouteOfAdministration.GINGINJ;
+    if ("BLADINJ".equals(codeString))
+      return V3RouteOfAdministration.BLADINJ;
+    if ("ENDOSININJ".equals(codeString))
+      return V3RouteOfAdministration.ENDOSININJ;
+    if ("HEMOPORT".equals(codeString))
+      return V3RouteOfAdministration.HEMOPORT;
+    if ("IABDINJ".equals(codeString))
+      return V3RouteOfAdministration.IABDINJ;
+    if ("IAINJ".equals(codeString))
+      return V3RouteOfAdministration.IAINJ;
+    if ("IAINJP".equals(codeString))
+      return V3RouteOfAdministration.IAINJP;
+    if ("IAINJSP".equals(codeString))
+      return V3RouteOfAdministration.IAINJSP;
+    if ("IARTINJ".equals(codeString))
+      return V3RouteOfAdministration.IARTINJ;
+    if ("IBURSINJ".equals(codeString))
+      return V3RouteOfAdministration.IBURSINJ;
+    if ("ICARDINJ".equals(codeString))
+      return V3RouteOfAdministration.ICARDINJ;
+    if ("ICARDINJRP".equals(codeString))
+      return V3RouteOfAdministration.ICARDINJRP;
+    if ("ICARDINJSP".equals(codeString))
+      return V3RouteOfAdministration.ICARDINJSP;
+    if ("ICARINJP".equals(codeString))
+      return V3RouteOfAdministration.ICARINJP;
+    if ("ICARTINJ".equals(codeString))
+      return V3RouteOfAdministration.ICARTINJ;
+    if ("ICAUDINJ".equals(codeString))
+      return V3RouteOfAdministration.ICAUDINJ;
+    if ("ICAVINJ".equals(codeString))
+      return V3RouteOfAdministration.ICAVINJ;
+    if ("ICAVITINJ".equals(codeString))
+      return V3RouteOfAdministration.ICAVITINJ;
+    if ("ICEREBINJ".equals(codeString))
+      return V3RouteOfAdministration.ICEREBINJ;
+    if ("ICISTERNINJ".equals(codeString))
+      return V3RouteOfAdministration.ICISTERNINJ;
+    if ("ICORONINJ".equals(codeString))
+      return V3RouteOfAdministration.ICORONINJ;
+    if ("ICORONINJP".equals(codeString))
+      return V3RouteOfAdministration.ICORONINJP;
+    if ("ICORPCAVINJ".equals(codeString))
+      return V3RouteOfAdministration.ICORPCAVINJ;
+    if ("IDINJ".equals(codeString))
+      return V3RouteOfAdministration.IDINJ;
+    if ("IDISCINJ".equals(codeString))
+      return V3RouteOfAdministration.IDISCINJ;
+    if ("IDUCTINJ".equals(codeString))
+      return V3RouteOfAdministration.IDUCTINJ;
+    if ("IDURINJ".equals(codeString))
+      return V3RouteOfAdministration.IDURINJ;
+    if ("IEPIDINJ".equals(codeString))
+      return V3RouteOfAdministration.IEPIDINJ;
+    if ("IEPITHINJ".equals(codeString))
+      return V3RouteOfAdministration.IEPITHINJ;
+    if ("ILESINJ".equals(codeString))
+      return V3RouteOfAdministration.ILESINJ;
+    if ("ILUMINJ".equals(codeString))
+      return V3RouteOfAdministration.ILUMINJ;
+    if ("ILYMPJINJ".equals(codeString))
+      return V3RouteOfAdministration.ILYMPJINJ;
+    if ("IM".equals(codeString))
+      return V3RouteOfAdministration.IM;
+    if ("IMD".equals(codeString))
+      return V3RouteOfAdministration.IMD;
+    if ("IMZ".equals(codeString))
+      return V3RouteOfAdministration.IMZ;
+    if ("IMEDULINJ".equals(codeString))
+      return V3RouteOfAdministration.IMEDULINJ;
+    if ("INTERMENINJ".equals(codeString))
+      return V3RouteOfAdministration.INTERMENINJ;
+    if ("INTERSTITINJ".equals(codeString))
+      return V3RouteOfAdministration.INTERSTITINJ;
+    if ("IOINJ".equals(codeString))
+      return V3RouteOfAdministration.IOINJ;
+    if ("IOSSINJ".equals(codeString))
+      return V3RouteOfAdministration.IOSSINJ;
+    if ("IOVARINJ".equals(codeString))
+      return V3RouteOfAdministration.IOVARINJ;
+    if ("IPCARDINJ".equals(codeString))
+      return V3RouteOfAdministration.IPCARDINJ;
+    if ("IPERINJ".equals(codeString))
+      return V3RouteOfAdministration.IPERINJ;
+    if ("IPINJ".equals(codeString))
+      return V3RouteOfAdministration.IPINJ;
+    if ("IPLRINJ".equals(codeString))
+      return V3RouteOfAdministration.IPLRINJ;
+    if ("IPROSTINJ".equals(codeString))
+      return V3RouteOfAdministration.IPROSTINJ;
+    if ("IPUMPINJ".equals(codeString))
+      return V3RouteOfAdministration.IPUMPINJ;
+    if ("ISINJ".equals(codeString))
+      return V3RouteOfAdministration.ISINJ;
+    if ("ISTERINJ".equals(codeString))
+      return V3RouteOfAdministration.ISTERINJ;
+    if ("ISYNINJ".equals(codeString))
+      return V3RouteOfAdministration.ISYNINJ;
+    if ("ITENDINJ".equals(codeString))
+      return V3RouteOfAdministration.ITENDINJ;
+    if ("ITESTINJ".equals(codeString))
+      return V3RouteOfAdministration.ITESTINJ;
+    if ("ITHORINJ".equals(codeString))
+      return V3RouteOfAdministration.ITHORINJ;
+    if ("ITINJ".equals(codeString))
+      return V3RouteOfAdministration.ITINJ;
+    if ("ITUBINJ".equals(codeString))
+      return V3RouteOfAdministration.ITUBINJ;
+    if ("ITUMINJ".equals(codeString))
+      return V3RouteOfAdministration.ITUMINJ;
+    if ("ITYMPINJ".equals(codeString))
+      return V3RouteOfAdministration.ITYMPINJ;
+    if ("IUINJ".equals(codeString))
+      return V3RouteOfAdministration.IUINJ;
+    if ("IUINJC".equals(codeString))
+      return V3RouteOfAdministration.IUINJC;
+    if ("IURETINJ".equals(codeString))
+      return V3RouteOfAdministration.IURETINJ;
+    if ("IVASCINJ".equals(codeString))
+      return V3RouteOfAdministration.IVASCINJ;
+    if ("IVENTINJ".equals(codeString))
+      return V3RouteOfAdministration.IVENTINJ;
+    if ("IVESINJ".equals(codeString))
+      return V3RouteOfAdministration.IVESINJ;
+    if ("IVINJ".equals(codeString))
+      return V3RouteOfAdministration.IVINJ;
+    if ("IVINJBOL".equals(codeString))
+      return V3RouteOfAdministration.IVINJBOL;
+    if ("IVPUSH".equals(codeString))
+      return V3RouteOfAdministration.IVPUSH;
+    if ("IVRPUSH".equals(codeString))
+      return V3RouteOfAdministration.IVRPUSH;
+    if ("IVSPUSH".equals(codeString))
+      return V3RouteOfAdministration.IVSPUSH;
+    if ("IVITINJ".equals(codeString))
+      return V3RouteOfAdministration.IVITINJ;
+    if ("PAINJ".equals(codeString))
+      return V3RouteOfAdministration.PAINJ;
+    if ("PARENTINJ".equals(codeString))
+      return V3RouteOfAdministration.PARENTINJ;
+    if ("PDONTINJ".equals(codeString))
+      return V3RouteOfAdministration.PDONTINJ;
+    if ("PDPINJ".equals(codeString))
+      return V3RouteOfAdministration.PDPINJ;
+    if ("PDURINJ".equals(codeString))
+      return V3RouteOfAdministration.PDURINJ;
+    if ("PNINJ".equals(codeString))
+      return V3RouteOfAdministration.PNINJ;
+    if ("PNSINJ".equals(codeString))
+      return V3RouteOfAdministration.PNSINJ;
+    if ("RBINJ".equals(codeString))
+      return V3RouteOfAdministration.RBINJ;
+    if ("SCINJ".equals(codeString))
+      return V3RouteOfAdministration.SCINJ;
+    if ("SLESINJ".equals(codeString))
+      return V3RouteOfAdministration.SLESINJ;
+    if ("SOFTISINJ".equals(codeString))
+      return V3RouteOfAdministration.SOFTISINJ;
+    if ("SQ".equals(codeString))
+      return V3RouteOfAdministration.SQ;
+    if ("SUBARACHINJ".equals(codeString))
+      return V3RouteOfAdministration.SUBARACHINJ;
+    if ("SUBMUCINJ".equals(codeString))
+      return V3RouteOfAdministration.SUBMUCINJ;
+    if ("TRPLACINJ".equals(codeString))
+      return V3RouteOfAdministration.TRPLACINJ;
+    if ("TRTRACHINJ".equals(codeString))
+      return V3RouteOfAdministration.TRTRACHINJ;
+    if ("URETHINJ".equals(codeString))
+      return V3RouteOfAdministration.URETHINJ;
+    if ("URETINJ".equals(codeString))
+      return V3RouteOfAdministration.URETINJ;
+    if ("_Insertion".equals(codeString))
+      return V3RouteOfAdministration._INSERTION;
+    if ("CERVINS".equals(codeString))
+      return V3RouteOfAdministration.CERVINS;
+    if ("IOSURGINS".equals(codeString))
+      return V3RouteOfAdministration.IOSURGINS;
+    if ("IU".equals(codeString))
+      return V3RouteOfAdministration.IU;
+    if ("LPINS".equals(codeString))
+      return V3RouteOfAdministration.LPINS;
+    if ("PR".equals(codeString))
+      return V3RouteOfAdministration.PR;
+    if ("SQSURGINS".equals(codeString))
+      return V3RouteOfAdministration.SQSURGINS;
+    if ("URETHINS".equals(codeString))
+      return V3RouteOfAdministration.URETHINS;
+    if ("VAGINSI".equals(codeString))
+      return V3RouteOfAdministration.VAGINSI;
+    if ("_Instillation".equals(codeString))
+      return V3RouteOfAdministration._INSTILLATION;
+    if ("CECINSTL".equals(codeString))
+      return V3RouteOfAdministration.CECINSTL;
+    if ("EFT".equals(codeString))
+      return V3RouteOfAdministration.EFT;
+    if ("ENTINSTL".equals(codeString))
+      return V3RouteOfAdministration.ENTINSTL;
+    if ("GT".equals(codeString))
+      return V3RouteOfAdministration.GT;
+    if ("NGT".equals(codeString))
+      return V3RouteOfAdministration.NGT;
+    if ("OGT".equals(codeString))
+      return V3RouteOfAdministration.OGT;
+    if ("BLADINSTL".equals(codeString))
+      return V3RouteOfAdministration.BLADINSTL;
+    if ("CAPDINSTL".equals(codeString))
+      return V3RouteOfAdministration.CAPDINSTL;
+    if ("CTINSTL".equals(codeString))
+      return V3RouteOfAdministration.CTINSTL;
+    if ("ETINSTL".equals(codeString))
+      return V3RouteOfAdministration.ETINSTL;
+    if ("GJT".equals(codeString))
+      return V3RouteOfAdministration.GJT;
+    if ("IBRONCHINSTIL".equals(codeString))
+      return V3RouteOfAdministration.IBRONCHINSTIL;
+    if ("IDUODINSTIL".equals(codeString))
+      return V3RouteOfAdministration.IDUODINSTIL;
+    if ("IESOPHINSTIL".equals(codeString))
+      return V3RouteOfAdministration.IESOPHINSTIL;
+    if ("IGASTINSTIL".equals(codeString))
+      return V3RouteOfAdministration.IGASTINSTIL;
+    if ("IILEALINJ".equals(codeString))
+      return V3RouteOfAdministration.IILEALINJ;
+    if ("IOINSTL".equals(codeString))
+      return V3RouteOfAdministration.IOINSTL;
+    if ("ISININSTIL".equals(codeString))
+      return V3RouteOfAdministration.ISININSTIL;
+    if ("ITRACHINSTIL".equals(codeString))
+      return V3RouteOfAdministration.ITRACHINSTIL;
+    if ("IUINSTL".equals(codeString))
+      return V3RouteOfAdministration.IUINSTL;
+    if ("JJTINSTL".equals(codeString))
+      return V3RouteOfAdministration.JJTINSTL;
+    if ("LARYNGINSTIL".equals(codeString))
+      return V3RouteOfAdministration.LARYNGINSTIL;
+    if ("NASALINSTIL".equals(codeString))
+      return V3RouteOfAdministration.NASALINSTIL;
+    if ("NASOGASINSTIL".equals(codeString))
+      return V3RouteOfAdministration.NASOGASINSTIL;
+    if ("NTT".equals(codeString))
+      return V3RouteOfAdministration.NTT;
+    if ("OJJ".equals(codeString))
+      return V3RouteOfAdministration.OJJ;
+    if ("OT".equals(codeString))
+      return V3RouteOfAdministration.OT;
+    if ("PDPINSTL".equals(codeString))
+      return V3RouteOfAdministration.PDPINSTL;
+    if ("PNSINSTL".equals(codeString))
+      return V3RouteOfAdministration.PNSINSTL;
+    if ("RECINSTL".equals(codeString))
+      return V3RouteOfAdministration.RECINSTL;
+    if ("RECTINSTL".equals(codeString))
+      return V3RouteOfAdministration.RECTINSTL;
+    if ("SININSTIL".equals(codeString))
+      return V3RouteOfAdministration.SININSTIL;
+    if ("SOFTISINSTIL".equals(codeString))
+      return V3RouteOfAdministration.SOFTISINSTIL;
+    if ("TRACHINSTL".equals(codeString))
+      return V3RouteOfAdministration.TRACHINSTL;
+    if ("TRTYMPINSTIL".equals(codeString))
+      return V3RouteOfAdministration.TRTYMPINSTIL;
+    if ("URETHINSTL".equals(codeString))
+      return V3RouteOfAdministration.URETHINSTL;
+    if ("_IontophoresisRoute".equals(codeString))
+      return V3RouteOfAdministration._IONTOPHORESISROUTE;
+    if ("IONTO".equals(codeString))
+      return V3RouteOfAdministration.IONTO;
+    if ("_Irrigation".equals(codeString))
+      return V3RouteOfAdministration._IRRIGATION;
+    if ("GUIRR".equals(codeString))
+      return V3RouteOfAdministration.GUIRR;
+    if ("IGASTIRR".equals(codeString))
+      return V3RouteOfAdministration.IGASTIRR;
+    if ("ILESIRR".equals(codeString))
+      return V3RouteOfAdministration.ILESIRR;
+    if ("IOIRR".equals(codeString))
+      return V3RouteOfAdministration.IOIRR;
+    if ("BLADIRR".equals(codeString))
+      return V3RouteOfAdministration.BLADIRR;
+    if ("BLADIRRC".equals(codeString))
+      return V3RouteOfAdministration.BLADIRRC;
+    if ("BLADIRRT".equals(codeString))
+      return V3RouteOfAdministration.BLADIRRT;
+    if ("RECIRR".equals(codeString))
+      return V3RouteOfAdministration.RECIRR;
+    if ("_LavageRoute".equals(codeString))
+      return V3RouteOfAdministration._LAVAGEROUTE;
+    if ("IGASTLAV".equals(codeString))
+      return V3RouteOfAdministration.IGASTLAV;
+    if ("_MucosalAbsorptionRoute".equals(codeString))
+      return V3RouteOfAdministration._MUCOSALABSORPTIONROUTE;
+    if ("IDOUDMAB".equals(codeString))
+      return V3RouteOfAdministration.IDOUDMAB;
+    if ("ITRACHMAB".equals(codeString))
+      return V3RouteOfAdministration.ITRACHMAB;
+    if ("SMUCMAB".equals(codeString))
+      return V3RouteOfAdministration.SMUCMAB;
+    if ("_Nebulization".equals(codeString))
+      return V3RouteOfAdministration._NEBULIZATION;
+    if ("ETNEB".equals(codeString))
+      return V3RouteOfAdministration.ETNEB;
+    if ("_Rinse".equals(codeString))
+      return V3RouteOfAdministration._RINSE;
+    if ("DENRINSE".equals(codeString))
+      return V3RouteOfAdministration.DENRINSE;
+    if ("ORRINSE".equals(codeString))
+      return V3RouteOfAdministration.ORRINSE;
+    if ("_SuppositoryRoute".equals(codeString))
+      return V3RouteOfAdministration._SUPPOSITORYROUTE;
+    if ("URETHSUP".equals(codeString))
+      return V3RouteOfAdministration.URETHSUP;
+    if ("_Swish".equals(codeString))
+      return V3RouteOfAdministration._SWISH;
+    if ("SWISHSPIT".equals(codeString))
+      return V3RouteOfAdministration.SWISHSPIT;
+    if ("SWISHSWAL".equals(codeString))
+      return V3RouteOfAdministration.SWISHSWAL;
+    if ("_TopicalAbsorptionRoute".equals(codeString))
+      return V3RouteOfAdministration._TOPICALABSORPTIONROUTE;
+    if ("TTYMPTABSORP".equals(codeString))
+      return V3RouteOfAdministration.TTYMPTABSORP;
+    if ("_TopicalApplication".equals(codeString))
+      return V3RouteOfAdministration._TOPICALAPPLICATION;
+    if ("DRESS".equals(codeString))
+      return V3RouteOfAdministration.DRESS;
+    if ("SWAB".equals(codeString))
+      return V3RouteOfAdministration.SWAB;
+    if ("TOPICAL".equals(codeString))
+      return V3RouteOfAdministration.TOPICAL;
+    if ("BUC".equals(codeString))
+      return V3RouteOfAdministration.BUC;
+    if ("CERV".equals(codeString))
+      return V3RouteOfAdministration.CERV;
+    if ("DEN".equals(codeString))
+      return V3RouteOfAdministration.DEN;
+    if ("GIN".equals(codeString))
+      return V3RouteOfAdministration.GIN;
+    if ("HAIR".equals(codeString))
+      return V3RouteOfAdministration.HAIR;
+    if ("ICORNTA".equals(codeString))
+      return V3RouteOfAdministration.ICORNTA;
+    if ("ICORONTA".equals(codeString))
+      return V3RouteOfAdministration.ICORONTA;
+    if ("IESOPHTA".equals(codeString))
+      return V3RouteOfAdministration.IESOPHTA;
+    if ("IILEALTA".equals(codeString))
+      return V3RouteOfAdministration.IILEALTA;
+    if ("ILTOP".equals(codeString))
+      return V3RouteOfAdministration.ILTOP;
+    if ("ILUMTA".equals(codeString))
+      return V3RouteOfAdministration.ILUMTA;
+    if ("IOTOP".equals(codeString))
+      return V3RouteOfAdministration.IOTOP;
+    if ("LARYNGTA".equals(codeString))
+      return V3RouteOfAdministration.LARYNGTA;
+    if ("MUC".equals(codeString))
+      return V3RouteOfAdministration.MUC;
+    if ("NAIL".equals(codeString))
+      return V3RouteOfAdministration.NAIL;
+    if ("NASAL".equals(codeString))
+      return V3RouteOfAdministration.NASAL;
+    if ("OPTHALTA".equals(codeString))
+      return V3RouteOfAdministration.OPTHALTA;
+    if ("ORALTA".equals(codeString))
+      return V3RouteOfAdministration.ORALTA;
+    if ("ORMUC".equals(codeString))
+      return V3RouteOfAdministration.ORMUC;
+    if ("OROPHARTA".equals(codeString))
+      return V3RouteOfAdministration.OROPHARTA;
+    if ("PERIANAL".equals(codeString))
+      return V3RouteOfAdministration.PERIANAL;
+    if ("PERINEAL".equals(codeString))
+      return V3RouteOfAdministration.PERINEAL;
+    if ("PDONTTA".equals(codeString))
+      return V3RouteOfAdministration.PDONTTA;
+    if ("RECTAL".equals(codeString))
+      return V3RouteOfAdministration.RECTAL;
+    if ("SCALP".equals(codeString))
+      return V3RouteOfAdministration.SCALP;
+    if ("OCDRESTA".equals(codeString))
+      return V3RouteOfAdministration.OCDRESTA;
+    if ("SKIN".equals(codeString))
+      return V3RouteOfAdministration.SKIN;
+    if ("SUBCONJTA".equals(codeString))
+      return V3RouteOfAdministration.SUBCONJTA;
+    if ("TMUCTA".equals(codeString))
+      return V3RouteOfAdministration.TMUCTA;
+    if ("VAGINS".equals(codeString))
+      return V3RouteOfAdministration.VAGINS;
+    if ("INSUF".equals(codeString))
+      return V3RouteOfAdministration.INSUF;
+    if ("TRNSDERM".equals(codeString))
+      return V3RouteOfAdministration.TRNSDERM;
+    if ("_RouteBySite".equals(codeString))
+      return V3RouteOfAdministration._ROUTEBYSITE;
+    if ("_AmnioticFluidSacRoute".equals(codeString))
+      return V3RouteOfAdministration._AMNIOTICFLUIDSACROUTE;
+    if ("_BiliaryRoute".equals(codeString))
+      return V3RouteOfAdministration._BILIARYROUTE;
+    if ("_BodySurfaceRoute".equals(codeString))
+      return V3RouteOfAdministration._BODYSURFACEROUTE;
+    if ("_BuccalMucosaRoute".equals(codeString))
+      return V3RouteOfAdministration._BUCCALMUCOSAROUTE;
+    if ("_CecostomyRoute".equals(codeString))
+      return V3RouteOfAdministration._CECOSTOMYROUTE;
+    if ("_CervicalRoute".equals(codeString))
+      return V3RouteOfAdministration._CERVICALROUTE;
+    if ("_EndocervicalRoute".equals(codeString))
+      return V3RouteOfAdministration._ENDOCERVICALROUTE;
+    if ("_EnteralRoute".equals(codeString))
+      return V3RouteOfAdministration._ENTERALROUTE;
+    if ("_EpiduralRoute".equals(codeString))
+      return V3RouteOfAdministration._EPIDURALROUTE;
+    if ("_ExtraAmnioticRoute".equals(codeString))
+      return V3RouteOfAdministration._EXTRAAMNIOTICROUTE;
+    if ("_ExtracorporealCirculationRoute".equals(codeString))
+      return V3RouteOfAdministration._EXTRACORPOREALCIRCULATIONROUTE;
+    if ("_GastricRoute".equals(codeString))
+      return V3RouteOfAdministration._GASTRICROUTE;
+    if ("_GenitourinaryRoute".equals(codeString))
+      return V3RouteOfAdministration._GENITOURINARYROUTE;
+    if ("_GingivalRoute".equals(codeString))
+      return V3RouteOfAdministration._GINGIVALROUTE;
+    if ("_HairRoute".equals(codeString))
+      return V3RouteOfAdministration._HAIRROUTE;
+    if ("_InterameningealRoute".equals(codeString))
+      return V3RouteOfAdministration._INTERAMENINGEALROUTE;
+    if ("_InterstitialRoute".equals(codeString))
+      return V3RouteOfAdministration._INTERSTITIALROUTE;
+    if ("_IntraabdominalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAABDOMINALROUTE;
+    if ("_IntraarterialRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAARTERIALROUTE;
+    if ("_IntraarticularRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAARTICULARROUTE;
+    if ("_IntrabronchialRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRABRONCHIALROUTE;
+    if ("_IntrabursalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRABURSALROUTE;
+    if ("_IntracardiacRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACARDIACROUTE;
+    if ("_IntracartilaginousRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACARTILAGINOUSROUTE;
+    if ("_IntracaudalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACAUDALROUTE;
+    if ("_IntracavernosalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACAVERNOSALROUTE;
+    if ("_IntracavitaryRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACAVITARYROUTE;
+    if ("_IntracerebralRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACEREBRALROUTE;
+    if ("_IntracervicalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACERVICALROUTE;
+    if ("_IntracisternalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACISTERNALROUTE;
+    if ("_IntracornealRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACORNEALROUTE;
+    if ("_IntracoronalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACORONALROUTE;
+    if ("_IntracoronaryRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACORONARYROUTE;
+    if ("_IntracorpusCavernosumRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRACORPUSCAVERNOSUMROUTE;
+    if ("_IntradermalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRADERMALROUTE;
+    if ("_IntradiscalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRADISCALROUTE;
+    if ("_IntraductalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRADUCTALROUTE;
+    if ("_IntraduodenalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRADUODENALROUTE;
+    if ("_IntraduralRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRADURALROUTE;
+    if ("_IntraepidermalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAEPIDERMALROUTE;
+    if ("_IntraepithelialRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAEPITHELIALROUTE;
+    if ("_IntraesophagealRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAESOPHAGEALROUTE;
+    if ("_IntragastricRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAGASTRICROUTE;
+    if ("_IntrailealRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAILEALROUTE;
+    if ("_IntralesionalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRALESIONALROUTE;
+    if ("_IntraluminalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRALUMINALROUTE;
+    if ("_IntralymphaticRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRALYMPHATICROUTE;
+    if ("_IntramedullaryRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAMEDULLARYROUTE;
+    if ("_IntramuscularRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAMUSCULARROUTE;
+    if ("_IntraocularRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAOCULARROUTE;
+    if ("_IntraosseousRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAOSSEOUSROUTE;
+    if ("_IntraovarianRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAOVARIANROUTE;
+    if ("_IntrapericardialRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAPERICARDIALROUTE;
+    if ("_IntraperitonealRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAPERITONEALROUTE;
+    if ("_IntrapleuralRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAPLEURALROUTE;
+    if ("_IntraprostaticRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAPROSTATICROUTE;
+    if ("_IntrapulmonaryRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAPULMONARYROUTE;
+    if ("_IntrasinalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRASINALROUTE;
+    if ("_IntraspinalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRASPINALROUTE;
+    if ("_IntrasternalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRASTERNALROUTE;
+    if ("_IntrasynovialRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRASYNOVIALROUTE;
+    if ("_IntratendinousRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRATENDINOUSROUTE;
+    if ("_IntratesticularRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRATESTICULARROUTE;
+    if ("_IntrathecalRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRATHECALROUTE;
+    if ("_IntrathoracicRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRATHORACICROUTE;
+    if ("_IntratrachealRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRATRACHEALROUTE;
+    if ("_IntratubularRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRATUBULARROUTE;
+    if ("_IntratumorRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRATUMORROUTE;
+    if ("_IntratympanicRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRATYMPANICROUTE;
+    if ("_IntrauterineRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAUTERINEROUTE;
+    if ("_IntravascularRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAVASCULARROUTE;
+    if ("_IntravenousRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAVENOUSROUTE;
+    if ("_IntraventricularRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAVENTRICULARROUTE;
+    if ("_IntravesicleRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAVESICLEROUTE;
+    if ("_IntravitrealRoute".equals(codeString))
+      return V3RouteOfAdministration._INTRAVITREALROUTE;
+    if ("_JejunumRoute".equals(codeString))
+      return V3RouteOfAdministration._JEJUNUMROUTE;
+    if ("_LacrimalPunctaRoute".equals(codeString))
+      return V3RouteOfAdministration._LACRIMALPUNCTAROUTE;
+    if ("_LaryngealRoute".equals(codeString))
+      return V3RouteOfAdministration._LARYNGEALROUTE;
+    if ("_LingualRoute".equals(codeString))
+      return V3RouteOfAdministration._LINGUALROUTE;
+    if ("_MucousMembraneRoute".equals(codeString))
+      return V3RouteOfAdministration._MUCOUSMEMBRANEROUTE;
+    if ("_NailRoute".equals(codeString))
+      return V3RouteOfAdministration._NAILROUTE;
+    if ("_NasalRoute".equals(codeString))
+      return V3RouteOfAdministration._NASALROUTE;
+    if ("_OphthalmicRoute".equals(codeString))
+      return V3RouteOfAdministration._OPHTHALMICROUTE;
+    if ("_OralRoute".equals(codeString))
+      return V3RouteOfAdministration._ORALROUTE;
+    if ("_OromucosalRoute".equals(codeString))
+      return V3RouteOfAdministration._OROMUCOSALROUTE;
+    if ("_OropharyngealRoute".equals(codeString))
+      return V3RouteOfAdministration._OROPHARYNGEALROUTE;
+    if ("_OticRoute".equals(codeString))
+      return V3RouteOfAdministration._OTICROUTE;
+    if ("_ParanasalSinusesRoute".equals(codeString))
+      return V3RouteOfAdministration._PARANASALSINUSESROUTE;
+    if ("_ParenteralRoute".equals(codeString))
+      return V3RouteOfAdministration._PARENTERALROUTE;
+    if ("_PerianalRoute".equals(codeString))
+      return V3RouteOfAdministration._PERIANALROUTE;
+    if ("_PeriarticularRoute".equals(codeString))
+      return V3RouteOfAdministration._PERIARTICULARROUTE;
+    if ("_PeriduralRoute".equals(codeString))
+      return V3RouteOfAdministration._PERIDURALROUTE;
+    if ("_PerinealRoute".equals(codeString))
+      return V3RouteOfAdministration._PERINEALROUTE;
+    if ("_PerineuralRoute".equals(codeString))
+      return V3RouteOfAdministration._PERINEURALROUTE;
+    if ("_PeriodontalRoute".equals(codeString))
+      return V3RouteOfAdministration._PERIODONTALROUTE;
+    if ("_PulmonaryRoute".equals(codeString))
+      return V3RouteOfAdministration._PULMONARYROUTE;
+    if ("_RectalRoute".equals(codeString))
+      return V3RouteOfAdministration._RECTALROUTE;
+    if ("_RespiratoryTractRoute".equals(codeString))
+      return V3RouteOfAdministration._RESPIRATORYTRACTROUTE;
+    if ("_RetrobulbarRoute".equals(codeString))
+      return V3RouteOfAdministration._RETROBULBARROUTE;
+    if ("_ScalpRoute".equals(codeString))
+      return V3RouteOfAdministration._SCALPROUTE;
+    if ("_SinusUnspecifiedRoute".equals(codeString))
+      return V3RouteOfAdministration._SINUSUNSPECIFIEDROUTE;
+    if ("_SkinRoute".equals(codeString))
+      return V3RouteOfAdministration._SKINROUTE;
+    if ("_SoftTissueRoute".equals(codeString))
+      return V3RouteOfAdministration._SOFTTISSUEROUTE;
+    if ("_SubarachnoidRoute".equals(codeString))
+      return V3RouteOfAdministration._SUBARACHNOIDROUTE;
+    if ("_SubconjunctivalRoute".equals(codeString))
+      return V3RouteOfAdministration._SUBCONJUNCTIVALROUTE;
+    if ("_SubcutaneousRoute".equals(codeString))
+      return V3RouteOfAdministration._SUBCUTANEOUSROUTE;
+    if ("_SublesionalRoute".equals(codeString))
+      return V3RouteOfAdministration._SUBLESIONALROUTE;
+    if ("_SublingualRoute".equals(codeString))
+      return V3RouteOfAdministration._SUBLINGUALROUTE;
+    if ("_SubmucosalRoute".equals(codeString))
+      return V3RouteOfAdministration._SUBMUCOSALROUTE;
+    if ("_TracheostomyRoute".equals(codeString))
+      return V3RouteOfAdministration._TRACHEOSTOMYROUTE;
+    if ("_TransmucosalRoute".equals(codeString))
+      return V3RouteOfAdministration._TRANSMUCOSALROUTE;
+    if ("_TransplacentalRoute".equals(codeString))
+      return V3RouteOfAdministration._TRANSPLACENTALROUTE;
+    if ("_TranstrachealRoute".equals(codeString))
+      return V3RouteOfAdministration._TRANSTRACHEALROUTE;
+    if ("_TranstympanicRoute".equals(codeString))
+      return V3RouteOfAdministration._TRANSTYMPANICROUTE;
+    if ("_UreteralRoute".equals(codeString))
+      return V3RouteOfAdministration._URETERALROUTE;
+    if ("_UrethralRoute".equals(codeString))
+      return V3RouteOfAdministration._URETHRALROUTE;
+    if ("_UrinaryBladderRoute".equals(codeString))
+      return V3RouteOfAdministration._URINARYBLADDERROUTE;
+    if ("_UrinaryTractRoute".equals(codeString))
+      return V3RouteOfAdministration._URINARYTRACTROUTE;
+    if ("_VaginalRoute".equals(codeString))
+      return V3RouteOfAdministration._VAGINALROUTE;
+    if ("_VitreousHumourRoute".equals(codeString))
+      return V3RouteOfAdministration._VITREOUSHUMOURROUTE;
+    throw new IllegalArgumentException("Unknown V3RouteOfAdministration code '"+codeString+"'");
+  }
+
+  public String toCode(V3RouteOfAdministration code) {
+    if (code == V3RouteOfAdministration._ROUTEBYMETHOD)
+      return "_RouteByMethod";
+    if (code == V3RouteOfAdministration.SOAK)
+      return "SOAK";
+    if (code == V3RouteOfAdministration.SHAMPOO)
+      return "SHAMPOO";
+    if (code == V3RouteOfAdministration.TRNSLING)
+      return "TRNSLING";
+    if (code == V3RouteOfAdministration.PO)
+      return "PO";
+    if (code == V3RouteOfAdministration.GARGLE)
+      return "GARGLE";
+    if (code == V3RouteOfAdministration.SUCK)
+      return "SUCK";
+    if (code == V3RouteOfAdministration._CHEW)
+      return "_Chew";
+    if (code == V3RouteOfAdministration.CHEW)
+      return "CHEW";
+    if (code == V3RouteOfAdministration._DIFFUSION)
+      return "_Diffusion";
+    if (code == V3RouteOfAdministration.EXTCORPDIF)
+      return "EXTCORPDIF";
+    if (code == V3RouteOfAdministration.HEMODIFF)
+      return "HEMODIFF";
+    if (code == V3RouteOfAdministration.TRNSDERMD)
+      return "TRNSDERMD";
+    if (code == V3RouteOfAdministration._DISSOLVE)
+      return "_Dissolve";
+    if (code == V3RouteOfAdministration.DISSOLVE)
+      return "DISSOLVE";
+    if (code == V3RouteOfAdministration.SL)
+      return "SL";
+    if (code == V3RouteOfAdministration._DOUCHE)
+      return "_Douche";
+    if (code == V3RouteOfAdministration.DOUCHE)
+      return "DOUCHE";
+    if (code == V3RouteOfAdministration._ELECTROOSMOSISROUTE)
+      return "_ElectroOsmosisRoute";
+    if (code == V3RouteOfAdministration.ELECTOSMOS)
+      return "ELECTOSMOS";
+    if (code == V3RouteOfAdministration._ENEMA)
+      return "_Enema";
+    if (code == V3RouteOfAdministration.ENEMA)
+      return "ENEMA";
+    if (code == V3RouteOfAdministration.RETENEMA)
+      return "RETENEMA";
+    if (code == V3RouteOfAdministration._FLUSH)
+      return "_Flush";
+    if (code == V3RouteOfAdministration.IVFLUSH)
+      return "IVFLUSH";
+    if (code == V3RouteOfAdministration._IMPLANTATION)
+      return "_Implantation";
+    if (code == V3RouteOfAdministration.IDIMPLNT)
+      return "IDIMPLNT";
+    if (code == V3RouteOfAdministration.IVITIMPLNT)
+      return "IVITIMPLNT";
+    if (code == V3RouteOfAdministration.SQIMPLNT)
+      return "SQIMPLNT";
+    if (code == V3RouteOfAdministration._INFUSION)
+      return "_Infusion";
+    if (code == V3RouteOfAdministration.EPI)
+      return "EPI";
+    if (code == V3RouteOfAdministration.IA)
+      return "IA";
+    if (code == V3RouteOfAdministration.IC)
+      return "IC";
+    if (code == V3RouteOfAdministration.ICOR)
+      return "ICOR";
+    if (code == V3RouteOfAdministration.IOSSC)
+      return "IOSSC";
+    if (code == V3RouteOfAdministration.IT)
+      return "IT";
+    if (code == V3RouteOfAdministration.IV)
+      return "IV";
+    if (code == V3RouteOfAdministration.IVC)
+      return "IVC";
+    if (code == V3RouteOfAdministration.IVCC)
+      return "IVCC";
+    if (code == V3RouteOfAdministration.IVCI)
+      return "IVCI";
+    if (code == V3RouteOfAdministration.PCA)
+      return "PCA";
+    if (code == V3RouteOfAdministration.IVASCINFUS)
+      return "IVASCINFUS";
+    if (code == V3RouteOfAdministration.SQINFUS)
+      return "SQINFUS";
+    if (code == V3RouteOfAdministration._INHALATION)
+      return "_Inhalation";
+    if (code == V3RouteOfAdministration.IPINHL)
+      return "IPINHL";
+    if (code == V3RouteOfAdministration.ORIFINHL)
+      return "ORIFINHL";
+    if (code == V3RouteOfAdministration.REBREATH)
+      return "REBREATH";
+    if (code == V3RouteOfAdministration.IPPB)
+      return "IPPB";
+    if (code == V3RouteOfAdministration.NASINHL)
+      return "NASINHL";
+    if (code == V3RouteOfAdministration.NASINHLC)
+      return "NASINHLC";
+    if (code == V3RouteOfAdministration.NEB)
+      return "NEB";
+    if (code == V3RouteOfAdministration.NASNEB)
+      return "NASNEB";
+    if (code == V3RouteOfAdministration.ORNEB)
+      return "ORNEB";
+    if (code == V3RouteOfAdministration.TRACH)
+      return "TRACH";
+    if (code == V3RouteOfAdministration.VENT)
+      return "VENT";
+    if (code == V3RouteOfAdministration.VENTMASK)
+      return "VENTMASK";
+    if (code == V3RouteOfAdministration._INJECTION)
+      return "_Injection";
+    if (code == V3RouteOfAdministration.AMNINJ)
+      return "AMNINJ";
+    if (code == V3RouteOfAdministration.BILINJ)
+      return "BILINJ";
+    if (code == V3RouteOfAdministration.CHOLINJ)
+      return "CHOLINJ";
+    if (code == V3RouteOfAdministration.CERVINJ)
+      return "CERVINJ";
+    if (code == V3RouteOfAdministration.EPIDURINJ)
+      return "EPIDURINJ";
+    if (code == V3RouteOfAdministration.EPIINJ)
+      return "EPIINJ";
+    if (code == V3RouteOfAdministration.EPINJSP)
+      return "EPINJSP";
+    if (code == V3RouteOfAdministration.EXTRAMNINJ)
+      return "EXTRAMNINJ";
+    if (code == V3RouteOfAdministration.EXTCORPINJ)
+      return "EXTCORPINJ";
+    if (code == V3RouteOfAdministration.GBINJ)
+      return "GBINJ";
+    if (code == V3RouteOfAdministration.GINGINJ)
+      return "GINGINJ";
+    if (code == V3RouteOfAdministration.BLADINJ)
+      return "BLADINJ";
+    if (code == V3RouteOfAdministration.ENDOSININJ)
+      return "ENDOSININJ";
+    if (code == V3RouteOfAdministration.HEMOPORT)
+      return "HEMOPORT";
+    if (code == V3RouteOfAdministration.IABDINJ)
+      return "IABDINJ";
+    if (code == V3RouteOfAdministration.IAINJ)
+      return "IAINJ";
+    if (code == V3RouteOfAdministration.IAINJP)
+      return "IAINJP";
+    if (code == V3RouteOfAdministration.IAINJSP)
+      return "IAINJSP";
+    if (code == V3RouteOfAdministration.IARTINJ)
+      return "IARTINJ";
+    if (code == V3RouteOfAdministration.IBURSINJ)
+      return "IBURSINJ";
+    if (code == V3RouteOfAdministration.ICARDINJ)
+      return "ICARDINJ";
+    if (code == V3RouteOfAdministration.ICARDINJRP)
+      return "ICARDINJRP";
+    if (code == V3RouteOfAdministration.ICARDINJSP)
+      return "ICARDINJSP";
+    if (code == V3RouteOfAdministration.ICARINJP)
+      return "ICARINJP";
+    if (code == V3RouteOfAdministration.ICARTINJ)
+      return "ICARTINJ";
+    if (code == V3RouteOfAdministration.ICAUDINJ)
+      return "ICAUDINJ";
+    if (code == V3RouteOfAdministration.ICAVINJ)
+      return "ICAVINJ";
+    if (code == V3RouteOfAdministration.ICAVITINJ)
+      return "ICAVITINJ";
+    if (code == V3RouteOfAdministration.ICEREBINJ)
+      return "ICEREBINJ";
+    if (code == V3RouteOfAdministration.ICISTERNINJ)
+      return "ICISTERNINJ";
+    if (code == V3RouteOfAdministration.ICORONINJ)
+      return "ICORONINJ";
+    if (code == V3RouteOfAdministration.ICORONINJP)
+      return "ICORONINJP";
+    if (code == V3RouteOfAdministration.ICORPCAVINJ)
+      return "ICORPCAVINJ";
+    if (code == V3RouteOfAdministration.IDINJ)
+      return "IDINJ";
+    if (code == V3RouteOfAdministration.IDISCINJ)
+      return "IDISCINJ";
+    if (code == V3RouteOfAdministration.IDUCTINJ)
+      return "IDUCTINJ";
+    if (code == V3RouteOfAdministration.IDURINJ)
+      return "IDURINJ";
+    if (code == V3RouteOfAdministration.IEPIDINJ)
+      return "IEPIDINJ";
+    if (code == V3RouteOfAdministration.IEPITHINJ)
+      return "IEPITHINJ";
+    if (code == V3RouteOfAdministration.ILESINJ)
+      return "ILESINJ";
+    if (code == V3RouteOfAdministration.ILUMINJ)
+      return "ILUMINJ";
+    if (code == V3RouteOfAdministration.ILYMPJINJ)
+      return "ILYMPJINJ";
+    if (code == V3RouteOfAdministration.IM)
+      return "IM";
+    if (code == V3RouteOfAdministration.IMD)
+      return "IMD";
+    if (code == V3RouteOfAdministration.IMZ)
+      return "IMZ";
+    if (code == V3RouteOfAdministration.IMEDULINJ)
+      return "IMEDULINJ";
+    if (code == V3RouteOfAdministration.INTERMENINJ)
+      return "INTERMENINJ";
+    if (code == V3RouteOfAdministration.INTERSTITINJ)
+      return "INTERSTITINJ";
+    if (code == V3RouteOfAdministration.IOINJ)
+      return "IOINJ";
+    if (code == V3RouteOfAdministration.IOSSINJ)
+      return "IOSSINJ";
+    if (code == V3RouteOfAdministration.IOVARINJ)
+      return "IOVARINJ";
+    if (code == V3RouteOfAdministration.IPCARDINJ)
+      return "IPCARDINJ";
+    if (code == V3RouteOfAdministration.IPERINJ)
+      return "IPERINJ";
+    if (code == V3RouteOfAdministration.IPINJ)
+      return "IPINJ";
+    if (code == V3RouteOfAdministration.IPLRINJ)
+      return "IPLRINJ";
+    if (code == V3RouteOfAdministration.IPROSTINJ)
+      return "IPROSTINJ";
+    if (code == V3RouteOfAdministration.IPUMPINJ)
+      return "IPUMPINJ";
+    if (code == V3RouteOfAdministration.ISINJ)
+      return "ISINJ";
+    if (code == V3RouteOfAdministration.ISTERINJ)
+      return "ISTERINJ";
+    if (code == V3RouteOfAdministration.ISYNINJ)
+      return "ISYNINJ";
+    if (code == V3RouteOfAdministration.ITENDINJ)
+      return "ITENDINJ";
+    if (code == V3RouteOfAdministration.ITESTINJ)
+      return "ITESTINJ";
+    if (code == V3RouteOfAdministration.ITHORINJ)
+      return "ITHORINJ";
+    if (code == V3RouteOfAdministration.ITINJ)
+      return "ITINJ";
+    if (code == V3RouteOfAdministration.ITUBINJ)
+      return "ITUBINJ";
+    if (code == V3RouteOfAdministration.ITUMINJ)
+      return "ITUMINJ";
+    if (code == V3RouteOfAdministration.ITYMPINJ)
+      return "ITYMPINJ";
+    if (code == V3RouteOfAdministration.IUINJ)
+      return "IUINJ";
+    if (code == V3RouteOfAdministration.IUINJC)
+      return "IUINJC";
+    if (code == V3RouteOfAdministration.IURETINJ)
+      return "IURETINJ";
+    if (code == V3RouteOfAdministration.IVASCINJ)
+      return "IVASCINJ";
+    if (code == V3RouteOfAdministration.IVENTINJ)
+      return "IVENTINJ";
+    if (code == V3RouteOfAdministration.IVESINJ)
+      return "IVESINJ";
+    if (code == V3RouteOfAdministration.IVINJ)
+      return "IVINJ";
+    if (code == V3RouteOfAdministration.IVINJBOL)
+      return "IVINJBOL";
+    if (code == V3RouteOfAdministration.IVPUSH)
+      return "IVPUSH";
+    if (code == V3RouteOfAdministration.IVRPUSH)
+      return "IVRPUSH";
+    if (code == V3RouteOfAdministration.IVSPUSH)
+      return "IVSPUSH";
+    if (code == V3RouteOfAdministration.IVITINJ)
+      return "IVITINJ";
+    if (code == V3RouteOfAdministration.PAINJ)
+      return "PAINJ";
+    if (code == V3RouteOfAdministration.PARENTINJ)
+      return "PARENTINJ";
+    if (code == V3RouteOfAdministration.PDONTINJ)
+      return "PDONTINJ";
+    if (code == V3RouteOfAdministration.PDPINJ)
+      return "PDPINJ";
+    if (code == V3RouteOfAdministration.PDURINJ)
+      return "PDURINJ";
+    if (code == V3RouteOfAdministration.PNINJ)
+      return "PNINJ";
+    if (code == V3RouteOfAdministration.PNSINJ)
+      return "PNSINJ";
+    if (code == V3RouteOfAdministration.RBINJ)
+      return "RBINJ";
+    if (code == V3RouteOfAdministration.SCINJ)
+      return "SCINJ";
+    if (code == V3RouteOfAdministration.SLESINJ)
+      return "SLESINJ";
+    if (code == V3RouteOfAdministration.SOFTISINJ)
+      return "SOFTISINJ";
+    if (code == V3RouteOfAdministration.SQ)
+      return "SQ";
+    if (code == V3RouteOfAdministration.SUBARACHINJ)
+      return "SUBARACHINJ";
+    if (code == V3RouteOfAdministration.SUBMUCINJ)
+      return "SUBMUCINJ";
+    if (code == V3RouteOfAdministration.TRPLACINJ)
+      return "TRPLACINJ";
+    if (code == V3RouteOfAdministration.TRTRACHINJ)
+      return "TRTRACHINJ";
+    if (code == V3RouteOfAdministration.URETHINJ)
+      return "URETHINJ";
+    if (code == V3RouteOfAdministration.URETINJ)
+      return "URETINJ";
+    if (code == V3RouteOfAdministration._INSERTION)
+      return "_Insertion";
+    if (code == V3RouteOfAdministration.CERVINS)
+      return "CERVINS";
+    if (code == V3RouteOfAdministration.IOSURGINS)
+      return "IOSURGINS";
+    if (code == V3RouteOfAdministration.IU)
+      return "IU";
+    if (code == V3RouteOfAdministration.LPINS)
+      return "LPINS";
+    if (code == V3RouteOfAdministration.PR)
+      return "PR";
+    if (code == V3RouteOfAdministration.SQSURGINS)
+      return "SQSURGINS";
+    if (code == V3RouteOfAdministration.URETHINS)
+      return "URETHINS";
+    if (code == V3RouteOfAdministration.VAGINSI)
+      return "VAGINSI";
+    if (code == V3RouteOfAdministration._INSTILLATION)
+      return "_Instillation";
+    if (code == V3RouteOfAdministration.CECINSTL)
+      return "CECINSTL";
+    if (code == V3RouteOfAdministration.EFT)
+      return "EFT";
+    if (code == V3RouteOfAdministration.ENTINSTL)
+      return "ENTINSTL";
+    if (code == V3RouteOfAdministration.GT)
+      return "GT";
+    if (code == V3RouteOfAdministration.NGT)
+      return "NGT";
+    if (code == V3RouteOfAdministration.OGT)
+      return "OGT";
+    if (code == V3RouteOfAdministration.BLADINSTL)
+      return "BLADINSTL";
+    if (code == V3RouteOfAdministration.CAPDINSTL)
+      return "CAPDINSTL";
+    if (code == V3RouteOfAdministration.CTINSTL)
+      return "CTINSTL";
+    if (code == V3RouteOfAdministration.ETINSTL)
+      return "ETINSTL";
+    if (code == V3RouteOfAdministration.GJT)
+      return "GJT";
+    if (code == V3RouteOfAdministration.IBRONCHINSTIL)
+      return "IBRONCHINSTIL";
+    if (code == V3RouteOfAdministration.IDUODINSTIL)
+      return "IDUODINSTIL";
+    if (code == V3RouteOfAdministration.IESOPHINSTIL)
+      return "IESOPHINSTIL";
+    if (code == V3RouteOfAdministration.IGASTINSTIL)
+      return "IGASTINSTIL";
+    if (code == V3RouteOfAdministration.IILEALINJ)
+      return "IILEALINJ";
+    if (code == V3RouteOfAdministration.IOINSTL)
+      return "IOINSTL";
+    if (code == V3RouteOfAdministration.ISININSTIL)
+      return "ISININSTIL";
+    if (code == V3RouteOfAdministration.ITRACHINSTIL)
+      return "ITRACHINSTIL";
+    if (code == V3RouteOfAdministration.IUINSTL)
+      return "IUINSTL";
+    if (code == V3RouteOfAdministration.JJTINSTL)
+      return "JJTINSTL";
+    if (code == V3RouteOfAdministration.LARYNGINSTIL)
+      return "LARYNGINSTIL";
+    if (code == V3RouteOfAdministration.NASALINSTIL)
+      return "NASALINSTIL";
+    if (code == V3RouteOfAdministration.NASOGASINSTIL)
+      return "NASOGASINSTIL";
+    if (code == V3RouteOfAdministration.NTT)
+      return "NTT";
+    if (code == V3RouteOfAdministration.OJJ)
+      return "OJJ";
+    if (code == V3RouteOfAdministration.OT)
+      return "OT";
+    if (code == V3RouteOfAdministration.PDPINSTL)
+      return "PDPINSTL";
+    if (code == V3RouteOfAdministration.PNSINSTL)
+      return "PNSINSTL";
+    if (code == V3RouteOfAdministration.RECINSTL)
+      return "RECINSTL";
+    if (code == V3RouteOfAdministration.RECTINSTL)
+      return "RECTINSTL";
+    if (code == V3RouteOfAdministration.SININSTIL)
+      return "SININSTIL";
+    if (code == V3RouteOfAdministration.SOFTISINSTIL)
+      return "SOFTISINSTIL";
+    if (code == V3RouteOfAdministration.TRACHINSTL)
+      return "TRACHINSTL";
+    if (code == V3RouteOfAdministration.TRTYMPINSTIL)
+      return "TRTYMPINSTIL";
+    if (code == V3RouteOfAdministration.URETHINSTL)
+      return "URETHINSTL";
+    if (code == V3RouteOfAdministration._IONTOPHORESISROUTE)
+      return "_IontophoresisRoute";
+    if (code == V3RouteOfAdministration.IONTO)
+      return "IONTO";
+    if (code == V3RouteOfAdministration._IRRIGATION)
+      return "_Irrigation";
+    if (code == V3RouteOfAdministration.GUIRR)
+      return "GUIRR";
+    if (code == V3RouteOfAdministration.IGASTIRR)
+      return "IGASTIRR";
+    if (code == V3RouteOfAdministration.ILESIRR)
+      return "ILESIRR";
+    if (code == V3RouteOfAdministration.IOIRR)
+      return "IOIRR";
+    if (code == V3RouteOfAdministration.BLADIRR)
+      return "BLADIRR";
+    if (code == V3RouteOfAdministration.BLADIRRC)
+      return "BLADIRRC";
+    if (code == V3RouteOfAdministration.BLADIRRT)
+      return "BLADIRRT";
+    if (code == V3RouteOfAdministration.RECIRR)
+      return "RECIRR";
+    if (code == V3RouteOfAdministration._LAVAGEROUTE)
+      return "_LavageRoute";
+    if (code == V3RouteOfAdministration.IGASTLAV)
+      return "IGASTLAV";
+    if (code == V3RouteOfAdministration._MUCOSALABSORPTIONROUTE)
+      return "_MucosalAbsorptionRoute";
+    if (code == V3RouteOfAdministration.IDOUDMAB)
+      return "IDOUDMAB";
+    if (code == V3RouteOfAdministration.ITRACHMAB)
+      return "ITRACHMAB";
+    if (code == V3RouteOfAdministration.SMUCMAB)
+      return "SMUCMAB";
+    if (code == V3RouteOfAdministration._NEBULIZATION)
+      return "_Nebulization";
+    if (code == V3RouteOfAdministration.ETNEB)
+      return "ETNEB";
+    if (code == V3RouteOfAdministration._RINSE)
+      return "_Rinse";
+    if (code == V3RouteOfAdministration.DENRINSE)
+      return "DENRINSE";
+    if (code == V3RouteOfAdministration.ORRINSE)
+      return "ORRINSE";
+    if (code == V3RouteOfAdministration._SUPPOSITORYROUTE)
+      return "_SuppositoryRoute";
+    if (code == V3RouteOfAdministration.URETHSUP)
+      return "URETHSUP";
+    if (code == V3RouteOfAdministration._SWISH)
+      return "_Swish";
+    if (code == V3RouteOfAdministration.SWISHSPIT)
+      return "SWISHSPIT";
+    if (code == V3RouteOfAdministration.SWISHSWAL)
+      return "SWISHSWAL";
+    if (code == V3RouteOfAdministration._TOPICALABSORPTIONROUTE)
+      return "_TopicalAbsorptionRoute";
+    if (code == V3RouteOfAdministration.TTYMPTABSORP)
+      return "TTYMPTABSORP";
+    if (code == V3RouteOfAdministration._TOPICALAPPLICATION)
+      return "_TopicalApplication";
+    if (code == V3RouteOfAdministration.DRESS)
+      return "DRESS";
+    if (code == V3RouteOfAdministration.SWAB)
+      return "SWAB";
+    if (code == V3RouteOfAdministration.TOPICAL)
+      return "TOPICAL";
+    if (code == V3RouteOfAdministration.BUC)
+      return "BUC";
+    if (code == V3RouteOfAdministration.CERV)
+      return "CERV";
+    if (code == V3RouteOfAdministration.DEN)
+      return "DEN";
+    if (code == V3RouteOfAdministration.GIN)
+      return "GIN";
+    if (code == V3RouteOfAdministration.HAIR)
+      return "HAIR";
+    if (code == V3RouteOfAdministration.ICORNTA)
+      return "ICORNTA";
+    if (code == V3RouteOfAdministration.ICORONTA)
+      return "ICORONTA";
+    if (code == V3RouteOfAdministration.IESOPHTA)
+      return "IESOPHTA";
+    if (code == V3RouteOfAdministration.IILEALTA)
+      return "IILEALTA";
+    if (code == V3RouteOfAdministration.ILTOP)
+      return "ILTOP";
+    if (code == V3RouteOfAdministration.ILUMTA)
+      return "ILUMTA";
+    if (code == V3RouteOfAdministration.IOTOP)
+      return "IOTOP";
+    if (code == V3RouteOfAdministration.LARYNGTA)
+      return "LARYNGTA";
+    if (code == V3RouteOfAdministration.MUC)
+      return "MUC";
+    if (code == V3RouteOfAdministration.NAIL)
+      return "NAIL";
+    if (code == V3RouteOfAdministration.NASAL)
+      return "NASAL";
+    if (code == V3RouteOfAdministration.OPTHALTA)
+      return "OPTHALTA";
+    if (code == V3RouteOfAdministration.ORALTA)
+      return "ORALTA";
+    if (code == V3RouteOfAdministration.ORMUC)
+      return "ORMUC";
+    if (code == V3RouteOfAdministration.OROPHARTA)
+      return "OROPHARTA";
+    if (code == V3RouteOfAdministration.PERIANAL)
+      return "PERIANAL";
+    if (code == V3RouteOfAdministration.PERINEAL)
+      return "PERINEAL";
+    if (code == V3RouteOfAdministration.PDONTTA)
+      return "PDONTTA";
+    if (code == V3RouteOfAdministration.RECTAL)
+      return "RECTAL";
+    if (code == V3RouteOfAdministration.SCALP)
+      return "SCALP";
+    if (code == V3RouteOfAdministration.OCDRESTA)
+      return "OCDRESTA";
+    if (code == V3RouteOfAdministration.SKIN)
+      return "SKIN";
+    if (code == V3RouteOfAdministration.SUBCONJTA)
+      return "SUBCONJTA";
+    if (code == V3RouteOfAdministration.TMUCTA)
+      return "TMUCTA";
+    if (code == V3RouteOfAdministration.VAGINS)
+      return "VAGINS";
+    if (code == V3RouteOfAdministration.INSUF)
+      return "INSUF";
+    if (code == V3RouteOfAdministration.TRNSDERM)
+      return "TRNSDERM";
+    if (code == V3RouteOfAdministration._ROUTEBYSITE)
+      return "_RouteBySite";
+    if (code == V3RouteOfAdministration._AMNIOTICFLUIDSACROUTE)
+      return "_AmnioticFluidSacRoute";
+    if (code == V3RouteOfAdministration._BILIARYROUTE)
+      return "_BiliaryRoute";
+    if (code == V3RouteOfAdministration._BODYSURFACEROUTE)
+      return "_BodySurfaceRoute";
+    if (code == V3RouteOfAdministration._BUCCALMUCOSAROUTE)
+      return "_BuccalMucosaRoute";
+    if (code == V3RouteOfAdministration._CECOSTOMYROUTE)
+      return "_CecostomyRoute";
+    if (code == V3RouteOfAdministration._CERVICALROUTE)
+      return "_CervicalRoute";
+    if (code == V3RouteOfAdministration._ENDOCERVICALROUTE)
+      return "_EndocervicalRoute";
+    if (code == V3RouteOfAdministration._ENTERALROUTE)
+      return "_EnteralRoute";
+    if (code == V3RouteOfAdministration._EPIDURALROUTE)
+      return "_EpiduralRoute";
+    if (code == V3RouteOfAdministration._EXTRAAMNIOTICROUTE)
+      return "_ExtraAmnioticRoute";
+    if (code == V3RouteOfAdministration._EXTRACORPOREALCIRCULATIONROUTE)
+      return "_ExtracorporealCirculationRoute";
+    if (code == V3RouteOfAdministration._GASTRICROUTE)
+      return "_GastricRoute";
+    if (code == V3RouteOfAdministration._GENITOURINARYROUTE)
+      return "_GenitourinaryRoute";
+    if (code == V3RouteOfAdministration._GINGIVALROUTE)
+      return "_GingivalRoute";
+    if (code == V3RouteOfAdministration._HAIRROUTE)
+      return "_HairRoute";
+    if (code == V3RouteOfAdministration._INTERAMENINGEALROUTE)
+      return "_InterameningealRoute";
+    if (code == V3RouteOfAdministration._INTERSTITIALROUTE)
+      return "_InterstitialRoute";
+    if (code == V3RouteOfAdministration._INTRAABDOMINALROUTE)
+      return "_IntraabdominalRoute";
+    if (code == V3RouteOfAdministration._INTRAARTERIALROUTE)
+      return "_IntraarterialRoute";
+    if (code == V3RouteOfAdministration._INTRAARTICULARROUTE)
+      return "_IntraarticularRoute";
+    if (code == V3RouteOfAdministration._INTRABRONCHIALROUTE)
+      return "_IntrabronchialRoute";
+    if (code == V3RouteOfAdministration._INTRABURSALROUTE)
+      return "_IntrabursalRoute";
+    if (code == V3RouteOfAdministration._INTRACARDIACROUTE)
+      return "_IntracardiacRoute";
+    if (code == V3RouteOfAdministration._INTRACARTILAGINOUSROUTE)
+      return "_IntracartilaginousRoute";
+    if (code == V3RouteOfAdministration._INTRACAUDALROUTE)
+      return "_IntracaudalRoute";
+    if (code == V3RouteOfAdministration._INTRACAVERNOSALROUTE)
+      return "_IntracavernosalRoute";
+    if (code == V3RouteOfAdministration._INTRACAVITARYROUTE)
+      return "_IntracavitaryRoute";
+    if (code == V3RouteOfAdministration._INTRACEREBRALROUTE)
+      return "_IntracerebralRoute";
+    if (code == V3RouteOfAdministration._INTRACERVICALROUTE)
+      return "_IntracervicalRoute";
+    if (code == V3RouteOfAdministration._INTRACISTERNALROUTE)
+      return "_IntracisternalRoute";
+    if (code == V3RouteOfAdministration._INTRACORNEALROUTE)
+      return "_IntracornealRoute";
+    if (code == V3RouteOfAdministration._INTRACORONALROUTE)
+      return "_IntracoronalRoute";
+    if (code == V3RouteOfAdministration._INTRACORONARYROUTE)
+      return "_IntracoronaryRoute";
+    if (code == V3RouteOfAdministration._INTRACORPUSCAVERNOSUMROUTE)
+      return "_IntracorpusCavernosumRoute";
+    if (code == V3RouteOfAdministration._INTRADERMALROUTE)
+      return "_IntradermalRoute";
+    if (code == V3RouteOfAdministration._INTRADISCALROUTE)
+      return "_IntradiscalRoute";
+    if (code == V3RouteOfAdministration._INTRADUCTALROUTE)
+      return "_IntraductalRoute";
+    if (code == V3RouteOfAdministration._INTRADUODENALROUTE)
+      return "_IntraduodenalRoute";
+    if (code == V3RouteOfAdministration._INTRADURALROUTE)
+      return "_IntraduralRoute";
+    if (code == V3RouteOfAdministration._INTRAEPIDERMALROUTE)
+      return "_IntraepidermalRoute";
+    if (code == V3RouteOfAdministration._INTRAEPITHELIALROUTE)
+      return "_IntraepithelialRoute";
+    if (code == V3RouteOfAdministration._INTRAESOPHAGEALROUTE)
+      return "_IntraesophagealRoute";
+    if (code == V3RouteOfAdministration._INTRAGASTRICROUTE)
+      return "_IntragastricRoute";
+    if (code == V3RouteOfAdministration._INTRAILEALROUTE)
+      return "_IntrailealRoute";
+    if (code == V3RouteOfAdministration._INTRALESIONALROUTE)
+      return "_IntralesionalRoute";
+    if (code == V3RouteOfAdministration._INTRALUMINALROUTE)
+      return "_IntraluminalRoute";
+    if (code == V3RouteOfAdministration._INTRALYMPHATICROUTE)
+      return "_IntralymphaticRoute";
+    if (code == V3RouteOfAdministration._INTRAMEDULLARYROUTE)
+      return "_IntramedullaryRoute";
+    if (code == V3RouteOfAdministration._INTRAMUSCULARROUTE)
+      return "_IntramuscularRoute";
+    if (code == V3RouteOfAdministration._INTRAOCULARROUTE)
+      return "_IntraocularRoute";
+    if (code == V3RouteOfAdministration._INTRAOSSEOUSROUTE)
+      return "_IntraosseousRoute";
+    if (code == V3RouteOfAdministration._INTRAOVARIANROUTE)
+      return "_IntraovarianRoute";
+    if (code == V3RouteOfAdministration._INTRAPERICARDIALROUTE)
+      return "_IntrapericardialRoute";
+    if (code == V3RouteOfAdministration._INTRAPERITONEALROUTE)
+      return "_IntraperitonealRoute";
+    if (code == V3RouteOfAdministration._INTRAPLEURALROUTE)
+      return "_IntrapleuralRoute";
+    if (code == V3RouteOfAdministration._INTRAPROSTATICROUTE)
+      return "_IntraprostaticRoute";
+    if (code == V3RouteOfAdministration._INTRAPULMONARYROUTE)
+      return "_IntrapulmonaryRoute";
+    if (code == V3RouteOfAdministration._INTRASINALROUTE)
+      return "_IntrasinalRoute";
+    if (code == V3RouteOfAdministration._INTRASPINALROUTE)
+      return "_IntraspinalRoute";
+    if (code == V3RouteOfAdministration._INTRASTERNALROUTE)
+      return "_IntrasternalRoute";
+    if (code == V3RouteOfAdministration._INTRASYNOVIALROUTE)
+      return "_IntrasynovialRoute";
+    if (code == V3RouteOfAdministration._INTRATENDINOUSROUTE)
+      return "_IntratendinousRoute";
+    if (code == V3RouteOfAdministration._INTRATESTICULARROUTE)
+      return "_IntratesticularRoute";
+    if (code == V3RouteOfAdministration._INTRATHECALROUTE)
+      return "_IntrathecalRoute";
+    if (code == V3RouteOfAdministration._INTRATHORACICROUTE)
+      return "_IntrathoracicRoute";
+    if (code == V3RouteOfAdministration._INTRATRACHEALROUTE)
+      return "_IntratrachealRoute";
+    if (code == V3RouteOfAdministration._INTRATUBULARROUTE)
+      return "_IntratubularRoute";
+    if (code == V3RouteOfAdministration._INTRATUMORROUTE)
+      return "_IntratumorRoute";
+    if (code == V3RouteOfAdministration._INTRATYMPANICROUTE)
+      return "_IntratympanicRoute";
+    if (code == V3RouteOfAdministration._INTRAUTERINEROUTE)
+      return "_IntrauterineRoute";
+    if (code == V3RouteOfAdministration._INTRAVASCULARROUTE)
+      return "_IntravascularRoute";
+    if (code == V3RouteOfAdministration._INTRAVENOUSROUTE)
+      return "_IntravenousRoute";
+    if (code == V3RouteOfAdministration._INTRAVENTRICULARROUTE)
+      return "_IntraventricularRoute";
+    if (code == V3RouteOfAdministration._INTRAVESICLEROUTE)
+      return "_IntravesicleRoute";
+    if (code == V3RouteOfAdministration._INTRAVITREALROUTE)
+      return "_IntravitrealRoute";
+    if (code == V3RouteOfAdministration._JEJUNUMROUTE)
+      return "_JejunumRoute";
+    if (code == V3RouteOfAdministration._LACRIMALPUNCTAROUTE)
+      return "_LacrimalPunctaRoute";
+    if (code == V3RouteOfAdministration._LARYNGEALROUTE)
+      return "_LaryngealRoute";
+    if (code == V3RouteOfAdministration._LINGUALROUTE)
+      return "_LingualRoute";
+    if (code == V3RouteOfAdministration._MUCOUSMEMBRANEROUTE)
+      return "_MucousMembraneRoute";
+    if (code == V3RouteOfAdministration._NAILROUTE)
+      return "_NailRoute";
+    if (code == V3RouteOfAdministration._NASALROUTE)
+      return "_NasalRoute";
+    if (code == V3RouteOfAdministration._OPHTHALMICROUTE)
+      return "_OphthalmicRoute";
+    if (code == V3RouteOfAdministration._ORALROUTE)
+      return "_OralRoute";
+    if (code == V3RouteOfAdministration._OROMUCOSALROUTE)
+      return "_OromucosalRoute";
+    if (code == V3RouteOfAdministration._OROPHARYNGEALROUTE)
+      return "_OropharyngealRoute";
+    if (code == V3RouteOfAdministration._OTICROUTE)
+      return "_OticRoute";
+    if (code == V3RouteOfAdministration._PARANASALSINUSESROUTE)
+      return "_ParanasalSinusesRoute";
+    if (code == V3RouteOfAdministration._PARENTERALROUTE)
+      return "_ParenteralRoute";
+    if (code == V3RouteOfAdministration._PERIANALROUTE)
+      return "_PerianalRoute";
+    if (code == V3RouteOfAdministration._PERIARTICULARROUTE)
+      return "_PeriarticularRoute";
+    if (code == V3RouteOfAdministration._PERIDURALROUTE)
+      return "_PeriduralRoute";
+    if (code == V3RouteOfAdministration._PERINEALROUTE)
+      return "_PerinealRoute";
+    if (code == V3RouteOfAdministration._PERINEURALROUTE)
+      return "_PerineuralRoute";
+    if (code == V3RouteOfAdministration._PERIODONTALROUTE)
+      return "_PeriodontalRoute";
+    if (code == V3RouteOfAdministration._PULMONARYROUTE)
+      return "_PulmonaryRoute";
+    if (code == V3RouteOfAdministration._RECTALROUTE)
+      return "_RectalRoute";
+    if (code == V3RouteOfAdministration._RESPIRATORYTRACTROUTE)
+      return "_RespiratoryTractRoute";
+    if (code == V3RouteOfAdministration._RETROBULBARROUTE)
+      return "_RetrobulbarRoute";
+    if (code == V3RouteOfAdministration._SCALPROUTE)
+      return "_ScalpRoute";
+    if (code == V3RouteOfAdministration._SINUSUNSPECIFIEDROUTE)
+      return "_SinusUnspecifiedRoute";
+    if (code == V3RouteOfAdministration._SKINROUTE)
+      return "_SkinRoute";
+    if (code == V3RouteOfAdministration._SOFTTISSUEROUTE)
+      return "_SoftTissueRoute";
+    if (code == V3RouteOfAdministration._SUBARACHNOIDROUTE)
+      return "_SubarachnoidRoute";
+    if (code == V3RouteOfAdministration._SUBCONJUNCTIVALROUTE)
+      return "_SubconjunctivalRoute";
+    if (code == V3RouteOfAdministration._SUBCUTANEOUSROUTE)
+      return "_SubcutaneousRoute";
+    if (code == V3RouteOfAdministration._SUBLESIONALROUTE)
+      return "_SublesionalRoute";
+    if (code == V3RouteOfAdministration._SUBLINGUALROUTE)
+      return "_SublingualRoute";
+    if (code == V3RouteOfAdministration._SUBMUCOSALROUTE)
+      return "_SubmucosalRoute";
+    if (code == V3RouteOfAdministration._TRACHEOSTOMYROUTE)
+      return "_TracheostomyRoute";
+    if (code == V3RouteOfAdministration._TRANSMUCOSALROUTE)
+      return "_TransmucosalRoute";
+    if (code == V3RouteOfAdministration._TRANSPLACENTALROUTE)
+      return "_TransplacentalRoute";
+    if (code == V3RouteOfAdministration._TRANSTRACHEALROUTE)
+      return "_TranstrachealRoute";
+    if (code == V3RouteOfAdministration._TRANSTYMPANICROUTE)
+      return "_TranstympanicRoute";
+    if (code == V3RouteOfAdministration._URETERALROUTE)
+      return "_UreteralRoute";
+    if (code == V3RouteOfAdministration._URETHRALROUTE)
+      return "_UrethralRoute";
+    if (code == V3RouteOfAdministration._URINARYBLADDERROUTE)
+      return "_UrinaryBladderRoute";
+    if (code == V3RouteOfAdministration._URINARYTRACTROUTE)
+      return "_UrinaryTractRoute";
+    if (code == V3RouteOfAdministration._VAGINALROUTE)
+      return "_VaginalRoute";
+    if (code == V3RouteOfAdministration._VITREOUSHUMOURROUTE)
+      return "_VitreousHumourRoute";
+    return "?";
+  }
+
+    public String toSystem(V3RouteOfAdministration code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Sequencing.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Sequencing.java
new file mode 100644
index 00000000000..84845fc37c4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3Sequencing.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3Sequencing {
+
+        /**
+         * Ascending sequence order.
+         */
+        A, 
+        /**
+         * Descending sequence order.
+         */
+        D, 
+        /**
+         * No enforced sequence order.
+         */
+        N, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3Sequencing fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("A".equals(codeString))
+          return A;
+        if ("D".equals(codeString))
+          return D;
+        if ("N".equals(codeString))
+          return N;
+        throw new FHIRException("Unknown V3Sequencing code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case A: return "A";
+            case D: return "D";
+            case N: return "N";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/Sequencing";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case A: return "Ascending sequence order.";
+            case D: return "Descending sequence order.";
+            case N: return "No enforced sequence order.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case A: return "Ascending";
+            case D: return "Descending";
+            case N: return "None";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SequencingEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SequencingEnumFactory.java
new file mode 100644
index 00000000000..67f043e0b78
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SequencingEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3SequencingEnumFactory implements EnumFactory {
+
+  public V3Sequencing fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("A".equals(codeString))
+      return V3Sequencing.A;
+    if ("D".equals(codeString))
+      return V3Sequencing.D;
+    if ("N".equals(codeString))
+      return V3Sequencing.N;
+    throw new IllegalArgumentException("Unknown V3Sequencing code '"+codeString+"'");
+  }
+
+  public String toCode(V3Sequencing code) {
+    if (code == V3Sequencing.A)
+      return "A";
+    if (code == V3Sequencing.D)
+      return "D";
+    if (code == V3Sequencing.N)
+      return "N";
+    return "?";
+  }
+
+    public String toSystem(V3Sequencing code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SetOperator.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SetOperator.java
new file mode 100644
index 00000000000..9c2b0f2da30
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SetOperator.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3SetOperator {
+
+        /**
+         * Operations that can be used to associate concepts in a terminology.
+         */
+        _VALUESETOPERATOR, 
+        /**
+         * Form the set-difference with this value, i.e., exclude this element or set from the resulting set.
+         */
+        E, 
+        /**
+         * Form the union with this value, i.e., include this element or set in the resulting set.
+         */
+        I, 
+        /**
+         * Form the intersection with the value.
+         */
+        A, 
+        /**
+         * Form the convex hull with the value. The convex hull is defined over ordered domains and is the smallest contiguous superset (interval) that of all the operand sets.
+         */
+        H, 
+        /**
+         * Form the periodic hull with the value. The periodic hull is defined over ordered domains and is the periodic set that contains all contiguous supersets of pairs of intervals generated by the operand periodic intervals.
+         */
+        P, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3SetOperator fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ValueSetOperator".equals(codeString))
+          return _VALUESETOPERATOR;
+        if ("E".equals(codeString))
+          return E;
+        if ("I".equals(codeString))
+          return I;
+        if ("A".equals(codeString))
+          return A;
+        if ("H".equals(codeString))
+          return H;
+        if ("P".equals(codeString))
+          return P;
+        throw new FHIRException("Unknown V3SetOperator code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _VALUESETOPERATOR: return "_ValueSetOperator";
+            case E: return "E";
+            case I: return "I";
+            case A: return "A";
+            case H: return "H";
+            case P: return "P";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/SetOperator";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _VALUESETOPERATOR: return "Operations that can be used to associate concepts in a terminology.";
+            case E: return "Form the set-difference with this value, i.e., exclude this element or set from the resulting set.";
+            case I: return "Form the union with this value, i.e., include this element or set in the resulting set.";
+            case A: return "Form the intersection with the value.";
+            case H: return "Form the convex hull with the value. The convex hull is defined over ordered domains and is the smallest contiguous superset (interval) that of all the operand sets.";
+            case P: return "Form the periodic hull with the value. The periodic hull is defined over ordered domains and is the periodic set that contains all contiguous supersets of pairs of intervals generated by the operand periodic intervals.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _VALUESETOPERATOR: return "ValueSetOperator";
+            case E: return "exclude";
+            case I: return "include";
+            case A: return "intersect";
+            case H: return "convex hull";
+            case P: return "periodic hull";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SetOperatorEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SetOperatorEnumFactory.java
new file mode 100644
index 00000000000..37f4013eb7e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SetOperatorEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3SetOperatorEnumFactory implements EnumFactory {
+
+  public V3SetOperator fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ValueSetOperator".equals(codeString))
+      return V3SetOperator._VALUESETOPERATOR;
+    if ("E".equals(codeString))
+      return V3SetOperator.E;
+    if ("I".equals(codeString))
+      return V3SetOperator.I;
+    if ("A".equals(codeString))
+      return V3SetOperator.A;
+    if ("H".equals(codeString))
+      return V3SetOperator.H;
+    if ("P".equals(codeString))
+      return V3SetOperator.P;
+    throw new IllegalArgumentException("Unknown V3SetOperator code '"+codeString+"'");
+  }
+
+  public String toCode(V3SetOperator code) {
+    if (code == V3SetOperator._VALUESETOPERATOR)
+      return "_ValueSetOperator";
+    if (code == V3SetOperator.E)
+      return "E";
+    if (code == V3SetOperator.I)
+      return "I";
+    if (code == V3SetOperator.A)
+      return "A";
+    if (code == V3SetOperator.H)
+      return "H";
+    if (code == V3SetOperator.P)
+      return "P";
+    return "?";
+  }
+
+    public String toSystem(V3SetOperator code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SpecimenType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SpecimenType.java
new file mode 100644
index 00000000000..f521851e327
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SpecimenType.java
@@ -0,0 +1,1185 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3SpecimenType {
+
+        /**
+         * SpecimenEntityType
+         */
+        _SPECIMENENTITYTYPE, 
+        /**
+         * Abcess
+         */
+        ABS, 
+        /**
+         * Amniotic fluid
+         */
+        AMN, 
+        /**
+         * Aspirate
+         */
+        ASP, 
+        /**
+         * Blood bag
+         */
+        BBL, 
+        /**
+         * Whole body
+         */
+        BDY, 
+        /**
+         * Bile fluid
+         */
+        BIFL, 
+        /**
+         * Whole blood
+         */
+        BLD, 
+        /**
+         * Blood arterial
+         */
+        BLDA, 
+        /**
+         * Blood capillary
+         */
+        BLDC, 
+        /**
+         * Blood - cord
+         */
+        BLDCO, 
+        /**
+         * Blood venous
+         */
+        BLDV, 
+        /**
+         * Bone
+         */
+        BON, 
+        /**
+         * Basophils
+         */
+        BPH, 
+        /**
+         * Blood product unit
+         */
+        BPU, 
+        /**
+         * Burn
+         */
+        BRN, 
+        /**
+         * Bronchial
+         */
+        BRO, 
+        /**
+         * Exhaled gas (=breath)
+         */
+        BRTH, 
+        /**
+         * Calculus (=Stone)
+         */
+        CALC, 
+        /**
+         * Cardiac muscle
+         */
+        CDM, 
+        /**
+         * Conjunctiva
+         */
+        CNJT, 
+        /**
+         * Cannula
+         */
+        CNL, 
+        /**
+         * Colostrum
+         */
+        COL, 
+        /**
+         * Cornea
+         */
+        CRN, 
+        /**
+         * Cerebral spinal fluid
+         */
+        CSF, 
+        /**
+         * Catheter tip
+         */
+        CTP, 
+        /**
+         * Curettage
+         */
+        CUR, 
+        /**
+         * Cervical mucus
+         */
+        CVM, 
+        /**
+         * Cervix
+         */
+        CVX, 
+        /**
+         * Cyst
+         */
+        CYST, 
+        /**
+         * Dialysis fluid
+         */
+        DIAF, 
+        /**
+         * Dose med or substance
+         */
+        DOSE, 
+        /**
+         * Drain
+         */
+        DRN, 
+        /**
+         * Duodenal fluid
+         */
+        DUFL, 
+        /**
+         * Ear
+         */
+        EAR, 
+        /**
+         * Ear wax (cerumen)
+         */
+        EARW, 
+        /**
+         * Electrode
+         */
+        ELT, 
+        /**
+         * Endocardium
+         */
+        ENDC, 
+        /**
+         * Endometrium
+         */
+        ENDM, 
+        /**
+         * Eosinophils
+         */
+        EOS, 
+        /**
+         * Eye
+         */
+        EYE, 
+        /**
+         * Fibroblasts
+         */
+        FIB, 
+        /**
+         * Fistula
+         */
+        FIST, 
+        /**
+         * Filter
+         */
+        FLT, 
+        /**
+         * Body fluid, unsp
+         */
+        FLU, 
+        /**
+         * Food sample
+         */
+        FOOD, 
+        /**
+         * Gas
+         */
+        GAS, 
+        /**
+         * Gastric fluid/contents
+         */
+        GAST, 
+        /**
+         * Genital
+         */
+        GEN, 
+        /**
+         * Genital cervix
+         */
+        GENC, 
+        /**
+         * Genital fluid
+         */
+        GENF, 
+        /**
+         * Genital lochia
+         */
+        GENL, 
+        /**
+         * Genital vaginal
+         */
+        GENV, 
+        /**
+         * Hair
+         */
+        HAR, 
+        /**
+         * Inhaled Gas
+         */
+        IHG, 
+        /**
+         * Isolate
+         */
+        ISLT, 
+        /**
+         * Intubation tube
+         */
+        IT, 
+        /**
+         * Lamella
+         */
+        LAM, 
+        /**
+         * Liquid NOS
+         */
+        LIQ, 
+        /**
+         * Line
+         */
+        LN, 
+        /**
+         * Line arterial
+         */
+        LNA, 
+        /**
+         * Line venous
+         */
+        LNV, 
+        /**
+         * Lymphocytes
+         */
+        LYM, 
+        /**
+         * Macrophages
+         */
+        MAC, 
+        /**
+         * Marrow (bone)
+         */
+        MAR, 
+        /**
+         * Menstrual blood
+         */
+        MBLD, 
+        /**
+         * Meconium
+         */
+        MEC, 
+        /**
+         * Breast milk
+         */
+        MILK, 
+        /**
+         * Milk
+         */
+        MLK, 
+        /**
+         * Nail
+         */
+        NAIL, 
+        /**
+         * Nose (nasal passage)
+         */
+        NOS, 
+        /**
+         * Pancreatic fluid
+         */
+        PAFL, 
+        /**
+         * Patient
+         */
+        PAT, 
+        /**
+         * Plasma
+         */
+        PLAS, 
+        /**
+         * Plasma bag
+         */
+        PLB, 
+        /**
+         * Placenta
+         */
+        PLC, 
+        /**
+         * Pleural fluid (thoracentesis fld)
+         */
+        PLR, 
+        /**
+         * Polymorphonuclear neutrophils
+         */
+        PMN, 
+        /**
+         * Platelet poor plasma
+         */
+        PPP, 
+        /**
+         * Platelet rich plasma
+         */
+        PRP, 
+        /**
+         * Peritoneal fluid /ascites
+         */
+        PRT, 
+        /**
+         * Pus
+         */
+        PUS, 
+        /**
+         * Erythrocytes
+         */
+        RBC, 
+        /**
+         * Saliva
+         */
+        SAL, 
+        /**
+         * Serum
+         */
+        SER, 
+        /**
+         * Skeletal muscle
+         */
+        SKM, 
+        /**
+         * Skin
+         */
+        SKN, 
+        /**
+         * Seminal fluid
+         */
+        SMN, 
+        /**
+         * Seminal plasma
+         */
+        SMPLS, 
+        /**
+         * Synovial fluid (Joint fluid)
+         */
+        SNV, 
+        /**
+         * Spermatozoa
+         */
+        SPRM, 
+        /**
+         * Sputum
+         */
+        SPT, 
+        /**
+         * Sputum - coughed
+         */
+        SPTC, 
+        /**
+         * Sputum - tracheal aspirate
+         */
+        SPTT, 
+        /**
+         * Stool = Fecal
+         */
+        STL, 
+        /**
+         * Sweat
+         */
+        SWT, 
+        /**
+         * Tears
+         */
+        TEAR, 
+        /**
+         * Thrombocyte (platelet)
+         */
+        THRB, 
+        /**
+         * Throat
+         */
+        THRT, 
+        /**
+         * Tissue gall bladder
+         */
+        TISG, 
+        /**
+         * Tissue placenta
+         */
+        TISPL, 
+        /**
+         * Tissue, unspecified
+         */
+        TISS, 
+        /**
+         * Tissue ulcer
+         */
+        TISU, 
+        /**
+         * Tissue large intestine
+         */
+        TLGI, 
+        /**
+         * Tissue lung
+         */
+        TLNG, 
+        /**
+         * Tissue small intestine Tissue ulcer
+         */
+        TSMI, 
+        /**
+         * Tube, unspecified
+         */
+        TUB, 
+        /**
+         * Ulcer
+         */
+        ULC, 
+        /**
+         * Umbilical blood
+         */
+        UMB, 
+        /**
+         * Unknown medicine
+         */
+        UMED, 
+        /**
+         * Urine
+         */
+        UR, 
+        /**
+         * Urine clean catch
+         */
+        URC, 
+        /**
+         * Urine sediment
+         */
+        URNS, 
+        /**
+         * Urine catheter
+         */
+        URT, 
+        /**
+         * Urethra
+         */
+        URTH, 
+        /**
+         * Unknown substance
+         */
+        USUB, 
+        /**
+         * Vomitus
+         */
+        VOM, 
+        /**
+         * Water
+         */
+        WAT, 
+        /**
+         * Leukocytes
+         */
+        WBC, 
+        /**
+         * Wick
+         */
+        WICK, 
+        /**
+         * Wound
+         */
+        WND, 
+        /**
+         * Wound abscess
+         */
+        WNDA, 
+        /**
+         * Wound drainage
+         */
+        WNDD, 
+        /**
+         * Wound exudate
+         */
+        WNDE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3SpecimenType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_SpecimenEntityType".equals(codeString))
+          return _SPECIMENENTITYTYPE;
+        if ("ABS".equals(codeString))
+          return ABS;
+        if ("AMN".equals(codeString))
+          return AMN;
+        if ("ASP".equals(codeString))
+          return ASP;
+        if ("BBL".equals(codeString))
+          return BBL;
+        if ("BDY".equals(codeString))
+          return BDY;
+        if ("BIFL".equals(codeString))
+          return BIFL;
+        if ("BLD".equals(codeString))
+          return BLD;
+        if ("BLDA".equals(codeString))
+          return BLDA;
+        if ("BLDC".equals(codeString))
+          return BLDC;
+        if ("BLDCO".equals(codeString))
+          return BLDCO;
+        if ("BLDV".equals(codeString))
+          return BLDV;
+        if ("BON".equals(codeString))
+          return BON;
+        if ("BPH".equals(codeString))
+          return BPH;
+        if ("BPU".equals(codeString))
+          return BPU;
+        if ("BRN".equals(codeString))
+          return BRN;
+        if ("BRO".equals(codeString))
+          return BRO;
+        if ("BRTH".equals(codeString))
+          return BRTH;
+        if ("CALC".equals(codeString))
+          return CALC;
+        if ("CDM".equals(codeString))
+          return CDM;
+        if ("CNJT".equals(codeString))
+          return CNJT;
+        if ("CNL".equals(codeString))
+          return CNL;
+        if ("COL".equals(codeString))
+          return COL;
+        if ("CRN".equals(codeString))
+          return CRN;
+        if ("CSF".equals(codeString))
+          return CSF;
+        if ("CTP".equals(codeString))
+          return CTP;
+        if ("CUR".equals(codeString))
+          return CUR;
+        if ("CVM".equals(codeString))
+          return CVM;
+        if ("CVX".equals(codeString))
+          return CVX;
+        if ("CYST".equals(codeString))
+          return CYST;
+        if ("DIAF".equals(codeString))
+          return DIAF;
+        if ("DOSE".equals(codeString))
+          return DOSE;
+        if ("DRN".equals(codeString))
+          return DRN;
+        if ("DUFL".equals(codeString))
+          return DUFL;
+        if ("EAR".equals(codeString))
+          return EAR;
+        if ("EARW".equals(codeString))
+          return EARW;
+        if ("ELT".equals(codeString))
+          return ELT;
+        if ("ENDC".equals(codeString))
+          return ENDC;
+        if ("ENDM".equals(codeString))
+          return ENDM;
+        if ("EOS".equals(codeString))
+          return EOS;
+        if ("EYE".equals(codeString))
+          return EYE;
+        if ("FIB".equals(codeString))
+          return FIB;
+        if ("FIST".equals(codeString))
+          return FIST;
+        if ("FLT".equals(codeString))
+          return FLT;
+        if ("FLU".equals(codeString))
+          return FLU;
+        if ("FOOD".equals(codeString))
+          return FOOD;
+        if ("GAS".equals(codeString))
+          return GAS;
+        if ("GAST".equals(codeString))
+          return GAST;
+        if ("GEN".equals(codeString))
+          return GEN;
+        if ("GENC".equals(codeString))
+          return GENC;
+        if ("GENF".equals(codeString))
+          return GENF;
+        if ("GENL".equals(codeString))
+          return GENL;
+        if ("GENV".equals(codeString))
+          return GENV;
+        if ("HAR".equals(codeString))
+          return HAR;
+        if ("IHG".equals(codeString))
+          return IHG;
+        if ("ISLT".equals(codeString))
+          return ISLT;
+        if ("IT".equals(codeString))
+          return IT;
+        if ("LAM".equals(codeString))
+          return LAM;
+        if ("LIQ".equals(codeString))
+          return LIQ;
+        if ("LN".equals(codeString))
+          return LN;
+        if ("LNA".equals(codeString))
+          return LNA;
+        if ("LNV".equals(codeString))
+          return LNV;
+        if ("LYM".equals(codeString))
+          return LYM;
+        if ("MAC".equals(codeString))
+          return MAC;
+        if ("MAR".equals(codeString))
+          return MAR;
+        if ("MBLD".equals(codeString))
+          return MBLD;
+        if ("MEC".equals(codeString))
+          return MEC;
+        if ("MILK".equals(codeString))
+          return MILK;
+        if ("MLK".equals(codeString))
+          return MLK;
+        if ("NAIL".equals(codeString))
+          return NAIL;
+        if ("NOS".equals(codeString))
+          return NOS;
+        if ("PAFL".equals(codeString))
+          return PAFL;
+        if ("PAT".equals(codeString))
+          return PAT;
+        if ("PLAS".equals(codeString))
+          return PLAS;
+        if ("PLB".equals(codeString))
+          return PLB;
+        if ("PLC".equals(codeString))
+          return PLC;
+        if ("PLR".equals(codeString))
+          return PLR;
+        if ("PMN".equals(codeString))
+          return PMN;
+        if ("PPP".equals(codeString))
+          return PPP;
+        if ("PRP".equals(codeString))
+          return PRP;
+        if ("PRT".equals(codeString))
+          return PRT;
+        if ("PUS".equals(codeString))
+          return PUS;
+        if ("RBC".equals(codeString))
+          return RBC;
+        if ("SAL".equals(codeString))
+          return SAL;
+        if ("SER".equals(codeString))
+          return SER;
+        if ("SKM".equals(codeString))
+          return SKM;
+        if ("SKN".equals(codeString))
+          return SKN;
+        if ("SMN".equals(codeString))
+          return SMN;
+        if ("SMPLS".equals(codeString))
+          return SMPLS;
+        if ("SNV".equals(codeString))
+          return SNV;
+        if ("SPRM".equals(codeString))
+          return SPRM;
+        if ("SPT".equals(codeString))
+          return SPT;
+        if ("SPTC".equals(codeString))
+          return SPTC;
+        if ("SPTT".equals(codeString))
+          return SPTT;
+        if ("STL".equals(codeString))
+          return STL;
+        if ("SWT".equals(codeString))
+          return SWT;
+        if ("TEAR".equals(codeString))
+          return TEAR;
+        if ("THRB".equals(codeString))
+          return THRB;
+        if ("THRT".equals(codeString))
+          return THRT;
+        if ("TISG".equals(codeString))
+          return TISG;
+        if ("TISPL".equals(codeString))
+          return TISPL;
+        if ("TISS".equals(codeString))
+          return TISS;
+        if ("TISU".equals(codeString))
+          return TISU;
+        if ("TLGI".equals(codeString))
+          return TLGI;
+        if ("TLNG".equals(codeString))
+          return TLNG;
+        if ("TSMI".equals(codeString))
+          return TSMI;
+        if ("TUB".equals(codeString))
+          return TUB;
+        if ("ULC".equals(codeString))
+          return ULC;
+        if ("UMB".equals(codeString))
+          return UMB;
+        if ("UMED".equals(codeString))
+          return UMED;
+        if ("UR".equals(codeString))
+          return UR;
+        if ("URC".equals(codeString))
+          return URC;
+        if ("URNS".equals(codeString))
+          return URNS;
+        if ("URT".equals(codeString))
+          return URT;
+        if ("URTH".equals(codeString))
+          return URTH;
+        if ("USUB".equals(codeString))
+          return USUB;
+        if ("VOM".equals(codeString))
+          return VOM;
+        if ("WAT".equals(codeString))
+          return WAT;
+        if ("WBC".equals(codeString))
+          return WBC;
+        if ("WICK".equals(codeString))
+          return WICK;
+        if ("WND".equals(codeString))
+          return WND;
+        if ("WNDA".equals(codeString))
+          return WNDA;
+        if ("WNDD".equals(codeString))
+          return WNDD;
+        if ("WNDE".equals(codeString))
+          return WNDE;
+        throw new FHIRException("Unknown V3SpecimenType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _SPECIMENENTITYTYPE: return "_SpecimenEntityType";
+            case ABS: return "ABS";
+            case AMN: return "AMN";
+            case ASP: return "ASP";
+            case BBL: return "BBL";
+            case BDY: return "BDY";
+            case BIFL: return "BIFL";
+            case BLD: return "BLD";
+            case BLDA: return "BLDA";
+            case BLDC: return "BLDC";
+            case BLDCO: return "BLDCO";
+            case BLDV: return "BLDV";
+            case BON: return "BON";
+            case BPH: return "BPH";
+            case BPU: return "BPU";
+            case BRN: return "BRN";
+            case BRO: return "BRO";
+            case BRTH: return "BRTH";
+            case CALC: return "CALC";
+            case CDM: return "CDM";
+            case CNJT: return "CNJT";
+            case CNL: return "CNL";
+            case COL: return "COL";
+            case CRN: return "CRN";
+            case CSF: return "CSF";
+            case CTP: return "CTP";
+            case CUR: return "CUR";
+            case CVM: return "CVM";
+            case CVX: return "CVX";
+            case CYST: return "CYST";
+            case DIAF: return "DIAF";
+            case DOSE: return "DOSE";
+            case DRN: return "DRN";
+            case DUFL: return "DUFL";
+            case EAR: return "EAR";
+            case EARW: return "EARW";
+            case ELT: return "ELT";
+            case ENDC: return "ENDC";
+            case ENDM: return "ENDM";
+            case EOS: return "EOS";
+            case EYE: return "EYE";
+            case FIB: return "FIB";
+            case FIST: return "FIST";
+            case FLT: return "FLT";
+            case FLU: return "FLU";
+            case FOOD: return "FOOD";
+            case GAS: return "GAS";
+            case GAST: return "GAST";
+            case GEN: return "GEN";
+            case GENC: return "GENC";
+            case GENF: return "GENF";
+            case GENL: return "GENL";
+            case GENV: return "GENV";
+            case HAR: return "HAR";
+            case IHG: return "IHG";
+            case ISLT: return "ISLT";
+            case IT: return "IT";
+            case LAM: return "LAM";
+            case LIQ: return "LIQ";
+            case LN: return "LN";
+            case LNA: return "LNA";
+            case LNV: return "LNV";
+            case LYM: return "LYM";
+            case MAC: return "MAC";
+            case MAR: return "MAR";
+            case MBLD: return "MBLD";
+            case MEC: return "MEC";
+            case MILK: return "MILK";
+            case MLK: return "MLK";
+            case NAIL: return "NAIL";
+            case NOS: return "NOS";
+            case PAFL: return "PAFL";
+            case PAT: return "PAT";
+            case PLAS: return "PLAS";
+            case PLB: return "PLB";
+            case PLC: return "PLC";
+            case PLR: return "PLR";
+            case PMN: return "PMN";
+            case PPP: return "PPP";
+            case PRP: return "PRP";
+            case PRT: return "PRT";
+            case PUS: return "PUS";
+            case RBC: return "RBC";
+            case SAL: return "SAL";
+            case SER: return "SER";
+            case SKM: return "SKM";
+            case SKN: return "SKN";
+            case SMN: return "SMN";
+            case SMPLS: return "SMPLS";
+            case SNV: return "SNV";
+            case SPRM: return "SPRM";
+            case SPT: return "SPT";
+            case SPTC: return "SPTC";
+            case SPTT: return "SPTT";
+            case STL: return "STL";
+            case SWT: return "SWT";
+            case TEAR: return "TEAR";
+            case THRB: return "THRB";
+            case THRT: return "THRT";
+            case TISG: return "TISG";
+            case TISPL: return "TISPL";
+            case TISS: return "TISS";
+            case TISU: return "TISU";
+            case TLGI: return "TLGI";
+            case TLNG: return "TLNG";
+            case TSMI: return "TSMI";
+            case TUB: return "TUB";
+            case ULC: return "ULC";
+            case UMB: return "UMB";
+            case UMED: return "UMED";
+            case UR: return "UR";
+            case URC: return "URC";
+            case URNS: return "URNS";
+            case URT: return "URT";
+            case URTH: return "URTH";
+            case USUB: return "USUB";
+            case VOM: return "VOM";
+            case WAT: return "WAT";
+            case WBC: return "WBC";
+            case WICK: return "WICK";
+            case WND: return "WND";
+            case WNDA: return "WNDA";
+            case WNDD: return "WNDD";
+            case WNDE: return "WNDE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/SpecimenType";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _SPECIMENENTITYTYPE: return "SpecimenEntityType";
+            case ABS: return "Abcess";
+            case AMN: return "Amniotic fluid";
+            case ASP: return "Aspirate";
+            case BBL: return "Blood bag";
+            case BDY: return "Whole body";
+            case BIFL: return "Bile fluid";
+            case BLD: return "Whole blood";
+            case BLDA: return "Blood arterial";
+            case BLDC: return "Blood capillary";
+            case BLDCO: return "Blood - cord";
+            case BLDV: return "Blood venous";
+            case BON: return "Bone";
+            case BPH: return "Basophils";
+            case BPU: return "Blood product unit";
+            case BRN: return "Burn";
+            case BRO: return "Bronchial";
+            case BRTH: return "Exhaled gas (=breath)";
+            case CALC: return "Calculus (=Stone)";
+            case CDM: return "Cardiac muscle";
+            case CNJT: return "Conjunctiva";
+            case CNL: return "Cannula";
+            case COL: return "Colostrum";
+            case CRN: return "Cornea";
+            case CSF: return "Cerebral spinal fluid";
+            case CTP: return "Catheter tip";
+            case CUR: return "Curettage";
+            case CVM: return "Cervical mucus";
+            case CVX: return "Cervix";
+            case CYST: return "Cyst";
+            case DIAF: return "Dialysis fluid";
+            case DOSE: return "Dose med or substance";
+            case DRN: return "Drain";
+            case DUFL: return "Duodenal fluid";
+            case EAR: return "Ear";
+            case EARW: return "Ear wax (cerumen)";
+            case ELT: return "Electrode";
+            case ENDC: return "Endocardium";
+            case ENDM: return "Endometrium";
+            case EOS: return "Eosinophils";
+            case EYE: return "Eye";
+            case FIB: return "Fibroblasts";
+            case FIST: return "Fistula";
+            case FLT: return "Filter";
+            case FLU: return "Body fluid, unsp";
+            case FOOD: return "Food sample";
+            case GAS: return "Gas";
+            case GAST: return "Gastric fluid/contents";
+            case GEN: return "Genital";
+            case GENC: return "Genital cervix";
+            case GENF: return "Genital fluid";
+            case GENL: return "Genital lochia";
+            case GENV: return "Genital vaginal";
+            case HAR: return "Hair";
+            case IHG: return "Inhaled Gas";
+            case ISLT: return "Isolate";
+            case IT: return "Intubation tube";
+            case LAM: return "Lamella";
+            case LIQ: return "Liquid NOS";
+            case LN: return "Line";
+            case LNA: return "Line arterial";
+            case LNV: return "Line venous";
+            case LYM: return "Lymphocytes";
+            case MAC: return "Macrophages";
+            case MAR: return "Marrow (bone)";
+            case MBLD: return "Menstrual blood";
+            case MEC: return "Meconium";
+            case MILK: return "Breast milk";
+            case MLK: return "Milk";
+            case NAIL: return "Nail";
+            case NOS: return "Nose (nasal passage)";
+            case PAFL: return "Pancreatic fluid";
+            case PAT: return "Patient";
+            case PLAS: return "Plasma";
+            case PLB: return "Plasma bag";
+            case PLC: return "Placenta";
+            case PLR: return "Pleural fluid (thoracentesis fld)";
+            case PMN: return "Polymorphonuclear neutrophils";
+            case PPP: return "Platelet poor plasma";
+            case PRP: return "Platelet rich plasma";
+            case PRT: return "Peritoneal fluid /ascites";
+            case PUS: return "Pus";
+            case RBC: return "Erythrocytes";
+            case SAL: return "Saliva";
+            case SER: return "Serum";
+            case SKM: return "Skeletal muscle";
+            case SKN: return "Skin";
+            case SMN: return "Seminal fluid";
+            case SMPLS: return "Seminal plasma";
+            case SNV: return "Synovial fluid (Joint fluid)";
+            case SPRM: return "Spermatozoa";
+            case SPT: return "Sputum";
+            case SPTC: return "Sputum - coughed";
+            case SPTT: return "Sputum - tracheal aspirate";
+            case STL: return "Stool = Fecal";
+            case SWT: return "Sweat";
+            case TEAR: return "Tears";
+            case THRB: return "Thrombocyte (platelet)";
+            case THRT: return "Throat";
+            case TISG: return "Tissue gall bladder";
+            case TISPL: return "Tissue placenta";
+            case TISS: return "Tissue, unspecified";
+            case TISU: return "Tissue ulcer";
+            case TLGI: return "Tissue large intestine";
+            case TLNG: return "Tissue lung";
+            case TSMI: return "Tissue small intestine Tissue ulcer";
+            case TUB: return "Tube, unspecified";
+            case ULC: return "Ulcer";
+            case UMB: return "Umbilical blood";
+            case UMED: return "Unknown medicine";
+            case UR: return "Urine";
+            case URC: return "Urine clean catch";
+            case URNS: return "Urine sediment";
+            case URT: return "Urine catheter";
+            case URTH: return "Urethra";
+            case USUB: return "Unknown substance";
+            case VOM: return "Vomitus";
+            case WAT: return "Water";
+            case WBC: return "Leukocytes";
+            case WICK: return "Wick";
+            case WND: return "Wound";
+            case WNDA: return "Wound abscess";
+            case WNDD: return "Wound drainage";
+            case WNDE: return "Wound exudate";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _SPECIMENENTITYTYPE: return "SpecimenEntityType";
+            case ABS: return "Abcess";
+            case AMN: return "Amniotic fluid";
+            case ASP: return "Aspirate";
+            case BBL: return "Blood bag";
+            case BDY: return "Whole body";
+            case BIFL: return "Bile fluid";
+            case BLD: return "Whole blood";
+            case BLDA: return "Blood arterial";
+            case BLDC: return "Blood capillary";
+            case BLDCO: return "Blood - cord";
+            case BLDV: return "Blood venous";
+            case BON: return "Bone";
+            case BPH: return "Basophils";
+            case BPU: return "Blood product unit";
+            case BRN: return "Burn";
+            case BRO: return "Bronchial";
+            case BRTH: return "Exhaled gas (=breath)";
+            case CALC: return "Calculus (=Stone)";
+            case CDM: return "Cardiac muscle";
+            case CNJT: return "Conjunctiva";
+            case CNL: return "Cannula";
+            case COL: return "Colostrum";
+            case CRN: return "Cornea";
+            case CSF: return "Cerebral spinal fluid";
+            case CTP: return "Catheter tip";
+            case CUR: return "Curettage";
+            case CVM: return "Cervical mucus";
+            case CVX: return "Cervix";
+            case CYST: return "Cyst";
+            case DIAF: return "Dialysis fluid";
+            case DOSE: return "Dose med or substance";
+            case DRN: return "Drain";
+            case DUFL: return "Duodenal fluid";
+            case EAR: return "Ear";
+            case EARW: return "Ear wax (cerumen)";
+            case ELT: return "Electrode";
+            case ENDC: return "Endocardium";
+            case ENDM: return "Endometrium";
+            case EOS: return "Eosinophils";
+            case EYE: return "Eye";
+            case FIB: return "Fibroblasts";
+            case FIST: return "Fistula";
+            case FLT: return "Filter";
+            case FLU: return "Body fluid, unsp";
+            case FOOD: return "Food sample";
+            case GAS: return "Gas";
+            case GAST: return "Gastric fluid/contents";
+            case GEN: return "Genital";
+            case GENC: return "Genital cervix";
+            case GENF: return "Genital fluid";
+            case GENL: return "Genital lochia";
+            case GENV: return "Genital vaginal";
+            case HAR: return "Hair";
+            case IHG: return "Inhaled Gas";
+            case ISLT: return "Isolate";
+            case IT: return "Intubation tube";
+            case LAM: return "Lamella";
+            case LIQ: return "Liquid NOS";
+            case LN: return "Line";
+            case LNA: return "Line arterial";
+            case LNV: return "Line venous";
+            case LYM: return "Lymphocytes";
+            case MAC: return "Macrophages";
+            case MAR: return "Marrow (bone)";
+            case MBLD: return "Menstrual blood";
+            case MEC: return "Meconium";
+            case MILK: return "Breast milk";
+            case MLK: return "Milk";
+            case NAIL: return "Nail";
+            case NOS: return "Nose (nasal passage)";
+            case PAFL: return "Pancreatic fluid";
+            case PAT: return "Patient";
+            case PLAS: return "Plasma";
+            case PLB: return "Plasma bag";
+            case PLC: return "Placenta";
+            case PLR: return "Pleural fluid (thoracentesis fld)";
+            case PMN: return "Polymorphonuclear neutrophils";
+            case PPP: return "Platelet poor plasma";
+            case PRP: return "Platelet rich plasma";
+            case PRT: return "Peritoneal fluid /ascites";
+            case PUS: return "Pus";
+            case RBC: return "Erythrocytes";
+            case SAL: return "Saliva";
+            case SER: return "Serum";
+            case SKM: return "Skeletal muscle";
+            case SKN: return "Skin";
+            case SMN: return "Seminal fluid";
+            case SMPLS: return "Seminal plasma";
+            case SNV: return "Synovial fluid (Joint fluid)";
+            case SPRM: return "Spermatozoa";
+            case SPT: return "Sputum";
+            case SPTC: return "Sputum - coughed";
+            case SPTT: return "Sputum - tracheal aspirate";
+            case STL: return "Stool = Fecal";
+            case SWT: return "Sweat";
+            case TEAR: return "Tears";
+            case THRB: return "Thrombocyte (platelet)";
+            case THRT: return "Throat";
+            case TISG: return "Tissue gall bladder";
+            case TISPL: return "Tissue placenta";
+            case TISS: return "Tissue, unspecified";
+            case TISU: return "Tissue ulcer";
+            case TLGI: return "Tissue large intestine";
+            case TLNG: return "Tissue lung";
+            case TSMI: return "Tissue small intestine Tissue ulcer";
+            case TUB: return "Tube, unspecified";
+            case ULC: return "Ulcer";
+            case UMB: return "Umbilical blood";
+            case UMED: return "Unknown medicine";
+            case UR: return "Urine";
+            case URC: return "Urine clean catch";
+            case URNS: return "Urine sediment";
+            case URT: return "Urine catheter";
+            case URTH: return "Urethra";
+            case USUB: return "Unknown substance";
+            case VOM: return "Vomitus";
+            case WAT: return "Water";
+            case WBC: return "Leukocytes";
+            case WICK: return "Wick";
+            case WND: return "Wound";
+            case WNDA: return "Wound abscess";
+            case WNDD: return "Wound drainage";
+            case WNDE: return "Wound exudate";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SpecimenTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SpecimenTypeEnumFactory.java
new file mode 100644
index 00000000000..8df065fe3a8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SpecimenTypeEnumFactory.java
@@ -0,0 +1,550 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3SpecimenTypeEnumFactory implements EnumFactory {
+
+  public V3SpecimenType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_SpecimenEntityType".equals(codeString))
+      return V3SpecimenType._SPECIMENENTITYTYPE;
+    if ("ABS".equals(codeString))
+      return V3SpecimenType.ABS;
+    if ("AMN".equals(codeString))
+      return V3SpecimenType.AMN;
+    if ("ASP".equals(codeString))
+      return V3SpecimenType.ASP;
+    if ("BBL".equals(codeString))
+      return V3SpecimenType.BBL;
+    if ("BDY".equals(codeString))
+      return V3SpecimenType.BDY;
+    if ("BIFL".equals(codeString))
+      return V3SpecimenType.BIFL;
+    if ("BLD".equals(codeString))
+      return V3SpecimenType.BLD;
+    if ("BLDA".equals(codeString))
+      return V3SpecimenType.BLDA;
+    if ("BLDC".equals(codeString))
+      return V3SpecimenType.BLDC;
+    if ("BLDCO".equals(codeString))
+      return V3SpecimenType.BLDCO;
+    if ("BLDV".equals(codeString))
+      return V3SpecimenType.BLDV;
+    if ("BON".equals(codeString))
+      return V3SpecimenType.BON;
+    if ("BPH".equals(codeString))
+      return V3SpecimenType.BPH;
+    if ("BPU".equals(codeString))
+      return V3SpecimenType.BPU;
+    if ("BRN".equals(codeString))
+      return V3SpecimenType.BRN;
+    if ("BRO".equals(codeString))
+      return V3SpecimenType.BRO;
+    if ("BRTH".equals(codeString))
+      return V3SpecimenType.BRTH;
+    if ("CALC".equals(codeString))
+      return V3SpecimenType.CALC;
+    if ("CDM".equals(codeString))
+      return V3SpecimenType.CDM;
+    if ("CNJT".equals(codeString))
+      return V3SpecimenType.CNJT;
+    if ("CNL".equals(codeString))
+      return V3SpecimenType.CNL;
+    if ("COL".equals(codeString))
+      return V3SpecimenType.COL;
+    if ("CRN".equals(codeString))
+      return V3SpecimenType.CRN;
+    if ("CSF".equals(codeString))
+      return V3SpecimenType.CSF;
+    if ("CTP".equals(codeString))
+      return V3SpecimenType.CTP;
+    if ("CUR".equals(codeString))
+      return V3SpecimenType.CUR;
+    if ("CVM".equals(codeString))
+      return V3SpecimenType.CVM;
+    if ("CVX".equals(codeString))
+      return V3SpecimenType.CVX;
+    if ("CYST".equals(codeString))
+      return V3SpecimenType.CYST;
+    if ("DIAF".equals(codeString))
+      return V3SpecimenType.DIAF;
+    if ("DOSE".equals(codeString))
+      return V3SpecimenType.DOSE;
+    if ("DRN".equals(codeString))
+      return V3SpecimenType.DRN;
+    if ("DUFL".equals(codeString))
+      return V3SpecimenType.DUFL;
+    if ("EAR".equals(codeString))
+      return V3SpecimenType.EAR;
+    if ("EARW".equals(codeString))
+      return V3SpecimenType.EARW;
+    if ("ELT".equals(codeString))
+      return V3SpecimenType.ELT;
+    if ("ENDC".equals(codeString))
+      return V3SpecimenType.ENDC;
+    if ("ENDM".equals(codeString))
+      return V3SpecimenType.ENDM;
+    if ("EOS".equals(codeString))
+      return V3SpecimenType.EOS;
+    if ("EYE".equals(codeString))
+      return V3SpecimenType.EYE;
+    if ("FIB".equals(codeString))
+      return V3SpecimenType.FIB;
+    if ("FIST".equals(codeString))
+      return V3SpecimenType.FIST;
+    if ("FLT".equals(codeString))
+      return V3SpecimenType.FLT;
+    if ("FLU".equals(codeString))
+      return V3SpecimenType.FLU;
+    if ("FOOD".equals(codeString))
+      return V3SpecimenType.FOOD;
+    if ("GAS".equals(codeString))
+      return V3SpecimenType.GAS;
+    if ("GAST".equals(codeString))
+      return V3SpecimenType.GAST;
+    if ("GEN".equals(codeString))
+      return V3SpecimenType.GEN;
+    if ("GENC".equals(codeString))
+      return V3SpecimenType.GENC;
+    if ("GENF".equals(codeString))
+      return V3SpecimenType.GENF;
+    if ("GENL".equals(codeString))
+      return V3SpecimenType.GENL;
+    if ("GENV".equals(codeString))
+      return V3SpecimenType.GENV;
+    if ("HAR".equals(codeString))
+      return V3SpecimenType.HAR;
+    if ("IHG".equals(codeString))
+      return V3SpecimenType.IHG;
+    if ("ISLT".equals(codeString))
+      return V3SpecimenType.ISLT;
+    if ("IT".equals(codeString))
+      return V3SpecimenType.IT;
+    if ("LAM".equals(codeString))
+      return V3SpecimenType.LAM;
+    if ("LIQ".equals(codeString))
+      return V3SpecimenType.LIQ;
+    if ("LN".equals(codeString))
+      return V3SpecimenType.LN;
+    if ("LNA".equals(codeString))
+      return V3SpecimenType.LNA;
+    if ("LNV".equals(codeString))
+      return V3SpecimenType.LNV;
+    if ("LYM".equals(codeString))
+      return V3SpecimenType.LYM;
+    if ("MAC".equals(codeString))
+      return V3SpecimenType.MAC;
+    if ("MAR".equals(codeString))
+      return V3SpecimenType.MAR;
+    if ("MBLD".equals(codeString))
+      return V3SpecimenType.MBLD;
+    if ("MEC".equals(codeString))
+      return V3SpecimenType.MEC;
+    if ("MILK".equals(codeString))
+      return V3SpecimenType.MILK;
+    if ("MLK".equals(codeString))
+      return V3SpecimenType.MLK;
+    if ("NAIL".equals(codeString))
+      return V3SpecimenType.NAIL;
+    if ("NOS".equals(codeString))
+      return V3SpecimenType.NOS;
+    if ("PAFL".equals(codeString))
+      return V3SpecimenType.PAFL;
+    if ("PAT".equals(codeString))
+      return V3SpecimenType.PAT;
+    if ("PLAS".equals(codeString))
+      return V3SpecimenType.PLAS;
+    if ("PLB".equals(codeString))
+      return V3SpecimenType.PLB;
+    if ("PLC".equals(codeString))
+      return V3SpecimenType.PLC;
+    if ("PLR".equals(codeString))
+      return V3SpecimenType.PLR;
+    if ("PMN".equals(codeString))
+      return V3SpecimenType.PMN;
+    if ("PPP".equals(codeString))
+      return V3SpecimenType.PPP;
+    if ("PRP".equals(codeString))
+      return V3SpecimenType.PRP;
+    if ("PRT".equals(codeString))
+      return V3SpecimenType.PRT;
+    if ("PUS".equals(codeString))
+      return V3SpecimenType.PUS;
+    if ("RBC".equals(codeString))
+      return V3SpecimenType.RBC;
+    if ("SAL".equals(codeString))
+      return V3SpecimenType.SAL;
+    if ("SER".equals(codeString))
+      return V3SpecimenType.SER;
+    if ("SKM".equals(codeString))
+      return V3SpecimenType.SKM;
+    if ("SKN".equals(codeString))
+      return V3SpecimenType.SKN;
+    if ("SMN".equals(codeString))
+      return V3SpecimenType.SMN;
+    if ("SMPLS".equals(codeString))
+      return V3SpecimenType.SMPLS;
+    if ("SNV".equals(codeString))
+      return V3SpecimenType.SNV;
+    if ("SPRM".equals(codeString))
+      return V3SpecimenType.SPRM;
+    if ("SPT".equals(codeString))
+      return V3SpecimenType.SPT;
+    if ("SPTC".equals(codeString))
+      return V3SpecimenType.SPTC;
+    if ("SPTT".equals(codeString))
+      return V3SpecimenType.SPTT;
+    if ("STL".equals(codeString))
+      return V3SpecimenType.STL;
+    if ("SWT".equals(codeString))
+      return V3SpecimenType.SWT;
+    if ("TEAR".equals(codeString))
+      return V3SpecimenType.TEAR;
+    if ("THRB".equals(codeString))
+      return V3SpecimenType.THRB;
+    if ("THRT".equals(codeString))
+      return V3SpecimenType.THRT;
+    if ("TISG".equals(codeString))
+      return V3SpecimenType.TISG;
+    if ("TISPL".equals(codeString))
+      return V3SpecimenType.TISPL;
+    if ("TISS".equals(codeString))
+      return V3SpecimenType.TISS;
+    if ("TISU".equals(codeString))
+      return V3SpecimenType.TISU;
+    if ("TLGI".equals(codeString))
+      return V3SpecimenType.TLGI;
+    if ("TLNG".equals(codeString))
+      return V3SpecimenType.TLNG;
+    if ("TSMI".equals(codeString))
+      return V3SpecimenType.TSMI;
+    if ("TUB".equals(codeString))
+      return V3SpecimenType.TUB;
+    if ("ULC".equals(codeString))
+      return V3SpecimenType.ULC;
+    if ("UMB".equals(codeString))
+      return V3SpecimenType.UMB;
+    if ("UMED".equals(codeString))
+      return V3SpecimenType.UMED;
+    if ("UR".equals(codeString))
+      return V3SpecimenType.UR;
+    if ("URC".equals(codeString))
+      return V3SpecimenType.URC;
+    if ("URNS".equals(codeString))
+      return V3SpecimenType.URNS;
+    if ("URT".equals(codeString))
+      return V3SpecimenType.URT;
+    if ("URTH".equals(codeString))
+      return V3SpecimenType.URTH;
+    if ("USUB".equals(codeString))
+      return V3SpecimenType.USUB;
+    if ("VOM".equals(codeString))
+      return V3SpecimenType.VOM;
+    if ("WAT".equals(codeString))
+      return V3SpecimenType.WAT;
+    if ("WBC".equals(codeString))
+      return V3SpecimenType.WBC;
+    if ("WICK".equals(codeString))
+      return V3SpecimenType.WICK;
+    if ("WND".equals(codeString))
+      return V3SpecimenType.WND;
+    if ("WNDA".equals(codeString))
+      return V3SpecimenType.WNDA;
+    if ("WNDD".equals(codeString))
+      return V3SpecimenType.WNDD;
+    if ("WNDE".equals(codeString))
+      return V3SpecimenType.WNDE;
+    throw new IllegalArgumentException("Unknown V3SpecimenType code '"+codeString+"'");
+  }
+
+  public String toCode(V3SpecimenType code) {
+    if (code == V3SpecimenType._SPECIMENENTITYTYPE)
+      return "_SpecimenEntityType";
+    if (code == V3SpecimenType.ABS)
+      return "ABS";
+    if (code == V3SpecimenType.AMN)
+      return "AMN";
+    if (code == V3SpecimenType.ASP)
+      return "ASP";
+    if (code == V3SpecimenType.BBL)
+      return "BBL";
+    if (code == V3SpecimenType.BDY)
+      return "BDY";
+    if (code == V3SpecimenType.BIFL)
+      return "BIFL";
+    if (code == V3SpecimenType.BLD)
+      return "BLD";
+    if (code == V3SpecimenType.BLDA)
+      return "BLDA";
+    if (code == V3SpecimenType.BLDC)
+      return "BLDC";
+    if (code == V3SpecimenType.BLDCO)
+      return "BLDCO";
+    if (code == V3SpecimenType.BLDV)
+      return "BLDV";
+    if (code == V3SpecimenType.BON)
+      return "BON";
+    if (code == V3SpecimenType.BPH)
+      return "BPH";
+    if (code == V3SpecimenType.BPU)
+      return "BPU";
+    if (code == V3SpecimenType.BRN)
+      return "BRN";
+    if (code == V3SpecimenType.BRO)
+      return "BRO";
+    if (code == V3SpecimenType.BRTH)
+      return "BRTH";
+    if (code == V3SpecimenType.CALC)
+      return "CALC";
+    if (code == V3SpecimenType.CDM)
+      return "CDM";
+    if (code == V3SpecimenType.CNJT)
+      return "CNJT";
+    if (code == V3SpecimenType.CNL)
+      return "CNL";
+    if (code == V3SpecimenType.COL)
+      return "COL";
+    if (code == V3SpecimenType.CRN)
+      return "CRN";
+    if (code == V3SpecimenType.CSF)
+      return "CSF";
+    if (code == V3SpecimenType.CTP)
+      return "CTP";
+    if (code == V3SpecimenType.CUR)
+      return "CUR";
+    if (code == V3SpecimenType.CVM)
+      return "CVM";
+    if (code == V3SpecimenType.CVX)
+      return "CVX";
+    if (code == V3SpecimenType.CYST)
+      return "CYST";
+    if (code == V3SpecimenType.DIAF)
+      return "DIAF";
+    if (code == V3SpecimenType.DOSE)
+      return "DOSE";
+    if (code == V3SpecimenType.DRN)
+      return "DRN";
+    if (code == V3SpecimenType.DUFL)
+      return "DUFL";
+    if (code == V3SpecimenType.EAR)
+      return "EAR";
+    if (code == V3SpecimenType.EARW)
+      return "EARW";
+    if (code == V3SpecimenType.ELT)
+      return "ELT";
+    if (code == V3SpecimenType.ENDC)
+      return "ENDC";
+    if (code == V3SpecimenType.ENDM)
+      return "ENDM";
+    if (code == V3SpecimenType.EOS)
+      return "EOS";
+    if (code == V3SpecimenType.EYE)
+      return "EYE";
+    if (code == V3SpecimenType.FIB)
+      return "FIB";
+    if (code == V3SpecimenType.FIST)
+      return "FIST";
+    if (code == V3SpecimenType.FLT)
+      return "FLT";
+    if (code == V3SpecimenType.FLU)
+      return "FLU";
+    if (code == V3SpecimenType.FOOD)
+      return "FOOD";
+    if (code == V3SpecimenType.GAS)
+      return "GAS";
+    if (code == V3SpecimenType.GAST)
+      return "GAST";
+    if (code == V3SpecimenType.GEN)
+      return "GEN";
+    if (code == V3SpecimenType.GENC)
+      return "GENC";
+    if (code == V3SpecimenType.GENF)
+      return "GENF";
+    if (code == V3SpecimenType.GENL)
+      return "GENL";
+    if (code == V3SpecimenType.GENV)
+      return "GENV";
+    if (code == V3SpecimenType.HAR)
+      return "HAR";
+    if (code == V3SpecimenType.IHG)
+      return "IHG";
+    if (code == V3SpecimenType.ISLT)
+      return "ISLT";
+    if (code == V3SpecimenType.IT)
+      return "IT";
+    if (code == V3SpecimenType.LAM)
+      return "LAM";
+    if (code == V3SpecimenType.LIQ)
+      return "LIQ";
+    if (code == V3SpecimenType.LN)
+      return "LN";
+    if (code == V3SpecimenType.LNA)
+      return "LNA";
+    if (code == V3SpecimenType.LNV)
+      return "LNV";
+    if (code == V3SpecimenType.LYM)
+      return "LYM";
+    if (code == V3SpecimenType.MAC)
+      return "MAC";
+    if (code == V3SpecimenType.MAR)
+      return "MAR";
+    if (code == V3SpecimenType.MBLD)
+      return "MBLD";
+    if (code == V3SpecimenType.MEC)
+      return "MEC";
+    if (code == V3SpecimenType.MILK)
+      return "MILK";
+    if (code == V3SpecimenType.MLK)
+      return "MLK";
+    if (code == V3SpecimenType.NAIL)
+      return "NAIL";
+    if (code == V3SpecimenType.NOS)
+      return "NOS";
+    if (code == V3SpecimenType.PAFL)
+      return "PAFL";
+    if (code == V3SpecimenType.PAT)
+      return "PAT";
+    if (code == V3SpecimenType.PLAS)
+      return "PLAS";
+    if (code == V3SpecimenType.PLB)
+      return "PLB";
+    if (code == V3SpecimenType.PLC)
+      return "PLC";
+    if (code == V3SpecimenType.PLR)
+      return "PLR";
+    if (code == V3SpecimenType.PMN)
+      return "PMN";
+    if (code == V3SpecimenType.PPP)
+      return "PPP";
+    if (code == V3SpecimenType.PRP)
+      return "PRP";
+    if (code == V3SpecimenType.PRT)
+      return "PRT";
+    if (code == V3SpecimenType.PUS)
+      return "PUS";
+    if (code == V3SpecimenType.RBC)
+      return "RBC";
+    if (code == V3SpecimenType.SAL)
+      return "SAL";
+    if (code == V3SpecimenType.SER)
+      return "SER";
+    if (code == V3SpecimenType.SKM)
+      return "SKM";
+    if (code == V3SpecimenType.SKN)
+      return "SKN";
+    if (code == V3SpecimenType.SMN)
+      return "SMN";
+    if (code == V3SpecimenType.SMPLS)
+      return "SMPLS";
+    if (code == V3SpecimenType.SNV)
+      return "SNV";
+    if (code == V3SpecimenType.SPRM)
+      return "SPRM";
+    if (code == V3SpecimenType.SPT)
+      return "SPT";
+    if (code == V3SpecimenType.SPTC)
+      return "SPTC";
+    if (code == V3SpecimenType.SPTT)
+      return "SPTT";
+    if (code == V3SpecimenType.STL)
+      return "STL";
+    if (code == V3SpecimenType.SWT)
+      return "SWT";
+    if (code == V3SpecimenType.TEAR)
+      return "TEAR";
+    if (code == V3SpecimenType.THRB)
+      return "THRB";
+    if (code == V3SpecimenType.THRT)
+      return "THRT";
+    if (code == V3SpecimenType.TISG)
+      return "TISG";
+    if (code == V3SpecimenType.TISPL)
+      return "TISPL";
+    if (code == V3SpecimenType.TISS)
+      return "TISS";
+    if (code == V3SpecimenType.TISU)
+      return "TISU";
+    if (code == V3SpecimenType.TLGI)
+      return "TLGI";
+    if (code == V3SpecimenType.TLNG)
+      return "TLNG";
+    if (code == V3SpecimenType.TSMI)
+      return "TSMI";
+    if (code == V3SpecimenType.TUB)
+      return "TUB";
+    if (code == V3SpecimenType.ULC)
+      return "ULC";
+    if (code == V3SpecimenType.UMB)
+      return "UMB";
+    if (code == V3SpecimenType.UMED)
+      return "UMED";
+    if (code == V3SpecimenType.UR)
+      return "UR";
+    if (code == V3SpecimenType.URC)
+      return "URC";
+    if (code == V3SpecimenType.URNS)
+      return "URNS";
+    if (code == V3SpecimenType.URT)
+      return "URT";
+    if (code == V3SpecimenType.URTH)
+      return "URTH";
+    if (code == V3SpecimenType.USUB)
+      return "USUB";
+    if (code == V3SpecimenType.VOM)
+      return "VOM";
+    if (code == V3SpecimenType.WAT)
+      return "WAT";
+    if (code == V3SpecimenType.WBC)
+      return "WBC";
+    if (code == V3SpecimenType.WICK)
+      return "WICK";
+    if (code == V3SpecimenType.WND)
+      return "WND";
+    if (code == V3SpecimenType.WNDA)
+      return "WNDA";
+    if (code == V3SpecimenType.WNDD)
+      return "WNDD";
+    if (code == V3SpecimenType.WNDE)
+      return "WNDE";
+    return "?";
+  }
+
+    public String toSystem(V3SpecimenType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstanceAdminSubstitution.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstanceAdminSubstitution.java
new file mode 100644
index 00000000000..875f257fdd9
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstanceAdminSubstitution.java
@@ -0,0 +1,213 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3SubstanceAdminSubstitution {
+
+        /**
+         * Description: Substitution occurred or is permitted with another product that may potentially have different ingredients, but having the same biological and therapeutic effects.
+         */
+        _ACTSUBSTANCEADMINSUBSTITUTIONCODE, 
+        /**
+         * Description: Substitution occurred or is permitted with another bioequivalent and therapeutically equivalent product.
+         */
+        E, 
+        /**
+         * Description: 
+                        
+
+                        Substitution occurred or is permitted with another product that is a:
+
+                        
+                           pharmaceutical alternative containing the same active ingredient but is formulated with different salt, ester
+                           pharmaceutical equivalent that has the same active ingredient, strength, dosage form and route of administration
+                        
+                        
+                           Examples: 
+                        
+
+                        
+                           
+                              Pharmaceutical alternative: Erythromycin Ethylsuccinate for Erythromycin Stearate
+                           
+                              Pharmaceutical equivalent: Lisonpril for Zestril
+         */
+        EC, 
+        /**
+         * Description: 
+                        
+
+                        Substitution occurred or is permitted between equivalent Brands but not Generics
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Zestril  for Prinivil
+                           Coumadin for Jantoven
+         */
+        BC, 
+        /**
+         * Description: Substitution occurred or is permitted between equivalent Generics but not Brands
+
+                        
+                           Examples: 
+                        
+
+                        
+                           Lisnopril (Lupin Corp) for Lisnopril (Wockhardt Corp)
+         */
+        G, 
+        /**
+         * Description: Substitution occurred or is permitted with another product having the same therapeutic objective and safety profile.
+
+                        
+                           Examples: 
+                        
+
+                        
+                           ranitidine for Tagamet
+         */
+        TE, 
+        /**
+         * Description: Substitution occurred or is permitted between therapeutically equivalent Brands but not Generics
+>
+                           Examples: 
+                        
+
+                        
+                           Zantac for Tagamet
+         */
+        TB, 
+        /**
+         * Description: Substitution occurred or is permitted between therapeutically equivalent Generics but not Brands
+>
+                           Examples: 
+                        
+
+                        
+                           Ranitidine  for cimetidine
+         */
+        TG, 
+        /**
+         * Description: This substitution was performed or is permitted based on formulary guidelines.
+         */
+        F, 
+        /**
+         * No substitution occurred or is permitted.
+         */
+        N, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3SubstanceAdminSubstitution fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_ActSubstanceAdminSubstitutionCode".equals(codeString))
+          return _ACTSUBSTANCEADMINSUBSTITUTIONCODE;
+        if ("E".equals(codeString))
+          return E;
+        if ("EC".equals(codeString))
+          return EC;
+        if ("BC".equals(codeString))
+          return BC;
+        if ("G".equals(codeString))
+          return G;
+        if ("TE".equals(codeString))
+          return TE;
+        if ("TB".equals(codeString))
+          return TB;
+        if ("TG".equals(codeString))
+          return TG;
+        if ("F".equals(codeString))
+          return F;
+        if ("N".equals(codeString))
+          return N;
+        throw new FHIRException("Unknown V3SubstanceAdminSubstitution code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _ACTSUBSTANCEADMINSUBSTITUTIONCODE: return "_ActSubstanceAdminSubstitutionCode";
+            case E: return "E";
+            case EC: return "EC";
+            case BC: return "BC";
+            case G: return "G";
+            case TE: return "TE";
+            case TB: return "TB";
+            case TG: return "TG";
+            case F: return "F";
+            case N: return "N";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/substanceAdminSubstitution";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _ACTSUBSTANCEADMINSUBSTITUTIONCODE: return "Description: Substitution occurred or is permitted with another product that may potentially have different ingredients, but having the same biological and therapeutic effects.";
+            case E: return "Description: Substitution occurred or is permitted with another bioequivalent and therapeutically equivalent product.";
+            case EC: return "Description: \n                        \r\n\n                        Substitution occurred or is permitted with another product that is a:\r\n\n                        \n                           pharmaceutical alternative containing the same active ingredient but is formulated with different salt, ester\n                           pharmaceutical equivalent that has the same active ingredient, strength, dosage form and route of administration\n                        \n                        \n                           Examples: \n                        \r\n\n                        \n                           \n                              Pharmaceutical alternative: Erythromycin Ethylsuccinate for Erythromycin Stearate\n                           \n                              Pharmaceutical equivalent: Lisonpril for Zestril";
+            case BC: return "Description: \n                        \r\n\n                        Substitution occurred or is permitted between equivalent Brands but not Generics\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Zestril  for Prinivil\n                           Coumadin for Jantoven";
+            case G: return "Description: Substitution occurred or is permitted between equivalent Generics but not Brands\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           Lisnopril (Lupin Corp) for Lisnopril (Wockhardt Corp)";
+            case TE: return "Description: Substitution occurred or is permitted with another product having the same therapeutic objective and safety profile.\r\n\n                        \n                           Examples: \n                        \r\n\n                        \n                           ranitidine for Tagamet";
+            case TB: return "Description: Substitution occurred or is permitted between therapeutically equivalent Brands but not Generics\r\n>\n                           Examples: \n                        \r\n\n                        \n                           Zantac for Tagamet";
+            case TG: return "Description: Substitution occurred or is permitted between therapeutically equivalent Generics but not Brands\r\n>\n                           Examples: \n                        \r\n\n                        \n                           Ranitidine  for cimetidine";
+            case F: return "Description: This substitution was performed or is permitted based on formulary guidelines.";
+            case N: return "No substitution occurred or is permitted.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _ACTSUBSTANCEADMINSUBSTITUTIONCODE: return "ActSubstanceAdminSubstitutionCode";
+            case E: return "equivalent";
+            case EC: return "equivalent composition";
+            case BC: return "brand composition";
+            case G: return "generic composition";
+            case TE: return "therapeutic alternative";
+            case TB: return "therapeutic brand";
+            case TG: return "therapeutic generic";
+            case F: return "formulary";
+            case N: return "none";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstanceAdminSubstitutionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstanceAdminSubstitutionEnumFactory.java
new file mode 100644
index 00000000000..8d295de8e10
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstanceAdminSubstitutionEnumFactory.java
@@ -0,0 +1,94 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3SubstanceAdminSubstitutionEnumFactory implements EnumFactory {
+
+  public V3SubstanceAdminSubstitution fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_ActSubstanceAdminSubstitutionCode".equals(codeString))
+      return V3SubstanceAdminSubstitution._ACTSUBSTANCEADMINSUBSTITUTIONCODE;
+    if ("E".equals(codeString))
+      return V3SubstanceAdminSubstitution.E;
+    if ("EC".equals(codeString))
+      return V3SubstanceAdminSubstitution.EC;
+    if ("BC".equals(codeString))
+      return V3SubstanceAdminSubstitution.BC;
+    if ("G".equals(codeString))
+      return V3SubstanceAdminSubstitution.G;
+    if ("TE".equals(codeString))
+      return V3SubstanceAdminSubstitution.TE;
+    if ("TB".equals(codeString))
+      return V3SubstanceAdminSubstitution.TB;
+    if ("TG".equals(codeString))
+      return V3SubstanceAdminSubstitution.TG;
+    if ("F".equals(codeString))
+      return V3SubstanceAdminSubstitution.F;
+    if ("N".equals(codeString))
+      return V3SubstanceAdminSubstitution.N;
+    throw new IllegalArgumentException("Unknown V3SubstanceAdminSubstitution code '"+codeString+"'");
+  }
+
+  public String toCode(V3SubstanceAdminSubstitution code) {
+    if (code == V3SubstanceAdminSubstitution._ACTSUBSTANCEADMINSUBSTITUTIONCODE)
+      return "_ActSubstanceAdminSubstitutionCode";
+    if (code == V3SubstanceAdminSubstitution.E)
+      return "E";
+    if (code == V3SubstanceAdminSubstitution.EC)
+      return "EC";
+    if (code == V3SubstanceAdminSubstitution.BC)
+      return "BC";
+    if (code == V3SubstanceAdminSubstitution.G)
+      return "G";
+    if (code == V3SubstanceAdminSubstitution.TE)
+      return "TE";
+    if (code == V3SubstanceAdminSubstitution.TB)
+      return "TB";
+    if (code == V3SubstanceAdminSubstitution.TG)
+      return "TG";
+    if (code == V3SubstanceAdminSubstitution.F)
+      return "F";
+    if (code == V3SubstanceAdminSubstitution.N)
+      return "N";
+    return "?";
+  }
+
+    public String toSystem(V3SubstanceAdminSubstitution code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstitutionCondition.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstitutionCondition.java
new file mode 100644
index 00000000000..f440ac33333
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstitutionCondition.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3SubstitutionCondition {
+
+        /**
+         * Some conditions may be attached to an allowable substitution.  An allowable substitution is based on a match to any other attributes that may be specified.
+         */
+        _CONDITIONAL, 
+        /**
+         * Confirmation with Contact Person prior to making any substitutions has or will occur.
+         */
+        CONFIRM, 
+        /**
+         * Notification to the Contact Person, prior to substitution and through normal institutional procedures, has or will be made.
+         */
+        NOTIFY, 
+        /**
+         * Substitution is not permitted.
+         */
+        NOSUB, 
+        /**
+         * No conditions are required.
+         */
+        UNCOND, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3SubstitutionCondition fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_Conditional".equals(codeString))
+          return _CONDITIONAL;
+        if ("CONFIRM".equals(codeString))
+          return CONFIRM;
+        if ("NOTIFY".equals(codeString))
+          return NOTIFY;
+        if ("NOSUB".equals(codeString))
+          return NOSUB;
+        if ("UNCOND".equals(codeString))
+          return UNCOND;
+        throw new FHIRException("Unknown V3SubstitutionCondition code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _CONDITIONAL: return "_Conditional";
+            case CONFIRM: return "CONFIRM";
+            case NOTIFY: return "NOTIFY";
+            case NOSUB: return "NOSUB";
+            case UNCOND: return "UNCOND";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/SubstitutionCondition";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _CONDITIONAL: return "Some conditions may be attached to an allowable substitution.  An allowable substitution is based on a match to any other attributes that may be specified.";
+            case CONFIRM: return "Confirmation with Contact Person prior to making any substitutions has or will occur.";
+            case NOTIFY: return "Notification to the Contact Person, prior to substitution and through normal institutional procedures, has or will be made.";
+            case NOSUB: return "Substitution is not permitted.";
+            case UNCOND: return "No conditions are required.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _CONDITIONAL: return "Conditional";
+            case CONFIRM: return "Confirm first";
+            case NOTIFY: return "Notify first";
+            case NOSUB: return "No substitution";
+            case UNCOND: return "Unconditional";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstitutionConditionEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstitutionConditionEnumFactory.java
new file mode 100644
index 00000000000..87bd350d235
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3SubstitutionConditionEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3SubstitutionConditionEnumFactory implements EnumFactory {
+
+  public V3SubstitutionCondition fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_Conditional".equals(codeString))
+      return V3SubstitutionCondition._CONDITIONAL;
+    if ("CONFIRM".equals(codeString))
+      return V3SubstitutionCondition.CONFIRM;
+    if ("NOTIFY".equals(codeString))
+      return V3SubstitutionCondition.NOTIFY;
+    if ("NOSUB".equals(codeString))
+      return V3SubstitutionCondition.NOSUB;
+    if ("UNCOND".equals(codeString))
+      return V3SubstitutionCondition.UNCOND;
+    throw new IllegalArgumentException("Unknown V3SubstitutionCondition code '"+codeString+"'");
+  }
+
+  public String toCode(V3SubstitutionCondition code) {
+    if (code == V3SubstitutionCondition._CONDITIONAL)
+      return "_Conditional";
+    if (code == V3SubstitutionCondition.CONFIRM)
+      return "CONFIRM";
+    if (code == V3SubstitutionCondition.NOTIFY)
+      return "NOTIFY";
+    if (code == V3SubstitutionCondition.NOSUB)
+      return "NOSUB";
+    if (code == V3SubstitutionCondition.UNCOND)
+      return "UNCOND";
+    return "?";
+  }
+
+    public String toSystem(V3SubstitutionCondition code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellHorizontalAlign.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellHorizontalAlign.java
new file mode 100644
index 00000000000..f8735536b28
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellHorizontalAlign.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TableCellHorizontalAlign {
+
+        /**
+         * center
+         */
+        CENTER, 
+        /**
+         * char
+         */
+        CHAR, 
+        /**
+         * justify
+         */
+        JUSTIFY, 
+        /**
+         * left
+         */
+        LEFT, 
+        /**
+         * right
+         */
+        RIGHT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TableCellHorizontalAlign fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("center".equals(codeString))
+          return CENTER;
+        if ("char".equals(codeString))
+          return CHAR;
+        if ("justify".equals(codeString))
+          return JUSTIFY;
+        if ("left".equals(codeString))
+          return LEFT;
+        if ("right".equals(codeString))
+          return RIGHT;
+        throw new FHIRException("Unknown V3TableCellHorizontalAlign code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case CENTER: return "center";
+            case CHAR: return "char";
+            case JUSTIFY: return "justify";
+            case LEFT: return "left";
+            case RIGHT: return "right";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TableCellHorizontalAlign";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case CENTER: return "center";
+            case CHAR: return "char";
+            case JUSTIFY: return "justify";
+            case LEFT: return "left";
+            case RIGHT: return "right";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case CENTER: return "center";
+            case CHAR: return "char";
+            case JUSTIFY: return "justify";
+            case LEFT: return "left";
+            case RIGHT: return "right";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellHorizontalAlignEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellHorizontalAlignEnumFactory.java
new file mode 100644
index 00000000000..f763ec7bbd1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellHorizontalAlignEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TableCellHorizontalAlignEnumFactory implements EnumFactory {
+
+  public V3TableCellHorizontalAlign fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("center".equals(codeString))
+      return V3TableCellHorizontalAlign.CENTER;
+    if ("char".equals(codeString))
+      return V3TableCellHorizontalAlign.CHAR;
+    if ("justify".equals(codeString))
+      return V3TableCellHorizontalAlign.JUSTIFY;
+    if ("left".equals(codeString))
+      return V3TableCellHorizontalAlign.LEFT;
+    if ("right".equals(codeString))
+      return V3TableCellHorizontalAlign.RIGHT;
+    throw new IllegalArgumentException("Unknown V3TableCellHorizontalAlign code '"+codeString+"'");
+  }
+
+  public String toCode(V3TableCellHorizontalAlign code) {
+    if (code == V3TableCellHorizontalAlign.CENTER)
+      return "center";
+    if (code == V3TableCellHorizontalAlign.CHAR)
+      return "char";
+    if (code == V3TableCellHorizontalAlign.JUSTIFY)
+      return "justify";
+    if (code == V3TableCellHorizontalAlign.LEFT)
+      return "left";
+    if (code == V3TableCellHorizontalAlign.RIGHT)
+      return "right";
+    return "?";
+  }
+
+    public String toSystem(V3TableCellHorizontalAlign code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellScope.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellScope.java
new file mode 100644
index 00000000000..1758da1d855
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellScope.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TableCellScope {
+
+        /**
+         * col
+         */
+        COL, 
+        /**
+         * colgroup
+         */
+        COLGROUP, 
+        /**
+         * row
+         */
+        ROW, 
+        /**
+         * rowgroup
+         */
+        ROWGROUP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TableCellScope fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("col".equals(codeString))
+          return COL;
+        if ("colgroup".equals(codeString))
+          return COLGROUP;
+        if ("row".equals(codeString))
+          return ROW;
+        if ("rowgroup".equals(codeString))
+          return ROWGROUP;
+        throw new FHIRException("Unknown V3TableCellScope code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COL: return "col";
+            case COLGROUP: return "colgroup";
+            case ROW: return "row";
+            case ROWGROUP: return "rowgroup";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TableCellScope";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COL: return "col";
+            case COLGROUP: return "colgroup";
+            case ROW: return "row";
+            case ROWGROUP: return "rowgroup";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COL: return "col";
+            case COLGROUP: return "colgroup";
+            case ROW: return "row";
+            case ROWGROUP: return "rowgroup";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellScopeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellScopeEnumFactory.java
new file mode 100644
index 00000000000..aa7a6dc7ab1
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellScopeEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TableCellScopeEnumFactory implements EnumFactory {
+
+  public V3TableCellScope fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("col".equals(codeString))
+      return V3TableCellScope.COL;
+    if ("colgroup".equals(codeString))
+      return V3TableCellScope.COLGROUP;
+    if ("row".equals(codeString))
+      return V3TableCellScope.ROW;
+    if ("rowgroup".equals(codeString))
+      return V3TableCellScope.ROWGROUP;
+    throw new IllegalArgumentException("Unknown V3TableCellScope code '"+codeString+"'");
+  }
+
+  public String toCode(V3TableCellScope code) {
+    if (code == V3TableCellScope.COL)
+      return "col";
+    if (code == V3TableCellScope.COLGROUP)
+      return "colgroup";
+    if (code == V3TableCellScope.ROW)
+      return "row";
+    if (code == V3TableCellScope.ROWGROUP)
+      return "rowgroup";
+    return "?";
+  }
+
+    public String toSystem(V3TableCellScope code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellVerticalAlign.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellVerticalAlign.java
new file mode 100644
index 00000000000..3603464d08e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellVerticalAlign.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TableCellVerticalAlign {
+
+        /**
+         * baseline
+         */
+        BASELINE, 
+        /**
+         * bottom
+         */
+        BOTTOM, 
+        /**
+         * middle
+         */
+        MIDDLE, 
+        /**
+         * top
+         */
+        TOP, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TableCellVerticalAlign fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("baseline".equals(codeString))
+          return BASELINE;
+        if ("bottom".equals(codeString))
+          return BOTTOM;
+        if ("middle".equals(codeString))
+          return MIDDLE;
+        if ("top".equals(codeString))
+          return TOP;
+        throw new FHIRException("Unknown V3TableCellVerticalAlign code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case BASELINE: return "baseline";
+            case BOTTOM: return "bottom";
+            case MIDDLE: return "middle";
+            case TOP: return "top";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TableCellVerticalAlign";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case BASELINE: return "baseline";
+            case BOTTOM: return "bottom";
+            case MIDDLE: return "middle";
+            case TOP: return "top";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case BASELINE: return "baseline";
+            case BOTTOM: return "bottom";
+            case MIDDLE: return "middle";
+            case TOP: return "top";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellVerticalAlignEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellVerticalAlignEnumFactory.java
new file mode 100644
index 00000000000..e5c6f1ebd54
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableCellVerticalAlignEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TableCellVerticalAlignEnumFactory implements EnumFactory {
+
+  public V3TableCellVerticalAlign fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("baseline".equals(codeString))
+      return V3TableCellVerticalAlign.BASELINE;
+    if ("bottom".equals(codeString))
+      return V3TableCellVerticalAlign.BOTTOM;
+    if ("middle".equals(codeString))
+      return V3TableCellVerticalAlign.MIDDLE;
+    if ("top".equals(codeString))
+      return V3TableCellVerticalAlign.TOP;
+    throw new IllegalArgumentException("Unknown V3TableCellVerticalAlign code '"+codeString+"'");
+  }
+
+  public String toCode(V3TableCellVerticalAlign code) {
+    if (code == V3TableCellVerticalAlign.BASELINE)
+      return "baseline";
+    if (code == V3TableCellVerticalAlign.BOTTOM)
+      return "bottom";
+    if (code == V3TableCellVerticalAlign.MIDDLE)
+      return "middle";
+    if (code == V3TableCellVerticalAlign.TOP)
+      return "top";
+    return "?";
+  }
+
+    public String toSystem(V3TableCellVerticalAlign code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableFrame.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableFrame.java
new file mode 100644
index 00000000000..4417aed1eea
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableFrame.java
@@ -0,0 +1,150 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TableFrame {
+
+        /**
+         * above
+         */
+        ABOVE, 
+        /**
+         * below
+         */
+        BELOW, 
+        /**
+         * border
+         */
+        BORDER, 
+        /**
+         * box
+         */
+        BOX, 
+        /**
+         * hsides
+         */
+        HSIDES, 
+        /**
+         * lhs
+         */
+        LHS, 
+        /**
+         * rhs
+         */
+        RHS, 
+        /**
+         * void
+         */
+        VOID, 
+        /**
+         * vsides
+         */
+        VSIDES, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TableFrame fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("above".equals(codeString))
+          return ABOVE;
+        if ("below".equals(codeString))
+          return BELOW;
+        if ("border".equals(codeString))
+          return BORDER;
+        if ("box".equals(codeString))
+          return BOX;
+        if ("hsides".equals(codeString))
+          return HSIDES;
+        if ("lhs".equals(codeString))
+          return LHS;
+        if ("rhs".equals(codeString))
+          return RHS;
+        if ("void".equals(codeString))
+          return VOID;
+        if ("vsides".equals(codeString))
+          return VSIDES;
+        throw new FHIRException("Unknown V3TableFrame code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ABOVE: return "above";
+            case BELOW: return "below";
+            case BORDER: return "border";
+            case BOX: return "box";
+            case HSIDES: return "hsides";
+            case LHS: return "lhs";
+            case RHS: return "rhs";
+            case VOID: return "void";
+            case VSIDES: return "vsides";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TableFrame";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ABOVE: return "above";
+            case BELOW: return "below";
+            case BORDER: return "border";
+            case BOX: return "box";
+            case HSIDES: return "hsides";
+            case LHS: return "lhs";
+            case RHS: return "rhs";
+            case VOID: return "void";
+            case VSIDES: return "vsides";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ABOVE: return "above";
+            case BELOW: return "below";
+            case BORDER: return "border";
+            case BOX: return "box";
+            case HSIDES: return "hsides";
+            case LHS: return "lhs";
+            case RHS: return "rhs";
+            case VOID: return "void";
+            case VSIDES: return "vsides";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableFrameEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableFrameEnumFactory.java
new file mode 100644
index 00000000000..04f9286810f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableFrameEnumFactory.java
@@ -0,0 +1,90 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TableFrameEnumFactory implements EnumFactory {
+
+  public V3TableFrame fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("above".equals(codeString))
+      return V3TableFrame.ABOVE;
+    if ("below".equals(codeString))
+      return V3TableFrame.BELOW;
+    if ("border".equals(codeString))
+      return V3TableFrame.BORDER;
+    if ("box".equals(codeString))
+      return V3TableFrame.BOX;
+    if ("hsides".equals(codeString))
+      return V3TableFrame.HSIDES;
+    if ("lhs".equals(codeString))
+      return V3TableFrame.LHS;
+    if ("rhs".equals(codeString))
+      return V3TableFrame.RHS;
+    if ("void".equals(codeString))
+      return V3TableFrame.VOID;
+    if ("vsides".equals(codeString))
+      return V3TableFrame.VSIDES;
+    throw new IllegalArgumentException("Unknown V3TableFrame code '"+codeString+"'");
+  }
+
+  public String toCode(V3TableFrame code) {
+    if (code == V3TableFrame.ABOVE)
+      return "above";
+    if (code == V3TableFrame.BELOW)
+      return "below";
+    if (code == V3TableFrame.BORDER)
+      return "border";
+    if (code == V3TableFrame.BOX)
+      return "box";
+    if (code == V3TableFrame.HSIDES)
+      return "hsides";
+    if (code == V3TableFrame.LHS)
+      return "lhs";
+    if (code == V3TableFrame.RHS)
+      return "rhs";
+    if (code == V3TableFrame.VOID)
+      return "void";
+    if (code == V3TableFrame.VSIDES)
+      return "vsides";
+    return "?";
+  }
+
+    public String toSystem(V3TableFrame code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableRules.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableRules.java
new file mode 100644
index 00000000000..306afc6008a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableRules.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TableRules {
+
+        /**
+         * all
+         */
+        ALL, 
+        /**
+         * cols
+         */
+        COLS, 
+        /**
+         * groups
+         */
+        GROUPS, 
+        /**
+         * none
+         */
+        NONE, 
+        /**
+         * rows
+         */
+        ROWS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TableRules fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("all".equals(codeString))
+          return ALL;
+        if ("cols".equals(codeString))
+          return COLS;
+        if ("groups".equals(codeString))
+          return GROUPS;
+        if ("none".equals(codeString))
+          return NONE;
+        if ("rows".equals(codeString))
+          return ROWS;
+        throw new FHIRException("Unknown V3TableRules code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ALL: return "all";
+            case COLS: return "cols";
+            case GROUPS: return "groups";
+            case NONE: return "none";
+            case ROWS: return "rows";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TableRules";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ALL: return "all";
+            case COLS: return "cols";
+            case GROUPS: return "groups";
+            case NONE: return "none";
+            case ROWS: return "rows";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ALL: return "all";
+            case COLS: return "cols";
+            case GROUPS: return "groups";
+            case NONE: return "none";
+            case ROWS: return "rows";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableRulesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableRulesEnumFactory.java
new file mode 100644
index 00000000000..6bc4eec16cb
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TableRulesEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TableRulesEnumFactory implements EnumFactory {
+
+  public V3TableRules fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("all".equals(codeString))
+      return V3TableRules.ALL;
+    if ("cols".equals(codeString))
+      return V3TableRules.COLS;
+    if ("groups".equals(codeString))
+      return V3TableRules.GROUPS;
+    if ("none".equals(codeString))
+      return V3TableRules.NONE;
+    if ("rows".equals(codeString))
+      return V3TableRules.ROWS;
+    throw new IllegalArgumentException("Unknown V3TableRules code '"+codeString+"'");
+  }
+
+  public String toCode(V3TableRules code) {
+    if (code == V3TableRules.ALL)
+      return "all";
+    if (code == V3TableRules.COLS)
+      return "cols";
+    if (code == V3TableRules.GROUPS)
+      return "groups";
+    if (code == V3TableRules.NONE)
+      return "none";
+    if (code == V3TableRules.ROWS)
+      return "rows";
+    return "?";
+  }
+
+    public String toSystem(V3TableRules code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TargetAwareness.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TargetAwareness.java
new file mode 100644
index 00000000000..b98a995df0a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TargetAwareness.java
@@ -0,0 +1,123 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TargetAwareness {
+
+        /**
+         * Target person has been informed about the issue but currently denies it.
+         */
+        D, 
+        /**
+         * Target person is fully aware of the issue.
+         */
+        F, 
+        /**
+         * Target person is not capable of comprehending the issue.
+         */
+        I, 
+        /**
+         * Target person is marginally aware of the issue.
+         */
+        M, 
+        /**
+         * Target person is partially aware of the issue.
+         */
+        P, 
+        /**
+         * Target person has not yet been informed of the issue.
+         */
+        U, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TargetAwareness fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("D".equals(codeString))
+          return D;
+        if ("F".equals(codeString))
+          return F;
+        if ("I".equals(codeString))
+          return I;
+        if ("M".equals(codeString))
+          return M;
+        if ("P".equals(codeString))
+          return P;
+        if ("U".equals(codeString))
+          return U;
+        throw new FHIRException("Unknown V3TargetAwareness code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case D: return "D";
+            case F: return "F";
+            case I: return "I";
+            case M: return "M";
+            case P: return "P";
+            case U: return "U";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TargetAwareness";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case D: return "Target person has been informed about the issue but currently denies it.";
+            case F: return "Target person is fully aware of the issue.";
+            case I: return "Target person is not capable of comprehending the issue.";
+            case M: return "Target person is marginally aware of the issue.";
+            case P: return "Target person is partially aware of the issue.";
+            case U: return "Target person has not yet been informed of the issue.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case D: return "denying";
+            case F: return "full awareness";
+            case I: return "incapable";
+            case M: return "marginal";
+            case P: return "partial";
+            case U: return "uninformed";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TargetAwarenessEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TargetAwarenessEnumFactory.java
new file mode 100644
index 00000000000..e34fe0c8bc8
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TargetAwarenessEnumFactory.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TargetAwarenessEnumFactory implements EnumFactory {
+
+  public V3TargetAwareness fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("D".equals(codeString))
+      return V3TargetAwareness.D;
+    if ("F".equals(codeString))
+      return V3TargetAwareness.F;
+    if ("I".equals(codeString))
+      return V3TargetAwareness.I;
+    if ("M".equals(codeString))
+      return V3TargetAwareness.M;
+    if ("P".equals(codeString))
+      return V3TargetAwareness.P;
+    if ("U".equals(codeString))
+      return V3TargetAwareness.U;
+    throw new IllegalArgumentException("Unknown V3TargetAwareness code '"+codeString+"'");
+  }
+
+  public String toCode(V3TargetAwareness code) {
+    if (code == V3TargetAwareness.D)
+      return "D";
+    if (code == V3TargetAwareness.F)
+      return "F";
+    if (code == V3TargetAwareness.I)
+      return "I";
+    if (code == V3TargetAwareness.M)
+      return "M";
+    if (code == V3TargetAwareness.P)
+      return "P";
+    if (code == V3TargetAwareness.U)
+      return "U";
+    return "?";
+  }
+
+    public String toSystem(V3TargetAwareness code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TelecommunicationCapabilities.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TelecommunicationCapabilities.java
new file mode 100644
index 00000000000..20a3c5b3b77
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TelecommunicationCapabilities.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TelecommunicationCapabilities {
+
+        /**
+         * Description: This device can receive data calls (i.e. modem).
+         */
+        DATA, 
+        /**
+         * Description: This device can receive faxes.
+         */
+        FAX, 
+        /**
+         * Description: This device can receive SMS messages.
+         */
+        SMS, 
+        /**
+         * Description: This device is a text telephone.
+         */
+        TTY, 
+        /**
+         * Description: This device can receive voice calls (i.e. talking to another person, or a recording device, or a voice activated computer).
+         */
+        VOICE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TelecommunicationCapabilities fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("data".equals(codeString))
+          return DATA;
+        if ("fax".equals(codeString))
+          return FAX;
+        if ("sms".equals(codeString))
+          return SMS;
+        if ("tty".equals(codeString))
+          return TTY;
+        if ("voice".equals(codeString))
+          return VOICE;
+        throw new FHIRException("Unknown V3TelecommunicationCapabilities code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case DATA: return "data";
+            case FAX: return "fax";
+            case SMS: return "sms";
+            case TTY: return "tty";
+            case VOICE: return "voice";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TelecommunicationCapabilities";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case DATA: return "Description: This device can receive data calls (i.e. modem).";
+            case FAX: return "Description: This device can receive faxes.";
+            case SMS: return "Description: This device can receive SMS messages.";
+            case TTY: return "Description: This device is a text telephone.";
+            case VOICE: return "Description: This device can receive voice calls (i.e. talking to another person, or a recording device, or a voice activated computer).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case DATA: return "data";
+            case FAX: return "fax";
+            case SMS: return "sms";
+            case TTY: return "text";
+            case VOICE: return "voice";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TelecommunicationCapabilitiesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TelecommunicationCapabilitiesEnumFactory.java
new file mode 100644
index 00000000000..770a0388e44
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TelecommunicationCapabilitiesEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TelecommunicationCapabilitiesEnumFactory implements EnumFactory {
+
+  public V3TelecommunicationCapabilities fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("data".equals(codeString))
+      return V3TelecommunicationCapabilities.DATA;
+    if ("fax".equals(codeString))
+      return V3TelecommunicationCapabilities.FAX;
+    if ("sms".equals(codeString))
+      return V3TelecommunicationCapabilities.SMS;
+    if ("tty".equals(codeString))
+      return V3TelecommunicationCapabilities.TTY;
+    if ("voice".equals(codeString))
+      return V3TelecommunicationCapabilities.VOICE;
+    throw new IllegalArgumentException("Unknown V3TelecommunicationCapabilities code '"+codeString+"'");
+  }
+
+  public String toCode(V3TelecommunicationCapabilities code) {
+    if (code == V3TelecommunicationCapabilities.DATA)
+      return "data";
+    if (code == V3TelecommunicationCapabilities.FAX)
+      return "fax";
+    if (code == V3TelecommunicationCapabilities.SMS)
+      return "sms";
+    if (code == V3TelecommunicationCapabilities.TTY)
+      return "tty";
+    if (code == V3TelecommunicationCapabilities.VOICE)
+      return "voice";
+    return "?";
+  }
+
+    public String toSystem(V3TelecommunicationCapabilities code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TimingEvent.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TimingEvent.java
new file mode 100644
index 00000000000..55a8e1f1348
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TimingEvent.java
@@ -0,0 +1,240 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TimingEvent {
+
+        /**
+         * before meal (from lat. ante cibus)
+         */
+        AC, 
+        /**
+         * before lunch (from lat. ante cibus diurnus)
+         */
+        ACD, 
+        /**
+         * before breakfast (from lat. ante cibus matutinus)
+         */
+        ACM, 
+        /**
+         * before dinner (from lat. ante cibus vespertinus)
+         */
+        ACV, 
+        /**
+         * Description: meal (from lat. ante cibus)
+         */
+        C, 
+        /**
+         * Description: lunch (from lat. cibus diurnus)
+         */
+        CD, 
+        /**
+         * Description: breakfast (from lat. cibus matutinus)
+         */
+        CM, 
+        /**
+         * Description: dinner (from lat. cibus vespertinus)
+         */
+        CV, 
+        /**
+         * Description: Prior to beginning a regular period of extended sleep (this would exclude naps).  Note that this might occur at different times of day depending on a person's regular sleep schedule.
+         */
+        HS, 
+        /**
+         * between meals (from lat. inter cibus)
+         */
+        IC, 
+        /**
+         * between lunch and dinner
+         */
+        ICD, 
+        /**
+         * between breakfast and lunch
+         */
+        ICM, 
+        /**
+         * between dinner and the hour of sleep
+         */
+        ICV, 
+        /**
+         * after meal (from lat. post cibus)
+         */
+        PC, 
+        /**
+         * after lunch (from lat. post cibus diurnus)
+         */
+        PCD, 
+        /**
+         * after breakfast (from lat. post cibus matutinus)
+         */
+        PCM, 
+        /**
+         * after dinner (from lat. post cibus vespertinus)
+         */
+        PCV, 
+        /**
+         * Description: Upon waking up from a regular period of sleep, in order to start regular activities (this would exclude waking up from a nap or temporarily waking up during a period of sleep)
+
+                        
+                           Usage Notes: e.g.
+
+                        Take pulse rate on waking in management of thyrotoxicosis.
+
+                        Take BP on waking in management of hypertension
+
+                        Take basal body temperature on waking in establishing date of ovulation
+         */
+        WAKE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TimingEvent fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AC".equals(codeString))
+          return AC;
+        if ("ACD".equals(codeString))
+          return ACD;
+        if ("ACM".equals(codeString))
+          return ACM;
+        if ("ACV".equals(codeString))
+          return ACV;
+        if ("C".equals(codeString))
+          return C;
+        if ("CD".equals(codeString))
+          return CD;
+        if ("CM".equals(codeString))
+          return CM;
+        if ("CV".equals(codeString))
+          return CV;
+        if ("HS".equals(codeString))
+          return HS;
+        if ("IC".equals(codeString))
+          return IC;
+        if ("ICD".equals(codeString))
+          return ICD;
+        if ("ICM".equals(codeString))
+          return ICM;
+        if ("ICV".equals(codeString))
+          return ICV;
+        if ("PC".equals(codeString))
+          return PC;
+        if ("PCD".equals(codeString))
+          return PCD;
+        if ("PCM".equals(codeString))
+          return PCM;
+        if ("PCV".equals(codeString))
+          return PCV;
+        if ("WAKE".equals(codeString))
+          return WAKE;
+        throw new FHIRException("Unknown V3TimingEvent code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AC: return "AC";
+            case ACD: return "ACD";
+            case ACM: return "ACM";
+            case ACV: return "ACV";
+            case C: return "C";
+            case CD: return "CD";
+            case CM: return "CM";
+            case CV: return "CV";
+            case HS: return "HS";
+            case IC: return "IC";
+            case ICD: return "ICD";
+            case ICM: return "ICM";
+            case ICV: return "ICV";
+            case PC: return "PC";
+            case PCD: return "PCD";
+            case PCM: return "PCM";
+            case PCV: return "PCV";
+            case WAKE: return "WAKE";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TimingEvent";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AC: return "before meal (from lat. ante cibus)";
+            case ACD: return "before lunch (from lat. ante cibus diurnus)";
+            case ACM: return "before breakfast (from lat. ante cibus matutinus)";
+            case ACV: return "before dinner (from lat. ante cibus vespertinus)";
+            case C: return "Description: meal (from lat. ante cibus)";
+            case CD: return "Description: lunch (from lat. cibus diurnus)";
+            case CM: return "Description: breakfast (from lat. cibus matutinus)";
+            case CV: return "Description: dinner (from lat. cibus vespertinus)";
+            case HS: return "Description: Prior to beginning a regular period of extended sleep (this would exclude naps).  Note that this might occur at different times of day depending on a person's regular sleep schedule.";
+            case IC: return "between meals (from lat. inter cibus)";
+            case ICD: return "between lunch and dinner";
+            case ICM: return "between breakfast and lunch";
+            case ICV: return "between dinner and the hour of sleep";
+            case PC: return "after meal (from lat. post cibus)";
+            case PCD: return "after lunch (from lat. post cibus diurnus)";
+            case PCM: return "after breakfast (from lat. post cibus matutinus)";
+            case PCV: return "after dinner (from lat. post cibus vespertinus)";
+            case WAKE: return "Description: Upon waking up from a regular period of sleep, in order to start regular activities (this would exclude waking up from a nap or temporarily waking up during a period of sleep)\r\n\n                        \n                           Usage Notes: e.g.\r\n\n                        Take pulse rate on waking in management of thyrotoxicosis.\r\n\n                        Take BP on waking in management of hypertension\r\n\n                        Take basal body temperature on waking in establishing date of ovulation";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AC: return "AC";
+            case ACD: return "ACD";
+            case ACM: return "ACM";
+            case ACV: return "ACV";
+            case C: return "C";
+            case CD: return "CD";
+            case CM: return "CM";
+            case CV: return "CV";
+            case HS: return "HS";
+            case IC: return "IC";
+            case ICD: return "ICD";
+            case ICM: return "ICM";
+            case ICV: return "ICV";
+            case PC: return "PC";
+            case PCD: return "PCD";
+            case PCM: return "PCM";
+            case PCV: return "PCV";
+            case WAKE: return "WAKE";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TimingEventEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TimingEventEnumFactory.java
new file mode 100644
index 00000000000..25402bfadbf
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TimingEventEnumFactory.java
@@ -0,0 +1,126 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TimingEventEnumFactory implements EnumFactory {
+
+  public V3TimingEvent fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AC".equals(codeString))
+      return V3TimingEvent.AC;
+    if ("ACD".equals(codeString))
+      return V3TimingEvent.ACD;
+    if ("ACM".equals(codeString))
+      return V3TimingEvent.ACM;
+    if ("ACV".equals(codeString))
+      return V3TimingEvent.ACV;
+    if ("C".equals(codeString))
+      return V3TimingEvent.C;
+    if ("CD".equals(codeString))
+      return V3TimingEvent.CD;
+    if ("CM".equals(codeString))
+      return V3TimingEvent.CM;
+    if ("CV".equals(codeString))
+      return V3TimingEvent.CV;
+    if ("HS".equals(codeString))
+      return V3TimingEvent.HS;
+    if ("IC".equals(codeString))
+      return V3TimingEvent.IC;
+    if ("ICD".equals(codeString))
+      return V3TimingEvent.ICD;
+    if ("ICM".equals(codeString))
+      return V3TimingEvent.ICM;
+    if ("ICV".equals(codeString))
+      return V3TimingEvent.ICV;
+    if ("PC".equals(codeString))
+      return V3TimingEvent.PC;
+    if ("PCD".equals(codeString))
+      return V3TimingEvent.PCD;
+    if ("PCM".equals(codeString))
+      return V3TimingEvent.PCM;
+    if ("PCV".equals(codeString))
+      return V3TimingEvent.PCV;
+    if ("WAKE".equals(codeString))
+      return V3TimingEvent.WAKE;
+    throw new IllegalArgumentException("Unknown V3TimingEvent code '"+codeString+"'");
+  }
+
+  public String toCode(V3TimingEvent code) {
+    if (code == V3TimingEvent.AC)
+      return "AC";
+    if (code == V3TimingEvent.ACD)
+      return "ACD";
+    if (code == V3TimingEvent.ACM)
+      return "ACM";
+    if (code == V3TimingEvent.ACV)
+      return "ACV";
+    if (code == V3TimingEvent.C)
+      return "C";
+    if (code == V3TimingEvent.CD)
+      return "CD";
+    if (code == V3TimingEvent.CM)
+      return "CM";
+    if (code == V3TimingEvent.CV)
+      return "CV";
+    if (code == V3TimingEvent.HS)
+      return "HS";
+    if (code == V3TimingEvent.IC)
+      return "IC";
+    if (code == V3TimingEvent.ICD)
+      return "ICD";
+    if (code == V3TimingEvent.ICM)
+      return "ICM";
+    if (code == V3TimingEvent.ICV)
+      return "ICV";
+    if (code == V3TimingEvent.PC)
+      return "PC";
+    if (code == V3TimingEvent.PCD)
+      return "PCD";
+    if (code == V3TimingEvent.PCM)
+      return "PCM";
+    if (code == V3TimingEvent.PCV)
+      return "PCV";
+    if (code == V3TimingEvent.WAKE)
+      return "WAKE";
+    return "?";
+  }
+
+    public String toSystem(V3TimingEvent code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TransmissionRelationshipTypeCode.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TransmissionRelationshipTypeCode.java
new file mode 100644
index 00000000000..d75f53d83b3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TransmissionRelationshipTypeCode.java
@@ -0,0 +1,78 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TransmissionRelationshipTypeCode {
+
+        /**
+         * Description:A transmission relationship indicating that the source transmission follows the target transmission.
+         */
+        SEQL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TransmissionRelationshipTypeCode fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("SEQL".equals(codeString))
+          return SEQL;
+        throw new FHIRException("Unknown V3TransmissionRelationshipTypeCode code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case SEQL: return "SEQL";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TransmissionRelationshipTypeCode";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case SEQL: return "Description:A transmission relationship indicating that the source transmission follows the target transmission.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case SEQL: return "sequence";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TransmissionRelationshipTypeCodeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TransmissionRelationshipTypeCodeEnumFactory.java
new file mode 100644
index 00000000000..2c586377356
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TransmissionRelationshipTypeCodeEnumFactory.java
@@ -0,0 +1,58 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TransmissionRelationshipTypeCodeEnumFactory implements EnumFactory {
+
+  public V3TransmissionRelationshipTypeCode fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("SEQL".equals(codeString))
+      return V3TransmissionRelationshipTypeCode.SEQL;
+    throw new IllegalArgumentException("Unknown V3TransmissionRelationshipTypeCode code '"+codeString+"'");
+  }
+
+  public String toCode(V3TransmissionRelationshipTypeCode code) {
+    if (code == V3TransmissionRelationshipTypeCode.SEQL)
+      return "SEQL";
+    return "?";
+  }
+
+    public String toSystem(V3TransmissionRelationshipTypeCode code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TribalEntityUS.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TribalEntityUS.java
new file mode 100644
index 00000000000..d0078fba97c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TribalEntityUS.java
@@ -0,0 +1,5181 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3TribalEntityUS {
+
+        /**
+         * NATIVE ENTITIES WITHIN THE STATE OF ALASKA RECOGNIZED AND ELIGIBLE TO RECEIVE SERVICES FROM THE UNITED STATES BUREAU OF INDIAN AFFAIRS
+         */
+        _NATIVEENTITYALASKA, 
+        /**
+         * Village of Afognak
+         */
+        _338, 
+        /**
+         * Agdaagux Tribe of King Cove
+         */
+        _339, 
+        /**
+         * Native Village of Akhiok
+         */
+        _340, 
+        /**
+         * Akiachak Native Community
+         */
+        _341, 
+        /**
+         * Akiak Native Community
+         */
+        _342, 
+        /**
+         * Native Village of Akutan
+         */
+        _343, 
+        /**
+         * Village of Alakanuk
+         */
+        _344, 
+        /**
+         * Alatna Village
+         */
+        _345, 
+        /**
+         * Native Village of Aleknagik
+         */
+        _346, 
+        /**
+         * Algaaciq Native Village (St. Mary's)
+         */
+        _347, 
+        /**
+         * Allakaket Village
+         */
+        _348, 
+        /**
+         * Native Village of Ambler
+         */
+        _349, 
+        /**
+         * Village of Anaktuvuk Pass
+         */
+        _350, 
+        /**
+         * Yupiit of Andreafski
+         */
+        _351, 
+        /**
+         * Angoon Community Association
+         */
+        _352, 
+        /**
+         * Village of Aniak
+         */
+        _353, 
+        /**
+         * Anvik Village
+         */
+        _354, 
+        /**
+         * Arctic Village (See Native Village of Venetie Trib
+         */
+        _355, 
+        /**
+         * Asa carsarmiut Tribe (formerly Native Village of M
+         */
+        _356, 
+        /**
+         * Native Village of Atka
+         */
+        _357, 
+        /**
+         * Village of Atmautluak
+         */
+        _358, 
+        /**
+         * Atqasuk Village (Atkasook)
+         */
+        _359, 
+        /**
+         * Native Village of Barrow Inupiat Traditional Gover
+         */
+        _360, 
+        /**
+         * Beaver Village
+         */
+        _361, 
+        /**
+         * Native Village of Belkofski
+         */
+        _362, 
+        /**
+         * Village of Bill Moore's Slough
+         */
+        _363, 
+        /**
+         * Birch Creek Tribe
+         */
+        _364, 
+        /**
+         * Native Village of Brevig Mission
+         */
+        _365, 
+        /**
+         * Native Village of Buckland
+         */
+        _366, 
+        /**
+         * Native Village of Cantwell
+         */
+        _367, 
+        /**
+         * Native Village of Chanega (aka Chenega)
+         */
+        _368, 
+        /**
+         * Chalkyitsik Village
+         */
+        _369, 
+        /**
+         * Village of Chefornak
+         */
+        _370, 
+        /**
+         * Chevak Native Village
+         */
+        _371, 
+        /**
+         * Chickaloon Native Village
+         */
+        _372, 
+        /**
+         * Native Village of Chignik
+         */
+        _373, 
+        /**
+         * Native Village of Chignik Lagoon
+         */
+        _374, 
+        /**
+         * Chignik Lake Village
+         */
+        _375, 
+        /**
+         * Chilkat Indian Village (Klukwan)
+         */
+        _376, 
+        /**
+         * Chilkoot Indian Association (Haines)
+         */
+        _377, 
+        /**
+         * Chinik Eskimo Community (Golovin)
+         */
+        _378, 
+        /**
+         * Native Village of Chistochina
+         */
+        _379, 
+        /**
+         * Native Village of Chitina
+         */
+        _380, 
+        /**
+         * Native Village of Chuathbaluk (Russian Mission, Ku
+         */
+        _381, 
+        /**
+         * Chuloonawick Native Village
+         */
+        _382, 
+        /**
+         * Circle Native Community
+         */
+        _383, 
+        /**
+         * Village of Clark's Point
+         */
+        _384, 
+        /**
+         * Native Village of Council
+         */
+        _385, 
+        /**
+         * Craig Community Association
+         */
+        _386, 
+        /**
+         * Village of Crooked Creek
+         */
+        _387, 
+        /**
+         * Curyung Tribal Council (formerly Native Village of
+         */
+        _388, 
+        /**
+         * Native Village of Deering
+         */
+        _389, 
+        /**
+         * Native Village of Diomede (aka Inalik)
+         */
+        _390, 
+        /**
+         * Village of Dot Lake
+         */
+        _391, 
+        /**
+         * Douglas Indian Association
+         */
+        _392, 
+        /**
+         * Native Village of Eagle
+         */
+        _393, 
+        /**
+         * Native Village of Eek
+         */
+        _394, 
+        /**
+         * Egegik Village
+         */
+        _395, 
+        /**
+         * Eklutna Native Village
+         */
+        _396, 
+        /**
+         * Native Village of Ekuk
+         */
+        _397, 
+        /**
+         * Ekwok Village
+         */
+        _398, 
+        /**
+         * Native Village of Elim
+         */
+        _399, 
+        /**
+         * Emmonak Village
+         */
+        _400, 
+        /**
+         * Evansville Village (aka Bettles Field)
+         */
+        _401, 
+        /**
+         * Native Village of Eyak (Cordova)
+         */
+        _402, 
+        /**
+         * Native Village of False Pass
+         */
+        _403, 
+        /**
+         * Native Village of Fort Yukon
+         */
+        _404, 
+        /**
+         * Native Village of Gakona
+         */
+        _405, 
+        /**
+         * Galena Village (aka Louden Village)
+         */
+        _406, 
+        /**
+         * Native Village of Gambell
+         */
+        _407, 
+        /**
+         * Native Village of Georgetown
+         */
+        _408, 
+        /**
+         * Native Village of Goodnews Bay
+         */
+        _409, 
+        /**
+         * Organized Village of Grayling (aka Holikachuk)
+         */
+        _410, 
+        /**
+         * Gulkana Village
+         */
+        _411, 
+        /**
+         * Native Village of Hamilton
+         */
+        _412, 
+        /**
+         * Healy Lake Village
+         */
+        _413, 
+        /**
+         * Holy Cross Village
+         */
+        _414, 
+        /**
+         * Hoonah Indian Association
+         */
+        _415, 
+        /**
+         * Native Village of Hooper Bay
+         */
+        _416, 
+        /**
+         * Hughes Village
+         */
+        _417, 
+        /**
+         * Huslia Village
+         */
+        _418, 
+        /**
+         * Hydaburg Cooperative Association
+         */
+        _419, 
+        /**
+         * Igiugig Village
+         */
+        _420, 
+        /**
+         * Village of Iliamna
+         */
+        _421, 
+        /**
+         * Inupiat Community of the Arctic Slope
+         */
+        _422, 
+        /**
+         * Iqurmuit Traditional Council (formerly Native Vill
+         */
+        _423, 
+        /**
+         * Ivanoff Bay Village
+         */
+        _424, 
+        /**
+         * Kaguyak Village
+         */
+        _425, 
+        /**
+         * Organized Village of Kake
+         */
+        _426, 
+        /**
+         * Kaktovik Village (aka Barter Island)
+         */
+        _427, 
+        /**
+         * Village of Kalskag
+         */
+        _428, 
+        /**
+         * Village of Kaltag
+         */
+        _429, 
+        /**
+         * Native Village of Kanatak
+         */
+        _430, 
+        /**
+         * Native Village of Karluk
+         */
+        _431, 
+        /**
+         * Organized Village of Kasaan
+         */
+        _432, 
+        /**
+         * Native Village of Kasigluk
+         */
+        _433, 
+        /**
+         * Kenaitze Indian Tribe
+         */
+        _434, 
+        /**
+         * Ketchikan Indian Corporation
+         */
+        _435, 
+        /**
+         * Native Village of Kiana
+         */
+        _436, 
+        /**
+         * King Island Native Community
+         */
+        _437, 
+        /**
+         * King Salmon Tribe
+         */
+        _438, 
+        /**
+         * Native Village of Kipnuk
+         */
+        _439, 
+        /**
+         * Native Village of Kivalina
+         */
+        _440, 
+        /**
+         * Klawock Cooperative Association
+         */
+        _441, 
+        /**
+         * Native Village of Kluti Kaah (aka Copper Center)
+         */
+        _442, 
+        /**
+         * Knik Tribe
+         */
+        _443, 
+        /**
+         * Native Village of Kobuk
+         */
+        _444, 
+        /**
+         * Kokhanok Village
+         */
+        _445, 
+        /**
+         * Native Village of Kongiganak
+         */
+        _446, 
+        /**
+         * Village of Kotlik
+         */
+        _447, 
+        /**
+         * Native Village of Kotzebue
+         */
+        _448, 
+        /**
+         * Native Village of Koyuk
+         */
+        _449, 
+        /**
+         * Koyukuk Native Village
+         */
+        _450, 
+        /**
+         * Organized Village of Kwethluk
+         */
+        _451, 
+        /**
+         * Native Village of Kwigillingok
+         */
+        _452, 
+        /**
+         * Native Village of Kwinhagak (aka Quinhagak)
+         */
+        _453, 
+        /**
+         * Native Village of Larsen Bay
+         */
+        _454, 
+        /**
+         * Levelock Village
+         */
+        _455, 
+        /**
+         * Lesnoi Village (aka Woody Island)
+         */
+        _456, 
+        /**
+         * Lime Village
+         */
+        _457, 
+        /**
+         * Village of Lower Kalskag
+         */
+        _458, 
+        /**
+         * Manley Hot Springs Village
+         */
+        _459, 
+        /**
+         * Manokotak Village
+         */
+        _460, 
+        /**
+         * Native Village of Marshall (aka Fortuna Ledge)
+         */
+        _461, 
+        /**
+         * Native Village of Mary's Igloo
+         */
+        _462, 
+        /**
+         * McGrath Native Village
+         */
+        _463, 
+        /**
+         * Native Village of Mekoryuk
+         */
+        _464, 
+        /**
+         * Mentasta Traditional Council
+         */
+        _465, 
+        /**
+         * Metlakatla Indian Community, Annette Island Reserv
+         */
+        _466, 
+        /**
+         * Native Village of Minto
+         */
+        _467, 
+        /**
+         * Naknek Native Village
+         */
+        _468, 
+        /**
+         * Native Village of Nanwalek (aka English Bay)
+         */
+        _469, 
+        /**
+         * Native Village of Napaimute
+         */
+        _470, 
+        /**
+         * Native Village of Napakiak
+         */
+        _471, 
+        /**
+         * Native Village of Napaskiak
+         */
+        _472, 
+        /**
+         * Native Village of Nelson Lagoon
+         */
+        _473, 
+        /**
+         * Nenana Native Association
+         */
+        _474, 
+        /**
+         * New Koliganek Village Council (formerly Koliganek
+         */
+        _475, 
+        /**
+         * New Stuyahok Village
+         */
+        _476, 
+        /**
+         * Newhalen Village
+         */
+        _477, 
+        /**
+         * Newtok Village
+         */
+        _478, 
+        /**
+         * Native Village of Nightmute
+         */
+        _479, 
+        /**
+         * Nikolai Village
+         */
+        _480, 
+        /**
+         * Native Village of Nikolski
+         */
+        _481, 
+        /**
+         * Ninilchik Village
+         */
+        _482, 
+        /**
+         * Native Village of Noatak
+         */
+        _483, 
+        /**
+         * Nome Eskimo Community
+         */
+        _484, 
+        /**
+         * Nondalton Village
+         */
+        _485, 
+        /**
+         * Noorvik Native Community
+         */
+        _486, 
+        /**
+         * Northway Village
+         */
+        _487, 
+        /**
+         * Native Village of Nuiqsut (aka Nooiksut)
+         */
+        _488, 
+        /**
+         * Nulato Village
+         */
+        _489, 
+        /**
+         * Nunakauyarmiut Tribe (formerly Native Village of T
+         */
+        _490, 
+        /**
+         * Native Village of Nunapitchuk
+         */
+        _491, 
+        /**
+         * Village of Ohogamiut
+         */
+        _492, 
+        /**
+         * Village of Old Harbor
+         */
+        _493, 
+        /**
+         * Orutsararmuit Native Village (aka Bethel)
+         */
+        _494, 
+        /**
+         * Oscarville Traditional Village
+         */
+        _495, 
+        /**
+         * Native Village of Ouzinkie
+         */
+        _496, 
+        /**
+         * Native Village of Paimiut
+         */
+        _497, 
+        /**
+         * Pauloff Harbor Village
+         */
+        _498, 
+        /**
+         * Pedro Bay Village
+         */
+        _499, 
+        /**
+         * Native Village of Perryville
+         */
+        _500, 
+        /**
+         * Petersburg Indian Association
+         */
+        _501, 
+        /**
+         * Native Village of Pilot Point
+         */
+        _502, 
+        /**
+         * Pilot Station Traditional Village
+         */
+        _503, 
+        /**
+         * Native Village of Pitka's Point
+         */
+        _504, 
+        /**
+         * Platinum Traditional Village
+         */
+        _505, 
+        /**
+         * Native Village of Point Hope
+         */
+        _506, 
+        /**
+         * Native Village of Point Lay
+         */
+        _507, 
+        /**
+         * Native Village of Port Graham
+         */
+        _508, 
+        /**
+         * Native Village of Port Heiden
+         */
+        _509, 
+        /**
+         * Native Village of Port Lions
+         */
+        _510, 
+        /**
+         * Portage Creek Village (aka Ohgsenakale)
+         */
+        _511, 
+        /**
+         * Pribilof Islands Aleut Communities of St. Paul & S
+         */
+        _512, 
+        /**
+         * Qagan Tayagungin Tribe of Sand Point Village
+         */
+        _513, 
+        /**
+         * Qawalangin Tribe of Unalaska
+         */
+        _514, 
+        /**
+         * Rampart Village
+         */
+        _515, 
+        /**
+         * Village of Red Devil
+         */
+        _516, 
+        /**
+         * Native Village of Ruby
+         */
+        _517, 
+        /**
+         * Saint George Island(See Pribilof Islands Aleut Com
+         */
+        _518, 
+        /**
+         * Native Village of Saint Michael
+         */
+        _519, 
+        /**
+         * Saint Paul Island (See Pribilof Islands Aleut Comm
+         */
+        _520, 
+        /**
+         * Village of Salamatoff
+         */
+        _521, 
+        /**
+         * Native Village of Savoonga
+         */
+        _522, 
+        /**
+         * Organized Village of Saxman
+         */
+        _523, 
+        /**
+         * Native Village of Scammon Bay
+         */
+        _524, 
+        /**
+         * Native Village of Selawik
+         */
+        _525, 
+        /**
+         * Seldovia Village Tribe
+         */
+        _526, 
+        /**
+         * Shageluk Native Village
+         */
+        _527, 
+        /**
+         * Native Village of Shaktoolik
+         */
+        _528, 
+        /**
+         * Native Village of Sheldon's Point
+         */
+        _529, 
+        /**
+         * Native Village of Shishmaref
+         */
+        _530, 
+        /**
+         * Shoonaq Tribe of Kodiak
+         */
+        _531, 
+        /**
+         * Native Village of Shungnak
+         */
+        _532, 
+        /**
+         * Sitka Tribe of Alaska
+         */
+        _533, 
+        /**
+         * Skagway Village
+         */
+        _534, 
+        /**
+         * Village of Sleetmute
+         */
+        _535, 
+        /**
+         * Village of Solomon
+         */
+        _536, 
+        /**
+         * South Naknek Village
+         */
+        _537, 
+        /**
+         * Stebbins Community Association
+         */
+        _538, 
+        /**
+         * Native Village of Stevens
+         */
+        _539, 
+        /**
+         * Village of Stony River
+         */
+        _540, 
+        /**
+         * Takotna Village
+         */
+        _541, 
+        /**
+         * Native Village of Tanacross
+         */
+        _542, 
+        /**
+         * Native Village of Tanana
+         */
+        _543, 
+        /**
+         * Native Village of Tatitlek
+         */
+        _544, 
+        /**
+         * Native Village of Tazlina
+         */
+        _545, 
+        /**
+         * Telida Village
+         */
+        _546, 
+        /**
+         * Native Village of Teller
+         */
+        _547, 
+        /**
+         * Native Village of Tetlin
+         */
+        _548, 
+        /**
+         * Central Council of the Tlingit and Haida Indian Tb
+         */
+        _549, 
+        /**
+         * Traditional Village of Togiak
+         */
+        _550, 
+        /**
+         * Tuluksak Native Community
+         */
+        _551, 
+        /**
+         * Native Village of Tuntutuliak
+         */
+        _552, 
+        /**
+         * Native Village of Tununak
+         */
+        _553, 
+        /**
+         * Twin Hills Village
+         */
+        _554, 
+        /**
+         * Native Village of Tyonek
+         */
+        _555, 
+        /**
+         * Ugashik Village
+         */
+        _556, 
+        /**
+         * Umkumiute Native Village
+         */
+        _557, 
+        /**
+         * Native Village of Unalakleet
+         */
+        _558, 
+        /**
+         * Native Village of Unga
+         */
+        _559, 
+        /**
+         * Village of Venetie (See Native Village of Venetie
+         */
+        _560, 
+        /**
+         * Native Village of Venetie Tribal Government (Arcti
+         */
+        _561, 
+        /**
+         * Village of Wainwright
+         */
+        _562, 
+        /**
+         * Native Village of Wales
+         */
+        _563, 
+        /**
+         * Native Village of White Mountain
+         */
+        _564, 
+        /**
+         * Wrangell Cooperative Association
+         */
+        _565, 
+        /**
+         * Yakutat Tlingit Tribe
+         */
+        _566, 
+        /**
+         * NATIVE ENTITIES WITHIN THE CONTIGUOUS 48 STATES
+         */
+        _NATIVEENTITYCONTIGUOUS, 
+        /**
+         * Absentee-Shawnee Tribe of Indians of Oklahoma
+         */
+        _1, 
+        /**
+         * Assiniboine and Sioux Tribes of the Fort Peck Indi
+         */
+        _10, 
+        /**
+         * Havasupai Tribe of the Havasupai Reservation, Ariz
+         */
+        _100, 
+        /**
+         * Ho-Chunk Nation of Wisconsin (formerly known as th
+         */
+        _101, 
+        /**
+         * Hoh Indian Tribe of the Hoh Indian Reservation, Wa
+         */
+        _102, 
+        /**
+         * Hoopa Valley Tribe, California
+         */
+        _103, 
+        /**
+         * Hopi Tribe of Arizona
+         */
+        _104, 
+        /**
+         * Hopland Band of Pomo Indians of the Hopland Ranche
+         */
+        _105, 
+        /**
+         * Houlton Band of Maliseet Indians of Maine
+         */
+        _106, 
+        /**
+         * Hualapai Indian Tribe of the Hualapai Indian Reser
+         */
+        _107, 
+        /**
+         * Huron Potawatomi, Inc., Michigan
+         */
+        _108, 
+        /**
+         * Inaja Band of Diegueno Mission Indians of the Inaj
+         */
+        _109, 
+        /**
+         * Augustine Band of Cahuilla Mission Indians of the
+         */
+        _11, 
+        /**
+         * Ione Band of Miwok Indians of California
+         */
+        _110, 
+        /**
+         * Iowa Tribe of Kansas and Nebraska
+         */
+        _111, 
+        /**
+         * Iowa Tribe of Oklahoma
+         */
+        _112, 
+        /**
+         * Jackson Rancheria of Me-Wuk Indians of California
+         */
+        _113, 
+        /**
+         * Jamestown S'Klallam Tribe of Washington
+         */
+        _114, 
+        /**
+         * Jamul Indian Village of California
+         */
+        _115, 
+        /**
+         * Jena Band of Choctaw Indians, Louisiana
+         */
+        _116, 
+        /**
+         * Jicarilla Apache Tribe of the Jicarilla Apache Ind
+         */
+        _117, 
+        /**
+         * Kaibab Band of Paiute Indians of the Kaibab Indian
+         */
+        _118, 
+        /**
+         * Kalispel Indian Community of the Kalispel Reservat
+         */
+        _119, 
+        /**
+         * Bad River Band of the Lake Superior Tribe of Chipp
+         */
+        _12, 
+        /**
+         * Karuk Tribe of California
+         */
+        _120, 
+        /**
+         * Kashia Band of Pomo Indians of the Stewarts Point
+         */
+        _121, 
+        /**
+         * Kaw Nation, Oklahoma
+         */
+        _122, 
+        /**
+         * Keweenaw Bay Indian Community of L'Anse and Ontona
+         */
+        _123, 
+        /**
+         * Kialegee Tribal Town, Oklahoma
+         */
+        _124, 
+        /**
+         * Kickapoo Tribe of Indians of the Kickapoo Reservat
+         */
+        _125, 
+        /**
+         * Kickapoo Tribe of Oklahoma
+         */
+        _126, 
+        /**
+         * Kickapoo Traditional Tribe of Texas
+         */
+        _127, 
+        /**
+         * Kiowa Indian Tribe of Oklahoma
+         */
+        _128, 
+        /**
+         * Klamath Indian Tribe of Oregon
+         */
+        _129, 
+        /**
+         * Bay Mills Indian Community of the Sault Ste. Marie
+         */
+        _13, 
+        /**
+         * Kootenai Tribe of Idaho
+         */
+        _130, 
+        /**
+         * La Jolla Band of Luiseno Mission Indians of the La
+         */
+        _131, 
+        /**
+         * La Posta Band of Diegueno Mission Indians of the L
+         */
+        _132, 
+        /**
+         * Lac Courte Oreilles Band of Lake Superior Chippewa
+         */
+        _133, 
+        /**
+         * Lac du Flambeau Band of Lake Superior Chippewa Ind
+         */
+        _134, 
+        /**
+         * Lac Vieux Desert Band of Lake Superior Chippewa In
+         */
+        _135, 
+        /**
+         * Las Vegas Tribe of Paiute Indians of the Las Vegas
+         */
+        _136, 
+        /**
+         * Little River Band of Ottawa Indians of Michigan
+         */
+        _137, 
+        /**
+         * Little Traverse Bay Bands of Odawa Indians of Mich
+         */
+        _138, 
+        /**
+         * Lower Lake Rancheria, California
+         */
+        _139, 
+        /**
+         * Bear River Band of the Rohnerville Rancheria, Cali
+         */
+        _14, 
+        /**
+         * Los Coyotes Band of Cahuilla Mission Indians of th
+         */
+        _140, 
+        /**
+         * Lovelock Paiute Tribe of the Lovelock Indian Colon
+         */
+        _141, 
+        /**
+         * Lower Brule Sioux Tribe of the Lower Brule Reserva
+         */
+        _142, 
+        /**
+         * Lower Elwha Tribal Community of the Lower Elwha Re
+         */
+        _143, 
+        /**
+         * Lower Sioux Indian Community of Minnesota Mdewakan
+         */
+        _144, 
+        /**
+         * Lummi Tribe of the Lummi Reservation, Washington
+         */
+        _145, 
+        /**
+         * Lytton Rancheria of California
+         */
+        _146, 
+        /**
+         * Makah Indian Tribe of the Makah Indian Reservation
+         */
+        _147, 
+        /**
+         * Manchester Band of Pomo Indians of the Manchester-
+         */
+        _148, 
+        /**
+         * Manzanita Band of Diegueno Mission Indians of the
+         */
+        _149, 
+        /**
+         * Berry Creek Rancheria of Maidu Indians of Californ
+         */
+        _15, 
+        /**
+         * Mashantucket Pequot Tribe of Connecticut
+         */
+        _150, 
+        /**
+         * Match-e-be-nash-she-wish Band of Pottawatomi India
+         */
+        _151, 
+        /**
+         * Mechoopda Indian Tribe of Chico Rancheria, Califor
+         */
+        _152, 
+        /**
+         * Menominee Indian Tribe of Wisconsin
+         */
+        _153, 
+        /**
+         * Mesa Grande Band of Diegueno Mission Indians of th
+         */
+        _154, 
+        /**
+         * Mescalero Apache Tribe of the Mescalero Reservatio
+         */
+        _155, 
+        /**
+         * Miami Tribe of Oklahoma
+         */
+        _156, 
+        /**
+         * Miccosukee Tribe of Indians of Florida
+         */
+        _157, 
+        /**
+         * Middletown Rancheria of Pomo Indians of California
+         */
+        _158, 
+        /**
+         * Minnesota Chippewa Tribe, Minnesota (Six component
+         */
+        _159, 
+        /**
+         * Big Lagoon Rancheria, California
+         */
+        _16, 
+        /**
+         * Bois Forte Band (Nett Lake); Fond du Lac Band; Gra
+         */
+        _160, 
+        /**
+         * Mississippi Band of Choctaw Indians, Mississippi
+         */
+        _161, 
+        /**
+         * Moapa Band of Paiute Indians of the Moapa River In
+         */
+        _162, 
+        /**
+         * Modoc Tribe of Oklahoma
+         */
+        _163, 
+        /**
+         * Mohegan Indian Tribe of Connecticut
+         */
+        _164, 
+        /**
+         * Mooretown Rancheria of Maidu Indians of California
+         */
+        _165, 
+        /**
+         * Morongo Band of Cahuilla Mission Indians of the Mo
+         */
+        _166, 
+        /**
+         * Muckleshoot Indian Tribe of the Muckleshoot Reserv
+         */
+        _167, 
+        /**
+         * Muscogee (Creek) Nation, Oklahoma
+         */
+        _168, 
+        /**
+         * Narragansett Indian Tribe of Rhode Island
+         */
+        _169, 
+        /**
+         * Big Pine Band of Owens Valley Paiute Shoshone Indi
+         */
+        _17, 
+        /**
+         * Navajo Nation, Arizona, New Mexico & Utah
+         */
+        _170, 
+        /**
+         * Nez Perce Tribe of Idaho
+         */
+        _171, 
+        /**
+         * Nisqually Indian Tribe of the Nisqually Reservatio
+         */
+        _172, 
+        /**
+         * Nooksack Indian Tribe of Washington
+         */
+        _173, 
+        /**
+         * Northern Cheyenne Tribe of the Northern Cheyenne I
+         */
+        _174, 
+        /**
+         * Northfork Rancheria of Mono Indians of California
+         */
+        _175, 
+        /**
+         * Northwestern Band of Shoshoni Nation of Utah (Wash
+         */
+        _176, 
+        /**
+         * Oglala Sioux Tribe of the Pine Ridge Reservation,
+         */
+        _177, 
+        /**
+         * Omaha Tribe of Nebraska
+         */
+        _178, 
+        /**
+         * Oneida Nation of New York
+         */
+        _179, 
+        /**
+         * Big Sandy Rancheria of Mono Indians of California
+         */
+        _18, 
+        /**
+         * Oneida Tribe of Wisconsin
+         */
+        _180, 
+        /**
+         * Onondaga Nation of New York
+         */
+        _181, 
+        /**
+         * Osage Tribe, Oklahoma
+         */
+        _182, 
+        /**
+         * Ottawa Tribe of Oklahoma
+         */
+        _183, 
+        /**
+         * Otoe-Missouria Tribe of Indians, Oklahoma
+         */
+        _184, 
+        /**
+         * Paiute Indian Tribe of Utah
+         */
+        _185, 
+        /**
+         * Paiute-Shoshone Indians of the Bishop Community of
+         */
+        _186, 
+        /**
+         * Paiute-Shoshone Tribe of the Fallon Reservation an
+         */
+        _187, 
+        /**
+         * Paiute-Shoshone Indians of the Lone Pine Community
+         */
+        _188, 
+        /**
+         * Pala Band of Luiseno Mission Indians of the Pala R
+         */
+        _189, 
+        /**
+         * Big Valley Band of Pomo Indians of the Big Valley
+         */
+        _19, 
+        /**
+         * Pascua Yaqui Tribe of Arizona
+         */
+        _190, 
+        /**
+         * Paskenta Band of Nomlaki Indians of California
+         */
+        _191, 
+        /**
+         * Passamaquoddy Tribe of Maine
+         */
+        _192, 
+        /**
+         * Pauma Band of Luiseno Mission Indians of the Pauma
+         */
+        _193, 
+        /**
+         * Pawnee Nation of Oklahoma
+         */
+        _194, 
+        /**
+         * Pechanga Band of Luiseno Mission Indians of the Pe
+         */
+        _195, 
+        /**
+         * Penobscot Tribe of Maine
+         */
+        _196, 
+        /**
+         * Peoria Tribe of Indians of Oklahoma
+         */
+        _197, 
+        /**
+         * Picayune Rancheria of Chukchansi Indians of Califo
+         */
+        _198, 
+        /**
+         * Pinoleville Rancheria of Pomo Indians of Californi
+         */
+        _199, 
+        /**
+         * Agua Caliente Band of Cahuilla Indians of the Agua
+         */
+        _2, 
+        /**
+         * Blackfeet Tribe of the Blackfeet Indian Reservatio
+         */
+        _20, 
+        /**
+         * Pit River Tribe, California (includes Big Bend, Lo
+         */
+        _200, 
+        /**
+         * Poarch Band of Creek Indians of Alabama
+         */
+        _201, 
+        /**
+         * Pokagon Band of Potawatomi Indians of Michigan
+         */
+        _202, 
+        /**
+         * Ponca Tribe of Indians of Oklahoma
+         */
+        _203, 
+        /**
+         * Ponca Tribe of Nebraska
+         */
+        _204, 
+        /**
+         * Port Gamble Indian Community of the Port Gamble Re
+         */
+        _205, 
+        /**
+         * Potter Valley Rancheria of Pomo Indians of Califor
+         */
+        _206, 
+        /**
+         * Prairie Band of Potawatomi Indians, Kansas
+         */
+        _207, 
+        /**
+         * Prairie Island Indian Community of Minnesota Mdewa
+         */
+        _208, 
+        /**
+         * Pueblo of Acoma, New Mexico
+         */
+        _209, 
+        /**
+         * Blue Lake Rancheria, California
+         */
+        _21, 
+        /**
+         * Pueblo of Cochiti, New Mexico
+         */
+        _210, 
+        /**
+         * Pueblo of Jemez, New Mexico
+         */
+        _211, 
+        /**
+         * Pueblo of Isleta, New Mexico
+         */
+        _212, 
+        /**
+         * Pueblo of Laguna, New Mexico
+         */
+        _213, 
+        /**
+         * Pueblo of Nambe, New Mexico
+         */
+        _214, 
+        /**
+         * Pueblo of Picuris, New Mexico
+         */
+        _215, 
+        /**
+         * Pueblo of Pojoaque, New Mexico
+         */
+        _216, 
+        /**
+         * Pueblo of San Felipe, New Mexico
+         */
+        _217, 
+        /**
+         * Pueblo of San Juan, New Mexico
+         */
+        _218, 
+        /**
+         * Pueblo of San Ildefonso, New Mexico
+         */
+        _219, 
+        /**
+         * Bridgeport Paiute Indian Colony of California
+         */
+        _22, 
+        /**
+         * Pueblo of Sandia, New Mexico
+         */
+        _220, 
+        /**
+         * Pueblo of Santa Ana, New Mexico
+         */
+        _221, 
+        /**
+         * Pueblo of Santa Clara, New Mexico
+         */
+        _222, 
+        /**
+         * Pueblo of Santo Domingo, New Mexico
+         */
+        _223, 
+        /**
+         * Pueblo of Taos, New Mexico
+         */
+        _224, 
+        /**
+         * Pueblo of Tesuque, New Mexico
+         */
+        _225, 
+        /**
+         * Pueblo of Zia, New Mexico
+         */
+        _226, 
+        /**
+         * Puyallup Tribe of the Puyallup Reservation, Washin
+         */
+        _227, 
+        /**
+         * Pyramid Lake Paiute Tribe of the Pyramid Lake Rese
+         */
+        _228, 
+        /**
+         * Quapaw Tribe of Indians, Oklahoma
+         */
+        _229, 
+        /**
+         * Buena Vista Rancheria of Me-Wuk Indians of Califor
+         */
+        _23, 
+        /**
+         * Quartz Valley Indian Community of the Quartz Valle
+         */
+        _230, 
+        /**
+         * Quechan Tribe of the Fort Yuma Indian Reservation,
+         */
+        _231, 
+        /**
+         * Quileute Tribe of the Quileute Reservation, Washin
+         */
+        _232, 
+        /**
+         * Quinault Tribe of the Quinault Reservation, Washin
+         */
+        _233, 
+        /**
+         * Ramona Band or Village of Cahuilla Mission Indians
+         */
+        _234, 
+        /**
+         * Red Cliff Band of Lake Superior Chippewa Indians o
+         */
+        _235, 
+        /**
+         * Red Lake Band of Chippewa Indians of the Red Lake
+         */
+        _236, 
+        /**
+         * Redding Rancheria, California
+         */
+        _237, 
+        /**
+         * Redwood Valley Rancheria of Pomo Indians of Califo
+         */
+        _238, 
+        /**
+         * Reno-Sparks Indian Colony, Nevada
+         */
+        _239, 
+        /**
+         * Burns Paiute Tribe of the Burns Paiute Indian Colo
+         */
+        _24, 
+        /**
+         * Resighini Rancheria, California (formerly known as
+         */
+        _240, 
+        /**
+         * Rincon Band of Luiseno Mission Indians of the Rinc
+         */
+        _241, 
+        /**
+         * Robinson Rancheria of Pomo Indians of California
+         */
+        _242, 
+        /**
+         * Rosebud Sioux Tribe of the Rosebud Indian Reservat
+         */
+        _243, 
+        /**
+         * Round Valley Indian Tribes of the Round Valley Res
+         */
+        _244, 
+        /**
+         * Rumsey Indian Rancheria of Wintun Indians of Calif
+         */
+        _245, 
+        /**
+         * Sac and Fox Tribe of the Mississippi in Iowa
+         */
+        _246, 
+        /**
+         * Sac and Fox Nation of Missouri in Kansas and Nebra
+         */
+        _247, 
+        /**
+         * Sac and Fox Nation, Oklahoma
+         */
+        _248, 
+        /**
+         * Saginaw Chippewa Indian Tribe of Michigan, Isabell
+         */
+        _249, 
+        /**
+         * Cabazon Band of Cahuilla Mission Indians of the Ca
+         */
+        _25, 
+        /**
+         * Salt River Pima-Maricopa Indian Community of the S
+         */
+        _250, 
+        /**
+         * Samish Indian Tribe, Washington
+         */
+        _251, 
+        /**
+         * San Carlos Apache Tribe of the San Carlos Reservat
+         */
+        _252, 
+        /**
+         * San Juan Southern Paiute Tribe of Arizona
+         */
+        _253, 
+        /**
+         * San Manual Band of Serrano Mission Indians of the
+         */
+        _254, 
+        /**
+         * San Pasqual Band of Diegueno Mission Indians of Ca
+         */
+        _255, 
+        /**
+         * Santa Rosa Indian Community of the Santa Rosa Ranc
+         */
+        _256, 
+        /**
+         * Santa Rosa Band of Cahuilla Mission Indians of the
+         */
+        _257, 
+        /**
+         * Santa Ynez Band of Chumash Mission Indians of the
+         */
+        _258, 
+        /**
+         * Santa Ysabel Band of Diegueno Mission Indians of t
+         */
+        _259, 
+        /**
+         * Cachil DeHe Band of Wintun Indians of the Colusa I
+         */
+        _26, 
+        /**
+         * Santee Sioux Tribe of the Santee Reservation of Ne
+         */
+        _260, 
+        /**
+         * Sauk-Suiattle Indian Tribe of Washington
+         */
+        _261, 
+        /**
+         * Sault Ste. Marie Tribe of Chippewa Indians of Mich
+         */
+        _262, 
+        /**
+         * Scotts Valley Band of Pomo Indians of California
+         */
+        _263, 
+        /**
+         * Seminole Nation of Oklahoma
+         */
+        _264, 
+        /**
+         * Seminole Tribe of Florida, Dania, Big Cypress, Bri
+         */
+        _265, 
+        /**
+         * Seneca Nation of New York
+         */
+        _266, 
+        /**
+         * Seneca-Cayuga Tribe of Oklahoma
+         */
+        _267, 
+        /**
+         * Shakopee Mdewakanton Sioux Community of Minnesota
+         */
+        _268, 
+        /**
+         * Shawnee Tribe, Oklahoma
+         */
+        _269, 
+        /**
+         * Caddo Indian Tribe of Oklahoma
+         */
+        _27, 
+        /**
+         * Sherwood Valley Rancheria of Pomo Indians of Calif
+         */
+        _270, 
+        /**
+         * Shingle Springs Band of Miwok Indians, Shingle Spr
+         */
+        _271, 
+        /**
+         * Shoalwater Bay Tribe of the Shoalwater Bay Indian
+         */
+        _272, 
+        /**
+         * Shoshone Tribe of the Wind River Reservation, Wyom
+         */
+        _273, 
+        /**
+         * Shoshone-Bannock Tribes of the Fort Hall Reservati
+         */
+        _274, 
+        /**
+         * Shoshone-Paiute Tribes of the Duck Valley Reservat
+         */
+        _275, 
+        /**
+         * Sisseton-Wahpeton Sioux Tribe of the Lake Traverse
+         */
+        _276, 
+        /**
+         * Skokomish Indian Tribe of the Skokomish Reservatio
+         */
+        _277, 
+        /**
+         * Skull Valley Band of Goshute Indians of Utah
+         */
+        _278, 
+        /**
+         * Smith River Rancheria, California
+         */
+        _279, 
+        /**
+         * Cahuilla Band of Mission Indians of the Cahuilla R
+         */
+        _28, 
+        /**
+         * Snoqualmie Tribe, Washington
+         */
+        _280, 
+        /**
+         * Soboba Band of Luiseno Indians, California (former
+         */
+        _281, 
+        /**
+         * Sokaogon Chippewa Community of the Mole Lake Band
+         */
+        _282, 
+        /**
+         * Southern Ute Indian Tribe of the Southern Ute Rese
+         */
+        _283, 
+        /**
+         * Spirit Lake Tribe, North Dakota (formerly known as
+         */
+        _284, 
+        /**
+         * Spokane Tribe of the Spokane Reservation, Washingt
+         */
+        _285, 
+        /**
+         * Squaxin Island Tribe of the Squaxin Island Reserva
+         */
+        _286, 
+        /**
+         * St. Croix Chippewa Indians of Wisconsin, St. Croix
+         */
+        _287, 
+        /**
+         * St. Regis Band of Mohawk Indians of New York
+         */
+        _288, 
+        /**
+         * Standing Rock Sioux Tribe of North & South Dakota
+         */
+        _289, 
+        /**
+         * Cahto Indian Tribe of the Laytonville Rancheria, C
+         */
+        _29, 
+        /**
+         * Stockbridge-Munsee Community of Mohican Indians of
+         */
+        _290, 
+        /**
+         * Stillaguamish Tribe of Washington
+         */
+        _291, 
+        /**
+         * Summit Lake Paiute Tribe of Nevada
+         */
+        _292, 
+        /**
+         * Suquamish Indian Tribe of the Port Madison Reserva
+         */
+        _293, 
+        /**
+         * Susanville Indian Rancheria, California
+         */
+        _294, 
+        /**
+         * Swinomish Indians of the Swinomish Reservation, Wa
+         */
+        _295, 
+        /**
+         * Sycuan Band of Diegueno Mission Indians of Califor
+         */
+        _296, 
+        /**
+         * Table Bluff Reservation - Wiyot Tribe, California
+         */
+        _297, 
+        /**
+         * Table Mountain Rancheria of California
+         */
+        _298, 
+        /**
+         * Te-Moak Tribe of Western Shoshone Indians of Nevad
+         */
+        _299, 
+        /**
+         * Ak Chin Indian Community of the Maricopa (Ak Chin)
+         */
+        _3, 
+        /**
+         * California Valley Miwok Tribe, California (formerl
+         */
+        _30, 
+        /**
+         * Thlopthlocco Tribal Town, Oklahoma
+         */
+        _300, 
+        /**
+         * Three Affiliated Tribes of the Fort Berthold Reser
+         */
+        _301, 
+        /**
+         * Tohono O'odham Nation of Arizona
+         */
+        _302, 
+        /**
+         * Tonawanda Band of Seneca Indians of New York
+         */
+        _303, 
+        /**
+         * Tonkawa Tribe of Indians of Oklahoma
+         */
+        _304, 
+        /**
+         * Tonto Apache Tribe of Arizona
+         */
+        _305, 
+        /**
+         * Torres-Martinez Band of Cahuilla Mission Indians o
+         */
+        _306, 
+        /**
+         * Tule River Indian Tribe of the Tule River Reservat
+         */
+        _307, 
+        /**
+         * Tulalip Tribes of the Tulalip Reservation, Washing
+         */
+        _308, 
+        /**
+         * Tunica-Biloxi Indian Tribe of Louisiana
+         */
+        _309, 
+        /**
+         * Campo Band of Diegueno Mission Indians of the Camp
+         */
+        _31, 
+        /**
+         * Tuolumne Band of Me-Wuk Indians of the Tuolumne Ra
+         */
+        _310, 
+        /**
+         * Turtle Mountain Band of Chippewa Indians of North
+         */
+        _311, 
+        /**
+         * Tuscarora Nation of New York
+         */
+        _312, 
+        /**
+         * Twenty-Nine Palms Band of Mission Indians of Calif
+         */
+        _313, 
+        /**
+         * United Auburn Indian Community of the Auburn Ranch
+         */
+        _314, 
+        /**
+         * United Keetoowah Band of Cherokee Indians of Oklah
+         */
+        _315, 
+        /**
+         * Upper Lake Band of Pomo Indians of Upper Lake Ranc
+         */
+        _316, 
+        /**
+         * Upper Sioux Indian Community of the Upper Sioux Re
+         */
+        _317, 
+        /**
+         * Upper Skagit Indian Tribe of Washington
+         */
+        _318, 
+        /**
+         * Ute Indian Tribe of the Uintah & Ouray Reservation
+         */
+        _319, 
+        /**
+         * Capitan Grande Band of Diegueno Mission Indians of
+         */
+        _32, 
+        /**
+         * Ute Mountain Tribe of the Ute Mountain Reservation
+         */
+        _320, 
+        /**
+         * Utu Utu Gwaitu Paiute Tribe of the Benton Paiute R
+         */
+        _321, 
+        /**
+         * Walker River Paiute Tribe of the Walker River Rese
+         */
+        _322, 
+        /**
+         * Wampanoag Tribe of Gay Head (Aquinnah) of Massachu
+         */
+        _323, 
+        /**
+         * Washoe Tribe of Nevada & California (Carson Colony
+         */
+        _324, 
+        /**
+         * White Mountain Apache Tribe of the Fort Apache Res
+         */
+        _325, 
+        /**
+         * Wichita and Affiliated Tribes (Wichita, Keechi, Wa
+         */
+        _326, 
+        /**
+         * Winnebago Tribe of Nebraska
+         */
+        _327, 
+        /**
+         * Winnemucca Indian Colony of Nevada
+         */
+        _328, 
+        /**
+         * Wyandotte Tribe of Oklahoma
+         */
+        _329, 
+        /**
+         * Barona Group of Capitan Grande Band of Mission Ind
+         */
+        _33, 
+        /**
+         * Yankton Sioux Tribe of South Dakota
+         */
+        _330, 
+        /**
+         * Yavapai-Apache Nation of the Camp Verde Indian Res
+         */
+        _331, 
+        /**
+         * Yavapai-Prescott Tribe of the Yavapai Reservation,
+         */
+        _332, 
+        /**
+         * Yerington Paiute Tribe of the Yerington Colony & C
+         */
+        _333, 
+        /**
+         * Yomba Shoshone Tribe of the Yomba Reservation, Nev
+         */
+        _334, 
+        /**
+         * Ysleta Del Sur Pueblo of Texas
+         */
+        _335, 
+        /**
+         * Yurok Tribe of the Yurok Reservation, California
+         */
+        _336, 
+        /**
+         * Zuni Tribe of the Zuni Reservation, New Mexico
+         */
+        _337, 
+        /**
+         * Viejas (Baron Long) Group of Capitan Grande Band o
+         */
+        _34, 
+        /**
+         * Catawba Indian Nation (aka Catawba Tribe of South
+         */
+        _35, 
+        /**
+         * Cayuga Nation of New York
+         */
+        _36, 
+        /**
+         * Cedarville Rancheria, California
+         */
+        _37, 
+        /**
+         * Chemehuevi Indian Tribe of the Chemehuevi Reservat
+         */
+        _38, 
+        /**
+         * Cher-Ae Heights Indian Community of the Trinidad R
+         */
+        _39, 
+        /**
+         * Alabama-Coushatta Tribes of Texas
+         */
+        _4, 
+        /**
+         * Cherokee Nation, Oklahoma
+         */
+        _40, 
+        /**
+         * Cheyenne-Arapaho Tribes of Oklahoma
+         */
+        _41, 
+        /**
+         * Cheyenne River Sioux Tribe of the Cheyenne River R
+         */
+        _42, 
+        /**
+         * Chickasaw Nation, Oklahoma
+         */
+        _43, 
+        /**
+         * Chicken Ranch Rancheria of Me-Wuk Indians of Calif
+         */
+        _44, 
+        /**
+         * Chippewa-Cree Indians of the Rocky Boy's Reservati
+         */
+        _45, 
+        /**
+         * Chitimacha Tribe of Louisiana
+         */
+        _46, 
+        /**
+         * Choctaw Nation of Oklahoma
+         */
+        _47, 
+        /**
+         * Citizen Potawatomi Nation, Oklahoma
+         */
+        _48, 
+        /**
+         * Cloverdale Rancheria of Pomo Indians of California
+         */
+        _49, 
+        /**
+         * Alabama-Quassarte Tribal Town, Oklahoma
+         */
+        _5, 
+        /**
+         * Cocopah Tribe of Arizona
+         */
+        _50, 
+        /**
+         * Coeur D'Alene Tribe of the Coeur D'Alene Reservati
+         */
+        _51, 
+        /**
+         * Cold Springs Rancheria of Mono Indians of Californ
+         */
+        _52, 
+        /**
+         * Colorado River Indian Tribes of the Colorado River
+         */
+        _53, 
+        /**
+         * Comanche Indian Tribe, Oklahoma
+         */
+        _54, 
+        /**
+         * Confederated Salish & Kootenai Tribes of the Flath
+         */
+        _55, 
+        /**
+         * Confederated Tribes of the Chehalis Reservation, W
+         */
+        _56, 
+        /**
+         * Confederated Tribes of the Colville Reservation, W
+         */
+        _57, 
+        /**
+         * Confederated Tribes of the Coos, Lower Umpqua and
+         */
+        _58, 
+        /**
+         * Confederated Tribes of the Goshute Reservation, Ne
+         */
+        _59, 
+        /**
+         * Alturas Indian Rancheria, California
+         */
+        _6, 
+        /**
+         * Confederated Tribes of the Grand Ronde Community o
+         */
+        _60, 
+        /**
+         * Confederated Tribes of the Siletz Reservation, Ore
+         */
+        _61, 
+        /**
+         * Confederated Tribes of the Umatilla Reservation, O
+         */
+        _62, 
+        /**
+         * Confederated Tribes of the Warm Springs Reservatio
+         */
+        _63, 
+        /**
+         * Confederated Tribes and Bands of the Yakama Indian
+         */
+        _64, 
+        /**
+         * Coquille Tribe of Oregon
+         */
+        _65, 
+        /**
+         * Cortina Indian Rancheria of Wintun Indians of Cali
+         */
+        _66, 
+        /**
+         * Coushatta Tribe of Louisiana
+         */
+        _67, 
+        /**
+         * Cow Creek Band of Umpqua Indians of Oregon
+         */
+        _68, 
+        /**
+         * Coyote Valley Band of Pomo Indians of California
+         */
+        _69, 
+        /**
+         * Apache Tribe of Oklahoma
+         */
+        _7, 
+        /**
+         * Crow Tribe of Montana
+         */
+        _70, 
+        /**
+         * Crow Creek Sioux Tribe of the Crow Creek Reservati
+         */
+        _71, 
+        /**
+         * Cuyapaipe Community of Diegueno Mission Indians of
+         */
+        _72, 
+        /**
+         * Death Valley Timbi-Sha Shoshone Band of California
+         */
+        _73, 
+        /**
+         * Delaware Nation, Oklahoma (formerly Delaware Tribe
+         */
+        _74, 
+        /**
+         * Delaware Tribe of Indians, Oklahoma
+         */
+        _75, 
+        /**
+         * Dry Creek Rancheria of Pomo Indians of California
+         */
+        _76, 
+        /**
+         * Duckwater Shoshone Tribe of the Duckwater Reservat
+         */
+        _77, 
+        /**
+         * Eastern Band of Cherokee Indians of North Carolina
+         */
+        _78, 
+        /**
+         * Eastern Shawnee Tribe of Oklahoma
+         */
+        _79, 
+        /**
+         * Arapahoe Tribe of the Wind River Reservation, Wyom
+         */
+        _8, 
+        /**
+         * Elem Indian Colony of Pomo Indians of the Sulphur
+         */
+        _80, 
+        /**
+         * Elk Valley Rancheria, California
+         */
+        _81, 
+        /**
+         * Ely Shoshone Tribe of Nevada
+         */
+        _82, 
+        /**
+         * Enterprise Rancheria of Maidu Indians of Californi
+         */
+        _83, 
+        /**
+         * Flandreau Santee Sioux Tribe of South Dakota
+         */
+        _84, 
+        /**
+         * Forest County Potawatomi Community of Wisconsin Po
+         */
+        _85, 
+        /**
+         * Fort Belknap Indian Community of the Fort Belknap
+         */
+        _86, 
+        /**
+         * Fort Bidwell Indian Community of the Fort Bidwell
+         */
+        _87, 
+        /**
+         * Fort Independence Indian Community of Paiute India
+         */
+        _88, 
+        /**
+         * Fort McDermitt Paiute and Shoshone Tribes of the F
+         */
+        _89, 
+        /**
+         * Aroostook Band of Micmac Indians of Maine
+         */
+        _9, 
+        /**
+         * Fort McDowell Yavapai Nation, Arizona (formerly th
+         */
+        _90, 
+        /**
+         * Fort Mojave Indian Tribe of Arizona, California
+         */
+        _91, 
+        /**
+         * Fort Sill Apache Tribe of Oklahoma
+         */
+        _92, 
+        /**
+         * Gila River Indian Community of the Gila River Indi
+         */
+        _93, 
+        /**
+         * Grand Traverse Band of Ottawa & Chippewa Indians o
+         */
+        _94, 
+        /**
+         * Graton Rancheria, California
+         */
+        _95, 
+        /**
+         * Greenville Rancheria of Maidu Indians of Californi
+         */
+        _96, 
+        /**
+         * Grindstone Indian Rancheria of Wintun-Wailaki Indi
+         */
+        _97, 
+        /**
+         * Guidiville Rancheria of California
+         */
+        _98, 
+        /**
+         * Hannahville Indian Community of Wisconsin Potawato
+         */
+        _99, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3TribalEntityUS fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("_NativeEntityAlaska".equals(codeString))
+          return _NATIVEENTITYALASKA;
+        if ("338".equals(codeString))
+          return _338;
+        if ("339".equals(codeString))
+          return _339;
+        if ("340".equals(codeString))
+          return _340;
+        if ("341".equals(codeString))
+          return _341;
+        if ("342".equals(codeString))
+          return _342;
+        if ("343".equals(codeString))
+          return _343;
+        if ("344".equals(codeString))
+          return _344;
+        if ("345".equals(codeString))
+          return _345;
+        if ("346".equals(codeString))
+          return _346;
+        if ("347".equals(codeString))
+          return _347;
+        if ("348".equals(codeString))
+          return _348;
+        if ("349".equals(codeString))
+          return _349;
+        if ("350".equals(codeString))
+          return _350;
+        if ("351".equals(codeString))
+          return _351;
+        if ("352".equals(codeString))
+          return _352;
+        if ("353".equals(codeString))
+          return _353;
+        if ("354".equals(codeString))
+          return _354;
+        if ("355".equals(codeString))
+          return _355;
+        if ("356".equals(codeString))
+          return _356;
+        if ("357".equals(codeString))
+          return _357;
+        if ("358".equals(codeString))
+          return _358;
+        if ("359".equals(codeString))
+          return _359;
+        if ("360".equals(codeString))
+          return _360;
+        if ("361".equals(codeString))
+          return _361;
+        if ("362".equals(codeString))
+          return _362;
+        if ("363".equals(codeString))
+          return _363;
+        if ("364".equals(codeString))
+          return _364;
+        if ("365".equals(codeString))
+          return _365;
+        if ("366".equals(codeString))
+          return _366;
+        if ("367".equals(codeString))
+          return _367;
+        if ("368".equals(codeString))
+          return _368;
+        if ("369".equals(codeString))
+          return _369;
+        if ("370".equals(codeString))
+          return _370;
+        if ("371".equals(codeString))
+          return _371;
+        if ("372".equals(codeString))
+          return _372;
+        if ("373".equals(codeString))
+          return _373;
+        if ("374".equals(codeString))
+          return _374;
+        if ("375".equals(codeString))
+          return _375;
+        if ("376".equals(codeString))
+          return _376;
+        if ("377".equals(codeString))
+          return _377;
+        if ("378".equals(codeString))
+          return _378;
+        if ("379".equals(codeString))
+          return _379;
+        if ("380".equals(codeString))
+          return _380;
+        if ("381".equals(codeString))
+          return _381;
+        if ("382".equals(codeString))
+          return _382;
+        if ("383".equals(codeString))
+          return _383;
+        if ("384".equals(codeString))
+          return _384;
+        if ("385".equals(codeString))
+          return _385;
+        if ("386".equals(codeString))
+          return _386;
+        if ("387".equals(codeString))
+          return _387;
+        if ("388".equals(codeString))
+          return _388;
+        if ("389".equals(codeString))
+          return _389;
+        if ("390".equals(codeString))
+          return _390;
+        if ("391".equals(codeString))
+          return _391;
+        if ("392".equals(codeString))
+          return _392;
+        if ("393".equals(codeString))
+          return _393;
+        if ("394".equals(codeString))
+          return _394;
+        if ("395".equals(codeString))
+          return _395;
+        if ("396".equals(codeString))
+          return _396;
+        if ("397".equals(codeString))
+          return _397;
+        if ("398".equals(codeString))
+          return _398;
+        if ("399".equals(codeString))
+          return _399;
+        if ("400".equals(codeString))
+          return _400;
+        if ("401".equals(codeString))
+          return _401;
+        if ("402".equals(codeString))
+          return _402;
+        if ("403".equals(codeString))
+          return _403;
+        if ("404".equals(codeString))
+          return _404;
+        if ("405".equals(codeString))
+          return _405;
+        if ("406".equals(codeString))
+          return _406;
+        if ("407".equals(codeString))
+          return _407;
+        if ("408".equals(codeString))
+          return _408;
+        if ("409".equals(codeString))
+          return _409;
+        if ("410".equals(codeString))
+          return _410;
+        if ("411".equals(codeString))
+          return _411;
+        if ("412".equals(codeString))
+          return _412;
+        if ("413".equals(codeString))
+          return _413;
+        if ("414".equals(codeString))
+          return _414;
+        if ("415".equals(codeString))
+          return _415;
+        if ("416".equals(codeString))
+          return _416;
+        if ("417".equals(codeString))
+          return _417;
+        if ("418".equals(codeString))
+          return _418;
+        if ("419".equals(codeString))
+          return _419;
+        if ("420".equals(codeString))
+          return _420;
+        if ("421".equals(codeString))
+          return _421;
+        if ("422".equals(codeString))
+          return _422;
+        if ("423".equals(codeString))
+          return _423;
+        if ("424".equals(codeString))
+          return _424;
+        if ("425".equals(codeString))
+          return _425;
+        if ("426".equals(codeString))
+          return _426;
+        if ("427".equals(codeString))
+          return _427;
+        if ("428".equals(codeString))
+          return _428;
+        if ("429".equals(codeString))
+          return _429;
+        if ("430".equals(codeString))
+          return _430;
+        if ("431".equals(codeString))
+          return _431;
+        if ("432".equals(codeString))
+          return _432;
+        if ("433".equals(codeString))
+          return _433;
+        if ("434".equals(codeString))
+          return _434;
+        if ("435".equals(codeString))
+          return _435;
+        if ("436".equals(codeString))
+          return _436;
+        if ("437".equals(codeString))
+          return _437;
+        if ("438".equals(codeString))
+          return _438;
+        if ("439".equals(codeString))
+          return _439;
+        if ("440".equals(codeString))
+          return _440;
+        if ("441".equals(codeString))
+          return _441;
+        if ("442".equals(codeString))
+          return _442;
+        if ("443".equals(codeString))
+          return _443;
+        if ("444".equals(codeString))
+          return _444;
+        if ("445".equals(codeString))
+          return _445;
+        if ("446".equals(codeString))
+          return _446;
+        if ("447".equals(codeString))
+          return _447;
+        if ("448".equals(codeString))
+          return _448;
+        if ("449".equals(codeString))
+          return _449;
+        if ("450".equals(codeString))
+          return _450;
+        if ("451".equals(codeString))
+          return _451;
+        if ("452".equals(codeString))
+          return _452;
+        if ("453".equals(codeString))
+          return _453;
+        if ("454".equals(codeString))
+          return _454;
+        if ("455".equals(codeString))
+          return _455;
+        if ("456".equals(codeString))
+          return _456;
+        if ("457".equals(codeString))
+          return _457;
+        if ("458".equals(codeString))
+          return _458;
+        if ("459".equals(codeString))
+          return _459;
+        if ("460".equals(codeString))
+          return _460;
+        if ("461".equals(codeString))
+          return _461;
+        if ("462".equals(codeString))
+          return _462;
+        if ("463".equals(codeString))
+          return _463;
+        if ("464".equals(codeString))
+          return _464;
+        if ("465".equals(codeString))
+          return _465;
+        if ("466".equals(codeString))
+          return _466;
+        if ("467".equals(codeString))
+          return _467;
+        if ("468".equals(codeString))
+          return _468;
+        if ("469".equals(codeString))
+          return _469;
+        if ("470".equals(codeString))
+          return _470;
+        if ("471".equals(codeString))
+          return _471;
+        if ("472".equals(codeString))
+          return _472;
+        if ("473".equals(codeString))
+          return _473;
+        if ("474".equals(codeString))
+          return _474;
+        if ("475".equals(codeString))
+          return _475;
+        if ("476".equals(codeString))
+          return _476;
+        if ("477".equals(codeString))
+          return _477;
+        if ("478".equals(codeString))
+          return _478;
+        if ("479".equals(codeString))
+          return _479;
+        if ("480".equals(codeString))
+          return _480;
+        if ("481".equals(codeString))
+          return _481;
+        if ("482".equals(codeString))
+          return _482;
+        if ("483".equals(codeString))
+          return _483;
+        if ("484".equals(codeString))
+          return _484;
+        if ("485".equals(codeString))
+          return _485;
+        if ("486".equals(codeString))
+          return _486;
+        if ("487".equals(codeString))
+          return _487;
+        if ("488".equals(codeString))
+          return _488;
+        if ("489".equals(codeString))
+          return _489;
+        if ("490".equals(codeString))
+          return _490;
+        if ("491".equals(codeString))
+          return _491;
+        if ("492".equals(codeString))
+          return _492;
+        if ("493".equals(codeString))
+          return _493;
+        if ("494".equals(codeString))
+          return _494;
+        if ("495".equals(codeString))
+          return _495;
+        if ("496".equals(codeString))
+          return _496;
+        if ("497".equals(codeString))
+          return _497;
+        if ("498".equals(codeString))
+          return _498;
+        if ("499".equals(codeString))
+          return _499;
+        if ("500".equals(codeString))
+          return _500;
+        if ("501".equals(codeString))
+          return _501;
+        if ("502".equals(codeString))
+          return _502;
+        if ("503".equals(codeString))
+          return _503;
+        if ("504".equals(codeString))
+          return _504;
+        if ("505".equals(codeString))
+          return _505;
+        if ("506".equals(codeString))
+          return _506;
+        if ("507".equals(codeString))
+          return _507;
+        if ("508".equals(codeString))
+          return _508;
+        if ("509".equals(codeString))
+          return _509;
+        if ("510".equals(codeString))
+          return _510;
+        if ("511".equals(codeString))
+          return _511;
+        if ("512".equals(codeString))
+          return _512;
+        if ("513".equals(codeString))
+          return _513;
+        if ("514".equals(codeString))
+          return _514;
+        if ("515".equals(codeString))
+          return _515;
+        if ("516".equals(codeString))
+          return _516;
+        if ("517".equals(codeString))
+          return _517;
+        if ("518".equals(codeString))
+          return _518;
+        if ("519".equals(codeString))
+          return _519;
+        if ("520".equals(codeString))
+          return _520;
+        if ("521".equals(codeString))
+          return _521;
+        if ("522".equals(codeString))
+          return _522;
+        if ("523".equals(codeString))
+          return _523;
+        if ("524".equals(codeString))
+          return _524;
+        if ("525".equals(codeString))
+          return _525;
+        if ("526".equals(codeString))
+          return _526;
+        if ("527".equals(codeString))
+          return _527;
+        if ("528".equals(codeString))
+          return _528;
+        if ("529".equals(codeString))
+          return _529;
+        if ("530".equals(codeString))
+          return _530;
+        if ("531".equals(codeString))
+          return _531;
+        if ("532".equals(codeString))
+          return _532;
+        if ("533".equals(codeString))
+          return _533;
+        if ("534".equals(codeString))
+          return _534;
+        if ("535".equals(codeString))
+          return _535;
+        if ("536".equals(codeString))
+          return _536;
+        if ("537".equals(codeString))
+          return _537;
+        if ("538".equals(codeString))
+          return _538;
+        if ("539".equals(codeString))
+          return _539;
+        if ("540".equals(codeString))
+          return _540;
+        if ("541".equals(codeString))
+          return _541;
+        if ("542".equals(codeString))
+          return _542;
+        if ("543".equals(codeString))
+          return _543;
+        if ("544".equals(codeString))
+          return _544;
+        if ("545".equals(codeString))
+          return _545;
+        if ("546".equals(codeString))
+          return _546;
+        if ("547".equals(codeString))
+          return _547;
+        if ("548".equals(codeString))
+          return _548;
+        if ("549".equals(codeString))
+          return _549;
+        if ("550".equals(codeString))
+          return _550;
+        if ("551".equals(codeString))
+          return _551;
+        if ("552".equals(codeString))
+          return _552;
+        if ("553".equals(codeString))
+          return _553;
+        if ("554".equals(codeString))
+          return _554;
+        if ("555".equals(codeString))
+          return _555;
+        if ("556".equals(codeString))
+          return _556;
+        if ("557".equals(codeString))
+          return _557;
+        if ("558".equals(codeString))
+          return _558;
+        if ("559".equals(codeString))
+          return _559;
+        if ("560".equals(codeString))
+          return _560;
+        if ("561".equals(codeString))
+          return _561;
+        if ("562".equals(codeString))
+          return _562;
+        if ("563".equals(codeString))
+          return _563;
+        if ("564".equals(codeString))
+          return _564;
+        if ("565".equals(codeString))
+          return _565;
+        if ("566".equals(codeString))
+          return _566;
+        if ("_NativeEntityContiguous".equals(codeString))
+          return _NATIVEENTITYCONTIGUOUS;
+        if ("1".equals(codeString))
+          return _1;
+        if ("10".equals(codeString))
+          return _10;
+        if ("100".equals(codeString))
+          return _100;
+        if ("101".equals(codeString))
+          return _101;
+        if ("102".equals(codeString))
+          return _102;
+        if ("103".equals(codeString))
+          return _103;
+        if ("104".equals(codeString))
+          return _104;
+        if ("105".equals(codeString))
+          return _105;
+        if ("106".equals(codeString))
+          return _106;
+        if ("107".equals(codeString))
+          return _107;
+        if ("108".equals(codeString))
+          return _108;
+        if ("109".equals(codeString))
+          return _109;
+        if ("11".equals(codeString))
+          return _11;
+        if ("110".equals(codeString))
+          return _110;
+        if ("111".equals(codeString))
+          return _111;
+        if ("112".equals(codeString))
+          return _112;
+        if ("113".equals(codeString))
+          return _113;
+        if ("114".equals(codeString))
+          return _114;
+        if ("115".equals(codeString))
+          return _115;
+        if ("116".equals(codeString))
+          return _116;
+        if ("117".equals(codeString))
+          return _117;
+        if ("118".equals(codeString))
+          return _118;
+        if ("119".equals(codeString))
+          return _119;
+        if ("12".equals(codeString))
+          return _12;
+        if ("120".equals(codeString))
+          return _120;
+        if ("121".equals(codeString))
+          return _121;
+        if ("122".equals(codeString))
+          return _122;
+        if ("123".equals(codeString))
+          return _123;
+        if ("124".equals(codeString))
+          return _124;
+        if ("125".equals(codeString))
+          return _125;
+        if ("126".equals(codeString))
+          return _126;
+        if ("127".equals(codeString))
+          return _127;
+        if ("128".equals(codeString))
+          return _128;
+        if ("129".equals(codeString))
+          return _129;
+        if ("13".equals(codeString))
+          return _13;
+        if ("130".equals(codeString))
+          return _130;
+        if ("131".equals(codeString))
+          return _131;
+        if ("132".equals(codeString))
+          return _132;
+        if ("133".equals(codeString))
+          return _133;
+        if ("134".equals(codeString))
+          return _134;
+        if ("135".equals(codeString))
+          return _135;
+        if ("136".equals(codeString))
+          return _136;
+        if ("137".equals(codeString))
+          return _137;
+        if ("138".equals(codeString))
+          return _138;
+        if ("139".equals(codeString))
+          return _139;
+        if ("14".equals(codeString))
+          return _14;
+        if ("140".equals(codeString))
+          return _140;
+        if ("141".equals(codeString))
+          return _141;
+        if ("142".equals(codeString))
+          return _142;
+        if ("143".equals(codeString))
+          return _143;
+        if ("144".equals(codeString))
+          return _144;
+        if ("145".equals(codeString))
+          return _145;
+        if ("146".equals(codeString))
+          return _146;
+        if ("147".equals(codeString))
+          return _147;
+        if ("148".equals(codeString))
+          return _148;
+        if ("149".equals(codeString))
+          return _149;
+        if ("15".equals(codeString))
+          return _15;
+        if ("150".equals(codeString))
+          return _150;
+        if ("151".equals(codeString))
+          return _151;
+        if ("152".equals(codeString))
+          return _152;
+        if ("153".equals(codeString))
+          return _153;
+        if ("154".equals(codeString))
+          return _154;
+        if ("155".equals(codeString))
+          return _155;
+        if ("156".equals(codeString))
+          return _156;
+        if ("157".equals(codeString))
+          return _157;
+        if ("158".equals(codeString))
+          return _158;
+        if ("159".equals(codeString))
+          return _159;
+        if ("16".equals(codeString))
+          return _16;
+        if ("160".equals(codeString))
+          return _160;
+        if ("161".equals(codeString))
+          return _161;
+        if ("162".equals(codeString))
+          return _162;
+        if ("163".equals(codeString))
+          return _163;
+        if ("164".equals(codeString))
+          return _164;
+        if ("165".equals(codeString))
+          return _165;
+        if ("166".equals(codeString))
+          return _166;
+        if ("167".equals(codeString))
+          return _167;
+        if ("168".equals(codeString))
+          return _168;
+        if ("169".equals(codeString))
+          return _169;
+        if ("17".equals(codeString))
+          return _17;
+        if ("170".equals(codeString))
+          return _170;
+        if ("171".equals(codeString))
+          return _171;
+        if ("172".equals(codeString))
+          return _172;
+        if ("173".equals(codeString))
+          return _173;
+        if ("174".equals(codeString))
+          return _174;
+        if ("175".equals(codeString))
+          return _175;
+        if ("176".equals(codeString))
+          return _176;
+        if ("177".equals(codeString))
+          return _177;
+        if ("178".equals(codeString))
+          return _178;
+        if ("179".equals(codeString))
+          return _179;
+        if ("18".equals(codeString))
+          return _18;
+        if ("180".equals(codeString))
+          return _180;
+        if ("181".equals(codeString))
+          return _181;
+        if ("182".equals(codeString))
+          return _182;
+        if ("183".equals(codeString))
+          return _183;
+        if ("184".equals(codeString))
+          return _184;
+        if ("185".equals(codeString))
+          return _185;
+        if ("186".equals(codeString))
+          return _186;
+        if ("187".equals(codeString))
+          return _187;
+        if ("188".equals(codeString))
+          return _188;
+        if ("189".equals(codeString))
+          return _189;
+        if ("19".equals(codeString))
+          return _19;
+        if ("190".equals(codeString))
+          return _190;
+        if ("191".equals(codeString))
+          return _191;
+        if ("192".equals(codeString))
+          return _192;
+        if ("193".equals(codeString))
+          return _193;
+        if ("194".equals(codeString))
+          return _194;
+        if ("195".equals(codeString))
+          return _195;
+        if ("196".equals(codeString))
+          return _196;
+        if ("197".equals(codeString))
+          return _197;
+        if ("198".equals(codeString))
+          return _198;
+        if ("199".equals(codeString))
+          return _199;
+        if ("2".equals(codeString))
+          return _2;
+        if ("20".equals(codeString))
+          return _20;
+        if ("200".equals(codeString))
+          return _200;
+        if ("201".equals(codeString))
+          return _201;
+        if ("202".equals(codeString))
+          return _202;
+        if ("203".equals(codeString))
+          return _203;
+        if ("204".equals(codeString))
+          return _204;
+        if ("205".equals(codeString))
+          return _205;
+        if ("206".equals(codeString))
+          return _206;
+        if ("207".equals(codeString))
+          return _207;
+        if ("208".equals(codeString))
+          return _208;
+        if ("209".equals(codeString))
+          return _209;
+        if ("21".equals(codeString))
+          return _21;
+        if ("210".equals(codeString))
+          return _210;
+        if ("211".equals(codeString))
+          return _211;
+        if ("212".equals(codeString))
+          return _212;
+        if ("213".equals(codeString))
+          return _213;
+        if ("214".equals(codeString))
+          return _214;
+        if ("215".equals(codeString))
+          return _215;
+        if ("216".equals(codeString))
+          return _216;
+        if ("217".equals(codeString))
+          return _217;
+        if ("218".equals(codeString))
+          return _218;
+        if ("219".equals(codeString))
+          return _219;
+        if ("22".equals(codeString))
+          return _22;
+        if ("220".equals(codeString))
+          return _220;
+        if ("221".equals(codeString))
+          return _221;
+        if ("222".equals(codeString))
+          return _222;
+        if ("223".equals(codeString))
+          return _223;
+        if ("224".equals(codeString))
+          return _224;
+        if ("225".equals(codeString))
+          return _225;
+        if ("226".equals(codeString))
+          return _226;
+        if ("227".equals(codeString))
+          return _227;
+        if ("228".equals(codeString))
+          return _228;
+        if ("229".equals(codeString))
+          return _229;
+        if ("23".equals(codeString))
+          return _23;
+        if ("230".equals(codeString))
+          return _230;
+        if ("231".equals(codeString))
+          return _231;
+        if ("232".equals(codeString))
+          return _232;
+        if ("233".equals(codeString))
+          return _233;
+        if ("234".equals(codeString))
+          return _234;
+        if ("235".equals(codeString))
+          return _235;
+        if ("236".equals(codeString))
+          return _236;
+        if ("237".equals(codeString))
+          return _237;
+        if ("238".equals(codeString))
+          return _238;
+        if ("239".equals(codeString))
+          return _239;
+        if ("24".equals(codeString))
+          return _24;
+        if ("240".equals(codeString))
+          return _240;
+        if ("241".equals(codeString))
+          return _241;
+        if ("242".equals(codeString))
+          return _242;
+        if ("243".equals(codeString))
+          return _243;
+        if ("244".equals(codeString))
+          return _244;
+        if ("245".equals(codeString))
+          return _245;
+        if ("246".equals(codeString))
+          return _246;
+        if ("247".equals(codeString))
+          return _247;
+        if ("248".equals(codeString))
+          return _248;
+        if ("249".equals(codeString))
+          return _249;
+        if ("25".equals(codeString))
+          return _25;
+        if ("250".equals(codeString))
+          return _250;
+        if ("251".equals(codeString))
+          return _251;
+        if ("252".equals(codeString))
+          return _252;
+        if ("253".equals(codeString))
+          return _253;
+        if ("254".equals(codeString))
+          return _254;
+        if ("255".equals(codeString))
+          return _255;
+        if ("256".equals(codeString))
+          return _256;
+        if ("257".equals(codeString))
+          return _257;
+        if ("258".equals(codeString))
+          return _258;
+        if ("259".equals(codeString))
+          return _259;
+        if ("26".equals(codeString))
+          return _26;
+        if ("260".equals(codeString))
+          return _260;
+        if ("261".equals(codeString))
+          return _261;
+        if ("262".equals(codeString))
+          return _262;
+        if ("263".equals(codeString))
+          return _263;
+        if ("264".equals(codeString))
+          return _264;
+        if ("265".equals(codeString))
+          return _265;
+        if ("266".equals(codeString))
+          return _266;
+        if ("267".equals(codeString))
+          return _267;
+        if ("268".equals(codeString))
+          return _268;
+        if ("269".equals(codeString))
+          return _269;
+        if ("27".equals(codeString))
+          return _27;
+        if ("270".equals(codeString))
+          return _270;
+        if ("271".equals(codeString))
+          return _271;
+        if ("272".equals(codeString))
+          return _272;
+        if ("273".equals(codeString))
+          return _273;
+        if ("274".equals(codeString))
+          return _274;
+        if ("275".equals(codeString))
+          return _275;
+        if ("276".equals(codeString))
+          return _276;
+        if ("277".equals(codeString))
+          return _277;
+        if ("278".equals(codeString))
+          return _278;
+        if ("279".equals(codeString))
+          return _279;
+        if ("28".equals(codeString))
+          return _28;
+        if ("280".equals(codeString))
+          return _280;
+        if ("281".equals(codeString))
+          return _281;
+        if ("282".equals(codeString))
+          return _282;
+        if ("283".equals(codeString))
+          return _283;
+        if ("284".equals(codeString))
+          return _284;
+        if ("285".equals(codeString))
+          return _285;
+        if ("286".equals(codeString))
+          return _286;
+        if ("287".equals(codeString))
+          return _287;
+        if ("288".equals(codeString))
+          return _288;
+        if ("289".equals(codeString))
+          return _289;
+        if ("29".equals(codeString))
+          return _29;
+        if ("290".equals(codeString))
+          return _290;
+        if ("291".equals(codeString))
+          return _291;
+        if ("292".equals(codeString))
+          return _292;
+        if ("293".equals(codeString))
+          return _293;
+        if ("294".equals(codeString))
+          return _294;
+        if ("295".equals(codeString))
+          return _295;
+        if ("296".equals(codeString))
+          return _296;
+        if ("297".equals(codeString))
+          return _297;
+        if ("298".equals(codeString))
+          return _298;
+        if ("299".equals(codeString))
+          return _299;
+        if ("3".equals(codeString))
+          return _3;
+        if ("30".equals(codeString))
+          return _30;
+        if ("300".equals(codeString))
+          return _300;
+        if ("301".equals(codeString))
+          return _301;
+        if ("302".equals(codeString))
+          return _302;
+        if ("303".equals(codeString))
+          return _303;
+        if ("304".equals(codeString))
+          return _304;
+        if ("305".equals(codeString))
+          return _305;
+        if ("306".equals(codeString))
+          return _306;
+        if ("307".equals(codeString))
+          return _307;
+        if ("308".equals(codeString))
+          return _308;
+        if ("309".equals(codeString))
+          return _309;
+        if ("31".equals(codeString))
+          return _31;
+        if ("310".equals(codeString))
+          return _310;
+        if ("311".equals(codeString))
+          return _311;
+        if ("312".equals(codeString))
+          return _312;
+        if ("313".equals(codeString))
+          return _313;
+        if ("314".equals(codeString))
+          return _314;
+        if ("315".equals(codeString))
+          return _315;
+        if ("316".equals(codeString))
+          return _316;
+        if ("317".equals(codeString))
+          return _317;
+        if ("318".equals(codeString))
+          return _318;
+        if ("319".equals(codeString))
+          return _319;
+        if ("32".equals(codeString))
+          return _32;
+        if ("320".equals(codeString))
+          return _320;
+        if ("321".equals(codeString))
+          return _321;
+        if ("322".equals(codeString))
+          return _322;
+        if ("323".equals(codeString))
+          return _323;
+        if ("324".equals(codeString))
+          return _324;
+        if ("325".equals(codeString))
+          return _325;
+        if ("326".equals(codeString))
+          return _326;
+        if ("327".equals(codeString))
+          return _327;
+        if ("328".equals(codeString))
+          return _328;
+        if ("329".equals(codeString))
+          return _329;
+        if ("33".equals(codeString))
+          return _33;
+        if ("330".equals(codeString))
+          return _330;
+        if ("331".equals(codeString))
+          return _331;
+        if ("332".equals(codeString))
+          return _332;
+        if ("333".equals(codeString))
+          return _333;
+        if ("334".equals(codeString))
+          return _334;
+        if ("335".equals(codeString))
+          return _335;
+        if ("336".equals(codeString))
+          return _336;
+        if ("337".equals(codeString))
+          return _337;
+        if ("34".equals(codeString))
+          return _34;
+        if ("35".equals(codeString))
+          return _35;
+        if ("36".equals(codeString))
+          return _36;
+        if ("37".equals(codeString))
+          return _37;
+        if ("38".equals(codeString))
+          return _38;
+        if ("39".equals(codeString))
+          return _39;
+        if ("4".equals(codeString))
+          return _4;
+        if ("40".equals(codeString))
+          return _40;
+        if ("41".equals(codeString))
+          return _41;
+        if ("42".equals(codeString))
+          return _42;
+        if ("43".equals(codeString))
+          return _43;
+        if ("44".equals(codeString))
+          return _44;
+        if ("45".equals(codeString))
+          return _45;
+        if ("46".equals(codeString))
+          return _46;
+        if ("47".equals(codeString))
+          return _47;
+        if ("48".equals(codeString))
+          return _48;
+        if ("49".equals(codeString))
+          return _49;
+        if ("5".equals(codeString))
+          return _5;
+        if ("50".equals(codeString))
+          return _50;
+        if ("51".equals(codeString))
+          return _51;
+        if ("52".equals(codeString))
+          return _52;
+        if ("53".equals(codeString))
+          return _53;
+        if ("54".equals(codeString))
+          return _54;
+        if ("55".equals(codeString))
+          return _55;
+        if ("56".equals(codeString))
+          return _56;
+        if ("57".equals(codeString))
+          return _57;
+        if ("58".equals(codeString))
+          return _58;
+        if ("59".equals(codeString))
+          return _59;
+        if ("6".equals(codeString))
+          return _6;
+        if ("60".equals(codeString))
+          return _60;
+        if ("61".equals(codeString))
+          return _61;
+        if ("62".equals(codeString))
+          return _62;
+        if ("63".equals(codeString))
+          return _63;
+        if ("64".equals(codeString))
+          return _64;
+        if ("65".equals(codeString))
+          return _65;
+        if ("66".equals(codeString))
+          return _66;
+        if ("67".equals(codeString))
+          return _67;
+        if ("68".equals(codeString))
+          return _68;
+        if ("69".equals(codeString))
+          return _69;
+        if ("7".equals(codeString))
+          return _7;
+        if ("70".equals(codeString))
+          return _70;
+        if ("71".equals(codeString))
+          return _71;
+        if ("72".equals(codeString))
+          return _72;
+        if ("73".equals(codeString))
+          return _73;
+        if ("74".equals(codeString))
+          return _74;
+        if ("75".equals(codeString))
+          return _75;
+        if ("76".equals(codeString))
+          return _76;
+        if ("77".equals(codeString))
+          return _77;
+        if ("78".equals(codeString))
+          return _78;
+        if ("79".equals(codeString))
+          return _79;
+        if ("8".equals(codeString))
+          return _8;
+        if ("80".equals(codeString))
+          return _80;
+        if ("81".equals(codeString))
+          return _81;
+        if ("82".equals(codeString))
+          return _82;
+        if ("83".equals(codeString))
+          return _83;
+        if ("84".equals(codeString))
+          return _84;
+        if ("85".equals(codeString))
+          return _85;
+        if ("86".equals(codeString))
+          return _86;
+        if ("87".equals(codeString))
+          return _87;
+        if ("88".equals(codeString))
+          return _88;
+        if ("89".equals(codeString))
+          return _89;
+        if ("9".equals(codeString))
+          return _9;
+        if ("90".equals(codeString))
+          return _90;
+        if ("91".equals(codeString))
+          return _91;
+        if ("92".equals(codeString))
+          return _92;
+        if ("93".equals(codeString))
+          return _93;
+        if ("94".equals(codeString))
+          return _94;
+        if ("95".equals(codeString))
+          return _95;
+        if ("96".equals(codeString))
+          return _96;
+        if ("97".equals(codeString))
+          return _97;
+        if ("98".equals(codeString))
+          return _98;
+        if ("99".equals(codeString))
+          return _99;
+        throw new FHIRException("Unknown V3TribalEntityUS code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _NATIVEENTITYALASKA: return "_NativeEntityAlaska";
+            case _338: return "338";
+            case _339: return "339";
+            case _340: return "340";
+            case _341: return "341";
+            case _342: return "342";
+            case _343: return "343";
+            case _344: return "344";
+            case _345: return "345";
+            case _346: return "346";
+            case _347: return "347";
+            case _348: return "348";
+            case _349: return "349";
+            case _350: return "350";
+            case _351: return "351";
+            case _352: return "352";
+            case _353: return "353";
+            case _354: return "354";
+            case _355: return "355";
+            case _356: return "356";
+            case _357: return "357";
+            case _358: return "358";
+            case _359: return "359";
+            case _360: return "360";
+            case _361: return "361";
+            case _362: return "362";
+            case _363: return "363";
+            case _364: return "364";
+            case _365: return "365";
+            case _366: return "366";
+            case _367: return "367";
+            case _368: return "368";
+            case _369: return "369";
+            case _370: return "370";
+            case _371: return "371";
+            case _372: return "372";
+            case _373: return "373";
+            case _374: return "374";
+            case _375: return "375";
+            case _376: return "376";
+            case _377: return "377";
+            case _378: return "378";
+            case _379: return "379";
+            case _380: return "380";
+            case _381: return "381";
+            case _382: return "382";
+            case _383: return "383";
+            case _384: return "384";
+            case _385: return "385";
+            case _386: return "386";
+            case _387: return "387";
+            case _388: return "388";
+            case _389: return "389";
+            case _390: return "390";
+            case _391: return "391";
+            case _392: return "392";
+            case _393: return "393";
+            case _394: return "394";
+            case _395: return "395";
+            case _396: return "396";
+            case _397: return "397";
+            case _398: return "398";
+            case _399: return "399";
+            case _400: return "400";
+            case _401: return "401";
+            case _402: return "402";
+            case _403: return "403";
+            case _404: return "404";
+            case _405: return "405";
+            case _406: return "406";
+            case _407: return "407";
+            case _408: return "408";
+            case _409: return "409";
+            case _410: return "410";
+            case _411: return "411";
+            case _412: return "412";
+            case _413: return "413";
+            case _414: return "414";
+            case _415: return "415";
+            case _416: return "416";
+            case _417: return "417";
+            case _418: return "418";
+            case _419: return "419";
+            case _420: return "420";
+            case _421: return "421";
+            case _422: return "422";
+            case _423: return "423";
+            case _424: return "424";
+            case _425: return "425";
+            case _426: return "426";
+            case _427: return "427";
+            case _428: return "428";
+            case _429: return "429";
+            case _430: return "430";
+            case _431: return "431";
+            case _432: return "432";
+            case _433: return "433";
+            case _434: return "434";
+            case _435: return "435";
+            case _436: return "436";
+            case _437: return "437";
+            case _438: return "438";
+            case _439: return "439";
+            case _440: return "440";
+            case _441: return "441";
+            case _442: return "442";
+            case _443: return "443";
+            case _444: return "444";
+            case _445: return "445";
+            case _446: return "446";
+            case _447: return "447";
+            case _448: return "448";
+            case _449: return "449";
+            case _450: return "450";
+            case _451: return "451";
+            case _452: return "452";
+            case _453: return "453";
+            case _454: return "454";
+            case _455: return "455";
+            case _456: return "456";
+            case _457: return "457";
+            case _458: return "458";
+            case _459: return "459";
+            case _460: return "460";
+            case _461: return "461";
+            case _462: return "462";
+            case _463: return "463";
+            case _464: return "464";
+            case _465: return "465";
+            case _466: return "466";
+            case _467: return "467";
+            case _468: return "468";
+            case _469: return "469";
+            case _470: return "470";
+            case _471: return "471";
+            case _472: return "472";
+            case _473: return "473";
+            case _474: return "474";
+            case _475: return "475";
+            case _476: return "476";
+            case _477: return "477";
+            case _478: return "478";
+            case _479: return "479";
+            case _480: return "480";
+            case _481: return "481";
+            case _482: return "482";
+            case _483: return "483";
+            case _484: return "484";
+            case _485: return "485";
+            case _486: return "486";
+            case _487: return "487";
+            case _488: return "488";
+            case _489: return "489";
+            case _490: return "490";
+            case _491: return "491";
+            case _492: return "492";
+            case _493: return "493";
+            case _494: return "494";
+            case _495: return "495";
+            case _496: return "496";
+            case _497: return "497";
+            case _498: return "498";
+            case _499: return "499";
+            case _500: return "500";
+            case _501: return "501";
+            case _502: return "502";
+            case _503: return "503";
+            case _504: return "504";
+            case _505: return "505";
+            case _506: return "506";
+            case _507: return "507";
+            case _508: return "508";
+            case _509: return "509";
+            case _510: return "510";
+            case _511: return "511";
+            case _512: return "512";
+            case _513: return "513";
+            case _514: return "514";
+            case _515: return "515";
+            case _516: return "516";
+            case _517: return "517";
+            case _518: return "518";
+            case _519: return "519";
+            case _520: return "520";
+            case _521: return "521";
+            case _522: return "522";
+            case _523: return "523";
+            case _524: return "524";
+            case _525: return "525";
+            case _526: return "526";
+            case _527: return "527";
+            case _528: return "528";
+            case _529: return "529";
+            case _530: return "530";
+            case _531: return "531";
+            case _532: return "532";
+            case _533: return "533";
+            case _534: return "534";
+            case _535: return "535";
+            case _536: return "536";
+            case _537: return "537";
+            case _538: return "538";
+            case _539: return "539";
+            case _540: return "540";
+            case _541: return "541";
+            case _542: return "542";
+            case _543: return "543";
+            case _544: return "544";
+            case _545: return "545";
+            case _546: return "546";
+            case _547: return "547";
+            case _548: return "548";
+            case _549: return "549";
+            case _550: return "550";
+            case _551: return "551";
+            case _552: return "552";
+            case _553: return "553";
+            case _554: return "554";
+            case _555: return "555";
+            case _556: return "556";
+            case _557: return "557";
+            case _558: return "558";
+            case _559: return "559";
+            case _560: return "560";
+            case _561: return "561";
+            case _562: return "562";
+            case _563: return "563";
+            case _564: return "564";
+            case _565: return "565";
+            case _566: return "566";
+            case _NATIVEENTITYCONTIGUOUS: return "_NativeEntityContiguous";
+            case _1: return "1";
+            case _10: return "10";
+            case _100: return "100";
+            case _101: return "101";
+            case _102: return "102";
+            case _103: return "103";
+            case _104: return "104";
+            case _105: return "105";
+            case _106: return "106";
+            case _107: return "107";
+            case _108: return "108";
+            case _109: return "109";
+            case _11: return "11";
+            case _110: return "110";
+            case _111: return "111";
+            case _112: return "112";
+            case _113: return "113";
+            case _114: return "114";
+            case _115: return "115";
+            case _116: return "116";
+            case _117: return "117";
+            case _118: return "118";
+            case _119: return "119";
+            case _12: return "12";
+            case _120: return "120";
+            case _121: return "121";
+            case _122: return "122";
+            case _123: return "123";
+            case _124: return "124";
+            case _125: return "125";
+            case _126: return "126";
+            case _127: return "127";
+            case _128: return "128";
+            case _129: return "129";
+            case _13: return "13";
+            case _130: return "130";
+            case _131: return "131";
+            case _132: return "132";
+            case _133: return "133";
+            case _134: return "134";
+            case _135: return "135";
+            case _136: return "136";
+            case _137: return "137";
+            case _138: return "138";
+            case _139: return "139";
+            case _14: return "14";
+            case _140: return "140";
+            case _141: return "141";
+            case _142: return "142";
+            case _143: return "143";
+            case _144: return "144";
+            case _145: return "145";
+            case _146: return "146";
+            case _147: return "147";
+            case _148: return "148";
+            case _149: return "149";
+            case _15: return "15";
+            case _150: return "150";
+            case _151: return "151";
+            case _152: return "152";
+            case _153: return "153";
+            case _154: return "154";
+            case _155: return "155";
+            case _156: return "156";
+            case _157: return "157";
+            case _158: return "158";
+            case _159: return "159";
+            case _16: return "16";
+            case _160: return "160";
+            case _161: return "161";
+            case _162: return "162";
+            case _163: return "163";
+            case _164: return "164";
+            case _165: return "165";
+            case _166: return "166";
+            case _167: return "167";
+            case _168: return "168";
+            case _169: return "169";
+            case _17: return "17";
+            case _170: return "170";
+            case _171: return "171";
+            case _172: return "172";
+            case _173: return "173";
+            case _174: return "174";
+            case _175: return "175";
+            case _176: return "176";
+            case _177: return "177";
+            case _178: return "178";
+            case _179: return "179";
+            case _18: return "18";
+            case _180: return "180";
+            case _181: return "181";
+            case _182: return "182";
+            case _183: return "183";
+            case _184: return "184";
+            case _185: return "185";
+            case _186: return "186";
+            case _187: return "187";
+            case _188: return "188";
+            case _189: return "189";
+            case _19: return "19";
+            case _190: return "190";
+            case _191: return "191";
+            case _192: return "192";
+            case _193: return "193";
+            case _194: return "194";
+            case _195: return "195";
+            case _196: return "196";
+            case _197: return "197";
+            case _198: return "198";
+            case _199: return "199";
+            case _2: return "2";
+            case _20: return "20";
+            case _200: return "200";
+            case _201: return "201";
+            case _202: return "202";
+            case _203: return "203";
+            case _204: return "204";
+            case _205: return "205";
+            case _206: return "206";
+            case _207: return "207";
+            case _208: return "208";
+            case _209: return "209";
+            case _21: return "21";
+            case _210: return "210";
+            case _211: return "211";
+            case _212: return "212";
+            case _213: return "213";
+            case _214: return "214";
+            case _215: return "215";
+            case _216: return "216";
+            case _217: return "217";
+            case _218: return "218";
+            case _219: return "219";
+            case _22: return "22";
+            case _220: return "220";
+            case _221: return "221";
+            case _222: return "222";
+            case _223: return "223";
+            case _224: return "224";
+            case _225: return "225";
+            case _226: return "226";
+            case _227: return "227";
+            case _228: return "228";
+            case _229: return "229";
+            case _23: return "23";
+            case _230: return "230";
+            case _231: return "231";
+            case _232: return "232";
+            case _233: return "233";
+            case _234: return "234";
+            case _235: return "235";
+            case _236: return "236";
+            case _237: return "237";
+            case _238: return "238";
+            case _239: return "239";
+            case _24: return "24";
+            case _240: return "240";
+            case _241: return "241";
+            case _242: return "242";
+            case _243: return "243";
+            case _244: return "244";
+            case _245: return "245";
+            case _246: return "246";
+            case _247: return "247";
+            case _248: return "248";
+            case _249: return "249";
+            case _25: return "25";
+            case _250: return "250";
+            case _251: return "251";
+            case _252: return "252";
+            case _253: return "253";
+            case _254: return "254";
+            case _255: return "255";
+            case _256: return "256";
+            case _257: return "257";
+            case _258: return "258";
+            case _259: return "259";
+            case _26: return "26";
+            case _260: return "260";
+            case _261: return "261";
+            case _262: return "262";
+            case _263: return "263";
+            case _264: return "264";
+            case _265: return "265";
+            case _266: return "266";
+            case _267: return "267";
+            case _268: return "268";
+            case _269: return "269";
+            case _27: return "27";
+            case _270: return "270";
+            case _271: return "271";
+            case _272: return "272";
+            case _273: return "273";
+            case _274: return "274";
+            case _275: return "275";
+            case _276: return "276";
+            case _277: return "277";
+            case _278: return "278";
+            case _279: return "279";
+            case _28: return "28";
+            case _280: return "280";
+            case _281: return "281";
+            case _282: return "282";
+            case _283: return "283";
+            case _284: return "284";
+            case _285: return "285";
+            case _286: return "286";
+            case _287: return "287";
+            case _288: return "288";
+            case _289: return "289";
+            case _29: return "29";
+            case _290: return "290";
+            case _291: return "291";
+            case _292: return "292";
+            case _293: return "293";
+            case _294: return "294";
+            case _295: return "295";
+            case _296: return "296";
+            case _297: return "297";
+            case _298: return "298";
+            case _299: return "299";
+            case _3: return "3";
+            case _30: return "30";
+            case _300: return "300";
+            case _301: return "301";
+            case _302: return "302";
+            case _303: return "303";
+            case _304: return "304";
+            case _305: return "305";
+            case _306: return "306";
+            case _307: return "307";
+            case _308: return "308";
+            case _309: return "309";
+            case _31: return "31";
+            case _310: return "310";
+            case _311: return "311";
+            case _312: return "312";
+            case _313: return "313";
+            case _314: return "314";
+            case _315: return "315";
+            case _316: return "316";
+            case _317: return "317";
+            case _318: return "318";
+            case _319: return "319";
+            case _32: return "32";
+            case _320: return "320";
+            case _321: return "321";
+            case _322: return "322";
+            case _323: return "323";
+            case _324: return "324";
+            case _325: return "325";
+            case _326: return "326";
+            case _327: return "327";
+            case _328: return "328";
+            case _329: return "329";
+            case _33: return "33";
+            case _330: return "330";
+            case _331: return "331";
+            case _332: return "332";
+            case _333: return "333";
+            case _334: return "334";
+            case _335: return "335";
+            case _336: return "336";
+            case _337: return "337";
+            case _34: return "34";
+            case _35: return "35";
+            case _36: return "36";
+            case _37: return "37";
+            case _38: return "38";
+            case _39: return "39";
+            case _4: return "4";
+            case _40: return "40";
+            case _41: return "41";
+            case _42: return "42";
+            case _43: return "43";
+            case _44: return "44";
+            case _45: return "45";
+            case _46: return "46";
+            case _47: return "47";
+            case _48: return "48";
+            case _49: return "49";
+            case _5: return "5";
+            case _50: return "50";
+            case _51: return "51";
+            case _52: return "52";
+            case _53: return "53";
+            case _54: return "54";
+            case _55: return "55";
+            case _56: return "56";
+            case _57: return "57";
+            case _58: return "58";
+            case _59: return "59";
+            case _6: return "6";
+            case _60: return "60";
+            case _61: return "61";
+            case _62: return "62";
+            case _63: return "63";
+            case _64: return "64";
+            case _65: return "65";
+            case _66: return "66";
+            case _67: return "67";
+            case _68: return "68";
+            case _69: return "69";
+            case _7: return "7";
+            case _70: return "70";
+            case _71: return "71";
+            case _72: return "72";
+            case _73: return "73";
+            case _74: return "74";
+            case _75: return "75";
+            case _76: return "76";
+            case _77: return "77";
+            case _78: return "78";
+            case _79: return "79";
+            case _8: return "8";
+            case _80: return "80";
+            case _81: return "81";
+            case _82: return "82";
+            case _83: return "83";
+            case _84: return "84";
+            case _85: return "85";
+            case _86: return "86";
+            case _87: return "87";
+            case _88: return "88";
+            case _89: return "89";
+            case _9: return "9";
+            case _90: return "90";
+            case _91: return "91";
+            case _92: return "92";
+            case _93: return "93";
+            case _94: return "94";
+            case _95: return "95";
+            case _96: return "96";
+            case _97: return "97";
+            case _98: return "98";
+            case _99: return "99";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/TribalEntityUS";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _NATIVEENTITYALASKA: return "NATIVE ENTITIES WITHIN THE STATE OF ALASKA RECOGNIZED AND ELIGIBLE TO RECEIVE SERVICES FROM THE UNITED STATES BUREAU OF INDIAN AFFAIRS";
+            case _338: return "Village of Afognak";
+            case _339: return "Agdaagux Tribe of King Cove";
+            case _340: return "Native Village of Akhiok";
+            case _341: return "Akiachak Native Community";
+            case _342: return "Akiak Native Community";
+            case _343: return "Native Village of Akutan";
+            case _344: return "Village of Alakanuk";
+            case _345: return "Alatna Village";
+            case _346: return "Native Village of Aleknagik";
+            case _347: return "Algaaciq Native Village (St. Mary's)";
+            case _348: return "Allakaket Village";
+            case _349: return "Native Village of Ambler";
+            case _350: return "Village of Anaktuvuk Pass";
+            case _351: return "Yupiit of Andreafski";
+            case _352: return "Angoon Community Association";
+            case _353: return "Village of Aniak";
+            case _354: return "Anvik Village";
+            case _355: return "Arctic Village (See Native Village of Venetie Trib";
+            case _356: return "Asa carsarmiut Tribe (formerly Native Village of M";
+            case _357: return "Native Village of Atka";
+            case _358: return "Village of Atmautluak";
+            case _359: return "Atqasuk Village (Atkasook)";
+            case _360: return "Native Village of Barrow Inupiat Traditional Gover";
+            case _361: return "Beaver Village";
+            case _362: return "Native Village of Belkofski";
+            case _363: return "Village of Bill Moore's Slough";
+            case _364: return "Birch Creek Tribe";
+            case _365: return "Native Village of Brevig Mission";
+            case _366: return "Native Village of Buckland";
+            case _367: return "Native Village of Cantwell";
+            case _368: return "Native Village of Chanega (aka Chenega)";
+            case _369: return "Chalkyitsik Village";
+            case _370: return "Village of Chefornak";
+            case _371: return "Chevak Native Village";
+            case _372: return "Chickaloon Native Village";
+            case _373: return "Native Village of Chignik";
+            case _374: return "Native Village of Chignik Lagoon";
+            case _375: return "Chignik Lake Village";
+            case _376: return "Chilkat Indian Village (Klukwan)";
+            case _377: return "Chilkoot Indian Association (Haines)";
+            case _378: return "Chinik Eskimo Community (Golovin)";
+            case _379: return "Native Village of Chistochina";
+            case _380: return "Native Village of Chitina";
+            case _381: return "Native Village of Chuathbaluk (Russian Mission, Ku";
+            case _382: return "Chuloonawick Native Village";
+            case _383: return "Circle Native Community";
+            case _384: return "Village of Clark's Point";
+            case _385: return "Native Village of Council";
+            case _386: return "Craig Community Association";
+            case _387: return "Village of Crooked Creek";
+            case _388: return "Curyung Tribal Council (formerly Native Village of";
+            case _389: return "Native Village of Deering";
+            case _390: return "Native Village of Diomede (aka Inalik)";
+            case _391: return "Village of Dot Lake";
+            case _392: return "Douglas Indian Association";
+            case _393: return "Native Village of Eagle";
+            case _394: return "Native Village of Eek";
+            case _395: return "Egegik Village";
+            case _396: return "Eklutna Native Village";
+            case _397: return "Native Village of Ekuk";
+            case _398: return "Ekwok Village";
+            case _399: return "Native Village of Elim";
+            case _400: return "Emmonak Village";
+            case _401: return "Evansville Village (aka Bettles Field)";
+            case _402: return "Native Village of Eyak (Cordova)";
+            case _403: return "Native Village of False Pass";
+            case _404: return "Native Village of Fort Yukon";
+            case _405: return "Native Village of Gakona";
+            case _406: return "Galena Village (aka Louden Village)";
+            case _407: return "Native Village of Gambell";
+            case _408: return "Native Village of Georgetown";
+            case _409: return "Native Village of Goodnews Bay";
+            case _410: return "Organized Village of Grayling (aka Holikachuk)";
+            case _411: return "Gulkana Village";
+            case _412: return "Native Village of Hamilton";
+            case _413: return "Healy Lake Village";
+            case _414: return "Holy Cross Village";
+            case _415: return "Hoonah Indian Association";
+            case _416: return "Native Village of Hooper Bay";
+            case _417: return "Hughes Village";
+            case _418: return "Huslia Village";
+            case _419: return "Hydaburg Cooperative Association";
+            case _420: return "Igiugig Village";
+            case _421: return "Village of Iliamna";
+            case _422: return "Inupiat Community of the Arctic Slope";
+            case _423: return "Iqurmuit Traditional Council (formerly Native Vill";
+            case _424: return "Ivanoff Bay Village";
+            case _425: return "Kaguyak Village";
+            case _426: return "Organized Village of Kake";
+            case _427: return "Kaktovik Village (aka Barter Island)";
+            case _428: return "Village of Kalskag";
+            case _429: return "Village of Kaltag";
+            case _430: return "Native Village of Kanatak";
+            case _431: return "Native Village of Karluk";
+            case _432: return "Organized Village of Kasaan";
+            case _433: return "Native Village of Kasigluk";
+            case _434: return "Kenaitze Indian Tribe";
+            case _435: return "Ketchikan Indian Corporation";
+            case _436: return "Native Village of Kiana";
+            case _437: return "King Island Native Community";
+            case _438: return "King Salmon Tribe";
+            case _439: return "Native Village of Kipnuk";
+            case _440: return "Native Village of Kivalina";
+            case _441: return "Klawock Cooperative Association";
+            case _442: return "Native Village of Kluti Kaah (aka Copper Center)";
+            case _443: return "Knik Tribe";
+            case _444: return "Native Village of Kobuk";
+            case _445: return "Kokhanok Village";
+            case _446: return "Native Village of Kongiganak";
+            case _447: return "Village of Kotlik";
+            case _448: return "Native Village of Kotzebue";
+            case _449: return "Native Village of Koyuk";
+            case _450: return "Koyukuk Native Village";
+            case _451: return "Organized Village of Kwethluk";
+            case _452: return "Native Village of Kwigillingok";
+            case _453: return "Native Village of Kwinhagak (aka Quinhagak)";
+            case _454: return "Native Village of Larsen Bay";
+            case _455: return "Levelock Village";
+            case _456: return "Lesnoi Village (aka Woody Island)";
+            case _457: return "Lime Village";
+            case _458: return "Village of Lower Kalskag";
+            case _459: return "Manley Hot Springs Village";
+            case _460: return "Manokotak Village";
+            case _461: return "Native Village of Marshall (aka Fortuna Ledge)";
+            case _462: return "Native Village of Mary's Igloo";
+            case _463: return "McGrath Native Village";
+            case _464: return "Native Village of Mekoryuk";
+            case _465: return "Mentasta Traditional Council";
+            case _466: return "Metlakatla Indian Community, Annette Island Reserv";
+            case _467: return "Native Village of Minto";
+            case _468: return "Naknek Native Village";
+            case _469: return "Native Village of Nanwalek (aka English Bay)";
+            case _470: return "Native Village of Napaimute";
+            case _471: return "Native Village of Napakiak";
+            case _472: return "Native Village of Napaskiak";
+            case _473: return "Native Village of Nelson Lagoon";
+            case _474: return "Nenana Native Association";
+            case _475: return "New Koliganek Village Council (formerly Koliganek";
+            case _476: return "New Stuyahok Village";
+            case _477: return "Newhalen Village";
+            case _478: return "Newtok Village";
+            case _479: return "Native Village of Nightmute";
+            case _480: return "Nikolai Village";
+            case _481: return "Native Village of Nikolski";
+            case _482: return "Ninilchik Village";
+            case _483: return "Native Village of Noatak";
+            case _484: return "Nome Eskimo Community";
+            case _485: return "Nondalton Village";
+            case _486: return "Noorvik Native Community";
+            case _487: return "Northway Village";
+            case _488: return "Native Village of Nuiqsut (aka Nooiksut)";
+            case _489: return "Nulato Village";
+            case _490: return "Nunakauyarmiut Tribe (formerly Native Village of T";
+            case _491: return "Native Village of Nunapitchuk";
+            case _492: return "Village of Ohogamiut";
+            case _493: return "Village of Old Harbor";
+            case _494: return "Orutsararmuit Native Village (aka Bethel)";
+            case _495: return "Oscarville Traditional Village";
+            case _496: return "Native Village of Ouzinkie";
+            case _497: return "Native Village of Paimiut";
+            case _498: return "Pauloff Harbor Village";
+            case _499: return "Pedro Bay Village";
+            case _500: return "Native Village of Perryville";
+            case _501: return "Petersburg Indian Association";
+            case _502: return "Native Village of Pilot Point";
+            case _503: return "Pilot Station Traditional Village";
+            case _504: return "Native Village of Pitka's Point";
+            case _505: return "Platinum Traditional Village";
+            case _506: return "Native Village of Point Hope";
+            case _507: return "Native Village of Point Lay";
+            case _508: return "Native Village of Port Graham";
+            case _509: return "Native Village of Port Heiden";
+            case _510: return "Native Village of Port Lions";
+            case _511: return "Portage Creek Village (aka Ohgsenakale)";
+            case _512: return "Pribilof Islands Aleut Communities of St. Paul & S";
+            case _513: return "Qagan Tayagungin Tribe of Sand Point Village";
+            case _514: return "Qawalangin Tribe of Unalaska";
+            case _515: return "Rampart Village";
+            case _516: return "Village of Red Devil";
+            case _517: return "Native Village of Ruby";
+            case _518: return "Saint George Island(See Pribilof Islands Aleut Com";
+            case _519: return "Native Village of Saint Michael";
+            case _520: return "Saint Paul Island (See Pribilof Islands Aleut Comm";
+            case _521: return "Village of Salamatoff";
+            case _522: return "Native Village of Savoonga";
+            case _523: return "Organized Village of Saxman";
+            case _524: return "Native Village of Scammon Bay";
+            case _525: return "Native Village of Selawik";
+            case _526: return "Seldovia Village Tribe";
+            case _527: return "Shageluk Native Village";
+            case _528: return "Native Village of Shaktoolik";
+            case _529: return "Native Village of Sheldon's Point";
+            case _530: return "Native Village of Shishmaref";
+            case _531: return "Shoonaq Tribe of Kodiak";
+            case _532: return "Native Village of Shungnak";
+            case _533: return "Sitka Tribe of Alaska";
+            case _534: return "Skagway Village";
+            case _535: return "Village of Sleetmute";
+            case _536: return "Village of Solomon";
+            case _537: return "South Naknek Village";
+            case _538: return "Stebbins Community Association";
+            case _539: return "Native Village of Stevens";
+            case _540: return "Village of Stony River";
+            case _541: return "Takotna Village";
+            case _542: return "Native Village of Tanacross";
+            case _543: return "Native Village of Tanana";
+            case _544: return "Native Village of Tatitlek";
+            case _545: return "Native Village of Tazlina";
+            case _546: return "Telida Village";
+            case _547: return "Native Village of Teller";
+            case _548: return "Native Village of Tetlin";
+            case _549: return "Central Council of the Tlingit and Haida Indian Tb";
+            case _550: return "Traditional Village of Togiak";
+            case _551: return "Tuluksak Native Community";
+            case _552: return "Native Village of Tuntutuliak";
+            case _553: return "Native Village of Tununak";
+            case _554: return "Twin Hills Village";
+            case _555: return "Native Village of Tyonek";
+            case _556: return "Ugashik Village";
+            case _557: return "Umkumiute Native Village";
+            case _558: return "Native Village of Unalakleet";
+            case _559: return "Native Village of Unga";
+            case _560: return "Village of Venetie (See Native Village of Venetie";
+            case _561: return "Native Village of Venetie Tribal Government (Arcti";
+            case _562: return "Village of Wainwright";
+            case _563: return "Native Village of Wales";
+            case _564: return "Native Village of White Mountain";
+            case _565: return "Wrangell Cooperative Association";
+            case _566: return "Yakutat Tlingit Tribe";
+            case _NATIVEENTITYCONTIGUOUS: return "NATIVE ENTITIES WITHIN THE CONTIGUOUS 48 STATES";
+            case _1: return "Absentee-Shawnee Tribe of Indians of Oklahoma";
+            case _10: return "Assiniboine and Sioux Tribes of the Fort Peck Indi";
+            case _100: return "Havasupai Tribe of the Havasupai Reservation, Ariz";
+            case _101: return "Ho-Chunk Nation of Wisconsin (formerly known as th";
+            case _102: return "Hoh Indian Tribe of the Hoh Indian Reservation, Wa";
+            case _103: return "Hoopa Valley Tribe, California";
+            case _104: return "Hopi Tribe of Arizona";
+            case _105: return "Hopland Band of Pomo Indians of the Hopland Ranche";
+            case _106: return "Houlton Band of Maliseet Indians of Maine";
+            case _107: return "Hualapai Indian Tribe of the Hualapai Indian Reser";
+            case _108: return "Huron Potawatomi, Inc., Michigan";
+            case _109: return "Inaja Band of Diegueno Mission Indians of the Inaj";
+            case _11: return "Augustine Band of Cahuilla Mission Indians of the";
+            case _110: return "Ione Band of Miwok Indians of California";
+            case _111: return "Iowa Tribe of Kansas and Nebraska";
+            case _112: return "Iowa Tribe of Oklahoma";
+            case _113: return "Jackson Rancheria of Me-Wuk Indians of California";
+            case _114: return "Jamestown S'Klallam Tribe of Washington";
+            case _115: return "Jamul Indian Village of California";
+            case _116: return "Jena Band of Choctaw Indians, Louisiana";
+            case _117: return "Jicarilla Apache Tribe of the Jicarilla Apache Ind";
+            case _118: return "Kaibab Band of Paiute Indians of the Kaibab Indian";
+            case _119: return "Kalispel Indian Community of the Kalispel Reservat";
+            case _12: return "Bad River Band of the Lake Superior Tribe of Chipp";
+            case _120: return "Karuk Tribe of California";
+            case _121: return "Kashia Band of Pomo Indians of the Stewarts Point";
+            case _122: return "Kaw Nation, Oklahoma";
+            case _123: return "Keweenaw Bay Indian Community of L'Anse and Ontona";
+            case _124: return "Kialegee Tribal Town, Oklahoma";
+            case _125: return "Kickapoo Tribe of Indians of the Kickapoo Reservat";
+            case _126: return "Kickapoo Tribe of Oklahoma";
+            case _127: return "Kickapoo Traditional Tribe of Texas";
+            case _128: return "Kiowa Indian Tribe of Oklahoma";
+            case _129: return "Klamath Indian Tribe of Oregon";
+            case _13: return "Bay Mills Indian Community of the Sault Ste. Marie";
+            case _130: return "Kootenai Tribe of Idaho";
+            case _131: return "La Jolla Band of Luiseno Mission Indians of the La";
+            case _132: return "La Posta Band of Diegueno Mission Indians of the L";
+            case _133: return "Lac Courte Oreilles Band of Lake Superior Chippewa";
+            case _134: return "Lac du Flambeau Band of Lake Superior Chippewa Ind";
+            case _135: return "Lac Vieux Desert Band of Lake Superior Chippewa In";
+            case _136: return "Las Vegas Tribe of Paiute Indians of the Las Vegas";
+            case _137: return "Little River Band of Ottawa Indians of Michigan";
+            case _138: return "Little Traverse Bay Bands of Odawa Indians of Mich";
+            case _139: return "Lower Lake Rancheria, California";
+            case _14: return "Bear River Band of the Rohnerville Rancheria, Cali";
+            case _140: return "Los Coyotes Band of Cahuilla Mission Indians of th";
+            case _141: return "Lovelock Paiute Tribe of the Lovelock Indian Colon";
+            case _142: return "Lower Brule Sioux Tribe of the Lower Brule Reserva";
+            case _143: return "Lower Elwha Tribal Community of the Lower Elwha Re";
+            case _144: return "Lower Sioux Indian Community of Minnesota Mdewakan";
+            case _145: return "Lummi Tribe of the Lummi Reservation, Washington";
+            case _146: return "Lytton Rancheria of California";
+            case _147: return "Makah Indian Tribe of the Makah Indian Reservation";
+            case _148: return "Manchester Band of Pomo Indians of the Manchester-";
+            case _149: return "Manzanita Band of Diegueno Mission Indians of the";
+            case _15: return "Berry Creek Rancheria of Maidu Indians of Californ";
+            case _150: return "Mashantucket Pequot Tribe of Connecticut";
+            case _151: return "Match-e-be-nash-she-wish Band of Pottawatomi India";
+            case _152: return "Mechoopda Indian Tribe of Chico Rancheria, Califor";
+            case _153: return "Menominee Indian Tribe of Wisconsin";
+            case _154: return "Mesa Grande Band of Diegueno Mission Indians of th";
+            case _155: return "Mescalero Apache Tribe of the Mescalero Reservatio";
+            case _156: return "Miami Tribe of Oklahoma";
+            case _157: return "Miccosukee Tribe of Indians of Florida";
+            case _158: return "Middletown Rancheria of Pomo Indians of California";
+            case _159: return "Minnesota Chippewa Tribe, Minnesota (Six component";
+            case _16: return "Big Lagoon Rancheria, California";
+            case _160: return "Bois Forte Band (Nett Lake); Fond du Lac Band; Gra";
+            case _161: return "Mississippi Band of Choctaw Indians, Mississippi";
+            case _162: return "Moapa Band of Paiute Indians of the Moapa River In";
+            case _163: return "Modoc Tribe of Oklahoma";
+            case _164: return "Mohegan Indian Tribe of Connecticut";
+            case _165: return "Mooretown Rancheria of Maidu Indians of California";
+            case _166: return "Morongo Band of Cahuilla Mission Indians of the Mo";
+            case _167: return "Muckleshoot Indian Tribe of the Muckleshoot Reserv";
+            case _168: return "Muscogee (Creek) Nation, Oklahoma";
+            case _169: return "Narragansett Indian Tribe of Rhode Island";
+            case _17: return "Big Pine Band of Owens Valley Paiute Shoshone Indi";
+            case _170: return "Navajo Nation, Arizona, New Mexico & Utah";
+            case _171: return "Nez Perce Tribe of Idaho";
+            case _172: return "Nisqually Indian Tribe of the Nisqually Reservatio";
+            case _173: return "Nooksack Indian Tribe of Washington";
+            case _174: return "Northern Cheyenne Tribe of the Northern Cheyenne I";
+            case _175: return "Northfork Rancheria of Mono Indians of California";
+            case _176: return "Northwestern Band of Shoshoni Nation of Utah (Wash";
+            case _177: return "Oglala Sioux Tribe of the Pine Ridge Reservation,";
+            case _178: return "Omaha Tribe of Nebraska";
+            case _179: return "Oneida Nation of New York";
+            case _18: return "Big Sandy Rancheria of Mono Indians of California";
+            case _180: return "Oneida Tribe of Wisconsin";
+            case _181: return "Onondaga Nation of New York";
+            case _182: return "Osage Tribe, Oklahoma";
+            case _183: return "Ottawa Tribe of Oklahoma";
+            case _184: return "Otoe-Missouria Tribe of Indians, Oklahoma";
+            case _185: return "Paiute Indian Tribe of Utah";
+            case _186: return "Paiute-Shoshone Indians of the Bishop Community of";
+            case _187: return "Paiute-Shoshone Tribe of the Fallon Reservation an";
+            case _188: return "Paiute-Shoshone Indians of the Lone Pine Community";
+            case _189: return "Pala Band of Luiseno Mission Indians of the Pala R";
+            case _19: return "Big Valley Band of Pomo Indians of the Big Valley";
+            case _190: return "Pascua Yaqui Tribe of Arizona";
+            case _191: return "Paskenta Band of Nomlaki Indians of California";
+            case _192: return "Passamaquoddy Tribe of Maine";
+            case _193: return "Pauma Band of Luiseno Mission Indians of the Pauma";
+            case _194: return "Pawnee Nation of Oklahoma";
+            case _195: return "Pechanga Band of Luiseno Mission Indians of the Pe";
+            case _196: return "Penobscot Tribe of Maine";
+            case _197: return "Peoria Tribe of Indians of Oklahoma";
+            case _198: return "Picayune Rancheria of Chukchansi Indians of Califo";
+            case _199: return "Pinoleville Rancheria of Pomo Indians of Californi";
+            case _2: return "Agua Caliente Band of Cahuilla Indians of the Agua";
+            case _20: return "Blackfeet Tribe of the Blackfeet Indian Reservatio";
+            case _200: return "Pit River Tribe, California (includes Big Bend, Lo";
+            case _201: return "Poarch Band of Creek Indians of Alabama";
+            case _202: return "Pokagon Band of Potawatomi Indians of Michigan";
+            case _203: return "Ponca Tribe of Indians of Oklahoma";
+            case _204: return "Ponca Tribe of Nebraska";
+            case _205: return "Port Gamble Indian Community of the Port Gamble Re";
+            case _206: return "Potter Valley Rancheria of Pomo Indians of Califor";
+            case _207: return "Prairie Band of Potawatomi Indians, Kansas";
+            case _208: return "Prairie Island Indian Community of Minnesota Mdewa";
+            case _209: return "Pueblo of Acoma, New Mexico";
+            case _21: return "Blue Lake Rancheria, California";
+            case _210: return "Pueblo of Cochiti, New Mexico";
+            case _211: return "Pueblo of Jemez, New Mexico";
+            case _212: return "Pueblo of Isleta, New Mexico";
+            case _213: return "Pueblo of Laguna, New Mexico";
+            case _214: return "Pueblo of Nambe, New Mexico";
+            case _215: return "Pueblo of Picuris, New Mexico";
+            case _216: return "Pueblo of Pojoaque, New Mexico";
+            case _217: return "Pueblo of San Felipe, New Mexico";
+            case _218: return "Pueblo of San Juan, New Mexico";
+            case _219: return "Pueblo of San Ildefonso, New Mexico";
+            case _22: return "Bridgeport Paiute Indian Colony of California";
+            case _220: return "Pueblo of Sandia, New Mexico";
+            case _221: return "Pueblo of Santa Ana, New Mexico";
+            case _222: return "Pueblo of Santa Clara, New Mexico";
+            case _223: return "Pueblo of Santo Domingo, New Mexico";
+            case _224: return "Pueblo of Taos, New Mexico";
+            case _225: return "Pueblo of Tesuque, New Mexico";
+            case _226: return "Pueblo of Zia, New Mexico";
+            case _227: return "Puyallup Tribe of the Puyallup Reservation, Washin";
+            case _228: return "Pyramid Lake Paiute Tribe of the Pyramid Lake Rese";
+            case _229: return "Quapaw Tribe of Indians, Oklahoma";
+            case _23: return "Buena Vista Rancheria of Me-Wuk Indians of Califor";
+            case _230: return "Quartz Valley Indian Community of the Quartz Valle";
+            case _231: return "Quechan Tribe of the Fort Yuma Indian Reservation,";
+            case _232: return "Quileute Tribe of the Quileute Reservation, Washin";
+            case _233: return "Quinault Tribe of the Quinault Reservation, Washin";
+            case _234: return "Ramona Band or Village of Cahuilla Mission Indians";
+            case _235: return "Red Cliff Band of Lake Superior Chippewa Indians o";
+            case _236: return "Red Lake Band of Chippewa Indians of the Red Lake";
+            case _237: return "Redding Rancheria, California";
+            case _238: return "Redwood Valley Rancheria of Pomo Indians of Califo";
+            case _239: return "Reno-Sparks Indian Colony, Nevada";
+            case _24: return "Burns Paiute Tribe of the Burns Paiute Indian Colo";
+            case _240: return "Resighini Rancheria, California (formerly known as";
+            case _241: return "Rincon Band of Luiseno Mission Indians of the Rinc";
+            case _242: return "Robinson Rancheria of Pomo Indians of California";
+            case _243: return "Rosebud Sioux Tribe of the Rosebud Indian Reservat";
+            case _244: return "Round Valley Indian Tribes of the Round Valley Res";
+            case _245: return "Rumsey Indian Rancheria of Wintun Indians of Calif";
+            case _246: return "Sac and Fox Tribe of the Mississippi in Iowa";
+            case _247: return "Sac and Fox Nation of Missouri in Kansas and Nebra";
+            case _248: return "Sac and Fox Nation, Oklahoma";
+            case _249: return "Saginaw Chippewa Indian Tribe of Michigan, Isabell";
+            case _25: return "Cabazon Band of Cahuilla Mission Indians of the Ca";
+            case _250: return "Salt River Pima-Maricopa Indian Community of the S";
+            case _251: return "Samish Indian Tribe, Washington";
+            case _252: return "San Carlos Apache Tribe of the San Carlos Reservat";
+            case _253: return "San Juan Southern Paiute Tribe of Arizona";
+            case _254: return "San Manual Band of Serrano Mission Indians of the";
+            case _255: return "San Pasqual Band of Diegueno Mission Indians of Ca";
+            case _256: return "Santa Rosa Indian Community of the Santa Rosa Ranc";
+            case _257: return "Santa Rosa Band of Cahuilla Mission Indians of the";
+            case _258: return "Santa Ynez Band of Chumash Mission Indians of the";
+            case _259: return "Santa Ysabel Band of Diegueno Mission Indians of t";
+            case _26: return "Cachil DeHe Band of Wintun Indians of the Colusa I";
+            case _260: return "Santee Sioux Tribe of the Santee Reservation of Ne";
+            case _261: return "Sauk-Suiattle Indian Tribe of Washington";
+            case _262: return "Sault Ste. Marie Tribe of Chippewa Indians of Mich";
+            case _263: return "Scotts Valley Band of Pomo Indians of California";
+            case _264: return "Seminole Nation of Oklahoma";
+            case _265: return "Seminole Tribe of Florida, Dania, Big Cypress, Bri";
+            case _266: return "Seneca Nation of New York";
+            case _267: return "Seneca-Cayuga Tribe of Oklahoma";
+            case _268: return "Shakopee Mdewakanton Sioux Community of Minnesota";
+            case _269: return "Shawnee Tribe, Oklahoma";
+            case _27: return "Caddo Indian Tribe of Oklahoma";
+            case _270: return "Sherwood Valley Rancheria of Pomo Indians of Calif";
+            case _271: return "Shingle Springs Band of Miwok Indians, Shingle Spr";
+            case _272: return "Shoalwater Bay Tribe of the Shoalwater Bay Indian";
+            case _273: return "Shoshone Tribe of the Wind River Reservation, Wyom";
+            case _274: return "Shoshone-Bannock Tribes of the Fort Hall Reservati";
+            case _275: return "Shoshone-Paiute Tribes of the Duck Valley Reservat";
+            case _276: return "Sisseton-Wahpeton Sioux Tribe of the Lake Traverse";
+            case _277: return "Skokomish Indian Tribe of the Skokomish Reservatio";
+            case _278: return "Skull Valley Band of Goshute Indians of Utah";
+            case _279: return "Smith River Rancheria, California";
+            case _28: return "Cahuilla Band of Mission Indians of the Cahuilla R";
+            case _280: return "Snoqualmie Tribe, Washington";
+            case _281: return "Soboba Band of Luiseno Indians, California (former";
+            case _282: return "Sokaogon Chippewa Community of the Mole Lake Band";
+            case _283: return "Southern Ute Indian Tribe of the Southern Ute Rese";
+            case _284: return "Spirit Lake Tribe, North Dakota (formerly known as";
+            case _285: return "Spokane Tribe of the Spokane Reservation, Washingt";
+            case _286: return "Squaxin Island Tribe of the Squaxin Island Reserva";
+            case _287: return "St. Croix Chippewa Indians of Wisconsin, St. Croix";
+            case _288: return "St. Regis Band of Mohawk Indians of New York";
+            case _289: return "Standing Rock Sioux Tribe of North & South Dakota";
+            case _29: return "Cahto Indian Tribe of the Laytonville Rancheria, C";
+            case _290: return "Stockbridge-Munsee Community of Mohican Indians of";
+            case _291: return "Stillaguamish Tribe of Washington";
+            case _292: return "Summit Lake Paiute Tribe of Nevada";
+            case _293: return "Suquamish Indian Tribe of the Port Madison Reserva";
+            case _294: return "Susanville Indian Rancheria, California";
+            case _295: return "Swinomish Indians of the Swinomish Reservation, Wa";
+            case _296: return "Sycuan Band of Diegueno Mission Indians of Califor";
+            case _297: return "Table Bluff Reservation - Wiyot Tribe, California";
+            case _298: return "Table Mountain Rancheria of California";
+            case _299: return "Te-Moak Tribe of Western Shoshone Indians of Nevad";
+            case _3: return "Ak Chin Indian Community of the Maricopa (Ak Chin)";
+            case _30: return "California Valley Miwok Tribe, California (formerl";
+            case _300: return "Thlopthlocco Tribal Town, Oklahoma";
+            case _301: return "Three Affiliated Tribes of the Fort Berthold Reser";
+            case _302: return "Tohono O'odham Nation of Arizona";
+            case _303: return "Tonawanda Band of Seneca Indians of New York";
+            case _304: return "Tonkawa Tribe of Indians of Oklahoma";
+            case _305: return "Tonto Apache Tribe of Arizona";
+            case _306: return "Torres-Martinez Band of Cahuilla Mission Indians o";
+            case _307: return "Tule River Indian Tribe of the Tule River Reservat";
+            case _308: return "Tulalip Tribes of the Tulalip Reservation, Washing";
+            case _309: return "Tunica-Biloxi Indian Tribe of Louisiana";
+            case _31: return "Campo Band of Diegueno Mission Indians of the Camp";
+            case _310: return "Tuolumne Band of Me-Wuk Indians of the Tuolumne Ra";
+            case _311: return "Turtle Mountain Band of Chippewa Indians of North";
+            case _312: return "Tuscarora Nation of New York";
+            case _313: return "Twenty-Nine Palms Band of Mission Indians of Calif";
+            case _314: return "United Auburn Indian Community of the Auburn Ranch";
+            case _315: return "United Keetoowah Band of Cherokee Indians of Oklah";
+            case _316: return "Upper Lake Band of Pomo Indians of Upper Lake Ranc";
+            case _317: return "Upper Sioux Indian Community of the Upper Sioux Re";
+            case _318: return "Upper Skagit Indian Tribe of Washington";
+            case _319: return "Ute Indian Tribe of the Uintah & Ouray Reservation";
+            case _32: return "Capitan Grande Band of Diegueno Mission Indians of";
+            case _320: return "Ute Mountain Tribe of the Ute Mountain Reservation";
+            case _321: return "Utu Utu Gwaitu Paiute Tribe of the Benton Paiute R";
+            case _322: return "Walker River Paiute Tribe of the Walker River Rese";
+            case _323: return "Wampanoag Tribe of Gay Head (Aquinnah) of Massachu";
+            case _324: return "Washoe Tribe of Nevada & California (Carson Colony";
+            case _325: return "White Mountain Apache Tribe of the Fort Apache Res";
+            case _326: return "Wichita and Affiliated Tribes (Wichita, Keechi, Wa";
+            case _327: return "Winnebago Tribe of Nebraska";
+            case _328: return "Winnemucca Indian Colony of Nevada";
+            case _329: return "Wyandotte Tribe of Oklahoma";
+            case _33: return "Barona Group of Capitan Grande Band of Mission Ind";
+            case _330: return "Yankton Sioux Tribe of South Dakota";
+            case _331: return "Yavapai-Apache Nation of the Camp Verde Indian Res";
+            case _332: return "Yavapai-Prescott Tribe of the Yavapai Reservation,";
+            case _333: return "Yerington Paiute Tribe of the Yerington Colony & C";
+            case _334: return "Yomba Shoshone Tribe of the Yomba Reservation, Nev";
+            case _335: return "Ysleta Del Sur Pueblo of Texas";
+            case _336: return "Yurok Tribe of the Yurok Reservation, California";
+            case _337: return "Zuni Tribe of the Zuni Reservation, New Mexico";
+            case _34: return "Viejas (Baron Long) Group of Capitan Grande Band o";
+            case _35: return "Catawba Indian Nation (aka Catawba Tribe of South";
+            case _36: return "Cayuga Nation of New York";
+            case _37: return "Cedarville Rancheria, California";
+            case _38: return "Chemehuevi Indian Tribe of the Chemehuevi Reservat";
+            case _39: return "Cher-Ae Heights Indian Community of the Trinidad R";
+            case _4: return "Alabama-Coushatta Tribes of Texas";
+            case _40: return "Cherokee Nation, Oklahoma";
+            case _41: return "Cheyenne-Arapaho Tribes of Oklahoma";
+            case _42: return "Cheyenne River Sioux Tribe of the Cheyenne River R";
+            case _43: return "Chickasaw Nation, Oklahoma";
+            case _44: return "Chicken Ranch Rancheria of Me-Wuk Indians of Calif";
+            case _45: return "Chippewa-Cree Indians of the Rocky Boy's Reservati";
+            case _46: return "Chitimacha Tribe of Louisiana";
+            case _47: return "Choctaw Nation of Oklahoma";
+            case _48: return "Citizen Potawatomi Nation, Oklahoma";
+            case _49: return "Cloverdale Rancheria of Pomo Indians of California";
+            case _5: return "Alabama-Quassarte Tribal Town, Oklahoma";
+            case _50: return "Cocopah Tribe of Arizona";
+            case _51: return "Coeur D'Alene Tribe of the Coeur D'Alene Reservati";
+            case _52: return "Cold Springs Rancheria of Mono Indians of Californ";
+            case _53: return "Colorado River Indian Tribes of the Colorado River";
+            case _54: return "Comanche Indian Tribe, Oklahoma";
+            case _55: return "Confederated Salish & Kootenai Tribes of the Flath";
+            case _56: return "Confederated Tribes of the Chehalis Reservation, W";
+            case _57: return "Confederated Tribes of the Colville Reservation, W";
+            case _58: return "Confederated Tribes of the Coos, Lower Umpqua and";
+            case _59: return "Confederated Tribes of the Goshute Reservation, Ne";
+            case _6: return "Alturas Indian Rancheria, California";
+            case _60: return "Confederated Tribes of the Grand Ronde Community o";
+            case _61: return "Confederated Tribes of the Siletz Reservation, Ore";
+            case _62: return "Confederated Tribes of the Umatilla Reservation, O";
+            case _63: return "Confederated Tribes of the Warm Springs Reservatio";
+            case _64: return "Confederated Tribes and Bands of the Yakama Indian";
+            case _65: return "Coquille Tribe of Oregon";
+            case _66: return "Cortina Indian Rancheria of Wintun Indians of Cali";
+            case _67: return "Coushatta Tribe of Louisiana";
+            case _68: return "Cow Creek Band of Umpqua Indians of Oregon";
+            case _69: return "Coyote Valley Band of Pomo Indians of California";
+            case _7: return "Apache Tribe of Oklahoma";
+            case _70: return "Crow Tribe of Montana";
+            case _71: return "Crow Creek Sioux Tribe of the Crow Creek Reservati";
+            case _72: return "Cuyapaipe Community of Diegueno Mission Indians of";
+            case _73: return "Death Valley Timbi-Sha Shoshone Band of California";
+            case _74: return "Delaware Nation, Oklahoma (formerly Delaware Tribe";
+            case _75: return "Delaware Tribe of Indians, Oklahoma";
+            case _76: return "Dry Creek Rancheria of Pomo Indians of California";
+            case _77: return "Duckwater Shoshone Tribe of the Duckwater Reservat";
+            case _78: return "Eastern Band of Cherokee Indians of North Carolina";
+            case _79: return "Eastern Shawnee Tribe of Oklahoma";
+            case _8: return "Arapahoe Tribe of the Wind River Reservation, Wyom";
+            case _80: return "Elem Indian Colony of Pomo Indians of the Sulphur";
+            case _81: return "Elk Valley Rancheria, California";
+            case _82: return "Ely Shoshone Tribe of Nevada";
+            case _83: return "Enterprise Rancheria of Maidu Indians of Californi";
+            case _84: return "Flandreau Santee Sioux Tribe of South Dakota";
+            case _85: return "Forest County Potawatomi Community of Wisconsin Po";
+            case _86: return "Fort Belknap Indian Community of the Fort Belknap";
+            case _87: return "Fort Bidwell Indian Community of the Fort Bidwell";
+            case _88: return "Fort Independence Indian Community of Paiute India";
+            case _89: return "Fort McDermitt Paiute and Shoshone Tribes of the F";
+            case _9: return "Aroostook Band of Micmac Indians of Maine";
+            case _90: return "Fort McDowell Yavapai Nation, Arizona (formerly th";
+            case _91: return "Fort Mojave Indian Tribe of Arizona, California";
+            case _92: return "Fort Sill Apache Tribe of Oklahoma";
+            case _93: return "Gila River Indian Community of the Gila River Indi";
+            case _94: return "Grand Traverse Band of Ottawa & Chippewa Indians o";
+            case _95: return "Graton Rancheria, California";
+            case _96: return "Greenville Rancheria of Maidu Indians of Californi";
+            case _97: return "Grindstone Indian Rancheria of Wintun-Wailaki Indi";
+            case _98: return "Guidiville Rancheria of California";
+            case _99: return "Hannahville Indian Community of Wisconsin Potawato";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _NATIVEENTITYALASKA: return "NativeEntityAlaska";
+            case _338: return "Village of Afognak";
+            case _339: return "Agdaagux Tribe of King Cove";
+            case _340: return "Native Village of Akhiok";
+            case _341: return "Akiachak Native Community";
+            case _342: return "Akiak Native Community";
+            case _343: return "Native Village of Akutan";
+            case _344: return "Village of Alakanuk";
+            case _345: return "Alatna Village";
+            case _346: return "Native Village of Aleknagik";
+            case _347: return "Algaaciq Native Village (St. Mary's)";
+            case _348: return "Allakaket Village";
+            case _349: return "Native Village of Ambler";
+            case _350: return "Village of Anaktuvuk Pass";
+            case _351: return "Yupiit of Andreafski";
+            case _352: return "Angoon Community Association";
+            case _353: return "Village of Aniak";
+            case _354: return "Anvik Village";
+            case _355: return "Arctic Village (See Native Village of Venetie Trib";
+            case _356: return "Asa carsarmiut Tribe (formerly Native Village of M";
+            case _357: return "Native Village of Atka";
+            case _358: return "Village of Atmautluak";
+            case _359: return "Atqasuk Village (Atkasook)";
+            case _360: return "Native Village of Barrow Inupiat Traditional Gover";
+            case _361: return "Beaver Village";
+            case _362: return "Native Village of Belkofski";
+            case _363: return "Village of Bill Moore's Slough";
+            case _364: return "Birch Creek Tribe";
+            case _365: return "Native Village of Brevig Mission";
+            case _366: return "Native Village of Buckland";
+            case _367: return "Native Village of Cantwell";
+            case _368: return "Native Village of Chanega (aka Chenega)";
+            case _369: return "Chalkyitsik Village";
+            case _370: return "Village of Chefornak";
+            case _371: return "Chevak Native Village";
+            case _372: return "Chickaloon Native Village";
+            case _373: return "Native Village of Chignik";
+            case _374: return "Native Village of Chignik Lagoon";
+            case _375: return "Chignik Lake Village";
+            case _376: return "Chilkat Indian Village (Klukwan)";
+            case _377: return "Chilkoot Indian Association (Haines)";
+            case _378: return "Chinik Eskimo Community (Golovin)";
+            case _379: return "Native Village of Chistochina";
+            case _380: return "Native Village of Chitina";
+            case _381: return "Native Village of Chuathbaluk (Russian Mission, Ku";
+            case _382: return "Chuloonawick Native Village";
+            case _383: return "Circle Native Community";
+            case _384: return "Village of Clark's Point";
+            case _385: return "Native Village of Council";
+            case _386: return "Craig Community Association";
+            case _387: return "Village of Crooked Creek";
+            case _388: return "Curyung Tribal Council (formerly Native Village of";
+            case _389: return "Native Village of Deering";
+            case _390: return "Native Village of Diomede (aka Inalik)";
+            case _391: return "Village of Dot Lake";
+            case _392: return "Douglas Indian Association";
+            case _393: return "Native Village of Eagle";
+            case _394: return "Native Village of Eek";
+            case _395: return "Egegik Village";
+            case _396: return "Eklutna Native Village";
+            case _397: return "Native Village of Ekuk";
+            case _398: return "Ekwok Village";
+            case _399: return "Native Village of Elim";
+            case _400: return "Emmonak Village";
+            case _401: return "Evansville Village (aka Bettles Field)";
+            case _402: return "Native Village of Eyak (Cordova)";
+            case _403: return "Native Village of False Pass";
+            case _404: return "Native Village of Fort Yukon";
+            case _405: return "Native Village of Gakona";
+            case _406: return "Galena Village (aka Louden Village)";
+            case _407: return "Native Village of Gambell";
+            case _408: return "Native Village of Georgetown";
+            case _409: return "Native Village of Goodnews Bay";
+            case _410: return "Organized Village of Grayling (aka Holikachuk)";
+            case _411: return "Gulkana Village";
+            case _412: return "Native Village of Hamilton";
+            case _413: return "Healy Lake Village";
+            case _414: return "Holy Cross Village";
+            case _415: return "Hoonah Indian Association";
+            case _416: return "Native Village of Hooper Bay";
+            case _417: return "Hughes Village";
+            case _418: return "Huslia Village";
+            case _419: return "Hydaburg Cooperative Association";
+            case _420: return "Igiugig Village";
+            case _421: return "Village of Iliamna";
+            case _422: return "Inupiat Community of the Arctic Slope";
+            case _423: return "Iqurmuit Traditional Council (formerly Native Vill";
+            case _424: return "Ivanoff Bay Village";
+            case _425: return "Kaguyak Village";
+            case _426: return "Organized Village of Kake";
+            case _427: return "Kaktovik Village (aka Barter Island)";
+            case _428: return "Village of Kalskag";
+            case _429: return "Village of Kaltag";
+            case _430: return "Native Village of Kanatak";
+            case _431: return "Native Village of Karluk";
+            case _432: return "Organized Village of Kasaan";
+            case _433: return "Native Village of Kasigluk";
+            case _434: return "Kenaitze Indian Tribe";
+            case _435: return "Ketchikan Indian Corporation";
+            case _436: return "Native Village of Kiana";
+            case _437: return "King Island Native Community";
+            case _438: return "King Salmon Tribe";
+            case _439: return "Native Village of Kipnuk";
+            case _440: return "Native Village of Kivalina";
+            case _441: return "Klawock Cooperative Association";
+            case _442: return "Native Village of Kluti Kaah (aka Copper Center)";
+            case _443: return "Knik Tribe";
+            case _444: return "Native Village of Kobuk";
+            case _445: return "Kokhanok Village";
+            case _446: return "Native Village of Kongiganak";
+            case _447: return "Village of Kotlik";
+            case _448: return "Native Village of Kotzebue";
+            case _449: return "Native Village of Koyuk";
+            case _450: return "Koyukuk Native Village";
+            case _451: return "Organized Village of Kwethluk";
+            case _452: return "Native Village of Kwigillingok";
+            case _453: return "Native Village of Kwinhagak (aka Quinhagak)";
+            case _454: return "Native Village of Larsen Bay";
+            case _455: return "Levelock Village";
+            case _456: return "Lesnoi Village (aka Woody Island)";
+            case _457: return "Lime Village";
+            case _458: return "Village of Lower Kalskag";
+            case _459: return "Manley Hot Springs Village";
+            case _460: return "Manokotak Village";
+            case _461: return "Native Village of Marshall (aka Fortuna Ledge)";
+            case _462: return "Native Village of Mary's Igloo";
+            case _463: return "McGrath Native Village";
+            case _464: return "Native Village of Mekoryuk";
+            case _465: return "Mentasta Traditional Council";
+            case _466: return "Metlakatla Indian Community, Annette Island Reserv";
+            case _467: return "Native Village of Minto";
+            case _468: return "Naknek Native Village";
+            case _469: return "Native Village of Nanwalek (aka English Bay)";
+            case _470: return "Native Village of Napaimute";
+            case _471: return "Native Village of Napakiak";
+            case _472: return "Native Village of Napaskiak";
+            case _473: return "Native Village of Nelson Lagoon";
+            case _474: return "Nenana Native Association";
+            case _475: return "New Koliganek Village Council (formerly Koliganek";
+            case _476: return "New Stuyahok Village";
+            case _477: return "Newhalen Village";
+            case _478: return "Newtok Village";
+            case _479: return "Native Village of Nightmute";
+            case _480: return "Nikolai Village";
+            case _481: return "Native Village of Nikolski";
+            case _482: return "Ninilchik Village";
+            case _483: return "Native Village of Noatak";
+            case _484: return "Nome Eskimo Community";
+            case _485: return "Nondalton Village";
+            case _486: return "Noorvik Native Community";
+            case _487: return "Northway Village";
+            case _488: return "Native Village of Nuiqsut (aka Nooiksut)";
+            case _489: return "Nulato Village";
+            case _490: return "Nunakauyarmiut Tribe (formerly Native Village of T";
+            case _491: return "Native Village of Nunapitchuk";
+            case _492: return "Village of Ohogamiut";
+            case _493: return "Village of Old Harbor";
+            case _494: return "Orutsararmuit Native Village (aka Bethel)";
+            case _495: return "Oscarville Traditional Village";
+            case _496: return "Native Village of Ouzinkie";
+            case _497: return "Native Village of Paimiut";
+            case _498: return "Pauloff Harbor Village";
+            case _499: return "Pedro Bay Village";
+            case _500: return "Native Village of Perryville";
+            case _501: return "Petersburg Indian Association";
+            case _502: return "Native Village of Pilot Point";
+            case _503: return "Pilot Station Traditional Village";
+            case _504: return "Native Village of Pitka's Point";
+            case _505: return "Platinum Traditional Village";
+            case _506: return "Native Village of Point Hope";
+            case _507: return "Native Village of Point Lay";
+            case _508: return "Native Village of Port Graham";
+            case _509: return "Native Village of Port Heiden";
+            case _510: return "Native Village of Port Lions";
+            case _511: return "Portage Creek Village (aka Ohgsenakale)";
+            case _512: return "Pribilof Islands Aleut Communities of St. Paul & S";
+            case _513: return "Qagan Tayagungin Tribe of Sand Point Village";
+            case _514: return "Qawalangin Tribe of Unalaska";
+            case _515: return "Rampart Village";
+            case _516: return "Village of Red Devil";
+            case _517: return "Native Village of Ruby";
+            case _518: return "Saint George Island(See Pribilof Islands Aleut Com";
+            case _519: return "Native Village of Saint Michael";
+            case _520: return "Saint Paul Island (See Pribilof Islands Aleut Comm";
+            case _521: return "Village of Salamatoff";
+            case _522: return "Native Village of Savoonga";
+            case _523: return "Organized Village of Saxman";
+            case _524: return "Native Village of Scammon Bay";
+            case _525: return "Native Village of Selawik";
+            case _526: return "Seldovia Village Tribe";
+            case _527: return "Shageluk Native Village";
+            case _528: return "Native Village of Shaktoolik";
+            case _529: return "Native Village of Sheldon's Point";
+            case _530: return "Native Village of Shishmaref";
+            case _531: return "Shoonaq Tribe of Kodiak";
+            case _532: return "Native Village of Shungnak";
+            case _533: return "Sitka Tribe of Alaska";
+            case _534: return "Skagway Village";
+            case _535: return "Village of Sleetmute";
+            case _536: return "Village of Solomon";
+            case _537: return "South Naknek Village";
+            case _538: return "Stebbins Community Association";
+            case _539: return "Native Village of Stevens";
+            case _540: return "Village of Stony River";
+            case _541: return "Takotna Village";
+            case _542: return "Native Village of Tanacross";
+            case _543: return "Native Village of Tanana";
+            case _544: return "Native Village of Tatitlek";
+            case _545: return "Native Village of Tazlina";
+            case _546: return "Telida Village";
+            case _547: return "Native Village of Teller";
+            case _548: return "Native Village of Tetlin";
+            case _549: return "Central Council of the Tlingit and Haida Indian Tb";
+            case _550: return "Traditional Village of Togiak";
+            case _551: return "Tuluksak Native Community";
+            case _552: return "Native Village of Tuntutuliak";
+            case _553: return "Native Village of Tununak";
+            case _554: return "Twin Hills Village";
+            case _555: return "Native Village of Tyonek";
+            case _556: return "Ugashik Village";
+            case _557: return "Umkumiute Native Village";
+            case _558: return "Native Village of Unalakleet";
+            case _559: return "Native Village of Unga";
+            case _560: return "Village of Venetie (See Native Village of Venetie";
+            case _561: return "Native Village of Venetie Tribal Government (Arcti";
+            case _562: return "Village of Wainwright";
+            case _563: return "Native Village of Wales";
+            case _564: return "Native Village of White Mountain";
+            case _565: return "Wrangell Cooperative Association";
+            case _566: return "Yakutat Tlingit Tribe";
+            case _NATIVEENTITYCONTIGUOUS: return "NativeEntityContiguous";
+            case _1: return "Absentee-Shawnee Tribe of Indians of Oklahoma";
+            case _10: return "Assiniboine and Sioux Tribes of the Fort Peck Indi";
+            case _100: return "Havasupai Tribe of the Havasupai Reservation, Ariz";
+            case _101: return "Ho-Chunk Nation of Wisconsin (formerly known as th";
+            case _102: return "Hoh Indian Tribe of the Hoh Indian Reservation, Wa";
+            case _103: return "Hoopa Valley Tribe, California";
+            case _104: return "Hopi Tribe of Arizona";
+            case _105: return "Hopland Band of Pomo Indians of the Hopland Ranche";
+            case _106: return "Houlton Band of Maliseet Indians of Maine";
+            case _107: return "Hualapai Indian Tribe of the Hualapai Indian Reser";
+            case _108: return "Huron Potawatomi, Inc., Michigan";
+            case _109: return "Inaja Band of Diegueno Mission Indians of the Inaj";
+            case _11: return "Augustine Band of Cahuilla Mission Indians of the";
+            case _110: return "Ione Band of Miwok Indians of California";
+            case _111: return "Iowa Tribe of Kansas and Nebraska";
+            case _112: return "Iowa Tribe of Oklahoma";
+            case _113: return "Jackson Rancheria of Me-Wuk Indians of California";
+            case _114: return "Jamestown S'Klallam Tribe of Washington";
+            case _115: return "Jamul Indian Village of California";
+            case _116: return "Jena Band of Choctaw Indians, Louisiana";
+            case _117: return "Jicarilla Apache Tribe of the Jicarilla Apache Ind";
+            case _118: return "Kaibab Band of Paiute Indians of the Kaibab Indian";
+            case _119: return "Kalispel Indian Community of the Kalispel Reservat";
+            case _12: return "Bad River Band of the Lake Superior Tribe of Chipp";
+            case _120: return "Karuk Tribe of California";
+            case _121: return "Kashia Band of Pomo Indians of the Stewarts Point";
+            case _122: return "Kaw Nation, Oklahoma";
+            case _123: return "Keweenaw Bay Indian Community of L'Anse and Ontona";
+            case _124: return "Kialegee Tribal Town, Oklahoma";
+            case _125: return "Kickapoo Tribe of Indians of the Kickapoo Reservat";
+            case _126: return "Kickapoo Tribe of Oklahoma";
+            case _127: return "Kickapoo Traditional Tribe of Texas";
+            case _128: return "Kiowa Indian Tribe of Oklahoma";
+            case _129: return "Klamath Indian Tribe of Oregon";
+            case _13: return "Bay Mills Indian Community of the Sault Ste. Marie";
+            case _130: return "Kootenai Tribe of Idaho";
+            case _131: return "La Jolla Band of Luiseno Mission Indians of the La";
+            case _132: return "La Posta Band of Diegueno Mission Indians of the L";
+            case _133: return "Lac Courte Oreilles Band of Lake Superior Chippewa";
+            case _134: return "Lac du Flambeau Band of Lake Superior Chippewa Ind";
+            case _135: return "Lac Vieux Desert Band of Lake Superior Chippewa In";
+            case _136: return "Las Vegas Tribe of Paiute Indians of the Las Vegas";
+            case _137: return "Little River Band of Ottawa Indians of Michigan";
+            case _138: return "Little Traverse Bay Bands of Odawa Indians of Mich";
+            case _139: return "Lower Lake Rancheria, California";
+            case _14: return "Bear River Band of the Rohnerville Rancheria, Cali";
+            case _140: return "Los Coyotes Band of Cahuilla Mission Indians of th";
+            case _141: return "Lovelock Paiute Tribe of the Lovelock Indian Colon";
+            case _142: return "Lower Brule Sioux Tribe of the Lower Brule Reserva";
+            case _143: return "Lower Elwha Tribal Community of the Lower Elwha Re";
+            case _144: return "Lower Sioux Indian Community of Minnesota Mdewakan";
+            case _145: return "Lummi Tribe of the Lummi Reservation, Washington";
+            case _146: return "Lytton Rancheria of California";
+            case _147: return "Makah Indian Tribe of the Makah Indian Reservation";
+            case _148: return "Manchester Band of Pomo Indians of the Manchester-";
+            case _149: return "Manzanita Band of Diegueno Mission Indians of the";
+            case _15: return "Berry Creek Rancheria of Maidu Indians of Californ";
+            case _150: return "Mashantucket Pequot Tribe of Connecticut";
+            case _151: return "Match-e-be-nash-she-wish Band of Pottawatomi India";
+            case _152: return "Mechoopda Indian Tribe of Chico Rancheria, Califor";
+            case _153: return "Menominee Indian Tribe of Wisconsin";
+            case _154: return "Mesa Grande Band of Diegueno Mission Indians of th";
+            case _155: return "Mescalero Apache Tribe of the Mescalero Reservatio";
+            case _156: return "Miami Tribe of Oklahoma";
+            case _157: return "Miccosukee Tribe of Indians of Florida";
+            case _158: return "Middletown Rancheria of Pomo Indians of California";
+            case _159: return "Minnesota Chippewa Tribe, Minnesota (Six component";
+            case _16: return "Big Lagoon Rancheria, California";
+            case _160: return "Bois Forte Band (Nett Lake); Fond du Lac Band; Gra";
+            case _161: return "Mississippi Band of Choctaw Indians, Mississippi";
+            case _162: return "Moapa Band of Paiute Indians of the Moapa River In";
+            case _163: return "Modoc Tribe of Oklahoma";
+            case _164: return "Mohegan Indian Tribe of Connecticut";
+            case _165: return "Mooretown Rancheria of Maidu Indians of California";
+            case _166: return "Morongo Band of Cahuilla Mission Indians of the Mo";
+            case _167: return "Muckleshoot Indian Tribe of the Muckleshoot Reserv";
+            case _168: return "Muscogee (Creek) Nation, Oklahoma";
+            case _169: return "Narragansett Indian Tribe of Rhode Island";
+            case _17: return "Big Pine Band of Owens Valley Paiute Shoshone Indi";
+            case _170: return "Navajo Nation, Arizona, New Mexico & Utah";
+            case _171: return "Nez Perce Tribe of Idaho";
+            case _172: return "Nisqually Indian Tribe of the Nisqually Reservatio";
+            case _173: return "Nooksack Indian Tribe of Washington";
+            case _174: return "Northern Cheyenne Tribe of the Northern Cheyenne I";
+            case _175: return "Northfork Rancheria of Mono Indians of California";
+            case _176: return "Northwestern Band of Shoshoni Nation of Utah (Wash";
+            case _177: return "Oglala Sioux Tribe of the Pine Ridge Reservation,";
+            case _178: return "Omaha Tribe of Nebraska";
+            case _179: return "Oneida Nation of New York";
+            case _18: return "Big Sandy Rancheria of Mono Indians of California";
+            case _180: return "Oneida Tribe of Wisconsin";
+            case _181: return "Onondaga Nation of New York";
+            case _182: return "Osage Tribe, Oklahoma";
+            case _183: return "Ottawa Tribe of Oklahoma";
+            case _184: return "Otoe-Missouria Tribe of Indians, Oklahoma";
+            case _185: return "Paiute Indian Tribe of Utah";
+            case _186: return "Paiute-Shoshone Indians of the Bishop Community of";
+            case _187: return "Paiute-Shoshone Tribe of the Fallon Reservation an";
+            case _188: return "Paiute-Shoshone Indians of the Lone Pine Community";
+            case _189: return "Pala Band of Luiseno Mission Indians of the Pala R";
+            case _19: return "Big Valley Band of Pomo Indians of the Big Valley";
+            case _190: return "Pascua Yaqui Tribe of Arizona";
+            case _191: return "Paskenta Band of Nomlaki Indians of California";
+            case _192: return "Passamaquoddy Tribe of Maine";
+            case _193: return "Pauma Band of Luiseno Mission Indians of the Pauma";
+            case _194: return "Pawnee Nation of Oklahoma";
+            case _195: return "Pechanga Band of Luiseno Mission Indians of the Pe";
+            case _196: return "Penobscot Tribe of Maine";
+            case _197: return "Peoria Tribe of Indians of Oklahoma";
+            case _198: return "Picayune Rancheria of Chukchansi Indians of Califo";
+            case _199: return "Pinoleville Rancheria of Pomo Indians of Californi";
+            case _2: return "Agua Caliente Band of Cahuilla Indians of the Agua";
+            case _20: return "Blackfeet Tribe of the Blackfeet Indian Reservatio";
+            case _200: return "Pit River Tribe, California (includes Big Bend, Lo";
+            case _201: return "Poarch Band of Creek Indians of Alabama";
+            case _202: return "Pokagon Band of Potawatomi Indians of Michigan";
+            case _203: return "Ponca Tribe of Indians of Oklahoma";
+            case _204: return "Ponca Tribe of Nebraska";
+            case _205: return "Port Gamble Indian Community of the Port Gamble Re";
+            case _206: return "Potter Valley Rancheria of Pomo Indians of Califor";
+            case _207: return "Prairie Band of Potawatomi Indians, Kansas";
+            case _208: return "Prairie Island Indian Community of Minnesota Mdewa";
+            case _209: return "Pueblo of Acoma, New Mexico";
+            case _21: return "Blue Lake Rancheria, California";
+            case _210: return "Pueblo of Cochiti, New Mexico";
+            case _211: return "Pueblo of Jemez, New Mexico";
+            case _212: return "Pueblo of Isleta, New Mexico";
+            case _213: return "Pueblo of Laguna, New Mexico";
+            case _214: return "Pueblo of Nambe, New Mexico";
+            case _215: return "Pueblo of Picuris, New Mexico";
+            case _216: return "Pueblo of Pojoaque, New Mexico";
+            case _217: return "Pueblo of San Felipe, New Mexico";
+            case _218: return "Pueblo of San Juan, New Mexico";
+            case _219: return "Pueblo of San Ildefonso, New Mexico";
+            case _22: return "Bridgeport Paiute Indian Colony of California";
+            case _220: return "Pueblo of Sandia, New Mexico";
+            case _221: return "Pueblo of Santa Ana, New Mexico";
+            case _222: return "Pueblo of Santa Clara, New Mexico";
+            case _223: return "Pueblo of Santo Domingo, New Mexico";
+            case _224: return "Pueblo of Taos, New Mexico";
+            case _225: return "Pueblo of Tesuque, New Mexico";
+            case _226: return "Pueblo of Zia, New Mexico";
+            case _227: return "Puyallup Tribe of the Puyallup Reservation, Washin";
+            case _228: return "Pyramid Lake Paiute Tribe of the Pyramid Lake Rese";
+            case _229: return "Quapaw Tribe of Indians, Oklahoma";
+            case _23: return "Buena Vista Rancheria of Me-Wuk Indians of Califor";
+            case _230: return "Quartz Valley Indian Community of the Quartz Valle";
+            case _231: return "Quechan Tribe of the Fort Yuma Indian Reservation,";
+            case _232: return "Quileute Tribe of the Quileute Reservation, Washin";
+            case _233: return "Quinault Tribe of the Quinault Reservation, Washin";
+            case _234: return "Ramona Band or Village of Cahuilla Mission Indians";
+            case _235: return "Red Cliff Band of Lake Superior Chippewa Indians o";
+            case _236: return "Red Lake Band of Chippewa Indians of the Red Lake";
+            case _237: return "Redding Rancheria, California";
+            case _238: return "Redwood Valley Rancheria of Pomo Indians of Califo";
+            case _239: return "Reno-Sparks Indian Colony, Nevada";
+            case _24: return "Burns Paiute Tribe of the Burns Paiute Indian Colo";
+            case _240: return "Resighini Rancheria, California (formerly known as";
+            case _241: return "Rincon Band of Luiseno Mission Indians of the Rinc";
+            case _242: return "Robinson Rancheria of Pomo Indians of California";
+            case _243: return "Rosebud Sioux Tribe of the Rosebud Indian Reservat";
+            case _244: return "Round Valley Indian Tribes of the Round Valley Res";
+            case _245: return "Rumsey Indian Rancheria of Wintun Indians of Calif";
+            case _246: return "Sac and Fox Tribe of the Mississippi in Iowa";
+            case _247: return "Sac and Fox Nation of Missouri in Kansas and Nebra";
+            case _248: return "Sac and Fox Nation, Oklahoma";
+            case _249: return "Saginaw Chippewa Indian Tribe of Michigan, Isabell";
+            case _25: return "Cabazon Band of Cahuilla Mission Indians of the Ca";
+            case _250: return "Salt River Pima-Maricopa Indian Community of the S";
+            case _251: return "Samish Indian Tribe, Washington";
+            case _252: return "San Carlos Apache Tribe of the San Carlos Reservat";
+            case _253: return "San Juan Southern Paiute Tribe of Arizona";
+            case _254: return "San Manual Band of Serrano Mission Indians of the";
+            case _255: return "San Pasqual Band of Diegueno Mission Indians of Ca";
+            case _256: return "Santa Rosa Indian Community of the Santa Rosa Ranc";
+            case _257: return "Santa Rosa Band of Cahuilla Mission Indians of the";
+            case _258: return "Santa Ynez Band of Chumash Mission Indians of the";
+            case _259: return "Santa Ysabel Band of Diegueno Mission Indians of t";
+            case _26: return "Cachil DeHe Band of Wintun Indians of the Colusa I";
+            case _260: return "Santee Sioux Tribe of the Santee Reservation of Ne";
+            case _261: return "Sauk-Suiattle Indian Tribe of Washington";
+            case _262: return "Sault Ste. Marie Tribe of Chippewa Indians of Mich";
+            case _263: return "Scotts Valley Band of Pomo Indians of California";
+            case _264: return "Seminole Nation of Oklahoma";
+            case _265: return "Seminole Tribe of Florida, Dania, Big Cypress, Bri";
+            case _266: return "Seneca Nation of New York";
+            case _267: return "Seneca-Cayuga Tribe of Oklahoma";
+            case _268: return "Shakopee Mdewakanton Sioux Community of Minnesota";
+            case _269: return "Shawnee Tribe, Oklahoma";
+            case _27: return "Caddo Indian Tribe of Oklahoma";
+            case _270: return "Sherwood Valley Rancheria of Pomo Indians of Calif";
+            case _271: return "Shingle Springs Band of Miwok Indians, Shingle Spr";
+            case _272: return "Shoalwater Bay Tribe of the Shoalwater Bay Indian";
+            case _273: return "Shoshone Tribe of the Wind River Reservation, Wyom";
+            case _274: return "Shoshone-Bannock Tribes of the Fort Hall Reservati";
+            case _275: return "Shoshone-Paiute Tribes of the Duck Valley Reservat";
+            case _276: return "Sisseton-Wahpeton Sioux Tribe of the Lake Traverse";
+            case _277: return "Skokomish Indian Tribe of the Skokomish Reservatio";
+            case _278: return "Skull Valley Band of Goshute Indians of Utah";
+            case _279: return "Smith River Rancheria, California";
+            case _28: return "Cahuilla Band of Mission Indians of the Cahuilla R";
+            case _280: return "Snoqualmie Tribe, Washington";
+            case _281: return "Soboba Band of Luiseno Indians, California (former";
+            case _282: return "Sokaogon Chippewa Community of the Mole Lake Band";
+            case _283: return "Southern Ute Indian Tribe of the Southern Ute Rese";
+            case _284: return "Spirit Lake Tribe, North Dakota (formerly known as";
+            case _285: return "Spokane Tribe of the Spokane Reservation, Washingt";
+            case _286: return "Squaxin Island Tribe of the Squaxin Island Reserva";
+            case _287: return "St. Croix Chippewa Indians of Wisconsin, St. Croix";
+            case _288: return "St. Regis Band of Mohawk Indians of New York";
+            case _289: return "Standing Rock Sioux Tribe of North & South Dakota";
+            case _29: return "Cahto Indian Tribe of the Laytonville Rancheria, C";
+            case _290: return "Stockbridge-Munsee Community of Mohican Indians of";
+            case _291: return "Stillaguamish Tribe of Washington";
+            case _292: return "Summit Lake Paiute Tribe of Nevada";
+            case _293: return "Suquamish Indian Tribe of the Port Madison Reserva";
+            case _294: return "Susanville Indian Rancheria, California";
+            case _295: return "Swinomish Indians of the Swinomish Reservation, Wa";
+            case _296: return "Sycuan Band of Diegueno Mission Indians of Califor";
+            case _297: return "Table Bluff Reservation - Wiyot Tribe, California";
+            case _298: return "Table Mountain Rancheria of California";
+            case _299: return "Te-Moak Tribe of Western Shoshone Indians of Nevad";
+            case _3: return "Ak Chin Indian Community of the Maricopa (Ak Chin)";
+            case _30: return "California Valley Miwok Tribe, California (formerl";
+            case _300: return "Thlopthlocco Tribal Town, Oklahoma";
+            case _301: return "Three Affiliated Tribes of the Fort Berthold Reser";
+            case _302: return "Tohono O'odham Nation of Arizona";
+            case _303: return "Tonawanda Band of Seneca Indians of New York";
+            case _304: return "Tonkawa Tribe of Indians of Oklahoma";
+            case _305: return "Tonto Apache Tribe of Arizona";
+            case _306: return "Torres-Martinez Band of Cahuilla Mission Indians o";
+            case _307: return "Tule River Indian Tribe of the Tule River Reservat";
+            case _308: return "Tulalip Tribes of the Tulalip Reservation, Washing";
+            case _309: return "Tunica-Biloxi Indian Tribe of Louisiana";
+            case _31: return "Campo Band of Diegueno Mission Indians of the Camp";
+            case _310: return "Tuolumne Band of Me-Wuk Indians of the Tuolumne Ra";
+            case _311: return "Turtle Mountain Band of Chippewa Indians of North";
+            case _312: return "Tuscarora Nation of New York";
+            case _313: return "Twenty-Nine Palms Band of Mission Indians of Calif";
+            case _314: return "United Auburn Indian Community of the Auburn Ranch";
+            case _315: return "United Keetoowah Band of Cherokee Indians of Oklah";
+            case _316: return "Upper Lake Band of Pomo Indians of Upper Lake Ranc";
+            case _317: return "Upper Sioux Indian Community of the Upper Sioux Re";
+            case _318: return "Upper Skagit Indian Tribe of Washington";
+            case _319: return "Ute Indian Tribe of the Uintah & Ouray Reservation";
+            case _32: return "Capitan Grande Band of Diegueno Mission Indians of";
+            case _320: return "Ute Mountain Tribe of the Ute Mountain Reservation";
+            case _321: return "Utu Utu Gwaitu Paiute Tribe of the Benton Paiute R";
+            case _322: return "Walker River Paiute Tribe of the Walker River Rese";
+            case _323: return "Wampanoag Tribe of Gay Head (Aquinnah) of Massachu";
+            case _324: return "Washoe Tribe of Nevada & California (Carson Colony";
+            case _325: return "White Mountain Apache Tribe of the Fort Apache Res";
+            case _326: return "Wichita and Affiliated Tribes (Wichita, Keechi, Wa";
+            case _327: return "Winnebago Tribe of Nebraska";
+            case _328: return "Winnemucca Indian Colony of Nevada";
+            case _329: return "Wyandotte Tribe of Oklahoma";
+            case _33: return "Barona Group of Capitan Grande Band of Mission Ind";
+            case _330: return "Yankton Sioux Tribe of South Dakota";
+            case _331: return "Yavapai-Apache Nation of the Camp Verde Indian Res";
+            case _332: return "Yavapai-Prescott Tribe of the Yavapai Reservation,";
+            case _333: return "Yerington Paiute Tribe of the Yerington Colony & C";
+            case _334: return "Yomba Shoshone Tribe of the Yomba Reservation, Nev";
+            case _335: return "Ysleta Del Sur Pueblo of Texas";
+            case _336: return "Yurok Tribe of the Yurok Reservation, California";
+            case _337: return "Zuni Tribe of the Zuni Reservation, New Mexico";
+            case _34: return "Viejas (Baron Long) Group of Capitan Grande Band o";
+            case _35: return "Catawba Indian Nation (aka Catawba Tribe of South";
+            case _36: return "Cayuga Nation of New York";
+            case _37: return "Cedarville Rancheria, California";
+            case _38: return "Chemehuevi Indian Tribe of the Chemehuevi Reservat";
+            case _39: return "Cher-Ae Heights Indian Community of the Trinidad R";
+            case _4: return "Alabama-Coushatta Tribes of Texas";
+            case _40: return "Cherokee Nation, Oklahoma";
+            case _41: return "Cheyenne-Arapaho Tribes of Oklahoma";
+            case _42: return "Cheyenne River Sioux Tribe of the Cheyenne River R";
+            case _43: return "Chickasaw Nation, Oklahoma";
+            case _44: return "Chicken Ranch Rancheria of Me-Wuk Indians of Calif";
+            case _45: return "Chippewa-Cree Indians of the Rocky Boy's Reservati";
+            case _46: return "Chitimacha Tribe of Louisiana";
+            case _47: return "Choctaw Nation of Oklahoma";
+            case _48: return "Citizen Potawatomi Nation, Oklahoma";
+            case _49: return "Cloverdale Rancheria of Pomo Indians of California";
+            case _5: return "Alabama-Quassarte Tribal Town, Oklahoma";
+            case _50: return "Cocopah Tribe of Arizona";
+            case _51: return "Coeur D'Alene Tribe of the Coeur D'Alene Reservati";
+            case _52: return "Cold Springs Rancheria of Mono Indians of Californ";
+            case _53: return "Colorado River Indian Tribes of the Colorado River";
+            case _54: return "Comanche Indian Tribe, Oklahoma";
+            case _55: return "Confederated Salish & Kootenai Tribes of the Flath";
+            case _56: return "Confederated Tribes of the Chehalis Reservation, W";
+            case _57: return "Confederated Tribes of the Colville Reservation, W";
+            case _58: return "Confederated Tribes of the Coos, Lower Umpqua and";
+            case _59: return "Confederated Tribes of the Goshute Reservation, Ne";
+            case _6: return "Alturas Indian Rancheria, California";
+            case _60: return "Confederated Tribes of the Grand Ronde Community o";
+            case _61: return "Confederated Tribes of the Siletz Reservation, Ore";
+            case _62: return "Confederated Tribes of the Umatilla Reservation, O";
+            case _63: return "Confederated Tribes of the Warm Springs Reservatio";
+            case _64: return "Confederated Tribes and Bands of the Yakama Indian";
+            case _65: return "Coquille Tribe of Oregon";
+            case _66: return "Cortina Indian Rancheria of Wintun Indians of Cali";
+            case _67: return "Coushatta Tribe of Louisiana";
+            case _68: return "Cow Creek Band of Umpqua Indians of Oregon";
+            case _69: return "Coyote Valley Band of Pomo Indians of California";
+            case _7: return "Apache Tribe of Oklahoma";
+            case _70: return "Crow Tribe of Montana";
+            case _71: return "Crow Creek Sioux Tribe of the Crow Creek Reservati";
+            case _72: return "Cuyapaipe Community of Diegueno Mission Indians of";
+            case _73: return "Death Valley Timbi-Sha Shoshone Band of California";
+            case _74: return "Delaware Nation, Oklahoma (formerly Delaware Tribe";
+            case _75: return "Delaware Tribe of Indians, Oklahoma";
+            case _76: return "Dry Creek Rancheria of Pomo Indians of California";
+            case _77: return "Duckwater Shoshone Tribe of the Duckwater Reservat";
+            case _78: return "Eastern Band of Cherokee Indians of North Carolina";
+            case _79: return "Eastern Shawnee Tribe of Oklahoma";
+            case _8: return "Arapahoe Tribe of the Wind River Reservation, Wyom";
+            case _80: return "Elem Indian Colony of Pomo Indians of the Sulphur";
+            case _81: return "Elk Valley Rancheria, California";
+            case _82: return "Ely Shoshone Tribe of Nevada";
+            case _83: return "Enterprise Rancheria of Maidu Indians of Californi";
+            case _84: return "Flandreau Santee Sioux Tribe of South Dakota";
+            case _85: return "Forest County Potawatomi Community of Wisconsin Po";
+            case _86: return "Fort Belknap Indian Community of the Fort Belknap";
+            case _87: return "Fort Bidwell Indian Community of the Fort Bidwell";
+            case _88: return "Fort Independence Indian Community of Paiute India";
+            case _89: return "Fort McDermitt Paiute and Shoshone Tribes of the F";
+            case _9: return "Aroostook Band of Micmac Indians of Maine";
+            case _90: return "Fort McDowell Yavapai Nation, Arizona (formerly th";
+            case _91: return "Fort Mojave Indian Tribe of Arizona, California";
+            case _92: return "Fort Sill Apache Tribe of Oklahoma";
+            case _93: return "Gila River Indian Community of the Gila River Indi";
+            case _94: return "Grand Traverse Band of Ottawa & Chippewa Indians o";
+            case _95: return "Graton Rancheria, California";
+            case _96: return "Greenville Rancheria of Maidu Indians of Californi";
+            case _97: return "Grindstone Indian Rancheria of Wintun-Wailaki Indi";
+            case _98: return "Guidiville Rancheria of California";
+            case _99: return "Hannahville Indian Community of Wisconsin Potawato";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TribalEntityUSEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TribalEntityUSEnumFactory.java
new file mode 100644
index 00000000000..e5eb6935f0e
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3TribalEntityUSEnumFactory.java
@@ -0,0 +1,2326 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3TribalEntityUSEnumFactory implements EnumFactory {
+
+  public V3TribalEntityUS fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("_NativeEntityAlaska".equals(codeString))
+      return V3TribalEntityUS._NATIVEENTITYALASKA;
+    if ("338".equals(codeString))
+      return V3TribalEntityUS._338;
+    if ("339".equals(codeString))
+      return V3TribalEntityUS._339;
+    if ("340".equals(codeString))
+      return V3TribalEntityUS._340;
+    if ("341".equals(codeString))
+      return V3TribalEntityUS._341;
+    if ("342".equals(codeString))
+      return V3TribalEntityUS._342;
+    if ("343".equals(codeString))
+      return V3TribalEntityUS._343;
+    if ("344".equals(codeString))
+      return V3TribalEntityUS._344;
+    if ("345".equals(codeString))
+      return V3TribalEntityUS._345;
+    if ("346".equals(codeString))
+      return V3TribalEntityUS._346;
+    if ("347".equals(codeString))
+      return V3TribalEntityUS._347;
+    if ("348".equals(codeString))
+      return V3TribalEntityUS._348;
+    if ("349".equals(codeString))
+      return V3TribalEntityUS._349;
+    if ("350".equals(codeString))
+      return V3TribalEntityUS._350;
+    if ("351".equals(codeString))
+      return V3TribalEntityUS._351;
+    if ("352".equals(codeString))
+      return V3TribalEntityUS._352;
+    if ("353".equals(codeString))
+      return V3TribalEntityUS._353;
+    if ("354".equals(codeString))
+      return V3TribalEntityUS._354;
+    if ("355".equals(codeString))
+      return V3TribalEntityUS._355;
+    if ("356".equals(codeString))
+      return V3TribalEntityUS._356;
+    if ("357".equals(codeString))
+      return V3TribalEntityUS._357;
+    if ("358".equals(codeString))
+      return V3TribalEntityUS._358;
+    if ("359".equals(codeString))
+      return V3TribalEntityUS._359;
+    if ("360".equals(codeString))
+      return V3TribalEntityUS._360;
+    if ("361".equals(codeString))
+      return V3TribalEntityUS._361;
+    if ("362".equals(codeString))
+      return V3TribalEntityUS._362;
+    if ("363".equals(codeString))
+      return V3TribalEntityUS._363;
+    if ("364".equals(codeString))
+      return V3TribalEntityUS._364;
+    if ("365".equals(codeString))
+      return V3TribalEntityUS._365;
+    if ("366".equals(codeString))
+      return V3TribalEntityUS._366;
+    if ("367".equals(codeString))
+      return V3TribalEntityUS._367;
+    if ("368".equals(codeString))
+      return V3TribalEntityUS._368;
+    if ("369".equals(codeString))
+      return V3TribalEntityUS._369;
+    if ("370".equals(codeString))
+      return V3TribalEntityUS._370;
+    if ("371".equals(codeString))
+      return V3TribalEntityUS._371;
+    if ("372".equals(codeString))
+      return V3TribalEntityUS._372;
+    if ("373".equals(codeString))
+      return V3TribalEntityUS._373;
+    if ("374".equals(codeString))
+      return V3TribalEntityUS._374;
+    if ("375".equals(codeString))
+      return V3TribalEntityUS._375;
+    if ("376".equals(codeString))
+      return V3TribalEntityUS._376;
+    if ("377".equals(codeString))
+      return V3TribalEntityUS._377;
+    if ("378".equals(codeString))
+      return V3TribalEntityUS._378;
+    if ("379".equals(codeString))
+      return V3TribalEntityUS._379;
+    if ("380".equals(codeString))
+      return V3TribalEntityUS._380;
+    if ("381".equals(codeString))
+      return V3TribalEntityUS._381;
+    if ("382".equals(codeString))
+      return V3TribalEntityUS._382;
+    if ("383".equals(codeString))
+      return V3TribalEntityUS._383;
+    if ("384".equals(codeString))
+      return V3TribalEntityUS._384;
+    if ("385".equals(codeString))
+      return V3TribalEntityUS._385;
+    if ("386".equals(codeString))
+      return V3TribalEntityUS._386;
+    if ("387".equals(codeString))
+      return V3TribalEntityUS._387;
+    if ("388".equals(codeString))
+      return V3TribalEntityUS._388;
+    if ("389".equals(codeString))
+      return V3TribalEntityUS._389;
+    if ("390".equals(codeString))
+      return V3TribalEntityUS._390;
+    if ("391".equals(codeString))
+      return V3TribalEntityUS._391;
+    if ("392".equals(codeString))
+      return V3TribalEntityUS._392;
+    if ("393".equals(codeString))
+      return V3TribalEntityUS._393;
+    if ("394".equals(codeString))
+      return V3TribalEntityUS._394;
+    if ("395".equals(codeString))
+      return V3TribalEntityUS._395;
+    if ("396".equals(codeString))
+      return V3TribalEntityUS._396;
+    if ("397".equals(codeString))
+      return V3TribalEntityUS._397;
+    if ("398".equals(codeString))
+      return V3TribalEntityUS._398;
+    if ("399".equals(codeString))
+      return V3TribalEntityUS._399;
+    if ("400".equals(codeString))
+      return V3TribalEntityUS._400;
+    if ("401".equals(codeString))
+      return V3TribalEntityUS._401;
+    if ("402".equals(codeString))
+      return V3TribalEntityUS._402;
+    if ("403".equals(codeString))
+      return V3TribalEntityUS._403;
+    if ("404".equals(codeString))
+      return V3TribalEntityUS._404;
+    if ("405".equals(codeString))
+      return V3TribalEntityUS._405;
+    if ("406".equals(codeString))
+      return V3TribalEntityUS._406;
+    if ("407".equals(codeString))
+      return V3TribalEntityUS._407;
+    if ("408".equals(codeString))
+      return V3TribalEntityUS._408;
+    if ("409".equals(codeString))
+      return V3TribalEntityUS._409;
+    if ("410".equals(codeString))
+      return V3TribalEntityUS._410;
+    if ("411".equals(codeString))
+      return V3TribalEntityUS._411;
+    if ("412".equals(codeString))
+      return V3TribalEntityUS._412;
+    if ("413".equals(codeString))
+      return V3TribalEntityUS._413;
+    if ("414".equals(codeString))
+      return V3TribalEntityUS._414;
+    if ("415".equals(codeString))
+      return V3TribalEntityUS._415;
+    if ("416".equals(codeString))
+      return V3TribalEntityUS._416;
+    if ("417".equals(codeString))
+      return V3TribalEntityUS._417;
+    if ("418".equals(codeString))
+      return V3TribalEntityUS._418;
+    if ("419".equals(codeString))
+      return V3TribalEntityUS._419;
+    if ("420".equals(codeString))
+      return V3TribalEntityUS._420;
+    if ("421".equals(codeString))
+      return V3TribalEntityUS._421;
+    if ("422".equals(codeString))
+      return V3TribalEntityUS._422;
+    if ("423".equals(codeString))
+      return V3TribalEntityUS._423;
+    if ("424".equals(codeString))
+      return V3TribalEntityUS._424;
+    if ("425".equals(codeString))
+      return V3TribalEntityUS._425;
+    if ("426".equals(codeString))
+      return V3TribalEntityUS._426;
+    if ("427".equals(codeString))
+      return V3TribalEntityUS._427;
+    if ("428".equals(codeString))
+      return V3TribalEntityUS._428;
+    if ("429".equals(codeString))
+      return V3TribalEntityUS._429;
+    if ("430".equals(codeString))
+      return V3TribalEntityUS._430;
+    if ("431".equals(codeString))
+      return V3TribalEntityUS._431;
+    if ("432".equals(codeString))
+      return V3TribalEntityUS._432;
+    if ("433".equals(codeString))
+      return V3TribalEntityUS._433;
+    if ("434".equals(codeString))
+      return V3TribalEntityUS._434;
+    if ("435".equals(codeString))
+      return V3TribalEntityUS._435;
+    if ("436".equals(codeString))
+      return V3TribalEntityUS._436;
+    if ("437".equals(codeString))
+      return V3TribalEntityUS._437;
+    if ("438".equals(codeString))
+      return V3TribalEntityUS._438;
+    if ("439".equals(codeString))
+      return V3TribalEntityUS._439;
+    if ("440".equals(codeString))
+      return V3TribalEntityUS._440;
+    if ("441".equals(codeString))
+      return V3TribalEntityUS._441;
+    if ("442".equals(codeString))
+      return V3TribalEntityUS._442;
+    if ("443".equals(codeString))
+      return V3TribalEntityUS._443;
+    if ("444".equals(codeString))
+      return V3TribalEntityUS._444;
+    if ("445".equals(codeString))
+      return V3TribalEntityUS._445;
+    if ("446".equals(codeString))
+      return V3TribalEntityUS._446;
+    if ("447".equals(codeString))
+      return V3TribalEntityUS._447;
+    if ("448".equals(codeString))
+      return V3TribalEntityUS._448;
+    if ("449".equals(codeString))
+      return V3TribalEntityUS._449;
+    if ("450".equals(codeString))
+      return V3TribalEntityUS._450;
+    if ("451".equals(codeString))
+      return V3TribalEntityUS._451;
+    if ("452".equals(codeString))
+      return V3TribalEntityUS._452;
+    if ("453".equals(codeString))
+      return V3TribalEntityUS._453;
+    if ("454".equals(codeString))
+      return V3TribalEntityUS._454;
+    if ("455".equals(codeString))
+      return V3TribalEntityUS._455;
+    if ("456".equals(codeString))
+      return V3TribalEntityUS._456;
+    if ("457".equals(codeString))
+      return V3TribalEntityUS._457;
+    if ("458".equals(codeString))
+      return V3TribalEntityUS._458;
+    if ("459".equals(codeString))
+      return V3TribalEntityUS._459;
+    if ("460".equals(codeString))
+      return V3TribalEntityUS._460;
+    if ("461".equals(codeString))
+      return V3TribalEntityUS._461;
+    if ("462".equals(codeString))
+      return V3TribalEntityUS._462;
+    if ("463".equals(codeString))
+      return V3TribalEntityUS._463;
+    if ("464".equals(codeString))
+      return V3TribalEntityUS._464;
+    if ("465".equals(codeString))
+      return V3TribalEntityUS._465;
+    if ("466".equals(codeString))
+      return V3TribalEntityUS._466;
+    if ("467".equals(codeString))
+      return V3TribalEntityUS._467;
+    if ("468".equals(codeString))
+      return V3TribalEntityUS._468;
+    if ("469".equals(codeString))
+      return V3TribalEntityUS._469;
+    if ("470".equals(codeString))
+      return V3TribalEntityUS._470;
+    if ("471".equals(codeString))
+      return V3TribalEntityUS._471;
+    if ("472".equals(codeString))
+      return V3TribalEntityUS._472;
+    if ("473".equals(codeString))
+      return V3TribalEntityUS._473;
+    if ("474".equals(codeString))
+      return V3TribalEntityUS._474;
+    if ("475".equals(codeString))
+      return V3TribalEntityUS._475;
+    if ("476".equals(codeString))
+      return V3TribalEntityUS._476;
+    if ("477".equals(codeString))
+      return V3TribalEntityUS._477;
+    if ("478".equals(codeString))
+      return V3TribalEntityUS._478;
+    if ("479".equals(codeString))
+      return V3TribalEntityUS._479;
+    if ("480".equals(codeString))
+      return V3TribalEntityUS._480;
+    if ("481".equals(codeString))
+      return V3TribalEntityUS._481;
+    if ("482".equals(codeString))
+      return V3TribalEntityUS._482;
+    if ("483".equals(codeString))
+      return V3TribalEntityUS._483;
+    if ("484".equals(codeString))
+      return V3TribalEntityUS._484;
+    if ("485".equals(codeString))
+      return V3TribalEntityUS._485;
+    if ("486".equals(codeString))
+      return V3TribalEntityUS._486;
+    if ("487".equals(codeString))
+      return V3TribalEntityUS._487;
+    if ("488".equals(codeString))
+      return V3TribalEntityUS._488;
+    if ("489".equals(codeString))
+      return V3TribalEntityUS._489;
+    if ("490".equals(codeString))
+      return V3TribalEntityUS._490;
+    if ("491".equals(codeString))
+      return V3TribalEntityUS._491;
+    if ("492".equals(codeString))
+      return V3TribalEntityUS._492;
+    if ("493".equals(codeString))
+      return V3TribalEntityUS._493;
+    if ("494".equals(codeString))
+      return V3TribalEntityUS._494;
+    if ("495".equals(codeString))
+      return V3TribalEntityUS._495;
+    if ("496".equals(codeString))
+      return V3TribalEntityUS._496;
+    if ("497".equals(codeString))
+      return V3TribalEntityUS._497;
+    if ("498".equals(codeString))
+      return V3TribalEntityUS._498;
+    if ("499".equals(codeString))
+      return V3TribalEntityUS._499;
+    if ("500".equals(codeString))
+      return V3TribalEntityUS._500;
+    if ("501".equals(codeString))
+      return V3TribalEntityUS._501;
+    if ("502".equals(codeString))
+      return V3TribalEntityUS._502;
+    if ("503".equals(codeString))
+      return V3TribalEntityUS._503;
+    if ("504".equals(codeString))
+      return V3TribalEntityUS._504;
+    if ("505".equals(codeString))
+      return V3TribalEntityUS._505;
+    if ("506".equals(codeString))
+      return V3TribalEntityUS._506;
+    if ("507".equals(codeString))
+      return V3TribalEntityUS._507;
+    if ("508".equals(codeString))
+      return V3TribalEntityUS._508;
+    if ("509".equals(codeString))
+      return V3TribalEntityUS._509;
+    if ("510".equals(codeString))
+      return V3TribalEntityUS._510;
+    if ("511".equals(codeString))
+      return V3TribalEntityUS._511;
+    if ("512".equals(codeString))
+      return V3TribalEntityUS._512;
+    if ("513".equals(codeString))
+      return V3TribalEntityUS._513;
+    if ("514".equals(codeString))
+      return V3TribalEntityUS._514;
+    if ("515".equals(codeString))
+      return V3TribalEntityUS._515;
+    if ("516".equals(codeString))
+      return V3TribalEntityUS._516;
+    if ("517".equals(codeString))
+      return V3TribalEntityUS._517;
+    if ("518".equals(codeString))
+      return V3TribalEntityUS._518;
+    if ("519".equals(codeString))
+      return V3TribalEntityUS._519;
+    if ("520".equals(codeString))
+      return V3TribalEntityUS._520;
+    if ("521".equals(codeString))
+      return V3TribalEntityUS._521;
+    if ("522".equals(codeString))
+      return V3TribalEntityUS._522;
+    if ("523".equals(codeString))
+      return V3TribalEntityUS._523;
+    if ("524".equals(codeString))
+      return V3TribalEntityUS._524;
+    if ("525".equals(codeString))
+      return V3TribalEntityUS._525;
+    if ("526".equals(codeString))
+      return V3TribalEntityUS._526;
+    if ("527".equals(codeString))
+      return V3TribalEntityUS._527;
+    if ("528".equals(codeString))
+      return V3TribalEntityUS._528;
+    if ("529".equals(codeString))
+      return V3TribalEntityUS._529;
+    if ("530".equals(codeString))
+      return V3TribalEntityUS._530;
+    if ("531".equals(codeString))
+      return V3TribalEntityUS._531;
+    if ("532".equals(codeString))
+      return V3TribalEntityUS._532;
+    if ("533".equals(codeString))
+      return V3TribalEntityUS._533;
+    if ("534".equals(codeString))
+      return V3TribalEntityUS._534;
+    if ("535".equals(codeString))
+      return V3TribalEntityUS._535;
+    if ("536".equals(codeString))
+      return V3TribalEntityUS._536;
+    if ("537".equals(codeString))
+      return V3TribalEntityUS._537;
+    if ("538".equals(codeString))
+      return V3TribalEntityUS._538;
+    if ("539".equals(codeString))
+      return V3TribalEntityUS._539;
+    if ("540".equals(codeString))
+      return V3TribalEntityUS._540;
+    if ("541".equals(codeString))
+      return V3TribalEntityUS._541;
+    if ("542".equals(codeString))
+      return V3TribalEntityUS._542;
+    if ("543".equals(codeString))
+      return V3TribalEntityUS._543;
+    if ("544".equals(codeString))
+      return V3TribalEntityUS._544;
+    if ("545".equals(codeString))
+      return V3TribalEntityUS._545;
+    if ("546".equals(codeString))
+      return V3TribalEntityUS._546;
+    if ("547".equals(codeString))
+      return V3TribalEntityUS._547;
+    if ("548".equals(codeString))
+      return V3TribalEntityUS._548;
+    if ("549".equals(codeString))
+      return V3TribalEntityUS._549;
+    if ("550".equals(codeString))
+      return V3TribalEntityUS._550;
+    if ("551".equals(codeString))
+      return V3TribalEntityUS._551;
+    if ("552".equals(codeString))
+      return V3TribalEntityUS._552;
+    if ("553".equals(codeString))
+      return V3TribalEntityUS._553;
+    if ("554".equals(codeString))
+      return V3TribalEntityUS._554;
+    if ("555".equals(codeString))
+      return V3TribalEntityUS._555;
+    if ("556".equals(codeString))
+      return V3TribalEntityUS._556;
+    if ("557".equals(codeString))
+      return V3TribalEntityUS._557;
+    if ("558".equals(codeString))
+      return V3TribalEntityUS._558;
+    if ("559".equals(codeString))
+      return V3TribalEntityUS._559;
+    if ("560".equals(codeString))
+      return V3TribalEntityUS._560;
+    if ("561".equals(codeString))
+      return V3TribalEntityUS._561;
+    if ("562".equals(codeString))
+      return V3TribalEntityUS._562;
+    if ("563".equals(codeString))
+      return V3TribalEntityUS._563;
+    if ("564".equals(codeString))
+      return V3TribalEntityUS._564;
+    if ("565".equals(codeString))
+      return V3TribalEntityUS._565;
+    if ("566".equals(codeString))
+      return V3TribalEntityUS._566;
+    if ("_NativeEntityContiguous".equals(codeString))
+      return V3TribalEntityUS._NATIVEENTITYCONTIGUOUS;
+    if ("1".equals(codeString))
+      return V3TribalEntityUS._1;
+    if ("10".equals(codeString))
+      return V3TribalEntityUS._10;
+    if ("100".equals(codeString))
+      return V3TribalEntityUS._100;
+    if ("101".equals(codeString))
+      return V3TribalEntityUS._101;
+    if ("102".equals(codeString))
+      return V3TribalEntityUS._102;
+    if ("103".equals(codeString))
+      return V3TribalEntityUS._103;
+    if ("104".equals(codeString))
+      return V3TribalEntityUS._104;
+    if ("105".equals(codeString))
+      return V3TribalEntityUS._105;
+    if ("106".equals(codeString))
+      return V3TribalEntityUS._106;
+    if ("107".equals(codeString))
+      return V3TribalEntityUS._107;
+    if ("108".equals(codeString))
+      return V3TribalEntityUS._108;
+    if ("109".equals(codeString))
+      return V3TribalEntityUS._109;
+    if ("11".equals(codeString))
+      return V3TribalEntityUS._11;
+    if ("110".equals(codeString))
+      return V3TribalEntityUS._110;
+    if ("111".equals(codeString))
+      return V3TribalEntityUS._111;
+    if ("112".equals(codeString))
+      return V3TribalEntityUS._112;
+    if ("113".equals(codeString))
+      return V3TribalEntityUS._113;
+    if ("114".equals(codeString))
+      return V3TribalEntityUS._114;
+    if ("115".equals(codeString))
+      return V3TribalEntityUS._115;
+    if ("116".equals(codeString))
+      return V3TribalEntityUS._116;
+    if ("117".equals(codeString))
+      return V3TribalEntityUS._117;
+    if ("118".equals(codeString))
+      return V3TribalEntityUS._118;
+    if ("119".equals(codeString))
+      return V3TribalEntityUS._119;
+    if ("12".equals(codeString))
+      return V3TribalEntityUS._12;
+    if ("120".equals(codeString))
+      return V3TribalEntityUS._120;
+    if ("121".equals(codeString))
+      return V3TribalEntityUS._121;
+    if ("122".equals(codeString))
+      return V3TribalEntityUS._122;
+    if ("123".equals(codeString))
+      return V3TribalEntityUS._123;
+    if ("124".equals(codeString))
+      return V3TribalEntityUS._124;
+    if ("125".equals(codeString))
+      return V3TribalEntityUS._125;
+    if ("126".equals(codeString))
+      return V3TribalEntityUS._126;
+    if ("127".equals(codeString))
+      return V3TribalEntityUS._127;
+    if ("128".equals(codeString))
+      return V3TribalEntityUS._128;
+    if ("129".equals(codeString))
+      return V3TribalEntityUS._129;
+    if ("13".equals(codeString))
+      return V3TribalEntityUS._13;
+    if ("130".equals(codeString))
+      return V3TribalEntityUS._130;
+    if ("131".equals(codeString))
+      return V3TribalEntityUS._131;
+    if ("132".equals(codeString))
+      return V3TribalEntityUS._132;
+    if ("133".equals(codeString))
+      return V3TribalEntityUS._133;
+    if ("134".equals(codeString))
+      return V3TribalEntityUS._134;
+    if ("135".equals(codeString))
+      return V3TribalEntityUS._135;
+    if ("136".equals(codeString))
+      return V3TribalEntityUS._136;
+    if ("137".equals(codeString))
+      return V3TribalEntityUS._137;
+    if ("138".equals(codeString))
+      return V3TribalEntityUS._138;
+    if ("139".equals(codeString))
+      return V3TribalEntityUS._139;
+    if ("14".equals(codeString))
+      return V3TribalEntityUS._14;
+    if ("140".equals(codeString))
+      return V3TribalEntityUS._140;
+    if ("141".equals(codeString))
+      return V3TribalEntityUS._141;
+    if ("142".equals(codeString))
+      return V3TribalEntityUS._142;
+    if ("143".equals(codeString))
+      return V3TribalEntityUS._143;
+    if ("144".equals(codeString))
+      return V3TribalEntityUS._144;
+    if ("145".equals(codeString))
+      return V3TribalEntityUS._145;
+    if ("146".equals(codeString))
+      return V3TribalEntityUS._146;
+    if ("147".equals(codeString))
+      return V3TribalEntityUS._147;
+    if ("148".equals(codeString))
+      return V3TribalEntityUS._148;
+    if ("149".equals(codeString))
+      return V3TribalEntityUS._149;
+    if ("15".equals(codeString))
+      return V3TribalEntityUS._15;
+    if ("150".equals(codeString))
+      return V3TribalEntityUS._150;
+    if ("151".equals(codeString))
+      return V3TribalEntityUS._151;
+    if ("152".equals(codeString))
+      return V3TribalEntityUS._152;
+    if ("153".equals(codeString))
+      return V3TribalEntityUS._153;
+    if ("154".equals(codeString))
+      return V3TribalEntityUS._154;
+    if ("155".equals(codeString))
+      return V3TribalEntityUS._155;
+    if ("156".equals(codeString))
+      return V3TribalEntityUS._156;
+    if ("157".equals(codeString))
+      return V3TribalEntityUS._157;
+    if ("158".equals(codeString))
+      return V3TribalEntityUS._158;
+    if ("159".equals(codeString))
+      return V3TribalEntityUS._159;
+    if ("16".equals(codeString))
+      return V3TribalEntityUS._16;
+    if ("160".equals(codeString))
+      return V3TribalEntityUS._160;
+    if ("161".equals(codeString))
+      return V3TribalEntityUS._161;
+    if ("162".equals(codeString))
+      return V3TribalEntityUS._162;
+    if ("163".equals(codeString))
+      return V3TribalEntityUS._163;
+    if ("164".equals(codeString))
+      return V3TribalEntityUS._164;
+    if ("165".equals(codeString))
+      return V3TribalEntityUS._165;
+    if ("166".equals(codeString))
+      return V3TribalEntityUS._166;
+    if ("167".equals(codeString))
+      return V3TribalEntityUS._167;
+    if ("168".equals(codeString))
+      return V3TribalEntityUS._168;
+    if ("169".equals(codeString))
+      return V3TribalEntityUS._169;
+    if ("17".equals(codeString))
+      return V3TribalEntityUS._17;
+    if ("170".equals(codeString))
+      return V3TribalEntityUS._170;
+    if ("171".equals(codeString))
+      return V3TribalEntityUS._171;
+    if ("172".equals(codeString))
+      return V3TribalEntityUS._172;
+    if ("173".equals(codeString))
+      return V3TribalEntityUS._173;
+    if ("174".equals(codeString))
+      return V3TribalEntityUS._174;
+    if ("175".equals(codeString))
+      return V3TribalEntityUS._175;
+    if ("176".equals(codeString))
+      return V3TribalEntityUS._176;
+    if ("177".equals(codeString))
+      return V3TribalEntityUS._177;
+    if ("178".equals(codeString))
+      return V3TribalEntityUS._178;
+    if ("179".equals(codeString))
+      return V3TribalEntityUS._179;
+    if ("18".equals(codeString))
+      return V3TribalEntityUS._18;
+    if ("180".equals(codeString))
+      return V3TribalEntityUS._180;
+    if ("181".equals(codeString))
+      return V3TribalEntityUS._181;
+    if ("182".equals(codeString))
+      return V3TribalEntityUS._182;
+    if ("183".equals(codeString))
+      return V3TribalEntityUS._183;
+    if ("184".equals(codeString))
+      return V3TribalEntityUS._184;
+    if ("185".equals(codeString))
+      return V3TribalEntityUS._185;
+    if ("186".equals(codeString))
+      return V3TribalEntityUS._186;
+    if ("187".equals(codeString))
+      return V3TribalEntityUS._187;
+    if ("188".equals(codeString))
+      return V3TribalEntityUS._188;
+    if ("189".equals(codeString))
+      return V3TribalEntityUS._189;
+    if ("19".equals(codeString))
+      return V3TribalEntityUS._19;
+    if ("190".equals(codeString))
+      return V3TribalEntityUS._190;
+    if ("191".equals(codeString))
+      return V3TribalEntityUS._191;
+    if ("192".equals(codeString))
+      return V3TribalEntityUS._192;
+    if ("193".equals(codeString))
+      return V3TribalEntityUS._193;
+    if ("194".equals(codeString))
+      return V3TribalEntityUS._194;
+    if ("195".equals(codeString))
+      return V3TribalEntityUS._195;
+    if ("196".equals(codeString))
+      return V3TribalEntityUS._196;
+    if ("197".equals(codeString))
+      return V3TribalEntityUS._197;
+    if ("198".equals(codeString))
+      return V3TribalEntityUS._198;
+    if ("199".equals(codeString))
+      return V3TribalEntityUS._199;
+    if ("2".equals(codeString))
+      return V3TribalEntityUS._2;
+    if ("20".equals(codeString))
+      return V3TribalEntityUS._20;
+    if ("200".equals(codeString))
+      return V3TribalEntityUS._200;
+    if ("201".equals(codeString))
+      return V3TribalEntityUS._201;
+    if ("202".equals(codeString))
+      return V3TribalEntityUS._202;
+    if ("203".equals(codeString))
+      return V3TribalEntityUS._203;
+    if ("204".equals(codeString))
+      return V3TribalEntityUS._204;
+    if ("205".equals(codeString))
+      return V3TribalEntityUS._205;
+    if ("206".equals(codeString))
+      return V3TribalEntityUS._206;
+    if ("207".equals(codeString))
+      return V3TribalEntityUS._207;
+    if ("208".equals(codeString))
+      return V3TribalEntityUS._208;
+    if ("209".equals(codeString))
+      return V3TribalEntityUS._209;
+    if ("21".equals(codeString))
+      return V3TribalEntityUS._21;
+    if ("210".equals(codeString))
+      return V3TribalEntityUS._210;
+    if ("211".equals(codeString))
+      return V3TribalEntityUS._211;
+    if ("212".equals(codeString))
+      return V3TribalEntityUS._212;
+    if ("213".equals(codeString))
+      return V3TribalEntityUS._213;
+    if ("214".equals(codeString))
+      return V3TribalEntityUS._214;
+    if ("215".equals(codeString))
+      return V3TribalEntityUS._215;
+    if ("216".equals(codeString))
+      return V3TribalEntityUS._216;
+    if ("217".equals(codeString))
+      return V3TribalEntityUS._217;
+    if ("218".equals(codeString))
+      return V3TribalEntityUS._218;
+    if ("219".equals(codeString))
+      return V3TribalEntityUS._219;
+    if ("22".equals(codeString))
+      return V3TribalEntityUS._22;
+    if ("220".equals(codeString))
+      return V3TribalEntityUS._220;
+    if ("221".equals(codeString))
+      return V3TribalEntityUS._221;
+    if ("222".equals(codeString))
+      return V3TribalEntityUS._222;
+    if ("223".equals(codeString))
+      return V3TribalEntityUS._223;
+    if ("224".equals(codeString))
+      return V3TribalEntityUS._224;
+    if ("225".equals(codeString))
+      return V3TribalEntityUS._225;
+    if ("226".equals(codeString))
+      return V3TribalEntityUS._226;
+    if ("227".equals(codeString))
+      return V3TribalEntityUS._227;
+    if ("228".equals(codeString))
+      return V3TribalEntityUS._228;
+    if ("229".equals(codeString))
+      return V3TribalEntityUS._229;
+    if ("23".equals(codeString))
+      return V3TribalEntityUS._23;
+    if ("230".equals(codeString))
+      return V3TribalEntityUS._230;
+    if ("231".equals(codeString))
+      return V3TribalEntityUS._231;
+    if ("232".equals(codeString))
+      return V3TribalEntityUS._232;
+    if ("233".equals(codeString))
+      return V3TribalEntityUS._233;
+    if ("234".equals(codeString))
+      return V3TribalEntityUS._234;
+    if ("235".equals(codeString))
+      return V3TribalEntityUS._235;
+    if ("236".equals(codeString))
+      return V3TribalEntityUS._236;
+    if ("237".equals(codeString))
+      return V3TribalEntityUS._237;
+    if ("238".equals(codeString))
+      return V3TribalEntityUS._238;
+    if ("239".equals(codeString))
+      return V3TribalEntityUS._239;
+    if ("24".equals(codeString))
+      return V3TribalEntityUS._24;
+    if ("240".equals(codeString))
+      return V3TribalEntityUS._240;
+    if ("241".equals(codeString))
+      return V3TribalEntityUS._241;
+    if ("242".equals(codeString))
+      return V3TribalEntityUS._242;
+    if ("243".equals(codeString))
+      return V3TribalEntityUS._243;
+    if ("244".equals(codeString))
+      return V3TribalEntityUS._244;
+    if ("245".equals(codeString))
+      return V3TribalEntityUS._245;
+    if ("246".equals(codeString))
+      return V3TribalEntityUS._246;
+    if ("247".equals(codeString))
+      return V3TribalEntityUS._247;
+    if ("248".equals(codeString))
+      return V3TribalEntityUS._248;
+    if ("249".equals(codeString))
+      return V3TribalEntityUS._249;
+    if ("25".equals(codeString))
+      return V3TribalEntityUS._25;
+    if ("250".equals(codeString))
+      return V3TribalEntityUS._250;
+    if ("251".equals(codeString))
+      return V3TribalEntityUS._251;
+    if ("252".equals(codeString))
+      return V3TribalEntityUS._252;
+    if ("253".equals(codeString))
+      return V3TribalEntityUS._253;
+    if ("254".equals(codeString))
+      return V3TribalEntityUS._254;
+    if ("255".equals(codeString))
+      return V3TribalEntityUS._255;
+    if ("256".equals(codeString))
+      return V3TribalEntityUS._256;
+    if ("257".equals(codeString))
+      return V3TribalEntityUS._257;
+    if ("258".equals(codeString))
+      return V3TribalEntityUS._258;
+    if ("259".equals(codeString))
+      return V3TribalEntityUS._259;
+    if ("26".equals(codeString))
+      return V3TribalEntityUS._26;
+    if ("260".equals(codeString))
+      return V3TribalEntityUS._260;
+    if ("261".equals(codeString))
+      return V3TribalEntityUS._261;
+    if ("262".equals(codeString))
+      return V3TribalEntityUS._262;
+    if ("263".equals(codeString))
+      return V3TribalEntityUS._263;
+    if ("264".equals(codeString))
+      return V3TribalEntityUS._264;
+    if ("265".equals(codeString))
+      return V3TribalEntityUS._265;
+    if ("266".equals(codeString))
+      return V3TribalEntityUS._266;
+    if ("267".equals(codeString))
+      return V3TribalEntityUS._267;
+    if ("268".equals(codeString))
+      return V3TribalEntityUS._268;
+    if ("269".equals(codeString))
+      return V3TribalEntityUS._269;
+    if ("27".equals(codeString))
+      return V3TribalEntityUS._27;
+    if ("270".equals(codeString))
+      return V3TribalEntityUS._270;
+    if ("271".equals(codeString))
+      return V3TribalEntityUS._271;
+    if ("272".equals(codeString))
+      return V3TribalEntityUS._272;
+    if ("273".equals(codeString))
+      return V3TribalEntityUS._273;
+    if ("274".equals(codeString))
+      return V3TribalEntityUS._274;
+    if ("275".equals(codeString))
+      return V3TribalEntityUS._275;
+    if ("276".equals(codeString))
+      return V3TribalEntityUS._276;
+    if ("277".equals(codeString))
+      return V3TribalEntityUS._277;
+    if ("278".equals(codeString))
+      return V3TribalEntityUS._278;
+    if ("279".equals(codeString))
+      return V3TribalEntityUS._279;
+    if ("28".equals(codeString))
+      return V3TribalEntityUS._28;
+    if ("280".equals(codeString))
+      return V3TribalEntityUS._280;
+    if ("281".equals(codeString))
+      return V3TribalEntityUS._281;
+    if ("282".equals(codeString))
+      return V3TribalEntityUS._282;
+    if ("283".equals(codeString))
+      return V3TribalEntityUS._283;
+    if ("284".equals(codeString))
+      return V3TribalEntityUS._284;
+    if ("285".equals(codeString))
+      return V3TribalEntityUS._285;
+    if ("286".equals(codeString))
+      return V3TribalEntityUS._286;
+    if ("287".equals(codeString))
+      return V3TribalEntityUS._287;
+    if ("288".equals(codeString))
+      return V3TribalEntityUS._288;
+    if ("289".equals(codeString))
+      return V3TribalEntityUS._289;
+    if ("29".equals(codeString))
+      return V3TribalEntityUS._29;
+    if ("290".equals(codeString))
+      return V3TribalEntityUS._290;
+    if ("291".equals(codeString))
+      return V3TribalEntityUS._291;
+    if ("292".equals(codeString))
+      return V3TribalEntityUS._292;
+    if ("293".equals(codeString))
+      return V3TribalEntityUS._293;
+    if ("294".equals(codeString))
+      return V3TribalEntityUS._294;
+    if ("295".equals(codeString))
+      return V3TribalEntityUS._295;
+    if ("296".equals(codeString))
+      return V3TribalEntityUS._296;
+    if ("297".equals(codeString))
+      return V3TribalEntityUS._297;
+    if ("298".equals(codeString))
+      return V3TribalEntityUS._298;
+    if ("299".equals(codeString))
+      return V3TribalEntityUS._299;
+    if ("3".equals(codeString))
+      return V3TribalEntityUS._3;
+    if ("30".equals(codeString))
+      return V3TribalEntityUS._30;
+    if ("300".equals(codeString))
+      return V3TribalEntityUS._300;
+    if ("301".equals(codeString))
+      return V3TribalEntityUS._301;
+    if ("302".equals(codeString))
+      return V3TribalEntityUS._302;
+    if ("303".equals(codeString))
+      return V3TribalEntityUS._303;
+    if ("304".equals(codeString))
+      return V3TribalEntityUS._304;
+    if ("305".equals(codeString))
+      return V3TribalEntityUS._305;
+    if ("306".equals(codeString))
+      return V3TribalEntityUS._306;
+    if ("307".equals(codeString))
+      return V3TribalEntityUS._307;
+    if ("308".equals(codeString))
+      return V3TribalEntityUS._308;
+    if ("309".equals(codeString))
+      return V3TribalEntityUS._309;
+    if ("31".equals(codeString))
+      return V3TribalEntityUS._31;
+    if ("310".equals(codeString))
+      return V3TribalEntityUS._310;
+    if ("311".equals(codeString))
+      return V3TribalEntityUS._311;
+    if ("312".equals(codeString))
+      return V3TribalEntityUS._312;
+    if ("313".equals(codeString))
+      return V3TribalEntityUS._313;
+    if ("314".equals(codeString))
+      return V3TribalEntityUS._314;
+    if ("315".equals(codeString))
+      return V3TribalEntityUS._315;
+    if ("316".equals(codeString))
+      return V3TribalEntityUS._316;
+    if ("317".equals(codeString))
+      return V3TribalEntityUS._317;
+    if ("318".equals(codeString))
+      return V3TribalEntityUS._318;
+    if ("319".equals(codeString))
+      return V3TribalEntityUS._319;
+    if ("32".equals(codeString))
+      return V3TribalEntityUS._32;
+    if ("320".equals(codeString))
+      return V3TribalEntityUS._320;
+    if ("321".equals(codeString))
+      return V3TribalEntityUS._321;
+    if ("322".equals(codeString))
+      return V3TribalEntityUS._322;
+    if ("323".equals(codeString))
+      return V3TribalEntityUS._323;
+    if ("324".equals(codeString))
+      return V3TribalEntityUS._324;
+    if ("325".equals(codeString))
+      return V3TribalEntityUS._325;
+    if ("326".equals(codeString))
+      return V3TribalEntityUS._326;
+    if ("327".equals(codeString))
+      return V3TribalEntityUS._327;
+    if ("328".equals(codeString))
+      return V3TribalEntityUS._328;
+    if ("329".equals(codeString))
+      return V3TribalEntityUS._329;
+    if ("33".equals(codeString))
+      return V3TribalEntityUS._33;
+    if ("330".equals(codeString))
+      return V3TribalEntityUS._330;
+    if ("331".equals(codeString))
+      return V3TribalEntityUS._331;
+    if ("332".equals(codeString))
+      return V3TribalEntityUS._332;
+    if ("333".equals(codeString))
+      return V3TribalEntityUS._333;
+    if ("334".equals(codeString))
+      return V3TribalEntityUS._334;
+    if ("335".equals(codeString))
+      return V3TribalEntityUS._335;
+    if ("336".equals(codeString))
+      return V3TribalEntityUS._336;
+    if ("337".equals(codeString))
+      return V3TribalEntityUS._337;
+    if ("34".equals(codeString))
+      return V3TribalEntityUS._34;
+    if ("35".equals(codeString))
+      return V3TribalEntityUS._35;
+    if ("36".equals(codeString))
+      return V3TribalEntityUS._36;
+    if ("37".equals(codeString))
+      return V3TribalEntityUS._37;
+    if ("38".equals(codeString))
+      return V3TribalEntityUS._38;
+    if ("39".equals(codeString))
+      return V3TribalEntityUS._39;
+    if ("4".equals(codeString))
+      return V3TribalEntityUS._4;
+    if ("40".equals(codeString))
+      return V3TribalEntityUS._40;
+    if ("41".equals(codeString))
+      return V3TribalEntityUS._41;
+    if ("42".equals(codeString))
+      return V3TribalEntityUS._42;
+    if ("43".equals(codeString))
+      return V3TribalEntityUS._43;
+    if ("44".equals(codeString))
+      return V3TribalEntityUS._44;
+    if ("45".equals(codeString))
+      return V3TribalEntityUS._45;
+    if ("46".equals(codeString))
+      return V3TribalEntityUS._46;
+    if ("47".equals(codeString))
+      return V3TribalEntityUS._47;
+    if ("48".equals(codeString))
+      return V3TribalEntityUS._48;
+    if ("49".equals(codeString))
+      return V3TribalEntityUS._49;
+    if ("5".equals(codeString))
+      return V3TribalEntityUS._5;
+    if ("50".equals(codeString))
+      return V3TribalEntityUS._50;
+    if ("51".equals(codeString))
+      return V3TribalEntityUS._51;
+    if ("52".equals(codeString))
+      return V3TribalEntityUS._52;
+    if ("53".equals(codeString))
+      return V3TribalEntityUS._53;
+    if ("54".equals(codeString))
+      return V3TribalEntityUS._54;
+    if ("55".equals(codeString))
+      return V3TribalEntityUS._55;
+    if ("56".equals(codeString))
+      return V3TribalEntityUS._56;
+    if ("57".equals(codeString))
+      return V3TribalEntityUS._57;
+    if ("58".equals(codeString))
+      return V3TribalEntityUS._58;
+    if ("59".equals(codeString))
+      return V3TribalEntityUS._59;
+    if ("6".equals(codeString))
+      return V3TribalEntityUS._6;
+    if ("60".equals(codeString))
+      return V3TribalEntityUS._60;
+    if ("61".equals(codeString))
+      return V3TribalEntityUS._61;
+    if ("62".equals(codeString))
+      return V3TribalEntityUS._62;
+    if ("63".equals(codeString))
+      return V3TribalEntityUS._63;
+    if ("64".equals(codeString))
+      return V3TribalEntityUS._64;
+    if ("65".equals(codeString))
+      return V3TribalEntityUS._65;
+    if ("66".equals(codeString))
+      return V3TribalEntityUS._66;
+    if ("67".equals(codeString))
+      return V3TribalEntityUS._67;
+    if ("68".equals(codeString))
+      return V3TribalEntityUS._68;
+    if ("69".equals(codeString))
+      return V3TribalEntityUS._69;
+    if ("7".equals(codeString))
+      return V3TribalEntityUS._7;
+    if ("70".equals(codeString))
+      return V3TribalEntityUS._70;
+    if ("71".equals(codeString))
+      return V3TribalEntityUS._71;
+    if ("72".equals(codeString))
+      return V3TribalEntityUS._72;
+    if ("73".equals(codeString))
+      return V3TribalEntityUS._73;
+    if ("74".equals(codeString))
+      return V3TribalEntityUS._74;
+    if ("75".equals(codeString))
+      return V3TribalEntityUS._75;
+    if ("76".equals(codeString))
+      return V3TribalEntityUS._76;
+    if ("77".equals(codeString))
+      return V3TribalEntityUS._77;
+    if ("78".equals(codeString))
+      return V3TribalEntityUS._78;
+    if ("79".equals(codeString))
+      return V3TribalEntityUS._79;
+    if ("8".equals(codeString))
+      return V3TribalEntityUS._8;
+    if ("80".equals(codeString))
+      return V3TribalEntityUS._80;
+    if ("81".equals(codeString))
+      return V3TribalEntityUS._81;
+    if ("82".equals(codeString))
+      return V3TribalEntityUS._82;
+    if ("83".equals(codeString))
+      return V3TribalEntityUS._83;
+    if ("84".equals(codeString))
+      return V3TribalEntityUS._84;
+    if ("85".equals(codeString))
+      return V3TribalEntityUS._85;
+    if ("86".equals(codeString))
+      return V3TribalEntityUS._86;
+    if ("87".equals(codeString))
+      return V3TribalEntityUS._87;
+    if ("88".equals(codeString))
+      return V3TribalEntityUS._88;
+    if ("89".equals(codeString))
+      return V3TribalEntityUS._89;
+    if ("9".equals(codeString))
+      return V3TribalEntityUS._9;
+    if ("90".equals(codeString))
+      return V3TribalEntityUS._90;
+    if ("91".equals(codeString))
+      return V3TribalEntityUS._91;
+    if ("92".equals(codeString))
+      return V3TribalEntityUS._92;
+    if ("93".equals(codeString))
+      return V3TribalEntityUS._93;
+    if ("94".equals(codeString))
+      return V3TribalEntityUS._94;
+    if ("95".equals(codeString))
+      return V3TribalEntityUS._95;
+    if ("96".equals(codeString))
+      return V3TribalEntityUS._96;
+    if ("97".equals(codeString))
+      return V3TribalEntityUS._97;
+    if ("98".equals(codeString))
+      return V3TribalEntityUS._98;
+    if ("99".equals(codeString))
+      return V3TribalEntityUS._99;
+    throw new IllegalArgumentException("Unknown V3TribalEntityUS code '"+codeString+"'");
+  }
+
+  public String toCode(V3TribalEntityUS code) {
+    if (code == V3TribalEntityUS._NATIVEENTITYALASKA)
+      return "_NativeEntityAlaska";
+    if (code == V3TribalEntityUS._338)
+      return "338";
+    if (code == V3TribalEntityUS._339)
+      return "339";
+    if (code == V3TribalEntityUS._340)
+      return "340";
+    if (code == V3TribalEntityUS._341)
+      return "341";
+    if (code == V3TribalEntityUS._342)
+      return "342";
+    if (code == V3TribalEntityUS._343)
+      return "343";
+    if (code == V3TribalEntityUS._344)
+      return "344";
+    if (code == V3TribalEntityUS._345)
+      return "345";
+    if (code == V3TribalEntityUS._346)
+      return "346";
+    if (code == V3TribalEntityUS._347)
+      return "347";
+    if (code == V3TribalEntityUS._348)
+      return "348";
+    if (code == V3TribalEntityUS._349)
+      return "349";
+    if (code == V3TribalEntityUS._350)
+      return "350";
+    if (code == V3TribalEntityUS._351)
+      return "351";
+    if (code == V3TribalEntityUS._352)
+      return "352";
+    if (code == V3TribalEntityUS._353)
+      return "353";
+    if (code == V3TribalEntityUS._354)
+      return "354";
+    if (code == V3TribalEntityUS._355)
+      return "355";
+    if (code == V3TribalEntityUS._356)
+      return "356";
+    if (code == V3TribalEntityUS._357)
+      return "357";
+    if (code == V3TribalEntityUS._358)
+      return "358";
+    if (code == V3TribalEntityUS._359)
+      return "359";
+    if (code == V3TribalEntityUS._360)
+      return "360";
+    if (code == V3TribalEntityUS._361)
+      return "361";
+    if (code == V3TribalEntityUS._362)
+      return "362";
+    if (code == V3TribalEntityUS._363)
+      return "363";
+    if (code == V3TribalEntityUS._364)
+      return "364";
+    if (code == V3TribalEntityUS._365)
+      return "365";
+    if (code == V3TribalEntityUS._366)
+      return "366";
+    if (code == V3TribalEntityUS._367)
+      return "367";
+    if (code == V3TribalEntityUS._368)
+      return "368";
+    if (code == V3TribalEntityUS._369)
+      return "369";
+    if (code == V3TribalEntityUS._370)
+      return "370";
+    if (code == V3TribalEntityUS._371)
+      return "371";
+    if (code == V3TribalEntityUS._372)
+      return "372";
+    if (code == V3TribalEntityUS._373)
+      return "373";
+    if (code == V3TribalEntityUS._374)
+      return "374";
+    if (code == V3TribalEntityUS._375)
+      return "375";
+    if (code == V3TribalEntityUS._376)
+      return "376";
+    if (code == V3TribalEntityUS._377)
+      return "377";
+    if (code == V3TribalEntityUS._378)
+      return "378";
+    if (code == V3TribalEntityUS._379)
+      return "379";
+    if (code == V3TribalEntityUS._380)
+      return "380";
+    if (code == V3TribalEntityUS._381)
+      return "381";
+    if (code == V3TribalEntityUS._382)
+      return "382";
+    if (code == V3TribalEntityUS._383)
+      return "383";
+    if (code == V3TribalEntityUS._384)
+      return "384";
+    if (code == V3TribalEntityUS._385)
+      return "385";
+    if (code == V3TribalEntityUS._386)
+      return "386";
+    if (code == V3TribalEntityUS._387)
+      return "387";
+    if (code == V3TribalEntityUS._388)
+      return "388";
+    if (code == V3TribalEntityUS._389)
+      return "389";
+    if (code == V3TribalEntityUS._390)
+      return "390";
+    if (code == V3TribalEntityUS._391)
+      return "391";
+    if (code == V3TribalEntityUS._392)
+      return "392";
+    if (code == V3TribalEntityUS._393)
+      return "393";
+    if (code == V3TribalEntityUS._394)
+      return "394";
+    if (code == V3TribalEntityUS._395)
+      return "395";
+    if (code == V3TribalEntityUS._396)
+      return "396";
+    if (code == V3TribalEntityUS._397)
+      return "397";
+    if (code == V3TribalEntityUS._398)
+      return "398";
+    if (code == V3TribalEntityUS._399)
+      return "399";
+    if (code == V3TribalEntityUS._400)
+      return "400";
+    if (code == V3TribalEntityUS._401)
+      return "401";
+    if (code == V3TribalEntityUS._402)
+      return "402";
+    if (code == V3TribalEntityUS._403)
+      return "403";
+    if (code == V3TribalEntityUS._404)
+      return "404";
+    if (code == V3TribalEntityUS._405)
+      return "405";
+    if (code == V3TribalEntityUS._406)
+      return "406";
+    if (code == V3TribalEntityUS._407)
+      return "407";
+    if (code == V3TribalEntityUS._408)
+      return "408";
+    if (code == V3TribalEntityUS._409)
+      return "409";
+    if (code == V3TribalEntityUS._410)
+      return "410";
+    if (code == V3TribalEntityUS._411)
+      return "411";
+    if (code == V3TribalEntityUS._412)
+      return "412";
+    if (code == V3TribalEntityUS._413)
+      return "413";
+    if (code == V3TribalEntityUS._414)
+      return "414";
+    if (code == V3TribalEntityUS._415)
+      return "415";
+    if (code == V3TribalEntityUS._416)
+      return "416";
+    if (code == V3TribalEntityUS._417)
+      return "417";
+    if (code == V3TribalEntityUS._418)
+      return "418";
+    if (code == V3TribalEntityUS._419)
+      return "419";
+    if (code == V3TribalEntityUS._420)
+      return "420";
+    if (code == V3TribalEntityUS._421)
+      return "421";
+    if (code == V3TribalEntityUS._422)
+      return "422";
+    if (code == V3TribalEntityUS._423)
+      return "423";
+    if (code == V3TribalEntityUS._424)
+      return "424";
+    if (code == V3TribalEntityUS._425)
+      return "425";
+    if (code == V3TribalEntityUS._426)
+      return "426";
+    if (code == V3TribalEntityUS._427)
+      return "427";
+    if (code == V3TribalEntityUS._428)
+      return "428";
+    if (code == V3TribalEntityUS._429)
+      return "429";
+    if (code == V3TribalEntityUS._430)
+      return "430";
+    if (code == V3TribalEntityUS._431)
+      return "431";
+    if (code == V3TribalEntityUS._432)
+      return "432";
+    if (code == V3TribalEntityUS._433)
+      return "433";
+    if (code == V3TribalEntityUS._434)
+      return "434";
+    if (code == V3TribalEntityUS._435)
+      return "435";
+    if (code == V3TribalEntityUS._436)
+      return "436";
+    if (code == V3TribalEntityUS._437)
+      return "437";
+    if (code == V3TribalEntityUS._438)
+      return "438";
+    if (code == V3TribalEntityUS._439)
+      return "439";
+    if (code == V3TribalEntityUS._440)
+      return "440";
+    if (code == V3TribalEntityUS._441)
+      return "441";
+    if (code == V3TribalEntityUS._442)
+      return "442";
+    if (code == V3TribalEntityUS._443)
+      return "443";
+    if (code == V3TribalEntityUS._444)
+      return "444";
+    if (code == V3TribalEntityUS._445)
+      return "445";
+    if (code == V3TribalEntityUS._446)
+      return "446";
+    if (code == V3TribalEntityUS._447)
+      return "447";
+    if (code == V3TribalEntityUS._448)
+      return "448";
+    if (code == V3TribalEntityUS._449)
+      return "449";
+    if (code == V3TribalEntityUS._450)
+      return "450";
+    if (code == V3TribalEntityUS._451)
+      return "451";
+    if (code == V3TribalEntityUS._452)
+      return "452";
+    if (code == V3TribalEntityUS._453)
+      return "453";
+    if (code == V3TribalEntityUS._454)
+      return "454";
+    if (code == V3TribalEntityUS._455)
+      return "455";
+    if (code == V3TribalEntityUS._456)
+      return "456";
+    if (code == V3TribalEntityUS._457)
+      return "457";
+    if (code == V3TribalEntityUS._458)
+      return "458";
+    if (code == V3TribalEntityUS._459)
+      return "459";
+    if (code == V3TribalEntityUS._460)
+      return "460";
+    if (code == V3TribalEntityUS._461)
+      return "461";
+    if (code == V3TribalEntityUS._462)
+      return "462";
+    if (code == V3TribalEntityUS._463)
+      return "463";
+    if (code == V3TribalEntityUS._464)
+      return "464";
+    if (code == V3TribalEntityUS._465)
+      return "465";
+    if (code == V3TribalEntityUS._466)
+      return "466";
+    if (code == V3TribalEntityUS._467)
+      return "467";
+    if (code == V3TribalEntityUS._468)
+      return "468";
+    if (code == V3TribalEntityUS._469)
+      return "469";
+    if (code == V3TribalEntityUS._470)
+      return "470";
+    if (code == V3TribalEntityUS._471)
+      return "471";
+    if (code == V3TribalEntityUS._472)
+      return "472";
+    if (code == V3TribalEntityUS._473)
+      return "473";
+    if (code == V3TribalEntityUS._474)
+      return "474";
+    if (code == V3TribalEntityUS._475)
+      return "475";
+    if (code == V3TribalEntityUS._476)
+      return "476";
+    if (code == V3TribalEntityUS._477)
+      return "477";
+    if (code == V3TribalEntityUS._478)
+      return "478";
+    if (code == V3TribalEntityUS._479)
+      return "479";
+    if (code == V3TribalEntityUS._480)
+      return "480";
+    if (code == V3TribalEntityUS._481)
+      return "481";
+    if (code == V3TribalEntityUS._482)
+      return "482";
+    if (code == V3TribalEntityUS._483)
+      return "483";
+    if (code == V3TribalEntityUS._484)
+      return "484";
+    if (code == V3TribalEntityUS._485)
+      return "485";
+    if (code == V3TribalEntityUS._486)
+      return "486";
+    if (code == V3TribalEntityUS._487)
+      return "487";
+    if (code == V3TribalEntityUS._488)
+      return "488";
+    if (code == V3TribalEntityUS._489)
+      return "489";
+    if (code == V3TribalEntityUS._490)
+      return "490";
+    if (code == V3TribalEntityUS._491)
+      return "491";
+    if (code == V3TribalEntityUS._492)
+      return "492";
+    if (code == V3TribalEntityUS._493)
+      return "493";
+    if (code == V3TribalEntityUS._494)
+      return "494";
+    if (code == V3TribalEntityUS._495)
+      return "495";
+    if (code == V3TribalEntityUS._496)
+      return "496";
+    if (code == V3TribalEntityUS._497)
+      return "497";
+    if (code == V3TribalEntityUS._498)
+      return "498";
+    if (code == V3TribalEntityUS._499)
+      return "499";
+    if (code == V3TribalEntityUS._500)
+      return "500";
+    if (code == V3TribalEntityUS._501)
+      return "501";
+    if (code == V3TribalEntityUS._502)
+      return "502";
+    if (code == V3TribalEntityUS._503)
+      return "503";
+    if (code == V3TribalEntityUS._504)
+      return "504";
+    if (code == V3TribalEntityUS._505)
+      return "505";
+    if (code == V3TribalEntityUS._506)
+      return "506";
+    if (code == V3TribalEntityUS._507)
+      return "507";
+    if (code == V3TribalEntityUS._508)
+      return "508";
+    if (code == V3TribalEntityUS._509)
+      return "509";
+    if (code == V3TribalEntityUS._510)
+      return "510";
+    if (code == V3TribalEntityUS._511)
+      return "511";
+    if (code == V3TribalEntityUS._512)
+      return "512";
+    if (code == V3TribalEntityUS._513)
+      return "513";
+    if (code == V3TribalEntityUS._514)
+      return "514";
+    if (code == V3TribalEntityUS._515)
+      return "515";
+    if (code == V3TribalEntityUS._516)
+      return "516";
+    if (code == V3TribalEntityUS._517)
+      return "517";
+    if (code == V3TribalEntityUS._518)
+      return "518";
+    if (code == V3TribalEntityUS._519)
+      return "519";
+    if (code == V3TribalEntityUS._520)
+      return "520";
+    if (code == V3TribalEntityUS._521)
+      return "521";
+    if (code == V3TribalEntityUS._522)
+      return "522";
+    if (code == V3TribalEntityUS._523)
+      return "523";
+    if (code == V3TribalEntityUS._524)
+      return "524";
+    if (code == V3TribalEntityUS._525)
+      return "525";
+    if (code == V3TribalEntityUS._526)
+      return "526";
+    if (code == V3TribalEntityUS._527)
+      return "527";
+    if (code == V3TribalEntityUS._528)
+      return "528";
+    if (code == V3TribalEntityUS._529)
+      return "529";
+    if (code == V3TribalEntityUS._530)
+      return "530";
+    if (code == V3TribalEntityUS._531)
+      return "531";
+    if (code == V3TribalEntityUS._532)
+      return "532";
+    if (code == V3TribalEntityUS._533)
+      return "533";
+    if (code == V3TribalEntityUS._534)
+      return "534";
+    if (code == V3TribalEntityUS._535)
+      return "535";
+    if (code == V3TribalEntityUS._536)
+      return "536";
+    if (code == V3TribalEntityUS._537)
+      return "537";
+    if (code == V3TribalEntityUS._538)
+      return "538";
+    if (code == V3TribalEntityUS._539)
+      return "539";
+    if (code == V3TribalEntityUS._540)
+      return "540";
+    if (code == V3TribalEntityUS._541)
+      return "541";
+    if (code == V3TribalEntityUS._542)
+      return "542";
+    if (code == V3TribalEntityUS._543)
+      return "543";
+    if (code == V3TribalEntityUS._544)
+      return "544";
+    if (code == V3TribalEntityUS._545)
+      return "545";
+    if (code == V3TribalEntityUS._546)
+      return "546";
+    if (code == V3TribalEntityUS._547)
+      return "547";
+    if (code == V3TribalEntityUS._548)
+      return "548";
+    if (code == V3TribalEntityUS._549)
+      return "549";
+    if (code == V3TribalEntityUS._550)
+      return "550";
+    if (code == V3TribalEntityUS._551)
+      return "551";
+    if (code == V3TribalEntityUS._552)
+      return "552";
+    if (code == V3TribalEntityUS._553)
+      return "553";
+    if (code == V3TribalEntityUS._554)
+      return "554";
+    if (code == V3TribalEntityUS._555)
+      return "555";
+    if (code == V3TribalEntityUS._556)
+      return "556";
+    if (code == V3TribalEntityUS._557)
+      return "557";
+    if (code == V3TribalEntityUS._558)
+      return "558";
+    if (code == V3TribalEntityUS._559)
+      return "559";
+    if (code == V3TribalEntityUS._560)
+      return "560";
+    if (code == V3TribalEntityUS._561)
+      return "561";
+    if (code == V3TribalEntityUS._562)
+      return "562";
+    if (code == V3TribalEntityUS._563)
+      return "563";
+    if (code == V3TribalEntityUS._564)
+      return "564";
+    if (code == V3TribalEntityUS._565)
+      return "565";
+    if (code == V3TribalEntityUS._566)
+      return "566";
+    if (code == V3TribalEntityUS._NATIVEENTITYCONTIGUOUS)
+      return "_NativeEntityContiguous";
+    if (code == V3TribalEntityUS._1)
+      return "1";
+    if (code == V3TribalEntityUS._10)
+      return "10";
+    if (code == V3TribalEntityUS._100)
+      return "100";
+    if (code == V3TribalEntityUS._101)
+      return "101";
+    if (code == V3TribalEntityUS._102)
+      return "102";
+    if (code == V3TribalEntityUS._103)
+      return "103";
+    if (code == V3TribalEntityUS._104)
+      return "104";
+    if (code == V3TribalEntityUS._105)
+      return "105";
+    if (code == V3TribalEntityUS._106)
+      return "106";
+    if (code == V3TribalEntityUS._107)
+      return "107";
+    if (code == V3TribalEntityUS._108)
+      return "108";
+    if (code == V3TribalEntityUS._109)
+      return "109";
+    if (code == V3TribalEntityUS._11)
+      return "11";
+    if (code == V3TribalEntityUS._110)
+      return "110";
+    if (code == V3TribalEntityUS._111)
+      return "111";
+    if (code == V3TribalEntityUS._112)
+      return "112";
+    if (code == V3TribalEntityUS._113)
+      return "113";
+    if (code == V3TribalEntityUS._114)
+      return "114";
+    if (code == V3TribalEntityUS._115)
+      return "115";
+    if (code == V3TribalEntityUS._116)
+      return "116";
+    if (code == V3TribalEntityUS._117)
+      return "117";
+    if (code == V3TribalEntityUS._118)
+      return "118";
+    if (code == V3TribalEntityUS._119)
+      return "119";
+    if (code == V3TribalEntityUS._12)
+      return "12";
+    if (code == V3TribalEntityUS._120)
+      return "120";
+    if (code == V3TribalEntityUS._121)
+      return "121";
+    if (code == V3TribalEntityUS._122)
+      return "122";
+    if (code == V3TribalEntityUS._123)
+      return "123";
+    if (code == V3TribalEntityUS._124)
+      return "124";
+    if (code == V3TribalEntityUS._125)
+      return "125";
+    if (code == V3TribalEntityUS._126)
+      return "126";
+    if (code == V3TribalEntityUS._127)
+      return "127";
+    if (code == V3TribalEntityUS._128)
+      return "128";
+    if (code == V3TribalEntityUS._129)
+      return "129";
+    if (code == V3TribalEntityUS._13)
+      return "13";
+    if (code == V3TribalEntityUS._130)
+      return "130";
+    if (code == V3TribalEntityUS._131)
+      return "131";
+    if (code == V3TribalEntityUS._132)
+      return "132";
+    if (code == V3TribalEntityUS._133)
+      return "133";
+    if (code == V3TribalEntityUS._134)
+      return "134";
+    if (code == V3TribalEntityUS._135)
+      return "135";
+    if (code == V3TribalEntityUS._136)
+      return "136";
+    if (code == V3TribalEntityUS._137)
+      return "137";
+    if (code == V3TribalEntityUS._138)
+      return "138";
+    if (code == V3TribalEntityUS._139)
+      return "139";
+    if (code == V3TribalEntityUS._14)
+      return "14";
+    if (code == V3TribalEntityUS._140)
+      return "140";
+    if (code == V3TribalEntityUS._141)
+      return "141";
+    if (code == V3TribalEntityUS._142)
+      return "142";
+    if (code == V3TribalEntityUS._143)
+      return "143";
+    if (code == V3TribalEntityUS._144)
+      return "144";
+    if (code == V3TribalEntityUS._145)
+      return "145";
+    if (code == V3TribalEntityUS._146)
+      return "146";
+    if (code == V3TribalEntityUS._147)
+      return "147";
+    if (code == V3TribalEntityUS._148)
+      return "148";
+    if (code == V3TribalEntityUS._149)
+      return "149";
+    if (code == V3TribalEntityUS._15)
+      return "15";
+    if (code == V3TribalEntityUS._150)
+      return "150";
+    if (code == V3TribalEntityUS._151)
+      return "151";
+    if (code == V3TribalEntityUS._152)
+      return "152";
+    if (code == V3TribalEntityUS._153)
+      return "153";
+    if (code == V3TribalEntityUS._154)
+      return "154";
+    if (code == V3TribalEntityUS._155)
+      return "155";
+    if (code == V3TribalEntityUS._156)
+      return "156";
+    if (code == V3TribalEntityUS._157)
+      return "157";
+    if (code == V3TribalEntityUS._158)
+      return "158";
+    if (code == V3TribalEntityUS._159)
+      return "159";
+    if (code == V3TribalEntityUS._16)
+      return "16";
+    if (code == V3TribalEntityUS._160)
+      return "160";
+    if (code == V3TribalEntityUS._161)
+      return "161";
+    if (code == V3TribalEntityUS._162)
+      return "162";
+    if (code == V3TribalEntityUS._163)
+      return "163";
+    if (code == V3TribalEntityUS._164)
+      return "164";
+    if (code == V3TribalEntityUS._165)
+      return "165";
+    if (code == V3TribalEntityUS._166)
+      return "166";
+    if (code == V3TribalEntityUS._167)
+      return "167";
+    if (code == V3TribalEntityUS._168)
+      return "168";
+    if (code == V3TribalEntityUS._169)
+      return "169";
+    if (code == V3TribalEntityUS._17)
+      return "17";
+    if (code == V3TribalEntityUS._170)
+      return "170";
+    if (code == V3TribalEntityUS._171)
+      return "171";
+    if (code == V3TribalEntityUS._172)
+      return "172";
+    if (code == V3TribalEntityUS._173)
+      return "173";
+    if (code == V3TribalEntityUS._174)
+      return "174";
+    if (code == V3TribalEntityUS._175)
+      return "175";
+    if (code == V3TribalEntityUS._176)
+      return "176";
+    if (code == V3TribalEntityUS._177)
+      return "177";
+    if (code == V3TribalEntityUS._178)
+      return "178";
+    if (code == V3TribalEntityUS._179)
+      return "179";
+    if (code == V3TribalEntityUS._18)
+      return "18";
+    if (code == V3TribalEntityUS._180)
+      return "180";
+    if (code == V3TribalEntityUS._181)
+      return "181";
+    if (code == V3TribalEntityUS._182)
+      return "182";
+    if (code == V3TribalEntityUS._183)
+      return "183";
+    if (code == V3TribalEntityUS._184)
+      return "184";
+    if (code == V3TribalEntityUS._185)
+      return "185";
+    if (code == V3TribalEntityUS._186)
+      return "186";
+    if (code == V3TribalEntityUS._187)
+      return "187";
+    if (code == V3TribalEntityUS._188)
+      return "188";
+    if (code == V3TribalEntityUS._189)
+      return "189";
+    if (code == V3TribalEntityUS._19)
+      return "19";
+    if (code == V3TribalEntityUS._190)
+      return "190";
+    if (code == V3TribalEntityUS._191)
+      return "191";
+    if (code == V3TribalEntityUS._192)
+      return "192";
+    if (code == V3TribalEntityUS._193)
+      return "193";
+    if (code == V3TribalEntityUS._194)
+      return "194";
+    if (code == V3TribalEntityUS._195)
+      return "195";
+    if (code == V3TribalEntityUS._196)
+      return "196";
+    if (code == V3TribalEntityUS._197)
+      return "197";
+    if (code == V3TribalEntityUS._198)
+      return "198";
+    if (code == V3TribalEntityUS._199)
+      return "199";
+    if (code == V3TribalEntityUS._2)
+      return "2";
+    if (code == V3TribalEntityUS._20)
+      return "20";
+    if (code == V3TribalEntityUS._200)
+      return "200";
+    if (code == V3TribalEntityUS._201)
+      return "201";
+    if (code == V3TribalEntityUS._202)
+      return "202";
+    if (code == V3TribalEntityUS._203)
+      return "203";
+    if (code == V3TribalEntityUS._204)
+      return "204";
+    if (code == V3TribalEntityUS._205)
+      return "205";
+    if (code == V3TribalEntityUS._206)
+      return "206";
+    if (code == V3TribalEntityUS._207)
+      return "207";
+    if (code == V3TribalEntityUS._208)
+      return "208";
+    if (code == V3TribalEntityUS._209)
+      return "209";
+    if (code == V3TribalEntityUS._21)
+      return "21";
+    if (code == V3TribalEntityUS._210)
+      return "210";
+    if (code == V3TribalEntityUS._211)
+      return "211";
+    if (code == V3TribalEntityUS._212)
+      return "212";
+    if (code == V3TribalEntityUS._213)
+      return "213";
+    if (code == V3TribalEntityUS._214)
+      return "214";
+    if (code == V3TribalEntityUS._215)
+      return "215";
+    if (code == V3TribalEntityUS._216)
+      return "216";
+    if (code == V3TribalEntityUS._217)
+      return "217";
+    if (code == V3TribalEntityUS._218)
+      return "218";
+    if (code == V3TribalEntityUS._219)
+      return "219";
+    if (code == V3TribalEntityUS._22)
+      return "22";
+    if (code == V3TribalEntityUS._220)
+      return "220";
+    if (code == V3TribalEntityUS._221)
+      return "221";
+    if (code == V3TribalEntityUS._222)
+      return "222";
+    if (code == V3TribalEntityUS._223)
+      return "223";
+    if (code == V3TribalEntityUS._224)
+      return "224";
+    if (code == V3TribalEntityUS._225)
+      return "225";
+    if (code == V3TribalEntityUS._226)
+      return "226";
+    if (code == V3TribalEntityUS._227)
+      return "227";
+    if (code == V3TribalEntityUS._228)
+      return "228";
+    if (code == V3TribalEntityUS._229)
+      return "229";
+    if (code == V3TribalEntityUS._23)
+      return "23";
+    if (code == V3TribalEntityUS._230)
+      return "230";
+    if (code == V3TribalEntityUS._231)
+      return "231";
+    if (code == V3TribalEntityUS._232)
+      return "232";
+    if (code == V3TribalEntityUS._233)
+      return "233";
+    if (code == V3TribalEntityUS._234)
+      return "234";
+    if (code == V3TribalEntityUS._235)
+      return "235";
+    if (code == V3TribalEntityUS._236)
+      return "236";
+    if (code == V3TribalEntityUS._237)
+      return "237";
+    if (code == V3TribalEntityUS._238)
+      return "238";
+    if (code == V3TribalEntityUS._239)
+      return "239";
+    if (code == V3TribalEntityUS._24)
+      return "24";
+    if (code == V3TribalEntityUS._240)
+      return "240";
+    if (code == V3TribalEntityUS._241)
+      return "241";
+    if (code == V3TribalEntityUS._242)
+      return "242";
+    if (code == V3TribalEntityUS._243)
+      return "243";
+    if (code == V3TribalEntityUS._244)
+      return "244";
+    if (code == V3TribalEntityUS._245)
+      return "245";
+    if (code == V3TribalEntityUS._246)
+      return "246";
+    if (code == V3TribalEntityUS._247)
+      return "247";
+    if (code == V3TribalEntityUS._248)
+      return "248";
+    if (code == V3TribalEntityUS._249)
+      return "249";
+    if (code == V3TribalEntityUS._25)
+      return "25";
+    if (code == V3TribalEntityUS._250)
+      return "250";
+    if (code == V3TribalEntityUS._251)
+      return "251";
+    if (code == V3TribalEntityUS._252)
+      return "252";
+    if (code == V3TribalEntityUS._253)
+      return "253";
+    if (code == V3TribalEntityUS._254)
+      return "254";
+    if (code == V3TribalEntityUS._255)
+      return "255";
+    if (code == V3TribalEntityUS._256)
+      return "256";
+    if (code == V3TribalEntityUS._257)
+      return "257";
+    if (code == V3TribalEntityUS._258)
+      return "258";
+    if (code == V3TribalEntityUS._259)
+      return "259";
+    if (code == V3TribalEntityUS._26)
+      return "26";
+    if (code == V3TribalEntityUS._260)
+      return "260";
+    if (code == V3TribalEntityUS._261)
+      return "261";
+    if (code == V3TribalEntityUS._262)
+      return "262";
+    if (code == V3TribalEntityUS._263)
+      return "263";
+    if (code == V3TribalEntityUS._264)
+      return "264";
+    if (code == V3TribalEntityUS._265)
+      return "265";
+    if (code == V3TribalEntityUS._266)
+      return "266";
+    if (code == V3TribalEntityUS._267)
+      return "267";
+    if (code == V3TribalEntityUS._268)
+      return "268";
+    if (code == V3TribalEntityUS._269)
+      return "269";
+    if (code == V3TribalEntityUS._27)
+      return "27";
+    if (code == V3TribalEntityUS._270)
+      return "270";
+    if (code == V3TribalEntityUS._271)
+      return "271";
+    if (code == V3TribalEntityUS._272)
+      return "272";
+    if (code == V3TribalEntityUS._273)
+      return "273";
+    if (code == V3TribalEntityUS._274)
+      return "274";
+    if (code == V3TribalEntityUS._275)
+      return "275";
+    if (code == V3TribalEntityUS._276)
+      return "276";
+    if (code == V3TribalEntityUS._277)
+      return "277";
+    if (code == V3TribalEntityUS._278)
+      return "278";
+    if (code == V3TribalEntityUS._279)
+      return "279";
+    if (code == V3TribalEntityUS._28)
+      return "28";
+    if (code == V3TribalEntityUS._280)
+      return "280";
+    if (code == V3TribalEntityUS._281)
+      return "281";
+    if (code == V3TribalEntityUS._282)
+      return "282";
+    if (code == V3TribalEntityUS._283)
+      return "283";
+    if (code == V3TribalEntityUS._284)
+      return "284";
+    if (code == V3TribalEntityUS._285)
+      return "285";
+    if (code == V3TribalEntityUS._286)
+      return "286";
+    if (code == V3TribalEntityUS._287)
+      return "287";
+    if (code == V3TribalEntityUS._288)
+      return "288";
+    if (code == V3TribalEntityUS._289)
+      return "289";
+    if (code == V3TribalEntityUS._29)
+      return "29";
+    if (code == V3TribalEntityUS._290)
+      return "290";
+    if (code == V3TribalEntityUS._291)
+      return "291";
+    if (code == V3TribalEntityUS._292)
+      return "292";
+    if (code == V3TribalEntityUS._293)
+      return "293";
+    if (code == V3TribalEntityUS._294)
+      return "294";
+    if (code == V3TribalEntityUS._295)
+      return "295";
+    if (code == V3TribalEntityUS._296)
+      return "296";
+    if (code == V3TribalEntityUS._297)
+      return "297";
+    if (code == V3TribalEntityUS._298)
+      return "298";
+    if (code == V3TribalEntityUS._299)
+      return "299";
+    if (code == V3TribalEntityUS._3)
+      return "3";
+    if (code == V3TribalEntityUS._30)
+      return "30";
+    if (code == V3TribalEntityUS._300)
+      return "300";
+    if (code == V3TribalEntityUS._301)
+      return "301";
+    if (code == V3TribalEntityUS._302)
+      return "302";
+    if (code == V3TribalEntityUS._303)
+      return "303";
+    if (code == V3TribalEntityUS._304)
+      return "304";
+    if (code == V3TribalEntityUS._305)
+      return "305";
+    if (code == V3TribalEntityUS._306)
+      return "306";
+    if (code == V3TribalEntityUS._307)
+      return "307";
+    if (code == V3TribalEntityUS._308)
+      return "308";
+    if (code == V3TribalEntityUS._309)
+      return "309";
+    if (code == V3TribalEntityUS._31)
+      return "31";
+    if (code == V3TribalEntityUS._310)
+      return "310";
+    if (code == V3TribalEntityUS._311)
+      return "311";
+    if (code == V3TribalEntityUS._312)
+      return "312";
+    if (code == V3TribalEntityUS._313)
+      return "313";
+    if (code == V3TribalEntityUS._314)
+      return "314";
+    if (code == V3TribalEntityUS._315)
+      return "315";
+    if (code == V3TribalEntityUS._316)
+      return "316";
+    if (code == V3TribalEntityUS._317)
+      return "317";
+    if (code == V3TribalEntityUS._318)
+      return "318";
+    if (code == V3TribalEntityUS._319)
+      return "319";
+    if (code == V3TribalEntityUS._32)
+      return "32";
+    if (code == V3TribalEntityUS._320)
+      return "320";
+    if (code == V3TribalEntityUS._321)
+      return "321";
+    if (code == V3TribalEntityUS._322)
+      return "322";
+    if (code == V3TribalEntityUS._323)
+      return "323";
+    if (code == V3TribalEntityUS._324)
+      return "324";
+    if (code == V3TribalEntityUS._325)
+      return "325";
+    if (code == V3TribalEntityUS._326)
+      return "326";
+    if (code == V3TribalEntityUS._327)
+      return "327";
+    if (code == V3TribalEntityUS._328)
+      return "328";
+    if (code == V3TribalEntityUS._329)
+      return "329";
+    if (code == V3TribalEntityUS._33)
+      return "33";
+    if (code == V3TribalEntityUS._330)
+      return "330";
+    if (code == V3TribalEntityUS._331)
+      return "331";
+    if (code == V3TribalEntityUS._332)
+      return "332";
+    if (code == V3TribalEntityUS._333)
+      return "333";
+    if (code == V3TribalEntityUS._334)
+      return "334";
+    if (code == V3TribalEntityUS._335)
+      return "335";
+    if (code == V3TribalEntityUS._336)
+      return "336";
+    if (code == V3TribalEntityUS._337)
+      return "337";
+    if (code == V3TribalEntityUS._34)
+      return "34";
+    if (code == V3TribalEntityUS._35)
+      return "35";
+    if (code == V3TribalEntityUS._36)
+      return "36";
+    if (code == V3TribalEntityUS._37)
+      return "37";
+    if (code == V3TribalEntityUS._38)
+      return "38";
+    if (code == V3TribalEntityUS._39)
+      return "39";
+    if (code == V3TribalEntityUS._4)
+      return "4";
+    if (code == V3TribalEntityUS._40)
+      return "40";
+    if (code == V3TribalEntityUS._41)
+      return "41";
+    if (code == V3TribalEntityUS._42)
+      return "42";
+    if (code == V3TribalEntityUS._43)
+      return "43";
+    if (code == V3TribalEntityUS._44)
+      return "44";
+    if (code == V3TribalEntityUS._45)
+      return "45";
+    if (code == V3TribalEntityUS._46)
+      return "46";
+    if (code == V3TribalEntityUS._47)
+      return "47";
+    if (code == V3TribalEntityUS._48)
+      return "48";
+    if (code == V3TribalEntityUS._49)
+      return "49";
+    if (code == V3TribalEntityUS._5)
+      return "5";
+    if (code == V3TribalEntityUS._50)
+      return "50";
+    if (code == V3TribalEntityUS._51)
+      return "51";
+    if (code == V3TribalEntityUS._52)
+      return "52";
+    if (code == V3TribalEntityUS._53)
+      return "53";
+    if (code == V3TribalEntityUS._54)
+      return "54";
+    if (code == V3TribalEntityUS._55)
+      return "55";
+    if (code == V3TribalEntityUS._56)
+      return "56";
+    if (code == V3TribalEntityUS._57)
+      return "57";
+    if (code == V3TribalEntityUS._58)
+      return "58";
+    if (code == V3TribalEntityUS._59)
+      return "59";
+    if (code == V3TribalEntityUS._6)
+      return "6";
+    if (code == V3TribalEntityUS._60)
+      return "60";
+    if (code == V3TribalEntityUS._61)
+      return "61";
+    if (code == V3TribalEntityUS._62)
+      return "62";
+    if (code == V3TribalEntityUS._63)
+      return "63";
+    if (code == V3TribalEntityUS._64)
+      return "64";
+    if (code == V3TribalEntityUS._65)
+      return "65";
+    if (code == V3TribalEntityUS._66)
+      return "66";
+    if (code == V3TribalEntityUS._67)
+      return "67";
+    if (code == V3TribalEntityUS._68)
+      return "68";
+    if (code == V3TribalEntityUS._69)
+      return "69";
+    if (code == V3TribalEntityUS._7)
+      return "7";
+    if (code == V3TribalEntityUS._70)
+      return "70";
+    if (code == V3TribalEntityUS._71)
+      return "71";
+    if (code == V3TribalEntityUS._72)
+      return "72";
+    if (code == V3TribalEntityUS._73)
+      return "73";
+    if (code == V3TribalEntityUS._74)
+      return "74";
+    if (code == V3TribalEntityUS._75)
+      return "75";
+    if (code == V3TribalEntityUS._76)
+      return "76";
+    if (code == V3TribalEntityUS._77)
+      return "77";
+    if (code == V3TribalEntityUS._78)
+      return "78";
+    if (code == V3TribalEntityUS._79)
+      return "79";
+    if (code == V3TribalEntityUS._8)
+      return "8";
+    if (code == V3TribalEntityUS._80)
+      return "80";
+    if (code == V3TribalEntityUS._81)
+      return "81";
+    if (code == V3TribalEntityUS._82)
+      return "82";
+    if (code == V3TribalEntityUS._83)
+      return "83";
+    if (code == V3TribalEntityUS._84)
+      return "84";
+    if (code == V3TribalEntityUS._85)
+      return "85";
+    if (code == V3TribalEntityUS._86)
+      return "86";
+    if (code == V3TribalEntityUS._87)
+      return "87";
+    if (code == V3TribalEntityUS._88)
+      return "88";
+    if (code == V3TribalEntityUS._89)
+      return "89";
+    if (code == V3TribalEntityUS._9)
+      return "9";
+    if (code == V3TribalEntityUS._90)
+      return "90";
+    if (code == V3TribalEntityUS._91)
+      return "91";
+    if (code == V3TribalEntityUS._92)
+      return "92";
+    if (code == V3TribalEntityUS._93)
+      return "93";
+    if (code == V3TribalEntityUS._94)
+      return "94";
+    if (code == V3TribalEntityUS._95)
+      return "95";
+    if (code == V3TribalEntityUS._96)
+      return "96";
+    if (code == V3TribalEntityUS._97)
+      return "97";
+    if (code == V3TribalEntityUS._98)
+      return "98";
+    if (code == V3TribalEntityUS._99)
+      return "99";
+    return "?";
+  }
+
+    public String toSystem(V3TribalEntityUS code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3VaccineManufacturer.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3VaccineManufacturer.java
new file mode 100644
index 00000000000..981ac7e689a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3VaccineManufacturer.java
@@ -0,0 +1,429 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum V3VaccineManufacturer {
+
+        /**
+         * Abbott Laboratories (includes Ross Products Division)
+         */
+        AB, 
+        /**
+         * Adams Laboratories
+         */
+        AD, 
+        /**
+         * Alpha Therapeutic Corporation
+         */
+        ALP, 
+        /**
+         * Armour [Inactive-use CEN]
+         */
+        AR, 
+        /**
+         * Aviron
+         */
+        AVI, 
+        /**
+         * Baxter Healthcare Corporation
+         */
+        BA, 
+        /**
+         * Bayer Corporation (includes Miles, Inc. and Cutter Laboratories)
+         */
+        BAY, 
+        /**
+         * Berna Products [Inactive-use BPC]
+         */
+        BP, 
+        /**
+         * Berna Products Corporation (includes Swiss Serum and Vaccine Institute Berne)
+         */
+        BPC, 
+        /**
+         * Centeon L.L.C. (includes Armour Pharmaceutical Company)
+         */
+        CEN, 
+        /**
+         * Chiron Corporation
+         */
+        CHI, 
+        /**
+         * Connaught [Inactive-use PMC]
+         */
+        CON, 
+        /**
+         * Evans Medical Limited (an affiliate of Medeva Pharmaceuticals, Inc.)
+         */
+        EVN, 
+        /**
+         * Greer Laboratories, Inc.
+         */
+        GRE, 
+        /**
+         * Immuno International AG
+         */
+        IAG, 
+        /**
+         * Merieux [Inactive-use PMC]
+         */
+        IM, 
+        /**
+         * Immuno-U.S., Inc.
+         */
+        IUS, 
+        /**
+         * The Research Foundation for Microbial Diseases of Osaka University (BIKEN)
+         */
+        JPN, 
+        /**
+         * Korea Green Cross Corporation
+         */
+        KGC, 
+        /**
+         * Lederle [Inactive-use WAL]
+         */
+        LED, 
+        /**
+         * Massachusetts Public Health Biologic Laboratories
+         */
+        MA, 
+        /**
+         * MedImmune, Inc.
+         */
+        MED, 
+        /**
+         * Miles [Inactive-use BAY]
+         */
+        MIL, 
+        /**
+         * Bioport Corporation (formerly Michigan Biologic Products Institute)
+         */
+        MIP, 
+        /**
+         * Merck & Co., Inc.
+         */
+        MSD, 
+        /**
+         * NABI (formerly North American Biologicals, Inc.)
+         */
+        NAB, 
+        /**
+         * North American Vaccine, Inc.
+         */
+        NAV, 
+        /**
+         * Novartis Pharmaceutical Corporation (includes Ciba-Geigy Limited and Sandoz Limited)
+         */
+        NOV, 
+        /**
+         * New York Blood Center
+         */
+        NYB, 
+        /**
+         * Ortho Diagnostic Systems, Inc.
+         */
+        ORT, 
+        /**
+         * Organon Teknika Corporation
+         */
+        OTC, 
+        /**
+         * Parkedale Pharmaceuticals (formerly Parke-Davis)
+         */
+        PD, 
+        /**
+         * Aventis Pasteur Inc. (formerly Pasteur Merieux Connaught; includes Connaught Laboratories and Pasteur Merieux)
+         */
+        PMC, 
+        /**
+         * Praxis Biologics [Inactive-use WAL]
+         */
+        PRX, 
+        /**
+         * Sclavo, Inc.
+         */
+        SCL, 
+        /**
+         * Swiss Serum and Vaccine Inst. [Inactive-use BPC]
+         */
+        SI, 
+        /**
+         * SmithKline Beecham
+         */
+        SKB, 
+        /**
+         * United States Army Medical Research and Materiel Command
+         */
+        USA, 
+        /**
+         * Wyeth-Ayerst [Inactive-use WAL]
+         */
+        WA, 
+        /**
+         * Wyeth-Ayerst (includes Wyeth-Lederle Vaccines and Pediatrics, Wyeth Laboratories, Lederle Laboratories, and Praxis Biologics)
+         */
+        WAL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static V3VaccineManufacturer fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("AB".equals(codeString))
+          return AB;
+        if ("AD".equals(codeString))
+          return AD;
+        if ("ALP".equals(codeString))
+          return ALP;
+        if ("AR".equals(codeString))
+          return AR;
+        if ("AVI".equals(codeString))
+          return AVI;
+        if ("BA".equals(codeString))
+          return BA;
+        if ("BAY".equals(codeString))
+          return BAY;
+        if ("BP".equals(codeString))
+          return BP;
+        if ("BPC".equals(codeString))
+          return BPC;
+        if ("CEN".equals(codeString))
+          return CEN;
+        if ("CHI".equals(codeString))
+          return CHI;
+        if ("CON".equals(codeString))
+          return CON;
+        if ("EVN".equals(codeString))
+          return EVN;
+        if ("GRE".equals(codeString))
+          return GRE;
+        if ("IAG".equals(codeString))
+          return IAG;
+        if ("IM".equals(codeString))
+          return IM;
+        if ("IUS".equals(codeString))
+          return IUS;
+        if ("JPN".equals(codeString))
+          return JPN;
+        if ("KGC".equals(codeString))
+          return KGC;
+        if ("LED".equals(codeString))
+          return LED;
+        if ("MA".equals(codeString))
+          return MA;
+        if ("MED".equals(codeString))
+          return MED;
+        if ("MIL".equals(codeString))
+          return MIL;
+        if ("MIP".equals(codeString))
+          return MIP;
+        if ("MSD".equals(codeString))
+          return MSD;
+        if ("NAB".equals(codeString))
+          return NAB;
+        if ("NAV".equals(codeString))
+          return NAV;
+        if ("NOV".equals(codeString))
+          return NOV;
+        if ("NYB".equals(codeString))
+          return NYB;
+        if ("ORT".equals(codeString))
+          return ORT;
+        if ("OTC".equals(codeString))
+          return OTC;
+        if ("PD".equals(codeString))
+          return PD;
+        if ("PMC".equals(codeString))
+          return PMC;
+        if ("PRX".equals(codeString))
+          return PRX;
+        if ("SCL".equals(codeString))
+          return SCL;
+        if ("SI".equals(codeString))
+          return SI;
+        if ("SKB".equals(codeString))
+          return SKB;
+        if ("USA".equals(codeString))
+          return USA;
+        if ("WA".equals(codeString))
+          return WA;
+        if ("WAL".equals(codeString))
+          return WAL;
+        throw new FHIRException("Unknown V3VaccineManufacturer code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case AB: return "AB";
+            case AD: return "AD";
+            case ALP: return "ALP";
+            case AR: return "AR";
+            case AVI: return "AVI";
+            case BA: return "BA";
+            case BAY: return "BAY";
+            case BP: return "BP";
+            case BPC: return "BPC";
+            case CEN: return "CEN";
+            case CHI: return "CHI";
+            case CON: return "CON";
+            case EVN: return "EVN";
+            case GRE: return "GRE";
+            case IAG: return "IAG";
+            case IM: return "IM";
+            case IUS: return "IUS";
+            case JPN: return "JPN";
+            case KGC: return "KGC";
+            case LED: return "LED";
+            case MA: return "MA";
+            case MED: return "MED";
+            case MIL: return "MIL";
+            case MIP: return "MIP";
+            case MSD: return "MSD";
+            case NAB: return "NAB";
+            case NAV: return "NAV";
+            case NOV: return "NOV";
+            case NYB: return "NYB";
+            case ORT: return "ORT";
+            case OTC: return "OTC";
+            case PD: return "PD";
+            case PMC: return "PMC";
+            case PRX: return "PRX";
+            case SCL: return "SCL";
+            case SI: return "SI";
+            case SKB: return "SKB";
+            case USA: return "USA";
+            case WA: return "WA";
+            case WAL: return "WAL";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/v3/VaccineManufacturer";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case AB: return "Abbott Laboratories (includes Ross Products Division)";
+            case AD: return "Adams Laboratories";
+            case ALP: return "Alpha Therapeutic Corporation";
+            case AR: return "Armour [Inactive-use CEN]";
+            case AVI: return "Aviron";
+            case BA: return "Baxter Healthcare Corporation";
+            case BAY: return "Bayer Corporation (includes Miles, Inc. and Cutter Laboratories)";
+            case BP: return "Berna Products [Inactive-use BPC]";
+            case BPC: return "Berna Products Corporation (includes Swiss Serum and Vaccine Institute Berne)";
+            case CEN: return "Centeon L.L.C. (includes Armour Pharmaceutical Company)";
+            case CHI: return "Chiron Corporation";
+            case CON: return "Connaught [Inactive-use PMC]";
+            case EVN: return "Evans Medical Limited (an affiliate of Medeva Pharmaceuticals, Inc.)";
+            case GRE: return "Greer Laboratories, Inc.";
+            case IAG: return "Immuno International AG";
+            case IM: return "Merieux [Inactive-use PMC]";
+            case IUS: return "Immuno-U.S., Inc.";
+            case JPN: return "The Research Foundation for Microbial Diseases of Osaka University (BIKEN)";
+            case KGC: return "Korea Green Cross Corporation";
+            case LED: return "Lederle [Inactive-use WAL]";
+            case MA: return "Massachusetts Public Health Biologic Laboratories";
+            case MED: return "MedImmune, Inc.";
+            case MIL: return "Miles [Inactive-use BAY]";
+            case MIP: return "Bioport Corporation (formerly Michigan Biologic Products Institute)";
+            case MSD: return "Merck & Co., Inc.";
+            case NAB: return "NABI (formerly North American Biologicals, Inc.)";
+            case NAV: return "North American Vaccine, Inc.";
+            case NOV: return "Novartis Pharmaceutical Corporation (includes Ciba-Geigy Limited and Sandoz Limited)";
+            case NYB: return "New York Blood Center";
+            case ORT: return "Ortho Diagnostic Systems, Inc.";
+            case OTC: return "Organon Teknika Corporation";
+            case PD: return "Parkedale Pharmaceuticals (formerly Parke-Davis)";
+            case PMC: return "Aventis Pasteur Inc. (formerly Pasteur Merieux Connaught; includes Connaught Laboratories and Pasteur Merieux)";
+            case PRX: return "Praxis Biologics [Inactive-use WAL]";
+            case SCL: return "Sclavo, Inc.";
+            case SI: return "Swiss Serum and Vaccine Inst. [Inactive-use BPC]";
+            case SKB: return "SmithKline Beecham";
+            case USA: return "United States Army Medical Research and Materiel Command";
+            case WA: return "Wyeth-Ayerst [Inactive-use WAL]";
+            case WAL: return "Wyeth-Ayerst (includes Wyeth-Lederle Vaccines and Pediatrics, Wyeth Laboratories, Lederle Laboratories, and Praxis Biologics)";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case AB: return "Abbott Laboratories (includes Ross Products Division)";
+            case AD: return "Adams Laboratories";
+            case ALP: return "Alpha Therapeutic Corporation";
+            case AR: return "Armour [Inactive - use CEN]";
+            case AVI: return "Aviron";
+            case BA: return "Baxter Healthcare Corporation";
+            case BAY: return "Bayer Corporation (includes Miles, Inc. and Cutter Laboratories)";
+            case BP: return "Berna Products [Inactive - use BPC]";
+            case BPC: return "Berna Products Corporation (includes Swiss Serum and Vaccine Institute Berne)";
+            case CEN: return "Centeon L.L.C. (includes Armour Pharmaceutical Company)";
+            case CHI: return "Chiron Corporation";
+            case CON: return "Connaught [Inactive - use PMC]";
+            case EVN: return "Evans Medical Limited (an affiliate of Medeva Pharmaceuticals, Inc.)";
+            case GRE: return "Greer Laboratories, Inc.";
+            case IAG: return "Immuno International AG";
+            case IM: return "Merieux [Inactive - use PMC]";
+            case IUS: return "Immuno-U.S., Inc.";
+            case JPN: return "The Research Foundation for Microbial Diseases of Osaka University (BIKEN)";
+            case KGC: return "Korea Green Cross Corporation";
+            case LED: return "Lederle [Inactive - use WAL]";
+            case MA: return "Massachusetts Public Health Biologic Laboratories";
+            case MED: return "MedImmune, Inc.";
+            case MIL: return "Miles [Inactive - use BAY]";
+            case MIP: return "Bioport Corporation (formerly Michigan Biologic Products Institute)";
+            case MSD: return "Merck and Co., Inc.";
+            case NAB: return "NABI (formerly North American Biologicals, Inc.)";
+            case NAV: return "North American Vaccine, Inc.";
+            case NOV: return "Novartis Pharmaceutical Corporation (includes Ciba-Geigy Limited and Sandoz Limited)";
+            case NYB: return "New York Blood Center";
+            case ORT: return "Ortho Diagnostic Systems, Inc.";
+            case OTC: return "Organon Teknika Corporation";
+            case PD: return "Parkedale Pharmaceuticals (formerly Parke-Davis)";
+            case PMC: return "Aventis Pasteur Inc. (formerly Pasteur Merieux Connaught; includes Connaught Laboratories and Pasteur Merieux)";
+            case PRX: return "Praxis Biologics [Inactive - use WAL]";
+            case SCL: return "Sclavo, Inc.";
+            case SI: return "Swiss Serum and Vaccine Inst. [Inactive - use BPC]";
+            case SKB: return "SmithKline Beecham";
+            case USA: return "United States Army Medical Research and Materiel Command";
+            case WA: return "Wyeth-Ayerst [Inactive - use WAL]";
+            case WAL: return "Wyeth-Ayerst (includes Wyeth-Lederle Vaccines and Pediatrics, Wyeth Laboratories, Lederle Laboratories, and Praxis Biologics)";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3VaccineManufacturerEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3VaccineManufacturerEnumFactory.java
new file mode 100644
index 00000000000..9d7b031d4f4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/V3VaccineManufacturerEnumFactory.java
@@ -0,0 +1,214 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class V3VaccineManufacturerEnumFactory implements EnumFactory {
+
+  public V3VaccineManufacturer fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("AB".equals(codeString))
+      return V3VaccineManufacturer.AB;
+    if ("AD".equals(codeString))
+      return V3VaccineManufacturer.AD;
+    if ("ALP".equals(codeString))
+      return V3VaccineManufacturer.ALP;
+    if ("AR".equals(codeString))
+      return V3VaccineManufacturer.AR;
+    if ("AVI".equals(codeString))
+      return V3VaccineManufacturer.AVI;
+    if ("BA".equals(codeString))
+      return V3VaccineManufacturer.BA;
+    if ("BAY".equals(codeString))
+      return V3VaccineManufacturer.BAY;
+    if ("BP".equals(codeString))
+      return V3VaccineManufacturer.BP;
+    if ("BPC".equals(codeString))
+      return V3VaccineManufacturer.BPC;
+    if ("CEN".equals(codeString))
+      return V3VaccineManufacturer.CEN;
+    if ("CHI".equals(codeString))
+      return V3VaccineManufacturer.CHI;
+    if ("CON".equals(codeString))
+      return V3VaccineManufacturer.CON;
+    if ("EVN".equals(codeString))
+      return V3VaccineManufacturer.EVN;
+    if ("GRE".equals(codeString))
+      return V3VaccineManufacturer.GRE;
+    if ("IAG".equals(codeString))
+      return V3VaccineManufacturer.IAG;
+    if ("IM".equals(codeString))
+      return V3VaccineManufacturer.IM;
+    if ("IUS".equals(codeString))
+      return V3VaccineManufacturer.IUS;
+    if ("JPN".equals(codeString))
+      return V3VaccineManufacturer.JPN;
+    if ("KGC".equals(codeString))
+      return V3VaccineManufacturer.KGC;
+    if ("LED".equals(codeString))
+      return V3VaccineManufacturer.LED;
+    if ("MA".equals(codeString))
+      return V3VaccineManufacturer.MA;
+    if ("MED".equals(codeString))
+      return V3VaccineManufacturer.MED;
+    if ("MIL".equals(codeString))
+      return V3VaccineManufacturer.MIL;
+    if ("MIP".equals(codeString))
+      return V3VaccineManufacturer.MIP;
+    if ("MSD".equals(codeString))
+      return V3VaccineManufacturer.MSD;
+    if ("NAB".equals(codeString))
+      return V3VaccineManufacturer.NAB;
+    if ("NAV".equals(codeString))
+      return V3VaccineManufacturer.NAV;
+    if ("NOV".equals(codeString))
+      return V3VaccineManufacturer.NOV;
+    if ("NYB".equals(codeString))
+      return V3VaccineManufacturer.NYB;
+    if ("ORT".equals(codeString))
+      return V3VaccineManufacturer.ORT;
+    if ("OTC".equals(codeString))
+      return V3VaccineManufacturer.OTC;
+    if ("PD".equals(codeString))
+      return V3VaccineManufacturer.PD;
+    if ("PMC".equals(codeString))
+      return V3VaccineManufacturer.PMC;
+    if ("PRX".equals(codeString))
+      return V3VaccineManufacturer.PRX;
+    if ("SCL".equals(codeString))
+      return V3VaccineManufacturer.SCL;
+    if ("SI".equals(codeString))
+      return V3VaccineManufacturer.SI;
+    if ("SKB".equals(codeString))
+      return V3VaccineManufacturer.SKB;
+    if ("USA".equals(codeString))
+      return V3VaccineManufacturer.USA;
+    if ("WA".equals(codeString))
+      return V3VaccineManufacturer.WA;
+    if ("WAL".equals(codeString))
+      return V3VaccineManufacturer.WAL;
+    throw new IllegalArgumentException("Unknown V3VaccineManufacturer code '"+codeString+"'");
+  }
+
+  public String toCode(V3VaccineManufacturer code) {
+    if (code == V3VaccineManufacturer.AB)
+      return "AB";
+    if (code == V3VaccineManufacturer.AD)
+      return "AD";
+    if (code == V3VaccineManufacturer.ALP)
+      return "ALP";
+    if (code == V3VaccineManufacturer.AR)
+      return "AR";
+    if (code == V3VaccineManufacturer.AVI)
+      return "AVI";
+    if (code == V3VaccineManufacturer.BA)
+      return "BA";
+    if (code == V3VaccineManufacturer.BAY)
+      return "BAY";
+    if (code == V3VaccineManufacturer.BP)
+      return "BP";
+    if (code == V3VaccineManufacturer.BPC)
+      return "BPC";
+    if (code == V3VaccineManufacturer.CEN)
+      return "CEN";
+    if (code == V3VaccineManufacturer.CHI)
+      return "CHI";
+    if (code == V3VaccineManufacturer.CON)
+      return "CON";
+    if (code == V3VaccineManufacturer.EVN)
+      return "EVN";
+    if (code == V3VaccineManufacturer.GRE)
+      return "GRE";
+    if (code == V3VaccineManufacturer.IAG)
+      return "IAG";
+    if (code == V3VaccineManufacturer.IM)
+      return "IM";
+    if (code == V3VaccineManufacturer.IUS)
+      return "IUS";
+    if (code == V3VaccineManufacturer.JPN)
+      return "JPN";
+    if (code == V3VaccineManufacturer.KGC)
+      return "KGC";
+    if (code == V3VaccineManufacturer.LED)
+      return "LED";
+    if (code == V3VaccineManufacturer.MA)
+      return "MA";
+    if (code == V3VaccineManufacturer.MED)
+      return "MED";
+    if (code == V3VaccineManufacturer.MIL)
+      return "MIL";
+    if (code == V3VaccineManufacturer.MIP)
+      return "MIP";
+    if (code == V3VaccineManufacturer.MSD)
+      return "MSD";
+    if (code == V3VaccineManufacturer.NAB)
+      return "NAB";
+    if (code == V3VaccineManufacturer.NAV)
+      return "NAV";
+    if (code == V3VaccineManufacturer.NOV)
+      return "NOV";
+    if (code == V3VaccineManufacturer.NYB)
+      return "NYB";
+    if (code == V3VaccineManufacturer.ORT)
+      return "ORT";
+    if (code == V3VaccineManufacturer.OTC)
+      return "OTC";
+    if (code == V3VaccineManufacturer.PD)
+      return "PD";
+    if (code == V3VaccineManufacturer.PMC)
+      return "PMC";
+    if (code == V3VaccineManufacturer.PRX)
+      return "PRX";
+    if (code == V3VaccineManufacturer.SCL)
+      return "SCL";
+    if (code == V3VaccineManufacturer.SI)
+      return "SI";
+    if (code == V3VaccineManufacturer.SKB)
+      return "SKB";
+    if (code == V3VaccineManufacturer.USA)
+      return "USA";
+    if (code == V3VaccineManufacturer.WA)
+      return "WA";
+    if (code == V3VaccineManufacturer.WAL)
+      return "WAL";
+    return "?";
+  }
+
+    public String toSystem(V3VaccineManufacturer code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatus.java
new file mode 100644
index 00000000000..2a121abdadd
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatus.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum VaccinationProtocolDoseStatus {
+
+        /**
+         * The dose counts toward fulfilling a path to immunity for a patient, providing protection against the target disease.
+         */
+        COUNT, 
+        /**
+         * The dose does not count toward fulfilling a path to immunity for a patient.
+         */
+        NOCOUNT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static VaccinationProtocolDoseStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("count".equals(codeString))
+          return COUNT;
+        if ("nocount".equals(codeString))
+          return NOCOUNT;
+        throw new FHIRException("Unknown VaccinationProtocolDoseStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case COUNT: return "count";
+            case NOCOUNT: return "nocount";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/vaccination-protocol-dose-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case COUNT: return "The dose counts toward fulfilling a path to immunity for a patient, providing protection against the target disease.";
+            case NOCOUNT: return "The dose does not count toward fulfilling a path to immunity for a patient.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case COUNT: return "Counts";
+            case NOCOUNT: return "Does not Count";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatusEnumFactory.java
new file mode 100644
index 00000000000..ace85e556ca
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatusEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class VaccinationProtocolDoseStatusEnumFactory implements EnumFactory {
+
+  public VaccinationProtocolDoseStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("count".equals(codeString))
+      return VaccinationProtocolDoseStatus.COUNT;
+    if ("nocount".equals(codeString))
+      return VaccinationProtocolDoseStatus.NOCOUNT;
+    throw new IllegalArgumentException("Unknown VaccinationProtocolDoseStatus code '"+codeString+"'");
+  }
+
+  public String toCode(VaccinationProtocolDoseStatus code) {
+    if (code == VaccinationProtocolDoseStatus.COUNT)
+      return "count";
+    if (code == VaccinationProtocolDoseStatus.NOCOUNT)
+      return "nocount";
+    return "?";
+  }
+
+    public String toSystem(VaccinationProtocolDoseStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatusReason.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatusReason.java
new file mode 100644
index 00000000000..3590ca809ac
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatusReason.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum VaccinationProtocolDoseStatusReason {
+
+        /**
+         * The product was stored in a manner inconsistent with manufacturer guidelines potentially reducing the effectiveness of the product.
+         */
+        ADVSTORAGE, 
+        /**
+         * The product was stored at a temperature inconsistent with manufacturer guidelines potentially reducing the effectiveness of the product.
+         */
+        COLDCHBRK, 
+        /**
+         * The product was administered after the expiration date associated with lot of vaccine.
+         */
+        EXPLOT, 
+        /**
+         * The product was administered at a time inconsistent with the documented schedule.
+         */
+        OUTSIDESCHED, 
+        /**
+         * The product administered has been recalled by the manufacturer.
+         */
+        PRODRECALL, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static VaccinationProtocolDoseStatusReason fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("advstorage".equals(codeString))
+          return ADVSTORAGE;
+        if ("coldchbrk".equals(codeString))
+          return COLDCHBRK;
+        if ("explot".equals(codeString))
+          return EXPLOT;
+        if ("outsidesched".equals(codeString))
+          return OUTSIDESCHED;
+        if ("prodrecall".equals(codeString))
+          return PRODRECALL;
+        throw new FHIRException("Unknown VaccinationProtocolDoseStatusReason code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ADVSTORAGE: return "advstorage";
+            case COLDCHBRK: return "coldchbrk";
+            case EXPLOT: return "explot";
+            case OUTSIDESCHED: return "outsidesched";
+            case PRODRECALL: return "prodrecall";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/vaccination-protocol-dose-status-reason";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ADVSTORAGE: return "The product was stored in a manner inconsistent with manufacturer guidelines potentially reducing the effectiveness of the product.";
+            case COLDCHBRK: return "The product was stored at a temperature inconsistent with manufacturer guidelines potentially reducing the effectiveness of the product.";
+            case EXPLOT: return "The product was administered after the expiration date associated with lot of vaccine.";
+            case OUTSIDESCHED: return "The product was administered at a time inconsistent with the documented schedule.";
+            case PRODRECALL: return "The product administered has been recalled by the manufacturer.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ADVSTORAGE: return "Adverse storage condition";
+            case COLDCHBRK: return "Cold chain break";
+            case EXPLOT: return "Expired lot";
+            case OUTSIDESCHED: return "Administered outside recommended schedule";
+            case PRODRECALL: return "Product recall";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatusReasonEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatusReasonEnumFactory.java
new file mode 100644
index 00000000000..7c8eac3be91
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VaccinationProtocolDoseStatusReasonEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class VaccinationProtocolDoseStatusReasonEnumFactory implements EnumFactory {
+
+  public VaccinationProtocolDoseStatusReason fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("advstorage".equals(codeString))
+      return VaccinationProtocolDoseStatusReason.ADVSTORAGE;
+    if ("coldchbrk".equals(codeString))
+      return VaccinationProtocolDoseStatusReason.COLDCHBRK;
+    if ("explot".equals(codeString))
+      return VaccinationProtocolDoseStatusReason.EXPLOT;
+    if ("outsidesched".equals(codeString))
+      return VaccinationProtocolDoseStatusReason.OUTSIDESCHED;
+    if ("prodrecall".equals(codeString))
+      return VaccinationProtocolDoseStatusReason.PRODRECALL;
+    throw new IllegalArgumentException("Unknown VaccinationProtocolDoseStatusReason code '"+codeString+"'");
+  }
+
+  public String toCode(VaccinationProtocolDoseStatusReason code) {
+    if (code == VaccinationProtocolDoseStatusReason.ADVSTORAGE)
+      return "advstorage";
+    if (code == VaccinationProtocolDoseStatusReason.COLDCHBRK)
+      return "coldchbrk";
+    if (code == VaccinationProtocolDoseStatusReason.EXPLOT)
+      return "explot";
+    if (code == VaccinationProtocolDoseStatusReason.OUTSIDESCHED)
+      return "outsidesched";
+    if (code == VaccinationProtocolDoseStatusReason.PRODRECALL)
+      return "prodrecall";
+    return "?";
+  }
+
+    public String toSystem(VaccinationProtocolDoseStatusReason code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ValueCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ValueCodes.java
new file mode 100644
index 00000000000..07990b1619d
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ValueCodes.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum ValueCodes {
+
+        /**
+         * Value 1001 description.
+         */
+        _1001, 
+        /**
+         * Value 1002 description.
+         */
+        _1002, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static ValueCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("1001".equals(codeString))
+          return _1001;
+        if ("1002".equals(codeString))
+          return _1002;
+        throw new FHIRException("Unknown ValueCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case _1001: return "1001";
+            case _1002: return "1002";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-claimvalue";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case _1001: return "Value 1001 description.";
+            case _1002: return "Value 1002 description.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case _1001: return "Value 1001";
+            case _1002: return "Value 1002";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ValueCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ValueCodesEnumFactory.java
new file mode 100644
index 00000000000..a1e0ee83140
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/ValueCodesEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class ValueCodesEnumFactory implements EnumFactory {
+
+  public ValueCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("1001".equals(codeString))
+      return ValueCodes._1001;
+    if ("1002".equals(codeString))
+      return ValueCodes._1002;
+    throw new IllegalArgumentException("Unknown ValueCodes code '"+codeString+"'");
+  }
+
+  public String toCode(ValueCodes code) {
+    if (code == ValueCodes._1001)
+      return "1001";
+    if (code == ValueCodes._1002)
+      return "1002";
+    return "?";
+  }
+
+    public String toSystem(ValueCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VariantState.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VariantState.java
new file mode 100644
index 00000000000..3e16aaaab4c
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VariantState.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum VariantState {
+
+        /**
+         * the variant is detected
+         */
+        POSITIVE, 
+        /**
+         * no variant is detected
+         */
+        NEGATIVE, 
+        /**
+         * result of the variant is missing
+         */
+        ABSENT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static VariantState fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("positive".equals(codeString))
+          return POSITIVE;
+        if ("negative".equals(codeString))
+          return NEGATIVE;
+        if ("absent".equals(codeString))
+          return ABSENT;
+        throw new FHIRException("Unknown VariantState code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case POSITIVE: return "positive";
+            case NEGATIVE: return "negative";
+            case ABSENT: return "absent";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/variant-state";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case POSITIVE: return "the variant is detected";
+            case NEGATIVE: return "no variant is detected";
+            case ABSENT: return "result of the variant is missing";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case POSITIVE: return "positive";
+            case NEGATIVE: return "negative";
+            case ABSENT: return "absent";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VariantStateEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VariantStateEnumFactory.java
new file mode 100644
index 00000000000..72b3ea1a1d6
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VariantStateEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class VariantStateEnumFactory implements EnumFactory {
+
+  public VariantState fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("positive".equals(codeString))
+      return VariantState.POSITIVE;
+    if ("negative".equals(codeString))
+      return VariantState.NEGATIVE;
+    if ("absent".equals(codeString))
+      return VariantState.ABSENT;
+    throw new IllegalArgumentException("Unknown VariantState code '"+codeString+"'");
+  }
+
+  public String toCode(VariantState code) {
+    if (code == VariantState.POSITIVE)
+      return "positive";
+    if (code == VariantState.NEGATIVE)
+      return "negative";
+    if (code == VariantState.ABSENT)
+      return "absent";
+    return "?";
+  }
+
+    public String toSystem(VariantState code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VersioningPolicy.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VersioningPolicy.java
new file mode 100644
index 00000000000..c300d63de72
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VersioningPolicy.java
@@ -0,0 +1,96 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum VersioningPolicy {
+
+        /**
+         * VersionId meta-property is not supported (server) or used (client).
+         */
+        NOVERSION, 
+        /**
+         * VersionId meta-property is supported (server) or used (client).
+         */
+        VERSIONED, 
+        /**
+         * VersionId must be correct for updates (server) or will be specified (If-match header) for updates (client).
+         */
+        VERSIONEDUPDATE, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static VersioningPolicy fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("no-version".equals(codeString))
+          return NOVERSION;
+        if ("versioned".equals(codeString))
+          return VERSIONED;
+        if ("versioned-update".equals(codeString))
+          return VERSIONEDUPDATE;
+        throw new FHIRException("Unknown VersioningPolicy code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case NOVERSION: return "no-version";
+            case VERSIONED: return "versioned";
+            case VERSIONEDUPDATE: return "versioned-update";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/versioning-policy";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case NOVERSION: return "VersionId meta-property is not supported (server) or used (client).";
+            case VERSIONED: return "VersionId meta-property is supported (server) or used (client).";
+            case VERSIONEDUPDATE: return "VersionId must be correct for updates (server) or will be specified (If-match header) for updates (client).";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case NOVERSION: return "No VersionId Support";
+            case VERSIONED: return "Versioned";
+            case VERSIONEDUPDATE: return "VersionId tracked fully";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VersioningPolicyEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VersioningPolicyEnumFactory.java
new file mode 100644
index 00000000000..c02cb765e4b
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VersioningPolicyEnumFactory.java
@@ -0,0 +1,66 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class VersioningPolicyEnumFactory implements EnumFactory {
+
+  public VersioningPolicy fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("no-version".equals(codeString))
+      return VersioningPolicy.NOVERSION;
+    if ("versioned".equals(codeString))
+      return VersioningPolicy.VERSIONED;
+    if ("versioned-update".equals(codeString))
+      return VersioningPolicy.VERSIONEDUPDATE;
+    throw new IllegalArgumentException("Unknown VersioningPolicy code '"+codeString+"'");
+  }
+
+  public String toCode(VersioningPolicy code) {
+    if (code == VersioningPolicy.NOVERSION)
+      return "no-version";
+    if (code == VersioningPolicy.VERSIONED)
+      return "versioned";
+    if (code == VersioningPolicy.VERSIONEDUPDATE)
+      return "versioned-update";
+    return "?";
+  }
+
+    public String toSystem(VersioningPolicy code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionBaseCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionBaseCodes.java
new file mode 100644
index 00000000000..0158aa7d221
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionBaseCodes.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum VisionBaseCodes {
+
+        /**
+         * top
+         */
+        UP, 
+        /**
+         * bottom
+         */
+        DOWN, 
+        /**
+         * inner edge
+         */
+        IN, 
+        /**
+         * outer edge
+         */
+        OUT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static VisionBaseCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("up".equals(codeString))
+          return UP;
+        if ("down".equals(codeString))
+          return DOWN;
+        if ("in".equals(codeString))
+          return IN;
+        if ("out".equals(codeString))
+          return OUT;
+        throw new FHIRException("Unknown VisionBaseCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case UP: return "up";
+            case DOWN: return "down";
+            case IN: return "in";
+            case OUT: return "out";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/vision-base-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case UP: return "top";
+            case DOWN: return "bottom";
+            case IN: return "inner edge";
+            case OUT: return "outer edge";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case UP: return "Up";
+            case DOWN: return "Down";
+            case IN: return "In";
+            case OUT: return "Out";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionBaseCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionBaseCodesEnumFactory.java
new file mode 100644
index 00000000000..fba0ac66164
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionBaseCodesEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class VisionBaseCodesEnumFactory implements EnumFactory {
+
+  public VisionBaseCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("up".equals(codeString))
+      return VisionBaseCodes.UP;
+    if ("down".equals(codeString))
+      return VisionBaseCodes.DOWN;
+    if ("in".equals(codeString))
+      return VisionBaseCodes.IN;
+    if ("out".equals(codeString))
+      return VisionBaseCodes.OUT;
+    throw new IllegalArgumentException("Unknown VisionBaseCodes code '"+codeString+"'");
+  }
+
+  public String toCode(VisionBaseCodes code) {
+    if (code == VisionBaseCodes.UP)
+      return "up";
+    if (code == VisionBaseCodes.DOWN)
+      return "down";
+    if (code == VisionBaseCodes.IN)
+      return "in";
+    if (code == VisionBaseCodes.OUT)
+      return "out";
+    return "?";
+  }
+
+    public String toSystem(VisionBaseCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionEyeCodes.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionEyeCodes.java
new file mode 100644
index 00000000000..8af7501907a
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionEyeCodes.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum VisionEyeCodes {
+
+        /**
+         * Right Eye
+         */
+        RIGHT, 
+        /**
+         * Left Eye
+         */
+        LEFT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static VisionEyeCodes fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("right".equals(codeString))
+          return RIGHT;
+        if ("left".equals(codeString))
+          return LEFT;
+        throw new FHIRException("Unknown VisionEyeCodes code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case RIGHT: return "right";
+            case LEFT: return "left";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/vision-eye-codes";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case RIGHT: return "Right Eye";
+            case LEFT: return "Left Eye";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case RIGHT: return "Right Eye";
+            case LEFT: return "Left Eye";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionEyeCodesEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionEyeCodesEnumFactory.java
new file mode 100644
index 00000000000..e69ec134827
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionEyeCodesEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class VisionEyeCodesEnumFactory implements EnumFactory {
+
+  public VisionEyeCodes fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("right".equals(codeString))
+      return VisionEyeCodes.RIGHT;
+    if ("left".equals(codeString))
+      return VisionEyeCodes.LEFT;
+    throw new IllegalArgumentException("Unknown VisionEyeCodes code '"+codeString+"'");
+  }
+
+  public String toCode(VisionEyeCodes code) {
+    if (code == VisionEyeCodes.RIGHT)
+      return "right";
+    if (code == VisionEyeCodes.LEFT)
+      return "left";
+    return "?";
+  }
+
+    public String toSystem(VisionEyeCodes code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionProduct.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionProduct.java
new file mode 100644
index 00000000000..52bc7904fc4
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionProduct.java
@@ -0,0 +1,87 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum VisionProduct {
+
+        /**
+         * A lens to be fitted to a frame to comprise a pair of glasses.
+         */
+        LENS, 
+        /**
+         * A lens to be fitted for wearing directly on an eye.
+         */
+        CONTACT, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static VisionProduct fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("lens".equals(codeString))
+          return LENS;
+        if ("contact".equals(codeString))
+          return CONTACT;
+        throw new FHIRException("Unknown VisionProduct code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case LENS: return "lens";
+            case CONTACT: return "contact";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/ex-visionprescriptionproduct";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case LENS: return "A lens to be fitted to a frame to comprise a pair of glasses.";
+            case CONTACT: return "A lens to be fitted for wearing directly on an eye.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case LENS: return "Lens";
+            case CONTACT: return "Contact Lens";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionProductEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionProductEnumFactory.java
new file mode 100644
index 00000000000..3e431efef48
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionProductEnumFactory.java
@@ -0,0 +1,62 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class VisionProductEnumFactory implements EnumFactory {
+
+  public VisionProduct fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("lens".equals(codeString))
+      return VisionProduct.LENS;
+    if ("contact".equals(codeString))
+      return VisionProduct.CONTACT;
+    throw new IllegalArgumentException("Unknown VisionProduct code '"+codeString+"'");
+  }
+
+  public String toCode(VisionProduct code) {
+    if (code == VisionProduct.LENS)
+      return "lens";
+    if (code == VisionProduct.CONTACT)
+      return "contact";
+    return "?";
+  }
+
+    public String toSystem(VisionProduct code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionStatus.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionStatus.java
new file mode 100644
index 00000000000..421a22ff3a5
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionStatus.java
@@ -0,0 +1,105 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum VisionStatus {
+
+        /**
+         * The resource instance is currently in-force.
+         */
+        ACTIVE, 
+        /**
+         * The resource instance is withdrawn, rescinded or reversed.
+         */
+        CANCELLED, 
+        /**
+         * A new resource instance the contents of which is not complete.
+         */
+        DRAFT, 
+        /**
+         * The resource instance was entered in error.
+         */
+        ENTEREDINERROR, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static VisionStatus fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("active".equals(codeString))
+          return ACTIVE;
+        if ("cancelled".equals(codeString))
+          return CANCELLED;
+        if ("draft".equals(codeString))
+          return DRAFT;
+        if ("entered-in-error".equals(codeString))
+          return ENTEREDINERROR;
+        throw new FHIRException("Unknown VisionStatus code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case ACTIVE: return "active";
+            case CANCELLED: return "cancelled";
+            case DRAFT: return "draft";
+            case ENTEREDINERROR: return "entered-in-error";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/vision-status";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case ACTIVE: return "The resource instance is currently in-force.";
+            case CANCELLED: return "The resource instance is withdrawn, rescinded or reversed.";
+            case DRAFT: return "A new resource instance the contents of which is not complete.";
+            case ENTEREDINERROR: return "The resource instance was entered in error.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case ACTIVE: return "Active";
+            case CANCELLED: return "Cancelled";
+            case DRAFT: return "Draft";
+            case ENTEREDINERROR: return "Entered In Error";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionStatusEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionStatusEnumFactory.java
new file mode 100644
index 00000000000..4985bb5a9b3
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/VisionStatusEnumFactory.java
@@ -0,0 +1,70 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class VisionStatusEnumFactory implements EnumFactory {
+
+  public VisionStatus fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("active".equals(codeString))
+      return VisionStatus.ACTIVE;
+    if ("cancelled".equals(codeString))
+      return VisionStatus.CANCELLED;
+    if ("draft".equals(codeString))
+      return VisionStatus.DRAFT;
+    if ("entered-in-error".equals(codeString))
+      return VisionStatus.ENTEREDINERROR;
+    throw new IllegalArgumentException("Unknown VisionStatus code '"+codeString+"'");
+  }
+
+  public String toCode(VisionStatus code) {
+    if (code == VisionStatus.ACTIVE)
+      return "active";
+    if (code == VisionStatus.CANCELLED)
+      return "cancelled";
+    if (code == VisionStatus.DRAFT)
+      return "draft";
+    if (code == VisionStatus.ENTEREDINERROR)
+      return "entered-in-error";
+    return "?";
+  }
+
+    public String toSystem(VisionStatus code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/W3cProvenanceActivityType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/W3cProvenanceActivityType.java
new file mode 100644
index 00000000000..33c84b5ad93
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/W3cProvenanceActivityType.java
@@ -0,0 +1,177 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum W3cProvenanceActivityType {
+
+        /**
+         * The completion of production of a new entity by an activity. This entity did not exist before generation and becomes available for usage after this generation. Given that a generation is the completion of production of an entity, it is instantaneous.
+         */
+        GENERATION, 
+        /**
+         * the beginning of utilizing an entity by an activity. Before usage, the activity had not begun to utilize this entity and could not have been affected by the entity.  (Note: This definition is formulated for a given usage; it is permitted for an activity to have used a same entity multiple times.) Given that a usage is the beginning of utilizing an entity, it is instantaneous.
+         */
+        USAGE, 
+        /**
+         * The exchange of some unspecified entity by two activities, one activity using some entity generated by the other. A communication implies that activity a2 is dependent on another activity, a1, by way of some unspecified entity that is generated by a1 and used by a2.
+         */
+        COMMUNICATION, 
+        /**
+         * When an activity is deemed to have been started by an entity, known as trigger. The activity did not exist before its start. Any usage, generation, or invalidation involving an activity follows the activity's start. A start may refer to a trigger entity that set off the activity, or to an activity, known as starter, that generated the trigger. Given that a start is when an activity is deemed to have started, it is instantaneous.
+         */
+        START, 
+        /**
+         * When an activity is deemed to have been ended by an entity, known as trigger. The activity no longer exists after its end. Any usage, generation, or invalidation involving an activity precedes the activity's end. An end may refer to a trigger entity that terminated the activity, or to an activity, known as ender that generated the trigger.
+         */
+        END, 
+        /**
+         * The start of the destruction, cessation, or expiry of an existing entity by an activity. The entity is no longer available for use (or further invalidation) after invalidation. Any generation or usage of an entity precedes its invalidation. Given that an invalidation is the start of destruction, cessation, or expiry, it is instantaneous.
+         */
+        INVALIDATION, 
+        /**
+         * A transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a pre-existing entity. For an entity to be transformed from, created from, or resulting from an update to another, there must be some underpinning activity or activities performing the necessary action(s) resulting in such a derivation. A derivation can be described at various levels of precision. In its simplest form, derivation relates two entities. Optionally, attributes can be added to represent further information about the derivation. If the derivation is the result of a single known activity, then this activity can also be optionally expressed. To provide a completely accurate description of the derivation, the generation and usage of the generated and used entities, respectively, can be provided, so as to make the derivation path, through usage, activity, and generation, explicit. Optional information such as activity, generation, and usage can be linked to derivations to aid analysis of provenance and to facilitate provenance-based reproducibility.
+         */
+        DERIVATION, 
+        /**
+         * A derivation for which the resulting entity is a revised version of some original. The implication here is that the resulting entity contains substantial content from the original. A revision relation is a kind of derivation relation from a revised entity to a preceding entity.
+         */
+        REVISION, 
+        /**
+         * The repeat of (some or all of) an entity, such as text or image, by someone who may or may not be its original author. A quotation relation is a kind of derivation relation, for which an entity was derived from a preceding entity by copying, or 'quoting', some or all of it.
+         */
+        QUOTATION, 
+        /**
+         * Refers to something produced by some agent with direct experience and knowledge about the topic, at the time of the topic's study, without benefit from hindsight. Because of the directness of primary sources, they 'speak for themselves' in ways that cannot be captured through the filter of secondary sources. As such, it is important for secondary sources to reference those primary sources from which they were derived, so that their reliability can be investigated. It is also important to note that a given entity might be a primary source for one entity but not another. It is the reason why Primary Source is defined as a relation as opposed to a subtype of Entity.
+         */
+        PRIMARYSOURCE, 
+        /**
+         * Ascribing of an entity (object/document) to an agent.
+         */
+        ATTRIBUTION, 
+        /**
+         *  An aggregating activity that results in composition of an entity, which provides a structure to some constituents that must themselves be entities. These constituents are said to be member of the collections.
+         */
+        COLLECTION, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static W3cProvenanceActivityType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("Generation".equals(codeString))
+          return GENERATION;
+        if ("Usage".equals(codeString))
+          return USAGE;
+        if ("Communication".equals(codeString))
+          return COMMUNICATION;
+        if ("Start".equals(codeString))
+          return START;
+        if ("End".equals(codeString))
+          return END;
+        if ("Invalidation".equals(codeString))
+          return INVALIDATION;
+        if ("Derivation".equals(codeString))
+          return DERIVATION;
+        if ("Revision".equals(codeString))
+          return REVISION;
+        if ("Quotation".equals(codeString))
+          return QUOTATION;
+        if ("Primary-Source".equals(codeString))
+          return PRIMARYSOURCE;
+        if ("Attribution".equals(codeString))
+          return ATTRIBUTION;
+        if ("Collection".equals(codeString))
+          return COLLECTION;
+        throw new FHIRException("Unknown W3cProvenanceActivityType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case GENERATION: return "Generation";
+            case USAGE: return "Usage";
+            case COMMUNICATION: return "Communication";
+            case START: return "Start";
+            case END: return "End";
+            case INVALIDATION: return "Invalidation";
+            case DERIVATION: return "Derivation";
+            case REVISION: return "Revision";
+            case QUOTATION: return "Quotation";
+            case PRIMARYSOURCE: return "Primary-Source";
+            case ATTRIBUTION: return "Attribution";
+            case COLLECTION: return "Collection";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/w3c-provenance-activity-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case GENERATION: return "The completion of production of a new entity by an activity. This entity did not exist before generation and becomes available for usage after this generation. Given that a generation is the completion of production of an entity, it is instantaneous.";
+            case USAGE: return "the beginning of utilizing an entity by an activity. Before usage, the activity had not begun to utilize this entity and could not have been affected by the entity.  (Note: This definition is formulated for a given usage; it is permitted for an activity to have used a same entity multiple times.) Given that a usage is the beginning of utilizing an entity, it is instantaneous.";
+            case COMMUNICATION: return "The exchange of some unspecified entity by two activities, one activity using some entity generated by the other. A communication implies that activity a2 is dependent on another activity, a1, by way of some unspecified entity that is generated by a1 and used by a2.";
+            case START: return "When an activity is deemed to have been started by an entity, known as trigger. The activity did not exist before its start. Any usage, generation, or invalidation involving an activity follows the activity's start. A start may refer to a trigger entity that set off the activity, or to an activity, known as starter, that generated the trigger. Given that a start is when an activity is deemed to have started, it is instantaneous.";
+            case END: return "When an activity is deemed to have been ended by an entity, known as trigger. The activity no longer exists after its end. Any usage, generation, or invalidation involving an activity precedes the activity's end. An end may refer to a trigger entity that terminated the activity, or to an activity, known as ender that generated the trigger.";
+            case INVALIDATION: return "The start of the destruction, cessation, or expiry of an existing entity by an activity. The entity is no longer available for use (or further invalidation) after invalidation. Any generation or usage of an entity precedes its invalidation. Given that an invalidation is the start of destruction, cessation, or expiry, it is instantaneous.";
+            case DERIVATION: return "A transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a pre-existing entity. For an entity to be transformed from, created from, or resulting from an update to another, there must be some underpinning activity or activities performing the necessary action(s) resulting in such a derivation. A derivation can be described at various levels of precision. In its simplest form, derivation relates two entities. Optionally, attributes can be added to represent further information about the derivation. If the derivation is the result of a single known activity, then this activity can also be optionally expressed. To provide a completely accurate description of the derivation, the generation and usage of the generated and used entities, respectively, can be provided, so as to make the derivation path, through usage, activity, and generation, explicit. Optional information such as activity, generation, and usage can be linked to derivations to aid analysis of provenance and to facilitate provenance-based reproducibility.";
+            case REVISION: return "A derivation for which the resulting entity is a revised version of some original. The implication here is that the resulting entity contains substantial content from the original. A revision relation is a kind of derivation relation from a revised entity to a preceding entity.";
+            case QUOTATION: return "The repeat of (some or all of) an entity, such as text or image, by someone who may or may not be its original author. A quotation relation is a kind of derivation relation, for which an entity was derived from a preceding entity by copying, or 'quoting', some or all of it.";
+            case PRIMARYSOURCE: return "Refers to something produced by some agent with direct experience and knowledge about the topic, at the time of the topic's study, without benefit from hindsight. Because of the directness of primary sources, they 'speak for themselves' in ways that cannot be captured through the filter of secondary sources. As such, it is important for secondary sources to reference those primary sources from which they were derived, so that their reliability can be investigated. It is also important to note that a given entity might be a primary source for one entity but not another. It is the reason why Primary Source is defined as a relation as opposed to a subtype of Entity.";
+            case ATTRIBUTION: return "Ascribing of an entity (object/document) to an agent.";
+            case COLLECTION: return " An aggregating activity that results in composition of an entity, which provides a structure to some constituents that must themselves be entities. These constituents are said to be member of the collections.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case GENERATION: return "wasGeneratedBy";
+            case USAGE: return "used";
+            case COMMUNICATION: return "wasInformedBy";
+            case START: return "wasStartedBy";
+            case END: return "wasEndedBy";
+            case INVALIDATION: return "wasInvalidatedBy";
+            case DERIVATION: return "wasDerivedFrom";
+            case REVISION: return "wasRevisionOf";
+            case QUOTATION: return "wasQuotedFrom";
+            case PRIMARYSOURCE: return "wasPrimarySourceOf";
+            case ATTRIBUTION: return "wasAttributedTo";
+            case COLLECTION: return "isCollectionOf";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/W3cProvenanceActivityTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/W3cProvenanceActivityTypeEnumFactory.java
new file mode 100644
index 00000000000..2756bc9c029
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/W3cProvenanceActivityTypeEnumFactory.java
@@ -0,0 +1,102 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Mar 25, 2017 21:03-0400 for FHIR v3.0.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class W3cProvenanceActivityTypeEnumFactory implements EnumFactory {
+
+  public W3cProvenanceActivityType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("Generation".equals(codeString))
+      return W3cProvenanceActivityType.GENERATION;
+    if ("Usage".equals(codeString))
+      return W3cProvenanceActivityType.USAGE;
+    if ("Communication".equals(codeString))
+      return W3cProvenanceActivityType.COMMUNICATION;
+    if ("Start".equals(codeString))
+      return W3cProvenanceActivityType.START;
+    if ("End".equals(codeString))
+      return W3cProvenanceActivityType.END;
+    if ("Invalidation".equals(codeString))
+      return W3cProvenanceActivityType.INVALIDATION;
+    if ("Derivation".equals(codeString))
+      return W3cProvenanceActivityType.DERIVATION;
+    if ("Revision".equals(codeString))
+      return W3cProvenanceActivityType.REVISION;
+    if ("Quotation".equals(codeString))
+      return W3cProvenanceActivityType.QUOTATION;
+    if ("Primary-Source".equals(codeString))
+      return W3cProvenanceActivityType.PRIMARYSOURCE;
+    if ("Attribution".equals(codeString))
+      return W3cProvenanceActivityType.ATTRIBUTION;
+    if ("Collection".equals(codeString))
+      return W3cProvenanceActivityType.COLLECTION;
+    throw new IllegalArgumentException("Unknown W3cProvenanceActivityType code '"+codeString+"'");
+  }
+
+  public String toCode(W3cProvenanceActivityType code) {
+    if (code == W3cProvenanceActivityType.GENERATION)
+      return "Generation";
+    if (code == W3cProvenanceActivityType.USAGE)
+      return "Usage";
+    if (code == W3cProvenanceActivityType.COMMUNICATION)
+      return "Communication";
+    if (code == W3cProvenanceActivityType.START)
+      return "Start";
+    if (code == W3cProvenanceActivityType.END)
+      return "End";
+    if (code == W3cProvenanceActivityType.INVALIDATION)
+      return "Invalidation";
+    if (code == W3cProvenanceActivityType.DERIVATION)
+      return "Derivation";
+    if (code == W3cProvenanceActivityType.REVISION)
+      return "Revision";
+    if (code == W3cProvenanceActivityType.QUOTATION)
+      return "Quotation";
+    if (code == W3cProvenanceActivityType.PRIMARYSOURCE)
+      return "Primary-Source";
+    if (code == W3cProvenanceActivityType.ATTRIBUTION)
+      return "Attribution";
+    if (code == W3cProvenanceActivityType.COLLECTION)
+      return "Collection";
+    return "?";
+  }
+
+    public String toSystem(W3cProvenanceActivityType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/XdsRelationshipType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/XdsRelationshipType.java
new file mode 100644
index 00000000000..dbd14a1c8d7
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/XdsRelationshipType.java
@@ -0,0 +1,114 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.exceptions.FHIRException;
+
+public enum XdsRelationshipType {
+
+        /**
+         * A separate XDS document that references a prior document, and may extend or alter the observations in the prior document.
+         */
+        APND, 
+        /**
+         * A new version of an existing document.
+         */
+        RPLC, 
+        /**
+         * A transformed document is derived by a machine translation from some other format.
+         */
+        XFRM, 
+        /**
+         * Both a XFRM and a RPLC relationship.
+         */
+        XFRMRPLC, 
+        /**
+         * This document signs the target document.
+         */
+        SIGNS, 
+        /**
+         * added to help the parsers
+         */
+        NULL;
+        public static XdsRelationshipType fromCode(String codeString) throws FHIRException {
+            if (codeString == null || "".equals(codeString))
+                return null;
+        if ("APND".equals(codeString))
+          return APND;
+        if ("RPLC".equals(codeString))
+          return RPLC;
+        if ("XFRM".equals(codeString))
+          return XFRM;
+        if ("XFRM_RPLC".equals(codeString))
+          return XFRMRPLC;
+        if ("signs".equals(codeString))
+          return SIGNS;
+        throw new FHIRException("Unknown XdsRelationshipType code '"+codeString+"'");
+        }
+        public String toCode() {
+          switch (this) {
+            case APND: return "APND";
+            case RPLC: return "RPLC";
+            case XFRM: return "XFRM";
+            case XFRMRPLC: return "XFRM_RPLC";
+            case SIGNS: return "signs";
+            default: return "?";
+          }
+        }
+        public String getSystem() {
+          return "http://hl7.org/fhir/xds-relationship-type";
+        }
+        public String getDefinition() {
+          switch (this) {
+            case APND: return "A separate XDS document that references a prior document, and may extend or alter the observations in the prior document.";
+            case RPLC: return "A new version of an existing document.";
+            case XFRM: return "A transformed document is derived by a machine translation from some other format.";
+            case XFRMRPLC: return "Both a XFRM and a RPLC relationship.";
+            case SIGNS: return "This document signs the target document.";
+            default: return "?";
+          }
+        }
+        public String getDisplay() {
+          switch (this) {
+            case APND: return "APND";
+            case RPLC: return "RPLC";
+            case XFRM: return "XFRM";
+            case XFRMRPLC: return "XFRM_RPLC";
+            case SIGNS: return "Signs";
+            default: return "?";
+          }
+    }
+
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/XdsRelationshipTypeEnumFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/XdsRelationshipTypeEnumFactory.java
new file mode 100644
index 00000000000..74d59ee7b90
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/XdsRelationshipTypeEnumFactory.java
@@ -0,0 +1,74 @@
+package org.hl7.fhir.dstu3.model.codesystems;
+
+/*
+  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.
+  
+*/
+
+// Generated on Sat, Nov 5, 2016 17:49-0400 for FHIR v1.7.0
+
+
+import org.hl7.fhir.dstu3.model.EnumFactory;
+
+public class XdsRelationshipTypeEnumFactory implements EnumFactory {
+
+  public XdsRelationshipType fromCode(String codeString) throws IllegalArgumentException {
+    if (codeString == null || "".equals(codeString))
+      return null;
+    if ("APND".equals(codeString))
+      return XdsRelationshipType.APND;
+    if ("RPLC".equals(codeString))
+      return XdsRelationshipType.RPLC;
+    if ("XFRM".equals(codeString))
+      return XdsRelationshipType.XFRM;
+    if ("XFRM_RPLC".equals(codeString))
+      return XdsRelationshipType.XFRMRPLC;
+    if ("signs".equals(codeString))
+      return XdsRelationshipType.SIGNS;
+    throw new IllegalArgumentException("Unknown XdsRelationshipType code '"+codeString+"'");
+  }
+
+  public String toCode(XdsRelationshipType code) {
+    if (code == XdsRelationshipType.APND)
+      return "APND";
+    if (code == XdsRelationshipType.RPLC)
+      return "RPLC";
+    if (code == XdsRelationshipType.XFRM)
+      return "XFRM";
+    if (code == XdsRelationshipType.XFRMRPLC)
+      return "XFRM_RPLC";
+    if (code == XdsRelationshipType.SIGNS)
+      return "signs";
+    return "?";
+  }
+
+    public String toSystem(XdsRelationshipType code) {
+      return code.getSystem();
+      }
+
+}
+
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/FHIRPathEngine.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/FHIRPathEngine.java
index 5cbb6218d55..5dadf69c830 100644
--- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/FHIRPathEngine.java
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/FHIRPathEngine.java
@@ -1,2824 +1,2825 @@
-package org.hl7.fhir.dstu3.utils;
-
-import java.math.BigDecimal;
-import java.util.*;
-
-import org.hl7.fhir.dstu3.context.IWorkerContext;
-import org.hl7.fhir.dstu3.model.*;
-import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
-import org.hl7.fhir.dstu3.model.ExpressionNode.*;
-import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind;
-import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule;
-import org.hl7.fhir.dstu3.model.TypeDetails.ProfiledType;
-import org.hl7.fhir.dstu3.utils.FHIRLexer.FHIRLexerException;
-import org.hl7.fhir.dstu3.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails;
-import org.hl7.fhir.exceptions.*;
-import org.hl7.fhir.utilities.Utilities;
-import org.hl7.fhir.utilities.ucum.Decimal;
-
-import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
-import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
-import ca.uhn.fhir.util.ElementUtil;
-
-/**
- * 
- * @author Grahame Grieve
- *
- */
-public class FHIRPathEngine {
-  private IWorkerContext worker;
-  private IEvaluationContext hostServices;
-  private StringBuilder log = new StringBuilder();
-  private Set primitiveTypes = new HashSet();
-  private Map allTypes = new HashMap();
-
-  // if the fhir path expressions are allowed to use constants beyond those defined in the specification
-  // the application can implement them by providing a constant resolver 
-  public interface IEvaluationContext {
-    public class FunctionDetails {
-      private String description;
-      private int minParameters;
-      private int maxParameters;
-      public FunctionDetails(String description, int minParameters, int maxParameters) {
-        super();
-        this.description = description;
-        this.minParameters = minParameters;
-        this.maxParameters = maxParameters;
-      }
-      public String getDescription() {
-        return description;
-      }
-      public int getMinParameters() {
-        return minParameters;
-      }
-      public int getMaxParameters() {
-        return maxParameters;
-      }
-
-    }
-
-    /**
-     * A constant reference - e.g. a reference to a name that must be resolved in context.
-     * The % will be removed from the constant name before this is invoked.
-     * 
-     * This will also be called if the host invokes the FluentPath engine with a context of null
-     *  
-     * @param appContext - content passed into the fluent path engine
-     * @param name - name reference to resolve
-     * @return the value of the reference (or null, if it's not valid, though can throw an exception if desired)
-     */
-    public Base resolveConstant(Object appContext, String name)  throws PathEngineException;
-    public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException;
-    
-    /**
-     * when the .log() function is called
-     * 
-     * @param argument
-     * @param focus
-     * @return
-     */
-    public boolean log(String argument, List focus);
-
-    // extensibility for functions
-    /**
-     * 
-     * @param functionName
-     * @return null if the function is not known
-     */
-    public FunctionDetails resolveFunction(String functionName);
-    
-    /**
-     * Check the function parameters, and throw an error if they are incorrect, or return the type for the function
-     * @param functionName
-     * @param parameters
-     * @return
-     */
-    public TypeDetails checkFunction(Object appContext, String functionName, List parameters) throws PathEngineException;
-    
-    /**
-     * @param appContext
-     * @param functionName
-     * @param parameters
-     * @return
-     */
-    public List executeFunction(Object appContext, String functionName, List> parameters);
-    
-    /**
-     * Implementation of resolve() function. Passed a string, return matching resource, if one is known - else null
-     * @param appInfo
-     * @param url
-     * @return
-     */
-    public Base resolveReference(Object appContext, String url);
-  }
-
-
-  /**
-   * @param worker - used when validating paths (@check), and used doing value set membership when executing tests (once that's defined)
-   */
-  public FHIRPathEngine(IWorkerContext worker) {
-    super();
-    this.worker = worker;
-    for (StructureDefinition sd : worker.allStructures()) {
-      if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION)
-        allTypes.put(sd.getName(), sd);
-      if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
-        primitiveTypes.add(sd.getName());
-      }
-    }
-  }
-
-
-  // --- 3 methods to override in children -------------------------------------------------------
-  // if you don't override, it falls through to the using the base reference implementation 
-  // HAPI overrides to these to support extending the base model
-
-  public IEvaluationContext getHostServices() {
-    return hostServices;
-  }
-
-
-  public void setHostServices(IEvaluationContext constantResolver) {
-    this.hostServices = constantResolver;
-  }
-
-
-  /**
-   * Given an item, return all the children that conform to the pattern described in name
-   * 
-   * Possible patterns:
-   *  - a simple name (which may be the base of a name with [] e.g. value[x])
-   *  - a name with a type replacement e.g. valueCodeableConcept
-   *  - * which means all children
-   *  - ** which means all descendants
-   *  
-   * @param item
-   * @param name
-   * @param result
-	 * @throws FHIRException 
-   */
-  protected void getChildrenByName(Base item, String name, List result) throws FHIRException {
-  	Base[] list = item.listChildrenByName(name, false);
-  	if (list != null)
-  		for (Base v : list)
-      if (v != null)
-        result.add(v);
-  }
-
-  // --- public API -------------------------------------------------------
-  /**
-   * Parse a path for later use using execute
-   * 
-   * @param path
-   * @return
-   * @throws PathEngineException 
-   * @throws Exception
-   */
-  public ExpressionNode parse(String path) throws FHIRLexerException {
-    FHIRLexer lexer = new FHIRLexer(path);
-    if (lexer.done())
-      throw lexer.error("Path cannot be empty");
-    ExpressionNode result = parseExpression(lexer, true);
-    if (!lexer.done())
-      throw lexer.error("Premature ExpressionNode termination at unexpected token \""+lexer.getCurrent()+"\"");
-    result.check();
-    return result;    
-  }
-
-  /**
-   * Parse a path that is part of some other syntax
-   *  
-   * @param path
-   * @return
-   * @throws PathEngineException 
-   * @throws Exception
-   */
-  public ExpressionNode parse(FHIRLexer lexer) throws FHIRLexerException {
-    ExpressionNode result = parseExpression(lexer, true);
-    result.check();
-    return result;    
-  }
-
-  /**
-   * check that paths referred to in the ExpressionNode are valid
-   * 
-   * xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath
-   * 
-   * returns a list of the possible types that might be returned by executing the ExpressionNode against a particular context
-   * 
-   * @param context - the logical type against which this path is applied
-   * @param path - the FHIR Path statement to check
-   * @throws DefinitionException 
-   * @throws PathEngineException 
-   * @if the path is not valid
-   */
-  public TypeDetails check(Object appContext, String resourceType, String context, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException {
-    // if context is a path that refers to a type, do that conversion now 
-	TypeDetails types; 
-	if (context == null) {
-	  types = null; // this is a special case; the first path reference will have to resolve to something in the context
-	} else if (!context.contains(".")) {
-    StructureDefinition sd = worker.fetchResource(StructureDefinition.class, context);
-	  types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl());
-	} else {
-	  String ctxt = context.substring(0, context.indexOf('.'));
-      if (Utilities.isAbsoluteUrl(resourceType)) {
-        ctxt = resourceType.substring(0, resourceType.lastIndexOf("/")+1)+ctxt;
-      }
-	  StructureDefinition sd = worker.fetchResource(StructureDefinition.class, ctxt);
-	  if (sd == null) 
-	    throw new PathEngineException("Unknown context "+context);
-	  ElementDefinitionMatch ed = getElementDefinition(sd, context, true);
-	  if (ed == null) 
-	    throw new PathEngineException("Unknown context element "+context);
-	  if (ed.fixedType != null) 
-	    types = new TypeDetails(CollectionStatus.SINGLETON, ed.fixedType);
-	  else if (ed.getDefinition().getType().isEmpty() || isAbstractType(ed.getDefinition().getType())) 
-	    types = new TypeDetails(CollectionStatus.SINGLETON, ctxt+"#"+context);
-	  else {
-	    types = new TypeDetails(CollectionStatus.SINGLETON);
-		for (TypeRefComponent t : ed.getDefinition().getType()) 
-		  types.addType(t.getCode());
-	  }
-	}
-
-    return executeType(new ExecutionTypeContext(appContext, resourceType, context, types), types, expr, true);
-  }
-
-  public TypeDetails check(Object appContext, StructureDefinition sd, String context, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException {
-    // if context is a path that refers to a type, do that conversion now 
-    TypeDetails types; 
-    if (!context.contains(".")) {
-      types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl());
-    } else {
-      ElementDefinitionMatch ed = getElementDefinition(sd, context, true);
-      if (ed == null) 
-        throw new PathEngineException("Unknown context element "+context);
-      if (ed.fixedType != null) 
-        types = new TypeDetails(CollectionStatus.SINGLETON, ed.fixedType);
-      else if (ed.getDefinition().getType().isEmpty() || isAbstractType(ed.getDefinition().getType())) 
-        types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl()+"#"+context);
-      else {
-        types = new TypeDetails(CollectionStatus.SINGLETON);
-        for (TypeRefComponent t : ed.getDefinition().getType()) 
-          types.addType(t.getCode());
-      }
-    }
-
-    return executeType(new ExecutionTypeContext(appContext, sd.getUrl(), context, types), types, expr, true);
-  }
-
-  public TypeDetails check(Object appContext, StructureDefinition sd, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException {
-    // if context is a path that refers to a type, do that conversion now 
-    TypeDetails types = null; // this is a special case; the first path reference will have to resolve to something in the context
-    return executeType(new ExecutionTypeContext(appContext, sd == null ? null : sd.getUrl(), null, types), types, expr, true);
-  }
-
-  public TypeDetails check(Object appContext, String resourceType, String context, String expr) throws FHIRLexerException, PathEngineException, DefinitionException {
-    return check(appContext, resourceType, context, parse(expr));
-  }
-
-
-  /**
-   * evaluate a path and return the matching elements
-   * 
-   * @param base - the object against which the path is being evaluated
-   * @param ExpressionNode - the parsed ExpressionNode statement to use
-   * @return
-   * @throws FHIRException 
-   * @
-   */
-	public List evaluate(Base base, ExpressionNode ExpressionNode) throws FHIRException {
-    List list = new ArrayList();
-    if (base != null)
-      list.add(base);
-    log = new StringBuilder();
-    return execute(new ExecutionContext(null, base != null && base.isResource() ? base : null, base, null, base), list, ExpressionNode, true);
-  }
-
-  /**
-   * evaluate a path and return the matching elements
-   * 
-   * @param base - the object against which the path is being evaluated
-   * @param path - the FHIR Path statement to use
-   * @return
-	 * @throws FHIRException 
-   * @
-   */
-	public List evaluate(Base base, String path) throws FHIRException {
-    ExpressionNode exp = parse(path);
-    List list = new ArrayList();
-    if (base != null)
-      list.add(base);
-    log = new StringBuilder();
-    return execute(new ExecutionContext(null, base.isResource() ? base : null, base, null, base), list, exp, true);
-  }
-
-  /**
-   * evaluate a path and return the matching elements
-   * 
-   * @param base - the object against which the path is being evaluated
-   * @param ExpressionNode - the parsed ExpressionNode statement to use
-   * @return
-	 * @throws FHIRException 
-   * @
-   */
-	public List evaluate(Object appContext, Resource resource, Base base, ExpressionNode ExpressionNode) throws FHIRException {
-    List list = new ArrayList();
-    if (base != null)
-      list.add(base);
-    log = new StringBuilder();
-    return execute(new ExecutionContext(appContext, resource, base, null, base), list, ExpressionNode, true);
-  }
-
-  /**
-   * evaluate a path and return the matching elements
-   * 
-   * @param base - the object against which the path is being evaluated
-   * @param ExpressionNode - the parsed ExpressionNode statement to use
-   * @return
-   * @throws FHIRException 
-   * @
-   */
-  public List evaluate(Object appContext, Base resource, Base base, ExpressionNode ExpressionNode) throws FHIRException {
-    List list = new ArrayList();
-    if (base != null)
-      list.add(base);
-    log = new StringBuilder();
-    return execute(new ExecutionContext(appContext, resource, base, null, base), list, ExpressionNode, true);
-  }
-
-  /**
-   * evaluate a path and return the matching elements
-   * 
-   * @param base - the object against which the path is being evaluated
-   * @param path - the FHIR Path statement to use
-   * @return
-	 * @throws FHIRException 
-   * @
-   */
-	public List evaluate(Object appContext, Resource resource, Base base, String path) throws FHIRException {
-    ExpressionNode exp = parse(path);
-    List list = new ArrayList();
-    if (base != null)
-      list.add(base);
-    log = new StringBuilder();
-    return execute(new ExecutionContext(appContext, resource, base, null, base), list, exp, true);
-  }
-
-  /**
-   * evaluate a path and return true or false (e.g. for an invariant)
-   * 
-   * @param base - the object against which the path is being evaluated
-   * @param path - the FHIR Path statement to use
-   * @return
-	 * @throws FHIRException 
-   * @
-   */
-	public boolean evaluateToBoolean(Resource resource, Base base, String path) throws FHIRException {
-    return convertToBoolean(evaluate(null, resource, base, path));
-  }
-
-  /**
-   * evaluate a path and return true or false (e.g. for an invariant)
-   * 
-   * @param base - the object against which the path is being evaluated
-   * @param path - the FHIR Path statement to use
-   * @return
-   * @throws FHIRException 
-   * @
-   */
-  public boolean evaluateToBoolean(Resource resource, Base base, ExpressionNode node) throws FHIRException {
-    return convertToBoolean(evaluate(null, resource, base, node));
-  }
-
-  /**
-   * evaluate a path and return true or false (e.g. for an invariant)
-   * 
-   * @param appinfo - application context
-   * @param base - the object against which the path is being evaluated
-   * @param path - the FHIR Path statement to use
-   * @return
-   * @throws FHIRException 
-   * @
-   */
-  public boolean evaluateToBoolean(Object appInfo, Resource resource, Base base, ExpressionNode node) throws FHIRException {
-    return convertToBoolean(evaluate(appInfo, resource, base, node));
-  }
-
-  /**
-   * evaluate a path and return true or false (e.g. for an invariant)
-   * 
-   * @param base - the object against which the path is being evaluated
-   * @param path - the FHIR Path statement to use
-   * @return
-   * @throws FHIRException 
-   * @
-   */
-  public boolean evaluateToBoolean(Base resource, Base base, ExpressionNode node) throws FHIRException {
-    return convertToBoolean(evaluate(null, resource, base, node));
-  }
-
-  /**
-   * evaluate a path and a string containing the outcome (for display)
-   * 
-   * @param base - the object against which the path is being evaluated
-   * @param path - the FHIR Path statement to use
-   * @return
-	 * @throws FHIRException 
-   * @
-   */
-  public String evaluateToString(Base base, String path) throws FHIRException {
-    return convertToString(evaluate(base, path));
-  }
-
-  public String evaluateToString(Object appInfo, Base resource, Base base, ExpressionNode node) throws FHIRException {
-    return convertToString(evaluate(appInfo, resource, base, node));
-  }
-
-  /**
-   * worker routine for converting a set of objects to a string representation
-   * 
-   * @param items - result from @evaluate
-   * @return
-   */
-  public String convertToString(List items) {
-    StringBuilder b = new StringBuilder();
-    boolean first = true;
-    for (Base item : items) {
-      if (first) 
-        first = false;
-      else
-        b.append(',');
-
-      b.append(convertToString(item));
-    }
-    return b.toString();
-  }
-
-  private String convertToString(Base item) {
-    if (item.isPrimitive())
-      return item.primitiveValue();
-    else 
-      return item.toString();
-  }
-
-  /**
-   * worker routine for converting a set of objects to a boolean representation (for invariants)
-   * 
-   * @param items - result from @evaluate
-   * @return
-   */
-  public boolean convertToBoolean(List items) {
-    if (items == null)
-      return false;
-    else if (items.size() == 1 && items.get(0) instanceof BooleanType)
-      return ((BooleanType) items.get(0)).getValue();
-    else 
-      return items.size() > 0;
-  }
-
-
-  private void log(String name, List contents) {
-    if (hostServices == null || !hostServices.log(name, contents)) {
-      if (log.length() > 0)
-        log.append("; ");
-      log.append(name);
-      log.append(": ");
-      boolean first = true;
-      for (Base b : contents) {
-        if (first)
-          first = false;
-        else
-          log.append(",");
-        log.append(convertToString(b));
-      }
-    }
-  }
-
-  public String forLog() {
-    if (log.length() > 0)
-      return " ("+log.toString()+")";
-    else
-      return "";
-  }
-
-  private class ExecutionContext {
-    private Object appInfo;
-    private Base resource;
-    private Base context;
-    private Base thisItem;
-    private Map aliases;
-    
-    public ExecutionContext(Object appInfo, Base resource, Base context, Map aliases, Base thisItem) {
-      this.appInfo = appInfo;
-      this.context = context;
-      this.resource = resource; 
-      this.aliases = aliases;
-      this.thisItem = thisItem;
-    }
-    public Base getResource() {
-      return resource;
-    }
-    public Base getThisItem() {
-      return thisItem;
-    }
-    public void addAlias(String name, List focus) throws FHIRException {
-      if (aliases == null)
-        aliases = new HashMap();
-      else
-        aliases = new HashMap(aliases); // clone it, since it's going to change 
-      if (focus.size() > 1)
-        throw new FHIRException("Attempt to alias a collection, not a singleton");
-      aliases.put(name, focus.size() == 0 ? null : focus.get(0));      
-    }
-    public Base getAlias(String name) {
-      return aliases == null ? null : aliases.get(name);
-    }
-  }
-
-  private class ExecutionTypeContext {
-    private Object appInfo; 
-    private String resource;
-    private String context;
-    private TypeDetails thisItem;
-
-
-    public ExecutionTypeContext(Object appInfo, String resource, String context, TypeDetails thisItem) {
-      super();
-      this.appInfo = appInfo;
-      this.resource = resource;
-      this.context = context;
-      this.thisItem = thisItem;
-      
-    }
-    public String getResource() {
-      return resource;
-    }
-    public TypeDetails getThisItem() {
-      return thisItem;
-    }
-  }
-
-  private ExpressionNode parseExpression(FHIRLexer lexer, boolean proximal) throws FHIRLexerException {
-    ExpressionNode result = new ExpressionNode(lexer.nextId());
-    SourceLocation c = lexer.getCurrentStartLocation();
-    result.setStart(lexer.getCurrentLocation());
-    // special:
-    if (lexer.getCurrent().equals("-")) {
-      lexer.take();
-      lexer.setCurrent("-"+lexer.getCurrent());
-    }
-    if (lexer.getCurrent().equals("+")) {
-      lexer.take();
-      lexer.setCurrent("+"+lexer.getCurrent());
-    }
-    if (lexer.isConstant(false)) {
-      checkConstant(lexer.getCurrent(), lexer);
-      result.setConstant(lexer.take());
-      result.setKind(Kind.Constant);
-      result.setEnd(lexer.getCurrentLocation());
-    } else if ("(".equals(lexer.getCurrent())) {
-      lexer.next();
-      result.setKind(Kind.Group);
-      result.setGroup(parseExpression(lexer, true));
-      if (!")".equals(lexer.getCurrent())) 
-        throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\"");
-      result.setEnd(lexer.getCurrentLocation());
-      lexer.next();
-    } else {
-      if (!lexer.isToken() && !lexer.getCurrent().startsWith("\"")) 
-        throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name");
-      if (lexer.getCurrent().startsWith("\""))
-        result.setName(lexer.readConstant("Path Name"));
-      else
-        result.setName(lexer.take());
-      result.setEnd(lexer.getCurrentLocation());
-      if (!result.checkName())
-        throw lexer.error("Found "+result.getName()+" expecting a valid token name");
-      if ("(".equals(lexer.getCurrent())) {
-        Function f = Function.fromCode(result.getName());
-        FunctionDetails details = null;
-        if (f == null) {
-          if (hostServices != null)
-            details = hostServices.resolveFunction(result.getName());
-          if (details == null)
-            throw lexer.error("The name "+result.getName()+" is not a valid function name");
-          f = Function.Custom;
-        }
-        result.setKind(Kind.Function);
-        result.setFunction(f);
-        lexer.next();
-        while (!")".equals(lexer.getCurrent())) { 
-          result.getParameters().add(parseExpression(lexer, true));
-          if (",".equals(lexer.getCurrent()))
-            lexer.next();
-          else if (!")".equals(lexer.getCurrent()))
-            throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - either a \",\" or a \")\" expected");
-        }
-        result.setEnd(lexer.getCurrentLocation());
-        lexer.next();
-        checkParameters(lexer, c, result, details);
-      } else
-        result.setKind(Kind.Name);
-    }
-    ExpressionNode focus = result;
-    if ("[".equals(lexer.getCurrent())) {
-      lexer.next();
-      ExpressionNode item = new ExpressionNode(lexer.nextId());
-      item.setKind(Kind.Function);
-      item.setFunction(ExpressionNode.Function.Item);
-      item.getParameters().add(parseExpression(lexer, true));
-      if (!lexer.getCurrent().equals("]"))
-        throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - a \"]\" expected");
-      lexer.next();
-      result.setInner(item);
-      focus = item;
-    }
-    if (".".equals(lexer.getCurrent())) {
-      lexer.next();
-      focus.setInner(parseExpression(lexer, false));
-    }
-    result.setProximal(proximal);
-    if (proximal) {
-      while (lexer.isOp()) {
-        focus.setOperation(ExpressionNode.Operation.fromCode(lexer.getCurrent()));
-        focus.setOpStart(lexer.getCurrentStartLocation());
-        focus.setOpEnd(lexer.getCurrentLocation());
-        lexer.next();
-        focus.setOpNext(parseExpression(lexer, false));
-        focus = focus.getOpNext();
-      }
-      result = organisePrecedence(lexer, result);
-    }
-    return result;
-  }
-
-  private ExpressionNode organisePrecedence(FHIRLexer lexer, ExpressionNode node) {
-    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Times, Operation.DivideBy, Operation.Div, Operation.Mod)); 
-    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Plus, Operation.Minus, Operation.Concatenate)); 
-    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Union)); 
-    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.LessThen, Operation.Greater, Operation.LessOrEqual, Operation.GreaterOrEqual));
-    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Is));
-    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Equals, Operation.Equivalent, Operation.NotEquals, Operation.NotEquivalent));
-    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.And));
-    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Xor, Operation.Or));
-    // last: implies
-    return node;
-  }
-
-  private ExpressionNode gatherPrecedence(FHIRLexer lexer, ExpressionNode start, EnumSet ops) {
-    //	  work : boolean;
-    //	  focus, node, group : ExpressionNode;
-
-    assert(start.isProximal());
-
-    // is there anything to do?
-    boolean work = false;
-    ExpressionNode focus = start.getOpNext();
-    if (ops.contains(start.getOperation())) {
-      while (focus != null && focus.getOperation() != null) {
-        work = work || !ops.contains(focus.getOperation());
-        focus = focus.getOpNext();
-      }
-    } else {
-      while (focus != null && focus.getOperation() != null) {
-        work = work || ops.contains(focus.getOperation());
-        focus = focus.getOpNext();
-      }
-    }  
-    if (!work)
-      return start;
-
-    // entry point: tricky
-    ExpressionNode group;
-    if (ops.contains(start.getOperation())) {
-      group = newGroup(lexer, start);
-      group.setProximal(true);
-      focus = start;
-      start = group;
-    } else {
-      ExpressionNode node = start;
-
-      focus = node.getOpNext();
-      while (!ops.contains(focus.getOperation())) {
-        node = focus;
-        focus = focus.getOpNext();
-      }
-      group = newGroup(lexer, focus);
-      node.setOpNext(group);
-    }
-
-    // now, at this point:
-    //   group is the group we are adding to, it already has a .group property filled out.
-    //   focus points at the group.group
-    do {
-      // run until we find the end of the sequence
-      while (ops.contains(focus.getOperation()))
-        focus = focus.getOpNext();
-      if (focus.getOperation() != null) {
-        group.setOperation(focus.getOperation());
-        group.setOpNext(focus.getOpNext());
-        focus.setOperation(null);
-        focus.setOpNext(null);
-        // now look for another sequence, and start it
-        ExpressionNode node = group;
-        focus = group.getOpNext();
-        if (focus != null) { 
-          while (focus != null && !ops.contains(focus.getOperation())) {
-            node = focus;
-            focus = focus.getOpNext();
-          }
-          if (focus != null) { // && (focus.Operation in Ops) - must be true 
-            group = newGroup(lexer, focus);
-            node.setOpNext(group);
-          }
-        }
-      }
-    }
-    while (focus != null && focus.getOperation() != null);
-    return start;
-  }
-
-
-  private ExpressionNode newGroup(FHIRLexer lexer, ExpressionNode next) {
-    ExpressionNode result = new ExpressionNode(lexer.nextId());
-    result.setKind(Kind.Group);
-    result.setGroup(next);
-    result.getGroup().setProximal(true);
-    return result;
-  }
-
-  private void checkConstant(String s, FHIRLexer lexer) throws FHIRLexerException {
-    if (s.startsWith("\'") && s.endsWith("\'")) {
-      int i = 1;
-      while (i < s.length()-1) {
-        char ch = s.charAt(i);
-        if (ch == '\\') {
-          switch (ch) {
-          case 't': 
-          case 'r':
-          case 'n': 
-          case 'f': 
-          case '\'':
-          case '\\': 
-          case '/': 
-            i++; 
-            break;
-          case 'u':
-            if (!Utilities.isHex("0x"+s.substring(i, i+4)))
-              throw lexer.error("Improper unicode escape \\u"+s.substring(i, i+4));
-            break;
-          default:
-            throw lexer.error("Unknown character escape \\"+ch);
-          }
-        } else
-          i++;
-      }
-    }
-  }
-
-  //  procedure CheckParamCount(c : integer);
-  //  begin
-  //    if exp.Parameters.Count <> c then
-  //      raise lexer.error('The function "'+exp.name+'" requires '+inttostr(c)+' parameters', offset);
-  //  end;
-
-  private boolean checkParamCount(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, int count) throws FHIRLexerException {
-    if (exp.getParameters().size() != count)
-      throw lexer.error("The function \""+exp.getName()+"\" requires "+Integer.toString(count)+" parameters", location.toString());
-    return true;
-  }
-
-  private boolean checkParamCount(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, int countMin, int countMax) throws FHIRLexerException {
-    if (exp.getParameters().size() < countMin || exp.getParameters().size() > countMax)
-      throw lexer.error("The function \""+exp.getName()+"\" requires between "+Integer.toString(countMin)+" and "+Integer.toString(countMax)+" parameters", location.toString());
-    return true;
-  }
-
-  private boolean checkParameters(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, FunctionDetails details) throws FHIRLexerException {
-    switch (exp.getFunction()) {
-    case Empty: return checkParamCount(lexer, location, exp, 0);
-    case Not: return checkParamCount(lexer, location, exp, 0);
-    case Exists: return checkParamCount(lexer, location, exp, 0);
-    case SubsetOf: return checkParamCount(lexer, location, exp, 1);
-    case SupersetOf: return checkParamCount(lexer, location, exp, 1);
-    case IsDistinct: return checkParamCount(lexer, location, exp, 0);
-    case Distinct: return checkParamCount(lexer, location, exp, 0);
-    case Count: return checkParamCount(lexer, location, exp, 0);
-    case Where: return checkParamCount(lexer, location, exp, 1);
-    case Select: return checkParamCount(lexer, location, exp, 1);
-    case All: return checkParamCount(lexer, location, exp, 0, 1);
-    case Repeat: return checkParamCount(lexer, location, exp, 1);
-    case Item: return checkParamCount(lexer, location, exp, 1);
-    case As: return checkParamCount(lexer, location, exp, 1);
-    case Is: return checkParamCount(lexer, location, exp, 1);
-    case Single: return checkParamCount(lexer, location, exp, 0);
-    case First: return checkParamCount(lexer, location, exp, 0);
-    case Last: return checkParamCount(lexer, location, exp, 0);
-    case Tail: return checkParamCount(lexer, location, exp, 0);
-    case Skip: return checkParamCount(lexer, location, exp, 1);
-    case Take: return checkParamCount(lexer, location, exp, 1);
-    case Iif: return checkParamCount(lexer, location, exp, 2,3);
-    case ToInteger: return checkParamCount(lexer, location, exp, 0);
-    case ToDecimal: return checkParamCount(lexer, location, exp, 0);
-    case ToString: return checkParamCount(lexer, location, exp, 0);
-    case Substring: return checkParamCount(lexer, location, exp, 1, 2);
-    case StartsWith: return checkParamCount(lexer, location, exp, 1);
-    case EndsWith: return checkParamCount(lexer, location, exp, 1);
-    case Matches: return checkParamCount(lexer, location, exp, 1);
-    case ReplaceMatches: return checkParamCount(lexer, location, exp, 2);
-    case Contains: return checkParamCount(lexer, location, exp, 1);
-    case Replace: return checkParamCount(lexer, location, exp, 2);
-    case Length: return checkParamCount(lexer, location, exp, 0);
-    case Children: return checkParamCount(lexer, location, exp, 0);
-    case Descendants: return checkParamCount(lexer, location, exp, 0);
-    case MemberOf: return checkParamCount(lexer, location, exp, 1);
-    case Trace: return checkParamCount(lexer, location, exp, 1);
-    case Today: return checkParamCount(lexer, location, exp, 0);
-    case Now: return checkParamCount(lexer, location, exp, 0);
-    case Resolve: return checkParamCount(lexer, location, exp, 0);
-    case Extension: return checkParamCount(lexer, location, exp, 1);
-    case HasValue: return checkParamCount(lexer, location, exp, 0);
-    case Alias: return checkParamCount(lexer, location, exp, 1);
-    case AliasAs: return checkParamCount(lexer, location, exp, 1);
-    case Custom: return checkParamCount(lexer, location, exp, details.getMinParameters(), details.getMaxParameters());
-    }
-    return false;
-  }
-
-	private List execute(ExecutionContext context, List focus, ExpressionNode exp, boolean atEntry) throws FHIRException {
-//    System.out.println("Evaluate {'"+exp.toString()+"'} on "+focus.toString());
-    List work = new ArrayList();
-    switch (exp.getKind()) {
-    case Name:
-      if (atEntry && exp.getName().equals("$this"))
-        work.add(context.getThisItem());
-      else
-        for (Base item : focus) {
-          List outcome = execute(context, item, exp, atEntry);
-          for (Base base : outcome)
-            if (base != null)
-              work.add(base);
-        }        		
-      break;
-    case Function:
-      List work2 = evaluateFunction(context, focus, exp);
-      work.addAll(work2);
-      break;
-    case Constant:
-      Base b = processConstant(context, exp.getConstant());
-      if (b != null)
-        work.add(b);
-      break;
-    case Group:
-      work2 = execute(context, focus, exp.getGroup(), atEntry);
-      work.addAll(work2);
-    }
-
-    if (exp.getInner() != null)
-      work = execute(context, work, exp.getInner(), false);
-
-    if (exp.isProximal() && exp.getOperation() != null) {
-      ExpressionNode next = exp.getOpNext();
-      ExpressionNode last = exp;
-      while (next != null) {
-        List work2 = preOperate(work, last.getOperation());
-        if (work2 != null)
-          work = work2;
-        else if (last.getOperation() == Operation.Is || last.getOperation() == Operation.As) {
-          work2 = executeTypeName(context, focus, next, false);
-          work = operate(work, last.getOperation(), work2);
-        } else {
-          work2 = execute(context, focus, next, true);
-          work = operate(work, last.getOperation(), work2);
-//          System.out.println("Result of {'"+last.toString()+" "+last.getOperation().toCode()+" "+next.toString()+"'}: "+focus.toString());
-        }
-        last = next;
-        next = next.getOpNext();
-      }
-    }
-//    System.out.println("Result of {'"+exp.toString()+"'}: "+work.toString());
-    return work;
-  }
-
-  private List executeTypeName(ExecutionContext context, List focus, ExpressionNode next, boolean atEntry) {
-    List result = new ArrayList();
-    result.add(new StringType(next.getName()));
-    return result;
-  }
-
-
-  private List preOperate(List left, Operation operation) {
-    switch (operation) {
-    case And:
-      return isBoolean(left, false) ? makeBoolean(false) : null;
-    case Or:
-      return isBoolean(left, true) ? makeBoolean(true) : null;
-    case Implies:
-      return convertToBoolean(left) ? null : makeBoolean(true);
-    default: 
-      return null;
-    }
-  }
-
-  private List makeBoolean(boolean b) {
-    List res = new ArrayList();
-    res.add(new BooleanType(b));
-    return res;
-  }
-
-  private TypeDetails executeTypeName(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException {
-    return new TypeDetails(CollectionStatus.SINGLETON, exp.getName());
-  }
-
-  private TypeDetails executeType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException {
-    TypeDetails result = new TypeDetails(null);
-    switch (exp.getKind()) {
-    case Name:
-      if (atEntry && exp.getName().equals("$this"))
-        result.update(context.getThisItem());
-      else if (atEntry && focus == null)
-        result.update(executeContextType(context, exp.getName()));
-      else {
-        for (String s : focus.getTypes()) {
-          result.update(executeType(s, exp, atEntry));
-        }
-        if (result.hasNoTypes()) 
-          throw new PathEngineException("The name "+exp.getName()+" is not valid for any of the possible types: "+focus.describe());
-      }
-      break;
-    case Function:
-      result.update(evaluateFunctionType(context, focus, exp));
-      break;
-    case Constant:
-      result.update(readConstantType(context, exp.getConstant()));
-      break;
-    case Group:
-      result.update(executeType(context, focus, exp.getGroup(), atEntry));
-    }
-    exp.setTypes(result);
-
-    if (exp.getInner() != null) {
-      result = executeType(context, result, exp.getInner(), false);
-    }
-
-    if (exp.isProximal() && exp.getOperation() != null) {
-      ExpressionNode next = exp.getOpNext();
-      ExpressionNode last = exp;
-      while (next != null) {
-        TypeDetails work;
-        if (last.getOperation() == Operation.Is || last.getOperation() == Operation.As)
-          work = executeTypeName(context, focus, next, atEntry);
-        else
-          work = executeType(context, focus, next, atEntry);
-        result = operateTypes(result, last.getOperation(), work);
-        last = next;
-        next = next.getOpNext();
-      }
-      exp.setOpTypes(result);
-    }
-    return result;
-  }
-
-  private Base processConstant(ExecutionContext context, String constant) throws PathEngineException {
-    if (constant.equals("true")) {
-      return new BooleanType(true);
-    } else if (constant.equals("false")) {
-      return new BooleanType(false);
-    } else if (constant.equals("{}")) {
-      return null;
-    } else if (Utilities.isInteger(constant)) {
-      return new IntegerType(constant);
-    } else if (Utilities.isDecimal(constant)) {
-      return new DecimalType(constant);
-    } else if (constant.startsWith("\'")) {
-      return new StringType(processConstantString(constant));
-    } else if (constant.startsWith("%")) {
-      return resolveConstant(context, constant);
-    } else if (constant.startsWith("@")) {
-      return processDateConstant(context.appInfo, constant.substring(1));
-    } else {
-      return new StringType(constant);
-    }
-  }
-
-  private Base processDateConstant(Object appInfo, String value) throws PathEngineException {
-    if (value.startsWith("T"))
-      return new TimeType(value.substring(1));
-    String v = value;
-    if (v.length() > 10) {
-      int i = v.substring(10).indexOf("-");
-      if (i == -1)
-        i = v.substring(10).indexOf("+");
-      if (i == -1)
-        i = v.substring(10).indexOf("Z");
-      v = i == -1 ? value : v.substring(0,  10+i);
-    }
-    if (v.length() > 10)
-      return new DateTimeType(value);
-    else 
-      return new DateType(value);
-  }
-
-
-  private Base resolveConstant(ExecutionContext context, String s) throws PathEngineException {
-    if (s.equals("%sct"))
-      return new StringType("http://snomed.info/sct");
-    else if (s.equals("%loinc"))
-      return new StringType("http://loinc.org");
-    else if (s.equals("%ucum"))
-      return new StringType("http://unitsofmeasure.org");
-    else if (s.equals("%resource")) {
-      if (context.resource == null)
-        throw new PathEngineException("Cannot use %resource in this context");
-      return context.resource;
-    } else if (s.equals("%context")) {
-      return context.context;
-    } else if (s.equals("%us-zip"))
-      return new StringType("[0-9]{5}(-[0-9]{4}){0,1}");
-    else if (s.startsWith("%\"vs-"))
-      return new StringType("http://hl7.org/fhir/ValueSet/"+s.substring(5, s.length()-1)+"");
-    else if (s.startsWith("%\"cs-"))
-      return new StringType("http://hl7.org/fhir/"+s.substring(5, s.length()-1)+"");
-    else if (s.startsWith("%\"ext-"))
-      return new StringType("http://hl7.org/fhir/StructureDefinition/"+s.substring(6, s.length()-1));
-    else if (hostServices == null)
-      throw new PathEngineException("Unknown fixed constant '"+s+"'");
-    else
-      return hostServices.resolveConstant(context.appInfo, s.substring(1));
-  }
-
-
-  private String processConstantString(String s) throws PathEngineException {
-    StringBuilder b = new StringBuilder();
-    int i = 1;
-    while (i < s.length()-1) {
-      char ch = s.charAt(i);
-      if (ch == '\\') {
-        i++;
-        switch (s.charAt(i)) {
-        case 't': 
-          b.append('\t');
-          break;
-        case 'r':
-          b.append('\r');
-          break;
-        case 'n': 
-          b.append('\n');
-          break;
-        case 'f': 
-          b.append('\f');
-          break;
-        case '\'':
-          b.append('\'');
-          break;
-        case '\\': 
-          b.append('\\');
-          break;
-        case '/': 
-          b.append('/');
-          break;
-        case 'u':
-          i++;
-          int uc = Integer.parseInt(s.substring(i, i+4), 16);
-          b.append((char) uc);
-          i = i + 3;
-          break;
-        default:
-          throw new PathEngineException("Unknown character escape \\"+s.charAt(i));
-        }
-        i++;
-      } else {
-        b.append(ch);
-        i++;
-      }
-    }
-    return b.toString();
-  }
-
-
-  private List operate(List left, Operation operation, List right) throws FHIRException {
-    switch (operation) {
-    case Equals: return opEquals(left, right);
-    case Equivalent: return opEquivalent(left, right);
-    case NotEquals: return opNotEquals(left, right);
-    case NotEquivalent: return opNotEquivalent(left, right);
-    case LessThen: return opLessThen(left, right);
-    case Greater: return opGreater(left, right);
-    case LessOrEqual: return opLessOrEqual(left, right);
-    case GreaterOrEqual: return opGreaterOrEqual(left, right);
-    case Union: return opUnion(left, right);
-    case In: return opIn(left, right);
-    case Contains: return opContains(left, right);
-    case Or:  return opOr(left, right);
-    case And:  return opAnd(left, right);
-    case Xor: return opXor(left, right);
-    case Implies: return opImplies(left, right);
-    case Plus: return opPlus(left, right);
-    case Times: return opTimes(left, right);
-    case Minus: return opMinus(left, right);
-    case Concatenate: return opConcatenate(left, right);
-    case DivideBy: return opDivideBy(left, right);
-    case Div: return opDiv(left, right);
-    case Mod: return opMod(left, right);
-    case Is: return opIs(left, right);
-    case As: return opAs(left, right);
-    default: 
-      throw new Error("Not Done Yet: "+operation.toCode());
-    }
-  }
-
-  private List opAs(List left, List right) {
-    List result = new ArrayList();
-    if (left.size() != 1 || right.size() != 1)
-      return result;
-    else {
-      String tn = convertToString(right);
-      if (tn.equals(left.get(0).fhirType()))
-        result.add(left.get(0));
-    }
-    return result;
-  }
-
-
-  private List opIs(List left, List right) {
-    List result = new ArrayList();
-    if (left.size() != 1 || right.size() != 1) 
-      result.add(new BooleanType(false));
-    else {
-      String tn = convertToString(right);
-      result.add(new BooleanType(left.get(0).hasType(tn)));
-    }
-    return result;
-  }
-
-
-  private TypeDetails operateTypes(TypeDetails left, Operation operation, TypeDetails right) {
-    switch (operation) {
-    case Equals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Equivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case NotEquals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case NotEquivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case LessThen: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Greater: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case LessOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case GreaterOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Is: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case As: return new TypeDetails(CollectionStatus.SINGLETON, right.getTypes());
-    case Union: return left.union(right);
-    case Or: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case And: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Xor: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Implies : return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Times: 
-      TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON);
-      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
-        result.addType("integer");
-      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
-        result.addType("decimal");
-      return result;
-    case DivideBy: 
-      result = new TypeDetails(CollectionStatus.SINGLETON);
-      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
-        result.addType("decimal");
-      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
-        result.addType("decimal");
-      return result;
-    case Concatenate:
-      result = new TypeDetails(CollectionStatus.SINGLETON, "");
-    case Plus:
-      result = new TypeDetails(CollectionStatus.SINGLETON);
-      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
-        result.addType("integer");
-      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
-        result.addType("decimal");
-      else if (left.hasType(worker, "string", "id", "code", "uri") && right.hasType(worker, "string", "id", "code", "uri"))
-        result.addType("string");
-      return result;
-    case Minus:
-      result = new TypeDetails(CollectionStatus.SINGLETON);
-      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
-        result.addType("integer");
-      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
-        result.addType("decimal");
-      return result;
-    case Div: 
-    case Mod: 
-      result = new TypeDetails(CollectionStatus.SINGLETON);
-      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
-        result.addType("integer");
-      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
-        result.addType("decimal");
-      return result;
-    case In: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Contains: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    default: 
-      return null;
-    }
-  }
-
-
-  private List opEquals(List left, List right) {
-    if (left.size() != right.size())
-      return makeBoolean(false);
-
-    boolean res = true;
-    for (int i = 0; i < left.size(); i++) {
-      if (!doEquals(left.get(i), right.get(i))) { 
-        res = false;
-        break;
-      }
-    }
-    return makeBoolean(res);
-  }
-
-  private List opNotEquals(List left, List right) {
-    if (left.size() != right.size())
-      return makeBoolean(true);
-
-    boolean res = true;
-    for (int i = 0; i < left.size(); i++) {
-      if (!doEquals(left.get(i), right.get(i))) { 
-        res = false;
-        break;
-      }
-    }
-    return makeBoolean(!res);
-  }
-
-  private boolean doEquals(Base left, Base right) {
-    if (left.isPrimitive() && right.isPrimitive())
-			return Base.equals(left.primitiveValue(), right.primitiveValue());
-    else
-      return Base.compareDeep(left, right, false);
-  }
-
-  private boolean doEquivalent(Base left, Base right) throws PathEngineException {
-    if (left.hasType("integer") && right.hasType("integer"))
-      return doEquals(left, right);
-    if (left.hasType("boolean") && right.hasType("boolean"))
-      return doEquals(left, right);
-    if (left.hasType("integer", "decimal", "unsignedInt", "positiveInt") && right.hasType("integer", "decimal", "unsignedInt", "positiveInt"))
-      return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue());
-    if (left.hasType("date", "dateTime", "time", "instant") && right.hasType("date", "dateTime", "time", "instant"))
-      return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue());
-    if (left.hasType("string", "id", "code", "uri") && right.hasType("string", "id", "code", "uri"))
-      return Utilities.equivalent(convertToString(left), convertToString(right));
-
-    throw new PathEngineException(String.format("Unable to determine equivalence between %s and %s", left.fhirType(), right.fhirType()));
-  }
-
-  private List opEquivalent(List left, List right) throws PathEngineException {
-    if (left.size() != right.size())
-      return makeBoolean(false);
-
-    boolean res = true;
-    for (int i = 0; i < left.size(); i++) {
-      boolean found = false;
-      for (int j = 0; j < right.size(); j++) {
-        if (doEquivalent(left.get(i), right.get(j))) {
-          found = true;
-          break;
-        }
-      }
-      if (!found) {
-        res = false;
-        break;
-      }
-    }
-    return makeBoolean(res);
-  }
-
-  private List opNotEquivalent(List left, List right) throws PathEngineException {
-    if (left.size() != right.size())
-      return makeBoolean(true);
-
-    boolean res = true;
-    for (int i = 0; i < left.size(); i++) {
-      boolean found = false;
-      for (int j = 0; j < right.size(); j++) {
-        if (doEquivalent(left.get(i), right.get(j))) {
-          found = true;
-          break;
-        }
-      }
-      if (!found) {
-        res = false;
-        break;
-      }
-    }
-    return makeBoolean(!res);
-  }
-
-	private List opLessThen(List left, List right) throws FHIRException {
-    if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
-      Base l = left.get(0);
-      Base r = right.get(0);
-      if (l.hasType("string") && r.hasType("string")) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0);
-      else if ((l.hasType("integer") || l.hasType("decimal")) && (r.hasType("integer") || r.hasType("decimal"))) 
-        return makeBoolean(new Double(l.primitiveValue()) < new Double(r.primitiveValue()));
-      else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0);
-      else if ((l.hasType("time")) && (r.hasType("time"))) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0);
-    } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) {
-      List lUnit = left.get(0).listChildrenByName("unit");
-      List rUnit = right.get(0).listChildrenByName("unit");
-      if (Base.compareDeep(lUnit, rUnit, true)) {
-        return opLessThen(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
-      } else {
-				throw new InternalErrorException("Canonical Comparison isn't done yet");
-      }
-    }
-    return new ArrayList();
-  }
-
-	private List opGreater(List left, List right) throws FHIRException {
-    if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
-      Base l = left.get(0);
-      Base r = right.get(0);
-      if (l.hasType("string") && r.hasType("string")) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0);
-      else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) 
-        return makeBoolean(new Double(l.primitiveValue()) > new Double(r.primitiveValue()));
-      else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0);
-      else if ((l.hasType("time")) && (r.hasType("time"))) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0);
-    } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) {
-      List lUnit = left.get(0).listChildrenByName("unit");
-      List rUnit = right.get(0).listChildrenByName("unit");
-      if (Base.compareDeep(lUnit, rUnit, true)) {
-        return opGreater(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
-      } else {
-				throw new InternalErrorException("Canonical Comparison isn't done yet");
-      }
-    }
-    return new ArrayList();
-  }
-
-	private List opLessOrEqual(List left, List right) throws FHIRException {
-    if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
-      Base l = left.get(0);
-      Base r = right.get(0);
-      if (l.hasType("string") && r.hasType("string")) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0);
-      else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) 
-        return makeBoolean(new Double(l.primitiveValue()) <= new Double(r.primitiveValue()));
-      else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0);
-      else if ((l.hasType("time")) && (r.hasType("time"))) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0);
-    } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) {
-      List lUnits = left.get(0).listChildrenByName("unit");
-      String lunit = lUnits.size() == 1 ? lUnits.get(0).primitiveValue() : null;
-      List rUnits = right.get(0).listChildrenByName("unit");
-      String runit = rUnits.size() == 1 ? rUnits.get(0).primitiveValue() : null;
-      if ((lunit == null && runit == null) || lunit.equals(runit)) {
-        return opLessOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
-      } else {
-				throw new InternalErrorException("Canonical Comparison isn't done yet");
-      }
-    }
-    return new ArrayList();
-  }
-
-	private List opGreaterOrEqual(List left, List right) throws FHIRException {
-    if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
-      Base l = left.get(0);
-      Base r = right.get(0);
-      if (l.hasType("string") && r.hasType("string")) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0);
-      else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) 
-        return makeBoolean(new Double(l.primitiveValue()) >= new Double(r.primitiveValue()));
-      else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0);
-      else if ((l.hasType("time")) && (r.hasType("time"))) 
-        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0);
-    } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) {
-      List lUnit = left.get(0).listChildrenByName("unit");
-      List rUnit = right.get(0).listChildrenByName("unit");
-      if (Base.compareDeep(lUnit, rUnit, true)) {
-        return opGreaterOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
-      } else {
-				throw new InternalErrorException("Canonical Comparison isn't done yet");
-      }
-    }
-    return new ArrayList();
-  }
-
-  private List opIn(List left, List right) {
-    boolean ans = true;
-    for (Base l : left) {
-      boolean f = false;
-      for (Base r : right)
-        if (doEquals(l, r)) {
-          f = true;
-          break;
-        }
-      if (!f) {
-        ans = false;
-        break;
-      }
-    }
-    return makeBoolean(ans);
-  }
-
-  private List opContains(List left, List right) {
-    boolean ans = true;
-    for (Base r : right) {
-      boolean f = false;
-      for (Base l : left)
-        if (doEquals(l, r)) {
-          f = true;
-          break;
-        }
-      if (!f) {
-        ans = false;
-        break;
-      }
-    }
-    return makeBoolean(ans);
-  }
-
-  private List opPlus(List left, List right) throws PathEngineException {
-    if (left.size() == 0)
-      throw new PathEngineException("Error performing +: left operand has no value");
-    if (left.size() > 1)
-      throw new PathEngineException("Error performing +: left operand has more than one value");
-    if (!left.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType()));
-    if (right.size() == 0)
-      throw new PathEngineException("Error performing +: right operand has no value");
-    if (right.size() > 1)
-      throw new PathEngineException("Error performing +: right operand has more than one value");
-    if (!right.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing +: right operand has the wrong type (%s)", right.get(0).fhirType()));
-
-    List result = new ArrayList();
-    Base l = left.get(0);
-    Base r = right.get(0);
-    if (l.hasType("string", "id", "code", "uri") && r.hasType("string", "id", "code", "uri")) 
-      result.add(new StringType(l.primitiveValue() + r.primitiveValue()));
-    else if (l.hasType("integer") && r.hasType("integer")) 
-      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue())));
-    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) 
-      result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue()))));
-    else
-      throw new PathEngineException(String.format("Error performing +: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
-    return result;
-  }
-
-  private List opTimes(List left, List right) throws PathEngineException {
-    if (left.size() == 0)
-      throw new PathEngineException("Error performing *: left operand has no value");
-    if (left.size() > 1)
-      throw new PathEngineException("Error performing *: left operand has more than one value");
-    if (!left.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType()));
-    if (right.size() == 0)
-      throw new PathEngineException("Error performing *: right operand has no value");
-    if (right.size() > 1)
-      throw new PathEngineException("Error performing *: right operand has more than one value");
-    if (!right.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing *: right operand has the wrong type (%s)", right.get(0).fhirType()));
-
-    List result = new ArrayList();
-    Base l = left.get(0);
-    Base r = right.get(0);
-
-    if (l.hasType("integer") && r.hasType("integer")) 
-      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) * Integer.parseInt(r.primitiveValue())));
-    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) 
-      result.add(new DecimalType(new BigDecimal(l.primitiveValue()).multiply(new BigDecimal(r.primitiveValue()))));
-    else
-      throw new PathEngineException(String.format("Error performing *: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
-    return result;
-  }
-
-  private List opConcatenate(List left, List right) {
-    List result = new ArrayList();
-    result.add(new StringType(convertToString(left) + convertToString((right))));
-    return result;
-  }
-
-  private List opUnion(List left, List right) {
-    List result = new ArrayList();
-    for (Base item : left) {
-      if (!doContains(result, item))
-        result.add(item);
-    }
-    for (Base item : right) {
-      if (!doContains(result, item))
-        result.add(item);
-    }
-    return result;
-  }
-
-  private boolean doContains(List list, Base item) {
-    for (Base test : list)
-      if (doEquals(test, item))
-        return true;
-    return false;
-  }
-
-
-  private List opAnd(List left, List right) {
-    if (left.isEmpty() && right.isEmpty())
-      return new ArrayList();
-    else if (isBoolean(left, false) || isBoolean(right, false))
-      return makeBoolean(false);
-    else if (left.isEmpty() || right.isEmpty())
-      return new ArrayList();
-    else if (convertToBoolean(left) && convertToBoolean(right))
-      return makeBoolean(true);
-    else 
-      return makeBoolean(false);
-  }
-
-  private boolean isBoolean(List list, boolean b) {
-    return list.size() == 1 && list.get(0) instanceof BooleanType && ((BooleanType) list.get(0)).booleanValue() == b;
-  }
-
-  private List opOr(List left, List right) {
-    if (left.isEmpty() && right.isEmpty())
-      return new ArrayList();
-    else if (convertToBoolean(left) || convertToBoolean(right))
-      return makeBoolean(true);
-    else if (left.isEmpty() || right.isEmpty())
-      return new ArrayList();
-    else 
-      return makeBoolean(false);
-  }
-
-  private List opXor(List left, List right) {
-    if (left.isEmpty() || right.isEmpty())
-      return new ArrayList();
-    else 
-      return makeBoolean(convertToBoolean(left) ^ convertToBoolean(right));
-  }
-
-  private List opImplies(List left, List right) {
-    if (!convertToBoolean(left)) 
-      return makeBoolean(true);
-    else if (right.size() == 0)
-      return new ArrayList();      
-    else
-      return makeBoolean(convertToBoolean(right));
-  }
-
-
-  private List opMinus(List left, List right) throws PathEngineException {
-    if (left.size() == 0)
-      throw new PathEngineException("Error performing -: left operand has no value");
-    if (left.size() > 1)
-      throw new PathEngineException("Error performing -: left operand has more than one value");
-    if (!left.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType()));
-    if (right.size() == 0)
-      throw new PathEngineException("Error performing -: right operand has no value");
-    if (right.size() > 1)
-      throw new PathEngineException("Error performing -: right operand has more than one value");
-    if (!right.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing -: right operand has the wrong type (%s)", right.get(0).fhirType()));
-
-    List result = new ArrayList();
-    Base l = left.get(0);
-    Base r = right.get(0);
-
-    if (l.hasType("integer") && r.hasType("integer")) 
-      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) - Integer.parseInt(r.primitiveValue())));
-    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) 
-      result.add(new DecimalType(new BigDecimal(l.primitiveValue()).subtract(new BigDecimal(r.primitiveValue()))));
-    else
-      throw new PathEngineException(String.format("Error performing -: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
-    return result;
-  }
-
-  private List opDivideBy(List left, List right) throws PathEngineException {
-    if (left.size() == 0)
-      throw new PathEngineException("Error performing /: left operand has no value");
-    if (left.size() > 1)
-      throw new PathEngineException("Error performing /: left operand has more than one value");
-    if (!left.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType()));
-    if (right.size() == 0)
-      throw new PathEngineException("Error performing /: right operand has no value");
-    if (right.size() > 1)
-      throw new PathEngineException("Error performing /: right operand has more than one value");
-    if (!right.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing /: right operand has the wrong type (%s)", right.get(0).fhirType()));
-
-    List result = new ArrayList();
-    Base l = left.get(0);
-    Base r = right.get(0);
-
-    if (l.hasType("integer", "decimal", "unsignedInt", "positiveInt") && r.hasType("integer", "decimal", "unsignedInt", "positiveInt")) {
-      Decimal d1;
-      try {
-        d1 = new Decimal(l.primitiveValue());
-        Decimal d2 = new Decimal(r.primitiveValue());
-        result.add(new DecimalType(d1.divide(d2).asDecimal()));
-      } catch (UcumException e) {
-        throw new PathEngineException(e);
-      }
-    }
-    else
-      throw new PathEngineException(String.format("Error performing /: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
-    return result;
-  }
-
-  private List opDiv(List left, List right) throws PathEngineException {
-    if (left.size() == 0)
-      throw new PathEngineException("Error performing div: left operand has no value");
-    if (left.size() > 1)
-      throw new PathEngineException("Error performing div: left operand has more than one value");
-    if (!left.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing div: left operand has the wrong type (%s)", left.get(0).fhirType()));
-    if (right.size() == 0)
-      throw new PathEngineException("Error performing div: right operand has no value");
-    if (right.size() > 1)
-      throw new PathEngineException("Error performing div: right operand has more than one value");
-    if (!right.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing div: right operand has the wrong type (%s)", right.get(0).fhirType()));
-
-    List result = new ArrayList();
-    Base l = left.get(0);
-    Base r = right.get(0);
-
-    if (l.hasType("integer") && r.hasType("integer")) 
-      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) / Integer.parseInt(r.primitiveValue())));
-    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { 
-      Decimal d1;
-      try {
-        d1 = new Decimal(l.primitiveValue());
-        Decimal d2 = new Decimal(r.primitiveValue());
-        result.add(new IntegerType(d1.divInt(d2).asDecimal()));
-      } catch (UcumException e) {
-        throw new PathEngineException(e);
-      }
-    }
-    else
-      throw new PathEngineException(String.format("Error performing div: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
-    return result;
-  }
-
-  private List opMod(List left, List right) throws PathEngineException {
-    if (left.size() == 0)
-      throw new PathEngineException("Error performing mod: left operand has no value");
-    if (left.size() > 1)
-      throw new PathEngineException("Error performing mod: left operand has more than one value");
-    if (!left.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing mod: left operand has the wrong type (%s)", left.get(0).fhirType()));
-    if (right.size() == 0)
-      throw new PathEngineException("Error performing mod: right operand has no value");
-    if (right.size() > 1)
-      throw new PathEngineException("Error performing mod: right operand has more than one value");
-    if (!right.get(0).isPrimitive())
-      throw new PathEngineException(String.format("Error performing mod: right operand has the wrong type (%s)", right.get(0).fhirType()));
-
-    List result = new ArrayList();
-    Base l = left.get(0);
-    Base r = right.get(0);
-
-    if (l.hasType("integer") && r.hasType("integer")) 
-      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) % Integer.parseInt(r.primitiveValue())));
-    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) {
-      Decimal d1;
-      try {
-        d1 = new Decimal(l.primitiveValue());
-        Decimal d2 = new Decimal(r.primitiveValue());
-        result.add(new DecimalType(d1.modulo(d2).asDecimal()));
-      } catch (UcumException e) {
-        throw new PathEngineException(e);
-      }
-    }
-    else
-      throw new PathEngineException(String.format("Error performing mod: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
-    return result;
-  }
-
-
-  private TypeDetails readConstantType(ExecutionTypeContext context, String constant) throws PathEngineException {
-    if (constant.equals("true")) 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    else if (constant.equals("false")) 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    else if (Utilities.isInteger(constant))
-      return new TypeDetails(CollectionStatus.SINGLETON, "integer");
-    else if (Utilities.isDecimal(constant))
-      return new TypeDetails(CollectionStatus.SINGLETON, "decimal");
-    else if (constant.startsWith("%"))
-      return resolveConstantType(context, constant);
-    else
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-  }
-
-  private TypeDetails resolveConstantType(ExecutionTypeContext context, String s) throws PathEngineException {
-    if (s.equals("%sct"))
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    else if (s.equals("%loinc"))
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    else if (s.equals("%ucum"))
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    else if (s.equals("%resource")) {
-      if (context.resource == null)
-        throw new PathEngineException("%resource cannot be used in this context");
-      return new TypeDetails(CollectionStatus.SINGLETON, context.resource);
-    } else if (s.equals("%context")) {
-      return new TypeDetails(CollectionStatus.SINGLETON, context.context);
-    } else if (s.equals("%map-codes"))
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    else if (s.equals("%us-zip"))
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    else if (s.startsWith("%\"vs-"))
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    else if (s.startsWith("%\"cs-"))
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    else if (s.startsWith("%\"ext-"))
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    else if (hostServices == null)
-      throw new PathEngineException("Unknown fixed constant type for '"+s+"'");
-    else
-      return hostServices.resolveConstantType(context.appInfo, s);
-  }
-
-	private List execute(ExecutionContext context, Base item, ExpressionNode exp, boolean atEntry) throws FHIRException {
-    List result = new ArrayList(); 
-    if (atEntry && Character.isUpperCase(exp.getName().charAt(0))) {// special case for start up
-      if (item.isResource() && item.fhirType().equals(exp.getName()))  
-        result.add(item);
-    } else 
-      getChildrenByName(item, exp.getName(), result);
-    if (result.size() == 0 && atEntry && context.appInfo != null) {
-      Base temp = hostServices.resolveConstant(context.appInfo, exp.getName());
-      if (temp != null) {
-        result.add(temp);
-      }
-    }
-    return result;
-  }	
-
-  private TypeDetails executeContextType(ExecutionTypeContext context, String name) throws PathEngineException, DefinitionException {
-    if (hostServices == null)
-      throw new PathEngineException("Unable to resolve context reference since no host services are provided");
-    return hostServices.resolveConstantType(context.appInfo, name);
-  }
-  
-  private TypeDetails executeType(String type, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException {
-    if (atEntry && Character.isUpperCase(exp.getName().charAt(0)) && tail(type).equals(exp.getName())) // special case for start up
-      return new TypeDetails(CollectionStatus.SINGLETON, type);
-    TypeDetails result = new TypeDetails(null);
-    getChildTypesByName(type, exp.getName(), result);
-    return result;
-  }
-
-
-  private String tail(String type) {
-    return type.contains("#") ? "" : type.substring(type.lastIndexOf("/")+1);
-  }
-
-
-  @SuppressWarnings("unchecked")
-  private TypeDetails evaluateFunctionType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp) throws PathEngineException, DefinitionException {
-    List paramTypes = new ArrayList();
-    if (exp.getFunction() == Function.Is || exp.getFunction() == Function.As)
-      paramTypes.add(new TypeDetails(CollectionStatus.SINGLETON, "string"));
-    else
-      for (ExpressionNode expr : exp.getParameters()) {
-        if (exp.getFunction() == Function.Where || exp.getFunction() == Function.Select || exp.getFunction() == Function.Repeat)
-          paramTypes.add(executeType(changeThis(context, focus), focus, expr, true));
-        else
-          paramTypes.add(executeType(context, focus, expr, true));
-      }
-    switch (exp.getFunction()) {
-    case Empty : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Not : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Exists : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case SubsetOf : {
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
-    }
-    case SupersetOf : {
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
-    }
-    case IsDistinct : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Distinct : 
-      return focus;
-    case Count : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "integer");
-    case Where : 
-      return focus;
-    case Select : 
-      return anything(focus.getCollectionStatus());
-    case All : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Repeat : 
-      return anything(focus.getCollectionStatus());
-    case Item : {
-      checkOrdered(focus, "item");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); 
-      return focus; 
-    }
-    case As : {
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, exp.getParameters().get(0).getName());
-    }
-    case Is : {
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
-    }
-    case Single :
-      return focus.toSingleton();
-    case First : {
-      checkOrdered(focus, "first");
-      return focus.toSingleton();
-    }
-    case Last : {
-      checkOrdered(focus, "last");
-      return focus.toSingleton();
-    }
-    case Tail : {
-      checkOrdered(focus, "tail");
-      return focus;
-    }
-    case Skip : {
-      checkOrdered(focus, "skip");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); 
-      return focus;
-    }
-    case Take : {
-      checkOrdered(focus, "take");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); 
-      return focus;
-    }
-    case Iif : {
-      TypeDetails types = new TypeDetails(null);
-      types.update(paramTypes.get(0));
-      if (paramTypes.size() > 1)
-        types.update(paramTypes.get(1));
-      return types;
-    }
-    case ToInteger : {
-      checkContextPrimitive(focus, "toInteger");
-      return new TypeDetails(CollectionStatus.SINGLETON, "integer");
-    }
-    case ToDecimal : {
-      checkContextPrimitive(focus, "toDecimal");
-      return new TypeDetails(CollectionStatus.SINGLETON, "decimal");
-    }
-    case ToString : {
-      checkContextPrimitive(focus, "toString");
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    }
-    case Substring : {
-      checkContextString(focus, "subString");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer"), new TypeDetails(CollectionStatus.SINGLETON, "integer")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "string"); 
-    }
-    case StartsWith : {
-      checkContextString(focus, "startsWith");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
-    }
-    case EndsWith : {
-      checkContextString(focus, "endsWith");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
-    }
-    case Matches : {
-      checkContextString(focus, "matches");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
-    }
-    case ReplaceMatches : {
-      checkContextString(focus, "replaceMatches");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "string"); 
-    }
-    case Contains : {
-      checkContextString(focus, "contains");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    }
-    case Replace : {
-      checkContextString(focus, "replace");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "string");
-    }
-    case Length : { 
-      checkContextPrimitive(focus, "length");
-      return new TypeDetails(CollectionStatus.SINGLETON, "integer");
-    }
-    case Children : 
-      return childTypes(focus, "*");
-    case Descendants : 
-      return childTypes(focus, "**");
-    case MemberOf : {
-      checkContextCoded(focus, "memberOf");
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    }
-    case Trace : {
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return focus; 
-    }
-    case Today : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "date");
-    case Now : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "dateTime");
-    case Resolve : {
-      checkContextReference(focus, "resolve");
-      return new TypeDetails(CollectionStatus.SINGLETON, "DomainResource"); 
-    }
-    case Extension : {
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return new TypeDetails(CollectionStatus.SINGLETON, "Extension"); 
-    }
-    case HasValue : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
-    case Alias : 
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return anything(CollectionStatus.SINGLETON); 
-    case AliasAs : 
-      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
-      return focus; 
-    case Custom : {
-      return hostServices.checkFunction(context.appInfo, exp.getName(), paramTypes);
-    }
-    default:
-      break;
-    }
-    throw new Error("not Implemented yet");
-  }
-
-
-  private void checkParamTypes(String funcName, List paramTypes, TypeDetails... typeSet) throws PathEngineException {
-    int i = 0;
-    for (TypeDetails pt : typeSet) {
-      if (i == paramTypes.size())
-        return;
-      TypeDetails actual = paramTypes.get(i);
-      i++;
-      for (String a : actual.getTypes()) {
-        if (!pt.hasType(worker, a))
-          throw new PathEngineException("The parameter type '"+a+"' is not legal for "+funcName+" parameter "+Integer.toString(i)+". expecting "+pt.toString()); 
-      }
-    }
-  }
-
-  private void checkOrdered(TypeDetails focus, String name) throws PathEngineException {
-    if (focus.getCollectionStatus() == CollectionStatus.UNORDERED)
-      throw new PathEngineException("The function '"+name+"'() can only be used on ordered collections"); 
-  }
-
-  private void checkContextReference(TypeDetails focus, String name) throws PathEngineException {
-    if (!focus.hasType(worker, "string") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Reference"))
-      throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, Reference"); 
-  }
-
-
-  private void checkContextCoded(TypeDetails focus, String name) throws PathEngineException {
-    if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Coding") && !focus.hasType(worker, "CodeableConcept"))
-      throw new PathEngineException("The function '"+name+"'() can only be used on string, code, uri, Coding, CodeableConcept");     
-  }
-
-
-  private void checkContextString(TypeDetails focus, String name) throws PathEngineException {
-    if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "id"))
-      throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, code, id, but found "+focus.describe()); 
-  }
-
-
-  private void checkContextPrimitive(TypeDetails focus, String name) throws PathEngineException {
-    if (!focus.hasType(primitiveTypes))
-      throw new PathEngineException("The function '"+name+"'() can only be used on "+primitiveTypes.toString()); 
-  }
-
-
-  private TypeDetails childTypes(TypeDetails focus, String mask) throws PathEngineException, DefinitionException {
-    TypeDetails result = new TypeDetails(CollectionStatus.UNORDERED);
-    for (String f : focus.getTypes()) 
-      getChildTypesByName(f, mask, result);
-    return result;
-  }
-
-  private TypeDetails anything(CollectionStatus status) {
-    return new TypeDetails(status, allTypes.keySet());
-  }
-
-  //	private boolean isPrimitiveType(String s) {
-  //		return s.equals("boolean") || s.equals("integer") || s.equals("decimal") || s.equals("base64Binary") || s.equals("instant") || s.equals("string") || s.equals("uri") || s.equals("date") || s.equals("dateTime") || s.equals("time") || s.equals("code") || s.equals("oid") || s.equals("id") || s.equals("unsignedInt") || s.equals("positiveInt") || s.equals("markdown");
-  //	}
-
-	private List evaluateFunction(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    switch (exp.getFunction()) {
-    case Empty : return funcEmpty(context, focus, exp);
-    case Not : return funcNot(context, focus, exp);
-    case Exists : return funcExists(context, focus, exp);
-    case SubsetOf : return funcSubsetOf(context, focus, exp);
-    case SupersetOf : return funcSupersetOf(context, focus, exp);
-    case IsDistinct : return funcIsDistinct(context, focus, exp);
-    case Distinct : return funcDistinct(context, focus, exp);
-    case Count : return funcCount(context, focus, exp);
-    case Where : return funcWhere(context, focus, exp);
-    case Select : return funcSelect(context, focus, exp);
-    case All : return funcAll(context, focus, exp);
-    case Repeat : return funcRepeat(context, focus, exp);
-    case Item : return funcItem(context, focus, exp);
-    case As : return funcAs(context, focus, exp);
-    case Is : return funcIs(context, focus, exp);
-    case Single : return funcSingle(context, focus, exp);
-    case First : return funcFirst(context, focus, exp);
-    case Last : return funcLast(context, focus, exp);
-    case Tail : return funcTail(context, focus, exp);
-    case Skip : return funcSkip(context, focus, exp);
-    case Take : return funcTake(context, focus, exp);
-    case Iif : return funcIif(context, focus, exp);
-    case ToInteger : return funcToInteger(context, focus, exp);
-    case ToDecimal : return funcToDecimal(context, focus, exp);
-    case ToString : return funcToString(context, focus, exp);
-    case Substring : return funcSubstring(context, focus, exp);
-    case StartsWith : return funcStartsWith(context, focus, exp);
-    case EndsWith : return funcEndsWith(context, focus, exp);
-    case Matches : return funcMatches(context, focus, exp);
-    case ReplaceMatches : return funcReplaceMatches(context, focus, exp);
-    case Contains : return funcContains(context, focus, exp);
-    case Replace : return funcReplace(context, focus, exp);
-    case Length : return funcLength(context, focus, exp);
-    case Children : return funcChildren(context, focus, exp);
-    case Descendants : return funcDescendants(context, focus, exp);
-    case MemberOf : return funcMemberOf(context, focus, exp);
-    case Trace : return funcTrace(context, focus, exp);
-    case Today : return funcToday(context, focus, exp);
-    case Now : return funcNow(context, focus, exp);
-    case Resolve : return funcResolve(context, focus, exp);
-    case Extension : return funcExtension(context, focus, exp);
-    case HasValue : return funcHasValue(context, focus, exp);
-    case AliasAs : return funcAliasAs(context, focus, exp);
-    case Alias : return funcAlias(context, focus, exp);
-    case Custom: { 
-      List> params = new ArrayList>();
-      for (ExpressionNode p : exp.getParameters()) 
-        params.add(execute(context, focus, p, true));
-      return hostServices.executeFunction(context.appInfo, exp.getName(), params);
-    }
-    default:
-      throw new Error("not Implemented yet");
-    }
-  }
-
-	private List funcAliasAs(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List nl = execute(context, focus, exp.getParameters().get(0), true);
-    String name = nl.get(0).primitiveValue();
-    context.addAlias(name, focus);
-    return focus;
-  }
-
-  private List funcAlias(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List nl = execute(context, focus, exp.getParameters().get(0), true);
-    String name = nl.get(0).primitiveValue();
-    List res = new ArrayList();
-    Base b = context.getAlias(name);
-    if (b != null)
-      res.add(b);
-    return res;
-    
-  }
-
-	private List funcAll(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    if (exp.getParameters().size() == 1) {
-      List result = new ArrayList();
-      List pc = new ArrayList();
-      boolean all = true;
-      for (Base item : focus) {
-        pc.clear();
-        pc.add(item);
-        if (!convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), true))) {
-          all = false;
-          break;
-        }
-      }
-      result.add(new BooleanType(all));
-      return result;
-    } else {// (exp.getParameters().size() == 0) {
-      List result = new ArrayList();
-      boolean all = true;
-      for (Base item : focus) {
-        boolean v = false;
-        if (item instanceof BooleanType) {
-          v = ((BooleanType) item).booleanValue();
-        } else 
-          v = item != null;
-        if (!v) {
-          all = false;
-          break;
-        }
-      }
-      result.add(new BooleanType(all));
-      return result;
-    }
-  }
-
-
-  private ExecutionContext changeThis(ExecutionContext context, Base newThis) {
-    return new ExecutionContext(context.appInfo, context.resource, context.context, context.aliases, newThis);
-  }
-
-  private ExecutionTypeContext changeThis(ExecutionTypeContext context, TypeDetails newThis) {
-    return new ExecutionTypeContext(context.appInfo, context.resource, context.context, newThis);
-  }
-
-
-  private List funcNow(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    result.add(DateTimeType.now());
-    return result;
-  }
-
-
-  private List funcToday(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    result.add(new DateType(new Date(), TemporalPrecisionEnum.DAY));
-    return result;
-  }
-
-
-  private List funcMemberOf(ExecutionContext context, List focus, ExpressionNode exp) {
-    throw new Error("not Implemented yet");
-  }
-
-
-  private List funcDescendants(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    List current = new ArrayList();
-    current.addAll(focus);
-    List added = new ArrayList();
-    boolean more = true;
-    while (more) {
-      added.clear();
-      for (Base item : current) {
-        getChildrenByName(item, "*", added);
-      }
-      more = !added.isEmpty();
-      result.addAll(added);
-      current.clear();
-      current.addAll(added);
-    }
-    return result;
-  }
-
-
-  private List funcChildren(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    for (Base b : focus)
-      getChildrenByName(b, "*", result);
-    return result;
-  }
-
-
-  private List funcReplace(ExecutionContext context, List focus, ExpressionNode exp) {
-    throw new Error("not Implemented yet");
-  }
-
-
-  private List funcReplaceMatches(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
-
-    if (focus.size() == 1 && !Utilities.noString(sw))
-      result.add(new BooleanType(convertToString(focus.get(0)).contains(sw)));
-    else
-      result.add(new BooleanType(false));
-    return result;
-  }
-
-
-  private List funcEndsWith(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
-
-    if (focus.size() == 1 && !Utilities.noString(sw))
-      result.add(new BooleanType(convertToString(focus.get(0)).endsWith(sw)));
-    else
-      result.add(new BooleanType(false));
-    return result;
-  }
-
-
-  private List funcToString(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    result.add(new StringType(convertToString(focus)));
-    return result;
-  }
-
-
-  private List funcToDecimal(ExecutionContext context, List focus, ExpressionNode exp) {
-    String s = convertToString(focus);
-    List result = new ArrayList();
-    if (Utilities.isDecimal(s))
-      result.add(new DecimalType(s));
-    return result;
-  }
-
-
-  private List funcIif(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List n1 = execute(context, focus, exp.getParameters().get(0), true);
-    Boolean v = convertToBoolean(n1);
-
-    if (v)
-      return execute(context, focus, exp.getParameters().get(1), true);
-    else if (exp.getParameters().size() < 3)
-      return new ArrayList();
-    else
-      return execute(context, focus, exp.getParameters().get(2), true);
-  }
-
-
-  private List funcTake(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List n1 = execute(context, focus, exp.getParameters().get(0), true);
-    int i1 = Integer.parseInt(n1.get(0).primitiveValue());
-
-    List result = new ArrayList();
-    for (int i = 0; i < Math.min(focus.size(), i1); i++)
-      result.add(focus.get(i));
-    return result;
-  }
-
-
-  private List funcSingle(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException {
-    if (focus.size() == 1)
-      return focus;
-    throw new PathEngineException(String.format("Single() : checking for 1 item but found %d items", focus.size()));
-  }
-
-
-  private List funcIs(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException {
-    List result = new ArrayList();
-    if (focus.size() == 0 || focus.size() > 1) 
-      result.add(new BooleanType(false));
-    else {
-      String tn = exp.getParameters().get(0).getName();
-      result.add(new BooleanType(focus.get(0).hasType(tn)));
-    }
-    return result;
-  }
-
-
-  private List funcAs(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    String tn = exp.getParameters().get(0).getName();
-    for (Base b : focus)
-      if (b.hasType(tn))
-        result.add(b);
-    return result;
-  }
-
-
-  private List funcRepeat(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    List current = new ArrayList();
-    current.addAll(focus);
-    List added = new ArrayList();
-    boolean more = true;
-    while (more) {
-      added.clear();
-      List pc = new ArrayList();
-      for (Base item : current) {
-        pc.clear();
-        pc.add(item);
-        added.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), false));
-      }
-      more = !added.isEmpty();
-      result.addAll(added);
-      current.clear();
-      current.addAll(added);
-    }
-    return result;
-  }
-
-
-
-  private List funcIsDistinct(ExecutionContext context, List focus, ExpressionNode exp) {
-    if (focus.size() <= 1)
-      return makeBoolean(true);
-
-    boolean distinct = true;
-    for (int i = 0; i < focus.size(); i++) {
-      for (int j = i+1; j < focus.size(); j++) {
-        if (doEquals(focus.get(j), focus.get(i))) {
-          distinct = false;
-          break;
-        }
-      }
-    }
-    return makeBoolean(distinct);
-  }
-
-
-  private List funcSupersetOf(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List target = execute(context, focus, exp.getParameters().get(0), true);
-
-    boolean valid = true;
-    for (Base item : target) {
-      boolean found = false;
-      for (Base t : focus) {
-        if (Base.compareDeep(item, t, false)) {
-          found = true;
-          break;
-        }
-      }
-      if (!found) {
-        valid = false;
-        break;
-      }
-    }
-    List result = new ArrayList();
-    result.add(new BooleanType(valid));
-    return result;
-  }
-
-
-  private List funcSubsetOf(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List target = execute(context, focus, exp.getParameters().get(0), true);
-
-    boolean valid = true;
-    for (Base item : focus) {
-      boolean found = false;
-      for (Base t : target) {
-        if (Base.compareDeep(item, t, false)) {
-          found = true;
-          break;
-        }
-      }
-      if (!found) {
-        valid = false;
-        break;
-      }
-    }
-    List result = new ArrayList();
-    result.add(new BooleanType(valid));
-    return result;
-  }
-
-
-  private List funcExists(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    result.add(new BooleanType(!ElementUtil.isEmpty(focus)));
-    return result;
-  }
-
-
-  private List funcResolve(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    for (Base item : focus) {
-      if (hostServices != null) {
-        String s = convertToString(item);
-        if (item.fhirType().equals("Reference")) {
-          Property p = item.getChildByName("reference");
-          if (p.hasValues())
-            s = convertToString(p.getValues().get(0));
-        }
-        Base res = null;
-        if (s.startsWith("#")) {
-          String id = s.substring(1);
-          Property p = context.resource.getChildByName("contained");
-          for (Base c : p.getValues()) {
-            if (id.equals(c.getIdBase()))
-              res = c;
-          }
-        } else
-         res = hostServices.resolveReference(context.appInfo, s);
-        if (res != null)
-          result.add(res);
-      }
-    }
-    return result;
-  }
-
-	private List funcExtension(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    List nl = execute(context, focus, exp.getParameters().get(0), true);
-    String url = nl.get(0).primitiveValue();
-
-    for (Base item : focus) {
-      List ext = new ArrayList();
-      getChildrenByName(item, "extension", ext);
-      getChildrenByName(item, "modifierExtension", ext);
-      for (Base ex : ext) {
-        List vl = new ArrayList();
-        getChildrenByName(ex, "url", vl);
-        if (convertToString(vl).equals(url))
-          result.add(ex);
-      }
-    }
-    return result;
-  }
-
-	private List funcTrace(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List nl = execute(context, focus, exp.getParameters().get(0), true);
-    String name = nl.get(0).primitiveValue();
-
-    log(name, focus);
-    return focus;
-  }
-
-  private List funcDistinct(ExecutionContext context, List focus, ExpressionNode exp) {
-    if (focus.size() <= 1)
-      return focus;
-
-    List result = new ArrayList();
-    for (int i = 0; i < focus.size(); i++) {
-      boolean found = false;
-      for (int j = i+1; j < focus.size(); j++) {
-        if (doEquals(focus.get(j), focus.get(i))) {
-          found = true;
-          break;
-        }
-      }
-      if (!found)
-        result.add(focus.get(i));
-    }
-    return result;
-  }
-
-	private List funcMatches(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
-
-    if (focus.size() == 1 && !Utilities.noString(sw)) {
-      String st = convertToString(focus.get(0));
-      if (Utilities.noString(st))
-        result.add(new BooleanType(false));
-      else
-        result.add(new BooleanType(st.matches(sw)));
-    } else
-      result.add(new BooleanType(false));
-    return result;
-  }
-
-	private List funcContains(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
-
-    if (focus.size() == 1 && !Utilities.noString(sw)) {
-      String st = convertToString(focus.get(0));
-      if (Utilities.noString(st))
-        result.add(new BooleanType(false));
-      else
-        result.add(new BooleanType(st.contains(sw)));
-    }  else
-      result.add(new BooleanType(false));
-    return result;
-  }
-
-  private List funcLength(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    if (focus.size() == 1) {
-      String s = convertToString(focus.get(0));
-      result.add(new IntegerType(s.length()));
-    }
-    return result;
-  }
-
-  private List funcHasValue(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    if (focus.size() == 1) {
-      String s = convertToString(focus.get(0));
-      result.add(new BooleanType(!Utilities.noString(s)));
-    }
-    return result;
-  }
-
-	private List funcStartsWith(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
-
-    if (focus.size() == 1 && !Utilities.noString(sw))
-      result.add(new BooleanType(convertToString(focus.get(0)).startsWith(sw)));
-    else
-      result.add(new BooleanType(false));
-    return result;
-  }
-
-	private List funcSubstring(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    List n1 = execute(context, focus, exp.getParameters().get(0), true);
-    int i1 = Integer.parseInt(n1.get(0).primitiveValue());
-    int i2 = -1;
-    if (exp.parameterCount() == 2) {
-      List n2 = execute(context, focus, exp.getParameters().get(1), true);
-      i2 = Integer.parseInt(n2.get(0).primitiveValue());
-    }
-
-    if (focus.size() == 1) {
-      String sw = convertToString(focus.get(0));
-      String s;
-      if (i1 < 0 || i1 >= sw.length())
-        return new ArrayList();
-      if (exp.parameterCount() == 2)
-        s = sw.substring(i1, Math.min(sw.length(), i1+i2));
-      else
-        s = sw.substring(i1);
-      if (!Utilities.noString(s)) 
-        result.add(new StringType(s));
-    }
-    return result;
-  }
-
-  private List funcToInteger(ExecutionContext context, List focus, ExpressionNode exp) {
-    String s = convertToString(focus);
-    List result = new ArrayList();
-    if (Utilities.isInteger(s))
-      result.add(new IntegerType(s));
-    return result;
-  }
-
-  private List funcCount(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    result.add(new IntegerType(focus.size()));
-    return result;
-  }
-
-  private List funcSkip(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List n1 = execute(context, focus, exp.getParameters().get(0), true);
-    int i1 = Integer.parseInt(n1.get(0).primitiveValue());
-
-    List result = new ArrayList();
-    for (int i = i1; i < focus.size(); i++)
-      result.add(focus.get(i));
-    return result;
-  }
-
-  private List funcTail(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    for (int i = 1; i < focus.size(); i++)
-      result.add(focus.get(i));
-    return result;
-  }
-
-  private List funcLast(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    if (focus.size() > 0)
-      result.add(focus.get(focus.size()-1));
-    return result;
-  }
-
-  private List funcFirst(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-    if (focus.size() > 0)
-      result.add(focus.get(0));
-    return result;
-  }
-
-
-	private List funcWhere(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    List pc = new ArrayList();
-    for (Base item : focus) {
-      pc.clear();
-      pc.add(item);
-      if (convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), true)))
-        result.add(item);
-    }
-    return result;
-  }
-
-  private List funcSelect(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    List pc = new ArrayList();
-    for (Base item : focus) {
-      pc.clear();
-      pc.add(item);
-      result.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), true));
-    }
-    return result;
-  }
-
-
-	private List funcItem(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
-    List result = new ArrayList();
-    String s = convertToString(execute(context, focus, exp.getParameters().get(0), true));
-    if (Utilities.isInteger(s) && Integer.parseInt(s) < focus.size())
-      result.add(focus.get(Integer.parseInt(s)));
-    return result;
-  }
-
-  private List funcEmpty(ExecutionContext context, List focus, ExpressionNode exp) {
-    List result = new ArrayList();
-		result.add(new BooleanType(ElementUtil.isEmpty(focus)));
-    return result;
-  }
-
-  private List funcNot(ExecutionContext context, List focus, ExpressionNode exp) {
-    return makeBoolean(!convertToBoolean(focus));
-  }
-
-  public class ElementDefinitionMatch {
-    private ElementDefinition definition;
-    private String fixedType;
-    public ElementDefinitionMatch(ElementDefinition definition, String fixedType) {
-      super();
-      this.definition = definition;
-      this.fixedType = fixedType;
-    }
-    public ElementDefinition getDefinition() {
-      return definition;
-    }
-    public String getFixedType() {
-      return fixedType;
-    }
-
-  }
-
-  private void getChildTypesByName(String type, String name, TypeDetails result) throws PathEngineException, DefinitionException {
-    if (Utilities.noString(type))
-      throw new PathEngineException("No type provided in BuildToolPathEvaluator.getChildTypesByName");
-    if (type.equals("http://hl7.org/fhir/StructureDefinition/xhtml"))
-      return;
-    String url = null;
-    if (type.contains("#")) {
-      url = type.substring(0, type.indexOf("#"));
-    } else {
-      url = type;
-    }
-    String tail = "";
-    StructureDefinition sd = worker.fetchResource(StructureDefinition.class, url);
-    if (sd == null)
-      throw new DefinitionException("Unknown type "+type); // this really is an error, because we can only get to here if the internal infrastrucgture is wrong
-    List sdl = new ArrayList();
-    ElementDefinitionMatch m = null;
-    if (type.contains("#"))
-      m = getElementDefinition(sd, type.substring(type.indexOf("#")+1), false);
-    if (m != null && hasDataType(m.definition)) {
-      if (m.fixedType != null)
-      {
-        StructureDefinition dt = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+m.fixedType);
-        if (dt == null)
-          throw new DefinitionException("unknown data type "+m.fixedType);
-        sdl.add(dt);
-      } else
-        for (TypeRefComponent t : m.definition.getType()) {
-          StructureDefinition dt = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+t.getCode());
-          if (dt == null)
-            throw new DefinitionException("unknown data type "+t.getCode());
-          sdl.add(dt);
-        }
-    } else {
-      sdl.add(sd);
-      if (type.contains("#")) {
-        tail = type.substring(type.indexOf("#")+1);
-        tail = tail.substring(tail.indexOf("."));
-      }
-    }
-
-    for (StructureDefinition sdi : sdl) {
-      String path = sdi.getSnapshot().getElement().get(0).getPath()+tail+".";
-      if (name.equals("**")) {
-        assert(result.getCollectionStatus() == CollectionStatus.UNORDERED);
-        for (ElementDefinition ed : sdi.getSnapshot().getElement()) {
-          if (ed.getPath().startsWith(path))
-            for (TypeRefComponent t : ed.getType()) {
-              if (t.hasCode() && t.getCodeElement().hasValue()) {
-                String tn = null;
-                if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement"))
-                  tn = sdi.getType()+"#"+ed.getPath();
-                else
-                  tn = t.getCode();
-                if (t.getCode().equals("Resource")) {
-                  for (String rn : worker.getResourceNames()) {
-                    if (!result.hasType(worker, rn)) {
-                      getChildTypesByName(result.addType(rn), "**", result);
-                    }                  
-                  }
-                } else if (!result.hasType(worker, tn)) {
-                  getChildTypesByName(result.addType(tn), "**", result);
-                }
-              }
-            }
-        }      
-      } else if (name.equals("*")) {
-        assert(result.getCollectionStatus() == CollectionStatus.UNORDERED);
-        for (ElementDefinition ed : sdi.getSnapshot().getElement()) {
-          if (ed.getPath().startsWith(path) && !ed.getPath().substring(path.length()).contains("."))
-            for (TypeRefComponent t : ed.getType()) {
-              if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement"))
-                result.addType(sdi.getType()+"#"+ed.getPath());
-              else if (t.getCode().equals("Resource"))
-                result.addTypes(worker.getResourceNames());
-              else
-                result.addType(t.getCode());
-            }
-        }
-      } else {
-        path = sdi.getSnapshot().getElement().get(0).getPath()+tail+"."+name;
-
-        ElementDefinitionMatch ed = getElementDefinition(sdi, path, false);
-        if (ed != null) {
-          if (!Utilities.noString(ed.getFixedType()))
-            result.addType(ed.getFixedType());
-          else
-            for (TypeRefComponent t : ed.getDefinition().getType()) {
-              if (Utilities.noString(t.getCode()))
-                break; // throw new PathEngineException("Illegal reference to primitive value attribute @ "+path);
-
-              ProfiledType pt = null;
-              if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement"))
-                pt = new ProfiledType(sdi.getUrl()+"#"+path);
-              else if (t.getCode().equals("Resource"))
-                result.addTypes(worker.getResourceNames());
-              else
-                pt = new ProfiledType(t.getCode());
-              if (pt != null) {
-                if (t.hasProfile())
-                  pt.addProfile(t.getProfile());
-                if (ed.getDefinition().hasBinding())
-                  pt.addBinding(ed.getDefinition().getBinding());
-                result.addType(pt);
-              }
-            }
-        }
-      }
-    }
-  }
-
-  private ElementDefinitionMatch getElementDefinition(StructureDefinition sd, String path, boolean allowTypedName) throws PathEngineException {
-    for (ElementDefinition ed : sd.getSnapshot().getElement()) {
-      if (ed.getPath().equals(path)) {
-        if (ed.hasContentReference()) {
-          return getElementDefinitionById(sd, ed.getContentReference());
-        } else
-          return new ElementDefinitionMatch(ed, null);
-      }
-      if (ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() == ed.getPath().length()-3)
-        return new ElementDefinitionMatch(ed, null);
-      if (allowTypedName && ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() > ed.getPath().length()-3) {
-    	String s = Utilities.uncapitalize(path.substring(ed.getPath().length()-3));
-    	if (primitiveTypes.contains(s))
-          return new ElementDefinitionMatch(ed, s);
-    	else
-        return new ElementDefinitionMatch(ed, path.substring(ed.getPath().length()-3));
-      }
-      if (ed.getPath().contains(".") && path.startsWith(ed.getPath()+".") && (ed.getType().size() > 0) && !isAbstractType(ed.getType())) { 
-        // now we walk into the type.
-        if (ed.getType().size() > 1)  // if there's more than one type, the test above would fail this
-          throw new PathEngineException("Internal typing issue....");
-        StructureDefinition nsd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+ed.getType().get(0).getCode());
-  	    if (nsd == null) 
-  	      throw new PathEngineException("Unknown type "+ed.getType().get(0).getCode());
-        return getElementDefinition(nsd, nsd.getId()+path.substring(ed.getPath().length()), allowTypedName);
-      }
-      if (ed.hasContentReference() && path.startsWith(ed.getPath()+".")) {
-        ElementDefinitionMatch m = getElementDefinitionById(sd, ed.getContentReference());
-        return getElementDefinition(sd, m.definition.getPath()+path.substring(ed.getPath().length()), allowTypedName);
-      }
-    }
-    return null;
-  }
-
-  private boolean isAbstractType(List list) {
-	return list.size() != 1 ? true : Utilities.existsInList(list.get(0).getCode(), "Element", "BackboneElement", "Resource", "DomainResource");
-}
-
-
-  private boolean hasType(ElementDefinition ed, String s) {
-    for (TypeRefComponent t : ed.getType()) 
-      if (s.equalsIgnoreCase(t.getCode()))
-        return true;
-    return false;
-  }
-
-  private boolean hasDataType(ElementDefinition ed) {
-    return ed.hasType() && !(ed.getType().get(0).getCode().equals("Element") || ed.getType().get(0).getCode().equals("BackboneElement"));
-  }
-
-  private ElementDefinitionMatch getElementDefinitionById(StructureDefinition sd, String ref) {
-    for (ElementDefinition ed : sd.getSnapshot().getElement()) {
-      if (ref.equals("#"+ed.getId())) 
-        return new ElementDefinitionMatch(ed, null);
-    }
-    return null;
-  }
-
-
-  public boolean hasLog() {
-    return log != null && log.length() > 0;
-  }
-
-
-  public String takeLog() {
-    if (!hasLog())
-      return "";
-    String s = log.toString();
-    log = new StringBuilder();
-    return s;
-  }
-
-}
+package org.hl7.fhir.dstu3.utils;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+import org.hl7.fhir.dstu3.context.IWorkerContext;
+import org.hl7.fhir.dstu3.model.*;
+import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
+import org.hl7.fhir.dstu3.model.ExpressionNode.*;
+import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind;
+import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule;
+import org.hl7.fhir.dstu3.model.TypeDetails.ProfiledType;
+import org.hl7.fhir.dstu3.utils.FHIRLexer.FHIRLexerException;
+import org.hl7.fhir.dstu3.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails;
+import org.hl7.fhir.exceptions.*;
+import org.hl7.fhir.utilities.Utilities;
+import org.hl7.fhir.utilities.ucum.Decimal;
+
+import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
+import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
+import ca.uhn.fhir.util.ElementUtil;
+
+/**
+ * 
+ * @author Grahame Grieve
+ *
+ */
+public class FHIRPathEngine {
+  private IWorkerContext worker;
+  private IEvaluationContext hostServices;
+  private StringBuilder log = new StringBuilder();
+  private Set primitiveTypes = new HashSet();
+  private Map allTypes = new HashMap();
+
+  // if the fhir path expressions are allowed to use constants beyond those defined in the specification
+  // the application can implement them by providing a constant resolver 
+  public interface IEvaluationContext {
+    public class FunctionDetails {
+      private String description;
+      private int minParameters;
+      private int maxParameters;
+      public FunctionDetails(String description, int minParameters, int maxParameters) {
+        super();
+        this.description = description;
+        this.minParameters = minParameters;
+        this.maxParameters = maxParameters;
+      }
+      public String getDescription() {
+        return description;
+      }
+      public int getMinParameters() {
+        return minParameters;
+      }
+      public int getMaxParameters() {
+        return maxParameters;
+      }
+
+    }
+
+    /**
+     * A constant reference - e.g. a reference to a name that must be resolved in context.
+     * The % will be removed from the constant name before this is invoked.
+     * 
+     * This will also be called if the host invokes the FluentPath engine with a context of null
+     *  
+     * @param appContext - content passed into the fluent path engine
+     * @param name - name reference to resolve
+     * @return the value of the reference (or null, if it's not valid, though can throw an exception if desired)
+     */
+    public Base resolveConstant(Object appContext, String name)  throws PathEngineException;
+    public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException;
+    
+    /**
+     * when the .log() function is called
+     * 
+     * @param argument
+     * @param focus
+     * @return
+     */
+    public boolean log(String argument, List focus);
+
+    // extensibility for functions
+    /**
+     * 
+     * @param functionName
+     * @return null if the function is not known
+     */
+    public FunctionDetails resolveFunction(String functionName);
+    
+    /**
+     * Check the function parameters, and throw an error if they are incorrect, or return the type for the function
+     * @param functionName
+     * @param parameters
+     * @return
+     */
+    public TypeDetails checkFunction(Object appContext, String functionName, List parameters) throws PathEngineException;
+    
+    /**
+     * @param appContext
+     * @param functionName
+     * @param parameters
+     * @return
+     */
+    public List executeFunction(Object appContext, String functionName, List> parameters);
+    
+    /**
+     * Implementation of resolve() function. Passed a string, return matching resource, if one is known - else null
+     * @param appInfo
+     * @param url
+     * @return
+     */
+    public Base resolveReference(Object appContext, String url);
+  }
+
+
+  /**
+   * @param worker - used when validating paths (@check), and used doing value set membership when executing tests (once that's defined)
+   */
+  public FHIRPathEngine(IWorkerContext worker) {
+    super();
+    this.worker = worker;
+    for (StructureDefinition sd : worker.allStructures()) {
+      if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION)
+        allTypes.put(sd.getName(), sd);
+      if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
+        primitiveTypes.add(sd.getName());
+      }
+    }
+  }
+
+
+  // --- 3 methods to override in children -------------------------------------------------------
+  // if you don't override, it falls through to the using the base reference implementation 
+  // HAPI overrides to these to support extending the base model
+
+  public IEvaluationContext getHostServices() {
+    return hostServices;
+  }
+
+
+  public void setHostServices(IEvaluationContext constantResolver) {
+    this.hostServices = constantResolver;
+  }
+
+
+  /**
+   * Given an item, return all the children that conform to the pattern described in name
+   * 
+   * Possible patterns:
+   *  - a simple name (which may be the base of a name with [] e.g. value[x])
+   *  - a name with a type replacement e.g. valueCodeableConcept
+   *  - * which means all children
+   *  - ** which means all descendants
+   *  
+   * @param item
+   * @param name
+   * @param result
+	 * @throws FHIRException 
+   */
+  protected void getChildrenByName(Base item, String name, List result) throws FHIRException {
+  	Base[] list = item.listChildrenByName(name, false);
+  	if (list != null)
+  		for (Base v : list)
+      if (v != null)
+        result.add(v);
+  }
+
+  // --- public API -------------------------------------------------------
+  /**
+   * Parse a path for later use using execute
+   * 
+   * @param path
+   * @return
+   * @throws PathEngineException 
+   * @throws Exception
+   */
+  public ExpressionNode parse(String path) throws FHIRLexerException {
+    FHIRLexer lexer = new FHIRLexer(path);
+    if (lexer.done())
+      throw lexer.error("Path cannot be empty");
+    ExpressionNode result = parseExpression(lexer, true);
+    if (!lexer.done())
+      throw lexer.error("Premature ExpressionNode termination at unexpected token \""+lexer.getCurrent()+"\"");
+    result.check();
+    return result;    
+  }
+
+  /**
+   * Parse a path that is part of some other syntax
+   *  
+   * @param path
+   * @return
+   * @throws PathEngineException 
+   * @throws Exception
+   */
+  public ExpressionNode parse(FHIRLexer lexer) throws FHIRLexerException {
+    ExpressionNode result = parseExpression(lexer, true);
+    result.check();
+    return result;    
+  }
+
+  /**
+   * check that paths referred to in the ExpressionNode are valid
+   * 
+   * xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath
+   * 
+   * returns a list of the possible types that might be returned by executing the ExpressionNode against a particular context
+   * 
+   * @param context - the logical type against which this path is applied
+   * @param path - the FHIR Path statement to check
+   * @throws DefinitionException 
+   * @throws PathEngineException 
+   * @if the path is not valid
+   */
+  public TypeDetails check(Object appContext, String resourceType, String context, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException {
+    // if context is a path that refers to a type, do that conversion now 
+	TypeDetails types; 
+	if (context == null) {
+	  types = null; // this is a special case; the first path reference will have to resolve to something in the context
+	} else if (!context.contains(".")) {
+    StructureDefinition sd = worker.fetchResource(StructureDefinition.class, context);
+	  types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl());
+	} else {
+	  String ctxt = context.substring(0, context.indexOf('.'));
+      if (Utilities.isAbsoluteUrl(resourceType)) {
+        ctxt = resourceType.substring(0, resourceType.lastIndexOf("/")+1)+ctxt;
+      }
+	  StructureDefinition sd = worker.fetchResource(StructureDefinition.class, ctxt);
+	  if (sd == null) 
+	    throw new PathEngineException("Unknown context "+context);
+	  ElementDefinitionMatch ed = getElementDefinition(sd, context, true);
+	  if (ed == null) 
+	    throw new PathEngineException("Unknown context element "+context);
+	  if (ed.fixedType != null) 
+	    types = new TypeDetails(CollectionStatus.SINGLETON, ed.fixedType);
+	  else if (ed.getDefinition().getType().isEmpty() || isAbstractType(ed.getDefinition().getType())) 
+	    types = new TypeDetails(CollectionStatus.SINGLETON, ctxt+"#"+context);
+	  else {
+	    types = new TypeDetails(CollectionStatus.SINGLETON);
+		for (TypeRefComponent t : ed.getDefinition().getType()) 
+		  types.addType(t.getCode());
+	  }
+	}
+
+    return executeType(new ExecutionTypeContext(appContext, resourceType, context, types), types, expr, true);
+  }
+
+  public TypeDetails check(Object appContext, StructureDefinition sd, String context, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException {
+    // if context is a path that refers to a type, do that conversion now 
+    TypeDetails types; 
+    if (!context.contains(".")) {
+      types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl());
+    } else {
+      ElementDefinitionMatch ed = getElementDefinition(sd, context, true);
+      if (ed == null) 
+        throw new PathEngineException("Unknown context element "+context);
+      if (ed.fixedType != null) 
+        types = new TypeDetails(CollectionStatus.SINGLETON, ed.fixedType);
+      else if (ed.getDefinition().getType().isEmpty() || isAbstractType(ed.getDefinition().getType())) 
+        types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl()+"#"+context);
+      else {
+        types = new TypeDetails(CollectionStatus.SINGLETON);
+        for (TypeRefComponent t : ed.getDefinition().getType()) 
+          types.addType(t.getCode());
+      }
+    }
+
+    return executeType(new ExecutionTypeContext(appContext, sd.getUrl(), context, types), types, expr, true);
+  }
+
+  public TypeDetails check(Object appContext, StructureDefinition sd, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException {
+    // if context is a path that refers to a type, do that conversion now 
+    TypeDetails types = null; // this is a special case; the first path reference will have to resolve to something in the context
+    return executeType(new ExecutionTypeContext(appContext, sd == null ? null : sd.getUrl(), null, types), types, expr, true);
+  }
+
+  public TypeDetails check(Object appContext, String resourceType, String context, String expr) throws FHIRLexerException, PathEngineException, DefinitionException {
+    return check(appContext, resourceType, context, parse(expr));
+  }
+
+
+  /**
+   * evaluate a path and return the matching elements
+   * 
+   * @param base - the object against which the path is being evaluated
+   * @param ExpressionNode - the parsed ExpressionNode statement to use
+   * @return
+   * @throws FHIRException 
+   * @
+   */
+	public List evaluate(Base base, ExpressionNode ExpressionNode) throws FHIRException {
+    List list = new ArrayList();
+    if (base != null)
+      list.add(base);
+    log = new StringBuilder();
+    return execute(new ExecutionContext(null, base != null && base.isResource() ? base : null, base, null, base), list, ExpressionNode, true);
+  }
+
+  /**
+   * evaluate a path and return the matching elements
+   * 
+   * @param base - the object against which the path is being evaluated
+   * @param path - the FHIR Path statement to use
+   * @return
+	 * @throws FHIRException 
+   * @
+   */
+	public List evaluate(Base base, String path) throws FHIRException {
+    ExpressionNode exp = parse(path);
+    List list = new ArrayList();
+    if (base != null)
+      list.add(base);
+    log = new StringBuilder();
+    return execute(new ExecutionContext(null, base.isResource() ? base : null, base, null, base), list, exp, true);
+  }
+
+  /**
+   * evaluate a path and return the matching elements
+   * 
+   * @param base - the object against which the path is being evaluated
+   * @param ExpressionNode - the parsed ExpressionNode statement to use
+   * @return
+	 * @throws FHIRException 
+   * @
+   */
+	public List evaluate(Object appContext, Resource resource, Base base, ExpressionNode ExpressionNode) throws FHIRException {
+    List list = new ArrayList();
+    if (base != null)
+      list.add(base);
+    log = new StringBuilder();
+    return execute(new ExecutionContext(appContext, resource, base, null, base), list, ExpressionNode, true);
+  }
+
+  /**
+   * evaluate a path and return the matching elements
+   * 
+   * @param base - the object against which the path is being evaluated
+   * @param ExpressionNode - the parsed ExpressionNode statement to use
+   * @return
+   * @throws FHIRException 
+   * @
+   */
+  public List evaluate(Object appContext, Base resource, Base base, ExpressionNode ExpressionNode) throws FHIRException {
+    List list = new ArrayList();
+    if (base != null)
+      list.add(base);
+    log = new StringBuilder();
+    return execute(new ExecutionContext(appContext, resource, base, null, base), list, ExpressionNode, true);
+  }
+
+  /**
+   * evaluate a path and return the matching elements
+   * 
+   * @param base - the object against which the path is being evaluated
+   * @param path - the FHIR Path statement to use
+   * @return
+	 * @throws FHIRException 
+   * @
+   */
+	public List evaluate(Object appContext, Resource resource, Base base, String path) throws FHIRException {
+    ExpressionNode exp = parse(path);
+    List list = new ArrayList();
+    if (base != null)
+      list.add(base);
+    log = new StringBuilder();
+    return execute(new ExecutionContext(appContext, resource, base, null, base), list, exp, true);
+  }
+
+  /**
+   * evaluate a path and return true or false (e.g. for an invariant)
+   * 
+   * @param base - the object against which the path is being evaluated
+   * @param path - the FHIR Path statement to use
+   * @return
+	 * @throws FHIRException 
+   * @
+   */
+	public boolean evaluateToBoolean(Resource resource, Base base, String path) throws FHIRException {
+    return convertToBoolean(evaluate(null, resource, base, path));
+  }
+
+  /**
+   * evaluate a path and return true or false (e.g. for an invariant)
+   * 
+   * @param base - the object against which the path is being evaluated
+   * @param path - the FHIR Path statement to use
+   * @return
+   * @throws FHIRException 
+   * @
+   */
+  public boolean evaluateToBoolean(Resource resource, Base base, ExpressionNode node) throws FHIRException {
+    return convertToBoolean(evaluate(null, resource, base, node));
+  }
+
+  /**
+   * evaluate a path and return true or false (e.g. for an invariant)
+   * 
+   * @param appinfo - application context
+   * @param base - the object against which the path is being evaluated
+   * @param path - the FHIR Path statement to use
+   * @return
+   * @throws FHIRException 
+   * @
+   */
+  public boolean evaluateToBoolean(Object appInfo, Resource resource, Base base, ExpressionNode node) throws FHIRException {
+    return convertToBoolean(evaluate(appInfo, resource, base, node));
+  }
+
+  /**
+   * evaluate a path and return true or false (e.g. for an invariant)
+   * 
+   * @param base - the object against which the path is being evaluated
+   * @param path - the FHIR Path statement to use
+   * @return
+   * @throws FHIRException 
+   * @
+   */
+  public boolean evaluateToBoolean(Base resource, Base base, ExpressionNode node) throws FHIRException {
+    return convertToBoolean(evaluate(null, resource, base, node));
+  }
+
+  /**
+   * evaluate a path and a string containing the outcome (for display)
+   * 
+   * @param base - the object against which the path is being evaluated
+   * @param path - the FHIR Path statement to use
+   * @return
+	 * @throws FHIRException 
+   * @
+   */
+  public String evaluateToString(Base base, String path) throws FHIRException {
+    return convertToString(evaluate(base, path));
+  }
+
+  public String evaluateToString(Object appInfo, Base resource, Base base, ExpressionNode node) throws FHIRException {
+    return convertToString(evaluate(appInfo, resource, base, node));
+  }
+
+  /**
+   * worker routine for converting a set of objects to a string representation
+   * 
+   * @param items - result from @evaluate
+   * @return
+   */
+  public String convertToString(List items) {
+    StringBuilder b = new StringBuilder();
+    boolean first = true;
+    for (Base item : items) {
+      if (first) 
+        first = false;
+      else
+        b.append(',');
+
+      b.append(convertToString(item));
+    }
+    return b.toString();
+  }
+
+  private String convertToString(Base item) {
+    if (item.isPrimitive())
+      return item.primitiveValue();
+    else 
+      return item.toString();
+  }
+
+  /**
+   * worker routine for converting a set of objects to a boolean representation (for invariants)
+   * 
+   * @param items - result from @evaluate
+   * @return
+   */
+  public boolean convertToBoolean(List items) {
+    if (items == null)
+      return false;
+    else if (items.size() == 1 && items.get(0) instanceof BooleanType)
+      return ((BooleanType) items.get(0)).getValue();
+    else 
+      return items.size() > 0;
+  }
+
+
+  private void log(String name, List contents) {
+    if (hostServices == null || !hostServices.log(name, contents)) {
+      if (log.length() > 0)
+        log.append("; ");
+      log.append(name);
+      log.append(": ");
+      boolean first = true;
+      for (Base b : contents) {
+        if (first)
+          first = false;
+        else
+          log.append(",");
+        log.append(convertToString(b));
+      }
+    }
+  }
+
+  public String forLog() {
+    if (log.length() > 0)
+      return " ("+log.toString()+")";
+    else
+      return "";
+  }
+
+  private class ExecutionContext {
+    private Object appInfo;
+    private Base resource;
+    private Base context;
+    private Base thisItem;
+    private Map aliases;
+    
+    public ExecutionContext(Object appInfo, Base resource, Base context, Map aliases, Base thisItem) {
+      this.appInfo = appInfo;
+      this.context = context;
+      this.resource = resource; 
+      this.aliases = aliases;
+      this.thisItem = thisItem;
+    }
+    public Base getResource() {
+      return resource;
+    }
+    public Base getThisItem() {
+      return thisItem;
+    }
+    public void addAlias(String name, List focus) throws FHIRException {
+      if (aliases == null)
+        aliases = new HashMap();
+      else
+        aliases = new HashMap(aliases); // clone it, since it's going to change 
+      if (focus.size() > 1)
+        throw new FHIRException("Attempt to alias a collection, not a singleton");
+      aliases.put(name, focus.size() == 0 ? null : focus.get(0));      
+    }
+    public Base getAlias(String name) {
+      return aliases == null ? null : aliases.get(name);
+    }
+  }
+
+  private class ExecutionTypeContext {
+    private Object appInfo; 
+    private String resource;
+    private String context;
+    private TypeDetails thisItem;
+
+
+    public ExecutionTypeContext(Object appInfo, String resource, String context, TypeDetails thisItem) {
+      super();
+      this.appInfo = appInfo;
+      this.resource = resource;
+      this.context = context;
+      this.thisItem = thisItem;
+      
+    }
+    public String getResource() {
+      return resource;
+    }
+    public TypeDetails getThisItem() {
+      return thisItem;
+    }
+  }
+
+  private ExpressionNode parseExpression(FHIRLexer lexer, boolean proximal) throws FHIRLexerException {
+    ExpressionNode result = new ExpressionNode(lexer.nextId());
+    SourceLocation c = lexer.getCurrentStartLocation();
+    result.setStart(lexer.getCurrentLocation());
+    // special:
+    if (lexer.getCurrent().equals("-")) {
+      lexer.take();
+      lexer.setCurrent("-"+lexer.getCurrent());
+    }
+    if (lexer.getCurrent().equals("+")) {
+      lexer.take();
+      lexer.setCurrent("+"+lexer.getCurrent());
+    }
+    if (lexer.isConstant(false)) {
+      checkConstant(lexer.getCurrent(), lexer);
+      result.setConstant(lexer.take());
+      result.setKind(Kind.Constant);
+      result.setEnd(lexer.getCurrentLocation());
+    } else if ("(".equals(lexer.getCurrent())) {
+      lexer.next();
+      result.setKind(Kind.Group);
+      result.setGroup(parseExpression(lexer, true));
+      if (!")".equals(lexer.getCurrent())) 
+        throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\"");
+      result.setEnd(lexer.getCurrentLocation());
+      lexer.next();
+    } else {
+      if (!lexer.isToken() && !lexer.getCurrent().startsWith("\"")) 
+        throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name");
+      if (lexer.getCurrent().startsWith("\""))
+        result.setName(lexer.readConstant("Path Name"));
+      else
+        result.setName(lexer.take());
+      result.setEnd(lexer.getCurrentLocation());
+      if (!result.checkName())
+        throw lexer.error("Found "+result.getName()+" expecting a valid token name");
+      if ("(".equals(lexer.getCurrent())) {
+        Function f = Function.fromCode(result.getName());
+        FunctionDetails details = null;
+        if (f == null) {
+          if (hostServices != null)
+            details = hostServices.resolveFunction(result.getName());
+          if (details == null)
+            throw lexer.error("The name "+result.getName()+" is not a valid function name");
+          f = Function.Custom;
+        }
+        result.setKind(Kind.Function);
+        result.setFunction(f);
+        lexer.next();
+        while (!")".equals(lexer.getCurrent())) { 
+          result.getParameters().add(parseExpression(lexer, true));
+          if (",".equals(lexer.getCurrent()))
+            lexer.next();
+          else if (!")".equals(lexer.getCurrent()))
+            throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - either a \",\" or a \")\" expected");
+        }
+        result.setEnd(lexer.getCurrentLocation());
+        lexer.next();
+        checkParameters(lexer, c, result, details);
+      } else
+        result.setKind(Kind.Name);
+    }
+    ExpressionNode focus = result;
+    if ("[".equals(lexer.getCurrent())) {
+      lexer.next();
+      ExpressionNode item = new ExpressionNode(lexer.nextId());
+      item.setKind(Kind.Function);
+      item.setFunction(ExpressionNode.Function.Item);
+      item.getParameters().add(parseExpression(lexer, true));
+      if (!lexer.getCurrent().equals("]"))
+        throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - a \"]\" expected");
+      lexer.next();
+      result.setInner(item);
+      focus = item;
+    }
+    if (".".equals(lexer.getCurrent())) {
+      lexer.next();
+      focus.setInner(parseExpression(lexer, false));
+    }
+    result.setProximal(proximal);
+    if (proximal) {
+      while (lexer.isOp()) {
+        focus.setOperation(ExpressionNode.Operation.fromCode(lexer.getCurrent()));
+        focus.setOpStart(lexer.getCurrentStartLocation());
+        focus.setOpEnd(lexer.getCurrentLocation());
+        lexer.next();
+        focus.setOpNext(parseExpression(lexer, false));
+        focus = focus.getOpNext();
+      }
+      result = organisePrecedence(lexer, result);
+    }
+    return result;
+  }
+
+  private ExpressionNode organisePrecedence(FHIRLexer lexer, ExpressionNode node) {
+    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Times, Operation.DivideBy, Operation.Div, Operation.Mod)); 
+    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Plus, Operation.Minus, Operation.Concatenate)); 
+    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Union)); 
+    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.LessThen, Operation.Greater, Operation.LessOrEqual, Operation.GreaterOrEqual));
+    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Is));
+    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Equals, Operation.Equivalent, Operation.NotEquals, Operation.NotEquivalent));
+    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.And));
+    node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Xor, Operation.Or));
+    // last: implies
+    return node;
+  }
+
+  private ExpressionNode gatherPrecedence(FHIRLexer lexer, ExpressionNode start, EnumSet ops) {
+    //	  work : boolean;
+    //	  focus, node, group : ExpressionNode;
+
+    assert(start.isProximal());
+
+    // is there anything to do?
+    boolean work = false;
+    ExpressionNode focus = start.getOpNext();
+    if (ops.contains(start.getOperation())) {
+      while (focus != null && focus.getOperation() != null) {
+        work = work || !ops.contains(focus.getOperation());
+        focus = focus.getOpNext();
+      }
+    } else {
+      while (focus != null && focus.getOperation() != null) {
+        work = work || ops.contains(focus.getOperation());
+        focus = focus.getOpNext();
+      }
+    }  
+    if (!work)
+      return start;
+
+    // entry point: tricky
+    ExpressionNode group;
+    if (ops.contains(start.getOperation())) {
+      group = newGroup(lexer, start);
+      group.setProximal(true);
+      focus = start;
+      start = group;
+    } else {
+      ExpressionNode node = start;
+
+      focus = node.getOpNext();
+      while (!ops.contains(focus.getOperation())) {
+        node = focus;
+        focus = focus.getOpNext();
+      }
+      group = newGroup(lexer, focus);
+      node.setOpNext(group);
+    }
+
+    // now, at this point:
+    //   group is the group we are adding to, it already has a .group property filled out.
+    //   focus points at the group.group
+    do {
+      // run until we find the end of the sequence
+      while (ops.contains(focus.getOperation()))
+        focus = focus.getOpNext();
+      if (focus.getOperation() != null) {
+        group.setOperation(focus.getOperation());
+        group.setOpNext(focus.getOpNext());
+        focus.setOperation(null);
+        focus.setOpNext(null);
+        // now look for another sequence, and start it
+        ExpressionNode node = group;
+        focus = group.getOpNext();
+        if (focus != null) { 
+          while (focus != null && !ops.contains(focus.getOperation())) {
+            node = focus;
+            focus = focus.getOpNext();
+          }
+          if (focus != null) { // && (focus.Operation in Ops) - must be true 
+            group = newGroup(lexer, focus);
+            node.setOpNext(group);
+          }
+        }
+      }
+    }
+    while (focus != null && focus.getOperation() != null);
+    return start;
+  }
+
+
+  private ExpressionNode newGroup(FHIRLexer lexer, ExpressionNode next) {
+    ExpressionNode result = new ExpressionNode(lexer.nextId());
+    result.setKind(Kind.Group);
+    result.setGroup(next);
+    result.getGroup().setProximal(true);
+    return result;
+  }
+
+  private void checkConstant(String s, FHIRLexer lexer) throws FHIRLexerException {
+    if (s.startsWith("\'") && s.endsWith("\'")) {
+      int i = 1;
+      while (i < s.length()-1) {
+        char ch = s.charAt(i);
+        if (ch == '\\') {
+          switch (ch) {
+          case 't': 
+          case 'r':
+          case 'n': 
+          case 'f': 
+          case '\'':
+          case '\\': 
+          case '/': 
+            i++; 
+            break;
+          case 'u':
+            if (!Utilities.isHex("0x"+s.substring(i, i+4)))
+              throw lexer.error("Improper unicode escape \\u"+s.substring(i, i+4));
+            break;
+          default:
+            throw lexer.error("Unknown character escape \\"+ch);
+          }
+        } else
+          i++;
+      }
+    }
+  }
+
+  //  procedure CheckParamCount(c : integer);
+  //  begin
+  //    if exp.Parameters.Count <> c then
+  //      raise lexer.error('The function "'+exp.name+'" requires '+inttostr(c)+' parameters', offset);
+  //  end;
+
+  private boolean checkParamCount(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, int count) throws FHIRLexerException {
+    if (exp.getParameters().size() != count)
+      throw lexer.error("The function \""+exp.getName()+"\" requires "+Integer.toString(count)+" parameters", location.toString());
+    return true;
+  }
+
+  private boolean checkParamCount(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, int countMin, int countMax) throws FHIRLexerException {
+    if (exp.getParameters().size() < countMin || exp.getParameters().size() > countMax)
+      throw lexer.error("The function \""+exp.getName()+"\" requires between "+Integer.toString(countMin)+" and "+Integer.toString(countMax)+" parameters", location.toString());
+    return true;
+  }
+
+  private boolean checkParameters(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, FunctionDetails details) throws FHIRLexerException {
+    switch (exp.getFunction()) {
+    case Empty: return checkParamCount(lexer, location, exp, 0);
+    case Not: return checkParamCount(lexer, location, exp, 0);
+    case Exists: return checkParamCount(lexer, location, exp, 0);
+    case SubsetOf: return checkParamCount(lexer, location, exp, 1);
+    case SupersetOf: return checkParamCount(lexer, location, exp, 1);
+    case IsDistinct: return checkParamCount(lexer, location, exp, 0);
+    case Distinct: return checkParamCount(lexer, location, exp, 0);
+    case Count: return checkParamCount(lexer, location, exp, 0);
+    case Where: return checkParamCount(lexer, location, exp, 1);
+    case Select: return checkParamCount(lexer, location, exp, 1);
+    case All: return checkParamCount(lexer, location, exp, 0, 1);
+    case Repeat: return checkParamCount(lexer, location, exp, 1);
+    case Item: return checkParamCount(lexer, location, exp, 1);
+    case As: return checkParamCount(lexer, location, exp, 1);
+    case Is: return checkParamCount(lexer, location, exp, 1);
+    case Single: return checkParamCount(lexer, location, exp, 0);
+    case First: return checkParamCount(lexer, location, exp, 0);
+    case Last: return checkParamCount(lexer, location, exp, 0);
+    case Tail: return checkParamCount(lexer, location, exp, 0);
+    case Skip: return checkParamCount(lexer, location, exp, 1);
+    case Take: return checkParamCount(lexer, location, exp, 1);
+    case Iif: return checkParamCount(lexer, location, exp, 2,3);
+    case ToInteger: return checkParamCount(lexer, location, exp, 0);
+    case ToDecimal: return checkParamCount(lexer, location, exp, 0);
+    case ToString: return checkParamCount(lexer, location, exp, 0);
+    case Substring: return checkParamCount(lexer, location, exp, 1, 2);
+    case StartsWith: return checkParamCount(lexer, location, exp, 1);
+    case EndsWith: return checkParamCount(lexer, location, exp, 1);
+    case Matches: return checkParamCount(lexer, location, exp, 1);
+    case ReplaceMatches: return checkParamCount(lexer, location, exp, 2);
+    case Contains: return checkParamCount(lexer, location, exp, 1);
+    case Replace: return checkParamCount(lexer, location, exp, 2);
+    case Length: return checkParamCount(lexer, location, exp, 0);
+    case Children: return checkParamCount(lexer, location, exp, 0);
+    case Descendants: return checkParamCount(lexer, location, exp, 0);
+    case MemberOf: return checkParamCount(lexer, location, exp, 1);
+    case Trace: return checkParamCount(lexer, location, exp, 1);
+    case Today: return checkParamCount(lexer, location, exp, 0);
+    case Now: return checkParamCount(lexer, location, exp, 0);
+    case Resolve: return checkParamCount(lexer, location, exp, 0);
+    case Extension: return checkParamCount(lexer, location, exp, 1);
+    case HasValue: return checkParamCount(lexer, location, exp, 0);
+    case Alias: return checkParamCount(lexer, location, exp, 1);
+    case AliasAs: return checkParamCount(lexer, location, exp, 1);
+    case Custom: return checkParamCount(lexer, location, exp, details.getMinParameters(), details.getMaxParameters());
+    }
+    return false;
+  }
+
+	private List execute(ExecutionContext context, List focus, ExpressionNode exp, boolean atEntry) throws FHIRException {
+//    System.out.println("Evaluate {'"+exp.toString()+"'} on "+focus.toString());
+    List work = new ArrayList();
+    switch (exp.getKind()) {
+    case Name:
+      if (atEntry && exp.getName().equals("$this"))
+        work.add(context.getThisItem());
+      else
+        for (Base item : focus) {
+          List outcome = execute(context, item, exp, atEntry);
+          for (Base base : outcome)
+            if (base != null)
+              work.add(base);
+        }        		
+      break;
+    case Function:
+      List work2 = evaluateFunction(context, focus, exp);
+      work.addAll(work2);
+      break;
+    case Constant:
+      Base b = processConstant(context, exp.getConstant());
+      if (b != null)
+        work.add(b);
+      break;
+    case Group:
+      work2 = execute(context, focus, exp.getGroup(), atEntry);
+      work.addAll(work2);
+    }
+
+    if (exp.getInner() != null)
+      work = execute(context, work, exp.getInner(), false);
+
+    if (exp.isProximal() && exp.getOperation() != null) {
+      ExpressionNode next = exp.getOpNext();
+      ExpressionNode last = exp;
+      while (next != null) {
+        List work2 = preOperate(work, last.getOperation());
+        if (work2 != null)
+          work = work2;
+        else if (last.getOperation() == Operation.Is || last.getOperation() == Operation.As) {
+          work2 = executeTypeName(context, focus, next, false);
+          work = operate(work, last.getOperation(), work2);
+        } else {
+          work2 = execute(context, focus, next, true);
+          work = operate(work, last.getOperation(), work2);
+//          System.out.println("Result of {'"+last.toString()+" "+last.getOperation().toCode()+" "+next.toString()+"'}: "+focus.toString());
+        }
+        last = next;
+        next = next.getOpNext();
+      }
+    }
+//    System.out.println("Result of {'"+exp.toString()+"'}: "+work.toString());
+    return work;
+  }
+
+  private List executeTypeName(ExecutionContext context, List focus, ExpressionNode next, boolean atEntry) {
+    List result = new ArrayList();
+    result.add(new StringType(next.getName()));
+    return result;
+  }
+
+
+  private List preOperate(List left, Operation operation) {
+    switch (operation) {
+    case And:
+      return isBoolean(left, false) ? makeBoolean(false) : null;
+    case Or:
+      return isBoolean(left, true) ? makeBoolean(true) : null;
+    case Implies:
+      return convertToBoolean(left) ? null : makeBoolean(true);
+    default: 
+      return null;
+    }
+  }
+
+  private List makeBoolean(boolean b) {
+    List res = new ArrayList();
+    res.add(new BooleanType(b));
+    return res;
+  }
+
+  private TypeDetails executeTypeName(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException {
+    return new TypeDetails(CollectionStatus.SINGLETON, exp.getName());
+  }
+
+  private TypeDetails executeType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException {
+    TypeDetails result = new TypeDetails(null);
+    switch (exp.getKind()) {
+    case Name:
+      if (atEntry && exp.getName().equals("$this"))
+        result.update(context.getThisItem());
+      else if (atEntry && focus == null)
+        result.update(executeContextType(context, exp.getName()));
+      else {
+        for (String s : focus.getTypes()) {
+          result.update(executeType(s, exp, atEntry));
+        }
+        if (result.hasNoTypes()) 
+          throw new PathEngineException("The name "+exp.getName()+" is not valid for any of the possible types: "+focus.describe());
+      }
+      break;
+    case Function:
+      result.update(evaluateFunctionType(context, focus, exp));
+      break;
+    case Constant:
+      result.update(readConstantType(context, exp.getConstant()));
+      break;
+    case Group:
+      result.update(executeType(context, focus, exp.getGroup(), atEntry));
+    }
+    exp.setTypes(result);
+
+    if (exp.getInner() != null) {
+      result = executeType(context, result, exp.getInner(), false);
+    }
+
+    if (exp.isProximal() && exp.getOperation() != null) {
+      ExpressionNode next = exp.getOpNext();
+      ExpressionNode last = exp;
+      while (next != null) {
+        TypeDetails work;
+        if (last.getOperation() == Operation.Is || last.getOperation() == Operation.As)
+          work = executeTypeName(context, focus, next, atEntry);
+        else
+          work = executeType(context, focus, next, atEntry);
+        result = operateTypes(result, last.getOperation(), work);
+        last = next;
+        next = next.getOpNext();
+      }
+      exp.setOpTypes(result);
+    }
+    return result;
+  }
+
+  private Base processConstant(ExecutionContext context, String constant) throws PathEngineException {
+    if (constant.equals("true")) {
+      return new BooleanType(true);
+    } else if (constant.equals("false")) {
+      return new BooleanType(false);
+    } else if (constant.equals("{}")) {
+      return null;
+    } else if (Utilities.isInteger(constant)) {
+      return new IntegerType(constant);
+    } else if (Utilities.isDecimal(constant)) {
+      return new DecimalType(constant);
+    } else if (constant.startsWith("\'")) {
+      return new StringType(processConstantString(constant));
+    } else if (constant.startsWith("%")) {
+      return resolveConstant(context, constant);
+    } else if (constant.startsWith("@")) {
+      return processDateConstant(context.appInfo, constant.substring(1));
+    } else {
+      return new StringType(constant);
+    }
+  }
+
+  private Base processDateConstant(Object appInfo, String value) throws PathEngineException {
+    if (value.startsWith("T"))
+      return new TimeType(value.substring(1));
+    String v = value;
+    if (v.length() > 10) {
+      int i = v.substring(10).indexOf("-");
+      if (i == -1)
+        i = v.substring(10).indexOf("+");
+      if (i == -1)
+        i = v.substring(10).indexOf("Z");
+      v = i == -1 ? value : v.substring(0,  10+i);
+    }
+    if (v.length() > 10)
+      return new DateTimeType(value);
+    else 
+      return new DateType(value);
+  }
+
+
+  private Base resolveConstant(ExecutionContext context, String s) throws PathEngineException {
+    if (s.equals("%sct"))
+      return new StringType("http://snomed.info/sct");
+    else if (s.equals("%loinc"))
+      return new StringType("http://loinc.org");
+    else if (s.equals("%ucum"))
+      return new StringType("http://unitsofmeasure.org");
+    else if (s.equals("%resource")) {
+      if (context.resource == null)
+        throw new PathEngineException("Cannot use %resource in this context");
+      return context.resource;
+    } else if (s.equals("%context")) {
+      return context.context;
+    } else if (s.equals("%us-zip"))
+      return new StringType("[0-9]{5}(-[0-9]{4}){0,1}");
+    else if (s.startsWith("%\"vs-"))
+      return new StringType("http://hl7.org/fhir/ValueSet/"+s.substring(5, s.length()-1)+"");
+    else if (s.startsWith("%\"cs-"))
+      return new StringType("http://hl7.org/fhir/"+s.substring(5, s.length()-1)+"");
+    else if (s.startsWith("%\"ext-"))
+      return new StringType("http://hl7.org/fhir/StructureDefinition/"+s.substring(6, s.length()-1));
+    else if (hostServices == null)
+      throw new PathEngineException("Unknown fixed constant '"+s+"'");
+    else
+      return hostServices.resolveConstant(context.appInfo, s.substring(1));
+  }
+
+
+  private String processConstantString(String s) throws PathEngineException {
+    StringBuilder b = new StringBuilder();
+    int i = 1;
+    while (i < s.length()-1) {
+      char ch = s.charAt(i);
+      if (ch == '\\') {
+        i++;
+        switch (s.charAt(i)) {
+        case 't': 
+          b.append('\t');
+          break;
+        case 'r':
+          b.append('\r');
+          break;
+        case 'n': 
+          b.append('\n');
+          break;
+        case 'f': 
+          b.append('\f');
+          break;
+        case '\'':
+          b.append('\'');
+          break;
+        case '\\': 
+          b.append('\\');
+          break;
+        case '/': 
+          b.append('/');
+          break;
+        case 'u':
+          i++;
+          int uc = Integer.parseInt(s.substring(i, i+4), 16);
+          b.append((char) uc);
+          i = i + 3;
+          break;
+        default:
+          throw new PathEngineException("Unknown character escape \\"+s.charAt(i));
+        }
+        i++;
+      } else {
+        b.append(ch);
+        i++;
+      }
+    }
+    return b.toString();
+  }
+
+
+  private List operate(List left, Operation operation, List right) throws FHIRException {
+    switch (operation) {
+    case Equals: return opEquals(left, right);
+    case Equivalent: return opEquivalent(left, right);
+    case NotEquals: return opNotEquals(left, right);
+    case NotEquivalent: return opNotEquivalent(left, right);
+    case LessThen: return opLessThen(left, right);
+    case Greater: return opGreater(left, right);
+    case LessOrEqual: return opLessOrEqual(left, right);
+    case GreaterOrEqual: return opGreaterOrEqual(left, right);
+    case Union: return opUnion(left, right);
+    case In: return opIn(left, right);
+    case Contains: return opContains(left, right);
+    case Or:  return opOr(left, right);
+    case And:  return opAnd(left, right);
+    case Xor: return opXor(left, right);
+    case Implies: return opImplies(left, right);
+    case Plus: return opPlus(left, right);
+    case Times: return opTimes(left, right);
+    case Minus: return opMinus(left, right);
+    case Concatenate: return opConcatenate(left, right);
+    case DivideBy: return opDivideBy(left, right);
+    case Div: return opDiv(left, right);
+    case Mod: return opMod(left, right);
+    case Is: return opIs(left, right);
+    case As: return opAs(left, right);
+    default: 
+      throw new Error("Not Done Yet: "+operation.toCode());
+    }
+  }
+
+  private List opAs(List left, List right) {
+    List result = new ArrayList();
+    if (left.size() != 1 || right.size() != 1)
+      return result;
+    else {
+      String tn = convertToString(right);
+      if (tn.equals(left.get(0).fhirType()))
+        result.add(left.get(0));
+    }
+    return result;
+  }
+
+
+  private List opIs(List left, List right) {
+    List result = new ArrayList();
+    if (left.size() != 1 || right.size() != 1) 
+      result.add(new BooleanType(false));
+    else {
+      String tn = convertToString(right);
+      result.add(new BooleanType(left.get(0).hasType(tn)));
+    }
+    return result;
+  }
+
+
+  private TypeDetails operateTypes(TypeDetails left, Operation operation, TypeDetails right) {
+    switch (operation) {
+    case Equals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Equivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case NotEquals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case NotEquivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case LessThen: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Greater: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case LessOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case GreaterOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Is: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case As: return new TypeDetails(CollectionStatus.SINGLETON, right.getTypes());
+    case Union: return left.union(right);
+    case Or: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case And: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Xor: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Implies : return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Times: 
+      TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON);
+      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
+        result.addType("integer");
+      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
+        result.addType("decimal");
+      return result;
+    case DivideBy: 
+      result = new TypeDetails(CollectionStatus.SINGLETON);
+      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
+        result.addType("decimal");
+      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
+        result.addType("decimal");
+      return result;
+    case Concatenate:
+      result = new TypeDetails(CollectionStatus.SINGLETON, "");
+      return result;
+    case Plus:
+      result = new TypeDetails(CollectionStatus.SINGLETON);
+      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
+        result.addType("integer");
+      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
+        result.addType("decimal");
+      else if (left.hasType(worker, "string", "id", "code", "uri") && right.hasType(worker, "string", "id", "code", "uri"))
+        result.addType("string");
+      return result;
+    case Minus:
+      result = new TypeDetails(CollectionStatus.SINGLETON);
+      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
+        result.addType("integer");
+      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
+        result.addType("decimal");
+      return result;
+    case Div: 
+    case Mod: 
+      result = new TypeDetails(CollectionStatus.SINGLETON);
+      if (left.hasType(worker, "integer") && right.hasType(worker, "integer"))
+        result.addType("integer");
+      else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal"))
+        result.addType("decimal");
+      return result;
+    case In: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Contains: return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    default: 
+      return null;
+    }
+  }
+
+
+  private List opEquals(List left, List right) {
+    if (left.size() != right.size())
+      return makeBoolean(false);
+
+    boolean res = true;
+    for (int i = 0; i < left.size(); i++) {
+      if (!doEquals(left.get(i), right.get(i))) { 
+        res = false;
+        break;
+      }
+    }
+    return makeBoolean(res);
+  }
+
+  private List opNotEquals(List left, List right) {
+    if (left.size() != right.size())
+      return makeBoolean(true);
+
+    boolean res = true;
+    for (int i = 0; i < left.size(); i++) {
+      if (!doEquals(left.get(i), right.get(i))) { 
+        res = false;
+        break;
+      }
+    }
+    return makeBoolean(!res);
+  }
+
+  private boolean doEquals(Base left, Base right) {
+    if (left.isPrimitive() && right.isPrimitive())
+			return Base.equals(left.primitiveValue(), right.primitiveValue());
+    else
+      return Base.compareDeep(left, right, false);
+  }
+
+  private boolean doEquivalent(Base left, Base right) throws PathEngineException {
+    if (left.hasType("integer") && right.hasType("integer"))
+      return doEquals(left, right);
+    if (left.hasType("boolean") && right.hasType("boolean"))
+      return doEquals(left, right);
+    if (left.hasType("integer", "decimal", "unsignedInt", "positiveInt") && right.hasType("integer", "decimal", "unsignedInt", "positiveInt"))
+      return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue());
+    if (left.hasType("date", "dateTime", "time", "instant") && right.hasType("date", "dateTime", "time", "instant"))
+      return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue());
+    if (left.hasType("string", "id", "code", "uri") && right.hasType("string", "id", "code", "uri"))
+      return Utilities.equivalent(convertToString(left), convertToString(right));
+
+    throw new PathEngineException(String.format("Unable to determine equivalence between %s and %s", left.fhirType(), right.fhirType()));
+  }
+
+  private List opEquivalent(List left, List right) throws PathEngineException {
+    if (left.size() != right.size())
+      return makeBoolean(false);
+
+    boolean res = true;
+    for (int i = 0; i < left.size(); i++) {
+      boolean found = false;
+      for (int j = 0; j < right.size(); j++) {
+        if (doEquivalent(left.get(i), right.get(j))) {
+          found = true;
+          break;
+        }
+      }
+      if (!found) {
+        res = false;
+        break;
+      }
+    }
+    return makeBoolean(res);
+  }
+
+  private List opNotEquivalent(List left, List right) throws PathEngineException {
+    if (left.size() != right.size())
+      return makeBoolean(true);
+
+    boolean res = true;
+    for (int i = 0; i < left.size(); i++) {
+      boolean found = false;
+      for (int j = 0; j < right.size(); j++) {
+        if (doEquivalent(left.get(i), right.get(j))) {
+          found = true;
+          break;
+        }
+      }
+      if (!found) {
+        res = false;
+        break;
+      }
+    }
+    return makeBoolean(!res);
+  }
+
+	private List opLessThen(List left, List right) throws FHIRException {
+    if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
+      Base l = left.get(0);
+      Base r = right.get(0);
+      if (l.hasType("string") && r.hasType("string")) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0);
+      else if ((l.hasType("integer") || l.hasType("decimal")) && (r.hasType("integer") || r.hasType("decimal"))) 
+        return makeBoolean(new Double(l.primitiveValue()) < new Double(r.primitiveValue()));
+      else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0);
+      else if ((l.hasType("time")) && (r.hasType("time"))) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0);
+    } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) {
+      List lUnit = left.get(0).listChildrenByName("unit");
+      List rUnit = right.get(0).listChildrenByName("unit");
+      if (Base.compareDeep(lUnit, rUnit, true)) {
+        return opLessThen(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
+      } else {
+				throw new InternalErrorException("Canonical Comparison isn't done yet");
+      }
+    }
+    return new ArrayList();
+  }
+
+	private List opGreater(List left, List right) throws FHIRException {
+    if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
+      Base l = left.get(0);
+      Base r = right.get(0);
+      if (l.hasType("string") && r.hasType("string")) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0);
+      else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) 
+        return makeBoolean(new Double(l.primitiveValue()) > new Double(r.primitiveValue()));
+      else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0);
+      else if ((l.hasType("time")) && (r.hasType("time"))) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0);
+    } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) {
+      List lUnit = left.get(0).listChildrenByName("unit");
+      List rUnit = right.get(0).listChildrenByName("unit");
+      if (Base.compareDeep(lUnit, rUnit, true)) {
+        return opGreater(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
+      } else {
+				throw new InternalErrorException("Canonical Comparison isn't done yet");
+      }
+    }
+    return new ArrayList();
+  }
+
+	private List opLessOrEqual(List left, List right) throws FHIRException {
+    if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
+      Base l = left.get(0);
+      Base r = right.get(0);
+      if (l.hasType("string") && r.hasType("string")) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0);
+      else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) 
+        return makeBoolean(new Double(l.primitiveValue()) <= new Double(r.primitiveValue()));
+      else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0);
+      else if ((l.hasType("time")) && (r.hasType("time"))) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0);
+    } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) {
+      List lUnits = left.get(0).listChildrenByName("unit");
+      String lunit = lUnits.size() == 1 ? lUnits.get(0).primitiveValue() : null;
+      List rUnits = right.get(0).listChildrenByName("unit");
+      String runit = rUnits.size() == 1 ? rUnits.get(0).primitiveValue() : null;
+      if ((lunit == null && runit == null) || lunit.equals(runit)) {
+        return opLessOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
+      } else {
+				throw new InternalErrorException("Canonical Comparison isn't done yet");
+      }
+    }
+    return new ArrayList();
+  }
+
+	private List opGreaterOrEqual(List left, List right) throws FHIRException {
+    if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
+      Base l = left.get(0);
+      Base r = right.get(0);
+      if (l.hasType("string") && r.hasType("string")) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0);
+      else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) 
+        return makeBoolean(new Double(l.primitiveValue()) >= new Double(r.primitiveValue()));
+      else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0);
+      else if ((l.hasType("time")) && (r.hasType("time"))) 
+        return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0);
+    } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) {
+      List lUnit = left.get(0).listChildrenByName("unit");
+      List rUnit = right.get(0).listChildrenByName("unit");
+      if (Base.compareDeep(lUnit, rUnit, true)) {
+        return opGreaterOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
+      } else {
+				throw new InternalErrorException("Canonical Comparison isn't done yet");
+      }
+    }
+    return new ArrayList();
+  }
+
+  private List opIn(List left, List right) {
+    boolean ans = true;
+    for (Base l : left) {
+      boolean f = false;
+      for (Base r : right)
+        if (doEquals(l, r)) {
+          f = true;
+          break;
+        }
+      if (!f) {
+        ans = false;
+        break;
+      }
+    }
+    return makeBoolean(ans);
+  }
+
+  private List opContains(List left, List right) {
+    boolean ans = true;
+    for (Base r : right) {
+      boolean f = false;
+      for (Base l : left)
+        if (doEquals(l, r)) {
+          f = true;
+          break;
+        }
+      if (!f) {
+        ans = false;
+        break;
+      }
+    }
+    return makeBoolean(ans);
+  }
+
+  private List opPlus(List left, List right) throws PathEngineException {
+    if (left.size() == 0)
+      throw new PathEngineException("Error performing +: left operand has no value");
+    if (left.size() > 1)
+      throw new PathEngineException("Error performing +: left operand has more than one value");
+    if (!left.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType()));
+    if (right.size() == 0)
+      throw new PathEngineException("Error performing +: right operand has no value");
+    if (right.size() > 1)
+      throw new PathEngineException("Error performing +: right operand has more than one value");
+    if (!right.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing +: right operand has the wrong type (%s)", right.get(0).fhirType()));
+
+    List result = new ArrayList();
+    Base l = left.get(0);
+    Base r = right.get(0);
+    if (l.hasType("string", "id", "code", "uri") && r.hasType("string", "id", "code", "uri")) 
+      result.add(new StringType(l.primitiveValue() + r.primitiveValue()));
+    else if (l.hasType("integer") && r.hasType("integer")) 
+      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue())));
+    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) 
+      result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue()))));
+    else
+      throw new PathEngineException(String.format("Error performing +: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
+    return result;
+  }
+
+  private List opTimes(List left, List right) throws PathEngineException {
+    if (left.size() == 0)
+      throw new PathEngineException("Error performing *: left operand has no value");
+    if (left.size() > 1)
+      throw new PathEngineException("Error performing *: left operand has more than one value");
+    if (!left.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType()));
+    if (right.size() == 0)
+      throw new PathEngineException("Error performing *: right operand has no value");
+    if (right.size() > 1)
+      throw new PathEngineException("Error performing *: right operand has more than one value");
+    if (!right.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing *: right operand has the wrong type (%s)", right.get(0).fhirType()));
+
+    List result = new ArrayList();
+    Base l = left.get(0);
+    Base r = right.get(0);
+
+    if (l.hasType("integer") && r.hasType("integer")) 
+      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) * Integer.parseInt(r.primitiveValue())));
+    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) 
+      result.add(new DecimalType(new BigDecimal(l.primitiveValue()).multiply(new BigDecimal(r.primitiveValue()))));
+    else
+      throw new PathEngineException(String.format("Error performing *: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
+    return result;
+  }
+
+  private List opConcatenate(List left, List right) {
+    List result = new ArrayList();
+    result.add(new StringType(convertToString(left) + convertToString((right))));
+    return result;
+  }
+
+  private List opUnion(List left, List right) {
+    List result = new ArrayList();
+    for (Base item : left) {
+      if (!doContains(result, item))
+        result.add(item);
+    }
+    for (Base item : right) {
+      if (!doContains(result, item))
+        result.add(item);
+    }
+    return result;
+  }
+
+  private boolean doContains(List list, Base item) {
+    for (Base test : list)
+      if (doEquals(test, item))
+        return true;
+    return false;
+  }
+
+
+  private List opAnd(List left, List right) {
+    if (left.isEmpty() && right.isEmpty())
+      return new ArrayList();
+    else if (isBoolean(left, false) || isBoolean(right, false))
+      return makeBoolean(false);
+    else if (left.isEmpty() || right.isEmpty())
+      return new ArrayList();
+    else if (convertToBoolean(left) && convertToBoolean(right))
+      return makeBoolean(true);
+    else 
+      return makeBoolean(false);
+  }
+
+  private boolean isBoolean(List list, boolean b) {
+    return list.size() == 1 && list.get(0) instanceof BooleanType && ((BooleanType) list.get(0)).booleanValue() == b;
+  }
+
+  private List opOr(List left, List right) {
+    if (left.isEmpty() && right.isEmpty())
+      return new ArrayList();
+    else if (convertToBoolean(left) || convertToBoolean(right))
+      return makeBoolean(true);
+    else if (left.isEmpty() || right.isEmpty())
+      return new ArrayList();
+    else 
+      return makeBoolean(false);
+  }
+
+  private List opXor(List left, List right) {
+    if (left.isEmpty() || right.isEmpty())
+      return new ArrayList();
+    else 
+      return makeBoolean(convertToBoolean(left) ^ convertToBoolean(right));
+  }
+
+  private List opImplies(List left, List right) {
+    if (!convertToBoolean(left)) 
+      return makeBoolean(true);
+    else if (right.size() == 0)
+      return new ArrayList();      
+    else
+      return makeBoolean(convertToBoolean(right));
+  }
+
+
+  private List opMinus(List left, List right) throws PathEngineException {
+    if (left.size() == 0)
+      throw new PathEngineException("Error performing -: left operand has no value");
+    if (left.size() > 1)
+      throw new PathEngineException("Error performing -: left operand has more than one value");
+    if (!left.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType()));
+    if (right.size() == 0)
+      throw new PathEngineException("Error performing -: right operand has no value");
+    if (right.size() > 1)
+      throw new PathEngineException("Error performing -: right operand has more than one value");
+    if (!right.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing -: right operand has the wrong type (%s)", right.get(0).fhirType()));
+
+    List result = new ArrayList();
+    Base l = left.get(0);
+    Base r = right.get(0);
+
+    if (l.hasType("integer") && r.hasType("integer")) 
+      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) - Integer.parseInt(r.primitiveValue())));
+    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) 
+      result.add(new DecimalType(new BigDecimal(l.primitiveValue()).subtract(new BigDecimal(r.primitiveValue()))));
+    else
+      throw new PathEngineException(String.format("Error performing -: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
+    return result;
+  }
+
+  private List opDivideBy(List left, List right) throws PathEngineException {
+    if (left.size() == 0)
+      throw new PathEngineException("Error performing /: left operand has no value");
+    if (left.size() > 1)
+      throw new PathEngineException("Error performing /: left operand has more than one value");
+    if (!left.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType()));
+    if (right.size() == 0)
+      throw new PathEngineException("Error performing /: right operand has no value");
+    if (right.size() > 1)
+      throw new PathEngineException("Error performing /: right operand has more than one value");
+    if (!right.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing /: right operand has the wrong type (%s)", right.get(0).fhirType()));
+
+    List result = new ArrayList();
+    Base l = left.get(0);
+    Base r = right.get(0);
+
+    if (l.hasType("integer", "decimal", "unsignedInt", "positiveInt") && r.hasType("integer", "decimal", "unsignedInt", "positiveInt")) {
+      Decimal d1;
+      try {
+        d1 = new Decimal(l.primitiveValue());
+        Decimal d2 = new Decimal(r.primitiveValue());
+        result.add(new DecimalType(d1.divide(d2).asDecimal()));
+      } catch (UcumException e) {
+        throw new PathEngineException(e);
+      }
+    }
+    else
+      throw new PathEngineException(String.format("Error performing /: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
+    return result;
+  }
+
+  private List opDiv(List left, List right) throws PathEngineException {
+    if (left.size() == 0)
+      throw new PathEngineException("Error performing div: left operand has no value");
+    if (left.size() > 1)
+      throw new PathEngineException("Error performing div: left operand has more than one value");
+    if (!left.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing div: left operand has the wrong type (%s)", left.get(0).fhirType()));
+    if (right.size() == 0)
+      throw new PathEngineException("Error performing div: right operand has no value");
+    if (right.size() > 1)
+      throw new PathEngineException("Error performing div: right operand has more than one value");
+    if (!right.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing div: right operand has the wrong type (%s)", right.get(0).fhirType()));
+
+    List result = new ArrayList();
+    Base l = left.get(0);
+    Base r = right.get(0);
+
+    if (l.hasType("integer") && r.hasType("integer")) 
+      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) / Integer.parseInt(r.primitiveValue())));
+    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { 
+      Decimal d1;
+      try {
+        d1 = new Decimal(l.primitiveValue());
+        Decimal d2 = new Decimal(r.primitiveValue());
+        result.add(new IntegerType(d1.divInt(d2).asDecimal()));
+      } catch (UcumException e) {
+        throw new PathEngineException(e);
+      }
+    }
+    else
+      throw new PathEngineException(String.format("Error performing div: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
+    return result;
+  }
+
+  private List opMod(List left, List right) throws PathEngineException {
+    if (left.size() == 0)
+      throw new PathEngineException("Error performing mod: left operand has no value");
+    if (left.size() > 1)
+      throw new PathEngineException("Error performing mod: left operand has more than one value");
+    if (!left.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing mod: left operand has the wrong type (%s)", left.get(0).fhirType()));
+    if (right.size() == 0)
+      throw new PathEngineException("Error performing mod: right operand has no value");
+    if (right.size() > 1)
+      throw new PathEngineException("Error performing mod: right operand has more than one value");
+    if (!right.get(0).isPrimitive())
+      throw new PathEngineException(String.format("Error performing mod: right operand has the wrong type (%s)", right.get(0).fhirType()));
+
+    List result = new ArrayList();
+    Base l = left.get(0);
+    Base r = right.get(0);
+
+    if (l.hasType("integer") && r.hasType("integer")) 
+      result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) % Integer.parseInt(r.primitiveValue())));
+    else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) {
+      Decimal d1;
+      try {
+        d1 = new Decimal(l.primitiveValue());
+        Decimal d2 = new Decimal(r.primitiveValue());
+        result.add(new DecimalType(d1.modulo(d2).asDecimal()));
+      } catch (UcumException e) {
+        throw new PathEngineException(e);
+      }
+    }
+    else
+      throw new PathEngineException(String.format("Error performing mod: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
+    return result;
+  }
+
+
+  private TypeDetails readConstantType(ExecutionTypeContext context, String constant) throws PathEngineException {
+    if (constant.equals("true")) 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    else if (constant.equals("false")) 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    else if (Utilities.isInteger(constant))
+      return new TypeDetails(CollectionStatus.SINGLETON, "integer");
+    else if (Utilities.isDecimal(constant))
+      return new TypeDetails(CollectionStatus.SINGLETON, "decimal");
+    else if (constant.startsWith("%"))
+      return resolveConstantType(context, constant);
+    else
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+  }
+
+  private TypeDetails resolveConstantType(ExecutionTypeContext context, String s) throws PathEngineException {
+    if (s.equals("%sct"))
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    else if (s.equals("%loinc"))
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    else if (s.equals("%ucum"))
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    else if (s.equals("%resource")) {
+      if (context.resource == null)
+        throw new PathEngineException("%resource cannot be used in this context");
+      return new TypeDetails(CollectionStatus.SINGLETON, context.resource);
+    } else if (s.equals("%context")) {
+      return new TypeDetails(CollectionStatus.SINGLETON, context.context);
+    } else if (s.equals("%map-codes"))
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    else if (s.equals("%us-zip"))
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    else if (s.startsWith("%\"vs-"))
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    else if (s.startsWith("%\"cs-"))
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    else if (s.startsWith("%\"ext-"))
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    else if (hostServices == null)
+      throw new PathEngineException("Unknown fixed constant type for '"+s+"'");
+    else
+      return hostServices.resolveConstantType(context.appInfo, s);
+  }
+
+	private List execute(ExecutionContext context, Base item, ExpressionNode exp, boolean atEntry) throws FHIRException {
+    List result = new ArrayList(); 
+    if (atEntry && Character.isUpperCase(exp.getName().charAt(0))) {// special case for start up
+      if (item.isResource() && item.fhirType().equals(exp.getName()))  
+        result.add(item);
+    } else 
+      getChildrenByName(item, exp.getName(), result);
+    if (result.size() == 0 && atEntry && context.appInfo != null) {
+      Base temp = hostServices.resolveConstant(context.appInfo, exp.getName());
+      if (temp != null) {
+        result.add(temp);
+      }
+    }
+    return result;
+  }	
+
+  private TypeDetails executeContextType(ExecutionTypeContext context, String name) throws PathEngineException, DefinitionException {
+    if (hostServices == null)
+      throw new PathEngineException("Unable to resolve context reference since no host services are provided");
+    return hostServices.resolveConstantType(context.appInfo, name);
+  }
+  
+  private TypeDetails executeType(String type, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException {
+    if (atEntry && Character.isUpperCase(exp.getName().charAt(0)) && tail(type).equals(exp.getName())) // special case for start up
+      return new TypeDetails(CollectionStatus.SINGLETON, type);
+    TypeDetails result = new TypeDetails(null);
+    getChildTypesByName(type, exp.getName(), result);
+    return result;
+  }
+
+
+  private String tail(String type) {
+    return type.contains("#") ? "" : type.substring(type.lastIndexOf("/")+1);
+  }
+
+
+  @SuppressWarnings("unchecked")
+  private TypeDetails evaluateFunctionType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp) throws PathEngineException, DefinitionException {
+    List paramTypes = new ArrayList();
+    if (exp.getFunction() == Function.Is || exp.getFunction() == Function.As)
+      paramTypes.add(new TypeDetails(CollectionStatus.SINGLETON, "string"));
+    else
+      for (ExpressionNode expr : exp.getParameters()) {
+        if (exp.getFunction() == Function.Where || exp.getFunction() == Function.Select || exp.getFunction() == Function.Repeat)
+          paramTypes.add(executeType(changeThis(context, focus), focus, expr, true));
+        else
+          paramTypes.add(executeType(context, focus, expr, true));
+      }
+    switch (exp.getFunction()) {
+    case Empty : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Not : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Exists : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case SubsetOf : {
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
+    }
+    case SupersetOf : {
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
+    }
+    case IsDistinct : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Distinct : 
+      return focus;
+    case Count : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "integer");
+    case Where : 
+      return focus;
+    case Select : 
+      return anything(focus.getCollectionStatus());
+    case All : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Repeat : 
+      return anything(focus.getCollectionStatus());
+    case Item : {
+      checkOrdered(focus, "item");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); 
+      return focus; 
+    }
+    case As : {
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, exp.getParameters().get(0).getName());
+    }
+    case Is : {
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
+    }
+    case Single :
+      return focus.toSingleton();
+    case First : {
+      checkOrdered(focus, "first");
+      return focus.toSingleton();
+    }
+    case Last : {
+      checkOrdered(focus, "last");
+      return focus.toSingleton();
+    }
+    case Tail : {
+      checkOrdered(focus, "tail");
+      return focus;
+    }
+    case Skip : {
+      checkOrdered(focus, "skip");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); 
+      return focus;
+    }
+    case Take : {
+      checkOrdered(focus, "take");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); 
+      return focus;
+    }
+    case Iif : {
+      TypeDetails types = new TypeDetails(null);
+      types.update(paramTypes.get(0));
+      if (paramTypes.size() > 1)
+        types.update(paramTypes.get(1));
+      return types;
+    }
+    case ToInteger : {
+      checkContextPrimitive(focus, "toInteger");
+      return new TypeDetails(CollectionStatus.SINGLETON, "integer");
+    }
+    case ToDecimal : {
+      checkContextPrimitive(focus, "toDecimal");
+      return new TypeDetails(CollectionStatus.SINGLETON, "decimal");
+    }
+    case ToString : {
+      checkContextPrimitive(focus, "toString");
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    }
+    case Substring : {
+      checkContextString(focus, "subString");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer"), new TypeDetails(CollectionStatus.SINGLETON, "integer")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "string"); 
+    }
+    case StartsWith : {
+      checkContextString(focus, "startsWith");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
+    }
+    case EndsWith : {
+      checkContextString(focus, "endsWith");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
+    }
+    case Matches : {
+      checkContextString(focus, "matches");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); 
+    }
+    case ReplaceMatches : {
+      checkContextString(focus, "replaceMatches");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "string"); 
+    }
+    case Contains : {
+      checkContextString(focus, "contains");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    }
+    case Replace : {
+      checkContextString(focus, "replace");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "string");
+    }
+    case Length : { 
+      checkContextPrimitive(focus, "length");
+      return new TypeDetails(CollectionStatus.SINGLETON, "integer");
+    }
+    case Children : 
+      return childTypes(focus, "*");
+    case Descendants : 
+      return childTypes(focus, "**");
+    case MemberOf : {
+      checkContextCoded(focus, "memberOf");
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    }
+    case Trace : {
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return focus; 
+    }
+    case Today : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "date");
+    case Now : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "dateTime");
+    case Resolve : {
+      checkContextReference(focus, "resolve");
+      return new TypeDetails(CollectionStatus.SINGLETON, "DomainResource"); 
+    }
+    case Extension : {
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return new TypeDetails(CollectionStatus.SINGLETON, "Extension"); 
+    }
+    case HasValue : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "boolean");
+    case Alias : 
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return anything(CollectionStatus.SINGLETON); 
+    case AliasAs : 
+      checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); 
+      return focus; 
+    case Custom : {
+      return hostServices.checkFunction(context.appInfo, exp.getName(), paramTypes);
+    }
+    default:
+      break;
+    }
+    throw new Error("not Implemented yet");
+  }
+
+
+  private void checkParamTypes(String funcName, List paramTypes, TypeDetails... typeSet) throws PathEngineException {
+    int i = 0;
+    for (TypeDetails pt : typeSet) {
+      if (i == paramTypes.size())
+        return;
+      TypeDetails actual = paramTypes.get(i);
+      i++;
+      for (String a : actual.getTypes()) {
+        if (!pt.hasType(worker, a))
+          throw new PathEngineException("The parameter type '"+a+"' is not legal for "+funcName+" parameter "+Integer.toString(i)+". expecting "+pt.toString()); 
+      }
+    }
+  }
+
+  private void checkOrdered(TypeDetails focus, String name) throws PathEngineException {
+    if (focus.getCollectionStatus() == CollectionStatus.UNORDERED)
+      throw new PathEngineException("The function '"+name+"'() can only be used on ordered collections"); 
+  }
+
+  private void checkContextReference(TypeDetails focus, String name) throws PathEngineException {
+    if (!focus.hasType(worker, "string") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Reference"))
+      throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, Reference"); 
+  }
+
+
+  private void checkContextCoded(TypeDetails focus, String name) throws PathEngineException {
+    if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Coding") && !focus.hasType(worker, "CodeableConcept"))
+      throw new PathEngineException("The function '"+name+"'() can only be used on string, code, uri, Coding, CodeableConcept");     
+  }
+
+
+  private void checkContextString(TypeDetails focus, String name) throws PathEngineException {
+    if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "id"))
+      throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, code, id, but found "+focus.describe()); 
+  }
+
+
+  private void checkContextPrimitive(TypeDetails focus, String name) throws PathEngineException {
+    if (!focus.hasType(primitiveTypes))
+      throw new PathEngineException("The function '"+name+"'() can only be used on "+primitiveTypes.toString()); 
+  }
+
+
+  private TypeDetails childTypes(TypeDetails focus, String mask) throws PathEngineException, DefinitionException {
+    TypeDetails result = new TypeDetails(CollectionStatus.UNORDERED);
+    for (String f : focus.getTypes()) 
+      getChildTypesByName(f, mask, result);
+    return result;
+  }
+
+  private TypeDetails anything(CollectionStatus status) {
+    return new TypeDetails(status, allTypes.keySet());
+  }
+
+  //	private boolean isPrimitiveType(String s) {
+  //		return s.equals("boolean") || s.equals("integer") || s.equals("decimal") || s.equals("base64Binary") || s.equals("instant") || s.equals("string") || s.equals("uri") || s.equals("date") || s.equals("dateTime") || s.equals("time") || s.equals("code") || s.equals("oid") || s.equals("id") || s.equals("unsignedInt") || s.equals("positiveInt") || s.equals("markdown");
+  //	}
+
+	private List evaluateFunction(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    switch (exp.getFunction()) {
+    case Empty : return funcEmpty(context, focus, exp);
+    case Not : return funcNot(context, focus, exp);
+    case Exists : return funcExists(context, focus, exp);
+    case SubsetOf : return funcSubsetOf(context, focus, exp);
+    case SupersetOf : return funcSupersetOf(context, focus, exp);
+    case IsDistinct : return funcIsDistinct(context, focus, exp);
+    case Distinct : return funcDistinct(context, focus, exp);
+    case Count : return funcCount(context, focus, exp);
+    case Where : return funcWhere(context, focus, exp);
+    case Select : return funcSelect(context, focus, exp);
+    case All : return funcAll(context, focus, exp);
+    case Repeat : return funcRepeat(context, focus, exp);
+    case Item : return funcItem(context, focus, exp);
+    case As : return funcAs(context, focus, exp);
+    case Is : return funcIs(context, focus, exp);
+    case Single : return funcSingle(context, focus, exp);
+    case First : return funcFirst(context, focus, exp);
+    case Last : return funcLast(context, focus, exp);
+    case Tail : return funcTail(context, focus, exp);
+    case Skip : return funcSkip(context, focus, exp);
+    case Take : return funcTake(context, focus, exp);
+    case Iif : return funcIif(context, focus, exp);
+    case ToInteger : return funcToInteger(context, focus, exp);
+    case ToDecimal : return funcToDecimal(context, focus, exp);
+    case ToString : return funcToString(context, focus, exp);
+    case Substring : return funcSubstring(context, focus, exp);
+    case StartsWith : return funcStartsWith(context, focus, exp);
+    case EndsWith : return funcEndsWith(context, focus, exp);
+    case Matches : return funcMatches(context, focus, exp);
+    case ReplaceMatches : return funcReplaceMatches(context, focus, exp);
+    case Contains : return funcContains(context, focus, exp);
+    case Replace : return funcReplace(context, focus, exp);
+    case Length : return funcLength(context, focus, exp);
+    case Children : return funcChildren(context, focus, exp);
+    case Descendants : return funcDescendants(context, focus, exp);
+    case MemberOf : return funcMemberOf(context, focus, exp);
+    case Trace : return funcTrace(context, focus, exp);
+    case Today : return funcToday(context, focus, exp);
+    case Now : return funcNow(context, focus, exp);
+    case Resolve : return funcResolve(context, focus, exp);
+    case Extension : return funcExtension(context, focus, exp);
+    case HasValue : return funcHasValue(context, focus, exp);
+    case AliasAs : return funcAliasAs(context, focus, exp);
+    case Alias : return funcAlias(context, focus, exp);
+    case Custom: { 
+      List> params = new ArrayList>();
+      for (ExpressionNode p : exp.getParameters()) 
+        params.add(execute(context, focus, p, true));
+      return hostServices.executeFunction(context.appInfo, exp.getName(), params);
+    }
+    default:
+      throw new Error("not Implemented yet");
+    }
+  }
+
+	private List funcAliasAs(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List nl = execute(context, focus, exp.getParameters().get(0), true);
+    String name = nl.get(0).primitiveValue();
+    context.addAlias(name, focus);
+    return focus;
+  }
+
+  private List funcAlias(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List nl = execute(context, focus, exp.getParameters().get(0), true);
+    String name = nl.get(0).primitiveValue();
+    List res = new ArrayList();
+    Base b = context.getAlias(name);
+    if (b != null)
+      res.add(b);
+    return res;
+    
+  }
+
+	private List funcAll(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    if (exp.getParameters().size() == 1) {
+      List result = new ArrayList();
+      List pc = new ArrayList();
+      boolean all = true;
+      for (Base item : focus) {
+        pc.clear();
+        pc.add(item);
+        if (!convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), true))) {
+          all = false;
+          break;
+        }
+      }
+      result.add(new BooleanType(all));
+      return result;
+    } else {// (exp.getParameters().size() == 0) {
+      List result = new ArrayList();
+      boolean all = true;
+      for (Base item : focus) {
+        boolean v = false;
+        if (item instanceof BooleanType) {
+          v = ((BooleanType) item).booleanValue();
+        } else 
+          v = item != null;
+        if (!v) {
+          all = false;
+          break;
+        }
+      }
+      result.add(new BooleanType(all));
+      return result;
+    }
+  }
+
+
+  private ExecutionContext changeThis(ExecutionContext context, Base newThis) {
+    return new ExecutionContext(context.appInfo, context.resource, context.context, context.aliases, newThis);
+  }
+
+  private ExecutionTypeContext changeThis(ExecutionTypeContext context, TypeDetails newThis) {
+    return new ExecutionTypeContext(context.appInfo, context.resource, context.context, newThis);
+  }
+
+
+  private List funcNow(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    result.add(DateTimeType.now());
+    return result;
+  }
+
+
+  private List funcToday(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    result.add(new DateType(new Date(), TemporalPrecisionEnum.DAY));
+    return result;
+  }
+
+
+  private List funcMemberOf(ExecutionContext context, List focus, ExpressionNode exp) {
+    throw new Error("not Implemented yet");
+  }
+
+
+  private List funcDescendants(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    List current = new ArrayList();
+    current.addAll(focus);
+    List added = new ArrayList();
+    boolean more = true;
+    while (more) {
+      added.clear();
+      for (Base item : current) {
+        getChildrenByName(item, "*", added);
+      }
+      more = !added.isEmpty();
+      result.addAll(added);
+      current.clear();
+      current.addAll(added);
+    }
+    return result;
+  }
+
+
+  private List funcChildren(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    for (Base b : focus)
+      getChildrenByName(b, "*", result);
+    return result;
+  }
+
+
+  private List funcReplace(ExecutionContext context, List focus, ExpressionNode exp) {
+    throw new Error("not Implemented yet");
+  }
+
+
+  private List funcReplaceMatches(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
+
+    if (focus.size() == 1 && !Utilities.noString(sw))
+      result.add(new BooleanType(convertToString(focus.get(0)).contains(sw)));
+    else
+      result.add(new BooleanType(false));
+    return result;
+  }
+
+
+  private List funcEndsWith(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
+
+    if (focus.size() == 1 && !Utilities.noString(sw))
+      result.add(new BooleanType(convertToString(focus.get(0)).endsWith(sw)));
+    else
+      result.add(new BooleanType(false));
+    return result;
+  }
+
+
+  private List funcToString(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    result.add(new StringType(convertToString(focus)));
+    return result;
+  }
+
+
+  private List funcToDecimal(ExecutionContext context, List focus, ExpressionNode exp) {
+    String s = convertToString(focus);
+    List result = new ArrayList();
+    if (Utilities.isDecimal(s))
+      result.add(new DecimalType(s));
+    return result;
+  }
+
+
+  private List funcIif(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List n1 = execute(context, focus, exp.getParameters().get(0), true);
+    Boolean v = convertToBoolean(n1);
+
+    if (v)
+      return execute(context, focus, exp.getParameters().get(1), true);
+    else if (exp.getParameters().size() < 3)
+      return new ArrayList();
+    else
+      return execute(context, focus, exp.getParameters().get(2), true);
+  }
+
+
+  private List funcTake(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List n1 = execute(context, focus, exp.getParameters().get(0), true);
+    int i1 = Integer.parseInt(n1.get(0).primitiveValue());
+
+    List result = new ArrayList();
+    for (int i = 0; i < Math.min(focus.size(), i1); i++)
+      result.add(focus.get(i));
+    return result;
+  }
+
+
+  private List funcSingle(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException {
+    if (focus.size() == 1)
+      return focus;
+    throw new PathEngineException(String.format("Single() : checking for 1 item but found %d items", focus.size()));
+  }
+
+
+  private List funcIs(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException {
+    List result = new ArrayList();
+    if (focus.size() == 0 || focus.size() > 1) 
+      result.add(new BooleanType(false));
+    else {
+      String tn = exp.getParameters().get(0).getName();
+      result.add(new BooleanType(focus.get(0).hasType(tn)));
+    }
+    return result;
+  }
+
+
+  private List funcAs(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    String tn = exp.getParameters().get(0).getName();
+    for (Base b : focus)
+      if (b.hasType(tn))
+        result.add(b);
+    return result;
+  }
+
+
+  private List funcRepeat(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    List current = new ArrayList();
+    current.addAll(focus);
+    List added = new ArrayList();
+    boolean more = true;
+    while (more) {
+      added.clear();
+      List pc = new ArrayList();
+      for (Base item : current) {
+        pc.clear();
+        pc.add(item);
+        added.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), false));
+      }
+      more = !added.isEmpty();
+      result.addAll(added);
+      current.clear();
+      current.addAll(added);
+    }
+    return result;
+  }
+
+
+
+  private List funcIsDistinct(ExecutionContext context, List focus, ExpressionNode exp) {
+    if (focus.size() <= 1)
+      return makeBoolean(true);
+
+    boolean distinct = true;
+    for (int i = 0; i < focus.size(); i++) {
+      for (int j = i+1; j < focus.size(); j++) {
+        if (doEquals(focus.get(j), focus.get(i))) {
+          distinct = false;
+          break;
+        }
+      }
+    }
+    return makeBoolean(distinct);
+  }
+
+
+  private List funcSupersetOf(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List target = execute(context, focus, exp.getParameters().get(0), true);
+
+    boolean valid = true;
+    for (Base item : target) {
+      boolean found = false;
+      for (Base t : focus) {
+        if (Base.compareDeep(item, t, false)) {
+          found = true;
+          break;
+        }
+      }
+      if (!found) {
+        valid = false;
+        break;
+      }
+    }
+    List result = new ArrayList();
+    result.add(new BooleanType(valid));
+    return result;
+  }
+
+
+  private List funcSubsetOf(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List target = execute(context, focus, exp.getParameters().get(0), true);
+
+    boolean valid = true;
+    for (Base item : focus) {
+      boolean found = false;
+      for (Base t : target) {
+        if (Base.compareDeep(item, t, false)) {
+          found = true;
+          break;
+        }
+      }
+      if (!found) {
+        valid = false;
+        break;
+      }
+    }
+    List result = new ArrayList();
+    result.add(new BooleanType(valid));
+    return result;
+  }
+
+
+  private List funcExists(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    result.add(new BooleanType(!ElementUtil.isEmpty(focus)));
+    return result;
+  }
+
+
+  private List funcResolve(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    for (Base item : focus) {
+      if (hostServices != null) {
+        String s = convertToString(item);
+        if (item.fhirType().equals("Reference")) {
+          Property p = item.getChildByName("reference");
+          if (p.hasValues())
+            s = convertToString(p.getValues().get(0));
+        }
+        Base res = null;
+        if (s.startsWith("#")) {
+          String id = s.substring(1);
+          Property p = context.resource.getChildByName("contained");
+          for (Base c : p.getValues()) {
+            if (id.equals(c.getIdBase()))
+              res = c;
+          }
+        } else
+         res = hostServices.resolveReference(context.appInfo, s);
+        if (res != null)
+          result.add(res);
+      }
+    }
+    return result;
+  }
+
+	private List funcExtension(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    List nl = execute(context, focus, exp.getParameters().get(0), true);
+    String url = nl.get(0).primitiveValue();
+
+    for (Base item : focus) {
+      List ext = new ArrayList();
+      getChildrenByName(item, "extension", ext);
+      getChildrenByName(item, "modifierExtension", ext);
+      for (Base ex : ext) {
+        List vl = new ArrayList();
+        getChildrenByName(ex, "url", vl);
+        if (convertToString(vl).equals(url))
+          result.add(ex);
+      }
+    }
+    return result;
+  }
+
+	private List funcTrace(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List nl = execute(context, focus, exp.getParameters().get(0), true);
+    String name = nl.get(0).primitiveValue();
+
+    log(name, focus);
+    return focus;
+  }
+
+  private List funcDistinct(ExecutionContext context, List focus, ExpressionNode exp) {
+    if (focus.size() <= 1)
+      return focus;
+
+    List result = new ArrayList();
+    for (int i = 0; i < focus.size(); i++) {
+      boolean found = false;
+      for (int j = i+1; j < focus.size(); j++) {
+        if (doEquals(focus.get(j), focus.get(i))) {
+          found = true;
+          break;
+        }
+      }
+      if (!found)
+        result.add(focus.get(i));
+    }
+    return result;
+  }
+
+	private List funcMatches(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
+
+    if (focus.size() == 1 && !Utilities.noString(sw)) {
+      String st = convertToString(focus.get(0));
+      if (Utilities.noString(st))
+        result.add(new BooleanType(false));
+      else
+        result.add(new BooleanType(st.matches(sw)));
+    } else
+      result.add(new BooleanType(false));
+    return result;
+  }
+
+	private List funcContains(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
+
+    if (focus.size() == 1 && !Utilities.noString(sw)) {
+      String st = convertToString(focus.get(0));
+      if (Utilities.noString(st))
+        result.add(new BooleanType(false));
+      else
+        result.add(new BooleanType(st.contains(sw)));
+    }  else
+      result.add(new BooleanType(false));
+    return result;
+  }
+
+  private List funcLength(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    if (focus.size() == 1) {
+      String s = convertToString(focus.get(0));
+      result.add(new IntegerType(s.length()));
+    }
+    return result;
+  }
+
+  private List funcHasValue(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    if (focus.size() == 1) {
+      String s = convertToString(focus.get(0));
+      result.add(new BooleanType(!Utilities.noString(s)));
+    }
+    return result;
+  }
+
+	private List funcStartsWith(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true));
+
+    if (focus.size() == 1 && !Utilities.noString(sw))
+      result.add(new BooleanType(convertToString(focus.get(0)).startsWith(sw)));
+    else
+      result.add(new BooleanType(false));
+    return result;
+  }
+
+	private List funcSubstring(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    List n1 = execute(context, focus, exp.getParameters().get(0), true);
+    int i1 = Integer.parseInt(n1.get(0).primitiveValue());
+    int i2 = -1;
+    if (exp.parameterCount() == 2) {
+      List n2 = execute(context, focus, exp.getParameters().get(1), true);
+      i2 = Integer.parseInt(n2.get(0).primitiveValue());
+    }
+
+    if (focus.size() == 1) {
+      String sw = convertToString(focus.get(0));
+      String s;
+      if (i1 < 0 || i1 >= sw.length())
+        return new ArrayList();
+      if (exp.parameterCount() == 2)
+        s = sw.substring(i1, Math.min(sw.length(), i1+i2));
+      else
+        s = sw.substring(i1);
+      if (!Utilities.noString(s)) 
+        result.add(new StringType(s));
+    }
+    return result;
+  }
+
+  private List funcToInteger(ExecutionContext context, List focus, ExpressionNode exp) {
+    String s = convertToString(focus);
+    List result = new ArrayList();
+    if (Utilities.isInteger(s))
+      result.add(new IntegerType(s));
+    return result;
+  }
+
+  private List funcCount(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    result.add(new IntegerType(focus.size()));
+    return result;
+  }
+
+  private List funcSkip(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List n1 = execute(context, focus, exp.getParameters().get(0), true);
+    int i1 = Integer.parseInt(n1.get(0).primitiveValue());
+
+    List result = new ArrayList();
+    for (int i = i1; i < focus.size(); i++)
+      result.add(focus.get(i));
+    return result;
+  }
+
+  private List funcTail(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    for (int i = 1; i < focus.size(); i++)
+      result.add(focus.get(i));
+    return result;
+  }
+
+  private List funcLast(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    if (focus.size() > 0)
+      result.add(focus.get(focus.size()-1));
+    return result;
+  }
+
+  private List funcFirst(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+    if (focus.size() > 0)
+      result.add(focus.get(0));
+    return result;
+  }
+
+
+	private List funcWhere(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    List pc = new ArrayList();
+    for (Base item : focus) {
+      pc.clear();
+      pc.add(item);
+      if (convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), true)))
+        result.add(item);
+    }
+    return result;
+  }
+
+  private List funcSelect(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    List pc = new ArrayList();
+    for (Base item : focus) {
+      pc.clear();
+      pc.add(item);
+      result.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), true));
+    }
+    return result;
+  }
+
+
+	private List funcItem(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException {
+    List result = new ArrayList();
+    String s = convertToString(execute(context, focus, exp.getParameters().get(0), true));
+    if (Utilities.isInteger(s) && Integer.parseInt(s) < focus.size())
+      result.add(focus.get(Integer.parseInt(s)));
+    return result;
+  }
+
+  private List funcEmpty(ExecutionContext context, List focus, ExpressionNode exp) {
+    List result = new ArrayList();
+		result.add(new BooleanType(ElementUtil.isEmpty(focus)));
+    return result;
+  }
+
+  private List funcNot(ExecutionContext context, List focus, ExpressionNode exp) {
+    return makeBoolean(!convertToBoolean(focus));
+  }
+
+  public class ElementDefinitionMatch {
+    private ElementDefinition definition;
+    private String fixedType;
+    public ElementDefinitionMatch(ElementDefinition definition, String fixedType) {
+      super();
+      this.definition = definition;
+      this.fixedType = fixedType;
+    }
+    public ElementDefinition getDefinition() {
+      return definition;
+    }
+    public String getFixedType() {
+      return fixedType;
+    }
+
+  }
+
+  private void getChildTypesByName(String type, String name, TypeDetails result) throws PathEngineException, DefinitionException {
+    if (Utilities.noString(type))
+      throw new PathEngineException("No type provided in BuildToolPathEvaluator.getChildTypesByName");
+    if (type.equals("http://hl7.org/fhir/StructureDefinition/xhtml"))
+      return;
+    String url = null;
+    if (type.contains("#")) {
+      url = type.substring(0, type.indexOf("#"));
+    } else {
+      url = type;
+    }
+    String tail = "";
+    StructureDefinition sd = worker.fetchResource(StructureDefinition.class, url);
+    if (sd == null)
+      throw new DefinitionException("Unknown type "+type); // this really is an error, because we can only get to here if the internal infrastrucgture is wrong
+    List sdl = new ArrayList();
+    ElementDefinitionMatch m = null;
+    if (type.contains("#"))
+      m = getElementDefinition(sd, type.substring(type.indexOf("#")+1), false);
+    if (m != null && hasDataType(m.definition)) {
+      if (m.fixedType != null)
+      {
+        StructureDefinition dt = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+m.fixedType);
+        if (dt == null)
+          throw new DefinitionException("unknown data type "+m.fixedType);
+        sdl.add(dt);
+      } else
+        for (TypeRefComponent t : m.definition.getType()) {
+          StructureDefinition dt = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+t.getCode());
+          if (dt == null)
+            throw new DefinitionException("unknown data type "+t.getCode());
+          sdl.add(dt);
+        }
+    } else {
+      sdl.add(sd);
+      if (type.contains("#")) {
+        tail = type.substring(type.indexOf("#")+1);
+        tail = tail.substring(tail.indexOf("."));
+      }
+    }
+
+    for (StructureDefinition sdi : sdl) {
+      String path = sdi.getSnapshot().getElement().get(0).getPath()+tail+".";
+      if (name.equals("**")) {
+        assert(result.getCollectionStatus() == CollectionStatus.UNORDERED);
+        for (ElementDefinition ed : sdi.getSnapshot().getElement()) {
+          if (ed.getPath().startsWith(path))
+            for (TypeRefComponent t : ed.getType()) {
+              if (t.hasCode() && t.getCodeElement().hasValue()) {
+                String tn = null;
+                if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement"))
+                  tn = sdi.getType()+"#"+ed.getPath();
+                else
+                  tn = t.getCode();
+                if (t.getCode().equals("Resource")) {
+                  for (String rn : worker.getResourceNames()) {
+                    if (!result.hasType(worker, rn)) {
+                      getChildTypesByName(result.addType(rn), "**", result);
+                    }                  
+                  }
+                } else if (!result.hasType(worker, tn)) {
+                  getChildTypesByName(result.addType(tn), "**", result);
+                }
+              }
+            }
+        }      
+      } else if (name.equals("*")) {
+        assert(result.getCollectionStatus() == CollectionStatus.UNORDERED);
+        for (ElementDefinition ed : sdi.getSnapshot().getElement()) {
+          if (ed.getPath().startsWith(path) && !ed.getPath().substring(path.length()).contains("."))
+            for (TypeRefComponent t : ed.getType()) {
+              if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement"))
+                result.addType(sdi.getType()+"#"+ed.getPath());
+              else if (t.getCode().equals("Resource"))
+                result.addTypes(worker.getResourceNames());
+              else
+                result.addType(t.getCode());
+            }
+        }
+      } else {
+        path = sdi.getSnapshot().getElement().get(0).getPath()+tail+"."+name;
+
+        ElementDefinitionMatch ed = getElementDefinition(sdi, path, false);
+        if (ed != null) {
+          if (!Utilities.noString(ed.getFixedType()))
+            result.addType(ed.getFixedType());
+          else
+            for (TypeRefComponent t : ed.getDefinition().getType()) {
+              if (Utilities.noString(t.getCode()))
+                break; // throw new PathEngineException("Illegal reference to primitive value attribute @ "+path);
+
+              ProfiledType pt = null;
+              if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement"))
+                pt = new ProfiledType(sdi.getUrl()+"#"+path);
+              else if (t.getCode().equals("Resource"))
+                result.addTypes(worker.getResourceNames());
+              else
+                pt = new ProfiledType(t.getCode());
+              if (pt != null) {
+                if (t.hasProfile())
+                  pt.addProfile(t.getProfile());
+                if (ed.getDefinition().hasBinding())
+                  pt.addBinding(ed.getDefinition().getBinding());
+                result.addType(pt);
+              }
+            }
+        }
+      }
+    }
+  }
+
+  private ElementDefinitionMatch getElementDefinition(StructureDefinition sd, String path, boolean allowTypedName) throws PathEngineException {
+    for (ElementDefinition ed : sd.getSnapshot().getElement()) {
+      if (ed.getPath().equals(path)) {
+        if (ed.hasContentReference()) {
+          return getElementDefinitionById(sd, ed.getContentReference());
+        } else
+          return new ElementDefinitionMatch(ed, null);
+      }
+      if (ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() == ed.getPath().length()-3)
+        return new ElementDefinitionMatch(ed, null);
+      if (allowTypedName && ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() > ed.getPath().length()-3) {
+    	String s = Utilities.uncapitalize(path.substring(ed.getPath().length()-3));
+    	if (primitiveTypes.contains(s))
+          return new ElementDefinitionMatch(ed, s);
+    	else
+        return new ElementDefinitionMatch(ed, path.substring(ed.getPath().length()-3));
+      }
+      if (ed.getPath().contains(".") && path.startsWith(ed.getPath()+".") && (ed.getType().size() > 0) && !isAbstractType(ed.getType())) { 
+        // now we walk into the type.
+        if (ed.getType().size() > 1)  // if there's more than one type, the test above would fail this
+          throw new PathEngineException("Internal typing issue....");
+        StructureDefinition nsd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+ed.getType().get(0).getCode());
+  	    if (nsd == null) 
+  	      throw new PathEngineException("Unknown type "+ed.getType().get(0).getCode());
+        return getElementDefinition(nsd, nsd.getId()+path.substring(ed.getPath().length()), allowTypedName);
+      }
+      if (ed.hasContentReference() && path.startsWith(ed.getPath()+".")) {
+        ElementDefinitionMatch m = getElementDefinitionById(sd, ed.getContentReference());
+        return getElementDefinition(sd, m.definition.getPath()+path.substring(ed.getPath().length()), allowTypedName);
+      }
+    }
+    return null;
+  }
+
+  private boolean isAbstractType(List list) {
+	return list.size() != 1 ? true : Utilities.existsInList(list.get(0).getCode(), "Element", "BackboneElement", "Resource", "DomainResource");
+}
+
+
+  private boolean hasType(ElementDefinition ed, String s) {
+    for (TypeRefComponent t : ed.getType()) 
+      if (s.equalsIgnoreCase(t.getCode()))
+        return true;
+    return false;
+  }
+
+  private boolean hasDataType(ElementDefinition ed) {
+    return ed.hasType() && !(ed.getType().get(0).getCode().equals("Element") || ed.getType().get(0).getCode().equals("BackboneElement"));
+  }
+
+  private ElementDefinitionMatch getElementDefinitionById(StructureDefinition sd, String ref) {
+    for (ElementDefinition ed : sd.getSnapshot().getElement()) {
+      if (ref.equals("#"+ed.getId())) 
+        return new ElementDefinitionMatch(ed, null);
+    }
+    return null;
+  }
+
+
+  public boolean hasLog() {
+    return log != null && log.length() > 0;
+  }
+
+
+  public String takeLog() {
+    if (!hasLog())
+      return "";
+    String s = log.toString();
+    log = new StringBuilder();
+    return s;
+  }
+
+}
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/JsonTrackingParser.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/JsonTrackingParser.java
index 94cbe94c1dd..8134327a701 100644
--- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/JsonTrackingParser.java
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/JsonTrackingParser.java
@@ -1,494 +1,501 @@
-package org.hl7.fhir.dstu3.utils;
-
-import java.math.BigDecimal;
-import java.util.Map;
-import java.util.Stack;
-
-import org.hl7.fhir.exceptions.FHIRException;
-import org.hl7.fhir.utilities.Utilities;
-
-import com.google.gson.*;
-
-
-/**
- * This is created to get a json parser that can track line numbers... grr...
- * 
- * @author Grahame Grieve
- *
- */
-public class JsonTrackingParser {
-
-	public enum TokenType {
-		Open, Close, String, Number, Colon, Comma, OpenArray, CloseArray, Eof, Null, Boolean;
-	}
-	
-	public class LocationData {
-		private int line;
-		private int col;
-		
-		protected LocationData(int line, int col) {
-			super();
-			this.line = line;
-			this.col = col;
-		}
-		
-		public int getLine() {
-			return line;
-		}
-		
-		public int getCol() {
-			return col;
-		}
-		
-		public void newLine() {
-			line++;
-			col = 1;		
-		}
-
-		public LocationData copy() {
-			return new LocationData(line, col);
-		}
-	}
-	
-	private class State {
-		private String name;
-		private boolean isProp;
-		protected State(String name, boolean isProp) {
-			super();
-			this.name = name;
-			this.isProp = isProp;
-		}
-		public String getName() {
-			return name;
-		}
-		public boolean isProp() {
-			return isProp;
-		}
-	}
-	
-	private class Lexer {
-		private String source;
-		private int cursor;
-		private String peek;
-		private String value;
-		private TokenType type;
-		private Stack states = new Stack();
-		private LocationData lastLocationBWS;
-		private LocationData lastLocationAWS;
-		private LocationData location;
-		private StringBuilder b = new StringBuilder();
-		
-    public Lexer(String source) throws FHIRException {
-    	this.source = source;
-    	cursor = -1;
-    	location = new LocationData(1, 1);  
-    	start();
-    }
-    
-    private boolean more() {
-    	return peek != null || cursor < source.length(); 
-    }
-    
-    private String getNext(int length) throws FHIRException {
-    	String result = "";
-      if (peek != null) {
-      	if (peek.length() > length) {
-      		result = peek.substring(0, length);
-      		peek = peek.substring(length);
-      	} else {
-      		result = peek;
-      		peek = null;
-      	}
-      }
-      if (result.length() < length) {
-      	int len = length - result.length(); 
-      	if (cursor > source.length() - len) 
-      		throw error("Attempt to read past end of source");
-      	result = result + source.substring(cursor+1, cursor+len+1);
-      	cursor = cursor + len;
-      }
-       for (char ch : result.toCharArray())
-        if (ch == '\n')
-          location.newLine();
-        else
-          location.col++;
-      return result;
-    }
-    
-    private char getNextChar() throws FHIRException {
-      if (peek != null) {
-      	char ch = peek.charAt(0);
-      	peek = peek.length() == 1 ? null : peek.substring(1);
-      	return ch;
-      } else {
-        cursor++;
-        if (cursor >= source.length())
-          return (char) 0;
-        char ch = source.charAt(cursor);
-        if (ch == '\n') {
-          location.newLine();
-        } else {
-          location.col++;
-        }
-        return ch;
-      }
-    }
-    
-    private void push(char ch){
-    	peek = peek == null ? String.valueOf(ch) : String.valueOf(ch)+peek;
-    }
-    
-    private void parseWord(String word, char ch, TokenType type) throws FHIRException {
-      this.type = type;
-      value = ""+ch+getNext(word.length()-1);
-      if (!value.equals(word))
-      	throw error("Syntax error in json reading special word "+word);
-    }
-    
-    private FHIRException error(String msg) {
-      return new FHIRException("Error parsing JSON source: "+msg+" at Line "+Integer.toString(location.line)+" (path=["+path()+"])");
-    }
-    
-    private String path() {
-      if (states.empty())
-        return value;
-      else {
-      	String result = "";
-        for (State s : states) 
-          result = result + '/'+ s.getName();
-        result = result + value;
-        return result;
-      }
-    }
-
-    public void start() throws FHIRException {
-//      char ch = getNextChar();
-//      if (ch = '\.uEF')
-//      begin
-//        // skip BOM
-//        getNextChar();
-//        getNextChar();
-//      end
-//      else
-//        push(ch);
-      next();
-    }
-    
-    public TokenType getType() {
-    	return type;
-    }
-    
-    public String getValue() {
-    	return value;
-    }
-
-
-    public LocationData getLastLocationBWS() {
-    	return lastLocationBWS;
-    }
-
-    public LocationData getLastLocationAWS() {
-    	return lastLocationAWS;
-    }
-
-    public void next() throws FHIRException {
-    	lastLocationBWS = location.copy();
-    	char ch;
-    	do {
-    		ch = getNextChar();
-    	} while (more() && Utilities.charInSet(ch, ' ', '\r', '\n', '\t'));
-    	lastLocationAWS = location.copy();
-
-    	if (!more()) {
-    		type = TokenType.Eof;
-    	} else {
-    		switch (ch) {
-    		case '{' : 
-    			type = TokenType.Open;
-    			break;
-    		case '}' : 
-    			type = TokenType.Close;
-    			break;
-    		case '"' :
-    			type = TokenType.String;
-    			b.setLength(0);
-    			do {
-    				ch = getNextChar();
-    				if (ch == '\\') {
-    					ch = getNextChar();
-    					switch (ch) {
-    					case '"': b.append('"'); break;
-    					case '\\': b.append('\\'); break;
-    					case '/': b.append('/'); break;
-    					case 'n': b.append('\n'); break;
-    					case 'r': b.append('\r'); break;
-    					case 't': b.append('\t'); break;
-    					case 'u': b.append((char) Integer.parseInt(getNext(4), 16)); break;
-    					default :
-    						throw error("unknown escape sequence: \\"+ch);
-    					}
-    					ch = ' ';
-    				} else if (ch != '"')
-    					b.append(ch);
-    			} while (more() && (ch != '"'));
-    			if (!more())
-    				throw error("premature termination of json stream during a string");
-    			value = b.toString();
-    			break;
-    		case ':' : 
-    			type = TokenType.Colon;
-    			break;
-    		case ',' : 
-    			type = TokenType.Comma;
-    			break;
-    		case '[' : 
-    			type = TokenType.OpenArray;
-    			break;
-    		case ']' : 
-    			type = TokenType.CloseArray;
-    			break;
-    		case 't' : 
-    			parseWord("true", ch, TokenType.Boolean);
-    			break;
-    		case 'f' : 
-    			parseWord("false", ch, TokenType.Boolean);
-    			break;
-    		case 'n' : 
-    			parseWord("null", ch, TokenType.Null);
-    			break;
-    		default:
-    			if ((ch >= '0' && ch <= '9') || ch == '-') {
-    				type = TokenType.Number;
-    				b.setLength(0);
-    				while (more() && ((ch >= '0' && ch <= '9') || ch == '-' || ch == '.')) {
-    					b.append(ch);
-    					ch = getNextChar();
-    				}
-    				value = b.toString();
-    				push(ch);
-    			} else
-    				throw error("Unexpected char '"+ch+"' in json stream");
-    		}
-    	}
-    }
-
-    public String consume(TokenType type) throws FHIRException {
-      if (this.type != type)
-        throw error("JSON syntax error - found "+type.toString()+" expecting "+type.toString());
-      String result = value;
-      next();
-      return result;
-    }
-
-	}
-
-	enum ItemType {
-	  Object, String, Number, Boolean, Array, End, Eof, Null;
-	}
-	private Map map;
-  private Lexer lexer;
-  private ItemType itemType = ItemType.Object;
-  private String itemName;
-  private String itemValue;
-
-	public static JsonObject parse(String source, Map map) throws FHIRException {
-		JsonTrackingParser self = new JsonTrackingParser();
-		self.map = map;
-    return self.parse(source);
-	}
-
-	private JsonObject parse(String source) throws FHIRException {
-		lexer = new Lexer(source);
-		JsonObject result = new JsonObject();
-		LocationData loc = lexer.location.copy();
-    if (lexer.getType() == TokenType.Open) {
-      lexer.next();
-      lexer.states.push(new State("", false));
-    } 
-    else
-      throw lexer.error("Unexpected content at start of JSON: "+lexer.getType().toString());
-
-    parseProperty();
-    readObject(result, true);
-		map.put(result, loc);
-    return result;
-	}
-
-	private void readObject(JsonObject obj, boolean root) throws FHIRException {
-		map.put(obj, lexer.location.copy());
-
-		while (!(itemType == ItemType.End) || (root && (itemType == ItemType.Eof))) {
-			if (obj.has(itemName))
-				throw lexer.error("Duplicated property name: "+itemName);
-
-			switch (itemType) {
-			case Object:
-				JsonObject child = new JsonObject(); //(obj.path+'.'+ItemName);
-				LocationData loc = lexer.location.copy();
-				obj.add(itemName, child);
-				next();
-				readObject(child, false);
-				map.put(obj, loc);
-				break;
-			case Boolean :
-				JsonPrimitive v = new JsonPrimitive(Boolean.valueOf(itemValue));
-				obj.add(itemName, v);
-				map.put(v, lexer.location.copy());
-				break;
-			case String:
-				v = new JsonPrimitive(itemValue);
-				obj.add(itemName, v);
-				map.put(v, lexer.location.copy());
-				break;
-			case Number:
-				v = new JsonPrimitive(new BigDecimal(itemValue));
-				obj.add(itemName, v);
-				map.put(v, lexer.location.copy());
-				break;
-			case Null:
-				JsonNull n = new JsonNull();
-				obj.add(itemName, n);
-				map.put(n, lexer.location.copy());
-				break;
-			case Array:
-				JsonArray arr = new JsonArray(); // (obj.path+'.'+ItemName);
-				loc = lexer.location.copy();
-				obj.add(itemName, arr);
-				next();
-				readArray(arr, false);
-				map.put(arr, loc);
-				break;
-			case Eof : 
-				throw lexer.error("Unexpected End of File");
-			}
-			next();
-		}
-	}
-
-	private void readArray(JsonArray arr, boolean root) throws FHIRException {
-	  while (!((itemType == ItemType.End) || (root && (itemType == ItemType.Eof)))) {
-	    switch (itemType) {
-	    case Object:
-	    	JsonObject obj  = new JsonObject(); // (arr.path+'['+inttostr(i)+']');
-				LocationData loc = lexer.location.copy();
-	    	arr.add(obj);
-	      next();
-	      readObject(obj, false);
-				map.put(obj, loc);
-	      break;
-	    case String:
-	    	JsonPrimitive v = new JsonPrimitive(itemValue);
-				arr.add(v);
-				map.put(v, lexer.location.copy());
-				break;
-	    case Number:
-	    	v = new JsonPrimitive(new BigDecimal(itemValue));
-				arr.add(v);
-				map.put(v, lexer.location.copy());
-				break;
-	    case Null :
-	    	JsonNull n = new JsonNull();
-				arr.add(n);
-				map.put(n, lexer.location.copy());
-				break;
-	    case Array:
-        JsonArray child = new JsonArray(); // (arr.path+'['+inttostr(i)+']');
-				loc = lexer.location.copy();
-				arr.add(child);
-        next();
-	      readArray(child, false);
-				map.put(arr, loc);
-        break;
-	    case Eof : 
-	    	throw lexer.error("Unexpected End of File");
-	    }
-	    next();
-	  }
-	}
-
-	private void next() throws FHIRException {
-		switch (itemType) {
-		case Object :
-			lexer.consume(TokenType.Open);
-			lexer.states.push(new State(itemName, false));
-			if (lexer.getType() == TokenType.Close) {
-				itemType = ItemType.End;
-				lexer.next();
-			} else
-				parseProperty();
-			break;
-		case Null:
-		case String:
-		case Number: 
-		case End: 
-		case Boolean :
-			if (itemType == ItemType.End)
-				lexer.states.pop();
-			if (lexer.getType() == TokenType.Comma) {
-				lexer.next();
-				parseProperty();
-			} else if (lexer.getType() == TokenType.Close) {
-				itemType = ItemType.End;
-				lexer.next();
-			} else if (lexer.getType() == TokenType.CloseArray) {
-				itemType = ItemType.End;
-				lexer.next();
-			} else if (lexer.getType() == TokenType.Eof) {
-				itemType = ItemType.Eof;
-			} else
-				throw lexer.error("Unexpected JSON syntax");
-			break;
-		case Array :
-			lexer.next();
-			lexer.states.push(new State(itemName+"[]", true));
-			parseProperty();
-			break;
-		case Eof :
-			throw lexer.error("JSON Syntax Error - attempt to read past end of json stream");
-		default:
-			throw lexer.error("not done yet (a): "+itemType.toString());
-		}
-	}
-
-	private void parseProperty() throws FHIRException {
-		if (!lexer.states.peek().isProp) {
-			itemName = lexer.consume(TokenType.String);
-			itemValue = null;
-			lexer.consume(TokenType.Colon);
-		}
-		switch (lexer.getType()) {
-		case Null :
-			itemType = ItemType.Null;
-			itemValue = lexer.value;
-			lexer.next();
-			break;
-		case String :
-			itemType = ItemType.String;
-			itemValue = lexer.value;
-			lexer.next();
-			break;
-		case Boolean :
-			itemType = ItemType.Boolean;
-			itemValue = lexer.value;
-			lexer.next();
-			break;
-		case Number :
-			itemType = ItemType.Number;
-			itemValue = lexer.value;
-			lexer.next();
-			break;
-		case Open :
-			itemType = ItemType.Object;
-			break;
-		case OpenArray :
-			itemType = ItemType.Array;
-			break;
-		case CloseArray :
-			itemType = ItemType.End;
-			break;
-			// case Close, , case Colon, case Comma, case OpenArray,       !
-		default:
-			throw lexer.error("not done yet (b): "+lexer.getType().toString());
-		}
-	}
-}
+package org.hl7.fhir.dstu3.utils;
+
+import java.math.BigDecimal;
+import java.util.Map;
+import java.util.Stack;
+
+import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.utilities.Utilities;
+
+import com.google.gson.*;
+
+
+/**
+ * This is created to get a json parser that can track line numbers... grr...
+ * 
+ * @author Grahame Grieve
+ *
+ */
+public class JsonTrackingParser {
+
+	public enum TokenType {
+		Open, Close, String, Number, Colon, Comma, OpenArray, CloseArray, Eof, Null, Boolean;
+	}
+	
+	public class LocationData {
+		private int line;
+		private int col;
+		
+		protected LocationData(int line, int col) {
+			super();
+			this.line = line;
+			this.col = col;
+		}
+		
+		public int getLine() {
+			return line;
+		}
+		
+		public int getCol() {
+			return col;
+		}
+		
+		public void newLine() {
+			line++;
+			col = 1;		
+		}
+
+		public LocationData copy() {
+			return new LocationData(line, col);
+		}
+	}
+	
+	private class State {
+		private String name;
+		private boolean isProp;
+		protected State(String name, boolean isProp) {
+			super();
+			this.name = name;
+			this.isProp = isProp;
+		}
+		public String getName() {
+			return name;
+		}
+		public boolean isProp() {
+			return isProp;
+		}
+	}
+	
+	private class Lexer {
+		private String source;
+		private int cursor;
+		private String peek;
+		private String value;
+		private TokenType type;
+		private Stack states = new Stack();
+		private LocationData lastLocationBWS;
+		private LocationData lastLocationAWS;
+		private LocationData location;
+		private StringBuilder b = new StringBuilder();
+		
+    public Lexer(String source) throws FHIRException {
+    	this.source = source;
+    	cursor = -1;
+    	location = new LocationData(1, 1);  
+    	start();
+    }
+    
+    private boolean more() {
+    	return peek != null || cursor < source.length(); 
+    }
+    
+    private String getNext(int length) throws FHIRException {
+    	String result = "";
+      if (peek != null) {
+      	if (peek.length() > length) {
+      		result = peek.substring(0, length);
+      		peek = peek.substring(length);
+      	} else {
+      		result = peek;
+      		peek = null;
+      	}
+      }
+      if (result.length() < length) {
+      	int len = length - result.length(); 
+      	if (cursor > source.length() - len) 
+      		throw error("Attempt to read past end of source");
+      	result = result + source.substring(cursor+1, cursor+len+1);
+      	cursor = cursor + len;
+      }
+       for (char ch : result.toCharArray())
+        if (ch == '\n')
+          location.newLine();
+        else
+          location.col++;
+      return result;
+    }
+    
+    private char getNextChar() throws FHIRException {
+      if (peek != null) {
+      	char ch = peek.charAt(0);
+      	peek = peek.length() == 1 ? null : peek.substring(1);
+      	return ch;
+      } else {
+        cursor++;
+        if (cursor >= source.length())
+          return (char) 0;
+        char ch = source.charAt(cursor);
+        if (ch == '\n') {
+          location.newLine();
+        } else {
+          location.col++;
+        }
+        return ch;
+      }
+    }
+    
+    private void push(char ch){
+    	peek = peek == null ? String.valueOf(ch) : String.valueOf(ch)+peek;
+    }
+    
+    private void parseWord(String word, char ch, TokenType type) throws FHIRException {
+      this.type = type;
+      value = ""+ch+getNext(word.length()-1);
+      if (!value.equals(word))
+      	throw error("Syntax error in json reading special word "+word);
+    }
+    
+    private FHIRException error(String msg) {
+      return new FHIRException("Error parsing JSON source: "+msg+" at Line "+Integer.toString(location.line)+" (path=["+path()+"])");
+    }
+    
+    private String path() {
+      if (states.empty())
+        return value;
+      else {
+      	String result = "";
+        for (State s : states) 
+          result = result + '/'+ s.getName();
+        result = result + value;
+        return result;
+      }
+    }
+
+    public void start() throws FHIRException {
+//      char ch = getNextChar();
+//      if (ch = '\.uEF')
+//      begin
+//        // skip BOM
+//        getNextChar();
+//        getNextChar();
+//      end
+//      else
+//        push(ch);
+      next();
+    }
+    
+    public TokenType getType() {
+    	return type;
+    }
+    
+    public String getValue() {
+    	return value;
+    }
+
+
+    public LocationData getLastLocationBWS() {
+    	return lastLocationBWS;
+    }
+
+    public LocationData getLastLocationAWS() {
+    	return lastLocationAWS;
+    }
+
+    public void next() throws FHIRException {
+    	lastLocationBWS = location.copy();
+    	char ch;
+    	do {
+    		ch = getNextChar();
+    	} while (more() && Utilities.charInSet(ch, ' ', '\r', '\n', '\t'));
+    	lastLocationAWS = location.copy();
+
+    	if (!more()) {
+    		type = TokenType.Eof;
+    	} else {
+    		switch (ch) {
+    		case '{' : 
+    			type = TokenType.Open;
+    			break;
+    		case '}' : 
+    			type = TokenType.Close;
+    			break;
+    		case '"' :
+    			type = TokenType.String;
+    			b.setLength(0);
+    			do {
+    				ch = getNextChar();
+    				if (ch == '\\') {
+    					ch = getNextChar();
+    					switch (ch) {
+    					case '"': b.append('"'); break;
+    					case '\\': b.append('\\'); break;
+    					case '/': b.append('/'); break;
+    					case 'n': b.append('\n'); break;
+    					case 'r': b.append('\r'); break;
+    					case 't': b.append('\t'); break;
+    					case 'u': b.append((char) Integer.parseInt(getNext(4), 16)); break;
+    					default :
+    						throw error("unknown escape sequence: \\"+ch);
+    					}
+    					ch = ' ';
+    				} else if (ch != '"')
+    					b.append(ch);
+    			} while (more() && (ch != '"'));
+    			if (!more())
+    				throw error("premature termination of json stream during a string");
+    			value = b.toString();
+    			break;
+    		case ':' : 
+    			type = TokenType.Colon;
+    			break;
+    		case ',' : 
+    			type = TokenType.Comma;
+    			break;
+    		case '[' : 
+    			type = TokenType.OpenArray;
+    			break;
+    		case ']' : 
+    			type = TokenType.CloseArray;
+    			break;
+    		case 't' : 
+    			parseWord("true", ch, TokenType.Boolean);
+    			break;
+    		case 'f' : 
+    			parseWord("false", ch, TokenType.Boolean);
+    			break;
+    		case 'n' : 
+    			parseWord("null", ch, TokenType.Null);
+    			break;
+    		default:
+    			if ((ch >= '0' && ch <= '9') || ch == '-') {
+    				type = TokenType.Number;
+    				b.setLength(0);
+    				while (more() && ((ch >= '0' && ch <= '9') || ch == '-' || ch == '.')) {
+    					b.append(ch);
+    					ch = getNextChar();
+    				}
+    				value = b.toString();
+    				push(ch);
+    			} else
+    				throw error("Unexpected char '"+ch+"' in json stream");
+    		}
+    	}
+    }
+
+    public String consume(TokenType type) throws FHIRException {
+      if (this.type != type)
+        throw error("JSON syntax error - found "+type.toString()+" expecting "+type.toString());
+      String result = value;
+      next();
+      return result;
+    }
+
+	}
+
+	enum ItemType {
+	  Object, String, Number, Boolean, Array, End, Eof, Null;
+	}
+	private Map map;
+  private Lexer lexer;
+  private ItemType itemType = ItemType.Object;
+  private String itemName;
+  private String itemValue;
+
+	public static JsonObject parse(String source, Map map) throws FHIRException {
+		JsonTrackingParser self = new JsonTrackingParser();
+		self.map = map;
+    return self.parse(source);
+	}
+
+	private JsonObject parse(String source) throws FHIRException {
+		lexer = new Lexer(source);
+		JsonObject result = new JsonObject();
+		LocationData loc = lexer.location.copy();
+    if (lexer.getType() == TokenType.Open) {
+      lexer.next();
+      lexer.states.push(new State("", false));
+    } 
+    else
+      throw lexer.error("Unexpected content at start of JSON: "+lexer.getType().toString());
+
+    parseProperty();
+    readObject(result, true);
+		map.put(result, loc);
+    return result;
+	}
+
+	private void readObject(JsonObject obj, boolean root) throws FHIRException {
+		map.put(obj, lexer.location.copy());
+
+		while (!(itemType == ItemType.End) || (root && (itemType == ItemType.Eof))) {
+			if (obj.has(itemName))
+				throw lexer.error("Duplicated property name: "+itemName);
+
+			switch (itemType) {
+			case Object:
+				JsonObject child = new JsonObject(); //(obj.path+'.'+ItemName);
+				LocationData loc = lexer.location.copy();
+				obj.add(itemName, child);
+				next();
+				readObject(child, false);
+				map.put(obj, loc);
+				break;
+			case Boolean :
+				JsonPrimitive v = new JsonPrimitive(Boolean.valueOf(itemValue));
+				obj.add(itemName, v);
+				map.put(v, lexer.location.copy());
+				break;
+			case String:
+				v = new JsonPrimitive(itemValue);
+				obj.add(itemName, v);
+				map.put(v, lexer.location.copy());
+				break;
+			case Number:
+				v = new JsonPrimitive(new BigDecimal(itemValue));
+				obj.add(itemName, v);
+				map.put(v, lexer.location.copy());
+				break;
+			case Null:
+				JsonNull n = new JsonNull();
+				obj.add(itemName, n);
+				map.put(n, lexer.location.copy());
+				break;
+			case Array:
+				JsonArray arr = new JsonArray(); // (obj.path+'.'+ItemName);
+				loc = lexer.location.copy();
+				obj.add(itemName, arr);
+				next();
+				readArray(arr, false);
+				map.put(arr, loc);
+				break;
+			case Eof : 
+				throw lexer.error("Unexpected End of File");
+			case End:
+			   // TODO: anything?\
+            break;
+			}
+			next();
+		}
+	}
+
+	private void readArray(JsonArray arr, boolean root) throws FHIRException {
+	  while (!((itemType == ItemType.End) || (root && (itemType == ItemType.Eof)))) {
+	    switch (itemType) {
+	    case Object:
+	    	JsonObject obj  = new JsonObject(); // (arr.path+'['+inttostr(i)+']');
+				LocationData loc = lexer.location.copy();
+	    	arr.add(obj);
+	      next();
+	      readObject(obj, false);
+				map.put(obj, loc);
+	      break;
+	    case String:
+	    	JsonPrimitive v = new JsonPrimitive(itemValue);
+				arr.add(v);
+				map.put(v, lexer.location.copy());
+				break;
+	    case Number:
+	    	v = new JsonPrimitive(new BigDecimal(itemValue));
+				arr.add(v);
+				map.put(v, lexer.location.copy());
+				break;
+	    case Null :
+	    	JsonNull n = new JsonNull();
+				arr.add(n);
+				map.put(n, lexer.location.copy());
+				break;
+	    case Array:
+        JsonArray child = new JsonArray(); // (arr.path+'['+inttostr(i)+']');
+				loc = lexer.location.copy();
+				arr.add(child);
+        next();
+	      readArray(child, false);
+				map.put(arr, loc);
+        break;
+	    case Eof : 
+	    	throw lexer.error("Unexpected End of File");
+       case End:
+       case Boolean:
+         // TODO: anything?
+         break;
+	    }
+	    next();
+	  }
+	}
+
+	private void next() throws FHIRException {
+		switch (itemType) {
+		case Object :
+			lexer.consume(TokenType.Open);
+			lexer.states.push(new State(itemName, false));
+			if (lexer.getType() == TokenType.Close) {
+				itemType = ItemType.End;
+				lexer.next();
+			} else
+				parseProperty();
+			break;
+		case Null:
+		case String:
+		case Number: 
+		case End: 
+		case Boolean :
+			if (itemType == ItemType.End)
+				lexer.states.pop();
+			if (lexer.getType() == TokenType.Comma) {
+				lexer.next();
+				parseProperty();
+			} else if (lexer.getType() == TokenType.Close) {
+				itemType = ItemType.End;
+				lexer.next();
+			} else if (lexer.getType() == TokenType.CloseArray) {
+				itemType = ItemType.End;
+				lexer.next();
+			} else if (lexer.getType() == TokenType.Eof) {
+				itemType = ItemType.Eof;
+			} else
+				throw lexer.error("Unexpected JSON syntax");
+			break;
+		case Array :
+			lexer.next();
+			lexer.states.push(new State(itemName+"[]", true));
+			parseProperty();
+			break;
+		case Eof :
+			throw lexer.error("JSON Syntax Error - attempt to read past end of json stream");
+		default:
+			throw lexer.error("not done yet (a): "+itemType.toString());
+		}
+	}
+
+	private void parseProperty() throws FHIRException {
+		if (!lexer.states.peek().isProp) {
+			itemName = lexer.consume(TokenType.String);
+			itemValue = null;
+			lexer.consume(TokenType.Colon);
+		}
+		switch (lexer.getType()) {
+		case Null :
+			itemType = ItemType.Null;
+			itemValue = lexer.value;
+			lexer.next();
+			break;
+		case String :
+			itemType = ItemType.String;
+			itemValue = lexer.value;
+			lexer.next();
+			break;
+		case Boolean :
+			itemType = ItemType.Boolean;
+			itemValue = lexer.value;
+			lexer.next();
+			break;
+		case Number :
+			itemType = ItemType.Number;
+			itemValue = lexer.value;
+			lexer.next();
+			break;
+		case Open :
+			itemType = ItemType.Object;
+			break;
+		case OpenArray :
+			itemType = ItemType.Array;
+			break;
+		case CloseArray :
+			itemType = ItemType.End;
+			break;
+			// case Close, , case Colon, case Comma, case OpenArray,       !
+		default:
+			throw lexer.error("not done yet (b): "+lexer.getType().toString());
+		}
+	}
+}
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/StructureMapUtilities.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/StructureMapUtilities.java
index 7f3ca68c8ca..cdd491e1c0f 100644
--- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/StructureMapUtilities.java
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/StructureMapUtilities.java
@@ -1,2723 +1,2727 @@
-package org.hl7.fhir.dstu3.utils;
-
-// remember group resolution
-// trace - account for which wasn't transformed in the source
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
-import org.hl7.fhir.dstu3.conformance.ProfileUtilities.ProfileKnowledgeProvider;
-import org.hl7.fhir.dstu3.context.IWorkerContext;
-import org.hl7.fhir.dstu3.context.IWorkerContext.ValidationResult;
-import org.hl7.fhir.dstu3.elementmodel.Element;
-import org.hl7.fhir.dstu3.elementmodel.Property;
-import org.hl7.fhir.dstu3.model.Base;
-import org.hl7.fhir.dstu3.model.BooleanType;
-import org.hl7.fhir.dstu3.model.CodeType;
-import org.hl7.fhir.dstu3.model.CodeableConcept;
-import org.hl7.fhir.dstu3.model.Coding;
-import org.hl7.fhir.dstu3.model.ConceptMap;
-import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent;
-import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent;
-import org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent;
-import org.hl7.fhir.dstu3.model.Constants;
-import org.hl7.fhir.dstu3.model.ContactDetail;
-import org.hl7.fhir.dstu3.model.ContactPoint;
-import org.hl7.fhir.dstu3.model.DecimalType;
-import org.hl7.fhir.dstu3.model.ElementDefinition;
-import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent;
-import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
-import org.hl7.fhir.dstu3.model.Enumeration;
-import org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence;
-import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;
-import org.hl7.fhir.dstu3.model.ExpressionNode;
-import org.hl7.fhir.dstu3.model.ExpressionNode.CollectionStatus;
-import org.hl7.fhir.dstu3.model.IdType;
-import org.hl7.fhir.dstu3.model.IntegerType;
-import org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus;
-import org.hl7.fhir.dstu3.model.PrimitiveType;
-import org.hl7.fhir.dstu3.model.Reference;
-import org.hl7.fhir.dstu3.model.Resource;
-import org.hl7.fhir.dstu3.model.ResourceFactory;
-import org.hl7.fhir.dstu3.model.StringType;
-import org.hl7.fhir.dstu3.model.StructureDefinition;
-import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent;
-import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule;
-import org.hl7.fhir.dstu3.model.StructureMap;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent;
-import org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform;
-import org.hl7.fhir.dstu3.model.Type;
-import org.hl7.fhir.dstu3.model.TypeDetails;
-import org.hl7.fhir.dstu3.model.TypeDetails.ProfiledType;
-import org.hl7.fhir.dstu3.model.UriType;
-import org.hl7.fhir.dstu3.model.ValueSet;
-import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent;
-import org.hl7.fhir.dstu3.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
-import org.hl7.fhir.dstu3.utils.FHIRLexer.FHIRLexerException;
-import org.hl7.fhir.dstu3.utils.FHIRPathEngine.IEvaluationContext;
-import org.hl7.fhir.exceptions.DefinitionException;
-import org.hl7.fhir.exceptions.FHIRException;
-import org.hl7.fhir.exceptions.PathEngineException;
-import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
-import org.hl7.fhir.utilities.TextFile;
-import org.hl7.fhir.utilities.Utilities;
-import org.hl7.fhir.utilities.xhtml.NodeType;
-import org.hl7.fhir.utilities.xhtml.XhtmlNode;
-
-/**
- * Services in this class:
- * 
- * string render(map) - take a structure and convert it to text
- * map parse(text) - take a text representation and parse it 
- * getTargetType(map) - return the definition for the type to create to hand in 
- * transform(appInfo, source, map, target) - transform from source to target following the map
- * analyse(appInfo, map) - generate profiles and other analysis artifacts for the targets of the transform
- * map generateMapFromMappings(StructureDefinition) - build a mapping from a structure definition with loigcal mappings
- *  
- * @author Grahame Grieve
- *
- */
-public class StructureMapUtilities {
-
-	public class ResolvedGroup {
-    public StructureMapGroupComponent target;
-    public StructureMap targetMap;
-  }
-  public static final String MAP_WHERE_CHECK = "map.where.check";
-	public static final String MAP_WHERE_EXPRESSION = "map.where.expression";
-	public static final String MAP_SEARCH_EXPRESSION = "map.search.expression";
-	public static final String MAP_EXPRESSION = "map.transform.expression";
-  private static final boolean RENDER_MULTIPLE_TARGETS_ONELINE = true;
-  private static final String AUTO_VAR_NAME = "vvv";
-
-	public interface ITransformerServices {
-		//    public boolean validateByValueSet(Coding code, String valuesetId);
-	  public void log(String message); // log internal progress
-	  public Base createType(Object appInfo, String name) throws FHIRException;
-    public Base createResource(Object appInfo, Base res); // an already created resource is provided; this is to identify/store it
-		public Coding translate(Object appInfo, Coding source, String conceptMapUrl) throws FHIRException;
-		//    public Coding translate(Coding code)
-		//    ValueSet validation operation
-		//    Translation operation
-		//    Lookup another tree of data
-		//    Create an instance tree
-		//    Return the correct string format to refer to a tree (input or output)
-    public Base resolveReference(Object appContext, String url);
-    public List performSearch(Object appContext, String url);
-	}
-
-	private class FFHIRPathHostServices implements IEvaluationContext{
-
-    public Base resolveConstant(Object appContext, String name) throws PathEngineException {
-      Variables vars = (Variables) appContext;
-      Base res = vars.get(VariableMode.INPUT, name);
-      if (res == null)
-        res = vars.get(VariableMode.OUTPUT, name);
-      return res;
-    }
-
-    @Override
-    public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException {
-      if (!(appContext instanceof VariablesForProfiling)) 
-        throw new Error("Internal Logic Error (wrong type '"+appContext.getClass().getName()+"' in resolveConstantType)");
-      VariablesForProfiling vars = (VariablesForProfiling) appContext;
-      VariableForProfiling v = vars.get(null, name);
-      if (v == null)
-        throw new PathEngineException("Unknown variable '"+name+"' from variables "+vars.summary());
-      return v.property.types;
-    }
-
-    @Override
-    public boolean log(String argument, List focus) {
-      throw new Error("Not Implemented Yet");
-    }
-
-    @Override
-    public FunctionDetails resolveFunction(String functionName) {
-      return null; // throw new Error("Not Implemented Yet");
-    }
-
-    @Override
-    public TypeDetails checkFunction(Object appContext, String functionName, List parameters) throws PathEngineException {
-      throw new Error("Not Implemented Yet");
-    }
-
-    @Override
-    public List executeFunction(Object appContext, String functionName, List> parameters) {
-      throw new Error("Not Implemented Yet");
-    }
-
-    @Override
-    public Base resolveReference(Object appContext, String url) {
-      if (services == null)
-        return null;
-      return services.resolveReference(appContext, url);
-    }
-	  
-	}
-	private IWorkerContext worker;
-	private FHIRPathEngine fpe;
-	private Map library;
-	private ITransformerServices services;
-  private ProfileKnowledgeProvider pkp;
-  private Map ids = new HashMap(); 
-
-	public StructureMapUtilities(IWorkerContext worker, Map library, ITransformerServices services, ProfileKnowledgeProvider pkp) {
-		super();
-		this.worker = worker;
-		this.library = library;
-		this.services = services;
-		this.pkp = pkp;
-		fpe = new FHIRPathEngine(worker);
-		fpe.setHostServices(new FFHIRPathHostServices());
-	}
-
-	public StructureMapUtilities(IWorkerContext worker, Map library, ITransformerServices services) {
-		super();
-		this.worker = worker;
-		this.library = library;
-		this.services = services;
-		fpe = new FHIRPathEngine(worker);
-    fpe.setHostServices(new FFHIRPathHostServices());
-	}
-
-  public StructureMapUtilities(IWorkerContext worker, Map library) {
-    super();
-    this.worker = worker;
-    this.library = library;
-    fpe = new FHIRPathEngine(worker);
-    fpe.setHostServices(new FFHIRPathHostServices());
-  }
-
-  public StructureMapUtilities(IWorkerContext worker) {
-    super();
-    this.worker = worker;
-    fpe = new FHIRPathEngine(worker);
-    fpe.setHostServices(new FFHIRPathHostServices());
-  }
-
-  public StructureMapUtilities(IWorkerContext worker, ITransformerServices services) {
-    super();
-    this.worker = worker;
-    this.library = new HashMap();
-    for (org.hl7.fhir.dstu3.model.MetadataResource bc : worker.allConformanceResources()) {
-      if (bc instanceof StructureMap)
-        library.put(bc.getUrl(), (StructureMap) bc);
-    }
-    this.services = services;
-    fpe = new FHIRPathEngine(worker);
-    fpe.setHostServices(new FFHIRPathHostServices());
-  }
-
-	public static String render(StructureMap map) {
-		StringBuilder b = new StringBuilder();
-		b.append("map \"");
-		b.append(map.getUrl());
-		b.append("\" = \"");
-		b.append(Utilities.escapeJava(map.getName()));
-		b.append("\"\r\n\r\n");
-
-		renderConceptMaps(b, map);
-		renderUses(b, map);
-		renderImports(b, map);
-		for (StructureMapGroupComponent g : map.getGroup())
-			renderGroup(b, g);
-		return b.toString();
-	}
-
-	private static void renderConceptMaps(StringBuilder b, StructureMap map) {
-    for (Resource r : map.getContained()) {
-      if (r instanceof ConceptMap) {
-        produceConceptMap(b, (ConceptMap) r);
-      }
-    }
-  }
-
-  private static void produceConceptMap(StringBuilder b, ConceptMap cm) {
-    b.append("conceptmap \"");
-    b.append(cm.getId());
-    b.append("\" {\r\n");
-    Map prefixesSrc = new HashMap();
-    Map prefixesTgt = new HashMap();
-    char prefix = 's';
-    for (ConceptMapGroupComponent cg : cm.getGroup()) {
-      if (!prefixesSrc.containsKey(cg.getSource())) {
-        prefixesSrc.put(cg.getSource(), String.valueOf(prefix));
-        b.append("  prefix ");
-        b.append(prefix);
-        b.append(" = \"");
-        b.append(cg.getSource());
-        b.append("\"\r\n");
-        prefix++;
-      }
-      if (!prefixesTgt.containsKey(cg.getTarget())) {
-        prefixesTgt.put(cg.getTarget(), String.valueOf(prefix));
-        b.append("  prefix ");
-        b.append(prefix);
-        b.append(" = \"");
-        b.append(cg.getTarget());
-        b.append("\"\r\n");
-        prefix++;
-      }
-    }
-    b.append("\r\n");
-    for (ConceptMapGroupComponent cg : cm.getGroup()) {
-      for (SourceElementComponent ce : cg.getElement()) {
-        b.append("  ");
-        b.append(prefixesSrc.get(cg.getSource()));
-        b.append(":");
-        b.append(ce.getCode());
-        b.append(" ");
-        b.append(getChar(ce.getTargetFirstRep().getEquivalence()));
-        b.append(" ");
-        b.append(prefixesTgt.get(cg.getTarget()));
-        b.append(":");
-        b.append(ce.getTargetFirstRep().getCode());
-        b.append("\r\n");
-      }
-    }
-    b.append("}\r\n\r\n");
-  }
-
-  private static Object getChar(ConceptMapEquivalence equivalence) {
-    switch (equivalence) {
-    case RELATEDTO: return "-";
-    case EQUAL: return "=";
-    case EQUIVALENT: return "==";
-    case DISJOINT: return "!=";
-    case UNMATCHED: return "--";
-    case WIDER: return "<=";
-    case SUBSUMES: return "<-";
-    case NARROWER: return ">=";
-    case SPECIALIZES: return ">-";
-    case INEXACT: return "~";
-    default: return "??";
-    }
-  }
-
-  private static void renderUses(StringBuilder b, StructureMap map) {
-		for (StructureMapStructureComponent s : map.getStructure()) {
-			b.append("uses \"");
-			b.append(s.getUrl());
-      b.append("\" ");
-      if (s.hasAlias()) {
-        b.append("alias ");
-        b.append(s.getAlias());
-        b.append(" ");
-      }
-      b.append("as ");
-			b.append(s.getMode().toCode());
-			b.append("\r\n");
-			renderDoco(b, s.getDocumentation());
-		}
-		if (map.hasStructure())
-			b.append("\r\n");
-	}
-
-	private static void renderImports(StringBuilder b, StructureMap map) {
-		for (UriType s : map.getImport()) {
-			b.append("imports \"");
-			b.append(s.getValue());
-			b.append("\"\r\n");
-		}
-		if (map.hasImport())
-			b.append("\r\n");
-	}
-
-  public static String groupToString(StructureMapGroupComponent g) {
-    StringBuilder b = new StringBuilder();
-    renderGroup(b, g);
-    return b.toString();
-  }
-  
-  private static void renderGroup(StringBuilder b, StructureMapGroupComponent g) {
-		b.append("group ");
-    switch (g.getTypeMode()) {
-    case TYPES: b.append("for types");
-    case TYPEANDTYPES: b.append("for type+types ");
-    default: // NONE, NULL
-    }
-      b.append("for types ");
-		b.append(g.getName());
-		if (g.hasExtends()) {
-			b.append(" extends ");
-			b.append(g.getExtends());
-		}
-		if (g.hasDocumentation()) 
-			renderDoco(b, g.getDocumentation());
-		b.append("\r\n");
-		for (StructureMapGroupInputComponent gi : g.getInput()) {
-			b.append("  input ");
-			b.append(gi.getName());
-			if (gi.hasType()) {
-				b.append(" : ");
-				b.append(gi.getType());
-			}
-			b.append(" as ");
-			b.append(gi.getMode().toCode());
-			b.append("\r\n");
-		}
-		if (g.hasInput())
-			b.append("\r\n");
-		for (StructureMapGroupRuleComponent r : g.getRule()) {
-			renderRule(b, r, 2);
-		}
-		b.append("\r\nendgroup\r\n");
-	}
-
-  public static String ruleToString(StructureMapGroupRuleComponent r) {
-    StringBuilder b = new StringBuilder();
-    renderRule(b, r, 0);
-    return b.toString();
-  }
-  
-	private static void renderRule(StringBuilder b, StructureMapGroupRuleComponent r, int indent) {
-		for (int i = 0; i < indent; i++)
-			b.append(' ');
-		b.append(r.getName());
-		b.append(" : for ");
-		boolean canBeAbbreviated = checkisSimple(r);
-		
-		boolean first = true;
-		for (StructureMapGroupRuleSourceComponent rs : r.getSource()) {
-			if (first)
-				first = false;
-			else
-				b.append(", ");
-			renderSource(b, rs, canBeAbbreviated);
-		}
-		if (r.getTarget().size() > 1) {
-			b.append(" make ");
-			first = true;
-			for (StructureMapGroupRuleTargetComponent rt : r.getTarget()) {
-				if (first)
-					first = false;
-				else
-					b.append(", ");
-				if (RENDER_MULTIPLE_TARGETS_ONELINE)
-	        b.append(' ');
-				else {
-				b.append("\r\n");
-				for (int i = 0; i < indent+4; i++)
-					b.append(' ');
-				}
-				renderTarget(b, rt, false);
-			}
-		} else if (r.hasTarget()) { 
-			b.append(" make ");
-			renderTarget(b, r.getTarget().get(0), canBeAbbreviated);
-		}
-		if (!canBeAbbreviated) {
-		  if (r.hasRule()) {
-		    b.append(" then {\r\n");
-		    renderDoco(b, r.getDocumentation());
-		    for (StructureMapGroupRuleComponent ir : r.getRule()) {
-		      renderRule(b, ir, indent+2);
-		    }
-		    for (int i = 0; i < indent; i++)
-		      b.append(' ');
-		    b.append("}\r\n");
-		  } else {
-		    if (r.hasDependent()) {
-		      b.append(" then ");
-		      first = true;
-		      for (StructureMapGroupRuleDependentComponent rd : r.getDependent()) {
-		        if (first)
-		          first = false;
-		        else
-		          b.append(", ");
-		        b.append(rd.getName());
-		        b.append("(");
-		        boolean ifirst = true;
-		        for (StringType rdp : rd.getVariable()) {
-		          if (ifirst)
-		            ifirst = false;
-		          else
-		            b.append(", ");
-		          b.append(rdp.asStringValue());
-		        }
-		        b.append(")");
-		      }
-		    }
-		  }
-		}
-    renderDoco(b, r.getDocumentation());
-    b.append("\r\n");
-	}
-
-  private static boolean checkisSimple(StructureMapGroupRuleComponent r) {
-    return 
-          (r.getSource().size() == 1 && r.getSourceFirstRep().hasElement() && r.getSourceFirstRep().hasVariable()) && 
-          (r.getTarget().size() == 1 && r.getTargetFirstRep().hasVariable() && (r.getTargetFirstRep().getTransform() == null || r.getTargetFirstRep().getTransform() == StructureMapTransform.CREATE) && r.getTargetFirstRep().getParameter().size() == 0) &&
-          (r.getDependent().size() == 0);
-  }
-
-  public static String sourceToString(StructureMapGroupRuleSourceComponent r) {
-    StringBuilder b = new StringBuilder();
-    renderSource(b, r, false);
-    return b.toString();
-  }
-  
-	private static void renderSource(StringBuilder b, StructureMapGroupRuleSourceComponent rs, boolean abbreviate) {
-		b.append(rs.getContext());
-		if (rs.getContext().equals("@search")) {
-      b.append('(');
-      b.append(rs.getElement());
-      b.append(')');
-		} else if (rs.hasElement()) {
-			b.append('.');
-			b.append(rs.getElement());
-		}
-		if (rs.hasType()) {
-      b.append(" : ");
-      b.append(rs.getType());
-      if (rs.hasMin()) {
-        b.append(" ");
-        b.append(rs.getMin());
-        b.append("..");
-        b.append(rs.getMax());
-      }
-		}
-		
-		if (rs.hasListMode()) {
-			b.append(" ");
-				b.append(rs.getListMode().toCode());
-		}
-		if (rs.hasDefaultValue()) {
-		  b.append(" default ");
-		  assert rs.getDefaultValue() instanceof StringType;
-		  b.append("\""+Utilities.escapeJson(((StringType) rs.getDefaultValue()).asStringValue())+"\"");
-		}
-		if (!abbreviate && rs.hasVariable()) {
-			b.append(" as ");
-			b.append(rs.getVariable());
-		}
-		if (rs.hasCondition())  {
-			b.append(" where ");
-			b.append(rs.getCondition());
-		}
-		if (rs.hasCheck())  {
-			b.append(" check ");
-			b.append(rs.getCheck());
-		}
-	}
-
-  public static String targetToString(StructureMapGroupRuleTargetComponent rt) {
-    StringBuilder b = new StringBuilder();
-    renderTarget(b, rt, false);
-    return b.toString();
-  }
-	
-	private static void renderTarget(StringBuilder b, StructureMapGroupRuleTargetComponent rt, boolean abbreviate) {
-	  if (rt.hasContext()) {
-	    if (rt.getContextType() == StructureMapContextType.TYPE)
-	      b.append("@");
-		b.append(rt.getContext());
-		if (rt.hasElement())  {
-			b.append('.');
-			b.append(rt.getElement());
-		}
-	  }
-		if (!abbreviate && rt.hasTransform()) {
-	    if (rt.hasContext()) 
-			b.append(" = ");
-			if (rt.getTransform() == StructureMapTransform.COPY && rt.getParameter().size() == 1) {
-				renderTransformParam(b, rt.getParameter().get(0));
-      } else if (rt.getTransform() == StructureMapTransform.EVALUATE && rt.getParameter().size() == 1) {
-        b.append("(");
-        b.append("\""+((StringType) rt.getParameter().get(0).getValue()).asStringValue()+"\"");
-        b.append(")");
-			} else if (rt.getTransform() == StructureMapTransform.EVALUATE && rt.getParameter().size() == 2) {
-				b.append(rt.getTransform().toCode());
-				b.append("(");
-				b.append(((IdType) rt.getParameter().get(0).getValue()).asStringValue());
-				b.append("\""+((StringType) rt.getParameter().get(1).getValue()).asStringValue()+"\"");
-				b.append(")");
-			} else {
-				b.append(rt.getTransform().toCode());
-				b.append("(");
-				boolean first = true;
-				for (StructureMapGroupRuleTargetParameterComponent rtp : rt.getParameter()) {
-					if (first)
-						first = false;
-					else
-						b.append(", ");
-					renderTransformParam(b, rtp);
-				}
-				b.append(")");
-			}
-		}
-		if (!abbreviate && rt.hasVariable()) {
-			b.append(" as ");
-			b.append(rt.getVariable());
-		}
-		for (Enumeration lm : rt.getListMode()) {
-			b.append(" ");
-			b.append(lm.getValue().toCode());
-			if (lm.getValue() == StructureMapTargetListMode.SHARE) {
-				b.append(" ");
-				b.append(rt.getListRuleId());
-			}
-		}
-	}
-
-  public static String paramToString(StructureMapGroupRuleTargetParameterComponent rtp) {
-    StringBuilder b = new StringBuilder();
-    renderTransformParam(b, rtp);
-    return b.toString();
-  }
-  	
-	private static void renderTransformParam(StringBuilder b, StructureMapGroupRuleTargetParameterComponent rtp) {
-	  try {
-		if (rtp.hasValueBooleanType())
-			b.append(rtp.getValueBooleanType().asStringValue());
-		else if (rtp.hasValueDecimalType())
-			b.append(rtp.getValueDecimalType().asStringValue());
-		else if (rtp.hasValueIdType())
-			b.append(rtp.getValueIdType().asStringValue());
-		else if (rtp.hasValueDecimalType())
-			b.append(rtp.getValueDecimalType().asStringValue());
-		else if (rtp.hasValueIntegerType())
-			b.append(rtp.getValueIntegerType().asStringValue());
-		else 
-	      b.append("\""+Utilities.escapeJava(rtp.getValueStringType().asStringValue())+"\"");
-	  } catch (FHIRException e) {
-	    e.printStackTrace();
-	    b.append("error!");
-	  }
-	}
-
-	private static void renderDoco(StringBuilder b, String doco) {
-		if (Utilities.noString(doco))
-			return;
-		b.append(" // ");
-		b.append(doco.replace("\r\n", " ").replace("\r", " ").replace("\n", " "));
-	}
-
-	public StructureMap parse(String text) throws FHIRException {
-		FHIRLexer lexer = new FHIRLexer(text);
-		if (lexer.done())
-			throw lexer.error("Map Input cannot be empty");
-		lexer.skipComments();
-		lexer.token("map");
-		StructureMap result = new StructureMap();
-		result.setUrl(lexer.readConstant("url"));
-		lexer.token("=");
-		result.setName(lexer.readConstant("name"));
-		lexer.skipComments();
-
-		while (lexer.hasToken("conceptmap"))
-			parseConceptMap(result, lexer);
-
-		while (lexer.hasToken("uses"))
-			parseUses(result, lexer);
-		while (lexer.hasToken("imports"))
-			parseImports(result, lexer);
-
-		parseGroup(result, lexer);
-
-		while (!lexer.done()) {
-			parseGroup(result, lexer);    
-		}
-
-		return result;
-	}
-
-	private void parseConceptMap(StructureMap result, FHIRLexer lexer) throws FHIRLexerException {
-		lexer.token("conceptmap");
-		ConceptMap map = new ConceptMap();
-		String id = lexer.readConstant("map id");
-		if (!id.startsWith("#"))
-			lexer.error("Concept Map identifier must start with #");
-		map.setId(id);
-		map.setStatus(PublicationStatus.DRAFT); // todo: how to add this to the text format
-		result.getContained().add(map);
-		lexer.token("{");
-		lexer.skipComments();
-		//	  lexer.token("source");
-		//	  map.setSource(new UriType(lexer.readConstant("source")));
-		//	  lexer.token("target");
-		//	  map.setSource(new UriType(lexer.readConstant("target")));
-		Map prefixes = new HashMap();
-		while (lexer.hasToken("prefix")) {
-			lexer.token("prefix");
-			String n = lexer.take();
-			lexer.token("=");
-			String v = lexer.readConstant("prefix url");
-			prefixes.put(n, v);
-		}
-		while (!lexer.hasToken("}")) {
-		  String srcs = readPrefix(prefixes, lexer);
-			lexer.token(":");
-      String sc = lexer.getCurrent().startsWith("\"") ? lexer.readConstant("code") : lexer.take();
-		  ConceptMapEquivalence eq = readEquivalence(lexer);
-		  String tgts = (eq != ConceptMapEquivalence.UNMATCHED) ? readPrefix(prefixes, lexer) : "";
-		  ConceptMapGroupComponent g = getGroup(map, srcs, tgts);
-			SourceElementComponent e = g.addElement();
-			e.setCode(sc);
-      if (e.getCode().startsWith("\""))
-        e.setCode(lexer.processConstant(e.getCode()));
-			TargetElementComponent tgt = e.addTarget();
-			if (eq != ConceptMapEquivalence.EQUIVALENT)
-			  tgt.setEquivalence(eq);
-			if (tgt.getEquivalence() != ConceptMapEquivalence.UNMATCHED) {
-				lexer.token(":");
-				tgt.setCode(lexer.take());
-				if (tgt.getCode().startsWith("\""))
-				  tgt.setCode(lexer.processConstant(tgt.getCode()));
-			}
-			if (lexer.hasComment())
-				tgt.setComment(lexer.take().substring(2).trim());
-		}
-		lexer.token("}");
-	}
-
-
-	private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
-	  for (ConceptMapGroupComponent grp : map.getGroup()) {
-	    if (grp.getSource().equals(srcs)) 
-	      if ((tgts == null && !grp.hasTarget()) || (tgts != null && tgts.equals(grp.getTarget())))
-	      return grp;
-	  }
-	  ConceptMapGroupComponent grp = map.addGroup(); 
-    grp.setSource(srcs);
-    grp.setTarget(tgts);
-    return grp;
-  }
-
-
-	private String readPrefix(Map prefixes, FHIRLexer lexer) throws FHIRLexerException {
-		String prefix = lexer.take();
-		if (!prefixes.containsKey(prefix))
-			throw lexer.error("Unknown prefix '"+prefix+"'");
-		return prefixes.get(prefix);
-	}
-
-
-	private ConceptMapEquivalence readEquivalence(FHIRLexer lexer) throws FHIRLexerException {
-		String token = lexer.take();
-    if (token.equals("-"))
-      return ConceptMapEquivalence.RELATEDTO;
-    if (token.equals("="))
-      return ConceptMapEquivalence.EQUAL;
-		if (token.equals("=="))
-			return ConceptMapEquivalence.EQUIVALENT;
-		if (token.equals("!="))
-			return ConceptMapEquivalence.DISJOINT;
-		if (token.equals("--"))
-			return ConceptMapEquivalence.UNMATCHED;
-		if (token.equals("<="))
-			return ConceptMapEquivalence.WIDER;
-		if (token.equals("<-"))
-			return ConceptMapEquivalence.SUBSUMES;
-		if (token.equals(">="))
-			return ConceptMapEquivalence.NARROWER;
-		if (token.equals(">-"))
-			return ConceptMapEquivalence.SPECIALIZES;
-		if (token.equals("~"))
-			return ConceptMapEquivalence.INEXACT;
-		throw lexer.error("Unknown equivalence token '"+token+"'");
-	}
-
-
-	private void parseUses(StructureMap result, FHIRLexer lexer) throws FHIRException {
-		lexer.token("uses");
-		StructureMapStructureComponent st = result.addStructure();
-		st.setUrl(lexer.readConstant("url"));
-		if (lexer.hasToken("alias")) {
-	    lexer.token("alias");
-		  st.setAlias(lexer.take());
-		}
-		lexer.token("as");
-		st.setMode(StructureMapModelMode.fromCode(lexer.take()));
-		lexer.skipToken(";");
-		if (lexer.hasComment()) {
-			st.setDocumentation(lexer.take().substring(2).trim());
-		}
-		lexer.skipComments();
-	}
-
-	private void parseImports(StructureMap result, FHIRLexer lexer) throws FHIRException {
-		lexer.token("imports");
-		result.addImport(lexer.readConstant("url"));
-		lexer.skipToken(";");
-		if (lexer.hasComment()) {
-			lexer.next();
-		}
-		lexer.skipComments();
-	}
-
-	private void parseGroup(StructureMap result, FHIRLexer lexer) throws FHIRException {
-		lexer.token("group");
-		StructureMapGroupComponent group = result.addGroup();
-		if (lexer.hasToken("for")) {
-		  lexer.token("for");
-		  if ("type".equals(lexer.getCurrent())) {
-        lexer.token("type");
-        lexer.token("+");
-        lexer.token("types");
-        group.setTypeMode(StructureMapGroupTypeMode.TYPEANDTYPES);
-		  } else {
-		    lexer.token("types");
-        group.setTypeMode(StructureMapGroupTypeMode.TYPES);
-		  }
-		} else
-		  group.setTypeMode(StructureMapGroupTypeMode.NONE);
-		group.setName(lexer.take());
-		if (lexer.hasToken("extends")) {
-			lexer.next();
-			group.setExtends(lexer.take());
-		}
-		lexer.skipComments();
-		while (lexer.hasToken("input")) 
-			parseInput(group, lexer);
-		while (!lexer.hasToken("endgroup")) {
-			if (lexer.done())
-				throw lexer.error("premature termination expecting 'endgroup'");
-			parseRule(result, group.getRule(), lexer);
-		}
-		lexer.next();
-		lexer.skipComments();
-	}
-
-	private void parseInput(StructureMapGroupComponent group, FHIRLexer lexer) throws FHIRException {
-		lexer.token("input");
-		StructureMapGroupInputComponent input = group.addInput();
-		input.setName(lexer.take());
-		if (lexer.hasToken(":")) {
-			lexer.token(":");
-			input.setType(lexer.take());
-		}
-		lexer.token("as");
-		input.setMode(StructureMapInputMode.fromCode(lexer.take()));
-		if (lexer.hasComment()) {
-			input.setDocumentation(lexer.take().substring(2).trim());
-		}
-		lexer.skipToken(";");
-		lexer.skipComments();
-	}
-
-	private void parseRule(StructureMap map, List list, FHIRLexer lexer) throws FHIRException {
-		StructureMapGroupRuleComponent rule = new StructureMapGroupRuleComponent(); 
-		list.add(rule);
-		rule.setName(lexer.takeDottedToken());
-		lexer.token(":");
-		lexer.token("for");
-		boolean done = false;
-		while (!done) {
-			parseSource(rule, lexer);
-			done = !lexer.hasToken(",");
-			if (!done)
-				lexer.next();
-		}
-		if (lexer.hasToken("make")) {
-			lexer.token("make");
-			done = false;
-			while (!done) {
-				parseTarget(rule, lexer);
-				done = !lexer.hasToken(",");
-				if (!done)
-					lexer.next();
-			}
-		}
-		if (lexer.hasToken("then")) {
-			lexer.token("then");
-			if (lexer.hasToken("{")) {
-				lexer.token("{");
-				if (lexer.hasComment()) {
-					rule.setDocumentation(lexer.take().substring(2).trim());
-				}
-				lexer.skipComments();
-				while (!lexer.hasToken("}")) {
-					if (lexer.done())
-						throw lexer.error("premature termination expecting '}' in nested group");
-					parseRule(map, rule.getRule(), lexer);
-				}      
-				lexer.token("}");
-			} else {
-				done = false;
-				while (!done) {
-					parseRuleReference(rule, lexer);
-					done = !lexer.hasToken(",");
-					if (!done)
-						lexer.next();
-				}
-			}
-		} else if (lexer.hasComment()) {
-			rule.setDocumentation(lexer.take().substring(2).trim());
-		}
-		if (isSimpleSyntax(rule)) {
-		  rule.getSourceFirstRep().setVariable(AUTO_VAR_NAME);
-		  rule.getTargetFirstRep().setVariable(AUTO_VAR_NAME);
-		  rule.getTargetFirstRep().setTransform(StructureMapTransform.CREATE); // with no parameter - e.g. imply what is to be created
-		  // no dependencies - imply what is to be done based on types
-		}
-		lexer.skipComments();
-	}
-
-	private boolean isSimpleSyntax(StructureMapGroupRuleComponent rule) {
-    return 
-        (rule.getSource().size() == 1 && rule.getSourceFirstRep().hasContext() && rule.getSourceFirstRep().hasElement() && !rule.getSourceFirstRep().hasVariable()) &&
-        (rule.getTarget().size() == 1 && rule.getTargetFirstRep().hasContext() && rule.getTargetFirstRep().hasElement() && !rule.getTargetFirstRep().hasVariable() && !rule.getTargetFirstRep().hasParameter()) &&
-        (rule.getDependent().size() == 0 && rule.getRule().size() == 0);
-  }
-
-  private void parseRuleReference(StructureMapGroupRuleComponent rule, FHIRLexer lexer) throws FHIRLexerException {
-		StructureMapGroupRuleDependentComponent ref = rule.addDependent();
-		ref.setName(lexer.take());
-		lexer.token("(");
-		boolean done = false;
-		while (!done) {
-			ref.addVariable(lexer.take());
-			done = !lexer.hasToken(",");
-			if (!done)
-				lexer.next();
-		}
-		lexer.token(")");
-	}
-
-	private void parseSource(StructureMapGroupRuleComponent rule, FHIRLexer lexer) throws FHIRException {
-		StructureMapGroupRuleSourceComponent source = rule.addSource();
-		source.setContext(lexer.take());
-		if (source.getContext().equals("search") && lexer.hasToken("(")) {
-	    source.setContext("@search");
-      lexer.take();
-      ExpressionNode node = fpe.parse(lexer);
-      source.setUserData(MAP_SEARCH_EXPRESSION, node);
-      source.setElement(node.toString());
-      lexer.token(")");
-		} else if (lexer.hasToken(".")) {
-			lexer.token(".");
-			source.setElement(lexer.take());
-		}
-		if (lexer.hasToken(":")) {
-		  // type and cardinality
-		  lexer.token(":");
-		  source.setType(lexer.takeDottedToken());
-		  if (!lexer.hasToken("as", "first", "last", "not_first", "not_last", "only_one", "default")) {
-		    source.setMin(lexer.takeInt());
-		    lexer.token("..");
-		    source.setMax(lexer.take());
-		  }
-		}
-		if (lexer.hasToken("default")) {
-		  lexer.token("default");
-		  source.setDefaultValue(new StringType(lexer.readConstant("default value")));
-		}
-		if (Utilities.existsInList(lexer.getCurrent(), "first", "last", "not_first", "not_last", "only_one"))
-			source.setListMode(StructureMapSourceListMode.fromCode(lexer.take()));
-
-		if (lexer.hasToken("as")) {
-			lexer.take();
-			source.setVariable(lexer.take());
-		}
-		if (lexer.hasToken("where")) {
-			lexer.take();
-			ExpressionNode node = fpe.parse(lexer);
-			source.setUserData(MAP_WHERE_EXPRESSION, node);
-			source.setCondition(node.toString());
-		}
-		if (lexer.hasToken("check")) {
-			lexer.take();
-			ExpressionNode node = fpe.parse(lexer);
-			source.setUserData(MAP_WHERE_CHECK, node);
-			source.setCheck(node.toString());
-		}
-	}
-
-	private void parseTarget(StructureMapGroupRuleComponent rule, FHIRLexer lexer) throws FHIRException {
-		StructureMapGroupRuleTargetComponent target = rule.addTarget();
-		String start = lexer.take();
-		if (lexer.hasToken(".")) {
-	    target.setContext(start);
-	    target.setContextType(StructureMapContextType.VARIABLE);
-	    start = null;
-			lexer.token(".");
-			target.setElement(lexer.take());
-		}
-		String name;
-		boolean isConstant = false;
-		if (lexer.hasToken("=")) {
-		  if (start != null)
-	      target.setContext(start);
-			lexer.token("=");
-			isConstant = lexer.isConstant(true);
-			name = lexer.take();
-		} else 
-		  name = start;
-		
-		if ("(".equals(name)) {
-		  // inline fluentpath expression
-      target.setTransform(StructureMapTransform.EVALUATE);
-      ExpressionNode node = fpe.parse(lexer);
-      target.setUserData(MAP_EXPRESSION, node);
-      target.addParameter().setValue(new StringType(node.toString()));
-      lexer.token(")");
-		} else if (lexer.hasToken("(")) {
-				target.setTransform(StructureMapTransform.fromCode(name));
-				lexer.token("(");
-				if (target.getTransform() == StructureMapTransform.EVALUATE) {
-					parseParameter(target, lexer);
-					lexer.token(",");
-					ExpressionNode node = fpe.parse(lexer);
-					target.setUserData(MAP_EXPRESSION, node);
-					target.addParameter().setValue(new StringType(node.toString()));
-				} else { 
-					while (!lexer.hasToken(")")) {
-						parseParameter(target, lexer);
-						if (!lexer.hasToken(")"))
-							lexer.token(",");
-					}       
-				}
-				lexer.token(")");
-		} else if (name != null) {
-				target.setTransform(StructureMapTransform.COPY);
-				if (!isConstant) {
-					String id = name;
-					while (lexer.hasToken(".")) {
-						id = id + lexer.take() + lexer.take();
-					}
-					target.addParameter().setValue(new IdType(id));
-				}
-				else 
-					target.addParameter().setValue(readConstant(name, lexer));
-			}
-		if (lexer.hasToken("as")) {
-			lexer.take();
-			target.setVariable(lexer.take());
-		}
-		while (Utilities.existsInList(lexer.getCurrent(), "first", "last", "share", "collate")) {
-			if (lexer.getCurrent().equals("share")) {
-				target.addListMode(StructureMapTargetListMode.SHARE);
-				lexer.next();
-				target.setListRuleId(lexer.take());
-			} else if (lexer.getCurrent().equals("first")) 
-				target.addListMode(StructureMapTargetListMode.FIRST);
-			else
-				target.addListMode(StructureMapTargetListMode.LAST);
-			lexer.next();
-		}
-	}
-
-
-	private void parseParameter(StructureMapGroupRuleTargetComponent target, FHIRLexer lexer) throws FHIRLexerException {
-		if (!lexer.isConstant(true)) {
-			target.addParameter().setValue(new IdType(lexer.take()));
-		} else if (lexer.isStringConstant())
-			target.addParameter().setValue(new StringType(lexer.readConstant("??")));
-		else {
-			target.addParameter().setValue(readConstant(lexer.take(), lexer));
-		}
-	}
-
-	private Type readConstant(String s, FHIRLexer lexer) throws FHIRLexerException {
-		if (Utilities.isInteger(s))
-			return new IntegerType(s);
-		else if (Utilities.isDecimal(s))
-			return new DecimalType(s);
-		else if (Utilities.existsInList(s, "true", "false"))
-			return new BooleanType(s.equals("true"));
-		else 
-			return new StringType(lexer.processConstant(s));        
-	}
-
-	public StructureDefinition getTargetType(StructureMap map) throws FHIRException {
-	  boolean found = false;
-	  StructureDefinition res = null;
-	  for (StructureMapStructureComponent uses : map.getStructure()) {
-	    if (uses.getMode() == StructureMapModelMode.TARGET) {
-	      if (found)
-	        throw new FHIRException("Multiple targets found in map "+map.getUrl());
-	      found = true;
-	      res = worker.fetchResource(StructureDefinition.class, uses.getUrl());
-	      if (res == null)
-	        throw new FHIRException("Unable to find "+uses.getUrl()+" referenced from map "+map.getUrl());      
-	    }
-	  }
-	  if (res == null)
-      throw new FHIRException("No targets found in map "+map.getUrl());
-	  return res;
-	}
-
-	public enum VariableMode {
-		INPUT, OUTPUT
-	}
-
-	public class Variable {
-		private VariableMode mode;
-		private String name;
-		private Base object;
-		public Variable(VariableMode mode, String name, Base object) {
-			super();
-			this.mode = mode;
-			this.name = name;
-			this.object = object;
-		}
-		public VariableMode getMode() {
-			return mode;
-		}
-		public String getName() {
-			return name;
-		}
-		public Base getObject() {
-			return object;
-		}
-    public String summary() {
-      return name+": "+object.fhirType();
-    }
-	}
-
-	public class Variables {
-		private List list = new ArrayList();
-
-		public void add(VariableMode mode, String name, Base object) {
-			Variable vv = null;
-			for (Variable v : list) 
-				if ((v.mode == mode) && v.getName().equals(name))
-					vv = v;
-			if (vv != null)
-				list.remove(vv);
-			list.add(new Variable(mode, name, object));
-		}
-
-		public Variables copy() {
-			Variables result = new Variables();
-			result.list.addAll(list);
-			return result;
-		}
-
-		public Base get(VariableMode mode, String name) {
-			for (Variable v : list) 
-				if ((v.mode == mode) && v.getName().equals(name))
-					return v.getObject();
-			return null;
-		}
-
-    public String summary() {
-      CommaSeparatedStringBuilder s = new CommaSeparatedStringBuilder();
-      CommaSeparatedStringBuilder t = new CommaSeparatedStringBuilder();
-      for (Variable v : list)
-        if (v.mode == VariableMode.INPUT)
-          s.append(v.summary());
-        else
-          t.append(v.summary());
-      return "source variables ["+s.toString()+"], target variables ["+t.toString()+"]";
-    }
-	}
-
-	public class TransformContext {
-		private Object appInfo;
-
-		public TransformContext(Object appInfo) {
-			super();
-			this.appInfo = appInfo;
-		}
-
-		public Object getAppInfo() {
-			return appInfo;
-		}
-
-	}
-
-	private void log(String cnt) {
-	  if (services != null)
-	    services.log(cnt);
-	}
-
-	/**
-	 * Given an item, return all the children that conform to the pattern described in name
-	 * 
-	 * Possible patterns:
-	 *  - a simple name (which may be the base of a name with [] e.g. value[x])
-	 *  - a name with a type replacement e.g. valueCodeableConcept
-	 *  - * which means all children
-	 *  - ** which means all descendents
-	 *  
-	 * @param item
-	 * @param name
-	 * @param result
-	 * @throws FHIRException 
-	 */
-	protected void getChildrenByName(Base item, String name, List result) throws FHIRException {
-		for (Base v : item.listChildrenByName(name, true))
-			if (v != null)
-				result.add(v);
-	}
-
-	public void transform(Object appInfo, Base source, StructureMap map, Base target) throws FHIRException {
-		TransformContext context = new TransformContext(appInfo);
-    log("Start Transform "+map.getUrl());
-    StructureMapGroupComponent g = map.getGroup().get(0);
-
-		Variables vars = new Variables();
-		vars.add(VariableMode.INPUT, getInputName(g, StructureMapInputMode.SOURCE, "source"), source);
-		vars.add(VariableMode.OUTPUT, getInputName(g, StructureMapInputMode.TARGET, "target"), target);
-
-    executeGroup("", context, map, vars, g);
-    if (target instanceof Element)
-      ((Element) target).sort();
-	}
-
-	private String getInputName(StructureMapGroupComponent g, StructureMapInputMode mode, String def) throws DefinitionException {
-	  String name = null;
-    for (StructureMapGroupInputComponent inp : g.getInput()) {
-      if (inp.getMode() == mode)
-        if (name != null)
-          throw new DefinitionException("This engine does not support multiple source inputs");
-        else
-          name = inp.getName();
-    }
-    return name == null ? def : name;
-	}
-
-	private void executeGroup(String indent, TransformContext context, StructureMap map, Variables vars, StructureMapGroupComponent group) throws FHIRException {
-		log(indent+"Group : "+group.getName());
-    // todo: check inputs
-		if (group.hasExtends()) {
-		  ResolvedGroup rg = resolveGroupReference(map, group, group.getExtends());
-		  executeGroup(indent+" ", context, rg.targetMap, vars, rg.target); 
-		}
-		  
-		for (StructureMapGroupRuleComponent r : group.getRule()) {
-			executeRule(indent+"  ", context, map, vars, group, r);
-		}
-	}
-
-	private void executeRule(String indent, TransformContext context, StructureMap map, Variables vars, StructureMapGroupComponent group, StructureMapGroupRuleComponent rule) throws FHIRException {
-		log(indent+"rule : "+rule.getName());
-		if (rule.getName().contains("CarePlan.participant-unlink"))
-		  System.out.println("debug");
-		Variables srcVars = vars.copy();
-		if (rule.getSource().size() != 1)
-			throw new FHIRException("Rule \""+rule.getName()+"\": not handled yet");
-		List source = processSource(rule.getName(), context, srcVars, rule.getSource().get(0));
-		if (source != null) {
-			for (Variables v : source) {
-				for (StructureMapGroupRuleTargetComponent t : rule.getTarget()) {
-					processTarget(rule.getName(), context, v, map, group, t, rule.getSource().size() == 1 ? rule.getSourceFirstRep().getVariable() : null);
-				}
-				if (rule.hasRule()) {
-					for (StructureMapGroupRuleComponent childrule : rule.getRule()) {
-						executeRule(indent +"  ", context, map, v, group, childrule);
-					}
-				} else if (rule.hasDependent()) {
-					for (StructureMapGroupRuleDependentComponent dependent : rule.getDependent()) {
-						executeDependency(indent+"  ", context, map, v, group, dependent);
-					}
-				} else if (rule.getSource().size() == 1 && rule.getSourceFirstRep().hasVariable() && rule.getTarget().size() == 1 && rule.getTargetFirstRep().hasVariable() && rule.getTargetFirstRep().getTransform() == StructureMapTransform.CREATE && !rule.getTargetFirstRep().hasParameter()) {
-				  // simple inferred, map by type
-				  Base src = v.get(VariableMode.INPUT, rule.getSourceFirstRep().getVariable());
-				  Base tgt = v.get(VariableMode.OUTPUT, rule.getTargetFirstRep().getVariable());
-				  String srcType = src.fhirType();
-				  String tgtType = tgt.fhirType();
-				  ResolvedGroup defGroup = resolveGroupByTypes(map, rule.getName(), group, srcType, tgtType);
-			    Variables vdef = new Variables();
-          vdef.add(VariableMode.INPUT, defGroup.target.getInput().get(0).getName(), src);
-          vdef.add(VariableMode.OUTPUT, defGroup.target.getInput().get(1).getName(), tgt);
-				  executeGroup(indent+"  ", context, defGroup.targetMap, vdef, defGroup.target);
-				}
-			}
-		}
-	}
-
-	private void executeDependency(String indent, TransformContext context, StructureMap map, Variables vin, StructureMapGroupComponent group, StructureMapGroupRuleDependentComponent dependent) throws FHIRException {
-	  ResolvedGroup rg = resolveGroupReference(map, group, dependent.getName());
-
-		if (rg.target.getInput().size() != dependent.getVariable().size()) {
-			throw new FHIRException("Rule '"+dependent.getName()+"' has "+Integer.toString(rg.target.getInput().size())+" but the invocation has "+Integer.toString(dependent.getVariable().size())+" variables");
-		}
-		Variables v = new Variables();
-		for (int i = 0; i < rg.target.getInput().size(); i++) {
-			StructureMapGroupInputComponent input = rg.target.getInput().get(i);
-			StringType rdp = dependent.getVariable().get(i);
-      String var = rdp.asStringValue();
-			VariableMode mode = input.getMode() == StructureMapInputMode.SOURCE ? VariableMode.INPUT :   VariableMode.OUTPUT; 
-			Base vv = vin.get(mode, var);
-      if (vv == null && mode == VariableMode.INPUT) //* once source, always source. but target can be treated as source at user convenient
-        vv = vin.get(VariableMode.OUTPUT, var);
-			if (vv == null)
-				throw new FHIRException("Rule '"+dependent.getName()+"' "+mode.toString()+" variable '"+input.getName()+"' named as '"+var+"' has no value");
-			v.add(mode, input.getName(), vv);    	
-		}
-		executeGroup(indent+"  ", context, rg.targetMap, v, rg.target);
-	}
-
-  private String determineTypeFromSourceType(StructureMap map, StructureMapGroupComponent source, Base base, String[] types) throws FHIRException {
-    String type = base.fhirType();
-    String kn = "type^"+type;
-    if (source.hasUserData(kn))
-      return source.getUserString(kn);
-    
-    ResolvedGroup res = new ResolvedGroup();
-    res.targetMap = null;
-    res.target = null;
-    for (StructureMapGroupComponent grp : map.getGroup()) {
-      if (matchesByType(map, grp, type)) {
-        if (res.targetMap == null) {
-          res.targetMap = map;
-          res.target = grp;
-        } else 
-          throw new FHIRException("Multiple possible matches looking for default rule for '"+type+"'");
-      }
-    }
-    if (res.targetMap != null) {
-      String result = getActualType(res.targetMap, res.target.getInput().get(1).getType());
-      source.setUserData(kn, result);
-      return result;
-    }
-
-    for (UriType imp : map.getImport()) {
-      List impMapList = findMatchingMaps(imp.getValue());
-      if (impMapList.size() == 0)
-        throw new FHIRException("Unable to find map(s) for "+imp.getValue());
-      for (StructureMap impMap : impMapList) {
-        if (!impMap.getUrl().equals(map.getUrl())) {
-          for (StructureMapGroupComponent grp : impMap.getGroup()) {
-            if (matchesByType(impMap, grp, type)) {
-              if (res.targetMap == null) {
-                res.targetMap = impMap;
-                res.target = grp;
-              } else 
-                throw new FHIRException("Multiple possible matches for default rule for '"+type+"' in "+res.targetMap.getUrl()+" ("+res.target.getName()+") and "+impMap.getUrl()+" ("+grp.getName()+")");
-            }
-          }
-        }
-      }
-    }
-    if (res.target == null)
-      throw new FHIRException("No matches found for default rule for '"+type+"' from "+map.getUrl());
-    String result = getActualType(res.targetMap, res.target.getInput().get(1).getType()); // should be .getType, but R2...
-    source.setUserData(kn, result);
-    return result;
-  }
-
-  private List findMatchingMaps(String value) {
-    List res = new ArrayList();
-    if (value.contains("*")) {
-      for (StructureMap sm : library.values()) {
-        if (urlMatches(value, sm.getUrl())) {
-          res.add(sm); 
-        }
-      }
-    } else {
-      StructureMap sm = library.get(value);
-      if (sm != null)
-        res.add(sm); 
-    }
-    Set check = new HashSet();
-    for (StructureMap sm : res) {
-      if (check.contains(sm.getUrl()))
-        throw new Error("duplicate");
-      else
-        check.add(sm.getUrl());
-    }
-    return res;
-  }
-
-  private boolean urlMatches(String mask, String url) {
-    return url.length() > mask.length() && url.startsWith(mask.substring(0, mask.indexOf("*"))) && url.endsWith(mask.substring(mask.indexOf("*")+1)) ;
-  }
-
-  private ResolvedGroup resolveGroupByTypes(StructureMap map, String ruleid, StructureMapGroupComponent source, String srcType, String tgtType) throws FHIRException {
-    String kn = "types^"+srcType+":"+tgtType;
-    if (source.hasUserData(kn))
-      return (ResolvedGroup) source.getUserData(kn);
-    
-    ResolvedGroup res = new ResolvedGroup();
-    res.targetMap = null;
-    res.target = null;
-    for (StructureMapGroupComponent grp : map.getGroup()) {
-      if (matchesByType(map, grp, srcType, tgtType)) {
-        if (res.targetMap == null) {
-          res.targetMap = map;
-          res.target = grp;
-        } else 
-          throw new FHIRException("Multiple possible matches looking for rule for '"+srcType+"/"+tgtType+"', from rule '"+ruleid+"'");
-      }
-    }
-    if (res.targetMap != null) {
-      source.setUserData(kn, res);
-      return res;
-    }
-
-    for (UriType imp : map.getImport()) {
-      List impMapList = findMatchingMaps(imp.getValue());
-      if (impMapList.size() == 0)
-        throw new FHIRException("Unable to find map(s) for "+imp.getValue());
-      for (StructureMap impMap : impMapList) {
-        if (!impMap.getUrl().equals(map.getUrl())) {
-          for (StructureMapGroupComponent grp : impMap.getGroup()) {
-            if (matchesByType(impMap, grp, srcType, tgtType)) {
-              if (res.targetMap == null) {
-                res.targetMap = impMap;
-                res.target = grp;
-              } else 
-                throw new FHIRException("Multiple possible matches for rule for '"+srcType+"/"+tgtType+"' in "+res.targetMap.getUrl()+" and "+impMap.getUrl()+", from rule '"+ruleid+"'");
-            }
-          }
-        }
-      }
-    }
-    if (res.target == null)
-      throw new FHIRException("No matches found for rule for '"+srcType+"/"+tgtType+"' from "+map.getUrl()+", from rule '"+ruleid+"'");
-    source.setUserData(kn, res);
-    return res;
-  }
-
-
-  private boolean matchesByType(StructureMap map, StructureMapGroupComponent grp, String type) throws FHIRException {
-    if (grp.getTypeMode() != StructureMapGroupTypeMode.TYPEANDTYPES)
-      return false;
-    if (grp.getInput().size() != 2 || grp.getInput().get(0).getMode() != StructureMapInputMode.SOURCE || grp.getInput().get(1).getMode() != StructureMapInputMode.TARGET)
-      return false;
-    return matchesType(map, type, grp.getInput().get(0).getType());
-  }
-
-  private boolean matchesByType(StructureMap map, StructureMapGroupComponent grp, String srcType, String tgtType) throws FHIRException {
-    if (grp.getTypeMode() == StructureMapGroupTypeMode.NONE)
-      return false;
-    if (grp.getInput().size() != 2 || grp.getInput().get(0).getMode() != StructureMapInputMode.SOURCE || grp.getInput().get(1).getMode() != StructureMapInputMode.TARGET)
-      return false;
-    if (!grp.getInput().get(0).hasType() || !grp.getInput().get(1).hasType())
-      return false;
-    return matchesType(map, srcType, grp.getInput().get(0).getType()) && matchesType(map, tgtType, grp.getInput().get(1).getType());
-  }
-
-  private boolean matchesType(StructureMap map, String actualType, String statedType) throws FHIRException {
-    // check the aliases
-    for (StructureMapStructureComponent imp : map.getStructure()) {
-      if (imp.hasAlias() && statedType.equals(imp.getAlias())) {
-        StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl());
-        if (sd != null)
-          statedType = sd.getType();
-        break;
-      }
-    }
-    
-    return actualType.equals(statedType);
-  }
-
-  private String getActualType(StructureMap map, String statedType) throws FHIRException {
-    // check the aliases
-    for (StructureMapStructureComponent imp : map.getStructure()) {
-      if (imp.hasAlias() && statedType.equals(imp.getAlias())) {
-        StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl());
-        if (sd == null)
-          throw new FHIRException("Unable to resolve structure "+imp.getUrl());
-        return sd.getId(); // should be sd.getType(), but R2...
-      }
-    }
-    return statedType;
-  }
-
-
-  private ResolvedGroup resolveGroupReference(StructureMap map, StructureMapGroupComponent source, String name) throws FHIRException {
-    String kn = "ref^"+name;
-    if (source.hasUserData(kn))
-      return (ResolvedGroup) source.getUserData(kn);
-    
-	  ResolvedGroup res = new ResolvedGroup();
-    res.targetMap = null;
-    res.target = null;
-    for (StructureMapGroupComponent grp : map.getGroup()) {
-      if (grp.getName().equals(name)) {
-        if (res.targetMap == null) {
-          res.targetMap = map;
-          res.target = grp;
-        } else 
-          throw new FHIRException("Multiple possible matches for rule '"+name+"'");
-      }
-    }
-    if (res.targetMap != null) {
-      source.setUserData(kn, res);
-      return res;
-    }
-
-    for (UriType imp : map.getImport()) {
-      List impMapList = findMatchingMaps(imp.getValue());
-      if (impMapList.size() == 0)
-        throw new FHIRException("Unable to find map(s) for "+imp.getValue());
-      for (StructureMap impMap : impMapList) {
-        if (!impMap.getUrl().equals(map.getUrl())) {
-          for (StructureMapGroupComponent grp : impMap.getGroup()) {
-            if (grp.getName().equals(name)) {
-              if (res.targetMap == null) {
-                res.targetMap = impMap;
-                res.target = grp;
-              } else 
-                throw new FHIRException("Multiple possible matches for rule '"+name+"' in "+res.targetMap.getUrl()+" and "+impMap.getUrl());
-            }
-          }
-        }
-      }
-    }
-    if (res.target == null)
-      throw new FHIRException("No matches found for rule '"+name+"'. Reference found in "+map.getUrl());
-    source.setUserData(kn, res);
-    return res;
-  }
-
-  private List processSource(String ruleId, TransformContext context, Variables vars, StructureMapGroupRuleSourceComponent src) throws FHIRException {
-    List items;
-    if (src.getContext().equals("@search")) {
-      ExpressionNode expr = (ExpressionNode) src.getUserData(MAP_SEARCH_EXPRESSION);
-      if (expr == null) {
-        expr = fpe.parse(src.getElement());
-        src.setUserData(MAP_SEARCH_EXPRESSION, expr);
-      }
-      String search = fpe.evaluateToString(vars, null, new StringType(), expr); // string is a holder of nothing to ensure that variables are processed correctly 
-      items = services.performSearch(context.appInfo, search);
-    } else {
-      items = new ArrayList();
-      Base b = vars.get(VariableMode.INPUT, src.getContext());
-      if (b == null)
-        throw new FHIRException("Unknown input variable "+src.getContext());
-
-      if (!src.hasElement()) 
-        items.add(b);
-      else { 
-        getChildrenByName(b, src.getElement(), items);
-        if (items.size() == 0 && src.hasDefaultValue())
-          items.add(src.getDefaultValue());
-      }
-    }
-    
-		if (src.hasType()) {
-	    List remove = new ArrayList();
-	    for (Base item : items) {
-	      if (item != null && !isType(item, src.getType())) {
-	        remove.add(item);
-	      }
-	    }
-	    items.removeAll(remove);
-		}
-
-    if (src.hasCondition()) {
-      ExpressionNode expr = (ExpressionNode) src.getUserData(MAP_WHERE_EXPRESSION);
-      if (expr == null) {
-        expr = fpe.parse(src.getCondition());
-        //        fpe.check(context.appInfo, ??, ??, expr)
-        src.setUserData(MAP_WHERE_EXPRESSION, expr);
-      }
-      List remove = new ArrayList();
-      for (Base item : items) {
-        if (!fpe.evaluateToBoolean(vars, null, item, expr))
-          remove.add(item);
-      }
-      items.removeAll(remove);
-    }
-
-    if (src.hasCheck()) {
-      ExpressionNode expr = (ExpressionNode) src.getUserData(MAP_WHERE_CHECK);
-      if (expr == null) {
-        expr = fpe.parse(src.getCheck());
-        //        fpe.check(context.appInfo, ??, ??, expr)
-        src.setUserData(MAP_WHERE_CHECK, expr);
-      }
-      List remove = new ArrayList();
-      for (Base item : items) {
-        if (!fpe.evaluateToBoolean(vars, null, item, expr))
-          throw new FHIRException("Rule \""+ruleId+"\": Check condition failed");
-      }
-    } 
-
-		
-		if (src.hasListMode() && !items.isEmpty()) {
-		  switch (src.getListMode()) {
-		  case FIRST:
-		    Base bt = items.get(0);
-        items.clear();
-        items.add(bt);
-		    break;
-		  case NOTFIRST: 
-        if (items.size() > 0)
-          items.remove(0);
-        break;
-		  case LAST:
-        bt = items.get(items.size()-1);
-        items.clear();
-        items.add(bt);
-        break;
-		  case NOTLAST: 
-        if (items.size() > 0)
-          items.remove(items.size()-1);
-        break;
-		  case ONLYONE:
-		    if (items.size() > 1)
-          throw new FHIRException("Rule \""+ruleId+"\": Check condition failed: the collection has more than one item");
-        break;
-      case NULL:
-		  }
-		}
-		List result = new ArrayList();
-		for (Base r : items) {
-			Variables v = vars.copy();
-			if (src.hasVariable())
-				v.add(VariableMode.INPUT, src.getVariable(), r);
-			result.add(v); 
-		}
-		return result;
-	}
-
-
-	private boolean isType(Base item, String type) {
-    if (type.equals(item.fhirType()))
-      return true;
-    return false;
-  }
-
-  private void processTarget(String ruleId, TransformContext context, Variables vars, StructureMap map, StructureMapGroupComponent group, StructureMapGroupRuleTargetComponent tgt, String srcVar) throws FHIRException {
-	  Base dest = null;
-	  if (tgt.hasContext()) {
-  		dest = vars.get(VariableMode.OUTPUT, tgt.getContext());
-		if (dest == null)
-			throw new FHIRException("Rule \""+ruleId+"\": target context not known: "+tgt.getContext());
-		if (!tgt.hasElement())
-			throw new FHIRException("Rule \""+ruleId+"\": Not supported yet");
-	  }
-		Base v = null;
-		if (tgt.hasTransform()) {
-			v = runTransform(ruleId, context, map, group, tgt, vars, dest, tgt.getElement(), srcVar);
-			if (v != null && dest != null)
-				v = dest.setProperty(tgt.getElement().hashCode(), tgt.getElement(), v); // reset v because some implementations may have to rewrite v when setting the value
-		} else if (dest != null) 
-			v = dest.makeProperty(tgt.getElement().hashCode(), tgt.getElement());
-		if (tgt.hasVariable() && v != null)
-			vars.add(VariableMode.OUTPUT, tgt.getVariable(), v);
-	}
-
-	private Base runTransform(String ruleId, TransformContext context, StructureMap map, StructureMapGroupComponent group, StructureMapGroupRuleTargetComponent tgt, Variables vars, Base dest, String element, String srcVar) throws FHIRException {
-	  try {
-	    switch (tgt.getTransform()) {
-	    case CREATE :
-	      String tn;
-	      if (tgt.getParameter().isEmpty()) {
-	        // we have to work out the type. First, we see if there is a single type for the target. If there is, we use that
-	        String[] types = dest.getTypesForProperty(element.hashCode(), element);
-	        if (types.length == 1 && !"*".equals(types[0]) && !types[0].equals("Resource"))
-	          tn = types[0];
-	        else if (srcVar != null) {
-	          tn = determineTypeFromSourceType(map, group, vars.get(VariableMode.INPUT, srcVar), types);
-	        } else
-	          throw new Error("Cannot determine type implicitly because there is no single input variable");
-	      } else
-	        tn = getParamStringNoNull(vars, tgt.getParameter().get(0), tgt.toString());
-	      Base res = services != null ? services.createType(context.getAppInfo(), tn) : ResourceFactory.createResourceOrType(tn);
-	      if (res.isResource() && !res.fhirType().equals("Parameters")) {
-//	        res.setIdBase(tgt.getParameter().size() > 1 ? getParamString(vars, tgt.getParameter().get(0)) : UUID.randomUUID().toString().toLowerCase());
-	        if (services != null) 
-	          res = services.createResource(context.getAppInfo(), res);
-	      }
-	      if (tgt.hasUserData("profile"))
-	        res.setUserData("profile", tgt.getUserData("profile"));
-	      return res;
-	    case COPY : 
-	      return getParam(vars, tgt.getParameter().get(0));
-	    case EVALUATE :
-	      ExpressionNode expr = (ExpressionNode) tgt.getUserData(MAP_EXPRESSION);
-	      if (expr == null) {
-	        expr = fpe.parse(getParamStringNoNull(vars, tgt.getParameter().get(1), tgt.toString()));
-	        tgt.setUserData(MAP_WHERE_EXPRESSION, expr);
-	      }
-	      List v = fpe.evaluate(vars, null, tgt.getParameter().size() == 2 ? getParam(vars, tgt.getParameter().get(0)) : new BooleanType(false), expr);
-	      if (v.size() == 0)
-	        return null;
-	      else if (v.size() != 1)
-	        throw new FHIRException("Rule \""+ruleId+"\": Evaluation of "+expr.toString()+" returned "+Integer.toString(v.size())+" objects");
-	      else
-	        return v.get(0);
-
-	    case TRUNCATE : 
-	      String src = getParamString(vars, tgt.getParameter().get(0));
-	      String len = getParamStringNoNull(vars, tgt.getParameter().get(1), tgt.toString());
-	      if (Utilities.isInteger(len)) {
-	        int l = Integer.parseInt(len);
-	        if (src.length() > l)
-	          src = src.substring(0, l);
-	      }
-	      return new StringType(src);
-	    case ESCAPE : 
-	      throw new Error("Rule \""+ruleId+"\": Transform "+tgt.getTransform().toCode()+" not supported yet");
-	    case CAST :
-	      throw new Error("Rule \""+ruleId+"\": Transform "+tgt.getTransform().toCode()+" not supported yet");
-	    case APPEND : 
-	      throw new Error("Rule \""+ruleId+"\": Transform "+tgt.getTransform().toCode()+" not supported yet");
-	    case TRANSLATE : 
-	      return translate(context, map, vars, tgt.getParameter());
-	    case REFERENCE :
-	      Base b = getParam(vars, tgt.getParameter().get(0));
-	      if (b == null)
-	        throw new FHIRException("Rule \""+ruleId+"\": Unable to find parameter "+((IdType) tgt.getParameter().get(0).getValue()).asStringValue());
-	      if (!b.isResource())
-	        throw new FHIRException("Rule \""+ruleId+"\": Transform engine cannot point at an element of type "+b.fhirType());
-	      else {
-	        String id = b.getIdBase();
-	        if (id == null) {
-	          id = UUID.randomUUID().toString().toLowerCase();
-	          b.setIdBase(id);
-	        }
-	        return new Reference().setReference(b.fhirType()+"/"+id);
-	      }
-	    case DATEOP :
-	      throw new Error("Rule \""+ruleId+"\": Transform "+tgt.getTransform().toCode()+" not supported yet");
-	    case UUID :
-	      return new IdType(UUID.randomUUID().toString());
-	    case POINTER :
-	      b = getParam(vars, tgt.getParameter().get(0));
-	      if (b instanceof Resource)
-	        return new UriType("urn:uuid:"+((Resource) b).getId());
-	      else
-	        throw new FHIRException("Rule \""+ruleId+"\": Transform engine cannot point at an element of type "+b.fhirType());
-	    case CC:
-	      CodeableConcept cc = new CodeableConcept();
-	      cc.addCoding(buildCoding(getParamStringNoNull(vars, tgt.getParameter().get(0), tgt.toString()), getParamStringNoNull(vars, tgt.getParameter().get(1), tgt.toString())));
-	      return cc;
-	    case C: 
-	      Coding c = buildCoding(getParamStringNoNull(vars, tgt.getParameter().get(0), tgt.toString()), getParamStringNoNull(vars, tgt.getParameter().get(1), tgt.toString()));
-	      return c;
-	    default:
-	      throw new Error("Rule \""+ruleId+"\": Transform Unknown: "+tgt.getTransform().toCode());
-	    }
-	  } catch (Exception e) {
-	    throw new FHIRException("Exception executing transform "+tgt.toString()+" on Rule \""+ruleId+"\": "+e.getMessage(), e);
-	  }
-	}
-
-
-  private Coding buildCoding(String uri, String code) throws FHIRException {
-	  // if we can get this as a valueSet, we will
-	  String system = null;
-	  String display = null;
-	  ValueSet vs = Utilities.noString(uri) ? null : worker.fetchResourceWithException(ValueSet.class, uri);
-	  if (vs != null) {
-	    ValueSetExpansionOutcome vse = worker.expandVS(vs, true, false);
-	    if (vse.getError() != null)
-	      throw new FHIRException(vse.getError());
-	    CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
-	    for (ValueSetExpansionContainsComponent t : vse.getValueset().getExpansion().getContains()) {
-	      if (t.hasCode())
-	        b.append(t.getCode());
-	      if (code.equals(t.getCode()) && t.hasSystem()) {
-	        system = t.getSystem();
-          display = t.getDisplay();
-	        break;
-	      }
-        if (code.equalsIgnoreCase(t.getDisplay()) && t.hasSystem()) {
-          system = t.getSystem();
-          display = t.getDisplay();
-          break;
-        }
-	    }
-	    if (system == null)
-	      throw new FHIRException("The code '"+code+"' is not in the value set '"+uri+"' (valid codes: "+b.toString()+"; also checked displays)");
-	  } else
-	    system = uri;
-	  ValidationResult vr = worker.validateCode(system, code, null);
-	  if (vr != null && vr.getDisplay() != null)
-	    display = vr.getDisplay();
-   return new Coding().setSystem(system).setCode(code).setDisplay(display);
-  }
-
-
-  private String getParamStringNoNull(Variables vars, StructureMapGroupRuleTargetParameterComponent parameter, String message) throws FHIRException {
-    Base b = getParam(vars, parameter);
-    if (b == null)
-      throw new FHIRException("Unable to find a value for "+parameter.toString()+". Context: "+message);
-    if (!b.hasPrimitiveValue())
-      throw new FHIRException("Found a value for "+parameter.toString()+", but it has a type of "+b.fhirType()+" and cannot be treated as a string. Context: "+message);
-    return b.primitiveValue();
-  }
-
-  private String getParamString(Variables vars, StructureMapGroupRuleTargetParameterComponent parameter) throws DefinitionException {
-		Base b = getParam(vars, parameter);
-		if (b == null || !b.hasPrimitiveValue())
-			return null;
-		return b.primitiveValue();
-	}
-
-
-	private Base getParam(Variables vars, StructureMapGroupRuleTargetParameterComponent parameter) throws DefinitionException {
-		Type p = parameter.getValue();
-		if (!(p instanceof IdType))
-			return p;
-		else { 
-			String n = ((IdType) p).asStringValue();
-      Base b = vars.get(VariableMode.INPUT, n);
-			if (b == null)
-				b = vars.get(VariableMode.OUTPUT, n);
-			if (b == null)
-        throw new DefinitionException("Variable "+n+" not found ("+vars.summary()+")");
-			return b;
-		}
-	}
-
-
-	private Base translate(TransformContext context, StructureMap map, Variables vars, List parameter) throws FHIRException {
-		Base src = getParam(vars, parameter.get(0));
-		String id = getParamString(vars, parameter.get(1));
-		String fld = parameter.size() > 2 ? getParamString(vars, parameter.get(2)) : null;
-		return translate(context, map, src, id, fld);
-	}
-
-	private class SourceElementComponentWrapper {
-	  private ConceptMapGroupComponent group;
-    private SourceElementComponent comp;
-    public SourceElementComponentWrapper(ConceptMapGroupComponent group, SourceElementComponent comp) {
-      super();
-      this.group = group;
-      this.comp = comp;
-    }
-	}
-	public Base translate(TransformContext context, StructureMap map, Base source, String conceptMapUrl, String fieldToReturn) throws FHIRException {
-		Coding src = new Coding();
-		if (source.isPrimitive()) {
-			src.setCode(source.primitiveValue());
-		} else if ("Coding".equals(source.fhirType())) {
-			Base[] b = source.getProperty("system".hashCode(), "system", true);
-			if (b.length == 1)
-				src.setSystem(b[0].primitiveValue());
-			b = source.getProperty("code".hashCode(), "code", true);
-			if (b.length == 1)
-				src.setCode(b[0].primitiveValue());
-		} else if ("CE".equals(source.fhirType())) {
-			Base[] b = source.getProperty("codeSystem".hashCode(), "codeSystem", true);
-			if (b.length == 1)
-				src.setSystem(b[0].primitiveValue());
-			b = source.getProperty("code".hashCode(), "code", true);
-			if (b.length == 1)
-				src.setCode(b[0].primitiveValue());
-		} else
-			throw new FHIRException("Unable to translate source "+source.fhirType());
-
-		String su = conceptMapUrl;
-		if (conceptMapUrl.equals("http://hl7.org/fhir/ConceptMap/special-oid2uri")) {
-			String uri = worker.oid2Uri(src.getCode());
-			if (uri == null)
-				uri = "urn:oid:"+src.getCode();
-			if ("uri".equals(fieldToReturn))
-				return new UriType(uri);
-			else
-				throw new FHIRException("Error in return code");
-		} else {
-			ConceptMap cmap = null;
-			if (conceptMapUrl.startsWith("#")) {
-				for (Resource r : map.getContained()) {
-					if (r instanceof ConceptMap && ((ConceptMap) r).getId().equals(conceptMapUrl.substring(1))) {
-						cmap = (ConceptMap) r;
-						su = map.getUrl()+conceptMapUrl;
-					}
-				}
-				if (cmap == null)
-		      throw new FHIRException("Unable to translate - cannot find map "+conceptMapUrl);
-			} else
-				cmap = worker.fetchResource(ConceptMap.class, conceptMapUrl);
-			Coding outcome = null;
-			boolean done = false;
-			String message = null;
-			if (cmap == null) {
-				if (services == null) 
-					message = "No map found for "+conceptMapUrl;
-				else {
-					outcome = services.translate(context.appInfo, src, conceptMapUrl);
-					done = true;
-				}
-			} else {
-			  List list = new ArrayList();
-			  for (ConceptMapGroupComponent g : cmap.getGroup()) {
-			    for (SourceElementComponent e : g.getElement()) {
-						if (!src.hasSystem() && src.getCode().equals(e.getCode())) 
-			        list.add(new SourceElementComponentWrapper(g, e));
-			      else if (src.hasSystem() && src.getSystem().equals(g.getSource()) && src.getCode().equals(e.getCode()))
-			        list.add(new SourceElementComponentWrapper(g, e));
-			    }
-				}
-				if (list.size() == 0)
-					done = true;
-				else if (list.get(0).comp.getTarget().size() == 0)
-					message = "Concept map "+su+" found no translation for "+src.getCode();
-				else {
-					for (TargetElementComponent tgt : list.get(0).comp.getTarget()) {
-						if (tgt.getEquivalence() == null || EnumSet.of( ConceptMapEquivalence.EQUAL , ConceptMapEquivalence.RELATEDTO , ConceptMapEquivalence.EQUIVALENT, ConceptMapEquivalence.WIDER).contains(tgt.getEquivalence())) {
-							if (done) {
-								message = "Concept map "+su+" found multiple matches for "+src.getCode();
-								done = false;
-							} else {
-								done = true;
-								outcome = new Coding().setCode(tgt.getCode()).setSystem(list.get(0).group.getTarget());
-							}
-						} else if (tgt.getEquivalence() == ConceptMapEquivalence.UNMATCHED) {
-							done = true;
-						}
-					}
-					if (!done)
-						message = "Concept map "+su+" found no usable translation for "+src.getCode();
-				}
-			}
-			if (!done) 
-				throw new FHIRException(message);
-			if (outcome == null)
-				return null;
-			if ("code".equals(fieldToReturn))
-				return new CodeType(outcome.getCode());
-			else
-				return outcome; 
-		}
-	}
-
-
-	public Map getLibrary() {
-	  return library;
-	}
-
-	public class PropertyWithType {
-    private String path;
-    private Property baseProperty;
-    private Property profileProperty;
-	  private TypeDetails types;
-    public PropertyWithType(String path, Property baseProperty, Property profileProperty, TypeDetails types) {
-      super();
-      this.baseProperty = baseProperty;
-      this.profileProperty = profileProperty;
-      this.path = path;
-      this.types = types;
-    }
-
-    public TypeDetails getTypes() {
-      return types;
-    }
-    public String getPath() {
-      return path;
-    }
-
-    public Property getBaseProperty() {
-      return baseProperty;
-    }
-
-    public void setBaseProperty(Property baseProperty) {
-      this.baseProperty = baseProperty;
-    }
-
-    public Property getProfileProperty() {
-      return profileProperty;
-    }
-
-    public void setProfileProperty(Property profileProperty) {
-      this.profileProperty = profileProperty;
-    }
-
-    public String summary() {
-      return path;
-    }
-    
-	}
-	
-	public class VariableForProfiling {
-	    private VariableMode mode;
-	    private String name;
-	    private PropertyWithType property;
-	    
-	    public VariableForProfiling(VariableMode mode, String name, PropertyWithType property) {
-	      super();
-	      this.mode = mode;
-	      this.name = name;
-	      this.property = property;
-	    }
-	    public VariableMode getMode() {
-	      return mode;
-	    }
-	    public String getName() {
-	      return name;
-	    }
-      public PropertyWithType getProperty() {
-        return property;
-      }
-      public String summary() {
-        return name+": "+property.summary();
-      }      
-	  }
-
-  public class VariablesForProfiling {
-    private List list = new ArrayList();
-    private boolean optional;
-    private boolean repeating;
-
-    public VariablesForProfiling(boolean optional, boolean repeating) {
-      this.optional = optional;
-      this.repeating = repeating;
-    }
-
-    public void add(VariableMode mode, String name, String path, Property property, TypeDetails types) {
-      add(mode, name, new PropertyWithType(path, property, null, types));
-    }
-    
-    public void add(VariableMode mode, String name, String path, Property baseProperty, Property profileProperty, TypeDetails types) {
-      add(mode, name, new PropertyWithType(path, baseProperty, profileProperty, types));
-    }
-    
-    public void add(VariableMode mode, String name, PropertyWithType property) {
-      VariableForProfiling vv = null;
-      for (VariableForProfiling v : list) 
-        if ((v.mode == mode) && v.getName().equals(name))
-          vv = v;
-      if (vv != null)
-        list.remove(vv);
-      list.add(new VariableForProfiling(mode, name, property));
-    }
-
-    public VariablesForProfiling copy(boolean optional, boolean repeating) {
-      VariablesForProfiling result = new VariablesForProfiling(optional, repeating);
-      result.list.addAll(list);
-      return result;
-    }
-
-    public VariablesForProfiling copy() {
-      VariablesForProfiling result = new VariablesForProfiling(optional, repeating);
-      result.list.addAll(list);
-      return result;
-    }
-
-    public VariableForProfiling get(VariableMode mode, String name) {
-      if (mode == null) {
-        for (VariableForProfiling v : list) 
-          if ((v.mode == VariableMode.OUTPUT) && v.getName().equals(name))
-            return v;
-        for (VariableForProfiling v : list) 
-          if ((v.mode == VariableMode.INPUT) && v.getName().equals(name))
-            return v;
-      }
-      for (VariableForProfiling v : list) 
-        if ((v.mode == mode) && v.getName().equals(name))
-          return v;
-      return null;
-    }
-
-    public String summary() {
-      CommaSeparatedStringBuilder s = new CommaSeparatedStringBuilder();
-      CommaSeparatedStringBuilder t = new CommaSeparatedStringBuilder();
-      for (VariableForProfiling v : list)
-        if (v.mode == VariableMode.INPUT)
-          s.append(v.summary());
-        else
-          t.append(v.summary());
-      return "source variables ["+s.toString()+"], target variables ["+t.toString()+"]";
-    }
-  }
-
-  public class StructureMapAnalysis {
-    private List profiles = new ArrayList();
-    private XhtmlNode summary;
-    public List getProfiles() {
-      return profiles;
-    }
-    public XhtmlNode getSummary() {
-      return summary;
-    }
-    
-  }
-
-	/**
-	 * Given a structure map, return a set of analyses on it. 
-	 * 
-	 * Returned:
-	 *   - a list or profiles for what it will create. First profile is the target
-	 *   - a table with a summary (in xhtml) for easy human undertanding of the mapping
-	 *   
-	 * 
-	 * @param appInfo
-	 * @param map
-	 * @return
-	 * @throws Exception
-	 */
-  public StructureMapAnalysis analyse(Object appInfo, StructureMap map) throws Exception {
-    ids.clear();
-    StructureMapAnalysis result = new StructureMapAnalysis(); 
-    TransformContext context = new TransformContext(appInfo);
-    VariablesForProfiling vars = new VariablesForProfiling(false, false);
-    StructureMapGroupComponent start = map.getGroup().get(0);
-    for (StructureMapGroupInputComponent t : start.getInput()) {
-      PropertyWithType ti = resolveType(map, t.getType(), t.getMode());
-      if (t.getMode() == StructureMapInputMode.SOURCE)
-       vars.add(VariableMode.INPUT, t.getName(), ti);
-      else 
-        vars.add(VariableMode.OUTPUT, t.getName(), createProfile(map, result.profiles, ti, start.getName(), start));
-    }
-
-    result.summary = new XhtmlNode(NodeType.Element, "table").setAttribute("class", "grid");
-    XhtmlNode tr = result.summary.addTag("tr");
-    tr.addTag("td").addTag("b").addText("Source");
-    tr.addTag("td").addTag("b").addText("Target");
-    
-    log("Start Profiling Transform "+map.getUrl());
-    analyseGroup("", context, map, vars, start, result);
-    ProfileUtilities pu = new ProfileUtilities(worker, null, pkp);
-    for (StructureDefinition sd : result.getProfiles())
-      pu.cleanUpDifferential(sd);
-    return result;
-  }
-
-
-  private void analyseGroup(String indent, TransformContext context, StructureMap map, VariablesForProfiling vars, StructureMapGroupComponent group, StructureMapAnalysis result) throws Exception {
-    log(indent+"Analyse Group : "+group.getName());
-    // todo: extends
-    // todo: check inputs
-    XhtmlNode tr = result.summary.addTag("tr").setAttribute("class", "diff-title");
-    XhtmlNode xs = tr.addTag("td");
-    XhtmlNode xt = tr.addTag("td");
-    for (StructureMapGroupInputComponent inp : group.getInput()) {
-      if (inp.getMode() == StructureMapInputMode.SOURCE) 
-        noteInput(vars, inp, VariableMode.INPUT, xs);
-      if (inp.getMode() == StructureMapInputMode.TARGET) 
-        noteInput(vars, inp, VariableMode.OUTPUT, xt);
-    }
-    for (StructureMapGroupRuleComponent r : group.getRule()) {
-      analyseRule(indent+"  ", context, map, vars, group, r, result);
-    }    
-  }
-
-
-  private void noteInput(VariablesForProfiling vars, StructureMapGroupInputComponent inp, VariableMode mode, XhtmlNode xs) {
-    VariableForProfiling v = vars.get(mode, inp.getName());
-    if (v != null)
-      xs.addText("Input: "+v.property.getPath());
-  }
-
-  private void analyseRule(String indent, TransformContext context, StructureMap map, VariablesForProfiling vars, StructureMapGroupComponent group, StructureMapGroupRuleComponent rule, StructureMapAnalysis result) throws Exception {
-    log(indent+"Analyse rule : "+rule.getName());
-    XhtmlNode tr = result.summary.addTag("tr");
-    XhtmlNode xs = tr.addTag("td");
-    XhtmlNode xt = tr.addTag("td");
-
-    VariablesForProfiling srcVars = vars.copy();
-    if (rule.getSource().size() != 1)
-      throw new Exception("Rule \""+rule.getName()+"\": not handled yet");
-    VariablesForProfiling source = analyseSource(rule.getName(), context, srcVars, rule.getSourceFirstRep(), xs);
-
-    TargetWriter tw = new TargetWriter();
-      for (StructureMapGroupRuleTargetComponent t : rule.getTarget()) {
-      analyseTarget(rule.getName(), context, source, map, t, rule.getSourceFirstRep().getVariable(), tw, result.profiles, rule.getName());
-      }
-    tw.commit(xt);
-
-          for (StructureMapGroupRuleComponent childrule : rule.getRule()) {
-      analyseRule(indent+"  ", context, map, source, group, childrule, result);
-          }
-//    for (StructureMapGroupRuleDependentComponent dependent : rule.getDependent()) {
-//      executeDependency(indent+"  ", context, map, v, group, dependent); // do we need group here?
-//    }
-          }
-
-  public class StringPair {
-    private String var;
-    private String desc;
-    public StringPair(String var, String desc) {
-      super();
-      this.var = var;
-      this.desc = desc;
-        }
-    public String getVar() {
-      return var;
-      }
-    public String getDesc() {
-      return desc;
-    }
-  }
-  public class TargetWriter {
-    private Map newResources = new HashMap();
-    private List assignments = new ArrayList();
-    private List keyProps = new ArrayList();
-    private CommaSeparatedStringBuilder txt = new CommaSeparatedStringBuilder();
-
-    public void newResource(String var, String name) {
-      newResources.put(var, name);
-      txt.append("new "+name);
-    }
-
-    public void valueAssignment(String context, String desc) {
-      assignments.add(new StringPair(context, desc));      
-      txt.append(desc);
-        }
-
-    public void keyAssignment(String context, String desc) {
-      keyProps.add(new StringPair(context, desc));      
-      txt.append(desc);
-    }
-    public void commit(XhtmlNode xt) {
-      if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 1 && newResources.containsKey(keyProps.get(0).getVar()) ) {
-        xt.addText("new "+assignments.get(0).desc+" ("+keyProps.get(0).desc.substring(keyProps.get(0).desc.indexOf(".")+1)+")");
-      } else if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 0) {
-        xt.addText("new "+assignments.get(0).desc);
-      } else {
-        xt.addText(txt.toString());        
-    }
-    }
-  }
-
-  private VariablesForProfiling analyseSource(String ruleId, TransformContext context, VariablesForProfiling vars, StructureMapGroupRuleSourceComponent src, XhtmlNode td) throws Exception {
-    VariableForProfiling var = vars.get(VariableMode.INPUT, src.getContext());
-    if (var == null)
-      throw new FHIRException("Rule \""+ruleId+"\": Unknown input variable "+src.getContext());
-    PropertyWithType prop = var.getProperty();
-
-    boolean optional = false;
-    boolean repeating = false;
-
-    if (src.hasCondition()) {
-      optional = true;
-    }
-
-    if (src.hasElement()) {
-      Property element = prop.getBaseProperty().getChild(prop.types.getType(), src.getElement());
-      if (element == null)
-        throw new Exception("Rule \""+ruleId+"\": Unknown element name "+src.getElement());
-      if (element.getDefinition().getMin() == 0)
-        optional = true;
-      if (element.getDefinition().getMax().equals("*"))
-        repeating = true;
-      VariablesForProfiling result = vars.copy(optional, repeating);
-      TypeDetails type = new TypeDetails(CollectionStatus.SINGLETON);
-      for (TypeRefComponent tr : element.getDefinition().getType()) {
-        if (!tr.hasCode())
-          throw new Error("Rule \""+ruleId+"\": Element has no type");
-        ProfiledType pt = new ProfiledType(tr.getCode());
-        if (tr.hasProfile())
-          pt.addProfile(tr.getProfile());
-        if (element.getDefinition().hasBinding())
-          pt.addBinding(element.getDefinition().getBinding());
-        type.addType(pt);
-    } 
-      td.addText(prop.getPath()+"."+src.getElement()); 
-      if (src.hasVariable())
-        result.add(VariableMode.INPUT, src.getVariable(), new PropertyWithType(prop.getPath()+"."+src.getElement(), element, null, type));
-    return result;
-    } else {
-      td.addText(prop.getPath()); // ditto!
-      return vars.copy(optional, repeating);
-    }
-  }
-
-
-  private void analyseTarget(String ruleId, TransformContext context, VariablesForProfiling vars, StructureMap map, StructureMapGroupRuleTargetComponent tgt, String tv, TargetWriter tw, List profiles, String sliceName) throws Exception {
-    VariableForProfiling var = null;
-    if (tgt.hasContext()) {
-      var = vars.get(VariableMode.OUTPUT, tgt.getContext());
-      if (var == null)
-        throw new Exception("Rule \""+ruleId+"\": target context not known: "+tgt.getContext());
-      if (!tgt.hasElement())
-        throw new Exception("Rule \""+ruleId+"\": Not supported yet");
-    }
-
-    
-    TypeDetails type = null;
-    if (tgt.hasTransform()) {
-      type = analyseTransform(context, map, tgt, var, vars);
-        // profiling: dest.setProperty(tgt.getElement().hashCode(), tgt.getElement(), v);
-    } else {
-      Property vp = var.property.baseProperty.getChild(tgt.getElement(),  tgt.getElement());
-      if (vp == null)
-        throw new Exception("Unknown Property "+tgt.getElement()+" on "+var.property.path);
-      
-      type = new TypeDetails(CollectionStatus.SINGLETON, vp.getType(tgt.getElement()));
-    }
-
-    if (tgt.getTransform() == StructureMapTransform.CREATE) {
-      String s = getParamString(vars, tgt.getParameter().get(0));
-      if (worker.getResourceNames().contains(s))
-        tw.newResource(tgt.getVariable(), s);
-    } else { 
-      boolean mapsSrc = false;
-      for (StructureMapGroupRuleTargetParameterComponent p : tgt.getParameter()) {
-        Type pr = p.getValue();
-        if (pr instanceof IdType && ((IdType) pr).asStringValue().equals(tv)) 
-          mapsSrc = true;
-      }
-      if (mapsSrc) { 
-        if (var == null)
-          throw new Error("Rule \""+ruleId+"\": Attempt to assign with no context");
-        tw.valueAssignment(tgt.getContext(), var.property.getPath()+"."+tgt.getElement()+getTransformSuffix(tgt.getTransform()));
-      } else if (tgt.hasContext()) {
-        if (isSignificantElement(var.property, tgt.getElement())) {
-          String td = describeTransform(tgt);
-          if (td != null)
-            tw.keyAssignment(tgt.getContext(), var.property.getPath()+"."+tgt.getElement()+" = "+td);
-        }
-      }
-    }
-    Type fixed = generateFixedValue(tgt);
-    
-    PropertyWithType prop = updateProfile(var, tgt.getElement(), type, map, profiles, sliceName, fixed, tgt);
-    if (tgt.hasVariable())
-      if (tgt.hasElement())
-        vars.add(VariableMode.OUTPUT, tgt.getVariable(), prop); 
-      else
-        vars.add(VariableMode.OUTPUT, tgt.getVariable(), prop); 
-  }
-  
-  private Type generateFixedValue(StructureMapGroupRuleTargetComponent tgt) {
-    if (!allParametersFixed(tgt))
-      return null;
-    if (!tgt.hasTransform())
-      return null;
-    switch (tgt.getTransform()) {
-    case COPY: return tgt.getParameter().get(0).getValue(); 
-    case TRUNCATE: return null; 
-    //case ESCAPE: 
-    //case CAST: 
-    //case APPEND: 
-    case TRANSLATE: return null; 
-  //case DATEOP, 
-  //case UUID, 
-  //case POINTER, 
-  //case EVALUATE, 
-    case CC: 
-      CodeableConcept cc = new CodeableConcept();
-      cc.addCoding(buildCoding(tgt.getParameter().get(0).getValue(), tgt.getParameter().get(1).getValue()));
-      return cc;
-    case C: 
-      return buildCoding(tgt.getParameter().get(0).getValue(), tgt.getParameter().get(1).getValue());
-    case QTY: return null; 
-  //case ID, 
-  //case CP, 
-    default:
-      return null;
-    }
-  }
-
-  @SuppressWarnings("rawtypes")
-  private Coding buildCoding(Type value1, Type value2) {
-    return new Coding().setSystem(((PrimitiveType) value1).asStringValue()).setCode(((PrimitiveType) value2).asStringValue()) ;
-  }
-
-  private boolean allParametersFixed(StructureMapGroupRuleTargetComponent tgt) {
-    for (StructureMapGroupRuleTargetParameterComponent p : tgt.getParameter()) {
-      Type pr = p.getValue();
-      if (pr instanceof IdType)
-        return false;
-    }
-    return true;
-  }
-
-  private String describeTransform(StructureMapGroupRuleTargetComponent tgt) throws FHIRException {
-    switch (tgt.getTransform()) {
-    case COPY: return null; 
-    case TRUNCATE: return null; 
-    //case ESCAPE: 
-    //case CAST: 
-    //case APPEND: 
-    case TRANSLATE: return null; 
-  //case DATEOP, 
-  //case UUID, 
-  //case POINTER, 
-  //case EVALUATE, 
-    case CC: return describeTransformCCorC(tgt); 
-    case C: return describeTransformCCorC(tgt); 
-    case QTY: return null; 
-  //case ID, 
-  //case CP, 
-    default:
-      return null;
-    }
-  }
-
-  @SuppressWarnings("rawtypes")
-  private String describeTransformCCorC(StructureMapGroupRuleTargetComponent tgt) throws FHIRException {
-    if (tgt.getParameter().size() < 2)
-      return null;
-    Type p1 = tgt.getParameter().get(0).getValue();
-    Type p2 = tgt.getParameter().get(1).getValue();
-    if (p1 instanceof IdType || p2 instanceof IdType)
-      return null;
-    if (!(p1 instanceof PrimitiveType) || !(p2 instanceof PrimitiveType))
-      return null;
-    String uri = ((PrimitiveType) p1).asStringValue();
-    String code = ((PrimitiveType) p2).asStringValue();
-    if (Utilities.noString(uri))
-      throw new FHIRException("Describe Transform, but the uri is blank");
-    if (Utilities.noString(code))
-      throw new FHIRException("Describe Transform, but the code is blank");
-    Coding c = buildCoding(uri, code);
-    return NarrativeGenerator.describeSystem(c.getSystem())+"#"+c.getCode()+(c.hasDisplay() ? "("+c.getDisplay()+")" : "");
-  }
-
-
-  private boolean isSignificantElement(PropertyWithType property, String element) {
-    if ("Observation".equals(property.getPath()))
-      return "code".equals(element);
-    else if ("Bundle".equals(property.getPath()))
-      return "type".equals(element);
-    else
-      return false;
-  }
-
-  private String getTransformSuffix(StructureMapTransform transform) {
-    switch (transform) {
-    case COPY: return ""; 
-    case TRUNCATE: return " (truncated)"; 
-    //case ESCAPE: 
-    //case CAST: 
-    //case APPEND: 
-    case TRANSLATE: return " (translated)"; 
-  //case DATEOP, 
-  //case UUID, 
-  //case POINTER, 
-  //case EVALUATE, 
-    case CC: return " (--> CodeableConcept)"; 
-    case C: return " (--> Coding)"; 
-    case QTY: return " (--> Quantity)"; 
-  //case ID, 
-  //case CP, 
-    default:
-      return " {??)";
-    }
-  }
-
-  private PropertyWithType updateProfile(VariableForProfiling var, String element, TypeDetails type, StructureMap map, List profiles, String sliceName, Type fixed, StructureMapGroupRuleTargetComponent tgt) throws FHIRException {
-    if (var == null) {
-      assert (Utilities.noString(element));
-      // 1. start the new structure definition
-      StructureDefinition sdn = worker.fetchResource(StructureDefinition.class, type.getType());
-      if (sdn == null)
-        throw new FHIRException("Unable to find definition for "+type.getType());
-      ElementDefinition edn = sdn.getSnapshot().getElementFirstRep();
-      PropertyWithType pn = createProfile(map, profiles, new PropertyWithType(sdn.getId(), new Property(worker, edn, sdn), null, type), sliceName, tgt);
-
-//      // 2. hook it into the base bundle
-//      if (type.getType().startsWith("http://hl7.org/fhir/StructureDefinition/") && worker.getResourceNames().contains(type.getType().substring(40))) {
-//        StructureDefinition sd = var.getProperty().profileProperty.getStructure();
-//        ElementDefinition ed = sd.getDifferential().addElement();
-//        ed.setPath("Bundle.entry");
-//        ed.setName(sliceName);
-//        ed.setMax("1"); // well, it is for now...
-//        ed = sd.getDifferential().addElement();
-//        ed.setPath("Bundle.entry.fullUrl");
-//        ed.setMin(1);
-//        ed = sd.getDifferential().addElement();
-//        ed.setPath("Bundle.entry.resource");
-//        ed.setMin(1);
-//        ed.addType().setCode(pn.getProfileProperty().getStructure().getType()).setProfile(pn.getProfileProperty().getStructure().getUrl());
-//      }
-      return pn; 
-    } else {
-      assert (!Utilities.noString(element));
-      Property pvb = var.getProperty().getBaseProperty();
-      Property pvd = var.getProperty().getProfileProperty();
-      Property pc = pvb.getChild(element, var.property.types);
-      if (pc == null)
-        throw new DefinitionException("Unable to find a definition for "+pvb.getDefinition().getPath()+"."+element);
-      
-      // the profile structure definition (derived)
-      StructureDefinition sd = var.getProperty().profileProperty.getStructure();
-      ElementDefinition ednew = sd.getDifferential().addElement();
-      ednew.setPath(var.getProperty().profileProperty.getDefinition().getPath()+"."+pc.getName());
-      ednew.setUserData("slice-name", sliceName);
-      ednew.setFixed(fixed);
-      for (ProfiledType pt : type.getProfiledTypes()) {
-        if (pt.hasBindings())
-          ednew.setBinding(pt.getBindings().get(0));
-        if (pt.getUri().startsWith("http://hl7.org/fhir/StructureDefinition/")) {
-          String t = pt.getUri().substring(40);
-          t = checkType(t, pc, pt.getProfiles());
-          if (t != null) {
-            if (pt.hasProfiles()) {
-              for (String p : pt.getProfiles())
-                if (t.equals("Reference"))
-                  ednew.addType().setCode(t).setTargetProfile(p);
-                else
-                  ednew.addType().setCode(t).setProfile(p);
-            } else 
-            ednew.addType().setCode(t);
-      }
-        }
-      }
-      
-      return new PropertyWithType(var.property.path+"."+element, pc, new Property(worker, ednew, sd), type);
-    }
-  }
-  
-
-
-  private String checkType(String t, Property pvb, List profiles) throws FHIRException {
-    if (pvb.getDefinition().getType().size() == 1 && isCompatibleType(t, pvb.getDefinition().getType().get(0).getCode()) && profilesMatch(profiles, pvb.getDefinition().getType().get(0).getProfile())) 
-      return null;
-    for (TypeRefComponent tr : pvb.getDefinition().getType()) {
-      if (isCompatibleType(t, tr.getCode()))
-        return tr.getCode(); // note what is returned - the base type, not the inferred mapping type
-    }
-    throw new FHIRException("The type "+t+" is not compatible with the allowed types for "+pvb.getDefinition().getPath());
-  }
-
-  private boolean profilesMatch(List profiles, String profile) {
-    return profiles == null || profiles.size() == 0 || (profiles.size() == 1 && profiles.get(0).equals(profile));
-  }
-
-  private boolean isCompatibleType(String t, String code) {
-    if (t.equals(code))
-      return true;
-    if (t.equals("string")) {
-      StructureDefinition sd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code);
-      if (sd != null && sd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/string"))
-        return true;
-    }
-    return false;
-  }
-
-  private TypeDetails analyseTransform(TransformContext context, StructureMap map, StructureMapGroupRuleTargetComponent tgt, VariableForProfiling var, VariablesForProfiling vars) throws FHIRException {
-    switch (tgt.getTransform()) {
-    case CREATE :
-      String p = getParamString(vars, tgt.getParameter().get(0));
-      return new TypeDetails(CollectionStatus.SINGLETON, p);
-    case COPY : 
-      return getParam(vars, tgt.getParameter().get(0));
-    case EVALUATE :
-      ExpressionNode expr = (ExpressionNode) tgt.getUserData(MAP_EXPRESSION);
-      if (expr == null) {
-        expr = fpe.parse(getParamString(vars, tgt.getParameter().get(tgt.getParameter().size()-1)));
-        tgt.setUserData(MAP_WHERE_EXPRESSION, expr);
-      }
-      return fpe.check(vars, null, expr);
-
-////case TRUNCATE : 
-////  String src = getParamString(vars, tgt.getParameter().get(0));
-////  String len = getParamString(vars, tgt.getParameter().get(1));
-////  if (Utilities.isInteger(len)) {
-////    int l = Integer.parseInt(len);
-////    if (src.length() > l)
-////      src = src.substring(0, l);
-////  }
-////  return new StringType(src);
-////case ESCAPE : 
-////  throw new Error("Transform "+tgt.getTransform().toCode()+" not supported yet");
-////case CAST :
-////  throw new Error("Transform "+tgt.getTransform().toCode()+" not supported yet");
-////case APPEND : 
-////  throw new Error("Transform "+tgt.getTransform().toCode()+" not supported yet");
-    case TRANSLATE : 
-      return new TypeDetails(CollectionStatus.SINGLETON, "CodeableConcept");
-   case CC:
-     ProfiledType res = new ProfiledType("CodeableConcept");
-     if (tgt.getParameter().size() >= 2  && isParamId(vars, tgt.getParameter().get(1))) {
-       TypeDetails td = vars.get(null, getParamId(vars, tgt.getParameter().get(1))).property.types;
-       if (td != null && td.hasBinding())
-         // todo: do we need to check that there's no implicit translation her? I don't think we do...
-         res.addBinding(td.getBinding());
-     }
-     return new TypeDetails(CollectionStatus.SINGLETON, res);
-   case C:
-     return new TypeDetails(CollectionStatus.SINGLETON, "Coding");
-   case QTY:
-     return new TypeDetails(CollectionStatus.SINGLETON, "Quantity");
-   case REFERENCE :
-      VariableForProfiling vrs = vars.get(VariableMode.OUTPUT, getParamId(vars, tgt.getParameterFirstRep()));
-      if (vrs == null)
-        throw new FHIRException("Unable to resolve variable \""+getParamId(vars, tgt.getParameterFirstRep())+"\"");
-      String profile = vrs.property.getProfileProperty().getStructure().getUrl();
-     TypeDetails td = new TypeDetails(CollectionStatus.SINGLETON);
-     td.addType("Reference", profile);
-     return td;  
-////case DATEOP :
-////  throw new Error("Transform "+tgt.getTransform().toCode()+" not supported yet");
-////case UUID :
-////  return new IdType(UUID.randomUUID().toString());
-////case POINTER :
-////  Base b = getParam(vars, tgt.getParameter().get(0));
-////  if (b instanceof Resource)
-////    return new UriType("urn:uuid:"+((Resource) b).getId());
-////  else
-////    throw new FHIRException("Transform engine cannot point at an element of type "+b.fhirType());
-    default:
-      throw new Error("Transform Unknown or not handled yet: "+tgt.getTransform().toCode());
-    }
-  }
-  private String getParamString(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) {
-    Type p = parameter.getValue();
-    if (p == null || p instanceof IdType)
-      return null;
-    if (!p.hasPrimitiveValue())
-      return null;
-    return p.primitiveValue();
-  }
-
-  private String getParamId(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) {
-    Type p = parameter.getValue();
-    if (p == null || !(p instanceof IdType))
-      return null;
-    return p.primitiveValue();
-  }
-
-  private boolean isParamId(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) {
-    Type p = parameter.getValue();
-    if (p == null || !(p instanceof IdType))
-      return false;
-    return vars.get(null, p.primitiveValue()) != null;
-  }
-
-  private TypeDetails getParam(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) throws DefinitionException {
-    Type p = parameter.getValue();
-    if (!(p instanceof IdType))
-      return new TypeDetails(CollectionStatus.SINGLETON, "http://hl7.org/fhir/StructureDefinition/"+p.fhirType());
-    else { 
-      String n = ((IdType) p).asStringValue();
-      VariableForProfiling b = vars.get(VariableMode.INPUT, n);
-      if (b == null)
-        b = vars.get(VariableMode.OUTPUT, n);
-      if (b == null)
-        throw new DefinitionException("Variable "+n+" not found ("+vars.summary()+")");
-      return b.getProperty().getTypes();
-    }
-  }
-
-  private PropertyWithType createProfile(StructureMap map, List profiles, PropertyWithType prop, String sliceName, Base ctxt) throws DefinitionException {
-    if (prop.getBaseProperty().getDefinition().getPath().contains(".")) 
-      throw new DefinitionException("Unable to process entry point");
-
-    String type = prop.getBaseProperty().getDefinition().getPath();
-    String suffix = "";
-    if (ids.containsKey(type)) {
-      int id = ids.get(type);
-      id++;
-      ids.put(type, id);
-      suffix = "-"+Integer.toString(id);
-    } else
-      ids.put(type, 0);
-    
-    StructureDefinition profile = new StructureDefinition();
-    profiles.add(profile);
-    profile.setDerivation(TypeDerivationRule.CONSTRAINT);
-    profile.setType(type);
-    profile.setBaseDefinition(prop.getBaseProperty().getStructure().getUrl());
-    profile.setName("Profile for "+profile.getType()+" for "+sliceName);
-    profile.setUrl(map.getUrl().replace("StructureMap", "StructureDefinition")+"-"+profile.getType()+suffix);
-    ctxt.setUserData("profile", profile.getUrl()); // then we can easily assign this profile url for validation later when we actually transform
-    profile.setId(map.getId()+"-"+profile.getType()+suffix);
-    profile.setStatus(map.getStatus());
-    profile.setExperimental(map.getExperimental());
-    profile.setDescription("Generated automatically from the mapping by the Java Reference Implementation");
-    for (ContactDetail c : map.getContact()) {
-      ContactDetail p = profile.addContact();
-      p.setName(c.getName());
-      for (ContactPoint cc : c.getTelecom()) 
-        p.addTelecom(cc);
-    }
-    profile.setDate(map.getDate());
-    profile.setCopyright(map.getCopyright());
-    profile.setFhirVersion(Constants.VERSION);
-    profile.setKind(prop.getBaseProperty().getStructure().getKind());
-    profile.setAbstract(false);
-    ElementDefinition ed = profile.getDifferential().addElement();
-    ed.setPath(profile.getType());
-    prop.profileProperty = new Property(worker, ed, profile);
-    return prop;
-  }
-
-  private PropertyWithType resolveType(StructureMap map, String type, StructureMapInputMode mode) throws Exception {
-    for (StructureMapStructureComponent imp : map.getStructure()) {
-      if ((imp.getMode() == StructureMapModelMode.SOURCE && mode == StructureMapInputMode.SOURCE) || 
-          (imp.getMode() == StructureMapModelMode.TARGET && mode == StructureMapInputMode.TARGET)) {
-        StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl());
-        if (sd == null)
-          throw new Exception("Import "+imp.getUrl()+" cannot be resolved");
-        if (sd.getId().equals(type)) {
-          return new PropertyWithType(sd.getType(), new Property(worker, sd.getSnapshot().getElement().get(0), sd), null, new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl()));
-        }
-      }
-    }
-    throw new Exception("Unable to find structure definition for "+type+" in imports");
-  }
-
-
-  public StructureMap generateMapFromMappings(StructureDefinition sd) throws IOException, FHIRException {
-    String id = getLogicalMappingId(sd);
-    if (id == null) 
-        return null;
-    String prefix = ToolingExtensions.readStringExtension(sd,  ToolingExtensions.EXT_MAPPING_PREFIX);
-    String suffix = ToolingExtensions.readStringExtension(sd,  ToolingExtensions.EXT_MAPPING_SUFFIX);
-    if (prefix == null || suffix == null)
-      return null;
-    // we build this by text. Any element that has a mapping, we put it's mappings inside it....
-    StringBuilder b = new StringBuilder();
-    b.append(prefix);
-
-    ElementDefinition root = sd.getSnapshot().getElementFirstRep();
-    String m = getMapping(root, id);
-    if (m != null)
-      b.append(m+"\r\n");
-    addChildMappings(b, id, "", sd, root, false);
-    b.append("\r\n");
-    b.append(suffix);
-    b.append("\r\n");
-    TextFile.stringToFile(b.toString(), "c:\\temp\\test.map");
-    StructureMap map = parse(b.toString());
-    map.setId(tail(map.getUrl()));
-    if (!map.hasStatus())
-      map.setStatus(PublicationStatus.DRAFT);
-    map.getText().setStatus(NarrativeStatus.GENERATED);
-    map.getText().setDiv(new XhtmlNode(NodeType.Element, "div"));
-    map.getText().getDiv().addTag("pre").addText(render(map));
-    return map;
-  }
-
-
-  private String tail(String url) {
-    return url.substring(url.lastIndexOf("/")+1);
-  }
-
-
-  private void addChildMappings(StringBuilder b, String id, String indent, StructureDefinition sd, ElementDefinition ed, boolean inner) throws DefinitionException {
-    boolean first = true;
-    List children = ProfileUtilities.getChildMap(sd, ed);
-    for (ElementDefinition child : children) {
-      if (first && inner) {
-        b.append(" then {\r\n");
-        first = false;
-      }
-      String map = getMapping(child, id);
-      if (map != null) {
-        b.append(indent+"  "+child.getPath()+": "+map);
-        addChildMappings(b, id, indent+"  ", sd, child, true);
-        b.append("\r\n");
-      }
-    }
-    if (!first && inner)
-      b.append(indent+"}");
-    
-  }
-
-
-  private String getMapping(ElementDefinition ed, String id) {
-    for (ElementDefinitionMappingComponent map : ed.getMapping())
-      if (id.equals(map.getIdentity()))
-        return map.getMap();
-    return null;
-  }
-
-
-  private String getLogicalMappingId(StructureDefinition sd) {
-    String id = null;
-    for (StructureDefinitionMappingComponent map : sd.getMapping()) {
-      if ("http://hl7.org/fhir/logical".equals(map.getUri()))
-        return map.getIdentity();
-    }
-    return null;
-  }
-	
-}
+package org.hl7.fhir.dstu3.utils;
+
+// remember group resolution
+// trace - account for which wasn't transformed in the source
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
+import org.hl7.fhir.dstu3.conformance.ProfileUtilities.ProfileKnowledgeProvider;
+import org.hl7.fhir.dstu3.context.IWorkerContext;
+import org.hl7.fhir.dstu3.context.IWorkerContext.ValidationResult;
+import org.hl7.fhir.dstu3.elementmodel.Element;
+import org.hl7.fhir.dstu3.elementmodel.Property;
+import org.hl7.fhir.dstu3.model.Base;
+import org.hl7.fhir.dstu3.model.BooleanType;
+import org.hl7.fhir.dstu3.model.CodeType;
+import org.hl7.fhir.dstu3.model.CodeableConcept;
+import org.hl7.fhir.dstu3.model.Coding;
+import org.hl7.fhir.dstu3.model.ConceptMap;
+import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent;
+import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent;
+import org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent;
+import org.hl7.fhir.dstu3.model.Constants;
+import org.hl7.fhir.dstu3.model.ContactDetail;
+import org.hl7.fhir.dstu3.model.ContactPoint;
+import org.hl7.fhir.dstu3.model.DecimalType;
+import org.hl7.fhir.dstu3.model.ElementDefinition;
+import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent;
+import org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent;
+import org.hl7.fhir.dstu3.model.Enumeration;
+import org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence;
+import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;
+import org.hl7.fhir.dstu3.model.ExpressionNode;
+import org.hl7.fhir.dstu3.model.ExpressionNode.CollectionStatus;
+import org.hl7.fhir.dstu3.model.IdType;
+import org.hl7.fhir.dstu3.model.IntegerType;
+import org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus;
+import org.hl7.fhir.dstu3.model.PrimitiveType;
+import org.hl7.fhir.dstu3.model.Reference;
+import org.hl7.fhir.dstu3.model.Resource;
+import org.hl7.fhir.dstu3.model.ResourceFactory;
+import org.hl7.fhir.dstu3.model.StringType;
+import org.hl7.fhir.dstu3.model.StructureDefinition;
+import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent;
+import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule;
+import org.hl7.fhir.dstu3.model.StructureMap;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupInputComponent;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleComponent;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleDependentComponent;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleSourceComponent;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetComponent;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupRuleTargetParameterComponent;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupTypeMode;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapInputMode;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapSourceListMode;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapTargetListMode;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapModelMode;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapStructureComponent;
+import org.hl7.fhir.dstu3.model.StructureMap.StructureMapTransform;
+import org.hl7.fhir.dstu3.model.Type;
+import org.hl7.fhir.dstu3.model.TypeDetails;
+import org.hl7.fhir.dstu3.model.TypeDetails.ProfiledType;
+import org.hl7.fhir.dstu3.model.UriType;
+import org.hl7.fhir.dstu3.model.ValueSet;
+import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent;
+import org.hl7.fhir.dstu3.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
+import org.hl7.fhir.dstu3.utils.FHIRLexer.FHIRLexerException;
+import org.hl7.fhir.dstu3.utils.FHIRPathEngine.IEvaluationContext;
+import org.hl7.fhir.exceptions.DefinitionException;
+import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.exceptions.PathEngineException;
+import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
+import org.hl7.fhir.utilities.TextFile;
+import org.hl7.fhir.utilities.Utilities;
+import org.hl7.fhir.utilities.xhtml.NodeType;
+import org.hl7.fhir.utilities.xhtml.XhtmlNode;
+
+/**
+ * Services in this class:
+ * 
+ * string render(map) - take a structure and convert it to text
+ * map parse(text) - take a text representation and parse it 
+ * getTargetType(map) - return the definition for the type to create to hand in 
+ * transform(appInfo, source, map, target) - transform from source to target following the map
+ * analyse(appInfo, map) - generate profiles and other analysis artifacts for the targets of the transform
+ * map generateMapFromMappings(StructureDefinition) - build a mapping from a structure definition with loigcal mappings
+ *  
+ * @author Grahame Grieve
+ *
+ */
+public class StructureMapUtilities {
+
+	public class ResolvedGroup {
+    public StructureMapGroupComponent target;
+    public StructureMap targetMap;
+  }
+  public static final String MAP_WHERE_CHECK = "map.where.check";
+	public static final String MAP_WHERE_EXPRESSION = "map.where.expression";
+	public static final String MAP_SEARCH_EXPRESSION = "map.search.expression";
+	public static final String MAP_EXPRESSION = "map.transform.expression";
+  private static final boolean RENDER_MULTIPLE_TARGETS_ONELINE = true;
+  private static final String AUTO_VAR_NAME = "vvv";
+
+	public interface ITransformerServices {
+		//    public boolean validateByValueSet(Coding code, String valuesetId);
+	  public void log(String message); // log internal progress
+	  public Base createType(Object appInfo, String name) throws FHIRException;
+    public Base createResource(Object appInfo, Base res); // an already created resource is provided; this is to identify/store it
+		public Coding translate(Object appInfo, Coding source, String conceptMapUrl) throws FHIRException;
+		//    public Coding translate(Coding code)
+		//    ValueSet validation operation
+		//    Translation operation
+		//    Lookup another tree of data
+		//    Create an instance tree
+		//    Return the correct string format to refer to a tree (input or output)
+    public Base resolveReference(Object appContext, String url);
+    public List performSearch(Object appContext, String url);
+	}
+
+	private class FFHIRPathHostServices implements IEvaluationContext{
+
+    public Base resolveConstant(Object appContext, String name) throws PathEngineException {
+      Variables vars = (Variables) appContext;
+      Base res = vars.get(VariableMode.INPUT, name);
+      if (res == null)
+        res = vars.get(VariableMode.OUTPUT, name);
+      return res;
+    }
+
+    @Override
+    public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException {
+      if (!(appContext instanceof VariablesForProfiling)) 
+        throw new Error("Internal Logic Error (wrong type '"+appContext.getClass().getName()+"' in resolveConstantType)");
+      VariablesForProfiling vars = (VariablesForProfiling) appContext;
+      VariableForProfiling v = vars.get(null, name);
+      if (v == null)
+        throw new PathEngineException("Unknown variable '"+name+"' from variables "+vars.summary());
+      return v.property.types;
+    }
+
+    @Override
+    public boolean log(String argument, List focus) {
+      throw new Error("Not Implemented Yet");
+    }
+
+    @Override
+    public FunctionDetails resolveFunction(String functionName) {
+      return null; // throw new Error("Not Implemented Yet");
+    }
+
+    @Override
+    public TypeDetails checkFunction(Object appContext, String functionName, List parameters) throws PathEngineException {
+      throw new Error("Not Implemented Yet");
+    }
+
+    @Override
+    public List executeFunction(Object appContext, String functionName, List> parameters) {
+      throw new Error("Not Implemented Yet");
+    }
+
+    @Override
+    public Base resolveReference(Object appContext, String url) {
+      if (services == null)
+        return null;
+      return services.resolveReference(appContext, url);
+    }
+	  
+	}
+	private IWorkerContext worker;
+	private FHIRPathEngine fpe;
+	private Map library;
+	private ITransformerServices services;
+  private ProfileKnowledgeProvider pkp;
+  private Map ids = new HashMap(); 
+
+	public StructureMapUtilities(IWorkerContext worker, Map library, ITransformerServices services, ProfileKnowledgeProvider pkp) {
+		super();
+		this.worker = worker;
+		this.library = library;
+		this.services = services;
+		this.pkp = pkp;
+		fpe = new FHIRPathEngine(worker);
+		fpe.setHostServices(new FFHIRPathHostServices());
+	}
+
+	public StructureMapUtilities(IWorkerContext worker, Map library, ITransformerServices services) {
+		super();
+		this.worker = worker;
+		this.library = library;
+		this.services = services;
+		fpe = new FHIRPathEngine(worker);
+    fpe.setHostServices(new FFHIRPathHostServices());
+	}
+
+  public StructureMapUtilities(IWorkerContext worker, Map library) {
+    super();
+    this.worker = worker;
+    this.library = library;
+    fpe = new FHIRPathEngine(worker);
+    fpe.setHostServices(new FFHIRPathHostServices());
+  }
+
+  public StructureMapUtilities(IWorkerContext worker) {
+    super();
+    this.worker = worker;
+    fpe = new FHIRPathEngine(worker);
+    fpe.setHostServices(new FFHIRPathHostServices());
+  }
+
+  public StructureMapUtilities(IWorkerContext worker, ITransformerServices services) {
+    super();
+    this.worker = worker;
+    this.library = new HashMap();
+    for (org.hl7.fhir.dstu3.model.MetadataResource bc : worker.allConformanceResources()) {
+      if (bc instanceof StructureMap)
+        library.put(bc.getUrl(), (StructureMap) bc);
+    }
+    this.services = services;
+    fpe = new FHIRPathEngine(worker);
+    fpe.setHostServices(new FFHIRPathHostServices());
+  }
+
+	public static String render(StructureMap map) {
+		StringBuilder b = new StringBuilder();
+		b.append("map \"");
+		b.append(map.getUrl());
+		b.append("\" = \"");
+		b.append(Utilities.escapeJava(map.getName()));
+		b.append("\"\r\n\r\n");
+
+		renderConceptMaps(b, map);
+		renderUses(b, map);
+		renderImports(b, map);
+		for (StructureMapGroupComponent g : map.getGroup())
+			renderGroup(b, g);
+		return b.toString();
+	}
+
+	private static void renderConceptMaps(StringBuilder b, StructureMap map) {
+    for (Resource r : map.getContained()) {
+      if (r instanceof ConceptMap) {
+        produceConceptMap(b, (ConceptMap) r);
+      }
+    }
+  }
+
+  private static void produceConceptMap(StringBuilder b, ConceptMap cm) {
+    b.append("conceptmap \"");
+    b.append(cm.getId());
+    b.append("\" {\r\n");
+    Map prefixesSrc = new HashMap();
+    Map prefixesTgt = new HashMap();
+    char prefix = 's';
+    for (ConceptMapGroupComponent cg : cm.getGroup()) {
+      if (!prefixesSrc.containsKey(cg.getSource())) {
+        prefixesSrc.put(cg.getSource(), String.valueOf(prefix));
+        b.append("  prefix ");
+        b.append(prefix);
+        b.append(" = \"");
+        b.append(cg.getSource());
+        b.append("\"\r\n");
+        prefix++;
+      }
+      if (!prefixesTgt.containsKey(cg.getTarget())) {
+        prefixesTgt.put(cg.getTarget(), String.valueOf(prefix));
+        b.append("  prefix ");
+        b.append(prefix);
+        b.append(" = \"");
+        b.append(cg.getTarget());
+        b.append("\"\r\n");
+        prefix++;
+      }
+    }
+    b.append("\r\n");
+    for (ConceptMapGroupComponent cg : cm.getGroup()) {
+      for (SourceElementComponent ce : cg.getElement()) {
+        b.append("  ");
+        b.append(prefixesSrc.get(cg.getSource()));
+        b.append(":");
+        b.append(ce.getCode());
+        b.append(" ");
+        b.append(getChar(ce.getTargetFirstRep().getEquivalence()));
+        b.append(" ");
+        b.append(prefixesTgt.get(cg.getTarget()));
+        b.append(":");
+        b.append(ce.getTargetFirstRep().getCode());
+        b.append("\r\n");
+      }
+    }
+    b.append("}\r\n\r\n");
+  }
+
+  private static Object getChar(ConceptMapEquivalence equivalence) {
+    switch (equivalence) {
+    case RELATEDTO: return "-";
+    case EQUAL: return "=";
+    case EQUIVALENT: return "==";
+    case DISJOINT: return "!=";
+    case UNMATCHED: return "--";
+    case WIDER: return "<=";
+    case SUBSUMES: return "<-";
+    case NARROWER: return ">=";
+    case SPECIALIZES: return ">-";
+    case INEXACT: return "~";
+    default: return "??";
+    }
+  }
+
+  private static void renderUses(StringBuilder b, StructureMap map) {
+		for (StructureMapStructureComponent s : map.getStructure()) {
+			b.append("uses \"");
+			b.append(s.getUrl());
+      b.append("\" ");
+      if (s.hasAlias()) {
+        b.append("alias ");
+        b.append(s.getAlias());
+        b.append(" ");
+      }
+      b.append("as ");
+			b.append(s.getMode().toCode());
+			b.append("\r\n");
+			renderDoco(b, s.getDocumentation());
+		}
+		if (map.hasStructure())
+			b.append("\r\n");
+	}
+
+	private static void renderImports(StringBuilder b, StructureMap map) {
+		for (UriType s : map.getImport()) {
+			b.append("imports \"");
+			b.append(s.getValue());
+			b.append("\"\r\n");
+		}
+		if (map.hasImport())
+			b.append("\r\n");
+	}
+
+  public static String groupToString(StructureMapGroupComponent g) {
+    StringBuilder b = new StringBuilder();
+    renderGroup(b, g);
+    return b.toString();
+  }
+  
+  private static void renderGroup(StringBuilder b, StructureMapGroupComponent g) {
+		b.append("group ");
+      switch (g.getTypeMode()) {
+      case TYPES:
+        b.append("for types");
+        break;
+      case TYPEANDTYPES:
+        b.append("for type+types ");
+        break;
+      default: // NONE, NULL
+        break;
+      }
+		b.append(g.getName());
+		if (g.hasExtends()) {
+			b.append(" extends ");
+			b.append(g.getExtends());
+		}
+		if (g.hasDocumentation()) 
+			renderDoco(b, g.getDocumentation());
+		b.append("\r\n");
+		for (StructureMapGroupInputComponent gi : g.getInput()) {
+			b.append("  input ");
+			b.append(gi.getName());
+			if (gi.hasType()) {
+				b.append(" : ");
+				b.append(gi.getType());
+			}
+			b.append(" as ");
+			b.append(gi.getMode().toCode());
+			b.append("\r\n");
+		}
+		if (g.hasInput())
+			b.append("\r\n");
+		for (StructureMapGroupRuleComponent r : g.getRule()) {
+			renderRule(b, r, 2);
+		}
+		b.append("\r\nendgroup\r\n");
+	}
+
+  public static String ruleToString(StructureMapGroupRuleComponent r) {
+    StringBuilder b = new StringBuilder();
+    renderRule(b, r, 0);
+    return b.toString();
+  }
+  
+	private static void renderRule(StringBuilder b, StructureMapGroupRuleComponent r, int indent) {
+		for (int i = 0; i < indent; i++)
+			b.append(' ');
+		b.append(r.getName());
+		b.append(" : for ");
+		boolean canBeAbbreviated = checkisSimple(r);
+		
+		boolean first = true;
+		for (StructureMapGroupRuleSourceComponent rs : r.getSource()) {
+			if (first)
+				first = false;
+			else
+				b.append(", ");
+			renderSource(b, rs, canBeAbbreviated);
+		}
+		if (r.getTarget().size() > 1) {
+			b.append(" make ");
+			first = true;
+			for (StructureMapGroupRuleTargetComponent rt : r.getTarget()) {
+				if (first)
+					first = false;
+				else
+					b.append(", ");
+				if (RENDER_MULTIPLE_TARGETS_ONELINE)
+	        b.append(' ');
+				else {
+				b.append("\r\n");
+				for (int i = 0; i < indent+4; i++)
+					b.append(' ');
+				}
+				renderTarget(b, rt, false);
+			}
+		} else if (r.hasTarget()) { 
+			b.append(" make ");
+			renderTarget(b, r.getTarget().get(0), canBeAbbreviated);
+		}
+		if (!canBeAbbreviated) {
+		  if (r.hasRule()) {
+		    b.append(" then {\r\n");
+		    renderDoco(b, r.getDocumentation());
+		    for (StructureMapGroupRuleComponent ir : r.getRule()) {
+		      renderRule(b, ir, indent+2);
+		    }
+		    for (int i = 0; i < indent; i++)
+		      b.append(' ');
+		    b.append("}\r\n");
+		  } else {
+		    if (r.hasDependent()) {
+		      b.append(" then ");
+		      first = true;
+		      for (StructureMapGroupRuleDependentComponent rd : r.getDependent()) {
+		        if (first)
+		          first = false;
+		        else
+		          b.append(", ");
+		        b.append(rd.getName());
+		        b.append("(");
+		        boolean ifirst = true;
+		        for (StringType rdp : rd.getVariable()) {
+		          if (ifirst)
+		            ifirst = false;
+		          else
+		            b.append(", ");
+		          b.append(rdp.asStringValue());
+		        }
+		        b.append(")");
+		      }
+		    }
+		  }
+		}
+    renderDoco(b, r.getDocumentation());
+    b.append("\r\n");
+	}
+
+  private static boolean checkisSimple(StructureMapGroupRuleComponent r) {
+    return 
+          (r.getSource().size() == 1 && r.getSourceFirstRep().hasElement() && r.getSourceFirstRep().hasVariable()) && 
+          (r.getTarget().size() == 1 && r.getTargetFirstRep().hasVariable() && (r.getTargetFirstRep().getTransform() == null || r.getTargetFirstRep().getTransform() == StructureMapTransform.CREATE) && r.getTargetFirstRep().getParameter().size() == 0) &&
+          (r.getDependent().size() == 0);
+  }
+
+  public static String sourceToString(StructureMapGroupRuleSourceComponent r) {
+    StringBuilder b = new StringBuilder();
+    renderSource(b, r, false);
+    return b.toString();
+  }
+  
+	private static void renderSource(StringBuilder b, StructureMapGroupRuleSourceComponent rs, boolean abbreviate) {
+		b.append(rs.getContext());
+		if (rs.getContext().equals("@search")) {
+      b.append('(');
+      b.append(rs.getElement());
+      b.append(')');
+		} else if (rs.hasElement()) {
+			b.append('.');
+			b.append(rs.getElement());
+		}
+		if (rs.hasType()) {
+      b.append(" : ");
+      b.append(rs.getType());
+      if (rs.hasMin()) {
+        b.append(" ");
+        b.append(rs.getMin());
+        b.append("..");
+        b.append(rs.getMax());
+      }
+		}
+		
+		if (rs.hasListMode()) {
+			b.append(" ");
+				b.append(rs.getListMode().toCode());
+		}
+		if (rs.hasDefaultValue()) {
+		  b.append(" default ");
+		  assert rs.getDefaultValue() instanceof StringType;
+		  b.append("\""+Utilities.escapeJson(((StringType) rs.getDefaultValue()).asStringValue())+"\"");
+		}
+		if (!abbreviate && rs.hasVariable()) {
+			b.append(" as ");
+			b.append(rs.getVariable());
+		}
+		if (rs.hasCondition())  {
+			b.append(" where ");
+			b.append(rs.getCondition());
+		}
+		if (rs.hasCheck())  {
+			b.append(" check ");
+			b.append(rs.getCheck());
+		}
+	}
+
+  public static String targetToString(StructureMapGroupRuleTargetComponent rt) {
+    StringBuilder b = new StringBuilder();
+    renderTarget(b, rt, false);
+    return b.toString();
+  }
+	
+	private static void renderTarget(StringBuilder b, StructureMapGroupRuleTargetComponent rt, boolean abbreviate) {
+	  if (rt.hasContext()) {
+	    if (rt.getContextType() == StructureMapContextType.TYPE)
+	      b.append("@");
+		b.append(rt.getContext());
+		if (rt.hasElement())  {
+			b.append('.');
+			b.append(rt.getElement());
+		}
+	  }
+		if (!abbreviate && rt.hasTransform()) {
+	    if (rt.hasContext()) 
+			b.append(" = ");
+			if (rt.getTransform() == StructureMapTransform.COPY && rt.getParameter().size() == 1) {
+				renderTransformParam(b, rt.getParameter().get(0));
+      } else if (rt.getTransform() == StructureMapTransform.EVALUATE && rt.getParameter().size() == 1) {
+        b.append("(");
+        b.append("\""+((StringType) rt.getParameter().get(0).getValue()).asStringValue()+"\"");
+        b.append(")");
+			} else if (rt.getTransform() == StructureMapTransform.EVALUATE && rt.getParameter().size() == 2) {
+				b.append(rt.getTransform().toCode());
+				b.append("(");
+				b.append(((IdType) rt.getParameter().get(0).getValue()).asStringValue());
+				b.append("\""+((StringType) rt.getParameter().get(1).getValue()).asStringValue()+"\"");
+				b.append(")");
+			} else {
+				b.append(rt.getTransform().toCode());
+				b.append("(");
+				boolean first = true;
+				for (StructureMapGroupRuleTargetParameterComponent rtp : rt.getParameter()) {
+					if (first)
+						first = false;
+					else
+						b.append(", ");
+					renderTransformParam(b, rtp);
+				}
+				b.append(")");
+			}
+		}
+		if (!abbreviate && rt.hasVariable()) {
+			b.append(" as ");
+			b.append(rt.getVariable());
+		}
+		for (Enumeration lm : rt.getListMode()) {
+			b.append(" ");
+			b.append(lm.getValue().toCode());
+			if (lm.getValue() == StructureMapTargetListMode.SHARE) {
+				b.append(" ");
+				b.append(rt.getListRuleId());
+			}
+		}
+	}
+
+  public static String paramToString(StructureMapGroupRuleTargetParameterComponent rtp) {
+    StringBuilder b = new StringBuilder();
+    renderTransformParam(b, rtp);
+    return b.toString();
+  }
+  	
+	private static void renderTransformParam(StringBuilder b, StructureMapGroupRuleTargetParameterComponent rtp) {
+	  try {
+		if (rtp.hasValueBooleanType())
+			b.append(rtp.getValueBooleanType().asStringValue());
+		else if (rtp.hasValueDecimalType())
+			b.append(rtp.getValueDecimalType().asStringValue());
+		else if (rtp.hasValueIdType())
+			b.append(rtp.getValueIdType().asStringValue());
+		else if (rtp.hasValueDecimalType())
+			b.append(rtp.getValueDecimalType().asStringValue());
+		else if (rtp.hasValueIntegerType())
+			b.append(rtp.getValueIntegerType().asStringValue());
+		else 
+	      b.append("\""+Utilities.escapeJava(rtp.getValueStringType().asStringValue())+"\"");
+	  } catch (FHIRException e) {
+	    e.printStackTrace();
+	    b.append("error!");
+	  }
+	}
+
+	private static void renderDoco(StringBuilder b, String doco) {
+		if (Utilities.noString(doco))
+			return;
+		b.append(" // ");
+		b.append(doco.replace("\r\n", " ").replace("\r", " ").replace("\n", " "));
+	}
+
+	public StructureMap parse(String text) throws FHIRException {
+		FHIRLexer lexer = new FHIRLexer(text);
+		if (lexer.done())
+			throw lexer.error("Map Input cannot be empty");
+		lexer.skipComments();
+		lexer.token("map");
+		StructureMap result = new StructureMap();
+		result.setUrl(lexer.readConstant("url"));
+		lexer.token("=");
+		result.setName(lexer.readConstant("name"));
+		lexer.skipComments();
+
+		while (lexer.hasToken("conceptmap"))
+			parseConceptMap(result, lexer);
+
+		while (lexer.hasToken("uses"))
+			parseUses(result, lexer);
+		while (lexer.hasToken("imports"))
+			parseImports(result, lexer);
+
+		parseGroup(result, lexer);
+
+		while (!lexer.done()) {
+			parseGroup(result, lexer);    
+		}
+
+		return result;
+	}
+
+	private void parseConceptMap(StructureMap result, FHIRLexer lexer) throws FHIRLexerException {
+		lexer.token("conceptmap");
+		ConceptMap map = new ConceptMap();
+		String id = lexer.readConstant("map id");
+		if (!id.startsWith("#"))
+			lexer.error("Concept Map identifier must start with #");
+		map.setId(id);
+		map.setStatus(PublicationStatus.DRAFT); // todo: how to add this to the text format
+		result.getContained().add(map);
+		lexer.token("{");
+		lexer.skipComments();
+		//	  lexer.token("source");
+		//	  map.setSource(new UriType(lexer.readConstant("source")));
+		//	  lexer.token("target");
+		//	  map.setSource(new UriType(lexer.readConstant("target")));
+		Map prefixes = new HashMap();
+		while (lexer.hasToken("prefix")) {
+			lexer.token("prefix");
+			String n = lexer.take();
+			lexer.token("=");
+			String v = lexer.readConstant("prefix url");
+			prefixes.put(n, v);
+		}
+		while (!lexer.hasToken("}")) {
+		  String srcs = readPrefix(prefixes, lexer);
+			lexer.token(":");
+      String sc = lexer.getCurrent().startsWith("\"") ? lexer.readConstant("code") : lexer.take();
+		  ConceptMapEquivalence eq = readEquivalence(lexer);
+		  String tgts = (eq != ConceptMapEquivalence.UNMATCHED) ? readPrefix(prefixes, lexer) : "";
+		  ConceptMapGroupComponent g = getGroup(map, srcs, tgts);
+			SourceElementComponent e = g.addElement();
+			e.setCode(sc);
+      if (e.getCode().startsWith("\""))
+        e.setCode(lexer.processConstant(e.getCode()));
+			TargetElementComponent tgt = e.addTarget();
+			if (eq != ConceptMapEquivalence.EQUIVALENT)
+			  tgt.setEquivalence(eq);
+			if (tgt.getEquivalence() != ConceptMapEquivalence.UNMATCHED) {
+				lexer.token(":");
+				tgt.setCode(lexer.take());
+				if (tgt.getCode().startsWith("\""))
+				  tgt.setCode(lexer.processConstant(tgt.getCode()));
+			}
+			if (lexer.hasComment())
+				tgt.setComment(lexer.take().substring(2).trim());
+		}
+		lexer.token("}");
+	}
+
+
+	private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
+	  for (ConceptMapGroupComponent grp : map.getGroup()) {
+	    if (grp.getSource().equals(srcs)) 
+	      if ((tgts == null && !grp.hasTarget()) || (tgts != null && tgts.equals(grp.getTarget())))
+	      return grp;
+	  }
+	  ConceptMapGroupComponent grp = map.addGroup(); 
+    grp.setSource(srcs);
+    grp.setTarget(tgts);
+    return grp;
+  }
+
+
+	private String readPrefix(Map prefixes, FHIRLexer lexer) throws FHIRLexerException {
+		String prefix = lexer.take();
+		if (!prefixes.containsKey(prefix))
+			throw lexer.error("Unknown prefix '"+prefix+"'");
+		return prefixes.get(prefix);
+	}
+
+
+	private ConceptMapEquivalence readEquivalence(FHIRLexer lexer) throws FHIRLexerException {
+		String token = lexer.take();
+    if (token.equals("-"))
+      return ConceptMapEquivalence.RELATEDTO;
+    if (token.equals("="))
+      return ConceptMapEquivalence.EQUAL;
+		if (token.equals("=="))
+			return ConceptMapEquivalence.EQUIVALENT;
+		if (token.equals("!="))
+			return ConceptMapEquivalence.DISJOINT;
+		if (token.equals("--"))
+			return ConceptMapEquivalence.UNMATCHED;
+		if (token.equals("<="))
+			return ConceptMapEquivalence.WIDER;
+		if (token.equals("<-"))
+			return ConceptMapEquivalence.SUBSUMES;
+		if (token.equals(">="))
+			return ConceptMapEquivalence.NARROWER;
+		if (token.equals(">-"))
+			return ConceptMapEquivalence.SPECIALIZES;
+		if (token.equals("~"))
+			return ConceptMapEquivalence.INEXACT;
+		throw lexer.error("Unknown equivalence token '"+token+"'");
+	}
+
+
+	private void parseUses(StructureMap result, FHIRLexer lexer) throws FHIRException {
+		lexer.token("uses");
+		StructureMapStructureComponent st = result.addStructure();
+		st.setUrl(lexer.readConstant("url"));
+		if (lexer.hasToken("alias")) {
+	    lexer.token("alias");
+		  st.setAlias(lexer.take());
+		}
+		lexer.token("as");
+		st.setMode(StructureMapModelMode.fromCode(lexer.take()));
+		lexer.skipToken(";");
+		if (lexer.hasComment()) {
+			st.setDocumentation(lexer.take().substring(2).trim());
+		}
+		lexer.skipComments();
+	}
+
+	private void parseImports(StructureMap result, FHIRLexer lexer) throws FHIRException {
+		lexer.token("imports");
+		result.addImport(lexer.readConstant("url"));
+		lexer.skipToken(";");
+		if (lexer.hasComment()) {
+			lexer.next();
+		}
+		lexer.skipComments();
+	}
+
+	private void parseGroup(StructureMap result, FHIRLexer lexer) throws FHIRException {
+		lexer.token("group");
+		StructureMapGroupComponent group = result.addGroup();
+		if (lexer.hasToken("for")) {
+		  lexer.token("for");
+		  if ("type".equals(lexer.getCurrent())) {
+        lexer.token("type");
+        lexer.token("+");
+        lexer.token("types");
+        group.setTypeMode(StructureMapGroupTypeMode.TYPEANDTYPES);
+		  } else {
+		    lexer.token("types");
+        group.setTypeMode(StructureMapGroupTypeMode.TYPES);
+		  }
+		} else
+		  group.setTypeMode(StructureMapGroupTypeMode.NONE);
+		group.setName(lexer.take());
+		if (lexer.hasToken("extends")) {
+			lexer.next();
+			group.setExtends(lexer.take());
+		}
+		lexer.skipComments();
+		while (lexer.hasToken("input")) 
+			parseInput(group, lexer);
+		while (!lexer.hasToken("endgroup")) {
+			if (lexer.done())
+				throw lexer.error("premature termination expecting 'endgroup'");
+			parseRule(result, group.getRule(), lexer);
+		}
+		lexer.next();
+		lexer.skipComments();
+	}
+
+	private void parseInput(StructureMapGroupComponent group, FHIRLexer lexer) throws FHIRException {
+		lexer.token("input");
+		StructureMapGroupInputComponent input = group.addInput();
+		input.setName(lexer.take());
+		if (lexer.hasToken(":")) {
+			lexer.token(":");
+			input.setType(lexer.take());
+		}
+		lexer.token("as");
+		input.setMode(StructureMapInputMode.fromCode(lexer.take()));
+		if (lexer.hasComment()) {
+			input.setDocumentation(lexer.take().substring(2).trim());
+		}
+		lexer.skipToken(";");
+		lexer.skipComments();
+	}
+
+	private void parseRule(StructureMap map, List list, FHIRLexer lexer) throws FHIRException {
+		StructureMapGroupRuleComponent rule = new StructureMapGroupRuleComponent(); 
+		list.add(rule);
+		rule.setName(lexer.takeDottedToken());
+		lexer.token(":");
+		lexer.token("for");
+		boolean done = false;
+		while (!done) {
+			parseSource(rule, lexer);
+			done = !lexer.hasToken(",");
+			if (!done)
+				lexer.next();
+		}
+		if (lexer.hasToken("make")) {
+			lexer.token("make");
+			done = false;
+			while (!done) {
+				parseTarget(rule, lexer);
+				done = !lexer.hasToken(",");
+				if (!done)
+					lexer.next();
+			}
+		}
+		if (lexer.hasToken("then")) {
+			lexer.token("then");
+			if (lexer.hasToken("{")) {
+				lexer.token("{");
+				if (lexer.hasComment()) {
+					rule.setDocumentation(lexer.take().substring(2).trim());
+				}
+				lexer.skipComments();
+				while (!lexer.hasToken("}")) {
+					if (lexer.done())
+						throw lexer.error("premature termination expecting '}' in nested group");
+					parseRule(map, rule.getRule(), lexer);
+				}      
+				lexer.token("}");
+			} else {
+				done = false;
+				while (!done) {
+					parseRuleReference(rule, lexer);
+					done = !lexer.hasToken(",");
+					if (!done)
+						lexer.next();
+				}
+			}
+		} else if (lexer.hasComment()) {
+			rule.setDocumentation(lexer.take().substring(2).trim());
+		}
+		if (isSimpleSyntax(rule)) {
+		  rule.getSourceFirstRep().setVariable(AUTO_VAR_NAME);
+		  rule.getTargetFirstRep().setVariable(AUTO_VAR_NAME);
+		  rule.getTargetFirstRep().setTransform(StructureMapTransform.CREATE); // with no parameter - e.g. imply what is to be created
+		  // no dependencies - imply what is to be done based on types
+		}
+		lexer.skipComments();
+	}
+
+	private boolean isSimpleSyntax(StructureMapGroupRuleComponent rule) {
+    return 
+        (rule.getSource().size() == 1 && rule.getSourceFirstRep().hasContext() && rule.getSourceFirstRep().hasElement() && !rule.getSourceFirstRep().hasVariable()) &&
+        (rule.getTarget().size() == 1 && rule.getTargetFirstRep().hasContext() && rule.getTargetFirstRep().hasElement() && !rule.getTargetFirstRep().hasVariable() && !rule.getTargetFirstRep().hasParameter()) &&
+        (rule.getDependent().size() == 0 && rule.getRule().size() == 0);
+  }
+
+  private void parseRuleReference(StructureMapGroupRuleComponent rule, FHIRLexer lexer) throws FHIRLexerException {
+		StructureMapGroupRuleDependentComponent ref = rule.addDependent();
+		ref.setName(lexer.take());
+		lexer.token("(");
+		boolean done = false;
+		while (!done) {
+			ref.addVariable(lexer.take());
+			done = !lexer.hasToken(",");
+			if (!done)
+				lexer.next();
+		}
+		lexer.token(")");
+	}
+
+	private void parseSource(StructureMapGroupRuleComponent rule, FHIRLexer lexer) throws FHIRException {
+		StructureMapGroupRuleSourceComponent source = rule.addSource();
+		source.setContext(lexer.take());
+		if (source.getContext().equals("search") && lexer.hasToken("(")) {
+	    source.setContext("@search");
+      lexer.take();
+      ExpressionNode node = fpe.parse(lexer);
+      source.setUserData(MAP_SEARCH_EXPRESSION, node);
+      source.setElement(node.toString());
+      lexer.token(")");
+		} else if (lexer.hasToken(".")) {
+			lexer.token(".");
+			source.setElement(lexer.take());
+		}
+		if (lexer.hasToken(":")) {
+		  // type and cardinality
+		  lexer.token(":");
+		  source.setType(lexer.takeDottedToken());
+		  if (!lexer.hasToken("as", "first", "last", "not_first", "not_last", "only_one", "default")) {
+		    source.setMin(lexer.takeInt());
+		    lexer.token("..");
+		    source.setMax(lexer.take());
+		  }
+		}
+		if (lexer.hasToken("default")) {
+		  lexer.token("default");
+		  source.setDefaultValue(new StringType(lexer.readConstant("default value")));
+		}
+		if (Utilities.existsInList(lexer.getCurrent(), "first", "last", "not_first", "not_last", "only_one"))
+			source.setListMode(StructureMapSourceListMode.fromCode(lexer.take()));
+
+		if (lexer.hasToken("as")) {
+			lexer.take();
+			source.setVariable(lexer.take());
+		}
+		if (lexer.hasToken("where")) {
+			lexer.take();
+			ExpressionNode node = fpe.parse(lexer);
+			source.setUserData(MAP_WHERE_EXPRESSION, node);
+			source.setCondition(node.toString());
+		}
+		if (lexer.hasToken("check")) {
+			lexer.take();
+			ExpressionNode node = fpe.parse(lexer);
+			source.setUserData(MAP_WHERE_CHECK, node);
+			source.setCheck(node.toString());
+		}
+	}
+
+	private void parseTarget(StructureMapGroupRuleComponent rule, FHIRLexer lexer) throws FHIRException {
+		StructureMapGroupRuleTargetComponent target = rule.addTarget();
+		String start = lexer.take();
+		if (lexer.hasToken(".")) {
+	    target.setContext(start);
+	    target.setContextType(StructureMapContextType.VARIABLE);
+	    start = null;
+			lexer.token(".");
+			target.setElement(lexer.take());
+		}
+		String name;
+		boolean isConstant = false;
+		if (lexer.hasToken("=")) {
+		  if (start != null)
+	      target.setContext(start);
+			lexer.token("=");
+			isConstant = lexer.isConstant(true);
+			name = lexer.take();
+		} else 
+		  name = start;
+		
+		if ("(".equals(name)) {
+		  // inline fluentpath expression
+      target.setTransform(StructureMapTransform.EVALUATE);
+      ExpressionNode node = fpe.parse(lexer);
+      target.setUserData(MAP_EXPRESSION, node);
+      target.addParameter().setValue(new StringType(node.toString()));
+      lexer.token(")");
+		} else if (lexer.hasToken("(")) {
+				target.setTransform(StructureMapTransform.fromCode(name));
+				lexer.token("(");
+				if (target.getTransform() == StructureMapTransform.EVALUATE) {
+					parseParameter(target, lexer);
+					lexer.token(",");
+					ExpressionNode node = fpe.parse(lexer);
+					target.setUserData(MAP_EXPRESSION, node);
+					target.addParameter().setValue(new StringType(node.toString()));
+				} else { 
+					while (!lexer.hasToken(")")) {
+						parseParameter(target, lexer);
+						if (!lexer.hasToken(")"))
+							lexer.token(",");
+					}       
+				}
+				lexer.token(")");
+		} else if (name != null) {
+				target.setTransform(StructureMapTransform.COPY);
+				if (!isConstant) {
+					String id = name;
+					while (lexer.hasToken(".")) {
+						id = id + lexer.take() + lexer.take();
+					}
+					target.addParameter().setValue(new IdType(id));
+				}
+				else 
+					target.addParameter().setValue(readConstant(name, lexer));
+			}
+		if (lexer.hasToken("as")) {
+			lexer.take();
+			target.setVariable(lexer.take());
+		}
+		while (Utilities.existsInList(lexer.getCurrent(), "first", "last", "share", "collate")) {
+			if (lexer.getCurrent().equals("share")) {
+				target.addListMode(StructureMapTargetListMode.SHARE);
+				lexer.next();
+				target.setListRuleId(lexer.take());
+			} else if (lexer.getCurrent().equals("first")) 
+				target.addListMode(StructureMapTargetListMode.FIRST);
+			else
+				target.addListMode(StructureMapTargetListMode.LAST);
+			lexer.next();
+		}
+	}
+
+
+	private void parseParameter(StructureMapGroupRuleTargetComponent target, FHIRLexer lexer) throws FHIRLexerException {
+		if (!lexer.isConstant(true)) {
+			target.addParameter().setValue(new IdType(lexer.take()));
+		} else if (lexer.isStringConstant())
+			target.addParameter().setValue(new StringType(lexer.readConstant("??")));
+		else {
+			target.addParameter().setValue(readConstant(lexer.take(), lexer));
+		}
+	}
+
+	private Type readConstant(String s, FHIRLexer lexer) throws FHIRLexerException {
+		if (Utilities.isInteger(s))
+			return new IntegerType(s);
+		else if (Utilities.isDecimal(s))
+			return new DecimalType(s);
+		else if (Utilities.existsInList(s, "true", "false"))
+			return new BooleanType(s.equals("true"));
+		else 
+			return new StringType(lexer.processConstant(s));        
+	}
+
+	public StructureDefinition getTargetType(StructureMap map) throws FHIRException {
+	  boolean found = false;
+	  StructureDefinition res = null;
+	  for (StructureMapStructureComponent uses : map.getStructure()) {
+	    if (uses.getMode() == StructureMapModelMode.TARGET) {
+	      if (found)
+	        throw new FHIRException("Multiple targets found in map "+map.getUrl());
+	      found = true;
+	      res = worker.fetchResource(StructureDefinition.class, uses.getUrl());
+	      if (res == null)
+	        throw new FHIRException("Unable to find "+uses.getUrl()+" referenced from map "+map.getUrl());      
+	    }
+	  }
+	  if (res == null)
+      throw new FHIRException("No targets found in map "+map.getUrl());
+	  return res;
+	}
+
+	public enum VariableMode {
+		INPUT, OUTPUT
+	}
+
+	public class Variable {
+		private VariableMode mode;
+		private String name;
+		private Base object;
+		public Variable(VariableMode mode, String name, Base object) {
+			super();
+			this.mode = mode;
+			this.name = name;
+			this.object = object;
+		}
+		public VariableMode getMode() {
+			return mode;
+		}
+		public String getName() {
+			return name;
+		}
+		public Base getObject() {
+			return object;
+		}
+    public String summary() {
+      return name+": "+object.fhirType();
+    }
+	}
+
+	public class Variables {
+		private List list = new ArrayList();
+
+		public void add(VariableMode mode, String name, Base object) {
+			Variable vv = null;
+			for (Variable v : list) 
+				if ((v.mode == mode) && v.getName().equals(name))
+					vv = v;
+			if (vv != null)
+				list.remove(vv);
+			list.add(new Variable(mode, name, object));
+		}
+
+		public Variables copy() {
+			Variables result = new Variables();
+			result.list.addAll(list);
+			return result;
+		}
+
+		public Base get(VariableMode mode, String name) {
+			for (Variable v : list) 
+				if ((v.mode == mode) && v.getName().equals(name))
+					return v.getObject();
+			return null;
+		}
+
+    public String summary() {
+      CommaSeparatedStringBuilder s = new CommaSeparatedStringBuilder();
+      CommaSeparatedStringBuilder t = new CommaSeparatedStringBuilder();
+      for (Variable v : list)
+        if (v.mode == VariableMode.INPUT)
+          s.append(v.summary());
+        else
+          t.append(v.summary());
+      return "source variables ["+s.toString()+"], target variables ["+t.toString()+"]";
+    }
+	}
+
+	public class TransformContext {
+		private Object appInfo;
+
+		public TransformContext(Object appInfo) {
+			super();
+			this.appInfo = appInfo;
+		}
+
+		public Object getAppInfo() {
+			return appInfo;
+		}
+
+	}
+
+	private void log(String cnt) {
+	  if (services != null)
+	    services.log(cnt);
+	}
+
+	/**
+	 * Given an item, return all the children that conform to the pattern described in name
+	 * 
+	 * Possible patterns:
+	 *  - a simple name (which may be the base of a name with [] e.g. value[x])
+	 *  - a name with a type replacement e.g. valueCodeableConcept
+	 *  - * which means all children
+	 *  - ** which means all descendents
+	 *  
+	 * @param item
+	 * @param name
+	 * @param result
+	 * @throws FHIRException 
+	 */
+	protected void getChildrenByName(Base item, String name, List result) throws FHIRException {
+		for (Base v : item.listChildrenByName(name, true))
+			if (v != null)
+				result.add(v);
+	}
+
+	public void transform(Object appInfo, Base source, StructureMap map, Base target) throws FHIRException {
+		TransformContext context = new TransformContext(appInfo);
+    log("Start Transform "+map.getUrl());
+    StructureMapGroupComponent g = map.getGroup().get(0);
+
+		Variables vars = new Variables();
+		vars.add(VariableMode.INPUT, getInputName(g, StructureMapInputMode.SOURCE, "source"), source);
+		vars.add(VariableMode.OUTPUT, getInputName(g, StructureMapInputMode.TARGET, "target"), target);
+
+    executeGroup("", context, map, vars, g);
+    if (target instanceof Element)
+      ((Element) target).sort();
+	}
+
+	private String getInputName(StructureMapGroupComponent g, StructureMapInputMode mode, String def) throws DefinitionException {
+	  String name = null;
+    for (StructureMapGroupInputComponent inp : g.getInput()) {
+      if (inp.getMode() == mode)
+        if (name != null)
+          throw new DefinitionException("This engine does not support multiple source inputs");
+        else
+          name = inp.getName();
+    }
+    return name == null ? def : name;
+	}
+
+	private void executeGroup(String indent, TransformContext context, StructureMap map, Variables vars, StructureMapGroupComponent group) throws FHIRException {
+		log(indent+"Group : "+group.getName());
+    // todo: check inputs
+		if (group.hasExtends()) {
+		  ResolvedGroup rg = resolveGroupReference(map, group, group.getExtends());
+		  executeGroup(indent+" ", context, rg.targetMap, vars, rg.target); 
+		}
+		  
+		for (StructureMapGroupRuleComponent r : group.getRule()) {
+			executeRule(indent+"  ", context, map, vars, group, r);
+		}
+	}
+
+	private void executeRule(String indent, TransformContext context, StructureMap map, Variables vars, StructureMapGroupComponent group, StructureMapGroupRuleComponent rule) throws FHIRException {
+		log(indent+"rule : "+rule.getName());
+		if (rule.getName().contains("CarePlan.participant-unlink"))
+		  System.out.println("debug");
+		Variables srcVars = vars.copy();
+		if (rule.getSource().size() != 1)
+			throw new FHIRException("Rule \""+rule.getName()+"\": not handled yet");
+		List source = processSource(rule.getName(), context, srcVars, rule.getSource().get(0));
+		if (source != null) {
+			for (Variables v : source) {
+				for (StructureMapGroupRuleTargetComponent t : rule.getTarget()) {
+					processTarget(rule.getName(), context, v, map, group, t, rule.getSource().size() == 1 ? rule.getSourceFirstRep().getVariable() : null);
+				}
+				if (rule.hasRule()) {
+					for (StructureMapGroupRuleComponent childrule : rule.getRule()) {
+						executeRule(indent +"  ", context, map, v, group, childrule);
+					}
+				} else if (rule.hasDependent()) {
+					for (StructureMapGroupRuleDependentComponent dependent : rule.getDependent()) {
+						executeDependency(indent+"  ", context, map, v, group, dependent);
+					}
+				} else if (rule.getSource().size() == 1 && rule.getSourceFirstRep().hasVariable() && rule.getTarget().size() == 1 && rule.getTargetFirstRep().hasVariable() && rule.getTargetFirstRep().getTransform() == StructureMapTransform.CREATE && !rule.getTargetFirstRep().hasParameter()) {
+				  // simple inferred, map by type
+				  Base src = v.get(VariableMode.INPUT, rule.getSourceFirstRep().getVariable());
+				  Base tgt = v.get(VariableMode.OUTPUT, rule.getTargetFirstRep().getVariable());
+				  String srcType = src.fhirType();
+				  String tgtType = tgt.fhirType();
+				  ResolvedGroup defGroup = resolveGroupByTypes(map, rule.getName(), group, srcType, tgtType);
+			    Variables vdef = new Variables();
+          vdef.add(VariableMode.INPUT, defGroup.target.getInput().get(0).getName(), src);
+          vdef.add(VariableMode.OUTPUT, defGroup.target.getInput().get(1).getName(), tgt);
+				  executeGroup(indent+"  ", context, defGroup.targetMap, vdef, defGroup.target);
+				}
+			}
+		}
+	}
+
+	private void executeDependency(String indent, TransformContext context, StructureMap map, Variables vin, StructureMapGroupComponent group, StructureMapGroupRuleDependentComponent dependent) throws FHIRException {
+	  ResolvedGroup rg = resolveGroupReference(map, group, dependent.getName());
+
+		if (rg.target.getInput().size() != dependent.getVariable().size()) {
+			throw new FHIRException("Rule '"+dependent.getName()+"' has "+Integer.toString(rg.target.getInput().size())+" but the invocation has "+Integer.toString(dependent.getVariable().size())+" variables");
+		}
+		Variables v = new Variables();
+		for (int i = 0; i < rg.target.getInput().size(); i++) {
+			StructureMapGroupInputComponent input = rg.target.getInput().get(i);
+			StringType rdp = dependent.getVariable().get(i);
+      String var = rdp.asStringValue();
+			VariableMode mode = input.getMode() == StructureMapInputMode.SOURCE ? VariableMode.INPUT :   VariableMode.OUTPUT; 
+			Base vv = vin.get(mode, var);
+      if (vv == null && mode == VariableMode.INPUT) //* once source, always source. but target can be treated as source at user convenient
+        vv = vin.get(VariableMode.OUTPUT, var);
+			if (vv == null)
+				throw new FHIRException("Rule '"+dependent.getName()+"' "+mode.toString()+" variable '"+input.getName()+"' named as '"+var+"' has no value");
+			v.add(mode, input.getName(), vv);    	
+		}
+		executeGroup(indent+"  ", context, rg.targetMap, v, rg.target);
+	}
+
+  private String determineTypeFromSourceType(StructureMap map, StructureMapGroupComponent source, Base base, String[] types) throws FHIRException {
+    String type = base.fhirType();
+    String kn = "type^"+type;
+    if (source.hasUserData(kn))
+      return source.getUserString(kn);
+    
+    ResolvedGroup res = new ResolvedGroup();
+    res.targetMap = null;
+    res.target = null;
+    for (StructureMapGroupComponent grp : map.getGroup()) {
+      if (matchesByType(map, grp, type)) {
+        if (res.targetMap == null) {
+          res.targetMap = map;
+          res.target = grp;
+        } else 
+          throw new FHIRException("Multiple possible matches looking for default rule for '"+type+"'");
+      }
+    }
+    if (res.targetMap != null) {
+      String result = getActualType(res.targetMap, res.target.getInput().get(1).getType());
+      source.setUserData(kn, result);
+      return result;
+    }
+
+    for (UriType imp : map.getImport()) {
+      List impMapList = findMatchingMaps(imp.getValue());
+      if (impMapList.size() == 0)
+        throw new FHIRException("Unable to find map(s) for "+imp.getValue());
+      for (StructureMap impMap : impMapList) {
+        if (!impMap.getUrl().equals(map.getUrl())) {
+          for (StructureMapGroupComponent grp : impMap.getGroup()) {
+            if (matchesByType(impMap, grp, type)) {
+              if (res.targetMap == null) {
+                res.targetMap = impMap;
+                res.target = grp;
+              } else 
+                throw new FHIRException("Multiple possible matches for default rule for '"+type+"' in "+res.targetMap.getUrl()+" ("+res.target.getName()+") and "+impMap.getUrl()+" ("+grp.getName()+")");
+            }
+          }
+        }
+      }
+    }
+    if (res.target == null)
+      throw new FHIRException("No matches found for default rule for '"+type+"' from "+map.getUrl());
+    String result = getActualType(res.targetMap, res.target.getInput().get(1).getType()); // should be .getType, but R2...
+    source.setUserData(kn, result);
+    return result;
+  }
+
+  private List findMatchingMaps(String value) {
+    List res = new ArrayList();
+    if (value.contains("*")) {
+      for (StructureMap sm : library.values()) {
+        if (urlMatches(value, sm.getUrl())) {
+          res.add(sm); 
+        }
+      }
+    } else {
+      StructureMap sm = library.get(value);
+      if (sm != null)
+        res.add(sm); 
+    }
+    Set check = new HashSet();
+    for (StructureMap sm : res) {
+      if (check.contains(sm.getUrl()))
+        throw new Error("duplicate");
+      else
+        check.add(sm.getUrl());
+    }
+    return res;
+  }
+
+  private boolean urlMatches(String mask, String url) {
+    return url.length() > mask.length() && url.startsWith(mask.substring(0, mask.indexOf("*"))) && url.endsWith(mask.substring(mask.indexOf("*")+1)) ;
+  }
+
+  private ResolvedGroup resolveGroupByTypes(StructureMap map, String ruleid, StructureMapGroupComponent source, String srcType, String tgtType) throws FHIRException {
+    String kn = "types^"+srcType+":"+tgtType;
+    if (source.hasUserData(kn))
+      return (ResolvedGroup) source.getUserData(kn);
+    
+    ResolvedGroup res = new ResolvedGroup();
+    res.targetMap = null;
+    res.target = null;
+    for (StructureMapGroupComponent grp : map.getGroup()) {
+      if (matchesByType(map, grp, srcType, tgtType)) {
+        if (res.targetMap == null) {
+          res.targetMap = map;
+          res.target = grp;
+        } else 
+          throw new FHIRException("Multiple possible matches looking for rule for '"+srcType+"/"+tgtType+"', from rule '"+ruleid+"'");
+      }
+    }
+    if (res.targetMap != null) {
+      source.setUserData(kn, res);
+      return res;
+    }
+
+    for (UriType imp : map.getImport()) {
+      List impMapList = findMatchingMaps(imp.getValue());
+      if (impMapList.size() == 0)
+        throw new FHIRException("Unable to find map(s) for "+imp.getValue());
+      for (StructureMap impMap : impMapList) {
+        if (!impMap.getUrl().equals(map.getUrl())) {
+          for (StructureMapGroupComponent grp : impMap.getGroup()) {
+            if (matchesByType(impMap, grp, srcType, tgtType)) {
+              if (res.targetMap == null) {
+                res.targetMap = impMap;
+                res.target = grp;
+              } else 
+                throw new FHIRException("Multiple possible matches for rule for '"+srcType+"/"+tgtType+"' in "+res.targetMap.getUrl()+" and "+impMap.getUrl()+", from rule '"+ruleid+"'");
+            }
+          }
+        }
+      }
+    }
+    if (res.target == null)
+      throw new FHIRException("No matches found for rule for '"+srcType+"/"+tgtType+"' from "+map.getUrl()+", from rule '"+ruleid+"'");
+    source.setUserData(kn, res);
+    return res;
+  }
+
+
+  private boolean matchesByType(StructureMap map, StructureMapGroupComponent grp, String type) throws FHIRException {
+    if (grp.getTypeMode() != StructureMapGroupTypeMode.TYPEANDTYPES)
+      return false;
+    if (grp.getInput().size() != 2 || grp.getInput().get(0).getMode() != StructureMapInputMode.SOURCE || grp.getInput().get(1).getMode() != StructureMapInputMode.TARGET)
+      return false;
+    return matchesType(map, type, grp.getInput().get(0).getType());
+  }
+
+  private boolean matchesByType(StructureMap map, StructureMapGroupComponent grp, String srcType, String tgtType) throws FHIRException {
+    if (grp.getTypeMode() == StructureMapGroupTypeMode.NONE)
+      return false;
+    if (grp.getInput().size() != 2 || grp.getInput().get(0).getMode() != StructureMapInputMode.SOURCE || grp.getInput().get(1).getMode() != StructureMapInputMode.TARGET)
+      return false;
+    if (!grp.getInput().get(0).hasType() || !grp.getInput().get(1).hasType())
+      return false;
+    return matchesType(map, srcType, grp.getInput().get(0).getType()) && matchesType(map, tgtType, grp.getInput().get(1).getType());
+  }
+
+  private boolean matchesType(StructureMap map, String actualType, String statedType) throws FHIRException {
+    // check the aliases
+    for (StructureMapStructureComponent imp : map.getStructure()) {
+      if (imp.hasAlias() && statedType.equals(imp.getAlias())) {
+        StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl());
+        if (sd != null)
+          statedType = sd.getType();
+        break;
+      }
+    }
+    
+    return actualType.equals(statedType);
+  }
+
+  private String getActualType(StructureMap map, String statedType) throws FHIRException {
+    // check the aliases
+    for (StructureMapStructureComponent imp : map.getStructure()) {
+      if (imp.hasAlias() && statedType.equals(imp.getAlias())) {
+        StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl());
+        if (sd == null)
+          throw new FHIRException("Unable to resolve structure "+imp.getUrl());
+        return sd.getId(); // should be sd.getType(), but R2...
+      }
+    }
+    return statedType;
+  }
+
+
+  private ResolvedGroup resolveGroupReference(StructureMap map, StructureMapGroupComponent source, String name) throws FHIRException {
+    String kn = "ref^"+name;
+    if (source.hasUserData(kn))
+      return (ResolvedGroup) source.getUserData(kn);
+    
+	  ResolvedGroup res = new ResolvedGroup();
+    res.targetMap = null;
+    res.target = null;
+    for (StructureMapGroupComponent grp : map.getGroup()) {
+      if (grp.getName().equals(name)) {
+        if (res.targetMap == null) {
+          res.targetMap = map;
+          res.target = grp;
+        } else 
+          throw new FHIRException("Multiple possible matches for rule '"+name+"'");
+      }
+    }
+    if (res.targetMap != null) {
+      source.setUserData(kn, res);
+      return res;
+    }
+
+    for (UriType imp : map.getImport()) {
+      List impMapList = findMatchingMaps(imp.getValue());
+      if (impMapList.size() == 0)
+        throw new FHIRException("Unable to find map(s) for "+imp.getValue());
+      for (StructureMap impMap : impMapList) {
+        if (!impMap.getUrl().equals(map.getUrl())) {
+          for (StructureMapGroupComponent grp : impMap.getGroup()) {
+            if (grp.getName().equals(name)) {
+              if (res.targetMap == null) {
+                res.targetMap = impMap;
+                res.target = grp;
+              } else 
+                throw new FHIRException("Multiple possible matches for rule '"+name+"' in "+res.targetMap.getUrl()+" and "+impMap.getUrl());
+            }
+          }
+        }
+      }
+    }
+    if (res.target == null)
+      throw new FHIRException("No matches found for rule '"+name+"'. Reference found in "+map.getUrl());
+    source.setUserData(kn, res);
+    return res;
+  }
+
+  private List processSource(String ruleId, TransformContext context, Variables vars, StructureMapGroupRuleSourceComponent src) throws FHIRException {
+    List items;
+    if (src.getContext().equals("@search")) {
+      ExpressionNode expr = (ExpressionNode) src.getUserData(MAP_SEARCH_EXPRESSION);
+      if (expr == null) {
+        expr = fpe.parse(src.getElement());
+        src.setUserData(MAP_SEARCH_EXPRESSION, expr);
+      }
+      String search = fpe.evaluateToString(vars, null, new StringType(), expr); // string is a holder of nothing to ensure that variables are processed correctly 
+      items = services.performSearch(context.appInfo, search);
+    } else {
+      items = new ArrayList();
+      Base b = vars.get(VariableMode.INPUT, src.getContext());
+      if (b == null)
+        throw new FHIRException("Unknown input variable "+src.getContext());
+
+      if (!src.hasElement()) 
+        items.add(b);
+      else { 
+        getChildrenByName(b, src.getElement(), items);
+        if (items.size() == 0 && src.hasDefaultValue())
+          items.add(src.getDefaultValue());
+      }
+    }
+    
+		if (src.hasType()) {
+	    List remove = new ArrayList();
+	    for (Base item : items) {
+	      if (item != null && !isType(item, src.getType())) {
+	        remove.add(item);
+	      }
+	    }
+	    items.removeAll(remove);
+		}
+
+    if (src.hasCondition()) {
+      ExpressionNode expr = (ExpressionNode) src.getUserData(MAP_WHERE_EXPRESSION);
+      if (expr == null) {
+        expr = fpe.parse(src.getCondition());
+        //        fpe.check(context.appInfo, ??, ??, expr)
+        src.setUserData(MAP_WHERE_EXPRESSION, expr);
+      }
+      List remove = new ArrayList();
+      for (Base item : items) {
+        if (!fpe.evaluateToBoolean(vars, null, item, expr))
+          remove.add(item);
+      }
+      items.removeAll(remove);
+    }
+
+    if (src.hasCheck()) {
+      ExpressionNode expr = (ExpressionNode) src.getUserData(MAP_WHERE_CHECK);
+      if (expr == null) {
+        expr = fpe.parse(src.getCheck());
+        //        fpe.check(context.appInfo, ??, ??, expr)
+        src.setUserData(MAP_WHERE_CHECK, expr);
+      }
+      List remove = new ArrayList();
+      for (Base item : items) {
+        if (!fpe.evaluateToBoolean(vars, null, item, expr))
+          throw new FHIRException("Rule \""+ruleId+"\": Check condition failed");
+      }
+    } 
+
+		
+		if (src.hasListMode() && !items.isEmpty()) {
+		  switch (src.getListMode()) {
+		  case FIRST:
+		    Base bt = items.get(0);
+        items.clear();
+        items.add(bt);
+		    break;
+		  case NOTFIRST: 
+        if (items.size() > 0)
+          items.remove(0);
+        break;
+		  case LAST:
+        bt = items.get(items.size()-1);
+        items.clear();
+        items.add(bt);
+        break;
+		  case NOTLAST: 
+        if (items.size() > 0)
+          items.remove(items.size()-1);
+        break;
+		  case ONLYONE:
+		    if (items.size() > 1)
+          throw new FHIRException("Rule \""+ruleId+"\": Check condition failed: the collection has more than one item");
+        break;
+      case NULL:
+		  }
+		}
+		List result = new ArrayList();
+		for (Base r : items) {
+			Variables v = vars.copy();
+			if (src.hasVariable())
+				v.add(VariableMode.INPUT, src.getVariable(), r);
+			result.add(v); 
+		}
+		return result;
+	}
+
+
+	private boolean isType(Base item, String type) {
+    if (type.equals(item.fhirType()))
+      return true;
+    return false;
+  }
+
+  private void processTarget(String ruleId, TransformContext context, Variables vars, StructureMap map, StructureMapGroupComponent group, StructureMapGroupRuleTargetComponent tgt, String srcVar) throws FHIRException {
+	  Base dest = null;
+	  if (tgt.hasContext()) {
+  		dest = vars.get(VariableMode.OUTPUT, tgt.getContext());
+		if (dest == null)
+			throw new FHIRException("Rule \""+ruleId+"\": target context not known: "+tgt.getContext());
+		if (!tgt.hasElement())
+			throw new FHIRException("Rule \""+ruleId+"\": Not supported yet");
+	  }
+		Base v = null;
+		if (tgt.hasTransform()) {
+			v = runTransform(ruleId, context, map, group, tgt, vars, dest, tgt.getElement(), srcVar);
+			if (v != null && dest != null)
+				v = dest.setProperty(tgt.getElement().hashCode(), tgt.getElement(), v); // reset v because some implementations may have to rewrite v when setting the value
+		} else if (dest != null) 
+			v = dest.makeProperty(tgt.getElement().hashCode(), tgt.getElement());
+		if (tgt.hasVariable() && v != null)
+			vars.add(VariableMode.OUTPUT, tgt.getVariable(), v);
+	}
+
+	private Base runTransform(String ruleId, TransformContext context, StructureMap map, StructureMapGroupComponent group, StructureMapGroupRuleTargetComponent tgt, Variables vars, Base dest, String element, String srcVar) throws FHIRException {
+	  try {
+	    switch (tgt.getTransform()) {
+	    case CREATE :
+	      String tn;
+	      if (tgt.getParameter().isEmpty()) {
+	        // we have to work out the type. First, we see if there is a single type for the target. If there is, we use that
+	        String[] types = dest.getTypesForProperty(element.hashCode(), element);
+	        if (types.length == 1 && !"*".equals(types[0]) && !types[0].equals("Resource"))
+	          tn = types[0];
+	        else if (srcVar != null) {
+	          tn = determineTypeFromSourceType(map, group, vars.get(VariableMode.INPUT, srcVar), types);
+	        } else
+	          throw new Error("Cannot determine type implicitly because there is no single input variable");
+	      } else
+	        tn = getParamStringNoNull(vars, tgt.getParameter().get(0), tgt.toString());
+	      Base res = services != null ? services.createType(context.getAppInfo(), tn) : ResourceFactory.createResourceOrType(tn);
+	      if (res.isResource() && !res.fhirType().equals("Parameters")) {
+//	        res.setIdBase(tgt.getParameter().size() > 1 ? getParamString(vars, tgt.getParameter().get(0)) : UUID.randomUUID().toString().toLowerCase());
+	        if (services != null) 
+	          res = services.createResource(context.getAppInfo(), res);
+	      }
+	      if (tgt.hasUserData("profile"))
+	        res.setUserData("profile", tgt.getUserData("profile"));
+	      return res;
+	    case COPY : 
+	      return getParam(vars, tgt.getParameter().get(0));
+	    case EVALUATE :
+	      ExpressionNode expr = (ExpressionNode) tgt.getUserData(MAP_EXPRESSION);
+	      if (expr == null) {
+	        expr = fpe.parse(getParamStringNoNull(vars, tgt.getParameter().get(1), tgt.toString()));
+	        tgt.setUserData(MAP_WHERE_EXPRESSION, expr);
+	      }
+	      List v = fpe.evaluate(vars, null, tgt.getParameter().size() == 2 ? getParam(vars, tgt.getParameter().get(0)) : new BooleanType(false), expr);
+	      if (v.size() == 0)
+	        return null;
+	      else if (v.size() != 1)
+	        throw new FHIRException("Rule \""+ruleId+"\": Evaluation of "+expr.toString()+" returned "+Integer.toString(v.size())+" objects");
+	      else
+	        return v.get(0);
+
+	    case TRUNCATE : 
+	      String src = getParamString(vars, tgt.getParameter().get(0));
+	      String len = getParamStringNoNull(vars, tgt.getParameter().get(1), tgt.toString());
+	      if (Utilities.isInteger(len)) {
+	        int l = Integer.parseInt(len);
+	        if (src.length() > l)
+	          src = src.substring(0, l);
+	      }
+	      return new StringType(src);
+	    case ESCAPE : 
+	      throw new Error("Rule \""+ruleId+"\": Transform "+tgt.getTransform().toCode()+" not supported yet");
+	    case CAST :
+	      throw new Error("Rule \""+ruleId+"\": Transform "+tgt.getTransform().toCode()+" not supported yet");
+	    case APPEND : 
+	      throw new Error("Rule \""+ruleId+"\": Transform "+tgt.getTransform().toCode()+" not supported yet");
+	    case TRANSLATE : 
+	      return translate(context, map, vars, tgt.getParameter());
+	    case REFERENCE :
+	      Base b = getParam(vars, tgt.getParameter().get(0));
+	      if (b == null)
+	        throw new FHIRException("Rule \""+ruleId+"\": Unable to find parameter "+((IdType) tgt.getParameter().get(0).getValue()).asStringValue());
+	      if (!b.isResource())
+	        throw new FHIRException("Rule \""+ruleId+"\": Transform engine cannot point at an element of type "+b.fhirType());
+	      else {
+	        String id = b.getIdBase();
+	        if (id == null) {
+	          id = UUID.randomUUID().toString().toLowerCase();
+	          b.setIdBase(id);
+	        }
+	        return new Reference().setReference(b.fhirType()+"/"+id);
+	      }
+	    case DATEOP :
+	      throw new Error("Rule \""+ruleId+"\": Transform "+tgt.getTransform().toCode()+" not supported yet");
+	    case UUID :
+	      return new IdType(UUID.randomUUID().toString());
+	    case POINTER :
+	      b = getParam(vars, tgt.getParameter().get(0));
+	      if (b instanceof Resource)
+	        return new UriType("urn:uuid:"+((Resource) b).getId());
+	      else
+	        throw new FHIRException("Rule \""+ruleId+"\": Transform engine cannot point at an element of type "+b.fhirType());
+	    case CC:
+	      CodeableConcept cc = new CodeableConcept();
+	      cc.addCoding(buildCoding(getParamStringNoNull(vars, tgt.getParameter().get(0), tgt.toString()), getParamStringNoNull(vars, tgt.getParameter().get(1), tgt.toString())));
+	      return cc;
+	    case C: 
+	      Coding c = buildCoding(getParamStringNoNull(vars, tgt.getParameter().get(0), tgt.toString()), getParamStringNoNull(vars, tgt.getParameter().get(1), tgt.toString()));
+	      return c;
+	    default:
+	      throw new Error("Rule \""+ruleId+"\": Transform Unknown: "+tgt.getTransform().toCode());
+	    }
+	  } catch (Exception e) {
+	    throw new FHIRException("Exception executing transform "+tgt.toString()+" on Rule \""+ruleId+"\": "+e.getMessage(), e);
+	  }
+	}
+
+
+  private Coding buildCoding(String uri, String code) throws FHIRException {
+	  // if we can get this as a valueSet, we will
+	  String system = null;
+	  String display = null;
+	  ValueSet vs = Utilities.noString(uri) ? null : worker.fetchResourceWithException(ValueSet.class, uri);
+	  if (vs != null) {
+	    ValueSetExpansionOutcome vse = worker.expandVS(vs, true, false);
+	    if (vse.getError() != null)
+	      throw new FHIRException(vse.getError());
+	    CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
+	    for (ValueSetExpansionContainsComponent t : vse.getValueset().getExpansion().getContains()) {
+	      if (t.hasCode())
+	        b.append(t.getCode());
+	      if (code.equals(t.getCode()) && t.hasSystem()) {
+	        system = t.getSystem();
+          display = t.getDisplay();
+	        break;
+	      }
+        if (code.equalsIgnoreCase(t.getDisplay()) && t.hasSystem()) {
+          system = t.getSystem();
+          display = t.getDisplay();
+          break;
+        }
+	    }
+	    if (system == null)
+	      throw new FHIRException("The code '"+code+"' is not in the value set '"+uri+"' (valid codes: "+b.toString()+"; also checked displays)");
+	  } else
+	    system = uri;
+	  ValidationResult vr = worker.validateCode(system, code, null);
+	  if (vr != null && vr.getDisplay() != null)
+	    display = vr.getDisplay();
+   return new Coding().setSystem(system).setCode(code).setDisplay(display);
+  }
+
+
+  private String getParamStringNoNull(Variables vars, StructureMapGroupRuleTargetParameterComponent parameter, String message) throws FHIRException {
+    Base b = getParam(vars, parameter);
+    if (b == null)
+      throw new FHIRException("Unable to find a value for "+parameter.toString()+". Context: "+message);
+    if (!b.hasPrimitiveValue())
+      throw new FHIRException("Found a value for "+parameter.toString()+", but it has a type of "+b.fhirType()+" and cannot be treated as a string. Context: "+message);
+    return b.primitiveValue();
+  }
+
+  private String getParamString(Variables vars, StructureMapGroupRuleTargetParameterComponent parameter) throws DefinitionException {
+		Base b = getParam(vars, parameter);
+		if (b == null || !b.hasPrimitiveValue())
+			return null;
+		return b.primitiveValue();
+	}
+
+
+	private Base getParam(Variables vars, StructureMapGroupRuleTargetParameterComponent parameter) throws DefinitionException {
+		Type p = parameter.getValue();
+		if (!(p instanceof IdType))
+			return p;
+		else { 
+			String n = ((IdType) p).asStringValue();
+      Base b = vars.get(VariableMode.INPUT, n);
+			if (b == null)
+				b = vars.get(VariableMode.OUTPUT, n);
+			if (b == null)
+        throw new DefinitionException("Variable "+n+" not found ("+vars.summary()+")");
+			return b;
+		}
+	}
+
+
+	private Base translate(TransformContext context, StructureMap map, Variables vars, List parameter) throws FHIRException {
+		Base src = getParam(vars, parameter.get(0));
+		String id = getParamString(vars, parameter.get(1));
+		String fld = parameter.size() > 2 ? getParamString(vars, parameter.get(2)) : null;
+		return translate(context, map, src, id, fld);
+	}
+
+	private class SourceElementComponentWrapper {
+	  private ConceptMapGroupComponent group;
+    private SourceElementComponent comp;
+    public SourceElementComponentWrapper(ConceptMapGroupComponent group, SourceElementComponent comp) {
+      super();
+      this.group = group;
+      this.comp = comp;
+    }
+	}
+	public Base translate(TransformContext context, StructureMap map, Base source, String conceptMapUrl, String fieldToReturn) throws FHIRException {
+		Coding src = new Coding();
+		if (source.isPrimitive()) {
+			src.setCode(source.primitiveValue());
+		} else if ("Coding".equals(source.fhirType())) {
+			Base[] b = source.getProperty("system".hashCode(), "system", true);
+			if (b.length == 1)
+				src.setSystem(b[0].primitiveValue());
+			b = source.getProperty("code".hashCode(), "code", true);
+			if (b.length == 1)
+				src.setCode(b[0].primitiveValue());
+		} else if ("CE".equals(source.fhirType())) {
+			Base[] b = source.getProperty("codeSystem".hashCode(), "codeSystem", true);
+			if (b.length == 1)
+				src.setSystem(b[0].primitiveValue());
+			b = source.getProperty("code".hashCode(), "code", true);
+			if (b.length == 1)
+				src.setCode(b[0].primitiveValue());
+		} else
+			throw new FHIRException("Unable to translate source "+source.fhirType());
+
+		String su = conceptMapUrl;
+		if (conceptMapUrl.equals("http://hl7.org/fhir/ConceptMap/special-oid2uri")) {
+			String uri = worker.oid2Uri(src.getCode());
+			if (uri == null)
+				uri = "urn:oid:"+src.getCode();
+			if ("uri".equals(fieldToReturn))
+				return new UriType(uri);
+			else
+				throw new FHIRException("Error in return code");
+		} else {
+			ConceptMap cmap = null;
+			if (conceptMapUrl.startsWith("#")) {
+				for (Resource r : map.getContained()) {
+					if (r instanceof ConceptMap && ((ConceptMap) r).getId().equals(conceptMapUrl.substring(1))) {
+						cmap = (ConceptMap) r;
+						su = map.getUrl()+conceptMapUrl;
+					}
+				}
+				if (cmap == null)
+		      throw new FHIRException("Unable to translate - cannot find map "+conceptMapUrl);
+			} else
+				cmap = worker.fetchResource(ConceptMap.class, conceptMapUrl);
+			Coding outcome = null;
+			boolean done = false;
+			String message = null;
+			if (cmap == null) {
+				if (services == null) 
+					message = "No map found for "+conceptMapUrl;
+				else {
+					outcome = services.translate(context.appInfo, src, conceptMapUrl);
+					done = true;
+				}
+			} else {
+			  List list = new ArrayList();
+			  for (ConceptMapGroupComponent g : cmap.getGroup()) {
+			    for (SourceElementComponent e : g.getElement()) {
+						if (!src.hasSystem() && src.getCode().equals(e.getCode())) 
+			        list.add(new SourceElementComponentWrapper(g, e));
+			      else if (src.hasSystem() && src.getSystem().equals(g.getSource()) && src.getCode().equals(e.getCode()))
+			        list.add(new SourceElementComponentWrapper(g, e));
+			    }
+				}
+				if (list.size() == 0)
+					done = true;
+				else if (list.get(0).comp.getTarget().size() == 0)
+					message = "Concept map "+su+" found no translation for "+src.getCode();
+				else {
+					for (TargetElementComponent tgt : list.get(0).comp.getTarget()) {
+						if (tgt.getEquivalence() == null || EnumSet.of( ConceptMapEquivalence.EQUAL , ConceptMapEquivalence.RELATEDTO , ConceptMapEquivalence.EQUIVALENT, ConceptMapEquivalence.WIDER).contains(tgt.getEquivalence())) {
+							if (done) {
+								message = "Concept map "+su+" found multiple matches for "+src.getCode();
+								done = false;
+							} else {
+								done = true;
+								outcome = new Coding().setCode(tgt.getCode()).setSystem(list.get(0).group.getTarget());
+							}
+						} else if (tgt.getEquivalence() == ConceptMapEquivalence.UNMATCHED) {
+							done = true;
+						}
+					}
+					if (!done)
+						message = "Concept map "+su+" found no usable translation for "+src.getCode();
+				}
+			}
+			if (!done) 
+				throw new FHIRException(message);
+			if (outcome == null)
+				return null;
+			if ("code".equals(fieldToReturn))
+				return new CodeType(outcome.getCode());
+			else
+				return outcome; 
+		}
+	}
+
+
+	public Map getLibrary() {
+	  return library;
+	}
+
+	public class PropertyWithType {
+    private String path;
+    private Property baseProperty;
+    private Property profileProperty;
+	  private TypeDetails types;
+    public PropertyWithType(String path, Property baseProperty, Property profileProperty, TypeDetails types) {
+      super();
+      this.baseProperty = baseProperty;
+      this.profileProperty = profileProperty;
+      this.path = path;
+      this.types = types;
+    }
+
+    public TypeDetails getTypes() {
+      return types;
+    }
+    public String getPath() {
+      return path;
+    }
+
+    public Property getBaseProperty() {
+      return baseProperty;
+    }
+
+    public void setBaseProperty(Property baseProperty) {
+      this.baseProperty = baseProperty;
+    }
+
+    public Property getProfileProperty() {
+      return profileProperty;
+    }
+
+    public void setProfileProperty(Property profileProperty) {
+      this.profileProperty = profileProperty;
+    }
+
+    public String summary() {
+      return path;
+    }
+    
+	}
+	
+	public class VariableForProfiling {
+	    private VariableMode mode;
+	    private String name;
+	    private PropertyWithType property;
+	    
+	    public VariableForProfiling(VariableMode mode, String name, PropertyWithType property) {
+	      super();
+	      this.mode = mode;
+	      this.name = name;
+	      this.property = property;
+	    }
+	    public VariableMode getMode() {
+	      return mode;
+	    }
+	    public String getName() {
+	      return name;
+	    }
+      public PropertyWithType getProperty() {
+        return property;
+      }
+      public String summary() {
+        return name+": "+property.summary();
+      }      
+	  }
+
+  public class VariablesForProfiling {
+    private List list = new ArrayList();
+    private boolean optional;
+    private boolean repeating;
+
+    public VariablesForProfiling(boolean optional, boolean repeating) {
+      this.optional = optional;
+      this.repeating = repeating;
+    }
+
+    public void add(VariableMode mode, String name, String path, Property property, TypeDetails types) {
+      add(mode, name, new PropertyWithType(path, property, null, types));
+    }
+    
+    public void add(VariableMode mode, String name, String path, Property baseProperty, Property profileProperty, TypeDetails types) {
+      add(mode, name, new PropertyWithType(path, baseProperty, profileProperty, types));
+    }
+    
+    public void add(VariableMode mode, String name, PropertyWithType property) {
+      VariableForProfiling vv = null;
+      for (VariableForProfiling v : list) 
+        if ((v.mode == mode) && v.getName().equals(name))
+          vv = v;
+      if (vv != null)
+        list.remove(vv);
+      list.add(new VariableForProfiling(mode, name, property));
+    }
+
+    public VariablesForProfiling copy(boolean optional, boolean repeating) {
+      VariablesForProfiling result = new VariablesForProfiling(optional, repeating);
+      result.list.addAll(list);
+      return result;
+    }
+
+    public VariablesForProfiling copy() {
+      VariablesForProfiling result = new VariablesForProfiling(optional, repeating);
+      result.list.addAll(list);
+      return result;
+    }
+
+    public VariableForProfiling get(VariableMode mode, String name) {
+      if (mode == null) {
+        for (VariableForProfiling v : list) 
+          if ((v.mode == VariableMode.OUTPUT) && v.getName().equals(name))
+            return v;
+        for (VariableForProfiling v : list) 
+          if ((v.mode == VariableMode.INPUT) && v.getName().equals(name))
+            return v;
+      }
+      for (VariableForProfiling v : list) 
+        if ((v.mode == mode) && v.getName().equals(name))
+          return v;
+      return null;
+    }
+
+    public String summary() {
+      CommaSeparatedStringBuilder s = new CommaSeparatedStringBuilder();
+      CommaSeparatedStringBuilder t = new CommaSeparatedStringBuilder();
+      for (VariableForProfiling v : list)
+        if (v.mode == VariableMode.INPUT)
+          s.append(v.summary());
+        else
+          t.append(v.summary());
+      return "source variables ["+s.toString()+"], target variables ["+t.toString()+"]";
+    }
+  }
+
+  public class StructureMapAnalysis {
+    private List profiles = new ArrayList();
+    private XhtmlNode summary;
+    public List getProfiles() {
+      return profiles;
+    }
+    public XhtmlNode getSummary() {
+      return summary;
+    }
+    
+  }
+
+	/**
+	 * Given a structure map, return a set of analyses on it. 
+	 * 
+	 * Returned:
+	 *   - a list or profiles for what it will create. First profile is the target
+	 *   - a table with a summary (in xhtml) for easy human undertanding of the mapping
+	 *   
+	 * 
+	 * @param appInfo
+	 * @param map
+	 * @return
+	 * @throws Exception
+	 */
+  public StructureMapAnalysis analyse(Object appInfo, StructureMap map) throws Exception {
+    ids.clear();
+    StructureMapAnalysis result = new StructureMapAnalysis(); 
+    TransformContext context = new TransformContext(appInfo);
+    VariablesForProfiling vars = new VariablesForProfiling(false, false);
+    StructureMapGroupComponent start = map.getGroup().get(0);
+    for (StructureMapGroupInputComponent t : start.getInput()) {
+      PropertyWithType ti = resolveType(map, t.getType(), t.getMode());
+      if (t.getMode() == StructureMapInputMode.SOURCE)
+       vars.add(VariableMode.INPUT, t.getName(), ti);
+      else 
+        vars.add(VariableMode.OUTPUT, t.getName(), createProfile(map, result.profiles, ti, start.getName(), start));
+    }
+
+    result.summary = new XhtmlNode(NodeType.Element, "table").setAttribute("class", "grid");
+    XhtmlNode tr = result.summary.addTag("tr");
+    tr.addTag("td").addTag("b").addText("Source");
+    tr.addTag("td").addTag("b").addText("Target");
+    
+    log("Start Profiling Transform "+map.getUrl());
+    analyseGroup("", context, map, vars, start, result);
+    ProfileUtilities pu = new ProfileUtilities(worker, null, pkp);
+    for (StructureDefinition sd : result.getProfiles())
+      pu.cleanUpDifferential(sd);
+    return result;
+  }
+
+
+  private void analyseGroup(String indent, TransformContext context, StructureMap map, VariablesForProfiling vars, StructureMapGroupComponent group, StructureMapAnalysis result) throws Exception {
+    log(indent+"Analyse Group : "+group.getName());
+    // todo: extends
+    // todo: check inputs
+    XhtmlNode tr = result.summary.addTag("tr").setAttribute("class", "diff-title");
+    XhtmlNode xs = tr.addTag("td");
+    XhtmlNode xt = tr.addTag("td");
+    for (StructureMapGroupInputComponent inp : group.getInput()) {
+      if (inp.getMode() == StructureMapInputMode.SOURCE) 
+        noteInput(vars, inp, VariableMode.INPUT, xs);
+      if (inp.getMode() == StructureMapInputMode.TARGET) 
+        noteInput(vars, inp, VariableMode.OUTPUT, xt);
+    }
+    for (StructureMapGroupRuleComponent r : group.getRule()) {
+      analyseRule(indent+"  ", context, map, vars, group, r, result);
+    }    
+  }
+
+
+  private void noteInput(VariablesForProfiling vars, StructureMapGroupInputComponent inp, VariableMode mode, XhtmlNode xs) {
+    VariableForProfiling v = vars.get(mode, inp.getName());
+    if (v != null)
+      xs.addText("Input: "+v.property.getPath());
+  }
+
+  private void analyseRule(String indent, TransformContext context, StructureMap map, VariablesForProfiling vars, StructureMapGroupComponent group, StructureMapGroupRuleComponent rule, StructureMapAnalysis result) throws Exception {
+    log(indent+"Analyse rule : "+rule.getName());
+    XhtmlNode tr = result.summary.addTag("tr");
+    XhtmlNode xs = tr.addTag("td");
+    XhtmlNode xt = tr.addTag("td");
+
+    VariablesForProfiling srcVars = vars.copy();
+    if (rule.getSource().size() != 1)
+      throw new Exception("Rule \""+rule.getName()+"\": not handled yet");
+    VariablesForProfiling source = analyseSource(rule.getName(), context, srcVars, rule.getSourceFirstRep(), xs);
+
+    TargetWriter tw = new TargetWriter();
+      for (StructureMapGroupRuleTargetComponent t : rule.getTarget()) {
+      analyseTarget(rule.getName(), context, source, map, t, rule.getSourceFirstRep().getVariable(), tw, result.profiles, rule.getName());
+      }
+    tw.commit(xt);
+
+          for (StructureMapGroupRuleComponent childrule : rule.getRule()) {
+      analyseRule(indent+"  ", context, map, source, group, childrule, result);
+          }
+//    for (StructureMapGroupRuleDependentComponent dependent : rule.getDependent()) {
+//      executeDependency(indent+"  ", context, map, v, group, dependent); // do we need group here?
+//    }
+          }
+
+  public class StringPair {
+    private String var;
+    private String desc;
+    public StringPair(String var, String desc) {
+      super();
+      this.var = var;
+      this.desc = desc;
+        }
+    public String getVar() {
+      return var;
+      }
+    public String getDesc() {
+      return desc;
+    }
+  }
+  public class TargetWriter {
+    private Map newResources = new HashMap();
+    private List assignments = new ArrayList();
+    private List keyProps = new ArrayList();
+    private CommaSeparatedStringBuilder txt = new CommaSeparatedStringBuilder();
+
+    public void newResource(String var, String name) {
+      newResources.put(var, name);
+      txt.append("new "+name);
+    }
+
+    public void valueAssignment(String context, String desc) {
+      assignments.add(new StringPair(context, desc));      
+      txt.append(desc);
+        }
+
+    public void keyAssignment(String context, String desc) {
+      keyProps.add(new StringPair(context, desc));      
+      txt.append(desc);
+    }
+    public void commit(XhtmlNode xt) {
+      if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 1 && newResources.containsKey(keyProps.get(0).getVar()) ) {
+        xt.addText("new "+assignments.get(0).desc+" ("+keyProps.get(0).desc.substring(keyProps.get(0).desc.indexOf(".")+1)+")");
+      } else if (newResources.size() == 1 && assignments.size() == 1 && newResources.containsKey(assignments.get(0).getVar()) && keyProps.size() == 0) {
+        xt.addText("new "+assignments.get(0).desc);
+      } else {
+        xt.addText(txt.toString());        
+    }
+    }
+  }
+
+  private VariablesForProfiling analyseSource(String ruleId, TransformContext context, VariablesForProfiling vars, StructureMapGroupRuleSourceComponent src, XhtmlNode td) throws Exception {
+    VariableForProfiling var = vars.get(VariableMode.INPUT, src.getContext());
+    if (var == null)
+      throw new FHIRException("Rule \""+ruleId+"\": Unknown input variable "+src.getContext());
+    PropertyWithType prop = var.getProperty();
+
+    boolean optional = false;
+    boolean repeating = false;
+
+    if (src.hasCondition()) {
+      optional = true;
+    }
+
+    if (src.hasElement()) {
+      Property element = prop.getBaseProperty().getChild(prop.types.getType(), src.getElement());
+      if (element == null)
+        throw new Exception("Rule \""+ruleId+"\": Unknown element name "+src.getElement());
+      if (element.getDefinition().getMin() == 0)
+        optional = true;
+      if (element.getDefinition().getMax().equals("*"))
+        repeating = true;
+      VariablesForProfiling result = vars.copy(optional, repeating);
+      TypeDetails type = new TypeDetails(CollectionStatus.SINGLETON);
+      for (TypeRefComponent tr : element.getDefinition().getType()) {
+        if (!tr.hasCode())
+          throw new Error("Rule \""+ruleId+"\": Element has no type");
+        ProfiledType pt = new ProfiledType(tr.getCode());
+        if (tr.hasProfile())
+          pt.addProfile(tr.getProfile());
+        if (element.getDefinition().hasBinding())
+          pt.addBinding(element.getDefinition().getBinding());
+        type.addType(pt);
+    } 
+      td.addText(prop.getPath()+"."+src.getElement()); 
+      if (src.hasVariable())
+        result.add(VariableMode.INPUT, src.getVariable(), new PropertyWithType(prop.getPath()+"."+src.getElement(), element, null, type));
+    return result;
+    } else {
+      td.addText(prop.getPath()); // ditto!
+      return vars.copy(optional, repeating);
+    }
+  }
+
+
+  private void analyseTarget(String ruleId, TransformContext context, VariablesForProfiling vars, StructureMap map, StructureMapGroupRuleTargetComponent tgt, String tv, TargetWriter tw, List profiles, String sliceName) throws Exception {
+    VariableForProfiling var = null;
+    if (tgt.hasContext()) {
+      var = vars.get(VariableMode.OUTPUT, tgt.getContext());
+      if (var == null)
+        throw new Exception("Rule \""+ruleId+"\": target context not known: "+tgt.getContext());
+      if (!tgt.hasElement())
+        throw new Exception("Rule \""+ruleId+"\": Not supported yet");
+    }
+
+    
+    TypeDetails type = null;
+    if (tgt.hasTransform()) {
+      type = analyseTransform(context, map, tgt, var, vars);
+        // profiling: dest.setProperty(tgt.getElement().hashCode(), tgt.getElement(), v);
+    } else {
+      Property vp = var.property.baseProperty.getChild(tgt.getElement(),  tgt.getElement());
+      if (vp == null)
+        throw new Exception("Unknown Property "+tgt.getElement()+" on "+var.property.path);
+      
+      type = new TypeDetails(CollectionStatus.SINGLETON, vp.getType(tgt.getElement()));
+    }
+
+    if (tgt.getTransform() == StructureMapTransform.CREATE) {
+      String s = getParamString(vars, tgt.getParameter().get(0));
+      if (worker.getResourceNames().contains(s))
+        tw.newResource(tgt.getVariable(), s);
+    } else { 
+      boolean mapsSrc = false;
+      for (StructureMapGroupRuleTargetParameterComponent p : tgt.getParameter()) {
+        Type pr = p.getValue();
+        if (pr instanceof IdType && ((IdType) pr).asStringValue().equals(tv)) 
+          mapsSrc = true;
+      }
+      if (mapsSrc) { 
+        if (var == null)
+          throw new Error("Rule \""+ruleId+"\": Attempt to assign with no context");
+        tw.valueAssignment(tgt.getContext(), var.property.getPath()+"."+tgt.getElement()+getTransformSuffix(tgt.getTransform()));
+      } else if (tgt.hasContext()) {
+        if (isSignificantElement(var.property, tgt.getElement())) {
+          String td = describeTransform(tgt);
+          if (td != null)
+            tw.keyAssignment(tgt.getContext(), var.property.getPath()+"."+tgt.getElement()+" = "+td);
+        }
+      }
+    }
+    Type fixed = generateFixedValue(tgt);
+    
+    PropertyWithType prop = updateProfile(var, tgt.getElement(), type, map, profiles, sliceName, fixed, tgt);
+    if (tgt.hasVariable())
+      if (tgt.hasElement())
+        vars.add(VariableMode.OUTPUT, tgt.getVariable(), prop); 
+      else
+        vars.add(VariableMode.OUTPUT, tgt.getVariable(), prop); 
+  }
+  
+  private Type generateFixedValue(StructureMapGroupRuleTargetComponent tgt) {
+    if (!allParametersFixed(tgt))
+      return null;
+    if (!tgt.hasTransform())
+      return null;
+    switch (tgt.getTransform()) {
+    case COPY: return tgt.getParameter().get(0).getValue(); 
+    case TRUNCATE: return null; 
+    //case ESCAPE: 
+    //case CAST: 
+    //case APPEND: 
+    case TRANSLATE: return null; 
+  //case DATEOP, 
+  //case UUID, 
+  //case POINTER, 
+  //case EVALUATE, 
+    case CC: 
+      CodeableConcept cc = new CodeableConcept();
+      cc.addCoding(buildCoding(tgt.getParameter().get(0).getValue(), tgt.getParameter().get(1).getValue()));
+      return cc;
+    case C: 
+      return buildCoding(tgt.getParameter().get(0).getValue(), tgt.getParameter().get(1).getValue());
+    case QTY: return null; 
+  //case ID, 
+  //case CP, 
+    default:
+      return null;
+    }
+  }
+
+  @SuppressWarnings("rawtypes")
+  private Coding buildCoding(Type value1, Type value2) {
+    return new Coding().setSystem(((PrimitiveType) value1).asStringValue()).setCode(((PrimitiveType) value2).asStringValue()) ;
+  }
+
+  private boolean allParametersFixed(StructureMapGroupRuleTargetComponent tgt) {
+    for (StructureMapGroupRuleTargetParameterComponent p : tgt.getParameter()) {
+      Type pr = p.getValue();
+      if (pr instanceof IdType)
+        return false;
+    }
+    return true;
+  }
+
+  private String describeTransform(StructureMapGroupRuleTargetComponent tgt) throws FHIRException {
+    switch (tgt.getTransform()) {
+    case COPY: return null; 
+    case TRUNCATE: return null; 
+    //case ESCAPE: 
+    //case CAST: 
+    //case APPEND: 
+    case TRANSLATE: return null; 
+  //case DATEOP, 
+  //case UUID, 
+  //case POINTER, 
+  //case EVALUATE, 
+    case CC: return describeTransformCCorC(tgt); 
+    case C: return describeTransformCCorC(tgt); 
+    case QTY: return null; 
+  //case ID, 
+  //case CP, 
+    default:
+      return null;
+    }
+  }
+
+  @SuppressWarnings("rawtypes")
+  private String describeTransformCCorC(StructureMapGroupRuleTargetComponent tgt) throws FHIRException {
+    if (tgt.getParameter().size() < 2)
+      return null;
+    Type p1 = tgt.getParameter().get(0).getValue();
+    Type p2 = tgt.getParameter().get(1).getValue();
+    if (p1 instanceof IdType || p2 instanceof IdType)
+      return null;
+    if (!(p1 instanceof PrimitiveType) || !(p2 instanceof PrimitiveType))
+      return null;
+    String uri = ((PrimitiveType) p1).asStringValue();
+    String code = ((PrimitiveType) p2).asStringValue();
+    if (Utilities.noString(uri))
+      throw new FHIRException("Describe Transform, but the uri is blank");
+    if (Utilities.noString(code))
+      throw new FHIRException("Describe Transform, but the code is blank");
+    Coding c = buildCoding(uri, code);
+    return NarrativeGenerator.describeSystem(c.getSystem())+"#"+c.getCode()+(c.hasDisplay() ? "("+c.getDisplay()+")" : "");
+  }
+
+
+  private boolean isSignificantElement(PropertyWithType property, String element) {
+    if ("Observation".equals(property.getPath()))
+      return "code".equals(element);
+    else if ("Bundle".equals(property.getPath()))
+      return "type".equals(element);
+    else
+      return false;
+  }
+
+  private String getTransformSuffix(StructureMapTransform transform) {
+    switch (transform) {
+    case COPY: return ""; 
+    case TRUNCATE: return " (truncated)"; 
+    //case ESCAPE: 
+    //case CAST: 
+    //case APPEND: 
+    case TRANSLATE: return " (translated)"; 
+  //case DATEOP, 
+  //case UUID, 
+  //case POINTER, 
+  //case EVALUATE, 
+    case CC: return " (--> CodeableConcept)"; 
+    case C: return " (--> Coding)"; 
+    case QTY: return " (--> Quantity)"; 
+  //case ID, 
+  //case CP, 
+    default:
+      return " {??)";
+    }
+  }
+
+  private PropertyWithType updateProfile(VariableForProfiling var, String element, TypeDetails type, StructureMap map, List profiles, String sliceName, Type fixed, StructureMapGroupRuleTargetComponent tgt) throws FHIRException {
+    if (var == null) {
+      assert (Utilities.noString(element));
+      // 1. start the new structure definition
+      StructureDefinition sdn = worker.fetchResource(StructureDefinition.class, type.getType());
+      if (sdn == null)
+        throw new FHIRException("Unable to find definition for "+type.getType());
+      ElementDefinition edn = sdn.getSnapshot().getElementFirstRep();
+      PropertyWithType pn = createProfile(map, profiles, new PropertyWithType(sdn.getId(), new Property(worker, edn, sdn), null, type), sliceName, tgt);
+
+//      // 2. hook it into the base bundle
+//      if (type.getType().startsWith("http://hl7.org/fhir/StructureDefinition/") && worker.getResourceNames().contains(type.getType().substring(40))) {
+//        StructureDefinition sd = var.getProperty().profileProperty.getStructure();
+//        ElementDefinition ed = sd.getDifferential().addElement();
+//        ed.setPath("Bundle.entry");
+//        ed.setName(sliceName);
+//        ed.setMax("1"); // well, it is for now...
+//        ed = sd.getDifferential().addElement();
+//        ed.setPath("Bundle.entry.fullUrl");
+//        ed.setMin(1);
+//        ed = sd.getDifferential().addElement();
+//        ed.setPath("Bundle.entry.resource");
+//        ed.setMin(1);
+//        ed.addType().setCode(pn.getProfileProperty().getStructure().getType()).setProfile(pn.getProfileProperty().getStructure().getUrl());
+//      }
+      return pn; 
+    } else {
+      assert (!Utilities.noString(element));
+      Property pvb = var.getProperty().getBaseProperty();
+      Property pvd = var.getProperty().getProfileProperty();
+      Property pc = pvb.getChild(element, var.property.types);
+      if (pc == null)
+        throw new DefinitionException("Unable to find a definition for "+pvb.getDefinition().getPath()+"."+element);
+      
+      // the profile structure definition (derived)
+      StructureDefinition sd = var.getProperty().profileProperty.getStructure();
+      ElementDefinition ednew = sd.getDifferential().addElement();
+      ednew.setPath(var.getProperty().profileProperty.getDefinition().getPath()+"."+pc.getName());
+      ednew.setUserData("slice-name", sliceName);
+      ednew.setFixed(fixed);
+      for (ProfiledType pt : type.getProfiledTypes()) {
+        if (pt.hasBindings())
+          ednew.setBinding(pt.getBindings().get(0));
+        if (pt.getUri().startsWith("http://hl7.org/fhir/StructureDefinition/")) {
+          String t = pt.getUri().substring(40);
+          t = checkType(t, pc, pt.getProfiles());
+          if (t != null) {
+            if (pt.hasProfiles()) {
+              for (String p : pt.getProfiles())
+                if (t.equals("Reference"))
+                  ednew.addType().setCode(t).setTargetProfile(p);
+                else
+                  ednew.addType().setCode(t).setProfile(p);
+            } else 
+            ednew.addType().setCode(t);
+      }
+        }
+      }
+      
+      return new PropertyWithType(var.property.path+"."+element, pc, new Property(worker, ednew, sd), type);
+    }
+  }
+  
+
+
+  private String checkType(String t, Property pvb, List profiles) throws FHIRException {
+    if (pvb.getDefinition().getType().size() == 1 && isCompatibleType(t, pvb.getDefinition().getType().get(0).getCode()) && profilesMatch(profiles, pvb.getDefinition().getType().get(0).getProfile())) 
+      return null;
+    for (TypeRefComponent tr : pvb.getDefinition().getType()) {
+      if (isCompatibleType(t, tr.getCode()))
+        return tr.getCode(); // note what is returned - the base type, not the inferred mapping type
+    }
+    throw new FHIRException("The type "+t+" is not compatible with the allowed types for "+pvb.getDefinition().getPath());
+  }
+
+  private boolean profilesMatch(List profiles, String profile) {
+    return profiles == null || profiles.size() == 0 || (profiles.size() == 1 && profiles.get(0).equals(profile));
+  }
+
+  private boolean isCompatibleType(String t, String code) {
+    if (t.equals(code))
+      return true;
+    if (t.equals("string")) {
+      StructureDefinition sd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code);
+      if (sd != null && sd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/string"))
+        return true;
+    }
+    return false;
+  }
+
+  private TypeDetails analyseTransform(TransformContext context, StructureMap map, StructureMapGroupRuleTargetComponent tgt, VariableForProfiling var, VariablesForProfiling vars) throws FHIRException {
+    switch (tgt.getTransform()) {
+    case CREATE :
+      String p = getParamString(vars, tgt.getParameter().get(0));
+      return new TypeDetails(CollectionStatus.SINGLETON, p);
+    case COPY : 
+      return getParam(vars, tgt.getParameter().get(0));
+    case EVALUATE :
+      ExpressionNode expr = (ExpressionNode) tgt.getUserData(MAP_EXPRESSION);
+      if (expr == null) {
+        expr = fpe.parse(getParamString(vars, tgt.getParameter().get(tgt.getParameter().size()-1)));
+        tgt.setUserData(MAP_WHERE_EXPRESSION, expr);
+      }
+      return fpe.check(vars, null, expr);
+
+////case TRUNCATE : 
+////  String src = getParamString(vars, tgt.getParameter().get(0));
+////  String len = getParamString(vars, tgt.getParameter().get(1));
+////  if (Utilities.isInteger(len)) {
+////    int l = Integer.parseInt(len);
+////    if (src.length() > l)
+////      src = src.substring(0, l);
+////  }
+////  return new StringType(src);
+////case ESCAPE : 
+////  throw new Error("Transform "+tgt.getTransform().toCode()+" not supported yet");
+////case CAST :
+////  throw new Error("Transform "+tgt.getTransform().toCode()+" not supported yet");
+////case APPEND : 
+////  throw new Error("Transform "+tgt.getTransform().toCode()+" not supported yet");
+    case TRANSLATE : 
+      return new TypeDetails(CollectionStatus.SINGLETON, "CodeableConcept");
+   case CC:
+     ProfiledType res = new ProfiledType("CodeableConcept");
+     if (tgt.getParameter().size() >= 2  && isParamId(vars, tgt.getParameter().get(1))) {
+       TypeDetails td = vars.get(null, getParamId(vars, tgt.getParameter().get(1))).property.types;
+       if (td != null && td.hasBinding())
+         // todo: do we need to check that there's no implicit translation her? I don't think we do...
+         res.addBinding(td.getBinding());
+     }
+     return new TypeDetails(CollectionStatus.SINGLETON, res);
+   case C:
+     return new TypeDetails(CollectionStatus.SINGLETON, "Coding");
+   case QTY:
+     return new TypeDetails(CollectionStatus.SINGLETON, "Quantity");
+   case REFERENCE :
+      VariableForProfiling vrs = vars.get(VariableMode.OUTPUT, getParamId(vars, tgt.getParameterFirstRep()));
+      if (vrs == null)
+        throw new FHIRException("Unable to resolve variable \""+getParamId(vars, tgt.getParameterFirstRep())+"\"");
+      String profile = vrs.property.getProfileProperty().getStructure().getUrl();
+     TypeDetails td = new TypeDetails(CollectionStatus.SINGLETON);
+     td.addType("Reference", profile);
+     return td;  
+////case DATEOP :
+////  throw new Error("Transform "+tgt.getTransform().toCode()+" not supported yet");
+////case UUID :
+////  return new IdType(UUID.randomUUID().toString());
+////case POINTER :
+////  Base b = getParam(vars, tgt.getParameter().get(0));
+////  if (b instanceof Resource)
+////    return new UriType("urn:uuid:"+((Resource) b).getId());
+////  else
+////    throw new FHIRException("Transform engine cannot point at an element of type "+b.fhirType());
+    default:
+      throw new Error("Transform Unknown or not handled yet: "+tgt.getTransform().toCode());
+    }
+  }
+  private String getParamString(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) {
+    Type p = parameter.getValue();
+    if (p == null || p instanceof IdType)
+      return null;
+    if (!p.hasPrimitiveValue())
+      return null;
+    return p.primitiveValue();
+  }
+
+  private String getParamId(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) {
+    Type p = parameter.getValue();
+    if (p == null || !(p instanceof IdType))
+      return null;
+    return p.primitiveValue();
+  }
+
+  private boolean isParamId(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) {
+    Type p = parameter.getValue();
+    if (p == null || !(p instanceof IdType))
+      return false;
+    return vars.get(null, p.primitiveValue()) != null;
+  }
+
+  private TypeDetails getParam(VariablesForProfiling vars, StructureMapGroupRuleTargetParameterComponent parameter) throws DefinitionException {
+    Type p = parameter.getValue();
+    if (!(p instanceof IdType))
+      return new TypeDetails(CollectionStatus.SINGLETON, "http://hl7.org/fhir/StructureDefinition/"+p.fhirType());
+    else { 
+      String n = ((IdType) p).asStringValue();
+      VariableForProfiling b = vars.get(VariableMode.INPUT, n);
+      if (b == null)
+        b = vars.get(VariableMode.OUTPUT, n);
+      if (b == null)
+        throw new DefinitionException("Variable "+n+" not found ("+vars.summary()+")");
+      return b.getProperty().getTypes();
+    }
+  }
+
+  private PropertyWithType createProfile(StructureMap map, List profiles, PropertyWithType prop, String sliceName, Base ctxt) throws DefinitionException {
+    if (prop.getBaseProperty().getDefinition().getPath().contains(".")) 
+      throw new DefinitionException("Unable to process entry point");
+
+    String type = prop.getBaseProperty().getDefinition().getPath();
+    String suffix = "";
+    if (ids.containsKey(type)) {
+      int id = ids.get(type);
+      id++;
+      ids.put(type, id);
+      suffix = "-"+Integer.toString(id);
+    } else
+      ids.put(type, 0);
+    
+    StructureDefinition profile = new StructureDefinition();
+    profiles.add(profile);
+    profile.setDerivation(TypeDerivationRule.CONSTRAINT);
+    profile.setType(type);
+    profile.setBaseDefinition(prop.getBaseProperty().getStructure().getUrl());
+    profile.setName("Profile for "+profile.getType()+" for "+sliceName);
+    profile.setUrl(map.getUrl().replace("StructureMap", "StructureDefinition")+"-"+profile.getType()+suffix);
+    ctxt.setUserData("profile", profile.getUrl()); // then we can easily assign this profile url for validation later when we actually transform
+    profile.setId(map.getId()+"-"+profile.getType()+suffix);
+    profile.setStatus(map.getStatus());
+    profile.setExperimental(map.getExperimental());
+    profile.setDescription("Generated automatically from the mapping by the Java Reference Implementation");
+    for (ContactDetail c : map.getContact()) {
+      ContactDetail p = profile.addContact();
+      p.setName(c.getName());
+      for (ContactPoint cc : c.getTelecom()) 
+        p.addTelecom(cc);
+    }
+    profile.setDate(map.getDate());
+    profile.setCopyright(map.getCopyright());
+    profile.setFhirVersion(Constants.VERSION);
+    profile.setKind(prop.getBaseProperty().getStructure().getKind());
+    profile.setAbstract(false);
+    ElementDefinition ed = profile.getDifferential().addElement();
+    ed.setPath(profile.getType());
+    prop.profileProperty = new Property(worker, ed, profile);
+    return prop;
+  }
+
+  private PropertyWithType resolveType(StructureMap map, String type, StructureMapInputMode mode) throws Exception {
+    for (StructureMapStructureComponent imp : map.getStructure()) {
+      if ((imp.getMode() == StructureMapModelMode.SOURCE && mode == StructureMapInputMode.SOURCE) || 
+          (imp.getMode() == StructureMapModelMode.TARGET && mode == StructureMapInputMode.TARGET)) {
+        StructureDefinition sd = worker.fetchResource(StructureDefinition.class, imp.getUrl());
+        if (sd == null)
+          throw new Exception("Import "+imp.getUrl()+" cannot be resolved");
+        if (sd.getId().equals(type)) {
+          return new PropertyWithType(sd.getType(), new Property(worker, sd.getSnapshot().getElement().get(0), sd), null, new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl()));
+        }
+      }
+    }
+    throw new Exception("Unable to find structure definition for "+type+" in imports");
+  }
+
+
+  public StructureMap generateMapFromMappings(StructureDefinition sd) throws IOException, FHIRException {
+    String id = getLogicalMappingId(sd);
+    if (id == null) 
+        return null;
+    String prefix = ToolingExtensions.readStringExtension(sd,  ToolingExtensions.EXT_MAPPING_PREFIX);
+    String suffix = ToolingExtensions.readStringExtension(sd,  ToolingExtensions.EXT_MAPPING_SUFFIX);
+    if (prefix == null || suffix == null)
+      return null;
+    // we build this by text. Any element that has a mapping, we put it's mappings inside it....
+    StringBuilder b = new StringBuilder();
+    b.append(prefix);
+
+    ElementDefinition root = sd.getSnapshot().getElementFirstRep();
+    String m = getMapping(root, id);
+    if (m != null)
+      b.append(m+"\r\n");
+    addChildMappings(b, id, "", sd, root, false);
+    b.append("\r\n");
+    b.append(suffix);
+    b.append("\r\n");
+    TextFile.stringToFile(b.toString(), "c:\\temp\\test.map");
+    StructureMap map = parse(b.toString());
+    map.setId(tail(map.getUrl()));
+    if (!map.hasStatus())
+      map.setStatus(PublicationStatus.DRAFT);
+    map.getText().setStatus(NarrativeStatus.GENERATED);
+    map.getText().setDiv(new XhtmlNode(NodeType.Element, "div"));
+    map.getText().getDiv().addTag("pre").addText(render(map));
+    return map;
+  }
+
+
+  private String tail(String url) {
+    return url.substring(url.lastIndexOf("/")+1);
+  }
+
+
+  private void addChildMappings(StringBuilder b, String id, String indent, StructureDefinition sd, ElementDefinition ed, boolean inner) throws DefinitionException {
+    boolean first = true;
+    List children = ProfileUtilities.getChildMap(sd, ed);
+    for (ElementDefinition child : children) {
+      if (first && inner) {
+        b.append(" then {\r\n");
+        first = false;
+      }
+      String map = getMapping(child, id);
+      if (map != null) {
+        b.append(indent+"  "+child.getPath()+": "+map);
+        addChildMappings(b, id, indent+"  ", sd, child, true);
+        b.append("\r\n");
+      }
+    }
+    if (!first && inner)
+      b.append(indent+"}");
+    
+  }
+
+
+  private String getMapping(ElementDefinition ed, String id) {
+    for (ElementDefinitionMappingComponent map : ed.getMapping())
+      if (id.equals(map.getIdentity()))
+        return map.getMap();
+    return null;
+  }
+
+
+  private String getLogicalMappingId(StructureDefinition sd) {
+    String id = null;
+    for (StructureDefinitionMappingComponent map : sd.getMapping()) {
+      if ("http://hl7.org/fhir/logical".equals(map.getUri()))
+        return map.getIdentity();
+    }
+    return null;
+  }
+	
+}
diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/formats/JsonTrackingParser.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/formats/JsonTrackingParser.java
index 76147fd9fab..dd7eaaed48e 100644
--- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/formats/JsonTrackingParser.java
+++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/utils/formats/JsonTrackingParser.java
@@ -1,498 +1,505 @@
-package org.hl7.fhir.dstu3.utils.formats;
-
-import java.math.BigDecimal;
-import java.util.Map;
-import java.util.Stack;
-
-import org.hl7.fhir.exceptions.FHIRException;
-import org.hl7.fhir.utilities.Utilities;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonNull;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-
-
-/**
- * This is created to get a json parser that can track line numbers... grr...
- * 
- * @author Grahame Grieve
- *
- */
-public class JsonTrackingParser {
-
-	public enum TokenType {
-		Open, Close, String, Number, Colon, Comma, OpenArray, CloseArray, Eof, Null, Boolean;
-	}
-	
-	public class LocationData {
-		private int line;
-		private int col;
-		
-		protected LocationData(int line, int col) {
-			super();
-			this.line = line;
-			this.col = col;
-		}
-		
-		public int getLine() {
-			return line;
-		}
-		
-		public int getCol() {
-			return col;
-		}
-		
-		public void newLine() {
-			line++;
-			col = 1;		
-		}
-
-		public LocationData copy() {
-			return new LocationData(line, col);
-		}
-	}
-	
-	private class State {
-		private String name;
-		private boolean isProp;
-		protected State(String name, boolean isProp) {
-			super();
-			this.name = name;
-			this.isProp = isProp;
-		}
-		public String getName() {
-			return name;
-		}
-		public boolean isProp() {
-			return isProp;
-		}
-	}
-	
-	private class Lexer {
-		private String source;
-		private int cursor;
-		private String peek;
-		private String value;
-		private TokenType type;
-		private Stack states = new Stack();
-		private LocationData lastLocationBWS;
-		private LocationData lastLocationAWS;
-		private LocationData location;
-		private StringBuilder b = new StringBuilder();
-		
-    public Lexer(String source) throws FHIRException {
-    	this.source = source;
-    	cursor = -1;
-    	location = new LocationData(1, 1);  
-    	start();
-    }
-    
-    private boolean more() {
-    	return peek != null || cursor < source.length(); 
-    }
-    
-    private String getNext(int length) throws FHIRException {
-    	String result = "";
-      if (peek != null) {
-      	if (peek.length() > length) {
-      		result = peek.substring(0, length);
-      		peek = peek.substring(length);
-      	} else {
-      		result = peek;
-      		peek = null;
-      	}
-      }
-      if (result.length() < length) {
-      	int len = length - result.length(); 
-      	if (cursor > source.length() - len) 
-      		throw error("Attempt to read past end of source");
-      	result = result + source.substring(cursor+1, cursor+len+1);
-      	cursor = cursor + len;
-      }
-       for (char ch : result.toCharArray())
-        if (ch == '\n')
-          location.newLine();
-        else
-          location.col++;
-      return result;
-    }
-    
-    private char getNextChar() throws FHIRException {
-      if (peek != null) {
-      	char ch = peek.charAt(0);
-      	peek = peek.length() == 1 ? null : peek.substring(1);
-      	return ch;
-      } else {
-        cursor++;
-        if (cursor >= source.length())
-          return (char) 0;
-        char ch = source.charAt(cursor);
-        if (ch == '\n') {
-          location.newLine();
-        } else {
-          location.col++;
-        }
-        return ch;
-      }
-    }
-    
-    private void push(char ch){
-    	peek = peek == null ? String.valueOf(ch) : String.valueOf(ch)+peek;
-    }
-    
-    private void parseWord(String word, char ch, TokenType type) throws FHIRException {
-      this.type = type;
-      value = ""+ch+getNext(word.length()-1);
-      if (!value.equals(word))
-      	throw error("Syntax error in json reading special word "+word);
-    }
-    
-    private FHIRException error(String msg) {
-      return new FHIRException("Error parsing JSON source: "+msg+" at Line "+Integer.toString(location.line)+" (path=["+path()+"])");
-    }
-    
-    private String path() {
-      if (states.empty())
-        return value;
-      else {
-      	String result = "";
-        for (State s : states) 
-          result = result + '/'+ s.getName();
-        result = result + value;
-        return result;
-      }
-    }
-
-    public void start() throws FHIRException {
-//      char ch = getNextChar();
-//      if (ch = '\.uEF')
-//      begin
-//        // skip BOM
-//        getNextChar();
-//        getNextChar();
-//      end
-//      else
-//        push(ch);
-      next();
-    }
-    
-    public TokenType getType() {
-    	return type;
-    }
-    
-    public String getValue() {
-    	return value;
-    }
-
-
-    public LocationData getLastLocationBWS() {
-    	return lastLocationBWS;
-    }
-
-    public LocationData getLastLocationAWS() {
-    	return lastLocationAWS;
-    }
-
-    public void next() throws FHIRException {
-    	lastLocationBWS = location.copy();
-    	char ch;
-    	do {
-    		ch = getNextChar();
-    	} while (more() && Utilities.charInSet(ch, ' ', '\r', '\n', '\t'));
-    	lastLocationAWS = location.copy();
-
-    	if (!more()) {
-    		type = TokenType.Eof;
-    	} else {
-    		switch (ch) {
-    		case '{' : 
-    			type = TokenType.Open;
-    			break;
-    		case '}' : 
-    			type = TokenType.Close;
-    			break;
-    		case '"' :
-    			type = TokenType.String;
-    			b.setLength(0);
-    			do {
-    				ch = getNextChar();
-    				if (ch == '\\') {
-    					ch = getNextChar();
-    					switch (ch) {
-    					case '"': b.append('"'); break;
-    					case '\\': b.append('\\'); break;
-    					case '/': b.append('/'); break;
-    					case 'n': b.append('\n'); break;
-    					case 'r': b.append('\r'); break;
-    					case 't': b.append('\t'); break;
-    					case 'u': b.append((char) Integer.parseInt(getNext(4), 16)); break;
-    					default :
-    						throw error("unknown escape sequence: \\"+ch);
-    					}
-    					ch = ' ';
-    				} else if (ch != '"')
-    					b.append(ch);
-    			} while (more() && (ch != '"'));
-    			if (!more())
-    				throw error("premature termination of json stream during a string");
-    			value = b.toString();
-    			break;
-    		case ':' : 
-    			type = TokenType.Colon;
-    			break;
-    		case ',' : 
-    			type = TokenType.Comma;
-    			break;
-    		case '[' : 
-    			type = TokenType.OpenArray;
-    			break;
-    		case ']' : 
-    			type = TokenType.CloseArray;
-    			break;
-    		case 't' : 
-    			parseWord("true", ch, TokenType.Boolean);
-    			break;
-    		case 'f' : 
-    			parseWord("false", ch, TokenType.Boolean);
-    			break;
-    		case 'n' : 
-    			parseWord("null", ch, TokenType.Null);
-    			break;
-    		default:
-    			if ((ch >= '0' && ch <= '9') || ch == '-') {
-    				type = TokenType.Number;
-    				b.setLength(0);
-    				while (more() && ((ch >= '0' && ch <= '9') || ch == '-' || ch == '.')) {
-    					b.append(ch);
-    					ch = getNextChar();
-    				}
-    				value = b.toString();
-    				push(ch);
-    			} else
-    				throw error("Unexpected char '"+ch+"' in json stream");
-    		}
-    	}
-    }
-
-    public String consume(TokenType type) throws FHIRException {
-      if (this.type != type)
-        throw error("JSON syntax error - found "+type.toString()+" expecting "+type.toString());
-      String result = value;
-      next();
-      return result;
-    }
-
-	}
-
-	enum ItemType {
-	  Object, String, Number, Boolean, Array, End, Eof, Null;
-	}
-	private Map map;
-  private Lexer lexer;
-  private ItemType itemType = ItemType.Object;
-  private String itemName;
-  private String itemValue;
-
-	public static JsonObject parse(String source, Map map) throws FHIRException {
-		JsonTrackingParser self = new JsonTrackingParser();
-		self.map = map;
-    return self.parse(source);
-	}
-
-	private JsonObject parse(String source) throws FHIRException {
-		lexer = new Lexer(source);
-		JsonObject result = new JsonObject();
-		LocationData loc = lexer.location.copy();
-    if (lexer.getType() == TokenType.Open) {
-      lexer.next();
-      lexer.states.push(new State("", false));
-    } 
-    else
-      throw lexer.error("Unexpected content at start of JSON: "+lexer.getType().toString());
-
-    parseProperty();
-    readObject(result, true);
-		map.put(result, loc);
-    return result;
-	}
-
-	private void readObject(JsonObject obj, boolean root) throws FHIRException {
-		map.put(obj, lexer.location.copy());
-
-		while (!(itemType == ItemType.End) || (root && (itemType == ItemType.Eof))) {
-			if (obj.has(itemName))
-				throw lexer.error("Duplicated property name: "+itemName);
-
-			switch (itemType) {
-			case Object:
-				JsonObject child = new JsonObject(); //(obj.path+'.'+ItemName);
-				LocationData loc = lexer.location.copy();
-				obj.add(itemName, child);
-				next();
-				readObject(child, false);
-				map.put(obj, loc);
-				break;
-			case Boolean :
-				JsonPrimitive v = new JsonPrimitive(Boolean.valueOf(itemValue));
-				obj.add(itemName, v);
-				map.put(v, lexer.location.copy());
-				break;
-			case String:
-				v = new JsonPrimitive(itemValue);
-				obj.add(itemName, v);
-				map.put(v, lexer.location.copy());
-				break;
-			case Number:
-				v = new JsonPrimitive(new BigDecimal(itemValue));
-				obj.add(itemName, v);
-				map.put(v, lexer.location.copy());
-				break;
-			case Null:
-				JsonNull n = new JsonNull();
-				obj.add(itemName, n);
-				map.put(n, lexer.location.copy());
-				break;
-			case Array:
-				JsonArray arr = new JsonArray(); // (obj.path+'.'+ItemName);
-				loc = lexer.location.copy();
-				obj.add(itemName, arr);
-				next();
-				readArray(arr, false);
-				map.put(arr, loc);
-				break;
-			case Eof : 
-				throw lexer.error("Unexpected End of File");
-			}
-			next();
-		}
-	}
-
-	private void readArray(JsonArray arr, boolean root) throws FHIRException {
-	  while (!((itemType == ItemType.End) || (root && (itemType == ItemType.Eof)))) {
-	    switch (itemType) {
-	    case Object:
-	    	JsonObject obj  = new JsonObject(); // (arr.path+'['+inttostr(i)+']');
-				LocationData loc = lexer.location.copy();
-	    	arr.add(obj);
-	      next();
-	      readObject(obj, false);
-				map.put(obj, loc);
-	      break;
-	    case String:
-	    	JsonPrimitive v = new JsonPrimitive(itemValue);
-				arr.add(v);
-				map.put(v, lexer.location.copy());
-				break;
-	    case Number:
-	    	v = new JsonPrimitive(new BigDecimal(itemValue));
-				arr.add(v);
-				map.put(v, lexer.location.copy());
-				break;
-	    case Null :
-	    	JsonNull n = new JsonNull();
-				arr.add(n);
-				map.put(n, lexer.location.copy());
-				break;
-	    case Array:
-        JsonArray child = new JsonArray(); // (arr.path+'['+inttostr(i)+']');
-				loc = lexer.location.copy();
-				arr.add(child);
-        next();
-	      readArray(child, false);
-				map.put(arr, loc);
-        break;
-	    case Eof : 
-	    	throw lexer.error("Unexpected End of File");
-	    }
-	    next();
-	  }
-	}
-
-	private void next() throws FHIRException {
-		switch (itemType) {
-		case Object :
-			lexer.consume(TokenType.Open);
-			lexer.states.push(new State(itemName, false));
-			if (lexer.getType() == TokenType.Close) {
-				itemType = ItemType.End;
-				lexer.next();
-			} else
-				parseProperty();
-			break;
-		case Null:
-		case String:
-		case Number: 
-		case End: 
-		case Boolean :
-			if (itemType == ItemType.End)
-				lexer.states.pop();
-			if (lexer.getType() == TokenType.Comma) {
-				lexer.next();
-				parseProperty();
-			} else if (lexer.getType() == TokenType.Close) {
-				itemType = ItemType.End;
-				lexer.next();
-			} else if (lexer.getType() == TokenType.CloseArray) {
-				itemType = ItemType.End;
-				lexer.next();
-			} else if (lexer.getType() == TokenType.Eof) {
-				itemType = ItemType.Eof;
-			} else
-				throw lexer.error("Unexpected JSON syntax");
-			break;
-		case Array :
-			lexer.next();
-			lexer.states.push(new State(itemName+"[]", true));
-			parseProperty();
-			break;
-		case Eof :
-			throw lexer.error("JSON Syntax Error - attempt to read past end of json stream");
-		default:
-			throw lexer.error("not done yet (a): "+itemType.toString());
-		}
-	}
-
-	private void parseProperty() throws FHIRException {
-		if (!lexer.states.peek().isProp) {
-			itemName = lexer.consume(TokenType.String);
-			itemValue = null;
-			lexer.consume(TokenType.Colon);
-		}
-		switch (lexer.getType()) {
-		case Null :
-			itemType = ItemType.Null;
-			itemValue = lexer.value;
-			lexer.next();
-			break;
-		case String :
-			itemType = ItemType.String;
-			itemValue = lexer.value;
-			lexer.next();
-			break;
-		case Boolean :
-			itemType = ItemType.Boolean;
-			itemValue = lexer.value;
-			lexer.next();
-			break;
-		case Number :
-			itemType = ItemType.Number;
-			itemValue = lexer.value;
-			lexer.next();
-			break;
-		case Open :
-			itemType = ItemType.Object;
-			break;
-		case OpenArray :
-			itemType = ItemType.Array;
-			break;
-		case CloseArray :
-			itemType = ItemType.End;
-			break;
-			// case Close, , case Colon, case Comma, case OpenArray,       !
-		default:
-			throw lexer.error("not done yet (b): "+lexer.getType().toString());
-		}
-	}
-}
+package org.hl7.fhir.dstu3.utils.formats;
+
+import java.math.BigDecimal;
+import java.util.Map;
+import java.util.Stack;
+
+import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.utilities.Utilities;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonNull;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+
+
+/**
+ * This is created to get a json parser that can track line numbers... grr...
+ * 
+ * @author Grahame Grieve
+ *
+ */
+public class JsonTrackingParser {
+
+	public enum TokenType {
+		Open, Close, String, Number, Colon, Comma, OpenArray, CloseArray, Eof, Null, Boolean;
+	}
+	
+	public class LocationData {
+		private int line;
+		private int col;
+		
+		protected LocationData(int line, int col) {
+			super();
+			this.line = line;
+			this.col = col;
+		}
+		
+		public int getLine() {
+			return line;
+		}
+		
+		public int getCol() {
+			return col;
+		}
+		
+		public void newLine() {
+			line++;
+			col = 1;		
+		}
+
+		public LocationData copy() {
+			return new LocationData(line, col);
+		}
+	}
+	
+	private class State {
+		private String name;
+		private boolean isProp;
+		protected State(String name, boolean isProp) {
+			super();
+			this.name = name;
+			this.isProp = isProp;
+		}
+		public String getName() {
+			return name;
+		}
+		public boolean isProp() {
+			return isProp;
+		}
+	}
+	
+	private class Lexer {
+		private String source;
+		private int cursor;
+		private String peek;
+		private String value;
+		private TokenType type;
+		private Stack states = new Stack();
+		private LocationData lastLocationBWS;
+		private LocationData lastLocationAWS;
+		private LocationData location;
+		private StringBuilder b = new StringBuilder();
+		
+    public Lexer(String source) throws FHIRException {
+    	this.source = source;
+    	cursor = -1;
+    	location = new LocationData(1, 1);  
+    	start();
+    }
+    
+    private boolean more() {
+    	return peek != null || cursor < source.length(); 
+    }
+    
+    private String getNext(int length) throws FHIRException {
+    	String result = "";
+      if (peek != null) {
+      	if (peek.length() > length) {
+      		result = peek.substring(0, length);
+      		peek = peek.substring(length);
+      	} else {
+      		result = peek;
+      		peek = null;
+      	}
+      }
+      if (result.length() < length) {
+      	int len = length - result.length(); 
+      	if (cursor > source.length() - len) 
+      		throw error("Attempt to read past end of source");
+      	result = result + source.substring(cursor+1, cursor+len+1);
+      	cursor = cursor + len;
+      }
+       for (char ch : result.toCharArray())
+        if (ch == '\n')
+          location.newLine();
+        else
+          location.col++;
+      return result;
+    }
+    
+    private char getNextChar() throws FHIRException {
+      if (peek != null) {
+      	char ch = peek.charAt(0);
+      	peek = peek.length() == 1 ? null : peek.substring(1);
+      	return ch;
+      } else {
+        cursor++;
+        if (cursor >= source.length())
+          return (char) 0;
+        char ch = source.charAt(cursor);
+        if (ch == '\n') {
+          location.newLine();
+        } else {
+          location.col++;
+        }
+        return ch;
+      }
+    }
+    
+    private void push(char ch){
+    	peek = peek == null ? String.valueOf(ch) : String.valueOf(ch)+peek;
+    }
+    
+    private void parseWord(String word, char ch, TokenType type) throws FHIRException {
+      this.type = type;
+      value = ""+ch+getNext(word.length()-1);
+      if (!value.equals(word))
+      	throw error("Syntax error in json reading special word "+word);
+    }
+    
+    private FHIRException error(String msg) {
+      return new FHIRException("Error parsing JSON source: "+msg+" at Line "+Integer.toString(location.line)+" (path=["+path()+"])");
+    }
+    
+    private String path() {
+      if (states.empty())
+        return value;
+      else {
+      	String result = "";
+        for (State s : states) 
+          result = result + '/'+ s.getName();
+        result = result + value;
+        return result;
+      }
+    }
+
+    public void start() throws FHIRException {
+//      char ch = getNextChar();
+//      if (ch = '\.uEF')
+//      begin
+//        // skip BOM
+//        getNextChar();
+//        getNextChar();
+//      end
+//      else
+//        push(ch);
+      next();
+    }
+    
+    public TokenType getType() {
+    	return type;
+    }
+    
+    public String getValue() {
+    	return value;
+    }
+
+
+    public LocationData getLastLocationBWS() {
+    	return lastLocationBWS;
+    }
+
+    public LocationData getLastLocationAWS() {
+    	return lastLocationAWS;
+    }
+
+    public void next() throws FHIRException {
+    	lastLocationBWS = location.copy();
+    	char ch;
+    	do {
+    		ch = getNextChar();
+    	} while (more() && Utilities.charInSet(ch, ' ', '\r', '\n', '\t'));
+    	lastLocationAWS = location.copy();
+
+    	if (!more()) {
+    		type = TokenType.Eof;
+    	} else {
+    		switch (ch) {
+    		case '{' : 
+    			type = TokenType.Open;
+    			break;
+    		case '}' : 
+    			type = TokenType.Close;
+    			break;
+    		case '"' :
+    			type = TokenType.String;
+    			b.setLength(0);
+    			do {
+    				ch = getNextChar();
+    				if (ch == '\\') {
+    					ch = getNextChar();
+    					switch (ch) {
+    					case '"': b.append('"'); break;
+    					case '\\': b.append('\\'); break;
+    					case '/': b.append('/'); break;
+    					case 'n': b.append('\n'); break;
+    					case 'r': b.append('\r'); break;
+    					case 't': b.append('\t'); break;
+    					case 'u': b.append((char) Integer.parseInt(getNext(4), 16)); break;
+    					default :
+    						throw error("unknown escape sequence: \\"+ch);
+    					}
+    					ch = ' ';
+    				} else if (ch != '"')
+    					b.append(ch);
+    			} while (more() && (ch != '"'));
+    			if (!more())
+    				throw error("premature termination of json stream during a string");
+    			value = b.toString();
+    			break;
+    		case ':' : 
+    			type = TokenType.Colon;
+    			break;
+    		case ',' : 
+    			type = TokenType.Comma;
+    			break;
+    		case '[' : 
+    			type = TokenType.OpenArray;
+    			break;
+    		case ']' : 
+    			type = TokenType.CloseArray;
+    			break;
+    		case 't' : 
+    			parseWord("true", ch, TokenType.Boolean);
+    			break;
+    		case 'f' : 
+    			parseWord("false", ch, TokenType.Boolean);
+    			break;
+    		case 'n' : 
+    			parseWord("null", ch, TokenType.Null);
+    			break;
+    		default:
+    			if ((ch >= '0' && ch <= '9') || ch == '-') {
+    				type = TokenType.Number;
+    				b.setLength(0);
+    				while (more() && ((ch >= '0' && ch <= '9') || ch == '-' || ch == '.')) {
+    					b.append(ch);
+    					ch = getNextChar();
+    				}
+    				value = b.toString();
+    				push(ch);
+    			} else
+    				throw error("Unexpected char '"+ch+"' in json stream");
+    		}
+    	}
+    }
+
+    public String consume(TokenType type) throws FHIRException {
+      if (this.type != type)
+        throw error("JSON syntax error - found "+type.toString()+" expecting "+type.toString());
+      String result = value;
+      next();
+      return result;
+    }
+
+	}
+
+	enum ItemType {
+	  Object, String, Number, Boolean, Array, End, Eof, Null;
+	}
+	private Map map;
+  private Lexer lexer;
+  private ItemType itemType = ItemType.Object;
+  private String itemName;
+  private String itemValue;
+
+	public static JsonObject parse(String source, Map map) throws FHIRException {
+		JsonTrackingParser self = new JsonTrackingParser();
+		self.map = map;
+    return self.parse(source);
+	}
+
+	private JsonObject parse(String source) throws FHIRException {
+		lexer = new Lexer(source);
+		JsonObject result = new JsonObject();
+		LocationData loc = lexer.location.copy();
+    if (lexer.getType() == TokenType.Open) {
+      lexer.next();
+      lexer.states.push(new State("", false));
+    } 
+    else
+      throw lexer.error("Unexpected content at start of JSON: "+lexer.getType().toString());
+
+    parseProperty();
+    readObject(result, true);
+		map.put(result, loc);
+    return result;
+	}
+
+	private void readObject(JsonObject obj, boolean root) throws FHIRException {
+		map.put(obj, lexer.location.copy());
+
+		while (!(itemType == ItemType.End) || (root && (itemType == ItemType.Eof))) {
+			if (obj.has(itemName))
+				throw lexer.error("Duplicated property name: "+itemName);
+
+			switch (itemType) {
+			case Object:
+				JsonObject child = new JsonObject(); //(obj.path+'.'+ItemName);
+				LocationData loc = lexer.location.copy();
+				obj.add(itemName, child);
+				next();
+				readObject(child, false);
+				map.put(obj, loc);
+				break;
+			case Boolean :
+				JsonPrimitive v = new JsonPrimitive(Boolean.valueOf(itemValue));
+				obj.add(itemName, v);
+				map.put(v, lexer.location.copy());
+				break;
+			case String:
+				v = new JsonPrimitive(itemValue);
+				obj.add(itemName, v);
+				map.put(v, lexer.location.copy());
+				break;
+			case Number:
+				v = new JsonPrimitive(new BigDecimal(itemValue));
+				obj.add(itemName, v);
+				map.put(v, lexer.location.copy());
+				break;
+			case Null:
+				JsonNull n = new JsonNull();
+				obj.add(itemName, n);
+				map.put(n, lexer.location.copy());
+				break;
+			case Array:
+				JsonArray arr = new JsonArray(); // (obj.path+'.'+ItemName);
+				loc = lexer.location.copy();
+				obj.add(itemName, arr);
+				next();
+				readArray(arr, false);
+				map.put(arr, loc);
+				break;
+			case Eof : 
+				throw lexer.error("Unexpected End of File");
+         case End:
+           // TODO: anything?
+           break;
+			}
+			next();
+		}
+	}
+
+	private void readArray(JsonArray arr, boolean root) throws FHIRException {
+	  while (!((itemType == ItemType.End) || (root && (itemType == ItemType.Eof)))) {
+	    switch (itemType) {
+	    case Object:
+	    	JsonObject obj  = new JsonObject(); // (arr.path+'['+inttostr(i)+']');
+				LocationData loc = lexer.location.copy();
+	    	arr.add(obj);
+	      next();
+	      readObject(obj, false);
+				map.put(obj, loc);
+	      break;
+	    case String:
+	    	JsonPrimitive v = new JsonPrimitive(itemValue);
+				arr.add(v);
+				map.put(v, lexer.location.copy());
+				break;
+	    case Number:
+	    	v = new JsonPrimitive(new BigDecimal(itemValue));
+				arr.add(v);
+				map.put(v, lexer.location.copy());
+				break;
+	    case Null :
+	    	JsonNull n = new JsonNull();
+				arr.add(n);
+				map.put(n, lexer.location.copy());
+				break;
+	    case Array:
+        JsonArray child = new JsonArray(); // (arr.path+'['+inttostr(i)+']');
+				loc = lexer.location.copy();
+				arr.add(child);
+        next();
+	      readArray(child, false);
+				map.put(arr, loc);
+        break;
+	    case Eof : 
+	    	throw lexer.error("Unexpected End of File");
+       case End:
+       case Boolean:
+         // TODO: anything?
+         break;
+	    }
+	    next();
+	  }
+	}
+
+	private void next() throws FHIRException {
+		switch (itemType) {
+		case Object :
+			lexer.consume(TokenType.Open);
+			lexer.states.push(new State(itemName, false));
+			if (lexer.getType() == TokenType.Close) {
+				itemType = ItemType.End;
+				lexer.next();
+			} else
+				parseProperty();
+			break;
+		case Null:
+		case String:
+		case Number: 
+		case End: 
+		case Boolean :
+			if (itemType == ItemType.End)
+				lexer.states.pop();
+			if (lexer.getType() == TokenType.Comma) {
+				lexer.next();
+				parseProperty();
+			} else if (lexer.getType() == TokenType.Close) {
+				itemType = ItemType.End;
+				lexer.next();
+			} else if (lexer.getType() == TokenType.CloseArray) {
+				itemType = ItemType.End;
+				lexer.next();
+			} else if (lexer.getType() == TokenType.Eof) {
+				itemType = ItemType.Eof;
+			} else
+				throw lexer.error("Unexpected JSON syntax");
+			break;
+		case Array :
+			lexer.next();
+			lexer.states.push(new State(itemName+"[]", true));
+			parseProperty();
+			break;
+		case Eof :
+			throw lexer.error("JSON Syntax Error - attempt to read past end of json stream");
+		default:
+			throw lexer.error("not done yet (a): "+itemType.toString());
+		}
+	}
+
+	private void parseProperty() throws FHIRException {
+		if (!lexer.states.peek().isProp) {
+			itemName = lexer.consume(TokenType.String);
+			itemValue = null;
+			lexer.consume(TokenType.Colon);
+		}
+		switch (lexer.getType()) {
+		case Null :
+			itemType = ItemType.Null;
+			itemValue = lexer.value;
+			lexer.next();
+			break;
+		case String :
+			itemType = ItemType.String;
+			itemValue = lexer.value;
+			lexer.next();
+			break;
+		case Boolean :
+			itemType = ItemType.Boolean;
+			itemValue = lexer.value;
+			lexer.next();
+			break;
+		case Number :
+			itemType = ItemType.Number;
+			itemValue = lexer.value;
+			lexer.next();
+			break;
+		case Open :
+			itemType = ItemType.Object;
+			break;
+		case OpenArray :
+			itemType = ItemType.Array;
+			break;
+		case CloseArray :
+			itemType = ItemType.End;
+			break;
+			// case Close, , case Colon, case Comma, case OpenArray,       !
+		default:
+			throw lexer.error("not done yet (b): "+lexer.getType().toString());
+		}
+	}
+}
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/Bug720Datatype.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/Bug720Datatype.java
new file mode 100644
index 00000000000..b18564a4794
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/Bug720Datatype.java
@@ -0,0 +1,30 @@
+package ca.uhn.fhir.parser;
+
+import ca.uhn.fhir.model.api.annotation.Child;
+import ca.uhn.fhir.model.api.annotation.DatatypeDef;
+import ca.uhn.fhir.model.api.annotation.Description;
+import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
+import org.hl7.fhir.dstu3.model.Person;
+import org.hl7.fhir.dstu3.model.Type;
+import org.hl7.fhir.instance.model.api.ICompositeType;
+
+/**
+ * See #720
+ */
+@DatatypeDef(name = "ConsentTemplate")
+public class Bug720Datatype extends Type implements ICompositeType {
+
+	@Child(name = "contact", order = 8, min = 0, max = 1)
+	@Description(shortDefinition = "responsible contact for this consent template")
+	private Person contact = new Person();
+
+	public Person getContact() {
+		return contact;
+	}
+
+
+	@Override
+	protected Type typedCopy() {
+		throw new InternalErrorException("");
+	}
+}
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/Bug720ResourceType.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/Bug720ResourceType.java
new file mode 100644
index 00000000000..35f971f0a5f
--- /dev/null
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/Bug720ResourceType.java
@@ -0,0 +1,38 @@
+package ca.uhn.fhir.parser;
+
+import ca.uhn.fhir.model.api.annotation.Child;
+import ca.uhn.fhir.model.api.annotation.Description;
+import ca.uhn.fhir.model.api.annotation.ResourceDef;
+import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
+import org.hl7.fhir.dstu3.model.DomainResource;
+import org.hl7.fhir.dstu3.model.ResourceType;
+import org.hl7.fhir.dstu3.model.Type;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * See #720
+ */
+@ResourceDef(name = "Bug720ResourceType", profile = "http://example.com/StructureDefinition/dontuse#Bug720ResourceType")
+public class Bug720ResourceType extends DomainResource {
+
+
+	@Child(name = "templates", order = 4, min = 1, max = Child.MAX_UNLIMITED, type = {Bug720Datatype.class})
+	@Description(shortDefinition = "import information for 1-n consent templates")
+	private List templates = new ArrayList();
+
+	@Override
+	public DomainResource copy() {
+		throw new InternalErrorException("");
+	}
+
+	@Override
+	public ResourceType getResourceType() {
+		throw new InternalErrorException("");
+	}
+
+	public List getTemplates() {
+		return templates;
+	}
+}
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
index b62f272fe89..c5f4213969e 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/JsonParserDstu3Test.java
@@ -51,14 +51,14 @@ import static org.mockito.Matchers.isNull;
 import static org.mockito.Mockito.*;
 
 public class JsonParserDstu3Test {
-	private static FhirContext ourCtx = FhirContext.forDstu3();
 	private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JsonParserDstu3Test.class);
+	private static FhirContext ourCtx = FhirContext.forDstu3();
 
 	@After
 	public void after() {
 		ourCtx.setNarrativeGenerator(null);
 	}
-	
+
 
 	/**
 	 * See #563
@@ -94,6 +94,26 @@ public class JsonParserDstu3Test {
 		}
 	}
 
+	@Test
+	public void testBaseUrlFooResourceCorrectlySerializedInExtensionValueReference() {
+		String refVal = "http://my.org/FooBar";
+
+		Patient fhirPat = new Patient();
+		fhirPat.addExtension().setUrl("x1").setValue(new Reference(refVal));
+
+		IParser parser = ourCtx.newJsonParser();
+
+		String output = parser.encodeResourceToString(fhirPat);
+		System.out.println("output: " + output);
+
+		// Deserialize then check that valueReference value is still correct
+		fhirPat = parser.parseResource(Patient.class, output);
+
+		List extlst = fhirPat.getExtensionsByUrl("x1");
+		Assert.assertEquals(1, extlst.size());
+		Assert.assertEquals(refVal, ((Reference) extlst.get(0).getValue()).getReference());
+	}
+
 	/**
 	 * See #544
 	 */
@@ -255,12 +275,12 @@ public class JsonParserDstu3Test {
 
 		String enc = ourCtx.newJsonParser().encodeResourceToString(patient);
 		assertThat(enc, Matchers.stringContainsInOrder("{\"resourceType\":\"Patient\",", "\"extension\":[{\"url\":\"http://example.com/extensions#someext\",\"valueDateTime\":\"2011-01-02T11:13:15\"}",
-				"{\"url\":\"http://example.com#parent\",\"extension\":[{\"url\":\"http://example.com#child\",\"valueString\":\"value1\"},{\"url\":\"http://example.com#child\",\"valueString\":\"value2\"}]}"));
+			"{\"url\":\"http://example.com#parent\",\"extension\":[{\"url\":\"http://example.com#child\",\"valueString\":\"value1\"},{\"url\":\"http://example.com#child\",\"valueString\":\"value2\"}]}"));
 		assertThat(enc, Matchers.stringContainsInOrder("\"modifierExtension\":[" + "{" + "\"url\":\"http://example.com/extensions#modext\"," + "\"valueDate\":\"1995-01-02\"" + "}" + "],"));
 		assertThat(enc,
-				containsString("\"_given\":[" + "{" + "\"extension\":[" + "{" + "\"url\":\"http://examples.com#givenext\"," + "\"valueString\":\"given\"" + "}" + "]" + "}," + "{" + "\"extension\":[" + "{"
-						+ "\"url\":\"http://examples.com#givenext_parent\"," + "\"extension\":[" + "{" + "\"url\":\"http://examples.com#givenext_child\"," + "\"valueString\":\"CHILD\"" + "}" + "]" + "}"
-						+ "]" + "}"));
+			containsString("\"_given\":[" + "{" + "\"extension\":[" + "{" + "\"url\":\"http://examples.com#givenext\"," + "\"valueString\":\"given\"" + "}" + "]" + "}," + "{" + "\"extension\":[" + "{"
+				+ "\"url\":\"http://examples.com#givenext_parent\"," + "\"extension\":[" + "{" + "\"url\":\"http://examples.com#givenext_child\"," + "\"valueString\":\"CHILD\"" + "}" + "]" + "}"
+				+ "]" + "}"));
 
 		/*
 		 * Now parse this back
@@ -318,36 +338,36 @@ public class JsonParserDstu3Test {
 		ourLog.info(enc);
 
 		//@formatter:off
-		assertThat(enc, stringContainsInOrder("\"meta\": {", 
-				"\"profile\": [", 
-				"\"http://foo/Profile1\",", 
-				"\"http://foo/Profile2\"", 
-				"],", 
-				"\"security\": [", 
-				"{", 
-				"\"system\": \"sec_scheme1\",", 
-				"\"code\": \"sec_term1\",", 
-				"\"display\": \"sec_label1\"", 
-				"},", 
-				"{", 
-				"\"system\": \"sec_scheme2\",", 
-				"\"code\": \"sec_term2\",", 
-				"\"display\": \"sec_label2\"", 
-				"}", 
-				"],", 
-				"\"tag\": [", 
-				"{", 
-				"\"system\": \"scheme1\",", 
-				"\"code\": \"term1\",", 
-				"\"display\": \"label1\"", 
-				"},", 
-				"{", 
-				"\"system\": \"scheme2\",", 
-				"\"code\": \"term2\",", 
-				"\"display\": \"label2\"", 
-				"}", 
-				"]", 
-				"},"));
+		assertThat(enc, stringContainsInOrder("\"meta\": {",
+			"\"profile\": [",
+			"\"http://foo/Profile1\",",
+			"\"http://foo/Profile2\"",
+			"],",
+			"\"security\": [",
+			"{",
+			"\"system\": \"sec_scheme1\",",
+			"\"code\": \"sec_term1\",",
+			"\"display\": \"sec_label1\"",
+			"},",
+			"{",
+			"\"system\": \"sec_scheme2\",",
+			"\"code\": \"sec_term2\",",
+			"\"display\": \"sec_label2\"",
+			"}",
+			"],",
+			"\"tag\": [",
+			"{",
+			"\"system\": \"scheme1\",",
+			"\"code\": \"term1\",",
+			"\"display\": \"label1\"",
+			"},",
+			"{",
+			"\"system\": \"scheme2\",",
+			"\"code\": \"term2\",",
+			"\"display\": \"label2\"",
+			"}",
+			"]",
+			"},"));
 		//@formatter:on
 
 		Patient parsed = ourCtx.newJsonParser().parseResource(Patient.class, enc);
@@ -446,29 +466,29 @@ public class JsonParserDstu3Test {
 		ourLog.info(enc);
 
 		//@formatter:off
-		assertEquals("{\n" + 
-			"  \"resourceType\": \"Patient\",\n" + 
-			"  \"meta\": {\n" + 
-			"    \"security\": [\n" + 
-			"      {\n" + 
-			"        \"system\": \"SYSTEM1\",\n" + 
-			"        \"version\": \"VERSION1\",\n" + 
-			"        \"code\": \"CODE1\",\n" + 
-			"        \"display\": \"DISPLAY1\"\n" + 
-			"      },\n" + 
-			"      {\n" + 
-			"        \"system\": \"SYSTEM2\",\n" + 
-			"        \"version\": \"VERSION2\",\n" + 
-			"        \"code\": \"CODE2\",\n" + 
-			"        \"display\": \"DISPLAY2\"\n" + 
-			"      }\n" + 
-			"    ]\n" + 
-			"  },\n" + 
-			"  \"name\": [\n" + 
-			"    {\n" + 
-			"      \"family\": \"FAMILY\"\n" + 
-			"    }\n" + 
-			"  ]\n" + 
+		assertEquals("{\n" +
+			"  \"resourceType\": \"Patient\",\n" +
+			"  \"meta\": {\n" +
+			"    \"security\": [\n" +
+			"      {\n" +
+			"        \"system\": \"SYSTEM1\",\n" +
+			"        \"version\": \"VERSION1\",\n" +
+			"        \"code\": \"CODE1\",\n" +
+			"        \"display\": \"DISPLAY1\"\n" +
+			"      },\n" +
+			"      {\n" +
+			"        \"system\": \"SYSTEM2\",\n" +
+			"        \"version\": \"VERSION2\",\n" +
+			"        \"code\": \"CODE2\",\n" +
+			"        \"display\": \"DISPLAY2\"\n" +
+			"      }\n" +
+			"    ]\n" +
+			"  },\n" +
+			"  \"name\": [\n" +
+			"    {\n" +
+			"      \"family\": \"FAMILY\"\n" +
+			"    }\n" +
+			"  ]\n" +
 			"}", enc.trim());
 		//@formatter:on
 
@@ -490,6 +510,22 @@ public class JsonParserDstu3Test {
 		assertEquals("VERSION2", label.getVersion());
 	}
 
+	@Test
+	public void testEncodeBinaryWithSecurityContext() {
+		Binary bin = new Binary();
+		bin.setContentType("text/plain");
+		bin.setContent("Now is the time".getBytes());
+		Reference securityContext = new Reference();
+		securityContext.setReference("DiagnosticReport/1");
+		bin.setSecurityContext(securityContext);
+		String encoded = ourCtx.newJsonParser().encodeResourceToString(bin);
+		ourLog.info(encoded);
+		assertThat(encoded, containsString("Binary"));
+		assertThat(encoded, containsString("\"contentType\":\"text/plain\""));
+		assertThat(encoded, containsString("\"content\":\"Tm93IGlzIHRoZSB0aW1l\""));
+		assertThat(encoded, containsString("\"securityContext\":{\"reference\":\"DiagnosticReport/1\"}"));
+	}
+
 	@Test
 	public void testEncodeBundleNewBundleNoText() {
 
@@ -523,22 +559,22 @@ public class JsonParserDstu3Test {
 		//@formatter:off
 		assertThat(encoded, stringContainsInOrder(
 			"{",
-				"\"resourceType\": \"Patient\",",
-				"\"contained\": [",
-					"{",
-					"\"resourceType\": \"Condition\",",
-					"\"id\": \"1\"",
-					"}",
-				"],",
-				"\"extension\": [",
-					"{",
-					"\"url\": \"test\",",
-					"\"valueReference\": {",
-					"\"reference\": \"#1\"",
-					"}",
-					"}",
-				"],",
-				"\"birthDate\": \"2016-04-05\"",
+			"\"resourceType\": \"Patient\",",
+			"\"contained\": [",
+			"{",
+			"\"resourceType\": \"Condition\",",
+			"\"id\": \"1\"",
+			"}",
+			"],",
+			"\"extension\": [",
+			"{",
+			"\"url\": \"test\",",
+			"\"valueReference\": {",
+			"\"reference\": \"#1\"",
+			"}",
+			"}",
+			"],",
+			"\"birthDate\": \"2016-04-05\"",
 			"}"
 		));
 		//@formatter:on
@@ -630,8 +666,8 @@ public class JsonParserDstu3Test {
 		ourLog.info(val);
 
 		assertEquals(
-				"{\"resourceType\":\"Patient\",\"id\":\"123\",\"contact\":[{\"extension\":[{\"url\":\"http://foo.com/contact-eyecolour\",\"valueIdentifier\":{\"value\":\"EYE\"}}],\"name\":{\"family\":\"FAMILY\"}}]}",
-				val);
+			"{\"resourceType\":\"Patient\",\"id\":\"123\",\"contact\":[{\"extension\":[{\"url\":\"http://foo.com/contact-eyecolour\",\"valueIdentifier\":{\"value\":\"EYE\"}}],\"name\":{\"family\":\"FAMILY\"}}]}",
+			val);
 
 		FhirContext newCtx = FhirContext.forDstu3();
 		PatientWithExtendedContactDstu3 actual = newCtx.newJsonParser().parseResource(PatientWithExtendedContactDstu3.class, val);
@@ -673,9 +709,9 @@ public class JsonParserDstu3Test {
 		Patient p = new Patient();
 		p.setId("Patient/B");
 		p
-				.addExtension()
-				.setUrl("http://foo")
-				.setValue(new Reference("Practitioner/A"));
+			.addExtension()
+			.setUrl("http://foo")
+			.setValue(new Reference("Practitioner/A"));
 
 		IParser parser = ourCtx.newJsonParser().setPrettyPrint(true);
 		parser.setDontEncodeElements(new HashSet(Arrays.asList("*.id", "*.meta")));
@@ -744,20 +780,20 @@ public class JsonParserDstu3Test {
 
 		//@formatter:off
 		assertThat(output, stringContainsInOrder(
-				"\"id\": \"1\"",
-				"\"meta\"",
-				"\"extension\"",
-				"\"url\": \"http://exturl\"",
-				"\"extension\"",
-				"\"url\": \"http://subext\"",
-				"\"valueString\": \"sub_ext_value\"",
-				"\"code\":"
-			));
-			assertThat(output, not(stringContainsInOrder(
-				"\"url\": \"http://exturl\"",
-				",",
-				"\"url\": \"http://exturl\""
-			)));
+			"\"id\": \"1\"",
+			"\"meta\"",
+			"\"extension\"",
+			"\"url\": \"http://exturl\"",
+			"\"extension\"",
+			"\"url\": \"http://subext\"",
+			"\"valueString\": \"sub_ext_value\"",
+			"\"code\":"
+		));
+		assertThat(output, not(stringContainsInOrder(
+			"\"url\": \"http://exturl\"",
+			",",
+			"\"url\": \"http://exturl\""
+		)));
 		//@formatter:on
 
 		obs = parser.parseResource(Observation.class, output);
@@ -788,17 +824,17 @@ public class JsonParserDstu3Test {
 
 		//@formatter:off
 		assertThat(encoded, stringContainsInOrder(
-			"\"resourceType\": \"Patient\"", 
+			"\"resourceType\": \"Patient\"",
 			"\"contained\": [",
-					"\"resourceType\": \"Condition\"", 
-					"\"id\": \"1\"",
-					"\"bodySite\": [",
-					"\"text\": \"BODY SITE\"",
-			"\"extension\": [", 
-				"\"url\": \"testCondition\",",
-				"\"valueReference\": {",
-					"\"reference\": \"#1\"", 
-			"\"birthDate\": \"2016-04-14\"", 
+			"\"resourceType\": \"Condition\"",
+			"\"id\": \"1\"",
+			"\"bodySite\": [",
+			"\"text\": \"BODY SITE\"",
+			"\"extension\": [",
+			"\"url\": \"testCondition\",",
+			"\"valueReference\": {",
+			"\"reference\": \"#1\"",
+			"\"birthDate\": \"2016-04-14\"",
 			"}"
 		));
 		//@formatter:on
@@ -1038,7 +1074,7 @@ public class JsonParserDstu3Test {
 
 		assertThat(encoded, containsString("Patient"));
 		assertThat(encoded, stringContainsInOrder("\"tag\"", "\"system\": \"foo\",", "\"code\": \"bar\"", "\"system\": \"" + ca.uhn.fhir.rest.api.Constants.TAG_SUBSETTED_SYSTEM + "\"",
-				"\"code\": \"" + ca.uhn.fhir.rest.api.Constants.TAG_SUBSETTED_CODE + "\""));
+			"\"code\": \"" + ca.uhn.fhir.rest.api.Constants.TAG_SUBSETTED_CODE + "\""));
 		assertThat(encoded, not(containsString("THE DIV")));
 		assertThat(encoded, containsString("family"));
 		assertThat(encoded, not(containsString("maritalStatus")));
@@ -1058,7 +1094,7 @@ public class JsonParserDstu3Test {
 		ourLog.info(enc);
 
 		assertEquals("{\"resourceType\":\"Patient\",\"meta\":{\"tag\":[{\"system\":\"scheme\",\"code\":\"term\",\"display\":\"display\"}]},\"identifier\":[{\"system\":\"sys\",\"value\":\"val\"}]}",
-				enc);
+			enc);
 
 	}
 
@@ -1235,19 +1271,19 @@ public class JsonParserDstu3Test {
 	@Test
 	public void testExplanationOfBenefit() {
 		//@formatter:off
-		String input = "{" + 
-			 "  \"resourceType\": \"ExplanationOfBenefit\"," + 
-			 "  \"insurance\": {\n" + 
-			 "    \"coverage\": {\n" + 
-			 "      \"reference\": \"Coverage/123\"\n" + 
-			 "    }\n" + 
-			 "  },\n" + 
-			 "  \"relationship\": {\n" + 
-			 "    \"system\": \"http://hl7.org/fhir/relationship\",\n" + 
-			 "    \"code\": \"1\",\n" + 
-			 "    \"display\": \"self\"\n" + 
-			 "  }\n" + 
-			 "}";
+		String input = "{" +
+			"  \"resourceType\": \"ExplanationOfBenefit\"," +
+			"  \"insurance\": {\n" +
+			"    \"coverage\": {\n" +
+			"      \"reference\": \"Coverage/123\"\n" +
+			"    }\n" +
+			"  },\n" +
+			"  \"relationship\": {\n" +
+			"    \"system\": \"http://hl7.org/fhir/relationship\",\n" +
+			"    \"code\": \"1\",\n" +
+			"    \"display\": \"self\"\n" +
+			"  }\n" +
+			"}";
 		//@formatter:on
 
 		ExplanationOfBenefit eob = ourCtx.newJsonParser().parseResource(ExplanationOfBenefit.class, input);
@@ -1301,14 +1337,14 @@ public class JsonParserDstu3Test {
 
 		// ID should be a String and communication should be an Array
 		String input = "{\"resourceType\": \"Patient\",\n" +
-				"  \"id\": 123,\n" +
-				"  \"communication\": {\n" +
-				"    \"language\": {\n" +
-				"      \"text\": \"Hindi\"\n" +
-				"    },\n" +
-				"    \"preferred\": true\n" +
-				"  }\n" +
-				"}";
+			"  \"id\": 123,\n" +
+			"  \"communication\": {\n" +
+			"    \"language\": {\n" +
+			"      \"text\": \"Hindi\"\n" +
+			"    },\n" +
+			"    \"preferred\": true\n" +
+			"  }\n" +
+			"}";
 
 		IParser p = ourCtx.newJsonParser();
 
@@ -1342,14 +1378,14 @@ public class JsonParserDstu3Test {
 
 		// ID should be a String and communication should be an Array
 		String input = "{\"resourceType\": \"Patient\",\n" +
-				"  \"id\": \"123\",\n" +
-				"  \"communication\": [{\n" +
-				"    \"language\": {\n" +
-				"      \"text\": \"Hindi\"\n" +
-				"    },\n" +
-				"    \"preferred\": true\n" +
-				"  }]\n" +
-				"}";
+			"  \"id\": \"123\",\n" +
+			"  \"communication\": [{\n" +
+			"    \"language\": {\n" +
+			"      \"text\": \"Hindi\"\n" +
+			"    },\n" +
+			"    \"preferred\": true\n" +
+			"  }]\n" +
+			"}";
 
 		IParser p = ourCtx.newJsonParser();
 
@@ -1470,14 +1506,14 @@ public class JsonParserDstu3Test {
 	@Ignore
 	public void testNamespacePreservationEncode() throws Exception {
 		//@formatter:off
-		String input = "" + 
-				"" + 
-				"" + 
-				"" + 
-				"@fhirabend" + 
-				"" + 
-				"" + 
-				"";
+		String input = "" +
+			"" +
+			"" +
+			"" +
+			"@fhirabend" +
+			"" +
+			"" +
+			"";
 		//@formatter:on
 		Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, input);
 
@@ -1679,69 +1715,69 @@ public class JsonParserDstu3Test {
 	@Test
 	public void testParseAndEncodeBundleWithUuidBase() {
 		//@formatter:off
-		String input = 
-				"{\n" + 
-				"    \"resourceType\":\"Bundle\",\n" + 
-				"    \"type\":\"document\",\n" + 
-				"    \"entry\":[\n" + 
-				"        {\n" + 
-				"            \"fullUrl\":\"urn:uuid:180f219f-97a8-486d-99d9-ed631fe4fc57\",\n" + 
-				"            \"resource\":{\n" + 
-				"                \"resourceType\":\"Composition\",\n" + 
-				"                \"id\":\"180f219f-97a8-486d-99d9-ed631fe4fc57\",\n" + 
-				"                \"meta\":{\n" + 
-				"                    \"lastUpdated\":\"2013-05-28T22:12:21Z\"\n" + 
-				"                },\n" + 
-				"                \"text\":{\n" + 
-				"                    \"status\":\"generated\",\n" + 
-				"                    \"div\":\"\"\n" + 
-				"                },\n" + 
-				"                \"date\":\"2013-02-01T12:30:02Z\",\n" + 
-				"                \"type\":{\n" + 
-				"                    \"coding\":[\n" + 
-				"                        {\n" + 
-				"                            \"system\":\"http://loinc.org\",\n" + 
-				"                            \"code\":\"28655-9\"\n" + 
-				"                        }\n" + 
-				"                    ],\n" + 
-				"                    \"text\":\"Discharge Summary from Responsible Clinician\"\n" + 
-				"                },\n" + 
-				"                \"status\":\"final\",\n" + 
-				"                \"confidentiality\":\"N\",\n" + 
-				"                \"subject\":{\n" + 
-				"                    \"reference\":\"http://fhir.healthintersections.com.au/open/Patient/d1\",\n" + 
-				"                    \"display\":\"Eve Everywoman\"\n" + 
-				"                },\n" + 
-				"                \"author\":[\n" + 
-				"                    {\n" + 
-				"                        \"reference\":\"Practitioner/example\",\n" + 
-				"                        \"display\":\"Doctor Dave\"\n" + 
-				"                    }\n" + 
-				"                ],\n" + 
-				"                \"encounter\":{\n" + 
-				"                    \"reference\":\"http://fhir.healthintersections.com.au/open/Encounter/doc-example\"\n" + 
-				"                },\n" + 
-				"                \"section\":[\n" + 
-				"                    {\n" + 
-				"                        \"title\":\"Reason for admission\",\n" + 
-				"                        \"content\":{\n" + 
-				"                            \"reference\":\"urn:uuid:d0dd51d3-3ab2-4c84-b697-a630c3e40e7a\"\n" + 
-				"                        }\n" + 
-				"                    },\n" + 
-				"                    {\n" + 
-				"                        \"title\":\"Medications on Discharge\",\n" + 
-				"                        \"content\":{\n" + 
-				"                            \"reference\":\"urn:uuid:673f8db5-0ffd-4395-9657-6da00420bbc1\"\n" + 
-				"                        }\n" + 
-				"                    },\n" + 
-				"                    {\n" + 
-				"                        \"title\":\"Known allergies\",\n" + 
-				"                        \"content\":{\n" + 
-				"                            \"reference\":\"urn:uuid:68f86194-e6e1-4f65-b64a-5314256f8d7b\"\n" + 
-				"                        }\n" + 
-				"                    }\n" + 
-				"                ]\n" + 
-				"            }\n" + 
+		String input =
+			"{\n" +
+				"    \"resourceType\":\"Bundle\",\n" +
+				"    \"type\":\"document\",\n" +
+				"    \"entry\":[\n" +
+				"        {\n" +
+				"            \"fullUrl\":\"urn:uuid:180f219f-97a8-486d-99d9-ed631fe4fc57\",\n" +
+				"            \"resource\":{\n" +
+				"                \"resourceType\":\"Composition\",\n" +
+				"                \"id\":\"180f219f-97a8-486d-99d9-ed631fe4fc57\",\n" +
+				"                \"meta\":{\n" +
+				"                    \"lastUpdated\":\"2013-05-28T22:12:21Z\"\n" +
+				"                },\n" +
+				"                \"text\":{\n" +
+				"                    \"status\":\"generated\",\n" +
+				"                    \"div\":\"

Generated Narrative with Details

id: 180f219f-97a8-486d-99d9-ed631fe4fc57

meta:

date: Feb 1, 2013 12:30:02 PM

type: Discharge Summary from Responsible Clinician (Details : {LOINC code '28655-9' = 'Physician attending Discharge summary)

status: final

confidentiality: N

author: Doctor Dave. Generated Summary: 23; Adam Careful

encounter: http://fhir.healthintersections.com.au/open/Encounter/doc-example

\"\n" + + " },\n" + + " \"date\":\"2013-02-01T12:30:02Z\",\n" + + " \"type\":{\n" + + " \"coding\":[\n" + + " {\n" + + " \"system\":\"http://loinc.org\",\n" + + " \"code\":\"28655-9\"\n" + + " }\n" + + " ],\n" + + " \"text\":\"Discharge Summary from Responsible Clinician\"\n" + + " },\n" + + " \"status\":\"final\",\n" + + " \"confidentiality\":\"N\",\n" + + " \"subject\":{\n" + + " \"reference\":\"http://fhir.healthintersections.com.au/open/Patient/d1\",\n" + + " \"display\":\"Eve Everywoman\"\n" + + " },\n" + + " \"author\":[\n" + + " {\n" + + " \"reference\":\"Practitioner/example\",\n" + + " \"display\":\"Doctor Dave\"\n" + + " }\n" + + " ],\n" + + " \"encounter\":{\n" + + " \"reference\":\"http://fhir.healthintersections.com.au/open/Encounter/doc-example\"\n" + + " },\n" + + " \"section\":[\n" + + " {\n" + + " \"title\":\"Reason for admission\",\n" + + " \"content\":{\n" + + " \"reference\":\"urn:uuid:d0dd51d3-3ab2-4c84-b697-a630c3e40e7a\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"title\":\"Medications on Discharge\",\n" + + " \"content\":{\n" + + " \"reference\":\"urn:uuid:673f8db5-0ffd-4395-9657-6da00420bbc1\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"title\":\"Known allergies\",\n" + + " \"content\":{\n" + + " \"reference\":\"urn:uuid:68f86194-e6e1-4f65-b64a-5314256f8d7b\"\n" + + " }\n" + + " }\n" + + " ]\n" + + " }\n" + " }" + " ]" + "}"; @@ -1761,34 +1797,34 @@ public class JsonParserDstu3Test { @Test public void testParseAndEncodeComments() { //@formatter:off - String input = "{\n" + - " \"resourceType\": \"Patient\",\n" + - " \"id\": \"pat1\",\n" + - " \"text\": {\n" + - " \"status\": \"generated\",\n" + - " \"div\": \"
\\n \\n

Patient Donald DUCK @ Acme Healthcare, Inc. MR = 654321

\\n \\n
\"\n" + - " },\n" + - " \"identifier\": [\n" + - " {\n" + - " \"fhir_comments\":[\"identifier comment 1\",\"identifier comment 2\"],\n" + - " \"use\": \"usual\",\n" + - " \"_use\": {\n" + - " \"fhir_comments\":[\"use comment 1\",\"use comment 2\"]\n" + - " },\n" + - " \"type\": {\n" + - " \"coding\": [\n" + - " {\n" + - " \"system\": \"http://hl7.org/fhir/v2/0203\",\n" + - " \"code\": \"MR\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"system\": \"urn:oid:0.1.2.3.4.5.6.7\",\n" + - " \"value\": \"654321\"\n" + - " }\n" + - " ],\n" + - " \"active\": true" + - "}"; + String input = "{\n" + + " \"resourceType\": \"Patient\",\n" + + " \"id\": \"pat1\",\n" + + " \"text\": {\n" + + " \"status\": \"generated\",\n" + + " \"div\": \"
\\n \\n

Patient Donald DUCK @ Acme Healthcare, Inc. MR = 654321

\\n \\n
\"\n" + + " },\n" + + " \"identifier\": [\n" + + " {\n" + + " \"fhir_comments\":[\"identifier comment 1\",\"identifier comment 2\"],\n" + + " \"use\": \"usual\",\n" + + " \"_use\": {\n" + + " \"fhir_comments\":[\"use comment 1\",\"use comment 2\"]\n" + + " },\n" + + " \"type\": {\n" + + " \"coding\": [\n" + + " {\n" + + " \"system\": \"http://hl7.org/fhir/v2/0203\",\n" + + " \"code\": \"MR\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"system\": \"urn:oid:0.1.2.3.4.5.6.7\",\n" + + " \"value\": \"654321\"\n" + + " }\n" + + " ],\n" + + " \"active\": true" + + "}"; //@formatter:off Patient res = ourCtx.newJsonParser().parseResource(Patient.class, input); @@ -1796,33 +1832,33 @@ public class JsonParserDstu3Test { assertEquals("Patient/pat1", res.getId()); assertEquals("654321", res.getIdentifier().get(0).getValue()); assertEquals(true, res.getActive()); - + assertThat(res.getIdentifier().get(0).getFormatCommentsPre(), contains("identifier comment 1", "identifier comment 2")); assertThat(res.getIdentifier().get(0).getUseElement().getFormatCommentsPre(), contains("use comment 1", "use comment 2")); - + String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(res); ourLog.info(encoded); - + //@formatter:off assertThat(encoded, stringContainsInOrder( - "\"identifier\": [", - "{", - "\"fhir_comments\":", - "[", - "\"identifier comment 1\"", - ",", - "\"identifier comment 2\"", - "]", - "\"use\": \"usual\",", - "\"_use\": {", - "\"fhir_comments\":", - "[", - "\"use comment 1\"", - ",", - "\"use comment 2\"", - "]", - "},", - "\"type\"" + "\"identifier\": [", + "{", + "\"fhir_comments\":", + "[", + "\"identifier comment 1\"", + ",", + "\"identifier comment 2\"", + "]", + "\"use\": \"usual\",", + "\"_use\": {", + "\"fhir_comments\":", + "[", + "\"use comment 1\"", + ",", + "\"use comment 2\"", + "]", + "},", + "\"type\"" )); //@formatter:off } @@ -1832,11 +1868,11 @@ public class JsonParserDstu3Test { Binary patient = new Binary(); patient.setId(new IdType("http://base/Binary/11/_history/22")); patient.setContentType("foo"); - patient.setContent(new byte[] { 1, 2, 3, 4 }); + patient.setContent(new byte[]{1, 2, 3, 4}); String val = ourCtx.newJsonParser().encodeResourceToString(patient); - String expected = "{\"resourceType\":\"Binary\",\"id\":\"11\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}"; + String expected = "{\"resourceType\":\"Binary\",\"id\":\"11\",\"meta\":{\"versionId\":\"22\"},\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}"; ourLog.info("Expected: {}", expected); ourLog.info("Actual : {}", val); assertEquals(expected, val); @@ -1883,7 +1919,7 @@ public class JsonParserDstu3Test { "\"resourceType\":\"Patient\",", "\"id\":\"1\"", "\"reference\":\"#1\"" - )); + )); //@formatter:on o = parser.parseResource(Observation.class, enc); @@ -1894,6 +1930,21 @@ public class JsonParserDstu3Test { assertEquals("patient family", p.getName().get(0).getFamilyElement().getValue()); } + /** + * See #720 + */ + @Test + public void testParseCustomResourceType() { + String input = "{\"resourceType\":\"Bug720ResourceType\",\"meta\":{\"profile\":[\"http://example.com/StructureDefinition/dontuse#Bug720ResourceType\"]},\"supportedVersion\":\"2.5.x\",\"templatesConsentTemplate\":[{\"domainName\":\"name\",\"Name\":\"template_01\",\"version\":\"1.0\",\"title\":\"title\",\"comment\":\"comment\",\"contact\":{\"resourceType\":\"Person\",\"name\":[{\"family\":\"Mustermann\",\"given\":[\"Max\"]}],\"telecom\":[{\"system\":\"email\",\"value\":\"max.mustermann@mail.de\"},{\"system\":\"phone\",\"value\":\"+49 1234 23232\"}],\"address\":[{\"text\":\"street 1-2\",\"city\":\"city\",\"postalCode\":\"12345\",\"country\":\"Germany\"}]}}]}"; + Bug720ResourceType parsed = ourCtx.newJsonParser().parseResource(Bug720ResourceType.class, input); + + assertEquals(1, parsed.getTemplates().size()); + assertEquals(Bug720Datatype.class, parsed.getTemplates().get(0).getClass()); + assertEquals("Mustermann", ((Bug720Datatype) parsed.getTemplates().get(0)).getContact().getNameFirstRep().getFamily()); + + ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(parsed)); + } + /** * #480 */ @@ -1954,10 +2005,10 @@ public class JsonParserDstu3Test { @Test public void testParseJsonExtensionWithoutUrl() { //@formatter:off - String input = + String input = "{\"resourceType\":\"Patient\"," + - "\"extension\":[ {\"valueDateTime\":\"2011-01-02T11:13:15\"} ]" + - "}"; + "\"extension\":[ {\"valueDateTime\":\"2011-01-02T11:13:15\"} ]" + + "}"; //@formatter:on IParser parser = ourCtx.newJsonParser(); @@ -1984,10 +2035,10 @@ public class JsonParserDstu3Test { @Test public void testParseJsonModifierExtensionWithoutUrl() { //@formatter:off - String input = + String input = "{\"resourceType\":\"Patient\"," + - "\"modifierExtension\":[ {\"valueDateTime\":\"2011-01-02T11:13:15\"} ]" + - "}"; + "\"modifierExtension\":[ {\"valueDateTime\":\"2011-01-02T11:13:15\"} ]" + + "}"; //@formatter:on IParser parser = ourCtx.newJsonParser(); @@ -2011,24 +2062,24 @@ public class JsonParserDstu3Test { @Test public void testParseMetadata() throws Exception { //@formatter:off - String bundle = "{\n" + - " \"resourceType\" : \"Bundle\",\n" + - " \"total\" : 1,\n" + - " \"link\": [{\n" + - " \"relation\" : \"self\",\n" + - " \"url\" : \"http://localhost:52788/Binary?_pretty=true\"\n" + - " }],\n" + - " \"entry\" : [{\n" + + String bundle = "{\n" + + " \"resourceType\" : \"Bundle\",\n" + + " \"total\" : 1,\n" + + " \"link\": [{\n" + + " \"relation\" : \"self\",\n" + + " \"url\" : \"http://localhost:52788/Binary?_pretty=true\"\n" + + " }],\n" + + " \"entry\" : [{\n" + " \"fullUrl\" : \"http://foo/fhirBase2/Patient/1/_history/2\",\n" + - " \"resource\" : {\n" + - " \"resourceType\" : \"Patient\",\n" + - " \"id\" : \"1\",\n" + + " \"resource\" : {\n" + + " \"resourceType\" : \"Patient\",\n" + + " \"id\" : \"1\",\n" + " \"meta\" : {\n" + " \"versionId\" : \"2\",\n" + " \"lastUpdated\" : \"2001-02-22T11:22:33-05:00\"\n" + - " },\n" + - " \"birthDate\" : \"2012-01-02\"\n" + - " },\n" + + " },\n" + + " \"birthDate\" : \"2012-01-02\"\n" + + " },\n" + " \"search\" : {\n" + " \"mode\" : \"match\",\n" + " \"score\" : 0.123\n" + @@ -2037,7 +2088,7 @@ public class JsonParserDstu3Test { " \"method\" : \"POST\",\n" + " \"url\" : \"http://foo/Patient?identifier=value\"\n" + " }\n" + - " }]\n" + + " }]\n" + "}"; //@formatter:on @@ -2149,6 +2200,43 @@ public class JsonParserDstu3Test { } } + @Test + public void testParseWithPrecision() { + String input = "{\"resourceType\":\"Observation\",\"valueQuantity\":{\"value\":0.000000000000000100}}"; + Observation obs = ourCtx.newJsonParser().parseResource(Observation.class, input); + + DecimalType valueElement = ((Quantity) obs.getValue()).getValueElement(); + assertEquals("0.000000000000000100", valueElement.getValueAsString()); + + String str = ourCtx.newJsonParser().encodeResourceToString(obs); + ourLog.info(str); + assertEquals("{\"resourceType\":\"Observation\",\"valueQuantity\":{\"value\":0.000000000000000100}}", str); + } + + @Test(expected = DataFormatException.class) + public void testParseWithTrailingContent() throws Exception { + //@formatter:off + String bundle = "{\n" + + " \"resourceType\" : \"Bundle\",\n" + + " \"total\" : 1\n" + + "}}"; + //@formatter:on + + Bundle b = ourCtx.newJsonParser().parseResource(Bundle.class, bundle); + } + + @Test + @Ignore + public void testParseWithWrongTypeObjectShouldBeArray() throws Exception { + String input = IOUtils.toString(getClass().getResourceAsStream("/invalid_metadata.json")); + try { + ourCtx.newJsonParser().parseResource(CapabilityStatement.class, input); + fail(); + } catch (DataFormatException e) { + assertEquals("Syntax error parsing JSON FHIR structure: Expected ARRAY at element 'modifierExtension', found 'OBJECT'", e.getMessage()); + } + } + /** * See #344 */ @@ -2182,43 +2270,6 @@ public class JsonParserDstu3Test { } } - @Test - public void testParseWithPrecision() { - String input = "{\"resourceType\":\"Observation\",\"valueQuantity\":{\"value\":0.000000000000000100}}"; - Observation obs = ourCtx.newJsonParser().parseResource(Observation.class, input); - - DecimalType valueElement = ((Quantity) obs.getValue()).getValueElement(); - assertEquals("0.000000000000000100", valueElement.getValueAsString()); - - String str = ourCtx.newJsonParser().encodeResourceToString(obs); - ourLog.info(str); - assertEquals("{\"resourceType\":\"Observation\",\"valueQuantity\":{\"value\":0.000000000000000100}}", str); - } - - @Test(expected = DataFormatException.class) - public void testParseWithTrailingContent() throws Exception { - //@formatter:off - String bundle = "{\n" + - " \"resourceType\" : \"Bundle\",\n" + - " \"total\" : 1\n" + - "}}"; - //@formatter:on - - Bundle b = ourCtx.newJsonParser().parseResource(Bundle.class, bundle); - } - - @Test - @Ignore - public void testParseWithWrongTypeObjectShouldBeArray() throws Exception { - String input = IOUtils.toString(getClass().getResourceAsStream("/invalid_metadata.json")); - try { - ourCtx.newJsonParser().parseResource(CapabilityStatement.class, input); - fail(); - } catch (DataFormatException e) { - assertEquals("Syntax error parsing JSON FHIR structure: Expected ARRAY at element 'modifierExtension', found 'OBJECT'", e.getMessage()); - } - } - /** * See #144 and #146 */ @@ -2290,13 +2341,13 @@ public class JsonParserDstu3Test { ArgumentCaptor expectedScalar = ArgumentCaptor.forClass(ScalarType.class); ArgumentCaptor actualScalar = ArgumentCaptor.forClass(ScalarType.class); verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.any(IParseLocation.class), elementName.capture(), expected.capture(), expectedScalar.capture(), actual.capture(), - actualScalar.capture()); + actualScalar.capture()); verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.any(IParseLocation.class), Mockito.eq("_id"), Mockito.eq(ValueType.OBJECT), expectedScalar.capture(), Mockito.eq(ValueType.SCALAR), - actualScalar.capture()); + actualScalar.capture()); verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.any(IParseLocation.class), Mockito.eq("__v"), Mockito.eq(ValueType.OBJECT), expectedScalar.capture(), Mockito.eq(ValueType.SCALAR), - actualScalar.capture()); + actualScalar.capture()); verify(errorHandler, atLeastOnce()).incorrectJsonType(Mockito.any(IParseLocation.class), Mockito.eq("_status"), Mockito.eq(ValueType.OBJECT), expectedScalar.capture(), - Mockito.eq(ValueType.SCALAR), actualScalar.capture()); + Mockito.eq(ValueType.SCALAR), actualScalar.capture()); assertEquals("_id", elementName.getAllValues().get(0)); assertEquals(ValueType.OBJECT, expected.getAllValues().get(0)); @@ -2328,26 +2379,6 @@ public class JsonParserDstu3Test { assertTrue(result.isSuccessful()); } - @Test - public void testBaseUrlFooResourceCorrectlySerializedInExtensionValueReference() { - String refVal = "http://my.org/FooBar"; - - Patient fhirPat = new Patient(); - fhirPat.addExtension().setUrl("x1").setValue(new Reference(refVal)); - - IParser parser = ourCtx.newJsonParser(); - - String output = parser.encodeResourceToString(fhirPat); - System.out.println("output: " + output); - - // Deserialize then check that valueReference value is still correct - fhirPat = parser.parseResource(Patient.class, output); - - List extlst = fhirPat.getExtensionsByUrl("x1"); - Assert.assertEquals(1, extlst.size()); - Assert.assertEquals(refVal, ((Reference) extlst.get(0).getValue()).getReference()); - } - @AfterClass public static void afterClassClearContext() { TestUtil.clearAllStaticFieldsForUnitTest(); diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java index 4c63567c71f..8cd9f644d03 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java @@ -1,41 +1,26 @@ package ca.uhn.fhir.parser; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.startsWith; -import static org.hamcrest.Matchers.stringContainsInOrder; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.io.IOException; -import java.io.StringReader; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.*; - +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.ResourceDef; +import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; +import ca.uhn.fhir.parser.FooMessageHeaderWithExplicitField.FooMessageSourceComponent; +import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation; +import ca.uhn.fhir.parser.PatientWithCustomCompositeExtension.FooParentExtension; +import ca.uhn.fhir.util.TestUtil; +import com.google.common.collect.Sets; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.hamcrest.collection.IsEmptyCollection; import org.hamcrest.core.StringContains; import org.hamcrest.text.StringContainsInOrder; -import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.dstu3.model.Address.AddressUse; import org.hl7.fhir.dstu3.model.Address.AddressUseEnumFactory; -import org.hl7.fhir.dstu3.model.Bundle.*; +import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent; +import org.hl7.fhir.dstu3.model.Bundle.BundleType; import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem; import org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus; import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent; @@ -52,27 +37,27 @@ import org.junit.*; import org.mockito.ArgumentCaptor; import org.xmlunit.builder.DiffBuilder; import org.xmlunit.builder.Input; -import org.xmlunit.diff.*; +import org.xmlunit.diff.ComparisonControllers; +import org.xmlunit.diff.DefaultNodeMatcher; +import org.xmlunit.diff.Diff; +import org.xmlunit.diff.ElementSelectors; -import com.google.common.collect.Sets; +import java.io.IOException; +import java.io.StringReader; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.*; -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.api.annotation.Child; -import ca.uhn.fhir.model.api.annotation.ResourceDef; -import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; -import ca.uhn.fhir.parser.FooMessageHeaderWithExplicitField.FooMessageSourceComponent; -import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation; -import ca.uhn.fhir.parser.PatientWithCustomCompositeExtension.FooParentExtension; -import ca.uhn.fhir.rest.client.api.IGenericClient; -import ca.uhn.fhir.util.TestUtil; -import ca.uhn.fhir.validation.IValidationContext; -import ca.uhn.fhir.validation.SingleValidationMessage; -import ca.uhn.fhir.validation.ValidationContext; -import ca.uhn.fhir.validation.ValidationResult; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.startsWith; +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.*; public class XmlParserDstu3Test { - private static FhirContext ourCtx = FhirContext.forDstu3(); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParserDstu3Test.class); + private static FhirContext ourCtx = FhirContext.forDstu3(); @After public void after() { @@ -82,6 +67,26 @@ public class XmlParserDstu3Test { ourCtx.setNarrativeGenerator(null); } + @Test + public void testBaseUrlFooResourceCorrectlySerializedInExtensionValueReference() { + String refVal = "http://my.org/FooBar"; + + Patient fhirPat = new Patient(); + fhirPat.addExtension().setUrl("x1").setValue(new Reference(refVal)); + + IParser parser = ourCtx.newXmlParser(); + + String output = parser.encodeResourceToString(fhirPat); + System.out.println("output: " + output); + + // Deserialize then check that valueReference value is still correct + fhirPat = parser.parseResource(Patient.class, output); + + List extlst = fhirPat.getExtensionsByUrl("x1"); + Assert.assertEquals(1, extlst.size()); + Assert.assertEquals(refVal, ((Reference) extlst.get(0).getValue()).getReference()); + } + /** * See #544 */ @@ -114,29 +119,29 @@ public class XmlParserDstu3Test { public void testBundleWithBinary() { String bundle = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; Bundle b = ourCtx.newXmlParser().parseResource(Bundle.class, bundle); assertEquals(1, b.getEntry().size()); Binary bin = (Binary) b.getEntry().get(0).getResource(); - assertArrayEquals(new byte[] { 1, 2, 3, 4 }, bin.getContent()); + assertArrayEquals(new byte[]{1, 2, 3, 4}, bin.getContent()); } @@ -281,10 +286,10 @@ public class XmlParserDstu3Test { ourLog.info(encoded); assertThat(encoded, stringContainsInOrder( - "", - "", - "", - "")); + "", + "", + "", + "")); bundle = ourCtx.newXmlParser().parseResource(Bundle.class, encoded); pt = (Patient) bundle.getEntry().get(0).getResource(); @@ -401,24 +406,24 @@ public class XmlParserDstu3Test { ourLog.info(output); assertThat(output, stringContainsInOrder( - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); /* * Now PARSE! @@ -452,18 +457,18 @@ public class XmlParserDstu3Test { ourLog.info(output); assertThat(output, stringContainsInOrder( - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); /* * Now PARSE! @@ -566,10 +571,10 @@ public class XmlParserDstu3Test { assertThat(enc, containsString("")); assertThat(enc, containsString("")); assertThat(enc, containsString( - "")); + "")); assertThat(enc, containsString("")); assertThat(enc, containsString( - "")); + "")); /* * Now parse this back @@ -623,15 +628,15 @@ public class XmlParserDstu3Test { ourLog.info(out); assertThat(out, stringContainsInOrder("", - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "")); patient = ourCtx.newXmlParser().parseResource(Patient.class, out); assertEquals("http://hl7.org/fhir/v2/0203", patient.getIdentifier().get(0).getType().getCoding().get(0).getSystem()); @@ -671,26 +676,26 @@ public class XmlParserDstu3Test { ourLog.info(enc); assertThat(enc, stringContainsInOrder("", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, enc); List gotLabels = parsed.getMeta().getProfile(); @@ -731,24 +736,24 @@ public class XmlParserDstu3Test { ourLog.info(enc); assertThat(enc, stringContainsInOrder("", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, enc); assertThat(parsed.getMeta().getProfile(), empty()); @@ -862,24 +867,24 @@ public class XmlParserDstu3Test { ourLog.info(enc); assertThat(enc, stringContainsInOrder("", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, enc); List gotLabels = parsed.getMeta().getSecurity(); @@ -952,7 +957,7 @@ public class XmlParserDstu3Test { @Test public void testEncodeBinaryWithNoContentType() { Binary b = new Binary(); - b.setContent(new byte[] { 1, 2, 3, 4 }); + b.setContent(new byte[]{1, 2, 3, 4}); String output = ourCtx.newXmlParser().encodeResourceToString(b); ourLog.info(output); @@ -960,6 +965,22 @@ public class XmlParserDstu3Test { assertEquals("", output); } + @Test + public void testEncodeBinaryWithSecurityContext() { + Binary bin = new Binary(); + bin.setContentType("text/plain"); + bin.setContent("Now is the time".getBytes()); + Reference securityContext = new Reference(); + securityContext.setReference("DiagnosticReport/1"); + bin.setSecurityContext(securityContext); + String encoded = ourCtx.newXmlParser().encodeResourceToString(bin); + ourLog.info(encoded); + assertThat(encoded, containsString("Binary")); + assertThat(encoded, containsString("")); + assertThat(encoded, containsString("")); + assertThat(encoded, containsString("")); + } + @Test public void testEncodeBundleWithContained() { DiagnosticReport rpt = new DiagnosticReport(); @@ -1020,19 +1041,19 @@ public class XmlParserDstu3Test { ourLog.info(encoded); assertThat(encoded, stringContainsInOrder( - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); } @@ -1064,9 +1085,9 @@ public class XmlParserDstu3Test { // @formatter:on assertThat(encoded, - stringContainsInOrder("", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "")); + stringContainsInOrder("", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "")); } @@ -1097,9 +1118,9 @@ public class XmlParserDstu3Test { ourLog.info(encoded); assertThat(encoded, - stringContainsInOrder("", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "")); + stringContainsInOrder("", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "")); } @@ -1130,9 +1151,9 @@ public class XmlParserDstu3Test { ourLog.info(encoded); assertThat(encoded, - stringContainsInOrder("", "", "", "", "", "", - "", "", "", "", "", "", "", "", - "", "", "")); + stringContainsInOrder("", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "")); } @@ -1183,9 +1204,9 @@ public class XmlParserDstu3Test { GuidanceResponse.GuidanceResponseStatus status = GuidanceResponse.GuidanceResponseStatus.SUCCESS; GuidanceResponse gr = new GuidanceResponse() - .setRequestId("123") - .setModule(new Reference("Evaluate Operation")) - .setStatus(status); + .setRequestId("123") + .setModule(new Reference("Evaluate Operation")) + .setStatus(status); gr.setReason(new Reference(pr)); gr.getContained().add(p); @@ -1233,9 +1254,9 @@ public class XmlParserDstu3Test { ourLog.info(output); assertThat(output, stringContainsInOrder( - "A P TAG

", - "

line1\nline2\nline3  BOLD
")); + "A P TAG

", + "

line1\nline2\nline3  BOLD
")); } @@ -1249,9 +1270,9 @@ public class XmlParserDstu3Test { ourLog.info(output); assertThat(output, stringContainsInOrder( - " ", - " line1\nline2\nline3 BOLD
")); + " ", + " line1\nline2\nline3 BOLD
")); } @@ -1310,9 +1331,9 @@ public class XmlParserDstu3Test { Patient p = new Patient(); p.setId("Patient/B"); p - .addExtension() - .setUrl("http://foo") - .setValue(new Reference("Practitioner/A")); + .addExtension() + .setUrl("http://foo") + .setValue(new Reference("Practitioner/A")); IParser parser = ourCtx.newXmlParser().setPrettyPrint(true); parser.setDontEncodeElements(new HashSet(Arrays.asList("*.id", "*.meta"))); @@ -1339,14 +1360,14 @@ public class XmlParserDstu3Test { ourLog.info(output); assertThat(output, stringContainsInOrder( - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "")); assertThat(output, not(stringContainsInOrder( - ""))); + ""))); obs = parser.parseResource(Observation.class, output); assertEquals(1, obs.getExtension().size()); @@ -1373,15 +1394,15 @@ public class XmlParserDstu3Test { ourLog.info(output); assertThat(output, stringContainsInOrder( - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "")); assertThat(output, not(stringContainsInOrder( - ""))); + ""))); obs = parser.parseResource(Observation.class, output); assertEquals(1, obs.getExtension().size()); @@ -1410,22 +1431,22 @@ public class XmlParserDstu3Test { ourLog.info(encoded); assertThat(encoded, stringContainsInOrder( - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); } @@ -1497,7 +1518,7 @@ public class XmlParserDstu3Test { assertThat(encoded, containsString("", "", - "", "")); + "", "")); assertThat(encoded, not(containsString("text"))); assertThat(encoded, not(containsString("THE DIV"))); assertThat(encoded, containsString("family")); @@ -1644,7 +1665,7 @@ public class XmlParserDstu3Test { assertThat(encoded, containsString("", "", - "", "")); + "", "")); assertThat(encoded, not(containsString("THE DIV"))); assertThat(encoded, containsString("family")); assertThat(encoded, not(containsString("maritalStatus"))); @@ -1666,7 +1687,7 @@ public class XmlParserDstu3Test { assertThat(encoded, containsString("", "", "", "")); assertThat(encoded, stringContainsInOrder("", "", - "", "")); + "", "")); assertThat(encoded, not(containsString("THE DIV"))); assertThat(encoded, containsString("family")); assertThat(encoded, not(containsString("maritalStatus"))); @@ -1747,29 +1768,29 @@ public class XmlParserDstu3Test { ourLog.info(encoded); assertThat(encoded, stringContainsInOrder( - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); assertThat(encoded, not(containsString("#1002"))); } @@ -1855,7 +1876,7 @@ public class XmlParserDstu3Test { { IParser p = ourCtx.newXmlParser(); - p.setEncodeElements(new HashSet(Arrays.asList("Patient.name", "Bundle.entry"))); + p.setEncodeElements(new HashSet<>(Arrays.asList("Patient.name", "Bundle.entry"))); p.setPrettyPrint(true); String out = p.encodeResourceToString(bundle); ourLog.info(out); @@ -1891,6 +1912,31 @@ public class XmlParserDstu3Test { } + @Test + public void testEncodeWithEncodeElementsAppliesToChildResourcesOnly() throws Exception { + Patient patient = new Patient(); + patient.getMeta().addProfile("http://profile"); + patient.addName().setFamily("FAMILY"); + patient.addAddress().addLine("LINE1"); + + Bundle bundle = new Bundle(); + bundle.setTotal(100); + bundle.addEntry().setResource(patient); + + { + IParser p = ourCtx.newXmlParser(); + p.setEncodeElements(new HashSet<>(Arrays.asList("Patient.name"))); + p.setEncodeElementsAppliesToChildResourcesOnly(true); + p.setPrettyPrint(true); + String out = p.encodeResourceToString(bundle); + ourLog.info(out); + assertThat(out, containsString("total")); + assertThat(out, containsString("Patient")); + assertThat(out, containsString("name")); + assertThat(out, not(containsString("address"))); + } + } + @Test public void testEncodeWithNarrative() { Patient p = new Patient(); @@ -1969,10 +2015,10 @@ public class XmlParserDstu3Test { String enc = ourCtx.newXmlParser().encodeResourceToString(patient); assertThat(enc, containsString("")); assertThat(enc, containsString( - "")); + "")); assertThat(enc, containsString("")); assertThat(enc, containsString( - "")); + "")); } @Test @@ -2102,34 +2148,34 @@ public class XmlParserDstu3Test { @Test public void testParseAndEncodeComments() { String input = "\n" + - " " + - " \n" + - " \n" + - " \n" + - "
\n" + - "\n" + - "

Patient Donald DUCK @ Acme Healthcare, Inc. MR = 654321

\n" + - "\n" + - "
\n" + - "
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " " + - " " + - "
"; + " " + + " \n" + + " \n" + + " \n" + + "
\n" + + "\n" + + "

Patient Donald DUCK @ Acme Healthcare, Inc. MR = 654321

\n" + + "\n" + + "
\n" + + "
\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " " + + " " + + "
"; Patient res = ourCtx.newXmlParser().parseResource(Patient.class, input); res.getFormatCommentsPre(); @@ -2146,54 +2192,54 @@ public class XmlParserDstu3Test { ourLog.info(encoded); assertThat(encoded, stringContainsInOrder( - "\"identifier\": [", - "{", - "\"fhir_comments\":", - "[", - "\"identifier comment 1\"", - ",", - "\"identifier comment 2\"", - "]", - "\"use\": \"usual\",", - "\"_use\": {", - "\"fhir_comments\":", - "[", - "\"use comment 1\"", - ",", - "\"use comment 2\"", - "]", - "},", - "\"type\"")); + "\"identifier\": [", + "{", + "\"fhir_comments\":", + "[", + "\"identifier comment 1\"", + ",", + "\"identifier comment 2\"", + "]", + "\"use\": \"usual\",", + "\"_use\": {", + "\"fhir_comments\":", + "[", + "\"use comment 1\"", + ",", + "\"use comment 2\"", + "]", + "},", + "\"type\"")); encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(res); ourLog.info(encoded); assertThat(encoded, stringContainsInOrder( - "", - "", - "", - "", - "
", - "

Patient Donald DUCK @ Acme Healthcare, Inc. MR = 654321

", - "
", - "
", - " \n", - " ", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "
")); + "", + "", + "", + "", + "
", + "

Patient Donald DUCK @ Acme Healthcare, Inc. MR = 654321

", + "
", + "
", + " \n", + " ", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "
")); } @@ -2201,84 +2247,84 @@ public class XmlParserDstu3Test { public void testParseAndEncodeCommentsOnExtensions() { String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; Patient pat = ourCtx.newXmlParser().parseResource(Patient.class, input); String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(pat); ourLog.info(output); assertThat(output, stringContainsInOrder( - "", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - " ", - "")); + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "")); output = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(pat); ourLog.info(output); assertThat(output, stringContainsInOrder( - "{", - " \"resourceType\": \"Patient\",", - " \"id\": \"someid\",", - " \"_id\": {", - " \"fhir_comments\": [", - " \" comment 1 \"", - " ]", - " },", - " \"extension\": [", - " {", - " \"fhir_comments\": [", - " \" comment 2 \",", - " \" comment 7 \"", - " ],", - " \"url\": \"urn:patientext:att\",", - " \"valueAttachment\": {", - " \"fhir_comments\": [", - " \" comment 3 \",", - " \" comment 6 \"", - " ],", - " \"contentType\": \"aaaa\",", - " \"_contentType\": {", - " \"fhir_comments\": [", - " \" comment 4 \"", - " ]", - " },", - " \"data\": \"AAAA\",", - " \"_data\": {", - " \"fhir_comments\": [", - " \" comment 5 \"", - " ]", - " }", - " }", - " }", - " ]", - "}")); + "{", + " \"resourceType\": \"Patient\",", + " \"id\": \"someid\",", + " \"_id\": {", + " \"fhir_comments\": [", + " \" comment 1 \"", + " ]", + " },", + " \"extension\": [", + " {", + " \"fhir_comments\": [", + " \" comment 2 \",", + " \" comment 7 \"", + " ],", + " \"url\": \"urn:patientext:att\",", + " \"valueAttachment\": {", + " \"fhir_comments\": [", + " \" comment 3 \",", + " \" comment 6 \"", + " ],", + " \"contentType\": \"aaaa\",", + " \"_contentType\": {", + " \"fhir_comments\": [", + " \" comment 4 \"", + " ]", + " },", + " \"data\": \"AAAA\",", + " \"_data\": {", + " \"fhir_comments\": [", + " \" comment 5 \"", + " ]", + " }", + " }", + " }", + " ]", + "}")); } @@ -2286,203 +2332,203 @@ public class XmlParserDstu3Test { public void testParseAndEncodeExtensionOnReference() { String input = "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - ""; + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; DataElement de = ourCtx.newXmlParser().parseResource(DataElement.class, input); String output = ourCtx.newXmlParser().encodeResourceToString(de).replace(" xmlns=\"http://hl7.org/fhir\"", ""); @@ -2517,14 +2563,14 @@ public class XmlParserDstu3Test { public void testParseAndEncodeNestedExtensions() { String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; Patient p = ourCtx.newXmlParser().parseResource(Patient.class, input); DateType bd = p.getBirthDateElement(); @@ -2544,15 +2590,15 @@ public class XmlParserDstu3Test { ourLog.info(encoded); assertThat(encoded, stringContainsInOrder( - "", - "", - "", - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "", + "", + "", + "")); } @@ -2560,16 +2606,16 @@ public class XmlParserDstu3Test { public void testParseBundleNewWithPlaceholderIds() { String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n"; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n"; Bundle parsed = ourCtx.newXmlParser().parseResource(Bundle.class, input); assertEquals("urn:oid:0.1.2.3", parsed.getEntry().get(0).getResource().getIdElement().getValue()); @@ -2580,16 +2626,16 @@ public class XmlParserDstu3Test { public void testParseBundleNewWithPlaceholderIdsInBase1() { String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n"; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n"; Bundle parsed = ourCtx.newXmlParser().parseResource(Bundle.class, input); assertEquals("urn:oid:0.1.2.3", parsed.getEntry().get(0).getResource().getIdElement().getValue()); @@ -2599,31 +2645,31 @@ public class XmlParserDstu3Test { public void testParseBundleNewWithPlaceholderIdsInBase2() { String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n"; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n"; Bundle parsed = ourCtx.newXmlParser().parseResource(Bundle.class, input); assertEquals("urn:uuid:0.1.2.3", parsed.getEntry().get(0).getResource().getIdElement().getValue()); input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n"; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n"; parsed = ourCtx.newXmlParser().parseResource(Bundle.class, input); assertEquals("urn:uuid:0.1.2.3", parsed.getEntry().get(0).getResource().getIdElement().getValue()); @@ -2634,29 +2680,29 @@ public class XmlParserDstu3Test { public void testParseBundleOldStyleWithUnknownLinks() throws Exception { String bundle = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; Bundle b = (Bundle) ourCtx.newXmlParser().parseResource(bundle); assertEquals(1, b.getEntry().size()); @@ -2667,16 +2713,16 @@ public class XmlParserDstu3Test { public void testParseBundleOldWithPlaceholderIds() { String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "\n"; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "\n"; Bundle parsed = (Bundle) ourCtx.newXmlParser().parseResource(input); assertEquals("urn:oid:0.1.2.3", parsed.getEntry().get(0).getResource().getId()); @@ -2710,10 +2756,10 @@ public class XmlParserDstu3Test { public void testParseBundleWithResourceId() { String input = "" - + "" - + "" - + "" - + "\n"; + + "" + + "" + + "" + + "\n"; Bundle bundle = ourCtx.newXmlParser().parseResource(Bundle.class, input); assertEquals("http://localhost:58402/fhir/context/Patient/1/_history/3", bundle.getEntry().get(0).getResource().getIdElement().getValue()); @@ -2742,12 +2788,12 @@ public class XmlParserDstu3Test { ourLog.info(enc); assertThat(enc, stringContainsInOrder( - "", - "", - "", - "", - "", - "")); + "", + "", + "", + "", + "", + "")); o = parser.parseResource(Observation.class, enc); assertEquals("obs text", o.getCode().getText()); @@ -2762,7 +2808,7 @@ public class XmlParserDstu3Test { */ @Test public void testParseContainedBinaryResource() { - byte[] bin = new byte[] { 0, 1, 2, 3, 4 }; + byte[] bin = new byte[]{0, 1, 2, 3, 4}; final Binary binary = new Binary(); binary.setContentType("PatientConsent").setContent(bin); @@ -2784,7 +2830,7 @@ public class XmlParserDstu3Test { /* * If this fails, it's possibe the DocumentManifest structure is wrong: It should be - * + * * @Child(name = "p", type = {Attachment.class, ValueSet.class}, order=1, min=1, max=1, modifier=false, summary=true) */ assertNotNull(((Reference) actual.getContent().get(0).getP()).getResource()); @@ -2797,15 +2843,15 @@ public class XmlParserDstu3Test { public void testParseExtensionWithIdType() { String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; Patient pt = ourCtx.newXmlParser().parseResource(Patient.class, input); @@ -2818,22 +2864,22 @@ public class XmlParserDstu3Test { /** * See #426 - * + *

* Value type of FOO isn't a valid datatype */ @Test public void testParseExtensionWithInvalidType() { String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; Patient pt = ourCtx.newXmlParser().parseResource(Patient.class, input); @@ -2859,8 +2905,8 @@ public class XmlParserDstu3Test { public void testParseInvalidBoolean() { String resource = "\n" + - " \n" + - ""; + " \n" + + ""; IParser p = ourCtx.newXmlParser(); @@ -2896,12 +2942,12 @@ public class XmlParserDstu3Test { // This was changed from 0.5 to 1.0.0 String out = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; IParserErrorHandler errorHandler = mock(IParserErrorHandler.class); @@ -2917,37 +2963,61 @@ public class XmlParserDstu3Test { assertEquals("value", capt.getValue()); } + @Test + public void testParseMetaUpdatedDate() { + + String input = "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; + + Bundle b = ourCtx.newXmlParser().parseResource(Bundle.class, input); + + InstantType updated = b.getMeta().getLastUpdatedElement(); + assertEquals("2015-06-22T15:48:57.554-04:00", updated.getValueAsString()); + + } + @Test public void testParseMetadata() throws Exception { String content = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; Bundle b = ourCtx.newXmlParser().parseResource(Bundle.class, content); assertEquals(1, b.getEntry().size()); @@ -2970,43 +3040,6 @@ public class XmlParserDstu3Test { } - public static void compareXml(String content, String reEncoded) { - Diff d = DiffBuilder.compare(Input.fromString(content)) - .withTest(Input.fromString(reEncoded)) - .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)) - .checkForSimilar() - .ignoreWhitespace() // this is working with newest Saxon 9.8.0-2 (not worked with 9.7.0-15 - .ignoreComments() // this is not working even with newest Saxon 9.8.0-2 - .withComparisonController(ComparisonControllers.Default) - .build(); - - assertTrue(d.toString(), !d.hasDifferences()); - } - - @Test - public void testParseMetaUpdatedDate() { - - String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; - - Bundle b = ourCtx.newXmlParser().parseResource(Bundle.class, input); - - InstantType updated = b.getMeta().getLastUpdatedElement(); - assertEquals("2015-06-22T15:48:57.554-04:00", updated.getValueAsString()); - - } - // TODO: this should work @Test @Ignore @@ -3015,11 +3048,11 @@ public class XmlParserDstu3Test { String htmlNoNs = "

AAABBBCCC
"; String htmlNs = htmlNoNs.replace("
", "
"); String res = "\n" + - " \n" + - " \n" + - " " + htmlNs + "\n" + - " \n" + - ""; + " \n" + + " \n" + + " " + htmlNs + "\n" + + " \n" + + ""; Patient p = ourCtx.newXmlParser().parseResource(Patient.class, res); assertEquals(htmlNs, p.getText().getDiv().getValueAsString()); @@ -3029,15 +3062,15 @@ public class XmlParserDstu3Test { public void testParseNestedExtensionsInvalid() { String input = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + ""; try { ourCtx.newXmlParser().parseResource(Patient.class, input); @@ -3077,40 +3110,6 @@ public class XmlParserDstu3Test { assertEquals("Patient", reincarnatedPatient.getIdElement().getResourceType()); } - /** - * See #344 - */ - @Test - public void testParserIsCaseSensitive() { - Observation obs = new Observation(); - SampledData data = new SampledData(); - data.setData("1 2 3"); - data.setOrigin((SimpleQuantity) new SimpleQuantity().setValue(0L)); - data.setPeriod(1000L); - obs.setValue(data); - - IParser p = ourCtx.newXmlParser().setPrettyPrint(true).setParserErrorHandler(new StrictErrorHandler()); - String encoded = p.encodeResourceToString(obs); - ourLog.info(encoded); - - p.parseResource(encoded); - - try { - p.parseResource(encoded.replace("Observation", "observation")); - fail(); - } catch (DataFormatException e) { - assertEquals("DataFormatException at [[row,col {unknown-source}]: [1,1]]: Unknown resource type 'observation': Resource names are case sensitive, found similar name: 'Observation'", - e.getMessage()); - } - - try { - p.parseResource(encoded.replace("valueSampledData", "valueSampleddata")); - fail(); - } catch (DataFormatException e) { - assertEquals("DataFormatException at [[row,col {unknown-source}]: [2,4]]: Unknown element 'valueSampleddata' found during parse", e.getMessage()); - } - } - @Test(expected = DataFormatException.class) public void testParseWithInvalidLocalRef() throws IOException { String string = IOUtils.toString(getClass().getResourceAsStream("/bundle_with_invalid_contained_ref.xml"), StandardCharsets.UTF_8); @@ -3156,10 +3155,10 @@ public class XmlParserDstu3Test { public void testParseXmlExtensionWithoutUrl() { String input = "\n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + ""; IParser parser = ourCtx.newXmlParser(); parser.setParserErrorHandler(new LenientErrorHandler()); @@ -3186,10 +3185,10 @@ public class XmlParserDstu3Test { public void testParseXmlModifierExtensionWithoutUrl() { String input = "\n" + - " \n" + - " \n" + - " \n" + - ""; + " \n" + + " \n" + + " \n" + + ""; IParser parser = ourCtx.newXmlParser(); parser.setParserErrorHandler(new LenientErrorHandler()); @@ -3209,6 +3208,40 @@ public class XmlParserDstu3Test { } + /** + * See #344 + */ + @Test + public void testParserIsCaseSensitive() { + Observation obs = new Observation(); + SampledData data = new SampledData(); + data.setData("1 2 3"); + data.setOrigin((SimpleQuantity) new SimpleQuantity().setValue(0L)); + data.setPeriod(1000L); + obs.setValue(data); + + IParser p = ourCtx.newXmlParser().setPrettyPrint(true).setParserErrorHandler(new StrictErrorHandler()); + String encoded = p.encodeResourceToString(obs); + ourLog.info(encoded); + + p.parseResource(encoded); + + try { + p.parseResource(encoded.replace("Observation", "observation")); + fail(); + } catch (DataFormatException e) { + assertEquals("DataFormatException at [[row,col {unknown-source}]: [1,1]]: Unknown resource type 'observation': Resource names are case sensitive, found similar name: 'Observation'", + e.getMessage()); + } + + try { + p.parseResource(encoded.replace("valueSampledData", "valueSampleddata")); + fail(); + } catch (DataFormatException e) { + assertEquals("DataFormatException at [[row,col {unknown-source}]: [2,4]]: Unknown element 'valueSampleddata' found during parse", e.getMessage()); + } + } + /** * See #551 */ @@ -3228,24 +3261,24 @@ public class XmlParserDstu3Test { /** * See #339 - * + *

* https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Processing */ @Test public void testXxe() { String input = "" + - "" + - "]>" + - "" + - "" + - "

TEXT &xxe; TEXT
" + - "" + - "
" + - "" + - "
" + - ""; + "" + + "]>" + + "" + + "" + + "
TEXT &xxe; TEXT
" + + "
" + + "
" + + "" + + "
" + + "
"; ourLog.info(input); @@ -3258,35 +3291,22 @@ public class XmlParserDstu3Test { } - @Test - public void testBaseUrlFooResourceCorrectlySerializedInExtensionValueReference() { - String refVal = "http://my.org/FooBar"; - - Patient fhirPat = new Patient(); - fhirPat.addExtension().setUrl("x1").setValue(new Reference(refVal)); - - IParser parser = ourCtx.newXmlParser(); - - String output = parser.encodeResourceToString(fhirPat); - System.out.println("output: " + output); - - // Deserialize then check that valueReference value is still correct - fhirPat = parser.parseResource(Patient.class, output); - - List extlst = fhirPat.getExtensionsByUrl("x1"); - Assert.assertEquals(1, extlst.size()); - Assert.assertEquals(refVal, ((Reference) extlst.get(0).getValue()).getReference()); - } - @AfterClass public static void afterClassClearContext() { TestUtil.clearAllStaticFieldsForUnitTest(); } - public static void main(String[] args) { - IGenericClient c = ourCtx.newRestfulGenericClient("http://fhir-dev.healthintersections.com.au/open"); - // c.registerInterceptor(new LoggingInterceptor(true)); - c.read().resource("Patient").withId("324").execute(); + public static void compareXml(String content, String reEncoded) { + Diff d = DiffBuilder.compare(Input.fromString(content)) + .withTest(Input.fromString(reEncoded)) + .withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndText)) + .checkForSimilar() + .ignoreWhitespace() // this is working with newest Saxon 9.8.0-2 (not worked with 9.7.0-15 + .ignoreComments() // this is not working even with newest Saxon 9.8.0-2 + .withComparisonController(ComparisonControllers.Default) + .build(); + + assertTrue(d.toString(), !d.hasDifferences()); } @ResourceDef(name = "Patient") diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu3Test.java new file mode 100644 index 00000000000..cdb7a99c235 --- /dev/null +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu3Test.java @@ -0,0 +1,150 @@ +package ca.uhn.fhir.rest.client; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.InputStream; +import java.io.StringReader; +import java.nio.charset.Charset; + +import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.dstu3.model.CapabilityStatement; +import org.hl7.fhir.dstu3.model.Patient; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Matchers; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.primitive.UriDt; +import ca.uhn.fhir.rest.client.exceptions.FhirClientInappropriateForServerException; +import ca.uhn.fhir.util.TestUtil; + +public class ClientServerValidationDstu3Test { + + private FhirContext myCtx; + private HttpClient myHttpClient; + private HttpResponse myHttpResponse; + private boolean myFirstResponse; + + @Before + public void before() { + myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs()); + myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); + myFirstResponse = true; + + myCtx = FhirContext.forDstu3(); + myCtx.getRestfulClientFactory().setHttpClient(myHttpClient); + } + + @Test + public void testServerReturnsAppropriateVersionDstu3() throws Exception { + String appropriateFhirVersion = "3.0.1"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU3.getFhirVersionString())); + CapabilityStatement conf = new CapabilityStatement(); + conf.setFhirVersion(appropriateFhirVersion); + final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + if (myFirstResponse) { + myFirstResponse=false; + return new ReaderInputStream(new StringReader(confResource), Charset.forName("UTF-8")); + } else { + return new ReaderInputStream(new StringReader(myCtx.newXmlParser().encodeResourceToString(new Patient())), Charset.forName("UTF-8")); + } + }}); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); + IGenericClient client = myCtx.newRestfulGenericClient("http://foo"); + + // don't load the conformance until the first time the client is actually used + assertTrue(myFirstResponse); + client.read(new UriDt("http://foo/Patient/123")); + assertFalse(myFirstResponse); + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + + // Conformance only loaded once, then 3 reads + verify(myHttpClient, times(4)).execute(Matchers.any(HttpUriRequest.class)); + } + + @Test + public void testServerReturnsWrongVersionDstu3() throws Exception { + String wrongFhirVersion = "1.0.2"; + assertThat(wrongFhirVersion, is(FhirVersionEnum.DSTU2.getFhirVersionString())); + CapabilityStatement conf = new CapabilityStatement(); + conf.setFhirVersion(wrongFhirVersion); + String msg = myCtx.newXmlParser().encodeResourceToString(conf); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); + try { + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/1")); + fail(); + } catch (FhirClientInappropriateForServerException e) { + assertThat(e.toString(), containsString("The server at base URL \"http://foo/metadata\" returned a conformance statement indicating that it supports FHIR version \"1.0.2\" which corresponds to DSTU2, but this client is configured to use DSTU3 (via the FhirContext)")); + } + } + + @Test + public void testServerReturnsRightVersionDstu3() throws Exception { + String appropriateFhirVersion = "3.0.1"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU3.getFhirVersionString())); + CapabilityStatement conf = new CapabilityStatement(); + conf.setFhirVersion(appropriateFhirVersion); + String msg = myCtx.newXmlParser().encodeResourceToString(conf); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); + myCtx.newRestfulGenericClient("http://foo").forceConformanceCheck(); + } + + @AfterClass + public static void afterClassClearContext() { + TestUtil.clearAllStaticFieldsForUnitTest(); + } +} diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ReadDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ReadDstu3Test.java index f3f05de41bf..ae8065ed5c4 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ReadDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/ReadDstu3Test.java @@ -69,20 +69,38 @@ public class ReadDstu3Test { CloseableHttpResponse status; HttpGet httpGet; + // Fixture was last modified at 2012-01-01T12:12:12Z + // thus it hasn't changed after the later time of 2012-01-01T13:00:00Z + // so we expect a 304 (Not Modified) httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2"); httpGet.addHeader(Constants.HEADER_IF_MODIFIED_SINCE, DateUtils.formatDate(new InstantDt("2012-01-01T13:00:00Z").getValue())); status = ourClient.execute(httpGet); try { - assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(304, status.getStatusLine().getStatusCode()); } finally { IOUtils.closeQuietly(status); } - + + // Fixture was last modified at 2012-01-01T12:12:12Z + // thus it hasn't changed after the same time of 2012-01-01T12:12:12Z + // so we expect a 304 (Not Modified) + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2"); + httpGet.addHeader(Constants.HEADER_IF_MODIFIED_SINCE, DateUtils.formatDate(new InstantDt("2012-01-01T12:12:12Z").getValue())); + status = ourClient.execute(httpGet); + try { + assertEquals(304, status.getStatusLine().getStatusCode()); + } finally { + IOUtils.closeQuietly(status); + } + + // Fixture was last modified at 2012-01-01T12:12:12Z + // thus it has changed after the earlier time of 2012-01-01T10:00:00Z + // so we expect a 200 httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2"); httpGet.addHeader(Constants.HEADER_IF_MODIFIED_SINCE, DateUtils.formatDate(new InstantDt("2012-01-01T10:00:00Z").getValue())); status = ourClient.execute(httpGet); try { - assertEquals(304, status.getStatusLine().getStatusCode()); + assertEquals(200, status.getStatusLine().getStatusCode()); } finally { IOUtils.closeQuietly(status); } diff --git a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/BackboneElementDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/BackboneElementDstu3Test.java new file mode 100644 index 00000000000..95579f832fa --- /dev/null +++ b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/BackboneElementDstu3Test.java @@ -0,0 +1,25 @@ +package org.hl7.fhir.dstu3.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent; +import org.junit.Test; + +public class BackboneElementDstu3Test { + /** + * Ensuring that IDs of subtypes of BackboneElement get copied when + * the {@link BackboneElement#copy()} method is called + */ + @Test + public void testPatientCommunicationComponentCopy() { + PatientCommunicationComponent pcc1 = new PatientCommunicationComponent(); + pcc1.setId("1001"); + + PatientCommunicationComponent copiedPcc = pcc1.copy(); + String copiedPccID = copiedPcc.getId(); + + assertTrue(copiedPcc instanceof BackboneElement); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedPccID); + } +} diff --git a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/CodesystemsDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/CodesystemsDstu3Test.java new file mode 100644 index 00000000000..1fb703cfad6 --- /dev/null +++ b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/CodesystemsDstu3Test.java @@ -0,0 +1,35 @@ +package org.hl7.fhir.dstu3.model; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.either; +import static org.hamcrest.Matchers.endsWith; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.util.*; + +import org.apache.commons.lang3.time.FastDateFormat; +import org.hamcrest.Matchers; +import org.junit.*; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.TemporalPrecisionEnum; +import ca.uhn.fhir.parser.DataFormatException; +import ca.uhn.fhir.util.TestUtil; +import ca.uhn.fhir.validation.ValidationResult; + +public class CodesystemsDstu3Test { + + @Test + public void testCodesystemsPresent() { + org.hl7.fhir.dstu3.model.codesystems.XdsRelationshipType.class.toString(); + } +} diff --git a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/DomainResourceDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/DomainResourceDstu3Test.java new file mode 100644 index 00000000000..382f5dad705 --- /dev/null +++ b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/DomainResourceDstu3Test.java @@ -0,0 +1,27 @@ +package org.hl7.fhir.dstu3.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class DomainResourceDstu3Test { + /** + * Ensuring that fields defined in {@link DomainResource} and {@link Resource} + * get copied when the {@link DomainResource#copy()} method is called + */ + @Test + public void testPatientCopy() { + Patient p1 = new Patient(); + p1.setId("1001"); + p1.setText(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL)); + + Patient copiedPatient = p1.copy(); + String copiedPatientID = copiedPatient.getIdElement().getIdPart(); + Narrative.NarrativeStatus copiedPatientTextStatus = copiedPatient.getText().getStatus(); + + assertTrue(copiedPatient instanceof DomainResource); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedPatientID); + assertEquals(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL).getStatus(), copiedPatientTextStatus); + } +} diff --git a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/MetadataResourceDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/MetadataResourceDstu3Test.java new file mode 100644 index 00000000000..a7eca43fe93 --- /dev/null +++ b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/MetadataResourceDstu3Test.java @@ -0,0 +1,29 @@ +package org.hl7.fhir.dstu3.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class MetadataResourceDstu3Test { + /** + * Ensuring that fields defined in {@link MetadataResource}, {@link DomainResource}, and {@link Resource} + * get copied when the {@link MetadataResource#copy()} method is called + */ + @Test + public void testCodeSystemCopy() { + CodeSystem codeSystem1 = new CodeSystem(); + codeSystem1.setId("1001"); + codeSystem1.setName("Name123"); + codeSystem1.setText(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL)); + + CodeSystem copiedCodeSystem = codeSystem1.copy(); + String copiedCodeSystemID = copiedCodeSystem.getId(); + String copiedCodeSystemName = copiedCodeSystem.getName(); + Narrative.NarrativeStatus copiedCodeSystemTextStatus = copiedCodeSystem.getText().getStatus(); + + assertTrue(copiedCodeSystem instanceof MetadataResource); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedCodeSystemID); + assertEquals("Name123", copiedCodeSystemName); + assertEquals(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL).getStatus(), copiedCodeSystemTextStatus); + } +} diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index f6a51832736..9e3218868b8 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -29,6 +29,11 @@ + + org.codehaus.woodstox + woodstox-core-asl + test + ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu2 diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java index aafa5abd95a..5ba1389a843 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java @@ -19,14 +19,6 @@ package ca.uhn.fhir.rest.server.provider.dstu2hl7org; * limitations under the License. * #L% */ -import static org.apache.commons.lang3.StringUtils.isBlank; -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -import java.util.*; - -import org.hl7.fhir.instance.model.*; -import org.hl7.fhir.instance.model.Bundle.*; -import org.hl7.fhir.instance.model.api.*; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.api.BundleInclusionRule; @@ -35,311 +27,328 @@ import ca.uhn.fhir.model.valueset.BundleTypeEnum; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.IVersionSpecificBundleFactory; import ca.uhn.fhir.util.ResourceReferenceInfo; +import org.hl7.fhir.instance.model.Bundle; +import org.hl7.fhir.instance.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.instance.model.Bundle.BundleLinkComponent; +import org.hl7.fhir.instance.model.Bundle.HTTPVerb; +import org.hl7.fhir.instance.model.Bundle.SearchEntryMode; +import org.hl7.fhir.instance.model.IdType; +import org.hl7.fhir.instance.model.InstantType; +import org.hl7.fhir.instance.model.Resource; +import org.hl7.fhir.instance.model.api.*; + +import java.util.*; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory { - private String myBase; - private Bundle myBundle; - private FhirContext myContext; + private String myBase; + private Bundle myBundle; + private FhirContext myContext; - public Dstu2Hl7OrgBundleFactory(FhirContext theContext) { - myContext = theContext; - } + public Dstu2Hl7OrgBundleFactory(FhirContext theContext) { + myContext = theContext; + } - private void addResourcesForSearch(List theResult) { - List includedResources = new ArrayList(); - Set addedResourceIds = new HashSet(); + private void addResourcesForSearch(List theResult) { + List includedResources = new ArrayList(); + Set addedResourceIds = new HashSet(); - for (IBaseResource next : theResult) { - if (next.getIdElement().isEmpty() == false) { - addedResourceIds.add(next.getIdElement()); - } - } + for (IBaseResource next : theResult) { + if (next.getIdElement().isEmpty() == false) { + addedResourceIds.add(next.getIdElement()); + } + } - for (IBaseResource nextBaseRes : theResult) { - IDomainResource next = (IDomainResource) nextBaseRes; - Set containedIds = new HashSet(); - for (IBaseResource nextContained : next.getContained()) { - if (nextContained.getIdElement().isEmpty() == false) { - containedIds.add(nextContained.getIdElement().getValue()); - } - } + for (IBaseResource nextBaseRes : theResult) { + IDomainResource next = (IDomainResource) nextBaseRes; + Set containedIds = new HashSet(); + for (IBaseResource nextContained : next.getContained()) { + if (nextContained.getIdElement().isEmpty() == false) { + containedIds.add(nextContained.getIdElement().getValue()); + } + } - List references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, - IBaseReference.class); - do { - List addedResourcesThisPass = new ArrayList(); + List references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, + IBaseReference.class); + do { + List addedResourcesThisPass = new ArrayList(); - for (IBaseReference nextRef : references) { - IBaseResource nextRes = (IBaseResource) nextRef.getResource(); - if (nextRes != null) { - if (nextRes.getIdElement().hasIdPart()) { - if (containedIds.contains(nextRes.getIdElement().getValue())) { - // Don't add contained IDs as top level resources - continue; - } + for (IBaseReference nextRef : references) { + IBaseResource nextRes = (IBaseResource) nextRef.getResource(); + if (nextRes != null) { + if (nextRes.getIdElement().hasIdPart()) { + if (containedIds.contains(nextRes.getIdElement().getValue())) { + // Don't add contained IDs as top level resources + continue; + } - IIdType id = nextRes.getIdElement(); - if (id.hasResourceType() == false) { - String resName = myContext.getResourceDefinition(nextRes).getName(); - id = id.withResourceType(resName); - } + IIdType id = nextRes.getIdElement(); + if (id.hasResourceType() == false) { + String resName = myContext.getResourceDefinition(nextRes).getName(); + id = id.withResourceType(resName); + } - if (!addedResourceIds.contains(id)) { - addedResourceIds.add(id); - addedResourcesThisPass.add(nextRes); - } + if (!addedResourceIds.contains(id)) { + addedResourceIds.add(id); + addedResourcesThisPass.add(nextRes); + } - } - } - } + } + } + } - // Linked resources may themselves have linked resources - references = new ArrayList(); - for (IBaseResource iResource : addedResourcesThisPass) { - List newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, - IBaseReference.class); - references.addAll(newReferences); - } + // Linked resources may themselves have linked resources + references = new ArrayList(); + for (IBaseResource iResource : addedResourcesThisPass) { + List newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, + IBaseReference.class); + references.addAll(newReferences); + } - includedResources.addAll(addedResourcesThisPass); + includedResources.addAll(addedResourcesThisPass); - } while (references.isEmpty() == false); + } while (references.isEmpty() == false); - BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next); - populateBundleEntryFullUrl(next, entry); - } + BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next); + populateBundleEntryFullUrl(next, entry); + } + + /* + * Actually add the resources to the bundle + */ + for (IBaseResource next : includedResources) { + BundleEntryComponent entry = myBundle.addEntry(); + entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); + populateBundleEntryFullUrl(next, entry); + } + } + + @Override + public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, + BundleInclusionRule theBundleInclusionRule, Set theIncludes) { + ensureBundle(); + + List includedResources = new ArrayList(); + Set addedResourceIds = new HashSet(); + + for (IBaseResource next : theResult) { + if (next.getIdElement().isEmpty() == false) { + addedResourceIds.add(next.getIdElement()); + } + } + + for (IBaseResource next : theResult) { + + List contained; + if (next instanceof IDomainResource) { + IDomainResource nextDomain = (IDomainResource) next; + contained = nextDomain.getContained(); + } else { + contained = Collections.emptyList(); + } + + Set containedIds = new HashSet(); + for (IAnyResource nextContained : contained) { + if (nextContained.getId().isEmpty() == false) { + containedIds.add(nextContained.getIdElement().getValue()); + } + } + + List references = myContext.newTerser().getAllResourceReferences(next); + do { + List addedResourcesThisPass = new ArrayList(); + + for (ResourceReferenceInfo nextRefInfo : references) { + if (!theBundleInclusionRule.shouldIncludeReferencedResource(nextRefInfo, theIncludes)) + continue; + + IBaseResource nextRes = (IBaseResource) nextRefInfo.getResourceReference().getResource(); + if (nextRes != null) { + if (nextRes.getIdElement().hasIdPart()) { + if (containedIds.contains(nextRes.getIdElement().getValue())) { + // Don't add contained IDs as top level resources + continue; + } + + IdType id = (IdType) nextRes.getIdElement(); + if (id.hasResourceType() == false) { + String resName = myContext.getResourceDefinition(nextRes).getName(); + id = id.withResourceType(resName); + } + + if (!addedResourceIds.contains(id)) { + addedResourceIds.add(id); + addedResourcesThisPass.add(nextRes); + } + + } + } + } + + includedResources.addAll(addedResourcesThisPass); + + // Linked resources may themselves have linked resources + references = new ArrayList(); + for (IBaseResource iResource : addedResourcesThisPass) { + List newReferences = myContext.newTerser().getAllResourceReferences(iResource); + references.addAll(newReferences); + } + } while (references.isEmpty() == false); + + BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next); + populateBundleEntryFullUrl(next, entry); + + // BundleEntrySearchModeEnum searchMode = + // ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(next); + // if (searchMode != null) { + // entry.getSearch().getModeElement().setValue(searchMode.getCode()); + // } + } /* * Actually add the resources to the bundle */ - for (IBaseResource next : includedResources) { - BundleEntryComponent entry = myBundle.addEntry(); - entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); - populateBundleEntryFullUrl(next, entry); - } - } + for (IBaseResource next : includedResources) { + myBundle.addEntry().setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); + } - @Override - public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, - BundleInclusionRule theBundleInclusionRule, Set theIncludes) { - ensureBundle(); + } - List includedResources = new ArrayList(); - Set addedResourceIds = new HashSet(); + @Override + public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, + Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType theLastUpdated) { + ensureBundle(); - for (IBaseResource next : theResult) { - if (next.getIdElement().isEmpty() == false) { - addedResourceIds.add(next.getIdElement()); - } - } + if (myBundle.getIdElement().isEmpty()) { + myBundle.setId(theId); + } + if (isBlank(myBundle.getId())) { + myBundle.setId(UUID.randomUUID().toString()); + } - for (IBaseResource next : theResult) { + if (myBundle.getMeta().getLastUpdated() == null) { + InstantType instantType = new InstantType(); + instantType.setValueAsString(theLastUpdated.getValueAsString()); + myBundle.getMeta().setLastUpdatedElement(instantType); + } - List contained; - if (next instanceof IDomainResource) { - IDomainResource nextDomain = (IDomainResource) next; - contained = nextDomain.getContained(); - } else { - contained = Collections.emptyList(); - } + if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkSelf)) { + myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theLinkSelf); + } + if (!hasLink(Constants.LINK_NEXT, myBundle) && isNotBlank(theLinkNext)) { + myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(theLinkNext); + } + if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkPrev)) { + myBundle.addLink().setRelation(Constants.LINK_PREVIOUS).setUrl(theLinkPrev); + } - Set containedIds = new HashSet(); - for (IAnyResource nextContained : contained) { - if (nextContained.getId().isEmpty() == false) { - containedIds.add(nextContained.getIdElement().getValue()); - } - } + myBase = theServerBase; - List references = myContext.newTerser().getAllResourceReferences(next); - do { - List addedResourcesThisPass = new ArrayList(); + if (myBundle.getTypeElement().isEmpty() && theBundleType != null) { + myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); + } - for (ResourceReferenceInfo nextRefInfo : references) { - if (!theBundleInclusionRule.shouldIncludeReferencedResource(nextRefInfo, theIncludes)) - continue; + if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) { + myBundle.getTotalElement().setValue(theTotalResults); + } + } - IBaseResource nextRes = (IBaseResource) nextRefInfo.getResourceReference().getResource(); - if (nextRes != null) { - if (nextRes.getIdElement().hasIdPart()) { - if (containedIds.contains(nextRes.getIdElement().getValue())) { - // Don't add contained IDs as top level resources - continue; - } + private void ensureBundle() { + if (myBundle == null) { + myBundle = new Bundle(); + } + } - IdType id = (IdType) nextRes.getIdElement(); - if (id.hasResourceType() == false) { - String resName = myContext.getResourceDefinition(nextRes).getName(); - id = id.withResourceType(resName); - } + @Override + public IBaseResource getResourceBundle() { + return myBundle; + } - if (!addedResourceIds.contains(id)) { - addedResourceIds.add(id); - addedResourcesThisPass.add(nextRes); - } + private boolean hasLink(String theLinkType, Bundle theBundle) { + for (BundleLinkComponent next : theBundle.getLink()) { + if (theLinkType.equals(next.getRelation())) { + return true; + } + } + return false; + } - } - } - } + @Override + public void initializeBundleFromResourceList(String theAuthor, List theResources, + String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) { + ensureBundle(); - includedResources.addAll(addedResourcesThisPass); + myBundle.setId(UUID.randomUUID().toString()); - // Linked resources may themselves have linked resources - references = new ArrayList(); - for (IBaseResource iResource : addedResourcesThisPass) { - List newReferences = myContext.newTerser().getAllResourceReferences(iResource); - references.addAll(newReferences); - } - } while (references.isEmpty() == false); + myBundle.getMeta().setLastUpdatedElement(InstantType.withCurrentTime()); - BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next); - populateBundleEntryFullUrl(next, entry); + myBundle.addLink().setRelation(Constants.LINK_FHIR_BASE).setUrl(theServerBase); + myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theCompleteUrl); + myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); - // BundleEntrySearchModeEnum searchMode = - // ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(next); - // if (searchMode != null) { - // entry.getSearch().getModeElement().setValue(searchMode.getCode()); - // } - } + if (theBundleType.equals(BundleTypeEnum.TRANSACTION)) { + for (IBaseResource nextBaseRes : theResources) { + IBaseResource next = (IBaseResource) nextBaseRes; + BundleEntryComponent nextEntry = myBundle.addEntry(); - /* - * Actually add the resources to the bundle - */ - for (IBaseResource next : includedResources) { - myBundle.addEntry().setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); - } + nextEntry.setResource((Resource) next); + if (next.getIdElement().isEmpty()) { + nextEntry.getRequest().setMethod(HTTPVerb.POST); + } else { + nextEntry.getRequest().setMethod(HTTPVerb.PUT); + if (next.getIdElement().isAbsolute()) { + nextEntry.getRequest().setUrl(next.getIdElement().getValue()); + } else { + String resourceType = myContext.getResourceDefinition(next).getName(); + nextEntry.getRequest().setUrl(new IdType(theServerBase, resourceType, next.getIdElement().getIdPart(), + next.getIdElement().getVersionIdPart()).getValue()); + } + } + } + } else { + addResourcesForSearch(theResources); + } - } + myBundle.getTotalElement().setValue(theTotalResults); + } - @Override - public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, - Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType theLastUpdated) { - ensureBundle(); + @Override + public void initializeWithBundleResource(IBaseResource theBundle) { + myBundle = (Bundle) theBundle; + } - if (isBlank(myBundle.getId())) { - myBundle.setId(UUID.randomUUID().toString()); - } + private void populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { + if (next.getIdElement().hasBaseUrl()) { + entry.setFullUrl(next.getIdElement().toVersionless().getValue()); + } else { + if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { + IIdType id = next.getIdElement().toVersionless(); + id = id.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); + entry.setFullUrl(id.getValue()); + } + } + } - if (myBundle.getMeta().getLastUpdated() == null) { - InstantType instantType = new InstantType(); - instantType.setValueAsString(theLastUpdated.getValueAsString()); - myBundle.getMeta().setLastUpdatedElement(instantType); - } - - if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkSelf)) { - myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theLinkSelf); - } - if (!hasLink(Constants.LINK_NEXT, myBundle) && isNotBlank(theLinkNext)) { - myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(theLinkNext); - } - if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkPrev)) { - myBundle.addLink().setRelation(Constants.LINK_PREVIOUS).setUrl(theLinkPrev); - } - - myBase = theServerBase; - - if (myBundle.getTypeElement().isEmpty() && theBundleType != null) { - myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); - } - - if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) { - myBundle.getTotalElement().setValue(theTotalResults); - } - } - - private void ensureBundle() { - if (myBundle == null) { - myBundle = new Bundle(); - } - } - - @Override - public IBaseResource getResourceBundle() { - return myBundle; - } - - private boolean hasLink(String theLinkType, Bundle theBundle) { - for (BundleLinkComponent next : theBundle.getLink()) { - if (theLinkType.equals(next.getRelation())) { - return true; - } - } - return false; - } - - @Override - public void initializeBundleFromResourceList(String theAuthor, List theResources, - String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) { - ensureBundle(); - - myBundle.setId(UUID.randomUUID().toString()); - - myBundle.getMeta().setLastUpdatedElement(InstantType.withCurrentTime()); - - myBundle.addLink().setRelation(Constants.LINK_FHIR_BASE).setUrl(theServerBase); - myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theCompleteUrl); - myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); - - if (theBundleType.equals(BundleTypeEnum.TRANSACTION)) { - for (IBaseResource nextBaseRes : theResources) { - IBaseResource next = (IBaseResource) nextBaseRes; - BundleEntryComponent nextEntry = myBundle.addEntry(); - - nextEntry.setResource((Resource) next); - if (next.getIdElement().isEmpty()) { - nextEntry.getRequest().setMethod(HTTPVerb.POST); - } else { - nextEntry.getRequest().setMethod(HTTPVerb.PUT); - if (next.getIdElement().isAbsolute()) { - nextEntry.getRequest().setUrl(next.getIdElement().getValue()); - } else { - String resourceType = myContext.getResourceDefinition(next).getName(); - nextEntry.getRequest().setUrl(new IdType(theServerBase, resourceType, next.getIdElement().getIdPart(), - next.getIdElement().getVersionIdPart()).getValue()); - } - } - } - } else { - addResourcesForSearch(theResources); - } - - myBundle.getTotalElement().setValue(theTotalResults); - } - - @Override - public void initializeWithBundleResource(IBaseResource theBundle) { - myBundle = (Bundle) theBundle; - } - - private void populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { - if (next.getIdElement().hasBaseUrl()) { - entry.setFullUrl(next.getIdElement().toVersionless().getValue()); - } else { - if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { - IIdType id = next.getIdElement().toVersionless(); - id = id.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); - entry.setFullUrl(id.getValue()); - } - } - } - - @Override - public List toListOfResources() { - ArrayList retVal = new ArrayList(); - for (BundleEntryComponent next : myBundle.getEntry()) { - if (next.getResource() != null) { - retVal.add(next.getResource()); - } else if (next.getResponse().getLocationElement().isEmpty() == false) { - IdType id = new IdType(next.getResponse().getLocation()); - String resourceType = id.getResourceType(); - if (isNotBlank(resourceType)) { - IBaseResource res = (IBaseResource) myContext.getResourceDefinition(resourceType).newInstance(); - res.setId(id); - retVal.add(res); - } - } - } - return retVal; - } + @Override + public List toListOfResources() { + ArrayList retVal = new ArrayList(); + for (BundleEntryComponent next : myBundle.getEntry()) { + if (next.getResource() != null) { + retVal.add(next.getResource()); + } else if (next.getResponse().getLocationElement().isEmpty() == false) { + IdType id = new IdType(next.getResponse().getLocation()); + String resourceType = id.getResourceType(); + if (isNotBlank(resourceType)) { + IBaseResource res = (IBaseResource) myContext.getResourceDefinition(resourceType).newInstance(); + res.setId(id); + retVal.add(res); + } + } + } + return retVal; + } } diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/BackboneElement.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/BackboneElement.java index df79a09d3d9..a8fdca716ba 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/BackboneElement.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/BackboneElement.java @@ -128,6 +128,7 @@ public abstract class BackboneElement extends Element implements IBaseBackboneEl public abstract BackboneElement copy(); public void copyValues(BackboneElement dst) { + super.copyValues(dst); if (modifierExtension != null) { dst.modifierExtension = new ArrayList(); for (Extension i : modifierExtension) diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/DomainResource.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/DomainResource.java index e4497017a25..480b2b1b930 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/DomainResource.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/DomainResource.java @@ -265,6 +265,7 @@ public abstract class DomainResource extends Resource implements IBaseHasExtensi public abstract DomainResource copy(); public void copyValues(DomainResource dst) { + super.copyValues(dst); dst.text = text == null ? null : text.copy(); if (contained != null) { dst.contained = new ArrayList(); diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/utils/FHIRPathEngine.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/utils/FHIRPathEngine.java index 0b2d291b8fd..1ef92fc5404 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/utils/FHIRPathEngine.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/utils/FHIRPathEngine.java @@ -1,2670 +1,2671 @@ -package org.hl7.fhir.instance.utils; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.hl7.fhir.instance.model.Base; -import org.hl7.fhir.instance.model.BooleanType; -import org.hl7.fhir.instance.model.DateTimeType; -import org.hl7.fhir.instance.model.DateType; -import org.hl7.fhir.instance.model.DecimalType; -import org.hl7.fhir.instance.model.ElementDefinition; -import org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent; -import org.hl7.fhir.instance.model.ExpressionNode; -import org.hl7.fhir.instance.model.ExpressionNode.CollectionStatus; -import org.hl7.fhir.instance.model.ExpressionNode.Function; -import org.hl7.fhir.instance.model.ExpressionNode.Kind; -import org.hl7.fhir.instance.model.ExpressionNode.Operation; -import org.hl7.fhir.instance.model.ExpressionNode.SourceLocation; -import org.hl7.fhir.instance.model.ExpressionNode.TypeDetails; -import org.hl7.fhir.instance.model.IntegerType; -import org.hl7.fhir.instance.model.Resource; -import org.hl7.fhir.instance.model.StringType; -import org.hl7.fhir.instance.model.StructureDefinition; -import org.hl7.fhir.instance.model.TemporalPrecisionEnum; -import org.hl7.fhir.instance.model.TimeType; -import org.hl7.fhir.instance.model.Type; -import org.hl7.fhir.instance.utils.FHIRLexer.FHIRLexerException; -import org.hl7.fhir.instance.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails; -import org.hl7.fhir.exceptions.DefinitionException; -import org.hl7.fhir.exceptions.PathEngineException; -import org.hl7.fhir.exceptions.UcumException; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.utilities.ucum.Decimal; - - -/** - * - * @author Grahame Grieve - * - */ -public class FHIRPathEngine { - private IWorkerContext worker; - private IEvaluationContext hostServices; - private StringBuilder log = new StringBuilder(); - private Set primitiveTypes = new HashSet(); - private Map allTypes = new HashMap(); - - // if the fhir path expressions are allowed to use constants beyond those defined in the specification - // the application can implement them by providing a constant resolver - public interface IEvaluationContext { - public class FunctionDetails { - private String description; - private int minParameters; - private int maxParameters; - public FunctionDetails(String description, int minParameters, int maxParameters) { - super(); - this.description = description; - this.minParameters = minParameters; - this.maxParameters = maxParameters; - } - public String getDescription() { - return description; - } - public int getMinParameters() { - return minParameters; - } - public int getMaxParameters() { - return maxParameters; - } - - } - - public Type resolveConstant(Object appContext, String name); - public String resolveConstantType(Object appContext, String name); - public boolean Log(String argument, List focus); - - // extensibility for functions - /** - * - * @param functionName - * @return null if the function is not known - */ - public FunctionDetails resolveFunction(String functionName); - - /** - * Check the function parameters, and throw an error if they are incorrect, or return the type for the function - * @param functionName - * @param parameters - * @return - */ - public TypeDetails checkFunction(Object appContext, String functionName, List parameters) throws PathEngineException; - - /** - * @param appContext - * @param functionName - * @param parameters - * @return - */ - public List executeFunction(Object appContext, String functionName, List> parameters); - } - - - /** - * @param worker - used when validating paths (@check), and used doing value set membership when executing tests (once that's defined) - */ - public FHIRPathEngine(IWorkerContext worker) { - super(); - this.worker = worker; - primitiveTypes.add("string"); - primitiveTypes.add("code"); - primitiveTypes.add("integer"); - primitiveTypes.add("boolean"); - primitiveTypes.add("decimal"); - primitiveTypes.add("date"); - primitiveTypes.add("dateTime"); -// for (StructureDefinition sd : worker.allStructures()) { -// if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) -// allTypes.put(sd.getName(), sd); -// if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) { -// primitiveTypes.add(sd.getName()); -// } -// } - } - - - // --- 3 methods to override in children ------------------------------------------------------- - // if you don't override, it falls through to the using the base reference implementation - // HAPI overrides to these to support extensing the base model - - public IEvaluationContext getConstantResolver() { - return hostServices; - } - - - public void setConstantResolver(IEvaluationContext constantResolver) { - this.hostServices = constantResolver; - } - - - /** - * Given an item, return all the children that conform to the pattern described in name - * - * Possible patterns: - * - a simple name (which may be the base of a name with [] e.g. value[x]) - * - a name with a type replacement e.g. valueCodeableConcept - * - * which means all children - * - ** which means all descendants - * - * @param item - * @param name - * @param result - * @ - */ - protected void getChildrenByName(Base item, String name, List result) { - List list = item.listChildrenByName(name); - if (list != null) - for (Base v : list) - if (v != null) - result.add(v); - } - - // --- public API ------------------------------------------------------- - /** - * Parse a path for later use using execute - * - * @param path - * @return - * @throws PathEngineException - * @throws Exception - */ - public ExpressionNode parse(String path) throws FHIRLexerException { - path = path.replace("$.", "$this."); - FHIRLexer lexer = new FHIRLexer(path); - if (lexer.done()) - throw lexer.error("Path cannot be empty"); - ExpressionNode result = parseExpression(lexer, true); - if (!lexer.done()) - throw lexer.error("Premature ExpressionNode termination at unexpected token \""+lexer.getCurrent()+"\""); - result.check(); - return result; - } - - /** - * Parse a path that is part of some other syntax - * - * @param path - * @return - * @throws PathEngineException - * @throws Exception - */ - public ExpressionNode parse(FHIRLexer lexer) throws FHIRLexerException { - ExpressionNode result = parseExpression(lexer, true); - result.check(); - return result; - } - - /** - * check that paths referred to in the ExpressionNode are valid - * - * xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath - * - * returns a list of the possible types that might be returned by executing the ExpressionNode against a particular context - * - * @param context - the logical type against which this path is applied - * @param path - the FHIR Path statement to check - * @throws DefinitionException - * @throws PathEngineException - * @if the path is not valid - */ - public TypeDetails check(Object appContext, String resourceType, String context, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException { - // if context is a path that refers to a type, do that conversion now - TypeDetails types; - if (!context.contains(".")) - types = new TypeDetails(CollectionStatus.SINGLETON, context); - else { - StructureDefinition sd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+context.substring(0, context.indexOf('.'))); - if (sd == null) - throw new PathEngineException("Unknown context "+context); - ElementDefinitionMatch ed = getElementDefinition(sd, context, true); - if (ed == null) - throw new PathEngineException("Unknown context element "+context); - if (ed.fixedType != null) - types = new TypeDetails(CollectionStatus.SINGLETON, ed.fixedType); - else if (ed.getDefinition().getType().isEmpty() || ( isAbstractType(ed.getDefinition().getType()))) - types = new TypeDetails(CollectionStatus.SINGLETON, context); - else { - types = new TypeDetails(CollectionStatus.SINGLETON); - for (TypeRefComponent t : ed.getDefinition().getType()) - types.addType(t.getCode()); - } - } - - return executeType(new ExecutionTypeContext(appContext, resourceType, context, types), types, expr, true); - } - - public TypeDetails check(Object appContext, String resourceType, String context, String expr) throws FHIRLexerException, PathEngineException, DefinitionException { - return check(appContext, resourceType, context, parse(expr)); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param ExpressionNode - the parsed ExpressionNode statement to use - * @return - * @throws PathEngineException - * @ - * @ - */ - public List evaluate(Base base, ExpressionNode ExpressionNode) throws PathEngineException { - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(null, null, base, base), list, ExpressionNode, true); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRLexerException - * @throws PathEngineException - * @ - * @ - */ - public List evaluate(Base base, String path) throws FHIRLexerException, PathEngineException { - ExpressionNode exp = parse(path); - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(null, null, base, base), list, exp, true); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param ExpressionNode - the parsed ExpressionNode statement to use - * @return - * @throws PathEngineException - * @ - * @ - */ - public List evaluate(Object appContext, Resource resource, Base base, ExpressionNode ExpressionNode) throws PathEngineException { - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(appContext, resource, base, base), list, ExpressionNode, true); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param ExpressionNode - the parsed ExpressionNode statement to use - * @return - * @throws PathEngineException - * @ - * @ - */ - public List evaluate(Object appContext, Base resource, Base base, ExpressionNode ExpressionNode) throws PathEngineException { - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(appContext, resource, base, base), list, ExpressionNode, true); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws PathEngineException - * @throws FHIRLexerException - * @ - * @ - */ - public List evaluate(Object appContext, Resource resource, Base base, String path) throws PathEngineException, FHIRLexerException { - ExpressionNode exp = parse(path); - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(appContext, resource, base, base), list, exp, true); - } - - /** - * evaluate a path and return true or false (e.g. for an invariant) - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRLexerException - * @throws PathEngineException - * @ - * @ - */ - public boolean evaluateToBoolean(Resource resource, Base base, String path) throws PathEngineException, FHIRLexerException { - return convertToBoolean(evaluate(null, resource, base, path)); - } - - /** - * evaluate a path and return true or false (e.g. for an invariant) - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws PathEngineException - * @ - * @ - */ - public boolean evaluateToBoolean(Resource resource, Base base, ExpressionNode node) throws PathEngineException { - return convertToBoolean(evaluate(null, resource, base, node)); - } - - /** - * evaluate a path and return true or false (e.g. for an invariant) - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws PathEngineException - * @ - * @ - */ - public boolean evaluateToBoolean(Base resource, Base base, ExpressionNode node) throws PathEngineException { - return convertToBoolean(evaluate(null, resource, base, node)); - } - - /** - * evaluate a path and a string containing the outcome (for display) - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRLexerException - * @throws PathEngineException - * @ - * @ - */ - public String evaluateToString(Base base, String path) throws FHIRLexerException, PathEngineException { - return convertToString(evaluate(base, path)); - } - - /** - * worker routine for converting a set of objects to a string representation - * - * @param items - result from @evaluate - * @return - */ - public String convertToString(List items) { - StringBuilder b = new StringBuilder(); - boolean first = true; - for (Base item : items) { - if (first) - first = false; - else - b.append(','); - - b.append(convertToString(item)); - } - return b.toString(); - } - - private String convertToString(Base item) { - if (item.isPrimitive()) - return item.primitiveValue(); - else - return item.getClass().getName(); - } - - /** - * worker routine for converting a set of objects to a boolean representation (for invariants) - * - * @param items - result from @evaluate - * @return - */ - public boolean convertToBoolean(List items) { - if (items == null) - return false; - else if (items.size() == 1 && items.get(0) instanceof BooleanType) - return ((BooleanType) items.get(0)).getValue(); - else - return items.size() > 0; - } - - - private void log(String name, List contents) { - if (hostServices == null || !hostServices.Log(name, contents)) { - if (log.length() > 0) - log.append("; "); - log.append(name); - log.append(": "); - boolean first = true; - for (Base b : contents) { - if (first) - first = false; - else - log.append(","); - log.append(convertToString(b)); - } - } - } - - public String forLog() { - if (log.length() > 0) - return " ("+log.toString()+")"; - else - return ""; - } - - private class ExecutionContext { - private Object appInfo; - private Base resource; - private Base context; - private Base thisItem; - public ExecutionContext(Object appInfo, Base resource, Base context, Base thisItem) { - this.appInfo = appInfo; - this.resource = resource; - this.context = context; - this.thisItem = thisItem; - } - public Base getResource() { - return resource; - } - public Base getThisItem() { - return thisItem; - } - } - - private class ExecutionTypeContext { - private Object appInfo; - private String resource; - private String context; - private TypeDetails thisItem; - - - public ExecutionTypeContext(Object appInfo, String resource, String context, TypeDetails thisItem) { - super(); - this.appInfo = appInfo; - this.resource = resource; - this.context = context; - this.thisItem = thisItem; - } - public String getResource() { - return resource; - } - public TypeDetails getThisItem() { - return thisItem; - } - } - - private ExpressionNode parseExpression(FHIRLexer lexer, boolean proximal) throws FHIRLexerException { - ExpressionNode result = new ExpressionNode(lexer.nextId()); - SourceLocation c = lexer.getCurrentStartLocation(); - result.setStart(lexer.getCurrentLocation()); - // special: - if (lexer.getCurrent().equals("-")) { - lexer.take(); - lexer.setCurrent("-"+lexer.getCurrent()); - } - if (lexer.getCurrent().equals("+")) { - lexer.take(); - lexer.setCurrent("+"+lexer.getCurrent()); - } - if (lexer.isConstant(false)) { - checkConstant(lexer.getCurrent(), lexer); - result.setConstant(lexer.take()); - result.setKind(Kind.Constant); - result.setEnd(lexer.getCurrentLocation()); - } else if ("(".equals(lexer.getCurrent())) { - lexer.next(); - result.setKind(Kind.Group); - result.setGroup(parseExpression(lexer, true)); - if (!")".equals(lexer.getCurrent())) - throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\""); - result.setEnd(lexer.getCurrentLocation()); - lexer.next(); - } else { - if (!lexer.isToken() && !lexer.getCurrent().startsWith("\"")) - throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name"); - if (lexer.getCurrent().startsWith("\"")) - result.setName(lexer.readConstant("Path Name")); - else - result.setName(lexer.take()); - result.setEnd(lexer.getCurrentLocation()); - if (!result.checkName()) - throw lexer.error("Found "+result.getName()+" expecting a valid token name"); - if ("(".equals(lexer.getCurrent())) { - Function f = Function.fromCode(result.getName()); - FunctionDetails details = null; - if (f == null) { - details = hostServices != null ? hostServices.resolveFunction(result.getName()) : null; - if (details == null) - throw lexer.error("The name "+result.getName()+" is not a valid function name"); - f = Function.Custom; - } - result.setKind(Kind.Function); - result.setFunction(f); - lexer.next(); - while (!")".equals(lexer.getCurrent())) { - result.getParameters().add(parseExpression(lexer, true)); - if (",".equals(lexer.getCurrent())) - lexer.next(); - else if (!")".equals(lexer.getCurrent())) - throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - either a \",\" or a \")\" expected"); - } - result.setEnd(lexer.getCurrentLocation()); - lexer.next(); - checkParameters(lexer, c, result, details); - } else - result.setKind(Kind.Name); - } - ExpressionNode focus = result; - if ("[".equals(lexer.getCurrent())) { - lexer.next(); - ExpressionNode item = new ExpressionNode(lexer.nextId()); - item.setKind(Kind.Function); - item.setFunction(ExpressionNode.Function.Item); - item.getParameters().add(parseExpression(lexer, true)); - if (!lexer.getCurrent().equals("]")) - throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - a \"]\" expected"); - lexer.next(); - result.setInner(item); - focus = item; - } - if (".".equals(lexer.getCurrent())) { - lexer.next(); - focus.setInner(parseExpression(lexer, false)); - } - result.setProximal(proximal); - if (proximal) { - while (lexer.isOp()) { - focus.setOperation(ExpressionNode.Operation.fromCode(lexer.getCurrent())); - focus.setOpStart(lexer.getCurrentStartLocation()); - focus.setOpEnd(lexer.getCurrentLocation()); - lexer.next(); - focus.setOpNext(parseExpression(lexer, false)); - focus = focus.getOpNext(); - } - result = organisePrecedence(lexer, result); - } - return result; - } - - private ExpressionNode organisePrecedence(FHIRLexer lexer, ExpressionNode node) { - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Times, Operation.DivideBy, Operation.Div, Operation.Mod)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Plus, Operation.Minus, Operation.Concatenate)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Union)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.LessThen, Operation.Greater, Operation.LessOrEqual, Operation.GreaterOrEqual)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Is)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Equals, Operation.Equivalent, Operation.NotEquals, Operation.NotEquivalent)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.And)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Xor, Operation.Or)); - // last: implies - return node; - } - - private ExpressionNode gatherPrecedence(FHIRLexer lexer, ExpressionNode start, EnumSet ops) { - // work : boolean; - // focus, node, group : ExpressionNode; - - assert(start.isProximal()); - - // is there anything to do? - boolean work = false; - ExpressionNode focus = start.getOpNext(); - if (ops.contains(start.getOperation())) { - while (focus != null && focus.getOperation() != null) { - work = work || !ops.contains(focus.getOperation()); - focus = focus.getOpNext(); - } - } else { - while (focus != null && focus.getOperation() != null) { - work = work || ops.contains(focus.getOperation()); - focus = focus.getOpNext(); - } - } - if (!work) - return start; - - // entry point: tricky - ExpressionNode group; - if (ops.contains(start.getOperation())) { - group = newGroup(lexer, start); - group.setProximal(true); - focus = start; - start = group; - } else { - ExpressionNode node = start; - - focus = node.getOpNext(); - while (!ops.contains(focus.getOperation())) { - node = focus; - focus = focus.getOpNext(); - } - group = newGroup(lexer, focus); - node.setOpNext(group); - } - - // now, at this point: - // group is the group we are adding to, it already has a .group property filled out. - // focus points at the group.group - do { - // run until we find the end of the sequence - while (ops.contains(focus.getOperation())) - focus = focus.getOpNext(); - if (focus.getOperation() != null) { - group.setOperation(focus.getOperation()); - group.setOpNext(focus.getOpNext()); - focus.setOperation(null); - focus.setOpNext(null); - // now look for another sequence, and start it - ExpressionNode node = group; - focus = group.getOpNext(); - if (focus != null) { - while (focus == null && !ops.contains(focus.getOperation())) { - node = focus; - focus = focus.getOpNext(); - } - if (focus != null) { // && (focus.Operation in Ops) - must be true - group = newGroup(lexer, focus); - node.setOpNext(group); - } - } - } - } - while (focus != null && focus.getOperation() != null); - return start; - } - - - private ExpressionNode newGroup(FHIRLexer lexer, ExpressionNode next) { - ExpressionNode result = new ExpressionNode(lexer.nextId()); - result.setKind(Kind.Group); - result.setGroup(next); - result.getGroup().setProximal(true); - return result; - } - - private void checkConstant(String s, FHIRLexer lexer) throws FHIRLexerException { - if (s.startsWith("\'") && s.endsWith("\'")) { - int i = 1; - while (i < s.length()-1) { - char ch = s.charAt(i); - if (ch == '\\') { - switch (ch) { - case 't': - case 'r': - case 'n': - case 'f': - case '\'': - case '\\': - case '/': - i++; - break; - case 'u': - if (!Utilities.isHex("0x"+s.substring(i, i+4))) - throw lexer.error("Improper unicode escape \\u"+s.substring(i, i+4)); - break; - default: - throw lexer.error("Unknown character escape \\"+ch); - } - } else - i++; - } - } - } - - // procedure CheckParamCount(c : integer); - // begin - // if exp.Parameters.Count <> c then - // raise lexer.error('The function "'+exp.name+'" requires '+inttostr(c)+' parameters', offset); - // end; - - private boolean checkParamCount(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, int count) throws FHIRLexerException { - if (exp.getParameters().size() != count) - throw lexer.error("The function \""+exp.getName()+"\" requires "+Integer.toString(count)+" parameters", location.toString()); - return true; - } - - private boolean checkParamCount(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, int countMin, int countMax) throws FHIRLexerException { - if (exp.getParameters().size() < countMin || exp.getParameters().size() > countMax) - throw lexer.error("The function \""+exp.getName()+"\" requires between "+Integer.toString(countMin)+" and "+Integer.toString(countMax)+" parameters", location.toString()); - return true; - } - - private boolean checkParameters(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, FunctionDetails details) throws FHIRLexerException { - switch (exp.getFunction()) { - case Empty: return checkParamCount(lexer, location, exp, 0); - case Not: return checkParamCount(lexer, location, exp, 0); - case Exists: return checkParamCount(lexer, location, exp, 0); - case SubsetOf: return checkParamCount(lexer, location, exp, 1); - case SupersetOf: return checkParamCount(lexer, location, exp, 1); - case IsDistinct: return checkParamCount(lexer, location, exp, 0); - case Distinct: return checkParamCount(lexer, location, exp, 0); - case Count: return checkParamCount(lexer, location, exp, 0); - case Where: return checkParamCount(lexer, location, exp, 1); - case Select: return checkParamCount(lexer, location, exp, 1); - case All: return checkParamCount(lexer, location, exp, 0, 1); - case Repeat: return checkParamCount(lexer, location, exp, 1); - case Item: return checkParamCount(lexer, location, exp, 1); - case As: return checkParamCount(lexer, location, exp, 1); - case Is: return checkParamCount(lexer, location, exp, 1); - case Single: return checkParamCount(lexer, location, exp, 0); - case First: return checkParamCount(lexer, location, exp, 0); - case Last: return checkParamCount(lexer, location, exp, 0); - case Tail: return checkParamCount(lexer, location, exp, 0); - case Skip: return checkParamCount(lexer, location, exp, 1); - case Take: return checkParamCount(lexer, location, exp, 1); - case Iif: return checkParamCount(lexer, location, exp, 2,3); - case ToInteger: return checkParamCount(lexer, location, exp, 0); - case ToDecimal: return checkParamCount(lexer, location, exp, 0); - case ToString: return checkParamCount(lexer, location, exp, 0); - case Substring: return checkParamCount(lexer, location, exp, 1, 2); - case StartsWith: return checkParamCount(lexer, location, exp, 1); - case EndsWith: return checkParamCount(lexer, location, exp, 1); - case Matches: return checkParamCount(lexer, location, exp, 1); - case ReplaceMatches: return checkParamCount(lexer, location, exp, 2); - case Contains: return checkParamCount(lexer, location, exp, 1); - case Replace: return checkParamCount(lexer, location, exp, 2); - case Length: return checkParamCount(lexer, location, exp, 0); - case Children: return checkParamCount(lexer, location, exp, 0); - case Descendants: return checkParamCount(lexer, location, exp, 0); - case MemberOf: return checkParamCount(lexer, location, exp, 1); - case Trace: return checkParamCount(lexer, location, exp, 1); - case Today: return checkParamCount(lexer, location, exp, 0); - case Now: return checkParamCount(lexer, location, exp, 0); - case Resolve: return checkParamCount(lexer, location, exp, 0); - case Extension: return checkParamCount(lexer, location, exp, 1); - case Custom: return checkParamCount(lexer, location, exp, details.getMinParameters(), details.getMaxParameters()); - } - return false; - } - - private List execute(ExecutionContext context, List focus, ExpressionNode exp, boolean atEntry) throws PathEngineException { -// System.out.println("Evaluate {'"+exp.toString()+"'} on "+focus.toString()); - List work = new ArrayList(); - switch (exp.getKind()) { - case Name: - if (atEntry && exp.getName().equals("$this")) - work.add(context.getThisItem()); - else - for (Base item : focus) { - List outcome = execute(context, item, exp, atEntry); - for (Base base : outcome) - if (base != null) - work.add(base); - } - break; - case Function: - List work2 = evaluateFunction(context, focus, exp); - work.addAll(work2); - break; - case Constant: - Base b = processConstant(context, exp.getConstant()); - if (b != null) - work.add(b); - break; - case Group: - work2 = execute(context, focus, exp.getGroup(), atEntry); - work.addAll(work2); - } - - if (exp.getInner() != null) - work = execute(context, work, exp.getInner(), false); - - if (exp.isProximal() && exp.getOperation() != null) { - ExpressionNode next = exp.getOpNext(); - ExpressionNode last = exp; - while (next != null) { - List work2 = preOperate(work, last.getOperation()); - if (work2 != null) - work = work2; - else if (last.getOperation() == Operation.Is || last.getOperation() == Operation.As) { - work2 = executeTypeName(context, focus, next, false); - work = operate(work, last.getOperation(), work2); - } else { - work2 = execute(context, focus, next, true); - work = operate(work, last.getOperation(), work2); -// System.out.println("Result of {'"+last.toString()+" "+last.getOperation().toCode()+" "+next.toString()+"'}: "+focus.toString()); - } - last = next; - next = next.getOpNext(); - } - } -// System.out.println("Result of {'"+exp.toString()+"'}: "+work.toString()); - return work; - } - - private List executeTypeName(ExecutionContext context, List focus, ExpressionNode next, boolean atEntry) { - List result = new ArrayList(); - result.add(new StringType(next.getName())); - return result; - } - - - private List preOperate(List left, Operation operation) { - switch (operation) { - case And: - return isBoolean(left, false) ? makeBoolean(false) : null; - case Or: - return isBoolean(left, true) ? makeBoolean(true) : null; - case Implies: - return convertToBoolean(left) ? null : makeBoolean(true); - default: - return null; - } - } - - private List makeBoolean(boolean b) { - List res = new ArrayList(); - res.add(new BooleanType(b)); - return res; - } - - private TypeDetails executeTypeName(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { - return new TypeDetails(CollectionStatus.SINGLETON, exp.getName()); - } - - private TypeDetails executeType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { -// System.out.println("Evaluate {'"+exp.toString()+"'} on "+focus.toString()); - TypeDetails result = new TypeDetails(null); - switch (exp.getKind()) { - case Name: - if (atEntry && exp.getName().equals("$this")) - result.update(context.getThisItem()); - else { - for (String s : focus.getTypes()) { - result.update(executeType(s, exp, atEntry)); - } - if (result.hasNoTypes()) - throw new PathEngineException("The name "+exp.getName()+" is not valid for any of the possible types: "+focus.describe()); - } - break; - case Function: - result.update(evaluateFunctionType(context, focus, exp)); - break; - case Constant: - result.addType(readConstantType(context, exp.getConstant())); - break; - case Group: - result.update(executeType(context, focus, exp.getGroup(), atEntry)); - } - exp.setTypes(result); - - if (exp.getInner() != null) { - result = executeType(context, result, exp.getInner(), false); - } - - if (exp.isProximal() && exp.getOperation() != null) { - ExpressionNode next = exp.getOpNext(); - ExpressionNode last = exp; - while (next != null) { - TypeDetails work; - if (last.getOperation() == Operation.Is || last.getOperation() == Operation.As) - work = executeTypeName(context, focus, next, atEntry); - else - work = executeType(context, focus, next, atEntry); - result = operateTypes(result, last.getOperation(), work); - last = next; - next = next.getOpNext(); - } - exp.setOpTypes(result); - } - return result; - } - - private Base processConstant(ExecutionContext context, String constant) throws PathEngineException { - if (constant.equals("true")) { - return new BooleanType(true); - } else if (constant.equals("false")) { - return new BooleanType(false); - } else if (constant.equals("{}")) { - return null; - } else if (Utilities.isInteger(constant)) { - return new IntegerType(constant); - } else if (Utilities.isDecimal(constant)) { - return new DecimalType(constant); - } else if (constant.startsWith("\'")) { - return new StringType(processConstantString(constant)); - } else if (constant.startsWith("%")) { - return resolveConstant(context, constant); - } else if (constant.startsWith("@")) { - return processDateConstant(context.appInfo, constant.substring(1)); - } else { - return new StringType(constant); - } - } - - private Base processDateConstant(Object appInfo, String value) throws PathEngineException { - if (value.startsWith("T")) - return new TimeType(value.substring(1)); - String v = value; - if (v.length() > 10) { - int i = v.substring(10).indexOf("-"); - if (i == -1) - i = v.substring(10).indexOf("+"); - if (i == -1) - i = v.substring(10).indexOf("Z"); - v = i == -1 ? value : v.substring(0, 10+i); - } - if (v.length() > 10) - return new DateTimeType(value); - else - return new DateType(value); - } - - - private Base resolveConstant(ExecutionContext context, String s) throws PathEngineException { - if (s.equals("%sct")) - return new StringType("http://snomed.info/sct"); - else if (s.equals("%loinc")) - return new StringType("http://loinc.org"); - else if (s.equals("%ucum")) - return new StringType("http://unitsofmeasure.org"); - else if (s.equals("%context")) - return context.context; - else if (s.equals("%resource")) { - if (context.resource == null) - throw new PathEngineException("Cannot use %resource in this context"); - return context.resource; - } else if (s.equals("%us-zip")) - return new StringType("[0-9]{5}(-[0-9]{4}){0,1}"); - else if (s.startsWith("%\"vs-")) - return new StringType("http://hl7.org/fhir/ValueSet/"+s.substring(5, s.length()-1)+""); - else if (s.startsWith("%\"cs-")) - return new StringType("http://hl7.org/fhir/"+s.substring(5, s.length()-1)+""); - else if (s.startsWith("%\"ext-")) - return new StringType("http://hl7.org/fhir/StructureDefinition/"+s.substring(6, s.length()-1)); - else if (hostServices == null) - throw new PathEngineException("Unknown fixed constant '"+s+"'"); - else - return hostServices.resolveConstant(context.appInfo, s); - } - - - private String processConstantString(String s) throws PathEngineException { - StringBuilder b = new StringBuilder(); - int i = 1; - while (i < s.length()-1) { - char ch = s.charAt(i); - if (ch == '\\') { - i++; - switch (s.charAt(i)) { - case 't': - b.append('\t'); - break; - case 'r': - b.append('\r'); - break; - case 'n': - b.append('\n'); - break; - case 'f': - b.append('\f'); - break; - case '\'': - b.append('\''); - break; - case '\\': - b.append('\\'); - break; - case '/': - b.append('/'); - break; - case 'u': - i++; - int uc = Integer.parseInt(s.substring(i, i+4), 16); - b.append((char) uc); - i = i + 4; - break; - default: - throw new PathEngineException("Unknown character escape \\"+s.charAt(i)); - } - } else { - b.append(ch); - i++; - } - } - return b.toString(); - } - - - private List operate(List left, Operation operation, List right) throws PathEngineException { - switch (operation) { - case Equals: return opEquals(left, right); - case Equivalent: return opEquivalent(left, right); - case NotEquals: return opNotEquals(left, right); - case NotEquivalent: return opNotEquivalent(left, right); - case LessThen: return opLessThen(left, right); - case Greater: return opGreater(left, right); - case LessOrEqual: return opLessOrEqual(left, right); - case GreaterOrEqual: return opGreaterOrEqual(left, right); - case Union: return opUnion(left, right); - case In: return opIn(left, right); - case Contains: return opContains(left, right); - case Or: return opOr(left, right); - case And: return opAnd(left, right); - case Xor: return opXor(left, right); - case Implies: return opImplies(left, right); - case Plus: return opPlus(left, right); - case Times: return opTimes(left, right); - case Minus: return opMinus(left, right); - case Concatenate: return opConcatenate(left, right); - case DivideBy: return opDivideBy(left, right); - case Div: return opDiv(left, right); - case Mod: return opMod(left, right); - case Is: return opIs(left, right); - case As: return opAs(left, right); - default: - throw new Error("Not Done Yet: "+operation.toCode()); - } - } - - private List opAs(List left, List right) { - List result = new ArrayList(); - if (left.size() != 1 || right.size() != 1) - return result; - else { - String tn = convertToString(right); - if (tn.equals(left.get(0).fhirType())) - result.add(left.get(0)); - } - return result; - } - - - private List opIs(List left, List right) { - List result = new ArrayList(); - if (left.size() != 1 || right.size() != 1) - result.add(new BooleanType(false)); - else { - String tn = convertToString(right); - result.add(new BooleanType(left.get(0).hasType(tn))); - } - return result; - } - - - private TypeDetails operateTypes(TypeDetails left, Operation operation, TypeDetails right) { - switch (operation) { - case Equals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Equivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case NotEquals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case NotEquivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case LessThen: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Greater: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case LessOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case GreaterOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Is: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case As: return new TypeDetails(CollectionStatus.SINGLETON, right.getTypes()); - case Union: return left.union(right); - case Or: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case And: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Xor: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Implies : return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Times: - TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("integer"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - return result; - case DivideBy: - result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("decimal"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - return result; - case Concatenate: - result = new TypeDetails(CollectionStatus.SINGLETON, ""); - case Plus: - result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("integer"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - else if (left.hasType(worker, "string", "id", "code", "uri") && right.hasType(worker, "string", "id", "code", "uri")) - result.addType("string"); - return result; - case Minus: - result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("integer"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - return result; - case Div: - case Mod: - result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("integer"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - return result; - case In: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Contains: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - default: - return null; - } - } - - - private List opEquals(List left, List right) { - if (left.size() != right.size()) - return makeBoolean(false); - - boolean res = true; - for (int i = 0; i < left.size(); i++) { - if (!doEquals(left.get(i), right.get(i))) { - res = false; - break; - } - } - return makeBoolean(res); - } - - private List opNotEquals(List left, List right) { - if (left.size() != right.size()) - return makeBoolean(true); - - boolean res = true; - for (int i = 0; i < left.size(); i++) { - if (!doEquals(left.get(i), right.get(i))) { - res = false; - break; - } - } - return makeBoolean(!res); - } - - private boolean doEquals(Base left, Base right) { - if (left.isPrimitive() && right.isPrimitive()) - return Base.equals(left.primitiveValue(), right.primitiveValue()); - else - return Base.compareDeep(left, right, false); - } - - private boolean doEquivalent(Base left, Base right) throws PathEngineException { - if (left.hasType("integer") && right.hasType("integer")) - return doEquals(left, right); - if (left.hasType("boolean") && right.hasType("boolean")) - return doEquals(left, right); - if (left.hasType("integer", "decimal") && right.hasType("integer", "decimal")) - return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue()); - if (left.hasType("date", "dateTime", "time", "instant") && right.hasType("date", "dateTime", "time", "instant")) - return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue()); - if (left.hasType("string", "id", "code", "uri") && right.hasType("string", "id", "code", "uri")) - return Utilities.equivalent(convertToString(left), convertToString(right)); - - throw new PathEngineException(String.format("Unable to determine equivalence between %s and %s", left.fhirType(), right.fhirType())); - } - - private List opEquivalent(List left, List right) throws PathEngineException { - if (left.size() != right.size()) - return makeBoolean(false); - - boolean res = true; - for (int i = 0; i < left.size(); i++) { - boolean found = false; - for (int j = 0; j < right.size(); j++) { - if (doEquivalent(left.get(i), right.get(j))) { - found = true; - break; - } - } - if (!found) { - res = false; - break; - } - } - return makeBoolean(res); - } - - private List opNotEquivalent(List left, List right) throws PathEngineException { - if (left.size() != right.size()) - return makeBoolean(true); - - boolean res = true; - for (int i = 0; i < left.size(); i++) { - boolean found = false; - for (int j = 0; j < right.size(); j++) { - if (doEquivalent(left.get(i), right.get(j))) { - found = true; - break; - } - } - if (!found) { - res = false; - break; - } - } - return makeBoolean(!res); - } - - private List opLessThen(List left, List right) throws PathEngineException { - if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string") && r.hasType("string")) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); - else if ((l.hasType("integer") || l.hasType("decimal")) && (r.hasType("integer") || r.hasType("decimal"))) - return makeBoolean(new Double(l.primitiveValue()) < new Double(r.primitiveValue())); - else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); - else if ((l.hasType("time")) && (r.hasType("time"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); - } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { - List lUnit = left.get(0).listChildrenByName("unit"); - List rUnit = right.get(0).listChildrenByName("unit"); - if (Base.compareDeep(lUnit, rUnit, true)) { - return opLessThen(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); - } else { - throw new PathEngineException("Canonical Comparison isn't done yet"); - } - } - return new ArrayList(); - } - - private List opGreater(List left, List right) throws PathEngineException { - if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string") && r.hasType("string")) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); - else if ((l.hasType("integer", "decimal")) && (r.hasType("integer", "decimal"))) - return makeBoolean(new Double(l.primitiveValue()) > new Double(r.primitiveValue())); - else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); - else if ((l.hasType("time")) && (r.hasType("time"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); - } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { - List lUnit = left.get(0).listChildrenByName("unit"); - List rUnit = right.get(0).listChildrenByName("unit"); - if (Base.compareDeep(lUnit, rUnit, true)) { - return opGreater(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); - } else { - throw new PathEngineException("Canonical Comparison isn't done yet"); - } - } - return new ArrayList(); - } - - private List opLessOrEqual(List left, List right) throws PathEngineException { - if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string") && r.hasType("string")) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); - else if ((l.hasType("integer", "decimal")) && (r.hasType("integer", "decimal"))) - return makeBoolean(new Double(l.primitiveValue()) <= new Double(r.primitiveValue())); - else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); - else if ((l.hasType("time")) && (r.hasType("time"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); - } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { - List lUnits = left.get(0).listChildrenByName("unit"); - String lunit = lUnits.size() == 1 ? lUnits.get(0).primitiveValue() : null; - List rUnits = right.get(0).listChildrenByName("unit"); - String runit = rUnits.size() == 1 ? rUnits.get(0).primitiveValue() : null; - if ((lunit == null && runit == null) || lunit.equals(runit)) { - return opLessOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); - } else { - throw new PathEngineException("Canonical Comparison isn't done yet"); - } - } - return new ArrayList(); - } - - private List opGreaterOrEqual(List left, List right) throws PathEngineException { - if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string") && r.hasType("string")) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); - else if ((l.hasType("integer", "decimal")) && (r.hasType("integer", "decimal"))) - return makeBoolean(new Double(l.primitiveValue()) >= new Double(r.primitiveValue())); - else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); - else if ((l.hasType("time")) && (r.hasType("time"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); - } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { - List lUnit = left.get(0).listChildrenByName("unit"); - List rUnit = right.get(0).listChildrenByName("unit"); - if (Base.compareDeep(lUnit, rUnit, true)) { - return opGreaterOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); - } else { - throw new PathEngineException("Canonical Comparison isn't done yet"); - } - } - return new ArrayList(); - } - - private List opIn(List left, List right) { - boolean ans = true; - for (Base l : left) { - boolean f = false; - for (Base r : right) - if (doEquals(l, r)) { - f = true; - break; - } - if (!f) { - ans = false; - break; - } - } - return makeBoolean(ans); - } - - private List opContains(List left, List right) { - boolean ans = true; - for (Base r : right) { - boolean f = false; - for (Base l : left) - if (doEquals(l, r)) { - f = true; - break; - } - if (!f) { - ans = false; - break; - } - } - return makeBoolean(ans); - } - - private List opPlus(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing +: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing +: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing +: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing +: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing +: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string", "id", "code", "uri") && r.hasType("string", "id", "code", "uri")) - result.add(new StringType(l.primitiveValue() + r.primitiveValue())); - else if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) - result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue())))); - else - throw new PathEngineException(String.format("Error performing +: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opTimes(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing *: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing *: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing *: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing *: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing *: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) * Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) - result.add(new DecimalType(new BigDecimal(l.primitiveValue()).multiply(new BigDecimal(r.primitiveValue())))); - else - throw new PathEngineException(String.format("Error performing *: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opConcatenate(List left, List right) { - List result = new ArrayList(); - result.add(new StringType(convertToString(left) + convertToString((right)))); - return result; - } - - private List opUnion(List left, List right) { - List result = new ArrayList(); - for (Base item : left) { - if (!doContains(result, item)) - result.add(item); - } - for (Base item : right) { - if (!doContains(result, item)) - result.add(item); - } - return result; - } - - private boolean doContains(List list, Base item) { - for (Base test : list) - if (doEquals(test, item)) - return true; - return false; - } - - - private List opAnd(List left, List right) { - if (left.isEmpty() && right.isEmpty()) - return new ArrayList(); - else if (isBoolean(left, false) || isBoolean(right, false)) - return makeBoolean(false); - else if (left.isEmpty() || right.isEmpty()) - return new ArrayList(); - else if (convertToBoolean(left) && convertToBoolean(right)) - return makeBoolean(true); - else - return makeBoolean(false); - } - - private boolean isBoolean(List list, boolean b) { - return list.size() == 1 && list.get(0) instanceof BooleanType && ((BooleanType) list.get(0)).booleanValue() == b; - } - - private List opOr(List left, List right) { - if (left.isEmpty() && right.isEmpty()) - return new ArrayList(); - else if (convertToBoolean(left) || convertToBoolean(right)) - return makeBoolean(true); - else if (left.isEmpty() || right.isEmpty()) - return new ArrayList(); - else - return makeBoolean(false); - } - - private List opXor(List left, List right) { - if (left.isEmpty() && right.isEmpty()) - return makeBoolean(false); - else - return makeBoolean(convertToBoolean(left) ^ convertToBoolean(right)); - } - - private List opImplies(List left, List right) { - if (!convertToBoolean(left)) - return makeBoolean(true); - else if (right.size() == 0) - return new ArrayList(); - else - return makeBoolean(convertToBoolean(right)); - } - - - private List opMinus(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing -: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing -: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing -: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing -: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing -: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) - Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) - result.add(new DecimalType(new BigDecimal(l.primitiveValue()).subtract(new BigDecimal(r.primitiveValue())))); - else - throw new PathEngineException(String.format("Error performing -: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opDivideBy(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing /: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing /: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing /: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing /: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing /: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer", "decimal") && r.hasType("integer", "decimal")) { - Decimal d1; - try { - d1 = new Decimal(l.primitiveValue()); - Decimal d2 = new Decimal(r.primitiveValue()); - result.add(new DecimalType(d1.divide(d2).asDecimal())); - } catch (UcumException e) { - throw new PathEngineException(e); - } - } - else - throw new PathEngineException(String.format("Error performing /: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opDiv(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing div: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing div: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing div: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing div: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing div: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing div: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) / Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { - Decimal d1; - try { - d1 = new Decimal(l.primitiveValue()); - Decimal d2 = new Decimal(r.primitiveValue()); - result.add(new IntegerType(d1.divInt(d2).asDecimal())); - } catch (UcumException e) { - throw new PathEngineException(e); - } - } - else - throw new PathEngineException(String.format("Error performing div: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opMod(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing mod: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing mod: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing mod: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing mod: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing mod: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing mod: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) % Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { - Decimal d1; - try { - d1 = new Decimal(l.primitiveValue()); - Decimal d2 = new Decimal(r.primitiveValue()); - result.add(new DecimalType(d1.modulo(d2).asDecimal())); - } catch (UcumException e) { - throw new PathEngineException(e); - } - } - else - throw new PathEngineException(String.format("Error performing mod: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - - private String readConstantType(ExecutionTypeContext context, String constant) throws PathEngineException { - if (constant.equals("true")) - return "boolean"; - else if (constant.equals("false")) - return "boolean"; - else if (Utilities.isInteger(constant)) - return "integer"; - else if (Utilities.isDecimal(constant)) - return "decimal"; - else if (constant.startsWith("%")) - return resolveConstantType(context, constant); - else - return "string"; - } - - private String resolveConstantType(ExecutionTypeContext context, String s) throws PathEngineException { - if (s.equals("%sct")) - return "string"; - else if (s.equals("%loinc")) - return "string"; - else if (s.equals("%ucum")) - return "string"; - else if (s.equals("%context")) - return context.context; - else if (s.equals("%resource")) { - if (context.resource == null) - throw new PathEngineException("%resource cannot be used in this context"); - return context.resource; - } else if (s.equals("%map-codes")) - return "string"; - else if (s.equals("%us-zip")) - return "string"; - else if (s.startsWith("%\"vs-")) - return "string"; - else if (s.startsWith("%\"cs-")) - return "string"; - else if (s.startsWith("%\"ext-")) - return "string"; - else if (hostServices == null) - throw new PathEngineException("Unknown fixed constant type for '"+s+"'"); - else - return hostServices.resolveConstantType(context.appInfo, s); - } - - private List execute(ExecutionContext context, Base item, ExpressionNode exp, boolean atEntry) { - List result = new ArrayList(); - if (atEntry && Character.isUpperCase(exp.getName().charAt(0))) {// special case for start up - if (item instanceof Resource && ((Resource) item).getResourceType().toString().equals(exp.getName())) - result.add(item); - } else - getChildrenByName(item, exp.getName(), result); - return result; - } - - private TypeDetails executeType(String type, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { - if (atEntry && Character.isUpperCase(exp.getName().charAt(0)) && type.equals(exp.getName())) // special case for start up - return new TypeDetails(CollectionStatus.SINGLETON, type); - TypeDetails result = new TypeDetails(null); - getChildTypesByName(type, exp.getName(), result); - return result; - } - - - @SuppressWarnings("unchecked") - private TypeDetails evaluateFunctionType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp) throws PathEngineException, DefinitionException { - List paramTypes = new ArrayList(); - if (exp.getFunction() == Function.Is || exp.getFunction() == Function.As) - paramTypes.add(new TypeDetails(CollectionStatus.SINGLETON, "string")); - else - for (ExpressionNode expr : exp.getParameters()) { - if (exp.getFunction() == Function.Where || exp.getFunction() == Function.Select) - paramTypes.add(executeType(changeThis(context, focus), focus, expr, true)); - else if (exp.getFunction() == Function.Repeat) - ; // it turns out you can't really test this - else - paramTypes.add(executeType(context, focus, expr, true)); - } - switch (exp.getFunction()) { - case Empty : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Not : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Exists : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case SubsetOf : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case SupersetOf : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case IsDistinct : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Distinct : - return focus; - case Count : - return new TypeDetails(CollectionStatus.SINGLETON, "integer"); - case Where : - return focus; - case Select : - return anything(focus.getCollectionStatus()); - case All : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Repeat : - return anything(focus.getCollectionStatus()); - case Item : { - checkOrdered(focus, "item"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); - return focus; - } - case As : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, exp.getParameters().get(0).getName()); - } - case Is : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case Single : - return focus.toSingleton(); - case First : { - checkOrdered(focus, "first"); - return focus.toSingleton(); - } - case Last : { - checkOrdered(focus, "last"); - return focus.toSingleton(); - } - case Tail : { - checkOrdered(focus, "tail"); - return focus; - } - case Skip : { - checkOrdered(focus, "skip"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); - return focus; - } - case Take : { - checkOrdered(focus, "take"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); - return focus; - } - case Iif : { - TypeDetails types = new TypeDetails(null); - types.update(paramTypes.get(0)); - if (paramTypes.size() > 1) - types.update(paramTypes.get(1)); - return types; - } - case ToInteger : { - checkContextPrimitive(focus, "toInteger"); - return new TypeDetails(CollectionStatus.SINGLETON, "integer"); - } - case ToDecimal : { - checkContextPrimitive(focus, "toDecimal"); - return new TypeDetails(CollectionStatus.SINGLETON, "decimal"); - } - case ToString : { - checkContextPrimitive(focus, "toString"); - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - } - case Substring : { - checkContextString(focus, "subString"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer"), new TypeDetails(CollectionStatus.SINGLETON, "integer")); - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - } - case StartsWith : { - checkContextString(focus, "startsWith"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case EndsWith : { - checkContextString(focus, "endsWith"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case Matches : { - checkContextString(focus, "matches"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case ReplaceMatches : { - checkContextString(focus, "replaceMatches"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - } - case Contains : { - checkContextString(focus, "contains"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case Replace : { - checkContextString(focus, "replace"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - } - case Length : { - checkContextPrimitive(focus, "length"); - return new TypeDetails(CollectionStatus.SINGLETON, "integer"); - } - case Children : - return childTypes(focus, "*"); - case Descendants : - return childTypes(focus, "**"); - case MemberOf : { - checkContextCoded(focus, "memberOf"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case Trace : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return focus; - } - case Today : - return new TypeDetails(CollectionStatus.SINGLETON, "date"); - case Now : - return new TypeDetails(CollectionStatus.SINGLETON, "dateTime"); - case Resolve : { - checkContextReference(focus, "resolve"); - return new TypeDetails(CollectionStatus.SINGLETON, "DomainResource"); - } - case Extension : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "Extension"); - } - case Custom : { - return hostServices.checkFunction(context.appInfo, exp.getName(), paramTypes); - } - default: - break; - } - throw new Error("not Implemented yet"); - } - - - private void checkParamTypes(String funcName, List paramTypes, TypeDetails... typeSet) throws PathEngineException { - int i = 0; - for (TypeDetails pt : typeSet) { - if (i == paramTypes.size()) - return; - TypeDetails actual = paramTypes.get(i); - i++; - for (String a : actual.getTypes()) { - if (!pt.hasType(worker, a)) - throw new PathEngineException("The parameter type '"+a+"' is not legal for "+funcName+" parameter "+Integer.toString(i)+". expecting "+pt.toString()); - } - } - } - - private void checkOrdered(TypeDetails focus, String name) throws PathEngineException { - if (focus.getCollectionStatus() == CollectionStatus.UNORDERED) - throw new PathEngineException("The function '"+name+"'() can only be used on ordered collections"); - } - - private void checkContextReference(TypeDetails focus, String name) throws PathEngineException { - if (!focus.hasType(worker, "string") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Reference")) - throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, Reference"); - } - - - private void checkContextCoded(TypeDetails focus, String name) throws PathEngineException { - if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Coding") && !focus.hasType(worker, "CodeableConcept")) - throw new PathEngineException("The function '"+name+"'() can only be used on string, code, uri, Coding, CodeableConcept"); - } - - - private void checkContextString(TypeDetails focus, String name) throws PathEngineException { - if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "id")) - throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, code, id, but found "+focus.describe()); - } - - - private void checkContextPrimitive(TypeDetails focus, String name) throws PathEngineException { - if (!focus.hasType(primitiveTypes)) - throw new PathEngineException("The function '"+name+"'() can only be used on "+primitiveTypes.toString()+", not "+focus.describe()); - } - - - private TypeDetails childTypes(TypeDetails focus, String mask) throws PathEngineException, DefinitionException { - TypeDetails result = new TypeDetails(CollectionStatus.UNORDERED); - for (String f : focus.getTypes()) - getChildTypesByName(f, mask, result); - return result; - } - - private TypeDetails anything(CollectionStatus status) { - return new TypeDetails(status, allTypes.keySet()); - } - - // private boolean isPrimitiveType(String s) { - // return s.equals("boolean") || s.equals("integer") || s.equals("decimal") || s.equals("base64Binary") || s.equals("instant") || s.equals("string") || s.equals("uri") || s.equals("date") || s.equals("dateTime") || s.equals("time") || s.equals("code") || s.equals("oid") || s.equals("id") || s.equals("unsignedInt") || s.equals("positiveInt") || s.equals("markdown"); - // } - - private List evaluateFunction(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - switch (exp.getFunction()) { - case Empty : return funcEmpty(context, focus, exp); - case Not : return funcNot(context, focus, exp); - case Exists : return funcExists(context, focus, exp); - case SubsetOf : return funcSubsetOf(context, focus, exp); - case SupersetOf : return funcSupersetOf(context, focus, exp); - case IsDistinct : return funcIsDistinct(context, focus, exp); - case Distinct : return funcDistinct(context, focus, exp); - case Count : return funcCount(context, focus, exp); - case Where : return funcWhere(context, focus, exp); - case Select : return funcSelect(context, focus, exp); - case All : return funcAll(context, focus, exp); - case Repeat : return funcRepeat(context, focus, exp); - case Item : return funcItem(context, focus, exp); - case As : return funcAs(context, focus, exp); - case Is : return funcIs(context, focus, exp); - case Single : return funcSingle(context, focus, exp); - case First : return funcFirst(context, focus, exp); - case Last : return funcLast(context, focus, exp); - case Tail : return funcTail(context, focus, exp); - case Skip : return funcSkip(context, focus, exp); - case Take : return funcTake(context, focus, exp); - case Iif : return funcIif(context, focus, exp); - case ToInteger : return funcToInteger(context, focus, exp); - case ToDecimal : return funcToDecimal(context, focus, exp); - case ToString : return funcToString(context, focus, exp); - case Substring : return funcSubstring(context, focus, exp); - case StartsWith : return funcStartsWith(context, focus, exp); - case EndsWith : return funcEndsWith(context, focus, exp); - case Matches : return funcMatches(context, focus, exp); - case ReplaceMatches : return funcReplaceMatches(context, focus, exp); - case Contains : return funcContains(context, focus, exp); - case Replace : return funcReplace(context, focus, exp); - case Length : return funcLength(context, focus, exp); - case Children : return funcChildren(context, focus, exp); - case Descendants : return funcDescendants(context, focus, exp); - case MemberOf : return funcMemberOf(context, focus, exp); - case Trace : return funcTrace(context, focus, exp); - case Today : return funcToday(context, focus, exp); - case Now : return funcNow(context, focus, exp); - case Resolve: return funcResolve(context, focus, exp); - case Extension: return funcExtension(context, focus, exp); - case Custom: { - List> params = new ArrayList>(); - for (ExpressionNode p : exp.getParameters()) - params.add(execute(context, focus, p, true)); - return hostServices.executeFunction(context.appInfo, exp.getName(), params); - } - default: - throw new Error("not Implemented yet"); - } - } - - private List funcAll(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - if (exp.getParameters().size() == 1) { - List result = new ArrayList(); - List pc = new ArrayList(); - boolean all = true; - for (Base item : focus) { - pc.clear(); - pc.add(item); - if (!convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), false))) { - all = false; - break; - } - } - result.add(new BooleanType(all)); - return result; - } else {// (exp.getParameters().size() == 0) { - List result = new ArrayList(); - boolean all = true; - for (Base item : focus) { - boolean v = false; - if (item instanceof BooleanType) { - v = ((BooleanType) item).booleanValue(); - } else - v = item != null; - if (!v) { - all = false; - break; - } - } - result.add(new BooleanType(all)); - return result; - } - } - - - private ExecutionContext changeThis(ExecutionContext context, Base newThis) { - return new ExecutionContext(context.appInfo, context.resource, context.context, newThis); - } - - private ExecutionTypeContext changeThis(ExecutionTypeContext context, TypeDetails newThis) { - return new ExecutionTypeContext(context.appInfo, context.resource, context.context, newThis); - } - - - private List funcNow(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - result.add(DateTimeType.now()); - return result; - } - - - private List funcToday(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - result.add(new DateType(new Date(), TemporalPrecisionEnum.DAY)); - return result; - } - - - private List funcMemberOf(ExecutionContext context, List focus, ExpressionNode exp) { - throw new Error("not Implemented yet"); - } - - - private List funcDescendants(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - List current = new ArrayList(); - current.addAll(focus); - List added = new ArrayList(); - boolean more = true; - while (more) { - added.clear(); - for (Base item : current) { - getChildrenByName(item, "*", added); - } - more = !added.isEmpty(); - result.addAll(added); - current.clear(); - current.addAll(added); - } - return result; - } - - - private List funcChildren(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - for (Base b : focus) - getChildrenByName(b, "*", result); - return result; - } - - - private List funcReplace(ExecutionContext context, List focus, ExpressionNode exp) { - throw new Error("not Implemented yet"); - } - - - private List funcReplaceMatches(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - - if (focus.size() == 1 && !Utilities.noString(sw)) - result.add(new BooleanType(convertToString(focus.get(0)).contains(sw))); - else - result.add(new BooleanType(false)); - return result; - } - - - private List funcEndsWith(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - - if (focus.size() == 1 && !Utilities.noString(sw)) - result.add(new BooleanType(convertToString(focus.get(0)).endsWith(sw))); - else - result.add(new BooleanType(false)); - return result; - } - - - private List funcToString(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - result.add(new StringType(convertToString(focus))); - return result; - } - - - private List funcToDecimal(ExecutionContext context, List focus, ExpressionNode exp) { - String s = convertToString(focus); - List result = new ArrayList(); - if (Utilities.isDecimal(s)) - result.add(new DecimalType(s)); - return result; - } - - - private List funcIif(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List n1 = execute(context, focus, exp.getParameters().get(0), true); - Boolean v = convertToBoolean(n1); - - if (v) - return execute(context, focus, exp.getParameters().get(1), true); - else if (exp.getParameters().size() < 3) - return new ArrayList(); - else - return execute(context, focus, exp.getParameters().get(2), true); - } - - - private List funcTake(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List n1 = execute(context, focus, exp.getParameters().get(0), true); - int i1 = Integer.parseInt(n1.get(0).primitiveValue()); - - List result = new ArrayList(); - for (int i = 0; i < Math.min(focus.size(), i1); i++) - result.add(focus.get(i)); - return result; - } - - - private List funcSingle(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - if (focus.size() == 1) - return focus; - throw new PathEngineException(String.format("Single() : checking for 1 item but found %d items", focus.size())); - } - - - private List funcIs(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - if (focus.size() == 0 || focus.size() > 1) - result.add(new BooleanType(false)); - else { - String tn = exp.getParameters().get(0).getName(); - result.add(new BooleanType(focus.get(0).hasType(tn))); - } - return result; - } - - - private List funcAs(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - String tn = exp.getParameters().get(0).getName(); - for (Base b : focus) - if (b.hasType(tn)) - result.add(b); - return result; - } - - - private List funcRepeat(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - List current = new ArrayList(); - current.addAll(focus); - List added = new ArrayList(); - boolean more = true; - while (more) { - added.clear(); - List pc = new ArrayList(); - for (Base item : current) { - pc.clear(); - pc.add(item); - added.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), false)); - } - more = !added.isEmpty(); - result.addAll(added); - current.clear(); - current.addAll(added); - } - return result; - } - - - - private List funcIsDistinct(ExecutionContext context, List focus, ExpressionNode exp) { - if (focus.size() <= 1) - return makeBoolean(true); - - boolean distinct = true; - for (int i = 0; i < focus.size(); i++) { - for (int j = i+1; j < focus.size(); j++) { - if (doEquals(focus.get(j), focus.get(i))) { - distinct = false; - break; - } - } - } - return makeBoolean(distinct); - } - - - private List funcSupersetOf(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List target = execute(context, focus, exp.getParameters().get(0), true); - - boolean valid = true; - for (Base item : target) { - boolean found = false; - for (Base t : focus) { - if (Base.compareDeep(item, t, false)) { - found = true; - break; - } - } - if (!found) { - valid = false; - break; - } - } - List result = new ArrayList(); - result.add(new BooleanType(valid)); - return result; - } - - - private List funcSubsetOf(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List target = execute(context, focus, exp.getParameters().get(0), true); - - boolean valid = true; - for (Base item : focus) { - boolean found = false; - for (Base t : target) { - if (Base.compareDeep(item, t, false)) { - found = true; - break; - } - } - if (!found) { - valid = false; - break; - } - } - List result = new ArrayList(); - result.add(new BooleanType(valid)); - return result; - } - - - private List funcExists(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - result.add(new BooleanType(!focus.isEmpty())); // R2 - can't use ElementUtil - return result; - } - - - private List funcResolve(ExecutionContext context, List focus, ExpressionNode exp) { - throw new Error("not Implemented yet"); - } - - private List funcExtension(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - List nl = execute(context, focus, exp.getParameters().get(0), true); - String url = nl.get(0).primitiveValue(); - - for (Base item : focus) { - List ext = new ArrayList(); - getChildrenByName(item, "extension", ext); - getChildrenByName(item, "modifierExtension", ext); - for (Base ex : ext) { - List vl = new ArrayList(); - getChildrenByName(ex, "url", vl); - if (convertToString(vl).equals(url)) - result.add(ex); - } - } - return result; - } - - private List funcTrace(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List nl = execute(context, focus, exp.getParameters().get(0), true); - String name = nl.get(0).primitiveValue(); - - log(name, focus); - return focus; - } - - private List funcDistinct(ExecutionContext context, List focus, ExpressionNode exp) { - if (focus.size() <= 1) - return focus; - - List result = new ArrayList(); - for (int i = 0; i < focus.size(); i++) { - boolean found = false; - for (int j = i+1; j < focus.size(); j++) { - if (doEquals(focus.get(j), focus.get(i))) { - found = true; - break; - } - } - if (!found) - result.add(focus.get(i)); - } - return result; - } - - private List funcMatches(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - - if (focus.size() == 1 && !Utilities.noString(sw)) - result.add(new BooleanType(convertToString(focus.get(0)).matches(sw))); - else - result.add(new BooleanType(false)); - return result; - } - - private List funcContains(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - - if (focus.size() == 1 && !Utilities.noString(sw)) - result.add(new BooleanType(convertToString(focus.get(0)).contains(sw))); - else - result.add(new BooleanType(false)); - return result; - } - - private List funcLength(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - if (focus.size() == 1) { - String s = convertToString(focus.get(0)); - result.add(new IntegerType(s.length())); - } - return result; - } - - private List funcStartsWith(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - - if (focus.size() == 1 && !Utilities.noString(sw)) - result.add(new BooleanType(convertToString(focus.get(0)).startsWith(sw))); - else - result.add(new BooleanType(false)); - return result; - } - - private List funcSubstring(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - List n1 = execute(context, focus, exp.getParameters().get(0), true); - int i1 = Integer.parseInt(n1.get(0).primitiveValue()); - int i2 = -1; - if (exp.parameterCount() == 2) { - List n2 = execute(context, focus, exp.getParameters().get(1), true); - i2 = Integer.parseInt(n2.get(0).primitiveValue()); - } - - if (focus.size() == 1) { - String sw = convertToString(focus.get(0)); - String s; - if (i1 < 0 || i1 >= sw.length()) - return new ArrayList(); - if (exp.parameterCount() == 2) - s = sw.substring(i1, Math.min(sw.length(), i1+i2)); - else - s = sw.substring(i1); - if (!Utilities.noString(s)) - result.add(new StringType(s)); - } - return result; - } - - private List funcToInteger(ExecutionContext context, List focus, ExpressionNode exp) { - String s = convertToString(focus); - List result = new ArrayList(); - if (Utilities.isInteger(s)) - result.add(new IntegerType(s)); - return result; - } - - private List funcCount(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - result.add(new IntegerType(focus.size())); - return result; - } - - private List funcSkip(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List n1 = execute(context, focus, exp.getParameters().get(0), true); - int i1 = Integer.parseInt(n1.get(0).primitiveValue()); - - List result = new ArrayList(); - for (int i = i1; i < focus.size(); i++) - result.add(focus.get(i)); - return result; - } - - private List funcTail(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - for (int i = 1; i < focus.size(); i++) - result.add(focus.get(i)); - return result; - } - - private List funcLast(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - if (focus.size() > 0) - result.add(focus.get(focus.size()-1)); - return result; - } - - private List funcFirst(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - if (focus.size() > 0) - result.add(focus.get(0)); - return result; - } - - - private List funcWhere(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - List pc = new ArrayList(); - for (Base item : focus) { - pc.clear(); - pc.add(item); - if (convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), true))) - result.add(item); - } - return result; - } - - private List funcSelect(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - List pc = new ArrayList(); - for (Base item : focus) { - pc.clear(); - pc.add(item); - result.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), true)); - } - return result; - } - - - private List funcItem(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - List result = new ArrayList(); - String s = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - if (Utilities.isInteger(s) && Integer.parseInt(s) < focus.size()) - result.add(focus.get(Integer.parseInt(s))); - return result; - } - - private List funcEmpty(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - result.add(new BooleanType(focus.isEmpty())); - return result; - } - - private List funcNot(ExecutionContext context, List focus, ExpressionNode exp) { - return makeBoolean(!convertToBoolean(focus)); - } - - public class ElementDefinitionMatch { - private ElementDefinition definition; - private String fixedType; - public ElementDefinitionMatch(ElementDefinition definition, String fixedType) { - super(); - this.definition = definition; - this.fixedType = fixedType; - } - public ElementDefinition getDefinition() { - return definition; - } - public String getFixedType() { - return fixedType; - } - - } - - private void getChildTypesByName(String type, String name, TypeDetails result) throws PathEngineException, DefinitionException { - if (Utilities.noString(type)) - throw new PathEngineException("No type provided in BuildToolPathEvaluator.getChildTypesByName"); - if (type.equals("xhtml")) - return; - String url = null; - if (type.contains(".")) { - url = "http://hl7.org/fhir/StructureDefinition/"+type.substring(0, type.indexOf(".")); - } else { - url = "http://hl7.org/fhir/StructureDefinition/"+type; - } - String tail = ""; - StructureDefinition sd = worker.fetchResource(StructureDefinition.class, url); - if (sd == null) - throw new DefinitionException("Unknown type "+type); // this really is an error, because we can only get to here if the internal infrastrucgture is wrong - List sdl = new ArrayList(); - ElementDefinitionMatch m = null; - if (type.contains(".")) - m = getElementDefinition(sd, type, false); - if (m != null && hasDataType(m.definition)) { - if (m.fixedType != null) - { - StructureDefinition dt = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+m.fixedType); - if (dt == null) - throw new DefinitionException("unknown data type "+m.fixedType); - sdl.add(dt); - } else - for (TypeRefComponent t : m.definition.getType()) { - StructureDefinition dt = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+t.getCode()); - if (dt == null) - throw new DefinitionException("unknown data type "+t.getCode()); - sdl.add(dt); - } - } else { - sdl.add(sd); - if (type.contains(".")) - tail = type.substring(type.indexOf(".")); - } - - for (StructureDefinition sdi : sdl) { - String path = sdi.getSnapshot().getElement().get(0).getPath()+tail+"."; - if (name.equals("**")) { - assert(result.getCollectionStatus() == CollectionStatus.UNORDERED); - for (ElementDefinition ed : sdi.getSnapshot().getElement()) { - if (ed.getPath().startsWith(path)) - for (TypeRefComponent t : ed.getType()) { - if (t.hasCode() && t.getCodeElement().hasValue()) { - String tn = null; - if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement")) - tn = ed.getPath(); - else - tn = t.getCode(); - if (t.getCode().equals("Resource")) { - for (String rn : worker.getResourceNames()) { - if (!result.hasType(worker, rn)) { - result.addType(rn); - getChildTypesByName(rn, "**", result); - } - } - } else if (!result.hasType(worker, tn)) { - result.addType(tn); - getChildTypesByName(tn, "**", result); - } - } - } - } - } else if (name.equals("*")) { - assert(result.getCollectionStatus() == CollectionStatus.UNORDERED); - for (ElementDefinition ed : sdi.getSnapshot().getElement()) { - if (ed.getPath().startsWith(path) && !ed.getPath().substring(path.length()).contains(".")) - for (TypeRefComponent t : ed.getType()) { - if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement")) - result.addType(ed.getPath()); - else if (t.getCode().equals("Resource")) - result.addTypes(worker.getResourceNames()); - else - result.addType(t.getCode()); - } - } - } else { - path = sdi.getSnapshot().getElement().get(0).getPath()+tail+"."+name; - - ElementDefinitionMatch ed = getElementDefinition(sdi, path, false); - if (ed != null) { - if (!Utilities.noString(ed.getFixedType())) - result.addType(ed.getFixedType()); - else - for (TypeRefComponent t : ed.getDefinition().getType()) { - if (Utilities.noString(t.getCode())) - break; // throw new PathEngineException("Illegal reference to primitive value attribute @ "+path); - - if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement")) - result.addType(path); - else if (t.getCode().equals("Resource")) - result.addTypes(worker.getResourceNames()); - else - result.addType(t.getCode()); - } - } - } - } - } - - private ElementDefinitionMatch getElementDefinition(StructureDefinition sd, String path, boolean allowTypedName) throws PathEngineException { - for (ElementDefinition ed : sd.getSnapshot().getElement()) { - if (ed.getPath().equals(path)) { - if (ed.hasNameReference()) { - return getElementDefinitionByName(sd, ed.getNameReference()); - } else - return new ElementDefinitionMatch(ed, null); - } - if (ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() == ed.getPath().length()-3) - return new ElementDefinitionMatch(ed, null); - if (allowTypedName && ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() > ed.getPath().length()-3) { - String s = Utilities.uncapitalize(path.substring(ed.getPath().length()-3)); - if (primitiveTypes.contains(s)) - return new ElementDefinitionMatch(ed, s); - else - return new ElementDefinitionMatch(ed, path.substring(ed.getPath().length()-3)); - } - if (ed.getPath().contains(".") && path.startsWith(ed.getPath()+".") && (ed.getType().size() > 0) && !isAbstractType(ed.getType())) { - // now we walk into the type. - if (ed.getType().size() > 1) // if there's more than one type, the test above would fail this - throw new PathEngineException("Internal typing issue...."); - StructureDefinition nsd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+ed.getType().get(0).getCode()); - if (nsd == null) - throw new PathEngineException("Unknown type "+ed.getType().get(0).getCode()); - return getElementDefinition(nsd, nsd.getId()+path.substring(ed.getPath().length()), allowTypedName); - } - if (ed.hasNameReference() && path.startsWith(ed.getPath()+".")) { - ElementDefinitionMatch m = getElementDefinitionByName(sd, ed.getNameReference()); - return getElementDefinition(sd, m.definition.getPath()+path.substring(ed.getPath().length()), allowTypedName); - } - } - return null; - } - - private boolean isAbstractType(List list) { - return list.size() != 1 ? false : Utilities.existsInList(list.get(0).getCode(), "Element", "BackboneElement", "Resource", "DomainResource"); -} - - - private boolean hasType(ElementDefinition ed, String s) { - for (TypeRefComponent t : ed.getType()) - if (s.equalsIgnoreCase(t.getCode())) - return true; - return false; - } - - private boolean hasDataType(ElementDefinition ed) { - return ed.hasType() && !(ed.getType().get(0).getCode().equals("Element") || ed.getType().get(0).getCode().equals("BackboneElement")); - } - - private ElementDefinitionMatch getElementDefinitionByName(StructureDefinition sd, String ref) { - for (ElementDefinition ed : sd.getSnapshot().getElement()) { - if (ref.equals(ed.getName())) - return new ElementDefinitionMatch(ed, null); - } - return null; - } - - - public boolean hasLog() { - return log != null && log.length() > 0; - } - - - public String takeLog() { - if (!hasLog()) - return ""; - String s = log.toString(); - log = new StringBuilder(); - return s; - } - -} \ No newline at end of file +package org.hl7.fhir.instance.utils; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.hl7.fhir.instance.model.Base; +import org.hl7.fhir.instance.model.BooleanType; +import org.hl7.fhir.instance.model.DateTimeType; +import org.hl7.fhir.instance.model.DateType; +import org.hl7.fhir.instance.model.DecimalType; +import org.hl7.fhir.instance.model.ElementDefinition; +import org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent; +import org.hl7.fhir.instance.model.ExpressionNode; +import org.hl7.fhir.instance.model.ExpressionNode.CollectionStatus; +import org.hl7.fhir.instance.model.ExpressionNode.Function; +import org.hl7.fhir.instance.model.ExpressionNode.Kind; +import org.hl7.fhir.instance.model.ExpressionNode.Operation; +import org.hl7.fhir.instance.model.ExpressionNode.SourceLocation; +import org.hl7.fhir.instance.model.ExpressionNode.TypeDetails; +import org.hl7.fhir.instance.model.IntegerType; +import org.hl7.fhir.instance.model.Resource; +import org.hl7.fhir.instance.model.StringType; +import org.hl7.fhir.instance.model.StructureDefinition; +import org.hl7.fhir.instance.model.TemporalPrecisionEnum; +import org.hl7.fhir.instance.model.TimeType; +import org.hl7.fhir.instance.model.Type; +import org.hl7.fhir.instance.utils.FHIRLexer.FHIRLexerException; +import org.hl7.fhir.instance.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails; +import org.hl7.fhir.exceptions.DefinitionException; +import org.hl7.fhir.exceptions.PathEngineException; +import org.hl7.fhir.exceptions.UcumException; +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.ucum.Decimal; + + +/** + * + * @author Grahame Grieve + * + */ +public class FHIRPathEngine { + private IWorkerContext worker; + private IEvaluationContext hostServices; + private StringBuilder log = new StringBuilder(); + private Set primitiveTypes = new HashSet(); + private Map allTypes = new HashMap(); + + // if the fhir path expressions are allowed to use constants beyond those defined in the specification + // the application can implement them by providing a constant resolver + public interface IEvaluationContext { + public class FunctionDetails { + private String description; + private int minParameters; + private int maxParameters; + public FunctionDetails(String description, int minParameters, int maxParameters) { + super(); + this.description = description; + this.minParameters = minParameters; + this.maxParameters = maxParameters; + } + public String getDescription() { + return description; + } + public int getMinParameters() { + return minParameters; + } + public int getMaxParameters() { + return maxParameters; + } + + } + + public Type resolveConstant(Object appContext, String name); + public String resolveConstantType(Object appContext, String name); + public boolean Log(String argument, List focus); + + // extensibility for functions + /** + * + * @param functionName + * @return null if the function is not known + */ + public FunctionDetails resolveFunction(String functionName); + + /** + * Check the function parameters, and throw an error if they are incorrect, or return the type for the function + * @param functionName + * @param parameters + * @return + */ + public TypeDetails checkFunction(Object appContext, String functionName, List parameters) throws PathEngineException; + + /** + * @param appContext + * @param functionName + * @param parameters + * @return + */ + public List executeFunction(Object appContext, String functionName, List> parameters); + } + + + /** + * @param worker - used when validating paths (@check), and used doing value set membership when executing tests (once that's defined) + */ + public FHIRPathEngine(IWorkerContext worker) { + super(); + this.worker = worker; + primitiveTypes.add("string"); + primitiveTypes.add("code"); + primitiveTypes.add("integer"); + primitiveTypes.add("boolean"); + primitiveTypes.add("decimal"); + primitiveTypes.add("date"); + primitiveTypes.add("dateTime"); +// for (StructureDefinition sd : worker.allStructures()) { +// if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) +// allTypes.put(sd.getName(), sd); +// if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) { +// primitiveTypes.add(sd.getName()); +// } +// } + } + + + // --- 3 methods to override in children ------------------------------------------------------- + // if you don't override, it falls through to the using the base reference implementation + // HAPI overrides to these to support extensing the base model + + public IEvaluationContext getConstantResolver() { + return hostServices; + } + + + public void setConstantResolver(IEvaluationContext constantResolver) { + this.hostServices = constantResolver; + } + + + /** + * Given an item, return all the children that conform to the pattern described in name + * + * Possible patterns: + * - a simple name (which may be the base of a name with [] e.g. value[x]) + * - a name with a type replacement e.g. valueCodeableConcept + * - * which means all children + * - ** which means all descendants + * + * @param item + * @param name + * @param result + * @ + */ + protected void getChildrenByName(Base item, String name, List result) { + List list = item.listChildrenByName(name); + if (list != null) + for (Base v : list) + if (v != null) + result.add(v); + } + + // --- public API ------------------------------------------------------- + /** + * Parse a path for later use using execute + * + * @param path + * @return + * @throws PathEngineException + * @throws Exception + */ + public ExpressionNode parse(String path) throws FHIRLexerException { + path = path.replace("$.", "$this."); + FHIRLexer lexer = new FHIRLexer(path); + if (lexer.done()) + throw lexer.error("Path cannot be empty"); + ExpressionNode result = parseExpression(lexer, true); + if (!lexer.done()) + throw lexer.error("Premature ExpressionNode termination at unexpected token \""+lexer.getCurrent()+"\""); + result.check(); + return result; + } + + /** + * Parse a path that is part of some other syntax + * + * @param path + * @return + * @throws PathEngineException + * @throws Exception + */ + public ExpressionNode parse(FHIRLexer lexer) throws FHIRLexerException { + ExpressionNode result = parseExpression(lexer, true); + result.check(); + return result; + } + + /** + * check that paths referred to in the ExpressionNode are valid + * + * xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath + * + * returns a list of the possible types that might be returned by executing the ExpressionNode against a particular context + * + * @param context - the logical type against which this path is applied + * @param path - the FHIR Path statement to check + * @throws DefinitionException + * @throws PathEngineException + * @if the path is not valid + */ + public TypeDetails check(Object appContext, String resourceType, String context, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException { + // if context is a path that refers to a type, do that conversion now + TypeDetails types; + if (!context.contains(".")) + types = new TypeDetails(CollectionStatus.SINGLETON, context); + else { + StructureDefinition sd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+context.substring(0, context.indexOf('.'))); + if (sd == null) + throw new PathEngineException("Unknown context "+context); + ElementDefinitionMatch ed = getElementDefinition(sd, context, true); + if (ed == null) + throw new PathEngineException("Unknown context element "+context); + if (ed.fixedType != null) + types = new TypeDetails(CollectionStatus.SINGLETON, ed.fixedType); + else if (ed.getDefinition().getType().isEmpty() || ( isAbstractType(ed.getDefinition().getType()))) + types = new TypeDetails(CollectionStatus.SINGLETON, context); + else { + types = new TypeDetails(CollectionStatus.SINGLETON); + for (TypeRefComponent t : ed.getDefinition().getType()) + types.addType(t.getCode()); + } + } + + return executeType(new ExecutionTypeContext(appContext, resourceType, context, types), types, expr, true); + } + + public TypeDetails check(Object appContext, String resourceType, String context, String expr) throws FHIRLexerException, PathEngineException, DefinitionException { + return check(appContext, resourceType, context, parse(expr)); + } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param ExpressionNode - the parsed ExpressionNode statement to use + * @return + * @throws PathEngineException + * @ + * @ + */ + public List evaluate(Base base, ExpressionNode ExpressionNode) throws PathEngineException { + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(null, null, base, base), list, ExpressionNode, true); + } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRLexerException + * @throws PathEngineException + * @ + * @ + */ + public List evaluate(Base base, String path) throws FHIRLexerException, PathEngineException { + ExpressionNode exp = parse(path); + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(null, null, base, base), list, exp, true); + } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param ExpressionNode - the parsed ExpressionNode statement to use + * @return + * @throws PathEngineException + * @ + * @ + */ + public List evaluate(Object appContext, Resource resource, Base base, ExpressionNode ExpressionNode) throws PathEngineException { + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(appContext, resource, base, base), list, ExpressionNode, true); + } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param ExpressionNode - the parsed ExpressionNode statement to use + * @return + * @throws PathEngineException + * @ + * @ + */ + public List evaluate(Object appContext, Base resource, Base base, ExpressionNode ExpressionNode) throws PathEngineException { + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(appContext, resource, base, base), list, ExpressionNode, true); + } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws PathEngineException + * @throws FHIRLexerException + * @ + * @ + */ + public List evaluate(Object appContext, Resource resource, Base base, String path) throws PathEngineException, FHIRLexerException { + ExpressionNode exp = parse(path); + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(appContext, resource, base, base), list, exp, true); + } + + /** + * evaluate a path and return true or false (e.g. for an invariant) + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRLexerException + * @throws PathEngineException + * @ + * @ + */ + public boolean evaluateToBoolean(Resource resource, Base base, String path) throws PathEngineException, FHIRLexerException { + return convertToBoolean(evaluate(null, resource, base, path)); + } + + /** + * evaluate a path and return true or false (e.g. for an invariant) + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws PathEngineException + * @ + * @ + */ + public boolean evaluateToBoolean(Resource resource, Base base, ExpressionNode node) throws PathEngineException { + return convertToBoolean(evaluate(null, resource, base, node)); + } + + /** + * evaluate a path and return true or false (e.g. for an invariant) + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws PathEngineException + * @ + * @ + */ + public boolean evaluateToBoolean(Base resource, Base base, ExpressionNode node) throws PathEngineException { + return convertToBoolean(evaluate(null, resource, base, node)); + } + + /** + * evaluate a path and a string containing the outcome (for display) + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRLexerException + * @throws PathEngineException + * @ + * @ + */ + public String evaluateToString(Base base, String path) throws FHIRLexerException, PathEngineException { + return convertToString(evaluate(base, path)); + } + + /** + * worker routine for converting a set of objects to a string representation + * + * @param items - result from @evaluate + * @return + */ + public String convertToString(List items) { + StringBuilder b = new StringBuilder(); + boolean first = true; + for (Base item : items) { + if (first) + first = false; + else + b.append(','); + + b.append(convertToString(item)); + } + return b.toString(); + } + + private String convertToString(Base item) { + if (item.isPrimitive()) + return item.primitiveValue(); + else + return item.getClass().getName(); + } + + /** + * worker routine for converting a set of objects to a boolean representation (for invariants) + * + * @param items - result from @evaluate + * @return + */ + public boolean convertToBoolean(List items) { + if (items == null) + return false; + else if (items.size() == 1 && items.get(0) instanceof BooleanType) + return ((BooleanType) items.get(0)).getValue(); + else + return items.size() > 0; + } + + + private void log(String name, List contents) { + if (hostServices == null || !hostServices.Log(name, contents)) { + if (log.length() > 0) + log.append("; "); + log.append(name); + log.append(": "); + boolean first = true; + for (Base b : contents) { + if (first) + first = false; + else + log.append(","); + log.append(convertToString(b)); + } + } + } + + public String forLog() { + if (log.length() > 0) + return " ("+log.toString()+")"; + else + return ""; + } + + private class ExecutionContext { + private Object appInfo; + private Base resource; + private Base context; + private Base thisItem; + public ExecutionContext(Object appInfo, Base resource, Base context, Base thisItem) { + this.appInfo = appInfo; + this.resource = resource; + this.context = context; + this.thisItem = thisItem; + } + public Base getResource() { + return resource; + } + public Base getThisItem() { + return thisItem; + } + } + + private class ExecutionTypeContext { + private Object appInfo; + private String resource; + private String context; + private TypeDetails thisItem; + + + public ExecutionTypeContext(Object appInfo, String resource, String context, TypeDetails thisItem) { + super(); + this.appInfo = appInfo; + this.resource = resource; + this.context = context; + this.thisItem = thisItem; + } + public String getResource() { + return resource; + } + public TypeDetails getThisItem() { + return thisItem; + } + } + + private ExpressionNode parseExpression(FHIRLexer lexer, boolean proximal) throws FHIRLexerException { + ExpressionNode result = new ExpressionNode(lexer.nextId()); + SourceLocation c = lexer.getCurrentStartLocation(); + result.setStart(lexer.getCurrentLocation()); + // special: + if (lexer.getCurrent().equals("-")) { + lexer.take(); + lexer.setCurrent("-"+lexer.getCurrent()); + } + if (lexer.getCurrent().equals("+")) { + lexer.take(); + lexer.setCurrent("+"+lexer.getCurrent()); + } + if (lexer.isConstant(false)) { + checkConstant(lexer.getCurrent(), lexer); + result.setConstant(lexer.take()); + result.setKind(Kind.Constant); + result.setEnd(lexer.getCurrentLocation()); + } else if ("(".equals(lexer.getCurrent())) { + lexer.next(); + result.setKind(Kind.Group); + result.setGroup(parseExpression(lexer, true)); + if (!")".equals(lexer.getCurrent())) + throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\""); + result.setEnd(lexer.getCurrentLocation()); + lexer.next(); + } else { + if (!lexer.isToken() && !lexer.getCurrent().startsWith("\"")) + throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name"); + if (lexer.getCurrent().startsWith("\"")) + result.setName(lexer.readConstant("Path Name")); + else + result.setName(lexer.take()); + result.setEnd(lexer.getCurrentLocation()); + if (!result.checkName()) + throw lexer.error("Found "+result.getName()+" expecting a valid token name"); + if ("(".equals(lexer.getCurrent())) { + Function f = Function.fromCode(result.getName()); + FunctionDetails details = null; + if (f == null) { + details = hostServices != null ? hostServices.resolveFunction(result.getName()) : null; + if (details == null) + throw lexer.error("The name "+result.getName()+" is not a valid function name"); + f = Function.Custom; + } + result.setKind(Kind.Function); + result.setFunction(f); + lexer.next(); + while (!")".equals(lexer.getCurrent())) { + result.getParameters().add(parseExpression(lexer, true)); + if (",".equals(lexer.getCurrent())) + lexer.next(); + else if (!")".equals(lexer.getCurrent())) + throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - either a \",\" or a \")\" expected"); + } + result.setEnd(lexer.getCurrentLocation()); + lexer.next(); + checkParameters(lexer, c, result, details); + } else + result.setKind(Kind.Name); + } + ExpressionNode focus = result; + if ("[".equals(lexer.getCurrent())) { + lexer.next(); + ExpressionNode item = new ExpressionNode(lexer.nextId()); + item.setKind(Kind.Function); + item.setFunction(ExpressionNode.Function.Item); + item.getParameters().add(parseExpression(lexer, true)); + if (!lexer.getCurrent().equals("]")) + throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - a \"]\" expected"); + lexer.next(); + result.setInner(item); + focus = item; + } + if (".".equals(lexer.getCurrent())) { + lexer.next(); + focus.setInner(parseExpression(lexer, false)); + } + result.setProximal(proximal); + if (proximal) { + while (lexer.isOp()) { + focus.setOperation(ExpressionNode.Operation.fromCode(lexer.getCurrent())); + focus.setOpStart(lexer.getCurrentStartLocation()); + focus.setOpEnd(lexer.getCurrentLocation()); + lexer.next(); + focus.setOpNext(parseExpression(lexer, false)); + focus = focus.getOpNext(); + } + result = organisePrecedence(lexer, result); + } + return result; + } + + private ExpressionNode organisePrecedence(FHIRLexer lexer, ExpressionNode node) { + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Times, Operation.DivideBy, Operation.Div, Operation.Mod)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Plus, Operation.Minus, Operation.Concatenate)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Union)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.LessThen, Operation.Greater, Operation.LessOrEqual, Operation.GreaterOrEqual)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Is)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Equals, Operation.Equivalent, Operation.NotEquals, Operation.NotEquivalent)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.And)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Xor, Operation.Or)); + // last: implies + return node; + } + + private ExpressionNode gatherPrecedence(FHIRLexer lexer, ExpressionNode start, EnumSet ops) { + // work : boolean; + // focus, node, group : ExpressionNode; + + assert(start.isProximal()); + + // is there anything to do? + boolean work = false; + ExpressionNode focus = start.getOpNext(); + if (ops.contains(start.getOperation())) { + while (focus != null && focus.getOperation() != null) { + work = work || !ops.contains(focus.getOperation()); + focus = focus.getOpNext(); + } + } else { + while (focus != null && focus.getOperation() != null) { + work = work || ops.contains(focus.getOperation()); + focus = focus.getOpNext(); + } + } + if (!work) + return start; + + // entry point: tricky + ExpressionNode group; + if (ops.contains(start.getOperation())) { + group = newGroup(lexer, start); + group.setProximal(true); + focus = start; + start = group; + } else { + ExpressionNode node = start; + + focus = node.getOpNext(); + while (!ops.contains(focus.getOperation())) { + node = focus; + focus = focus.getOpNext(); + } + group = newGroup(lexer, focus); + node.setOpNext(group); + } + + // now, at this point: + // group is the group we are adding to, it already has a .group property filled out. + // focus points at the group.group + do { + // run until we find the end of the sequence + while (ops.contains(focus.getOperation())) + focus = focus.getOpNext(); + if (focus.getOperation() != null) { + group.setOperation(focus.getOperation()); + group.setOpNext(focus.getOpNext()); + focus.setOperation(null); + focus.setOpNext(null); + // now look for another sequence, and start it + ExpressionNode node = group; + focus = group.getOpNext(); + if (focus != null) { + while (focus == null && !ops.contains(focus.getOperation())) { + node = focus; + focus = focus.getOpNext(); + } + if (focus != null) { // && (focus.Operation in Ops) - must be true + group = newGroup(lexer, focus); + node.setOpNext(group); + } + } + } + } + while (focus != null && focus.getOperation() != null); + return start; + } + + + private ExpressionNode newGroup(FHIRLexer lexer, ExpressionNode next) { + ExpressionNode result = new ExpressionNode(lexer.nextId()); + result.setKind(Kind.Group); + result.setGroup(next); + result.getGroup().setProximal(true); + return result; + } + + private void checkConstant(String s, FHIRLexer lexer) throws FHIRLexerException { + if (s.startsWith("\'") && s.endsWith("\'")) { + int i = 1; + while (i < s.length()-1) { + char ch = s.charAt(i); + if (ch == '\\') { + switch (ch) { + case 't': + case 'r': + case 'n': + case 'f': + case '\'': + case '\\': + case '/': + i++; + break; + case 'u': + if (!Utilities.isHex("0x"+s.substring(i, i+4))) + throw lexer.error("Improper unicode escape \\u"+s.substring(i, i+4)); + break; + default: + throw lexer.error("Unknown character escape \\"+ch); + } + } else + i++; + } + } + } + + // procedure CheckParamCount(c : integer); + // begin + // if exp.Parameters.Count <> c then + // raise lexer.error('The function "'+exp.name+'" requires '+inttostr(c)+' parameters', offset); + // end; + + private boolean checkParamCount(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, int count) throws FHIRLexerException { + if (exp.getParameters().size() != count) + throw lexer.error("The function \""+exp.getName()+"\" requires "+Integer.toString(count)+" parameters", location.toString()); + return true; + } + + private boolean checkParamCount(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, int countMin, int countMax) throws FHIRLexerException { + if (exp.getParameters().size() < countMin || exp.getParameters().size() > countMax) + throw lexer.error("The function \""+exp.getName()+"\" requires between "+Integer.toString(countMin)+" and "+Integer.toString(countMax)+" parameters", location.toString()); + return true; + } + + private boolean checkParameters(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, FunctionDetails details) throws FHIRLexerException { + switch (exp.getFunction()) { + case Empty: return checkParamCount(lexer, location, exp, 0); + case Not: return checkParamCount(lexer, location, exp, 0); + case Exists: return checkParamCount(lexer, location, exp, 0); + case SubsetOf: return checkParamCount(lexer, location, exp, 1); + case SupersetOf: return checkParamCount(lexer, location, exp, 1); + case IsDistinct: return checkParamCount(lexer, location, exp, 0); + case Distinct: return checkParamCount(lexer, location, exp, 0); + case Count: return checkParamCount(lexer, location, exp, 0); + case Where: return checkParamCount(lexer, location, exp, 1); + case Select: return checkParamCount(lexer, location, exp, 1); + case All: return checkParamCount(lexer, location, exp, 0, 1); + case Repeat: return checkParamCount(lexer, location, exp, 1); + case Item: return checkParamCount(lexer, location, exp, 1); + case As: return checkParamCount(lexer, location, exp, 1); + case Is: return checkParamCount(lexer, location, exp, 1); + case Single: return checkParamCount(lexer, location, exp, 0); + case First: return checkParamCount(lexer, location, exp, 0); + case Last: return checkParamCount(lexer, location, exp, 0); + case Tail: return checkParamCount(lexer, location, exp, 0); + case Skip: return checkParamCount(lexer, location, exp, 1); + case Take: return checkParamCount(lexer, location, exp, 1); + case Iif: return checkParamCount(lexer, location, exp, 2,3); + case ToInteger: return checkParamCount(lexer, location, exp, 0); + case ToDecimal: return checkParamCount(lexer, location, exp, 0); + case ToString: return checkParamCount(lexer, location, exp, 0); + case Substring: return checkParamCount(lexer, location, exp, 1, 2); + case StartsWith: return checkParamCount(lexer, location, exp, 1); + case EndsWith: return checkParamCount(lexer, location, exp, 1); + case Matches: return checkParamCount(lexer, location, exp, 1); + case ReplaceMatches: return checkParamCount(lexer, location, exp, 2); + case Contains: return checkParamCount(lexer, location, exp, 1); + case Replace: return checkParamCount(lexer, location, exp, 2); + case Length: return checkParamCount(lexer, location, exp, 0); + case Children: return checkParamCount(lexer, location, exp, 0); + case Descendants: return checkParamCount(lexer, location, exp, 0); + case MemberOf: return checkParamCount(lexer, location, exp, 1); + case Trace: return checkParamCount(lexer, location, exp, 1); + case Today: return checkParamCount(lexer, location, exp, 0); + case Now: return checkParamCount(lexer, location, exp, 0); + case Resolve: return checkParamCount(lexer, location, exp, 0); + case Extension: return checkParamCount(lexer, location, exp, 1); + case Custom: return checkParamCount(lexer, location, exp, details.getMinParameters(), details.getMaxParameters()); + } + return false; + } + + private List execute(ExecutionContext context, List focus, ExpressionNode exp, boolean atEntry) throws PathEngineException { +// System.out.println("Evaluate {'"+exp.toString()+"'} on "+focus.toString()); + List work = new ArrayList(); + switch (exp.getKind()) { + case Name: + if (atEntry && exp.getName().equals("$this")) + work.add(context.getThisItem()); + else + for (Base item : focus) { + List outcome = execute(context, item, exp, atEntry); + for (Base base : outcome) + if (base != null) + work.add(base); + } + break; + case Function: + List work2 = evaluateFunction(context, focus, exp); + work.addAll(work2); + break; + case Constant: + Base b = processConstant(context, exp.getConstant()); + if (b != null) + work.add(b); + break; + case Group: + work2 = execute(context, focus, exp.getGroup(), atEntry); + work.addAll(work2); + } + + if (exp.getInner() != null) + work = execute(context, work, exp.getInner(), false); + + if (exp.isProximal() && exp.getOperation() != null) { + ExpressionNode next = exp.getOpNext(); + ExpressionNode last = exp; + while (next != null) { + List work2 = preOperate(work, last.getOperation()); + if (work2 != null) + work = work2; + else if (last.getOperation() == Operation.Is || last.getOperation() == Operation.As) { + work2 = executeTypeName(context, focus, next, false); + work = operate(work, last.getOperation(), work2); + } else { + work2 = execute(context, focus, next, true); + work = operate(work, last.getOperation(), work2); +// System.out.println("Result of {'"+last.toString()+" "+last.getOperation().toCode()+" "+next.toString()+"'}: "+focus.toString()); + } + last = next; + next = next.getOpNext(); + } + } +// System.out.println("Result of {'"+exp.toString()+"'}: "+work.toString()); + return work; + } + + private List executeTypeName(ExecutionContext context, List focus, ExpressionNode next, boolean atEntry) { + List result = new ArrayList(); + result.add(new StringType(next.getName())); + return result; + } + + + private List preOperate(List left, Operation operation) { + switch (operation) { + case And: + return isBoolean(left, false) ? makeBoolean(false) : null; + case Or: + return isBoolean(left, true) ? makeBoolean(true) : null; + case Implies: + return convertToBoolean(left) ? null : makeBoolean(true); + default: + return null; + } + } + + private List makeBoolean(boolean b) { + List res = new ArrayList(); + res.add(new BooleanType(b)); + return res; + } + + private TypeDetails executeTypeName(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { + return new TypeDetails(CollectionStatus.SINGLETON, exp.getName()); + } + + private TypeDetails executeType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { +// System.out.println("Evaluate {'"+exp.toString()+"'} on "+focus.toString()); + TypeDetails result = new TypeDetails(null); + switch (exp.getKind()) { + case Name: + if (atEntry && exp.getName().equals("$this")) + result.update(context.getThisItem()); + else { + for (String s : focus.getTypes()) { + result.update(executeType(s, exp, atEntry)); + } + if (result.hasNoTypes()) + throw new PathEngineException("The name "+exp.getName()+" is not valid for any of the possible types: "+focus.describe()); + } + break; + case Function: + result.update(evaluateFunctionType(context, focus, exp)); + break; + case Constant: + result.addType(readConstantType(context, exp.getConstant())); + break; + case Group: + result.update(executeType(context, focus, exp.getGroup(), atEntry)); + } + exp.setTypes(result); + + if (exp.getInner() != null) { + result = executeType(context, result, exp.getInner(), false); + } + + if (exp.isProximal() && exp.getOperation() != null) { + ExpressionNode next = exp.getOpNext(); + ExpressionNode last = exp; + while (next != null) { + TypeDetails work; + if (last.getOperation() == Operation.Is || last.getOperation() == Operation.As) + work = executeTypeName(context, focus, next, atEntry); + else + work = executeType(context, focus, next, atEntry); + result = operateTypes(result, last.getOperation(), work); + last = next; + next = next.getOpNext(); + } + exp.setOpTypes(result); + } + return result; + } + + private Base processConstant(ExecutionContext context, String constant) throws PathEngineException { + if (constant.equals("true")) { + return new BooleanType(true); + } else if (constant.equals("false")) { + return new BooleanType(false); + } else if (constant.equals("{}")) { + return null; + } else if (Utilities.isInteger(constant)) { + return new IntegerType(constant); + } else if (Utilities.isDecimal(constant)) { + return new DecimalType(constant); + } else if (constant.startsWith("\'")) { + return new StringType(processConstantString(constant)); + } else if (constant.startsWith("%")) { + return resolveConstant(context, constant); + } else if (constant.startsWith("@")) { + return processDateConstant(context.appInfo, constant.substring(1)); + } else { + return new StringType(constant); + } + } + + private Base processDateConstant(Object appInfo, String value) throws PathEngineException { + if (value.startsWith("T")) + return new TimeType(value.substring(1)); + String v = value; + if (v.length() > 10) { + int i = v.substring(10).indexOf("-"); + if (i == -1) + i = v.substring(10).indexOf("+"); + if (i == -1) + i = v.substring(10).indexOf("Z"); + v = i == -1 ? value : v.substring(0, 10+i); + } + if (v.length() > 10) + return new DateTimeType(value); + else + return new DateType(value); + } + + + private Base resolveConstant(ExecutionContext context, String s) throws PathEngineException { + if (s.equals("%sct")) + return new StringType("http://snomed.info/sct"); + else if (s.equals("%loinc")) + return new StringType("http://loinc.org"); + else if (s.equals("%ucum")) + return new StringType("http://unitsofmeasure.org"); + else if (s.equals("%context")) + return context.context; + else if (s.equals("%resource")) { + if (context.resource == null) + throw new PathEngineException("Cannot use %resource in this context"); + return context.resource; + } else if (s.equals("%us-zip")) + return new StringType("[0-9]{5}(-[0-9]{4}){0,1}"); + else if (s.startsWith("%\"vs-")) + return new StringType("http://hl7.org/fhir/ValueSet/"+s.substring(5, s.length()-1)+""); + else if (s.startsWith("%\"cs-")) + return new StringType("http://hl7.org/fhir/"+s.substring(5, s.length()-1)+""); + else if (s.startsWith("%\"ext-")) + return new StringType("http://hl7.org/fhir/StructureDefinition/"+s.substring(6, s.length()-1)); + else if (hostServices == null) + throw new PathEngineException("Unknown fixed constant '"+s+"'"); + else + return hostServices.resolveConstant(context.appInfo, s); + } + + + private String processConstantString(String s) throws PathEngineException { + StringBuilder b = new StringBuilder(); + int i = 1; + while (i < s.length()-1) { + char ch = s.charAt(i); + if (ch == '\\') { + i++; + switch (s.charAt(i)) { + case 't': + b.append('\t'); + break; + case 'r': + b.append('\r'); + break; + case 'n': + b.append('\n'); + break; + case 'f': + b.append('\f'); + break; + case '\'': + b.append('\''); + break; + case '\\': + b.append('\\'); + break; + case '/': + b.append('/'); + break; + case 'u': + i++; + int uc = Integer.parseInt(s.substring(i, i+4), 16); + b.append((char) uc); + i = i + 4; + break; + default: + throw new PathEngineException("Unknown character escape \\"+s.charAt(i)); + } + } else { + b.append(ch); + i++; + } + } + return b.toString(); + } + + + private List operate(List left, Operation operation, List right) throws PathEngineException { + switch (operation) { + case Equals: return opEquals(left, right); + case Equivalent: return opEquivalent(left, right); + case NotEquals: return opNotEquals(left, right); + case NotEquivalent: return opNotEquivalent(left, right); + case LessThen: return opLessThen(left, right); + case Greater: return opGreater(left, right); + case LessOrEqual: return opLessOrEqual(left, right); + case GreaterOrEqual: return opGreaterOrEqual(left, right); + case Union: return opUnion(left, right); + case In: return opIn(left, right); + case Contains: return opContains(left, right); + case Or: return opOr(left, right); + case And: return opAnd(left, right); + case Xor: return opXor(left, right); + case Implies: return opImplies(left, right); + case Plus: return opPlus(left, right); + case Times: return opTimes(left, right); + case Minus: return opMinus(left, right); + case Concatenate: return opConcatenate(left, right); + case DivideBy: return opDivideBy(left, right); + case Div: return opDiv(left, right); + case Mod: return opMod(left, right); + case Is: return opIs(left, right); + case As: return opAs(left, right); + default: + throw new Error("Not Done Yet: "+operation.toCode()); + } + } + + private List opAs(List left, List right) { + List result = new ArrayList(); + if (left.size() != 1 || right.size() != 1) + return result; + else { + String tn = convertToString(right); + if (tn.equals(left.get(0).fhirType())) + result.add(left.get(0)); + } + return result; + } + + + private List opIs(List left, List right) { + List result = new ArrayList(); + if (left.size() != 1 || right.size() != 1) + result.add(new BooleanType(false)); + else { + String tn = convertToString(right); + result.add(new BooleanType(left.get(0).hasType(tn))); + } + return result; + } + + + private TypeDetails operateTypes(TypeDetails left, Operation operation, TypeDetails right) { + switch (operation) { + case Equals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Equivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case NotEquals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case NotEquivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case LessThen: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Greater: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case LessOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case GreaterOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Is: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case As: return new TypeDetails(CollectionStatus.SINGLETON, right.getTypes()); + case Union: return left.union(right); + case Or: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case And: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Xor: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Implies : return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Times: + TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("integer"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + return result; + case DivideBy: + result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("decimal"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + return result; + case Concatenate: + result = new TypeDetails(CollectionStatus.SINGLETON, ""); + return result; + case Plus: + result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("integer"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + else if (left.hasType(worker, "string", "id", "code", "uri") && right.hasType(worker, "string", "id", "code", "uri")) + result.addType("string"); + return result; + case Minus: + result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("integer"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + return result; + case Div: + case Mod: + result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("integer"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + return result; + case In: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Contains: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + default: + return null; + } + } + + + private List opEquals(List left, List right) { + if (left.size() != right.size()) + return makeBoolean(false); + + boolean res = true; + for (int i = 0; i < left.size(); i++) { + if (!doEquals(left.get(i), right.get(i))) { + res = false; + break; + } + } + return makeBoolean(res); + } + + private List opNotEquals(List left, List right) { + if (left.size() != right.size()) + return makeBoolean(true); + + boolean res = true; + for (int i = 0; i < left.size(); i++) { + if (!doEquals(left.get(i), right.get(i))) { + res = false; + break; + } + } + return makeBoolean(!res); + } + + private boolean doEquals(Base left, Base right) { + if (left.isPrimitive() && right.isPrimitive()) + return Base.equals(left.primitiveValue(), right.primitiveValue()); + else + return Base.compareDeep(left, right, false); + } + + private boolean doEquivalent(Base left, Base right) throws PathEngineException { + if (left.hasType("integer") && right.hasType("integer")) + return doEquals(left, right); + if (left.hasType("boolean") && right.hasType("boolean")) + return doEquals(left, right); + if (left.hasType("integer", "decimal") && right.hasType("integer", "decimal")) + return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue()); + if (left.hasType("date", "dateTime", "time", "instant") && right.hasType("date", "dateTime", "time", "instant")) + return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue()); + if (left.hasType("string", "id", "code", "uri") && right.hasType("string", "id", "code", "uri")) + return Utilities.equivalent(convertToString(left), convertToString(right)); + + throw new PathEngineException(String.format("Unable to determine equivalence between %s and %s", left.fhirType(), right.fhirType())); + } + + private List opEquivalent(List left, List right) throws PathEngineException { + if (left.size() != right.size()) + return makeBoolean(false); + + boolean res = true; + for (int i = 0; i < left.size(); i++) { + boolean found = false; + for (int j = 0; j < right.size(); j++) { + if (doEquivalent(left.get(i), right.get(j))) { + found = true; + break; + } + } + if (!found) { + res = false; + break; + } + } + return makeBoolean(res); + } + + private List opNotEquivalent(List left, List right) throws PathEngineException { + if (left.size() != right.size()) + return makeBoolean(true); + + boolean res = true; + for (int i = 0; i < left.size(); i++) { + boolean found = false; + for (int j = 0; j < right.size(); j++) { + if (doEquivalent(left.get(i), right.get(j))) { + found = true; + break; + } + } + if (!found) { + res = false; + break; + } + } + return makeBoolean(!res); + } + + private List opLessThen(List left, List right) throws PathEngineException { + if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string") && r.hasType("string")) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); + else if ((l.hasType("integer") || l.hasType("decimal")) && (r.hasType("integer") || r.hasType("decimal"))) + return makeBoolean(new Double(l.primitiveValue()) < new Double(r.primitiveValue())); + else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); + else if ((l.hasType("time")) && (r.hasType("time"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); + } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { + List lUnit = left.get(0).listChildrenByName("unit"); + List rUnit = right.get(0).listChildrenByName("unit"); + if (Base.compareDeep(lUnit, rUnit, true)) { + return opLessThen(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); + } else { + throw new PathEngineException("Canonical Comparison isn't done yet"); + } + } + return new ArrayList(); + } + + private List opGreater(List left, List right) throws PathEngineException { + if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string") && r.hasType("string")) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); + else if ((l.hasType("integer", "decimal")) && (r.hasType("integer", "decimal"))) + return makeBoolean(new Double(l.primitiveValue()) > new Double(r.primitiveValue())); + else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); + else if ((l.hasType("time")) && (r.hasType("time"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); + } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { + List lUnit = left.get(0).listChildrenByName("unit"); + List rUnit = right.get(0).listChildrenByName("unit"); + if (Base.compareDeep(lUnit, rUnit, true)) { + return opGreater(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); + } else { + throw new PathEngineException("Canonical Comparison isn't done yet"); + } + } + return new ArrayList(); + } + + private List opLessOrEqual(List left, List right) throws PathEngineException { + if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string") && r.hasType("string")) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); + else if ((l.hasType("integer", "decimal")) && (r.hasType("integer", "decimal"))) + return makeBoolean(new Double(l.primitiveValue()) <= new Double(r.primitiveValue())); + else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); + else if ((l.hasType("time")) && (r.hasType("time"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); + } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { + List lUnits = left.get(0).listChildrenByName("unit"); + String lunit = lUnits.size() == 1 ? lUnits.get(0).primitiveValue() : null; + List rUnits = right.get(0).listChildrenByName("unit"); + String runit = rUnits.size() == 1 ? rUnits.get(0).primitiveValue() : null; + if ((lunit == null && runit == null) || lunit.equals(runit)) { + return opLessOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); + } else { + throw new PathEngineException("Canonical Comparison isn't done yet"); + } + } + return new ArrayList(); + } + + private List opGreaterOrEqual(List left, List right) throws PathEngineException { + if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string") && r.hasType("string")) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); + else if ((l.hasType("integer", "decimal")) && (r.hasType("integer", "decimal"))) + return makeBoolean(new Double(l.primitiveValue()) >= new Double(r.primitiveValue())); + else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); + else if ((l.hasType("time")) && (r.hasType("time"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); + } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { + List lUnit = left.get(0).listChildrenByName("unit"); + List rUnit = right.get(0).listChildrenByName("unit"); + if (Base.compareDeep(lUnit, rUnit, true)) { + return opGreaterOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); + } else { + throw new PathEngineException("Canonical Comparison isn't done yet"); + } + } + return new ArrayList(); + } + + private List opIn(List left, List right) { + boolean ans = true; + for (Base l : left) { + boolean f = false; + for (Base r : right) + if (doEquals(l, r)) { + f = true; + break; + } + if (!f) { + ans = false; + break; + } + } + return makeBoolean(ans); + } + + private List opContains(List left, List right) { + boolean ans = true; + for (Base r : right) { + boolean f = false; + for (Base l : left) + if (doEquals(l, r)) { + f = true; + break; + } + if (!f) { + ans = false; + break; + } + } + return makeBoolean(ans); + } + + private List opPlus(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing +: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing +: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing +: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing +: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing +: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string", "id", "code", "uri") && r.hasType("string", "id", "code", "uri")) + result.add(new StringType(l.primitiveValue() + r.primitiveValue())); + else if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) + result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue())))); + else + throw new PathEngineException(String.format("Error performing +: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opTimes(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing *: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing *: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing *: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing *: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing *: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) * Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) + result.add(new DecimalType(new BigDecimal(l.primitiveValue()).multiply(new BigDecimal(r.primitiveValue())))); + else + throw new PathEngineException(String.format("Error performing *: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opConcatenate(List left, List right) { + List result = new ArrayList(); + result.add(new StringType(convertToString(left) + convertToString((right)))); + return result; + } + + private List opUnion(List left, List right) { + List result = new ArrayList(); + for (Base item : left) { + if (!doContains(result, item)) + result.add(item); + } + for (Base item : right) { + if (!doContains(result, item)) + result.add(item); + } + return result; + } + + private boolean doContains(List list, Base item) { + for (Base test : list) + if (doEquals(test, item)) + return true; + return false; + } + + + private List opAnd(List left, List right) { + if (left.isEmpty() && right.isEmpty()) + return new ArrayList(); + else if (isBoolean(left, false) || isBoolean(right, false)) + return makeBoolean(false); + else if (left.isEmpty() || right.isEmpty()) + return new ArrayList(); + else if (convertToBoolean(left) && convertToBoolean(right)) + return makeBoolean(true); + else + return makeBoolean(false); + } + + private boolean isBoolean(List list, boolean b) { + return list.size() == 1 && list.get(0) instanceof BooleanType && ((BooleanType) list.get(0)).booleanValue() == b; + } + + private List opOr(List left, List right) { + if (left.isEmpty() && right.isEmpty()) + return new ArrayList(); + else if (convertToBoolean(left) || convertToBoolean(right)) + return makeBoolean(true); + else if (left.isEmpty() || right.isEmpty()) + return new ArrayList(); + else + return makeBoolean(false); + } + + private List opXor(List left, List right) { + if (left.isEmpty() && right.isEmpty()) + return makeBoolean(false); + else + return makeBoolean(convertToBoolean(left) ^ convertToBoolean(right)); + } + + private List opImplies(List left, List right) { + if (!convertToBoolean(left)) + return makeBoolean(true); + else if (right.size() == 0) + return new ArrayList(); + else + return makeBoolean(convertToBoolean(right)); + } + + + private List opMinus(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing -: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing -: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing -: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing -: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing -: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) - Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) + result.add(new DecimalType(new BigDecimal(l.primitiveValue()).subtract(new BigDecimal(r.primitiveValue())))); + else + throw new PathEngineException(String.format("Error performing -: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opDivideBy(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing /: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing /: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing /: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing /: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing /: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer", "decimal") && r.hasType("integer", "decimal")) { + Decimal d1; + try { + d1 = new Decimal(l.primitiveValue()); + Decimal d2 = new Decimal(r.primitiveValue()); + result.add(new DecimalType(d1.divide(d2).asDecimal())); + } catch (UcumException e) { + throw new PathEngineException(e); + } + } + else + throw new PathEngineException(String.format("Error performing /: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opDiv(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing div: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing div: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing div: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing div: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing div: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing div: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) / Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { + Decimal d1; + try { + d1 = new Decimal(l.primitiveValue()); + Decimal d2 = new Decimal(r.primitiveValue()); + result.add(new IntegerType(d1.divInt(d2).asDecimal())); + } catch (UcumException e) { + throw new PathEngineException(e); + } + } + else + throw new PathEngineException(String.format("Error performing div: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opMod(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing mod: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing mod: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing mod: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing mod: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing mod: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing mod: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) % Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { + Decimal d1; + try { + d1 = new Decimal(l.primitiveValue()); + Decimal d2 = new Decimal(r.primitiveValue()); + result.add(new DecimalType(d1.modulo(d2).asDecimal())); + } catch (UcumException e) { + throw new PathEngineException(e); + } + } + else + throw new PathEngineException(String.format("Error performing mod: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + + private String readConstantType(ExecutionTypeContext context, String constant) throws PathEngineException { + if (constant.equals("true")) + return "boolean"; + else if (constant.equals("false")) + return "boolean"; + else if (Utilities.isInteger(constant)) + return "integer"; + else if (Utilities.isDecimal(constant)) + return "decimal"; + else if (constant.startsWith("%")) + return resolveConstantType(context, constant); + else + return "string"; + } + + private String resolveConstantType(ExecutionTypeContext context, String s) throws PathEngineException { + if (s.equals("%sct")) + return "string"; + else if (s.equals("%loinc")) + return "string"; + else if (s.equals("%ucum")) + return "string"; + else if (s.equals("%context")) + return context.context; + else if (s.equals("%resource")) { + if (context.resource == null) + throw new PathEngineException("%resource cannot be used in this context"); + return context.resource; + } else if (s.equals("%map-codes")) + return "string"; + else if (s.equals("%us-zip")) + return "string"; + else if (s.startsWith("%\"vs-")) + return "string"; + else if (s.startsWith("%\"cs-")) + return "string"; + else if (s.startsWith("%\"ext-")) + return "string"; + else if (hostServices == null) + throw new PathEngineException("Unknown fixed constant type for '"+s+"'"); + else + return hostServices.resolveConstantType(context.appInfo, s); + } + + private List execute(ExecutionContext context, Base item, ExpressionNode exp, boolean atEntry) { + List result = new ArrayList(); + if (atEntry && Character.isUpperCase(exp.getName().charAt(0))) {// special case for start up + if (item instanceof Resource && ((Resource) item).getResourceType().toString().equals(exp.getName())) + result.add(item); + } else + getChildrenByName(item, exp.getName(), result); + return result; + } + + private TypeDetails executeType(String type, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { + if (atEntry && Character.isUpperCase(exp.getName().charAt(0)) && type.equals(exp.getName())) // special case for start up + return new TypeDetails(CollectionStatus.SINGLETON, type); + TypeDetails result = new TypeDetails(null); + getChildTypesByName(type, exp.getName(), result); + return result; + } + + + @SuppressWarnings("unchecked") + private TypeDetails evaluateFunctionType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp) throws PathEngineException, DefinitionException { + List paramTypes = new ArrayList(); + if (exp.getFunction() == Function.Is || exp.getFunction() == Function.As) + paramTypes.add(new TypeDetails(CollectionStatus.SINGLETON, "string")); + else + for (ExpressionNode expr : exp.getParameters()) { + if (exp.getFunction() == Function.Where || exp.getFunction() == Function.Select) + paramTypes.add(executeType(changeThis(context, focus), focus, expr, true)); + else if (exp.getFunction() == Function.Repeat) + ; // it turns out you can't really test this + else + paramTypes.add(executeType(context, focus, expr, true)); + } + switch (exp.getFunction()) { + case Empty : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Not : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Exists : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case SubsetOf : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case SupersetOf : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case IsDistinct : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Distinct : + return focus; + case Count : + return new TypeDetails(CollectionStatus.SINGLETON, "integer"); + case Where : + return focus; + case Select : + return anything(focus.getCollectionStatus()); + case All : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Repeat : + return anything(focus.getCollectionStatus()); + case Item : { + checkOrdered(focus, "item"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); + return focus; + } + case As : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, exp.getParameters().get(0).getName()); + } + case Is : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case Single : + return focus.toSingleton(); + case First : { + checkOrdered(focus, "first"); + return focus.toSingleton(); + } + case Last : { + checkOrdered(focus, "last"); + return focus.toSingleton(); + } + case Tail : { + checkOrdered(focus, "tail"); + return focus; + } + case Skip : { + checkOrdered(focus, "skip"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); + return focus; + } + case Take : { + checkOrdered(focus, "take"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); + return focus; + } + case Iif : { + TypeDetails types = new TypeDetails(null); + types.update(paramTypes.get(0)); + if (paramTypes.size() > 1) + types.update(paramTypes.get(1)); + return types; + } + case ToInteger : { + checkContextPrimitive(focus, "toInteger"); + return new TypeDetails(CollectionStatus.SINGLETON, "integer"); + } + case ToDecimal : { + checkContextPrimitive(focus, "toDecimal"); + return new TypeDetails(CollectionStatus.SINGLETON, "decimal"); + } + case ToString : { + checkContextPrimitive(focus, "toString"); + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + } + case Substring : { + checkContextString(focus, "subString"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer"), new TypeDetails(CollectionStatus.SINGLETON, "integer")); + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + } + case StartsWith : { + checkContextString(focus, "startsWith"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case EndsWith : { + checkContextString(focus, "endsWith"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case Matches : { + checkContextString(focus, "matches"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case ReplaceMatches : { + checkContextString(focus, "replaceMatches"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + } + case Contains : { + checkContextString(focus, "contains"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case Replace : { + checkContextString(focus, "replace"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + } + case Length : { + checkContextPrimitive(focus, "length"); + return new TypeDetails(CollectionStatus.SINGLETON, "integer"); + } + case Children : + return childTypes(focus, "*"); + case Descendants : + return childTypes(focus, "**"); + case MemberOf : { + checkContextCoded(focus, "memberOf"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case Trace : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return focus; + } + case Today : + return new TypeDetails(CollectionStatus.SINGLETON, "date"); + case Now : + return new TypeDetails(CollectionStatus.SINGLETON, "dateTime"); + case Resolve : { + checkContextReference(focus, "resolve"); + return new TypeDetails(CollectionStatus.SINGLETON, "DomainResource"); + } + case Extension : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "Extension"); + } + case Custom : { + return hostServices.checkFunction(context.appInfo, exp.getName(), paramTypes); + } + default: + break; + } + throw new Error("not Implemented yet"); + } + + + private void checkParamTypes(String funcName, List paramTypes, TypeDetails... typeSet) throws PathEngineException { + int i = 0; + for (TypeDetails pt : typeSet) { + if (i == paramTypes.size()) + return; + TypeDetails actual = paramTypes.get(i); + i++; + for (String a : actual.getTypes()) { + if (!pt.hasType(worker, a)) + throw new PathEngineException("The parameter type '"+a+"' is not legal for "+funcName+" parameter "+Integer.toString(i)+". expecting "+pt.toString()); + } + } + } + + private void checkOrdered(TypeDetails focus, String name) throws PathEngineException { + if (focus.getCollectionStatus() == CollectionStatus.UNORDERED) + throw new PathEngineException("The function '"+name+"'() can only be used on ordered collections"); + } + + private void checkContextReference(TypeDetails focus, String name) throws PathEngineException { + if (!focus.hasType(worker, "string") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Reference")) + throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, Reference"); + } + + + private void checkContextCoded(TypeDetails focus, String name) throws PathEngineException { + if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Coding") && !focus.hasType(worker, "CodeableConcept")) + throw new PathEngineException("The function '"+name+"'() can only be used on string, code, uri, Coding, CodeableConcept"); + } + + + private void checkContextString(TypeDetails focus, String name) throws PathEngineException { + if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "id")) + throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, code, id, but found "+focus.describe()); + } + + + private void checkContextPrimitive(TypeDetails focus, String name) throws PathEngineException { + if (!focus.hasType(primitiveTypes)) + throw new PathEngineException("The function '"+name+"'() can only be used on "+primitiveTypes.toString()+", not "+focus.describe()); + } + + + private TypeDetails childTypes(TypeDetails focus, String mask) throws PathEngineException, DefinitionException { + TypeDetails result = new TypeDetails(CollectionStatus.UNORDERED); + for (String f : focus.getTypes()) + getChildTypesByName(f, mask, result); + return result; + } + + private TypeDetails anything(CollectionStatus status) { + return new TypeDetails(status, allTypes.keySet()); + } + + // private boolean isPrimitiveType(String s) { + // return s.equals("boolean") || s.equals("integer") || s.equals("decimal") || s.equals("base64Binary") || s.equals("instant") || s.equals("string") || s.equals("uri") || s.equals("date") || s.equals("dateTime") || s.equals("time") || s.equals("code") || s.equals("oid") || s.equals("id") || s.equals("unsignedInt") || s.equals("positiveInt") || s.equals("markdown"); + // } + + private List evaluateFunction(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + switch (exp.getFunction()) { + case Empty : return funcEmpty(context, focus, exp); + case Not : return funcNot(context, focus, exp); + case Exists : return funcExists(context, focus, exp); + case SubsetOf : return funcSubsetOf(context, focus, exp); + case SupersetOf : return funcSupersetOf(context, focus, exp); + case IsDistinct : return funcIsDistinct(context, focus, exp); + case Distinct : return funcDistinct(context, focus, exp); + case Count : return funcCount(context, focus, exp); + case Where : return funcWhere(context, focus, exp); + case Select : return funcSelect(context, focus, exp); + case All : return funcAll(context, focus, exp); + case Repeat : return funcRepeat(context, focus, exp); + case Item : return funcItem(context, focus, exp); + case As : return funcAs(context, focus, exp); + case Is : return funcIs(context, focus, exp); + case Single : return funcSingle(context, focus, exp); + case First : return funcFirst(context, focus, exp); + case Last : return funcLast(context, focus, exp); + case Tail : return funcTail(context, focus, exp); + case Skip : return funcSkip(context, focus, exp); + case Take : return funcTake(context, focus, exp); + case Iif : return funcIif(context, focus, exp); + case ToInteger : return funcToInteger(context, focus, exp); + case ToDecimal : return funcToDecimal(context, focus, exp); + case ToString : return funcToString(context, focus, exp); + case Substring : return funcSubstring(context, focus, exp); + case StartsWith : return funcStartsWith(context, focus, exp); + case EndsWith : return funcEndsWith(context, focus, exp); + case Matches : return funcMatches(context, focus, exp); + case ReplaceMatches : return funcReplaceMatches(context, focus, exp); + case Contains : return funcContains(context, focus, exp); + case Replace : return funcReplace(context, focus, exp); + case Length : return funcLength(context, focus, exp); + case Children : return funcChildren(context, focus, exp); + case Descendants : return funcDescendants(context, focus, exp); + case MemberOf : return funcMemberOf(context, focus, exp); + case Trace : return funcTrace(context, focus, exp); + case Today : return funcToday(context, focus, exp); + case Now : return funcNow(context, focus, exp); + case Resolve: return funcResolve(context, focus, exp); + case Extension: return funcExtension(context, focus, exp); + case Custom: { + List> params = new ArrayList>(); + for (ExpressionNode p : exp.getParameters()) + params.add(execute(context, focus, p, true)); + return hostServices.executeFunction(context.appInfo, exp.getName(), params); + } + default: + throw new Error("not Implemented yet"); + } + } + + private List funcAll(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + if (exp.getParameters().size() == 1) { + List result = new ArrayList(); + List pc = new ArrayList(); + boolean all = true; + for (Base item : focus) { + pc.clear(); + pc.add(item); + if (!convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), false))) { + all = false; + break; + } + } + result.add(new BooleanType(all)); + return result; + } else {// (exp.getParameters().size() == 0) { + List result = new ArrayList(); + boolean all = true; + for (Base item : focus) { + boolean v = false; + if (item instanceof BooleanType) { + v = ((BooleanType) item).booleanValue(); + } else + v = item != null; + if (!v) { + all = false; + break; + } + } + result.add(new BooleanType(all)); + return result; + } + } + + + private ExecutionContext changeThis(ExecutionContext context, Base newThis) { + return new ExecutionContext(context.appInfo, context.resource, context.context, newThis); + } + + private ExecutionTypeContext changeThis(ExecutionTypeContext context, TypeDetails newThis) { + return new ExecutionTypeContext(context.appInfo, context.resource, context.context, newThis); + } + + + private List funcNow(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + result.add(DateTimeType.now()); + return result; + } + + + private List funcToday(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + result.add(new DateType(new Date(), TemporalPrecisionEnum.DAY)); + return result; + } + + + private List funcMemberOf(ExecutionContext context, List focus, ExpressionNode exp) { + throw new Error("not Implemented yet"); + } + + + private List funcDescendants(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + List current = new ArrayList(); + current.addAll(focus); + List added = new ArrayList(); + boolean more = true; + while (more) { + added.clear(); + for (Base item : current) { + getChildrenByName(item, "*", added); + } + more = !added.isEmpty(); + result.addAll(added); + current.clear(); + current.addAll(added); + } + return result; + } + + + private List funcChildren(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + for (Base b : focus) + getChildrenByName(b, "*", result); + return result; + } + + + private List funcReplace(ExecutionContext context, List focus, ExpressionNode exp) { + throw new Error("not Implemented yet"); + } + + + private List funcReplaceMatches(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + + if (focus.size() == 1 && !Utilities.noString(sw)) + result.add(new BooleanType(convertToString(focus.get(0)).contains(sw))); + else + result.add(new BooleanType(false)); + return result; + } + + + private List funcEndsWith(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + + if (focus.size() == 1 && !Utilities.noString(sw)) + result.add(new BooleanType(convertToString(focus.get(0)).endsWith(sw))); + else + result.add(new BooleanType(false)); + return result; + } + + + private List funcToString(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + result.add(new StringType(convertToString(focus))); + return result; + } + + + private List funcToDecimal(ExecutionContext context, List focus, ExpressionNode exp) { + String s = convertToString(focus); + List result = new ArrayList(); + if (Utilities.isDecimal(s)) + result.add(new DecimalType(s)); + return result; + } + + + private List funcIif(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List n1 = execute(context, focus, exp.getParameters().get(0), true); + Boolean v = convertToBoolean(n1); + + if (v) + return execute(context, focus, exp.getParameters().get(1), true); + else if (exp.getParameters().size() < 3) + return new ArrayList(); + else + return execute(context, focus, exp.getParameters().get(2), true); + } + + + private List funcTake(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List n1 = execute(context, focus, exp.getParameters().get(0), true); + int i1 = Integer.parseInt(n1.get(0).primitiveValue()); + + List result = new ArrayList(); + for (int i = 0; i < Math.min(focus.size(), i1); i++) + result.add(focus.get(i)); + return result; + } + + + private List funcSingle(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + if (focus.size() == 1) + return focus; + throw new PathEngineException(String.format("Single() : checking for 1 item but found %d items", focus.size())); + } + + + private List funcIs(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + if (focus.size() == 0 || focus.size() > 1) + result.add(new BooleanType(false)); + else { + String tn = exp.getParameters().get(0).getName(); + result.add(new BooleanType(focus.get(0).hasType(tn))); + } + return result; + } + + + private List funcAs(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + String tn = exp.getParameters().get(0).getName(); + for (Base b : focus) + if (b.hasType(tn)) + result.add(b); + return result; + } + + + private List funcRepeat(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + List current = new ArrayList(); + current.addAll(focus); + List added = new ArrayList(); + boolean more = true; + while (more) { + added.clear(); + List pc = new ArrayList(); + for (Base item : current) { + pc.clear(); + pc.add(item); + added.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), false)); + } + more = !added.isEmpty(); + result.addAll(added); + current.clear(); + current.addAll(added); + } + return result; + } + + + + private List funcIsDistinct(ExecutionContext context, List focus, ExpressionNode exp) { + if (focus.size() <= 1) + return makeBoolean(true); + + boolean distinct = true; + for (int i = 0; i < focus.size(); i++) { + for (int j = i+1; j < focus.size(); j++) { + if (doEquals(focus.get(j), focus.get(i))) { + distinct = false; + break; + } + } + } + return makeBoolean(distinct); + } + + + private List funcSupersetOf(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List target = execute(context, focus, exp.getParameters().get(0), true); + + boolean valid = true; + for (Base item : target) { + boolean found = false; + for (Base t : focus) { + if (Base.compareDeep(item, t, false)) { + found = true; + break; + } + } + if (!found) { + valid = false; + break; + } + } + List result = new ArrayList(); + result.add(new BooleanType(valid)); + return result; + } + + + private List funcSubsetOf(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List target = execute(context, focus, exp.getParameters().get(0), true); + + boolean valid = true; + for (Base item : focus) { + boolean found = false; + for (Base t : target) { + if (Base.compareDeep(item, t, false)) { + found = true; + break; + } + } + if (!found) { + valid = false; + break; + } + } + List result = new ArrayList(); + result.add(new BooleanType(valid)); + return result; + } + + + private List funcExists(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + result.add(new BooleanType(!focus.isEmpty())); // R2 - can't use ElementUtil + return result; + } + + + private List funcResolve(ExecutionContext context, List focus, ExpressionNode exp) { + throw new Error("not Implemented yet"); + } + + private List funcExtension(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + List nl = execute(context, focus, exp.getParameters().get(0), true); + String url = nl.get(0).primitiveValue(); + + for (Base item : focus) { + List ext = new ArrayList(); + getChildrenByName(item, "extension", ext); + getChildrenByName(item, "modifierExtension", ext); + for (Base ex : ext) { + List vl = new ArrayList(); + getChildrenByName(ex, "url", vl); + if (convertToString(vl).equals(url)) + result.add(ex); + } + } + return result; + } + + private List funcTrace(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List nl = execute(context, focus, exp.getParameters().get(0), true); + String name = nl.get(0).primitiveValue(); + + log(name, focus); + return focus; + } + + private List funcDistinct(ExecutionContext context, List focus, ExpressionNode exp) { + if (focus.size() <= 1) + return focus; + + List result = new ArrayList(); + for (int i = 0; i < focus.size(); i++) { + boolean found = false; + for (int j = i+1; j < focus.size(); j++) { + if (doEquals(focus.get(j), focus.get(i))) { + found = true; + break; + } + } + if (!found) + result.add(focus.get(i)); + } + return result; + } + + private List funcMatches(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + + if (focus.size() == 1 && !Utilities.noString(sw)) + result.add(new BooleanType(convertToString(focus.get(0)).matches(sw))); + else + result.add(new BooleanType(false)); + return result; + } + + private List funcContains(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + + if (focus.size() == 1 && !Utilities.noString(sw)) + result.add(new BooleanType(convertToString(focus.get(0)).contains(sw))); + else + result.add(new BooleanType(false)); + return result; + } + + private List funcLength(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + if (focus.size() == 1) { + String s = convertToString(focus.get(0)); + result.add(new IntegerType(s.length())); + } + return result; + } + + private List funcStartsWith(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + + if (focus.size() == 1 && !Utilities.noString(sw)) + result.add(new BooleanType(convertToString(focus.get(0)).startsWith(sw))); + else + result.add(new BooleanType(false)); + return result; + } + + private List funcSubstring(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + List n1 = execute(context, focus, exp.getParameters().get(0), true); + int i1 = Integer.parseInt(n1.get(0).primitiveValue()); + int i2 = -1; + if (exp.parameterCount() == 2) { + List n2 = execute(context, focus, exp.getParameters().get(1), true); + i2 = Integer.parseInt(n2.get(0).primitiveValue()); + } + + if (focus.size() == 1) { + String sw = convertToString(focus.get(0)); + String s; + if (i1 < 0 || i1 >= sw.length()) + return new ArrayList(); + if (exp.parameterCount() == 2) + s = sw.substring(i1, Math.min(sw.length(), i1+i2)); + else + s = sw.substring(i1); + if (!Utilities.noString(s)) + result.add(new StringType(s)); + } + return result; + } + + private List funcToInteger(ExecutionContext context, List focus, ExpressionNode exp) { + String s = convertToString(focus); + List result = new ArrayList(); + if (Utilities.isInteger(s)) + result.add(new IntegerType(s)); + return result; + } + + private List funcCount(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + result.add(new IntegerType(focus.size())); + return result; + } + + private List funcSkip(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List n1 = execute(context, focus, exp.getParameters().get(0), true); + int i1 = Integer.parseInt(n1.get(0).primitiveValue()); + + List result = new ArrayList(); + for (int i = i1; i < focus.size(); i++) + result.add(focus.get(i)); + return result; + } + + private List funcTail(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + for (int i = 1; i < focus.size(); i++) + result.add(focus.get(i)); + return result; + } + + private List funcLast(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + if (focus.size() > 0) + result.add(focus.get(focus.size()-1)); + return result; + } + + private List funcFirst(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + if (focus.size() > 0) + result.add(focus.get(0)); + return result; + } + + + private List funcWhere(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + List pc = new ArrayList(); + for (Base item : focus) { + pc.clear(); + pc.add(item); + if (convertToBoolean(execute(changeThis(context, item), pc, exp.getParameters().get(0), true))) + result.add(item); + } + return result; + } + + private List funcSelect(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + List pc = new ArrayList(); + for (Base item : focus) { + pc.clear(); + pc.add(item); + result.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), true)); + } + return result; + } + + + private List funcItem(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + List result = new ArrayList(); + String s = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + if (Utilities.isInteger(s) && Integer.parseInt(s) < focus.size()) + result.add(focus.get(Integer.parseInt(s))); + return result; + } + + private List funcEmpty(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + result.add(new BooleanType(focus.isEmpty())); + return result; + } + + private List funcNot(ExecutionContext context, List focus, ExpressionNode exp) { + return makeBoolean(!convertToBoolean(focus)); + } + + public class ElementDefinitionMatch { + private ElementDefinition definition; + private String fixedType; + public ElementDefinitionMatch(ElementDefinition definition, String fixedType) { + super(); + this.definition = definition; + this.fixedType = fixedType; + } + public ElementDefinition getDefinition() { + return definition; + } + public String getFixedType() { + return fixedType; + } + + } + + private void getChildTypesByName(String type, String name, TypeDetails result) throws PathEngineException, DefinitionException { + if (Utilities.noString(type)) + throw new PathEngineException("No type provided in BuildToolPathEvaluator.getChildTypesByName"); + if (type.equals("xhtml")) + return; + String url = null; + if (type.contains(".")) { + url = "http://hl7.org/fhir/StructureDefinition/"+type.substring(0, type.indexOf(".")); + } else { + url = "http://hl7.org/fhir/StructureDefinition/"+type; + } + String tail = ""; + StructureDefinition sd = worker.fetchResource(StructureDefinition.class, url); + if (sd == null) + throw new DefinitionException("Unknown type "+type); // this really is an error, because we can only get to here if the internal infrastrucgture is wrong + List sdl = new ArrayList(); + ElementDefinitionMatch m = null; + if (type.contains(".")) + m = getElementDefinition(sd, type, false); + if (m != null && hasDataType(m.definition)) { + if (m.fixedType != null) + { + StructureDefinition dt = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+m.fixedType); + if (dt == null) + throw new DefinitionException("unknown data type "+m.fixedType); + sdl.add(dt); + } else + for (TypeRefComponent t : m.definition.getType()) { + StructureDefinition dt = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+t.getCode()); + if (dt == null) + throw new DefinitionException("unknown data type "+t.getCode()); + sdl.add(dt); + } + } else { + sdl.add(sd); + if (type.contains(".")) + tail = type.substring(type.indexOf(".")); + } + + for (StructureDefinition sdi : sdl) { + String path = sdi.getSnapshot().getElement().get(0).getPath()+tail+"."; + if (name.equals("**")) { + assert(result.getCollectionStatus() == CollectionStatus.UNORDERED); + for (ElementDefinition ed : sdi.getSnapshot().getElement()) { + if (ed.getPath().startsWith(path)) + for (TypeRefComponent t : ed.getType()) { + if (t.hasCode() && t.getCodeElement().hasValue()) { + String tn = null; + if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement")) + tn = ed.getPath(); + else + tn = t.getCode(); + if (t.getCode().equals("Resource")) { + for (String rn : worker.getResourceNames()) { + if (!result.hasType(worker, rn)) { + result.addType(rn); + getChildTypesByName(rn, "**", result); + } + } + } else if (!result.hasType(worker, tn)) { + result.addType(tn); + getChildTypesByName(tn, "**", result); + } + } + } + } + } else if (name.equals("*")) { + assert(result.getCollectionStatus() == CollectionStatus.UNORDERED); + for (ElementDefinition ed : sdi.getSnapshot().getElement()) { + if (ed.getPath().startsWith(path) && !ed.getPath().substring(path.length()).contains(".")) + for (TypeRefComponent t : ed.getType()) { + if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement")) + result.addType(ed.getPath()); + else if (t.getCode().equals("Resource")) + result.addTypes(worker.getResourceNames()); + else + result.addType(t.getCode()); + } + } + } else { + path = sdi.getSnapshot().getElement().get(0).getPath()+tail+"."+name; + + ElementDefinitionMatch ed = getElementDefinition(sdi, path, false); + if (ed != null) { + if (!Utilities.noString(ed.getFixedType())) + result.addType(ed.getFixedType()); + else + for (TypeRefComponent t : ed.getDefinition().getType()) { + if (Utilities.noString(t.getCode())) + break; // throw new PathEngineException("Illegal reference to primitive value attribute @ "+path); + + if (t.getCode().equals("Element") || t.getCode().equals("BackboneElement")) + result.addType(path); + else if (t.getCode().equals("Resource")) + result.addTypes(worker.getResourceNames()); + else + result.addType(t.getCode()); + } + } + } + } + } + + private ElementDefinitionMatch getElementDefinition(StructureDefinition sd, String path, boolean allowTypedName) throws PathEngineException { + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + if (ed.getPath().equals(path)) { + if (ed.hasNameReference()) { + return getElementDefinitionByName(sd, ed.getNameReference()); + } else + return new ElementDefinitionMatch(ed, null); + } + if (ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() == ed.getPath().length()-3) + return new ElementDefinitionMatch(ed, null); + if (allowTypedName && ed.getPath().endsWith("[x]") && path.startsWith(ed.getPath().substring(0, ed.getPath().length()-3)) && path.length() > ed.getPath().length()-3) { + String s = Utilities.uncapitalize(path.substring(ed.getPath().length()-3)); + if (primitiveTypes.contains(s)) + return new ElementDefinitionMatch(ed, s); + else + return new ElementDefinitionMatch(ed, path.substring(ed.getPath().length()-3)); + } + if (ed.getPath().contains(".") && path.startsWith(ed.getPath()+".") && (ed.getType().size() > 0) && !isAbstractType(ed.getType())) { + // now we walk into the type. + if (ed.getType().size() > 1) // if there's more than one type, the test above would fail this + throw new PathEngineException("Internal typing issue...."); + StructureDefinition nsd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+ed.getType().get(0).getCode()); + if (nsd == null) + throw new PathEngineException("Unknown type "+ed.getType().get(0).getCode()); + return getElementDefinition(nsd, nsd.getId()+path.substring(ed.getPath().length()), allowTypedName); + } + if (ed.hasNameReference() && path.startsWith(ed.getPath()+".")) { + ElementDefinitionMatch m = getElementDefinitionByName(sd, ed.getNameReference()); + return getElementDefinition(sd, m.definition.getPath()+path.substring(ed.getPath().length()), allowTypedName); + } + } + return null; + } + + private boolean isAbstractType(List list) { + return list.size() != 1 ? false : Utilities.existsInList(list.get(0).getCode(), "Element", "BackboneElement", "Resource", "DomainResource"); +} + + + private boolean hasType(ElementDefinition ed, String s) { + for (TypeRefComponent t : ed.getType()) + if (s.equalsIgnoreCase(t.getCode())) + return true; + return false; + } + + private boolean hasDataType(ElementDefinition ed) { + return ed.hasType() && !(ed.getType().get(0).getCode().equals("Element") || ed.getType().get(0).getCode().equals("BackboneElement")); + } + + private ElementDefinitionMatch getElementDefinitionByName(StructureDefinition sd, String ref) { + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + if (ref.equals(ed.getName())) + return new ElementDefinitionMatch(ed, null); + } + return null; + } + + + public boolean hasLog() { + return log != null && log.length() > 0; + } + + + public String takeLog() { + if (!hasLog()) + return ""; + String s = log.toString(); + log = new StringBuilder(); + return s; + } + +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/utils/ProfileUtilities.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/utils/ProfileUtilities.java index a82e9b20cc7..9d2c0a2ae41 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/utils/ProfileUtilities.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/utils/ProfileUtilities.java @@ -1628,7 +1628,7 @@ public class ProfileUtilities { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, definition.getShort(), null))); - } else if (fallback != null && fallback != null && fallback.hasShort()) { + } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, fallback.getShort(), null))); } diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/BackboneElementHL7_Dstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/BackboneElementHL7_Dstu2Test.java new file mode 100644 index 00000000000..602cf3d60da --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/BackboneElementHL7_Dstu2Test.java @@ -0,0 +1,26 @@ +package ca.uhn.fhir.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.hl7.fhir.instance.model.BackboneElement; +import org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent; +import org.junit.Test; + +public class BackboneElementHL7_Dstu2Test { + /** + * Ensuring that IDs of subtypes of BackboneElement get copied when + * the {@link org.hl7.fhir.instance.model.BackboneElement#copy()} method is called + */ + @Test + public void testPatientCommunicationComponentIdCopy() { + PatientCommunicationComponent pcc1 = new PatientCommunicationComponent(); + pcc1.setId("1001"); + + PatientCommunicationComponent copiedPcc = pcc1.copy(); + String copiedPccID = copiedPcc.getIdElement().getIdPart(); + + assertTrue(copiedPcc instanceof BackboneElement); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedPccID); + } +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/DomainResourceHL7_Dstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/DomainResourceHL7_Dstu2Test.java new file mode 100644 index 00000000000..7af7349feb4 --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/DomainResourceHL7_Dstu2Test.java @@ -0,0 +1,30 @@ +package ca.uhn.fhir.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.hl7.fhir.instance.model.DomainResource; +import org.hl7.fhir.instance.model.Narrative; +import org.hl7.fhir.instance.model.Patient; +import org.junit.Test; + +public class DomainResourceHL7_Dstu2Test { + /** + * Ensuring that fields defined in {@link org.hl7.fhir.instance.model.DomainResource} and {@link org.hl7.fhir.instance.model.Resource} + * the {@link org.hl7.fhir.instance.model.DomainResource#copy()} method is called + */ + @Test + public void testPatientCopy() { + Patient p1 = new Patient(); + p1.setId("1001"); + p1.setText(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL)); + + Patient copiedPatient = p1.copy(); + String copiedPatientID = copiedPatient.getIdElement().getIdPart(); + Narrative.NarrativeStatus copiedPatientTextStatus = copiedPatient.getText().getStatus(); + + assertTrue(copiedPatient instanceof DomainResource); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedPatientID); + assertEquals(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL).getStatus(), copiedPatientTextStatus); + } +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestHl7OrgDstu2.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestHl7OrgDstu2.java index a6adbce2d2f..af793935302 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestHl7OrgDstu2.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationTestHl7OrgDstu2.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.rest.client; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @@ -14,6 +15,8 @@ import java.io.InputStream; import java.io.StringReader; import java.nio.charset.Charset; +import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.util.TestUtil; import org.apache.commons.io.input.ReaderInputStream; import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; @@ -23,6 +26,7 @@ import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicStatusLine; import org.hl7.fhir.instance.model.Conformance; import org.hl7.fhir.instance.model.Patient; +import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -39,8 +43,7 @@ import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.exceptions.FhirClientInappropriateForServerException; public class ClientServerValidationTestHl7OrgDstu2 { - - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ClientServerValidationTestHl7OrgDstu2.class); + private FhirContext myCtx; private HttpClient myHttpClient; private HttpResponse myHttpResponse; @@ -58,8 +61,10 @@ public class ClientServerValidationTestHl7OrgDstu2 { @Test public void testServerReturnsAppropriateVersionForDstu2() throws Exception { + String appropriateFhirVersion = "1.0.2"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2_HL7ORG.getFhirVersionString())); Conformance conf = new Conformance(); - conf.setFhirVersion("1.0.2"); + conf.setFhirVersion(appropriateFhirVersion); final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); @@ -79,11 +84,11 @@ public class ClientServerValidationTestHl7OrgDstu2 { when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - myCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.ONCE); + myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); IGenericClient client = myCtx.newRestfulGenericClient("http://foo"); // don't load the conformance until the first time the client is actually used - assertTrue(myFirstResponse); + assertTrue(myFirstResponse); client.read(new UriDt("http://foo/Patient/123")); assertFalse(myFirstResponse); myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); @@ -95,8 +100,10 @@ public class ClientServerValidationTestHl7OrgDstu2 { @Test public void testServerReturnsWrongVersionForDstu2() throws Exception { + String wrongFhirVersion = "3.0.1"; + assertThat(wrongFhirVersion, is(FhirVersionEnum.DSTU3.getFhirVersionString())); // asserting that what we assume to be the DSTU3 FHIR version is still correct Conformance conf = new Conformance(); - conf.setFhirVersion("0.0.82"); + conf.setFhirVersion(wrongFhirVersion); String msg = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); @@ -107,16 +114,37 @@ public class ClientServerValidationTestHl7OrgDstu2 { when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - myCtx.getRestfulClientFactory().setServerValidationModeEnum(ServerValidationModeEnum.ONCE); + myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); try { - myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123")); + myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/1")); fail(); } catch (FhirClientInappropriateForServerException e) { - String out = e.toString(); - String want = "The server at base URL \"http://foo/metadata\" returned a conformance statement indicating that it supports FHIR version \"0.0.82\" which corresponds to DSTU1, but this client is configured to use DSTU2_HL7ORG (via the FhirContext)"; - ourLog.info(out); - ourLog.info(want); - assertThat(out, containsString(want)); + assertThat(e.toString(), containsString("The server at base URL \"http://foo/metadata\" returned a conformance statement indicating that it supports FHIR version \"3.0.1\" which corresponds to DSTU3, but this client is configured to use DSTU2_HL7ORG (via the FhirContext)")); } } + + @Test + public void testServerReturnsRightVersionForDstu2() throws Exception { + String appropriateFhirVersion = "1.0.2"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2_HL7ORG.getFhirVersionString())); + Conformance conf = new Conformance(); + conf.setFhirVersion(appropriateFhirVersion); + String msg = myCtx.newXmlParser().encodeResourceToString(conf); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE); + myCtx.newRestfulGenericClient("http://foo").forceConformanceCheck(); + } + + @AfterClass + public static void afterClassClearContext() { + TestUtil.clearAllStaticFieldsForUnitTest(); + } } diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml index fd4d8a33d96..686617184cc 100644 --- a/hapi-fhir-structures-r4/pom.xml +++ b/hapi-fhir-structures-r4/pom.xml @@ -29,6 +29,11 @@ + + org.codehaus.woodstox + woodstox-core-asl + test + es.nitaur.markdown txtmark diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java index 31bd506f2cd..452472e7545 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java @@ -1532,7 +1532,7 @@ public class ProfileUtilities extends TranslatingUtilities { private boolean hasBindableType(ElementDefinition ed) { for (TypeRefComponent tr : ed.getType()) { - if (Utilities.existsInList(tr.getCode(), "Coding", "CodeableConcept", "Quantity", "url", "string", "code")) + if (Utilities.existsInList(tr.getCode(), "Coding", "CodeableConcept", "Quantity", "uri", "string", "code")) return true; } return false; @@ -1918,8 +1918,8 @@ public class ProfileUtilities extends TranslatingUtilities { case BUNDLED : return "b"; case CONTAINED : return "c"; case REFERENCED: return "r"; + default: return "?"; } - return "?"; } @@ -2366,7 +2366,7 @@ public class ProfileUtilities extends TranslatingUtilities { if (definition != null && definition.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(definition.getShortElement(), gen.new Piece(null, gt(definition.getShortElement()), null))); - } else if (fallback != null && fallback != null && fallback.hasShort()) { + } else if (fallback != null && fallback.hasShort()) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.addPiece(checkForNoChange(fallback.getShortElement(), gen.new Piece(null, gt(fallback.getShortElement()), null))); } @@ -2604,6 +2604,13 @@ public class ProfileUtilities extends TranslatingUtilities { } } } + if (definition.hasDefinition()) { + if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); + c.getPieces().add(gen.new Piece(null, "Definition: ", null).addStyle("font-weight:bold")); + c.addPiece(gen.new Piece("br")); + c.addMarkdown(definition.getDefinition()); +// c.getPieces().add(checkForNoChange(definition.getCommentElement(), gen.new Piece(null, definition.getComment(), null))); + } if (definition.getComment()!=null) { if (!c.getPieces().isEmpty()) c.addPiece(gen.new Piece("br")); c.getPieces().add(gen.new Piece(null, "Comments: ", null).addStyle("font-weight:bold")); @@ -3734,17 +3741,21 @@ public class ProfileUtilities extends TranslatingUtilities { } - public static ElementDefinitionSlicingDiscriminatorComponent interpretR2Discriminator(String discriminator) { + public static ElementDefinitionSlicingDiscriminatorComponent interpretR2Discriminator(String discriminator, boolean isExists) { if (discriminator.endsWith("@profile")) return makeDiscriminator(DiscriminatorType.PROFILE, discriminator.length() == 8 ? "" : discriminator.substring(discriminator.length()-9)); if (discriminator.endsWith("@type")) - return makeDiscriminator(DiscriminatorType.TYPE, discriminator.length() == 5 ? "" : discriminator.substring(discriminator.length()-6)); + return makeDiscriminator(DiscriminatorType.TYPE, discriminator.length() == 5 ? "" : discriminator.substring(discriminator.length()-6)); + if (discriminator.endsWith("@exists")) + return makeDiscriminator(DiscriminatorType.EXISTS, discriminator.length() == 7 ? "" : discriminator.substring(discriminator.length()-8)); + if (isExists) + return makeDiscriminator(DiscriminatorType.EXISTS, discriminator); return new ElementDefinitionSlicingDiscriminatorComponent().setType(DiscriminatorType.VALUE).setPath(discriminator); } - private static ElementDefinitionSlicingDiscriminatorComponent makeDiscriminator(DiscriminatorType profile, String str) { - return new ElementDefinitionSlicingDiscriminatorComponent().setType(DiscriminatorType.VALUE).setPath(Utilities.noString(str)? "$this" : str); + private static ElementDefinitionSlicingDiscriminatorComponent makeDiscriminator(DiscriminatorType dType, String str) { + return new ElementDefinitionSlicingDiscriminatorComponent().setType(dType).setPath(Utilities.noString(str)? "$this" : str); } diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/rest/server/R4BundleFactory.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/rest/server/R4BundleFactory.java index 538dc47dc7c..22697d282c4 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/rest/server/R4BundleFactory.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/rest/server/R4BundleFactory.java @@ -19,13 +19,6 @@ package org.hl7.fhir.r4.hapi.rest.server; * limitations under the License. * #L% */ -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -import java.util.*; - -import org.hl7.fhir.instance.model.api.*; -import org.hl7.fhir.r4.model.*; -import org.hl7.fhir.r4.model.Bundle.*; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.api.BundleInclusionRule; @@ -35,324 +28,340 @@ import ca.uhn.fhir.model.valueset.BundleTypeEnum; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.IVersionSpecificBundleFactory; import ca.uhn.fhir.util.ResourceReferenceInfo; +import org.hl7.fhir.instance.model.api.*; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r4.model.Bundle.BundleLinkComponent; +import org.hl7.fhir.r4.model.Bundle.HTTPVerb; +import org.hl7.fhir.r4.model.Bundle.SearchEntryMode; +import org.hl7.fhir.r4.model.DomainResource; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Resource; + +import java.util.*; + +import static org.apache.commons.lang3.StringUtils.isNotBlank; public class R4BundleFactory implements IVersionSpecificBundleFactory { - private String myBase; - private Bundle myBundle; - private FhirContext myContext; + private String myBase; + private Bundle myBundle; + private FhirContext myContext; - public R4BundleFactory(FhirContext theContext) { - myContext = theContext; - } + public R4BundleFactory(FhirContext theContext) { + myContext = theContext; + } - private void addResourcesForSearch(List theResult) { - List includedResources = new ArrayList(); - Set addedResourceIds = new HashSet(); + private void addResourcesForSearch(List theResult) { + List includedResources = new ArrayList(); + Set addedResourceIds = new HashSet(); - for (IBaseResource next : theResult) { - if (next.getIdElement().isEmpty() == false) { - addedResourceIds.add(next.getIdElement()); - } - } + for (IBaseResource next : theResult) { + if (next.getIdElement().isEmpty() == false) { + addedResourceIds.add(next.getIdElement()); + } + } - for (IBaseResource nextBaseRes : theResult) { - Resource next = (Resource) nextBaseRes; - Set containedIds = new HashSet(); - if (next instanceof DomainResource) { - for (Resource nextContained : ((DomainResource) next).getContained()) { - if (nextContained.getIdElement().isEmpty() == false) { - containedIds.add(nextContained.getIdElement().getValue()); - } - } - } + for (IBaseResource nextBaseRes : theResult) { + Resource next = (Resource) nextBaseRes; + Set containedIds = new HashSet(); + if (next instanceof DomainResource) { + for (Resource nextContained : ((DomainResource) next).getContained()) { + if (nextContained.getIdElement().isEmpty() == false) { + containedIds.add(nextContained.getIdElement().getValue()); + } + } + } - List references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, IBaseReference.class); - do { - List addedResourcesThisPass = new ArrayList(); + List references = myContext.newTerser().getAllPopulatedChildElementsOfType(next, IBaseReference.class); + do { + List addedResourcesThisPass = new ArrayList(); - for (IBaseReference nextRef : references) { - IAnyResource nextRes = (IAnyResource) nextRef.getResource(); - if (nextRes != null) { - if (nextRes.getIdElement().hasIdPart()) { - if (containedIds.contains(nextRes.getIdElement().getValue())) { - // Don't add contained IDs as top level resources - continue; - } + for (IBaseReference nextRef : references) { + IAnyResource nextRes = (IAnyResource) nextRef.getResource(); + if (nextRes != null) { + if (nextRes.getIdElement().hasIdPart()) { + if (containedIds.contains(nextRes.getIdElement().getValue())) { + // Don't add contained IDs as top level resources + continue; + } - IIdType id = nextRes.getIdElement(); - if (id.hasResourceType() == false) { - String resName = myContext.getResourceDefinition(nextRes).getName(); - id = id.withResourceType(resName); - } + IIdType id = nextRes.getIdElement(); + if (id.hasResourceType() == false) { + String resName = myContext.getResourceDefinition(nextRes).getName(); + id = id.withResourceType(resName); + } - if (!addedResourceIds.contains(id)) { - addedResourceIds.add(id); - addedResourcesThisPass.add(nextRes); - } + if (!addedResourceIds.contains(id)) { + addedResourceIds.add(id); + addedResourcesThisPass.add(nextRes); + } - } - } - } + } + } + } - // Linked resources may themselves have linked resources - references = new ArrayList(); - for (IAnyResource iResource : addedResourcesThisPass) { - List newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, IBaseReference.class); - references.addAll(newReferences); - } + // Linked resources may themselves have linked resources + references = new ArrayList(); + for (IAnyResource iResource : addedResourcesThisPass) { + List newReferences = myContext.newTerser().getAllPopulatedChildElementsOfType(iResource, IBaseReference.class); + references.addAll(newReferences); + } - includedResources.addAll(addedResourcesThisPass); + includedResources.addAll(addedResourcesThisPass); - } while (references.isEmpty() == false); + } while (references.isEmpty() == false); - BundleEntryComponent entry = myBundle.addEntry().setResource(next); - if (next.getIdElement().hasBaseUrl()) { - entry.setFullUrl(next.getId()); - } + BundleEntryComponent entry = myBundle.addEntry().setResource(next); + if (next.getIdElement().hasBaseUrl()) { + entry.setFullUrl(next.getId()); + } - String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(next); - if (httpVerb != null) { - entry.getRequest().getMethodElement().setValueAsString(httpVerb); - entry.getRequest().getUrlElement().setValue(next.getId()); - } - } + String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(next); + if (httpVerb != null) { + entry.getRequest().getMethodElement().setValueAsString(httpVerb); + entry.getRequest().getUrlElement().setValue(next.getId()); + } + } + + /* + * Actually add the resources to the bundle + */ + for (IBaseResource next : includedResources) { + BundleEntryComponent entry = myBundle.addEntry(); + entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); + if (next.getIdElement().hasBaseUrl()) { + entry.setFullUrl(next.getIdElement().getValue()); + } + } + } + + @Override + public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes) { + ensureBundle(); + + List includedResources = new ArrayList(); + Set addedResourceIds = new HashSet(); + + for (IBaseResource next : theResult) { + if (next.getIdElement().isEmpty() == false) { + addedResourceIds.add(next.getIdElement()); + } + } + + for (IBaseResource next : theResult) { + + Set containedIds = new HashSet(); + + if (next instanceof DomainResource) { + for (Resource nextContained : ((DomainResource) next).getContained()) { + if (isNotBlank(nextContained.getId())) { + containedIds.add(nextContained.getId()); + } + } + } + + List references = myContext.newTerser().getAllResourceReferences(next); + do { + List addedResourcesThisPass = new ArrayList(); + + for (ResourceReferenceInfo nextRefInfo : references) { + if (!theBundleInclusionRule.shouldIncludeReferencedResource(nextRefInfo, theIncludes)) { + continue; + } + + IAnyResource nextRes = (IAnyResource) nextRefInfo.getResourceReference().getResource(); + if (nextRes != null) { + if (nextRes.getIdElement().hasIdPart()) { + if (containedIds.contains(nextRes.getIdElement().getValue())) { + // Don't add contained IDs as top level resources + continue; + } + + IIdType id = nextRes.getIdElement(); + if (id.hasResourceType() == false) { + String resName = myContext.getResourceDefinition(nextRes).getName(); + id = id.withResourceType(resName); + } + + if (!addedResourceIds.contains(id)) { + addedResourceIds.add(id); + addedResourcesThisPass.add(nextRes); + } + + } + } + } + + includedResources.addAll(addedResourcesThisPass); + + // Linked resources may themselves have linked resources + references = new ArrayList(); + for (IAnyResource iResource : addedResourcesThisPass) { + List newReferences = myContext.newTerser().getAllResourceReferences(iResource); + references.addAll(newReferences); + } + } while (references.isEmpty() == false); + + BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next); + Resource nextAsResource = (Resource) next; + IIdType id = populateBundleEntryFullUrl(next, entry); + String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource); + if (httpVerb != null) { + entry.getRequest().getMethodElement().setValueAsString(httpVerb); + if (id != null) { + entry.getRequest().setUrl(id.getValue()); + } + } + + String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource); + if (searchMode != null) { + entry.getSearch().getModeElement().setValueAsString(searchMode); + } + } /* * Actually add the resources to the bundle */ - for (IBaseResource next : includedResources) { - BundleEntryComponent entry = myBundle.addEntry(); - entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); - if (next.getIdElement().hasBaseUrl()) { - entry.setFullUrl(next.getIdElement().getValue()); - } - } - } + for (IAnyResource next : includedResources) { + BundleEntryComponent entry = myBundle.addEntry(); + entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); + populateBundleEntryFullUrl(next, entry); + } - @Override - public void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes) { - ensureBundle(); + } - List includedResources = new ArrayList(); - Set addedResourceIds = new HashSet(); + @Override + public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, + IPrimitiveType theLastUpdated) { + ensureBundle(); - for (IBaseResource next : theResult) { - if (next.getIdElement().isEmpty() == false) { - addedResourceIds.add(next.getIdElement()); - } - } + myBase = theServerBase; - for (IBaseResource next : theResult) { + if (myBundle.getIdElement().isEmpty()) { + myBundle.setId(theId); + } + if (myBundle.getIdElement().isEmpty()) { + myBundle.setId(UUID.randomUUID().toString()); + } - Set containedIds = new HashSet(); + if (myBundle.getMeta().getLastUpdated() == null && theLastUpdated != null) { + myBundle.getMeta().getLastUpdatedElement().setValueAsString(theLastUpdated.getValueAsString()); + } - if (next instanceof DomainResource) { - for (Resource nextContained : ((DomainResource) next).getContained()) { - if (isNotBlank(nextContained.getId())) { - containedIds.add(nextContained.getId()); - } - } - } + if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkSelf)) { + myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theLinkSelf); + } + if (!hasLink(Constants.LINK_NEXT, myBundle) && isNotBlank(theLinkNext)) { + myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(theLinkNext); + } + if (!hasLink(Constants.LINK_PREVIOUS, myBundle) && isNotBlank(theLinkPrev)) { + myBundle.addLink().setRelation(Constants.LINK_PREVIOUS).setUrl(theLinkPrev); + } - List references = myContext.newTerser().getAllResourceReferences(next); - do { - List addedResourcesThisPass = new ArrayList(); + if (myBundle.getTypeElement().isEmpty() && theBundleType != null) { + myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); + } - for (ResourceReferenceInfo nextRefInfo : references) { - if (!theBundleInclusionRule.shouldIncludeReferencedResource(nextRefInfo, theIncludes)) { - continue; - } + if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) { + myBundle.getTotalElement().setValue(theTotalResults); + } + } - IAnyResource nextRes = (IAnyResource) nextRefInfo.getResourceReference().getResource(); - if (nextRes != null) { - if (nextRes.getIdElement().hasIdPart()) { - if (containedIds.contains(nextRes.getIdElement().getValue())) { - // Don't add contained IDs as top level resources - continue; - } + private void ensureBundle() { + if (myBundle == null) { + myBundle = new Bundle(); + } + } - IIdType id = nextRes.getIdElement(); - if (id.hasResourceType() == false) { - String resName = myContext.getResourceDefinition(nextRes).getName(); - id = id.withResourceType(resName); - } + @Override + public IBaseResource getResourceBundle() { + return myBundle; + } - if (!addedResourceIds.contains(id)) { - addedResourceIds.add(id); - addedResourcesThisPass.add(nextRes); - } + private boolean hasLink(String theLinkType, Bundle theBundle) { + for (BundleLinkComponent next : theBundle.getLink()) { + if (theLinkType.equals(next.getRelation())) { + return true; + } + } + return false; + } - } - } - } + @Override + public void initializeBundleFromResourceList(String theAuthor, List theResources, String theServerBase, String theCompleteUrl, int theTotalResults, + BundleTypeEnum theBundleType) { + myBundle = new Bundle(); - includedResources.addAll(addedResourcesThisPass); + myBundle.setId(UUID.randomUUID().toString()); - // Linked resources may themselves have linked resources - references = new ArrayList(); - for (IAnyResource iResource : addedResourcesThisPass) { - List newReferences = myContext.newTerser().getAllResourceReferences(iResource); - references.addAll(newReferences); - } - } while (references.isEmpty() == false); + myBundle.getMeta().setLastUpdated(new Date()); - BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next); - Resource nextAsResource = (Resource) next; - IIdType id = populateBundleEntryFullUrl(next, entry); - String httpVerb = ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.get(nextAsResource); - if (httpVerb != null) { - entry.getRequest().getMethodElement().setValueAsString(httpVerb); - if (id != null) { - entry.getRequest().setUrl(id.getValue()); - } - } + myBundle.addLink().setRelation(Constants.LINK_FHIR_BASE).setUrl(theServerBase); + myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theCompleteUrl); + myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); - String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource); - if (searchMode != null) { - entry.getSearch().getModeElement().setValueAsString(searchMode); - } - } + if (theBundleType.equals(BundleTypeEnum.TRANSACTION)) { + for (IBaseResource nextBaseRes : theResources) { + Resource next = (Resource) nextBaseRes; + BundleEntryComponent nextEntry = myBundle.addEntry(); - /* - * Actually add the resources to the bundle - */ - for (IAnyResource next : includedResources) { - BundleEntryComponent entry = myBundle.addEntry(); - entry.setResource((Resource) next).getSearch().setMode(SearchEntryMode.INCLUDE); - populateBundleEntryFullUrl(next, entry); - } + nextEntry.setResource(next); + if (next.getIdElement().isEmpty()) { + nextEntry.getRequest().setMethod(HTTPVerb.POST); + } else { + nextEntry.getRequest().setMethod(HTTPVerb.PUT); + if (next.getIdElement().isAbsolute()) { + nextEntry.getRequest().setUrl(next.getId()); + } else { + String resourceType = myContext.getResourceDefinition(next).getName(); + nextEntry.getRequest().setUrl(new IdType(theServerBase, resourceType, next.getIdElement().getIdPart(), next.getIdElement().getVersionIdPart()).getValue()); + } + } + } + } else { + addResourcesForSearch(theResources); + } - } + myBundle.getTotalElement().setValue(theTotalResults); + } - @Override - public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, - IPrimitiveType theLastUpdated) { - ensureBundle(); + @Override + public void initializeWithBundleResource(IBaseResource theBundle) { + myBundle = (Bundle) theBundle; + } - myBase = theServerBase; + private IIdType populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { + IIdType idElement = null; + if (next.getIdElement().hasBaseUrl()) { + idElement = next.getIdElement(); + entry.setFullUrl(idElement.toVersionless().getValue()); + } else { + if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { + idElement = next.getIdElement(); + idElement = idElement.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); + entry.setFullUrl(idElement.toVersionless().getValue()); + } + } + return idElement; + } - if (myBundle.getIdElement().isEmpty()) { - myBundle.setId(UUID.randomUUID().toString()); - } - - if (myBundle.getMeta().getLastUpdated() == null && theLastUpdated != null) { - myBundle.getMeta().getLastUpdatedElement().setValueAsString(theLastUpdated.getValueAsString()); - } - - if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkSelf)) { - myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theLinkSelf); - } - if (!hasLink(Constants.LINK_NEXT, myBundle) && isNotBlank(theLinkNext)) { - myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(theLinkNext); - } - if (!hasLink(Constants.LINK_PREVIOUS, myBundle) && isNotBlank(theLinkPrev)) { - myBundle.addLink().setRelation(Constants.LINK_PREVIOUS).setUrl(theLinkPrev); - } - - if (myBundle.getTypeElement().isEmpty() && theBundleType != null) { - myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); - } - - if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) { - myBundle.getTotalElement().setValue(theTotalResults); - } - } - - private void ensureBundle() { - if (myBundle == null) { - myBundle = new Bundle(); - } - } - - @Override - public IBaseResource getResourceBundle() { - return myBundle; - } - - private boolean hasLink(String theLinkType, Bundle theBundle) { - for (BundleLinkComponent next : theBundle.getLink()) { - if (theLinkType.equals(next.getRelation())) { - return true; - } - } - return false; - } - - @Override - public void initializeBundleFromResourceList(String theAuthor, List theResources, String theServerBase, String theCompleteUrl, int theTotalResults, - BundleTypeEnum theBundleType) { - myBundle = new Bundle(); - - myBundle.setId(UUID.randomUUID().toString()); - - myBundle.getMeta().setLastUpdated(new Date()); - - myBundle.addLink().setRelation(Constants.LINK_FHIR_BASE).setUrl(theServerBase); - myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theCompleteUrl); - myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); - - if (theBundleType.equals(BundleTypeEnum.TRANSACTION)) { - for (IBaseResource nextBaseRes : theResources) { - Resource next = (Resource) nextBaseRes; - BundleEntryComponent nextEntry = myBundle.addEntry(); - - nextEntry.setResource(next); - if (next.getIdElement().isEmpty()) { - nextEntry.getRequest().setMethod(HTTPVerb.POST); - } else { - nextEntry.getRequest().setMethod(HTTPVerb.PUT); - if (next.getIdElement().isAbsolute()) { - nextEntry.getRequest().setUrl(next.getId()); - } else { - String resourceType = myContext.getResourceDefinition(next).getName(); - nextEntry.getRequest().setUrl(new IdType(theServerBase, resourceType, next.getIdElement().getIdPart(), next.getIdElement().getVersionIdPart()).getValue()); - } - } - } - } else { - addResourcesForSearch(theResources); - } - - myBundle.getTotalElement().setValue(theTotalResults); - } - - @Override - public void initializeWithBundleResource(IBaseResource theBundle) { - myBundle = (Bundle) theBundle; - } - - private IIdType populateBundleEntryFullUrl(IBaseResource next, BundleEntryComponent entry) { - IIdType idElement = null; - if (next.getIdElement().hasBaseUrl()) { - idElement = next.getIdElement(); - entry.setFullUrl(idElement.toVersionless().getValue()); - } else { - if (isNotBlank(myBase) && next.getIdElement().hasIdPart()) { - idElement = next.getIdElement(); - idElement = idElement.withServerBase(myBase, myContext.getResourceDefinition(next).getName()); - entry.setFullUrl(idElement.toVersionless().getValue()); - } - } - return idElement; - } - - @Override - public List toListOfResources() { - ArrayList retVal = new ArrayList(); - for (BundleEntryComponent next : myBundle.getEntry()) { - if (next.getResource() != null) { - retVal.add(next.getResource()); - } else if (next.getResponse().getLocationElement().isEmpty() == false) { - IdType id = new IdType(next.getResponse().getLocation()); - String resourceType = id.getResourceType(); - if (isNotBlank(resourceType)) { - IAnyResource res = (IAnyResource) myContext.getResourceDefinition(resourceType).newInstance(); - res.setId(id); - retVal.add(res); - } - } - } - return retVal; - } + @Override + public List toListOfResources() { + ArrayList retVal = new ArrayList(); + for (BundleEntryComponent next : myBundle.getEntry()) { + if (next.getResource() != null) { + retVal.add(next.getResource()); + } else if (next.getResponse().getLocationElement().isEmpty() == false) { + IdType id = new IdType(next.getResponse().getLocation()); + String resourceType = id.getResourceType(); + if (isNotBlank(resourceType)) { + IAnyResource res = (IAnyResource) myContext.getResourceDefinition(resourceType).newInstance(); + res.setId(id); + retVal.add(res); + } + } + } + return retVal; + } } diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/BaseDateTimeType.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/BaseDateTimeType.java index 392e289bd7c..608f0c48fd2 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/BaseDateTimeType.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/BaseDateTimeType.java @@ -208,14 +208,6 @@ public abstract class BaseDateTimeType extends PrimitiveType { return getFieldValue(Calendar.DAY_OF_MONTH); } - /** - * Sets the month with 1-index, e.g. 1=the first day of the month - */ - public BaseDateTimeType setDay(int theDay) { - setFieldValue(Calendar.DAY_OF_MONTH, theDay, null, 0, 31); - return this; - } - /** * Returns the default precision for the given datatype */ @@ -236,14 +228,6 @@ public abstract class BaseDateTimeType extends PrimitiveType { return getFieldValue(Calendar.HOUR_OF_DAY); } - /** - * Sets the hour of the day in a 24h clock, e.g. 13=1pm - */ - public BaseDateTimeType setHour(int theHour) { - setFieldValue(Calendar.HOUR_OF_DAY, theHour, null, 0, 23); - return this; - } - /** * Returns the milliseconds within the current second. *

@@ -255,18 +239,6 @@ public abstract class BaseDateTimeType extends PrimitiveType { return getFieldValue(Calendar.MILLISECOND); } - /** - * Sets the milliseconds within the current second. - *

- * Note that this method sets the - * same value as {@link #setNanos(long)} but with less precision. - *

- */ - public BaseDateTimeType setMillis(int theMillis) { - setFieldValue(Calendar.MILLISECOND, theMillis, null, 0, 999); - return this; - } - /** * Returns the minute of the hour in the range 0-59 */ @@ -274,14 +246,6 @@ public abstract class BaseDateTimeType extends PrimitiveType { return getFieldValue(Calendar.MINUTE); } - /** - * Sets the minute of the hour in the range 0-59 - */ - public BaseDateTimeType setMinute(int theMinute) { - setFieldValue(Calendar.MINUTE, theMinute, null, 0, 59); - return this; - } - /** * Returns the month with 0-index, e.g. 0=January */ @@ -289,14 +253,6 @@ public abstract class BaseDateTimeType extends PrimitiveType { return getFieldValue(Calendar.MONTH); } - /** - * Sets the month with 0-index, e.g. 0=January - */ - public BaseDateTimeType setMonth(int theMonth) { - setFieldValue(Calendar.MONTH, theMonth, null, 0, 11); - return this; - } - /** * Returns the nanoseconds within the current second *

@@ -313,29 +269,6 @@ public abstract class BaseDateTimeType extends PrimitiveType { return Long.parseLong(retVal); } - /** - * Sets the nanoseconds within the current second - *

- * Note that this method sets the - * same value as {@link #setMillis(int)} but with more precision. - *

- */ - public BaseDateTimeType setNanos(long theNanos) { - validateValueInRange(theNanos, 0, NANOS_PER_SECOND - 1); - String fractionalSeconds = StringUtils.leftPad(Long.toString(theNanos), 9, '0'); - - // Strip trailing 0s - for (int i = fractionalSeconds.length(); i > 0; i--) { - if (fractionalSeconds.charAt(i - 1) != '0') { - fractionalSeconds = fractionalSeconds.substring(0, i); - break; - } - } - int millis = (int) (theNanos / NANOS_PER_MILLIS); - setFieldValue(Calendar.MILLISECOND, millis, fractionalSeconds, 0, 999); - return this; - } - private int getOffsetIndex(String theValueString) { int plusIndex = theValueString.indexOf('+', 16); int minusIndex = theValueString.indexOf('-', 16); @@ -352,7 +285,7 @@ public abstract class BaseDateTimeType extends PrimitiveType { /** * Gets the precision for this datatype (using the default for the given type if not set) - * + * * @see #setPrecision(TemporalPrecisionEnum) */ public TemporalPrecisionEnum getPrecision() { @@ -362,19 +295,6 @@ public abstract class BaseDateTimeType extends PrimitiveType { return myPrecision; } - /** - * Sets the precision for this datatype - * - * @throws DataFormatException - */ - public void setPrecision(TemporalPrecisionEnum thePrecision) throws DataFormatException { - if (thePrecision == null) { - throw new NullPointerException("Precision may not be null"); - } - myPrecision = thePrecision; - updateStringValue(); - } - /** * Returns the second of the minute in the range 0-59 */ @@ -382,32 +302,17 @@ public abstract class BaseDateTimeType extends PrimitiveType { return getFieldValue(Calendar.SECOND); } - /** - * Sets the second of the minute in the range 0-59 - */ - public BaseDateTimeType setSecond(int theSecond) { - setFieldValue(Calendar.SECOND, theSecond, null, 0, 59); - return this; - } - /** * Returns the TimeZone associated with this dateTime's value. May return null if no timezone was * supplied. */ public TimeZone getTimeZone() { if (myTimeZoneZulu) { - return TimeZone.getTimeZone("Z"); + return TimeZone.getTimeZone("GMT"); } return myTimeZone; } - public BaseDateTimeType setTimeZone(TimeZone theTimeZone) { - myTimeZone = theTimeZone; - myTimeZoneZulu = false; - updateStringValue(); - return this; - } - /** * Returns the value of this object as a {@link GregorianCalendar} */ @@ -432,14 +337,6 @@ public abstract class BaseDateTimeType extends PrimitiveType { return getFieldValue(Calendar.YEAR); } - /** - * Sets the year, e.g. 2015 - */ - public BaseDateTimeType setYear(int theYear) { - setFieldValue(Calendar.YEAR, theYear, null, 0, 9999); - return this; - } - /** * To be implemented by subclasses to indicate whether the given precision is allowed by this type */ @@ -452,16 +349,9 @@ public abstract class BaseDateTimeType extends PrimitiveType { return myTimeZoneZulu; } - public BaseDateTimeType setTimeZoneZulu(boolean theTimeZoneZulu) { - myTimeZoneZulu = theTimeZoneZulu; - myTimeZone = null; - updateStringValue(); - return this; - } - /** * Returns true if this object represents a date that is today's date - * + * * @throws NullPointerException * if {@link #getValue()} returns null */ @@ -602,6 +492,14 @@ public abstract class BaseDateTimeType extends PrimitiveType { return retVal; } + /** + * Sets the month with 1-index, e.g. 1=the first day of the month + */ + public BaseDateTimeType setDay(int theDay) { + setFieldValue(Calendar.DAY_OF_MONTH, theDay, null, 0, 31); + return this; + } + private void setFieldValue(int theField, int theValue, String theFractionalSeconds, int theMinimum, int theMaximum) { validateValueInRange(theValue, theMinimum, theMaximum); Calendar cal; @@ -621,6 +519,86 @@ public abstract class BaseDateTimeType extends PrimitiveType { super.setValue(cal.getTime()); } + /** + * Sets the hour of the day in a 24h clock, e.g. 13=1pm + */ + public BaseDateTimeType setHour(int theHour) { + setFieldValue(Calendar.HOUR_OF_DAY, theHour, null, 0, 23); + return this; + } + + /** + * Sets the milliseconds within the current second. + *

+ * Note that this method sets the + * same value as {@link #setNanos(long)} but with less precision. + *

+ */ + public BaseDateTimeType setMillis(int theMillis) { + setFieldValue(Calendar.MILLISECOND, theMillis, null, 0, 999); + return this; + } + + /** + * Sets the minute of the hour in the range 0-59 + */ + public BaseDateTimeType setMinute(int theMinute) { + setFieldValue(Calendar.MINUTE, theMinute, null, 0, 59); + return this; + } + + /** + * Sets the month with 0-index, e.g. 0=January + */ + public BaseDateTimeType setMonth(int theMonth) { + setFieldValue(Calendar.MONTH, theMonth, null, 0, 11); + return this; + } + + /** + * Sets the nanoseconds within the current second + *

+ * Note that this method sets the + * same value as {@link #setMillis(int)} but with more precision. + *

+ */ + public BaseDateTimeType setNanos(long theNanos) { + validateValueInRange(theNanos, 0, NANOS_PER_SECOND - 1); + String fractionalSeconds = StringUtils.leftPad(Long.toString(theNanos), 9, '0'); + + // Strip trailing 0s + for (int i = fractionalSeconds.length(); i > 0; i--) { + if (fractionalSeconds.charAt(i - 1) != '0') { + fractionalSeconds = fractionalSeconds.substring(0, i); + break; + } + } + int millis = (int) (theNanos / NANOS_PER_MILLIS); + setFieldValue(Calendar.MILLISECOND, millis, fractionalSeconds, 0, 999); + return this; + } + + /** + * Sets the precision for this datatype + * + * @throws DataFormatException + */ + public void setPrecision(TemporalPrecisionEnum thePrecision) throws DataFormatException { + if (thePrecision == null) { + throw new NullPointerException("Precision may not be null"); + } + myPrecision = thePrecision; + updateStringValue(); + } + + /** + * Sets the second of the minute in the range 0-59 + */ + public BaseDateTimeType setSecond(int theSecond) { + setFieldValue(Calendar.SECOND, theSecond, null, 0, 59); + return this; + } + private BaseDateTimeType setTimeZone(String theWholeValue, String theValue) { if (isBlank(theValue)) { @@ -642,6 +620,20 @@ public abstract class BaseDateTimeType extends PrimitiveType { return this; } + public BaseDateTimeType setTimeZone(TimeZone theTimeZone) { + myTimeZone = theTimeZone; + myTimeZoneZulu = false; + updateStringValue(); + return this; + } + + public BaseDateTimeType setTimeZoneZulu(boolean theTimeZoneZulu) { + myTimeZoneZulu = theTimeZoneZulu; + myTimeZone = null; + updateStringValue(); + return this; + } + /** * Sets the value for this type using the given Java Date object as the time, and using the default precision for * this datatype (unless the precision is already set), as well as the local timezone as determined by the local operating @@ -657,7 +649,7 @@ public abstract class BaseDateTimeType extends PrimitiveType { * Sets the value for this type using the given Java Date object as the time, and using the specified precision, as * well as the local timezone as determined by the local operating system. Both of * these properties may be modified in subsequent calls if neccesary. - * + * * @param theValue * The date value * @param thePrecision @@ -729,6 +721,14 @@ public abstract class BaseDateTimeType extends PrimitiveType { } } + /** + * Sets the year, e.g. 2015 + */ + public BaseDateTimeType setYear(int theYear) { + setFieldValue(Calendar.YEAR, theYear, null, 0, 9999); + return this; + } + private void throwBadDateFormat(String theValue) { throw new DataFormatException("Invalid date/time format: \"" + theValue + "\""); } diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/FHIRPathEngine.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/FHIRPathEngine.java index df0e5b5c9fb..1efd44f25f4 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/FHIRPathEngine.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/FHIRPathEngine.java @@ -1,27 +1,56 @@ package org.hl7.fhir.r4.utils; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + import ca.uhn.fhir.model.api.TemporalPrecisionEnum; -import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; -import ca.uhn.fhir.util.ElementUtil; -import org.fhir.ucum.Decimal; -import org.fhir.ucum.UcumException; -import org.hl7.fhir.exceptions.DefinitionException; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.exceptions.PathEngineException; import org.hl7.fhir.r4.conformance.ProfileUtilities; import org.hl7.fhir.r4.context.IWorkerContext; -import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.elementmodel.Element; +import org.hl7.fhir.r4.elementmodel.ObjectConverter; +import org.hl7.fhir.r4.model.Base; +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.DateTimeType; +import org.hl7.fhir.r4.model.DateType; +import org.hl7.fhir.r4.model.DecimalType; +import org.hl7.fhir.r4.model.ElementDefinition; import org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent; -import org.hl7.fhir.r4.model.ExpressionNode.*; +import org.hl7.fhir.r4.model.ExpressionNode; +import org.hl7.fhir.r4.model.ExpressionNode.CollectionStatus; +import org.hl7.fhir.r4.model.ExpressionNode.Function; +import org.hl7.fhir.r4.model.ExpressionNode.Kind; +import org.hl7.fhir.r4.model.ExpressionNode.Operation; +import org.hl7.fhir.r4.model.ExpressionNode.SourceLocation; +import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.Property; +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.StructureDefinitionKind; import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.r4.model.TimeType; +import org.hl7.fhir.r4.model.TypeDetails; +import org.hl7.fhir.r4.model.ValueSet; import org.hl7.fhir.r4.model.TypeDetails.ProfiledType; import org.hl7.fhir.r4.utils.FHIRLexer.FHIRLexerException; import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails; +import org.hl7.fhir.exceptions.DefinitionException; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.exceptions.PathEngineException; import org.hl7.fhir.utilities.Utilities; +import org.fhir.ucum.Decimal; +import org.fhir.ucum.UcumException; -import java.math.BigDecimal; -import java.util.*; +import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import ca.uhn.fhir.util.ElementUtil; /** * @@ -35,6 +64,88 @@ public class FHIRPathEngine { private Set primitiveTypes = new HashSet(); private Map allTypes = new HashMap(); + // if the fhir path expressions are allowed to use constants beyond those defined in the specification + // the application can implement them by providing a constant resolver + public interface IEvaluationContext { + public class FunctionDetails { + private String description; + private int minParameters; + private int maxParameters; + public FunctionDetails(String description, int minParameters, int maxParameters) { + super(); + this.description = description; + this.minParameters = minParameters; + this.maxParameters = maxParameters; + } + public String getDescription() { + return description; + } + public int getMinParameters() { + return minParameters; + } + public int getMaxParameters() { + return maxParameters; + } + + } + + /** + * A constant reference - e.g. a reference to a name that must be resolved in context. + * The % will be removed from the constant name before this is invoked. + * + * This will also be called if the host invokes the FluentPath engine with a context of null + * + * @param appContext - content passed into the fluent path engine + * @param name - name reference to resolve + * @return the value of the reference (or null, if it's not valid, though can throw an exception if desired) + */ + public Base resolveConstant(Object appContext, String name) throws PathEngineException; + public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException; + + /** + * when the .log() function is called + * + * @param argument + * @param focus + * @return + */ + public boolean log(String argument, List focus); + + // extensibility for functions + /** + * + * @param functionName + * @return null if the function is not known + */ + public FunctionDetails resolveFunction(String functionName); + + /** + * Check the function parameters, and throw an error if they are incorrect, or return the type for the function + * @param functionName + * @param parameters + * @return + */ + public TypeDetails checkFunction(Object appContext, String functionName, List parameters) throws PathEngineException; + + /** + * @param appContext + * @param functionName + * @param parameters + * @return + */ + public List executeFunction(Object appContext, String functionName, List> parameters); + + /** + * Implementation of resolve() function. Passed a string, return matching resource, if one is known - else null + * @param appInfo + * @param url + * @return + */ + public Base resolveReference(Object appContext, String url); + + } + + /** * @param worker - used when validating paths (@check), and used doing value set membership when executing tests (once that's defined) */ @@ -50,39 +161,93 @@ public class FHIRPathEngine { } } - private TypeDetails anything(CollectionStatus status) { - return new TypeDetails(status, allTypes.keySet()); - } - // --- 3 methods to override in children ------------------------------------------------------- // if you don't override, it falls through to the using the base reference implementation // HAPI overrides to these to support extending the base model - private ExecutionContext changeThis(ExecutionContext context, Base newThis) { - return new ExecutionContext(context.appInfo, context.resource, context.context, context.aliases, newThis); + public IEvaluationContext getHostServices() { + return hostServices; } - private ExecutionTypeContext changeThis(ExecutionTypeContext context, TypeDetails newThis) { - return new ExecutionTypeContext(context.appInfo, context.resource, context.context, newThis); + + public void setHostServices(IEvaluationContext constantResolver) { + this.hostServices = constantResolver; + } + + + /** + * Given an item, return all the children that conform to the pattern described in name + * + * Possible patterns: + * - a simple name (which may be the base of a name with [] e.g. value[x]) + * - a name with a type replacement e.g. valueCodeableConcept + * - * which means all children + * - ** which means all descendants + * + * @param item + * @param name + * @param result + * @throws FHIRException + */ + protected void getChildrenByName(Base item, String name, List result) throws FHIRException { + Base[] list = item.listChildrenByName(name, false); + if (list != null) + for (Base v : list) + if (v != null) + result.add(v); + } + + // --- public API ------------------------------------------------------- + /** + * Parse a path for later use using execute + * + * @param path + * @return + * @throws PathEngineException + * @throws Exception + */ + public ExpressionNode parse(String path) throws FHIRLexerException { + FHIRLexer lexer = new FHIRLexer(path); + if (lexer.done()) + throw lexer.error("Path cannot be empty"); + ExpressionNode result = parseExpression(lexer, true); + if (!lexer.done()) + throw lexer.error("Premature ExpressionNode termination at unexpected token \""+lexer.getCurrent()+"\""); + result.check(); + return result; + } + + /** + * Parse a path that is part of some other syntax + * + * @param path + * @return + * @throws PathEngineException + * @throws Exception + */ + public ExpressionNode parse(FHIRLexer lexer) throws FHIRLexerException { + ExpressionNode result = parseExpression(lexer, true); + result.check(); + return result; } /** * check that paths referred to in the ExpressionNode are valid - * + * * xPathStartsWithValueRef is a hack work around for the fact that FHIR Path sometimes needs a different starting point than the xpath - * + * * returns a list of the possible types that might be returned by executing the ExpressionNode against a particular context - * + * * @param context - the logical type against which this path is applied * @param path - the FHIR Path statement to check - * @throws DefinitionException - * @throws PathEngineException + * @throws DefinitionException + * @throws PathEngineException * @if the path is not valid */ public TypeDetails check(Object appContext, String resourceType, String context, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException { - // if context is a path that refers to a type, do that conversion now - TypeDetails types; + // if context is a path that refers to a type, do that conversion now + TypeDetails types; if (context == null) { types = null; // this is a special case; the first path reference will have to resolve to something in the context } else if (!context.contains(".")) { @@ -94,18 +259,18 @@ public class FHIRPathEngine { ctxt = resourceType.substring(0, resourceType.lastIndexOf("/")+1)+ctxt; } StructureDefinition sd = worker.fetchResource(StructureDefinition.class, ctxt); - if (sd == null) + if (sd == null) throw new PathEngineException("Unknown context "+context); ElementDefinitionMatch ed = getElementDefinition(sd, context, true); - if (ed == null) + if (ed == null) throw new PathEngineException("Unknown context element "+context); - if (ed.fixedType != null) + if (ed.fixedType != null) types = new TypeDetails(CollectionStatus.SINGLETON, ed.fixedType); - else if (ed.getDefinition().getType().isEmpty() || isAbstractType(ed.getDefinition().getType())) + else if (ed.getDefinition().getType().isEmpty() || isAbstractType(ed.getDefinition().getType())) types = new TypeDetails(CollectionStatus.SINGLETON, ctxt+"#"+context); else { types = new TypeDetails(CollectionStatus.SINGLETON); - for (TypeRefComponent t : ed.getDefinition().getType()) + for (TypeRefComponent t : ed.getDefinition().getType()) types.addType(t.getCode()); } } @@ -113,24 +278,22 @@ public class FHIRPathEngine { return executeType(new ExecutionTypeContext(appContext, resourceType, context, types), types, expr, true); } - // --- public API ------------------------------------------------------- - public TypeDetails check(Object appContext, StructureDefinition sd, String context, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException { - // if context is a path that refers to a type, do that conversion now - TypeDetails types; + // if context is a path that refers to a type, do that conversion now + TypeDetails types; if (!context.contains(".")) { types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl()); } else { ElementDefinitionMatch ed = getElementDefinition(sd, context, true); - if (ed == null) + if (ed == null) throw new PathEngineException("Unknown context element "+context); - if (ed.fixedType != null) + if (ed.fixedType != null) types = new TypeDetails(CollectionStatus.SINGLETON, ed.fixedType); - else if (ed.getDefinition().getType().isEmpty() || isAbstractType(ed.getDefinition().getType())) + else if (ed.getDefinition().getType().isEmpty() || isAbstractType(ed.getDefinition().getType())) types = new TypeDetails(CollectionStatus.SINGLETON, sd.getUrl()+"#"+context); else { types = new TypeDetails(CollectionStatus.SINGLETON); - for (TypeRefComponent t : ed.getDefinition().getType()) + for (TypeRefComponent t : ed.getDefinition().getType()) types.addType(t.getCode()); } } @@ -139,7 +302,7 @@ public class FHIRPathEngine { } public TypeDetails check(Object appContext, StructureDefinition sd, ExpressionNode expr) throws FHIRLexerException, PathEngineException, DefinitionException { - // if context is a path that refers to a type, do that conversion now + // if context is a path that refers to a type, do that conversion now TypeDetails types = null; // this is a special case; the first path reference will have to resolve to something in the context return executeType(new ExecutionTypeContext(appContext, sd == null ? null : sd.getUrl(), null, types), types, expr, true); } @@ -148,6 +311,477 @@ public class FHIRPathEngine { return check(appContext, resourceType, context, parse(expr)); } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param ExpressionNode - the parsed ExpressionNode statement to use + * @return + * @throws FHIRException + * @ + */ + public List evaluate(Base base, ExpressionNode ExpressionNode) throws FHIRException { + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(null, base != null && base.isResource() ? base : null, base, null, base), list, ExpressionNode, true); + } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRException + * @ + */ + public List evaluate(Base base, String path) throws FHIRException { + ExpressionNode exp = parse(path); + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(null, base.isResource() ? base : null, base, null, base), list, exp, true); + } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param ExpressionNode - the parsed ExpressionNode statement to use + * @return + * @throws FHIRException + * @ + */ + public List evaluate(Object appContext, Resource resource, Base base, ExpressionNode ExpressionNode) throws FHIRException { + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(appContext, resource, base, null, base), list, ExpressionNode, true); + } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param ExpressionNode - the parsed ExpressionNode statement to use + * @return + * @throws FHIRException + * @ + */ + public List evaluate(Object appContext, Base resource, Base base, ExpressionNode ExpressionNode) throws FHIRException { + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(appContext, resource, base, null, base), list, ExpressionNode, true); + } + + /** + * evaluate a path and return the matching elements + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRException + * @ + */ + public List evaluate(Object appContext, Resource resource, Base base, String path) throws FHIRException { + ExpressionNode exp = parse(path); + List list = new ArrayList(); + if (base != null) + list.add(base); + log = new StringBuilder(); + return execute(new ExecutionContext(appContext, resource, base, null, base), list, exp, true); + } + + /** + * evaluate a path and return true or false (e.g. for an invariant) + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRException + * @ + */ + public boolean evaluateToBoolean(Resource resource, Base base, String path) throws FHIRException { + return convertToBoolean(evaluate(null, resource, base, path)); + } + + /** + * evaluate a path and return true or false (e.g. for an invariant) + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRException + * @ + */ + public boolean evaluateToBoolean(Resource resource, Base base, ExpressionNode node) throws FHIRException { + return convertToBoolean(evaluate(null, resource, base, node)); + } + + /** + * evaluate a path and return true or false (e.g. for an invariant) + * + * @param appinfo - application context + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRException + * @ + */ + public boolean evaluateToBoolean(Object appInfo, Base resource, Base base, ExpressionNode node) throws FHIRException { + return convertToBoolean(evaluate(appInfo, resource, base, node)); + } + + /** + * evaluate a path and return true or false (e.g. for an invariant) + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRException + * @ + */ + public boolean evaluateToBoolean(Base resource, Base base, ExpressionNode node) throws FHIRException { + return convertToBoolean(evaluate(null, resource, base, node)); + } + + /** + * evaluate a path and a string containing the outcome (for display) + * + * @param base - the object against which the path is being evaluated + * @param path - the FHIR Path statement to use + * @return + * @throws FHIRException + * @ + */ + public String evaluateToString(Base base, String path) throws FHIRException { + return convertToString(evaluate(base, path)); + } + + public String evaluateToString(Object appInfo, Base resource, Base base, ExpressionNode node) throws FHIRException { + return convertToString(evaluate(appInfo, resource, base, node)); + } + + /** + * worker routine for converting a set of objects to a string representation + * + * @param items - result from @evaluate + * @return + */ + public String convertToString(List items) { + StringBuilder b = new StringBuilder(); + boolean first = true; + for (Base item : items) { + if (first) + first = false; + else + b.append(','); + + b.append(convertToString(item)); + } + return b.toString(); + } + + private String convertToString(Base item) { + if (item.isPrimitive()) + return item.primitiveValue(); + else + return item.toString(); + } + + /** + * worker routine for converting a set of objects to a boolean representation (for invariants) + * + * @param items - result from @evaluate + * @return + */ + public boolean convertToBoolean(List items) { + if (items == null) + return false; + else if (items.size() == 1 && items.get(0) instanceof BooleanType) + return ((BooleanType) items.get(0)).getValue(); + else + return items.size() > 0; + } + + + private void log(String name, List contents) { + if (hostServices == null || !hostServices.log(name, contents)) { + if (log.length() > 0) + log.append("; "); + log.append(name); + log.append(": "); + boolean first = true; + for (Base b : contents) { + if (first) + first = false; + else + log.append(","); + log.append(convertToString(b)); + } + } + } + + public String forLog() { + if (log.length() > 0) + return " ("+log.toString()+")"; + else + return ""; + } + + private class ExecutionContext { + private Object appInfo; + private Base resource; + private Base context; + private Base thisItem; + private Map aliases; + + public ExecutionContext(Object appInfo, Base resource, Base context, Map aliases, Base thisItem) { + this.appInfo = appInfo; + this.context = context; + this.resource = resource; + this.aliases = aliases; + this.thisItem = thisItem; + } + public Base getResource() { + return resource; + } + public Base getThisItem() { + return thisItem; + } + public void addAlias(String name, List focus) throws FHIRException { + if (aliases == null) + aliases = new HashMap(); + else + aliases = new HashMap(aliases); // clone it, since it's going to change + if (focus.size() > 1) + throw new FHIRException("Attempt to alias a collection, not a singleton"); + aliases.put(name, focus.size() == 0 ? null : focus.get(0)); + } + public Base getAlias(String name) { + return aliases == null ? null : aliases.get(name); + } + } + + private class ExecutionTypeContext { + private Object appInfo; + private String resource; + private String context; + private TypeDetails thisItem; + + + public ExecutionTypeContext(Object appInfo, String resource, String context, TypeDetails thisItem) { + super(); + this.appInfo = appInfo; + this.resource = resource; + this.context = context; + this.thisItem = thisItem; + + } + public String getResource() { + return resource; + } + public TypeDetails getThisItem() { + return thisItem; + } + } + + private ExpressionNode parseExpression(FHIRLexer lexer, boolean proximal) throws FHIRLexerException { + ExpressionNode result = new ExpressionNode(lexer.nextId()); + SourceLocation c = lexer.getCurrentStartLocation(); + result.setStart(lexer.getCurrentLocation()); + // special: + if (lexer.getCurrent().equals("-")) { + lexer.take(); + lexer.setCurrent("-"+lexer.getCurrent()); + } + if (lexer.getCurrent().equals("+")) { + lexer.take(); + lexer.setCurrent("+"+lexer.getCurrent()); + } + if (lexer.isConstant(false)) { + checkConstant(lexer.getCurrent(), lexer); + result.setConstant(lexer.take()); + result.setKind(Kind.Constant); + result.setEnd(lexer.getCurrentLocation()); + } else if ("(".equals(lexer.getCurrent())) { + lexer.next(); + result.setKind(Kind.Group); + result.setGroup(parseExpression(lexer, true)); + if (!")".equals(lexer.getCurrent())) + throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\""); + result.setEnd(lexer.getCurrentLocation()); + lexer.next(); + } else { + if (!lexer.isToken() && !lexer.getCurrent().startsWith("\"")) + throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name"); + if (lexer.getCurrent().startsWith("\"")) + result.setName(lexer.readConstant("Path Name")); + else + result.setName(lexer.take()); + result.setEnd(lexer.getCurrentLocation()); + if (!result.checkName()) + throw lexer.error("Found "+result.getName()+" expecting a valid token name"); + if ("(".equals(lexer.getCurrent())) { + Function f = Function.fromCode(result.getName()); + FunctionDetails details = null; + if (f == null) { + if (hostServices != null) + details = hostServices.resolveFunction(result.getName()); + if (details == null) + throw lexer.error("The name "+result.getName()+" is not a valid function name"); + f = Function.Custom; + } + result.setKind(Kind.Function); + result.setFunction(f); + lexer.next(); + while (!")".equals(lexer.getCurrent())) { + result.getParameters().add(parseExpression(lexer, true)); + if (",".equals(lexer.getCurrent())) + lexer.next(); + else if (!")".equals(lexer.getCurrent())) + throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - either a \",\" or a \")\" expected"); + } + result.setEnd(lexer.getCurrentLocation()); + lexer.next(); + checkParameters(lexer, c, result, details); + } else + result.setKind(Kind.Name); + } + ExpressionNode focus = result; + if ("[".equals(lexer.getCurrent())) { + lexer.next(); + ExpressionNode item = new ExpressionNode(lexer.nextId()); + item.setKind(Kind.Function); + item.setFunction(ExpressionNode.Function.Item); + item.getParameters().add(parseExpression(lexer, true)); + if (!lexer.getCurrent().equals("]")) + throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - a \"]\" expected"); + lexer.next(); + result.setInner(item); + focus = item; + } + if (".".equals(lexer.getCurrent())) { + lexer.next(); + focus.setInner(parseExpression(lexer, false)); + } + result.setProximal(proximal); + if (proximal) { + while (lexer.isOp()) { + focus.setOperation(ExpressionNode.Operation.fromCode(lexer.getCurrent())); + focus.setOpStart(lexer.getCurrentStartLocation()); + focus.setOpEnd(lexer.getCurrentLocation()); + lexer.next(); + focus.setOpNext(parseExpression(lexer, false)); + focus = focus.getOpNext(); + } + result = organisePrecedence(lexer, result); + } + return result; + } + + private ExpressionNode organisePrecedence(FHIRLexer lexer, ExpressionNode node) { + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Times, Operation.DivideBy, Operation.Div, Operation.Mod)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Plus, Operation.Minus, Operation.Concatenate)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Union)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.LessThen, Operation.Greater, Operation.LessOrEqual, Operation.GreaterOrEqual)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Is)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Equals, Operation.Equivalent, Operation.NotEquals, Operation.NotEquivalent)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.And)); + node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Xor, Operation.Or)); + // last: implies + return node; + } + + private ExpressionNode gatherPrecedence(FHIRLexer lexer, ExpressionNode start, EnumSet ops) { + // work : boolean; + // focus, node, group : ExpressionNode; + + assert(start.isProximal()); + + // is there anything to do? + boolean work = false; + ExpressionNode focus = start.getOpNext(); + if (ops.contains(start.getOperation())) { + while (focus != null && focus.getOperation() != null) { + work = work || !ops.contains(focus.getOperation()); + focus = focus.getOpNext(); + } + } else { + while (focus != null && focus.getOperation() != null) { + work = work || ops.contains(focus.getOperation()); + focus = focus.getOpNext(); + } + } + if (!work) + return start; + + // entry point: tricky + ExpressionNode group; + if (ops.contains(start.getOperation())) { + group = newGroup(lexer, start); + group.setProximal(true); + focus = start; + start = group; + } else { + ExpressionNode node = start; + + focus = node.getOpNext(); + while (!ops.contains(focus.getOperation())) { + node = focus; + focus = focus.getOpNext(); + } + group = newGroup(lexer, focus); + node.setOpNext(group); + } + + // now, at this point: + // group is the group we are adding to, it already has a .group property filled out. + // focus points at the group.group + do { + // run until we find the end of the sequence + while (ops.contains(focus.getOperation())) + focus = focus.getOpNext(); + if (focus.getOperation() != null) { + group.setOperation(focus.getOperation()); + group.setOpNext(focus.getOpNext()); + focus.setOperation(null); + focus.setOpNext(null); + // now look for another sequence, and start it + ExpressionNode node = group; + focus = group.getOpNext(); + if (focus != null) { + while (focus != null && !ops.contains(focus.getOperation())) { + node = focus; + focus = focus.getOpNext(); + } + if (focus != null) { // && (focus.Operation in Ops) - must be true + group = newGroup(lexer, focus); + node.setOpNext(group); + } + } + } + } + while (focus != null && focus.getOperation() != null); + return start; + } + + + private ExpressionNode newGroup(FHIRLexer lexer, ExpressionNode next) { + ExpressionNode result = new ExpressionNode(lexer.nextId()); + result.setKind(Kind.Group); + result.setGroup(next); + result.getGroup().setProximal(true); + return result; + } + private void checkConstant(String s, FHIRLexer lexer) throws FHIRLexerException { if (s.startsWith("\'") && s.endsWith("\'")) { int i = 1; @@ -155,14 +789,14 @@ public class FHIRPathEngine { char ch = s.charAt(i); if (ch == '\\') { switch (ch) { - case 't': + case 't': case 'r': - case 'n': - case 'f': + case 'n': + case 'f': case '\'': - case '\\': - case '/': - i++; + case '\\': + case '/': + i++; break; case 'u': if (!Utilities.isHex("0x"+s.substring(i, i+4))) @@ -177,30 +811,11 @@ public class FHIRPathEngine { } } - private void checkContextCoded(TypeDetails focus, String name) throws PathEngineException { - if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Coding") && !focus.hasType(worker, "CodeableConcept")) - throw new PathEngineException("The function '"+name+"'() can only be used on string, code, uri, Coding, CodeableConcept"); - } - - private void checkContextPrimitive(TypeDetails focus, String name) throws PathEngineException { - if (!focus.hasType(primitiveTypes)) - throw new PathEngineException("The function '"+name+"'() can only be used on "+primitiveTypes.toString()); - } - - private void checkContextReference(TypeDetails focus, String name) throws PathEngineException { - if (!focus.hasType(worker, "string") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Reference")) - throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, Reference"); - } - - private void checkContextString(TypeDetails focus, String name) throws PathEngineException { - if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "id")) - throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, code, id, but found "+focus.describe()); - } - - private void checkOrdered(TypeDetails focus, String name) throws PathEngineException { - if (focus.getCollectionStatus() == CollectionStatus.UNORDERED) - throw new PathEngineException("The function '"+name+"'() can only be used on ordered collections"); - } + // procedure CheckParamCount(c : integer); + // begin + // if exp.Parameters.Count <> c then + // raise lexer.error('The function "'+exp.name+'" requires '+inttostr(c)+' parameters', offset); + // end; private boolean checkParamCount(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, int count) throws FHIRLexerException { if (exp.getParameters().size() != count) @@ -214,20 +829,6 @@ public class FHIRPathEngine { return true; } - private void checkParamTypes(String funcName, List paramTypes, TypeDetails... typeSet) throws PathEngineException { - int i = 0; - for (TypeDetails pt : typeSet) { - if (i == paramTypes.size()) - return; - TypeDetails actual = paramTypes.get(i); - i++; - for (String a : actual.getTypes()) { - if (!pt.hasType(worker, a)) - throw new PathEngineException("The parameter type '"+a+"' is not legal for "+funcName+" parameter "+Integer.toString(i)+". expecting "+pt.toString()); - } - } - } - private boolean checkParameters(FHIRLexer lexer, SourceLocation location, ExpressionNode exp, FunctionDetails details) throws FHIRLexerException { switch (exp.getFunction()) { case Empty: return checkParamCount(lexer, location, exp, 0); @@ -279,542 +880,6 @@ public class FHIRPathEngine { return false; } - private TypeDetails childTypes(TypeDetails focus, String mask) throws PathEngineException, DefinitionException { - TypeDetails result = new TypeDetails(CollectionStatus.UNORDERED); - for (String f : focus.getTypes()) - getChildTypesByName(f, mask, result); - return result; - } - - /** - * worker routine for converting a set of objects to a boolean representation (for invariants) - * - * @param items - result from @evaluate - * @return - */ - public boolean convertToBoolean(List items) { - if (items == null) - return false; - else if (items.size() == 1 && items.get(0) instanceof BooleanType) - return ((BooleanType) items.get(0)).getValue(); - else - return items.size() > 0; - } - - /** - * worker routine for converting a set of objects to a string representation - * - * @param items - result from @evaluate - * @return - */ - public String convertToString(List items) { - StringBuilder b = new StringBuilder(); - boolean first = true; - for (Base item : items) { - if (first) - first = false; - else - b.append(','); - - b.append(convertToString(item)); - } - return b.toString(); - } - - private String convertToString(Base item) { - if (item.isPrimitive()) - return item.primitiveValue(); - else - return item.toString(); - } - - private boolean doContains(List list, Base item) { - for (Base test : list) - if (doEquals(test, item)) - return true; - return false; - } - - private boolean doEquals(Base left, Base right) { - if (left.isPrimitive() && right.isPrimitive()) - return Base.equals(left.primitiveValue(), right.primitiveValue()); - else - return Base.compareDeep(left, right, false); - } - - private boolean doEquivalent(Base left, Base right) throws PathEngineException { - if (left.hasType("integer") && right.hasType("integer")) - return doEquals(left, right); - if (left.hasType("boolean") && right.hasType("boolean")) - return doEquals(left, right); - if (left.hasType("integer", "decimal", "unsignedInt", "positiveInt") && right.hasType("integer", "decimal", "unsignedInt", "positiveInt")) - return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue()); - if (left.hasType("date", "dateTime", "time", "instant") && right.hasType("date", "dateTime", "time", "instant")) - return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue()); - if (left.hasType("string", "id", "code", "uri") && right.hasType("string", "id", "code", "uri")) - return Utilities.equivalent(convertToString(left), convertToString(right)); - - throw new PathEngineException(String.format("Unable to determine equivalence between %s and %s", left.fhirType(), right.fhirType())); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param ExpressionNode - the parsed ExpressionNode statement to use - * @return - * @throws FHIRException - * @ - */ - public List evaluate(Base base, ExpressionNode ExpressionNode) throws FHIRException { - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(null, base != null && base.isResource() ? base : null, base, null, base), list, ExpressionNode, true); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRException - * @ - */ - public List evaluate(Base base, String path) throws FHIRException { - ExpressionNode exp = parse(path); - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(null, base.isResource() ? base : null, base, null, base), list, exp, true); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param ExpressionNode - the parsed ExpressionNode statement to use - * @return - * @throws FHIRException - * @ - */ - public List evaluate(Object appContext, Resource resource, Base base, ExpressionNode ExpressionNode) throws FHIRException { - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(appContext, resource, base, null, base), list, ExpressionNode, true); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param ExpressionNode - the parsed ExpressionNode statement to use - * @return - * @throws FHIRException - * @ - */ - public List evaluate(Object appContext, Base resource, Base base, ExpressionNode ExpressionNode) throws FHIRException { - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(appContext, resource, base, null, base), list, ExpressionNode, true); - } - - /** - * evaluate a path and return the matching elements - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRException - * @ - */ - public List evaluate(Object appContext, Resource resource, Base base, String path) throws FHIRException { - ExpressionNode exp = parse(path); - List list = new ArrayList(); - if (base != null) - list.add(base); - log = new StringBuilder(); - return execute(new ExecutionContext(appContext, resource, base, null, base), list, exp, true); - } - - /** given an element definition in a profile, what element contains the differentiating fixed - * for the element, given the differentiating expresssion. The expression is only allowed to - * use a subset of FHIRPath - * - * @param profile - * @param element - * @return - * @throws PathEngineException - * @throws DefinitionException - */ - public ElementDefinition evaluateDefinition(ExpressionNode expr, StructureDefinition profile, ElementDefinition element) throws DefinitionException { - StructureDefinition sd = profile; - ElementDefinition focus = null; - - if (expr.getKind() == Kind.Name) { - List childDefinitions; - childDefinitions = ProfileUtilities.getChildMap(sd, element); - // if that's empty, get the children of the type - if (childDefinitions.isEmpty()) { - sd = fetchStructureByType(element); - if (sd == null) - throw new DefinitionException("Problem with use of resolve() - profile '"+element.getType().get(0).getProfile()+"' on "+element.getId()+" could not be resolved"); - childDefinitions = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElementFirstRep()); - } - for (ElementDefinition t : childDefinitions) { - if (tailMatches(t, expr.getName())) { - focus = t; - break; - } - } - } else if (expr.getKind() == Kind.Function) { - if ("resolve".equals(expr.getName())) { - if (!element.hasType()) - throw new DefinitionException("illegal use of resolve() in discriminator - no type on element "+element.getId()); - if (element.getType().size() > 1) - throw new DefinitionException("illegal use of resolve() in discriminator - Multiple possible types on "+element.getId()); - if (!"Reference".equals(element.getType().get(0).getCode())) - throw new DefinitionException("illegal use of resolve() in discriminator - type on "+element.getId()+" is not Reference ("+element.getType().get(0).getCode()+")"); - sd = worker.fetchResource(StructureDefinition.class, element.getType().get(0).getTargetProfile()); - if (sd == null) - throw new DefinitionException("Problem with use of resolve() - profile '"+element.getType().get(0).getTargetProfile()+"' on "+element.getId()+" could not be resolved"); - focus = sd.getSnapshot().getElementFirstRep(); - } else if ("extension".equals(expr.getName())) - throw new DefinitionException("Not supported yet"); - else - throw new DefinitionException("illegal function name "+expr.getName()+"() in discriminator"); - } else if (expr.getKind() == Kind.Group) { - throw new DefinitionException("illegal expression syntax in discriminator (group)"); - } else if (expr.getKind() == Kind.Constant) { - throw new DefinitionException("illegal expression syntax in discriminator (const)"); - } - - if (focus == null) - throw new DefinitionException("Unable to resolve discriminator"); - else if (expr.getInner() == null) - return focus; - else - return evaluateDefinition(expr.getInner(), sd, focus); - } - - private List evaluateFunction(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - switch (exp.getFunction()) { - case Empty : return funcEmpty(context, focus, exp); - case Not : return funcNot(context, focus, exp); - case Exists : return funcExists(context, focus, exp); - case SubsetOf : return funcSubsetOf(context, focus, exp); - case SupersetOf : return funcSupersetOf(context, focus, exp); - case IsDistinct : return funcIsDistinct(context, focus, exp); - case Distinct : return funcDistinct(context, focus, exp); - case Count : return funcCount(context, focus, exp); - case Where : return funcWhere(context, focus, exp); - case Select : return funcSelect(context, focus, exp); - case All : return funcAll(context, focus, exp); - case Repeat : return funcRepeat(context, focus, exp); - case Item : return funcItem(context, focus, exp); - case As : return funcAs(context, focus, exp); - case Is : return funcIs(context, focus, exp); - case Single : return funcSingle(context, focus, exp); - case First : return funcFirst(context, focus, exp); - case Last : return funcLast(context, focus, exp); - case Tail : return funcTail(context, focus, exp); - case Skip : return funcSkip(context, focus, exp); - case Take : return funcTake(context, focus, exp); - case Iif : return funcIif(context, focus, exp); - case ToInteger : return funcToInteger(context, focus, exp); - case ToDecimal : return funcToDecimal(context, focus, exp); - case ToString : return funcToString(context, focus, exp); - case Substring : return funcSubstring(context, focus, exp); - case StartsWith : return funcStartsWith(context, focus, exp); - case EndsWith : return funcEndsWith(context, focus, exp); - case Matches : return funcMatches(context, focus, exp); - case ReplaceMatches : return funcReplaceMatches(context, focus, exp); - case Contains : return funcContains(context, focus, exp); - case Replace : return funcReplace(context, focus, exp); - case Length : return funcLength(context, focus, exp); - case Children : return funcChildren(context, focus, exp); - case Descendants : return funcDescendants(context, focus, exp); - case MemberOf : return funcMemberOf(context, focus, exp); - case Trace : return funcTrace(context, focus, exp); - case Today : return funcToday(context, focus, exp); - case Now : return funcNow(context, focus, exp); - case Resolve : return funcResolve(context, focus, exp); - case Extension : return funcExtension(context, focus, exp); - case HasValue : return funcHasValue(context, focus, exp); - case AliasAs : return funcAliasAs(context, focus, exp); - case Alias : return funcAlias(context, focus, exp); - case Custom: { - List> params = new ArrayList>(); - for (ExpressionNode p : exp.getParameters()) - params.add(execute(context, focus, p, true)); - return hostServices.executeFunction(context.appInfo, exp.getName(), params); - } - default: - throw new Error("not Implemented yet"); - } - } - - @SuppressWarnings("unchecked") - private TypeDetails evaluateFunctionType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp) throws PathEngineException, DefinitionException { - List paramTypes = new ArrayList(); - if (exp.getFunction() == Function.Is || exp.getFunction() == Function.As) - paramTypes.add(new TypeDetails(CollectionStatus.SINGLETON, "string")); - else - for (ExpressionNode expr : exp.getParameters()) { - if (exp.getFunction() == Function.Where || exp.getFunction() == Function.Select || exp.getFunction() == Function.Repeat) - paramTypes.add(executeType(changeThis(context, focus), focus, expr, true)); - else - paramTypes.add(executeType(context, focus, expr, true)); - } - switch (exp.getFunction()) { - case Empty : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Not : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Exists : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case SubsetOf : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case SupersetOf : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case IsDistinct : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Distinct : - return focus; - case Count : - return new TypeDetails(CollectionStatus.SINGLETON, "integer"); - case Where : - return focus; - case Select : - return anything(focus.getCollectionStatus()); - case All : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Repeat : - return anything(focus.getCollectionStatus()); - case Item : { - checkOrdered(focus, "item"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); - return focus; - } - case As : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, exp.getParameters().get(0).getName()); - } - case Is : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case Single : - return focus.toSingleton(); - case First : { - checkOrdered(focus, "first"); - return focus.toSingleton(); - } - case Last : { - checkOrdered(focus, "last"); - return focus.toSingleton(); - } - case Tail : { - checkOrdered(focus, "tail"); - return focus; - } - case Skip : { - checkOrdered(focus, "skip"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); - return focus; - } - case Take : { - checkOrdered(focus, "take"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); - return focus; - } - case Iif : { - TypeDetails types = new TypeDetails(null); - types.update(paramTypes.get(0)); - if (paramTypes.size() > 1) - types.update(paramTypes.get(1)); - return types; - } - case ToInteger : { - checkContextPrimitive(focus, "toInteger"); - return new TypeDetails(CollectionStatus.SINGLETON, "integer"); - } - case ToDecimal : { - checkContextPrimitive(focus, "toDecimal"); - return new TypeDetails(CollectionStatus.SINGLETON, "decimal"); - } - case ToString : { - checkContextPrimitive(focus, "toString"); - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - } - case Substring : { - checkContextString(focus, "subString"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer"), new TypeDetails(CollectionStatus.SINGLETON, "integer")); - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - } - case StartsWith : { - checkContextString(focus, "startsWith"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case EndsWith : { - checkContextString(focus, "endsWith"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case Matches : { - checkContextString(focus, "matches"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case ReplaceMatches : { - checkContextString(focus, "replaceMatches"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - } - case Contains : { - checkContextString(focus, "contains"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case Replace : { - checkContextString(focus, "replace"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - } - case Length : { - checkContextPrimitive(focus, "length"); - return new TypeDetails(CollectionStatus.SINGLETON, "integer"); - } - case Children : - return childTypes(focus, "*"); - case Descendants : - return childTypes(focus, "**"); - case MemberOf : { - checkContextCoded(focus, "memberOf"); - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - } - case Trace : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return focus; - } - case Today : - return new TypeDetails(CollectionStatus.SINGLETON, "date"); - case Now : - return new TypeDetails(CollectionStatus.SINGLETON, "dateTime"); - case Resolve : { - checkContextReference(focus, "resolve"); - return new TypeDetails(CollectionStatus.SINGLETON, "DomainResource"); - } - case Extension : { - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return new TypeDetails(CollectionStatus.SINGLETON, "Extension"); - } - case HasValue : - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Alias : - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return anything(CollectionStatus.SINGLETON); - case AliasAs : - checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); - return focus; - case Custom : { - return hostServices.checkFunction(context.appInfo, exp.getName(), paramTypes); - } - default: - break; - } - throw new Error("not Implemented yet"); - } - - /** - * evaluate a path and return true or false (e.g. for an invariant) - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRException - * @ - */ - public boolean evaluateToBoolean(Resource resource, Base base, String path) throws FHIRException { - return convertToBoolean(evaluate(null, resource, base, path)); - } - - // procedure CheckParamCount(c : integer); - // begin - // if exp.Parameters.Count <> c then - // raise lexer.error('The function "'+exp.name+'" requires '+inttostr(c)+' parameters', offset); - // end; - - /** - * evaluate a path and return true or false (e.g. for an invariant) - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRException - * @ - */ - public boolean evaluateToBoolean(Resource resource, Base base, ExpressionNode node) throws FHIRException { - return convertToBoolean(evaluate(null, resource, base, node)); - } - - /** - * evaluate a path and return true or false (e.g. for an invariant) - * - * @param appinfo - application context - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRException - * @ - */ - public boolean evaluateToBoolean(Object appInfo, Base resource, Base base, ExpressionNode node) throws FHIRException { - return convertToBoolean(evaluate(appInfo, resource, base, node)); - } - - /** - * evaluate a path and return true or false (e.g. for an invariant) - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRException - * @ - */ - public boolean evaluateToBoolean(Base resource, Base base, ExpressionNode node) throws FHIRException { - return convertToBoolean(evaluate(null, resource, base, node)); - } - - /** - * evaluate a path and a string containing the outcome (for display) - * - * @param base - the object against which the path is being evaluated - * @param path - the FHIR Path statement to use - * @return - * @throws FHIRException - * @ - */ - public String evaluateToString(Base base, String path) throws FHIRException { - return convertToString(evaluate(base, path)); - } - - public String evaluateToString(Object appInfo, Base resource, Base base, ExpressionNode node) throws FHIRException { - return convertToString(evaluate(appInfo, resource, base, node)); - } - private List execute(ExecutionContext context, List focus, ExpressionNode exp, boolean atEntry) throws FHIRException { // System.out.println("Evaluate {'"+exp.toString()+"'} on "+focus.toString()); List work = new ArrayList(); @@ -828,7 +893,7 @@ public class FHIRPathEngine { for (Base base : outcome) if (base != null) work.add(base); - } + } break; case Function: List work2 = evaluateFunction(context, focus, exp); @@ -870,26 +935,34 @@ public class FHIRPathEngine { return work; } - private List execute(ExecutionContext context, Base item, ExpressionNode exp, boolean atEntry) throws FHIRException { + private List executeTypeName(ExecutionContext context, List focus, ExpressionNode next, boolean atEntry) { List result = new ArrayList(); - if (atEntry && Character.isUpperCase(exp.getName().charAt(0))) {// special case for start up - if (item.isResource() && item.fhirType().equals(exp.getName())) - result.add(item); - } else - getChildrenByName(item, exp.getName(), result); - if (result.size() == 0 && atEntry && context.appInfo != null) { - Base temp = hostServices.resolveConstant(context.appInfo, exp.getName()); - if (temp != null) { - result.add(temp); - } - } + result.add(new StringType(next.getName())); return result; } - private TypeDetails executeContextType(ExecutionTypeContext context, String name) throws PathEngineException, DefinitionException { - if (hostServices == null) - throw new PathEngineException("Unable to resolve context reference since no host services are provided"); - return hostServices.resolveConstantType(context.appInfo, name); + + private List preOperate(List left, Operation operation) { + switch (operation) { + case And: + return isBoolean(left, false) ? makeBoolean(false) : null; + case Or: + return isBoolean(left, true) ? makeBoolean(true) : null; + case Implies: + return convertToBoolean(left) ? null : makeBoolean(true); + default: + return null; + } + } + + private List makeBoolean(boolean b) { + List res = new ArrayList(); + res.add(new BooleanType(b)); + return res; + } + + private TypeDetails executeTypeName(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { + return new TypeDetails(CollectionStatus.SINGLETON, exp.getName()); } private TypeDetails executeType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { @@ -941,6 +1014,816 @@ public class FHIRPathEngine { return result; } + private Base processConstant(ExecutionContext context, String constant) throws PathEngineException { + if (constant.equals("true")) { + return new BooleanType(true); + } else if (constant.equals("false")) { + return new BooleanType(false); + } else if (constant.equals("{}")) { + return null; + } else if (Utilities.isInteger(constant)) { + return new IntegerType(constant); + } else if (Utilities.isDecimal(constant)) { + return new DecimalType(constant); + } else if (constant.startsWith("\'")) { + return new StringType(processConstantString(constant)); + } else if (constant.startsWith("%")) { + return resolveConstant(context, constant); + } else if (constant.startsWith("@")) { + return processDateConstant(context.appInfo, constant.substring(1)); + } else { + return new StringType(constant); + } + } + + private Base processDateConstant(Object appInfo, String value) throws PathEngineException { + if (value.startsWith("T")) + return new TimeType(value.substring(1)); + String v = value; + if (v.length() > 10) { + int i = v.substring(10).indexOf("-"); + if (i == -1) + i = v.substring(10).indexOf("+"); + if (i == -1) + i = v.substring(10).indexOf("Z"); + v = i == -1 ? value : v.substring(0, 10+i); + } + if (v.length() > 10) + return new DateTimeType(value); + else + return new DateType(value); + } + + + private Base resolveConstant(ExecutionContext context, String s) throws PathEngineException { + if (s.equals("%sct")) + return new StringType("http://snomed.info/sct"); + else if (s.equals("%loinc")) + return new StringType("http://loinc.org"); + else if (s.equals("%ucum")) + return new StringType("http://unitsofmeasure.org"); + else if (s.equals("%resource")) { + if (context.resource == null) + throw new PathEngineException("Cannot use %resource in this context"); + return context.resource; + } else if (s.equals("%context")) { + return context.context; + } else if (s.equals("%us-zip")) + return new StringType("[0-9]{5}(-[0-9]{4}){0,1}"); + else if (s.startsWith("%\"vs-")) + return new StringType("http://hl7.org/fhir/ValueSet/"+s.substring(5, s.length()-1)+""); + else if (s.startsWith("%\"cs-")) + return new StringType("http://hl7.org/fhir/"+s.substring(5, s.length()-1)+""); + else if (s.startsWith("%\"ext-")) + return new StringType("http://hl7.org/fhir/StructureDefinition/"+s.substring(6, s.length()-1)); + else if (hostServices == null) + throw new PathEngineException("Unknown fixed constant '"+s+"'"); + else + return hostServices.resolveConstant(context.appInfo, s.substring(1)); + } + + + private String processConstantString(String s) throws PathEngineException { + StringBuilder b = new StringBuilder(); + int i = 1; + while (i < s.length()-1) { + char ch = s.charAt(i); + if (ch == '\\') { + i++; + switch (s.charAt(i)) { + case 't': + b.append('\t'); + break; + case 'r': + b.append('\r'); + break; + case 'n': + b.append('\n'); + break; + case 'f': + b.append('\f'); + break; + case '\'': + b.append('\''); + break; + case '\\': + b.append('\\'); + break; + case '/': + b.append('/'); + break; + case 'u': + i++; + int uc = Integer.parseInt(s.substring(i, i+4), 16); + b.append((char) uc); + i = i + 3; + break; + default: + throw new PathEngineException("Unknown character escape \\"+s.charAt(i)); + } + i++; + } else { + b.append(ch); + i++; + } + } + return b.toString(); + } + + + private List operate(List left, Operation operation, List right) throws FHIRException { + switch (operation) { + case Equals: return opEquals(left, right); + case Equivalent: return opEquivalent(left, right); + case NotEquals: return opNotEquals(left, right); + case NotEquivalent: return opNotEquivalent(left, right); + case LessThen: return opLessThen(left, right); + case Greater: return opGreater(left, right); + case LessOrEqual: return opLessOrEqual(left, right); + case GreaterOrEqual: return opGreaterOrEqual(left, right); + case Union: return opUnion(left, right); + case In: return opIn(left, right); + case MemberOf: return opMemberOf(left, right); + case Contains: return opContains(left, right); + case Or: return opOr(left, right); + case And: return opAnd(left, right); + case Xor: return opXor(left, right); + case Implies: return opImplies(left, right); + case Plus: return opPlus(left, right); + case Times: return opTimes(left, right); + case Minus: return opMinus(left, right); + case Concatenate: return opConcatenate(left, right); + case DivideBy: return opDivideBy(left, right); + case Div: return opDiv(left, right); + case Mod: return opMod(left, right); + case Is: return opIs(left, right); + case As: return opAs(left, right); + default: + throw new Error("Not Done Yet: "+operation.toCode()); + } + } + + private List opAs(List left, List right) { + List result = new ArrayList(); + if (left.size() != 1 || right.size() != 1) + return result; + else { + String tn = convertToString(right); + if (tn.equals(left.get(0).fhirType())) + result.add(left.get(0)); + } + return result; + } + + + private List opIs(List left, List right) { + List result = new ArrayList(); + if (left.size() != 1 || right.size() != 1) + result.add(new BooleanType(false)); + else { + String tn = convertToString(right); + result.add(new BooleanType(left.get(0).hasType(tn))); + } + return result; + } + + + private TypeDetails operateTypes(TypeDetails left, Operation operation, TypeDetails right) { + switch (operation) { + case Equals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Equivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case NotEquals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case NotEquivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case LessThen: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Greater: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case LessOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case GreaterOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Is: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case As: return new TypeDetails(CollectionStatus.SINGLETON, right.getTypes()); + case Union: return left.union(right); + case Or: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case And: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Xor: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Implies : return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Times: + TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("integer"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + return result; + case DivideBy: + result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("decimal"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + return result; + case Concatenate: + result = new TypeDetails(CollectionStatus.SINGLETON, ""); +// return result; + // fall through + case Plus: + result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("integer"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + else if (left.hasType(worker, "string", "id", "code", "uri") && right.hasType(worker, "string", "id", "code", "uri")) + result.addType("string"); + return result; + case Minus: + result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("integer"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + return result; + case Div: + case Mod: + result = new TypeDetails(CollectionStatus.SINGLETON); + if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) + result.addType("integer"); + else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) + result.addType("decimal"); + return result; + case In: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case MemberOf: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Contains: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + default: + return null; + } + } + + + private List opEquals(List left, List right) { + if (left.size() != right.size()) + return makeBoolean(false); + + boolean res = true; + for (int i = 0; i < left.size(); i++) { + if (!doEquals(left.get(i), right.get(i))) { + res = false; + break; + } + } + return makeBoolean(res); + } + + private List opNotEquals(List left, List right) { + if (left.size() != right.size()) + return makeBoolean(true); + + boolean res = true; + for (int i = 0; i < left.size(); i++) { + if (!doEquals(left.get(i), right.get(i))) { + res = false; + break; + } + } + return makeBoolean(!res); + } + + private boolean doEquals(Base left, Base right) { + if (left.isPrimitive() && right.isPrimitive()) + return Base.equals(left.primitiveValue(), right.primitiveValue()); + else + return Base.compareDeep(left, right, false); + } + + private boolean doEquivalent(Base left, Base right) throws PathEngineException { + if (left.hasType("integer") && right.hasType("integer")) + return doEquals(left, right); + if (left.hasType("boolean") && right.hasType("boolean")) + return doEquals(left, right); + if (left.hasType("integer", "decimal", "unsignedInt", "positiveInt") && right.hasType("integer", "decimal", "unsignedInt", "positiveInt")) + return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue()); + if (left.hasType("date", "dateTime", "time", "instant") && right.hasType("date", "dateTime", "time", "instant")) + return Utilities.equivalentNumber(left.primitiveValue(), right.primitiveValue()); + if (left.hasType("string", "id", "code", "uri") && right.hasType("string", "id", "code", "uri")) + return Utilities.equivalent(convertToString(left), convertToString(right)); + + throw new PathEngineException(String.format("Unable to determine equivalence between %s and %s", left.fhirType(), right.fhirType())); + } + + private List opEquivalent(List left, List right) throws PathEngineException { + if (left.size() != right.size()) + return makeBoolean(false); + + boolean res = true; + for (int i = 0; i < left.size(); i++) { + boolean found = false; + for (int j = 0; j < right.size(); j++) { + if (doEquivalent(left.get(i), right.get(j))) { + found = true; + break; + } + } + if (!found) { + res = false; + break; + } + } + return makeBoolean(res); + } + + private List opNotEquivalent(List left, List right) throws PathEngineException { + if (left.size() != right.size()) + return makeBoolean(true); + + boolean res = true; + for (int i = 0; i < left.size(); i++) { + boolean found = false; + for (int j = 0; j < right.size(); j++) { + if (doEquivalent(left.get(i), right.get(j))) { + found = true; + break; + } + } + if (!found) { + res = false; + break; + } + } + return makeBoolean(!res); + } + + private List opLessThen(List left, List right) throws FHIRException { + if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string") && r.hasType("string")) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); + else if ((l.hasType("integer") || l.hasType("decimal")) && (r.hasType("integer") || r.hasType("decimal"))) + return makeBoolean(new Double(l.primitiveValue()) < new Double(r.primitiveValue())); + else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); + else if ((l.hasType("time")) && (r.hasType("time"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); + } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { + List lUnit = left.get(0).listChildrenByName("unit"); + List rUnit = right.get(0).listChildrenByName("unit"); + if (Base.compareDeep(lUnit, rUnit, true)) { + return opLessThen(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); + } else { + throw new InternalErrorException("Canonical Comparison isn't done yet"); + } + } + return new ArrayList(); + } + + private List opGreater(List left, List right) throws FHIRException { + if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string") && r.hasType("string")) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); + else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) + return makeBoolean(new Double(l.primitiveValue()) > new Double(r.primitiveValue())); + else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); + else if ((l.hasType("time")) && (r.hasType("time"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); + } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { + List lUnit = left.get(0).listChildrenByName("unit"); + List rUnit = right.get(0).listChildrenByName("unit"); + if (Base.compareDeep(lUnit, rUnit, true)) { + return opGreater(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); + } else { + throw new InternalErrorException("Canonical Comparison isn't done yet"); + } + } + return new ArrayList(); + } + + private List opLessOrEqual(List left, List right) throws FHIRException { + if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string") && r.hasType("string")) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); + else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) + return makeBoolean(new Double(l.primitiveValue()) <= new Double(r.primitiveValue())); + else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); + else if ((l.hasType("time")) && (r.hasType("time"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); + } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { + List lUnits = left.get(0).listChildrenByName("unit"); + String lunit = lUnits.size() == 1 ? lUnits.get(0).primitiveValue() : null; + List rUnits = right.get(0).listChildrenByName("unit"); + String runit = rUnits.size() == 1 ? rUnits.get(0).primitiveValue() : null; + if ((lunit == null && runit == null) || lunit.equals(runit)) { + return opLessOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); + } else { + throw new InternalErrorException("Canonical Comparison isn't done yet"); + } + } + return new ArrayList(); + } + + private List opGreaterOrEqual(List left, List right) throws FHIRException { + if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string") && r.hasType("string")) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); + else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) + return makeBoolean(new Double(l.primitiveValue()) >= new Double(r.primitiveValue())); + else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); + else if ((l.hasType("time")) && (r.hasType("time"))) + return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); + } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { + List lUnit = left.get(0).listChildrenByName("unit"); + List rUnit = right.get(0).listChildrenByName("unit"); + if (Base.compareDeep(lUnit, rUnit, true)) { + return opGreaterOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); + } else { + throw new InternalErrorException("Canonical Comparison isn't done yet"); + } + } + return new ArrayList(); + } + + private List opMemberOf(List left, List right) throws FHIRException { + boolean ans = false; + ValueSet vs = worker.fetchResource(ValueSet.class, right.get(0).primitiveValue()); + if (vs != null) { + for (Base l : left) { + if (l.fhirType().equals("code")) { + if (worker.validateCode(l.castToCoding(l), vs).isOk()) + ans = true; + } else if (l.fhirType().equals("Coding")) { + if (worker.validateCode(l.castToCoding(l), vs).isOk()) + ans = true; + } else if (l.fhirType().equals("CodeableConcept")) { + if (worker.validateCode(l.castToCodeableConcept(l), vs).isOk()) + ans = true; + } + } + } + return makeBoolean(ans); + } + + private List opIn(List left, List right) throws FHIRException { + boolean ans = true; + for (Base l : left) { + boolean f = false; + for (Base r : right) + if (doEquals(l, r)) { + f = true; + break; + } + if (!f) { + ans = false; + break; + } + } + return makeBoolean(ans); + } + + private List opContains(List left, List right) { + boolean ans = true; + for (Base r : right) { + boolean f = false; + for (Base l : left) + if (doEquals(l, r)) { + f = true; + break; + } + if (!f) { + ans = false; + break; + } + } + return makeBoolean(ans); + } + + private List opPlus(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing +: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing +: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing +: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing +: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing +: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + if (l.hasType("string", "id", "code", "uri") && r.hasType("string", "id", "code", "uri")) + result.add(new StringType(l.primitiveValue() + r.primitiveValue())); + else if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) + result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue())))); + else + throw new PathEngineException(String.format("Error performing +: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opTimes(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing *: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing *: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing *: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing *: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing *: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) * Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) + result.add(new DecimalType(new BigDecimal(l.primitiveValue()).multiply(new BigDecimal(r.primitiveValue())))); + else + throw new PathEngineException(String.format("Error performing *: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opConcatenate(List left, List right) { + List result = new ArrayList(); + result.add(new StringType(convertToString(left) + convertToString((right)))); + return result; + } + + private List opUnion(List left, List right) { + List result = new ArrayList(); + for (Base item : left) { + if (!doContains(result, item)) + result.add(item); + } + for (Base item : right) { + if (!doContains(result, item)) + result.add(item); + } + return result; + } + + private boolean doContains(List list, Base item) { + for (Base test : list) + if (doEquals(test, item)) + return true; + return false; + } + + + private List opAnd(List left, List right) { + if (left.isEmpty() && right.isEmpty()) + return new ArrayList(); + else if (isBoolean(left, false) || isBoolean(right, false)) + return makeBoolean(false); + else if (left.isEmpty() || right.isEmpty()) + return new ArrayList(); + else if (convertToBoolean(left) && convertToBoolean(right)) + return makeBoolean(true); + else + return makeBoolean(false); + } + + private boolean isBoolean(List list, boolean b) { + return list.size() == 1 && list.get(0) instanceof BooleanType && ((BooleanType) list.get(0)).booleanValue() == b; + } + + private List opOr(List left, List right) { + if (left.isEmpty() && right.isEmpty()) + return new ArrayList(); + else if (convertToBoolean(left) || convertToBoolean(right)) + return makeBoolean(true); + else if (left.isEmpty() || right.isEmpty()) + return new ArrayList(); + else + return makeBoolean(false); + } + + private List opXor(List left, List right) { + if (left.isEmpty() || right.isEmpty()) + return new ArrayList(); + else + return makeBoolean(convertToBoolean(left) ^ convertToBoolean(right)); + } + + private List opImplies(List left, List right) { + if (!convertToBoolean(left)) + return makeBoolean(true); + else if (right.size() == 0) + return new ArrayList(); + else + return makeBoolean(convertToBoolean(right)); + } + + + private List opMinus(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing -: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing -: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing -: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing -: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing -: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) - Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) + result.add(new DecimalType(new BigDecimal(l.primitiveValue()).subtract(new BigDecimal(r.primitiveValue())))); + else + throw new PathEngineException(String.format("Error performing -: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opDivideBy(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing /: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing /: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing /: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing /: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing /: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer", "decimal", "unsignedInt", "positiveInt") && r.hasType("integer", "decimal", "unsignedInt", "positiveInt")) { + Decimal d1; + try { + d1 = new Decimal(l.primitiveValue()); + Decimal d2 = new Decimal(r.primitiveValue()); + result.add(new DecimalType(d1.divide(d2).asDecimal())); + } catch (UcumException e) { + throw new PathEngineException(e); + } + } + else + throw new PathEngineException(String.format("Error performing /: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opDiv(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing div: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing div: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing div: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing div: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing div: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing div: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) / Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { + Decimal d1; + try { + d1 = new Decimal(l.primitiveValue()); + Decimal d2 = new Decimal(r.primitiveValue()); + result.add(new IntegerType(d1.divInt(d2).asDecimal())); + } catch (UcumException e) { + throw new PathEngineException(e); + } + } + else + throw new PathEngineException(String.format("Error performing div: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + private List opMod(List left, List right) throws PathEngineException { + if (left.size() == 0) + throw new PathEngineException("Error performing mod: left operand has no value"); + if (left.size() > 1) + throw new PathEngineException("Error performing mod: left operand has more than one value"); + if (!left.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing mod: left operand has the wrong type (%s)", left.get(0).fhirType())); + if (right.size() == 0) + throw new PathEngineException("Error performing mod: right operand has no value"); + if (right.size() > 1) + throw new PathEngineException("Error performing mod: right operand has more than one value"); + if (!right.get(0).isPrimitive()) + throw new PathEngineException(String.format("Error performing mod: right operand has the wrong type (%s)", right.get(0).fhirType())); + + List result = new ArrayList(); + Base l = left.get(0); + Base r = right.get(0); + + if (l.hasType("integer") && r.hasType("integer")) + result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) % Integer.parseInt(r.primitiveValue()))); + else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { + Decimal d1; + try { + d1 = new Decimal(l.primitiveValue()); + Decimal d2 = new Decimal(r.primitiveValue()); + result.add(new DecimalType(d1.modulo(d2).asDecimal())); + } catch (UcumException e) { + throw new PathEngineException(e); + } + } + else + throw new PathEngineException(String.format("Error performing mod: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); + return result; + } + + + private TypeDetails readConstantType(ExecutionTypeContext context, String constant) throws PathEngineException { + if (constant.equals("true")) + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + else if (constant.equals("false")) + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + else if (Utilities.isInteger(constant)) + return new TypeDetails(CollectionStatus.SINGLETON, "integer"); + else if (Utilities.isDecimal(constant)) + return new TypeDetails(CollectionStatus.SINGLETON, "decimal"); + else if (constant.startsWith("%")) + return resolveConstantType(context, constant); + else + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + } + + private TypeDetails resolveConstantType(ExecutionTypeContext context, String s) throws PathEngineException { + if (s.equals("%sct")) + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + else if (s.equals("%loinc")) + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + else if (s.equals("%ucum")) + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + else if (s.equals("%resource")) { + if (context.resource == null) + throw new PathEngineException("%resource cannot be used in this context"); + return new TypeDetails(CollectionStatus.SINGLETON, context.resource); + } else if (s.equals("%context")) { + return new TypeDetails(CollectionStatus.SINGLETON, context.context); + } else if (s.equals("%map-codes")) + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + else if (s.equals("%us-zip")) + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + else if (s.startsWith("%\"vs-")) + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + else if (s.startsWith("%\"cs-")) + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + else if (s.startsWith("%\"ext-")) + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + else if (hostServices == null) + throw new PathEngineException("Unknown fixed constant type for '"+s+"'"); + else + return hostServices.resolveConstantType(context.appInfo, s); + } + + private List execute(ExecutionContext context, Base item, ExpressionNode exp, boolean atEntry) throws FHIRException { + List result = new ArrayList(); + if (atEntry && Character.isUpperCase(exp.getName().charAt(0))) {// special case for start up + if (item.isResource() && item.fhirType().equals(exp.getName())) + result.add(item); + } else + getChildrenByName(item, exp.getName(), result); + if (result.size() == 0 && atEntry && context.appInfo != null) { + Base temp = hostServices.resolveConstant(context.appInfo, exp.getName()); + if (temp != null) { + result.add(temp); + } + } + return result; + } + + private TypeDetails executeContextType(ExecutionTypeContext context, String name) throws PathEngineException, DefinitionException { + if (hostServices == null) + throw new PathEngineException("Unable to resolve context reference since no host services are provided"); + return hostServices.resolveConstantType(context.appInfo, name); + } + private TypeDetails executeType(String type, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { if (atEntry && Character.isUpperCase(exp.getName().charAt(0)) && hashTail(type).equals(exp.getName())) // special case for start up return new TypeDetails(CollectionStatus.SINGLETON, type); @@ -949,34 +1832,311 @@ public class FHIRPathEngine { return result; } - private List executeTypeName(ExecutionContext context, List focus, ExpressionNode next, boolean atEntry) { - List result = new ArrayList(); - result.add(new StringType(next.getName())); + + private String hashTail(String type) { + return type.contains("#") ? "" : type.substring(type.lastIndexOf("/")+1); + } + + + @SuppressWarnings("unchecked") + private TypeDetails evaluateFunctionType(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp) throws PathEngineException, DefinitionException { + List paramTypes = new ArrayList(); + if (exp.getFunction() == Function.Is || exp.getFunction() == Function.As) + paramTypes.add(new TypeDetails(CollectionStatus.SINGLETON, "string")); + else + for (ExpressionNode expr : exp.getParameters()) { + if (exp.getFunction() == Function.Where || exp.getFunction() == Function.Select || exp.getFunction() == Function.Repeat) + paramTypes.add(executeType(changeThis(context, focus), focus, expr, true)); + else + paramTypes.add(executeType(context, focus, expr, true)); + } + switch (exp.getFunction()) { + case Empty : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Not : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Exists : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case SubsetOf : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case SupersetOf : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, focus); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case IsDistinct : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Distinct : + return focus; + case Count : + return new TypeDetails(CollectionStatus.SINGLETON, "integer"); + case Where : + return focus; + case Select : + return anything(focus.getCollectionStatus()); + case All : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Repeat : + return anything(focus.getCollectionStatus()); + case Item : { + checkOrdered(focus, "item"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); + return focus; + } + case As : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, exp.getParameters().get(0).getName()); + } + case Is : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case Single : + return focus.toSingleton(); + case First : { + checkOrdered(focus, "first"); + return focus.toSingleton(); + } + case Last : { + checkOrdered(focus, "last"); + return focus.toSingleton(); + } + case Tail : { + checkOrdered(focus, "tail"); + return focus; + } + case Skip : { + checkOrdered(focus, "skip"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); + return focus; + } + case Take : { + checkOrdered(focus, "take"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer")); + return focus; + } + case Iif : { + TypeDetails types = new TypeDetails(null); + types.update(paramTypes.get(0)); + if (paramTypes.size() > 1) + types.update(paramTypes.get(1)); + return types; + } + case ToInteger : { + checkContextPrimitive(focus, "toInteger"); + return new TypeDetails(CollectionStatus.SINGLETON, "integer"); + } + case ToDecimal : { + checkContextPrimitive(focus, "toDecimal"); + return new TypeDetails(CollectionStatus.SINGLETON, "decimal"); + } + case ToString : { + checkContextPrimitive(focus, "toString"); + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + } + case Substring : { + checkContextString(focus, "subString"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "integer"), new TypeDetails(CollectionStatus.SINGLETON, "integer")); + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + } + case StartsWith : { + checkContextString(focus, "startsWith"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case EndsWith : { + checkContextString(focus, "endsWith"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case Matches : { + checkContextString(focus, "matches"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case ReplaceMatches : { + checkContextString(focus, "replaceMatches"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + } + case Contains : { + checkContextString(focus, "contains"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case Replace : { + checkContextString(focus, "replace"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string"), new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "string"); + } + case Length : { + checkContextPrimitive(focus, "length"); + return new TypeDetails(CollectionStatus.SINGLETON, "integer"); + } + case Children : + return childTypes(focus, "*"); + case Descendants : + return childTypes(focus, "**"); + case MemberOf : { + checkContextCoded(focus, "memberOf"); + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + } + case Trace : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return focus; + } + case Today : + return new TypeDetails(CollectionStatus.SINGLETON, "date"); + case Now : + return new TypeDetails(CollectionStatus.SINGLETON, "dateTime"); + case Resolve : { + checkContextReference(focus, "resolve"); + return new TypeDetails(CollectionStatus.SINGLETON, "DomainResource"); + } + case Extension : { + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return new TypeDetails(CollectionStatus.SINGLETON, "Extension"); + } + case HasValue : + return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); + case Alias : + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return anything(CollectionStatus.SINGLETON); + case AliasAs : + checkParamTypes(exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, "string")); + return focus; + case Custom : { + return hostServices.checkFunction(context.appInfo, exp.getName(), paramTypes); + } + default: + break; + } + throw new Error("not Implemented yet"); + } + + + private void checkParamTypes(String funcName, List paramTypes, TypeDetails... typeSet) throws PathEngineException { + int i = 0; + for (TypeDetails pt : typeSet) { + if (i == paramTypes.size()) + return; + TypeDetails actual = paramTypes.get(i); + i++; + for (String a : actual.getTypes()) { + if (!pt.hasType(worker, a)) + throw new PathEngineException("The parameter type '"+a+"' is not legal for "+funcName+" parameter "+Integer.toString(i)+". expecting "+pt.toString()); + } + } + } + + private void checkOrdered(TypeDetails focus, String name) throws PathEngineException { + if (focus.getCollectionStatus() == CollectionStatus.UNORDERED) + throw new PathEngineException("The function '"+name+"'() can only be used on ordered collections"); + } + + private void checkContextReference(TypeDetails focus, String name) throws PathEngineException { + if (!focus.hasType(worker, "string") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Reference")) + throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, Reference"); + } + + + private void checkContextCoded(TypeDetails focus, String name) throws PathEngineException { + if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "Coding") && !focus.hasType(worker, "CodeableConcept")) + throw new PathEngineException("The function '"+name+"'() can only be used on string, code, uri, Coding, CodeableConcept"); + } + + + private void checkContextString(TypeDetails focus, String name) throws PathEngineException { + if (!focus.hasType(worker, "string") && !focus.hasType(worker, "code") && !focus.hasType(worker, "uri") && !focus.hasType(worker, "id")) + throw new PathEngineException("The function '"+name+"'() can only be used on string, uri, code, id, but found "+focus.describe()); + } + + + private void checkContextPrimitive(TypeDetails focus, String name) throws PathEngineException { + if (!focus.hasType(primitiveTypes)) + throw new PathEngineException("The function '"+name+"'() can only be used on "+primitiveTypes.toString()); + } + + + private TypeDetails childTypes(TypeDetails focus, String mask) throws PathEngineException, DefinitionException { + TypeDetails result = new TypeDetails(CollectionStatus.UNORDERED); + for (String f : focus.getTypes()) + getChildTypesByName(f, mask, result); return result; } - private TypeDetails executeTypeName(ExecutionTypeContext context, TypeDetails focus, ExpressionNode exp, boolean atEntry) throws PathEngineException, DefinitionException { - return new TypeDetails(CollectionStatus.SINGLETON, exp.getName()); + private TypeDetails anything(CollectionStatus status) { + return new TypeDetails(status, allTypes.keySet()); } - private StructureDefinition fetchStructureByType(ElementDefinition ed) throws DefinitionException { - if (ed.getType().size() == 0) - throw new DefinitionException("Error in discriminator at "+ed.getId()+": no children, no type"); - if (ed.getType().size() > 1) - throw new DefinitionException("Error in discriminator at "+ed.getId()+": no children, multiple types"); - if (ed.hasSlicing()) - throw new DefinitionException("Error in discriminator at "+ed.getId()+": slicing found"); - if (ed.getType().get(0).hasProfile()) - return worker.fetchResource(StructureDefinition.class, ed.getType().get(0).getProfile()); - else - return worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + ed.getType().get(0).getCode()); + // private boolean isPrimitiveType(String s) { + // return s.equals("boolean") || s.equals("integer") || s.equals("decimal") || s.equals("base64Binary") || s.equals("instant") || s.equals("string") || s.equals("uri") || s.equals("date") || s.equals("dateTime") || s.equals("time") || s.equals("code") || s.equals("oid") || s.equals("id") || s.equals("unsignedInt") || s.equals("positiveInt") || s.equals("markdown"); + // } + + private List evaluateFunction(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + switch (exp.getFunction()) { + case Empty : return funcEmpty(context, focus, exp); + case Not : return funcNot(context, focus, exp); + case Exists : return funcExists(context, focus, exp); + case SubsetOf : return funcSubsetOf(context, focus, exp); + case SupersetOf : return funcSupersetOf(context, focus, exp); + case IsDistinct : return funcIsDistinct(context, focus, exp); + case Distinct : return funcDistinct(context, focus, exp); + case Count : return funcCount(context, focus, exp); + case Where : return funcWhere(context, focus, exp); + case Select : return funcSelect(context, focus, exp); + case All : return funcAll(context, focus, exp); + case Repeat : return funcRepeat(context, focus, exp); + case Item : return funcItem(context, focus, exp); + case As : return funcAs(context, focus, exp); + case Is : return funcIs(context, focus, exp); + case Single : return funcSingle(context, focus, exp); + case First : return funcFirst(context, focus, exp); + case Last : return funcLast(context, focus, exp); + case Tail : return funcTail(context, focus, exp); + case Skip : return funcSkip(context, focus, exp); + case Take : return funcTake(context, focus, exp); + case Iif : return funcIif(context, focus, exp); + case ToInteger : return funcToInteger(context, focus, exp); + case ToDecimal : return funcToDecimal(context, focus, exp); + case ToString : return funcToString(context, focus, exp); + case Substring : return funcSubstring(context, focus, exp); + case StartsWith : return funcStartsWith(context, focus, exp); + case EndsWith : return funcEndsWith(context, focus, exp); + case Matches : return funcMatches(context, focus, exp); + case ReplaceMatches : return funcReplaceMatches(context, focus, exp); + case Contains : return funcContains(context, focus, exp); + case Replace : return funcReplace(context, focus, exp); + case Length : return funcLength(context, focus, exp); + case Children : return funcChildren(context, focus, exp); + case Descendants : return funcDescendants(context, focus, exp); + case MemberOf : return funcMemberOf(context, focus, exp); + case Trace : return funcTrace(context, focus, exp); + case Today : return funcToday(context, focus, exp); + case Now : return funcNow(context, focus, exp); + case Resolve : return funcResolve(context, focus, exp); + case Extension : return funcExtension(context, focus, exp); + case HasValue : return funcHasValue(context, focus, exp); + case AliasAs : return funcAliasAs(context, focus, exp); + case Alias : return funcAlias(context, focus, exp); + case Custom: { + List> params = new ArrayList>(); + for (ExpressionNode p : exp.getParameters()) + params.add(execute(context, focus, p, true)); + return hostServices.executeFunction(context.appInfo, exp.getName(), params); + } + default: + throw new Error("not Implemented yet"); + } } - public String forLog() { - if (log.length() > 0) - return " ("+log.toString()+")"; - else - return ""; + private List funcAliasAs(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List nl = execute(context, focus, exp.getParameters().get(0), true); + String name = nl.get(0).primitiveValue(); + context.addAlias(name, focus); + return focus; } private List funcAlias(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { @@ -987,14 +2147,7 @@ public class FHIRPathEngine { if (b != null) res.add(b); return res; - - } - - private List funcAliasAs(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List nl = execute(context, focus, exp.getParameters().get(0), true); - String name = nl.get(0).primitiveValue(); - context.addAlias(name, focus); - return focus; + } private List funcAll(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { @@ -1019,7 +2172,7 @@ public class FHIRPathEngine { boolean v = false; if (item instanceof BooleanType) { v = ((BooleanType) item).booleanValue(); - } else + } else v = item != null; if (!v) { all = false; @@ -1031,42 +2184,34 @@ public class FHIRPathEngine { } } - private List funcAs(ExecutionContext context, List focus, ExpressionNode exp) { + + private ExecutionContext changeThis(ExecutionContext context, Base newThis) { + return new ExecutionContext(context.appInfo, context.resource, context.context, context.aliases, newThis); + } + + private ExecutionTypeContext changeThis(ExecutionTypeContext context, TypeDetails newThis) { + return new ExecutionTypeContext(context.appInfo, context.resource, context.context, newThis); + } + + + private List funcNow(ExecutionContext context, List focus, ExpressionNode exp) { List result = new ArrayList(); - String tn = exp.getParameters().get(0).getName(); - for (Base b : focus) - if (b.hasType(tn)) - result.add(b); + result.add(DateTimeType.now()); return result; } - private List funcChildren(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + + private List funcToday(ExecutionContext context, List focus, ExpressionNode exp) { List result = new ArrayList(); - for (Base b : focus) - getChildrenByName(b, "*", result); + result.add(new DateType(new Date(), TemporalPrecisionEnum.DAY)); return result; } - private List funcContains(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List result = new ArrayList(); - String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - if (focus.size() == 1 && !Utilities.noString(sw)) { - String st = convertToString(focus.get(0)); - if (Utilities.noString(st)) - result.add(new BooleanType(false)); - else - result.add(new BooleanType(st.contains(sw))); - } else - result.add(new BooleanType(false)); - return result; + private List funcMemberOf(ExecutionContext context, List focus, ExpressionNode exp) { + throw new Error("not Implemented yet"); } - private List funcCount(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - result.add(new IntegerType(focus.size())); - return result; - } private List funcDescendants(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { List result = new ArrayList(); @@ -1087,31 +2232,32 @@ public class FHIRPathEngine { return result; } - private List funcDistinct(ExecutionContext context, List focus, ExpressionNode exp) { - if (focus.size() <= 1) - return focus; + private List funcChildren(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { List result = new ArrayList(); - for (int i = 0; i < focus.size(); i++) { - boolean found = false; - for (int j = i+1; j < focus.size(); j++) { - if (doEquals(focus.get(j), focus.get(i))) { - found = true; - break; - } - } - if (!found) - result.add(focus.get(i)); - } + for (Base b : focus) + getChildrenByName(b, "*", result); return result; } - private List funcEmpty(ExecutionContext context, List focus, ExpressionNode exp) { + + private List funcReplace(ExecutionContext context, List focus, ExpressionNode exp) { + throw new Error("not Implemented yet"); + } + + + private List funcReplaceMatches(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { List result = new ArrayList(); - result.add(new BooleanType(ElementUtil.isEmpty(focus))); + String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + + if (focus.size() == 1 && !Utilities.noString(sw)) + result.add(new BooleanType(convertToString(focus.get(0)).contains(sw))); + else + result.add(new BooleanType(false)); return result; } + private List funcEndsWith(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { List result = new ArrayList(); String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); @@ -1123,46 +2269,22 @@ public class FHIRPathEngine { return result; } - private List funcExists(ExecutionContext context, List focus, ExpressionNode exp) { + + private List funcToString(ExecutionContext context, List focus, ExpressionNode exp) { List result = new ArrayList(); - result.add(new BooleanType(!ElementUtil.isEmpty(focus))); + result.add(new StringType(convertToString(focus))); return result; } - private List funcExtension(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List result = new ArrayList(); - List nl = execute(context, focus, exp.getParameters().get(0), true); - String url = nl.get(0).primitiveValue(); - for (Base item : focus) { - List ext = new ArrayList(); - getChildrenByName(item, "extension", ext); - getChildrenByName(item, "modifierExtension", ext); - for (Base ex : ext) { - List vl = new ArrayList(); - getChildrenByName(ex, "url", vl); - if (convertToString(vl).equals(url)) - result.add(ex); - } - } + private List funcToDecimal(ExecutionContext context, List focus, ExpressionNode exp) { + String s = convertToString(focus); + List result = new ArrayList(); + if (Utilities.isDecimal(s)) + result.add(new DecimalType(s)); return result; } - private List funcFirst(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - if (focus.size() > 0) - result.add(focus.get(0)); - return result; - } - - private List funcHasValue(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - if (focus.size() == 1) { - String s = convertToString(focus.get(0)); - result.add(new BooleanType(!Utilities.noString(s))); - } - return result; - } private List funcIif(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { List n1 = execute(context, focus, exp.getParameters().get(0), true); @@ -1176,9 +2298,28 @@ public class FHIRPathEngine { return execute(context, focus, exp.getParameters().get(2), true); } + + private List funcTake(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List n1 = execute(context, focus, exp.getParameters().get(0), true); + int i1 = Integer.parseInt(n1.get(0).primitiveValue()); + + List result = new ArrayList(); + for (int i = 0; i < Math.min(focus.size(), i1); i++) + result.add(focus.get(i)); + return result; + } + + + private List funcSingle(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { + if (focus.size() == 1) + return focus; + throw new PathEngineException(String.format("Single() : checking for 1 item but found %d items", focus.size())); + } + + private List funcIs(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { List result = new ArrayList(); - if (focus.size() == 0 || focus.size() > 1) + if (focus.size() == 0 || focus.size() > 1) result.add(new BooleanType(false)); else { String tn = exp.getParameters().get(0).getName(); @@ -1187,74 +2328,16 @@ public class FHIRPathEngine { return result; } - private List funcIsDistinct(ExecutionContext context, List focus, ExpressionNode exp) { - if (focus.size() <= 1) - return makeBoolean(true); - boolean distinct = true; - for (int i = 0; i < focus.size(); i++) { - for (int j = i+1; j < focus.size(); j++) { - if (doEquals(focus.get(j), focus.get(i))) { - distinct = false; - break; - } - } - } - return makeBoolean(distinct); - } - - private List funcItem(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + private List funcAs(ExecutionContext context, List focus, ExpressionNode exp) { List result = new ArrayList(); - String s = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - if (Utilities.isInteger(s) && Integer.parseInt(s) < focus.size()) - result.add(focus.get(Integer.parseInt(s))); + String tn = exp.getParameters().get(0).getName(); + for (Base b : focus) + if (b.hasType(tn)) + result.add(b); return result; } - private List funcLast(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - if (focus.size() > 0) - result.add(focus.get(focus.size()-1)); - return result; - } - - private List funcLength(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - if (focus.size() == 1) { - String s = convertToString(focus.get(0)); - result.add(new IntegerType(s.length())); - } - return result; - } - - private List funcMatches(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List result = new ArrayList(); - String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - - if (focus.size() == 1 && !Utilities.noString(sw)) { - String st = convertToString(focus.get(0)); - if (Utilities.noString(st)) - result.add(new BooleanType(false)); - else - result.add(new BooleanType(st.matches(sw))); - } else - result.add(new BooleanType(false)); - return result; - } - - private List funcMemberOf(ExecutionContext context, List focus, ExpressionNode exp) { - throw new Error("not Implemented yet"); - } - - private List funcNot(ExecutionContext context, List focus, ExpressionNode exp) { - return makeBoolean(!convertToBoolean(focus)); - } - - private List funcNow(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - result.add(DateTimeType.now()); - return result; - } private List funcRepeat(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { List result = new ArrayList(); @@ -1278,21 +2361,78 @@ public class FHIRPathEngine { return result; } - private List funcReplace(ExecutionContext context, List focus, ExpressionNode exp) { - throw new Error("not Implemented yet"); + + + private List funcIsDistinct(ExecutionContext context, List focus, ExpressionNode exp) { + if (focus.size() <= 1) + return makeBoolean(true); + + boolean distinct = true; + for (int i = 0; i < focus.size(); i++) { + for (int j = i+1; j < focus.size(); j++) { + if (doEquals(focus.get(j), focus.get(i))) { + distinct = false; + break; + } + } + } + return makeBoolean(distinct); } - private List funcReplaceMatches(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List result = new ArrayList(); - String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); - if (focus.size() == 1 && !Utilities.noString(sw)) - result.add(new BooleanType(convertToString(focus.get(0)).contains(sw))); - else - result.add(new BooleanType(false)); + private List funcSupersetOf(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List target = execute(context, focus, exp.getParameters().get(0), true); + + boolean valid = true; + for (Base item : target) { + boolean found = false; + for (Base t : focus) { + if (Base.compareDeep(item, t, false)) { + found = true; + break; + } + } + if (!found) { + valid = false; + break; + } + } + List result = new ArrayList(); + result.add(new BooleanType(valid)); return result; } + + private List funcSubsetOf(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List target = execute(context, focus, exp.getParameters().get(0), true); + + boolean valid = true; + for (Base item : focus) { + boolean found = false; + for (Base t : target) { + if (Base.compareDeep(item, t, false)) { + found = true; + break; + } + } + if (!found) { + valid = false; + break; + } + } + List result = new ArrayList(); + result.add(new BooleanType(valid)); + return result; + } + + + private List funcExists(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + result.add(new BooleanType(!ElementUtil.isEmpty(focus))); + return result; + } + + private List funcResolve(ExecutionContext context, List focus, ExpressionNode exp) { List result = new ArrayList(); for (Base item : focus) { @@ -1326,30 +2466,97 @@ public class FHIRPathEngine { return result; } - private List funcSelect(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + private List funcExtension(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { List result = new ArrayList(); - List pc = new ArrayList(); + List nl = execute(context, focus, exp.getParameters().get(0), true); + String url = nl.get(0).primitiveValue(); + for (Base item : focus) { - pc.clear(); - pc.add(item); - result.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), true)); + List ext = new ArrayList(); + getChildrenByName(item, "extension", ext); + getChildrenByName(item, "modifierExtension", ext); + for (Base ex : ext) { + List vl = new ArrayList(); + getChildrenByName(ex, "url", vl); + if (convertToString(vl).equals(url)) + result.add(ex); + } } return result; } - private List funcSingle(ExecutionContext context, List focus, ExpressionNode exp) throws PathEngineException { - if (focus.size() == 1) - return focus; - throw new PathEngineException(String.format("Single() : checking for 1 item but found %d items", focus.size())); + private List funcTrace(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List nl = execute(context, focus, exp.getParameters().get(0), true); + String name = nl.get(0).primitiveValue(); + + log(name, focus); + return focus; } - private List funcSkip(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List n1 = execute(context, focus, exp.getParameters().get(0), true); - int i1 = Integer.parseInt(n1.get(0).primitiveValue()); + private List funcDistinct(ExecutionContext context, List focus, ExpressionNode exp) { + if (focus.size() <= 1) + return focus; List result = new ArrayList(); - for (int i = i1; i < focus.size(); i++) - result.add(focus.get(i)); + for (int i = 0; i < focus.size(); i++) { + boolean found = false; + for (int j = i+1; j < focus.size(); j++) { + if (doEquals(focus.get(j), focus.get(i))) { + found = true; + break; + } + } + if (!found) + result.add(focus.get(i)); + } + return result; + } + + private List funcMatches(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List result = new ArrayList(); + String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + + if (focus.size() == 1 && !Utilities.noString(sw)) { + String st = convertToString(focus.get(0)); + if (Utilities.noString(st)) + result.add(new BooleanType(false)); + else + result.add(new BooleanType(st.matches(sw))); + } else + result.add(new BooleanType(false)); + return result; + } + + private List funcContains(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List result = new ArrayList(); + String sw = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + + if (focus.size() == 1 && !Utilities.noString(sw)) { + String st = convertToString(focus.get(0)); + if (Utilities.noString(st)) + result.add(new BooleanType(false)); + else + result.add(new BooleanType(st.contains(sw))); + } else + result.add(new BooleanType(false)); + return result; + } + + private List funcLength(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + if (focus.size() == 1) { + String s = convertToString(focus.get(0)); + result.add(new IntegerType(s.length())); + } + return result; + } + + private List funcHasValue(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + if (focus.size() == 1) { + String s = convertToString(focus.get(0)); + result.add(new BooleanType(!Utilities.noString(s))); + } return result; } @@ -1364,28 +2571,6 @@ public class FHIRPathEngine { return result; } - private List funcSubsetOf(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List target = execute(context, focus, exp.getParameters().get(0), true); - - boolean valid = true; - for (Base item : focus) { - boolean found = false; - for (Base t : target) { - if (Base.compareDeep(item, t, false)) { - found = true; - break; - } - } - if (!found) { - valid = false; - break; - } - } - List result = new ArrayList(); - result.add(new BooleanType(valid)); - return result; - } - private List funcSubstring(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { List result = new ArrayList(); List n1 = execute(context, focus, exp.getParameters().get(0), true); @@ -1405,59 +2590,12 @@ public class FHIRPathEngine { s = sw.substring(i1, Math.min(sw.length(), i1+i2)); else s = sw.substring(i1); - if (!Utilities.noString(s)) + if (!Utilities.noString(s)) result.add(new StringType(s)); } return result; } - private List funcSupersetOf(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List target = execute(context, focus, exp.getParameters().get(0), true); - - boolean valid = true; - for (Base item : target) { - boolean found = false; - for (Base t : focus) { - if (Base.compareDeep(item, t, false)) { - found = true; - break; - } - } - if (!found) { - valid = false; - break; - } - } - List result = new ArrayList(); - result.add(new BooleanType(valid)); - return result; - } - - private List funcTail(ExecutionContext context, List focus, ExpressionNode exp) { - List result = new ArrayList(); - for (int i = 1; i < focus.size(); i++) - result.add(focus.get(i)); - return result; - } - - private List funcTake(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List n1 = execute(context, focus, exp.getParameters().get(0), true); - int i1 = Integer.parseInt(n1.get(0).primitiveValue()); - - List result = new ArrayList(); - for (int i = 0; i < Math.min(focus.size(), i1); i++) - result.add(focus.get(i)); - return result; - } - - private List funcToDecimal(ExecutionContext context, List focus, ExpressionNode exp) { - String s = convertToString(focus); - List result = new ArrayList(); - if (Utilities.isDecimal(s)) - result.add(new DecimalType(s)); - return result; - } - private List funcToInteger(ExecutionContext context, List focus, ExpressionNode exp) { String s = convertToString(focus); List result = new ArrayList(); @@ -1466,26 +2604,44 @@ public class FHIRPathEngine { return result; } - private List funcToString(ExecutionContext context, List focus, ExpressionNode exp) { + private List funcCount(ExecutionContext context, List focus, ExpressionNode exp) { List result = new ArrayList(); - result.add(new StringType(convertToString(focus))); + result.add(new IntegerType(focus.size())); return result; } - private List funcToday(ExecutionContext context, List focus, ExpressionNode exp) { + private List funcSkip(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List n1 = execute(context, focus, exp.getParameters().get(0), true); + int i1 = Integer.parseInt(n1.get(0).primitiveValue()); + List result = new ArrayList(); - result.add(new DateType(new Date(), TemporalPrecisionEnum.DAY)); + for (int i = i1; i < focus.size(); i++) + result.add(focus.get(i)); return result; } - private List funcTrace(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { - List nl = execute(context, focus, exp.getParameters().get(0), true); - String name = nl.get(0).primitiveValue(); - - log(name, focus); - return focus; + private List funcTail(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + for (int i = 1; i < focus.size(); i++) + result.add(focus.get(i)); + return result; } + private List funcLast(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + if (focus.size() > 0) + result.add(focus.get(focus.size()-1)); + return result; + } + + private List funcFirst(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + if (focus.size() > 0) + result.add(focus.get(0)); + return result; + } + + private List funcWhere(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { List result = new ArrayList(); List pc = new ArrayList(); @@ -1498,82 +2654,52 @@ public class FHIRPathEngine { return result; } - private ExpressionNode gatherPrecedence(FHIRLexer lexer, ExpressionNode start, EnumSet ops) { - // work : boolean; - // focus, node, group : ExpressionNode; - - assert(start.isProximal()); - - // is there anything to do? - boolean work = false; - ExpressionNode focus = start.getOpNext(); - if (ops.contains(start.getOperation())) { - while (focus != null && focus.getOperation() != null) { - work = work || !ops.contains(focus.getOperation()); - focus = focus.getOpNext(); - } - } else { - while (focus != null && focus.getOperation() != null) { - work = work || ops.contains(focus.getOperation()); - focus = focus.getOpNext(); - } + private List funcSelect(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List result = new ArrayList(); + List pc = new ArrayList(); + for (Base item : focus) { + pc.clear(); + pc.add(item); + result.addAll(execute(changeThis(context, item), pc, exp.getParameters().get(0), true)); } - if (!work) - return start; - - // entry point: tricky - ExpressionNode group; - if (ops.contains(start.getOperation())) { - group = newGroup(lexer, start); - group.setProximal(true); - focus = start; - start = group; - } else { - ExpressionNode node = start; - - focus = node.getOpNext(); - while (!ops.contains(focus.getOperation())) { - node = focus; - focus = focus.getOpNext(); - } - group = newGroup(lexer, focus); - node.setOpNext(group); - } - - // now, at this point: - // group is the group we are adding to, it already has a .group property filled out. - // focus points at the group.group - do { - // run until we find the end of the sequence - while (ops.contains(focus.getOperation())) - focus = focus.getOpNext(); - if (focus.getOperation() != null) { - group.setOperation(focus.getOperation()); - group.setOpNext(focus.getOpNext()); - focus.setOperation(null); - focus.setOpNext(null); - // now look for another sequence, and start it - ExpressionNode node = group; - focus = group.getOpNext(); - if (focus != null) { - while (focus != null && !ops.contains(focus.getOperation())) { - node = focus; - focus = focus.getOpNext(); - } - if (focus != null) { // && (focus.Operation in Ops) - must be true - group = newGroup(lexer, focus); - node.setOpNext(group); - } - } - } - } - while (focus != null && focus.getOperation() != null); - return start; + return result; } - // private boolean isPrimitiveType(String s) { - // return s.equals("boolean") || s.equals("integer") || s.equals("decimal") || s.equals("base64Binary") || s.equals("instant") || s.equals("string") || s.equals("uri") || s.equals("date") || s.equals("dateTime") || s.equals("time") || s.equals("code") || s.equals("oid") || s.equals("id") || s.equals("unsignedInt") || s.equals("positiveInt") || s.equals("markdown"); - // } + + private List funcItem(ExecutionContext context, List focus, ExpressionNode exp) throws FHIRException { + List result = new ArrayList(); + String s = convertToString(execute(context, focus, exp.getParameters().get(0), true)); + if (Utilities.isInteger(s) && Integer.parseInt(s) < focus.size()) + result.add(focus.get(Integer.parseInt(s))); + return result; + } + + private List funcEmpty(ExecutionContext context, List focus, ExpressionNode exp) { + List result = new ArrayList(); + result.add(new BooleanType(ElementUtil.isEmpty(focus))); + return result; + } + + private List funcNot(ExecutionContext context, List focus, ExpressionNode exp) { + return makeBoolean(!convertToBoolean(focus)); + } + + public class ElementDefinitionMatch { + private ElementDefinition definition; + private String fixedType; + public ElementDefinitionMatch(ElementDefinition definition, String fixedType) { + super(); + this.definition = definition; + this.fixedType = fixedType; + } + public ElementDefinition getDefinition() { + return definition; + } + public String getFixedType() { + return fixedType; + } + + } private void getChildTypesByName(String type, String name, TypeDetails result) throws PathEngineException, DefinitionException { if (Utilities.noString(type)) @@ -1633,14 +2759,14 @@ public class FHIRPathEngine { for (String rn : worker.getResourceNames()) { if (!result.hasType(worker, rn)) { getChildTypesByName(result.addType(rn), "**", result); - } + } } } else if (!result.hasType(worker, tn)) { getChildTypesByName(result.addType(tn), "**", result); } } } - } + } } else if (name.equals("*")) { assert(result.getCollectionStatus() == CollectionStatus.UNORDERED); for (ElementDefinition ed : sdi.getSnapshot().getElement()) { @@ -1686,28 +2812,6 @@ public class FHIRPathEngine { } } - /** - * Given an item, return all the children that conform to the pattern described in name - * - * Possible patterns: - * - a simple name (which may be the base of a name with [] e.g. value[x]) - * - a name with a type replacement e.g. valueCodeableConcept - * - * which means all children - * - ** which means all descendants - * - * @param item - * @param name - * @param result - * @throws FHIRException - */ - protected void getChildrenByName(Base item, String name, List result) throws FHIRException { - Base[] list = item.listChildrenByName(name, false); - if (list != null) - for (Base v : list) - if (v != null) - result.add(v); - } - private ElementDefinitionMatch getElementDefinition(StructureDefinition sd, String path, boolean allowTypedName) throws PathEngineException { for (ElementDefinition ed : sd.getSnapshot().getElement()) { if (ed.getPath().equals(path)) { @@ -1725,12 +2829,12 @@ public class FHIRPathEngine { else return new ElementDefinitionMatch(ed, path.substring(ed.getPath().length()-3)); } - if (ed.getPath().contains(".") && path.startsWith(ed.getPath()+".") && (ed.getType().size() > 0) && !isAbstractType(ed.getType())) { + if (ed.getPath().contains(".") && path.startsWith(ed.getPath()+".") && (ed.getType().size() > 0) && !isAbstractType(ed.getType())) { // now we walk into the type. if (ed.getType().size() > 1) // if there's more than one type, the test above would fail this throw new PathEngineException("Internal typing issue...."); StructureDefinition nsd = worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+ed.getType().get(0).getCode()); - if (nsd == null) + if (nsd == null) throw new PathEngineException("Unknown type "+ed.getType().get(0).getCode()); return getElementDefinition(nsd, nsd.getId()+path.substring(ed.getPath().length()), allowTypedName); } @@ -1742,988 +2846,35 @@ public class FHIRPathEngine { return null; } - private ElementDefinitionMatch getElementDefinitionById(StructureDefinition sd, String ref) { - for (ElementDefinition ed : sd.getSnapshot().getElement()) { - if (ref.equals("#"+ed.getId())) - return new ElementDefinitionMatch(ed, null); - } - return null; - } + private boolean isAbstractType(List list) { + return list.size() != 1 ? true : Utilities.existsInList(list.get(0).getCode(), "Element", "BackboneElement", "Resource", "DomainResource"); +} - public IEvaluationContext getHostServices() { - return hostServices; - } - public void setHostServices(IEvaluationContext constantResolver) { - this.hostServices = constantResolver; + private boolean hasType(ElementDefinition ed, String s) { + for (TypeRefComponent t : ed.getType()) + if (s.equalsIgnoreCase(t.getCode())) + return true; + return false; } private boolean hasDataType(ElementDefinition ed) { return ed.hasType() && !(ed.getType().get(0).getCode().equals("Element") || ed.getType().get(0).getCode().equals("BackboneElement")); } + private ElementDefinitionMatch getElementDefinitionById(StructureDefinition sd, String ref) { + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + if (ref.equals("#"+ed.getId())) + return new ElementDefinitionMatch(ed, null); + } + return null; + } + + public boolean hasLog() { return log != null && log.length() > 0; } - private boolean hasType(ElementDefinition ed, String s) { - for (TypeRefComponent t : ed.getType()) - if (s.equalsIgnoreCase(t.getCode())) - return true; - return false; - } - - private String hashTail(String type) { - return type.contains("#") ? "" : type.substring(type.lastIndexOf("/")+1); - } - - private boolean isAbstractType(List list) { - return list.size() != 1 ? true : Utilities.existsInList(list.get(0).getCode(), "Element", "BackboneElement", "Resource", "DomainResource"); -} - - private boolean isBoolean(List list, boolean b) { - return list.size() == 1 && list.get(0) instanceof BooleanType && ((BooleanType) list.get(0)).booleanValue() == b; - } - - private void log(String name, List contents) { - if (hostServices == null || !hostServices.log(name, contents)) { - if (log.length() > 0) - log.append("; "); - log.append(name); - log.append(": "); - boolean first = true; - for (Base b : contents) { - if (first) - first = false; - else - log.append(","); - log.append(convertToString(b)); - } - } - } - - private List makeBoolean(boolean b) { - List res = new ArrayList(); - res.add(new BooleanType(b)); - return res; - } - - private ExpressionNode newGroup(FHIRLexer lexer, ExpressionNode next) { - ExpressionNode result = new ExpressionNode(lexer.nextId()); - result.setKind(Kind.Group); - result.setGroup(next); - result.getGroup().setProximal(true); - return result; - } - - private List opAnd(List left, List right) { - if (left.isEmpty() && right.isEmpty()) - return new ArrayList(); - else if (isBoolean(left, false) || isBoolean(right, false)) - return makeBoolean(false); - else if (left.isEmpty() || right.isEmpty()) - return new ArrayList(); - else if (convertToBoolean(left) && convertToBoolean(right)) - return makeBoolean(true); - else - return makeBoolean(false); - } - - private List opAs(List left, List right) { - List result = new ArrayList(); - if (left.size() != 1 || right.size() != 1) - return result; - else { - String tn = convertToString(right); - if (tn.equals(left.get(0).fhirType())) - result.add(left.get(0)); - } - return result; - } - - private List opConcatenate(List left, List right) { - List result = new ArrayList(); - result.add(new StringType(convertToString(left) + convertToString((right)))); - return result; - } - - private List opContains(List left, List right) { - boolean ans = true; - for (Base r : right) { - boolean f = false; - for (Base l : left) - if (doEquals(l, r)) { - f = true; - break; - } - if (!f) { - ans = false; - break; - } - } - return makeBoolean(ans); - } - - private List opDiv(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing div: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing div: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing div: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing div: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing div: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing div: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) / Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { - Decimal d1; - try { - d1 = new Decimal(l.primitiveValue()); - Decimal d2 = new Decimal(r.primitiveValue()); - result.add(new IntegerType(d1.divInt(d2).asDecimal())); - } catch (UcumException e) { - throw new PathEngineException(e); - } - } - else - throw new PathEngineException(String.format("Error performing div: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opDivideBy(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing /: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing /: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing /: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing /: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing /: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer", "decimal", "unsignedInt", "positiveInt") && r.hasType("integer", "decimal", "unsignedInt", "positiveInt")) { - Decimal d1; - try { - d1 = new Decimal(l.primitiveValue()); - Decimal d2 = new Decimal(r.primitiveValue()); - result.add(new DecimalType(d1.divide(d2).asDecimal())); - } catch (UcumException e) { - throw new PathEngineException(e); - } - } - else - throw new PathEngineException(String.format("Error performing /: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opEquals(List left, List right) { - if (left.size() != right.size()) - return makeBoolean(false); - - boolean res = true; - for (int i = 0; i < left.size(); i++) { - if (!doEquals(left.get(i), right.get(i))) { - res = false; - break; - } - } - return makeBoolean(res); - } - - private List opEquivalent(List left, List right) throws PathEngineException { - if (left.size() != right.size()) - return makeBoolean(false); - - boolean res = true; - for (int i = 0; i < left.size(); i++) { - boolean found = false; - for (int j = 0; j < right.size(); j++) { - if (doEquivalent(left.get(i), right.get(j))) { - found = true; - break; - } - } - if (!found) { - res = false; - break; - } - } - return makeBoolean(res); - } - - private List opGreater(List left, List right) throws FHIRException { - if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string") && r.hasType("string")) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); - else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) - return makeBoolean(new Double(l.primitiveValue()) > new Double(r.primitiveValue())); - else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); - else if ((l.hasType("time")) && (r.hasType("time"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) > 0); - } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { - List lUnit = left.get(0).listChildrenByName("unit"); - List rUnit = right.get(0).listChildrenByName("unit"); - if (Base.compareDeep(lUnit, rUnit, true)) { - return opGreater(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); - } else { - throw new InternalErrorException("Canonical Comparison isn't done yet"); - } - } - return new ArrayList(); - } - - private List opGreaterOrEqual(List left, List right) throws FHIRException { - if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string") && r.hasType("string")) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); - else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) - return makeBoolean(new Double(l.primitiveValue()) >= new Double(r.primitiveValue())); - else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); - else if ((l.hasType("time")) && (r.hasType("time"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0); - } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { - List lUnit = left.get(0).listChildrenByName("unit"); - List rUnit = right.get(0).listChildrenByName("unit"); - if (Base.compareDeep(lUnit, rUnit, true)) { - return opGreaterOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); - } else { - throw new InternalErrorException("Canonical Comparison isn't done yet"); - } - } - return new ArrayList(); - } - - private List opImplies(List left, List right) { - if (!convertToBoolean(left)) - return makeBoolean(true); - else if (right.size() == 0) - return new ArrayList(); - else - return makeBoolean(convertToBoolean(right)); - } - - private List opIn(List left, List right) throws FHIRException { - boolean ans = true; - for (Base l : left) { - boolean f = false; - for (Base r : right) - if (doEquals(l, r)) { - f = true; - break; - } - if (!f) { - ans = false; - break; - } - } - return makeBoolean(ans); - } - - private List opIs(List left, List right) { - List result = new ArrayList(); - if (left.size() != 1 || right.size() != 1) - result.add(new BooleanType(false)); - else { - String tn = convertToString(right); - result.add(new BooleanType(left.get(0).hasType(tn))); - } - return result; - } - - private List opLessOrEqual(List left, List right) throws FHIRException { - if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string") && r.hasType("string")) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); - else if ((l.hasType("integer", "decimal", "unsignedInt", "positiveInt")) && (r.hasType("integer", "decimal", "unsignedInt", "positiveInt"))) - return makeBoolean(new Double(l.primitiveValue()) <= new Double(r.primitiveValue())); - else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); - else if ((l.hasType("time")) && (r.hasType("time"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) <= 0); - } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { - List lUnits = left.get(0).listChildrenByName("unit"); - String lunit = lUnits.size() == 1 ? lUnits.get(0).primitiveValue() : null; - List rUnits = right.get(0).listChildrenByName("unit"); - String runit = rUnits.size() == 1 ? rUnits.get(0).primitiveValue() : null; - if ((lunit == null && runit == null) || lunit.equals(runit)) { - return opLessOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); - } else { - throw new InternalErrorException("Canonical Comparison isn't done yet"); - } - } - return new ArrayList(); - } - - private List opLessThen(List left, List right) throws FHIRException { - if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) { - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string") && r.hasType("string")) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); - else if ((l.hasType("integer") || l.hasType("decimal")) && (r.hasType("integer") || r.hasType("decimal"))) - return makeBoolean(new Double(l.primitiveValue()) < new Double(r.primitiveValue())); - else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); - else if ((l.hasType("time")) && (r.hasType("time"))) - return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0); - } else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity") ) { - List lUnit = left.get(0).listChildrenByName("unit"); - List rUnit = right.get(0).listChildrenByName("unit"); - if (Base.compareDeep(lUnit, rUnit, true)) { - return opLessThen(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value")); - } else { - throw new InternalErrorException("Canonical Comparison isn't done yet"); - } - } - return new ArrayList(); - } - - private List opMemberOf(List left, List right) throws FHIRException { - boolean ans = false; - ValueSet vs = worker.fetchResource(ValueSet.class, right.get(0).primitiveValue()); - if (vs != null) { - for (Base l : left) { - if (l.fhirType().equals("code")) { - if (worker.validateCode(l.castToCoding(l), vs).isOk()) - ans = true; - } else if (l.fhirType().equals("Coding")) { - if (worker.validateCode(l.castToCoding(l), vs).isOk()) - ans = true; - } else if (l.fhirType().equals("CodeableConcept")) { - if (worker.validateCode(l.castToCodeableConcept(l), vs).isOk()) - ans = true; - } - } - } - return makeBoolean(ans); - } - - private List opMinus(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing -: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing -: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing -: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing -: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing -: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) - Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) - result.add(new DecimalType(new BigDecimal(l.primitiveValue()).subtract(new BigDecimal(r.primitiveValue())))); - else - throw new PathEngineException(String.format("Error performing -: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opMod(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing mod: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing mod: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing mod: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing mod: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing mod: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing mod: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) % Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { - Decimal d1; - try { - d1 = new Decimal(l.primitiveValue()); - Decimal d2 = new Decimal(r.primitiveValue()); - result.add(new DecimalType(d1.modulo(d2).asDecimal())); - } catch (UcumException e) { - throw new PathEngineException(e); - } - } - else - throw new PathEngineException(String.format("Error performing mod: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opNotEquals(List left, List right) { - if (left.size() != right.size()) - return makeBoolean(true); - - boolean res = true; - for (int i = 0; i < left.size(); i++) { - if (!doEquals(left.get(i), right.get(i))) { - res = false; - break; - } - } - return makeBoolean(!res); - } - - private List opNotEquivalent(List left, List right) throws PathEngineException { - if (left.size() != right.size()) - return makeBoolean(true); - - boolean res = true; - for (int i = 0; i < left.size(); i++) { - boolean found = false; - for (int j = 0; j < right.size(); j++) { - if (doEquivalent(left.get(i), right.get(j))) { - found = true; - break; - } - } - if (!found) { - res = false; - break; - } - } - return makeBoolean(!res); - } - - private List opOr(List left, List right) { - if (left.isEmpty() && right.isEmpty()) - return new ArrayList(); - else if (convertToBoolean(left) || convertToBoolean(right)) - return makeBoolean(true); - else if (left.isEmpty() || right.isEmpty()) - return new ArrayList(); - else - return makeBoolean(false); - } - - private List opPlus(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing +: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing +: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing +: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing +: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing +: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - if (l.hasType("string", "id", "code", "uri") && r.hasType("string", "id", "code", "uri")) - result.add(new StringType(l.primitiveValue() + r.primitiveValue())); - else if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) - result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue())))); - else - throw new PathEngineException(String.format("Error performing +: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opTimes(List left, List right) throws PathEngineException { - if (left.size() == 0) - throw new PathEngineException("Error performing *: left operand has no value"); - if (left.size() > 1) - throw new PathEngineException("Error performing *: left operand has more than one value"); - if (!left.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType())); - if (right.size() == 0) - throw new PathEngineException("Error performing *: right operand has no value"); - if (right.size() > 1) - throw new PathEngineException("Error performing *: right operand has more than one value"); - if (!right.get(0).isPrimitive()) - throw new PathEngineException(String.format("Error performing *: right operand has the wrong type (%s)", right.get(0).fhirType())); - - List result = new ArrayList(); - Base l = left.get(0); - Base r = right.get(0); - - if (l.hasType("integer") && r.hasType("integer")) - result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) * Integer.parseInt(r.primitiveValue()))); - else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) - result.add(new DecimalType(new BigDecimal(l.primitiveValue()).multiply(new BigDecimal(r.primitiveValue())))); - else - throw new PathEngineException(String.format("Error performing *: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType())); - return result; - } - - private List opUnion(List left, List right) { - List result = new ArrayList(); - for (Base item : left) { - if (!doContains(result, item)) - result.add(item); - } - for (Base item : right) { - if (!doContains(result, item)) - result.add(item); - } - return result; - } - - private List opXor(List left, List right) { - if (left.isEmpty() || right.isEmpty()) - return new ArrayList(); - else - return makeBoolean(convertToBoolean(left) ^ convertToBoolean(right)); - } - - private List operate(List left, Operation operation, List right) throws FHIRException { - switch (operation) { - case Equals: return opEquals(left, right); - case Equivalent: return opEquivalent(left, right); - case NotEquals: return opNotEquals(left, right); - case NotEquivalent: return opNotEquivalent(left, right); - case LessThen: return opLessThen(left, right); - case Greater: return opGreater(left, right); - case LessOrEqual: return opLessOrEqual(left, right); - case GreaterOrEqual: return opGreaterOrEqual(left, right); - case Union: return opUnion(left, right); - case In: return opIn(left, right); - case MemberOf: return opMemberOf(left, right); - case Contains: return opContains(left, right); - case Or: return opOr(left, right); - case And: return opAnd(left, right); - case Xor: return opXor(left, right); - case Implies: return opImplies(left, right); - case Plus: return opPlus(left, right); - case Times: return opTimes(left, right); - case Minus: return opMinus(left, right); - case Concatenate: return opConcatenate(left, right); - case DivideBy: return opDivideBy(left, right); - case Div: return opDiv(left, right); - case Mod: return opMod(left, right); - case Is: return opIs(left, right); - case As: return opAs(left, right); - default: - throw new Error("Not Done Yet: "+operation.toCode()); - } - } - - private TypeDetails operateTypes(TypeDetails left, Operation operation, TypeDetails right) { - switch (operation) { - case Equals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Equivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case NotEquals: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case NotEquivalent: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case LessThen: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Greater: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case LessOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case GreaterOrEqual: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Is: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case As: return new TypeDetails(CollectionStatus.SINGLETON, right.getTypes()); - case Union: return left.union(right); - case Or: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case And: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Xor: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Implies : return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Times: - TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("integer"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - return result; - case DivideBy: - result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("decimal"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - return result; - case Concatenate: - result = new TypeDetails(CollectionStatus.SINGLETON, ""); - case Plus: - result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("integer"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - else if (left.hasType(worker, "string", "id", "code", "uri") && right.hasType(worker, "string", "id", "code", "uri")) - result.addType("string"); - return result; - case Minus: - result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("integer"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - return result; - case Div: - case Mod: - result = new TypeDetails(CollectionStatus.SINGLETON); - if (left.hasType(worker, "integer") && right.hasType(worker, "integer")) - result.addType("integer"); - else if (left.hasType(worker, "integer", "decimal") && right.hasType(worker, "integer", "decimal")) - result.addType("decimal"); - return result; - case In: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case MemberOf: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - case Contains: return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - default: - return null; - } - } - - private ExpressionNode organisePrecedence(FHIRLexer lexer, ExpressionNode node) { - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Times, Operation.DivideBy, Operation.Div, Operation.Mod)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Plus, Operation.Minus, Operation.Concatenate)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Union)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.LessThen, Operation.Greater, Operation.LessOrEqual, Operation.GreaterOrEqual)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Is)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Equals, Operation.Equivalent, Operation.NotEquals, Operation.NotEquivalent)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.And)); - node = gatherPrecedence(lexer, node, EnumSet.of(Operation.Xor, Operation.Or)); - // last: implies - return node; - } - - /** - * Parse a path for later use using execute - * - * @param path - * @return - * @throws PathEngineException - * @throws Exception - */ - public ExpressionNode parse(String path) throws FHIRLexerException { - FHIRLexer lexer = new FHIRLexer(path); - if (lexer.done()) - throw lexer.error("Path cannot be empty"); - ExpressionNode result = parseExpression(lexer, true); - if (!lexer.done()) - throw lexer.error("Premature ExpressionNode termination at unexpected token \""+lexer.getCurrent()+"\""); - result.check(); - return result; - } - - /** - * Parse a path that is part of some other syntax - * - * @param path - * @return - * @throws PathEngineException - * @throws Exception - */ - public ExpressionNode parse(FHIRLexer lexer) throws FHIRLexerException { - ExpressionNode result = parseExpression(lexer, true); - result.check(); - return result; - } - - private ExpressionNode parseExpression(FHIRLexer lexer, boolean proximal) throws FHIRLexerException { - ExpressionNode result = new ExpressionNode(lexer.nextId()); - SourceLocation c = lexer.getCurrentStartLocation(); - result.setStart(lexer.getCurrentLocation()); - // special: - if (lexer.getCurrent().equals("-")) { - lexer.take(); - lexer.setCurrent("-"+lexer.getCurrent()); - } - if (lexer.getCurrent().equals("+")) { - lexer.take(); - lexer.setCurrent("+"+lexer.getCurrent()); - } - if (lexer.isConstant(false)) { - checkConstant(lexer.getCurrent(), lexer); - result.setConstant(lexer.take()); - result.setKind(Kind.Constant); - result.setEnd(lexer.getCurrentLocation()); - } else if ("(".equals(lexer.getCurrent())) { - lexer.next(); - result.setKind(Kind.Group); - result.setGroup(parseExpression(lexer, true)); - if (!")".equals(lexer.getCurrent())) - throw lexer.error("Found "+lexer.getCurrent()+" expecting a \")\""); - result.setEnd(lexer.getCurrentLocation()); - lexer.next(); - } else { - if (!lexer.isToken() && !lexer.getCurrent().startsWith("\"")) - throw lexer.error("Found "+lexer.getCurrent()+" expecting a token name"); - if (lexer.getCurrent().startsWith("\"")) - result.setName(lexer.readConstant("Path Name")); - else - result.setName(lexer.take()); - result.setEnd(lexer.getCurrentLocation()); - if (!result.checkName()) - throw lexer.error("Found "+result.getName()+" expecting a valid token name"); - if ("(".equals(lexer.getCurrent())) { - Function f = Function.fromCode(result.getName()); - FunctionDetails details = null; - if (f == null) { - if (hostServices != null) - details = hostServices.resolveFunction(result.getName()); - if (details == null) - throw lexer.error("The name "+result.getName()+" is not a valid function name"); - f = Function.Custom; - } - result.setKind(Kind.Function); - result.setFunction(f); - lexer.next(); - while (!")".equals(lexer.getCurrent())) { - result.getParameters().add(parseExpression(lexer, true)); - if (",".equals(lexer.getCurrent())) - lexer.next(); - else if (!")".equals(lexer.getCurrent())) - throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - either a \",\" or a \")\" expected"); - } - result.setEnd(lexer.getCurrentLocation()); - lexer.next(); - checkParameters(lexer, c, result, details); - } else - result.setKind(Kind.Name); - } - ExpressionNode focus = result; - if ("[".equals(lexer.getCurrent())) { - lexer.next(); - ExpressionNode item = new ExpressionNode(lexer.nextId()); - item.setKind(Kind.Function); - item.setFunction(ExpressionNode.Function.Item); - item.getParameters().add(parseExpression(lexer, true)); - if (!lexer.getCurrent().equals("]")) - throw lexer.error("The token "+lexer.getCurrent()+" is not expected here - a \"]\" expected"); - lexer.next(); - result.setInner(item); - focus = item; - } - if (".".equals(lexer.getCurrent())) { - lexer.next(); - focus.setInner(parseExpression(lexer, false)); - } - result.setProximal(proximal); - if (proximal) { - while (lexer.isOp()) { - focus.setOperation(ExpressionNode.Operation.fromCode(lexer.getCurrent())); - focus.setOpStart(lexer.getCurrentStartLocation()); - focus.setOpEnd(lexer.getCurrentLocation()); - lexer.next(); - focus.setOpNext(parseExpression(lexer, false)); - focus = focus.getOpNext(); - } - result = organisePrecedence(lexer, result); - } - return result; - } - - private List preOperate(List left, Operation operation) { - switch (operation) { - case And: - return isBoolean(left, false) ? makeBoolean(false) : null; - case Or: - return isBoolean(left, true) ? makeBoolean(true) : null; - case Implies: - return convertToBoolean(left) ? null : makeBoolean(true); - default: - return null; - } - } - - private Base processConstant(ExecutionContext context, String constant) throws PathEngineException { - if (constant.equals("true")) { - return new BooleanType(true); - } else if (constant.equals("false")) { - return new BooleanType(false); - } else if (constant.equals("{}")) { - return null; - } else if (Utilities.isInteger(constant)) { - return new IntegerType(constant); - } else if (Utilities.isDecimal(constant)) { - return new DecimalType(constant); - } else if (constant.startsWith("\'")) { - return new StringType(processConstantString(constant)); - } else if (constant.startsWith("%")) { - return resolveConstant(context, constant); - } else if (constant.startsWith("@")) { - return processDateConstant(context.appInfo, constant.substring(1)); - } else { - return new StringType(constant); - } - } - - private String processConstantString(String s) throws PathEngineException { - StringBuilder b = new StringBuilder(); - int i = 1; - while (i < s.length()-1) { - char ch = s.charAt(i); - if (ch == '\\') { - i++; - switch (s.charAt(i)) { - case 't': - b.append('\t'); - break; - case 'r': - b.append('\r'); - break; - case 'n': - b.append('\n'); - break; - case 'f': - b.append('\f'); - break; - case '\'': - b.append('\''); - break; - case '\\': - b.append('\\'); - break; - case '/': - b.append('/'); - break; - case 'u': - i++; - int uc = Integer.parseInt(s.substring(i, i+4), 16); - b.append((char) uc); - i = i + 3; - break; - default: - throw new PathEngineException("Unknown character escape \\"+s.charAt(i)); - } - i++; - } else { - b.append(ch); - i++; - } - } - return b.toString(); - } - - private Base processDateConstant(Object appInfo, String value) throws PathEngineException { - if (value.startsWith("T")) - return new TimeType(value.substring(1)); - String v = value; - if (v.length() > 10) { - int i = v.substring(10).indexOf("-"); - if (i == -1) - i = v.substring(10).indexOf("+"); - if (i == -1) - i = v.substring(10).indexOf("Z"); - v = i == -1 ? value : v.substring(0, 10+i); - } - if (v.length() > 10) - return new DateTimeType(value); - else - return new DateType(value); - } - - private TypeDetails readConstantType(ExecutionTypeContext context, String constant) throws PathEngineException { - if (constant.equals("true")) - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - else if (constant.equals("false")) - return new TypeDetails(CollectionStatus.SINGLETON, "boolean"); - else if (Utilities.isInteger(constant)) - return new TypeDetails(CollectionStatus.SINGLETON, "integer"); - else if (Utilities.isDecimal(constant)) - return new TypeDetails(CollectionStatus.SINGLETON, "decimal"); - else if (constant.startsWith("%")) - return resolveConstantType(context, constant); - else - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - } - - private Base resolveConstant(ExecutionContext context, String s) throws PathEngineException { - if (s.equals("%sct")) - return new StringType("http://snomed.info/sct"); - else if (s.equals("%loinc")) - return new StringType("http://loinc.org"); - else if (s.equals("%ucum")) - return new StringType("http://unitsofmeasure.org"); - else if (s.equals("%resource")) { - if (context.resource == null) - throw new PathEngineException("Cannot use %resource in this context"); - return context.resource; - } else if (s.equals("%context")) { - return context.context; - } else if (s.equals("%us-zip")) - return new StringType("[0-9]{5}(-[0-9]{4}){0,1}"); - else if (s.startsWith("%\"vs-")) - return new StringType("http://hl7.org/fhir/ValueSet/"+s.substring(5, s.length()-1)+""); - else if (s.startsWith("%\"cs-")) - return new StringType("http://hl7.org/fhir/"+s.substring(5, s.length()-1)+""); - else if (s.startsWith("%\"ext-")) - return new StringType("http://hl7.org/fhir/StructureDefinition/"+s.substring(6, s.length()-1)); - else if (hostServices == null) - throw new PathEngineException("Unknown fixed constant '"+s+"'"); - else - return hostServices.resolveConstant(context.appInfo, s.substring(1)); - } - - private TypeDetails resolveConstantType(ExecutionTypeContext context, String s) throws PathEngineException { - if (s.equals("%sct")) - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - else if (s.equals("%loinc")) - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - else if (s.equals("%ucum")) - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - else if (s.equals("%resource")) { - if (context.resource == null) - throw new PathEngineException("%resource cannot be used in this context"); - return new TypeDetails(CollectionStatus.SINGLETON, context.resource); - } else if (s.equals("%context")) { - return new TypeDetails(CollectionStatus.SINGLETON, context.context); - } else if (s.equals("%map-codes")) - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - else if (s.equals("%us-zip")) - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - else if (s.startsWith("%\"vs-")) - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - else if (s.startsWith("%\"cs-")) - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - else if (s.startsWith("%\"ext-")) - return new TypeDetails(CollectionStatus.SINGLETON, "string"); - else if (hostServices == null) - throw new PathEngineException("Unknown fixed constant type for '"+s+"'"); - else - return hostServices.resolveConstantType(context.appInfo, s); - } - - private String tailDot(String path) { - return path.substring(path.lastIndexOf(".") + 1); - } - - private boolean tailMatches(ElementDefinition t, String d) { - String tail = tailDot(t.getPath()); - if (d.contains("[")) - return tail.startsWith(d.substring(0, d.indexOf('['))); - else - return tail.equals(d); - } public String takeLog() { if (!hasLog()) @@ -2734,167 +2885,107 @@ public class FHIRPathEngine { } - // if the fhir path expressions are allowed to use constants beyond those defined in the specification - // the application can implement them by providing a constant resolver - public interface IEvaluationContext { - /** - * Check the function parameters, and throw an error if they are incorrect, or return the type for the function - * @param functionName - * @param parameters - * @return - */ - public TypeDetails checkFunction(Object appContext, String functionName, List parameters) throws PathEngineException; + /** given an element definition in a profile, what element contains the differentiating fixed + * for the element, given the differentiating expresssion. The expression is only allowed to + * use a subset of FHIRPath + * + * @param profile + * @param element + * @return + * @throws PathEngineException + * @throws DefinitionException + */ + public ElementDefinition evaluateDefinition(ExpressionNode expr, StructureDefinition profile, ElementDefinition element) throws DefinitionException { + StructureDefinition sd = profile; + ElementDefinition focus = null; - /** - * @param appContext - * @param functionName - * @param parameters - * @return - */ - public List executeFunction(Object appContext, String functionName, List> parameters); - - /** - * when the .log() function is called - * - * @param argument - * @param focus - * @return - */ - public boolean log(String argument, List focus); - - /** - * A constant reference - e.g. a reference to a name that must be resolved in context. - * The % will be removed from the constant name before this is invoked. - * - * This will also be called if the host invokes the FluentPath engine with a context of null - * - * @param appContext - content passed into the fluent path engine - * @param name - name reference to resolve - * @return the value of the reference (or null, if it's not valid, though can throw an exception if desired) - */ - public Base resolveConstant(Object appContext, String name) throws PathEngineException; - - // extensibility for functions - - public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException; - - /** - * - * @param functionName - * @return null if the function is not known - */ - public FunctionDetails resolveFunction(String functionName); - - /** - * Implementation of resolve() function. Passed a string, return matching resource, if one is known - else null - * @param appInfo - * @param url - * @return - */ - public Base resolveReference(Object appContext, String url); - - public class FunctionDetails { - private String description; - private int minParameters; - private int maxParameters; - public FunctionDetails(String description, int minParameters, int maxParameters) { - super(); - this.description = description; - this.minParameters = minParameters; - this.maxParameters = maxParameters; + if (expr.getKind() == Kind.Name) { + List childDefinitions; + childDefinitions = ProfileUtilities.getChildMap(sd, element); + // if that's empty, get the children of the type + if (childDefinitions.isEmpty()) { + sd = fetchStructureByType(element); + if (sd == null) + throw new DefinitionException("Problem with use of resolve() - profile '"+element.getType().get(0).getProfile()+"' on "+element.getId()+" could not be resolved"); + childDefinitions = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElementFirstRep()); } - public String getDescription() { - return description; + for (ElementDefinition t : childDefinitions) { + if (tailMatches(t, expr.getName())) { + focus = t; + break; + } } - - public int getMaxParameters() { - return maxParameters; - } - - public int getMinParameters() { - return minParameters; - } - + } else if (expr.getKind() == Kind.Function) { + if ("resolve".equals(expr.getName())) { + if (!element.hasType()) + throw new DefinitionException("illegal use of resolve() in discriminator - no type on element "+element.getId()); + if (element.getType().size() > 1) + throw new DefinitionException("illegal use of resolve() in discriminator - Multiple possible types on "+element.getId()); + if (!"Reference".equals(element.getType().get(0).getCode())) + throw new DefinitionException("illegal use of resolve() in discriminator - type on "+element.getId()+" is not Reference ("+element.getType().get(0).getCode()+")"); + sd = worker.fetchResource(StructureDefinition.class, element.getType().get(0).getTargetProfile()); + if (sd == null) + throw new DefinitionException("Problem with use of resolve() - profile '"+element.getType().get(0).getTargetProfile()+"' on "+element.getId()+" could not be resolved"); + focus = sd.getSnapshot().getElementFirstRep(); + } else if ("extension".equals(expr.getName())) { + String targetUrl = expr.getParameters().get(0).getConstant(); + targetUrl = targetUrl.substring(1,targetUrl.length()-1); + List childDefinitions = ProfileUtilities.getChildMap(sd, element); + for (ElementDefinition t : childDefinitions) { + if (t.getPath().endsWith(".extension") && t.hasSliceName()) { + sd = worker.fetchResource(StructureDefinition.class, t.getType().get(0).getProfile()); + while (sd!=null && !sd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/Extension")) + sd = worker.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); + if (sd.getUrl().equals(targetUrl)) { + focus = t; + break; + } + } + } + } else + throw new DefinitionException("illegal function name "+expr.getName()+"() in discriminator"); + } else if (expr.getKind() == Kind.Group) { + throw new DefinitionException("illegal expression syntax in discriminator (group)"); + } else if (expr.getKind() == Kind.Constant) { + throw new DefinitionException("illegal expression syntax in discriminator (const)"); } + if (focus == null) + throw new DefinitionException("Unable to resolve discriminator"); + else if (expr.getInner() == null) + return focus; + else + return evaluateDefinition(expr.getInner(), sd, focus); } - private class ExecutionContext { - private Object appInfo; - private Base resource; - private Base context; - private Base thisItem; - private Map aliases; - - public ExecutionContext(Object appInfo, Base resource, Base context, Map aliases, Base thisItem) { - this.appInfo = appInfo; - this.context = context; - this.resource = resource; - this.aliases = aliases; - this.thisItem = thisItem; - } - - public void addAlias(String name, List focus) throws FHIRException { - if (aliases == null) - aliases = new HashMap(); - else - aliases = new HashMap(aliases); // clone it, since it's going to change - if (focus.size() > 1) - throw new FHIRException("Attempt to alias a collection, not a singleton"); - aliases.put(name, focus.size() == 0 ? null : focus.get(0)); - } - - public Base getAlias(String name) { - return aliases == null ? null : aliases.get(name); - } - - public Base getResource() { - return resource; - } - - public Base getThisItem() { - return thisItem; - } + private StructureDefinition fetchStructureByType(ElementDefinition ed) throws DefinitionException { + if (ed.getType().size() == 0) + throw new DefinitionException("Error in discriminator at "+ed.getId()+": no children, no type"); + if (ed.getType().size() > 1) + throw new DefinitionException("Error in discriminator at "+ed.getId()+": no children, multiple types"); + if (ed.hasSlicing()) + throw new DefinitionException("Error in discriminator at "+ed.getId()+": slicing found"); + if (ed.getType().get(0).hasProfile()) + return worker.fetchResource(StructureDefinition.class, ed.getType().get(0).getProfile()); + else + return worker.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + ed.getType().get(0).getCode()); } - private class ExecutionTypeContext { - private Object appInfo; - private String resource; - private String context; - private TypeDetails thisItem; - - public ExecutionTypeContext(Object appInfo, String resource, String context, TypeDetails thisItem) { - super(); - this.appInfo = appInfo; - this.resource = resource; - this.context = context; - this.thisItem = thisItem; - - } - public String getResource() { - return resource; - } - public TypeDetails getThisItem() { - return thisItem; - } + private boolean tailMatches(ElementDefinition t, String d) { + String tail = tailDot(t.getPath()); + if (d.contains("[")) + return tail.startsWith(d.substring(0, d.indexOf('['))); + else if (tail.equals(d)) + return true; + else if (t.getType().size()==1 && t.getPath().toUpperCase().endsWith(t.getType().get(0).getCode().toUpperCase())) + return tail.startsWith(d); + + return false; } - public class ElementDefinitionMatch { - private ElementDefinition definition; - private String fixedType; - public ElementDefinitionMatch(ElementDefinition definition, String fixedType) { - super(); - this.definition = definition; - this.fixedType = fixedType; - } - public ElementDefinition getDefinition() { - return definition; - } - public String getFixedType() { - return fixedType; - } - + private String tailDot(String path) { + return path.substring(path.lastIndexOf(".") + 1); } } diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/OperationOutcomeUtilities.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/OperationOutcomeUtilities.java index f456378def6..280d97653c5 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/OperationOutcomeUtilities.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/OperationOutcomeUtilities.java @@ -35,6 +35,7 @@ public class OperationOutcomeUtilities { case ERROR : return IssueSeverity.ERROR; case WARNING : return IssueSeverity.WARNING; case INFORMATION : return IssueSeverity.INFORMATION; + case NULL : return IssueSeverity.NULL; } return IssueSeverity.NULL; } @@ -70,6 +71,7 @@ public class OperationOutcomeUtilities { case TIMEOUT: return IssueType.TIMEOUT; case THROTTLED: return IssueType.THROTTLED; case INFORMATIONAL: return IssueType.INFORMATIONAL; + case NULL: return IssueType.NULL; } return IssueType.NULL; } diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/QuestionnaireBuilder.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/QuestionnaireBuilder.java index 1d1481664a0..5132e96f21a 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/QuestionnaireBuilder.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/QuestionnaireBuilder.java @@ -589,20 +589,20 @@ public class QuestionnaireBuilder { private Type convertType(Base value, QuestionnaireItemType af, ValueSet vs, String path) throws FHIRException { switch (af) { // simple cases - case BOOLEAN: if (value instanceof BooleanType) return (Type) value; - case DECIMAL: if (value instanceof DecimalType) return (Type) value; - case INTEGER: if (value instanceof IntegerType) return (Type) value; - case DATE: if (value instanceof DateType) return (Type) value; - case DATETIME: if (value instanceof DateTimeType) return (Type) value; - case TIME: if (value instanceof TimeType) return (Type) value; + case BOOLEAN: if (value instanceof BooleanType) return (Type) value; break; + case DECIMAL: if (value instanceof DecimalType) return (Type) value; break; + case INTEGER: if (value instanceof IntegerType) return (Type) value; break; + case DATE: if (value instanceof DateType) return (Type) value; break; + case DATETIME: if (value instanceof DateTimeType) return (Type) value; break; + case TIME: if (value instanceof TimeType) return (Type) value; break; case STRING: if (value instanceof StringType) return (Type) value; else if (value instanceof UriType) return new StringType(((UriType) value).asStringValue()); - - case TEXT: if (value instanceof StringType) return (Type) value; - case QUANTITY: if (value instanceof Quantity) return (Type) value; + break; + case TEXT: if (value instanceof StringType) return (Type) value; break; + case QUANTITY: if (value instanceof Quantity) return (Type) value; break; // complex cases: // ? QuestionnaireItemTypeAttachment: ...? @@ -621,6 +621,7 @@ public class QuestionnaireBuilder { cc.setSystem(getSystemForCode(vs, cc.getCode(), path)); return cc; } + break; case REFERENCE: if (value instanceof Reference) @@ -629,6 +630,9 @@ public class QuestionnaireBuilder { Reference r = new Reference(); r.setReference(((StringType) value).asStringValue()); } + break; + default: + break; } throw new FHIRException("Unable to convert from '"+value.getClass().toString()+"' for Answer Format "+af.toCode()+", path = "+path); diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/StructureMapUtilities.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/StructureMapUtilities.java index 388421225c6..8cd8f23fa9e 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/StructureMapUtilities.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/StructureMapUtilities.java @@ -365,11 +365,14 @@ public class StructureMapUtilities { private static void renderGroup(StringBuilder b, StructureMapGroupComponent g) { b.append("group "); switch (g.getTypeMode()) { - case TYPES: b.append("for types"); - case TYPEANDTYPES: b.append("for type+types "); + case TYPES: + b.append("for types"); + break; + case TYPEANDTYPES: + b.append("for type+types "); + break; default: // NONE, NULL } - b.append("for types "); b.append(g.getName()); if (g.hasExtends()) { b.append(" extends "); diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/client/ResourceAddress.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/client/ResourceAddress.java index 368b9b2c0ba..ef2b841547b 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/client/ResourceAddress.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/client/ResourceAddress.java @@ -1,417 +1,417 @@ -package org.hl7.fhir.r4.utils.client; - - -/* - 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.net.URI; -import java.net.URISyntaxException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.TimeZone; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.lang3.StringUtils; -import org.apache.http.client.utils.URIBuilder; -import org.hl7.fhir.r4.model.Resource; -import org.hl7.fhir.r4.model.ResourceType; -import org.hl7.fhir.utilities.Utilities; - -//Make resources address subclass of URI -/** - * Helper class to manage FHIR Resource URIs - * - * @author Claude Nanjo - * - */ -public class ResourceAddress { - - public static final String REGEX_ID_WITH_HISTORY = "(.*)(/)([a-zA-Z0-9]*)(/)([a-z0-9\\-\\.]{1,64})(/_history/)([a-z0-9\\-\\.]{1,64})$"; - - private URI baseServiceUri; - - public ResourceAddress(String endpointPath) throws URISyntaxException {//TODO Revisit this exception - this.baseServiceUri = ResourceAddress.buildAbsoluteURI(endpointPath); - } - - public ResourceAddress(URI baseServiceUri) { - this.baseServiceUri = baseServiceUri; - } - - public URI getBaseServiceUri() { - return this.baseServiceUri; - } - - public URI resolveOperationURLFromClass(Class resourceClass, String name, String parameters) { - return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$"+name+"?"+ parameters); - } - - public URI resolveSearchUri(Class resourceClass, Map parameters) { - return appendHttpParameters(baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"_search"), parameters); - } - - private String nameForClassWithSlash(Class resourceClass) { - String n = nameForClass(resourceClass); - return n == null ? "" : n +"/"; - } - - public URI resolveOperationUri(Class resourceClass, String opName) { - return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"/"+opName); - } - - public URI resolveOperationUri(Class resourceClass, String opName, Map parameters) { - return appendHttpParameters(baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$"+opName), parameters); - } - - public URI resolveValidateUri(Class resourceClass, String id) { - return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$validate/"+id); - } - - public URI resolveGetUriFromResourceClass(Class resourceClass) { - return baseServiceUri.resolve(nameForClass(resourceClass)); - } - - public URI resolveGetUriFromResourceClassAndId(Class resourceClass, String id) { - return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id); - } - - public URI resolveGetUriFromResourceClassAndIdAndVersion(Class resourceClass, String id, String version) { - return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id+"/_history/"+version); - } - - public URI resolveGetHistoryForAllResources(int count) { - if(count > 0) { - return appendHttpParameter(baseServiceUri.resolve("_history"), "_count", ""+count); - } else { - return baseServiceUri.resolve("_history"); - } -} - - public URI resolveGetHistoryForResourceId(Class resourceClass, String id, int count) { - return resolveGetHistoryUriForResourceId(resourceClass, id, null, count); - } - - protected URI resolveGetHistoryUriForResourceId(Class resourceClass, String id, Object since, int count) { - Map parameters = getHistoryParameters(since, count); - return appendHttpParameters(baseServiceUri.resolve(nameForClass(resourceClass) + "/" + id + "/_history"), parameters); - } - - public URI resolveGetHistoryForResourceType(Class resourceClass, int count) { - Map parameters = getHistoryParameters(null, count); - return appendHttpParameters(baseServiceUri.resolve(nameForClass(resourceClass) + "/_history"), parameters); - } - - public URI resolveGetHistoryForResourceType(Class resourceClass, Object since, int count) { - Map parameters = getHistoryParameters(since, count); - return appendHttpParameters(baseServiceUri.resolve(nameForClass(resourceClass) + "/_history"), parameters); - } - - public URI resolveGetHistoryForAllResources(Calendar since, int count) { - Map parameters = getHistoryParameters(since, count); - return appendHttpParameters(baseServiceUri.resolve("_history"), parameters); - } - - public URI resolveGetHistoryForAllResources(Date since, int count) { - Map parameters = getHistoryParameters(since, count); - return appendHttpParameters(baseServiceUri.resolve("_history"), parameters); - } - - public Map getHistoryParameters(Object since, int count) { - Map parameters = new HashMap(); - if (since != null) { - parameters.put("_since", since.toString()); - } - if(count > 0) { - parameters.put("_count", ""+count); - } - return parameters; - } - - public URI resolveGetHistoryForResourceId(Class resourceClass, String id, Calendar since, int count) { - return resolveGetHistoryUriForResourceId(resourceClass, id, since, count); - } - - public URI resolveGetHistoryForResourceId(Class resourceClass, String id, Date since, int count) { - return resolveGetHistoryUriForResourceId(resourceClass, id, since, count); - } - - public URI resolveGetHistoryForResourceType(Class resourceClass, Calendar since, int count) { - return resolveGetHistoryForResourceType(resourceClass, getCalendarDateInIsoTimeFormat(since), count); - } - - public URI resolveGetHistoryForResourceType(Class resourceClass, Date since, int count) { - return resolveGetHistoryForResourceType(resourceClass, since.toString(), count); - } - - public URI resolveGetAllTags() { - return baseServiceUri.resolve("_tags"); - } - - public URI resolveGetAllTagsForResourceType(Class resourceClass) { - return baseServiceUri.resolve(nameForClass(resourceClass) + "/_tags"); - } - - public URI resolveGetTagsForReference(Class resourceClass, String id) { - return baseServiceUri.resolve(nameForClass(resourceClass) + "/" + id + "/_tags"); - } - - public URI resolveGetTagsForResourceVersion(Class resourceClass, String id, String version) { - return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id+"/_history/"+version + "/_tags"); - } - - public URI resolveDeleteTagsForResourceVersion(Class resourceClass, String id, String version) { - return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id+"/_history/"+version + "/_tags/_delete"); - } - - - public String nameForClass(Class resourceClass) { - if (resourceClass == null) - return null; - String res = resourceClass.getSimpleName(); - if (res.equals("List_")) - return "List"; - else - return res; - } - - public URI resolveMetadataUri(boolean quick) { - return baseServiceUri.resolve(quick ? "metadata?_summary=true" : "metadata"); - } - - /** - * For now, assume this type of location header structure. - * Generalize later: http://hl7connect.healthintersections.com.au/svc/fhir/318/_history/1 - * - * @param serviceBase - * @param locationHeader - */ - public static ResourceAddress.ResourceVersionedIdentifier parseCreateLocation(String locationResponseHeader) { - Pattern pattern = Pattern.compile(REGEX_ID_WITH_HISTORY); - Matcher matcher = pattern.matcher(locationResponseHeader); - ResourceVersionedIdentifier parsedHeader = null; - if(matcher.matches()){ - String serviceRoot = matcher.group(1); - String resourceType = matcher.group(3); - String id = matcher.group(5); - String version = matcher.group(7); - parsedHeader = new ResourceVersionedIdentifier(serviceRoot, resourceType, id, version); - } - return parsedHeader; - } - - public static URI buildAbsoluteURI(String absoluteURI) { - - if(StringUtils.isBlank(absoluteURI)) { - throw new EFhirClientException("Invalid URI", new URISyntaxException(absoluteURI, "URI/URL cannot be blank")); - } - - String endpoint = appendForwardSlashToPath(absoluteURI); - - return buildEndpointUriFromString(endpoint); - } - - public static String appendForwardSlashToPath(String path) { - if(path.lastIndexOf('/') != path.length() - 1) { - path += "/"; - } - return path; - } - - public static URI buildEndpointUriFromString(String endpointPath) { - URI uri = null; - try { - URIBuilder uriBuilder = new URIBuilder(endpointPath); - uri = uriBuilder.build(); - String scheme = uri.getScheme(); - String host = uri.getHost(); - if(!scheme.equalsIgnoreCase("http") && !scheme.equalsIgnoreCase("https")) { - throw new EFhirClientException("Scheme must be 'http' or 'https': " + uri); - } - if(StringUtils.isBlank(host)) { - throw new EFhirClientException("host cannot be blank: " + uri); - } - } catch(URISyntaxException e) { - throw new EFhirClientException("Invalid URI", e); - } - return uri; - } - - public static URI appendQueryStringToUri(URI uri, String parameterName, String parameterValue) { - URI modifiedUri = null; - try { - URIBuilder uriBuilder = new URIBuilder(uri); - uriBuilder.setQuery(parameterName + "=" + parameterValue); - modifiedUri = uriBuilder.build(); - } catch(Exception e) { - throw new EFhirClientException("Unable to append query parameter '" + parameterName + "=" + parameterValue + " to URI " + uri, e); - } - return modifiedUri; - } - - public static String buildRelativePathFromResourceType(ResourceType resourceType) { - //return resourceType.toString().toLowerCase()+"/"; - return resourceType.toString() + "/"; - } - - public static String buildRelativePathFromResourceType(ResourceType resourceType, String id) { - return buildRelativePathFromResourceType(resourceType)+ "@" + id; - } - - public static String buildRelativePathFromReference(Resource resource) { - return buildRelativePathFromResourceType(resource.getResourceType()); - } - - public static String buildRelativePathFromReference(Resource resource, String id) { - return buildRelativePathFromResourceType(resource.getResourceType(), id); - } - - public static class ResourceVersionedIdentifier { - - private String serviceRoot; - private String resourceType; - private String id; - private String version; - private URI resourceLocation; - - public ResourceVersionedIdentifier(String serviceRoot, String resourceType, String id, String version, URI resourceLocation) { - this.serviceRoot = serviceRoot; - this.resourceType = resourceType; - this.id = id; - this.version = version; - this.resourceLocation = resourceLocation; - } - - public ResourceVersionedIdentifier(String resourceType, String id, String version, URI resourceLocation) { - this(null, resourceType, id, version, resourceLocation); - } - - public ResourceVersionedIdentifier(String serviceRoot, String resourceType, String id, String version) { - this(serviceRoot, resourceType, id, version, null); - } - - public ResourceVersionedIdentifier(String resourceType, String id, String version) { - this(null, resourceType, id, version, null); - } - - public ResourceVersionedIdentifier(String resourceType, String id) { - this.id = id; - } - - public String getId() { - return this.id; - } - - protected void setId(String id) { - this.id = id; - } - - public String getVersionId() { - return this.version; - } - - protected void setVersionId(String version) { - this.version = version; - } - - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public String getServiceRoot() { - return serviceRoot; - } - - public void setServiceRoot(String serviceRoot) { - this.serviceRoot = serviceRoot; - } - - public String getResourcePath() { - return this.serviceRoot + "/" + this.resourceType + "/" + this.id; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public URI getResourceLocation() { - return this.resourceLocation; - } - - public void setResourceLocation(URI resourceLocation) { - this.resourceLocation = resourceLocation; - } - } - - public static String getCalendarDateInIsoTimeFormat(Calendar calendar) { - SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd'T'hh:mm:ss");//TODO Move out - format.setTimeZone(TimeZone.getTimeZone("GMT")); - return format.format(calendar.getTime()); - } - - public static URI appendHttpParameter(URI basePath, String httpParameterName, String httpParameterValue) { - Map parameters = new HashMap(); - parameters.put(httpParameterName, httpParameterValue); - return appendHttpParameters(basePath, parameters); - } - - public static URI appendHttpParameters(URI basePath, Map parameters) { - try { - Set httpParameterNames = parameters.keySet(); - String query = basePath.getQuery(); - - for(String httpParameterName : httpParameterNames) { - if(query != null) { - query += "&"; - } else { - query = ""; - } - query += httpParameterName + "=" + Utilities.encodeUri(parameters.get(httpParameterName)); - } - - return new URI(basePath.getScheme(), basePath.getUserInfo(), basePath.getHost(),basePath.getPort(), basePath.getPath(), query, basePath.getFragment()); - } catch(Exception e) { - throw new EFhirClientException("Error appending http parameter", e); - } - } - -} \ No newline at end of file +package org.hl7.fhir.r4.utils.client; + + +/* + 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.net.URI; +import java.net.URISyntaxException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.TimeZone; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.client.utils.URIBuilder; +import org.hl7.fhir.r4.model.Resource; +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.utilities.Utilities; + +//Make resources address subclass of URI +/** + * Helper class to manage FHIR Resource URIs + * + * @author Claude Nanjo + * + */ +public class ResourceAddress { + + public static final String REGEX_ID_WITH_HISTORY = "(.*)(/)([a-zA-Z0-9]*)(/)([a-z0-9\\-\\.]{1,64})(/_history/)([a-z0-9\\-\\.]{1,64})$"; + + private URI baseServiceUri; + + public ResourceAddress(String endpointPath) throws URISyntaxException {//TODO Revisit this exception + this.baseServiceUri = ResourceAddress.buildAbsoluteURI(endpointPath); + } + + public ResourceAddress(URI baseServiceUri) { + this.baseServiceUri = baseServiceUri; + } + + public URI getBaseServiceUri() { + return this.baseServiceUri; + } + + public URI resolveOperationURLFromClass(Class resourceClass, String name, String parameters) { + return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$"+name+"?"+ parameters); + } + + public URI resolveSearchUri(Class resourceClass, Map parameters) { + return appendHttpParameters(baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"_search"), parameters); + } + + private String nameForClassWithSlash(Class resourceClass) { + String n = nameForClass(resourceClass); + return n == null ? "" : n +"/"; + } + + public URI resolveOperationUri(Class resourceClass, String opName) { + return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"/"+opName); + } + + public URI resolveOperationUri(Class resourceClass, String opName, Map parameters) { + return appendHttpParameters(baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$"+opName), parameters); + } + + public URI resolveValidateUri(Class resourceClass, String id) { + return baseServiceUri.resolve(nameForClassWithSlash(resourceClass) +"$validate/"+id); + } + + public URI resolveGetUriFromResourceClass(Class resourceClass) { + return baseServiceUri.resolve(nameForClass(resourceClass)); + } + + public URI resolveGetUriFromResourceClassAndId(Class resourceClass, String id) { + return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id); + } + + public URI resolveGetUriFromResourceClassAndIdAndVersion(Class resourceClass, String id, String version) { + return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id+"/_history/"+version); + } + + public URI resolveGetHistoryForAllResources(int count) { + if(count > 0) { + return appendHttpParameter(baseServiceUri.resolve("_history"), "_count", ""+count); + } else { + return baseServiceUri.resolve("_history"); + } +} + + public URI resolveGetHistoryForResourceId(Class resourceClass, String id, int count) { + return resolveGetHistoryUriForResourceId(resourceClass, id, null, count); + } + + protected URI resolveGetHistoryUriForResourceId(Class resourceClass, String id, Object since, int count) { + Map parameters = getHistoryParameters(since, count); + return appendHttpParameters(baseServiceUri.resolve(nameForClass(resourceClass) + "/" + id + "/_history"), parameters); + } + + public URI resolveGetHistoryForResourceType(Class resourceClass, int count) { + Map parameters = getHistoryParameters(null, count); + return appendHttpParameters(baseServiceUri.resolve(nameForClass(resourceClass) + "/_history"), parameters); + } + + public URI resolveGetHistoryForResourceType(Class resourceClass, Object since, int count) { + Map parameters = getHistoryParameters(since, count); + return appendHttpParameters(baseServiceUri.resolve(nameForClass(resourceClass) + "/_history"), parameters); + } + + public URI resolveGetHistoryForAllResources(Calendar since, int count) { + Map parameters = getHistoryParameters(since, count); + return appendHttpParameters(baseServiceUri.resolve("_history"), parameters); + } + + public URI resolveGetHistoryForAllResources(Date since, int count) { + Map parameters = getHistoryParameters(since, count); + return appendHttpParameters(baseServiceUri.resolve("_history"), parameters); + } + + public Map getHistoryParameters(Object since, int count) { + Map parameters = new HashMap(); + if (since != null) { + parameters.put("_since", since.toString()); + } + if(count > 0) { + parameters.put("_count", ""+count); + } + return parameters; + } + + public URI resolveGetHistoryForResourceId(Class resourceClass, String id, Calendar since, int count) { + return resolveGetHistoryUriForResourceId(resourceClass, id, since, count); + } + + public URI resolveGetHistoryForResourceId(Class resourceClass, String id, Date since, int count) { + return resolveGetHistoryUriForResourceId(resourceClass, id, since, count); + } + + public URI resolveGetHistoryForResourceType(Class resourceClass, Calendar since, int count) { + return resolveGetHistoryForResourceType(resourceClass, getCalendarDateInIsoTimeFormat(since), count); + } + + public URI resolveGetHistoryForResourceType(Class resourceClass, Date since, int count) { + return resolveGetHistoryForResourceType(resourceClass, since.toString(), count); + } + + public URI resolveGetAllTags() { + return baseServiceUri.resolve("_tags"); + } + + public URI resolveGetAllTagsForResourceType(Class resourceClass) { + return baseServiceUri.resolve(nameForClass(resourceClass) + "/_tags"); + } + + public URI resolveGetTagsForReference(Class resourceClass, String id) { + return baseServiceUri.resolve(nameForClass(resourceClass) + "/" + id + "/_tags"); + } + + public URI resolveGetTagsForResourceVersion(Class resourceClass, String id, String version) { + return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id+"/_history/"+version + "/_tags"); + } + + public URI resolveDeleteTagsForResourceVersion(Class resourceClass, String id, String version) { + return baseServiceUri.resolve(nameForClass(resourceClass) +"/"+id+"/_history/"+version + "/_tags/_delete"); + } + + + public String nameForClass(Class resourceClass) { + if (resourceClass == null) + return null; + String res = resourceClass.getSimpleName(); + if (res.equals("List_")) + return "List"; + else + return res; + } + + public URI resolveMetadataUri(boolean quick) { + return baseServiceUri.resolve(quick ? "metadata?_summary=true" : "metadata"); + } + + /** + * For now, assume this type of location header structure. + * Generalize later: http://hl7connect.healthintersections.com.au/svc/fhir/318/_history/1 + * + * @param serviceBase + * @param locationHeader + */ + public static ResourceAddress.ResourceVersionedIdentifier parseCreateLocation(String locationResponseHeader) { + Pattern pattern = Pattern.compile(REGEX_ID_WITH_HISTORY); + Matcher matcher = pattern.matcher(locationResponseHeader); + ResourceVersionedIdentifier parsedHeader = null; + if(matcher.matches()){ + String serviceRoot = matcher.group(1); + String resourceType = matcher.group(3); + String id = matcher.group(5); + String version = matcher.group(7); + parsedHeader = new ResourceVersionedIdentifier(serviceRoot, resourceType, id, version); + } + return parsedHeader; + } + + public static URI buildAbsoluteURI(String absoluteURI) { + + if(StringUtils.isBlank(absoluteURI)) { + throw new EFhirClientException("Invalid URI", new URISyntaxException(absoluteURI, "URI/URL cannot be blank")); + } + + String endpoint = appendForwardSlashToPath(absoluteURI); + + return buildEndpointUriFromString(endpoint); + } + + public static String appendForwardSlashToPath(String path) { + if(path.lastIndexOf('/') != path.length() - 1) { + path += "/"; + } + return path; + } + + public static URI buildEndpointUriFromString(String endpointPath) { + URI uri = null; + try { + URIBuilder uriBuilder = new URIBuilder(endpointPath); + uri = uriBuilder.build(); + String scheme = uri.getScheme(); + String host = uri.getHost(); + if(!scheme.equalsIgnoreCase("http") && !scheme.equalsIgnoreCase("https")) { + throw new EFhirClientException("Scheme must be 'http' or 'https': " + uri); + } + if(StringUtils.isBlank(host)) { + throw new EFhirClientException("host cannot be blank: " + uri); + } + } catch(URISyntaxException e) { + throw new EFhirClientException("Invalid URI", e); + } + return uri; + } + + public static URI appendQueryStringToUri(URI uri, String parameterName, String parameterValue) { + URI modifiedUri = null; + try { + URIBuilder uriBuilder = new URIBuilder(uri); + uriBuilder.setQuery(parameterName + "=" + parameterValue); + modifiedUri = uriBuilder.build(); + } catch(Exception e) { + throw new EFhirClientException("Unable to append query parameter '" + parameterName + "=" + parameterValue + " to URI " + uri, e); + } + return modifiedUri; + } + + public static String buildRelativePathFromResourceType(ResourceType resourceType) { + //return resourceType.toString().toLowerCase()+"/"; + return resourceType.toString() + "/"; + } + + public static String buildRelativePathFromResourceType(ResourceType resourceType, String id) { + return buildRelativePathFromResourceType(resourceType)+ "@" + id; + } + + public static String buildRelativePathFromReference(Resource resource) { + return buildRelativePathFromResourceType(resource.getResourceType()); + } + + public static String buildRelativePathFromReference(Resource resource, String id) { + return buildRelativePathFromResourceType(resource.getResourceType(), id); + } + + public static class ResourceVersionedIdentifier { + + private String serviceRoot; + private String resourceType; + private String id; + private String version; + private URI resourceLocation; + + public ResourceVersionedIdentifier(String serviceRoot, String resourceType, String id, String version, URI resourceLocation) { + this.serviceRoot = serviceRoot; + this.resourceType = resourceType; + this.id = id; + this.version = version; + this.resourceLocation = resourceLocation; + } + + public ResourceVersionedIdentifier(String resourceType, String id, String version, URI resourceLocation) { + this(null, resourceType, id, version, resourceLocation); + } + + public ResourceVersionedIdentifier(String serviceRoot, String resourceType, String id, String version) { + this(serviceRoot, resourceType, id, version, null); + } + + public ResourceVersionedIdentifier(String resourceType, String id, String version) { + this(null, resourceType, id, version, null); + } + + public ResourceVersionedIdentifier(String resourceType, String id) { + this.id = id; + } + + public String getId() { + return this.id; + } + + protected void setId(String id) { + this.id = id; + } + + public String getVersionId() { + return this.version; + } + + protected void setVersionId(String version) { + this.version = version; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public String getServiceRoot() { + return serviceRoot; + } + + public void setServiceRoot(String serviceRoot) { + this.serviceRoot = serviceRoot; + } + + public String getResourcePath() { + return this.serviceRoot + "/" + this.resourceType + "/" + this.id; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public URI getResourceLocation() { + return this.resourceLocation; + } + + public void setResourceLocation(URI resourceLocation) { + this.resourceLocation = resourceLocation; + } + } + + public static String getCalendarDateInIsoTimeFormat(Calendar calendar) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");//TODO Move out + format.setTimeZone(TimeZone.getTimeZone("GMT")); + return format.format(calendar.getTime()); + } + + public static URI appendHttpParameter(URI basePath, String httpParameterName, String httpParameterValue) { + Map parameters = new HashMap(); + parameters.put(httpParameterName, httpParameterValue); + return appendHttpParameters(basePath, parameters); + } + + public static URI appendHttpParameters(URI basePath, Map parameters) { + try { + Set httpParameterNames = parameters.keySet(); + String query = basePath.getQuery(); + + for(String httpParameterName : httpParameterNames) { + if(query != null) { + query += "&"; + } else { + query = ""; + } + query += httpParameterName + "=" + Utilities.encodeUri(parameters.get(httpParameterName)); + } + + return new URI(basePath.getScheme(), basePath.getUserInfo(), basePath.getHost(),basePath.getPort(), basePath.getPath(), query, basePath.getFragment()); + } catch(Exception e) { + throw new EFhirClientException("Error appending http parameter", e); + } + } + +} diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/formats/JsonTrackingParser.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/formats/JsonTrackingParser.java index 0ea6a5a8e06..5b0ea3e79fb 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/formats/JsonTrackingParser.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/utils/formats/JsonTrackingParser.java @@ -364,6 +364,9 @@ public class JsonTrackingParser { break; case Eof : throw lexer.error("Unexpected End of File"); + case End: + // TODO GG: This isn't handled. Should it be? + break; } next(); } @@ -405,6 +408,10 @@ public class JsonTrackingParser { break; case Eof : throw lexer.error("Unexpected End of File"); + case End: + case Boolean: + // TODO GG: These aren't handled. SHould they be? + break; } next(); } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu1Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationR4Test.java similarity index 76% rename from hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu1Test.java rename to hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationR4Test.java index 850f90b70cc..e0d0561932d 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu1Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationR4Test.java @@ -1,13 +1,21 @@ package ca.uhn.fhir.rest.client; import static org.hamcrest.Matchers.containsString; -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import java.io.InputStream; import java.io.StringReader; import java.nio.charset.Charset; +import ca.uhn.fhir.context.FhirVersionEnum; import org.apache.commons.io.input.ReaderInputStream; import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; @@ -32,7 +40,7 @@ import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; import ca.uhn.fhir.rest.client.exceptions.FhirClientInappropriateForServerException; import ca.uhn.fhir.util.TestUtil; -public class ClientServerValidationDstu1Test { +public class ClientServerValidationR4Test { private FhirContext myCtx; private HttpClient myHttpClient; @@ -50,15 +58,17 @@ public class ClientServerValidationDstu1Test { } @Test - public void testServerReturnsAppropriateVersionDstu() throws Exception { + public void testServerReturnsAppropriateVersionR4() throws Exception { + String appropriateFhirVersion = "3.1.0"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.R4.getFhirVersionString())); CapabilityStatement conf = new CapabilityStatement(); - conf.setFhirVersion("0.0.8"); + conf.setFhirVersion(appropriateFhirVersion); final String confResource = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8")); when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { @Override public InputStream answer(InvocationOnMock theInvocation) throws Throwable { @@ -87,16 +97,17 @@ public class ClientServerValidationDstu1Test { } @Test - @Ignore - public void testServerReturnsWrongVersionDstu() throws Exception { + public void testServerReturnsWrongVersionR4() throws Exception { + String wrongFhirVersion = "3.0.1"; + assertThat(wrongFhirVersion, is(FhirVersionEnum.DSTU3.getFhirVersionString())); // asserting that what we assume to be the DSTU3 FHIR version is still correct CapabilityStatement conf = new CapabilityStatement(); - conf.setFhirVersion("0.4.0"); + conf.setFhirVersion(wrongFhirVersion); String msg = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8")); when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); @@ -106,20 +117,22 @@ public class ClientServerValidationDstu1Test { myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/1")); fail(); } catch (FhirClientInappropriateForServerException e) { - assertThat(e.toString(), containsString("The server at base URL \"http://foo/metadata\" returned a conformance statement indicating that it supports FHIR version \"0.4.0\" which corresponds to DSTU2, but this client is configured to use R4 (via the FhirContext)")); + assertThat(e.toString(), containsString("The server at base URL \"http://foo/metadata\" returned a conformance statement indicating that it supports FHIR version \"3.0.1\" which corresponds to DSTU3, but this client is configured to use R4 (via the FhirContext)")); } } @Test - public void testServerReturnsRightVersionDstu() throws Exception { + public void testServerReturnsRightVersionR4() throws Exception { + String appropriateFhirVersion = "3.1.0"; + assertThat(appropriateFhirVersion, is(FhirVersionEnum.R4.getFhirVersionString())); CapabilityStatement conf = new CapabilityStatement(); - conf.setFhirVersion("3.1.0"); + conf.setFhirVersion(appropriateFhirVersion); String msg = myCtx.newXmlParser().encodeResourceToString(conf); ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8")); when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java index 5c13093d826..34579616a06 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java @@ -1,1626 +1,1701 @@ -package ca.uhn.fhir.rest.client; - -import static org.hamcrest.Matchers.containsString; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.*; -import java.net.URLEncoder; -import java.nio.charset.Charset; -import java.util.*; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.io.input.ReaderInputStream; -import org.apache.commons.lang3.StringUtils; -import org.apache.http.*; -import org.apache.http.client.HttpClient; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.*; -import org.apache.http.message.BasicHeader; -import org.apache.http.message.BasicStatusLine; -import org.hamcrest.Matchers; -import org.hamcrest.core.StringContains; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r4.model.*; -import org.hl7.fhir.r4.model.Bundle.BundleType; -import org.hl7.fhir.r4.model.Bundle.HTTPVerb; -import org.junit.*; -import org.mockito.ArgumentCaptor; -import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.api.*; -import ca.uhn.fhir.model.primitive.InstantDt; -import ca.uhn.fhir.model.primitive.UriDt; -import ca.uhn.fhir.rest.api.*; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.client.api.IGenericClient; -import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; -import ca.uhn.fhir.rest.client.exceptions.NonFhirResponseException; -import ca.uhn.fhir.rest.client.impl.BaseClient; -import ca.uhn.fhir.rest.client.impl.GenericClient; -import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; -import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import ca.uhn.fhir.util.*; - -public class GenericClientTest { - - private static FhirContext ourCtx; - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GenericClientTest.class); - private HttpClient myHttpClient; - - private HttpResponse myHttpResponse; - - @Before - public void before() { - - myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs()); - ourCtx.getRestfulClientFactory().setHttpClient(myHttpClient); - ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); - - myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); - - System.setProperty(BaseClient.HAPI_CLIENT_KEEPRESPONSES, "true"); - } - - private String extractBody(ArgumentCaptor capt, int count) throws IOException { - String body = IOUtils.toString(((HttpEntityEnclosingRequestBase) capt.getAllValues().get(count)).getEntity().getContent(), "UTF-8"); - return body; - } - - @Test - @Ignore - public void testInvalidCalls() { - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - try { - client.meta(); - fail(); - } catch (IllegalStateException e) { - assertEquals("Can not call $meta operations on a DSTU1 client", e.getMessage()); - } - try { - client.operation(); - fail(); - } catch (IllegalStateException e) { - assertEquals("Operations are only supported in FHIR DSTU2 and later. This client was created using a context configured for DSTU1", e.getMessage()); - } - } - - private String getPatientFeedWithOneResult() { - return ClientR4Test.getPatientFeedWithOneResult(ourCtx); -// //@formatter:off -// String msg = "\n" + -// "\n" + -// "<id>d039f91a-cc3c-4013-988e-af4d8d0614bd</id>\n" + -// "<os:totalResults xmlns:os=\"http://a9.com/-/spec/opensearch/1.1/\">1</os:totalResults>\n" + -// "<author>\n" + -// "<name>ca.uhn.fhir.rest.server.DummyRestfulServer</name>\n" + -// "</author>\n" + -// "<entry>\n" + -// "<content type=\"text/xml\">" -// + "<Patient xmlns=\"http://hl7.org/fhir\">" -// + "<text><status value=\"generated\" /><div xmlns=\"http://www.w3.org/1999/xhtml\">John Cardinal: 444333333 </div></text>" -// + "<identifier><label value=\"SSN\" /><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>" -// + "<name><use value=\"official\" /><family value=\"Cardinal\" /><given value=\"John\" /></name>" -// + "<name><family value=\"Kramer\" /><given value=\"Doe\" /></name>" -// + "<telecom><system value=\"phone\" /><value value=\"555-555-2004\" /><use value=\"work\" /></telecom>" -// + "<gender><coding><system value=\"http://hl7.org/fhir/v3/AdministrativeGender\" /><code value=\"M\" /></coding></gender>" -// + "<address><use value=\"home\" /><line value=\"2222 Home Street\" /></address><active value=\"true\" />" -// + "</Patient>" -// + "</content>\n" -// + " </entry>\n" -// + "</feed>"; -// //@formatter:on - // return msg; - } - - private String getResourceResult() { - //@formatter:off - String msg = - "<Patient xmlns=\"http://hl7.org/fhir\">" - + "<text><status value=\"generated\" /><div xmlns=\"http://www.w3.org/1999/xhtml\">John Cardinal: 444333333 </div></text>" - + "<identifier><label value=\"SSN\" /><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>" - + "<name><use value=\"official\" /><family value=\"Cardinal\" /><given value=\"John\" /></name>" - + "<name><family value=\"Kramer\" /><given value=\"Doe\" /></name>" - + "<telecom><system value=\"phone\" /><value value=\"555-555-2004\" /><use value=\"work\" /></telecom>" - + "<gender><coding><system value=\"http://hl7.org/fhir/v3/AdministrativeGender\" /><code value=\"M\" /></coding></gender>" - + "<address><use value=\"home\" /><line value=\"2222 Home Street\" /></address><active value=\"true\" />" - + "</Patient>"; - //@formatter:on - return msg; - } - - @Test - public void testCreatePopulatesIsCreated() throws Exception { - - Patient p1 = createPatientP1(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); - MethodOutcome resp = client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).execute(); - assertTrue(resp.getCreated()); - - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - resp = client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).execute(); - assertNull(resp.getCreated()); - - ourLog.info("lastRequest: {}", ((GenericClient) client).getLastRequest()); - ourLog.info("lastResponse: {}", ((GenericClient) client).getLastResponse()); - ourLog.info("lastResponseBody: {}", ((GenericClient) client).getLastResponseBody()); - } - - private Patient createPatientP1() { - Patient p1 = new Patient(); - p1.addIdentifier().setSystem("foo:bar").setValue("12345"); - p1.addName().setFamily("Smith").addGiven("John"); - return p1; - } - - @Test - public void testCreateWithStringAutoDetectsEncoding() throws Exception { - - Patient p1 = createPatientP1(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - int count = 0; - client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).execute(); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - assertThat(extractBody(capt, count), containsString("value=\"John\"")); - count++; - - String resourceAsString = ourCtx.newJsonParser().encodeResourceToString(p1); - client - .create() - .resource(resourceAsString) - .execute(); - - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.JSON.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - assertThat(extractBody(capt, count), containsString("[\"John\"]")); - count++; - - /* - * e.g. Now try with reversed encoding (provide a string that's in JSON and ask the client to use XML) - */ - - client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).encodedJson().execute(); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.JSON.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - assertThat(extractBody(capt, count), containsString("[\"John\"]")); - count++; - - client.create().resource(ourCtx.newJsonParser().encodeResourceToString(p1)).encodedXml().execute(); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - assertThat(extractBody(capt, count), containsString("value=\"John\"")); - count++; - - } - - @Test - public void testCreateWithTag() throws Exception { - - Patient p1 = createPatientP1(); - p1.getMeta().addTag("http://hl7.org/fhir/tag", "urn:happytag", "This is a happy resource"); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - MethodOutcome outcome = client.create().resource(p1).execute(); - assertEquals("44", outcome.getId().getIdPart()); - assertEquals("22", outcome.getId().getVersionIdPart()); - - int count = 0; - - assertEquals("http://example.com/fhir/Patient", capt.getValue().getURI().toString()); - assertEquals("POST", capt.getValue().getMethod()); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - count++; - - /* - * Try fluent options - */ - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - client.create().resource(p1).execute(); - assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(1).getURI().toString()); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - count++; - - String resourceText = "<Patient xmlns=\"http://hl7.org/fhir\"> </Patient>"; - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - client.create().resource(resourceText).execute(); - assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(2).getURI().toString()); - assertEquals(resourceText, IOUtils.toString(((HttpPost) capt.getAllValues().get(2)).getEntity().getContent())); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - count++; - } - - @Test - public void testCreateWithTagNonFluent() throws Exception { - - Patient p1 = createPatientP1(); - p1.getMeta().addTag("http://hl7.org/fhir/tag", "urn:happytag", "This is a happy resource"); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - MethodOutcome outcome = client.create().resource(p1).execute(); - assertEquals("44", outcome.getId().getIdPart()); - assertEquals("22", outcome.getId().getVersionIdPart()); - - assertEquals("http://example.com/fhir/Patient", capt.getValue().getURI().toString()); - assertEquals("POST", capt.getValue().getMethod()); - Header catH = capt.getValue().getFirstHeader("Category"); - assertNull(catH); - } - - /** - * Test for issue #60 - */ - @Test - public void testCreateWithUtf8Characters() throws Exception { - String name = "測試醫院"; - Organization org = new Organization(); - org.setName(name); - org.addIdentifier().setSystem("urn:system").setValue("testCreateWithUtf8Characters_01"); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - int count = 0; - client.create().resource(org).prettyPrint().encodedXml().execute(); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - assertThat(extractBody(capt, count), containsString("<name value=\"測試醫院\"/>")); - count++; - - } - - @Test - public void testDelete() throws Exception { - OperationOutcome oo = new OperationOutcome(); - oo.addIssue().addLocation("testDelete01"); - String ooStr = ourCtx.newXmlParser().encodeResourceToString(oo); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(ooStr), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - OperationOutcome outcome = (OperationOutcome) client.delete().resourceById("Patient", "123").execute(); - - assertEquals("http://example.com/fhir/Patient/123", capt.getValue().getURI().toString()); - assertEquals("DELETE", capt.getValue().getMethod()); - assertEquals("testDelete01", outcome.getIssueFirstRep().getLocation().get(0).getValue()); - - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader("LKJHLKJGLKJKLL"), Charset.forName("UTF-8"))); - outcome = (OperationOutcome) client.delete().resourceById(new IdType("Location", "123", "456")).prettyPrint().encodedJson().execute(); - - assertEquals("http://example.com/fhir/Location/123?_pretty=true", capt.getAllValues().get(1).getURI().toString()); - assertEquals("DELETE", capt.getValue().getMethod()); - assertEquals(null, outcome); - - } - - @Test - public void testHistory() throws Exception { - - final String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { - @Override - public InputStream answer(InvocationOnMock theInvocation) throws Throwable { - return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); - } - }); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - int idx = 0; - Bundle response; - - response = client - .history() - .onServer() - .andReturnBundle(Bundle.class) - .execute(); - assertEquals("http://example.com/fhir/_history", capt.getAllValues().get(idx).getURI().toString()); - assertEquals(1, response.getEntry().size()); - idx++; - - response = client - .history() - .onType(Patient.class) - .andReturnBundle(Bundle.class) - .execute(); - assertEquals("http://example.com/fhir/Patient/_history", capt.getAllValues().get(idx).getURI().toString()); - assertEquals(1, response.getEntry().size()); - idx++; - - response = client - .history() - .onInstance(new IdType("Patient", "123")) - .andReturnBundle(Bundle.class) - .execute(); - assertEquals("http://example.com/fhir/Patient/123/_history", capt.getAllValues().get(idx).getURI().toString()); - assertEquals(1, response.getEntry().size()); - idx++; - } - - @Test - public void testMissing() throws Exception { - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { - @Override - public InputStream answer(InvocationOnMock theInvocation) throws Throwable { - return (new ReaderInputStream(new StringReader(getPatientFeedWithOneResult()), Charset.forName("UTF-8"))); - } - }); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); - - client.search().forResource("Patient").where(Patient.NAME.isMissing(true)).returnBundle(Bundle.class).execute(); - assertEquals("http://example.com/fhir/Patient?name%3Amissing=true", capt.getValue().getRequestLine().getUri()); - - client.search().forResource("Patient").where(Patient.NAME.isMissing(false)).returnBundle(Bundle.class).execute(); - assertEquals("http://example.com/fhir/Patient?name%3Amissing=false", capt.getValue().getRequestLine().getUri()); - } - - @Test - public void testRead() throws Exception { - - String msg = getResourceResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - Header[] headers = new Header[] { - new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT"), - new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), - }; - when(myHttpResponse.getAllHeaders()).thenReturn(headers); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Patient response = client - .read() - .resource(Patient.class) - .withId(new IdType("Patient/1234")) - .execute(); - - assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); - - assertEquals("http://foo.com/Patient/123/_history/2333", response.getIdElement().getValue()); - - InstantType lm = response.getMeta().getLastUpdatedElement(); - lm.setTimeZoneZulu(true); - assertEquals("1995-11-15T04:58:08.000Z", lm.getValueAsString()); - - } - - @Test - public void testReadFluent() throws Exception { - - String msg = getResourceResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - Header[] headers = new Header[] { - new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT"), - new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), - }; - when(myHttpResponse.getAllHeaders()).thenReturn(headers); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - int count = 0; - - Patient response = client.read().resource(Patient.class).withId(new IdType("Patient/1234")).execute(); - assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); - assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count++).getURI().toString()); - - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - response = (Patient) client.read().resource("Patient").withId("1234").execute(); - assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); - assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count++).getURI().toString()); - - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - response = (Patient) client.read().resource("Patient").withId(567L).execute(); - assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); - assertEquals("http://example.com/fhir/Patient/567", capt.getAllValues().get(count++).getURI().toString()); - - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - response = client.read().resource(Patient.class).withIdAndVersion("1234", "22").execute(); - assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); - assertEquals("http://example.com/fhir/Patient/1234/_history/22", capt.getAllValues().get(count++).getURI().toString()); - - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - response = client.read().resource(Patient.class).withUrl("http://foo/Patient/22").execute(); - assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); - assertEquals("http://foo/Patient/22", capt.getAllValues().get(count++).getURI().toString()); - - } - - @Test - public void testReadWithAbsoluteUrl() throws Exception { - - String msg = getResourceResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - Header[] headers = new Header[] { new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT"), - new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), - }; - when(myHttpResponse.getAllHeaders()).thenReturn(headers); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Patient response = client - .read() - .resource(Patient.class) - .withUrl(new IdType("http://somebase.com/path/to/base/Patient/1234")) - .execute(); - assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); - assertEquals("http://somebase.com/path/to/base/Patient/1234", capt.getAllValues().get(0).getURI().toString()); - - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - response = client - .read() - .resource(Patient.class) - .withUrl(new IdType("http://somebase.com/path/to/base/Patient/1234/_history/222")) - .execute(); - assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); - assertEquals("http://somebase.com/path/to/base/Patient/1234/_history/222", capt.getAllValues().get(1).getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchAllResources() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forAllResources() - .where(Patient.NAME.matches().value("james")) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/?name=james", capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchAutomaticallyUsesPost() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - String longValue = StringUtils.leftPad("", 20000, 'B'); - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.NAME.matches().value(longValue)) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient/_search", capt.getValue().getURI().toString()); - - HttpEntityEnclosingRequestBase enc = (HttpEntityEnclosingRequestBase) capt.getValue(); - UrlEncodedFormEntity ent = (UrlEncodedFormEntity) enc.getEntity(); - String string = IOUtils.toString(ent.getContent()); - ourLog.info(string); - assertEquals("name=" + longValue, string); - } - - @Test - public void testLoadPageAndReturnDstu1Bundle() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); - client - .loadPage() - .byUrl("http://example.com/page1") - .andReturnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/page1", capt.getValue().getURI().toString()); - } - - @Test - public void testSearchByCompartment() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); - Bundle response = client - .search() - .forResource(Patient.class) - .withIdAndCompartment("123", "fooCompartment") - .where(Patient.BIRTHDATE.afterOrEquals().day("2011-01-02")) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://foo/Patient/123/fooCompartment?birthdate=ge2011-01-02", capt.getValue().getURI().toString()); - - ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(response)); - - assertEquals("PRP1660", BundleUtil.toListOfResourcesOfType(ourCtx, response, Patient.class).get(0).getIdentifier().get(0).getValue()); - - try { - client - .search() - .forResource(Patient.class) - .withIdAndCompartment("", "fooCompartment") - .where(Patient.BIRTHDATE.afterOrEquals().day("2011-01-02")) - .returnBundle(Bundle.class) - .execute(); - fail(); - } catch (InvalidRequestException e) { - assertThat(e.toString(), containsString("null or empty for compartment")); - } - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByComposite() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); - - Bundle response = client.search() - .forResource("Observation") - .where(Observation.CODE_VALUE_DATE - .withLeft(Observation.CODE.exactly().code("FOO$BAR")) - .withRight(Observation.VALUE_DATE.exactly().day("2001-01-01"))) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://foo/Observation?" + Observation.SP_CODE_VALUE_DATE + "=" + URLEncoder.encode("FOO\\$BAR$2001-01-01", "UTF-8"), capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByDate() throws Exception { - - final String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { - @Override - public InputStream answer(InvocationOnMock theInvocation) throws Throwable { - return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); - } - }); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - int idx = 0; - - @SuppressWarnings("deprecation") - Bundle response = client.search() - .forResource(Patient.class) - .encodedJson() - .where(Patient.BIRTHDATE.beforeOrEquals().day("2012-01-22")) - .and(Patient.BIRTHDATE.after().day("2011-01-01")) - .include(Patient.INCLUDE_ORGANIZATION) - .sort().ascending(Patient.BIRTHDATE) - .sort().descending(Patient.NAME) - .sort().defaultOrder(Patient.ADDRESS) - .count(123) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?birthdate=le2012-01-22&birthdate=gt2011-01-01&_include=Patient%3Aorganization&_sort=birthdate%2C-name%2Caddress&_count=123&_format=json", - capt.getAllValues().get(idx++).getURI().toString()); - - response = client.search() - .forResource(Patient.class) - .encodedJson() - .where(Patient.BIRTHDATE.beforeOrEquals().day("2012-01-22")) - .and(Patient.BIRTHDATE.after().day("2011-01-01")) - .include(Patient.INCLUDE_ORGANIZATION) - .sort().ascending(Patient.BIRTHDATE) - .sort().descending(Patient.NAME) - .sort().defaultOrder(Patient.ADDRESS) - .count(123) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?birthdate=le2012-01-22&birthdate=gt2011-01-01&_include=Patient%3Aorganization&_sort=birthdate%2C-name%2Caddress&_count=123&_format=json", - capt.getAllValues().get(idx++).getURI().toString()); - - response = client.search() - .forResource(Patient.class) - .encodedJson() - .where(Patient.BIRTHDATE.beforeOrEquals().day("2012-01-22").orAfter().day("2020-01-01")) - .and(Patient.BIRTHDATE.after().day("2011-01-01")) - .returnBundle(Bundle.class) - .execute(); - - String comma = "%2C"; - assertEquals("http://example.com/fhir/Patient?birthdate=le2012-01-22" + comma + "gt2020-01-01&birthdate=gt2011-01-01&_format=json", capt.getAllValues().get(idx++).getURI().toString()); - } - - @SuppressWarnings("unused") - @Test - public void testSearchByNumberExact() throws Exception { - - String msg = ourCtx.newXmlParser().encodeResourceToString(new Bundle()); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource(Observation.class) - .where(Observation.VALUE_QUANTITY.greaterThan().number(123).andUnits("foo", "bar")) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Observation?value-quantity=gt123%7Cfoo%7Cbar", capt.getValue().getURI().toString()); - } - - @SuppressWarnings("unused") - @Test - public void testSearchByProfile() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource(Patient.class) - .withProfile("http://1") - .withProfile("http://2") - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?_profile=http%3A%2F%2F1&_profile=http%3A%2F%2F2", capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByQuantity() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource(Patient.class) - .where(Encounter.LENGTH.exactly().number(123)) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?length=123", capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByReferenceProperty() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource(Patient.class) - .where(Patient.GENERAL_PRACTITIONER.hasChainedProperty(Organization.NAME.matches().value("ORG0"))) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?general-practitioner.name=ORG0", capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByReferenceSimple() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.GENERAL_PRACTITIONER.hasId("123")) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?general-practitioner=123", capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchBySecurity() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource(Patient.class) - .withSecurity("urn:foo", "123") - .withSecurity("urn:bar", "456") - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?_security=urn%3Afoo%7C123&_security=urn%3Abar%7C456", capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByString() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.NAME.matches().value("james")) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?name=james", capt.getValue().getURI().toString()); - - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - response = client.search() - .forResource("Patient") - .where(Patient.NAME.matches().values("AAA", "BBB", "C,C")) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?name=" + URLEncoder.encode("AAA,BBB,C\\,C", "UTF-8"), capt.getAllValues().get(1).getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByStringExact() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.NAME.matchesExactly().value("james")) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?name%3Aexact=james", capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByTag() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource(Patient.class) - .withTag("urn:foo", "123") - .withTag("urn:bar", "456") - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?_tag=urn%3Afoo%7C123&_tag=urn%3Abar%7C456", capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByToken() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.IDENTIFIER.exactly().systemAndCode("http://example.com/fhir", "ZZZ")) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?identifier=http%3A%2F%2Fexample.com%2Ffhir%7CZZZ", capt.getValue().getURI().toString()); - - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - response = client.search() - .forResource("Patient") - .where(Patient.IDENTIFIER.exactly().code("ZZZ")) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?identifier=ZZZ", capt.getAllValues().get(1).getURI().toString()); - - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - response = client.search() - .forResource("Patient") - .where(Patient.IDENTIFIER.exactly().codings(new Coding("A", "B", "ZZZ"), new Coding("C", "D", "ZZZ"))) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?identifier=" + URLEncoder.encode("A|B,C|D", "UTF-8"), capt.getAllValues().get(2).getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchByTokenWithSystemAndNoCode() throws Exception { - - final String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { - @Override - public InputStream answer(InvocationOnMock theInvocation) throws Throwable { - return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); - } - }); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - int idx = 0; - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.IDENTIFIER.hasSystemWithAnyCode("urn:foo")) - .returnBundle(Bundle.class) - .execute(); - assertEquals("http://example.com/fhir/Patient?identifier=urn%3Afoo%7C", capt.getAllValues().get(idx++).getURI().toString()); - - response = client.search() - .forResource("Patient") - .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:foo", null)) - .returnBundle(Bundle.class) - .execute(); - assertEquals("http://example.com/fhir/Patient?identifier=urn%3Afoo%7C", capt.getAllValues().get(idx++).getURI().toString()); - - response = client.search() - .forResource("Patient") - .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:foo", "")) - .returnBundle(Bundle.class) - .execute(); - assertEquals("http://example.com/fhir/Patient?identifier=urn%3Afoo%7C", capt.getAllValues().get(idx++).getURI().toString()); - } - - /** - * Test for #192 - */ - @SuppressWarnings("unused") - @Test - public void testSearchByTokenWithEscaping() throws Exception { - final String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { - @Override - public InputStream answer(InvocationOnMock theInvocation) throws Throwable { - return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); - } - }); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); - int index = 0; - String wantPrefix = "http://foo/Patient?identifier="; - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.IDENTIFIER.exactly().systemAndCode("1", "2")) - .returnBundle(Bundle.class) - .execute(); - String wantValue = "1|2"; - String url = capt.getAllValues().get(index).getURI().toString(); - assertThat(url, Matchers.startsWith(wantPrefix)); - assertEquals(wantValue, UrlUtil.unescape(url.substring(wantPrefix.length()))); - assertEquals(UrlUtil.escape(wantValue), url.substring(wantPrefix.length())); - index++; - - response = client.search() - .forResource("Patient") - .where(Patient.IDENTIFIER.exactly().systemAndCode("1,2", "3,4")) - .returnBundle(Bundle.class) - .execute(); - wantValue = "1\\,2|3\\,4"; - url = capt.getAllValues().get(index).getURI().toString(); - assertThat(url, Matchers.startsWith(wantPrefix)); - assertEquals(wantValue, UrlUtil.unescape(url.substring(wantPrefix.length()))); - assertEquals(UrlUtil.escape(wantValue), url.substring(wantPrefix.length())); - index++; - } - - @SuppressWarnings("unused") - @Test - public void testSearchIncludeRecursive() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource(Patient.class) - .include(Patient.INCLUDE_ORGANIZATION) - .include(Patient.INCLUDE_LINK.asRecursive()) - .include(Patient.INCLUDE_ALL.asNonRecursive()) - .returnBundle(Bundle.class) - .execute(); - - assertThat(capt.getValue().getURI().toString(), containsString("http://example.com/fhir/Patient?")); - assertThat(capt.getValue().getURI().toString(), containsString("_include=" + UrlUtil.escape(Patient.INCLUDE_ORGANIZATION.getValue()))); - assertThat(capt.getValue().getURI().toString(), containsString("_include%3Arecurse=" + UrlUtil.escape(Patient.INCLUDE_LINK.getValue()))); - assertThat(capt.getValue().getURI().toString(), containsString("_include=*")); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchUsingGetSearch() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.NAME.matches().value("james")) - .usingStyle(SearchStyleEnum.GET_WITH_SEARCH) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient/_search?name=james", capt.getValue().getURI().toString()); - } - - @SuppressWarnings("unused") - @Test - public void testSearchUsingPost() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.NAME.matches().value("james")) - .usingStyle(SearchStyleEnum.POST) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient/_search", capt.getValue().getURI().toString()); - - HttpEntityEnclosingRequestBase enc = (HttpEntityEnclosingRequestBase) capt.getValue(); - UrlEncodedFormEntity ent = (UrlEncodedFormEntity) enc.getEntity(); - String string = IOUtils.toString(ent.getContent()); - ourLog.info(string); - assertEquals("name=james", string); - } - - @Test - public void testSearchWithAbsoluteUrl() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client - .search() - .byUrl("http://example.com/fhir/Patient?birthdate=le2012-01-22&birthdate=gt2011-01-01&_include=Patient%3Aorganization&_sort%3Aasc=birthdate&_sort%3Adesc=name&_count=123&_format=json") - .returnBundle(Bundle.class) - .execute(); - - assertEquals(1, response.getEntry().size()); - } - - @SuppressWarnings("unused") - @Test - public void testSearchWithClientEncodingAndPrettyPrintConfig() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - client.setPrettyPrint(true); - client.setEncoding(EncodingEnum.JSON); - - Bundle response = client.search() - .forResource(Patient.class) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?_format=json&_pretty=true", capt.getValue().getURI().toString()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchWithEscapedParameters() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource("Patient") - .where(Patient.NAME.matches().values("NE,NE", "NE,NE")) - .where(Patient.NAME.matchesExactly().values("E$E")) - .where(Patient.NAME.matches().values("NE\\NE")) - .where(Patient.NAME.matchesExactly().values("E|E")) - .returnBundle(Bundle.class) - .execute(); - - assertThat(capt.getValue().getURI().toString(), containsString("%3A")); - assertEquals("http://example.com/fhir/Patient?name=NE\\,NE,NE\\,NE&name=NE\\\\NE&name:exact=E\\$E&name:exact=E\\|E", UrlUtil.unescape(capt.getValue().getURI().toString())); - } - - @SuppressWarnings("unused") - @Test - public void testSearchWithInternalServerError() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 500, "INTERNAL ERRORS")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader("Server Issues!"), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - try { - client - .search() - .forResource(Patient.class) - .returnBundle(Bundle.class) - .execute(); - fail(); - } catch (InternalErrorException e) { - assertEquals(e.getMessage(), "HTTP 500 INTERNAL ERRORS: Server Issues!"); - assertEquals(e.getResponseBody(), "Server Issues!"); - } - - } - - @SuppressWarnings("unused") - @Test - public void testSearchWithNonFhirResponse() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader("Server Issues!"), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - try { - client.search().forResource(Patient.class).returnBundle(Bundle.class).execute(); - fail(); - } catch (NonFhirResponseException e) { - assertThat(e.getMessage(), StringContains.containsString("Server Issues!")); - } - - } - - @SuppressWarnings("unused") - @Test - public void testSearchWithReverseInclude() throws Exception { - - String msg = getPatientFeedWithOneResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.search() - .forResource(Patient.class) - .encodedJson() - .revInclude(Provenance.INCLUDE_TARGET) - .returnBundle(Bundle.class) - .execute(); - - assertEquals("http://example.com/fhir/Patient?_revinclude=Provenance%3Atarget&_format=json", capt.getValue().getURI().toString()); - - } - - @Test - public void testSetDefaultEncoding() throws Exception { - - String msg = ourCtx.newJsonParser().encodeResourceToString(new Patient()); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - // Header[] headers = new Header[] { new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 - // GMT"), - // new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), - // new BasicHeader(Constants.HEADER_CATEGORY, "http://foo/tagdefinition.html; scheme=\"http://hl7.org/fhir/tag\"; - // label=\"Some tag\"") }; - // when(myHttpResponse.getAllHeaders()).thenReturn(headers); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - (client).setEncoding(EncodingEnum.JSON); - int count = 0; - - client - .read() - .resource(Patient.class) - .withId(new IdType("Patient/1234")) - .execute(); - assertEquals("http://example.com/fhir/Patient/1234?_format=json", capt.getAllValues().get(count).getURI().toString()); - count++; - - } - - @Test - public void testTransaction() throws Exception { - Bundle input = createTransactionBundleInput(); - Bundle output = createTransactionBundleOutput(); - - String msg = ourCtx.newJsonParser().encodeResourceToString(output); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.transaction() - .withBundle(input) - .execute(); - - assertEquals("http://example.com/fhir", capt.getValue().getURI().toString()); - assertEquals(input.getEntry().get(0).getResource().getId(), response.getEntry().get(0).getResource().getId()); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(0).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - - } - - @Test - public void testTransactionXml() throws Exception { - Bundle input = createTransactionBundleInput(); - Bundle output = createTransactionBundleOutput(); - - String msg = ourCtx.newXmlParser().encodeResourceToString(output); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Bundle response = client.transaction() - .withBundle(input) - .execute(); - - assertEquals("http://example.com/fhir", capt.getValue().getURI().toString()); - assertEquals(input.getEntry().get(0).getResource().getId(), response.getEntry().get(0).getResource().getId()); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(0).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - - } - - private Bundle createTransactionBundleOutput() { - Bundle output = new Bundle(); - output.setType(BundleType.TRANSACTIONRESPONSE); - output - .addEntry() - .setResource(createPatientP1()) - .getResponse() - .setLocation(createPatientP1().getId()); - return output; - } - - private Bundle createTransactionBundleInput() { - Bundle input = new Bundle(); - input.setType(BundleType.TRANSACTION); - input - .addEntry() - .setResource(createPatientP1()) - .getRequest() - .setMethod(HTTPVerb.POST); - return input; - } - - @Test - public void testUpdate() throws Exception { - - Patient p1 = new Patient(); - p1.addIdentifier().setSystem("foo:bar").setValue("12345"); - p1.addName().setFamily("Smith").addGiven("John"); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - try { - client.update().resource(p1).execute(); - fail(); - } catch (InvalidRequestException e) { - // should happen because no ID set - } - - assertEquals(0, capt.getAllValues().size()); - - p1.setId("44"); - client.update().resource(p1).execute(); - - int count = 0; - - assertEquals(1, capt.getAllValues().size()); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - count++; - - MethodOutcome outcome = client.update().resource(p1).execute(); - assertEquals("44", outcome.getId().getIdPart()); - assertEquals("22", outcome.getId().getVersionIdPart()); - - assertEquals(2, capt.getAllValues().size()); - - assertEquals("http://example.com/fhir/Patient/44", capt.getValue().getURI().toString()); - assertEquals("PUT", capt.getValue().getMethod()); - - /* - * Try fluent options - */ - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - client.update().resource(p1).withId("123").execute(); - assertEquals(3, capt.getAllValues().size()); - assertEquals("http://example.com/fhir/Patient/123", capt.getAllValues().get(2).getURI().toString()); - - String resourceText = "<Patient xmlns=\"http://hl7.org/fhir\"> </Patient>"; - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - client.update().resource(resourceText).withId("123").execute(); - assertEquals("http://example.com/fhir/Patient/123", capt.getAllValues().get(3).getURI().toString()); - assertEquals(resourceText, IOUtils.toString(((HttpPut) capt.getAllValues().get(3)).getEntity().getContent())); - assertEquals(4, capt.getAllValues().size()); - - } - - @Test - public void testUpdateWithStringAutoDetectsEncoding() throws Exception { - - Patient p1 = new Patient(); - p1.addIdentifier().setSystem("foo:bar").setValue("12345"); - p1.addName().setFamily("Smith").addGiven("John"); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - int count = 0; - client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).withId("1").execute(); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - assertThat(extractBody(capt, count), containsString("value=\"John\"")); - count++; - - client.update().resource(ourCtx.newJsonParser().encodeResourceToString(p1)).withId("1").execute(); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.JSON.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - assertThat(extractBody(capt, count), containsString("[\"John\"]")); - count++; - - /* - * e.g. Now try with reversed encoding (provide a string that's in JSON and ask the client to use XML) - */ - - client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).withId("1").encodedJson().execute(); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.JSON.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - assertThat(extractBody(capt, count), containsString("[\"John\"]")); - count++; - - client.update().resource(ourCtx.newJsonParser().encodeResourceToString(p1)).withId("1").encodedXml().execute(); - assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); - assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); - assertThat(extractBody(capt, count), containsString("value=\"John\"")); - count++; - } - - @Test - public void testValidateNonFluent() throws Exception { - - OperationOutcome oo = new OperationOutcome(); - oo.addIssue().setDiagnostics("OOOK"); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] {}); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(ourCtx.newXmlParser().encodeResourceToString(oo)), Charset.forName("UTF-8"))); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Patient p1 = new Patient(); - p1.addIdentifier().setSystem("foo:bar").setValue("12345"); - p1.addName().setFamily("Smith").addGiven("John"); - - MethodOutcome resp = client.validate(p1); - assertEquals("http://example.com/fhir/Patient/$validate", capt.getValue().getURI().toString()); - oo = (OperationOutcome) resp.getOperationOutcome(); - assertEquals("OOOK", oo.getIssueFirstRep().getDiagnostics()); - - } - - @Test - public void testVReadWithAbsoluteUrl() throws Exception { - - String msg = getResourceResult(); - - ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); - when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); - when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); - when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); - when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); - Header[] headers = new Header[] { - new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT"), - new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), - }; - when(myHttpResponse.getAllHeaders()).thenReturn(headers); - - IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); - - Patient response = client - .read() - .resource(Patient.class) - .withUrl("http://somebase.com/path/to/base/Patient/1234/_history/2222") - .execute(); - - assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); - assertEquals("http://somebase.com/path/to/base/Patient/1234/_history/2222", capt.getAllValues().get(0).getURI().toString()); - - } - - @BeforeClass - public static void beforeClass() { - ourCtx = FhirContext.forR4(); - } - - @AfterClass - public static void afterClassClearContext() { - TestUtil.clearAllStaticFieldsForUnitTest(); - } - -} +package ca.uhn.fhir.rest.client; + +import static org.hamcrest.Matchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.*; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.util.*; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.*; +import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.*; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hamcrest.Matchers; +import org.hamcrest.core.StringContains; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Bundle.BundleType; +import org.hl7.fhir.r4.model.Bundle.HTTPVerb; +import org.junit.*; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.*; +import ca.uhn.fhir.model.primitive.InstantDt; +import ca.uhn.fhir.model.primitive.UriDt; +import ca.uhn.fhir.rest.api.*; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.client.api.IGenericClient; +import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum; +import ca.uhn.fhir.rest.client.exceptions.NonFhirResponseException; +import ca.uhn.fhir.rest.client.impl.BaseClient; +import ca.uhn.fhir.rest.client.impl.GenericClient; +import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import ca.uhn.fhir.util.*; + +public class GenericClientTest { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GenericClientTest.class); + private static FhirContext ourCtx; + private HttpClient myHttpClient; + + private HttpResponse myHttpResponse; + + @Before + public void before() { + + myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs()); + ourCtx.getRestfulClientFactory().setHttpClient(myHttpClient); + ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); + + myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); + + System.setProperty(BaseClient.HAPI_CLIENT_KEEPRESPONSES, "true"); + } + + private Patient createPatientP1() { + Patient p1 = new Patient(); + p1.addIdentifier().setSystem("foo:bar").setValue("12345"); + p1.addName().setFamily("Smith").addGiven("John"); + return p1; + } + + private Bundle createTransactionBundleInput() { + Bundle input = new Bundle(); + input.setType(BundleType.TRANSACTION); + input + .addEntry() + .setResource(createPatientP1()) + .getRequest() + .setMethod(HTTPVerb.POST); + return input; + } + + private Bundle createTransactionBundleOutput() { + Bundle output = new Bundle(); + output.setType(BundleType.TRANSACTIONRESPONSE); + output + .addEntry() + .setResource(createPatientP1()) + .getResponse() + .setLocation(createPatientP1().getId()); + return output; + } + + private String extractBody(ArgumentCaptor<HttpUriRequest> capt, int count) throws IOException { + String body = IOUtils.toString(((HttpEntityEnclosingRequestBase) capt.getAllValues().get(count)).getEntity().getContent(), "UTF-8"); + return body; + } + + private String getPatientFeedWithOneResult() { + return ClientR4Test.getPatientFeedWithOneResult(ourCtx); +// //@formatter:off +// String msg = "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n" + +// "<title/>\n" + +// "<id>d039f91a-cc3c-4013-988e-af4d8d0614bd</id>\n" + +// "<os:totalResults xmlns:os=\"http://a9.com/-/spec/opensearch/1.1/\">1</os:totalResults>\n" + +// "<author>\n" + +// "<name>ca.uhn.fhir.rest.server.DummyRestfulServer</name>\n" + +// "</author>\n" + +// "<entry>\n" + +// "<content type=\"text/xml\">" +// + "<Patient xmlns=\"http://hl7.org/fhir\">" +// + "<text><status value=\"generated\" /><div xmlns=\"http://www.w3.org/1999/xhtml\">John Cardinal: 444333333 </div></text>" +// + "<identifier><label value=\"SSN\" /><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>" +// + "<name><use value=\"official\" /><family value=\"Cardinal\" /><given value=\"John\" /></name>" +// + "<name><family value=\"Kramer\" /><given value=\"Doe\" /></name>" +// + "<telecom><system value=\"phone\" /><value value=\"555-555-2004\" /><use value=\"work\" /></telecom>" +// + "<gender><coding><system value=\"http://hl7.org/fhir/v3/AdministrativeGender\" /><code value=\"M\" /></coding></gender>" +// + "<address><use value=\"home\" /><line value=\"2222 Home Street\" /></address><active value=\"true\" />" +// + "</Patient>" +// + "</content>\n" +// + " </entry>\n" +// + "</feed>"; +// //@formatter:on + // return msg; + } + + private String getResourceResult() { + //@formatter:off + String msg = + "<Patient xmlns=\"http://hl7.org/fhir\">" + + "<text><status value=\"generated\" /><div xmlns=\"http://www.w3.org/1999/xhtml\">John Cardinal: 444333333 </div></text>" + + "<identifier><label value=\"SSN\" /><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>" + + "<name><use value=\"official\" /><family value=\"Cardinal\" /><given value=\"John\" /></name>" + + "<name><family value=\"Kramer\" /><given value=\"Doe\" /></name>" + + "<telecom><system value=\"phone\" /><value value=\"555-555-2004\" /><use value=\"work\" /></telecom>" + + "<gender><coding><system value=\"http://hl7.org/fhir/v3/AdministrativeGender\" /><code value=\"M\" /></coding></gender>" + + "<address><use value=\"home\" /><line value=\"2222 Home Street\" /></address><active value=\"true\" />" + + "</Patient>"; + //@formatter:on + return msg; + } + + @SuppressWarnings("unused") + @Test + public void testCacheControlNoStore() throws Exception { + + String msg = ourCtx.newXmlParser().encodeResourceToString(new Bundle()); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Observation.class) + .returnBundle(Bundle.class) + .cacheControl(new CacheControlDirective().setNoStore(true)) + .execute(); + + assertEquals("http://example.com/fhir/Observation", capt.getValue().getURI().toString()); + assertEquals(1, capt.getValue().getHeaders("Cache-Control").length); + assertEquals("no-store", capt.getValue().getHeaders("Cache-Control")[0].getValue()); + } + + @SuppressWarnings("unused") + @Test + public void testCacheControlNoStoreMaxResults() throws Exception { + + String msg = ourCtx.newXmlParser().encodeResourceToString(new Bundle()); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Observation.class) + .returnBundle(Bundle.class) + .cacheControl(new CacheControlDirective().setNoStore(true).setMaxResults(100)) + .execute(); + + assertEquals("http://example.com/fhir/Observation", capt.getValue().getURI().toString()); + assertEquals(1, capt.getValue().getHeaders("Cache-Control").length); + assertEquals("no-store, max-results=100", capt.getValue().getHeaders("Cache-Control")[0].getValue()); + } + + @SuppressWarnings("unused") + @Test + public void testCacheControlNoStoreNoCache() throws Exception { + + String msg = ourCtx.newXmlParser().encodeResourceToString(new Bundle()); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Observation.class) + .returnBundle(Bundle.class) + .cacheControl(new CacheControlDirective().setNoStore(true).setNoCache(true)) + .execute(); + + assertEquals("http://example.com/fhir/Observation", capt.getValue().getURI().toString()); + assertEquals(1, capt.getValue().getHeaders("Cache-Control").length); + assertEquals("no-cache, no-store", capt.getValue().getHeaders("Cache-Control")[0].getValue()); + } + + @Test + public void testCreatePopulatesIsCreated() throws Exception { + + Patient p1 = createPatientP1(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); + MethodOutcome resp = client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).execute(); + assertTrue(resp.getCreated()); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + resp = client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).execute(); + assertNull(resp.getCreated()); + + ourLog.info("lastRequest: {}", ((GenericClient) client).getLastRequest()); + ourLog.info("lastResponse: {}", ((GenericClient) client).getLastResponse()); + ourLog.info("lastResponseBody: {}", ((GenericClient) client).getLastResponseBody()); + } + + @Test + public void testCreateWithStringAutoDetectsEncoding() throws Exception { + + Patient p1 = createPatientP1(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int count = 0; + client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).execute(); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, count), containsString("value=\"John\"")); + count++; + + String resourceAsString = ourCtx.newJsonParser().encodeResourceToString(p1); + client + .create() + .resource(resourceAsString) + .execute(); + + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.JSON.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, count), containsString("[\"John\"]")); + count++; + + /* + * e.g. Now try with reversed encoding (provide a string that's in JSON and ask the client to use XML) + */ + + client.create().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).encodedJson().execute(); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.JSON.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, count), containsString("[\"John\"]")); + count++; + + client.create().resource(ourCtx.newJsonParser().encodeResourceToString(p1)).encodedXml().execute(); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, count), containsString("value=\"John\"")); + count++; + + } + + @Test + public void testCreateWithTag() throws Exception { + + Patient p1 = createPatientP1(); + p1.getMeta().addTag("http://hl7.org/fhir/tag", "urn:happytag", "This is a happy resource"); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + MethodOutcome outcome = client.create().resource(p1).execute(); + assertEquals("44", outcome.getId().getIdPart()); + assertEquals("22", outcome.getId().getVersionIdPart()); + + int count = 0; + + assertEquals("http://example.com/fhir/Patient", capt.getValue().getURI().toString()); + assertEquals("POST", capt.getValue().getMethod()); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + count++; + + /* + * Try fluent options + */ + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + client.create().resource(p1).execute(); + assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(1).getURI().toString()); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + count++; + + String resourceText = "<Patient xmlns=\"http://hl7.org/fhir\"> </Patient>"; + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + client.create().resource(resourceText).execute(); + assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(2).getURI().toString()); + assertEquals(resourceText, IOUtils.toString(((HttpPost) capt.getAllValues().get(2)).getEntity().getContent())); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + count++; + } + + @Test + public void testCreateWithTagNonFluent() throws Exception { + + Patient p1 = createPatientP1(); + p1.getMeta().addTag("http://hl7.org/fhir/tag", "urn:happytag", "This is a happy resource"); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + MethodOutcome outcome = client.create().resource(p1).execute(); + assertEquals("44", outcome.getId().getIdPart()); + assertEquals("22", outcome.getId().getVersionIdPart()); + + assertEquals("http://example.com/fhir/Patient", capt.getValue().getURI().toString()); + assertEquals("POST", capt.getValue().getMethod()); + Header catH = capt.getValue().getFirstHeader("Category"); + assertNull(catH); + } + + /** + * Test for issue #60 + */ + @Test + public void testCreateWithUtf8Characters() throws Exception { + String name = "測試醫院"; + Organization org = new Organization(); + org.setName(name); + org.addIdentifier().setSystem("urn:system").setValue("testCreateWithUtf8Characters_01"); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int count = 0; + client.create().resource(org).prettyPrint().encodedXml().execute(); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, count), containsString("<name value=\"測試醫院\"/>")); + count++; + + } + + @Test + public void testDelete() throws Exception { + OperationOutcome oo = new OperationOutcome(); + oo.addIssue().addLocation("testDelete01"); + String ooStr = ourCtx.newXmlParser().encodeResourceToString(oo); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(ooStr), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + OperationOutcome outcome = (OperationOutcome) client.delete().resourceById("Patient", "123").execute(); + + assertEquals("http://example.com/fhir/Patient/123", capt.getValue().getURI().toString()); + assertEquals("DELETE", capt.getValue().getMethod()); + assertEquals("testDelete01", outcome.getIssueFirstRep().getLocation().get(0).getValue()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader("LKJHLKJGLKJKLL"), Charset.forName("UTF-8"))); + outcome = (OperationOutcome) client.delete().resourceById(new IdType("Location", "123", "456")).prettyPrint().encodedJson().execute(); + + assertEquals("http://example.com/fhir/Location/123?_pretty=true", capt.getAllValues().get(1).getURI().toString()); + assertEquals("DELETE", capt.getValue().getMethod()); + assertEquals(null, outcome); + + } + + @Test + public void testHistory() throws Exception { + + final String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + Bundle response; + + response = client + .history() + .onServer() + .andReturnBundle(Bundle.class) + .execute(); + assertEquals("http://example.com/fhir/_history", capt.getAllValues().get(idx).getURI().toString()); + assertEquals(1, response.getEntry().size()); + idx++; + + response = client + .history() + .onType(Patient.class) + .andReturnBundle(Bundle.class) + .execute(); + assertEquals("http://example.com/fhir/Patient/_history", capt.getAllValues().get(idx).getURI().toString()); + assertEquals(1, response.getEntry().size()); + idx++; + + response = client + .history() + .onInstance(new IdType("Patient", "123")) + .andReturnBundle(Bundle.class) + .execute(); + assertEquals("http://example.com/fhir/Patient/123/_history", capt.getAllValues().get(idx).getURI().toString()); + assertEquals(1, response.getEntry().size()); + idx++; + } + + @Test + @Ignore + public void testInvalidCalls() { + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + try { + client.meta(); + fail(); + } catch (IllegalStateException e) { + assertEquals("Can not call $meta operations on a DSTU1 client", e.getMessage()); + } + try { + client.operation(); + fail(); + } catch (IllegalStateException e) { + assertEquals("Operations are only supported in FHIR DSTU2 and later. This client was created using a context configured for DSTU1", e.getMessage()); + } + } + + @Test + public void testLoadPageAndReturnDstu1Bundle() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); + client + .loadPage() + .byUrl("http://example.com/page1") + .andReturnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/page1", capt.getValue().getURI().toString()); + } + + @Test + public void testMissing() throws Exception { + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return (new ReaderInputStream(new StringReader(getPatientFeedWithOneResult()), Charset.forName("UTF-8"))); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); + + client.search().forResource("Patient").where(Patient.NAME.isMissing(true)).returnBundle(Bundle.class).execute(); + assertEquals("http://example.com/fhir/Patient?name%3Amissing=true", capt.getValue().getRequestLine().getUri()); + + client.search().forResource("Patient").where(Patient.NAME.isMissing(false)).returnBundle(Bundle.class).execute(); + assertEquals("http://example.com/fhir/Patient?name%3Amissing=false", capt.getValue().getRequestLine().getUri()); + } + + @Test + public void testRead() throws Exception { + + String msg = getResourceResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + Header[] headers = new Header[] { + new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT"), + new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), + }; + when(myHttpResponse.getAllHeaders()).thenReturn(headers); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Patient response = client + .read() + .resource(Patient.class) + .withId(new IdType("Patient/1234")) + .execute(); + + assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); + + assertEquals("http://foo.com/Patient/123/_history/2333", response.getIdElement().getValue()); + + InstantType lm = response.getMeta().getLastUpdatedElement(); + lm.setTimeZoneZulu(true); + assertEquals("1995-11-15T04:58:08.000Z", lm.getValueAsString()); + + } + + @Test + public void testReadFluent() throws Exception { + + String msg = getResourceResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + Header[] headers = new Header[] { + new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT"), + new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), + }; + when(myHttpResponse.getAllHeaders()).thenReturn(headers); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int count = 0; + + Patient response = client.read().resource(Patient.class).withId(new IdType("Patient/1234")).execute(); + assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count++).getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = (Patient) client.read().resource("Patient").withId("1234").execute(); + assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); + assertEquals("http://example.com/fhir/Patient/1234", capt.getAllValues().get(count++).getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = (Patient) client.read().resource("Patient").withId(567L).execute(); + assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); + assertEquals("http://example.com/fhir/Patient/567", capt.getAllValues().get(count++).getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = client.read().resource(Patient.class).withIdAndVersion("1234", "22").execute(); + assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); + assertEquals("http://example.com/fhir/Patient/1234/_history/22", capt.getAllValues().get(count++).getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = client.read().resource(Patient.class).withUrl("http://foo/Patient/22").execute(); + assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); + assertEquals("http://foo/Patient/22", capt.getAllValues().get(count++).getURI().toString()); + + } + + @Test + public void testReadWithAbsoluteUrl() throws Exception { + + String msg = getResourceResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + Header[] headers = new Header[] { new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT"), + new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), + }; + when(myHttpResponse.getAllHeaders()).thenReturn(headers); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Patient response = client + .read() + .resource(Patient.class) + .withUrl(new IdType("http://somebase.com/path/to/base/Patient/1234")) + .execute(); + assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); + assertEquals("http://somebase.com/path/to/base/Patient/1234", capt.getAllValues().get(0).getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = client + .read() + .resource(Patient.class) + .withUrl(new IdType("http://somebase.com/path/to/base/Patient/1234/_history/222")) + .execute(); + assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); + assertEquals("http://somebase.com/path/to/base/Patient/1234/_history/222", capt.getAllValues().get(1).getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchAllResources() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forAllResources() + .where(Patient.NAME.matches().value("james")) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/?name=james", capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchAutomaticallyUsesPost() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + String longValue = StringUtils.leftPad("", 20000, 'B'); + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.NAME.matches().value(longValue)) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient/_search", capt.getValue().getURI().toString()); + + HttpEntityEnclosingRequestBase enc = (HttpEntityEnclosingRequestBase) capt.getValue(); + UrlEncodedFormEntity ent = (UrlEncodedFormEntity) enc.getEntity(); + String string = IOUtils.toString(ent.getContent()); + ourLog.info(string); + assertEquals("name=" + longValue, string); + } + + @Test + public void testSearchByCompartment() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); + Bundle response = client + .search() + .forResource(Patient.class) + .withIdAndCompartment("123", "fooCompartment") + .where(Patient.BIRTHDATE.afterOrEquals().day("2011-01-02")) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://foo/Patient/123/fooCompartment?birthdate=ge2011-01-02", capt.getValue().getURI().toString()); + + ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(response)); + + assertEquals("PRP1660", BundleUtil.toListOfResourcesOfType(ourCtx, response, Patient.class).get(0).getIdentifier().get(0).getValue()); + + try { + client + .search() + .forResource(Patient.class) + .withIdAndCompartment("", "fooCompartment") + .where(Patient.BIRTHDATE.afterOrEquals().day("2011-01-02")) + .returnBundle(Bundle.class) + .execute(); + fail(); + } catch (InvalidRequestException e) { + assertThat(e.toString(), containsString("null or empty for compartment")); + } + + } + + @SuppressWarnings("unused") + @Test + public void testSearchByComposite() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); + + Bundle response = client.search() + .forResource("Observation") + .where(Observation.CODE_VALUE_DATE + .withLeft(Observation.CODE.exactly().code("FOO$BAR")) + .withRight(Observation.VALUE_DATE.exactly().day("2001-01-01"))) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://foo/Observation?" + Observation.SP_CODE_VALUE_DATE + "=" + URLEncoder.encode("FOO\\$BAR$2001-01-01", "UTF-8"), capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchByDate() throws Exception { + + final String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + int idx = 0; + + @SuppressWarnings("deprecation") + Bundle response = client.search() + .forResource(Patient.class) + .encodedJson() + .where(Patient.BIRTHDATE.beforeOrEquals().day("2012-01-22")) + .and(Patient.BIRTHDATE.after().day("2011-01-01")) + .include(Patient.INCLUDE_ORGANIZATION) + .sort().ascending(Patient.BIRTHDATE) + .sort().descending(Patient.NAME) + .sort().defaultOrder(Patient.ADDRESS) + .count(123) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?birthdate=le2012-01-22&birthdate=gt2011-01-01&_include=Patient%3Aorganization&_sort=birthdate%2C-name%2Caddress&_count=123&_format=json", + capt.getAllValues().get(idx++).getURI().toString()); + + response = client.search() + .forResource(Patient.class) + .encodedJson() + .where(Patient.BIRTHDATE.beforeOrEquals().day("2012-01-22")) + .and(Patient.BIRTHDATE.after().day("2011-01-01")) + .include(Patient.INCLUDE_ORGANIZATION) + .sort().ascending(Patient.BIRTHDATE) + .sort().descending(Patient.NAME) + .sort().defaultOrder(Patient.ADDRESS) + .count(123) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?birthdate=le2012-01-22&birthdate=gt2011-01-01&_include=Patient%3Aorganization&_sort=birthdate%2C-name%2Caddress&_count=123&_format=json", + capt.getAllValues().get(idx++).getURI().toString()); + + response = client.search() + .forResource(Patient.class) + .encodedJson() + .where(Patient.BIRTHDATE.beforeOrEquals().day("2012-01-22").orAfter().day("2020-01-01")) + .and(Patient.BIRTHDATE.after().day("2011-01-01")) + .returnBundle(Bundle.class) + .execute(); + + String comma = "%2C"; + assertEquals("http://example.com/fhir/Patient?birthdate=le2012-01-22" + comma + "gt2020-01-01&birthdate=gt2011-01-01&_format=json", capt.getAllValues().get(idx++).getURI().toString()); + } + + @SuppressWarnings("unused") + @Test + public void testSearchByNumberExact() throws Exception { + + String msg = ourCtx.newXmlParser().encodeResourceToString(new Bundle()); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Observation.class) + .where(Observation.VALUE_QUANTITY.greaterThan().number(123).andUnits("foo", "bar")) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Observation?value-quantity=gt123%7Cfoo%7Cbar", capt.getValue().getURI().toString()); + } + + @SuppressWarnings("unused") + @Test + public void testSearchByProfile() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Patient.class) + .withProfile("http://1") + .withProfile("http://2") + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?_profile=http%3A%2F%2F1&_profile=http%3A%2F%2F2", capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchByQuantity() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Patient.class) + .where(Encounter.LENGTH.exactly().number(123)) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?length=123", capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchByReferenceProperty() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Patient.class) + .where(Patient.GENERAL_PRACTITIONER.hasChainedProperty(Organization.NAME.matches().value("ORG0"))) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?general-practitioner.name=ORG0", capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchByReferenceSimple() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.GENERAL_PRACTITIONER.hasId("123")) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?general-practitioner=123", capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchBySecurity() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Patient.class) + .withSecurity("urn:foo", "123") + .withSecurity("urn:bar", "456") + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?_security=urn%3Afoo%7C123&_security=urn%3Abar%7C456", capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchByString() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.NAME.matches().value("james")) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?name=james", capt.getValue().getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = client.search() + .forResource("Patient") + .where(Patient.NAME.matches().values("AAA", "BBB", "C,C")) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?name=" + URLEncoder.encode("AAA,BBB,C\\,C", "UTF-8"), capt.getAllValues().get(1).getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchByStringExact() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.NAME.matchesExactly().value("james")) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?name%3Aexact=james", capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchByTag() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Patient.class) + .withTag("urn:foo", "123") + .withTag("urn:bar", "456") + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?_tag=urn%3Afoo%7C123&_tag=urn%3Abar%7C456", capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchByToken() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.IDENTIFIER.exactly().systemAndCode("http://example.com/fhir", "ZZZ")) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?identifier=http%3A%2F%2Fexample.com%2Ffhir%7CZZZ", capt.getValue().getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = client.search() + .forResource("Patient") + .where(Patient.IDENTIFIER.exactly().code("ZZZ")) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?identifier=ZZZ", capt.getAllValues().get(1).getURI().toString()); + + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + response = client.search() + .forResource("Patient") + .where(Patient.IDENTIFIER.exactly().codings(new Coding("A", "B", "ZZZ"), new Coding("C", "D", "ZZZ"))) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?identifier=" + URLEncoder.encode("A|B,C|D", "UTF-8"), capt.getAllValues().get(2).getURI().toString()); + + } + + /** + * Test for #192 + */ + @SuppressWarnings("unused") + @Test + public void testSearchByTokenWithEscaping() throws Exception { + final String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://foo"); + int index = 0; + String wantPrefix = "http://foo/Patient?identifier="; + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.IDENTIFIER.exactly().systemAndCode("1", "2")) + .returnBundle(Bundle.class) + .execute(); + String wantValue = "1|2"; + String url = capt.getAllValues().get(index).getURI().toString(); + assertThat(url, Matchers.startsWith(wantPrefix)); + assertEquals(wantValue, UrlUtil.unescape(url.substring(wantPrefix.length()))); + assertEquals(UrlUtil.escape(wantValue), url.substring(wantPrefix.length())); + index++; + + response = client.search() + .forResource("Patient") + .where(Patient.IDENTIFIER.exactly().systemAndCode("1,2", "3,4")) + .returnBundle(Bundle.class) + .execute(); + wantValue = "1\\,2|3\\,4"; + url = capt.getAllValues().get(index).getURI().toString(); + assertThat(url, Matchers.startsWith(wantPrefix)); + assertEquals(wantValue, UrlUtil.unescape(url.substring(wantPrefix.length()))); + assertEquals(UrlUtil.escape(wantValue), url.substring(wantPrefix.length())); + index++; + } + + @SuppressWarnings("unused") + @Test + public void testSearchByTokenWithSystemAndNoCode() throws Exception { + + final String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() { + @Override + public InputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int idx = 0; + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.IDENTIFIER.hasSystemWithAnyCode("urn:foo")) + .returnBundle(Bundle.class) + .execute(); + assertEquals("http://example.com/fhir/Patient?identifier=urn%3Afoo%7C", capt.getAllValues().get(idx++).getURI().toString()); + + response = client.search() + .forResource("Patient") + .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:foo", null)) + .returnBundle(Bundle.class) + .execute(); + assertEquals("http://example.com/fhir/Patient?identifier=urn%3Afoo%7C", capt.getAllValues().get(idx++).getURI().toString()); + + response = client.search() + .forResource("Patient") + .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:foo", "")) + .returnBundle(Bundle.class) + .execute(); + assertEquals("http://example.com/fhir/Patient?identifier=urn%3Afoo%7C", capt.getAllValues().get(idx++).getURI().toString()); + } + + @SuppressWarnings("unused") + @Test + public void testSearchIncludeRecursive() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Patient.class) + .include(Patient.INCLUDE_ORGANIZATION) + .include(Patient.INCLUDE_LINK.asRecursive()) + .include(Patient.INCLUDE_ALL.asNonRecursive()) + .returnBundle(Bundle.class) + .execute(); + + assertThat(capt.getValue().getURI().toString(), containsString("http://example.com/fhir/Patient?")); + assertThat(capt.getValue().getURI().toString(), containsString("_include=" + UrlUtil.escape(Patient.INCLUDE_ORGANIZATION.getValue()))); + assertThat(capt.getValue().getURI().toString(), containsString("_include%3Arecurse=" + UrlUtil.escape(Patient.INCLUDE_LINK.getValue()))); + assertThat(capt.getValue().getURI().toString(), containsString("_include=*")); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchUsingGetSearch() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.NAME.matches().value("james")) + .usingStyle(SearchStyleEnum.GET_WITH_SEARCH) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient/_search?name=james", capt.getValue().getURI().toString()); + } + + @SuppressWarnings("unused") + @Test + public void testSearchUsingPost() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.NAME.matches().value("james")) + .usingStyle(SearchStyleEnum.POST) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient/_search", capt.getValue().getURI().toString()); + + HttpEntityEnclosingRequestBase enc = (HttpEntityEnclosingRequestBase) capt.getValue(); + UrlEncodedFormEntity ent = (UrlEncodedFormEntity) enc.getEntity(); + String string = IOUtils.toString(ent.getContent()); + ourLog.info(string); + assertEquals("name=james", string); + } + + @Test + public void testSearchWithAbsoluteUrl() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client + .search() + .byUrl("http://example.com/fhir/Patient?birthdate=le2012-01-22&birthdate=gt2011-01-01&_include=Patient%3Aorganization&_sort%3Aasc=birthdate&_sort%3Adesc=name&_count=123&_format=json") + .returnBundle(Bundle.class) + .execute(); + + assertEquals(1, response.getEntry().size()); + } + + @SuppressWarnings("unused") + @Test + public void testSearchWithClientEncodingAndPrettyPrintConfig() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + client.setPrettyPrint(true); + client.setEncoding(EncodingEnum.JSON); + + Bundle response = client.search() + .forResource(Patient.class) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?_format=json&_pretty=true", capt.getValue().getURI().toString()); + + } + + @SuppressWarnings("unused") + @Test + public void testSearchWithEscapedParameters() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource("Patient") + .where(Patient.NAME.matches().values("NE,NE", "NE,NE")) + .where(Patient.NAME.matchesExactly().values("E$E")) + .where(Patient.NAME.matches().values("NE\\NE")) + .where(Patient.NAME.matchesExactly().values("E|E")) + .returnBundle(Bundle.class) + .execute(); + + assertThat(capt.getValue().getURI().toString(), containsString("%3A")); + assertEquals("http://example.com/fhir/Patient?name=NE\\,NE,NE\\,NE&name=NE\\\\NE&name:exact=E\\$E&name:exact=E\\|E", UrlUtil.unescape(capt.getValue().getURI().toString())); + } + + @SuppressWarnings("unused") + @Test + public void testSearchWithInternalServerError() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 500, "INTERNAL ERRORS")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader("Server Issues!"), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + try { + client + .search() + .forResource(Patient.class) + .returnBundle(Bundle.class) + .execute(); + fail(); + } catch (InternalErrorException e) { + assertEquals(e.getMessage(), "HTTP 500 INTERNAL ERRORS: Server Issues!"); + assertEquals(e.getResponseBody(), "Server Issues!"); + } + + } + + @SuppressWarnings("unused") + @Test + public void testSearchWithNonFhirResponse() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader("Server Issues!"), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + try { + client.search().forResource(Patient.class).returnBundle(Bundle.class).execute(); + fail(); + } catch (NonFhirResponseException e) { + assertThat(e.getMessage(), StringContains.containsString("Server Issues!")); + } + + } + + @SuppressWarnings("unused") + @Test + public void testSearchWithReverseInclude() throws Exception { + + String msg = getPatientFeedWithOneResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.search() + .forResource(Patient.class) + .encodedJson() + .revInclude(Provenance.INCLUDE_TARGET) + .returnBundle(Bundle.class) + .execute(); + + assertEquals("http://example.com/fhir/Patient?_revinclude=Provenance%3Atarget&_format=json", capt.getValue().getURI().toString()); + + } + + @Test + public void testSetDefaultEncoding() throws Exception { + + String msg = ourCtx.newJsonParser().encodeResourceToString(new Patient()); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + // Header[] headers = new Header[] { new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 + // GMT"), + // new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), + // new BasicHeader(Constants.HEADER_CATEGORY, "http://foo/tagdefinition.html; scheme=\"http://hl7.org/fhir/tag\"; + // label=\"Some tag\"") }; + // when(myHttpResponse.getAllHeaders()).thenReturn(headers); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + (client).setEncoding(EncodingEnum.JSON); + int count = 0; + + client + .read() + .resource(Patient.class) + .withId(new IdType("Patient/1234")) + .execute(); + assertEquals("http://example.com/fhir/Patient/1234?_format=json", capt.getAllValues().get(count).getURI().toString()); + count++; + + } + + @Test + public void testTransaction() throws Exception { + Bundle input = createTransactionBundleInput(); + Bundle output = createTransactionBundleOutput(); + + String msg = ourCtx.newJsonParser().encodeResourceToString(output); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_JSON + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.transaction() + .withBundle(input) + .execute(); + + assertEquals("http://example.com/fhir", capt.getValue().getURI().toString()); + assertEquals(input.getEntry().get(0).getResource().getId(), response.getEntry().get(0).getResource().getId()); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(0).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + + } + + @Test + public void testTransactionXml() throws Exception { + Bundle input = createTransactionBundleInput(); + Bundle output = createTransactionBundleOutput(); + + String msg = ourCtx.newXmlParser().encodeResourceToString(output); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Bundle response = client.transaction() + .withBundle(input) + .execute(); + + assertEquals("http://example.com/fhir", capt.getValue().getURI().toString()); + assertEquals(input.getEntry().get(0).getResource().getId(), response.getEntry().get(0).getResource().getId()); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(0).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + + } + + @Test + public void testUpdate() throws Exception { + + Patient p1 = new Patient(); + p1.addIdentifier().setSystem("foo:bar").setValue("12345"); + p1.addName().setFamily("Smith").addGiven("John"); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + try { + client.update().resource(p1).execute(); + fail(); + } catch (InvalidRequestException e) { + // should happen because no ID set + } + + assertEquals(0, capt.getAllValues().size()); + + p1.setId("44"); + client.update().resource(p1).execute(); + + int count = 0; + + assertEquals(1, capt.getAllValues().size()); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + count++; + + MethodOutcome outcome = client.update().resource(p1).execute(); + assertEquals("44", outcome.getId().getIdPart()); + assertEquals("22", outcome.getId().getVersionIdPart()); + + assertEquals(2, capt.getAllValues().size()); + + assertEquals("http://example.com/fhir/Patient/44", capt.getValue().getURI().toString()); + assertEquals("PUT", capt.getValue().getMethod()); + + /* + * Try fluent options + */ + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + client.update().resource(p1).withId("123").execute(); + assertEquals(3, capt.getAllValues().size()); + assertEquals("http://example.com/fhir/Patient/123", capt.getAllValues().get(2).getURI().toString()); + + String resourceText = "<Patient xmlns=\"http://hl7.org/fhir\"> </Patient>"; + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + client.update().resource(resourceText).withId("123").execute(); + assertEquals("http://example.com/fhir/Patient/123", capt.getAllValues().get(3).getURI().toString()); + assertEquals(resourceText, IOUtils.toString(((HttpPut) capt.getAllValues().get(3)).getEntity().getContent())); + assertEquals(4, capt.getAllValues().size()); + + } + + @Test + public void testUpdateWithStringAutoDetectsEncoding() throws Exception { + + Patient p1 = new Patient(); + p1.addIdentifier().setSystem("foo:bar").setValue("12345"); + p1.addName().setFamily("Smith").addGiven("John"); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK")); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] { new BasicHeader(Constants.HEADER_LOCATION, "/Patient/44/_history/22") }); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8"))); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + int count = 0; + client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).withId("1").execute(); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, count), containsString("value=\"John\"")); + count++; + + client.update().resource(ourCtx.newJsonParser().encodeResourceToString(p1)).withId("1").execute(); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.JSON.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, count), containsString("[\"John\"]")); + count++; + + /* + * e.g. Now try with reversed encoding (provide a string that's in JSON and ask the client to use XML) + */ + + client.update().resource(ourCtx.newXmlParser().encodeResourceToString(p1)).withId("1").encodedJson().execute(); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.JSON.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, count), containsString("[\"John\"]")); + count++; + + client.update().resource(ourCtx.newJsonParser().encodeResourceToString(p1)).withId("1").encodedXml().execute(); + assertEquals(1, capt.getAllValues().get(count).getHeaders(Constants.HEADER_CONTENT_TYPE).length); + assertEquals(EncodingEnum.XML.getResourceContentTypeNonLegacy() + Constants.HEADER_SUFFIX_CT_UTF_8, capt.getAllValues().get(count).getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue()); + assertThat(extractBody(capt, count), containsString("value=\"John\"")); + count++; + } + + @Test + public void testVReadWithAbsoluteUrl() throws Exception { + + String msg = getResourceResult(); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + Header[] headers = new Header[] { + new BasicHeader(Constants.HEADER_LAST_MODIFIED, "Wed, 15 Nov 1995 04:58:08 GMT"), + new BasicHeader(Constants.HEADER_CONTENT_LOCATION, "http://foo.com/Patient/123/_history/2333"), + }; + when(myHttpResponse.getAllHeaders()).thenReturn(headers); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Patient response = client + .read() + .resource(Patient.class) + .withUrl("http://somebase.com/path/to/base/Patient/1234/_history/2222") + .execute(); + + assertThat(response.getNameFirstRep().getFamily(), StringContains.containsString("Cardinal")); + assertEquals("http://somebase.com/path/to/base/Patient/1234/_history/2222", capt.getAllValues().get(0).getURI().toString()); + + } + + @Test + public void testValidateNonFluent() throws Exception { + + OperationOutcome oo = new OperationOutcome(); + oo.addIssue().setDiagnostics("OOOK"); + + ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getAllHeaders()).thenReturn(new Header[] {}); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(ourCtx.newXmlParser().encodeResourceToString(oo)), Charset.forName("UTF-8"))); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + Patient p1 = new Patient(); + p1.addIdentifier().setSystem("foo:bar").setValue("12345"); + p1.addName().setFamily("Smith").addGiven("John"); + + MethodOutcome resp = client.validate(p1); + assertEquals("http://example.com/fhir/Patient/$validate", capt.getValue().getURI().toString()); + oo = (OperationOutcome) resp.getOperationOutcome(); + assertEquals("OOOK", oo.getIssueFirstRep().getDiagnostics()); + + } + + @AfterClass + public static void afterClassClearContext() { + TestUtil.clearAllStaticFieldsForUnitTest(); + } + + @BeforeClass + public static void beforeClass() { + ourCtx = FhirContext.forR4(); + } + +} diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/BinaryServerR4Test.java similarity index 50% rename from hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryR4Test.java rename to hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/BinaryServerR4Test.java index 51d2abef86f..4bee8510f9e 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/BinaryServerR4Test.java @@ -1,14 +1,16 @@ package ca.uhn.fhir.rest.server; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.util.concurrent.TimeUnit; - +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.rest.annotation.*; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.MethodOutcome; +import ca.uhn.fhir.util.PortUtil; +import ca.uhn.fhir.util.TestUtil; import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; @@ -18,18 +20,20 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r4.model.*; -import org.junit.*; +import org.hl7.fhir.r4.model.Binary; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.Reference; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.rest.annotation.Create; -import ca.uhn.fhir.rest.annotation.ResourceParam; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.MethodOutcome; -import ca.uhn.fhir.util.PortUtil; -import ca.uhn.fhir.util.TestUtil; +import java.util.concurrent.TimeUnit; -public class CreateBinaryR4Test { +import static org.junit.Assert.*; + +public class BinaryServerR4Test { private static CloseableHttpClient ourClient; private static FhirContext ourCtx = FhirContext.forR4(); private static Binary ourLastBinary; @@ -37,24 +41,73 @@ public class CreateBinaryR4Test { private static String ourLastBinaryString; private static int ourPort; private static Server ourServer; + private static IdType ourLastId; + private static Binary ourNextBinary; @Before public void before() { ourLastBinary = null; ourLastBinaryBytes = null; ourLastBinaryString = null; + ourLastId = null; + ourNextBinary = null; } @Test - public void testRawBytesBinaryContentType() throws Exception { + public void testGetWithNoAccept() throws Exception { + + ourNextBinary = new Binary(); + ourNextBinary.setId("Binary/A/_history/222"); + ourNextBinary.setContent(new byte[]{0, 1, 2, 3, 4}); + ourNextBinary.setSecurityContext(new Reference("Patient/1")); + ourNextBinary.setContentType("application/foo"); + + HttpGet get = new HttpGet("http://localhost:" + ourPort + "/Binary/A"); + get.addHeader("Content-Type", "application/foo"); + CloseableHttpResponse status = ourClient.execute(get); + try { + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals("application/foo", status.getEntity().getContentType().getValue()); + assertEquals("Patient/1", status.getFirstHeader(Constants.HEADER_X_SECURITY_CONTEXT).getValue()); + assertEquals("W/\"222\"", status.getFirstHeader(Constants.HEADER_ETAG).getValue()); + assertEquals("http://localhost:" + ourPort + "/Binary/A/_history/222", status.getFirstHeader(Constants.HEADER_LOCATION).getValue()); + + byte[] content = IOUtils.toByteArray(status.getEntity().getContent()); + assertArrayEquals(new byte[]{0, 1, 2, 3, 4}, content); + } finally { + IOUtils.closeQuietly(status); + } + } + + @Test + public void testPostBinaryWithSecurityContext() throws Exception { HttpPost post = new HttpPost("http://localhost:" + ourPort + "/Binary"); - post.setEntity(new ByteArrayEntity(new byte[] { 0, 1, 2, 3, 4 })); + post.setEntity(new ByteArrayEntity(new byte[]{0, 1, 2, 3, 4})); + post.addHeader("Content-Type", "application/foo"); + post.addHeader(Constants.HEADER_X_SECURITY_CONTEXT, "Encounter/2"); + CloseableHttpResponse status = ourClient.execute(post); + try { + assertNull(ourLastId); + assertEquals("application/foo", ourLastBinary.getContentType()); + assertEquals("Encounter/2", ourLastBinary.getSecurityContext().getReference()); + assertArrayEquals(new byte[]{0, 1, 2, 3, 4}, ourLastBinary.getContent()); + assertArrayEquals(new byte[]{0, 1, 2, 3, 4}, ourLastBinaryBytes); + } finally { + IOUtils.closeQuietly(status); + } + } + + @Test + public void testPostRawBytesBinaryContentType() throws Exception { + HttpPost post = new HttpPost("http://localhost:" + ourPort + "/Binary"); + post.setEntity(new ByteArrayEntity(new byte[]{0, 1, 2, 3, 4})); post.addHeader("Content-Type", "application/foo"); CloseableHttpResponse status = ourClient.execute(post); try { + assertNull(ourLastId); assertEquals("application/foo", ourLastBinary.getContentType()); - assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, ourLastBinary.getContent()); - assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, ourLastBinaryBytes); + assertArrayEquals(new byte[]{0, 1, 2, 3, 4}, ourLastBinary.getContent()); + assertArrayEquals(new byte[]{0, 1, 2, 3, 4}, ourLastBinaryBytes); } finally { IOUtils.closeQuietly(status); } @@ -64,11 +117,11 @@ public class CreateBinaryR4Test { * Technically the client shouldn't be doing it this way, but we'll be accepting */ @Test - public void testRawBytesFhirContentType() throws Exception { + public void testPostRawBytesFhirContentType() throws Exception { Binary b = new Binary(); b.setContentType("application/foo"); - b.setContent(new byte[] { 0, 1, 2, 3, 4 }); + b.setContent(new byte[]{0, 1, 2, 3, 4}); String encoded = ourCtx.newJsonParser().encodeResourceToString(b); HttpPost post = new HttpPost("http://localhost:" + ourPort + "/Binary"); @@ -77,14 +130,14 @@ public class CreateBinaryR4Test { CloseableHttpResponse status = ourClient.execute(post); try { assertEquals("application/foo", ourLastBinary.getContentType()); - assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, ourLastBinary.getContent()); + assertArrayEquals(new byte[]{0, 1, 2, 3, 4}, ourLastBinary.getContent()); } finally { IOUtils.closeQuietly(status); } } @Test - public void testRawBytesFhirContentTypeContainingFhir() throws Exception { + public void testPostRawBytesFhirContentTypeContainingFhir() throws Exception { Patient p = new Patient(); p.getText().setDivAsString("A PATIENT"); @@ -109,13 +162,32 @@ public class CreateBinaryR4Test { } @Test - public void testRawBytesNoContentType() throws Exception { + public void testPostRawBytesNoContentType() throws Exception { HttpPost post = new HttpPost("http://localhost:" + ourPort + "/Binary"); - post.setEntity(new ByteArrayEntity(new byte[] { 0, 1, 2, 3, 4 })); + post.setEntity(new ByteArrayEntity(new byte[]{0, 1, 2, 3, 4})); CloseableHttpResponse status = ourClient.execute(post); try { assertNull(ourLastBinary.getContentType()); - assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, ourLastBinary.getContent()); + assertArrayEquals(new byte[]{0, 1, 2, 3, 4}, ourLastBinary.getContent()); + } finally { + IOUtils.closeQuietly(status); + } + } + + @Test + public void testPutBinaryWithSecurityContext() throws Exception { + HttpPut post = new HttpPut("http://localhost:" + ourPort + "/Binary/A"); + post.setEntity(new ByteArrayEntity(new byte[]{0, 1, 2, 3, 4})); + post.addHeader("Content-Type", "application/foo"); + post.addHeader(Constants.HEADER_X_SECURITY_CONTEXT, "Encounter/2"); + CloseableHttpResponse status = ourClient.execute(post); + try { + assertEquals("Binary/A", ourLastId.getValue()); + assertEquals("Binary/A", ourLastBinary.getId()); + assertEquals("application/foo", ourLastBinary.getContentType()); + assertEquals("Encounter/2", ourLastBinary.getSecurityContext().getReference()); + assertArrayEquals(new byte[]{0, 1, 2, 3, 4}, ourLastBinary.getContent()); + assertArrayEquals(new byte[]{0, 1, 2, 3, 4}, ourLastBinaryBytes); } finally { IOUtils.closeQuietly(status); } @@ -149,7 +221,6 @@ public class CreateBinaryR4Test { } public static class BinaryProvider implements IResourceProvider { - @Create() public MethodOutcome createBinary(@ResourceParam Binary theBinary, @ResourceParam String theBinaryString, @ResourceParam byte[] theBinaryBytes) { ourLastBinary = theBinary; @@ -163,6 +234,20 @@ public class CreateBinaryR4Test { return Binary.class; } + @Read + public Binary read(@IdParam IdType theId) { + return ourNextBinary; + } + + @Update() + public MethodOutcome updateBinary(@IdParam IdType theId, @ResourceParam Binary theBinary, @ResourceParam String theBinaryString, @ResourceParam byte[] theBinaryBytes) { + ourLastId = theId; + ourLastBinary = theBinary; + ourLastBinaryString = theBinaryString; + ourLastBinaryBytes = theBinaryBytes; + return new MethodOutcome(new IdType("Binary/001/_history/002")); + } + } } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4ProviderTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4ProviderTest.java index b4e15bcdd14..973835eb88f 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4ProviderTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4ProviderTest.java @@ -22,7 +22,6 @@ import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.hapi.rest.server.GraphQLProvider; import org.hl7.fhir.r4.model.*; -import org.hl7.fhir.r4.utils.GraphQLEngine; import org.hl7.fhir.utilities.graphql.Argument; import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices; import org.hl7.fhir.utilities.graphql.ReferenceResolution; @@ -37,8 +36,7 @@ import java.util.List; import java.util.concurrent.TimeUnit; import static org.hamcrest.Matchers.startsWith; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.*; public class GraphQLR4ProviderTest { @@ -48,6 +46,121 @@ public class GraphQLR4ProviderTest { private static int ourPort; private static Server ourServer; + @Before + public void before() { + //nothing + } + + @Test + public void testGraphInstance() throws Exception { + String query = "{name{family,given}}"; + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/123/$graphql?query=" + UrlUtil.escape(query)); + CloseableHttpResponse status = ourClient.execute(httpGet); + try { + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + ourLog.info(responseContent); + assertEquals(200, status.getStatusLine().getStatusCode()); + + assertEquals(TestUtil.stripReturns("{\n" + + " \"name\":[{\n" + + " \"family\":\"FAMILY\",\n" + + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + + " },{\n" + + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + + " }]\n" + + "}"), TestUtil.stripReturns(responseContent)); + assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); + + } finally { + IOUtils.closeQuietly(status.getEntity().getContent()); + } + + } + + @Test + public void testGraphInstanceWithFhirpath() throws Exception { + String query = "{name(fhirpath:\"family.exists()\"){text,given,family}}"; + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/123/$graphql?query=" + UrlUtil.escape(query)); + CloseableHttpResponse status = ourClient.execute(httpGet); + try { + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + ourLog.info(responseContent); + assertEquals(200, status.getStatusLine().getStatusCode()); + + assertEquals(TestUtil.stripReturns("{\n" + + " \"name\":[{\n" + + " \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" + + " \"family\":\"FAMILY\"\n" + + " }]\n" + + "}"), TestUtil.stripReturns(responseContent)); + assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); + + } finally { + IOUtils.closeQuietly(status.getEntity().getContent()); + } + + } + + @Test + public void testGraphSystemInstance() throws Exception { + String query = "{Patient(id:123){id,name{given,family}}}"; + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/$graphql?query=" + UrlUtil.escape(query)); + CloseableHttpResponse status = ourClient.execute(httpGet); + try { + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + ourLog.info(responseContent); + assertEquals(200, status.getStatusLine().getStatusCode()); + + assertEquals(TestUtil.stripReturns("{\n" + + " \"Patient\":{\n" + + " \"name\":[{\n" + + " \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" + + " \"family\":\"FAMILY\"\n" + + " },{\n" + + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + + " }]\n" + + " }\n" + + "}"), TestUtil.stripReturns(responseContent)); + assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); + + } finally { + IOUtils.closeQuietly(status.getEntity().getContent()); + } + + } + + @Test + public void testGraphSystemList() throws Exception { + String query = "{PatientList(name:\"pet\"){name{family,given}}}"; + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/$graphql?query=" + UrlUtil.escape(query)); + CloseableHttpResponse status = ourClient.execute(httpGet); + try { + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + ourLog.info(responseContent); + assertEquals(200, status.getStatusLine().getStatusCode()); + + assertEquals(TestUtil.stripReturns("{\n" + + " \"PatientList\":[{\n" + + " \"name\":[{\n" + + " \"family\":\"pet\",\n" + + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + + " },{\n" + + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + + " }]\n" + + " },{\n" + + " \"name\":[{\n" + + " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + + " }]\n" + + " }]\n" + + "}"), TestUtil.stripReturns(responseContent)); + assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); + + } finally { + IOUtils.closeQuietly(status.getEntity().getContent()); + } + + } + @AfterClass public static void afterClassClearContext() throws Exception { ourServer.stop(); @@ -79,121 +192,6 @@ public class GraphQLR4ProviderTest { } - @Before - public void before() { - //nothing - } - - @Test - public void testGraphInstance() throws Exception { - String query = "{name{family,given}}"; - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/123/$graphql?query=" + UrlUtil.escape(query)); - CloseableHttpResponse status = ourClient.execute(httpGet); - try { - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - - assertEquals("{\n" + - " \"name\":[{\n" + - " \"family\":\"FAMILY\",\n" + - " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + - " },{\n" + - " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + - " }]\n" + - "}", responseContent); - assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); - - } finally { - IOUtils.closeQuietly(status.getEntity().getContent()); - } - - } - - @Test - public void testGraphSystemInstance() throws Exception { - String query = "{Patient(id:123){id,name{given,family}}}"; - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/$graphql?query=" + UrlUtil.escape(query)); - CloseableHttpResponse status = ourClient.execute(httpGet); - try { - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - - assertEquals("{\n" + - " \"Patient\":{\n" + - " \"name\":[{\n" + - " \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" + - " \"family\":\"FAMILY\"\n" + - " },{\n" + - " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + - " }]\n" + - " }\n" + - "}", responseContent); - assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); - - } finally { - IOUtils.closeQuietly(status.getEntity().getContent()); - } - - } - - @Test - public void testGraphSystemList() throws Exception { - String query = "{PatientList(name:\"pet\"){name{family,given}}}"; - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/$graphql?query=" + UrlUtil.escape(query)); - CloseableHttpResponse status = ourClient.execute(httpGet); - try { - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - - assertEquals("{\n" + - " \"PatientList\":[{\n" + - " \"name\":[{\n" + - " \"family\":\"pet\",\n" + - " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + - " },{\n" + - " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + - " }]\n" + - " },{\n" + - " \"name\":[{\n" + - " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + - " }]\n" + - " }]\n" + - "}", responseContent); - assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); - - } finally { - IOUtils.closeQuietly(status.getEntity().getContent()); - } - - } - - @Test - public void testGraphInstanceWithFhirpath() throws Exception { - String query = "{name(fhirpath:\"family.exists()\"){text,given,family}}"; - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/123/$graphql?query=" + UrlUtil.escape(query)); - CloseableHttpResponse status = ourClient.execute(httpGet); - try { - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - - assertEquals("{\n" + - " \"name\":[{\n" + - " \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" + - " \"family\":\"FAMILY\"\n" + - " }]\n" + - "}", responseContent); - assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); - - } finally { - IOUtils.closeQuietly(status.getEntity().getContent()); - } - - } - public static class DummyPatientResourceProvider implements IResourceProvider { @Override @@ -219,31 +217,6 @@ public class GraphQLR4ProviderTest { } private static class MyStorageServices implements IGraphQLStorageServices<Resource, Reference, Bundle> { - @Override - public ReferenceResolution<Resource> lookup(Object theAppInfo, Resource theContext, Reference theReference) throws FHIRException { - ourLog.info("lookup from {} to {}", theContext.getIdElement().getValue(), theReference.getReference()); - return null; - } - - @Override - public Resource lookup(Object theAppInfo, String theType, String theId) throws FHIRException { - ourLog.info("lookup {}/{}", theType, theId); - - if (theType.equals("Patient") && theId.equals("123")) { - Patient p = new Patient(); - p.addName() - .setFamily("FAMILY") - .addGiven("GIVEN1") - .addGiven("GIVEN2"); - p.addName() - .addGiven("GivenOnly1") - .addGiven("GivenOnly2"); - return p; - } - - return null; - } - @Override public void listResources(Object theAppInfo, String theType, List<Argument> theSearchParams, List<Resource> theMatches) throws FHIRException { ourLog.info("listResources of {} - {}", theType, theSearchParams); @@ -271,6 +244,31 @@ public class GraphQLR4ProviderTest { } } + @Override + public Resource lookup(Object theAppInfo, String theType, String theId) throws FHIRException { + ourLog.info("lookup {}/{}", theType, theId); + + if (theType.equals("Patient") && theId.equals("123")) { + Patient p = new Patient(); + p.addName() + .setFamily("FAMILY") + .addGiven("GIVEN1") + .addGiven("GIVEN2"); + p.addName() + .addGiven("GivenOnly1") + .addGiven("GivenOnly2"); + return p; + } + + return null; + } + + @Override + public ReferenceResolution<Resource> lookup(Object theAppInfo, Resource theContext, Reference theReference) throws FHIRException { + ourLog.info("lookup from {} to {}", theContext.getIdElement().getValue(), theReference.getReference()); + return null; + } + @Override public Bundle search(Object theAppInfo, String theType, List<Argument> theSearchParams) throws FHIRException { ourLog.info("search on {} - {}", theType, theSearchParams); diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchR4Test.java index a0cf8a51031..86f43d9114c 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/SearchR4Test.java @@ -1,32 +1,5 @@ package ca.uhn.fhir.rest.server; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.io.IOUtils; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.servlet.ServletHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r4.model.*; -import org.junit.*; - import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.annotation.RequiredParam; import ca.uhn.fhir.rest.annotation.Search; @@ -38,15 +11,46 @@ import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; import ca.uhn.fhir.rest.gclient.StringClientParam; import ca.uhn.fhir.rest.param.TokenAndListParam; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import ca.uhn.fhir.util.*; +import ca.uhn.fhir.util.PortUtil; +import ca.uhn.fhir.util.TestUtil; +import ca.uhn.fhir.util.UrlUtil; +import org.apache.commons.io.IOUtils; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.HumanName; +import org.hl7.fhir.r4.model.OperationOutcome; +import org.hl7.fhir.r4.model.Patient; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.junit.Assert.*; public class SearchR4Test { + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchR4Test.class); private static CloseableHttpClient ourClient; private static FhirContext ourCtx = FhirContext.forR4(); private static TokenAndListParam ourIdentifiers; private static String ourLastMethod; - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchR4Test.class); private static int ourPort; private static Server ourServer; @@ -57,74 +61,63 @@ public class SearchR4Test { ourIdentifiers = null; } - @Test - public void testSearchNormal() throws Exception { - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=foo%7Cbar"); + private Bundle executeAndReturnLinkNext(HttpGet httpGet, EncodingEnum theExpectEncoding) throws IOException, ClientProtocolException { CloseableHttpResponse status = ourClient.execute(httpGet); + Bundle bundle; try { String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - - assertEquals("search", ourLastMethod); - - assertEquals("foo", ourIdentifiers.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(0).getSystem()); - assertEquals("bar", ourIdentifiers.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(0).getValue()); + EncodingEnum ct = EncodingEnum.forContentType(status.getEntity().getContentType().getValue().replaceAll(";.*", "").trim()); + assertEquals(theExpectEncoding, ct); + bundle = ct.newParser(ourCtx).parseResource(Bundle.class, responseContent); + assertEquals(10, bundle.getEntry().size()); + String linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); + assertNotNull(linkNext); } finally { IOUtils.closeQuietly(status.getEntity().getContent()); } - + return bundle; } @Test - public void testSearchWithInvalidChain() throws Exception { - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier.chain=foo%7Cbar"); - CloseableHttpResponse status = ourClient.execute(httpGet); - try { - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - ourLog.info(responseContent); - assertEquals(400, status.getStatusLine().getStatusCode()); - - OperationOutcome oo = (OperationOutcome) ourCtx.newJsonParser().parseResource(responseContent); - assertEquals( - "Invalid search parameter \"identifier.chain\". Parameter contains a chain (.chain) and chains are not supported for this parameter (chaining is only allowed on reference parameters)", - oo.getIssueFirstRep().getDiagnostics()); - } finally { - IOUtils.closeQuietly(status.getEntity().getContent()); - } - - } - - - @Test - public void testPagingPreservesEncodingJson() throws Exception { + public void testPagingPreservesElements() throws Exception { HttpGet httpGet; String linkNext; Bundle bundle; + String linkSelf; // Initial search - httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=foo%7Cbar&_format=json"); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=foo%7Cbar&_elements=name"); bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.JSON); + assertThat(toJson(bundle), not(containsString("active"))); + linkSelf = bundle.getLink(Constants.LINK_SELF).getUrl(); + assertThat(linkSelf, containsString("_elements=name")); linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); - assertThat(linkNext, containsString("_format=json")); + assertThat(linkNext, containsString("_elements=name")); + + ourLog.info(toJson(bundle)); // Fetch the next page httpGet = new HttpGet(linkNext); bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.JSON); + assertThat(toJson(bundle), not(containsString("active"))); linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); - assertThat(linkNext, containsString("_format=json")); + assertThat(linkNext, containsString("_elements=name")); // Fetch the next page httpGet = new HttpGet(linkNext); bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.JSON); + assertThat(toJson(bundle), not(containsString("active"))); linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); - assertThat(linkNext, containsString("_format=json")); + assertThat(linkNext, containsString("_elements=name")); // Fetch the next page httpGet = new HttpGet(linkNext); bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.JSON); + assertThat(toJson(bundle), not(containsString("active"))); linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); - assertThat(linkNext, containsString("_format=json")); + assertThat(linkNext, containsString("_elements=name")); } @@ -161,34 +154,35 @@ public class SearchR4Test { } @Test - public void testPagingPreservesEncodingXml() throws Exception { + public void testPagingPreservesEncodingJson() throws Exception { HttpGet httpGet; String linkNext; Bundle bundle; // Initial search - httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=foo%7Cbar&_format=xml"); - bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.XML); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=foo%7Cbar&_format=json"); + bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.JSON); + assertThat(toJson(bundle), containsString("active")); linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); - assertThat(linkNext, containsString("_format=xml")); + assertThat(linkNext, containsString("_format=json")); // Fetch the next page httpGet = new HttpGet(linkNext); - bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.XML); + bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.JSON); linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); - assertThat(linkNext, containsString("_format=xml")); + assertThat(linkNext, containsString("_format=json")); // Fetch the next page httpGet = new HttpGet(linkNext); - bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.XML); + bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.JSON); linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); - assertThat(linkNext, containsString("_format=xml")); + assertThat(linkNext, containsString("_format=json")); // Fetch the next page httpGet = new HttpGet(linkNext); - bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.XML); + bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.JSON); linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); - assertThat(linkNext, containsString("_format=xml")); + assertThat(linkNext, containsString("_format=json")); } @@ -260,26 +254,76 @@ public class SearchR4Test { } - private Bundle executeAndReturnLinkNext(HttpGet httpGet, EncodingEnum theExpectEncoding) throws IOException, ClientProtocolException { - CloseableHttpResponse status = ourClient.execute(httpGet); + @Test + public void testPagingPreservesEncodingXml() throws Exception { + HttpGet httpGet; + String linkNext; Bundle bundle; + + // Initial search + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=foo%7Cbar&_format=xml"); + bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.XML); + linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); + assertThat(linkNext, containsString("_format=xml")); + + // Fetch the next page + httpGet = new HttpGet(linkNext); + bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.XML); + linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); + assertThat(linkNext, containsString("_format=xml")); + + // Fetch the next page + httpGet = new HttpGet(linkNext); + bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.XML); + linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); + assertThat(linkNext, containsString("_format=xml")); + + // Fetch the next page + httpGet = new HttpGet(linkNext); + bundle = executeAndReturnLinkNext(httpGet, EncodingEnum.XML); + linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); + assertThat(linkNext, containsString("_format=xml")); + + } + + @Test + public void testSearchNormal() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=foo%7Cbar"); + CloseableHttpResponse status = ourClient.execute(httpGet); try { String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - EncodingEnum ct = EncodingEnum.forContentType(status.getEntity().getContentType().getValue().replaceAll(";.*", "").trim()); - assertEquals(theExpectEncoding, ct); - bundle = ct.newParser(ourCtx).parseResource(Bundle.class, responseContent); - assertEquals(10, bundle.getEntry().size()); - String linkNext = bundle.getLink(Constants.LINK_NEXT).getUrl(); - assertNotNull(linkNext); + + assertEquals("search", ourLastMethod); + + assertEquals("foo", ourIdentifiers.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(0).getSystem()); + assertEquals("bar", ourIdentifiers.getValuesAsQueryTokens().get(0).getValuesAsQueryTokens().get(0).getValue()); } finally { IOUtils.closeQuietly(status.getEntity().getContent()); } - return bundle; + + } + + @Test + public void testSearchWithInvalidChain() throws Exception { + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier.chain=foo%7Cbar"); + CloseableHttpResponse status = ourClient.execute(httpGet); + try { + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + ourLog.info(responseContent); + assertEquals(400, status.getStatusLine().getStatusCode()); + + OperationOutcome oo = (OperationOutcome) ourCtx.newJsonParser().parseResource(responseContent); + assertEquals( + "Invalid search parameter \"identifier.chain\". Parameter contains a chain (.chain) and chains are not supported for this parameter (chaining is only allowed on reference parameters)", + oo.getIssueFirstRep().getDiagnostics()); + } finally { + IOUtils.closeQuietly(status.getEntity().getContent()); + } + } - @Test public void testSearchWithPostAndInvalidParameters() throws Exception { IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort); @@ -293,14 +337,14 @@ public class SearchR4Test { client.registerInterceptor(interceptor); try { client - .search() - .forResource(Patient.class) - .where(new StringClientParam("foo").matches().value("bar")) - .prettyPrint() - .usingStyle(SearchStyleEnum.POST) - .returnBundle(org.hl7.fhir.r4.model.Bundle.class) - .encodedJson() - .execute(); + .search() + .forResource(Patient.class) + .where(new StringClientParam("foo").matches().value("bar")) + .prettyPrint() + .usingStyle(SearchStyleEnum.POST) + .returnBundle(org.hl7.fhir.r4.model.Bundle.class) + .encodedJson() + .execute(); fail(); } catch (InvalidRequestException e) { assertThat(e.getMessage(), containsString("Invalid request: The FHIR endpoint on this server does not know how to handle POST operation[Patient/_search] with parameters [[_pretty, foo]]")); @@ -308,6 +352,10 @@ public class SearchR4Test { } + private String toJson(Bundle theBundle) { + return ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(theBundle); + } + @AfterClass public static void afterClassClearContext() throws Exception { ourServer.stop(); @@ -349,16 +397,17 @@ public class SearchR4Test { @SuppressWarnings("rawtypes") @Search() public List search( - @RequiredParam(name = Patient.SP_IDENTIFIER) TokenAndListParam theIdentifiers) { + @RequiredParam(name = Patient.SP_IDENTIFIER) TokenAndListParam theIdentifiers) { ourLastMethod = "search"; ourIdentifiers = theIdentifiers; ArrayList<Patient> retVal = new ArrayList<Patient>(); - + for (int i = 0; i < 200; i++) { Patient patient = new Patient(); patient.addName(new HumanName().setFamily("FAMILY")); + patient.setActive(true); patient.getIdElement().setValue("Patient/" + i); - retVal.add((Patient) patient); + retVal.add(patient); } return retVal; } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/AuthorizationInterceptorR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/AuthorizationInterceptorR4Test.java new file mode 100644 index 00000000000..4e40574d9c7 --- /dev/null +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/AuthorizationInterceptorR4Test.java @@ -0,0 +1,2202 @@ +package ca.uhn.fhir.rest.server.interceptor; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.context.api.AddProfileTagEnum; +import ca.uhn.fhir.rest.annotation.*; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.*; +import ca.uhn.fhir.rest.api.server.IRequestOperationCallback; +import ca.uhn.fhir.rest.api.server.RequestDetails; +import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider; +import ca.uhn.fhir.rest.server.IResourceProvider; +import ca.uhn.fhir.rest.server.RestfulServer; +import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails; +import ca.uhn.fhir.rest.server.interceptor.auth.AuthorizationInterceptor; +import ca.uhn.fhir.rest.server.interceptor.auth.IAuthRule; +import ca.uhn.fhir.rest.server.interceptor.auth.PolicyEnum; +import ca.uhn.fhir.rest.server.interceptor.auth.RuleBuilder; +import ca.uhn.fhir.util.PortUtil; +import ca.uhn.fhir.util.TestUtil; +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.*; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.r4.model.*; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.apache.commons.lang3.StringUtils.isNotBlank; +import static org.hamcrest.Matchers.containsString; +import static org.junit.Assert.*; + +public class AuthorizationInterceptorR4Test { + + private static final String ERR403 = "{\"resourceType\":\"OperationOutcome\",\"issue\":[{\"severity\":\"error\",\"code\":\"processing\",\"diagnostics\":\"Access denied by default policy (no applicable rules)\"}]}"; + private static CloseableHttpClient ourClient; + private static String ourConditionalCreateId; + private static FhirContext ourCtx = FhirContext.forR4(); + private static boolean ourHitMethod; + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(AuthorizationInterceptorR4Test.class); + private static int ourPort; + private static List<Resource> ourReturn; + private static Server ourServer; + private static RestfulServer ourServlet; + + @Before + public void before() { + ourCtx.setAddProfileTagWhenEncoding(AddProfileTagEnum.NEVER); + for (IServerInterceptor next : new ArrayList<IServerInterceptor>(ourServlet.getInterceptors())) { + ourServlet.unregisterInterceptor(next); + } + ourReturn = null; + ourHitMethod = false; + ourConditionalCreateId = "1123"; + } + + private Resource createCarePlan(Integer theId, String theSubjectId) { + CarePlan retVal = new CarePlan(); + if (theId != null) { + retVal.setId(new IdType("CarePlan", (long) theId)); + } + retVal.setSubject(new Reference("Patient/" + theSubjectId)); + return retVal; + } + + private HttpEntity createFhirResourceEntity(IBaseResource theResource) { + String out = ourCtx.newJsonParser().encodeResourceToString(theResource); + return new StringEntity(out, ContentType.create(Constants.CT_FHIR_JSON, "UTF-8")); + } + + private Resource createObservation(Integer theId, String theSubjectId) { + Observation retVal = new Observation(); + if (theId != null) { + retVal.setId(new IdType("Observation", (long) theId)); + } + retVal.getCode().setText("OBS"); + retVal.setSubject(new Reference(theSubjectId)); + return retVal; + } + + private Resource createPatient(Integer theId) { + Patient retVal = new Patient(); + if (theId != null) { + retVal.setId(new IdType("Patient", (long) theId)); + } + retVal.addName().setFamily("FAM"); + return retVal; + } + + private Resource createPatient(Integer theId, int theVersion) { + Resource retVal = createPatient(theId); + retVal.setId(retVal.getIdElement().withVersion(Integer.toString(theVersion))); + return retVal; + } + + private String extractResponseAndClose(HttpResponse status) throws IOException { + if (status.getEntity() == null) { + return null; + } + String responseContent; + responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + IOUtils.closeQuietly(status.getEntity().getContent()); + return responseContent; + } + + @Test + public void testAllowAll() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .deny("Rule 1").read().resourcesOfType(Patient.class).withAnyId().andThen() + .allowAll("Default Rule") + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + ourHitMethod = false; + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation/10"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by rule: Rule 1")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$validate"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + /** + * #528 + */ + @Test + public void testAllowByCompartmentWithAnyType() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder().allow("Rule 1").read().allResources().inCompartment("Patient", new IdType("Patient/845bd9f1-3635-4866-a6c8-1ca085df5c1a")).andThen().denyAll().build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + + ourHitMethod = false; + ourReturn = Collections.singletonList(createCarePlan(10, "845bd9f1-3635-4866-a6c8-1ca085df5c1a")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/CarePlan/135154"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + ourReturn = Collections.singletonList(createCarePlan(10, "FOO")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/CarePlan/135154"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + /** + * #528 + */ + @Test + public void testAllowByCompartmentWithType() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder().allow("Rule 1").read().resourcesOfType(CarePlan.class).inCompartment("Patient", new IdType("Patient/845bd9f1-3635-4866-a6c8-1ca085df5c1a")).andThen().denyAll() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + + ourHitMethod = false; + ourReturn = Collections.singletonList(createCarePlan(10, "845bd9f1-3635-4866-a6c8-1ca085df5c1a")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/CarePlan/135154"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + ourReturn = Collections.singletonList(createCarePlan(10, "FOO")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/CarePlan/135154"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + } + + @Test + public void testBatchWhenOnlyTransactionAllowed() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").transaction().withAnyOperation().andApplyNormalRules().andThen() + .allow("Rule 2").write().allResources().inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").read().allResources().inCompartment("Patient", new IdType("Patient/1")).andThen() + .build(); + } + }); + + Bundle input = new Bundle(); + input.setType(Bundle.BundleType.BATCH); + input.addEntry().setResource(createPatient(1)).getRequest().setUrl("/Patient").setMethod(Bundle.HTTPVerb.POST); + + Bundle output = new Bundle(); + output.setType(Bundle.BundleType.TRANSACTIONRESPONSE); + output.addEntry().getResponse().setLocation("/Patient/1"); + + HttpPost httpPost; + HttpResponse status; + + ourReturn = Collections.singletonList((Resource) output); + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/"); + httpPost.setEntity(createFhirResourceEntity(input)); + status = ourClient.execute(httpPost); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + } + + @Test + public void testBatchWhenTransactionReadDenied() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").transaction().withAnyOperation().andApplyNormalRules().andThen() + .allow("Rule 2").write().allResources().inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").read().allResources().inCompartment("Patient", new IdType("Patient/1")).andThen() + .build(); + } + }); + + Bundle input = new Bundle(); + input.setType(Bundle.BundleType.BATCH); + input.addEntry().setResource(createPatient(1)).getRequest().setUrl("/Patient").setMethod(Bundle.HTTPVerb.POST); + + Bundle output = new Bundle(); + output.setType(Bundle.BundleType.TRANSACTIONRESPONSE); + output.addEntry().setResource(createPatient(2)); + + HttpPost httpPost; + HttpResponse status; + + ourReturn = Collections.singletonList((Resource) output); + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/"); + httpPost.setEntity(createFhirResourceEntity(input)); + status = ourClient.execute(httpPost); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + } + + @Test + public void testBatchWhenTransactionWrongBundleType() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").transaction().withAnyOperation().andApplyNormalRules().andThen() + .allow("Rule 2").write().allResources().inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").read().allResources().inCompartment("Patient", new IdType("Patient/1")).andThen() + .build(); + } + }); + + Bundle input = new Bundle(); + input.setType(Bundle.BundleType.COLLECTION); + input.addEntry().setResource(createPatient(1)).getRequest().setUrl("/Patient").setMethod(Bundle.HTTPVerb.POST); + + Bundle output = new Bundle(); + output.setType(Bundle.BundleType.TRANSACTIONRESPONSE); + output.addEntry().setResource(createPatient(1)); + + HttpPost httpPost; + HttpResponse status; + String response; + + ourReturn = Collections.singletonList((Resource) output); + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/"); + httpPost.setEntity(createFhirResourceEntity(input)); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + } + + @Test + public void testDeleteByCompartment() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").delete().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").delete().resourcesOfType(Observation.class).inCompartment("Patient", new IdType("Patient/1")) + .build(); + } + }); + + HttpDelete httpDelete; + HttpResponse status; + + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpDelete = new HttpDelete("http://localhost:" + ourPort + "/Patient/2"); + status = ourClient.execute(httpDelete); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(1)); + httpDelete = new HttpDelete("http://localhost:" + ourPort + "/Patient/1"); + status = ourClient.execute(httpDelete); + extractResponseAndClose(status); + assertEquals(204, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + } + + @Test + public void testDenyAll() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow().read().resourcesOfType(Patient.class).withAnyId().andThen() + .denyAll("Default Rule") + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation/10"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by rule: Default Rule")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$validate"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by rule: Default Rule")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by rule: Default Rule")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + } + + /** + * #528 + */ + @Test + public void testDenyByCompartmentWithAnyType() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder().deny("Rule 1").read().allResources().inCompartment("Patient", new IdType("Patient/845bd9f1-3635-4866-a6c8-1ca085df5c1a")).andThen().allowAll().build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + + ourHitMethod = false; + ourReturn = Collections.singletonList(createCarePlan(10, "845bd9f1-3635-4866-a6c8-1ca085df5c1a")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/CarePlan/135154"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + ourReturn = Collections.singletonList(createCarePlan(10, "FOO")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/CarePlan/135154"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + /** + * #528 + */ + @Test + public void testDenyByCompartmentWithType() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder().deny("Rule 1").read().resourcesOfType(CarePlan.class).inCompartment("Patient", new IdType("Patient/845bd9f1-3635-4866-a6c8-1ca085df5c1a")).andThen().allowAll() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + + ourHitMethod = false; + ourReturn = Collections.singletonList(createCarePlan(10, "845bd9f1-3635-4866-a6c8-1ca085df5c1a")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/CarePlan/135154"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + ourReturn = Collections.singletonList(createCarePlan(10, "FOO")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/CarePlan/135154"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + } + + @Test + public void testHistoryWithReadAll() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").read().allResources().withAnyId() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + + ourReturn = Collections.singletonList(createPatient(2, 1)); + + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/_history"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/_history"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/_history"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + } + + @Test + public void testMetadataAllow() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").metadata() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + + ourReturn = Collections.singletonList(createPatient(2)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/metadata"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + } + + @Test + public void testMetadataDeny() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.ALLOW) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .deny("Rule 1").metadata() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + + ourReturn = Collections.singletonList(createPatient(2)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/metadata"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + } + + @Test + public void testOperationAnyName() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("RULE 1").operation().withAnyName().onServer().andThen() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + + // Server + ourHitMethod = false; + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/$opName"); + status = ourClient.execute(httpGet); + String response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + @Test + public void testOperationByInstanceOfTypeAllowed() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").operation().named("everything").onInstancesOfType(Patient.class) + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + ourReturn = new ArrayList<>(); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$everything"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("Bundle")); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(true, ourHitMethod); + + ourReturn = new ArrayList<>(); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Encounter/1/$everything"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("OperationOutcome")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(false, ourHitMethod); + + } + + @Test + public void testOperationByInstanceOfTypeWithInvalidReturnValue() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").operation().named("everything").onInstancesOfType(Patient.class).andThen() + .allow("Rule 2").read().allResources().inCompartment("Patient", new IdType("Patient/1")).andThen() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + // With a return value we don't allow + ourReturn = Collections.singletonList(createPatient(222)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$everything"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("OperationOutcome")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(true, ourHitMethod); + + // With a return value we do + ourReturn = Collections.singletonList(createPatient(1)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$everything"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("Bundle")); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(true, ourHitMethod); + + } + + @Test + public void testOperationByInstanceOfTypeWithReturnValue() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").operation().named("everything").onInstancesOfType(Patient.class) + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + ourReturn = new ArrayList<>(); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$everything"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("Bundle")); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertEquals(true, ourHitMethod); + + ourReturn = new ArrayList<>(); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Encounter/1/$everything"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("OperationOutcome")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(false, ourHitMethod); + } + + @Test + public void testOperationInstanceLevel() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("RULE 1").operation().named("opName").onInstance(new IdType("http://example.com/Patient/1/_history/2")).andThen() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + // Server + ourHitMethod = false; + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Type + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Instance + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + // Wrong instance + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + } + + @Test + public void testOperationInstanceLevelAnyInstance() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("RULE 1").operation().named("opName").onAnyInstance().andThen() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + // Server + ourHitMethod = false; + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Type + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Instance + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + // Another Instance + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation/2/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + // Wrong name + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2/$opName2"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + } + + @Test + public void testOperationNotAllowedWithWritePermissiom() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("RULE 1").write().allResources().withAnyId().andThen() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + // Server + ourHitMethod = false; + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // System + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Type + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Instance + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/123/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + } + + @Test + public void testOperationServerLevel() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("RULE 1").operation().named("opName").onServer().andThen() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + // Server + ourHitMethod = false; + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/$opName"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + // Type + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Instance + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + } + + @Test + public void testOperationTypeLevel() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("RULE 1").operation().named("opName").onType(Patient.class).andThen() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + // Server + ourHitMethod = false; + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Type + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + // Wrong type + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation/1/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Wrong name + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$opName2"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Instance + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + } + + @Test + public void testOperationTypeLevelWildcard() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("RULE 1").operation().named("opName").onAnyType().andThen() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + // Server + ourHitMethod = false; + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + httpGet = new HttpGet("http://localhost:" + ourPort + "/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Type + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + // Another type + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + // Wrong name + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/$opName2"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + // Instance + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/$opName"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + } + + @Test + public void testReadByAnyId() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").read().resourcesOfType(Patient.class).withAnyId() + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + ourReturn = Collections.singletonList(createPatient(2)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Collections.singletonList(createPatient(2)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1/_history/222"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation/10"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy (no applicable rules)")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + ourReturn = Arrays.asList(createPatient(1), createObservation(10, "Patient/2")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy (no applicable rules)")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Arrays.asList(createPatient(2), createObservation(10, "Patient/1")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy (no applicable rules)")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + @Test + public void testReadByCompartmentRight() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").read().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").read().resourcesOfType(Observation.class).inCompartment("Patient", new IdType("Patient/1")) + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + + ourReturn = Collections.singletonList(createPatient(1)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Collections.singletonList(createObservation(10, "Patient/1")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation/10"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Arrays.asList(createPatient(1), createObservation(10, "Patient/1")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient"); + status = ourClient.execute(httpGet); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + @Test + public void testReadPageRight() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").read().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")) + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String respString; + Bundle respBundle; + + ourReturn = new ArrayList<>(); + for (int i = 0; i < 10; i++) { + ourReturn.add(createPatient(1)); + } + + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_count=5&_format=json"); + status = ourClient.execute(httpGet); + respString = extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + respBundle = ourCtx.newJsonParser().parseResource(Bundle.class, respString); + assertEquals(5, respBundle.getEntry().size()); + assertEquals(10, respBundle.getTotal()); + assertEquals("Patient/1", respBundle.getEntry().get(0).getResource().getIdElement().toUnqualifiedVersionless().getValue()); + assertNotNull(respBundle.getLink("next")); + + // Load next page + + ourHitMethod = false; + httpGet = new HttpGet(respBundle.getLink("next").getUrl()); + status = ourClient.execute(httpGet); + respString = extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + respBundle = ourCtx.newJsonParser().parseResource(Bundle.class, respString); + assertEquals(5, respBundle.getEntry().size()); + assertEquals(10, respBundle.getTotal()); + assertEquals("Patient/1", respBundle.getEntry().get(0).getResource().getIdElement().toUnqualifiedVersionless().getValue()); + assertNull(respBundle.getLink("next")); + + } + + @Test + public void testReadPageWrong() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").read().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")) + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String respString; + Bundle respBundle; + + ourReturn = new ArrayList<>(); + for (int i = 0; i < 5; i++) { + ourReturn.add(createPatient(1)); + } + for (int i = 0; i < 5; i++) { + ourReturn.add(createPatient(2)); + } + + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_count=5&_format=json"); + status = ourClient.execute(httpGet); + respString = extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + respBundle = ourCtx.newJsonParser().parseResource(Bundle.class, respString); + assertEquals(5, respBundle.getEntry().size()); + assertEquals(10, respBundle.getTotal()); + assertEquals("Patient/1", respBundle.getEntry().get(0).getResource().getIdElement().toUnqualifiedVersionless().getValue()); + assertNotNull(respBundle.getLink("next")); + + // Load next page + + ourHitMethod = false; + httpGet = new HttpGet(respBundle.getLink("next").getUrl()); + status = ourClient.execute(httpGet); + respString = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + } + + @Test + public void testReadByCompartmentWrong() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").read().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").read().resourcesOfType(Observation.class).inCompartment("Patient", new IdType("Patient/1")) + .build(); + } + }); + + HttpGet httpGet; + HttpResponse status; + String response; + + ourReturn = Collections.singletonList(createPatient(2)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy (no applicable rules)")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Collections.singletonList(createObservation(10, "Patient/2")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation/10"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy (no applicable rules)")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Collections.singletonList(createCarePlan(10, "Patient/2")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/CarePlan/10"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy (no applicable rules)")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + ourReturn = Arrays.asList(createPatient(1), createObservation(10, "Patient/2")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy (no applicable rules)")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Arrays.asList(createPatient(2), createObservation(10, "Patient/1")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + ourLog.info(response); + assertThat(response, containsString("Access denied by default policy (no applicable rules)")); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + @Test + public void testTransactionWriteGood() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").transaction().withAnyOperation().andApplyNormalRules().andThen() + .allow("Rule 2").write().allResources().inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").read().allResources().inCompartment("Patient", new IdType("Patient/1")).andThen() + .build(); + } + }); + + Bundle input = new Bundle(); + input.setType(Bundle.BundleType.TRANSACTION); + input.addEntry().setResource(createPatient(1)).getRequest().setUrl("/Patient").setMethod(Bundle.HTTPVerb.PUT); + + Bundle output = new Bundle(); + output.setType(Bundle.BundleType.TRANSACTIONRESPONSE); + output.addEntry().getResponse().setLocation("/Patient/1"); + + HttpPost httpPost; + HttpResponse status; + + ourReturn = Collections.singletonList((Resource) output); + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/"); + httpPost.setEntity(createFhirResourceEntity(input)); + status = ourClient.execute(httpPost); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + } + + @Test + public void testWriteByCompartmentCreate() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").write().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 1b").write().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1123")).andThen() + .allow("Rule 2").write().resourcesOfType(Observation.class).inCompartment("Patient", new IdType("Patient/1")) + .build(); + } + }); + + HttpEntityEnclosingRequestBase httpPost; + HttpResponse status; + String response; + + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient"); + httpPost.setEntity(createFhirResourceEntity(createPatient(null))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + assertFalse(ourHitMethod); + + // Conditional + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient"); + httpPost.addHeader("If-None-Exist", "Patient?foo=bar"); + httpPost.setEntity(createFhirResourceEntity(createPatient(null))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + assertFalse(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/Observation"); + httpPost.setEntity(createFhirResourceEntity(createObservation(null, "Patient/2"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + assertFalse(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/Observation"); + httpPost.setEntity(createFhirResourceEntity(createObservation(null, "Patient/1"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(201, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + } + + @Test + public void testWriteByCompartmentCreateConditionalResolvesToValid() throws Exception { + ourConditionalCreateId = "1"; + + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").write().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").createConditional().resourcesOfType(Patient.class) + .build(); + } + }); + + HttpEntityEnclosingRequestBase httpPost; + HttpResponse status; + + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient"); + httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "foo=bar"); + httpPost.setEntity(createFhirResourceEntity(createPatient(null))); + status = ourClient.execute(httpPost); + String response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(201, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + @Test + public void testWriteByCompartmentDeleteConditionalResolvesToValid() throws Exception { + ourConditionalCreateId = "1"; + + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").delete().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").deleteConditional().resourcesOfType(Patient.class) + .build(); + } + }); + + HttpDelete httpDelete; + HttpResponse status; + + ourReturn = Collections.singletonList(createPatient(1)); + + ourHitMethod = false; + httpDelete = new HttpDelete("http://localhost:" + ourPort + "/Patient?foo=bar"); + status = ourClient.execute(httpDelete); + String response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(204, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + @Test + public void testWriteByCompartmentDeleteConditionalWithoutDirectMatch() throws Exception { + ourConditionalCreateId = "1"; + + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 2").deleteConditional().resourcesOfType(Patient.class) + .build(); + } + }); + + HttpDelete httpDelete; + HttpResponse status; + + ourReturn = Collections.singletonList(createPatient(1)); + + ourHitMethod = false; + httpDelete = new HttpDelete("http://localhost:" + ourPort + "/Patient?foo=bar"); + status = ourClient.execute(httpDelete); + String response = extractResponseAndClose(status); + ourLog.info(response); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + } + + @Test + public void testWriteByCompartmentDoesntAllowDelete() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").write().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").write().resourcesOfType(Observation.class).inCompartment("Patient", new IdType("Patient/1")) + .build(); + } + }); + + HttpDelete httpDelete; + HttpResponse status; + + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(2)); + httpDelete = new HttpDelete("http://localhost:" + ourPort + "/Patient/2"); + status = ourClient.execute(httpDelete); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + ourReturn = Collections.singletonList(createPatient(1)); + httpDelete = new HttpDelete("http://localhost:" + ourPort + "/Patient/1"); + status = ourClient.execute(httpDelete); + extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + } + + @Test + public void testWriteByCompartmentUpdate() throws Exception { + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").write().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").write().resourcesOfType(Observation.class).inCompartment("Patient", new IdType("Patient/1")) + .build(); + } + }); + + HttpEntityEnclosingRequestBase httpPost; + String response; + HttpResponse status; + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Patient/2"); + httpPost.setEntity(createFhirResourceEntity(createPatient(2))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(ERR403, response); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Patient/1"); + httpPost.setEntity(createFhirResourceEntity(createPatient(1))); + status = ourClient.execute(httpPost); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + // Conditional + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Patient?foo=bar"); + httpPost.setEntity(createFhirResourceEntity(createPatient(1))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(ERR403, response); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Patient?foo=bar"); + httpPost.setEntity(createFhirResourceEntity(createPatient(99))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(ERR403, response); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Observation/10"); + httpPost.setEntity(createFhirResourceEntity(createObservation(10, "Patient/1"))); + status = ourClient.execute(httpPost); + extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Observation/10"); + httpPost.setEntity(createFhirResourceEntity(createObservation(10, "Patient/2"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(ERR403, response); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + } + + @Test + public void testWriteByCompartmentUpdateConditionalResolvesToInvalid() throws Exception { + ourConditionalCreateId = "1123"; + + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").write().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").write().resourcesOfType(Observation.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 3").updateConditional().resourcesOfType(Patient.class) + .build(); + } + }); + + HttpEntityEnclosingRequestBase httpPost; + HttpResponse status; + String response; + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Patient?foo=bar"); + httpPost.setEntity(createFhirResourceEntity(createPatient(null))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + assertTrue(ourHitMethod); + + } + + @Test + public void testWriteByCompartmentUpdateConditionalResolvesToValid() throws Exception { + ourConditionalCreateId = "1"; + + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").write().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").write().resourcesOfType(Observation.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 3").updateConditional().resourcesOfType(Patient.class) + .build(); + } + }); + + HttpEntityEnclosingRequestBase httpPost; + HttpResponse status; + String response; + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Patient?foo=bar"); + httpPost.setEntity(createFhirResourceEntity(createPatient(null))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Observation?foo=bar"); + httpPost.setEntity(createFhirResourceEntity(createObservation(null, "Patient/12"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + assertFalse(ourHitMethod); + + } + + @Test + public void testWriteByCompartmentUpdateConditionalResolvesToValidAllTypes() throws Exception { + ourConditionalCreateId = "1"; + + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").write().resourcesOfType(Patient.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 2").write().resourcesOfType(Observation.class).inCompartment("Patient", new IdType("Patient/1")).andThen() + .allow("Rule 3").updateConditional().allResources() + .build(); + } + }); + + HttpEntityEnclosingRequestBase httpPost; + HttpResponse status; + String response; + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Patient?foo=bar"); + httpPost.setEntity(createFhirResourceEntity(createPatient(null))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Observation?foo=bar"); + httpPost.setEntity(createFhirResourceEntity(createObservation(null, "Patient/12"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + assertTrue(ourHitMethod); + + } + + @Test + public void testInvalidInstanceIds() throws Exception { + try { + new RuleBuilder().allow("Rule 1").write().instance((String) null); + fail(); + } catch (NullPointerException e) { + assertEquals("theId must not be null or empty", e.getMessage()); + } + try { + new RuleBuilder().allow("Rule 1").write().instance(""); + fail(); + } catch (IllegalArgumentException e) { + assertEquals("theId must not be null or empty", e.getMessage()); + } + try { + new RuleBuilder().allow("Rule 1").write().instance("Observation/"); + fail(); + } catch (IllegalArgumentException e) { + assertEquals("theId must contain an ID part", e.getMessage()); + } + try { + new RuleBuilder().allow("Rule 1").write().instance(new IdType()); + fail(); + } catch (NullPointerException e) { + assertEquals("theId.getValue() must not be null or empty", e.getMessage()); + } + try { + new RuleBuilder().allow("Rule 1").write().instance(new IdType("")); + fail(); + } catch (NullPointerException e) { + assertEquals("theId.getValue() must not be null or empty", e.getMessage()); + } + try { + new RuleBuilder().allow("Rule 1").write().instance(new IdType("Observation", (String) null)); + fail(); + } catch (NullPointerException e) { + assertEquals("theId must contain an ID part", e.getMessage()); + } + } + + @Test + public void testWritePatchByInstance() throws Exception { + ourConditionalCreateId = "1"; + + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").write().instance("Patient/900").andThen() + .build(); + } + }); + + HttpEntityEnclosingRequestBase httpPost; + HttpResponse status; + String response; + + String input = "[ { \"op\": \"replace\", \"path\": \"/gender\", \"value\": \"male\" } ]"; + + ourHitMethod = false; + httpPost = new HttpPatch("http://localhost:" + ourPort + "/Patient/900"); + httpPost.setEntity(new StringEntity(input, ContentType.parse("application/json-patch+json"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(204, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPatch("http://localhost:" + ourPort + "/Patient/999"); + httpPost.setEntity(new StringEntity(input, ContentType.parse("application/json-patch+json"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertFalse(ourHitMethod); + } + + @Test + public void testWriteByInstance() throws Exception { + ourConditionalCreateId = "1"; + + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").write().instance("Observation/900").andThen() + .allow("Rule 1").write().instance("901").andThen() + .build(); + } + }); + + HttpEntityEnclosingRequestBase httpPost; + HttpResponse status; + String response; + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Observation/900"); + httpPost.setEntity(createFhirResourceEntity(createObservation(900, "Patient/12"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPut("http://localhost:" + ourPort + "/Observation/901"); + httpPost.setEntity(createFhirResourceEntity(createObservation(901, "Patient/12"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/Observation"); + httpPost.setEntity(createFhirResourceEntity(createObservation(null, "Patient/900"))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + assertFalse(ourHitMethod); + + ourHitMethod = false; + httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient"); + httpPost.setEntity(createFhirResourceEntity(createPatient(null))); + status = ourClient.execute(httpPost); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + assertFalse(ourHitMethod); + + } + + @Test + public void testReadByInstance() throws Exception { + ourConditionalCreateId = "1"; + + ourServlet.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) { + @Override + public List<IAuthRule> buildRuleList(RequestDetails theRequestDetails) { + return new RuleBuilder() + .allow("Rule 1").read().instance("Observation/900").andThen() + .allow("Rule 1").read().instance("901").andThen() + .build(); + } + }); + + HttpResponse status; + String response; + HttpGet httpGet; + + ourReturn = Collections.singletonList(createObservation(900, "Patient/1")); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation/900"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Collections.singletonList(createPatient(901)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/901"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertEquals(200, status.getStatusLine().getStatusCode()); + assertTrue(ourHitMethod); + + ourReturn = Collections.singletonList(createPatient(1)); + ourHitMethod = false; + httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/1?_format=json"); + status = ourClient.execute(httpGet); + response = extractResponseAndClose(status); + assertEquals(403, status.getStatusLine().getStatusCode()); + assertEquals(ERR403, response); + assertFalse(ourHitMethod); + + } + + @AfterClass + public static void afterClassClearContext() throws Exception { + ourServer.stop(); + TestUtil.clearAllStaticFieldsForUnitTest(); + } + + @BeforeClass + public static void beforeClass() throws Exception { + + ourPort = PortUtil.findFreePort(); + ourServer = new Server(ourPort); + + DummyPatientResourceProvider patProvider = new DummyPatientResourceProvider(); + DummyObservationResourceProvider obsProv = new DummyObservationResourceProvider(); + DummyEncounterResourceProvider encProv = new DummyEncounterResourceProvider(); + DummyCarePlanResourceProvider cpProv = new DummyCarePlanResourceProvider(); + PlainProvider plainProvider = new PlainProvider(); + + ServletHandler proxyHandler = new ServletHandler(); + ourServlet = new RestfulServer(ourCtx); + ourServlet.setFhirContext(ourCtx); + ourServlet.setResourceProviders(patProvider, obsProv, encProv, cpProv); + ourServlet.setPlainProviders(plainProvider); + ourServlet.setPagingProvider(new FifoMemoryPagingProvider(100)); + ServletHolder servletHolder = new ServletHolder(ourServlet); + proxyHandler.addServletWithMapping(servletHolder, "/*"); + ourServer.setHandler(proxyHandler); + ourServer.start(); + + PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS); + HttpClientBuilder builder = HttpClientBuilder.create(); + builder.setConnectionManager(connectionManager); + ourClient = builder.build(); + + } + + public static class DummyCarePlanResourceProvider implements IResourceProvider { + + @Override + public Class<? extends IBaseResource> getResourceType() { + return CarePlan.class; + } + + @Read(version = true) + public CarePlan read(@IdParam IdType theId) { + ourHitMethod = true; + return (CarePlan) ourReturn.get(0); + } + + @Search() + public List<Resource> search() { + ourHitMethod = true; + return ourReturn; + } + } + + public static class DummyEncounterResourceProvider implements IResourceProvider { + + @Operation(name = "everything", idempotent = true) + public Bundle everything(@IdParam IdType theId) { + ourHitMethod = true; + Bundle retVal = new Bundle(); + for (Resource next : ourReturn) { + retVal.addEntry().setResource(next); + } + return retVal; + } + + @Override + public Class<? extends IBaseResource> getResourceType() { + return Encounter.class; + } + } + + public static class DummyObservationResourceProvider implements IResourceProvider { + + @Create() + public MethodOutcome create(@ResourceParam Observation theResource, @ConditionalUrlParam String theConditionalUrl) { + ourHitMethod = true; + theResource.setId("Observation/1/_history/1"); + MethodOutcome retVal = new MethodOutcome(); + retVal.setCreated(true); + retVal.setResource(theResource); + return retVal; + } + + @Delete() + public MethodOutcome delete(@IdParam IdType theId) { + ourHitMethod = true; + MethodOutcome retVal = new MethodOutcome(); + return retVal; + } + + @Override + public Class<? extends IBaseResource> getResourceType() { + return Observation.class; + } + + @Operation(name = "opName", idempotent = true) + public Parameters operation() { + ourHitMethod = true; + return (Parameters) new Parameters().setId("1"); + } + + @Operation(name = "opName", idempotent = true) + public Parameters operation(@IdParam IdType theId) { + ourHitMethod = true; + return (Parameters) new Parameters().setId("1"); + } + + @Read(version = true) + public Observation read(@IdParam IdType theId) { + ourHitMethod = true; + return (Observation) ourReturn.get(0); + } + + @Search() + public List<Resource> search() { + ourHitMethod = true; + return ourReturn; + } + + @Update() + public MethodOutcome update(@IdParam IdType theId, @ResourceParam Observation theResource, @ConditionalUrlParam String theConditionalUrl, RequestDetails theRequestDetails) { + ourHitMethod = true; + + if (isNotBlank(theConditionalUrl)) { + IdType actual = new IdType("Observation", ourConditionalCreateId); + ActionRequestDetails subRequest = new ActionRequestDetails(theRequestDetails, actual); + subRequest.notifyIncomingRequestPreHandled(RestOperationTypeEnum.UPDATE); + theResource.setId(actual); + } else { + ActionRequestDetails subRequest = new ActionRequestDetails(theRequestDetails, theResource); + subRequest.notifyIncomingRequestPreHandled(RestOperationTypeEnum.UPDATE); + theResource.setId(theId.withVersion("2")); + } + + MethodOutcome retVal = new MethodOutcome(); + retVal.setResource(theResource); + return retVal; + } + + } + + public static class DummyPatientResourceProvider implements IResourceProvider { + + @Create() + public MethodOutcome create(@ResourceParam Patient theResource, @ConditionalUrlParam String theConditionalUrl, RequestDetails theRequestDetails) { + + if (isNotBlank(theConditionalUrl)) { + IdType actual = new IdType("Patient", ourConditionalCreateId); + ActionRequestDetails subRequest = new ActionRequestDetails(theRequestDetails, actual); + subRequest.notifyIncomingRequestPreHandled(RestOperationTypeEnum.CREATE); + } else { + ActionRequestDetails subRequest = new ActionRequestDetails(theRequestDetails, theResource); + subRequest.notifyIncomingRequestPreHandled(RestOperationTypeEnum.CREATE); + } + + ourHitMethod = true; + theResource.setId("Patient/1/_history/1"); + MethodOutcome retVal = new MethodOutcome(); + retVal.setCreated(true); + retVal.setResource(theResource); + return retVal; + } + + @Delete() + public MethodOutcome delete(IRequestOperationCallback theRequestOperationCallback, @IdParam IdType theId, @ConditionalUrlParam String theConditionalUrl, RequestDetails theRequestDetails) { + ourHitMethod = true; + for (IBaseResource next : ourReturn) { + theRequestOperationCallback.resourceDeleted(next); + } + MethodOutcome retVal = new MethodOutcome(); + return retVal; + } + + @Operation(name = "everything", idempotent = true) + public Bundle everything(@IdParam IdType theId) { + ourHitMethod = true; + Bundle retVal = new Bundle(); + for (Resource next : ourReturn) { + retVal.addEntry().setResource(next); + } + return retVal; + } + + @Override + public Class<? extends IBaseResource> getResourceType() { + return Patient.class; + } + + @History() + public List<Resource> history() { + ourHitMethod = true; + return (ourReturn); + } + + @History() + public List<Resource> history(@IdParam IdType theId) { + ourHitMethod = true; + return (ourReturn); + } + + @Operation(name = "opName", idempotent = true) + public Parameters operation() { + ourHitMethod = true; + return (Parameters) new Parameters().setId("1"); + } + + @Operation(name = "opName", idempotent = true) + public Parameters operation(@IdParam IdType theId) { + ourHitMethod = true; + return (Parameters) new Parameters().setId("1"); + } + + @Operation(name = "opName2", idempotent = true) + public Parameters operation2(@IdParam IdType theId) { + ourHitMethod = true; + return (Parameters) new Parameters().setId("1"); + } + + @Operation(name = "opName2", idempotent = true) + public Parameters operation2() { + ourHitMethod = true; + return (Parameters) new Parameters().setId("1"); + } + + @Read(version = true) + public Patient read(@IdParam IdType theId) { + ourHitMethod = true; + return (Patient) ourReturn.get(0); + } + + @Search() + public List<Resource> search() { + ourHitMethod = true; + return ourReturn; + } + + @Update() + public MethodOutcome update(@IdParam IdType theId, @ResourceParam Patient theResource, @ConditionalUrlParam String theConditionalUrl, RequestDetails theRequestDetails) { + ourHitMethod = true; + + if (isNotBlank(theConditionalUrl)) { + IdType actual = new IdType("Patient", ourConditionalCreateId); + ActionRequestDetails subRequest = new ActionRequestDetails(theRequestDetails, actual); + subRequest.notifyIncomingRequestPreHandled(RestOperationTypeEnum.UPDATE); + theResource.setId(actual); + } else { + ActionRequestDetails subRequest = new ActionRequestDetails(theRequestDetails, theResource); + subRequest.notifyIncomingRequestPreHandled(RestOperationTypeEnum.UPDATE); + theResource.setId(theId.withVersion("2")); + } + + MethodOutcome retVal = new MethodOutcome(); + retVal.setResource(theResource); + return retVal; + } + + @Patch() + public MethodOutcome patch(@IdParam IdType theId, @ResourceParam String theResource, PatchTypeEnum thePatchType) { + ourHitMethod = true; + + MethodOutcome retVal = new MethodOutcome(); + return retVal; + } + + @Validate + public MethodOutcome validate(@ResourceParam Patient theResource, @IdParam IdType theId, @ResourceParam String theRawResource, @ResourceParam EncodingEnum theEncoding, + @Validate.Mode ValidationModeEnum theMode, @Validate.Profile String theProfile, RequestDetails theRequestDetails) { + ourHitMethod = true; + OperationOutcome oo = new OperationOutcome(); + oo.addIssue().setDiagnostics("OK"); + return new MethodOutcome(oo); + } + + @Validate + public MethodOutcome validate(@ResourceParam Patient theResource, @ResourceParam String theRawResource, @ResourceParam EncodingEnum theEncoding, @Validate.Mode ValidationModeEnum theMode, + @Validate.Profile String theProfile, RequestDetails theRequestDetails) { + ourHitMethod = true; + OperationOutcome oo = new OperationOutcome(); + oo.addIssue().setDiagnostics("OK"); + return new MethodOutcome(oo); + } + + } + + public static class PlainProvider { + + @History() + public List<Resource> history() { + ourHitMethod = true; + return (ourReturn); + } + + @Operation(name = "opName", idempotent = true) + public Parameters operation() { + ourHitMethod = true; + return (Parameters) new Parameters().setId("1"); + } + + @Transaction() + public Bundle search(@TransactionParam Bundle theInput) { + ourHitMethod = true; + return (Bundle) ourReturn.get(0); + } + + } + +} diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java index caf5b0f169b..32267a6a2d9 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java @@ -24,10 +24,36 @@ public class GraphQLEngineTest { private static FhirContext ourCtx; private org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GraphQLEngineTest.class); - @BeforeClass - public static void beforeClass() { - ourCtx = FhirContext.forR4(); - ourWorkerCtx = new HapiWorkerContext(ourCtx, new DefaultProfileValidationSupport()); + private Observation createObservation() { + Observation obs = new Observation(); + obs.setId("http://foo.com/Patient/PATA"); + obs.setValue(new Quantity().setValue(123).setUnit("cm")); + obs.setSubject(new Reference("Patient/123")); + return obs; + } + + private IGraphQLStorageServices<Resource, Reference, Bundle> createStorageServices() throws FHIRException { + IGraphQLStorageServices<Resource, Reference, Bundle> retVal = mock(IGraphQLStorageServices.class); + when(retVal.lookup(any(Object.class), any(Resource.class), any(Reference.class))).thenAnswer(new Answer<Object>() { + @Override + public Object answer(InvocationOnMock invocation) throws Throwable { + Object appInfo = invocation.getArguments()[0]; + Resource context = (Resource) invocation.getArguments()[1]; + Reference reference = (Reference) invocation.getArguments()[2]; + ourLog.info("AppInfo: {} / Context: {} / Reference: {}", appInfo, context.getId(), reference.getReference()); + + if (reference.getReference().equalsIgnoreCase("Patient/123")) { + Patient p = new Patient(); + p.getBirthDateElement().setValueAsString("2011-02-22"); + return new ReferenceResolution<>(context, p); + } + + ourLog.info("Not found!"); + return null; + } + }); + + return retVal; } @Test @@ -50,18 +76,10 @@ public class GraphQLEngineTest { " \"unit\":\"cm\"\n" + " }\n" + "}"; - assertEquals(expected, outputBuilder.toString()); + assertEquals(TestUtil.stripReturns(expected), TestUtil.stripReturns(outputBuilder.toString())); } - private Observation createObservation() { - Observation obs = new Observation(); - obs.setId("http://foo.com/Patient/PATA"); - obs.setValue(new Quantity().setValue(123).setUnit("cm")); - obs.setSubject(new Reference("Patient/123")); - return obs; - } - @Test public void testReferences() throws EGraphQLException, EGraphEngine, IOException, FHIRException { @@ -95,32 +113,14 @@ public class GraphQLEngineTest { " }\n" + " }\n" + "}"; - assertEquals(expected, outputBuilder.toString()); + assertEquals(TestUtil.stripReturns(expected), TestUtil.stripReturns(outputBuilder.toString())); } - private IGraphQLStorageServices<Resource, Reference, Bundle> createStorageServices() throws FHIRException { - IGraphQLStorageServices<Resource, Reference, Bundle> retVal = mock(IGraphQLStorageServices.class); - when(retVal.lookup(any(Object.class), any(Resource.class), any(Reference.class))).thenAnswer(new Answer<Object>() { - @Override - public Object answer(InvocationOnMock invocation) throws Throwable { - Object appInfo = invocation.getArguments()[0]; - Resource context = (Resource) invocation.getArguments()[1]; - Reference reference = (Reference) invocation.getArguments()[2]; - ourLog.info("AppInfo: {} / Context: {} / Reference: {}", appInfo, context.getId(), reference.getReference()); - - if (reference.getReference().equalsIgnoreCase("Patient/123")) { - Patient p = new Patient(); - p.getBirthDateElement().setValueAsString("2011-02-22"); - return new ReferenceResolution<>(context, p); - } - - ourLog.info("Not found!"); - return null; - } - }); - - return retVal; + @BeforeClass + public static void beforeClass() { + ourCtx = FhirContext.forR4(); + ourWorkerCtx = new HapiWorkerContext(ourCtx, new DefaultProfileValidationSupport()); } } diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/BackboneElementR4Test.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/BackboneElementR4Test.java new file mode 100644 index 00000000000..5270148cfd6 --- /dev/null +++ b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/BackboneElementR4Test.java @@ -0,0 +1,25 @@ +package org.hl7.fhir.r4.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent; +import org.junit.Test; + +public class BackboneElementR4Test { + /** + * Ensuring that IDs of subtypes of BackboneElement get copied when + * the {@link BackboneElement#copy()} method is called + */ + @Test + public void testPatientCommunicationComponentCopy() { + PatientCommunicationComponent pcc1 = new PatientCommunicationComponent(); + pcc1.setId("1001"); + + PatientCommunicationComponent copiedPcc = pcc1.copy(); + String copiedPccID = copiedPcc.getId(); + + assertTrue(copiedPcc instanceof BackboneElement); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedPccID); + } +} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/CodesystemsR4Test.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/CodesystemsR4Test.java new file mode 100644 index 00000000000..d1ae71b29bb --- /dev/null +++ b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/CodesystemsR4Test.java @@ -0,0 +1,35 @@ +package org.hl7.fhir.dstu3.model; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.either; +import static org.hamcrest.Matchers.endsWith; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.util.*; + +import org.apache.commons.lang3.time.FastDateFormat; +import org.hamcrest.Matchers; +import org.junit.*; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.TemporalPrecisionEnum; +import ca.uhn.fhir.parser.DataFormatException; +import ca.uhn.fhir.util.TestUtil; +import ca.uhn.fhir.validation.ValidationResult; + +public class CodesystemsR4Test { + + @Test + public void testCodesystemsPresent() { + org.hl7.fhir.r4.model.codesystems.W3cProvenanceActivityType.class.toString(); + } +} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/DomainResourceR4Test.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/DomainResourceR4Test.java new file mode 100644 index 00000000000..77a802e7d4b --- /dev/null +++ b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/DomainResourceR4Test.java @@ -0,0 +1,26 @@ +package org.hl7.fhir.r4.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class DomainResourceR4Test { + /** + * Ensuring that fields defined in {@link DomainResource} and {@link Resource} + * get copied when the {@link DomainResource#copy()} method is called + */ + @Test + public void testPatientCopy() { + Patient p1 = new Patient(); + p1.setId("1001"); + p1.setText(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL)); + + Patient copiedPatient = p1.copy(); + String copiedPatientID = copiedPatient.getIdElement().getIdPart(); + Narrative.NarrativeStatus copiedPatientTextStatus = copiedPatient.getText().getStatus(); + + assertTrue(copiedPatient instanceof DomainResource); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedPatientID); + assertEquals(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL).getStatus(), copiedPatientTextStatus); + } +} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/MetadataResourceR4Test.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/MetadataResourceR4Test.java new file mode 100644 index 00000000000..11e7ba1401c --- /dev/null +++ b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/MetadataResourceR4Test.java @@ -0,0 +1,29 @@ +package org.hl7.fhir.r4.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.junit.Test; + +public class MetadataResourceR4Test { + /** + * Ensuring that fields defined in {@link MetadataResource}, {@link DomainResource}, and {@link Resource} + * get copied when the {@link MetadataResource#copy()} method is called + */ + @Test + public void testCodeSystemCopy() { + CodeSystem codeSystem1 = new CodeSystem(); + codeSystem1.setId("1001"); + codeSystem1.setName("Name123"); + codeSystem1.setText(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL)); + + CodeSystem copiedCodeSystem = codeSystem1.copy(); + String copiedCodeSystemID = copiedCodeSystem.getId(); + String copiedCodeSystemName = copiedCodeSystem.getName(); + Narrative.NarrativeStatus copiedCodeSystemTextStatus = copiedCodeSystem.getText().getStatus(); + + assertTrue(copiedCodeSystem instanceof MetadataResource); // Just making sure this assumption still holds up, otherwise this test isn't very useful + assertEquals("1001", copiedCodeSystemID); + assertEquals("Name123", copiedCodeSystemName); + assertEquals(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL).getStatus(), copiedCodeSystemTextStatus); + } +} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/AllTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/AllTests.java deleted file mode 100644 index c09bf8c6c7c..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/AllTests.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.hl7.fhir.r4.test; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@RunWith(Suite.class) -@SuiteClasses({ FluentPathTests.class, NarrativeGeneratorTests.class, /*ShexGeneratorTests.class, StructureMapTests.class, */ TurtleTests.class, GraphQLParserTests.class }) -public class AllTests { - -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/FluentPathTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/FluentPathTests.java deleted file mode 100644 index 48138d27ff4..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/FluentPathTests.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.hl7.fhir.r4.test; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.parsers.ParserConfigurationException; - -import org.hl7.fhir.r4.context.SimpleWorkerContext; -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.ExpressionNode; -import org.hl7.fhir.r4.model.PrimitiveType; -import org.hl7.fhir.r4.model.Resource; -import org.hl7.fhir.r4.test.support.TestingUtilities; -import org.hl7.fhir.r4.utils.FHIRPathEngine; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.utilities.xml.XMLUtil; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.SAXException; - -import junit.framework.Assert; - -@RunWith(Parameterized.class) -public class FluentPathTests { - - private static FHIRPathEngine fp; - - @Parameters(name = "{index}: file {0}") - public static Iterable<Object[]> data() throws ParserConfigurationException, SAXException, IOException { - Document dom = XMLUtil.parseFileToDom(Utilities.path(TestingUtilities. home(), "tests", "resources", "tests-fhir-r4.xml")); - - List<Element> list = new ArrayList<Element>(); - List<Element> groups = new ArrayList<Element>(); - XMLUtil.getNamedChildren(dom.getDocumentElement(), "group", groups); - for (Element g : groups) { - XMLUtil.getNamedChildren(g, "test", list); - } - - List<Object[]> objects = new ArrayList<Object[]>(list.size()); - - for (Element e : list) { - objects.add(new Object[] { getName(e), e }); - } - - return objects; - } - - private static Object getName(Element e) { - String s = e.getAttribute("name"); - if (Utilities.noString(s)) { - Element p = (Element) e.getParentNode(); - int ndx = 0; - for (int i = 0; i < p.getChildNodes().getLength(); i++) { - Node c = p.getChildNodes().item(i); - if (c == e) - break; - else if (c instanceof Element) - ndx++; - } - s = p.getAttribute("name")+" - "+Integer.toString(ndx+1); - } - return s; - } - - private final Element test; - private final String name; - - public FluentPathTests(String name, Element e) { - this.name = name; - this.test = e; - } - - @SuppressWarnings("deprecation") - @Test - public void test() throws FileNotFoundException, IOException, FHIRException, org.hl7.fhir.exceptions.FHIRException { - if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.home(), "publish", "definitions.xml.zip")); - if (fp == null) - fp = new FHIRPathEngine(TestingUtilities.context); - String input = test.getAttribute("inputfile"); - String expression = XMLUtil.getNamedChild(test, "expression").getTextContent(); - boolean fail = "true".equals(XMLUtil.getNamedChild(test, "expression").getAttribute("invalid")); - Resource res = null; - - List<Base> outcome = new ArrayList<Base>(); - - ExpressionNode node = fp.parse(expression); - try { - if (Utilities.noString(input)) - fp.check(null, null, node); - else { - res = new XmlParser().parse(new FileInputStream(Utilities.path(TestingUtilities.home(), "publish", input))); - fp.check(res, res.getResourceType().toString(), res.getResourceType().toString(), node); - } - outcome = fp.evaluate(res, node); - Assert.assertTrue(String.format("Expected exception parsing %s", expression), !fail); - } catch (Exception e) { - Assert.assertTrue(String.format("Unexpected exception parsing %s: "+e.getMessage(), expression), fail); - } - - if ("true".equals(test.getAttribute("predicate"))) { - boolean ok = fp.convertToBoolean(outcome); - outcome.clear(); - outcome.add(new BooleanType(ok)); - } - if (fp.hasLog()) - System.out.println(fp.takeLog()); - - List<Element> expected = new ArrayList<Element>(); - XMLUtil.getNamedChildren(test, "output", expected); - Assert.assertTrue(String.format("Expected %d objects but found %d", expected.size(), outcome.size()), outcome.size() == expected.size()); - for (int i = 0; i < Math.min(outcome.size(), expected.size()); i++) { - String tn = expected.get(i).getAttribute("type"); - if (!Utilities.noString(tn)) { - Assert.assertTrue(String.format("Outcome %d: Type should be %s but was %s", i, tn, outcome.get(i).fhirType()), tn.equals(outcome.get(i).fhirType())); - } - String v = expected.get(i).getTextContent(); - if (!Utilities.noString(v)) { - Assert.assertTrue(String.format("Outcome %d: Value should be a primitive type but was %s", i, outcome.get(i).fhirType()), outcome.get(i) instanceof PrimitiveType); - Assert.assertTrue(String.format("Outcome %d: Value should be %s but was %s", i, v, outcome.get(i).toString()), v.equals(((PrimitiveType)outcome.get(i)).asStringValue())); - } - } - } -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/GraphQLParserTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/GraphQLParserTests.java deleted file mode 100644 index 2bb0aba384a..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/GraphQLParserTests.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.hl7.fhir.r4.test; - -import static org.junit.Assert.*; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.parsers.ParserConfigurationException; - -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r4.test.support.TestingUtilities; -import org.hl7.fhir.utilities.TextFile; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.utilities.graphql.EGraphEngine; -import org.hl7.fhir.utilities.graphql.EGraphQLException; -import org.hl7.fhir.utilities.graphql.Package; -import org.hl7.fhir.utilities.graphql.Parser; -import org.hl7.fhir.utilities.xml.XMLUtil; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.xml.sax.SAXException; - -@RunWith(Parameterized.class) -public class GraphQLParserTests { - - @Parameters(name = "{index}: {0}") - public static Iterable<Object[]> data() throws FileNotFoundException, IOException { - String src = TextFile.fileToString(Utilities.path(TestingUtilities.home(), "tests", "graphql", "parser-tests.gql")); - String[] tests = src.split("###"); - int i = 0; - for (String s : tests) - if (!Utilities.noString(s.trim())) - i++; - List<Object[]> objects = new ArrayList<Object[]>(i); - i = 0; - for (String s : tests) { - if (!Utilities.noString(s.trim())) { - int l = s.indexOf('\r'); - objects.add(new Object[] { s.substring(0, l), s.substring(l+2).trim()}); - } - } - return objects; - } - - private final String test; - private final String name; - - public GraphQLParserTests(String name, String test) { - this.name = name; - this.test = test; - } - - @Test - public void test() throws IOException, EGraphQLException, EGraphEngine { - Package doc = Parser.parse(test); - Assert.assertTrue(doc != null); - } - - -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/NarrativeGeneratorTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/NarrativeGeneratorTests.java deleted file mode 100644 index 2204b756416..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/NarrativeGeneratorTests.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.hl7.fhir.r4.test; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - -import org.hl7.fhir.r4.context.SimpleWorkerContext; -import org.hl7.fhir.r4.formats.XmlParser; -import org.hl7.fhir.r4.model.DomainResource; -import org.hl7.fhir.r4.test.support.TestingUtilities; -import org.hl7.fhir.r4.utils.EOperationOutcome; -import org.hl7.fhir.r4.utils.NarrativeGenerator; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.exceptions.FHIRException; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.xmlpull.v1.XmlPullParserException; - -public class NarrativeGeneratorTests { - - private NarrativeGenerator gen; - - @Before - public void setUp() throws FileNotFoundException, IOException, FHIRException { - if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.home(), "publish", "definitions.xml.zip")); - if (gen == null) - gen = new NarrativeGenerator("", null, TestingUtilities.context); - } - - @After - public void tearDown() { - } - - @Test - public void test() throws FileNotFoundException, IOException, XmlPullParserException, EOperationOutcome, FHIRException { - process(Utilities.path(TestingUtilities.home(), "source", "questionnaireresponse", "questionnaireresponse-example-f201-lifelines.xml")); - } - - private void process(String path) throws FileNotFoundException, IOException, XmlPullParserException, EOperationOutcome, FHIRException { - XmlParser p = new XmlParser(); - DomainResource r = (DomainResource) p.parse(new FileInputStream(path)); - gen.generate(r); - FileOutputStream s = new FileOutputStream(Utilities.path(TestingUtilities.temp(), "gen.xml")); - new XmlParser().compose(s, r, true); - s.close(); - - } - -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/ProfileUtilitiesTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/ProfileUtilitiesTests.java deleted file mode 100644 index eb93be56ff1..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/ProfileUtilitiesTests.java +++ /dev/null @@ -1,940 +0,0 @@ -package org.hl7.fhir.r4.test; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.hl7.fhir.r4.conformance.ProfileComparer; -import org.hl7.fhir.r4.conformance.ProfileComparer.ProfileComparison; -import org.hl7.fhir.r4.conformance.ProfileUtilities; -import org.hl7.fhir.r4.context.SimpleWorkerContext; -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.CodeType; -import org.hl7.fhir.r4.model.ElementDefinition; -import org.hl7.fhir.r4.model.ElementDefinition.DiscriminatorType; -import org.hl7.fhir.r4.model.ElementDefinition.SlicingRules; -import org.hl7.fhir.r4.model.Enumerations.BindingStrength; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.StructureDefinition; -import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule; -import org.hl7.fhir.r4.test.support.TestingUtilities; -import org.hl7.fhir.r4.utils.EOperationOutcome; -import org.hl7.fhir.exceptions.DefinitionException; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.exceptions.FHIRFormatError; -import org.hl7.fhir.utilities.CSFile; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.utilities.validation.ValidationMessage; -import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; -import static org.junit.Assert.*; - -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r4.utils.SnomedExpressions; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - - -public class ProfileUtilitiesTests { - -// private String root; -// private SimpleWorkerContext context; -// private ProfileComparer comp; -// -//// public ProfileUtilitiesTests(String root) { -//// super(); -//// this.root = root; -//// } -// -//// public ProfileUtilitiesTests() { -//// super(); -//// root = TestingUtilities.home(); -//// -//// } -// -// public static void main(String[] args) throws EOperationOutcome, Exception { -// // new ProfileUtilitiesTests().execute(args); -// ProfileUtilitiesTests put = new ProfileUtilitiesTests(); -// put.root = "C:\\work\\org.hl7.fhir\\build\\publish"; -// put.testSnapshotGeneration(); -// // StructureDefinition p = (StructureDefinition) new XmlParser().parse(new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\lipid-report-cholesterol.profile.xml")); -// // new ProfileUtilities(context, messages, null).generateSchematrons(new FileOutputStream("c:\\temp\\test.sch"), p); -// } -// -// public void execute(String[] args) throws FileNotFoundException, IOException, FHIRException { -// System.out.println("loading context"); -// context = SimpleWorkerContext.fromPack(Utilities.path(root, "validation.zip")); -// comp = new ProfileComparer(context); -// -// compare("patient-daf-dafpatient.profile.xml", "patient-qicore-qicore-patient.profile.xml"); -// compare("encounter-daf-dafencounter.profile.xml", "encounter-qicore-qicore-encounter.profile.xml"); -// compare("substance-daf-dafsubstance.profile.xml", "substance-qicore-qicore-substance.profile.xml"); -// compare("medication-daf-dafmedication.profile.xml", "medication-qicore-qicore-medication.profile.xml"); -// compare("procedure-daf-dafprocedure.profile.xml", "procedure-qicore-qicore-procedure.profile.xml"); -// compare("familymemberhistory-daf-daffamilymemberhistory.profile.xml", "familymemberhistory-qicore-qicore-familymemberhistory.profile.xml"); -// compare("immunization-daf-dafimmunization.profile.xml", "immunization-qicore-qicore-immunization.profile.xml"); -// compare("condition-daf-dafcondition.profile.xml", "condition-qicore-qicore-condition.profile.xml"); -// compare("allergyintolerance-daf-dafallergyintolerance.profile.xml", "allergyintolerance-qicore-qicore-allergyintolerance.profile.xml"); -// compare("medicationadministration-daf-dafmedicationadministration.profile.xml", "medicationadministration-qicore-qicore-medicationadministration.profile.xml"); -// compare("medicationdispense-daf-dafmedicationdispense.profile.xml", "medicationdispense-qicore-qicore-medicationdispense.profile.xml"); -// compare("medicationprescription-daf-dafmedicationprescription.profile.xml", "medicationprescription-qicore-qicore-medicationprescription.profile.xml"); -// compare("medicationstatement-daf-dafmedicationstatement.profile.xml", "medicationstatement-qicore-qicore-medicationstatement.profile.xml"); -// compare("observation-daf-smokingstatus-dafsmokingstatus.profile.xml", "observation-qicore-qicore-observation.profile.xml"); -// compare("observation-daf-vitalsigns-dafvitalsigns.profile.xml", "observation-qicore-qicore-observation.profile.xml"); -//// compare("observation-daf-results-dafresultobs.profile.xml", "observation-qicore-qicore-observation.profile.xml"); -//// compare("diagnosticorder-daf-dafdiagnosticorder.profile.xml", "diagnosticorder-qicore-qicore-diagnosticorder.profile.xml"); -//// compare("diagnosticreport-daf-dafdiagnosticreport.profile.xml", "diagnosticreport-qicore-qicore-diagnosticreport.profile.xml"); -// -// System.out.println("processing output"); -// for (ProfileComparison outcome : comp.getComparisons()) { -// if (outcome.getSubset() != null) -// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("C:\\temp\\intersection-"+outcome.getId()+".xml"), outcome.getSubset()); -// if (outcome.getSuperset() != null) -// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("C:\\temp\\union-"+outcome.getId()+".xml"), outcome.getSuperset()); -// -// System.out.println("\r\n"+outcome.getId()+": Comparison of "+outcome.getLeft().getUrl()+" and "+outcome.getRight().getUrl()); -// for (ValidationMessage vm : outcome.getMessages()) -// if (vm.getLevel() == IssueSeverity.INFORMATION) -// System.out.println(vm.summary()); -// for (ValidationMessage vm : outcome.getMessages()) -// if (vm.getLevel() == IssueSeverity.WARNING) -// System.out.println(vm.summary()); -// for (ValidationMessage vm : outcome.getMessages()) -// if (vm.getLevel() == IssueSeverity.ERROR) -// System.out.println(vm.summary()); -// for (ValidationMessage vm : outcome.getMessages()) -// if (vm.getLevel() == IssueSeverity.FATAL) -// System.out.println(vm.summary()); -// System.out.println("done. "+Integer.toString(outcome.getMessages().size())+" messages"); -// System.out.println("================================================================="); -// } -// } -// -// private void compare(String fn1, String fn2) throws FHIRFormatError, FileNotFoundException, IOException, DefinitionException { -// System.out.println("Compare "+fn1+" to "+fn2); -// System.out.println(" .. load"); -// StructureDefinition left = (StructureDefinition) new XmlParser().parse(new FileInputStream(Utilities.path(root, fn1))); -// StructureDefinition right = (StructureDefinition) new XmlParser().parse(new FileInputStream(Utilities.path(root, fn2))); -// System.out.println(" .. compare"); -// comp.compareProfiles(left, right); -// -// } -// -// public void testSnapshotGeneration() throws EOperationOutcome, Exception { -// System.out.println("Loading"); -// context = SimpleWorkerContext.fromPack(Utilities.path(root, "definitions.xml.zip")); -// System.out.println("Loaded "+Integer.toString(context.totalCount())+" resources"); -// -// // simple tests -// testSimple(); -// testSimple2(); -// testCardinalityChange(); -// testDocumentationAppend(); -// textTypeNarrowing1(); -// textTypeNarrowing2(); -// testMapping(); -// -// // ok, now we test walking into a new type: -// testTypeWalk(); -// // todo: testTypeWalk2(); -// -// // slicing tests -// testSlicingSimple(); -// testSlicingExtension(false); -// testSlicingExtension(true); -// testSlicingExtensionComplex(true); -// testSlicingExtensionComplex(false); -// testSlicingTask8742(); -// System.out.println("Success"); -// } -// -// /** -// * This is simple: we just create an empty differential, generate the snapshot, and then insist it must match the base -// * -// * @param context2 -// * @ -// * @throws EOperationOutcome -// */ - @Test - public void testSimple() throws FHIRException, FileNotFoundException, IOException { - if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.home(), "publish", "definitions.xml.zip")); - - StructureDefinition focus = new StructureDefinition(); - StructureDefinition base = TestingUtilities.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); - focus.setUrl(Utilities.makeUuidUrn()); - focus.setBaseDefinition(base.getUrl()); - focus.setType("Patient"); - focus.setDerivation(TypeDerivationRule.CONSTRAINT); - List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); - new ProfileUtilities(TestingUtilities.context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test"); - - boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size(); - for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { - ElementDefinition b = base.getSnapshot().getElement().get(i); - ElementDefinition f = focus.getSnapshot().getElement().get(i); - if (ok) { - if (!f.hasBase()) - ok = false; - else if (!b.getPath().equals(f.getPath())) - ok = false; - else { - b.setBase(null); - f.setBase(null); - ok = Base.compareDeep(b, f, true); - } - } - } - - if (!ok) { - compareXml(base, focus); - throw new FHIRException("Snap shot generation simple test failed"); - } else - System.out.println("Snap shot generation simple test passed"); - } - - -// -// /** -// * This is simple: we just create an empty differential, generate the snapshot, and then insist it must match the base. for a different resource with recursion -// * -// * @param context2 -// * @ -// * @throws EOperationOutcome -// */ - @Test - public void testSimple2() throws EOperationOutcome, Exception { - if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.home(), "publish", "definitions.xml.zip")); - - StructureDefinition focus = new StructureDefinition(); - StructureDefinition base = TestingUtilities.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/ValueSet").copy(); - focus.setUrl(Utilities.makeUuidUrn()); - focus.setBaseDefinition(base.getUrl()); - focus.setType(base.getType()); - focus.setDerivation(TypeDerivationRule.CONSTRAINT); - List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); - new ProfileUtilities(TestingUtilities.context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); - - boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size(); - for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { - if (ok) { - ElementDefinition b = base.getSnapshot().getElement().get(i); - ElementDefinition f = focus.getSnapshot().getElement().get(i); - if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) - ok = false; - else { - f.setBase(null); - ok = Base.compareDeep(b, f, true); - } - } - } - - if (!ok) { - compareXml(base, focus); - throw new FHIRException("Snap shot generation simple test failed"); - } else - System.out.println("Snap shot generation simple test passed"); - } - -// /** -// * Change one cardinality. -// * -// * @param context2 -// * @ -// * @throws EOperationOutcome -// */ -// private void testCardinalityChange() throws EOperationOutcome, Exception { -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// ElementDefinition id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier"); -// id.setMin(1); -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size(); -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.identifier")) { -// ok = f.getMin() == 1; -// if (ok) -// f.setMin(0); -// } -// ok = ok && Base.compareDeep(b, f, true); -// } -// } -// } -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation chenge cardinality test failed"); -// } else -// System.out.println("Snap shot generation chenge cardinality test passed"); -// } -// -// /** -// * check that documentation appending is working -// * -// * @param context2 -// * @ -// * @throws EOperationOutcome -// */ -// private void testDocumentationAppend() throws EOperationOutcome, Exception { -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// ElementDefinition id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier"); -// id.setDefinition("... some more doco"); -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size(); -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.identifier")) { -// ok = f.getDefinition().length() > b.getDefinition().length(); -// if (ok) { -// f.setDefinition(null); -// b.setDefinition(null); -// } -// } -// ok = ok && Base.compareDeep(b, f, true); -// } -// } -// } -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation documentation append failed"); -// } else -// System.out.println("Snap shot generation documentation append test passed"); -// } -// -// -// /** -// * check that narrowing types is working -// * this one doesn't rename the path -// * -// * @param context2 -// * @ -// * @throws EOperationOutcome -// */ -// private void textTypeNarrowing1() throws EOperationOutcome, Exception { -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// ElementDefinition id = focus.getDifferential().addElement(); -// id.setPath("Patient.deceased[x]"); -// id.addType().setCode("dateTime"); -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size(); -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.deceasedDateTime")) { -// ok = f.getType().size() == 1 && f.getType().get(0).getCode().equals("dateTime"); -// if (ok) { -// f.getType().clear(); -// b.getType().clear(); -// f.setPath(b.getPath()); -// } -// } -// ok = ok && Base.compareDeep(b, f, true); -// } -// } -// } -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation narrow type 1 failed"); -// } else -// System.out.println("Snap shot generation narrow type 1 test passed"); -// } -// -// /** -// * check that narrowing types is working -// * this one renames the path -// * -// * @param context2 -// * @ -// * @throws EOperationOutcome -// */ -// private void textTypeNarrowing2() throws EOperationOutcome, Exception { -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// ElementDefinition id = focus.getDifferential().addElement(); -// id.setPath("Patient.deceasedDateTime"); -// id.addType().setCode("dateTime"); -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size(); -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.deceasedDateTime")) { -// ok = f.getType().size() == 1 && f.getType().get(0).getCode().equals("dateTime"); -// if (ok) { -// f.getType().clear(); -// b.getType().clear(); -// f.setPath(b.getPath()); -// } -// } -// ok = ok && Base.compareDeep(b, f, true); -// } -// } -// } -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation narrow type 2 failed"); -// } else -// System.out.println("Snap shot generation narrow type 2 test passed"); -// } -// -// /** -// * check that mapping resolution is working -// * -// * @param context2 -// * @ -// * @throws EOperationOutcome -// */ -// private void testMapping() throws EOperationOutcome, Exception { -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// ElementDefinition id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier"); -// id.addMapping().setIdentity("rim").setMap("test"); -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size(); -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.identifier")) { -// ok = f.getMapping().size() > b.getMapping().size(); -// if (ok) { -// f.getMapping().clear(); -// b.getMapping().clear(); -// } -// } -// ok = ok && Base.compareDeep(b, f, true); -// } -// } -// } -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation mapping changes failed"); -// } else -// System.out.println("Snap shot generation mapping changes test passed"); -// } -// -// /** -// * Walking into a type -// * -// * @param context2 -// * @ -// * @throws EOperationOutcome -// */ -// private void testTypeWalk() throws EOperationOutcome, Exception { -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// ElementDefinition id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier"); -// id.setMustSupport(true); -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier.system"); -// id.setMustSupport(true); -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// // the derived should be 8 longer -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size() - 8; -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i <= 9 ? i : i + 8); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.identifier")) { -// ok = f.getMustSupport() && !b.getMustSupport(); -// if (ok) { -// f.setMustSupportElement(null); -// } -// } -// ok = Base.compareDeep(b, f, true); -// } -// } -// } -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation simple test failed"); -// } else -// System.out.println("Snap shot generation simple test passed"); -// } -// -// /** -// * Walking into a type, without explicitly doing so -// * -// * note: this currently fails. -// * -// * @param context2 -// * @ -// * @throws EOperationOutcome -// */ -// private void testTypeWalk2() throws EOperationOutcome, Exception { -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// ElementDefinition id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier.system"); -// id.setMustSupport(true); -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// // the derived should be 8 longer -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size() - 8; -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i <= 9 ? i : i + 8); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.identifier")) { -// ok = f.getMustSupport() && !b.getMustSupport(); -// if (ok) { -// f.setMustSupportElement(null); -// } -// } -// ok = Base.compareDeep(b, f, true); -// } -// } -// } -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation simple test failed"); -// } else -// System.out.println("Snap shot generation simple test passed"); -// } -// -// -// /** -// * we're going to slice Patient.identifier -// */ -// private void testSlicingSimple() throws EOperationOutcome, Exception { -// -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// -// // set the slice up -// ElementDefinition id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier"); -// id.getSlicing().setOrdered(false).setRules(SlicingRules.OPEN).addDiscriminator().setPath("use").setType(DiscriminatorType.VALUE); -// -// // first slice: -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier"); -// id.setSliceName("name1"); -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier.use"); -// id.setFixed(new CodeType("usual")); -// -// // second slice: -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier"); -// id.setSliceName("name2"); -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.identifier.use"); -// id.setFixed(new CodeType("official")); -// -// -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// // 18 different: identifier + 8 inner children * 2 -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size() - 18; -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i <= 9 ? i : i + 18); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.identifier")) { -// ok = f.hasSlicing(); -// if (ok) -// f.setSlicing(null); -// } -// ok = Base.compareDeep(b, f, true); -// } -// } -// } -// // now, check that the slices we skipped are correct: -// for (int i = 10; i <= 18; i++) { -// if (ok) { -// ElementDefinition d1 = focus.getSnapshot().getElement().get(i); -// ElementDefinition d2 = focus.getSnapshot().getElement().get(i+9); -// if (d1.getPath().equals("Patient.identifier.use")) { -// ok = d1.hasFixed() && d2.hasFixed() && !Base.compareDeep(d1.getFixed(), d2.getFixed(), true); -// if (ok) { -// d1.setFixed(null); -// d2.setFixed(null); -// } -// } -// if (d1.getPath().equals("Patient.identifier")) { -// ok = d1.hasSliceName() && d2.hasSliceName() && !Base.compareDeep(d1.getSliceNameElement(), d2.getSliceNameElement(), true); -// if (ok) { -// d1.setSliceName(null); -// d2.setSliceName(null); -// } -// } -// ok = Base.compareDeep(d1, d2, true); -// } -// } -// // for throughness, we could check against identifier too, but this is not done now. -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation slicing failed"); -// } else -// System.out.println("Snap shot generation slicing passed"); -// -// } -// -// /** -// * we're going to slice Patient.extension and refer to extension by profile -// * -// * implicit: whether to rely on implicit extension slicing -// */ -// private void testSlicingExtension(boolean implicit) throws EOperationOutcome, Exception { -// -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// -// // set the slice up -// ElementDefinition id; -// if (!implicit) { -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.extension"); -// id.getSlicing().setOrdered(false).setRules(SlicingRules.OPEN).addDiscriminator().setPath("url").setType(DiscriminatorType.VALUE); -// id.setMax("3"); -// } -// // first slice: -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.extension"); -// id.setSliceName("name1"); -// id.addType().setCode("Extension").setProfile("http://hl7.org/fhir/StructureDefinition/patient-birthTime"); -// id.setMin(1); -// -// // second slice: -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.extension"); -// id.setSliceName("name2"); -// id.addType().setCode("Extension").setProfile("http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName"); -// -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// ProfileUtilities pu = new ProfileUtilities(context, messages, null); -// pu.generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// // 2 different: extension slices -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size() - 2; -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i <= 7 ? i : i + 2); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.extension")) { -// ok = f.hasSlicing() && (implicit || f.getMax().equals("3")); -// if (ok) { -// f.setSlicing(null); -// f.setMaxElement(b.getMaxElement()); -// } -// } -// if (!f.getPath().equals("Patient.extension")) // no compare that because the definitions get overwritten -// ok = Base.compareDeep(b, f, true); -// } -// } -// } -// // now, check that the slices we skipped are correct: -// if (ok) { -// ElementDefinition d1 = focus.getSnapshot().getElement().get(8); -// ElementDefinition d2 = focus.getSnapshot().getElement().get(9); -// ok = d1.hasType() && d1.getType().get(0).hasProfile() && d2.hasType() && d2.getType().get(0).hasProfile() && !Base.compareDeep(d1.getType(), d2.getType(), true) && -// d1.getMin() == 1 && d2.getMin() == 0 && d1.getMax().equals("1") && d2.getMax().equals("1"); -// if (ok) { -// d1.getType().clear(); -// d2.getType().clear(); -// d1.setSliceName("x"); -// d2.setSliceName("x"); -// d1.setMin(0); -// } -// ok = Base.compareDeep(d1, d2, true); -// // for throughness, we could check against extension too, but this is not done now. -// } -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation slicing extensions simple ("+(implicit ? "implicit" : "not implicit")+") failed"); -// } else -// System.out.println("Snap shot generation slicing extensions simple ("+(implicit ? "implicit" : "not implicit")+") passed"); -// } -// -// /** -// * we're going to slice Patient.extension and refer to extension by profile. one of the extensions is complex, and we're going to walk into -// * it and make it must support -// * -// * implicit: whether to rely on implicit extension slicing -// */ -// private void testSlicingExtensionComplex(boolean implicit) throws EOperationOutcome, Exception { -// -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// -// // set the slice up -// ElementDefinition id; -// if (!implicit) { -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.extension"); -// id.getSlicing().setOrdered(false).setRules(SlicingRules.OPEN).addDiscriminator().setPath("url").setType(DiscriminatorType.VALUE); -// } -// // first slice - a simple one to get us going: -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.extension"); -// id.setSliceName("simple"); -// id.addType().setCode("Extension").setProfile("http://hl7.org/fhir/StructureDefinition/patient-birthTime"); -// -// // second slice - the complex one -// // we walk into this and fix properties on the inner extensions -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.extension"); -// id.setSliceName("complex"); -// id.addType().setCode("Extension").setProfile("http://hl7.org/fhir/StructureDefinition/patient-nationality"); -// if (!implicit) { -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.extension.extension"); -// id.getSlicing().setOrdered(false).setRules(SlicingRules.OPEN).addDiscriminator().setPath("url").setType(DiscriminatorType.VALUE); -// } -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.extension.extension"); -// id.setSliceName("code"); -// id.setMustSupport(true); -// id.addType().setCode("Extension").setProfile("http://hl7.org/fhir/StructureDefinition/patient-nationality#code"); -// -// id = focus.getDifferential().addElement(); -// id.setPath("Patient.extension.extension"); -// id.setSliceName("period"); -// id.addType().setCode("Extension").setProfile("http://hl7.org/fhir/StructureDefinition/patient-nationality#period"); -// id.setMax("0"); // prohibit this one.... -// -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// // ok, there's going to 1 (simple) + complex: 1 + id + extnesion.slice + extension.code + (4 inside from that) + extension.period + (4 inside from that) + value + url = 16 -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size() - 16; -// -// // custom checks -// ok = ok && rule(focus.getSnapshot().getElement().get(7).getPath().equals("Patient.extension"), "element 7 (base) path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(7).hasSlicing(), "element 7 slicing"); -// ok = ok && rule(focus.getSnapshot().getElement().get(8).getPath().equals("Patient.extension"), "element 8 (1st slice) path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(8).getSliceName().equals("simple"), "element 8 (1st slice) name"); -// ok = ok && rule(focus.getSnapshot().getElement().get(8).getType().get(0).getProfile().equals("http://hl7.org/fhir/StructureDefinition/patient-birthTime"), "element 9 (2nd slice) profile name"); -// ok = ok && rule(focus.getSnapshot().getElement().get(9).getPath().equals("Patient.extension"), "element 9 (2nd slice) path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(9).getSliceName().equals("complex"), "element 8 (1st slice) name"); -// ok = ok && rule(focus.getSnapshot().getElement().get(9).getType().get(0).getProfile().equals("http://hl7.org/fhir/StructureDefinition/patient-nationality"), "element 9 (2nd slice) profile name"); -// ok = ok && rule(focus.getSnapshot().getElement().get(10).getPath().equals("Patient.extension.id"), "element 10 (2nd slice).id path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(11).getPath().equals("Patient.extension.extension"), "element 11 (2nd slice).extension path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(12).getPath().equals("Patient.extension.extension"), "element 12 (2nd slice).extension path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(12).getMustSupport(), "element 12 (2nd slice).extension must support"); -// ok = ok && rule(focus.getSnapshot().getElement().get(13).getPath().equals("Patient.extension.extension.id"), "element 13 (2nd slice).extension.id path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(14).getPath().equals("Patient.extension.extension.extension"), "element 14 (2nd slice).extension.extension path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(15).getPath().equals("Patient.extension.extension.url"), "element 15 (2nd slice).extension.url path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(16).getPath().equals("Patient.extension.extension.valueCodeableConcept"), "element 16 (2nd slice).extension.valueCodeableConcept path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(17).getPath().equals("Patient.extension.extension"), "element 17 (2nd slice).extension path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(17).getMax().equals("0"), "element 17 (2nd slice).extension cardinality"); -// ok = ok && rule(focus.getSnapshot().getElement().get(18).getPath().equals("Patient.extension.extension.id"), "element 18 (2nd slice).extension.id path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(19).getPath().equals("Patient.extension.extension.extension"), "element 19 (2nd slice).extension.extension path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(20).getPath().equals("Patient.extension.extension.url"), "element 20 (2nd slice).extension.url path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(21).getPath().equals("Patient.extension.extension.valuePeriod"), "element 21 (2nd slice).extension.valuePeriod path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(22).getPath().equals("Patient.extension.url"), "element 22 (2nd slice).url path"); -// ok = ok && rule(focus.getSnapshot().getElement().get(23).getPath().equals("Patient.extension.value[x]"), "element 23 (2nd slice).url path"); -// -// for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { -// if (ok) { -// ElementDefinition b = base.getSnapshot().getElement().get(i); -// ElementDefinition f = focus.getSnapshot().getElement().get(i <= 7 ? i : i + 16); -// if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath())) -// ok = false; -// else { -// f.setBase(null); -// if (f.getPath().equals("Patient.extension")) { -// ok = f.hasSlicing(); -// if (ok) -// f.setSlicing(null); -// } -// if (!f.getPath().equals("Patient.extension")) // no compare that because the definitions get overwritten -// ok = Base.compareDeep(b, f, true); -// } -// } -// } -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation slicing extensions complex ("+(implicit ? "implicit" : "not implicit")+") failed"); -// } else -// System.out.println("Snap shot generation slicing extensions complex ("+(implicit ? "implicit" : "not implicit")+") passed"); -// } -// -// private void testSlicingTask8742() throws EOperationOutcome, Exception { -// StructureDefinition focus = new StructureDefinition(); -// StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Organization").copy(); -// focus.setUrl(Utilities.makeUuidUrn()); -// focus.setBaseDefinition(base.getUrl()); -// focus.setType(base.getType()); -// focus.setDerivation(TypeDerivationRule.CONSTRAINT); -// -// ElementDefinition id = focus.getDifferential().addElement(); -// id.setPath("Organization.address"); -// id.setMin(1); -// id.setMax("1"); -// id.setMustSupport(true); -// -// id = focus.getDifferential().addElement(); -// id.setPath("Organization.address.extension"); -// id.setSliceName("USLabCountycodes"); -// id.getSlicing().setOrdered(false).setRules(SlicingRules.OPEN).addDiscriminator().setPath("url").setType(DiscriminatorType.VALUE); -// id.setShort("County/Parish FIPS codes"); -// id.setDefinition("County/Parish FIPS codes."); -// id.setRequirements("County/Parish Code SHALL use FIPS 6-4 ( INCITS 31:2009)."); -// id.setMin(0); -// id.setMax("1"); -// id.addType().setCode("Extension").setProfile("http://hl7.org/fhir/StructureDefinition/us-core-county"); -// id.setMustSupport(true); -// id.getBinding().setStrength(BindingStrength.REQUIRED).setDescription("FIPS codes for US counties and county equivalent entities.").setValueSet(new Reference().setReference("http://hl7.org/fhir/ValueSet/fips-county")); -// List<ValidationMessage> messages = new ArrayList<ValidationMessage>(); -// -// new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test" ); -// -// // 14 for address with one sliced extension -// boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size() - 13; -// -// if (!ok) { -// compareXml(base, focus); -// throw new FHIRException("Snap shot generation test 8742 failed"); -// } else -// System.out.println("Snap shot generation test 8742 passed"); -// } -// -// -// private boolean rule(boolean ok, String message) { -// if (!ok) -// System.out.println("Test failed: " + message); -// return ok; -// } -// - - private void compareXml(StructureDefinition base, StructureDefinition focus) throws FileNotFoundException, IOException { - base.setText(null); - focus.setText(null); - base.setDifferential(null); -// focus.setDifferential(null); - String f1 = Utilities.path("c:", "temp", "base.xml"); - String f2 = Utilities.path("c:", "temp", "derived.xml"); - new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(f1), base);; - new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(f2), focus);; - String diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge", "WinMergeU.exe"); - List<String> command = new ArrayList<String>(); - command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\""); - - ProcessBuilder builder = new ProcessBuilder(command); - builder.directory(new CSFile("c:\\temp")); - builder.start(); - } - - - -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/ResourceRoundTripTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/ResourceRoundTripTests.java deleted file mode 100644 index 980022e7fa2..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/ResourceRoundTripTests.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.hl7.fhir.r4.test; - -import static org.junit.Assert.*; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - -import org.hl7.fhir.r4.context.IWorkerContext; -import org.hl7.fhir.r4.context.SimpleWorkerContext; -import org.hl7.fhir.r4.formats.IParser.OutputStyle; -import org.hl7.fhir.r4.formats.XmlParser; -import org.hl7.fhir.r4.model.DomainResource; -import org.hl7.fhir.r4.model.Resource; -import org.hl7.fhir.r4.test.support.TestingUtilities; -import org.hl7.fhir.r4.utils.EOperationOutcome; -import org.hl7.fhir.r4.utils.NarrativeGenerator; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.exceptions.FHIRException; -import org.junit.Before; -import org.junit.Test; - -public class ResourceRoundTripTests { - - @Before - public void setUp() throws Exception { - } - - @Test - public void test() throws FileNotFoundException, IOException, FHIRException, EOperationOutcome { - if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.home(), "publish", "definitions.xml.zip")); - Resource res = new XmlParser().parse(new FileInputStream(Utilities.path(TestingUtilities.home(), "tests", "resources", "unicode.xml"))); - new NarrativeGenerator("", "", TestingUtilities.context).generate((DomainResource) res); - new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(TestingUtilities.home(), "tests", "resources","unicode.out.xml")), res); - } - -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/ShexGeneratorTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/ShexGeneratorTests.java deleted file mode 100644 index fe7fbca31ee..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/ShexGeneratorTests.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.hl7.fhir.r4.test; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.nio.file.FileSystems; -import java.nio.file.Path; - -import org.hl7.fhir.r4.conformance.ShExGenerator; -import org.hl7.fhir.r4.conformance.ShExGenerator.HTMLLinkPolicy; -import org.hl7.fhir.r4.context.SimpleWorkerContext; -import org.hl7.fhir.r4.model.StructureDefinition; -import org.hl7.fhir.r4.test.support.TestingUtilities; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.utilities.TextFile; -import org.junit.Test; - -public class ShexGeneratorTests { - - private void doTest(String name) throws FileNotFoundException, IOException, FHIRException { - String workingDirectory = "C:\\work\\org.hl7.fhir\\build\\publish"; // FileSystems.getDefault().getPath(System.getProperty("user.dir"), "data").toString(); - // String workingDirectory = FileSystems.getDefault().getPath(System.getProperty("user.dir"), "..", "..", "..", "publish").toString(); - if (TestingUtilities.context == null) { - // For the time being, put the validation entry in org/hl7/fhir/r4/data - Path path = FileSystems.getDefault().getPath(workingDirectory, "definitions.xml.zip"); - TestingUtilities.context = SimpleWorkerContext.fromPack(path.toString()); - } - StructureDefinition sd = TestingUtilities.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+name); - if(sd == null) { - throw new FHIRException("StructuredDefinition for " + name + "was null"); - } - Path outPath = FileSystems.getDefault().getPath(workingDirectory, name.toLowerCase()+".shex"); - TextFile.stringToFile(new ShExGenerator(TestingUtilities.context).generate(HTMLLinkPolicy.NONE, sd), outPath.toString()); - } - - @Test - public void testId() throws FHIRException, IOException { - doTest("id"); - } - - @Test - public void testUri() throws FHIRException, IOException { - doTest("uri"); - } - - - @Test - public void testObservation() throws FHIRException, IOException { - doTest("Observation"); - } - - @Test - public void testRef() throws FHIRException, IOException { - doTest("Reference"); - } - - @Test - public void testAccount() throws FHIRException, IOException { - doTest("Account"); - } - - @Test - public void testMedicationOrder() throws FHIRException, IOException { - doTest("MedicationOrder"); - } - - @Test - public void testAllergyIntolerance() throws FHIRException, IOException { - doTest("AllergyIntolerance"); - } - - @Test - public void testCoding() throws FHIRException, IOException { - doTest("Coding"); - } - - @Test - public void testTiming() throws FHIRException, IOException { - doTest("Timing"); - } - - @Test - public void testSignature() throws FHIRException, IOException { - doTest("Signature"); - } -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/SnapShotGenerationTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/SnapShotGenerationTests.java deleted file mode 100644 index ce48cca0090..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/SnapShotGenerationTests.java +++ /dev/null @@ -1,338 +0,0 @@ -package org.hl7.fhir.r4.test; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.xml.parsers.ParserConfigurationException; - -import org.hl7.fhir.r4.conformance.ProfileUtilities; -import org.hl7.fhir.r4.context.SimpleWorkerContext; -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.Coding; -import org.hl7.fhir.r4.model.ExpressionNode; -import org.hl7.fhir.r4.model.MetadataResource; -import org.hl7.fhir.r4.model.ExpressionNode.CollectionStatus; -import org.hl7.fhir.r4.model.PrimitiveType; -import org.hl7.fhir.r4.model.Resource; -import org.hl7.fhir.r4.model.StructureDefinition; -import org.hl7.fhir.r4.model.TestScript; -import org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent; -import org.hl7.fhir.r4.model.TestScript.SetupActionComponent; -import org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent; -import org.hl7.fhir.r4.model.TestScript.TestActionComponent; -import org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent; -import org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent; -import org.hl7.fhir.r4.model.TypeDetails; -import org.hl7.fhir.r4.test.support.TestingUtilities; -import org.hl7.fhir.r4.utils.CodingUtilities; -import org.hl7.fhir.r4.utils.FHIRPathEngine; -import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext; -import org.hl7.fhir.exceptions.DefinitionException; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.exceptions.FHIRFormatError; -import org.hl7.fhir.exceptions.PathEngineException; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.utilities.xml.XMLUtil; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import junit.framework.Assert; - -@RunWith(Parameterized.class) -public class SnapShotGenerationTests { - - private static class SnapShotGenerationTestsContext implements IEvaluationContext { - private Map<String, Resource> fixtures; - private Map<String, StructureDefinition> snapshots = new HashMap<String, StructureDefinition>(); - public TestScript tests; - - public void checkTestsDetails() { - if (!"http://hl7.org/fhir/tests/snapshotgeneration".equals(tests.getUrl())) - throw new Error("Wrong URL on test script"); - if (!tests.getSetup().isEmpty()) - throw new Error("Setup is not supported"); - if (!tests.getTeardown().isEmpty()) - throw new Error("Teardown is not supported"); - Set<String> ids = new HashSet<String>(); - Set<String> urls = new HashSet<String>(); - for (Resource r : tests.getContained()) { - if (ids.contains(r.getId())) - throw new Error("Unsupported: duplicate contained resource on fixture id "+r.getId()); - ids.add(r.getId()); - if (r instanceof MetadataResource) { - MetadataResource md = (MetadataResource) r; - if (urls.contains(md.getUrl())) - throw new Error("Unsupported: duplicate canonical url "+md.getUrl()+" on fixture id "+r.getId()); - urls.add(md.getUrl()); - } - } - for (TestScriptFixtureComponent r : tests.getFixture()) { - if (ids.contains(r.getId())) - throw new Error("Unsupported: duplicate contained resource or fixture id "+r.getId()); - ids.add(r.getId()); - } - Set<String> names = new HashSet<String>(); - for (TestScriptTestComponent test : tests.getTest()) { - if (names.contains(test.getName())) - throw new Error("Unsupported: duplicate name "+test.getName()); - names.add(test.getName()); - if (test.getAction().size() < 2) - throw new Error("Unsupported: multiple actions required"); - if (!test.getActionFirstRep().hasOperation()) - throw new Error("Unsupported: first action must be an operation"); - for (int i = 0; i < test.getAction().size(); i++) { -// if (!test.getAction().get(i).hasAssert()) -// throw new Error("Unsupported: following actions must be an asserts"); - TestActionComponent action = test.getAction().get(i); - if (action.hasOperation()) { - SetupActionOperationComponent op = test.getActionFirstRep().getOperation(); - if (!CodingUtilities.matches(op.getType(), "http://hl7.org/fhir/testscript-operation-codes", "snapshot") - && !CodingUtilities.matches(op.getType(), "http://hl7.org/fhir/testscript-operation-codes", "sortDifferential")) - throw new Error("Unsupported action operation type "+CodingUtilities.present(op.getType())); - if (!"StructureDefinition".equals(op.getResource())) - throw new Error("Unsupported action operation resource "+op.getResource()); - if (!op.hasResponseId()) - throw new Error("Unsupported action operation: no response id"); - if (!op.hasSourceId()) - throw new Error("Unsupported action operation: no source id"); - if (!hasSource(op.getSourceId())) - throw new Error("Unsupported action operation: source id could not be resolved"); - } else if (action.hasAssert()) { - SetupActionAssertComponent a = action.getAssert(); - if (!a.hasLabel()) - throw new Error("Unsupported: actions must have a label"); - if (!a.hasDescription()) - throw new Error("Unsupported: actions must have a description"); - if (!a.hasExpression()) - throw new Error("Unsupported: actions must have an expression"); - } else { - throw new Error("Unsupported: Unrecognized action type"); - } - } - } - } - - private boolean hasSource(String sourceId) { - for (TestScriptFixtureComponent ds : tests.getFixture()) { - if (sourceId.equals(ds.getId())) - return true; - } - for (Resource r : tests.getContained()) { - if (sourceId.equals(r.getId())) - return true; - } - return false; - } - - public Resource fetchFixture(String id) { - if (fixtures.containsKey(id)) - return fixtures.get(id); - - for (TestScriptFixtureComponent ds : tests.getFixture()) { - if (id.equals(ds.getId())) - throw new Error("not done yet"); - } - for (Resource r : tests.getContained()) { - if (id.equals(r.getId())) - return r; - } - return null; - } - - // FHIRPath methods - @Override - public Base resolveConstant(Object appContext, String name) throws PathEngineException { - return null; - } - - @Override - public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException { - return null; - } - - @Override - public boolean log(String argument, List<Base> focus) { - System.out.println(argument+": "+fp.convertToString(focus)); - return true; - } - - @Override - public FunctionDetails resolveFunction(String functionName) { - if ("fixture".equals(functionName)) - return new FunctionDetails("Access a fixture defined in the testing context", 0, 1); - return null; - } - - @Override - public TypeDetails checkFunction(Object appContext, String functionName, List<TypeDetails> parameters) throws PathEngineException { - if ("fixture".equals(functionName)) - return new TypeDetails(CollectionStatus.SINGLETON, TestingUtilities.context.getResourceNamesAsSet()); - return null; - } - - @Override - public List<Base> executeFunction(Object appContext, String functionName, List<List<Base>> parameters) { - if ("fixture".equals(functionName)) { - String id = fp.convertToString(parameters.get(0)); - Resource res = fetchFixture(id); - if (res != null) { - List<Base> list = new ArrayList<Base>(); - list.add(res); - return list; - } - } - return null; - } - - @Override - public Base resolveReference(Object appContext, String url) { - // TODO Auto-generated method stub - return null; - } - - } - - - private static FHIRPathEngine fp; - - @Parameters(name = "{index}: file {0}") - public static Iterable<Object[]> data() throws ParserConfigurationException, IOException, FHIRFormatError { - SnapShotGenerationTestsContext context = new SnapShotGenerationTestsContext(); - context.tests = (TestScript) new XmlParser().parse(new FileInputStream(Utilities.path(TestingUtilities.home(), "tests", "resources", "snapshot-generation-tests.xml"))); - - context.checkTestsDetails(); - - List<Object[]> objects = new ArrayList<Object[]>(context.tests.getTest().size()); - - for (TestScriptTestComponent e : context.tests.getTest()) { - objects.add(new Object[] { e.getName(), e, context }); - } - return objects; - } - - - private final TestScriptTestComponent test; - private final String name; - private SnapShotGenerationTestsContext context; - - public SnapShotGenerationTests(String name, TestScriptTestComponent e, SnapShotGenerationTestsContext context) { - this.name = name; - this.test = e; - this.context = context; - } - - @SuppressWarnings("deprecation") - @Test - public void test() throws FileNotFoundException, IOException, FHIRException, org.hl7.fhir.exceptions.FHIRException { - if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.home(), "publish", "definitions.xml.zip")); - if (fp == null) - fp = new FHIRPathEngine(TestingUtilities.context); - fp.setHostServices(context); - - resolveFixtures(); - - for (int i = 0; i < test.getAction().size(); i++) { - TestActionComponent action = test.getAction().get(i); - if (action.hasOperation()) { - SetupActionOperationComponent op = action.getOperation(); - Coding opType = op.getType(); - if (opType.getSystem().equals("http://hl7.org/fhir/testscript-operation-codes") && opType.getCode().equals("snapshot")) { - StructureDefinition source = (StructureDefinition) context.fetchFixture(op.getSourceId()); - StructureDefinition base = getSD(source.getBaseDefinition()); - StructureDefinition output = source.copy(); - ProfileUtilities pu = new ProfileUtilities(TestingUtilities.context, null, null); - pu.setIds(source, false); - if ("sort=true".equals(op.getParams())) { - List<String> errors = new ArrayList<String>(); - pu.sortDifferential(base, output, source.getName(), errors); - if (errors.size() > 0) - throw new FHIRException("Sort failed: "+errors.toString()); - } - pu.generateSnapshot(base, output, source.getUrl(), source.getName()); - context.fixtures.put(op.getResponseId(), output); - context.snapshots.put(output.getUrl(), output); - - new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(System.getProperty("java.io.tmpdir"), op.getResponseId()+".xml")), output); - - } else if (opType.getSystem().equals("http://hl7.org/fhir/testscript-operation-codes") && opType.getCode().equals("sortDifferential")) { - StructureDefinition source = (StructureDefinition) context.fetchFixture(op.getSourceId()); - StructureDefinition base = getSD(source.getBaseDefinition()); - StructureDefinition output = source.copy(); - ProfileUtilities pu = new ProfileUtilities(TestingUtilities.context, null, null); - pu.setIds(source, false); - List<String> errors = new ArrayList<String>(); - pu.sortDifferential(base, output, output.getUrl(), errors); - if (!errors.isEmpty()) - throw new FHIRException(errors.get(0)); - context.fixtures.put(op.getResponseId(), output); - context.snapshots.put(output.getUrl(), output); - - new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(System.getProperty("java.io.tmpdir"), op.getResponseId()+".xml")), output); - - } else { - throw new Error("Unsupported operation: " + opType.getSystem() + " : " + opType.getCode()); - } - } else if (action.hasAssert()) { - SetupActionAssertComponent a = action.getAssert(); - Assert.assertTrue(a.getLabel()+": "+a.getDescription(), fp.evaluateToBoolean(new StructureDefinition(), new StructureDefinition(), a.getExpression())); - } - } - } - - - private StructureDefinition getSD(String url) throws DefinitionException, FHIRException { - StructureDefinition sd = TestingUtilities.context.fetchResource(StructureDefinition.class, url); - if (sd == null) - sd = context.snapshots.get(url); - if (sd == null) - sd = findContainedProfile(url); - return sd; - } - - private StructureDefinition findContainedProfile(String url) throws DefinitionException, FHIRException { - for (Resource r : context.tests.getContained()) { - if (r instanceof StructureDefinition) { - StructureDefinition sd = (StructureDefinition) r; - if (sd.getUrl().equals(url)) { - StructureDefinition p = sd.copy(); - ProfileUtilities pu = new ProfileUtilities(TestingUtilities.context, null, null); - pu.setIds(p, false); - List<String> errors = new ArrayList<String>(); - pu.sortDifferential(getSD(p.getBaseDefinition()), p, url, errors); - if (!errors.isEmpty()) - throw new FHIRException(errors.get(0)); - pu.generateSnapshot(getSD(p.getBaseDefinition()), p, p.getUrl(), p.getName()); - return p; - } - } - } - return null; - } - - private void resolveFixtures() { - if (context.fixtures == null) { - context.fixtures = new HashMap<String, Resource>(); - for (TestScriptFixtureComponent fd : context.tests.getFixture()) { - Resource r = TestingUtilities.context.fetchResource(Resource.class, fd.getResource().getReference()); - context.fixtures.put(fd.getId(), r); - } - } - - } -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/SnomedExpressionsTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/SnomedExpressionsTests.java deleted file mode 100644 index fc9a61553ff..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/SnomedExpressionsTests.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.hl7.fhir.r4.test; - -import static org.junit.Assert.*; - -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r4.utils.SnomedExpressions; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class SnomedExpressionsTests { - - @Before - public void setUp() throws Exception { - } - - @Test - public void test() throws FHIRException { - p("116680003"); - p("128045006:{363698007=56459004}"); - p("128045006|cellulitis (disorder)|:{363698007|finding site|=56459004|foot structure|}"); - p("31978002: 272741003=7771000"); - p("31978002|fracture of tibia|: 272741003|laterality|=7771000|left|"); - p("64572001|disease|:{116676008|associated morphology|=72704001|fracture|,363698007|finding site|=(12611008|bone structure of tibia|:272741003|laterality|=7771000|left|)}"); - p("417662000|past history of clinical finding|:246090004|associated finding|= (31978002|fracture of tibia|: 272741003|laterality|=7771000|left|)"); - p("243796009|situation with explicit context|:246090004|associated finding|= (64572001|disease|:{116676008|associated morphology|=72704001|fracture|,"+" 363698007|finding site|=(12611008|bone structure of tibia|: 272741003|laterality|=7771000|left|)}),408729009|finding context|= "+"410515003|known present|,408731000|temporal context|=410513005|past|, 408732007|subject relationship context|=410604004|subject of record|"); - - // from IHTSDO expression documentation: - p("125605004 |fracture of bone|"); - p("284003005 |bone injury| :{ 363698007 |finding site| = 272673000 |bone structure|,116676008 |associated morphology| = 72704001 |fracture| }"); - p("421720008 |spray dose form| + 7946007 |drug suspension|"); - p("182201002 |hip joint| : 272741003 |laterality| = 24028007 |right|"); - p("397956004 |prosthetic arthroplasty of the hip| : 363704007 |procedure site| = (182201002 |hip joint| : 272741003 |laterality| = 24028007 |right|)"); - p("71388002 |procedure| : {260686004 |method| = 129304002 |excision - action|, 405813007 |procedure site - direct| = 28231008 |gallbladder structure|}, {260686004 |method| = 281615006 "+"|exploration|, 405813007 |procedure site - direct| = 28273000 |bile duct structure|}"); - p("27658006 |amoxicillin|:411116001 |has dose form| = 385049006 |capsule|,{ 127489000 |has active ingredient| = 372687004 |amoxicillin|,111115 |has basis of strength| = (111115 |"+"amoxicillin only|:111115 |strength magnitude| = #500,111115 |strength unit| = 258684004 |mg|)}"); - p("91143003 |albuterol|:411116001 |has dose form| = 385023001 |oral solution|,{ 127489000 |has active ingredient| = 372897005 |albuterol|,111115 |has basis of strength| = (111115 |a"+"lbuterol only|:111115 |strength magnitude| = #0.083,111115 |strength unit| = 118582008 |%|)}"); - p("322236009 |paracetamol 500mg tablet| : 111115 |trade name| = \"PANADOL\""); - p("=== 46866001 |fracture of lower limb| + 428881005 |injury of tibia| :116676008 |associated morphology| = 72704001 |fracture|,363698007 |finding site| = 12611008 |bone structure of tibia|"); - p("<<< 73211009 |diabetes mellitus| : 363698007 |finding site| = 113331007 |endocrine system|"); - - // from Overview of Expression Normalization, Equivalence and Subsumption Testing - - p("28012007 |Closed fracture of shaft of tibia|"); - p("125605004 |Fracture of bone| :{ 363698007 |Finding site| = 52687003 |Bone structure of shaft of tibia|,116676008 |Associated morphology| = 20946005 |Fracture, closed | }"); - p("423125000 |Closed fracture of bone|:363698007 |Finding site| = 52687003 |Bone structure of shaft of tibia|"); - p("6990005 |Fracture of shaft of tibia |: 116676008 |Associated morphology| = 20946005 |Fracture, closed |"); - p("64572001 |Disease| : { 363698007 |Finding site| = 52687003 |Bone structure of shaft of tibia|, 116676008 |Associated morphology| = 20946005 |Fracture, closed | }"); - // p("10925361000119108 |Closed fracture of shaft of left tibia|"); // US Extension - p("28012007 |Closed fracture of shaft of tibia| : 363698007 |Finding site| = (52687003 |Bone structure of shaft of tibia| : 272741003 |Laterality|= 7771000 |Left|)"); - p("28012007 |Closed fracture of shaft of tibia| : 272741003 |Laterality|= 7771000 |Left|"); //Close to user form omits restatement of finding site"); - p("64572001 |Disease| : {363698007 |Finding site| = (52687003 |Bone structure of shaft of tibia| : 272741003 |Laterality|= 7771000 |Left|), 116676008 |Associated morphology| = 20946005 |Fracture, closed | }"); - p("28012007 |Closed fracture of shaft of tibia| : 363698007 |Finding site| = 31156008 |Structure of left half of body|"); - } - - private void p(String expression) throws FHIRException { - Assert.assertNotNull("must be present", SnomedExpressions.parse(expression)); - - } - -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/StructureMapTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/StructureMapTests.java deleted file mode 100644 index 6d80591dc0b..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/StructureMapTests.java +++ /dev/null @@ -1,145 +0,0 @@ -package org.hl7.fhir.r4.test; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.hl7.fhir.r4.context.SimpleWorkerContext; -import org.hl7.fhir.r4.elementmodel.Element; -import org.hl7.fhir.r4.elementmodel.Manager; -import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat; -import org.hl7.fhir.r4.formats.IParser.OutputStyle; -import org.hl7.fhir.r4.formats.XmlParser; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.StructureDefinition; -import org.hl7.fhir.r4.model.StructureMap; -import org.hl7.fhir.r4.test.support.TestingUtilities; -import org.hl7.fhir.r4.utils.StructureMapUtilities; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.utilities.TextFile; -import org.hl7.fhir.utilities.Utilities; -import org.junit.Test; - - -public class StructureMapTests { - - private void testParse(String path) throws FileNotFoundException, IOException, FHIRException { - if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.home(), "publish", "definitions.xml.zip")); - - StructureMapUtilities scm = new StructureMapUtilities(TestingUtilities.context, null, null); - StructureMap map = scm.parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), path))); - TextFile.stringToFile(scm.render(map), Utilities.path(TestingUtilities.home(), path+".out")); - } - -// @Test -// public void testParseAny() throws FHIRException, IOException { -// testParse("guides\\ccda2\\mapping\\map\\any.map"); -// } -// -// @Test -// public void testParseBL() throws FHIRException, IOException { -// testParse("guides\\ccda2\\mapping\\map\\bl.map"); -// } -// -// @Test -// public void testParseED() throws FHIRException, IOException { -// testParse("guides\\ccda2\\mapping\\map\\ed.map"); -// } -// -// @Test -// public void testParseCD() throws FHIRException, IOException { -// testParse("guides\\ccda2\\mapping\\map\\cd.map"); -// } -// -// @Test -// public void testParseAD() throws FHIRException, IOException { -// testParse("guides\\ccda2\\mapping\\map\\ad.map"); -// } -// -// @Test -// public void testParsePQ() throws FHIRException, IOException { -// testParse("guides\\ccda2\\mapping\\map\\pq.map"); -// } -// -// @Test -// public void testParseIVLTS() throws FHIRException, IOException { -// testParse("guides\\ccda2\\mapping\\map\\ivl-ts.map"); -// } -// -// @Test -// public void testParseCDA() throws FHIRException, IOException { -// testParse("guides\\ccda2\\mapping\\map\\cda.map"); -// } - -// @Test -// public void testTransformCDA() throws FileNotFoundException, Exception { -// Map<String, StructureMap> maps = new HashMap<String, StructureMap>(); -// -// if (TestingUtilities.context == null) -// TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.home(), "publish", "definitions.xml.zip")); -// -// StructureMapUtilities scu = new StructureMapUtilities(TestingUtilities.context, maps, null); -// -// for (String f : new File(Utilities.path(TestingUtilities.home(), "guides", "ccda2", "mapping", "logical")).list()) { -// try { -// StructureDefinition sd = (StructureDefinition) new XmlParser().parse(new FileInputStream(Utilities.path(TestingUtilities.home(), "guides", "ccda2", "mapping", "logical", f))); -// ((SimpleWorkerContext) TestingUtilities.context).seeResource(sd.getUrl(), sd); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } -// -// for (String f : new File(Utilities.path(TestingUtilities.home(), "guides", "ccda2", "mapping", "map")).list()) { -// try { -// StructureMap map = scu.parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "guides", "ccda2", "mapping", "map", f))); -// maps.put(map.getUrl(), map); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } -// -// Element cda = Manager.parse(TestingUtilities.context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\guides\\ccda2\\mapping\\example\\ccd.xml"), FhirFormat.XML); -// Manager.compose(TestingUtilities.context, cda, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\guides\\ccda2\\mapping\\example\\ccd.out.json"), FhirFormat.JSON, OutputStyle.PRETTY, null); -// Manager.compose(TestingUtilities.context, cda, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\guides\\ccda2\\mapping\\example\\ccd.out.xml"), FhirFormat.XML, OutputStyle.PRETTY, null); -// Bundle bundle = new Bundle(); -// scu.transform(null, cda, maps.get("http://hl7.org/fhir/StructureMap/cda"), bundle); -// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\bundle.xml"), bundle); -// } -// -// @Test -// public void testTransformProfilesCDA() throws FileNotFoundException, Exception { -// Map<String, StructureMap> maps = new HashMap<String, StructureMap>(); -// -// if (TestingUtilities.context == null) -// TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); -// -// StructureMapUtilities scu = new StructureMapUtilities(TestingUtilities.context, maps, null); -// -// for (String f : new File("C:\\work\\org.hl7.fhir\\build\\guides\\ccda\\CDA").list()) { -// try { -// StructureDefinition sd = (StructureDefinition) new XmlParser().parse(new FileInputStream("C:\\work\\org.hl7.fhir\\build\\guides\\ccda\\CDA\\"+f)); -// ((SimpleWorkerContext) TestingUtilities.context).seeResource(sd.getUrl(), sd); -// } catch (Exception e) { -// } -// } -// -// for (String f : new File("C:\\work\\org.hl7.fhir\\build\\guides\\ccda2\\mapping\\map").list()) { -// try { -// StructureMap map = scu.parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\guides\\ccda2\\mapping\\map\\"+ f)); -// maps.put(map.getUrl(), map); -// } catch (Exception e) { -// } -// } -// -// List<StructureDefinition> result = scu.analyse(null, maps.get("http://hl7.org/fhir/StructureMap/cda")).getProfiles(); -// for (StructureDefinition sd : result) -// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\res-"+sd.getId()+".xml"), sd); -// } -// -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/TurtleTests.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/TurtleTests.java deleted file mode 100644 index 88b99ac074c..00000000000 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/TurtleTests.java +++ /dev/null @@ -1,3552 +0,0 @@ -package org.hl7.fhir.r4.test; - -import java.io.FileNotFoundException; -import java.io.IOException; - -import org.hl7.fhir.r4.test.support.TestingUtilities; -import org.hl7.fhir.r4.utils.formats.Turtle; -import org.hl7.fhir.utilities.TextFile; -import org.hl7.fhir.utilities.Utilities; -import org.junit.Test; - -import junit.framework.Assert; - -public class TurtleTests { - - - - private void doTest(String filename, boolean ok) throws Exception { - try { - String s = TextFile.fileToString(filename); - Turtle ttl = new Turtle(); - ttl.parse(s); - Assert.assertTrue(ok); - } catch (Exception e) { - Assert.assertTrue(e.getMessage(), !ok); - } - } - - @Test - public void test_double_lower_case_e1() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "double_lower_case_e.nt"), true); - } - @Test - public void test_double_lower_case_e2() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "double_lower_case_e.ttl"), true); - } - @Test - public void test_empty_collection1() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "empty_collection.nt"), true); - } - @Test - public void test_empty_collection2() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "empty_collection.ttl"), true); - } - @Test - public void test_first1() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "first.nt"), true); - } -// @Test -// public void test_first2() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "first.ttl"), true); -// } -// @Test - public void test_HYPHEN_MINUS_in_localNameNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "HYPHEN_MINUS_in_localName.nt"), true); - } - @Test - public void test_HYPHEN_MINUS_in_localName() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "HYPHEN_MINUS_in_localName.ttl"), true); - } - @Test - public void test_IRI_spoNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "IRI_spo.nt"), true); - } - @Test - public void test_IRI_subject() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "IRI_subject.ttl"), true); - } - @Test - public void test_IRI_with_all_punctuationNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "IRI_with_all_punctuation.nt"), true); - } - @Test - public void test_IRI_with_all_punctuation() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "IRI_with_all_punctuation.ttl"), true); - } - @Test - public void test_IRI_with_eight_digit_numeric_escape() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "IRI_with_eight_digit_numeric_escape.ttl"), true); - } - @Test - public void test_IRI_with_four_digit_numeric_escape() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "IRI_with_four_digit_numeric_escape.ttl"), true); - } - @Test - public void test_IRIREF_datatypeNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "IRIREF_datatype.nt"), true); - } - @Test - public void test_IRIREF_datatype() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "IRIREF_datatype.ttl"), true); - } - @Test - public void test_labeled_blank_node_objectNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "labeled_blank_node_object.nt"), true); - } - @Test - public void test_labeled_blank_node_object() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "labeled_blank_node_object.ttl"), true); - } - @Test - public void test_labeled_blank_node_subjectNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "labeled_blank_node_subject.nt"), true); - } - @Test - public void test_labeled_blank_node_subject() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "labeled_blank_node_subject.ttl"), true); - } - @Test - public void test_labeled_blank_node_with_leading_digit() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "labeled_blank_node_with_leading_digit.ttl"), true); - } - @Test - public void test_labeled_blank_node_with_leading_underscore() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "labeled_blank_node_with_leading_underscore.ttl"), true); - } - @Test - public void test_labeled_blank_node_with_non_leading_extras() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "labeled_blank_node_with_non_leading_extras.ttl"), true); - } - @Test - public void test_labeled_blank_node_with_PN_CHARS_BASE_character_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "labeled_blank_node_with_PN_CHARS_BASE_character_boundaries.ttl"), false); - } - @Test - public void test_langtagged_LONG() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "langtagged_LONG.ttl"), true); - } - @Test - public void test_langtagged_LONG_with_subtagNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "langtagged_LONG_with_subtag.nt"), true); - } - @Test - public void test_langtagged_LONG_with_subtag() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "langtagged_LONG_with_subtag.ttl"), true); - } - @Test - public void test_langtagged_non_LONGNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "langtagged_non_LONG.nt"), true); - } - @Test - public void test_langtagged_non_LONG() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "langtagged_non_LONG.ttl"), true); - } - @Test - public void test_lantag_with_subtagNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "lantag_with_subtag.nt"), true); - } - @Test - public void test_lantag_with_subtag() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "lantag_with_subtag.ttl"), true); - } - @Test - public void test_lastNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "last.nt"), true); - } - @Test - public void test_last() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "last.ttl"), false); - } - @Test - public void test_literal_falseNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_false.nt"), true); - } - @Test - public void test_literal_false() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_false.ttl"), true); - } - @Test - public void test_LITERAL_LONG1() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG1.ttl"), true); - } - @Test - public void test_LITERAL_LONG1_ascii_boundariesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG1_ascii_boundaries.nt"), false); - } - @Test - public void test_LITERAL_LONG1_ascii_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG1_ascii_boundaries.ttl"), true); - } - @Test - public void test_LITERAL_LONG1_with_1_squoteNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG1_with_1_squote.nt"), true); - } - @Test - public void test_LITERAL_LONG1_with_1_squote() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG1_with_1_squote.ttl"), true); - } - @Test - public void test_LITERAL_LONG1_with_2_squotesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG1_with_2_squotes.nt"), true); - } - @Test - public void test_LITERAL_LONG1_with_2_squotes() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG1_with_2_squotes.ttl"), true); - } - @Test - public void test_LITERAL_LONG1_with_UTF8_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG1_with_UTF8_boundaries.ttl"), true); - } - @Test - public void test_LITERAL_LONG2() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2.ttl"), true); - } - @Test - public void test_LITERAL_LONG2_ascii_boundariesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2_ascii_boundaries.nt"), false); - } - @Test - public void test_LITERAL_LONG2_ascii_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2_ascii_boundaries.ttl"), true); - } - @Test - public void test_LITERAL_LONG2_with_1_squoteNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2_with_1_squote.nt"), true); - } - @Test - public void test_LITERAL_LONG2_with_1_squote() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2_with_1_squote.ttl"), true); - } - @Test - public void test_LITERAL_LONG2_with_2_squotesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2_with_2_squotes.nt"), true); - } - @Test - public void test_LITERAL_LONG2_with_2_squotes() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2_with_2_squotes.ttl"), true); - } - @Test - public void test_LITERAL_LONG2_with_REVERSE_SOLIDUSNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2_with_REVERSE_SOLIDUS.nt"), false); - } - @Test - public void test_LITERAL_LONG2_with_REVERSE_SOLIDUS() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2_with_REVERSE_SOLIDUS.ttl"), false); - } - @Test - public void test_LITERAL_LONG2_with_UTF8_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_LONG2_with_UTF8_boundaries.ttl"), true); - } - @Test - public void test_literal_trueNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_true.nt"), true); - } - @Test - public void test_literal_true() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_true.ttl"), true); - } - @Test - public void test_literal_with_BACKSPACENT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_BACKSPACE.nt"), false); - } - @Test - public void test_literal_with_BACKSPACE() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_BACKSPACE.ttl"), true); - } - @Test - public void test_literal_with_CARRIAGE_RETURNNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_CARRIAGE_RETURN.nt"), true); - } - @Test - public void test_literal_with_CARRIAGE_RETURN() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_CARRIAGE_RETURN.ttl"), true); - } - @Test - public void test_literal_with_CHARACTER_TABULATIONNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_CHARACTER_TABULATION.nt"), true); - } - @Test - public void test_literal_with_CHARACTER_TABULATION() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_CHARACTER_TABULATION.ttl"), true); - } - @Test - public void test_literal_with_escaped_BACKSPACE() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_escaped_BACKSPACE.ttl"), false); - } - @Test - public void test_literal_with_escaped_CARRIAGE_RETURN() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_escaped_CARRIAGE_RETURN.ttl"), true); - } - @Test - public void test_literal_with_escaped_CHARACTER_TABULATION() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_escaped_CHARACTER_TABULATION.ttl"), true); - } - @Test - public void test_literal_with_escaped_FORM_FEED() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_escaped_FORM_FEED.ttl"), true); - } - @Test - public void test_literal_with_escaped_LINE_FEED() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_escaped_LINE_FEED.ttl"), true); - } -// @Test -// public void test_literal_with_FORM_FEEDNT() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_FORM_FEED.nt"), true); -// } - @Test - public void test_literal_with_FORM_FEED() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_FORM_FEED.ttl"), true); - } - @Test - public void test_literal_with_LINE_FEEDNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_LINE_FEED.nt"), true); - } - @Test - public void test_literal_with_LINE_FEED() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_LINE_FEED.ttl"), true); - } - @Test - public void test_literal_with_numeric_escape4NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_numeric_escape4.nt"), true); - } - @Test - public void test_literal_with_numeric_escape4() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_numeric_escape4.ttl"), true); - } - @Test - public void test_literal_with_numeric_escape8() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_numeric_escape8.ttl"), true); - } - @Test - public void test_literal_with_REVERSE_SOLIDUSNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_REVERSE_SOLIDUS.nt"), false); - } - @Test - public void test_literal_with_REVERSE_SOLIDUS() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "literal_with_REVERSE_SOLIDUS.ttl"), true); - } - @Test - public void test_LITERAL_with_UTF8_boundariesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL_with_UTF8_boundaries.nt"), true); - } - @Test - public void test_LITERAL1NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL1.nt"), true); - } - @Test - public void test_LITERAL1() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL1.ttl"), true); - } - @Test - public void test_LITERAL1_all_controlsNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL1_all_controls.nt"), false); - } - @Test - public void test_LITERAL1_all_controls() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL1_all_controls.ttl"), true); - } - @Test - public void test_LITERAL1_all_punctuationNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL1_all_punctuation.nt"), true); - } - @Test - public void test_LITERAL1_all_punctuation() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL1_all_punctuation.ttl"), true); - } -// @Test -// public void test_LITERAL1_ascii_boundariesNT() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL1_ascii_boundaries.nt"), true); -// } - @Test - public void test_LITERAL1_ascii_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL1_ascii_boundaries.ttl"), true); - } - @Test - public void test_LITERAL1_with_UTF8_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL1_with_UTF8_boundaries.ttl"), true); - } - @Test - public void test_LITERAL2() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL2.ttl"), true); - } - @Test - public void test_LITERAL2_ascii_boundariesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL2_ascii_boundaries.nt"), false); - } - @Test - public void test_LITERAL2_ascii_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL2_ascii_boundaries.ttl"), true); - } - @Test - public void test_LITERAL2_with_UTF8_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "LITERAL2_with_UTF8_boundaries.ttl"), true); - } - @Test - public void test_localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundariesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundaries.nt"), true); - } - @Test - public void test_localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundaries.ttl"), true); - } - @Test - public void test_localName_with_assigned_nfc_PN_CHARS_BASE_character_boundariesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_assigned_nfc_PN_CHARS_BASE_character_boundaries.nt"), true); - } - @Test - public void test_localName_with_assigned_nfc_PN_CHARS_BASE_character_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_assigned_nfc_PN_CHARS_BASE_character_boundaries.ttl"), false); - } -// don't need to support property names with ':' -// @Test -// public void test_localname_with_COLONNT() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localname_with_COLON.nt"), true); -// } -// @Test -// public void test_localname_with_COLON() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localname_with_COLON.ttl"), true); -// } - @Test - public void test_localName_with_leading_digitNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_leading_digit.nt"), true); - } - @Test - public void test_localName_with_leading_digit() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_leading_digit.ttl"), true); - } - @Test - public void test_localName_with_leading_underscoreNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_leading_underscore.nt"), true); - } - @Test - public void test_localName_with_leading_underscore() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_leading_underscore.ttl"), true); - } - @Test - public void test_localName_with_nfc_PN_CHARS_BASE_character_boundariesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_nfc_PN_CHARS_BASE_character_boundaries.nt"), true); - } - @Test - public void test_localName_with_nfc_PN_CHARS_BASE_character_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_nfc_PN_CHARS_BASE_character_boundaries.ttl"), false); - } - @Test - public void test_localName_with_non_leading_extrasNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_non_leading_extras.nt"), true); - } - @Test - public void test_localName_with_non_leading_extras() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "localName_with_non_leading_extras.ttl"), true); - } - @Test - public void test_negative_numericNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "negative_numeric.nt"), true); - } - @Test - public void test_negative_numeric() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "negative_numeric.ttl"), true); - } - @Test - public void test_nested_blankNodePropertyListsNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "nested_blankNodePropertyLists.nt"), true); - } - @Test - public void test_nested_blankNodePropertyLists() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "nested_blankNodePropertyLists.ttl"), true); - } - @Test - public void test_nested_collectionNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "nested_collection.nt"), true); - } - @Test - public void test_nested_collection() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "nested_collection.ttl"), false); - } - @Test - public void test_number_sign_following_localNameNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "number_sign_following_localName.nt"), true); - } - @Test - public void test_number_sign_following_localName() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "number_sign_following_localName.ttl"), true); - } - @Test - public void test_number_sign_following_PNAME_NSNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "number_sign_following_PNAME_NS.nt"), true); - } -// @Test -// public void test_number_sign_following_PNAME_NS() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "number_sign_following_PNAME_NS.ttl"), true); -// } - @Test - public void test_numeric_with_leading_0NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "numeric_with_leading_0.nt"), true); - } - @Test - public void test_numeric_with_leading_0() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "numeric_with_leading_0.ttl"), true); - } - @Test - public void test_objectList_with_two_objectsNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "objectList_with_two_objects.nt"), true); - } - @Test - public void test_objectList_with_two_objects() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "objectList_with_two_objects.ttl"), true); - } - @Test - public void test_old_style_base() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "old_style_base.ttl"), true); - } - @Test - public void test_old_style_prefix() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "old_style_prefix.ttl"), true); - } - @Test - public void test_percent_escaped_localNameNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "percent_escaped_localName.nt"), true); - } -// @Test -// public void test_percent_escaped_localName() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "percent_escaped_localName.ttl"), true); -// } - @Test - public void test_positive_numericNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "positive_numeric.nt"), true); - } - @Test - public void test_positive_numeric() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "positive_numeric.ttl"), true); - } - @Test - public void test_predicateObjectList_with_two_objectListsNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "predicateObjectList_with_two_objectLists.nt"), true); - } - @Test - public void test_predicateObjectList_with_two_objectLists() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "predicateObjectList_with_two_objectLists.ttl"), true); - } -// @Test -// public void test_prefix_only_IRI() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "prefix_only_IRI.ttl"), true); -// } - @Test - public void test_prefix_reassigned_and_usedNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "prefix_reassigned_and_used.nt"), true); - } - @Test - public void test_prefix_reassigned_and_used() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "prefix_reassigned_and_used.ttl"), true); - } - @Test - public void test_prefix_with_non_leading_extras() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "prefix_with_non_leading_extras.ttl"), true); - } - @Test - public void test_prefix_with_PN_CHARS_BASE_character_boundaries() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "prefix_with_PN_CHARS_BASE_character_boundaries.ttl"), true); - } - @Test - public void test_prefixed_IRI_object() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "prefixed_IRI_object.ttl"), true); - } - @Test - public void test_prefixed_IRI_predicate() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "prefixed_IRI_predicate.ttl"), true); - } - @Test - public void test_prefixed_name_datatype() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "prefixed_name_datatype.ttl"), true); - } - @Test - public void test_repeated_semis_at_end() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "repeated_semis_at_end.ttl"), true); - } - @Test - public void test_repeated_semis_not_at_endNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "repeated_semis_not_at_end.nt"), true); - } - @Test - public void test_repeated_semis_not_at_end() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "repeated_semis_not_at_end.ttl"), true); - } - @Test - public void test_reserved_escaped_localNameNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "reserved_escaped_localName.nt"), true); - } -// @Test -// public void test_reserved_escaped_localName() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "reserved_escaped_localName.ttl"), true); -// } - @Test - public void test_sole_blankNodePropertyList() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "sole_blankNodePropertyList.ttl"), true); - } - @Test - public void test_SPARQL_style_base() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "SPARQL_style_base.ttl"), true); - } - @Test - public void test_SPARQL_style_prefix() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "SPARQL_style_prefix.ttl"), true); - } - @Test - public void test_turtle_eval_bad_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-eval-bad-01.ttl"), false); - } - @Test - public void test_turtle_eval_bad_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-eval-bad-02.ttl"), false); - } - @Test - public void test_turtle_eval_bad_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-eval-bad-03.ttl"), false); - } -// @Test -// public void test_turtle_eval_bad_04() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-eval-bad-04.ttl"), false); -// } - @Test - public void test_turtle_eval_struct_01NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-eval-struct-01.nt"), true); - } - @Test - public void test_turtle_eval_struct_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-eval-struct-01.ttl"), true); - } - @Test - public void test_turtle_eval_struct_02NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-eval-struct-02.nt"), true); - } - @Test - public void test_turtle_eval_struct_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-eval-struct-02.ttl"), true); - } - @Test - public void test_turtle_subm_01NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-01.nt"), true); - } - @Test - public void test_turtle_subm_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-01.ttl"), true); - } - @Test - public void test_turtle_subm_02NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-02.nt"), true); - } - @Test - public void test_turtle_subm_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-02.ttl"), true); - } - @Test - public void test_turtle_subm_03NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-03.nt"), true); - } - @Test - public void test_turtle_subm_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-03.ttl"), false); - } - @Test - public void test_turtle_subm_04NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-04.nt"), true); - } - @Test - public void test_turtle_subm_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-04.ttl"), true); - } - @Test - public void test_turtle_subm_05NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-05.nt"), true); - } - @Test - public void test_turtle_subm_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-05.ttl"), true); - } - @Test - public void test_turtle_subm_06NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-06.nt"), true); - } - @Test - public void test_turtle_subm_06() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-06.ttl"), true); - } - @Test - public void test_turtle_subm_07NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-07.nt"), true); - } - @Test - public void test_turtle_subm_07() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-07.ttl"), false); - } - @Test - public void test_NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-08.nt"), true); - } - @Test - public void test_turtle_subm_08() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-08.ttl"), true); - } - @Test - public void test_turtle_subm_09NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-09.nt"), true); - } - @Test - public void test_turtle_subm_09() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-09.ttl"), true); - } - @Test - public void test_turtle_subm_10NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-10.nt"), true); - } - @Test - public void test_turtle_subm_10() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-10.ttl"), true); - } - @Test - public void test_turtle_subm_11NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-11.nt"), true); - } - @Test - public void test_turtle_subm_11() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-11.ttl"), true); - } - @Test - public void test_turtle_subm_12NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-12.nt"), true); - } - @Test - public void test_turtle_subm_12() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-12.ttl"), true); - } - @Test - public void test_turtle_subm_13NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-13.nt"), true); - } - @Test - public void test_turtle_subm_13() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-13.ttl"), true); - } - @Test - public void test_turtle_subm_14NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-14.nt"), true); - } - @Test - public void test_turtle_subm_14() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-14.ttl"), false); - } - @Test - public void test_turtle_subm_15NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-15.nt"), true); - } - @Test - public void test_turtle_subm_15() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-15.ttl"), true); - } - @Test - public void test_turtle_subm_16NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-16.nt"), true); - } - @Test - public void test_turtle_subm_16() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-16.ttl"), true); - } - @Test - public void test_turtle_subm_17NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-17.nt"), true); - } - @Test - public void test_turtle_subm_17() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-17.ttl"), true); - } - @Test - public void test_turtle_subm_18NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-18.nt"), false); - } - @Test - public void test_turtle_subm_18() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-18.ttl"), false); - } - @Test - public void test_turtle_subm_19NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-19.nt"), true); - } - @Test - public void test_turtle_subm_19() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-19.ttl"), true); - } - @Test - public void test_turtle_subm_20NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-20.nt"), true); - } - @Test - public void test_turtle_subm_20() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-20.ttl"), true); - } - @Test - public void test_turtle_subm_21NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-21.nt"), true); - } - @Test - public void test_turtle_subm_21() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-21.ttl"), true); - } - @Test - public void test_turtle_subm_22NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-22.nt"), true); - } - @Test - public void test_turtle_subm_22() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-22.ttl"), true); - } - @Test - public void test_turtle_subm_23NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-23.nt"), true); - } - @Test - public void test_turtle_subm_23() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-23.ttl"), false); - } - @Test - public void test_turtle_subm_24NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-24.nt"), true); - } - @Test - public void test_turtle_subm_24() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-24.ttl"), true); - } - @Test - public void test_turtle_subm_25NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-25.nt"), true); - } - @Test - public void test_turtle_subm_25() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-25.ttl"), true); - } - @Test - public void test_turtle_subm_26NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-26.nt"), true); - } - @Test - public void test_turtle_subm_26() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-26.ttl"), true); - } - @Test - public void test_turtle_subm_27NT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-27.nt"), true); - } - @Test - public void test_turtle_subm_27() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-subm-27.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_base_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-base-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_base_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-base-02.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_base_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-base-03.ttl"), false); - } -// @Test -// public void test_turtle_syntax_bad_blank_label_dot_end() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-blank-label-dot-end.ttl"), false); -// } - @Test - public void test_turtle_syntax_bad_esc_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-esc-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_esc_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-esc-02.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_esc_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-esc-03.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_esc_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-esc-04.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_kw_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-kw-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_kw_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-kw-02.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_kw_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-kw-03.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_kw_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-kw-04.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_kw_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-kw-05.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_lang_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-lang-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_LITERAL2_with_langtag_and_datatype() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-LITERAL2_with_langtag_and_datatype.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_ln_dash_start() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-ln-dash-start.ttl"), true); - } - @Test - public void test_turtle_syntax_bad_ln_escape() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-ln-escape.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_ln_escape_start() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-ln-escape-start.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_missing_ns_dot_end() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-missing-ns-dot-end.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_missing_ns_dot_start() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-missing-ns-dot-start.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-02.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-03.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-04.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-05.ttl"), false); - } -// @Test -// public void test_turtle_syntax_bad_n3_extras_06() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-06.ttl"), false); -// } - @Test - public void test_turtle_syntax_bad_n3_extras_07() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-07.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_08() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-08.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_09() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-09.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_10() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-10.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_11() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-11.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_12() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-12.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_n3_extras_13() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-n3-extras-13.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_ns_dot_end() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-ns-dot-end.ttl"), true); - } - @Test - public void test_turtle_syntax_bad_ns_dot_start() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-ns-dot-start.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_num_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-num-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_num_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-num-02.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_num_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-num-03.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_num_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-num-04.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_num_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-num-05.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_number_dot_in_anon() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-number-dot-in-anon.ttl"), true); - } - @Test - public void test_turtle_syntax_bad_pname_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-pname-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_pname_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-pname-02.ttl"), false); - } -// @Test -// public void test_turtle_syntax_bad_pname_03() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-pname-03.ttl"), false); -// } - @Test - public void test_turtle_syntax_bad_prefix_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-prefix-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_prefix_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-prefix-02.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_prefix_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-prefix-03.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_prefix_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-prefix-04.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_prefix_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-prefix-05.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_string_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-string-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_string_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-string-02.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_string_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-string-03.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_string_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-string-04.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_string_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-string-05.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_string_06() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-string-06.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_string_07() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-string-07.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-01.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-02.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-03.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-04.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-05.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_06() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-06.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_07() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-07.ttl"), true); - } - @Test - public void test_turtle_syntax_bad_struct_08() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-08.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_09() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-09.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_10() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-10.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_11() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-11.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_12() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-12.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_13() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-13.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_14() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-14.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_15() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-15.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_16() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-16.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_struct_17() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-struct-17.ttl"), true); - } -// @Test -// public void test_turtle_syntax_bad_uri_01() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-uri-01.ttl"), false); -// } - @Test - public void test_turtle_syntax_bad_uri_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-uri-02.ttl"), false); - } - @Test - public void test_turtle_syntax_bad_uri_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-uri-03.ttl"), false); - } -// @Test -// public void test_turtle_syntax_bad_uri_04() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-uri-04.ttl"), false); -// } -// @Test -// public void test_turtle_syntax_bad_uri_05() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bad-uri-05.ttl"), false); -// } - @Test - public void test_turtle_syntax_base_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-base-01.ttl"), true); - } - @Test - public void test_turtle_syntax_base_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-base-02.ttl"), true); - } - @Test - public void test_turtle_syntax_base_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-base-03.ttl"), true); - } - @Test - public void test_turtle_syntax_base_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-base-04.ttl"), true); - } - @Test - public void test_turtle_syntax_blank_label() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-blank-label.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-01.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-02.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-03.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-04.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-05.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_06() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-06.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_07() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-07.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_08() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-08.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_09() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-09.ttl"), true); - } - @Test - public void test_turtle_syntax_bnode_10() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-bnode-10.ttl"), true); - } - @Test - public void test_turtle_syntax_datatypes_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-datatypes-01.ttl"), true); - } - @Test - public void test_turtle_syntax_datatypes_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-datatypes-02.ttl"), true); - } - @Test - public void test_turtle_syntax_file_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-file-01.ttl"), true); - } - @Test - public void test_turtle_syntax_file_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-file-02.ttl"), true); - } - @Test - public void test_turtle_syntax_file_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-file-03.ttl"), true); - } - @Test - public void test_turtle_syntax_kw_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-kw-01.ttl"), true); - } - @Test - public void test_turtle_syntax_kw_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-kw-02.ttl"), true); - } - @Test - public void test_turtle_syntax_kw_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-kw-03.ttl"), false); - } - @Test - public void test_turtle_syntax_lists_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-lists-01.ttl"), true); - } - @Test - public void test_turtle_syntax_lists_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-lists-02.ttl"), true); - } -// @Test -// public void test_turtle_syntax_lists_03() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-lists-03.ttl"), true); -// } -// @Test -// public void test_turtle_syntax_lists_04() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-lists-04.ttl"), true); -// } -// @Test -// public void test_turtle_syntax_lists_05() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-lists-05.ttl"), true); -// } -// @Test -// public void test_turtle_syntax_ln_colons() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-ln-colons.ttl"), true); -// } - @Test - public void test_turtle_syntax_ln_dots() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-ln-dots.ttl"), false); - } - @Test - public void test_turtle_syntax_ns_dots() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-ns-dots.ttl"), true); - } - @Test - public void test_turtle_syntax_number_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-01.ttl"), true); - } - @Test - public void test_turtle_syntax_number_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-02.ttl"), true); - } - @Test - public void test_turtle_syntax_number_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-03.ttl"), true); - } - @Test - public void test_turtle_syntax_number_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-04.ttl"), true); - } -// @Test -// public void test_turtle_syntax_number_05() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-05.ttl"), true); -// } - @Test - public void test_turtle_syntax_number_06() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-06.ttl"), true); - } - @Test - public void test_turtle_syntax_number_07() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-07.ttl"), true); - } -// @Test -// public void test_turtle_syntax_number_08() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-08.ttl"), true); -// } - @Test - public void test_turtle_syntax_number_09() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-09.ttl"), true); - } - @Test - public void test_turtle_syntax_number_10() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-10.ttl"), true); - } - @Test - public void test_turtle_syntax_number_11() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-number-11.ttl"), true); - } - @Test - public void test_turtle_syntax_pname_esc_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-pname-esc-01.ttl"), false); - } - @Test - public void test_turtle_syntax_pname_esc_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-pname-esc-02.ttl"), false); - } - @Test - public void test_turtle_syntax_pname_esc_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-pname-esc-03.ttl"), false); - } - @Test - public void test_turtle_syntax_prefix_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-prefix-01.ttl"), true); - } -// @Test -// public void test_turtle_syntax_prefix_02() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-prefix-02.ttl"), true); -// } - @Test - public void test_turtle_syntax_prefix_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-prefix-03.ttl"), true); - } - @Test - public void test_turtle_syntax_prefix_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-prefix-04.ttl"), true); - } -// @Test -// public void test_turtle_syntax_prefix_05() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-prefix-05.ttl"), true); -// } -// @Test -// public void test_turtle_syntax_prefix_06() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-prefix-06.ttl"), true); -// } - @Test - public void test_turtle_syntax_prefix_07() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-prefix-07.ttl"), true); - } - @Test - public void test_turtle_syntax_prefix_08() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-prefix-08.ttl"), true); - } - @Test - public void test_turtle_syntax_prefix_09() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-prefix-09.ttl"), true); - } - @Test - public void test_turtle_syntax_str_esc_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-str-esc-01.ttl"), true); - } - @Test - public void test_turtle_syntax_str_esc_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-str-esc-02.ttl"), true); - } - @Test - public void test_turtle_syntax_str_esc_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-str-esc-03.ttl"), true); - } - @Test - public void test_turtle_syntax_string_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-01.ttl"), true); - } - @Test - public void test_turtle_syntax_string_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-02.ttl"), true); - } - @Test - public void test_turtle_syntax_string_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-03.ttl"), true); - } - @Test - public void test_turtle_syntax_string_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-04.ttl"), true); - } - @Test - public void test_turtle_syntax_string_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-05.ttl"), true); - } - @Test - public void test_turtle_syntax_string_06() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-06.ttl"), true); - } - @Test - public void test_turtle_syntax_string_07() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-07.ttl"), true); - } - @Test - public void test_turtle_syntax_string_08() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-08.ttl"), true); - } - @Test - public void test_turtle_syntax_string_09() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-09.ttl"), true); - } - @Test - public void test_turtle_syntax_string_10() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-10.ttl"), true); - } - @Test - public void test_turtle_syntax_string_11() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-string-11.ttl"), true); - } - @Test - public void test_turtle_syntax_struct_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-struct-01.ttl"), true); - } - @Test - public void test_turtle_syntax_struct_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-struct-02.ttl"), true); - } - @Test - public void test_turtle_syntax_struct_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-struct-03.ttl"), true); - } - @Test - public void test_turtle_syntax_struct_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-struct-04.ttl"), true); - } - @Test - public void test_turtle_syntax_struct_05() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-struct-05.ttl"), true); - } - @Test - public void test_turtle_syntax_uri_01() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-uri-01.ttl"), true); - } - @Test - public void test_turtle_syntax_uri_02() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-uri-02.ttl"), true); - } - @Test - public void test_turtle_syntax_uri_03() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-uri-03.ttl"), true); - } - @Test - public void test_turtle_syntax_uri_04() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "turtle-syntax-uri-04.ttl"), true); - } - @Test - public void test_two_LITERAL_LONG2sNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "two_LITERAL_LONG2s.nt"), true); - } - @Test - public void test_two_LITERAL_LONG2s() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "two_LITERAL_LONG2s.ttl"), true); - } - @Test - public void test_underscore_in_localNameNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "underscore_in_localName.nt"), true); - } - @Test - public void test_underscore_in_localName() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "underscore_in_localName.ttl"), true); - } - @Test - public void test_anonymous_blank_node_object() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "anonymous_blank_node_object.ttl"), true); - } - @Test - public void test_anonymous_blank_node_subject() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "anonymous_blank_node_subject.ttl"), true); - } - @Test - public void test_bareword_a_predicateNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "bareword_a_predicate.nt"), true); - } - @Test - public void test_bareword_a_predicate() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "bareword_a_predicate.ttl"), true); - } - @Test - public void test_bareword_decimalNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "bareword_decimal.nt"), true); - } - @Test - public void test_bareword_decimal() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "bareword_decimal.ttl"), true); - } - @Test - public void test_bareword_doubleNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "bareword_double.nt"), true); - } - @Test - public void test_bareword_double() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "bareword_double.ttl"), true); - } - @Test - public void test_bareword_integer() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "bareword_integer.ttl"), true); - } - @Test - public void test_blankNodePropertyList_as_objectNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "blankNodePropertyList_as_object.nt"), true); - } - @Test - public void test_blankNodePropertyList_as_object() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "blankNodePropertyList_as_object.ttl"), true); - } - @Test - public void test_blankNodePropertyList_as_subjectNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "blankNodePropertyList_as_subject.nt"), true); - } -// @Test -// public void test_blankNodePropertyList_as_subject() throws Exception { -// doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "blankNodePropertyList_as_subject.ttl"), true); -// } - - @Test - public void test_blankNodePropertyList_containing_collectionNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "blankNodePropertyList_containing_collection.nt"), true); - } - @Test - public void test_blankNodePropertyList_containing_collection() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "blankNodePropertyList_containing_collection.ttl"), true); - } - @Test - public void test_blankNodePropertyList_with_multiple_triplesNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "blankNodePropertyList_with_multiple_triples.nt"), true); - } - @Test - public void test_blankNodePropertyList_with_multiple_triples() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "blankNodePropertyList_with_multiple_triples.ttl"), true); - } - @Test - public void test_collection_objectNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "collection_object.nt"), true); - } - @Test - public void test_collection_object() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "collection_object.ttl"), true); - } - @Test - public void test_collection_subjectNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "collection_subject.nt"), true); - } - @Test - public void test_collection_subject() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "collection_subject.ttl"), false); - } - @Test - public void test_comment_following_localName() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "comment_following_localName.ttl"), true); - } - @Test - public void test_comment_following_PNAME_NSNT() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "comment_following_PNAME_NS.nt"), true); - } - @Test - public void test_comment_following_PNAME_NS() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "comment_following_PNAME_NS.ttl"), false); - } - @Test - public void test__default_namespace_IRI() throws Exception { - doTest(Utilities.path(TestingUtilities.home(), "tests", "turtle", "default_namespace_IRI.ttl"), true); - } -// - - @Test - public void test_audit_event_example_pixQuery() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("audit-event-example-pixQuery.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "audit-event-example-pixQuery.ttl"))); - } - @Test - public void test_audit_event_example_media() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("audit-event-example-media.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "audit-event-example-media.ttl"))); - } - @Test - public void test_audit_event_example_logout() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("audit-event-example-logout.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "audit-event-example-logout.ttl"))); - } - @Test - public void test_audit_event_example_login() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("audit-event-example-login.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "audit-event-example-login.ttl"))); - } - @Test - public void test_appointmentresponse_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("appointmentresponse-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "appointmentresponse-example.ttl"))); - } - @Test - public void test_appointmentresponse_example_req() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("appointmentresponse-example-req.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "appointmentresponse-example-req.ttl"))); - } - @Test - public void test_appointment_example2doctors() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("appointment-example2doctors.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "appointment-example2doctors.ttl"))); - } - @Test - public void test_appointment_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("appointment-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "appointment-example.ttl"))); - } - @Test - public void test_appointment_example_request() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("appointment-example-request.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "appointment-example-request.ttl"))); - } - @Test - public void test_allergyintolerance_medication() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("allergyintolerance-medication.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "allergyintolerance-medication.ttl"))); - } - @Test - public void test_allergyintolerance_fishallergy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("allergyintolerance-fishallergy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "allergyintolerance-fishallergy.ttl"))); - } - @Test - public void test_allergyintolerance_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("allergyintolerance-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "allergyintolerance-example.ttl"))); - } - @Test - public void test_account_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("account-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "account-example.ttl"))); - } - @Test - public void test_xds_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("xds-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "xds-example.ttl"))); - } - @Test - public void test_visionprescription_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("visionprescription-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "visionprescription-example.ttl"))); - } - @Test - public void test_visionprescription_example_1() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("visionprescription-example-1.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "visionprescription-example-1.ttl"))); - } - @Test - public void test_valueset_ucum_common() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("valueset-ucum-common.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "valueset-ucum-common.ttl"))); - } - @Test - public void test_valueset_nhin_purposeofuse() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("valueset-nhin-purposeofuse.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "valueset-nhin-purposeofuse.ttl"))); - } - @Test - public void test_valueset_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("valueset-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "valueset-example.ttl"))); - } - @Test - public void test_valueset_example_yesnodontknow() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("valueset-example-yesnodontknow.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "valueset-example-yesnodontknow.ttl"))); - } - @Test - public void test_valueset_example_intensional() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("valueset-example-intensional.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "valueset-example-intensional.ttl"))); - } - @Test - public void test_valueset_example_expansion() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("valueset-example-expansion.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "valueset-example-expansion.ttl"))); - } - @Test - public void test_valueset_cpt_all() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("valueset-cpt-all.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "valueset-cpt-all.ttl"))); - } - @Test - public void test_testscript_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("testscript-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "testscript-example.ttl"))); - } - @Test - public void test_testscript_example_rule() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("testscript-example-rule.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "testscript-example-rule.ttl"))); - } - @Test - public void test_supplydelivery_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("supplydelivery-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "supplydelivery-example.ttl"))); - } - @Test - public void test_substance_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("substance-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "substance-example.ttl"))); - } - @Test - public void test_substance_example_silver_nitrate_product() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("substance-example-silver-nitrate-product.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "substance-example-silver-nitrate-product.ttl"))); - } - @Test - public void test_substance_example_f203_potassium() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("substance-example-f203-potassium.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "substance-example-f203-potassium.ttl"))); - } - @Test - public void test_substance_example_f202_staphylococcus() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("substance-example-f202-staphylococcus.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "substance-example-f202-staphylococcus.ttl"))); - } - @Test - public void test_substance_example_f201_dust() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("substance-example-f201-dust.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "substance-example-f201-dust.ttl"))); - } - @Test - public void test_substance_example_amoxicillin_clavulanate() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("substance-example-amoxicillin-clavulanate.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "substance-example-amoxicillin-clavulanate.ttl"))); - } - @Test - public void test_subscription_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("subscription-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "subscription-example.ttl"))); - } - @Test - public void test_subscription_example_error() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("subscription-example-error.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "subscription-example-error.ttl"))); - } - @Test - public void test_structuremap_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("structuremap-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "structuremap-example.ttl"))); - } - @Test - public void test_structuredefinition_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("structuredefinition-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "structuredefinition-example.ttl"))); - } - @Test - public void test_specimen_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("specimen-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "specimen-example.ttl"))); - } - @Test - public void test_specimen_example_urine() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("specimen-example-urine.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "specimen-example-urine.ttl"))); - } - @Test - public void test_specimen_example_isolate() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("specimen-example-isolate.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "specimen-example-isolate.ttl"))); - } - @Test - public void test_slot_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("slot-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "slot-example.ttl"))); - } - @Test - public void test_slot_example_unavailable() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("slot-example-unavailable.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "slot-example-unavailable.ttl"))); - } - @Test - public void test_slot_example_tentative() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("slot-example-tentative.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "slot-example-tentative.ttl"))); - } - @Test - public void test_slot_example_busy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("slot-example-busy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "slot-example-busy.ttl"))); - } - @Test - public void test_sequence_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("sequence-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "sequence-example.ttl"))); - } - @Test - public void test_searchparameter_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("searchparameter-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "searchparameter-example.ttl"))); - } - @Test - public void test_searchparameter_example_extension() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("searchparameter-example-extension.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "searchparameter-example-extension.ttl"))); - } - @Test - public void test_schedule_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("schedule-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "schedule-example.ttl"))); - } - @Test - public void test_riskassessment_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("riskassessment-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "riskassessment-example.ttl"))); - } - @Test - public void test_riskassessment_example_prognosis() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("riskassessment-example-prognosis.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "riskassessment-example-prognosis.ttl"))); - } - @Test - public void test_riskassessment_example_population() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("riskassessment-example-population.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "riskassessment-example-population.ttl"))); - } - @Test - public void test_riskassessment_example_cardiac() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("riskassessment-example-cardiac.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "riskassessment-example-cardiac.ttl"))); - } - @Test - public void test_relatedperson_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("relatedperson-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "relatedperson-example.ttl"))); - } - @Test - public void test_relatedperson_example_peter() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("relatedperson-example-peter.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "relatedperson-example-peter.ttl"))); - } - @Test - public void test_relatedperson_example_f002_ariadne() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("relatedperson-example-f002-ariadne.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "relatedperson-example-f002-ariadne.ttl"))); - } - @Test - public void test_relatedperson_example_f001_sarah() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("relatedperson-example-f001-sarah.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "relatedperson-example-f001-sarah.ttl"))); - } - @Test - public void test_provenance_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("provenance-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "provenance-example.ttl"))); - } - @Test - public void test_provenance_example_sig() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("provenance-example-sig.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "provenance-example-sig.ttl"))); - } - @Test - public void test_processresponse_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processresponse-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processresponse-example.ttl"))); - } - @Test - public void test_processrequest_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processrequest-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processrequest-example.ttl"))); - } - @Test - public void test_processrequest_example_status() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processrequest-example-status.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processrequest-example-status.ttl"))); - } - @Test - public void test_processrequest_example_reverse() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processrequest-example-reverse.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processrequest-example-reverse.ttl"))); - } - @Test - public void test_processrequest_example_reprocess() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processrequest-example-reprocess.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processrequest-example-reprocess.ttl"))); - } - @Test - public void test_processrequest_example_poll_specific() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processrequest-example-poll-specific.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processrequest-example-poll-specific.ttl"))); - } - @Test - public void test_processrequest_example_poll_payrec() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processrequest-example-poll-payrec.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processrequest-example-poll-payrec.ttl"))); - } - @Test - public void test_processrequest_example_poll_inclusive() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processrequest-example-poll-inclusive.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processrequest-example-poll-inclusive.ttl"))); - } - @Test - public void test_processrequest_example_poll_exclusive() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processrequest-example-poll-exclusive.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processrequest-example-poll-exclusive.ttl"))); - } - @Test - public void test_processrequest_example_poll_eob() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("processrequest-example-poll-eob.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "processrequest-example-poll-eob.ttl"))); - } - @Test - public void test_procedurerequest_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("procedurerequest-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "procedurerequest-example.ttl"))); - } - @Test - public void test_procedure_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("procedure-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "procedure-example.ttl"))); - } - @Test - public void test_procedure_example_implant() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("procedure-example-implant.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "procedure-example-implant.ttl"))); - } - @Test - public void test_procedure_example_f201_tpf() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("procedure-example-f201-tpf.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "procedure-example-f201-tpf.ttl"))); - } - @Test - public void test_procedure_example_f004_tracheotomy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("procedure-example-f004-tracheotomy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "procedure-example-f004-tracheotomy.ttl"))); - } - @Test - public void test_procedure_example_f003_abscess() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("procedure-example-f003-abscess.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "procedure-example-f003-abscess.ttl"))); - } - @Test - public void test_procedure_example_f002_lung() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("procedure-example-f002-lung.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "procedure-example-f002-lung.ttl"))); - } - @Test - public void test_procedure_example_f001_heart() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("procedure-example-f001-heart.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "procedure-example-f001-heart.ttl"))); - } - @Test - public void test_procedure_example_biopsy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("procedure-example-biopsy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "procedure-example-biopsy.ttl"))); - } - @Test - public void test_practitionerrole_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitionerrole-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitionerrole-example.ttl"))); - } - @Test - public void test_practitioner_examples_general() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-examples-general.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-examples-general.ttl"))); - } - @Test - public void test_practitioner_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example.ttl"))); - } - @Test - public void test_practitioner_example_xcda1() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-xcda1.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-xcda1.ttl"))); - } - @Test - public void test_practitioner_example_xcda_author() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-xcda-author.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-xcda-author.ttl"))); - } - @Test - public void test_practitioner_example_f204_ce() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f204-ce.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f204-ce.ttl"))); - } - @Test - public void test_practitioner_example_f203_jvg() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f203-jvg.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f203-jvg.ttl"))); - } - @Test - public void test_practitioner_example_f202_lm() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f202-lm.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f202-lm.ttl"))); - } - @Test - public void test_practitioner_example_f201_ab() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f201-ab.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f201-ab.ttl"))); - } - @Test - public void test_practitioner_example_f007_sh() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f007-sh.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f007-sh.ttl"))); - } - @Test - public void test_practitioner_example_f006_rvdb() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f006-rvdb.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f006-rvdb.ttl"))); - } - @Test - public void test_practitioner_example_f005_al() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f005-al.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f005-al.ttl"))); - } - @Test - public void test_practitioner_example_f004_rb() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f004-rb.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f004-rb.ttl"))); - } - @Test - public void test_practitioner_example_f003_mv() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f003-mv.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f003-mv.ttl"))); - } - @Test - public void test_practitioner_example_f002_pv() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f002-pv.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f002-pv.ttl"))); - } - @Test - public void test_practitioner_example_f001_evdb() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("practitioner-example-f001-evdb.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "practitioner-example-f001-evdb.ttl"))); - } - @Test - public void test_person_provider_directory() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("person-provider-directory.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "person-provider-directory.ttl"))); - } - @Test - public void test_person_patient_portal() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("person-patient-portal.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "person-patient-portal.ttl"))); - } - @Test - public void test_person_grahame() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("person-grahame.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "person-grahame.ttl"))); - } - @Test - public void test_person_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("person-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "person-example.ttl"))); - } - @Test - public void test_person_example_f002_ariadne() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("person-example-f002-ariadne.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "person-example-f002-ariadne.ttl"))); - } - @Test - public void test_paymentreconciliation_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("paymentreconciliation-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "paymentreconciliation-example.ttl"))); - } - @Test - public void test_paymentnotice_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("paymentnotice-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "paymentnotice-example.ttl"))); - } - @Test - public void test_patient_glossy_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-glossy-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-glossy-example.ttl"))); - } - @Test - public void test_patient_examples_general() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-examples-general.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-examples-general.ttl"))); - } - @Test - public void test_patient_examples_cypress_template() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-examples-cypress-template.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-examples-cypress-template.ttl"))); - } - @Test - public void test_patient_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example.ttl"))); - } - @Test - public void test_patient_example_xds() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-xds.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-xds.ttl"))); - } - @Test - public void test_patient_example_xcda() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-xcda.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-xcda.ttl"))); - } - @Test - public void test_patient_example_proband() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-proband.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-proband.ttl"))); - } - @Test - public void test_patient_example_ihe_pcd() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-ihe-pcd.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-ihe-pcd.ttl"))); - } - @Test - public void test_patient_example_f201_roel() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-f201-roel.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-f201-roel.ttl"))); - } - @Test - public void test_patient_example_f001_pieter() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-f001-pieter.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-f001-pieter.ttl"))); - } - @Test - public void test_patient_example_dicom() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-dicom.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-dicom.ttl"))); - } - @Test - public void test_patient_example_d() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-d.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-d.ttl"))); - } - @Test - public void test_patient_example_c() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-c.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-c.ttl"))); - } - @Test - public void test_patient_example_b() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-b.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-b.ttl"))); - } - @Test - public void test_patient_example_animal() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-animal.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-animal.ttl"))); - } - @Test - public void test_patient_example_a() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("patient-example-a.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "patient-example-a.ttl"))); - } - @Test - public void test_parameters_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("parameters-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "parameters-example.ttl"))); - } - @Test - public void test_organization_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example.ttl"))); - } - @Test - public void test_organization_example_lab() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example-lab.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example-lab.ttl"))); - } - @Test - public void test_organization_example_insurer() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example-insurer.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example-insurer.ttl"))); - } - @Test - public void test_organization_example_good_health_care() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example-good-health-care.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example-good-health-care.ttl"))); - } - @Test - public void test_organization_example_gastro() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example-gastro.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example-gastro.ttl"))); - } - @Test - public void test_organization_example_f203_bumc() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example-f203-bumc.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example-f203-bumc.ttl"))); - } - @Test - public void test_organization_example_f201_aumc() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example-f201-aumc.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example-f201-aumc.ttl"))); - } - @Test - public void test_organization_example_f003_burgers_ENT() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example-f003-burgers-ENT.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example-f003-burgers-ENT.ttl"))); - } - @Test - public void test_organization_example_f002_burgers_card() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example-f002-burgers-card.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example-f002-burgers-card.ttl"))); - } - @Test - public void test_organization_example_f001_burgers() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("organization-example-f001-burgers.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "organization-example-f001-burgers.ttl"))); - } - @Test - public void test_operationoutcome_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("operationoutcome-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "operationoutcome-example.ttl"))); - } - @Test - public void test_operationoutcome_example_validationfail() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("operationoutcome-example-validationfail.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "operationoutcome-example-validationfail.ttl"))); - } - @Test - public void test_operationoutcome_example_searchfail() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("operationoutcome-example-searchfail.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "operationoutcome-example-searchfail.ttl"))); - } - @Test - public void test_operationoutcome_example_exception() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("operationoutcome-example-exception.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "operationoutcome-example-exception.ttl"))); - } - @Test - public void test_operationoutcome_example_break_the_glass() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("operationoutcome-example-break-the-glass.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "operationoutcome-example-break-the-glass.ttl"))); - } - @Test - public void test_operationoutcome_example_allok() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("operationoutcome-example-allok.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "operationoutcome-example-allok.ttl"))); - } - @Test - public void test_operationdefinition_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("operationdefinition-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "operationdefinition-example.ttl"))); - } - @Test - public void test_observation_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example.ttl"))); - } - @Test - public void test_observation_example_unsat() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-unsat.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-unsat.ttl"))); - } - @Test - public void test_observation_example_satO2() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-satO2.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-satO2.ttl"))); - } - @Test - public void test_observation_example_sample_data() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-sample-data.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-sample-data.ttl"))); - } - @Test - public void test_observation_example_glasgow() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-glasgow.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-glasgow.ttl"))); - } - @Test - public void test_observation_example_glasgow_qa() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-glasgow-qa.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-glasgow-qa.ttl"))); - } - @Test - public void test_observation_example_genetics_5() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-genetics-5.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-genetics-5.ttl"))); - } - @Test - public void test_observation_example_genetics_4() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-genetics-4.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-genetics-4.ttl"))); - } - @Test - public void test_observation_example_genetics_3() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-genetics-3.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-genetics-3.ttl"))); - } - @Test - public void test_observation_example_genetics_2() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-genetics-2.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-genetics-2.ttl"))); - } - @Test - public void test_observation_example_genetics_1() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-genetics-1.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-genetics-1.ttl"))); - } - @Test - public void test_observation_example_f206_staphylococcus() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f206-staphylococcus.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f206-staphylococcus.ttl"))); - } - @Test - public void test_observation_example_f205_egfr() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f205-egfr.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f205-egfr.ttl"))); - } - @Test - public void test_observation_example_f204_creatinine() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f204-creatinine.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f204-creatinine.ttl"))); - } - @Test - public void test_observation_example_f203_bicarbonate() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f203-bicarbonate.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f203-bicarbonate.ttl"))); - } - @Test - public void test_observation_example_f202_temperature() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f202-temperature.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f202-temperature.ttl"))); - } - @Test - public void test_observation_example_f005_hemoglobin() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f005-hemoglobin.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f005-hemoglobin.ttl"))); - } - @Test - public void test_observation_example_f004_erythrocyte() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f004-erythrocyte.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f004-erythrocyte.ttl"))); - } - @Test - public void test_observation_example_f003_co2() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f003-co2.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f003-co2.ttl"))); - } - @Test - public void test_observation_example_f002_excess() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f002-excess.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f002-excess.ttl"))); - } - @Test - public void test_observation_example_f001_glucose() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-f001-glucose.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-f001-glucose.ttl"))); - } - @Test - public void test_observation_example_bloodpressure() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-bloodpressure.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-bloodpressure.ttl"))); - } - @Test - public void test_observation_example_bloodpressure_cancel() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("observation-example-bloodpressure-cancel.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "observation-example-bloodpressure-cancel.ttl"))); - } - @Test - public void test_nutritionorder_example_texture_modified() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-texture-modified.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-texture-modified.ttl"))); - } - @Test - public void test_nutritionorder_example_renaldiet() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-renaldiet.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-renaldiet.ttl"))); - } - @Test - public void test_nutritionorder_example_pureeddiet() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-pureeddiet.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-pureeddiet.ttl"))); - } - @Test - public void test_nutritionorder_example_pureeddiet_simple() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-pureeddiet-simple.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-pureeddiet-simple.ttl"))); - } - @Test - public void test_nutritionorder_example_proteinsupplement() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-proteinsupplement.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-proteinsupplement.ttl"))); - } - @Test - public void test_nutritionorder_example_infantenteral() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-infantenteral.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-infantenteral.ttl"))); - } - @Test - public void test_nutritionorder_example_fiberrestricteddiet() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-fiberrestricteddiet.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-fiberrestricteddiet.ttl"))); - } - @Test - public void test_nutritionorder_example_enteralcontinuous() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-enteralcontinuous.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-enteralcontinuous.ttl"))); - } - @Test - public void test_nutritionorder_example_enteralbolus() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-enteralbolus.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-enteralbolus.ttl"))); - } - @Test - public void test_nutritionorder_example_energysupplement() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-energysupplement.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-energysupplement.ttl"))); - } - @Test - public void test_nutritionorder_example_diabeticsupplement() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-diabeticsupplement.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-diabeticsupplement.ttl"))); - } - @Test - public void test_nutritionorder_example_diabeticdiet() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-diabeticdiet.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-diabeticdiet.ttl"))); - } - @Test - public void test_nutritionorder_example_cardiacdiet() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("nutritionorder-example-cardiacdiet.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "nutritionorder-example-cardiacdiet.ttl"))); - } - @Test - public void test_namingsystem_registry() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("namingsystem-registry.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "namingsystem-registry.ttl"))); - } - @Test - public void test_namingsystem_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("namingsystem-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "namingsystem-example.ttl"))); - } - @Test - public void test_namingsystem_example_replaced() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("namingsystem-example-replaced.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "namingsystem-example-replaced.ttl"))); - } - @Test - public void test_namingsystem_example_id() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("namingsystem-example-id.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "namingsystem-example-id.ttl"))); - } - @Test - public void test_messageheader_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("messageheader-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "messageheader-example.ttl"))); - } - @Test - public void test_message_response_link() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("message-response-link.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "message-response-link.ttl"))); - } - @Test - public void test_message_request_link() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("message-request-link.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "message-request-link.ttl"))); - } - @Test - public void test_medicationstatementexample7() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationstatementexample7.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationstatementexample7.ttl"))); - } - @Test - public void test_medicationstatementexample6() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationstatementexample6.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationstatementexample6.ttl"))); - } - @Test - public void test_medicationstatementexample5() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationstatementexample5.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationstatementexample5.ttl"))); - } - @Test - public void test_medicationstatementexample4() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationstatementexample4.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationstatementexample4.ttl"))); - } - @Test - public void test_medicationstatementexample2() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationstatementexample2.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationstatementexample2.ttl"))); - } - @Test - public void test_medicationstatementexample1() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationstatementexample1.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationstatementexample1.ttl"))); - } - @Test - public void test_medicationrequestexample2() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationrequestexample2.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationrequestexample2.ttl"))); - } - @Test - public void test_medicationrequestexample1() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationrequestexample1.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationrequestexample1.ttl"))); - } - @Test - public void test_medicationexample15() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationexample15.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationexample15.ttl"))); - } - @Test - public void test_medicationexample1() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationexample1.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationexample1.ttl"))); - } - @Test - public void test_medicationdispenseexample8() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationdispenseexample8.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationdispenseexample8.ttl"))); - } - @Test - public void test_medicationadministrationexample3() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationadministrationexample3.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationadministrationexample3.ttl"))); - } - @Test - public void test_medication_example_f203_paracetamol() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("medicationexample0312.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "medicationexample0312.ttl"))); - } - @Test - public void test_media_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("media-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "media-example.ttl"))); - } - @Test - public void test_media_example_sound() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("media-example-sound.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "media-example-sound.ttl"))); - } - @Test - public void test_media_example_dicom() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("media-example-dicom.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "media-example-dicom.ttl"))); - } - @Test - public void test_measurereport_cms146_cat3_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("measurereport-cms146-cat3-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "measurereport-cms146-cat3-example.ttl"))); - } - @Test - public void test_measurereport_cms146_cat2_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("measurereport-cms146-cat2-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "measurereport-cms146-cat2-example.ttl"))); - } - @Test - public void test_measurereport_cms146_cat1_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("measurereport-cms146-cat1-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "measurereport-cms146-cat1-example.ttl"))); - } - @Test - public void test_measure_exclusive_breastfeeding() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("measure-exclusive-breastfeeding.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "measure-exclusive-breastfeeding.ttl"))); - } - @Test - public void test_location_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("location-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "location-example.ttl"))); - } - @Test - public void test_location_example_ukpharmacy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("location-example-ukpharmacy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "location-example-ukpharmacy.ttl"))); - } - @Test - public void test_location_example_room() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("location-example-room.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "location-example-room.ttl"))); - } - @Test - public void test_location_example_patients_home() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("location-example-patients-home.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "location-example-patients-home.ttl"))); - } - @Test - public void test_location_example_hl7hq() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("location-example-hl7hq.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "location-example-hl7hq.ttl"))); - } - @Test - public void test_location_example_ambulance() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("location-example-ambulance.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "location-example-ambulance.ttl"))); - } - @Test - public void test_list_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("list-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "list-example.ttl"))); - } - @Test - public void test_list_example_medlist() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("list-example-medlist.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "list-example-medlist.ttl"))); - } - @Test - public void test_list_example_familyhistory_f201_roel() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("list-example-familyhistory-f201-roel.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "list-example-familyhistory-f201-roel.ttl"))); - } - @Test - public void test_list_example_empty() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("list-example-empty.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "list-example-empty.ttl"))); - } - @Test - public void test_list_example_allergies() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("list-example-allergies.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "list-example-allergies.ttl"))); - } - @Test - public void test_linkage_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("linkage-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "linkage-example.ttl"))); - } - @Test - public void test_library_exclusive_breastfeeding_cqm_logic() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("library-exclusive-breastfeeding-cqm-logic.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "library-exclusive-breastfeeding-cqm-logic.ttl"))); - } - @Test - public void test_library_exclusive_breastfeeding_cds_logic() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("library-exclusive-breastfeeding-cds-logic.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "library-exclusive-breastfeeding-cds-logic.ttl"))); - } - @Test - public void test_library_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("library-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "library-example.ttl"))); - } - @Test - public void test_library_cms146_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("library-cms146-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "library-cms146-example.ttl"))); - } - @Test - public void test_implementationguide_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("implementationguide-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "implementationguide-example.ttl"))); - } - @Test - public void test_immunizationrecommendation_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("immunizationrecommendation-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "immunizationrecommendation-example.ttl"))); - } - @Test - public void test_immunization_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("immunization-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "immunization-example.ttl"))); - } - @Test - public void test_immunization_example_refused() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("immunization-example-refused.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "immunization-example-refused.ttl"))); - } - @Test - public void test_imagingstudy_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("imagingstudy-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "imagingstudy-example.ttl"))); - } - @Test - public void test_healthcareservice_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("healthcareservice-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "healthcareservice-example.ttl"))); - } - @Test - public void test_guidanceresponse_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("guidanceresponse-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "guidanceresponse-example.ttl"))); - } - @Test - public void test_group_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("group-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "group-example.ttl"))); - } - @Test - public void test_group_example_member() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("group-example-member.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "group-example-member.ttl"))); - } - @Test - public void test_goal_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("goal-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "goal-example.ttl"))); - } - @Test - public void test_flag_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("flag-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "flag-example.ttl"))); - } - @Test - public void test_flag_example_encounter() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("flag-example-encounter.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "flag-example-encounter.ttl"))); - } - @Test - public void test_familymemberhistory_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("familymemberhistory-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "familymemberhistory-example.ttl"))); - } - @Test - public void test_familymemberhistory_example_mother() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("familymemberhistory-example-mother.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "familymemberhistory-example-mother.ttl"))); - } - @Test - public void test_explanationofbenefit_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("explanationofbenefit-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "explanationofbenefit-example.ttl"))); - } - @Test - public void test_episodeofcare_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("episodeofcare-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "episodeofcare-example.ttl"))); - } - @Test - public void test_enrollmentresponse_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("enrollmentresponse-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "enrollmentresponse-example.ttl"))); - } - @Test - public void test_enrollmentrequest_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("enrollmentrequest-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "enrollmentrequest-example.ttl"))); - } - @Test - public void test_endpoint_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("endpoint-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "endpoint-example.ttl"))); - } - @Test - public void test_encounter_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("encounter-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "encounter-example.ttl"))); - } - @Test - public void test_encounter_example_xcda() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("encounter-example-xcda.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "encounter-example-xcda.ttl"))); - } - @Test - public void test_encounter_example_home() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("encounter-example-home.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "encounter-example-home.ttl"))); - } - @Test - public void test_encounter_example_f203_20130311() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("encounter-example-f203-20130311.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "encounter-example-f203-20130311.ttl"))); - } - @Test - public void test_encounter_example_f202_20130128() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("encounter-example-f202-20130128.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "encounter-example-f202-20130128.ttl"))); - } - @Test - public void test_encounter_example_f201_20130404() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("encounter-example-f201-20130404.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "encounter-example-f201-20130404.ttl"))); - } - @Test - public void test_encounter_example_f003_abscess() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("encounter-example-f003-abscess.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "encounter-example-f003-abscess.ttl"))); - } - @Test - public void test_encounter_example_f002_lung() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("encounter-example-f002-lung.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "encounter-example-f002-lung.ttl"))); - } - @Test - public void test_encounter_example_f001_heart() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("encounter-example-f001-heart.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "encounter-example-f001-heart.ttl"))); - } - @Test - public void test_eligibilityresponse_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("eligibilityresponse-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "eligibilityresponse-example.ttl"))); - } - @Test - public void test_eligibilityrequest_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("eligibilityrequest-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "eligibilityrequest-example.ttl"))); - } - @Test - public void test_documentreference_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("documentreference-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "documentreference-example.ttl"))); - } - @Test - public void test_documentmanifest_fm_attachment() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("documentmanifest-fm-attachment.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "documentmanifest-fm-attachment.ttl"))); - } - @Test - public void test_document_example_dischargesummary() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("document-example-dischargesummary.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "document-example-dischargesummary.ttl"))); - } - @Test - public void test_diagnosticreport_micro1() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-micro1.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-micro1.ttl"))); - } - @Test - public void test_diagnosticreport_hla_genetics_results_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-hla-genetics-results-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-hla-genetics-results-example.ttl"))); - } - - @Test - public void test_diagnosticreport_genetics_comprehensive_bone_marrow_report() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-genetics-comprehensive-bone-marrow-report.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-genetics-comprehensive-bone-marrow-report.ttl"))); - } - @Test - public void test_diagnosticreport_examples_general() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-examples-general.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-examples-general.ttl"))); - } - @Test - public void test_diagnosticreport_example_ultrasound() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-example-ultrasound.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-example-ultrasound.ttl"))); - } - @Test - public void test_diagnosticreport_example_lipids() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-example-lipids.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-example-lipids.ttl"))); - } - @Test - public void test_diagnosticreport_example_ghp() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-example-ghp.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-example-ghp.ttl"))); - } - @Test - public void test_diagnosticreport_example_f202_bloodculture() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-example-f202-bloodculture.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-example-f202-bloodculture.ttl"))); - } - @Test - public void test_diagnosticreport_example_f201_brainct() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-example-f201-brainct.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-example-f201-brainct.ttl"))); - } - @Test - public void test_diagnosticreport_example_f001_bloodexam() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-example-f001-bloodexam.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-example-f001-bloodexam.ttl"))); - } - @Test - public void test_diagnosticreport_example_dxa() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("diagnosticreport-example-dxa.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "diagnosticreport-example-dxa.ttl"))); - } - @Test - public void test_deviceusestatement_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("deviceusestatement-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "deviceusestatement-example.ttl"))); - } - @Test - public void test_devicemetric_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("devicemetric-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "devicemetric-example.ttl"))); - } - @Test - public void test_devicecomponent_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("devicecomponent-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "devicecomponent-example.ttl"))); - } - @Test - public void test_devicecomponent_example_prodspec() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("devicecomponent-example-prodspec.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "devicecomponent-example-prodspec.ttl"))); - } - @Test - public void test_device_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("device-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "device-example.ttl"))); - } - @Test - public void test_device_example_udi1() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("device-example-udi1.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "device-example-udi1.ttl"))); - } - @Test - public void test_device_example_software() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("device-example-software.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "device-example-software.ttl"))); - } - @Test - public void test_device_example_pacemaker() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("device-example-pacemaker.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "device-example-pacemaker.ttl"))); - } - @Test - public void test_device_example_ihe_pcd() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("device-example-ihe-pcd.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "device-example-ihe-pcd.ttl"))); - } - @Test - public void test_device_example_f001_feedingtube() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("device-example-f001-feedingtube.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "device-example-f001-feedingtube.ttl"))); - } - @Test - public void test_detectedissue_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("detectedissue-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "detectedissue-example.ttl"))); - } - @Test - public void test_detectedissue_example_lab() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("detectedissue-example-lab.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "detectedissue-example-lab.ttl"))); - } - @Test - public void test_detectedissue_example_dup() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("detectedissue-example-dup.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "detectedissue-example-dup.ttl"))); - } - @Test - public void test_detectedissue_example_allergy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("detectedissue-example-allergy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "detectedissue-example-allergy.ttl"))); - } - @Test - public void test_coverage_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("coverage-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "coverage-example.ttl"))); - } - @Test - public void test_coverage_example_2() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("coverage-example-2.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "coverage-example-2.ttl"))); - } - @Test - public void test_contract_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("contract-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "contract-example.ttl"))); - } - @Test - public void test_condition_example2() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example2.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example2.ttl"))); - } - @Test - public void test_condition_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example.ttl"))); - } - @Test - public void test_condition_example_stroke() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example-stroke.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example-stroke.ttl"))); - } - @Test - public void test_condition_example_f205_infection() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example-f205-infection.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example-f205-infection.ttl"))); - } - @Test - public void test_condition_example_f204_renal() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example-f204-renal.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example-f204-renal.ttl"))); - } - @Test - public void test_condition_example_f203_sepsis() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example-f203-sepsis.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example-f203-sepsis.ttl"))); - } - @Test - public void test_condition_example_f202_malignancy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example-f202-malignancy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example-f202-malignancy.ttl"))); - } - @Test - public void test_condition_example_f201_fever() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example-f201-fever.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example-f201-fever.ttl"))); - } - @Test - public void test_condition_example_f003_abscess() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example-f003-abscess.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example-f003-abscess.ttl"))); - } - @Test - public void test_condition_example_f002_lung() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example-f002-lung.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example-f002-lung.ttl"))); - } - @Test - public void test_condition_example_f001_heart() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("condition-example-f001-heart.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "condition-example-f001-heart.ttl"))); - } - @Test - public void test_conceptmap_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("conceptmap-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "conceptmap-example.ttl"))); - } - @Test - public void test_conceptmap_example_specimen_type() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("conceptmap-example-specimen-type.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "conceptmap-example-specimen-type.ttl"))); - } - @Test - public void test_conceptmap_103() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("conceptmap-103.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "conceptmap-103.ttl"))); - } - @Test - public void test_composition_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("composition-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "composition-example.ttl"))); - } - @Test - public void test_communicationrequest_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("communicationrequest-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "communicationrequest-example.ttl"))); - } - @Test - public void test_communication_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("communication-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "communication-example.ttl"))); - } - @Test - public void test_codesystem_nhin_purposeofuse() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("codesystem-nhin-purposeofuse.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "codesystem-nhin-purposeofuse.ttl"))); - } - @Test - public void test_codesystem_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("codesystem-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "codesystem-example.ttl"))); - } - @Test - public void test_clinicalimpression_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("clinicalimpression-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "clinicalimpression-example.ttl"))); - } - @Test - public void test_claimresponse_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claimresponse-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claimresponse-example.ttl"))); - } - @Test - public void test_claim_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example.ttl"))); - } - @Test - public void test_claim_example_vision() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-vision.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-vision.ttl"))); - } - @Test - public void test_claim_example_vision_glasses() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-vision-glasses.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-vision-glasses.ttl"))); - } - @Test - public void test_claim_example_professional() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-professional.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-professional.ttl"))); - } - @Test - public void test_claim_example_pharmacy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-pharmacy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-pharmacy.ttl"))); - } - @Test - public void test_claim_example_oral_orthoplan() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-oral-orthoplan.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-oral-orthoplan.ttl"))); - } - @Test - public void test_claim_example_oral_identifier() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-oral-identifier.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-oral-identifier.ttl"))); - } - @Test - public void test_claim_example_oral_contained() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-oral-contained.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-oral-contained.ttl"))); - } - @Test - public void test_claim_example_oral_contained_identifier() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-oral-contained-identifier.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-oral-contained-identifier.ttl"))); - } - @Test - public void test_claim_example_oral_average() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-oral-average.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-oral-average.ttl"))); - } - @Test - public void test_claim_example_institutional() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("claim-example-institutional.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "claim-example-institutional.ttl"))); - } - @Test - public void test_careteam_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careteam-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careteam-example.ttl"))); - } - @Test - public void test_careplan_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example.ttl"))); - } - @Test - public void test_careplan_example_pregnancy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example-pregnancy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example-pregnancy.ttl"))); - } - @Test - public void test_careplan_example_integrated() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example-integrated.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example-integrated.ttl"))); - } - @Test - public void test_careplan_example_GPVisit() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example-GPVisit.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example-GPVisit.ttl"))); - } - @Test - public void test_careplan_example_f203_sepsis() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example-f203-sepsis.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example-f203-sepsis.ttl"))); - } - @Test - public void test_careplan_example_f202_malignancy() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example-f202-malignancy.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example-f202-malignancy.ttl"))); - } - @Test - public void test_careplan_example_f201_renal() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example-f201-renal.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example-f201-renal.ttl"))); - } - @Test - public void test_careplan_example_f003_pharynx() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example-f003-pharynx.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example-f003-pharynx.ttl"))); - } - @Test - public void test_careplan_example_f002_lung() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example-f002-lung.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example-f002-lung.ttl"))); - } - @Test - public void test_careplan_example_f001_heart() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("careplan-example-f001-heart.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "careplan-example-f001-heart.ttl"))); - } - @Test - public void test_bundle_transaction() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("bundle-transaction.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "bundle-transaction.ttl"))); - } - @Test - public void test_bundle_response() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("bundle-response.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "bundle-response.ttl"))); - } - @Test - public void test_bundle_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("bundle-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "bundle-example.ttl"))); - } - @Test - public void test_binary_f006() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("binary-f006.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "binary-f006.ttl"))); - } - @Test - public void test_binary_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("binary-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "binary-example.ttl"))); - } - @Test - public void test_basic_example2() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("basic-example2.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "basic-example2.ttl"))); - } - @Test - public void test_basic_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("basic-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "basic-example.ttl"))); - } - @Test - public void test_basic_example_narrative() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("basic-example-narrative.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "basic-example-narrative.ttl"))); - } - @Test - public void test_auditevent_example() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("auditevent-example.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "auditevent-example.ttl"))); - } - @Test - public void test_auditevent_example_disclosure() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("auditevent-example-disclosure.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "auditevent-example-disclosure.ttl"))); - } - @Test - public void test_audit_event_example_vread() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("audit-event-example-vread.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "audit-event-example-vread.ttl"))); - } - @Test - public void test_audit_event_example_search() throws FileNotFoundException, IOException, Exception { - if (!TestingUtilities.silent) - System.out.println("audit-event-example-search.ttl"); - new Turtle().parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), "publish", "audit-event-example-search.ttl"))); - } - - -} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/support/TestingUtilities.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/support/TestingUtilities.java index e55b9fa2206..1d9860f59a6 100644 --- a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/support/TestingUtilities.java +++ b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/test/support/TestingUtilities.java @@ -270,7 +270,7 @@ public class TestingUtilities { JsonArray a1 = (JsonArray) n1; JsonArray a2 = (JsonArray) n2; - if (a1.size() != a1.size()) + if (a1.size() != a2.size()) return "array properties differ at "+path+": count "+Integer.toString(a1.size())+"/"+Integer.toString(a2.size()); for (int i = 0; i < a1.size(); i++) { String s = compareNodes(path+"["+Integer.toString(i)+"]", a1.get(i), a2.get(i)); diff --git a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/BaseController.java b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/BaseController.java index 0c1f632ae54..8e1c430e1ee 100644 --- a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/BaseController.java +++ b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/BaseController.java @@ -1,24 +1,31 @@ package ca.uhn.fhir.to; -import static org.apache.commons.lang3.StringUtils.defaultString; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.*; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; - +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.context.RuntimeResourceDefinition; +import ca.uhn.fhir.model.api.ExtensionDt; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.dstu2.resource.Conformance; +import ca.uhn.fhir.model.primitive.DecimalDt; +import ca.uhn.fhir.rest.api.Constants; +import ca.uhn.fhir.rest.api.EncodingEnum; +import ca.uhn.fhir.rest.client.api.IClientInterceptor; +import ca.uhn.fhir.rest.client.api.IHttpRequest; +import ca.uhn.fhir.rest.client.api.IHttpResponse; +import ca.uhn.fhir.rest.client.impl.GenericClient; +import ca.uhn.fhir.to.model.HomeRequest; +import ca.uhn.fhir.util.ExtensionConstants; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.Header; import org.apache.http.entity.ContentType; import org.apache.http.message.BasicHeader; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.CapabilityStatement; import org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent; import org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent; +import org.hl7.fhir.dstu3.model.DecimalType; +import org.hl7.fhir.dstu3.model.Extension; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IDomainResource; @@ -26,23 +33,19 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.ModelMap; import org.thymeleaf.TemplateEngine; -import ca.uhn.fhir.context.*; -import ca.uhn.fhir.model.api.ExtensionDt; -import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.dstu2.resource.Conformance; -import ca.uhn.fhir.model.primitive.DecimalDt; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.EncodingEnum; -import ca.uhn.fhir.rest.client.api.*; -import ca.uhn.fhir.rest.client.impl.GenericClient; -import ca.uhn.fhir.to.model.HomeRequest; -import ca.uhn.fhir.util.ExtensionConstants; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.*; + +import static org.apache.commons.lang3.StringUtils.defaultString; public class BaseController { - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseController.class); static final String PARAM_RESOURCE = "resource"; static final String RESOURCE_COUNT_EXT_URL = "http://hl7api.sourceforge.net/hapi-fhir/res/extdefs.html#resourceCount"; - + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseController.class); @Autowired protected TesterConfig myConfig; private Map<FhirVersionEnum, FhirContext> myContexts = new HashMap<FhirVersionEnum, FhirContext>(); @@ -294,13 +297,15 @@ public class BaseController { private IBaseResource loadAndAddConf(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) { switch (theRequest.getFhirVersion(myConfig)) { - case DSTU2: - return loadAndAddConfDstu2(theServletRequest, theRequest, theModel); - case DSTU3: - return loadAndAddConfDstu3(theServletRequest, theRequest, theModel); - case DSTU2_1: - case DSTU2_HL7ORG: - break; + case DSTU2: + return loadAndAddConfDstu2(theServletRequest, theRequest, theModel); + case DSTU3: + return loadAndAddConfDstu3(theServletRequest, theRequest, theModel); + case R4: + return loadAndAddConfR4(theServletRequest, theRequest, theModel); + case DSTU2_1: + case DSTU2_HL7ORG: + break; } throw new IllegalStateException("Unknown version: " + theRequest.getFhirVersion(myConfig)); } @@ -379,7 +384,7 @@ public class BaseController { } theModel.put("jsonEncodedConf", getContext(theRequest).newJsonParser().encodeResourceToString(capabilityStatement)); - + Map<String, Number> resourceCounts = new HashMap<String, Number>(); long total = 0; @@ -427,6 +432,67 @@ public class BaseController { return capabilityStatement; } + private IBaseResource loadAndAddConfR4(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) { + CaptureInterceptor interceptor = new CaptureInterceptor(); + GenericClient client = theRequest.newClient(theServletRequest, getContext(theRequest), myConfig, interceptor); + + org.hl7.fhir.r4.model.CapabilityStatement capabilityStatement = new org.hl7.fhir.r4.model.CapabilityStatement(); + try { + capabilityStatement = client.fetchConformance().ofType(org.hl7.fhir.r4.model.CapabilityStatement.class).execute(); + } catch (Exception ex) { + ourLog.warn("Failed to load conformance statement, error was: {}", ex.toString()); + theModel.put("errorMsg", toDisplayError("Failed to load conformance statement, error was: " + ex.toString(), ex)); + } + + theModel.put("jsonEncodedConf", getContext(theRequest).newJsonParser().encodeResourceToString(capabilityStatement)); + + Map<String, Number> resourceCounts = new HashMap<String, Number>(); + long total = 0; + + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent nextRest : capabilityStatement.getRest()) { + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent nextResource : nextRest.getResource()) { + List<org.hl7.fhir.r4.model.Extension> exts = nextResource.getExtensionsByUrl(RESOURCE_COUNT_EXT_URL); + if (exts != null && exts.size() > 0) { + Number nextCount = ((org.hl7.fhir.r4.model.DecimalType) (exts.get(0).getValue())).getValueAsNumber(); + resourceCounts.put(nextResource.getTypeElement().getValue(), nextCount); + total += nextCount.longValue(); + } + } + } + + theModel.put("resourceCounts", resourceCounts); + + if (total > 0) { + for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent nextRest : capabilityStatement.getRest()) { + Collections.sort(nextRest.getResource(), new Comparator<org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent>() { + @Override + public int compare(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent theO1, org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent theO2) { + org.hl7.fhir.r4.model.DecimalType count1 = new org.hl7.fhir.r4.model.DecimalType(); + List<org.hl7.fhir.r4.model.Extension> count1exts = theO1.getExtensionsByUrl(RESOURCE_COUNT_EXT_URL); + if (count1exts != null && count1exts.size() > 0) { + count1 = (org.hl7.fhir.r4.model.DecimalType) count1exts.get(0).getValue(); + } + org.hl7.fhir.r4.model.DecimalType count2 = new org.hl7.fhir.r4.model.DecimalType(); + List<org.hl7.fhir.r4.model.Extension> count2exts = theO2.getExtensionsByUrl(RESOURCE_COUNT_EXT_URL); + if (count2exts != null && count2exts.size() > 0) { + count2 = (org.hl7.fhir.r4.model.DecimalType) count2exts.get(0).getValue(); + } + int retVal = count2.compareTo(count1); + if (retVal == 0) { + retVal = theO1.getTypeElement().getValue().compareTo(theO2.getTypeElement().getValue()); + } + return retVal; + } + }); + } + } + + theModel.put("requiredParamExtension", ExtensionConstants.PARAM_IS_REQUIRED); + + theModel.put("conf", capabilityStatement); + return capabilityStatement; + } + protected String logPrefix(ModelMap theModel) { return "[server=" + theModel.get("serverId") + "] - "; } @@ -485,7 +551,7 @@ public class BaseController { } protected void processAndAddLastClientInvocation(GenericClient theClient, ResultType theResultType, ModelMap theModelMap, long theLatency, String outcomeDescription, - CaptureInterceptor theInterceptor, HomeRequest theRequest) { + CaptureInterceptor theInterceptor, HomeRequest theRequest) { try { // ApacheHttpRequest lastRequest = theInterceptor.getLastRequest(); // HttpResponse lastResponse = theInterceptor.getLastResponse(); @@ -505,7 +571,7 @@ public class BaseController { // ContentType ct = lastResponse != null ? ContentType.get(lastResponse.getEntity()) : null; // String mimeType = ct != null ? ct.getMimeType() : null; - + IHttpRequest lastRequest = theInterceptor.getLastRequest(); IHttpResponse lastResponse = theInterceptor.getLastResponse(); String requestBody = null; @@ -524,7 +590,7 @@ public class BaseController { resultStatus = "HTTP " + lastResponse.getStatus() + " " + lastResponse.getStatusInfo(); lastResponse.bufferEntity(); resultBody = IOUtils.toString(lastResponse.readEntity(), Constants.CHARSET_UTF8); - + List<String> ctStrings = lastResponse.getHeaders(Constants.HEADER_CONTENT_TYPE); if (ctStrings != null && ctStrings.isEmpty() == false) { ct = ContentType.parse(ctStrings.get(0)); @@ -543,25 +609,25 @@ public class BaseController { resultDescription.append("Non-FHIR response"); } else { switch (ctEnum) { - case JSON: - if (theResultType == ResultType.RESOURCE) { - narrativeString = parseNarrative(theRequest, ctEnum, resultBody); - resultDescription.append("JSON resource"); - } else if (theResultType == ResultType.BUNDLE) { - resultDescription.append("JSON bundle"); - riBundle = context.newJsonParser().parseResource(resultBody); - } - break; - case XML: - default: - if (theResultType == ResultType.RESOURCE) { - narrativeString = parseNarrative(theRequest, ctEnum, resultBody); - resultDescription.append("XML resource"); - } else if (theResultType == ResultType.BUNDLE) { - resultDescription.append("XML bundle"); - riBundle = context.newXmlParser().parseResource(resultBody); - } - break; + case JSON: + if (theResultType == ResultType.RESOURCE) { + narrativeString = parseNarrative(theRequest, ctEnum, resultBody); + resultDescription.append("JSON resource"); + } else if (theResultType == ResultType.BUNDLE) { + resultDescription.append("JSON bundle"); + riBundle = context.newJsonParser().parseResource(resultBody); + } + break; + case XML: + default: + if (theResultType == ResultType.RESOURCE) { + narrativeString = parseNarrative(theRequest, ctEnum, resultBody); + resultDescription.append("XML resource"); + } else if (theResultType == ResultType.BUNDLE) { + resultDescription.append("XML bundle"); + riBundle = context.newXmlParser().parseResource(resultBody); + } + break; } } @@ -599,6 +665,22 @@ public class BaseController { } + /** + * A hook to be overridden by subclasses. The overriding method can modify the error message + * based on its content and/or the related exception. + * + * @param theErrorMsg The original error message to be displayed to the user. + * @param theException The exception that occurred. May be null. + * @return The modified error message to be displayed to the user. + */ + protected String toDisplayError(String theErrorMsg, Exception theException) { + return theErrorMsg; + } + + protected enum ResultType { + BUNDLE, NONE, RESOURCE, TAGLIST + } + public static class CaptureInterceptor implements IClientInterceptor { private IHttpRequest myLastRequest; @@ -620,7 +702,7 @@ public class BaseController { @Override public void interceptRequest(IHttpRequest theRequest) { assert myLastRequest == null; - + myLastRequest = theRequest; } @@ -667,20 +749,4 @@ public class BaseController { } - protected enum ResultType { - BUNDLE, NONE, RESOURCE, TAGLIST - } - - /** - * A hook to be overridden by subclasses. The overriding method can modify the error message - * based on its content and/or the related exception. - * - * @param theErrorMsg The original error message to be displayed to the user. - * @param theException The exception that occurred. May be null. - * @return The modified error message to be displayed to the user. - */ - protected String toDisplayError(String theErrorMsg, Exception theException) { - return theErrorMsg; - } - } diff --git a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/mvc/ToBindingInitializer.java b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/mvc/ToBindingInitializer.java index 6c3b0e4f12a..14f69789cb4 100644 --- a/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/mvc/ToBindingInitializer.java +++ b/hapi-fhir-testpage-overlay/src/main/java/ca/uhn/fhir/to/mvc/ToBindingInitializer.java @@ -7,8 +7,13 @@ import org.springframework.web.context.request.WebRequest; public class ToBindingInitializer implements WebBindingInitializer { @Override - public void initBinder(WebDataBinder theBinder, WebRequest theRequest) { + public void initBinder(WebDataBinder theBinder) { theBinder.setFieldMarkerPrefix("__"); } + @Override + public void initBinder(WebDataBinder theBinder, WebRequest theRequest) { + // nothing + } + } diff --git a/hapi-fhir-testpage-overlay/src/main/resources/.keep b/hapi-fhir-testpage-overlay/src/main/resources/.keep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hapi-fhir-testpage-overlay/src/main/webapp/WEB-INF/templates/resource.html b/hapi-fhir-testpage-overlay/src/main/webapp/WEB-INF/templates/resource.html index a5dd309286b..891644e7d18 100644 --- a/hapi-fhir-testpage-overlay/src/main/webapp/WEB-INF/templates/resource.html +++ b/hapi-fhir-testpage-overlay/src/main/webapp/WEB-INF/templates/resource.html @@ -64,7 +64,7 @@ </li> <!-- CRUD Tab --> <li th:class="(${!haveSearchParams} and ${queries.empty}) ? 'active'"> - <a href="#tab-otheractions" role="tab" data-toggle="tab">CRUD Operations</a> + <a href="#tab-otheractions" role="tab" data-toggle="tab" name="tabCrudOperationsLink">CRUD Operations</a> </li> <!-- Tags Tab --> <li> diff --git a/hapi-fhir-validation-resources-dstu3/src/main/java/.keep b/hapi-fhir-validation-resources-dstu3/src/main/java/.keep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index b851d8f1932..9a6988b95b3 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -100,6 +100,11 @@ </dependency> <!-- Test Deps --> + <dependency> + <groupId>org.codehaus.woodstox</groupId> + <artifactId>woodstox-core-asl</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>ca.uhn.hapi.fhir</groupId> <artifactId>hapi-fhir-converter</artifactId> diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/validation/InstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/validation/InstanceValidator.java index 823c3e90827..50261ff36fe 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/validation/InstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/validation/InstanceValidator.java @@ -13,8 +13,8 @@ import java.util.Map; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.apache.commons.lang3.StringUtils; + import org.hl7.fhir.dstu3.conformance.ProfileUtilities; import org.hl7.fhir.dstu3.context.IWorkerContext; import org.hl7.fhir.dstu3.context.IWorkerContext.ValidationResult; @@ -339,10 +339,13 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat switch (bpWarnings) { case Error: rule(errors, invalid, line, col, literalPath, test, message); + break; case Warning: warning(errors, invalid, line, col, literalPath, test, message); + break; case Hint: hint(errors, invalid, line, col, literalPath, test, message); + break; default: // do nothing } } @@ -2102,6 +2105,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat } private String resolve(String uri, String ref) { + if (isBlank(uri)) { + return ref; + } String[] up = uri.split("\\/"); String[] rp = ref.split("\\/"); if (context.getResourceNames().contains(up[up.length-2]) && context.getResourceNames().contains(rp[0])) { @@ -2452,6 +2458,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat else if (itemType.equals("integer")) checkOption(errors, answer, ns, qsrc, qItem, "integer"); else if (itemType.equals("string")) checkOption(errors, answer, ns, qsrc, qItem, "string", true); break; + case QUESTION: + case NULL: + break; } validateQuestionannaireResponseItems(qsrc, qItem.getItem(), errors, answer, stack, inProgress); } @@ -2816,6 +2825,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat List<Element> entries = new ArrayList<Element>(); bundle.getNamedChildren("entry", entries); String type = bundle.getNamedChildValue("type"); + type = StringUtils.defaultString(type); + if (entries.size() == 0) { rule(errors, IssueType.INVALID, stack.getLiteralPath(), !(type.equals("document") || type.equals("message")), "Documents or Messages must contain at least one entry"); } else { @@ -3048,11 +3059,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat if (ei.path.endsWith(".extension")) rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getNamedChildValue("url") + "\")" + (profile==null ? "" : " for profile " + profile.getUrl())); else if (!unsupportedSlicing) - if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) || ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN))) + if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN))) hint(errors, IssueType.INFORMATIONAL, ei.line(), ei.col(), ei.path, (ei.definition != null), "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); else - if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) || ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN))) + if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN))) rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition != null), "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); else @@ -3228,7 +3239,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat goodProfiles.put(typeProfile, profileErrors); } if (goodProfiles.size()==1) { - errors.addAll(goodProfiles.get(0)); + errors.addAll(goodProfiles.values().iterator().next()); } else if (goodProfiles.size()==0) { rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, false, "Unable to find matching profile among choices: " + StringUtils.join("; ", profiles)); for (List<ValidationMessage> messages : badProfiles) { diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/validation/InstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/validation/InstanceValidator.java index 6a2e1ac2cbe..e9fc8fec4fc 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/validation/InstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/validation/InstanceValidator.java @@ -1,2791 +1,2794 @@ -package org.hl7.fhir.instance.validation; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; - -import org.hl7.fhir.exceptions.*; -import org.hl7.fhir.instance.formats.FormatUtilities; -import org.hl7.fhir.instance.model.*; -import org.hl7.fhir.instance.model.ElementDefinition.*; -import org.hl7.fhir.instance.model.Enumerations.BindingStrength; -import org.hl7.fhir.instance.model.StructureDefinition.*; -import org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent; -import org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent; -import org.hl7.fhir.instance.utils.IWorkerContext.ValidationResult; -//import org.hl7.fhir.instance.utils.ProfileUtilities; -import org.hl7.fhir.instance.utils.*; -import org.hl7.fhir.instance.utils.IResourceValidator.BestPracticeWarningLevel; -import org.hl7.fhir.instance.utils.IResourceValidator.CheckDisplayOption; -import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.utilities.validation.ValidationMessage; -import org.hl7.fhir.utilities.validation.ValidationMessage.*; -import org.hl7.fhir.utilities.xml.XMLUtil; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import com.google.gson.*; - - -/* - * todo: - * check urn's don't start oid: or uuid: - */ -public class InstanceValidator extends BaseValidator implements IResourceValidator { - - private class ElementDefinitionOutcome { - public ElementDefinitionOutcome(ElementDefinition ed) { - definition = ed; - } - public ElementDefinitionOutcome(ElementDefinition ed, TypeRefComponent tr) { - definition = ed; - typename = tr.getCode(); - if (tr.hasProfile()) - profile = tr.getProfile().get(0).getValue(); - } - private ElementDefinition definition; - private String typename; - private String profile; - } - - public class ResourceOnWrapper extends Resource { - private static final long serialVersionUID = 1L; - private IWorkerContext services; - private WrapperElement wrapper; - private List<ElementDefinition> elementList; - private StructureDefinition profile; - private ElementDefinition definition; - private List<ElementDefinition> childDefinitions; - - public ResourceOnWrapper(IWorkerContext services, WrapperElement wrapper, StructureDefinition profile) { - super(); - this.services = services; - this.wrapper = wrapper; - this.profile = profile; - this.definition = profile.getSnapshot().getElement().get(0); - } - - private ElementDefinitionOutcome getDefinition(String name) throws DefinitionException { - if (childDefinitions == null) - childDefinitions = ProfileUtilities.getChildMap(profile, definition.getName(), definition.getPath(), definition.getNameReference()); - for (ElementDefinition ed : childDefinitions) { - String tail = ed.getPath().substring(ed.getPath().lastIndexOf('.')+1); - if (tail.equals(name)) { - return new ElementDefinitionOutcome(ed); - } - if (tail.endsWith("[x]") && tail.substring(0, tail.length()-3).equals(name.substring(0, tail.length()-3))) { - TypeRefComponent tr = getType(ed, name.substring(tail.length()-3)); - if (tr != null) - return new ElementDefinitionOutcome(ed, tr); - } - } - return null; - } - - private TypeRefComponent getType(ElementDefinition ed, String type) { - for (TypeRefComponent t : ed.getType()) { - if (t.getCode().equals(type)) - return t; - } - return null; - } - - @Override - public List<Base> listChildrenByName(String child_name) { - List<Base> list = new ArrayList<Base>(); - List<WrapperElement> children = new ArrayList<WrapperElement>(); - wrapper.getNamedChildren(child_name, children); - for (WrapperElement child : children) { - ElementDefinitionOutcome definition; - try { - definition = getDefinition(child.getName()); - } catch (Exception e) { - definition = null; - } - if (definition != null) { - TypeRefComponent tr = getType(definition.definition, "Resource"); - if (tr != null && wrapper.isXml()) // special case for DomainResource.contained and Bundle.entry - list.add(new BaseOnWrapper(services, child.getFirstChild(), profile, definition.definition, definition.typename, definition.profile)); - else - list.add(new BaseOnWrapper(services, child, profile, definition.definition, definition.typename, definition.profile)); - } - } - return list; - } - - @Override - public String fhirType() { - return wrapper.getResourceType(); - } - - @Override - public Resource copy() { - throw new Error("copy() is not implemented here"); - } - - - @Override - public ResourceType getResourceType() { - try { - return ResourceType.fromCode(fhirType()); - } catch (Exception e) { - return null; - } - } - - @Override - protected boolean isMetadataBased() { - return true; - } - - @Override - public String toString() { - return fhirType(); - } - } - - public class BaseOnWrapper extends Base { - private static final long serialVersionUID = 1L; - private IWorkerContext services; - private WrapperElement wrapper; - private List<ElementDefinition> elementList; - private StructureDefinition profile; - private ElementDefinition definition; - private List<ElementDefinition> childDefinitions; - private String typeName; - private String typeProfile; - - - public BaseOnWrapper(IWorkerContext services, WrapperElement wrapper, StructureDefinition profile, - ElementDefinition definition, String typeName, String typeProfile) { - super(); - this.services = services; - this.wrapper = wrapper; - this.profile = profile; - this.definition = definition; - this.typeName = typeName; - this.typeProfile = typeProfile; - } - - private ElementDefinitionOutcome getDefinition(String name) throws DefinitionException { - if (childDefinitions == null) - childDefinitions = ProfileUtilities.getChildMap(profile, definition.getName(), definition.getPath(), definition.getNameReference()); - - if (childDefinitions.size() == 0) { - String pn = typeProfile; - if (Utilities.noString(pn) && !Utilities.noString(typeName)) - pn = "http://hl7.org/fhir/StructureDefinition/"+typeName; - if (Utilities.noString(pn) && definition.getType().size() == 1) { - if (definition.getType().get(0).getProfile().size() > 0) - pn = definition.getType().get(0).getProfile().get(0).getValue(); - else - pn = "http://hl7.org/fhir/StructureDefinition/"+ definition.getType().get(0).getCode(); - } - if (!Utilities.noString(pn)) { - StructureDefinition profile = services.fetchResource(StructureDefinition.class, pn); - if (profile != null) { - this.profile = profile; - childDefinitions = ProfileUtilities.getChildMap(profile, null, profile.getSnapshot().getElement().get(0).getPath(), null); - } - } - } - - - for (ElementDefinition ed : childDefinitions) { - String tail = ed.getPath().substring(ed.getPath().lastIndexOf('.')+1); - if (tail.equals(name)) { - return new ElementDefinitionOutcome(ed); - } - if (tail.endsWith("[x]") && name.length() > tail.length()-1 && tail.substring(0, tail.length()-3).equals(name.substring(0, tail.length()-3))) { - TypeRefComponent tr = getType(ed, name.substring(tail.length()-3)); - if (tr != null) - return new ElementDefinitionOutcome(ed, tr); - } - } - return null; - } - - private TypeRefComponent getType(ElementDefinition ed, String type) { - for (TypeRefComponent t : ed.getType()) { - if (t.getCode().equalsIgnoreCase(type)) - return t; - } - return null; - } - - @Override - public List<Base> listChildrenByName(String child_name) { - List<Base> list = new ArrayList<Base>(); - List<WrapperElement> children = new ArrayList<WrapperElement>(); - wrapper.getNamedChildrenWithWildcard(child_name, children); - for (WrapperElement child : children) { - ElementDefinitionOutcome definition; - try { - definition = getDefinition(child.getName()); - } catch (Exception e) { - definition = null; - } - if (definition != null) { - TypeRefComponent tr = getType(definition.definition, "Resource"); - if (tr != null && wrapper.isXml()) // special case for DomainResource.contained and Bundle.entry - list.add(new BaseOnWrapper(services, child.getFirstChild(), profile, definition.definition, definition.typename, definition.profile)); - else - list.add(new BaseOnWrapper(services, child, profile, definition.definition, definition.typename, definition.profile)); - } - } - return list; - } - - public boolean isPrimitive() { - String t = fhirType(); - return t.equalsIgnoreCase("boolean") || t.equalsIgnoreCase("integer") || t.equalsIgnoreCase("string") || t.equalsIgnoreCase("decimal") || t.equalsIgnoreCase("uri") || t.equalsIgnoreCase("base64Binary") || - t.equalsIgnoreCase("instant") || t.equalsIgnoreCase("date") || t.equalsIgnoreCase("uuid") || t.equalsIgnoreCase("id") || t.equalsIgnoreCase("xhtml") || t.equalsIgnoreCase("markdown") || - t.equalsIgnoreCase("dateTime") || t.equalsIgnoreCase("time") || t.equalsIgnoreCase("code") || t.equalsIgnoreCase("oid") || t.equalsIgnoreCase("id"); - } - - public String primitiveValue() { - return wrapper.getAttribute("value"); - } - - @Override - public String fhirType() { - if (!Utilities.noString(typeName)) - return typeName; - else - return definition.getType().get(0).getCode(); - } - - @Override - protected void listChildren(List<Property> result) { - throw new Error("not done yet"); - } - - @Override - protected boolean isMetadataBased() { - return true; - } - - public boolean equalsDeep(Base other) { - if (!super.equalsDeep(other) || !fhirType().equals(other.fhirType())) - return false; - - // make sure we have child definitions - try { - getDefinition("xxxx"); - List<ElementDefinition> childList = childDefinitions; - // there's a problem here - we're going to iterate by the definition, where as equality should - probably - be - // based on the underlying definitions. is it worth getting them? it's kind of complicated.... - for (ElementDefinition ed : childList) { - String tail = tail(ed.getPath()); - List<Base> thisList = listChildrenByName(tail); - List<Base> otherList = other.listChildrenByName(tail); - if (!compareDeep(thisList, otherList, false)) - return false; - } - return true; - } catch (Exception e) { - return false;// because we can't decide - } - } - - @Override - public String toString() { - if (isPrimitive()) - return primitiveValue(); - else - return fhirType(); - } - } - - private boolean anyExtensionsAllowed; - - private BestPracticeWarningLevel bpWarnings; - // configuration items - private CheckDisplayOption checkDisplay; - private IWorkerContext context; - - private List<String> extensionDomains = new ArrayList<String>(); - - private IdStatus resourceIdRule; - - // used during the build process to keep the overall volume of messages down - private boolean suppressLoincSnomedMessages; - - public InstanceValidator(IWorkerContext theContext) { - super(); - this.context = theContext; - source = Source.InstanceValidator; - } - - private boolean allowUnknownExtension(String url) { - if (url.contains("example.org") || url.contains("acme.com") || url.contains("nema.org")) - return true; - for (String s : extensionDomains) - if (url.startsWith(s)) - return true; - return anyExtensionsAllowed; - } - - private void bpCheck(List<ValidationMessage> errors, IssueType invalid, int line, int col, String literalPath, boolean test, String message) { - if (bpWarnings != null) { - switch (bpWarnings) { - case Error: - rule(errors, invalid, line, col, literalPath, test, message); - case Warning: - warning(errors, invalid, line, col, literalPath, test, message); - case Hint: - hint(errors, invalid, line, col, literalPath, test, message); - default: // do nothing - } - } - } - - private boolean check(String v1, String v2) { - return v1 == null ? Utilities.noString(v1) : v1.equals(v2); - } - - private void checkAddress(List<ValidationMessage> errors, String path, WrapperElement focus, Address fixed) { - checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); - checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text"); - checkFixedValue(errors, path + ".city", focus.getNamedChild("city"), fixed.getCityElement(), "city"); - checkFixedValue(errors, path + ".state", focus.getNamedChild("state"), fixed.getStateElement(), "state"); - checkFixedValue(errors, path + ".country", focus.getNamedChild("country"), fixed.getCountryElement(), "country"); - checkFixedValue(errors, path + ".zip", focus.getNamedChild("zip"), fixed.getPostalCodeElement(), "postalCode"); - - List<WrapperElement> lines = new ArrayList<WrapperElement>(); - focus.getNamedChildren("line", lines); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, lines.size() == fixed.getLine().size(), - "Expected " + Integer.toString(fixed.getLine().size()) + " but found " + Integer.toString(lines.size()) + " line elements")) { - for (int i = 0; i < lines.size(); i++) - checkFixedValue(errors, path + ".coding", lines.get(i), fixed.getLine().get(i), "coding"); - } - } - - private void checkAttachment(List<ValidationMessage> errors, String path, WrapperElement focus, Attachment fixed) { - checkFixedValue(errors, path + ".contentType", focus.getNamedChild("contentType"), fixed.getContentTypeElement(), "contentType"); - checkFixedValue(errors, path + ".language", focus.getNamedChild("language"), fixed.getLanguageElement(), "language"); - checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data"); - checkFixedValue(errors, path + ".url", focus.getNamedChild("url"), fixed.getUrlElement(), "url"); - checkFixedValue(errors, path + ".size", focus.getNamedChild("size"), fixed.getSizeElement(), "size"); - checkFixedValue(errors, path + ".hash", focus.getNamedChild("hash"), fixed.getHashElement(), "hash"); - checkFixedValue(errors, path + ".title", focus.getNamedChild("title"), fixed.getTitleElement(), "title"); - } - - // public API - - private boolean checkCode(List<ValidationMessage> errors, WrapperElement element, String path, String code, String system, String display) { - if (context.supportsSystem(system)) { - ValidationResult s = context.validateCode(system, code, display); - if (s == null || s.isOk()) - return true; - if (s.getSeverity() == IssueSeverity.INFORMATION) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); - else if (s.getSeverity() == IssueSeverity.WARNING) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); - else - return rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); - return true; - } else if (system.startsWith("http://hl7.org/fhir")) { - if (system.equals("http://hl7.org/fhir/sid/icd-10")) - return true; // else don't check ICD-10 (for now) - else { - ValueSet vs = getValueSet(system); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, "Unknown Code System " + system)) { - ConceptDefinitionComponent def = getCodeDefinition(vs, code); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, def != null, "Unknown Code (" + system + "#" + code + ")")) - return warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, display == null || display.equals(def.getDisplay()), "Display should be '" + def.getDisplay() + "'"); - } - return false; - } - } else if (system.startsWith("http://loinc.org")) { - return true; - } else if (system.startsWith("http://unitsofmeasure.org")) { - return true; - } else - return true; - } - - private void checkCodeableConcept(List<ValidationMessage> errors, String path, WrapperElement focus, CodeableConcept fixed) { - checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text"); - List<WrapperElement> codings = new ArrayList<WrapperElement>(); - focus.getNamedChildren("coding", codings); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, codings.size() == fixed.getCoding().size(), - "Expected " + Integer.toString(fixed.getCoding().size()) + " but found " + Integer.toString(codings.size()) + " coding elements")) { - for (int i = 0; i < codings.size(); i++) - checkFixedValue(errors, path + ".coding", codings.get(i), fixed.getCoding().get(i), "coding"); - } - } - - private void checkCodeableConcept(List<ValidationMessage> errors, String path, WrapperElement element, StructureDefinition profile, ElementDefinition theElementCntext) { - if (theElementCntext != null && theElementCntext.hasBinding()) { - ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing (cc)")) { - if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { - ValueSet valueset = resolveBindingReference(binding.getValueSet()); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { - try { - CodeableConcept cc = readAsCodeableConcept(element); - if (!cc.hasCoding()) { - if (binding.getStrength() == BindingStrength.REQUIRED) - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code is required from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code should be provided from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); - } else { - ValidationResult vr = context.validateCode(cc, valueset); - if (!vr.isOk()) { - if (binding.getStrength() == BindingStrength.REQUIRED) - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()+", and a code from this value set is required"); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"); - else if (binding.getStrength() == BindingStrength.PREFERRED) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"); - } - } - } catch (Exception e) { - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept"); - } - } - } else if (binding.hasValueSet()) { - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); - } else { - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); - } - } - } - } - - private CodeableConcept readAsCodeableConcept(WrapperElement element) { - CodeableConcept cc = new CodeableConcept(); - List<WrapperElement> list = new ArrayList<WrapperElement>(); - element.getNamedChildren("coding", list); - for (WrapperElement item : list) - cc.addCoding(readAsCoding(item)); - cc.setText(element.getNamedChildValue("text")); - return cc; - } - - private Coding readAsCoding(WrapperElement item) { - Coding c = new Coding(); - c.setSystem(item.getNamedChildValue("system")); - c.setVersion(item.getNamedChildValue("version")); - c.setCode(item.getNamedChildValue("code")); - c.setDisplay(item.getNamedChildValue("display")); - return c; - } - - private void checkCoding(List<ValidationMessage> errors, String path, WrapperElement focus, Coding fixed) { - checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); - checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code"); - checkFixedValue(errors, path + ".display", focus.getNamedChild("display"), fixed.getDisplayElement(), "display"); - checkFixedValue(errors, path + ".userSelected", focus.getNamedChild("userSelected"), fixed.getUserSelectedElement(), "userSelected"); - } - - private void checkCoding(List<ValidationMessage> errors, String path, WrapperElement element, StructureDefinition profile, ElementDefinition theElementCntext, boolean inCodeableConcept) { - String code = element.getNamedChildValue("code"); - String system = element.getNamedChildValue("system"); - String display = element.getNamedChildValue("display"); - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Coding.system must be an absolute reference, not a local reference"); - - if (system != null && code != null) { - if (checkCode(errors, element, path, code, system, display)) - if (theElementCntext != null && theElementCntext.getBinding() != null) { - ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing")) { - if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { - ValueSet valueset = resolveBindingReference(binding.getValueSet()); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { - try { - Coding c = readAsCoding(element); - ValidationResult vr = context.validateCode(c, valueset); - if (!vr.isOk()) { - if (binding.getStrength() == BindingStrength.REQUIRED) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is required from this value set)"); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"); - else if (binding.getStrength() == BindingStrength.PREFERRED) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"); - } - } catch (Exception e) { - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept"); - } - } - } else if (binding.hasValueSet()) { - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); - } else if (!inCodeableConcept) { - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); - } - } - } - } - } - - private void checkContactPoint(List<ValidationMessage> errors, String path, WrapperElement focus, ContactPoint fixed) { - checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); - checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value"); - checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); - checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period"); - - } - - private void checkDeclaredProfiles(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, NodeStack stack) throws FHIRException { - WrapperElement meta = element.getNamedChild("meta"); - if (meta != null) { - List<WrapperElement> profiles = new ArrayList<InstanceValidator.WrapperElement>(); - meta.getNamedChildren("profile", profiles); - int i = 0; - for (WrapperElement profile : profiles) { - String ref = profile.getAttribute("value"); - String p = stack.addToLiteralPath("meta", "profile", ":" + Integer.toString(i)); - if (rule(errors, IssueType.INVALID, element.line(), element.col(), p, !Utilities.noString(ref), "StructureDefinition reference invalid")) { - StructureDefinition pr = context.fetchResource(StructureDefinition.class, ref); - if (warning(errors, IssueType.INVALID, element.line(), element.col(), p, pr != null, "StructureDefinition reference \"{0}\" could not be resolved", ref)) { - if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), p, pr.hasSnapshot(), - "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) { - validateElement(errors, pr, pr.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); - } - } - i++; - } - } - } - } - - private StructureDefinition checkExtension(List<ValidationMessage> errors, String path, WrapperElement element, ElementDefinition def, StructureDefinition profile, NodeStack stack) - { - String url = element.getAttribute("url"); - boolean isModifier = element.getName().equals("modifierExtension"); - - StructureDefinition ex = context.fetchResource(StructureDefinition.class, url); - if (ex == null) { - if (!rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowUnknownExtension(url), "The extension " + url + " is unknown, and not allowed here")) - warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowUnknownExtension(url), "Unknown extension " + url); - } else { - if (def.getIsModifier()) - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), - "Extension modifier mismatch: the extension element is labelled as a modifier, but the underlying extension is not"); - else - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), - "Extension modifier mismatch: the extension element is not labelled as a modifier, but the underlying extension is"); - - // two questions - // 1. can this extension be used here? - checkExtensionContext(errors, element, /* path+"[url='"+url+"']", */ ex, stack, ex.getUrl()); - - if (isModifier) - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), - "The Extension '" + url + "' must be used as a modifierExtension"); - else - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), - "The Extension '" + url + "' must not be used as an extension (it's a modifierExtension)"); - - // 2. is the content of the extension valid? - - } - return ex; - } - - private boolean checkExtensionContext(List<ValidationMessage> errors, WrapperElement element, StructureDefinition definition, NodeStack stack, String extensionParent) { - String extUrl = definition.getUrl(); - CommaSeparatedStringBuilder p = new CommaSeparatedStringBuilder(); - for (String lp : stack.getLogicalPaths()) - p.append(lp); - if (definition.getContextType() == ExtensionContext.DATATYPE) { - boolean ok = false; - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (StringType ct : definition.getContext()) { - b.append(ct.getValue()); - if (ct.getValue().equals("*") || stack.getLogicalPaths().contains(ct.getValue() + ".extension")) - ok = true; - } - return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, - "The extension " + extUrl + " is not allowed to be used on the logical path set [" + p.toString() + "] (allowed: datatype=" + b.toString() + ")"); - } else if (definition.getContextType() == ExtensionContext.EXTENSION) { - boolean ok = false; - for (StringType ct : definition.getContext()) - if (ct.getValue().equals("*") || ct.getValue().equals(extensionParent)) - ok = true; - return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, - "The extension " + extUrl + " is not allowed to be used with the extension '" + extensionParent + "'"); - } else if (definition.getContextType() == ExtensionContext.MAPPING) { - throw new Error("Not handled yet (extensionContext)"); - } else if (definition.getContextType() == ExtensionContext.RESOURCE) { - boolean ok = false; - // String simplePath = container.getPath(); - // System.out.println(simplePath); - // if (effetive.endsWith(".extension") || simplePath.endsWith(".modifierExtension")) - // simplePath = simplePath.substring(0, simplePath.lastIndexOf('.')); - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (StringType ct : definition.getContext()) { - String c = ct.getValue(); - b.append(c); - if (c.equals("*") || stack.getLogicalPaths().contains(c + ".extension") || (c.startsWith("@") && stack.getLogicalPaths().contains(c.substring(1) + ".extension"))) - ; - ok = true; - } - return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, - "The extension " + extUrl + " is not allowed to be used on the logical path set " + p.toString() + " (allowed: resource=" + b.toString() + ")"); - } else - throw new Error("Unknown context type"); - } - // - // private String simplifyPath(String path) { - // String s = path.replace("/f:", "."); - // while (s.contains("[")) - // s = s.substring(0, s.indexOf("["))+s.substring(s.indexOf("]")+1); - // String[] parts = s.split("\\."); - // int i = 0; - // while (i < parts.length && !context.getProfiles().containsKey(parts[i].toLowerCase())) - // i++; - // if (i >= parts.length) - // throw new Error("Unable to process part "+path); - // int j = parts.length - 1; - // while (j > 0 && (parts[j].equals("extension") || parts[j].equals("modifierExtension"))) - // j--; - // StringBuilder b = new StringBuilder(); - // boolean first = true; - // for (int k = i; k <= j; k++) { - // if (k == j || !parts[k].equals(parts[k+1])) { - // if (first) - // first = false; - // else - // b.append("."); - // b.append(parts[k]); - // } - // } - // return b.toString(); - // } - // - - private void checkFixedValue(List<ValidationMessage> errors, String path, WrapperElement focus, org.hl7.fhir.instance.model.Element fixed, String propName) { - if (fixed == null && focus == null) - ; // this is all good - else if (fixed == null && focus != null) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, false, "Unexpected element " + focus.getName()); - else if (fixed != null && focus == null) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, false, "Mising element " + propName); - else { - String value = focus.getAttribute("value"); - if (fixed instanceof org.hl7.fhir.instance.model.BooleanType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.BooleanType) fixed).asStringValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.BooleanType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.IntegerType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.IntegerType) fixed).asStringValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.IntegerType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.DecimalType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.DecimalType) fixed).asStringValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.DecimalType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.Base64BinaryType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.Base64BinaryType) fixed).asStringValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.Base64BinaryType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.InstantType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.InstantType) fixed).getValue().toString(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.InstantType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.StringType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.StringType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.StringType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.UriType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.UriType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.UriType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.DateType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.DateType) fixed).getValue().toString(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.DateType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.DateTimeType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.DateTimeType) fixed).getValue().toString(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.DateTimeType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.OidType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.OidType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.OidType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.UuidType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.UuidType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.UuidType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.CodeType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.CodeType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.CodeType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.instance.model.IdType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.IdType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.IdType) fixed).getValue() + "'"); - else if (fixed instanceof Quantity) - checkQuantity(errors, path, focus, (Quantity) fixed); - else if (fixed instanceof Address) - checkAddress(errors, path, focus, (Address) fixed); - else if (fixed instanceof ContactPoint) - checkContactPoint(errors, path, focus, (ContactPoint) fixed); - else if (fixed instanceof Attachment) - checkAttachment(errors, path, focus, (Attachment) fixed); - else if (fixed instanceof Identifier) - checkIdentifier(errors, path, focus, (Identifier) fixed); - else if (fixed instanceof Coding) - checkCoding(errors, path, focus, (Coding) fixed); - else if (fixed instanceof HumanName) - checkHumanName(errors, path, focus, (HumanName) fixed); - else if (fixed instanceof CodeableConcept) - checkCodeableConcept(errors, path, focus, (CodeableConcept) fixed); - else if (fixed instanceof Timing) - checkTiming(errors, path, focus, (Timing) fixed); - else if (fixed instanceof Period) - checkPeriod(errors, path, focus, (Period) fixed); - else if (fixed instanceof Range) - checkRange(errors, path, focus, (Range) fixed); - else if (fixed instanceof Ratio) - checkRatio(errors, path, focus, (Ratio) fixed); - else if (fixed instanceof SampledData) - checkSampledData(errors, path, focus, (SampledData) fixed); - - else - rule(errors, IssueType.EXCEPTION, focus.line(), focus.col(), path, false, "Unhandled fixed value type " + fixed.getClass().getName()); - List<WrapperElement> extensions = new ArrayList<WrapperElement>(); - focus.getNamedChildren("extension", extensions); - if (fixed.getExtension().size() == 0) { - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == 0, "No extensions allowed"); - } else if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == fixed.getExtension().size(), - "Extensions count mismatch: expected " + Integer.toString(fixed.getExtension().size()) + " but found " + Integer.toString(extensions.size()))) { - for (Extension e : fixed.getExtension()) { - WrapperElement ex = getExtensionByUrl(extensions, e.getUrl()); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, ex != null, "Extension count mismatch: unable to find extension: " + e.getUrl())) { - checkFixedValue(errors, path, ex.getFirstChild().getNextSibling(), e.getValue(), "extension.value"); - } - } - } - } - } - - private void checkForProcessingInstruction(List<ValidationMessage> errors, Document document) { - Node node = document.getFirstChild(); - while (node != null) { - rule(errors, IssueType.INVALID, -1, -1, "(document)", node.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE, "No processing instructions allowed in resources"); - node = node.getNextSibling(); - } - } - - private void checkHumanName(List<ValidationMessage> errors, String path, WrapperElement focus, HumanName fixed) { - checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); - checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text"); - checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period"); - - List<WrapperElement> parts = new ArrayList<WrapperElement>(); - focus.getNamedChildren("family", parts); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getFamily().size(), - "Expected " + Integer.toString(fixed.getFamily().size()) + " but found " + Integer.toString(parts.size()) + " family elements")) { - for (int i = 0; i < parts.size(); i++) - checkFixedValue(errors, path + ".family", parts.get(i), fixed.getFamily().get(i), "family"); - } - focus.getNamedChildren("given", parts); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getGiven().size(), - "Expected " + Integer.toString(fixed.getGiven().size()) + " but found " + Integer.toString(parts.size()) + " given elements")) { - for (int i = 0; i < parts.size(); i++) - checkFixedValue(errors, path + ".given", parts.get(i), fixed.getGiven().get(i), "given"); - } - focus.getNamedChildren("prefix", parts); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getPrefix().size(), - "Expected " + Integer.toString(fixed.getPrefix().size()) + " but found " + Integer.toString(parts.size()) + " prefix elements")) { - for (int i = 0; i < parts.size(); i++) - checkFixedValue(errors, path + ".prefix", parts.get(i), fixed.getPrefix().get(i), "prefix"); - } - focus.getNamedChildren("suffix", parts); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getSuffix().size(), - "Expected " + Integer.toString(fixed.getSuffix().size()) + " but found " + Integer.toString(parts.size()) + " suffix elements")) { - for (int i = 0; i < parts.size(); i++) - checkFixedValue(errors, path + ".suffix", parts.get(i), fixed.getSuffix().get(i), "suffix"); - } - } - - private void checkIdentifier(List<ValidationMessage> errors, String path, WrapperElement element, ElementDefinition context) { - String system = element.getNamedChildValue("system"); - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Identifier.system must be an absolute reference, not a local reference"); - } - - private void checkIdentifier(List<ValidationMessage> errors, String path, WrapperElement focus, Identifier fixed) { - checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); - checkFixedValue(errors, path + ".type", focus.getNamedChild("type"), fixed.getType(), "type"); - checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); - checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value"); - checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period"); - checkFixedValue(errors, path + ".assigner", focus.getNamedChild("assigner"), fixed.getAssigner(), "assigner"); - } - - private void checkPeriod(List<ValidationMessage> errors, String path, WrapperElement focus, Period fixed) { - checkFixedValue(errors, path + ".start", focus.getNamedChild("start"), fixed.getStartElement(), "start"); - checkFixedValue(errors, path + ".end", focus.getNamedChild("end"), fixed.getEndElement(), "end"); - } - - private void checkPrimitive(List<ValidationMessage> errors, String path, String type, ElementDefinition context, WrapperElement e) { - if (type.equals("uri")) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.getAttribute("value").startsWith("oid:"), "URI values cannot start with oid:"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.getAttribute("value").startsWith("uuid:"), "URI values cannot start with uuid:"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.getAttribute("value").equals(e.getAttribute("value").trim()), "URI values cannot have leading or trailing whitespace"); - } - if (!type.equalsIgnoreCase("string") && e.hasAttribute("value")) { - if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.getAttribute("value").length() > 0, "@value cannot be empty")) { - warning(errors, IssueType.INVALID, e.line(), e.col(), path, e.getAttribute("value").trim().equals(e.getAttribute("value")), "value should not start or finish with whitespace"); - } - } - if (type.equals("dateTime")) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.getAttribute("value")), "The value '" + e.getAttribute("value") + "' does not have a valid year"); - boolean ok = e.getAttribute("value").matches("-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?)?)?"); - if (!ok) - rule(errors, IssueType.INVALID, e.line(), e.col(), path,ok, "'"+e.getAttribute("value")+"' is not a valid date time"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !hasTime(e.getAttribute("value")) || hasTimeZone(e.getAttribute("value")), "if a date has a time, it must have a timezone"); - - } - if (type.equals("instant")) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, - e.getAttribute("value").matches("-?[0-9]{4}-(0[1-9]|1[0-2])-(0[0-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"), - "The instant '" + e.getAttribute("value") + "' is not valid (by regex)"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.getAttribute("value")), "The value '" + e.getAttribute("value") + "' does not have a valid year"); - } - - if (type.equals("code")) { - // Technically, a code is restricted to string which has at least one character and no leading or trailing whitespace, and where there is no whitespace - // other than single spaces in the contents - rule(errors, IssueType.INVALID, e.line(), e.col(), path, passesCodeWhitespaceRules(e.getAttribute("value")), "The code '" + e.getAttribute("value") + "' is not valid (whitespace rules)"); - } - - if (context.hasBinding()) { - checkPrimitiveBinding(errors, path, type, context, e); - } - // for nothing to check - } - - // note that we don't check the type here; it could be string, uri or code. - private void checkPrimitiveBinding(List<ValidationMessage> errors, String path, String type, ElementDefinition elementContext, WrapperElement element) { - if (!element.hasAttribute("value")) - return; - - String value = element.getAttribute("value"); - // System.out.println("check "+value+" in "+path); - - // firstly, resolve the value set - ElementDefinitionBindingComponent binding = elementContext.getBinding(); - if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { - ValueSet vs = resolveBindingReference(binding.getValueSet()); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, "ValueSet {0} not found", describeReference(binding.getValueSet()))) { - ValidationResult vr = context.validateCode(null, value, null, vs); - if (!vr.isOk()) { - if (binding.getStrength() == BindingStrength.REQUIRED) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is required from this value set)"); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code should come from this value set unless it has no suitable code)"); - else if (binding.getStrength() == BindingStrength.PREFERRED) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is recommended to come from this value set)"); - } - } - } else - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding has no source, so can't be checked"); - } - - private void checkQuantity(List<ValidationMessage> errors, String path, WrapperElement focus, Quantity fixed) { - checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value"); - checkFixedValue(errors, path + ".comparator", focus.getNamedChild("comparator"), fixed.getComparatorElement(), "comparator"); - checkFixedValue(errors, path + ".units", focus.getNamedChild("unit"), fixed.getUnitElement(), "units"); - checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); - checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code"); - } - - // implementation - - private void checkRange(List<ValidationMessage> errors, String path, WrapperElement focus, Range fixed) { - checkFixedValue(errors, path + ".low", focus.getNamedChild("low"), fixed.getLow(), "low"); - checkFixedValue(errors, path + ".high", focus.getNamedChild("high"), fixed.getHigh(), "high"); - - } - - private void checkRatio(List<ValidationMessage> errors, String path, WrapperElement focus, Ratio fixed) { - checkFixedValue(errors, path + ".numerator", focus.getNamedChild("numerator"), fixed.getNumerator(), "numerator"); - checkFixedValue(errors, path + ".denominator", focus.getNamedChild("denominator"), fixed.getDenominator(), "denominator"); - } - - private void checkReference(List<ValidationMessage> errors, String path, WrapperElement element, StructureDefinition profile, ElementDefinition container, String parentType, NodeStack stack) - { - String ref = element.getNamedChildValue("reference"); - if (Utilities.noString(ref)) { - // todo - what should we do in this case? - hint(errors, IssueType.STRUCTURE, element.line(), element.col(), path, !Utilities.noString(element.getNamedChildValue("display")), - "A Reference without an actual reference should have a display"); - return; - } - - WrapperElement we = resolve(ref, stack); - String ft; - if (we != null) - ft = we.getResourceType(); - else - ft = tryParse(ref); - if (hint(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ft != null, "Unable to determine type of target resource")) { - boolean ok = false; - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (TypeRefComponent type : container.getType()) { - if (!ok && type.getCode().equals("Reference")) { - // we validate as much as we can. First, can we infer a type from the profile? - if (!type.hasProfile() || type.getProfile().get(0).getValue().equals("http://hl7.org/fhir/StructureDefinition/Resource")) - ok = true; - else { - String pr = type.getProfile().get(0).getValue(); - - String bt = getBaseType(profile, pr); - if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, bt != null, "Unable to resolve the profile reference '" + pr + "'")) { - b.append(bt); - ok = bt.equals(ft); - } else - ok = true; // suppress following check - } - } - if (!ok && type.getCode().equals("*")) { - ok = true; // can refer to anything - } - } - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ok, "Invalid Resource target type. Found " + ft + ", but expected one of (" + b.toString() + ")"); - } - } - - private String checkResourceType(String type) { - if (context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type) != null) - return type; - else - return null; - } - - private void checkSampledData(List<ValidationMessage> errors, String path, WrapperElement focus, SampledData fixed) { - checkFixedValue(errors, path + ".origin", focus.getNamedChild("origin"), fixed.getOrigin(), "origin"); - checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriodElement(), "period"); - checkFixedValue(errors, path + ".factor", focus.getNamedChild("factor"), fixed.getFactorElement(), "factor"); - checkFixedValue(errors, path + ".lowerLimit", focus.getNamedChild("lowerLimit"), fixed.getLowerLimitElement(), "lowerLimit"); - checkFixedValue(errors, path + ".upperLimit", focus.getNamedChild("upperLimit"), fixed.getUpperLimitElement(), "upperLimit"); - checkFixedValue(errors, path + ".dimensions", focus.getNamedChild("dimensions"), fixed.getDimensionsElement(), "dimensions"); - checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data"); - } - - private void checkTiming(List<ValidationMessage> errors, String path, WrapperElement focus, Timing fixed) { - checkFixedValue(errors, path + ".repeat", focus.getNamedChild("repeat"), fixed.getRepeat(), "value"); - - List<WrapperElement> events = new ArrayList<WrapperElement>(); - focus.getNamedChildren("event", events); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, events.size() == fixed.getEvent().size(), - "Expected " + Integer.toString(fixed.getEvent().size()) + " but found " + Integer.toString(events.size()) + " event elements")) { - for (int i = 0; i < events.size(); i++) - checkFixedValue(errors, path + ".event", events.get(i), fixed.getEvent().get(i), "event"); - } - } - - private boolean codeinExpansion(ValueSetExpansionContainsComponent cnt, String system, String code) { - for (ValueSetExpansionContainsComponent c : cnt.getContains()) { - if (code.equals(c.getCode()) && system.equals(c.getSystem().toString())) - return true; - if (codeinExpansion(c, system, code)) - return true; - } - return false; - } - - private boolean codeInExpansion(ValueSet vs, String system, String code) { - for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) { - if (code.equals(c.getCode()) && (system == null || system.equals(c.getSystem()))) - return true; - if (codeinExpansion(c, system, code)) - return true; - } - return false; - } - - private String describeReference(Type reference) { - if (reference == null) - return "null"; - if (reference instanceof UriType) - return ((UriType) reference).getValue(); - if (reference instanceof Reference) - return ((Reference) reference).getReference(); - return "??"; - } - - private String describeTypes(List<TypeRefComponent> types) { - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (TypeRefComponent t : types) { - b.append(t.getCode()); - } - return b.toString(); - } - - private boolean empty(WrapperElement element) { - if (element.hasAttribute("value")) - return false; - if (element.hasAttribute("xml:id")) - return false; - WrapperElement child = element.getFirstChild(); - while (child != null) { - if (!child.isXml() || FormatUtilities.FHIR_NS.equals(child.getNamespace())) { - return false; - } - child = child.getNextSibling(); - } - return true; - } - - private ElementDefinition findElement(StructureDefinition profile, String name) { - for (ElementDefinition c : profile.getSnapshot().getElement()) { - if (c.getPath().equals(name)) { - return c; - } - } - return null; - } - - private String genFullUrl(String bundleBase, String entryBase, String type, String id) { - String base = Utilities.noString(entryBase) ? bundleBase : entryBase; - if (Utilities.noString(base)) { - return type + "/" + id; - } else if ("urn:uuid".equals(base) || "urn:oid".equals(base)) - return base + id; - else - return Utilities.appendSlash(base) + type + "/" + id; - } - - public BestPracticeWarningLevel getBasePracticeWarningLevel() { - return bpWarnings; - } - - private String getBaseType(StructureDefinition profile, String pr) { - // if (pr.startsWith("http://hl7.org/fhir/StructureDefinition/")) { - // // this just has to be a base type - // return pr.substring(40); - // } else { - StructureDefinition p = resolveProfile(profile, pr); - if (p == null) - return null; - else if (p.getKind() == StructureDefinitionKind.RESOURCE) - return p.getSnapshot().getElement().get(0).getPath(); - else - return p.getSnapshot().getElement().get(0).getType().get(0).getCode(); - // } - } - - @Override - public CheckDisplayOption getCheckDisplay() { - return checkDisplay; - } - - // private String findProfileTag(WrapperElement element) { - // String uri = null; - // List<WrapperElement> list = new ArrayList<WrapperElement>(); - // element.getNamedChildren("category", list); - // for (WrapperElement c : list) { - // if ("http://hl7.org/fhir/tag/profile".equals(c.getAttribute("scheme"))) { - // uri = c.getAttribute("term"); - // } - // } - // return uri; - // } - - private ConceptDefinitionComponent getCodeDefinition(ConceptDefinitionComponent c, String code) { - if (code.equals(c.getCode())) - return c; - for (ConceptDefinitionComponent g : c.getConcept()) { - ConceptDefinitionComponent r = getCodeDefinition(g, code); - if (r != null) - return r; - } - return null; - } - - private ConceptDefinitionComponent getCodeDefinition(ValueSet vs, String code) { - for (ConceptDefinitionComponent c : vs.getCodeSystem().getConcept()) { - ConceptDefinitionComponent r = getCodeDefinition(c, code); - if (r != null) - return r; - } - return null; - } - - private WrapperElement getContainedById(WrapperElement container, String id) { - List<WrapperElement> contained = new ArrayList<WrapperElement>(); - container.getNamedChildren("contained", contained); - for (WrapperElement we : contained) { - WrapperElement res = we.isXml() ? we.getFirstChild() : we; - if (id.equals(res.getNamedChildValue("id"))) - return res; - } - return null; - } - - public IWorkerContext getContext() { - return context; - } - - private ElementDefinition getCriteriaForDiscriminator(String path, ElementDefinition ed, String discriminator, StructureDefinition profile) throws DefinitionException { - List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(profile, ed); - List<ElementDefinition> snapshot = null; - if (childDefinitions.isEmpty()) { - // going to look at the type - if (ed.getType().size() == 0) - throw new DefinitionException("Error in profile for " + path + " no children, no type"); - if (ed.getType().size() > 1) - throw new DefinitionException("Error in profile for " + path + " multiple types defined in slice discriminator"); - StructureDefinition type; - if (ed.getType().get(0).hasProfile()) { - // need to do some special processing for reference here... - if (ed.getType().get(0).getCode().equals("Reference")) - discriminator = discriminator.substring(discriminator.indexOf(".")+1); - type = context.fetchResource(StructureDefinition.class, ed.getType().get(0).getProfile().get(0).getValue()); - } else - type = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + ed.getType().get(0).getCode()); - snapshot = type.getSnapshot().getElement(); - ed = snapshot.get(0); - } else { - snapshot = profile.getSnapshot().getElement(); - } - String originalPath = ed.getPath(); - String goal = originalPath + "." + discriminator; - - int index = snapshot.indexOf(ed); - assert(index > -1); - index++; - while (index < snapshot.size() && !snapshot.get(index).getPath().equals(originalPath)) { - if (snapshot.get(index).getPath().equals(goal)) - return snapshot.get(index); - index++; - } - throw new Error("Unable to find discriminator definition for " + goal + " in " + discriminator + " at " + path); - } - - private WrapperElement getExtensionByUrl(List<WrapperElement> extensions, String urlSimple) { - for (WrapperElement e : extensions) { - if (urlSimple.equals(e.getNamedChildValue("url"))) - return e; - } - return null; - } - - public List<String> getExtensionDomains() { - return extensionDomains; - } - - private WrapperElement getFromBundle(WrapperElement bundle, String ref) { - List<WrapperElement> entries = new ArrayList<WrapperElement>(); - bundle.getNamedChildren("entry", entries); - for (WrapperElement we : entries) { - WrapperElement res = we.getNamedChild("resource").getFirstChild(); - if (res != null) { - String url = genFullUrl(bundle.getNamedChildValue("base"), we.getNamedChildValue("base"), res.getName(), res.getNamedChildValue("id")); - if (url.endsWith(ref)) - return res; - } - } - return null; - } - - private StructureDefinition getProfileForType(String type) { - return context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type); - } - - private Element getValueForDiscriminator(WrapperElement element, String discriminator, ElementDefinition criteria) { - // throw new Error("validation of slices not done yet"); - return null; - } - - private ValueSet getValueSet(String system) { - return context.fetchCodeSystem(system); - } - - private boolean hasTime(String fmt) { - return fmt.contains("T"); - } - - private boolean hasTimeZone(String fmt) { - return fmt.length() > 10 && (fmt.substring(10).contains("-") || fmt.substring(10).contains("+") || fmt.substring(10).contains("Z")); - } - - private boolean isAbsolute(String uri) { - return Utilities.noString(uri) || uri.startsWith("http:") || uri.startsWith("https:") || uri.startsWith("urn:uuid:") || uri.startsWith("urn:oid:") || uri.startsWith("urn:ietf:") - || uri.startsWith("urn:iso:") || isValidFHIRUrn(uri); - } - - private boolean isValidFHIRUrn(String uri) { - return (uri.equals("urn:x-fhir:uk:id:nhs-number")); - } - - public boolean isAnyExtensionsAllowed() { - return anyExtensionsAllowed; - } - - private boolean isParametersEntry(String path) { - String[] parts = path.split("\\/"); - if (path.startsWith("/f:")) - return parts.length == 4 && parts[parts.length-3].equals("f:Parameters") && parts[parts.length-2].startsWith("f:parameter") && parts[parts.length-1].startsWith("f:resource"); - else - return parts.length == 4 && parts[parts.length-3].equals("Parameters") && parts[parts.length-2].startsWith("parameter") && parts[parts.length-1].startsWith("resource"); - } - - private boolean isBundleEntry(String path) { - String[] parts = path.split("\\/"); - if (path.startsWith("/f:")) - return parts.length > 2 && parts[parts.length - 1].startsWith("f:resource") && (parts[parts.length - 2].equals("f:entry") || parts[parts.length - 2].startsWith("f:entry[")); - else - return parts.length > 2 && parts[parts.length - 1].equals("resource") && ((parts.length > 2 && parts[parts.length - 3].equals("entry")) || parts[parts.length - 2].equals("entry")); - } - - private boolean isPrimitiveType(String type) { - return type.equalsIgnoreCase("boolean") || type.equalsIgnoreCase("integer") || type.equalsIgnoreCase("string") || type.equalsIgnoreCase("decimal") || type.equalsIgnoreCase("uri") - || type.equalsIgnoreCase("base64Binary") || type.equalsIgnoreCase("instant") || type.equalsIgnoreCase("date") || type.equalsIgnoreCase("uuid") || type.equalsIgnoreCase("id") - || type.equalsIgnoreCase("xhtml") || type.equalsIgnoreCase("markdown") || type.equalsIgnoreCase("dateTime") || type.equalsIgnoreCase("time") || type.equalsIgnoreCase("code") - || type.equalsIgnoreCase("oid") || type.equalsIgnoreCase("id"); - } - - - - public boolean isSuppressLoincSnomedMessages() { - return suppressLoincSnomedMessages; - } - - private boolean nameMatches(String name, String tail) { - if (tail.endsWith("[x]")) - return name.startsWith(tail.substring(0, tail.length() - 3)); - else - return (name.equals(tail)); - } - - // private String mergePath(String path1, String path2) { - // // path1 is xpath path - // // path2 is dotted path - // String[] parts = path2.split("\\."); - // StringBuilder b = new StringBuilder(path1); - // for (int i = 1; i < parts.length -1; i++) - // b.append("/f:"+parts[i]); - // return b.toString(); - // } - - private boolean passesCodeWhitespaceRules(String v) { - if (!v.trim().equals(v)) - return false; - boolean lastWasSpace = true; - for (char c : v.toCharArray()) { - if (c == ' ') { - if (lastWasSpace) - return false; - else - lastWasSpace = true; - } else if (Character.isWhitespace(c)) - return false; - else - lastWasSpace = false; - } - return true; - } - - private WrapperElement resolve(String ref, NodeStack stack) { - if (ref.startsWith("#")) { - // work back through the contained list. - // really, there should only be one level for this (contained resources cannot contain - // contained resources), but we'll leave that to some other code to worry about - while (stack != null && stack.getElement() != null) { - WrapperElement res = getContainedById(stack.getElement(), ref.substring(1)); - if (res != null) - return res; - stack = stack.parent; - } - return null; - } else { - // work back through the contained list - if any of them are bundles, try to resolve - // the resource in the bundle - while (stack != null && stack.getElement() != null) { - if ("Bundle".equals(stack.getElement().getResourceType())) { - WrapperElement res = getFromBundle(stack.getElement(), ref.substring(1)); - if (res != null) - return res; - } - stack = stack.parent; - } - - // todo: consult the external host for resolution - return null; - - } - } - - private ValueSet resolveBindingReference(Type reference) { - if (reference instanceof UriType) - return context.fetchResource(ValueSet.class, ((UriType) reference).getValue().toString()); - else if (reference instanceof Reference) - return context.fetchResource(ValueSet.class, ((Reference) reference).getReference()); - else - return null; - } - - private WrapperElement resolveInBundle(List<WrapperElement> entries, String ref, String fullUrl, String type, String id) { - if (Utilities.isAbsoluteUrl(ref)) { - // if the reference is absolute, then you resolve by fullUrl. No other thinking is required. - for (WrapperElement entry : entries) { - String fu = entry.getNamedChildValue("fullUrl"); - if (ref.equals(fu)) - return entry; - } - return null; - } else { - // split into base, type, and id - String u = null; - if (fullUrl != null && fullUrl.endsWith(type+"/"+id)) - // fullUrl = complex - u = fullUrl.substring((type+"/"+id).length())+ref; - String[] parts = ref.split("\\/"); - if (parts.length >= 2) { - String t = parts[0]; - String i = parts[1]; - for (WrapperElement entry : entries) { - String fu = entry.getNamedChildValue("fullUrl"); - if (u != null && fullUrl.equals(u)) - return entry; - if (u == null) { - WrapperElement res = entry.getNamedChild("resource"); - WrapperElement resource = res.getFirstChild(); - String et = resource.getResourceType(); - String eid = resource.getNamedChildValue("id"); - if (t.equals(et) && i.equals(eid)) - return entry; - } - } - } - return null; - } - } - - private ElementDefinition resolveNameReference(StructureDefinitionSnapshotComponent snapshot, String name) { - for (ElementDefinition ed : snapshot.getElement()) - if (name.equals(ed.getName())) - return ed; - return null; - } - - private StructureDefinition resolveProfile(StructureDefinition profile, String pr) { - if (pr.startsWith("#")) { - for (Resource r : profile.getContained()) { - if (r.getId().equals(pr.substring(1)) && r instanceof StructureDefinition) - return (StructureDefinition) r; - } - return null; - } else - return context.fetchResource(StructureDefinition.class, pr); - } - - private ElementDefinition resolveType(String type) { - String url = "http://hl7.org/fhir/StructureDefinition/" + type; - StructureDefinition sd = context.fetchResource(StructureDefinition.class, url); - if (sd == null || !sd.hasSnapshot()) - return null; - else - return sd.getSnapshot().getElement().get(0); - } - - public void setAnyExtensionsAllowed(boolean anyExtensionsAllowed) { - this.anyExtensionsAllowed = anyExtensionsAllowed; - } - - public void setBestPracticeWarningLevel(BestPracticeWarningLevel value) { - bpWarnings = value; - } - - @Override - public void setCheckDisplay(CheckDisplayOption checkDisplay) { - this.checkDisplay = checkDisplay; - } - - public void setSuppressLoincSnomedMessages(boolean suppressLoincSnomedMessages) { - this.suppressLoincSnomedMessages = suppressLoincSnomedMessages; - } - - public IdStatus getResourceIdRule() { - return resourceIdRule; - } - - public void setResourceIdRule(IdStatus resourceIdRule) { - this.resourceIdRule = resourceIdRule; - } - - /** - * - * @param element - * - the candidate that might be in the slice - * @param path - * - for reporting any errors. the XPath for the element - * @param slice - * - the definition of how slicing is determined - * @param ed - * - the slice for which to test membership - * @return - * @throws DefinitionException - * @throws Exception - */ - private boolean sliceMatches(WrapperElement element, String path, ElementDefinition slice, ElementDefinition ed, StructureDefinition profile) throws DefinitionException { - if (!slice.getSlicing().hasDiscriminator()) - return false; // cannot validate in this case - for (StringType s : slice.getSlicing().getDiscriminator()) { - String discriminator = s.getValue(); - ElementDefinition criteria = getCriteriaForDiscriminator(path, ed, discriminator, profile); - if (discriminator.equals("url") && criteria.getPath().equals("Extension.url")) { - if (!element.getAttribute("url").equals(((UriType) criteria.getFixed()).asStringValue())) - return false; - } else { - Element value = getValueForDiscriminator(element, discriminator, criteria); - if (!valueMatchesCriteria(value, criteria)) - return false; - } - } - return true; - } - - // we assume that the following things are true: - // the instance at root is valid against the schema and schematron - // the instance validator had no issues against the base resource profile - private void start(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, StructureDefinition profile, NodeStack stack) throws FHIRException { - // profile is valid, and matches the resource name - if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), profile.hasSnapshot(), - "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) { - validateElement(errors, profile, profile.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); - - checkDeclaredProfiles(errors, resource, element, stack); - - // specific known special validations - if (element.getResourceType().equals("Bundle")) - validateBundle(errors, element, stack); - if (element.getResourceType().equals("Observation")) - validateObservation(errors, element, stack); - } - } - - private String tail(String path) { - return path.substring(path.lastIndexOf(".") + 1); - } - - private String tryParse(String ref) { - String[] parts = ref.split("\\/"); - switch (parts.length) { - case 1: - return null; - case 2: - return checkResourceType(parts[0]); - default: - if (parts[parts.length - 2].equals("_history")) - return checkResourceType(parts[parts.length - 4]); - else - return checkResourceType(parts[parts.length - 2]); - } - } - - private boolean typesAreAllReference(List<TypeRefComponent> theType) { - for (TypeRefComponent typeRefComponent : theType) { - if (typeRefComponent.getCode().equals("Reference") == false) { - return false; - } - } - return true; - } - - @Override - public List<ValidationMessage> validate(Document document) throws FHIRException { - List<ValidationMessage> results = new ArrayList<ValidationMessage>(); - validate(results, document); - return results; - } - - @Override - public List<ValidationMessage> validate(Document document, String profile) throws FHIRException { - List<ValidationMessage> results = new ArrayList<ValidationMessage>(); - validate(results, document, profile); - return results; - } - - @Override - public List<ValidationMessage> validate(Document document, StructureDefinition profile) throws FHIRException { - List<ValidationMessage> results = new ArrayList<ValidationMessage>(); - validate(results, document, profile); - return results; - } - - @Override - public List<ValidationMessage> validate(Element element) throws FHIRException { - List<ValidationMessage> results = new ArrayList<ValidationMessage>(); - validate(results, element); - return results; - } - - @Override - public List<ValidationMessage> validate(Element element, String profile) throws FHIRException { - List<ValidationMessage> results = new ArrayList<ValidationMessage>(); - validate(results, element, profile); - return results; - } - - @Override - public List<ValidationMessage> validate(Element element, StructureDefinition profile) throws FHIRException { - List<ValidationMessage> results = new ArrayList<ValidationMessage>(); - validate(results, element, profile); - return results; - } - - @Override - public List<ValidationMessage> validate(JsonObject obj) throws FHIRException { - List<ValidationMessage> results = new ArrayList<ValidationMessage>(); - validate(results, obj); - return results; - } - - @Override - public List<ValidationMessage> validate(JsonObject obj, String profile) throws FHIRException { - List<ValidationMessage> results = new ArrayList<ValidationMessage>(); - validate(results, obj, profile); - return results; - } - - @Override - public List<ValidationMessage> validate(JsonObject obj, StructureDefinition profile) throws FHIRException { - List<ValidationMessage> results = new ArrayList<ValidationMessage>(); - validate(results, obj, profile); - return results; - } - - @Override - public void validate(List<ValidationMessage> errors, Document document) throws FHIRException { - checkForProcessingInstruction(errors, document); - validateResource(errors, null, new DOMWrapperElement(document.getDocumentElement()), null, resourceIdRule, null); - } - - @Override - public void validate(List<ValidationMessage> errors, Document document, String profile) throws FHIRException { - checkForProcessingInstruction(errors, document); - StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); - if (p == null) - throw new DefinitionException("StructureDefinition '" + profile + "' not found"); - validateResource(errors, null, new DOMWrapperElement(document.getDocumentElement()), p, resourceIdRule, null); - } - - @Override - public void validate(List<ValidationMessage> errors, Document document, StructureDefinition profile) throws FHIRException { - checkForProcessingInstruction(errors, document); - validateResource(errors, null, new DOMWrapperElement(document.getDocumentElement()), profile, resourceIdRule, null); - } - - @Override - public void validate(List<ValidationMessage> errors, Element element) throws FHIRException { - validateResource(errors, null, new DOMWrapperElement(element), null, resourceIdRule, null); - } - - @Override - public void validate(List<ValidationMessage> errors, Element element, String profile) throws FHIRException { - StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); - if (p == null) - throw new DefinitionException("StructureDefinition '" + profile + "' not found"); - validateResource(errors, null, new DOMWrapperElement(element), p, resourceIdRule, null); - } - - @Override - public void validate(List<ValidationMessage> errors, Element element, StructureDefinition profile) throws FHIRException { - validateResource(errors, null, new DOMWrapperElement(element), profile, resourceIdRule, null); - } - - @Override - public void validate(List<ValidationMessage> errors, JsonObject object) throws FHIRException { - validateResource(errors, null, new JsonWrapperElement(object), null, resourceIdRule, null); - } - - @Override - public void validate(List<ValidationMessage> errors, JsonObject object, String profile) throws FHIRException { - StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); - if (p == null) - throw new DefinitionException("StructureDefinition '" + profile + "' not found"); - validateResource(errors, null, new JsonWrapperElement(object), p, resourceIdRule, null); - } - - @Override - public void validate(List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws FHIRException { - validateResource(errors, null, new JsonWrapperElement(object), profile, resourceIdRule, null); - } - - private void validateBundle(List<ValidationMessage> errors, WrapperElement bundle, NodeStack stack) { - List<WrapperElement> entries = new ArrayList<WrapperElement>(); - bundle.getNamedChildren("entry", entries); - String type = bundle.getNamedChildValue("type"); - if (entries.size() == 0) { - rule(errors, IssueType.INVALID, stack.getLiteralPath(), !(type.equals("document") || type.equals("message")), "Documents or Messages must contain at least one entry"); - } else { - WrapperElement firstEntry = entries.get(0); - NodeStack firstStack = stack.push(firstEntry, 0, null, null); - String fullUrl = firstEntry.getNamedChildValue("fullUrl"); - - if (type.equals("document")) { - WrapperElement res = firstEntry.getNamedChild("resource"); - NodeStack localStack = firstStack.push(res, -1, null, null); - WrapperElement resource = res.getFirstChild(); - String id = resource.getNamedChildValue("id"); - if (rule(errors, IssueType.INVALID, firstEntry.line(), firstEntry.col(), stack.addToLiteralPath("entry", ":0"), res != null, "No resource on first entry")) { - if (bundle.isXml()) - validateDocument(errors, entries, resource, localStack.push(resource, -1, null, null), fullUrl, id); - else - validateDocument(errors, entries, res, localStack, fullUrl, id); - } - } - if (type.equals("message")) - validateMessage(errors, bundle); - } - } - - // public class ProfileStructureIterator { - // - // private StructureDefinition profile; - // private ElementDefinition elementDefn; - // private List<String> names = new ArrayList<String>(); - // private Map<String, List<ElementDefinition>> children = new HashMap<String, List<ElementDefinition>>(); - // private int cursor; - // - // public ProfileStructureIterator(StructureDefinition profile, ElementDefinition elementDefn) { - // this.profile = profile; - // this.elementDefn = elementDefn; - // loadMap(); - // cursor = -1; - // } - // - // private void loadMap() { - // int i = profile.getSnapshot().getElement().indexOf(elementDefn) + 1; - // String lead = elementDefn.getPath(); - // while (i < profile.getSnapshot().getElement().size()) { - // String name = profile.getSnapshot().getElement().get(i).getPath(); - // if (name.length() <= lead.length()) - // return; // cause we've got to the end of the possible matches - // String tail = name.substring(lead.length()+1); - // if (Utilities.isToken(tail) && name.substring(0, lead.length()).equals(lead)) { - // List<ElementDefinition> list = children.get(tail); - // if (list == null) { - // list = new ArrayList<ElementDefinition>(); - // names.add(tail); - // children.put(tail, list); - // } - // list.add(profile.getSnapshot().getElement().get(i)); - // } - // i++; - // } - // } - // - // public boolean more() { - // cursor++; - // return cursor < names.size(); - // } - // - // public List<ElementDefinition> current() { - // return children.get(name()); - // } - // - // public String name() { - // return names.get(cursor); - // } - // - // } - // - // private void checkByProfile(List<ValidationMessage> errors, String path, WrapperElement focus, StructureDefinition profile, ElementDefinition elementDefn) - // { - // // we have an element, and the structure that describes it. - // // we know that's it's valid against the underlying spec - is it valid against this one? - // // in the instance validator above, we assume that schema or schmeatron has taken care of cardinalities, but here, we have no such reliance. - // // so the walking algorithm is different: we're going to walk the definitions - // String type; - // if (elementDefn.getPath().endsWith("[x]")) { - // String tail = elementDefn.getPath().substring(elementDefn.getPath().lastIndexOf(".")+1, elementDefn.getPath().length()-3); - // type = focus.getName().substring(tail.length()); - // rule(errors, IssueType.STRUCTURE, focus.line(), focus.col(), path, typeAllowed(type, elementDefn.getType()), "The type '"+type+"' is not allowed at this - // point (must be one of '"+typeSummary(elementDefn)+")"); - // } else { - // if (elementDefn.getType().size() == 1) { - // type = elementDefn.getType().size() == 0 ? null : elementDefn.getType().get(0).getCode(); - // } else - // type = null; - // } - // // constraints: - // for (ElementDefinitionConstraintComponent c : elementDefn.getConstraint()) - // checkConstraint(errors, path, focus, c); - // if (elementDefn.hasBinding() && type != null) - // checkBinding(errors, path, focus, profile, elementDefn, type); - // - // // type specific checking: - // if (type != null && isPrimitiveType(type)) { - // checkPrimitiveByProfile(errors, path, focus, elementDefn); - // } else { - // if (elementDefn.hasFixed()) - // checkFixedValue(errors, path, focus, elementDefn.getFixed(), ""); - // - // ProfileStructureIterator walker = new ProfileStructureIterator(profile, elementDefn); - // while (walker.more()) { - // // collect all the slices for the path - // List<ElementDefinition> childset = walker.current(); - // // collect all the elements that match it by name - // List<WrapperElement> children = new ArrayList<WrapperElement>(); - // focus.getNamedChildrenWithWildcard(walker.name(), children); - // - // if (children.size() == 0) { - // // well, there's no children - should there be? - // for (ElementDefinition defn : childset) { - // if (!rule(errors, IssueType.REQUIRED, focus.line(), focus.col(), path, defn.getMin() == 0, "Required Element '"+walker.name()+"' missing")) - // break; // no point complaining about missing ones after the first one - // } - // } else if (childset.size() == 1) { - // // simple case: one possible definition, and one or more children. - // rule(errors, IssueType.STRUCTURE, focus.line(), focus.col(), path, childset.get(0).getMax().equals("*") || Integer.parseInt(childset.get(0).getMax()) >= - // children.size(), - // "Too many elements for '"+walker.name()+"'"); // todo: sort out structure - // for (WrapperElement child : children) { - // checkByProfile(errors, childset.get(0).getPath(), child, profile, childset.get(0)); - // } - // } else { - // // ok, this is the full case - we have a list of definitions, and a list of candidates for meeting those definitions. - // // we need to decide *if* that match a given definition - // } - // } - // } - // } - - // private void checkBinding(List<ValidationMessage> errors, String path, WrapperElement focus, StructureDefinition profile, ElementDefinition elementDefn, - // String type) { - // ElementDefinitionBindingComponent bc = elementDefn.getBinding(); - // - // if (bc != null && bc.hasValueSet() && bc.getValueSet() instanceof Reference) { - // String url = ((Reference) bc.getValueSet()).getReference(); - // ValueSet vs = resolveValueSetReference(profile, (Reference) bc.getValueSet()); - // if (vs == null) { - // rule(errors, IssueType.STRUCTURE, focus.line(), focus.col(), path, false, "Cannot check binding on type '"+type+"' as the value set '"+url+"' could not be - // located"); - // } else if (type.equals("code")) - // checkBindingCode(errors, path, focus, vs); - // else if (type.equals("Coding")) - // checkBindingCoding(errors, path, focus, vs); - // else if (type.equals("CodeableConcept")) - // checkBindingCodeableConcept(errors, path, focus, vs); - // else - // rule(errors, IssueType.STRUCTURE, focus.line(), focus.col(), path, false, "Cannot check binding on type '"+type+"'"); - // } - // } - // - // private ValueSet resolveValueSetReference(StructureDefinition profile, Reference reference) { - // if (reference.getReference().startsWith("#")) { - // for (Resource r : profile.getContained()) { - // if (r instanceof ValueSet && r.getId().equals(reference.getReference().substring(1))) - // return (ValueSet) r; - // } - // return null; - // } else - // return resolveBindingReference(reference); - // - // } - // - // private void checkBindingCode(List<ValidationMessage> errors, String path, WrapperElement focus, ValueSet vs) { - // // rule(errors, "exception", path, false, "checkBindingCode not done yet"); - // } - // - // private void checkBindingCoding(List<ValidationMessage> errors, String path, WrapperElement focus, ValueSet vs) { - // // rule(errors, "exception", path, false, "checkBindingCoding not done yet"); - // } - // - // private void checkBindingCodeableConcept(List<ValidationMessage> errors, String path, WrapperElement focus, ValueSet vs) { - // // rule(errors, "exception", path, false, "checkBindingCodeableConcept not done yet"); - // } - // - // private String typeSummary(ElementDefinition elementDefn) { - // StringBuilder b = new StringBuilder(); - // for (TypeRefComponent t : elementDefn.getType()) { - // b.append("|"+t.getCode()); - // } - // return b.toString().substring(1); - // } - // - // private boolean typeAllowed(String t, List<TypeRefComponent> types) { - // for (TypeRefComponent type : types) { - // if (t.equals(Utilities.capitalize(type.getCode()))) - // return true; - // if (t.equals("Resource") && Utilities.capitalize(type.getCode()).equals("Reference")) - // return true; - // } - // return false; - // } - // - // private void checkConstraint(List<ValidationMessage> errors, String path, WrapperElement focus, ElementDefinitionConstraintComponent c) { - // - //// try - //// { - //// XPathFactory xpf = new net.sf.saxon.xpath.XPathFactoryImpl(); - //// NamespaceContext context = new NamespaceContextMap("f", "http://hl7.org/fhir", "h", "http://www.w3.org/1999/xhtml"); - //// - //// XPath xpath = xpf.newXPath(); - //// xpath.setNamespaceContext(context); - //// Boolean ok = (Boolean) xpath.evaluate(c.getXpath(), focus, XPathConstants.BOOLEAN); - //// if (ok == null || !ok) { - //// if (c.getSeverity() == ConstraintSeverity.warning) - //// warning(errors, "invariant", path, false, c.getHuman()); - //// else - //// rule(errors, "invariant", path, false, c.getHuman()); - //// } - //// } - //// catch (XPathExpressionException e) { - //// rule(errors, "invariant", path, false, "error executing invariant: "+e.getMessage()); - //// } - // } - // - // private void checkPrimitiveByProfile(List<ValidationMessage> errors, String path, WrapperElement focus, ElementDefinition elementDefn) { - // // two things to check - length, and fixed value - // String value = focus.getAttribute("value"); - // if (elementDefn.hasMaxLengthElement()) { - // rule(errors, IssueType.TOOLONG, focus.line(), focus.col(), path, value.length() <= elementDefn.getMaxLength(), "The value '"+value+"' exceeds the allow - // length limit of "+Integer.toString(elementDefn.getMaxLength())); - // } - // if (elementDefn.hasFixed()) { - // checkFixedValue(errors, path, focus, elementDefn.getFixed(), ""); - // } - // } - - private void validateBundleReference(List<ValidationMessage> errors, List<WrapperElement> entries, WrapperElement ref, String name, NodeStack stack, String fullUrl, String type, String id) { - if (ref != null && !Utilities.noString(ref.getNamedChildValue("reference"))) { - WrapperElement target = resolveInBundle(entries, ref.getNamedChildValue("reference"), fullUrl, type, id); - rule(errors, IssueType.INVALID, target.line(), target.col(), stack.addToLiteralPath("reference"), target != null, "Unable to resolve the target of the reference in the bundle (" + name + ")"); - } - } - - private void validateContains(List<ValidationMessage> errors, String path, ElementDefinition child, ElementDefinition context, WrapperElement resource, WrapperElement element, NodeStack stack, IdStatus idstatus) throws FHIRException - { - WrapperElement e = element.isXml() ? element.getFirstChild() : element; - String resourceName = e.getResourceType(); - StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); - // special case: resource wrapper is reset if we're crossing a bundle boundary, but not otherwise - if (path.endsWith("resource")) - resource = e; - if (rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), profile != null, "No profile found for contained resource of type '" + resourceName + "'")) - validateResource(errors, resource, e, profile, idstatus, stack); - } - - private void validateDocument(List<ValidationMessage> errors, List<WrapperElement> entries, WrapperElement composition, NodeStack stack, String fullUrl, String id) { - // first entry must be a composition - if (rule(errors, IssueType.INVALID, composition.line(), composition.col(), stack.getLiteralPath(), composition.getResourceType().equals("Composition"), - "The first entry in a document must be a composition")) { - // the composition subject and section references must resolve in the bundle - validateBundleReference(errors, entries, composition.getNamedChild("subject"), "Composition Subject", stack.push(composition.getNamedChild("subject"), -1, null, null), fullUrl, "Composition", - id); - validateSections(errors, entries, composition, stack, fullUrl, id); - } - } - // rule(errors, IssueType.INVALID, bundle.line(), bundle.col(), "Bundle", !"urn:guid:".equals(base), "The base 'urn:guid:' is not valid (use urn:uuid:)"); - // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !"urn:guid:".equals(ebase), "The base 'urn:guid:' is not valid"); - // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !Utilities.noString(base) || !Utilities.noString(ebase), "entry - // does not have a base"); - // String firstBase = null; - // firstBase = ebase == null ? base : ebase; - - private void validateElement(List<ValidationMessage> errors, StructureDefinition profile, ElementDefinition definition, StructureDefinition cprofile, ElementDefinition context, - WrapperElement resource, WrapperElement element, String actualType, NodeStack stack, boolean inCodeableConcept) throws FHIRException { - element.setDefinition(definition); - element.setProfile(profile); - - // irrespective of what element it is, it cannot be empty - if (element.isXml()) { - rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), FormatUtilities.FHIR_NS.equals(element.getNamespace()), - "Namespace mismatch - expected '" + FormatUtilities.FHIR_NS + "', found '" + element.getNamespace() + "'"); - rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), !element.hasNamespace("http://www.w3.org/2001/XMLSchema-instance"), - "Schema Instance Namespace is not allowed in instances"); - rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), !element.hasProcessingInstruction(), "No Processing Instructions in resources"); - } - rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), !empty(element), "Elements must have some content (@value, extensions, or children elements)"); - - checkInvariants(errors, stack.literalPath, profile, definition, null, null, resource, element); - - // get the list of direct defined children, including slices - List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(profile, definition.getName(), definition.getPath(), definition.getNameReference()); - - // 1. List the children, and remember their exact path (convenience) - List<ElementInfo> children = new ArrayList<InstanceValidator.ElementInfo>(); - ChildIterator iter = new ChildIterator(stack.getLiteralPath(), element); - while (iter.next()) - children.add(new ElementInfo(iter.name(), iter.element(), iter.path(), iter.count())); - - // 2. assign children to a definition - // for each definition, for each child, check whether it belongs in the slice - ElementDefinition slice = null; - for (ElementDefinition ed : childDefinitions) { - boolean process = true; - // where are we with slicing - if (ed.hasSlicing()) { - if (slice != null && slice.getPath().equals(ed.getPath())) - throw new DefinitionException("Slice encountered midway through path on " + slice.getPath()); - slice = ed; - process = false; - } else if (slice != null && !slice.getPath().equals(ed.getPath())) - slice = null; - - if (process) { - for (ElementInfo ei : children) { - boolean match = false; - if (slice == null) { - match = nameMatches(ei.name, tail(ed.getPath())); - } else { - if (nameMatches(ei.name, tail(ed.getPath()))) - match = sliceMatches(ei.element, ei.path, slice, ed, profile); - } - if (match) { - if (rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition == null, "Element matches more than one slice")) - ei.definition = ed; - } - } - } - } - for (ElementInfo ei : children) - if (ei.path.endsWith(".extension")) - rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getAttribute("url") + "\")"); - else - rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition != null) || (!ei.element.isXml() && ei.element.getName().equals("fhir_comments")), - "Element is unknown or does not match any slice"); - - // 3. report any definitions that have a cardinality problem - for (ElementDefinition ed : childDefinitions) { - if (ed.getRepresentation().isEmpty()) { // ignore xml attributes - int count = 0; - for (ElementInfo ei : children) - if (ei.definition == ed) - count++; - if (ed.getMin() > 0) { - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), - "Element '" + stack.getLiteralPath() + "." + tail(ed.getPath()) + "': minimum required = " + Integer.toString(ed.getMin()) + ", but only found " + Integer.toString(count)); - } - if (ed.hasMax() && !ed.getMax().equals("*")) { - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), - "Element " + tail(ed.getPath()) + " @ " + stack.getLiteralPath() + ": max allowed = " + ed.getMax() + ", but found " + Integer.toString(count)); - } - - } - } - // 4. check order if any slices are orderd. (todo) - - // 5. inspect each child for validity - for (ElementInfo ei : children) { - if (ei.definition != null) { - String type = null; - ElementDefinition typeDefn = null; - if (ei.definition.getType().size() == 1 && !ei.definition.getType().get(0).getCode().equals("*") && !ei.definition.getType().get(0).getCode().equals("Element") - && !ei.definition.getType().get(0).getCode().equals("BackboneElement")) - type = ei.definition.getType().get(0).getCode(); - else if (ei.definition.getType().size() == 1 && ei.definition.getType().get(0).getCode().equals("*")) { - String prefix = tail(ei.definition.getPath()); - assert prefix.endsWith("[x]"); - type = ei.name.substring(prefix.length() - 3); - if (isPrimitiveType(type)) - type = Utilities.uncapitalize(type); - } else if (ei.definition.getType().size() > 1) { - - String prefix = tail(ei.definition.getPath()); - assert typesAreAllReference(ei.definition.getType()) || prefix.endsWith("[x]") : prefix; - - prefix = prefix.substring(0, prefix.length() - 3); - for (TypeRefComponent t : ei.definition.getType()) - if ((prefix + Utilities.capitalize(t.getCode())).equals(ei.name)) - type = t.getCode(); - if (type == null) { - TypeRefComponent trc = ei.definition.getType().get(0); - if (trc.getCode().equals("Reference")) - type = "Reference"; - else - rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), false, - "The element " + ei.name + " is illegal. Valid types at this point are " + describeTypes(ei.definition.getType())); - } - } else if (ei.definition.getNameReference() != null) { - typeDefn = resolveNameReference(profile.getSnapshot(), ei.definition.getNameReference()); - } - - if (type != null) { - if (type.startsWith("@")) { - ei.definition = findElement(profile, type.substring(1)); - type = null; - } - } - NodeStack localStack = stack.push(ei.element, ei.count, ei.definition, type == null ? typeDefn : resolveType(type)); - String localStackLiterapPath = localStack.getLiteralPath(); - String eiPath = ei.path; - assert(eiPath.equals(localStackLiterapPath)) : "ei.path: " + ei.path + " - localStack.getLiterapPath: " + localStackLiterapPath; - boolean thisIsCodeableConcept = false; - - if (type != null) { - if (isPrimitiveType(type)) - checkPrimitive(errors, ei.path, type, ei.definition, ei.element); - else { - if (type.equals("Identifier")) - checkIdentifier(errors, ei.path, ei.element, ei.definition); - else if (type.equals("Coding")) - checkCoding(errors, ei.path, ei.element, profile, ei.definition, inCodeableConcept); - else if (type.equals("CodeableConcept")) { - checkCodeableConcept(errors, ei.path, ei.element, profile, ei.definition); - thisIsCodeableConcept = true; - } else if (type.equals("Reference")) - checkReference(errors, ei.path, ei.element, profile, ei.definition, actualType, localStack); - - if (type.equals("Extension")) - checkExtension(errors, ei.path, ei.element, ei.definition, profile, localStack); - else if (type.equals("Resource")) - validateContains(errors, ei.path, ei.definition, definition, resource, ei.element, localStack, idStatusForEntry(element, ei)); // if - // (str.matches(".*([.,/])work\\1$")) - else { - StructureDefinition p = getProfileForType(type); - if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown type " + type)) { - validateElement(errors, p, p.getSnapshot().getElement().get(0), profile, ei.definition, resource, ei.element, type, localStack, thisIsCodeableConcept); - } - } - } - } else { - if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), ei.definition != null, "Unrecognised Content " + ei.name)) - validateElement(errors, profile, ei.definition, null, null, resource, ei.element, type, localStack, false); - } - } - } - } - - private IdStatus idStatusForEntry(WrapperElement ep, ElementInfo ei) { - if (isBundleEntry(ei.path)) { - WrapperElement req = ep.getNamedChild("request"); - WrapperElement resp = ep.getNamedChild("response"); - WrapperElement fullUrl = ep.getNamedChild("fullUrl"); - WrapperElement method = null; - WrapperElement url = null; - if (req != null) { - method = req.getNamedChild("method"); - url = req.getNamedChild("url"); - } - if (resp != null) { - return IdStatus.OPTIONAL; - } if (method == null) { - if (fullUrl == null) - return IdStatus.REQUIRED; - else if (fullUrl.getAttribute("value").startsWith("urn:uuid:")) - return IdStatus.OPTIONAL; - else - return IdStatus.REQUIRED; - } else { - String s = method.getAttribute("value"); - if (s.equals("PUT")) { - if (url == null) - return IdStatus.REQUIRED; - else - return IdStatus.OPTIONAL; // or maybe prohibited? not clear - } else if (s.equals("POST")) - return IdStatus.OPTIONAL; // this should be prohibited, but see task 9102 - else // actually, we should never get to here; a bundle entry with method get/delete should not have a resource - return IdStatus.OPTIONAL; - } - } else if (isParametersEntry(ei.path)) - return IdStatus.OPTIONAL; - else - return this.getResourceIdRule(); - } - - private void checkInvariants(List<ValidationMessage> errors, String path, StructureDefinition profile, ElementDefinition ed, String typename, String typeProfile, WrapperElement resource, WrapperElement element) throws FHIRException { - for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { - if (inv.hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression")) { - ResourceOnWrapper res = new ResourceOnWrapper(context, resource, resource.getProfile()); - BaseOnWrapper e = new BaseOnWrapper(context, element, profile, ed, typename, typeProfile); - String expr = inv.getExtensionString("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression"); - FHIRPathEngine fpe = new FHIRPathEngine(context); - boolean ok = true; - try { - ok = fpe.evaluateToBoolean(res, e, expr); - } catch (PathEngineException e1) { - rule(errors, IssueType.INVARIANT, element.line(), element.col(), path, false, e1.getMessage()+": "+inv.getHuman()+fpe.forLog()); - } - if (!ok) { - if (inv.getSeverity() == ConstraintSeverity.ERROR) - rule(errors, IssueType.INVARIANT, element.line(), element.col(), path, ok, inv.getHuman()+fpe.forLog()); - else if (inv.getSeverity() == ConstraintSeverity.WARNING) - warning(errors, IssueType.INVARIANT, element.line(), element.line(), path, ok, inv.getHuman()+fpe.forLog()); - } - } - } - } - - private void validateMessage(List<ValidationMessage> errors, WrapperElement bundle) { - // TODO Auto-generated method stub - - } - - private void validateObservation(List<ValidationMessage> errors, WrapperElement element, NodeStack stack) { - // all observations should have a subject, a performer, and a time - - bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("subject") != null, "All observations should have a subject"); - bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("performer") != null, "All observations should have a performer"); - bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null, - "All observations should have an effectiveDateTime or an effectivePeriod"); - } - - /* - * The actual base entry point - */ - private void validateResource(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, StructureDefinition profile, IdStatus idstatus, NodeStack stack) throws FHIRException { - if (stack == null) - stack = new NodeStack(element.isXml()); - if (resource == null) - resource = element; - - // getting going - either we got a profile, or not. - boolean ok = true; - if (element.isXml()) { - ok = rule(errors, IssueType.INVALID, element.line(), element.col(), "/", element.getNamespace().equals(FormatUtilities.FHIR_NS), - "Namespace mismatch - expected '" + FormatUtilities.FHIR_NS + "', found '" + element.getNamespace() + "'"); - } - if (ok) { - String resourceName = element.getResourceType(); - if (profile == null) { - profile = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); - ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), profile != null, "No profile found for resource type '" + resourceName + "'"); - } else { - String type = profile.hasConstrainedType() ? profile.getConstrainedType() : profile.getName(); - // special case: we have a bundle, and the profile is not for a bundle. We'll try the first entry instead - if (!type.equals(resourceName) && resourceName.equals("Bundle")) { - WrapperElement first = getFirstEntry(element); - if (first != null && first.getResourceType().equals(type)) { - element = first; - resourceName = element.getResourceType(); - idstatus = IdStatus.OPTIONAL; // why? - } - } - ok = rule(errors, IssueType.INVALID, -1, -1, stack.addToLiteralPath(resourceName), type.equals(resourceName), - "Specified profile type was '" + profile.getConstrainedType() + "', but resource type was '" + resourceName + "'"); - } - } - - if (ok) { - stack = stack.push(element, -1, profile.getSnapshot().getElement().get(0), profile.getSnapshot().getElement().get(0)); - if (idstatus == IdStatus.REQUIRED && (element.getNamedChild("id") == null)) - rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource requires an id, but none is present"); - else if (idstatus == IdStatus.PROHIBITED && (element.getNamedChild("id") != null)) - rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource has an id, but none is allowed"); - start(errors, resource, element, profile, stack); // root is both definition and type - } - } - - private WrapperElement getFirstEntry(WrapperElement bundle) { - List<WrapperElement> list = new ArrayList<WrapperElement>(); - bundle.getNamedChildren("entry", list); - if (list.isEmpty()) - return null; - WrapperElement resource = list.get(0).getNamedChild("resource"); - if (resource == null) - return null; - else - return resource.getFirstChild(); - } - - private void validateSections(List<ValidationMessage> errors, List<WrapperElement> entries, WrapperElement focus, NodeStack stack, String fullUrl, String id) { - List<WrapperElement> sections = new ArrayList<WrapperElement>(); - focus.getNamedChildren("entry", sections); - int i = 0; - for (WrapperElement section : sections) { - NodeStack localStack = stack.push(section, 1, null, null); - validateBundleReference(errors, entries, section.getNamedChild("content"), "Section Content", localStack, fullUrl, "Composition", id); - validateSections(errors, entries, section, localStack, fullUrl, id); - i++; - } - } - - private boolean valueMatchesCriteria(Element value, ElementDefinition criteria) { - // throw new Error("validation of slices not done yet"); - return false; - } - - private boolean yearIsValid(String v) { - if (v == null) { - return false; - } - try { - int i = Integer.parseInt(v.substring(0, Math.min(4, v.length()))); - return i >= 1800 && i <= 2100; - } catch (NumberFormatException e) { - return false; - } - } - - public class ChildIterator { - private String basePath; - private WrapperElement child; - private int lastCount; - private WrapperElement parent; - - public ChildIterator(String path, WrapperElement element) { - parent = element; - basePath = path; - } - - public int count() { - WrapperElement n = child.getNextSibling(); - if (n != null && n.getName().equals(child.getName())) { - return lastCount + 1; - } else - return -1; - } - - public WrapperElement element() { - return child; - } - - public String name() { - return child.getName(); - } - - public boolean next() { - if (child == null) { - child = parent.getFirstChild(); - lastCount = 0; - } else { - String lastName = child.getName(); - child = child.getNextSibling(); - if (child != null && child.getName().equals(lastName)) - lastCount++; - else - lastCount = 0; - } - return child != null; - } - - public String path() { - WrapperElement n = child.getNextSibling(); - if (parent.isXml()) { - String sfx = ""; - if (n != null && n.getName().equals(child.getName())) { - sfx = "[" + Integer.toString(lastCount + 1) + "]"; - } - if (FormatUtilities.XHTML_NS.equals(child.getNamespace())) - return basePath + "/h:" + name() + sfx; - else - return basePath + "/f:" + name() + sfx; - } else { - String sfx = ""; - if (n != null && n.getName().equals(child.getName())) { - sfx = "/" + Integer.toString(lastCount + 1); - } - return basePath + "/" + name() + sfx; - } - } - } - - public class DOMWrapperElement extends WrapperElement { - - private int col; - private Element element; - private int line; - - public DOMWrapperElement(Element element) { - super(); - this.element = element; - XmlLocationData loc = (XmlLocationData) element.getUserData(XmlLocationData.LOCATION_DATA_KEY); - if (loc != null) { - line = loc.getStartLine(); - col = loc.getStartColumn(); - } else { - line = -1; - col = -1; - } - } - - @Override - public int col() { - return col; - } - - @Override - public String getAttribute(String name) { - return element.getAttribute(name); - } - - @Override - public WrapperElement getFirstChild() { - Element res = XMLUtil.getFirstChild(element); - return res == null ? null : new DOMWrapperElement(res); - } - - @Override - public String getName() { - return element.getLocalName(); - } - - @Override - public WrapperElement getNamedChild(String name) { - Element res = XMLUtil.getNamedChild(element, name); - return res == null ? null : new DOMWrapperElement(res); - } - - @Override - public void getNamedChildren(String name, List<WrapperElement> list) { - List<Element> el = new ArrayList<Element>(); - XMLUtil.getNamedChildren(element, name, el); - for (Element e : el) - list.add(new DOMWrapperElement(e)); - } - - @Override - public void getNamedChildrenWithWildcard(String name, List<WrapperElement> list) { - List<Element> el = new ArrayList<Element>(); - XMLUtil.getNamedChildrenWithWildcard(element, name, el); - for (Element e : el) - list.add(new DOMWrapperElement(e)); - } - - @Override - public String getNamedChildValue(String name) { - return XMLUtil.getNamedChildValue(element, name); - } - - @Override - public String getNamespace() { - return element.getNamespaceURI(); - } - - @Override - public WrapperElement getNextSibling() { - Element res = XMLUtil.getNextSibling(element); - return res == null ? null : new DOMWrapperElement(res); - } - - @Override - public String getResourceType() { - return element.getLocalName(); - } - - @Override - public String getText() { - return element.getTextContent(); - } - - @Override - public boolean hasAttribute(String name) { - return element.hasAttribute(name); - } - - @Override - public boolean hasNamespace(String ns) { - for (int i = 0; i < element.getAttributes().getLength(); i++) { - Node a = element.getAttributes().item(i); - if ((a.getNodeName().equals("xmlns") || a.getNodeName().startsWith("xmlns:")) && a.getNodeValue().equals(ns)) - return true; - } - return false; - } - - @Override - public boolean hasProcessingInstruction() { - Node node = element.getFirstChild(); - while (node != null) { - if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) - return true; - node = node.getNextSibling(); - } - return false; - } - - @Override - public boolean isXml() { - return true; - } - - @Override - public int line() { - return line; - } - } - - public class ElementInfo { - - public int count; - public ElementDefinition definition; - private WrapperElement element; - private String name; - private String path; - - public ElementInfo(String name, WrapperElement element, String path, int count) { - this.name = name; - this.element = element; - this.path = path; - this.count = count; - } - - public int col() { - return element.col(); - } - - public int line() { - return element.line(); - } - - } - - public class JsonWrapperElement extends WrapperElement { - - private JsonElement _element; - private List<JsonWrapperElement> children = new ArrayList<JsonWrapperElement>(); - private JsonElement element; - private int index; - private String name; - private JsonWrapperElement parent; - private String path; - private String resourceType; - - public JsonWrapperElement(JsonElement element) { - super(); - this.name = null; - this.resourceType = ((JsonObject) element).get("resourceType").getAsString(); - this.element = element; - this.path = ""; - createChildren(); - } - - public JsonWrapperElement(String path, String name, JsonElement element, JsonElement _element, JsonWrapperElement parent, int index) { - super(); - this.path = path + "/" + name; - this.name = name; - this.element = element; - if (element instanceof JsonObject && ((JsonObject) element).has("resourceType")) - this.resourceType = ((JsonObject) element).get("resourceType").getAsString(); - this._element = _element; - this.parent = parent; - this.index = index; - createChildren(); - } - - @Override - public int col() { - // TODO Auto-generated method stub - return -1; - } - - private void createChildren() { - // System.out.println(" ..: "+path); - // we're going to make this look like the XML - if (element != null) { - if (element instanceof JsonPrimitive) { - // we may have an element_ too - if (_element != null && _element instanceof JsonObject) - for (Entry<String, JsonElement> t : ((JsonObject) _element).entrySet()) - processChild(t.getKey(), t.getValue()); - } else if (element instanceof JsonObject) { - for (Entry<String, JsonElement> t : ((JsonObject) element).entrySet()) - if (!t.getKey().equals("resourceType")) { - processChild(t.getKey(), t.getValue()); - } - } else if (element instanceof JsonNull) { - // nothing to do - } else - throw new Error("unexpected condition: " + element.getClass().getName()); - } - if (_element != null) { - - } - } - - @Override - public String getAttribute(String name) { - if (name.equals("value")) { - if (element == null) - return null; - if (element instanceof JsonPrimitive) - return ((JsonPrimitive) element).getAsString(); - return null; - } - if (name.equals("xml:id")) { - WrapperElement c = getNamedChild("id"); - return c == null ? null : c.getAttribute("value"); - } - if (name.equals("url")) { - WrapperElement c = getNamedChild("url"); - return c == null ? null : c.getAttribute("value"); - } - throw new Error("not done yet: " + name); - } - - @Override - public WrapperElement getFirstChild() { - if (children.isEmpty()) - return null; - else - return children.get(0); - } - - @Override - public String getName() { - return name; - } - - @Override - public WrapperElement getNamedChild(String name) { - for (JsonWrapperElement j : children) - if (j.name.equals(name)) - return j; - return null; - } - - @Override - public void getNamedChildren(String name, List<WrapperElement> list) { - for (JsonWrapperElement j : children) - if (j.name.equals(name)) - list.add(j); - } - - @Override - public void getNamedChildrenWithWildcard(String name, List<WrapperElement> list) { - for (JsonWrapperElement j : children) { - String n = j.name; - if (n.equals(name) || (name.endsWith("[x]") && n.startsWith(name.substring(0, name.length() - 3)))) - list.add(j); - } - } - - @Override - public String getNamedChildValue(String name) { - WrapperElement c = getNamedChild(name); - return c == null ? null : c.getAttribute("value"); - } - - @Override - public String getNamespace() { - // return element.getNamespaceURI(); - throw new Error("not done yet"); - } - - @Override - public WrapperElement getNextSibling() { - if (parent == null) - return null; - if (index >= parent.children.size() - 1) - return null; - return parent.children.get(index + 1); - } - - @Override - public String getResourceType() { - return resourceType; - } - - @Override - public String getText() { - throw new Error("not done yet"); - } - - @Override - public boolean hasAttribute(String name) { - if (name.equals("value")) { - if (element == null) - return false; - if (element instanceof JsonPrimitive) - return true; - return false; - } - if (name.equals("xml:id")) { - return getNamedChild("id") != null; - } - throw new Error("not done yet: " + name); - } - - @Override - public boolean hasNamespace(String ns) { - throw new Error("not done"); - } - - @Override - public boolean hasProcessingInstruction() { - return false; - } - - @Override - public boolean isXml() { - return false; - } - - @Override - public int line() { - return -1; - } - - private void processChild(String name, JsonElement e) { - if (name.startsWith("_")) { - name = name.substring(1); - if (((JsonObject) element).has(name)) - return; // it will get processed anyway - e = null; - } - JsonElement _e = element instanceof JsonObject ? ((JsonObject) element).get("_" + name) : null; - - if (e instanceof JsonPrimitive || (e == null && _e != null && !(_e instanceof JsonArray))) { - children.add(new JsonWrapperElement(path, name, e, _e, this, children.size())); - } else if (e instanceof JsonArray || (e == null && _e != null)) { - JsonArray array = (JsonArray) e; - JsonArray _array = (JsonArray) _e; - int max = array != null ? array.size() : 0; - if (_array != null && _array.size() > max) - max = _array.size(); - for (int i = 0; i < max; i++) { - JsonElement a = array == null || array.size() < i ? null : array.get(i); - JsonElement _a = _array == null || _array.size() < i ? null : _array.get(i); - children.add(new JsonWrapperElement(path, name, a, _a, this, children.size())); - } - } else if (e instanceof JsonObject) { - children.add(new JsonWrapperElement(path, name, e, null, this, children.size())); - } else - throw new Error("not done yet: " + e.getClass().getName()); - } - - } - - private class NodeStack { - private ElementDefinition definition; - private WrapperElement element; - private ElementDefinition extension; - private String literalPath; // xpath format - private List<String> logicalPaths; // dotted format, various entry points - private NodeStack parent; - private ElementDefinition type; - private boolean xml; - - public NodeStack(boolean xml) { - this.xml = xml; - } - - public String addToLiteralPath(String... path) { - StringBuilder b = new StringBuilder(); - b.append(getLiteralPath()); - if (xml) { - for (String p : path) { - if (p.startsWith(":")) { - b.append("["); - b.append(p.substring(1)); - b.append("]"); - } else { - b.append("/f:"); - b.append(p); - } - } - } else { - for (String p : path) { - b.append("/"); - if (p.startsWith(":")) { - b.append(p.substring(1)); - } else { - b.append(p); - } - } - } - return b.toString(); - } - - private ElementDefinition getDefinition() { - return definition; - } - - private WrapperElement getElement() { - return element; - } - - private String getLiteralPath() { - return literalPath == null ? "" : literalPath; - } - - private List<String> getLogicalPaths() { - return logicalPaths == null ? new ArrayList<String>() : logicalPaths; - } - - private ElementDefinition getType() { - return type; - } - - private NodeStack push(WrapperElement element, int count, ElementDefinition definition, ElementDefinition type) { - NodeStack res = new NodeStack(element.isXml()); - res.parent = this; - res.element = element; - res.definition = definition; - if (element.isXml()) { - res.literalPath = getLiteralPath() + (element.getNamespace().equals(FormatUtilities.XHTML_NS) ? "/h:" : "/f:") + element.getName(); - if (count > -1) - res.literalPath = res.literalPath + "[" + Integer.toString(count) + "]"; - } else { - if (element.getName() == null) - res.literalPath = ""; - else - res.literalPath = getLiteralPath() + "/" + element.getName(); - if (count > -1) - res.literalPath = res.literalPath + "/" + Integer.toString(count); - } - res.logicalPaths = new ArrayList<String>(); - if (type != null) { - // type will be bull if we on a stitching point of a contained resource, or if.... - res.type = type; - String t = tail(definition.getPath()); - for (String lp : getLogicalPaths()) { - res.logicalPaths.add(lp + "." + t); - if (t.endsWith("[x]")) - res.logicalPaths.add(lp + "." + t.substring(0, t.length() - 3) + type.getPath()); - } - res.logicalPaths.add(type.getPath()); - } else if (definition != null) { - for (String lp : getLogicalPaths()) - res.logicalPaths.add(lp + "." + element.getName()); - } else - res.logicalPaths.addAll(getLogicalPaths()); - // CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - // for (String lp : res.logicalPaths) - // b.append(lp); - // System.out.println(res.literalPath+" : "+b.toString()); - return res; - } - - private void setType(ElementDefinition type) { - this.type = type; - } - } - - public abstract class WrapperElement { - private StructureDefinition profile; - private ElementDefinition definition; - - - public StructureDefinition getProfile() { - return profile; - } - - public void setProfile(StructureDefinition profile) { - this.profile = profile; - } - - public ElementDefinition getDefinition() { - return definition; - } - - public void setDefinition(ElementDefinition definition) { - this.definition = definition; - } - - public abstract int col(); - - public abstract String getAttribute(String name); - - public abstract WrapperElement getFirstChild(); - - public abstract String getName(); - - public abstract WrapperElement getNamedChild(String name); - - public abstract void getNamedChildren(String name, List<WrapperElement> list); - - public abstract void getNamedChildrenWithWildcard(String name, List<WrapperElement> list); - - public abstract String getNamedChildValue(String name); - - public abstract String getNamespace(); - - public abstract WrapperElement getNextSibling(); - - public abstract String getResourceType(); - - public abstract String getText(); - - public abstract boolean hasAttribute(String name); - - public abstract boolean hasNamespace(String string); - - public abstract boolean hasProcessingInstruction(); - - public abstract boolean isXml(); - - public abstract int line(); - } - -} +package org.hl7.fhir.instance.validation; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; + +import org.hl7.fhir.exceptions.*; +import org.hl7.fhir.instance.formats.FormatUtilities; +import org.hl7.fhir.instance.model.*; +import org.hl7.fhir.instance.model.ElementDefinition.*; +import org.hl7.fhir.instance.model.Enumerations.BindingStrength; +import org.hl7.fhir.instance.model.StructureDefinition.*; +import org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent; +import org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent; +import org.hl7.fhir.instance.utils.IWorkerContext.ValidationResult; +//import org.hl7.fhir.instance.utils.ProfileUtilities; +import org.hl7.fhir.instance.utils.*; +import org.hl7.fhir.instance.utils.IResourceValidator.BestPracticeWarningLevel; +import org.hl7.fhir.instance.utils.IResourceValidator.CheckDisplayOption; +import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.utilities.validation.ValidationMessage.*; +import org.hl7.fhir.utilities.xml.XMLUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import com.google.gson.*; + + +/* + * todo: + * check urn's don't start oid: or uuid: + */ +public class InstanceValidator extends BaseValidator implements IResourceValidator { + + private class ElementDefinitionOutcome { + public ElementDefinitionOutcome(ElementDefinition ed) { + definition = ed; + } + public ElementDefinitionOutcome(ElementDefinition ed, TypeRefComponent tr) { + definition = ed; + typename = tr.getCode(); + if (tr.hasProfile()) + profile = tr.getProfile().get(0).getValue(); + } + private ElementDefinition definition; + private String typename; + private String profile; + } + + public class ResourceOnWrapper extends Resource { + private static final long serialVersionUID = 1L; + private IWorkerContext services; + private WrapperElement wrapper; + private List<ElementDefinition> elementList; + private StructureDefinition profile; + private ElementDefinition definition; + private List<ElementDefinition> childDefinitions; + + public ResourceOnWrapper(IWorkerContext services, WrapperElement wrapper, StructureDefinition profile) { + super(); + this.services = services; + this.wrapper = wrapper; + this.profile = profile; + this.definition = profile.getSnapshot().getElement().get(0); + } + + private ElementDefinitionOutcome getDefinition(String name) throws DefinitionException { + if (childDefinitions == null) + childDefinitions = ProfileUtilities.getChildMap(profile, definition.getName(), definition.getPath(), definition.getNameReference()); + for (ElementDefinition ed : childDefinitions) { + String tail = ed.getPath().substring(ed.getPath().lastIndexOf('.')+1); + if (tail.equals(name)) { + return new ElementDefinitionOutcome(ed); + } + if (tail.endsWith("[x]") && tail.substring(0, tail.length()-3).equals(name.substring(0, tail.length()-3))) { + TypeRefComponent tr = getType(ed, name.substring(tail.length()-3)); + if (tr != null) + return new ElementDefinitionOutcome(ed, tr); + } + } + return null; + } + + private TypeRefComponent getType(ElementDefinition ed, String type) { + for (TypeRefComponent t : ed.getType()) { + if (t.getCode().equals(type)) + return t; + } + return null; + } + + @Override + public List<Base> listChildrenByName(String child_name) { + List<Base> list = new ArrayList<Base>(); + List<WrapperElement> children = new ArrayList<WrapperElement>(); + wrapper.getNamedChildren(child_name, children); + for (WrapperElement child : children) { + ElementDefinitionOutcome definition; + try { + definition = getDefinition(child.getName()); + } catch (Exception e) { + definition = null; + } + if (definition != null) { + TypeRefComponent tr = getType(definition.definition, "Resource"); + if (tr != null && wrapper.isXml()) // special case for DomainResource.contained and Bundle.entry + list.add(new BaseOnWrapper(services, child.getFirstChild(), profile, definition.definition, definition.typename, definition.profile)); + else + list.add(new BaseOnWrapper(services, child, profile, definition.definition, definition.typename, definition.profile)); + } + } + return list; + } + + @Override + public String fhirType() { + return wrapper.getResourceType(); + } + + @Override + public Resource copy() { + throw new Error("copy() is not implemented here"); + } + + + @Override + public ResourceType getResourceType() { + try { + return ResourceType.fromCode(fhirType()); + } catch (Exception e) { + return null; + } + } + + @Override + protected boolean isMetadataBased() { + return true; + } + + @Override + public String toString() { + return fhirType(); + } + } + + public class BaseOnWrapper extends Base { + private static final long serialVersionUID = 1L; + private IWorkerContext services; + private WrapperElement wrapper; + private List<ElementDefinition> elementList; + private StructureDefinition profile; + private ElementDefinition definition; + private List<ElementDefinition> childDefinitions; + private String typeName; + private String typeProfile; + + + public BaseOnWrapper(IWorkerContext services, WrapperElement wrapper, StructureDefinition profile, + ElementDefinition definition, String typeName, String typeProfile) { + super(); + this.services = services; + this.wrapper = wrapper; + this.profile = profile; + this.definition = definition; + this.typeName = typeName; + this.typeProfile = typeProfile; + } + + private ElementDefinitionOutcome getDefinition(String name) throws DefinitionException { + if (childDefinitions == null) + childDefinitions = ProfileUtilities.getChildMap(profile, definition.getName(), definition.getPath(), definition.getNameReference()); + + if (childDefinitions.size() == 0) { + String pn = typeProfile; + if (Utilities.noString(pn) && !Utilities.noString(typeName)) + pn = "http://hl7.org/fhir/StructureDefinition/"+typeName; + if (Utilities.noString(pn) && definition.getType().size() == 1) { + if (definition.getType().get(0).getProfile().size() > 0) + pn = definition.getType().get(0).getProfile().get(0).getValue(); + else + pn = "http://hl7.org/fhir/StructureDefinition/"+ definition.getType().get(0).getCode(); + } + if (!Utilities.noString(pn)) { + StructureDefinition profile = services.fetchResource(StructureDefinition.class, pn); + if (profile != null) { + this.profile = profile; + childDefinitions = ProfileUtilities.getChildMap(profile, null, profile.getSnapshot().getElement().get(0).getPath(), null); + } + } + } + + + for (ElementDefinition ed : childDefinitions) { + String tail = ed.getPath().substring(ed.getPath().lastIndexOf('.')+1); + if (tail.equals(name)) { + return new ElementDefinitionOutcome(ed); + } + if (tail.endsWith("[x]") && name.length() > tail.length()-1 && tail.substring(0, tail.length()-3).equals(name.substring(0, tail.length()-3))) { + TypeRefComponent tr = getType(ed, name.substring(tail.length()-3)); + if (tr != null) + return new ElementDefinitionOutcome(ed, tr); + } + } + return null; + } + + private TypeRefComponent getType(ElementDefinition ed, String type) { + for (TypeRefComponent t : ed.getType()) { + if (t.getCode().equalsIgnoreCase(type)) + return t; + } + return null; + } + + @Override + public List<Base> listChildrenByName(String child_name) { + List<Base> list = new ArrayList<Base>(); + List<WrapperElement> children = new ArrayList<WrapperElement>(); + wrapper.getNamedChildrenWithWildcard(child_name, children); + for (WrapperElement child : children) { + ElementDefinitionOutcome definition; + try { + definition = getDefinition(child.getName()); + } catch (Exception e) { + definition = null; + } + if (definition != null) { + TypeRefComponent tr = getType(definition.definition, "Resource"); + if (tr != null && wrapper.isXml()) // special case for DomainResource.contained and Bundle.entry + list.add(new BaseOnWrapper(services, child.getFirstChild(), profile, definition.definition, definition.typename, definition.profile)); + else + list.add(new BaseOnWrapper(services, child, profile, definition.definition, definition.typename, definition.profile)); + } + } + return list; + } + + public boolean isPrimitive() { + String t = fhirType(); + return t.equalsIgnoreCase("boolean") || t.equalsIgnoreCase("integer") || t.equalsIgnoreCase("string") || t.equalsIgnoreCase("decimal") || t.equalsIgnoreCase("uri") || t.equalsIgnoreCase("base64Binary") || + t.equalsIgnoreCase("instant") || t.equalsIgnoreCase("date") || t.equalsIgnoreCase("uuid") || t.equalsIgnoreCase("id") || t.equalsIgnoreCase("xhtml") || t.equalsIgnoreCase("markdown") || + t.equalsIgnoreCase("dateTime") || t.equalsIgnoreCase("time") || t.equalsIgnoreCase("code") || t.equalsIgnoreCase("oid") || t.equalsIgnoreCase("id"); + } + + public String primitiveValue() { + return wrapper.getAttribute("value"); + } + + @Override + public String fhirType() { + if (!Utilities.noString(typeName)) + return typeName; + else + return definition.getType().get(0).getCode(); + } + + @Override + protected void listChildren(List<Property> result) { + throw new Error("not done yet"); + } + + @Override + protected boolean isMetadataBased() { + return true; + } + + public boolean equalsDeep(Base other) { + if (!super.equalsDeep(other) || !fhirType().equals(other.fhirType())) + return false; + + // make sure we have child definitions + try { + getDefinition("xxxx"); + List<ElementDefinition> childList = childDefinitions; + // there's a problem here - we're going to iterate by the definition, where as equality should - probably - be + // based on the underlying definitions. is it worth getting them? it's kind of complicated.... + for (ElementDefinition ed : childList) { + String tail = tail(ed.getPath()); + List<Base> thisList = listChildrenByName(tail); + List<Base> otherList = other.listChildrenByName(tail); + if (!compareDeep(thisList, otherList, false)) + return false; + } + return true; + } catch (Exception e) { + return false;// because we can't decide + } + } + + @Override + public String toString() { + if (isPrimitive()) + return primitiveValue(); + else + return fhirType(); + } + } + + private boolean anyExtensionsAllowed; + + private BestPracticeWarningLevel bpWarnings; + // configuration items + private CheckDisplayOption checkDisplay; + private IWorkerContext context; + + private List<String> extensionDomains = new ArrayList<String>(); + + private IdStatus resourceIdRule; + + // used during the build process to keep the overall volume of messages down + private boolean suppressLoincSnomedMessages; + + public InstanceValidator(IWorkerContext theContext) { + super(); + this.context = theContext; + source = Source.InstanceValidator; + } + + private boolean allowUnknownExtension(String url) { + if (url.contains("example.org") || url.contains("acme.com") || url.contains("nema.org")) + return true; + for (String s : extensionDomains) + if (url.startsWith(s)) + return true; + return anyExtensionsAllowed; + } + + private void bpCheck(List<ValidationMessage> errors, IssueType invalid, int line, int col, String literalPath, boolean test, String message) { + if (bpWarnings != null) { + switch (bpWarnings) { + case Error: + rule(errors, invalid, line, col, literalPath, test, message); + break; + case Warning: + warning(errors, invalid, line, col, literalPath, test, message); + break; + case Hint: + hint(errors, invalid, line, col, literalPath, test, message); + break; + default: // do nothing + } + } + } + + private boolean check(String v1, String v2) { + return v1 == null ? Utilities.noString(v1) : v1.equals(v2); + } + + private void checkAddress(List<ValidationMessage> errors, String path, WrapperElement focus, Address fixed) { + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); + checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text"); + checkFixedValue(errors, path + ".city", focus.getNamedChild("city"), fixed.getCityElement(), "city"); + checkFixedValue(errors, path + ".state", focus.getNamedChild("state"), fixed.getStateElement(), "state"); + checkFixedValue(errors, path + ".country", focus.getNamedChild("country"), fixed.getCountryElement(), "country"); + checkFixedValue(errors, path + ".zip", focus.getNamedChild("zip"), fixed.getPostalCodeElement(), "postalCode"); + + List<WrapperElement> lines = new ArrayList<WrapperElement>(); + focus.getNamedChildren("line", lines); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, lines.size() == fixed.getLine().size(), + "Expected " + Integer.toString(fixed.getLine().size()) + " but found " + Integer.toString(lines.size()) + " line elements")) { + for (int i = 0; i < lines.size(); i++) + checkFixedValue(errors, path + ".coding", lines.get(i), fixed.getLine().get(i), "coding"); + } + } + + private void checkAttachment(List<ValidationMessage> errors, String path, WrapperElement focus, Attachment fixed) { + checkFixedValue(errors, path + ".contentType", focus.getNamedChild("contentType"), fixed.getContentTypeElement(), "contentType"); + checkFixedValue(errors, path + ".language", focus.getNamedChild("language"), fixed.getLanguageElement(), "language"); + checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data"); + checkFixedValue(errors, path + ".url", focus.getNamedChild("url"), fixed.getUrlElement(), "url"); + checkFixedValue(errors, path + ".size", focus.getNamedChild("size"), fixed.getSizeElement(), "size"); + checkFixedValue(errors, path + ".hash", focus.getNamedChild("hash"), fixed.getHashElement(), "hash"); + checkFixedValue(errors, path + ".title", focus.getNamedChild("title"), fixed.getTitleElement(), "title"); + } + + // public API + + private boolean checkCode(List<ValidationMessage> errors, WrapperElement element, String path, String code, String system, String display) { + if (context.supportsSystem(system)) { + ValidationResult s = context.validateCode(system, code, display); + if (s == null || s.isOk()) + return true; + if (s.getSeverity() == IssueSeverity.INFORMATION) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + else if (s.getSeverity() == IssueSeverity.WARNING) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + else + return rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + return true; + } else if (system.startsWith("http://hl7.org/fhir")) { + if (system.equals("http://hl7.org/fhir/sid/icd-10")) + return true; // else don't check ICD-10 (for now) + else { + ValueSet vs = getValueSet(system); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, "Unknown Code System " + system)) { + ConceptDefinitionComponent def = getCodeDefinition(vs, code); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, def != null, "Unknown Code (" + system + "#" + code + ")")) + return warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, display == null || display.equals(def.getDisplay()), "Display should be '" + def.getDisplay() + "'"); + } + return false; + } + } else if (system.startsWith("http://loinc.org")) { + return true; + } else if (system.startsWith("http://unitsofmeasure.org")) { + return true; + } else + return true; + } + + private void checkCodeableConcept(List<ValidationMessage> errors, String path, WrapperElement focus, CodeableConcept fixed) { + checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text"); + List<WrapperElement> codings = new ArrayList<WrapperElement>(); + focus.getNamedChildren("coding", codings); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, codings.size() == fixed.getCoding().size(), + "Expected " + Integer.toString(fixed.getCoding().size()) + " but found " + Integer.toString(codings.size()) + " coding elements")) { + for (int i = 0; i < codings.size(); i++) + checkFixedValue(errors, path + ".coding", codings.get(i), fixed.getCoding().get(i), "coding"); + } + } + + private void checkCodeableConcept(List<ValidationMessage> errors, String path, WrapperElement element, StructureDefinition profile, ElementDefinition theElementCntext) { + if (theElementCntext != null && theElementCntext.hasBinding()) { + ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing (cc)")) { + if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { + ValueSet valueset = resolveBindingReference(binding.getValueSet()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { + try { + CodeableConcept cc = readAsCodeableConcept(element); + if (!cc.hasCoding()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code is required from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code should be provided from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); + } else { + ValidationResult vr = context.validateCode(cc, valueset); + if (!vr.isOk()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()+", and a code from this value set is required"); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"); + else if (binding.getStrength() == BindingStrength.PREFERRED) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"); + } + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept"); + } + } + } else if (binding.hasValueSet()) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); + } else { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); + } + } + } + } + + private CodeableConcept readAsCodeableConcept(WrapperElement element) { + CodeableConcept cc = new CodeableConcept(); + List<WrapperElement> list = new ArrayList<WrapperElement>(); + element.getNamedChildren("coding", list); + for (WrapperElement item : list) + cc.addCoding(readAsCoding(item)); + cc.setText(element.getNamedChildValue("text")); + return cc; + } + + private Coding readAsCoding(WrapperElement item) { + Coding c = new Coding(); + c.setSystem(item.getNamedChildValue("system")); + c.setVersion(item.getNamedChildValue("version")); + c.setCode(item.getNamedChildValue("code")); + c.setDisplay(item.getNamedChildValue("display")); + return c; + } + + private void checkCoding(List<ValidationMessage> errors, String path, WrapperElement focus, Coding fixed) { + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); + checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code"); + checkFixedValue(errors, path + ".display", focus.getNamedChild("display"), fixed.getDisplayElement(), "display"); + checkFixedValue(errors, path + ".userSelected", focus.getNamedChild("userSelected"), fixed.getUserSelectedElement(), "userSelected"); + } + + private void checkCoding(List<ValidationMessage> errors, String path, WrapperElement element, StructureDefinition profile, ElementDefinition theElementCntext, boolean inCodeableConcept) { + String code = element.getNamedChildValue("code"); + String system = element.getNamedChildValue("system"); + String display = element.getNamedChildValue("display"); + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Coding.system must be an absolute reference, not a local reference"); + + if (system != null && code != null) { + if (checkCode(errors, element, path, code, system, display)) + if (theElementCntext != null && theElementCntext.getBinding() != null) { + ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing")) { + if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { + ValueSet valueset = resolveBindingReference(binding.getValueSet()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { + try { + Coding c = readAsCoding(element); + ValidationResult vr = context.validateCode(c, valueset); + if (!vr.isOk()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is required from this value set)"); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"); + else if (binding.getStrength() == BindingStrength.PREFERRED) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept"); + } + } + } else if (binding.hasValueSet()) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); + } else if (!inCodeableConcept) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); + } + } + } + } + } + + private void checkContactPoint(List<ValidationMessage> errors, String path, WrapperElement focus, ContactPoint fixed) { + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); + checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value"); + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period"); + + } + + private void checkDeclaredProfiles(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, NodeStack stack) throws FHIRException { + WrapperElement meta = element.getNamedChild("meta"); + if (meta != null) { + List<WrapperElement> profiles = new ArrayList<InstanceValidator.WrapperElement>(); + meta.getNamedChildren("profile", profiles); + int i = 0; + for (WrapperElement profile : profiles) { + String ref = profile.getAttribute("value"); + String p = stack.addToLiteralPath("meta", "profile", ":" + Integer.toString(i)); + if (rule(errors, IssueType.INVALID, element.line(), element.col(), p, !Utilities.noString(ref), "StructureDefinition reference invalid")) { + StructureDefinition pr = context.fetchResource(StructureDefinition.class, ref); + if (warning(errors, IssueType.INVALID, element.line(), element.col(), p, pr != null, "StructureDefinition reference \"{0}\" could not be resolved", ref)) { + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), p, pr.hasSnapshot(), + "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) { + validateElement(errors, pr, pr.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); + } + } + i++; + } + } + } + } + + private StructureDefinition checkExtension(List<ValidationMessage> errors, String path, WrapperElement element, ElementDefinition def, StructureDefinition profile, NodeStack stack) + { + String url = element.getAttribute("url"); + boolean isModifier = element.getName().equals("modifierExtension"); + + StructureDefinition ex = context.fetchResource(StructureDefinition.class, url); + if (ex == null) { + if (!rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowUnknownExtension(url), "The extension " + url + " is unknown, and not allowed here")) + warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowUnknownExtension(url), "Unknown extension " + url); + } else { + if (def.getIsModifier()) + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), + "Extension modifier mismatch: the extension element is labelled as a modifier, but the underlying extension is not"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), + "Extension modifier mismatch: the extension element is not labelled as a modifier, but the underlying extension is"); + + // two questions + // 1. can this extension be used here? + checkExtensionContext(errors, element, /* path+"[url='"+url+"']", */ ex, stack, ex.getUrl()); + + if (isModifier) + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), + "The Extension '" + url + "' must be used as a modifierExtension"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), + "The Extension '" + url + "' must not be used as an extension (it's a modifierExtension)"); + + // 2. is the content of the extension valid? + + } + return ex; + } + + private boolean checkExtensionContext(List<ValidationMessage> errors, WrapperElement element, StructureDefinition definition, NodeStack stack, String extensionParent) { + String extUrl = definition.getUrl(); + CommaSeparatedStringBuilder p = new CommaSeparatedStringBuilder(); + for (String lp : stack.getLogicalPaths()) + p.append(lp); + if (definition.getContextType() == ExtensionContext.DATATYPE) { + boolean ok = false; + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (StringType ct : definition.getContext()) { + b.append(ct.getValue()); + if (ct.getValue().equals("*") || stack.getLogicalPaths().contains(ct.getValue() + ".extension")) + ok = true; + } + return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, + "The extension " + extUrl + " is not allowed to be used on the logical path set [" + p.toString() + "] (allowed: datatype=" + b.toString() + ")"); + } else if (definition.getContextType() == ExtensionContext.EXTENSION) { + boolean ok = false; + for (StringType ct : definition.getContext()) + if (ct.getValue().equals("*") || ct.getValue().equals(extensionParent)) + ok = true; + return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, + "The extension " + extUrl + " is not allowed to be used with the extension '" + extensionParent + "'"); + } else if (definition.getContextType() == ExtensionContext.MAPPING) { + throw new Error("Not handled yet (extensionContext)"); + } else if (definition.getContextType() == ExtensionContext.RESOURCE) { + boolean ok = false; + // String simplePath = container.getPath(); + // System.out.println(simplePath); + // if (effetive.endsWith(".extension") || simplePath.endsWith(".modifierExtension")) + // simplePath = simplePath.substring(0, simplePath.lastIndexOf('.')); + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (StringType ct : definition.getContext()) { + String c = ct.getValue(); + b.append(c); + if (c.equals("*") || stack.getLogicalPaths().contains(c + ".extension") || (c.startsWith("@") && stack.getLogicalPaths().contains(c.substring(1) + ".extension"))) + ; + ok = true; + } + return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, + "The extension " + extUrl + " is not allowed to be used on the logical path set " + p.toString() + " (allowed: resource=" + b.toString() + ")"); + } else + throw new Error("Unknown context type"); + } + // + // private String simplifyPath(String path) { + // String s = path.replace("/f:", "."); + // while (s.contains("[")) + // s = s.substring(0, s.indexOf("["))+s.substring(s.indexOf("]")+1); + // String[] parts = s.split("\\."); + // int i = 0; + // while (i < parts.length && !context.getProfiles().containsKey(parts[i].toLowerCase())) + // i++; + // if (i >= parts.length) + // throw new Error("Unable to process part "+path); + // int j = parts.length - 1; + // while (j > 0 && (parts[j].equals("extension") || parts[j].equals("modifierExtension"))) + // j--; + // StringBuilder b = new StringBuilder(); + // boolean first = true; + // for (int k = i; k <= j; k++) { + // if (k == j || !parts[k].equals(parts[k+1])) { + // if (first) + // first = false; + // else + // b.append("."); + // b.append(parts[k]); + // } + // } + // return b.toString(); + // } + // + + private void checkFixedValue(List<ValidationMessage> errors, String path, WrapperElement focus, org.hl7.fhir.instance.model.Element fixed, String propName) { + if (fixed == null && focus == null) + ; // this is all good + else if (fixed == null && focus != null) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, false, "Unexpected element " + focus.getName()); + else if (fixed != null && focus == null) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, false, "Mising element " + propName); + else { + String value = focus.getAttribute("value"); + if (fixed instanceof org.hl7.fhir.instance.model.BooleanType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.BooleanType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.BooleanType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.IntegerType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.IntegerType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.IntegerType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.DecimalType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.DecimalType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.DecimalType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.Base64BinaryType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.Base64BinaryType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.Base64BinaryType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.InstantType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.InstantType) fixed).getValue().toString(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.InstantType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.StringType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.StringType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.StringType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.UriType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.UriType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.UriType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.DateType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.DateType) fixed).getValue().toString(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.DateType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.DateTimeType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.DateTimeType) fixed).getValue().toString(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.DateTimeType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.OidType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.OidType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.OidType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.UuidType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.UuidType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.UuidType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.CodeType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.CodeType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.CodeType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.instance.model.IdType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.instance.model.IdType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.instance.model.IdType) fixed).getValue() + "'"); + else if (fixed instanceof Quantity) + checkQuantity(errors, path, focus, (Quantity) fixed); + else if (fixed instanceof Address) + checkAddress(errors, path, focus, (Address) fixed); + else if (fixed instanceof ContactPoint) + checkContactPoint(errors, path, focus, (ContactPoint) fixed); + else if (fixed instanceof Attachment) + checkAttachment(errors, path, focus, (Attachment) fixed); + else if (fixed instanceof Identifier) + checkIdentifier(errors, path, focus, (Identifier) fixed); + else if (fixed instanceof Coding) + checkCoding(errors, path, focus, (Coding) fixed); + else if (fixed instanceof HumanName) + checkHumanName(errors, path, focus, (HumanName) fixed); + else if (fixed instanceof CodeableConcept) + checkCodeableConcept(errors, path, focus, (CodeableConcept) fixed); + else if (fixed instanceof Timing) + checkTiming(errors, path, focus, (Timing) fixed); + else if (fixed instanceof Period) + checkPeriod(errors, path, focus, (Period) fixed); + else if (fixed instanceof Range) + checkRange(errors, path, focus, (Range) fixed); + else if (fixed instanceof Ratio) + checkRatio(errors, path, focus, (Ratio) fixed); + else if (fixed instanceof SampledData) + checkSampledData(errors, path, focus, (SampledData) fixed); + + else + rule(errors, IssueType.EXCEPTION, focus.line(), focus.col(), path, false, "Unhandled fixed value type " + fixed.getClass().getName()); + List<WrapperElement> extensions = new ArrayList<WrapperElement>(); + focus.getNamedChildren("extension", extensions); + if (fixed.getExtension().size() == 0) { + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == 0, "No extensions allowed"); + } else if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == fixed.getExtension().size(), + "Extensions count mismatch: expected " + Integer.toString(fixed.getExtension().size()) + " but found " + Integer.toString(extensions.size()))) { + for (Extension e : fixed.getExtension()) { + WrapperElement ex = getExtensionByUrl(extensions, e.getUrl()); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, ex != null, "Extension count mismatch: unable to find extension: " + e.getUrl())) { + checkFixedValue(errors, path, ex.getFirstChild().getNextSibling(), e.getValue(), "extension.value"); + } + } + } + } + } + + private void checkForProcessingInstruction(List<ValidationMessage> errors, Document document) { + Node node = document.getFirstChild(); + while (node != null) { + rule(errors, IssueType.INVALID, -1, -1, "(document)", node.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE, "No processing instructions allowed in resources"); + node = node.getNextSibling(); + } + } + + private void checkHumanName(List<ValidationMessage> errors, String path, WrapperElement focus, HumanName fixed) { + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); + checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text"); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period"); + + List<WrapperElement> parts = new ArrayList<WrapperElement>(); + focus.getNamedChildren("family", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getFamily().size(), + "Expected " + Integer.toString(fixed.getFamily().size()) + " but found " + Integer.toString(parts.size()) + " family elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".family", parts.get(i), fixed.getFamily().get(i), "family"); + } + focus.getNamedChildren("given", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getGiven().size(), + "Expected " + Integer.toString(fixed.getGiven().size()) + " but found " + Integer.toString(parts.size()) + " given elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".given", parts.get(i), fixed.getGiven().get(i), "given"); + } + focus.getNamedChildren("prefix", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getPrefix().size(), + "Expected " + Integer.toString(fixed.getPrefix().size()) + " but found " + Integer.toString(parts.size()) + " prefix elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".prefix", parts.get(i), fixed.getPrefix().get(i), "prefix"); + } + focus.getNamedChildren("suffix", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getSuffix().size(), + "Expected " + Integer.toString(fixed.getSuffix().size()) + " but found " + Integer.toString(parts.size()) + " suffix elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".suffix", parts.get(i), fixed.getSuffix().get(i), "suffix"); + } + } + + private void checkIdentifier(List<ValidationMessage> errors, String path, WrapperElement element, ElementDefinition context) { + String system = element.getNamedChildValue("system"); + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Identifier.system must be an absolute reference, not a local reference"); + } + + private void checkIdentifier(List<ValidationMessage> errors, String path, WrapperElement focus, Identifier fixed) { + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use"); + checkFixedValue(errors, path + ".type", focus.getNamedChild("type"), fixed.getType(), "type"); + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); + checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value"); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period"); + checkFixedValue(errors, path + ".assigner", focus.getNamedChild("assigner"), fixed.getAssigner(), "assigner"); + } + + private void checkPeriod(List<ValidationMessage> errors, String path, WrapperElement focus, Period fixed) { + checkFixedValue(errors, path + ".start", focus.getNamedChild("start"), fixed.getStartElement(), "start"); + checkFixedValue(errors, path + ".end", focus.getNamedChild("end"), fixed.getEndElement(), "end"); + } + + private void checkPrimitive(List<ValidationMessage> errors, String path, String type, ElementDefinition context, WrapperElement e) { + if (type.equals("uri")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.getAttribute("value").startsWith("oid:"), "URI values cannot start with oid:"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.getAttribute("value").startsWith("uuid:"), "URI values cannot start with uuid:"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.getAttribute("value").equals(e.getAttribute("value").trim()), "URI values cannot have leading or trailing whitespace"); + } + if (!type.equalsIgnoreCase("string") && e.hasAttribute("value")) { + if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.getAttribute("value").length() > 0, "@value cannot be empty")) { + warning(errors, IssueType.INVALID, e.line(), e.col(), path, e.getAttribute("value").trim().equals(e.getAttribute("value")), "value should not start or finish with whitespace"); + } + } + if (type.equals("dateTime")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.getAttribute("value")), "The value '" + e.getAttribute("value") + "' does not have a valid year"); + boolean ok = e.getAttribute("value").matches("-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[0-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?)?)?"); + if (!ok) + rule(errors, IssueType.INVALID, e.line(), e.col(), path,ok, "'"+e.getAttribute("value")+"' is not a valid date time"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !hasTime(e.getAttribute("value")) || hasTimeZone(e.getAttribute("value")), "if a date has a time, it must have a timezone"); + + } + if (type.equals("instant")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, + e.getAttribute("value").matches("-?[0-9]{4}-(0[1-9]|1[0-2])-(0[0-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"), + "The instant '" + e.getAttribute("value") + "' is not valid (by regex)"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.getAttribute("value")), "The value '" + e.getAttribute("value") + "' does not have a valid year"); + } + + if (type.equals("code")) { + // Technically, a code is restricted to string which has at least one character and no leading or trailing whitespace, and where there is no whitespace + // other than single spaces in the contents + rule(errors, IssueType.INVALID, e.line(), e.col(), path, passesCodeWhitespaceRules(e.getAttribute("value")), "The code '" + e.getAttribute("value") + "' is not valid (whitespace rules)"); + } + + if (context.hasBinding()) { + checkPrimitiveBinding(errors, path, type, context, e); + } + // for nothing to check + } + + // note that we don't check the type here; it could be string, uri or code. + private void checkPrimitiveBinding(List<ValidationMessage> errors, String path, String type, ElementDefinition elementContext, WrapperElement element) { + if (!element.hasAttribute("value")) + return; + + String value = element.getAttribute("value"); + // System.out.println("check "+value+" in "+path); + + // firstly, resolve the value set + ElementDefinitionBindingComponent binding = elementContext.getBinding(); + if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { + ValueSet vs = resolveBindingReference(binding.getValueSet()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, "ValueSet {0} not found", describeReference(binding.getValueSet()))) { + ValidationResult vr = context.validateCode(null, value, null, vs); + if (!vr.isOk()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is required from this value set)"); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code should come from this value set unless it has no suitable code)"); + else if (binding.getStrength() == BindingStrength.PREFERRED) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is recommended to come from this value set)"); + } + } + } else + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding has no source, so can't be checked"); + } + + private void checkQuantity(List<ValidationMessage> errors, String path, WrapperElement focus, Quantity fixed) { + checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value"); + checkFixedValue(errors, path + ".comparator", focus.getNamedChild("comparator"), fixed.getComparatorElement(), "comparator"); + checkFixedValue(errors, path + ".units", focus.getNamedChild("unit"), fixed.getUnitElement(), "units"); + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system"); + checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code"); + } + + // implementation + + private void checkRange(List<ValidationMessage> errors, String path, WrapperElement focus, Range fixed) { + checkFixedValue(errors, path + ".low", focus.getNamedChild("low"), fixed.getLow(), "low"); + checkFixedValue(errors, path + ".high", focus.getNamedChild("high"), fixed.getHigh(), "high"); + + } + + private void checkRatio(List<ValidationMessage> errors, String path, WrapperElement focus, Ratio fixed) { + checkFixedValue(errors, path + ".numerator", focus.getNamedChild("numerator"), fixed.getNumerator(), "numerator"); + checkFixedValue(errors, path + ".denominator", focus.getNamedChild("denominator"), fixed.getDenominator(), "denominator"); + } + + private void checkReference(List<ValidationMessage> errors, String path, WrapperElement element, StructureDefinition profile, ElementDefinition container, String parentType, NodeStack stack) + { + String ref = element.getNamedChildValue("reference"); + if (Utilities.noString(ref)) { + // todo - what should we do in this case? + hint(errors, IssueType.STRUCTURE, element.line(), element.col(), path, !Utilities.noString(element.getNamedChildValue("display")), + "A Reference without an actual reference should have a display"); + return; + } + + WrapperElement we = resolve(ref, stack); + String ft; + if (we != null) + ft = we.getResourceType(); + else + ft = tryParse(ref); + if (hint(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ft != null, "Unable to determine type of target resource")) { + boolean ok = false; + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (TypeRefComponent type : container.getType()) { + if (!ok && type.getCode().equals("Reference")) { + // we validate as much as we can. First, can we infer a type from the profile? + if (!type.hasProfile() || type.getProfile().get(0).getValue().equals("http://hl7.org/fhir/StructureDefinition/Resource")) + ok = true; + else { + String pr = type.getProfile().get(0).getValue(); + + String bt = getBaseType(profile, pr); + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, bt != null, "Unable to resolve the profile reference '" + pr + "'")) { + b.append(bt); + ok = bt.equals(ft); + } else + ok = true; // suppress following check + } + } + if (!ok && type.getCode().equals("*")) { + ok = true; // can refer to anything + } + } + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ok, "Invalid Resource target type. Found " + ft + ", but expected one of (" + b.toString() + ")"); + } + } + + private String checkResourceType(String type) { + if (context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type) != null) + return type; + else + return null; + } + + private void checkSampledData(List<ValidationMessage> errors, String path, WrapperElement focus, SampledData fixed) { + checkFixedValue(errors, path + ".origin", focus.getNamedChild("origin"), fixed.getOrigin(), "origin"); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriodElement(), "period"); + checkFixedValue(errors, path + ".factor", focus.getNamedChild("factor"), fixed.getFactorElement(), "factor"); + checkFixedValue(errors, path + ".lowerLimit", focus.getNamedChild("lowerLimit"), fixed.getLowerLimitElement(), "lowerLimit"); + checkFixedValue(errors, path + ".upperLimit", focus.getNamedChild("upperLimit"), fixed.getUpperLimitElement(), "upperLimit"); + checkFixedValue(errors, path + ".dimensions", focus.getNamedChild("dimensions"), fixed.getDimensionsElement(), "dimensions"); + checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data"); + } + + private void checkTiming(List<ValidationMessage> errors, String path, WrapperElement focus, Timing fixed) { + checkFixedValue(errors, path + ".repeat", focus.getNamedChild("repeat"), fixed.getRepeat(), "value"); + + List<WrapperElement> events = new ArrayList<WrapperElement>(); + focus.getNamedChildren("event", events); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, events.size() == fixed.getEvent().size(), + "Expected " + Integer.toString(fixed.getEvent().size()) + " but found " + Integer.toString(events.size()) + " event elements")) { + for (int i = 0; i < events.size(); i++) + checkFixedValue(errors, path + ".event", events.get(i), fixed.getEvent().get(i), "event"); + } + } + + private boolean codeinExpansion(ValueSetExpansionContainsComponent cnt, String system, String code) { + for (ValueSetExpansionContainsComponent c : cnt.getContains()) { + if (code.equals(c.getCode()) && system.equals(c.getSystem().toString())) + return true; + if (codeinExpansion(c, system, code)) + return true; + } + return false; + } + + private boolean codeInExpansion(ValueSet vs, String system, String code) { + for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) { + if (code.equals(c.getCode()) && (system == null || system.equals(c.getSystem()))) + return true; + if (codeinExpansion(c, system, code)) + return true; + } + return false; + } + + private String describeReference(Type reference) { + if (reference == null) + return "null"; + if (reference instanceof UriType) + return ((UriType) reference).getValue(); + if (reference instanceof Reference) + return ((Reference) reference).getReference(); + return "??"; + } + + private String describeTypes(List<TypeRefComponent> types) { + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (TypeRefComponent t : types) { + b.append(t.getCode()); + } + return b.toString(); + } + + private boolean empty(WrapperElement element) { + if (element.hasAttribute("value")) + return false; + if (element.hasAttribute("xml:id")) + return false; + WrapperElement child = element.getFirstChild(); + while (child != null) { + if (!child.isXml() || FormatUtilities.FHIR_NS.equals(child.getNamespace())) { + return false; + } + child = child.getNextSibling(); + } + return true; + } + + private ElementDefinition findElement(StructureDefinition profile, String name) { + for (ElementDefinition c : profile.getSnapshot().getElement()) { + if (c.getPath().equals(name)) { + return c; + } + } + return null; + } + + private String genFullUrl(String bundleBase, String entryBase, String type, String id) { + String base = Utilities.noString(entryBase) ? bundleBase : entryBase; + if (Utilities.noString(base)) { + return type + "/" + id; + } else if ("urn:uuid".equals(base) || "urn:oid".equals(base)) + return base + id; + else + return Utilities.appendSlash(base) + type + "/" + id; + } + + public BestPracticeWarningLevel getBasePracticeWarningLevel() { + return bpWarnings; + } + + private String getBaseType(StructureDefinition profile, String pr) { + // if (pr.startsWith("http://hl7.org/fhir/StructureDefinition/")) { + // // this just has to be a base type + // return pr.substring(40); + // } else { + StructureDefinition p = resolveProfile(profile, pr); + if (p == null) + return null; + else if (p.getKind() == StructureDefinitionKind.RESOURCE) + return p.getSnapshot().getElement().get(0).getPath(); + else + return p.getSnapshot().getElement().get(0).getType().get(0).getCode(); + // } + } + + @Override + public CheckDisplayOption getCheckDisplay() { + return checkDisplay; + } + + // private String findProfileTag(WrapperElement element) { + // String uri = null; + // List<WrapperElement> list = new ArrayList<WrapperElement>(); + // element.getNamedChildren("category", list); + // for (WrapperElement c : list) { + // if ("http://hl7.org/fhir/tag/profile".equals(c.getAttribute("scheme"))) { + // uri = c.getAttribute("term"); + // } + // } + // return uri; + // } + + private ConceptDefinitionComponent getCodeDefinition(ConceptDefinitionComponent c, String code) { + if (code.equals(c.getCode())) + return c; + for (ConceptDefinitionComponent g : c.getConcept()) { + ConceptDefinitionComponent r = getCodeDefinition(g, code); + if (r != null) + return r; + } + return null; + } + + private ConceptDefinitionComponent getCodeDefinition(ValueSet vs, String code) { + for (ConceptDefinitionComponent c : vs.getCodeSystem().getConcept()) { + ConceptDefinitionComponent r = getCodeDefinition(c, code); + if (r != null) + return r; + } + return null; + } + + private WrapperElement getContainedById(WrapperElement container, String id) { + List<WrapperElement> contained = new ArrayList<WrapperElement>(); + container.getNamedChildren("contained", contained); + for (WrapperElement we : contained) { + WrapperElement res = we.isXml() ? we.getFirstChild() : we; + if (id.equals(res.getNamedChildValue("id"))) + return res; + } + return null; + } + + public IWorkerContext getContext() { + return context; + } + + private ElementDefinition getCriteriaForDiscriminator(String path, ElementDefinition ed, String discriminator, StructureDefinition profile) throws DefinitionException { + List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(profile, ed); + List<ElementDefinition> snapshot = null; + if (childDefinitions.isEmpty()) { + // going to look at the type + if (ed.getType().size() == 0) + throw new DefinitionException("Error in profile for " + path + " no children, no type"); + if (ed.getType().size() > 1) + throw new DefinitionException("Error in profile for " + path + " multiple types defined in slice discriminator"); + StructureDefinition type; + if (ed.getType().get(0).hasProfile()) { + // need to do some special processing for reference here... + if (ed.getType().get(0).getCode().equals("Reference")) + discriminator = discriminator.substring(discriminator.indexOf(".")+1); + type = context.fetchResource(StructureDefinition.class, ed.getType().get(0).getProfile().get(0).getValue()); + } else + type = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + ed.getType().get(0).getCode()); + snapshot = type.getSnapshot().getElement(); + ed = snapshot.get(0); + } else { + snapshot = profile.getSnapshot().getElement(); + } + String originalPath = ed.getPath(); + String goal = originalPath + "." + discriminator; + + int index = snapshot.indexOf(ed); + assert(index > -1); + index++; + while (index < snapshot.size() && !snapshot.get(index).getPath().equals(originalPath)) { + if (snapshot.get(index).getPath().equals(goal)) + return snapshot.get(index); + index++; + } + throw new Error("Unable to find discriminator definition for " + goal + " in " + discriminator + " at " + path); + } + + private WrapperElement getExtensionByUrl(List<WrapperElement> extensions, String urlSimple) { + for (WrapperElement e : extensions) { + if (urlSimple.equals(e.getNamedChildValue("url"))) + return e; + } + return null; + } + + public List<String> getExtensionDomains() { + return extensionDomains; + } + + private WrapperElement getFromBundle(WrapperElement bundle, String ref) { + List<WrapperElement> entries = new ArrayList<WrapperElement>(); + bundle.getNamedChildren("entry", entries); + for (WrapperElement we : entries) { + WrapperElement res = we.getNamedChild("resource").getFirstChild(); + if (res != null) { + String url = genFullUrl(bundle.getNamedChildValue("base"), we.getNamedChildValue("base"), res.getName(), res.getNamedChildValue("id")); + if (url.endsWith(ref)) + return res; + } + } + return null; + } + + private StructureDefinition getProfileForType(String type) { + return context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type); + } + + private Element getValueForDiscriminator(WrapperElement element, String discriminator, ElementDefinition criteria) { + // throw new Error("validation of slices not done yet"); + return null; + } + + private ValueSet getValueSet(String system) { + return context.fetchCodeSystem(system); + } + + private boolean hasTime(String fmt) { + return fmt.contains("T"); + } + + private boolean hasTimeZone(String fmt) { + return fmt.length() > 10 && (fmt.substring(10).contains("-") || fmt.substring(10).contains("+") || fmt.substring(10).contains("Z")); + } + + private boolean isAbsolute(String uri) { + return Utilities.noString(uri) || uri.startsWith("http:") || uri.startsWith("https:") || uri.startsWith("urn:uuid:") || uri.startsWith("urn:oid:") || uri.startsWith("urn:ietf:") + || uri.startsWith("urn:iso:") || isValidFHIRUrn(uri); + } + + private boolean isValidFHIRUrn(String uri) { + return (uri.equals("urn:x-fhir:uk:id:nhs-number")); + } + + public boolean isAnyExtensionsAllowed() { + return anyExtensionsAllowed; + } + + private boolean isParametersEntry(String path) { + String[] parts = path.split("\\/"); + if (path.startsWith("/f:")) + return parts.length == 4 && parts[parts.length-3].equals("f:Parameters") && parts[parts.length-2].startsWith("f:parameter") && parts[parts.length-1].startsWith("f:resource"); + else + return parts.length == 4 && parts[parts.length-3].equals("Parameters") && parts[parts.length-2].startsWith("parameter") && parts[parts.length-1].startsWith("resource"); + } + + private boolean isBundleEntry(String path) { + String[] parts = path.split("\\/"); + if (path.startsWith("/f:")) + return parts.length > 2 && parts[parts.length - 1].startsWith("f:resource") && (parts[parts.length - 2].equals("f:entry") || parts[parts.length - 2].startsWith("f:entry[")); + else + return parts.length > 2 && parts[parts.length - 1].equals("resource") && ((parts.length > 2 && parts[parts.length - 3].equals("entry")) || parts[parts.length - 2].equals("entry")); + } + + private boolean isPrimitiveType(String type) { + return type.equalsIgnoreCase("boolean") || type.equalsIgnoreCase("integer") || type.equalsIgnoreCase("string") || type.equalsIgnoreCase("decimal") || type.equalsIgnoreCase("uri") + || type.equalsIgnoreCase("base64Binary") || type.equalsIgnoreCase("instant") || type.equalsIgnoreCase("date") || type.equalsIgnoreCase("uuid") || type.equalsIgnoreCase("id") + || type.equalsIgnoreCase("xhtml") || type.equalsIgnoreCase("markdown") || type.equalsIgnoreCase("dateTime") || type.equalsIgnoreCase("time") || type.equalsIgnoreCase("code") + || type.equalsIgnoreCase("oid") || type.equalsIgnoreCase("id"); + } + + + + public boolean isSuppressLoincSnomedMessages() { + return suppressLoincSnomedMessages; + } + + private boolean nameMatches(String name, String tail) { + if (tail.endsWith("[x]")) + return name.startsWith(tail.substring(0, tail.length() - 3)); + else + return (name.equals(tail)); + } + + // private String mergePath(String path1, String path2) { + // // path1 is xpath path + // // path2 is dotted path + // String[] parts = path2.split("\\."); + // StringBuilder b = new StringBuilder(path1); + // for (int i = 1; i < parts.length -1; i++) + // b.append("/f:"+parts[i]); + // return b.toString(); + // } + + private boolean passesCodeWhitespaceRules(String v) { + if (!v.trim().equals(v)) + return false; + boolean lastWasSpace = true; + for (char c : v.toCharArray()) { + if (c == ' ') { + if (lastWasSpace) + return false; + else + lastWasSpace = true; + } else if (Character.isWhitespace(c)) + return false; + else + lastWasSpace = false; + } + return true; + } + + private WrapperElement resolve(String ref, NodeStack stack) { + if (ref.startsWith("#")) { + // work back through the contained list. + // really, there should only be one level for this (contained resources cannot contain + // contained resources), but we'll leave that to some other code to worry about + while (stack != null && stack.getElement() != null) { + WrapperElement res = getContainedById(stack.getElement(), ref.substring(1)); + if (res != null) + return res; + stack = stack.parent; + } + return null; + } else { + // work back through the contained list - if any of them are bundles, try to resolve + // the resource in the bundle + while (stack != null && stack.getElement() != null) { + if ("Bundle".equals(stack.getElement().getResourceType())) { + WrapperElement res = getFromBundle(stack.getElement(), ref.substring(1)); + if (res != null) + return res; + } + stack = stack.parent; + } + + // todo: consult the external host for resolution + return null; + + } + } + + private ValueSet resolveBindingReference(Type reference) { + if (reference instanceof UriType) + return context.fetchResource(ValueSet.class, ((UriType) reference).getValue().toString()); + else if (reference instanceof Reference) + return context.fetchResource(ValueSet.class, ((Reference) reference).getReference()); + else + return null; + } + + private WrapperElement resolveInBundle(List<WrapperElement> entries, String ref, String fullUrl, String type, String id) { + if (Utilities.isAbsoluteUrl(ref)) { + // if the reference is absolute, then you resolve by fullUrl. No other thinking is required. + for (WrapperElement entry : entries) { + String fu = entry.getNamedChildValue("fullUrl"); + if (ref.equals(fu)) + return entry; + } + return null; + } else { + // split into base, type, and id + String u = null; + if (fullUrl != null && fullUrl.endsWith(type+"/"+id)) + // fullUrl = complex + u = fullUrl.substring((type+"/"+id).length())+ref; + String[] parts = ref.split("\\/"); + if (parts.length >= 2) { + String t = parts[0]; + String i = parts[1]; + for (WrapperElement entry : entries) { + String fu = entry.getNamedChildValue("fullUrl"); + if (u != null && fullUrl.equals(u)) + return entry; + if (u == null) { + WrapperElement res = entry.getNamedChild("resource"); + WrapperElement resource = res.getFirstChild(); + String et = resource.getResourceType(); + String eid = resource.getNamedChildValue("id"); + if (t.equals(et) && i.equals(eid)) + return entry; + } + } + } + return null; + } + } + + private ElementDefinition resolveNameReference(StructureDefinitionSnapshotComponent snapshot, String name) { + for (ElementDefinition ed : snapshot.getElement()) + if (name.equals(ed.getName())) + return ed; + return null; + } + + private StructureDefinition resolveProfile(StructureDefinition profile, String pr) { + if (pr.startsWith("#")) { + for (Resource r : profile.getContained()) { + if (r.getId().equals(pr.substring(1)) && r instanceof StructureDefinition) + return (StructureDefinition) r; + } + return null; + } else + return context.fetchResource(StructureDefinition.class, pr); + } + + private ElementDefinition resolveType(String type) { + String url = "http://hl7.org/fhir/StructureDefinition/" + type; + StructureDefinition sd = context.fetchResource(StructureDefinition.class, url); + if (sd == null || !sd.hasSnapshot()) + return null; + else + return sd.getSnapshot().getElement().get(0); + } + + public void setAnyExtensionsAllowed(boolean anyExtensionsAllowed) { + this.anyExtensionsAllowed = anyExtensionsAllowed; + } + + public void setBestPracticeWarningLevel(BestPracticeWarningLevel value) { + bpWarnings = value; + } + + @Override + public void setCheckDisplay(CheckDisplayOption checkDisplay) { + this.checkDisplay = checkDisplay; + } + + public void setSuppressLoincSnomedMessages(boolean suppressLoincSnomedMessages) { + this.suppressLoincSnomedMessages = suppressLoincSnomedMessages; + } + + public IdStatus getResourceIdRule() { + return resourceIdRule; + } + + public void setResourceIdRule(IdStatus resourceIdRule) { + this.resourceIdRule = resourceIdRule; + } + + /** + * + * @param element + * - the candidate that might be in the slice + * @param path + * - for reporting any errors. the XPath for the element + * @param slice + * - the definition of how slicing is determined + * @param ed + * - the slice for which to test membership + * @return + * @throws DefinitionException + * @throws Exception + */ + private boolean sliceMatches(WrapperElement element, String path, ElementDefinition slice, ElementDefinition ed, StructureDefinition profile) throws DefinitionException { + if (!slice.getSlicing().hasDiscriminator()) + return false; // cannot validate in this case + for (StringType s : slice.getSlicing().getDiscriminator()) { + String discriminator = s.getValue(); + ElementDefinition criteria = getCriteriaForDiscriminator(path, ed, discriminator, profile); + if (discriminator.equals("url") && criteria.getPath().equals("Extension.url")) { + if (!element.getAttribute("url").equals(((UriType) criteria.getFixed()).asStringValue())) + return false; + } else { + Element value = getValueForDiscriminator(element, discriminator, criteria); + if (!valueMatchesCriteria(value, criteria)) + return false; + } + } + return true; + } + + // we assume that the following things are true: + // the instance at root is valid against the schema and schematron + // the instance validator had no issues against the base resource profile + private void start(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, StructureDefinition profile, NodeStack stack) throws FHIRException { + // profile is valid, and matches the resource name + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), profile.hasSnapshot(), + "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) { + validateElement(errors, profile, profile.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); + + checkDeclaredProfiles(errors, resource, element, stack); + + // specific known special validations + if (element.getResourceType().equals("Bundle")) + validateBundle(errors, element, stack); + if (element.getResourceType().equals("Observation")) + validateObservation(errors, element, stack); + } + } + + private String tail(String path) { + return path.substring(path.lastIndexOf(".") + 1); + } + + private String tryParse(String ref) { + String[] parts = ref.split("\\/"); + switch (parts.length) { + case 1: + return null; + case 2: + return checkResourceType(parts[0]); + default: + if (parts[parts.length - 2].equals("_history")) + return checkResourceType(parts[parts.length - 4]); + else + return checkResourceType(parts[parts.length - 2]); + } + } + + private boolean typesAreAllReference(List<TypeRefComponent> theType) { + for (TypeRefComponent typeRefComponent : theType) { + if (typeRefComponent.getCode().equals("Reference") == false) { + return false; + } + } + return true; + } + + @Override + public List<ValidationMessage> validate(Document document) throws FHIRException { + List<ValidationMessage> results = new ArrayList<ValidationMessage>(); + validate(results, document); + return results; + } + + @Override + public List<ValidationMessage> validate(Document document, String profile) throws FHIRException { + List<ValidationMessage> results = new ArrayList<ValidationMessage>(); + validate(results, document, profile); + return results; + } + + @Override + public List<ValidationMessage> validate(Document document, StructureDefinition profile) throws FHIRException { + List<ValidationMessage> results = new ArrayList<ValidationMessage>(); + validate(results, document, profile); + return results; + } + + @Override + public List<ValidationMessage> validate(Element element) throws FHIRException { + List<ValidationMessage> results = new ArrayList<ValidationMessage>(); + validate(results, element); + return results; + } + + @Override + public List<ValidationMessage> validate(Element element, String profile) throws FHIRException { + List<ValidationMessage> results = new ArrayList<ValidationMessage>(); + validate(results, element, profile); + return results; + } + + @Override + public List<ValidationMessage> validate(Element element, StructureDefinition profile) throws FHIRException { + List<ValidationMessage> results = new ArrayList<ValidationMessage>(); + validate(results, element, profile); + return results; + } + + @Override + public List<ValidationMessage> validate(JsonObject obj) throws FHIRException { + List<ValidationMessage> results = new ArrayList<ValidationMessage>(); + validate(results, obj); + return results; + } + + @Override + public List<ValidationMessage> validate(JsonObject obj, String profile) throws FHIRException { + List<ValidationMessage> results = new ArrayList<ValidationMessage>(); + validate(results, obj, profile); + return results; + } + + @Override + public List<ValidationMessage> validate(JsonObject obj, StructureDefinition profile) throws FHIRException { + List<ValidationMessage> results = new ArrayList<ValidationMessage>(); + validate(results, obj, profile); + return results; + } + + @Override + public void validate(List<ValidationMessage> errors, Document document) throws FHIRException { + checkForProcessingInstruction(errors, document); + validateResource(errors, null, new DOMWrapperElement(document.getDocumentElement()), null, resourceIdRule, null); + } + + @Override + public void validate(List<ValidationMessage> errors, Document document, String profile) throws FHIRException { + checkForProcessingInstruction(errors, document); + StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); + if (p == null) + throw new DefinitionException("StructureDefinition '" + profile + "' not found"); + validateResource(errors, null, new DOMWrapperElement(document.getDocumentElement()), p, resourceIdRule, null); + } + + @Override + public void validate(List<ValidationMessage> errors, Document document, StructureDefinition profile) throws FHIRException { + checkForProcessingInstruction(errors, document); + validateResource(errors, null, new DOMWrapperElement(document.getDocumentElement()), profile, resourceIdRule, null); + } + + @Override + public void validate(List<ValidationMessage> errors, Element element) throws FHIRException { + validateResource(errors, null, new DOMWrapperElement(element), null, resourceIdRule, null); + } + + @Override + public void validate(List<ValidationMessage> errors, Element element, String profile) throws FHIRException { + StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); + if (p == null) + throw new DefinitionException("StructureDefinition '" + profile + "' not found"); + validateResource(errors, null, new DOMWrapperElement(element), p, resourceIdRule, null); + } + + @Override + public void validate(List<ValidationMessage> errors, Element element, StructureDefinition profile) throws FHIRException { + validateResource(errors, null, new DOMWrapperElement(element), profile, resourceIdRule, null); + } + + @Override + public void validate(List<ValidationMessage> errors, JsonObject object) throws FHIRException { + validateResource(errors, null, new JsonWrapperElement(object), null, resourceIdRule, null); + } + + @Override + public void validate(List<ValidationMessage> errors, JsonObject object, String profile) throws FHIRException { + StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); + if (p == null) + throw new DefinitionException("StructureDefinition '" + profile + "' not found"); + validateResource(errors, null, new JsonWrapperElement(object), p, resourceIdRule, null); + } + + @Override + public void validate(List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws FHIRException { + validateResource(errors, null, new JsonWrapperElement(object), profile, resourceIdRule, null); + } + + private void validateBundle(List<ValidationMessage> errors, WrapperElement bundle, NodeStack stack) { + List<WrapperElement> entries = new ArrayList<WrapperElement>(); + bundle.getNamedChildren("entry", entries); + String type = bundle.getNamedChildValue("type"); + if (entries.size() == 0) { + rule(errors, IssueType.INVALID, stack.getLiteralPath(), !(type.equals("document") || type.equals("message")), "Documents or Messages must contain at least one entry"); + } else { + WrapperElement firstEntry = entries.get(0); + NodeStack firstStack = stack.push(firstEntry, 0, null, null); + String fullUrl = firstEntry.getNamedChildValue("fullUrl"); + + if (type.equals("document")) { + WrapperElement res = firstEntry.getNamedChild("resource"); + NodeStack localStack = firstStack.push(res, -1, null, null); + WrapperElement resource = res.getFirstChild(); + String id = resource.getNamedChildValue("id"); + if (rule(errors, IssueType.INVALID, firstEntry.line(), firstEntry.col(), stack.addToLiteralPath("entry", ":0"), res != null, "No resource on first entry")) { + if (bundle.isXml()) + validateDocument(errors, entries, resource, localStack.push(resource, -1, null, null), fullUrl, id); + else + validateDocument(errors, entries, res, localStack, fullUrl, id); + } + } + if (type.equals("message")) + validateMessage(errors, bundle); + } + } + + // public class ProfileStructureIterator { + // + // private StructureDefinition profile; + // private ElementDefinition elementDefn; + // private List<String> names = new ArrayList<String>(); + // private Map<String, List<ElementDefinition>> children = new HashMap<String, List<ElementDefinition>>(); + // private int cursor; + // + // public ProfileStructureIterator(StructureDefinition profile, ElementDefinition elementDefn) { + // this.profile = profile; + // this.elementDefn = elementDefn; + // loadMap(); + // cursor = -1; + // } + // + // private void loadMap() { + // int i = profile.getSnapshot().getElement().indexOf(elementDefn) + 1; + // String lead = elementDefn.getPath(); + // while (i < profile.getSnapshot().getElement().size()) { + // String name = profile.getSnapshot().getElement().get(i).getPath(); + // if (name.length() <= lead.length()) + // return; // cause we've got to the end of the possible matches + // String tail = name.substring(lead.length()+1); + // if (Utilities.isToken(tail) && name.substring(0, lead.length()).equals(lead)) { + // List<ElementDefinition> list = children.get(tail); + // if (list == null) { + // list = new ArrayList<ElementDefinition>(); + // names.add(tail); + // children.put(tail, list); + // } + // list.add(profile.getSnapshot().getElement().get(i)); + // } + // i++; + // } + // } + // + // public boolean more() { + // cursor++; + // return cursor < names.size(); + // } + // + // public List<ElementDefinition> current() { + // return children.get(name()); + // } + // + // public String name() { + // return names.get(cursor); + // } + // + // } + // + // private void checkByProfile(List<ValidationMessage> errors, String path, WrapperElement focus, StructureDefinition profile, ElementDefinition elementDefn) + // { + // // we have an element, and the structure that describes it. + // // we know that's it's valid against the underlying spec - is it valid against this one? + // // in the instance validator above, we assume that schema or schmeatron has taken care of cardinalities, but here, we have no such reliance. + // // so the walking algorithm is different: we're going to walk the definitions + // String type; + // if (elementDefn.getPath().endsWith("[x]")) { + // String tail = elementDefn.getPath().substring(elementDefn.getPath().lastIndexOf(".")+1, elementDefn.getPath().length()-3); + // type = focus.getName().substring(tail.length()); + // rule(errors, IssueType.STRUCTURE, focus.line(), focus.col(), path, typeAllowed(type, elementDefn.getType()), "The type '"+type+"' is not allowed at this + // point (must be one of '"+typeSummary(elementDefn)+")"); + // } else { + // if (elementDefn.getType().size() == 1) { + // type = elementDefn.getType().size() == 0 ? null : elementDefn.getType().get(0).getCode(); + // } else + // type = null; + // } + // // constraints: + // for (ElementDefinitionConstraintComponent c : elementDefn.getConstraint()) + // checkConstraint(errors, path, focus, c); + // if (elementDefn.hasBinding() && type != null) + // checkBinding(errors, path, focus, profile, elementDefn, type); + // + // // type specific checking: + // if (type != null && isPrimitiveType(type)) { + // checkPrimitiveByProfile(errors, path, focus, elementDefn); + // } else { + // if (elementDefn.hasFixed()) + // checkFixedValue(errors, path, focus, elementDefn.getFixed(), ""); + // + // ProfileStructureIterator walker = new ProfileStructureIterator(profile, elementDefn); + // while (walker.more()) { + // // collect all the slices for the path + // List<ElementDefinition> childset = walker.current(); + // // collect all the elements that match it by name + // List<WrapperElement> children = new ArrayList<WrapperElement>(); + // focus.getNamedChildrenWithWildcard(walker.name(), children); + // + // if (children.size() == 0) { + // // well, there's no children - should there be? + // for (ElementDefinition defn : childset) { + // if (!rule(errors, IssueType.REQUIRED, focus.line(), focus.col(), path, defn.getMin() == 0, "Required Element '"+walker.name()+"' missing")) + // break; // no point complaining about missing ones after the first one + // } + // } else if (childset.size() == 1) { + // // simple case: one possible definition, and one or more children. + // rule(errors, IssueType.STRUCTURE, focus.line(), focus.col(), path, childset.get(0).getMax().equals("*") || Integer.parseInt(childset.get(0).getMax()) >= + // children.size(), + // "Too many elements for '"+walker.name()+"'"); // todo: sort out structure + // for (WrapperElement child : children) { + // checkByProfile(errors, childset.get(0).getPath(), child, profile, childset.get(0)); + // } + // } else { + // // ok, this is the full case - we have a list of definitions, and a list of candidates for meeting those definitions. + // // we need to decide *if* that match a given definition + // } + // } + // } + // } + + // private void checkBinding(List<ValidationMessage> errors, String path, WrapperElement focus, StructureDefinition profile, ElementDefinition elementDefn, + // String type) { + // ElementDefinitionBindingComponent bc = elementDefn.getBinding(); + // + // if (bc != null && bc.hasValueSet() && bc.getValueSet() instanceof Reference) { + // String url = ((Reference) bc.getValueSet()).getReference(); + // ValueSet vs = resolveValueSetReference(profile, (Reference) bc.getValueSet()); + // if (vs == null) { + // rule(errors, IssueType.STRUCTURE, focus.line(), focus.col(), path, false, "Cannot check binding on type '"+type+"' as the value set '"+url+"' could not be + // located"); + // } else if (type.equals("code")) + // checkBindingCode(errors, path, focus, vs); + // else if (type.equals("Coding")) + // checkBindingCoding(errors, path, focus, vs); + // else if (type.equals("CodeableConcept")) + // checkBindingCodeableConcept(errors, path, focus, vs); + // else + // rule(errors, IssueType.STRUCTURE, focus.line(), focus.col(), path, false, "Cannot check binding on type '"+type+"'"); + // } + // } + // + // private ValueSet resolveValueSetReference(StructureDefinition profile, Reference reference) { + // if (reference.getReference().startsWith("#")) { + // for (Resource r : profile.getContained()) { + // if (r instanceof ValueSet && r.getId().equals(reference.getReference().substring(1))) + // return (ValueSet) r; + // } + // return null; + // } else + // return resolveBindingReference(reference); + // + // } + // + // private void checkBindingCode(List<ValidationMessage> errors, String path, WrapperElement focus, ValueSet vs) { + // // rule(errors, "exception", path, false, "checkBindingCode not done yet"); + // } + // + // private void checkBindingCoding(List<ValidationMessage> errors, String path, WrapperElement focus, ValueSet vs) { + // // rule(errors, "exception", path, false, "checkBindingCoding not done yet"); + // } + // + // private void checkBindingCodeableConcept(List<ValidationMessage> errors, String path, WrapperElement focus, ValueSet vs) { + // // rule(errors, "exception", path, false, "checkBindingCodeableConcept not done yet"); + // } + // + // private String typeSummary(ElementDefinition elementDefn) { + // StringBuilder b = new StringBuilder(); + // for (TypeRefComponent t : elementDefn.getType()) { + // b.append("|"+t.getCode()); + // } + // return b.toString().substring(1); + // } + // + // private boolean typeAllowed(String t, List<TypeRefComponent> types) { + // for (TypeRefComponent type : types) { + // if (t.equals(Utilities.capitalize(type.getCode()))) + // return true; + // if (t.equals("Resource") && Utilities.capitalize(type.getCode()).equals("Reference")) + // return true; + // } + // return false; + // } + // + // private void checkConstraint(List<ValidationMessage> errors, String path, WrapperElement focus, ElementDefinitionConstraintComponent c) { + // + //// try + //// { + //// XPathFactory xpf = new net.sf.saxon.xpath.XPathFactoryImpl(); + //// NamespaceContext context = new NamespaceContextMap("f", "http://hl7.org/fhir", "h", "http://www.w3.org/1999/xhtml"); + //// + //// XPath xpath = xpf.newXPath(); + //// xpath.setNamespaceContext(context); + //// Boolean ok = (Boolean) xpath.evaluate(c.getXpath(), focus, XPathConstants.BOOLEAN); + //// if (ok == null || !ok) { + //// if (c.getSeverity() == ConstraintSeverity.warning) + //// warning(errors, "invariant", path, false, c.getHuman()); + //// else + //// rule(errors, "invariant", path, false, c.getHuman()); + //// } + //// } + //// catch (XPathExpressionException e) { + //// rule(errors, "invariant", path, false, "error executing invariant: "+e.getMessage()); + //// } + // } + // + // private void checkPrimitiveByProfile(List<ValidationMessage> errors, String path, WrapperElement focus, ElementDefinition elementDefn) { + // // two things to check - length, and fixed value + // String value = focus.getAttribute("value"); + // if (elementDefn.hasMaxLengthElement()) { + // rule(errors, IssueType.TOOLONG, focus.line(), focus.col(), path, value.length() <= elementDefn.getMaxLength(), "The value '"+value+"' exceeds the allow + // length limit of "+Integer.toString(elementDefn.getMaxLength())); + // } + // if (elementDefn.hasFixed()) { + // checkFixedValue(errors, path, focus, elementDefn.getFixed(), ""); + // } + // } + + private void validateBundleReference(List<ValidationMessage> errors, List<WrapperElement> entries, WrapperElement ref, String name, NodeStack stack, String fullUrl, String type, String id) { + if (ref != null && !Utilities.noString(ref.getNamedChildValue("reference"))) { + WrapperElement target = resolveInBundle(entries, ref.getNamedChildValue("reference"), fullUrl, type, id); + rule(errors, IssueType.INVALID, target.line(), target.col(), stack.addToLiteralPath("reference"), target != null, "Unable to resolve the target of the reference in the bundle (" + name + ")"); + } + } + + private void validateContains(List<ValidationMessage> errors, String path, ElementDefinition child, ElementDefinition context, WrapperElement resource, WrapperElement element, NodeStack stack, IdStatus idstatus) throws FHIRException + { + WrapperElement e = element.isXml() ? element.getFirstChild() : element; + String resourceName = e.getResourceType(); + StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); + // special case: resource wrapper is reset if we're crossing a bundle boundary, but not otherwise + if (path.endsWith("resource")) + resource = e; + if (rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), profile != null, "No profile found for contained resource of type '" + resourceName + "'")) + validateResource(errors, resource, e, profile, idstatus, stack); + } + + private void validateDocument(List<ValidationMessage> errors, List<WrapperElement> entries, WrapperElement composition, NodeStack stack, String fullUrl, String id) { + // first entry must be a composition + if (rule(errors, IssueType.INVALID, composition.line(), composition.col(), stack.getLiteralPath(), composition.getResourceType().equals("Composition"), + "The first entry in a document must be a composition")) { + // the composition subject and section references must resolve in the bundle + validateBundleReference(errors, entries, composition.getNamedChild("subject"), "Composition Subject", stack.push(composition.getNamedChild("subject"), -1, null, null), fullUrl, "Composition", + id); + validateSections(errors, entries, composition, stack, fullUrl, id); + } + } + // rule(errors, IssueType.INVALID, bundle.line(), bundle.col(), "Bundle", !"urn:guid:".equals(base), "The base 'urn:guid:' is not valid (use urn:uuid:)"); + // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !"urn:guid:".equals(ebase), "The base 'urn:guid:' is not valid"); + // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !Utilities.noString(base) || !Utilities.noString(ebase), "entry + // does not have a base"); + // String firstBase = null; + // firstBase = ebase == null ? base : ebase; + + private void validateElement(List<ValidationMessage> errors, StructureDefinition profile, ElementDefinition definition, StructureDefinition cprofile, ElementDefinition context, + WrapperElement resource, WrapperElement element, String actualType, NodeStack stack, boolean inCodeableConcept) throws FHIRException { + element.setDefinition(definition); + element.setProfile(profile); + + // irrespective of what element it is, it cannot be empty + if (element.isXml()) { + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), FormatUtilities.FHIR_NS.equals(element.getNamespace()), + "Namespace mismatch - expected '" + FormatUtilities.FHIR_NS + "', found '" + element.getNamespace() + "'"); + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), !element.hasNamespace("http://www.w3.org/2001/XMLSchema-instance"), + "Schema Instance Namespace is not allowed in instances"); + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), !element.hasProcessingInstruction(), "No Processing Instructions in resources"); + } + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), !empty(element), "Elements must have some content (@value, extensions, or children elements)"); + + checkInvariants(errors, stack.literalPath, profile, definition, null, null, resource, element); + + // get the list of direct defined children, including slices + List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(profile, definition.getName(), definition.getPath(), definition.getNameReference()); + + // 1. List the children, and remember their exact path (convenience) + List<ElementInfo> children = new ArrayList<InstanceValidator.ElementInfo>(); + ChildIterator iter = new ChildIterator(stack.getLiteralPath(), element); + while (iter.next()) + children.add(new ElementInfo(iter.name(), iter.element(), iter.path(), iter.count())); + + // 2. assign children to a definition + // for each definition, for each child, check whether it belongs in the slice + ElementDefinition slice = null; + for (ElementDefinition ed : childDefinitions) { + boolean process = true; + // where are we with slicing + if (ed.hasSlicing()) { + if (slice != null && slice.getPath().equals(ed.getPath())) + throw new DefinitionException("Slice encountered midway through path on " + slice.getPath()); + slice = ed; + process = false; + } else if (slice != null && !slice.getPath().equals(ed.getPath())) + slice = null; + + if (process) { + for (ElementInfo ei : children) { + boolean match = false; + if (slice == null) { + match = nameMatches(ei.name, tail(ed.getPath())); + } else { + if (nameMatches(ei.name, tail(ed.getPath()))) + match = sliceMatches(ei.element, ei.path, slice, ed, profile); + } + if (match) { + if (rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition == null, "Element matches more than one slice")) + ei.definition = ed; + } + } + } + } + for (ElementInfo ei : children) + if (ei.path.endsWith(".extension")) + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getAttribute("url") + "\")"); + else + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition != null) || (!ei.element.isXml() && ei.element.getName().equals("fhir_comments")), + "Element is unknown or does not match any slice"); + + // 3. report any definitions that have a cardinality problem + for (ElementDefinition ed : childDefinitions) { + if (ed.getRepresentation().isEmpty()) { // ignore xml attributes + int count = 0; + for (ElementInfo ei : children) + if (ei.definition == ed) + count++; + if (ed.getMin() > 0) { + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), + "Element '" + stack.getLiteralPath() + "." + tail(ed.getPath()) + "': minimum required = " + Integer.toString(ed.getMin()) + ", but only found " + Integer.toString(count)); + } + if (ed.hasMax() && !ed.getMax().equals("*")) { + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), + "Element " + tail(ed.getPath()) + " @ " + stack.getLiteralPath() + ": max allowed = " + ed.getMax() + ", but found " + Integer.toString(count)); + } + + } + } + // 4. check order if any slices are orderd. (todo) + + // 5. inspect each child for validity + for (ElementInfo ei : children) { + if (ei.definition != null) { + String type = null; + ElementDefinition typeDefn = null; + if (ei.definition.getType().size() == 1 && !ei.definition.getType().get(0).getCode().equals("*") && !ei.definition.getType().get(0).getCode().equals("Element") + && !ei.definition.getType().get(0).getCode().equals("BackboneElement")) + type = ei.definition.getType().get(0).getCode(); + else if (ei.definition.getType().size() == 1 && ei.definition.getType().get(0).getCode().equals("*")) { + String prefix = tail(ei.definition.getPath()); + assert prefix.endsWith("[x]"); + type = ei.name.substring(prefix.length() - 3); + if (isPrimitiveType(type)) + type = Utilities.uncapitalize(type); + } else if (ei.definition.getType().size() > 1) { + + String prefix = tail(ei.definition.getPath()); + assert typesAreAllReference(ei.definition.getType()) || prefix.endsWith("[x]") : prefix; + + prefix = prefix.substring(0, prefix.length() - 3); + for (TypeRefComponent t : ei.definition.getType()) + if ((prefix + Utilities.capitalize(t.getCode())).equals(ei.name)) + type = t.getCode(); + if (type == null) { + TypeRefComponent trc = ei.definition.getType().get(0); + if (trc.getCode().equals("Reference")) + type = "Reference"; + else + rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), false, + "The element " + ei.name + " is illegal. Valid types at this point are " + describeTypes(ei.definition.getType())); + } + } else if (ei.definition.getNameReference() != null) { + typeDefn = resolveNameReference(profile.getSnapshot(), ei.definition.getNameReference()); + } + + if (type != null) { + if (type.startsWith("@")) { + ei.definition = findElement(profile, type.substring(1)); + type = null; + } + } + NodeStack localStack = stack.push(ei.element, ei.count, ei.definition, type == null ? typeDefn : resolveType(type)); + String localStackLiterapPath = localStack.getLiteralPath(); + String eiPath = ei.path; + assert(eiPath.equals(localStackLiterapPath)) : "ei.path: " + ei.path + " - localStack.getLiterapPath: " + localStackLiterapPath; + boolean thisIsCodeableConcept = false; + + if (type != null) { + if (isPrimitiveType(type)) + checkPrimitive(errors, ei.path, type, ei.definition, ei.element); + else { + if (type.equals("Identifier")) + checkIdentifier(errors, ei.path, ei.element, ei.definition); + else if (type.equals("Coding")) + checkCoding(errors, ei.path, ei.element, profile, ei.definition, inCodeableConcept); + else if (type.equals("CodeableConcept")) { + checkCodeableConcept(errors, ei.path, ei.element, profile, ei.definition); + thisIsCodeableConcept = true; + } else if (type.equals("Reference")) + checkReference(errors, ei.path, ei.element, profile, ei.definition, actualType, localStack); + + if (type.equals("Extension")) + checkExtension(errors, ei.path, ei.element, ei.definition, profile, localStack); + else if (type.equals("Resource")) + validateContains(errors, ei.path, ei.definition, definition, resource, ei.element, localStack, idStatusForEntry(element, ei)); // if + // (str.matches(".*([.,/])work\\1$")) + else { + StructureDefinition p = getProfileForType(type); + if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown type " + type)) { + validateElement(errors, p, p.getSnapshot().getElement().get(0), profile, ei.definition, resource, ei.element, type, localStack, thisIsCodeableConcept); + } + } + } + } else { + if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), ei.definition != null, "Unrecognised Content " + ei.name)) + validateElement(errors, profile, ei.definition, null, null, resource, ei.element, type, localStack, false); + } + } + } + } + + private IdStatus idStatusForEntry(WrapperElement ep, ElementInfo ei) { + if (isBundleEntry(ei.path)) { + WrapperElement req = ep.getNamedChild("request"); + WrapperElement resp = ep.getNamedChild("response"); + WrapperElement fullUrl = ep.getNamedChild("fullUrl"); + WrapperElement method = null; + WrapperElement url = null; + if (req != null) { + method = req.getNamedChild("method"); + url = req.getNamedChild("url"); + } + if (resp != null) { + return IdStatus.OPTIONAL; + } if (method == null) { + if (fullUrl == null) + return IdStatus.REQUIRED; + else if (fullUrl.getAttribute("value").startsWith("urn:uuid:")) + return IdStatus.OPTIONAL; + else + return IdStatus.REQUIRED; + } else { + String s = method.getAttribute("value"); + if (s.equals("PUT")) { + if (url == null) + return IdStatus.REQUIRED; + else + return IdStatus.OPTIONAL; // or maybe prohibited? not clear + } else if (s.equals("POST")) + return IdStatus.OPTIONAL; // this should be prohibited, but see task 9102 + else // actually, we should never get to here; a bundle entry with method get/delete should not have a resource + return IdStatus.OPTIONAL; + } + } else if (isParametersEntry(ei.path)) + return IdStatus.OPTIONAL; + else + return this.getResourceIdRule(); + } + + private void checkInvariants(List<ValidationMessage> errors, String path, StructureDefinition profile, ElementDefinition ed, String typename, String typeProfile, WrapperElement resource, WrapperElement element) throws FHIRException { + for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { + if (inv.hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression")) { + ResourceOnWrapper res = new ResourceOnWrapper(context, resource, resource.getProfile()); + BaseOnWrapper e = new BaseOnWrapper(context, element, profile, ed, typename, typeProfile); + String expr = inv.getExtensionString("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression"); + FHIRPathEngine fpe = new FHIRPathEngine(context); + boolean ok = true; + try { + ok = fpe.evaluateToBoolean(res, e, expr); + } catch (PathEngineException e1) { + rule(errors, IssueType.INVARIANT, element.line(), element.col(), path, false, e1.getMessage()+": "+inv.getHuman()+fpe.forLog()); + } + if (!ok) { + if (inv.getSeverity() == ConstraintSeverity.ERROR) + rule(errors, IssueType.INVARIANT, element.line(), element.col(), path, ok, inv.getHuman()+fpe.forLog()); + else if (inv.getSeverity() == ConstraintSeverity.WARNING) + warning(errors, IssueType.INVARIANT, element.line(), element.line(), path, ok, inv.getHuman()+fpe.forLog()); + } + } + } + } + + private void validateMessage(List<ValidationMessage> errors, WrapperElement bundle) { + // TODO Auto-generated method stub + + } + + private void validateObservation(List<ValidationMessage> errors, WrapperElement element, NodeStack stack) { + // all observations should have a subject, a performer, and a time + + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("subject") != null, "All observations should have a subject"); + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("performer") != null, "All observations should have a performer"); + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null, + "All observations should have an effectiveDateTime or an effectivePeriod"); + } + + /* + * The actual base entry point + */ + private void validateResource(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, StructureDefinition profile, IdStatus idstatus, NodeStack stack) throws FHIRException { + if (stack == null) + stack = new NodeStack(element.isXml()); + if (resource == null) + resource = element; + + // getting going - either we got a profile, or not. + boolean ok = true; + if (element.isXml()) { + ok = rule(errors, IssueType.INVALID, element.line(), element.col(), "/", element.getNamespace().equals(FormatUtilities.FHIR_NS), + "Namespace mismatch - expected '" + FormatUtilities.FHIR_NS + "', found '" + element.getNamespace() + "'"); + } + if (ok) { + String resourceName = element.getResourceType(); + if (profile == null) { + profile = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); + ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), profile != null, "No profile found for resource type '" + resourceName + "'"); + } else { + String type = profile.hasConstrainedType() ? profile.getConstrainedType() : profile.getName(); + // special case: we have a bundle, and the profile is not for a bundle. We'll try the first entry instead + if (!type.equals(resourceName) && resourceName.equals("Bundle")) { + WrapperElement first = getFirstEntry(element); + if (first != null && first.getResourceType().equals(type)) { + element = first; + resourceName = element.getResourceType(); + idstatus = IdStatus.OPTIONAL; // why? + } + } + ok = rule(errors, IssueType.INVALID, -1, -1, stack.addToLiteralPath(resourceName), type.equals(resourceName), + "Specified profile type was '" + profile.getConstrainedType() + "', but resource type was '" + resourceName + "'"); + } + } + + if (ok) { + stack = stack.push(element, -1, profile.getSnapshot().getElement().get(0), profile.getSnapshot().getElement().get(0)); + if (idstatus == IdStatus.REQUIRED && (element.getNamedChild("id") == null)) + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource requires an id, but none is present"); + else if (idstatus == IdStatus.PROHIBITED && (element.getNamedChild("id") != null)) + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource has an id, but none is allowed"); + start(errors, resource, element, profile, stack); // root is both definition and type + } + } + + private WrapperElement getFirstEntry(WrapperElement bundle) { + List<WrapperElement> list = new ArrayList<WrapperElement>(); + bundle.getNamedChildren("entry", list); + if (list.isEmpty()) + return null; + WrapperElement resource = list.get(0).getNamedChild("resource"); + if (resource == null) + return null; + else + return resource.getFirstChild(); + } + + private void validateSections(List<ValidationMessage> errors, List<WrapperElement> entries, WrapperElement focus, NodeStack stack, String fullUrl, String id) { + List<WrapperElement> sections = new ArrayList<WrapperElement>(); + focus.getNamedChildren("entry", sections); + int i = 0; + for (WrapperElement section : sections) { + NodeStack localStack = stack.push(section, 1, null, null); + validateBundleReference(errors, entries, section.getNamedChild("content"), "Section Content", localStack, fullUrl, "Composition", id); + validateSections(errors, entries, section, localStack, fullUrl, id); + i++; + } + } + + private boolean valueMatchesCriteria(Element value, ElementDefinition criteria) { + // throw new Error("validation of slices not done yet"); + return false; + } + + private boolean yearIsValid(String v) { + if (v == null) { + return false; + } + try { + int i = Integer.parseInt(v.substring(0, Math.min(4, v.length()))); + return i >= 1800 && i <= 2100; + } catch (NumberFormatException e) { + return false; + } + } + + public class ChildIterator { + private String basePath; + private WrapperElement child; + private int lastCount; + private WrapperElement parent; + + public ChildIterator(String path, WrapperElement element) { + parent = element; + basePath = path; + } + + public int count() { + WrapperElement n = child.getNextSibling(); + if (n != null && n.getName().equals(child.getName())) { + return lastCount + 1; + } else + return -1; + } + + public WrapperElement element() { + return child; + } + + public String name() { + return child.getName(); + } + + public boolean next() { + if (child == null) { + child = parent.getFirstChild(); + lastCount = 0; + } else { + String lastName = child.getName(); + child = child.getNextSibling(); + if (child != null && child.getName().equals(lastName)) + lastCount++; + else + lastCount = 0; + } + return child != null; + } + + public String path() { + WrapperElement n = child.getNextSibling(); + if (parent.isXml()) { + String sfx = ""; + if (n != null && n.getName().equals(child.getName())) { + sfx = "[" + Integer.toString(lastCount + 1) + "]"; + } + if (FormatUtilities.XHTML_NS.equals(child.getNamespace())) + return basePath + "/h:" + name() + sfx; + else + return basePath + "/f:" + name() + sfx; + } else { + String sfx = ""; + if (n != null && n.getName().equals(child.getName())) { + sfx = "/" + Integer.toString(lastCount + 1); + } + return basePath + "/" + name() + sfx; + } + } + } + + public class DOMWrapperElement extends WrapperElement { + + private int col; + private Element element; + private int line; + + public DOMWrapperElement(Element element) { + super(); + this.element = element; + XmlLocationData loc = (XmlLocationData) element.getUserData(XmlLocationData.LOCATION_DATA_KEY); + if (loc != null) { + line = loc.getStartLine(); + col = loc.getStartColumn(); + } else { + line = -1; + col = -1; + } + } + + @Override + public int col() { + return col; + } + + @Override + public String getAttribute(String name) { + return element.getAttribute(name); + } + + @Override + public WrapperElement getFirstChild() { + Element res = XMLUtil.getFirstChild(element); + return res == null ? null : new DOMWrapperElement(res); + } + + @Override + public String getName() { + return element.getLocalName(); + } + + @Override + public WrapperElement getNamedChild(String name) { + Element res = XMLUtil.getNamedChild(element, name); + return res == null ? null : new DOMWrapperElement(res); + } + + @Override + public void getNamedChildren(String name, List<WrapperElement> list) { + List<Element> el = new ArrayList<Element>(); + XMLUtil.getNamedChildren(element, name, el); + for (Element e : el) + list.add(new DOMWrapperElement(e)); + } + + @Override + public void getNamedChildrenWithWildcard(String name, List<WrapperElement> list) { + List<Element> el = new ArrayList<Element>(); + XMLUtil.getNamedChildrenWithWildcard(element, name, el); + for (Element e : el) + list.add(new DOMWrapperElement(e)); + } + + @Override + public String getNamedChildValue(String name) { + return XMLUtil.getNamedChildValue(element, name); + } + + @Override + public String getNamespace() { + return element.getNamespaceURI(); + } + + @Override + public WrapperElement getNextSibling() { + Element res = XMLUtil.getNextSibling(element); + return res == null ? null : new DOMWrapperElement(res); + } + + @Override + public String getResourceType() { + return element.getLocalName(); + } + + @Override + public String getText() { + return element.getTextContent(); + } + + @Override + public boolean hasAttribute(String name) { + return element.hasAttribute(name); + } + + @Override + public boolean hasNamespace(String ns) { + for (int i = 0; i < element.getAttributes().getLength(); i++) { + Node a = element.getAttributes().item(i); + if ((a.getNodeName().equals("xmlns") || a.getNodeName().startsWith("xmlns:")) && a.getNodeValue().equals(ns)) + return true; + } + return false; + } + + @Override + public boolean hasProcessingInstruction() { + Node node = element.getFirstChild(); + while (node != null) { + if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) + return true; + node = node.getNextSibling(); + } + return false; + } + + @Override + public boolean isXml() { + return true; + } + + @Override + public int line() { + return line; + } + } + + public class ElementInfo { + + public int count; + public ElementDefinition definition; + private WrapperElement element; + private String name; + private String path; + + public ElementInfo(String name, WrapperElement element, String path, int count) { + this.name = name; + this.element = element; + this.path = path; + this.count = count; + } + + public int col() { + return element.col(); + } + + public int line() { + return element.line(); + } + + } + + public class JsonWrapperElement extends WrapperElement { + + private JsonElement _element; + private List<JsonWrapperElement> children = new ArrayList<JsonWrapperElement>(); + private JsonElement element; + private int index; + private String name; + private JsonWrapperElement parent; + private String path; + private String resourceType; + + public JsonWrapperElement(JsonElement element) { + super(); + this.name = null; + this.resourceType = ((JsonObject) element).get("resourceType").getAsString(); + this.element = element; + this.path = ""; + createChildren(); + } + + public JsonWrapperElement(String path, String name, JsonElement element, JsonElement _element, JsonWrapperElement parent, int index) { + super(); + this.path = path + "/" + name; + this.name = name; + this.element = element; + if (element instanceof JsonObject && ((JsonObject) element).has("resourceType")) + this.resourceType = ((JsonObject) element).get("resourceType").getAsString(); + this._element = _element; + this.parent = parent; + this.index = index; + createChildren(); + } + + @Override + public int col() { + // TODO Auto-generated method stub + return -1; + } + + private void createChildren() { + // System.out.println(" ..: "+path); + // we're going to make this look like the XML + if (element != null) { + if (element instanceof JsonPrimitive) { + // we may have an element_ too + if (_element != null && _element instanceof JsonObject) + for (Entry<String, JsonElement> t : ((JsonObject) _element).entrySet()) + processChild(t.getKey(), t.getValue()); + } else if (element instanceof JsonObject) { + for (Entry<String, JsonElement> t : ((JsonObject) element).entrySet()) + if (!t.getKey().equals("resourceType")) { + processChild(t.getKey(), t.getValue()); + } + } else if (element instanceof JsonNull) { + // nothing to do + } else + throw new Error("unexpected condition: " + element.getClass().getName()); + } + if (_element != null) { + + } + } + + @Override + public String getAttribute(String name) { + if (name.equals("value")) { + if (element == null) + return null; + if (element instanceof JsonPrimitive) + return ((JsonPrimitive) element).getAsString(); + return null; + } + if (name.equals("xml:id")) { + WrapperElement c = getNamedChild("id"); + return c == null ? null : c.getAttribute("value"); + } + if (name.equals("url")) { + WrapperElement c = getNamedChild("url"); + return c == null ? null : c.getAttribute("value"); + } + throw new Error("not done yet: " + name); + } + + @Override + public WrapperElement getFirstChild() { + if (children.isEmpty()) + return null; + else + return children.get(0); + } + + @Override + public String getName() { + return name; + } + + @Override + public WrapperElement getNamedChild(String name) { + for (JsonWrapperElement j : children) + if (j.name.equals(name)) + return j; + return null; + } + + @Override + public void getNamedChildren(String name, List<WrapperElement> list) { + for (JsonWrapperElement j : children) + if (j.name.equals(name)) + list.add(j); + } + + @Override + public void getNamedChildrenWithWildcard(String name, List<WrapperElement> list) { + for (JsonWrapperElement j : children) { + String n = j.name; + if (n.equals(name) || (name.endsWith("[x]") && n.startsWith(name.substring(0, name.length() - 3)))) + list.add(j); + } + } + + @Override + public String getNamedChildValue(String name) { + WrapperElement c = getNamedChild(name); + return c == null ? null : c.getAttribute("value"); + } + + @Override + public String getNamespace() { + // return element.getNamespaceURI(); + throw new Error("not done yet"); + } + + @Override + public WrapperElement getNextSibling() { + if (parent == null) + return null; + if (index >= parent.children.size() - 1) + return null; + return parent.children.get(index + 1); + } + + @Override + public String getResourceType() { + return resourceType; + } + + @Override + public String getText() { + throw new Error("not done yet"); + } + + @Override + public boolean hasAttribute(String name) { + if (name.equals("value")) { + if (element == null) + return false; + if (element instanceof JsonPrimitive) + return true; + return false; + } + if (name.equals("xml:id")) { + return getNamedChild("id") != null; + } + throw new Error("not done yet: " + name); + } + + @Override + public boolean hasNamespace(String ns) { + throw new Error("not done"); + } + + @Override + public boolean hasProcessingInstruction() { + return false; + } + + @Override + public boolean isXml() { + return false; + } + + @Override + public int line() { + return -1; + } + + private void processChild(String name, JsonElement e) { + if (name.startsWith("_")) { + name = name.substring(1); + if (((JsonObject) element).has(name)) + return; // it will get processed anyway + e = null; + } + JsonElement _e = element instanceof JsonObject ? ((JsonObject) element).get("_" + name) : null; + + if (e instanceof JsonPrimitive || (e == null && _e != null && !(_e instanceof JsonArray))) { + children.add(new JsonWrapperElement(path, name, e, _e, this, children.size())); + } else if (e instanceof JsonArray || (e == null && _e != null)) { + JsonArray array = (JsonArray) e; + JsonArray _array = (JsonArray) _e; + int max = array != null ? array.size() : 0; + if (_array != null && _array.size() > max) + max = _array.size(); + for (int i = 0; i < max; i++) { + JsonElement a = array == null || array.size() < i ? null : array.get(i); + JsonElement _a = _array == null || _array.size() < i ? null : _array.get(i); + children.add(new JsonWrapperElement(path, name, a, _a, this, children.size())); + } + } else if (e instanceof JsonObject) { + children.add(new JsonWrapperElement(path, name, e, null, this, children.size())); + } else + throw new Error("not done yet: " + e.getClass().getName()); + } + + } + + private class NodeStack { + private ElementDefinition definition; + private WrapperElement element; + private ElementDefinition extension; + private String literalPath; // xpath format + private List<String> logicalPaths; // dotted format, various entry points + private NodeStack parent; + private ElementDefinition type; + private boolean xml; + + public NodeStack(boolean xml) { + this.xml = xml; + } + + public String addToLiteralPath(String... path) { + StringBuilder b = new StringBuilder(); + b.append(getLiteralPath()); + if (xml) { + for (String p : path) { + if (p.startsWith(":")) { + b.append("["); + b.append(p.substring(1)); + b.append("]"); + } else { + b.append("/f:"); + b.append(p); + } + } + } else { + for (String p : path) { + b.append("/"); + if (p.startsWith(":")) { + b.append(p.substring(1)); + } else { + b.append(p); + } + } + } + return b.toString(); + } + + private ElementDefinition getDefinition() { + return definition; + } + + private WrapperElement getElement() { + return element; + } + + private String getLiteralPath() { + return literalPath == null ? "" : literalPath; + } + + private List<String> getLogicalPaths() { + return logicalPaths == null ? new ArrayList<String>() : logicalPaths; + } + + private ElementDefinition getType() { + return type; + } + + private NodeStack push(WrapperElement element, int count, ElementDefinition definition, ElementDefinition type) { + NodeStack res = new NodeStack(element.isXml()); + res.parent = this; + res.element = element; + res.definition = definition; + if (element.isXml()) { + res.literalPath = getLiteralPath() + (element.getNamespace().equals(FormatUtilities.XHTML_NS) ? "/h:" : "/f:") + element.getName(); + if (count > -1) + res.literalPath = res.literalPath + "[" + Integer.toString(count) + "]"; + } else { + if (element.getName() == null) + res.literalPath = ""; + else + res.literalPath = getLiteralPath() + "/" + element.getName(); + if (count > -1) + res.literalPath = res.literalPath + "/" + Integer.toString(count); + } + res.logicalPaths = new ArrayList<String>(); + if (type != null) { + // type will be bull if we on a stitching point of a contained resource, or if.... + res.type = type; + String t = tail(definition.getPath()); + for (String lp : getLogicalPaths()) { + res.logicalPaths.add(lp + "." + t); + if (t.endsWith("[x]")) + res.logicalPaths.add(lp + "." + t.substring(0, t.length() - 3) + type.getPath()); + } + res.logicalPaths.add(type.getPath()); + } else if (definition != null) { + for (String lp : getLogicalPaths()) + res.logicalPaths.add(lp + "." + element.getName()); + } else + res.logicalPaths.addAll(getLogicalPaths()); + // CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + // for (String lp : res.logicalPaths) + // b.append(lp); + // System.out.println(res.literalPath+" : "+b.toString()); + return res; + } + + private void setType(ElementDefinition type) { + this.type = type; + } + } + + public abstract class WrapperElement { + private StructureDefinition profile; + private ElementDefinition definition; + + + public StructureDefinition getProfile() { + return profile; + } + + public void setProfile(StructureDefinition profile) { + this.profile = profile; + } + + public ElementDefinition getDefinition() { + return definition; + } + + public void setDefinition(ElementDefinition definition) { + this.definition = definition; + } + + public abstract int col(); + + public abstract String getAttribute(String name); + + public abstract WrapperElement getFirstChild(); + + public abstract String getName(); + + public abstract WrapperElement getNamedChild(String name); + + public abstract void getNamedChildren(String name, List<WrapperElement> list); + + public abstract void getNamedChildrenWithWildcard(String name, List<WrapperElement> list); + + public abstract String getNamedChildValue(String name); + + public abstract String getNamespace(); + + public abstract WrapperElement getNextSibling(); + + public abstract String getResourceType(); + + public abstract String getText(); + + public abstract boolean hasAttribute(String name); + + public abstract boolean hasNamespace(String string); + + public abstract boolean hasProcessingInstruction(); + + public abstract boolean isXml(); + + public abstract int line(); + } + +} diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java index d5b84337ae9..0e5f054ff44 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/InstanceValidator.java @@ -1,3710 +1,3732 @@ -package org.hl7.fhir.r4.validation; - -import static org.apache.commons.lang3.StringUtils.isBlank; -import static org.apache.commons.lang3.StringUtils.isNotBlank; - -import java.io.IOException; -import java.io.InputStream; -import java.util.*; - -import org.apache.commons.lang3.StringUtils; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.exceptions.*; -import org.hl7.fhir.r4.conformance.ProfileUtilities; -import org.hl7.fhir.r4.context.IWorkerContext; -import org.hl7.fhir.r4.context.IWorkerContext.ValidationResult; -import org.hl7.fhir.r4.elementmodel.*; -import org.hl7.fhir.r4.elementmodel.Element; -import org.hl7.fhir.r4.elementmodel.Element.SpecialElement; -import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat; -import org.hl7.fhir.r4.elementmodel.ParserBase.ValidationPolicy; -import org.hl7.fhir.r4.formats.FormatUtilities; -import org.hl7.fhir.r4.model.*; -import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; -import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent; -import org.hl7.fhir.r4.model.ElementDefinition.*; -import org.hl7.fhir.r4.model.Enumeration; -import org.hl7.fhir.r4.model.Enumerations.BindingStrength; -import org.hl7.fhir.r4.model.Questionnaire.*; -import org.hl7.fhir.r4.model.StructureDefinition.*; -import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent; -import org.hl7.fhir.r4.utils.*; -import org.hl7.fhir.r4.utils.FHIRLexer.FHIRLexerException; -import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext; -import org.hl7.fhir.r4.utils.ValidationProfileSet.ProfileRegistration; -import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.utilities.validation.ValidationMessage; -import org.hl7.fhir.utilities.validation.ValidationMessage.*; -import org.hl7.fhir.utilities.xhtml.NodeType; -import org.hl7.fhir.utilities.xhtml.XhtmlNode; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; - -import ca.uhn.fhir.util.ObjectUtil; - - -/** - * Thinking of using this in a java program? Don't! - * You should use on of the wrappers instead. Either in HAPI, or use ValidationEngine - * - * @author Grahame Grieve - * - */ -/* - * todo: - * check urn's don't start oid: or uuid: - */ -public class InstanceValidator extends BaseValidator implements IResourceValidator { - - - private class ValidatorHostContext { - private Object appContext; - private Element container; // bundle, or parameters - private Element resource; - public ValidatorHostContext(Object appContext) { - this.appContext = appContext; - } - public ValidatorHostContext(Object appContext, Element element) { - this.appContext = appContext; - this.resource = element; - } - - public ValidatorHostContext forContained(Element element) { - ValidatorHostContext res = new ValidatorHostContext(appContext); - res.resource = element; - return res; - } - } - - private class ValidatorHostServices implements IEvaluationContext { - - @Override - public Base resolveConstant(Object appContext, String name) throws PathEngineException { - ValidatorHostContext c = (ValidatorHostContext) appContext; - if (externalHostServices != null) - return externalHostServices.resolveConstant(c.appContext, name); - else - return null; - } - - @Override - public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException { - ValidatorHostContext c = (ValidatorHostContext) appContext; - if (externalHostServices != null) - return externalHostServices.resolveConstantType(c.appContext, name); - else - return null; - } - - @Override - public boolean log(String argument, List<Base> focus) { - if (externalHostServices != null) - return externalHostServices.log(argument, focus); - else - return false; - } - - @Override - public FunctionDetails resolveFunction(String functionName) { - throw new Error("Not done yet"); - } - - @Override - public TypeDetails checkFunction(Object appContext, String functionName, List<TypeDetails> parameters) throws PathEngineException { - throw new Error("Not done yet"); - } - - @Override - public List<Base> executeFunction(Object appContext, String functionName, List<List<Base>> parameters) { - throw new Error("Not done yet"); - } - - @Override - public Base resolveReference(Object appContext, String url) { - ValidatorHostContext c = (ValidatorHostContext) appContext; - if (c.container != null || externalHostServices == null) - throw new Error("Not done yet - resolve "+url+" locally"); - else - return externalHostServices.resolveReference(c.appContext, url); - - } - - } - - private IWorkerContext context; - private FHIRPathEngine fpe; - - // configuration items - private CheckDisplayOption checkDisplay; - private boolean anyExtensionsAllowed; - private boolean errorForUnknownProfiles; - private boolean noInvariantChecks; - private boolean noTerminologyChecks; - private BestPracticeWarningLevel bpWarnings; - - private List<String> extensionDomains = new ArrayList<String>(); - - private IdStatus resourceIdRule; - private boolean allowXsiLocation; - - // used during the build process to keep the overall volume of messages down - private boolean suppressLoincSnomedMessages; - - private Bundle logical; - - // time tracking - private long overall = 0; - private long txTime = 0; - private long sdTime = 0; - private long loadTime = 0; - private long fpeTime = 0; - - private boolean noBindingMsgSuppressed; - private HashMap<Element, ResourceProfiles> resourceProfilesMap; - private IValidatorResourceFetcher fetcher; - long time = 0; - private ValidationProfileSet providedProfiles; - private IEvaluationContext externalHostServices; - - /* - * Keeps track of whether a particular profile has been checked or not yet - */ - private class ProfileUsage { - private StructureDefinition profile; - private boolean checked; - - public ProfileUsage(StructureDefinition profile) { - this.profile = profile; - this.checked = false; - } - - public boolean isChecked() { - return checked; - } - - public void setChecked() { - this.checked = true; - } - - public StructureDefinition getProfile() { - return profile; - } - } - - /* - * Keeps track of all profiles associated with a resource element and whether the resource has been checked against those profiles yet - */ - public class ResourceProfiles { - private Element resource; - private Element owner; - private NodeStack stack; - private HashMap<StructureDefinition, ProfileUsage> profiles; - private boolean processed; - - public ResourceProfiles(Element resource, NodeStack stack) { - this.resource = resource; - if (this.resource.getName().equals("contained")) - this.owner = stack.parent.element; - else - this.owner = resource; - this.stack = stack; - this.profiles = new HashMap<StructureDefinition, ProfileUsage>(); - this.processed = false; - } - - public boolean isProcessed() { - return processed; - } - - public void setProcessed() { - processed = true; - } - - public NodeStack getStack() { - return stack; - } - - public Element getOwner() { - return owner; - } - - public boolean hasProfiles() { - return !profiles.isEmpty(); - } - - public void addProfiles(List<ValidationMessage> errors, ValidationProfileSet profiles, String path, Element element, boolean external) throws FHIRException { - for (ProfileRegistration profile : profiles.getCanonical()) { - StructureDefinition sd = profiles.fetch(profile.getProfile()); - if (sd == null) - sd = context.fetchResource(StructureDefinition.class, profile.getProfile()); - if (sd == null) { - errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.UNKNOWN, path, "Unable to locate profile "+profile.getProfile(), external ? IssueSeverity.ERROR : IssueSeverity.WARNING)); - } else if (!sd.getType().equals(element.fhirType())) { - boolean ok = false; - if (element.fhirType().equals("Bundle")) { // special case: if the profile type isn't 'Bundle', then the profile applies to the first resource - List<Element> entries = element.getChildren("entry"); - if (entries.size() > 0) { - Element res = entries.get(0).getNamedChild("resource"); - if (res != null) { - ok = true; - // addProfile(errors, profile.getProfile(), profile.isError(), path, res); ggtodo: we need to go add this to a different profile - } - } - } - - if (!ok) - errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.UNKNOWN, path, "Profile mismatch on type for "+profile.getProfile()+": the profile constrains "+sd.getType()+" but the element is "+element.fhirType(), IssueSeverity.ERROR)); - } else - addProfile(errors, profile.getProfile(), profile.isError(), path, element); - } - } - - public boolean addProfile(List<ValidationMessage> errors, String profile, boolean error, String path, Element element) { - String effectiveProfile = profile; - String version = null; - if (profile.contains("|")) { - effectiveProfile = profile.substring(0, profile.indexOf('|')); - version = profile.substring(profile.indexOf('|')+1); - } - StructureDefinition sd = null; - if (providedProfiles != null) - sd = providedProfiles.fetch(effectiveProfile); - if (sd == null) - sd = context.fetchResource(StructureDefinition.class, effectiveProfile); - - if (warningOrError(error, errors, IssueType.INVALID, element.line(), element.col(), path, sd != null, "StructureDefinition reference \"{0}\" could not be resolved", profile)) { - if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, version==null || (sd.getVersion()!=null && sd.getVersion().equals(version)), - "Referenced version " + version + " does not match found version " + sd.getVersion() + " for profile " + sd.getUrl(), profile)) { - if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, sd.hasSnapshot(), - "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) { - if (!profiles.containsKey(sd)) { - profiles.put(sd, new ProfileUsage(sd)); - addAncestorProfiles(sd); - return true; - } - } - } - } - return false; - } - - public void addAncestorProfiles(StructureDefinition sd) { - if (sd.hasDerivation() && sd.getDerivation().equals(StructureDefinition.TypeDerivationRule.CONSTRAINT)) { - StructureDefinition parentSd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); - if (parentSd != null && !profiles.containsKey(parentSd)) { - ProfileUsage pu = new ProfileUsage(parentSd); - pu.setChecked(); // We're going to check the child, so no need to check the parent - profiles.put(parentSd, pu); - } - } - } - - public List<ProfileUsage> uncheckedProfiles() { - List<ProfileUsage> uncheckedProfiles = new ArrayList<ProfileUsage>(); - for (ProfileUsage profileUsage : profiles.values()) { - if (!profileUsage.isChecked()) - uncheckedProfiles.add(profileUsage); - } - return uncheckedProfiles; - } - - public boolean hasUncheckedProfiles() { - return !uncheckedProfiles().isEmpty(); - } - - public void checkProfile(StructureDefinition profile) { - ProfileUsage profileUsage = profiles.get(profile); - if (profileUsage==null) - throw new Error("Can't check profile that hasn't been added: " + profile.getUrl()); - else - profileUsage.setChecked(); - } - } - - public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices) { - super(); - this.context = theContext; - this.externalHostServices = hostServices; - fpe = new FHIRPathEngine(context); - fpe.setHostServices(new ValidatorHostServices()); - source = Source.InstanceValidator; - } - - @Override - public boolean isNoInvariantChecks() { - return noInvariantChecks; - } - - @Override - public IResourceValidator setNoInvariantChecks(boolean value) { - this.noInvariantChecks = value; - return this; - } - - public IValidatorResourceFetcher getFetcher() { - return this.fetcher; - } - - public IResourceValidator setFetcher(IValidatorResourceFetcher value) { - this.fetcher = value; - return this; - } - - private boolean allowUnknownExtension(String url) { - if (url.contains("example.org") || url.contains("acme.com") || url.contains("nema.org") || url.startsWith("http://hl7.org/fhir/tools/StructureDefinition/") || url.equals("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression")) - // Added structuredefinition-expression explicitly because it wasn't defined in the version of the spec it needs to be used with - return true; - for (String s : extensionDomains) - if (url.startsWith(s)) - return true; - return anyExtensionsAllowed; - } - - private boolean isKnownExtension(String url) { - // Added structuredefinition-expression explicitly because it wasn't defined in the version of the spec it needs to be used with - if (url.contains("example.org") || url.contains("acme.com") || url.contains("nema.org") || url.startsWith("http://hl7.org/fhir/tools/StructureDefinition/") || url.equals("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression")) - return true; - for (String s : extensionDomains) - if (url.startsWith(s)) - return true; - return false; - } - - private void bpCheck(List<ValidationMessage> errors, IssueType invalid, int line, int col, String literalPath, boolean test, String message) { - if (bpWarnings != null) { - switch (bpWarnings) { - case Error: - rule(errors, invalid, line, col, literalPath, test, message); - case Warning: - warning(errors, invalid, line, col, literalPath, test, message); - case Hint: - hint(errors, invalid, line, col, literalPath, test, message); - default: // do nothing - } - } - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, InputStream stream, FhirFormat format) throws FHIRException, IOException { - return validate(appContext, errors, stream, format, new ValidationProfileSet()); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, InputStream stream, FhirFormat format, String profile) throws FHIRException, IOException { - return validate(appContext, errors, stream, format, new ValidationProfileSet(profile, true)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, InputStream stream, FhirFormat format, StructureDefinition profile) throws FHIRException, IOException { - return validate(appContext, errors, stream, format, new ValidationProfileSet(profile)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, InputStream stream, FhirFormat format, ValidationProfileSet profiles) throws FHIRException, IOException { - ParserBase parser = Manager.makeParser(context, format); - if (parser instanceof XmlParser) - ((XmlParser) parser).setAllowXsiLocation(allowXsiLocation); - parser.setupValidation(ValidationPolicy.EVERYTHING, errors); - long t = System.nanoTime(); - Element e = parser.parse(stream); - loadTime = System.nanoTime() - t; - if (e != null) - validate(appContext, errors, e, profiles); - return e; - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Resource resource) throws FHIRException, IOException { - return validate(appContext, errors, resource, new ValidationProfileSet()); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Resource resource, String profile) throws FHIRException, IOException { - return validate(appContext, errors, resource, new ValidationProfileSet(profile, true)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Resource resource, StructureDefinition profile) throws FHIRException, IOException { - return validate(appContext, errors, resource, new ValidationProfileSet(profile)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Resource resource, ValidationProfileSet profiles) throws FHIRException, IOException { - long t = System.nanoTime(); - Element e = new ObjectConverter(context).convert(resource); - loadTime = System.nanoTime() - t; - validate(appContext, errors, e, profiles); - return e; - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, org.w3c.dom.Element element) throws FHIRException, IOException { - return validate(appContext, errors, element, new ValidationProfileSet()); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, org.w3c.dom.Element element, String profile) throws FHIRException, IOException { - return validate(appContext, errors, element, new ValidationProfileSet(profile, true)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, org.w3c.dom.Element element, StructureDefinition profile) throws FHIRException, IOException { - return validate(appContext, errors, element, new ValidationProfileSet(profile)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, org.w3c.dom.Element element, ValidationProfileSet profiles) throws FHIRException, IOException { - XmlParser parser = new XmlParser(context); - parser.setupValidation(ValidationPolicy.EVERYTHING, errors); - long t = System.nanoTime(); - Element e = parser.parse(element); - loadTime = System.nanoTime() - t; - if (e != null) - validate(appContext, errors, e, profiles); - return e; - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Document document) throws FHIRException, IOException { - return validate(appContext, errors, document, new ValidationProfileSet()); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Document document, String profile) throws FHIRException, IOException { - return validate(appContext, errors, document, new ValidationProfileSet(profile, true)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Document document, StructureDefinition profile) throws FHIRException, IOException { - return validate(appContext, errors, document, new ValidationProfileSet(profile)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Document document, ValidationProfileSet profiles) throws FHIRException, IOException { - XmlParser parser = new XmlParser(context); - parser.setupValidation(ValidationPolicy.EVERYTHING, errors); - long t = System.nanoTime(); - Element e = parser.parse(document); - loadTime = System.nanoTime() - t; - if (e != null) - validate(appContext, errors, e, profiles); - return e; - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, JsonObject object) throws FHIRException, IOException { - return validate(appContext, errors, object, new ValidationProfileSet()); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, JsonObject object, String profile) throws FHIRException, IOException { - return validate(appContext, errors, object, new ValidationProfileSet(profile, true)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws FHIRException, IOException { - return validate(appContext, errors, object, new ValidationProfileSet(profile)); - } - - @Override - public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, JsonObject object, ValidationProfileSet profiles) throws FHIRException, IOException { - JsonParser parser = new JsonParser(context); - parser.setupValidation(ValidationPolicy.EVERYTHING, errors); - long t = System.nanoTime(); - Element e = parser.parse(object); - loadTime = System.nanoTime() - t; - if (e != null) - validate(appContext, errors, e, profiles); - return e; - } - - @Override - public void validate(Object appContext, List<ValidationMessage> errors, Element element) throws FHIRException, IOException { - ValidationProfileSet profileSet = new ValidationProfileSet(); - validate(appContext, errors, element, profileSet); - } - - private void validateRemainder(Object appContext, List<ValidationMessage> errors) throws IOException, FHIRException { - boolean processedResource; - do { - processedResource = false; - Set<Element> keys = new HashSet<Element>(); - keys.addAll(resourceProfilesMap.keySet()); - for (Element resource : keys) { - ResourceProfiles rp = resourceProfilesMap.get(resource); - if (rp.hasUncheckedProfiles()) { - processedResource = true; - start(new ValidatorHostContext(appContext), errors, rp.getOwner(), resource, null, rp.getStack()); - } - } - } while (processedResource); - } - - @Override - public void validate(Object appContext, List<ValidationMessage> errors, Element element, String profile) throws FHIRException, IOException { - validate(appContext, errors, element, new ValidationProfileSet(profile, true)); - } - - @Override - public void validate(Object appContext, List<ValidationMessage> errors, Element element, StructureDefinition profile) throws FHIRException, IOException { - validate(appContext, errors, element, new ValidationProfileSet(profile)); - } - - @Override - public void validate(Object appContext, List<ValidationMessage> errors, Element element, ValidationProfileSet profiles) throws FHIRException, IOException { - // this is the main entry point; all the other entry points end up here coming here... - providedProfiles = profiles; - long t = System.nanoTime(); - boolean isRoot = false; - if (resourceProfilesMap == null) { - resourceProfilesMap = new HashMap<Element, ResourceProfiles>(); - isRoot = true; - } - validateResource(new ValidatorHostContext(appContext, element), errors, element, element, null, profiles, resourceIdRule, new NodeStack(element), true); - if (isRoot) { - validateRemainder(appContext, errors); - resourceProfilesMap = null; - checkElementUsage(errors, element, new NodeStack(element)); - } - overall = System.nanoTime() - t; - } - - private void checkElementUsage(List<ValidationMessage> errors, Element element, NodeStack stack) { - String elementUsage = element.getUserString("elementSupported"); - hint(errors, IssueType.INFORMATIONAL, element.line(),element.col(), stack.getLiteralPath(), elementUsage==null || elementUsage.equals("Y"), "Instance includes element that is not marked as 'mustSupport' and was validated against profiles declaring mustSupport=true"); - if (element.hasChildren()) { - String prevName = ""; - int elementCount = 0; - for (Element ce : element.getChildren()) { - if (ce.getName().equals(prevName)) - elementCount++; - else { - elementCount=1; - prevName = ce.getName(); - } - checkElementUsage(errors, ce, stack.push(ce, elementCount, null, null)); - } - } - } - - private boolean check(String v1, String v2) { - return v1 == null ? Utilities.noString(v1) : v1.equals(v2); - } - - private void checkAddress(List<ValidationMessage> errors, String path, Element focus, Address fixed) { - checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); - checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); - checkFixedValue(errors, path + ".city", focus.getNamedChild("city"), fixed.getCityElement(), "city", focus); - checkFixedValue(errors, path + ".state", focus.getNamedChild("state"), fixed.getStateElement(), "state", focus); - checkFixedValue(errors, path + ".country", focus.getNamedChild("country"), fixed.getCountryElement(), "country", focus); - checkFixedValue(errors, path + ".zip", focus.getNamedChild("zip"), fixed.getPostalCodeElement(), "postalCode", focus); - - List<Element> lines = new ArrayList<Element>(); - focus.getNamedChildren("line", lines); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, lines.size() == fixed.getLine().size(), - "Expected " + Integer.toString(fixed.getLine().size()) + " but found " + Integer.toString(lines.size()) + " line elements")) { - for (int i = 0; i < lines.size(); i++) - checkFixedValue(errors, path + ".coding", lines.get(i), fixed.getLine().get(i), "coding", focus); - } - } - - private void checkAttachment(List<ValidationMessage> errors, String path, Element focus, Attachment fixed) { - checkFixedValue(errors, path + ".contentType", focus.getNamedChild("contentType"), fixed.getContentTypeElement(), "contentType", focus); - checkFixedValue(errors, path + ".language", focus.getNamedChild("language"), fixed.getLanguageElement(), "language", focus); - checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data", focus); - checkFixedValue(errors, path + ".url", focus.getNamedChild("url"), fixed.getUrlElement(), "url", focus); - checkFixedValue(errors, path + ".size", focus.getNamedChild("size"), fixed.getSizeElement(), "size", focus); - checkFixedValue(errors, path + ".hash", focus.getNamedChild("hash"), fixed.getHashElement(), "hash", focus); - checkFixedValue(errors, path + ".title", focus.getNamedChild("title"), fixed.getTitleElement(), "title", focus); - } - - // public API - - private boolean checkCode(List<ValidationMessage> errors, Element element, String path, String code, String system, String display) throws TerminologyServiceException { - long t = System.nanoTime(); - boolean ss = context.supportsSystem(system); - txTime = txTime + (System.nanoTime() - t); - if (ss) { - t = System.nanoTime(); - ValidationResult s = context.validateCode(system, code, display); - txTime = txTime + (System.nanoTime() - t); - if (s == null) - return true; - if (s.isOk()) { - if (s.getMessage() != null) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); - return true; - } - if (s.getSeverity() == IssueSeverity.INFORMATION) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); - else if (s.getSeverity() == IssueSeverity.WARNING) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); - else - return rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); - return true; - } else if (system.startsWith("http://hl7.org/fhir")) { - if (system.equals("http://hl7.org/fhir/sid/icd-10")) - return true; // else don't check ICD-10 (for now) - else { - CodeSystem cs = getCodeSystem(system); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs != null, "Unknown Code System " + system)) { - ConceptDefinitionComponent def = getCodeDefinition(cs, code); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, def != null, "Unknown Code (" + system + "#" + code + ")")) - return warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, display == null || display.equals(def.getDisplay()), "Display should be '" + def.getDisplay() + "'"); - } - return false; - } - } else if (context.isNoTerminologyServer() && Utilities.existsInList(system, "http://loinc.org", "http://unitsofmeasure.org", "http://snomed.info/sct", "http://www.nlm.nih.gov/research/umls/rxnorm")) { - return true; // no checks in this case - } else if (startsWithButIsNot(system, "http://snomed.info/sct", "http://loinc.org", "http://unitsofmeasure.org", "http://www.nlm.nih.gov/research/umls/rxnorm")) { - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Invalid System URI: "+system); - return false; - } else { - try { - if (context.fetchResourceWithException(ValueSet.class, system) != null) { - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Invalid System URI: "+system+" - cannot use a value set URI as a system"); - return false; - } else - return true; - } - catch (Exception e) { - return true; - } - } - } - - private boolean startsWithButIsNot(String system, String... uri) { - for (String s : uri) - if (!system.equals(s) && system.startsWith(s)) - return true; - return false; - } - - private void checkCodeableConcept(List<ValidationMessage> errors, String path, Element focus, CodeableConcept fixed) { - checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); - List<Element> codings = new ArrayList<Element>(); - focus.getNamedChildren("coding", codings); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, codings.size() == fixed.getCoding().size(), - "Expected " + Integer.toString(fixed.getCoding().size()) + " but found " + Integer.toString(codings.size()) + " coding elements")) { - for (int i = 0; i < codings.size(); i++) - checkFixedValue(errors, path + ".coding", codings.get(i), fixed.getCoding().get(i), "coding", focus); - } - } - - private void checkCodeableConcept(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition theElementCntext) { - if (!noTerminologyChecks && theElementCntext != null && theElementCntext.hasBinding()) { - ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing (cc)")) { - if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { - ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl()); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { - try { - CodeableConcept cc = ObjectConverter.readAsCodeableConcept(element); - if (!cc.hasCoding()) { - if (binding.getStrength() == BindingStrength.REQUIRED) - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code is required from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code should be provided from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); - } else { - long t = System.nanoTime(); - - // Check whether the codes are appropriate for the type of binding we have - boolean bindingsOk = true; - if (binding.getStrength() != BindingStrength.EXAMPLE) { - boolean atLeastOneSystemIsSupported = false; - for (Coding nextCoding : cc.getCoding()) { - String nextSystem = nextCoding.getSystem(); - if (isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) { - atLeastOneSystemIsSupported = true; - break; - } - } - - if (!atLeastOneSystemIsSupported && binding.getStrength() == BindingStrength.EXAMPLE) { - // ignore this since we can't validate but it doesn't matter.. - } else { - ValidationResult vr = context.validateCode(cc, valueset); - if (!vr.isOk()) { - bindingsOk = false; - if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) { - if (binding.getStrength() == BindingStrength.REQUIRED) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " and a code from this value set is required (class = "+vr.getErrorClass().toString()+")"); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { - if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) - checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), cc); - else - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " and a code should come from this value set unless it has no suitable code (class = "+vr.getErrorClass().toString()+")"); - } else if (binding.getStrength() == BindingStrength.PREFERRED) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " and a code is recommended to come from this value set (class = "+vr.getErrorClass().toString()+")"); - } else { - if (binding.getStrength() == BindingStrength.REQUIRED) - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()+", and a code from this value set is required) (codes = "+ccSummary(cc)+")"); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { - if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) - checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), cc); - else - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code) (codes = "+ccSummary(cc)+")"); - } else if (binding.getStrength() == BindingStrength.PREFERRED) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set) (codes = "+ccSummary(cc)+")"); - } - } else if (vr.getMessage()!=null) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, vr.getMessage()); - } - // Then, for any codes that are in code systems we are able - // to validate, we'll validate that the codes actually exist - if (bindingsOk) { - for (Coding nextCoding : cc.getCoding()) { - String nextCode = nextCoding.getCode(); - String nextSystem = nextCoding.getSystem(); - if (isNotBlank(nextCode) && isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) { - ValidationResult vr = context.validateCode(nextSystem, nextCode, null); - if (!vr.isOk()) { - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Code {0} is not a valid code in code system {1}", nextCode, nextSystem); - } - } - } - } - txTime = txTime + (System.nanoTime() - t); - } - } - } catch (Exception e) { - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept"); - } - } - } else if (binding.hasValueSet()) { - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); - } else if (!noBindingMsgSuppressed) { - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); - } - } - } - } - - private void checkMaxValueSet(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, Reference maxVSUrl, CodeableConcept cc) { - // TODO Auto-generated method stub - ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl()); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(maxVSUrl) + " not found")) { - try { - long t = System.nanoTime(); - ValidationResult vr = context.validateCode(cc, valueset); - txTime = txTime + (System.nanoTime() - t); - if (!vr.isOk()) { - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+", and a code from this value set is required) (codes = "+ccSummary(cc)+")"); - } - } catch (Exception e) { - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept using maxValueSet"); - } - } - } - - private void checkMaxValueSet(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, Reference maxVSUrl, Coding c) { - // TODO Auto-generated method stub - ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl()); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(maxVSUrl) + " not found")) { - try { - long t = System.nanoTime(); - ValidationResult vr = context.validateCode(c, valueset); - txTime = txTime + (System.nanoTime() - t); - if (!vr.isOk()) { - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided is not in the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+", and a code from this value set is required) (code = "+c.getSystem()+"#"+c.getCode()+")"); - } - } catch (Exception e) { - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept using maxValueSet"); - } - } - } - - private void checkMaxValueSet(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, Reference maxVSUrl, String value) { - // TODO Auto-generated method stub - ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl()); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(maxVSUrl) + " not found")) { - try { - long t = System.nanoTime(); - ValidationResult vr = context.validateCode(null, value, null, valueset); - txTime = txTime + (System.nanoTime() - t); - if (!vr.isOk()) { - if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided could not be validated against the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+"), (error = "+vr.getMessage()+")"); - else - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided is not in the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+"), and a code from this value set is required) (code = "+value+"), (error = "+vr.getMessage()+")"); - } - } catch (Exception e) { - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept using maxValueSet"); - } - } - } - - private String ccSummary(CodeableConcept cc) { - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (Coding c : cc.getCoding()) - b.append(c.getSystem()+"#"+c.getCode()); - return b.toString(); - } - - private void checkCoding(List<ValidationMessage> errors, String path, Element focus, Coding fixed) { - checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); - checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code", focus); - checkFixedValue(errors, path + ".display", focus.getNamedChild("display"), fixed.getDisplayElement(), "display", focus); - checkFixedValue(errors, path + ".userSelected", focus.getNamedChild("userSelected"), fixed.getUserSelectedElement(), "userSelected", focus); - } - - private void checkCoding(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition theElementCntext, boolean inCodeableConcept) { - String code = element.getNamedChildValue("code"); - String system = element.getNamedChildValue("system"); - String display = element.getNamedChildValue("display"); - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Coding.system must be an absolute reference, not a local reference"); - - if (system != null && code != null && !noTerminologyChecks) { - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, !isValueSet(system), "The Coding references a value set, not a code system (\""+system+"\")"); - try { - if (checkCode(errors, element, path, code, system, display)) - if (theElementCntext != null && theElementCntext.hasBinding()) { - ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing")) { - if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { - ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl()); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { - try { - Coding c = ObjectConverter.readAsCoding(element); - long t = System.nanoTime(); - ValidationResult vr = context.validateCode(c, valueset); - txTime = txTime + (System.nanoTime() - t); - if (!vr.isOk()) { - if (vr.IsNoService()) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided could not be validated in the absence of a terminology server"); - else if (vr.getErrorClass() != null && !vr.getErrorClass().isInfrastructure()) { - if (binding.getStrength() == BindingStrength.REQUIRED) - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()+", and a code from this value set is required)"); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { - if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) - checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), c); - else - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"); - } else if (binding.getStrength() == BindingStrength.PREFERRED) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"); - } else if (binding.getStrength() == BindingStrength.REQUIRED) - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The Coding provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is required from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { - if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) - checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), c); - else - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The Coding provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); - } else if (binding.getStrength() == BindingStrength.PREFERRED) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The Coding provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); - } - } catch (Exception e) { - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating Coding"); - } - } - } else if (binding.hasValueSet()) { - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); - } else if (!inCodeableConcept && !noBindingMsgSuppressed) { - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); - } - } - } - } catch (Exception e) { - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating Coding"); - } - } - } - - private boolean isValueSet(String url) { - try { - ValueSet vs = context.fetchResourceWithException(ValueSet.class, url); - return vs != null; - } catch (Exception e) { - return false; - } - } - - private void checkContactPoint(List<ValidationMessage> errors, String path, Element focus, ContactPoint fixed) { - checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); - checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); - checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); - checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period", focus); - - } - - protected void checkDeclaredProfiles(ResourceProfiles resourceProfiles, List<ValidationMessage> errors, Element resource, Element element, NodeStack stack) throws FHIRException { - Element meta = element.getNamedChild("meta"); - if (meta != null) { - List<Element> profiles = new ArrayList<Element>(); - meta.getNamedChildren("profile", profiles); - int i = 0; - for (Element profile : profiles) { - String ref = profile.primitiveValue(); - String p = stack.addToLiteralPath("meta", "profile", ":" + Integer.toString(i)); - if (rule(errors, IssueType.INVALID, element.line(), element.col(), p, !Utilities.noString(ref), "StructureDefinition reference invalid")) { - long t = System.nanoTime(); - resourceProfiles.addProfile(errors, ref, errorForUnknownProfiles, p, element); - i++; - } - } - } - } - - private StructureDefinition checkExtension(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, Element resource, Element element, ElementDefinition def, StructureDefinition profile, NodeStack stack) throws FHIRException, IOException { - String url = element.getNamedChildValue("url"); - boolean isModifier = element.getName().equals("modifierExtension"); - - long t = System.nanoTime(); - StructureDefinition ex = context.fetchResource(StructureDefinition.class, url); - sdTime = sdTime + (System.nanoTime() - t); - if (ex == null) { - if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowUnknownExtension(url), "The extension " + url + " is unknown, and not allowed here")) - hint(errors, IssueType.STRUCTURE, element.line(), element.col(), path, isKnownExtension(url), "Unknown extension " + url); - } else { - if (def.getIsModifier()) - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), - "Extension modifier mismatch: the extension element is labelled as a modifier, but the underlying extension is not"); - else - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), - "Extension modifier mismatch: the extension element is not labelled as a modifier, but the underlying extension is"); - - // two questions - // 1. can this extension be used here? - checkExtensionContext(errors, element, /* path+"[url='"+url+"']", */ ex, stack, ex.getUrl()); - - if (isModifier) - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), - "The Extension '" + url + "' must be used as a modifierExtension"); - else - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), - "The Extension '" + url + "' must not be used as an extension (it's a modifierExtension)"); - - // check the type of the extension: - Set<String> allowedTypes = listExtensionTypes(ex); - String actualType = getExtensionType(element); - if (actualType == null) - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", allowedTypes.isEmpty(), "The Extension '" + url + "' definition is for a complex extension, so it cannot contain a value"); - else - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", allowedTypes.contains(actualType), "The Extension '" + url + "' definition allows for the types "+allowedTypes.toString()+" but found type "+actualType); - - // 3. is the content of the extension valid? - validateElement(hostContext, errors, ex, ex.getSnapshot().getElement().get(0), null, null, resource, element, "Extension", stack, false); - - } - return ex; - } - - private String getExtensionType(Element element) { - for (Element e : element.getChildren()) { - if (e.getName().startsWith("value")) { - String tn = e.getName().substring(5); - String ltn = Utilities.uncapitalize(tn); - if (isPrimitiveType(ltn)) - return ltn; - else - return tn; - } - } - return null; - } - - private Set<String> listExtensionTypes(StructureDefinition ex) { - ElementDefinition vd = null; - for (ElementDefinition ed : ex.getSnapshot().getElement()) { - if (ed.getPath().startsWith("Extension.value")) { - vd = ed; - break; - } - } - Set<String> res = new HashSet<String>(); - if (vd != null && !"0".equals(vd.getMax())) { - for (TypeRefComponent tr : vd.getType()) { - res.add(tr.getCode()); - } - } - return res; - } - - private boolean checkExtensionContext(List<ValidationMessage> errors, Element element, StructureDefinition definition, NodeStack stack, String extensionParent) { - String extUrl = definition.getUrl(); - CommaSeparatedStringBuilder p = new CommaSeparatedStringBuilder(); - for (String lp : stack.getLogicalPaths()) - p.append(lp); - if (definition.getContextType() == ExtensionContext.DATATYPE) { - boolean ok = false; - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (StringType ct : definition.getContext()) { - b.append(ct.getValue()); - if (ct.getValue().equals("*") || stack.getLogicalPaths().contains(ct.getValue() + ".extension")) - ok = true; - } - return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, - "The extension " + extUrl + " is not allowed to be used on the logical path set [" + p.toString() + "] (allowed: datatype=" + b.toString() + ")"); - } else if (definition.getContextType() == ExtensionContext.EXTENSION) { - boolean ok = false; - for (StringType ct : definition.getContext()) - if (ct.getValue().equals("*") || ct.getValue().equals(extensionParent)) - ok = true; - return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, - "The extension " + extUrl + " is not allowed to be used with the extension '" + extensionParent + "'"); - } else if (definition.getContextType() == ExtensionContext.RESOURCE) { - boolean ok = false; - // String simplePath = container.getPath(); - // System.out.println(simplePath); - // if (effetive.endsWith(".extension") || simplePath.endsWith(".modifierExtension")) - // simplePath = simplePath.substring(0, simplePath.lastIndexOf('.')); - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (StringType ct : definition.getContext()) { - String c = ct.getValue(); - b.append(c); - if (c.equals("*") || stack.getLogicalPaths().contains(c + ".extension") || (c.startsWith("@") && stack.getLogicalPaths().contains(c.substring(1) + ".extension"))) - ; - ok = true; - } - return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, - "The extension " + extUrl + " is not allowed to be used on the logical path set " + p.toString() + " (allowed: resource=" + b.toString() + ")"); - } else - throw new Error("Unknown context type"); - } - // - // private String simplifyPath(String path) { - // String s = path.replace("/f:", "."); - // while (s.contains("[")) - // s = s.substring(0, s.indexOf("["))+s.substring(s.indexOf("]")+1); - // String[] parts = s.split("\\."); - // int i = 0; - // while (i < parts.length && !context.getProfiles().containsKey(parts[i].toLowerCase())) - // i++; - // if (i >= parts.length) - // throw new Error("Unable to process part "+path); - // int j = parts.length - 1; - // while (j > 0 && (parts[j].equals("extension") || parts[j].equals("modifierExtension"))) - // j--; - // StringBuilder b = new StringBuilder(); - // boolean first = true; - // for (int k = i; k <= j; k++) { - // if (k == j || !parts[k].equals(parts[k+1])) { - // if (first) - // first = false; - // else - // b.append("."); - // b.append(parts[k]); - // } - // } - // return b.toString(); - // } - // - - private void checkFixedValue(List<ValidationMessage> errors, String path, Element focus, org.hl7.fhir.r4.model.Element fixed, String propName, Element parent) { - if ((fixed == null || fixed.isEmpty()) && focus == null) - ; // this is all good - else if (fixed == null && focus != null) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, false, "Unexpected element " + focus.getName()); - else if (fixed != null && !fixed.isEmpty() && focus == null) - rule(errors, IssueType.VALUE, parent == null ? -1 : parent.line(), parent == null ? -1 : parent.col(), path, false, "Missing element '" + propName+"'"); - else { - String value = focus.primitiveValue(); - if (fixed instanceof org.hl7.fhir.r4.model.BooleanType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.BooleanType) fixed).asStringValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.BooleanType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.IntegerType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.IntegerType) fixed).asStringValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.IntegerType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.DecimalType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.DecimalType) fixed).asStringValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.DecimalType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.Base64BinaryType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.Base64BinaryType) fixed).asStringValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.Base64BinaryType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.InstantType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.InstantType) fixed).getValue().toString(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.InstantType) fixed).asStringValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.StringType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.StringType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.StringType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.UriType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.UriType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.UriType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.DateType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.DateType) fixed).getValue().toString(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.DateType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.DateTimeType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.DateTimeType) fixed).getValue().toString(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.DateTimeType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.OidType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.OidType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.OidType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.UuidType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.UuidType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.UuidType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.CodeType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.CodeType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.CodeType) fixed).getValue() + "'"); - else if (fixed instanceof org.hl7.fhir.r4.model.IdType) - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.IdType) fixed).getValue(), value), - "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.IdType) fixed).getValue() + "'"); - else if (fixed instanceof Quantity) - checkQuantity(errors, path, focus, (Quantity) fixed); - else if (fixed instanceof Address) - checkAddress(errors, path, focus, (Address) fixed); - else if (fixed instanceof ContactPoint) - checkContactPoint(errors, path, focus, (ContactPoint) fixed); - else if (fixed instanceof Attachment) - checkAttachment(errors, path, focus, (Attachment) fixed); - else if (fixed instanceof Identifier) - checkIdentifier(errors, path, focus, (Identifier) fixed); - else if (fixed instanceof Coding) - checkCoding(errors, path, focus, (Coding) fixed); - else if (fixed instanceof HumanName) - checkHumanName(errors, path, focus, (HumanName) fixed); - else if (fixed instanceof CodeableConcept) - checkCodeableConcept(errors, path, focus, (CodeableConcept) fixed); - else if (fixed instanceof Timing) - checkTiming(errors, path, focus, (Timing) fixed); - else if (fixed instanceof Period) - checkPeriod(errors, path, focus, (Period) fixed); - else if (fixed instanceof Range) - checkRange(errors, path, focus, (Range) fixed); - else if (fixed instanceof Ratio) - checkRatio(errors, path, focus, (Ratio) fixed); - else if (fixed instanceof SampledData) - checkSampledData(errors, path, focus, (SampledData) fixed); - - else - rule(errors, IssueType.EXCEPTION, focus.line(), focus.col(), path, false, "Unhandled fixed value type " + fixed.getClass().getName()); - List<Element> extensions = new ArrayList<Element>(); - focus.getNamedChildren("extension", extensions); - if (fixed.getExtension().size() == 0) { - rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == 0, "No extensions allowed"); - } else if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == fixed.getExtension().size(), - "Extensions count mismatch: expected " + Integer.toString(fixed.getExtension().size()) + " but found " + Integer.toString(extensions.size()))) { - for (Extension e : fixed.getExtension()) { - Element ex = getExtensionByUrl(extensions, e.getUrl()); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, ex != null, "Extension count mismatch: unable to find extension: " + e.getUrl())) { - checkFixedValue(errors, path, ex.getNamedChild("extension").getNamedChild("value"), e.getValue(), "extension.value", ex.getNamedChild("extension")); - } - } - } - } - } - - private void checkHumanName(List<ValidationMessage> errors, String path, Element focus, HumanName fixed) { - checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); - checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); - checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period", focus); - - List<Element> parts = new ArrayList<Element>(); - focus.getNamedChildren("family", parts); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() > 0 == fixed.hasFamily(), - "Expected " + (fixed.hasFamily() ? "1" : "0") + " but found " + Integer.toString(parts.size()) + " family elements")) { - for (int i = 0; i < parts.size(); i++) - checkFixedValue(errors, path + ".family", parts.get(i), fixed.getFamilyElement(), "family", focus); - } - focus.getNamedChildren("given", parts); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getGiven().size(), - "Expected " + Integer.toString(fixed.getGiven().size()) + " but found " + Integer.toString(parts.size()) + " given elements")) { - for (int i = 0; i < parts.size(); i++) - checkFixedValue(errors, path + ".given", parts.get(i), fixed.getGiven().get(i), "given", focus); - } - focus.getNamedChildren("prefix", parts); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getPrefix().size(), - "Expected " + Integer.toString(fixed.getPrefix().size()) + " but found " + Integer.toString(parts.size()) + " prefix elements")) { - for (int i = 0; i < parts.size(); i++) - checkFixedValue(errors, path + ".prefix", parts.get(i), fixed.getPrefix().get(i), "prefix", focus); - } - focus.getNamedChildren("suffix", parts); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getSuffix().size(), - "Expected " + Integer.toString(fixed.getSuffix().size()) + " but found " + Integer.toString(parts.size()) + " suffix elements")) { - for (int i = 0; i < parts.size(); i++) - checkFixedValue(errors, path + ".suffix", parts.get(i), fixed.getSuffix().get(i), "suffix", focus); - } - } - - private void checkIdentifier(List<ValidationMessage> errors, String path, Element element, ElementDefinition context) { - String system = element.getNamedChildValue("system"); - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Identifier.system must be an absolute reference, not a local reference"); - } - - private void checkIdentifier(List<ValidationMessage> errors, String path, Element focus, Identifier fixed) { - checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); - checkFixedValue(errors, path + ".type", focus.getNamedChild("type"), fixed.getType(), "type", focus); - checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); - checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); - checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period", focus); - checkFixedValue(errors, path + ".assigner", focus.getNamedChild("assigner"), fixed.getAssigner(), "assigner", focus); - } - - private void checkPeriod(List<ValidationMessage> errors, String path, Element focus, Period fixed) { - checkFixedValue(errors, path + ".start", focus.getNamedChild("start"), fixed.getStartElement(), "start", focus); - checkFixedValue(errors, path + ".end", focus.getNamedChild("end"), fixed.getEndElement(), "end", focus); - } - - private void checkPrimitive(Object appContext, List<ValidationMessage> errors, String path, String type, ElementDefinition context, Element e, StructureDefinition profile) throws FHIRException, IOException { - if (isBlank(e.primitiveValue())) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.hasChildren(), "primitive types must have a value or must have child extensions"); - return; - } - String regex = context.getExtensionString(ToolingExtensions.EXT_REGEX); - if (regex!=null) - regex = context.getExtensionString("http://hl7.org/fhir/StructureDefinition/regex"); - if (regex!=null) - rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().matches(regex), "Element value '" + e.primitiveValue() + "' does not meet regex '" + regex + "'"); - - if (type.equals("boolean")) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, "true".equals(e.primitiveValue()) || "false".equals(e.primitiveValue()), "boolean values must be 'true' or 'false'"); - } - if (type.equals("uri")) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.primitiveValue().startsWith("oid:"), "URI values cannot start with oid:"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.primitiveValue().startsWith("uuid:"), "URI values cannot start with uuid:"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().equals(e.primitiveValue().trim()), "URI values cannot have leading or trailing whitespace"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); - - // now, do we check the URI target? - if (fetcher != null) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, fetcher.resolveURL(appContext, path, e.primitiveValue()), "URL value '"+e.primitiveValue()+"' does not resolve"); - } - } - if (type.equalsIgnoreCase("string") && e.hasPrimitiveValue()) { - if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().length() > 0, "@value cannot be empty")) { - warning(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().trim().equals(e.primitiveValue()), "value should not start or finish with whitespace"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); - } - } - if (type.equals("dateTime")) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, - e.primitiveValue() - .matches("-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?)?)?"), - "Not a valid date time"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !hasTime(e.primitiveValue()) || hasTimeZone(e.primitiveValue()), "if a date has a time, it must have a timezone"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); - } - if (type.equals("date")) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().matches("-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1]))?)?"), - "Not a valid date"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum value of " + context.getMaxLength()); - } - if (type.equals("integer")) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxValueIntegerType() || !context.getMaxValueIntegerType().hasValue() || (context.getMaxValueIntegerType().getValue() >= new Integer(e.getValue()).intValue()), "value is greater than permitted maximum value of " + (context.hasMaxValueIntegerType() ? context.getMaxValueIntegerType() : "")); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMinValueIntegerType() || !context.getMinValueIntegerType().hasValue() || (context.getMinValueIntegerType().getValue() <= new Integer(e.getValue()).intValue()), "value is less than permitted minimum value of " + (context.hasMinValueIntegerType() ? context.getMinValueIntegerType() : "")); - } - if (type.equals("instant")) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, - e.primitiveValue().matches("-?[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"), - "The instant '" + e.primitiveValue() + "' is not valid (by regex)"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year"); - } - - if (type.equals("code") && e.primitiveValue() != null) { - // Technically, a code is restricted to string which has at least one character and no leading or trailing whitespace, and where there is no whitespace - // other than single spaces in the contents - rule(errors, IssueType.INVALID, e.line(), e.col(), path, passesCodeWhitespaceRules(e.primitiveValue()), "The code '" + e.primitiveValue() + "' is not valid (whitespace rules)"); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); - } - - if (context.hasBinding() && e.primitiveValue() != null) { - checkPrimitiveBinding(errors, path, type, context, e, profile); - } - - if (type.equals("xhtml")) { - XhtmlNode xhtml = e.getXhtml(); - if (xhtml != null) { // if it is null, this is an error already noted in the parsers - // check that the namespace is there and correct. - String ns = xhtml.getNsDecl(); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, FormatUtilities.XHTML_NS.equals(ns), "Wrong namespace on the XHTML ('"+ns+"')"); - // check that inner namespaces are all correct - checkInnerNS(errors, e, path, xhtml.getChildNodes()); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, "div".equals(xhtml.getName()), "Wrong name on the XHTML ('"+ns+"') - must start with div"); - // check that no illegal elements and attributes have been used - checkInnerNames(errors, e, path, xhtml.getChildNodes()); - } - } - - if (context.hasFixed()) - checkFixedValue(errors,path,e, context.getFixed(), context.getSliceName(), null); - - // for nothing to check - } - - private void checkInnerNames(List<ValidationMessage> errors, Element e, String path, List<XhtmlNode> list) { - for (XhtmlNode node : list) { - if (node.getNodeType() == NodeType.Element) { - rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.existsInList(node.getName(), - "p", "br", "div", "h1", "h2", "h3", "h4", "h5", "h6", "a", "span", "b", "em", "i", "strong", - "small", "big", "tt", "small", "dfn", "q", "var", "abbr", "acronym", "cite", "blockquote", "hr", "address", "bdo", "kbd", "q", "sub", "sup", - "ul", "ol", "li", "dl", "dt", "dd", "pre", "table", "caption", "colgroup", "col", "thead", "tr", "tfoot", "tbody", "th", "td", - "code", "samp", "img", "map", "area" - - ), "Illegal element name in the XHTML ('"+node.getName()+"')"); - for (String an : node.getAttributes().keySet()) { - boolean ok = an.startsWith("xmlns") || Utilities.existsInList(an, - "title", "style", "class", "id", "lang", "xml:lang", "dir", "accesskey", "tabindex", - // tables - "span", "width", "align", "valign", "char", "charoff", "abbr", "axis", "headers", "scope", "rowspan", "colspan") || - - Utilities.existsInList(node.getName()+"."+an, "a.href", "a.name", "img.src", "img.border", "div.xmlns", "blockquote.cite", "q.cite", - "a.charset", "a.type", "a.name", "a.href", "a.hreflang", "a.rel", "a.rev", "a.shape", "a.coords", "img.src", - "img.alt", "img.longdesc", "img.height", "img.width", "img.usemap", "img.ismap", "map.name", "area.shape", - "area.coords", "area.href", "area.nohref", "area.alt", "table.summary", "table.width", "table.border", - "table.frame", "table.rules", "table.cellspacing", "table.cellpadding", "pre.space" - ); - if (!ok) - rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Illegal attribute name in the XHTML ('"+an+"' on '"+node.getName()+"')"); - } - checkInnerNames(errors, e, path, node.getChildNodes()); - } - } - } - - private void checkInnerNS(List<ValidationMessage> errors, Element e, String path, List<XhtmlNode> list) { - for (XhtmlNode node : list) { - if (node.getNodeType() == NodeType.Element) { - String ns = node.getNsDecl(); - rule(errors, IssueType.INVALID, e.line(), e.col(), path, ns == null || FormatUtilities.XHTML_NS.equals(ns), "Wrong namespace on the XHTML ('"+ns+"')"); - checkInnerNS(errors, e, path, node.getChildNodes()); - } - } - } - - private void checkPrimitiveBinding(List<ValidationMessage> errors, String path, String type, ElementDefinition elementContext, Element element, StructureDefinition profile) { - // We ignore bindings that aren't on string, uri or code - if (!element.hasPrimitiveValue() || !("code".equals(type) || "string".equals(type) || "uri".equals(type))) { - return; - } - if (noTerminologyChecks) - return; - - String value = element.primitiveValue(); - // System.out.println("check "+value+" in "+path); - - // firstly, resolve the value set - ElementDefinitionBindingComponent binding = elementContext.getBinding(); - if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { - ValueSet vs = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl()); - if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, "ValueSet {0} not found", describeReference(binding.getValueSet()))) { - long t = System.nanoTime(); - ValidationResult vr = context.validateCode(null, value, null, vs); - txTime = txTime + (System.nanoTime() - t); - if (vr != null && !vr.isOk()) { - if (vr.IsNoService()) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') could not be validated in the absence of a terminology server"); - else if (binding.getStrength() == BindingStrength.REQUIRED) - rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is required from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); - else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { - if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) - checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), value); - else - warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code should come from this value set unless it has no suitable code)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); - } else if (binding.getStrength() == BindingStrength.PREFERRED) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is recommended to come from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); - } - } - } else if (!noBindingMsgSuppressed) - hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, !type.equals("code"), "Binding has no source, so can't be checked"); - } - - private void checkQuantity(List<ValidationMessage> errors, String path, Element focus, Quantity fixed) { - checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); - checkFixedValue(errors, path + ".comparator", focus.getNamedChild("comparator"), fixed.getComparatorElement(), "comparator", focus); - checkFixedValue(errors, path + ".units", focus.getNamedChild("unit"), fixed.getUnitElement(), "units", focus); - checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); - checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code", focus); - } - - // implementation - - private void checkRange(List<ValidationMessage> errors, String path, Element focus, Range fixed) { - checkFixedValue(errors, path + ".low", focus.getNamedChild("low"), fixed.getLow(), "low", focus); - checkFixedValue(errors, path + ".high", focus.getNamedChild("high"), fixed.getHigh(), "high", focus); - - } - - private void checkRatio(List<ValidationMessage> errors, String path, Element focus, Ratio fixed) { - checkFixedValue(errors, path + ".numerator", focus.getNamedChild("numerator"), fixed.getNumerator(), "numerator", focus); - checkFixedValue(errors, path + ".denominator", focus.getNamedChild("denominator"), fixed.getDenominator(), "denominator", focus); - } - - private void checkReference(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition container, String parentType, NodeStack stack) throws FHIRException, IOException { - Reference reference = ObjectConverter.readAsReference(element); - - String ref = reference.getReference(); - if (Utilities.noString(ref)) { - if (Utilities.noString(reference.getIdentifier().getSystem()) && Utilities.noString(reference.getIdentifier().getValue())) { - warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, !Utilities.noString(element.getNamedChildValue("display")), "A Reference without an actual reference or identifier should have a display"); - } - return; - } - - Element we = localResolve(ref, stack, errors, path); - String refType; - if (ref.startsWith("#")) { - refType = "contained"; - } else { - if (we == null) { - refType = "remote"; - } else { - refType = "bundle"; - } - } - ReferenceValidationPolicy pol = refType.equals("contained") ? ReferenceValidationPolicy.CHECK_VALID : fetcher == null ? ReferenceValidationPolicy.IGNORE : fetcher.validationPolicy(hostContext.appContext, path, ref); - - if (pol.checkExists()) { - if (we == null) { - if (fetcher == null) - throw new FHIRException("Resource resolution services not provided"); - we = fetcher.fetch(hostContext.appContext, ref); - } - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, we != null, "Unable to resolve resource '"+ref+"'"); - } - - String ft; - if (we != null) - ft = we.getType(); - else - ft = tryParse(ref); - - if (we != null && pol.checkType()) { - if (warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ft!=null, "Unable to determine type of target resource")) { - boolean ok = false; - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (TypeRefComponent type : container.getType()) { - if (!ok && type.getCode().equals("Reference")) { - // we validate as much as we can. First, can we infer a type from the profile? - if (!type.hasTargetProfile() || type.getTargetProfile().equals("http://hl7.org/fhir/StructureDefinition/Resource")) - ok = true; - else { - String pr = type.getTargetProfile(); - - String bt = getBaseType(profile, pr); - StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + bt); - if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, bt != null, "Unable to resolve the profile reference '" + pr + "'")) { - b.append(bt); - ok = bt.equals(ft); - if (ok && we!=null && pol.checkValid()) { - doResourceProfile(hostContext, we, pr, errors, stack.push(we, -1, null, null), path, element); - } - } else - ok = true; // suppress following check - if (ok && type.hasAggregation()) { - boolean modeOk; - for (Enumeration<AggregationMode> mode : type.getAggregation()) { - if (mode.getValue().equals(AggregationMode.CONTAINED) && refType.equals("contained")) - ok = true; - else if (mode.getValue().equals(AggregationMode.BUNDLED) && refType.equals("bundled")) - ok = true; - else if (mode.getValue().equals(AggregationMode.REFERENCED) && (refType.equals("bundled")||refType.equals("remote"))) - ok = true; - } - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ok, "Reference is " + refType + " which isn't supported by the specified aggregation mode(s) for the reference"); - } - } - } - if (!ok && type.getCode().equals("*")) { - ok = true; // can refer to anything - } - } - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ok, "Invalid Resource target type. Found " + ft + ", but expected one of (" + b.toString() + ")"); - } - } - if (pol == ReferenceValidationPolicy.CHECK_VALID) { - // todo.... - } - } - - private void doResourceProfile(ValidatorHostContext hostContext, Element resource, String profile, List<ValidationMessage> errors, NodeStack stack, String path, Element element) throws FHIRException, IOException { - ResourceProfiles resourceProfiles = addResourceProfile(errors, resource, profile, path, element, stack); - if (resourceProfiles.isProcessed()) { - start(hostContext, errors, resource, resource, null, stack); - } - } - - private ResourceProfiles getResourceProfiles(Element resource, NodeStack stack) { - ResourceProfiles resourceProfiles = resourceProfilesMap.get(resource); - if (resourceProfiles==null) { - resourceProfiles = new ResourceProfiles(resource, stack); - resourceProfilesMap.put(resource, resourceProfiles); - } - return resourceProfiles; - } - - private ResourceProfiles addResourceProfile(List<ValidationMessage> errors, Element resource, String profile, String path, Element element, NodeStack stack) { - ResourceProfiles resourceProfiles = getResourceProfiles(resource, stack); - resourceProfiles.addProfile(errors, profile, errorForUnknownProfiles, path, element); - return resourceProfiles; - } - - private String checkResourceType(String type) { - long t = System.nanoTime(); - try { - if (context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type) != null) - return type; - else - return null; - } finally { - sdTime = sdTime + (System.nanoTime() - t); - } - } - - private void checkSampledData(List<ValidationMessage> errors, String path, Element focus, SampledData fixed) { - checkFixedValue(errors, path + ".origin", focus.getNamedChild("origin"), fixed.getOrigin(), "origin", focus); - checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriodElement(), "period", focus); - checkFixedValue(errors, path + ".factor", focus.getNamedChild("factor"), fixed.getFactorElement(), "factor", focus); - checkFixedValue(errors, path + ".lowerLimit", focus.getNamedChild("lowerLimit"), fixed.getLowerLimitElement(), "lowerLimit", focus); - checkFixedValue(errors, path + ".upperLimit", focus.getNamedChild("upperLimit"), fixed.getUpperLimitElement(), "upperLimit", focus); - checkFixedValue(errors, path + ".dimensions", focus.getNamedChild("dimensions"), fixed.getDimensionsElement(), "dimensions", focus); - checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data", focus); - } - - private void checkTiming(List<ValidationMessage> errors, String path, Element focus, Timing fixed) { - checkFixedValue(errors, path + ".repeat", focus.getNamedChild("repeat"), fixed.getRepeat(), "value", focus); - - List<Element> events = new ArrayList<Element>(); - focus.getNamedChildren("event", events); - if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, events.size() == fixed.getEvent().size(), - "Expected " + Integer.toString(fixed.getEvent().size()) + " but found " + Integer.toString(events.size()) + " event elements")) { - for (int i = 0; i < events.size(); i++) - checkFixedValue(errors, path + ".event", events.get(i), fixed.getEvent().get(i), "event", focus); - } - } - - private boolean codeinExpansion(ValueSetExpansionContainsComponent cnt, String system, String code) { - for (ValueSetExpansionContainsComponent c : cnt.getContains()) { - if (code.equals(c.getCode()) && system.equals(c.getSystem().toString())) - return true; - if (codeinExpansion(c, system, code)) - return true; - } - return false; - } - - private boolean codeInExpansion(ValueSet vs, String system, String code) { - for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) { - if (code.equals(c.getCode()) && (system == null || system.equals(c.getSystem()))) - return true; - if (codeinExpansion(c, system, code)) - return true; - } - return false; - } - - private String describeReference(Type reference) { - if (reference == null) - return "null"; - if (reference instanceof UriType) - return ((UriType) reference).getValue(); - if (reference instanceof Reference) - return ((Reference) reference).getReference(); - return "??"; - } - - private String describeTypes(List<TypeRefComponent> types) { - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (TypeRefComponent t : types) { - b.append(t.getCode()); - } - return b.toString(); - } - - protected ElementDefinition findElement(StructureDefinition profile, String name) { - for (ElementDefinition c : profile.getSnapshot().getElement()) { - if (c.getPath().equals(name)) { - return c; - } - } - return null; - } - - public BestPracticeWarningLevel getBasePracticeWarningLevel() { - return bpWarnings; - } - - private String getBaseType(StructureDefinition profile, String pr) { - StructureDefinition p = resolveProfile(profile, pr); - if (p == null) - return null; - else - return p.getType(); - } - - @Override - public CheckDisplayOption getCheckDisplay() { - return checkDisplay; - } - - // private String findProfileTag(Element element) { - // String uri = null; - // List<Element> list = new ArrayList<Element>(); - // element.getNamedChildren("category", list); - // for (Element c : list) { - // if ("http://hl7.org/fhir/tag/profile".equals(c.getAttribute("scheme"))) { - // uri = c.getAttribute("term"); - // } - // } - // return uri; - // } - - private ConceptDefinitionComponent getCodeDefinition(ConceptDefinitionComponent c, String code) { - if (code.equals(c.getCode())) - return c; - for (ConceptDefinitionComponent g : c.getConcept()) { - ConceptDefinitionComponent r = getCodeDefinition(g, code); - if (r != null) - return r; - } - return null; - } - - private ConceptDefinitionComponent getCodeDefinition(CodeSystem cs, String code) { - for (ConceptDefinitionComponent c : cs.getConcept()) { - ConceptDefinitionComponent r = getCodeDefinition(c, code); - if (r != null) - return r; - } - return null; - } - - private Element getContainedById(Element container, String id) { - List<Element> contained = new ArrayList<Element>(); - container.getNamedChildren("contained", contained); - for (Element we : contained) { - if (id.equals(we.getNamedChildValue("id"))) - return we; - } - return null; - } - - public IWorkerContext getContext() { - return context; - } - - private ElementDefinition getCriteriaForDiscriminator(String path, ElementDefinition element, String discriminator, StructureDefinition profile) throws DefinitionException, FHIRLexerException { - if ("value".equals(discriminator) && element.hasFixed()) - return element; - - ExpressionNode expr = fpe.parse(discriminator); - long t2 = System.nanoTime(); - ElementDefinition ed = fpe.evaluateDefinition(expr, profile, element); - sdTime = sdTime + (System.nanoTime() - t2); - return ed; - } - - - private Element getExtensionByUrl(List<Element> extensions, String urlSimple) { - for (Element e : extensions) { - if (urlSimple.equals(e.getNamedChildValue("url"))) - return e; - } - return null; - } - - public List<String> getExtensionDomains() { - return extensionDomains; - } - - private Element getFromBundle(Element bundle, String ref, String fullUrl, List<ValidationMessage> errors, String path) { - String targetUrl = null; - String version = ""; - if (ref.startsWith("http") || ref.startsWith("urn")) { - // We've got an absolute reference, no need to calculate - if (ref.contains("/_history/")) { - targetUrl = ref.substring(0, ref.indexOf("/_history/") - 1); - version = ref.substring(ref.indexOf("/_history/") + 10); - } else - targetUrl = ref; - - } else if (fullUrl == null) { - //This isn't a problem for signatures - if it's a signature, we won't have a resolution for a relative reference. For anything else, this is an error - rule(errors, IssueType.REQUIRED, -1, -1, path, path.startsWith("Bundle.signature"), "Relative Reference appears inside Bundle whose entry is missing a fullUrl"); - return null; - - } else if (ref.split("/").length!=2) { - rule(errors, IssueType.INVALID, -1, -1, path, false, "Relative URLs must be of the format [ResourceName]/[id]. Encountered " + ref); - return null; - - } else { - String base = ""; - if (fullUrl.startsWith("urn")) { - String[] parts = fullUrl.split("\\:"); - for (int i=0; i < parts.length-1; i++) { - base = base + parts[i] + ":"; - } - } else { - String[] parts; - parts = fullUrl.split("/"); - for (int i=0; i < parts.length-2; i++) { - base = base + parts[i] + "/"; - } - } - - String id = null; - if (ref.contains("/_history/")) { - version = ref.substring(ref.indexOf("/_history/") + 10); - id = ref.substring(0, ref.indexOf("/history/")-1); - } else if (base.startsWith("urn")) - id = ref.split("/")[1]; - else - id = ref; - - targetUrl = base + id; - } - - List<Element> entries = new ArrayList<Element>(); - bundle.getNamedChildren("entry", entries); - Element match = null; - for (Element we : entries) { - if (we.getChildValue("fullUrl").equals(targetUrl)) { - Element r = we.getNamedChild("resource"); - if (version.isEmpty()) { - rule(errors, IssueType.FORBIDDEN, -1, -1, path, match==null, "Multiple matches in bundle for reference " + ref); - match = r; - } else { - try { - if (r.getChildren("meta").get(0).getChildValue("versionId").equals(version)) { - rule(errors, IssueType.FORBIDDEN, -1, -1, path, match==null, "Multiple matches in bundle for reference " + ref); - match = r; - } - } catch (Exception e) { - warning(errors, IssueType.REQUIRED, -1, -1, path, r.getChildren("meta").size()==1 && r.getChildren("meta").get(0).getChildValue("versionId")!=null, "Entries matching fullURL " + targetUrl + " should declare meta/versionId because there are version-specific references"); - // If one of these things is null - } - } - } - } - - warning(errors, IssueType.REQUIRED, -1, -1, path, match!=null || !targetUrl.startsWith("urn"), "URN reference is not locally contained within the bundle " + ref); - return match; - } - - private StructureDefinition getProfileForType(String type) { - if (logical != null) - for (BundleEntryComponent be : logical.getEntry()) { - if (be.hasResource() && be.getResource() instanceof StructureDefinition) { - StructureDefinition sd = (StructureDefinition) be.getResource(); - if (sd.getId().equals(type)) - return sd; - } - } - - long t = System.nanoTime(); - try { - return context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type); - } finally { - sdTime = sdTime + (System.nanoTime() - t); - } - } - - private Element getValueForDiscriminator(Object appContext, List<ValidationMessage> errors, Element element, String discriminator, ElementDefinition criteria, NodeStack stack) throws FHIRException, IOException { - String p = stack.getLiteralPath()+"."+element.getName(); - Element focus = element; - String[] dlist = discriminator.split("\\."); - for (String d : dlist) { - if (focus.fhirType().equals("Reference") && d.equals("reference")) { - String url = focus.getChildValue("reference"); - if (Utilities.noString(url)) - throw new FHIRException("No reference resolving discriminator "+discriminator+" from "+element.getProperty().getName()); - // Note that we use the passed in stack here. This might be a problem if the discriminator is deep enough? - Element target = resolve(appContext, url, stack, errors, p); - if (target == null) - throw new FHIRException("Unable to find resource "+url+" at "+d+" resolving discriminator "+discriminator+" from "+element.getProperty().getName()); - focus = target; - } else if (d.equals("value") && focus.isPrimitive()) { - return focus; - } else { - List<Element> children = focus.getChildren(d); - if (children.isEmpty()) - throw new FHIRException("Unable to find "+d+" resolving discriminator "+discriminator+" from "+element.getProperty().getName()); - if (children.size() > 1) - throw new FHIRException("Found "+Integer.toString(children.size())+" items for "+d+" resolving discriminator "+discriminator+" from "+element.getProperty().getName()); - focus = children.get(0); - p = p + "."+d; - } - } - return focus; - } - - private CodeSystem getCodeSystem(String system) { - long t = System.nanoTime(); - try { - return context.fetchCodeSystem(system); - } finally { - txTime = txTime + (System.nanoTime() - t); - } - } - - private boolean hasTime(String fmt) { - return fmt.contains("T"); - } - - private boolean hasTimeZone(String fmt) { - return fmt.length() > 10 && (fmt.substring(10).contains("-") || fmt.substring(10).contains("+") || fmt.substring(10).contains("Z")); - } - - private boolean isAbsolute(String uri) { - return Utilities.noString(uri) || uri.startsWith("http:") || uri.startsWith("https:") || uri.startsWith("urn:uuid:") || uri.startsWith("urn:oid:") || uri.startsWith("urn:ietf:") - || uri.startsWith("urn:iso:") || uri.startsWith("urn:iso-astm:") || isValidFHIRUrn(uri); - } - - private boolean isValidFHIRUrn(String uri) { - return (uri.equals("urn:x-fhir:uk:id:nhs-number")) || uri.startsWith("urn:"); // Anyone can invent a URN, so why should we complain? - } - - public boolean isAnyExtensionsAllowed() { - return anyExtensionsAllowed; - } - - public boolean isErrorForUnknownProfiles() { - return errorForUnknownProfiles; - } - - public void setErrorForUnknownProfiles(boolean errorForUnknownProfiles) { - this.errorForUnknownProfiles = errorForUnknownProfiles; - } - - private boolean isParametersEntry(String path) { - String[] parts = path.split("\\."); - return parts.length > 2 && parts[parts.length - 1].equals("resource") && (pathEntryHasName(parts[parts.length - 2], "parameter") || pathEntryHasName(parts[parts.length - 2], "part")); - } - - private boolean isBundleEntry(String path) { - String[] parts = path.split("\\."); - return parts.length > 2 && parts[parts.length - 1].equals("resource") && pathEntryHasName(parts[parts.length - 2], "entry"); - } - - private boolean isBundleOutcome(String path) { - String[] parts = path.split("\\."); - return parts.length > 2 && parts[parts.length - 1].equals("outcome") && pathEntryHasName(parts[parts.length - 2], "response"); - } - - - private static boolean pathEntryHasName(String thePathEntry, String theName) { - if (thePathEntry.equals(theName)) { - return true; - } - if (thePathEntry.length() >= theName.length() + 3) { - if (thePathEntry.startsWith(theName)) { - if (thePathEntry.charAt(theName.length()) == '[') { - return true; - } - } - } - return false; - } - - private boolean isPrimitiveType(String code) { - StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code); - return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE; - } - - - - public boolean isSuppressLoincSnomedMessages() { - return suppressLoincSnomedMessages; - } - - private boolean nameMatches(String name, String tail) { - if (tail.endsWith("[x]")) - return name.startsWith(tail.substring(0, tail.length() - 3)); - else - return (name.equals(tail)); - } - - // private String mergePath(String path1, String path2) { - // // path1 is xpath path - // // path2 is dotted path - // String[] parts = path2.split("\\."); - // StringBuilder b = new StringBuilder(path1); - // for (int i = 1; i < parts.length -1; i++) - // b.append("/f:"+parts[i]); - // return b.toString(); - // } - - private boolean passesCodeWhitespaceRules(String v) { - if (!v.trim().equals(v)) - return false; - boolean lastWasSpace = true; - for (char c : v.toCharArray()) { - if (c == ' ') { - if (lastWasSpace) - return false; - else - lastWasSpace = true; - } else if (Character.isWhitespace(c)) - return false; - else - lastWasSpace = false; - } - return true; - } - - private Element localResolve(String ref, NodeStack stack, List<ValidationMessage> errors, String path) { - if (ref.startsWith("#")) { - // work back through the contained list. - // really, there should only be one level for this (contained resources cannot contain - // contained resources), but we'll leave that to some other code to worry about - while (stack != null && stack.getElement() != null) { - if (stack.getElement().getProperty().isResource()) { - // ok, we'll try to find the contained reference - Element res = getContainedById(stack.getElement(), ref.substring(1)); - if (res != null) - return res; - } - if (stack.getElement().getSpecial() == SpecialElement.BUNDLE_ENTRY) { - return null; // we don't try to resolve contained references across this boundary - } - stack = stack.parent; - } - return null; - } else { - // work back through the contained list - if any of them are bundles, try to resolve - // the resource in the bundle - String fullUrl = null; // we're going to try to work this out as we go up - while (stack != null && stack.getElement() != null) { - if (stack.getElement().getSpecial() == SpecialElement.BUNDLE_ENTRY && fullUrl==null && stack.parent.getElement().getName().equals("entry")) { - fullUrl = stack.parent.getElement().getChildValue("fullUrl"); // we don't try to resolve contained references across this boundary - if (fullUrl==null) - rule(errors, IssueType.REQUIRED, stack.parent.getElement().line(), stack.parent.getElement().col(), stack.parent.getLiteralPath(), fullUrl!=null, "Bundle entry missing fullUrl"); - } - if ("Bundle".equals(stack.getElement().getType())) { - Element res = getFromBundle(stack.getElement(), ref, fullUrl, errors, path); - return res; - } - stack = stack.parent; - } - } - return null; - } - - private Element resolve(Object appContext, String ref, NodeStack stack, List<ValidationMessage> errors, String path) throws IOException, FHIRException { - Element local = localResolve(ref, stack, errors, path); - if (local!=null) - return local; - if (fetcher == null) - return null; - return fetcher.fetch(appContext, ref); - } - - private ValueSet resolveBindingReference(DomainResource ctxt, Type reference, String uri) { - if (reference instanceof UriType) { - long t = System.nanoTime(); - ValueSet fr = context.fetchResource(ValueSet.class, ((UriType) reference).getValue().toString()); - txTime = txTime + (System.nanoTime() - t); - return fr; - } - 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 { - long t = System.nanoTime(); - String ref = ((Reference) reference).getReference(); - if (!Utilities.isAbsoluteUrl(ref)) - ref = resolve(uri, ref); - ValueSet fr = context.fetchResource(ValueSet.class, ref); - txTime = txTime + (System.nanoTime() - t); - return fr; - } - } - else - return null; - } - - private String resolve(String uri, String ref) { - String[] up = uri.split("\\/"); - String[] rp = ref.split("\\/"); - if (context.getResourceNames().contains(up[up.length-2]) && context.getResourceNames().contains(rp[0])) { - StringBuilder b = new StringBuilder(); - for (int i = 0; i < up.length-2; i++) { - b.append(up[i]); - b.append("/"); - } - b.append(ref); - return b.toString(); - } else - return ref; - } - - private Element resolveInBundle(List<Element> entries, String ref, String fullUrl, String type, String id) { - if (Utilities.isAbsoluteUrl(ref)) { - // if the reference is absolute, then you resolve by fullUrl. No other thinking is required. - for (Element entry : entries) { - String fu = entry.getNamedChildValue("fullUrl"); - if (ref.equals(fu)) - return entry; - } - return null; - } else { - // split into base, type, and id - String u = null; - if (fullUrl != null && fullUrl.endsWith(type+"/"+id)) - // fullUrl = complex - u = fullUrl.substring((type+"/"+id).length())+ref; - String[] parts = ref.split("\\/"); - if (parts.length >= 2) { - String t = parts[0]; - String i = parts[1]; - for (Element entry : entries) { - String fu = entry.getNamedChildValue("fullUrl"); - if (u != null && fullUrl.equals(u)) - return entry; - if (u == null) { - Element resource = entry.getNamedChild("resource"); - String et = resource.getType(); - String eid = resource.getNamedChildValue("id"); - if (t.equals(et) && i.equals(eid)) - return entry; - } - } - } - return null; - } - } - - private ElementDefinition resolveNameReference(StructureDefinitionSnapshotComponent snapshot, String contentReference) { - for (ElementDefinition ed : snapshot.getElement()) - if (contentReference.equals("#"+ed.getId())) - return ed; - return null; - } - - private StructureDefinition resolveProfile(StructureDefinition profile, String pr) { - if (pr.startsWith("#")) { - for (Resource r : profile.getContained()) { - if (r.getId().equals(pr.substring(1)) && r instanceof StructureDefinition) - return (StructureDefinition) r; - } - return null; - } else { - long t = System.nanoTime(); - StructureDefinition fr = context.fetchResource(StructureDefinition.class, pr); - sdTime = sdTime + (System.nanoTime() - t); - return fr; - } - } - - private ElementDefinition resolveType(String type) { - if (logical != null) - for (BundleEntryComponent be : logical.getEntry()) { - if (be.hasResource() && be.getResource() instanceof StructureDefinition) { - StructureDefinition sd = (StructureDefinition) be.getResource(); - if (sd.getId().equals(type)) - return sd.getSnapshot().getElement().get(0); - } - } - String url = "http://hl7.org/fhir/StructureDefinition/" + type; - long t = System.nanoTime(); - StructureDefinition sd = context.fetchResource(StructureDefinition.class, url); - sdTime = sdTime + (System.nanoTime() - t); - if (sd == null || !sd.hasSnapshot()) - return null; - else - return sd.getSnapshot().getElement().get(0); - } - - public void setAnyExtensionsAllowed(boolean anyExtensionsAllowed) { - this.anyExtensionsAllowed = anyExtensionsAllowed; - } - - public IResourceValidator setBestPracticeWarningLevel(BestPracticeWarningLevel value) { - bpWarnings = value; - return this; - } - - @Override - public void setCheckDisplay(CheckDisplayOption checkDisplay) { - this.checkDisplay = checkDisplay; - } - - public void setSuppressLoincSnomedMessages(boolean suppressLoincSnomedMessages) { - this.suppressLoincSnomedMessages = suppressLoincSnomedMessages; - } - - public IdStatus getResourceIdRule() { - return resourceIdRule; - } - - public void setResourceIdRule(IdStatus resourceIdRule) { - this.resourceIdRule = resourceIdRule; - } - - - public boolean isAllowXsiLocation() { - return allowXsiLocation; - } - - public void setAllowXsiLocation(boolean allowXsiLocation) { - this.allowXsiLocation = allowXsiLocation; - } - - /** - * - * @param element - * - the candidate that might be in the slice - * @param path - * - for reporting any errors. the XPath for the element - * @param slice - * - the definition of how slicing is determined - * @param ed - * - the slice for which to test membership - * @param errors - * @param stack - * @return - * @throws DefinitionException - * @throws DefinitionException - * @throws IOException - * @throws FHIRException - */ - private boolean sliceMatches(ValidatorHostContext hostContext, Element element, String path, ElementDefinition slicer, ElementDefinition ed, StructureDefinition profile, List<ValidationMessage> errors, NodeStack stack) throws DefinitionException, FHIRException, IOException { - if (!slicer.getSlicing().hasDiscriminator()) - return false; // cannot validate in this case - - ExpressionNode n = (ExpressionNode) ed.getUserData("slice.expression.cache"); - if (n == null) { - long t = System.nanoTime(); - // GG: this approach is flawed because it treats discriminators individually rather than collectively - StringBuilder expression = new StringBuilder("true"); - for (ElementDefinitionSlicingDiscriminatorComponent s : slicer.getSlicing().getDiscriminator()) { - String discriminator = s.getPath(); - if (s.getType() == DiscriminatorType.PROFILE) - throw new FHIRException("Validating against slices with discriminators based on profiles is not yet supported by the FHIRPath engine: " + discriminator); - // Todo: Fix this once FHIRPath (and this engine) supports a boolean function that test profile conformance - - ElementDefinition criteriaElement = getCriteriaForDiscriminator(path, ed, discriminator, profile); - if (s.getType() == DiscriminatorType.TYPE) { - String type = null; - if (!criteriaElement.getPath().contains("[") && discriminator.contains("[")) { - discriminator = discriminator.substring(0, discriminator.indexOf('[')); - String lastNode = tail(discriminator); - type = tail(criteriaElement.getPath()).substring(lastNode.length()); - type = type.substring(0,1).toLowerCase() + type.substring(1); - } else if (!criteriaElement.hasType() || criteriaElement.getType().size()==1) { - if (discriminator.contains("[")) - discriminator = discriminator.substring(0, discriminator.indexOf('[')); - type = criteriaElement.getType().get(0).getCode(); - } - if (type==null) - throw new DefinitionException("Discriminator (" + discriminator + ") is based on type, but slice " + ed.getId() + " does not declare a type"); - if (discriminator.isEmpty()) - expression.append(" and this is " + type); - else - expression.append(" and " + discriminator + " is " + type); - } else if (s.getType() == DiscriminatorType.EXISTS) { - if (criteriaElement.hasMin() && criteriaElement.getMin()>=1) - expression.append(" and (" + discriminator + ".exists())"); - else if (criteriaElement.hasMax() && criteriaElement.getMax().equals("0")) - expression.append(" and (" + discriminator + ".exists().not())"); - else - throw new FHIRException("Discriminator (" + discriminator + ") is based on element existence, but slice " + ed.getId() + " neither sets min>=1 or max=0"); - } else if (criteriaElement.hasFixed()) { - buildFixedExpression(ed, expression, discriminator, criteriaElement); - } else if (criteriaElement.hasPattern()) { - buildPattternExpression(ed, expression, discriminator, criteriaElement); - } else if (criteriaElement.hasBinding() && criteriaElement.getBinding().hasStrength() && criteriaElement.getBinding().getStrength().equals(BindingStrength.REQUIRED) && criteriaElement.getBinding().getValueSetReference()!=null) { - expression.append(" and (" + discriminator + " memberOf '" + criteriaElement.getBinding().getValueSetReference().getReference() + "')"); - } else { - throw new DefinitionException("Could not match discriminator (" + discriminator + ") for slice " + ed.getId() + " in profile " + profile.getUrl() + " - does not have fixed value, binding or existence assertions"); - } - } - - try { - n = fpe.parse(expression.toString()); - } catch (FHIRLexerException e) { - throw new FHIRException("Problem processing expression "+expression +" in profile " + profile.getUrl() + " path " + path + ": " + e.getMessage()); - } - fpeTime = fpeTime + (System.nanoTime() - t); - ed.setUserData("slice.expression.cache", n); - } - - String msg; - boolean ok; - try { - long t = System.nanoTime(); - ok = fpe.evaluateToBoolean(hostContext, hostContext.resource, element, n); - fpeTime = fpeTime + (System.nanoTime() - t); - msg = fpe.forLog(); - } catch (Exception ex) { - throw new FHIRException("Problem evaluating slicing expression for element in profile " + profile.getUrl() + " path " + path + " (fhirPath = "+n+"): " + ex.getMessage()); - } - return ok; - } - - private void buildPattternExpression(ElementDefinition ed, StringBuilder expression, String discriminator, ElementDefinition criteriaElement) throws DefinitionException { - Type pattern = criteriaElement.getPattern(); - if (pattern instanceof CodeableConcept) { - CodeableConcept cc = (CodeableConcept) pattern; - buildCodeableConceptExpression(ed, expression, discriminator, cc); - } else - throw new DefinitionException("Unsupported fixed pattern type for discriminator(" + discriminator + ") for slice " + ed.getId() + ": " + pattern.getClass().getName()); - } - - private void buildCodeableConceptExpression(ElementDefinition ed, StringBuilder expression, String discriminator, CodeableConcept cc) - throws DefinitionException { - if (cc.hasText()) - throw new DefinitionException("Unsupported CodeableConcept pattern - using text - for discriminator(" + discriminator + ") for slice " + ed.getId()); - if (!cc.hasCoding() || cc.getCoding().size() > 1) - throw new DefinitionException("Unsupported CodeableConcept pattern - must be just one coding - for discriminator(" + discriminator + ") for slice " + ed.getId()); - Coding c = cc.getCodingFirstRep(); - if (c.hasExtension() || cc.hasExtension()) - throw new DefinitionException("Unsupported CodeableConcept pattern - extensions are not allowed - for discriminator(" + discriminator + ") for slice " + ed.getId()); - expression.append(" and " + discriminator + ".coding.where("); - boolean first = true; - if (c.hasSystem()) { - first = false; - expression.append("system = '"+c.getSystem()+"'"); - } - if (c.hasVersion()) { - if (first) first = false; else expression.append(" and "); - expression.append("version = '"+c.getVersion()+"'"); - } - if (c.hasCode()) { - if (first) first = false; else expression.append(" and "); - expression.append("code = '"+c.getCode()+"'"); - } - if (c.hasDisplay()) { - if (first) first = false; else expression.append(" and "); - expression.append("display = '"+c.getDisplay()+"'"); - } - expression.append(").exists()"); - } - - private void buildFixedExpression(ElementDefinition ed, StringBuilder expression, String discriminator, ElementDefinition criteriaElement) throws DefinitionException { - Type fixed = criteriaElement.getFixed(); - if (fixed instanceof CodeableConcept) { - CodeableConcept cc = (CodeableConcept) fixed; - buildCodeableConceptExpression(ed, expression, discriminator, cc); - } else { - expression.append(" and (" + discriminator + " = "); - if (fixed instanceof StringType) { - Gson gson = new Gson(); - String json = gson.toJson((StringType)fixed); - String escapedString = json.substring(json.indexOf(":")+2); - escapedString = escapedString.substring(0, escapedString.indexOf(",\"myStringValue")-1); - expression.append("'" + escapedString + "'"); - } else if (fixed instanceof UriType) { - expression.append("'" + ((UriType)fixed).asStringValue() + "'"); - } else if (fixed instanceof IntegerType) { - expression.append(((IntegerType)fixed).asStringValue()); - } else if (fixed instanceof DecimalType) { - expression.append(((IntegerType)fixed).asStringValue()); - } else if (fixed instanceof BooleanType) { - expression.append(((BooleanType)fixed).asStringValue()); - } else - throw new DefinitionException("Unsupported fixed value type for discriminator(" + discriminator + ") for slice " + ed.getId() + ": " + fixed.getClass().getName()); - expression.append(")"); - } - } - - // we assume that the following things are true: - // the instance at root is valid against the schema and schematron - // the instance validator had no issues against the base resource profile - private void start(ValidatorHostContext hostContext, List<ValidationMessage> errors, Element resource, Element element, StructureDefinition defn, NodeStack stack) throws FHIRException, FHIRException, IOException { - // profile is valid, and matches the resource name - ResourceProfiles resourceProfiles = getResourceProfiles(element, stack); - if (!resourceProfiles.isProcessed()) - checkDeclaredProfiles(resourceProfiles, errors, resource, element, stack); - - if (!resourceProfiles.isProcessed()) { - resourceProfiles.setProcessed(); - if (!resourceProfiles.hasProfiles() && - (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), defn.hasSnapshot(), - "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided"))) { - // Don't need to validate against the resource if there's a profile because the profile snapshot will include the relevant parts of the resources - validateElement(hostContext, errors, defn, defn.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); - } - - // specific known special validations - if (element.getType().equals("Bundle")) - validateBundle(errors, element, stack); - if (element.getType().equals("Observation")) - validateObservation(errors, element, stack); - if (element.getType().equals("QuestionnaireResponse")) - validateQuestionannaireResponse(errors, element, stack); - } - for (ProfileUsage profileUsage : resourceProfiles.uncheckedProfiles()) { - profileUsage.setChecked(); -// todo: re-enable this when I can deal with the impact... (GG) -// if (!profileUsage.getProfile().getType().equals(resource.fhirType())) -// throw new FHIRException("Profile type mismatch - resource is "+resource.fhirType()+", and profile is for "+profileUsage.getProfile().getType()); - validateElement(hostContext, errors, profileUsage.getProfile(), profileUsage.getProfile().getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); - } - } - - private void validateQuestionannaireResponse(List<ValidationMessage> errors, Element element, NodeStack stack) { - Element q = element.getNamedChild("questionnaire"); - if (hint(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), q != null && isNotBlank(q.getNamedChildValue("reference")), "No questionnaire is identified, so no validation can be performed against the base questionnaire")) { - long t = System.nanoTime(); - Questionnaire qsrc = context.fetchResource(Questionnaire.class, q.getNamedChildValue("reference")); - sdTime = sdTime + (System.nanoTime() - t); - if (warning(errors, IssueType.REQUIRED, q.line(), q.col(), stack.getLiteralPath(), qsrc != null, "The questionnaire could not be resolved, so no validation can be performed against the base questionnaire")) { - boolean inProgress = "in-progress".equals(element.getNamedChildValue("status")); - validateQuestionannaireResponseItems(qsrc, qsrc.getItem(), errors, element, stack, inProgress); - } - } - } - - private void validateQuestionannaireResponseItem(Questionnaire qsrc, QuestionnaireItemComponent qItem, List<ValidationMessage> errors, Element element, NodeStack stack, boolean inProgress) { - String text = element.getNamedChildValue("text"); - rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), Utilities.noString(text) || text.equals(qItem.getText()), "If text exists, it must match the questionnaire definition for linkId "+qItem.getLinkId()); - - List<Element> answers = new ArrayList<Element>(); - element.getNamedChildren("answer", answers); - if (inProgress) - warning(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), (answers.size() > 0) || !qItem.getRequired(), "No response answer found for required item "+qItem.getLinkId()); - else - rule(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), (answers.size() > 0) || !qItem.getRequired(), "No response answer found for required item "+qItem.getLinkId()); - if (answers.size() > 1) - rule(errors, IssueType.INVALID, answers.get(1).line(), answers.get(1).col(), stack.getLiteralPath(), qItem.getRepeats(), "Only one response answer item with this linkId allowed"); - - for (Element answer : answers) { - NodeStack ns = stack.push(answer, -1, null, null); - switch (qItem.getType()) { - case GROUP: - rule(errors, IssueType.STRUCTURE, answer.line(), answer.col(), stack.getLiteralPath(), false, "Items of type group should not have answers"); - break; - case DISPLAY: // nothing - break; - case BOOLEAN: - validateQuestionnaireResponseItemType(errors, answer, ns, "boolean"); - break; - case DECIMAL: - validateQuestionnaireResponseItemType(errors, answer, ns, "decimal"); - break; - case INTEGER: - validateQuestionnaireResponseItemType(errors, answer, ns, "integer"); - break; - case DATE: - validateQuestionnaireResponseItemType(errors, answer, ns, "date"); - break; - case DATETIME: - validateQuestionnaireResponseItemType(errors, answer, ns, "dateTime"); - break; - case TIME: - validateQuestionnaireResponseItemType(errors, answer, ns, "time"); - break; - case STRING: - validateQuestionnaireResponseItemType(errors, answer, ns, "string"); - break; - case TEXT: - validateQuestionnaireResponseItemType(errors, answer, ns, "text"); - break; - case URL: - validateQuestionnaireResponseItemType(errors, answer, ns, "uri"); - break; - case ATTACHMENT: - validateQuestionnaireResponseItemType(errors, answer, ns, "Attachment"); - break; - case REFERENCE: - validateQuestionnaireResponseItemType(errors, answer, ns, "Reference"); - break; - case QUANTITY: - if (validateQuestionnaireResponseItemType(errors, answer, ns, "Quantity").equals("Quantity")) - if (qItem.hasExtension("???")) - validateQuestionnaireResponseItemQuantity(errors, answer, ns); - break; - case CHOICE: - String itemType=validateQuestionnaireResponseItemType(errors, answer, ns, "Coding", "date", "time", "integer", "string"); - if (itemType.equals("Coding")) validateAnswerCode(errors, answer, ns, qsrc, qItem, false); - else if (itemType.equals("date")) checkOption(errors, answer, ns, qsrc, qItem, "date"); - else if (itemType.equals("time")) checkOption(errors, answer, ns, qsrc, qItem, "time"); - else if (itemType.equals("integer")) checkOption(errors, answer, ns, qsrc, qItem, "integer"); - else if (itemType.equals("string")) checkOption(errors, answer, ns, qsrc, qItem, "string"); - break; - case OPENCHOICE: - itemType=validateQuestionnaireResponseItemType(errors, answer, ns, "Coding", "date", "time", "integer", "string"); - if (itemType.equals("Coding")) validateAnswerCode(errors, answer, ns, qsrc, qItem, true); - else if (itemType.equals("date")) checkOption(errors, answer, ns, qsrc, qItem, "date"); - else if (itemType.equals("time")) checkOption(errors, answer, ns, qsrc, qItem, "time"); - else if (itemType.equals("integer")) checkOption(errors, answer, ns, qsrc, qItem, "integer"); - else if (itemType.equals("string")) checkOption(errors, answer, ns, qsrc, qItem, "string", true); - break; - } - validateQuestionannaireResponseItems(qsrc, qItem.getItem(), errors, answer, stack, inProgress); - } - if (qItem.getType() == null) { - fail(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), false, "Definition for item "+qItem.getLinkId() + " does not contain a type"); - } else if (qItem.getType() == QuestionnaireItemType.GROUP) { - validateQuestionannaireResponseItems(qsrc, qItem.getItem(), errors, element, stack, inProgress); - } else { - List<Element> items = new ArrayList<Element>(); - element.getNamedChildren("item", items); - for (Element item : items) { - NodeStack ns = stack.push(item, -1, null, null); - rule(errors, IssueType.STRUCTURE, answers.get(0).line(), answers.get(0).col(), stack.getLiteralPath(), false, "Items not of type group should not have items - Item with linkId {0} of type {1} has {2} item(s)", qItem.getLinkId(), qItem.getType(), items.size()); - } - } - } - - private void validateQuestionannaireResponseItem(Questionnaire qsrc, QuestionnaireItemComponent qItem, List<ValidationMessage> errors, List<Element> elements, NodeStack stack, boolean inProgress) { - if (elements.size() > 1) - rule(errors, IssueType.INVALID, elements.get(1).line(), elements.get(1).col(), stack.getLiteralPath(), qItem.getRepeats(), "Only one response item with this linkId allowed"); - for (Element element : elements) { - NodeStack ns = stack.push(element, -1, null, null); - validateQuestionannaireResponseItem(qsrc, qItem, errors, element, ns, inProgress); - } - } - - private int getLinkIdIndex(List<QuestionnaireItemComponent> qItems, String linkId) { - for (int i = 0; i < qItems.size(); i++) { - if (linkId.equals(qItems.get(i).getLinkId())) - return i; - } - return -1; - } - - private void validateQuestionannaireResponseItems(Questionnaire qsrc, List<QuestionnaireItemComponent> qItems, List<ValidationMessage> errors, Element element, NodeStack stack, boolean inProgress) { - List<Element> items = new ArrayList<Element>(); - element.getNamedChildren("item", items); - // now, sort into stacks - Map<String, List<Element>> map = new HashMap<String, List<Element>>(); - int lastIndex = -1; - for (Element item : items) { - String linkId = item.getNamedChildValue("linkId"); - if (rule(errors, IssueType.REQUIRED, item.line(), item.col(), stack.getLiteralPath(), !Utilities.noString(linkId), "No LinkId, so can't be validated")) { - int index = getLinkIdIndex(qItems, linkId); - if (index == -1) { - QuestionnaireItemComponent qItem = findQuestionnaireItem(qsrc, linkId); - if (qItem != null) { - rule(errors, IssueType.STRUCTURE, item.line(), item.col(), stack.getLiteralPath(), index > -1, "Structural Error: item is in the wrong place"); - NodeStack ns = stack.push(item, -1, null, null); - validateQuestionannaireResponseItem(qsrc, qItem, errors, element, ns, inProgress); - } - else - rule(errors, IssueType.NOTFOUND, item.line(), item.col(), stack.getLiteralPath(), index > -1, "LinkId \""+linkId+"\" not found in questionnaire"); - } - else - { - rule(errors, IssueType.STRUCTURE, item.line(), item.col(), stack.getLiteralPath(), index >= lastIndex, "Structural Error: items are out of order"); - lastIndex = index; - List<Element> mapItem = map.get(linkId); - if (mapItem == null) { - mapItem = new ArrayList<Element>(); - map.put(linkId, mapItem); - } - mapItem.add(item); - } - } - } - - // ok, now we have a list of known items, grouped by linkId. We"ve made an error for anything out of order - for (QuestionnaireItemComponent qItem : qItems) { - List<Element> mapItem = map.get(qItem.getLinkId()); - if (mapItem != null) - validateQuestionannaireResponseItem(qsrc, qItem, errors, mapItem, stack, inProgress); - else - rule(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), !qItem.getRequired(), "No response found for required item "+qItem.getLinkId()); - } - } - - private void validateQuestionnaireResponseItemQuantity( List<ValidationMessage> errors, Element answer, NodeStack stack) { - - } - - private String validateQuestionnaireResponseItemType(List<ValidationMessage> errors, Element element, NodeStack stack, String... types) { - List<Element> values = new ArrayList<Element>(); - element.getNamedChildrenWithWildcard("value[x]", values); - if (values.size() > 0) { - NodeStack ns = stack.push(values.get(0), -1, null, null); - CommaSeparatedStringBuilder l = new CommaSeparatedStringBuilder(); - for (String s : types) { - l.append(s); - if (values.get(0).getName().equals("value"+Utilities.capitalize(s))) - return(s); - } - if (types.length == 1) - rule(errors, IssueType.STRUCTURE, values.get(0).line(), values.get(0).col(), ns.getLiteralPath(), false, "Answer value must be of type "+types[0]); - else - rule(errors, IssueType.STRUCTURE, values.get(0).line(), values.get(0).col(), ns.getLiteralPath(), false, "Answer value must be one of the types "+l.toString()); - } - return null; - } - - private QuestionnaireItemComponent findQuestionnaireItem(Questionnaire qSrc, String linkId) { - return findItem(qSrc.getItem(), linkId); - } - - private QuestionnaireItemComponent findItem(List<QuestionnaireItemComponent> list, String linkId) { - for (QuestionnaireItemComponent item : list) { - if (linkId.equals(item.getLinkId())) - return item; - QuestionnaireItemComponent result = findItem(item.getItem(), linkId); - if (result != null) - return result; - } - return null; - } - - /* private void validateAnswerCode(List<ValidationMessage> errors, Element value, NodeStack stack, List<Coding> optionList) { - String system = value.getNamedChildValue("system"); - String code = value.getNamedChildValue("code"); - boolean found = false; - for (Coding c : optionList) { - if (ObjectUtil.equals(c.getSystem(), system) && ObjectUtil.equals(c.getCode(), code)) { - found = true; - break; - } - } - rule(errors, IssueType.STRUCTURE, value.line(), value.col(), stack.getLiteralPath(), found, "The code "+system+"::"+code+" is not a valid option"); - }*/ - - private void validateAnswerCode(List<ValidationMessage> errors, Element value, NodeStack stack, Questionnaire qSrc, Reference ref, boolean theOpenChoice) { - ValueSet vs = resolveBindingReference(qSrc, ref, qSrc.getUrl()); - if (warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), vs != null, "ValueSet " + describeReference(ref) + " not found")) { - try { - Coding c = ObjectConverter.readAsCoding(value); - if (isBlank(c.getCode()) && isBlank(c.getSystem()) && isNotBlank(c.getDisplay())) { - if (theOpenChoice) { - return; - } - } - - long t = System.nanoTime(); - ValidationResult res = context.validateCode(c, vs); - txTime = txTime + (System.nanoTime() - t); - if (!res.isOk()) - rule(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "The value provided ("+c.getSystem()+"::"+c.getCode()+") is not in the options value set in the questionnaire"); - } catch (Exception e) { - warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "Error " + e.getMessage() + " validating Coding against Questionnaire Options"); - } - } - } - - private void validateAnswerCode( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean theOpenChoice) { - Element v = answer.getNamedChild("valueCoding"); - NodeStack ns = stack.push(v, -1, null, null); - if (qItem.getOption().size() > 0) - checkCodingOption(errors, answer, stack, qSrc, qItem, theOpenChoice); - // validateAnswerCode(errors, v, stack, qItem.getOption()); - else if (qItem.hasOptions()) - validateAnswerCode(errors, v, stack, qSrc, qItem.getOptions(), theOpenChoice); - else - hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate options because no option or options are provided"); - } - - private void checkOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, String type) { - checkOption(errors, answer, stack, qSrc, qItem, type, false); - } - - private void checkOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, String type, boolean openChoice) { - if (type.equals("integer")) checkIntegerOption(errors, answer, stack, qSrc, qItem, openChoice); - else if (type.equals("date")) checkDateOption(errors, answer, stack, qSrc, qItem, openChoice); - else if (type.equals("time")) checkTimeOption(errors, answer, stack, qSrc, qItem, openChoice); - else if (type.equals("string")) checkStringOption(errors, answer, stack, qSrc, qItem, openChoice); - else if (type.equals("Coding")) checkCodingOption(errors, answer, stack, qSrc, qItem, openChoice); - } - - private void checkIntegerOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { - Element v = answer.getNamedChild("valueInteger"); - NodeStack ns = stack.push(v, -1, null, null); - if (qItem.getOption().size() > 0) { - List<IntegerType> list = new ArrayList<IntegerType>(); - for (QuestionnaireItemOptionComponent components : qItem.getOption()) { - try { - list.add(components.getValueIntegerType()); - } catch (FHIRException e) { - // If it's the wrong type, just keep going - } - } - if (list.isEmpty() && !openChoice) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type integer"); - } else { - boolean found = false; - for (IntegerType item : list) { - if (item.getValue() == Integer.parseInt(v.primitiveValue())) { - found = true; - break; - } - } - if (!found) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The integer "+v.primitiveValue()+" is not a valid option"); - } - } - } else - hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate integer answer option because no option list is provided"); - } - - private void checkDateOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { - Element v = answer.getNamedChild("valueDate"); - NodeStack ns = stack.push(v, -1, null, null); - if (qItem.getOption().size() > 0) { - List<DateType> list = new ArrayList<DateType>(); - for (QuestionnaireItemOptionComponent components : qItem.getOption()) { - try { - list.add(components.getValueDateType()); - } catch (FHIRException e) { - // If it's the wrong type, just keep going - } - } - if (list.isEmpty() && !openChoice) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type date"); - } else { - boolean found = false; - for (DateType item : list) { - if (item.getValue().equals(v.primitiveValue())) { - found = true; - break; - } - } - if (!found) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The date "+v.primitiveValue()+" is not a valid option"); - } - } - } else - hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate date answer option because no option list is provided"); - } - - private void checkTimeOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { - Element v = answer.getNamedChild("valueTime"); - NodeStack ns = stack.push(v, -1, null, null); - if (qItem.getOption().size() > 0) { - List<TimeType> list = new ArrayList<TimeType>(); - for (QuestionnaireItemOptionComponent components : qItem.getOption()) { - try { - list.add(components.getValueTimeType()); - } catch (FHIRException e) { - // If it's the wrong type, just keep going - } - } - if (list.isEmpty() && !openChoice) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type time"); - } else { - boolean found = false; - for (TimeType item : list) { - if (item.getValue().equals(v.primitiveValue())) { - found = true; - break; - } - } - if (!found) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The time "+v.primitiveValue()+" is not a valid option"); - } - } - } else - hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate time answer option because no option list is provided"); - } - - private void checkStringOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { - Element v = answer.getNamedChild("valueString"); - NodeStack ns = stack.push(v, -1, null, null); - if (qItem.getOption().size() > 0) { - List<StringType> list = new ArrayList<StringType>(); - for (QuestionnaireItemOptionComponent components : qItem.getOption()) { - try { - if (components.getValue() != null) { - list.add(components.getValueStringType()); - } - } catch (FHIRException e) { - // If it's the wrong type, just keep going - } - } - if (list.isEmpty() && !openChoice) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type string"); - } else { - boolean found = false; - for (StringType item : list) { - if (item.getValue().equals((v.primitiveValue()))) { - found = true; - break; - } - } - if (!found) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The string "+v.primitiveValue()+" is not a valid option"); - } - } - } else { - hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate string answer option because no option list is provided"); - } - } - - private void checkCodingOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { - Element v = answer.getNamedChild("valueCoding"); - String system = v.getNamedChildValue("system"); - String code = v.getNamedChildValue("code"); - NodeStack ns = stack.push(v, -1, null, null); - if (qItem.getOption().size() > 0) { - List<Coding> list = new ArrayList<Coding>(); - for (QuestionnaireItemOptionComponent components : qItem.getOption()) { - try { - if (components.getValue() != null) { - list.add(components.getValueCoding()); - } - } catch (FHIRException e) { - // If it's the wrong type, just keep going - } - } - if (list.isEmpty() && !openChoice) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type coding"); - } else { - boolean found = false; - for (Coding item : list) { - if (ObjectUtil.equals(item.getSystem(), system) && ObjectUtil.equals(item.getCode(), code)) { - found = true; - break; - } - } - if (!found) { - rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The code "+system+"::"+code+" is not a valid option"); - } - } - } else - hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate Coding option because no option list is provided"); - } - - private String tail(String path) { - return path.substring(path.lastIndexOf(".") + 1); - } - - private String tryParse(String ref) { - String[] parts = ref.split("\\/"); - switch (parts.length) { - case 1: - return null; - case 2: - return checkResourceType(parts[0]); - default: - if (parts[parts.length - 2].equals("_history")) - return checkResourceType(parts[parts.length - 4]); - else - return checkResourceType(parts[parts.length - 2]); - } - } - - private boolean typesAreAllReference(List<TypeRefComponent> theType) { - for (TypeRefComponent typeRefComponent : theType) { - if (typeRefComponent.getCode().equals("Reference") == false) { - return false; - } - } - return true; - } - - private void validateBundle(List<ValidationMessage> errors, Element bundle, NodeStack stack) { - List<Element> entries = new ArrayList<Element>(); - bundle.getNamedChildren("entry", entries); - String type = bundle.getNamedChildValue("type"); - if (entries.size() == 0) { - rule(errors, IssueType.INVALID, stack.getLiteralPath(), !(type.equals("document") || type.equals("message")), "Documents or Messages must contain at least one entry"); - } else { - Element firstEntry = entries.get(0); - NodeStack firstStack = stack.push(firstEntry, 0, null, null); - String fullUrl = firstEntry.getNamedChildValue("fullUrl"); - - if (type.equals("document")) { - Element resource = firstEntry.getNamedChild("resource"); - NodeStack localStack = firstStack.push(resource, -1, null, null); - String id = resource.getNamedChildValue("id"); - if (rule(errors, IssueType.INVALID, firstEntry.line(), firstEntry.col(), stack.addToLiteralPath("entry", ":0"), resource != null, "No resource on first entry")) { - validateDocument(errors, entries, resource, localStack.push(resource, -1, null, null), fullUrl, id); - } - checkAllInterlinked(errors, entries, stack, bundle); - } - if (type.equals("message")) { - Element resource = firstEntry.getNamedChild("resource"); - NodeStack localStack = firstStack.push(resource, -1, null, null); - String id = resource.getNamedChildValue("id"); - if (rule(errors, IssueType.INVALID, firstEntry.line(), firstEntry.col(), stack.addToLiteralPath("entry", ":0"), resource != null, "No resource on first entry")) { - validateMessage(errors, entries, resource, localStack.push(resource, -1, null, null), fullUrl, id); - } - checkAllInterlinked(errors, entries, stack, bundle); - } - } - } - - private void checkAllInterlinked(List<ValidationMessage> errors, List<Element> entries, NodeStack stack, Element bundle) { - List<Element> visitedResources = new ArrayList<Element>(); - HashMap<Element,Element> candidateEntries = new HashMap<Element,Element>(); - List<Element> candidateResources = new ArrayList<Element>(); - for (Element entry: entries) { - candidateEntries.put(entry.getNamedChild("resource"), entry); - candidateResources.add(entry.getNamedChild("resource")); - } - followResourceLinks(entries.get(0), visitedResources, candidateEntries, candidateResources, true, errors, stack); - List<Element> unusedResources = new ArrayList<Element>(); - unusedResources.addAll(candidateResources); - unusedResources.removeAll(visitedResources); - int i = 0; - for (Element entry : entries) { - // TODO: Need to add support for tracking Bundle.link entries so that embedded stylesheets won't trigger this - warning(errors, IssueType.INFORMATIONAL, entry.line(), entry.col(), stack.addToLiteralPath("entry", Integer.toString(i)), !unusedResources.contains(entry.getNamedChild("resource")), "Entry isn't reachable by traversing from first Bundle entry"); - i++; - } - // Todo - check if the remaining resources point *to* the elements in the referenced set. Any that are still left over are errors - } - - private void followResourceLinks(Element entry, List<Element> visitedResources, HashMap<Element, Element> candidateEntries, List<Element> candidateResources, boolean referenced, List<ValidationMessage> errors, NodeStack stack) { - Element resource = entry.getNamedChild("resource"); - if (visitedResources.contains(resource)) - return; - - if (referenced) - visitedResources.add(resource); - - List<String> references = findReferences(resource); - for (String reference: references) { - // We don't want errors when just retrieving the element as they will be caught (with better path info) in subsequent processing - Element r = getFromBundle(stack.getElement(), reference, entry.getChildValue("fullUrl"), new ArrayList<ValidationMessage>(), stack.addToLiteralPath("entry[" + candidateResources.indexOf(resource) + "]")); - if (r!=null && !visitedResources.contains(r)) { - followResourceLinks(candidateEntries.get(r), visitedResources, candidateEntries, candidateResources, referenced, errors, stack); - } - } - } - - private List<String> findReferences(Element start) { - List<String> references = new ArrayList<String>(); - findReferences(start, references); - return references; - } - - private void findReferences(Element start, List<String> references) { - for (Element child : start.getChildren()) { - if (child.getType().equals("Reference")) { - String ref = child.getChildValue("reference"); - if (ref!=null && !ref.startsWith("#")) - references.add(ref); - } - findReferences(child, references); - } - } - - private void validateBundleReference(List<ValidationMessage> errors, List<Element> entries, Element ref, String name, NodeStack stack, String fullUrl, String type, String id) { - String reference = null; - try { - reference = ref.getNamedChildValue("reference"); - } catch (Error e) { - - } - - if (ref != null && !Utilities.noString(reference)) { - Element target = resolveInBundle(entries, reference, fullUrl, type, id); - rule(errors, IssueType.INVALID, ref.line(), ref.col(), stack.addToLiteralPath("reference"), target != null, "Unable to resolve the target of the reference in the bundle (" + name + ")"); - } - } - - private void validateContains(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, ElementDefinition child, ElementDefinition context, Element resource, Element element, NodeStack stack, IdStatus idstatus) throws FHIRException, FHIRException, IOException { - String resourceName = element.getType(); - long t = System.nanoTime(); - StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); - sdTime = sdTime + (System.nanoTime() - t); - // special case: resource wrapper is reset if we're crossing a bundle boundary, but not otherwise - if (element.getSpecial() == SpecialElement.BUNDLE_ENTRY || element.getSpecial() == SpecialElement.BUNDLE_OUTCOME || element.getSpecial() == SpecialElement.PARAMETER ) - resource = element; - if (rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), profile != null, "No profile found for contained resource of type '" + resourceName + "'")) - validateResource(hostContext.forContained(element), errors, resource, element, profile, null, idstatus, stack, false); - } - - private void validateDocument(List<ValidationMessage> errors, List<Element> entries, Element composition, NodeStack stack, String fullUrl, String id) { - // first entry must be a composition - if (rule(errors, IssueType.INVALID, composition.line(), composition.col(), stack.getLiteralPath(), composition.getType().equals("Composition"), - "The first entry in a document must be a composition")) { - // the composition subject and section references must resolve in the bundle - Element elem = composition.getNamedChild("subject"); - if (rule(errors, IssueType.INVALID, composition.line(), composition.col(), stack.getLiteralPath(), elem != null, "A document composition must have a subject")) - validateBundleReference(errors, entries, elem, "Composition Subject", stack.push(elem, -1, null, null), fullUrl, "Composition", id); - validateSections(errors, entries, composition, stack, fullUrl, id); - } - } - // rule(errors, IssueType.INVALID, bundle.line(), bundle.col(), "Bundle", !"urn:guid:".equals(base), "The base 'urn:guid:' is not valid (use urn:uuid:)"); - // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !"urn:guid:".equals(ebase), "The base 'urn:guid:' is not valid"); - // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !Utilities.noString(base) || !Utilities.noString(ebase), "entry - // does not have a base"); - // String firstBase = null; - // firstBase = ebase == null ? base : ebase; - - private void validateElement(ValidatorHostContext hostContext, List<ValidationMessage> errors, StructureDefinition profile, ElementDefinition definition, StructureDefinition cprofile, ElementDefinition context, - Element resource, Element element, String actualType, NodeStack stack, boolean inCodeableConcept) throws FHIRException, FHIRException, IOException { - element.markValidation(profile, definition); - - // System.out.println(" "+stack.getLiteralPath()+" "+Long.toString((System.nanoTime() - time) / 1000000)); - // time = System.nanoTime(); - if (resource.getName().equals("contained")) { - NodeStack ancestor = stack; - while (!ancestor.element.isResource() || ancestor.element.getName().equals("contained")) - ancestor = ancestor.parent; - checkInvariants(hostContext, errors, stack.getLiteralPath(), profile, definition, null, null, ancestor.element, element); - } else - checkInvariants(hostContext, errors, stack.getLiteralPath(), profile, definition, null, null, resource, element); - if (definition.getFixed()!=null) - checkFixedValue(errors, stack.getLiteralPath(), element, definition.getFixed(), definition.getSliceName(), null); - - - // get the list of direct defined children, including slices - List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(profile, definition); - if (childDefinitions.isEmpty()) { - if (actualType == null) - return; // there'll be an error elsewhere in this case, and we're going to stop. - - StructureDefinition dt = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + actualType); - if (dt == null) - throw new DefinitionException("Unable to resolve actual type " + actualType); - - childDefinitions = ProfileUtilities.getChildMap(dt, dt.getSnapshot().getElement().get(0)); - } - - // 1. List the children, and remember their exact path (convenience) - List<ElementInfo> children = new ArrayList<InstanceValidator.ElementInfo>(); - ChildIterator iter = new ChildIterator(stack.getLiteralPath(), element); - while (iter.next()) - children.add(new ElementInfo(iter.name(), iter.element(), iter.path(), iter.count())); - - // 2. assign children to a definition - // for each definition, for each child, check whether it belongs in the slice - ElementDefinition slicer = null; - boolean unsupportedSlicing = false; - List<String> problematicPaths = new ArrayList<String>(); - String slicingPath = null; - int sliceOffset = 0; - for (int i = 0; i < childDefinitions.size(); i++) { - ElementDefinition ed = childDefinitions.get(i); - boolean childUnsupportedSlicing = false; - boolean process = true; - if (ed.hasSlicing() && !ed.getSlicing().getOrdered()) - slicingPath = ed.getPath(); - else if (slicingPath!=null && ed.getPath().equals(slicingPath)) - ; // nothing - else if (slicingPath != null && !ed.getPath().startsWith(slicingPath)) - slicingPath = null; - // where are we with slicing - if (ed.hasSlicing()) { - if (slicer != null && slicer.getPath().equals(ed.getPath())) - throw new DefinitionException("Slice encountered midway through path on " + slicer.getPath()); - slicer = ed; - process = false; - sliceOffset = i; - } else if (slicer != null && !slicer.getPath().equals(ed.getPath())) - slicer = null; - -// if (process) { - for (ElementInfo ei : children) { - boolean match = false; - if (slicer == null || slicer == ed) { - match = nameMatches(ei.name, tail(ed.getPath())); - } else { -// ei.slice = slice; - if (nameMatches(ei.name, tail(ed.getPath()))) - try { - match = sliceMatches(hostContext, ei.element, ei.path, slicer, ed, profile, errors, stack); - if (match) - ei.slice = slicer; - } catch (FHIRException e) { - rule(errors, IssueType.PROCESSING, ei.line(), ei.col(), ei.path, false, e.getMessage()); - unsupportedSlicing = true; - childUnsupportedSlicing = true; - } - } - if (match) { - if (rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition == null || ei.definition == slicer, "Profile " + profile.getUrl() + ", Element matches more than one slice - " + (ei.definition==null || !ei.definition.hasSliceName() ? "" : ei.definition.getSliceName()) + ", " + (ed.hasSliceName() ? ed.getSliceName() : ""))) { - ei.definition = ed; - if (ei.slice == null) { - ei.index = i; - } else { - ei.index = sliceOffset; - ei.sliceindex = i - (sliceOffset + 1); - } - } - } else if (childUnsupportedSlicing) { - problematicPaths.add(ed.getPath()); - } - } -// } - } - int last = -1; - int lastSlice = -1; - for (ElementInfo ei : children) { - String sliceInfo = ""; - if (slicer != null) - sliceInfo = " (slice: " + slicer.getPath()+")"; - if (ei.path.endsWith(".extension")) - rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getNamedChildValue("url") + "\")" + (profile==null ? "" : " for profile " + profile.getUrl())); - else if (!unsupportedSlicing) - if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) || ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN))) - hint(errors, IssueType.INFORMATIONAL, ei.line(), ei.col(), ei.path, (ei.definition != null), - "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); - else - if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN) || ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN))) - rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition != null), - "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); - else - hint(errors, IssueType.NOTSUPPORTED, ei.line(), ei.col(), ei.path, (ei.definition != null), - "Could not verify slice for profile " + profile.getUrl()); - // TODO: Should get the order of elements correct when parsing elements that are XML attributes vs. elements - boolean isXmlAttr = false; - if (ei.definition!=null) - for (Enumeration<PropertyRepresentation> r : ei.definition.getRepresentation()) { - if (r.getValue() == PropertyRepresentation.XMLATTR) { - isXmlAttr = true; - break; - } - } - - rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition == null) || (ei.index >= last) || isXmlAttr, "As specified by profile " + profile.getUrl() + ", Element '"+ei.name+"' is out of order"); - if (ei.slice != null && ei.index == last && ei.slice.getSlicing().getOrdered()) - rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition == null) || (ei.sliceindex >= lastSlice) || isXmlAttr, "As specified by profile " + profile.getUrl() + ", Element '"+ei.name+"' is out of order in ordered slice"); - if (ei.definition == null || !isXmlAttr) - last = ei.index; - if (ei.slice != null) - lastSlice = ei.sliceindex; - else - lastSlice = -1; - } - - // 3. report any definitions that have a cardinality problem - for (ElementDefinition ed : childDefinitions) { - if (ed.getRepresentation().isEmpty()) { // ignore xml attributes - int count = 0; - List<ElementDefinition> slices = null; - if (ed.hasSlicing()) - slices = ProfileUtilities.getSliceList(profile, ed); - for (ElementInfo ei : children) - if (ei.definition == ed) - count++; - else if (slices!=null) { - for (ElementDefinition sed : slices) { - if (ei.definition == sed) { - count++; - break; - } - } - } - String location = "Profile " + profile.getUrl() + ", Element '" + stack.getLiteralPath() + "." + tail(ed.getPath()) + (ed.hasSliceName()? "[" + ed.getSliceName() + (ed.hasLabel() ? " ("+ed.getLabel()+")" : "")+"]": ""); - if (ed.getMin() > 0) { - if (problematicPaths.contains(ed.getPath())) - hint(errors, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), - location + "': Unable to check minimum required (" + Integer.toString(ed.getMin()) + ") due to lack of slicing validation"); - else - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), - location + "': minimum required = " + Integer.toString(ed.getMin()) + ", but only found " + Integer.toString(count)); - } - if (ed.hasMax() && !ed.getMax().equals("*")) { - if (problematicPaths.contains(ed.getPath())) - hint(errors, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), - location + ": Unable to check max allowed (" + ed.getMax() + ") due to lack of slicing validation"); - else - rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), - location + ": max allowed = " + ed.getMax() + ", but found " + Integer.toString(count)); - } - } - } - // 4. check order if any slices are ordered. (todo) - - // 5. inspect each child for validity - for (ElementInfo ei : children) { - List<String> profiles = new ArrayList<String>(); - if (ei.definition != null) { - String type = null; - ElementDefinition typeDefn = null; - - String usesMustSupport = profile.getUserString("usesMustSupport"); - if (usesMustSupport == null) { - usesMustSupport = "N"; - for (ElementDefinition pe: profile.getSnapshot().getElement()) { - if (pe.getMustSupport()) { - usesMustSupport = "Y"; - break; - } - } - profile.setUserData("usesMustSupport", usesMustSupport); - } - if (usesMustSupport.equals("Y")) { - String elementSupported = ei.element.getUserString("elementSupported"); - if (elementSupported==null || ei.definition.getMustSupport()) - if (ei.definition.getMustSupport()) - ei.element.setUserData("elementSupported", "Y"); - else - ei.element.setUserData("elementSupported", "N"); - } - - if (ei.definition.getType().size() == 1 && !ei.definition.getType().get(0).getCode().equals("*") && !ei.definition.getType().get(0).getCode().equals("Element") - && !ei.definition.getType().get(0).getCode().equals("BackboneElement")) { - type = ei.definition.getType().get(0).getCode(); - // Excluding reference is a kludge to get around versioning issues - if (ei.definition.getType().get(0).hasProfile() && !type.equals("Reference")) - profiles.add(ei.definition.getType().get(0).getProfile()); - - } else if (ei.definition.getType().size() == 1 && ei.definition.getType().get(0).getCode().equals("*")) { - String prefix = tail(ei.definition.getPath()); - assert prefix.endsWith("[x]"); - type = ei.name.substring(prefix.length() - 3); - if (isPrimitiveType(type)) - type = Utilities.uncapitalize(type); - // Excluding reference is a kludge to get around versioning issues - if (ei.definition.getType().get(0).hasProfile() && !type.equals("Reference")) - profiles.add(ei.definition.getType().get(0).getProfile()); - } else if (ei.definition.getType().size() > 1) { - - String prefix = tail(ei.definition.getPath()); - assert typesAreAllReference(ei.definition.getType()) || prefix.endsWith("[x]") : prefix; - - prefix = prefix.substring(0, prefix.length() - 3); - for (TypeRefComponent t : ei.definition.getType()) - if ((prefix + Utilities.capitalize(t.getCode())).equals(ei.name)) { - type = t.getCode(); - // Excluding reference is a kludge to get around versioning issues - if (t.hasProfile() && !type.equals("Reference")) - profiles.add(t.getProfile()); - } - if (type == null) { - TypeRefComponent trc = ei.definition.getType().get(0); - if (trc.getCode().equals("Reference")) - type = "Reference"; - else - rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), false, - "The element " + ei.name + " is illegal. Valid types at this point are " + describeTypes(ei.definition.getType())); - } - } else if (ei.definition.getContentReference() != null) { - typeDefn = resolveNameReference(profile.getSnapshot(), ei.definition.getContentReference()); - } - - if (type != null) { - if (type.startsWith("@")) { - ei.definition = findElement(profile, type.substring(1)); - type = null; - } - } - NodeStack localStack = stack.push(ei.element, ei.count, ei.definition, type == null ? typeDefn : resolveType(type)); - String localStackLiterapPath = localStack.getLiteralPath(); - String eiPath = ei.path; - assert(eiPath.equals(localStackLiterapPath)) : "ei.path: " + ei.path + " - localStack.getLiteralPath: " + localStackLiterapPath; - boolean thisIsCodeableConcept = false; - - if (type != null) { - if (isPrimitiveType(type)) { - checkPrimitive(hostContext, errors, ei.path, type, ei.definition, ei.element, profile); - } else { -// checkNonPrimitive(appContext, errors, ei.path, type, ei.definition, ei.element, profile); - if (type.equals("Identifier")) - checkIdentifier(errors, ei.path, ei.element, ei.definition); - else if (type.equals("Coding")) - checkCoding(errors, ei.path, ei.element, profile, ei.definition, inCodeableConcept); - else if (type.equals("CodeableConcept")) { - checkCodeableConcept(errors, ei.path, ei.element, profile, ei.definition); - thisIsCodeableConcept = true; - } else if (type.equals("Reference")) - checkReference(hostContext, errors, ei.path, ei.element, profile, ei.definition, actualType, localStack); - // We only check extensions if we're not in a complex extension or if the element we're dealing with is not defined as part of that complex extension - if (type.equals("Extension") && ei.element.getChildValue("url").contains("/")) - checkExtension(hostContext, errors, ei.path, resource, ei.element, ei.definition, profile, localStack); - else if (type.equals("Resource")) - validateContains(hostContext, errors, ei.path, ei.definition, definition, resource, ei.element, localStack, idStatusForEntry(element, ei)); // if - // (str.matches(".*([.,/])work\\1$")) - else { - StructureDefinition p = null; - boolean elementValidated = false; - if (profiles.isEmpty()) { - p = getProfileForType(type); - rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown type " + type); - } else if (profiles.size()==1) { - p = this.context.fetchResource(StructureDefinition.class, profiles.get(0)); - rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown profile " + profiles.get(0)); - } else { - elementValidated = true; - HashMap<String, List<ValidationMessage>> goodProfiles = new HashMap<String, List<ValidationMessage>>(); - List<List<ValidationMessage>> badProfiles = new ArrayList<List<ValidationMessage>>(); - for (String typeProfile : profiles) { - p = this.context.fetchResource(StructureDefinition.class, typeProfile); - if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown profile " + typeProfile)) { - List<ValidationMessage> profileErrors = new ArrayList<ValidationMessage>(); - validateElement(hostContext, profileErrors, p, p.getSnapshot().getElement().get(0), profile, ei.definition, resource, ei.element, type, localStack, thisIsCodeableConcept); - boolean hasError = false; - for (ValidationMessage msg : profileErrors) { - if (msg.getLevel()==ValidationMessage.IssueSeverity.ERROR || msg.getLevel()==ValidationMessage.IssueSeverity.FATAL) { - hasError = true; - break; - } - } - if (hasError) - badProfiles.add(profileErrors); - else - goodProfiles.put(typeProfile, profileErrors); - } - if (goodProfiles.size()==1) { - errors.addAll(goodProfiles.get(0)); - } else if (goodProfiles.size()==0) { - rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, false, "Unable to find matching profile among choices: " + StringUtils.join("; ", profiles)); - for (List<ValidationMessage> messages : badProfiles) { - errors.addAll(messages); - } - } else { - warning(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, false, "Found multiple matching profiles among choices: " + StringUtils.join("; ", goodProfiles.keySet())); - for (List<ValidationMessage> messages : goodProfiles.values()) { - errors.addAll(messages); - } - } - } - } - if (p!=null) { - if (!elementValidated) - validateElement(hostContext, errors, p, p.getSnapshot().getElement().get(0), profile, ei.definition, resource, ei.element, type, localStack, thisIsCodeableConcept); - int index = profile.getSnapshot().getElement().indexOf(ei.definition); - if (index < profile.getSnapshot().getElement().size() - 1) { - String nextPath = profile.getSnapshot().getElement().get(index+1).getPath(); - if (!nextPath.equals(ei.definition.getPath()) && nextPath.startsWith(ei.definition.getPath())) - validateElement(hostContext, errors, profile, ei.definition, null, null, resource, ei.element, type, localStack, thisIsCodeableConcept); - } - } - } - } - } else { - if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), ei.definition != null, "Unrecognised Content " + ei.name)) - validateElement(hostContext, errors, profile, ei.definition, null, null, resource, ei.element, type, localStack, false); - } - } - } - } - - private IdStatus idStatusForEntry(Element ep, ElementInfo ei) { - if (isBundleEntry(ei.path)) { - Element req = ep.getNamedChild("request"); - Element resp = ep.getNamedChild("response"); - Element fullUrl = ep.getNamedChild("fullUrl"); - Element method = null; - Element url = null; - if (req != null) { - method = req.getNamedChild("method"); - url = req.getNamedChild("url"); - } - if (resp != null) { - return IdStatus.OPTIONAL; - } if (method == null) { - if (fullUrl == null) - return IdStatus.REQUIRED; - else if (fullUrl.primitiveValue().startsWith("urn:uuid:") || fullUrl.primitiveValue().startsWith("urn:oid:")) - return IdStatus.OPTIONAL; - else - return IdStatus.REQUIRED; - } else { - String s = method.primitiveValue(); - if (s.equals("PUT")) { - if (url == null) - return IdStatus.REQUIRED; - else - return IdStatus.OPTIONAL; // or maybe prohibited? not clear - } else if (s.equals("POST")) - return IdStatus.OPTIONAL; // this should be prohibited, but see task 9102 - else // actually, we should never get to here; a bundle entry with method get/delete should not have a resource - return IdStatus.OPTIONAL; - } - } else if (isParametersEntry(ei.path) || isBundleOutcome(ei.path)) - return IdStatus.OPTIONAL; - else - return IdStatus.REQUIRED; - } - - private void checkInvariants(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, StructureDefinition profile, ElementDefinition ed, String typename, String typeProfile, Element resource, Element element) throws FHIRException, FHIRException { - if (noInvariantChecks) - return; - - for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { - if (inv.hasExpression()) { - ExpressionNode n = (ExpressionNode) inv.getUserData("validator.expression.cache"); - if (n == null) { - long t = System.nanoTime(); - try { - n = fpe.parse(inv.getExpression()); - } catch (FHIRLexerException e) { - throw new FHIRException("Problem processing expression "+inv.getExpression() +" in profile " + profile.getUrl() + " path " + path + ": " + e.getMessage()); - } - fpeTime = fpeTime + (System.nanoTime() - t); - inv.setUserData("validator.expression.cache", n); - } - - String msg; - boolean ok; - try { - long t = System.nanoTime(); - ok = fpe.evaluateToBoolean(hostContext, resource, element, n); - fpeTime = fpeTime + (System.nanoTime() - t); - msg = fpe.forLog(); - } catch (Exception ex) { - ok = false; - msg = ex.getMessage(); - } - if (!ok) { - try { - ok = fpe.evaluateToBoolean(hostContext, resource, element, n); - } catch (PathEngineException e) { - throw new FHIRException("Problem processing expression "+inv.getExpression() +" in profile " + profile.getUrl() + " path " + path + ": " + e.getMessage()); - } - if (!Utilities.noString(msg)) - msg = " ("+msg+")"; - if (inv.getSeverity() == ConstraintSeverity.ERROR) - rule(errors, IssueType.INVARIANT, element.line(), element.col(), path, ok, inv.getHuman()+msg+" ["+inv.getExpression()+"]"); - else if (inv.getSeverity() == ConstraintSeverity.WARNING) - warning(errors, IssueType.INVARIANT, element.line(), element.line(), path, ok, inv.getHuman()+msg+" ["+inv.getExpression()+"]"); - } - } - } - } - - private void validateMessage(List<ValidationMessage> errors, List<Element> entries, Element messageHeader, NodeStack stack, String fullUrl, String id) { - // first entry must be a messageheader - if (rule(errors, IssueType.INVALID, messageHeader.line(), messageHeader.col(), stack.getLiteralPath(), messageHeader.getType().equals("MessageHeader"), - "The first entry in a message must be a MessageHeader")) { - // the composition subject and section references must resolve in the bundle - List<Element> elements = messageHeader.getChildren("data"); - for (Element elem: elements) - validateBundleReference(errors, entries, elem, "MessageHeader Data", stack.push(elem, -1, null, null), fullUrl, "MessageHeader", id); - } - } - - private void validateObservation(List<ValidationMessage> errors, Element element, NodeStack stack) { - // all observations should have a subject, a performer, and a time - - bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("subject") != null, "All observations should have a subject"); - bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("performer") != null, "All observations should have a performer"); - bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null, - "All observations should have an effectiveDateTime or an effectivePeriod"); - } - - /* - * The actual base entry point - */ - /* private void validateResource(List<ValidationMessage> errors, Element resource, Element element, StructureDefinition defn, ValidationProfileSet profiles, IdStatus idstatus, NodeStack stack) throws FHIRException, FHIRException { - List<StructureDefinition> declProfiles = new ArrayList<StructureDefinition>(); - List<Element> meta = element.getChildrenByName("meta"); - if (!meta.isEmpty()) { - for (Element profileName : meta.get(0).getChildrenByName("profile")) { - StructureDefinition sd = context.fetchResource(StructureDefinition.class, profileName.getValue()); - if (sd != null) - declProfiles.add(sd); - } - } - - if (!declProfiles.isEmpty()) { - // Validate against profiles rather than the resource itself as they'll be more constrained and will cover the resource elements anyhow - for (StructureDefinition sd : declProfiles) - validateResource2(errors, resource, element, sd, profiles, idstatus, stack); - } else - validateResource2(errors, resource, element, defn, profiles, idstatus, stack); - }*/ - - private void validateResource(ValidatorHostContext hostContext, List<ValidationMessage> errors, Element resource, Element element, StructureDefinition defn, ValidationProfileSet profiles, IdStatus idstatus, NodeStack stack, boolean isEntry) throws FHIRException, FHIRException, IOException { - assert stack != null; - assert resource != null; - - boolean ok = true; - - String resourceName = element.getType(); // todo: consider namespace...? - if (defn == null) { - long t = System.nanoTime(); - defn = element.getProperty().getStructure(); - if (defn == null) - defn = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); - if (profiles!=null) - getResourceProfiles(resource, stack).addProfiles(errors, profiles, stack.getLiteralPath(), element, isEntry); - sdTime = sdTime + (System.nanoTime() - t); - ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), defn != null, "No definition found for resource type '" + resourceName + "'"); - } - - String type = defn.getKind() == StructureDefinitionKind.LOGICAL ? defn.getId() : defn.getType(); - // special case: we have a bundle, and the profile is not for a bundle. We'll try the first entry instead - if (!type.equals(resourceName) && resourceName.equals("Bundle")) { - Element first = getFirstEntry(element); - if (first != null && first.getType().equals(type)) { - element = first; - resourceName = element.getType(); - idstatus = IdStatus.OPTIONAL; // why? - } - } - ok = rule(errors, IssueType.INVALID, -1, -1, stack.getLiteralPath(), type.equals(resourceName), "Specified profile type was '" + type + "', but found type '" + resourceName + "'"); - - if (ok) { - if (idstatus == IdStatus.REQUIRED && (element.getNamedChild("id") == null)) - rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource requires an id, but none is present"); - else if (idstatus == IdStatus.PROHIBITED && (element.getNamedChild("id") != null)) - rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource has an id, but none is allowed"); - start(hostContext, errors, resource, element, defn, stack); // root is both definition and type - } - } - - private void loadProfiles(ValidationProfileSet profiles) throws DefinitionException { - if (profiles != null) { - for (String profile : profiles.getCanonicalUrls()) { - StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); - if (p == null) - throw new DefinitionException("StructureDefinition '" + profile + "' not found"); - profiles.getDefinitions().add(p); - } - } - } - - private Element getFirstEntry(Element bundle) { - List<Element> list = new ArrayList<Element>(); - bundle.getNamedChildren("entry", list); - if (list.isEmpty()) - return null; - Element resource = list.get(0).getNamedChild("resource"); - if (resource == null) - return null; - else - return resource; - } - - private void validateSections(List<ValidationMessage> errors, List<Element> entries, Element focus, NodeStack stack, String fullUrl, String id) { - List<Element> sections = new ArrayList<Element>(); - focus.getNamedChildren("entry", sections); - int i = 0; - for (Element section : sections) { - NodeStack localStack = stack.push(section, 1, null, null); - validateBundleReference(errors, entries, section.getNamedChild("content"), "Section Content", localStack, fullUrl, "Composition", id); - validateSections(errors, entries, section, localStack, fullUrl, id); - i++; - } - } - - private boolean valueMatchesCriteria(Element value, ElementDefinition criteria) throws FHIRException { - if (criteria.hasFixed()) { - List<ValidationMessage> msgs = new ArrayList<ValidationMessage>(); - checkFixedValue(msgs, "{virtual}", value, criteria.getFixed(), "value", null); - return msgs.size() == 0; - } else if (criteria.hasBinding() && criteria.getBinding().getStrength() == BindingStrength.REQUIRED && criteria.getBinding().hasValueSet()) { - throw new FHIRException("Unable to resolve slice matching - slice matching by value set not done"); - } else { - throw new FHIRException("Unable to resolve slice matching - no fixed value or required value set"); - } - } - - private boolean yearIsValid(String v) { - if (v == null) { - return false; - } - try { - int i = Integer.parseInt(v.substring(0, Math.min(4, v.length()))); - return i >= 1800 && i <= 2100; - } catch (NumberFormatException e) { - return false; - } - } - - public class ChildIterator { - private String basePath; - private Element parent; - private int cursor; - private int lastCount; - - public ChildIterator(String path, Element element) { - parent = element; - basePath = path; - cursor = -1; - } - - public int count() { - String nb = cursor == 0 ? "--" : parent.getChildren().get(cursor-1).getName(); - String na = cursor >= parent.getChildren().size() - 1 ? "--" : parent.getChildren().get(cursor+1).getName(); - if (name().equals(nb) || name().equals(na) ) { - return lastCount + 1; - } else - return -1; - } - - public Element element() { - return parent.getChildren().get(cursor); - } - - public String name() { - return element().getName(); - } - - public boolean next() { - if (cursor == -1) { - cursor++; - lastCount = 0; - } else { - String lastName = name(); - cursor++; - if (cursor < parent.getChildren().size() && name().equals(lastName)) - lastCount++; - else - lastCount = 0; - } - return cursor < parent.getChildren().size(); - } - - public String path() { - int i = count(); - String sfx = ""; - if (i > -1) { - sfx = "[" + Integer.toString(lastCount + 1) + "]"; - } - return basePath + "." + name() + sfx; - } - } - - public class NodeStack { - private ElementDefinition definition; - private Element element; - private ElementDefinition extension; - private String literalPath; // xpath format - private List<String> logicalPaths; // dotted format, various entry points - private NodeStack parent; - private ElementDefinition type; - - public NodeStack() { - } - - public NodeStack(Element element) { - this.element = element; - literalPath = element.getName(); - } - - public String addToLiteralPath(String... path) { - StringBuilder b = new StringBuilder(); - b.append(getLiteralPath()); - for (String p : path) { - if (p.startsWith(":")) { - b.append("["); - b.append(p.substring(1)); - b.append("]"); - } else { - b.append("."); - b.append(p); - } - } - return b.toString(); - } - - private ElementDefinition getDefinition() { - return definition; - } - - private Element getElement() { - return element; - } - - protected String getLiteralPath() { - return literalPath == null ? "" : literalPath; - } - - private List<String> getLogicalPaths() { - return logicalPaths == null ? new ArrayList<String>() : logicalPaths; - } - - private ElementDefinition getType() { - return type; - } - - private NodeStack push(Element element, int count, ElementDefinition definition, ElementDefinition type) { - NodeStack res = new NodeStack(); - res.parent = this; - res.element = element; - res.definition = definition; - res.literalPath = getLiteralPath() + "." + element.getName(); - if (count > -1) - res.literalPath = res.literalPath + "[" + Integer.toString(count) + "]"; - res.logicalPaths = new ArrayList<String>(); - if (type != null) { - // type will be bull if we on a stitching point of a contained resource, or if.... - res.type = type; - String t = tail(definition.getPath()); - for (String lp : getLogicalPaths()) { - res.logicalPaths.add(lp + "." + t); - if (t.endsWith("[x]")) - res.logicalPaths.add(lp + "." + t.substring(0, t.length() - 3) + type.getPath()); - } - res.logicalPaths.add(type.getPath()); - } else if (definition != null) { - for (String lp : getLogicalPaths()) - res.logicalPaths.add(lp + "." + element.getName()); - } else - res.logicalPaths.addAll(getLogicalPaths()); - // CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - // for (String lp : res.logicalPaths) - // b.append(lp); - // System.out.println(res.literalPath+" : "+b.toString()); - return res; - } - - private void setType(ElementDefinition type) { - this.type = type; - } - } - - private void checkForProcessingInstruction(List<ValidationMessage> errors, Document document) { - Node node = document.getFirstChild(); - while (node != null) { - rule(errors, IssueType.INVALID, -1, -1, "(document)", node.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE, "No processing instructions allowed in resources"); - node = node.getNextSibling(); - } - } - - public class ElementInfo { - - public int index; // order of definition in overall order. all slices get the index of the slicing definition - public int sliceindex; // order of the definition in the slices (if slice != null) - public int count; - public ElementDefinition definition; - public ElementDefinition slice; - private Element element; - private String name; - private String path; - - public ElementInfo(String name, Element element, String path, int count) { - this.name = name; - this.element = element; - this.path = path; - this.count = count; - } - - public int col() { - return element.col(); - } - - public int line() { - return element.line(); - } - - } - - public String reportTimes() { - String s = String.format("Times: overall = %d, tx = %d, sd = %d, load = %d, fpe = %d", overall, txTime, sdTime, loadTime, fpeTime); - overall = 0; - txTime = 0; - sdTime = 0; - loadTime = 0; - fpeTime = 0; - return s; - } - - public boolean isNoBindingMsgSuppressed() { - return noBindingMsgSuppressed; - } - - public IResourceValidator setNoBindingMsgSuppressed(boolean noBindingMsgSuppressed) { - this.noBindingMsgSuppressed = noBindingMsgSuppressed; - return this; - } - - - public boolean isNoTerminologyChecks() { - return noTerminologyChecks; - } - - public IResourceValidator setNoTerminologyChecks(boolean noTerminologyChecks) { - this.noTerminologyChecks = noTerminologyChecks; - return this; - } - - public void checkAllInvariants(){ - for (StructureDefinition sd : context.allStructures()) { - if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) { - for (ElementDefinition ed : sd.getSnapshot().getElement()) { - for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { - if (inv.hasExpression()) { - try { - ExpressionNode n = (ExpressionNode) inv.getUserData("validator.expression.cache"); - if (n == null) { - n = fpe.parse(inv.getExpression()); - inv.setUserData("validator.expression.cache", n); - } - fpe.check(null, sd.getKind() == StructureDefinitionKind.RESOURCE ? sd.getType() : "DomainResource", ed.getPath(), n); - } catch (Exception e) { - System.out.println("Error processing structure ["+sd.getId()+"] path "+ed.getPath()+":"+inv.getKey()+" (\""+inv.getExpression()+"\"): "+e.getMessage()); - } - } - } - } - } - } - } - -} +package org.hl7.fhir.r4.validation; + +import static org.apache.commons.lang3.StringUtils.isBlank; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +import java.io.IOException; +import java.io.InputStream; +import java.util.*; + +import org.apache.commons.lang3.StringUtils; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.exceptions.*; +import org.hl7.fhir.r4.conformance.ProfileUtilities; +import org.hl7.fhir.r4.context.IWorkerContext; +import org.hl7.fhir.r4.context.IWorkerContext.ValidationResult; +import org.hl7.fhir.r4.elementmodel.*; +import org.hl7.fhir.r4.elementmodel.Element; +import org.hl7.fhir.r4.elementmodel.Element.SpecialElement; +import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat; +import org.hl7.fhir.r4.elementmodel.ParserBase.ValidationPolicy; +import org.hl7.fhir.r4.formats.FormatUtilities; +import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.r4.model.ElementDefinition.*; +import org.hl7.fhir.r4.model.Enumeration; +import org.hl7.fhir.r4.model.Enumerations.BindingStrength; +import org.hl7.fhir.r4.model.Questionnaire.*; +import org.hl7.fhir.r4.model.StructureDefinition.*; +import org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent; +import org.hl7.fhir.r4.utils.*; +import org.hl7.fhir.r4.utils.FHIRLexer.FHIRLexerException; +import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext; +import org.hl7.fhir.r4.utils.ValidationProfileSet.ProfileRegistration; +import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.validation.ValidationMessage; +import org.hl7.fhir.utilities.validation.ValidationMessage.*; +import org.hl7.fhir.utilities.xhtml.NodeType; +import org.hl7.fhir.utilities.xhtml.XhtmlNode; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +import ca.uhn.fhir.util.ObjectUtil; + + +/** + * Thinking of using this in a java program? Don't! + * You should use on of the wrappers instead. Either in HAPI, or use ValidationEngine + * + * @author Grahame Grieve + * + */ +/* + * todo: + * check urn's don't start oid: or uuid: + */ +public class InstanceValidator extends BaseValidator implements IResourceValidator { + + + private class ValidatorHostContext { + private Object appContext; + private Element container; // bundle, or parameters + private Element resource; + public ValidatorHostContext(Object appContext) { + this.appContext = appContext; + } + public ValidatorHostContext(Object appContext, Element element) { + this.appContext = appContext; + this.resource = element; + } + + public ValidatorHostContext forContained(Element element) { + ValidatorHostContext res = new ValidatorHostContext(appContext); + res.resource = element; + return res; + } + } + + private class ValidatorHostServices implements IEvaluationContext { + + @Override + public Base resolveConstant(Object appContext, String name) throws PathEngineException { + ValidatorHostContext c = (ValidatorHostContext) appContext; + if (externalHostServices != null) + return externalHostServices.resolveConstant(c.appContext, name); + else + return null; + } + + @Override + public TypeDetails resolveConstantType(Object appContext, String name) throws PathEngineException { + ValidatorHostContext c = (ValidatorHostContext) appContext; + if (externalHostServices != null) + return externalHostServices.resolveConstantType(c.appContext, name); + else + return null; + } + + @Override + public boolean log(String argument, List<Base> focus) { + if (externalHostServices != null) + return externalHostServices.log(argument, focus); + else + return false; + } + + @Override + public FunctionDetails resolveFunction(String functionName) { + throw new Error("Not done yet"); + } + + @Override + public TypeDetails checkFunction(Object appContext, String functionName, List<TypeDetails> parameters) throws PathEngineException { + throw new Error("Not done yet"); + } + + @Override + public List<Base> executeFunction(Object appContext, String functionName, List<List<Base>> parameters) { + throw new Error("Not done yet"); + } + + @Override + public Base resolveReference(Object appContext, String url) { + ValidatorHostContext c = (ValidatorHostContext) appContext; + if (c.container != null || externalHostServices == null) + throw new Error("Not done yet - resolve "+url+" locally"); + else + return externalHostServices.resolveReference(c.appContext, url); + + } + + } + + private IWorkerContext context; + private FHIRPathEngine fpe; + + // configuration items + private CheckDisplayOption checkDisplay; + private boolean anyExtensionsAllowed; + private boolean errorForUnknownProfiles; + private boolean noInvariantChecks; + private boolean noTerminologyChecks; + private BestPracticeWarningLevel bpWarnings; + + private List<String> extensionDomains = new ArrayList<String>(); + + private IdStatus resourceIdRule; + private boolean allowXsiLocation; + + // used during the build process to keep the overall volume of messages down + private boolean suppressLoincSnomedMessages; + + private Bundle logical; + + // time tracking + private long overall = 0; + private long txTime = 0; + private long sdTime = 0; + private long loadTime = 0; + private long fpeTime = 0; + + private boolean noBindingMsgSuppressed; + private HashMap<Element, ResourceProfiles> resourceProfilesMap; + private IValidatorResourceFetcher fetcher; + long time = 0; + private ValidationProfileSet providedProfiles; + private IEvaluationContext externalHostServices; + + /* + * Keeps track of whether a particular profile has been checked or not yet + */ + private class ProfileUsage { + private StructureDefinition profile; + private boolean checked; + + public ProfileUsage(StructureDefinition profile) { + this.profile = profile; + this.checked = false; + } + + public boolean isChecked() { + return checked; + } + + public void setChecked() { + this.checked = true; + } + + public StructureDefinition getProfile() { + return profile; + } + } + + /* + * Keeps track of all profiles associated with a resource element and whether the resource has been checked against those profiles yet + */ + public class ResourceProfiles { + private Element resource; + private Element owner; + private NodeStack stack; + private HashMap<StructureDefinition, ProfileUsage> profiles; + private boolean processed; + + public ResourceProfiles(Element resource, NodeStack stack) { + this.resource = resource; + if (this.resource.getName().equals("contained")) + this.owner = stack.parent.element; + else + this.owner = resource; + this.stack = stack; + this.profiles = new HashMap<StructureDefinition, ProfileUsage>(); + this.processed = false; + } + + public boolean isProcessed() { + return processed; + } + + public void setProcessed() { + processed = true; + } + + public NodeStack getStack() { + return stack; + } + + public Element getOwner() { + return owner; + } + + public boolean hasProfiles() { + return !profiles.isEmpty(); + } + + public void addProfiles(List<ValidationMessage> errors, ValidationProfileSet profiles, String path, Element element, boolean external) throws FHIRException { + for (ProfileRegistration profile : profiles.getCanonical()) { + StructureDefinition sd = profiles.fetch(profile.getProfile()); + if (sd == null) + sd = context.fetchResource(StructureDefinition.class, profile.getProfile()); + if (sd == null) { + errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.UNKNOWN, path, "Unable to locate profile "+profile.getProfile(), external ? IssueSeverity.ERROR : IssueSeverity.WARNING)); + } else if (!sd.getType().equals(element.fhirType())) { + boolean ok = false; + if (element.fhirType().equals("Bundle")) { // special case: if the profile type isn't 'Bundle', then the profile applies to the first resource + List<Element> entries = element.getChildren("entry"); + if (entries.size() > 0) { + Element res = entries.get(0).getNamedChild("resource"); + if (res != null) { + ok = true; + // addProfile(errors, profile.getProfile(), profile.isError(), path, res); ggtodo: we need to go add this to a different profile + } + } + } + + if (!ok) + errors.add(new ValidationMessage(Source.InstanceValidator, IssueType.UNKNOWN, path, "Profile mismatch on type for "+profile.getProfile()+": the profile constrains "+sd.getType()+" but the element is "+element.fhirType(), IssueSeverity.ERROR)); + } else + addProfile(errors, profile.getProfile(), profile.isError(), path, element); + } + } + + public boolean addProfile(List<ValidationMessage> errors, String profile, boolean error, String path, Element element) { + String effectiveProfile = profile; + String version = null; + if (profile.contains("|")) { + effectiveProfile = profile.substring(0, profile.indexOf('|')); + version = profile.substring(profile.indexOf('|')+1); + } + StructureDefinition sd = null; + if (providedProfiles != null) + sd = providedProfiles.fetch(effectiveProfile); + if (sd == null) + sd = context.fetchResource(StructureDefinition.class, effectiveProfile); + + if (warningOrError(error, errors, IssueType.INVALID, element.line(), element.col(), path, sd != null, "StructureDefinition reference \"{0}\" could not be resolved", profile)) { + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, version==null || (sd.getVersion()!=null && sd.getVersion().equals(version)), + "Referenced version " + version + " does not match found version " + sd.getVersion() + " for profile " + sd.getUrl(), profile)) { + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, sd.hasSnapshot(), + "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) { + if (!profiles.containsKey(sd)) { + profiles.put(sd, new ProfileUsage(sd)); + addAncestorProfiles(sd); + return true; + } + } + } + } + return false; + } + + public void addAncestorProfiles(StructureDefinition sd) { + if (sd.hasDerivation() && sd.getDerivation().equals(StructureDefinition.TypeDerivationRule.CONSTRAINT)) { + StructureDefinition parentSd = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); + if (parentSd != null && !profiles.containsKey(parentSd)) { + ProfileUsage pu = new ProfileUsage(parentSd); + pu.setChecked(); // We're going to check the child, so no need to check the parent + profiles.put(parentSd, pu); + } + } + } + + public List<ProfileUsage> uncheckedProfiles() { + List<ProfileUsage> uncheckedProfiles = new ArrayList<ProfileUsage>(); + for (ProfileUsage profileUsage : profiles.values()) { + if (!profileUsage.isChecked()) + uncheckedProfiles.add(profileUsage); + } + return uncheckedProfiles; + } + + public boolean hasUncheckedProfiles() { + return !uncheckedProfiles().isEmpty(); + } + + public void checkProfile(StructureDefinition profile) { + ProfileUsage profileUsage = profiles.get(profile); + if (profileUsage==null) + throw new Error("Can't check profile that hasn't been added: " + profile.getUrl()); + else + profileUsage.setChecked(); + } + } + + public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices) { + super(); + this.context = theContext; + this.externalHostServices = hostServices; + fpe = new FHIRPathEngine(context); + fpe.setHostServices(new ValidatorHostServices()); + source = Source.InstanceValidator; + } + + @Override + public boolean isNoInvariantChecks() { + return noInvariantChecks; + } + + @Override + public IResourceValidator setNoInvariantChecks(boolean value) { + this.noInvariantChecks = value; + return this; + } + + public IValidatorResourceFetcher getFetcher() { + return this.fetcher; + } + + public IResourceValidator setFetcher(IValidatorResourceFetcher value) { + this.fetcher = value; + return this; + } + + private boolean allowUnknownExtension(String url) { + if (url.contains("example.org") || url.contains("acme.com") || url.contains("nema.org") || url.startsWith("http://hl7.org/fhir/tools/StructureDefinition/") || url.equals("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression")) + // Added structuredefinition-expression explicitly because it wasn't defined in the version of the spec it needs to be used with + return true; + for (String s : extensionDomains) + if (url.startsWith(s)) + return true; + return anyExtensionsAllowed; + } + + private boolean isKnownExtension(String url) { + // Added structuredefinition-expression explicitly because it wasn't defined in the version of the spec it needs to be used with + if (url.contains("example.org") || url.contains("acme.com") || url.contains("nema.org") || url.startsWith("http://hl7.org/fhir/tools/StructureDefinition/") || url.equals("http://hl7.org/fhir/StructureDefinition/structuredefinition-expression")) + return true; + for (String s : extensionDomains) + if (url.startsWith(s)) + return true; + return false; + } + + private void bpCheck(List<ValidationMessage> errors, IssueType invalid, int line, int col, String literalPath, boolean test, String message) { + if (bpWarnings != null) { + switch (bpWarnings) { + case Error: + rule(errors, invalid, line, col, literalPath, test, message); + break; + case Warning: + warning(errors, invalid, line, col, literalPath, test, message); + break; + case Hint: + hint(errors, invalid, line, col, literalPath, test, message); + break; + default: // do nothing + } + } + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, InputStream stream, FhirFormat format) throws FHIRException, IOException { + return validate(appContext, errors, stream, format, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, InputStream stream, FhirFormat format, String profile) throws FHIRException, IOException { + return validate(appContext, errors, stream, format, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, InputStream stream, FhirFormat format, StructureDefinition profile) throws FHIRException, IOException { + return validate(appContext, errors, stream, format, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, InputStream stream, FhirFormat format, ValidationProfileSet profiles) throws FHIRException, IOException { + ParserBase parser = Manager.makeParser(context, format); + if (parser instanceof XmlParser) + ((XmlParser) parser).setAllowXsiLocation(allowXsiLocation); + parser.setupValidation(ValidationPolicy.EVERYTHING, errors); + long t = System.nanoTime(); + Element e = parser.parse(stream); + loadTime = System.nanoTime() - t; + if (e != null) + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Resource resource) throws FHIRException, IOException { + return validate(appContext, errors, resource, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Resource resource, String profile) throws FHIRException, IOException { + return validate(appContext, errors, resource, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Resource resource, StructureDefinition profile) throws FHIRException, IOException { + return validate(appContext, errors, resource, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Resource resource, ValidationProfileSet profiles) throws FHIRException, IOException { + long t = System.nanoTime(); + Element e = new ObjectConverter(context).convert(resource); + loadTime = System.nanoTime() - t; + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, org.w3c.dom.Element element) throws FHIRException, IOException { + return validate(appContext, errors, element, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, org.w3c.dom.Element element, String profile) throws FHIRException, IOException { + return validate(appContext, errors, element, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, org.w3c.dom.Element element, StructureDefinition profile) throws FHIRException, IOException { + return validate(appContext, errors, element, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, org.w3c.dom.Element element, ValidationProfileSet profiles) throws FHIRException, IOException { + XmlParser parser = new XmlParser(context); + parser.setupValidation(ValidationPolicy.EVERYTHING, errors); + long t = System.nanoTime(); + Element e = parser.parse(element); + loadTime = System.nanoTime() - t; + if (e != null) + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Document document) throws FHIRException, IOException { + return validate(appContext, errors, document, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Document document, String profile) throws FHIRException, IOException { + return validate(appContext, errors, document, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Document document, StructureDefinition profile) throws FHIRException, IOException { + return validate(appContext, errors, document, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, Document document, ValidationProfileSet profiles) throws FHIRException, IOException { + XmlParser parser = new XmlParser(context); + parser.setupValidation(ValidationPolicy.EVERYTHING, errors); + long t = System.nanoTime(); + Element e = parser.parse(document); + loadTime = System.nanoTime() - t; + if (e != null) + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, JsonObject object) throws FHIRException, IOException { + return validate(appContext, errors, object, new ValidationProfileSet()); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, JsonObject object, String profile) throws FHIRException, IOException { + return validate(appContext, errors, object, new ValidationProfileSet(profile, true)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws FHIRException, IOException { + return validate(appContext, errors, object, new ValidationProfileSet(profile)); + } + + @Override + public org.hl7.fhir.r4.elementmodel.Element validate(Object appContext, List<ValidationMessage> errors, JsonObject object, ValidationProfileSet profiles) throws FHIRException, IOException { + JsonParser parser = new JsonParser(context); + parser.setupValidation(ValidationPolicy.EVERYTHING, errors); + long t = System.nanoTime(); + Element e = parser.parse(object); + loadTime = System.nanoTime() - t; + if (e != null) + validate(appContext, errors, e, profiles); + return e; + } + + @Override + public void validate(Object appContext, List<ValidationMessage> errors, Element element) throws FHIRException, IOException { + ValidationProfileSet profileSet = new ValidationProfileSet(); + validate(appContext, errors, element, profileSet); + } + + private void validateRemainder(Object appContext, List<ValidationMessage> errors) throws IOException, FHIRException { + boolean processedResource; + do { + processedResource = false; + Set<Element> keys = new HashSet<Element>(); + keys.addAll(resourceProfilesMap.keySet()); + for (Element resource : keys) { + ResourceProfiles rp = resourceProfilesMap.get(resource); + if (rp.hasUncheckedProfiles()) { + processedResource = true; + start(new ValidatorHostContext(appContext), errors, rp.getOwner(), resource, null, rp.getStack()); + } + } + } while (processedResource); + } + + @Override + public void validate(Object appContext, List<ValidationMessage> errors, Element element, String profile) throws FHIRException, IOException { + validate(appContext, errors, element, new ValidationProfileSet(profile, true)); + } + + @Override + public void validate(Object appContext, List<ValidationMessage> errors, Element element, StructureDefinition profile) throws FHIRException, IOException { + validate(appContext, errors, element, new ValidationProfileSet(profile)); + } + + @Override + public void validate(Object appContext, List<ValidationMessage> errors, Element element, ValidationProfileSet profiles) throws FHIRException, IOException { + // this is the main entry point; all the other entry points end up here coming here... + providedProfiles = profiles; + long t = System.nanoTime(); + boolean isRoot = false; + if (resourceProfilesMap == null) { + resourceProfilesMap = new HashMap<Element, ResourceProfiles>(); + isRoot = true; + } + validateResource(new ValidatorHostContext(appContext, element), errors, element, element, null, profiles, resourceIdRule, new NodeStack(element), true); + if (isRoot) { + validateRemainder(appContext, errors); + resourceProfilesMap = null; + checkElementUsage(errors, element, new NodeStack(element)); + } + overall = System.nanoTime() - t; + } + + private void checkElementUsage(List<ValidationMessage> errors, Element element, NodeStack stack) { + String elementUsage = element.getUserString("elementSupported"); + hint(errors, IssueType.INFORMATIONAL, element.line(),element.col(), stack.getLiteralPath(), elementUsage==null || elementUsage.equals("Y"), "Instance includes element that is not marked as 'mustSupport' and was validated against profiles declaring mustSupport=true"); + if (element.hasChildren()) { + String prevName = ""; + int elementCount = 0; + for (Element ce : element.getChildren()) { + if (ce.getName().equals(prevName)) + elementCount++; + else { + elementCount=1; + prevName = ce.getName(); + } + checkElementUsage(errors, ce, stack.push(ce, elementCount, null, null)); + } + } + } + + private boolean check(String v1, String v2) { + return v1 == null ? Utilities.noString(v1) : v1.equals(v2); + } + + private void checkAddress(List<ValidationMessage> errors, String path, Element focus, Address fixed) { + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); + checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); + checkFixedValue(errors, path + ".city", focus.getNamedChild("city"), fixed.getCityElement(), "city", focus); + checkFixedValue(errors, path + ".state", focus.getNamedChild("state"), fixed.getStateElement(), "state", focus); + checkFixedValue(errors, path + ".country", focus.getNamedChild("country"), fixed.getCountryElement(), "country", focus); + checkFixedValue(errors, path + ".zip", focus.getNamedChild("zip"), fixed.getPostalCodeElement(), "postalCode", focus); + + List<Element> lines = new ArrayList<Element>(); + focus.getNamedChildren("line", lines); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, lines.size() == fixed.getLine().size(), + "Expected " + Integer.toString(fixed.getLine().size()) + " but found " + Integer.toString(lines.size()) + " line elements")) { + for (int i = 0; i < lines.size(); i++) + checkFixedValue(errors, path + ".coding", lines.get(i), fixed.getLine().get(i), "coding", focus); + } + } + + private void checkAttachment(List<ValidationMessage> errors, String path, Element focus, Attachment fixed) { + checkFixedValue(errors, path + ".contentType", focus.getNamedChild("contentType"), fixed.getContentTypeElement(), "contentType", focus); + checkFixedValue(errors, path + ".language", focus.getNamedChild("language"), fixed.getLanguageElement(), "language", focus); + checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data", focus); + checkFixedValue(errors, path + ".url", focus.getNamedChild("url"), fixed.getUrlElement(), "url", focus); + checkFixedValue(errors, path + ".size", focus.getNamedChild("size"), fixed.getSizeElement(), "size", focus); + checkFixedValue(errors, path + ".hash", focus.getNamedChild("hash"), fixed.getHashElement(), "hash", focus); + checkFixedValue(errors, path + ".title", focus.getNamedChild("title"), fixed.getTitleElement(), "title", focus); + } + + // public API + + private boolean checkCode(List<ValidationMessage> errors, Element element, String path, String code, String system, String display) throws TerminologyServiceException { + long t = System.nanoTime(); + boolean ss = context.supportsSystem(system); + txTime = txTime + (System.nanoTime() - t); + if (ss) { + t = System.nanoTime(); + ValidationResult s = context.validateCode(system, code, display); + txTime = txTime + (System.nanoTime() - t); + if (s == null) + return true; + if (s.isOk()) { + if (s.getMessage() != null) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + return true; + } + if (s.getSeverity() == IssueSeverity.INFORMATION) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + else if (s.getSeverity() == IssueSeverity.WARNING) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + else + return rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage()); + return true; + } else if (system.startsWith("http://hl7.org/fhir")) { + if (system.equals("http://hl7.org/fhir/sid/icd-10")) + return true; // else don't check ICD-10 (for now) + else { + CodeSystem cs = getCodeSystem(system); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, cs != null, "Unknown Code System " + system)) { + ConceptDefinitionComponent def = getCodeDefinition(cs, code); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, def != null, "Unknown Code (" + system + "#" + code + ")")) + return warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, display == null || display.equals(def.getDisplay()), "Display should be '" + def.getDisplay() + "'"); + } + return false; + } + } else if (context.isNoTerminologyServer() && Utilities.existsInList(system, "http://loinc.org", "http://unitsofmeasure.org", "http://snomed.info/sct", "http://www.nlm.nih.gov/research/umls/rxnorm")) { + return true; // no checks in this case + } else if (startsWithButIsNot(system, "http://snomed.info/sct", "http://loinc.org", "http://unitsofmeasure.org", "http://www.nlm.nih.gov/research/umls/rxnorm")) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Invalid System URI: "+system); + return false; + } else { + try { + if (context.fetchResourceWithException(ValueSet.class, system) != null) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Invalid System URI: "+system+" - cannot use a value set URI as a system"); + // Lloyd: This error used to prohibit checking for downstream issues, but there are some cases where that checking needs to occur. Please talk to me before changing the code back. + } + return true; + } + catch (Exception e) { + return true; + } + } + } + + private boolean startsWithButIsNot(String system, String... uri) { + for (String s : uri) + if (!system.equals(s) && system.startsWith(s)) + return true; + return false; + } + + private void checkCodeableConcept(List<ValidationMessage> errors, String path, Element focus, CodeableConcept fixed) { + checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); + List<Element> codings = new ArrayList<Element>(); + focus.getNamedChildren("coding", codings); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, codings.size() == fixed.getCoding().size(), + "Expected " + Integer.toString(fixed.getCoding().size()) + " but found " + Integer.toString(codings.size()) + " coding elements")) { + for (int i = 0; i < codings.size(); i++) + checkFixedValue(errors, path + ".coding", codings.get(i), fixed.getCoding().get(i), "coding", focus); + } + } + + private void checkCodeableConcept(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition theElementCntext) { + if (!noTerminologyChecks && theElementCntext != null && theElementCntext.hasBinding()) { + ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing (cc)")) { + if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { + ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { + try { + CodeableConcept cc = ObjectConverter.readAsCodeableConcept(element); + if (!cc.hasCoding()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code is required from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "No code provided, and a code should be provided from the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()); + } else { + long t = System.nanoTime(); + + // Check whether the codes are appropriate for the type of binding we have + boolean bindingsOk = true; + if (binding.getStrength() != BindingStrength.EXAMPLE) { + boolean atLeastOneSystemIsSupported = false; + for (Coding nextCoding : cc.getCoding()) { + String nextSystem = nextCoding.getSystem(); + if (isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) { + atLeastOneSystemIsSupported = true; + break; + } + } + + if (!atLeastOneSystemIsSupported && binding.getStrength() == BindingStrength.EXAMPLE) { + // ignore this since we can't validate but it doesn't matter.. + } else { + ValidationResult vr = context.validateCode(cc, valueset); + if (!vr.isOk()) { + bindingsOk = false; + if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " and a code from this value set is required (class = "+vr.getErrorClass().toString()+")"); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), cc); + else + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " and a code should come from this value set unless it has no suitable code (class = "+vr.getErrorClass().toString()+")"); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " and a code is recommended to come from this value set (class = "+vr.getErrorClass().toString()+")"); + } else { + if (binding.getStrength() == BindingStrength.REQUIRED) + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()+", and a code from this value set is required) (codes = "+ccSummary(cc)+")"); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), cc); + else + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code) (codes = "+ccSummary(cc)+")"); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set) (codes = "+ccSummary(cc)+")"); + } + } else if (vr.getMessage()!=null) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, vr.getMessage()); + } + // Then, for any codes that are in code systems we are able + // to validate, we'll validate that the codes actually exist + if (bindingsOk) { + for (Coding nextCoding : cc.getCoding()) { + String nextCode = nextCoding.getCode(); + String nextSystem = nextCoding.getSystem(); + if (isNotBlank(nextCode) && isNotBlank(nextSystem) && context.supportsSystem(nextSystem)) { + ValidationResult vr = context.validateCode(nextSystem, nextCode, null); + if (!vr.isOk()) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Code {0} is not a valid code in code system {1}", nextCode, nextSystem); + } + } + } + } + txTime = txTime + (System.nanoTime() - t); + } + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept"); + } + } + } else if (binding.hasValueSet()) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); + } else if (!noBindingMsgSuppressed) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); + } + } + } + } + + private void checkMaxValueSet(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, Reference maxVSUrl, CodeableConcept cc) { + // TODO Auto-generated method stub + ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(maxVSUrl) + " not found")) { + try { + long t = System.nanoTime(); + ValidationResult vr = context.validateCode(cc, valueset); + txTime = txTime + (System.nanoTime() - t); + if (!vr.isOk()) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "None of the codes provided are in the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+", and a code from this value set is required) (codes = "+ccSummary(cc)+")"); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept using maxValueSet"); + } + } + } + + private void checkMaxValueSet(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, Reference maxVSUrl, Coding c) { + // TODO Auto-generated method stub + ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(maxVSUrl) + " not found")) { + try { + long t = System.nanoTime(); + ValidationResult vr = context.validateCode(c, valueset); + txTime = txTime + (System.nanoTime() - t); + if (!vr.isOk()) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided is not in the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+", and a code from this value set is required) (code = "+c.getSystem()+"#"+c.getCode()+")"); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept using maxValueSet"); + } + } + } + + private void checkMaxValueSet(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, Reference maxVSUrl, String value) { + // TODO Auto-generated method stub + ValueSet valueset = resolveBindingReference(profile, maxVSUrl, profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(maxVSUrl) + " not found")) { + try { + long t = System.nanoTime(); + ValidationResult vr = context.validateCode(null, value, null, valueset); + txTime = txTime + (System.nanoTime() - t); + if (!vr.isOk()) { + if (vr.getErrorClass() != null && vr.getErrorClass().isInfrastructure()) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided could not be validated against the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+"), (error = "+vr.getMessage()+")"); + else + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The code provided is not in the maximum value set " + describeReference(maxVSUrl) + " (" + valueset.getUrl()+"), and a code from this value set is required) (code = "+value+"), (error = "+vr.getMessage()+")"); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating CodeableConcept using maxValueSet"); + } + } + } + + private String ccSummary(CodeableConcept cc) { + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (Coding c : cc.getCoding()) + b.append(c.getSystem()+"#"+c.getCode()); + return b.toString(); + } + + private void checkCoding(List<ValidationMessage> errors, String path, Element focus, Coding fixed) { + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); + checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code", focus); + checkFixedValue(errors, path + ".display", focus.getNamedChild("display"), fixed.getDisplayElement(), "display", focus); + checkFixedValue(errors, path + ".userSelected", focus.getNamedChild("userSelected"), fixed.getUserSelectedElement(), "userSelected", focus); + } + + private void checkCoding(List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition theElementCntext, boolean inCodeableConcept) { + String code = element.getNamedChildValue("code"); + String system = element.getNamedChildValue("system"); + String display = element.getNamedChildValue("display"); + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Coding.system must be an absolute reference, not a local reference"); + + if (system != null && code != null && !noTerminologyChecks) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, !isValueSet(system), "The Coding references a value set, not a code system (\""+system+"\")"); + try { + if (checkCode(errors, element, path, code, system, display)) + if (theElementCntext != null && theElementCntext.hasBinding()) { + ElementDefinitionBindingComponent binding = theElementCntext.getBinding(); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, binding != null, "Binding for " + path + " missing")) { + if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { + ValueSet valueset = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, valueset != null, "ValueSet " + describeReference(binding.getValueSet()) + " not found")) { + try { + Coding c = ObjectConverter.readAsCoding(element); + long t = System.nanoTime(); + ValidationResult vr = null; + if (binding.getStrength() != BindingStrength.EXAMPLE) { + vr = context.validateCode(c, valueset); + } + txTime = txTime + (System.nanoTime() - t); + if (vr != null && !vr.isOk()) { + if (vr.IsNoService()) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided could not be validated in the absence of a terminology server"); + else if (vr.getErrorClass() != null && !vr.getErrorClass().isInfrastructure()) { + if (binding.getStrength() == BindingStrength.REQUIRED) + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl()+", and a code from this value set is required)"); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), c); + else + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Could not confirm that the codes provided are in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"); + } else if (binding.getStrength() == BindingStrength.REQUIRED) + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The Coding provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is required from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), c); + else + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The Coding provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code should come from this value set unless it has no suitable code)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The Coding provided is not in the value set " + describeReference(binding.getValueSet()) + " (" + valueset.getUrl() + ", and a code is recommended to come from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + } + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating Coding"); + } + } + } else if (binding.hasValueSet()) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding by URI reference cannot be checked"); + } else if (!inCodeableConcept && !noBindingMsgSuppressed) { + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Binding for path " + path + " has no source, so can't be checked"); + } + } + } + } catch (Exception e) { + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "Error "+e.getMessage()+" validating Coding"); + } + } + } + + private boolean isValueSet(String url) { + try { + ValueSet vs = context.fetchResourceWithException(ValueSet.class, url); + return vs != null; + } catch (Exception e) { + return false; + } + } + + private void checkContactPoint(List<ValidationMessage> errors, String path, Element focus, ContactPoint fixed) { + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); + checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period", focus); + + } + + protected void checkDeclaredProfiles(ResourceProfiles resourceProfiles, List<ValidationMessage> errors, Element resource, Element element, NodeStack stack) throws FHIRException { + Element meta = element.getNamedChild("meta"); + if (meta != null) { + List<Element> profiles = new ArrayList<Element>(); + meta.getNamedChildren("profile", profiles); + int i = 0; + for (Element profile : profiles) { + String ref = profile.primitiveValue(); + String p = stack.addToLiteralPath("meta", "profile", ":" + Integer.toString(i)); + if (rule(errors, IssueType.INVALID, element.line(), element.col(), p, !Utilities.noString(ref), "StructureDefinition reference invalid")) { + long t = System.nanoTime(); + resourceProfiles.addProfile(errors, ref, errorForUnknownProfiles, p, element); + i++; + } + } + } + } + + private StructureDefinition checkExtension(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, Element resource, Element element, ElementDefinition def, StructureDefinition profile, NodeStack stack) throws FHIRException, IOException { + String url = element.getNamedChildValue("url"); + boolean isModifier = element.getName().equals("modifierExtension"); + + long t = System.nanoTime(); + StructureDefinition ex = context.fetchResource(StructureDefinition.class, url); + sdTime = sdTime + (System.nanoTime() - t); + if (ex == null) { + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, allowUnknownExtension(url), "The extension " + url + " is unknown, and not allowed here")) + hint(errors, IssueType.STRUCTURE, element.line(), element.col(), path, isKnownExtension(url), "Unknown extension " + url); + } else { + if (def.getIsModifier()) + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), + "Extension modifier mismatch: the extension element is labelled as a modifier, but the underlying extension is not"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), + "Extension modifier mismatch: the extension element is not labelled as a modifier, but the underlying extension is"); + + // two questions + // 1. can this extension be used here? + checkExtensionContext(errors, element, /* path+"[url='"+url+"']", */ ex, stack, ex.getUrl()); + + if (isModifier) + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", ex.getSnapshot().getElement().get(0).getIsModifier(), + "The Extension '" + url + "' must be used as a modifierExtension"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", !ex.getSnapshot().getElement().get(0).getIsModifier(), + "The Extension '" + url + "' must not be used as an extension (it's a modifierExtension)"); + + // check the type of the extension: + Set<String> allowedTypes = listExtensionTypes(ex); + String actualType = getExtensionType(element); + if (actualType == null) + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", allowedTypes.isEmpty(), "The Extension '" + url + "' definition is for a complex extension, so it cannot contain a value"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path + "[url='" + url + "']", allowedTypes.contains(actualType), "The Extension '" + url + "' definition allows for the types "+allowedTypes.toString()+" but found type "+actualType); + + // 3. is the content of the extension valid? + validateElement(hostContext, errors, ex, ex.getSnapshot().getElement().get(0), null, null, resource, element, "Extension", stack, false); + + } + return ex; + } + + private String getExtensionType(Element element) { + for (Element e : element.getChildren()) { + if (e.getName().startsWith("value")) { + String tn = e.getName().substring(5); + String ltn = Utilities.uncapitalize(tn); + if (isPrimitiveType(ltn)) + return ltn; + else + return tn; + } + } + return null; + } + + private Set<String> listExtensionTypes(StructureDefinition ex) { + ElementDefinition vd = null; + for (ElementDefinition ed : ex.getSnapshot().getElement()) { + if (ed.getPath().startsWith("Extension.value")) { + vd = ed; + break; + } + } + Set<String> res = new HashSet<String>(); + if (vd != null && !"0".equals(vd.getMax())) { + for (TypeRefComponent tr : vd.getType()) { + res.add(tr.getCode()); + } + } + return res; + } + + private boolean checkExtensionContext(List<ValidationMessage> errors, Element element, StructureDefinition definition, NodeStack stack, String extensionParent) { + String extUrl = definition.getUrl(); + CommaSeparatedStringBuilder p = new CommaSeparatedStringBuilder(); + for (String lp : stack.getLogicalPaths()) + p.append(lp); + if (definition.getContextType() == ExtensionContext.DATATYPE) { + boolean ok = false; + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (StringType ct : definition.getContext()) { + b.append(ct.getValue()); + if (ct.getValue().equals("*") || stack.getLogicalPaths().contains(ct.getValue() + ".extension")) + ok = true; + } + return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, + "The extension " + extUrl + " is not allowed to be used on the logical path set [" + p.toString() + "] (allowed: datatype=" + b.toString() + ")"); + } else if (definition.getContextType() == ExtensionContext.EXTENSION) { + boolean ok = false; + for (StringType ct : definition.getContext()) + if (ct.getValue().equals("*") || ct.getValue().equals(extensionParent)) + ok = true; + return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, + "The extension " + extUrl + " is not allowed to be used with the extension '" + extensionParent + "'"); + } else if (definition.getContextType() == ExtensionContext.RESOURCE) { + boolean ok = false; + // String simplePath = container.getPath(); + // System.out.println(simplePath); + // if (effetive.endsWith(".extension") || simplePath.endsWith(".modifierExtension")) + // simplePath = simplePath.substring(0, simplePath.lastIndexOf('.')); + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (StringType ct : definition.getContext()) { + String c = ct.getValue(); + b.append(c); + if (c.equals("*") || stack.getLogicalPaths().contains(c + ".extension") || (c.startsWith("@") && stack.getLogicalPaths().contains(c.substring(1) + ".extension"))) + ; + ok = true; + } + return rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), ok, + "The extension " + extUrl + " is not allowed to be used on the logical path set " + p.toString() + " (allowed: resource=" + b.toString() + ")"); + } else + throw new Error("Unknown context type"); + } + // + // private String simplifyPath(String path) { + // String s = path.replace("/f:", "."); + // while (s.contains("[")) + // s = s.substring(0, s.indexOf("["))+s.substring(s.indexOf("]")+1); + // String[] parts = s.split("\\."); + // int i = 0; + // while (i < parts.length && !context.getProfiles().containsKey(parts[i].toLowerCase())) + // i++; + // if (i >= parts.length) + // throw new Error("Unable to process part "+path); + // int j = parts.length - 1; + // while (j > 0 && (parts[j].equals("extension") || parts[j].equals("modifierExtension"))) + // j--; + // StringBuilder b = new StringBuilder(); + // boolean first = true; + // for (int k = i; k <= j; k++) { + // if (k == j || !parts[k].equals(parts[k+1])) { + // if (first) + // first = false; + // else + // b.append("."); + // b.append(parts[k]); + // } + // } + // return b.toString(); + // } + // + + private void checkFixedValue(List<ValidationMessage> errors, String path, Element focus, org.hl7.fhir.r4.model.Element fixed, String propName, Element parent) { + if ((fixed == null || fixed.isEmpty()) && focus == null) + ; // this is all good + else if (fixed == null && focus != null) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, false, "Unexpected element " + focus.getName()); + else if (fixed != null && !fixed.isEmpty() && focus == null) + rule(errors, IssueType.VALUE, parent == null ? -1 : parent.line(), parent == null ? -1 : parent.col(), path, false, "Missing element '" + propName+"'"); + else { + String value = focus.primitiveValue(); + if (fixed instanceof org.hl7.fhir.r4.model.BooleanType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.BooleanType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.BooleanType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.IntegerType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.IntegerType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.IntegerType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.DecimalType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.DecimalType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.DecimalType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.Base64BinaryType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.Base64BinaryType) fixed).asStringValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.Base64BinaryType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.InstantType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.InstantType) fixed).getValue().toString(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.InstantType) fixed).asStringValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.StringType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.StringType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.StringType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.UriType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.UriType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.UriType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.DateType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.DateType) fixed).getValue().toString(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.DateType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.DateTimeType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.DateTimeType) fixed).getValue().toString(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.DateTimeType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.OidType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.OidType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.OidType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.UuidType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.UuidType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.UuidType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.CodeType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.CodeType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.CodeType) fixed).getValue() + "'"); + else if (fixed instanceof org.hl7.fhir.r4.model.IdType) + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, check(((org.hl7.fhir.r4.model.IdType) fixed).getValue(), value), + "Value is '" + value + "' but must be '" + ((org.hl7.fhir.r4.model.IdType) fixed).getValue() + "'"); + else if (fixed instanceof Quantity) + checkQuantity(errors, path, focus, (Quantity) fixed); + else if (fixed instanceof Address) + checkAddress(errors, path, focus, (Address) fixed); + else if (fixed instanceof ContactPoint) + checkContactPoint(errors, path, focus, (ContactPoint) fixed); + else if (fixed instanceof Attachment) + checkAttachment(errors, path, focus, (Attachment) fixed); + else if (fixed instanceof Identifier) + checkIdentifier(errors, path, focus, (Identifier) fixed); + else if (fixed instanceof Coding) + checkCoding(errors, path, focus, (Coding) fixed); + else if (fixed instanceof HumanName) + checkHumanName(errors, path, focus, (HumanName) fixed); + else if (fixed instanceof CodeableConcept) + checkCodeableConcept(errors, path, focus, (CodeableConcept) fixed); + else if (fixed instanceof Timing) + checkTiming(errors, path, focus, (Timing) fixed); + else if (fixed instanceof Period) + checkPeriod(errors, path, focus, (Period) fixed); + else if (fixed instanceof Range) + checkRange(errors, path, focus, (Range) fixed); + else if (fixed instanceof Ratio) + checkRatio(errors, path, focus, (Ratio) fixed); + else if (fixed instanceof SampledData) + checkSampledData(errors, path, focus, (SampledData) fixed); + + else + rule(errors, IssueType.EXCEPTION, focus.line(), focus.col(), path, false, "Unhandled fixed value type " + fixed.getClass().getName()); + List<Element> extensions = new ArrayList<Element>(); + focus.getNamedChildren("extension", extensions); + if (fixed.getExtension().size() == 0) { + rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == 0, "No extensions allowed"); + } else if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, extensions.size() == fixed.getExtension().size(), + "Extensions count mismatch: expected " + Integer.toString(fixed.getExtension().size()) + " but found " + Integer.toString(extensions.size()))) { + for (Extension e : fixed.getExtension()) { + Element ex = getExtensionByUrl(extensions, e.getUrl()); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, ex != null, "Extension count mismatch: unable to find extension: " + e.getUrl())) { + checkFixedValue(errors, path, ex.getNamedChild("extension").getNamedChild("value"), e.getValue(), "extension.value", ex.getNamedChild("extension")); + } + } + } + } + } + + private void checkHumanName(List<ValidationMessage> errors, String path, Element focus, HumanName fixed) { + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); + checkFixedValue(errors, path + ".text", focus.getNamedChild("text"), fixed.getTextElement(), "text", focus); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period", focus); + + List<Element> parts = new ArrayList<Element>(); + focus.getNamedChildren("family", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() > 0 == fixed.hasFamily(), + "Expected " + (fixed.hasFamily() ? "1" : "0") + " but found " + Integer.toString(parts.size()) + " family elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".family", parts.get(i), fixed.getFamilyElement(), "family", focus); + } + focus.getNamedChildren("given", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getGiven().size(), + "Expected " + Integer.toString(fixed.getGiven().size()) + " but found " + Integer.toString(parts.size()) + " given elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".given", parts.get(i), fixed.getGiven().get(i), "given", focus); + } + focus.getNamedChildren("prefix", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getPrefix().size(), + "Expected " + Integer.toString(fixed.getPrefix().size()) + " but found " + Integer.toString(parts.size()) + " prefix elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".prefix", parts.get(i), fixed.getPrefix().get(i), "prefix", focus); + } + focus.getNamedChildren("suffix", parts); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, parts.size() == fixed.getSuffix().size(), + "Expected " + Integer.toString(fixed.getSuffix().size()) + " but found " + Integer.toString(parts.size()) + " suffix elements")) { + for (int i = 0; i < parts.size(); i++) + checkFixedValue(errors, path + ".suffix", parts.get(i), fixed.getSuffix().get(i), "suffix", focus); + } + } + + private void checkIdentifier(List<ValidationMessage> errors, String path, Element element, ElementDefinition context) { + String system = element.getNamedChildValue("system"); + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, isAbsolute(system), "Identifier.system must be an absolute reference, not a local reference"); + } + + private void checkIdentifier(List<ValidationMessage> errors, String path, Element focus, Identifier fixed) { + checkFixedValue(errors, path + ".use", focus.getNamedChild("use"), fixed.getUseElement(), "use", focus); + checkFixedValue(errors, path + ".type", focus.getNamedChild("type"), fixed.getType(), "type", focus); + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); + checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriod(), "period", focus); + checkFixedValue(errors, path + ".assigner", focus.getNamedChild("assigner"), fixed.getAssigner(), "assigner", focus); + } + + private void checkPeriod(List<ValidationMessage> errors, String path, Element focus, Period fixed) { + checkFixedValue(errors, path + ".start", focus.getNamedChild("start"), fixed.getStartElement(), "start", focus); + checkFixedValue(errors, path + ".end", focus.getNamedChild("end"), fixed.getEndElement(), "end", focus); + } + + private void checkPrimitive(Object appContext, List<ValidationMessage> errors, String path, String type, ElementDefinition context, Element e, StructureDefinition profile) throws FHIRException, IOException { + if (isBlank(e.primitiveValue())) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.hasChildren(), "primitive types must have a value or must have child extensions"); + return; + } + String regex = context.getExtensionString(ToolingExtensions.EXT_REGEX); + if (regex!=null) + regex = context.getExtensionString("http://hl7.org/fhir/StructureDefinition/regex"); + if (regex!=null) + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().matches(regex), "Element value '" + e.primitiveValue() + "' does not meet regex '" + regex + "'"); + + if (type.equals("boolean")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, "true".equals(e.primitiveValue()) || "false".equals(e.primitiveValue()), "boolean values must be 'true' or 'false'"); + } + if (type.equals("uri")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.primitiveValue().startsWith("oid:"), "URI values cannot start with oid:"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !e.primitiveValue().startsWith("uuid:"), "URI values cannot start with uuid:"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().equals(e.primitiveValue().trim()), "URI values cannot have leading or trailing whitespace"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); + + // now, do we check the URI target? + if (fetcher != null) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, fetcher.resolveURL(appContext, path, e.primitiveValue()), "URL value '"+e.primitiveValue()+"' does not resolve"); + } + } + if (type.equalsIgnoreCase("string") && e.hasPrimitiveValue()) { + if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().length() > 0, "@value cannot be empty")) { + warning(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue() == null || e.primitiveValue().trim().equals(e.primitiveValue()), "value should not start or finish with whitespace"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); + } + } + if (type.equals("dateTime")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, + e.primitiveValue() + .matches("-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)?)?)?"), + "Not a valid date time"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !hasTime(e.primitiveValue()) || hasTimeZone(e.primitiveValue()), "if a date has a time, it must have a timezone"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); + } + if (type.equals("date")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, e.primitiveValue().matches("-?[0-9]{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1]))?)?"), + "Not a valid date"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum value of " + context.getMaxLength()); + } + if (type.equals("integer")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxValueIntegerType() || !context.getMaxValueIntegerType().hasValue() || (context.getMaxValueIntegerType().getValue() >= new Integer(e.getValue()).intValue()), "value is greater than permitted maximum value of " + (context.hasMaxValueIntegerType() ? context.getMaxValueIntegerType() : "")); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMinValueIntegerType() || !context.getMinValueIntegerType().hasValue() || (context.getMinValueIntegerType().getValue() <= new Integer(e.getValue()).intValue()), "value is less than permitted minimum value of " + (context.hasMinValueIntegerType() ? context.getMinValueIntegerType() : "")); + } + if (type.equals("instant")) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, + e.primitiveValue().matches("-?[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))"), + "The instant '" + e.primitiveValue() + "' is not valid (by regex)"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, yearIsValid(e.primitiveValue()), "The value '" + e.primitiveValue() + "' does not have a valid year"); + } + + if (type.equals("code") && e.primitiveValue() != null) { + // Technically, a code is restricted to string which has at least one character and no leading or trailing whitespace, and where there is no whitespace + // other than single spaces in the contents + rule(errors, IssueType.INVALID, e.line(), e.col(), path, passesCodeWhitespaceRules(e.primitiveValue()), "The code '" + e.primitiveValue() + "' is not valid (whitespace rules)"); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxLength() || context.getMaxLength()==0 || e.primitiveValue().length() <= context.getMaxLength(), "value is longer than permitted maximum length of " + context.getMaxLength()); + } + + if (context.hasBinding() && e.primitiveValue() != null) { + checkPrimitiveBinding(errors, path, type, context, e, profile); + } + + if (type.equals("xhtml")) { + XhtmlNode xhtml = e.getXhtml(); + if (xhtml != null) { // if it is null, this is an error already noted in the parsers + // check that the namespace is there and correct. + String ns = xhtml.getNsDecl(); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, FormatUtilities.XHTML_NS.equals(ns), "Wrong namespace on the XHTML ('"+ns+"')"); + // check that inner namespaces are all correct + checkInnerNS(errors, e, path, xhtml.getChildNodes()); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, "div".equals(xhtml.getName()), "Wrong name on the XHTML ('"+ns+"') - must start with div"); + // check that no illegal elements and attributes have been used + checkInnerNames(errors, e, path, xhtml.getChildNodes()); + } + } + + if (context.hasFixed()) + checkFixedValue(errors,path,e, context.getFixed(), context.getSliceName(), null); + + // for nothing to check + } + + private void checkInnerNames(List<ValidationMessage> errors, Element e, String path, List<XhtmlNode> list) { + for (XhtmlNode node : list) { + if (node.getNodeType() == NodeType.Element) { + rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.existsInList(node.getName(), + "p", "br", "div", "h1", "h2", "h3", "h4", "h5", "h6", "a", "span", "b", "em", "i", "strong", + "small", "big", "tt", "small", "dfn", "q", "var", "abbr", "acronym", "cite", "blockquote", "hr", "address", "bdo", "kbd", "q", "sub", "sup", + "ul", "ol", "li", "dl", "dt", "dd", "pre", "table", "caption", "colgroup", "col", "thead", "tr", "tfoot", "tbody", "th", "td", + "code", "samp", "img", "map", "area" + + ), "Illegal element name in the XHTML ('"+node.getName()+"')"); + for (String an : node.getAttributes().keySet()) { + boolean ok = an.startsWith("xmlns") || Utilities.existsInList(an, + "title", "style", "class", "id", "lang", "xml:lang", "dir", "accesskey", "tabindex", + // tables + "span", "width", "align", "valign", "char", "charoff", "abbr", "axis", "headers", "scope", "rowspan", "colspan") || + + Utilities.existsInList(node.getName()+"."+an, "a.href", "a.name", "img.src", "img.border", "div.xmlns", "blockquote.cite", "q.cite", + "a.charset", "a.type", "a.name", "a.href", "a.hreflang", "a.rel", "a.rev", "a.shape", "a.coords", "img.src", + "img.alt", "img.longdesc", "img.height", "img.width", "img.usemap", "img.ismap", "map.name", "area.shape", + "area.coords", "area.href", "area.nohref", "area.alt", "table.summary", "table.width", "table.border", + "table.frame", "table.rules", "table.cellspacing", "table.cellpadding", "pre.space" + ); + if (!ok) + rule(errors, IssueType.INVALID, e.line(), e.col(), path, false, "Illegal attribute name in the XHTML ('"+an+"' on '"+node.getName()+"')"); + } + checkInnerNames(errors, e, path, node.getChildNodes()); + } + } + } + + private void checkInnerNS(List<ValidationMessage> errors, Element e, String path, List<XhtmlNode> list) { + for (XhtmlNode node : list) { + if (node.getNodeType() == NodeType.Element) { + String ns = node.getNsDecl(); + rule(errors, IssueType.INVALID, e.line(), e.col(), path, ns == null || FormatUtilities.XHTML_NS.equals(ns), "Wrong namespace on the XHTML ('"+ns+"')"); + checkInnerNS(errors, e, path, node.getChildNodes()); + } + } + } + + private void checkPrimitiveBinding(List<ValidationMessage> errors, String path, String type, ElementDefinition elementContext, Element element, StructureDefinition profile) { + // We ignore bindings that aren't on string, uri or code + if (!element.hasPrimitiveValue() || !("code".equals(type) || "string".equals(type) || "uri".equals(type))) { + return; + } + if (noTerminologyChecks) + return; + + String value = element.primitiveValue(); + // System.out.println("check "+value+" in "+path); + + // firstly, resolve the value set + ElementDefinitionBindingComponent binding = elementContext.getBinding(); + if (binding.hasValueSet() && binding.getValueSet() instanceof Reference) { + ValueSet vs = resolveBindingReference(profile, binding.getValueSet(), profile.getUrl()); + if (warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, vs != null, "ValueSet {0} not found", describeReference(binding.getValueSet()))) { + long t = System.nanoTime(); + ValidationResult vr = null; + if (binding.getStrength() != BindingStrength.EXAMPLE) { + vr = context.validateCode(null, value, null, vs); + } + txTime = txTime + (System.nanoTime() - t); + if (vr != null && !vr.isOk()) { + if (vr.IsNoService()) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') could not be validated in the absence of a terminology server"); + else if (binding.getStrength() == BindingStrength.REQUIRED) + rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is required from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + else if (binding.getStrength() == BindingStrength.EXTENSIBLE) { + if (binding.hasExtension("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet")) + checkMaxValueSet(errors, path, element, profile, (Reference) binding.getExtensionsByUrl("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet").get(0).getValue(), value); + else + warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code should come from this value set unless it has no suitable code)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + } else if (binding.getStrength() == BindingStrength.PREFERRED) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, false, "The value provided ('"+value+"') is not in the value set " + describeReference(binding.getValueSet()) + " (" + vs.getUrl() + ", and a code is recommended to come from this value set)"+(vr.getMessage() != null ? " (error message = "+vr.getMessage()+")" : "")); + } + } + } else if (!noBindingMsgSuppressed) + hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, !type.equals("code"), "Binding has no source, so can't be checked"); + } + + private void checkQuantity(List<ValidationMessage> errors, String path, Element focus, Quantity fixed) { + checkFixedValue(errors, path + ".value", focus.getNamedChild("value"), fixed.getValueElement(), "value", focus); + checkFixedValue(errors, path + ".comparator", focus.getNamedChild("comparator"), fixed.getComparatorElement(), "comparator", focus); + checkFixedValue(errors, path + ".units", focus.getNamedChild("unit"), fixed.getUnitElement(), "units", focus); + checkFixedValue(errors, path + ".system", focus.getNamedChild("system"), fixed.getSystemElement(), "system", focus); + checkFixedValue(errors, path + ".code", focus.getNamedChild("code"), fixed.getCodeElement(), "code", focus); + } + + // implementation + + private void checkRange(List<ValidationMessage> errors, String path, Element focus, Range fixed) { + checkFixedValue(errors, path + ".low", focus.getNamedChild("low"), fixed.getLow(), "low", focus); + checkFixedValue(errors, path + ".high", focus.getNamedChild("high"), fixed.getHigh(), "high", focus); + + } + + private void checkRatio(List<ValidationMessage> errors, String path, Element focus, Ratio fixed) { + checkFixedValue(errors, path + ".numerator", focus.getNamedChild("numerator"), fixed.getNumerator(), "numerator", focus); + checkFixedValue(errors, path + ".denominator", focus.getNamedChild("denominator"), fixed.getDenominator(), "denominator", focus); + } + + private void checkReference(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, Element element, StructureDefinition profile, ElementDefinition container, String parentType, NodeStack stack) throws FHIRException, IOException { + Reference reference = ObjectConverter.readAsReference(element); + + String ref = reference.getReference(); + if (Utilities.noString(ref)) { + if (Utilities.noString(reference.getIdentifier().getSystem()) && Utilities.noString(reference.getIdentifier().getValue())) { + warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, !Utilities.noString(element.getNamedChildValue("display")), "A Reference without an actual reference or identifier should have a display"); + } + return; + } + + Element we = localResolve(ref, stack, errors, path); + String refType; + if (ref.startsWith("#")) { + refType = "contained"; + } else { + if (we == null) { + refType = "remote"; + } else { + refType = "bundle"; + } + } + ReferenceValidationPolicy pol = refType.equals("contained") || refType.equals("bundle") ? ReferenceValidationPolicy.CHECK_VALID : fetcher == null ? ReferenceValidationPolicy.IGNORE : fetcher.validationPolicy(hostContext.appContext, path, ref); + + if (pol.checkExists()) { + if (we == null) { + if (fetcher == null) + throw new FHIRException("Resource resolution services not provided"); + we = fetcher.fetch(hostContext.appContext, ref); + } + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, we != null, "Unable to resolve resource '"+ref+"'"); + } + + String ft; + if (we != null) + ft = we.getType(); + else + ft = tryParse(ref); + + if (we != null && pol.checkType()) { + if (warning(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ft!=null, "Unable to determine type of target resource")) { + boolean ok = false; + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (TypeRefComponent type : container.getType()) { + if (!ok && type.getCode().equals("Reference")) { + // we validate as much as we can. First, can we infer a type from the profile? + if (!type.hasTargetProfile() || type.getTargetProfile().equals("http://hl7.org/fhir/StructureDefinition/Resource")) + ok = true; + else { + String pr = type.getTargetProfile(); + + String bt = getBaseType(profile, pr); + StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + bt); + if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, bt != null, "Unable to resolve the profile reference '" + pr + "'")) { + b.append(bt); + ok = bt.equals(ft); + if (ok && we!=null && pol.checkValid()) { + doResourceProfile(hostContext, we, pr, errors, stack.push(we, -1, null, null), path, element); + } + } else + ok = true; // suppress following check + if (ok && type.hasAggregation()) { + boolean modeOk; + for (Enumeration<AggregationMode> mode : type.getAggregation()) { + if (mode.getValue().equals(AggregationMode.CONTAINED) && refType.equals("contained")) + ok = true; + else if (mode.getValue().equals(AggregationMode.BUNDLED) && refType.equals("bundled")) + ok = true; + else if (mode.getValue().equals(AggregationMode.REFERENCED) && (refType.equals("bundled")||refType.equals("remote"))) + ok = true; + } + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ok, "Reference is " + refType + " which isn't supported by the specified aggregation mode(s) for the reference"); + } + } + } + if (!ok && type.getCode().equals("*")) { + ok = true; // can refer to anything + } + } + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), path, ok, "Invalid Resource target type. Found " + ft + ", but expected one of (" + b.toString() + ")"); + } + } + if (pol == ReferenceValidationPolicy.CHECK_VALID) { + // todo.... + } + } + + private void doResourceProfile(ValidatorHostContext hostContext, Element resource, String profile, List<ValidationMessage> errors, NodeStack stack, String path, Element element) throws FHIRException, IOException { + ResourceProfiles resourceProfiles = addResourceProfile(errors, resource, profile, path, element, stack); + if (resourceProfiles.isProcessed()) { + start(hostContext, errors, resource, resource, null, stack); + } + } + + private ResourceProfiles getResourceProfiles(Element resource, NodeStack stack) { + ResourceProfiles resourceProfiles = resourceProfilesMap.get(resource); + if (resourceProfiles==null) { + resourceProfiles = new ResourceProfiles(resource, stack); + resourceProfilesMap.put(resource, resourceProfiles); + } + return resourceProfiles; + } + + private ResourceProfiles addResourceProfile(List<ValidationMessage> errors, Element resource, String profile, String path, Element element, NodeStack stack) { + ResourceProfiles resourceProfiles = getResourceProfiles(resource, stack); + resourceProfiles.addProfile(errors, profile, errorForUnknownProfiles, path, element); + return resourceProfiles; + } + + private String checkResourceType(String type) { + long t = System.nanoTime(); + try { + if (context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type) != null) + return type; + else + return null; + } finally { + sdTime = sdTime + (System.nanoTime() - t); + } + } + + private void checkSampledData(List<ValidationMessage> errors, String path, Element focus, SampledData fixed) { + checkFixedValue(errors, path + ".origin", focus.getNamedChild("origin"), fixed.getOrigin(), "origin", focus); + checkFixedValue(errors, path + ".period", focus.getNamedChild("period"), fixed.getPeriodElement(), "period", focus); + checkFixedValue(errors, path + ".factor", focus.getNamedChild("factor"), fixed.getFactorElement(), "factor", focus); + checkFixedValue(errors, path + ".lowerLimit", focus.getNamedChild("lowerLimit"), fixed.getLowerLimitElement(), "lowerLimit", focus); + checkFixedValue(errors, path + ".upperLimit", focus.getNamedChild("upperLimit"), fixed.getUpperLimitElement(), "upperLimit", focus); + checkFixedValue(errors, path + ".dimensions", focus.getNamedChild("dimensions"), fixed.getDimensionsElement(), "dimensions", focus); + checkFixedValue(errors, path + ".data", focus.getNamedChild("data"), fixed.getDataElement(), "data", focus); + } + + private void checkTiming(List<ValidationMessage> errors, String path, Element focus, Timing fixed) { + checkFixedValue(errors, path + ".repeat", focus.getNamedChild("repeat"), fixed.getRepeat(), "value", focus); + + List<Element> events = new ArrayList<Element>(); + focus.getNamedChildren("event", events); + if (rule(errors, IssueType.VALUE, focus.line(), focus.col(), path, events.size() == fixed.getEvent().size(), + "Expected " + Integer.toString(fixed.getEvent().size()) + " but found " + Integer.toString(events.size()) + " event elements")) { + for (int i = 0; i < events.size(); i++) + checkFixedValue(errors, path + ".event", events.get(i), fixed.getEvent().get(i), "event", focus); + } + } + + private boolean codeinExpansion(ValueSetExpansionContainsComponent cnt, String system, String code) { + for (ValueSetExpansionContainsComponent c : cnt.getContains()) { + if (code.equals(c.getCode()) && system.equals(c.getSystem().toString())) + return true; + if (codeinExpansion(c, system, code)) + return true; + } + return false; + } + + private boolean codeInExpansion(ValueSet vs, String system, String code) { + for (ValueSetExpansionContainsComponent c : vs.getExpansion().getContains()) { + if (code.equals(c.getCode()) && (system == null || system.equals(c.getSystem()))) + return true; + if (codeinExpansion(c, system, code)) + return true; + } + return false; + } + + private String describeReference(Type reference) { + if (reference == null) + return "null"; + if (reference instanceof UriType) + return ((UriType) reference).getValue(); + if (reference instanceof Reference) + return ((Reference) reference).getReference(); + return "??"; + } + + private String describeTypes(List<TypeRefComponent> types) { + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (TypeRefComponent t : types) { + b.append(t.getCode()); + } + return b.toString(); + } + + protected ElementDefinition findElement(StructureDefinition profile, String name) { + for (ElementDefinition c : profile.getSnapshot().getElement()) { + if (c.getPath().equals(name)) { + return c; + } + } + return null; + } + + public BestPracticeWarningLevel getBasePracticeWarningLevel() { + return bpWarnings; + } + + private String getBaseType(StructureDefinition profile, String pr) { + StructureDefinition p = resolveProfile(profile, pr); + if (p == null) + return null; + else + return p.getType(); + } + + @Override + public CheckDisplayOption getCheckDisplay() { + return checkDisplay; + } + + // private String findProfileTag(Element element) { + // String uri = null; + // List<Element> list = new ArrayList<Element>(); + // element.getNamedChildren("category", list); + // for (Element c : list) { + // if ("http://hl7.org/fhir/tag/profile".equals(c.getAttribute("scheme"))) { + // uri = c.getAttribute("term"); + // } + // } + // return uri; + // } + + private ConceptDefinitionComponent getCodeDefinition(ConceptDefinitionComponent c, String code) { + if (code.equals(c.getCode())) + return c; + for (ConceptDefinitionComponent g : c.getConcept()) { + ConceptDefinitionComponent r = getCodeDefinition(g, code); + if (r != null) + return r; + } + return null; + } + + private ConceptDefinitionComponent getCodeDefinition(CodeSystem cs, String code) { + for (ConceptDefinitionComponent c : cs.getConcept()) { + ConceptDefinitionComponent r = getCodeDefinition(c, code); + if (r != null) + return r; + } + return null; + } + + private Element getContainedById(Element container, String id) { + List<Element> contained = new ArrayList<Element>(); + container.getNamedChildren("contained", contained); + for (Element we : contained) { + if (id.equals(we.getNamedChildValue("id"))) + return we; + } + return null; + } + + public IWorkerContext getContext() { + return context; + } + + private ElementDefinition getCriteriaForDiscriminator(String path, ElementDefinition element, String discriminator, StructureDefinition profile) throws DefinitionException, FHIRLexerException { + if ("value".equals(discriminator) && element.hasFixed()) + return element; + + ExpressionNode expr = fpe.parse(discriminator); + long t2 = System.nanoTime(); + ElementDefinition ed = fpe.evaluateDefinition(expr, profile, element); + sdTime = sdTime + (System.nanoTime() - t2); + return ed; + } + + + private Element getExtensionByUrl(List<Element> extensions, String urlSimple) { + for (Element e : extensions) { + if (urlSimple.equals(e.getNamedChildValue("url"))) + return e; + } + return null; + } + + public List<String> getExtensionDomains() { + return extensionDomains; + } + + private Element getFromBundle(Element bundle, String ref, String fullUrl, List<ValidationMessage> errors, String path) { + String targetUrl = null; + String version = ""; + if (ref.startsWith("http") || ref.startsWith("urn")) { + // We've got an absolute reference, no need to calculate + if (ref.contains("/_history/")) { + targetUrl = ref.substring(0, ref.indexOf("/_history/") - 1); + version = ref.substring(ref.indexOf("/_history/") + 10); + } else + targetUrl = ref; + + } else if (fullUrl == null) { + //This isn't a problem for signatures - if it's a signature, we won't have a resolution for a relative reference. For anything else, this is an error + rule(errors, IssueType.REQUIRED, -1, -1, path, path.startsWith("Bundle.signature"), "Relative Reference appears inside Bundle whose entry is missing a fullUrl"); + return null; + + } else if (ref.split("/").length!=2) { + rule(errors, IssueType.INVALID, -1, -1, path, false, "Relative URLs must be of the format [ResourceName]/[id]. Encountered " + ref); + return null; + + } else { + String base = ""; + if (fullUrl.startsWith("urn")) { + String[] parts = fullUrl.split("\\:"); + for (int i=0; i < parts.length-1; i++) { + base = base + parts[i] + ":"; + } + } else { + String[] parts; + parts = fullUrl.split("/"); + for (int i=0; i < parts.length-2; i++) { + base = base + parts[i] + "/"; + } + } + + String id = null; + if (ref.contains("/_history/")) { + version = ref.substring(ref.indexOf("/_history/") + 10); + id = ref.substring(0, ref.indexOf("/history/")-1); + } else if (base.startsWith("urn")) + id = ref.split("/")[1]; + else + id = ref; + + targetUrl = base + id; + } + + List<Element> entries = new ArrayList<Element>(); + bundle.getNamedChildren("entry", entries); + Element match = null; + for (Element we : entries) { + if (we.getChildValue("fullUrl").equals(targetUrl)) { + Element r = we.getNamedChild("resource"); + if (version.isEmpty()) { + rule(errors, IssueType.FORBIDDEN, -1, -1, path, match==null, "Multiple matches in bundle for reference " + ref); + match = r; + } else { + try { + if (r.getChildren("meta").get(0).getChildValue("versionId").equals(version)) { + rule(errors, IssueType.FORBIDDEN, -1, -1, path, match==null, "Multiple matches in bundle for reference " + ref); + match = r; + } + } catch (Exception e) { + warning(errors, IssueType.REQUIRED, -1, -1, path, r.getChildren("meta").size()==1 && r.getChildren("meta").get(0).getChildValue("versionId")!=null, "Entries matching fullURL " + targetUrl + " should declare meta/versionId because there are version-specific references"); + // If one of these things is null + } + } + } + } + + warning(errors, IssueType.REQUIRED, -1, -1, path, match!=null || !targetUrl.startsWith("urn"), "URN reference is not locally contained within the bundle " + ref); + return match; + } + + private StructureDefinition getProfileForType(String type) { + if (logical != null) + for (BundleEntryComponent be : logical.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + if (sd.getId().equals(type)) + return sd; + } + } + + long t = System.nanoTime(); + try { + return context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type); + } finally { + sdTime = sdTime + (System.nanoTime() - t); + } + } + + private Element getValueForDiscriminator(Object appContext, List<ValidationMessage> errors, Element element, String discriminator, ElementDefinition criteria, NodeStack stack) throws FHIRException, IOException { + String p = stack.getLiteralPath()+"."+element.getName(); + Element focus = element; + String[] dlist = discriminator.split("\\."); + for (String d : dlist) { + if (focus.fhirType().equals("Reference") && d.equals("reference")) { + String url = focus.getChildValue("reference"); + if (Utilities.noString(url)) + throw new FHIRException("No reference resolving discriminator "+discriminator+" from "+element.getProperty().getName()); + // Note that we use the passed in stack here. This might be a problem if the discriminator is deep enough? + Element target = resolve(appContext, url, stack, errors, p); + if (target == null) + throw new FHIRException("Unable to find resource "+url+" at "+d+" resolving discriminator "+discriminator+" from "+element.getProperty().getName()); + focus = target; + } else if (d.equals("value") && focus.isPrimitive()) { + return focus; + } else { + List<Element> children = focus.getChildren(d); + if (children.isEmpty()) + throw new FHIRException("Unable to find "+d+" resolving discriminator "+discriminator+" from "+element.getProperty().getName()); + if (children.size() > 1) + throw new FHIRException("Found "+Integer.toString(children.size())+" items for "+d+" resolving discriminator "+discriminator+" from "+element.getProperty().getName()); + focus = children.get(0); + p = p + "."+d; + } + } + return focus; + } + + private CodeSystem getCodeSystem(String system) { + long t = System.nanoTime(); + try { + return context.fetchCodeSystem(system); + } finally { + txTime = txTime + (System.nanoTime() - t); + } + } + + private boolean hasTime(String fmt) { + return fmt.contains("T"); + } + + private boolean hasTimeZone(String fmt) { + return fmt.length() > 10 && (fmt.substring(10).contains("-") || fmt.substring(10).contains("+") || fmt.substring(10).contains("Z")); + } + + private boolean isAbsolute(String uri) { + return Utilities.noString(uri) || uri.startsWith("http:") || uri.startsWith("https:") || uri.startsWith("urn:uuid:") || uri.startsWith("urn:oid:") || uri.startsWith("urn:ietf:") + || uri.startsWith("urn:iso:") || uri.startsWith("urn:iso-astm:") || isValidFHIRUrn(uri); + } + + private boolean isValidFHIRUrn(String uri) { + return (uri.equals("urn:x-fhir:uk:id:nhs-number")) || uri.startsWith("urn:"); // Anyone can invent a URN, so why should we complain? + } + + public boolean isAnyExtensionsAllowed() { + return anyExtensionsAllowed; + } + + public boolean isErrorForUnknownProfiles() { + return errorForUnknownProfiles; + } + + public void setErrorForUnknownProfiles(boolean errorForUnknownProfiles) { + this.errorForUnknownProfiles = errorForUnknownProfiles; + } + + private boolean isParametersEntry(String path) { + String[] parts = path.split("\\."); + return parts.length > 2 && parts[parts.length - 1].equals("resource") && (pathEntryHasName(parts[parts.length - 2], "parameter") || pathEntryHasName(parts[parts.length - 2], "part")); + } + + private boolean isBundleEntry(String path) { + String[] parts = path.split("\\."); + return parts.length > 2 && parts[parts.length - 1].equals("resource") && pathEntryHasName(parts[parts.length - 2], "entry"); + } + + private boolean isBundleOutcome(String path) { + String[] parts = path.split("\\."); + return parts.length > 2 && parts[parts.length - 1].equals("outcome") && pathEntryHasName(parts[parts.length - 2], "response"); + } + + + private static boolean pathEntryHasName(String thePathEntry, String theName) { + if (thePathEntry.equals(theName)) { + return true; + } + if (thePathEntry.length() >= theName.length() + 3) { + if (thePathEntry.startsWith(theName)) { + if (thePathEntry.charAt(theName.length()) == '[') { + return true; + } + } + } + return false; + } + + private boolean isPrimitiveType(String code) { + StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+code); + return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE; + } + + + + public boolean isSuppressLoincSnomedMessages() { + return suppressLoincSnomedMessages; + } + + private boolean nameMatches(String name, String tail) { + if (tail.endsWith("[x]")) + return name.startsWith(tail.substring(0, tail.length() - 3)); + else + return (name.equals(tail)); + } + + // private String mergePath(String path1, String path2) { + // // path1 is xpath path + // // path2 is dotted path + // String[] parts = path2.split("\\."); + // StringBuilder b = new StringBuilder(path1); + // for (int i = 1; i < parts.length -1; i++) + // b.append("/f:"+parts[i]); + // return b.toString(); + // } + + private boolean passesCodeWhitespaceRules(String v) { + if (!v.trim().equals(v)) + return false; + boolean lastWasSpace = true; + for (char c : v.toCharArray()) { + if (c == ' ') { + if (lastWasSpace) + return false; + else + lastWasSpace = true; + } else if (Character.isWhitespace(c)) + return false; + else + lastWasSpace = false; + } + return true; + } + + private Element localResolve(String ref, NodeStack stack, List<ValidationMessage> errors, String path) { + if (ref.startsWith("#")) { + // work back through the contained list. + // really, there should only be one level for this (contained resources cannot contain + // contained resources), but we'll leave that to some other code to worry about + while (stack != null && stack.getElement() != null) { + if (stack.getElement().getProperty().isResource()) { + // ok, we'll try to find the contained reference + Element res = getContainedById(stack.getElement(), ref.substring(1)); + if (res != null) + return res; + } + if (stack.getElement().getSpecial() == SpecialElement.BUNDLE_ENTRY) { + return null; // we don't try to resolve contained references across this boundary + } + stack = stack.parent; + } + return null; + } else { + // work back through the contained list - if any of them are bundles, try to resolve + // the resource in the bundle + String fullUrl = null; // we're going to try to work this out as we go up + while (stack != null && stack.getElement() != null) { + if (stack.getElement().getSpecial() == SpecialElement.BUNDLE_ENTRY && fullUrl==null && stack.parent.getElement().getName().equals("entry")) { + fullUrl = stack.parent.getElement().getChildValue("fullUrl"); // we don't try to resolve contained references across this boundary + if (fullUrl==null) + rule(errors, IssueType.REQUIRED, stack.parent.getElement().line(), stack.parent.getElement().col(), stack.parent.getLiteralPath(), fullUrl!=null, "Bundle entry missing fullUrl"); + } + if ("Bundle".equals(stack.getElement().getType())) { + Element res = getFromBundle(stack.getElement(), ref, fullUrl, errors, path); + return res; + } + stack = stack.parent; + } + } + return null; + } + + private Element resolve(Object appContext, String ref, NodeStack stack, List<ValidationMessage> errors, String path) throws IOException, FHIRException { + Element local = localResolve(ref, stack, errors, path); + if (local!=null) + return local; + if (fetcher == null) + return null; + return fetcher.fetch(appContext, ref); + } + + private ValueSet resolveBindingReference(DomainResource ctxt, Type reference, String uri) { + if (reference instanceof UriType) { + long t = System.nanoTime(); + ValueSet fr = context.fetchResource(ValueSet.class, ((UriType) reference).getValue().toString()); + txTime = txTime + (System.nanoTime() - t); + return fr; + } + 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 { + long t = System.nanoTime(); + String ref = ((Reference) reference).getReference(); + if (!Utilities.isAbsoluteUrl(ref)) + ref = resolve(uri, ref); + ValueSet fr = context.fetchResource(ValueSet.class, ref); + txTime = txTime + (System.nanoTime() - t); + return fr; + } + } + else + return null; + } + + private String resolve(String uri, String ref) { + if (isBlank(uri)) { + return ref; + } + String[] up = uri.split("\\/"); + String[] rp = ref.split("\\/"); + if (context.getResourceNames().contains(up[up.length-2]) && context.getResourceNames().contains(rp[0])) { + StringBuilder b = new StringBuilder(); + for (int i = 0; i < up.length-2; i++) { + b.append(up[i]); + b.append("/"); + } + b.append(ref); + return b.toString(); + } else + return ref; + } + + private Element resolveInBundle(List<Element> entries, String ref, String fullUrl, String type, String id) { + if (Utilities.isAbsoluteUrl(ref)) { + // if the reference is absolute, then you resolve by fullUrl. No other thinking is required. + for (Element entry : entries) { + String fu = entry.getNamedChildValue("fullUrl"); + if (ref.equals(fu)) + return entry; + } + return null; + } else { + // split into base, type, and id + String u = null; + if (fullUrl != null && fullUrl.endsWith(type+"/"+id)) + // fullUrl = complex + u = fullUrl.substring((type+"/"+id).length())+ref; + String[] parts = ref.split("\\/"); + if (parts.length >= 2) { + String t = parts[0]; + String i = parts[1]; + for (Element entry : entries) { + String fu = entry.getNamedChildValue("fullUrl"); + if (u != null && fullUrl.equals(u)) + return entry; + if (u == null) { + Element resource = entry.getNamedChild("resource"); + String et = resource.getType(); + String eid = resource.getNamedChildValue("id"); + if (t.equals(et) && i.equals(eid)) + return entry; + } + } + } + return null; + } + } + + private ElementDefinition resolveNameReference(StructureDefinitionSnapshotComponent snapshot, String contentReference) { + for (ElementDefinition ed : snapshot.getElement()) + if (contentReference.equals("#"+ed.getId())) + return ed; + return null; + } + + private StructureDefinition resolveProfile(StructureDefinition profile, String pr) { + if (pr.startsWith("#")) { + for (Resource r : profile.getContained()) { + if (r.getId().equals(pr.substring(1)) && r instanceof StructureDefinition) + return (StructureDefinition) r; + } + return null; + } else { + long t = System.nanoTime(); + StructureDefinition fr = context.fetchResource(StructureDefinition.class, pr); + sdTime = sdTime + (System.nanoTime() - t); + return fr; + } + } + + private ElementDefinition resolveType(String type) { + if (logical != null) + for (BundleEntryComponent be : logical.getEntry()) { + if (be.hasResource() && be.getResource() instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) be.getResource(); + if (sd.getId().equals(type)) + return sd.getSnapshot().getElement().get(0); + } + } + String url = "http://hl7.org/fhir/StructureDefinition/" + type; + long t = System.nanoTime(); + StructureDefinition sd = context.fetchResource(StructureDefinition.class, url); + sdTime = sdTime + (System.nanoTime() - t); + if (sd == null || !sd.hasSnapshot()) + return null; + else + return sd.getSnapshot().getElement().get(0); + } + + public void setAnyExtensionsAllowed(boolean anyExtensionsAllowed) { + this.anyExtensionsAllowed = anyExtensionsAllowed; + } + + public IResourceValidator setBestPracticeWarningLevel(BestPracticeWarningLevel value) { + bpWarnings = value; + return this; + } + + @Override + public void setCheckDisplay(CheckDisplayOption checkDisplay) { + this.checkDisplay = checkDisplay; + } + + public void setSuppressLoincSnomedMessages(boolean suppressLoincSnomedMessages) { + this.suppressLoincSnomedMessages = suppressLoincSnomedMessages; + } + + public IdStatus getResourceIdRule() { + return resourceIdRule; + } + + public void setResourceIdRule(IdStatus resourceIdRule) { + this.resourceIdRule = resourceIdRule; + } + + + public boolean isAllowXsiLocation() { + return allowXsiLocation; + } + + public void setAllowXsiLocation(boolean allowXsiLocation) { + this.allowXsiLocation = allowXsiLocation; + } + + /** + * + * @param element + * - the candidate that might be in the slice + * @param path + * - for reporting any errors. the XPath for the element + * @param slice + * - the definition of how slicing is determined + * @param ed + * - the slice for which to test membership + * @param errors + * @param stack + * @return + * @throws DefinitionException + * @throws DefinitionException + * @throws IOException + * @throws FHIRException + */ + private boolean sliceMatches(ValidatorHostContext hostContext, Element element, String path, ElementDefinition slicer, ElementDefinition ed, StructureDefinition profile, List<ValidationMessage> errors, NodeStack stack) throws DefinitionException, FHIRException, IOException { + if (!slicer.getSlicing().hasDiscriminator()) + return false; // cannot validate in this case + + ExpressionNode n = (ExpressionNode) ed.getUserData("slice.expression.cache"); + if (n == null) { + long t = System.nanoTime(); + // GG: this approach is flawed because it treats discriminators individually rather than collectively + StringBuilder expression = new StringBuilder("true"); + for (ElementDefinitionSlicingDiscriminatorComponent s : slicer.getSlicing().getDiscriminator()) { + String discriminator = s.getPath(); + if (s.getType() == DiscriminatorType.PROFILE) + throw new FHIRException("Validating against slices with discriminators based on profiles is not yet supported by the FHIRPath engine: " + discriminator); + // Todo: Fix this once FHIRPath (and this engine) supports a boolean function that test profile conformance + + ElementDefinition criteriaElement = getCriteriaForDiscriminator(path, ed, discriminator, profile); + if (s.getType() == DiscriminatorType.TYPE) { + String type = null; + if (!criteriaElement.getPath().contains("[") && discriminator.contains("[")) { + discriminator = discriminator.substring(0, discriminator.indexOf('[')); + String lastNode = tail(discriminator); + type = tail(criteriaElement.getPath()).substring(lastNode.length()); + type = type.substring(0,1).toLowerCase() + type.substring(1); + } else if (!criteriaElement.hasType() || criteriaElement.getType().size()==1) { + if (discriminator.contains("[")) + discriminator = discriminator.substring(0, discriminator.indexOf('[')); + type = criteriaElement.getType().get(0).getCode(); + } + if (type==null) + throw new DefinitionException("Discriminator (" + discriminator + ") is based on type, but slice " + ed.getId() + " does not declare a type"); + if (discriminator.isEmpty()) + expression.append(" and this is " + type); + else + expression.append(" and " + discriminator + " is " + type); + } else if (s.getType() == DiscriminatorType.EXISTS) { + if (criteriaElement.hasMin() && criteriaElement.getMin()>=1) + expression.append(" and (" + discriminator + ".exists())"); + else if (criteriaElement.hasMax() && criteriaElement.getMax().equals("0")) + expression.append(" and (" + discriminator + ".exists().not())"); + else + throw new FHIRException("Discriminator (" + discriminator + ") is based on element existence, but slice " + ed.getId() + " neither sets min>=1 or max=0"); + } else if (criteriaElement.hasFixed()) { + buildFixedExpression(ed, expression, discriminator, criteriaElement); + } else if (criteriaElement.hasPattern()) { + buildPattternExpression(ed, expression, discriminator, criteriaElement); + } else if (criteriaElement.hasBinding() && criteriaElement.getBinding().hasStrength() && criteriaElement.getBinding().getStrength().equals(BindingStrength.REQUIRED) && criteriaElement.getBinding().getValueSetReference()!=null) { + expression.append(" and (" + discriminator + " memberOf '" + criteriaElement.getBinding().getValueSetReference().getReference() + "')"); + } else { + throw new DefinitionException("Could not match discriminator (" + discriminator + ") for slice " + ed.getId() + " in profile " + profile.getUrl() + " - does not have fixed value, binding or existence assertions"); + } + } + + try { + n = fpe.parse(expression.toString()); + } catch (FHIRLexerException e) { + throw new FHIRException("Problem processing expression "+expression +" in profile " + profile.getUrl() + " path " + path + ": " + e.getMessage()); + } + fpeTime = fpeTime + (System.nanoTime() - t); + ed.setUserData("slice.expression.cache", n); + } + + String msg; + boolean ok; + try { + long t = System.nanoTime(); + ok = fpe.evaluateToBoolean(hostContext, hostContext.resource, element, n); + fpeTime = fpeTime + (System.nanoTime() - t); + msg = fpe.forLog(); + } catch (Exception ex) { + throw new FHIRException("Problem evaluating slicing expression for element in profile " + profile.getUrl() + " path " + path + " (fhirPath = "+n+"): " + ex.getMessage()); + } + return ok; + } + + private void buildPattternExpression(ElementDefinition ed, StringBuilder expression, String discriminator, ElementDefinition criteriaElement) throws DefinitionException { + Type pattern = criteriaElement.getPattern(); + if (pattern instanceof CodeableConcept) { + CodeableConcept cc = (CodeableConcept) pattern; + buildCodeableConceptExpression(ed, expression, discriminator, cc); + } else + throw new DefinitionException("Unsupported fixed pattern type for discriminator(" + discriminator + ") for slice " + ed.getId() + ": " + pattern.getClass().getName()); + } + + private void buildCodeableConceptExpression(ElementDefinition ed, StringBuilder expression, String discriminator, CodeableConcept cc) + throws DefinitionException { + if (cc.hasText()) + throw new DefinitionException("Unsupported CodeableConcept pattern - using text - for discriminator(" + discriminator + ") for slice " + ed.getId()); + if (!cc.hasCoding() || cc.getCoding().size() > 1) + throw new DefinitionException("Unsupported CodeableConcept pattern - must be just one coding - for discriminator(" + discriminator + ") for slice " + ed.getId()); + Coding c = cc.getCodingFirstRep(); + if (c.hasExtension() || cc.hasExtension()) + throw new DefinitionException("Unsupported CodeableConcept pattern - extensions are not allowed - for discriminator(" + discriminator + ") for slice " + ed.getId()); + expression.append(" and " + discriminator + ".coding.where("); + boolean first = true; + if (c.hasSystem()) { + first = false; + expression.append("system = '"+c.getSystem()+"'"); + } + if (c.hasVersion()) { + if (first) first = false; else expression.append(" and "); + expression.append("version = '"+c.getVersion()+"'"); + } + if (c.hasCode()) { + if (first) first = false; else expression.append(" and "); + expression.append("code = '"+c.getCode()+"'"); + } + if (c.hasDisplay()) { + if (first) first = false; else expression.append(" and "); + expression.append("display = '"+c.getDisplay()+"'"); + } + expression.append(").exists()"); + } + + private void buildFixedExpression(ElementDefinition ed, StringBuilder expression, String discriminator, ElementDefinition criteriaElement) throws DefinitionException { + Type fixed = criteriaElement.getFixed(); + if (fixed instanceof CodeableConcept) { + CodeableConcept cc = (CodeableConcept) fixed; + buildCodeableConceptExpression(ed, expression, discriminator, cc); + } else { + expression.append(" and (" + discriminator + " = "); + if (fixed instanceof StringType) { + Gson gson = new Gson(); + String json = gson.toJson((StringType)fixed); + String escapedString = json.substring(json.indexOf(":")+2); + escapedString = escapedString.substring(0, escapedString.indexOf(",\"myStringValue")-1); + expression.append("'" + escapedString + "'"); + } else if (fixed instanceof UriType) { + expression.append("'" + ((UriType)fixed).asStringValue() + "'"); + } else if (fixed instanceof IntegerType) { + expression.append(((IntegerType)fixed).asStringValue()); + } else if (fixed instanceof DecimalType) { + expression.append(((IntegerType)fixed).asStringValue()); + } else if (fixed instanceof BooleanType) { + expression.append(((BooleanType)fixed).asStringValue()); + } else + throw new DefinitionException("Unsupported fixed value type for discriminator(" + discriminator + ") for slice " + ed.getId() + ": " + fixed.getClass().getName()); + expression.append(")"); + } + } + + // we assume that the following things are true: + // the instance at root is valid against the schema and schematron + // the instance validator had no issues against the base resource profile + private void start(ValidatorHostContext hostContext, List<ValidationMessage> errors, Element resource, Element element, StructureDefinition defn, NodeStack stack) throws FHIRException, FHIRException, IOException { + // profile is valid, and matches the resource name + ResourceProfiles resourceProfiles = getResourceProfiles(element, stack); + if (!resourceProfiles.isProcessed()) + checkDeclaredProfiles(resourceProfiles, errors, resource, element, stack); + + if (!resourceProfiles.isProcessed()) { + resourceProfiles.setProcessed(); + if (!resourceProfiles.hasProfiles() && + (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), defn.hasSnapshot(), + "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided"))) { + // Don't need to validate against the resource if there's a profile because the profile snapshot will include the relevant parts of the resources + validateElement(hostContext, errors, defn, defn.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); + } + + // specific known special validations + if (element.getType().equals("Bundle")) + validateBundle(errors, element, stack); + if (element.getType().equals("Observation")) + validateObservation(errors, element, stack); + if (element.getType().equals("QuestionnaireResponse")) + validateQuestionannaireResponse(errors, element, stack); + } + for (ProfileUsage profileUsage : resourceProfiles.uncheckedProfiles()) { + profileUsage.setChecked(); +// todo: re-enable this when I can deal with the impact... (GG) +// if (!profileUsage.getProfile().getType().equals(resource.fhirType())) +// throw new FHIRException("Profile type mismatch - resource is "+resource.fhirType()+", and profile is for "+profileUsage.getProfile().getType()); + validateElement(hostContext, errors, profileUsage.getProfile(), profileUsage.getProfile().getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); + } + } + + private void validateQuestionannaireResponse(List<ValidationMessage> errors, Element element, NodeStack stack) { + Element q = element.getNamedChild("questionnaire"); + if (hint(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), q != null && isNotBlank(q.getNamedChildValue("reference")), "No questionnaire is identified, so no validation can be performed against the base questionnaire")) { + long t = System.nanoTime(); + Questionnaire qsrc = context.fetchResource(Questionnaire.class, q.getNamedChildValue("reference")); + sdTime = sdTime + (System.nanoTime() - t); + if (warning(errors, IssueType.REQUIRED, q.line(), q.col(), stack.getLiteralPath(), qsrc != null, "The questionnaire could not be resolved, so no validation can be performed against the base questionnaire")) { + boolean inProgress = "in-progress".equals(element.getNamedChildValue("status")); + validateQuestionannaireResponseItems(qsrc, qsrc.getItem(), errors, element, stack, inProgress); + } + } + } + + private void validateQuestionannaireResponseItem(Questionnaire qsrc, QuestionnaireItemComponent qItem, List<ValidationMessage> errors, Element element, NodeStack stack, boolean inProgress) { + String text = element.getNamedChildValue("text"); + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), Utilities.noString(text) || text.equals(qItem.getText()), "If text exists, it must match the questionnaire definition for linkId "+qItem.getLinkId()); + + List<Element> answers = new ArrayList<Element>(); + element.getNamedChildren("answer", answers); + if (inProgress) + warning(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), (answers.size() > 0) || !qItem.getRequired(), "No response answer found for required item "+qItem.getLinkId()); + else + rule(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), (answers.size() > 0) || !qItem.getRequired(), "No response answer found for required item "+qItem.getLinkId()); + if (answers.size() > 1) + rule(errors, IssueType.INVALID, answers.get(1).line(), answers.get(1).col(), stack.getLiteralPath(), qItem.getRepeats(), "Only one response answer item with this linkId allowed"); + + for (Element answer : answers) { + NodeStack ns = stack.push(answer, -1, null, null); + switch (qItem.getType()) { + case GROUP: + rule(errors, IssueType.STRUCTURE, answer.line(), answer.col(), stack.getLiteralPath(), false, "Items of type group should not have answers"); + break; + case DISPLAY: // nothing + break; + case BOOLEAN: + validateQuestionnaireResponseItemType(errors, answer, ns, "boolean"); + break; + case DECIMAL: + validateQuestionnaireResponseItemType(errors, answer, ns, "decimal"); + break; + case INTEGER: + validateQuestionnaireResponseItemType(errors, answer, ns, "integer"); + break; + case DATE: + validateQuestionnaireResponseItemType(errors, answer, ns, "date"); + break; + case DATETIME: + validateQuestionnaireResponseItemType(errors, answer, ns, "dateTime"); + break; + case TIME: + validateQuestionnaireResponseItemType(errors, answer, ns, "time"); + break; + case STRING: + validateQuestionnaireResponseItemType(errors, answer, ns, "string"); + break; + case TEXT: + validateQuestionnaireResponseItemType(errors, answer, ns, "text"); + break; + case URL: + validateQuestionnaireResponseItemType(errors, answer, ns, "uri"); + break; + case ATTACHMENT: + validateQuestionnaireResponseItemType(errors, answer, ns, "Attachment"); + break; + case REFERENCE: + validateQuestionnaireResponseItemType(errors, answer, ns, "Reference"); + break; + case QUANTITY: + if (validateQuestionnaireResponseItemType(errors, answer, ns, "Quantity").equals("Quantity")) + if (qItem.hasExtension("???")) + validateQuestionnaireResponseItemQuantity(errors, answer, ns); + break; + case CHOICE: + String itemType=validateQuestionnaireResponseItemType(errors, answer, ns, "Coding", "date", "time", "integer", "string"); + if (itemType.equals("Coding")) validateAnswerCode(errors, answer, ns, qsrc, qItem, false); + else if (itemType.equals("date")) checkOption(errors, answer, ns, qsrc, qItem, "date"); + else if (itemType.equals("time")) checkOption(errors, answer, ns, qsrc, qItem, "time"); + else if (itemType.equals("integer")) checkOption(errors, answer, ns, qsrc, qItem, "integer"); + else if (itemType.equals("string")) checkOption(errors, answer, ns, qsrc, qItem, "string"); + break; + case OPENCHOICE: + itemType=validateQuestionnaireResponseItemType(errors, answer, ns, "Coding", "date", "time", "integer", "string"); + if (itemType.equals("Coding")) validateAnswerCode(errors, answer, ns, qsrc, qItem, true); + else if (itemType.equals("date")) checkOption(errors, answer, ns, qsrc, qItem, "date"); + else if (itemType.equals("time")) checkOption(errors, answer, ns, qsrc, qItem, "time"); + else if (itemType.equals("integer")) checkOption(errors, answer, ns, qsrc, qItem, "integer"); + else if (itemType.equals("string")) checkOption(errors, answer, ns, qsrc, qItem, "string", true); + break; + case QUESTION: + // TODO: how to validate this??? + break; + case NULL: + // Should not happen + break; + } + validateQuestionannaireResponseItems(qsrc, qItem.getItem(), errors, answer, stack, inProgress); + } + if (qItem.getType() == null) { + fail(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), false, "Definition for item "+qItem.getLinkId() + " does not contain a type"); + } else if (qItem.getType() == QuestionnaireItemType.GROUP) { + validateQuestionannaireResponseItems(qsrc, qItem.getItem(), errors, element, stack, inProgress); + } else { + List<Element> items = new ArrayList<Element>(); + element.getNamedChildren("item", items); + for (Element item : items) { + NodeStack ns = stack.push(item, -1, null, null); + rule(errors, IssueType.STRUCTURE, answers.get(0).line(), answers.get(0).col(), stack.getLiteralPath(), false, "Items not of type group should not have items - Item with linkId {0} of type {1} has {2} item(s)", qItem.getLinkId(), qItem.getType(), items.size()); + } + } + } + + private void validateQuestionannaireResponseItem(Questionnaire qsrc, QuestionnaireItemComponent qItem, List<ValidationMessage> errors, List<Element> elements, NodeStack stack, boolean inProgress) { + if (elements.size() > 1) + rule(errors, IssueType.INVALID, elements.get(1).line(), elements.get(1).col(), stack.getLiteralPath(), qItem.getRepeats(), "Only one response item with this linkId allowed"); + for (Element element : elements) { + NodeStack ns = stack.push(element, -1, null, null); + validateQuestionannaireResponseItem(qsrc, qItem, errors, element, ns, inProgress); + } + } + + private int getLinkIdIndex(List<QuestionnaireItemComponent> qItems, String linkId) { + for (int i = 0; i < qItems.size(); i++) { + if (linkId.equals(qItems.get(i).getLinkId())) + return i; + } + return -1; + } + + private void validateQuestionannaireResponseItems(Questionnaire qsrc, List<QuestionnaireItemComponent> qItems, List<ValidationMessage> errors, Element element, NodeStack stack, boolean inProgress) { + List<Element> items = new ArrayList<Element>(); + element.getNamedChildren("item", items); + // now, sort into stacks + Map<String, List<Element>> map = new HashMap<String, List<Element>>(); + int lastIndex = -1; + for (Element item : items) { + String linkId = item.getNamedChildValue("linkId"); + if (rule(errors, IssueType.REQUIRED, item.line(), item.col(), stack.getLiteralPath(), !Utilities.noString(linkId), "No LinkId, so can't be validated")) { + int index = getLinkIdIndex(qItems, linkId); + if (index == -1) { + QuestionnaireItemComponent qItem = findQuestionnaireItem(qsrc, linkId); + if (qItem != null) { + rule(errors, IssueType.STRUCTURE, item.line(), item.col(), stack.getLiteralPath(), index > -1, "Structural Error: item is in the wrong place"); + NodeStack ns = stack.push(item, -1, null, null); + validateQuestionannaireResponseItem(qsrc, qItem, errors, element, ns, inProgress); + } + else + rule(errors, IssueType.NOTFOUND, item.line(), item.col(), stack.getLiteralPath(), index > -1, "LinkId \""+linkId+"\" not found in questionnaire"); + } + else + { + rule(errors, IssueType.STRUCTURE, item.line(), item.col(), stack.getLiteralPath(), index >= lastIndex, "Structural Error: items are out of order"); + lastIndex = index; + List<Element> mapItem = map.get(linkId); + if (mapItem == null) { + mapItem = new ArrayList<Element>(); + map.put(linkId, mapItem); + } + mapItem.add(item); + } + } + } + + // ok, now we have a list of known items, grouped by linkId. We"ve made an error for anything out of order + for (QuestionnaireItemComponent qItem : qItems) { + List<Element> mapItem = map.get(qItem.getLinkId()); + if (mapItem != null) + validateQuestionannaireResponseItem(qsrc, qItem, errors, mapItem, stack, inProgress); + else + rule(errors, IssueType.REQUIRED, element.line(), element.col(), stack.getLiteralPath(), !qItem.getRequired(), "No response found for required item "+qItem.getLinkId()); + } + } + + private void validateQuestionnaireResponseItemQuantity( List<ValidationMessage> errors, Element answer, NodeStack stack) { + + } + + private String validateQuestionnaireResponseItemType(List<ValidationMessage> errors, Element element, NodeStack stack, String... types) { + List<Element> values = new ArrayList<Element>(); + element.getNamedChildrenWithWildcard("value[x]", values); + if (values.size() > 0) { + NodeStack ns = stack.push(values.get(0), -1, null, null); + CommaSeparatedStringBuilder l = new CommaSeparatedStringBuilder(); + for (String s : types) { + l.append(s); + if (values.get(0).getName().equals("value"+Utilities.capitalize(s))) + return(s); + } + if (types.length == 1) + rule(errors, IssueType.STRUCTURE, values.get(0).line(), values.get(0).col(), ns.getLiteralPath(), false, "Answer value must be of type "+types[0]); + else + rule(errors, IssueType.STRUCTURE, values.get(0).line(), values.get(0).col(), ns.getLiteralPath(), false, "Answer value must be one of the types "+l.toString()); + } + return null; + } + + private QuestionnaireItemComponent findQuestionnaireItem(Questionnaire qSrc, String linkId) { + return findItem(qSrc.getItem(), linkId); + } + + private QuestionnaireItemComponent findItem(List<QuestionnaireItemComponent> list, String linkId) { + for (QuestionnaireItemComponent item : list) { + if (linkId.equals(item.getLinkId())) + return item; + QuestionnaireItemComponent result = findItem(item.getItem(), linkId); + if (result != null) + return result; + } + return null; + } + + /* private void validateAnswerCode(List<ValidationMessage> errors, Element value, NodeStack stack, List<Coding> optionList) { + String system = value.getNamedChildValue("system"); + String code = value.getNamedChildValue("code"); + boolean found = false; + for (Coding c : optionList) { + if (ObjectUtil.equals(c.getSystem(), system) && ObjectUtil.equals(c.getCode(), code)) { + found = true; + break; + } + } + rule(errors, IssueType.STRUCTURE, value.line(), value.col(), stack.getLiteralPath(), found, "The code "+system+"::"+code+" is not a valid option"); + }*/ + + private void validateAnswerCode(List<ValidationMessage> errors, Element value, NodeStack stack, Questionnaire qSrc, Reference ref, boolean theOpenChoice) { + ValueSet vs = resolveBindingReference(qSrc, ref, qSrc.getUrl()); + if (warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), vs != null, "ValueSet " + describeReference(ref) + " not found")) { + try { + Coding c = ObjectConverter.readAsCoding(value); + if (isBlank(c.getCode()) && isBlank(c.getSystem()) && isNotBlank(c.getDisplay())) { + if (theOpenChoice) { + return; + } + } + + long t = System.nanoTime(); + ValidationResult res = context.validateCode(c, vs); + txTime = txTime + (System.nanoTime() - t); + if (!res.isOk()) + rule(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "The value provided ("+c.getSystem()+"::"+c.getCode()+") is not in the options value set in the questionnaire"); + } catch (Exception e) { + warning(errors, IssueType.CODEINVALID, value.line(), value.col(), stack.getLiteralPath(), false, "Error " + e.getMessage() + " validating Coding against Questionnaire Options"); + } + } + } + + private void validateAnswerCode( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean theOpenChoice) { + Element v = answer.getNamedChild("valueCoding"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getOption().size() > 0) + checkCodingOption(errors, answer, stack, qSrc, qItem, theOpenChoice); + // validateAnswerCode(errors, v, stack, qItem.getOption()); + else if (qItem.hasOptions()) + validateAnswerCode(errors, v, stack, qSrc, qItem.getOptions(), theOpenChoice); + else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate options because no option or options are provided"); + } + + private void checkOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, String type) { + checkOption(errors, answer, stack, qSrc, qItem, type, false); + } + + private void checkOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, String type, boolean openChoice) { + if (type.equals("integer")) checkIntegerOption(errors, answer, stack, qSrc, qItem, openChoice); + else if (type.equals("date")) checkDateOption(errors, answer, stack, qSrc, qItem, openChoice); + else if (type.equals("time")) checkTimeOption(errors, answer, stack, qSrc, qItem, openChoice); + else if (type.equals("string")) checkStringOption(errors, answer, stack, qSrc, qItem, openChoice); + else if (type.equals("Coding")) checkCodingOption(errors, answer, stack, qSrc, qItem, openChoice); + } + + private void checkIntegerOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueInteger"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getOption().size() > 0) { + List<IntegerType> list = new ArrayList<IntegerType>(); + for (QuestionnaireItemOptionComponent components : qItem.getOption()) { + try { + list.add(components.getValueIntegerType()); + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type integer"); + } else { + boolean found = false; + for (IntegerType item : list) { + if (item.getValue() == Integer.parseInt(v.primitiveValue())) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The integer "+v.primitiveValue()+" is not a valid option"); + } + } + } else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate integer answer option because no option list is provided"); + } + + private void checkDateOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueDate"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getOption().size() > 0) { + List<DateType> list = new ArrayList<DateType>(); + for (QuestionnaireItemOptionComponent components : qItem.getOption()) { + try { + list.add(components.getValueDateType()); + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type date"); + } else { + boolean found = false; + for (DateType item : list) { + if (item.getValue().equals(v.primitiveValue())) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The date "+v.primitiveValue()+" is not a valid option"); + } + } + } else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate date answer option because no option list is provided"); + } + + private void checkTimeOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueTime"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getOption().size() > 0) { + List<TimeType> list = new ArrayList<TimeType>(); + for (QuestionnaireItemOptionComponent components : qItem.getOption()) { + try { + list.add(components.getValueTimeType()); + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type time"); + } else { + boolean found = false; + for (TimeType item : list) { + if (item.getValue().equals(v.primitiveValue())) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The time "+v.primitiveValue()+" is not a valid option"); + } + } + } else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate time answer option because no option list is provided"); + } + + private void checkStringOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueString"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getOption().size() > 0) { + List<StringType> list = new ArrayList<StringType>(); + for (QuestionnaireItemOptionComponent components : qItem.getOption()) { + try { + if (components.getValue() != null) { + list.add(components.getValueStringType()); + } + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type string"); + } else { + boolean found = false; + for (StringType item : list) { + if (item.getValue().equals((v.primitiveValue()))) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The string "+v.primitiveValue()+" is not a valid option"); + } + } + } else { + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate string answer option because no option list is provided"); + } + } + + private void checkCodingOption( List<ValidationMessage> errors, Element answer, NodeStack stack, Questionnaire qSrc, QuestionnaireItemComponent qItem, boolean openChoice) { + Element v = answer.getNamedChild("valueCoding"); + String system = v.getNamedChildValue("system"); + String code = v.getNamedChildValue("code"); + NodeStack ns = stack.push(v, -1, null, null); + if (qItem.getOption().size() > 0) { + List<Coding> list = new ArrayList<Coding>(); + for (QuestionnaireItemOptionComponent components : qItem.getOption()) { + try { + if (components.getValue() != null) { + list.add(components.getValueCoding()); + } + } catch (FHIRException e) { + // If it's the wrong type, just keep going + } + } + if (list.isEmpty() && !openChoice) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Option list has no option values of type coding"); + } else { + boolean found = false; + for (Coding item : list) { + if (ObjectUtil.equals(item.getSystem(), system) && ObjectUtil.equals(item.getCode(), code)) { + found = true; + break; + } + } + if (!found) { + rule(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), found, "The code "+system+"::"+code+" is not a valid option"); + } + } + } else + hint(errors, IssueType.STRUCTURE, v.line(), v.col(), stack.getLiteralPath(), false, "Cannot validate Coding option because no option list is provided"); + } + + private String tail(String path) { + return path.substring(path.lastIndexOf(".") + 1); + } + + private String tryParse(String ref) { + String[] parts = ref.split("\\/"); + switch (parts.length) { + case 1: + return null; + case 2: + return checkResourceType(parts[0]); + default: + if (parts[parts.length - 2].equals("_history")) + return checkResourceType(parts[parts.length - 4]); + else + return checkResourceType(parts[parts.length - 2]); + } + } + + private boolean typesAreAllReference(List<TypeRefComponent> theType) { + for (TypeRefComponent typeRefComponent : theType) { + if (typeRefComponent.getCode().equals("Reference") == false) { + return false; + } + } + return true; + } + + private void validateBundle(List<ValidationMessage> errors, Element bundle, NodeStack stack) { + List<Element> entries = new ArrayList<Element>(); + bundle.getNamedChildren("entry", entries); + String type = bundle.getNamedChildValue("type"); + type = StringUtils.defaultString(type); + + if (entries.size() == 0) { + rule(errors, IssueType.INVALID, stack.getLiteralPath(), !(type.equals("document") || type.equals("message")), "Documents or Messages must contain at least one entry"); + } else { + Element firstEntry = entries.get(0); + NodeStack firstStack = stack.push(firstEntry, 0, null, null); + String fullUrl = firstEntry.getNamedChildValue("fullUrl"); + + if (type.equals("document")) { + Element resource = firstEntry.getNamedChild("resource"); + NodeStack localStack = firstStack.push(resource, -1, null, null); + String id = resource.getNamedChildValue("id"); + if (rule(errors, IssueType.INVALID, firstEntry.line(), firstEntry.col(), stack.addToLiteralPath("entry", ":0"), resource != null, "No resource on first entry")) { + validateDocument(errors, entries, resource, localStack.push(resource, -1, null, null), fullUrl, id); + } + checkAllInterlinked(errors, entries, stack, bundle); + } + if (type.equals("message")) { + Element resource = firstEntry.getNamedChild("resource"); + NodeStack localStack = firstStack.push(resource, -1, null, null); + String id = resource.getNamedChildValue("id"); + if (rule(errors, IssueType.INVALID, firstEntry.line(), firstEntry.col(), stack.addToLiteralPath("entry", ":0"), resource != null, "No resource on first entry")) { + validateMessage(errors, entries, resource, localStack.push(resource, -1, null, null), fullUrl, id); + } + checkAllInterlinked(errors, entries, stack, bundle); + } + } + } + + private void checkAllInterlinked(List<ValidationMessage> errors, List<Element> entries, NodeStack stack, Element bundle) { + List<Element> visitedResources = new ArrayList<Element>(); + HashMap<Element,Element> candidateEntries = new HashMap<Element,Element>(); + List<Element> candidateResources = new ArrayList<Element>(); + for (Element entry: entries) { + candidateEntries.put(entry.getNamedChild("resource"), entry); + candidateResources.add(entry.getNamedChild("resource")); + } + followResourceLinks(entries.get(0), visitedResources, candidateEntries, candidateResources, true, errors, stack); + List<Element> unusedResources = new ArrayList<Element>(); + unusedResources.addAll(candidateResources); + unusedResources.removeAll(visitedResources); + int i = 0; + for (Element entry : entries) { + // TODO: Need to add support for tracking Bundle.link entries so that embedded stylesheets won't trigger this + warning(errors, IssueType.INFORMATIONAL, entry.line(), entry.col(), stack.addToLiteralPath("entry", Integer.toString(i)), !unusedResources.contains(entry.getNamedChild("resource")), "Entry isn't reachable by traversing from first Bundle entry"); + i++; + } + // Todo - check if the remaining resources point *to* the elements in the referenced set. Any that are still left over are errors + } + + private void followResourceLinks(Element entry, List<Element> visitedResources, HashMap<Element, Element> candidateEntries, List<Element> candidateResources, boolean referenced, List<ValidationMessage> errors, NodeStack stack) { + Element resource = entry.getNamedChild("resource"); + if (visitedResources.contains(resource)) + return; + + if (referenced) + visitedResources.add(resource); + + List<String> references = findReferences(resource); + for (String reference: references) { + // We don't want errors when just retrieving the element as they will be caught (with better path info) in subsequent processing + Element r = getFromBundle(stack.getElement(), reference, entry.getChildValue("fullUrl"), new ArrayList<ValidationMessage>(), stack.addToLiteralPath("entry[" + candidateResources.indexOf(resource) + "]")); + if (r!=null && !visitedResources.contains(r)) { + followResourceLinks(candidateEntries.get(r), visitedResources, candidateEntries, candidateResources, referenced, errors, stack); + } + } + } + + private List<String> findReferences(Element start) { + List<String> references = new ArrayList<String>(); + findReferences(start, references); + return references; + } + + private void findReferences(Element start, List<String> references) { + for (Element child : start.getChildren()) { + if (child.getType().equals("Reference")) { + String ref = child.getChildValue("reference"); + if (ref!=null && !ref.startsWith("#")) + references.add(ref); + } + findReferences(child, references); + } + } + + private void validateBundleReference(List<ValidationMessage> errors, List<Element> entries, Element ref, String name, NodeStack stack, String fullUrl, String type, String id) { + String reference = null; + try { + reference = ref.getNamedChildValue("reference"); + } catch (Error e) { + + } + + if (ref != null && !Utilities.noString(reference)) { + Element target = resolveInBundle(entries, reference, fullUrl, type, id); + rule(errors, IssueType.INVALID, ref.line(), ref.col(), stack.addToLiteralPath("reference"), target != null, "Unable to resolve the target of the reference in the bundle (" + name + ")"); + } + } + + private void validateContains(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, ElementDefinition child, ElementDefinition context, Element resource, Element element, NodeStack stack, IdStatus idstatus) throws FHIRException, FHIRException, IOException { + String resourceName = element.getType(); + long t = System.nanoTime(); + StructureDefinition profile = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); + sdTime = sdTime + (System.nanoTime() - t); + // special case: resource wrapper is reset if we're crossing a bundle boundary, but not otherwise + if (element.getSpecial() == SpecialElement.BUNDLE_ENTRY || element.getSpecial() == SpecialElement.BUNDLE_OUTCOME || element.getSpecial() == SpecialElement.PARAMETER ) + resource = element; + if (rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), profile != null, "No profile found for contained resource of type '" + resourceName + "'")) + validateResource(hostContext.forContained(element), errors, resource, element, profile, null, idstatus, stack, false); + } + + private void validateDocument(List<ValidationMessage> errors, List<Element> entries, Element composition, NodeStack stack, String fullUrl, String id) { + // first entry must be a composition + if (rule(errors, IssueType.INVALID, composition.line(), composition.col(), stack.getLiteralPath(), composition.getType().equals("Composition"), + "The first entry in a document must be a composition")) { + // the composition subject and section references must resolve in the bundle + Element elem = composition.getNamedChild("subject"); + if (rule(errors, IssueType.INVALID, composition.line(), composition.col(), stack.getLiteralPath(), elem != null, "A document composition must have a subject")) + validateBundleReference(errors, entries, elem, "Composition Subject", stack.push(elem, -1, null, null), fullUrl, "Composition", id); + validateSections(errors, entries, composition, stack, fullUrl, id); + } + } + // rule(errors, IssueType.INVALID, bundle.line(), bundle.col(), "Bundle", !"urn:guid:".equals(base), "The base 'urn:guid:' is not valid (use urn:uuid:)"); + // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !"urn:guid:".equals(ebase), "The base 'urn:guid:' is not valid"); + // rule(errors, IssueType.INVALID, entry.line(), entry.col(), localStack.getLiteralPath(), !Utilities.noString(base) || !Utilities.noString(ebase), "entry + // does not have a base"); + // String firstBase = null; + // firstBase = ebase == null ? base : ebase; + + private void validateElement(ValidatorHostContext hostContext, List<ValidationMessage> errors, StructureDefinition profile, ElementDefinition definition, StructureDefinition cprofile, ElementDefinition context, + Element resource, Element element, String actualType, NodeStack stack, boolean inCodeableConcept) throws FHIRException, FHIRException, IOException { + element.markValidation(profile, definition); + + // System.out.println(" "+stack.getLiteralPath()+" "+Long.toString((System.nanoTime() - time) / 1000000)); + // time = System.nanoTime(); + if (resource.getName().equals("contained")) { + NodeStack ancestor = stack; + while (!ancestor.element.isResource() || ancestor.element.getName().equals("contained")) + ancestor = ancestor.parent; + checkInvariants(hostContext, errors, stack.getLiteralPath(), profile, definition, null, null, ancestor.element, element); + } else + checkInvariants(hostContext, errors, stack.getLiteralPath(), profile, definition, null, null, resource, element); + if (definition.getFixed()!=null) + checkFixedValue(errors, stack.getLiteralPath(), element, definition.getFixed(), definition.getSliceName(), null); + + + // get the list of direct defined children, including slices + List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(profile, definition); + if (childDefinitions.isEmpty()) { + if (actualType == null) + return; // there'll be an error elsewhere in this case, and we're going to stop. + + StructureDefinition dt = this.context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + actualType); + if (dt == null) + throw new DefinitionException("Unable to resolve actual type " + actualType); + + childDefinitions = ProfileUtilities.getChildMap(dt, dt.getSnapshot().getElement().get(0)); + } + + // 1. List the children, and remember their exact path (convenience) + List<ElementInfo> children = new ArrayList<InstanceValidator.ElementInfo>(); + ChildIterator iter = new ChildIterator(stack.getLiteralPath(), element); + while (iter.next()) + children.add(new ElementInfo(iter.name(), iter.element(), iter.path(), iter.count())); + + // 2. assign children to a definition + // for each definition, for each child, check whether it belongs in the slice + ElementDefinition slicer = null; + boolean unsupportedSlicing = false; + List<String> problematicPaths = new ArrayList<String>(); + String slicingPath = null; + int sliceOffset = 0; + for (int i = 0; i < childDefinitions.size(); i++) { + ElementDefinition ed = childDefinitions.get(i); + boolean childUnsupportedSlicing = false; + boolean process = true; + if (ed.hasSlicing() && !ed.getSlicing().getOrdered()) + slicingPath = ed.getPath(); + else if (slicingPath!=null && ed.getPath().equals(slicingPath)) + ; // nothing + else if (slicingPath != null && !ed.getPath().startsWith(slicingPath)) + slicingPath = null; + // where are we with slicing + if (ed.hasSlicing()) { + if (slicer != null && slicer.getPath().equals(ed.getPath())) + throw new DefinitionException("Slice encountered midway through path on " + slicer.getPath()); + slicer = ed; + process = false; + sliceOffset = i; + } else if (slicer != null && !slicer.getPath().equals(ed.getPath())) + slicer = null; + +// if (process) { + for (ElementInfo ei : children) { + boolean match = false; + if (slicer == null || slicer == ed) { + match = nameMatches(ei.name, tail(ed.getPath())); + } else { +// ei.slice = slice; + if (nameMatches(ei.name, tail(ed.getPath()))) + try { + match = sliceMatches(hostContext, ei.element, ei.path, slicer, ed, profile, errors, stack); + if (match) + ei.slice = slicer; + } catch (FHIRException e) { + rule(errors, IssueType.PROCESSING, ei.line(), ei.col(), ei.path, false, e.getMessage()); + unsupportedSlicing = true; + childUnsupportedSlicing = true; + } + } + if (match) { + if (rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition == null || ei.definition == slicer, "Profile " + profile.getUrl() + ", Element matches more than one slice - " + (ei.definition==null || !ei.definition.hasSliceName() ? "" : ei.definition.getSliceName()) + ", " + (ed.hasSliceName() ? ed.getSliceName() : ""))) { + ei.definition = ed; + if (ei.slice == null) { + ei.index = i; + } else { + ei.index = sliceOffset; + ei.sliceindex = i - (sliceOffset + 1); + } + } + } else if (childUnsupportedSlicing) { + problematicPaths.add(ed.getPath()); + } + } +// } + } + int last = -1; + int lastSlice = -1; + for (ElementInfo ei : children) { + String sliceInfo = ""; + if (slicer != null) + sliceInfo = " (slice: " + slicer.getPath()+")"; + if (ei.path.endsWith(".extension")) + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, ei.definition != null, "Element is unknown or does not match any slice (url=\"" + ei.element.getNamedChildValue("url") + "\")" + (profile==null ? "" : " for profile " + profile.getUrl())); + else if (!unsupportedSlicing) + if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN))) + hint(errors, IssueType.INFORMATIONAL, ei.line(), ei.col(), ei.path, (ei.definition != null), + "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); + else + if (ei.slice!=null && (ei.slice.getSlicing().getRules().equals(ElementDefinition.SlicingRules.OPEN))) + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition != null), + "Element " + ei.element.getName() + " is unknown or does not match any slice " + sliceInfo + (profile==null ? "" : " for profile " + profile.getUrl())); + else + hint(errors, IssueType.NOTSUPPORTED, ei.line(), ei.col(), ei.path, (ei.definition != null), + "Could not verify slice for profile " + profile.getUrl()); + // TODO: Should get the order of elements correct when parsing elements that are XML attributes vs. elements + boolean isXmlAttr = false; + if (ei.definition!=null) + for (Enumeration<PropertyRepresentation> r : ei.definition.getRepresentation()) { + if (r.getValue() == PropertyRepresentation.XMLATTR) { + isXmlAttr = true; + break; + } + } + + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition == null) || (ei.index >= last) || isXmlAttr, "As specified by profile " + profile.getUrl() + ", Element '"+ei.name+"' is out of order"); + if (ei.slice != null && ei.index == last && ei.slice.getSlicing().getOrdered()) + rule(errors, IssueType.INVALID, ei.line(), ei.col(), ei.path, (ei.definition == null) || (ei.sliceindex >= lastSlice) || isXmlAttr, "As specified by profile " + profile.getUrl() + ", Element '"+ei.name+"' is out of order in ordered slice"); + if (ei.definition == null || !isXmlAttr) + last = ei.index; + if (ei.slice != null) + lastSlice = ei.sliceindex; + else + lastSlice = -1; + } + + // 3. report any definitions that have a cardinality problem + for (ElementDefinition ed : childDefinitions) { + if (ed.getRepresentation().isEmpty()) { // ignore xml attributes + int count = 0; + List<ElementDefinition> slices = null; + if (ed.hasSlicing()) + slices = ProfileUtilities.getSliceList(profile, ed); + for (ElementInfo ei : children) + if (ei.definition == ed) + count++; + else if (slices!=null) { + for (ElementDefinition sed : slices) { + if (ei.definition == sed) { + count++; + break; + } + } + } + String location = "Profile " + profile.getUrl() + ", Element '" + stack.getLiteralPath() + "." + tail(ed.getPath()) + (ed.hasSliceName()? "[" + ed.getSliceName() + (ed.hasLabel() ? " ("+ed.getLabel()+")" : "")+"]": ""); + if (ed.getMin() > 0) { + if (problematicPaths.contains(ed.getPath())) + hint(errors, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), + location + "': Unable to check minimum required (" + Integer.toString(ed.getMin()) + ") due to lack of slicing validation"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), + location + "': minimum required = " + Integer.toString(ed.getMin()) + ", but only found " + Integer.toString(count)); + } + if (ed.hasMax() && !ed.getMax().equals("*")) { + if (problematicPaths.contains(ed.getPath())) + hint(errors, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), + location + ": Unable to check max allowed (" + ed.getMax() + ") due to lack of slicing validation"); + else + rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), + location + ": max allowed = " + ed.getMax() + ", but found " + Integer.toString(count)); + } + } + } + // 4. check order if any slices are ordered. (todo) + + // 5. inspect each child for validity + for (ElementInfo ei : children) { + List<String> profiles = new ArrayList<String>(); + if (ei.definition != null) { + String type = null; + ElementDefinition typeDefn = null; + + String usesMustSupport = profile.getUserString("usesMustSupport"); + if (usesMustSupport == null) { + usesMustSupport = "N"; + for (ElementDefinition pe: profile.getSnapshot().getElement()) { + if (pe.getMustSupport()) { + usesMustSupport = "Y"; + break; + } + } + profile.setUserData("usesMustSupport", usesMustSupport); + } + if (usesMustSupport.equals("Y")) { + String elementSupported = ei.element.getUserString("elementSupported"); + if (elementSupported==null || ei.definition.getMustSupport()) + if (ei.definition.getMustSupport()) + ei.element.setUserData("elementSupported", "Y"); + else + ei.element.setUserData("elementSupported", "N"); + } + + if (ei.definition.getType().size() == 1 && !ei.definition.getType().get(0).getCode().equals("*") && !ei.definition.getType().get(0).getCode().equals("Element") + && !ei.definition.getType().get(0).getCode().equals("BackboneElement")) { + type = ei.definition.getType().get(0).getCode(); + // Excluding reference is a kludge to get around versioning issues + if (ei.definition.getType().get(0).hasProfile() && !type.equals("Reference")) + profiles.add(ei.definition.getType().get(0).getProfile()); + + } else if (ei.definition.getType().size() == 1 && ei.definition.getType().get(0).getCode().equals("*")) { + String prefix = tail(ei.definition.getPath()); + assert prefix.endsWith("[x]"); + type = ei.name.substring(prefix.length() - 3); + if (isPrimitiveType(type)) + type = Utilities.uncapitalize(type); + // Excluding reference is a kludge to get around versioning issues + if (ei.definition.getType().get(0).hasProfile() && !type.equals("Reference")) + profiles.add(ei.definition.getType().get(0).getProfile()); + } else if (ei.definition.getType().size() > 1) { + + String prefix = tail(ei.definition.getPath()); + assert typesAreAllReference(ei.definition.getType()) || prefix.endsWith("[x]") : prefix; + + prefix = prefix.substring(0, prefix.length() - 3); + for (TypeRefComponent t : ei.definition.getType()) + if ((prefix + Utilities.capitalize(t.getCode())).equals(ei.name)) { + type = t.getCode(); + // Excluding reference is a kludge to get around versioning issues + if (t.hasProfile() && !type.equals("Reference")) + profiles.add(t.getProfile()); + } + if (type == null) { + TypeRefComponent trc = ei.definition.getType().get(0); + if (trc.getCode().equals("Reference")) + type = "Reference"; + else + rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), false, + "The element " + ei.name + " is illegal. Valid types at this point are " + describeTypes(ei.definition.getType())); + } + } else if (ei.definition.getContentReference() != null) { + typeDefn = resolveNameReference(profile.getSnapshot(), ei.definition.getContentReference()); + } + + if (type != null) { + if (type.startsWith("@")) { + ei.definition = findElement(profile, type.substring(1)); + type = null; + } + } + NodeStack localStack = stack.push(ei.element, ei.count, ei.definition, type == null ? typeDefn : resolveType(type)); + String localStackLiterapPath = localStack.getLiteralPath(); + String eiPath = ei.path; + assert(eiPath.equals(localStackLiterapPath)) : "ei.path: " + ei.path + " - localStack.getLiteralPath: " + localStackLiterapPath; + boolean thisIsCodeableConcept = false; + + if (type != null) { + if (isPrimitiveType(type)) { + checkPrimitive(hostContext, errors, ei.path, type, ei.definition, ei.element, profile); + } else { +// checkNonPrimitive(appContext, errors, ei.path, type, ei.definition, ei.element, profile); + if (type.equals("Identifier")) + checkIdentifier(errors, ei.path, ei.element, ei.definition); + else if (type.equals("Coding")) + checkCoding(errors, ei.path, ei.element, profile, ei.definition, inCodeableConcept); + else if (type.equals("CodeableConcept")) { + checkCodeableConcept(errors, ei.path, ei.element, profile, ei.definition); + thisIsCodeableConcept = true; + } else if (type.equals("Reference")) + checkReference(hostContext, errors, ei.path, ei.element, profile, ei.definition, actualType, localStack); + // We only check extensions if we're not in a complex extension or if the element we're dealing with is not defined as part of that complex extension + if (type.equals("Extension") && ei.element.getChildValue("url").contains("/")) + checkExtension(hostContext, errors, ei.path, resource, ei.element, ei.definition, profile, localStack); + else if (type.equals("Resource")) + validateContains(hostContext, errors, ei.path, ei.definition, definition, resource, ei.element, localStack, idStatusForEntry(element, ei)); // if + // (str.matches(".*([.,/])work\\1$")) + else { + StructureDefinition p = null; + boolean elementValidated = false; + if (profiles.isEmpty()) { + p = getProfileForType(type); + rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown type " + type); + } else if (profiles.size()==1) { + p = this.context.fetchResource(StructureDefinition.class, profiles.get(0)); + rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown profile " + profiles.get(0)); + } else { + elementValidated = true; + HashMap<String, List<ValidationMessage>> goodProfiles = new HashMap<String, List<ValidationMessage>>(); + List<List<ValidationMessage>> badProfiles = new ArrayList<List<ValidationMessage>>(); + for (String typeProfile : profiles) { + p = this.context.fetchResource(StructureDefinition.class, typeProfile); + if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, p != null, "Unknown profile " + typeProfile)) { + List<ValidationMessage> profileErrors = new ArrayList<ValidationMessage>(); + validateElement(hostContext, profileErrors, p, p.getSnapshot().getElement().get(0), profile, ei.definition, resource, ei.element, type, localStack, thisIsCodeableConcept); + boolean hasError = false; + for (ValidationMessage msg : profileErrors) { + if (msg.getLevel()==ValidationMessage.IssueSeverity.ERROR || msg.getLevel()==ValidationMessage.IssueSeverity.FATAL) { + hasError = true; + break; + } + } + if (hasError) + badProfiles.add(profileErrors); + else + goodProfiles.put(typeProfile, profileErrors); + } + if (goodProfiles.size()==1) { + /* TODO: this was goodProfiless.get(0) which will always + * return null - Is the first value what was wanted? */ + errors.addAll(goodProfiles.values().iterator().next()); + } else if (goodProfiles.size()==0) { + rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, false, "Unable to find matching profile among choices: " + StringUtils.join("; ", profiles)); + for (List<ValidationMessage> messages : badProfiles) { + errors.addAll(messages); + } + } else { + warning(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.path, false, "Found multiple matching profiles among choices: " + StringUtils.join("; ", goodProfiles.keySet())); + for (List<ValidationMessage> messages : goodProfiles.values()) { + errors.addAll(messages); + } + } + } + } + if (p!=null) { + if (!elementValidated) + validateElement(hostContext, errors, p, p.getSnapshot().getElement().get(0), profile, ei.definition, resource, ei.element, type, localStack, thisIsCodeableConcept); + int index = profile.getSnapshot().getElement().indexOf(ei.definition); + if (index < profile.getSnapshot().getElement().size() - 1) { + String nextPath = profile.getSnapshot().getElement().get(index+1).getPath(); + if (!nextPath.equals(ei.definition.getPath()) && nextPath.startsWith(ei.definition.getPath())) + validateElement(hostContext, errors, profile, ei.definition, null, null, resource, ei.element, type, localStack, thisIsCodeableConcept); + } + } + } + } + } else { + if (rule(errors, IssueType.STRUCTURE, ei.line(), ei.col(), stack.getLiteralPath(), ei.definition != null, "Unrecognised Content " + ei.name)) + validateElement(hostContext, errors, profile, ei.definition, null, null, resource, ei.element, type, localStack, false); + } + } + } + } + + private IdStatus idStatusForEntry(Element ep, ElementInfo ei) { + if (isBundleEntry(ei.path)) { + Element req = ep.getNamedChild("request"); + Element resp = ep.getNamedChild("response"); + Element fullUrl = ep.getNamedChild("fullUrl"); + Element method = null; + Element url = null; + if (req != null) { + method = req.getNamedChild("method"); + url = req.getNamedChild("url"); + } + if (resp != null) { + return IdStatus.OPTIONAL; + } if (method == null) { + if (fullUrl == null) + return IdStatus.REQUIRED; + else if (fullUrl.primitiveValue().startsWith("urn:uuid:") || fullUrl.primitiveValue().startsWith("urn:oid:")) + return IdStatus.OPTIONAL; + else + return IdStatus.REQUIRED; + } else { + String s = method.primitiveValue(); + if (s.equals("PUT")) { + if (url == null) + return IdStatus.REQUIRED; + else + return IdStatus.OPTIONAL; // or maybe prohibited? not clear + } else if (s.equals("POST")) + return IdStatus.OPTIONAL; // this should be prohibited, but see task 9102 + else // actually, we should never get to here; a bundle entry with method get/delete should not have a resource + return IdStatus.OPTIONAL; + } + } else if (isParametersEntry(ei.path) || isBundleOutcome(ei.path)) + return IdStatus.OPTIONAL; + else + return IdStatus.REQUIRED; + } + + private void checkInvariants(ValidatorHostContext hostContext, List<ValidationMessage> errors, String path, StructureDefinition profile, ElementDefinition ed, String typename, String typeProfile, Element resource, Element element) throws FHIRException, FHIRException { + if (noInvariantChecks) + return; + + for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { + if (inv.hasExpression()) { + ExpressionNode n = (ExpressionNode) inv.getUserData("validator.expression.cache"); + if (n == null) { + long t = System.nanoTime(); + try { + n = fpe.parse(inv.getExpression()); + } catch (FHIRLexerException e) { + throw new FHIRException("Problem processing expression "+inv.getExpression() +" in profile " + profile.getUrl() + " path " + path + ": " + e.getMessage()); + } + fpeTime = fpeTime + (System.nanoTime() - t); + inv.setUserData("validator.expression.cache", n); + } + + String msg; + boolean ok; + try { + long t = System.nanoTime(); + ok = fpe.evaluateToBoolean(hostContext, resource, element, n); + fpeTime = fpeTime + (System.nanoTime() - t); + msg = fpe.forLog(); + } catch (Exception ex) { + ok = false; + msg = ex.getMessage(); + } + if (!ok) { + try { + ok = fpe.evaluateToBoolean(hostContext, resource, element, n); + } catch (PathEngineException e) { + throw new FHIRException("Problem processing expression "+inv.getExpression() +" in profile " + profile.getUrl() + " path " + path + ": " + e.getMessage()); + } + if (!Utilities.noString(msg)) + msg = " ("+msg+")"; + if (inv.getSeverity() == ConstraintSeverity.ERROR) + rule(errors, IssueType.INVARIANT, element.line(), element.col(), path, ok, inv.getHuman()+msg+" ["+inv.getExpression()+"]"); + else if (inv.getSeverity() == ConstraintSeverity.WARNING) + warning(errors, IssueType.INVARIANT, element.line(), element.line(), path, ok, inv.getHuman()+msg+" ["+inv.getExpression()+"]"); + } + } + } + } + + private void validateMessage(List<ValidationMessage> errors, List<Element> entries, Element messageHeader, NodeStack stack, String fullUrl, String id) { + // first entry must be a messageheader + if (rule(errors, IssueType.INVALID, messageHeader.line(), messageHeader.col(), stack.getLiteralPath(), messageHeader.getType().equals("MessageHeader"), + "The first entry in a message must be a MessageHeader")) { + // the composition subject and section references must resolve in the bundle + List<Element> elements = messageHeader.getChildren("data"); + for (Element elem: elements) + validateBundleReference(errors, entries, elem, "MessageHeader Data", stack.push(elem, -1, null, null), fullUrl, "MessageHeader", id); + } + } + + private void validateObservation(List<ValidationMessage> errors, Element element, NodeStack stack) { + // all observations should have a subject, a performer, and a time + + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("subject") != null, "All observations should have a subject"); + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("performer") != null, "All observations should have a performer"); + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null, + "All observations should have an effectiveDateTime or an effectivePeriod"); + } + + /* + * The actual base entry point + */ + /* private void validateResource(List<ValidationMessage> errors, Element resource, Element element, StructureDefinition defn, ValidationProfileSet profiles, IdStatus idstatus, NodeStack stack) throws FHIRException, FHIRException { + List<StructureDefinition> declProfiles = new ArrayList<StructureDefinition>(); + List<Element> meta = element.getChildrenByName("meta"); + if (!meta.isEmpty()) { + for (Element profileName : meta.get(0).getChildrenByName("profile")) { + StructureDefinition sd = context.fetchResource(StructureDefinition.class, profileName.getValue()); + if (sd != null) + declProfiles.add(sd); + } + } + + if (!declProfiles.isEmpty()) { + // Validate against profiles rather than the resource itself as they'll be more constrained and will cover the resource elements anyhow + for (StructureDefinition sd : declProfiles) + validateResource2(errors, resource, element, sd, profiles, idstatus, stack); + } else + validateResource2(errors, resource, element, defn, profiles, idstatus, stack); + }*/ + + private void validateResource(ValidatorHostContext hostContext, List<ValidationMessage> errors, Element resource, Element element, StructureDefinition defn, ValidationProfileSet profiles, IdStatus idstatus, NodeStack stack, boolean isEntry) throws FHIRException, FHIRException, IOException { + assert stack != null; + assert resource != null; + + boolean ok = true; + + String resourceName = element.getType(); // todo: consider namespace...? + if (defn == null) { + long t = System.nanoTime(); + defn = element.getProperty().getStructure(); + if (defn == null) + defn = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + resourceName); + if (profiles!=null) + getResourceProfiles(resource, stack).addProfiles(errors, profiles, stack.getLiteralPath(), element, isEntry); + sdTime = sdTime + (System.nanoTime() - t); + ok = rule(errors, IssueType.INVALID, element.line(), element.col(), stack.addToLiteralPath(resourceName), defn != null, "No definition found for resource type '" + resourceName + "'"); + } + + String type = defn.getKind() == StructureDefinitionKind.LOGICAL ? defn.getId() : defn.getType(); + // special case: we have a bundle, and the profile is not for a bundle. We'll try the first entry instead + if (!type.equals(resourceName) && resourceName.equals("Bundle")) { + Element first = getFirstEntry(element); + if (first != null && first.getType().equals(type)) { + element = first; + resourceName = element.getType(); + idstatus = IdStatus.OPTIONAL; // why? + } + } + ok = rule(errors, IssueType.INVALID, -1, -1, stack.getLiteralPath(), type.equals(resourceName), "Specified profile type was '" + type + "', but found type '" + resourceName + "'"); + + if (ok) { + if (idstatus == IdStatus.REQUIRED && (element.getNamedChild("id") == null)) + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource requires an id, but none is present"); + else if (idstatus == IdStatus.PROHIBITED && (element.getNamedChild("id") != null)) + rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, "Resource has an id, but none is allowed"); + start(hostContext, errors, resource, element, defn, stack); // root is both definition and type + } + } + + private void loadProfiles(ValidationProfileSet profiles) throws DefinitionException { + if (profiles != null) { + for (String profile : profiles.getCanonicalUrls()) { + StructureDefinition p = context.fetchResource(StructureDefinition.class, profile); + if (p == null) + throw new DefinitionException("StructureDefinition '" + profile + "' not found"); + profiles.getDefinitions().add(p); + } + } + } + + private Element getFirstEntry(Element bundle) { + List<Element> list = new ArrayList<Element>(); + bundle.getNamedChildren("entry", list); + if (list.isEmpty()) + return null; + Element resource = list.get(0).getNamedChild("resource"); + if (resource == null) + return null; + else + return resource; + } + + private void validateSections(List<ValidationMessage> errors, List<Element> entries, Element focus, NodeStack stack, String fullUrl, String id) { + List<Element> sections = new ArrayList<Element>(); + focus.getNamedChildren("entry", sections); + int i = 0; + for (Element section : sections) { + NodeStack localStack = stack.push(section, 1, null, null); + validateBundleReference(errors, entries, section.getNamedChild("content"), "Section Content", localStack, fullUrl, "Composition", id); + validateSections(errors, entries, section, localStack, fullUrl, id); + i++; + } + } + + private boolean valueMatchesCriteria(Element value, ElementDefinition criteria) throws FHIRException { + if (criteria.hasFixed()) { + List<ValidationMessage> msgs = new ArrayList<ValidationMessage>(); + checkFixedValue(msgs, "{virtual}", value, criteria.getFixed(), "value", null); + return msgs.size() == 0; + } else if (criteria.hasBinding() && criteria.getBinding().getStrength() == BindingStrength.REQUIRED && criteria.getBinding().hasValueSet()) { + throw new FHIRException("Unable to resolve slice matching - slice matching by value set not done"); + } else { + throw new FHIRException("Unable to resolve slice matching - no fixed value or required value set"); + } + } + + private boolean yearIsValid(String v) { + if (v == null) { + return false; + } + try { + int i = Integer.parseInt(v.substring(0, Math.min(4, v.length()))); + return i >= 1800 && i <= 2100; + } catch (NumberFormatException e) { + return false; + } + } + + public class ChildIterator { + private String basePath; + private Element parent; + private int cursor; + private int lastCount; + + public ChildIterator(String path, Element element) { + parent = element; + basePath = path; + cursor = -1; + } + + public int count() { + String nb = cursor == 0 ? "--" : parent.getChildren().get(cursor-1).getName(); + String na = cursor >= parent.getChildren().size() - 1 ? "--" : parent.getChildren().get(cursor+1).getName(); + if (name().equals(nb) || name().equals(na) ) { + return lastCount + 1; + } else + return -1; + } + + public Element element() { + return parent.getChildren().get(cursor); + } + + public String name() { + return element().getName(); + } + + public boolean next() { + if (cursor == -1) { + cursor++; + lastCount = 0; + } else { + String lastName = name(); + cursor++; + if (cursor < parent.getChildren().size() && name().equals(lastName)) + lastCount++; + else + lastCount = 0; + } + return cursor < parent.getChildren().size(); + } + + public String path() { + int i = count(); + String sfx = ""; + if (i > -1) { + sfx = "[" + Integer.toString(lastCount + 1) + "]"; + } + return basePath + "." + name() + sfx; + } + } + + public class NodeStack { + private ElementDefinition definition; + private Element element; + private ElementDefinition extension; + private String literalPath; // xpath format + private List<String> logicalPaths; // dotted format, various entry points + private NodeStack parent; + private ElementDefinition type; + + public NodeStack() { + } + + public NodeStack(Element element) { + this.element = element; + literalPath = element.getName(); + } + + public String addToLiteralPath(String... path) { + StringBuilder b = new StringBuilder(); + b.append(getLiteralPath()); + for (String p : path) { + if (p.startsWith(":")) { + b.append("["); + b.append(p.substring(1)); + b.append("]"); + } else { + b.append("."); + b.append(p); + } + } + return b.toString(); + } + + private ElementDefinition getDefinition() { + return definition; + } + + private Element getElement() { + return element; + } + + protected String getLiteralPath() { + return literalPath == null ? "" : literalPath; + } + + private List<String> getLogicalPaths() { + return logicalPaths == null ? new ArrayList<String>() : logicalPaths; + } + + private ElementDefinition getType() { + return type; + } + + private NodeStack push(Element element, int count, ElementDefinition definition, ElementDefinition type) { + NodeStack res = new NodeStack(); + res.parent = this; + res.element = element; + res.definition = definition; + res.literalPath = getLiteralPath() + "." + element.getName(); + if (count > -1) + res.literalPath = res.literalPath + "[" + Integer.toString(count) + "]"; + res.logicalPaths = new ArrayList<String>(); + if (type != null) { + // type will be bull if we on a stitching point of a contained resource, or if.... + res.type = type; + String t = tail(definition.getPath()); + for (String lp : getLogicalPaths()) { + res.logicalPaths.add(lp + "." + t); + if (t.endsWith("[x]")) + res.logicalPaths.add(lp + "." + t.substring(0, t.length() - 3) + type.getPath()); + } + res.logicalPaths.add(type.getPath()); + } else if (definition != null) { + for (String lp : getLogicalPaths()) + res.logicalPaths.add(lp + "." + element.getName()); + } else + res.logicalPaths.addAll(getLogicalPaths()); + // CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + // for (String lp : res.logicalPaths) + // b.append(lp); + // System.out.println(res.literalPath+" : "+b.toString()); + return res; + } + + private void setType(ElementDefinition type) { + this.type = type; + } + } + + private void checkForProcessingInstruction(List<ValidationMessage> errors, Document document) { + Node node = document.getFirstChild(); + while (node != null) { + rule(errors, IssueType.INVALID, -1, -1, "(document)", node.getNodeType() != Node.PROCESSING_INSTRUCTION_NODE, "No processing instructions allowed in resources"); + node = node.getNextSibling(); + } + } + + public class ElementInfo { + + public int index; // order of definition in overall order. all slices get the index of the slicing definition + public int sliceindex; // order of the definition in the slices (if slice != null) + public int count; + public ElementDefinition definition; + public ElementDefinition slice; + private Element element; + private String name; + private String path; + + public ElementInfo(String name, Element element, String path, int count) { + this.name = name; + this.element = element; + this.path = path; + this.count = count; + } + + public int col() { + return element.col(); + } + + public int line() { + return element.line(); + } + + } + + public String reportTimes() { + String s = String.format("Times: overall = %d, tx = %d, sd = %d, load = %d, fpe = %d", overall, txTime, sdTime, loadTime, fpeTime); + overall = 0; + txTime = 0; + sdTime = 0; + loadTime = 0; + fpeTime = 0; + return s; + } + + public boolean isNoBindingMsgSuppressed() { + return noBindingMsgSuppressed; + } + + public IResourceValidator setNoBindingMsgSuppressed(boolean noBindingMsgSuppressed) { + this.noBindingMsgSuppressed = noBindingMsgSuppressed; + return this; + } + + + public boolean isNoTerminologyChecks() { + return noTerminologyChecks; + } + + public IResourceValidator setNoTerminologyChecks(boolean noTerminologyChecks) { + this.noTerminologyChecks = noTerminologyChecks; + return this; + } + + public void checkAllInvariants(){ + for (StructureDefinition sd : context.allStructures()) { + if (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) { + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) { + if (inv.hasExpression()) { + try { + ExpressionNode n = (ExpressionNode) inv.getUserData("validator.expression.cache"); + if (n == null) { + n = fpe.parse(inv.getExpression()); + inv.setUserData("validator.expression.cache", n); + } + fpe.check(null, sd.getKind() == StructureDefinitionKind.RESOURCE ? sd.getType() : "DomainResource", ed.getPath(), n); + } catch (Exception e) { + System.out.println("Error processing structure ["+sd.getId()+"] path "+ed.getPath()+":"+inv.getKey()+" (\""+inv.getExpression()+"\"): "+e.getMessage()); + } + } + } + } + } + } + } + +} diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/GraphQLDstu3ProviderTest.java b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/GraphQLDstu3ProviderTest.java index 74591613a6b..b8da72f1894 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/GraphQLDstu3ProviderTest.java +++ b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/GraphQLDstu3ProviderTest.java @@ -48,39 +48,6 @@ public class GraphQLDstu3ProviderTest { private static int ourPort; private static Server ourServer; - @AfterClass - public static void afterClassClearContext() throws Exception { - ourServer.stop(); - TestUtil.clearAllStaticFieldsForUnitTest(); - } - - @BeforeClass - public static void beforeClass() throws Exception { - ourPort = PortUtil.findFreePort(); - ourServer = new Server(ourPort); - - - - ServletHandler proxyHandler = new ServletHandler(); - RestfulServer servlet = new RestfulServer(ourCtx); - servlet.setDefaultResponseEncoding(EncodingEnum.JSON); - servlet.setPagingProvider(new FifoMemoryPagingProvider(10)); - - servlet.registerProvider(new DummyPatientResourceProvider()); - MyStorageServices storageServices = new MyStorageServices(); - servlet.registerProvider(new GraphQLProviderDstu3(ourCtx, new DefaultProfileValidationSupport(), storageServices)); - ServletHolder servletHolder = new ServletHolder(servlet); - proxyHandler.addServletWithMapping(servletHolder, "/*"); - ourServer.setHandler(proxyHandler); - ourServer.start(); - - PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS); - HttpClientBuilder builder = HttpClientBuilder.create(); - builder.setConnectionManager(connectionManager); - ourClient = builder.build(); - - } - @Before public void before() { //nothing @@ -97,76 +64,14 @@ public class GraphQLDstu3ProviderTest { ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals("{\n" + + assertEquals(TestUtil.stripReturns("{\n" + " \"name\":[{\n" + " \"family\":[\"FAMILY\"],\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + " },{\n" + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + " }]\n" + - "}", responseContent); - assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), Matchers.startsWith("application/json")); - - } finally { - IOUtils.closeQuietly(status.getEntity().getContent()); - } - - } - - @Test - @org.junit.Ignore - public void testGraphSystemInstance() throws Exception { - String query = "{Patient(id:123){id,name{given,family}}}"; - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/$graphql?query=" + UrlUtil.escape(query)); - CloseableHttpResponse status = ourClient.execute(httpGet); - try { - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - - assertEquals("{\n" + - " \"Patient\":{\n" + - " \"name\":[{\n" + - " \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" + - " \"family\":[\"FAMILY\"]\n" + - " },{\n" + - " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + - " }]\n" + - " }\n" + - "}", responseContent); - assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), Matchers.startsWith("application/json")); - - } finally { - IOUtils.closeQuietly(status.getEntity().getContent()); - } - - } - - @Test - @Ignore - public void testGraphSystemList() throws Exception { - String query = "{PatientList(name:\"pet\"){name{family,given}}}"; - HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/$graphql?query=" + UrlUtil.escape(query)); - CloseableHttpResponse status = ourClient.execute(httpGet); - try { - String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); - ourLog.info(responseContent); - assertEquals(200, status.getStatusLine().getStatusCode()); - - assertEquals("{\n" + - " \"PatientList\":[{\n" + - " \"name\":[{\n" + - " \"family\":[\"pet\"],\n" + - " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + - " },{\n" + - " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + - " }]\n" + - " },{\n" + - " \"name\":[{\n" + - " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + - " }]\n" + - " }]\n" + - "}", responseContent); + "}"), TestUtil.stripReturns(responseContent)); assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), Matchers.startsWith("application/json")); } finally { @@ -186,12 +91,12 @@ public class GraphQLDstu3ProviderTest { ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals("{\n" + + assertEquals(TestUtil.stripReturns("{\n" + " \"name\":[{\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" + " \"family\":[\"FAMILY\"]\n" + " }]\n" + - "}", responseContent); + "}"), TestUtil.stripReturns(responseContent)); assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), Matchers.startsWith("application/json")); } finally { @@ -200,6 +105,100 @@ public class GraphQLDstu3ProviderTest { } + @Test + @org.junit.Ignore + public void testGraphSystemInstance() throws Exception { + String query = "{Patient(id:123){id,name{given,family}}}"; + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/$graphql?query=" + UrlUtil.escape(query)); + CloseableHttpResponse status = ourClient.execute(httpGet); + try { + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + ourLog.info(responseContent); + assertEquals(200, status.getStatusLine().getStatusCode()); + + assertEquals(TestUtil.stripReturns("{\n" + + " \"Patient\":{\n" + + " \"name\":[{\n" + + " \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" + + " \"family\":[\"FAMILY\"]\n" + + " },{\n" + + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + + " }]\n" + + " }\n" + + "}"), TestUtil.stripReturns(responseContent)); + assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), Matchers.startsWith("application/json")); + + } finally { + IOUtils.closeQuietly(status.getEntity().getContent()); + } + + } + + @Test + @Ignore + public void testGraphSystemList() throws Exception { + String query = "{PatientList(name:\"pet\"){name{family,given}}}"; + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/$graphql?query=" + UrlUtil.escape(query)); + CloseableHttpResponse status = ourClient.execute(httpGet); + try { + String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8); + ourLog.info(responseContent); + assertEquals(200, status.getStatusLine().getStatusCode()); + + assertEquals(TestUtil.stripReturns("{\n" + + " \"PatientList\":[{\n" + + " \"name\":[{\n" + + " \"family\":[\"pet\"],\n" + + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + + " },{\n" + + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + + " }]\n" + + " },{\n" + + " \"name\":[{\n" + + " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + + " }]\n" + + " }]\n" + + "}"), TestUtil.stripReturns(responseContent)); + assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), Matchers.startsWith("application/json")); + + } finally { + IOUtils.closeQuietly(status.getEntity().getContent()); + } + + } + + @AfterClass + public static void afterClassClearContext() throws Exception { + ourServer.stop(); + TestUtil.clearAllStaticFieldsForUnitTest(); + } + + @BeforeClass + public static void beforeClass() throws Exception { + ourPort = PortUtil.findFreePort(); + ourServer = new Server(ourPort); + + + ServletHandler proxyHandler = new ServletHandler(); + RestfulServer servlet = new RestfulServer(ourCtx); + servlet.setDefaultResponseEncoding(EncodingEnum.JSON); + servlet.setPagingProvider(new FifoMemoryPagingProvider(10)); + + servlet.registerProvider(new DummyPatientResourceProvider()); + MyStorageServices storageServices = new MyStorageServices(); + servlet.registerProvider(new GraphQLProviderDstu3(ourCtx, new DefaultProfileValidationSupport(), storageServices)); + ServletHolder servletHolder = new ServletHolder(servlet); + proxyHandler.addServletWithMapping(servletHolder, "/*"); + ourServer.setHandler(proxyHandler); + ourServer.start(); + + PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS); + HttpClientBuilder builder = HttpClientBuilder.create(); + builder.setConnectionManager(connectionManager); + ourClient = builder.build(); + + } + public static class DummyPatientResourceProvider implements IResourceProvider { @Override @@ -225,31 +224,6 @@ public class GraphQLDstu3ProviderTest { } private static class MyStorageServices implements IGraphQLStorageServices<Resource, Reference, Bundle> { - @Override - public ReferenceResolution<Resource> lookup(Object theAppInfo, Resource theContext, Reference theReference) throws FHIRException { - ourLog.info("lookup from {} to {}", theContext.getIdElement().getValue(), theReference.getReference()); - return null; - } - - @Override - public Resource lookup(Object theAppInfo, String theType, String theId) throws FHIRException { - ourLog.info("lookup {}/{}", theType, theId); - - if (theType.equals("Patient") && theId.equals("123")) { - Patient p = new Patient(); - p.addName() - .setFamily("FAMILY") - .addGiven("GIVEN1") - .addGiven("GIVEN2"); - p.addName() - .addGiven("GivenOnly1") - .addGiven("GivenOnly2"); - return p; - } - - return null; - } - @Override public void listResources(Object theAppInfo, String theType, List<Argument> theSearchParams, List<Resource> theMatches) throws FHIRException { ourLog.info("listResources of {} - {}", theType, theSearchParams); @@ -277,6 +251,31 @@ public class GraphQLDstu3ProviderTest { } } + @Override + public Resource lookup(Object theAppInfo, String theType, String theId) throws FHIRException { + ourLog.info("lookup {}/{}", theType, theId); + + if (theType.equals("Patient") && theId.equals("123")) { + Patient p = new Patient(); + p.addName() + .setFamily("FAMILY") + .addGiven("GIVEN1") + .addGiven("GIVEN2"); + p.addName() + .addGiven("GivenOnly1") + .addGiven("GivenOnly2"); + return p; + } + + return null; + } + + @Override + public ReferenceResolution<Resource> lookup(Object theAppInfo, Resource theContext, Reference theReference) throws FHIRException { + ourLog.info("lookup from {} to {}", theContext.getIdElement().getValue(), theReference.getReference()); + return null; + } + @Override public Bundle search(Object theAppInfo, String theType, List<Argument> theSearchParams) throws FHIRException { ourLog.info("search on {} - {}", theType, theSearchParams); diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java index 32295577991..db00c744347 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java @@ -336,6 +336,15 @@ public class FhirInstanceValidatorDstu3Test { assertTrue(output.isSuccessful()); } + @Test + public void testValidateBundleWithNoType() throws Exception { + String vsContents = IOUtils.toString(FhirInstanceValidatorDstu3Test.class.getResourceAsStream("/dstu3/bundle-with-no-type.json"), "UTF-8"); + + ValidationResult output = myVal.validateWithResult(vsContents); + logResultsAndReturnNonInformationalOnes(output); + assertThat(output.getMessages().toString(), containsString("Element 'Bundle.type': minimum required = 1")); + } + /** * See #739 */ @@ -868,6 +877,18 @@ public class FhirInstanceValidatorDstu3Test { } + @Test + public void testGoal() { + Goal goal = new Goal(); + goal.setSubject(new Reference("Patient/123")); + goal.setDescription(new CodeableConcept().addCoding(new Coding("http://foo","some other goal",""))); + goal.setStatus(Goal.GoalStatus.INPROGRESS); + + ValidationResult results = myVal.validateWithResult(goal); + List<SingleValidationMessage> outcome = logResultsAndReturnNonInformationalOnes(results); + assertEquals(0, outcome.size()); + } + @AfterClass public static void afterClassClearContext() { myDefaultValidationSupport.flush(); @@ -875,4 +896,5 @@ public class FhirInstanceValidatorDstu3Test { TestUtil.clearAllStaticFieldsForUnitTest(); } + } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java index f4199f61e4c..87c5113a680 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/QuestionnaireResponseValidatorDstu3Test.java @@ -1,17 +1,7 @@ package org.hl7.fhir.dstu3.hapi.validation; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.empty; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.List; - +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.validation.FhirValidator; import ca.uhn.fhir.validation.SingleValidationMessage; import ca.uhn.fhir.validation.ValidationResult; @@ -20,38 +10,39 @@ import org.hl7.fhir.dstu3.context.IWorkerContext; import org.hl7.fhir.dstu3.hapi.ctx.HapiWorkerContext; import org.hl7.fhir.dstu3.hapi.ctx.IValidationSupport; import org.hl7.fhir.dstu3.hapi.ctx.IValidationSupport.CodeValidationResult; -import org.hl7.fhir.dstu3.model.CodeSystem; +import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode; import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; -import org.hl7.fhir.dstu3.model.CodeType; -import org.hl7.fhir.dstu3.model.Coding; -import org.hl7.fhir.dstu3.model.IntegerType; -import org.hl7.fhir.dstu3.model.Questionnaire; import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent; import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType; -import org.hl7.fhir.dstu3.model.QuestionnaireResponse; import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent; import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus; -import org.hl7.fhir.dstu3.model.Reference; -import org.hl7.fhir.dstu3.model.StringType; -import org.hl7.fhir.dstu3.model.ValueSet; import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.util.TestUtil; +import java.util.ArrayList; +import java.util.List; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.empty; +import static org.junit.Assert.*; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class QuestionnaireResponseValidatorDstu3Test { - private static DefaultProfileValidationSupport myDefaultValidationSupport = new DefaultProfileValidationSupport(); - - private static FhirContext ourCtx = FhirContext.forDstu3(); + public static final IdType ID_ICC_QUESTIONNAIRE_SETUP = new IdType("Questionnaire/profile"); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(QuestionnaireResponseValidatorDstu3Test.class); - + private static final String CODE_ICC_SCHOOLTYPE_PT = "PT"; + private static final IdType ID_VS_SCHOOLTYPE = new IdType("ValueSet/schooltype"); + private static final String SYSTEMURI_ICC_SCHOOLTYPE = "http://ehealthinnovation/icc/ns/schooltype"; + private static DefaultProfileValidationSupport myDefaultValidationSupport = new DefaultProfileValidationSupport(); + private static FhirContext ourCtx = FhirContext.forDstu3(); private FhirInstanceValidator myInstanceVal; private FhirValidator myVal; private IValidationSupport myValSupport; - private IWorkerContext myWorkerCtx; @Before @@ -59,28 +50,30 @@ public class QuestionnaireResponseValidatorDstu3Test { myValSupport = mock(IValidationSupport.class); // new DefaultProfileValidationSupport(); myWorkerCtx = new HapiWorkerContext(ourCtx, myValSupport); - + myVal = ourCtx.newValidator(); myVal.setValidateAgainstStandardSchema(false); myVal.setValidateAgainstStandardSchematron(false); ValidationSupportChain validationSupport = new ValidationSupportChain(myValSupport, myDefaultValidationSupport); myInstanceVal = new FhirInstanceValidator(validationSupport); - + myVal.registerValidatorModule(myInstanceVal); } + private ValidationResult stripBindingHasNoSourceMessage(ValidationResult theErrors) { List<SingleValidationMessage> messages = new ArrayList<SingleValidationMessage>(theErrors.getMessages()); for (int i = 0; i < messages.size(); i++) { if (messages.get(i).getMessage().contains("has no source, so can't")) { messages.remove(i); i--; - } + } } - + return new ValidationResult(ourCtx, messages); } + @Test public void testAnswerWithWrongType() { Questionnaire q = new Questionnaire(); @@ -179,7 +172,7 @@ public class QuestionnaireResponseValidatorDstu3Test { ourLog.info(errors.toString()); assertThat(errors.toString(), containsString("minimum required = 1, but only found 0 - QuestionnaireResponse.item")); } - + @Test public void testItemWithNoType() { Questionnaire q = new Questionnaire(); @@ -221,6 +214,64 @@ public class QuestionnaireResponseValidatorDstu3Test { assertThat(errors.toString(), containsString("No response found for required item link0")); } + @Test + public void testValidateQuestionnaireResponseWithValueSetChoiceAnswer() { + /* + * Create valueset + */ + ValueSet iccSchoolTypeVs = new ValueSet(); + iccSchoolTypeVs.setId(ID_VS_SCHOOLTYPE); + iccSchoolTypeVs.getCompose().getIncludeFirstRep().setSystem(SYSTEMURI_ICC_SCHOOLTYPE); + iccSchoolTypeVs + .getCompose() + .getIncludeFirstRep() + .addConcept() + .setCode(CODE_ICC_SCHOOLTYPE_PT) + .setDisplay("Part Time"); + + /* + * Create Questionnaire + */ + Questionnaire questionnaire = new Questionnaire(); + { + questionnaire.setId(ID_ICC_QUESTIONNAIRE_SETUP); + + Questionnaire.QuestionnaireItemComponent basicGroup = questionnaire.addItem(); + basicGroup.setLinkId("basic"); + basicGroup.setType(Questionnaire.QuestionnaireItemType.GROUP); + basicGroup + .addItem() + .setLinkId("schoolType") + .setType(Questionnaire.QuestionnaireItemType.CHOICE) + .setOptions(new Reference(ID_VS_SCHOOLTYPE)) + .setRequired(true); + } + + /* + * Create response + */ + QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse(); + questionnaireResponse.setStatus(QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED); + questionnaireResponse.setQuestionnaire(new Reference(ID_ICC_QUESTIONNAIRE_SETUP)); + questionnaireResponse.getSubject().setReference("Patient/123"); + + QuestionnaireResponse.QuestionnaireResponseItemComponent basicGroup = questionnaireResponse + .addItem(); + basicGroup.setLinkId("basic"); + basicGroup + .addItem() + .setLinkId("schoolType") + .addAnswer() + .setValue(new Coding(SYSTEMURI_ICC_SCHOOLTYPE, CODE_ICC_SCHOOLTYPE_PT, "")); + + when(myValSupport.fetchResource(any(FhirContext.class), eq(Questionnaire.class), eq(questionnaireResponse.getQuestionnaire().getReference()))).thenReturn(questionnaire); + when(myValSupport.fetchResource(any(FhirContext.class), eq(ValueSet.class), eq(ID_VS_SCHOOLTYPE.getValue()))).thenReturn(iccSchoolTypeVs); + ValidationResult errors = myVal.validateWithResult(questionnaireResponse); + + ourLog.info(errors.toString()); + assertThat(errors.toString(), containsString("No issues")); + } + @Test public void testOpenchoiceAnswer() { String questionnaireRef = "http://example.com/Questionnaire/q1"; @@ -248,7 +299,7 @@ public class QuestionnaireResponseValidatorDstu3Test { when(myValSupport.fetchResource(any(FhirContext.class), eq(ValueSet.class), eq("http://somevalueset"))).thenReturn(options); when(myValSupport.validateCode(any(FhirContext.class), eq("http://codesystems.com/system"), eq("code0"), any(String.class))).thenReturn(new CodeValidationResult(new ConceptDefinitionComponent(new CodeType("code0")))); - + QuestionnaireResponse qa; ValidationResult errors; @@ -389,19 +440,19 @@ public class QuestionnaireResponseValidatorDstu3Test { //@formatter:off input = input.replaceAll( "<answer>\n" + - " <valueCoding>\n" + - " <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" + - " <code value=\"2\"/>\n" + - " <display value=\"Once/twice\"/>\n" + - " </valueCoding>\n" + - " </answer>", - "<answer>\n" + - " <valueCoding>\n" + - " <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" + - " <code value=\"GGG\"/>\n" + - " <display value=\"Once/twice\"/>\n" + - " </valueCoding>\n" + - " </answer>"); + " <valueCoding>\n" + + " <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" + + " <code value=\"2\"/>\n" + + " <display value=\"Once/twice\"/>\n" + + " </valueCoding>\n" + + " </answer>", + "<answer>\n" + + " <valueCoding>\n" + + " <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" + + " <code value=\"GGG\"/>\n" + + " <display value=\"Once/twice\"/>\n" + + " </valueCoding>\n" + + " </answer>"); assertThat(input, containsString("GGG")); //@formatter:on diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java new file mode 100644 index 00000000000..d75a5865462 --- /dev/null +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/utils/FhirPathEngineR4Test.java @@ -0,0 +1,92 @@ +package org.hl7.fhir.r4.utils; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.util.TestUtil; +import org.hl7.fhir.dstu3.utils.FhirPathEngineTest; +import org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport; +import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext; +import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.utils.FHIRPathEngine; +import org.hl7.fhir.exceptions.FHIRException; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.*; + +public class FhirPathEngineR4Test { + + private static FhirContext ourCtx = FhirContext.forR4(); + private static FHIRPathEngine ourEngine; + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirPathEngineTest.class); + + @Test + public void testAs() throws Exception { + Observation obs = new Observation(); + obs.setValue(new StringType("FOO")); + + List<Base> value = ourEngine.evaluate(obs, "Observation.value.as(String)"); + assertEquals(1, value.size()); + assertEquals("FOO", ((StringType)value.get(0)).getValue()); + } + + @Test + public void testExistsWithNoValue() throws FHIRException { + Patient patient = new Patient(); + patient.setDeceased(new BooleanType()); + List<Base> eval = ourEngine.evaluate(patient, "Patient.deceased.exists()"); + ourLog.info(eval.toString()); + assertFalse(((BooleanType)eval.get(0)).getValue()); + } + + @Test + public void testExistsWithValue() throws FHIRException { + Patient patient = new Patient(); + patient.setDeceased(new BooleanType(false)); + List<Base> eval = ourEngine.evaluate(patient, "Patient.deceased.exists()"); + ourLog.info(eval.toString()); + assertTrue(((BooleanType)eval.get(0)).getValue()); + } + + @Test + public void testConcatenation() throws FHIRException { + String exp = "Patient.name.family & '.'"; + + Patient p = new Patient(); + p.addName().setFamily("TEST"); + String result = ourEngine.evaluateToString(p, exp); + assertEquals("TEST.", result); + } + + @Test + public void testConcatenationFunction() throws FHIRException { + String exp = "element.first().path.startsWith(%resource.type) and element.tail().all(path.startsWith(%resource.type&'.'))"; + + StructureDefinition sd = new StructureDefinition(); + StructureDefinition.StructureDefinitionDifferentialComponent diff = sd.getDifferential(); + + diff.addElement().setPath("Patient.name"); + + + Patient p = new Patient(); + p.addName().setFamily("TEST"); + List<Base> result = ourEngine.evaluate(null, p, diff, exp); + ourLog.info(result.toString()); +// assertEquals("TEST.", result); + } + + + @AfterClass + public static void afterClassClearContext() throws Exception { + TestUtil.clearAllStaticFieldsForUnitTest(); + } + + @BeforeClass + public static void beforeClass() { + ourEngine = new FHIRPathEngine(new HapiWorkerContext(ourCtx, new DefaultProfileValidationSupport())); + } + +} diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/FhirInstanceValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java similarity index 97% rename from hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/FhirInstanceValidatorR4Test.java rename to hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java index 1d4d1e28ae5..73798c99109 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/FhirInstanceValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java @@ -1,4 +1,4 @@ -package ca.uhn.fhir.validation; +package org.hl7.fhir.r4.validation; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.empty; @@ -17,7 +17,12 @@ import java.io.InputStream; import java.util.*; import java.util.zip.GZIPInputStream; +import ca.uhn.fhir.validation.FhirValidator; +import ca.uhn.fhir.validation.ResultSeverityEnum; +import ca.uhn.fhir.validation.SingleValidationMessage; +import ca.uhn.fhir.validation.ValidationResult; import org.apache.commons.io.IOUtils; +import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidatorDstu3Test; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.hapi.ctx.*; import org.hl7.fhir.r4.hapi.ctx.IValidationSupport.CodeValidationResult; @@ -236,9 +241,9 @@ public class FhirInstanceValidatorR4Test { myVal.registerValidatorModule(myInstanceVal); - mySupportedCodeSystemsForExpansion = new HashMap<String, ValueSet.ValueSetExpansionComponent>(); + mySupportedCodeSystemsForExpansion = new HashMap<>(); - myValidConcepts = new ArrayList<String>(); + myValidConcepts = new ArrayList<>(); when(myMockSupport.expandValueSet(any(FhirContext.class), any(ConceptSetComponent.class))).thenAnswer(new Answer<ValueSetExpansionComponent>() { @Override @@ -533,6 +538,16 @@ public class FhirInstanceValidatorR4Test { assertEquals(output.toString(), 0, output.getMessages().size()); } + @Test + public void testValidateBundleWithNoType() throws Exception { + String vsContents = IOUtils.toString(FhirInstanceValidatorR4Test.class.getResourceAsStream("/r4/bundle-with-no-type.json"), "UTF-8"); + + ValidationResult output = myVal.validateWithResult(vsContents); + logResultsAndReturnNonInformationalOnes(output); + assertThat(output.getMessages().toString(), containsString("Element 'Bundle.type': minimum required = 1")); + } + + @Test public void testValidateRawXmlResourceWithEmptyPrimitive() { // @formatter:off diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/QuestionnaireResponseValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java similarity index 80% rename from hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/QuestionnaireResponseValidatorR4Test.java rename to hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java index 818cfcc5789..ea4529e984d 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/QuestionnaireResponseValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/QuestionnaireResponseValidatorR4Test.java @@ -1,57 +1,52 @@ -package ca.uhn.fhir.validation; +package org.hl7.fhir.r4.validation; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.util.TestUtil; +import ca.uhn.fhir.validation.FhirValidator; +import ca.uhn.fhir.validation.SingleValidationMessage; +import ca.uhn.fhir.validation.ValidationResult; +import org.apache.commons.io.IOUtils; +import org.hl7.fhir.r4.context.IWorkerContext; +import org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport; +import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext; +import org.hl7.fhir.r4.hapi.ctx.IValidationSupport; +import org.hl7.fhir.r4.hapi.ctx.IValidationSupport.CodeValidationResult; +import org.hl7.fhir.r4.hapi.ctx.ValidationSupportChain; +import org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator; +import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent; +import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType; +import org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent; +import org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus; +import org.hl7.fhir.r4.model.IdType; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.empty; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; +import static org.junit.Assert.*; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.io.IOUtils; -import org.hl7.fhir.dstu3.context.IWorkerContext; -import org.hl7.fhir.dstu3.hapi.validation.DefaultProfileValidationSupport; -import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator; -import org.hl7.fhir.dstu3.hapi.ctx.HapiWorkerContext; -import org.hl7.fhir.dstu3.hapi.ctx.IValidationSupport; -import org.hl7.fhir.dstu3.hapi.ctx.IValidationSupport.CodeValidationResult; -import org.hl7.fhir.dstu3.hapi.validation.ValidationSupportChain; -import org.hl7.fhir.dstu3.model.CodeSystem; -import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode; -import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; -import org.hl7.fhir.dstu3.model.CodeType; -import org.hl7.fhir.dstu3.model.Coding; -import org.hl7.fhir.dstu3.model.IntegerType; -import org.hl7.fhir.dstu3.model.Questionnaire; -import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent; -import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType; -import org.hl7.fhir.dstu3.model.QuestionnaireResponse; -import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent; -import org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus; -import org.hl7.fhir.dstu3.model.Reference; -import org.hl7.fhir.dstu3.model.StringType; -import org.hl7.fhir.dstu3.model.ValueSet; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.util.TestUtil; - public class QuestionnaireResponseValidatorR4Test { - private static DefaultProfileValidationSupport myDefaultValidationSupport = new DefaultProfileValidationSupport(); - - private static FhirContext ourCtx = FhirContext.forDstu3(); + public static final IdType ID_ICC_QUESTIONNAIRE_SETUP = new IdType("Questionnaire/profile"); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(QuestionnaireResponseValidatorR4Test.class); - + private static final String CODE_ICC_SCHOOLTYPE_PT = "PT"; + private static final IdType ID_VS_SCHOOLTYPE = new IdType("ValueSet/schooltype"); + private static final String SYSTEMURI_ICC_SCHOOLTYPE = "http://ehealthinnovation/icc/ns/schooltype"; + private static DefaultProfileValidationSupport myDefaultValidationSupport = new DefaultProfileValidationSupport(); + private static FhirContext ourCtx = FhirContext.forR4(); private FhirInstanceValidator myInstanceVal; private FhirValidator myVal; private IValidationSupport myValSupport; - private IWorkerContext myWorkerCtx; @Before @@ -59,28 +54,30 @@ public class QuestionnaireResponseValidatorR4Test { myValSupport = mock(IValidationSupport.class); // new DefaultProfileValidationSupport(); myWorkerCtx = new HapiWorkerContext(ourCtx, myValSupport); - + myVal = ourCtx.newValidator(); myVal.setValidateAgainstStandardSchema(false); myVal.setValidateAgainstStandardSchematron(false); ValidationSupportChain validationSupport = new ValidationSupportChain(myValSupport, myDefaultValidationSupport); myInstanceVal = new FhirInstanceValidator(validationSupport); - + myVal.registerValidatorModule(myInstanceVal); } + private ValidationResult stripBindingHasNoSourceMessage(ValidationResult theErrors) { List<SingleValidationMessage> messages = new ArrayList<SingleValidationMessage>(theErrors.getMessages()); for (int i = 0; i < messages.size(); i++) { if (messages.get(i).getMessage().contains("has no source, so can't")) { messages.remove(i); i--; - } + } } - + return new ValidationResult(ourCtx, messages); } + @Test public void testAnswerWithWrongType() { Questionnaire q = new Questionnaire(); @@ -177,9 +174,9 @@ public class QuestionnaireResponseValidatorR4Test { ValidationResult errors = myVal.validateWithResult(qa); ourLog.info(errors.toString()); - assertThat(errors.toString(), containsString("minimum required = 1, but only found 0 - QuestionnaireResponse.item")); + assertThat(errors.toString(), containsString("ERROR - No LinkId, so can't be validated - QuestionnaireResponse")); } - + @Test public void testItemWithNoType() { Questionnaire q = new Questionnaire(); @@ -248,7 +245,7 @@ public class QuestionnaireResponseValidatorR4Test { when(myValSupport.fetchResource(any(FhirContext.class), eq(ValueSet.class), eq("http://somevalueset"))).thenReturn(options); when(myValSupport.validateCode(any(FhirContext.class), eq("http://codesystems.com/system"), eq("code0"), any(String.class))).thenReturn(new CodeValidationResult(new ConceptDefinitionComponent(new CodeType("code0")))); - + QuestionnaireResponse qa; ValidationResult errors; @@ -375,6 +372,64 @@ public class QuestionnaireResponseValidatorR4Test { assertThat(errors.toString(), containsString("LinkId \"link1\" not found in questionnaire")); } + @Test + public void testValidateQuestionnaireResponseWithValueSetChoiceAnswer() { + /* + * Create valueset + */ + ValueSet iccSchoolTypeVs = new ValueSet(); + iccSchoolTypeVs.setId(ID_VS_SCHOOLTYPE); + iccSchoolTypeVs.getCompose().getIncludeFirstRep().setSystem(SYSTEMURI_ICC_SCHOOLTYPE); + iccSchoolTypeVs + .getCompose() + .getIncludeFirstRep() + .addConcept() + .setCode(CODE_ICC_SCHOOLTYPE_PT) + .setDisplay("Part Time"); + + /* + * Create Questionnaire + */ + Questionnaire questionnaire = new Questionnaire(); + { + questionnaire.setId(ID_ICC_QUESTIONNAIRE_SETUP); + + Questionnaire.QuestionnaireItemComponent basicGroup = questionnaire.addItem(); + basicGroup.setLinkId("basic"); + basicGroup.setType(Questionnaire.QuestionnaireItemType.GROUP); + basicGroup + .addItem() + .setLinkId("schoolType") + .setType(Questionnaire.QuestionnaireItemType.CHOICE) + .setOptions(new Reference(ID_VS_SCHOOLTYPE)) + .setRequired(true); + } + + /* + * Create response + */ + QuestionnaireResponse questionnaireResponse = new QuestionnaireResponse(); + questionnaireResponse.setStatus(QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED); + questionnaireResponse.setQuestionnaire(new Reference(ID_ICC_QUESTIONNAIRE_SETUP)); + questionnaireResponse.getSubject().setReference("Patient/123"); + + QuestionnaireResponse.QuestionnaireResponseItemComponent basicGroup = questionnaireResponse + .addItem(); + basicGroup.setLinkId("basic"); + basicGroup + .addItem() + .setLinkId("schoolType") + .addAnswer() + .setValue(new Coding(SYSTEMURI_ICC_SCHOOLTYPE, CODE_ICC_SCHOOLTYPE_PT, "")); + + when(myValSupport.fetchResource(any(FhirContext.class), eq(Questionnaire.class), eq(questionnaireResponse.getQuestionnaire().getReference()))).thenReturn(questionnaire); + when(myValSupport.fetchResource(any(FhirContext.class), eq(ValueSet.class), eq(ID_VS_SCHOOLTYPE.getValue()))).thenReturn(iccSchoolTypeVs); + ValidationResult errors = myVal.validateWithResult(questionnaireResponse); + + ourLog.info(errors.toString()); + assertThat(errors.toString(), containsString("No issues")); + } + // @Test public void validateHealthConnexExample() throws Exception { String input = IOUtils.toString(QuestionnaireResponseValidatorR4Test.class.getResourceAsStream("/questionnaireanswers-0f431c50ddbe4fff8e0dd6b7323625fc.xml")); @@ -389,19 +444,19 @@ public class QuestionnaireResponseValidatorR4Test { //@formatter:off input = input.replaceAll( "<answer>\n" + - " <valueCoding>\n" + - " <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" + - " <code value=\"2\"/>\n" + - " <display value=\"Once/twice\"/>\n" + - " </valueCoding>\n" + - " </answer>", - "<answer>\n" + - " <valueCoding>\n" + - " <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" + - " <code value=\"GGG\"/>\n" + - " <display value=\"Once/twice\"/>\n" + - " </valueCoding>\n" + - " </answer>"); + " <valueCoding>\n" + + " <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" + + " <code value=\"2\"/>\n" + + " <display value=\"Once/twice\"/>\n" + + " </valueCoding>\n" + + " </answer>", + "<answer>\n" + + " <valueCoding>\n" + + " <system value=\"f69573b8-cb63-4d31-85a4-23ac784735ab\"/>\n" + + " <code value=\"GGG\"/>\n" + + " <display value=\"Once/twice\"/>\n" + + " </valueCoding>\n" + + " </answer>"); assertThat(input, containsString("GGG")); //@formatter:on @@ -417,4 +472,5 @@ public class QuestionnaireResponseValidatorR4Test { TestUtil.clearAllStaticFieldsForUnitTest(); } + } diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/SchemaValidationR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchemaValidationR4Test.java similarity index 93% rename from hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/SchemaValidationR4Test.java rename to hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchemaValidationR4Test.java index 5df6a832cc7..917029b75b5 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/validation/SchemaValidationR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/SchemaValidationR4Test.java @@ -1,9 +1,11 @@ -package ca.uhn.fhir.validation; +package org.hl7.fhir.r4.validation; import static org.hamcrest.Matchers.containsString; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; +import ca.uhn.fhir.validation.FhirValidator; +import ca.uhn.fhir.validation.ValidationResult; import org.junit.AfterClass; import org.junit.Test; diff --git a/hapi-fhir-validation/src/test/resources/dstu3/bundle-with-no-type.json b/hapi-fhir-validation/src/test/resources/dstu3/bundle-with-no-type.json new file mode 100644 index 00000000000..64b109613f8 --- /dev/null +++ b/hapi-fhir-validation/src/test/resources/dstu3/bundle-with-no-type.json @@ -0,0 +1,73 @@ +{ + "resourceType": "Bundle", + "entry": [ + { + "fullUrl": "http://localhost:5555/phr/baseDstu3/Person/PERSON1", + "resource": { + "resourceType": "Person", + "id": "PERSON1", + "meta": { + "versionId": "1", + "lastUpdated": "2017-08-17T16:19:40.109+03:00" + }, + "identifier": [ + { + "value": "081181-9984" + } + ], + "name": [ + { + "text": "Anna Testi", + "family": "Testi", + "given": [ + "Anna" + ] + }, + { + "family": "asdfas" + } + ], + "telecom": [ + { + "use": "home" + }, + { + "system": "phone", + "value": "(044) 1234567", + "use": "work" + } + ], + "gender": "female", + "birthDate": "1981-11-08", + "address": [ + { + "line": [ + "Osuuspankkitie 2" + ], + "city": "Helsinki", + "postalCode": "00120", + "country": "Suomi" + }, + { + "city": "Blo-49847020" + } + ], + "active": true, + "link": [ + { + "target": { + "reference": "Patient/PATIENT1", + "display": "Anna Testi" + } + } + ] + }, + "request": { + "method": "PUT", + "url": "Person/PERSON1", + "ifMatch": "1" + } + } + ] +} + diff --git a/hapi-fhir-validation/src/test/resources/r4/bundle-with-no-type.json b/hapi-fhir-validation/src/test/resources/r4/bundle-with-no-type.json new file mode 100644 index 00000000000..64b109613f8 --- /dev/null +++ b/hapi-fhir-validation/src/test/resources/r4/bundle-with-no-type.json @@ -0,0 +1,73 @@ +{ + "resourceType": "Bundle", + "entry": [ + { + "fullUrl": "http://localhost:5555/phr/baseDstu3/Person/PERSON1", + "resource": { + "resourceType": "Person", + "id": "PERSON1", + "meta": { + "versionId": "1", + "lastUpdated": "2017-08-17T16:19:40.109+03:00" + }, + "identifier": [ + { + "value": "081181-9984" + } + ], + "name": [ + { + "text": "Anna Testi", + "family": "Testi", + "given": [ + "Anna" + ] + }, + { + "family": "asdfas" + } + ], + "telecom": [ + { + "use": "home" + }, + { + "system": "phone", + "value": "(044) 1234567", + "use": "work" + } + ], + "gender": "female", + "birthDate": "1981-11-08", + "address": [ + { + "line": [ + "Osuuspankkitie 2" + ], + "city": "Helsinki", + "postalCode": "00120", + "country": "Suomi" + }, + { + "city": "Blo-49847020" + } + ], + "active": true, + "link": [ + { + "target": { + "reference": "Patient/PATIENT1", + "display": "Anna Testi" + } + } + ] + }, + "request": { + "method": "PUT", + "url": "Person/PERSON1", + "ifMatch": "1" + } + } + ] +} + diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java index 40ee89dc323..efeeb8c4b38 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java @@ -233,11 +233,14 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, - IPrimitiveType<Date> theLastUpdated) { + public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, + IPrimitiveType<Date> theLastUpdated) { myBase = theServerBase; + if (myBundle.getIdElement().isEmpty()) { + myBundle.setId(theId); + } if (myBundle.getId().isEmpty()) { myBundle.setId(UUID.randomUUID().toString()); } diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ExamineTestTrace.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ExamineTestTrace.java index 4a1e9a74555..6f36d5b953d 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ExamineTestTrace.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ExamineTestTrace.java @@ -14,12 +14,18 @@ public class ExamineTestTrace { private static final Logger ourLog = LoggerFactory.getLogger(ExamineTestTrace.class); public static void main(String[] aaa) { - String input = "Running ca.uhn.fhir.model.primitive.BaseResourceReferenceDtTest\n" + - "Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.896 sec - in ca.uhn.fhir.rest.server.OperationServerWithSearchParamTypesDstu2Test"; + String input = "[INFO] Running ca.uhn.fhir.rest.client.RestfulClientFactoryDstu2Test\n" + + "[INFO] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.982 s - in ca.uhn.fhir.validation.ResourceValidatorDstu2Test"; Set<String> started = new HashSet<>(); Set<String> finished = new HashSet<>(); for (String next : input.split("\n")) { + if (next.startsWith("[INFO] ")) { + next = next.substring("[INFO] ".length()); + } + if (next.startsWith("[WARNING] ")) { + next = next.substring("[WARNING] ".length()); + } if (next.startsWith("Running ")) { started.add(next.substring("Running ".length())); } else if (next.startsWith("Tests run: ")) { @@ -27,7 +33,7 @@ public class ExamineTestTrace { } else if (isBlank(next)) { continue; } else { - throw new IllegalStateException(); + throw new IllegalStateException("Unknown line: " + next); } } diff --git a/hapi-tinder-plugin/src/main/resources/ca/uhn/fhir/model/dstu2/fhirversion.properties b/hapi-tinder-plugin/src/main/resources/ca/uhn/fhir/model/dstu2/fhirversion.properties index 0e8c4e7e745..5534dddc601 100644 --- a/hapi-tinder-plugin/src/main/resources/ca/uhn/fhir/model/dstu2/fhirversion.properties +++ b/hapi-tinder-plugin/src/main/resources/ca/uhn/fhir/model/dstu2/fhirversion.properties @@ -91,7 +91,6 @@ resource.Subscription=ca.uhn.fhir.model.dstu2.resource.Subscription resource.Substance=ca.uhn.fhir.model.dstu2.resource.Substance resource.SupplyDelivery=ca.uhn.fhir.model.dstu2.resource.SupplyDelivery resource.SupplyRequest=ca.uhn.fhir.model.dstu2.resource.SupplyRequest -resource.Test=ca.uhn.fhir.model.dstu2.resource.Test resource.TestScript=ca.uhn.fhir.model.dstu2.resource.TestScript resource.User=ca.uhn.fhir.model.dstu2.resource.User resource.ValueSet=ca.uhn.fhir.model.dstu2.resource.ValueSet diff --git a/hapi-tinder-plugin/src/main/resources/vm/jpa_resource_provider.vm b/hapi-tinder-plugin/src/main/resources/vm/jpa_resource_provider.vm index 7e61bbc9a44..90e1a6cf67e 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/jpa_resource_provider.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/jpa_resource_provider.vm @@ -41,7 +41,8 @@ public class ${className}ResourceProvider extends @Search(allowUnknownParams=true) public ca.uhn.fhir.rest.api.server.IBundleProvider search( javax.servlet.http.HttpServletRequest theServletRequest, - + javax.servlet.http.HttpServletResponse theServletResponse, + ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, @Description(shortDefinition="Search the contents of the resource's data using a fulltext search") @@ -154,7 +155,7 @@ public class ${className}ResourceProvider extends getDao().translateRawParameters(theAdditionalRawParams, paramMap); - ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails); + ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); return retVal; } finally { endRequest(theServletRequest); diff --git a/pom.xml b/pom.xml index d3e55664015..dab5976aeaa 100644 --- a/pom.xml +++ b/pom.xml @@ -362,6 +362,14 @@ <id>rhausam</id> <name>Rob Hausam</name> </developer> + <developer> + <id>patrick-werner</id> + <name>Patrick Werner</name> + </developer> + <developer> + <id>malcolmm83</id> + <name>Malcolm McRoberts</name> + </developer> </developers> <licenses> @@ -392,10 +400,9 @@ <lucene_version>5.5.4</lucene_version> <maven_assembly_plugin_version>2.5.3</maven_assembly_plugin_version> <maven_license_plugin_version>1.8</maven_license_plugin_version> - <maven_source_plugin_version>2.4</maven_source_plugin_version> <phloc_schematron_version>2.7.1</phloc_schematron_version> <phloc_commons_version>4.4.11</phloc_commons_version> - <spring_version>4.3.10.RELEASE</spring_version> + <spring_version>5.0.0.RELEASE</spring_version> <spring-boot.version>1.5.6.RELEASE</spring-boot.version> <thymeleaf-version>3.0.7.RELEASE</thymeleaf-version> @@ -426,32 +433,32 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> - <version>2.8.1</version> + <version>2.9.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> - <version>2.8.1</version> + <version>2.9.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <version>2.8.1</version> + <version>2.9.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr310</artifactId> - <version>2.8.1</version> + <version>2.9.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-yaml</artifactId> - <version>2.8.1</version> + <version>2.9.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.module</groupId> <artifactId>jackson-module-jaxb-annotations</artifactId> - <version>2.8.1</version> + <version>2.9.2</version> </dependency> <dependency> <groupId>com.icegreen</groupId> @@ -1002,6 +1009,11 @@ <build> <pluginManagement> <plugins> + <plugin> + <groupId>org.basepom.maven</groupId> + <artifactId>duplicate-finder-maven-plugin</artifactId> + <version>1.2.1</version> + </plugin> <plugin> <groupId>de.juplo</groupId> <artifactId>hibernate-maven-plugin</artifactId> @@ -1113,7 +1125,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> - <version>3.0.0</version> + <version>3.0.1</version> <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> @@ -1125,7 +1137,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.19.1</version> + <version>2.20.1</version> <configuration> <redirectTestOutputToFile>true</redirectTestOutputToFile> <runOrder>random</runOrder> @@ -1136,7 +1148,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> - <version>3.0.0</version> + <version>3.2.0</version> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> @@ -1649,7 +1661,6 @@ <artifactId>maven-scm-api</artifactId> <version>1.9.5</version> </dependency> - <!-- <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-core</artifactId> <version>1.7</version> </dependency> --> <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-module-markdown</artifactId> @@ -1689,17 +1700,11 @@ </execution> </executions> </plugin> - <!-- <plugin> <groupId>com.github.github</groupId> <artifactId>site-maven-plugin</artifactId> <version>0.12</version> <configuration> <message>Building site for ${project.version}</message> <server>github</server> - </configuration> <executions> <execution> <goals> <goal>site</goal> </goals> <phase>site-deploy</phase> </execution> </executions> </plugin> --> </plugins> </build> <reporting> <plugins> - <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <reportSets> <reportSet> <reports><report>checkstyle-aggregate</report></reports> </reportSet> - </reportSets> <configuration> <configLocation>config/sun_checks.xml</configLocation> <includes> hapi-fhir-base/src/main/java/**/*.java </includes> </configuration> </plugin> --> - <!-- <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.7.7.201606060606</version> <reportSets> <reportSet> <reports> <report>report</report> </reports> <configuration> - <dataFileIncludes>${baseDir}/hapi-fhir-base/target/jacoco.exec</dataFileIncludes> </configuration> </reportSet> </reportSets> </plugin> --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> @@ -1917,6 +1922,9 @@ </profile> <profile> <id>ERRORPRONE</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> <build> <plugins> <plugin> diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 99b8f3473c3..65d74758394 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -7,10 +7,193 @@ </properties> <body> <release version="3.1.0" date="TBD"> + <action type="add"> + The version of a few dependencies have been bumped to the + latest versions (dependent HAPI modules listed in brackets): + <![CDATA[ + <ul> + <li>Spring (JPA): 4.3.10 -> 5.0.0</li> + <li>Jackson (JPA): 2.8.1 -> 2.9.2</li> + </ul> + ]]> + </action> + <action type="fix"> + The Android client module has been restored to working order, and no longer + requires a special classifier or an XML parser to be present in order to + work. This means that the hapi-fhir-android library is much less likely + to cause conflicts with other libraries imported into an Android application + via Gradle. + <![CDATA[<br/><br/>]]> + See the + <![CDATA[<a href="http://hapifhir.io/doc_android.html">HAPI FHIR Android Documentation</a>]]> + for more information. As a part of this fix, all dependencies on + the StAX API have been removed in environments where StAX is not + present (such as Android). The client will now detect this case, and + explicitly request JSON payloads from servers, meaning that Android clients + no longer need to include two parser stacks + </action> <action type="add"> A performance to the JPA server has been made which reduces the number - of changes to index tables when updating a resource with contents that - only make minor changes + of writes to index tables when updating a resource with contents that + only make minor changes to the resource content. In many cases this can + noticeably improve update performance. + </action> + <action type="fix"> + In FHIR DSTU3 the + <![CDATA[<code>ValueSet/$expand?identifier=foo</code>]]> + and + <![CDATA[<code>ValueSet/$validate-code?identifier=foo</code>]]> + parameters were changed to + <![CDATA[<code>ValueSet/$expand?url=foo</code>]]> + and + <![CDATA[<code>ValueSet/$validate-code?url=foo</code>]]> + respectively, but the JPA server had not caught up. The + JPA DSTU3 server has been adjusted to accept either "identifier" + or "url" (with "url" taking precedence), and the JPA R4 server + has been changed to only accept "url". + Thanks to Avinash Shanbhag for reporting! + </action> + <action type="fix" issue="744"> + Fix an error in JPA server when using Derby Database, where search queries with + a search URL longer than 255 characters caused a mysterious failure. Thanks to + Chris Schuler and Bryn Rhodes for all of their help in reproducing this issue. + </action> + <action type="add"> + JPA server now supports the use of the + <![CDATA[<code>Cache-Control</code>]]> + header in order to allow the client to selectively disable the + search result cache. This directive can also be used to disable result paging + and return results faster when only a small number of results is needed. + See the + <![CDATA[<a href="http://hapifhir.io/doc_jpa.html">JPA Page</a>]]> + for more information. + </action> + <action type="fix"> + In certain cases in the JPA server, if multiple threads all attempted to + update the same resource simultaneously, the optimistic lock failure caused + a "gap" in the history numbers to occur. This would then cause a mysterious + failure when trying to update this resource further. This has been + resolved. + </action> + <action type="add"> + JPA Server search/history results now set the ID of the returned Bundle to + the ID of the search, meaning that if a search returns results from the Query + cache, it will reuse the ID of the previously returned Bundle + </action> + <action type="fix"> + Fix a NullPointerException when validating a Bundle (in DSTU3/R4) with no + <![CDATA[<code>Bundle.type</code>]]> value + </action> + <action type="add"> + The JPA server transaction operation (DSTU3/R4) did not correctly process the + If-Match header when passed in via + <![CDATA[<code>Bundle.entry.request.ifMatch</code>]]> value + </action> + <action type="add"> + In Apache client, remove a log message at WARN level when the response does not + specify a charset. This log line often showed up any time a server was not supplying + a response, making client logs quite noisy + </action> + <action type="add"> + A new configuration item has been added to the JPA server DaoConfig + called + <![CDATA[<code>getCountSearchResultsUpTo()</code>]]>. + This setting governs how many search results the search + coordinator should try to find before returning an initial + search response to the user, which has an effect on whether + the + <![CDATA[<code>Bundle.total</code>]]> + field is always populated in search responses. This has now + been set to 20000 on out public server (fhirtest.uhn.ca) + so most search results should now include a total. + </action> + <action type="fix"> + Remove a bunch of exceptions in the org.hl7.fhir.exception package from the + hapi-fhir-base module, as they were also duplicated in the + hapi-fhir-utilities module. + </action> + <action type="add"> + The DSTU2 XhtmlDt type has been modified so that it no longer uses + the StAX XMLEvent type as its internal model, and instead simply uses + a String. New methods called "parse" and "encode" have been added + to HAPI FHIR's XmlUtil class, which can be used to convert + between a String and an XML representatio. This should allow + HAPI FHIR to run in environments where StAX is not available, such + as Android phones. + </action> + <action type="add" issue="761"> + Restored the + <![CDATA[<code>org.hl7.fhir.r4.model.codesystem.*</code>]]> + classes (which are Java Enums for the various FHIR codesystems). + These were accidentally removed in HAPI FHIR 3.0.0. Thanks to + GitHub user @CarthageKing for reporting! + </action> + <action type="fix"> + The resource Profile Validator has been enhanced to not try to validate + bound fields where the binding strength is "example", and a crash was + resolved when validating QuestionnaireResponse answers with a type + of "choice" where the choice was bound to a ValueSet. + </action> + <action type="fix"> + Remove the fake "Test" resource from DSTU2 structures. This was not + a real resource type, and caused conflicts with the .NET client. Thanks to + Vlad Ignatov for reporting! + </action> + <action type="fix" issue="720"> + Parsing a DSTU3/R4 custom structure which contained a field of + a custom type caused a crash during parsing. Thanks to + GitHub user @mosaic-hgw for reporting! + </action> + <action type="add" issue="711"> + Client logic for checking the version of the connected + server to ensure it is for the correct version of FHIR now + includes a check for R4 servers. Thanks to Clayton Bodendein + for the pull request, including a number of great tests! + </action> + <action type="add" issue="714"> + JAX-RS client framework now supports the ability to + register your own JAX-RS Component Classes against the client, + as well as better documentation about thread safety. Thanks + to Sébastien Rivière for the pull request! + </action> + <action type="fix" issue="717"> + Processing of the If-Modified-Since header on FHIR read operations was reversed, + returning a 304 when the resource had been modified recently. Thanks to + Michael Lawley for the pull request! + </action> + <action type="add"> + Add <![CDATA[<code>Prefer</code> and <code>Cache-Control</code>]]> to the list of headers which are declared as + being acceptable for CORS requests in CorsInterceptor, CLI, and JPA Example. + Thanks to Patrick Werner for the pull request! + </action> + <action type="fix" issue="725"> + DSTU2-hl7org and DSTU2.1 structures did not copy resource IDs when invoking + copyValues(). Thanks to Clayton Bodendein for the pull request! + </action> + <action type="fix" issue="734"> + When encoding a Binary resource, the Binary.securityContext field + was not encoded correctly. Thanks to Malcolm McRoberts for the pull + request with fix and test case! + </action> + <action type="add"> + Bundle resources did not have their version encoded when serializing + in FHIR resource (XML/JSON) format. + </action> + <action type="add"> + The Binary resource endpoint now supports the `X-Security-Context` header when + reading or writing Binary contents using their native Content-Type (i.e exchanging + the raw binary with the server, as opposed to exchanging a FHIR resource). + </action> + <action type="fix"> + When paging through multiple pages of search results, if the + client had requested a subset of resources to be returned using the + <![CDATA[<code>_elements</code>]]> parameter, the elements list + was lost after the first page of results. + In addition, elements will not remove elements from + search/history Bundles (i.e. elements from the Bundle itself, as opposed + to elements in the entry resources) unless the Bundle elements are + explicitly listed, e.g. <![CDATA[<code>_include=Bundle.total</code>]]>. + Thanks to @parisni for reporting! </action> </release> <release version="3.0.0" date="2017-09-27"> diff --git a/src/site/xdoc/doc_android.xml.vm b/src/site/xdoc/doc_android.xml.vm index b46abcaa89a..007a9a89a8f 100644 --- a/src/site/xdoc/doc_android.xml.vm +++ b/src/site/xdoc/doc_android.xml.vm @@ -1,93 +1,117 @@ -<?xml version="1.0" encoding="UTF-8"?> -<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd"> - - <properties> - <title>Android Support - James Agnew - - - - -
- -

- HAPI now has a specially built binary (JAR) which can be used on Android. Android developers - may use this JAR to take advantage of the FHIR model classes, and the FHIR client (running a FHIR server - on Android is not yet supported. Help wanted!) -

- -

- The Android JAR ships as a "shade JAR", meaning it is a single JAR containing all of the - dependencies required in order to use HAPI FHIR. You should not need to include any other - libraries. -

-

- Note that the Android JAR is still new and hasn't received as much testing as other - parts of the library. We would greatly appreciate feedback, testing, etc. Also note that - because mobile apps run on less powerful hardware compared to desktop and server applications, - it is all the more important to keep a single instance of the FhirContext - around for good performance, since this object is expensive to create. We are hoping to - improve performance of the creation of this object in a future release. If you are an - Android developer and would like to help with this, please get in touch! -

- - - -

- To add the HAPI library via Gradle, use the following - dependency. Note the following things: -

-
    -
  • The classifier should be set to the version of FHIR you want to support.
  • -
  • - You need to excluded a few things in order to get this to work. This is - a quirk because the way HAPI is built and will hopefully be resolved in a future - release. -
  • -
- - -

- You may also download a copy from the GitHub - Releases page. -

-
-
- -
-

- On mobile devices, performance problems are particularly noticeable. This - is made worse by the fact that some Android devices have much slower performance - than modern desktop computers. See the - Client Configuration Performance - page for some tips on how to improve client performance. -

-
- -
- -

- The following is intended to be a selection of publicly available open source - Android applications which use HAPI FHIR and might be useful as a reference. -

-

- If you know of others, please let us know! -

- - -
- - - - + + + + + Android Support + James Agnew + + + + +
+ +

+ HAPI now has a specially built module for use on Android. Android developers + may use this JAR to take advantage of the FHIR model classes, and the FHIR client (running a FHIR server + on Android is not yet supported. Get in touch if this is something you are interested in working on!) +

+ +

+ As of HAPI FHIR 3.1.0, the hapi-fhir-android module has been streamlined in order + to reduce its footprint. Previous versions of the library included both an XML and a JSON parser + but this has been streamlined to only include JSON support in order to reduce the number of + libraries required in an Android build. +

+ +

+ When using the HAPI FHIR Android client, the client will request only JSON responses + (via the HTTP Accept header) and will not be able to communicate + with FHIR servers that support only XML encoding (few, if any, servers actually exist + with this limitation that we are aware of). +

+ +

+ The Android client also uses the hapi-fhir-client-okhttp module, + which is an HTTP client based on the OkHttp library. This library has proven to be + more powerful and less likely to cause issues on Android than the Apache HttpClient + implementation which is bundled by default. +

+ +

+ Note that the Android JAR is still new and hasn't received as much testing as other + parts of the library. We would greatly appreciate feedback, testing, etc. Also note that + because mobile apps run on less powerful hardware compared to desktop and server applications, + it is all the more important to keep a single instance of the FhirContext + around for good performance, since this object is expensive to create. We are hoping to + improve performance of the creation of this object in a future release. If you are an + Android developer and would like to help with this, please get in touch! +

+ + + +

+ To add the HAPI library via Gradle, you should add the + hapi-fhir-android + library to your Gradle file, as well as a structures library for the appropriate + version of FHIR that you want to support, e.g. + hapi-fhir-structures-dstu3. +

+ + +

+ Uou will also need to manually exclude the Woodstox StAX library from + inclusion, as this library uses namespaces which are prohibited on Android. You should also + exclude +

+ + +

+ To see a sample Gradle file for a working Android project + using HAPI FHIR, see the + Android Integration Test + project. +

+
+
+ +
+

+ On mobile devices, performance problems are particularly noticeable. This + is made worse by the fact that some economy Android devices have much slower performance + than modern desktop computers. See the + Client Configuration Performance + page for some tips on how to improve client performance. +

+
+ +
+ +

+ The following is intended to be a selection of publicly available open source + Android applications which use HAPI FHIR and might be useful as a reference. +

+

+ If you know of others, please let us know! +

+ + +
+ + + +
diff --git a/src/site/xdoc/doc_jpa.xml b/src/site/xdoc/doc_jpa.xml index ae2a9b8db84..d1eb338dfa9 100644 --- a/src/site/xdoc/doc_jpa.xml +++ b/src/site/xdoc/doc_jpa.xml @@ -1,315 +1,372 @@ - - - - - JPA Server - James Agnew - - - - -
- -

- The HAPI FHIR - RestfulServer - module can be used to create a FHIR server endpoint against an arbitrary - data source, which could be a database of your own design, an existing - clinical system, a set of files, or anything else you come up with. -

-

- HAPI also provides a persistence module which can be used to - provide a complete RESTful server implementation, backed by a database of - your choosing. This module uses the JPA 2.0 - API to store data in a database without depending on any specific database technology. -

-

- Important Note: - This implementation uses a fairly simple table design, with a - single table being used to hold resource bodies (which are stored as - CLOBs, optionally GZipped to save space) and a set of tables to hold search indexes, tags, - history details, etc. This design is only one of many possible ways - of designing a FHIR server so it is worth considering whether it - is appropriate for the problem you are trying to solve. -

- - - -

- The easiest way to get started with HAPI's JPA server module is - to begin with the example project. There is a complete sample project - found in our GitHub repo here: hapi-fhir-jpaserver-example -

- -

- This example is a fully contained FHIR server, supporting all standard operations (read/create/delete/etc). - It bundles an embedded instance of the Apache Derby Java database - so that the server can run without depending on any external database, but it can also be - configured to use an installation of Oracle, Postgres, etc. -

- -

- To take this project for a spin, check out the sources from GitHib (or download a snapshot), - and then build the project: -

- - - -

- You now have two options for starting the server: -

-
    -
  • - Deploy to Tomcat/JBoss/Websphere/etc: You will now have a file - in your target directory called hapi-fhir-jpaserver-example.war. - This WAR file can be deployed to any Servlet container, at which point you could - access the server by pointing your browser at a URL similar to the following - (you may need to adjust the - port depending on which port your container is configured to listen on): - http://localhost:8080/hapi-fhir-jpaserver-example/ -
  • -
  • - Run with Maven and Embedded Jetty: To start the server - directly within Maven, you can execute the following command:
    - $ mvn jetty:run - You can then access the server by pointing your browser at the following URL: - http://localhost:8080/hapi-fhir-jpaserver-example/ -
  • -
-
-
- -
- -

- The JPA server is configured through a series of configuration files, most - of which are documented inline. -

- - -
- -
- -

- The Spring confguration contains a definition for a bean called daoConfig, - which will look something like the following: -

- - -

- You can use this method to change various configuration settings on the DaoConfig bean - which define the way that the JPA server will behave. - See the DaoConfig JavaDoc - for information about the available settings. -

- - - -

- Clients may sometimes post resources to your server that contain - absolute resource references. For example, consider the following resource: -

- - - - - - - - - - -]]> - -

- By default, the server will reject this reference, as only - local references are permitted by the server. This can be changed - however. -

-

- If you want the server to recognize that this URL is actually a local - reference (i.e. because the server will be deployed to the base URL - http://example.com/fhir/) you can - configure the server to recognize this URL via the following DaoConfig - setting: -

- - -

- On the other hand, if you want the server to be configurable to - allow remote references, you can set this with the confguration below. - Using the setAllowExternalReferences means that - it will be possible to search for references that refer to these - external references. -

- - -
- - - -

- In some cases, you may have references which are Logical References, - which means that they act as an identifier and not necessarily as a literal - web address. -

-

- A common use for logical references is in references to conformance - resources, such as ValueSets, StructureDefinitions, etc. For example, - you might refer to the ValueSet - http://hl7.org/fhir/ValueSet/quantity-comparator - from your own resources. In this case, you are not neccesarily telling - the server that this is a real address that it should resolve, but - rather that this is an identifier for a ValueSet where - ValueSet.url has the given URI/URL. -

-

- HAPI can be configured to treat certain URI/URL patterns as - logical by using the DaoConfig#setTreatReferencesAsLogical property - (see JavaDoc). - For example: -

- - // Treat specific URL as logical - myDaoConfig.getTreatReferencesAsLogical().add("http://mysystem.com/ValueSet/cats-and-dogs"); - - // Treat all references with given prefix as logical - myDaoConfig.getTreatReferencesAsLogical().add("http://mysystem.com/mysystem-vs-*"); - -
- -
- -
- - Architecture - -

- The HAPI JPA Server has the following components: -

- -
    -
  • - Resource Providers: - A RESTful server Resource Provider is - provided for each resource type in a given release of FHIR. Each resource provider implements - a - @Search - method implementing the complete set of search parameters defined in the FHIR - specification for the given resource type.

    - The resource providers also extend a superclass which implements all of the - other FHIR methods, such as Read, Create, Delete, etc.

    - Note that these resource providers are generated as a part of the HAPI build process, - so they are not checked into Git. You can see their source - in the JXR Report, - for example the - PatientResourceProvider. -

    - The resource providers do not actually implement any of the logic - in searching, updating, etc. They simply receive the incoming HTTP calls (via the RestfulServer) - and pass along the incoming requests to the DAOs. -

    -
  • -
  • - HAPI DAOs: - The DAOs actually implement all of the database business logic relating to - the storage, indexing, and retrieval of FHIR resources, using the underlying JPA - API. -

    -
  • -
  • - Hibernate: - The HAPI JPA Server uses the JPA library, implemented by Hibernate. No Hibernate - specific features are used, so the library should also work with other - providers (e.g. Eclipselink) but it is not tested regularly with them. -

    -
  • -
  • - Database: - The RESTful server uses an embedded Derby database, but can be configured to - talk to - any database supported by Hibernate. -
  • - -
- -
- -
- -
    -
  • - This page - has information on loading national editions (UK specifically) of SNOMED CT files into - the database. -
  • -
- -
- - - - - -
+ + + + + JPA Server + James Agnew + + + + +
+ +

+ The HAPI FHIR + RestfulServer + module can be used to create a FHIR server endpoint against an arbitrary + data source, which could be a database of your own design, an existing + clinical system, a set of files, or anything else you come up with. +

+

+ HAPI also provides a persistence module which can be used to + provide a complete RESTful server implementation, backed by a database of + your choosing. This module uses the JPA 2.0 + API to store data in a database without depending on any specific database technology. +

+

+ Important Note: + This implementation uses a fairly simple table design, with a + single table being used to hold resource bodies (which are stored as + CLOBs, optionally GZipped to save space) and a set of tables to hold search indexes, tags, + history details, etc. This design is only one of many possible ways + of designing a FHIR server so it is worth considering whether it + is appropriate for the problem you are trying to solve. +

+ + + +

+ The easiest way to get started with HAPI's JPA server module is + to begin with the example project. There is a complete sample project + found in our GitHub repo here: hapi-fhir-jpaserver-example +

+ +

+ This example is a fully contained FHIR server, supporting all standard operations (read/create/delete/etc). + It bundles an embedded instance of the Apache Derby Java database + so that the server can run without depending on any external database, but it can also be + configured to use an installation of Oracle, Postgres, etc. +

+ +

+ To take this project for a spin, check out the sources from GitHib (or download a snapshot), + and then build the project: +

+ + + +

+ You now have two options for starting the server: +

+
    +
  • + Deploy to Tomcat/JBoss/Websphere/etc: You will now have a file + in your target directory called hapi-fhir-jpaserver-example.war. + This WAR file can be deployed to any Servlet container, at which point you could + access the server by pointing your browser at a URL similar to the following + (you may need to adjust the + port depending on which port your container is configured to listen on): + http://localhost:8080/hapi-fhir-jpaserver-example/ +
  • +
  • + Run with Maven and Embedded Jetty: To start the server + directly within Maven, you can execute the following command:
    + $ mvn jetty:run + You can then access the server by pointing your browser at the following URL: + http://localhost:8080/hapi-fhir-jpaserver-example/ +
  • +
+
+
+ +
+ +

+ The JPA server is configured through a series of configuration files, most + of which are documented inline. +

+ + +
+ +
+ +

+ The Spring confguration contains a definition for a bean called daoConfig, + which will look something like the following: +

+ + +

+ You can use this method to change various configuration settings on the DaoConfig bean + which define the way that the JPA server will behave. + See the DaoConfig JavaDoc + for information about the available settings. +

+ + + +

+ Clients may sometimes post resources to your server that contain + absolute resource references. For example, consider the following resource: +

+ + + + + + + + + + +]]> + +

+ By default, the server will reject this reference, as only + local references are permitted by the server. This can be changed + however. +

+

+ If you want the server to recognize that this URL is actually a local + reference (i.e. because the server will be deployed to the base URL + http://example.com/fhir/) you can + configure the server to recognize this URL via the following DaoConfig + setting: +

+ + +

+ On the other hand, if you want the server to be configurable to + allow remote references, you can set this with the confguration below. + Using the setAllowExternalReferences means that + it will be possible to search for references that refer to these + external references. +

+ + +
+ + + +

+ In some cases, you may have references which are Logical References, + which means that they act as an identifier and not necessarily as a literal + web address. +

+

+ A common use for logical references is in references to conformance + resources, such as ValueSets, StructureDefinitions, etc. For example, + you might refer to the ValueSet + http://hl7.org/fhir/ValueSet/quantity-comparator + from your own resources. In this case, you are not neccesarily telling + the server that this is a real address that it should resolve, but + rather that this is an identifier for a ValueSet where + ValueSet.url has the given URI/URL. +

+

+ HAPI can be configured to treat certain URI/URL patterns as + logical by using the DaoConfig#setTreatReferencesAsLogical property + (see JavaDoc). + For example: +

+
+
+					// Treat specific URL as logical
+					myDaoConfig.getTreatReferencesAsLogical().add("http://mysystem.com/ValueSet/cats-and-dogs");
+					
+					// Treat all references with given prefix as logical
+					myDaoConfig.getTreatReferencesAsLogical().add("http://mysystem.com/mysystem-vs-*");
+				
+
+ +
+ + + +

+ By default, search results will be cached for one minute. This means that + if a client performs a search for Patient?name=smith and gets back + 500 results, if a client performs the same search within 60000 milliseconds the + previously loaded search results will be returned again. This also means that + any new Patient resources named "Smith" within the last minute will not be + reflected in the results. +

+

+ Under many normal scenarios this is a n acceptable performance tradeoff, + but in some cases it is not. If you want to disable caching, you have two + options: +

+

Globally Disable / Change Caching Timeout

+

+ You can change the global cache using the following setting: +

+
+
+					myDaoConfig.setReuseCachedSearchResultsForMillis(null);
+				
+
+

Disable Cache at the Request Level

+

+ Clients can selectively disable caching for an individual request + using the Cache-Control header: +

+
+
+					Cache-Control: nocache
+				
+
+

Disable Paging at the Request Level

+

+ If the client knows that they will only want a small number of results + (for example, a UI containing 20 results is being shown and the client + knows that they will never load the next page of results) the client + may also use the nostore directive along with a HAPI FHIR + extension called max-results in order to specify that + only the given number of results should be fetched. This directive + disabled paging entirely for the request and causes the request to + return immediately when the given number of results is found. This + can cause a noticeable performance improvement in some cases. +

+
+
+						Cache-Control: nostore, max-results=20
+					
+
+ +
+ +
+ +
+ + Architecture + +

+ The HAPI JPA Server has the following components: +

+ +
    +
  • + Resource Providers: + A RESTful server Resource Provider is + provided for each resource type in a given release of FHIR. Each resource provider implements + a + @Search + method implementing the complete set of search parameters defined in the FHIR + specification for the given resource type.

    + The resource providers also extend a superclass which implements all of the + other FHIR methods, such as Read, Create, Delete, etc.

    + Note that these resource providers are generated as a part of the HAPI build process, + so they are not checked into Git. You can see their source + in the JXR Report, + for example the + PatientResourceProvider. +

    + The resource providers do not actually implement any of the logic + in searching, updating, etc. They simply receive the incoming HTTP calls (via the RestfulServer) + and pass along the incoming requests to the DAOs. +

    +
  • +
  • + HAPI DAOs: + The DAOs actually implement all of the database business logic relating to + the storage, indexing, and retrieval of FHIR resources, using the underlying JPA + API. +

    +
  • +
  • + Hibernate: + The HAPI JPA Server uses the JPA library, implemented by Hibernate. No Hibernate + specific features are used, so the library should also work with other + providers (e.g. Eclipselink) but it is not tested regularly with them. +

    +
  • +
  • + Database: + The RESTful server uses an embedded Derby database, but can be configured to + talk to + any database supported by Hibernate. +
  • + +
+ +
+ +
+ +
    +
  • + This page + has information on loading national editions (UK specifically) of SNOMED CT files into + the database. +
  • +
+ +
+ + + + + +
diff --git a/src/site/xdoc/doc_rest_client.xml b/src/site/xdoc/doc_rest_client.xml index 28dc0366781..7a350d2a808 100644 --- a/src/site/xdoc/doc_rest_client.xml +++ b/src/site/xdoc/doc_rest_client.xml @@ -1,539 +1,567 @@ - - - - - RESTful Client - James Agnew - - - - - -
- - - -

- HAPI provides a built-in mechanism for connecting to FHIR RESTful - servers. - The HAPI RESTful client is designed to be easy to set up and - to allow strong - compile-time type checking wherever possible. -

- -

- There are two types of RESTful clients provided by HAPI: - The Fluent/Generic client (described below) and - the Annotation - client. - The generic client is simpler to use - and generally provides the faster way to get started. The annotation-driven - client relies on static binding to specific operations to - give better compile-time checking against servers with a specific set of capabilities - exposed. This second model takes more effort to use, but can be useful - if the person defining the specific methods to invoke is not the same person - who is using those methods. -

- -
- -
- -

- Creating a generic client simply requires you to create an instance of - FhirContext and use that to instantiate a client. -

-

- The following example shows how to create a client, and a few operations which - can be performed. -

- - - - - - -

- Performance Tip: Note that FhirContext is an expensive object to create, - so you should try to keep an instance around for the lifetime of your application. It - is thread-safe so it can be passed as needed. Client instances, on the other hand, - are very inexpensive to create so you can create a new one for each request if needed - (although there is no requirement to do so, clients are reusable and thread-safe as well). -

- - -

- The generic client supports queries using a fluent interface - which is inspired by the fantastic - .NET FHIR API. - The fluent interface allows you to construct powerful queries by chaining - method calls together, leading to highly readable code. It also allows - you to take advantage of intellisense/code completion in your favourite - IDE. -

-

- Note that most fluent operations end with an execute() - statement which actually performs the invocation. You may also invoke - several configuration operations just prior to the execute() statement, - such as encodedJson() or encodedXml(). -

-
- - - -

- Searching for resources is probably the most common initial scenario for - client applications, so we'll start the demonstration there. The FHIR search - operation generally uses a URL with a set of predefined search parameters, - and returns a Bundle containing zero-or-more resources which matched the - given search criteria. -

-

- Search is a very powerful mechanism, with advanced features such as paging, - including linked resources, etc. See the FHIR - search specification - for more information. -

- -

- Note on Bundle types: As of DSTU2, FHIR defines Bundle as a resource - instead of an Atom feed as it was in DSTU1. In code that was written for - DSTU1 you would typically use the ca.uhn.fhir.model.api.Bundle - class to represent a bundle, and that is that default return type for search - methods. If you are implemeting a DSTU2+ server, is recommended to use a - Bundle resource class instead (e.g. ca.uhn.fhir.model.dstu2.resource.Bundle - or org.hl7.fhir.instance.model.Bundle). Many of the examples below include - a chained invocation similar to - .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class), which - instructs the search method which bundle type should be returned. -

- -

- The following example shows how to query using the generic client: -

- - - - - -

Search - Multi-valued Parameters (ANY/OR)

-

- To search for a set of possible values where ANY should be matched, - you can provide multiple values to a parameter, as shown in the example below. - This leads to a URL resembling ?family=Smith,Smyth -

- - - - - -

Search - Multi-valued Parameters (ALL/AND)

-

- To search for a set of possible values where ALL should be matched, - you can provide multiple instances of a parameter, as shown in the example below. - This leads to a URL resembling ?address=Toronto&address=Ontario&address=Canada -

- - - - - -

Search - Paging

-

- If the server supports paging results, the client has a page method - which can be used to load subsequent pages. -

- - - - - -

Search - Composite Parameters

-

- If a composite parameter is being searched on, the parameter - takes a "left" and "right" operand, each of which is - a parameter from the resource being seached. The following example shows the - syntax. -

- - - - - -

Search - By plain URL

-

- You can also perform a search using a String URL, instead - of using the fluent method calls to build the URL. This - can be useful if you have a URL you retrieved from - somewhere else that you want to use as a search. -

- - - - - -

Search - Other Query Options

-

- The fluent search also has methods for sorting, limiting, specifying - JSON encoding, _include, _revinclude, _lastUpdated, _tag, etc. -

- - - - - -

Search - Using HTTP POST

-

- The FHIR specification allows the use of an HTTP POST to transmit a search to a server instead of - using - an HTTP GET. With this style of search, the search parameters are included in the request body - instead - of the request URL, which can be useful if you need to transmit a search with a large number - of parameters. -

-

- The usingStyle() method controls which style to use. By default, GET style is used - unless the client detects that the request would result in a very long URL (over 8000 chars) in which - case the client automatically switches to POST. -

-

- An alternate form of the search URL (using a URL ending with_search) was also - supported in FHIR DSTU1. This form is no longer valid in FHIR DSTU2, but HAPI retains support - for using this form in order to interoperate with servers which use it. -

- - - - - -

Search - Compartments

-

- To search a - resource compartment, - simply use the withIdAndCompartment - method in your search. -

- - - - - -

Search - Subsetting (_summary and _elements)

-

- Sometimes you may want to only ask the server to include some parts of returned - resources (instead of the whole resource). Typically this is for performance or - optimization reasons, but there may also be privacy reasons for doing this. -

-

- To request that the server return only "summary" elements (those elements - defined in the specification with the "Σ" flag), you can use the - summaryMode(SummaryEnum) qualifier: -

- - - - -

- To request that the server return only elements from a custom list - provided by the client, you can use the elementsSubset(String...) - qualifier: -

- - - - - -
- - -

- The following example shows how to perform a create - operation using the generic client: -

- - - - - -

Conditional Creates

-

- FHIR also specifies a type of update called "conditional create", where - a set of search parameters are provided and a new resource is only - created if no existing resource matches those parameters. See the - FHIR specification for more information on conditional creation. -

- - - - -
- - -

- Given a resource name and ID, it is simple to retrieve - the latest version of that resource (a 'read') -

- - - - -

- By adding a version string, it is also possible to retrieve a - specific version (a 'vread') -

- - - - -

- It is also possible to retrieve a resource given its absolute - URL (this will override the base URL set on the client) -

- - - - - -

- See also the page on - ETag Support - for information on specifying a matching version in the - client request. -

- -
- - -

- The following example shows how to perform a delete - operation using the generic client: -

- - - - -

Conditional Deletes

-

- Conditional deletions are also possible, which is a form where - instead of deleting a resource using its logical ID, you specify - a set of search criteria and a single resource is deleted if - it matches that criteria. Note that this is not a mechanism - for bulk deletion; see the FHIR specification for information - on conditional deletes and how they are used. -

- - - - -
- - -

- Updating a resource is similar to creating one, except that - an ID must be supplied since you are updating a previously - existing resource instance. -

-

- The following example shows how to perform an update - operation using the generic client: -

- - - - - -

Conditional Updates

-

- FHIR also specifies a type of update called "conditional updates", where - insetad of using the logical ID of a resource to update, a set of - search parameters is provided. If a single resource matches that set of - parameters, that resource is updated. See the FHIR specification for - information on how conditional updates work. -

- - - - - -

ETags and Resource Contention

-

- See also the page on - ETag Support - for information on specifying a matching version in the - client request. -

- -
- - -

- To retrieve the version history of all resources, or all resources of a given type, or - of a specific instance of a resource, you call the history() - method. -

- - - - - -

- If you are using a DSTU2 compliant server, you should instead use the - Bundle resource which is found in the DSTU2 structures JAR, as shown - in the syntax below. Note that in both cases, the class name is Bundle, - but the DSTU2 bundle is found in the .resources. package. -

- - - - - -

- You can also optionally request that only resource versions - later than a given date, and/or only up to a given count (number) - of resource versions be returned. -

- - - - -
- - -

- The following example shows how to execute a transaction using the generic client: -

- - - - -
- - -

- To retrieve the server's conformance statement, simply call the conformance() - method as shown below. -

- - - - -
-
- -
-

- In the FHIR DSTU2 version, operations (referred to as "extended operations") - were added. These operations are an RPC style of invocation, with a set of - named input parameters passed to the server and a set of named output - parameters returned back. -

-

- To invoke an operation using the client, you simply need to create the - input - Parameters - resource, then pass that to the operation() fluent method. -

-

- The example below shows a simple operation call. -

- - - - - -

- Note that if the operation does not require any input parameters, - you may also invoke the operation using the following form. Note that - the withNoParameters still requires you to provide the - type of the Parameters resource so that it can return the correct type in - the response. -

- - - - - - -

- By default, the client will invoke operations using the HTTP POST form. - The FHIR specification also allows requests to use the HTTP GET verb - if the operation is idempotent and has no composite/resource parameters. - Use the following form to invoke operation with HTTP GET. -

- - - - -
- - -

- The $validate operation asks the server to test a given resource - to see if it would be acceptable as a create/update on that server. - The client has built-in support for this operation. -

-

- If the client is in DSTU1 mode, the method below will invoke the - DSTU1 validation style instead. -

- - - - - - -
- - -

- The $process-message operation asks the server to accept a fhir - message bundle for processing. -

- - - - - - -
- -
- - - -
+ + + + + RESTful Client + James Agnew + + + + + +
+ + + +

+ HAPI provides a built-in mechanism for connecting to FHIR RESTful + servers. + The HAPI RESTful client is designed to be easy to set up and + to allow strong + compile-time type checking wherever possible. +

+ +

+ There are two types of RESTful clients provided by HAPI: + The Fluent/Generic client (described below) and + the Annotation + client. + The generic client is simpler to use + and generally provides the faster way to get started. The annotation-driven + client relies on static binding to specific operations to + give better compile-time checking against servers with a specific set of capabilities + exposed. This second model takes more effort to use, but can be useful + if the person defining the specific methods to invoke is not the same person + who is using those methods. +

+ +
+ +
+ +

+ Creating a generic client simply requires you to create an instance of + FhirContext and use that to instantiate a client. +

+

+ The following example shows how to create a client, and a few operations which + can be performed. +

+ + + + + + +

+ Performance Tip: Note that FhirContext is an expensive object to create, + so you should try to keep an instance around for the lifetime of your application. It + is thread-safe so it can be passed as needed. Client instances, on the other hand, + are very inexpensive to create so you can create a new one for each request if needed + (although there is no requirement to do so, clients are reusable and thread-safe as well). +

+ + +

+ The generic client supports queries using a fluent interface + which is inspired by the fantastic + .NET FHIR API. + The fluent interface allows you to construct powerful queries by chaining + method calls together, leading to highly readable code. It also allows + you to take advantage of intellisense/code completion in your favourite + IDE. +

+

+ Note that most fluent operations end with an execute() + statement which actually performs the invocation. You may also invoke + several configuration operations just prior to the execute() statement, + such as encodedJson() or encodedXml(). +

+
+ + + +

+ Searching for resources is probably the most common initial scenario for + client applications, so we'll start the demonstration there. The FHIR search + operation generally uses a URL with a set of predefined search parameters, + and returns a Bundle containing zero-or-more resources which matched the + given search criteria. +

+

+ Search is a very powerful mechanism, with advanced features such as paging, + including linked resources, etc. See the FHIR + search specification + for more information. +

+ +

+ Note on Bundle types: As of DSTU2, FHIR defines Bundle as a resource + instead of an Atom feed as it was in DSTU1. In code that was written for + DSTU1 you would typically use the ca.uhn.fhir.model.api.Bundle + class to represent a bundle, and that is that default return type for search + methods. If you are implemeting a DSTU2+ server, is recommended to use a + Bundle resource class instead (e.g. ca.uhn.fhir.model.dstu2.resource.Bundle + or org.hl7.fhir.instance.model.Bundle). Many of the examples below include + a chained invocation similar to + .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class), which + instructs the search method which bundle type should be returned. +

+ +

+ The following example shows how to query using the generic client: +

+ + + + + +

Search - Multi-valued Parameters (ANY/OR)

+

+ To search for a set of possible values where ANY should be matched, + you can provide multiple values to a parameter, as shown in the example below. + This leads to a URL resembling ?family=Smith,Smyth +

+ + + + + +

Search - Multi-valued Parameters (ALL/AND)

+

+ To search for a set of possible values where ALL should be matched, + you can provide multiple instances of a parameter, as shown in the example below. + This leads to a URL resembling ?address=Toronto&address=Ontario&address=Canada +

+ + + + + +

Search - Paging

+

+ If the server supports paging results, the client has a page method + which can be used to load subsequent pages. +

+ + + + + +

Search - Composite Parameters

+

+ If a composite parameter is being searched on, the parameter + takes a "left" and "right" operand, each of which is + a parameter from the resource being seached. The following example shows the + syntax. +

+ + + + + +

Search - By plain URL

+

+ You can also perform a search using a String URL, instead + of using the fluent method calls to build the URL. This + can be useful if you have a URL you retrieved from + somewhere else that you want to use as a search. +

+ + + + + +

Search - Other Query Options

+

+ The fluent search also has methods for sorting, limiting, specifying + JSON encoding, _include, _revinclude, _lastUpdated, _tag, etc. +

+ + + + + +

Search - Using HTTP POST

+

+ The FHIR specification allows the use of an HTTP POST to transmit a search to a server instead of + using + an HTTP GET. With this style of search, the search parameters are included in the request body + instead + of the request URL, which can be useful if you need to transmit a search with a large number + of parameters. +

+

+ The usingStyle() method controls which style to use. By default, GET style is used + unless the client detects that the request would result in a very long URL (over 8000 chars) in which + case the client automatically switches to POST. +

+

+ An alternate form of the search URL (using a URL ending with_search) was also + supported in FHIR DSTU1. This form is no longer valid in FHIR DSTU2, but HAPI retains support + for using this form in order to interoperate with servers which use it. +

+ + + + + +

Search - Compartments

+

+ To search a + resource compartment, + simply use the withIdAndCompartment + method in your search. +

+ + + + + +

Search - Subsetting (_summary and _elements)

+

+ Sometimes you may want to only ask the server to include some parts of returned + resources (instead of the whole resource). Typically this is for performance or + optimization reasons, but there may also be privacy reasons for doing this. +

+

+ To request that the server return only "summary" elements (those elements + defined in the specification with the "Σ" flag), you can use the + summaryMode(SummaryEnum) qualifier: +

+ + + + +

+ To request that the server return only elements from a custom list + provided by the client, you can use the elementsSubset(String...) + qualifier: +

+ + + + + +
+ + +

+ The following example shows how to perform a create + operation using the generic client: +

+ + + + + +

Conditional Creates

+

+ FHIR also specifies a type of update called "conditional create", where + a set of search parameters are provided and a new resource is only + created if no existing resource matches those parameters. See the + FHIR specification for more information on conditional creation. +

+ + + + +
+ + +

+ Given a resource name and ID, it is simple to retrieve + the latest version of that resource (a 'read') +

+ + + + +

+ By adding a version string, it is also possible to retrieve a + specific version (a 'vread') +

+ + + + +

+ It is also possible to retrieve a resource given its absolute + URL (this will override the base URL set on the client) +

+ + + + + +

+ See also the page on + ETag Support + for information on specifying a matching version in the + client request. +

+ +
+ + +

+ The following example shows how to perform a delete + operation using the generic client: +

+ + + + +

Conditional Deletes

+

+ Conditional deletions are also possible, which is a form where + instead of deleting a resource using its logical ID, you specify + a set of search criteria and a single resource is deleted if + it matches that criteria. Note that this is not a mechanism + for bulk deletion; see the FHIR specification for information + on conditional deletes and how they are used. +

+ + + + +
+ + +

+ Updating a resource is similar to creating one, except that + an ID must be supplied since you are updating a previously + existing resource instance. +

+

+ The following example shows how to perform an update + operation using the generic client: +

+ + + + + +

Conditional Updates

+

+ FHIR also specifies a type of update called "conditional updates", where + insetad of using the logical ID of a resource to update, a set of + search parameters is provided. If a single resource matches that set of + parameters, that resource is updated. See the FHIR specification for + information on how conditional updates work. +

+ + + + + +

ETags and Resource Contention

+

+ See also the page on + ETag Support + for information on specifying a matching version in the + client request. +

+ +
+ + +

+ To retrieve the version history of all resources, or all resources of a given type, or + of a specific instance of a resource, you call the history() + method. +

+ + + + + +

+ If you are using a DSTU2 compliant server, you should instead use the + Bundle resource which is found in the DSTU2 structures JAR, as shown + in the syntax below. Note that in both cases, the class name is Bundle, + but the DSTU2 bundle is found in the .resources. package. +

+ + + + + +

+ You can also optionally request that only resource versions + later than a given date, and/or only up to a given count (number) + of resource versions be returned. +

+ + + + +
+ + +

+ The following example shows how to execute a transaction using the generic client: +

+ + + + +
+ + +

+ To retrieve the server's conformance statement, simply call the conformance() + method as shown below. +

+ + + + +
+
+ +
+

+ In the FHIR DSTU2 version, operations (referred to as "extended operations") + were added. These operations are an RPC style of invocation, with a set of + named input parameters passed to the server and a set of named output + parameters returned back. +

+

+ To invoke an operation using the client, you simply need to create the + input + Parameters + resource, then pass that to the operation() fluent method. +

+

+ The example below shows a simple operation call. +

+ + + + + +

+ Note that if the operation does not require any input parameters, + you may also invoke the operation using the following form. Note that + the withNoParameters still requires you to provide the + type of the Parameters resource so that it can return the correct type in + the response. +

+ + + + + + +

+ By default, the client will invoke operations using the HTTP POST form. + The FHIR specification also allows requests to use the HTTP GET verb + if the operation is idempotent and has no composite/resource parameters. + Use the following form to invoke operation with HTTP GET. +

+ + + + +
+ + +

+ The $validate operation asks the server to test a given resource + to see if it would be acceptable as a create/update on that server. + The client has built-in support for this operation. +

+

+ If the client is in DSTU1 mode, the method below will invoke the + DSTU1 validation style instead. +

+ + + + + + +
+ + +

+ The $process-message operation asks the server to accept a fhir + message bundle for processing. +

+ + + + + + +
+ +
+ +
+ +

+ This section contains ways of customizing the request sent by the client +

+ + + +

+ The Cache-Control header can be used by the client in a request + to signal to the server (or any cache in front of it) that the client wants specific + behaviour from the cache, or wants the cache to not act on the request altogether. + Naturally, not all servers will honour this header. +

+ +

+ To add a cache control directive in a request: +

+ + + + + + +
+ +
+ + + +